@desplega.ai/agent-swarm 2.4.2 → 2.4.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-dv7hmx4r.js → acp-adapter-thq04adh.js} +4 -5
- package/dist/{actions-51nc1gny.js → actions-j6ywh6x5.js} +18 -18
- package/dist/{amp-adapter-abp5tdx8.js → amp-adapter-k8b5xmj8.js} +3 -3
- package/dist/{app-9h14qvr6.js → app-rb7vc02s.js} +3 -3
- package/dist/{assistant-wv1gz3mt.js → assistant-ftta1zjf.js} +20 -20
- package/dist/{boot-reembed-6yn53ms9.js → boot-reembed-srp6v6af.js} +1 -1
- package/dist/{boot-reembed-7fcka4z5.js → boot-reembed-xns7h5h9.js} +1 -1
- package/dist/{boot-scrub-sweep-pm1580ax.js → boot-scrub-sweep-3qqrh2mz.js} +3 -3
- package/dist/{boot-seeds-g5hfc1x8.js → boot-seeds-9ks8hce7.js} +4 -4
- package/dist/{claude-adapter-gf3kxhf0.js → claude-adapter-k5ksyres.js} +4 -4
- package/dist/{claude-managed-setup-h00hsgtz.js → claude-managed-setup-n5a5eqks.js} +1 -1
- package/dist/{claude-sdk-session-s2k1qd8y.js → claude-sdk-session-2j3j4kwn.js} +9822 -9749
- package/dist/{cli-pkht5hap.js → cli-1d70crsy.js} +2 -2
- package/dist/{cli-r99kc9yq.js → cli-1ephgwnq.js} +3 -3
- package/dist/{cli-7225gwj7.js → cli-1m17dc9d.js} +1 -1
- package/dist/{cli-bcj753sq.js → cli-2v045xyf.js} +3 -3
- package/dist/{cli-h38rjv87.js → cli-2y91wnbh.js} +12 -7
- package/dist/{cli-sv5gb0yb.js → cli-2zqpkvtt.js} +1 -1
- package/dist/{cli-xbzvet96.js → cli-36ckw0wx.js} +5 -4
- package/dist/{cli-8sxqsbbq.js → cli-37yb7307.js} +1 -1
- package/dist/{cli-hyfw2j1e.js → cli-3cgngyd8.js} +11 -11
- package/dist/{cli-a4gvwttf.js → cli-44159k28.js} +2 -2
- package/dist/{cli-7awf1fp8.js → cli-4dg55wsk.js} +3 -3
- package/dist/{cli-mhywgrrz.js → cli-4sydckyj.js} +1 -1
- package/dist/{cli-y2x52gs2.js → cli-51y09c6p.js} +20 -17
- package/dist/{cli-ahtpy9kf.js → cli-55qmbp6z.js} +10 -5
- package/dist/{cli-pw7v69vp.js → cli-625tb7aq.js} +1 -1
- package/dist/{cli-x5mq1fyq.js → cli-74c1wpm0.js} +3 -3
- package/dist/{cli-b1dfr1m4.js → cli-7a6p4e65.js} +1 -1
- package/dist/{cli-hqhzg1qq.js → cli-82d3nkc3.js} +1 -1
- package/dist/{cli-nmqdc2t3.js → cli-9fhkkpj5.js} +78 -12
- package/dist/{cli-h93c9vb3.js → cli-amyhm3gj.js} +1 -1
- package/dist/{cli-0qvtffe9.js → cli-b8k7epj1.js} +6 -6
- package/dist/{cli-1pa3rz69.js → cli-ba8ne1es.js} +6 -1
- package/dist/{cli-g0hgtz4p.js → cli-bnz0r3kc.js} +3 -3
- package/dist/{cli-0hyhdkdk.js → cli-cebvbc9t.js} +4 -1
- package/dist/{cli-efaqv1c7.js → cli-cynvc9fj.js} +35 -7
- package/dist/{cli-8zwe9mpk.js → cli-dqb4n629.js} +10 -10
- package/dist/{cli-7a91w22y.js → cli-e8xyjvfc.js} +1 -1
- package/dist/{cli-s6vr7r2d.js → cli-esxerzg7.js} +1 -1
- package/dist/{cli-w9g4sz81.js → cli-gf2850q7.js} +1 -1
- package/dist/{cli-10hhg0km.js → cli-gqvh8d8a.js} +7 -7
- package/dist/{cli-t30yj95q.js → cli-hj3debgw.js} +1 -1
- package/dist/{cli-fpmsqq59.js → cli-nc35pxb7.js} +3 -3
- package/dist/{cli-d3qqdy4c.js → cli-p20r8w42.js} +16 -14
- package/dist/{cli-shvfedvm.js → cli-pccfmtb5.js} +5 -5
- package/dist/{cli-02qm7src.js → cli-q6r7t299.js} +1037 -299
- package/dist/{cli-2wag8973.js → cli-qeaq3j6t.js} +1 -1
- package/dist/{cli-nn47d7e8.js → cli-qkhc5aqy.js} +15 -15
- package/dist/{cli-faypxz7q.js → cli-t7cyef5g.js} +4 -4
- package/dist/{cli-z4wd2ftv.js → cli-te6b5wvg.js} +149 -184
- package/dist/{cli-5rk36sjf.js → cli-v3yr2gbg.js} +119 -44
- package/dist/{cli-239yjk27.js → cli-vdm20wej.js} +5 -5
- package/dist/{cli-zfg9enh9.js → cli-vfha21c9.js} +6 -1
- package/dist/{cli-rdyw3mct.js → cli-vq97g1jq.js} +6 -5
- package/dist/{cli-n85dqg6d.js → cli-w6nadkh4.js} +4 -4
- package/dist/{cli-99jez72r.js → cli-w9etnnxk.js} +6 -1
- package/dist/{cli-saw9a6f6.js → cli-xc27fwzg.js} +2 -2
- package/dist/{cli-ftyypbg5.js → cli-xj0re5tm.js} +1 -1
- package/dist/{cli-fyzjmseb.js → cli-zrk6jxv8.js} +1 -1
- package/dist/{cli-y8n5k515.js → cli-zrwpctp4.js} +28 -28
- package/dist/cli.js +44 -19
- package/dist/{codex-adapter-ttygw382.js → codex-adapter-968xwfy7.js} +2 -2
- package/dist/{codex-hook-x7nejyrr.js → codex-hook-e2he7aca.js} +2 -2
- package/dist/{codex-session-runner-60b58vv3.js → codex-session-runner-ht4z99fa.js} +2 -2
- package/dist/{commands-edmdwa4x.js → commands-pcymaeg9.js} +3 -3
- package/dist/{controller-m263fg43.js → controller-fpjyk46r.js} +3 -3
- package/dist/{controllers-connect-5fym8sw1.js → controllers-connect-mwzx1fh6.js} +19 -19
- package/dist/{cursor-adapter-cz6nm6mj.js → cursor-adapter-cp4s2e2f.js} +2 -2
- package/dist/{db-2y0mgstc.js → db-sgd12bt9.js} +3 -3
- package/dist/{db-nn0hcmx5.js → db-xsjg9jqq.js} +2 -2
- package/dist/{dispatcher-0a9wwjcx.js → dispatcher-x0jfw2c9.js} +17 -17
- package/dist/{dsh-adapter-3n3net33.js → dsh-adapter-jrq7ma7h.js} +2 -2
- package/dist/{e2b-thdcxtjd.js → e2b-16d6ch39.js} +1 -1
- package/dist/{e2b-7am6tmq6.js → e2b-zn0b4w5w.js} +1 -1
- package/dist/{external-channel-zhvt95n3.js → external-channel-8njj4h3b.js} +2 -2
- package/dist/{grok-adapter-qnr1hp2y.js → grok-adapter-kkr97v2f.js} +5 -6
- package/dist/handlers-0pvee9nw.js +39 -0
- package/dist/{heartbeat-gz97r7ac.js → heartbeat-wd03zhn0.js} +20 -20
- package/dist/{hook-1mmdgjqs.js → hook-f0vghj42.js} +10 -5
- package/dist/{hook-x8rthca4.js → hook-xzj2ts2p.js} +2 -2
- package/dist/{http-r8f85xr9.js → http-4hwxv62p.js} +261 -123
- package/dist/{index-va3y63es.js → index-6srwvd5b.js} +1 -2
- package/dist/{index-y7rbcrc1.js → index-97q4xn03.js} +20 -11
- package/dist/{index-s98037v0.js → index-cbxkmfc5.js} +1 -2
- package/dist/{index-vzvfqzfj.js → index-gdh8jrdm.js} +17 -17
- package/dist/{index-aex0eba9.js → index-hg0x2cdv.js} +17 -17
- package/dist/index-thm0y6a8.js +41 -0
- package/dist/{index-smxyk04s.js → index-ww2vznkp.js} +1 -1
- package/dist/{keepalive-64c0f34c.js → keepalive-hrh7xnr9.js} +3 -3
- package/dist/{lead-b1da0f97.js → lead-ee8vazz2.js} +30 -31
- package/dist/{maintenance-mnxpar12.js → maintenance-e8wnwnqx.js} +1 -1
- package/dist/{oauth-refresh-sweep-36hs2v4h.js → oauth-refresh-sweep-zm0yj4sj.js} +2 -2
- package/dist/{onboard-xes8de61.js → onboard-dtwcq603.js} +3 -3
- package/dist/{opencode-adapter-3s7ax02e.js → opencode-adapter-x4tqzhkh.js} +3 -3
- package/dist/{otel-impl-fzc57kcq.js → otel-impl-w3fbhpn0.js} +1 -1
- package/dist/{pi-mono-adapter-ytp7gz8b.js → pi-mono-adapter-mcfkn9vf.js} +3 -3
- package/dist/{pricing-refresh-1nek2w7b.js → pricing-refresh-j38dehfs.js} +3 -3
- package/dist/{rbac-roles-ttyfaep2.js → rbac-roles-ae8yttq4.js} +3 -3
- package/dist/{rbac-roles-sqefb5hw.js → rbac-roles-ejxx9b35.js} +2 -2
- package/dist/{render-v2-vb527jwn.js → render-v2-n16n0phe.js} +3 -3
- package/dist/{resume-jcdzg1bn.js → resume-z0fgjc38.js} +5 -5
- package/dist/{session-access-zsp4wsp0.js → session-access-cv3mq6mc.js} +6 -4
- package/dist/{setup-1nb2zqd3.js → setup-mafhj3yt.js} +1 -1
- package/dist/{work-objects-61w08fwr.js → work-objects-8b86mgjp.js} +21 -21
- package/dist/{worker-c1e68hpa.js → worker-16s75hm5.js} +30 -31
- package/dist/worker-token-xf11yyds.js +136 -0
- package/openapi.json +295 -12
- package/package.json +5 -5
- package/src/apps/action-runner.ts +4 -0
- package/src/apps/catalog.generated.json +3 -0
- package/src/apps/page-validator.ts +8 -2
- package/src/be/db.ts +7 -4
- package/src/be/migrations/231_slack_tasks_last_updated_index.sql +5 -0
- package/src/be/migrations/232_agent_session_tokens.sql +41 -0
- package/src/be/seed-scripts/catalog/heartbeat-jev-gate.ts +10 -1
- package/src/be/swarm-config-guard.ts +16 -0
- package/src/be/users.ts +169 -12
- package/src/cli.tsx +24 -0
- package/src/commands/worker-token.ts +164 -0
- package/src/github/handlers.ts +6 -5
- package/src/hooks/hook.ts +2 -1
- package/src/http/apps.ts +43 -5
- package/src/http/codex-oauth-keep-warm.ts +27 -9
- package/src/http/config.ts +5 -3
- package/src/http/core.ts +2 -0
- package/src/http/session-access.ts +51 -2
- package/src/http/sessions.ts +249 -10
- package/src/http/tasks.ts +4 -32
- package/src/providers/acp-adapter.ts +33 -13
- package/src/providers/acp-swarm-events.ts +1 -1
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/codex-adapter.ts +4 -4
- package/src/providers/codex-oauth/storage.ts +1 -1
- package/src/providers/opencode-adapter.ts +2 -2
- package/src/providers/pi-mono-extension.ts +2 -1
- package/src/rbac/legacy-policy.ts +3 -1
- package/src/rbac/permissions.ts +4 -0
- package/src/tests/acp-adapter.test.ts +10 -23
- package/src/tests/acp-fake-agent.ts +36 -0
- package/src/tests/acp-swarm-events.test.ts +1 -1
- package/src/tests/agent-session-tokens.test.ts +452 -0
- package/src/tests/apps-action-parent-task.test.ts +295 -0
- package/src/tests/claude-stop-hook.test.ts +47 -0
- package/src/tests/codex-adapter.test.ts +42 -0
- package/src/tests/codex-oauth-keep-warm.test.ts +85 -1
- package/src/tests/config-session-auth.test.ts +14 -0
- package/src/tests/docs-index-footprint.test.js +2 -2
- package/src/tests/env-flag.test.ts +15 -1
- package/src/tests/github-handlers-cancel-config.test.ts +29 -8
- package/src/tests/github-handlers-inline-comments.test.ts +9 -2
- package/src/tests/grok-adapter.test.ts +3 -3
- package/src/tests/heartbeat-jev-gate.test.ts +23 -0
- package/src/tests/migration-232-agent-session-tokens.test.ts +67 -0
- package/src/tests/rbac-engine.test.ts +1 -0
- package/src/tests/runtime-child-token-cleanup.test.ts +3 -3
- package/src/tests/script-connections.test.ts +4 -0
- package/src/tests/session-route-posture.test.ts +2 -0
- package/src/tests/skill-script-refs.test.ts +63 -0
- package/src/tests/slack-render-v2-query-plans.test.ts +147 -0
- package/src/tests/worker-token-cli.test.ts +76 -0
- package/src/tests/workflow-executors.test.ts +4 -2
- package/src/tests/workflow-system-one-extraction.test.ts +805 -0
- package/src/types.ts +2 -1
- package/src/utils/env-flag.ts +9 -0
- package/src/utils/request-auth-context.ts +2 -1
- package/src/workflows/definition.ts +7 -1
- package/src/workflows/engine.ts +18 -12
- package/src/workflows/executors/index.ts +1 -0
- package/src/workflows/executors/registry.ts +2 -0
- package/src/workflows/executors/system-one-decision.ts +56 -255
- package/src/workflows/executors/system-one-extract-wire.ts +57 -0
- package/src/workflows/executors/system-one-extraction.ts +830 -0
- package/src/workflows/executors/system-one-providers.ts +277 -110
- package/src/workflows/executors/system-one-transport.ts +264 -0
- package/templates/official/lead/HEARTBEAT.md +1 -1
- package/templates/skills/apps/SKILL.md +4 -1
- package/templates/skills/apps/content.md +4 -1
- package/templates/skills/code-quality/content.md +9 -14
- package/templates/skills/heartbeat-runbook/content.md +3 -3
- package/dist/cli-v1sjhn52.js +0 -7
- package/dist/handlers-dkcarkd0.js +0 -39
- package/dist/index-5jecgp3n.js +0 -41
|
@@ -177,6 +177,9 @@ import {
|
|
|
177
177
|
scheduleIntegrationsReload,
|
|
178
178
|
handleCore,
|
|
179
179
|
userCtx,
|
|
180
|
+
requestPrincipal,
|
|
181
|
+
agentFirstPrincipal,
|
|
182
|
+
rejectGuest,
|
|
180
183
|
handleApps,
|
|
181
184
|
cancelApprovalRequest,
|
|
182
185
|
getUserCommsPrefs,
|
|
@@ -280,7 +283,7 @@ import {
|
|
|
280
283
|
hasCapability,
|
|
281
284
|
getEnabledCapabilities,
|
|
282
285
|
createServer
|
|
283
|
-
} from "./cli-
|
|
286
|
+
} from "./cli-v3yr2gbg.js";
|
|
284
287
|
import {
|
|
285
288
|
chatThreadOfContextKey,
|
|
286
289
|
agentContextKey,
|
|
@@ -446,6 +449,7 @@ import {
|
|
|
446
449
|
reservedKeyError,
|
|
447
450
|
MAX_DB_RETENTION_DAYS,
|
|
448
451
|
DB_RETENTION_TUNING_BOUNDS,
|
|
452
|
+
CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS,
|
|
449
453
|
validateConfigValue,
|
|
450
454
|
validateExportToEnv,
|
|
451
455
|
init_swarm_config_guard,
|
|
@@ -716,26 +720,26 @@ import {
|
|
|
716
720
|
countScriptRunJournalSteps2,
|
|
717
721
|
countScriptRunJournalAgentTaskSteps2,
|
|
718
722
|
init_db3
|
|
719
|
-
} from "./cli-
|
|
723
|
+
} from "./cli-p20r8w42.js";
|
|
720
724
|
import {
|
|
721
725
|
getUserGrant2,
|
|
722
726
|
init_rbac_roles
|
|
723
|
-
} from "./cli-
|
|
724
|
-
import"./cli-
|
|
727
|
+
} from "./cli-4dg55wsk.js";
|
|
728
|
+
import"./cli-t7cyef5g.js";
|
|
725
729
|
import {
|
|
726
730
|
normalizeModelKey
|
|
727
|
-
} from "./cli-
|
|
731
|
+
} from "./cli-amyhm3gj.js";
|
|
728
732
|
import {
|
|
729
733
|
upsertModelCatalogOverlay,
|
|
730
734
|
deleteModelCatalogOverlay,
|
|
731
735
|
loadModelsCatalog,
|
|
732
736
|
requestModelCatalogRefresh2
|
|
733
|
-
} from "./cli-
|
|
737
|
+
} from "./cli-xc27fwzg.js";
|
|
734
738
|
import {
|
|
735
739
|
AMP_ESTIMATE_MODELS,
|
|
736
740
|
ampBillsCacheWrites,
|
|
737
741
|
resolveAmpModel
|
|
738
|
-
} from "./cli-
|
|
742
|
+
} from "./cli-2zqpkvtt.js";
|
|
739
743
|
import {
|
|
740
744
|
automationIntegrationFixUrl,
|
|
741
745
|
preflightAutomation,
|
|
@@ -747,7 +751,7 @@ import {
|
|
|
747
751
|
cancelWorkflowRun2,
|
|
748
752
|
TriggerSchemaError,
|
|
749
753
|
startWorkflowExecution2
|
|
750
|
-
} from "./cli-
|
|
754
|
+
} from "./cli-51y09c6p.js";
|
|
751
755
|
import {
|
|
752
756
|
require_dist2,
|
|
753
757
|
isInvalidClientError,
|
|
@@ -827,14 +831,14 @@ import {
|
|
|
827
831
|
typecheckWithAmbient,
|
|
828
832
|
typecheckScript,
|
|
829
833
|
parseSkillContent
|
|
830
|
-
} from "./cli-
|
|
834
|
+
} from "./cli-2y91wnbh.js";
|
|
831
835
|
import {
|
|
832
836
|
buildAuthorizationUrl,
|
|
833
837
|
exchangeAuthorizationCode,
|
|
834
838
|
oauthAppRowToProviderConfig,
|
|
835
839
|
forceRefreshAuthorizationOrThrow,
|
|
836
840
|
forceRefreshTokenOrThrow
|
|
837
|
-
} from "./cli-
|
|
841
|
+
} from "./cli-esxerzg7.js";
|
|
838
842
|
import {
|
|
839
843
|
signalProcessGroup,
|
|
840
844
|
detachedProcessGroup,
|
|
@@ -862,14 +866,14 @@ import {
|
|
|
862
866
|
getSlackApp2,
|
|
863
867
|
startSlackApp2,
|
|
864
868
|
stopSlackApp2
|
|
865
|
-
} from "./cli-
|
|
866
|
-
import"./cli-
|
|
869
|
+
} from "./cli-qkhc5aqy.js";
|
|
870
|
+
import"./cli-1d70crsy.js";
|
|
867
871
|
import {
|
|
868
872
|
createApprovalFollowUpTask,
|
|
869
873
|
generateEdges,
|
|
870
874
|
definitionNodeIds,
|
|
871
875
|
validateDefinition
|
|
872
|
-
} from "./cli-
|
|
876
|
+
} from "./cli-q6r7t299.js";
|
|
873
877
|
import"./cli-8nyhf7za.js";
|
|
874
878
|
import {
|
|
875
879
|
_fetchHolder,
|
|
@@ -922,15 +926,16 @@ import {
|
|
|
922
926
|
canReadSession2,
|
|
923
927
|
readableByFor2,
|
|
924
928
|
SESSION_WRITE_DENIED2,
|
|
929
|
+
denyParentAttach2,
|
|
925
930
|
runtimeInstanceHeader,
|
|
926
931
|
bodyTask,
|
|
927
932
|
bodyListTask,
|
|
928
933
|
describeRequestRoute,
|
|
929
934
|
route
|
|
930
|
-
} from "./cli-
|
|
935
|
+
} from "./cli-cynvc9fj.js";
|
|
931
936
|
import {
|
|
932
937
|
isMultiRuntimeEnabled
|
|
933
|
-
} from "./cli-
|
|
938
|
+
} from "./cli-e8xyjvfc.js";
|
|
934
939
|
import {
|
|
935
940
|
FilesError,
|
|
936
941
|
normalizeFilesError,
|
|
@@ -958,7 +963,7 @@ import {
|
|
|
958
963
|
resolvePoolDelivery2,
|
|
959
964
|
createPoolAgent2,
|
|
960
965
|
init_db
|
|
961
|
-
} from "./cli-
|
|
966
|
+
} from "./cli-w6nadkh4.js";
|
|
962
967
|
import {
|
|
963
968
|
RATING_MODEL_MAX_LENGTH,
|
|
964
969
|
REFERENCES_SOURCE_MAX_LENGTH,
|
|
@@ -974,8 +979,8 @@ import {
|
|
|
974
979
|
checkHeartbeatChecklist2,
|
|
975
980
|
runHeartbeatSweep2,
|
|
976
981
|
stopHeartbeat2
|
|
977
|
-
} from "./cli-
|
|
978
|
-
import"./cli-
|
|
982
|
+
} from "./cli-3cgngyd8.js";
|
|
983
|
+
import"./cli-82d3nkc3.js";
|
|
979
984
|
import {
|
|
980
985
|
import_websocket,
|
|
981
986
|
import_websocket_server
|
|
@@ -984,7 +989,7 @@ import {
|
|
|
984
989
|
runtimeSupervisorStatus,
|
|
985
990
|
startRuntimeSupervisor,
|
|
986
991
|
stopRuntimeSupervisor
|
|
987
|
-
} from "./cli-
|
|
992
|
+
} from "./cli-dqb4n629.js";
|
|
988
993
|
import"./cli-ns59dc6r.js";
|
|
989
994
|
import {
|
|
990
995
|
ACP_TARGET_IDS
|
|
@@ -1004,11 +1009,11 @@ import {
|
|
|
1004
1009
|
memoryRelevance,
|
|
1005
1010
|
isUnknownModelError,
|
|
1006
1011
|
writeSkillsToFilesystem
|
|
1007
|
-
} from "./cli-
|
|
1012
|
+
} from "./cli-xj0re5tm.js";
|
|
1008
1013
|
import {
|
|
1009
1014
|
inviteEmailToSharedOrg,
|
|
1010
1015
|
ensureAgentFsCredentialsForAgent
|
|
1011
|
-
} from "./cli-
|
|
1016
|
+
} from "./cli-hj3debgw.js";
|
|
1012
1017
|
import {
|
|
1013
1018
|
Anthropic
|
|
1014
1019
|
} from "./cli-er83cjbn.js";
|
|
@@ -1041,9 +1046,13 @@ import {
|
|
|
1041
1046
|
mintSessionToken,
|
|
1042
1047
|
mintRuntimeToken,
|
|
1043
1048
|
revokeSessionToken,
|
|
1049
|
+
AgentTokenExistsError,
|
|
1050
|
+
mintAgentToken,
|
|
1051
|
+
rotateAgentToken,
|
|
1052
|
+
revokeAgentTokens,
|
|
1044
1053
|
fingerprintApiKey,
|
|
1045
1054
|
init_users
|
|
1046
|
-
} from "./cli-
|
|
1055
|
+
} from "./cli-9fhkkpj5.js";
|
|
1047
1056
|
import"./cli-v41kn3cd.js";
|
|
1048
1057
|
import"./cli-wgtk7xxr.js";
|
|
1049
1058
|
import {
|
|
@@ -1057,7 +1066,7 @@ import {
|
|
|
1057
1066
|
clearAuditSink,
|
|
1058
1067
|
can,
|
|
1059
1068
|
init_rbac
|
|
1060
|
-
} from "./cli-
|
|
1069
|
+
} from "./cli-ba8ne1es.js";
|
|
1061
1070
|
import {
|
|
1062
1071
|
isSafeBundlePath,
|
|
1063
1072
|
init_bundle_path,
|
|
@@ -1199,20 +1208,20 @@ import {
|
|
|
1199
1208
|
KvKeySchema,
|
|
1200
1209
|
KvEntrySchema,
|
|
1201
1210
|
init_types
|
|
1202
|
-
} from "./cli-
|
|
1211
|
+
} from "./cli-nc35pxb7.js";
|
|
1203
1212
|
import {
|
|
1204
1213
|
IDENTITY_FIELD_BUDGETS,
|
|
1205
1214
|
IdentityFieldBudgetError,
|
|
1206
1215
|
init_identity_field_budget
|
|
1207
|
-
} from "./cli-
|
|
1216
|
+
} from "./cli-74c1wpm0.js";
|
|
1208
1217
|
import {
|
|
1209
1218
|
getSlackConfiguration,
|
|
1210
1219
|
init_config
|
|
1211
|
-
} from "./cli-
|
|
1220
|
+
} from "./cli-qeaq3j6t.js";
|
|
1212
1221
|
import {
|
|
1213
1222
|
isSteeringEnabled2,
|
|
1214
1223
|
init_steering_enabled
|
|
1215
|
-
} from "./cli-
|
|
1224
|
+
} from "./cli-4sydckyj.js";
|
|
1216
1225
|
import {
|
|
1217
1226
|
interpolate,
|
|
1218
1227
|
init_template,
|
|
@@ -1272,7 +1281,7 @@ import {
|
|
|
1272
1281
|
import {
|
|
1273
1282
|
init_package,
|
|
1274
1283
|
package_default
|
|
1275
|
-
} from "./cli-
|
|
1284
|
+
} from "./cli-pccfmtb5.js";
|
|
1276
1285
|
import {
|
|
1277
1286
|
realtimeBus,
|
|
1278
1287
|
init_bus
|
|
@@ -1285,12 +1294,12 @@ import {
|
|
|
1285
1294
|
getPublicMcpBaseUrl,
|
|
1286
1295
|
agentFsFileRoute,
|
|
1287
1296
|
init_constants2
|
|
1288
|
-
} from "./cli-
|
|
1297
|
+
} from "./cli-gf2850q7.js";
|
|
1289
1298
|
import {
|
|
1290
1299
|
parseEnvFlag,
|
|
1291
1300
|
isEnvFlagEnabled,
|
|
1292
1301
|
init_env_flag
|
|
1293
|
-
} from "./cli-
|
|
1302
|
+
} from "./cli-cebvbc9t.js";
|
|
1294
1303
|
import {
|
|
1295
1304
|
getApiKey,
|
|
1296
1305
|
init_api_key
|
|
@@ -6511,47 +6520,6 @@ init_db2();
|
|
|
6511
6520
|
init_rbac();
|
|
6512
6521
|
init_types();
|
|
6513
6522
|
init_request_auth_context();
|
|
6514
|
-
|
|
6515
|
-
// src/http/request-principal.ts
|
|
6516
|
-
init_db3();
|
|
6517
|
-
init_request_auth_context();
|
|
6518
|
-
async function requestPrincipal(req, myAgentId) {
|
|
6519
|
-
const auth = getRequestAuth(req);
|
|
6520
|
-
if (auth?.kind === "controller")
|
|
6521
|
-
return { kind: "guest" };
|
|
6522
|
-
if (auth?.kind === "operator")
|
|
6523
|
-
return { kind: "operator" };
|
|
6524
|
-
if (auth?.kind === "user")
|
|
6525
|
-
return { kind: "user", userId: auth.userId };
|
|
6526
|
-
if (auth?.kind === "guest")
|
|
6527
|
-
return { kind: "guest" };
|
|
6528
|
-
if (!myAgentId)
|
|
6529
|
-
return null;
|
|
6530
|
-
const agent = await getAgentById2(myAgentId);
|
|
6531
|
-
return { kind: "agent", agentId: myAgentId, isLead: agent?.isLead ?? false };
|
|
6532
|
-
}
|
|
6533
|
-
async function agentFirstPrincipal(req, myAgentId) {
|
|
6534
|
-
const auth = getRequestAuth(req);
|
|
6535
|
-
if (auth?.kind === "controller")
|
|
6536
|
-
return { kind: "guest" };
|
|
6537
|
-
if (auth?.kind === "user")
|
|
6538
|
-
return { kind: "user", userId: auth.userId };
|
|
6539
|
-
if (auth?.kind === "guest")
|
|
6540
|
-
return { kind: "guest" };
|
|
6541
|
-
const agentId = auth?.kind === "agent" ? auth.agentId : myAgentId;
|
|
6542
|
-
if (!agentId)
|
|
6543
|
-
return { kind: "operator" };
|
|
6544
|
-
const agent = await getAgentById2(agentId);
|
|
6545
|
-
return { kind: "agent", agentId, isLead: agent?.isLead === true };
|
|
6546
|
-
}
|
|
6547
|
-
function rejectGuest(req, res) {
|
|
6548
|
-
if (getRequestAuth(req)?.kind !== "guest")
|
|
6549
|
-
return false;
|
|
6550
|
-
jsonError(res, "Forbidden", 403);
|
|
6551
|
-
return true;
|
|
6552
|
-
}
|
|
6553
|
-
|
|
6554
|
-
// src/http/assets.ts
|
|
6555
6523
|
var AssetKeyAuditIssueSchema = object2({
|
|
6556
6524
|
severity: _enum2(["fatal", "warning"]),
|
|
6557
6525
|
code: _enum2([
|
|
@@ -8150,7 +8118,7 @@ async function requestSecretReadScope(req, resolvedScope) {
|
|
|
8150
8118
|
source: "http"
|
|
8151
8119
|
}).allow)
|
|
8152
8120
|
return "all";
|
|
8153
|
-
if (
|
|
8121
|
+
if (auth.tokenKind === "task" || resolvedScope?.agentId !== auth.agentId)
|
|
8154
8122
|
return "none";
|
|
8155
8123
|
return "self";
|
|
8156
8124
|
}
|
|
@@ -8168,7 +8136,7 @@ async function resolveSecretsRead(req, includeSecrets, resolvedScope) {
|
|
|
8168
8136
|
const auth = getRequestAuth(req);
|
|
8169
8137
|
return {
|
|
8170
8138
|
effectiveIncludeSecrets: includeSecrets && scope !== "none",
|
|
8171
|
-
includeRepoSecrets: !(auth?.kind === "agent" && auth.
|
|
8139
|
+
includeRepoSecrets: !(auth?.kind === "agent" && auth.tokenKind !== "task" && scope !== "all"),
|
|
8172
8140
|
secretsNote: includeSecrets && scope === "none" ? SECRETS_FORCE_MASK_NOTE : ""
|
|
8173
8141
|
};
|
|
8174
8142
|
}
|
|
@@ -8350,7 +8318,7 @@ async function handleConfig(req, res, pathSegments, queryParams) {
|
|
|
8350
8318
|
const key = parsed.query.key;
|
|
8351
8319
|
const auth = getRequestAuth(req);
|
|
8352
8320
|
const resolvedScope = {
|
|
8353
|
-
agentId: parsed.query.agentId || (auth?.kind === "agent" && auth.
|
|
8321
|
+
agentId: parsed.query.agentId || (auth?.kind === "agent" && auth.tokenKind !== "task" ? auth.agentId : undefined),
|
|
8354
8322
|
repoId: parsed.query.repoId || undefined
|
|
8355
8323
|
};
|
|
8356
8324
|
const { effectiveIncludeSecrets, includeRepoSecrets, secretsNote } = await resolveSecretsRead(req, includeSecrets, resolvedScope);
|
|
@@ -8824,10 +8792,18 @@ async function handleCodexOAuthDevice(req, res, pathSegments, queryParams) {
|
|
|
8824
8792
|
// src/http/codex-oauth-keep-warm.ts
|
|
8825
8793
|
init_zod();
|
|
8826
8794
|
init_db3();
|
|
8795
|
+
init_swarm_config_guard();
|
|
8827
8796
|
init_api_key();
|
|
8828
8797
|
init_codex_auth_failure();
|
|
8829
8798
|
init_constants2();
|
|
8830
|
-
var
|
|
8799
|
+
var DEFAULT_KEEP_WARM_MAX_AGE_HOURS = 120;
|
|
8800
|
+
function keepWarmMaxAgeMs(env = process.env) {
|
|
8801
|
+
const raw = env.CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS?.trim();
|
|
8802
|
+
const { min, max } = CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS;
|
|
8803
|
+
const value = raw && /^\d+$/.test(raw) ? Number(raw) : Number.NaN;
|
|
8804
|
+
const hours = value >= min && value <= max ? value : DEFAULT_KEEP_WARM_MAX_AGE_HOURS;
|
|
8805
|
+
return hours * 60 * 60 * 1000;
|
|
8806
|
+
}
|
|
8831
8807
|
var slotOutcomeSchema = discriminatedUnion("outcome", [
|
|
8832
8808
|
object2({ slot: number2(), keySuffix: string2(), outcome: literal2("warm") }),
|
|
8833
8809
|
object2({ slot: number2(), keySuffix: string2(), outcome: literal2("refreshed") }),
|
|
@@ -8845,7 +8821,7 @@ var keepWarmRoute = route({
|
|
|
8845
8821
|
path: "/api/oauth/keep-warm/codex",
|
|
8846
8822
|
pattern: ["api", "oauth", "keep-warm", "codex"],
|
|
8847
8823
|
summary: "Locked keep-warm refresh sweep across all Codex OAuth pool slots",
|
|
8848
|
-
description: "Enumerates codex_oauth_* slots and refreshes any older than
|
|
8824
|
+
description: "Enumerates codex_oauth_* slots and refreshes any older than CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS (default 120 hours) through the same locked getValidCodexOAuth path used at task time. Skips slots with a codex-auth-watch bench marker (auth-failure bench or codex-auth-expiry-watch).",
|
|
8849
8825
|
tags: ["OAuth"],
|
|
8850
8826
|
responses: {
|
|
8851
8827
|
200: {
|
|
@@ -8862,6 +8838,7 @@ async function handleCodexOAuthKeepWarm(req, res, pathSegments) {
|
|
|
8862
8838
|
return true;
|
|
8863
8839
|
const apiUrl = getMcpBaseUrl();
|
|
8864
8840
|
const apiKey = getApiKey();
|
|
8841
|
+
const maxAgeMs = keepWarmMaxAgeMs();
|
|
8865
8842
|
const slots = await loadAllCodexOAuthSlots(apiUrl, apiKey);
|
|
8866
8843
|
const results = [];
|
|
8867
8844
|
for (const { slot, creds } of slots) {
|
|
@@ -8872,9 +8849,7 @@ async function handleCodexOAuthKeepWarm(req, res, pathSegments) {
|
|
|
8872
8849
|
}
|
|
8873
8850
|
try {
|
|
8874
8851
|
const beforeAccess = creds.access;
|
|
8875
|
-
const refreshed = await getValidCodexOAuth(apiUrl, apiKey, slot, {
|
|
8876
|
-
maxAgeMs: KEEP_WARM_MAX_AGE_MS
|
|
8877
|
-
});
|
|
8852
|
+
const refreshed = await getValidCodexOAuth(apiUrl, apiKey, slot, { maxAgeMs });
|
|
8878
8853
|
if (!refreshed) {
|
|
8879
8854
|
results.push({ slot, outcome: "no-credentials" });
|
|
8880
8855
|
} else {
|
|
@@ -22736,10 +22711,6 @@ var updateTaskTitleRoute = route({
|
|
|
22736
22711
|
ungated: "mirrors the pre-RBAC PATCH /api/tasks/{id}/vcs sibling route: bearer auth only"
|
|
22737
22712
|
}
|
|
22738
22713
|
});
|
|
22739
|
-
async function hasSessionWrite(req, myAgentId, taskId) {
|
|
22740
|
-
const access = await sessionAccessFor2(await resolveSessionActor2(req, myAgentId), taskId);
|
|
22741
|
-
return hasSessionAccess(access, "write");
|
|
22742
|
-
}
|
|
22743
22714
|
async function canSteerTask(req, myAgentId, task, sessionAccess = "none") {
|
|
22744
22715
|
const auth = getRequestAuth(req);
|
|
22745
22716
|
const resource = {
|
|
@@ -22919,23 +22890,7 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
22919
22890
|
}
|
|
22920
22891
|
const parentTask = parsed.body.parentTaskId ? await getTaskById2(parsed.body.parentTaskId) : null;
|
|
22921
22892
|
const principal = await resolveTaskWritePrincipal(req, myAgentId);
|
|
22922
|
-
if (parentTask &&
|
|
22923
|
-
principal,
|
|
22924
|
-
verb: "task.parent.attach",
|
|
22925
|
-
resource: {
|
|
22926
|
-
kind: "task",
|
|
22927
|
-
taskId: parentTask.id,
|
|
22928
|
-
requestedByUserId: parentTask.requestedByUserId,
|
|
22929
|
-
creatorAgentId: parentTask.creatorAgentId,
|
|
22930
|
-
agentId: parentTask.agentId
|
|
22931
|
-
},
|
|
22932
|
-
source: "http"
|
|
22933
|
-
}).allow) {
|
|
22934
|
-
jsonError(res, `You don't have context for parent task ${parentTask.id}.`, 403);
|
|
22935
|
-
return true;
|
|
22936
|
-
}
|
|
22937
|
-
if (parentTask && !await hasSessionWrite(req, myAgentId, parentTask.id)) {
|
|
22938
|
-
jsonError(res, SESSION_WRITE_DENIED2, 403);
|
|
22893
|
+
if (parentTask && await denyParentAttach2(req, res, myAgentId, parentTask, principal)) {
|
|
22939
22894
|
return true;
|
|
22940
22895
|
}
|
|
22941
22896
|
if (principal.kind === "agent" && parsed.body.contextKey && parsed.body.contextKey !== parentTask?.contextKey && chatThreadOfContextKey(parsed.body.contextKey) && !can({ principal, verb: "integration.chat.post", resource: { kind: "none" }, source: "http" }).allow) {
|
|
@@ -33147,6 +33102,7 @@ async function handleSessionData(req, res, pathSegments, queryParams, myAgentId)
|
|
|
33147
33102
|
// src/http/sessions.ts
|
|
33148
33103
|
init_zod();
|
|
33149
33104
|
init_db3();
|
|
33105
|
+
init_rbac_roles();
|
|
33150
33106
|
init_steering();
|
|
33151
33107
|
init_users();
|
|
33152
33108
|
init_rbac();
|
|
@@ -33203,7 +33159,7 @@ var mintSessionTokenRoute = route({
|
|
|
33203
33159
|
none: "user tokens cannot mint: the handler admits only the operator key or the task's own runtime"
|
|
33204
33160
|
},
|
|
33205
33161
|
summary: "Mint an ephemeral task or runtime token",
|
|
33206
|
-
description: "Operators can mint task or runtime tokens. Runtime tokens can mint task tokens for their own assigned tasks.
|
|
33162
|
+
description: "Operators can mint task or runtime tokens. Runtime and agent tokens can mint task tokens for their own assigned tasks. A child token never outlives its parent and is revoked with it.",
|
|
33207
33163
|
tags: ["Sessions"],
|
|
33208
33164
|
body: object2({
|
|
33209
33165
|
agentId: string2().min(1),
|
|
@@ -33229,7 +33185,7 @@ var mintSessionTokenRoute = route({
|
|
|
33229
33185
|
},
|
|
33230
33186
|
auth: { apiKey: true },
|
|
33231
33187
|
rbac: {
|
|
33232
|
-
ungated: "operator or runtime token minting for its own assigned task, enforced in the handler"
|
|
33188
|
+
ungated: "operator, or a runtime or agent token minting for its own assigned task, enforced in the handler"
|
|
33233
33189
|
}
|
|
33234
33190
|
});
|
|
33235
33191
|
var revokeSessionTokenRoute = route({
|
|
@@ -33237,7 +33193,7 @@ var revokeSessionTokenRoute = route({
|
|
|
33237
33193
|
path: "/api/sessions/tokens/{tokenId}",
|
|
33238
33194
|
pattern: ["api", "sessions", "tokens", null],
|
|
33239
33195
|
summary: "Revoke an ephemeral session token",
|
|
33240
|
-
description: "Operators can revoke any ephemeral token.
|
|
33196
|
+
description: "Operators can revoke any ephemeral token. Agent tokens, and runtime tokens when runtime pools are enabled, can revoke their own child task tokens. Repeated revocation has no effect.",
|
|
33241
33197
|
tags: ["Sessions"],
|
|
33242
33198
|
params: object2({ tokenId: string2() }),
|
|
33243
33199
|
responses: {
|
|
@@ -33247,9 +33203,188 @@ var revokeSessionTokenRoute = route({
|
|
|
33247
33203
|
},
|
|
33248
33204
|
auth: { apiKey: true },
|
|
33249
33205
|
rbac: {
|
|
33250
|
-
ungated: "operator or runtime token revoking its own child, enforced in the handler"
|
|
33206
|
+
ungated: "operator, or a runtime or agent token revoking its own child, enforced in the handler"
|
|
33251
33207
|
}
|
|
33252
33208
|
});
|
|
33209
|
+
var AGENT_TOKEN_ROTATE_GRACE_SEC = 300;
|
|
33210
|
+
var AgentTokenSchema = object2({
|
|
33211
|
+
agentId: string2(),
|
|
33212
|
+
tokenId: string2(),
|
|
33213
|
+
plaintext: string2(),
|
|
33214
|
+
expiresAt: string2().nullable().describe("null when the token does not expire")
|
|
33215
|
+
});
|
|
33216
|
+
var agentTokenTtl = number2().int().positive().optional().describe("Token lifetime in ms. Omit for the default (no expiry).");
|
|
33217
|
+
var mintAgentTokenRoute = route({
|
|
33218
|
+
method: "post",
|
|
33219
|
+
path: "/api/agents/{id}/token",
|
|
33220
|
+
pattern: ["api", "agents", null, "token"],
|
|
33221
|
+
operationId: "agents_mintWorkerToken",
|
|
33222
|
+
summary: "Mint an agent-bound worker token",
|
|
33223
|
+
description: "Returns the token once. A worker runs on it in place of the swarm API key and acts only as this agent. Creates the agent when it does not exist and `name` is given. Fails with 409 when the agent already holds an active token.",
|
|
33224
|
+
tags: ["Sessions"],
|
|
33225
|
+
params: object2({ id: string2().min(1) }),
|
|
33226
|
+
body: object2({ name: string2().min(1).optional(), ttlMs: agentTokenTtl }).strict().optional(),
|
|
33227
|
+
responses: {
|
|
33228
|
+
200: {
|
|
33229
|
+
description: "Minted worker token",
|
|
33230
|
+
schema: AgentTokenSchema.extend({ agentCreated: boolean() })
|
|
33231
|
+
},
|
|
33232
|
+
403: { description: "Operator or user credentials required" },
|
|
33233
|
+
404: { description: "Agent not found and no name given" },
|
|
33234
|
+
409: { description: "Agent already holds an active token" }
|
|
33235
|
+
},
|
|
33236
|
+
rbac: { permission: "agent.token.manage" }
|
|
33237
|
+
});
|
|
33238
|
+
var rotateAgentTokenRoute = route({
|
|
33239
|
+
method: "post",
|
|
33240
|
+
path: "/api/agents/{id}/token/rotate",
|
|
33241
|
+
pattern: ["api", "agents", null, "token", "rotate"],
|
|
33242
|
+
operationId: "agents_rotateWorkerToken",
|
|
33243
|
+
summary: "Rotate an agent-bound worker token",
|
|
33244
|
+
description: "Returns a new token once. The previous token keeps working for `graceSec` (default 300), then expires. Use revoke for a token that must stop now.",
|
|
33245
|
+
tags: ["Sessions"],
|
|
33246
|
+
params: object2({ id: string2().min(1) }),
|
|
33247
|
+
body: object2({ graceSec: number2().int().min(0).max(86400).optional(), ttlMs: agentTokenTtl }).strict().optional(),
|
|
33248
|
+
responses: {
|
|
33249
|
+
200: {
|
|
33250
|
+
description: "New worker token",
|
|
33251
|
+
schema: AgentTokenSchema.extend({ previousExpiresAt: string2() })
|
|
33252
|
+
},
|
|
33253
|
+
403: { description: "Operator or user credentials required" },
|
|
33254
|
+
404: { description: "Agent holds no active token" }
|
|
33255
|
+
},
|
|
33256
|
+
rbac: { permission: "agent.token.manage" }
|
|
33257
|
+
});
|
|
33258
|
+
var revokeAgentTokenRoute = route({
|
|
33259
|
+
method: "delete",
|
|
33260
|
+
path: "/api/agents/{id}/token",
|
|
33261
|
+
pattern: ["api", "agents", null, "token"],
|
|
33262
|
+
operationId: "agents_revokeWorkerToken",
|
|
33263
|
+
summary: "Revoke an agent-bound worker token",
|
|
33264
|
+
description: "Revokes every active worker token of the agent and the task tokens they minted. Open realtime connections on them close.",
|
|
33265
|
+
tags: ["Sessions"],
|
|
33266
|
+
params: object2({ id: string2().min(1) }),
|
|
33267
|
+
responses: {
|
|
33268
|
+
200: {
|
|
33269
|
+
description: "Number of worker tokens revoked (0 when none was active)",
|
|
33270
|
+
schema: object2({ revoked: number2().int() })
|
|
33271
|
+
},
|
|
33272
|
+
403: { description: "Operator or user credentials required" }
|
|
33273
|
+
},
|
|
33274
|
+
rbac: { permission: "agent.token.manage" }
|
|
33275
|
+
});
|
|
33276
|
+
var AGENT_TOKEN_ROUTES = [mintAgentTokenRoute, rotateAgentTokenRoute, revokeAgentTokenRoute];
|
|
33277
|
+
async function ensureAgentTokenManager(req, res, agentId) {
|
|
33278
|
+
const auth = getRequestAuth(req);
|
|
33279
|
+
if (auth?.kind !== "operator" && auth?.kind !== "user") {
|
|
33280
|
+
jsonError(res, "Worker tokens require operator or user credentials", 403);
|
|
33281
|
+
return false;
|
|
33282
|
+
}
|
|
33283
|
+
const header = req.headers["x-agent-id"];
|
|
33284
|
+
const decision = can({
|
|
33285
|
+
principal: await agentFirstPrincipal(req, Array.isArray(header) ? header[0] : header),
|
|
33286
|
+
verb: "agent.token.manage",
|
|
33287
|
+
resource: { kind: "agent", agentId },
|
|
33288
|
+
source: "http"
|
|
33289
|
+
});
|
|
33290
|
+
if (!decision.allow) {
|
|
33291
|
+
jsonError(res, decision.reason, 403);
|
|
33292
|
+
return false;
|
|
33293
|
+
}
|
|
33294
|
+
if (auth.kind === "user" && isRbacEnabled()) {
|
|
33295
|
+
const grant = await getUserGrant2(auth.userId);
|
|
33296
|
+
if (!grant.grantsAll) {
|
|
33297
|
+
const target = await getAgentById2(agentId);
|
|
33298
|
+
const targetActsOnAny = can({
|
|
33299
|
+
principal: { kind: "agent", agentId, isLead: target?.isLead ?? false },
|
|
33300
|
+
verb: "agent.act.any",
|
|
33301
|
+
resource: { kind: "agent", agentId },
|
|
33302
|
+
source: "http"
|
|
33303
|
+
}).allow;
|
|
33304
|
+
if (targetActsOnAny) {
|
|
33305
|
+
jsonError(res, "A lead agent's worker token requires a grant-all role", 403);
|
|
33306
|
+
return false;
|
|
33307
|
+
}
|
|
33308
|
+
const missing = ["agent.act.any", "config.read.secrets"].filter((verb) => !grant.verbs.has(verb));
|
|
33309
|
+
if (missing.length > 0) {
|
|
33310
|
+
jsonError(res, `Worker tokens also require: ${missing.join(", ")}`, 403);
|
|
33311
|
+
return false;
|
|
33312
|
+
}
|
|
33313
|
+
}
|
|
33314
|
+
}
|
|
33315
|
+
return true;
|
|
33316
|
+
}
|
|
33317
|
+
async function handleAgentTokens(req, res, pathSegments, queryParams) {
|
|
33318
|
+
const matched = AGENT_TOKEN_ROUTES.find((def) => def.match(req.method, pathSegments));
|
|
33319
|
+
if (!matched)
|
|
33320
|
+
return false;
|
|
33321
|
+
if (!await ensureAgentTokenManager(req, res, pathSegments[2]))
|
|
33322
|
+
return true;
|
|
33323
|
+
res.setHeader("Cache-Control", "no-store");
|
|
33324
|
+
if (matched === mintAgentTokenRoute) {
|
|
33325
|
+
const parsed = await mintAgentTokenRoute.parse(req, res, pathSegments, queryParams);
|
|
33326
|
+
if (!parsed)
|
|
33327
|
+
return true;
|
|
33328
|
+
const agentId = parsed.params.id;
|
|
33329
|
+
const result = await getDbClient2().transaction(async () => {
|
|
33330
|
+
let agentCreated = false;
|
|
33331
|
+
if (!await getAgentById2(agentId)) {
|
|
33332
|
+
if (!parsed.body?.name)
|
|
33333
|
+
return { status: 404 };
|
|
33334
|
+
await createAgent2({
|
|
33335
|
+
id: agentId,
|
|
33336
|
+
name: parsed.body.name,
|
|
33337
|
+
isLead: false,
|
|
33338
|
+
status: "offline",
|
|
33339
|
+
capabilities: [],
|
|
33340
|
+
maxTasks: 1
|
|
33341
|
+
});
|
|
33342
|
+
agentCreated = true;
|
|
33343
|
+
}
|
|
33344
|
+
return {
|
|
33345
|
+
status: 200,
|
|
33346
|
+
agentCreated,
|
|
33347
|
+
token: await mintAgentToken(agentId, parsed.body?.ttlMs)
|
|
33348
|
+
};
|
|
33349
|
+
}).catch((error) => {
|
|
33350
|
+
if (error instanceof AgentTokenExistsError)
|
|
33351
|
+
return { status: 409 };
|
|
33352
|
+
throw error;
|
|
33353
|
+
});
|
|
33354
|
+
if (result.status === 404) {
|
|
33355
|
+
jsonError(res, "Agent not found; pass name to create it", 404);
|
|
33356
|
+
return true;
|
|
33357
|
+
}
|
|
33358
|
+
if (result.status === 409) {
|
|
33359
|
+
jsonError(res, "Agent already holds an active worker token; rotate or revoke it", 409);
|
|
33360
|
+
return true;
|
|
33361
|
+
}
|
|
33362
|
+
mintAgentTokenRoute.respond(res, 200, {
|
|
33363
|
+
agentId,
|
|
33364
|
+
...result.token,
|
|
33365
|
+
agentCreated: result.agentCreated
|
|
33366
|
+
});
|
|
33367
|
+
return true;
|
|
33368
|
+
}
|
|
33369
|
+
if (matched === rotateAgentTokenRoute) {
|
|
33370
|
+
const parsed = await rotateAgentTokenRoute.parse(req, res, pathSegments, queryParams);
|
|
33371
|
+
if (!parsed)
|
|
33372
|
+
return true;
|
|
33373
|
+
const graceSec = parsed.body?.graceSec ?? AGENT_TOKEN_ROTATE_GRACE_SEC;
|
|
33374
|
+
const token = await rotateAgentToken(parsed.params.id, graceSec * 1000, parsed.body?.ttlMs);
|
|
33375
|
+
if (!token) {
|
|
33376
|
+
jsonError(res, "Agent holds no active worker token", 404);
|
|
33377
|
+
return true;
|
|
33378
|
+
}
|
|
33379
|
+
rotateAgentTokenRoute.respond(res, 200, { agentId: parsed.params.id, ...token });
|
|
33380
|
+
return true;
|
|
33381
|
+
}
|
|
33382
|
+
const parsed = await revokeAgentTokenRoute.parse(req, res, pathSegments, queryParams);
|
|
33383
|
+
if (!parsed)
|
|
33384
|
+
return true;
|
|
33385
|
+
revokeAgentTokenRoute.respond(res, 200, { revoked: await revokeAgentTokens(parsed.params.id) });
|
|
33386
|
+
return true;
|
|
33387
|
+
}
|
|
33253
33388
|
var listSessions = route({
|
|
33254
33389
|
method: "get",
|
|
33255
33390
|
path: "/api/sessions",
|
|
@@ -33347,9 +33482,11 @@ async function accessForRoot(actor, root) {
|
|
|
33347
33482
|
return actor.kind === "bypass" ? "owner" : sessionAccessForRoot(actor.userId, root);
|
|
33348
33483
|
}
|
|
33349
33484
|
async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
33485
|
+
if (await handleAgentTokens(req, res, pathSegments, queryParams))
|
|
33486
|
+
return true;
|
|
33350
33487
|
if (mintSessionTokenRoute.match(req.method, pathSegments)) {
|
|
33351
33488
|
const auth = getRequestAuth(req);
|
|
33352
|
-
if (auth?.kind !== "operator" && !(auth?.kind === "agent" && auth.
|
|
33489
|
+
if (auth?.kind !== "operator" && !(auth?.kind === "agent" && auth.tokenKind !== "task")) {
|
|
33353
33490
|
jsonError(res, "Unauthorized", 401);
|
|
33354
33491
|
return true;
|
|
33355
33492
|
}
|
|
@@ -33394,7 +33531,7 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
33394
33531
|
}
|
|
33395
33532
|
if (revokeSessionTokenRoute.match(req.method, pathSegments)) {
|
|
33396
33533
|
const auth = getRequestAuth(req);
|
|
33397
|
-
if (auth?.kind !== "operator" && !(
|
|
33534
|
+
if (auth?.kind !== "operator" && !(auth?.kind === "agent" && (auth.tokenKind === "agent" || auth.tokenKind === "runtime" && isRuntimePoolsEnabled()))) {
|
|
33398
33535
|
jsonError(res, "Unauthorized", 401);
|
|
33399
33536
|
return true;
|
|
33400
33537
|
}
|
|
@@ -33403,7 +33540,8 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
33403
33540
|
return true;
|
|
33404
33541
|
const revoked = await getDbClient2().transaction(async (client) => {
|
|
33405
33542
|
if (auth.kind === "agent") {
|
|
33406
|
-
const child = await client.get(
|
|
33543
|
+
const child = await client.get(`SELECT id FROM session_tokens WHERE id = ? AND agentId = ? AND taskId IS NOT NULL
|
|
33544
|
+
AND ${auth.runtimeId ? "parentRuntimeId" : "parentTokenId"} = ?`, [parsed.params.tokenId, auth.agentId, auth.runtimeId ?? auth.tokenId]);
|
|
33407
33545
|
if (!child)
|
|
33408
33546
|
return false;
|
|
33409
33547
|
}
|
|
@@ -39126,7 +39264,7 @@ var httpServer = createHttpServer(async (req, res) => {
|
|
|
39126
39264
|
});
|
|
39127
39265
|
});
|
|
39128
39266
|
var detachRealtime = attachRealtimeTransport(httpServer);
|
|
39129
|
-
var { attachControllerTransport } = await import("./controllers-connect-
|
|
39267
|
+
var { attachControllerTransport } = await import("./controllers-connect-mwzx1fh6.js");
|
|
39130
39268
|
var detachControllers = attachControllerTransport(httpServer);
|
|
39131
39269
|
var stopWorkerNudges = startWorkerNudgeListener();
|
|
39132
39270
|
var stopRoomDeletion = realtimeBus.subscribe("room:namespace-deleted", (namespace) => {
|
|
@@ -39155,7 +39293,7 @@ async function shutdown() {
|
|
|
39155
39293
|
sessionsProcessed: getServerSessionsProcessed()
|
|
39156
39294
|
});
|
|
39157
39295
|
if (hasCapability("scheduling")) {
|
|
39158
|
-
const { stopScheduler } = await import("./index-
|
|
39296
|
+
const { stopScheduler } = await import("./index-hg0x2cdv.js");
|
|
39159
39297
|
stopScheduler();
|
|
39160
39298
|
}
|
|
39161
39299
|
stopHeartbeat2();
|
|
@@ -39167,7 +39305,7 @@ async function shutdown() {
|
|
|
39167
39305
|
await stopSlackApp2();
|
|
39168
39306
|
await stopChatSdk();
|
|
39169
39307
|
if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
|
|
39170
|
-
const { stopOAuthKeepalive } = await import("./keepalive-
|
|
39308
|
+
const { stopOAuthKeepalive } = await import("./keepalive-hrh7xnr9.js");
|
|
39171
39309
|
await stopOAuthKeepalive();
|
|
39172
39310
|
}
|
|
39173
39311
|
stopOAuthPendingGc();
|
|
@@ -39247,21 +39385,21 @@ try {
|
|
|
39247
39385
|
console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
|
|
39248
39386
|
}
|
|
39249
39387
|
try {
|
|
39250
|
-
const { ensurePricingSeeded } = await import("./boot-seeds-
|
|
39388
|
+
const { ensurePricingSeeded } = await import("./boot-seeds-9ks8hce7.js");
|
|
39251
39389
|
ensurePricingSeeded();
|
|
39252
|
-
const { startPricingRefreshLoop } = await import("./pricing-refresh-
|
|
39390
|
+
const { startPricingRefreshLoop } = await import("./pricing-refresh-j38dehfs.js");
|
|
39253
39391
|
startPricingRefreshLoop();
|
|
39254
39392
|
} catch (err) {
|
|
39255
39393
|
console.error("[startup] Failed to seed pricing rows:", err);
|
|
39256
39394
|
}
|
|
39257
39395
|
try {
|
|
39258
|
-
const { ensureModelProfilesSeeded } = await import("./boot-seeds-
|
|
39396
|
+
const { ensureModelProfilesSeeded } = await import("./boot-seeds-9ks8hce7.js");
|
|
39259
39397
|
await ensureModelProfilesSeeded();
|
|
39260
39398
|
} catch (err) {
|
|
39261
39399
|
console.error("[startup] Failed to seed model profiles:", err);
|
|
39262
39400
|
}
|
|
39263
39401
|
try {
|
|
39264
|
-
const { ensureRbacSeeded } = await import("./boot-seeds-
|
|
39402
|
+
const { ensureRbacSeeded } = await import("./boot-seeds-9ks8hce7.js");
|
|
39265
39403
|
ensureRbacSeeded();
|
|
39266
39404
|
} catch (err) {
|
|
39267
39405
|
console.error("[startup] Failed to sync RBAC seed rows:", err);
|
|
@@ -39269,7 +39407,7 @@ try {
|
|
|
39269
39407
|
throw err;
|
|
39270
39408
|
}
|
|
39271
39409
|
try {
|
|
39272
|
-
const { runAllSeeders } = await import("./index-
|
|
39410
|
+
const { runAllSeeders } = await import("./index-97q4xn03.js");
|
|
39273
39411
|
await runAllSeeders({ scriptEmbeddingMode: "skip" });
|
|
39274
39412
|
} catch (err) {
|
|
39275
39413
|
console.error("[startup] Failed to seed built-in entities:", err);
|
|
@@ -39331,39 +39469,39 @@ httpServer.listen(port, async () => {
|
|
|
39331
39469
|
await initWorkflows2();
|
|
39332
39470
|
await startScriptRunSupervisor(getMcpBaseUrl());
|
|
39333
39471
|
if (hasCapability("scheduling")) {
|
|
39334
|
-
const { startScheduler } = await import("./index-
|
|
39335
|
-
const { getExecutorRegistry } = await import("./index-
|
|
39472
|
+
const { startScheduler } = await import("./index-hg0x2cdv.js");
|
|
39473
|
+
const { getExecutorRegistry } = await import("./index-gdh8jrdm.js");
|
|
39336
39474
|
const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
|
|
39337
39475
|
startScheduler(getExecutorRegistry(), intervalMs, {
|
|
39338
39476
|
runId: globalState.__runId
|
|
39339
39477
|
});
|
|
39340
39478
|
}
|
|
39341
39479
|
if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
|
|
39342
|
-
const { startHeartbeat } = await import("./index-
|
|
39480
|
+
const { startHeartbeat } = await import("./index-thm0y6a8.js");
|
|
39343
39481
|
const heartbeatMs = Number(process.env.HEARTBEAT_INTERVAL_MS) || 90000;
|
|
39344
39482
|
startHeartbeat(heartbeatMs);
|
|
39345
39483
|
}
|
|
39346
39484
|
startPoolRouting();
|
|
39347
39485
|
startRuntimeSupervisor();
|
|
39348
39486
|
if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
|
|
39349
|
-
const { startOAuthKeepalive } = await import("./keepalive-
|
|
39487
|
+
const { startOAuthKeepalive } = await import("./keepalive-hrh7xnr9.js");
|
|
39350
39488
|
startOAuthKeepalive();
|
|
39351
39489
|
}
|
|
39352
39490
|
if (process.env.OAUTH_REFRESH_SWEEP_DISABLE !== "true") {
|
|
39353
|
-
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-
|
|
39491
|
+
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-zm0yj4sj.js");
|
|
39354
39492
|
startOAuthRefreshSweep();
|
|
39355
39493
|
}
|
|
39356
39494
|
startOAuthPendingGc();
|
|
39357
39495
|
await startMemoryGc();
|
|
39358
39496
|
await startDbRetention();
|
|
39359
39497
|
startHumanFreeDrain();
|
|
39360
|
-
import("./boot-reembed-
|
|
39498
|
+
import("./boot-reembed-srp6v6af.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
|
|
39361
39499
|
console.error("[boot-reembed] startup backfill failed (non-fatal):", err);
|
|
39362
39500
|
});
|
|
39363
|
-
import("./boot-reembed-
|
|
39501
|
+
import("./boot-reembed-xns7h5h9.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
|
|
39364
39502
|
console.error("[boot-reembed-scripts] startup backfill failed (non-fatal):", err);
|
|
39365
39503
|
});
|
|
39366
|
-
import("./boot-scrub-sweep-
|
|
39504
|
+
import("./boot-scrub-sweep-3qqrh2mz.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
|
|
39367
39505
|
console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
|
|
39368
39506
|
});
|
|
39369
39507
|
}).on("error", (err) => {
|