@desplega.ai/agent-swarm 1.120.0 → 1.121.1
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/README.md +2 -2
- package/dist/{actions-rym7jyg2.js → actions-99h2dh5e.js} +6 -6
- package/dist/{anthropic-messages-qjxzsabf.js → anthropic-messages-4gn944cn.js} +29 -13
- package/dist/{app-ss3a0nfj.js → app-9gfdk9me.js} +4 -4
- package/dist/{assistant-8sd2b21b.js → assistant-mabq9kz7.js} +13 -13
- package/dist/{azure-openai-responses-ntfd05zd.js → azure-openai-responses-79zc0wyy.js} +28 -13
- package/dist/{boot-reembed-7bs0d0sj.js → boot-reembed-3vr2amzp.js} +5 -5
- package/dist/{boot-reembed-eh18r04f.js → boot-reembed-ya33nge3.js} +4 -4
- package/dist/{boot-scrub-logs-v8ch000n.js → boot-scrub-logs-2nmz7fzw.js} +4 -4
- package/dist/{claude-adapter-9n3nzt65.js → claude-adapter-vxvcym3r.js} +3 -3
- package/dist/{claude-managed-adapter-pv2nbqy4.js → claude-managed-adapter-g807894s.js} +2 -2
- package/dist/{cli-sbh0b9r1.js → cli-02m8v96c.js} +5 -4
- package/dist/{cli-branks1w.js → cli-16dv125e.js} +28 -3
- package/dist/{cli-383wyw2f.js → cli-2846g99z.js} +61 -17
- package/dist/cli-3dpj7atn.js +11 -0
- package/dist/{cli-w6rhc30s.js → cli-3jrdwnn9.js} +20 -5
- package/dist/{cli-kyfx7z3d.js → cli-3t4nvx1x.js} +4 -4
- package/dist/{cli-2r7s8jhp.js → cli-5c4327dx.js} +7 -1
- package/dist/{cli-84j2vp67.js → cli-5jd04m23.js} +1 -1
- package/dist/{cli-d2eyq90a.js → cli-7bk7s2sx.js} +1 -1
- package/dist/{cli-qs7nb3zn.js → cli-8wrympd7.js} +27 -1
- package/dist/{cli-0ap79nha.js → cli-9hewdgzb.js} +5 -5
- package/dist/{cli-wr706gez.js → cli-av2s7my4.js} +167 -66
- package/dist/{cli-zxnp21rf.js → cli-avxs2rp9.js} +18 -15
- package/dist/{cli-1arw00dp.js → cli-ccjwgarc.js} +12 -3
- package/dist/{cli-pscrc6tw.js → cli-ch7t5v7n.js} +5 -0
- package/dist/{cli-tghre7g6.js → cli-cw70hymf.js} +1 -0
- package/dist/{cli-gq12jc1m.js → cli-dn5ycmtw.js} +7 -5
- package/dist/{cli-kyqs14qe.js → cli-dwqakg2b.js} +5 -5
- package/dist/{cli-py8z9bjq.js → cli-e0zbndab.js} +9 -9
- package/dist/{cli-zxeb2qe3.js → cli-fxdhzkqx.js} +1 -1
- package/dist/{cli-f6c6y7fw.js → cli-gahmct71.js} +2 -2
- package/dist/{cli-n745f8e5.js → cli-kwjx3f1v.js} +1 -1
- package/dist/{cli-0kkggfr9.js → cli-kx7vsvg0.js} +2 -2
- package/dist/{cli-t91zbm2s.js → cli-msyrqt1f.js} +59 -22
- package/dist/{cli-shdvvj0n.js → cli-ng0gr9rz.js} +2 -2
- package/dist/{cli-th08nm8p.js → cli-p8qcm631.js} +1 -1
- package/dist/{cli-gad984jj.js → cli-qfh6pmvm.js} +1 -1
- package/dist/{cli-v65h59hn.js → cli-rjn06qph.js} +1 -1
- package/dist/{cli-xeatwfbe.js → cli-ry656xem.js} +24 -17
- package/dist/cli-s8s499xy.js +81 -0
- package/dist/{cli-n61x2aph.js → cli-vh3h1grg.js} +826 -1336
- package/dist/{cli-vmhqfnp1.js → cli-w4crd8gx.js} +2 -2
- package/dist/{cli-mg280wsv.js → cli-we156bmz.js} +1 -1
- package/dist/{cli-e0y603nn.js → cli-x0e0yvnq.js} +101 -1
- package/dist/{cli-mw3xpgwb.js → cli-x4apc9t3.js} +4 -4
- package/dist/{cli-dnx98dwa.js → cli-yhwn2vjm.js} +38185 -38141
- package/dist/{cli-j59bj3vs.js → cli-yy9sm7c1.js} +8 -8
- package/dist/{cli-4cb3p8pj.js → cli-yyqpn0gc.js} +2 -2
- package/dist/{cli-w5em21am.js → cli-zm78xp1y.js} +3 -3
- package/dist/{cli-da3x3btq.js → cli-zweca3q3.js} +4 -3
- package/dist/cli.js +23 -21
- package/dist/{codex-adapter-6j2b38tg.js → codex-adapter-0kv2meed.js} +9 -9
- package/dist/{codex-session-runner-vz215wgw.js → codex-session-runner-m1e1v4r0.js} +9 -9
- package/dist/{commands-w1swgcgg.js → commands-hty4156r.js} +3 -3
- package/dist/{db-yv6y0fxw.js → db-kyeq3t7h.js} +5 -3
- package/dist/{google-generative-ai-n1d3xt4n.js → google-generative-ai-wwa2ked5.js} +14 -18
- package/dist/{google-vertex-mxst23gy.js → google-vertex-71xmdd7n.js} +14 -18
- package/dist/{handlers-yjyafdwk.js → handlers-fxvqnp6s.js} +13 -13
- package/dist/{hook-6nvc6p19.js → hook-j4ksm2fy.js} +8 -8
- package/dist/{http-g6j8rc6h.js → http-m7fq6kbc.js} +143 -64
- package/dist/{index-7betnvg6.js → index-62g7ym5y.js} +9 -9
- package/dist/{index-b2rarbkn.js → index-mbaa4yn7.js} +12 -11
- package/dist/{index-64th6eqs.js → index-r2tmg4ts.js} +11 -10
- package/dist/{index-cbknx39k.js → index-rqxt0515.js} +13 -12
- package/dist/{keepalive-j8c99r3m.js → keepalive-acgfgbk8.js} +6 -6
- package/dist/{lead-8xe71m3s.js → lead-r3pnbky3.js} +31 -31
- package/dist/{maintenance-eqnmrwb2.js → maintenance-4tqr6va0.js} +5 -5
- package/dist/{mistral-conversations-ykcg66za.js → mistral-conversations-26ya4yah.js} +17 -13
- package/dist/{oauth-refresh-sweep-c5dy1653.js → oauth-refresh-sweep-5714hq77.js} +6 -6
- package/dist/{onboard-4avg01c1.js → onboard-s5x8zjqd.js} +2 -2
- package/dist/{openai-codex-responses-zy0907j9.js → openai-codex-responses-6rr2ye0s.js} +78 -38
- package/dist/{openai-completions-xk4p56n9.js → openai-completions-zfa9nkvt.js} +130 -33
- package/dist/{openai-responses-4gv3ca5d.js → openai-responses-9wmdks0g.js} +38 -14
- package/dist/{opencode-adapter-5bwzvbwj.js → opencode-adapter-s3nhtp9m.js} +5 -2
- package/dist/{openrouter-images-4fsrrzes.js → openrouter-images-dgq98729.js} +10 -3
- package/dist/{otel-impl-z4cwkp40.js → otel-impl-8g0741yr.js} +4 -4
- package/dist/{pi-messages-zb8v76wx.js → pi-messages-nzjbbz47.js} +4 -6
- package/dist/{pi-mono-adapter-9sg69kg3.js → pi-mono-adapter-k3z6e5fn.js} +5666 -4521
- package/dist/{pricing-refresh-dts9429d.js → pricing-refresh-09ty42xr.js} +5 -5
- package/dist/{rbac-roles-4f64wch6.js → rbac-roles-2hjvj3q0.js} +4 -4
- package/dist/{rbac-roles-24cvsejy.js → rbac-roles-q38w8rne.js} +3 -3
- package/dist/{seed-pricing-74ph9wap.js → seed-pricing-wzx03625.js} +4 -4
- package/dist/{setup-9q0n8rvd.js → setup-4hmnc9fz.js} +2 -2
- package/dist/{worker-x7g344z8.js → worker-efef96pc.js} +31 -31
- package/openapi.json +169 -85
- package/package.json +7 -5
- package/plugin/commands/swarm-chat.md +2 -0
- package/plugin/pi-skills/swarm-chat/SKILL.md +2 -0
- package/src/be/db.ts +61 -5
- package/src/be/memory/constants.ts +7 -6
- package/src/be/memory/graph-expansion.ts +3 -3
- package/src/be/memory/raters/llm-summarizer.ts +10 -2
- package/src/be/migrations/119_agent_avatar.sql +7 -0
- package/src/be/migrations/120_task_title.sql +3 -0
- package/src/be/scripts/typecheck.ts +3 -2
- package/src/be/seed-capabilities.ts +62 -0
- package/src/be/seed-pricing.ts +1 -1
- package/src/be/seed-scripts/catalog/ops-catalog-audit.inline.ts +1 -1
- package/src/be/seed-scripts/catalog/ops-catalog-audit.ts +1 -1
- package/src/commands/provider-credentials.ts +2 -1
- package/src/commands/runner.ts +69 -6
- package/src/http/agents.ts +23 -5
- package/src/http/core.ts +8 -5
- package/src/http/index.ts +11 -0
- package/src/http/mcp-bridge.ts +5 -2
- package/src/http/memory.ts +2 -1
- package/src/http/poll.ts +5 -1
- package/src/http/sessions.ts +1 -1
- package/src/http/tasks.ts +35 -0
- package/src/prompts/base-prompt.ts +48 -4
- package/src/prompts/session-templates.ts +13 -1
- package/src/providers/claude-managed-models.ts +8 -0
- package/src/providers/codex-adapter.ts +3 -0
- package/src/providers/opencode-adapter.ts +40 -0
- package/src/providers/pi-mono-adapter.ts +179 -1
- package/src/providers/pi-mono-extension.ts +9 -0
- package/src/scripts-runtime/types/stdlib.d.ts +11 -0
- package/src/server.ts +230 -126
- package/src/tests/agent-avatar-resolution.test.ts +293 -0
- package/src/tests/agents-list-model-display.test.ts +10 -0
- package/src/tests/base-prompt.test.ts +72 -0
- package/src/tests/claude-managed-adapter.test.ts +6 -0
- package/src/tests/context-window.test.ts +1 -0
- package/src/tests/list-endpoint-slimming.test.ts +45 -0
- package/src/tests/memory-feature-flags.test.ts +45 -0
- package/src/tests/memory-rater-llm-summarizer.test.ts +24 -0
- package/src/tests/opencode-plugin.test.ts +43 -0
- package/src/tests/openrouter-base-url.test.ts +256 -0
- package/src/tests/pi-mono-adapter.test.ts +90 -0
- package/src/tests/prompt-template-session.test.ts +6 -5
- package/src/tests/script-connections.test.ts +1 -0
- package/src/tests/sdk-allowlist.test.ts +4 -1
- package/src/tests/seed-capabilities.test.ts +92 -0
- package/src/tests/session-costs-model-key-normalize.test.ts +1 -0
- package/src/tests/sessions.test.ts +46 -0
- package/src/tests/task-title-route.test.ts +106 -0
- package/src/tests/tool-annotations.test.ts +6 -3
- package/src/tools/memory-search.ts +2 -1
- package/src/tools/update-profile.ts +15 -5
- package/src/types.ts +29 -0
- package/src/utils/context-window.ts +1 -0
- package/src/utils/internal-ai/complete-structured.ts +19 -1
- package/src/utils/internal-ai/summarize-session.ts +7 -0
- package/src/utils/openrouter-base-url.ts +28 -0
- package/src/workflows/executors/raw-llm.ts +2 -1
- package/src/workflows/executors/validate.ts +2 -1
- package/dist/cli-z9gzq07x.js +0 -27
- package/dist/{otel-g299k41b.js → otel-63jr5v38.js} +1 -1
|
@@ -5,14 +5,18 @@ import {
|
|
|
5
5
|
parseStreamingJson
|
|
6
6
|
} from "./cli-zyxs93y9.js";
|
|
7
7
|
import {
|
|
8
|
+
appendGrammarToolInputJsonDelta,
|
|
9
|
+
getGrammarToolInput,
|
|
10
|
+
resolveGrammarConstrainedSampling,
|
|
11
|
+
resolveJsonSchemaStrictSampling,
|
|
8
12
|
transformMessages
|
|
9
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-x0e0yvnq.js";
|
|
10
14
|
import {
|
|
11
15
|
sanitizeSurrogates
|
|
12
16
|
} from "./cli-y2apkfe2.js";
|
|
13
17
|
import {
|
|
14
18
|
calculateCost
|
|
15
|
-
} from "./cli-
|
|
19
|
+
} from "./cli-ccjwgarc.js";
|
|
16
20
|
|
|
17
21
|
// node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js
|
|
18
22
|
function encodeTextSignatureV1(id, phase) {
|
|
@@ -37,6 +41,27 @@ function parseTextSignature(signature) {
|
|
|
37
41
|
}
|
|
38
42
|
return { id: signature };
|
|
39
43
|
}
|
|
44
|
+
function convertToolResultOutput(model, content) {
|
|
45
|
+
const textResult = content.filter((c) => c.type === "text").map((c) => c.text).join(`
|
|
46
|
+
`);
|
|
47
|
+
const images = content.filter((c) => c.type === "image");
|
|
48
|
+
const hasText = textResult.length > 0;
|
|
49
|
+
if (images.length === 0 || !model.input.includes("image")) {
|
|
50
|
+
return sanitizeSurrogates(hasText ? textResult : images.length > 0 ? "(see attached image)" : "(no tool output)");
|
|
51
|
+
}
|
|
52
|
+
const output = [];
|
|
53
|
+
if (hasText) {
|
|
54
|
+
output.push({ type: "input_text", text: sanitizeSurrogates(textResult) });
|
|
55
|
+
}
|
|
56
|
+
for (const image of images) {
|
|
57
|
+
output.push({
|
|
58
|
+
type: "input_image",
|
|
59
|
+
detail: "auto",
|
|
60
|
+
image_url: `data:${image.mimeType};base64,${image.data}`
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return output;
|
|
64
|
+
}
|
|
40
65
|
function convertResponsesMessages(model, context, allowedToolCallProviders, options) {
|
|
41
66
|
const messages = [];
|
|
42
67
|
const loadedToolNames = new Set;
|
|
@@ -135,55 +160,49 @@ function convertResponsesMessages(model, context, allowedToolCallProviders, opti
|
|
|
135
160
|
} else if (block.type === "toolCall") {
|
|
136
161
|
const toolCall = block;
|
|
137
162
|
const [callId, itemIdRaw] = toolCall.id.split("|");
|
|
163
|
+
const customInputProperty = options?.grammarToolInputProperties?.get(toolCall.name);
|
|
138
164
|
let itemId = itemIdRaw;
|
|
139
|
-
if (isDifferentModel && itemId?.startsWith("fc_")) {
|
|
165
|
+
if (isDifferentModel && itemId?.startsWith("fc_") || customInputProperty === undefined && !itemId?.startsWith("fc_")) {
|
|
140
166
|
itemId = undefined;
|
|
141
167
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
168
|
+
if (customInputProperty !== undefined) {
|
|
169
|
+
output.push({
|
|
170
|
+
type: "custom_tool_call",
|
|
171
|
+
id: itemId,
|
|
172
|
+
call_id: callId,
|
|
173
|
+
name: toolCall.name,
|
|
174
|
+
input: sanitizeSurrogates(getGrammarToolInput(toolCall.name, toolCall.arguments, customInputProperty))
|
|
175
|
+
});
|
|
176
|
+
} else {
|
|
177
|
+
output.push({
|
|
178
|
+
type: "function_call",
|
|
179
|
+
id: itemId,
|
|
180
|
+
call_id: callId,
|
|
181
|
+
name: toolCall.name,
|
|
182
|
+
arguments: JSON.stringify(toolCall.arguments)
|
|
183
|
+
});
|
|
184
|
+
}
|
|
149
185
|
}
|
|
150
186
|
}
|
|
151
187
|
if (output.length === 0)
|
|
152
188
|
continue;
|
|
153
189
|
messages.push(...output);
|
|
154
190
|
} else if (msg.role === "toolResult") {
|
|
155
|
-
const textResult = msg.content.filter((c) => c.type === "text").map((c) => c.text).join(`
|
|
156
|
-
`);
|
|
157
|
-
const hasImages = msg.content.some((c) => c.type === "image");
|
|
158
|
-
const hasText = textResult.length > 0;
|
|
159
191
|
const [callId] = msg.toolCallId.split("|");
|
|
160
|
-
|
|
161
|
-
if (
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
for (const block of msg.content) {
|
|
170
|
-
if (block.type === "image") {
|
|
171
|
-
contentParts.push({
|
|
172
|
-
type: "input_image",
|
|
173
|
-
detail: "auto",
|
|
174
|
-
image_url: `data:${block.mimeType};base64,${block.data}`
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
output = contentParts;
|
|
192
|
+
const output = convertToolResultOutput(model, msg.content);
|
|
193
|
+
if (options?.grammarToolInputProperties?.has(msg.toolName)) {
|
|
194
|
+
messages.push({
|
|
195
|
+
type: "custom_tool_call_output",
|
|
196
|
+
call_id: callId,
|
|
197
|
+
output
|
|
198
|
+
});
|
|
179
199
|
} else {
|
|
180
|
-
|
|
200
|
+
messages.push({
|
|
201
|
+
type: "function_call_output",
|
|
202
|
+
call_id: callId,
|
|
203
|
+
output
|
|
204
|
+
});
|
|
181
205
|
}
|
|
182
|
-
messages.push({
|
|
183
|
-
type: "function_call_output",
|
|
184
|
-
call_id: callId,
|
|
185
|
-
output
|
|
186
|
-
});
|
|
187
206
|
const deferredTools = [];
|
|
188
207
|
for (const name of msg.addedToolNames ?? []) {
|
|
189
208
|
const tool = options?.deferredTools?.get(name);
|
|
@@ -207,7 +226,10 @@ function convertResponsesMessages(model, context, allowedToolCallProviders, opti
|
|
|
207
226
|
call_id: searchCallId,
|
|
208
227
|
execution: "client",
|
|
209
228
|
status: "completed",
|
|
210
|
-
tools: convertResponsesTools(deferredTools, {
|
|
229
|
+
tools: convertResponsesTools(deferredTools, {
|
|
230
|
+
...options?.toolOptions,
|
|
231
|
+
deferLoading: true
|
|
232
|
+
})
|
|
211
233
|
});
|
|
212
234
|
}
|
|
213
235
|
}
|
|
@@ -216,15 +238,52 @@ function convertResponsesMessages(model, context, allowedToolCallProviders, opti
|
|
|
216
238
|
return messages;
|
|
217
239
|
}
|
|
218
240
|
function convertResponsesTools(tools, options) {
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
241
|
+
const defaultStrict = options?.strict === undefined ? false : options.strict;
|
|
242
|
+
const supportsStrictMode = options?.supportsStrictMode ?? true;
|
|
243
|
+
const supportsOpenAIGrammarTools = options?.supportsOpenAIGrammarTools ?? false;
|
|
244
|
+
return tools.map((tool) => {
|
|
245
|
+
const grammar = resolveGrammarConstrainedSampling(tool, supportsOpenAIGrammarTools);
|
|
246
|
+
if (grammar) {
|
|
247
|
+
return {
|
|
248
|
+
type: "custom",
|
|
249
|
+
name: tool.name,
|
|
250
|
+
description: tool.description,
|
|
251
|
+
format: {
|
|
252
|
+
type: "grammar",
|
|
253
|
+
syntax: grammar.format,
|
|
254
|
+
definition: grammar.definition
|
|
255
|
+
},
|
|
256
|
+
...options?.deferLoading ? { defer_loading: true } : {}
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
const constrainedStrict = resolveJsonSchemaStrictSampling(tool, supportsStrictMode);
|
|
260
|
+
const functionTool = {
|
|
261
|
+
type: "function",
|
|
262
|
+
name: tool.name,
|
|
263
|
+
description: tool.description,
|
|
264
|
+
parameters: tool.parameters,
|
|
265
|
+
...options?.deferLoading ? { defer_loading: true } : {}
|
|
266
|
+
};
|
|
267
|
+
if (supportsStrictMode) {
|
|
268
|
+
functionTool.strict = constrainedStrict ?? defaultStrict;
|
|
269
|
+
}
|
|
270
|
+
return functionTool;
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
function getCustomToolCallInput(block) {
|
|
274
|
+
const property = block.customInput?.property;
|
|
275
|
+
if (property === undefined)
|
|
276
|
+
return "";
|
|
277
|
+
const value = block.arguments[property];
|
|
278
|
+
return typeof value === "string" ? value : "";
|
|
279
|
+
}
|
|
280
|
+
function appendCustomToolCallInput(block, nextInput, close) {
|
|
281
|
+
const customInput = block.customInput;
|
|
282
|
+
if (!customInput)
|
|
283
|
+
return;
|
|
284
|
+
const delta = appendGrammarToolInputJsonDelta(customInput.jsonBuffer, customInput.property, nextInput, close);
|
|
285
|
+
block.arguments = { [customInput.property]: nextInput };
|
|
286
|
+
return delta;
|
|
228
287
|
}
|
|
229
288
|
async function processResponsesStream(openaiStream, output, stream, model, options) {
|
|
230
289
|
let sawTerminalResponseEvent = false;
|
|
@@ -234,6 +293,16 @@ async function processResponsesStream(openaiStream, output, stream, model, optio
|
|
|
234
293
|
const slot = outputSlots.get(outputIndex);
|
|
235
294
|
return slot?.type === type ? slot : undefined;
|
|
236
295
|
};
|
|
296
|
+
const pushToolCallDelta = (slot, delta) => {
|
|
297
|
+
if (delta === undefined)
|
|
298
|
+
return;
|
|
299
|
+
stream.push({
|
|
300
|
+
type: "toolcall_delta",
|
|
301
|
+
contentIndex: slot.contentIndex,
|
|
302
|
+
delta,
|
|
303
|
+
partial: output
|
|
304
|
+
});
|
|
305
|
+
};
|
|
237
306
|
const createSlot = (outputIndex, item) => {
|
|
238
307
|
if (item.type === "reasoning") {
|
|
239
308
|
const block = { type: "thinking", thinking: "" };
|
|
@@ -273,6 +342,29 @@ async function processResponsesStream(openaiStream, output, stream, model, optio
|
|
|
273
342
|
stream.push({ type: "toolcall_start", contentIndex: slot.contentIndex, partial: output });
|
|
274
343
|
return slot;
|
|
275
344
|
}
|
|
345
|
+
if (item.type === "custom_tool_call") {
|
|
346
|
+
const inputProperty = options?.grammarToolInputProperties?.get(item.name) ?? "input";
|
|
347
|
+
const input = item.input || "";
|
|
348
|
+
const block = {
|
|
349
|
+
type: "toolCall",
|
|
350
|
+
id: `${item.call_id}|${item.id}`,
|
|
351
|
+
name: item.name,
|
|
352
|
+
arguments: { [inputProperty]: input },
|
|
353
|
+
customInput: {
|
|
354
|
+
property: inputProperty,
|
|
355
|
+
jsonBuffer: { input: "", started: false, closed: false }
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
output.content.push(block);
|
|
359
|
+
const slot = {
|
|
360
|
+
type: "toolCall",
|
|
361
|
+
block,
|
|
362
|
+
contentIndex: output.content.length - 1
|
|
363
|
+
};
|
|
364
|
+
outputSlots.set(outputIndex, slot);
|
|
365
|
+
stream.push({ type: "toolcall_start", contentIndex: slot.contentIndex, partial: output });
|
|
366
|
+
return slot;
|
|
367
|
+
}
|
|
276
368
|
return;
|
|
277
369
|
};
|
|
278
370
|
const getOrCreateSlot = (outputIndex, item) => {
|
|
@@ -390,34 +482,33 @@ async function processResponsesStream(openaiStream, output, stream, model, optio
|
|
|
390
482
|
});
|
|
391
483
|
} else if (event.type === "response.function_call_arguments.delta") {
|
|
392
484
|
const slot = getSlot(event.output_index, "toolCall");
|
|
393
|
-
if (!slot)
|
|
485
|
+
if (!slot || slot.block.partialJson === undefined)
|
|
394
486
|
continue;
|
|
395
487
|
slot.block.partialJson += event.delta;
|
|
396
488
|
slot.block.arguments = parseStreamingJson(slot.block.partialJson);
|
|
397
|
-
|
|
398
|
-
type: "toolcall_delta",
|
|
399
|
-
contentIndex: slot.contentIndex,
|
|
400
|
-
delta: event.delta,
|
|
401
|
-
partial: output
|
|
402
|
-
});
|
|
489
|
+
pushToolCallDelta(slot, event.delta);
|
|
403
490
|
} else if (event.type === "response.function_call_arguments.done") {
|
|
404
491
|
const slot = getSlot(event.output_index, "toolCall");
|
|
405
|
-
if (!slot)
|
|
492
|
+
if (!slot || slot.block.partialJson === undefined)
|
|
406
493
|
continue;
|
|
407
494
|
const previousPartialJson = slot.block.partialJson;
|
|
408
495
|
slot.block.partialJson = event.arguments;
|
|
409
496
|
slot.block.arguments = parseStreamingJson(slot.block.partialJson);
|
|
410
497
|
if (event.arguments.startsWith(previousPartialJson)) {
|
|
411
498
|
const delta = event.arguments.slice(previousPartialJson.length);
|
|
412
|
-
if (delta.length > 0)
|
|
413
|
-
|
|
414
|
-
type: "toolcall_delta",
|
|
415
|
-
contentIndex: slot.contentIndex,
|
|
416
|
-
delta,
|
|
417
|
-
partial: output
|
|
418
|
-
});
|
|
419
|
-
}
|
|
499
|
+
if (delta.length > 0)
|
|
500
|
+
pushToolCallDelta(slot, delta);
|
|
420
501
|
}
|
|
502
|
+
} else if (event.type === "response.custom_tool_call_input.delta") {
|
|
503
|
+
const slot = getSlot(event.output_index, "toolCall");
|
|
504
|
+
if (!slot || !slot.block.customInput)
|
|
505
|
+
continue;
|
|
506
|
+
pushToolCallDelta(slot, appendCustomToolCallInput(slot.block, getCustomToolCallInput(slot.block) + event.delta, false));
|
|
507
|
+
} else if (event.type === "response.custom_tool_call_input.done") {
|
|
508
|
+
const slot = getSlot(event.output_index, "toolCall");
|
|
509
|
+
if (!slot || !slot.block.customInput)
|
|
510
|
+
continue;
|
|
511
|
+
pushToolCallDelta(slot, appendCustomToolCallInput(slot.block, event.input, true));
|
|
421
512
|
} else if (event.type === "response.output_item.done") {
|
|
422
513
|
const item = event.item;
|
|
423
514
|
const slot = getOrCreateSlot(event.output_index, item);
|
|
@@ -448,7 +539,7 @@ async function processResponsesStream(openaiStream, output, stream, model, optio
|
|
|
448
539
|
partial: output
|
|
449
540
|
});
|
|
450
541
|
outputSlots.delete(event.output_index);
|
|
451
|
-
} else if (item.type === "function_call" && slot?.type === "toolCall") {
|
|
542
|
+
} else if (item.type === "function_call" && slot?.type === "toolCall" && slot.block.partialJson !== undefined) {
|
|
452
543
|
slot.block.arguments = parseStreamingJson(item.arguments || slot.block.partialJson || "{}");
|
|
453
544
|
delete slot.block.partialJson;
|
|
454
545
|
stream.push({
|
|
@@ -458,6 +549,16 @@ async function processResponsesStream(openaiStream, output, stream, model, optio
|
|
|
458
549
|
partial: output
|
|
459
550
|
});
|
|
460
551
|
outputSlots.delete(event.output_index);
|
|
552
|
+
} else if (item.type === "custom_tool_call" && slot?.type === "toolCall" && slot.block.customInput) {
|
|
553
|
+
pushToolCallDelta(slot, appendCustomToolCallInput(slot.block, item.input ?? getCustomToolCallInput(slot.block), true));
|
|
554
|
+
delete slot.block.customInput;
|
|
555
|
+
stream.push({
|
|
556
|
+
type: "toolcall_end",
|
|
557
|
+
contentIndex: slot.contentIndex,
|
|
558
|
+
toolCall: slot.block,
|
|
559
|
+
partial: output
|
|
560
|
+
});
|
|
561
|
+
outputSlots.delete(event.output_index);
|
|
461
562
|
}
|
|
462
563
|
} else if (event.type === "response.completed" || event.type === "response.incomplete") {
|
|
463
564
|
finalizeResponse(event.response);
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getApiKey
|
|
3
3
|
} from "./cli-f14fvzag.js";
|
|
4
|
+
import {
|
|
5
|
+
getOpenRouterBaseUrl
|
|
6
|
+
} from "./cli-3dpj7atn.js";
|
|
4
7
|
import {
|
|
5
8
|
ensureAuthorizationTokenOrThrow,
|
|
6
9
|
oauthAppRowToProviderConfig
|
|
7
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-qfh6pmvm.js";
|
|
8
11
|
import {
|
|
9
12
|
getScript,
|
|
10
13
|
getScriptApiConnectionDescriptors,
|
|
@@ -12,15 +15,15 @@ import {
|
|
|
12
15
|
getScriptVersion,
|
|
13
16
|
listRelationalCredentialBindings,
|
|
14
17
|
validateScriptImports
|
|
15
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-e0zbndab.js";
|
|
16
19
|
import {
|
|
17
20
|
getAuthorizationById,
|
|
18
21
|
getOAuthApp,
|
|
19
22
|
getOAuthAppById
|
|
20
|
-
} from "./cli-
|
|
23
|
+
} from "./cli-5jd04m23.js";
|
|
21
24
|
import {
|
|
22
25
|
withSiblingAwareness
|
|
23
|
-
} from "./cli-
|
|
26
|
+
} from "./cli-p8qcm631.js";
|
|
24
27
|
import {
|
|
25
28
|
getAppUrl
|
|
26
29
|
} from "./cli-dh55d5fg.js";
|
|
@@ -74,13 +77,7 @@ import {
|
|
|
74
77
|
updateWorkflowRun,
|
|
75
78
|
updateWorkflowRunStep,
|
|
76
79
|
workflowContextKey
|
|
77
|
-
} from "./cli-
|
|
78
|
-
import {
|
|
79
|
-
init_zod
|
|
80
|
-
} from "./cli-bw80ck94.js";
|
|
81
|
-
import {
|
|
82
|
-
exports_external
|
|
83
|
-
} from "./cli-xz9aq0rf.js";
|
|
80
|
+
} from "./cli-2846g99z.js";
|
|
84
81
|
import {
|
|
85
82
|
init_secret_scrubber,
|
|
86
83
|
isSensitiveKey,
|
|
@@ -88,6 +85,12 @@ import {
|
|
|
88
85
|
scrubObject,
|
|
89
86
|
scrubSecrets
|
|
90
87
|
} from "./cli-4j2mrzag.js";
|
|
88
|
+
import {
|
|
89
|
+
init_zod
|
|
90
|
+
} from "./cli-bw80ck94.js";
|
|
91
|
+
import {
|
|
92
|
+
exports_external
|
|
93
|
+
} from "./cli-xz9aq0rf.js";
|
|
91
94
|
import {
|
|
92
95
|
init_event_bus,
|
|
93
96
|
workflowEventBus
|
|
@@ -2620,7 +2623,7 @@ class HumanInTheLoopExecutor extends BaseExecutor {
|
|
|
2620
2623
|
}
|
|
2621
2624
|
if (notification.channel === "slack") {
|
|
2622
2625
|
try {
|
|
2623
|
-
const { getSlackApp } = await import("./app-
|
|
2626
|
+
const { getSlackApp } = await import("./app-9gfdk9me.js");
|
|
2624
2627
|
const slackApp = getSlackApp();
|
|
2625
2628
|
if (!slackApp) {
|
|
2626
2629
|
console.warn("[HITL] Slack not initialized — cannot send notification");
|
|
@@ -2734,7 +2737,7 @@ class NotifyExecutor extends BaseExecutor {
|
|
|
2734
2737
|
}
|
|
2735
2738
|
}
|
|
2736
2739
|
case "slack": {
|
|
2737
|
-
const { getSlackApp } = await import("./app-
|
|
2740
|
+
const { getSlackApp } = await import("./app-9gfdk9me.js");
|
|
2738
2741
|
const app = getSlackApp();
|
|
2739
2742
|
if (!app) {
|
|
2740
2743
|
return {
|
|
@@ -2859,7 +2862,7 @@ async function executeRawLlm(config) {
|
|
|
2859
2862
|
try {
|
|
2860
2863
|
const { createOpenAI } = await import("./index-2dgfj9av.js");
|
|
2861
2864
|
const openrouter = createOpenAI({
|
|
2862
|
-
baseURL:
|
|
2865
|
+
baseURL: getOpenRouterBaseUrl(),
|
|
2863
2866
|
apiKey: process.env.OPENROUTER_API_KEY
|
|
2864
2867
|
});
|
|
2865
2868
|
const model = openrouter(modelName);
|
|
@@ -3625,7 +3628,7 @@ class ValidateExecutor extends BaseExecutor {
|
|
|
3625
3628
|
const { createOpenAI } = await import("./index-2dgfj9av.js");
|
|
3626
3629
|
const { generateObject, jsonSchema } = await import("./index-t2snazez.js");
|
|
3627
3630
|
const openrouter = createOpenAI({
|
|
3628
|
-
baseURL:
|
|
3631
|
+
baseURL: getOpenRouterBaseUrl(),
|
|
3629
3632
|
apiKey: process.env.OPENROUTER_API_KEY
|
|
3630
3633
|
});
|
|
3631
3634
|
const { object } = await generateObject({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AssistantMessageEventStream
|
|
3
|
-
|
|
2
|
+
AssistantMessageEventStream,
|
|
3
|
+
formatThrownValue
|
|
4
|
+
} from "./cli-8wrympd7.js";
|
|
4
5
|
|
|
5
6
|
// node_modules/@earendil-works/pi-ai/dist/api/lazy.js
|
|
6
7
|
function createSetupErrorMessage(model, error) {
|
|
@@ -124,11 +125,19 @@ class InMemoryCredentialStore {
|
|
|
124
125
|
class ModelsError extends Error {
|
|
125
126
|
code;
|
|
126
127
|
constructor(code, message, options) {
|
|
127
|
-
super(message, options);
|
|
128
|
+
super(withCauseDetail(message, options?.cause), options);
|
|
128
129
|
this.name = "ModelsError";
|
|
129
130
|
this.code = code;
|
|
130
131
|
}
|
|
131
132
|
}
|
|
133
|
+
function withCauseDetail(message, cause) {
|
|
134
|
+
if (cause === undefined || cause === null)
|
|
135
|
+
return message;
|
|
136
|
+
const detail = formatThrownValue(cause).trim();
|
|
137
|
+
if (!detail || message.includes(detail))
|
|
138
|
+
return message;
|
|
139
|
+
return `${message}: ${detail}`;
|
|
140
|
+
}
|
|
132
141
|
async function resolveProviderAuth(provider, credentials, authContext, overrides) {
|
|
133
142
|
const requestAuthContext = overrides?.env ? overlayEnvAuthContext(authContext, overrides.env) : authContext;
|
|
134
143
|
if (overrides?.apiKey !== undefined && provider.auth.apiKey) {
|
|
@@ -43,10 +43,15 @@ function pickBodyText(error) {
|
|
|
43
43
|
const responseBody = error.$response?.body;
|
|
44
44
|
if (typeof responseBody === "string")
|
|
45
45
|
return responseBody;
|
|
46
|
+
if (isReadableStreamLike(responseBody))
|
|
47
|
+
return;
|
|
46
48
|
if (isNonEmptyObject(responseBody))
|
|
47
49
|
return safeJsonStringify(responseBody);
|
|
48
50
|
return;
|
|
49
51
|
}
|
|
52
|
+
function isReadableStreamLike(value) {
|
|
53
|
+
return typeof value === "object" && value !== null && "pipe" in value && typeof value.pipe === "function";
|
|
54
|
+
}
|
|
50
55
|
function isNonEmptyObject(value) {
|
|
51
56
|
return typeof value === "object" && value !== null && Object.keys(value).length > 0;
|
|
52
57
|
}
|
|
@@ -7,7 +7,7 @@ var package_default;
|
|
|
7
7
|
var init_package = __esm(() => {
|
|
8
8
|
package_default = {
|
|
9
9
|
name: "@desplega.ai/agent-swarm",
|
|
10
|
-
version: "1.
|
|
10
|
+
version: "1.121.1",
|
|
11
11
|
description: "Multi-agent orchestration for Claude Code, Codex, Gemini CLI, and other AI coding assistants",
|
|
12
12
|
license: "MIT",
|
|
13
13
|
author: "desplega.sh <contact@desplega.sh>",
|
|
@@ -66,6 +66,7 @@ var init_package = __esm(() => {
|
|
|
66
66
|
],
|
|
67
67
|
scripts: {
|
|
68
68
|
"build:pi-skills": "bun run plugin/build-pi-skills.ts",
|
|
69
|
+
"build:script-types": "bun scripts/bundle-script-types.ts",
|
|
69
70
|
"build:cli": "bun run scripts/build-cli.ts",
|
|
70
71
|
"mono:build": "turbo run build",
|
|
71
72
|
"mono:test": "turbo run test",
|
|
@@ -78,6 +79,7 @@ var init_package = __esm(() => {
|
|
|
78
79
|
"check:api-key-boundary": "bash scripts/check-api-key-boundary.sh",
|
|
79
80
|
"check:vendored-openapi": "bun scripts/check-vendored-openapi.ts",
|
|
80
81
|
"check:rbac-coverage": "bun scripts/check-rbac-coverage.ts",
|
|
82
|
+
"check:script-types": "bash scripts/check-script-types-freshness.sh",
|
|
81
83
|
"check:audit-columns": "bash scripts/check-audit-columns.sh",
|
|
82
84
|
"lint:structure": "konsistent check",
|
|
83
85
|
"prepare-release": "bun scripts/prepare-release.ts",
|
|
@@ -150,14 +152,14 @@ var init_package = __esm(() => {
|
|
|
150
152
|
"@aws-sdk/client-bedrock": "3.1048.0",
|
|
151
153
|
"@desplega.ai/business-use": "^0.4.2",
|
|
152
154
|
"@desplega.ai/localtunnel": "^2.2.0",
|
|
153
|
-
"@earendil-works/pi-agent-core": "^0.
|
|
154
|
-
"@earendil-works/pi-ai": "^0.
|
|
155
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
155
|
+
"@earendil-works/pi-agent-core": "^0.82.1",
|
|
156
|
+
"@earendil-works/pi-ai": "^0.82.1",
|
|
157
|
+
"@earendil-works/pi-coding-agent": "^0.82.1",
|
|
156
158
|
"@inkjs/ui": "^2.0.0",
|
|
157
159
|
"@linear/sdk": "^77.0.0",
|
|
158
160
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
159
161
|
"@openai/codex-sdk": "^0.145.0",
|
|
160
|
-
"@opencode-ai/sdk": "^1.18.
|
|
162
|
+
"@opencode-ai/sdk": "^1.18.5",
|
|
161
163
|
"@openfort/openfort-node": "^0.9.1",
|
|
162
164
|
"@opentelemetry/api": "^1.9.1",
|
|
163
165
|
"@opentelemetry/exporter-metrics-otlp-http": "^0.218.0",
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
getTaskById,
|
|
28
28
|
init_db,
|
|
29
29
|
setSlackMessageTracking
|
|
30
|
-
} from "./cli-
|
|
30
|
+
} from "./cli-2846g99z.js";
|
|
31
31
|
import {
|
|
32
32
|
require_receiver,
|
|
33
33
|
require_sender,
|
|
@@ -55073,13 +55073,13 @@ async function initSlackApp() {
|
|
|
55073
55073
|
socketMode: true,
|
|
55074
55074
|
logLevel: import_bolt.LogLevel.DEBUG
|
|
55075
55075
|
});
|
|
55076
|
-
const { registerMessageHandler } = await import("./handlers-
|
|
55077
|
-
const { registerCommandHandler } = await import("./commands-
|
|
55078
|
-
const { registerActionHandlers } = await import("./actions-
|
|
55076
|
+
const { registerMessageHandler } = await import("./handlers-fxvqnp6s.js");
|
|
55077
|
+
const { registerCommandHandler } = await import("./commands-hty4156r.js");
|
|
55078
|
+
const { registerActionHandlers } = await import("./actions-99h2dh5e.js");
|
|
55079
55079
|
registerMessageHandler(app);
|
|
55080
55080
|
registerCommandHandler(app);
|
|
55081
55081
|
registerActionHandlers(app);
|
|
55082
|
-
const { createAssistant } = await import("./assistant-
|
|
55082
|
+
const { createAssistant } = await import("./assistant-mabq9kz7.js");
|
|
55083
55083
|
app.assistant(createAssistant());
|
|
55084
55084
|
return app;
|
|
55085
55085
|
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./cli-jkhwmmgg.js";
|
|
4
4
|
import {
|
|
5
5
|
embedScript
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-yyqpn0gc.js";
|
|
7
7
|
import {
|
|
8
8
|
calculatePKCECodeChallenge,
|
|
9
9
|
generateRandomCodeVerifier,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
getOAuthAppById,
|
|
13
13
|
updateAuthorizationTokens,
|
|
14
14
|
upsertAuthorization
|
|
15
|
-
} from "./cli-
|
|
15
|
+
} from "./cli-5jd04m23.js";
|
|
16
16
|
import {
|
|
17
17
|
computeContentHash,
|
|
18
18
|
decryptSecret,
|
|
@@ -28,19 +28,19 @@ import {
|
|
|
28
28
|
normalizeDateRequired,
|
|
29
29
|
placeholderForConfigKey,
|
|
30
30
|
upsertSwarmConfig
|
|
31
|
-
} from "./cli-
|
|
32
|
-
import {
|
|
33
|
-
init_zod
|
|
34
|
-
} from "./cli-bw80ck94.js";
|
|
35
|
-
import {
|
|
36
|
-
exports_external
|
|
37
|
-
} from "./cli-xz9aq0rf.js";
|
|
31
|
+
} from "./cli-2846g99z.js";
|
|
38
32
|
import {
|
|
39
33
|
init_secret_scrubber,
|
|
40
34
|
refreshSecretScrubberCache,
|
|
41
35
|
registerVolatileSecret,
|
|
42
36
|
scrubSecrets
|
|
43
37
|
} from "./cli-4j2mrzag.js";
|
|
38
|
+
import {
|
|
39
|
+
init_zod
|
|
40
|
+
} from "./cli-bw80ck94.js";
|
|
41
|
+
import {
|
|
42
|
+
exports_external
|
|
43
|
+
} from "./cli-xz9aq0rf.js";
|
|
44
44
|
import {
|
|
45
45
|
__commonJS,
|
|
46
46
|
__require,
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
linkIdentity,
|
|
5
5
|
recordUnmappedIdentity,
|
|
6
6
|
resolveIdentity
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-7bk7s2sx.js";
|
|
8
8
|
import {
|
|
9
9
|
getKv,
|
|
10
10
|
init_db,
|
|
11
11
|
upsertKv
|
|
12
|
-
} from "./cli-
|
|
12
|
+
} from "./cli-2846g99z.js";
|
|
13
13
|
|
|
14
14
|
// src/slack/enrich.ts
|
|
15
15
|
init_db();
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getAgentWorkingOnThread,
|
|
4
4
|
getAllAgents,
|
|
5
5
|
init_db
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-2846g99z.js";
|
|
7
7
|
|
|
8
8
|
// src/slack/router.ts
|
|
9
9
|
init_db();
|
|
@@ -261,4 +261,4 @@ function createAdditiveBuffer(options) {
|
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
export { hasOtherUserMention, routeMessage, extractTaskFromMessage, extractSlackMessageText, parseSlackTs
|
|
264
|
+
export { createAdditiveBuffer, hasOtherUserMention, routeMessage, extractTaskFromMessage, extractSlackMessageText, parseSlackTs };
|