Community translations by veiseule.ai — Help improve them on Crowdin
Skip to main content

boshqa kontekstlardan qayta foydalanish (mahalliy skriptlar, kelajakdagi desktop ilova va h.k.)

OpenClaw shell buyruqlarini exec vositasi orqali ishga tushiradi va uzoq davom etadigan vazifalarni xotirada saqlaydi. process vositasi esa ushbu fon sessiyalarini boshqaradi.

exec tool

Asosiy parametrlar:

  • command (majburiy)
  • yieldMs (standart 10000): ushbu kechikishdan so‘ng avtomatik ravishda fon rejimiga o‘tkaziladi
  • background (bool): darhol fon rejimida ishga tushirish
  • timeout (soniya, standart 1800): ushbu vaqt tugagach jarayonni to‘xtatadi
  • elevated (bool): agar elevated rejimi yoqilgan/ruxsat berilgan bo‘lsa, hostda ishga tushirish
  • Fon ijrosi + Jarayon asbobi Set pty: true.
  • Haqiqiy TTY kerakmi?

Behavior:

  • Foreground runs return output directly.
  • When backgrounded (explicit or timeout), the tool returns status: "running" + sessionId and a short tail.
  • Output is kept in memory until the session is polled or cleared.
  • If the process tool is disallowed, exec runs synchronously and ignores yieldMs/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)
    1. PI_BASH_JOB_TTL_MS: yakunlangan sessiyalar uchun TTL (ms, 1 daqiqa–3 soat oralig‘ida cheklangan)
  1. Konfiguratsiya (tavsiya etiladi):
    1. tools.exec.backgroundMs (standart 10000)
    1. tools.exec.timeoutSec (standart 1800)
    1. tools.exec.cleanupMs (standart 1800000)
    1. tools.exec.notifyOnExit (standart true): fon rejimidagi exec yakunlanganda tizim hodisasini navbatga qo‘shadi va heartbeat so‘raydi.

7. process vositasi

  1. Amallar:
    1. list: ishlayotgan + yakunlangan sessiyalar
    1. poll: sessiya uchun yangi chiqishni chiqarib tashlash (shuningdek chiqish holatini bildiradi)
    1. log: yig‘ilgan chiqishni o‘qish (offset + limit qo‘llab-quvvatlanadi)
    1. write: stdin yuborish (data, ixtiyoriy eof)
    1. kill: fon sessiyasini to‘xtatish
    1. clear: yakunlangan sessiyani xotiradan olib tashlash
    1. remove: agar ishlayotgan bo‘lsa o‘ldiradi, aks holda yakunlangan bo‘lsa tozalaydi
  1. Eslatmalar:
    1. Faqat fon rejimidagi sessiyalar ro‘yxatga olinadi va xotirada saqlanadi.
    1. Jarayon qayta ishga tushirilganda sessiyalar yo‘qoladi (diskda saqlanmaydi).
    1. Sessiya jurnallari faqat process poll/log ishga tushirilganda va vosita natijasi yozib olinganda chat tarixiga saqlanadi.
    1. process agent bo‘yicha cheklangan; u faqat shu agent boshlagan sessiyalarni ko‘radi.
    1. process list tez ko‘zdan kechirish uchun hosila name (buyruq fe’li + maqsad) ni o‘z ichiga oladi.
    1. process log qatorlarga asoslangan offset/limit dan foydalanadi (offsetni qoldirsangiz, oxirgi N qator olinadi).

23. Misollar

  1. Uzoq vazifani ishga tushiring va keyinroq so‘rov qiling:
25. { "tool": "exec", "command": "sleep 5 && echo done", "yieldMs": 1000 }
26. { "tool": "process", "action": "poll", "sessionId": "<id>" }
  1. Darhol fon rejimida boshlash:
28. { "tool": "exec", "command": "npm run build", "background": true }
  1. stdin yuborish:
30. { "tool": "process", "action": "write", "sessionId": "<id>", "data": "y\n" }