@cjhyy/code-shell 0.1.6 → 0.1.7
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-UBSB5AQH.js +1 -0
- package/dist/arena/index.js +1 -104
- package/dist/arena-OW55ZCHT.js +3 -0
- package/dist/bwrap-PVZMLHZR.js +2 -0
- package/dist/chunk-2NS3JMNK.js +1 -0
- package/dist/chunk-3QP5BQ3L.js +1 -0
- package/dist/chunk-B7K2OWKC.js +2 -0
- package/dist/chunk-EWWK56K6.js +2 -0
- package/dist/chunk-FU7AHZNN.js +1 -0
- package/dist/chunk-HIJ2XXGX.js +1 -0
- package/dist/chunk-KCXSARAA.js +1 -0
- package/dist/chunk-NFH3UQ3E.js +2 -0
- package/dist/chunk-NMBYBGC7.js +250 -0
- package/dist/chunk-NVAZJ5XS.js +2 -0
- package/dist/chunk-O5HFCH2U.js +1 -0
- package/dist/chunk-P6JSTIFM.js +1 -0
- package/dist/chunk-PGANL6F2.js +3 -0
- package/dist/chunk-Q4O2HGWS.js +251 -0
- package/dist/chunk-QTWU7UNA.js +5 -0
- package/dist/chunk-RP26WO4R.js +1 -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-UDPUTFQT.js +2 -0
- package/dist/chunk-W47Z7MGS.js +33 -0
- package/dist/chunk-WI6FSWGU.js +1 -0
- package/dist/chunk-WOP6MJKW.js +1 -0
- package/dist/chunk-XDOWC7EG.js +4 -0
- package/dist/chunk-Y2NS6HPO.js +641 -0
- package/dist/cli/main.js +303 -22060
- package/dist/client-base-6ZZJJYDY.js +1 -0
- package/dist/compaction-ECVQVOCT.js +1 -0
- package/dist/devtools-SGDUOOM4.js +1 -0
- package/dist/engine/engine.d.ts +8 -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/token-counter.d.ts +17 -0
- package/dist/manager-C3TDN6MS.js +1 -0
- package/dist/mcp-manager-OP4XYV53.js +1 -0
- package/dist/memory-BNI4WEWL.js +1 -0
- package/dist/model-cache-HEDXI7UJ.js +1 -0
- package/dist/model-fetcher-BJ64META.js +1 -0
- package/dist/off-7SDVMMXW.js +1 -0
- package/dist/openai-KEWQ54TM.js +1 -0
- package/dist/openrouter-models-AM6M52D6.js +1 -0
- package/dist/openrouter-sync-5JNBL3Z6.js +1 -0
- package/dist/product/index.js +1 -21
- package/dist/run/index.js +1 -48
- package/dist/seatbelt-WBYROQT6.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 +72 -6
- package/dist/tool-summary-5UE62VU4.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/sandbox/bwrap.d.ts +13 -0
- package/dist/tool-system/sandbox/index.d.ts +71 -0
- package/dist/tool-system/sandbox/off.d.ts +2 -0
- package/dist/tool-system/sandbox/seatbelt.d.ts +18 -0
- package/dist/types.d.ts +4 -0
- package/dist/ui/components/SessionPicker.d.ts +2 -0
- package/dist/ui/components/SpinnerWithVerb.d.ts +2 -2
- package/dist/ui/components/StatusLine.d.ts +2 -2
- 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
|
@@ -219,16 +219,16 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
219
219
|
args?: string[] | undefined;
|
|
220
220
|
headers?: Record<string, string> | undefined;
|
|
221
221
|
command?: string | undefined;
|
|
222
|
-
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
223
222
|
env?: Record<string, string> | undefined;
|
|
223
|
+
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
224
224
|
}, {
|
|
225
225
|
name: string;
|
|
226
226
|
url?: string | undefined;
|
|
227
227
|
args?: string[] | undefined;
|
|
228
228
|
headers?: Record<string, string> | undefined;
|
|
229
229
|
command?: string | undefined;
|
|
230
|
-
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
231
230
|
env?: Record<string, string> | undefined;
|
|
231
|
+
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
232
232
|
}>>>;
|
|
233
233
|
instructions: z.ZodDefault<z.ZodObject<{
|
|
234
234
|
fileName: z.ZodDefault<z.ZodString>;
|
|
@@ -303,6 +303,28 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
303
303
|
}, {
|
|
304
304
|
format?: "text" | "json" | "jsonl" | "stream-json" | undefined;
|
|
305
305
|
}>>;
|
|
306
|
+
/**
|
|
307
|
+
* OS-level sandbox for shell-tool execution. "auto" picks per platform:
|
|
308
|
+
* Seatbelt on macOS, bubblewrap on Linux when installed, otherwise off.
|
|
309
|
+
* Defaults are applied per Engine run depending on headless vs REPL —
|
|
310
|
+
* see Engine.run() and run.ts.
|
|
311
|
+
*/
|
|
312
|
+
sandbox: z.ZodOptional<z.ZodObject<{
|
|
313
|
+
mode: z.ZodOptional<z.ZodEnum<["off", "auto", "seatbelt", "bwrap"]>>;
|
|
314
|
+
writableRoots: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
315
|
+
deniedReads: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
316
|
+
network: z.ZodOptional<z.ZodEnum<["allow", "deny"]>>;
|
|
317
|
+
}, "strip", z.ZodTypeAny, {
|
|
318
|
+
mode?: "auto" | "off" | "seatbelt" | "bwrap" | undefined;
|
|
319
|
+
writableRoots?: string[] | undefined;
|
|
320
|
+
deniedReads?: string[] | undefined;
|
|
321
|
+
network?: "allow" | "deny" | undefined;
|
|
322
|
+
}, {
|
|
323
|
+
mode?: "auto" | "off" | "seatbelt" | "bwrap" | undefined;
|
|
324
|
+
writableRoots?: string[] | undefined;
|
|
325
|
+
deniedReads?: string[] | undefined;
|
|
326
|
+
network?: "allow" | "deny" | undefined;
|
|
327
|
+
}>>;
|
|
306
328
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
307
329
|
agent: z.ZodDefault<z.ZodObject<{
|
|
308
330
|
preset: z.ZodDefault<z.ZodString>;
|
|
@@ -520,16 +542,16 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
520
542
|
args?: string[] | undefined;
|
|
521
543
|
headers?: Record<string, string> | undefined;
|
|
522
544
|
command?: string | undefined;
|
|
523
|
-
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
524
545
|
env?: Record<string, string> | undefined;
|
|
546
|
+
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
525
547
|
}, {
|
|
526
548
|
name: string;
|
|
527
549
|
url?: string | undefined;
|
|
528
550
|
args?: string[] | undefined;
|
|
529
551
|
headers?: Record<string, string> | undefined;
|
|
530
552
|
command?: string | undefined;
|
|
531
|
-
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
532
553
|
env?: Record<string, string> | undefined;
|
|
554
|
+
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
533
555
|
}>>>;
|
|
534
556
|
instructions: z.ZodDefault<z.ZodObject<{
|
|
535
557
|
fileName: z.ZodDefault<z.ZodString>;
|
|
@@ -604,6 +626,28 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
604
626
|
}, {
|
|
605
627
|
format?: "text" | "json" | "jsonl" | "stream-json" | undefined;
|
|
606
628
|
}>>;
|
|
629
|
+
/**
|
|
630
|
+
* OS-level sandbox for shell-tool execution. "auto" picks per platform:
|
|
631
|
+
* Seatbelt on macOS, bubblewrap on Linux when installed, otherwise off.
|
|
632
|
+
* Defaults are applied per Engine run depending on headless vs REPL —
|
|
633
|
+
* see Engine.run() and run.ts.
|
|
634
|
+
*/
|
|
635
|
+
sandbox: z.ZodOptional<z.ZodObject<{
|
|
636
|
+
mode: z.ZodOptional<z.ZodEnum<["off", "auto", "seatbelt", "bwrap"]>>;
|
|
637
|
+
writableRoots: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
638
|
+
deniedReads: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
639
|
+
network: z.ZodOptional<z.ZodEnum<["allow", "deny"]>>;
|
|
640
|
+
}, "strip", z.ZodTypeAny, {
|
|
641
|
+
mode?: "auto" | "off" | "seatbelt" | "bwrap" | undefined;
|
|
642
|
+
writableRoots?: string[] | undefined;
|
|
643
|
+
deniedReads?: string[] | undefined;
|
|
644
|
+
network?: "allow" | "deny" | undefined;
|
|
645
|
+
}, {
|
|
646
|
+
mode?: "auto" | "off" | "seatbelt" | "bwrap" | undefined;
|
|
647
|
+
writableRoots?: string[] | undefined;
|
|
648
|
+
deniedReads?: string[] | undefined;
|
|
649
|
+
network?: "allow" | "deny" | undefined;
|
|
650
|
+
}>>;
|
|
607
651
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
608
652
|
agent: z.ZodDefault<z.ZodObject<{
|
|
609
653
|
preset: z.ZodDefault<z.ZodString>;
|
|
@@ -821,16 +865,16 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
821
865
|
args?: string[] | undefined;
|
|
822
866
|
headers?: Record<string, string> | undefined;
|
|
823
867
|
command?: string | undefined;
|
|
824
|
-
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
825
868
|
env?: Record<string, string> | undefined;
|
|
869
|
+
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
826
870
|
}, {
|
|
827
871
|
name: string;
|
|
828
872
|
url?: string | undefined;
|
|
829
873
|
args?: string[] | undefined;
|
|
830
874
|
headers?: Record<string, string> | undefined;
|
|
831
875
|
command?: string | undefined;
|
|
832
|
-
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
833
876
|
env?: Record<string, string> | undefined;
|
|
877
|
+
transport?: "stdio" | "sse" | "streamable-http" | "inprocess" | undefined;
|
|
834
878
|
}>>>;
|
|
835
879
|
instructions: z.ZodDefault<z.ZodObject<{
|
|
836
880
|
fileName: z.ZodDefault<z.ZodString>;
|
|
@@ -905,6 +949,28 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
905
949
|
}, {
|
|
906
950
|
format?: "text" | "json" | "jsonl" | "stream-json" | undefined;
|
|
907
951
|
}>>;
|
|
952
|
+
/**
|
|
953
|
+
* OS-level sandbox for shell-tool execution. "auto" picks per platform:
|
|
954
|
+
* Seatbelt on macOS, bubblewrap on Linux when installed, otherwise off.
|
|
955
|
+
* Defaults are applied per Engine run depending on headless vs REPL —
|
|
956
|
+
* see Engine.run() and run.ts.
|
|
957
|
+
*/
|
|
958
|
+
sandbox: z.ZodOptional<z.ZodObject<{
|
|
959
|
+
mode: z.ZodOptional<z.ZodEnum<["off", "auto", "seatbelt", "bwrap"]>>;
|
|
960
|
+
writableRoots: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
961
|
+
deniedReads: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
962
|
+
network: z.ZodOptional<z.ZodEnum<["allow", "deny"]>>;
|
|
963
|
+
}, "strip", z.ZodTypeAny, {
|
|
964
|
+
mode?: "auto" | "off" | "seatbelt" | "bwrap" | undefined;
|
|
965
|
+
writableRoots?: string[] | undefined;
|
|
966
|
+
deniedReads?: string[] | undefined;
|
|
967
|
+
network?: "allow" | "deny" | undefined;
|
|
968
|
+
}, {
|
|
969
|
+
mode?: "auto" | "off" | "seatbelt" | "bwrap" | undefined;
|
|
970
|
+
writableRoots?: string[] | undefined;
|
|
971
|
+
deniedReads?: string[] | undefined;
|
|
972
|
+
network?: "allow" | "deny" | undefined;
|
|
973
|
+
}>>;
|
|
908
974
|
}, z.ZodTypeAny, "passthrough">>;
|
|
909
975
|
export type ValidatedSettings = z.infer<typeof SettingsSchema>;
|
|
910
976
|
export declare function validateSettings(raw: unknown): ValidatedSettings;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {b}from'./chunk-B7K2OWKC.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
|
}
|
|
@@ -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,71 @@
|
|
|
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
|
+
/**
|
|
43
|
+
* If `stderr` looks like a sandbox denial, return a short hint string that
|
|
44
|
+
* the Bash tool will append to its result so the model understands why.
|
|
45
|
+
*/
|
|
46
|
+
hintForBlockedOutput?(stderr: string): string | undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Detect which sandbox mechanisms are available on the current host. Used by
|
|
50
|
+
* "auto" mode and surfaced to the user via /sandbox status if desired.
|
|
51
|
+
*/
|
|
52
|
+
export declare function detectSandboxCapabilities(): {
|
|
53
|
+
seatbelt: boolean;
|
|
54
|
+
bwrap: boolean;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Expand `~` and `${workspace}` placeholders against the live cwd and home.
|
|
58
|
+
*/
|
|
59
|
+
export declare function expandPath(p: string, cwd: string): string;
|
|
60
|
+
export declare function expandConfig(config: SandboxConfig, cwd: string): SandboxConfig;
|
|
61
|
+
export declare function defaultSandboxConfig(mode?: SandboxMode): SandboxConfig;
|
|
62
|
+
/**
|
|
63
|
+
* Resolve the active backend given user config + the current host.
|
|
64
|
+
*
|
|
65
|
+
* "off" → off backend
|
|
66
|
+
* "seatbelt" → seatbelt if available, else throws (explicit choice)
|
|
67
|
+
* "bwrap" → bwrap if available, else throws
|
|
68
|
+
* "auto" → seatbelt on macOS, bwrap on Linux with bwrap installed,
|
|
69
|
+
* else off + console warning
|
|
70
|
+
*/
|
|
71
|
+
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;
|
package/dist/types.d.ts
CHANGED
|
@@ -169,6 +169,7 @@ export interface TaskInfo {
|
|
|
169
169
|
export type StreamEvent = {
|
|
170
170
|
type: "session_started";
|
|
171
171
|
sessionId: string;
|
|
172
|
+
promptTokens: number;
|
|
172
173
|
} | {
|
|
173
174
|
type: "stream_request_start";
|
|
174
175
|
turnNumber: number;
|
|
@@ -176,6 +177,7 @@ export type StreamEvent = {
|
|
|
176
177
|
} | {
|
|
177
178
|
type: "text_delta";
|
|
178
179
|
text: string;
|
|
180
|
+
tokens?: number;
|
|
179
181
|
agentId?: string;
|
|
180
182
|
} | {
|
|
181
183
|
type: "tool_use_start";
|
|
@@ -258,6 +260,8 @@ export interface LLMResponse {
|
|
|
258
260
|
export interface LLMStreamChunk {
|
|
259
261
|
type: "text" | "tool_use_start" | "tool_use_delta" | "tool_use_end" | "stop";
|
|
260
262
|
text?: string;
|
|
263
|
+
/** Token count for this text delta, when provider can compute it. */
|
|
264
|
+
tokens?: number;
|
|
261
265
|
toolCall?: Partial<ToolCall>;
|
|
262
266
|
stopReason?: string;
|
|
263
267
|
}
|
|
@@ -5,9 +5,9 @@ import { type MutableRefObject } from "react";
|
|
|
5
5
|
export type SpinnerMode = "responding" | "tool-use" | "thinking";
|
|
6
6
|
interface SpinnerWithVerbProps {
|
|
7
7
|
mode: SpinnerMode;
|
|
8
|
-
|
|
8
|
+
streamingTokensRef?: MutableRefObject<number>;
|
|
9
9
|
runStartRef?: MutableRefObject<number>;
|
|
10
10
|
thinkingContent?: string;
|
|
11
11
|
}
|
|
12
|
-
export declare function SpinnerWithVerb({ mode,
|
|
12
|
+
export declare function SpinnerWithVerb({ mode, streamingTokensRef, runStartRef, thinkingContent, }: SpinnerWithVerbProps): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -17,8 +17,8 @@ interface StatusLineProps {
|
|
|
17
17
|
maxContextTokens?: number;
|
|
18
18
|
gitBranch?: string;
|
|
19
19
|
isRunning?: boolean;
|
|
20
|
-
|
|
20
|
+
streamingTokensRef?: MutableRefObject<number>;
|
|
21
21
|
runStartRef?: MutableRefObject<number>;
|
|
22
22
|
}
|
|
23
|
-
export declare function StatusLine({ model, effort, tokens, cost, sessionId, baseContextTokens, maxContextTokens, gitBranch, isRunning,
|
|
23
|
+
export declare function StatusLine({ model, effort, tokens, cost, sessionId, baseContextTokens, maxContextTokens, gitBranch, isRunning, streamingTokensRef, runStartRef, }: StatusLineProps): import("react/jsx-runtime").JSX.Element;
|
|
24
24
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{f as __internal,a as checkForUpdate,c as getAutoUpdateDisabledReason,e as getCurrentVersion,b as getUpdateAvailable,d as scheduleAutoInstallOnExit}from'./chunk-TKJA6W36.js';import'./chunk-3QP5BQ3L.js';
|
package/package.json
CHANGED
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cjhyy/code-shell",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Code Shell — general-purpose agent orchestration framework with a terminal coding preset",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/index.js"
|
|
13
|
-
"require": "./dist/index.cjs"
|
|
12
|
+
"import": "./dist/index.js"
|
|
14
13
|
},
|
|
15
14
|
"./run": {
|
|
16
15
|
"types": "./dist/run/index.d.ts",
|
|
17
|
-
"import": "./dist/run/index.js"
|
|
18
|
-
"require": "./dist/run/index.cjs"
|
|
16
|
+
"import": "./dist/run/index.js"
|
|
19
17
|
},
|
|
20
18
|
"./arena": {
|
|
21
19
|
"types": "./dist/arena/index.d.ts",
|
|
22
|
-
"import": "./dist/arena/index.js"
|
|
23
|
-
"require": "./dist/arena/index.cjs"
|
|
20
|
+
"import": "./dist/arena/index.js"
|
|
24
21
|
},
|
|
25
22
|
"./product": {
|
|
26
23
|
"types": "./dist/product/index.d.ts",
|
|
27
|
-
"import": "./dist/product/index.js"
|
|
28
|
-
"require": "./dist/product/index.cjs"
|
|
24
|
+
"import": "./dist/product/index.js"
|
|
29
25
|
},
|
|
30
26
|
"./package.json": "./package.json"
|
|
31
27
|
},
|
|
@@ -95,6 +91,7 @@
|
|
|
95
91
|
"emoji-regex": "^10.6.0",
|
|
96
92
|
"get-east-asian-width": "^1.5.0",
|
|
97
93
|
"glob": "^11.0.0",
|
|
94
|
+
"gpt-tokenizer": "^3.4.0",
|
|
98
95
|
"indent-string": "^5.0.0",
|
|
99
96
|
"lodash-es": "^4.17.23",
|
|
100
97
|
"marked": "^17.0.5",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkYIQBXAYUcjs = require('./chunk-YIQBXAYU.cjs');
|
|
4
|
-
require('./chunk-7EG3V4JY.cjs');
|
|
5
|
-
require('./chunk-2YW4FPFG.cjs');
|
|
6
|
-
require('./chunk-IK4EWJBP.cjs');
|
|
7
|
-
require('./chunk-KS3RYAYL.cjs');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.AnthropicClient = _chunkYIQBXAYUcjs.AnthropicClient;
|
package/dist/arena/index.cjs
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _chunkDDB6QOKJcjs = require('../chunk-DDB6QOKJ.cjs');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var _chunkWZJV6DJCcjs = require('../chunk-WZJV6DJC.cjs');
|
|
52
|
-
require('../chunk-YKIAELDZ.cjs');
|
|
53
|
-
require('../chunk-2YW4FPFG.cjs');
|
|
54
|
-
require('../chunk-IK4EWJBP.cjs');
|
|
55
|
-
require('../chunk-KS3RYAYL.cjs');
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
exports.Arena = _chunkWZJV6DJCcjs.Arena; exports.ArenaLedger = _chunkWZJV6DJCcjs.ArenaLedger; exports.DiscussionStrategy = _chunkWZJV6DJCcjs.DiscussionStrategy; exports.IterativeArena = _chunkDDB6QOKJcjs.IterativeArena; exports.LENS_NAMES = _chunkWZJV6DJCcjs.LENS_NAMES; exports.MODEL_PRESETS = _chunkWZJV6DJCcjs.MODEL_PRESETS; exports.PlanningStrategy = _chunkWZJV6DJCcjs.PlanningStrategy; exports.ReviewStrategy = _chunkWZJV6DJCcjs.ReviewStrategy; exports.applyReviewResult = _chunkWZJV6DJCcjs.applyReviewResult; exports.buildConsensus = _chunkWZJV6DJCcjs.buildConsensus; exports.buildDigest = _chunkWZJV6DJCcjs.buildDigest; exports.buildLensPrompt = _chunkWZJV6DJCcjs.buildLensPrompt; exports.collectEvidence = _chunkWZJV6DJCcjs.collectEvidence; exports.createProgressRenderer = _chunkWZJV6DJCcjs.createProgressRenderer; exports.defaultIterateConvergence = _chunkDDB6QOKJcjs.defaultConvergence; exports.formatArenaResult = _chunkWZJV6DJCcjs.formatArenaResult; exports.formatArenaResultForSession = _chunkWZJV6DJCcjs.formatArenaResultForSession; exports.formatDigest = _chunkWZJV6DJCcjs.formatDigest; exports.getIterateFormat = _chunkDDB6QOKJcjs.getFormat; exports.getLens = _chunkWZJV6DJCcjs.getLens; exports.getMaxOutputTokens = _chunkWZJV6DJCcjs.getMaxOutputTokens; exports.getStrategy = _chunkWZJV6DJCcjs.getStrategy; exports.getStrategyForPlan = _chunkWZJV6DJCcjs.getStrategyForPlan; exports.hasTools = _chunkWZJV6DJCcjs.hasTools; exports.isStrategyV2 = _chunkWZJV6DJCcjs.isStrategyV2; exports.isTerminal = _chunkWZJV6DJCcjs.isTerminal; exports.iterateCodeFormat = _chunkDDB6QOKJcjs.codeFormat; exports.iterateDiffRatio = _chunkDDB6QOKJcjs.diffRatio; exports.iterateDocumentFormat = _chunkDDB6QOKJcjs.documentFormat; exports.markUnderReview = _chunkWZJV6DJCcjs.markUnderReview; exports.markUnresolved = _chunkWZJV6DJCcjs.markUnresolved; exports.planArena = _chunkWZJV6DJCcjs.planArena; exports.printArenaResult = _chunkWZJV6DJCcjs.printArenaResult; exports.registerClaims = _chunkWZJV6DJCcjs.registerClaims; exports.renderProgress = _chunkWZJV6DJCcjs.renderProgress; exports.resolveClaimStatus = _chunkWZJV6DJCcjs.resolveClaimStatus; exports.resolveLenses = _chunkWZJV6DJCcjs.resolveLenses; exports.runAdjudication = _chunkWZJV6DJCcjs.runAdjudication; exports.runCrossReview = _chunkWZJV6DJCcjs.runCrossReview; exports.runDebateRounds = _chunkWZJV6DJCcjs.runDebateRounds; exports.runParticipantResearch = _chunkWZJV6DJCcjs.runParticipantResearch; exports.runParticipantResearchWithDossiers = _chunkWZJV6DJCcjs.runParticipantResearchWithDossiers; exports.runVerificationReview = _chunkWZJV6DJCcjs.runVerificationReview; exports.selectClaimsForReview = _chunkWZJV6DJCcjs.selectClaimsForReview; exports.selectTools = _chunkWZJV6DJCcjs.selectTools; exports.transitionClaim = _chunkWZJV6DJCcjs.transitionClaim; exports.validTransitions = _chunkWZJV6DJCcjs.validTransitions;
|