@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
|
@@ -111,6 +111,10 @@ import {
|
|
|
111
111
|
cancelTask2,
|
|
112
112
|
getRecentlyCancelledTasksForAgent2,
|
|
113
113
|
updateTaskProgress2,
|
|
114
|
+
getRunLineageBlock,
|
|
115
|
+
getWorkflowRunStatus,
|
|
116
|
+
disarmWorkflowTreeRetries,
|
|
117
|
+
getRunningSubWorkflowSteps,
|
|
114
118
|
getSettledChildRunParentSteps,
|
|
115
119
|
init_workflow_runs,
|
|
116
120
|
CHAT_SDK_ADAPTER_NAMES,
|
|
@@ -283,7 +287,6 @@ import {
|
|
|
283
287
|
getApprovalRequestById2,
|
|
284
288
|
resolveApprovalRequest2,
|
|
285
289
|
cancelApprovalRequestById2,
|
|
286
|
-
listCancelledApprovalRequestsForRun2,
|
|
287
290
|
getStuckApprovalRuns2,
|
|
288
291
|
getDueWaitStates2,
|
|
289
292
|
getStuckWaitRuns2,
|
|
@@ -336,19 +339,19 @@ import {
|
|
|
336
339
|
recordInlineScriptRun2,
|
|
337
340
|
exports_db,
|
|
338
341
|
init_db3
|
|
339
|
-
} from "./cli-
|
|
342
|
+
} from "./cli-jb30dzvk.js";
|
|
340
343
|
import {
|
|
341
344
|
getUserGrant2,
|
|
342
345
|
init_rbac_roles
|
|
343
|
-
} from "./cli-
|
|
346
|
+
} from "./cli-ff1tm9n9.js";
|
|
344
347
|
import {
|
|
345
348
|
ensurePricingSeeded2,
|
|
346
349
|
ensureRbacSeeded2,
|
|
347
350
|
ensureModelProfilesSeeded2
|
|
348
|
-
} from "./cli-
|
|
351
|
+
} from "./cli-c61mbdds.js";
|
|
349
352
|
import {
|
|
350
353
|
loadModelsDevCache
|
|
351
|
-
} from "./cli-
|
|
354
|
+
} from "./cli-sbwsxvtd.js";
|
|
352
355
|
import {
|
|
353
356
|
buildCatalogEntries,
|
|
354
357
|
listModelCatalog,
|
|
@@ -358,12 +361,16 @@ import {
|
|
|
358
361
|
loadModelsCatalog,
|
|
359
362
|
requestModelCatalogRefresh2,
|
|
360
363
|
startPricingRefreshLoop2
|
|
361
|
-
} from "./cli-
|
|
364
|
+
} from "./cli-bvpgr9ny.js";
|
|
362
365
|
import {
|
|
363
366
|
ampPinProviderError,
|
|
364
367
|
ampPinCatalogError,
|
|
365
368
|
ampModelError
|
|
366
|
-
} from "./cli-
|
|
369
|
+
} from "./cli-9s05422w.js";
|
|
370
|
+
import {
|
|
371
|
+
workflowEventBus2,
|
|
372
|
+
init_event_bus
|
|
373
|
+
} from "./cli-dabehxhp.js";
|
|
367
374
|
import {
|
|
368
375
|
notifyAutomationPreflightFailure,
|
|
369
376
|
isNeedsSetupFailure,
|
|
@@ -373,6 +380,16 @@ import {
|
|
|
373
380
|
schedulePreflightInput,
|
|
374
381
|
recordSchedulePreflightFailure,
|
|
375
382
|
BaseExecutor,
|
|
383
|
+
AGENT_MAX_TASKS_CONFIG_KEY,
|
|
384
|
+
resetAgentMaxTasksMirror,
|
|
385
|
+
upsertSwarmConfigWithPolicyMirror,
|
|
386
|
+
getRuntimeInstanceById,
|
|
387
|
+
markRuntimeTerminated,
|
|
388
|
+
touchRuntimeInstance,
|
|
389
|
+
markRuntimeInstanceOffline,
|
|
390
|
+
reconcileAgentStatusFromRuntimes,
|
|
391
|
+
ConfigQuestionSettingsSchema,
|
|
392
|
+
normalizeApprovalQuestions,
|
|
376
393
|
resolveSlackConversationId,
|
|
377
394
|
postApprovalCancellationUpdates,
|
|
378
395
|
createApprovalFollowUpTask,
|
|
@@ -400,6 +417,7 @@ import {
|
|
|
400
417
|
startWorkflowExecution2,
|
|
401
418
|
failRunOnUnreadableReplay,
|
|
402
419
|
isWorkflowRunActive,
|
|
420
|
+
isStepExecuting,
|
|
403
421
|
holdWorkflowRun,
|
|
404
422
|
walkGraph,
|
|
405
423
|
findReadyNodes,
|
|
@@ -409,6 +427,7 @@ import {
|
|
|
409
427
|
isForeachChildOwned,
|
|
410
428
|
parkAndDriveForeach,
|
|
411
429
|
runForeachDrive,
|
|
430
|
+
resolveForeachParent,
|
|
412
431
|
stepFailureMode,
|
|
413
432
|
generateEdges,
|
|
414
433
|
resolveValidationPort,
|
|
@@ -416,7 +435,7 @@ import {
|
|
|
416
435
|
definitionNodeIds,
|
|
417
436
|
validateDefinition,
|
|
418
437
|
applyDefinitionPatch
|
|
419
|
-
} from "./cli-
|
|
438
|
+
} from "./cli-gbfxp48k.js";
|
|
420
439
|
import {
|
|
421
440
|
require_dist2,
|
|
422
441
|
publicEndpointSsrfOptions,
|
|
@@ -476,19 +495,22 @@ import {
|
|
|
476
495
|
deleteApp,
|
|
477
496
|
typecheckScript,
|
|
478
497
|
parseSkillContent
|
|
479
|
-
} from "./cli-
|
|
498
|
+
} from "./cli-7p4jxgtt.js";
|
|
480
499
|
import {
|
|
481
500
|
buildAuthorizationUrl,
|
|
482
501
|
onAuthorizationRefreshed,
|
|
483
502
|
ensureAuthorizationTokenOrThrow,
|
|
484
503
|
ensureToken,
|
|
485
504
|
ensureTokenOrThrow
|
|
486
|
-
} from "./cli-
|
|
505
|
+
} from "./cli-tsma7p8v.js";
|
|
487
506
|
import {
|
|
488
507
|
detachedProcessGroup,
|
|
489
508
|
registerProcessGroup,
|
|
490
509
|
terminateProcessGroup
|
|
491
510
|
} from "./cli-3ggwdtb0.js";
|
|
511
|
+
import {
|
|
512
|
+
isMultiRuntimeEnabled
|
|
513
|
+
} from "./cli-e8xyjvfc.js";
|
|
492
514
|
import {
|
|
493
515
|
noteSlackInboundSideEffect,
|
|
494
516
|
terminalReactionEvent,
|
|
@@ -514,18 +536,14 @@ import {
|
|
|
514
536
|
getSlackApp2,
|
|
515
537
|
startSlackApp2,
|
|
516
538
|
stopSlackApp2
|
|
517
|
-
} from "./cli-
|
|
539
|
+
} from "./cli-abs8ndtr.js";
|
|
518
540
|
import {
|
|
519
541
|
slackCode,
|
|
520
542
|
slackMissingScopeMessage,
|
|
521
543
|
withAutoJoin,
|
|
522
544
|
externalChannelToolError2,
|
|
523
545
|
getChannelBlockReason2
|
|
524
|
-
} from "./cli-
|
|
525
|
-
import {
|
|
526
|
-
workflowEventBus2,
|
|
527
|
-
init_event_bus
|
|
528
|
-
} from "./cli-dabehxhp.js";
|
|
546
|
+
} from "./cli-eftzyh9y.js";
|
|
529
547
|
import {
|
|
530
548
|
shapeApprovalResolution,
|
|
531
549
|
SubWorkflowExecutor,
|
|
@@ -539,11 +557,12 @@ import {
|
|
|
539
557
|
retryFailedRun2,
|
|
540
558
|
cancelWorkflowRunRows2,
|
|
541
559
|
cancelWorkflowRun2,
|
|
560
|
+
postTreeApprovalCancellations2,
|
|
542
561
|
resumeWaitState2,
|
|
543
562
|
recoverResolvedWaitState2,
|
|
544
563
|
resumeFromChildRun2,
|
|
545
564
|
initWaitBusSubscriptions2
|
|
546
|
-
} from "./cli-
|
|
565
|
+
} from "./cli-x0f2v69c.js";
|
|
547
566
|
import {
|
|
548
567
|
duplicateGuardedQueryKey,
|
|
549
568
|
parseQueryParams,
|
|
@@ -570,10 +589,7 @@ import {
|
|
|
570
589
|
isPublicRoute,
|
|
571
590
|
findRoute,
|
|
572
591
|
route
|
|
573
|
-
} from "./cli-
|
|
574
|
-
import {
|
|
575
|
-
isMultiRuntimeEnabled
|
|
576
|
-
} from "./cli-e8xyjvfc.js";
|
|
592
|
+
} from "./cli-gwhjmh8g.js";
|
|
577
593
|
import {
|
|
578
594
|
FilesError,
|
|
579
595
|
providerPath,
|
|
@@ -584,7 +600,7 @@ import {
|
|
|
584
600
|
import {
|
|
585
601
|
getRuntimePool2,
|
|
586
602
|
init_db
|
|
587
|
-
} from "./cli-
|
|
603
|
+
} from "./cli-19202kew.js";
|
|
588
604
|
import {
|
|
589
605
|
getMemoryRaterNames,
|
|
590
606
|
REFERENCES_SOURCE_MAX_LENGTH,
|
|
@@ -609,7 +625,7 @@ import {
|
|
|
609
625
|
import {
|
|
610
626
|
canProvisionKind,
|
|
611
627
|
init_runtime_providers
|
|
612
|
-
} from "./cli-
|
|
628
|
+
} from "./cli-dew6x255.js";
|
|
613
629
|
import {
|
|
614
630
|
findUserById,
|
|
615
631
|
findUserByExternalId,
|
|
@@ -621,11 +637,10 @@ import {
|
|
|
621
637
|
linkIdentity,
|
|
622
638
|
unlinkIdentity,
|
|
623
639
|
resolveUserByToken,
|
|
624
|
-
revokeRuntimeTokensForRuntime,
|
|
625
640
|
resolveSessionToken,
|
|
626
641
|
fingerprintApiKey,
|
|
627
642
|
init_users
|
|
628
|
-
} from "./cli-
|
|
643
|
+
} from "./cli-6a1xg1p7.js";
|
|
629
644
|
import {
|
|
630
645
|
isRbacEnabled,
|
|
631
646
|
decideAdmission,
|
|
@@ -694,7 +709,7 @@ import {
|
|
|
694
709
|
KvNamespaceSchema,
|
|
695
710
|
KvKeySchema,
|
|
696
711
|
init_types
|
|
697
|
-
} from "./cli-
|
|
712
|
+
} from "./cli-mz9afxxf.js";
|
|
698
713
|
import {
|
|
699
714
|
generateDefaultClaudeMd2,
|
|
700
715
|
generateDefaultSoulMd2,
|
|
@@ -703,7 +718,7 @@ import {
|
|
|
703
718
|
taskAttachmentFetchCommand,
|
|
704
719
|
taskAttachmentDisplayUrl,
|
|
705
720
|
init_task_attachment_links
|
|
706
|
-
} from "./cli-
|
|
721
|
+
} from "./cli-e42vss7b.js";
|
|
707
722
|
import {
|
|
708
723
|
getSlackConfiguration,
|
|
709
724
|
init_config
|
|
@@ -721,7 +736,7 @@ import {
|
|
|
721
736
|
init_registry,
|
|
722
737
|
resolveTemplate,
|
|
723
738
|
init_resolver
|
|
724
|
-
} from "./cli-
|
|
739
|
+
} from "./cli-dqygeeh5.js";
|
|
725
740
|
import {
|
|
726
741
|
init_zod
|
|
727
742
|
} from "./cli-4chz1hye.js";
|
|
@@ -763,7 +778,7 @@ import {
|
|
|
763
778
|
import {
|
|
764
779
|
init_package,
|
|
765
780
|
package_default
|
|
766
|
-
} from "./cli-
|
|
781
|
+
} from "./cli-xtrz6bzs.js";
|
|
767
782
|
import {
|
|
768
783
|
realtimeBus,
|
|
769
784
|
init_bus
|
|
@@ -20071,6 +20086,7 @@ async function poolHarnessModelError(model) {
|
|
|
20071
20086
|
// src/extensions/apply-task-create.ts
|
|
20072
20087
|
init_types();
|
|
20073
20088
|
init_secret_scrubber();
|
|
20089
|
+
init_event_bus();
|
|
20074
20090
|
|
|
20075
20091
|
// src/extensions/dispatcher.ts
|
|
20076
20092
|
init_db_client();
|
|
@@ -20140,6 +20156,7 @@ async function recoverIncompleteRuns(registry) {
|
|
|
20140
20156
|
}
|
|
20141
20157
|
}
|
|
20142
20158
|
recovered += await recoverForeachFanouts(registry);
|
|
20159
|
+
recovered += await recoverOrphanedSubWorkflowSteps(registry);
|
|
20143
20160
|
if (recovered > 0) {
|
|
20144
20161
|
console.log(`[workflows] Recovered ${recovered} incomplete run(s)`);
|
|
20145
20162
|
}
|
|
@@ -20155,6 +20172,10 @@ async function recoverRunningRuns(registry) {
|
|
|
20155
20172
|
const run = await getWorkflowRun2(runId);
|
|
20156
20173
|
if (!run || run.status !== "running")
|
|
20157
20174
|
continue;
|
|
20175
|
+
if (run.parentStepId && run.context === undefined) {
|
|
20176
|
+
await failRunningRun(runId, "Child workflow run lost its initial context in a restart");
|
|
20177
|
+
continue;
|
|
20178
|
+
}
|
|
20158
20179
|
const workflow = await getWorkflow2(run.workflowId);
|
|
20159
20180
|
if (!workflow)
|
|
20160
20181
|
continue;
|
|
@@ -20181,6 +20202,43 @@ async function recoverRunningRuns(registry) {
|
|
|
20181
20202
|
}
|
|
20182
20203
|
return recovered;
|
|
20183
20204
|
}
|
|
20205
|
+
async function failRunningRun(runId, error) {
|
|
20206
|
+
await getDbClient2().transaction(async () => {
|
|
20207
|
+
const run = await getWorkflowRun2(runId);
|
|
20208
|
+
if (run?.status !== "running")
|
|
20209
|
+
return;
|
|
20210
|
+
await updateWorkflowRun2(runId, {
|
|
20211
|
+
status: "failed",
|
|
20212
|
+
error,
|
|
20213
|
+
finishedAt: new Date().toISOString()
|
|
20214
|
+
});
|
|
20215
|
+
});
|
|
20216
|
+
}
|
|
20217
|
+
async function recoverOrphanedSubWorkflowSteps(registry) {
|
|
20218
|
+
let recovered = 0;
|
|
20219
|
+
for (const row of await getRunningSubWorkflowSteps()) {
|
|
20220
|
+
try {
|
|
20221
|
+
if (isWorkflowRunActive(row.runId) || isStepExecuting(row.stepId))
|
|
20222
|
+
continue;
|
|
20223
|
+
const run = await getWorkflowRun2(row.runId);
|
|
20224
|
+
if (!run || run.status !== "running" && run.status !== "waiting")
|
|
20225
|
+
continue;
|
|
20226
|
+
const workflow = await getWorkflow2(run.workflowId);
|
|
20227
|
+
const node = workflow?.definition.nodes.find((n) => n.id === row.nodeId);
|
|
20228
|
+
if (!workflow || !node)
|
|
20229
|
+
continue;
|
|
20230
|
+
if (isWorkflowRunActive(row.runId))
|
|
20231
|
+
continue;
|
|
20232
|
+
await walkGraph(workflow.definition, row.runId, run.context ?? {}, [node], registry, workflow.id, getSecretInputKeys(workflow.input));
|
|
20233
|
+
recovered++;
|
|
20234
|
+
} catch (err) {
|
|
20235
|
+
if (await failRunOnUnreadableReplay(row.runId, err))
|
|
20236
|
+
continue;
|
|
20237
|
+
console.error(`[workflows] Failed to recover sub-workflow step ${row.stepId}:`, err);
|
|
20238
|
+
}
|
|
20239
|
+
}
|
|
20240
|
+
return recovered;
|
|
20241
|
+
}
|
|
20184
20242
|
function retryPendingNodeIds(steps) {
|
|
20185
20243
|
const nodeIds = new Set;
|
|
20186
20244
|
for (const step of steps) {
|
|
@@ -20194,6 +20252,8 @@ async function completeIfSettled(runId, ctx) {
|
|
|
20194
20252
|
const run = await getWorkflowRun2(runId);
|
|
20195
20253
|
if (run?.status !== "running")
|
|
20196
20254
|
return false;
|
|
20255
|
+
if (await getRunLineageBlock(runId))
|
|
20256
|
+
return false;
|
|
20197
20257
|
const steps = await getWorkflowRunStepsByRunId2(runId);
|
|
20198
20258
|
if (retryPendingNodeIds(steps).size > 0)
|
|
20199
20259
|
return false;
|
|
@@ -20386,6 +20446,7 @@ async function getRunIdsByStatus(status) {
|
|
|
20386
20446
|
}
|
|
20387
20447
|
// src/workflows/retry-poller.ts
|
|
20388
20448
|
init_db3();
|
|
20449
|
+
init_workflow_runs();
|
|
20389
20450
|
var pollerTimeout = null;
|
|
20390
20451
|
function startRetryPoller(registry, intervalMs = 5000) {
|
|
20391
20452
|
if (pollerTimeout !== null)
|
|
@@ -20402,6 +20463,14 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20402
20463
|
const workflow = await getWorkflow2(run.workflowId);
|
|
20403
20464
|
if (!workflow)
|
|
20404
20465
|
continue;
|
|
20466
|
+
const foreachParent = resolveForeachParent(workflow.definition, step.nodeId);
|
|
20467
|
+
if (foreachParent) {
|
|
20468
|
+
if (!await claimRetry(run.id, step.id, { requeueForeachChild: true }))
|
|
20469
|
+
continue;
|
|
20470
|
+
console.log(`[workflows] Retrying foreach item ${step.nodeId} (attempt ${step.retryCount}) for run ${step.runId}`);
|
|
20471
|
+
await runForeachDrive(run.id, foreachParent.id, registry);
|
|
20472
|
+
continue;
|
|
20473
|
+
}
|
|
20405
20474
|
const node = workflow.definition.nodes.find((n) => n.id === step.nodeId);
|
|
20406
20475
|
if (!node)
|
|
20407
20476
|
continue;
|
|
@@ -20409,6 +20478,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20409
20478
|
release = holdWorkflowRun(run.id);
|
|
20410
20479
|
if (!await claimRetry(run.id, step.id))
|
|
20411
20480
|
continue;
|
|
20481
|
+
const fence = { retryCount: step.retryCount };
|
|
20412
20482
|
const {
|
|
20413
20483
|
ctx,
|
|
20414
20484
|
inputCtx,
|
|
@@ -20416,7 +20486,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20416
20486
|
scriptBodyUnresolved
|
|
20417
20487
|
} = await rebuildNodeExecutionInput(workflow.definition, run, node, registry);
|
|
20418
20488
|
if (scriptBodyUnresolved && scriptBodyUnresolved.length > 0) {
|
|
20419
|
-
await checkpointStepFailure(run.id, step.id, scriptBodyInterpolationError(node.id, scriptBodyUnresolved), step.retryCount);
|
|
20489
|
+
await checkpointStepFailure(run.id, step.id, scriptBodyInterpolationError(node.id, scriptBodyUnresolved), step.retryCount, undefined, { fence });
|
|
20420
20490
|
continue;
|
|
20421
20491
|
}
|
|
20422
20492
|
const executor = registry.get(node.type);
|
|
@@ -20436,8 +20506,8 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20436
20506
|
meta
|
|
20437
20507
|
});
|
|
20438
20508
|
if (result.status === "failed") {
|
|
20439
|
-
const retryPolicy = node.retry || executor.retryPolicy;
|
|
20440
|
-
await checkpointStepFailure(run.id, step.id, result.error || "Retry failed", step.retryCount, retryPolicy);
|
|
20509
|
+
const retryPolicy = result.retryable === false ? undefined : node.retry || executor.retryPolicy;
|
|
20510
|
+
await checkpointStepFailure(run.id, step.id, result.error || "Retry failed", step.retryCount, retryPolicy, { fence, output: result.output });
|
|
20441
20511
|
} else if ("async" in result && result.async && result.waitFor === FOREACH_ITEMS_WAIT_FOR) {
|
|
20442
20512
|
const drive = await parkAndDriveForeach({
|
|
20443
20513
|
runId: run.id,
|
|
@@ -20457,12 +20527,16 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20457
20527
|
const waiting = await checkpointStepWaiting(run.id, step.id, ctx);
|
|
20458
20528
|
if (!waiting)
|
|
20459
20529
|
continue;
|
|
20530
|
+
if (result.waitFor === "workflow.child.finished") {
|
|
20531
|
+
const { resumeFromChildRun } = await import("./resume-frdtgfa0.js");
|
|
20532
|
+
await resumeFromChildRun(step.id, registry);
|
|
20533
|
+
}
|
|
20460
20534
|
} else {
|
|
20461
20535
|
let validationPassed;
|
|
20462
20536
|
if (node.validation) {
|
|
20463
20537
|
const validationResult = await runStepValidation(registry, node, result.output, ctx, meta);
|
|
20464
20538
|
if (validationResult.outcome === "halt") {
|
|
20465
|
-
await checkpointStepFailure(run.id, step.id, "Validation failed (mustPass)", step.retryCount);
|
|
20539
|
+
await checkpointStepFailure(run.id, step.id, "Validation failed (mustPass)", step.retryCount, undefined, { fence });
|
|
20466
20540
|
continue;
|
|
20467
20541
|
}
|
|
20468
20542
|
if (validationResult.outcome === "retry") {
|
|
@@ -20472,13 +20546,15 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20472
20546
|
ctx[historyKey] = [...existing, validationResult.retryContext];
|
|
20473
20547
|
}
|
|
20474
20548
|
const retryPolicy = node.validation.retry || node.retry;
|
|
20475
|
-
await checkpointStepFailure(run.id, step.id, "Validation failed, retrying", step.retryCount, retryPolicy);
|
|
20549
|
+
await checkpointStepFailure(run.id, step.id, "Validation failed, retrying", step.retryCount, retryPolicy, { fence });
|
|
20476
20550
|
continue;
|
|
20477
20551
|
}
|
|
20478
20552
|
validationPassed = validationResult.passed;
|
|
20479
20553
|
}
|
|
20480
20554
|
result.nextPort = resolveValidationPort(node.next, result.nextPort, validationPassed);
|
|
20481
|
-
await checkpointStep(run.id, step.id, step.nodeId, result, ctx)
|
|
20555
|
+
if (!await checkpointStep(run.id, step.id, step.nodeId, result, ctx, { fence })) {
|
|
20556
|
+
continue;
|
|
20557
|
+
}
|
|
20482
20558
|
const port = result.nextPort || "default";
|
|
20483
20559
|
const successors = getSuccessors(workflow.definition, step.nodeId, port);
|
|
20484
20560
|
if (successors.length > 0) {
|
|
@@ -20492,7 +20568,9 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20492
20568
|
continue;
|
|
20493
20569
|
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
20494
20570
|
const retryPolicy = node.retry || executor.retryPolicy;
|
|
20495
|
-
await checkpointStepFailure(run.id, step.id, errorMsg, step.retryCount, retryPolicy
|
|
20571
|
+
await checkpointStepFailure(run.id, step.id, errorMsg, step.retryCount, retryPolicy, {
|
|
20572
|
+
fence
|
|
20573
|
+
});
|
|
20496
20574
|
}
|
|
20497
20575
|
} catch (err) {
|
|
20498
20576
|
if (await failRunOnUnreadableReplay(step.runId, err, step.id))
|
|
@@ -20509,13 +20587,23 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20509
20587
|
}
|
|
20510
20588
|
pollerTimeout = setTimeout(poll, intervalMs);
|
|
20511
20589
|
}
|
|
20512
|
-
async function claimRetry(runId, stepId) {
|
|
20590
|
+
async function claimRetry(runId, stepId, options = {}) {
|
|
20513
20591
|
return getDbClient2().transaction(async () => {
|
|
20514
20592
|
const run = await getWorkflowRun2(runId);
|
|
20515
20593
|
if (!run || !RETRYABLE_RUN_STATUSES.has(run.status))
|
|
20516
20594
|
return false;
|
|
20595
|
+
if (await getRunLineageBlock(runId)) {
|
|
20596
|
+
await disarmWorkflowTreeRetries([runId], new Date().toISOString());
|
|
20597
|
+
return false;
|
|
20598
|
+
}
|
|
20599
|
+
if (options.requeueForeachChild && run.status === "failed") {
|
|
20600
|
+
await getDbClient2().run(`UPDATE workflow_run_steps SET nextRetryAt = NULL, finishedAt = ?
|
|
20601
|
+
WHERE id = ? AND runId = ? AND status = 'failed' AND nextRetryAt IS NOT NULL`, [new Date().toISOString(), stepId, runId]);
|
|
20602
|
+
return false;
|
|
20603
|
+
}
|
|
20604
|
+
const set = options.requeueForeachChild ? "status = 'pending', nextRetryAt = NULL, error = NULL" : "status = 'running', nextRetryAt = NULL";
|
|
20517
20605
|
const claimed = await getDbClient2().get(`UPDATE workflow_run_steps
|
|
20518
|
-
SET
|
|
20606
|
+
SET ${set}
|
|
20519
20607
|
WHERE id = ? AND runId = ? AND status = 'failed' AND nextRetryAt IS NOT NULL
|
|
20520
20608
|
RETURNING id`, [stepId, runId]);
|
|
20521
20609
|
if (!claimed)
|
|
@@ -20531,6 +20619,8 @@ async function completeRunIfSettled(runId, ctx) {
|
|
|
20531
20619
|
const run = await getWorkflowRun2(runId);
|
|
20532
20620
|
if (!run || run.status !== "running" && run.status !== "waiting")
|
|
20533
20621
|
return;
|
|
20622
|
+
if (await getRunLineageBlock(runId))
|
|
20623
|
+
return;
|
|
20534
20624
|
const steps = await getWorkflowRunStepsByRunId2(runId);
|
|
20535
20625
|
const live = steps.some((s) => s.status === "running" || s.status === "waiting" || s.status === "failed" && s.nextRetryAt != null);
|
|
20536
20626
|
if (live)
|
|
@@ -21121,7 +21211,7 @@ class NotifyExecutor extends BaseExecutor {
|
|
|
21121
21211
|
}
|
|
21122
21212
|
}
|
|
21123
21213
|
case "slack": {
|
|
21124
|
-
const { getSlackApp } = await import("./app-
|
|
21214
|
+
const { getSlackApp } = await import("./app-ctn8gsgx.js");
|
|
21125
21215
|
const app = getSlackApp();
|
|
21126
21216
|
if (!app) {
|
|
21127
21217
|
return {
|
|
@@ -21247,7 +21337,7 @@ var RawLlmOutputSchema = object2({
|
|
|
21247
21337
|
async function executeRawLlm(config) {
|
|
21248
21338
|
let modelName = config.model ?? "google/gemini-3-flash-preview";
|
|
21249
21339
|
try {
|
|
21250
|
-
const { createOpenAI } = await import("./index-
|
|
21340
|
+
const { createOpenAI } = await import("./index-p4xfz37z.js");
|
|
21251
21341
|
const llmConfig = await resolveWorkflowLlmConfig(config.model);
|
|
21252
21342
|
modelName = llmConfig.model;
|
|
21253
21343
|
const provider = createOpenAI({
|
|
@@ -21257,7 +21347,7 @@ async function executeRawLlm(config) {
|
|
|
21257
21347
|
});
|
|
21258
21348
|
const model = provider(llmConfig.model);
|
|
21259
21349
|
if (config.schema) {
|
|
21260
|
-
const { generateObject, jsonSchema } = await import("./index-
|
|
21350
|
+
const { generateObject, jsonSchema } = await import("./index-9pn1pfkf.js");
|
|
21261
21351
|
const { object } = await generateObject({
|
|
21262
21352
|
model,
|
|
21263
21353
|
schema: jsonSchema(config.schema),
|
|
@@ -21271,7 +21361,7 @@ async function executeRawLlm(config) {
|
|
|
21271
21361
|
output: { result: object, model: modelName }
|
|
21272
21362
|
};
|
|
21273
21363
|
}
|
|
21274
|
-
const { generateText } = await import("./index-
|
|
21364
|
+
const { generateText } = await import("./index-9pn1pfkf.js");
|
|
21275
21365
|
const { text } = await generateText({
|
|
21276
21366
|
model,
|
|
21277
21367
|
prompt: config.prompt
|
|
@@ -21711,8 +21801,8 @@ class ValidateExecutor extends BaseExecutor {
|
|
|
21711
21801
|
const interpolatedPrompt = this.deps.interpolate(prompt, context);
|
|
21712
21802
|
const outputStr = typeof targetOutput === "string" ? targetOutput : JSON.stringify(targetOutput);
|
|
21713
21803
|
try {
|
|
21714
|
-
const { createOpenAI } = await import("./index-
|
|
21715
|
-
const { generateObject, jsonSchema } = await import("./index-
|
|
21804
|
+
const { createOpenAI } = await import("./index-p4xfz37z.js");
|
|
21805
|
+
const { generateObject, jsonSchema } = await import("./index-9pn1pfkf.js");
|
|
21716
21806
|
const llmConfig = await resolveWorkflowLlmConfig();
|
|
21717
21807
|
const provider = createOpenAI({
|
|
21718
21808
|
baseURL: llmConfig.baseURL,
|
|
@@ -24505,7 +24595,7 @@ function setPreloadedTools(server, names) {
|
|
|
24505
24595
|
async function applyPreToolCall(name, args, requestInfo, inputSchema) {
|
|
24506
24596
|
if (requestInfo.callOrigin !== "mcp")
|
|
24507
24597
|
return { args };
|
|
24508
|
-
const dispatcher = await import("./dispatcher-
|
|
24598
|
+
const dispatcher = await import("./dispatcher-7b8e4z2j.js");
|
|
24509
24599
|
const result = await dispatcher.dispatchPre("pre.tool.call", { tool: name, args, requestInfo }, inputSchema ? {
|
|
24510
24600
|
validateModify: async (data) => {
|
|
24511
24601
|
const schema = normalizeObjectSchema(inputSchema) ?? inputSchema;
|
|
@@ -25540,6 +25630,10 @@ var onTaskCreated = observed("task.created", async (data) => {
|
|
|
25540
25630
|
if (task)
|
|
25541
25631
|
await dispatchPost2("post.task.created", { task }, { skipExtensionId: extensionIdForAgent2(task.creatorAgentId) });
|
|
25542
25632
|
});
|
|
25633
|
+
var onTaskBlocked = observed("task.create_blocked", async (data) => {
|
|
25634
|
+
const { skipExtensionId, ...event } = data;
|
|
25635
|
+
await dispatchPost2("post.task.blocked", event, { skipExtensionId });
|
|
25636
|
+
});
|
|
25543
25637
|
var onTaskCompleted = observed("task.completed", async (data) => {
|
|
25544
25638
|
const task = await taskFrom(data);
|
|
25545
25639
|
if (!task)
|
|
@@ -25767,6 +25861,7 @@ function initExtensionPostBridge() {
|
|
|
25767
25861
|
return;
|
|
25768
25862
|
subscribed = true;
|
|
25769
25863
|
workflowEventBus2.on("task.created", onTaskCreated);
|
|
25864
|
+
workflowEventBus2.on("task.create_blocked", onTaskBlocked);
|
|
25770
25865
|
workflowEventBus2.on("task.completed", onTaskCompleted);
|
|
25771
25866
|
workflowEventBus2.on("task.failed", onTaskFailed);
|
|
25772
25867
|
workflowEventBus2.on("task.cancelled", onTaskCancelled);
|
|
@@ -25787,6 +25882,7 @@ function teardownExtensionPostBridge() {
|
|
|
25787
25882
|
return;
|
|
25788
25883
|
subscribed = false;
|
|
25789
25884
|
workflowEventBus2.off("task.created", onTaskCreated);
|
|
25885
|
+
workflowEventBus2.off("task.create_blocked", onTaskBlocked);
|
|
25790
25886
|
workflowEventBus2.off("task.completed", onTaskCompleted);
|
|
25791
25887
|
workflowEventBus2.off("task.failed", onTaskFailed);
|
|
25792
25888
|
workflowEventBus2.off("task.cancelled", onTaskCancelled);
|
|
@@ -26322,6 +26418,10 @@ function runContext2(event, payload) {
|
|
|
26322
26418
|
agentId = requestAgent ?? stringField(payload, "options", "agentId");
|
|
26323
26419
|
subject = `${stringField(payload, "origin") ?? "?"}: ${snippet(field(payload, "description"))}`;
|
|
26324
26420
|
break;
|
|
26421
|
+
case "post.task.blocked":
|
|
26422
|
+
agentId = stringField(payload, "requester", "agentId");
|
|
26423
|
+
subject = `${stringField(payload, "origin") ?? "?"}: ${stringField(payload, "extension", "name") ?? "?"}`;
|
|
26424
|
+
break;
|
|
26325
26425
|
case "pre.task.followUp":
|
|
26326
26426
|
agentId = stringField(payload, "workerAgentId");
|
|
26327
26427
|
subject = `task ${stringField(payload, "completedTask", "id") ?? "?"} ${stringField(payload, "status") ?? ""}`.trim();
|
|
@@ -26603,10 +26703,48 @@ var MODIFIABLE_OPTION_KEY_SET = new Set(MODIFIABLE_OPTION_KEYS);
|
|
|
26603
26703
|
function warnDroppedKey(extensionName, key) {
|
|
26604
26704
|
console.warn(scrubSecrets(`[extensions] pre.task.create ignored disallowed key "${key}" from extension "${extensionName}"`));
|
|
26605
26705
|
}
|
|
26706
|
+
function scrubFields(fields) {
|
|
26707
|
+
return Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined).map(([key, value]) => [key, typeof value === "string" ? scrubSecrets(value) : value]));
|
|
26708
|
+
}
|
|
26606
26709
|
async function applyPreTaskCreate(args) {
|
|
26607
26710
|
const creatingExtensionId = extensionIdForAgent2(args.requestInfo?.agentId);
|
|
26608
26711
|
const creatingExtension = creatingExtensionId ? listRegistered2().find((loaded) => loaded.record.id === creatingExtensionId) : undefined;
|
|
26609
26712
|
const origin = creatingExtension ? `extension:${creatingExtension.record.name}` : args.origin;
|
|
26713
|
+
const blocked = (reason, extension) => {
|
|
26714
|
+
const { options, requestInfo } = args;
|
|
26715
|
+
const event = {
|
|
26716
|
+
extension,
|
|
26717
|
+
reason: scrubSecrets(reason),
|
|
26718
|
+
origin,
|
|
26719
|
+
source: options.source,
|
|
26720
|
+
requester: scrubFields({
|
|
26721
|
+
userId: options.requestedByUserId,
|
|
26722
|
+
agentId: requestInfo?.agentId ?? options.creatorAgentId,
|
|
26723
|
+
slackUserId: options.slackUserId
|
|
26724
|
+
}),
|
|
26725
|
+
context: scrubFields({
|
|
26726
|
+
contextKey: options.contextKey ?? requestInfo?.contextKey,
|
|
26727
|
+
scheduleId: options.scheduleId,
|
|
26728
|
+
workflowRunId: options.workflowRunId,
|
|
26729
|
+
workflowRunStepId: options.workflowRunStepId,
|
|
26730
|
+
parentTaskId: options.parentTaskId,
|
|
26731
|
+
vcsRepo: options.vcsRepo,
|
|
26732
|
+
vcsNumber: options.vcsNumber,
|
|
26733
|
+
slackChannelId: options.slackChannelId,
|
|
26734
|
+
slackThreadTs: options.slackThreadTs
|
|
26735
|
+
}),
|
|
26736
|
+
description: scrubSecrets(args.description).slice(0, 500)
|
|
26737
|
+
};
|
|
26738
|
+
try {
|
|
26739
|
+
workflowEventBus2.emit("task.create_blocked", {
|
|
26740
|
+
...event,
|
|
26741
|
+
skipExtensionId: creatingExtensionId
|
|
26742
|
+
});
|
|
26743
|
+
} catch (error) {
|
|
26744
|
+
console.error("[extensions] task.create_blocked event not emitted:", scrubSecrets(error instanceof Error ? error.message : String(error)));
|
|
26745
|
+
}
|
|
26746
|
+
return { kind: "blocked", reason: event.reason, extension };
|
|
26747
|
+
};
|
|
26610
26748
|
let modelEditor;
|
|
26611
26749
|
const result = await dispatchPre2("pre.task.create", {
|
|
26612
26750
|
description: args.description,
|
|
@@ -26641,11 +26779,7 @@ async function applyPreTaskCreate(args) {
|
|
|
26641
26779
|
}
|
|
26642
26780
|
});
|
|
26643
26781
|
if (result.action === "block") {
|
|
26644
|
-
return
|
|
26645
|
-
kind: "blocked",
|
|
26646
|
-
reason: result.reason,
|
|
26647
|
-
extension: result.extension
|
|
26648
|
-
};
|
|
26782
|
+
return blocked(result.reason, result.extension);
|
|
26649
26783
|
}
|
|
26650
26784
|
if (result.action === "continue") {
|
|
26651
26785
|
return { kind: "proceed", description: args.description, options: args.options };
|
|
@@ -26659,11 +26793,7 @@ async function applyPreTaskCreate(args) {
|
|
|
26659
26793
|
agentId: options.agentId
|
|
26660
26794
|
});
|
|
26661
26795
|
if (modelError) {
|
|
26662
|
-
return {
|
|
26663
|
-
kind: "blocked",
|
|
26664
|
-
reason: `pre.task.create rewrite from extension "${modelEditor.name}" is invalid: ${modelError}`,
|
|
26665
|
-
extension: modelEditor
|
|
26666
|
-
};
|
|
26796
|
+
return blocked(`pre.task.create rewrite from extension "${modelEditor.name}" is invalid: ${modelError}`, modelEditor);
|
|
26667
26797
|
}
|
|
26668
26798
|
}
|
|
26669
26799
|
return {
|
|
@@ -28610,240 +28740,6 @@ function teardownAzureDevOpsOutbound() {
|
|
|
28610
28740
|
// src/http/core.ts
|
|
28611
28741
|
init_db3();
|
|
28612
28742
|
|
|
28613
|
-
// src/be/multi-runtime.ts
|
|
28614
|
-
init_secret_scrubber();
|
|
28615
|
-
init_db3();
|
|
28616
|
-
init_users();
|
|
28617
|
-
var AGENT_MAX_TASKS_CONFIG_KEY = "AGENT_MAX_TASKS";
|
|
28618
|
-
function parseAgentMaxTasksValue(raw) {
|
|
28619
|
-
const str = raw.trim();
|
|
28620
|
-
if (!/^\d+$/.test(str))
|
|
28621
|
-
return null;
|
|
28622
|
-
const value = Number(str);
|
|
28623
|
-
return value >= 1 && value <= 100 ? value : null;
|
|
28624
|
-
}
|
|
28625
|
-
function defaultMaxTasksForAgent(agent) {
|
|
28626
|
-
return agent.isLead ? 2 : 1;
|
|
28627
|
-
}
|
|
28628
|
-
async function getAgentMaxTasksConfig(agentId) {
|
|
28629
|
-
return (await getSwarmConfigs2({ scope: "agent", scopeId: agentId, key: AGENT_MAX_TASKS_CONFIG_KEY }))[0] ?? null;
|
|
28630
|
-
}
|
|
28631
|
-
async function reconcileAgentMaxTasksPolicy(agentId) {
|
|
28632
|
-
const agent = await getAgentById2(agentId);
|
|
28633
|
-
if (!agent)
|
|
28634
|
-
return;
|
|
28635
|
-
const existing = await getAgentMaxTasksConfig(agentId);
|
|
28636
|
-
if (existing) {
|
|
28637
|
-
const authoritative = parseAgentMaxTasksValue(existing.value);
|
|
28638
|
-
if (authoritative !== null && authoritative !== (agent.maxTasks ?? 1)) {
|
|
28639
|
-
await updateAgentMaxTasks2(agentId, authoritative);
|
|
28640
|
-
}
|
|
28641
|
-
return;
|
|
28642
|
-
}
|
|
28643
|
-
await upsertSwarmConfig2({
|
|
28644
|
-
scope: "agent",
|
|
28645
|
-
scopeId: agentId,
|
|
28646
|
-
key: AGENT_MAX_TASKS_CONFIG_KEY,
|
|
28647
|
-
value: String(agent.maxTasks ?? defaultMaxTasksForAgent(agent)),
|
|
28648
|
-
description: "Logical agent max-tasks policy (seeded from agents.maxTasks)"
|
|
28649
|
-
});
|
|
28650
|
-
}
|
|
28651
|
-
async function resetAgentMaxTasksMirror(agentId) {
|
|
28652
|
-
const agent = await getAgentById2(agentId);
|
|
28653
|
-
if (!agent)
|
|
28654
|
-
return;
|
|
28655
|
-
await updateAgentMaxTasks2(agentId, defaultMaxTasksForAgent(agent));
|
|
28656
|
-
}
|
|
28657
|
-
async function upsertSwarmConfigWithPolicyMirror(data) {
|
|
28658
|
-
const scopeId = data.scope === "agent" ? data.scopeId : null;
|
|
28659
|
-
if (!scopeId || data.key !== AGENT_MAX_TASKS_CONFIG_KEY) {
|
|
28660
|
-
return upsertSwarmConfig2(data);
|
|
28661
|
-
}
|
|
28662
|
-
return await getDbClient2().transaction(async () => {
|
|
28663
|
-
const row = await upsertSwarmConfig2(data);
|
|
28664
|
-
const value = parseAgentMaxTasksValue(data.value);
|
|
28665
|
-
if (value !== null)
|
|
28666
|
-
await updateAgentMaxTasks2(scopeId, value);
|
|
28667
|
-
return row;
|
|
28668
|
-
});
|
|
28669
|
-
}
|
|
28670
|
-
function rowToRuntimeInstance(row) {
|
|
28671
|
-
let metadata = null;
|
|
28672
|
-
if (row.metadata) {
|
|
28673
|
-
try {
|
|
28674
|
-
metadata = JSON.parse(row.metadata);
|
|
28675
|
-
} catch {
|
|
28676
|
-
metadata = null;
|
|
28677
|
-
}
|
|
28678
|
-
}
|
|
28679
|
-
return {
|
|
28680
|
-
id: row.id,
|
|
28681
|
-
agentId: row.agent_id,
|
|
28682
|
-
poolId: row.pool_id ?? null,
|
|
28683
|
-
controllerId: row.controller_id ?? null,
|
|
28684
|
-
externalHandle: row.external_handle ? JSON.parse(row.external_handle) : null,
|
|
28685
|
-
provisionAttempts: row.provision_attempts ?? 0,
|
|
28686
|
-
provisionError: row.provision_error ?? null,
|
|
28687
|
-
provisionRequestedAt: row.provision_requested_at ?? null,
|
|
28688
|
-
draining: row.draining === 1,
|
|
28689
|
-
idleSince: row.idle_since ?? null,
|
|
28690
|
-
leaseExpiresAt: row.lease_expires_at ?? null,
|
|
28691
|
-
taskId: row.task_id ?? null,
|
|
28692
|
-
status: row.status,
|
|
28693
|
-
reportedSlots: row.reported_slots,
|
|
28694
|
-
credentialReady: row.credential_ready === null ? null : row.credential_ready === 1,
|
|
28695
|
-
metadata,
|
|
28696
|
-
lastSeenAt: row.last_seen_at,
|
|
28697
|
-
createdAt: row.created_at,
|
|
28698
|
-
updatedAt: row.updated_at
|
|
28699
|
-
};
|
|
28700
|
-
}
|
|
28701
|
-
function runtimeStaleThresholdMinutes() {
|
|
28702
|
-
return Number(process.env.RUNTIME_STALE_THRESHOLD_MIN) || 5;
|
|
28703
|
-
}
|
|
28704
|
-
function runtimeLivenessCutoff() {
|
|
28705
|
-
return new Date(Date.now() - runtimeStaleThresholdMinutes() * 60 * 1000).toISOString();
|
|
28706
|
-
}
|
|
28707
|
-
async function upsertRuntimeInstance(instance) {
|
|
28708
|
-
const metadataJson = instance.metadata ? JSON.stringify(instance.metadata) : null;
|
|
28709
|
-
const row = await getDbClient2().transaction(async (tx) => {
|
|
28710
|
-
const provisioning = await tx.get("SELECT id FROM runtime_instances WHERE id = ? AND status = 'provisioning' AND agent_id = ?", [instance.id, instance.agentId]);
|
|
28711
|
-
const row = await tx.get(`INSERT INTO runtime_instances (id, agent_id, status, reported_slots, metadata)
|
|
28712
|
-
VALUES (?, ?, 'active', ?, ?)
|
|
28713
|
-
ON CONFLICT(id) DO UPDATE SET
|
|
28714
|
-
status = 'active',
|
|
28715
|
-
reported_slots = excluded.reported_slots,
|
|
28716
|
-
metadata = COALESCE(excluded.metadata, runtime_instances.metadata),
|
|
28717
|
-
last_seen_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now'),
|
|
28718
|
-
updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
|
|
28719
|
-
WHERE runtime_instances.agent_id = excluded.agent_id
|
|
28720
|
-
RETURNING *`, [instance.id, instance.agentId, instance.reportedSlots, metadataJson]);
|
|
28721
|
-
if (row?.pool_id && provisioning) {
|
|
28722
|
-
await tx.run("UPDATE agents SET runtime_provision_attempts = 0, runtime_provision_retry_at = NULL WHERE id = ?", [row.agent_id]);
|
|
28723
|
-
await tx.run("UPDATE runtime_pools SET consecutive_failures = 0, circuit_open_until = NULL WHERE id = ?", [row.pool_id]);
|
|
28724
|
-
}
|
|
28725
|
-
return row;
|
|
28726
|
-
});
|
|
28727
|
-
return row ? rowToRuntimeInstance(row) : null;
|
|
28728
|
-
}
|
|
28729
|
-
async function getRuntimeInstanceById(id) {
|
|
28730
|
-
const row = await getDbClient2().get("SELECT * FROM runtime_instances WHERE id = ?", [id]);
|
|
28731
|
-
return row ? rowToRuntimeInstance(row) : null;
|
|
28732
|
-
}
|
|
28733
|
-
async function insertProvisioningRuntime(instance) {
|
|
28734
|
-
const row = await getDbClient2().get(`INSERT INTO runtime_instances (id, agent_id, pool_id, controller_id, status,
|
|
28735
|
-
reported_slots, provision_requested_at)
|
|
28736
|
-
VALUES (?, ?, ?, ?, 'provisioning', ?, ?) RETURNING *`, [
|
|
28737
|
-
instance.id,
|
|
28738
|
-
instance.agentId,
|
|
28739
|
-
instance.poolId,
|
|
28740
|
-
instance.controllerId,
|
|
28741
|
-
instance.reportedSlots ?? 1,
|
|
28742
|
-
new Date().toISOString()
|
|
28743
|
-
]);
|
|
28744
|
-
return rowToRuntimeInstance(row);
|
|
28745
|
-
}
|
|
28746
|
-
async function markRuntimeTerminated(id, reason) {
|
|
28747
|
-
await getDbClient2().transaction(async () => {
|
|
28748
|
-
const runtime = await getRuntimeInstanceById(id);
|
|
28749
|
-
if (!runtime)
|
|
28750
|
-
return;
|
|
28751
|
-
await markRuntimeInstanceOffline(id, runtime.agentId);
|
|
28752
|
-
if (runtime.status === "provisioning") {
|
|
28753
|
-
await getDbClient2().run("UPDATE runtime_instances SET provision_error = ? WHERE id = ?", [
|
|
28754
|
-
scrubSecrets(reason),
|
|
28755
|
-
id
|
|
28756
|
-
]);
|
|
28757
|
-
}
|
|
28758
|
-
await reconcileAgentStatusFromRuntimes(runtime.agentId);
|
|
28759
|
-
await revokeRuntimeTokensForRuntime(id);
|
|
28760
|
-
});
|
|
28761
|
-
}
|
|
28762
|
-
async function touchRuntimeInstance(id, agentId) {
|
|
28763
|
-
const result = await getDbClient2().run(`UPDATE runtime_instances
|
|
28764
|
-
SET last_seen_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now'),
|
|
28765
|
-
updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
|
|
28766
|
-
WHERE id = ? AND agent_id = ? AND status = 'active' AND last_seen_at >= ?`, [id, agentId, runtimeLivenessCutoff()]);
|
|
28767
|
-
return result.changes > 0;
|
|
28768
|
-
}
|
|
28769
|
-
async function markRuntimeInstanceOffline(id, agentId) {
|
|
28770
|
-
const row = await getDbClient2().get(`UPDATE runtime_instances
|
|
28771
|
-
SET status = 'offline', updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
|
|
28772
|
-
WHERE id = ? AND agent_id = ? RETURNING *`, [id, agentId]);
|
|
28773
|
-
return row ? rowToRuntimeInstance(row) : null;
|
|
28774
|
-
}
|
|
28775
|
-
async function countActiveRuntimeInstancesForAgent(agentId) {
|
|
28776
|
-
const result = await getDbClient2().get(`SELECT COUNT(*) as count FROM runtime_instances
|
|
28777
|
-
WHERE agent_id = ? AND status = 'active' AND last_seen_at >= ?`, [agentId, runtimeLivenessCutoff()]);
|
|
28778
|
-
return result?.count ?? 0;
|
|
28779
|
-
}
|
|
28780
|
-
async function listRuntimeInstancesForAgent(agentId) {
|
|
28781
|
-
const rows = await getDbClient2().query(`SELECT *, (status = 'active' AND last_seen_at >= ?) AS is_live
|
|
28782
|
-
FROM runtime_instances
|
|
28783
|
-
WHERE agent_id = ?
|
|
28784
|
-
ORDER BY created_at ASC, id ASC`, [runtimeLivenessCutoff(), agentId]);
|
|
28785
|
-
return rows.map((row) => ({ ...rowToRuntimeInstance(row), isLive: row.is_live === 1 }));
|
|
28786
|
-
}
|
|
28787
|
-
async function setRuntimeCredentialReady(id, agentId, ready) {
|
|
28788
|
-
const result = await getDbClient2().run(`UPDATE runtime_instances
|
|
28789
|
-
SET credential_ready = ?, updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
|
|
28790
|
-
WHERE id = ? AND agent_id = ? AND status = 'active' AND last_seen_at >= ?`, [ready ? 1 : 0, id, agentId, runtimeLivenessCutoff()]);
|
|
28791
|
-
return result.changes > 0;
|
|
28792
|
-
}
|
|
28793
|
-
async function hasReadyLiveRuntime(agentId) {
|
|
28794
|
-
const row = await getDbClient2().get(`SELECT COUNT(*) c FROM runtime_instances
|
|
28795
|
-
WHERE agent_id = ? AND status = 'active' AND last_seen_at >= ?
|
|
28796
|
-
AND (credential_ready IS NULL OR credential_ready = 1)`, [agentId, runtimeLivenessCutoff()]);
|
|
28797
|
-
return (row?.c ?? 0) > 0;
|
|
28798
|
-
}
|
|
28799
|
-
async function reconcileAgentStatusFromRuntimes(agentId) {
|
|
28800
|
-
await getDbClient2().transaction(async () => {
|
|
28801
|
-
const agent = await getAgentById2(agentId);
|
|
28802
|
-
if (!agent)
|
|
28803
|
-
return;
|
|
28804
|
-
if (await countActiveRuntimeInstancesForAgent(agentId) === 0) {
|
|
28805
|
-
if (agent.status !== "offline")
|
|
28806
|
-
await updateAgentStatus2(agentId, "offline");
|
|
28807
|
-
return;
|
|
28808
|
-
}
|
|
28809
|
-
if (!await hasReadyLiveRuntime(agentId)) {
|
|
28810
|
-
if (agent.status !== "waiting_for_credentials") {
|
|
28811
|
-
await updateAgentStatus2(agentId, "waiting_for_credentials");
|
|
28812
|
-
}
|
|
28813
|
-
return;
|
|
28814
|
-
}
|
|
28815
|
-
const next = await getActiveTaskCount2(agentId) > 0 ? "busy" : "idle";
|
|
28816
|
-
if (agent.status !== next)
|
|
28817
|
-
await updateAgentStatus2(agentId, next);
|
|
28818
|
-
});
|
|
28819
|
-
}
|
|
28820
|
-
async function agentsWithLiveRuntime() {
|
|
28821
|
-
const rows = await getDbClient2().query(`SELECT DISTINCT agent_id FROM runtime_instances
|
|
28822
|
-
WHERE status = 'active' AND last_seen_at >= ?`, [runtimeLivenessCutoff()]);
|
|
28823
|
-
return new Set(rows.map((r) => r.agent_id));
|
|
28824
|
-
}
|
|
28825
|
-
async function expireStaleRuntimeInstances() {
|
|
28826
|
-
if (!isMultiRuntimeEnabled()) {
|
|
28827
|
-
return { expired: 0, agentsOffline: 0, pruned: 0 };
|
|
28828
|
-
}
|
|
28829
|
-
return await getDbClient2().transaction(async (tx) => {
|
|
28830
|
-
const cutoff = runtimeLivenessCutoff();
|
|
28831
|
-
const stale = await tx.query(`SELECT id, agent_id FROM runtime_instances
|
|
28832
|
-
WHERE status = 'active' AND last_seen_at < ? AND pool_id IS NULL`, [cutoff]);
|
|
28833
|
-
const pruned = (await tx.run("DELETE FROM runtime_instances WHERE last_seen_at < ? AND status != 'provisioning' AND (pool_id IS NULL OR status = 'offline')", [cutoff])).changes;
|
|
28834
|
-
let agentsOffline = 0;
|
|
28835
|
-
for (const agentId of new Set(stale.map((r) => r.agent_id))) {
|
|
28836
|
-
await reconcileAgentStatusFromRuntimes(agentId);
|
|
28837
|
-
if ((await getAgentById2(agentId))?.status === "offline")
|
|
28838
|
-
agentsOffline++;
|
|
28839
|
-
}
|
|
28840
|
-
return { expired: stale.length, agentsOffline, pruned };
|
|
28841
|
-
});
|
|
28842
|
-
}
|
|
28843
|
-
async function listRuntimeInstancesForPool(poolId) {
|
|
28844
|
-
return (await getDbClient2().query("SELECT * FROM runtime_instances WHERE pool_id = ? ORDER BY created_at", [poolId])).map(rowToRuntimeInstance);
|
|
28845
|
-
}
|
|
28846
|
-
|
|
28847
28743
|
// src/be/rbac-audit.ts
|
|
28848
28744
|
init_env_flag();
|
|
28849
28745
|
init_db3();
|
|
@@ -33556,7 +33452,7 @@ async function handleChatInbound(thread, message, kind) {
|
|
|
33556
33452
|
}
|
|
33557
33453
|
}
|
|
33558
33454
|
if (text || attachments.length > 0) {
|
|
33559
|
-
const acknowledge = kind !== "subscribed";
|
|
33455
|
+
const acknowledge = kind !== "subscribed" || isDirectMessage || mentioned || facts.replyToBot;
|
|
33560
33456
|
bufferChatMessage(thread.id, {
|
|
33561
33457
|
messageId: message.id,
|
|
33562
33458
|
channelId: thread.channelId,
|
|
@@ -35130,7 +35026,7 @@ async function notifySlack(text) {
|
|
|
35130
35026
|
return;
|
|
35131
35027
|
}
|
|
35132
35028
|
try {
|
|
35133
|
-
const { getSlackApp } = await import("./app-
|
|
35029
|
+
const { getSlackApp } = await import("./app-ctn8gsgx.js");
|
|
35134
35030
|
const app = getSlackApp();
|
|
35135
35031
|
if (!app) {
|
|
35136
35032
|
console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
|
|
@@ -35201,7 +35097,7 @@ async function deleteJiraWebhook(webhookId) {
|
|
|
35201
35097
|
console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
|
|
35202
35098
|
}
|
|
35203
35099
|
async function overwriteWebhookIds(next) {
|
|
35204
|
-
const { getDbClient } = await import("./db-
|
|
35100
|
+
const { getDbClient } = await import("./db-w759qmx0.js");
|
|
35205
35101
|
await getDbClient().transaction(async (tx) => {
|
|
35206
35102
|
const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
|
|
35207
35103
|
if (!row) {
|
|
@@ -108596,7 +108492,7 @@ async function reloadGlobalConfigsAndIntegrations() {
|
|
|
108596
108492
|
return runWithoutRequestAuth(() => reloadGlobalConfigsAndIntegrationsInner());
|
|
108597
108493
|
}
|
|
108598
108494
|
async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
108599
|
-
const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-
|
|
108495
|
+
const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-3n8m9ea2.js");
|
|
108600
108496
|
const wasEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
|
|
108601
108497
|
const updated = await loadGlobalConfigsIntoEnv(true);
|
|
108602
108498
|
await syncTelemetryEnabled("settings").catch((err) => {
|
|
@@ -108612,10 +108508,10 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
|
108612
108508
|
integrations.push("embeddings");
|
|
108613
108509
|
}
|
|
108614
108510
|
if (!wasEmbeddingsConfigured && isEmbeddingsConfigured) {
|
|
108615
|
-
import("./boot-reembed-
|
|
108511
|
+
import("./boot-reembed-w75maga2.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
|
|
108616
108512
|
console.error("[config-reload] memory backfill failed (non-fatal):", err);
|
|
108617
108513
|
});
|
|
108618
|
-
import("./boot-reembed-
|
|
108514
|
+
import("./boot-reembed-dwzfttdr.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
|
|
108619
108515
|
console.error("[config-reload] script backfill failed (non-fatal):", err);
|
|
108620
108516
|
});
|
|
108621
108517
|
}
|
|
@@ -113625,6 +113521,7 @@ init_db3();
|
|
|
113625
113521
|
|
|
113626
113522
|
// src/workflows/approval-cancel.ts
|
|
113627
113523
|
init_db3();
|
|
113524
|
+
init_workflow_runs();
|
|
113628
113525
|
init_rbac();
|
|
113629
113526
|
var LIVE_RUN_STATUSES = new Set(["running", "waiting"]);
|
|
113630
113527
|
async function cancelApprovalRequest(input) {
|
|
@@ -113699,19 +113596,23 @@ async function cancelApprovalRequestAndRun(id, data) {
|
|
|
113699
113596
|
if (!request)
|
|
113700
113597
|
return null;
|
|
113701
113598
|
let runCancelled = false;
|
|
113599
|
+
let treeRunIds = [];
|
|
113702
113600
|
const runId = request.workflowRunId;
|
|
113703
113601
|
if (runId) {
|
|
113704
|
-
const
|
|
113705
|
-
if (
|
|
113706
|
-
|
|
113602
|
+
const status = await getWorkflowRunStatus(runId);
|
|
113603
|
+
if (status && LIVE_RUN_STATUSES.has(status)) {
|
|
113604
|
+
const result = await cancelWorkflowRunRows2(runId, data.reason);
|
|
113605
|
+
runCancelled = result.cancelled;
|
|
113606
|
+
treeRunIds = result.runIds;
|
|
113707
113607
|
}
|
|
113708
113608
|
}
|
|
113709
113609
|
const slackReason = data.slackReason ?? data.reason;
|
|
113710
113610
|
client.afterCommit(async () => {
|
|
113711
113611
|
await postApprovalCancellationUpdates([request], slackReason);
|
|
113712
|
-
if (runCancelled
|
|
113713
|
-
|
|
113714
|
-
|
|
113612
|
+
if (runCancelled) {
|
|
113613
|
+
await postTreeApprovalCancellations2(treeRunIds, data.reason, {
|
|
113614
|
+
exceptRequestId: request.id
|
|
113615
|
+
});
|
|
113715
113616
|
}
|
|
113716
113617
|
});
|
|
113717
113618
|
return { request, runCancelled };
|
|
@@ -122359,8 +122260,8 @@ init_db3();
|
|
|
122359
122260
|
init_constants2();
|
|
122360
122261
|
var QuestionSchema = object2({
|
|
122361
122262
|
id: string2().describe("Unique ID for the question (used as key in responses)"),
|
|
122362
|
-
type: _enum2(["approval", "text", "single-select", "multi-select", "boolean"]).describe("Question type"),
|
|
122363
|
-
label: string2().describe("The question text displayed to the user"),
|
|
122263
|
+
type: _enum2(["approval", "text", "single-select", "multi-select", "boolean", "config"]).describe("Question type"),
|
|
122264
|
+
label: string2().optional().describe("The question text displayed to the user (required except for config, which defaults to the key)"),
|
|
122364
122265
|
required: boolean().optional().describe("Whether this question is required (default: true)"),
|
|
122365
122266
|
description: string2().optional().describe("Optional help text, rendered as markdown (code fences, images)"),
|
|
122366
122267
|
placeholder: string2().optional().describe("Placeholder text (for text type)"),
|
|
@@ -122372,13 +122273,14 @@ var QuestionSchema = object2({
|
|
|
122372
122273
|
})).optional().describe("Options (for single-select/multi-select types)"),
|
|
122373
122274
|
minSelections: number2().int().min(0).optional().describe("Min selections (for multi-select)"),
|
|
122374
122275
|
maxSelections: number2().int().min(1).optional().describe("Max selections (for multi-select)"),
|
|
122375
|
-
defaultValue: boolean().optional().describe("Default value (for boolean type)")
|
|
122276
|
+
defaultValue: boolean().optional().describe("Default value (for boolean type)"),
|
|
122277
|
+
config: ConfigQuestionSettingsSchema.optional().describe("Settings for a config question: the key and scope to set, plus options or defaultValue for non-secret keys")
|
|
122376
122278
|
});
|
|
122377
122279
|
var registerRequestHumanInputTool = (server) => {
|
|
122378
122280
|
createToolRegistrar(server)("request-human-input", {
|
|
122379
122281
|
title: "Request human input",
|
|
122380
122282
|
annotations: { destructiveHint: false },
|
|
122381
|
-
description: "Create an approval request and return at once with the request id and URL. The answer arrives later as a hitl-follow-up task. " + "Supports multiple question types: approval (yes/no), text, single-select, " + "multi-select, and
|
|
122283
|
+
description: "Create an approval request and return at once with the request id and URL. The answer arrives later as a hitl-follow-up task. " + "Supports multiple question types: approval (yes/no), text, single-select, " + "multi-select, boolean, and config. Returns the request ID and URL for the human to respond. " + "config asks a person to set one swarm config key on the dashboard; secrets are stored encrypted and you receive only {key, scope, isSecret, status, updatedAt}, never the value. " + "The dashboard renders each label and description as markdown: put long content in description, fence code with a language, and put an image URL alone on its own line to show it. " + "No Slack message is sent; share the URL yourself.",
|
|
122382
122284
|
inputSchema: object2({
|
|
122383
122285
|
title: string2().min(1).describe("Title of the approval request"),
|
|
122384
122286
|
questions: array2(QuestionSchema).min(1).describe("Questions to ask the human"),
|
|
@@ -122401,12 +122303,20 @@ var registerRequestHumanInputTool = (server) => {
|
|
|
122401
122303
|
sourceTaskId = currentTask.id;
|
|
122402
122304
|
}
|
|
122403
122305
|
}
|
|
122306
|
+
const approvers = { policy: "any" };
|
|
122307
|
+
const normalized = await normalizeApprovalQuestions(questions, {
|
|
122308
|
+
approvers,
|
|
122309
|
+
callerAgentId: requestInfo.agentId
|
|
122310
|
+
});
|
|
122311
|
+
if (!normalized.ok) {
|
|
122312
|
+
return toolErr(normalized.error, { data: { yourAgentId: requestInfo.agentId } });
|
|
122313
|
+
}
|
|
122404
122314
|
const id = crypto.randomUUID();
|
|
122405
122315
|
const request = await createApprovalRequest2({
|
|
122406
122316
|
id,
|
|
122407
122317
|
title,
|
|
122408
|
-
questions,
|
|
122409
|
-
approvers
|
|
122318
|
+
questions: normalized.questions,
|
|
122319
|
+
approvers,
|
|
122410
122320
|
sourceTaskId: sourceTaskId ?? undefined,
|
|
122411
122321
|
timeoutSeconds,
|
|
122412
122322
|
createdBy: await resolveTaskAuditUserId(sourceTaskId, requestInfo.agentId) ?? undefined
|
|
@@ -136523,7 +136433,7 @@ var registerCancelWorkflowRunTool = (server) => {
|
|
|
136523
136433
|
createToolRegistrar(server)("cancel-workflow-run", {
|
|
136524
136434
|
title: "Cancel Workflow Run",
|
|
136525
136435
|
annotations: { destructiveHint: true },
|
|
136526
|
-
description: "Cancel a running or waiting workflow run. Cancels
|
|
136436
|
+
description: "Cancel a running or waiting workflow run and every child run below it. Cancels their non-terminal steps, tasks, pending approvals and queued retries in one transaction; finished child runs keep their status. Repeating the cancel on a cancelled run finishes any child runs still open.",
|
|
136527
136437
|
inputSchema: object2({
|
|
136528
136438
|
runId: string2().uuid().describe("Workflow run ID to cancel"),
|
|
136529
136439
|
reason: string2().optional().describe("Optional reason for cancellation")
|
|
@@ -137635,4 +137545,4 @@ async function createServer(opts = {}) {
|
|
|
137635
137545
|
return server;
|
|
137636
137546
|
}
|
|
137637
137547
|
|
|
137638
|
-
export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, McpServer, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, resolveIdentity, renderIdentity, createAdditiveBuffer, taskModelPin, resumedTaskModelSelection, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, referencedBundlePaths, skillDirs, TaskCreationBlockedError, recordUnmappedIdentity, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, transcribeAudioNotes, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, notifySlackFileFailures, isRuntimePoolWakeable, isAgentReachable, hasOtherUserMention, broadcastMatches, routeMessage, extractTaskFromMessage, extractSlackMessageText, recoverIncompleteRuns, handleWebhookTrigger, verifyHmacSignature, WebhookError, snapshotAndUpdateWorkflow, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, getExecutorRegistry2, initWorkflows2, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, ExtensionAssetConflictError, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, SDK_ALLOWLIST, mcpToolNameForSdkMethod, mcpOverflowAuthError, hasKvViewArgs, resolveKvView, toolErr, createToolRegistrar, handleMcpBridge, Redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, ExtensionConfigError, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, stripSiblingBlock, createTaskWithSiblingAwareness, isInboxAllowed, isSenderAllowed, handleMessageReceived, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, repointTrackerSyncBySwarmId, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound,
|
|
137548
|
+
export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, McpServer, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, resolveIdentity, renderIdentity, createAdditiveBuffer, taskModelPin, resumedTaskModelSelection, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, referencedBundlePaths, skillDirs, TaskCreationBlockedError, recordUnmappedIdentity, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, transcribeAudioNotes, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, notifySlackFileFailures, isRuntimePoolWakeable, isAgentReachable, hasOtherUserMention, broadcastMatches, routeMessage, extractTaskFromMessage, extractSlackMessageText, recoverIncompleteRuns, handleWebhookTrigger, verifyHmacSignature, WebhookError, snapshotAndUpdateWorkflow, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, getExecutorRegistry2, initWorkflows2, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, ExtensionAssetConflictError, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, SDK_ALLOWLIST, mcpToolNameForSdkMethod, mcpOverflowAuthError, hasKvViewArgs, resolveKvView, toolErr, createToolRegistrar, handleMcpBridge, Redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, ExtensionConfigError, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, stripSiblingBlock, createTaskWithSiblingAwareness, isInboxAllowed, isSenderAllowed, handleMessageReceived, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, repointTrackerSyncBySwarmId, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, getTelemetryIngestAnchor, initApiTelemetry, syncTelemetryEnabled, isBitbucketEnabled, initBitbucket, verifyBitbucketWebhook, isDuplicateDelivery, markDeliveryProcessed, pullRequestEventOf, pullRequestCommentEventOf, handlePullRequestCreated2, handlePullRequestCommentCreated, handlePullRequestClosed, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, isChatSdkEnabled, getChatSdkConfig, errorMessage, resolveAdapterApiUrl, trackBackground, TelegramBotApiError, callTelegramBotApi, isTrustedTeamsServiceUrl, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, registerJiraWebhook, deleteJiraWebhook, isJiraEnabled, initJira, handleJiraWebhook, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, isLinearEnabled, initLinear, isCookieSafePageId, extractPageSession, extractLegacyPageSession, extractAndVerifyCookie, pageSessionSetCookies, resolveHttpRequestAuth, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, MCP_MAX_TOOL_INPUT_ELEMENTS, MCP_MAX_REQUEST_BODY_BYTES, userCtx, requestPrincipal, agentFirstPrincipal, rejectGuest, handleApps, cancelApprovalRequest, cancelApprovalRequestAndRun, getUserCommsPrefs, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, executeReadOnlyQuery, assertSelectOnlyQuery, handleDbQuery, snapshotMetric, AssetKeyAuthorizationError, authorizeAssetKeyWrite, getPageEditCounter, snapshotPage, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, scopedResourceScopeIdSchema, resolveScopedResourceId, MemoryKeyError, refreshLinks, indexMemoryContent, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, ExplicitSelfDuplicateError, applyRating, shouldPersistAutomaticTaskMemory, REBOOT_RETRY_PIN_TAG, getPinCandidateAgent, resolveLeadOnlyRecoveryAssignment, getResumeGeneration, getNextResumeGeneration, inheritedModelSelection, createWorkerTaskFollowUp, createResumeFollowUp, createRerouteDecisionTask, createPoolStarvationDecisionTask, guardTerminalTaskResultWrite, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, reservedNamespaceError, reservedRoomKeyError, updateMcpServerChecked, updateTouchesStdioExecution, canReadMemory, getLinksForMemory, expandCandidatesWithGraph, isApiDraining, drainApi, markKapsoMessageRead, sendKapsoReaction, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, changesAllowMerge, updateSwarmRepoChecked, getCombConfig, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, sessionAccessTopic, sessionPresenceRoot, RoomOperationSchema, removeAwarenessStates, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, mergeScheduleTiming, validateRecurringTiming, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, canClaim, emitBudgetRefusalSideEffects, workflowModelErrors, patchWorkflowDefinition, resolveScriptsOnlyMode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer };
|