skimpyclaw 0.3.14 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/README.md +47 -37
  2. package/dist/__tests__/adapter-types.test.d.ts +4 -0
  3. package/dist/__tests__/adapter-types.test.js +63 -0
  4. package/dist/__tests__/anthropic-adapter.test.d.ts +4 -0
  5. package/dist/__tests__/anthropic-adapter.test.js +264 -0
  6. package/dist/__tests__/api.test.js +0 -1
  7. package/dist/__tests__/cli.integration.test.js +2 -4
  8. package/dist/__tests__/cli.test.js +0 -1
  9. package/dist/__tests__/code-agents-notifications.test.js +137 -0
  10. package/dist/__tests__/code-agents-parser.test.js +19 -1
  11. package/dist/__tests__/code-agents-preflight.test.js +3 -28
  12. package/dist/__tests__/code-agents-utils.test.js +34 -9
  13. package/dist/__tests__/code-agents-worktrees.test.js +116 -0
  14. package/dist/__tests__/codex-adapter.test.js +184 -0
  15. package/dist/__tests__/codex-auth.test.js +66 -0
  16. package/dist/__tests__/codex-provider-gating.test.js +35 -0
  17. package/dist/__tests__/codex-unified-loop.test.js +111 -0
  18. package/dist/__tests__/config-security.test.js +127 -0
  19. package/dist/__tests__/config.test.js +23 -0
  20. package/dist/__tests__/context-manager.test.js +243 -164
  21. package/dist/__tests__/cron-run.test.js +250 -0
  22. package/dist/__tests__/cron.test.js +12 -38
  23. package/dist/__tests__/digests.test.js +67 -0
  24. package/dist/__tests__/discord-attachments.test.js +211 -0
  25. package/dist/__tests__/discord-docs.test.d.ts +1 -0
  26. package/dist/__tests__/discord-docs.test.js +27 -0
  27. package/dist/__tests__/discord-thread-agents.test.d.ts +1 -0
  28. package/dist/__tests__/discord-thread-agents.test.js +115 -0
  29. package/dist/__tests__/discord-thread-context.test.d.ts +1 -0
  30. package/dist/__tests__/discord-thread-context.test.js +42 -0
  31. package/dist/__tests__/doctor.formatters.test.js +4 -4
  32. package/dist/__tests__/doctor.index.test.js +1 -1
  33. package/dist/__tests__/doctor.runner.test.js +3 -15
  34. package/dist/__tests__/env-sanitizer.test.d.ts +1 -0
  35. package/dist/__tests__/env-sanitizer.test.js +45 -0
  36. package/dist/__tests__/exec-approval.test.js +61 -0
  37. package/dist/__tests__/fetch-tool.test.d.ts +1 -0
  38. package/dist/__tests__/fetch-tool.test.js +85 -0
  39. package/dist/__tests__/gateway-status-auth.test.d.ts +1 -0
  40. package/dist/__tests__/gateway-status-auth.test.js +72 -0
  41. package/dist/__tests__/heartbeat.test.js +3 -3
  42. package/dist/__tests__/interactive-sessions.test.d.ts +1 -0
  43. package/dist/__tests__/interactive-sessions.test.js +96 -0
  44. package/dist/__tests__/langfuse.test.js +6 -18
  45. package/dist/__tests__/model-selection.test.js +3 -4
  46. package/dist/__tests__/providers-init.test.js +2 -8
  47. package/dist/__tests__/providers-routing.test.js +1 -1
  48. package/dist/__tests__/providers-utils.test.js +13 -3
  49. package/dist/__tests__/sessions.test.js +14 -10
  50. package/dist/__tests__/setup.test.js +12 -29
  51. package/dist/__tests__/skills.test.js +10 -7
  52. package/dist/__tests__/stream-formatter.test.d.ts +1 -0
  53. package/dist/__tests__/stream-formatter.test.js +114 -0
  54. package/dist/__tests__/token-efficiency.test.js +131 -15
  55. package/dist/__tests__/tool-loop.test.d.ts +4 -0
  56. package/dist/__tests__/tool-loop.test.js +505 -0
  57. package/dist/__tests__/tools.test.js +101 -276
  58. package/dist/__tests__/utils.test.d.ts +1 -0
  59. package/dist/__tests__/utils.test.js +14 -0
  60. package/dist/__tests__/voice.test.js +21 -0
  61. package/dist/agent.js +35 -4
  62. package/dist/api.js +113 -37
  63. package/dist/channels/discord/attachments.d.ts +50 -0
  64. package/dist/channels/discord/attachments.js +137 -0
  65. package/dist/channels/discord/delegation.d.ts +5 -0
  66. package/dist/channels/discord/delegation.js +136 -0
  67. package/dist/channels/discord/handlers.js +694 -7
  68. package/dist/channels/discord/index.d.ts +16 -1
  69. package/dist/channels/discord/index.js +64 -1
  70. package/dist/channels/discord/thread-agents.d.ts +54 -0
  71. package/dist/channels/discord/thread-agents.js +323 -0
  72. package/dist/channels/discord/threads.d.ts +58 -0
  73. package/dist/channels/discord/threads.js +192 -0
  74. package/dist/channels/discord/types.js +4 -2
  75. package/dist/channels/discord/utils.d.ts +16 -0
  76. package/dist/channels/discord/utils.js +86 -6
  77. package/dist/channels/telegram/index.d.ts +1 -1
  78. package/dist/channels/telegram/types.js +1 -1
  79. package/dist/channels/telegram/utils.js +9 -3
  80. package/dist/channels.d.ts +1 -1
  81. package/dist/cli.js +20 -400
  82. package/dist/code-agents/executor.d.ts +1 -1
  83. package/dist/code-agents/executor.js +101 -45
  84. package/dist/code-agents/index.d.ts +2 -7
  85. package/dist/code-agents/index.js +111 -80
  86. package/dist/code-agents/interactive-resume.d.ts +6 -0
  87. package/dist/code-agents/interactive-resume.js +98 -0
  88. package/dist/code-agents/interactive-sessions.d.ts +20 -0
  89. package/dist/code-agents/interactive-sessions.js +132 -0
  90. package/dist/code-agents/parser.js +5 -1
  91. package/dist/code-agents/registry.d.ts +7 -1
  92. package/dist/code-agents/registry.js +11 -23
  93. package/dist/code-agents/stream-formatter.d.ts +8 -0
  94. package/dist/code-agents/stream-formatter.js +92 -0
  95. package/dist/code-agents/types.d.ts +16 -24
  96. package/dist/code-agents/utils.d.ts +35 -11
  97. package/dist/code-agents/utils.js +349 -95
  98. package/dist/code-agents/worktrees.d.ts +37 -0
  99. package/dist/code-agents/worktrees.js +116 -0
  100. package/dist/config.d.ts +2 -4
  101. package/dist/config.js +123 -23
  102. package/dist/cron.d.ts +1 -6
  103. package/dist/cron.js +175 -82
  104. package/dist/dashboard/assets/index-B345aOO-.js +65 -0
  105. package/dist/dashboard/assets/index-ZWK4dalJ.css +1 -0
  106. package/dist/dashboard/index.html +2 -2
  107. package/dist/digests.d.ts +1 -0
  108. package/dist/digests.js +132 -42
  109. package/dist/doctor/checks.d.ts +0 -3
  110. package/dist/doctor/checks.js +1 -108
  111. package/dist/doctor/runner.js +1 -4
  112. package/dist/env-sanitizer.d.ts +2 -0
  113. package/dist/env-sanitizer.js +61 -0
  114. package/dist/exec-approval.d.ts +11 -1
  115. package/dist/exec-approval.js +17 -4
  116. package/dist/gateway.d.ts +3 -1
  117. package/dist/gateway.js +17 -7
  118. package/dist/heartbeat.js +1 -6
  119. package/dist/langfuse.js +3 -29
  120. package/dist/model-selection.js +3 -1
  121. package/dist/providers/adapter.d.ts +118 -0
  122. package/dist/providers/adapter.js +6 -0
  123. package/dist/providers/adapters/anthropic-adapter.d.ts +22 -0
  124. package/dist/providers/adapters/anthropic-adapter.js +204 -0
  125. package/dist/providers/adapters/codex-adapter.d.ts +26 -0
  126. package/dist/providers/adapters/codex-adapter.js +203 -0
  127. package/dist/providers/anthropic.d.ts +1 -0
  128. package/dist/providers/anthropic.js +10 -272
  129. package/dist/providers/codex.d.ts +21 -0
  130. package/dist/providers/codex.js +149 -330
  131. package/dist/providers/content.d.ts +1 -1
  132. package/dist/providers/content.js +2 -2
  133. package/dist/providers/context-manager.d.ts +18 -6
  134. package/dist/providers/context-manager.js +199 -223
  135. package/dist/providers/index.d.ts +9 -1
  136. package/dist/providers/index.js +73 -64
  137. package/dist/providers/loop-utils.d.ts +20 -0
  138. package/dist/providers/loop-utils.js +30 -0
  139. package/dist/providers/tool-loop.d.ts +12 -0
  140. package/dist/providers/tool-loop.js +251 -0
  141. package/dist/providers/utils.d.ts +19 -3
  142. package/dist/providers/utils.js +100 -29
  143. package/dist/secure-store.d.ts +8 -0
  144. package/dist/secure-store.js +80 -0
  145. package/dist/service.js +3 -28
  146. package/dist/sessions.d.ts +3 -0
  147. package/dist/sessions.js +147 -18
  148. package/dist/setup-templates.js +13 -25
  149. package/dist/setup.d.ts +10 -6
  150. package/dist/setup.js +84 -292
  151. package/dist/skills.js +3 -11
  152. package/dist/tools/agent-delegation.d.ts +19 -0
  153. package/dist/tools/agent-delegation.js +49 -0
  154. package/dist/tools/bash-tool.js +89 -34
  155. package/dist/tools/definitions.d.ts +199 -302
  156. package/dist/tools/definitions.js +70 -123
  157. package/dist/tools/execute-context.d.ts +13 -4
  158. package/dist/tools/fetch-tool.js +109 -13
  159. package/dist/tools/file-tools.js +7 -1
  160. package/dist/tools.d.ts +7 -7
  161. package/dist/tools.js +133 -151
  162. package/dist/types.d.ts +37 -30
  163. package/dist/utils.js +4 -6
  164. package/dist/voice.d.ts +1 -1
  165. package/dist/voice.js +17 -4
  166. package/package.json +33 -23
  167. package/templates/TOOLS.md +0 -27
  168. package/dist/__tests__/audit.test.js +0 -122
  169. package/dist/__tests__/code-agents-orchestrator.test.js +0 -216
  170. package/dist/__tests__/code-agents-sandbox.test.js +0 -163
  171. package/dist/__tests__/orchestrator.test.js +0 -425
  172. package/dist/__tests__/sandbox-bridge.test.js +0 -116
  173. package/dist/__tests__/sandbox-manager.test.js +0 -144
  174. package/dist/__tests__/sandbox-mount-security.test.js +0 -139
  175. package/dist/__tests__/sandbox-runtime.test.js +0 -176
  176. package/dist/__tests__/subagent.test.js +0 -240
  177. package/dist/__tests__/telegram.test.js +0 -42
  178. package/dist/code-agents/orchestrator.d.ts +0 -29
  179. package/dist/code-agents/orchestrator.js +0 -694
  180. package/dist/code-agents/worktree.d.ts +0 -40
  181. package/dist/code-agents/worktree.js +0 -215
  182. package/dist/dashboard/assets/index-BoTHPby4.js +0 -65
  183. package/dist/dashboard/assets/index-D4mufvBg.css +0 -1
  184. package/dist/dashboard.d.ts +0 -8
  185. package/dist/dashboard.js +0 -4071
  186. package/dist/discord.d.ts +0 -8
  187. package/dist/discord.js +0 -792
  188. package/dist/mcp-context-a8c.d.ts +0 -13
  189. package/dist/mcp-context-a8c.js +0 -34
  190. package/dist/orchestrator.d.ts +0 -15
  191. package/dist/orchestrator.js +0 -676
  192. package/dist/providers/openai.d.ts +0 -10
  193. package/dist/providers/openai.js +0 -355
  194. package/dist/sandbox/bridge.d.ts +0 -5
  195. package/dist/sandbox/bridge.js +0 -63
  196. package/dist/sandbox/index.d.ts +0 -5
  197. package/dist/sandbox/index.js +0 -4
  198. package/dist/sandbox/manager.d.ts +0 -7
  199. package/dist/sandbox/manager.js +0 -100
  200. package/dist/sandbox/mount-security.d.ts +0 -12
  201. package/dist/sandbox/mount-security.js +0 -122
  202. package/dist/sandbox/runtime.d.ts +0 -39
  203. package/dist/sandbox/runtime.js +0 -192
  204. package/dist/sandbox-utils.d.ts +0 -6
  205. package/dist/sandbox-utils.js +0 -36
  206. package/dist/subagent.d.ts +0 -19
  207. package/dist/subagent.js +0 -407
  208. package/dist/telegram.d.ts +0 -2
  209. package/dist/telegram.js +0 -11
  210. package/dist/tools/browser-tool.d.ts +0 -3
  211. package/dist/tools/browser-tool.js +0 -266
  212. package/sandbox/Dockerfile +0 -40
  213. /package/dist/__tests__/{audit.test.d.ts → code-agents-notifications.test.d.ts} +0 -0
  214. /package/dist/__tests__/{code-agents-orchestrator.test.d.ts → code-agents-worktrees.test.d.ts} +0 -0
  215. /package/dist/__tests__/{code-agents-sandbox.test.d.ts → codex-adapter.test.d.ts} +0 -0
  216. /package/dist/__tests__/{orchestrator.test.d.ts → codex-auth.test.d.ts} +0 -0
  217. /package/dist/__tests__/{sandbox-bridge.test.d.ts → codex-provider-gating.test.d.ts} +0 -0
  218. /package/dist/__tests__/{sandbox-manager.test.d.ts → codex-unified-loop.test.d.ts} +0 -0
  219. /package/dist/__tests__/{sandbox-mount-security.test.d.ts → config-security.test.d.ts} +0 -0
  220. /package/dist/__tests__/{sandbox-runtime.test.d.ts → cron-run.test.d.ts} +0 -0
  221. /package/dist/__tests__/{subagent.test.d.ts → digests.test.d.ts} +0 -0
  222. /package/dist/__tests__/{telegram.test.d.ts → discord-attachments.test.d.ts} +0 -0
@@ -1,39 +0,0 @@
1
- export interface ContainerOpts {
2
- image: string;
3
- cpus?: number;
4
- memory?: string;
5
- network?: string;
6
- mounts?: Array<{
7
- host: string;
8
- container: string;
9
- readOnly?: boolean;
10
- }>;
11
- env?: Record<string, string>;
12
- user?: string;
13
- }
14
- export interface ExecOpts {
15
- stdin?: string;
16
- timeout?: number;
17
- env?: Record<string, string>;
18
- }
19
- export interface ExecResult {
20
- stdout: string;
21
- stderr: string;
22
- exitCode: number;
23
- }
24
- /** Set the container runtime binary ('container' or 'docker'). */
25
- export declare function setRuntime(runtime: 'container' | 'docker'): void;
26
- /** Get the container runtime binary, auto-detecting if not explicitly set. */
27
- export declare function getRuntime(): string;
28
- /**
29
- * Check if a usable container runtime is available.
30
- * Returns the runtime name if found, null otherwise. Never throws.
31
- */
32
- export declare function probeRuntime(preferred?: string): string | null;
33
- /** Reset runtime detection (for testing). */
34
- export declare function resetRuntime(): void;
35
- export declare function createContainer(name: string, opts: ContainerOpts): Promise<void>;
36
- export declare function execInContainer(name: string, args: string[], opts?: ExecOpts): Promise<ExecResult>;
37
- export declare function removeContainer(name: string): Promise<void>;
38
- export declare function isContainerRunning(name: string): Promise<boolean>;
39
- export declare function cleanupOrphans(): Promise<number>;
@@ -1,192 +0,0 @@
1
- import { spawn, spawnSync } from 'child_process';
2
- const DEFAULT_TIMEOUT = 30_000;
3
- const CONTAINER_PREFIX = 'skimpyclaw-sbx-';
4
- /** Resolved container CLI binary. Set once via setRuntime() or auto-detected on first use. */
5
- let runtimeBinary = null;
6
- /** Set the container runtime binary ('container' or 'docker'). */
7
- export function setRuntime(runtime) {
8
- runtimeBinary = runtime;
9
- }
10
- /** Get the container runtime binary, auto-detecting if not explicitly set. */
11
- export function getRuntime() {
12
- if (runtimeBinary)
13
- return runtimeBinary;
14
- // Auto-detect: prefer Apple Containers, fall back to Docker
15
- if (spawnSync('container', ['--version'], { stdio: 'ignore' }).status === 0) {
16
- runtimeBinary = 'container';
17
- }
18
- else if (spawnSync('docker', ['--version'], { stdio: 'ignore' }).status === 0) {
19
- runtimeBinary = 'docker';
20
- }
21
- else {
22
- throw new Error('No container runtime found. Install Apple Containers or Docker.');
23
- }
24
- return runtimeBinary;
25
- }
26
- /**
27
- * Check if a usable container runtime is available.
28
- * Returns the runtime name if found, null otherwise. Never throws.
29
- */
30
- export function probeRuntime(preferred) {
31
- // If a preferred runtime is specified, check that one first
32
- if (preferred) {
33
- const result = spawnSync(preferred, ['--version'], { stdio: 'ignore' });
34
- if (result.status === 0)
35
- return preferred;
36
- }
37
- // Auto-detect: prefer Apple Containers, fall back to Docker
38
- if (spawnSync('container', ['--version'], { stdio: 'ignore' }).status === 0) {
39
- return 'container';
40
- }
41
- if (spawnSync('docker', ['--version'], { stdio: 'ignore' }).status === 0) {
42
- return 'docker';
43
- }
44
- return null;
45
- }
46
- /** Reset runtime detection (for testing). */
47
- export function resetRuntime() {
48
- runtimeBinary = null;
49
- }
50
- function runCommand(cmd, args, opts) {
51
- return new Promise((resolve, reject) => {
52
- const timeout = opts?.timeout ?? DEFAULT_TIMEOUT;
53
- const child = spawn(cmd, args, {
54
- stdio: [opts?.stdin ? 'pipe' : 'ignore', 'pipe', 'pipe'],
55
- signal: AbortSignal.timeout(timeout),
56
- });
57
- const stdoutChunks = [];
58
- const stderrChunks = [];
59
- child.stdout?.on('data', (chunk) => stdoutChunks.push(chunk));
60
- child.stderr?.on('data', (chunk) => stderrChunks.push(chunk));
61
- if (opts?.stdin && child.stdin) {
62
- child.stdin.write(opts.stdin);
63
- child.stdin.end();
64
- }
65
- child.on('close', (code) => {
66
- resolve({
67
- stdout: Buffer.concat(stdoutChunks).toString('utf-8'),
68
- stderr: Buffer.concat(stderrChunks).toString('utf-8'),
69
- exitCode: code ?? 1,
70
- });
71
- });
72
- child.on('error', (err) => {
73
- const timeout = opts?.timeout ?? DEFAULT_TIMEOUT;
74
- if (err.name === 'AbortError') {
75
- reject(new Error(`Sandbox command timed out after ${Math.round(timeout / 1000)}s`));
76
- return;
77
- }
78
- reject(err);
79
- });
80
- });
81
- }
82
- function formatCreateContainerError(runtime, network, stderr) {
83
- const raw = stderr.trim();
84
- if (raw.includes('network bridge not found')) {
85
- return `network "${network || 'bridge'}" not found for ${runtime}. ` +
86
- `Use sandbox.network="${runtime === 'container' ? 'default' : 'bridge'}" and retry.`;
87
- }
88
- if (raw.includes('pull access denied') || raw.includes('not found')) {
89
- return `sandbox image is missing. Build it with: ${runtime} build -t skimpyclaw-sandbox:latest sandbox/`;
90
- }
91
- return raw;
92
- }
93
- export async function createContainer(name, opts) {
94
- const runtime = getRuntime();
95
- const args = ['run', '-d', '--name', name];
96
- if (opts.user) {
97
- args.push('--user', opts.user);
98
- }
99
- if (opts.cpus) {
100
- args.push('--cpus', String(opts.cpus));
101
- }
102
- if (opts.memory) {
103
- args.push('--memory', opts.memory);
104
- }
105
- if (opts.network) {
106
- args.push('--network', opts.network);
107
- }
108
- if (opts.mounts) {
109
- for (const m of opts.mounts) {
110
- let mountArg = `type=bind,src=${m.host},dst=${m.container}`;
111
- if (m.readOnly) {
112
- mountArg += ',ro';
113
- }
114
- args.push('--mount', mountArg);
115
- }
116
- }
117
- if (opts.env) {
118
- for (const [key, val] of Object.entries(opts.env)) {
119
- args.push('-e', `${key}=${val}`);
120
- }
121
- }
122
- args.push(opts.image, 'sleep', 'infinity');
123
- const result = await runCommand(runtime, args);
124
- if (result.exitCode !== 0) {
125
- const hint = formatCreateContainerError(runtime, opts.network, result.stderr);
126
- throw new Error(`Failed to create container ${name}: ${hint}`);
127
- }
128
- }
129
- export async function execInContainer(name, args, opts) {
130
- // Callers (bridge.ts) handle their own escaping — just join args
131
- const escaped = args.join(' ');
132
- const execArgs = ['exec'];
133
- if (opts?.stdin) {
134
- execArgs.push('-i');
135
- }
136
- if (opts?.env) {
137
- for (const [key, val] of Object.entries(opts.env)) {
138
- execArgs.push('-e', `${key}=${val}`);
139
- }
140
- }
141
- execArgs.push(name, 'sh', '-c', escaped);
142
- return runCommand(getRuntime(), execArgs, {
143
- stdin: opts?.stdin,
144
- timeout: opts?.timeout ?? DEFAULT_TIMEOUT,
145
- });
146
- }
147
- export async function removeContainer(name) {
148
- const runtime = getRuntime();
149
- // Best-effort stop then force rm to clear stopped/dead containers
150
- await runCommand(runtime, ['stop', name]).catch(() => { });
151
- await runCommand(runtime, ['rm', '-f', name]).catch(() => { });
152
- }
153
- export async function isContainerRunning(name) {
154
- const runtime = getRuntime();
155
- // Docker: use --format to check the running state directly
156
- if (runtime === 'docker') {
157
- const result = await runCommand(runtime, ['inspect', '--format', '{{.State.Running}}', name]);
158
- return result.exitCode === 0 && result.stdout.trim() === 'true';
159
- }
160
- // Apple Containers: inspect succeeds for any state; check ps output
161
- const result = await runCommand(runtime, ['inspect', name]);
162
- if (result.exitCode !== 0)
163
- return false;
164
- // If stdout contains "running" state indicator, it's running
165
- const output = result.stdout.toLowerCase();
166
- return output.includes('"running"') || output.includes('status: running') || output.includes('state: running');
167
- }
168
- export async function cleanupOrphans() {
169
- const rt = getRuntime();
170
- // Try Docker-style --format first, fall back to plain ps for Apple Containers
171
- let result = await runCommand(rt, ['ps', '-a', '--format', '{{.Names}}']);
172
- if (result.exitCode !== 0) {
173
- // Fallback: plain ps output, grep for our prefix
174
- result = await runCommand(rt, ['ps', '-a']);
175
- if (result.exitCode !== 0)
176
- return 0;
177
- }
178
- const names = result.stdout
179
- .split('\n')
180
- .map((n) => n.trim())
181
- .filter((n) => n.startsWith(CONTAINER_PREFIX) || n.includes(CONTAINER_PREFIX))
182
- // Extract container name if it's in a table row
183
- .map((n) => {
184
- const match = n.match(new RegExp(`(${CONTAINER_PREFIX}[\\w-]+)`));
185
- return match ? match[1] : n;
186
- })
187
- .filter((n) => n.startsWith(CONTAINER_PREFIX));
188
- for (const name of names) {
189
- await removeContainer(name);
190
- }
191
- return names.length;
192
- }
@@ -1,6 +0,0 @@
1
- export type SandboxRuntime = 'container' | 'docker';
2
- export declare function detectSandboxRuntime(preferred?: SandboxRuntime | string | null): SandboxRuntime | null;
3
- export declare function isSandboxRuntimeRunning(runtime: SandboxRuntime): boolean;
4
- export declare function sandboxNetworkExists(runtime: SandboxRuntime, network: string): boolean;
5
- export declare function defaultSandboxNetwork(runtime: SandboxRuntime): string;
6
- export declare function sandboxImageExists(runtime: SandboxRuntime, image: string): boolean;
@@ -1,36 +0,0 @@
1
- // Shared sandbox runtime detection helpers (used by setup.ts and cli.ts)
2
- import { spawnSync } from 'child_process';
3
- export function detectSandboxRuntime(preferred) {
4
- if (preferred === 'container' || preferred === 'docker') {
5
- return spawnSync(preferred, ['--version'], { encoding: 'utf-8' }).status === 0 ? preferred : null;
6
- }
7
- if (spawnSync('container', ['--version'], { encoding: 'utf-8' }).status === 0) {
8
- return 'container';
9
- }
10
- if (spawnSync('docker', ['--version'], { encoding: 'utf-8' }).status === 0) {
11
- return 'docker';
12
- }
13
- return null;
14
- }
15
- export function isSandboxRuntimeRunning(runtime) {
16
- if (runtime === 'container') {
17
- return spawnSync('container', ['system', 'status'], { encoding: 'utf-8' }).status === 0;
18
- }
19
- return spawnSync('docker', ['info'], { encoding: 'utf-8' }).status === 0;
20
- }
21
- export function sandboxNetworkExists(runtime, network) {
22
- if (runtime === 'container') {
23
- const result = spawnSync('container', ['network', 'ls'], { encoding: 'utf-8' });
24
- if (result.status !== 0)
25
- return false;
26
- return result.stdout.split('\n').some((line) => line.trim().split(/\s+/)[0] === network);
27
- }
28
- const result = spawnSync('docker', ['network', 'inspect', network], { encoding: 'utf-8' });
29
- return result.status === 0;
30
- }
31
- export function defaultSandboxNetwork(runtime) {
32
- return runtime === 'container' ? 'default' : 'bridge';
33
- }
34
- export function sandboxImageExists(runtime, image) {
35
- return spawnSync(runtime, ['image', 'inspect', image], { encoding: 'utf-8' }).status === 0;
36
- }
@@ -1,19 +0,0 @@
1
- import type { Config, SubagentType, SubagentTask, ChatMessage } from './types.js';
2
- /**
3
- * Ensure agent directory and templates exist for a subagent type.
4
- * Creates the dir + starter IDENTITY.md + TOOLS.md if missing.
5
- * Registers the agent in config.agents.list (in-memory only).
6
- */
7
- export declare function ensureAgentSetup(type: SubagentType, config: Config): void;
8
- export declare function initSubagentSystem(deliverFn: (chatId: number, message: string) => Promise<void>): void;
9
- export declare function getPresetDescriptions(): string;
10
- export declare function dispatchSubagent(type: SubagentType, prompt: string, chatId: number, config: Config, modelOverride?: string, history?: ChatMessage[], options?: {
11
- label?: string;
12
- allowedPaths?: string[];
13
- maxRetries?: number;
14
- }): SubagentTask;
15
- export declare function cancelTask(id: string): SubagentTask | null;
16
- export declare function getActiveTasks(): SubagentTask[];
17
- export declare function getRecentTasks(n?: number): SubagentTask[];
18
- export declare function getTask(id: string): SubagentTask | null;
19
- export declare function resetForTesting(): void;