@desplega.ai/agent-swarm 2.4.5 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/{acp-adapter-2wdkktv6.js → acp-adapter-11gp67nr.js} +8 -6
- package/dist/{actions-c40ebcm4.js → actions-8p2kze8j.js} +23 -21
- package/dist/{amp-adapter-wb67m95z.js → amp-adapter-z4qvhacj.js} +2 -2
- package/dist/{anthropic-messages-g6pqmqk4.js → anthropic-messages-txs190dd.js} +17 -20
- package/dist/{app-353vre8g.js → app-0qp0a2gk.js} +3 -3
- package/dist/{assistant-sj1njh23.js → assistant-jedd3ktm.js} +24 -22
- package/dist/{azure-openai-responses-9dbmj346.js → azure-openai-responses-9kfwhmn7.js} +18 -13
- package/dist/{boot-reembed-qdkvxeem.js → boot-reembed-4xwq5tg0.js} +1 -1
- package/dist/{boot-reembed-b9c3az3c.js → boot-reembed-n4wq5dd2.js} +1 -1
- package/dist/{boot-scrub-sweep-m3wh8eks.js → boot-scrub-sweep-69h90xcq.js} +4 -4
- package/dist/{boot-seeds-j2273s54.js → boot-seeds-3vn0m9sg.js} +4 -4
- package/dist/{claude-adapter-m7q0a085.js → claude-adapter-221mvad5.js} +8 -6
- package/dist/{claude-managed-adapter-5ptb6tzs.js → claude-managed-adapter-gt6pa35d.js} +2 -2
- package/dist/{claude-managed-setup-smrqk5j5.js → claude-managed-setup-c3hp36ph.js} +4 -4
- package/dist/{claude-sdk-session-38xnz21e.js → claude-sdk-session-8thjsk5e.js} +9012 -8928
- package/dist/{cli-b9fcxxev.js → cli-007cnhm1.js} +50 -4
- package/dist/{cli-j4rqdf2n.js → cli-03vpq45j.js} +2 -2
- package/dist/{cli-dk44dxec.js → cli-0y6f0ckq.js} +1 -1
- package/dist/{cli-kpw04va0.js → cli-0z3vjrpm.js} +1 -1
- package/dist/{cli-94gwyg7m.js → cli-179xcyky.js} +9 -9
- package/dist/{cli-3r8samv3.js → cli-1f0gp9vz.js} +3 -2
- package/dist/{cli-4zfqgjc5.js → cli-1pr672hz.js} +2 -2
- package/dist/{cli-0bqteszy.js → cli-2nf3b08t.js} +328 -25
- package/dist/{cli-43x64hv3.js → cli-36j4jnk3.js} +4 -4
- package/dist/{cli-k8g16gz3.js → cli-3qv8naq8.js} +115 -119
- package/dist/cli-3zwye9sn.js +1193 -0
- package/dist/{cli-60cgh1rv.js → cli-459fk97x.js} +7 -7
- package/dist/{cli-v8fjakwf.js → cli-4w24f7z3.js} +1 -1
- package/dist/{cli-n72rg53p.js → cli-5kzk3472.js} +812 -418
- package/dist/{cli-h7gc0b4r.js → cli-5m84zd2k.js} +55 -18
- package/dist/{cli-j99azg3g.js → cli-5rvg1ddk.js} +5 -5
- package/dist/{cli-dvkmp9bt.js → cli-6ctwrf1z.js} +20 -10
- package/dist/{cli-848hxdwj.js → cli-6rg2jn2y.js} +2 -1
- package/dist/{cli-fv5hepyy.js → cli-7bwtc6yx.js} +3 -3
- package/dist/{cli-ms85309d.js → cli-7g40g8hq.js} +11 -11
- package/dist/{cli-xpa64rek.js → cli-92mqenkc.js} +2362 -159
- package/dist/{cli-018r4jq6.js → cli-9ce2xw98.js} +8 -8
- package/dist/{cli-1syn2xy1.js → cli-bgdtv62r.js} +32 -18
- package/dist/{cli-wxbn3yfx.js → cli-cz5nmdxt.js} +2 -2
- package/dist/{cli-wt645v7q.js → cli-dabehxhp.js} +1 -1
- package/dist/{cli-vfha21c9.js → cli-e5bxnjps.js} +2 -2
- package/dist/{cli-wt0jf9hm.js → cli-fcc5qe3f.js} +553 -193
- package/dist/{cli-ftc1g5tj.js → cli-fes51ya2.js} +3 -3
- package/dist/{cli-3a45zcgm.js → cli-ftmq4nvk.js} +2 -2
- package/dist/{cli-37j04k05.js → cli-fy1jyyym.js} +13 -13
- package/dist/{cli-s95dknxh.js → cli-g1cw7xtt.js} +1 -1
- package/dist/{cli-74c1wpm0.js → cli-gpv60278.js} +1 -1
- package/dist/{cli-pemywhfq.js → cli-ha9rmwgq.js} +2 -1
- package/dist/{cli-g35m2xwm.js → cli-j1eghqfm.js} +2 -2
- package/dist/{cli-qfxc84gh.js → cli-jpxsrxcb.js} +1 -1
- package/dist/{cli-ejs3m1sx.js → cli-kxpfx2xr.js} +1 -1
- package/dist/{cli-p14m2cnp.js → cli-mbfj11fq.js} +1 -1
- package/dist/{cli-pnp2j5zg.js → cli-mmhj8vd7.js} +2 -2
- package/dist/{cli-xf234ws8.js → cli-n4c8e3s5.js} +2 -0
- package/dist/{cli-f01h25yt.js → cli-n6kmqngw.js} +2 -2
- package/dist/{cli-v0yrfmdh.js → cli-nnvjb17s.js} +3 -3
- package/dist/{cli-1dmcq2eh.js → cli-nzfnt2gs.js} +1 -1
- package/dist/{cli-625tb7aq.js → cli-p859hcc8.js} +2 -2
- package/dist/{cli-smvcw9z5.js → cli-pasyvjmm.js} +1 -1
- package/dist/cli-pkaqk57w.js +128 -0
- package/dist/{cli-8nyhf7za.js → cli-qqzmjxkf.js} +129 -105
- package/dist/{cli-9yqgm9nd.js → cli-r25qpaxt.js} +161 -63
- package/dist/{cli-eww120g8.js → cli-rh5smt8t.js} +18 -4
- package/dist/{cli-qwkcwjdn.js → cli-rycdaj0a.js} +1 -1
- package/dist/{cli-a92r1127.js → cli-s4sntwt4.js} +2 -2
- package/dist/{cli-be2161h1.js → cli-segs7hx9.js} +6 -6
- package/dist/{cli-36ckw0wx.js → cli-stxdrqs2.js} +2 -2
- package/dist/{cli-z7d29rw9.js → cli-sy8f9705.js} +4 -4
- package/dist/{cli-1m17dc9d.js → cli-ta8bd7th.js} +2 -2
- package/dist/{cli-st8aw1m6.js → cli-we0ra057.js} +4 -4
- package/dist/{cli-7c9qs530.js → cli-x21dqn18.js} +5 -5
- package/dist/{cli-1sp861s4.js → cli-x6vf4sad.js} +11 -11
- package/dist/{cli-d2mb5s8a.js → cli-x77gen2p.js} +680 -440
- package/dist/{cli-tw4p90jb.js → cli-xawhpgc9.js} +5 -5
- package/dist/{cli-f0g3pgvf.js → cli-xd4eqtr2.js} +2 -2
- package/dist/{cli-1f3qzw6y.js → cli-xt768r5m.js} +2 -2
- package/dist/{cli-cxxe61f6.js → cli-y4x8ww6s.js} +2 -2
- package/dist/{cli-bnes4z6b.js → cli-y9jvxfhk.js} +3 -3
- package/dist/{cli-qwhy2qma.js → cli-z63a269p.js} +2 -2
- package/dist/{cli-sm8rses9.js → cli-zfdp01hn.js} +8 -5
- package/dist/cli.js +29 -27
- package/dist/{cloudflare-workers-ai-system-one-ch2wxfcp.js → cloudflare-workers-ai-system-one-43v9qkjk.js} +7 -2
- package/dist/{codex-adapter-tn6k5mkg.js → codex-adapter-tcg1q3jk.js} +6 -4
- package/dist/{codex-login-m819c41r.js → codex-login-rn7c5gxt.js} +1 -1
- package/dist/{codex-session-runner-7vjt7jbw.js → codex-session-runner-xfx4wd9x.js} +7 -5
- package/dist/{commands-t7rz9146.js → commands-ew83nj70.js} +2 -2
- package/dist/{controller-m2jasma5.js → controller-gnq1k1mf.js} +4 -4
- package/dist/{controllers-connect-9ftpex99.js → controllers-connect-tw1dan9r.js} +25 -23
- package/dist/{cursor-adapter-mjv79e4z.js → cursor-adapter-yq5xgfcg.js} +1 -1
- package/dist/{db-6sfrn9g3.js → db-7gbc53fd.js} +14 -2
- package/dist/{db-rn673r06.js → db-t86xrnes.js} +3 -3
- package/dist/{devin-adapter-zgqadvnm.js → devin-adapter-4ycy4vrf.js} +1 -1
- package/dist/{dispatcher-c155xz0p.js → dispatcher-64bdyhps.js} +22 -20
- package/dist/{docker-fkgtr75t.js → docker-nfy2gc8t.js} +2 -2
- package/dist/{dsh-adapter-3mmszc1x.js → dsh-adapter-tvhc4k2d.js} +1 -1
- package/dist/{e2b-16d6ch39.js → e2b-9gkdhm3c.js} +2 -2
- package/dist/{e2b-zn0b4w5w.js → e2b-cjtf8k1z.js} +2 -2
- package/dist/{easter-egg-3d-5cgynaja.js → easter-egg-3d-e4qv8dxj.js} +1 -1
- package/dist/{event-bus-9vpk8gmq.js → event-bus-3z78ep5n.js} +1 -1
- package/dist/{execute-t4e6m3rw.js → execute-0xpz8950.js} +85 -23
- package/dist/{external-channel-35k6tkv8.js → external-channel-e9nw24zv.js} +2 -2
- package/dist/{google-generative-ai-bmq8gkf3.js → google-generative-ai-mk9vcpe1.js} +15 -15
- package/dist/{google-vertex-b1rvp52s.js → google-vertex-q580kz8k.js} +20 -20
- package/dist/{grok-adapter-tfrq7tg1.js → grok-adapter-v82srhrx.js} +9 -7
- package/dist/handlers-c9ajzhbn.js +41 -0
- package/dist/{heartbeat-dyg4npkp.js → heartbeat-2vqs1319.js} +25 -23
- package/dist/{hook-x26b31bg.js → hook-01nk13wx.js} +7 -5
- package/dist/{hook-drspbwpe.js → hook-jzpheegg.js} +9 -7
- package/dist/{http-pk972xyw.js → http-fc1k6ec8.js} +544 -76
- package/dist/index-07ef7nkm.js +42 -0
- package/dist/{index-g6tbb6ve.js → index-31ceyf42.js} +1 -1
- package/dist/index-7yts8n9s.js +43 -0
- package/dist/index-q3t40ryv.js +46 -0
- package/dist/{index-arytgj5q.js → index-sepja052.js} +1 -1
- package/dist/{index-jwxkkex2.js → index-zdycv3ja.js} +13 -11
- package/dist/{index-g216q6jr.js → index-zsyx51ap.js} +1 -4
- package/dist/{keepalive-7yrng7px.js → keepalive-5nh2rhmr.js} +4 -4
- package/dist/lead-aayq64jn.js +79 -0
- package/dist/{llama-cpp-classify-vv43gswy.js → llama-cpp-classify-ee7vmd7q.js} +4 -1
- package/dist/{maintenance-e6cemdqt.js → maintenance-hjhzdt3k.js} +1 -1
- package/dist/{mistral-conversations-1medfwv7.js → mistral-conversations-sd0xf1tn.js} +13 -13
- package/dist/{node-de6akczr.js → node-jzjj7r9x.js} +1 -1
- package/dist/{oauth-refresh-sweep-yw3xdbcj.js → oauth-refresh-sweep-y3n1knmd.js} +3 -3
- package/dist/{onboard-0a9y5yrc.js → onboard-1zq3m7db.js} +2 -2
- package/dist/{openai-codex-responses-de9pvs4d.js → openai-codex-responses-79s8xnbh.js} +29 -23
- package/dist/{openai-completions-mtqge3nf.js → openai-completions-tdbyts0x.js} +21 -20
- package/dist/{openai-decisions-ygk4kkxd.js → openai-decisions-bqhnjyfz.js} +2 -1
- package/dist/{openai-responses-dkyng71g.js → openai-responses-dm3t5vqp.js} +26 -17
- package/dist/{opencode-adapter-x4tqzhkh.js → opencode-adapter-e56086m1.js} +7 -5
- package/dist/{openrouter-images-wvv7camj.js → openrouter-images-ssttr1y4.js} +6 -3
- package/dist/{otel-impl-trjpkfb7.js → otel-impl-h9yyza47.js} +2 -2
- package/dist/{pi-messages-nhh1pkz2.js → pi-messages-3nf8bq1a.js} +6 -4
- package/dist/{pi-mono-adapter-mcfkn9vf.js → pi-mono-adapter-tzps8f38.js} +9 -37
- package/dist/{pricing-refresh-d2b5my0y.js → pricing-refresh-nevhat8h.js} +3 -3
- package/dist/{rbac-roles-nxh5ahwk.js → rbac-roles-4y6ngvzq.js} +1 -1
- package/dist/{rbac-roles-hey3yv9d.js → rbac-roles-exbg8xb6.js} +2 -2
- package/dist/{render-v2-rr3p2atg.js → render-v2-cfsh13z3.js} +3 -3
- package/dist/{resume-2efkf1s1.js → resume-5s2t0dbs.js} +10 -8
- package/dist/{runtime-xe3aqy4x.js → runtime-bt5pkpm1.js} +1 -1
- package/dist/{session-access-s2mttxpw.js → session-access-dnbyp3cn.js} +6 -4
- package/dist/{setup-vypma5yt.js → setup-1wj1y77j.js} +1 -1
- package/dist/{typesafe-system-one-2hgpayzy.js → typesafe-system-one-bre38hvs.js} +4 -2
- package/dist/{virtual-modules-4r3zkc20.js → virtual-modules-mnfbh5mr.js} +8 -2
- package/dist/{work-objects-rvhckdkp.js → work-objects-7mg6216g.js} +25 -23
- package/dist/worker-nwb789mg.js +79 -0
- package/dist/{x-y45mthwn.js → x-pbpezr0s.js} +2 -2
- package/openapi.json +785 -5
- package/package.json +9 -9
- package/src/assets/key.ts +17 -0
- package/src/azure-devops/handlers.ts +1 -1
- package/src/be/db/approvals.ts +18 -0
- package/src/be/db/session-moves.ts +164 -0
- package/src/be/db/session-tree.ts +384 -0
- package/src/be/db/tasks/read.ts +40 -4
- package/src/be/db/workflow-runs.ts +96 -0
- package/src/be/db.ts +80 -236
- package/src/be/onboarding.ts +3 -0
- package/src/be/skill-sync.ts +43 -2
- package/src/be/swarm-config-guard.ts +1 -0
- package/src/bitbucket/api.ts +81 -0
- package/src/bitbucket/auth.ts +64 -0
- package/src/bitbucket/handlers.ts +434 -0
- package/src/bitbucket/index.ts +28 -0
- package/src/bitbucket/templates.ts +134 -0
- package/src/bitbucket/types.ts +65 -0
- package/src/commands/runner.ts +55 -3
- package/src/e2b/env.ts +1 -0
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/extensions/contract.ts +2 -2
- package/src/extensions/post-bridge.ts +1 -0
- package/src/github/handlers.ts +6 -6
- package/src/gitlab/handlers.ts +5 -5
- package/src/http/assets.ts +14 -2
- package/src/http/core.ts +12 -0
- package/src/http/index.ts +4 -0
- package/src/http/onboarding.ts +1 -0
- package/src/http/sessions.ts +366 -12
- package/src/http/skills.ts +48 -1
- package/src/http/tasks.ts +1 -1
- package/src/http/users.ts +1 -0
- package/src/http/webhooks.ts +141 -0
- package/src/integrations/chat-sdk/adapters.ts +19 -3
- package/src/integrations/chat-sdk/facts.ts +30 -12
- package/src/integrations/chat-sdk/outbound.ts +38 -1
- package/src/providers/acp-targets.ts +1 -1
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/pi-mono-adapter.ts +5 -53
- package/src/scripts-runtime/types/swarm-extension.d.ts +6 -4
- package/src/slack/handlers.test.ts +158 -0
- package/src/slack/handlers.ts +19 -28
- package/src/tasks/context-key.ts +61 -1
- package/src/tests/bitbucket-auth.test.ts +156 -0
- package/src/tests/bitbucket-handlers.test.ts +425 -0
- package/src/tests/bitbucket-webhook.test.ts +220 -0
- package/src/tests/chat-sdk-inbound.test.ts +39 -0
- package/src/tests/chat-sdk-telegram-markdown.test.ts +92 -0
- package/src/tests/context-key.test.ts +50 -0
- package/src/tests/core-auth.test.ts +5 -0
- package/src/tests/db-task-read-contract.test.ts +7 -0
- package/src/tests/db-task-write-contract.test.ts +6 -0
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/fixtures/bitbucket/pullrequest-comment-created-inline.json +174 -0
- package/src/tests/fixtures/bitbucket/pullrequest-comment-created.json +170 -0
- package/src/tests/fixtures/bitbucket/pullrequest-created-mention.json +132 -0
- package/src/tests/fixtures/bitbucket/pullrequest-created-reviewer.json +140 -0
- package/src/tests/fixtures/bitbucket/pullrequest-fulfilled.json +134 -0
- package/src/tests/fixtures/bitbucket/pullrequest-rejected.json +133 -0
- package/src/tests/generate-mcp-docs.test.ts +101 -0
- package/src/tests/gitlab-handlers.test.ts +3 -3
- package/src/tests/gitlab-vcs-db.test.ts +4 -4
- package/src/tests/integration-disable-flags.test.ts +36 -0
- package/src/tests/mcp-tools.test.ts +1 -1
- package/src/tests/onboarding.test.ts +12 -0
- package/src/tests/pi-codemode.test.ts +8 -2
- package/src/tests/preload-env.test.ts +57 -0
- package/src/tests/preload.ts +21 -0
- package/src/tests/prompt-template-remaining.test.ts +38 -0
- package/src/tests/run-root-coverage.test.ts +39 -0
- package/src/tests/runner-bitbucket-vcs.test.ts +191 -0
- package/src/tests/runner-skills-refresh.test.ts +58 -0
- package/src/tests/secret-scrubber.test.ts +15 -0
- package/src/tests/sessions-move.test.ts +576 -0
- package/src/tests/sessions-tree.test.ts +493 -0
- package/src/tests/skill-files-http.test.ts +50 -0
- package/src/tests/skills-bundle.test.ts +99 -0
- package/src/tests/swarm-config-export-to-env.test.ts +2 -1
- package/src/tests/vcs-bitbucket.test.ts +91 -0
- package/src/tests/vcs-provider-isolation.test.ts +123 -0
- package/src/tests/vcs-provider.test.ts +16 -1
- package/src/tests/vcs-tracking.test.ts +3 -3
- package/src/tests/workflow-foreach-bodies.test.ts +637 -0
- package/src/tests/workflow-foreach-concurrency.test.ts +342 -0
- package/src/tests/workflow-foreach-retry.test.ts +537 -0
- package/src/tests/workflow-foreach.test.ts +44 -23
- package/src/tests/workflow-step-claims.test.ts +6 -6
- package/src/tests/workflow-tla-races.test.ts +2 -2
- package/src/tools/script-delete.ts +1 -1
- package/src/tools/workflows/create-workflow.ts +5 -3
- package/src/types.ts +3 -2
- package/src/utils/config-env-export.ts +1 -0
- package/src/utils/secret-scrubber.ts +4 -0
- package/src/utils/skills-refresh.ts +83 -43
- package/src/vcs/bitbucket.ts +58 -0
- package/src/vcs/index.ts +2 -0
- package/src/vcs/types.ts +2 -2
- package/src/workflows/approval-resolution.ts +4 -1
- package/src/workflows/checkpoint.ts +9 -1
- package/src/workflows/constants.ts +3 -0
- package/src/workflows/definition.ts +48 -17
- package/src/workflows/engine.ts +25 -15
- package/src/workflows/executors/foreach.ts +45 -99
- package/src/workflows/foreach-body.ts +146 -0
- package/src/workflows/foreach-driver.ts +552 -0
- package/src/workflows/foreach-join.ts +206 -7
- package/src/workflows/node-timeout.ts +21 -0
- package/src/workflows/recovery.ts +68 -3
- package/src/workflows/resume.ts +221 -43
- package/src/workflows/retry-poller.ts +39 -24
- package/src/workflows/step-input.ts +59 -0
- package/src/workflows/task-step-routing.ts +114 -56
- package/templates/skills/slack-interaction/content.md +5 -0
- package/templates/skills/work-on-task/SKILL.md +1 -1
- package/templates/skills/work-on-task/content.md +1 -1
- package/dist/cli-9hstj09h.js +0 -2657
- package/dist/cli-yw91rnmw.js +0 -13
- package/dist/handlers-7gw64dxw.js +0 -39
- package/dist/index-bgdyvcnv.js +0 -40
- package/dist/index-gabbcdn2.js +0 -43
- package/dist/index-tfb26zhy.js +0 -41
- package/dist/lead-7e02z839.js +0 -77
- package/dist/worker-5snytpbd.js +0 -77
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bedrockProviderModule
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-6ctwrf1z.js";
|
|
4
|
+
import"./cli-2nf3b08t.js";
|
|
4
5
|
import"./cli-kvzgak7c.js";
|
|
5
6
|
import"./cli-445c1vp7.js";
|
|
6
7
|
import"./cli-qz93y3x5.js";
|
|
@@ -129,6 +130,16 @@ import {
|
|
|
129
130
|
getTelemetryIngestAnchor,
|
|
130
131
|
initApiTelemetry,
|
|
131
132
|
syncTelemetryEnabled,
|
|
133
|
+
isBitbucketEnabled,
|
|
134
|
+
initBitbucket,
|
|
135
|
+
verifyBitbucketWebhook,
|
|
136
|
+
isDuplicateDelivery,
|
|
137
|
+
markDeliveryProcessed,
|
|
138
|
+
pullRequestEventOf,
|
|
139
|
+
pullRequestCommentEventOf,
|
|
140
|
+
handlePullRequestCreated2,
|
|
141
|
+
handlePullRequestCommentCreated,
|
|
142
|
+
handlePullRequestClosed,
|
|
132
143
|
handlePullRequest,
|
|
133
144
|
handleIssue,
|
|
134
145
|
handleComment,
|
|
@@ -290,7 +301,7 @@ import {
|
|
|
290
301
|
hasCapability,
|
|
291
302
|
getEnabledCapabilities,
|
|
292
303
|
createServer
|
|
293
|
-
} from "./cli-
|
|
304
|
+
} from "./cli-5kzk3472.js";
|
|
294
305
|
import {
|
|
295
306
|
chatThreadOfContextKey,
|
|
296
307
|
agentContextKey,
|
|
@@ -385,6 +396,7 @@ import {
|
|
|
385
396
|
listApprovalRequestSummaries2,
|
|
386
397
|
getPendingApprovalVoteState2,
|
|
387
398
|
recordApprovalVotes2,
|
|
399
|
+
getPendingApprovalsForTasks2,
|
|
388
400
|
computeContentHash2,
|
|
389
401
|
getTaskById2,
|
|
390
402
|
TASK_LINEAGE_LIMITS2,
|
|
@@ -404,6 +416,15 @@ import {
|
|
|
404
416
|
deleteModelProfile,
|
|
405
417
|
taskProfileError,
|
|
406
418
|
init_model_profiles,
|
|
419
|
+
AssetKeyMovesBlockedError2,
|
|
420
|
+
assertAssetKeyMovesAllowed2,
|
|
421
|
+
moveSessionChains,
|
|
422
|
+
listPrefixRoots,
|
|
423
|
+
listSharedPrefixRoots,
|
|
424
|
+
init_session_moves,
|
|
425
|
+
getSessionReadState,
|
|
426
|
+
getSessionTree,
|
|
427
|
+
init_session_tree,
|
|
407
428
|
setHumanFreeQueueListener,
|
|
408
429
|
drainHumanFreeReclassifyQueue,
|
|
409
430
|
init_human_free,
|
|
@@ -729,38 +750,40 @@ import {
|
|
|
729
750
|
countScriptRunJournalSteps2,
|
|
730
751
|
countScriptRunJournalAgentTaskSteps2,
|
|
731
752
|
init_db3
|
|
732
|
-
} from "./cli-
|
|
753
|
+
} from "./cli-fcc5qe3f.js";
|
|
733
754
|
import {
|
|
734
755
|
getUserGrant2,
|
|
735
756
|
init_rbac_roles
|
|
736
|
-
} from "./cli-
|
|
737
|
-
import"./cli-
|
|
757
|
+
} from "./cli-0z3vjrpm.js";
|
|
758
|
+
import"./cli-36j4jnk3.js";
|
|
738
759
|
import {
|
|
739
760
|
normalizeModelKey
|
|
740
|
-
} from "./cli-
|
|
761
|
+
} from "./cli-0y6f0ckq.js";
|
|
741
762
|
import {
|
|
742
763
|
upsertModelCatalogOverlay,
|
|
743
764
|
deleteModelCatalogOverlay,
|
|
744
765
|
loadModelsCatalog,
|
|
745
766
|
requestModelCatalogRefresh2
|
|
746
|
-
} from "./cli-
|
|
767
|
+
} from "./cli-y9jvxfhk.js";
|
|
747
768
|
import {
|
|
748
769
|
AMP_ESTIMATE_MODELS,
|
|
749
770
|
ampBillsCacheWrites,
|
|
750
771
|
resolveAmpModel
|
|
751
|
-
} from "./cli-
|
|
772
|
+
} from "./cli-jpxsrxcb.js";
|
|
752
773
|
import {
|
|
753
774
|
automationIntegrationFixUrl,
|
|
754
775
|
preflightAutomation,
|
|
755
776
|
getAutomationSetupStates,
|
|
756
777
|
listEnabledAutomationPreflightInputs,
|
|
778
|
+
createApprovalFollowUpTask,
|
|
757
779
|
validateJsonSchema,
|
|
758
780
|
workflowSaveWarnings,
|
|
759
|
-
retryFailedRun2,
|
|
760
|
-
cancelWorkflowRun2,
|
|
761
781
|
TriggerSchemaError,
|
|
762
|
-
startWorkflowExecution2
|
|
763
|
-
|
|
782
|
+
startWorkflowExecution2,
|
|
783
|
+
generateEdges,
|
|
784
|
+
definitionNodeIds,
|
|
785
|
+
validateDefinition
|
|
786
|
+
} from "./cli-92mqenkc.js";
|
|
764
787
|
import {
|
|
765
788
|
require_dist2,
|
|
766
789
|
isInvalidClientError,
|
|
@@ -840,14 +863,14 @@ import {
|
|
|
840
863
|
typecheckWithAmbient,
|
|
841
864
|
typecheckScript,
|
|
842
865
|
parseSkillContent
|
|
843
|
-
} from "./cli-
|
|
866
|
+
} from "./cli-we0ra057.js";
|
|
844
867
|
import {
|
|
845
868
|
buildAuthorizationUrl,
|
|
846
869
|
exchangeAuthorizationCode,
|
|
847
870
|
oauthAppRowToProviderConfig,
|
|
848
871
|
forceRefreshAuthorizationOrThrow,
|
|
849
872
|
forceRefreshTokenOrThrow
|
|
850
|
-
} from "./cli-
|
|
873
|
+
} from "./cli-s4sntwt4.js";
|
|
851
874
|
import {
|
|
852
875
|
signalProcessGroup,
|
|
853
876
|
detachedProcessGroup,
|
|
@@ -875,15 +898,9 @@ import {
|
|
|
875
898
|
getSlackApp2,
|
|
876
899
|
startSlackApp2,
|
|
877
900
|
stopSlackApp2
|
|
878
|
-
} from "./cli-
|
|
879
|
-
import"./cli-
|
|
880
|
-
import
|
|
881
|
-
createApprovalFollowUpTask,
|
|
882
|
-
generateEdges,
|
|
883
|
-
definitionNodeIds,
|
|
884
|
-
validateDefinition
|
|
885
|
-
} from "./cli-xpa64rek.js";
|
|
886
|
-
import"./cli-8nyhf7za.js";
|
|
901
|
+
} from "./cli-fy1jyyym.js";
|
|
902
|
+
import"./cli-ftmq4nvk.js";
|
|
903
|
+
import"./cli-qqzmjxkf.js";
|
|
887
904
|
import {
|
|
888
905
|
_fetchHolder,
|
|
889
906
|
CLIENT_ID,
|
|
@@ -894,11 +911,15 @@ import {
|
|
|
894
911
|
codexOAuthKeyForSlot,
|
|
895
912
|
loadAllCodexOAuthSlots,
|
|
896
913
|
getValidCodexOAuth
|
|
897
|
-
} from "./cli-
|
|
914
|
+
} from "./cli-kxpfx2xr.js";
|
|
898
915
|
import {
|
|
899
916
|
workflowEventBus2,
|
|
900
917
|
init_event_bus
|
|
901
|
-
} from "./cli-
|
|
918
|
+
} from "./cli-dabehxhp.js";
|
|
919
|
+
import {
|
|
920
|
+
retryFailedRun2,
|
|
921
|
+
cancelWorkflowRun2
|
|
922
|
+
} from "./cli-3zwye9sn.js";
|
|
902
923
|
import {
|
|
903
924
|
duplicateGuardedQueryKey,
|
|
904
925
|
warnIfCorsAllowsAnyOrigin,
|
|
@@ -936,13 +957,14 @@ import {
|
|
|
936
957
|
canReadSession2,
|
|
937
958
|
readableByFor2,
|
|
938
959
|
SESSION_WRITE_DENIED2,
|
|
960
|
+
hasSessionWrite2,
|
|
939
961
|
denyParentAttach2,
|
|
940
962
|
runtimeInstanceHeader,
|
|
941
963
|
bodyTask,
|
|
942
964
|
bodyListTask,
|
|
943
965
|
describeRequestRoute,
|
|
944
966
|
route
|
|
945
|
-
} from "./cli-
|
|
967
|
+
} from "./cli-9ce2xw98.js";
|
|
946
968
|
import {
|
|
947
969
|
isMultiRuntimeEnabled
|
|
948
970
|
} from "./cli-e8xyjvfc.js";
|
|
@@ -973,13 +995,13 @@ import {
|
|
|
973
995
|
resolvePoolDelivery2,
|
|
974
996
|
createPoolAgent2,
|
|
975
997
|
init_db
|
|
976
|
-
} from "./cli-
|
|
998
|
+
} from "./cli-5rvg1ddk.js";
|
|
977
999
|
import {
|
|
978
1000
|
RATING_MODEL_MAX_LENGTH,
|
|
979
1001
|
REFERENCES_SOURCE_MAX_LENGTH,
|
|
980
1002
|
sanitizeReferencesSource
|
|
981
1003
|
} from "./cli-3h26v7yj.js";
|
|
982
|
-
import"./cli-
|
|
1004
|
+
import"./cli-pasyvjmm.js";
|
|
983
1005
|
import {
|
|
984
1006
|
startPoolRouting,
|
|
985
1007
|
stopPoolRouting,
|
|
@@ -989,8 +1011,8 @@ import {
|
|
|
989
1011
|
checkHeartbeatChecklist2,
|
|
990
1012
|
runHeartbeatSweep2,
|
|
991
1013
|
stopHeartbeat2
|
|
992
|
-
} from "./cli-
|
|
993
|
-
import"./cli-
|
|
1014
|
+
} from "./cli-7g40g8hq.js";
|
|
1015
|
+
import"./cli-xd4eqtr2.js";
|
|
994
1016
|
import {
|
|
995
1017
|
import_websocket,
|
|
996
1018
|
import_websocket_server
|
|
@@ -999,7 +1021,7 @@ import {
|
|
|
999
1021
|
runtimeSupervisorStatus,
|
|
1000
1022
|
startRuntimeSupervisor,
|
|
1001
1023
|
stopRuntimeSupervisor
|
|
1002
|
-
} from "./cli-
|
|
1024
|
+
} from "./cli-x6vf4sad.js";
|
|
1003
1025
|
import"./cli-ns59dc6r.js";
|
|
1004
1026
|
import {
|
|
1005
1027
|
ACP_TARGET_IDS
|
|
@@ -1019,14 +1041,14 @@ import {
|
|
|
1019
1041
|
memoryRelevance,
|
|
1020
1042
|
isUnknownModelError,
|
|
1021
1043
|
writeSkillsToFilesystem
|
|
1022
|
-
} from "./cli-
|
|
1044
|
+
} from "./cli-4w24f7z3.js";
|
|
1023
1045
|
import {
|
|
1024
1046
|
inviteEmailToSharedOrg,
|
|
1025
1047
|
ensureAgentFsCredentialsForAgent
|
|
1026
|
-
} from "./cli-
|
|
1048
|
+
} from "./cli-1pr672hz.js";
|
|
1027
1049
|
import {
|
|
1028
1050
|
Anthropic
|
|
1029
|
-
} from "./cli-
|
|
1051
|
+
} from "./cli-3qv8naq8.js";
|
|
1030
1052
|
import {
|
|
1031
1053
|
isCodexOAuthConfigKey
|
|
1032
1054
|
} from "./cli-j4bwnpkm.js";
|
|
@@ -1062,12 +1084,13 @@ import {
|
|
|
1062
1084
|
revokeAgentTokens,
|
|
1063
1085
|
fingerprintApiKey,
|
|
1064
1086
|
init_users
|
|
1065
|
-
} from "./cli-
|
|
1087
|
+
} from "./cli-xt768r5m.js";
|
|
1066
1088
|
import"./cli-v41kn3cd.js";
|
|
1067
1089
|
import"./cli-wgtk7xxr.js";
|
|
1090
|
+
import"./cli-1f0gp9vz.js";
|
|
1068
1091
|
import {
|
|
1069
1092
|
setBedrockProviderModule
|
|
1070
|
-
} from "./cli-
|
|
1093
|
+
} from "./cli-rycdaj0a.js";
|
|
1071
1094
|
import {
|
|
1072
1095
|
isRbacEnabled,
|
|
1073
1096
|
decideToolAdmission,
|
|
@@ -1078,6 +1101,11 @@ import {
|
|
|
1078
1101
|
init_rbac
|
|
1079
1102
|
} from "./cli-ba8ne1es.js";
|
|
1080
1103
|
import {
|
|
1104
|
+
ASSET_KEY_MAX_LENGTH,
|
|
1105
|
+
normalizeAssetKey,
|
|
1106
|
+
defaultAssetKey,
|
|
1107
|
+
parseAssetKey,
|
|
1108
|
+
init_key,
|
|
1081
1109
|
isSafeBundlePath,
|
|
1082
1110
|
init_bundle_path,
|
|
1083
1111
|
init_zod_openapi,
|
|
@@ -1218,12 +1246,12 @@ import {
|
|
|
1218
1246
|
KvKeySchema,
|
|
1219
1247
|
KvEntrySchema,
|
|
1220
1248
|
init_types
|
|
1221
|
-
} from "./cli-
|
|
1249
|
+
} from "./cli-rh5smt8t.js";
|
|
1222
1250
|
import {
|
|
1223
1251
|
IDENTITY_FIELD_BUDGETS,
|
|
1224
1252
|
IdentityFieldBudgetError,
|
|
1225
1253
|
init_identity_field_budget
|
|
1226
|
-
} from "./cli-
|
|
1254
|
+
} from "./cli-gpv60278.js";
|
|
1227
1255
|
import {
|
|
1228
1256
|
getSlackConfiguration,
|
|
1229
1257
|
init_config
|
|
@@ -1291,7 +1319,7 @@ import {
|
|
|
1291
1319
|
import {
|
|
1292
1320
|
init_package,
|
|
1293
1321
|
package_default
|
|
1294
|
-
} from "./cli-
|
|
1322
|
+
} from "./cli-179xcyky.js";
|
|
1295
1323
|
import {
|
|
1296
1324
|
realtimeBus,
|
|
1297
1325
|
init_bus
|
|
@@ -1320,7 +1348,7 @@ import {
|
|
|
1320
1348
|
scrubObject,
|
|
1321
1349
|
registerVolatileSecret,
|
|
1322
1350
|
init_secret_scrubber
|
|
1323
|
-
} from "./cli-
|
|
1351
|
+
} from "./cli-n4c8e3s5.js";
|
|
1324
1352
|
import {
|
|
1325
1353
|
isAlias,
|
|
1326
1354
|
init_src2
|
|
@@ -6778,6 +6806,10 @@ async function handleAssets(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
6778
6806
|
jsonError(res, "Asset not found", 404);
|
|
6779
6807
|
return true;
|
|
6780
6808
|
}
|
|
6809
|
+
if (!await hasSessionWrite2(req, myAgentId, task.id)) {
|
|
6810
|
+
jsonError(res, await canReadSession2(req, myAgentId, task.id) ? "You can view this session but not move it." : SESSION_READ_DENIED2, 403);
|
|
6811
|
+
return true;
|
|
6812
|
+
}
|
|
6781
6813
|
const tasks = parsed.body.cascade ? await getRootTaskChain2(task.id) : [task];
|
|
6782
6814
|
for (const target of tasks) {
|
|
6783
6815
|
if (!await canMutateTaskNamespace(target, myAgentId, req)) {
|
|
@@ -6834,7 +6866,7 @@ async function handleAssets(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
6834
6866
|
return true;
|
|
6835
6867
|
}
|
|
6836
6868
|
const message = error instanceof Error ? error.message : String(error);
|
|
6837
|
-
jsonError(res, message,
|
|
6869
|
+
jsonError(res, message, error instanceof AssetKeyMovesBlockedError2 ? 409 : 400);
|
|
6838
6870
|
}
|
|
6839
6871
|
return true;
|
|
6840
6872
|
}
|
|
@@ -7085,6 +7117,7 @@ var OnboardingIntegrationMethodSchema = _enum2([
|
|
|
7085
7117
|
"slack",
|
|
7086
7118
|
"github",
|
|
7087
7119
|
"gitlab",
|
|
7120
|
+
"bitbucket",
|
|
7088
7121
|
"linear_oauth",
|
|
7089
7122
|
"jira_oauth"
|
|
7090
7123
|
]);
|
|
@@ -7152,6 +7185,7 @@ var OnboardingSignalsSchema = object2({
|
|
|
7152
7185
|
slack: boolean(),
|
|
7153
7186
|
github: boolean(),
|
|
7154
7187
|
gitlab: boolean(),
|
|
7188
|
+
bitbucket: boolean(),
|
|
7155
7189
|
linear: boolean(),
|
|
7156
7190
|
jira: boolean()
|
|
7157
7191
|
}),
|
|
@@ -7373,6 +7407,8 @@ function inferIntegrationMethod(signals) {
|
|
|
7373
7407
|
return "github";
|
|
7374
7408
|
if (signals.integrations.gitlab)
|
|
7375
7409
|
return "gitlab";
|
|
7410
|
+
if (signals.integrations.bitbucket)
|
|
7411
|
+
return "bitbucket";
|
|
7376
7412
|
if (signals.integrations.linear)
|
|
7377
7413
|
return "linear_oauth";
|
|
7378
7414
|
if (signals.integrations.jira)
|
|
@@ -9653,6 +9689,7 @@ declare module "swarm-extension" {
|
|
|
9653
9689
|
| "github"
|
|
9654
9690
|
| "gitlab"
|
|
9655
9691
|
| "azure-devops"
|
|
9692
|
+
| "bitbucket"
|
|
9656
9693
|
| "system"
|
|
9657
9694
|
| "linear"
|
|
9658
9695
|
| "jira"
|
|
@@ -9679,7 +9716,7 @@ declare module "swarm-extension" {
|
|
|
9679
9716
|
slackTriggerMessageTs?: string | undefined;
|
|
9680
9717
|
slackUserId?: string | undefined;
|
|
9681
9718
|
overrideSlackContext?: boolean | undefined;
|
|
9682
|
-
vcsProvider?: "github" | "gitlab" | "azure-devops" | undefined;
|
|
9719
|
+
vcsProvider?: "github" | "gitlab" | "azure-devops" | "bitbucket" | undefined;
|
|
9683
9720
|
vcsRepo?: string | undefined;
|
|
9684
9721
|
vcsEventType?: string | undefined;
|
|
9685
9722
|
vcsNumber?: number | undefined;
|
|
@@ -9770,6 +9807,7 @@ declare module "swarm-extension" {
|
|
|
9770
9807
|
| "github"
|
|
9771
9808
|
| "gitlab"
|
|
9772
9809
|
| "azure-devops"
|
|
9810
|
+
| "bitbucket"
|
|
9773
9811
|
| "system"
|
|
9774
9812
|
| "linear"
|
|
9775
9813
|
| "jira"
|
|
@@ -9810,7 +9848,7 @@ declare module "swarm-extension" {
|
|
|
9810
9848
|
slackUserId?: string | undefined;
|
|
9811
9849
|
slackProgressMessageTs?: string | undefined;
|
|
9812
9850
|
slackTreeRootMessageTs?: string | undefined;
|
|
9813
|
-
vcsProvider?: "github" | "gitlab" | "azure-devops" | undefined;
|
|
9851
|
+
vcsProvider?: "github" | "gitlab" | "azure-devops" | "bitbucket" | undefined;
|
|
9814
9852
|
vcsRepo?: string | undefined;
|
|
9815
9853
|
vcsEventType?: string | undefined;
|
|
9816
9854
|
vcsNumber?: number | undefined;
|
|
@@ -10263,7 +10301,7 @@ declare module "swarm-extension" {
|
|
|
10263
10301
|
/** The text, or a placeholder naming the type for a non-text message. */
|
|
10264
10302
|
text: string;
|
|
10265
10303
|
}
|
|
10266
|
-
export type VcsProvider = "github" | "gitlab" | "azure-devops";
|
|
10304
|
+
export type VcsProvider = "github" | "gitlab" | "azure-devops" | "bitbucket";
|
|
10267
10305
|
/**
|
|
10268
10306
|
* The provider object the event is about, as the provider names it. GitLab
|
|
10269
10307
|
* calls a pull request a merge request, and a comment a \`note\`.
|
|
@@ -10286,7 +10324,7 @@ declare module "swarm-extension" {
|
|
|
10286
10324
|
provider: VcsProvider;
|
|
10287
10325
|
kind: VcsEventKind;
|
|
10288
10326
|
action: string;
|
|
10289
|
-
/** \`owner/name\` on GitHub and GitLab, the repository URL on Azure DevOps. */
|
|
10327
|
+
/** \`owner/name\` on GitHub and GitLab, \`workspace/repo_slug\` on Bitbucket, the repository URL on Azure DevOps. */
|
|
10290
10328
|
repo: string;
|
|
10291
10329
|
/** The PR, merge request, or issue number. Absent for a pipeline outside a merge request. */
|
|
10292
10330
|
number?: number;
|
|
@@ -21779,6 +21817,7 @@ async function buildSignals(state) {
|
|
|
21779
21817
|
slack: integrations.slack === "configured",
|
|
21780
21818
|
github: Boolean(process.env.GITHUB_TOKEN?.trim()) || integrations.github === "verified",
|
|
21781
21819
|
gitlab: Boolean(process.env.GITLAB_TOKEN?.trim()),
|
|
21820
|
+
bitbucket: Boolean(process.env.BITBUCKET_TOKEN?.trim()),
|
|
21782
21821
|
linear: integrations.linear === "verified",
|
|
21783
21822
|
jira: integrations.jira === "verified"
|
|
21784
21823
|
},
|
|
@@ -22813,7 +22852,7 @@ var updateTaskVcsRoute = route({
|
|
|
22813
22852
|
tags: ["Tasks"],
|
|
22814
22853
|
params: object2({ id: string2() }),
|
|
22815
22854
|
body: object2({
|
|
22816
|
-
vcsProvider: _enum2(["github", "gitlab", "azure-devops"]),
|
|
22855
|
+
vcsProvider: _enum2(["github", "gitlab", "azure-devops", "bitbucket"]),
|
|
22817
22856
|
vcsRepo: string2(),
|
|
22818
22857
|
vcsNumber: number2().int().positive(),
|
|
22819
22858
|
vcsUrl: string2().url()
|
|
@@ -33230,7 +33269,10 @@ async function handleSessionData(req, res, pathSegments, queryParams, myAgentId)
|
|
|
33230
33269
|
|
|
33231
33270
|
// src/http/sessions.ts
|
|
33232
33271
|
init_zod();
|
|
33272
|
+
init_key();
|
|
33233
33273
|
init_db3();
|
|
33274
|
+
init_session_moves();
|
|
33275
|
+
init_session_tree();
|
|
33234
33276
|
init_rbac_roles();
|
|
33235
33277
|
init_steering();
|
|
33236
33278
|
init_users();
|
|
@@ -33272,7 +33314,54 @@ var SessionListItemSchema = object2({
|
|
|
33272
33314
|
root: union2([AgentTaskSchema, AgentTaskSummarySchema2]),
|
|
33273
33315
|
chainTaskCount: number2().int(),
|
|
33274
33316
|
lastActivityAt: string2(),
|
|
33275
|
-
latestStatus: AgentTaskStatusSchema
|
|
33317
|
+
latestStatus: AgentTaskStatusSchema,
|
|
33318
|
+
readState: _enum2(["unread", "read", "later", "done"]).optional(),
|
|
33319
|
+
snoozeUntil: string2().nullable().optional(),
|
|
33320
|
+
needsYou: boolean().optional(),
|
|
33321
|
+
groupKey: string2().optional(),
|
|
33322
|
+
shared: boolean().optional(),
|
|
33323
|
+
people: array2(object2({ id: string2(), name: string2() })).optional(),
|
|
33324
|
+
peopleCount: number2().int().optional(),
|
|
33325
|
+
preview: string2().nullable().optional(),
|
|
33326
|
+
shares: array2(object2({
|
|
33327
|
+
userId: string2().nullable(),
|
|
33328
|
+
name: string2().nullable(),
|
|
33329
|
+
access: _enum2(["read", "write"])
|
|
33330
|
+
})).optional()
|
|
33331
|
+
});
|
|
33332
|
+
var SessionSectionCountsSchema = object2({
|
|
33333
|
+
total: number2().int(),
|
|
33334
|
+
unread: number2().int(),
|
|
33335
|
+
running: number2().int(),
|
|
33336
|
+
needsYou: number2().int()
|
|
33337
|
+
});
|
|
33338
|
+
var SessionTreeGroupSchema = SessionSectionCountsSchema.extend({
|
|
33339
|
+
key: string2(),
|
|
33340
|
+
lastActivityAt: string2()
|
|
33341
|
+
});
|
|
33342
|
+
var SessionTreeResponseSchema = object2({
|
|
33343
|
+
groups: array2(SessionTreeGroupSchema),
|
|
33344
|
+
inbox: SessionSectionCountsSchema,
|
|
33345
|
+
later: SessionSectionCountsSchema,
|
|
33346
|
+
done: SessionSectionCountsSchema,
|
|
33347
|
+
noGroup: SessionSectionCountsSchema
|
|
33348
|
+
});
|
|
33349
|
+
var SessionApprovalSchema = object2({
|
|
33350
|
+
id: string2(),
|
|
33351
|
+
status: literal2("pending"),
|
|
33352
|
+
sourceTaskId: string2(),
|
|
33353
|
+
title: string2()
|
|
33354
|
+
});
|
|
33355
|
+
var SessionKeyFilterSchema = string2().transform((value, ctx) => {
|
|
33356
|
+
try {
|
|
33357
|
+
return normalizeAssetKey(value);
|
|
33358
|
+
} catch (error) {
|
|
33359
|
+
ctx.addIssue({
|
|
33360
|
+
code: "custom",
|
|
33361
|
+
message: error instanceof Error ? error.message : "Invalid asset key"
|
|
33362
|
+
});
|
|
33363
|
+
return NEVER;
|
|
33364
|
+
}
|
|
33276
33365
|
});
|
|
33277
33366
|
var TaskWithSteeringSchema = AgentTaskSchema.extend({
|
|
33278
33367
|
citations: array2(TaskCitationSchema),
|
|
@@ -33528,8 +33617,14 @@ var listSessions = route({
|
|
|
33528
33617
|
q: string2().optional(),
|
|
33529
33618
|
requestedByUserId: string2().min(1).optional(),
|
|
33530
33619
|
contextKeyPrefix: string2().min(1).optional(),
|
|
33620
|
+
keyPrefix: SessionKeyFilterSchema.optional(),
|
|
33621
|
+
groupKey: SessionKeyFilterSchema.optional(),
|
|
33622
|
+
noGroup: _enum2(["true", "false"]).transform((v) => v === "true").optional(),
|
|
33623
|
+
triage: _enum2(["inbox", "later", "done", "unread"]).optional(),
|
|
33624
|
+
status: _enum2(["running", "failed", "needs"]).optional(),
|
|
33625
|
+
withUserId: string2().min(1).optional(),
|
|
33531
33626
|
fields: _enum2(["full", "slim"]).optional(),
|
|
33532
|
-
scope: _enum2(["mine", "shared"]).optional()
|
|
33627
|
+
scope: _enum2(["mine", "shared", "tree"]).optional().describe("mine: owned sessions. shared: sessions shared with me. tree: Sessions that GET /api/session-tree counts: mine plus shared with me, no ownerless roots. A bypass actor sees every root with tree scope.")
|
|
33533
33628
|
}),
|
|
33534
33629
|
responses: {
|
|
33535
33630
|
200: {
|
|
@@ -33545,6 +33640,110 @@ var listSessions = route({
|
|
|
33545
33640
|
},
|
|
33546
33641
|
auth: { apiKey: true }
|
|
33547
33642
|
});
|
|
33643
|
+
var sessionTree = route({
|
|
33644
|
+
method: "get",
|
|
33645
|
+
path: "/api/session-tree",
|
|
33646
|
+
pattern: ["api", "session-tree"],
|
|
33647
|
+
summary: "Get session groups and triage counts",
|
|
33648
|
+
tags: ["Sessions"],
|
|
33649
|
+
responses: {
|
|
33650
|
+
200: { description: "Visible groups and section counts", schema: SessionTreeResponseSchema },
|
|
33651
|
+
401: { description: "Unauthorized" }
|
|
33652
|
+
},
|
|
33653
|
+
auth: { apiKey: true }
|
|
33654
|
+
});
|
|
33655
|
+
var SESSION_MOVE_LIMIT = 200;
|
|
33656
|
+
var SESSION_MOVE_OWNER_ONLY = "Only the session owner can move this group";
|
|
33657
|
+
var SESSION_MOVE_UNAVAILABLE = "Session not found or not accessible";
|
|
33658
|
+
var SessionMoveResultSchema = object2({
|
|
33659
|
+
moved: array2(string2()),
|
|
33660
|
+
skipped: array2(object2({ rootTaskId: string2(), reason: string2() }))
|
|
33661
|
+
});
|
|
33662
|
+
var sessionMoveRbac = {
|
|
33663
|
+
ungated: "per-session access, per-task task.fs.mutate, and asset-key write checks in the handler, as PATCH /api/assets/task/{id}/key"
|
|
33664
|
+
};
|
|
33665
|
+
var sessionMoveResponses = {
|
|
33666
|
+
400: { description: "Invalid namespace or request" },
|
|
33667
|
+
403: { description: "Personal destination not authorized" },
|
|
33668
|
+
409: { description: "Moves blocked until audit warnings are repaired" }
|
|
33669
|
+
};
|
|
33670
|
+
var moveSessions = route({
|
|
33671
|
+
method: "post",
|
|
33672
|
+
path: "/api/session-moves",
|
|
33673
|
+
pattern: ["api", "session-moves"],
|
|
33674
|
+
summary: "Move sessions into a group or reset their keys",
|
|
33675
|
+
tags: ["Sessions"],
|
|
33676
|
+
session: { none: "The handler checks each root and reports denied roots as skipped" },
|
|
33677
|
+
body: object2({
|
|
33678
|
+
rootTaskIds: array2(string2().min(1)).min(1).max(SESSION_MOVE_LIMIT),
|
|
33679
|
+
groupKey: AssetKeySchema.nullable()
|
|
33680
|
+
}),
|
|
33681
|
+
responses: {
|
|
33682
|
+
200: { description: "Moved and skipped sessions", schema: SessionMoveResultSchema },
|
|
33683
|
+
...sessionMoveResponses
|
|
33684
|
+
},
|
|
33685
|
+
auth: { apiKey: true },
|
|
33686
|
+
rbac: sessionMoveRbac
|
|
33687
|
+
});
|
|
33688
|
+
var moveSessionPrefix = route({
|
|
33689
|
+
method: "post",
|
|
33690
|
+
path: "/api/session-moves/prefix",
|
|
33691
|
+
pattern: ["api", "session-moves", "prefix"],
|
|
33692
|
+
summary: "Rename or delete a session group",
|
|
33693
|
+
tags: ["Sessions"],
|
|
33694
|
+
body: object2({ from: AssetKeySchema, to: AssetKeySchema.nullable() }),
|
|
33695
|
+
responses: {
|
|
33696
|
+
200: {
|
|
33697
|
+
description: "Moved and skipped sessions and remaining movable roots",
|
|
33698
|
+
schema: SessionMoveResultSchema.extend({ remaining: number2().int().min(0) })
|
|
33699
|
+
},
|
|
33700
|
+
...sessionMoveResponses
|
|
33701
|
+
},
|
|
33702
|
+
auth: { apiKey: true },
|
|
33703
|
+
rbac: sessionMoveRbac
|
|
33704
|
+
});
|
|
33705
|
+
async function withSessionMove(req, res, myAgentId, destination, run) {
|
|
33706
|
+
try {
|
|
33707
|
+
const changedBy = await resolveHttpAuditUserId(req, myAgentId);
|
|
33708
|
+
const actor = await resolveSessionActor2(req, myAgentId);
|
|
33709
|
+
const key = destination === null ? null : await authorizeAssetKeyWrite(destination, changedBy);
|
|
33710
|
+
await assertAssetKeyMovesAllowed2();
|
|
33711
|
+
await run({ actor, changedBy: changedBy ?? undefined, key });
|
|
33712
|
+
} catch (error) {
|
|
33713
|
+
if (error instanceof AssetKeyAuthorizationError) {
|
|
33714
|
+
jsonError(res, error.message, error.statusCode);
|
|
33715
|
+
} else if (error instanceof AssetKeyMovesBlockedError2) {
|
|
33716
|
+
jsonError(res, error.message, 409);
|
|
33717
|
+
} else {
|
|
33718
|
+
throw error;
|
|
33719
|
+
}
|
|
33720
|
+
}
|
|
33721
|
+
}
|
|
33722
|
+
async function checkSessionMove(rootTaskId, actor, req, myAgentId, options = {}) {
|
|
33723
|
+
const root = await getTaskById2(rootTaskId);
|
|
33724
|
+
if (!root)
|
|
33725
|
+
return { reason: SESSION_MOVE_UNAVAILABLE };
|
|
33726
|
+
if (options.ownerOnly) {
|
|
33727
|
+
if (actor.kind === "user" && (!actor.userId || root.requestedByUserId !== actor.userId)) {
|
|
33728
|
+
return { reason: SESSION_MOVE_OWNER_ONLY };
|
|
33729
|
+
}
|
|
33730
|
+
} else {
|
|
33731
|
+
const access = await sessionAccessFor2(actor, root.id);
|
|
33732
|
+
if (access === "none")
|
|
33733
|
+
return { reason: SESSION_MOVE_UNAVAILABLE };
|
|
33734
|
+
if (!hasSessionAccess(access, "write"))
|
|
33735
|
+
return { reason: "Session write access required" };
|
|
33736
|
+
}
|
|
33737
|
+
if (root.parentTaskId)
|
|
33738
|
+
return { reason: "Task is not a session root" };
|
|
33739
|
+
const tasks = await getRootTaskChain2(root.id);
|
|
33740
|
+
for (const task of tasks) {
|
|
33741
|
+
if (!await canMutateTaskNamespace(task, myAgentId, req)) {
|
|
33742
|
+
return { reason: "Not authorized to move this task namespace" };
|
|
33743
|
+
}
|
|
33744
|
+
}
|
|
33745
|
+
return { taskIds: tasks.map((task) => task.id) };
|
|
33746
|
+
}
|
|
33548
33747
|
var getSession = route({
|
|
33549
33748
|
method: "get",
|
|
33550
33749
|
path: "/api/sessions/{rootTaskId}",
|
|
@@ -33560,7 +33759,10 @@ var getSession = route({
|
|
|
33560
33759
|
root: TaskWithSteeringSchema,
|
|
33561
33760
|
chain: array2(TaskWithSteeringSchema),
|
|
33562
33761
|
access: SessionAccessSchema,
|
|
33563
|
-
owner: SessionOwnerSchema.nullable()
|
|
33762
|
+
owner: SessionOwnerSchema.nullable(),
|
|
33763
|
+
approvals: array2(SessionApprovalSchema).optional(),
|
|
33764
|
+
readState: _enum2(["unread", "read", "later", "done"]).optional(),
|
|
33765
|
+
lastActivityAt: string2().optional()
|
|
33564
33766
|
})
|
|
33565
33767
|
},
|
|
33566
33768
|
401: { description: "Unauthorized" },
|
|
@@ -33691,11 +33893,12 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
33691
33893
|
return true;
|
|
33692
33894
|
const sources = parsed.query.source ? parsed.query.source.split(",").map((s) => s.trim()).filter(Boolean) : undefined;
|
|
33693
33895
|
const actor = await resolveSessionActor2(req, myAgentId);
|
|
33694
|
-
|
|
33896
|
+
const limit = Math.min(200, Math.max(0, parsed.query.limit ?? 25));
|
|
33897
|
+
if (actor.kind === "bypass" && parsed.query.scope && parsed.query.scope !== "tree") {
|
|
33695
33898
|
listSessions.respond(res, 200, {
|
|
33696
33899
|
sessions: [],
|
|
33697
33900
|
total: 0,
|
|
33698
|
-
limit
|
|
33901
|
+
limit,
|
|
33699
33902
|
offset: parsed.query.offset ?? 0
|
|
33700
33903
|
});
|
|
33701
33904
|
return true;
|
|
@@ -33705,11 +33908,24 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
33705
33908
|
q: parsed.query.q,
|
|
33706
33909
|
requestedByUserId: parsed.query.requestedByUserId,
|
|
33707
33910
|
contextKeyPrefix: parsed.query.contextKeyPrefix,
|
|
33708
|
-
|
|
33911
|
+
keyPrefix: parsed.query.keyPrefix,
|
|
33912
|
+
groupKey: parsed.query.groupKey,
|
|
33913
|
+
noGroup: parsed.query.noGroup,
|
|
33914
|
+
triage: parsed.query.triage,
|
|
33915
|
+
status: parsed.query.status,
|
|
33916
|
+
withUserId: parsed.query.withUserId,
|
|
33917
|
+
now: new Date().toISOString(),
|
|
33918
|
+
tree: parsed.query.scope === "tree",
|
|
33919
|
+
...actor.kind === "user" ? {
|
|
33920
|
+
viewer: {
|
|
33921
|
+
userId: actor.userId,
|
|
33922
|
+
scope: parsed.query.scope === "tree" ? "all" : parsed.query.scope ?? "all"
|
|
33923
|
+
}
|
|
33924
|
+
} : {}
|
|
33709
33925
|
};
|
|
33710
33926
|
const baseOpts = {
|
|
33711
33927
|
...filterOpts,
|
|
33712
|
-
limit
|
|
33928
|
+
limit,
|
|
33713
33929
|
offset: parsed.query.offset
|
|
33714
33930
|
};
|
|
33715
33931
|
const sessions = parsed.query.fields === "full" ? await listRecentSessions2(baseOpts) : await listRecentSessions2({ ...baseOpts, slim: true });
|
|
@@ -33717,11 +33933,104 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
33717
33933
|
listSessions.respond(res, 200, {
|
|
33718
33934
|
sessions,
|
|
33719
33935
|
total,
|
|
33720
|
-
limit
|
|
33936
|
+
limit,
|
|
33721
33937
|
offset: parsed.query.offset ?? 0
|
|
33722
33938
|
});
|
|
33723
33939
|
return true;
|
|
33724
33940
|
}
|
|
33941
|
+
if (sessionTree.match(req.method, pathSegments)) {
|
|
33942
|
+
const parsed = await sessionTree.parse(req, res, pathSegments, queryParams);
|
|
33943
|
+
if (!parsed)
|
|
33944
|
+
return true;
|
|
33945
|
+
sessionTree.respond(res, 200, await getSessionTree(await resolveSessionActor2(req, myAgentId)));
|
|
33946
|
+
return true;
|
|
33947
|
+
}
|
|
33948
|
+
if (moveSessions.match(req.method, pathSegments)) {
|
|
33949
|
+
const parsed = await moveSessions.parse(req, res, pathSegments, queryParams);
|
|
33950
|
+
if (!parsed)
|
|
33951
|
+
return true;
|
|
33952
|
+
await withSessionMove(req, res, myAgentId, parsed.body.groupKey, async ({ actor, changedBy, key }) => {
|
|
33953
|
+
const skipped = [];
|
|
33954
|
+
const moves = [];
|
|
33955
|
+
for (const rootId of new Set(parsed.body.rootTaskIds)) {
|
|
33956
|
+
const checked = await checkSessionMove(rootId, actor, req, myAgentId);
|
|
33957
|
+
if ("reason" in checked) {
|
|
33958
|
+
skipped.push({ rootTaskId: rootId, reason: checked.reason });
|
|
33959
|
+
} else {
|
|
33960
|
+
moves.push({
|
|
33961
|
+
rootId,
|
|
33962
|
+
taskIds: checked.taskIds,
|
|
33963
|
+
key: key ?? defaultAssetKey("task", rootId)
|
|
33964
|
+
});
|
|
33965
|
+
}
|
|
33966
|
+
}
|
|
33967
|
+
const moved = await moveSessionChains({ moves, changedBy });
|
|
33968
|
+
moveSessions.respond(res, 200, { moved, skipped });
|
|
33969
|
+
});
|
|
33970
|
+
return true;
|
|
33971
|
+
}
|
|
33972
|
+
if (moveSessionPrefix.match(req.method, pathSegments)) {
|
|
33973
|
+
const parsed = await moveSessionPrefix.parse(req, res, pathSegments, queryParams);
|
|
33974
|
+
if (!parsed)
|
|
33975
|
+
return true;
|
|
33976
|
+
const from = normalizeAssetKey(parsed.body.from);
|
|
33977
|
+
if (parseAssetKey(from).relativeSegments.length === 0) {
|
|
33978
|
+
jsonError(res, "Cannot move a namespace root", 400);
|
|
33979
|
+
return true;
|
|
33980
|
+
}
|
|
33981
|
+
await withSessionMove(req, res, myAgentId, parsed.body.to, async ({ actor, changedBy, key }) => {
|
|
33982
|
+
if (key?.startsWith(from)) {
|
|
33983
|
+
jsonError(res, "Destination must be outside the source prefix", 400);
|
|
33984
|
+
return;
|
|
33985
|
+
}
|
|
33986
|
+
const skipped = actor.kind === "user" ? (await listSharedPrefixRoots({ from, userId: actor.userId })).map((root) => ({
|
|
33987
|
+
rootTaskId: root.id,
|
|
33988
|
+
reason: SESSION_MOVE_OWNER_ONLY
|
|
33989
|
+
})) : [];
|
|
33990
|
+
const moves = [];
|
|
33991
|
+
let remaining = 0;
|
|
33992
|
+
for (let offset = 0;; offset += SESSION_MOVE_LIMIT) {
|
|
33993
|
+
const roots = await listPrefixRoots({
|
|
33994
|
+
from,
|
|
33995
|
+
userId: actor.kind === "user" ? actor.userId : undefined,
|
|
33996
|
+
limit: SESSION_MOVE_LIMIT,
|
|
33997
|
+
offset
|
|
33998
|
+
});
|
|
33999
|
+
for (const root of roots) {
|
|
34000
|
+
const nextKey = key === null ? defaultAssetKey("task", root.id) : key + root.key.slice(from.length);
|
|
34001
|
+
if (nextKey.startsWith(from)) {
|
|
34002
|
+
skipped.push({
|
|
34003
|
+
rootTaskId: root.id,
|
|
34004
|
+
reason: "The new key stays inside the source group"
|
|
34005
|
+
});
|
|
34006
|
+
continue;
|
|
34007
|
+
}
|
|
34008
|
+
if (nextKey.length > ASSET_KEY_MAX_LENGTH) {
|
|
34009
|
+
skipped.push({
|
|
34010
|
+
rootTaskId: root.id,
|
|
34011
|
+
reason: `Asset key cannot exceed ${ASSET_KEY_MAX_LENGTH} characters`
|
|
34012
|
+
});
|
|
34013
|
+
continue;
|
|
34014
|
+
}
|
|
34015
|
+
const checked = await checkSessionMove(root.id, actor, req, myAgentId, {
|
|
34016
|
+
ownerOnly: true
|
|
34017
|
+
});
|
|
34018
|
+
if ("reason" in checked) {
|
|
34019
|
+
skipped.push({ rootTaskId: root.id, reason: checked.reason });
|
|
34020
|
+
} else if (moves.length < SESSION_MOVE_LIMIT) {
|
|
34021
|
+
moves.push({ rootId: root.id, taskIds: checked.taskIds, key: nextKey });
|
|
34022
|
+
} else {
|
|
34023
|
+
remaining++;
|
|
34024
|
+
}
|
|
34025
|
+
}
|
|
34026
|
+
if (roots.length < SESSION_MOVE_LIMIT)
|
|
34027
|
+
break;
|
|
34028
|
+
}
|
|
34029
|
+
const moved = await moveSessionChains({ moves, changedBy });
|
|
34030
|
+
moveSessionPrefix.respond(res, 200, { moved, skipped, remaining });
|
|
34031
|
+
});
|
|
34032
|
+
return true;
|
|
34033
|
+
}
|
|
33725
34034
|
if (getSession.match(req.method, pathSegments)) {
|
|
33726
34035
|
const parsed = await getSession.parse(req, res, pathSegments, queryParams);
|
|
33727
34036
|
if (!parsed)
|
|
@@ -33735,7 +34044,8 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
33735
34044
|
id: root.id,
|
|
33736
34045
|
requestedByUserId: root.requestedByUserId ?? null
|
|
33737
34046
|
};
|
|
33738
|
-
const
|
|
34047
|
+
const actor = await resolveSessionActor2(req, myAgentId);
|
|
34048
|
+
const access = await accessForRoot(actor, sessionRoot);
|
|
33739
34049
|
if (access === "none") {
|
|
33740
34050
|
jsonError(res, "You don't have access to this session. Ask the owner to share it.", 403);
|
|
33741
34051
|
return true;
|
|
@@ -33747,9 +34057,11 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
33747
34057
|
} : null;
|
|
33748
34058
|
const chain = await getRootTaskChain2(parsed.params.rootTaskId);
|
|
33749
34059
|
const tasks = [root, ...chain];
|
|
33750
|
-
const [steering, citations] = await Promise.all([
|
|
34060
|
+
const [steering, citations, approvals, read] = await Promise.all([
|
|
33751
34061
|
getTaskSteeringFieldsForTasks(tasks),
|
|
33752
|
-
getTaskCitationsForTasks(tasks.map((task) => task.id))
|
|
34062
|
+
getTaskCitationsForTasks(tasks.map((task) => task.id)),
|
|
34063
|
+
getPendingApprovalsForTasks2(tasks.map((task) => task.id)),
|
|
34064
|
+
actor.kind === "user" && actor.userId ? getSessionReadState(sessionRoot.id, actor.userId) : Promise.resolve(null)
|
|
33753
34065
|
]);
|
|
33754
34066
|
const decorate = (task) => ({
|
|
33755
34067
|
...task,
|
|
@@ -33760,7 +34072,9 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
33760
34072
|
root: decorate(root),
|
|
33761
34073
|
chain: chain.map(decorate),
|
|
33762
34074
|
access,
|
|
33763
|
-
owner
|
|
34075
|
+
owner,
|
|
34076
|
+
...approvals.length ? { approvals } : {},
|
|
34077
|
+
...read ?? {}
|
|
33764
34078
|
});
|
|
33765
34079
|
return true;
|
|
33766
34080
|
}
|
|
@@ -33849,8 +34163,7 @@ async function syncSkillsToFilesystem(agentId, harnessType = "all", homeOverride
|
|
|
33849
34163
|
})));
|
|
33850
34164
|
return writeSkillsToFilesystem(entries, harnessType, home);
|
|
33851
34165
|
}
|
|
33852
|
-
|
|
33853
|
-
const skills = await getAgentSkills2(agentId);
|
|
34166
|
+
function computeSkillsSignature(skills) {
|
|
33854
34167
|
const sorted = [...skills].sort((a, b) => a.id.localeCompare(b.id));
|
|
33855
34168
|
const canonical = JSON.stringify(sorted.map((s) => [
|
|
33856
34169
|
s.id,
|
|
@@ -33865,6 +34178,18 @@ async function computeAgentSkillsSignature(agentId) {
|
|
|
33865
34178
|
const hash = new Bun.CryptoHasher("sha256").update(canonical).digest("hex");
|
|
33866
34179
|
return { hash, count: sorted.length };
|
|
33867
34180
|
}
|
|
34181
|
+
async function computeAgentSkillsSignature(agentId) {
|
|
34182
|
+
return computeSkillsSignature(await getAgentSkills2(agentId));
|
|
34183
|
+
}
|
|
34184
|
+
async function buildSkillsBundle(readSkills, readFiles) {
|
|
34185
|
+
const skills = await readSkills();
|
|
34186
|
+
const signature = computeSkillsSignature(skills).hash;
|
|
34187
|
+
const entries = await Promise.all(skills.map(async (skill) => ({
|
|
34188
|
+
...skill,
|
|
34189
|
+
files: skill.isComplex ? await readFiles(skill.id) : []
|
|
34190
|
+
})));
|
|
34191
|
+
return { skills: entries, total: entries.length, signature };
|
|
34192
|
+
}
|
|
33868
34193
|
|
|
33869
34194
|
// src/be/skill-usage.ts
|
|
33870
34195
|
init_db3();
|
|
@@ -34150,6 +34475,13 @@ var agentSkillsListResponseSchema = object2({
|
|
|
34150
34475
|
total: number2(),
|
|
34151
34476
|
signature: string2()
|
|
34152
34477
|
});
|
|
34478
|
+
var agentSkillsBundleResponseSchema = object2({
|
|
34479
|
+
skills: array2(SkillWithInstallInfoSchema.extend({
|
|
34480
|
+
files: array2(SkillFileSchema)
|
|
34481
|
+
})),
|
|
34482
|
+
total: number2(),
|
|
34483
|
+
signature: string2()
|
|
34484
|
+
});
|
|
34153
34485
|
var agentSkillsSignatureResponseSchema = object2({
|
|
34154
34486
|
hash: string2(),
|
|
34155
34487
|
count: number2(),
|
|
@@ -34544,7 +34876,28 @@ var getAgentSkillsSignatureRoute = route({
|
|
|
34544
34876
|
200: { description: "Skills signature", schema: agentSkillsSignatureResponseSchema }
|
|
34545
34877
|
}
|
|
34546
34878
|
});
|
|
34879
|
+
var getAgentSkillsBundleRoute = route({
|
|
34880
|
+
method: "get",
|
|
34881
|
+
path: "/api/agents/{id}/skills/bundle",
|
|
34882
|
+
pattern: ["api", "agents", null, "skills", "bundle"],
|
|
34883
|
+
summary: "Get an agent's installed skills together with their bundled files",
|
|
34884
|
+
description: "Single-request boot payload: every installed-and-enabled skill with the full content of its bundled files, plus the same signature the cheap probe returns. Lets a worker sync its local skill tree without an N+1 file fan-out.",
|
|
34885
|
+
tags: ["Skills"],
|
|
34886
|
+
auth: { apiKey: true },
|
|
34887
|
+
params: object2({ id: string2() }),
|
|
34888
|
+
responses: {
|
|
34889
|
+
200: { description: "Agent skills bundle", schema: agentSkillsBundleResponseSchema }
|
|
34890
|
+
}
|
|
34891
|
+
});
|
|
34547
34892
|
async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
34893
|
+
if (getAgentSkillsBundleRoute.match(req.method, pathSegments)) {
|
|
34894
|
+
const parsed = await getAgentSkillsBundleRoute.parse(req, res, pathSegments, queryParams);
|
|
34895
|
+
if (!parsed)
|
|
34896
|
+
return true;
|
|
34897
|
+
const bundle = await buildSkillsBundle(() => getAgentSkills2(parsed.params.id), (skillId) => getSkillFiles2(skillId));
|
|
34898
|
+
getAgentSkillsBundleRoute.respond(res, 200, bundle);
|
|
34899
|
+
return true;
|
|
34900
|
+
}
|
|
34548
34901
|
if (getAgentSkillsSignatureRoute.match(req.method, pathSegments)) {
|
|
34549
34902
|
const parsed = await getAgentSkillsSignatureRoute.parse(req, res, pathSegments, queryParams);
|
|
34550
34903
|
if (!parsed)
|
|
@@ -36703,6 +37056,7 @@ var UNMAPPED_KINDS = [
|
|
|
36703
37056
|
"github",
|
|
36704
37057
|
"gitlab",
|
|
36705
37058
|
"azure-devops",
|
|
37059
|
+
"bitbucket",
|
|
36706
37060
|
"linear",
|
|
36707
37061
|
"kapso",
|
|
36708
37062
|
"telegram",
|
|
@@ -37485,6 +37839,24 @@ var azureDevOpsWebhook = route({
|
|
|
37485
37839
|
503: { description: "Azure DevOps integration not configured" }
|
|
37486
37840
|
}
|
|
37487
37841
|
});
|
|
37842
|
+
var bitbucketWebhook = route({
|
|
37843
|
+
method: "post",
|
|
37844
|
+
path: "/api/bitbucket/webhook",
|
|
37845
|
+
pattern: ["api", "bitbucket", "webhook"],
|
|
37846
|
+
summary: "Handle Bitbucket Cloud webhook events",
|
|
37847
|
+
tags: ["Webhooks"],
|
|
37848
|
+
auth: { apiKey: false },
|
|
37849
|
+
rbac: {
|
|
37850
|
+
ungated: "provider webhook: authenticated by the per-webhook HMAC secret, not a swarm principal"
|
|
37851
|
+
},
|
|
37852
|
+
responses: {
|
|
37853
|
+
200: { description: "Event processed", schema: WebhookDispatchResultSchema },
|
|
37854
|
+
401: { description: "Invalid signature" },
|
|
37855
|
+
413: { description: "Body exceeds 1 MiB" },
|
|
37856
|
+
503: { description: "Bitbucket integration not configured" }
|
|
37857
|
+
}
|
|
37858
|
+
});
|
|
37859
|
+
var BITBUCKET_WEBHOOK_MAX_BODY_BYTES = 1024 * 1024;
|
|
37488
37860
|
var agentmailWebhook = route({
|
|
37489
37861
|
method: "post",
|
|
37490
37862
|
path: "/api/agentmail/webhook",
|
|
@@ -37941,6 +38313,101 @@ async function handleWebhooks(req, res, pathSegments) {
|
|
|
37941
38313
|
}
|
|
37942
38314
|
return true;
|
|
37943
38315
|
}
|
|
38316
|
+
if (bitbucketWebhook.match(req.method, pathSegments)) {
|
|
38317
|
+
if (!isBitbucketEnabled()) {
|
|
38318
|
+
res.writeHead(503, { "Content-Type": "application/json" });
|
|
38319
|
+
res.end(JSON.stringify({ error: "Bitbucket integration not configured" }));
|
|
38320
|
+
return true;
|
|
38321
|
+
}
|
|
38322
|
+
if (enforceContentLengthCap(req, res, BITBUCKET_WEBHOOK_MAX_BODY_BYTES) === BODY_TOO_LARGE) {
|
|
38323
|
+
return true;
|
|
38324
|
+
}
|
|
38325
|
+
const chunks = [];
|
|
38326
|
+
let receivedBytes = 0;
|
|
38327
|
+
let tooLarge = false;
|
|
38328
|
+
for await (const chunk of req) {
|
|
38329
|
+
if (tooLarge)
|
|
38330
|
+
continue;
|
|
38331
|
+
receivedBytes += chunk.byteLength;
|
|
38332
|
+
if (receivedBytes > BITBUCKET_WEBHOOK_MAX_BODY_BYTES) {
|
|
38333
|
+
tooLarge = true;
|
|
38334
|
+
chunks.length = 0;
|
|
38335
|
+
jsonError(res, `Payload too large (max ${BITBUCKET_WEBHOOK_MAX_BODY_BYTES} bytes)`, 413);
|
|
38336
|
+
continue;
|
|
38337
|
+
}
|
|
38338
|
+
chunks.push(chunk);
|
|
38339
|
+
}
|
|
38340
|
+
if (tooLarge)
|
|
38341
|
+
return true;
|
|
38342
|
+
const rawBody = Buffer.concat(chunks).toString();
|
|
38343
|
+
const signature = req.headers["x-hub-signature"];
|
|
38344
|
+
if (!verifyBitbucketWebhook(rawBody, signature)) {
|
|
38345
|
+
console.log("[Bitbucket] Invalid webhook signature");
|
|
38346
|
+
res.writeHead(401, { "Content-Type": "application/json" });
|
|
38347
|
+
res.end(JSON.stringify({ error: "Invalid signature" }));
|
|
38348
|
+
return true;
|
|
38349
|
+
}
|
|
38350
|
+
let body;
|
|
38351
|
+
try {
|
|
38352
|
+
body = JSON.parse(rawBody);
|
|
38353
|
+
} catch {
|
|
38354
|
+
res.writeHead(400, { "Content-Type": "application/json" });
|
|
38355
|
+
res.end(JSON.stringify({ error: "Invalid JSON body" }));
|
|
38356
|
+
return true;
|
|
38357
|
+
}
|
|
38358
|
+
const eventKey = req.headers["x-event-key"];
|
|
38359
|
+
const requestUuid = req.headers["x-request-uuid"];
|
|
38360
|
+
if (isDuplicateDelivery(requestUuid)) {
|
|
38361
|
+
console.log(`[Bitbucket] Skipping duplicate delivery ${requestUuid}`);
|
|
38362
|
+
bitbucketWebhook.respond(res, 200, { created: false });
|
|
38363
|
+
return true;
|
|
38364
|
+
}
|
|
38365
|
+
console.log(`[Bitbucket] Received ${eventKey} event`);
|
|
38366
|
+
try {
|
|
38367
|
+
const result = await runBlockableHandler("Bitbucket", async () => {
|
|
38368
|
+
switch (eventKey) {
|
|
38369
|
+
case "pullrequest:created":
|
|
38370
|
+
return await handlePullRequestCreated2(body);
|
|
38371
|
+
case "pullrequest:comment_created":
|
|
38372
|
+
return await handlePullRequestCommentCreated(body);
|
|
38373
|
+
case "pullrequest:fulfilled":
|
|
38374
|
+
return await handlePullRequestClosed(body, "merged");
|
|
38375
|
+
case "pullrequest:rejected":
|
|
38376
|
+
return await handlePullRequestClosed(body, "declined");
|
|
38377
|
+
default:
|
|
38378
|
+
console.log(`[Bitbucket] Ignoring unsupported event type: ${eventKey}`);
|
|
38379
|
+
return { created: false };
|
|
38380
|
+
}
|
|
38381
|
+
});
|
|
38382
|
+
const workflowEvent = {
|
|
38383
|
+
"pullrequest:created": "created",
|
|
38384
|
+
"pullrequest:comment_created": "commented",
|
|
38385
|
+
"pullrequest:fulfilled": "merged",
|
|
38386
|
+
"pullrequest:rejected": "declined"
|
|
38387
|
+
}[eventKey ?? ""];
|
|
38388
|
+
const prEvent = workflowEvent ? pullRequestEventOf(body) : null;
|
|
38389
|
+
if (workflowEvent && prEvent) {
|
|
38390
|
+
const pr = prEvent.pullrequest;
|
|
38391
|
+
const comment = workflowEvent === "commented" ? pullRequestCommentEventOf(body)?.comment : undefined;
|
|
38392
|
+
const user = comment?.user ?? prEvent.actor;
|
|
38393
|
+
workflowEventBus2.emit(`bitbucket.pull_request.${workflowEvent}`, {
|
|
38394
|
+
repo: prEvent.repository.full_name,
|
|
38395
|
+
number: pr.id,
|
|
38396
|
+
...workflowEvent === "commented" ? { body: comment?.content.raw } : { title: pr.title, body: pr.description ?? undefined },
|
|
38397
|
+
action: workflowEvent,
|
|
38398
|
+
user_login: user.account_id ?? user.nickname ?? user.display_name
|
|
38399
|
+
});
|
|
38400
|
+
}
|
|
38401
|
+
markDeliveryProcessed(requestUuid);
|
|
38402
|
+
bitbucketWebhook.respond(res, 200, result);
|
|
38403
|
+
} catch (err) {
|
|
38404
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
38405
|
+
console.error(`[Bitbucket] Error handling ${eventKey} event: ${scrubSecrets(errorMessage)}`);
|
|
38406
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
38407
|
+
res.end(JSON.stringify({ error: "Internal server error" }));
|
|
38408
|
+
}
|
|
38409
|
+
return true;
|
|
38410
|
+
}
|
|
37944
38411
|
if (agentmailWebhook.match(req.method, pathSegments)) {
|
|
37945
38412
|
if (!isAgentMailEnabled()) {
|
|
37946
38413
|
res.writeHead(503, { "Content-Type": "application/json" });
|
|
@@ -39403,7 +39870,7 @@ var httpServer = createHttpServer(async (req, res) => {
|
|
|
39403
39870
|
});
|
|
39404
39871
|
});
|
|
39405
39872
|
var detachRealtime = attachRealtimeTransport(httpServer);
|
|
39406
|
-
var { attachControllerTransport } = await import("./controllers-connect-
|
|
39873
|
+
var { attachControllerTransport } = await import("./controllers-connect-tw1dan9r.js");
|
|
39407
39874
|
var detachControllers = attachControllerTransport(httpServer);
|
|
39408
39875
|
var stopWorkerNudges = startWorkerNudgeListener();
|
|
39409
39876
|
var stopRoomDeletion = realtimeBus.subscribe("room:namespace-deleted", (namespace) => {
|
|
@@ -39432,7 +39899,7 @@ async function shutdown() {
|
|
|
39432
39899
|
sessionsProcessed: getServerSessionsProcessed()
|
|
39433
39900
|
});
|
|
39434
39901
|
if (hasCapability("scheduling")) {
|
|
39435
|
-
const { stopScheduler } = await import("./index-
|
|
39902
|
+
const { stopScheduler } = await import("./index-07ef7nkm.js");
|
|
39436
39903
|
stopScheduler();
|
|
39437
39904
|
}
|
|
39438
39905
|
stopHeartbeat2();
|
|
@@ -39444,7 +39911,7 @@ async function shutdown() {
|
|
|
39444
39911
|
await stopSlackApp2();
|
|
39445
39912
|
await stopChatSdk();
|
|
39446
39913
|
if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
|
|
39447
|
-
const { stopOAuthKeepalive } = await import("./keepalive-
|
|
39914
|
+
const { stopOAuthKeepalive } = await import("./keepalive-5nh2rhmr.js");
|
|
39448
39915
|
await stopOAuthKeepalive();
|
|
39449
39916
|
}
|
|
39450
39917
|
stopOAuthPendingGc();
|
|
@@ -39524,21 +39991,21 @@ try {
|
|
|
39524
39991
|
console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
|
|
39525
39992
|
}
|
|
39526
39993
|
try {
|
|
39527
|
-
const { ensurePricingSeeded } = await import("./boot-seeds-
|
|
39994
|
+
const { ensurePricingSeeded } = await import("./boot-seeds-3vn0m9sg.js");
|
|
39528
39995
|
ensurePricingSeeded();
|
|
39529
|
-
const { startPricingRefreshLoop } = await import("./pricing-refresh-
|
|
39996
|
+
const { startPricingRefreshLoop } = await import("./pricing-refresh-nevhat8h.js");
|
|
39530
39997
|
startPricingRefreshLoop();
|
|
39531
39998
|
} catch (err) {
|
|
39532
39999
|
console.error("[startup] Failed to seed pricing rows:", err);
|
|
39533
40000
|
}
|
|
39534
40001
|
try {
|
|
39535
|
-
const { ensureModelProfilesSeeded } = await import("./boot-seeds-
|
|
40002
|
+
const { ensureModelProfilesSeeded } = await import("./boot-seeds-3vn0m9sg.js");
|
|
39536
40003
|
await ensureModelProfilesSeeded();
|
|
39537
40004
|
} catch (err) {
|
|
39538
40005
|
console.error("[startup] Failed to seed model profiles:", err);
|
|
39539
40006
|
}
|
|
39540
40007
|
try {
|
|
39541
|
-
const { ensureRbacSeeded } = await import("./boot-seeds-
|
|
40008
|
+
const { ensureRbacSeeded } = await import("./boot-seeds-3vn0m9sg.js");
|
|
39542
40009
|
ensureRbacSeeded();
|
|
39543
40010
|
} catch (err) {
|
|
39544
40011
|
console.error("[startup] Failed to sync RBAC seed rows:", err);
|
|
@@ -39546,7 +40013,7 @@ try {
|
|
|
39546
40013
|
throw err;
|
|
39547
40014
|
}
|
|
39548
40015
|
try {
|
|
39549
|
-
const { runAllSeeders } = await import("./index-
|
|
40016
|
+
const { runAllSeeders } = await import("./index-zdycv3ja.js");
|
|
39550
40017
|
await runAllSeeders({ scriptEmbeddingMode: "skip" });
|
|
39551
40018
|
} catch (err) {
|
|
39552
40019
|
console.error("[startup] Failed to seed built-in entities:", err);
|
|
@@ -39602,45 +40069,46 @@ httpServer.listen(port, async () => {
|
|
|
39602
40069
|
initGitLab();
|
|
39603
40070
|
initAzureDevOps();
|
|
39604
40071
|
initAzureDevOpsOutbound();
|
|
40072
|
+
initBitbucket();
|
|
39605
40073
|
initAgentMail();
|
|
39606
40074
|
await initLinear();
|
|
39607
40075
|
await initJira();
|
|
39608
40076
|
await initWorkflows2();
|
|
39609
40077
|
await startScriptRunSupervisor(getMcpBaseUrl());
|
|
39610
40078
|
if (hasCapability("scheduling")) {
|
|
39611
|
-
const { startScheduler } = await import("./index-
|
|
39612
|
-
const { getExecutorRegistry } = await import("./index-
|
|
40079
|
+
const { startScheduler } = await import("./index-07ef7nkm.js");
|
|
40080
|
+
const { getExecutorRegistry } = await import("./index-q3t40ryv.js");
|
|
39613
40081
|
const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
|
|
39614
40082
|
startScheduler(getExecutorRegistry(), intervalMs, {
|
|
39615
40083
|
runId: globalState.__runId
|
|
39616
40084
|
});
|
|
39617
40085
|
}
|
|
39618
40086
|
if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
|
|
39619
|
-
const { startHeartbeat } = await import("./index-
|
|
40087
|
+
const { startHeartbeat } = await import("./index-7yts8n9s.js");
|
|
39620
40088
|
const heartbeatMs = Number(process.env.HEARTBEAT_INTERVAL_MS) || 90000;
|
|
39621
40089
|
startHeartbeat(heartbeatMs);
|
|
39622
40090
|
}
|
|
39623
40091
|
startPoolRouting();
|
|
39624
40092
|
startRuntimeSupervisor();
|
|
39625
40093
|
if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
|
|
39626
|
-
const { startOAuthKeepalive } = await import("./keepalive-
|
|
40094
|
+
const { startOAuthKeepalive } = await import("./keepalive-5nh2rhmr.js");
|
|
39627
40095
|
startOAuthKeepalive();
|
|
39628
40096
|
}
|
|
39629
40097
|
if (process.env.OAUTH_REFRESH_SWEEP_DISABLE !== "true") {
|
|
39630
|
-
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-
|
|
40098
|
+
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-y3n1knmd.js");
|
|
39631
40099
|
startOAuthRefreshSweep();
|
|
39632
40100
|
}
|
|
39633
40101
|
startOAuthPendingGc();
|
|
39634
40102
|
await startMemoryGc();
|
|
39635
40103
|
await startDbRetention();
|
|
39636
40104
|
startHumanFreeDrain();
|
|
39637
|
-
import("./boot-reembed-
|
|
40105
|
+
import("./boot-reembed-n4wq5dd2.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
|
|
39638
40106
|
console.error("[boot-reembed] startup backfill failed (non-fatal):", err);
|
|
39639
40107
|
});
|
|
39640
|
-
import("./boot-reembed-
|
|
40108
|
+
import("./boot-reembed-4xwq5tg0.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
|
|
39641
40109
|
console.error("[boot-reembed-scripts] startup backfill failed (non-fatal):", err);
|
|
39642
40110
|
});
|
|
39643
|
-
import("./boot-scrub-sweep-
|
|
40111
|
+
import("./boot-scrub-sweep-69h90xcq.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
|
|
39644
40112
|
console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
|
|
39645
40113
|
});
|
|
39646
40114
|
}).on("error", (err) => {
|