@desplega.ai/agent-swarm 2.5.3 → 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-gr2fcyyj.js → acp-adapter-ek38cwsv.js} +4 -4
- package/dist/{actions-wv766ghf.js → actions-92mepq03.js} +17 -17
- package/dist/{amp-adapter-speb906t.js → amp-adapter-9gaxg015.js} +2 -2
- package/dist/{app-ag29n14f.js → app-ctn8gsgx.js} +3 -3
- package/dist/{assistant-3x8bz3eg.js → assistant-zyr5kz47.js} +19 -19
- package/dist/{boot-reembed-jsmfrpzf.js → boot-reembed-dwzfttdr.js} +1 -1
- package/dist/{boot-reembed-5b3d2eea.js → boot-reembed-w75maga2.js} +1 -1
- package/dist/{boot-scrub-sweep-s73gerxy.js → boot-scrub-sweep-e9kq43kf.js} +3 -3
- package/dist/{boot-seeds-5zmax2wr.js → boot-seeds-x28v3fhb.js} +4 -4
- package/dist/{claude-adapter-hswdnm3t.js → claude-adapter-f0afqnne.js} +4 -4
- package/dist/{claude-managed-adapter-cvbzj1h6.js → claude-managed-adapter-x81a7r65.js} +3 -3
- package/dist/{claude-managed-setup-3k8m3hhc.js → claude-managed-setup-bqzwjd9x.js} +1 -1
- package/dist/{claude-sdk-session-fkbyk66x.js → claude-sdk-session-7b7whkaq.js} +9307 -9254
- package/dist/{cli-a5ebc95n.js → cli-0shx9j93.js} +16 -13
- package/dist/{cli-vwn81jbs.js → cli-19202kew.js} +3 -3
- package/dist/{cli-svrj71pg.js → cli-1r5ad7j5.js} +7 -7
- package/dist/{cli-hhxjnjzs.js → cli-25n3mv5d.js} +8 -6
- package/dist/cli-2655k16q.js +140 -0
- package/dist/{cli-hcpj2xqz.js → cli-277c31dw.js} +1 -1
- package/dist/{cli-35gtk1p6.js → cli-4b2z6n0m.js} +29 -7
- package/dist/{cli-40jsnrjm.js → cli-5bnsc0e1.js} +7 -5
- package/dist/{cli-fzcn3d87.js → cli-621ce7kw.js} +1 -1
- package/dist/{cli-s49hpn37.js → cli-64mh9mf3.js} +19 -5
- package/dist/{cli-e8jyq7d8.js → cli-6a1xg1p7.js} +6 -2
- package/dist/{cli-p9rafdrb.js → cli-7p4jxgtt.js} +4 -4
- package/dist/{cli-w1zwctj2.js → cli-9j129brq.js} +9 -3
- package/dist/{cli-ce0ak9ms.js → cli-abs8ndtr.js} +11 -11
- package/dist/{cli-aecdcr77.js → cli-asq5ydm4.js} +123 -50
- package/dist/{cli-n45mr7zh.js → cli-bvpgr9ny.js} +2 -2
- package/dist/{cli-210xd1f4.js → cli-c61mbdds.js} +3 -3
- 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-s53vp709.js → cli-eftzyh9y.js} +1 -1
- package/dist/{cli-3ngdk5te.js → cli-ethgy7ha.js} +1 -1
- package/dist/{cli-99xgw26r.js → cli-ff1tm9n9.js} +1 -1
- package/dist/{cli-ewm3pwbq.js → cli-g9vd9ece.js} +37 -12
- package/dist/{cli-jjznk3f7.js → cli-gbfxp48k.js} +62 -28
- package/dist/{cli-z21whrrg.js → cli-gn5af0x5.js} +14 -14
- package/dist/{cli-1fc85mvt.js → cli-gwhjmh8g.js} +4 -4
- package/dist/{cli-avdvgcay.js → cli-hh5we352.js} +24 -5
- package/dist/{cli-0ebey9hg.js → cli-j6rktc91.js} +1 -1
- package/dist/{cli-kxawjrxg.js → cli-jb30dzvk.js} +332 -36
- package/dist/{cli-25j01dpj.js → cli-jbnn4vxb.js} +3 -3
- package/dist/{cli-qzme5949.js → cli-k4tjsdx9.js} +44 -39
- package/dist/{cli-8s5wx3nz.js → cli-m4ecdxvz.js} +40 -13
- package/dist/{cli-ta8bd7th.js → cli-pzatvw94.js} +1 -1
- package/dist/{cli-p6zs9h4y.js → cli-rr7zx19j.js} +767 -249
- package/dist/{cli-502eqv93.js → cli-s682zgqz.js} +1 -1
- package/dist/{cli-fsdprwrg.js → cli-sbwsxvtd.js} +1 -1
- package/dist/{cli-0xk505e8.js → cli-sxgtf5fw.js} +1 -1
- package/dist/{cli-egjggehm.js → cli-tsma7p8v.js} +1 -1
- package/dist/{cli-qgf8emrn.js → cli-wghjkr0e.js} +5 -5
- package/dist/{cli-p0rzjkya.js → cli-wx2nj19m.js} +29 -10
- package/dist/{cli-e2ar4bp1.js → cli-x0f2v69c.js} +111 -42
- package/dist/{cli-y561h5a9.js → cli-xtrz6bzs.js} +5 -5
- package/dist/{cli-gpsz7g88.js → cli-xzfq4at3.js} +7 -7
- package/dist/cli.js +18 -18
- package/dist/{codex-adapter-n8ka66vf.js → codex-adapter-wch12q99.js} +2 -2
- package/dist/{codex-hook-e2he7aca.js → codex-hook-brpnycn5.js} +1 -1
- package/dist/{codex-session-runner-fsebts37.js → codex-session-runner-41pfcr95.js} +2 -2
- package/dist/{commands-t04rt2pc.js → commands-9849dkj6.js} +2 -2
- package/dist/{controller-rgna04r2.js → controller-ja0sd95p.js} +27 -1
- package/dist/{controllers-connect-bqm1rtft.js → controllers-connect-xp05dj6x.js} +16 -16
- package/dist/{cursor-adapter-swr2k95y.js → cursor-adapter-623qxqew.js} +1 -2
- package/dist/{db-a4m7haw0.js → db-47vj40dy.js} +3 -3
- package/dist/{db-24ck09xy.js → db-w759qmx0.js} +2 -2
- package/dist/{dispatcher-nwf9ss0q.js → dispatcher-7b8e4z2j.js} +15 -15
- package/dist/{docker-nfy2gc8t.js → docker-s84hjs91.js} +2 -2
- package/dist/{dsh-adapter-kpdnhjst.js → dsh-adapter-2ezw3xea.js} +1 -2
- package/dist/{external-channel-j1e2p34p.js → external-channel-e2s028da.js} +2 -2
- package/dist/{grok-adapter-qtjz0whk.js → grok-adapter-ys7gaqee.js} +5 -5
- package/dist/{handlers-19xr6dnz.js → handlers-wy1dr6ja.js} +18 -18
- package/dist/{heartbeat-vtesda5d.js → heartbeat-w3mntghj.js} +17 -17
- package/dist/{hook-8wqaszda.js → hook-3jjywnpb.js} +9 -3
- package/dist/{hook-b2hhj6rd.js → hook-g7kvv6x9.js} +3 -2
- package/dist/{http-mxcqhhcs.js → http-tkp7d4kb.js} +267 -75
- package/dist/{index-srg522m6.js → index-1ef1myq2.js} +15 -15
- package/dist/{index-1r8wfpzs.js → index-3n8m9ea2.js} +1 -1
- package/dist/{index-kw2mmat7.js → index-nmm79qgr.js} +17 -17
- package/dist/{index-n1vbvta9.js → index-q7m26kvs.js} +24 -22
- package/dist/{index-spwxjgay.js → index-xdaahthb.js} +15 -15
- package/dist/{keepalive-dsd8rtgx.js → keepalive-v4ta8wgg.js} +3 -3
- package/dist/{lead-zyerk1x2.js → lead-sawnyqxk.js} +33 -33
- package/dist/{maintenance-jqmqwnet.js → maintenance-84n1ex21.js} +1 -1
- package/dist/{oauth-refresh-sweep-q2c3bnvm.js → oauth-refresh-sweep-vjnnandw.js} +2 -2
- package/dist/{onboard-w4yd7s8t.js → onboard-sfmpe4np.js} +2 -2
- package/dist/{opencode-adapter-9tppvxar.js → opencode-adapter-jmpst4q4.js} +3 -3
- package/dist/{otel-impl-f36byzbd.js → otel-impl-v6cc0zve.js} +1 -1
- package/dist/{pi-mono-adapter-tqsge1ay.js → pi-mono-adapter-fk8fkcf6.js} +33 -6
- package/dist/{pricing-refresh-xvak5p4v.js → pricing-refresh-fsk1e1zc.js} +3 -3
- package/dist/{rbac-roles-gfn30fb8.js → rbac-roles-prmkdnkw.js} +2 -2
- package/dist/{rbac-roles-682k2mt5.js → rbac-roles-zxmxqa39.js} +1 -1
- package/dist/{render-v2-hgytz8nn.js → render-v2-pjwxvnkw.js} +3 -3
- package/dist/{resume-2dvq348g.js → resume-frdtgfa0.js} +8 -6
- package/dist/{session-access-7f21ekq9.js → session-access-fpez4y5q.js} +4 -4
- package/dist/{setup-epffxtbk.js → setup-mq6m3m8q.js} +1 -1
- package/dist/{work-objects-xz1a5rqk.js → work-objects-kfahhjsq.js} +18 -18
- package/dist/{worker-42t8emjt.js → worker-v5e5rxj3.js} +33 -33
- package/openapi.json +68 -3
- package/package.json +5 -5
- package/plugin/commands/create-pr.md +2 -2
- package/plugin/pi-skills/create-pr/SKILL.md +2 -2
- package/src/be/db/approvals.ts +48 -0
- 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 +318 -7
- package/src/be/db.ts +67 -17
- 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 +2 -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/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/config.ts +48 -16
- package/src/http/idempotency-key.ts +117 -0
- package/src/http/workflows.ts +129 -24
- 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/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-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/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/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/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 +3 -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 +37 -0
- 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/tools/workflows/cancel-workflow-run.ts +1 -1
- package/src/utils/context-window.ts +8 -6
- package/src/workflows/approval-cancel.ts +15 -13
- package/src/workflows/approval-notifications.ts +5 -1
- package/src/workflows/checkpoint.ts +6 -3
- package/src/workflows/engine.ts +30 -8
- package/src/workflows/executors/foreach.ts +2 -2
- package/src/workflows/foreach-driver.ts +10 -3
- package/src/workflows/foreach-join.ts +29 -6
- package/src/workflows/recovery.ts +6 -1
- package/src/workflows/resume.ts +168 -56
- package/src/workflows/retry-poller.ts +49 -3
- 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/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/work-on-task/SKILL.md +1 -1
- package/templates/skills/work-on-task/content.md +1 -1
|
@@ -289,7 +289,7 @@ import {
|
|
|
289
289
|
hasCapability,
|
|
290
290
|
getEnabledCapabilities,
|
|
291
291
|
createServer
|
|
292
|
-
} from "./cli-
|
|
292
|
+
} from "./cli-asq5ydm4.js";
|
|
293
293
|
import {
|
|
294
294
|
chatThreadOfContextKey,
|
|
295
295
|
agentContextKey,
|
|
@@ -440,6 +440,12 @@ import {
|
|
|
440
440
|
getPausedTasksForAgent2,
|
|
441
441
|
resetOrphanedInProgressTasksForAgent2,
|
|
442
442
|
updateTaskProgress2,
|
|
443
|
+
IdempotencyKeyTakenError,
|
|
444
|
+
workflowRequestFingerprint,
|
|
445
|
+
findAcceptedWorkflowOperation,
|
|
446
|
+
assertWorkflowIdempotencyKeyUnused,
|
|
447
|
+
recordAcceptedWorkflowOperation,
|
|
448
|
+
init_workflow_idempotency,
|
|
443
449
|
getWorkflowRunParent,
|
|
444
450
|
init_workflow_runs,
|
|
445
451
|
CHAT_SDK_ADAPTER_NAMES,
|
|
@@ -737,7 +743,7 @@ import {
|
|
|
737
743
|
countScriptRunJournalSteps2,
|
|
738
744
|
countScriptRunJournalAgentTaskSteps2,
|
|
739
745
|
init_db3
|
|
740
|
-
} from "./cli-
|
|
746
|
+
} from "./cli-jb30dzvk.js";
|
|
741
747
|
import {
|
|
742
748
|
PRIMARY_ROLE_NAMES2,
|
|
743
749
|
getUserGrant2,
|
|
@@ -748,22 +754,26 @@ import {
|
|
|
748
754
|
assertNotLastAdmin2,
|
|
749
755
|
setUserRoles2,
|
|
750
756
|
init_rbac_roles
|
|
751
|
-
} from "./cli-
|
|
752
|
-
import"./cli-
|
|
757
|
+
} from "./cli-ff1tm9n9.js";
|
|
758
|
+
import"./cli-c61mbdds.js";
|
|
753
759
|
import {
|
|
754
760
|
normalizeModelKey
|
|
755
|
-
} from "./cli-
|
|
761
|
+
} from "./cli-sbwsxvtd.js";
|
|
756
762
|
import {
|
|
757
763
|
upsertModelCatalogOverlay,
|
|
758
764
|
deleteModelCatalogOverlay,
|
|
759
765
|
loadModelsCatalog,
|
|
760
766
|
requestModelCatalogRefresh2
|
|
761
|
-
} from "./cli-
|
|
767
|
+
} from "./cli-bvpgr9ny.js";
|
|
762
768
|
import {
|
|
763
769
|
AMP_ESTIMATE_MODELS,
|
|
764
770
|
ampBillsCacheWrites,
|
|
765
771
|
resolveAmpModel
|
|
766
772
|
} from "./cli-9s05422w.js";
|
|
773
|
+
import {
|
|
774
|
+
workflowEventBus2,
|
|
775
|
+
init_event_bus
|
|
776
|
+
} from "./cli-dabehxhp.js";
|
|
767
777
|
import {
|
|
768
778
|
automationIntegrationFixUrl,
|
|
769
779
|
preflightAutomation,
|
|
@@ -799,7 +809,7 @@ import {
|
|
|
799
809
|
generateEdges,
|
|
800
810
|
definitionNodeIds,
|
|
801
811
|
validateDefinition
|
|
802
|
-
} from "./cli-
|
|
812
|
+
} from "./cli-gbfxp48k.js";
|
|
803
813
|
import {
|
|
804
814
|
require_dist2,
|
|
805
815
|
isInvalidClientError,
|
|
@@ -879,14 +889,14 @@ import {
|
|
|
879
889
|
typecheckWithAmbient,
|
|
880
890
|
typecheckScript,
|
|
881
891
|
parseSkillContent
|
|
882
|
-
} from "./cli-
|
|
892
|
+
} from "./cli-7p4jxgtt.js";
|
|
883
893
|
import {
|
|
884
894
|
buildAuthorizationUrl,
|
|
885
895
|
exchangeAuthorizationCode,
|
|
886
896
|
oauthAppRowToProviderConfig,
|
|
887
897
|
forceRefreshAuthorizationOrThrow,
|
|
888
898
|
forceRefreshTokenOrThrow
|
|
889
|
-
} from "./cli-
|
|
899
|
+
} from "./cli-tsma7p8v.js";
|
|
890
900
|
import {
|
|
891
901
|
signalProcessGroup,
|
|
892
902
|
detachedProcessGroup,
|
|
@@ -917,8 +927,8 @@ import {
|
|
|
917
927
|
getSlackApp2,
|
|
918
928
|
startSlackApp2,
|
|
919
929
|
stopSlackApp2
|
|
920
|
-
} from "./cli-
|
|
921
|
-
import"./cli-
|
|
930
|
+
} from "./cli-abs8ndtr.js";
|
|
931
|
+
import"./cli-eftzyh9y.js";
|
|
922
932
|
import"./cli-qqzmjxkf.js";
|
|
923
933
|
import {
|
|
924
934
|
_fetchHolder,
|
|
@@ -931,14 +941,10 @@ import {
|
|
|
931
941
|
loadAllCodexOAuthSlots,
|
|
932
942
|
getValidCodexOAuth
|
|
933
943
|
} from "./cli-kxpfx2xr.js";
|
|
934
|
-
import {
|
|
935
|
-
workflowEventBus2,
|
|
936
|
-
init_event_bus
|
|
937
|
-
} from "./cli-dabehxhp.js";
|
|
938
944
|
import {
|
|
939
945
|
retryFailedRun2,
|
|
940
946
|
cancelWorkflowRun2
|
|
941
|
-
} from "./cli-
|
|
947
|
+
} from "./cli-x0f2v69c.js";
|
|
942
948
|
import {
|
|
943
949
|
duplicateGuardedQueryKey,
|
|
944
950
|
warnIfCorsAllowsAnyOrigin,
|
|
@@ -983,7 +989,7 @@ import {
|
|
|
983
989
|
bodyListTask,
|
|
984
990
|
describeRequestRoute,
|
|
985
991
|
route
|
|
986
|
-
} from "./cli-
|
|
992
|
+
} from "./cli-gwhjmh8g.js";
|
|
987
993
|
import {
|
|
988
994
|
FilesError,
|
|
989
995
|
normalizeFilesError,
|
|
@@ -1011,7 +1017,7 @@ import {
|
|
|
1011
1017
|
resolvePoolDelivery2,
|
|
1012
1018
|
createPoolAgent2,
|
|
1013
1019
|
init_db
|
|
1014
|
-
} from "./cli-
|
|
1020
|
+
} from "./cli-19202kew.js";
|
|
1015
1021
|
import {
|
|
1016
1022
|
RATING_MODEL_MAX_LENGTH,
|
|
1017
1023
|
REFERENCES_SOURCE_MAX_LENGTH,
|
|
@@ -1027,7 +1033,7 @@ import {
|
|
|
1027
1033
|
checkHeartbeatChecklist2,
|
|
1028
1034
|
runHeartbeatSweep2,
|
|
1029
1035
|
stopHeartbeat2
|
|
1030
|
-
} from "./cli-
|
|
1036
|
+
} from "./cli-gn5af0x5.js";
|
|
1031
1037
|
import"./cli-6n8axjv1.js";
|
|
1032
1038
|
import {
|
|
1033
1039
|
import_websocket,
|
|
@@ -1037,7 +1043,7 @@ import {
|
|
|
1037
1043
|
runtimeSupervisorStatus,
|
|
1038
1044
|
startRuntimeSupervisor,
|
|
1039
1045
|
stopRuntimeSupervisor
|
|
1040
|
-
} from "./cli-
|
|
1046
|
+
} from "./cli-1r5ad7j5.js";
|
|
1041
1047
|
import"./cli-ns59dc6r.js";
|
|
1042
1048
|
import {
|
|
1043
1049
|
ACP_TARGET_IDS
|
|
@@ -1057,14 +1063,14 @@ import {
|
|
|
1057
1063
|
memoryRelevance,
|
|
1058
1064
|
isUnknownModelError,
|
|
1059
1065
|
writeSkillsToFilesystem
|
|
1060
|
-
} from "./cli-
|
|
1066
|
+
} from "./cli-277c31dw.js";
|
|
1061
1067
|
import {
|
|
1062
1068
|
inviteEmailToSharedOrg,
|
|
1063
1069
|
ensureAgentFsCredentialsForAgent
|
|
1064
|
-
} from "./cli-
|
|
1070
|
+
} from "./cli-ethgy7ha.js";
|
|
1065
1071
|
import {
|
|
1066
1072
|
Anthropic
|
|
1067
|
-
} from "./cli-
|
|
1073
|
+
} from "./cli-rr7zx19j.js";
|
|
1068
1074
|
import {
|
|
1069
1075
|
isCodexOAuthConfigKey
|
|
1070
1076
|
} from "./cli-j4bwnpkm.js";
|
|
@@ -1093,6 +1099,7 @@ import {
|
|
|
1093
1099
|
InvalidRuntimeTokenError,
|
|
1094
1100
|
mintSessionToken,
|
|
1095
1101
|
mintRuntimeToken,
|
|
1102
|
+
isScriptRunToken,
|
|
1096
1103
|
revokeSessionToken,
|
|
1097
1104
|
AgentTokenExistsError,
|
|
1098
1105
|
mintAgentToken,
|
|
@@ -1100,7 +1107,7 @@ import {
|
|
|
1100
1107
|
revokeAgentTokens,
|
|
1101
1108
|
fingerprintApiKey,
|
|
1102
1109
|
init_users
|
|
1103
|
-
} from "./cli-
|
|
1110
|
+
} from "./cli-6a1xg1p7.js";
|
|
1104
1111
|
import"./cli-v41kn3cd.js";
|
|
1105
1112
|
import"./cli-wgtk7xxr.js";
|
|
1106
1113
|
import"./cli-1f0gp9vz.js";
|
|
@@ -1269,7 +1276,7 @@ import {
|
|
|
1269
1276
|
IDENTITY_FIELD_BUDGETS,
|
|
1270
1277
|
IdentityFieldBudgetError,
|
|
1271
1278
|
init_identity_field_budget
|
|
1272
|
-
} from "./cli-
|
|
1279
|
+
} from "./cli-e42vss7b.js";
|
|
1273
1280
|
import {
|
|
1274
1281
|
getSlackConfiguration,
|
|
1275
1282
|
init_config
|
|
@@ -1278,16 +1285,6 @@ import {
|
|
|
1278
1285
|
isSteeringEnabled2,
|
|
1279
1286
|
init_steering_enabled
|
|
1280
1287
|
} from "./cli-4sydckyj.js";
|
|
1281
|
-
import {
|
|
1282
|
-
interpolate,
|
|
1283
|
-
init_template,
|
|
1284
|
-
getTemplateDefinition,
|
|
1285
|
-
getAllTemplateDefinitions,
|
|
1286
|
-
init_registry,
|
|
1287
|
-
resolveTemplate,
|
|
1288
|
-
init_resolver,
|
|
1289
|
-
init_session_templates
|
|
1290
|
-
} from "./cli-tx00c0h6.js";
|
|
1291
1288
|
import {
|
|
1292
1289
|
MODEL_SCOPED_WINDOWS,
|
|
1293
1290
|
activeModelBlocks,
|
|
@@ -1303,6 +1300,16 @@ import {
|
|
|
1303
1300
|
getOpenRouterAttributionHeaders,
|
|
1304
1301
|
init_openrouter_base_url
|
|
1305
1302
|
} from "./cli-dfyv0jdy.js";
|
|
1303
|
+
import {
|
|
1304
|
+
interpolate,
|
|
1305
|
+
init_template,
|
|
1306
|
+
getTemplateDefinition,
|
|
1307
|
+
getAllTemplateDefinitions,
|
|
1308
|
+
init_registry,
|
|
1309
|
+
resolveTemplate,
|
|
1310
|
+
init_resolver,
|
|
1311
|
+
init_session_templates
|
|
1312
|
+
} from "./cli-dqygeeh5.js";
|
|
1306
1313
|
import {
|
|
1307
1314
|
init_zod
|
|
1308
1315
|
} from "./cli-4chz1hye.js";
|
|
@@ -1337,7 +1344,7 @@ import {
|
|
|
1337
1344
|
import {
|
|
1338
1345
|
init_package,
|
|
1339
1346
|
package_default
|
|
1340
|
-
} from "./cli-
|
|
1347
|
+
} from "./cli-xtrz6bzs.js";
|
|
1341
1348
|
import {
|
|
1342
1349
|
realtimeBus,
|
|
1343
1350
|
init_bus
|
|
@@ -6044,6 +6051,7 @@ async function fillOrgLogoFromWebsite(website) {
|
|
|
6044
6051
|
// src/http/config.ts
|
|
6045
6052
|
init_rbac_roles();
|
|
6046
6053
|
init_swarm_config_guard();
|
|
6054
|
+
init_users();
|
|
6047
6055
|
init_rbac();
|
|
6048
6056
|
init_types();
|
|
6049
6057
|
init_request_auth_context();
|
|
@@ -6513,6 +6521,28 @@ async function resolveSecretsRead(req, includeSecrets, resolvedScope) {
|
|
|
6513
6521
|
secretsNote: includeSecrets && scope === "none" ? SECRETS_FORCE_MASK_NOTE : ""
|
|
6514
6522
|
};
|
|
6515
6523
|
}
|
|
6524
|
+
async function scriptRunHeldConfigIds(req) {
|
|
6525
|
+
const auth = getRequestAuth(req);
|
|
6526
|
+
if (auth?.kind !== "agent" || auth.tokenKind !== "agent")
|
|
6527
|
+
return;
|
|
6528
|
+
if (!await isScriptRunToken(auth.tokenId))
|
|
6529
|
+
return;
|
|
6530
|
+
const held = stripApiOnlyKeys(await getResolvedConfig2(auth.agentId, undefined, { includeRepoSecrets: false }));
|
|
6531
|
+
return new Set(held.map((config) => config.id));
|
|
6532
|
+
}
|
|
6533
|
+
async function maskConfigRead(req, configs, includeSecrets) {
|
|
6534
|
+
const { effectiveIncludeSecrets, secretsNote } = await resolveSecretsRead(req, includeSecrets);
|
|
6535
|
+
const held = includeSecrets && !effectiveIncludeSecrets ? await scriptRunHeldConfigIds(req) : undefined;
|
|
6536
|
+
const reveal = (config) => effectiveIncludeSecrets || !!held?.has(config.id);
|
|
6537
|
+
const result = configs.map((config) => config.isSecret && !reveal(config) ? maskSecrets2([config])[0] : config);
|
|
6538
|
+
for (const config of result) {
|
|
6539
|
+
if (config.isSecret && config.value && reveal(config)) {
|
|
6540
|
+
registerVolatileSecret(config.value, `config:${config.key}`);
|
|
6541
|
+
}
|
|
6542
|
+
}
|
|
6543
|
+
const anyMasked = result.some((config) => config.isSecret && !reveal(config));
|
|
6544
|
+
return { result, secretsNote: held && !anyMasked ? "" : secretsNote };
|
|
6545
|
+
}
|
|
6516
6546
|
async function ensureConfigAdmin(req, res, verb) {
|
|
6517
6547
|
return ensureHttpPermission(req, res, verb, verb === "config.write.any" ? "Writing swarm config requires the lead agent" : "Deleting swarm config requires the lead agent");
|
|
6518
6548
|
}
|
|
@@ -6757,13 +6787,9 @@ async function handleConfig(req, res, pathSegments, queryParams) {
|
|
|
6757
6787
|
jsonError(res, "Config not found", 404);
|
|
6758
6788
|
return true;
|
|
6759
6789
|
}
|
|
6760
|
-
const {
|
|
6761
|
-
const singleResult = effectiveIncludeSecrets ? config : maskSecrets2([config])[0];
|
|
6762
|
-
if (effectiveIncludeSecrets && singleResult.isSecret && singleResult.value) {
|
|
6763
|
-
registerVolatileSecret(singleResult.value, `config:${singleResult.key}`);
|
|
6764
|
-
}
|
|
6790
|
+
const { result, secretsNote } = await maskConfigRead(req, [config], includeSecrets);
|
|
6765
6791
|
getConfigById.respond(res, 200, {
|
|
6766
|
-
...
|
|
6792
|
+
...result[0],
|
|
6767
6793
|
...secretsNote ? { message: `Found 1 config(s).${secretsNote}` } : {}
|
|
6768
6794
|
});
|
|
6769
6795
|
return true;
|
|
@@ -6773,20 +6799,12 @@ async function handleConfig(req, res, pathSegments, queryParams) {
|
|
|
6773
6799
|
if (!parsed)
|
|
6774
6800
|
return true;
|
|
6775
6801
|
const includeSecrets = parsed.query.includeSecrets === "true";
|
|
6776
|
-
const { effectiveIncludeSecrets, secretsNote } = await resolveSecretsRead(req, includeSecrets);
|
|
6777
6802
|
const configs = stripApiOnlyKeys(await getSwarmConfigs2({
|
|
6778
6803
|
scope: parsed.query.scope || undefined,
|
|
6779
6804
|
scopeId: parsed.query.scopeId || undefined,
|
|
6780
6805
|
key: parsed.query.key
|
|
6781
6806
|
}));
|
|
6782
|
-
const listResult =
|
|
6783
|
-
if (effectiveIncludeSecrets) {
|
|
6784
|
-
for (const c of listResult) {
|
|
6785
|
-
if (c.isSecret && c.value) {
|
|
6786
|
-
registerVolatileSecret(c.value, `config:${c.key}`);
|
|
6787
|
-
}
|
|
6788
|
-
}
|
|
6789
|
-
}
|
|
6807
|
+
const { result: listResult, secretsNote } = await maskConfigRead(req, configs, includeSecrets);
|
|
6790
6808
|
listConfig.respond(res, 200, {
|
|
6791
6809
|
configs: listResult,
|
|
6792
6810
|
...secretsNote ? { message: `Found ${listResult.length} config(s).${secretsNote}` } : {}
|
|
@@ -10207,6 +10225,36 @@ declare module "swarm-extension" {
|
|
|
10207
10225
|
origin: TaskCreateOrigin;
|
|
10208
10226
|
requestInfo?: RequestInfo;
|
|
10209
10227
|
}
|
|
10228
|
+
/** A pre.task.create hook blocked a task before it was created. */
|
|
10229
|
+
export interface TaskBlockedEvent {
|
|
10230
|
+
/** The extension that blocked, or whose model/agent rewrite was rejected. */
|
|
10231
|
+
extension: {
|
|
10232
|
+
id: string;
|
|
10233
|
+
name: string;
|
|
10234
|
+
};
|
|
10235
|
+
/** The scrubbed block reason. */
|
|
10236
|
+
reason: string;
|
|
10237
|
+
origin: TaskCreateOrigin;
|
|
10238
|
+
source?: AgentTask["source"];
|
|
10239
|
+
requester: {
|
|
10240
|
+
userId?: string;
|
|
10241
|
+
agentId?: string;
|
|
10242
|
+
slackUserId?: string;
|
|
10243
|
+
};
|
|
10244
|
+
context?: {
|
|
10245
|
+
contextKey?: string;
|
|
10246
|
+
scheduleId?: string;
|
|
10247
|
+
workflowRunId?: string;
|
|
10248
|
+
workflowRunStepId?: string;
|
|
10249
|
+
parentTaskId?: string;
|
|
10250
|
+
vcsRepo?: string;
|
|
10251
|
+
vcsNumber?: number;
|
|
10252
|
+
slackChannelId?: string;
|
|
10253
|
+
slackThreadTs?: string;
|
|
10254
|
+
};
|
|
10255
|
+
/** The original task description, scrubbed and cut to 500 characters. */
|
|
10256
|
+
description: string;
|
|
10257
|
+
}
|
|
10210
10258
|
export type TaskCreateModify = Partial<
|
|
10211
10259
|
Pick<
|
|
10212
10260
|
CreateTaskOptions,
|
|
@@ -10509,6 +10557,11 @@ declare module "swarm-extension" {
|
|
|
10509
10557
|
modify: never;
|
|
10510
10558
|
result: void;
|
|
10511
10559
|
};
|
|
10560
|
+
"post.task.blocked": {
|
|
10561
|
+
event: TaskBlockedEvent;
|
|
10562
|
+
modify: never;
|
|
10563
|
+
result: void;
|
|
10564
|
+
};
|
|
10512
10565
|
"post.task.completed": {
|
|
10513
10566
|
event: TaskCompletedEvent;
|
|
10514
10567
|
modify: never;
|
|
@@ -39250,8 +39303,66 @@ async function handleWorkflowEvents(req, res, pathSegments, queryParams) {
|
|
|
39250
39303
|
// src/http/workflows.ts
|
|
39251
39304
|
init_zod();
|
|
39252
39305
|
init_db3();
|
|
39306
|
+
init_workflow_idempotency();
|
|
39253
39307
|
init_workflow_runs();
|
|
39254
39308
|
init_types();
|
|
39309
|
+
|
|
39310
|
+
// src/http/idempotency-key.ts
|
|
39311
|
+
init_zod();
|
|
39312
|
+
init_workflow_idempotency();
|
|
39313
|
+
init_request_auth_context();
|
|
39314
|
+
var IDEMPOTENCY_KEY_PATTERN = /^[\x21-\x7E]{1,255}$/;
|
|
39315
|
+
var IDEMPOTENT_REPLAYED_HEADER = "Idempotent-Replayed";
|
|
39316
|
+
var idempotencyKeyHeader = (accepted) => object2({
|
|
39317
|
+
"Idempotency-Key": string2().regex(IDEMPOTENCY_KEY_PATTERN).optional().describe("Optional client-generated key, 1-255 visible ASCII characters (a UUID works). " + `The first request the server accepts under a key ${accepted}; a retry with the same key ` + "and an equivalent body gets that request's status and body back (with " + `\`${IDEMPOTENT_REPLAYED_HEADER}: true\`) and changes nothing. The key is scoped to the ` + "caller's identity and this operation; it is not a credential. The same key with a " + "different body is a 409. A request rejected before it is accepted (validation, auth, " + "not found, disabled) does not use up the key. Accepted keys do not expire.")
|
|
39318
|
+
});
|
|
39319
|
+
function idempotencyPrincipal(req, myAgentId) {
|
|
39320
|
+
const auth = getRequestAuth(req);
|
|
39321
|
+
switch (auth?.kind) {
|
|
39322
|
+
case "user":
|
|
39323
|
+
return `user:${auth.userId}`;
|
|
39324
|
+
case "agent":
|
|
39325
|
+
return `agent:${auth.agentId}`;
|
|
39326
|
+
case "controller":
|
|
39327
|
+
return `controller:${auth.controllerId}`;
|
|
39328
|
+
case "guest":
|
|
39329
|
+
return null;
|
|
39330
|
+
default:
|
|
39331
|
+
return myAgentId ? `agent:${myAgentId}` : "operator";
|
|
39332
|
+
}
|
|
39333
|
+
}
|
|
39334
|
+
function readIdempotencyKey(req, res, myAgentId) {
|
|
39335
|
+
const raw = req.headers["idempotency-key"];
|
|
39336
|
+
if (raw === undefined)
|
|
39337
|
+
return;
|
|
39338
|
+
const key = Array.isArray(raw) ? raw.join(", ") : raw;
|
|
39339
|
+
if (!IDEMPOTENCY_KEY_PATTERN.test(key)) {
|
|
39340
|
+
jsonError(res, "Idempotency-Key must be 1-255 visible ASCII characters", 400);
|
|
39341
|
+
return null;
|
|
39342
|
+
}
|
|
39343
|
+
const principal = idempotencyPrincipal(req, myAgentId);
|
|
39344
|
+
if (!principal) {
|
|
39345
|
+
jsonError(res, "Idempotency-Key needs an identified caller", 400);
|
|
39346
|
+
return null;
|
|
39347
|
+
}
|
|
39348
|
+
return { principal, key };
|
|
39349
|
+
}
|
|
39350
|
+
async function replayAcceptedOperation(res, claim, send) {
|
|
39351
|
+
const accepted = await findAcceptedWorkflowOperation(claim);
|
|
39352
|
+
if (!accepted)
|
|
39353
|
+
return false;
|
|
39354
|
+
if (accepted.fingerprint !== claim.fingerprint) {
|
|
39355
|
+
jsonError(res, "Idempotency-Key was already used for a different request", 409);
|
|
39356
|
+
} else if (accepted.resourceDeletedAt !== null) {
|
|
39357
|
+
jsonError(res, "The workflow this Idempotency-Key created or triggered was deleted; send a new key to start over", 410);
|
|
39358
|
+
} else {
|
|
39359
|
+
res.setHeader(IDEMPOTENT_REPLAYED_HEADER, "true");
|
|
39360
|
+
send(accepted.body);
|
|
39361
|
+
}
|
|
39362
|
+
return true;
|
|
39363
|
+
}
|
|
39364
|
+
|
|
39365
|
+
// src/http/workflows.ts
|
|
39255
39366
|
var WorkflowWithFavoriteSchema = WorkflowSchema.extend({ favorite: boolean() });
|
|
39256
39367
|
var WorkflowSaveResponseSchema = WorkflowSchema.extend({
|
|
39257
39368
|
warnings: array2(string2()).optional()
|
|
@@ -39313,6 +39424,7 @@ var createWorkflowRoute = route({
|
|
|
39313
39424
|
pattern: ["api", "workflows"],
|
|
39314
39425
|
summary: "Create a new workflow",
|
|
39315
39426
|
tags: ["Workflows"],
|
|
39427
|
+
headers: idempotencyKeyHeader("creates one workflow"),
|
|
39316
39428
|
body: object2({
|
|
39317
39429
|
name: string2().min(1),
|
|
39318
39430
|
key: AssetKeySchema.optional(),
|
|
@@ -39330,7 +39442,9 @@ var createWorkflowRoute = route({
|
|
|
39330
39442
|
}),
|
|
39331
39443
|
responses: {
|
|
39332
39444
|
201: { description: "Workflow created", schema: WorkflowSaveResponseSchema },
|
|
39333
|
-
400: { description: "Invalid definition" }
|
|
39445
|
+
400: { description: "Invalid definition, or a malformed Idempotency-Key" },
|
|
39446
|
+
409: { description: "Idempotency-Key was already used for a different request" },
|
|
39447
|
+
410: { description: "The workflow created under this Idempotency-Key was deleted" }
|
|
39334
39448
|
}
|
|
39335
39449
|
});
|
|
39336
39450
|
var getWorkflowRoute = route({
|
|
@@ -39434,16 +39548,20 @@ var triggerWorkflowRoute = route({
|
|
|
39434
39548
|
path: "/api/workflows/{id}/trigger",
|
|
39435
39549
|
pattern: ["api", "workflows", null, "trigger"],
|
|
39436
39550
|
summary: "Trigger a workflow execution",
|
|
39551
|
+
description: "With an `Idempotency-Key`, a retry returns the accepted run's `runId` and `skipped` without starting, resuming or waiting for anything, even after the workflow was disabled or edited and whatever state the run is in now.",
|
|
39437
39552
|
tags: ["Workflows"],
|
|
39438
39553
|
params: object2({ id: string2() }),
|
|
39554
|
+
headers: idempotencyKeyHeader("starts one run"),
|
|
39439
39555
|
responses: {
|
|
39440
39556
|
201: {
|
|
39441
39557
|
description: "Workflow run started (or skipped if cooldown active)",
|
|
39442
39558
|
schema: object2({ runId: string2(), skipped: boolean() })
|
|
39443
39559
|
},
|
|
39444
|
-
400: { description: "Workflow is disabled" },
|
|
39560
|
+
400: { description: "Workflow is disabled, or a malformed Idempotency-Key" },
|
|
39445
39561
|
401: { description: "Unauthorized" },
|
|
39446
|
-
404: { description: "Workflow not found" }
|
|
39562
|
+
404: { description: "Workflow not found" },
|
|
39563
|
+
409: { description: "Idempotency-Key was already used for a different request" },
|
|
39564
|
+
410: { description: "The workflow triggered under this Idempotency-Key was deleted" }
|
|
39447
39565
|
}
|
|
39448
39566
|
});
|
|
39449
39567
|
var validateTriggerRoute = route({
|
|
@@ -39688,9 +39806,21 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
39688
39806
|
return true;
|
|
39689
39807
|
}
|
|
39690
39808
|
if (createWorkflowRoute.match(req.method, pathSegments)) {
|
|
39809
|
+
const idempotency = readIdempotencyKey(req, res, myAgentId);
|
|
39810
|
+
if (idempotency === null)
|
|
39811
|
+
return true;
|
|
39691
39812
|
const parsed = await createWorkflowRoute.parse(req, res, pathSegments, queryParams);
|
|
39692
39813
|
if (!parsed)
|
|
39693
39814
|
return true;
|
|
39815
|
+
const claim = idempotency && {
|
|
39816
|
+
...idempotency,
|
|
39817
|
+
operation: "workflow.create",
|
|
39818
|
+
targetId: "",
|
|
39819
|
+
fingerprint: workflowRequestFingerprint("workflow.create", parsed.body)
|
|
39820
|
+
};
|
|
39821
|
+
const replayCreate = (body) => createWorkflowRoute.respond(res, 201, body);
|
|
39822
|
+
if (claim && await replayAcceptedOperation(res, claim, replayCreate))
|
|
39823
|
+
return true;
|
|
39694
39824
|
const validation = validateDefinition(parsed.body.definition, getExecutorRegistry2());
|
|
39695
39825
|
if (!validation.valid) {
|
|
39696
39826
|
jsonError(res, `Invalid definition: ${validation.errors.join("; ")}`, 400);
|
|
@@ -39712,7 +39842,7 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
39712
39842
|
}
|
|
39713
39843
|
throw error;
|
|
39714
39844
|
}
|
|
39715
|
-
const
|
|
39845
|
+
const data = {
|
|
39716
39846
|
key,
|
|
39717
39847
|
name: parsed.body.name,
|
|
39718
39848
|
description: parsed.body.description,
|
|
@@ -39728,8 +39858,34 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
39728
39858
|
vcsRepo: parsed.body.vcsRepo,
|
|
39729
39859
|
createdByAgentId: myAgentId ?? undefined,
|
|
39730
39860
|
createdBy: await resolveHttpAuditUserId(req, myAgentId) ?? undefined
|
|
39731
|
-
}
|
|
39732
|
-
|
|
39861
|
+
};
|
|
39862
|
+
if (!claim) {
|
|
39863
|
+
const workflow = await createWorkflow2(data, "api");
|
|
39864
|
+
createWorkflowRoute.respond(res, 201, await withSaveWarnings(workflow));
|
|
39865
|
+
return true;
|
|
39866
|
+
}
|
|
39867
|
+
const warnings = await workflowSaveWarnings(parsed.body.definition, getExecutorRegistry2());
|
|
39868
|
+
let saved;
|
|
39869
|
+
try {
|
|
39870
|
+
saved = await getDbClient2().transaction(async () => {
|
|
39871
|
+
await assertWorkflowIdempotencyKeyUnused(claim);
|
|
39872
|
+
const workflow = await createWorkflow2(data, "api");
|
|
39873
|
+
const body = warnings.length > 0 ? { ...workflow, warnings } : workflow;
|
|
39874
|
+
await recordAcceptedWorkflowOperation(claim, {
|
|
39875
|
+
workflowId: workflow.id,
|
|
39876
|
+
status: 201,
|
|
39877
|
+
body
|
|
39878
|
+
});
|
|
39879
|
+
return body;
|
|
39880
|
+
});
|
|
39881
|
+
} catch (err) {
|
|
39882
|
+
if (err instanceof IdempotencyKeyTakenError) {
|
|
39883
|
+
if (await replayAcceptedOperation(res, claim, replayCreate))
|
|
39884
|
+
return true;
|
|
39885
|
+
}
|
|
39886
|
+
throw err;
|
|
39887
|
+
}
|
|
39888
|
+
createWorkflowRoute.respond(res, 201, saved);
|
|
39733
39889
|
return true;
|
|
39734
39890
|
}
|
|
39735
39891
|
if (getWorkflowRoute.match(req.method, pathSegments)) {
|
|
@@ -39931,9 +40087,26 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
39931
40087
|
return true;
|
|
39932
40088
|
}
|
|
39933
40089
|
if (triggerWorkflowRoute.match(req.method, pathSegments)) {
|
|
40090
|
+
const idempotency = readIdempotencyKey(req, res, myAgentId);
|
|
40091
|
+
if (idempotency === null)
|
|
40092
|
+
return true;
|
|
39934
40093
|
const parsed = await triggerWorkflowRoute.parse(req, res, pathSegments, queryParams);
|
|
39935
40094
|
if (!parsed)
|
|
39936
40095
|
return true;
|
|
40096
|
+
let claim;
|
|
40097
|
+
let keyedBody;
|
|
40098
|
+
const replayTrigger = (body) => triggerWorkflowRoute.respond(res, 201, body);
|
|
40099
|
+
if (idempotency) {
|
|
40100
|
+
keyedBody = await parseBody(req);
|
|
40101
|
+
claim = {
|
|
40102
|
+
...idempotency,
|
|
40103
|
+
operation: "workflow.trigger",
|
|
40104
|
+
targetId: parsed.params.id,
|
|
40105
|
+
fingerprint: workflowRequestFingerprint("workflow.trigger", keyedBody)
|
|
40106
|
+
};
|
|
40107
|
+
if (await replayAcceptedOperation(res, claim, replayTrigger))
|
|
40108
|
+
return true;
|
|
40109
|
+
}
|
|
39937
40110
|
const workflow = await getWorkflow2(parsed.params.id);
|
|
39938
40111
|
if (!workflow) {
|
|
39939
40112
|
res.writeHead(404);
|
|
@@ -39944,20 +40117,39 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
39944
40117
|
jsonError(res, "Workflow is disabled", 400);
|
|
39945
40118
|
return true;
|
|
39946
40119
|
}
|
|
39947
|
-
const body = await parseBody(req);
|
|
40120
|
+
const body = idempotency ? keyedBody : await parseBody(req);
|
|
39948
40121
|
let runId;
|
|
40122
|
+
let accepted;
|
|
39949
40123
|
try {
|
|
39950
40124
|
runId = await startWorkflowExecution2(workflow, body, getExecutorRegistry2(), {
|
|
39951
40125
|
triggerType: "api",
|
|
39952
|
-
requestedByUserId: await resolveHttpAuditUserId(req, myAgentId) ?? undefined
|
|
40126
|
+
requestedByUserId: await resolveHttpAuditUserId(req, myAgentId) ?? undefined,
|
|
40127
|
+
accept: claim ? async (run) => {
|
|
40128
|
+
const response = { runId: run.runId, skipped: run.skipped };
|
|
40129
|
+
await recordAcceptedWorkflowOperation(claim, {
|
|
40130
|
+
workflowId: workflow.id,
|
|
40131
|
+
runId: run.runId,
|
|
40132
|
+
status: 201,
|
|
40133
|
+
body: response
|
|
40134
|
+
});
|
|
40135
|
+
accepted = response;
|
|
40136
|
+
} : undefined
|
|
39953
40137
|
});
|
|
39954
40138
|
} catch (err) {
|
|
39955
40139
|
if (err instanceof TriggerSchemaError) {
|
|
39956
40140
|
triggerSchemaErrorResponse(res, err.message, err.validationErrors);
|
|
39957
40141
|
return true;
|
|
39958
40142
|
}
|
|
40143
|
+
if (claim && err instanceof IdempotencyKeyTakenError) {
|
|
40144
|
+
if (await replayAcceptedOperation(res, claim, replayTrigger))
|
|
40145
|
+
return true;
|
|
40146
|
+
}
|
|
39959
40147
|
throw err;
|
|
39960
40148
|
}
|
|
40149
|
+
if (accepted) {
|
|
40150
|
+
triggerWorkflowRoute.respond(res, 201, accepted);
|
|
40151
|
+
return true;
|
|
40152
|
+
}
|
|
39961
40153
|
const run = await getWorkflowRun2(runId);
|
|
39962
40154
|
const skipped = run?.status === "skipped";
|
|
39963
40155
|
triggerWorkflowRoute.respond(res, 201, { runId, skipped });
|
|
@@ -40427,7 +40619,7 @@ var httpServer = createHttpServer(async (req, res) => {
|
|
|
40427
40619
|
});
|
|
40428
40620
|
});
|
|
40429
40621
|
var detachRealtime = attachRealtimeTransport(httpServer);
|
|
40430
|
-
var { attachControllerTransport } = await import("./controllers-connect-
|
|
40622
|
+
var { attachControllerTransport } = await import("./controllers-connect-xp05dj6x.js");
|
|
40431
40623
|
var detachControllers = attachControllerTransport(httpServer);
|
|
40432
40624
|
var stopWorkerNudges = startWorkerNudgeListener();
|
|
40433
40625
|
var stopRoomDeletion = realtimeBus.subscribe("room:namespace-deleted", (namespace) => {
|
|
@@ -40456,7 +40648,7 @@ async function shutdown() {
|
|
|
40456
40648
|
sessionsProcessed: getServerSessionsProcessed()
|
|
40457
40649
|
});
|
|
40458
40650
|
if (hasCapability("scheduling")) {
|
|
40459
|
-
const { stopScheduler } = await import("./index-
|
|
40651
|
+
const { stopScheduler } = await import("./index-xdaahthb.js");
|
|
40460
40652
|
stopScheduler();
|
|
40461
40653
|
}
|
|
40462
40654
|
stopHeartbeat2();
|
|
@@ -40468,7 +40660,7 @@ async function shutdown() {
|
|
|
40468
40660
|
await stopSlackApp2();
|
|
40469
40661
|
await stopChatSdk();
|
|
40470
40662
|
if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
|
|
40471
|
-
const { stopOAuthKeepalive } = await import("./keepalive-
|
|
40663
|
+
const { stopOAuthKeepalive } = await import("./keepalive-v4ta8wgg.js");
|
|
40472
40664
|
await stopOAuthKeepalive();
|
|
40473
40665
|
}
|
|
40474
40666
|
stopOAuthPendingGc();
|
|
@@ -40548,21 +40740,21 @@ try {
|
|
|
40548
40740
|
console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
|
|
40549
40741
|
}
|
|
40550
40742
|
try {
|
|
40551
|
-
const { ensurePricingSeeded } = await import("./boot-seeds-
|
|
40743
|
+
const { ensurePricingSeeded } = await import("./boot-seeds-x28v3fhb.js");
|
|
40552
40744
|
ensurePricingSeeded();
|
|
40553
|
-
const { startPricingRefreshLoop } = await import("./pricing-refresh-
|
|
40745
|
+
const { startPricingRefreshLoop } = await import("./pricing-refresh-fsk1e1zc.js");
|
|
40554
40746
|
startPricingRefreshLoop();
|
|
40555
40747
|
} catch (err) {
|
|
40556
40748
|
console.error("[startup] Failed to seed pricing rows:", err);
|
|
40557
40749
|
}
|
|
40558
40750
|
try {
|
|
40559
|
-
const { ensureModelProfilesSeeded } = await import("./boot-seeds-
|
|
40751
|
+
const { ensureModelProfilesSeeded } = await import("./boot-seeds-x28v3fhb.js");
|
|
40560
40752
|
await ensureModelProfilesSeeded();
|
|
40561
40753
|
} catch (err) {
|
|
40562
40754
|
console.error("[startup] Failed to seed model profiles:", err);
|
|
40563
40755
|
}
|
|
40564
40756
|
try {
|
|
40565
|
-
const { ensureRbacSeeded } = await import("./boot-seeds-
|
|
40757
|
+
const { ensureRbacSeeded } = await import("./boot-seeds-x28v3fhb.js");
|
|
40566
40758
|
ensureRbacSeeded();
|
|
40567
40759
|
} catch (err) {
|
|
40568
40760
|
console.error("[startup] Failed to sync RBAC seed rows:", err);
|
|
@@ -40570,7 +40762,7 @@ try {
|
|
|
40570
40762
|
throw err;
|
|
40571
40763
|
}
|
|
40572
40764
|
try {
|
|
40573
|
-
const { runAllSeeders } = await import("./index-
|
|
40765
|
+
const { runAllSeeders } = await import("./index-q7m26kvs.js");
|
|
40574
40766
|
await runAllSeeders({ scriptEmbeddingMode: "skip" });
|
|
40575
40767
|
} catch (err) {
|
|
40576
40768
|
console.error("[startup] Failed to seed built-in entities:", err);
|
|
@@ -40633,39 +40825,39 @@ httpServer.listen(port, async () => {
|
|
|
40633
40825
|
await initWorkflows2();
|
|
40634
40826
|
await startScriptRunSupervisor(getMcpBaseUrl());
|
|
40635
40827
|
if (hasCapability("scheduling")) {
|
|
40636
|
-
const { startScheduler } = await import("./index-
|
|
40637
|
-
const { getExecutorRegistry } = await import("./index-
|
|
40828
|
+
const { startScheduler } = await import("./index-xdaahthb.js");
|
|
40829
|
+
const { getExecutorRegistry } = await import("./index-1ef1myq2.js");
|
|
40638
40830
|
const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
|
|
40639
40831
|
startScheduler(getExecutorRegistry(), intervalMs, {
|
|
40640
40832
|
runId: globalState.__runId
|
|
40641
40833
|
});
|
|
40642
40834
|
}
|
|
40643
40835
|
if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
|
|
40644
|
-
const { startHeartbeat } = await import("./index-
|
|
40836
|
+
const { startHeartbeat } = await import("./index-nmm79qgr.js");
|
|
40645
40837
|
const heartbeatMs = Number(process.env.HEARTBEAT_INTERVAL_MS) || 90000;
|
|
40646
40838
|
startHeartbeat(heartbeatMs);
|
|
40647
40839
|
}
|
|
40648
40840
|
startPoolRouting();
|
|
40649
40841
|
startRuntimeSupervisor();
|
|
40650
40842
|
if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
|
|
40651
|
-
const { startOAuthKeepalive } = await import("./keepalive-
|
|
40843
|
+
const { startOAuthKeepalive } = await import("./keepalive-v4ta8wgg.js");
|
|
40652
40844
|
startOAuthKeepalive();
|
|
40653
40845
|
}
|
|
40654
40846
|
if (process.env.OAUTH_REFRESH_SWEEP_DISABLE !== "true") {
|
|
40655
|
-
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-
|
|
40847
|
+
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-vjnnandw.js");
|
|
40656
40848
|
startOAuthRefreshSweep();
|
|
40657
40849
|
}
|
|
40658
40850
|
startOAuthPendingGc();
|
|
40659
40851
|
await startMemoryGc();
|
|
40660
40852
|
await startDbRetention();
|
|
40661
40853
|
startHumanFreeDrain();
|
|
40662
|
-
import("./boot-reembed-
|
|
40854
|
+
import("./boot-reembed-w75maga2.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
|
|
40663
40855
|
console.error("[boot-reembed] startup backfill failed (non-fatal):", err);
|
|
40664
40856
|
});
|
|
40665
|
-
import("./boot-reembed-
|
|
40857
|
+
import("./boot-reembed-dwzfttdr.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
|
|
40666
40858
|
console.error("[boot-reembed-scripts] startup backfill failed (non-fatal):", err);
|
|
40667
40859
|
});
|
|
40668
|
-
import("./boot-scrub-sweep-
|
|
40860
|
+
import("./boot-scrub-sweep-e9kq43kf.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
|
|
40669
40861
|
console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
|
|
40670
40862
|
});
|
|
40671
40863
|
}).on("error", (err) => {
|