boshqa kontekstlardan qayta foydalanish (mahalliy skriptlar, kelajakdagi desktop ilova va h.k.)
OpenClaw runs shell commands through theexec tool and keeps long‑running tasks in memory. The process tool manages those background sessions.
exec tool
Key parameters:command(required)yieldMs(default 10000): auto‑background after this delaybackground(bool): background immediatelytimeout(seconds, default 1800): kill the process after this timeoutelevated(bool): run on host if elevated mode is enabled/allowed- Fon ijrosi + Jarayon asbobi Set
pty: true. - Haqiqiy TTY kerakmi?
- Foreground runs return output directly.
- When backgrounded (explicit or timeout), the tool returns
status: "running"+sessionIdand a short tail. - Output is kept in memory until the session is polled or cleared.
- If the
processtool is disallowed,execruns synchronously and ignoresyieldMs/background.
Child process bridging
When spawning long-running child processes outside the exec/process tools (for example, CLI respawns or gateway helpers), attach the child-process bridge helper so termination signals are forwarded and listeners are detached on exit/error. This avoids orphaned processes on systemd and keeps shutdown behavior consistent across platforms. Environment overrides:PI_BASH_YIELD_MS: default yield (ms)PI_BASH_MAX_OUTPUT_CHARS: in‑memory output cap (chars)OPENCLAW_BASH_PENDING_MAX_OUTPUT_CHARS: pending stdout/stderr cap per stream (chars)-
PI_BASH_JOB_TTL_MS: yakunlangan sessiyalar uchun TTL (ms, 1 daqiqa–3 soat oralig‘ida cheklangan)
- Konfiguratsiya (tavsiya etiladi):
-
tools.exec.backgroundMs(standart 10000)
-
tools.exec.timeoutSec(standart 1800)
-
tools.exec.cleanupMs(standart 1800000)
-
tools.exec.notifyOnExit(standart true): fon rejimidagi exec yakunlanganda tizim hodisasini navbatga qo‘shadi va heartbeat so‘raydi.
tools.exec.notifyOnExitEmptySuccess(standart false): true bo‘lganda, hech qanday chiqish bermagan muvaffaqiyatli background rejimdagi ishga tushirishlar uchun ham yakunlanish hodisalarini navbatga qo‘shadi.
7. process vositasi
- Amallar:
-
list: ishlayotgan + yakunlangan sessiyalar
-
poll: sessiya uchun yangi chiqishni chiqarib tashlash (shuningdek chiqish holatini bildiradi)
-
log: yig‘ilgan chiqishni o‘qish (offset+limitqo‘llab-quvvatlanadi)
-
write: stdin yuborish (data, ixtiyoriyeof)
-
kill: fon sessiyasini to‘xtatish
-
clear: yakunlangan sessiyani xotiradan olib tashlash
-
remove: agar ishlayotgan bo‘lsa o‘ldiradi, aks holda yakunlangan bo‘lsa tozalaydi
- Eslatmalar:
-
- Faqat fon rejimidagi sessiyalar ro‘yxatga olinadi va xotirada saqlanadi.
-
- Jarayon qayta ishga tushirilganda sessiyalar yo‘qoladi (diskda saqlanmaydi).
-
- Sessiya jurnallari faqat
process poll/logishga tushirilganda va vosita natijasi yozib olinganda chat tarixiga saqlanadi.
- Sessiya jurnallari faqat
-
processagent bo‘yicha cheklangan; u faqat shu agent boshlagan sessiyalarni ko‘radi.
-
process listtez ko‘zdan kechirish uchun hosilaname(buyruq fe’li + maqsad) ni o‘z ichiga oladi.
process logqatorga asoslanganoffset/limitdan foydalanadi.offsetvalimitikkalasi ham ko‘rsatilmasa, oxirgi 200 qatorni qaytaradi va sahifalash bo‘yicha ko‘rsatma qo‘shadi.offsetko‘rsatilgan valimitko‘rsatilmagan bo‘lsa,offsetdan oxirigacha qaytaradi (200 bilan cheklanmaydi).
23. Misollar
- Uzoq vazifani ishga tushiring va keyinroq so‘rov qiling:
- Darhol fon rejimida boshlash:
- stdin yuborish: