@cjhyy/code-shell 0.1.6 → 0.2.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.
- package/dist/anthropic-OVRWAZRD.js +1 -0
- package/dist/arena/index.js +1 -104
- package/dist/arena-64T2EQD4.js +3 -0
- package/dist/bwrap-PVZMLHZR.js +2 -0
- package/dist/chunk-2EUIMKJA.js +1 -0
- package/dist/chunk-2GJ7H5NC.js +641 -0
- package/dist/chunk-2OD6VR4N.js +2 -0
- package/dist/chunk-3QP5BQ3L.js +1 -0
- package/dist/chunk-A4M2Y42L.js +2 -0
- package/dist/chunk-DEYFK6FP.js +1 -0
- package/dist/chunk-DTPABBSV.js +2 -0
- package/dist/chunk-EU3J7TBP.js +1 -0
- package/dist/chunk-FU7AHZNN.js +1 -0
- package/dist/chunk-L7B2ORID.js +4 -0
- package/dist/chunk-M7VU4YVY.js +49 -0
- package/dist/chunk-MGP35GKD.js +254 -0
- package/dist/chunk-MLCTC53I.js +1 -0
- package/dist/chunk-O5HFCH2U.js +1 -0
- package/dist/chunk-P6JSTIFM.js +1 -0
- package/dist/chunk-Q3RSX66I.js +1 -0
- package/dist/chunk-QTWU7UNA.js +5 -0
- package/dist/chunk-RERBX75D.js +251 -0
- package/dist/chunk-SNFAPSLA.js +1 -0
- package/dist/chunk-T222K6IV.js +18 -0
- package/dist/chunk-TKJA6W36.js +3 -0
- package/dist/chunk-VKKU4LOM.js +3 -0
- package/dist/chunk-WI6FSWGU.js +1 -0
- package/dist/chunk-XXCZE2U2.js +2 -0
- package/dist/chunk-ZSAONDT6.js +2 -0
- package/dist/cli/main.js +303 -22060
- package/dist/cli/onboarding.d.ts +7 -2
- package/dist/client-base-F5FCRSB3.js +1 -0
- package/dist/compaction-L3Y6NG4N.js +1 -0
- package/dist/context/compaction.d.ts +2 -1
- package/dist/data/static-catalogs.d.ts +25 -0
- package/dist/devtools-SGDUOOM4.js +1 -0
- package/dist/engine/engine.d.ts +24 -0
- package/dist/engine/turn-loop.d.ts +20 -0
- package/dist/export-md-U72T7NW7.js +22 -0
- package/dist/file-history-7FQFEQOL.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -347
- package/dist/llm/capabilities/index.d.ts +20 -0
- package/dist/llm/capabilities/rules.d.ts +26 -0
- package/dist/llm/capabilities/types.d.ts +108 -0
- package/dist/llm/model-pool.d.ts +7 -0
- package/dist/llm/provider-catalog.d.ts +2 -0
- package/dist/llm/provider-kinds.d.ts +1 -1
- package/dist/llm/providers/openai.d.ts +22 -0
- package/dist/llm/token-counter.d.ts +17 -0
- package/dist/llm/types.d.ts +8 -0
- package/dist/logging/logger.d.ts +10 -2
- package/dist/logging/session-recorder.d.ts +16 -3
- package/dist/manager-J6FXEUEK.js +1 -0
- package/dist/mcp-manager-27EVBKRT.js +1 -0
- package/dist/memory-BNI4WEWL.js +1 -0
- package/dist/model-cache-HEDXI7UJ.js +1 -0
- package/dist/model-fetcher-X5W5EASG.js +1 -0
- package/dist/off-7SDVMMXW.js +1 -0
- package/dist/openai-3QEADSYL.js +1 -0
- package/dist/openrouter-models-GZVCRWD2.js +1 -0
- package/dist/openrouter-sync-WG4AG5NC.js +1 -0
- package/dist/product/index.js +1 -21
- package/dist/protocol/client.d.ts +1 -1
- package/dist/run/index.js +1 -48
- package/dist/seatbelt-L54CNI2Y.js +37 -0
- package/dist/session/session-manager.d.ts +2 -0
- package/dist/session-manager-AGWS5SMJ.js +1 -0
- package/dist/settings/schema.d.ts +147 -21
- package/dist/tool-summary-V2B3MD5N.js +2 -0
- package/dist/tool-system/builtin/bash.d.ts +7 -1
- package/dist/tool-system/context.d.ts +7 -0
- package/dist/tool-system/executor.d.ts +4 -0
- package/dist/tool-system/sandbox/bwrap.d.ts +13 -0
- package/dist/tool-system/sandbox/index.d.ts +78 -0
- package/dist/tool-system/sandbox/off.d.ts +2 -0
- package/dist/tool-system/sandbox/seatbelt.d.ts +18 -0
- package/dist/tool-system/task-guard.d.ts +30 -0
- package/dist/types.d.ts +17 -0
- package/dist/ui/components/SessionPicker.d.ts +2 -0
- package/dist/ui/components/SpinnerWithVerb.d.ts +7 -2
- package/dist/ui/components/StatusLine.d.ts +7 -3
- package/dist/updater-OCNU2K2Z.js +1 -0
- package/package.json +7 -10
- package/dist/anthropic-IBTI4WL2.cjs +0 -10
- package/dist/anthropic-PRZZKHEZ.js +0 -10
- package/dist/arena/index.cjs +0 -104
- package/dist/arena-2LTLIXOL.js +0 -261
- package/dist/arena-ADB7DRFI.cjs +0 -261
- package/dist/chunk-2YW4FPFG.cjs +0 -101
- package/dist/chunk-3OA5G4TM.js +0 -47
- package/dist/chunk-3QO25N6E.js +0 -4711
- package/dist/chunk-3SBSUOWZ.js +0 -447
- package/dist/chunk-52LGZKT3.cjs +0 -47
- package/dist/chunk-55XGPMAP.cjs +0 -146
- package/dist/chunk-6QVAYW7C.cjs +0 -438
- package/dist/chunk-6S4BJ65N.js +0 -113
- package/dist/chunk-76HYEPDM.js +0 -307
- package/dist/chunk-7BI3V74Y.cjs +0 -447
- package/dist/chunk-7EG3V4JY.cjs +0 -113
- package/dist/chunk-7JVTYEEC.js +0 -340
- package/dist/chunk-7QIM3BKD.js +0 -44
- package/dist/chunk-7Y6S3OCX.js +0 -438
- package/dist/chunk-ABRRONJ7.js +0 -107
- package/dist/chunk-BSW22MPA.js +0 -146
- package/dist/chunk-BXCY2FSE.js +0 -203
- package/dist/chunk-BZ5TNE7L.js +0 -5128
- package/dist/chunk-DDB6QOKJ.cjs +0 -1252
- package/dist/chunk-HEKQCI7B.cjs +0 -224
- package/dist/chunk-IK4EWJBP.cjs +0 -203
- package/dist/chunk-ILHE7XLT.cjs +0 -107
- package/dist/chunk-JMR33QVF.cjs +0 -169
- package/dist/chunk-KAQHULYN.js +0 -54
- package/dist/chunk-KE4EQOWA.js +0 -294
- package/dist/chunk-KOVYSDHZ.cjs +0 -340
- package/dist/chunk-KS3RYAYL.cjs +0 -45
- package/dist/chunk-MD32R22I.js +0 -50
- package/dist/chunk-MV7YI4WO.cjs +0 -293
- package/dist/chunk-MY5XHADU.cjs +0 -216
- package/dist/chunk-NUNC3VFB.cjs +0 -307
- package/dist/chunk-PKGRTCCY.js +0 -9092
- package/dist/chunk-QARL3IDQ.js +0 -1252
- package/dist/chunk-S754JHLR.cjs +0 -54
- package/dist/chunk-SFXHZSRF.js +0 -101
- package/dist/chunk-SIHHIQLO.js +0 -224
- package/dist/chunk-T6VYG46N.js +0 -105
- package/dist/chunk-TNLGBJYS.cjs +0 -44
- package/dist/chunk-TUY2T5KP.cjs +0 -105
- package/dist/chunk-UXOCVJJ6.cjs +0 -9092
- package/dist/chunk-VIAGTYYW.js +0 -169
- package/dist/chunk-WASS5YWB.js +0 -215
- package/dist/chunk-WZJV6DJC.cjs +0 -5128
- package/dist/chunk-YIQBXAYU.cjs +0 -264
- package/dist/chunk-YKIAELDZ.cjs +0 -4711
- package/dist/chunk-ZBPSQCPU.js +0 -264
- package/dist/cli/main.cjs +0 -22156
- package/dist/client-base-HTF236ZD.cjs +0 -9
- package/dist/client-base-QKRKCOWB.js +0 -9
- package/dist/compaction-6VU2T643.js +0 -33
- package/dist/compaction-OKUNTCA7.cjs +0 -33
- package/dist/devtools-T2NIZBJK.cjs +0 -6
- package/dist/devtools-YXWHOVKR.js +0 -6
- package/dist/export-md-RXDW6F5W.cjs +0 -135
- package/dist/export-md-XXKZANW5.js +0 -135
- package/dist/file-history-KYPE3ECT.cjs +0 -7
- package/dist/file-history-LF4F7X26.js +0 -7
- package/dist/index.cjs +0 -347
- package/dist/manager-D65VFAPX.js +0 -7
- package/dist/manager-TTF5VHJC.cjs +0 -7
- package/dist/mcp-manager-QMKWPBZ4.js +0 -8
- package/dist/mcp-manager-Z3OKI74O.cjs +0 -8
- package/dist/memory-5LWZ6FI2.cjs +0 -9
- package/dist/memory-VIJLBAMQ.js +0 -9
- package/dist/model-cache-5KIYL5SL.js +0 -13
- package/dist/model-cache-OED3IM4R.cjs +0 -13
- package/dist/model-fetcher-HKGICACL.js +0 -8
- package/dist/model-fetcher-UR6WJOQP.cjs +0 -8
- package/dist/openai-JR2WEKOF.js +0 -10
- package/dist/openai-YBTOET4O.cjs +0 -10
- package/dist/openrouter-models-H56GHBHN.js +0 -15
- package/dist/openrouter-models-TWUFWZ5T.cjs +0 -15
- package/dist/openrouter-sync-5VMGN6C2.cjs +0 -11
- package/dist/openrouter-sync-ALEMF5IU.js +0 -11
- package/dist/product/index.cjs +0 -21
- package/dist/run/index.cjs +0 -48
- package/dist/session-manager-Q22BBMD3.js +0 -8
- package/dist/session-manager-XODQVL3C.cjs +0 -8
- package/dist/tool-summary-63DPIS7G.cjs +0 -31
- package/dist/tool-summary-NP5CDBKG.js +0 -31
- package/dist/updater-I7QBW4DP.cjs +0 -17
- package/dist/updater-NVME5S3Z.js +0 -17
|
@@ -48,38 +48,47 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
48
48
|
}, "strip", z.ZodTypeAny, {
|
|
49
49
|
provider: string;
|
|
50
50
|
name: string;
|
|
51
|
+
temperature: number;
|
|
51
52
|
maxTokens: number;
|
|
52
53
|
baseUrl: string;
|
|
53
|
-
temperature: number;
|
|
54
54
|
apiKey?: string | undefined;
|
|
55
55
|
}, {
|
|
56
56
|
provider?: string | undefined;
|
|
57
57
|
name?: string | undefined;
|
|
58
|
+
temperature?: number | undefined;
|
|
58
59
|
maxTokens?: number | undefined;
|
|
59
60
|
baseUrl?: string | undefined;
|
|
60
61
|
apiKey?: string | undefined;
|
|
61
|
-
temperature?: number | undefined;
|
|
62
62
|
}>>;
|
|
63
63
|
providers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
64
64
|
key: z.ZodString;
|
|
65
65
|
label: z.ZodOptional<z.ZodString>;
|
|
66
|
-
kind: z.ZodEnum<["openai", "anthropic", "deepseek", "xai", "mistral", "groq", "google", "openrouter", "ollama", "custom"]>;
|
|
66
|
+
kind: z.ZodEnum<["openai", "anthropic", "deepseek", "zai", "xai", "mistral", "groq", "google", "openrouter", "ollama", "custom"]>;
|
|
67
67
|
baseUrl: z.ZodString;
|
|
68
68
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
69
69
|
protocol: z.ZodOptional<z.ZodEnum<["openai-compat", "anthropic-style"]>>;
|
|
70
70
|
modelsPath: z.ZodOptional<z.ZodString>;
|
|
71
|
+
/**
|
|
72
|
+
* DeepSeek V4 thinking-mode default for this provider. "enabled"
|
|
73
|
+
* matches endpoint default; "disabled" makes V4 calls run in
|
|
74
|
+
* non-thinking mode (faster, cheaper). Ignored by every provider
|
|
75
|
+
* other than DeepSeek V4. Per-call overrides still win.
|
|
76
|
+
*/
|
|
77
|
+
thinking: z.ZodOptional<z.ZodEnum<["enabled", "disabled"]>>;
|
|
71
78
|
}, "strip", z.ZodTypeAny, {
|
|
72
|
-
kind: "anthropic" | "openai" | "
|
|
79
|
+
kind: "anthropic" | "openai" | "deepseek" | "zai" | "xai" | "mistral" | "groq" | "google" | "openrouter" | "ollama" | "custom";
|
|
73
80
|
key: string;
|
|
74
81
|
baseUrl: string;
|
|
82
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
75
83
|
label?: string | undefined;
|
|
76
84
|
apiKey?: string | undefined;
|
|
77
85
|
protocol?: "openai-compat" | "anthropic-style" | undefined;
|
|
78
86
|
modelsPath?: string | undefined;
|
|
79
87
|
}, {
|
|
80
|
-
kind: "anthropic" | "openai" | "
|
|
88
|
+
kind: "anthropic" | "openai" | "deepseek" | "zai" | "xai" | "mistral" | "groq" | "google" | "openrouter" | "ollama" | "custom";
|
|
81
89
|
key: string;
|
|
82
90
|
baseUrl: string;
|
|
91
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
83
92
|
label?: string | undefined;
|
|
84
93
|
apiKey?: string | undefined;
|
|
85
94
|
protocol?: "openai-compat" | "anthropic-style" | undefined;
|
|
@@ -102,10 +111,18 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
102
111
|
provider: z.ZodOptional<z.ZodString>;
|
|
103
112
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
104
113
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
114
|
+
/**
|
|
115
|
+
* Per-model thinking override. Wins over the provider-level
|
|
116
|
+
* setting (settings.providers[].thinking). Use this when
|
|
117
|
+
* different models under the same provider need different
|
|
118
|
+
* defaults — e.g. DeepSeek V4 Pro off (faster) but V4 Flash on.
|
|
119
|
+
*/
|
|
120
|
+
thinking: z.ZodOptional<z.ZodEnum<["enabled", "disabled"]>>;
|
|
105
121
|
}, "strip", z.ZodTypeAny, {
|
|
106
122
|
model: string;
|
|
107
123
|
key: string;
|
|
108
124
|
provider?: string | undefined;
|
|
125
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
109
126
|
baseUrl?: string | undefined;
|
|
110
127
|
label?: string | undefined;
|
|
111
128
|
apiKey?: string | undefined;
|
|
@@ -117,6 +134,7 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
117
134
|
model: string;
|
|
118
135
|
key: string;
|
|
119
136
|
provider?: string | undefined;
|
|
137
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
120
138
|
baseUrl?: string | undefined;
|
|
121
139
|
label?: string | undefined;
|
|
122
140
|
apiKey?: string | undefined;
|
|
@@ -129,6 +147,7 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
129
147
|
provider: string | undefined;
|
|
130
148
|
model: string;
|
|
131
149
|
key: string;
|
|
150
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
132
151
|
baseUrl?: string | undefined;
|
|
133
152
|
label?: string | undefined;
|
|
134
153
|
apiKey?: string | undefined;
|
|
@@ -139,6 +158,7 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
139
158
|
model: string;
|
|
140
159
|
key: string;
|
|
141
160
|
provider?: string | undefined;
|
|
161
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
142
162
|
baseUrl?: string | undefined;
|
|
143
163
|
label?: string | undefined;
|
|
144
164
|
apiKey?: string | undefined;
|
|
@@ -219,16 +239,16 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
219
239
|
args?: string[] | undefined;
|
|
220
240
|
headers?: Record<string, string> | undefined;
|
|
221
241
|
command?: string | undefined;
|
|
222
|
-
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
223
242
|
env?: Record<string, string> | undefined;
|
|
243
|
+
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
224
244
|
}, {
|
|
225
245
|
name: string;
|
|
226
246
|
url?: string | undefined;
|
|
227
247
|
args?: string[] | undefined;
|
|
228
248
|
headers?: Record<string, string> | undefined;
|
|
229
249
|
command?: string | undefined;
|
|
230
|
-
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
231
250
|
env?: Record<string, string> | undefined;
|
|
251
|
+
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
232
252
|
}>>>;
|
|
233
253
|
instructions: z.ZodDefault<z.ZodObject<{
|
|
234
254
|
fileName: z.ZodDefault<z.ZodString>;
|
|
@@ -303,6 +323,28 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
303
323
|
}, {
|
|
304
324
|
format?: "text" | "json" | "jsonl" | "stream-json" | undefined;
|
|
305
325
|
}>>;
|
|
326
|
+
/**
|
|
327
|
+
* OS-level sandbox for shell-tool execution. "auto" picks per platform:
|
|
328
|
+
* Seatbelt on macOS, bubblewrap on Linux when installed, otherwise off.
|
|
329
|
+
* Defaults are applied per Engine run depending on headless vs REPL —
|
|
330
|
+
* see Engine.run() and run.ts.
|
|
331
|
+
*/
|
|
332
|
+
sandbox: z.ZodOptional<z.ZodObject<{
|
|
333
|
+
mode: z.ZodOptional<z.ZodEnum<["off", "auto", "seatbelt", "bwrap"]>>;
|
|
334
|
+
writableRoots: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
335
|
+
deniedReads: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
336
|
+
network: z.ZodOptional<z.ZodEnum<["allow", "deny"]>>;
|
|
337
|
+
}, "strip", z.ZodTypeAny, {
|
|
338
|
+
mode?: "auto" | "off" | "seatbelt" | "bwrap" | undefined;
|
|
339
|
+
writableRoots?: string[] | undefined;
|
|
340
|
+
deniedReads?: string[] | undefined;
|
|
341
|
+
network?: "allow" | "deny" | undefined;
|
|
342
|
+
}, {
|
|
343
|
+
mode?: "auto" | "off" | "seatbelt" | "bwrap" | undefined;
|
|
344
|
+
writableRoots?: string[] | undefined;
|
|
345
|
+
deniedReads?: string[] | undefined;
|
|
346
|
+
network?: "allow" | "deny" | undefined;
|
|
347
|
+
}>>;
|
|
306
348
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
307
349
|
agent: z.ZodDefault<z.ZodObject<{
|
|
308
350
|
preset: z.ZodDefault<z.ZodString>;
|
|
@@ -349,38 +391,47 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
349
391
|
}, "strip", z.ZodTypeAny, {
|
|
350
392
|
provider: string;
|
|
351
393
|
name: string;
|
|
394
|
+
temperature: number;
|
|
352
395
|
maxTokens: number;
|
|
353
396
|
baseUrl: string;
|
|
354
|
-
temperature: number;
|
|
355
397
|
apiKey?: string | undefined;
|
|
356
398
|
}, {
|
|
357
399
|
provider?: string | undefined;
|
|
358
400
|
name?: string | undefined;
|
|
401
|
+
temperature?: number | undefined;
|
|
359
402
|
maxTokens?: number | undefined;
|
|
360
403
|
baseUrl?: string | undefined;
|
|
361
404
|
apiKey?: string | undefined;
|
|
362
|
-
temperature?: number | undefined;
|
|
363
405
|
}>>;
|
|
364
406
|
providers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
365
407
|
key: z.ZodString;
|
|
366
408
|
label: z.ZodOptional<z.ZodString>;
|
|
367
|
-
kind: z.ZodEnum<["openai", "anthropic", "deepseek", "xai", "mistral", "groq", "google", "openrouter", "ollama", "custom"]>;
|
|
409
|
+
kind: z.ZodEnum<["openai", "anthropic", "deepseek", "zai", "xai", "mistral", "groq", "google", "openrouter", "ollama", "custom"]>;
|
|
368
410
|
baseUrl: z.ZodString;
|
|
369
411
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
370
412
|
protocol: z.ZodOptional<z.ZodEnum<["openai-compat", "anthropic-style"]>>;
|
|
371
413
|
modelsPath: z.ZodOptional<z.ZodString>;
|
|
414
|
+
/**
|
|
415
|
+
* DeepSeek V4 thinking-mode default for this provider. "enabled"
|
|
416
|
+
* matches endpoint default; "disabled" makes V4 calls run in
|
|
417
|
+
* non-thinking mode (faster, cheaper). Ignored by every provider
|
|
418
|
+
* other than DeepSeek V4. Per-call overrides still win.
|
|
419
|
+
*/
|
|
420
|
+
thinking: z.ZodOptional<z.ZodEnum<["enabled", "disabled"]>>;
|
|
372
421
|
}, "strip", z.ZodTypeAny, {
|
|
373
|
-
kind: "anthropic" | "openai" | "
|
|
422
|
+
kind: "anthropic" | "openai" | "deepseek" | "zai" | "xai" | "mistral" | "groq" | "google" | "openrouter" | "ollama" | "custom";
|
|
374
423
|
key: string;
|
|
375
424
|
baseUrl: string;
|
|
425
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
376
426
|
label?: string | undefined;
|
|
377
427
|
apiKey?: string | undefined;
|
|
378
428
|
protocol?: "openai-compat" | "anthropic-style" | undefined;
|
|
379
429
|
modelsPath?: string | undefined;
|
|
380
430
|
}, {
|
|
381
|
-
kind: "anthropic" | "openai" | "
|
|
431
|
+
kind: "anthropic" | "openai" | "deepseek" | "zai" | "xai" | "mistral" | "groq" | "google" | "openrouter" | "ollama" | "custom";
|
|
382
432
|
key: string;
|
|
383
433
|
baseUrl: string;
|
|
434
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
384
435
|
label?: string | undefined;
|
|
385
436
|
apiKey?: string | undefined;
|
|
386
437
|
protocol?: "openai-compat" | "anthropic-style" | undefined;
|
|
@@ -403,10 +454,18 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
403
454
|
provider: z.ZodOptional<z.ZodString>;
|
|
404
455
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
405
456
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
457
|
+
/**
|
|
458
|
+
* Per-model thinking override. Wins over the provider-level
|
|
459
|
+
* setting (settings.providers[].thinking). Use this when
|
|
460
|
+
* different models under the same provider need different
|
|
461
|
+
* defaults — e.g. DeepSeek V4 Pro off (faster) but V4 Flash on.
|
|
462
|
+
*/
|
|
463
|
+
thinking: z.ZodOptional<z.ZodEnum<["enabled", "disabled"]>>;
|
|
406
464
|
}, "strip", z.ZodTypeAny, {
|
|
407
465
|
model: string;
|
|
408
466
|
key: string;
|
|
409
467
|
provider?: string | undefined;
|
|
468
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
410
469
|
baseUrl?: string | undefined;
|
|
411
470
|
label?: string | undefined;
|
|
412
471
|
apiKey?: string | undefined;
|
|
@@ -418,6 +477,7 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
418
477
|
model: string;
|
|
419
478
|
key: string;
|
|
420
479
|
provider?: string | undefined;
|
|
480
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
421
481
|
baseUrl?: string | undefined;
|
|
422
482
|
label?: string | undefined;
|
|
423
483
|
apiKey?: string | undefined;
|
|
@@ -430,6 +490,7 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
430
490
|
provider: string | undefined;
|
|
431
491
|
model: string;
|
|
432
492
|
key: string;
|
|
493
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
433
494
|
baseUrl?: string | undefined;
|
|
434
495
|
label?: string | undefined;
|
|
435
496
|
apiKey?: string | undefined;
|
|
@@ -440,6 +501,7 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
440
501
|
model: string;
|
|
441
502
|
key: string;
|
|
442
503
|
provider?: string | undefined;
|
|
504
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
443
505
|
baseUrl?: string | undefined;
|
|
444
506
|
label?: string | undefined;
|
|
445
507
|
apiKey?: string | undefined;
|
|
@@ -520,16 +582,16 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
520
582
|
args?: string[] | undefined;
|
|
521
583
|
headers?: Record<string, string> | undefined;
|
|
522
584
|
command?: string | undefined;
|
|
523
|
-
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
524
585
|
env?: Record<string, string> | undefined;
|
|
586
|
+
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
525
587
|
}, {
|
|
526
588
|
name: string;
|
|
527
589
|
url?: string | undefined;
|
|
528
590
|
args?: string[] | undefined;
|
|
529
591
|
headers?: Record<string, string> | undefined;
|
|
530
592
|
command?: string | undefined;
|
|
531
|
-
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
532
593
|
env?: Record<string, string> | undefined;
|
|
594
|
+
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
533
595
|
}>>>;
|
|
534
596
|
instructions: z.ZodDefault<z.ZodObject<{
|
|
535
597
|
fileName: z.ZodDefault<z.ZodString>;
|
|
@@ -604,6 +666,28 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
604
666
|
}, {
|
|
605
667
|
format?: "text" | "json" | "jsonl" | "stream-json" | undefined;
|
|
606
668
|
}>>;
|
|
669
|
+
/**
|
|
670
|
+
* OS-level sandbox for shell-tool execution. "auto" picks per platform:
|
|
671
|
+
* Seatbelt on macOS, bubblewrap on Linux when installed, otherwise off.
|
|
672
|
+
* Defaults are applied per Engine run depending on headless vs REPL —
|
|
673
|
+
* see Engine.run() and run.ts.
|
|
674
|
+
*/
|
|
675
|
+
sandbox: z.ZodOptional<z.ZodObject<{
|
|
676
|
+
mode: z.ZodOptional<z.ZodEnum<["off", "auto", "seatbelt", "bwrap"]>>;
|
|
677
|
+
writableRoots: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
678
|
+
deniedReads: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
679
|
+
network: z.ZodOptional<z.ZodEnum<["allow", "deny"]>>;
|
|
680
|
+
}, "strip", z.ZodTypeAny, {
|
|
681
|
+
mode?: "auto" | "off" | "seatbelt" | "bwrap" | undefined;
|
|
682
|
+
writableRoots?: string[] | undefined;
|
|
683
|
+
deniedReads?: string[] | undefined;
|
|
684
|
+
network?: "allow" | "deny" | undefined;
|
|
685
|
+
}, {
|
|
686
|
+
mode?: "auto" | "off" | "seatbelt" | "bwrap" | undefined;
|
|
687
|
+
writableRoots?: string[] | undefined;
|
|
688
|
+
deniedReads?: string[] | undefined;
|
|
689
|
+
network?: "allow" | "deny" | undefined;
|
|
690
|
+
}>>;
|
|
607
691
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
608
692
|
agent: z.ZodDefault<z.ZodObject<{
|
|
609
693
|
preset: z.ZodDefault<z.ZodString>;
|
|
@@ -650,38 +734,47 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
650
734
|
}, "strip", z.ZodTypeAny, {
|
|
651
735
|
provider: string;
|
|
652
736
|
name: string;
|
|
737
|
+
temperature: number;
|
|
653
738
|
maxTokens: number;
|
|
654
739
|
baseUrl: string;
|
|
655
|
-
temperature: number;
|
|
656
740
|
apiKey?: string | undefined;
|
|
657
741
|
}, {
|
|
658
742
|
provider?: string | undefined;
|
|
659
743
|
name?: string | undefined;
|
|
744
|
+
temperature?: number | undefined;
|
|
660
745
|
maxTokens?: number | undefined;
|
|
661
746
|
baseUrl?: string | undefined;
|
|
662
747
|
apiKey?: string | undefined;
|
|
663
|
-
temperature?: number | undefined;
|
|
664
748
|
}>>;
|
|
665
749
|
providers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
666
750
|
key: z.ZodString;
|
|
667
751
|
label: z.ZodOptional<z.ZodString>;
|
|
668
|
-
kind: z.ZodEnum<["openai", "anthropic", "deepseek", "xai", "mistral", "groq", "google", "openrouter", "ollama", "custom"]>;
|
|
752
|
+
kind: z.ZodEnum<["openai", "anthropic", "deepseek", "zai", "xai", "mistral", "groq", "google", "openrouter", "ollama", "custom"]>;
|
|
669
753
|
baseUrl: z.ZodString;
|
|
670
754
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
671
755
|
protocol: z.ZodOptional<z.ZodEnum<["openai-compat", "anthropic-style"]>>;
|
|
672
756
|
modelsPath: z.ZodOptional<z.ZodString>;
|
|
757
|
+
/**
|
|
758
|
+
* DeepSeek V4 thinking-mode default for this provider. "enabled"
|
|
759
|
+
* matches endpoint default; "disabled" makes V4 calls run in
|
|
760
|
+
* non-thinking mode (faster, cheaper). Ignored by every provider
|
|
761
|
+
* other than DeepSeek V4. Per-call overrides still win.
|
|
762
|
+
*/
|
|
763
|
+
thinking: z.ZodOptional<z.ZodEnum<["enabled", "disabled"]>>;
|
|
673
764
|
}, "strip", z.ZodTypeAny, {
|
|
674
|
-
kind: "anthropic" | "openai" | "
|
|
765
|
+
kind: "anthropic" | "openai" | "deepseek" | "zai" | "xai" | "mistral" | "groq" | "google" | "openrouter" | "ollama" | "custom";
|
|
675
766
|
key: string;
|
|
676
767
|
baseUrl: string;
|
|
768
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
677
769
|
label?: string | undefined;
|
|
678
770
|
apiKey?: string | undefined;
|
|
679
771
|
protocol?: "openai-compat" | "anthropic-style" | undefined;
|
|
680
772
|
modelsPath?: string | undefined;
|
|
681
773
|
}, {
|
|
682
|
-
kind: "anthropic" | "openai" | "
|
|
774
|
+
kind: "anthropic" | "openai" | "deepseek" | "zai" | "xai" | "mistral" | "groq" | "google" | "openrouter" | "ollama" | "custom";
|
|
683
775
|
key: string;
|
|
684
776
|
baseUrl: string;
|
|
777
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
685
778
|
label?: string | undefined;
|
|
686
779
|
apiKey?: string | undefined;
|
|
687
780
|
protocol?: "openai-compat" | "anthropic-style" | undefined;
|
|
@@ -704,10 +797,18 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
704
797
|
provider: z.ZodOptional<z.ZodString>;
|
|
705
798
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
706
799
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
800
|
+
/**
|
|
801
|
+
* Per-model thinking override. Wins over the provider-level
|
|
802
|
+
* setting (settings.providers[].thinking). Use this when
|
|
803
|
+
* different models under the same provider need different
|
|
804
|
+
* defaults — e.g. DeepSeek V4 Pro off (faster) but V4 Flash on.
|
|
805
|
+
*/
|
|
806
|
+
thinking: z.ZodOptional<z.ZodEnum<["enabled", "disabled"]>>;
|
|
707
807
|
}, "strip", z.ZodTypeAny, {
|
|
708
808
|
model: string;
|
|
709
809
|
key: string;
|
|
710
810
|
provider?: string | undefined;
|
|
811
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
711
812
|
baseUrl?: string | undefined;
|
|
712
813
|
label?: string | undefined;
|
|
713
814
|
apiKey?: string | undefined;
|
|
@@ -719,6 +820,7 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
719
820
|
model: string;
|
|
720
821
|
key: string;
|
|
721
822
|
provider?: string | undefined;
|
|
823
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
722
824
|
baseUrl?: string | undefined;
|
|
723
825
|
label?: string | undefined;
|
|
724
826
|
apiKey?: string | undefined;
|
|
@@ -731,6 +833,7 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
731
833
|
provider: string | undefined;
|
|
732
834
|
model: string;
|
|
733
835
|
key: string;
|
|
836
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
734
837
|
baseUrl?: string | undefined;
|
|
735
838
|
label?: string | undefined;
|
|
736
839
|
apiKey?: string | undefined;
|
|
@@ -741,6 +844,7 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
741
844
|
model: string;
|
|
742
845
|
key: string;
|
|
743
846
|
provider?: string | undefined;
|
|
847
|
+
thinking?: "enabled" | "disabled" | undefined;
|
|
744
848
|
baseUrl?: string | undefined;
|
|
745
849
|
label?: string | undefined;
|
|
746
850
|
apiKey?: string | undefined;
|
|
@@ -821,16 +925,16 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
821
925
|
args?: string[] | undefined;
|
|
822
926
|
headers?: Record<string, string> | undefined;
|
|
823
927
|
command?: string | undefined;
|
|
824
|
-
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
825
928
|
env?: Record<string, string> | undefined;
|
|
929
|
+
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
826
930
|
}, {
|
|
827
931
|
name: string;
|
|
828
932
|
url?: string | undefined;
|
|
829
933
|
args?: string[] | undefined;
|
|
830
934
|
headers?: Record<string, string> | undefined;
|
|
831
935
|
command?: string | undefined;
|
|
832
|
-
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
833
936
|
env?: Record<string, string> | undefined;
|
|
937
|
+
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
834
938
|
}>>>;
|
|
835
939
|
instructions: z.ZodDefault<z.ZodObject<{
|
|
836
940
|
fileName: z.ZodDefault<z.ZodString>;
|
|
@@ -905,6 +1009,28 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
905
1009
|
}, {
|
|
906
1010
|
format?: "text" | "json" | "jsonl" | "stream-json" | undefined;
|
|
907
1011
|
}>>;
|
|
1012
|
+
/**
|
|
1013
|
+
* OS-level sandbox for shell-tool execution. "auto" picks per platform:
|
|
1014
|
+
* Seatbelt on macOS, bubblewrap on Linux when installed, otherwise off.
|
|
1015
|
+
* Defaults are applied per Engine run depending on headless vs REPL —
|
|
1016
|
+
* see Engine.run() and run.ts.
|
|
1017
|
+
*/
|
|
1018
|
+
sandbox: z.ZodOptional<z.ZodObject<{
|
|
1019
|
+
mode: z.ZodOptional<z.ZodEnum<["off", "auto", "seatbelt", "bwrap"]>>;
|
|
1020
|
+
writableRoots: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1021
|
+
deniedReads: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1022
|
+
network: z.ZodOptional<z.ZodEnum<["allow", "deny"]>>;
|
|
1023
|
+
}, "strip", z.ZodTypeAny, {
|
|
1024
|
+
mode?: "auto" | "off" | "seatbelt" | "bwrap" | undefined;
|
|
1025
|
+
writableRoots?: string[] | undefined;
|
|
1026
|
+
deniedReads?: string[] | undefined;
|
|
1027
|
+
network?: "allow" | "deny" | undefined;
|
|
1028
|
+
}, {
|
|
1029
|
+
mode?: "auto" | "off" | "seatbelt" | "bwrap" | undefined;
|
|
1030
|
+
writableRoots?: string[] | undefined;
|
|
1031
|
+
deniedReads?: string[] | undefined;
|
|
1032
|
+
network?: "allow" | "deny" | undefined;
|
|
1033
|
+
}>>;
|
|
908
1034
|
}, z.ZodTypeAny, "passthrough">>;
|
|
909
1035
|
export type ValidatedSettings = z.infer<typeof SettingsSchema>;
|
|
910
1036
|
export declare function validateSettings(raw: unknown): ValidatedSettings;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {b}from'./chunk-ZSAONDT6.js';import {h,a}from'./chunk-3QP5BQ3L.js';h();var p='Generate a very brief (under 40 chars) summary of what these tools did. Use past tense, commit-subject style. Examples: "Read 3 config files", "Fixed import in auth.ts", "Searched for API endpoints". Respond with ONLY the summary text, nothing else.';async function d(r,a,l){if(r.length===0)return null;try{let e=[];for(let t=0;t<r.length;t++){let s=r[t],o=a[t],u=JSON.stringify(s.args).slice(0,200),c=(o?.result??o?.error??"").slice(0,300);e.push(`Tool: ${s.toolName}(${u}) \u2192 ${c}`);}return (await l(p,e.join(`
|
|
2
|
+
`)))?.trim()||null}catch(e){return b.warn("tool_summary.failed",{error:e.message}),null}}a(d,"generateToolUseSummary");export{d as generateToolUseSummary};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Built-in Bash shell command execution tool.
|
|
3
|
+
*
|
|
4
|
+
* Spawns commands under an optional OS-level sandbox (Seatbelt on macOS,
|
|
5
|
+
* bubblewrap on Linux). The sandbox is selected by the Engine and handed
|
|
6
|
+
* down via ToolContext.sandbox. Without a sandbox we fall back to the
|
|
7
|
+
* historical behavior — plain shell spawn in the user's environment.
|
|
3
8
|
*/
|
|
9
|
+
import type { ToolContext } from "../context.js";
|
|
4
10
|
import type { ToolDefinition } from "../../types.js";
|
|
5
11
|
export declare const bashToolDef: ToolDefinition;
|
|
6
|
-
export declare function bashTool(args: Record<string, unknown
|
|
12
|
+
export declare function bashTool(args: Record<string, unknown>, ctx?: ToolContext): Promise<string>;
|
|
@@ -16,6 +16,7 @@ import type { LLMConfig, StreamCallback } from "../types.js";
|
|
|
16
16
|
import type { ModelPool } from "../llm/model-pool.js";
|
|
17
17
|
import type { ToolRegistry } from "./registry.js";
|
|
18
18
|
import type { AgentPresetName } from "../preset/index.js";
|
|
19
|
+
import type { SandboxBackend } from "./sandbox/index.js";
|
|
19
20
|
/** One choice in a multiple-choice AskUserQuestion. */
|
|
20
21
|
export interface AskUserChoice {
|
|
21
22
|
label: string;
|
|
@@ -86,6 +87,12 @@ export interface ToolContext {
|
|
|
86
87
|
askUser?: AskUserFn;
|
|
87
88
|
/** Sub-agent spawner (Agent tool). Undefined → Agent tool unavailable. */
|
|
88
89
|
subAgentSpawner?: SubAgentSpawner;
|
|
90
|
+
/**
|
|
91
|
+
* Active sandbox backend for the Bash tool. Undefined falls back to "off"
|
|
92
|
+
* (plain spawn). Headless runs default to an OS-level sandbox; the REPL
|
|
93
|
+
* defaults to off because a human is in the loop to approve commands.
|
|
94
|
+
*/
|
|
95
|
+
sandbox?: SandboxBackend;
|
|
89
96
|
/** Optional cancellation signal for the whole turn. */
|
|
90
97
|
signal?: AbortSignal;
|
|
91
98
|
}
|
|
@@ -8,6 +8,7 @@ import { PermissionClassifier } from "./permission.js";
|
|
|
8
8
|
import { logger as rootLogger } from "../logging/logger.js";
|
|
9
9
|
import type { ToolContext } from "./context.js";
|
|
10
10
|
import type { InvestigationGuard } from "./investigation-guard.js";
|
|
11
|
+
import type { TaskGuard } from "./task-guard.js";
|
|
11
12
|
type Logger = typeof rootLogger;
|
|
12
13
|
export declare class ToolExecutor {
|
|
13
14
|
private readonly registry;
|
|
@@ -23,9 +24,12 @@ export declare class ToolExecutor {
|
|
|
23
24
|
*/
|
|
24
25
|
private log;
|
|
25
26
|
private guard?;
|
|
27
|
+
private taskGuard?;
|
|
26
28
|
constructor(registry: ToolRegistry, permission: PermissionClassifier, hooks: HookRegistry);
|
|
27
29
|
setInvestigationGuard(guard: InvestigationGuard | undefined): void;
|
|
28
30
|
getInvestigationGuard(): InvestigationGuard | undefined;
|
|
31
|
+
setTaskGuard(guard: TaskGuard | undefined): void;
|
|
32
|
+
getTaskGuard(): TaskGuard | undefined;
|
|
29
33
|
/** Set the abort signal for cascading cancellation. */
|
|
30
34
|
setSignal(signal?: AbortSignal): void;
|
|
31
35
|
/** Set the per-Engine ToolContext (askUser, llmConfig, modelPool, etc.). */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Linux bubblewrap backend.
|
|
3
|
+
*
|
|
4
|
+
* bwrap creates a fresh mount namespace, then bind-mounts only what we tell
|
|
5
|
+
* it. We bind / read-only and overlay writableRoots as read-write. PID,
|
|
6
|
+
* IPC, UTS, cgroup namespaces are unshared. Network is shared unless
|
|
7
|
+
* config.network === "deny".
|
|
8
|
+
*
|
|
9
|
+
* Sensitive directories listed in deniedReads are shadowed with a tmpfs so
|
|
10
|
+
* the inner process literally cannot see them even though `/` is mounted.
|
|
11
|
+
*/
|
|
12
|
+
import type { SandboxBackend, SandboxConfig } from "./index.js";
|
|
13
|
+
export declare function createBwrapBackend(config: SandboxConfig): SandboxBackend;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sandbox backends for shell command execution.
|
|
3
|
+
*
|
|
4
|
+
* We wrap Bash-tool commands in an OS-level sandbox so a misbehaving (or
|
|
5
|
+
* prompt-injected) model can't reach beyond the workspace. The sandbox runs
|
|
6
|
+
* the user's command inside an isolated process tree with restricted file
|
|
7
|
+
* and (optionally) network access. The Engine itself is NOT sandboxed; only
|
|
8
|
+
* the spawned shell is. File-editing tools (Edit/Write) keep going through
|
|
9
|
+
* the application-layer permission gate.
|
|
10
|
+
*
|
|
11
|
+
* Backends are platform-specific:
|
|
12
|
+
* - "seatbelt" macOS sandbox-exec, built into macOS, zero install
|
|
13
|
+
* - "bwrap" Linux bubblewrap, requires `apt install bubblewrap`
|
|
14
|
+
* - "off" passthrough, no sandboxing (current behavior)
|
|
15
|
+
*
|
|
16
|
+
* "auto" picks per platform at startup; falls back to "off" with a warning
|
|
17
|
+
* when no sandbox is available.
|
|
18
|
+
*/
|
|
19
|
+
export type SandboxMode = "off" | "auto" | "seatbelt" | "bwrap";
|
|
20
|
+
export type SandboxNetworkPolicy = "allow" | "deny";
|
|
21
|
+
export interface SandboxConfig {
|
|
22
|
+
mode: SandboxMode;
|
|
23
|
+
writableRoots: string[];
|
|
24
|
+
deniedReads: string[];
|
|
25
|
+
network: SandboxNetworkPolicy;
|
|
26
|
+
}
|
|
27
|
+
export interface SandboxBackend {
|
|
28
|
+
/** Resolved backend name — "off" means no sandboxing. */
|
|
29
|
+
name: "off" | "seatbelt" | "bwrap";
|
|
30
|
+
/**
|
|
31
|
+
* Decide the binary + argv that should actually be spawned to run `command`
|
|
32
|
+
* under this sandbox. The shell still interprets `command`; we only swap
|
|
33
|
+
* the outer process.
|
|
34
|
+
*/
|
|
35
|
+
wrap(command: string, opts: {
|
|
36
|
+
cwd: string;
|
|
37
|
+
shell: string;
|
|
38
|
+
}): {
|
|
39
|
+
file: string;
|
|
40
|
+
args: string[];
|
|
41
|
+
/**
|
|
42
|
+
* Optional callback the Bash tool calls after the child process exits.
|
|
43
|
+
* Backends that allocate per-command resources (e.g. seatbelt writes a
|
|
44
|
+
* profile file to a fresh temp dir) hang their cleanup here so a long
|
|
45
|
+
* session doesn't leak hundreds of temp dirs in /tmp.
|
|
46
|
+
*/
|
|
47
|
+
cleanup?: () => void;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* If `stderr` looks like a sandbox denial, return a short hint string that
|
|
51
|
+
* the Bash tool will append to its result so the model understands why.
|
|
52
|
+
*/
|
|
53
|
+
hintForBlockedOutput?(stderr: string): string | undefined;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Detect which sandbox mechanisms are available on the current host. Used by
|
|
57
|
+
* "auto" mode and surfaced to the user via /sandbox status if desired.
|
|
58
|
+
*/
|
|
59
|
+
export declare function detectSandboxCapabilities(): {
|
|
60
|
+
seatbelt: boolean;
|
|
61
|
+
bwrap: boolean;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Expand `~` and `${workspace}` placeholders against the live cwd and home.
|
|
65
|
+
*/
|
|
66
|
+
export declare function expandPath(p: string, cwd: string): string;
|
|
67
|
+
export declare function expandConfig(config: SandboxConfig, cwd: string): SandboxConfig;
|
|
68
|
+
export declare function defaultSandboxConfig(mode?: SandboxMode): SandboxConfig;
|
|
69
|
+
/**
|
|
70
|
+
* Resolve the active backend given user config + the current host.
|
|
71
|
+
*
|
|
72
|
+
* "off" → off backend
|
|
73
|
+
* "seatbelt" → seatbelt if available, else throws (explicit choice)
|
|
74
|
+
* "bwrap" → bwrap if available, else throws
|
|
75
|
+
* "auto" → seatbelt on macOS, bwrap on Linux with bwrap installed,
|
|
76
|
+
* else off + console warning
|
|
77
|
+
*/
|
|
78
|
+
export declare function resolveSandboxBackend(config: SandboxConfig, cwd: string): Promise<SandboxBackend>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* macOS Seatbelt backend.
|
|
3
|
+
*
|
|
4
|
+
* Builds a sandbox-exec profile that:
|
|
5
|
+
* - Allows reading most of the filesystem (denying everything breaks tooling)
|
|
6
|
+
* - Denies reads of sensitive credential directories
|
|
7
|
+
* - Restricts writes to the workspace + writableRoots
|
|
8
|
+
* - Optionally denies outbound network
|
|
9
|
+
*
|
|
10
|
+
* The profile is written to a fresh temp file per command (cheap; users can
|
|
11
|
+
* have arbitrary writableRoots so we can't cache). The spawned process and
|
|
12
|
+
* its entire subprocess tree inherit the profile via XNU's sandbox framework.
|
|
13
|
+
*
|
|
14
|
+
* sandbox-exec is technically deprecated by Apple but remains the only
|
|
15
|
+
* working OS-level sandbox on macOS and is what Codex CLI / Cursor use today.
|
|
16
|
+
*/
|
|
17
|
+
import type { SandboxBackend, SandboxConfig } from "./index.js";
|
|
18
|
+
export declare function createSeatbeltBackend(config: SandboxConfig): SandboxBackend;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TaskGuard — nudges the model to update stale in_progress tasks.
|
|
3
|
+
*
|
|
4
|
+
* Background: TaskCreate is sticky in the model's working memory only for the
|
|
5
|
+
* first few turns. After enough intervening tool_results (Read/Edit/Bash) the
|
|
6
|
+
* "I have an open task" signal gets diluted and the model finishes its work
|
|
7
|
+
* without ever calling TaskUpdate(status="completed") — so the UI spinner runs
|
|
8
|
+
* forever on a task that the model considers done.
|
|
9
|
+
*
|
|
10
|
+
* Same shape as InvestigationGuard.turnEnded: turn-loop polls at the end of
|
|
11
|
+
* each turn; if anything is in_progress and hasn't been touched in N turns,
|
|
12
|
+
* we emit a <system-reminder> that lands at the top of the next turn.
|
|
13
|
+
*
|
|
14
|
+
* Re-nag policy: don't fire more than once per (task, threshold) pair. A task
|
|
15
|
+
* stale at turn 5 fires once; if the model still ignores it, we wait for it
|
|
16
|
+
* to cross the next threshold (8, 11, …) before firing again. This keeps the
|
|
17
|
+
* reminder from drowning out everything else when the model is genuinely
|
|
18
|
+
* stuck on something unrelated.
|
|
19
|
+
*/
|
|
20
|
+
import type { Task } from "./builtin/task.js";
|
|
21
|
+
export declare class TaskGuard {
|
|
22
|
+
private taskListSource;
|
|
23
|
+
/** Last turn we nagged about a given task id. */
|
|
24
|
+
private lastNagTurn;
|
|
25
|
+
/** Turn the task was first observed in_progress (model-time, not wall-clock). */
|
|
26
|
+
private inProgressSince;
|
|
27
|
+
constructor(taskListSource: () => Task[]);
|
|
28
|
+
turnEnded(turnNumber: number): string | undefined;
|
|
29
|
+
reset(): void;
|
|
30
|
+
}
|