@desplega.ai/agent-swarm 2.5.2 → 2.5.4
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-ek38cwsv.js} +5 -5
- package/dist/{actions-6xx079d1.js → actions-92mepq03.js} +19 -19
- package/dist/{amp-adapter-8n6f0hz8.js → amp-adapter-9gaxg015.js} +4 -4
- package/dist/{app-ft6r6v23.js → app-ctn8gsgx.js} +3 -3
- package/dist/{assistant-vt2cyfzd.js → assistant-zyr5kz47.js} +21 -21
- package/dist/{boot-reembed-tgrfy27t.js → boot-reembed-dwzfttdr.js} +1 -1
- package/dist/{boot-reembed-r3e808ky.js → boot-reembed-w75maga2.js} +1 -1
- package/dist/{boot-scrub-sweep-masdwxkm.js → boot-scrub-sweep-e9kq43kf.js} +3 -3
- package/dist/{boot-seeds-0n82qc7q.js → boot-seeds-x28v3fhb.js} +4 -4
- package/dist/{claude-adapter-s7j47k06.js → claude-adapter-f0afqnne.js} +5 -5
- package/dist/{claude-managed-adapter-gt6pa35d.js → claude-managed-adapter-x81a7r65.js} +3 -3
- package/dist/{claude-managed-setup-3hzrgrnk.js → claude-managed-setup-bqzwjd9x.js} +2 -2
- package/dist/{claude-sdk-session-0zrdzyx2.js → claude-sdk-session-7b7whkaq.js} +9307 -9254
- package/dist/{cli-a5ebc95n.js → cli-0shx9j93.js} +16 -13
- package/dist/{cli-4qkg9968.js → cli-19202kew.js} +4 -4
- package/dist/{cli-cyfgxnvb.js → cli-1r5ad7j5.js} +19 -17
- package/dist/{cli-jmcjbjkt.js → cli-25n3mv5d.js} +9 -7
- package/dist/cli-2655k16q.js +140 -0
- package/dist/{cli-wadzapwb.js → cli-277c31dw.js} +1 -1
- package/dist/{cli-n6kmqngw.js → cli-4b2z6n0m.js} +29 -7
- package/dist/{cli-7ccf7akh.js → cli-5bnsc0e1.js} +9 -7
- package/dist/{cli-qrjv7t18.js → cli-621ce7kw.js} +1 -1
- package/dist/{cli-xzge46sj.js → cli-64mh9mf3.js} +20 -6
- package/dist/{cli-b6tnjdvx.js → cli-6a1xg1p7.js} +6 -2
- package/dist/{cli-ydg6ep51.js → cli-6n8axjv1.js} +1 -1
- package/dist/{cli-e91vshb1.js → cli-7p4jxgtt.js} +5 -5
- package/dist/{cli-f3pfn4x3.js → cli-9j129brq.js} +9 -3
- package/dist/{cli-xw9q173h.js → cli-9s05422w.js} +1 -1
- package/dist/{cli-15xd0j7w.js → cli-abs8ndtr.js} +12 -12
- package/dist/{cli-h5d22pfs.js → cli-asq5ydm4.js} +219 -309
- package/dist/{cli-w9etnnxk.js → cli-bf8ma3f1.js} +120 -50
- package/dist/{cli-0vgy5wfw.js → cli-bvpgr9ny.js} +2 -2
- package/dist/{cli-3e9vs93g.js → cli-c61mbdds.js} +4 -4
- package/dist/{cli-e5bxnjps.js → cli-c952c7ac.js} +5 -5
- package/dist/{cli-p859hcc8.js → cli-dew6x255.js} +1 -1
- package/dist/{cli-tx00c0h6.js → cli-dqygeeh5.js} +17 -1
- package/dist/{cli-gpv60278.js → cli-e42vss7b.js} +2 -2
- package/dist/{cli-b63d08rs.js → cli-eftzyh9y.js} +1 -1
- package/dist/{cli-fgn7yg5r.js → cli-ethgy7ha.js} +1 -1
- package/dist/{cli-86zpfje5.js → cli-ff1tm9n9.js} +1 -1
- package/dist/{cli-cf63dnxj.js → cli-g9vd9ece.js} +37 -12
- package/dist/{cli-j3dwd4kz.js → cli-gbfxp48k.js} +770 -126
- package/dist/{cli-n2918sed.js → cli-gn5af0x5.js} +21 -21
- package/dist/{cli-d172svcw.js → cli-gwhjmh8g.js} +4 -4
- package/dist/{cli-stxdrqs2.js → cli-hh5we352.js} +24 -5
- package/dist/{cli-0ebey9hg.js → cli-j6rktc91.js} +1 -1
- package/dist/{cli-csh8fnbg.js → cli-jb30dzvk.js} +473 -58
- package/dist/{cli-vaxw3bg0.js → cli-jbnn4vxb.js} +3 -3
- package/dist/{cli-ha22h0eg.js → cli-k4tjsdx9.js} +45 -40
- package/dist/{cli-f55b6ky0.js → cli-m4ecdxvz.js} +40 -13
- package/dist/{cli-mntxtkhn.js → cli-mz9afxxf.js} +2 -1
- package/dist/{cli-ta8bd7th.js → cli-pzatvw94.js} +1 -1
- package/dist/{cli-3qv8naq8.js → cli-rr7zx19j.js} +1591 -353
- package/dist/{cli-b1tv22wr.js → cli-s682zgqz.js} +1 -1
- package/dist/{cli-bpbcpd8b.js → cli-sbwsxvtd.js} +1 -1
- package/dist/{cli-0xk505e8.js → cli-sxgtf5fw.js} +1 -1
- package/dist/{cli-6y43v79h.js → cli-tsma7p8v.js} +1 -1
- package/dist/{cli-edtm741g.js → cli-wghjkr0e.js} +5 -5
- package/dist/{cli-aaqnqpyw.js → cli-wx2nj19m.js} +30 -11
- package/dist/{cli-y3dzwyy3.js → cli-x0f2v69c.js} +180 -60
- package/dist/{cli-kcnwn85g.js → cli-xtrz6bzs.js} +7 -7
- package/dist/{cli-14v1sxxy.js → cli-xzfq4at3.js} +7 -7
- package/dist/cli.js +20 -20
- package/dist/{codex-adapter-brh2tcxr.js → codex-adapter-wch12q99.js} +3 -3
- package/dist/{codex-hook-e2he7aca.js → codex-hook-brpnycn5.js} +1 -1
- package/dist/{codex-session-runner-0dnj21qs.js → codex-session-runner-41pfcr95.js} +2 -2
- package/dist/{commands-1cnvseqx.js → commands-9849dkj6.js} +2 -2
- package/dist/{controller-kc7s9xhn.js → controller-ja0sd95p.js} +29 -3
- package/dist/{controllers-connect-jzx7t4bn.js → controllers-connect-xp05dj6x.js} +20 -20
- package/dist/{cursor-adapter-qpwp5sfg.js → cursor-adapter-623qxqew.js} +1 -2
- package/dist/{db-4vq88jkc.js → db-47vj40dy.js} +3 -3
- package/dist/{db-v5ytg5pw.js → db-w759qmx0.js} +2 -2
- package/dist/{dispatcher-trtcrqae.js → dispatcher-7b8e4z2j.js} +17 -17
- package/dist/{docker-nfy2gc8t.js → docker-s84hjs91.js} +2 -2
- package/dist/{dsh-adapter-f20xwn1z.js → dsh-adapter-2ezw3xea.js} +2 -3
- package/dist/{external-channel-n9bymc2n.js → external-channel-e2s028da.js} +2 -2
- package/dist/{grok-adapter-4kpmmnr6.js → grok-adapter-ys7gaqee.js} +6 -6
- package/dist/{handlers-ptsraqa8.js → handlers-wy1dr6ja.js} +20 -20
- package/dist/{heartbeat-60qtxtjf.js → heartbeat-w3mntghj.js} +20 -20
- package/dist/{hook-rbktcstg.js → hook-3jjywnpb.js} +9 -3
- package/dist/{hook-ngtvh729.js → hook-g7kvv6x9.js} +3 -2
- package/dist/{http-z8xy72gp.js → http-tkp7d4kb.js} +2984 -2483
- package/dist/{index-r70q0xjx.js → index-1ef1myq2.js} +17 -17
- package/dist/{index-a9nsavhx.js → index-3n8m9ea2.js} +1 -1
- package/dist/{index-cbxkmfc5.js → index-9pn1pfkf.js} +1 -1
- package/dist/{index-s193j5fh.js → index-nmm79qgr.js} +20 -20
- package/dist/{index-6srwvd5b.js → index-p4xfz37z.js} +1 -1
- package/dist/{index-06qkmcx6.js → index-q7m26kvs.js} +33 -23
- package/dist/{index-1cscynkb.js → index-xdaahthb.js} +17 -17
- package/dist/{keepalive-a9srcphj.js → keepalive-v4ta8wgg.js} +3 -3
- package/dist/{lead-3devneqy.js → lead-sawnyqxk.js} +35 -35
- package/dist/{maintenance-0er16h2y.js → maintenance-84n1ex21.js} +1 -1
- package/dist/{oauth-refresh-sweep-b65jcyw2.js → oauth-refresh-sweep-vjnnandw.js} +2 -2
- package/dist/{onboard-wqywz5py.js → onboard-sfmpe4np.js} +2 -2
- package/dist/{opencode-adapter-e56086m1.js → opencode-adapter-jmpst4q4.js} +4 -4
- package/dist/{otel-impl-vk32s884.js → otel-impl-v6cc0zve.js} +1 -1
- package/dist/{pi-mono-adapter-tzps8f38.js → pi-mono-adapter-fk8fkcf6.js} +33 -6
- package/dist/{pricing-refresh-t27anv4z.js → pricing-refresh-fsk1e1zc.js} +3 -3
- package/dist/{rbac-roles-452665y0.js → rbac-roles-prmkdnkw.js} +2 -2
- package/dist/{rbac-roles-bmcgsxjn.js → rbac-roles-zxmxqa39.js} +1 -1
- package/dist/{render-v2-0ttsk2j4.js → render-v2-pjwxvnkw.js} +3 -3
- package/dist/{resume-a26kvr41.js → resume-frdtgfa0.js} +9 -5
- package/dist/{session-access-dgh9nkwk.js → session-access-fpez4y5q.js} +4 -4
- package/dist/{setup-9vc9qahm.js → setup-mq6m3m8q.js} +1 -1
- package/dist/{work-objects-vn8nkxwn.js → work-objects-kfahhjsq.js} +20 -20
- package/dist/{worker-1x1h8vnm.js → worker-v5e5rxj3.js} +35 -35
- package/openapi.json +3078 -2424
- package/package.json +7 -7
- package/plugin/commands/create-pr.md +2 -2
- package/plugin/pi-skills/create-pr/SKILL.md +2 -2
- package/src/be/approval-config-question.ts +389 -0
- package/src/be/automation-preflight.ts +37 -3
- package/src/be/db/approvals.ts +48 -0
- 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/tasks/write.ts +15 -5
- package/src/be/db/workflow-idempotency.ts +183 -0
- package/src/be/db/workflow-runs.ts +366 -8
- package/src/be/db.ts +92 -22
- 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/migrations/242_workflow_idempotency_keys.sql +40 -0
- package/src/be/sealed-json.ts +1 -0
- package/src/be/seed-scripts/catalog/compound-insights.inline.ts +2 -2
- package/src/be/seed-scripts/catalog/compound-insights.ts +2 -2
- package/src/be/seed-skills/bundled-files.generated.json +1 -1
- package/src/be/sql-connections.ts +7 -1
- package/src/be/swarm-config-guard.ts +25 -0
- package/src/be/users.ts +9 -0
- package/src/commands/controller.ts +33 -0
- package/src/commands/runner.ts +6 -2
- package/src/extensions/apply-task-create.ts +57 -11
- package/src/extensions/catalog.generated.json +4 -4
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/extensions/contract.ts +25 -0
- package/src/extensions/dispatcher.ts +4 -0
- package/src/extensions/post-bridge.ts +8 -0
- package/src/hooks/context-bound-note.ts +196 -0
- package/src/hooks/hook.ts +12 -0
- package/src/http/approval-requests.ts +209 -38
- package/src/http/config.ts +70 -53
- package/src/http/idempotency-key.ts +117 -0
- package/src/http/sessions.ts +27 -2
- package/src/http/workflows.ts +129 -24
- package/src/integrations/chat-sdk/inbound.ts +5 -4
- package/src/prompts/context-bound-note.ts +48 -0
- package/src/prompts/session-templates.ts +25 -1
- package/src/providers/amp-adapter.ts +30 -8
- package/src/providers/claude-adapter.ts +29 -4
- package/src/providers/claude-managed-adapter.ts +26 -0
- package/src/providers/claude-sdk-session.ts +10 -0
- package/src/providers/claude-session-events.ts +13 -0
- package/src/providers/codex-adapter.ts +12 -0
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/providers/opencode-adapter.ts +18 -0
- package/src/providers/pi-mono-adapter.ts +35 -0
- package/src/runtime-providers/docker.ts +6 -2
- package/src/scripts-runtime/types/swarm-extension.d.ts +35 -0
- package/src/tests/amp-adapter.test.ts +97 -0
- package/src/tests/approval-config-question.test.ts +702 -0
- package/src/tests/approval-requests.test.ts +10 -7
- package/src/tests/approval-sweeps.test.ts +12 -6
- package/src/tests/base-prompt.test.ts +1 -1
- package/src/tests/chat-sdk-inbound.test.ts +20 -0
- package/src/tests/claude-hook-output.test.ts +79 -1
- package/src/tests/claude-managed-adapter.test.ts +275 -0
- package/src/tests/codex-adapter.test.ts +163 -0
- package/src/tests/context-bound-note.test.ts +269 -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/extensions-pre-task.test.ts +273 -0
- package/src/tests/fetch-resolved-env.test.ts +17 -0
- package/src/tests/fixtures/extensions/record-blocks/hooks.ts +10 -0
- package/src/tests/fixtures/extensions/record-blocks/manifest.json +7 -0
- package/src/tests/fixtures/fake-amp.ts +22 -8
- package/src/tests/fixtures/held-template-render.ts +42 -0
- package/src/tests/fixtures/workflow-idempotency-trigger.child.ts +73 -0
- 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/openapi-route-headers.test.ts +2 -0
- package/src/tests/opencode-adapter.test.ts +134 -0
- package/src/tests/pi-mono-adapter.test.ts +105 -0
- package/src/tests/prompt-template-session.test.ts +4 -3
- package/src/tests/runner-push-delivery.test.ts +25 -0
- package/src/tests/runtime-controller-liveness.test.ts +133 -0
- package/src/tests/runtime-providers-docker.test.ts +2 -0
- package/src/tests/script-connections.test.ts +9 -0
- package/src/tests/script-run-config-scope.test.ts +91 -3
- package/src/tests/session-logs.test.ts +70 -0
- package/src/tests/sessions-tree.test.ts +205 -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-cascade-cancel.test.ts +1169 -0
- package/src/tests/workflow-foreach-supersede-retry.test.ts +488 -0
- package/src/tests/workflow-idempotency.test.ts +915 -0
- package/src/tests/workflow-sub-workflow.test.ts +538 -1
- package/src/tools/request-human-input.ts +27 -5
- package/src/tools/workflows/cancel-workflow-run.ts +1 -1
- package/src/types.ts +7 -0
- package/src/utils/context-window.ts +8 -6
- package/src/workflows/approval-cancel.ts +15 -13
- package/src/workflows/approval-notifications.ts +15 -4
- package/src/workflows/checkpoint.ts +72 -35
- package/src/workflows/engine.ts +262 -93
- package/src/workflows/executors/base.ts +6 -0
- package/src/workflows/executors/foreach.ts +2 -2
- package/src/workflows/executors/human-in-the-loop.ts +25 -1
- package/src/workflows/executors/sub-workflow.ts +45 -16
- package/src/workflows/foreach-driver.ts +10 -3
- package/src/workflows/foreach-join.ts +29 -6
- package/src/workflows/recovery.ts +68 -1
- package/src/workflows/resume.ts +228 -77
- package/src/workflows/retry-poller.ts +74 -7
- package/src/workflows/task-step-routing.ts +29 -7
- package/templates/ai-toolbox.manifest.json +8 -8
- package/templates/community/open-prompt-showreel/PLAYBOOK.md +5 -6
- package/templates/community/open-prompt-showreel/lead-prompt.md +1 -1
- package/templates/community/open-prompt-showreel/skills/open-prompt-showreel/SKILL.md +4 -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/agent-browser/SKILL.md +4 -4
- package/templates/skills/agent-browser/content.md +4 -4
- package/templates/skills/code-quality/config.json +1 -1
- package/templates/skills/code-quality/content.md +2 -2
- package/templates/skills/delegate-work/content.md +29 -25
- package/templates/skills/delegate-work/files/scripts/codex-exec.sh +5 -5
- package/templates/skills/qa/content.md +2 -2
- package/templates/skills/researching/content.md +2 -0
- package/templates/skills/turso-interaction/content.md +1 -1
- package/templates/skills/work-on-task/SKILL.md +1 -1
- package/templates/skills/work-on-task/content.md +1 -1
- package/templates/skills/workflow-iterate/content.md +8 -1
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
init_steering,
|
|
11
11
|
createLogEntry2,
|
|
12
12
|
init_db3
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-jb30dzvk.js";
|
|
14
14
|
import {
|
|
15
15
|
ackSlackMessage,
|
|
16
16
|
buildBufferFlushBlocks,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
ensureSlackThreadTree2,
|
|
21
21
|
registerTreeMessage,
|
|
22
22
|
getSlackApp2
|
|
23
|
-
} from "./cli-
|
|
23
|
+
} from "./cli-abs8ndtr.js";
|
|
24
24
|
import {
|
|
25
25
|
createAdditiveBuffer,
|
|
26
26
|
TaskCreationBlockedError,
|
|
@@ -30,15 +30,15 @@ import {
|
|
|
30
30
|
createSlackTaskWithFiles,
|
|
31
31
|
notifySlackFileFailures,
|
|
32
32
|
extractSlackMessageText
|
|
33
|
-
} from "./cli-
|
|
33
|
+
} from "./cli-asq5ydm4.js";
|
|
34
34
|
import {
|
|
35
35
|
resolveSlackUserId,
|
|
36
36
|
rewriteSlackMentions
|
|
37
|
-
} from "./cli-
|
|
37
|
+
} from "./cli-jbnn4vxb.js";
|
|
38
38
|
import {
|
|
39
39
|
findUserByExternalId,
|
|
40
40
|
init_users
|
|
41
|
-
} from "./cli-
|
|
41
|
+
} from "./cli-6a1xg1p7.js";
|
|
42
42
|
import {
|
|
43
43
|
isSteeringEnabled2,
|
|
44
44
|
init_steering_enabled
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
contextBoundNoteThreshold,
|
|
3
|
+
createContextBoundNote
|
|
4
|
+
} from "./cli-2655k16q.js";
|
|
1
5
|
import {
|
|
2
6
|
ampBillsCacheWrites,
|
|
3
7
|
resolveAmpModel
|
|
4
|
-
} from "./cli-
|
|
5
|
-
import {
|
|
6
|
-
CONTEXT_FORMULA,
|
|
7
|
-
computeContextUsedUnified,
|
|
8
|
-
clampContextPercent
|
|
9
|
-
} from "./cli-a5ebc95n.js";
|
|
8
|
+
} from "./cli-9s05422w.js";
|
|
10
9
|
import {
|
|
11
10
|
swarmRuntimeInstanceId
|
|
12
11
|
} from "./cli-e8xyjvfc.js";
|
|
@@ -24,6 +23,12 @@ import {
|
|
|
24
23
|
import {
|
|
25
24
|
applyReasoningEffort
|
|
26
25
|
} from "./cli-bn0rewsy.js";
|
|
26
|
+
import {
|
|
27
|
+
CONTEXT_FORMULA,
|
|
28
|
+
computeContextUsedUnified,
|
|
29
|
+
clampContextPercent,
|
|
30
|
+
init_context_window
|
|
31
|
+
} from "./cli-0shx9j93.js";
|
|
27
32
|
import {
|
|
28
33
|
scrubSecrets,
|
|
29
34
|
registerVolatileSecret,
|
|
@@ -35,8 +40,9 @@ import { existsSync, readFileSync, renameSync, rmSync, writeFileSync } from "nod
|
|
|
35
40
|
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
36
41
|
import { tmpdir } from "node:os";
|
|
37
42
|
import { join } from "node:path";
|
|
43
|
+
init_context_window();
|
|
38
44
|
init_secret_scrubber();
|
|
39
|
-
var AMP_PACKAGE = "@ampcode/cli@0.0.
|
|
45
|
+
var AMP_PACKAGE = "@ampcode/cli@0.0.1792844927-g360c96";
|
|
40
46
|
var AMP_MCP_SERVER_NAME = "agent-swarm";
|
|
41
47
|
var AMP_PLUGIN_MODE_KEY = "agent-swarm";
|
|
42
48
|
var AMP_LIVE_TEST_TIMEOUT_MS = 5000;
|
|
@@ -322,6 +328,7 @@ class AmpSession {
|
|
|
322
328
|
captures = [];
|
|
323
329
|
steeringSeq = 0;
|
|
324
330
|
steers = new Map;
|
|
331
|
+
observeContextBound;
|
|
325
332
|
constructor(proc, directory, prompt, run) {
|
|
326
333
|
this.proc = proc;
|
|
327
334
|
this.directory = directory;
|
|
@@ -353,6 +360,12 @@ class AmpSession {
|
|
|
353
360
|
});
|
|
354
361
|
}
|
|
355
362
|
};
|
|
363
|
+
this.observeContextBound = createContextBoundNote({
|
|
364
|
+
threshold: contextBoundNoteThreshold(run.env),
|
|
365
|
+
model: () => run.selection.pin,
|
|
366
|
+
canDeliver: () => !this.inputClosed && !this.aborted,
|
|
367
|
+
inject: (note) => this.queueSteering(note, true)
|
|
368
|
+
});
|
|
356
369
|
this.completion = this.runSession(prompt);
|
|
357
370
|
}
|
|
358
371
|
onEvent(listener) {
|
|
@@ -375,13 +388,13 @@ class AmpSession {
|
|
|
375
388
|
await this.stdin.write(userMessage(text));
|
|
376
389
|
await this.stdin.flush?.();
|
|
377
390
|
}
|
|
378
|
-
queueSteering(text) {
|
|
391
|
+
queueSteering(text, internal = false) {
|
|
379
392
|
const name = `${String(++this.steeringSeq).padStart(6, "0")}.json`;
|
|
380
393
|
const temp = join(this.run.steeringInbox, `.${name}.tmp`);
|
|
381
394
|
writeFileSync(temp, JSON.stringify(text), { mode: 384 });
|
|
382
395
|
renameSync(temp, join(this.run.steeringInbox, name));
|
|
383
396
|
return new Promise((resolve) => {
|
|
384
|
-
this.steers.set(name, { text, via: "inbox", resolve });
|
|
397
|
+
this.steers.set(name, { text, via: "inbox", internal, resolve });
|
|
385
398
|
});
|
|
386
399
|
}
|
|
387
400
|
inboxPath(name, suffix = "") {
|
|
@@ -446,7 +459,7 @@ class AmpSession {
|
|
|
446
459
|
continue;
|
|
447
460
|
}
|
|
448
461
|
steer.via = "stdin";
|
|
449
|
-
taken.push({ name, text: steer.text });
|
|
462
|
+
taken.push({ name, text: steer.text, internal: steer.internal });
|
|
450
463
|
}
|
|
451
464
|
return taken;
|
|
452
465
|
}
|
|
@@ -482,7 +495,11 @@ class AmpSession {
|
|
|
482
495
|
onTurnEnd() {
|
|
483
496
|
if (this.inputClosed)
|
|
484
497
|
return;
|
|
485
|
-
for (const { name, text } of this.takeSteering()) {
|
|
498
|
+
for (const { name, text, internal } of this.takeSteering()) {
|
|
499
|
+
if (internal) {
|
|
500
|
+
this.settleSteer(name, { delivered: false, reason: "no tool result carried the note" });
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
486
503
|
this.writeInput(text).catch((error) => {
|
|
487
504
|
this.settleSteer(name, {
|
|
488
505
|
delivered: false,
|
|
@@ -581,6 +598,8 @@ class AmpSession {
|
|
|
581
598
|
});
|
|
582
599
|
if (used > 0)
|
|
583
600
|
this.emitContext(used, output, null);
|
|
601
|
+
if (topLevel && calledTool)
|
|
602
|
+
this.observeContextBound(input + cacheRead + cacheCreation);
|
|
584
603
|
}
|
|
585
604
|
if (topLevel && !calledTool && message.stop_reason !== "tool_use")
|
|
586
605
|
this.onTurnEnd();
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDbClient2,
|
|
3
|
+
listUndeliveredCancelledApprovalRequestIds,
|
|
4
|
+
init_approvals,
|
|
3
5
|
getTaskById2,
|
|
4
6
|
cancelTask2,
|
|
7
|
+
getRunLineageBlock,
|
|
8
|
+
getWorkflowRunTreeIds,
|
|
9
|
+
getWorkflowRunStatus,
|
|
10
|
+
getOpenWorkflowTreeTaskIds,
|
|
11
|
+
getTaskIdsWithDependents,
|
|
12
|
+
workflowRunTreeHasOpenWork,
|
|
13
|
+
cancelOpenWorkflowTreeSteps,
|
|
14
|
+
disarmWorkflowTreeRetries,
|
|
15
|
+
cancelLiveWorkflowTreeRuns,
|
|
5
16
|
getChildWorkflowRunId,
|
|
6
17
|
getWorkflowRunLineage,
|
|
7
18
|
createForeachAttemptSteps,
|
|
@@ -15,14 +26,14 @@ import {
|
|
|
15
26
|
getCompletedStepNodeIds2,
|
|
16
27
|
getTaskByWorkflowRunStepId2,
|
|
17
28
|
detachTaskFromWorkflowRunStep2,
|
|
29
|
+
getApprovalRequestById2,
|
|
18
30
|
cancelPendingApprovalRequestsForRun2,
|
|
19
|
-
listCancelledApprovalRequestsForRun2,
|
|
20
31
|
getWaitStateById2,
|
|
21
32
|
getPendingEventWaitNames2,
|
|
22
33
|
getPendingWaitsByEvent2,
|
|
23
34
|
resolveWaitState2,
|
|
24
35
|
init_db3
|
|
25
|
-
} from "./cli-
|
|
36
|
+
} from "./cli-jb30dzvk.js";
|
|
26
37
|
import {
|
|
27
38
|
BaseExecutor,
|
|
28
39
|
postApprovalCancellationUpdates,
|
|
@@ -35,12 +46,14 @@ import {
|
|
|
35
46
|
findWorkflowReadinessProblems,
|
|
36
47
|
formatReadinessProblems,
|
|
37
48
|
startWorkflowExecution2,
|
|
49
|
+
ParentStepNotCurrentError,
|
|
38
50
|
failRunOnUnreadableReplay,
|
|
39
51
|
walkGraph,
|
|
40
52
|
hasRunningStep,
|
|
41
53
|
findReadyNodes,
|
|
42
54
|
startForeachDrive,
|
|
43
55
|
FOREACH_TERMINAL_STEP_STATUSES,
|
|
56
|
+
isRetryPending,
|
|
44
57
|
parseSyntheticNodeId,
|
|
45
58
|
resolveForeachParent,
|
|
46
59
|
settleForeachChild,
|
|
@@ -48,7 +61,7 @@ import {
|
|
|
48
61
|
stepFailureMode,
|
|
49
62
|
getNextTargets,
|
|
50
63
|
getSuccessors
|
|
51
|
-
} from "./cli-
|
|
64
|
+
} from "./cli-gbfxp48k.js";
|
|
52
65
|
import {
|
|
53
66
|
workflowEventBus2,
|
|
54
67
|
init_event_bus
|
|
@@ -57,7 +70,7 @@ import {
|
|
|
57
70
|
RetryPolicySchema,
|
|
58
71
|
SUPERSEDED_WORKFLOW_TASK_REASON,
|
|
59
72
|
init_types
|
|
60
|
-
} from "./cli-
|
|
73
|
+
} from "./cli-mz9afxxf.js";
|
|
61
74
|
import {
|
|
62
75
|
init_zod
|
|
63
76
|
} from "./cli-4chz1hye.js";
|
|
@@ -97,7 +110,9 @@ function shapeApprovalResolution(registry, definition, nodeId, parkedOutput, app
|
|
|
97
110
|
|
|
98
111
|
// src/workflows/resume.ts
|
|
99
112
|
init_db3();
|
|
113
|
+
init_approvals();
|
|
100
114
|
init_workflow_runs();
|
|
115
|
+
init_types();
|
|
101
116
|
init_secret_scrubber();
|
|
102
117
|
init_event_bus();
|
|
103
118
|
|
|
@@ -120,7 +135,10 @@ function childRunOutcome(child) {
|
|
|
120
135
|
return null;
|
|
121
136
|
if (child.status !== "completed") {
|
|
122
137
|
const reason = child.error ? `: ${child.error}` : "";
|
|
123
|
-
return {
|
|
138
|
+
return {
|
|
139
|
+
error: `Child workflow run ${child.id} ${child.status}${reason}`,
|
|
140
|
+
retryable: child.status === "failed"
|
|
141
|
+
};
|
|
124
142
|
}
|
|
125
143
|
const outputs = {};
|
|
126
144
|
for (const [key, value] of Object.entries(child.context ?? {})) {
|
|
@@ -142,10 +160,11 @@ class SubWorkflowExecutor extends BaseExecutor {
|
|
|
142
160
|
}
|
|
143
161
|
async execute(config, _context, meta) {
|
|
144
162
|
const { db } = this.deps;
|
|
145
|
-
const
|
|
163
|
+
const attempt = (await db.getWorkflowRunStep(meta.stepId))?.retryCount ?? 0;
|
|
164
|
+
const existingId = await getChildWorkflowRunId(meta.stepId, attempt);
|
|
146
165
|
const existing = existingId ? await db.getWorkflowRun(existingId) : null;
|
|
147
166
|
if (existing)
|
|
148
|
-
return this.settle(existing);
|
|
167
|
+
return this.settle(existing, config.workflowId);
|
|
149
168
|
const lineage = await getWorkflowRunLineage(meta.runId, MAX_SUB_WORKFLOW_DEPTH);
|
|
150
169
|
if (lineage.length > MAX_SUB_WORKFLOW_DEPTH) {
|
|
151
170
|
return {
|
|
@@ -165,16 +184,30 @@ class SubWorkflowExecutor extends BaseExecutor {
|
|
|
165
184
|
if (!workflow.enabled) {
|
|
166
185
|
return { status: "failed", error: `Workflow ${config.workflowId} is disabled` };
|
|
167
186
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
187
|
+
let childRunId;
|
|
188
|
+
try {
|
|
189
|
+
childRunId = await startWorkflowExecution2(workflow, config.inputs ?? {}, this.registry, {
|
|
190
|
+
requestedByUserId: meta.requestedByUserId,
|
|
191
|
+
parentStepId: meta.stepId,
|
|
192
|
+
parentStepAttempt: attempt
|
|
193
|
+
});
|
|
194
|
+
} catch (err) {
|
|
195
|
+
if (err instanceof ParentStepNotCurrentError)
|
|
196
|
+
return { status: "failed", error: err.message };
|
|
197
|
+
throw err;
|
|
198
|
+
}
|
|
172
199
|
const child = await db.getWorkflowRun(childRunId);
|
|
173
200
|
if (!child)
|
|
174
201
|
return { status: "failed", error: `Child workflow run ${childRunId} not found` };
|
|
175
|
-
return this.settle(child);
|
|
202
|
+
return this.settle(child, config.workflowId);
|
|
176
203
|
}
|
|
177
|
-
settle(child) {
|
|
204
|
+
settle(child, workflowId) {
|
|
205
|
+
if (child.workflowId !== workflowId) {
|
|
206
|
+
return {
|
|
207
|
+
status: "failed",
|
|
208
|
+
error: `Child workflow run ${child.id} runs workflow ${child.workflowId}, not ${workflowId}`
|
|
209
|
+
};
|
|
210
|
+
}
|
|
178
211
|
const outcome = childRunOutcome(child);
|
|
179
212
|
if (!outcome) {
|
|
180
213
|
return {
|
|
@@ -184,8 +217,9 @@ class SubWorkflowExecutor extends BaseExecutor {
|
|
|
184
217
|
correlationId: child.id
|
|
185
218
|
};
|
|
186
219
|
}
|
|
187
|
-
if ("error" in outcome)
|
|
188
|
-
return { status: "failed", error: outcome.error };
|
|
220
|
+
if ("error" in outcome) {
|
|
221
|
+
return { status: "failed", error: outcome.error, retryable: outcome.retryable };
|
|
222
|
+
}
|
|
189
223
|
return { status: "success", output: outcome.output, nextPort: "success" };
|
|
190
224
|
}
|
|
191
225
|
}
|
|
@@ -469,6 +503,7 @@ function computeNextPort(mode, status) {
|
|
|
469
503
|
|
|
470
504
|
// src/workflows/task-step-routing.ts
|
|
471
505
|
init_db3();
|
|
506
|
+
init_workflow_runs();
|
|
472
507
|
init_types();
|
|
473
508
|
var UNCLAIMED = {
|
|
474
509
|
claimed: false,
|
|
@@ -526,6 +561,8 @@ async function checkpointPortStepAndResolveSuccessors(def, runId, stepId, nodeId
|
|
|
526
561
|
if (!run || run.status !== "waiting" && run.status !== "running") {
|
|
527
562
|
return UNCLAIMED;
|
|
528
563
|
}
|
|
564
|
+
if (await getRunLineageBlock(runId))
|
|
565
|
+
return UNCLAIMED;
|
|
529
566
|
if (resolveForeachParent(def, nodeId)) {
|
|
530
567
|
return toRoutingResult(await settleForeachChild(def, runId, stepId, { status: "completed", output, nextPort }, ctx, {
|
|
531
568
|
registry
|
|
@@ -549,12 +586,14 @@ var SUPERSEDE_RETRY_POLICY = {
|
|
|
549
586
|
maxDelayMs: 30000
|
|
550
587
|
};
|
|
551
588
|
async function scheduleTaskStepRetry(def, runId, step, taskId, reason) {
|
|
552
|
-
const
|
|
589
|
+
const foreachParent = resolveForeachParent(def, step.nodeId);
|
|
590
|
+
const node = resolveStepNode(def, step.nodeId);
|
|
553
591
|
if (!node || node.type !== "agent-task")
|
|
554
592
|
return "not-eligible";
|
|
593
|
+
const declaredRetry = foreachParent ? foreachParent.retry : node.retry;
|
|
555
594
|
let policy;
|
|
556
|
-
if (
|
|
557
|
-
const parsed = RetryPolicySchema.safeParse(
|
|
595
|
+
if (declaredRetry) {
|
|
596
|
+
const parsed = RetryPolicySchema.safeParse(declaredRetry);
|
|
558
597
|
if (!parsed.success)
|
|
559
598
|
return "not-eligible";
|
|
560
599
|
policy = parsed.data;
|
|
@@ -569,6 +608,13 @@ async function scheduleTaskStepRetry(def, runId, step, taskId, reason) {
|
|
|
569
608
|
return "not-claimed";
|
|
570
609
|
if (!await isTaskBoundToStep(taskId, step.id))
|
|
571
610
|
return "not-claimed";
|
|
611
|
+
if (foreachParent) {
|
|
612
|
+
const run = await getWorkflowRun2(runId);
|
|
613
|
+
if (run?.status !== "running" && run?.status !== "waiting")
|
|
614
|
+
return "not-eligible";
|
|
615
|
+
}
|
|
616
|
+
if (await getRunLineageBlock(runId))
|
|
617
|
+
return "not-claimed";
|
|
572
618
|
if (current.retryCount >= policy.maxRetries)
|
|
573
619
|
return "not-eligible";
|
|
574
620
|
await detachTaskFromWorkflowRunStep2(taskId);
|
|
@@ -589,6 +635,8 @@ async function completeTaskStepAndResolveSuccessors(def, runId, step, output, ct
|
|
|
589
635
|
return UNCLAIMED;
|
|
590
636
|
if (ownerTaskId && !await isTaskBoundToStep(ownerTaskId, step.id))
|
|
591
637
|
return UNCLAIMED;
|
|
638
|
+
if (await getRunLineageBlock(runId))
|
|
639
|
+
return UNCLAIMED;
|
|
592
640
|
if (resolveForeachParent(def, step.nodeId)) {
|
|
593
641
|
return toRoutingResult(await settleForeachChild(def, runId, step.id, {
|
|
594
642
|
status: "completed",
|
|
@@ -729,10 +777,14 @@ async function resumeFromTaskCompletionUnguarded(event, registry) {
|
|
|
729
777
|
}
|
|
730
778
|
async function finalizeOrWait2(runId) {
|
|
731
779
|
await getDbClient2().transaction(async () => {
|
|
780
|
+
const status = await getWorkflowRunStatus(runId);
|
|
781
|
+
if (status !== "running" && status !== "waiting")
|
|
782
|
+
return;
|
|
783
|
+
if (await getRunLineageBlock(runId))
|
|
784
|
+
return;
|
|
732
785
|
const steps = await getWorkflowRunStepsByRunId2(runId);
|
|
733
786
|
if (hasRunningStep(steps)) {
|
|
734
|
-
|
|
735
|
-
if (run?.status === "waiting")
|
|
787
|
+
if (status === "waiting")
|
|
736
788
|
await updateWorkflowRun2(runId, { status: "running" });
|
|
737
789
|
return;
|
|
738
790
|
}
|
|
@@ -851,6 +903,9 @@ async function retryFailedRun2(runId, registry) {
|
|
|
851
903
|
const current = await getWorkflowRun2(runId);
|
|
852
904
|
if (!current || current.status !== "failed")
|
|
853
905
|
return null;
|
|
906
|
+
const blocked = await getRunLineageBlock(runId);
|
|
907
|
+
if (blocked)
|
|
908
|
+
throw new Error(`Retry not started, run left failed: ${blocked}`);
|
|
854
909
|
const currentSteps = await getWorkflowRunStepsByRunId2(runId);
|
|
855
910
|
const attempts = foreachRetryAttempts(workflow.definition, [
|
|
856
911
|
...latestStepPerNode(currentSteps).values()
|
|
@@ -858,6 +913,11 @@ async function retryFailedRun2(runId, registry) {
|
|
|
858
913
|
const capError = foreachRetryCapError(currentSteps.length, attempts);
|
|
859
914
|
if (capError)
|
|
860
915
|
throw new Error(`Retry not started, run left failed: ${capError}`);
|
|
916
|
+
for (const step of currentSteps) {
|
|
917
|
+
if (isRetryPending(step) && resolveForeachParent(workflow.definition, step.nodeId)) {
|
|
918
|
+
await updateWorkflowRunStep2(step.id, { nextRetryAt: null });
|
|
919
|
+
}
|
|
920
|
+
}
|
|
861
921
|
if (!foreachParent) {
|
|
862
922
|
await updateWorkflowRunStep2(failedStep.id, {
|
|
863
923
|
status: shouldRetryFailedNode ? "pending" : "cancelled",
|
|
@@ -920,52 +980,80 @@ function foreachRetryCapError(existingSteps, attempts) {
|
|
|
920
980
|
return null;
|
|
921
981
|
return `foreach retry would reach ${maxSteps} total steps (WORKFLOW_MAX_STEPS_PER_RUN): ${existingSteps} existing + ${added} new attempts leaves no room for the retry walk`;
|
|
922
982
|
}
|
|
983
|
+
var TERMINAL_RUN_STATUSES = new Set(["completed", "failed", "cancelled", "skipped"]);
|
|
923
984
|
async function cancelWorkflowRunRows2(runId, cancelReason) {
|
|
924
|
-
const terminalStatuses = ["completed", "failed", "cancelled", "skipped"];
|
|
925
985
|
const now = new Date().toISOString();
|
|
986
|
+
const settledTree = await getDbClient2().transaction(async () => {
|
|
987
|
+
if (await getWorkflowRunStatus(runId) !== "cancelled")
|
|
988
|
+
return null;
|
|
989
|
+
const ids = await getWorkflowRunTreeIds(runId);
|
|
990
|
+
return await workflowRunTreeHasOpenWork(ids) ? null : ids;
|
|
991
|
+
}, { readOnly: true });
|
|
992
|
+
if (settledTree)
|
|
993
|
+
return { cancelled: false, runIds: settledTree };
|
|
926
994
|
return await getDbClient2().transaction(async () => {
|
|
927
|
-
const
|
|
928
|
-
if (!
|
|
929
|
-
return false;
|
|
930
|
-
const steps = await getWorkflowRunStepsByRunId2(runId);
|
|
931
|
-
for (const step of steps) {
|
|
932
|
-
if (terminalStatuses.includes(step.status))
|
|
933
|
-
continue;
|
|
934
|
-
const task = await getTaskByWorkflowRunStepId2(step.id);
|
|
935
|
-
if (task) {
|
|
936
|
-
await cancelTask2(task.id, cancelReason);
|
|
937
|
-
}
|
|
938
|
-
await updateWorkflowRunStep2(step.id, {
|
|
939
|
-
status: "cancelled",
|
|
940
|
-
error: cancelReason,
|
|
941
|
-
finishedAt: now
|
|
942
|
-
});
|
|
995
|
+
const rootStatus = await getWorkflowRunStatus(runId);
|
|
996
|
+
if (!rootStatus || TERMINAL_RUN_STATUSES.has(rootStatus) && rootStatus !== "cancelled") {
|
|
997
|
+
return { cancelled: false, runIds: [] };
|
|
943
998
|
}
|
|
944
|
-
await
|
|
945
|
-
await
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
}
|
|
950
|
-
|
|
999
|
+
const runIds = await getWorkflowRunTreeIds(runId);
|
|
1000
|
+
const openTaskIds = await getOpenWorkflowTreeTaskIds(runIds);
|
|
1001
|
+
const withDependents = openTaskIds.length > 0 ? await getTaskIdsWithDependents() : new Set;
|
|
1002
|
+
for (const taskId of openTaskIds) {
|
|
1003
|
+
await cancelTask2(taskId, cancelReason, { cascadeDependents: withDependents.has(taskId) });
|
|
1004
|
+
}
|
|
1005
|
+
await cancelOpenWorkflowTreeSteps(runIds, cancelReason, now);
|
|
1006
|
+
await disarmWorkflowTreeRetries(runIds, now);
|
|
1007
|
+
for (const id of runIds)
|
|
1008
|
+
await cancelPendingApprovalRequestsForRun2(id, cancelReason);
|
|
1009
|
+
await cancelLiveWorkflowTreeRuns(runIds.slice(1), cancelReason, now);
|
|
1010
|
+
if (rootStatus !== "cancelled") {
|
|
1011
|
+
await updateWorkflowRun2(runId, { status: "cancelled", error: cancelReason, finishedAt: now });
|
|
1012
|
+
}
|
|
1013
|
+
return { cancelled: rootStatus !== "cancelled", runIds };
|
|
951
1014
|
});
|
|
952
1015
|
}
|
|
953
|
-
|
|
954
|
-
|
|
1016
|
+
var inFlightCancels = new Map;
|
|
1017
|
+
function cancelWorkflowRun2(runId, reason) {
|
|
1018
|
+
const inFlight = inFlightCancels.get(runId);
|
|
1019
|
+
if (inFlight)
|
|
1020
|
+
return inFlight;
|
|
1021
|
+
const cancel = cancelWorkflowRunOnce(runId, reason).finally(() => {
|
|
1022
|
+
inFlightCancels.delete(runId);
|
|
1023
|
+
});
|
|
1024
|
+
inFlightCancels.set(runId, cancel);
|
|
1025
|
+
return cancel;
|
|
1026
|
+
}
|
|
1027
|
+
async function cancelWorkflowRunOnce(runId, reason) {
|
|
1028
|
+
const run = await getWorkflowRun2(runId, "display");
|
|
955
1029
|
if (!run)
|
|
956
1030
|
throw new Error("Workflow run not found");
|
|
957
|
-
|
|
958
|
-
if (terminalStatuses.includes(run.status) && run.status !== "cancelled") {
|
|
1031
|
+
if (TERMINAL_RUN_STATUSES.has(run.status) && run.status !== "cancelled") {
|
|
959
1032
|
throw new Error(`Cannot cancel run in '${run.status}' state`);
|
|
960
1033
|
}
|
|
961
1034
|
const cancelReason = reason ?? "Cancelled by user";
|
|
962
|
-
const
|
|
963
|
-
const
|
|
964
|
-
|
|
965
|
-
if (!applied && latestRun?.status !== "cancelled") {
|
|
1035
|
+
const { cancelled, runIds } = await cancelWorkflowRunRows2(runId, cancelReason);
|
|
1036
|
+
const latestRun = await getWorkflowRun2(runId, "display");
|
|
1037
|
+
if (!cancelled && latestRun?.status !== "cancelled") {
|
|
966
1038
|
throw new Error(`Cannot cancel run in '${latestRun?.status ?? "missing"}' state`);
|
|
967
1039
|
}
|
|
968
|
-
await
|
|
1040
|
+
await postTreeApprovalCancellations2(runIds, cancelled ? cancelReason : latestRun?.error ?? cancelReason);
|
|
1041
|
+
}
|
|
1042
|
+
async function postTreeApprovalCancellations2(runIds, reason, options = {}) {
|
|
1043
|
+
try {
|
|
1044
|
+
const approvals = [];
|
|
1045
|
+
for (const id of await listUndeliveredCancelledApprovalRequestIds(runIds)) {
|
|
1046
|
+
if (id === options.exceptRequestId)
|
|
1047
|
+
continue;
|
|
1048
|
+
const approval = await getApprovalRequestById2(id);
|
|
1049
|
+
if (approval)
|
|
1050
|
+
approvals.push(approval);
|
|
1051
|
+
}
|
|
1052
|
+
if (approvals.length > 0)
|
|
1053
|
+
await postApprovalCancellationUpdates(approvals, reason);
|
|
1054
|
+
} catch (err) {
|
|
1055
|
+
console.error("[workflows] approval cancellation updates not posted:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
1056
|
+
}
|
|
969
1057
|
}
|
|
970
1058
|
async function resumeFromApprovalResolution(event, registry) {
|
|
971
1059
|
await failClosedOnUnreadableReplay(event.workflowRunId, event.workflowRunStepId, () => resumeFromApprovalResolutionUnguarded(event, registry));
|
|
@@ -1050,11 +1138,6 @@ async function resumeFromChildRun2(parentStepId, registry) {
|
|
|
1050
1138
|
const step = await getWorkflowRunStep2(parentStepId);
|
|
1051
1139
|
if (!step || step.status !== "waiting" || step.nodeType !== "sub-workflow")
|
|
1052
1140
|
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
1141
|
let claimed = false;
|
|
1059
1142
|
await failClosedOnUnreadableReplay(step.runId, step.id, async () => {
|
|
1060
1143
|
const run = await getWorkflowRun2(step.runId);
|
|
@@ -1064,7 +1147,32 @@ async function resumeFromChildRun2(parentStepId, registry) {
|
|
|
1064
1147
|
if (!workflow)
|
|
1065
1148
|
return;
|
|
1066
1149
|
const ctx = run.context ?? {};
|
|
1067
|
-
const routing =
|
|
1150
|
+
const routing = await getDbClient2().transaction(async () => {
|
|
1151
|
+
const current = await getWorkflowRunStep2(step.id);
|
|
1152
|
+
if (!current || current.status !== "waiting")
|
|
1153
|
+
return null;
|
|
1154
|
+
if (await getRunLineageBlock(run.id))
|
|
1155
|
+
return null;
|
|
1156
|
+
const childId = await getChildWorkflowRunId(step.id, current.retryCount);
|
|
1157
|
+
const child = childId ? await getWorkflowRun2(childId) : null;
|
|
1158
|
+
const outcome = child ? childRunOutcome(child) : { error: `Child workflow run of step ${parentStepId} was deleted`, retryable: false };
|
|
1159
|
+
if (!outcome)
|
|
1160
|
+
return null;
|
|
1161
|
+
if ("error" in outcome && outcome.retryable) {
|
|
1162
|
+
const policy = childStepRetryPolicy(workflow.definition, step.nodeId);
|
|
1163
|
+
if (policy && current.retryCount < policy.maxRetries) {
|
|
1164
|
+
await checkpointStepFailure(run.id, step.id, outcome.error, current.retryCount, policy);
|
|
1165
|
+
return CHILD_RETRY_SCHEDULED;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
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);
|
|
1169
|
+
});
|
|
1170
|
+
if (!routing)
|
|
1171
|
+
return;
|
|
1172
|
+
if (routing === CHILD_RETRY_SCHEDULED) {
|
|
1173
|
+
claimed = true;
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1068
1176
|
if (!routing.claimed || routing.runFailed) {
|
|
1069
1177
|
claimed = routing.claimed;
|
|
1070
1178
|
return;
|
|
@@ -1079,6 +1187,18 @@ async function resumeFromChildRun2(parentStepId, registry) {
|
|
|
1079
1187
|
});
|
|
1080
1188
|
return claimed;
|
|
1081
1189
|
}
|
|
1190
|
+
var CHILD_RETRY_SCHEDULED = {
|
|
1191
|
+
claimed: true,
|
|
1192
|
+
runFailed: false,
|
|
1193
|
+
successors: []
|
|
1194
|
+
};
|
|
1195
|
+
function childStepRetryPolicy(def, nodeId) {
|
|
1196
|
+
const node = def.nodes.find((candidate) => candidate.id === nodeId);
|
|
1197
|
+
if (!node?.retry)
|
|
1198
|
+
return null;
|
|
1199
|
+
const parsed = RetryPolicySchema.safeParse(node.retry);
|
|
1200
|
+
return parsed.success ? parsed.data : null;
|
|
1201
|
+
}
|
|
1082
1202
|
var FIRED_PAYLOAD_BYTE_CAP = 64 * 1024;
|
|
1083
1203
|
function capPayload(payload) {
|
|
1084
1204
|
if (payload === undefined || payload === null)
|
|
@@ -1190,4 +1310,4 @@ function isPayloadInRun(payload, runId) {
|
|
|
1190
1310
|
const rec = payload;
|
|
1191
1311
|
return rec._runId === runId || rec.workflowRunId === runId;
|
|
1192
1312
|
}
|
|
1193
|
-
export { shapeApprovalResolution, SubWorkflowExecutor, WaitExecutor, failStepAndRunIfWaiting, checkpointPortStepAndResolveSuccessors, scheduleTaskStepRetry, completeTaskStepAndResolveSuccessors, setupWorkflowResumeListener2, finalizeOrWait2, retryFailedRun2, cancelWorkflowRunRows2, cancelWorkflowRun2, resumeWaitState2, recoverResolvedWaitState2, resumeFromChildRun2, initWaitBusSubscriptions2, subscribeWaitToBus2 };
|
|
1313
|
+
export { shapeApprovalResolution, SubWorkflowExecutor, WaitExecutor, failStepAndRunIfWaiting, checkpointPortStepAndResolveSuccessors, scheduleTaskStepRetry, completeTaskStepAndResolveSuccessors, setupWorkflowResumeListener2, finalizeOrWait2, retryFailedRun2, cancelWorkflowRunRows2, cancelWorkflowRun2, postTreeApprovalCancellations2, resumeWaitState2, recoverResolvedWaitState2, resumeFromChildRun2, initWaitBusSubscriptions2, subscribeWaitToBus2 };
|
|
@@ -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: "2.5.
|
|
10
|
+
version: "2.5.4",
|
|
11
11
|
description: "agent-swarm.dev — an open-source operating system for AI work: a lead agent breaks goals into tasks, routes them to specialized workers such as Claude Code or Codex, runs each worker in an isolated container, and preserves shared memory, tools, schedules, and review gates so delegated work compounds across sessions.",
|
|
12
12
|
keywords: [
|
|
13
13
|
"agent-swarm.dev",
|
|
@@ -61,7 +61,7 @@ var init_package = __esm(() => {
|
|
|
61
61
|
config: {
|
|
62
62
|
name: "agent-swarm"
|
|
63
63
|
},
|
|
64
|
-
packageManager: "bun@1.4.
|
|
64
|
+
packageManager: "bun@1.4.4",
|
|
65
65
|
workspaces: [
|
|
66
66
|
"apps/ui",
|
|
67
67
|
"apps/templates-ui",
|
|
@@ -187,8 +187,8 @@ var init_package = __esm(() => {
|
|
|
187
187
|
"@desplega/model-catalog": "workspace:*",
|
|
188
188
|
"@desplega/model-routing": "workspace:*",
|
|
189
189
|
"@faker-js/faker": "^10.4.0",
|
|
190
|
-
"@opencode/plugin": "2.1.
|
|
191
|
-
"@opencode/sdk": "2.1.
|
|
190
|
+
"@opencode/plugin": "2.1.4",
|
|
191
|
+
"@opencode/sdk": "2.1.4",
|
|
192
192
|
"@oxlint/plugins": "1.78.0",
|
|
193
193
|
"@types/bun": "latest",
|
|
194
194
|
"dependency-cruiser": "^18.0.0",
|
|
@@ -206,10 +206,10 @@ var init_package = __esm(() => {
|
|
|
206
206
|
bun: ">=1.3.12"
|
|
207
207
|
},
|
|
208
208
|
dependencies: {
|
|
209
|
-
"@agentclientprotocol/sdk": "2.0.
|
|
209
|
+
"@agentclientprotocol/sdk": "2.0.2",
|
|
210
210
|
"@ai-sdk/openai": "^3.0.41",
|
|
211
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
212
|
-
"@anthropic-ai/sdk": "^1.
|
|
211
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.310",
|
|
212
|
+
"@anthropic-ai/sdk": "^1.3.0",
|
|
213
213
|
"@asteasolutions/zod-to-openapi": "^8.0.0",
|
|
214
214
|
"@aws-sdk/client-bedrock": "3.1048.0",
|
|
215
215
|
"@chat-adapter/discord": "4.41.1",
|