exec टूल के माध्यम से शेल कमांड चलाता है और लंबे समय तक चलने वाले कार्यों को मेमरी में रखता है। process टूल उन पृष्ठभूमि सत्रों को प्रबंधित करता है।
exec टूल
मुख्य पैरामीटर:command(आवश्यक)yieldMs(डिफ़ॉल्ट 10000): इस विलंब के बाद अपने-आप पृष्ठभूमि में चला जाता हैbackground(bool): तुरंत पृष्ठभूमि में चलाएंtimeout(सेकंड, डिफ़ॉल्टtools.exec.timeoutSec): इस टाइमआउट के बाद प्रक्रिया को समाप्त करें; केवल उस कॉल के लिए exec प्रक्रिया टाइमआउट अक्षम करने हेतुtimeout: 0सेट करेंelevated(bool): यदि elevated मोड सक्षम/अनुमत है, तो sandbox के बाहर चलाएं (डिफ़ॉल्ट रूप सेgateway, या जब exec लक्ष्यnodeहो तोnode)- वास्तविक TTY चाहिए?
pty: trueसेट करें। workdir,env
- अग्रभूमि में चलने वाली प्रक्रियाएं सीधे आउटपुट लौटाती हैं।
- पृष्ठभूमि में जाने पर (स्पष्ट रूप से या टाइमआउट से), टूल
status: "running"+sessionIdऔर एक छोटा tail लौटाता है। - पृष्ठभूमि और
yieldMsरनtools.exec.timeoutSecविरासत में लेते हैं, जब तक कॉल स्पष्टtimeoutप्रदान नहीं करती। - आउटपुट सत्र के पोल या साफ़ किए जाने तक मेमरी में रखा जाता है।
- यदि
processटूल अनुमत नहीं है, तोexecसमकालिक रूप से चलता है औरyieldMs/backgroundको अनदेखा करता है। - Spawn किए गए exec कमांड context-aware शेल/profile नियमों के लिए
OPENCLAW_SHELL=execप्राप्त करते हैं। - लंबे समय तक चलने वाले ऐसे काम के लिए जो अभी शुरू होता है, उसे एक बार शुरू करें और सक्षम होने पर automatic completion wake पर भरोसा करें, जब कमांड आउटपुट देता है या विफल होता है।
- यदि automatic completion wake उपलब्ध नहीं है, या आपको ऐसे कमांड के लिए quiet-success
पुष्टि चाहिए जो बिना आउटपुट के साफ़ तौर पर समाप्त हुआ, तो पूर्णता की पुष्टि के लिए
processका उपयोग करें। - reminders या विलंबित follow-ups को
sleeploops या बार-बार polling से emulate न करें; भविष्य के काम के लिए cron का उपयोग करें।
चाइल्ड प्रोसेस ब्रिजिंग
exec/process टूल्स के बाहर लंबे समय तक चलने वाली child processes spawn करते समय (उदाहरण के लिए, CLI respawns या gateway helpers), child-process bridge helper जोड़ें ताकि termination signals forward किए जाएं और exit/error पर listeners अलग किए जाएं। इससे systemd पर orphaned processes से बचाव होता है और shutdown व्यवहार platforms में सुसंगत रहता है। Environment overrides:OPENCLAW_BASH_YIELD_MS: डिफ़ॉल्ट yield (ms)OPENCLAW_BASH_MAX_OUTPUT_CHARS: in-memory output cap (chars)OPENCLAW_BASH_PENDING_MAX_OUTPUT_CHARS: प्रति stream pending stdout/stderr cap (chars)OPENCLAW_BASH_JOB_TTL_MS: finished sessions के लिए TTL (ms, 1m–3h तक bounded)OPENCLAW_PROCESS_INPUT_WAIT_IDLE_MS: writable background sessions को संभवतः input की प्रतीक्षा में चिह्नित करने से पहले idle-output threshold (डिफ़ॉल्ट 15000 ms)
tools.exec.backgroundMs(डिफ़ॉल्ट 10000)tools.exec.timeoutSec(डिफ़ॉल्ट 1800)tools.exec.cleanupMs(डिफ़ॉल्ट 1800000)tools.exec.notifyOnExit(डिफ़ॉल्ट true): जब backgrounded exec exit करता है, तो system event enqueue करें + Heartbeat request करें।tools.exec.notifyOnExitEmptySuccess(डिफ़ॉल्ट false): true होने पर, उन successful backgrounded runs के लिए भी completion events enqueue करें जिन्होंने कोई output नहीं बनाया।
process टूल
क्रियाएं:list: running + finished sessionspoll: किसी session के लिए नया output drain करें (exit status भी report करता है)log: aggregated output पढ़ें और input recovery hints दिखाएं (offset+limitसमर्थित)write: stdin भेजें (data, वैकल्पिकeof)send-keys: PTY-backed session को explicit key tokens या bytes भेजेंsubmit: PTY-backed session को Enter / carriage return भेजेंpaste: literal text भेजें, वैकल्पिक रूप से bracketed paste mode में wrappedkill: background session समाप्त करेंclear: finished session को मेमरी से हटाएंremove: running हो तो kill करें, अन्यथा finished हो तो clear करें
- केवल backgrounded sessions मेमरी में listed/persisted होते हैं।
- process restart पर sessions खो जाते हैं (disk persistence नहीं)।
- Session logs केवल तब chat history में save होते हैं जब आप
process poll/logचलाते हैं और tool result record होता है। processप्रति agent scoped है; यह केवल उस agent द्वारा शुरू किए गए sessions देखता है।- automatic completion wake अनुपलब्ध होने पर status, logs, quiet-success confirmation, या
completion confirmation के लिए
poll/logका उपयोग करें। - interactive CLI recover करने से पहले
logका उपयोग करें ताकि वर्तमान transcript, stdin state, और input-wait hint साथ में दिखाई दें। - जब आपको input या intervention की आवश्यकता हो, तो
write/send-keys/submit/paste/killका उपयोग करें। process listquick scans के लिए derivedname(command verb + target) शामिल करता है।process list,poll, औरlogwaitingForInputकेवल तब report करते हैं जब session में अभी भी writable stdin हो और वह input-wait threshold से अधिक समय तक idle रहा हो।process logline-basedoffset/limitका उपयोग करता है।- जब
offsetऔरlimitदोनों छोड़े जाते हैं, तो यह अंतिम 200 lines लौटाता है और paging hint शामिल करता है। - जब
offsetदिया जाता है औरlimitछोड़ा जाता है, तो यहoffsetसे अंत तक लौटाता है (200 तक capped नहीं)। - Polling on-demand status के लिए है, wait-loop scheduling के लिए नहीं। यदि काम बाद में होना चाहिए, तो इसके बजाय cron का उपयोग करें।