MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / LocalShellTask

Class LocalShellTask

src/tasks/local_shell.py:101–128  ·  view source on GitHub ↗

Minimal ``Task`` adapter for ``local_bash`` entries. Chunk B / WI-2.1 is intentionally a one-method shim: ``kill`` translates a registry lookup into a SIGTERM (and, on follow-ups, a SIGKILL ladder). The heavy spawn/reap logic stays in ``tool_system/tools/bash/background`` so the bas

Source from the content-addressed store, hash-verified

99
100
101class LocalShellTask:
102 """Minimal ``Task`` adapter for ``local_bash`` entries.
103
104 Chunk B / WI-2.1 is intentionally a one-method shim: ``kill`` translates
105 a registry lookup into a SIGTERM (and, on follow-ups, a SIGKILL ladder).
106 The heavy spawn/reap logic stays in ``tool_system/tools/bash/background``
107 so the bash machinery isn't moved across chunks.
108 """
109
110 name: str = "LocalShellTask"
111 type: Literal["local_bash"] = "local_bash"
112
113 async def kill(
114 self, task_id: str, registry: "RuntimeTaskRegistry"
115 ) -> None:
116 state = registry.get(task_id)
117 if not is_local_shell_task(state):
118 return
119 assert isinstance(state, LocalShellTaskState) # narrow for mypy
120 proc = state.proc
121 if proc is None:
122 return
123 if proc.poll() is not None:
124 return
125 try:
126 os.killpg(os.getpgid(proc.pid), 15)
127 except (ProcessLookupError, PermissionError):
128 return
129
130
131# Per Chunk-C N1 fold-in: registration moved to

Callers 2

__init__.pyFile · 0.90

Calls

no outgoing calls

Tested by 1