Camera capture (agent)

Mayros agent workflows के लिए camera capture का समर्थन करता है:

  • iOS node (Gateway के माध्यम से paired): node.invoke के माध्यम से photo (jpg) या short video clip (mp4, वैकल्पिक audio के साथ) capture करें।
  • Android node (Gateway के माध्यम से paired): node.invoke के माध्यम से photo (jpg) या short video clip (mp4, वैकल्पिक audio के साथ) capture करें।
  • macOS app (Gateway के माध्यम से node): node.invoke के माध्यम से photo (jpg) या short video clip (mp4, वैकल्पिक audio के साथ) capture करें।

सभी camera access user-controlled settings के पीछे gated है।

iOS node

User setting (डिफ़ॉल्ट on)

  • iOS Settings tab → CameraAllow Camera (camera.enabled)
    • डिफ़ॉल्ट: on (missing key को enabled के रूप में treat किया जाता है)।
    • जब off: camera.* commands CAMERA_DISABLED return करते हैं।

Commands (Gateway node.invoke के माध्यम से)

  • camera.list

    • Response payload:
      • devices: { id, name, position, deviceType } की array
  • camera.snap

    • Params:
      • facing: front|back (डिफ़ॉल्ट: front)
      • maxWidth: number (वैकल्पिक; iOS node पर डिफ़ॉल्ट 1600)
      • quality: 0..1 (वैकल्पिक; डिफ़ॉल्ट 0.9)
      • format: वर्तमान में jpg
      • delayMs: number (वैकल्पिक; डिफ़ॉल्ट 0)
      • deviceId: string (वैकल्पिक; camera.list से)
    • Response payload:
      • format: "jpg"
      • base64: "<...>"
      • width, height
    • Payload guard: photos को recompressed किया जाता है ताकि base64 payload 5 MB से कम रहे।
  • camera.clip

    • Params:
      • facing: front|back (डिफ़ॉल्ट: front)
      • durationMs: number (डिफ़ॉल्ट 3000, अधिकतम 60000 तक clamped)
      • includeAudio: boolean (डिफ़ॉल्ट true)
      • format: वर्तमान में mp4
      • deviceId: string (वैकल्पिक; camera.list से)
    • Response payload:
      • format: "mp4"
      • base64: "<...>"
      • durationMs
      • hasAudio

Foreground requirement

canvas.* की तरह, iOS node केवल foreground में camera.* commands की अनुमति देता है। Background invocations NODE_BACKGROUND_UNAVAILABLE return करते हैं।

CLI helper (temp files + MEDIA)

Attachments प्राप्त करने का सबसे आसान तरीका CLI helper के माध्यम से है, जो decoded media को temp file में लिखता है और MEDIA:<path> print करता है।

उदाहरण:

bash
mayros nodes camera snap --node <id>               # डिफ़ॉल्ट: दोनों front + back (2 MEDIA lines)
mayros nodes camera snap --node <id> --facing front
mayros nodes camera clip --node <id> --duration 3000
mayros nodes camera clip --node <id> --no-audio

नोट्स:

  • nodes camera snap agent को दोनों views देने के लिए दोनों facings को default करता है।
  • Output files temporary हैं (OS temp directory में) जब तक आप अपना wrapper नहीं बनाते।

macOS app

User setting (डिफ़ॉल्ट off)

macOS companion app एक checkbox expose करता है:

  • Settings → General → Allow Camera (mayros.cameraEnabled)
    • डिफ़ॉल्ट: off
    • जब off: camera requests "Camera disabled by user" return करते हैं।

CLI helper (node invoke)

macOS node पर camera commands invoke करने के लिए main mayros CLI का उपयोग करें।

उदाहरण:

bash
mayros nodes camera list --node <id>            # camera ids list करें
mayros nodes camera snap --node <id>            # MEDIA:<path> print करता है
mayros nodes camera snap --node <id> --max-width 1280
mayros nodes camera snap --node <id> --delay-ms 2000
mayros nodes camera clip --node <id> --duration 10s          # MEDIA:<path> print करता है
mayros nodes camera clip --node <id> --no-audio

Safety + practical limits

  • Camera और microphone access सामान्य OS permission prompts trigger करते हैं (और Info.plist में usage strings की आवश्यकता होती है)।
  • Video clips capped हैं (वर्तमान में <= 60s) oversized node payloads (base64 overhead + message limits) से बचने के लिए।