@desplega.ai/agent-swarm 1.131.0 → 1.133.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-w53mbns9.js → actions-cskpayd7.js} +11 -9
- package/dist/{anthropic-messages-rjmd2e7n.js → anthropic-messages-tpxtbx7b.js} +28 -12
- package/dist/{app-m9gwqsqv.js → app-ang77nbb.js} +8 -6
- package/dist/{assistant-bp65m6f3.js → assistant-b4exebdw.js} +16 -13
- package/dist/{azure-openai-responses-c0yjmbfd.js → azure-openai-responses-m3921t4y.js} +8 -8
- package/dist/{boot-reembed-62p0at2k.js → boot-reembed-ps2aftpb.js} +9 -7
- package/dist/{boot-reembed-xmfp6wdh.js → boot-reembed-znyk3nxb.js} +10 -8
- package/dist/{boot-scrub-logs-rr8q2dms.js → boot-scrub-logs-2ax3xgz1.js} +7 -5
- package/dist/{claude-adapter-2y47mrkd.js → claude-adapter-3ct8kgxw.js} +13 -9
- package/dist/{claude-managed-adapter-gv19tdew.js → claude-managed-adapter-akx4ntf2.js} +2 -2
- package/dist/{cli-t1xze5qh.js → cli-13w2hwkh.js} +1 -1
- package/dist/{cli-efxfnq6q.js → cli-1532szb1.js} +8 -6
- package/dist/{cli-d2tfkcga.js → cli-23d3rseb.js} +33 -17
- package/dist/{cli-nm5gtp1x.js → cli-2a75z9c5.js} +196 -7
- package/dist/{cli-fywms69x.js → cli-2t30rj0d.js} +1 -1
- package/dist/{cli-cvgjwnh1.js → cli-3c3tdgab.js} +10 -10
- package/dist/{cli-pm6xbh84.js → cli-3zzxa9jz.js} +46 -16
- package/dist/{cli-cdeg08wx.js → cli-4k6233gc.js} +1 -1
- package/dist/{cli-t55yw3a1.js → cli-5p2tz05r.js} +2 -2
- package/dist/{cli-0rcyq6d9.js → cli-5z2yhzvd.js} +125 -47
- package/dist/{cli-3kf51j15.js → cli-6zfq31nj.js} +9 -3
- package/dist/{cli-er3a4bb0.js → cli-8m9de10a.js} +6 -1
- package/dist/{cli-gm9cbhbq.js → cli-8t14vg9w.js} +27 -8
- package/dist/{cli-72q8m8gk.js → cli-9nfc2es8.js} +6 -6
- package/dist/{cli-5ze9rv97.js → cli-9ta3pwms.js} +11 -4
- package/dist/{cli-78xwvkhj.js → cli-avr0ns7z.js} +2 -2
- package/dist/{cli-n6h8qt8n.js → cli-c897wyhw.js} +12 -7
- package/dist/{cli-2q72qz2s.js → cli-dgk20ft7.js} +15 -6
- package/dist/cli-et1bbwqf.js +13 -0
- package/dist/{cli-bqw0mt1n.js → cli-f5w27pj3.js} +3 -3
- package/dist/{cli-2wadx7p2.js → cli-f8dre4bz.js} +2 -2
- package/dist/{cli-e7ckcg4v.js → cli-ftwpv451.js} +170 -387
- package/dist/{cli-g6b8x1h8.js → cli-g854s2dw.js} +1 -1
- package/dist/{cli-5kx36evn.js → cli-ggmdxeqa.js} +13 -8
- package/dist/cli-hkwfe3qj.js +530 -0
- package/dist/{cli-5dsbcjjw.js → cli-jqwnqx9m.js} +1 -1
- package/dist/{cli-9dr5qzc0.js → cli-ny122vh4.js} +21 -10
- package/dist/{cli-5v4rw6yd.js → cli-pvzqhbs9.js} +2 -2
- package/dist/cli-pzq5rjym.js +15 -0
- package/dist/{cli-xpxde7rm.js → cli-qes8ef67.js} +48 -30
- package/dist/{cli-sajgpkqg.js → cli-qs9hhsvb.js} +1723 -325
- package/dist/cli-qys3rhhz.js +27 -0
- package/dist/{cli-rzbpmxdr.js → cli-r6tpm37h.js} +2 -2
- package/dist/{cli-qv61hp37.js → cli-rch80c76.js} +2 -2
- package/dist/{cli-0258203w.js → cli-rpp0x4zy.js} +137 -17
- package/dist/{cli-5n6e5yfn.js → cli-s1k0wxhe.js} +12 -7
- package/dist/{cli-psh3c4va.js → cli-sfd9v7sj.js} +1 -1
- package/dist/{cli-70xqj0z3.js → cli-sh3ytsyj.js} +49 -39
- package/dist/{cli-zsspvvm2.js → cli-w1mp9jy7.js} +1 -1
- package/dist/{cli-d3x3x1c9.js → cli-xdb4mpnp.js} +2 -2
- package/dist/{cli-57khth04.js → cli-xmyqv00z.js} +120 -4
- package/dist/{cli-yw8vghx2.js → cli-xv8t8p3c.js} +65 -32
- package/dist/{cli-f1am9szv.js → cli-xxv5pn4f.js} +1 -1
- package/dist/{cli-t76vw5db.js → cli-y08jvxzx.js} +601 -140
- package/dist/{cli-a4jzdpa3.js → cli-zfbf3srj.js} +650 -245
- package/dist/{cli-a40rnf71.js → cli-zmq89k34.js} +6 -6
- package/dist/{cli-qmdnhpej.js → cli-zr9q011v.js} +23 -13
- package/dist/cli.js +22 -22
- package/dist/{codex-adapter-d24q75wk.js → codex-adapter-bef93pq4.js} +9 -7
- package/dist/{codex-hook-hq54t9ft.js → codex-hook-e8dba65p.js} +3 -2
- package/dist/{codex-session-runner-g50vcsex.js → codex-session-runner-5pkxys7x.js} +9 -7
- package/dist/{commands-c3nrc5hg.js → commands-e23s1bff.js} +9 -7
- package/dist/{db-nt7fg3tw.js → db-m3nabatn.js} +17 -5
- package/dist/{google-generative-ai-hysrd8qx.js → google-generative-ai-8maw55xh.js} +11 -8
- package/dist/{google-vertex-p5arrga0.js → google-vertex-8vjqmx8g.js} +11 -8
- package/dist/{handlers-fkr6swat.js → handlers-akazedvr.js} +16 -13
- package/dist/{hook-77wpvnjc.js → hook-ze4cpf0v.js} +55 -41
- package/dist/{hook-g019yehy.js → hook-zfqyyenw.js} +10 -7
- package/dist/{http-jewj0syk.js → http-sja0n6kw.js} +730 -150
- package/dist/index-0gr8vd6k.js +39 -0
- package/dist/{index-7n2xpbd4.js → index-354vkhdv.js} +154 -74
- package/dist/{index-070v4eyb.js → index-5qthek5t.js} +2 -3
- package/dist/{index-hfvggd0z.js → index-95t3cqq5.js} +16 -14
- package/dist/{index-9znhar3x.js → index-sea66619.js} +3 -4
- package/dist/{index-6gm5he8h.js → index-vpn36mma.js} +15 -13
- package/dist/{keepalive-j0fjvqfd.js → keepalive-3sp3meqj.js} +16 -10
- package/dist/{lead-1n8x30xe.js → lead-mefeewkf.js} +39 -36
- package/dist/{maintenance-gvev11sa.js → maintenance-8tbrbjfg.js} +10 -8
- package/dist/mistral-conversations-00zrp7g4.js +717 -0
- package/dist/{oauth-refresh-sweep-s9ecsvh0.js → oauth-refresh-sweep-srjwjz6m.js} +8 -6
- package/dist/{onboard-pvm5b38w.js → onboard-mt2tgyjg.js} +7 -7
- package/dist/{openai-codex-responses-5g27pd6f.js → openai-codex-responses-map32h2s.js} +18 -18
- package/dist/{openai-completions-3vkmfz2a.js → openai-completions-w871b1cq.js} +12 -11
- package/dist/{openai-responses-dg4t7j7a.js → openai-responses-b0j7xnw8.js} +15 -12
- package/dist/{opencode-adapter-1gm38aba.js → opencode-adapter-b39jefcj.js} +5 -3
- package/dist/{openrouter-images-g3gm8931.js → openrouter-images-srfkywy0.js} +4 -4
- package/dist/{otel-impl-p6jvgd9c.js → otel-impl-z6pxt3j9.js} +224 -9
- package/dist/{pi-mono-adapter-t091s27g.js → pi-mono-adapter-btvqmj58.js} +1138 -408
- package/dist/{pricing-refresh-k49rcyed.js → pricing-refresh-kyq8cezh.js} +9 -7
- package/dist/{rbac-roles-cr80g96t.js → rbac-roles-3ryfrfna.js} +8 -6
- package/dist/{rbac-roles-30pspvy7.js → rbac-roles-6qfvbee1.js} +9 -7
- package/dist/{render-v2-xm457ng1.js → render-v2-p61ppjey.js} +8 -6
- package/dist/{seed-pricing-yhpv35fr.js → seed-pricing-j56bbj4y.js} +8 -6
- package/dist/{setup-nytnmwwr.js → setup-tpr6c1kn.js} +2 -2
- package/dist/{worker-msytr2cw.js → worker-9w1v0mbb.js} +39 -36
- package/openapi.json +542 -16
- package/package.json +6 -6
- package/src/be/budget-refusal-notify.ts +14 -7
- package/src/be/db-queries/task-artifacts.ts +182 -0
- package/src/be/db.ts +783 -169
- package/src/be/events.ts +5 -0
- package/src/be/migrations/130_scratch_script_retention_grace.sql +6 -0
- package/src/be/migrations/131_session_logs_created_at_index.sql +2 -0
- package/src/be/migrations/132_multi_runtime_instances.sql +44 -0
- package/src/be/migrations/133_workflow_run_trigger_type.sql +12 -0
- package/src/be/migrations/135_backfill_task_pull_request_attachments.sql +228 -0
- package/src/be/migrations/136_task_requester_provenance.sql +37 -0
- package/src/be/migrations/137_memory_retrieval_composite_index.sql +1 -0
- package/src/be/multi-runtime.ts +430 -0
- package/src/be/scripts/db.ts +43 -1
- package/src/be/scripts/extract-schema.ts +3 -1
- package/src/be/scripts/retention.ts +164 -0
- package/src/be/scripts/run-saved.ts +16 -1
- package/src/be/scripts/typecheck.ts +3 -2
- package/src/be/seed-skills/index.ts +7 -0
- package/src/be/steering.ts +1 -1
- package/src/be/swarm-config-guard.ts +18 -0
- package/src/commands/credential-wait.ts +54 -0
- package/src/commands/onboard/steps/core-credentials.tsx +1 -1
- package/src/commands/onboard/steps/custom-templates.tsx +1 -1
- package/src/commands/onboard/steps/harness-credentials.tsx +1 -1
- package/src/commands/onboard/steps/health-check.tsx +1 -1
- package/src/commands/onboard/steps/start.tsx +1 -1
- package/src/commands/profile-sync-audit.ts +56 -0
- package/src/commands/profile-sync.ts +287 -15
- package/src/commands/provider-credentials.ts +46 -19
- package/src/commands/runner.ts +196 -33
- package/src/commands/templates.ts +22 -0
- package/src/github/handlers.ts +55 -9
- package/src/heartbeat/heartbeat.ts +71 -12
- package/src/hooks/hook.ts +49 -33
- package/src/http/active-sessions.ts +11 -1
- package/src/http/agents.ts +261 -30
- package/src/http/all-routes.ts +1 -0
- package/src/http/config.ts +13 -2
- package/src/http/core.ts +102 -4
- package/src/http/db-query-bounded.ts +313 -0
- package/src/http/db-query-shared.ts +249 -0
- package/src/http/db-query.ts +54 -42
- package/src/http/events.ts +2 -0
- package/src/http/index.ts +27 -2
- package/src/http/mcp-bridge.ts +37 -3
- package/src/http/mcp.ts +12 -0
- package/src/http/memory.ts +13 -2
- package/src/http/openapi.ts +1 -0
- package/src/http/poll.ts +70 -27
- package/src/http/route-def.ts +43 -9
- package/src/http/schedules.ts +2 -2
- package/src/http/scripts.ts +31 -4
- package/src/http/session-data.ts +44 -0
- package/src/http/tasks.ts +2 -2
- package/src/http/users.ts +74 -52
- package/src/http/webhooks.ts +5 -2
- package/src/http/workflows.ts +1 -4
- package/src/http/x.ts +14 -0
- package/src/integrations/kapso/inbound.ts +1 -1
- package/src/jira/outbound.ts +39 -8
- package/src/jira/webhook-lifecycle.ts +13 -2
- package/src/linear/outbound.ts +43 -10
- package/src/oauth/keepalive.ts +13 -2
- package/src/prompts/base-prompt.ts +1 -1
- package/src/prompts/session-templates.ts +45 -7
- package/src/providers/claude-adapter.ts +6 -0
- package/src/providers/claude-managed-models.ts +34 -10
- package/src/providers/codex-adapter.ts +6 -0
- package/src/providers/opencode-adapter.ts +6 -0
- package/src/providers/pi-mono-adapter.ts +8 -0
- package/src/providers/pricing-sources.md +24 -0
- package/src/queue-stall-alarm.ts +216 -0
- package/src/scheduler/scheduler.ts +7 -0
- package/src/script-workflows/executor.ts +2 -1
- package/src/scripts-runtime/executors/native.ts +2 -1
- package/src/scripts-runtime/executors/types.ts +5 -0
- package/src/scripts-runtime/loader.ts +5 -0
- package/src/scripts-runtime/swarm-config.ts +8 -0
- package/src/scripts-runtime/swarm-sdk.ts +7 -0
- package/src/scripts-runtime/types/stdlib.d.ts +1 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +1 -0
- package/src/tests/budget-claim-gate.test.ts +20 -0
- package/src/tests/claude-adapter.test.ts +32 -0
- package/src/tests/claude-managed-adapter.test.ts +38 -7
- package/src/tests/codex-adapter.test.ts +30 -0
- package/src/tests/create-task-validation.test.ts +128 -0
- package/src/tests/credential-wait.test.ts +67 -1
- package/src/tests/db-query.test.ts +711 -2
- package/src/tests/http-api-integration.test.ts +81 -0
- package/src/tests/http-users.test.ts +166 -1
- package/src/tests/identity-field-budget.test.ts +176 -0
- package/src/tests/mcp-tools-user.test.ts +34 -0
- package/src/tests/mcp-user-route.test.ts +17 -0
- package/src/tests/metrics-http.test.ts +44 -0
- package/src/tests/multi-runtime-registration.test.ts +2703 -0
- package/src/tests/openapi-response-contract.test.ts +24 -0
- package/src/tests/openapi-route-headers.test.ts +83 -0
- package/src/tests/opencode-adapter.test.ts +40 -0
- package/src/tests/outbound-listener-rejection.test.ts +138 -0
- package/src/tests/pi-mono-adapter.test.ts +98 -0
- package/src/tests/profile-sync-warning.test.ts +277 -0
- package/src/tests/profile-sync.test.ts +232 -6
- package/src/tests/prompt-template-session.test.ts +32 -3
- package/src/tests/queue-stall-alarm.test.ts +226 -0
- package/src/tests/requester-comms.test.ts +32 -0
- package/src/tests/runner-requester-profile.test.ts +38 -0
- package/src/tests/sandboxed-process.test.ts +45 -0
- package/src/tests/schedule-target-type.test.ts +38 -0
- package/src/tests/script-connections.test.ts +16 -3
- package/src/tests/scripts-external-api.test.ts +8 -3
- package/src/tests/scripts-http.test.ts +12 -0
- package/src/tests/scripts-retention.test.ts +384 -0
- package/src/tests/scripts-runtime-identity.test.ts +375 -0
- package/src/tests/scripts-runtime.test.ts +4 -3
- package/src/tests/sdk-allowlist.test.ts +47 -0
- package/src/tests/send-task-requested-by.test.ts +9 -0
- package/src/tests/session-costs.test.ts +506 -1
- package/src/tests/shutdown-error-scrubbing.test.ts +92 -0
- package/src/tests/steering-core.test.ts +28 -0
- package/src/tests/task-artifacts.test.ts +386 -0
- package/src/tests/task-attachments-schema.test.ts +17 -1
- package/src/tests/task-completion-idempotency.test.ts +57 -0
- package/src/tests/task-pull-request-backfill-migration.test.ts +321 -0
- package/src/tests/update-profile-api.test.ts +67 -39
- package/src/tests/update-profile-auth.test.ts +48 -4
- package/src/tests/user-attribution-migration.test.ts +54 -0
- package/src/tests/user-identity.test.ts +72 -0
- package/src/tests/workflow-async-v2.test.ts +39 -1
- package/src/tests/workflow-http-v2.test.ts +3 -2
- package/src/tests/workflow-mcp-trigger-schema.test.ts +52 -3
- package/src/tests/workflow-retry-v2.test.ts +45 -1
- package/src/tests/workflow-swarm-script.test.ts +14 -5
- package/src/tools/db-query.ts +18 -8
- package/src/tools/get-task-details.ts +24 -3
- package/src/tools/manage-user.ts +36 -3
- package/src/tools/poll-task.ts +93 -14
- package/src/tools/script-common.ts +5 -0
- package/src/tools/send-task.ts +1 -4
- package/src/tools/store-progress.ts +13 -2
- package/src/tools/swarm-config/delete-config.ts +9 -0
- package/src/tools/swarm-config/set-config.ts +3 -2
- package/src/tools/task-action.ts +30 -0
- package/src/tools/task-tool-ctx.ts +8 -1
- package/src/tools/update-profile.ts +16 -21
- package/src/tools/utils.ts +5 -0
- package/src/tools/workflows/trigger-workflow.ts +7 -1
- package/src/types.ts +165 -1
- package/src/utils/github-pull-request.ts +76 -0
- package/src/utils/identity-field-budget.ts +73 -0
- package/src/utils/multi-runtime.ts +20 -0
- package/src/utils/requester-comms.ts +24 -0
- package/src/utils/sandboxed-process.ts +40 -14
- package/src/workflows/engine.ts +22 -2
- package/src/workflows/executors/swarm-script.ts +24 -1
- package/src/workflows/resume.ts +19 -11
- package/src/workflows/retry-poller.ts +1 -0
- package/src/workflows/triggers.ts +4 -0
- package/templates/schedules/daily-compounding-reflection/content.md +12 -3
- package/templates/skills/db-query-guidance/config.json +14 -0
- package/templates/skills/db-query-guidance/content.md +57 -0
- package/dist/cli-3te4jdkm.js +0 -225
- package/dist/cli-bmze986d.js +0 -7
- package/dist/cli-kh3ba2zf.js +0 -607
- package/dist/index-hp1kdbjj.js +0 -36
- package/dist/mistral-conversations-81fwav0j.js +0 -30578
- package/dist/otel-nqa12wf3.js +0 -3149
- package/dist/{pi-messages-tqj8q6b9.js → pi-messages-sssy32x4.js} +3 -3
|
@@ -13,13 +13,15 @@ import {
|
|
|
13
13
|
getScriptMcpConnectionDescriptors,
|
|
14
14
|
getScriptVersion,
|
|
15
15
|
readStreamCapped,
|
|
16
|
+
restoreScratchScriptLastUsedIfUnchanged,
|
|
16
17
|
runScript,
|
|
17
18
|
sandboxSpawnEnv,
|
|
18
|
-
snapshotCapped
|
|
19
|
-
|
|
19
|
+
snapshotCapped,
|
|
20
|
+
touchScratchScriptLastUsed
|
|
21
|
+
} from "./cli-3zzxa9jz.js";
|
|
20
22
|
import {
|
|
21
23
|
withSiblingAwareness
|
|
22
|
-
} from "./cli-
|
|
24
|
+
} from "./cli-4k6233gc.js";
|
|
23
25
|
import {
|
|
24
26
|
FollowUpConfigSchema,
|
|
25
27
|
ModelTierSchema,
|
|
@@ -64,27 +66,28 @@ import {
|
|
|
64
66
|
updateWorkflowRun,
|
|
65
67
|
updateWorkflowRunStep,
|
|
66
68
|
workflowContextKey
|
|
67
|
-
} from "./cli-
|
|
69
|
+
} from "./cli-zfbf3srj.js";
|
|
68
70
|
import {
|
|
69
71
|
deepInterpolate,
|
|
70
72
|
findInterpolationTokens,
|
|
71
73
|
init_template,
|
|
72
74
|
interpolate
|
|
73
|
-
} from "./cli-
|
|
75
|
+
} from "./cli-qes8ef67.js";
|
|
74
76
|
import {
|
|
75
77
|
getAppUrl,
|
|
76
78
|
init_constants
|
|
77
79
|
} from "./cli-x23me2mg.js";
|
|
78
80
|
import {
|
|
79
81
|
init_zod
|
|
80
|
-
} from "./cli-
|
|
82
|
+
} from "./cli-w1mp9jy7.js";
|
|
81
83
|
import {
|
|
82
84
|
init_secret_scrubber,
|
|
83
|
-
isSensitiveKey
|
|
85
|
+
isSensitiveKey,
|
|
86
|
+
scrubSecrets
|
|
84
87
|
} from "./cli-4j2mrzag.js";
|
|
85
88
|
import {
|
|
86
89
|
exports_external
|
|
87
|
-
} from "./cli-
|
|
90
|
+
} from "./cli-jqwnqx9m.js";
|
|
88
91
|
import {
|
|
89
92
|
init_event_bus,
|
|
90
93
|
workflowEventBus
|
|
@@ -847,7 +850,13 @@ async function startWorkflowExecution(workflow, triggerData, registry, options =
|
|
|
847
850
|
}
|
|
848
851
|
if (workflow.cooldown && shouldSkipCooldown(workflow.id, workflow.cooldown)) {
|
|
849
852
|
const runId2 = crypto.randomUUID();
|
|
850
|
-
createWorkflowRun({
|
|
853
|
+
createWorkflowRun({
|
|
854
|
+
id: runId2,
|
|
855
|
+
workflowId: workflow.id,
|
|
856
|
+
triggerType: options.triggerType ?? "manual",
|
|
857
|
+
triggerData,
|
|
858
|
+
createdBy: options.requestedByUserId
|
|
859
|
+
});
|
|
851
860
|
updateWorkflowRun(runId2, {
|
|
852
861
|
status: "skipped",
|
|
853
862
|
error: "cooldown",
|
|
@@ -856,7 +865,13 @@ async function startWorkflowExecution(workflow, triggerData, registry, options =
|
|
|
856
865
|
return runId2;
|
|
857
866
|
}
|
|
858
867
|
const runId = crypto.randomUUID();
|
|
859
|
-
createWorkflowRun({
|
|
868
|
+
createWorkflowRun({
|
|
869
|
+
id: runId,
|
|
870
|
+
workflowId: workflow.id,
|
|
871
|
+
triggerType: options.triggerType ?? "manual",
|
|
872
|
+
triggerData,
|
|
873
|
+
createdBy: options.requestedByUserId
|
|
874
|
+
});
|
|
860
875
|
telemetry.workflow("started", {
|
|
861
876
|
workflowId: workflow.id,
|
|
862
877
|
nodeCount: workflow.definition.nodes.length,
|
|
@@ -888,6 +903,12 @@ async function startWorkflowExecution(workflow, triggerData, registry, options =
|
|
|
888
903
|
return runId;
|
|
889
904
|
}
|
|
890
905
|
async function walkGraph(def, runId, ctx, startNodes, registry, workflowId, secretKeys = new Set, options = {}) {
|
|
906
|
+
if (!options.requestedByUserId) {
|
|
907
|
+
options = {
|
|
908
|
+
...options,
|
|
909
|
+
requestedByUserId: getWorkflowRun(runId)?.createdBy
|
|
910
|
+
};
|
|
911
|
+
}
|
|
891
912
|
let nodeExecutionCount = 0;
|
|
892
913
|
if (!("run" in ctx)) {
|
|
893
914
|
ctx.run = { id: runId };
|
|
@@ -1318,6 +1339,7 @@ var FAILED_TASK_OUTPUT_PREFIX = "[FAILED:";
|
|
|
1318
1339
|
|
|
1319
1340
|
// src/workflows/resume.ts
|
|
1320
1341
|
init_db();
|
|
1342
|
+
init_secret_scrubber();
|
|
1321
1343
|
init_event_bus();
|
|
1322
1344
|
|
|
1323
1345
|
// src/workflows/executors/wait.ts
|
|
@@ -1667,40 +1689,40 @@ function completeTaskStepAndResolveSuccessors(def, runId, step, output, ctx, fai
|
|
|
1667
1689
|
// src/workflows/resume.ts
|
|
1668
1690
|
function setupWorkflowResumeListener(eventBus, registry) {
|
|
1669
1691
|
eventBus.on("task.completed", async (data) => {
|
|
1670
|
-
const event = data;
|
|
1671
|
-
if (!event.workflowRunId || !event.workflowRunStepId)
|
|
1672
|
-
return;
|
|
1673
1692
|
try {
|
|
1693
|
+
const event = data;
|
|
1694
|
+
if (!event.workflowRunId || !event.workflowRunStepId)
|
|
1695
|
+
return;
|
|
1674
1696
|
await resumeFromTaskCompletion(event, registry);
|
|
1675
1697
|
} catch (err) {
|
|
1676
1698
|
console.error("[workflows] Resume from task completion failed:", err);
|
|
1677
1699
|
}
|
|
1678
1700
|
});
|
|
1679
1701
|
eventBus.on("task.failed", async (data) => {
|
|
1680
|
-
const event = data;
|
|
1681
|
-
if (!event.workflowRunId || !event.workflowRunStepId)
|
|
1682
|
-
return;
|
|
1683
1702
|
try {
|
|
1703
|
+
const event = data;
|
|
1704
|
+
if (!event.workflowRunId || !event.workflowRunStepId)
|
|
1705
|
+
return;
|
|
1684
1706
|
await handleTaskFailure(event, event.failureReason ?? "Task failed", registry);
|
|
1685
1707
|
} catch (err) {
|
|
1686
1708
|
console.error("[workflows] Handle task failure error:", err);
|
|
1687
1709
|
}
|
|
1688
1710
|
});
|
|
1689
1711
|
eventBus.on("task.cancelled", async (data) => {
|
|
1690
|
-
const event = data;
|
|
1691
|
-
if (!event.workflowRunId || !event.workflowRunStepId)
|
|
1692
|
-
return;
|
|
1693
1712
|
try {
|
|
1713
|
+
const event = data;
|
|
1714
|
+
if (!event.workflowRunId || !event.workflowRunStepId)
|
|
1715
|
+
return;
|
|
1694
1716
|
await handleTaskFailure(event, "Task was cancelled", registry);
|
|
1695
1717
|
} catch (err) {
|
|
1696
1718
|
console.error("[workflows] Handle task cancellation error:", err);
|
|
1697
1719
|
}
|
|
1698
1720
|
});
|
|
1699
1721
|
eventBus.on("approval.resolved", async (data) => {
|
|
1700
|
-
const event = data;
|
|
1701
|
-
if (!event.workflowRunId || !event.workflowRunStepId)
|
|
1702
|
-
return;
|
|
1703
1722
|
try {
|
|
1723
|
+
const event = data;
|
|
1724
|
+
if (!event.workflowRunId || !event.workflowRunStepId)
|
|
1725
|
+
return;
|
|
1704
1726
|
await resumeFromApprovalResolution(event, registry);
|
|
1705
1727
|
} catch (err) {
|
|
1706
1728
|
console.error("[workflows] Resume from approval resolution failed:", err);
|
|
@@ -1965,7 +1987,9 @@ function registerWait(waitId, eventName) {
|
|
|
1965
1987
|
set.add(waitId);
|
|
1966
1988
|
if (!listenersByEvent.has(eventName)) {
|
|
1967
1989
|
const listener = (data) => {
|
|
1968
|
-
processBusEvent(eventName, data)
|
|
1990
|
+
processBusEvent(eventName, data).catch((err) => {
|
|
1991
|
+
console.error(`[workflows] Wait bus listener failed for event=${eventName}:`, scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
1992
|
+
});
|
|
1969
1993
|
};
|
|
1970
1994
|
listenersByEvent.set(eventName, listener);
|
|
1971
1995
|
workflowEventBus.on(eventName, listener);
|
|
@@ -2253,6 +2277,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
2253
2277
|
nodeId: step.nodeId,
|
|
2254
2278
|
workflowId: workflow.id,
|
|
2255
2279
|
dryRun: false,
|
|
2280
|
+
requestedByUserId: run.createdBy,
|
|
2256
2281
|
inputCtx
|
|
2257
2282
|
};
|
|
2258
2283
|
try {
|
|
@@ -2468,7 +2493,8 @@ async function handleWebhookTrigger(workflowId, payload, headers, registry, opti
|
|
|
2468
2493
|
}
|
|
2469
2494
|
const triggerData = parseTriggerPayload(payload);
|
|
2470
2495
|
const runId = await startWorkflowExecution(workflow, triggerData, registry, {
|
|
2471
|
-
triggerType: "event"
|
|
2496
|
+
triggerType: "event",
|
|
2497
|
+
requestedByUserId: options.requestedByUserId
|
|
2472
2498
|
});
|
|
2473
2499
|
return { runId };
|
|
2474
2500
|
}
|
|
@@ -2503,7 +2529,8 @@ async function handleScheduleTrigger(scheduleId, schedule, registry) {
|
|
|
2503
2529
|
firedAt: new Date().toISOString()
|
|
2504
2530
|
};
|
|
2505
2531
|
const runId = await startWorkflowExecution(workflow, triggerData, registry, {
|
|
2506
|
-
triggerType: "schedule"
|
|
2532
|
+
triggerType: "schedule",
|
|
2533
|
+
requestedByUserId: schedule.createdBy
|
|
2507
2534
|
});
|
|
2508
2535
|
runIds.push(runId);
|
|
2509
2536
|
console.log(`[Triggers] Schedule "${schedule.name}" triggered workflow "${workflow.name}" (run: ${runId})`);
|
|
@@ -3092,7 +3119,7 @@ class HumanInTheLoopExecutor extends BaseExecutor {
|
|
|
3092
3119
|
}
|
|
3093
3120
|
if (notification.channel === "slack") {
|
|
3094
3121
|
try {
|
|
3095
|
-
const { getSlackApp } = await import("./app-
|
|
3122
|
+
const { getSlackApp } = await import("./app-ang77nbb.js");
|
|
3096
3123
|
const slackApp = getSlackApp();
|
|
3097
3124
|
if (!slackApp) {
|
|
3098
3125
|
console.warn("[HITL] Slack not initialized — cannot send notification");
|
|
@@ -3208,7 +3235,7 @@ class NotifyExecutor extends BaseExecutor {
|
|
|
3208
3235
|
}
|
|
3209
3236
|
}
|
|
3210
3237
|
case "slack": {
|
|
3211
|
-
const { getSlackApp } = await import("./app-
|
|
3238
|
+
const { getSlackApp } = await import("./app-ang77nbb.js");
|
|
3212
3239
|
const app = getSlackApp();
|
|
3213
3240
|
if (!app) {
|
|
3214
3241
|
return {
|
|
@@ -3333,14 +3360,14 @@ var RawLlmOutputSchema = exports_external.object({
|
|
|
3333
3360
|
async function executeRawLlm(config) {
|
|
3334
3361
|
const modelName = config.model ?? "google/gemini-3-flash-preview";
|
|
3335
3362
|
try {
|
|
3336
|
-
const { createOpenAI } = await import("./index-
|
|
3363
|
+
const { createOpenAI } = await import("./index-5qthek5t.js");
|
|
3337
3364
|
const openrouter = createOpenAI({
|
|
3338
3365
|
baseURL: getOpenRouterBaseUrl(),
|
|
3339
3366
|
apiKey: process.env.OPENROUTER_API_KEY
|
|
3340
3367
|
});
|
|
3341
3368
|
const model = openrouter(modelName);
|
|
3342
3369
|
if (config.schema) {
|
|
3343
|
-
const { generateObject, jsonSchema } = await import("./index-
|
|
3370
|
+
const { generateObject, jsonSchema } = await import("./index-sea66619.js");
|
|
3344
3371
|
const { object } = await generateObject({
|
|
3345
3372
|
model,
|
|
3346
3373
|
schema: jsonSchema(config.schema),
|
|
@@ -3354,7 +3381,7 @@ async function executeRawLlm(config) {
|
|
|
3354
3381
|
output: { result: object, model: modelName }
|
|
3355
3382
|
};
|
|
3356
3383
|
}
|
|
3357
|
-
const { generateText } = await import("./index-
|
|
3384
|
+
const { generateText } = await import("./index-sea66619.js");
|
|
3358
3385
|
const { text } = await generateText({
|
|
3359
3386
|
model,
|
|
3360
3387
|
prompt: config.prompt
|
|
@@ -3615,6 +3642,7 @@ class SwarmScriptExecutor extends BaseExecutor {
|
|
|
3615
3642
|
error: `swarm-script body interpolation failed for node "${meta.nodeId}": unresolved token(s): ${renderedTokens}. ` + "Named script source is not workflow-interpolated; pass dynamic values through config.args and read them from args."
|
|
3616
3643
|
};
|
|
3617
3644
|
}
|
|
3645
|
+
const runStartTouch = resolved.script.isScratch ? touchScratchScriptLastUsed(resolved.script.id) : null;
|
|
3618
3646
|
const credentials = await buildScriptCredentialBindingsWithFailures({
|
|
3619
3647
|
agentId: agentId ?? undefined
|
|
3620
3648
|
});
|
|
@@ -3629,6 +3657,11 @@ class SwarmScriptExecutor extends BaseExecutor {
|
|
|
3629
3657
|
mcpConnections: getScriptMcpConnectionDescriptors({ agentId: agentId ?? undefined }),
|
|
3630
3658
|
timeoutMs: config.timeoutMs
|
|
3631
3659
|
});
|
|
3660
|
+
if (output.exitCode === 0 && !output.error && !output.runtimeError) {
|
|
3661
|
+
touchScratchScriptLastUsed(resolved.script.id);
|
|
3662
|
+
} else if (resolved.script.isScratch && runStartTouch) {
|
|
3663
|
+
restoreScratchScriptLastUsedIfUnchanged(resolved.script.id, resolved.script.updatedAt, runStartTouch);
|
|
3664
|
+
}
|
|
3632
3665
|
const workflowOutput = {
|
|
3633
3666
|
result: output.result,
|
|
3634
3667
|
stdout: output.stdout,
|
|
@@ -3781,8 +3814,8 @@ class ValidateExecutor extends BaseExecutor {
|
|
|
3781
3814
|
const interpolatedPrompt = this.deps.interpolate(prompt, context);
|
|
3782
3815
|
const outputStr = typeof targetOutput === "string" ? targetOutput : JSON.stringify(targetOutput);
|
|
3783
3816
|
try {
|
|
3784
|
-
const { createOpenAI } = await import("./index-
|
|
3785
|
-
const { generateObject, jsonSchema } = await import("./index-
|
|
3817
|
+
const { createOpenAI } = await import("./index-5qthek5t.js");
|
|
3818
|
+
const { generateObject, jsonSchema } = await import("./index-sea66619.js");
|
|
3786
3819
|
const openrouter = createOpenAI({
|
|
3787
3820
|
baseURL: getOpenRouterBaseUrl(),
|
|
3788
3821
|
apiKey: process.env.OPENROUTER_API_KEY
|