@desplega.ai/agent-swarm 2.5.2 → 2.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-adapter-csh0zz3b.js → acp-adapter-gr2fcyyj.js} +3 -3
- package/dist/{actions-6xx079d1.js → actions-wv766ghf.js} +18 -18
- package/dist/{amp-adapter-8n6f0hz8.js → amp-adapter-speb906t.js} +3 -3
- package/dist/{app-ft6r6v23.js → app-ag29n14f.js} +3 -3
- package/dist/{assistant-vt2cyfzd.js → assistant-3x8bz3eg.js} +19 -19
- package/dist/{boot-reembed-r3e808ky.js → boot-reembed-5b3d2eea.js} +1 -1
- package/dist/{boot-reembed-tgrfy27t.js → boot-reembed-jsmfrpzf.js} +1 -1
- package/dist/{boot-scrub-sweep-masdwxkm.js → boot-scrub-sweep-s73gerxy.js} +2 -2
- package/dist/{boot-seeds-0n82qc7q.js → boot-seeds-5zmax2wr.js} +4 -4
- package/dist/{claude-adapter-s7j47k06.js → claude-adapter-hswdnm3t.js} +3 -3
- package/dist/{claude-managed-adapter-gt6pa35d.js → claude-managed-adapter-cvbzj1h6.js} +2 -2
- package/dist/{claude-managed-setup-3hzrgrnk.js → claude-managed-setup-3k8m3hhc.js} +2 -2
- package/dist/{claude-sdk-session-0zrdzyx2.js → claude-sdk-session-fkbyk66x.js} +2 -2
- package/dist/{cli-d172svcw.js → cli-1fc85mvt.js} +4 -4
- package/dist/{cli-3e9vs93g.js → cli-210xd1f4.js} +4 -4
- package/dist/{cli-vaxw3bg0.js → cli-25j01dpj.js} +3 -3
- package/dist/{cli-n6kmqngw.js → cli-35gtk1p6.js} +1 -1
- package/dist/{cli-fgn7yg5r.js → cli-3ngdk5te.js} +1 -1
- package/dist/{cli-7ccf7akh.js → cli-40jsnrjm.js} +2 -2
- package/dist/{cli-b1tv22wr.js → cli-502eqv93.js} +1 -1
- package/dist/{cli-ydg6ep51.js → cli-6n8axjv1.js} +1 -1
- package/dist/{cli-f55b6ky0.js → cli-8s5wx3nz.js} +2 -2
- package/dist/{cli-86zpfje5.js → cli-99xgw26r.js} +1 -1
- package/dist/{cli-xw9q173h.js → cli-9s05422w.js} +1 -1
- package/dist/{cli-h5d22pfs.js → cli-aecdcr77.js} +119 -282
- package/dist/{cli-w9etnnxk.js → cli-bf8ma3f1.js} +120 -50
- package/dist/{cli-15xd0j7w.js → cli-ce0ak9ms.js} +11 -11
- package/dist/{cli-y3dzwyy3.js → cli-e2ar4bp1.js} +71 -20
- package/dist/{cli-b6tnjdvx.js → cli-e8jyq7d8.js} +1 -1
- package/dist/{cli-6y43v79h.js → cli-egjggehm.js} +1 -1
- package/dist/{cli-cf63dnxj.js → cli-ewm3pwbq.js} +2 -2
- package/dist/{cli-bpbcpd8b.js → cli-fsdprwrg.js} +1 -1
- package/dist/{cli-qrjv7t18.js → cli-fzcn3d87.js} +1 -1
- package/dist/{cli-14v1sxxy.js → cli-gpsz7g88.js} +6 -6
- package/dist/{cli-wadzapwb.js → cli-hcpj2xqz.js} +1 -1
- package/dist/{cli-jmcjbjkt.js → cli-hhxjnjzs.js} +1 -1
- package/dist/{cli-j3dwd4kz.js → cli-jjznk3f7.js} +718 -108
- package/dist/{cli-csh8fnbg.js → cli-kxawjrxg.js} +147 -28
- package/dist/{cli-mntxtkhn.js → cli-mz9afxxf.js} +2 -1
- package/dist/{cli-0vgy5wfw.js → cli-n45mr7zh.js} +2 -2
- package/dist/{cli-aaqnqpyw.js → cli-p0rzjkya.js} +2 -2
- package/dist/{cli-3qv8naq8.js → cli-p6zs9h4y.js} +827 -107
- package/dist/{cli-e91vshb1.js → cli-p9rafdrb.js} +4 -4
- package/dist/{cli-edtm741g.js → cli-qgf8emrn.js} +5 -5
- package/dist/{cli-ha22h0eg.js → cli-qzme5949.js} +26 -26
- package/dist/{cli-xzge46sj.js → cli-s49hpn37.js} +2 -2
- package/dist/{cli-b63d08rs.js → cli-s53vp709.js} +1 -1
- package/dist/{cli-cyfgxnvb.js → cli-svrj71pg.js} +18 -16
- package/dist/{cli-4qkg9968.js → cli-vwn81jbs.js} +3 -3
- package/dist/{cli-f3pfn4x3.js → cli-w1zwctj2.js} +1 -1
- package/dist/{cli-kcnwn85g.js → cli-y561h5a9.js} +4 -4
- package/dist/{cli-n2918sed.js → cli-z21whrrg.js} +15 -15
- package/dist/cli.js +16 -16
- package/dist/{codex-adapter-brh2tcxr.js → codex-adapter-n8ka66vf.js} +2 -2
- package/dist/{codex-session-runner-0dnj21qs.js → codex-session-runner-fsebts37.js} +1 -1
- package/dist/{commands-1cnvseqx.js → commands-t04rt2pc.js} +2 -2
- package/dist/{controller-kc7s9xhn.js → controller-rgna04r2.js} +2 -2
- package/dist/{controllers-connect-jzx7t4bn.js → controllers-connect-bqm1rtft.js} +20 -20
- package/dist/{cursor-adapter-qpwp5sfg.js → cursor-adapter-swr2k95y.js} +1 -1
- package/dist/{db-v5ytg5pw.js → db-24ck09xy.js} +1 -1
- package/dist/{db-4vq88jkc.js → db-a4m7haw0.js} +3 -3
- package/dist/{dispatcher-trtcrqae.js → dispatcher-nwf9ss0q.js} +17 -17
- package/dist/{dsh-adapter-f20xwn1z.js → dsh-adapter-kpdnhjst.js} +2 -2
- package/dist/{external-channel-n9bymc2n.js → external-channel-j1e2p34p.js} +2 -2
- package/dist/{grok-adapter-4kpmmnr6.js → grok-adapter-qtjz0whk.js} +4 -4
- package/dist/{handlers-ptsraqa8.js → handlers-19xr6dnz.js} +20 -20
- package/dist/{heartbeat-60qtxtjf.js → heartbeat-vtesda5d.js} +20 -20
- package/dist/{hook-rbktcstg.js → hook-8wqaszda.js} +1 -1
- package/dist/{hook-ngtvh729.js → hook-b2hhj6rd.js} +1 -1
- package/dist/{http-z8xy72gp.js → http-mxcqhhcs.js} +2757 -2448
- package/dist/{index-a9nsavhx.js → index-1r8wfpzs.js} +1 -1
- package/dist/{index-cbxkmfc5.js → index-9pn1pfkf.js} +1 -1
- package/dist/{index-s193j5fh.js → index-kw2mmat7.js} +20 -20
- package/dist/{index-06qkmcx6.js → index-n1vbvta9.js} +17 -9
- package/dist/{index-6srwvd5b.js → index-p4xfz37z.js} +1 -1
- package/dist/{index-1cscynkb.js → index-spwxjgay.js} +17 -17
- package/dist/{index-r70q0xjx.js → index-srg522m6.js} +17 -17
- package/dist/{keepalive-a9srcphj.js → keepalive-dsd8rtgx.js} +3 -3
- package/dist/{lead-3devneqy.js → lead-zyerk1x2.js} +30 -30
- package/dist/{maintenance-0er16h2y.js → maintenance-jqmqwnet.js} +1 -1
- package/dist/{oauth-refresh-sweep-b65jcyw2.js → oauth-refresh-sweep-q2c3bnvm.js} +2 -2
- package/dist/{onboard-wqywz5py.js → onboard-w4yd7s8t.js} +2 -2
- package/dist/{opencode-adapter-e56086m1.js → opencode-adapter-9tppvxar.js} +2 -2
- package/dist/{otel-impl-vk32s884.js → otel-impl-f36byzbd.js} +1 -1
- package/dist/{pricing-refresh-t27anv4z.js → pricing-refresh-xvak5p4v.js} +3 -3
- package/dist/{rbac-roles-bmcgsxjn.js → rbac-roles-682k2mt5.js} +1 -1
- package/dist/{rbac-roles-452665y0.js → rbac-roles-gfn30fb8.js} +2 -2
- package/dist/{render-v2-0ttsk2j4.js → render-v2-hgytz8nn.js} +3 -3
- package/dist/{resume-a26kvr41.js → resume-2dvq348g.js} +7 -5
- package/dist/{session-access-dgh9nkwk.js → session-access-7f21ekq9.js} +4 -4
- package/dist/{setup-9vc9qahm.js → setup-epffxtbk.js} +1 -1
- package/dist/{work-objects-vn8nkxwn.js → work-objects-xz1a5rqk.js} +20 -20
- package/dist/{worker-1x1h8vnm.js → worker-42t8emjt.js} +30 -30
- package/openapi.json +3045 -2456
- package/package.json +4 -4
- package/src/be/approval-config-question.ts +389 -0
- package/src/be/automation-preflight.ts +37 -3
- package/src/be/db/session-tree.ts +73 -15
- package/src/be/db/skill-search.ts +87 -0
- package/src/be/db/tasks/read.ts +29 -2
- package/src/be/db/workflow-runs.ts +54 -7
- package/src/be/db.ts +25 -5
- package/src/be/migrations/239_skills_fts.sql +40 -0
- package/src/be/migrations/240_workflow_run_parent_step_attempt.sql +37 -0
- package/src/be/migrations/241_skills_meta_fts.sql +39 -0
- package/src/be/swarm-config-guard.ts +23 -0
- package/src/extensions/catalog.generated.json +4 -4
- package/src/http/approval-requests.ts +209 -38
- package/src/http/config.ts +22 -37
- package/src/http/sessions.ts +27 -2
- package/src/integrations/chat-sdk/inbound.ts +5 -4
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/tests/approval-config-question.test.ts +702 -0
- package/src/tests/chat-sdk-inbound.test.ts +20 -0
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/entrypoint-gitlab-credential-helper.test.ts +273 -0
- package/src/tests/extensions-example-comms-adherence-gate.test.ts +321 -12
- package/src/tests/list-endpoint-slimming.test.ts +33 -0
- package/src/tests/migration-240-workflow-run-parent-step-attempt.test.ts +55 -0
- package/src/tests/script-connections.test.ts +6 -0
- package/src/tests/sessions-tree.test.ts +168 -1
- package/src/tests/skill-search-long-content.test.ts +193 -0
- package/src/tests/skill-search.test.ts +173 -22
- package/src/tests/workflow-sub-workflow.test.ts +538 -1
- package/src/tools/request-human-input.ts +27 -5
- package/src/types.ts +7 -0
- package/src/workflows/approval-notifications.ts +10 -3
- package/src/workflows/checkpoint.ts +69 -35
- package/src/workflows/engine.ts +234 -87
- package/src/workflows/executors/base.ts +6 -0
- package/src/workflows/executors/human-in-the-loop.ts +25 -1
- package/src/workflows/executors/sub-workflow.ts +45 -16
- package/src/workflows/recovery.ts +63 -1
- package/src/workflows/resume.ts +60 -21
- package/src/workflows/retry-poller.ts +25 -4
- package/templates/extensions/comms-adherence-gate/README.md +38 -13
- package/templates/extensions/comms-adherence-gate/hooks.ts +272 -69
- package/templates/extensions/comms-adherence-gate/manifest.json +2 -2
- package/templates/skills/turso-interaction/content.md +1 -1
- package/templates/skills/workflow-iterate/content.md +8 -1
- /package/dist/{cli-stxdrqs2.js → cli-avdvgcay.js} +0 -0
- /package/dist/{pi-mono-adapter-tzps8f38.js → pi-mono-adapter-tqsge1ay.js} +0 -0
|
@@ -111,6 +111,7 @@ import {
|
|
|
111
111
|
cancelTask2,
|
|
112
112
|
getRecentlyCancelledTasksForAgent2,
|
|
113
113
|
updateTaskProgress2,
|
|
114
|
+
getRunningSubWorkflowSteps,
|
|
114
115
|
getSettledChildRunParentSteps,
|
|
115
116
|
init_workflow_runs,
|
|
116
117
|
CHAT_SDK_ADAPTER_NAMES,
|
|
@@ -336,19 +337,19 @@ import {
|
|
|
336
337
|
recordInlineScriptRun2,
|
|
337
338
|
exports_db,
|
|
338
339
|
init_db3
|
|
339
|
-
} from "./cli-
|
|
340
|
+
} from "./cli-kxawjrxg.js";
|
|
340
341
|
import {
|
|
341
342
|
getUserGrant2,
|
|
342
343
|
init_rbac_roles
|
|
343
|
-
} from "./cli-
|
|
344
|
+
} from "./cli-99xgw26r.js";
|
|
344
345
|
import {
|
|
345
346
|
ensurePricingSeeded2,
|
|
346
347
|
ensureRbacSeeded2,
|
|
347
348
|
ensureModelProfilesSeeded2
|
|
348
|
-
} from "./cli-
|
|
349
|
+
} from "./cli-210xd1f4.js";
|
|
349
350
|
import {
|
|
350
351
|
loadModelsDevCache
|
|
351
|
-
} from "./cli-
|
|
352
|
+
} from "./cli-fsdprwrg.js";
|
|
352
353
|
import {
|
|
353
354
|
buildCatalogEntries,
|
|
354
355
|
listModelCatalog,
|
|
@@ -358,12 +359,12 @@ import {
|
|
|
358
359
|
loadModelsCatalog,
|
|
359
360
|
requestModelCatalogRefresh2,
|
|
360
361
|
startPricingRefreshLoop2
|
|
361
|
-
} from "./cli-
|
|
362
|
+
} from "./cli-n45mr7zh.js";
|
|
362
363
|
import {
|
|
363
364
|
ampPinProviderError,
|
|
364
365
|
ampPinCatalogError,
|
|
365
366
|
ampModelError
|
|
366
|
-
} from "./cli-
|
|
367
|
+
} from "./cli-9s05422w.js";
|
|
367
368
|
import {
|
|
368
369
|
notifyAutomationPreflightFailure,
|
|
369
370
|
isNeedsSetupFailure,
|
|
@@ -373,6 +374,16 @@ import {
|
|
|
373
374
|
schedulePreflightInput,
|
|
374
375
|
recordSchedulePreflightFailure,
|
|
375
376
|
BaseExecutor,
|
|
377
|
+
AGENT_MAX_TASKS_CONFIG_KEY,
|
|
378
|
+
resetAgentMaxTasksMirror,
|
|
379
|
+
upsertSwarmConfigWithPolicyMirror,
|
|
380
|
+
getRuntimeInstanceById,
|
|
381
|
+
markRuntimeTerminated,
|
|
382
|
+
touchRuntimeInstance,
|
|
383
|
+
markRuntimeInstanceOffline,
|
|
384
|
+
reconcileAgentStatusFromRuntimes,
|
|
385
|
+
ConfigQuestionSettingsSchema,
|
|
386
|
+
normalizeApprovalQuestions,
|
|
376
387
|
resolveSlackConversationId,
|
|
377
388
|
postApprovalCancellationUpdates,
|
|
378
389
|
createApprovalFollowUpTask,
|
|
@@ -400,6 +411,7 @@ import {
|
|
|
400
411
|
startWorkflowExecution2,
|
|
401
412
|
failRunOnUnreadableReplay,
|
|
402
413
|
isWorkflowRunActive,
|
|
414
|
+
isStepExecuting,
|
|
403
415
|
holdWorkflowRun,
|
|
404
416
|
walkGraph,
|
|
405
417
|
findReadyNodes,
|
|
@@ -416,7 +428,7 @@ import {
|
|
|
416
428
|
definitionNodeIds,
|
|
417
429
|
validateDefinition,
|
|
418
430
|
applyDefinitionPatch
|
|
419
|
-
} from "./cli-
|
|
431
|
+
} from "./cli-jjznk3f7.js";
|
|
420
432
|
import {
|
|
421
433
|
require_dist2,
|
|
422
434
|
publicEndpointSsrfOptions,
|
|
@@ -476,19 +488,22 @@ import {
|
|
|
476
488
|
deleteApp,
|
|
477
489
|
typecheckScript,
|
|
478
490
|
parseSkillContent
|
|
479
|
-
} from "./cli-
|
|
491
|
+
} from "./cli-p9rafdrb.js";
|
|
480
492
|
import {
|
|
481
493
|
buildAuthorizationUrl,
|
|
482
494
|
onAuthorizationRefreshed,
|
|
483
495
|
ensureAuthorizationTokenOrThrow,
|
|
484
496
|
ensureToken,
|
|
485
497
|
ensureTokenOrThrow
|
|
486
|
-
} from "./cli-
|
|
498
|
+
} from "./cli-egjggehm.js";
|
|
487
499
|
import {
|
|
488
500
|
detachedProcessGroup,
|
|
489
501
|
registerProcessGroup,
|
|
490
502
|
terminateProcessGroup
|
|
491
503
|
} from "./cli-3ggwdtb0.js";
|
|
504
|
+
import {
|
|
505
|
+
isMultiRuntimeEnabled
|
|
506
|
+
} from "./cli-e8xyjvfc.js";
|
|
492
507
|
import {
|
|
493
508
|
noteSlackInboundSideEffect,
|
|
494
509
|
terminalReactionEvent,
|
|
@@ -514,14 +529,14 @@ import {
|
|
|
514
529
|
getSlackApp2,
|
|
515
530
|
startSlackApp2,
|
|
516
531
|
stopSlackApp2
|
|
517
|
-
} from "./cli-
|
|
532
|
+
} from "./cli-ce0ak9ms.js";
|
|
518
533
|
import {
|
|
519
534
|
slackCode,
|
|
520
535
|
slackMissingScopeMessage,
|
|
521
536
|
withAutoJoin,
|
|
522
537
|
externalChannelToolError2,
|
|
523
538
|
getChannelBlockReason2
|
|
524
|
-
} from "./cli-
|
|
539
|
+
} from "./cli-s53vp709.js";
|
|
525
540
|
import {
|
|
526
541
|
workflowEventBus2,
|
|
527
542
|
init_event_bus
|
|
@@ -543,7 +558,7 @@ import {
|
|
|
543
558
|
recoverResolvedWaitState2,
|
|
544
559
|
resumeFromChildRun2,
|
|
545
560
|
initWaitBusSubscriptions2
|
|
546
|
-
} from "./cli-
|
|
561
|
+
} from "./cli-e2ar4bp1.js";
|
|
547
562
|
import {
|
|
548
563
|
duplicateGuardedQueryKey,
|
|
549
564
|
parseQueryParams,
|
|
@@ -570,10 +585,7 @@ import {
|
|
|
570
585
|
isPublicRoute,
|
|
571
586
|
findRoute,
|
|
572
587
|
route
|
|
573
|
-
} from "./cli-
|
|
574
|
-
import {
|
|
575
|
-
isMultiRuntimeEnabled
|
|
576
|
-
} from "./cli-e8xyjvfc.js";
|
|
588
|
+
} from "./cli-1fc85mvt.js";
|
|
577
589
|
import {
|
|
578
590
|
FilesError,
|
|
579
591
|
providerPath,
|
|
@@ -584,7 +596,7 @@ import {
|
|
|
584
596
|
import {
|
|
585
597
|
getRuntimePool2,
|
|
586
598
|
init_db
|
|
587
|
-
} from "./cli-
|
|
599
|
+
} from "./cli-vwn81jbs.js";
|
|
588
600
|
import {
|
|
589
601
|
getMemoryRaterNames,
|
|
590
602
|
REFERENCES_SOURCE_MAX_LENGTH,
|
|
@@ -621,11 +633,10 @@ import {
|
|
|
621
633
|
linkIdentity,
|
|
622
634
|
unlinkIdentity,
|
|
623
635
|
resolveUserByToken,
|
|
624
|
-
revokeRuntimeTokensForRuntime,
|
|
625
636
|
resolveSessionToken,
|
|
626
637
|
fingerprintApiKey,
|
|
627
638
|
init_users
|
|
628
|
-
} from "./cli-
|
|
639
|
+
} from "./cli-e8jyq7d8.js";
|
|
629
640
|
import {
|
|
630
641
|
isRbacEnabled,
|
|
631
642
|
decideAdmission,
|
|
@@ -694,7 +705,7 @@ import {
|
|
|
694
705
|
KvNamespaceSchema,
|
|
695
706
|
KvKeySchema,
|
|
696
707
|
init_types
|
|
697
|
-
} from "./cli-
|
|
708
|
+
} from "./cli-mz9afxxf.js";
|
|
698
709
|
import {
|
|
699
710
|
generateDefaultClaudeMd2,
|
|
700
711
|
generateDefaultSoulMd2,
|
|
@@ -763,7 +774,7 @@ import {
|
|
|
763
774
|
import {
|
|
764
775
|
init_package,
|
|
765
776
|
package_default
|
|
766
|
-
} from "./cli-
|
|
777
|
+
} from "./cli-y561h5a9.js";
|
|
767
778
|
import {
|
|
768
779
|
realtimeBus,
|
|
769
780
|
init_bus
|
|
@@ -20140,6 +20151,7 @@ async function recoverIncompleteRuns(registry) {
|
|
|
20140
20151
|
}
|
|
20141
20152
|
}
|
|
20142
20153
|
recovered += await recoverForeachFanouts(registry);
|
|
20154
|
+
recovered += await recoverOrphanedSubWorkflowSteps(registry);
|
|
20143
20155
|
if (recovered > 0) {
|
|
20144
20156
|
console.log(`[workflows] Recovered ${recovered} incomplete run(s)`);
|
|
20145
20157
|
}
|
|
@@ -20155,6 +20167,10 @@ async function recoverRunningRuns(registry) {
|
|
|
20155
20167
|
const run = await getWorkflowRun2(runId);
|
|
20156
20168
|
if (!run || run.status !== "running")
|
|
20157
20169
|
continue;
|
|
20170
|
+
if (run.parentStepId && run.context === undefined) {
|
|
20171
|
+
await failRunningRun(runId, "Child workflow run lost its initial context in a restart");
|
|
20172
|
+
continue;
|
|
20173
|
+
}
|
|
20158
20174
|
const workflow = await getWorkflow2(run.workflowId);
|
|
20159
20175
|
if (!workflow)
|
|
20160
20176
|
continue;
|
|
@@ -20181,6 +20197,43 @@ async function recoverRunningRuns(registry) {
|
|
|
20181
20197
|
}
|
|
20182
20198
|
return recovered;
|
|
20183
20199
|
}
|
|
20200
|
+
async function failRunningRun(runId, error) {
|
|
20201
|
+
await getDbClient2().transaction(async () => {
|
|
20202
|
+
const run = await getWorkflowRun2(runId);
|
|
20203
|
+
if (run?.status !== "running")
|
|
20204
|
+
return;
|
|
20205
|
+
await updateWorkflowRun2(runId, {
|
|
20206
|
+
status: "failed",
|
|
20207
|
+
error,
|
|
20208
|
+
finishedAt: new Date().toISOString()
|
|
20209
|
+
});
|
|
20210
|
+
});
|
|
20211
|
+
}
|
|
20212
|
+
async function recoverOrphanedSubWorkflowSteps(registry) {
|
|
20213
|
+
let recovered = 0;
|
|
20214
|
+
for (const row of await getRunningSubWorkflowSteps()) {
|
|
20215
|
+
try {
|
|
20216
|
+
if (isWorkflowRunActive(row.runId) || isStepExecuting(row.stepId))
|
|
20217
|
+
continue;
|
|
20218
|
+
const run = await getWorkflowRun2(row.runId);
|
|
20219
|
+
if (!run || run.status !== "running" && run.status !== "waiting")
|
|
20220
|
+
continue;
|
|
20221
|
+
const workflow = await getWorkflow2(run.workflowId);
|
|
20222
|
+
const node = workflow?.definition.nodes.find((n) => n.id === row.nodeId);
|
|
20223
|
+
if (!workflow || !node)
|
|
20224
|
+
continue;
|
|
20225
|
+
if (isWorkflowRunActive(row.runId))
|
|
20226
|
+
continue;
|
|
20227
|
+
await walkGraph(workflow.definition, row.runId, run.context ?? {}, [node], registry, workflow.id, getSecretInputKeys(workflow.input));
|
|
20228
|
+
recovered++;
|
|
20229
|
+
} catch (err) {
|
|
20230
|
+
if (await failRunOnUnreadableReplay(row.runId, err))
|
|
20231
|
+
continue;
|
|
20232
|
+
console.error(`[workflows] Failed to recover sub-workflow step ${row.stepId}:`, err);
|
|
20233
|
+
}
|
|
20234
|
+
}
|
|
20235
|
+
return recovered;
|
|
20236
|
+
}
|
|
20184
20237
|
function retryPendingNodeIds(steps) {
|
|
20185
20238
|
const nodeIds = new Set;
|
|
20186
20239
|
for (const step of steps) {
|
|
@@ -20409,6 +20462,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20409
20462
|
release = holdWorkflowRun(run.id);
|
|
20410
20463
|
if (!await claimRetry(run.id, step.id))
|
|
20411
20464
|
continue;
|
|
20465
|
+
const fence = { retryCount: step.retryCount };
|
|
20412
20466
|
const {
|
|
20413
20467
|
ctx,
|
|
20414
20468
|
inputCtx,
|
|
@@ -20416,7 +20470,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20416
20470
|
scriptBodyUnresolved
|
|
20417
20471
|
} = await rebuildNodeExecutionInput(workflow.definition, run, node, registry);
|
|
20418
20472
|
if (scriptBodyUnresolved && scriptBodyUnresolved.length > 0) {
|
|
20419
|
-
await checkpointStepFailure(run.id, step.id, scriptBodyInterpolationError(node.id, scriptBodyUnresolved), step.retryCount);
|
|
20473
|
+
await checkpointStepFailure(run.id, step.id, scriptBodyInterpolationError(node.id, scriptBodyUnresolved), step.retryCount, undefined, { fence });
|
|
20420
20474
|
continue;
|
|
20421
20475
|
}
|
|
20422
20476
|
const executor = registry.get(node.type);
|
|
@@ -20436,8 +20490,8 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20436
20490
|
meta
|
|
20437
20491
|
});
|
|
20438
20492
|
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);
|
|
20493
|
+
const retryPolicy = result.retryable === false ? undefined : node.retry || executor.retryPolicy;
|
|
20494
|
+
await checkpointStepFailure(run.id, step.id, result.error || "Retry failed", step.retryCount, retryPolicy, { fence, output: result.output });
|
|
20441
20495
|
} else if ("async" in result && result.async && result.waitFor === FOREACH_ITEMS_WAIT_FOR) {
|
|
20442
20496
|
const drive = await parkAndDriveForeach({
|
|
20443
20497
|
runId: run.id,
|
|
@@ -20457,12 +20511,16 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20457
20511
|
const waiting = await checkpointStepWaiting(run.id, step.id, ctx);
|
|
20458
20512
|
if (!waiting)
|
|
20459
20513
|
continue;
|
|
20514
|
+
if (result.waitFor === "workflow.child.finished") {
|
|
20515
|
+
const { resumeFromChildRun } = await import("./resume-2dvq348g.js");
|
|
20516
|
+
await resumeFromChildRun(step.id, registry);
|
|
20517
|
+
}
|
|
20460
20518
|
} else {
|
|
20461
20519
|
let validationPassed;
|
|
20462
20520
|
if (node.validation) {
|
|
20463
20521
|
const validationResult = await runStepValidation(registry, node, result.output, ctx, meta);
|
|
20464
20522
|
if (validationResult.outcome === "halt") {
|
|
20465
|
-
await checkpointStepFailure(run.id, step.id, "Validation failed (mustPass)", step.retryCount);
|
|
20523
|
+
await checkpointStepFailure(run.id, step.id, "Validation failed (mustPass)", step.retryCount, undefined, { fence });
|
|
20466
20524
|
continue;
|
|
20467
20525
|
}
|
|
20468
20526
|
if (validationResult.outcome === "retry") {
|
|
@@ -20472,13 +20530,15 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20472
20530
|
ctx[historyKey] = [...existing, validationResult.retryContext];
|
|
20473
20531
|
}
|
|
20474
20532
|
const retryPolicy = node.validation.retry || node.retry;
|
|
20475
|
-
await checkpointStepFailure(run.id, step.id, "Validation failed, retrying", step.retryCount, retryPolicy);
|
|
20533
|
+
await checkpointStepFailure(run.id, step.id, "Validation failed, retrying", step.retryCount, retryPolicy, { fence });
|
|
20476
20534
|
continue;
|
|
20477
20535
|
}
|
|
20478
20536
|
validationPassed = validationResult.passed;
|
|
20479
20537
|
}
|
|
20480
20538
|
result.nextPort = resolveValidationPort(node.next, result.nextPort, validationPassed);
|
|
20481
|
-
await checkpointStep(run.id, step.id, step.nodeId, result, ctx)
|
|
20539
|
+
if (!await checkpointStep(run.id, step.id, step.nodeId, result, ctx, { fence })) {
|
|
20540
|
+
continue;
|
|
20541
|
+
}
|
|
20482
20542
|
const port = result.nextPort || "default";
|
|
20483
20543
|
const successors = getSuccessors(workflow.definition, step.nodeId, port);
|
|
20484
20544
|
if (successors.length > 0) {
|
|
@@ -20492,7 +20552,9 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20492
20552
|
continue;
|
|
20493
20553
|
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
20494
20554
|
const retryPolicy = node.retry || executor.retryPolicy;
|
|
20495
|
-
await checkpointStepFailure(run.id, step.id, errorMsg, step.retryCount, retryPolicy
|
|
20555
|
+
await checkpointStepFailure(run.id, step.id, errorMsg, step.retryCount, retryPolicy, {
|
|
20556
|
+
fence
|
|
20557
|
+
});
|
|
20496
20558
|
}
|
|
20497
20559
|
} catch (err) {
|
|
20498
20560
|
if (await failRunOnUnreadableReplay(step.runId, err, step.id))
|
|
@@ -21121,7 +21183,7 @@ class NotifyExecutor extends BaseExecutor {
|
|
|
21121
21183
|
}
|
|
21122
21184
|
}
|
|
21123
21185
|
case "slack": {
|
|
21124
|
-
const { getSlackApp } = await import("./app-
|
|
21186
|
+
const { getSlackApp } = await import("./app-ag29n14f.js");
|
|
21125
21187
|
const app = getSlackApp();
|
|
21126
21188
|
if (!app) {
|
|
21127
21189
|
return {
|
|
@@ -21247,7 +21309,7 @@ var RawLlmOutputSchema = object2({
|
|
|
21247
21309
|
async function executeRawLlm(config) {
|
|
21248
21310
|
let modelName = config.model ?? "google/gemini-3-flash-preview";
|
|
21249
21311
|
try {
|
|
21250
|
-
const { createOpenAI } = await import("./index-
|
|
21312
|
+
const { createOpenAI } = await import("./index-p4xfz37z.js");
|
|
21251
21313
|
const llmConfig = await resolveWorkflowLlmConfig(config.model);
|
|
21252
21314
|
modelName = llmConfig.model;
|
|
21253
21315
|
const provider = createOpenAI({
|
|
@@ -21257,7 +21319,7 @@ async function executeRawLlm(config) {
|
|
|
21257
21319
|
});
|
|
21258
21320
|
const model = provider(llmConfig.model);
|
|
21259
21321
|
if (config.schema) {
|
|
21260
|
-
const { generateObject, jsonSchema } = await import("./index-
|
|
21322
|
+
const { generateObject, jsonSchema } = await import("./index-9pn1pfkf.js");
|
|
21261
21323
|
const { object } = await generateObject({
|
|
21262
21324
|
model,
|
|
21263
21325
|
schema: jsonSchema(config.schema),
|
|
@@ -21271,7 +21333,7 @@ async function executeRawLlm(config) {
|
|
|
21271
21333
|
output: { result: object, model: modelName }
|
|
21272
21334
|
};
|
|
21273
21335
|
}
|
|
21274
|
-
const { generateText } = await import("./index-
|
|
21336
|
+
const { generateText } = await import("./index-9pn1pfkf.js");
|
|
21275
21337
|
const { text } = await generateText({
|
|
21276
21338
|
model,
|
|
21277
21339
|
prompt: config.prompt
|
|
@@ -21711,8 +21773,8 @@ class ValidateExecutor extends BaseExecutor {
|
|
|
21711
21773
|
const interpolatedPrompt = this.deps.interpolate(prompt, context);
|
|
21712
21774
|
const outputStr = typeof targetOutput === "string" ? targetOutput : JSON.stringify(targetOutput);
|
|
21713
21775
|
try {
|
|
21714
|
-
const { createOpenAI } = await import("./index-
|
|
21715
|
-
const { generateObject, jsonSchema } = await import("./index-
|
|
21776
|
+
const { createOpenAI } = await import("./index-p4xfz37z.js");
|
|
21777
|
+
const { generateObject, jsonSchema } = await import("./index-9pn1pfkf.js");
|
|
21716
21778
|
const llmConfig = await resolveWorkflowLlmConfig();
|
|
21717
21779
|
const provider = createOpenAI({
|
|
21718
21780
|
baseURL: llmConfig.baseURL,
|
|
@@ -24505,7 +24567,7 @@ function setPreloadedTools(server, names) {
|
|
|
24505
24567
|
async function applyPreToolCall(name, args, requestInfo, inputSchema) {
|
|
24506
24568
|
if (requestInfo.callOrigin !== "mcp")
|
|
24507
24569
|
return { args };
|
|
24508
|
-
const dispatcher = await import("./dispatcher-
|
|
24570
|
+
const dispatcher = await import("./dispatcher-nwf9ss0q.js");
|
|
24509
24571
|
const result = await dispatcher.dispatchPre("pre.tool.call", { tool: name, args, requestInfo }, inputSchema ? {
|
|
24510
24572
|
validateModify: async (data) => {
|
|
24511
24573
|
const schema = normalizeObjectSchema(inputSchema) ?? inputSchema;
|
|
@@ -28610,240 +28672,6 @@ function teardownAzureDevOpsOutbound() {
|
|
|
28610
28672
|
// src/http/core.ts
|
|
28611
28673
|
init_db3();
|
|
28612
28674
|
|
|
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
28675
|
// src/be/rbac-audit.ts
|
|
28848
28676
|
init_env_flag();
|
|
28849
28677
|
init_db3();
|
|
@@ -33556,7 +33384,7 @@ async function handleChatInbound(thread, message, kind) {
|
|
|
33556
33384
|
}
|
|
33557
33385
|
}
|
|
33558
33386
|
if (text || attachments.length > 0) {
|
|
33559
|
-
const acknowledge = kind !== "subscribed";
|
|
33387
|
+
const acknowledge = kind !== "subscribed" || isDirectMessage || mentioned || facts.replyToBot;
|
|
33560
33388
|
bufferChatMessage(thread.id, {
|
|
33561
33389
|
messageId: message.id,
|
|
33562
33390
|
channelId: thread.channelId,
|
|
@@ -35130,7 +34958,7 @@ async function notifySlack(text) {
|
|
|
35130
34958
|
return;
|
|
35131
34959
|
}
|
|
35132
34960
|
try {
|
|
35133
|
-
const { getSlackApp } = await import("./app-
|
|
34961
|
+
const { getSlackApp } = await import("./app-ag29n14f.js");
|
|
35134
34962
|
const app = getSlackApp();
|
|
35135
34963
|
if (!app) {
|
|
35136
34964
|
console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
|
|
@@ -35201,7 +35029,7 @@ async function deleteJiraWebhook(webhookId) {
|
|
|
35201
35029
|
console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
|
|
35202
35030
|
}
|
|
35203
35031
|
async function overwriteWebhookIds(next) {
|
|
35204
|
-
const { getDbClient } = await import("./db-
|
|
35032
|
+
const { getDbClient } = await import("./db-24ck09xy.js");
|
|
35205
35033
|
await getDbClient().transaction(async (tx) => {
|
|
35206
35034
|
const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
|
|
35207
35035
|
if (!row) {
|
|
@@ -108596,7 +108424,7 @@ async function reloadGlobalConfigsAndIntegrations() {
|
|
|
108596
108424
|
return runWithoutRequestAuth(() => reloadGlobalConfigsAndIntegrationsInner());
|
|
108597
108425
|
}
|
|
108598
108426
|
async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
108599
|
-
const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-
|
|
108427
|
+
const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-1r8wfpzs.js");
|
|
108600
108428
|
const wasEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
|
|
108601
108429
|
const updated = await loadGlobalConfigsIntoEnv(true);
|
|
108602
108430
|
await syncTelemetryEnabled("settings").catch((err) => {
|
|
@@ -108612,10 +108440,10 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
|
108612
108440
|
integrations.push("embeddings");
|
|
108613
108441
|
}
|
|
108614
108442
|
if (!wasEmbeddingsConfigured && isEmbeddingsConfigured) {
|
|
108615
|
-
import("./boot-reembed-
|
|
108443
|
+
import("./boot-reembed-5b3d2eea.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
|
|
108616
108444
|
console.error("[config-reload] memory backfill failed (non-fatal):", err);
|
|
108617
108445
|
});
|
|
108618
|
-
import("./boot-reembed-
|
|
108446
|
+
import("./boot-reembed-jsmfrpzf.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
|
|
108619
108447
|
console.error("[config-reload] script backfill failed (non-fatal):", err);
|
|
108620
108448
|
});
|
|
108621
108449
|
}
|
|
@@ -122359,8 +122187,8 @@ init_db3();
|
|
|
122359
122187
|
init_constants2();
|
|
122360
122188
|
var QuestionSchema = object2({
|
|
122361
122189
|
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"),
|
|
122190
|
+
type: _enum2(["approval", "text", "single-select", "multi-select", "boolean", "config"]).describe("Question type"),
|
|
122191
|
+
label: string2().optional().describe("The question text displayed to the user (required except for config, which defaults to the key)"),
|
|
122364
122192
|
required: boolean().optional().describe("Whether this question is required (default: true)"),
|
|
122365
122193
|
description: string2().optional().describe("Optional help text, rendered as markdown (code fences, images)"),
|
|
122366
122194
|
placeholder: string2().optional().describe("Placeholder text (for text type)"),
|
|
@@ -122372,13 +122200,14 @@ var QuestionSchema = object2({
|
|
|
122372
122200
|
})).optional().describe("Options (for single-select/multi-select types)"),
|
|
122373
122201
|
minSelections: number2().int().min(0).optional().describe("Min selections (for multi-select)"),
|
|
122374
122202
|
maxSelections: number2().int().min(1).optional().describe("Max selections (for multi-select)"),
|
|
122375
|
-
defaultValue: boolean().optional().describe("Default value (for boolean type)")
|
|
122203
|
+
defaultValue: boolean().optional().describe("Default value (for boolean type)"),
|
|
122204
|
+
config: ConfigQuestionSettingsSchema.optional().describe("Settings for a config question: the key and scope to set, plus options or defaultValue for non-secret keys")
|
|
122376
122205
|
});
|
|
122377
122206
|
var registerRequestHumanInputTool = (server) => {
|
|
122378
122207
|
createToolRegistrar(server)("request-human-input", {
|
|
122379
122208
|
title: "Request human input",
|
|
122380
122209
|
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
|
|
122210
|
+
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
122211
|
inputSchema: object2({
|
|
122383
122212
|
title: string2().min(1).describe("Title of the approval request"),
|
|
122384
122213
|
questions: array2(QuestionSchema).min(1).describe("Questions to ask the human"),
|
|
@@ -122401,12 +122230,20 @@ var registerRequestHumanInputTool = (server) => {
|
|
|
122401
122230
|
sourceTaskId = currentTask.id;
|
|
122402
122231
|
}
|
|
122403
122232
|
}
|
|
122233
|
+
const approvers = { policy: "any" };
|
|
122234
|
+
const normalized = await normalizeApprovalQuestions(questions, {
|
|
122235
|
+
approvers,
|
|
122236
|
+
callerAgentId: requestInfo.agentId
|
|
122237
|
+
});
|
|
122238
|
+
if (!normalized.ok) {
|
|
122239
|
+
return toolErr(normalized.error, { data: { yourAgentId: requestInfo.agentId } });
|
|
122240
|
+
}
|
|
122404
122241
|
const id = crypto.randomUUID();
|
|
122405
122242
|
const request = await createApprovalRequest2({
|
|
122406
122243
|
id,
|
|
122407
122244
|
title,
|
|
122408
|
-
questions,
|
|
122409
|
-
approvers
|
|
122245
|
+
questions: normalized.questions,
|
|
122246
|
+
approvers,
|
|
122410
122247
|
sourceTaskId: sourceTaskId ?? undefined,
|
|
122411
122248
|
timeoutSeconds,
|
|
122412
122249
|
createdBy: await resolveTaskAuditUserId(sourceTaskId, requestInfo.agentId) ?? undefined
|
|
@@ -137635,4 +137472,4 @@ async function createServer(opts = {}) {
|
|
|
137635
137472
|
return server;
|
|
137636
137473
|
}
|
|
137637
137474
|
|
|
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,
|
|
137475
|
+
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 };
|