@swifty.js/swifty 0.0.32 → 0.0.35

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 (101) hide show
  1. package/README.md +64 -0
  2. package/dist/acp-A4KRKOHD.js +14 -0
  3. package/dist/agent-VDWIGFIV.js +4 -0
  4. package/dist/anthropic-AR2Y4FBR.js +4 -0
  5. package/dist/bwrap-4KOC7P3X.js +4 -0
  6. package/dist/chunk-2U4IWZ6E.js +4 -0
  7. package/dist/{chunk-2EV72T5X.js → chunk-325L2ILZ.js} +1 -1
  8. package/dist/chunk-35X3GW25.js +4 -0
  9. package/dist/chunk-44LPRRYU.js +60 -0
  10. package/dist/chunk-4B4SGVJH.js +164 -0
  11. package/dist/chunk-5W2TCASL.js +4 -0
  12. package/dist/chunk-6I3HEMIE.js +4 -0
  13. package/dist/{chunk-TKQ5T5VO.js → chunk-7JQHFZRD.js} +2 -2
  14. package/dist/chunk-F4FOFPKL.js +611 -0
  15. package/dist/chunk-FZORZF22.js +16 -0
  16. package/dist/chunk-G2TE2QZM.js +4 -0
  17. package/dist/{chunk-JMF2DWGY.js → chunk-H56UQALW.js} +1 -1
  18. package/dist/chunk-IOLGXPUQ.js +6 -0
  19. package/dist/chunk-IXCJZNBB.js +5 -0
  20. package/dist/chunk-IZ7QOBSB.js +4 -0
  21. package/dist/chunk-JC44NVST.js +4 -0
  22. package/dist/chunk-LC7ZWLIH.js +4 -0
  23. package/dist/chunk-M4D66APS.js +67 -0
  24. package/dist/chunk-NCZR3AGA.js +65 -0
  25. package/dist/chunk-NDPYUGE5.js +5 -0
  26. package/dist/chunk-PH643I2P.js +4 -0
  27. package/dist/{chunk-FPQ2LBL4.js → chunk-QQVDL4QT.js} +1 -1
  28. package/dist/{chunk-TCQ4EB4G.js → chunk-TNF3EHFY.js} +1 -1
  29. package/dist/{server-QMMIYNXW.js → chunk-TOM34LJB.js} +16 -16
  30. package/dist/{chunk-NERVCUWE.js → chunk-UJGMTIYO.js} +1 -1
  31. package/dist/chunk-XGUH7SGV.js +4 -0
  32. package/dist/chunk-YBS5ATGZ.js +4 -0
  33. package/dist/chunk-YKWIZE5D.js +4 -0
  34. package/dist/{devtools-OJ75EP3T.js → devtools-WJM4UVVT.js} +1 -1
  35. package/dist/esm-46WSO26W.js +4 -0
  36. package/dist/esm-6EDGM6QS.js +4 -0
  37. package/dist/esm-D6BB3FBR.js +4 -0
  38. package/dist/esm-P2KEXEEK.js +4 -0
  39. package/dist/esm-VBV56AO5.js +229 -0
  40. package/dist/esm-XYKZYVLV.js +4 -0
  41. package/dist/esm-YJVVI2QX.js +4 -0
  42. package/dist/getMachineId-bsd-NBOQ3GRQ.js +4 -0
  43. package/dist/getMachineId-darwin-6VBNSUFR.js +5 -0
  44. package/dist/getMachineId-linux-RQ33NIOO.js +4 -0
  45. package/dist/getMachineId-unsupported-IWOYPUHZ.js +4 -0
  46. package/dist/getMachineId-win-ITT3WXP6.js +4 -0
  47. package/dist/lib/agent-TC4HSVMS.js +16 -0
  48. package/dist/lib/{anthropic-B33M2AVN.js → anthropic-FKIGL7NL.js} +6 -5
  49. package/dist/lib/bwrap-2OL7VPSO.js +7 -0
  50. package/dist/lib/{chunk-FODSMOWP.js → chunk-6V7RW6HA.js} +34 -16
  51. package/dist/lib/{chunk-TJLAJGG4.js → chunk-ALQHMYOZ.js} +14 -3
  52. package/dist/lib/{chunk-XT67KGWE.js → chunk-BQFVUVLI.js} +12 -2
  53. package/dist/lib/chunk-FFM2LB4C.js +132 -0
  54. package/dist/lib/{chunk-VUD72RTY.js → chunk-FLKB4BK7.js} +16 -5
  55. package/dist/lib/{chunk-3OFLDUAW.js → chunk-HQSYRTER.js} +96 -49
  56. package/dist/lib/{chunk-4BPKIIQD.js → chunk-LRN4MOQ3.js} +31 -5
  57. package/dist/lib/chunk-MLKGABMK.js +9 -0
  58. package/dist/lib/chunk-OJTISIYU.js +462 -0
  59. package/dist/lib/{chunk-BCBD34D2.js → chunk-OLFXCZVH.js} +25 -7
  60. package/dist/lib/{chunk-SOOSTGHI.js → chunk-RUDYC7OS.js} +32 -48
  61. package/dist/lib/{chunk-UH5M7FDP.js → chunk-S5VWPTME.js} +1189 -126
  62. package/dist/lib/chunk-YIWNQ7OA.js +47 -0
  63. package/dist/lib/{chunk-3XCGUKGJ.js → chunk-ZPIF7IJN.js} +219 -6
  64. package/dist/lib/index.d.ts +3267 -1143
  65. package/dist/lib/index.js +13214 -12207
  66. package/dist/lib/{openai-C2PZFGJ2.js → openai-ZWIYIBLC.js} +4 -3
  67. package/dist/lib/{checker-QNMXPZ7C.js → permissions-BW4QPZXV.js} +4 -3
  68. package/dist/lib/providers-ROWSB6ND.js +9 -0
  69. package/dist/lib/sandbox-runtime-CCQ3X3SM.js +9 -0
  70. package/dist/lib/seatbelt-WO7YWKLR.js +7 -0
  71. package/dist/lib/{tool-filter-IMIU7CW2.js → tool-filter-QU4LOZII.js} +2 -1
  72. package/dist/main.js +231 -190
  73. package/dist/{node-GXMM4JG3.js → node-A6KBFKOV.js} +1 -1
  74. package/dist/{openai-M7B2TITO.js → openai-7LMX5HKW.js} +1 -1
  75. package/dist/permissions-74IHQW76.js +4 -0
  76. package/dist/providers-2J4JJYQD.js +4 -0
  77. package/dist/sandbox-runtime-RVW4BK3L.js +4 -0
  78. package/dist/seatbelt-GMQUP6SV.js +4 -0
  79. package/dist/server-ZYK4L22D.js +4 -0
  80. package/dist/src-3A5BCUSZ.js +4 -0
  81. package/dist/src-CRYFVH7Y.js +12 -0
  82. package/dist/src-Y77IB66J.js +4 -0
  83. package/dist/src-ZCW4GCG2.js +4 -0
  84. package/dist/{tool-filter-7LLVAHD5.js → tool-filter-U5SSL3LR.js} +1 -1
  85. package/dist/turndown.es-WNOSVZF6.js +83 -0
  86. package/package.json +34 -5
  87. package/dist/agent-2DUTUJFX.js +0 -4
  88. package/dist/anthropic-KR5MXB5I.js +0 -4
  89. package/dist/bwrap-TPE6G4BM.js +0 -4
  90. package/dist/checker-RKAWOOXC.js +0 -4
  91. package/dist/chunk-4YVJP2CO.js +0 -4
  92. package/dist/chunk-BWWNI2FK.js +0 -121
  93. package/dist/chunk-LTFPTWX4.js +0 -612
  94. package/dist/chunk-S35E7OYL.js +0 -5
  95. package/dist/chunk-TW7RHCDS.js +0 -150
  96. package/dist/chunk-X3UA5OZL.js +0 -4
  97. package/dist/lib/agent-3OEC4SOB.js +0 -10
  98. package/dist/lib/bwrap-QRGPUP4J.js +0 -6
  99. package/dist/lib/chunk-ORSYNBMM.js +0 -38
  100. package/dist/lib/seatbelt-FT5IY73W.js +0 -6
  101. package/dist/seatbelt-3GM2YGXV.js +0 -5
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __swiftyCreateRequire } from "node:module";
3
+ const require = __swiftyCreateRequire(import.meta.url);
4
+ import{a as t,c as L,f as e,m as p,q as _,s as O,t as T,v as s}from"./chunk-G2TE2QZM.js";import"./chunk-FZORZF22.js";import"./chunk-YKWIZE5D.js";import"./chunk-LC7ZWLIH.js";import"./chunk-IZ7QOBSB.js";L();_();s();var E="otlp_http_log_exporter";var r=class extends t{constructor(o={}){super(O(T(o,"LOGS","v1/logs",{"Content-Type":"application/json"}),p,E,e,o.selfObsMeterProvider))}};export{r as OTLPLogExporter};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __swiftyCreateRequire } from "node:module";
3
+ const require = __swiftyCreateRequire(import.meta.url);
4
+ import{a as e,c as _,e as o,l as p,q as O,s as T,t as E,v as a}from"./chunk-G2TE2QZM.js";import"./chunk-FZORZF22.js";import"./chunk-YKWIZE5D.js";import"./chunk-LC7ZWLIH.js";import"./chunk-IZ7QOBSB.js";_();O();a();var P="otlp_http_span_exporter";var r=class extends e{constructor(t={}){super(T(E(t,"TRACES","v1/traces",{"Content-Type":"application/x-protobuf"}),p,P,o,t.selfObsMeterProvider))}};export{r as OTLPTraceExporter};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __swiftyCreateRequire } from "node:module";
3
+ const require = __swiftyCreateRequire(import.meta.url);
4
+ import{a as t,b as s}from"./chunk-6I3HEMIE.js";import{p as r,u as n}from"./chunk-LC7ZWLIH.js";import{b as i}from"./chunk-IZ7QOBSB.js";import{promises as o}from"fs";async function m(){try{return(await o.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(e){r.debug(`error reading machine id: ${e}`)}try{return(await t("kenv -q smbios.system.uuid")).stdout.trim()}catch(e){r.debug(`error reading machine id: ${e}`)}}var a=i(()=>{s();n()});a();export{m as getMachineId};
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __swiftyCreateRequire } from "node:module";
3
+ const require = __swiftyCreateRequire(import.meta.url);
4
+ import{a as n,b as s}from"./chunk-6I3HEMIE.js";import{p as i,u as o}from"./chunk-LC7ZWLIH.js";import{b as d}from"./chunk-IZ7QOBSB.js";async function l(){try{let t=(await n('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
5
+ `).find(c=>c.includes("IOPlatformUUID"));if(!t)return;let r=t.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(e){i.debug(`error reading machine id: ${e}`)}}var a=d(()=>{s();o()});a();export{l as getMachineId};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __swiftyCreateRequire } from "node:module";
3
+ const require = __swiftyCreateRequire(import.meta.url);
4
+ import{p as r,u as a}from"./chunk-LC7ZWLIH.js";import{b as n}from"./chunk-IZ7QOBSB.js";import{promises as o}from"fs";async function m(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let i of t)try{return(await o.readFile(i,{encoding:"utf8"})).trim()}catch(e){r.debug(`error reading machine id: ${e}`)}}var c=n(()=>{a()});c();export{m as getMachineId};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __swiftyCreateRequire } from "node:module";
3
+ const require = __swiftyCreateRequire(import.meta.url);
4
+ import{p as e,u as d}from"./chunk-LC7ZWLIH.js";import{b as n}from"./chunk-IZ7QOBSB.js";async function t(){e.debug("could not read machine-id: unsupported platform")}var o=n(()=>{d()});o();export{t as getMachineId};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __swiftyCreateRequire } from "node:module";
3
+ const require = __swiftyCreateRequire(import.meta.url);
4
+ import{a as s,b as d}from"./chunk-6I3HEMIE.js";import{p as n,u as a}from"./chunk-LC7ZWLIH.js";import{b as o}from"./chunk-IZ7QOBSB.js";import*as r from"process";async function f(){let c="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";r.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in r.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let i=(await s(`${e} ${c}`)).stdout.split("REG_SZ");if(i.length===2)return i[1].trim()}catch(t){n.debug(`error reading machine id: ${t}`)}}var m=o(()=>{d();a()});m();export{f as getMachineId};
@@ -0,0 +1,16 @@
1
+ import {
2
+ Agent,
3
+ events_exports,
4
+ streaming_executor_exports
5
+ } from "./chunk-S5VWPTME.js";
6
+ import "./chunk-OJTISIYU.js";
7
+ import "./chunk-BQFVUVLI.js";
8
+ import "./chunk-HQSYRTER.js";
9
+ import "./chunk-OLFXCZVH.js";
10
+ import "./chunk-ZPIF7IJN.js";
11
+ import "./chunk-MLKGABMK.js";
12
+ export {
13
+ Agent,
14
+ events_exports as Events,
15
+ streaming_executor_exports as StreamingExecutor
16
+ };
@@ -5,11 +5,12 @@ import {
5
5
  markLastUserTailForCache,
6
6
  markToolsForCache,
7
7
  needsToolSearchBeta
8
- } from "./chunk-FODSMOWP.js";
9
- import "./chunk-XT67KGWE.js";
10
- import "./chunk-BCBD34D2.js";
11
- import "./chunk-3OFLDUAW.js";
12
- import "./chunk-3XCGUKGJ.js";
8
+ } from "./chunk-6V7RW6HA.js";
9
+ import "./chunk-BQFVUVLI.js";
10
+ import "./chunk-HQSYRTER.js";
11
+ import "./chunk-OLFXCZVH.js";
12
+ import "./chunk-ZPIF7IJN.js";
13
+ import "./chunk-MLKGABMK.js";
13
14
  export {
14
15
  AnthropicClient,
15
16
  buildAnthropicMessages,
@@ -0,0 +1,7 @@
1
+ import {
2
+ BwrapSandbox
3
+ } from "./chunk-YIWNQ7OA.js";
4
+ import "./chunk-MLKGABMK.js";
5
+ export {
6
+ BwrapSandbox
7
+ };
@@ -1,10 +1,6 @@
1
1
  import {
2
2
  normalizeToolResultContentBlock
3
- } from "./chunk-XT67KGWE.js";
4
- import {
5
- MCP_TOOL_PREFIX,
6
- isMcpToolLike
7
- } from "./chunk-BCBD34D2.js";
3
+ } from "./chunk-BQFVUVLI.js";
8
4
  import {
9
5
  AuthenticationError,
10
6
  ContextTooLongError,
@@ -21,7 +17,11 @@ import {
21
17
  thinkingBudgetForLevel,
22
18
  toAnthropicThinkingEffort,
23
19
  toReasoningEffort
24
- } from "./chunk-3OFLDUAW.js";
20
+ } from "./chunk-HQSYRTER.js";
21
+ import {
22
+ MCP_TOOL_PREFIX,
23
+ isMcpToolLike
24
+ } from "./chunk-OLFXCZVH.js";
25
25
  import {
26
26
  asErrorString,
27
27
  asRecord,
@@ -30,13 +30,37 @@ import {
30
30
  createChildLogger,
31
31
  isRecord,
32
32
  strArg
33
- } from "./chunk-3XCGUKGJ.js";
33
+ } from "./chunk-ZPIF7IJN.js";
34
+ import {
35
+ __export
36
+ } from "./chunk-MLKGABMK.js";
34
37
 
35
38
  // src/llm/anthropic.ts
39
+ var anthropic_exports = {};
40
+ __export(anthropic_exports, {
41
+ AnthropicClient: () => AnthropicClient,
42
+ buildAnthropicMessages: () => buildAnthropicMessages,
43
+ fetchModelContextWindow: () => fetchModelContextWindow,
44
+ markLastUserTailForCache: () => markLastUserTailForCache,
45
+ markToolsForCache: () => markToolsForCache,
46
+ needsToolSearchBeta: () => needsToolSearchBeta
47
+ });
36
48
  import Anthropic from "@anthropic-ai/sdk";
37
49
  import { safeParseAsync, z } from "zod";
38
50
 
39
51
  // src/mcp/strategy.ts
52
+ var strategy_exports = {};
53
+ __export(strategy_exports, {
54
+ CHARS_PER_TOKEN: () => CHARS_PER_TOKEN,
55
+ DEFAULT_EAGER_THRESHOLD_PERCENT: () => DEFAULT_EAGER_THRESHOLD_PERCENT,
56
+ NATIVE_TOOL_USE_BETA: () => NATIVE_TOOL_USE_BETA,
57
+ applyMode: () => applyMode,
58
+ decideAndApply: () => decideAndApply,
59
+ decideMode: () => decideMode,
60
+ estimateSchemaTokens: () => estimateSchemaTokens,
61
+ isOfficialAnthropicEndpoint: () => isOfficialAnthropicEndpoint,
62
+ measureSchemaChars: () => measureSchemaChars
63
+ });
40
64
  var DEFAULT_EAGER_THRESHOLD_PERCENT = 10;
41
65
  var CHARS_PER_TOKEN = 2.5;
42
66
  var NATIVE_TOOL_USE_BETA = "advanced-tool-use-2025-11-20";
@@ -570,19 +594,13 @@ function classifyAnthropicError(err) {
570
594
  }
571
595
 
572
596
  export {
573
- DEFAULT_EAGER_THRESHOLD_PERCENT,
574
- CHARS_PER_TOKEN,
575
- NATIVE_TOOL_USE_BETA,
576
- isOfficialAnthropicEndpoint,
577
- estimateSchemaTokens,
578
- decideMode,
579
- measureSchemaChars,
580
- applyMode,
581
597
  decideAndApply,
598
+ strategy_exports,
582
599
  markToolsForCache,
583
600
  needsToolSearchBeta,
584
601
  fetchModelContextWindow,
585
602
  buildAnthropicMessages,
586
603
  AnthropicClient,
587
- markLastUserTailForCache
604
+ markLastUserTailForCache,
605
+ anthropic_exports
588
606
  };
@@ -11,7 +11,7 @@ import {
11
11
  getThinkingLevel,
12
12
  resolveAPIKey,
13
13
  toReasoningEffort
14
- } from "./chunk-3OFLDUAW.js";
14
+ } from "./chunk-HQSYRTER.js";
15
15
  import {
16
16
  asRecord,
17
17
  asString,
@@ -19,9 +19,19 @@ import {
19
19
  createChildLogger,
20
20
  isRecord,
21
21
  strArg
22
- } from "./chunk-3XCGUKGJ.js";
22
+ } from "./chunk-ZPIF7IJN.js";
23
+ import {
24
+ __export
25
+ } from "./chunk-MLKGABMK.js";
23
26
 
24
27
  // src/llm/openai.ts
28
+ var openai_exports = {};
29
+ __export(openai_exports, {
30
+ OpenAIClient: () => OpenAIClient,
31
+ OpenAICompatClient: () => OpenAICompatClient,
32
+ buildChatCompletionMessages: () => buildChatCompletionMessages,
33
+ buildOpenAIInput: () => buildOpenAIInput
34
+ });
25
35
  import OpenAI from "openai";
26
36
  var log = createChildLogger({ module: "llm" });
27
37
  function computerActionArguments(action) {
@@ -842,5 +852,6 @@ export {
842
852
  OpenAIClient,
843
853
  buildOpenAIInput,
844
854
  OpenAICompatClient,
845
- buildChatCompletionMessages
855
+ buildChatCompletionMessages,
856
+ openai_exports
846
857
  };
@@ -1,4 +1,14 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-MLKGABMK.js";
4
+
1
5
  // src/tools/types.ts
6
+ var types_exports = {};
7
+ __export(types_exports, {
8
+ SKIP_DIRS: () => SKIP_DIRS,
9
+ isToolResultContentBlock: () => isToolResultContentBlock,
10
+ normalizeToolResultContentBlock: () => normalizeToolResultContentBlock
11
+ });
2
12
  function isRecord(value) {
3
13
  return typeof value === "object" && value !== null && !Array.isArray(value);
4
14
  }
@@ -135,6 +145,6 @@ var SKIP_DIRS = /* @__PURE__ */ new Set([
135
145
 
136
146
  export {
137
147
  normalizeToolResultContentBlock,
138
- isToolResultContentBlock,
139
- SKIP_DIRS
148
+ SKIP_DIRS,
149
+ types_exports
140
150
  };
@@ -0,0 +1,132 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-MLKGABMK.js";
4
+
5
+ // src/sandbox/sandbox-runtime.ts
6
+ var sandbox_runtime_exports = {};
7
+ __export(sandbox_runtime_exports, {
8
+ SandboxRuntimeSandbox: () => SandboxRuntimeSandbox,
9
+ createSandboxRuntimeConfig: () => createSandboxRuntimeConfig
10
+ });
11
+ import { isAbsolute, resolve } from "path";
12
+ async function loadSandboxRuntime() {
13
+ return await import("@anthropic-ai/sandbox-runtime");
14
+ }
15
+ function resolvePaths(paths, cwd) {
16
+ return paths.map((path) => isAbsolute(path) ? path : resolve(cwd, path));
17
+ }
18
+ function createSandboxRuntimeConfig(config, cwd) {
19
+ return {
20
+ network: {
21
+ allowedDomains: [],
22
+ deniedDomains: config.networkEnabled ? [] : ["*"],
23
+ strictAllowlist: !config.networkEnabled
24
+ },
25
+ filesystem: {
26
+ denyRead: [],
27
+ allowWrite: resolvePaths(config.allowWrite, cwd),
28
+ denyWrite: resolvePaths(config.denyWrite, cwd),
29
+ allowGitConfig: false
30
+ }
31
+ };
32
+ }
33
+ var SandboxRuntimeSandbox = class {
34
+ implementation = "sandbox-runtime";
35
+ availabilityError;
36
+ availabilityPromise;
37
+ configKey;
38
+ initializationPromise;
39
+ runtimePromise;
40
+ available() {
41
+ return this.availabilityPromise ??= this.checkAvailability();
42
+ }
43
+ async prepare(command, config, context) {
44
+ if (!await this.available()) {
45
+ throw new Error(this.availabilityError ?? "sandbox runtime is unavailable");
46
+ }
47
+ const runtime = await this.loadRuntime();
48
+ const runtimeConfig = runtime.SandboxRuntimeConfigSchema.parse(
49
+ createSandboxRuntimeConfig(config, context.cwd)
50
+ );
51
+ const configKey = JSON.stringify(runtimeConfig);
52
+ if (this.initializationPromise) {
53
+ await this.initializationPromise;
54
+ }
55
+ if (this.configKey !== configKey || !runtime.SandboxManager.isSandboxingEnabled()) {
56
+ this.initializationPromise = (async () => {
57
+ if (runtime.SandboxManager.isSandboxingEnabled()) {
58
+ await runtime.SandboxManager.reset();
59
+ }
60
+ await runtime.SandboxManager.initialize(
61
+ runtimeConfig,
62
+ config.networkEnabled ? () => Promise.resolve(true) : void 0
63
+ );
64
+ this.configKey = configKey;
65
+ })();
66
+ try {
67
+ await this.initializationPromise;
68
+ } finally {
69
+ this.initializationPromise = void 0;
70
+ }
71
+ }
72
+ const commandId = context.commandId ?? command;
73
+ const prepared = await runtime.SandboxManager.wrapWithSandboxArgv(
74
+ command,
75
+ "/bin/bash",
76
+ void 0,
77
+ context.abortSignal,
78
+ context.cwd,
79
+ { commandId, commandText: command }
80
+ );
81
+ const [executable, ...args] = prepared.argv;
82
+ if (!executable) {
83
+ throw new Error("sandbox runtime returned an empty command");
84
+ }
85
+ return {
86
+ executable,
87
+ args,
88
+ env: prepared.env,
89
+ annotateStderr: (stderr) => runtime.SandboxManager.annotateStderrWithSandboxFailures(commandId, stderr),
90
+ cleanup: () => {
91
+ runtime.SandboxManager.cleanupAfterCommand();
92
+ }
93
+ };
94
+ }
95
+ async dispose() {
96
+ if (!this.runtimePromise) {
97
+ return;
98
+ }
99
+ await this.initializationPromise;
100
+ const runtime = await this.runtimePromise;
101
+ await runtime.SandboxManager.reset();
102
+ this.configKey = void 0;
103
+ }
104
+ async checkAvailability() {
105
+ try {
106
+ const runtime = await this.loadRuntime();
107
+ if (!runtime.SandboxManager.isSupportedPlatform()) {
108
+ this.availabilityError = "sandbox runtime does not support this platform";
109
+ return false;
110
+ }
111
+ const dependencies = await runtime.SandboxManager.checkDependenciesAsync();
112
+ if (dependencies.errors.length > 0) {
113
+ this.availabilityError = dependencies.errors.join("; ");
114
+ return false;
115
+ }
116
+ this.availabilityError = void 0;
117
+ return true;
118
+ } catch (error) {
119
+ this.availabilityError = error instanceof Error ? error.message : String(error);
120
+ return false;
121
+ }
122
+ }
123
+ loadRuntime() {
124
+ return this.runtimePromise ??= loadSandboxRuntime();
125
+ }
126
+ };
127
+
128
+ export {
129
+ createSandboxRuntimeConfig,
130
+ SandboxRuntimeSandbox,
131
+ sandbox_runtime_exports
132
+ };
@@ -1,14 +1,24 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-MLKGABMK.js";
4
+
1
5
  // src/sandbox/seatbelt.ts
6
+ var seatbelt_exports = {};
7
+ __export(seatbelt_exports, {
8
+ SeatbeltSandbox: () => SeatbeltSandbox
9
+ });
2
10
  import { existsSync, statSync } from "fs";
3
11
  var SANDBOX_EXEC_PATH = "/usr/bin/sandbox-exec";
4
12
  var SeatbeltSandbox = class {
13
+ implementation = "seatbelt";
5
14
  available() {
6
15
  return existsSync(SANDBOX_EXEC_PATH);
7
16
  }
8
- wrap(command, config) {
9
- const profile = buildProfile(config);
10
- const escaped = command.replace(/'/g, "'\\''");
11
- return `${SANDBOX_EXEC_PATH} -p '${profile}' bash -c '${escaped}'`;
17
+ prepare(command, config) {
18
+ return {
19
+ executable: SANDBOX_EXEC_PATH,
20
+ args: ["-p", buildProfile(config), "bash", "-c", command]
21
+ };
12
22
  }
13
23
  };
14
24
  function buildProfile(config) {
@@ -35,5 +45,6 @@ function buildProfile(config) {
35
45
  }
36
46
 
37
47
  export {
38
- SeatbeltSandbox
48
+ SeatbeltSandbox,
49
+ seatbelt_exports
39
50
  };
@@ -1,42 +1,40 @@
1
1
  import {
2
2
  createChildLogger
3
- } from "./chunk-3XCGUKGJ.js";
4
-
5
- // src/llm/errors.ts
6
- var LLMError = class extends Error {
7
- constructor(message) {
8
- super(message);
9
- this.name = "LLMError";
10
- }
11
- };
12
- var AuthenticationError = class extends LLMError {
13
- constructor(message) {
14
- super(message);
15
- this.name = "AuthenticationError";
16
- }
17
- };
18
- var RateLimitError = class extends LLMError {
19
- retryAfter;
20
- constructor(message, retryAfter) {
21
- super(message);
22
- this.name = "RateLimitError";
23
- this.retryAfter = retryAfter;
24
- }
25
- };
26
- var NetworkError = class extends LLMError {
27
- constructor(message) {
28
- super(message);
29
- this.name = "NetworkError";
30
- }
31
- };
32
- var ContextTooLongError = class extends LLMError {
33
- constructor(message) {
34
- super(message);
35
- this.name = "ContextTooLongError";
36
- }
37
- };
3
+ } from "./chunk-ZPIF7IJN.js";
4
+ import {
5
+ __export
6
+ } from "./chunk-MLKGABMK.js";
38
7
 
39
- // src/config/config.ts
8
+ // src/config/index.ts
9
+ var config_exports = {};
10
+ __export(config_exports, {
11
+ ConfigError: () => ConfigError,
12
+ DEFAULT_CONTEXT_WINDOW: () => DEFAULT_CONTEXT_WINDOW,
13
+ DEFAULT_MAX_OUTPUT_TOKENS: () => DEFAULT_MAX_OUTPUT_TOKENS,
14
+ DEFAULT_THINKING_LEVEL: () => DEFAULT_THINKING_LEVEL,
15
+ HookConfigSchema: () => HookConfigSchema,
16
+ MIN_THINKING_ANSWER_TOKENS: () => MIN_THINKING_ANSWER_TOKENS,
17
+ MIN_THINKING_BUDGET_TOKENS: () => MIN_THINKING_BUDGET_TOKENS,
18
+ ProviderConfigSchema: () => ProviderConfigSchema,
19
+ THINKING_BUDGETS: () => THINKING_BUDGETS,
20
+ THINKING_LEVELS: () => THINKING_LEVELS,
21
+ clampThinkingLevel: () => clampThinkingLevel,
22
+ forkEnabled: () => forkEnabled,
23
+ getContextWindow: () => getContextWindow,
24
+ getMaxOutputTokens: () => getMaxOutputTokens,
25
+ getSupportedThinkingLevels: () => getSupportedThinkingLevels,
26
+ getThinkingLevel: () => getThinkingLevel,
27
+ globalConfigPath: () => globalConfigPath,
28
+ isValidThinkingLevel: () => isValidThinkingLevel,
29
+ loadConfig: () => loadConfig,
30
+ loadProjectMcpServers: () => loadProjectMcpServers,
31
+ resolveAPIKey: () => resolveAPIKey,
32
+ thinkingBudgetForLevel: () => thinkingBudgetForLevel,
33
+ toAnthropicThinkingEffort: () => toAnthropicThinkingEffort,
34
+ toReasoningEffort: () => toReasoningEffort,
35
+ withProjectMcpServers: () => withProjectMcpServers,
36
+ withProviderDefaults: () => withProviderDefaults
37
+ });
40
38
  import { existsSync, readFileSync } from "fs";
41
39
  import { homedir } from "os";
42
40
  import { join } from "path";
@@ -224,6 +222,7 @@ var HookConfigSchema = z.object({
224
222
  });
225
223
  var SandboxYamlConfigSchema = z.object({
226
224
  enabled: z.boolean().optional(),
225
+ backend: z.enum(["native", "sandbox-runtime"]).optional(),
227
226
  auto_allow: z.boolean().optional(),
228
227
  network_enabled: z.boolean().optional()
229
228
  });
@@ -304,6 +303,10 @@ function loadSingleFile(path) {
304
303
  const parsed2 = safeParse(SandboxYamlConfigSchema, raw.sandbox);
305
304
  if (parsed2.success) {
306
305
  sandbox = parsed2.data;
306
+ } else {
307
+ throw new ConfigError(
308
+ `Invalid sandbox configuration in ${path}: ${getParseErrorMessage(parsed2.error)}`
309
+ );
307
310
  }
308
311
  }
309
312
  if ("enable_coordinator_mode" in raw) {
@@ -483,6 +486,12 @@ function loadConfig(path, options = {}) {
483
486
  }
484
487
 
485
488
  // src/conversation/pairing.ts
489
+ var pairing_exports = {};
490
+ __export(pairing_exports, {
491
+ INTERRUPTED_TOOL_RESULT: () => INTERRUPTED_TOOL_RESULT,
492
+ REJECTED_TOOL_RESULT: () => REJECTED_TOOL_RESULT,
493
+ ensureToolPairing: () => ensureToolPairing
494
+ });
486
495
  var INTERRUPTED_TOOL_RESULT = "Tool execution was interrupted. The tool may or may not have completed; verify before relying on its effects.";
487
496
  var REJECTED_TOOL_RESULT = "The user rejected this tool use. Nothing was changed (for file edits, the new content was NOT written).";
488
497
  function ensureToolPairing(messages) {
@@ -533,21 +542,55 @@ function ensureToolPairing(messages) {
533
542
  return out;
534
543
  }
535
544
 
545
+ // src/llm/errors.ts
546
+ var errors_exports = {};
547
+ __export(errors_exports, {
548
+ AuthenticationError: () => AuthenticationError,
549
+ ContextTooLongError: () => ContextTooLongError,
550
+ LLMError: () => LLMError,
551
+ NetworkError: () => NetworkError,
552
+ RateLimitError: () => RateLimitError
553
+ });
554
+ var LLMError = class extends Error {
555
+ constructor(message) {
556
+ super(message);
557
+ this.name = "LLMError";
558
+ }
559
+ };
560
+ var AuthenticationError = class extends LLMError {
561
+ constructor(message) {
562
+ super(message);
563
+ this.name = "AuthenticationError";
564
+ }
565
+ };
566
+ var RateLimitError = class extends LLMError {
567
+ retryAfter;
568
+ constructor(message, retryAfter) {
569
+ super(message);
570
+ this.name = "RateLimitError";
571
+ this.retryAfter = retryAfter;
572
+ }
573
+ };
574
+ var NetworkError = class extends LLMError {
575
+ constructor(message) {
576
+ super(message);
577
+ this.name = "NetworkError";
578
+ }
579
+ };
580
+ var ContextTooLongError = class extends LLMError {
581
+ constructor(message) {
582
+ super(message);
583
+ this.name = "ContextTooLongError";
584
+ }
585
+ };
586
+
536
587
  export {
537
- LLMError,
538
- AuthenticationError,
539
- RateLimitError,
540
- NetworkError,
541
- ContextTooLongError,
542
- ConfigError,
543
588
  globalConfigPath,
544
589
  THINKING_LEVELS,
545
590
  ProviderConfigSchema,
546
591
  DEFAULT_THINKING_LEVEL,
547
592
  DEFAULT_CONTEXT_WINDOW,
548
593
  DEFAULT_MAX_OUTPUT_TOKENS,
549
- THINKING_BUDGETS,
550
- MIN_THINKING_BUDGET_TOKENS,
551
594
  MIN_THINKING_ANSWER_TOKENS,
552
595
  isValidThinkingLevel,
553
596
  getThinkingLevel,
@@ -556,16 +599,20 @@ export {
556
599
  toAnthropicThinkingEffort,
557
600
  getSupportedThinkingLevels,
558
601
  clampThinkingLevel,
559
- withProviderDefaults,
560
602
  getContextWindow,
561
603
  getMaxOutputTokens,
562
604
  resolveAPIKey,
563
- HookConfigSchema,
564
605
  forkEnabled,
565
- loadProjectMcpServers,
566
606
  withProjectMcpServers,
567
607
  loadConfig,
568
- INTERRUPTED_TOOL_RESULT,
608
+ config_exports,
569
609
  REJECTED_TOOL_RESULT,
570
- ensureToolPairing
610
+ ensureToolPairing,
611
+ pairing_exports,
612
+ LLMError,
613
+ AuthenticationError,
614
+ RateLimitError,
615
+ NetworkError,
616
+ ContextTooLongError,
617
+ errors_exports
571
618
  };
@@ -1,4 +1,25 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-MLKGABMK.js";
4
+
5
+ // src/subagent/tool-filter.ts
6
+ var tool_filter_exports = {};
7
+ __export(tool_filter_exports, {
8
+ ASYNC_AGENT_ALLOWED_TOOLS: () => ASYNC_AGENT_ALLOWED_TOOLS,
9
+ CUSTOM_AGENT_DISALLOWED_TOOLS: () => CUSTOM_AGENT_DISALLOWED_TOOLS,
10
+ FORK_QUERY_SOURCE: () => FORK_QUERY_SOURCE,
11
+ MAIN_AGENT_ONLY_TOOLS: () => MAIN_AGENT_ONLY_TOOLS,
12
+ SUBAGENT_DISALLOWED_TOOLS: () => SUBAGENT_DISALLOWED_TOOLS,
13
+ TEAMMATE_DISALLOWED_TOOLS: () => TEAMMATE_DISALLOWED_TOOLS,
14
+ cloneRegistryForFork: () => cloneRegistryForFork,
15
+ filterToolsForAgent: () => filterToolsForAgent
16
+ });
17
+
1
18
  // src/tools/registry.ts
19
+ var registry_exports = {};
20
+ __export(registry_exports, {
21
+ ToolRegistry: () => ToolRegistry
22
+ });
2
23
  var ToolRegistry = class {
3
24
  tools = /* @__PURE__ */ new Map();
4
25
  discovered = /* @__PURE__ */ new Set();
@@ -133,13 +154,15 @@ var ToolRegistry = class {
133
154
  };
134
155
 
135
156
  // src/subagent/tool-filter.ts
136
- var MAIN_AGENT_ONLY_TOOLS = /* @__PURE__ */ new Set(["ComputerUse"]);
157
+ var MAIN_AGENT_ONLY_TOOLS = /* @__PURE__ */ new Set([
158
+ "ComputerUse",
159
+ "AskUserQuestion",
160
+ "ExitPlanMode"
161
+ ]);
137
162
  var SUBAGENT_DISALLOWED_TOOLS = /* @__PURE__ */ new Set([
138
- "ExitPlanMode",
163
+ ...MAIN_AGENT_ONLY_TOOLS,
139
164
  "Agent",
140
165
  // Prevents recursive spawning of subagents
141
- "AskUserQuestion",
142
- ...MAIN_AGENT_ONLY_TOOLS,
143
166
  "TaskStop"
144
167
  ]);
145
168
  var TEAMMATE_DISALLOWED_TOOLS = /* @__PURE__ */ new Set(["TeamCreate", "TeamDelete"]);
@@ -155,6 +178,7 @@ var ASYNC_AGENT_ALLOWED_TOOLS = /* @__PURE__ */ new Set([
155
178
  "Grep",
156
179
  "Glob",
157
180
  "Bash",
181
+ "JavaScript",
158
182
  "PowerShell",
159
183
  "EditFile",
160
184
  "WriteFile",
@@ -228,6 +252,7 @@ function cloneRegistryForFork(registry) {
228
252
 
229
253
  export {
230
254
  ToolRegistry,
255
+ registry_exports,
231
256
  MAIN_AGENT_ONLY_TOOLS,
232
257
  SUBAGENT_DISALLOWED_TOOLS,
233
258
  TEAMMATE_DISALLOWED_TOOLS,
@@ -235,5 +260,6 @@ export {
235
260
  ASYNC_AGENT_ALLOWED_TOOLS,
236
261
  filterToolsForAgent,
237
262
  FORK_QUERY_SOURCE,
238
- cloneRegistryForFork
263
+ cloneRegistryForFork,
264
+ tool_filter_exports
239
265
  };
@@ -0,0 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ export {
8
+ __export
9
+ };