@swifty.js/swifty 0.0.33 → 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.
- package/dist/acp-A4KRKOHD.js +14 -0
- package/dist/agent-VDWIGFIV.js +4 -0
- package/dist/{anthropic-FXRRA63E.js → anthropic-AR2Y4FBR.js} +1 -1
- package/dist/bwrap-4KOC7P3X.js +4 -0
- package/dist/{chunk-IKQTIDRL.js → chunk-325L2ILZ.js} +1 -1
- package/dist/chunk-44LPRRYU.js +60 -0
- package/dist/chunk-4B4SGVJH.js +164 -0
- package/dist/chunk-5W2TCASL.js +4 -0
- package/dist/{chunk-FUKVR3XO.js → chunk-F4FOFPKL.js} +126 -123
- package/dist/{chunk-4PQYUHSN.js → chunk-H56UQALW.js} +1 -1
- package/dist/{providers-WNYZUMZ3.js → chunk-IOLGXPUQ.js} +3 -3
- package/dist/chunk-IXCJZNBB.js +5 -0
- package/dist/chunk-JC44NVST.js +4 -0
- package/dist/chunk-NDPYUGE5.js +5 -0
- package/dist/chunk-PH643I2P.js +4 -0
- package/dist/{chunk-PXQD6GWP.js → chunk-TOM34LJB.js} +7 -7
- package/dist/{chunk-4C3KJLJV.js → chunk-UJGMTIYO.js} +1 -1
- package/dist/chunk-YBS5ATGZ.js +4 -0
- package/dist/esm-VBV56AO5.js +229 -0
- package/dist/lib/agent-TC4HSVMS.js +16 -0
- package/dist/lib/{anthropic-B33M2AVN.js → anthropic-FKIGL7NL.js} +6 -5
- package/dist/lib/bwrap-2OL7VPSO.js +7 -0
- package/dist/lib/{chunk-FODSMOWP.js → chunk-6V7RW6HA.js} +34 -16
- package/dist/lib/{chunk-TJLAJGG4.js → chunk-ALQHMYOZ.js} +14 -3
- package/dist/lib/{chunk-XT67KGWE.js → chunk-BQFVUVLI.js} +12 -2
- package/dist/lib/chunk-FFM2LB4C.js +132 -0
- package/dist/lib/{chunk-VUD72RTY.js → chunk-FLKB4BK7.js} +16 -5
- package/dist/lib/{chunk-3OFLDUAW.js → chunk-HQSYRTER.js} +96 -49
- package/dist/lib/{chunk-LDWFI6MR.js → chunk-LRN4MOQ3.js} +25 -1
- package/dist/lib/chunk-MLKGABMK.js +9 -0
- package/dist/lib/{providers-UJEWP7C7.js → chunk-OJTISIYU.js} +46 -3
- package/dist/lib/{chunk-BCBD34D2.js → chunk-OLFXCZVH.js} +25 -7
- package/dist/lib/{chunk-CFYAZWDA.js → chunk-RUDYC7OS.js} +33 -55
- package/dist/lib/{chunk-AFYPVA5C.js → chunk-S5VWPTME.js} +940 -109
- package/dist/lib/chunk-YIWNQ7OA.js +47 -0
- package/dist/lib/{chunk-3XCGUKGJ.js → chunk-ZPIF7IJN.js} +219 -6
- package/dist/lib/index.d.ts +3427 -1380
- package/dist/lib/index.js +12767 -12281
- package/dist/lib/{openai-C2PZFGJ2.js → openai-ZWIYIBLC.js} +4 -3
- package/dist/lib/{checker-UPY4CXUL.js → permissions-BW4QPZXV.js} +4 -3
- package/dist/lib/providers-ROWSB6ND.js +9 -0
- package/dist/lib/sandbox-runtime-CCQ3X3SM.js +9 -0
- package/dist/lib/seatbelt-WO7YWKLR.js +7 -0
- package/dist/lib/{tool-filter-BFEINZIA.js → tool-filter-QU4LOZII.js} +2 -1
- package/dist/main.js +227 -194
- package/dist/{openai-WPEICAZ4.js → openai-7LMX5HKW.js} +1 -1
- package/dist/permissions-74IHQW76.js +4 -0
- package/dist/providers-2J4JJYQD.js +4 -0
- package/dist/sandbox-runtime-RVW4BK3L.js +4 -0
- package/dist/seatbelt-GMQUP6SV.js +4 -0
- package/dist/server-ZYK4L22D.js +4 -0
- package/dist/{tool-filter-X6IYME2K.js → tool-filter-U5SSL3LR.js} +1 -1
- package/package.json +6 -3
- package/dist/acp-5WRTN2LL.js +0 -14
- package/dist/agent-3CAPJCPD.js +0 -4
- package/dist/bwrap-ZTS67W2K.js +0 -4
- package/dist/checker-3O7QF7XV.js +0 -4
- package/dist/chunk-4HSQBZBI.js +0 -4
- package/dist/chunk-C5WLP3DH.js +0 -5
- package/dist/chunk-I7XJSLRI.js +0 -4
- package/dist/chunk-LHSUYZO5.js +0 -4
- package/dist/chunk-NAAAN2TD.js +0 -60
- package/dist/chunk-YIKI3EPG.js +0 -150
- package/dist/esm-4DBD7ONK.js +0 -229
- package/dist/lib/agent-NNYCUIOF.js +0 -10
- package/dist/lib/bwrap-QRGPUP4J.js +0 -6
- package/dist/lib/chunk-GTHYQZRL.js +0 -31
- package/dist/lib/chunk-ORSYNBMM.js +0 -38
- package/dist/lib/seatbelt-FT5IY73W.js +0 -6
- package/dist/seatbelt-PSPJ5LBR.js +0 -5
- package/dist/server-YPBLBRDN.js +0 -4
|
@@ -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-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
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,
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeToolResultContentBlock
|
|
3
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
-
|
|
139
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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/
|
|
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
|
-
|
|
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();
|
|
@@ -157,6 +178,7 @@ var ASYNC_AGENT_ALLOWED_TOOLS = /* @__PURE__ */ new Set([
|
|
|
157
178
|
"Grep",
|
|
158
179
|
"Glob",
|
|
159
180
|
"Bash",
|
|
181
|
+
"JavaScript",
|
|
160
182
|
"PowerShell",
|
|
161
183
|
"EditFile",
|
|
162
184
|
"WriteFile",
|
|
@@ -230,6 +252,7 @@ function cloneRegistryForFork(registry) {
|
|
|
230
252
|
|
|
231
253
|
export {
|
|
232
254
|
ToolRegistry,
|
|
255
|
+
registry_exports,
|
|
233
256
|
MAIN_AGENT_ONLY_TOOLS,
|
|
234
257
|
SUBAGENT_DISALLOWED_TOOLS,
|
|
235
258
|
TEAMMATE_DISALLOWED_TOOLS,
|
|
@@ -237,5 +260,6 @@ export {
|
|
|
237
260
|
ASYNC_AGENT_ALLOWED_TOOLS,
|
|
238
261
|
filterToolsForAgent,
|
|
239
262
|
FORK_QUERY_SOURCE,
|
|
240
|
-
cloneRegistryForFork
|
|
263
|
+
cloneRegistryForFork,
|
|
264
|
+
tool_filter_exports
|
|
241
265
|
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-MLKGABMK.js";
|
|
4
4
|
|
|
5
5
|
// src/telemetry/providers.ts
|
|
6
|
+
var providers_exports = {};
|
|
7
|
+
__export(providers_exports, {
|
|
8
|
+
createTelemetryRuntime: () => createTelemetryRuntime,
|
|
9
|
+
parseExporterTypes: () => parseExporterTypes
|
|
10
|
+
});
|
|
6
11
|
import { LangfuseSpanProcessor } from "@langfuse/otel";
|
|
7
12
|
import {
|
|
8
13
|
setLangfuseTracerProvider,
|
|
@@ -27,6 +32,40 @@ import {
|
|
|
27
32
|
ConsoleSpanExporter
|
|
28
33
|
} from "@opentelemetry/sdk-trace-base";
|
|
29
34
|
import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from "@opentelemetry/semantic-conventions";
|
|
35
|
+
|
|
36
|
+
// src/version.ts
|
|
37
|
+
var version_exports = {};
|
|
38
|
+
__export(version_exports, {
|
|
39
|
+
version: () => version
|
|
40
|
+
});
|
|
41
|
+
import { readFileSync } from "fs";
|
|
42
|
+
import path from "path";
|
|
43
|
+
import { fileURLToPath } from "url";
|
|
44
|
+
import { z } from "zod";
|
|
45
|
+
var PackageJsonSchema = z.object({
|
|
46
|
+
version: z.string()
|
|
47
|
+
});
|
|
48
|
+
function resolveVersion() {
|
|
49
|
+
if (true) {
|
|
50
|
+
return "0.0.35";
|
|
51
|
+
}
|
|
52
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
53
|
+
for (const levels of ["..", "../.."]) {
|
|
54
|
+
const candidate = path.resolve(here, levels, "package.json");
|
|
55
|
+
try {
|
|
56
|
+
const raw = JSON.parse(readFileSync(candidate, "utf-8"));
|
|
57
|
+
const parsed = PackageJsonSchema.safeParse(raw);
|
|
58
|
+
if (parsed.success) {
|
|
59
|
+
return parsed.data.version;
|
|
60
|
+
}
|
|
61
|
+
} catch {
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
throw new Error("Could not resolve package version");
|
|
65
|
+
}
|
|
66
|
+
var version = resolveVersion();
|
|
67
|
+
|
|
68
|
+
// src/telemetry/providers.ts
|
|
30
69
|
var DEFAULT_EXPORT_INTERVAL_MS = 6e4;
|
|
31
70
|
var SHUTDOWN_TIMEOUT_MS = 2e3;
|
|
32
71
|
function parseExporterTypes(value) {
|
|
@@ -413,7 +452,11 @@ async function createTelemetryRuntime() {
|
|
|
413
452
|
const logger = loggerProvider?.getLogger("@swifty.js/swifty", version) ?? null;
|
|
414
453
|
return new ProviderRuntime(tracerProvider, loggerProvider, meterProvider, meter, logger, sentry);
|
|
415
454
|
}
|
|
455
|
+
|
|
416
456
|
export {
|
|
457
|
+
version,
|
|
458
|
+
version_exports,
|
|
459
|
+
parseExporterTypes,
|
|
417
460
|
createTelemetryRuntime,
|
|
418
|
-
|
|
461
|
+
providers_exports
|
|
419
462
|
};
|