@desplega.ai/agent-swarm 2.5.2 → 2.5.3
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-adapter-csh0zz3b.js → acp-adapter-gr2fcyyj.js} +3 -3
- package/dist/{actions-6xx079d1.js → actions-wv766ghf.js} +18 -18
- package/dist/{amp-adapter-8n6f0hz8.js → amp-adapter-speb906t.js} +3 -3
- package/dist/{app-ft6r6v23.js → app-ag29n14f.js} +3 -3
- package/dist/{assistant-vt2cyfzd.js → assistant-3x8bz3eg.js} +19 -19
- package/dist/{boot-reembed-r3e808ky.js → boot-reembed-5b3d2eea.js} +1 -1
- package/dist/{boot-reembed-tgrfy27t.js → boot-reembed-jsmfrpzf.js} +1 -1
- package/dist/{boot-scrub-sweep-masdwxkm.js → boot-scrub-sweep-s73gerxy.js} +2 -2
- package/dist/{boot-seeds-0n82qc7q.js → boot-seeds-5zmax2wr.js} +4 -4
- package/dist/{claude-adapter-s7j47k06.js → claude-adapter-hswdnm3t.js} +3 -3
- package/dist/{claude-managed-adapter-gt6pa35d.js → claude-managed-adapter-cvbzj1h6.js} +2 -2
- package/dist/{claude-managed-setup-3hzrgrnk.js → claude-managed-setup-3k8m3hhc.js} +2 -2
- package/dist/{claude-sdk-session-0zrdzyx2.js → claude-sdk-session-fkbyk66x.js} +2 -2
- package/dist/{cli-d172svcw.js → cli-1fc85mvt.js} +4 -4
- package/dist/{cli-3e9vs93g.js → cli-210xd1f4.js} +4 -4
- package/dist/{cli-vaxw3bg0.js → cli-25j01dpj.js} +3 -3
- package/dist/{cli-n6kmqngw.js → cli-35gtk1p6.js} +1 -1
- package/dist/{cli-fgn7yg5r.js → cli-3ngdk5te.js} +1 -1
- package/dist/{cli-7ccf7akh.js → cli-40jsnrjm.js} +2 -2
- package/dist/{cli-b1tv22wr.js → cli-502eqv93.js} +1 -1
- package/dist/{cli-ydg6ep51.js → cli-6n8axjv1.js} +1 -1
- package/dist/{cli-f55b6ky0.js → cli-8s5wx3nz.js} +2 -2
- package/dist/{cli-86zpfje5.js → cli-99xgw26r.js} +1 -1
- package/dist/{cli-xw9q173h.js → cli-9s05422w.js} +1 -1
- package/dist/{cli-h5d22pfs.js → cli-aecdcr77.js} +119 -282
- package/dist/{cli-w9etnnxk.js → cli-bf8ma3f1.js} +120 -50
- package/dist/{cli-15xd0j7w.js → cli-ce0ak9ms.js} +11 -11
- package/dist/{cli-y3dzwyy3.js → cli-e2ar4bp1.js} +71 -20
- package/dist/{cli-b6tnjdvx.js → cli-e8jyq7d8.js} +1 -1
- package/dist/{cli-6y43v79h.js → cli-egjggehm.js} +1 -1
- package/dist/{cli-cf63dnxj.js → cli-ewm3pwbq.js} +2 -2
- package/dist/{cli-bpbcpd8b.js → cli-fsdprwrg.js} +1 -1
- package/dist/{cli-qrjv7t18.js → cli-fzcn3d87.js} +1 -1
- package/dist/{cli-14v1sxxy.js → cli-gpsz7g88.js} +6 -6
- package/dist/{cli-wadzapwb.js → cli-hcpj2xqz.js} +1 -1
- package/dist/{cli-jmcjbjkt.js → cli-hhxjnjzs.js} +1 -1
- package/dist/{cli-j3dwd4kz.js → cli-jjznk3f7.js} +718 -108
- package/dist/{cli-csh8fnbg.js → cli-kxawjrxg.js} +147 -28
- package/dist/{cli-mntxtkhn.js → cli-mz9afxxf.js} +2 -1
- package/dist/{cli-0vgy5wfw.js → cli-n45mr7zh.js} +2 -2
- package/dist/{cli-aaqnqpyw.js → cli-p0rzjkya.js} +2 -2
- package/dist/{cli-3qv8naq8.js → cli-p6zs9h4y.js} +827 -107
- package/dist/{cli-e91vshb1.js → cli-p9rafdrb.js} +4 -4
- package/dist/{cli-edtm741g.js → cli-qgf8emrn.js} +5 -5
- package/dist/{cli-ha22h0eg.js → cli-qzme5949.js} +26 -26
- package/dist/{cli-xzge46sj.js → cli-s49hpn37.js} +2 -2
- package/dist/{cli-b63d08rs.js → cli-s53vp709.js} +1 -1
- package/dist/{cli-cyfgxnvb.js → cli-svrj71pg.js} +18 -16
- package/dist/{cli-4qkg9968.js → cli-vwn81jbs.js} +3 -3
- package/dist/{cli-f3pfn4x3.js → cli-w1zwctj2.js} +1 -1
- package/dist/{cli-kcnwn85g.js → cli-y561h5a9.js} +4 -4
- package/dist/{cli-n2918sed.js → cli-z21whrrg.js} +15 -15
- package/dist/cli.js +16 -16
- package/dist/{codex-adapter-brh2tcxr.js → codex-adapter-n8ka66vf.js} +2 -2
- package/dist/{codex-session-runner-0dnj21qs.js → codex-session-runner-fsebts37.js} +1 -1
- package/dist/{commands-1cnvseqx.js → commands-t04rt2pc.js} +2 -2
- package/dist/{controller-kc7s9xhn.js → controller-rgna04r2.js} +2 -2
- package/dist/{controllers-connect-jzx7t4bn.js → controllers-connect-bqm1rtft.js} +20 -20
- package/dist/{cursor-adapter-qpwp5sfg.js → cursor-adapter-swr2k95y.js} +1 -1
- package/dist/{db-v5ytg5pw.js → db-24ck09xy.js} +1 -1
- package/dist/{db-4vq88jkc.js → db-a4m7haw0.js} +3 -3
- package/dist/{dispatcher-trtcrqae.js → dispatcher-nwf9ss0q.js} +17 -17
- package/dist/{dsh-adapter-f20xwn1z.js → dsh-adapter-kpdnhjst.js} +2 -2
- package/dist/{external-channel-n9bymc2n.js → external-channel-j1e2p34p.js} +2 -2
- package/dist/{grok-adapter-4kpmmnr6.js → grok-adapter-qtjz0whk.js} +4 -4
- package/dist/{handlers-ptsraqa8.js → handlers-19xr6dnz.js} +20 -20
- package/dist/{heartbeat-60qtxtjf.js → heartbeat-vtesda5d.js} +20 -20
- package/dist/{hook-rbktcstg.js → hook-8wqaszda.js} +1 -1
- package/dist/{hook-ngtvh729.js → hook-b2hhj6rd.js} +1 -1
- package/dist/{http-z8xy72gp.js → http-mxcqhhcs.js} +2757 -2448
- package/dist/{index-a9nsavhx.js → index-1r8wfpzs.js} +1 -1
- package/dist/{index-cbxkmfc5.js → index-9pn1pfkf.js} +1 -1
- package/dist/{index-s193j5fh.js → index-kw2mmat7.js} +20 -20
- package/dist/{index-06qkmcx6.js → index-n1vbvta9.js} +17 -9
- package/dist/{index-6srwvd5b.js → index-p4xfz37z.js} +1 -1
- package/dist/{index-1cscynkb.js → index-spwxjgay.js} +17 -17
- package/dist/{index-r70q0xjx.js → index-srg522m6.js} +17 -17
- package/dist/{keepalive-a9srcphj.js → keepalive-dsd8rtgx.js} +3 -3
- package/dist/{lead-3devneqy.js → lead-zyerk1x2.js} +30 -30
- package/dist/{maintenance-0er16h2y.js → maintenance-jqmqwnet.js} +1 -1
- package/dist/{oauth-refresh-sweep-b65jcyw2.js → oauth-refresh-sweep-q2c3bnvm.js} +2 -2
- package/dist/{onboard-wqywz5py.js → onboard-w4yd7s8t.js} +2 -2
- package/dist/{opencode-adapter-e56086m1.js → opencode-adapter-9tppvxar.js} +2 -2
- package/dist/{otel-impl-vk32s884.js → otel-impl-f36byzbd.js} +1 -1
- package/dist/{pricing-refresh-t27anv4z.js → pricing-refresh-xvak5p4v.js} +3 -3
- package/dist/{rbac-roles-bmcgsxjn.js → rbac-roles-682k2mt5.js} +1 -1
- package/dist/{rbac-roles-452665y0.js → rbac-roles-gfn30fb8.js} +2 -2
- package/dist/{render-v2-0ttsk2j4.js → render-v2-hgytz8nn.js} +3 -3
- package/dist/{resume-a26kvr41.js → resume-2dvq348g.js} +7 -5
- package/dist/{session-access-dgh9nkwk.js → session-access-7f21ekq9.js} +4 -4
- package/dist/{setup-9vc9qahm.js → setup-epffxtbk.js} +1 -1
- package/dist/{work-objects-vn8nkxwn.js → work-objects-xz1a5rqk.js} +20 -20
- package/dist/{worker-1x1h8vnm.js → worker-42t8emjt.js} +30 -30
- package/openapi.json +3045 -2456
- package/package.json +4 -4
- package/src/be/approval-config-question.ts +389 -0
- package/src/be/automation-preflight.ts +37 -3
- package/src/be/db/session-tree.ts +73 -15
- package/src/be/db/skill-search.ts +87 -0
- package/src/be/db/tasks/read.ts +29 -2
- package/src/be/db/workflow-runs.ts +54 -7
- package/src/be/db.ts +25 -5
- package/src/be/migrations/239_skills_fts.sql +40 -0
- package/src/be/migrations/240_workflow_run_parent_step_attempt.sql +37 -0
- package/src/be/migrations/241_skills_meta_fts.sql +39 -0
- package/src/be/swarm-config-guard.ts +23 -0
- package/src/extensions/catalog.generated.json +4 -4
- package/src/http/approval-requests.ts +209 -38
- package/src/http/config.ts +22 -37
- package/src/http/sessions.ts +27 -2
- package/src/integrations/chat-sdk/inbound.ts +5 -4
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/tests/approval-config-question.test.ts +702 -0
- package/src/tests/chat-sdk-inbound.test.ts +20 -0
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/entrypoint-gitlab-credential-helper.test.ts +273 -0
- package/src/tests/extensions-example-comms-adherence-gate.test.ts +321 -12
- package/src/tests/list-endpoint-slimming.test.ts +33 -0
- package/src/tests/migration-240-workflow-run-parent-step-attempt.test.ts +55 -0
- package/src/tests/script-connections.test.ts +6 -0
- package/src/tests/sessions-tree.test.ts +168 -1
- package/src/tests/skill-search-long-content.test.ts +193 -0
- package/src/tests/skill-search.test.ts +173 -22
- package/src/tests/workflow-sub-workflow.test.ts +538 -1
- package/src/tools/request-human-input.ts +27 -5
- package/src/types.ts +7 -0
- package/src/workflows/approval-notifications.ts +10 -3
- package/src/workflows/checkpoint.ts +69 -35
- package/src/workflows/engine.ts +234 -87
- package/src/workflows/executors/base.ts +6 -0
- package/src/workflows/executors/human-in-the-loop.ts +25 -1
- package/src/workflows/executors/sub-workflow.ts +45 -16
- package/src/workflows/recovery.ts +63 -1
- package/src/workflows/resume.ts +60 -21
- package/src/workflows/retry-poller.ts +25 -4
- package/templates/extensions/comms-adherence-gate/README.md +38 -13
- package/templates/extensions/comms-adherence-gate/hooks.ts +272 -69
- package/templates/extensions/comms-adherence-gate/manifest.json +2 -2
- package/templates/skills/turso-interaction/content.md +1 -1
- package/templates/skills/workflow-iterate/content.md +8 -1
- /package/dist/{cli-stxdrqs2.js → cli-avdvgcay.js} +0 -0
- /package/dist/{pi-mono-adapter-tzps8f38.js → pi-mono-adapter-tqsge1ay.js} +0 -0
|
@@ -349,46 +349,124 @@ class ParseError extends Error {
|
|
|
349
349
|
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
+
var LF = 10;
|
|
353
|
+
var CR = 13;
|
|
354
|
+
var SPACE = 32;
|
|
352
355
|
function noop(_arg) {}
|
|
353
|
-
function createParser(
|
|
354
|
-
if (typeof
|
|
355
|
-
throw new TypeError("`
|
|
356
|
-
const { onEvent = noop, onError = noop, onRetry = noop, onComment } =
|
|
357
|
-
let
|
|
358
|
-
function feed(
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
356
|
+
function createParser(config) {
|
|
357
|
+
if (typeof config == "function")
|
|
358
|
+
throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
|
|
359
|
+
const { onEvent = noop, onError = noop, onRetry = noop, onComment, maxBufferSize } = config, pendingFragments = [];
|
|
360
|
+
let pendingFragmentsLength = 0, isFirstChunk = true, id, data = "", dataLines = 0, eventType, terminated = false;
|
|
361
|
+
function feed(chunk) {
|
|
362
|
+
if (terminated)
|
|
363
|
+
throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
|
|
364
|
+
if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
|
|
365
|
+
const trailing2 = processLines(chunk);
|
|
366
|
+
trailing2 !== "" && (pendingFragments.push(trailing2), pendingFragmentsLength = trailing2.length), checkBufferSize();
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
if (chunk.indexOf(`
|
|
370
|
+
`) === -1 && chunk.indexOf("\r") === -1) {
|
|
371
|
+
pendingFragments.push(chunk), pendingFragmentsLength += chunk.length, checkBufferSize();
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
pendingFragments.push(chunk);
|
|
375
|
+
const input = pendingFragments.join("");
|
|
376
|
+
pendingFragments.length = 0, pendingFragmentsLength = 0;
|
|
377
|
+
const trailing = processLines(input);
|
|
378
|
+
trailing !== "" && (pendingFragments.push(trailing), pendingFragmentsLength = trailing.length), checkBufferSize();
|
|
379
|
+
}
|
|
380
|
+
function checkBufferSize() {
|
|
381
|
+
maxBufferSize !== undefined && (pendingFragmentsLength + data.length <= maxBufferSize || (terminated = true, pendingFragments.length = 0, pendingFragmentsLength = 0, id = undefined, data = "", dataLines = 0, eventType = undefined, onError(new ParseError(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, {
|
|
382
|
+
type: "max-buffer-size-exceeded"
|
|
383
|
+
}))));
|
|
384
|
+
}
|
|
385
|
+
function processLines(chunk) {
|
|
386
|
+
let searchIndex = 0;
|
|
387
|
+
if (chunk.indexOf("\r") === -1) {
|
|
388
|
+
let lfIndex = chunk.indexOf(`
|
|
389
|
+
`, searchIndex);
|
|
390
|
+
for (;lfIndex !== -1; ) {
|
|
391
|
+
if (searchIndex === lfIndex) {
|
|
392
|
+
dataLines > 0 && onEvent({ id, event: eventType, data }), id = undefined, data = "", dataLines = 0, eventType = undefined, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
393
|
+
`, searchIndex);
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
const firstCharCode = chunk.charCodeAt(searchIndex);
|
|
397
|
+
if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
|
|
398
|
+
const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
|
|
399
|
+
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
|
|
400
|
+
onEvent({ id, event: eventType, data: value }), id = undefined, data = "", eventType = undefined, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
|
|
401
|
+
`, searchIndex);
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
data = dataLines === 0 ? value : `${data}
|
|
405
|
+
${value}`, dataLines++;
|
|
406
|
+
} else
|
|
407
|
+
isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6, lfIndex) || undefined : parseLine(chunk, searchIndex, lfIndex);
|
|
408
|
+
searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
409
|
+
`, searchIndex);
|
|
410
|
+
}
|
|
411
|
+
return chunk.slice(searchIndex);
|
|
412
|
+
}
|
|
413
|
+
for (;searchIndex < chunk.length; ) {
|
|
414
|
+
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
415
|
+
`, searchIndex);
|
|
416
|
+
let lineEnd = -1;
|
|
417
|
+
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
|
|
418
|
+
break;
|
|
419
|
+
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
|
|
420
|
+
}
|
|
421
|
+
return chunk.slice(searchIndex);
|
|
422
|
+
}
|
|
423
|
+
function parseLine(chunk, start, end) {
|
|
424
|
+
if (start === end) {
|
|
366
425
|
dispatchEvent();
|
|
367
426
|
return;
|
|
368
427
|
}
|
|
369
|
-
|
|
370
|
-
|
|
428
|
+
const firstCharCode = chunk.charCodeAt(start);
|
|
429
|
+
if (isDataPrefix(chunk, start, firstCharCode)) {
|
|
430
|
+
const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
|
|
431
|
+
data = dataLines === 0 ? value2 : `${data}
|
|
432
|
+
${value2}`, dataLines++;
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
if (isEventPrefix(chunk, start, firstCharCode)) {
|
|
436
|
+
eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || undefined;
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
|
|
440
|
+
const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
|
|
441
|
+
value2.includes("\x00") || (id = value2);
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
if (firstCharCode === 58) {
|
|
445
|
+
if (onComment) {
|
|
446
|
+
const line2 = chunk.slice(start, end);
|
|
447
|
+
onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
|
|
448
|
+
}
|
|
371
449
|
return;
|
|
372
450
|
}
|
|
373
|
-
const fieldSeparatorIndex = line.indexOf(":");
|
|
374
|
-
if (fieldSeparatorIndex
|
|
375
|
-
|
|
376
|
-
processField(field, value, line);
|
|
451
|
+
const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
|
|
452
|
+
if (fieldSeparatorIndex === -1) {
|
|
453
|
+
processField(line, "", line);
|
|
377
454
|
return;
|
|
378
455
|
}
|
|
379
|
-
|
|
456
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
457
|
+
processField(field, value, line);
|
|
380
458
|
}
|
|
381
459
|
function processField(field, value, line) {
|
|
382
460
|
switch (field) {
|
|
383
461
|
case "event":
|
|
384
|
-
eventType = value;
|
|
462
|
+
eventType = value || undefined;
|
|
385
463
|
break;
|
|
386
464
|
case "data":
|
|
387
|
-
data = `${data}
|
|
388
|
-
|
|
465
|
+
data = dataLines === 0 ? value : `${data}
|
|
466
|
+
${value}`, dataLines++;
|
|
389
467
|
break;
|
|
390
468
|
case "id":
|
|
391
|
-
|
|
469
|
+
value.includes("\x00") || (id = value);
|
|
392
470
|
break;
|
|
393
471
|
case "retry":
|
|
394
472
|
/^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(new ParseError(`Invalid \`retry\` value: "${value}"`, {
|
|
@@ -403,40 +481,31 @@ function createParser(callbacks) {
|
|
|
403
481
|
}
|
|
404
482
|
}
|
|
405
483
|
function dispatchEvent() {
|
|
406
|
-
|
|
484
|
+
dataLines > 0 && onEvent({
|
|
407
485
|
id,
|
|
408
|
-
event: eventType
|
|
409
|
-
data
|
|
410
|
-
|
|
411
|
-
}), id = undefined, data = "", eventType = "";
|
|
486
|
+
event: eventType,
|
|
487
|
+
data
|
|
488
|
+
}), id = undefined, data = "", dataLines = 0, eventType = undefined;
|
|
412
489
|
}
|
|
413
490
|
function reset(options = {}) {
|
|
414
|
-
|
|
491
|
+
if (options.consume && pendingFragments.length > 0) {
|
|
492
|
+
const incompleteLine = pendingFragments.join("");
|
|
493
|
+
parseLine(incompleteLine, 0, incompleteLine.length);
|
|
494
|
+
}
|
|
495
|
+
isFirstChunk = true, id = undefined, data = "", dataLines = 0, eventType = undefined, pendingFragments.length = 0, pendingFragmentsLength = 0, terminated = false;
|
|
415
496
|
}
|
|
416
497
|
return { feed, reset };
|
|
417
498
|
}
|
|
418
|
-
function
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
`, searchIndex);
|
|
424
|
-
let lineEnd = -1;
|
|
425
|
-
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
|
|
426
|
-
incompleteLine = chunk.slice(searchIndex);
|
|
427
|
-
break;
|
|
428
|
-
} else {
|
|
429
|
-
const line = chunk.slice(searchIndex, lineEnd);
|
|
430
|
-
lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
|
|
431
|
-
` && searchIndex++;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
return [lines, incompleteLine];
|
|
499
|
+
function isDataPrefix(chunk, i, firstCharCode) {
|
|
500
|
+
return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
|
|
501
|
+
}
|
|
502
|
+
function isEventPrefix(chunk, i, firstCharCode) {
|
|
503
|
+
return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
|
|
435
504
|
}
|
|
436
505
|
|
|
437
506
|
// node_modules/eventsource-parser/dist/stream.js
|
|
438
507
|
class EventSourceParserStream extends TransformStream {
|
|
439
|
-
constructor({ onError, onRetry, onComment } = {}) {
|
|
508
|
+
constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
|
|
440
509
|
let parser;
|
|
441
510
|
super({
|
|
442
511
|
start(controller) {
|
|
@@ -445,10 +514,11 @@ class EventSourceParserStream extends TransformStream {
|
|
|
445
514
|
controller.enqueue(event);
|
|
446
515
|
},
|
|
447
516
|
onError(error) {
|
|
448
|
-
onError
|
|
517
|
+
typeof onError == "function" && onError(error), (onError === "terminate" || error.type === "max-buffer-size-exceeded") && controller.error(error);
|
|
449
518
|
},
|
|
450
519
|
onRetry,
|
|
451
|
-
onComment
|
|
520
|
+
onComment,
|
|
521
|
+
maxBufferSize
|
|
452
522
|
});
|
|
453
523
|
},
|
|
454
524
|
transform(chunk) {
|
|
@@ -47,10 +47,10 @@ import {
|
|
|
47
47
|
checkDependencies2,
|
|
48
48
|
emitBuiltInIntegrationConnectedOnce2,
|
|
49
49
|
init_db3
|
|
50
|
-
} from "./cli-
|
|
50
|
+
} from "./cli-kxawjrxg.js";
|
|
51
51
|
import {
|
|
52
52
|
getChannelBlockReason2
|
|
53
|
-
} from "./cli-
|
|
53
|
+
} from "./cli-s53vp709.js";
|
|
54
54
|
import {
|
|
55
55
|
require_dist5,
|
|
56
56
|
require_axios,
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
import {
|
|
68
68
|
isTerminalTaskStatus,
|
|
69
69
|
init_types
|
|
70
|
-
} from "./cli-
|
|
70
|
+
} from "./cli-mz9afxxf.js";
|
|
71
71
|
import {
|
|
72
72
|
taskAttachmentDisplayUrl,
|
|
73
73
|
init_task_attachment_links
|
|
@@ -6240,7 +6240,7 @@ async function initOtel(serviceRole = process.env.AGENT_ROLE || "api") {
|
|
|
6240
6240
|
return;
|
|
6241
6241
|
initialized = true;
|
|
6242
6242
|
try {
|
|
6243
|
-
const impl = await import("./otel-impl-
|
|
6243
|
+
const impl = await import("./otel-impl-f36byzbd.js");
|
|
6244
6244
|
await impl.boot(serviceRole, {
|
|
6245
6245
|
exportConsoleLogs: serviceRole === "api" && isApiLogExportEnabled()
|
|
6246
6246
|
});
|
|
@@ -10085,17 +10085,17 @@ async function initSlackApp2() {
|
|
|
10085
10085
|
});
|
|
10086
10086
|
initialized2 = true;
|
|
10087
10087
|
app.use(slackInboundOutcomeMiddleware());
|
|
10088
|
-
const { registerMessageHandler } = await import("./handlers-
|
|
10089
|
-
const { registerCommandHandler } = await import("./commands-
|
|
10090
|
-
const { registerActionHandlers } = await import("./actions-
|
|
10091
|
-
const { registerWorkObjectHandlers } = await import("./work-objects-
|
|
10088
|
+
const { registerMessageHandler } = await import("./handlers-19xr6dnz.js");
|
|
10089
|
+
const { registerCommandHandler } = await import("./commands-t04rt2pc.js");
|
|
10090
|
+
const { registerActionHandlers } = await import("./actions-wv766ghf.js");
|
|
10091
|
+
const { registerWorkObjectHandlers } = await import("./work-objects-xz1a5rqk.js");
|
|
10092
10092
|
registerMessageHandler(app);
|
|
10093
10093
|
registerCommandHandler(app);
|
|
10094
10094
|
registerActionHandlers(app);
|
|
10095
10095
|
registerWorkObjectHandlers(app);
|
|
10096
|
-
const { createAssistant } = await import("./assistant-
|
|
10096
|
+
const { createAssistant } = await import("./assistant-3x8bz3eg.js");
|
|
10097
10097
|
app.assistant(createAssistant());
|
|
10098
|
-
const { isBlockExternalEnabled, scanExternalChannelsOnBoot } = await import("./external-channel-
|
|
10098
|
+
const { isBlockExternalEnabled, scanExternalChannelsOnBoot } = await import("./external-channel-j1e2p34p.js");
|
|
10099
10099
|
if (isBlockExternalEnabled()) {
|
|
10100
10100
|
scanExternalChannelsOnBoot(app.client).catch((error) => {
|
|
10101
10101
|
console.error("[Slack] External channel boot scan failed:", error);
|
|
@@ -10108,7 +10108,7 @@ async function startSlackApp2() {
|
|
|
10108
10108
|
await initSlackApp2();
|
|
10109
10109
|
}
|
|
10110
10110
|
if (app) {
|
|
10111
|
-
const { isSlackRenderV2Enabled } = await import("./render-v2-
|
|
10111
|
+
const { isSlackRenderV2Enabled } = await import("./render-v2-hgytz8nn.js");
|
|
10112
10112
|
if (isSlackRenderV2Enabled())
|
|
10113
10113
|
await ensureSlackRenderV2Activation2();
|
|
10114
10114
|
await app.start();
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
getPendingWaitsByEvent2,
|
|
23
23
|
resolveWaitState2,
|
|
24
24
|
init_db3
|
|
25
|
-
} from "./cli-
|
|
25
|
+
} from "./cli-kxawjrxg.js";
|
|
26
26
|
import {
|
|
27
27
|
BaseExecutor,
|
|
28
28
|
postApprovalCancellationUpdates,
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
findWorkflowReadinessProblems,
|
|
36
36
|
formatReadinessProblems,
|
|
37
37
|
startWorkflowExecution2,
|
|
38
|
+
ParentStepNotCurrentError,
|
|
38
39
|
failRunOnUnreadableReplay,
|
|
39
40
|
walkGraph,
|
|
40
41
|
hasRunningStep,
|
|
@@ -48,7 +49,7 @@ import {
|
|
|
48
49
|
stepFailureMode,
|
|
49
50
|
getNextTargets,
|
|
50
51
|
getSuccessors
|
|
51
|
-
} from "./cli-
|
|
52
|
+
} from "./cli-jjznk3f7.js";
|
|
52
53
|
import {
|
|
53
54
|
workflowEventBus2,
|
|
54
55
|
init_event_bus
|
|
@@ -57,7 +58,7 @@ import {
|
|
|
57
58
|
RetryPolicySchema,
|
|
58
59
|
SUPERSEDED_WORKFLOW_TASK_REASON,
|
|
59
60
|
init_types
|
|
60
|
-
} from "./cli-
|
|
61
|
+
} from "./cli-mz9afxxf.js";
|
|
61
62
|
import {
|
|
62
63
|
init_zod
|
|
63
64
|
} from "./cli-4chz1hye.js";
|
|
@@ -98,6 +99,7 @@ function shapeApprovalResolution(registry, definition, nodeId, parkedOutput, app
|
|
|
98
99
|
// src/workflows/resume.ts
|
|
99
100
|
init_db3();
|
|
100
101
|
init_workflow_runs();
|
|
102
|
+
init_types();
|
|
101
103
|
init_secret_scrubber();
|
|
102
104
|
init_event_bus();
|
|
103
105
|
|
|
@@ -120,7 +122,10 @@ function childRunOutcome(child) {
|
|
|
120
122
|
return null;
|
|
121
123
|
if (child.status !== "completed") {
|
|
122
124
|
const reason = child.error ? `: ${child.error}` : "";
|
|
123
|
-
return {
|
|
125
|
+
return {
|
|
126
|
+
error: `Child workflow run ${child.id} ${child.status}${reason}`,
|
|
127
|
+
retryable: child.status === "failed"
|
|
128
|
+
};
|
|
124
129
|
}
|
|
125
130
|
const outputs = {};
|
|
126
131
|
for (const [key, value] of Object.entries(child.context ?? {})) {
|
|
@@ -142,10 +147,11 @@ class SubWorkflowExecutor extends BaseExecutor {
|
|
|
142
147
|
}
|
|
143
148
|
async execute(config, _context, meta) {
|
|
144
149
|
const { db } = this.deps;
|
|
145
|
-
const
|
|
150
|
+
const attempt = (await db.getWorkflowRunStep(meta.stepId))?.retryCount ?? 0;
|
|
151
|
+
const existingId = await getChildWorkflowRunId(meta.stepId, attempt);
|
|
146
152
|
const existing = existingId ? await db.getWorkflowRun(existingId) : null;
|
|
147
153
|
if (existing)
|
|
148
|
-
return this.settle(existing);
|
|
154
|
+
return this.settle(existing, config.workflowId);
|
|
149
155
|
const lineage = await getWorkflowRunLineage(meta.runId, MAX_SUB_WORKFLOW_DEPTH);
|
|
150
156
|
if (lineage.length > MAX_SUB_WORKFLOW_DEPTH) {
|
|
151
157
|
return {
|
|
@@ -165,16 +171,30 @@ class SubWorkflowExecutor extends BaseExecutor {
|
|
|
165
171
|
if (!workflow.enabled) {
|
|
166
172
|
return { status: "failed", error: `Workflow ${config.workflowId} is disabled` };
|
|
167
173
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
174
|
+
let childRunId;
|
|
175
|
+
try {
|
|
176
|
+
childRunId = await startWorkflowExecution2(workflow, config.inputs ?? {}, this.registry, {
|
|
177
|
+
requestedByUserId: meta.requestedByUserId,
|
|
178
|
+
parentStepId: meta.stepId,
|
|
179
|
+
parentStepAttempt: attempt
|
|
180
|
+
});
|
|
181
|
+
} catch (err) {
|
|
182
|
+
if (err instanceof ParentStepNotCurrentError)
|
|
183
|
+
return { status: "failed", error: err.message };
|
|
184
|
+
throw err;
|
|
185
|
+
}
|
|
172
186
|
const child = await db.getWorkflowRun(childRunId);
|
|
173
187
|
if (!child)
|
|
174
188
|
return { status: "failed", error: `Child workflow run ${childRunId} not found` };
|
|
175
|
-
return this.settle(child);
|
|
189
|
+
return this.settle(child, config.workflowId);
|
|
176
190
|
}
|
|
177
|
-
settle(child) {
|
|
191
|
+
settle(child, workflowId) {
|
|
192
|
+
if (child.workflowId !== workflowId) {
|
|
193
|
+
return {
|
|
194
|
+
status: "failed",
|
|
195
|
+
error: `Child workflow run ${child.id} runs workflow ${child.workflowId}, not ${workflowId}`
|
|
196
|
+
};
|
|
197
|
+
}
|
|
178
198
|
const outcome = childRunOutcome(child);
|
|
179
199
|
if (!outcome) {
|
|
180
200
|
return {
|
|
@@ -184,8 +204,9 @@ class SubWorkflowExecutor extends BaseExecutor {
|
|
|
184
204
|
correlationId: child.id
|
|
185
205
|
};
|
|
186
206
|
}
|
|
187
|
-
if ("error" in outcome)
|
|
188
|
-
return { status: "failed", error: outcome.error };
|
|
207
|
+
if ("error" in outcome) {
|
|
208
|
+
return { status: "failed", error: outcome.error, retryable: outcome.retryable };
|
|
209
|
+
}
|
|
189
210
|
return { status: "success", output: outcome.output, nextPort: "success" };
|
|
190
211
|
}
|
|
191
212
|
}
|
|
@@ -1050,11 +1071,6 @@ async function resumeFromChildRun2(parentStepId, registry) {
|
|
|
1050
1071
|
const step = await getWorkflowRunStep2(parentStepId);
|
|
1051
1072
|
if (!step || step.status !== "waiting" || step.nodeType !== "sub-workflow")
|
|
1052
1073
|
return false;
|
|
1053
|
-
const childId = await getChildWorkflowRunId(parentStepId);
|
|
1054
|
-
const child = childId ? await getWorkflowRun2(childId) : null;
|
|
1055
|
-
const outcome = child ? childRunOutcome(child) : { error: `Child workflow run of step ${parentStepId} was deleted` };
|
|
1056
|
-
if (!outcome)
|
|
1057
|
-
return false;
|
|
1058
1074
|
let claimed = false;
|
|
1059
1075
|
await failClosedOnUnreadableReplay(step.runId, step.id, async () => {
|
|
1060
1076
|
const run = await getWorkflowRun2(step.runId);
|
|
@@ -1064,7 +1080,30 @@ async function resumeFromChildRun2(parentStepId, registry) {
|
|
|
1064
1080
|
if (!workflow)
|
|
1065
1081
|
return;
|
|
1066
1082
|
const ctx = run.context ?? {};
|
|
1067
|
-
const routing =
|
|
1083
|
+
const routing = await getDbClient2().transaction(async () => {
|
|
1084
|
+
const current = await getWorkflowRunStep2(step.id);
|
|
1085
|
+
if (!current || current.status !== "waiting")
|
|
1086
|
+
return null;
|
|
1087
|
+
const childId = await getChildWorkflowRunId(step.id, current.retryCount);
|
|
1088
|
+
const child = childId ? await getWorkflowRun2(childId) : null;
|
|
1089
|
+
const outcome = child ? childRunOutcome(child) : { error: `Child workflow run of step ${parentStepId} was deleted`, retryable: false };
|
|
1090
|
+
if (!outcome)
|
|
1091
|
+
return null;
|
|
1092
|
+
if ("error" in outcome && outcome.retryable) {
|
|
1093
|
+
const policy = childStepRetryPolicy(workflow.definition, step.nodeId);
|
|
1094
|
+
if (policy && current.retryCount < policy.maxRetries) {
|
|
1095
|
+
await checkpointStepFailure(run.id, step.id, outcome.error, current.retryCount, policy);
|
|
1096
|
+
return CHILD_RETRY_SCHEDULED;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
return "error" in outcome ? await failStepAndRunIfWaiting(workflow.definition, step.id, run.id, outcome.error, undefined, { ctx, registry }) : await checkpointPortStepAndResolveSuccessors(workflow.definition, run.id, step.id, step.nodeId, outcome.output, "success", ctx, registry);
|
|
1100
|
+
});
|
|
1101
|
+
if (!routing)
|
|
1102
|
+
return;
|
|
1103
|
+
if (routing === CHILD_RETRY_SCHEDULED) {
|
|
1104
|
+
claimed = true;
|
|
1105
|
+
return;
|
|
1106
|
+
}
|
|
1068
1107
|
if (!routing.claimed || routing.runFailed) {
|
|
1069
1108
|
claimed = routing.claimed;
|
|
1070
1109
|
return;
|
|
@@ -1079,6 +1118,18 @@ async function resumeFromChildRun2(parentStepId, registry) {
|
|
|
1079
1118
|
});
|
|
1080
1119
|
return claimed;
|
|
1081
1120
|
}
|
|
1121
|
+
var CHILD_RETRY_SCHEDULED = {
|
|
1122
|
+
claimed: true,
|
|
1123
|
+
runFailed: false,
|
|
1124
|
+
successors: []
|
|
1125
|
+
};
|
|
1126
|
+
function childStepRetryPolicy(def, nodeId) {
|
|
1127
|
+
const node = def.nodes.find((candidate) => candidate.id === nodeId);
|
|
1128
|
+
if (!node?.retry)
|
|
1129
|
+
return null;
|
|
1130
|
+
const parsed = RetryPolicySchema.safeParse(node.retry);
|
|
1131
|
+
return parsed.success ? parsed.data : null;
|
|
1132
|
+
}
|
|
1082
1133
|
var FIRED_PAYLOAD_BYTE_CAP = 64 * 1024;
|
|
1083
1134
|
function capPayload(payload) {
|
|
1084
1135
|
if (payload === undefined || payload === null)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runStopHookSessionSummarySubprocess
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-w1zwctj2.js";
|
|
4
4
|
import {
|
|
5
5
|
CONTEXT_FORMULA,
|
|
6
6
|
getContextWindowSize,
|
|
@@ -1236,7 +1236,7 @@ class ClaudeAdapter2 {
|
|
|
1236
1236
|
if (transport === "sdk" && isClaudeBridgeEffective(sourceEnv)) {
|
|
1237
1237
|
throw new Error("CLAUDE_TRANSPORT=sdk cannot run with an effective Claude Bridge configuration. Select CLI transport or disable the bridge.");
|
|
1238
1238
|
}
|
|
1239
|
-
const claudeSdk = transport === "sdk" ? await import("./claude-sdk-session-
|
|
1239
|
+
const claudeSdk = transport === "sdk" ? await import("./claude-sdk-session-fkbyk66x.js") : undefined;
|
|
1240
1240
|
claudeSdk?.validateClaudeSdkAdditionalArgs([
|
|
1241
1241
|
...claudeBinaryArgv.slice(1),
|
|
1242
1242
|
...config.additionalArgs ?? []
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getMostRecentTaskInThread2,
|
|
11
11
|
reactionName,
|
|
12
12
|
init_db3
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-kxawjrxg.js";
|
|
14
14
|
import {
|
|
15
15
|
TaskCreationBlockedError,
|
|
16
16
|
buildEffectiveText,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
extractTaskFromMessage,
|
|
24
24
|
extractSlackMessageText,
|
|
25
25
|
dispatchPre2
|
|
26
|
-
} from "./cli-
|
|
26
|
+
} from "./cli-aecdcr77.js";
|
|
27
27
|
import {
|
|
28
28
|
noteSlackInboundSideEffect,
|
|
29
29
|
ignoreSlackInbound,
|
|
@@ -34,14 +34,14 @@ import {
|
|
|
34
34
|
isSlackRenderV2Enabled2,
|
|
35
35
|
ensureSlackThreadTree2,
|
|
36
36
|
registerTreeMessage
|
|
37
|
-
} from "./cli-
|
|
37
|
+
} from "./cli-ce0ak9ms.js";
|
|
38
38
|
import {
|
|
39
39
|
isBlockExternalEnabled2,
|
|
40
40
|
invalidateChannelExternality2,
|
|
41
41
|
getChannelBlockReason2,
|
|
42
42
|
shouldBlockChannel2,
|
|
43
43
|
leaveExternalChannel2
|
|
44
|
-
} from "./cli-
|
|
44
|
+
} from "./cli-s53vp709.js";
|
|
45
45
|
import {
|
|
46
46
|
workflowEventBus2,
|
|
47
47
|
init_event_bus
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
enrichSlackUserEmail,
|
|
51
51
|
resolveSlackUserId,
|
|
52
52
|
rewriteSlackMentions
|
|
53
|
-
} from "./cli-
|
|
53
|
+
} from "./cli-25j01dpj.js";
|
|
54
54
|
import {
|
|
55
55
|
wasEventSeen,
|
|
56
56
|
requestSlackThreadSteering,
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
bufferThreadMessage,
|
|
59
59
|
getBufferMessageCount,
|
|
60
60
|
instantFlush
|
|
61
|
-
} from "./cli-
|
|
61
|
+
} from "./cli-qgf8emrn.js";
|
|
62
62
|
import {
|
|
63
63
|
resolveTemplate,
|
|
64
64
|
init_resolver
|