@desplega.ai/agent-swarm 2.12.0 → 2.13.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/dist/acp-adapter-cn53011z.js +17 -0
- package/dist/{acp-targets-311gcyvw.js → acp-targets-86f0sh6g.js} +9 -8
- package/dist/{actions-c4chgxp6.js → actions-zv8vcxvr.js} +24 -23
- package/dist/{agent-fs-provision-0b9awm5n.js → agent-fs-provision-jqshb33y.js} +4 -4
- package/dist/{amp-adapter-r0veq6x5.js → amp-adapter-gt503ywc.js} +2 -2
- package/dist/{app-hn5fftf5.js → app-6t4k5rh1.js} +6 -4
- package/dist/{approval-notifications-3g6yc8nv.js → approval-notifications-fcfw063h.js} +7 -6
- package/dist/{assistant-cpjgpjvp.js → assistant-9dzybh12.js} +25 -24
- package/dist/{boot-args-schema-hce1av1h.js → boot-args-schema-xzfp2feg.js} +1 -1
- package/dist/{boot-reembed-d7xcym0j.js → boot-reembed-3jz0p2jk.js} +1 -1
- package/dist/{boot-reembed-bztbxc4z.js → boot-reembed-r88wngfg.js} +5 -2
- package/dist/{boot-scrub-sweep-mkmm16gk.js → boot-scrub-sweep-scrqhw48.js} +2 -2
- package/dist/{boot-seeds-arrkbe8t.js → boot-seeds-vb2dcrrb.js} +4 -4
- package/dist/{claude-adapter-ykpyr5p8.js → claude-adapter-h3mp9hgs.js} +7 -6
- package/dist/{claude-managed-adapter-ssg6z4bt.js → claude-managed-adapter-kpbyj2vb.js} +3 -3
- package/dist/{claude-managed-setup-trd59v7b.js → claude-managed-setup-0efr3wkg.js} +5 -5
- package/dist/{claude-sdk-session-yjcze0j1.js → claude-sdk-session-03dw669q.js} +7 -6
- package/dist/{cli-e3ahxq5y.js → cli-0b655smz.js} +4 -4
- package/dist/{cli-mcymtvwn.js → cli-0dg7ytxm.js} +89 -11
- package/dist/cli-0jkenasr.js +148 -0
- package/dist/{cli-c7j31hq9.js → cli-0pazkmd4.js} +3 -3
- package/dist/{cli-5tg94mdw.js → cli-117g15t4.js} +8 -11
- package/dist/{cli-r14ac1y0.js → cli-1dbv9mj9.js} +1 -1
- package/dist/{cli-q8tc22bj.js → cli-1v82d2w6.js} +3 -3
- package/dist/{cli-pe3yxedk.js → cli-2jk4s7z1.js} +2 -2
- package/dist/{cli-0pp1yjg2.js → cli-2skf1mdf.js} +8 -8
- package/dist/{cli-2tw284hj.js → cli-48nvk6sb.js} +1 -1
- package/dist/{cli-en6dmkxd.js → cli-49f5jyhh.js} +2 -2
- package/dist/{cli-2z2c4k6q.js → cli-50w82h6m.js} +21 -0
- package/dist/{cli-dd2k2mcd.js → cli-6a40p4kv.js} +1 -1
- package/dist/{cli-yegz2g06.js → cli-6h88mn9q.js} +3 -3
- package/dist/{cli-52nfye5j.js → cli-7dbhnsj9.js} +23 -15
- package/dist/{cli-04zc3f7b.js → cli-9fsagra4.js} +1 -1
- package/dist/{cli-nja15knq.js → cli-9m9kyw77.js} +3 -3
- package/dist/{cli-k5jx8jya.js → cli-ajjvqhf3.js} +1 -1
- package/dist/{cli-hbvgzjq4.js → cli-avqkr20b.js} +2 -2
- package/dist/{cli-yfpc6qy9.js → cli-avxh26pd.js} +46 -15
- package/dist/{cli-q2dywc8h.js → cli-b2jh3dyb.js} +4 -4
- package/dist/{cli-m5qtmrbc.js → cli-c8v2yvej.js} +2 -2
- package/dist/{cli-gfy6hbd9.js → cli-ct8sz3np.js} +17 -10
- package/dist/{cli-bz97ff9n.js → cli-dka73bak.js} +1 -1
- package/dist/{cli-dkvtfgn4.js → cli-dkejt425.js} +75 -16
- package/dist/{cli-sv2r3bw8.js → cli-dnh64e8e.js} +2 -2
- package/dist/{cli-kwr5qv5g.js → cli-eb279wn3.js} +2 -2
- package/dist/{cli-hhc47ack.js → cli-f1952kjy.js} +2 -2
- package/dist/{cli-5z0g0e8v.js → cli-f8rcvf2x.js} +49 -13
- package/dist/{cli-eq4kew31.js → cli-fhvk2nvp.js} +24 -11
- package/dist/{cli-xf4z5bdn.js → cli-fz9pcjsw.js} +2 -2
- package/dist/{cli-fxd1mwtr.js → cli-g6j6ac3h.js} +1 -1
- package/dist/{cli-ya3kf4gs.js → cli-gfcv679k.js} +1 -1
- package/dist/{cli-55tc8cj4.js → cli-hbq0kwxz.js} +4 -4
- package/dist/{cli-39qm0rtm.js → cli-hc6e4tac.js} +28 -149
- package/dist/{cli-j5gtytvg.js → cli-hgsxnjyg.js} +13 -10
- package/dist/{cli-h70a2mxy.js → cli-hpb9x72z.js} +48 -8
- package/dist/{cli-7yn42w6m.js → cli-j53hpbsm.js} +1 -1
- package/dist/{cli-12vek61e.js → cli-jj3c5nyb.js} +471 -119
- package/dist/{cli-fy4gb74g.js → cli-kde4ky90.js} +1 -1
- package/dist/{cli-9qe5y107.js → cli-kspxjftk.js} +1 -1
- package/dist/{cli-bp6k9acz.js → cli-mh7pdxe0.js} +16 -16
- package/dist/{cli-v9ya390t.js → cli-mz34pxbk.js} +8 -8
- package/dist/{cli-ma9ys8rt.js → cli-nc6a8b5b.js} +7 -4
- package/dist/{cli-1htmtqc2.js → cli-prf7kz78.js} +49 -49
- package/dist/{cli-01tvvtad.js → cli-qec9bynj.js} +3 -3
- package/dist/{cli-t75xngj1.js → cli-qhhb30e8.js} +7 -7
- package/dist/{cli-73q4g5nx.js → cli-qm3ntjqs.js} +12 -12
- package/dist/{cli-tm60vtax.js → cli-rfejbpe1.js} +1 -1
- package/dist/{cli-agjbj5x0.js → cli-sdh61g52.js} +37 -19
- package/dist/{cli-9y4tgrkf.js → cli-skd2c4ej.js} +2 -1
- package/dist/{cli-5x03v6en.js → cli-sq913bh1.js} +8 -8
- package/dist/{cli-b93d81yg.js → cli-t35hx078.js} +1 -1
- package/dist/{cli-r0mz92by.js → cli-tn91wc6e.js} +1 -1
- package/dist/{cli-wvjqaqcp.js → cli-tstj6e8e.js} +1113 -227
- package/dist/{cli-xm34qj8m.js → cli-w14j2z4k.js} +2 -2
- package/dist/{cli-eqq0hwvx.js → cli-wndegmns.js} +1 -1
- package/dist/{cli-0k1a0sde.js → cli-wrhbym01.js} +6 -6
- package/dist/{cli-fyaq4zdv.js → cli-wv20kbr3.js} +6 -6
- package/dist/{cli-mq2fbgva.js → cli-wxwv3t11.js} +2 -2
- package/dist/{cli-krbcr00p.js → cli-xfjn2kyq.js} +58 -4
- package/dist/{cli-5r95eqbh.js → cli-y260hgep.js} +1 -1
- package/dist/{cli-cjqyse9q.js → cli-y4a4458j.js} +3 -3
- package/dist/{cli-2amwhyv2.js → cli-y518qkjg.js} +5 -3
- package/dist/{cli-0vcqcwfn.js → cli-yfvhvw8m.js} +2 -0
- package/dist/cli-yn4kt85g.js +148 -0
- package/dist/{cli-n8f0fs3c.js → cli-ytc7fpza.js} +8 -8
- package/dist/{cli-e8n0hdzd.js → cli-z64t9pe6.js} +1 -1
- package/dist/{cli-72yms3ey.js → cli-zqmmy073.js} +198 -18
- package/dist/cli.js +18 -16
- package/dist/{codex-adapter-wc6e4wct.js → codex-adapter-f3yp0kaj.js} +5 -5
- package/dist/{codex-hook-aqtj17yr.js → codex-hook-262cekfp.js} +73 -2
- package/dist/{codex-session-runner-ppfgjd97.js → codex-session-runner-ns4mv70p.js} +5 -5
- package/dist/{commands-tsv2vx5b.js → commands-5bzf2tfw.js} +3 -3
- package/dist/{controller-ye4sdwsy.js → controller-5xt7kvfm.js} +2 -2
- package/dist/{controllers-connect-zn4dg69h.js → controllers-connect-0gg13mzp.js} +24 -23
- package/dist/core-0fqtbrxa.js +42 -0
- package/dist/{cursor-adapter-q2g9vwts.js → cursor-adapter-p0c5zv6r.js} +1 -1
- package/dist/{db-g111qn9j.js → db-2s68ycq7.js} +3 -3
- package/dist/{db-3r1fyr2n.js → db-q7q639k5.js} +4 -2
- package/dist/{dispatcher-4q8s0mx8.js → dispatcher-j2y1q7ae.js} +24 -21
- package/dist/{dsh-adapter-mmcw1z5s.js → dsh-adapter-pgnkf4st.js} +1 -1
- package/dist/{easter-egg-3d-04ke6hcp.js → easter-egg-3d-0kea97jf.js} +1 -1
- package/dist/{embedding-space-kcdn52vz.js → embedding-space-3n6mhhmy.js} +6 -6
- package/dist/{embeddings-jnzcd91a.js → embeddings-jfmj6yme.js} +1 -1
- package/dist/{execute-74amghty.js → execute-tjrej979.js} +1 -1
- package/dist/{external-channel-v9zgxnxz.js → external-channel-jy8w2gg3.js} +2 -2
- package/dist/fx-adapter-k6w3jvz9.js +20 -0
- package/dist/grok-adapter-4q5tssw0.js +20 -0
- package/dist/handlers-qxgfvvsf.js +41 -0
- package/dist/{heartbeat-p8pk1msj.js → heartbeat-6tr2w2da.js} +25 -24
- package/dist/{hook-p5reemds.js → hook-bpnncsec.js} +76 -17
- package/dist/{hook-k1h73zd7.js → hook-fv1jwrv7.js} +6 -5
- package/dist/{http-ms1z5xxy.js → http-bpa26czn.js} +785 -181
- package/dist/index-0mcxjdsa.js +44 -0
- package/dist/{index-kn63q1gr.js → index-52tgbhrw.js} +29 -28
- package/dist/index-dz4q23ag.js +40 -0
- package/dist/{index-76zzxtzf.js → index-mpj0z9e0.js} +1 -1
- package/dist/index-s175jckx.js +39 -0
- package/dist/{index-gjn6qfgn.js → index-s8re7mvq.js} +1 -1
- package/dist/{index-fbkqhvvj.js → index-w216g9y9.js} +198 -160
- package/dist/{keepalive-031js8jz.js → keepalive-d6z12s04.js} +3 -3
- package/dist/lead-p3hx7h35.js +79 -0
- package/dist/{maintenance-sq9v3qx9.js → maintenance-7kac6g2g.js} +1 -1
- package/dist/{oauth-refresh-sweep-zqmnyvs8.js → oauth-refresh-sweep-t1xjetbh.js} +2 -2
- package/dist/{object-webhooks-r24wwb5y.js → object-webhooks-6rdagg0r.js} +7 -7
- package/dist/{onboard-p25yhh7t.js → onboard-32y1cfxy.js} +3 -3
- package/dist/{opencode-adapter-wcjc4zdk.js → opencode-adapter-enp3v31n.js} +7 -6
- package/dist/{otel-impl-ff1gf20m.js → otel-impl-k0tm5ptj.js} +1 -1
- package/dist/{pending-hxj5yatb.js → pending-24zebgvs.js} +23 -22
- package/dist/{pi-mono-adapter-vkp4zz7p.js → pi-mono-adapter-yj72xxxe.js} +85 -16
- package/dist/{pricing-refresh-9w7gx41w.js → pricing-refresh-cf25x38j.js} +2 -2
- package/dist/{rbac-roles-84aw10nz.js → rbac-roles-0wydd22m.js} +3 -3
- package/dist/{rbac-roles-hz74vckp.js → rbac-roles-at6crb3r.js} +7 -4
- package/dist/{registry-eeyx1201.js → registry-zv0zvxsx.js} +1 -1
- package/dist/{render-v2-nrdkg9gf.js → render-v2-nvcw0jd7.js} +8 -4
- package/dist/{resume-s6ey36rh.js → resume-y4w0k5v3.js} +9 -8
- package/dist/{runtime-x0b4pyam.js → runtime-vpe43hx0.js} +1 -1
- package/dist/{session-access-xv49tk14.js → session-access-gkyvnfye.js} +5 -4
- package/dist/{session-source-backfill-r5j988ah.js → session-source-backfill-3w2st4m2.js} +2 -2
- package/dist/{setup-mj0krk1p.js → setup-axxvqtys.js} +1 -1
- package/dist/thread-buffer-rwa7d4dx.js +42 -0
- package/dist/{tree-visibility-cbrsfaar.js → tree-visibility-y4fqvab5.js} +2 -2
- package/dist/{user-merge-jobs-f9d8nwnw.js → user-merge-jobs-kcmwvrc6.js} +3 -3
- package/dist/{virtual-modules-ns0ryw05.js → virtual-modules-7d92dct1.js} +3 -3
- package/dist/{work-objects-pydhzast.js → work-objects-f708e069.js} +27 -25
- package/dist/worker-8rg9gz74.js +79 -0
- package/dist/{worker-follow-up-9z2xec5e.js → worker-follow-up-0by8wztc.js} +22 -21
- package/dist/xlsx-9acfmxr1.js +31534 -0
- package/openapi.json +1385 -204
- package/package.json +5 -3
- package/src/agentmail/handlers.ts +26 -19
- package/src/apps/catalog.generated.json +31 -0
- package/src/apps/row-store.ts +37 -14
- package/src/azure-devops/handlers.ts +2 -0
- package/src/be/audit-user.ts +46 -6
- package/src/be/db/kv-windows.ts +22 -0
- package/src/be/db/session-moves.ts +3 -3
- package/src/be/db/session-tree.ts +52 -5
- package/src/be/db/skill-audit.ts +17 -0
- package/src/be/db/tasks/write.ts +18 -3
- package/src/be/db.ts +114 -23
- package/src/be/extensions/assets.ts +11 -7
- package/src/be/memory/demotion-evidence.ts +2 -2
- package/src/be/memory/providers/sqlite-store.ts +151 -18
- package/src/be/memory/search-read-worker.ts +60 -0
- package/src/be/memory/search-reader.ts +223 -0
- package/src/be/migrations/337_favorites_session_hidden_key.sql +39 -0
- package/src/be/migrations/338_audit_agent_columns.sql +30 -0
- package/src/be/migrations/339_deferred_event_waits.sql +26 -0
- package/src/be/model-tier-resolution.ts +18 -1
- package/src/be/multi-runtime.ts +17 -0
- package/src/be/primitives/object-embed.ts +250 -0
- package/src/be/primitives/objects.ts +29 -9
- package/src/be/primitives/sheets/service.ts +138 -6
- package/src/be/primitives/sheets/xlsx.ts +367 -0
- package/src/be/rbac-roles.ts +3 -0
- package/src/be/repo-checked-update.ts +4 -4
- package/src/be/repo-merge-policy.ts +26 -9
- package/src/be/scripts/boot-reembed.ts +6 -0
- package/src/be/scripts/db.ts +17 -5
- package/src/be/scripts/embeddings.ts +6 -0
- package/src/be/scripts/typecheck.ts +43 -2
- package/src/be/seed/schedules-seeder.ts +9 -1
- package/src/be/seed/workflows-seeder.ts +9 -1
- package/src/be/seed-scripts/index.ts +2 -0
- package/src/be/seed-skills/index.ts +12 -0
- package/src/be/swarm-config-guard.ts +1 -0
- package/src/be/unmapped-identities.ts +95 -1
- package/src/bitbucket/handlers.ts +2 -0
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/event-waits/github.ts +43 -0
- package/src/event-waits/index.ts +29 -0
- package/src/event-waits/types.ts +51 -0
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/extensions/dispatcher.ts +9 -0
- package/src/fs/agent-fs-provider.ts +4 -1
- package/src/github/handlers.ts +3 -1
- package/src/github/pull-request-state.ts +34 -0
- package/src/gitlab/handlers.ts +12 -7
- package/src/hooks/codex-hook.ts +99 -1
- package/src/hooks/hook.ts +85 -11
- package/src/hooks/native-tool-hooks.ts +245 -0
- package/src/http/all-routes.ts +1 -0
- package/src/http/assets.ts +4 -3
- package/src/http/comb.ts +2 -2
- package/src/http/favorite-owner.ts +2 -2
- package/src/http/favorites.ts +3 -2
- package/src/http/fs.ts +13 -4
- package/src/http/index.ts +2 -0
- package/src/http/mcp-bridge.ts +4 -0
- package/src/http/objects.ts +265 -0
- package/src/http/pages.ts +3 -3
- package/src/http/poll.ts +43 -12
- package/src/http/repos.ts +7 -6
- package/src/http/schedules.ts +10 -6
- package/src/http/script-connections.ts +2 -2
- package/src/http/scripts.ts +9 -0
- package/src/http/sessions.ts +30 -12
- package/src/http/skills.ts +17 -0
- package/src/http/task-requester.ts +2 -2
- package/src/http/tasks.ts +13 -3
- package/src/http/tool-hooks.ts +24 -2
- package/src/http/trackers/authorize-gate.ts +2 -2
- package/src/http/users.ts +136 -1
- package/src/http/workflow-events.ts +13 -0
- package/src/http/workflows.ts +21 -11
- package/src/linear/sync.ts +3 -1
- package/src/prompts/base-prompt.ts +35 -13
- package/src/prompts/session-templates.ts +25 -0
- package/src/providers/acp-targets.ts +1 -1
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/providers/opencode-adapter.ts +1 -0
- package/src/providers/opencode-swarm-plugin.ts +50 -1
- package/src/providers/pi-mono-adapter.ts +139 -9
- package/src/providers/pi-mono-extension.ts +69 -0
- package/src/providers/runtime-dependencies.ts +1 -1
- package/src/rbac/legacy-policy.ts +3 -0
- package/src/rbac/permissions.ts +11 -1
- package/src/scheduler/deferred-task-waits.ts +170 -13
- package/src/scripts-runtime/executors/types.ts +5 -0
- package/src/scripts-runtime/loader.ts +8 -0
- package/src/scripts-runtime/mcp-client.ts +4 -0
- package/src/scripts-runtime/sdk-allowlist.ts +14 -1
- package/src/scripts-runtime/swarm-config.ts +8 -0
- package/src/scripts-runtime/swarm-sdk.ts +4 -0
- package/src/scripts-runtime/types/stdlib.d.ts +47 -4
- package/src/scripts-runtime/types/swarm-extension.d.ts +1 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +47 -4
- package/src/server.ts +4 -0
- package/src/slack/enrich.ts +81 -21
- package/src/slack/handlers.test.ts +55 -2
- package/src/slack/handlers.ts +38 -3
- package/src/slack/render-v2.ts +19 -0
- package/src/slack/session-mirror.ts +208 -0
- package/src/slack/thread-participants.ts +0 -5
- package/src/slack/watcher.ts +3 -0
- package/src/slack/work-objects.test.ts +2 -1
- package/src/slack/work-objects.ts +7 -2
- package/src/tests/agentmail-filters.test.ts +4 -3
- package/src/tests/audit-agent-person.test.ts +825 -0
- package/src/tests/audit-updated-by.test.ts +19 -12
- package/src/tests/claude-hook-output.test.ts +107 -2
- package/src/tests/claude-managed-setup.test.ts +1 -1
- package/src/tests/codex-adapter.test.ts +6 -6
- package/src/tests/codex-gpt6-release.test.ts +4 -4
- package/src/tests/db-task-read-contract.test.ts +1 -0
- package/src/tests/db-task-write-contract.test.ts +1 -0
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/extensions-catalog.test.ts +33 -25
- package/src/tests/fixtures/sheets/eocd-count-mismatch.xlsx +0 -0
- package/src/tests/fixtures/sheets/rich-budget.xlsx +0 -0
- package/src/tests/fixtures/sheets/tracker-export.xlsx +0 -0
- package/src/tests/kv-storage.test.ts +3 -0
- package/src/tests/memory-search-reader.test.ts +258 -0
- package/src/tests/memory-search-stall.test.ts +197 -20
- package/src/tests/model-control.test.ts +4 -4
- package/src/tests/model-tier-resolution.test.ts +2 -2
- package/src/tests/multi-runtime-registration.test.ts +8 -2
- package/src/tests/native-tool-hooks.test.ts +188 -0
- package/src/tests/opencode-swarm-plugin.test.ts +6 -1
- package/src/tests/pi-provider-runtime-keys.test.ts +163 -0
- package/src/tests/poll-probe-readonly.test.ts +108 -0
- package/src/tests/primitives-sheets-xlsx.test.ts +549 -0
- package/src/tests/prompt-template-session.test.ts +3 -2
- package/src/tests/rbac-roles.test.ts +3 -0
- package/src/tests/script-connections.test.ts +4 -0
- package/src/tests/seed-model-profiles.test.ts +1 -1
- package/src/tests/sessions-tree.test.ts +10 -2
- package/src/tests/slack-thread-participants.test.ts +66 -4
- package/src/tests/tool-registrar-no-input.test.ts +1 -0
- package/src/tools/defer-task.ts +154 -12
- package/src/tools/objects.ts +10 -5
- package/src/tools/repos/update-repo.ts +6 -6
- package/src/tools/schedules/create-schedule.ts +1 -0
- package/src/tools/schedules/list-schedules.ts +3 -0
- package/src/tools/schedules/patch-schedule.ts +12 -3
- package/src/tools/schedules/update-schedule.ts +12 -3
- package/src/tools/sheets.ts +66 -0
- package/src/tools/skills/skill-create.ts +6 -0
- package/src/tools/skills/skill-install-remote.ts +6 -0
- package/src/tools/skills/skill-sync-remote.ts +9 -0
- package/src/tools/skills/skill-update.ts +9 -1
- package/src/tools/tool-config.ts +3 -1
- package/src/tools/utils.ts +15 -0
- package/src/tools/workflows/create-workflow.ts +9 -4
- package/src/tools/workflows/patch-workflow-node.ts +1 -1
- package/src/tools/workflows/patch-workflow.ts +5 -2
- package/src/tools/workflows/update-workflow.ts +13 -7
- package/src/types.ts +96 -12
- package/src/workflows/input.ts +12 -5
- package/src/workflows/patch-definition.ts +13 -5
- package/src/workflows/triggers.ts +11 -6
- package/src/workflows/version.ts +7 -1
- package/templates/skills/boards-and-sheets/config.json +14 -0
- package/templates/skills/boards-and-sheets/content.md +163 -0
- package/templates/skills/swarm-docs/content.md +9 -0
- package/dist/acp-adapter-11m13kx4.js +0 -16
- package/dist/core-dxcy02sc.js +0 -41
- package/dist/fx-adapter-0ar6pqm3.js +0 -19
- package/dist/grok-adapter-t6m74fb1.js +0 -19
- package/dist/handlers-9kwcrc4k.js +0 -38
- package/dist/index-23cdfzr6.js +0 -39
- package/dist/index-g7kkjs5b.js +0 -38
- package/dist/index-stk36pa5.js +0 -43
- package/dist/lead-mfggjtfk.js +0 -77
- package/dist/thread-buffer-temgaqsy.js +0 -41
- package/dist/worker-efcemc22.js +0 -77
- /package/dist/{cli-cah298e5.js → cli-m4ejz4nj.js} +0 -0
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
beginRequestAuthScope,
|
|
45
45
|
setRequestAuth,
|
|
46
46
|
getRequestAuth,
|
|
47
|
+
getCurrentRequestAuth,
|
|
47
48
|
runWithoutRequestAuth,
|
|
48
49
|
authUserId,
|
|
49
50
|
authUser,
|
|
@@ -143,6 +144,8 @@ import {
|
|
|
143
144
|
init_review_recall_filter,
|
|
144
145
|
searchMemoryCandidates,
|
|
145
146
|
init_search_candidates,
|
|
147
|
+
memorySearchReader,
|
|
148
|
+
init_search_reader,
|
|
146
149
|
rowToCandidate,
|
|
147
150
|
init_sqlite_store,
|
|
148
151
|
getEmbeddingProvider2,
|
|
@@ -403,23 +406,23 @@ import {
|
|
|
403
406
|
recordInlineScriptRun2,
|
|
404
407
|
exports_db,
|
|
405
408
|
init_db4
|
|
406
|
-
} from "./cli-
|
|
409
|
+
} from "./cli-jj3c5nyb.js";
|
|
407
410
|
import {
|
|
408
411
|
assertMayActOnOperatorGrantedTarget2,
|
|
409
412
|
getUserGrant2,
|
|
410
413
|
init_rbac_roles
|
|
411
|
-
} from "./cli-
|
|
414
|
+
} from "./cli-nc6a8b5b.js";
|
|
412
415
|
import {
|
|
413
416
|
ensurePricingSeeded2,
|
|
414
417
|
ensureRbacSeeded2,
|
|
415
418
|
ensureModelProfilesSeeded2,
|
|
416
419
|
init_boot_seeds
|
|
417
|
-
} from "./cli-
|
|
420
|
+
} from "./cli-9m9kyw77.js";
|
|
418
421
|
import {
|
|
419
422
|
requestModelCatalogRefresh2,
|
|
420
423
|
startPricingRefreshLoop2,
|
|
421
424
|
init_pricing_refresh
|
|
422
|
-
} from "./cli-
|
|
425
|
+
} from "./cli-t35hx078.js";
|
|
423
426
|
import {
|
|
424
427
|
workflowEventBus2,
|
|
425
428
|
init_event_bus
|
|
@@ -432,7 +435,7 @@ import {
|
|
|
432
435
|
externalChannelToolError2,
|
|
433
436
|
getChannelBlockReason2,
|
|
434
437
|
init_external_channel
|
|
435
|
-
} from "./cli-
|
|
438
|
+
} from "./cli-g6j6ac3h.js";
|
|
436
439
|
import {
|
|
437
440
|
tableToAscii2,
|
|
438
441
|
init_dist8
|
|
@@ -495,7 +498,7 @@ import {
|
|
|
495
498
|
startSlackApp2,
|
|
496
499
|
stopSlackAppUnderLifecycleLock2,
|
|
497
500
|
init_app4
|
|
498
|
-
} from "./cli-
|
|
501
|
+
} from "./cli-zqmmy073.js";
|
|
499
502
|
import {
|
|
500
503
|
AGENT_MAX_TASKS_CONFIG_KEY,
|
|
501
504
|
resetAgentMaxTasksMirror,
|
|
@@ -516,7 +519,7 @@ import {
|
|
|
516
519
|
postApprovalCancellationUpdates2,
|
|
517
520
|
createApprovalFollowUpTask2,
|
|
518
521
|
init_approval_notifications
|
|
519
|
-
} from "./cli-
|
|
522
|
+
} from "./cli-ct8sz3np.js";
|
|
520
523
|
import {
|
|
521
524
|
shapeApprovalResolution,
|
|
522
525
|
init_approval_resolution,
|
|
@@ -540,15 +543,15 @@ import {
|
|
|
540
543
|
resumeFromChildRun2,
|
|
541
544
|
initWaitBusSubscriptions2,
|
|
542
545
|
init_resume
|
|
543
|
-
} from "./cli-
|
|
546
|
+
} from "./cli-0b655smz.js";
|
|
544
547
|
import {
|
|
545
548
|
getFileStorageProvider2,
|
|
546
549
|
init_registry2
|
|
547
|
-
} from "./cli-
|
|
550
|
+
} from "./cli-y260hgep.js";
|
|
548
551
|
import {
|
|
549
552
|
getRuntimePool2,
|
|
550
553
|
init_db2
|
|
551
|
-
} from "./cli-
|
|
554
|
+
} from "./cli-1v82d2w6.js";
|
|
552
555
|
import {
|
|
553
556
|
duplicateGuardedQueryKey,
|
|
554
557
|
parseQueryParams,
|
|
@@ -559,13 +562,10 @@ import {
|
|
|
559
562
|
json,
|
|
560
563
|
jsonError,
|
|
561
564
|
init_utils2,
|
|
562
|
-
getSessionRoot,
|
|
563
|
-
sessionAccessForRoot,
|
|
564
|
-
init_session_shares,
|
|
565
565
|
resolveCallerTask,
|
|
566
566
|
resolveTaskGroupKey,
|
|
567
567
|
resolveTaskAuditUserId,
|
|
568
|
-
|
|
568
|
+
resolveHttpRequesterUserId,
|
|
569
569
|
init_audit_user,
|
|
570
570
|
resolveHttpFavoriteOwner,
|
|
571
571
|
init_favorite_owner,
|
|
@@ -584,7 +584,7 @@ import {
|
|
|
584
584
|
findRoute,
|
|
585
585
|
route,
|
|
586
586
|
init_route_def
|
|
587
|
-
} from "./cli-
|
|
587
|
+
} from "./cli-hc6e4tac.js";
|
|
588
588
|
import {
|
|
589
589
|
COMPOSIO_HTTP_METHODS,
|
|
590
590
|
executeComposioRequest,
|
|
@@ -686,7 +686,7 @@ import {
|
|
|
686
686
|
init_typecheck,
|
|
687
687
|
parseSkillContent,
|
|
688
688
|
init_skill_parser
|
|
689
|
-
} from "./cli-
|
|
689
|
+
} from "./cli-0dg7ytxm.js";
|
|
690
690
|
import {
|
|
691
691
|
detachedProcessGroup,
|
|
692
692
|
registerProcessGroup,
|
|
@@ -701,9 +701,10 @@ import {
|
|
|
701
701
|
ensureToken,
|
|
702
702
|
ensureTokenOrThrow,
|
|
703
703
|
init_ensure_token
|
|
704
|
-
} from "./cli-
|
|
704
|
+
} from "./cli-kspxjftk.js";
|
|
705
705
|
import {
|
|
706
706
|
A1Error,
|
|
707
|
+
colName,
|
|
707
708
|
refOf,
|
|
708
709
|
parseCell,
|
|
709
710
|
parseRange,
|
|
@@ -719,6 +720,7 @@ import {
|
|
|
719
720
|
SheetDocSchema,
|
|
720
721
|
checkTabName,
|
|
721
722
|
newTab,
|
|
723
|
+
emptySheet,
|
|
722
724
|
usedExtent,
|
|
723
725
|
constantInput,
|
|
724
726
|
init_format,
|
|
@@ -727,17 +729,18 @@ import {
|
|
|
727
729
|
ObjectsError,
|
|
728
730
|
NO_AGENT_FS_IDENTITY,
|
|
729
731
|
clientFor,
|
|
732
|
+
normalizePath,
|
|
730
733
|
createObject,
|
|
731
734
|
getObject,
|
|
732
735
|
recordObjectVersion,
|
|
733
736
|
listObjects,
|
|
734
737
|
reindexObjects,
|
|
735
738
|
init_objects
|
|
736
|
-
} from "./cli-
|
|
739
|
+
} from "./cli-7dbhnsj9.js";
|
|
737
740
|
import {
|
|
738
741
|
agentFsClientFor,
|
|
739
742
|
init_agent_fs_identity
|
|
740
|
-
} from "./cli-
|
|
743
|
+
} from "./cli-avqkr20b.js";
|
|
741
744
|
import {
|
|
742
745
|
FilesError,
|
|
743
746
|
providerPath,
|
|
@@ -745,13 +748,13 @@ import {
|
|
|
745
748
|
init_provider,
|
|
746
749
|
AgentFsProvider,
|
|
747
750
|
init_agent_fs_provider
|
|
748
|
-
} from "./cli-
|
|
751
|
+
} from "./cli-skd2c4ej.js";
|
|
749
752
|
import {
|
|
750
753
|
SLACK_LEAVE_THREAD_DISABLE,
|
|
751
754
|
isSlackLeaveThreadDisabled,
|
|
752
755
|
leaveSlackThread,
|
|
753
756
|
init_left_threads
|
|
754
|
-
} from "./cli-
|
|
757
|
+
} from "./cli-1dbv9mj9.js";
|
|
755
758
|
import {
|
|
756
759
|
require_fast_deep_equal
|
|
757
760
|
} from "./cli-bhp11egn.js";
|
|
@@ -836,7 +839,7 @@ import {
|
|
|
836
839
|
validateDefinition,
|
|
837
840
|
applyDefinitionPatch,
|
|
838
841
|
init_definition2
|
|
839
|
-
} from "./cli-
|
|
842
|
+
} from "./cli-hgsxnjyg.js";
|
|
840
843
|
import {
|
|
841
844
|
isMultiRuntimeEnabled,
|
|
842
845
|
init_multi_runtime2
|
|
@@ -860,10 +863,15 @@ import {
|
|
|
860
863
|
canProvisionKind,
|
|
861
864
|
init_runtime_providers
|
|
862
865
|
} from "./cli-s6zk31gr.js";
|
|
866
|
+
import {
|
|
867
|
+
getSessionRoot,
|
|
868
|
+
sessionAccessForRoot,
|
|
869
|
+
init_session_shares
|
|
870
|
+
} from "./cli-yn4kt85g.js";
|
|
863
871
|
import {
|
|
864
872
|
publicEndpointSsrfOptions,
|
|
865
873
|
init_mcp_wrapper
|
|
866
|
-
} from "./cli-
|
|
874
|
+
} from "./cli-dka73bak.js";
|
|
867
875
|
import {
|
|
868
876
|
findUserById,
|
|
869
877
|
findUserByExternalId,
|
|
@@ -878,7 +886,7 @@ import {
|
|
|
878
886
|
resolveSessionToken,
|
|
879
887
|
fingerprintApiKey,
|
|
880
888
|
init_users
|
|
881
|
-
} from "./cli-
|
|
889
|
+
} from "./cli-ajjvqhf3.js";
|
|
882
890
|
import {
|
|
883
891
|
resolveGitHubHost,
|
|
884
892
|
getGitHubLinkConfig,
|
|
@@ -891,7 +899,46 @@ import {
|
|
|
891
899
|
ampBillsCacheWrites,
|
|
892
900
|
resolveAmpModel,
|
|
893
901
|
init_amp_models
|
|
894
|
-
} from "./cli-
|
|
902
|
+
} from "./cli-rfejbpe1.js";
|
|
903
|
+
import {
|
|
904
|
+
generateDefaultClaudeMd2,
|
|
905
|
+
generateDefaultSoulMd2,
|
|
906
|
+
generateDefaultIdentityMd2,
|
|
907
|
+
init_defaults,
|
|
908
|
+
taskAttachmentFetchCommand,
|
|
909
|
+
taskAttachmentDisplayUrl,
|
|
910
|
+
init_task_attachment_links,
|
|
911
|
+
contentSha256,
|
|
912
|
+
init_profile_sync
|
|
913
|
+
} from "./cli-sdh61g52.js";
|
|
914
|
+
import {
|
|
915
|
+
getSlackConfiguration,
|
|
916
|
+
isSlackConfigured,
|
|
917
|
+
init_config4
|
|
918
|
+
} from "./cli-eetzmsy5.js";
|
|
919
|
+
import {
|
|
920
|
+
isSteeringEnabled2,
|
|
921
|
+
init_steering_enabled
|
|
922
|
+
} from "./cli-4sydckyj.js";
|
|
923
|
+
import {
|
|
924
|
+
modelFamilyOf,
|
|
925
|
+
windowForModelFamily,
|
|
926
|
+
init_model_rate_limit_windows,
|
|
927
|
+
keySuffix,
|
|
928
|
+
splitCredentialPool,
|
|
929
|
+
selectCredential,
|
|
930
|
+
init_credentials2
|
|
931
|
+
} from "./cli-js10kdk7.js";
|
|
932
|
+
import {
|
|
933
|
+
findInterpolationTokens,
|
|
934
|
+
interpolate,
|
|
935
|
+
init_template2,
|
|
936
|
+
registerTemplate,
|
|
937
|
+
getTemplateDefinition,
|
|
938
|
+
init_registry3,
|
|
939
|
+
resolveTemplate,
|
|
940
|
+
init_resolver
|
|
941
|
+
} from "./cli-50w82h6m.js";
|
|
895
942
|
import {
|
|
896
943
|
normalizeAssetKey,
|
|
897
944
|
defaultAssetKey,
|
|
@@ -936,6 +983,7 @@ import {
|
|
|
936
983
|
ScheduledTaskTargetTypeSchema,
|
|
937
984
|
SwarmConfigScopeSchema,
|
|
938
985
|
RepoGuidelinesInputSchema,
|
|
986
|
+
agentsMayMerge,
|
|
939
987
|
RepoHooksSchema,
|
|
940
988
|
AgentMemoryScopeSchema,
|
|
941
989
|
AgentMemorySourceSchema,
|
|
@@ -965,46 +1013,7 @@ import {
|
|
|
965
1013
|
KvNamespaceSchema,
|
|
966
1014
|
KvKeySchema,
|
|
967
1015
|
init_types5
|
|
968
|
-
} from "./cli-
|
|
969
|
-
import {
|
|
970
|
-
generateDefaultClaudeMd2,
|
|
971
|
-
generateDefaultSoulMd2,
|
|
972
|
-
generateDefaultIdentityMd2,
|
|
973
|
-
init_defaults,
|
|
974
|
-
taskAttachmentFetchCommand,
|
|
975
|
-
taskAttachmentDisplayUrl,
|
|
976
|
-
init_task_attachment_links,
|
|
977
|
-
contentSha256,
|
|
978
|
-
init_profile_sync
|
|
979
|
-
} from "./cli-agjbj5x0.js";
|
|
980
|
-
import {
|
|
981
|
-
isSteeringEnabled2,
|
|
982
|
-
init_steering_enabled
|
|
983
|
-
} from "./cli-4sydckyj.js";
|
|
984
|
-
import {
|
|
985
|
-
getSlackConfiguration,
|
|
986
|
-
isSlackConfigured,
|
|
987
|
-
init_config4
|
|
988
|
-
} from "./cli-eetzmsy5.js";
|
|
989
|
-
import {
|
|
990
|
-
modelFamilyOf,
|
|
991
|
-
windowForModelFamily,
|
|
992
|
-
init_model_rate_limit_windows,
|
|
993
|
-
keySuffix,
|
|
994
|
-
splitCredentialPool,
|
|
995
|
-
selectCredential,
|
|
996
|
-
init_credentials2
|
|
997
|
-
} from "./cli-js10kdk7.js";
|
|
998
|
-
import {
|
|
999
|
-
findInterpolationTokens,
|
|
1000
|
-
interpolate,
|
|
1001
|
-
init_template2,
|
|
1002
|
-
registerTemplate,
|
|
1003
|
-
getTemplateDefinition,
|
|
1004
|
-
init_registry3,
|
|
1005
|
-
resolveTemplate,
|
|
1006
|
-
init_resolver
|
|
1007
|
-
} from "./cli-2z2c4k6q.js";
|
|
1016
|
+
} from "./cli-f8rcvf2x.js";
|
|
1008
1017
|
import {
|
|
1009
1018
|
init_zod
|
|
1010
1019
|
} from "./cli-96234j5w.js";
|
|
@@ -1045,6 +1054,7 @@ import {
|
|
|
1045
1054
|
getAgentFsLiveUrl,
|
|
1046
1055
|
getAgentFsDefaultOrgId,
|
|
1047
1056
|
getAgentFsDefaultDriveId,
|
|
1057
|
+
buildAgentFsLiveUrl,
|
|
1048
1058
|
getCombState,
|
|
1049
1059
|
isAgentFsProxyEnabled,
|
|
1050
1060
|
init_constants3
|
|
@@ -1057,7 +1067,7 @@ import {
|
|
|
1057
1067
|
import {
|
|
1058
1068
|
init_package,
|
|
1059
1069
|
package_default
|
|
1060
|
-
} from "./cli-
|
|
1070
|
+
} from "./cli-y518qkjg.js";
|
|
1061
1071
|
import {
|
|
1062
1072
|
getNodeEnv,
|
|
1063
1073
|
isDevOrTestNodeEnv,
|
|
@@ -20459,7 +20469,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20459
20469
|
if (!waiting)
|
|
20460
20470
|
continue;
|
|
20461
20471
|
if (result.waitFor === "workflow.child.finished") {
|
|
20462
|
-
const { resumeFromChildRun } = await import("./resume-
|
|
20472
|
+
const { resumeFromChildRun } = await import("./resume-y4w0k5v3.js");
|
|
20463
20473
|
await resumeFromChildRun(step.id, registry);
|
|
20464
20474
|
}
|
|
20465
20475
|
} else {
|
|
@@ -20785,6 +20795,9 @@ async function verifyWebhookRequest(trigger, rawBody, headers) {
|
|
|
20785
20795
|
case "hmac-sha256":
|
|
20786
20796
|
isValid = verifyHmacSignature(secret, rawBody, signature);
|
|
20787
20797
|
break;
|
|
20798
|
+
case "hmac-sha1":
|
|
20799
|
+
isValid = verifyHmacSignature(secret, rawBody, signature, "sha1");
|
|
20800
|
+
break;
|
|
20788
20801
|
case "timestamped-hmac-sha256":
|
|
20789
20802
|
isValid = verifyTimestampedHmacSignature(secret, rawBody, signature, {
|
|
20790
20803
|
timestampKey: verification.timestampKey,
|
|
@@ -20882,11 +20895,12 @@ async function handleScheduleTrigger(scheduleId, schedule, registry) {
|
|
|
20882
20895
|
}
|
|
20883
20896
|
return runIds;
|
|
20884
20897
|
}
|
|
20885
|
-
function verifyHmacSignature(secret, body, providedSignature) {
|
|
20886
|
-
const hmac = crypto2.createHmac(
|
|
20898
|
+
function verifyHmacSignature(secret, body, providedSignature, algorithm = "sha256") {
|
|
20899
|
+
const hmac = crypto2.createHmac(algorithm, secret);
|
|
20887
20900
|
hmac.update(body);
|
|
20888
20901
|
const expectedHex = hmac.digest("hex");
|
|
20889
|
-
const
|
|
20902
|
+
const prefix = `${algorithm}=`;
|
|
20903
|
+
const normalizedProvided = providedSignature.startsWith(prefix) ? providedSignature.slice(prefix.length) : providedSignature;
|
|
20890
20904
|
try {
|
|
20891
20905
|
return crypto2.timingSafeEqual(Buffer.from(normalizedProvided, "hex"), Buffer.from(expectedHex, "hex"));
|
|
20892
20906
|
} catch {
|
|
@@ -21031,7 +21045,11 @@ async function snapshotAndUpdateWorkflow(workflowId, updates, opts = {}) {
|
|
|
21031
21045
|
} else {
|
|
21032
21046
|
version = await snapshotWorkflow(workflowId, opts.changedByAgentId);
|
|
21033
21047
|
}
|
|
21034
|
-
const workflow = await updateWorkflow2(workflowId,
|
|
21048
|
+
const workflow = await updateWorkflow2(workflowId, {
|
|
21049
|
+
...updates,
|
|
21050
|
+
updatedBy: updates.updatedBy ?? null,
|
|
21051
|
+
updatedByAgentId: opts.changedByAgentId ?? null
|
|
21052
|
+
});
|
|
21035
21053
|
return { workflow, version };
|
|
21036
21054
|
});
|
|
21037
21055
|
}
|
|
@@ -21330,7 +21348,7 @@ var init_notify = __esm(() => {
|
|
|
21330
21348
|
}
|
|
21331
21349
|
}
|
|
21332
21350
|
case "slack": {
|
|
21333
|
-
const { getSlackApp } = await import("./app-
|
|
21351
|
+
const { getSlackApp } = await import("./app-6t4k5rh1.js");
|
|
21334
21352
|
let app = getSlackApp();
|
|
21335
21353
|
if (!app) {
|
|
21336
21354
|
if (!isSlackConfigured()) {
|
|
@@ -22278,6 +22296,93 @@ var init_workflows = __esm(() => {
|
|
|
22278
22296
|
];
|
|
22279
22297
|
});
|
|
22280
22298
|
|
|
22299
|
+
// src/github/pull-request-state.ts
|
|
22300
|
+
async function fetchPullRequestState(repo, number) {
|
|
22301
|
+
const auth = await getWorkerInstallationToken();
|
|
22302
|
+
const response = await fetch(githubApiUrl(`/repos/${repo}/pulls/${number}`), {
|
|
22303
|
+
headers: {
|
|
22304
|
+
Accept: "application/vnd.github+json",
|
|
22305
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
22306
|
+
...auth.status === "ok" ? { Authorization: `Bearer ${auth.token}` } : {}
|
|
22307
|
+
},
|
|
22308
|
+
signal: AbortSignal.timeout(1e4)
|
|
22309
|
+
});
|
|
22310
|
+
if (!response.ok)
|
|
22311
|
+
throw new Error(`GitHub returned ${response.status} for ${repo}#${number}`);
|
|
22312
|
+
const pr = await response.json();
|
|
22313
|
+
return {
|
|
22314
|
+
merged: pr.merged === true,
|
|
22315
|
+
state: pr.state === "open" ? "open" : "closed"
|
|
22316
|
+
};
|
|
22317
|
+
}
|
|
22318
|
+
var init_pull_request_state = __esm(() => {
|
|
22319
|
+
init_github_host();
|
|
22320
|
+
init_app();
|
|
22321
|
+
});
|
|
22322
|
+
|
|
22323
|
+
// src/event-waits/github.ts
|
|
22324
|
+
function prMatch(repo, number) {
|
|
22325
|
+
return { repo: repo.toLowerCase(), number };
|
|
22326
|
+
}
|
|
22327
|
+
var PrMatch, githubAdapter;
|
|
22328
|
+
var init_github2 = __esm(() => {
|
|
22329
|
+
init_zod();
|
|
22330
|
+
init_app();
|
|
22331
|
+
init_pull_request_state();
|
|
22332
|
+
PrMatch = object2({ repo: string2().regex(/^[\w.-]+\/[\w.-]+$/), number: number2().int().positive() }).strict();
|
|
22333
|
+
githubAdapter = {
|
|
22334
|
+
source: "github",
|
|
22335
|
+
events: ["vcs.pr.merged"],
|
|
22336
|
+
matchHint: "repo (owner/name), number",
|
|
22337
|
+
busPrefix: "github.pull_request.",
|
|
22338
|
+
readsWithServerCredentials: true,
|
|
22339
|
+
isEnabled: isGitHubEnabled,
|
|
22340
|
+
parseMatch(_event, match) {
|
|
22341
|
+
const parsed = PrMatch.safeParse(match);
|
|
22342
|
+
if (!parsed.success) {
|
|
22343
|
+
throw new Error("match for a github PR event takes repo (owner/name) and number only.");
|
|
22344
|
+
}
|
|
22345
|
+
return prMatch(parsed.data.repo, parsed.data.number);
|
|
22346
|
+
},
|
|
22347
|
+
fromBusEvent(busEvent, payload) {
|
|
22348
|
+
const pr = payload;
|
|
22349
|
+
if (busEvent !== "github.pull_request.closed" || pr?.merged !== true || typeof pr.repo !== "string" || typeof pr.number !== "number")
|
|
22350
|
+
return [];
|
|
22351
|
+
return [{ event: "vcs.pr.merged", match: prMatch(pr.repo, pr.number) }];
|
|
22352
|
+
},
|
|
22353
|
+
async confirm(_event, match) {
|
|
22354
|
+
return (await fetchPullRequestState(String(match.repo), Number(match.number))).merged;
|
|
22355
|
+
}
|
|
22356
|
+
};
|
|
22357
|
+
});
|
|
22358
|
+
|
|
22359
|
+
// src/event-waits/types.ts
|
|
22360
|
+
function matchKeyOf(match) {
|
|
22361
|
+
return JSON.stringify(Object.entries(match).sort(([a], [b]) => a < b ? -1 : 1));
|
|
22362
|
+
}
|
|
22363
|
+
function describeEventWait(source, event, match) {
|
|
22364
|
+
const target = Object.entries(match).map(([key, value]) => `${key}=${value}`).join(", ");
|
|
22365
|
+
return `${event} on ${source} (${target})`;
|
|
22366
|
+
}
|
|
22367
|
+
var init_types4 = () => {};
|
|
22368
|
+
|
|
22369
|
+
// src/event-waits/index.ts
|
|
22370
|
+
function getExternalEventAdapter(source) {
|
|
22371
|
+
return EXTERNAL_EVENT_ADAPTERS.find((adapter) => adapter.source === source);
|
|
22372
|
+
}
|
|
22373
|
+
function isReservedProviderEvent(name) {
|
|
22374
|
+
return EXTERNAL_EVENT_ADAPTERS.some((adapter) => name.startsWith(adapter.busPrefix));
|
|
22375
|
+
}
|
|
22376
|
+
var EXTERNAL_EVENT_ADAPTERS, EXTERNAL_EVENT_NAMES, EXTERNAL_EVENTS_DOC = 'vcs.pr.merged with source "github" and match {repo (owner/name), number}';
|
|
22377
|
+
var init_event_waits = __esm(() => {
|
|
22378
|
+
init_github2();
|
|
22379
|
+
init_types4();
|
|
22380
|
+
EXTERNAL_EVENT_ADAPTERS = [githubAdapter];
|
|
22381
|
+
EXTERNAL_EVENT_NAMES = [
|
|
22382
|
+
...new Set(EXTERNAL_EVENT_ADAPTERS.flatMap((adapter) => adapter.events))
|
|
22383
|
+
];
|
|
22384
|
+
});
|
|
22385
|
+
|
|
22281
22386
|
// src/scheduler/schedule-task.ts
|
|
22282
22387
|
async function answersInChat(task) {
|
|
22283
22388
|
if (task.source === "chat")
|
|
@@ -22344,15 +22449,37 @@ var init_schedule_task = __esm(() => {
|
|
|
22344
22449
|
});
|
|
22345
22450
|
|
|
22346
22451
|
// src/scheduler/deferred-task-waits.ts
|
|
22452
|
+
function externalWakeReason(source, event) {
|
|
22453
|
+
return `external:${source}:${event}`;
|
|
22454
|
+
}
|
|
22347
22455
|
async function resolveWaitCause(scheduleId, reason) {
|
|
22348
22456
|
const client = getDbClient2();
|
|
22349
22457
|
const wait = await client.get("SELECT * FROM deferred_task_waits WHERE scheduleId = ?", [scheduleId]);
|
|
22350
|
-
if (!wait
|
|
22458
|
+
if (!wait) {
|
|
22459
|
+
const eventWait = await client.get("SELECT * FROM deferred_event_waits WHERE scheduleId = ?", [scheduleId]);
|
|
22460
|
+
if (!eventWait || eventWait.status !== "pending")
|
|
22461
|
+
return;
|
|
22462
|
+
if (reason === "ceiling")
|
|
22463
|
+
return { table: "deferred_event_waits", cause: "ceiling expired", matchedTaskIds: [] };
|
|
22464
|
+
if (reason !== externalWakeReason(eventWait.source, eventWait.event))
|
|
22465
|
+
return;
|
|
22466
|
+
return {
|
|
22467
|
+
table: "deferred_event_waits",
|
|
22468
|
+
cause: describeEventWait(eventWait.source, eventWait.event, JSON.parse(eventWait.matchJson)),
|
|
22469
|
+
matchedTaskIds: []
|
|
22470
|
+
};
|
|
22471
|
+
}
|
|
22472
|
+
if (wait.status !== "pending")
|
|
22351
22473
|
return;
|
|
22352
22474
|
if (reason !== "ceiling" && wait.eventName !== "settled" && wait.eventName !== reason)
|
|
22353
22475
|
return;
|
|
22354
22476
|
if (reason === "ceiling")
|
|
22355
|
-
return {
|
|
22477
|
+
return {
|
|
22478
|
+
table: "deferred_task_waits",
|
|
22479
|
+
mode: wait.mode,
|
|
22480
|
+
cause: "ceiling expired",
|
|
22481
|
+
matchedTaskIds: []
|
|
22482
|
+
};
|
|
22356
22483
|
const members = await client.query(`SELECT m.taskId, ${WAIT_MEMBER_STATUS_SQL} AS taskStatus, EXISTS (
|
|
22357
22484
|
SELECT 1 FROM scheduled_tasks d
|
|
22358
22485
|
WHERE d.parentTaskId = t.id AND d.taskType = 'deferred' AND d.enabled = 1
|
|
@@ -22363,7 +22490,12 @@ async function resolveWaitCause(scheduleId, reason) {
|
|
|
22363
22490
|
if (!matched.length || wait.mode === "all" && matched.length !== members.length)
|
|
22364
22491
|
return;
|
|
22365
22492
|
const cause = members.length === 1 ? `task.${matched[0].taskStatus} for task ${matched[0].taskId}` : `${wait.mode} tasks matched ${wait.eventName}: ${matched.map((member) => `${member.taskId} (${member.taskStatus})`).join(", ")}`;
|
|
22366
|
-
return {
|
|
22493
|
+
return {
|
|
22494
|
+
table: "deferred_task_waits",
|
|
22495
|
+
mode: wait.mode,
|
|
22496
|
+
cause,
|
|
22497
|
+
matchedTaskIds: matched.map((member) => member.taskId)
|
|
22498
|
+
};
|
|
22367
22499
|
}
|
|
22368
22500
|
function wakeSchedule(schedule, cause) {
|
|
22369
22501
|
return { ...schedule, taskTemplate: `${schedule.taskTemplate}
|
|
@@ -22386,9 +22518,8 @@ async function prepareDeferredWakeTask(scheduleId, reason, extraTags) {
|
|
|
22386
22518
|
}
|
|
22387
22519
|
async function prepareDeferredTaskWait(scheduleId, reason, extraTags = []) {
|
|
22388
22520
|
const client = getDbClient2();
|
|
22389
|
-
if (!await client.get(
|
|
22390
|
-
|
|
22391
|
-
]))
|
|
22521
|
+
if (!await client.get(`SELECT 1 AS found FROM deferred_task_waits WHERE scheduleId = ?
|
|
22522
|
+
UNION ALL SELECT 1 FROM deferred_event_waits WHERE scheduleId = ?`, [scheduleId, scheduleId]))
|
|
22392
22523
|
return;
|
|
22393
22524
|
return { task: await prepareDeferredWakeTask(scheduleId, reason, extraTags) };
|
|
22394
22525
|
}
|
|
@@ -22408,7 +22539,7 @@ async function dispatchDeferredTaskWait(scheduleId, reason, extraTags = [], trig
|
|
|
22408
22539
|
if (!schedule?.enabled)
|
|
22409
22540
|
return {};
|
|
22410
22541
|
const now = new Date().toISOString();
|
|
22411
|
-
const claimed = await client.run(
|
|
22542
|
+
const claimed = await client.run(`UPDATE ${resolved.table} SET status = 'fired', firedBy = ?, resolvedAt = ?, updated_at = ? WHERE scheduleId = ? AND status = 'pending'`, [reason, now, now, scheduleId]);
|
|
22412
22543
|
if (!claimed.changes)
|
|
22413
22544
|
return {};
|
|
22414
22545
|
if (schedule.createdBy && !await getUserById2(schedule.createdBy)) {
|
|
@@ -22417,7 +22548,7 @@ async function dispatchDeferredTaskWait(scheduleId, reason, extraTags = [], trig
|
|
|
22417
22548
|
if (!schedule.taskTemplate)
|
|
22418
22549
|
throw new Error(`Schedule "${schedule.name}" has no taskTemplate`);
|
|
22419
22550
|
const task = await createStandaloneScheduleTask(wakeSchedule(schedule, resolved.cause), extraTags, preparedForWait);
|
|
22420
|
-
await client.run(
|
|
22551
|
+
await client.run(`UPDATE ${resolved.table} SET childTaskId = ? WHERE scheduleId = ?`, [
|
|
22421
22552
|
task.id,
|
|
22422
22553
|
scheduleId
|
|
22423
22554
|
]);
|
|
@@ -22431,7 +22562,7 @@ async function dispatchDeferredTaskWait(scheduleId, reason, extraTags = [], trig
|
|
|
22431
22562
|
waiterTaskId: schedule.parentTaskId ?? null,
|
|
22432
22563
|
wakeTaskId: task.id,
|
|
22433
22564
|
wakeAgentId: task.agentId ?? null,
|
|
22434
|
-
mode: resolved.
|
|
22565
|
+
mode: resolved.mode
|
|
22435
22566
|
}
|
|
22436
22567
|
});
|
|
22437
22568
|
}
|
|
@@ -22498,9 +22629,50 @@ async function reapSpentDeferredSchedules(now = new Date) {
|
|
|
22498
22629
|
AND NOT EXISTS (
|
|
22499
22630
|
SELECT 1 FROM deferred_task_waits w
|
|
22500
22631
|
WHERE w.scheduleId = scheduled_tasks.id AND w.status = 'pending'
|
|
22632
|
+
)
|
|
22633
|
+
AND NOT EXISTS (
|
|
22634
|
+
SELECT 1 FROM deferred_event_waits e
|
|
22635
|
+
WHERE e.scheduleId = scheduled_tasks.id AND e.status = 'pending'
|
|
22501
22636
|
)`, [cutoff]);
|
|
22502
22637
|
return result.changes;
|
|
22503
22638
|
}
|
|
22639
|
+
async function reconcileDeferredEventWaits(only, trustEvent = false) {
|
|
22640
|
+
const waits = await getDbClient2().query(`SELECT w.scheduleId, w.source, w.event, w.matchKey, w.matchJson FROM deferred_event_waits w
|
|
22641
|
+
JOIN scheduled_tasks s ON s.id = w.scheduleId
|
|
22642
|
+
WHERE w.status = 'pending' AND s.enabled = 1
|
|
22643
|
+
${only ? "AND w.source = ? AND w.event = ? AND w.matchKey = ?" : ""}`, only ? [only.source, only.event, only.matchKey] : []);
|
|
22644
|
+
const satisfied = new Map;
|
|
22645
|
+
for (const wait of waits) {
|
|
22646
|
+
const adapter = getExternalEventAdapter(wait.source);
|
|
22647
|
+
if (!adapter || !adapter.confirm && !trustEvent)
|
|
22648
|
+
continue;
|
|
22649
|
+
const key = `${wait.source}|${wait.event}|${wait.matchKey}`;
|
|
22650
|
+
try {
|
|
22651
|
+
if (!satisfied.has(key))
|
|
22652
|
+
satisfied.set(key, adapter.confirm ? await adapter.confirm(wait.event, JSON.parse(wait.matchJson)) : true);
|
|
22653
|
+
if (satisfied.get(key))
|
|
22654
|
+
await dispatchDeferredTaskWait(wait.scheduleId, externalWakeReason(wait.source, wait.event));
|
|
22655
|
+
} catch (err) {
|
|
22656
|
+
console.error(`[Scheduler] External event wake failed for ${wait.scheduleId}:`, err);
|
|
22657
|
+
}
|
|
22658
|
+
}
|
|
22659
|
+
}
|
|
22660
|
+
function externalEventListener(adapter) {
|
|
22661
|
+
return (busEvent, payload) => {
|
|
22662
|
+
let events;
|
|
22663
|
+
try {
|
|
22664
|
+
events = adapter.fromBusEvent(busEvent, payload);
|
|
22665
|
+
} catch (err) {
|
|
22666
|
+
console.error(`[Scheduler] ${adapter.source} adapter failed to read ${busEvent}:`, err);
|
|
22667
|
+
return;
|
|
22668
|
+
}
|
|
22669
|
+
for (const { event, match } of events) {
|
|
22670
|
+
reconcileDeferredEventWaits({ source: adapter.source, event, matchKey: matchKeyOf(match) }, true).catch((err) => {
|
|
22671
|
+
console.error("[Scheduler] External event wake failed:", err);
|
|
22672
|
+
});
|
|
22673
|
+
}
|
|
22674
|
+
};
|
|
22675
|
+
}
|
|
22504
22676
|
function onTaskEvent(payload) {
|
|
22505
22677
|
if (!payload || typeof payload !== "object" || !("taskId" in payload) || typeof payload.taskId !== "string")
|
|
22506
22678
|
return;
|
|
@@ -22516,7 +22688,15 @@ async function initDeferredTaskWaits() {
|
|
|
22516
22688
|
workflowEventBus2.on("task.skipped", onTaskEvent);
|
|
22517
22689
|
workflowEventBus2.on("task.superseded", onTaskEvent);
|
|
22518
22690
|
workflowEventBus2.on("task.created", onTaskEvent);
|
|
22691
|
+
for (const adapter of EXTERNAL_EVENT_ADAPTERS) {
|
|
22692
|
+
const listener = externalEventListener(adapter);
|
|
22693
|
+
externalEventListeners.set(adapter, listener);
|
|
22694
|
+
workflowEventBus2.onPrefix(adapter.busPrefix, listener);
|
|
22695
|
+
}
|
|
22519
22696
|
await reconcileDeferredTaskWaits();
|
|
22697
|
+
reconcileDeferredEventWaits().catch((err) => {
|
|
22698
|
+
console.error("[Scheduler] External event boot reconcile failed:", err);
|
|
22699
|
+
});
|
|
22520
22700
|
}
|
|
22521
22701
|
function stopDeferredTaskWaits() {
|
|
22522
22702
|
workflowEventBus2.off("task.completed", onTaskEvent);
|
|
@@ -22525,10 +22705,15 @@ function stopDeferredTaskWaits() {
|
|
|
22525
22705
|
workflowEventBus2.off("task.skipped", onTaskEvent);
|
|
22526
22706
|
workflowEventBus2.off("task.superseded", onTaskEvent);
|
|
22527
22707
|
workflowEventBus2.off("task.created", onTaskEvent);
|
|
22708
|
+
for (const [adapter, listener] of externalEventListeners) {
|
|
22709
|
+
workflowEventBus2.offPrefix(adapter.busPrefix, listener);
|
|
22710
|
+
}
|
|
22711
|
+
externalEventListeners.clear();
|
|
22528
22712
|
}
|
|
22529
|
-
var WAIT_MEMBER_STATUS_SQL, DEFERRED_WAIT_WOKE_EVENT = "task_deferred_wait_woke", SPENT_DEFERRED_SCHEDULE_RETENTION_MS;
|
|
22713
|
+
var MAX_PENDING_EVENT_WAITS_PER_AGENT = 20, WAIT_MEMBER_STATUS_SQL, DEFERRED_WAIT_WOKE_EVENT = "task_deferred_wait_woke", SPENT_DEFERRED_SCHEDULE_RETENTION_MS, externalEventListeners;
|
|
22530
22714
|
var init_deferred_task_waits = __esm(() => {
|
|
22531
22715
|
init_db4();
|
|
22716
|
+
init_event_waits();
|
|
22532
22717
|
init_types5();
|
|
22533
22718
|
init_event_bus();
|
|
22534
22719
|
init_schedule_task();
|
|
@@ -22536,6 +22721,7 @@ var init_deferred_task_waits = __esm(() => {
|
|
|
22536
22721
|
WHEN t.status = 'superseded' AND t.failureReason = '${SUPERSEDED_WORKFLOW_TASK_REASON}' THEN 'failed'
|
|
22537
22722
|
ELSE t.status END`;
|
|
22538
22723
|
SPENT_DEFERRED_SCHEDULE_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
|
|
22724
|
+
externalEventListeners = new Map;
|
|
22539
22725
|
});
|
|
22540
22726
|
|
|
22541
22727
|
// src/scheduler/scheduler.ts
|
|
@@ -23475,7 +23661,7 @@ var init_assets = __esm(() => {
|
|
|
23475
23661
|
});
|
|
23476
23662
|
return schedule.id;
|
|
23477
23663
|
},
|
|
23478
|
-
async update(plan, id,
|
|
23664
|
+
async update(plan, id, agentId, actor) {
|
|
23479
23665
|
const live = await getScheduledTaskById2(id);
|
|
23480
23666
|
if (!live)
|
|
23481
23667
|
return;
|
|
@@ -23489,7 +23675,8 @@ var init_assets = __esm(() => {
|
|
|
23489
23675
|
scriptName: spec.scriptName,
|
|
23490
23676
|
scriptArgs: spec.scriptArgs,
|
|
23491
23677
|
...live.enabled && timingChanged ? { nextRunAt: calculateNextRun2(timingOf(spec)) } : {},
|
|
23492
|
-
|
|
23678
|
+
updatedBy: actor,
|
|
23679
|
+
updatedByAgentId: agentId
|
|
23493
23680
|
});
|
|
23494
23681
|
},
|
|
23495
23682
|
async remove(row) {
|
|
@@ -23531,7 +23718,7 @@ var init_assets = __esm(() => {
|
|
|
23531
23718
|
});
|
|
23532
23719
|
return workflow.id;
|
|
23533
23720
|
},
|
|
23534
|
-
async update(plan, id,
|
|
23721
|
+
async update(plan, id, agentId, actor) {
|
|
23535
23722
|
await updateWorkflow2(id, {
|
|
23536
23723
|
description: plan.spec.description ?? "",
|
|
23537
23724
|
definition: plan.spec.definition,
|
|
@@ -23539,7 +23726,8 @@ var init_assets = __esm(() => {
|
|
|
23539
23726
|
cooldown: plan.spec.cooldown ?? null,
|
|
23540
23727
|
input: plan.spec.input ?? null,
|
|
23541
23728
|
triggerSchema: plan.spec.triggerSchema ?? null,
|
|
23542
|
-
|
|
23729
|
+
updatedBy: actor,
|
|
23730
|
+
updatedByAgentId: agentId
|
|
23543
23731
|
});
|
|
23544
23732
|
},
|
|
23545
23733
|
async remove(row) {
|
|
@@ -23565,7 +23753,7 @@ var init_assets = __esm(() => {
|
|
|
23565
23753
|
}));
|
|
23566
23754
|
return { id: skill.id, hash: skillHash(liveSkillSpec(skill), files) };
|
|
23567
23755
|
},
|
|
23568
|
-
async create(plan, agentId) {
|
|
23756
|
+
async create(plan, agentId, actor) {
|
|
23569
23757
|
const { spec } = plan;
|
|
23570
23758
|
const skill = await createSkill2({
|
|
23571
23759
|
...spec,
|
|
@@ -23580,13 +23768,15 @@ var init_assets = __esm(() => {
|
|
|
23580
23768
|
sourceHash: spec.sourceHash ?? undefined,
|
|
23581
23769
|
type: "personal",
|
|
23582
23770
|
ownerAgentId: agentId,
|
|
23583
|
-
isEnabled: false
|
|
23771
|
+
isEnabled: false,
|
|
23772
|
+
createdByAgentId: agentId,
|
|
23773
|
+
createdBy: actor
|
|
23584
23774
|
});
|
|
23585
23775
|
await upsertSkillFiles2(skill.id, plan.files);
|
|
23586
23776
|
return skill.id;
|
|
23587
23777
|
},
|
|
23588
|
-
async update(plan, id) {
|
|
23589
|
-
await updateSkill2(id, plan.spec);
|
|
23778
|
+
async update(plan, id, agentId, actor) {
|
|
23779
|
+
await updateSkill2(id, { ...plan.spec, updatedBy: actor, updatedByAgentId: agentId });
|
|
23590
23780
|
const wanted = new Set(plan.files.map((file) => file.path));
|
|
23591
23781
|
for (const file of await getSkillFiles2(id)) {
|
|
23592
23782
|
if (!wanted.has(file.path))
|
|
@@ -23996,6 +24186,8 @@ var init_sdk_allowlist = __esm(() => {
|
|
|
23996
24186
|
sheets_appendRows: "sheet-append-rows",
|
|
23997
24187
|
sheets_clearRange: "sheet-clear-range",
|
|
23998
24188
|
sheets_addTab: "sheet-add-tab",
|
|
24189
|
+
sheets_importXlsx: "sheet-import-xlsx",
|
|
24190
|
+
sheets_exportXlsx: "sheet-export-xlsx",
|
|
23999
24191
|
boards_create: "board-create",
|
|
24000
24192
|
boards_get: "board-get",
|
|
24001
24193
|
boards_list: "board-list",
|
|
@@ -24137,7 +24329,18 @@ var init_sdk_allowlist = __esm(() => {
|
|
|
24137
24329
|
REST_ONLY_SDK_METHODS = ["savings_calibrationGet", "savings_calibrationRun"];
|
|
24138
24330
|
SDK_NAMESPACES = Object.freeze({
|
|
24139
24331
|
objects: ["create", "get", "list", "reindex"],
|
|
24140
|
-
sheets: [
|
|
24332
|
+
sheets: [
|
|
24333
|
+
"create",
|
|
24334
|
+
"get",
|
|
24335
|
+
"list",
|
|
24336
|
+
"getRange",
|
|
24337
|
+
"setRange",
|
|
24338
|
+
"appendRows",
|
|
24339
|
+
"clearRange",
|
|
24340
|
+
"addTab",
|
|
24341
|
+
"importXlsx",
|
|
24342
|
+
"exportXlsx"
|
|
24343
|
+
],
|
|
24141
24344
|
boards: ["create", "get", "list", "addElements", "updateElements", "removeElements"]
|
|
24142
24345
|
});
|
|
24143
24346
|
});
|
|
@@ -24782,7 +24985,7 @@ function setPreloadedTools(server, names) {
|
|
|
24782
24985
|
async function applyPreToolCall(name, args, requestInfo, inputSchema) {
|
|
24783
24986
|
if (requestInfo.callOrigin !== "mcp")
|
|
24784
24987
|
return { args };
|
|
24785
|
-
const dispatcher = await import("./dispatcher-
|
|
24988
|
+
const dispatcher = await import("./dispatcher-j2y1q7ae.js");
|
|
24786
24989
|
const result = await dispatcher.dispatchPre("pre.tool.call", { tool: name, args, requestInfo }, inputSchema ? {
|
|
24787
24990
|
validateModify: async (data) => {
|
|
24788
24991
|
const schema = normalizeObjectSchema(inputSchema) ?? inputSchema;
|
|
@@ -24831,6 +25034,7 @@ function dispatchPostToolCall(dispatcher, name, args, outcome, requestInfo, dura
|
|
|
24831
25034
|
var scriptSdkRequestOrigins, extensionRequestOrigins, getRequestInfo = (req) => {
|
|
24832
25035
|
const agentIdHeader = req.requestInfo?.headers?.["x-agent-id"];
|
|
24833
25036
|
const sourceTaskIdHeader = req.requestInfo?.headers?.["x-source-task-id"];
|
|
25037
|
+
const auditSourceTaskIdHeader = req.requestInfo?.headers?.["x-audit-source-task-id"];
|
|
24834
25038
|
const contextKeyHeader = req.requestInfo?.headers?.["x-context-key"];
|
|
24835
25039
|
const runtimeHeader = req.requestInfo?.headers?.["x-runtime-instance-id"];
|
|
24836
25040
|
const runtimeInstanceId = Array.isArray(runtimeHeader) ? runtimeHeader[0] : runtimeHeader;
|
|
@@ -24857,6 +25061,7 @@ var scriptSdkRequestOrigins, extensionRequestOrigins, getRequestInfo = (req) =>
|
|
|
24857
25061
|
agentId,
|
|
24858
25062
|
runtimeInstanceId: typeof runtimeInstanceId === "string" ? runtimeInstanceId : undefined,
|
|
24859
25063
|
sourceTaskId,
|
|
25064
|
+
auditSourceTaskId: sourceTaskId ?? (Array.isArray(auditSourceTaskIdHeader) ? auditSourceTaskIdHeader[0] : typeof auditSourceTaskIdHeader === "string" ? auditSourceTaskIdHeader : undefined),
|
|
24860
25065
|
contextKey,
|
|
24861
25066
|
callOrigin: extensionRequestOrigins.has(req) ? "extension" : scriptSdkRequestOrigins.has(req) ? "script-sdk" : "mcp"
|
|
24862
25067
|
};
|
|
@@ -25152,6 +25357,7 @@ async function invokeToolInProcess(args) {
|
|
|
25152
25357
|
headers: {
|
|
25153
25358
|
"x-agent-id": args.agentId ?? "",
|
|
25154
25359
|
...args.sourceTaskId ? { "x-source-task-id": args.sourceTaskId } : {},
|
|
25360
|
+
...args.auditSourceTaskId ? { "x-audit-source-task-id": args.auditSourceTaskId } : {},
|
|
25155
25361
|
...args.runtimeInstanceId ? { "x-runtime-instance-id": args.runtimeInstanceId } : {}
|
|
25156
25362
|
}
|
|
25157
25363
|
}
|
|
@@ -25188,6 +25394,7 @@ async function handleMcpBridge(req, res, pathSegments, _queryParams, myAgentId)
|
|
|
25188
25394
|
args,
|
|
25189
25395
|
agentId: myAgentId,
|
|
25190
25396
|
sourceTaskId,
|
|
25397
|
+
auditSourceTaskId: headerValue2(req, "x-audit-source-task-id"),
|
|
25191
25398
|
runtimeInstanceId,
|
|
25192
25399
|
callOrigin: resolveBridgeCallOrigin2(myAgentId, headerValue2(req, "x-extension-token"))
|
|
25193
25400
|
});
|
|
@@ -25297,6 +25504,7 @@ class SwarmConfig {
|
|
|
25297
25504
|
agentId;
|
|
25298
25505
|
mcpBaseUrl;
|
|
25299
25506
|
runtimeInstanceId;
|
|
25507
|
+
auditSourceTaskId;
|
|
25300
25508
|
extensionToken;
|
|
25301
25509
|
userValues;
|
|
25302
25510
|
constructor(payload) {
|
|
@@ -25316,6 +25524,10 @@ class SwarmConfig {
|
|
|
25316
25524
|
type: "system",
|
|
25317
25525
|
isSecret: payload.system.runtimeInstanceId.isSecret
|
|
25318
25526
|
}) : undefined;
|
|
25527
|
+
this.auditSourceTaskId = payload.system.auditSourceTaskId ? Redacted.make(payload.system.auditSourceTaskId.value, {
|
|
25528
|
+
type: "system",
|
|
25529
|
+
isSecret: payload.system.auditSourceTaskId.isSecret
|
|
25530
|
+
}) : undefined;
|
|
25319
25531
|
this.extensionToken = payload.system.extensionToken ? Redacted.make(payload.system.extensionToken.value, {
|
|
25320
25532
|
type: "system",
|
|
25321
25533
|
isSecret: payload.system.extensionToken.isSecret
|
|
@@ -25496,6 +25708,7 @@ function headers(config) {
|
|
|
25496
25708
|
Authorization: `Bearer ${Redacted.value(config.apiKey)}`,
|
|
25497
25709
|
"X-Agent-ID": Redacted.value(config.agentId),
|
|
25498
25710
|
...config.runtimeInstanceId ? { "X-Runtime-Instance-ID": Redacted.value(config.runtimeInstanceId) } : {},
|
|
25711
|
+
...config.auditSourceTaskId ? { "X-Audit-Source-Task-Id": Redacted.value(config.auditSourceTaskId) } : {},
|
|
25499
25712
|
...config.extensionToken ? { "X-Extension-Token": Redacted.value(config.extensionToken) } : {},
|
|
25500
25713
|
"Content-Type": "application/json"
|
|
25501
25714
|
};
|
|
@@ -27288,6 +27501,9 @@ function unregister2(extensionId) {
|
|
|
27288
27501
|
}
|
|
27289
27502
|
return loaded;
|
|
27290
27503
|
}
|
|
27504
|
+
function hasNativeToolHandlers2() {
|
|
27505
|
+
return [...registry2.values()].some((loaded) => (loaded.manifest.toolSources ?? ["mcp"]).includes("native") && loaded.handlers.some((h) => h.event === "pre.tool.call" || h.event === "post.tool.call"));
|
|
27506
|
+
}
|
|
27291
27507
|
function listRegistered2() {
|
|
27292
27508
|
return [...registry2.values()];
|
|
27293
27509
|
}
|
|
@@ -27840,9 +28056,11 @@ Thread: {{thread_id}}
|
|
|
27840
28056
|
|
|
27841
28057
|
// src/agentmail/handlers.ts
|
|
27842
28058
|
function extractEmailFromField(from) {
|
|
27843
|
-
const angleMatch = from.match(/<([
|
|
28059
|
+
const angleMatch = from.match(/<([^<>]+@[^<>]+)>\s*$/);
|
|
27844
28060
|
if (angleMatch?.[1])
|
|
27845
|
-
return angleMatch[1].toLowerCase();
|
|
28061
|
+
return angleMatch[1].trim().toLowerCase();
|
|
28062
|
+
if (from.includes("<"))
|
|
28063
|
+
return;
|
|
27846
28064
|
const bareMatch = from.match(/[\w.+-]+@[\w.-]+\.\w+/);
|
|
27847
28065
|
return bareMatch?.[0]?.toLowerCase();
|
|
27848
28066
|
}
|
|
@@ -27866,11 +28084,8 @@ function isInboxAllowed(inboxId, filter) {
|
|
|
27866
28084
|
function isSenderAllowed(from, filter) {
|
|
27867
28085
|
if (!filter)
|
|
27868
28086
|
return true;
|
|
27869
|
-
const
|
|
27870
|
-
return
|
|
27871
|
-
const emailMatch = addr.match(/<([^>]+)>/);
|
|
27872
|
-
return matchesAddressFilter(emailMatch?.[1] ?? addr, filter);
|
|
27873
|
-
});
|
|
28087
|
+
const email = extractEmailFromField((Array.isArray(from) ? from[0] : from) ?? "");
|
|
28088
|
+
return email !== undefined && matchesAddressFilter(email, filter);
|
|
27874
28089
|
}
|
|
27875
28090
|
function isDuplicate(eventKey) {
|
|
27876
28091
|
const now = Date.now();
|
|
@@ -27906,14 +28121,16 @@ async function handleMessageReceived(payload) {
|
|
|
27906
28121
|
const from = (Array.isArray(message.from_) ? message.from_.join(", ") : message.from_) || "unknown";
|
|
27907
28122
|
const subject = message.subject || "(no subject)";
|
|
27908
28123
|
const body = message.text || message.html || "";
|
|
27909
|
-
const
|
|
27910
|
-
const
|
|
28124
|
+
const senderEntry = (Array.isArray(message.from_) ? message.from_[0] : message.from_) ?? "";
|
|
28125
|
+
const senderEmail = extractEmailFromField(senderEntry);
|
|
28126
|
+
const senderName = extractNameFromField(senderEntry);
|
|
28127
|
+
const senderAuthenticated = payload.event_type !== "message.received.unauthenticated" && !message.labels?.includes("unauthenticated");
|
|
27911
28128
|
let requestedByUserId;
|
|
27912
|
-
if (senderEmail) {
|
|
28129
|
+
if (senderEmail && senderAuthenticated) {
|
|
27913
28130
|
const { user } = await findOrCreateUserByEmail(senderEmail, { name: senderName ?? undefined }, { kind: "system", id: "webhook:agentmail" });
|
|
27914
28131
|
requestedByUserId = user.id;
|
|
27915
28132
|
}
|
|
27916
|
-
const senderDisplay = senderEmail ?
|
|
28133
|
+
const senderDisplay = renderIdentity(senderEmail && senderAuthenticated ? await resolveIdentityByEmail(senderEmail) : { status: "unknown", kind: "email", externalId: senderEmail ?? "unknown" });
|
|
27917
28134
|
const preview = body.length > 500 ? `${body.substring(0, 500)}...` : body;
|
|
27918
28135
|
workflowEventBus2.emit("agentmail.message.received", {
|
|
27919
28136
|
inboxId: inbox_id,
|
|
@@ -28470,6 +28687,103 @@ var init_tracker = __esm(() => {
|
|
|
28470
28687
|
init_db4();
|
|
28471
28688
|
});
|
|
28472
28689
|
|
|
28690
|
+
// src/be/unmapped-identities.ts
|
|
28691
|
+
function dismissedNamespace(kind) {
|
|
28692
|
+
return `integration:unmapped-dismissed:${kind}`;
|
|
28693
|
+
}
|
|
28694
|
+
async function isUnmappedIdentityDismissed(kind, externalId) {
|
|
28695
|
+
return await getKv2(dismissedNamespace(kind), externalId) !== null;
|
|
28696
|
+
}
|
|
28697
|
+
async function dismissUnmappedIdentity(kind, externalId, dismissedBy) {
|
|
28698
|
+
const ns = namespace(kind);
|
|
28699
|
+
await getDbClient2().transaction(async () => {
|
|
28700
|
+
const meta = await getKv2(ns, `${externalId}:meta`);
|
|
28701
|
+
const count = await getKv2(ns, `${externalId}:count`);
|
|
28702
|
+
const prior = (await getKv2(dismissedNamespace(kind), externalId))?.value;
|
|
28703
|
+
if (prior && !meta && !count)
|
|
28704
|
+
return;
|
|
28705
|
+
await upsertKv2({
|
|
28706
|
+
namespace: dismissedNamespace(kind),
|
|
28707
|
+
key: externalId,
|
|
28708
|
+
value: {
|
|
28709
|
+
dismissedAt: prior?.dismissedAt ?? new Date().toISOString(),
|
|
28710
|
+
dismissedBy: prior?.dismissedBy ?? dismissedBy,
|
|
28711
|
+
meta: meta?.value ?? prior?.meta ?? null,
|
|
28712
|
+
count: Number(prior?.count ?? 0) + Number(count?.value ?? 0)
|
|
28713
|
+
},
|
|
28714
|
+
valueType: "json"
|
|
28715
|
+
});
|
|
28716
|
+
await deleteKv2(ns, `${externalId}:meta`);
|
|
28717
|
+
await deleteKv2(ns, `${externalId}:count`);
|
|
28718
|
+
});
|
|
28719
|
+
}
|
|
28720
|
+
async function restoreUnmappedIdentity(kind, externalId) {
|
|
28721
|
+
const ns = namespace(kind);
|
|
28722
|
+
return getDbClient2().transaction(async () => {
|
|
28723
|
+
const row = await getKv2(dismissedNamespace(kind), externalId);
|
|
28724
|
+
if (!row)
|
|
28725
|
+
return false;
|
|
28726
|
+
await deleteKv2(dismissedNamespace(kind), externalId);
|
|
28727
|
+
const saved = row.value;
|
|
28728
|
+
const expiresAt = Date.now() + TTL_MS;
|
|
28729
|
+
if (saved?.meta && typeof saved.meta === "object") {
|
|
28730
|
+
await upsertKv2({
|
|
28731
|
+
namespace: ns,
|
|
28732
|
+
key: `${externalId}:meta`,
|
|
28733
|
+
value: saved.meta,
|
|
28734
|
+
valueType: "json",
|
|
28735
|
+
expiresAt
|
|
28736
|
+
});
|
|
28737
|
+
await upsertKv2({
|
|
28738
|
+
namespace: ns,
|
|
28739
|
+
key: `${externalId}:count`,
|
|
28740
|
+
value: Number(saved.count ?? 0),
|
|
28741
|
+
valueType: "integer",
|
|
28742
|
+
expiresAt
|
|
28743
|
+
});
|
|
28744
|
+
}
|
|
28745
|
+
return true;
|
|
28746
|
+
});
|
|
28747
|
+
}
|
|
28748
|
+
function namespace(kind) {
|
|
28749
|
+
return `integration:unmapped:${kind}`;
|
|
28750
|
+
}
|
|
28751
|
+
async function recordUnmappedIdentity(kind, externalId, meta) {
|
|
28752
|
+
if (await isUnmappedIdentityDismissed(kind, externalId))
|
|
28753
|
+
return;
|
|
28754
|
+
const ns = namespace(kind);
|
|
28755
|
+
const now = new Date().toISOString();
|
|
28756
|
+
const expiresAt = Date.now() + TTL_MS;
|
|
28757
|
+
const countKey = `${externalId}:count`;
|
|
28758
|
+
const countBefore = await getKv2(ns, countKey);
|
|
28759
|
+
await upsertKv2({
|
|
28760
|
+
namespace: ns,
|
|
28761
|
+
key: `${externalId}:meta`,
|
|
28762
|
+
value: {
|
|
28763
|
+
lastSeenAt: now,
|
|
28764
|
+
sampleEventType: meta.sampleEventType,
|
|
28765
|
+
sampleContext: meta.sampleContext.slice(0, 100)
|
|
28766
|
+
},
|
|
28767
|
+
valueType: "json",
|
|
28768
|
+
expiresAt
|
|
28769
|
+
});
|
|
28770
|
+
const incremented = await incrKv2(ns, countKey, 1);
|
|
28771
|
+
if (countBefore === null) {
|
|
28772
|
+
await upsertKv2({
|
|
28773
|
+
namespace: ns,
|
|
28774
|
+
key: countKey,
|
|
28775
|
+
value: Number(incremented.value),
|
|
28776
|
+
valueType: "integer",
|
|
28777
|
+
expiresAt
|
|
28778
|
+
});
|
|
28779
|
+
}
|
|
28780
|
+
}
|
|
28781
|
+
var TTL_MS;
|
|
28782
|
+
var init_unmapped_identities = __esm(() => {
|
|
28783
|
+
init_db4();
|
|
28784
|
+
TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
|
28785
|
+
});
|
|
28786
|
+
|
|
28473
28787
|
// src/vcs/azure-devops.ts
|
|
28474
28788
|
function isAzureDevOpsUrl(url) {
|
|
28475
28789
|
return /(^|[/@.])dev\.azure\.com[/:]|\.visualstudio\.com[/:]/i.test(url);
|
|
@@ -28773,6 +29087,8 @@ async function resolveAzureDevOpsSender(identity, sampleEventType, sampleContext
|
|
|
28773
29087
|
return;
|
|
28774
29088
|
}
|
|
28775
29089
|
async function recordUnmappedIdentity2(externalId, sampleEventType, sampleContext) {
|
|
29090
|
+
if (await isUnmappedIdentityDismissed("azure-devops", externalId))
|
|
29091
|
+
return;
|
|
28776
29092
|
await upsertKv2({
|
|
28777
29093
|
namespace: UNMAPPED_NAMESPACE,
|
|
28778
29094
|
key: `${externalId}:meta`,
|
|
@@ -28952,6 +29268,7 @@ var processedEvents2, DEDUP_TTL_MS = 60000, UNMAPPED_NAMESPACE = "integration:un
|
|
|
28952
29268
|
var init_handlers2 = __esm(() => {
|
|
28953
29269
|
init_db4();
|
|
28954
29270
|
init_identity();
|
|
29271
|
+
init_unmapped_identities();
|
|
28955
29272
|
init_users();
|
|
28956
29273
|
init_resolver();
|
|
28957
29274
|
init_context_key();
|
|
@@ -30097,6 +30414,8 @@ async function resolveBitbucketSender(account, sampleEventType, sampleContext) {
|
|
|
30097
30414
|
const existing = await findUserByExternalId("bitbucket", externalId);
|
|
30098
30415
|
if (existing)
|
|
30099
30416
|
return existing.id;
|
|
30417
|
+
if (await isUnmappedIdentityDismissed("bitbucket", externalId))
|
|
30418
|
+
return;
|
|
30100
30419
|
await upsertKv2({
|
|
30101
30420
|
namespace: UNMAPPED_NAMESPACE2,
|
|
30102
30421
|
key: `${externalId}:meta`,
|
|
@@ -30258,6 +30577,7 @@ var DEDUP_TTL_MS2 = 60000, processedEvents3, processedDeliveries, UNMAPPED_NAMES
|
|
|
30258
30577
|
var init_handlers3 = __esm(() => {
|
|
30259
30578
|
init_db4();
|
|
30260
30579
|
init_identity();
|
|
30580
|
+
init_unmapped_identities();
|
|
30261
30581
|
init_users();
|
|
30262
30582
|
init_resolver();
|
|
30263
30583
|
init_context_key();
|
|
@@ -30811,6 +31131,8 @@ async function resolveGitHubSender(login, sampleEventType, sampleContext) {
|
|
|
30811
31131
|
const existing = await findUserByExternalId("github", login);
|
|
30812
31132
|
if (existing)
|
|
30813
31133
|
return existing.id;
|
|
31134
|
+
if (await isUnmappedIdentityDismissed("github", login))
|
|
31135
|
+
return;
|
|
30814
31136
|
await upsertKv2({
|
|
30815
31137
|
namespace: UNMAPPED_NAMESPACE3,
|
|
30816
31138
|
key: `${login}:meta`,
|
|
@@ -31623,6 +31945,7 @@ var processedEvents4, EVENT_TTL2 = 60000, cancelOnUnassignEnabled = () => cancel
|
|
|
31623
31945
|
var init_handlers4 = __esm(() => {
|
|
31624
31946
|
init_db4();
|
|
31625
31947
|
init_identity();
|
|
31948
|
+
init_unmapped_identities();
|
|
31626
31949
|
init_users();
|
|
31627
31950
|
init_resolver();
|
|
31628
31951
|
init_context_key();
|
|
@@ -31894,11 +32217,13 @@ async function resolveGitLabSender(user, sampleEventType, sampleContext) {
|
|
|
31894
32217
|
if (existing)
|
|
31895
32218
|
return existing.id;
|
|
31896
32219
|
const inlineEmail = typeof user.email === "string" ? user.email.trim() : "";
|
|
31897
|
-
if (inlineEmail
|
|
32220
|
+
if (EMAIL_ADDRESS_RE.test(inlineEmail)) {
|
|
31898
32221
|
const { user: linked } = await findOrCreateUserByEmail(inlineEmail, { name: user.name }, GITLAB_WEBHOOK_ACTOR);
|
|
31899
32222
|
await linkIdentity(linked.id, "gitlab", user.username, GITLAB_WEBHOOK_ACTOR);
|
|
31900
32223
|
return linked.id;
|
|
31901
32224
|
}
|
|
32225
|
+
if (await isUnmappedIdentityDismissed("gitlab", user.username))
|
|
32226
|
+
return;
|
|
31902
32227
|
await upsertKv2({
|
|
31903
32228
|
namespace: UNMAPPED_NAMESPACE4,
|
|
31904
32229
|
key: `${user.username}:meta`,
|
|
@@ -32211,10 +32536,11 @@ async function handlePipeline(event) {
|
|
|
32211
32536
|
}, { origin: "webhook" });
|
|
32212
32537
|
return { created: true, taskId: task.id };
|
|
32213
32538
|
}
|
|
32214
|
-
var processedEvents5, DEDUP_TTL_MS3 = 60000, LEGACY_SCOPE, UNMAPPED_NAMESPACE4 = "integration:unmapped:gitlab", UNMAPPED_TTL_MS4, GITLAB_WEBHOOK_ACTOR;
|
|
32539
|
+
var processedEvents5, DEDUP_TTL_MS3 = 60000, LEGACY_SCOPE, UNMAPPED_NAMESPACE4 = "integration:unmapped:gitlab", UNMAPPED_TTL_MS4, GITLAB_WEBHOOK_ACTOR, EMAIL_ADDRESS_RE;
|
|
32215
32540
|
var init_handlers5 = __esm(() => {
|
|
32216
32541
|
init_db4();
|
|
32217
32542
|
init_identity();
|
|
32543
|
+
init_unmapped_identities();
|
|
32218
32544
|
init_users();
|
|
32219
32545
|
init_resolver();
|
|
32220
32546
|
init_context_key();
|
|
@@ -32235,6 +32561,7 @@ var init_handlers5 = __esm(() => {
|
|
|
32235
32561
|
};
|
|
32236
32562
|
UNMAPPED_TTL_MS4 = 30 * 24 * 60 * 60 * 1000;
|
|
32237
32563
|
GITLAB_WEBHOOK_ACTOR = { kind: "system", id: "webhook:gitlab" };
|
|
32564
|
+
EMAIL_ADDRESS_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
32238
32565
|
});
|
|
32239
32566
|
|
|
32240
32567
|
// src/gitlab/index.ts
|
|
@@ -33351,44 +33678,6 @@ var init_session_labels = __esm(() => {
|
|
|
33351
33678
|
};
|
|
33352
33679
|
});
|
|
33353
33680
|
|
|
33354
|
-
// src/be/unmapped-identities.ts
|
|
33355
|
-
function namespace(kind) {
|
|
33356
|
-
return `integration:unmapped:${kind}`;
|
|
33357
|
-
}
|
|
33358
|
-
async function recordUnmappedIdentity(kind, externalId, meta) {
|
|
33359
|
-
const ns = namespace(kind);
|
|
33360
|
-
const now = new Date().toISOString();
|
|
33361
|
-
const expiresAt = Date.now() + TTL_MS;
|
|
33362
|
-
const countKey = `${externalId}:count`;
|
|
33363
|
-
const countBefore = await getKv2(ns, countKey);
|
|
33364
|
-
await upsertKv2({
|
|
33365
|
-
namespace: ns,
|
|
33366
|
-
key: `${externalId}:meta`,
|
|
33367
|
-
value: {
|
|
33368
|
-
lastSeenAt: now,
|
|
33369
|
-
sampleEventType: meta.sampleEventType,
|
|
33370
|
-
sampleContext: meta.sampleContext.slice(0, 100)
|
|
33371
|
-
},
|
|
33372
|
-
valueType: "json",
|
|
33373
|
-
expiresAt
|
|
33374
|
-
});
|
|
33375
|
-
const incremented = await incrKv2(ns, countKey, 1);
|
|
33376
|
-
if (countBefore === null) {
|
|
33377
|
-
await upsertKv2({
|
|
33378
|
-
namespace: ns,
|
|
33379
|
-
key: countKey,
|
|
33380
|
-
value: Number(incremented.value),
|
|
33381
|
-
valueType: "integer",
|
|
33382
|
-
expiresAt
|
|
33383
|
-
});
|
|
33384
|
-
}
|
|
33385
|
-
}
|
|
33386
|
-
var TTL_MS;
|
|
33387
|
-
var init_unmapped_identities = __esm(() => {
|
|
33388
|
-
init_db4();
|
|
33389
|
-
TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
|
33390
|
-
});
|
|
33391
|
-
|
|
33392
33681
|
// src/be/task-attachment-store.ts
|
|
33393
33682
|
async function recordTaskAttachmentUpload(input) {
|
|
33394
33683
|
const { provider, scope, uploaded, contentType } = input;
|
|
@@ -36408,7 +36697,7 @@ async function notifySlack(text) {
|
|
|
36408
36697
|
return;
|
|
36409
36698
|
}
|
|
36410
36699
|
try {
|
|
36411
|
-
const { getSlackApp } = await import("./app-
|
|
36700
|
+
const { getSlackApp } = await import("./app-6t4k5rh1.js");
|
|
36412
36701
|
const app = getSlackApp();
|
|
36413
36702
|
if (!app) {
|
|
36414
36703
|
console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
|
|
@@ -36479,7 +36768,7 @@ async function deleteJiraWebhook(webhookId) {
|
|
|
36479
36768
|
console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
|
|
36480
36769
|
}
|
|
36481
36770
|
async function overwriteWebhookIds(next) {
|
|
36482
|
-
const { getDbClient } = await import("./db-
|
|
36771
|
+
const { getDbClient } = await import("./db-q7q639k5.js");
|
|
36483
36772
|
await getDbClient().transaction(async (tx) => {
|
|
36484
36773
|
const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
|
|
36485
36774
|
if (!row) {
|
|
@@ -108544,6 +108833,8 @@ async function resolveLinearActor(linearUserId, email, name, workspaceId, sample
|
|
|
108544
108833
|
await linkIdentity(linked.id, "linear", linearUserId, LINEAR_WEBHOOK_ACTOR);
|
|
108545
108834
|
return linked.id;
|
|
108546
108835
|
}
|
|
108836
|
+
if (await isUnmappedIdentityDismissed("linear", linearUserId))
|
|
108837
|
+
return;
|
|
108547
108838
|
await upsertKv2({
|
|
108548
108839
|
namespace: UNMAPPED_NAMESPACE5,
|
|
108549
108840
|
key: `${linearUserId}:meta`,
|
|
@@ -108970,6 +109261,7 @@ var init_sync = __esm(() => {
|
|
|
108970
109261
|
init_db4();
|
|
108971
109262
|
init_oauth();
|
|
108972
109263
|
init_tracker();
|
|
109264
|
+
init_unmapped_identities();
|
|
108973
109265
|
init_users();
|
|
108974
109266
|
init_ensure_token();
|
|
108975
109267
|
init_resolver();
|
|
@@ -109970,7 +110262,7 @@ async function loadGlobalConfigsIntoEnv2(override = false) {
|
|
|
109970
110262
|
if (updated.length > 0) {
|
|
109971
110263
|
refreshSecretScrubberCache();
|
|
109972
110264
|
}
|
|
109973
|
-
const { syncSlackTreeVisibility } = await import("./tree-visibility-
|
|
110265
|
+
const { syncSlackTreeVisibility } = await import("./tree-visibility-y4fqvab5.js");
|
|
109974
110266
|
await syncSlackTreeVisibility();
|
|
109975
110267
|
return updated;
|
|
109976
110268
|
}
|
|
@@ -109978,14 +110270,14 @@ async function reloadGlobalConfigsAndIntegrations2() {
|
|
|
109978
110270
|
return runWithoutRequestAuth(() => runSlackLifecycleExclusive(() => reloadGlobalConfigsAndIntegrationsInner()));
|
|
109979
110271
|
}
|
|
109980
110272
|
async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
109981
|
-
const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-
|
|
110273
|
+
const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-mpj0z9e0.js");
|
|
109982
110274
|
const wasEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
|
|
109983
110275
|
const updated = await loadGlobalConfigsIntoEnv2(true);
|
|
109984
110276
|
await syncTelemetryEnabled("settings").catch((err) => {
|
|
109985
110277
|
console.error("[config-reload] telemetry re-init failed (non-fatal):", err);
|
|
109986
110278
|
});
|
|
109987
110279
|
await stopSlackAppUnderLifecycleLock2();
|
|
109988
|
-
const { resetFileStorageProvider } = await import("./registry-
|
|
110280
|
+
const { resetFileStorageProvider } = await import("./registry-zv0zvxsx.js");
|
|
109989
110281
|
resetFileStorageProvider();
|
|
109990
110282
|
resetEmbeddingProvider();
|
|
109991
110283
|
const isEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
|
|
@@ -109994,7 +110286,7 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
|
109994
110286
|
integrations.push("embeddings");
|
|
109995
110287
|
}
|
|
109996
110288
|
if (isEmbeddingsConfigured) {
|
|
109997
|
-
import("./embedding-space-
|
|
110289
|
+
import("./embedding-space-3n6mhhmy.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: !wasEmbeddingsConfigured })).catch((err) => {
|
|
109998
110290
|
console.error("[config-reload] embedding maintenance failed (non-fatal):", err);
|
|
109999
110291
|
});
|
|
110000
110292
|
}
|
|
@@ -110566,6 +110858,18 @@ var init_accept_steer = __esm(() => {
|
|
|
110566
110858
|
});
|
|
110567
110859
|
});
|
|
110568
110860
|
|
|
110861
|
+
// src/be/db/kv-windows.ts
|
|
110862
|
+
async function kvKeyAfter(namespace, prefixUpper, afterKey, offset) {
|
|
110863
|
+
const row = await getDbClient2().get(`SELECT key FROM kv_entries
|
|
110864
|
+
WHERE namespace = ? AND key > ? AND key < ?
|
|
110865
|
+
ORDER BY key
|
|
110866
|
+
LIMIT 1 OFFSET ?`, [namespace, afterKey, prefixUpper, offset]);
|
|
110867
|
+
return row?.key ?? null;
|
|
110868
|
+
}
|
|
110869
|
+
var init_kv_windows = __esm(() => {
|
|
110870
|
+
init_runtime2();
|
|
110871
|
+
});
|
|
110872
|
+
|
|
110569
110873
|
// src/apps/row-store.ts
|
|
110570
110874
|
function yieldToEventLoop() {
|
|
110571
110875
|
return new Promise((resolve) => setImmediate(resolve));
|
|
@@ -110769,13 +111073,34 @@ async function getAppRow(appId, model, rowId) {
|
|
|
110769
111073
|
return entry.value;
|
|
110770
111074
|
}
|
|
110771
111075
|
async function listAppRows(appId, model, equals = []) {
|
|
110772
|
-
const
|
|
110773
|
-
|
|
110774
|
-
|
|
110775
|
-
|
|
110776
|
-
|
|
110777
|
-
|
|
110778
|
-
|
|
111076
|
+
const namespace = appsNamespace(appId);
|
|
111077
|
+
const prefix = `${model}/row/`;
|
|
111078
|
+
const upper = kvPrefixUpperBound2(prefix);
|
|
111079
|
+
const jsonFieldEquals = equals.filter((filter) => !/["\\]/.test(filter.column)).map((filter) => ({ field: filter.column, value: filter.value }));
|
|
111080
|
+
const rows = [];
|
|
111081
|
+
let afterKey = prefix;
|
|
111082
|
+
while (rows.length < LIST_ROW_CAP) {
|
|
111083
|
+
const through = await kvKeyAfter(namespace, upper, afterKey, LIST_SCAN_WINDOW - 1);
|
|
111084
|
+
const entries = await listKv2(namespace, {
|
|
111085
|
+
prefix,
|
|
111086
|
+
limit: LIST_ROW_CAP - rows.length,
|
|
111087
|
+
offset: 0,
|
|
111088
|
+
jsonFieldEquals,
|
|
111089
|
+
keyAfter: afterKey,
|
|
111090
|
+
keyThrough: through ?? undefined
|
|
111091
|
+
});
|
|
111092
|
+
for (const { value } of entries) {
|
|
111093
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
111094
|
+
rows.push(value);
|
|
111095
|
+
}
|
|
111096
|
+
}
|
|
111097
|
+
if (through === null)
|
|
111098
|
+
break;
|
|
111099
|
+
afterKey = through;
|
|
111100
|
+
if (!isInTransaction())
|
|
111101
|
+
await yieldToEventLoop();
|
|
111102
|
+
}
|
|
111103
|
+
return rows;
|
|
110779
111104
|
}
|
|
110780
111105
|
async function listAllAppRowsForMigrationUnlocked(appId, model) {
|
|
110781
111106
|
const rows = [];
|
|
@@ -110928,9 +111253,10 @@ function purgeAppRows(appId, models, afterPurge) {
|
|
|
110928
111253
|
};
|
|
110929
111254
|
return acquire(0);
|
|
110930
111255
|
}
|
|
110931
|
-
var AppRowValidationError, AppRowAppNotFoundError, mutationChains, lastCreatedAtMs = 0, MIGRATION_KV_BATCH_SIZE = 1000, PURGE_BATCH_SIZE = 1000;
|
|
111256
|
+
var AppRowValidationError, AppRowAppNotFoundError, mutationChains, lastCreatedAtMs = 0, LIST_SCAN_WINDOW = 2000, LIST_ROW_CAP = 1e5, MIGRATION_KV_BATCH_SIZE = 1000, PURGE_BATCH_SIZE = 1000;
|
|
110932
111257
|
var init_row_store = __esm(() => {
|
|
110933
111258
|
init_db4();
|
|
111259
|
+
init_kv_windows();
|
|
110934
111260
|
init_db_client();
|
|
110935
111261
|
init_definition();
|
|
110936
111262
|
init_format_upgrades();
|
|
@@ -112904,7 +113230,7 @@ var init_request_principal = __esm(() => {
|
|
|
112904
113230
|
|
|
112905
113231
|
// src/http/task-requester.ts
|
|
112906
113232
|
async function resolveTaskRequester(req, myAgentId, bodyUserId, trustedUserId) {
|
|
112907
|
-
const trusted = trustedUserId === undefined ? await
|
|
113233
|
+
const trusted = trustedUserId === undefined ? await resolveHttpRequesterUserId(req, myAgentId) : trustedUserId;
|
|
112908
113234
|
if (trusted)
|
|
112909
113235
|
return trusted;
|
|
112910
113236
|
if (process.env.TRUST_BODY_REQUESTED_BY_USER_ID === "false" || !bodyUserId)
|
|
@@ -116653,7 +116979,7 @@ var ref = (input) => {
|
|
|
116653
116979
|
throw new ObjectsError("pass `id` or `path`");
|
|
116654
116980
|
return { agentId: input.agentId, id: input.id, path: input.path, kind: "board" };
|
|
116655
116981
|
};
|
|
116656
|
-
var
|
|
116982
|
+
var init_service2 = __esm(() => {
|
|
116657
116983
|
init_objects();
|
|
116658
116984
|
init_write_object();
|
|
116659
116985
|
init_elements();
|
|
@@ -116753,8 +117079,12 @@ var objectOutputSchema, KindSchema, summary = (o) => `${o.kind} ${o.id} at ${o.p
|
|
|
116753
117079
|
createToolRegistrar(server)("object-reindex", {
|
|
116754
117080
|
title: "Reindex primitive objects",
|
|
116755
117081
|
annotations: { readOnlyHint: false, idempotentHint: true },
|
|
116756
|
-
description: "Rebuild the object index from the files on your default agent-fs drive. Keeps each file's embedded id; a file with no id (for example a stock Excalidraw save) keeps the id of the row at its path, else gets a new one written back. Rows whose file is gone are reported as `missing`, never deleted. Files whose version matches the index are checked, not re-read (`unchanged`); one call reads at most 50 changed files, 16 MiB, or 20 seconds of work, so run it again while `truncated` is true (`cutBy` names the limit). agent-fs file.changed webhooks keep the index current between runs when the swarm can register them.",
|
|
116757
|
-
inputSchema: object2({
|
|
117082
|
+
description: "Rebuild the object index from the files on your default agent-fs drive. Keeps each file's embedded id; a file with no id (for example a stock Excalidraw save) keeps the id of the row at its path, else gets a new one written back. Rows whose file is gone are reported as `missing`, never deleted. Without `prefix` it touches every id-less file of the kind on the drive, including files other people put there: pass `prefix` (same path-prefix match as object-list; end it with `/` for one folder, or give one file's path) to limit it, and `dryRun: true` to get the same report with nothing written. Files whose version matches the index are checked, not re-read (`unchanged`); one call reads at most 50 changed files, 16 MiB, or 20 seconds of work, so run it again while `truncated` is true (`cutBy` names the limit). agent-fs file.changed webhooks keep the index current between runs when the swarm can register them.",
|
|
117083
|
+
inputSchema: object2({
|
|
117084
|
+
kind: KindSchema.optional(),
|
|
117085
|
+
prefix: string2().optional(),
|
|
117086
|
+
dryRun: boolean().optional()
|
|
117087
|
+
}),
|
|
116758
117088
|
outputSchema: swarmToolOutputSchema({
|
|
116759
117089
|
yourAgentId: string2().optional(),
|
|
116760
117090
|
scanned: number2().optional(),
|
|
@@ -116764,14 +117094,15 @@ var objectOutputSchema, KindSchema, summary = (o) => `${o.kind} ${o.id} at ${o.p
|
|
|
116764
117094
|
missing: array2(string2()).optional(),
|
|
116765
117095
|
conflicts: array2(looseObject({ path: string2(), reason: string2() })).optional(),
|
|
116766
117096
|
truncated: boolean().optional(),
|
|
116767
|
-
cutBy: _enum2(["files", "reads", "time", "bytes"]).nullable().optional()
|
|
117097
|
+
cutBy: _enum2(["files", "reads", "time", "bytes"]).nullable().optional(),
|
|
117098
|
+
dryRun: boolean().optional()
|
|
116768
117099
|
})
|
|
116769
|
-
}, async ({ kind }, requestInfo) => {
|
|
116770
|
-
const result = await refusing(requestInfo.agentId, () => reindexObjects({ agentId: requestInfo.agentId, kind }));
|
|
117100
|
+
}, async ({ kind, prefix, dryRun }, requestInfo) => {
|
|
117101
|
+
const result = await refusing(requestInfo.agentId, () => reindexObjects({ agentId: requestInfo.agentId, kind, prefix, dryRun }));
|
|
116771
117102
|
if ("error" in result)
|
|
116772
117103
|
return result.error;
|
|
116773
117104
|
const report = result.value;
|
|
116774
|
-
return toolOk(
|
|
117105
|
+
return toolOk(`${report.dryRun ? "Dry run, nothing written. " : ""}Scanned ${report.scanned} files: ${report.unchanged} unchanged, ${report.adopted.length} adopted, ${report.restored.length} restored, ${report.missing.length} missing, ${report.conflicts.length} skipped${report.truncated ? ` (truncated: ${report.cutBy} limit)` : ""}.`, { data: { yourAgentId: requestInfo.agentId, ...report } });
|
|
116775
117106
|
});
|
|
116776
117107
|
};
|
|
116777
117108
|
var init_objects2 = __esm(() => {
|
|
@@ -116939,7 +117270,7 @@ var Coord, Size, Color, ShapeSchema, ArrowSchema, Shapes, Arrows, LayoutSchema,
|
|
|
116939
117270
|
var init_boards = __esm(() => {
|
|
116940
117271
|
init_zod();
|
|
116941
117272
|
init_elements();
|
|
116942
|
-
|
|
117273
|
+
init_service2();
|
|
116943
117274
|
init_objects2();
|
|
116944
117275
|
init_utils();
|
|
116945
117276
|
Coord = number2().min(-1e6).max(1e6);
|
|
@@ -122822,6 +123153,45 @@ var init_terminal_result_guard = __esm(() => {
|
|
|
122822
123153
|
});
|
|
122823
123154
|
|
|
122824
123155
|
// src/tools/defer-task.ts
|
|
123156
|
+
async function admitExternalWait(event, source, rawMatch) {
|
|
123157
|
+
const adapter = getExternalEventAdapter(source);
|
|
123158
|
+
if (!adapter?.events.includes(event)) {
|
|
123159
|
+
const served = EXTERNAL_EVENT_ADAPTERS.filter((a) => a.events.includes(event)).map((a) => a.source);
|
|
123160
|
+
return {
|
|
123161
|
+
error: `Source "${source}" does not serve ${event}; use one of: ${served.join(", ")}.`
|
|
123162
|
+
};
|
|
123163
|
+
}
|
|
123164
|
+
let match;
|
|
123165
|
+
try {
|
|
123166
|
+
match = adapter.parseMatch(event, rawMatch);
|
|
123167
|
+
} catch (error) {
|
|
123168
|
+
return { error: error instanceof Error ? error.message : "Invalid match." };
|
|
123169
|
+
}
|
|
123170
|
+
const target = describeEventWait(source, event, match);
|
|
123171
|
+
const auth = getCurrentRequestAuth();
|
|
123172
|
+
if (adapter.readsWithServerCredentials && auth?.kind === "agent" && auth.tokenKind === "task") {
|
|
123173
|
+
return {
|
|
123174
|
+
error: "A task-scoped token cannot defer on an external event; defer on a timer instead."
|
|
123175
|
+
};
|
|
123176
|
+
}
|
|
123177
|
+
if (!adapter.isEnabled()) {
|
|
123178
|
+
return {
|
|
123179
|
+
error: `The ${source} integration is off, so no event can wake you; defer on a timer instead.`
|
|
123180
|
+
};
|
|
123181
|
+
}
|
|
123182
|
+
if (adapter.confirm) {
|
|
123183
|
+
try {
|
|
123184
|
+
if (await adapter.confirm(event, match)) {
|
|
123185
|
+
return { error: `${target} already happened; read its result instead of deferring.` };
|
|
123186
|
+
}
|
|
123187
|
+
} catch (error) {
|
|
123188
|
+
return {
|
|
123189
|
+
error: `Could not read ${target} from ${source} (${error instanceof Error ? error.message : "unknown error"}); defer on a timer instead.`
|
|
123190
|
+
};
|
|
123191
|
+
}
|
|
123192
|
+
}
|
|
123193
|
+
return { adapter, match };
|
|
123194
|
+
}
|
|
122825
123195
|
function renderChecks(checks) {
|
|
122826
123196
|
if (!checks || checks.length === 0)
|
|
122827
123197
|
return "";
|
|
@@ -122900,25 +123270,27 @@ function renderHumanFacingDeferral(nextRunAt, tz, isFallbackTz, waitingOn) {
|
|
|
122900
123270
|
const when = renderWhen(nextRunAt, tz, isFallbackTz);
|
|
122901
123271
|
return waitingOn ? `Waiting on ${waitingOn} — or ${when} at the latest` : `Checking back ${when}`;
|
|
122902
123272
|
}
|
|
122903
|
-
var DeferAbortedError, registerDeferTaskTool = (server) => {
|
|
123273
|
+
var isExternalEvent = (event) => EXTERNAL_EVENT_NAMES.includes(event), DeferAbortedError, registerDeferTaskTool = (server) => {
|
|
122904
123274
|
createToolRegistrar(server)("defer-task", {
|
|
122905
123275
|
title: "Defer Task",
|
|
122906
123276
|
annotations: { destructiveHint: false, idempotentHint: false },
|
|
122907
|
-
description:
|
|
123277
|
+
description: 'Completes this task now with status `completed` and books a wake-up for you. Use when the result needs time: a build, a deploy, a reply. The task reaches its final state on this call; the lead sees your summary as its output unless the task has an outputSchema. For a task with an outputSchema, provide output as a JSON string matching that schema; it is stored verbatim as terminal output, while deferral details remain visible in the task log. A one-off schedule wakes you up later with a child task that carries this task as its parent. Optionally provide wakeOn with taskId or taskIds to wake early on task outcomes; mode defaults to all, or use any for the first match. Or provide wakeOn {event, source, match} to wake on an external event, e.g. {event: "vcs.pr.merged", source: "github", match: {repo, number}}. delayMs or runAt remains required as the ceiling for the whole set. Provide delayMs or runAt, a summary of what you did, and a note that says what is pending and what to check.',
|
|
122908
123278
|
inputSchema: object2({
|
|
122909
123279
|
taskId: string2().describe("The ID of the task you are working on."),
|
|
122910
123280
|
delayMs: number2().int().positive().optional().describe("Wake up after this many milliseconds (e.g. 1800000 for 30 min)."),
|
|
122911
123281
|
runAt: string2().datetime().optional().describe("Wake up at this ISO datetime (e.g. '2026-03-06T15:00:00Z'). Must be future."),
|
|
122912
123282
|
wakeOn: object2({
|
|
122913
|
-
event: _enum2(["task.completed", "task.failed", "settled"]),
|
|
123283
|
+
event: _enum2(["task.completed", "task.failed", "settled", ...EXTERNAL_EVENT_NAMES]),
|
|
122914
123284
|
taskId: string2().min(1).optional(),
|
|
122915
123285
|
taskIds: array2(string2().min(1)).min(1).optional(),
|
|
122916
|
-
mode: _enum2(["all", "any"]).optional()
|
|
122917
|
-
|
|
122918
|
-
|
|
123286
|
+
mode: _enum2(["all", "any"]).optional(),
|
|
123287
|
+
source: string2().min(1).optional(),
|
|
123288
|
+
match: record2(string2(), union3([string2(), number2()])).optional()
|
|
123289
|
+
}).strict().refine((wake) => isExternalEvent(wake.event) || wake.taskId !== undefined !== (wake.taskIds !== undefined), { message: "Provide exactly one of wakeOn.taskId or wakeOn.taskIds." }).refine((wake) => isExternalEvent(wake.event) ? wake.source !== undefined && wake.match !== undefined && wake.taskId === undefined && wake.taskIds === undefined && wake.mode === undefined : wake.source === undefined && wake.match === undefined, {
|
|
123290
|
+
message: "External events (e.g. vcs.pr.merged) take source and match only; task events take no source or match."
|
|
122919
123291
|
}).refine((wake) => !wake.taskIds || new Set(wake.taskIds).size === wake.taskIds.length, {
|
|
122920
123292
|
message: "wakeOn.taskIds must not contain duplicates."
|
|
122921
|
-
}).optional().describe(
|
|
123293
|
+
}).optional().describe(`Wake early on a task event. Provide taskId or nonempty, unique taskIds. mode defaults to all (every member must match); any wakes on the first match. settled covers completed, failed, cancelled, or skipped. Deferred and superseded members follow their continuations; a superseded member without a resume child holds to the ceiling, except a workflow step superseded by its queued retry, which counts as failed. Any already-terminal member rejects the request; one delayMs/runAt ceiling is still required for the whole set. External events: ${EXTERNAL_EVENTS_DOC}. They are rejected when the event already happened, the provider cannot be read, or its integration is off; an agent holds at most ${MAX_PENDING_EVENT_WAITS_PER_AGENT} pending external waits. The member whose settlement wakes you creates no separate lead follow-up for your agent unless its followUpConfig sets onCompleted/onFailed; an all-mode member that settles while others are pending still does.`),
|
|
122922
123294
|
summary: string2().min(1).max(4000).describe("What you did so far and where things stand. Stored in the task log for tasks with an outputSchema; otherwise becomes the task's output."),
|
|
122923
123295
|
output: string2().optional().describe("Required when the task has an outputSchema: a JSON string matching that schema, stored verbatim as terminal output. Ignored for tasks without an outputSchema."),
|
|
122924
123296
|
note: string2().min(1).max(2000).describe("What is pending, and what to check on wake-up."),
|
|
@@ -122966,7 +123338,8 @@ var DeferAbortedError, registerDeferTaskTool = (server) => {
|
|
|
122966
123338
|
const nextRunAt = delayMs ? new Date(Date.now() + delayMs).toISOString() : runAt;
|
|
122967
123339
|
const watchedTaskIds = wakeOn?.taskIds ?? (wakeOn?.taskId ? [wakeOn.taskId] : []);
|
|
122968
123340
|
const wakeMode = wakeOn?.mode ?? "all";
|
|
122969
|
-
const
|
|
123341
|
+
const eventWait = wakeOn && isExternalEvent(wakeOn.event) ? wakeOn : undefined;
|
|
123342
|
+
const wakeDescription = eventWait ? `on ${eventWait.event} from ${eventWait.source}, or by ${nextRunAt}` : wakeOn ? `on ${wakeOn.event} for ${wakeMode} of tasks ${watchedTaskIds.join(", ")}, or by ${nextRunAt}` : `at ${nextRunAt}`;
|
|
122970
123343
|
const checksBlock = renderChecks(checks);
|
|
122971
123344
|
const taskTemplate = `Resume task ${taskId}: ${note}${checksBlock}`;
|
|
122972
123345
|
const createdBy = await resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId) ?? undefined;
|
|
@@ -122979,8 +123352,23 @@ var DeferAbortedError, registerDeferTaskTool = (server) => {
|
|
|
122979
123352
|
return toolErr(outputValidationError);
|
|
122980
123353
|
}
|
|
122981
123354
|
const { tz: requesterTz, isFallback: isFallbackTz } = await resolveRequesterTimezone(task.requestedByUserId);
|
|
123355
|
+
let admitted;
|
|
123356
|
+
if (eventWait) {
|
|
123357
|
+
const result = await admitExternalWait(eventWait.event, eventWait.source, eventWait.match);
|
|
123358
|
+
if ("error" in result)
|
|
123359
|
+
return toolErr(result.error);
|
|
123360
|
+
admitted = result;
|
|
123361
|
+
}
|
|
122982
123362
|
try {
|
|
122983
123363
|
const committed = await getDbClient2().transaction(async () => {
|
|
123364
|
+
if (admitted) {
|
|
123365
|
+
const pending = await getDbClient2().get(`SELECT COUNT(*) AS n FROM deferred_event_waits w
|
|
123366
|
+
JOIN scheduled_tasks s ON s.id = w.scheduleId
|
|
123367
|
+
WHERE w.status = 'pending' AND s.enabled = 1 AND s.targetAgentId = ?`, [agent.id]);
|
|
123368
|
+
if ((pending?.n ?? 0) >= MAX_PENDING_EVENT_WAITS_PER_AGENT) {
|
|
123369
|
+
throw new DeferAbortedError(`You already hold ${MAX_PENDING_EVENT_WAITS_PER_AGENT} pending external event waits; wait for one to fire.`);
|
|
123370
|
+
}
|
|
123371
|
+
}
|
|
122984
123372
|
if (watchedTaskIds.length) {
|
|
122985
123373
|
const existing = await getDbClient2().get(`SELECT w.scheduleId, s.parentTaskId FROM deferred_task_waits w
|
|
122986
123374
|
JOIN scheduled_tasks s ON s.id = w.scheduleId
|
|
@@ -123023,7 +123411,27 @@ var DeferAbortedError, registerDeferTaskTool = (server) => {
|
|
|
123023
123411
|
parentTaskId: taskId,
|
|
123024
123412
|
createdBy
|
|
123025
123413
|
});
|
|
123026
|
-
if (
|
|
123414
|
+
if (admitted && eventWait) {
|
|
123415
|
+
const matchKey = matchKeyOf(admitted.match);
|
|
123416
|
+
await getDbClient2().run("INSERT INTO deferred_event_waits (scheduleId, source, event, matchKey, matchJson, created_by, updated_by) VALUES (?, ?, ?, ?, ?, ?, ?)", [
|
|
123417
|
+
schedule.id,
|
|
123418
|
+
admitted.adapter.source,
|
|
123419
|
+
eventWait.event,
|
|
123420
|
+
matchKey,
|
|
123421
|
+
JSON.stringify(admitted.match),
|
|
123422
|
+
createdBy ?? null,
|
|
123423
|
+
createdBy ?? null
|
|
123424
|
+
]);
|
|
123425
|
+
getDbClient2().afterCommit(() => {
|
|
123426
|
+
reconcileDeferredEventWaits({
|
|
123427
|
+
source: admitted.adapter.source,
|
|
123428
|
+
event: eventWait.event,
|
|
123429
|
+
matchKey
|
|
123430
|
+
}).catch((err) => {
|
|
123431
|
+
console.error("[defer-task] external event wake reconciliation failed:", err);
|
|
123432
|
+
});
|
|
123433
|
+
});
|
|
123434
|
+
} else if (wakeOn) {
|
|
123027
123435
|
await getDbClient2().run("INSERT INTO deferred_task_waits (scheduleId, eventName, mode, created_by, updated_by) VALUES (?, ?, ?, ?, ?)", [schedule.id, wakeOn.event, wakeMode, createdBy ?? null, createdBy ?? null]);
|
|
123028
123436
|
for (const watchedId of watchedTaskIds) {
|
|
123029
123437
|
await getDbClient2().run("INSERT INTO deferred_task_wait_members (scheduleId, taskId, created_by, updated_by) VALUES (?, ?, ?, ?)", [schedule.id, watchedId, createdBy ?? null, createdBy ?? null]);
|
|
@@ -123037,7 +123445,7 @@ var DeferAbortedError, registerDeferTaskTool = (server) => {
|
|
|
123037
123445
|
const deferralDetails = `${summary}
|
|
123038
123446
|
|
|
123039
123447
|
Deferred until ${nextRunAt} (schedule ${schedule.id}). Pending: ${note}${checksBlock}`;
|
|
123040
|
-
const terminalOutput = task.outputSchema ? output : renderHumanFacingDeferral(nextRunAt, requesterTz, isFallbackTz, wakeOn ? renderWaitingOn(watchedAgentNames, watchedTaskIds.length) : undefined);
|
|
123448
|
+
const terminalOutput = task.outputSchema ? output : renderHumanFacingDeferral(nextRunAt, requesterTz, isFallbackTz, admitted && eventWait ? describeEventWait(admitted.adapter.source, eventWait.event, admitted.match) : wakeOn ? renderWaitingOn(watchedAgentNames, watchedTaskIds.length) : undefined);
|
|
123041
123449
|
const completed = await completeTask2(taskId, terminalOutput, {
|
|
123042
123450
|
addTags: ["deferred"],
|
|
123043
123451
|
deferredAt: new Date().toISOString()
|
|
@@ -123099,6 +123507,7 @@ var init_defer_task = __esm(() => {
|
|
|
123099
123507
|
init_zod();
|
|
123100
123508
|
init_audit_user();
|
|
123101
123509
|
init_db4();
|
|
123510
|
+
init_event_waits();
|
|
123102
123511
|
init_deferred_task_waits();
|
|
123103
123512
|
init_task_terminal_effects();
|
|
123104
123513
|
init_terminal_result_guard();
|
|
@@ -123106,6 +123515,7 @@ var init_defer_task = __esm(() => {
|
|
|
123106
123515
|
init_utils();
|
|
123107
123516
|
init_types5();
|
|
123108
123517
|
init_business_use();
|
|
123518
|
+
init_request_auth_context();
|
|
123109
123519
|
DeferAbortedError = class DeferAbortedError extends Error {
|
|
123110
123520
|
};
|
|
123111
123521
|
});
|
|
@@ -126066,7 +126476,7 @@ async function attachDemotionEvidence(candidates) {
|
|
|
126066
126476
|
const ids = [...new Set(candidates.filter((c) => c.beta > c.alpha).map((c) => c.id))];
|
|
126067
126477
|
if (ids.length === 0)
|
|
126068
126478
|
return candidates;
|
|
126069
|
-
const rows = await
|
|
126479
|
+
const rows = await memorySearchReader.query(`SELECT memoryId,
|
|
126070
126480
|
SUM(CASE WHEN source = 'explicit-self' AND signal > 0 THEN signal * weight ELSE 0 END) AS selfAlpha,
|
|
126071
126481
|
SUM(CASE WHEN source = 'explicit-self' AND signal < 0 THEN -signal * weight ELSE 0 END) AS selfBeta,
|
|
126072
126482
|
SUM(CASE WHEN source = 'llm' AND signal > 0 THEN signal * weight ELSE 0 END) AS llmAlpha,
|
|
@@ -126084,7 +126494,7 @@ async function attachDemotionEvidence(candidates) {
|
|
|
126084
126494
|
});
|
|
126085
126495
|
}
|
|
126086
126496
|
var init_demotion_evidence = __esm(() => {
|
|
126087
|
-
|
|
126497
|
+
init_search_reader();
|
|
126088
126498
|
});
|
|
126089
126499
|
|
|
126090
126500
|
// src/be/memory/graph-expansion.ts
|
|
@@ -128159,19 +128569,24 @@ var init_get_repos = __esm(() => {
|
|
|
128159
128569
|
});
|
|
128160
128570
|
|
|
128161
128571
|
// src/be/repo-merge-policy.ts
|
|
128162
|
-
function
|
|
128572
|
+
function canonical(value) {
|
|
128573
|
+
return JSON.stringify(value ?? null, (_key, v) => v && typeof v === "object" && !Array.isArray(v) ? Object.fromEntries(Object.entries(v).sort(([a], [b]) => a < b ? -1 : 1)) : v);
|
|
128574
|
+
}
|
|
128575
|
+
function changesMergePolicy(current, incoming) {
|
|
128163
128576
|
if (incoming === undefined)
|
|
128164
128577
|
return false;
|
|
128165
|
-
return
|
|
128578
|
+
return current?.allowMerge === true !== (incoming?.allowMerge === true) || agentsMayMerge(current) !== agentsMayMerge(incoming) || canonical(current?.mergePolicy) !== canonical(incoming?.mergePolicy);
|
|
128166
128579
|
}
|
|
128167
|
-
var init_repo_merge_policy = () => {
|
|
128580
|
+
var init_repo_merge_policy = __esm(() => {
|
|
128581
|
+
init_types5();
|
|
128582
|
+
});
|
|
128168
128583
|
|
|
128169
128584
|
// src/be/repo-checked-update.ts
|
|
128170
128585
|
async function updateSwarmRepoChecked(id, updates, authorize) {
|
|
128171
128586
|
return await getDbClient2().transaction(async () => {
|
|
128172
128587
|
if (updates.guidelines !== undefined) {
|
|
128173
128588
|
const existing = await getSwarmRepoById2(id);
|
|
128174
|
-
if (existing &&
|
|
128589
|
+
if (existing && changesMergePolicy(existing.guidelines, updates.guidelines)) {
|
|
128175
128590
|
const refusal = await authorize(existing);
|
|
128176
128591
|
if (refusal !== null)
|
|
128177
128592
|
return { kind: "refused", refusal };
|
|
@@ -128190,7 +128605,7 @@ var init_repo_checked_update = __esm(() => {
|
|
|
128190
128605
|
var swarmRepoOutputShape2, registerUpdateRepoTool = (server) => {
|
|
128191
128606
|
createToolRegistrar(server)("update-repo", {
|
|
128192
128607
|
title: "Update Repo",
|
|
128193
|
-
description: "Update a repo's configuration including guidelines (PR checks, merge policy, review guidance). The lead uses this to set guidelines after asking the user. Pass null for guidelines to clear them. Only the lead can change allowMerge: resend
|
|
128608
|
+
description: "Update a repo's configuration including guidelines (PR checks, merge policy, review guidance). The lead uses this to set guidelines after asking the user. Pass null for guidelines to clear them. Only the lead can change allowMerge or mergePolicy: resend their current values to edit other guidelines.",
|
|
128194
128609
|
annotations: { readOnlyHint: false },
|
|
128195
128610
|
inputSchema: object2({
|
|
128196
128611
|
id: string2().uuid().describe("The repo ID to update."),
|
|
@@ -128200,7 +128615,7 @@ var swarmRepoOutputShape2, registerUpdateRepoTool = (server) => {
|
|
|
128200
128615
|
defaultBranch: string2().optional().describe("New default branch."),
|
|
128201
128616
|
autoClone: boolean().optional().describe("Whether to auto-clone."),
|
|
128202
128617
|
hooks: RepoHooksSchema.nullable().optional().describe("Repository hook install config. Best-effort worker hook installation is enabled by default for new repos. Disable it with { enabled: false } (or null), or turn it back on with { enabled: true }."),
|
|
128203
|
-
guidelines: RepoGuidelinesInputSchema.nullable().optional().describe("Repository guidelines: prChecks (commands before PR), mergeChecks (conditions before merge), allowMerge (default false), review (guidance for reviewers). Pass null to clear.")
|
|
128618
|
+
guidelines: RepoGuidelinesInputSchema.nullable().optional().describe("Repository guidelines: prChecks (commands before PR), mergeChecks (conditions before merge), allowMerge (default false), review (guidance for reviewers), mergePolicy (per-repo merge policy record: autoMerge, agentsMayMerge, notify). Pass null to clear.")
|
|
128204
128619
|
}),
|
|
128205
128620
|
outputSchema: swarmToolOutputSchema({
|
|
128206
128621
|
repo: swarmRepoOutputShape2.nullable().optional()
|
|
@@ -128216,8 +128631,8 @@ var swarmRepoOutputShape2, registerUpdateRepoTool = (server) => {
|
|
|
128216
128631
|
});
|
|
128217
128632
|
if (decision.allow)
|
|
128218
128633
|
return null;
|
|
128219
|
-
const current = existing.guidelines
|
|
128220
|
-
return `Only lead agents can change allowMerge (
|
|
128634
|
+
const current = agentsMayMerge(existing.guidelines);
|
|
128635
|
+
return `Only lead agents can change allowMerge or mergePolicy (agents may merge: ${current}). Resend the current allowMerge and mergePolicy to keep them while you edit the other guidelines.`;
|
|
128221
128636
|
});
|
|
128222
128637
|
if (result.kind === "refused") {
|
|
128223
128638
|
return toolErr(result.refusal, { data: { repo: null } });
|
|
@@ -135850,6 +136265,9 @@ var init_list_schedules = __esm(() => {
|
|
|
135850
136265
|
lastRunAt: string2().optional(),
|
|
135851
136266
|
nextRunAt: string2().optional(),
|
|
135852
136267
|
createdByAgentId: string2().optional(),
|
|
136268
|
+
updatedByAgentId: string2().optional(),
|
|
136269
|
+
createdBy: string2().optional(),
|
|
136270
|
+
updatedBy: string2().optional(),
|
|
135853
136271
|
parentTaskId: string2().optional(),
|
|
135854
136272
|
timezone: string2().optional(),
|
|
135855
136273
|
consecutiveErrors: number2().optional(),
|
|
@@ -136074,10 +136492,15 @@ var import_cron_parser3, patchScheduleInputSchema, scheduleDataShape2, registerP
|
|
|
136074
136492
|
updateData.nextRunAt = null;
|
|
136075
136493
|
}
|
|
136076
136494
|
}
|
|
136077
|
-
const updatedBy = await resolveTaskAuditUserId(requestInfo.
|
|
136078
|
-
if (key !== undefined)
|
|
136079
|
-
updateData.key = await authorizeAssetKeyWrite(key,
|
|
136080
|
-
|
|
136495
|
+
const updatedBy = await resolveTaskAuditUserId(requestInfo.auditSourceTaskId, requestInfo.agentId) ?? undefined;
|
|
136496
|
+
if (key !== undefined) {
|
|
136497
|
+
updateData.key = await authorizeAssetKeyWrite(key, await resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId));
|
|
136498
|
+
}
|
|
136499
|
+
const updated = await updateScheduledTask2(schedule.id, {
|
|
136500
|
+
...updateData,
|
|
136501
|
+
updatedBy: updatedBy ?? null,
|
|
136502
|
+
updatedByAgentId: requestInfo.agentId ?? null
|
|
136503
|
+
});
|
|
136081
136504
|
if (!updated) {
|
|
136082
136505
|
return toolErr("Failed to update schedule.");
|
|
136083
136506
|
}
|
|
@@ -136432,10 +136855,15 @@ var import_cron_parser4, updateScheduleInputSchema, scheduleDataShape3, register
|
|
|
136432
136855
|
updateData.nextRunAt = null;
|
|
136433
136856
|
}
|
|
136434
136857
|
}
|
|
136435
|
-
const updatedBy = await resolveTaskAuditUserId(requestInfo.
|
|
136436
|
-
if (key !== undefined)
|
|
136437
|
-
updateData.key = await authorizeAssetKeyWrite(key,
|
|
136438
|
-
|
|
136858
|
+
const updatedBy = await resolveTaskAuditUserId(requestInfo.auditSourceTaskId, requestInfo.agentId) ?? undefined;
|
|
136859
|
+
if (key !== undefined) {
|
|
136860
|
+
updateData.key = await authorizeAssetKeyWrite(key, await resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId));
|
|
136861
|
+
}
|
|
136862
|
+
const updated = await updateScheduledTask2(schedule.id, {
|
|
136863
|
+
...updateData,
|
|
136864
|
+
updatedBy: updatedBy ?? null,
|
|
136865
|
+
updatedByAgentId: requestInfo.agentId ?? null
|
|
136866
|
+
});
|
|
136439
136867
|
if (!updated) {
|
|
136440
136868
|
return toolErr("Failed to update schedule.");
|
|
136441
136869
|
}
|
|
@@ -138088,7 +138516,321 @@ var init_engine2 = __esm(() => {
|
|
|
138088
138516
|
ARRAY_SIZE = /\b(?:SEQUENCE|RANDARRAY|MAKEARRAY)\(\s*(\d+(?:\.\d+)?)\s*(?:,\s*(\d+(?:\.\d+)?)\s*[,)])?/gi;
|
|
138089
138517
|
});
|
|
138090
138518
|
|
|
138519
|
+
// src/be/primitives/sheets/xlsx.ts
|
|
138520
|
+
import { inflateRawSync } from "node:zlib";
|
|
138521
|
+
function hasZip64Extra(view, from, length) {
|
|
138522
|
+
for (let at = from;at + 4 <= from + length; ) {
|
|
138523
|
+
if (view.getUint16(at, true) === 1)
|
|
138524
|
+
return true;
|
|
138525
|
+
at += 4 + view.getUint16(at + 2, true);
|
|
138526
|
+
}
|
|
138527
|
+
return false;
|
|
138528
|
+
}
|
|
138529
|
+
function checkedZipParts(bytes) {
|
|
138530
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
138531
|
+
const names = new Set;
|
|
138532
|
+
try {
|
|
138533
|
+
let eocd = bytes.length - 4;
|
|
138534
|
+
while (eocd >= 0 && view.getUint32(eocd, true) !== 101010256)
|
|
138535
|
+
eocd--;
|
|
138536
|
+
if (eocd < 0)
|
|
138537
|
+
throw notXlsx("not a zip archive (no end-of-directory record)");
|
|
138538
|
+
const count = view.getUint16(eocd + 8, true);
|
|
138539
|
+
const dirSize = view.getUint32(eocd + 12, true);
|
|
138540
|
+
const dirStart = view.getUint32(eocd + 16, true);
|
|
138541
|
+
if (view.getUint16(eocd + 4, true) !== 0 || view.getUint16(eocd + 6, true) !== 0 || count !== view.getUint16(eocd + 10, true) || count === 65535 || dirSize === 4294967295 || dirStart === 4294967295) {
|
|
138542
|
+
throw refuse("the zip end record has split-disk, inconsistent or ZIP64 counts");
|
|
138543
|
+
}
|
|
138544
|
+
if (dirStart + dirSize !== eocd)
|
|
138545
|
+
throw refuse("the zip directory does not end at the end record");
|
|
138546
|
+
let at = dirStart;
|
|
138547
|
+
let inflated = 0;
|
|
138548
|
+
for (let n = 0;n < count; n++) {
|
|
138549
|
+
if (view.getUint32(at, true) !== 33639248)
|
|
138550
|
+
throw notXlsx("broken zip directory");
|
|
138551
|
+
const method = view.getUint16(at + 10, true);
|
|
138552
|
+
const size = view.getUint32(at + 20, true);
|
|
138553
|
+
const fullSize = view.getUint32(at + 24, true);
|
|
138554
|
+
const nameLen = view.getUint16(at + 28, true);
|
|
138555
|
+
const extraLen = view.getUint16(at + 30, true);
|
|
138556
|
+
const next = at + 46 + nameLen + extraLen + view.getUint16(at + 32, true);
|
|
138557
|
+
const local = view.getUint32(at + 42, true);
|
|
138558
|
+
const name = bytes.subarray(at + 46, at + 46 + nameLen);
|
|
138559
|
+
names.add(new TextDecoder().decode(name));
|
|
138560
|
+
inflated += fullSize;
|
|
138561
|
+
if (inflated > MAX_INFLATED_BYTES) {
|
|
138562
|
+
throw new ObjectsError(`the workbook inflates to more than ${MAX_INFLATED_BYTES} bytes (16 MiB); refusing it`);
|
|
138563
|
+
}
|
|
138564
|
+
if (size === 4294967295 || fullSize === 4294967295 || hasZip64Extra(view, at + 46 + nameLen, extraLen)) {
|
|
138565
|
+
throw refuse("a zip part uses ZIP64 sizes");
|
|
138566
|
+
}
|
|
138567
|
+
if (view.getUint32(local, true) !== 67324752)
|
|
138568
|
+
throw notXlsx("broken zip local header");
|
|
138569
|
+
const localNameLen = view.getUint16(local + 26, true);
|
|
138570
|
+
const localExtraLen = view.getUint16(local + 28, true);
|
|
138571
|
+
const sameSize = (value, declared) => value === declared || value === 0;
|
|
138572
|
+
if (view.getUint16(local + 8, true) !== method || !sameSize(view.getUint32(local + 18, true), size) || !sameSize(view.getUint32(local + 22, true), fullSize) || localNameLen !== nameLen || Buffer.compare(bytes.subarray(local + 30, local + 30 + localNameLen), name) !== 0 || hasZip64Extra(view, local + 30 + localNameLen, localExtraLen)) {
|
|
138573
|
+
throw refuse("a zip part's local header disagrees with the directory");
|
|
138574
|
+
}
|
|
138575
|
+
const start = local + 30 + localNameLen + localExtraLen;
|
|
138576
|
+
const data = bytes.subarray(start, start + size);
|
|
138577
|
+
let actual;
|
|
138578
|
+
if (method === 0)
|
|
138579
|
+
actual = data.length;
|
|
138580
|
+
else if (method === 8)
|
|
138581
|
+
actual = inflateRawSync(data, { maxOutputLength: Math.max(fullSize, 1) }).length;
|
|
138582
|
+
else
|
|
138583
|
+
throw notXlsx(`unsupported zip compression method ${method}`);
|
|
138584
|
+
if (actual !== fullSize)
|
|
138585
|
+
throw notXlsx("a zip part does not match its declared size");
|
|
138586
|
+
at = next;
|
|
138587
|
+
}
|
|
138588
|
+
if (at !== eocd)
|
|
138589
|
+
throw refuse("the zip directory has bytes the entry count does not cover");
|
|
138590
|
+
} catch (error) {
|
|
138591
|
+
if (error instanceof ObjectsError)
|
|
138592
|
+
throw error;
|
|
138593
|
+
throw notXlsx(`corrupt zip archive (${error.message})`);
|
|
138594
|
+
}
|
|
138595
|
+
return names;
|
|
138596
|
+
}
|
|
138597
|
+
function hasTagWith(xml, tag, attr) {
|
|
138598
|
+
for (let at = xml.indexOf(tag);at !== -1; at = xml.indexOf(tag, at)) {
|
|
138599
|
+
const end = xml.indexOf(">", at);
|
|
138600
|
+
if (end === -1)
|
|
138601
|
+
return false;
|
|
138602
|
+
if (xml.slice(at, end).includes(attr))
|
|
138603
|
+
return true;
|
|
138604
|
+
at = end + 1;
|
|
138605
|
+
}
|
|
138606
|
+
return false;
|
|
138607
|
+
}
|
|
138608
|
+
function hasBoldFont(styles) {
|
|
138609
|
+
for (let at = styles.indexOf("<font>");at !== -1; at = styles.indexOf("<font>", at)) {
|
|
138610
|
+
const end = styles.indexOf("</font>", at);
|
|
138611
|
+
if (end === -1)
|
|
138612
|
+
return false;
|
|
138613
|
+
if (styles.slice(at, end).includes("<b/>"))
|
|
138614
|
+
return true;
|
|
138615
|
+
at = end + 7;
|
|
138616
|
+
}
|
|
138617
|
+
return false;
|
|
138618
|
+
}
|
|
138619
|
+
function lostFeatures(names, files, definedNames) {
|
|
138620
|
+
const found = new Set;
|
|
138621
|
+
const text = (name) => {
|
|
138622
|
+
const content = files[name]?.content;
|
|
138623
|
+
return typeof content === "string" ? content : content ? new TextDecoder().decode(content) : "";
|
|
138624
|
+
};
|
|
138625
|
+
const has = (prefix) => [...names].some((name) => name.startsWith(prefix));
|
|
138626
|
+
if (has("xl/charts/"))
|
|
138627
|
+
found.add("charts");
|
|
138628
|
+
if (has("xl/media/"))
|
|
138629
|
+
found.add("images");
|
|
138630
|
+
if (has("xl/comments") || has("xl/threadedComments"))
|
|
138631
|
+
found.add("comments");
|
|
138632
|
+
if (has("xl/pivot"))
|
|
138633
|
+
found.add("pivot tables");
|
|
138634
|
+
if (has("xl/tables/"))
|
|
138635
|
+
found.add("Excel tables");
|
|
138636
|
+
if (names.has("xl/vbaProject.bin"))
|
|
138637
|
+
found.add("macros");
|
|
138638
|
+
for (const name of names) {
|
|
138639
|
+
if (!/^xl\/worksheets\/[^/]+\.xml$/.test(name))
|
|
138640
|
+
continue;
|
|
138641
|
+
const xml = text(name);
|
|
138642
|
+
if (xml.includes("<conditionalFormatting"))
|
|
138643
|
+
found.add("conditional formatting");
|
|
138644
|
+
if (xml.includes("<dataValidation"))
|
|
138645
|
+
found.add("data validation");
|
|
138646
|
+
if (xml.includes("<autoFilter"))
|
|
138647
|
+
found.add("autofilter");
|
|
138648
|
+
if (xml.includes("<hyperlink "))
|
|
138649
|
+
found.add("hyperlinks");
|
|
138650
|
+
if (xml.includes("<sheetProtection"))
|
|
138651
|
+
found.add("sheet protection");
|
|
138652
|
+
if (hasTagWith(xml, "<pane ", 'state="frozen"'))
|
|
138653
|
+
found.add("frozen panes");
|
|
138654
|
+
}
|
|
138655
|
+
const styles = text("xl/styles.xml");
|
|
138656
|
+
if (/<patternFill patternType="solid"/.test(styles) || hasBoldFont(styles) || /<(left|right|top|bottom) style="/.test(styles)) {
|
|
138657
|
+
found.add("cell styling (fills, bold, borders)");
|
|
138658
|
+
}
|
|
138659
|
+
if (definedNames)
|
|
138660
|
+
found.add("defined names");
|
|
138661
|
+
return [...found];
|
|
138662
|
+
}
|
|
138663
|
+
async function parseXlsx(bytes) {
|
|
138664
|
+
const names = checkedZipParts(bytes);
|
|
138665
|
+
if (!names.has("xl/workbook.xml"))
|
|
138666
|
+
throw notXlsx("the archive has no xl/workbook.xml");
|
|
138667
|
+
const XLSX = await import("./xlsx-9acfmxr1.js");
|
|
138668
|
+
let wb;
|
|
138669
|
+
try {
|
|
138670
|
+
wb = XLSX.read(bytes, {
|
|
138671
|
+
type: "array",
|
|
138672
|
+
cellFormula: true,
|
|
138673
|
+
cellNF: true,
|
|
138674
|
+
cellStyles: true,
|
|
138675
|
+
xlfn: true,
|
|
138676
|
+
sheetStubs: true,
|
|
138677
|
+
bookFiles: true
|
|
138678
|
+
});
|
|
138679
|
+
} catch (error) {
|
|
138680
|
+
throw notXlsx(error.message);
|
|
138681
|
+
}
|
|
138682
|
+
if (wb.SheetNames.length > MAX_TABS) {
|
|
138683
|
+
throw new ObjectsError(`the workbook has ${wb.SheetNames.length} tabs; the limit is ${MAX_TABS}`);
|
|
138684
|
+
}
|
|
138685
|
+
const dropped = new Set;
|
|
138686
|
+
let cellTotal = 0;
|
|
138687
|
+
const tabs = wb.SheetNames.map((name) => {
|
|
138688
|
+
const ws = wb.Sheets[name];
|
|
138689
|
+
const cells = {};
|
|
138690
|
+
for (const [ref, entry] of Object.entries(ws)) {
|
|
138691
|
+
if (ref.startsWith("!"))
|
|
138692
|
+
continue;
|
|
138693
|
+
const cell = entry;
|
|
138694
|
+
const out = {};
|
|
138695
|
+
if (typeof cell.f === "string" && cell.f !== "") {
|
|
138696
|
+
if (cell.F?.includes(":"))
|
|
138697
|
+
dropped.add("array formulas (kept as values)");
|
|
138698
|
+
else
|
|
138699
|
+
out.f = `=${outsideQuotes(cell.f, (code) => code.replace(XLPREFIX, ""))}`;
|
|
138700
|
+
}
|
|
138701
|
+
if (out.f === undefined) {
|
|
138702
|
+
if (cell.t === "n" || cell.t === "s")
|
|
138703
|
+
out.v = cell.v;
|
|
138704
|
+
else if (cell.t === "b")
|
|
138705
|
+
out.v = !!cell.v;
|
|
138706
|
+
else if (cell.t === "e") {
|
|
138707
|
+
out.v = cell.w ?? "#VALUE!";
|
|
138708
|
+
dropped.add("error constants (kept as text)");
|
|
138709
|
+
}
|
|
138710
|
+
}
|
|
138711
|
+
if (out.f === undefined && out.v === undefined)
|
|
138712
|
+
continue;
|
|
138713
|
+
if (typeof cell.z === "string" && cell.z !== "General")
|
|
138714
|
+
out.nf = cell.z;
|
|
138715
|
+
cells[ref] = out;
|
|
138716
|
+
if (++cellTotal > MAX_CELLS) {
|
|
138717
|
+
throw new ObjectsError(`the workbook has more than ${MAX_CELLS} cells; the limit is ${MAX_CELLS}`);
|
|
138718
|
+
}
|
|
138719
|
+
}
|
|
138720
|
+
const tab = { name, cells };
|
|
138721
|
+
const widths = {};
|
|
138722
|
+
(ws["!cols"] ?? []).forEach((col, i) => {
|
|
138723
|
+
const px = col?.wpx ?? (col?.wch ? Math.round(col.wch * 7 + 5) : 0);
|
|
138724
|
+
if (px)
|
|
138725
|
+
widths[colName(i + 1)] = px;
|
|
138726
|
+
});
|
|
138727
|
+
if (Object.keys(widths).length)
|
|
138728
|
+
tab.colWidths = widths;
|
|
138729
|
+
if (ws["!merges"]?.length)
|
|
138730
|
+
tab.merges = ws["!merges"].map((range) => XLSX.utils.encode_range(range));
|
|
138731
|
+
return tab;
|
|
138732
|
+
});
|
|
138733
|
+
const definedNames = !!wb.Workbook?.Names?.some((n) => !String(n.Name).startsWith("_xlnm"));
|
|
138734
|
+
for (const feature of lostFeatures(names, wb.files ?? {}, definedNames)) {
|
|
138735
|
+
dropped.add(feature);
|
|
138736
|
+
}
|
|
138737
|
+
return { tabs, dropped: [...dropped] };
|
|
138738
|
+
}
|
|
138739
|
+
async function buildXlsx(tabs) {
|
|
138740
|
+
const XLSX = await import("./xlsx-9acfmxr1.js");
|
|
138741
|
+
const wb = XLSX.utils.book_new();
|
|
138742
|
+
const dropped = new Set;
|
|
138743
|
+
for (const tab of tabs) {
|
|
138744
|
+
const ws = {};
|
|
138745
|
+
let rows = 0;
|
|
138746
|
+
let cols = 0;
|
|
138747
|
+
for (const [ref, c] of Object.entries(tab.cells)) {
|
|
138748
|
+
const at = parseCell(ref);
|
|
138749
|
+
rows = Math.max(rows, at.row);
|
|
138750
|
+
cols = Math.max(cols, at.col);
|
|
138751
|
+
let cell;
|
|
138752
|
+
if (c.e) {
|
|
138753
|
+
const text = String(c.v);
|
|
138754
|
+
cell = { t: "e", v: ERROR_CODES[text] ?? ERROR_CODES["#VALUE!"], w: text };
|
|
138755
|
+
} else if (typeof c.v === "number")
|
|
138756
|
+
cell = { t: "n", v: c.v };
|
|
138757
|
+
else if (typeof c.v === "boolean")
|
|
138758
|
+
cell = { t: "b", v: c.v };
|
|
138759
|
+
else if (typeof c.v === "string")
|
|
138760
|
+
cell = { t: "s", v: c.v };
|
|
138761
|
+
else
|
|
138762
|
+
cell = { t: "z" };
|
|
138763
|
+
if (c.f)
|
|
138764
|
+
cell.f = toXlsxFormula(c.f);
|
|
138765
|
+
if (c.nf)
|
|
138766
|
+
cell.z = c.nf;
|
|
138767
|
+
if (c.s)
|
|
138768
|
+
dropped.add("spilled array cells (written as values; the anchor keeps its formula)");
|
|
138769
|
+
ws[ref] = cell;
|
|
138770
|
+
}
|
|
138771
|
+
ws["!ref"] = rows ? `A1:${refOf(rows, cols)}` : "A1";
|
|
138772
|
+
if (tab.colWidths) {
|
|
138773
|
+
ws["!cols"] = Array.from({ length: cols }, (_, i) => {
|
|
138774
|
+
const px = tab.colWidths?.[colName(i + 1)];
|
|
138775
|
+
return px ? { wpx: px } : {};
|
|
138776
|
+
});
|
|
138777
|
+
}
|
|
138778
|
+
if (tab.merges)
|
|
138779
|
+
ws["!merges"] = tab.merges.map((range) => XLSX.utils.decode_range(range));
|
|
138780
|
+
if (tab.freezeRows)
|
|
138781
|
+
dropped.add("frozen panes");
|
|
138782
|
+
try {
|
|
138783
|
+
XLSX.utils.book_append_sheet(wb, ws, tab.name);
|
|
138784
|
+
} catch (error) {
|
|
138785
|
+
throw new ObjectsError(`cannot export tab '${tab.name}': ${error.message}`);
|
|
138786
|
+
}
|
|
138787
|
+
}
|
|
138788
|
+
const out = XLSX.write(wb, { type: "array", bookType: "xlsx", compression: true });
|
|
138789
|
+
return { bytes: new Uint8Array(out), dropped: [...dropped] };
|
|
138790
|
+
}
|
|
138791
|
+
var XLSX_MIME = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", MAX_XLSX_BYTES, MAX_INFLATED_BYTES, notXlsx = (why) => new ObjectsError(`not an xlsx workbook: ${why}`), refuse = (why) => notXlsx(`${why}; refusing it`), outsideQuotes = (formula, fn) => formula.split(/("(?:[^"]|"")*"|'(?:[^']|'')*')/).map((part, i) => i % 2 ? part : fn(part)).join(""), XLPREFIX, XLFN_FUNCTIONS, XLWS_FUNCTIONS, prefixFunctions = (formula, names, prefix) => names.reduce((f, name) => f.replace(new RegExp(`(?<![\\w.])${name.replace(".", "\\.")}\\(`, "gi"), `${prefix}${name}(`), formula), toXlsxFormula = (formula) => outsideQuotes(formula.slice(1), (code) => prefixFunctions(prefixFunctions(code, XLFN_FUNCTIONS, "_xlfn."), XLWS_FUNCTIONS, "_xlfn._xlws.")), ERROR_CODES;
|
|
138792
|
+
var init_xlsx = __esm(() => {
|
|
138793
|
+
init_objects();
|
|
138794
|
+
init_a1();
|
|
138795
|
+
init_format();
|
|
138796
|
+
MAX_XLSX_BYTES = MAX_FILE_BYTES;
|
|
138797
|
+
MAX_INFLATED_BYTES = 16 * 1024 * 1024;
|
|
138798
|
+
XLPREFIX = /_xl(?:fn|ws)\./g;
|
|
138799
|
+
XLFN_FUNCTIONS = [
|
|
138800
|
+
"CONCAT",
|
|
138801
|
+
"IFNA",
|
|
138802
|
+
"IFS",
|
|
138803
|
+
"MAXIFS",
|
|
138804
|
+
"MINIFS",
|
|
138805
|
+
"SEQUENCE",
|
|
138806
|
+
"STDEV.P",
|
|
138807
|
+
"STDEV.S",
|
|
138808
|
+
"SWITCH",
|
|
138809
|
+
"TEXTJOIN",
|
|
138810
|
+
"UNIQUE",
|
|
138811
|
+
"VAR.P",
|
|
138812
|
+
"VAR.S",
|
|
138813
|
+
"XLOOKUP",
|
|
138814
|
+
"XMATCH"
|
|
138815
|
+
];
|
|
138816
|
+
XLWS_FUNCTIONS = ["FILTER", "SORT"];
|
|
138817
|
+
ERROR_CODES = {
|
|
138818
|
+
"#NULL!": 0,
|
|
138819
|
+
"#DIV/0!": 7,
|
|
138820
|
+
"#VALUE!": 15,
|
|
138821
|
+
"#REF!": 23,
|
|
138822
|
+
"#NAME?": 29,
|
|
138823
|
+
"#NUM!": 36,
|
|
138824
|
+
"#N/A": 42
|
|
138825
|
+
};
|
|
138826
|
+
});
|
|
138827
|
+
|
|
138091
138828
|
// src/be/primitives/sheets/service.ts
|
|
138829
|
+
function embeddedId(content) {
|
|
138830
|
+
const { swarm } = content;
|
|
138831
|
+
const id = swarm && typeof swarm === "object" ? swarm.id : undefined;
|
|
138832
|
+
return typeof id === "string" && id.length > 0 ? id : undefined;
|
|
138833
|
+
}
|
|
138092
138834
|
async function load(target) {
|
|
138093
138835
|
const { object, missing, content } = await getObject({ ...target, includeContent: true });
|
|
138094
138836
|
if (object.kind !== "sheet") {
|
|
@@ -138099,7 +138841,11 @@ async function load(target) {
|
|
|
138099
138841
|
}
|
|
138100
138842
|
const parsed = SheetDocSchema.safeParse(content);
|
|
138101
138843
|
if (!parsed.success) {
|
|
138102
|
-
const
|
|
138844
|
+
const { issues } = parsed.error;
|
|
138845
|
+
if (issues.every((i) => i.path[0] === "swarm") && !embeddedId(content)) {
|
|
138846
|
+
throw new ObjectsError(`${object.path} has no embedded swarm.id, so a save outside the sheet tools dropped it; run object-reindex (ctx.objects.reindex) with prefix '${object.path}' to write the id back, then retry`);
|
|
138847
|
+
}
|
|
138848
|
+
const issue = issues[0];
|
|
138103
138849
|
throw new ObjectsError(`${object.path} is not a valid swarm-sheet/1 workbook: ${issue?.path.join(".") || "document"}: ${issue?.message}`);
|
|
138104
138850
|
}
|
|
138105
138851
|
if (object.fileVersion === null) {
|
|
@@ -138107,11 +138853,15 @@ async function load(target) {
|
|
|
138107
138853
|
}
|
|
138108
138854
|
return { object, version: object.fileVersion, doc: parsed.data };
|
|
138109
138855
|
}
|
|
138110
|
-
|
|
138856
|
+
function sheetBody(doc) {
|
|
138111
138857
|
const body = JSON.stringify(doc, null, 2);
|
|
138112
138858
|
if (Buffer.byteLength(body) > MAX_FILE_BYTES) {
|
|
138113
138859
|
throw new ObjectsError(`the sheet would exceed ${MAX_FILE_BYTES} bytes (5 MiB)`);
|
|
138114
138860
|
}
|
|
138861
|
+
return body;
|
|
138862
|
+
}
|
|
138863
|
+
async function save(agentId, object, doc, version, op) {
|
|
138864
|
+
const body = sheetBody(doc);
|
|
138115
138865
|
const client = agentId ? await agentFsClientFor(agentId) : undefined;
|
|
138116
138866
|
if (!client)
|
|
138117
138867
|
throw new ObjectsError(NO_AGENT_FS_IDENTITY);
|
|
@@ -138175,7 +138925,7 @@ function checkArea(range, what) {
|
|
|
138175
138925
|
async function createSheet(input) {
|
|
138176
138926
|
const { tabs } = input;
|
|
138177
138927
|
if (tabs) {
|
|
138178
|
-
|
|
138928
|
+
refuse2(() => {
|
|
138179
138929
|
if (tabs.length === 0 || tabs.length > MAX_TABS)
|
|
138180
138930
|
throw new A1Error(`tabs: 1-${MAX_TABS} tabs`);
|
|
138181
138931
|
const seen = new Set;
|
|
@@ -138223,7 +138973,7 @@ async function getSheet(target) {
|
|
|
138223
138973
|
}
|
|
138224
138974
|
async function getSheetRange(target) {
|
|
138225
138975
|
const { version, doc } = await load(target);
|
|
138226
|
-
const spec =
|
|
138976
|
+
const spec = refuse2(() => parseRange(target.range));
|
|
138227
138977
|
const tab = findTab(doc, spec.tab);
|
|
138228
138978
|
const range = capToUsed(spec, usedExtent(tab));
|
|
138229
138979
|
if (!range)
|
|
@@ -138255,7 +139005,7 @@ async function getSheetRange(target) {
|
|
|
138255
139005
|
};
|
|
138256
139006
|
}
|
|
138257
139007
|
async function setSheetRange(target) {
|
|
138258
|
-
const spec =
|
|
139008
|
+
const spec = refuse2(() => parseRange(target.range));
|
|
138259
139009
|
if (spec.open)
|
|
138260
139010
|
throw new ObjectsError("setRange needs a bounded range such as 'Tab!B2:C3', not a whole column or row");
|
|
138261
139011
|
const rows = target.values.length;
|
|
@@ -138271,7 +139021,7 @@ async function setSheetRange(target) {
|
|
|
138271
139021
|
if (height !== rows || width !== cols) {
|
|
138272
139022
|
throw new ObjectsError(`values is ${rows}x${cols} but the range is ${height}x${width}`);
|
|
138273
139023
|
}
|
|
138274
|
-
|
|
139024
|
+
refuse2(() => assertInBounds(range));
|
|
138275
139025
|
checkArea(range, "the range");
|
|
138276
139026
|
const { version, result } = await mutate(target, "set range", async (doc) => {
|
|
138277
139027
|
const tab = findTab(doc, spec.tab);
|
|
@@ -138310,7 +139060,7 @@ async function appendSheetRows(target) {
|
|
|
138310
139060
|
const first = usedExtent(tab).rows + 1;
|
|
138311
139061
|
const cols = Math.max(...target.rows.map((row) => row.length));
|
|
138312
139062
|
const range = { r1: first, c1: 1, r2: first + target.rows.length - 1, c2: cols };
|
|
138313
|
-
|
|
139063
|
+
refuse2(() => assertInBounds(range));
|
|
138314
139064
|
const patches = target.rows.flatMap((row, i) => row.flatMap((value, j) => value === null ? [] : [{ tab: tab.name, row: first + i, col: j + 1, input: inputFor(value) }]));
|
|
138315
139065
|
const changed = await recalc(target.agentId, doc, patches);
|
|
138316
139066
|
return {
|
|
@@ -138321,7 +139071,7 @@ async function appendSheetRows(target) {
|
|
|
138321
139071
|
return { ...result, version };
|
|
138322
139072
|
}
|
|
138323
139073
|
async function clearSheetRange(target) {
|
|
138324
|
-
const spec =
|
|
139074
|
+
const spec = refuse2(() => parseRange(target.range));
|
|
138325
139075
|
const { version, result } = await mutate(target, "clear range", async (doc) => {
|
|
138326
139076
|
const tab = findTab(doc, spec.tab);
|
|
138327
139077
|
const range = capToUsed(spec, usedExtent(tab));
|
|
@@ -138344,7 +139094,7 @@ async function clearSheetRange(target) {
|
|
|
138344
139094
|
}
|
|
138345
139095
|
async function addSheetTab(target) {
|
|
138346
139096
|
const { version, result } = await mutate(target, "add tab", async (doc) => {
|
|
138347
|
-
|
|
139097
|
+
refuse2(() => checkTabName(target.name));
|
|
138348
139098
|
if (doc.tabs.some((t) => t.name.toLowerCase() === target.name.toLowerCase())) {
|
|
138349
139099
|
throw new ObjectsError(`a tab named '${target.name}' already exists`);
|
|
138350
139100
|
}
|
|
@@ -138356,7 +139106,80 @@ async function addSheetTab(target) {
|
|
|
138356
139106
|
});
|
|
138357
139107
|
return { ...result, version };
|
|
138358
139108
|
}
|
|
138359
|
-
|
|
139109
|
+
async function readXlsx(agentId, sourcePath) {
|
|
139110
|
+
if (!/\.xlsx$/i.test(sourcePath))
|
|
139111
|
+
throw new ObjectsError("sourcePath must end in .xlsx");
|
|
139112
|
+
const { provider, scope } = await clientFor(agentId);
|
|
139113
|
+
const source = normalizePath(sourcePath);
|
|
139114
|
+
let response;
|
|
139115
|
+
try {
|
|
139116
|
+
response = await provider.download(scope(source));
|
|
139117
|
+
} catch (error) {
|
|
139118
|
+
if (error instanceof FilesError && error.code === "NotFound") {
|
|
139119
|
+
throw new ObjectsError(`no file at '${source}' on this drive`);
|
|
139120
|
+
}
|
|
139121
|
+
throw error;
|
|
139122
|
+
}
|
|
139123
|
+
const tooBig = () => new ObjectsError(`${source} is over the ${MAX_XLSX_BYTES} byte limit (5 MiB) for an xlsx`);
|
|
139124
|
+
if (Number(response.headers.get("content-length")) > MAX_XLSX_BYTES) {
|
|
139125
|
+
await response.body?.cancel();
|
|
139126
|
+
throw tooBig();
|
|
139127
|
+
}
|
|
139128
|
+
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
139129
|
+
if (bytes.length > MAX_XLSX_BYTES)
|
|
139130
|
+
throw tooBig();
|
|
139131
|
+
return bytes;
|
|
139132
|
+
}
|
|
139133
|
+
async function importSheetXlsx(input) {
|
|
139134
|
+
if (!input.path.endsWith(".sheet.json")) {
|
|
139135
|
+
throw new ObjectsError("a sheet path must end with '.sheet.json'");
|
|
139136
|
+
}
|
|
139137
|
+
const bytes = await readXlsx(input.agentId, input.sourcePath);
|
|
139138
|
+
const { tabs, dropped } = await parseXlsx(bytes);
|
|
139139
|
+
const draft = { tabs };
|
|
139140
|
+
await recalc(input.agentId, draft, []);
|
|
139141
|
+
sheetBody({ ...emptySheet(crypto.randomUUID(), input.title), tabs: draft.tabs });
|
|
139142
|
+
const created = await createObject({
|
|
139143
|
+
agentId: input.agentId,
|
|
139144
|
+
kind: "sheet",
|
|
139145
|
+
path: input.path,
|
|
139146
|
+
title: input.title
|
|
139147
|
+
});
|
|
139148
|
+
try {
|
|
139149
|
+
const { version } = await mutate({ agentId: input.agentId, id: created.id }, "import xlsx", async (doc) => {
|
|
139150
|
+
doc.tabs = draft.tabs;
|
|
139151
|
+
return { doc, result: null };
|
|
139152
|
+
});
|
|
139153
|
+
return { object: { ...created, fileVersion: version }, link: created.link, dropped };
|
|
139154
|
+
} catch (error) {
|
|
139155
|
+
if (error instanceof ObjectsError) {
|
|
139156
|
+
throw new ObjectsError(`created ${created.path} (id ${created.id}) but could not write the imported tabs: ${error.message}`);
|
|
139157
|
+
}
|
|
139158
|
+
throw error;
|
|
139159
|
+
}
|
|
139160
|
+
}
|
|
139161
|
+
async function exportSheetXlsx(target) {
|
|
139162
|
+
if (!/\.xlsx$/i.test(target.targetPath))
|
|
139163
|
+
throw new ObjectsError("targetPath must end in .xlsx");
|
|
139164
|
+
const { object, doc } = await load(target);
|
|
139165
|
+
const { bytes, dropped } = await buildXlsx(doc.tabs);
|
|
139166
|
+
const { provider, orgId, driveId, scope } = await clientFor(target.agentId);
|
|
139167
|
+
const path = normalizePath(target.targetPath);
|
|
139168
|
+
try {
|
|
139169
|
+
await provider.upload(scope(path), bytes, {
|
|
139170
|
+
contentType: XLSX_MIME,
|
|
139171
|
+
ifNoneMatch: target.overwrite ? undefined : "*",
|
|
139172
|
+
message: `export ${object.path}`
|
|
139173
|
+
});
|
|
139174
|
+
} catch (error) {
|
|
139175
|
+
if (error instanceof FilesError && error.code === "Conflict") {
|
|
139176
|
+
throw new ObjectsError(`a file already exists at '${path}'; pass overwrite: true to replace it`);
|
|
139177
|
+
}
|
|
139178
|
+
throw error;
|
|
139179
|
+
}
|
|
139180
|
+
return { path, link: buildAgentFsLiveUrl({ orgId, driveId, path }), dropped };
|
|
139181
|
+
}
|
|
139182
|
+
var MAX_ATTEMPTS = 4, refuse2 = (run) => {
|
|
138360
139183
|
try {
|
|
138361
139184
|
return run();
|
|
138362
139185
|
} catch (error) {
|
|
@@ -138368,14 +139191,16 @@ var MAX_ATTEMPTS = 4, refuse = (run) => {
|
|
|
138368
139191
|
const { rows, cols } = usedExtent(tab);
|
|
138369
139192
|
return { name: tab.name, rows, cols, freezeRows: tab.freezeRows ?? 0 };
|
|
138370
139193
|
}, listSheets = (input) => listObjects({ ...input, kind: "sheet" });
|
|
138371
|
-
var
|
|
139194
|
+
var init_service = __esm(() => {
|
|
138372
139195
|
init_provider();
|
|
139196
|
+
init_constants3();
|
|
138373
139197
|
init_agent_fs_identity();
|
|
138374
139198
|
init_db4();
|
|
138375
139199
|
init_objects();
|
|
138376
139200
|
init_a1();
|
|
138377
139201
|
init_engine2();
|
|
138378
139202
|
init_format();
|
|
139203
|
+
init_xlsx();
|
|
138379
139204
|
});
|
|
138380
139205
|
|
|
138381
139206
|
// src/tools/sheets.ts
|
|
@@ -138549,11 +139374,48 @@ var objectOutputSchema2, CellValue, Grid, RANGE_HELP = "A1 range such as `Tasks!
|
|
|
138549
139374
|
data: { yourAgentId: requestInfo.agentId, ...result.value }
|
|
138550
139375
|
});
|
|
138551
139376
|
});
|
|
139377
|
+
}, dropMessage = (dropped) => dropped.length ? `Dropped: ${dropped.join(", ")}.` : "Nothing dropped.", registerSheetImportXlsxTool = (server) => {
|
|
139378
|
+
createToolRegistrar(server)("sheet-import-xlsx", {
|
|
139379
|
+
title: "Import xlsx as sheet",
|
|
139380
|
+
annotations: WRITE,
|
|
139381
|
+
description: "Import an `.xlsx` file from your default agent-fs drive as a new sheet, as your own agent-fs identity. Create-only: refuses when the sheet path exists. Keeps tabs, values, formulas (recomputed), number formats, column widths and merges. `dropped` lists what the file had that a sheet cannot hold (styles, charts, comments, frozen panes, and so on). Limits: 5 MiB file, 20 tabs, 50,000 cells; nothing is created when a limit refuses.",
|
|
139382
|
+
inputSchema: object2({
|
|
139383
|
+
sourcePath: string2().min(1).describe("Drive path of the `.xlsx` file to import."),
|
|
139384
|
+
path: string2().min(1).describe("Drive path for the new sheet, ending in `.sheet.json`."),
|
|
139385
|
+
title: string2().max(200).optional()
|
|
139386
|
+
}),
|
|
139387
|
+
outputSchema
|
|
139388
|
+
}, async ({ sourcePath, path, title }, requestInfo) => {
|
|
139389
|
+
const result = await refusing2(requestInfo.agentId, () => importSheetXlsx({ agentId: requestInfo.agentId, sourcePath, path, title }));
|
|
139390
|
+
if ("error" in result)
|
|
139391
|
+
return result.error;
|
|
139392
|
+
const { object, link, dropped } = result.value;
|
|
139393
|
+
return toolOk(`Imported ${sourcePath} as sheet ${object.id} at ${object.path}${link ? ` (${link})` : ""}. ${dropMessage(dropped)}`, { data: { yourAgentId: requestInfo.agentId, ...result.value } });
|
|
139394
|
+
});
|
|
139395
|
+
}, registerSheetExportXlsxTool = (server) => {
|
|
139396
|
+
createToolRegistrar(server)("sheet-export-xlsx", {
|
|
139397
|
+
title: "Export sheet as xlsx",
|
|
139398
|
+
annotations: WRITE,
|
|
139399
|
+
description: "Export a sheet to an `.xlsx` file on your default agent-fs drive. Writes formulas with their cached values, number formats, column widths and merges. `dropped` lists what the file cannot carry (frozen panes, spilled array cells). Create-only: refuses when `targetPath` exists unless `overwrite` is true.",
|
|
139400
|
+
inputSchema: object2({
|
|
139401
|
+
id: string2().min(1).optional().describe(ID2),
|
|
139402
|
+
path: string2().min(1).optional().describe(PATH),
|
|
139403
|
+
targetPath: string2().min(1).describe("Drive path for the new file, ending in `.xlsx`."),
|
|
139404
|
+
overwrite: boolean().optional().describe("Replace `targetPath` when it exists.")
|
|
139405
|
+
}),
|
|
139406
|
+
outputSchema
|
|
139407
|
+
}, async ({ id, path, targetPath, overwrite }, requestInfo) => {
|
|
139408
|
+
const result = await refusing2(requestInfo.agentId, () => exportSheetXlsx({ agentId: requestInfo.agentId, id, path, targetPath, overwrite }));
|
|
139409
|
+
if ("error" in result)
|
|
139410
|
+
return result.error;
|
|
139411
|
+
const r = result.value;
|
|
139412
|
+
return toolOk(`Exported to ${r.path}${r.link ? ` (${r.link})` : ""}. ${dropMessage(r.dropped)}`, { data: { yourAgentId: requestInfo.agentId, ...r } });
|
|
139413
|
+
});
|
|
138552
139414
|
};
|
|
138553
139415
|
var init_sheets = __esm(() => {
|
|
138554
139416
|
init_zod();
|
|
138555
139417
|
init_objects();
|
|
138556
|
-
|
|
139418
|
+
init_service();
|
|
138557
139419
|
init_provider();
|
|
138558
139420
|
init_utils();
|
|
138559
139421
|
objectOutputSchema2 = looseObject({
|
|
@@ -138579,7 +139441,9 @@ var init_sheets = __esm(() => {
|
|
|
138579
139441
|
formulas: array2(array2(unknown())).optional(),
|
|
138580
139442
|
changed: number2().optional(),
|
|
138581
139443
|
recalculated: number2().optional(),
|
|
138582
|
-
cleared: number2().optional()
|
|
139444
|
+
cleared: number2().optional(),
|
|
139445
|
+
path: string2().optional(),
|
|
139446
|
+
dropped: array2(string2()).optional()
|
|
138583
139447
|
};
|
|
138584
139448
|
outputSchema = swarmToolOutputSchema(dataShape);
|
|
138585
139449
|
WRITE = { readOnlyHint: false, idempotentHint: false };
|
|
@@ -138637,7 +139501,9 @@ var registerSkillCreateTool = (server) => {
|
|
|
138637
139501
|
context: parsed.context,
|
|
138638
139502
|
agent: parsed.agent,
|
|
138639
139503
|
disableModelInvocation: parsed.disableModelInvocation,
|
|
138640
|
-
userInvocable: parsed.userInvocable
|
|
139504
|
+
userInvocable: parsed.userInvocable,
|
|
139505
|
+
createdByAgentId: requestInfo.agentId,
|
|
139506
|
+
createdBy: await resolveTaskAuditUserId(requestInfo.auditSourceTaskId, requestInfo.agentId)
|
|
138641
139507
|
});
|
|
138642
139508
|
await installSkill2(requestInfo.agentId, skill.id);
|
|
138643
139509
|
return toolOk(`Created and installed skill "${skill.name}".`, {
|
|
@@ -138653,6 +139519,7 @@ var registerSkillCreateTool = (server) => {
|
|
|
138653
139519
|
};
|
|
138654
139520
|
var init_skill_create = __esm(() => {
|
|
138655
139521
|
init_zod();
|
|
139522
|
+
init_audit_user();
|
|
138656
139523
|
init_db4();
|
|
138657
139524
|
init_skill_parser();
|
|
138658
139525
|
init_rbac();
|
|
@@ -138974,7 +139841,9 @@ var registerSkillInstallRemoteTool = (server) => {
|
|
|
138974
139841
|
context: parsedMeta.context,
|
|
138975
139842
|
agent: parsedMeta.agent,
|
|
138976
139843
|
disableModelInvocation: parsedMeta.disableModelInvocation,
|
|
138977
|
-
userInvocable: parsedMeta.userInvocable
|
|
139844
|
+
userInvocable: parsedMeta.userInvocable,
|
|
139845
|
+
createdByAgentId: requestInfo.agentId,
|
|
139846
|
+
createdBy: await resolveTaskAuditUserId(requestInfo.auditSourceTaskId, requestInfo.agentId)
|
|
138978
139847
|
});
|
|
138979
139848
|
return toolOk(`Installed remote skill "${skill.name}".`, {
|
|
138980
139849
|
details: `Installed remote skill "${skill.name}" from ${args.sourceRepo}`,
|
|
@@ -138988,6 +139857,7 @@ var registerSkillInstallRemoteTool = (server) => {
|
|
|
138988
139857
|
};
|
|
138989
139858
|
var init_skill_install_remote = __esm(() => {
|
|
138990
139859
|
init_zod();
|
|
139860
|
+
init_audit_user();
|
|
138991
139861
|
init_db4();
|
|
138992
139862
|
init_skill_parser();
|
|
138993
139863
|
init_rbac();
|
|
@@ -139191,6 +140061,7 @@ var registerSkillSyncRemoteTool = (server) => {
|
|
|
139191
140061
|
})() : await listSkills2({ type: "remote" });
|
|
139192
140062
|
let updated = 0;
|
|
139193
140063
|
const errors = [];
|
|
140064
|
+
const updatedBy = await resolveTaskAuditUserId(requestInfo.auditSourceTaskId, requestInfo.agentId);
|
|
139194
140065
|
for (const skill of skills) {
|
|
139195
140066
|
if (skill.isComplex)
|
|
139196
140067
|
continue;
|
|
@@ -139221,7 +140092,9 @@ var registerSkillSyncRemoteTool = (server) => {
|
|
|
139221
140092
|
disableModelInvocation: parsed.disableModelInvocation,
|
|
139222
140093
|
userInvocable: parsed.userInvocable,
|
|
139223
140094
|
sourceHash: newHash,
|
|
139224
|
-
lastFetchedAt: now
|
|
140095
|
+
lastFetchedAt: now,
|
|
140096
|
+
updatedByAgentId: requestInfo.agentId ?? null,
|
|
140097
|
+
updatedBy
|
|
139225
140098
|
});
|
|
139226
140099
|
updated++;
|
|
139227
140100
|
} else {
|
|
@@ -139255,6 +140128,7 @@ var registerSkillSyncRemoteTool = (server) => {
|
|
|
139255
140128
|
};
|
|
139256
140129
|
var init_skill_sync_remote = __esm(() => {
|
|
139257
140130
|
init_zod();
|
|
140131
|
+
init_audit_user();
|
|
139258
140132
|
init_db4();
|
|
139259
140133
|
init_skill_parser();
|
|
139260
140134
|
init_utils();
|
|
@@ -139392,7 +140266,11 @@ var SYSTEM_DEFAULT_SKILL_LOCKED_MESSAGE2 = "This skill is system-managed and can
|
|
|
139392
140266
|
}
|
|
139393
140267
|
updates.scope = args.scope;
|
|
139394
140268
|
}
|
|
139395
|
-
const skill = await updateSkill2(args.skillId,
|
|
140269
|
+
const skill = await updateSkill2(args.skillId, {
|
|
140270
|
+
...updates,
|
|
140271
|
+
updatedByAgentId: requestInfo.agentId,
|
|
140272
|
+
updatedBy: await resolveTaskAuditUserId(requestInfo.auditSourceTaskId, requestInfo.agentId)
|
|
140273
|
+
});
|
|
139396
140274
|
if (!skill) {
|
|
139397
140275
|
return toolErr("Update failed.", {
|
|
139398
140276
|
details: "Failed to update skill.",
|
|
@@ -139410,6 +140288,7 @@ var SYSTEM_DEFAULT_SKILL_LOCKED_MESSAGE2 = "This skill is system-managed and can
|
|
|
139410
140288
|
};
|
|
139411
140289
|
var init_skill_update = __esm(() => {
|
|
139412
140290
|
init_zod();
|
|
140291
|
+
init_audit_user();
|
|
139413
140292
|
init_db4();
|
|
139414
140293
|
init_skill_parser();
|
|
139415
140294
|
init_rbac();
|
|
@@ -142021,7 +142900,7 @@ async function readScriptActionAllowlist() {
|
|
|
142021
142900
|
const [row] = await getSwarmConfigs2({ scope: "global", key: UI_SPEC_SCRIPT_ACTIONS_KEY });
|
|
142022
142901
|
if (row)
|
|
142023
142902
|
return row.value;
|
|
142024
|
-
const { getDeploymentEnvValue } = await import("./core-
|
|
142903
|
+
const { getDeploymentEnvValue } = await import("./core-0fqtbrxa.js");
|
|
142025
142904
|
return getDeploymentEnvValue(UI_SPEC_SCRIPT_ACTIONS_KEY);
|
|
142026
142905
|
}
|
|
142027
142906
|
async function loadScriptActionLookups() {
|
|
@@ -145050,7 +145929,7 @@ var registerCreateWorkflowTool = (server) => {
|
|
|
145050
145929
|
` + `- Agent-task config: { template, outputSchema?, agentId?, tags?, priority?, dir?, vcsRepo?, model? }.
|
|
145051
145930
|
` + "- FOREACH NODE: type 'foreach' runs its body once per item. Config: " + "{ over: <array or exact {{input}} token>, itemKey: <property name>, body: { type: <any executor except foreach>, config: {...} }, " + "concurrency?: <integer >= 1, items in flight; unbounded when absent>, failurePolicy?: 'fail-fast' | 'collect-outcomes' }. " + "The body config is interpolated once per item with {{item.*}} and {{index}}. Child steps use synthetic IDs " + "'<foreachNodeId>#<itemKey>'; the parent waits for every child and exposes one aggregate result to successors. " + "failurePolicy defaults from onNodeFailure ('continue' = collect-outcomes, else fail-fast); fail-fast cancels queued items. " + `retry-workflow-run on a failed fan-out reruns only failed and cancelled items.
|
|
145052
145931
|
` + "- TRIGGER SCHEMA: Optional 'triggerSchema' is a JSON-Schema object that validates incoming trigger payloads. " + "Supported keywords: type, required, properties, enum, const, items (recursive into arrays). " + `Other JSON-Schema keywords (oneOf/anyOf/$ref/pattern/format/additionalProperties) are silently ignored.
|
|
145053
|
-
` + "- WEBHOOK VERIFICATION: Webhook triggers use hmacSecret for all verification formats. " + "Omit verification for legacy HMAC-SHA256 over the raw body with fallback header scanning; " + "or set verification to { format: 'hmac-sha256', header }, { format: 'timestamped-hmac-sha256', header, toleranceSeconds? }, " + "{ format: 'token-equality', header }, or { format: 'standard-webhooks', toleranceSeconds? } " + "(standardwebhooks.com: webhook-id/webhook-timestamp/webhook-signature headers, hmacSecret is the whsec_ signing secret). Example: { type: 'webhook', hmacSecret: 'secret.SUPERAGENT_WEBHOOK_SECRET', " + `verification: { format: 'timestamped-hmac-sha256', header: 'X-Superagent-Signature', toleranceSeconds: 300 } }.
|
|
145932
|
+
` + "- WEBHOOK VERIFICATION: Webhook triggers use hmacSecret for all verification formats. " + "Omit verification for legacy HMAC-SHA256 over the raw body with fallback header scanning; " + "or set verification to { format: 'hmac-sha256', header }, { format: 'hmac-sha1', header }, { format: 'timestamped-hmac-sha256', header, toleranceSeconds? }, " + "{ format: 'token-equality', header }, or { format: 'standard-webhooks', toleranceSeconds? } " + "(standardwebhooks.com: webhook-id/webhook-timestamp/webhook-signature headers, hmacSecret is the whsec_ signing secret). Example: { type: 'webhook', hmacSecret: 'secret.SUPERAGENT_WEBHOOK_SECRET', " + `verification: { format: 'timestamped-hmac-sha256', header: 'X-Superagent-Signature', toleranceSeconds: 300 } }.
|
|
145054
145933
|
` + "- WEBHOOK DELIVERY FILTER: optional filter on a webhook trigger drops deliveries after signature verification and before any run is saved " + "(200 { skipped: true, reason }). filter.headers and filter.body are allowlists (a string or an array of scalars); every field must match. " + "Header names are case-insensitive; values and JSON paths are exact, with no type coercion. " + 'preset "github" | "gitlab" | "standard-webhooks" selects where the deprecated events allowlist is read ' + "(X-GitHub-Event, X-Gitlab-Event, or JSON body type). events and eventHeader still work and are AND-ed with filter; eventHeader overrides preset. " + `Omit filter and events to accept every delivery.
|
|
145055
145934
|
` + "- WAIT NODE: type 'wait' pauses a workflow for a duration or until a named workflowEventBus event arrives. " + "See runbooks/workflows.md#wait-nodes for config shapes, ordering caveats, and built-in event names.",
|
|
145056
145935
|
inputSchema: object2({
|
|
@@ -145058,7 +145937,7 @@ var registerCreateWorkflowTool = (server) => {
|
|
|
145058
145937
|
key: AssetKeySchema.optional().describe("Logical namespace. Defaults to a shared/workflow:<id>/ resource key."),
|
|
145059
145938
|
description: string2().optional().describe("Description of what this workflow does"),
|
|
145060
145939
|
definition: WorkflowDefinitionSchema.describe("The workflow definition with nodes (each node has id, type, config, and optional next/retry/validation)"),
|
|
145061
|
-
triggers: array2(TriggerConfigSchema).optional().describe("Optional trigger configurations (webhook, schedule, event). A webhook trigger accepts filter (headers and body allowlists) and preset (github, gitlab, standard-webhooks). events and eventHeader remain a deprecated alias of one filter clause. Verification formats: legacy omitted verification, hmac-sha256, timestamped-hmac-sha256, token-equality, standard-webhooks."),
|
|
145940
|
+
triggers: array2(TriggerConfigSchema).optional().describe("Optional trigger configurations (webhook, schedule, event). A webhook trigger accepts filter (headers and body allowlists) and preset (github, gitlab, standard-webhooks). events and eventHeader remain a deprecated alias of one filter clause. Verification formats: legacy omitted verification, hmac-sha256, hmac-sha1, timestamped-hmac-sha256, token-equality, standard-webhooks."),
|
|
145062
145941
|
cooldown: CooldownConfigSchema.optional().describe("Optional cooldown configuration to prevent re-triggering too frequently"),
|
|
145063
145942
|
input: record2(string2(), InputValueSchema).optional().describe("Optional input values resolved at execution time (env vars like VAR_NAME, secrets secret.NAME, or literals). Env var and secret references require config.read.secrets (the lead agent)."),
|
|
145064
145943
|
dir: string2().min(1).startsWith("/").optional().describe("Default working directory for all agent-task nodes (absolute path, e.g. /tmp/workspace)"),
|
|
@@ -145098,8 +145977,8 @@ var registerCreateWorkflowTool = (server) => {
|
|
|
145098
145977
|
if (refKeys.length > 0 && !await agentMaySetServerRefInput(requestInfo.agentId)) {
|
|
145099
145978
|
return toolErr(serverRefInputDeniedMessage(refKeys));
|
|
145100
145979
|
}
|
|
145101
|
-
const createdBy = await resolveTaskAuditUserId(requestInfo.
|
|
145102
|
-
const assetKey = key ? await authorizeAssetKeyWrite(key,
|
|
145980
|
+
const createdBy = await resolveTaskAuditUserId(requestInfo.auditSourceTaskId, requestInfo.agentId) ?? undefined;
|
|
145981
|
+
const assetKey = key ? await authorizeAssetKeyWrite(key, await resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId)) : undefined;
|
|
145103
145982
|
const workflow = await createWorkflow2({
|
|
145104
145983
|
key: assetKey,
|
|
145105
145984
|
name,
|
|
@@ -145398,7 +146277,7 @@ async function patchWorkflowDefinition(options) {
|
|
|
145398
146277
|
if (!existing)
|
|
145399
146278
|
return { ok: false, reason: "not_found" };
|
|
145400
146279
|
if (options.serverRefInputAllowed === false) {
|
|
145401
|
-
const refKeys = serverRefInputKeys(existing.input);
|
|
146280
|
+
const refKeys = serverRefInputKeys(existing.input, updates?.params ?? existing.params);
|
|
145402
146281
|
if (refKeys.length > 0) {
|
|
145403
146282
|
return { ok: false, reason: "forbidden", errors: [serverRefInputDeniedMessage(refKeys)] };
|
|
145404
146283
|
}
|
|
@@ -145427,7 +146306,12 @@ async function patchWorkflowDefinition(options) {
|
|
|
145427
146306
|
} else {
|
|
145428
146307
|
version = (await snapshotWorkflow(id, snapshotAgentId)).version;
|
|
145429
146308
|
}
|
|
145430
|
-
const workflow = await updateWorkflow2(id, {
|
|
146309
|
+
const workflow = await updateWorkflow2(id, {
|
|
146310
|
+
...updates,
|
|
146311
|
+
definition: patchResult.definition,
|
|
146312
|
+
updatedBy: updates?.updatedBy ?? null,
|
|
146313
|
+
updatedByAgentId: snapshotAgentId ?? null
|
|
146314
|
+
});
|
|
145431
146315
|
if (!workflow)
|
|
145432
146316
|
return { ok: false, reason: "not_found" };
|
|
145433
146317
|
return { ok: true, workflow, version, definition: patchResult.definition };
|
|
@@ -145476,10 +146360,10 @@ var registerPatchWorkflowTool = (server) => {
|
|
|
145476
146360
|
})
|
|
145477
146361
|
}, async ({ id, key, update, delete: del, create, onNodeFailure, triggerSchema }, requestInfo) => {
|
|
145478
146362
|
try {
|
|
145479
|
-
const updatedBy = await resolveTaskAuditUserId(requestInfo.
|
|
146363
|
+
const updatedBy = await resolveTaskAuditUserId(requestInfo.auditSourceTaskId, requestInfo.agentId) ?? undefined;
|
|
145480
146364
|
const updates = {};
|
|
145481
146365
|
if (key !== undefined) {
|
|
145482
|
-
updates.key = await authorizeAssetKeyWrite(key,
|
|
146366
|
+
updates.key = await authorizeAssetKeyWrite(key, await resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId));
|
|
145483
146367
|
}
|
|
145484
146368
|
if (triggerSchema !== undefined) {
|
|
145485
146369
|
updates.triggerSchema = triggerSchema;
|
|
@@ -145568,7 +146452,7 @@ var registerPatchWorkflowNodeTool = (server) => {
|
|
|
145568
146452
|
})
|
|
145569
146453
|
}, async ({ id, nodeId, ...nodeFields }, requestInfo) => {
|
|
145570
146454
|
try {
|
|
145571
|
-
const updatedBy = await resolveTaskAuditUserId(requestInfo.
|
|
146455
|
+
const updatedBy = await resolveTaskAuditUserId(requestInfo.auditSourceTaskId, requestInfo.agentId) ?? undefined;
|
|
145572
146456
|
const result = await patchWorkflowDefinition({
|
|
145573
146457
|
id,
|
|
145574
146458
|
patch: { update: [{ nodeId, node: nodeFields }] },
|
|
@@ -145843,14 +146727,14 @@ var registerUpdateWorkflowTool = (server) => {
|
|
|
145843
146727
|
createToolRegistrar(server)("update-workflow", {
|
|
145844
146728
|
title: "Update Workflow",
|
|
145845
146729
|
annotations: { destructiveHint: false },
|
|
145846
|
-
description: "Update an existing workflow's name, description, definition, triggers, cooldown, input, triggerSchema, or enabled state. " + "Creates a version snapshot before applying changes. " + "TRIGGER SCHEMA: pass 'triggerSchema' as a JSON-Schema object to set/replace, or 'null' to clear. " + "Supported JSON-Schema keywords: type, required, properties, enum, const, items (recursive into arrays). " + "Other JSON-Schema keywords (oneOf/anyOf/$ref/pattern/format/additionalProperties) are silently ignored. " + "WEBHOOK VERIFICATION: webhook triggers use hmacSecret for all verification formats. " + "Omit verification for legacy HMAC-SHA256 over the raw body with fallback header scanning; " + "or set verification to { format: 'hmac-sha256', header }, { format: 'timestamped-hmac-sha256', header, toleranceSeconds? }, " + "{ format: 'token-equality', header }, or { format: 'standard-webhooks', toleranceSeconds? } " + "(standardwebhooks.com: webhook-id/webhook-timestamp/webhook-signature headers, hmacSecret is the whsec_ signing secret). " + "WEBHOOK DELIVERY FILTER: optional filter on a webhook trigger drops deliveries after signature verification and before any run is saved " + "(200 { skipped: true, reason }). filter.headers and filter.body are allowlists (a string or an array of scalars); every field must match. " + "Header names are case-insensitive; values and JSON paths are exact, with no type coercion. " + 'preset "github" | "gitlab" | "standard-webhooks" selects where the deprecated events allowlist is read ' + "(X-GitHub-Event, X-Gitlab-Event, or JSON body type). events and eventHeader still work and are AND-ed with filter; eventHeader overrides preset. " + "Omit filter and events to accept every delivery.",
|
|
146730
|
+
description: "Update an existing workflow's name, description, definition, triggers, cooldown, input, triggerSchema, or enabled state. " + "Creates a version snapshot before applying changes. " + "TRIGGER SCHEMA: pass 'triggerSchema' as a JSON-Schema object to set/replace, or 'null' to clear. " + "Supported JSON-Schema keywords: type, required, properties, enum, const, items (recursive into arrays). " + "Other JSON-Schema keywords (oneOf/anyOf/$ref/pattern/format/additionalProperties) are silently ignored. " + "WEBHOOK VERIFICATION: webhook triggers use hmacSecret for all verification formats. " + "Omit verification for legacy HMAC-SHA256 over the raw body with fallback header scanning; " + "or set verification to { format: 'hmac-sha256', header }, { format: 'hmac-sha1', header }, { format: 'timestamped-hmac-sha256', header, toleranceSeconds? }, " + "{ format: 'token-equality', header }, or { format: 'standard-webhooks', toleranceSeconds? } " + "(standardwebhooks.com: webhook-id/webhook-timestamp/webhook-signature headers, hmacSecret is the whsec_ signing secret). " + "WEBHOOK DELIVERY FILTER: optional filter on a webhook trigger drops deliveries after signature verification and before any run is saved " + "(200 { skipped: true, reason }). filter.headers and filter.body are allowlists (a string or an array of scalars); every field must match. " + "Header names are case-insensitive; values and JSON paths are exact, with no type coercion. " + 'preset "github" | "gitlab" | "standard-webhooks" selects where the deprecated events allowlist is read ' + "(X-GitHub-Event, X-Gitlab-Event, or JSON body type). events and eventHeader still work and are AND-ed with filter; eventHeader overrides preset. " + "Omit filter and events to accept every delivery.",
|
|
145847
146731
|
inputSchema: object2({
|
|
145848
146732
|
id: string2().uuid().describe("Workflow ID to update"),
|
|
145849
146733
|
key: AssetKeySchema.optional().describe("Move to a logical namespace."),
|
|
145850
146734
|
name: string2().optional().describe("New name for the workflow"),
|
|
145851
146735
|
description: string2().optional().describe("New description"),
|
|
145852
146736
|
definition: WorkflowDefinitionSchema.optional().describe("New workflow definition"),
|
|
145853
|
-
triggers: array2(TriggerConfigSchema).optional().describe("Replacement trigger list. A webhook trigger accepts filter (headers and body allowlists) and preset (github, gitlab, standard-webhooks). events and eventHeader remain a deprecated alias of one filter clause. Verification formats: legacy omitted verification, hmac-sha256, timestamped-hmac-sha256, token-equality, standard-webhooks."),
|
|
146737
|
+
triggers: array2(TriggerConfigSchema).optional().describe("Replacement trigger list. A webhook trigger accepts filter (headers and body allowlists) and preset (github, gitlab, standard-webhooks). events and eventHeader remain a deprecated alias of one filter clause. Verification formats: legacy omitted verification, hmac-sha256, hmac-sha1, timestamped-hmac-sha256, token-equality, standard-webhooks."),
|
|
145854
146738
|
cooldown: CooldownConfigSchema.optional().nullable().describe("New cooldown configuration (null to remove)"),
|
|
145855
146739
|
input: record2(string2(), InputValueSchema).optional().nullable().describe("New input values (null to remove)"),
|
|
145856
146740
|
dir: string2().min(1).startsWith("/").optional().nullable().describe("Default working directory for all agent-task nodes (null to remove)"),
|
|
@@ -145900,12 +146784,12 @@ var registerUpdateWorkflowTool = (server) => {
|
|
|
145900
146784
|
return toolErr(`Invalid definition: ${modelErrors.join("; ")}`);
|
|
145901
146785
|
}
|
|
145902
146786
|
}
|
|
145903
|
-
const refKeys = serverRefInputKeys(input !== undefined ? input :
|
|
146787
|
+
const refKeys = input !== undefined || definition ? serverRefInputKeys(input !== undefined ? input : existing.input, existing.params) : [];
|
|
145904
146788
|
if (refKeys.length > 0 && !(requestInfo.agentId && await agentMaySetServerRefInput(requestInfo.agentId))) {
|
|
145905
146789
|
return toolErr(serverRefInputDeniedMessage(refKeys));
|
|
145906
146790
|
}
|
|
145907
|
-
const updatedBy = await resolveTaskAuditUserId(requestInfo.
|
|
145908
|
-
const assetKey = key === undefined ? undefined : await authorizeAssetKeyWrite(key,
|
|
146791
|
+
const updatedBy = await resolveTaskAuditUserId(requestInfo.auditSourceTaskId, requestInfo.agentId) ?? undefined;
|
|
146792
|
+
const assetKey = key === undefined ? undefined : await authorizeAssetKeyWrite(key, await resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId));
|
|
145909
146793
|
const { workflow, version } = await snapshotAndUpdateWorkflow(id, {
|
|
145910
146794
|
key: assetKey,
|
|
145911
146795
|
name,
|
|
@@ -146256,6 +147140,8 @@ async function createServer(opts = {}) {
|
|
|
146256
147140
|
registerSheetAppendRowsTool(server);
|
|
146257
147141
|
registerSheetClearRangeTool(server);
|
|
146258
147142
|
registerSheetAddTabTool(server);
|
|
147143
|
+
registerSheetImportXlsxTool(server);
|
|
147144
|
+
registerSheetExportXlsxTool(server);
|
|
146259
147145
|
registerBoardCreateTool(server);
|
|
146260
147146
|
registerBoardGetTool(server);
|
|
146261
147147
|
registerBoardListTool(server);
|
|
@@ -146498,4 +147384,4 @@ var init_server = __esm(() => {
|
|
|
146498
147384
|
loggedToolAllowlistWarnings = new Set;
|
|
146499
147385
|
});
|
|
146500
147386
|
|
|
146501
|
-
export { safeParse, getObjectShape, getLiteralValue, init_zod_compat, LATEST_PROTOCOL_VERSION, DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, ErrorCode, isJSONRPCErrorResponse, JSONRPCMessageSchema, EmptyResultSchema, isInitializeRequest, InitializeResultSchema, CreateTaskResultSchema, ListResourcesResultSchema, ListResourceTemplatesResultSchema, ReadResourceResultSchema, ResourceListChangedNotificationSchema, ListPromptsResultSchema, GetPromptResultSchema, PromptListChangedNotificationSchema, ListToolsResultSchema, CallToolResultSchema, ToolListChangedNotificationSchema, ListChangedOptionsBaseSchema, CreateMessageRequestSchema, CreateMessageResultSchema, CreateMessageResultWithToolsSchema, ElicitRequestSchema, ElicitResultSchema, CompleteResultSchema, McpError, init_types, Protocol, mergeCapabilities, init_protocol, AjvJsonSchemaValidator, init_ajv_provider, assertToolsCallTaskCapability, assertClientRequestTaskCapability, init_helpers, McpServer, init_mcp, referencedBundlePaths, skillDirs, init_manifest_format, recoverIncompleteRuns, init_recovery, handleWebhookTrigger, verifyHmacSignature, decodeStandardWebhookSecret, verifyStandardWebhookSignature, verifyTokenEquality, WebhookError, init_triggers, snapshotAndUpdateWorkflow, init_version, applyPreTaskCreate, init_apply_task_create, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, init_raw_llm, getExecutorRegistry2, initWorkflows2, init_workflows, stripSiblingBlock, init_sibling_block, createTaskWithSiblingAwareness, init_sibling_awareness, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, init_scheduler, ExtensionAssetConflictError, hashOf, scriptHash, liveScriptSpec, liveWorkflowSpec, skillSpecOf, liveSkillSpec, skillHash, init_assets, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, init_db, SDK_ALLOWLIST, mcpToolNameForSdkMethod, init_sdk_allowlist, MCP_OVERFLOW_NAMESPACE, mcpOverflowAuthError, init_kv_overflow, hasKvViewArgs, resolveKvView, init_kv_view, COLOR_LITERAL_THRESHOLD, countColorLiterals, init_color_literals, toolErr, createToolRegistrar, init_utils, handleMcpBridge, init_mcp_bridge, Redacted, init_redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, init_response_limit, retry, init_retry, ExtensionConfigError, init_loader, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, init_lifecycle, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, init_dispatcher, resolveIdentity, renderIdentity, init_identity, recordUnmappedIdentity, init_unmapped_identities, getDeliveredSlackMessageTs, foldIntoPendingSlackTask, init_slack_fold, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, init_task_attachment_store, transcribeAudioNotes, init_transcription, init_templates, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, attachSlackFilesToDraft, notifySlackFileFailures, init_inbound_files, pendingWorkForAgent, countPoolRuntimes, computeDesired, init_demand, isRuntimePoolWakeable, isAgentReachable, isAgentOnDemand, init_reachability, isAddressedToOtherUser, broadcastMatches, routeMessage, extractTaskFromMessage, init_router, extractSlackMessageText, slackInboundMessageText, collectSlackMessageFiles, init_message_text, createAdditiveBuffer, init_additive_buffer, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, init_agentmail, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, repointTrackerSyncBySwarmId, init_tracker, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, init_azure_devops, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, init_azure_devops2, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, init_rbac_audit, getTelemetryIngestAnchor, init_telemetry_ingest_anchor, initApiTelemetry, syncTelemetryEnabled, init_telemetry_enable, isBitbucketEnabled, initBitbucket, verifyBitbucketWebhook, isDuplicateDelivery, markDeliveryProcessed, pullRequestEventOf, pullRequestCommentEventOf, handlePullRequestCreated2, handlePullRequestCommentCreated, handlePullRequestClosed, init_bitbucket, isGitHubEnabled, initGitHub, verifyWebhookSignature, getWorkerInstallationToken, init_app, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, init_github, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, init_gitlab, isChatSdkEnabled, getChatSdkConfig, init_config, errorMessage, init_logger, resolveAdapterApiUrl, init_adapters, trackBackground, init_background, TelegramBotApiError, callTelegramBotApi, init_telegram_api, isTrustedTeamsServiceUrl, init_teams_origin, getSessionLabels, rememberSessionLabel, getResourceSessionLabels, init_session_labels, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, init_runtime, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, init_metadata, registerJiraWebhook, deleteJiraWebhook, init_webhook_lifecycle, isJiraEnabled, initJira, init_app2, handleJiraWebhook, init_webhook, init_jira, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, init_sync, isLinearEnabled, initLinear, init_app3, init_linear, init_slack, verifyPageSession, LEGACY_PAGE_SESSION_COOKIE, isCookieSafePageId, extractPageSession, extractLegacyPageSession, extractAndVerifyCookie, isLocalDevPageRequest, pageSessionSetCookies, init_page_session, resolveHttpRequestAuth, init_auth, getDeploymentEnvValue2, loadGlobalConfigsIntoEnv2, reloadGlobalConfigsAndIntegrations2, scheduleIntegrationsReload2, handleCore2, init_core, runTaskUiScriptAction, init_script_actions, REBOOT_RETRY_PIN_TAG2, getPinCandidateAgent2, resolveLeadOnlyRecoveryAssignment2, getResumeGeneration2, getNextResumeGeneration2, inheritedModelSelection2, nextFallback2, createWorkerTaskFollowUp2, createResumeFollowUp2, createRerouteDecisionTask2, createPoolStarvationDecisionTask2, init_worker_follow_up, MCP_MAX_TOOL_INPUT_ELEMENTS, MCP_MAX_REQUEST_BODY_BYTES, init_mcp_limits, userCtx, init_task_tool_ctx, resolveRequestPrincipal, requestPrincipal, agentFirstPrincipal, requireAuthKind, rejectGuest, init_request_principal, resolveTaskRequester, init_task_requester, handleApps, init_apps, cancelApprovalRequest, cancelApprovalRequestAndRun, init_approval_cancel, getUserCommsPrefs, init_requester_comms, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, init_get_task_details, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, init_cancel_task, DbQueryTimeoutError, DbQueryConcurrencyCapError, executeReadOnlyQuery, getDbQueryHttpBudgetMs, init_db_query_shared, assertSelectOnlyQuery, executeReadOnlyQueryGated, handleDbQuery, init_db_query, snapshotMetric, init_version2, AssetKeyAuthorizationError, authorizeAssetKeyWrite, init_asset_key_auth, getPageEditCounter, init_page_versions, snapshotPage, init_version3, DEFAULT_THEME_ID, THEME_PRESET_IDS, getThemePreset, init_presets, readThemeFields, init_page_fields, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, init_app_validation, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, init_presets2, scopedResourceScopeIdSchema, resolveScopedResourceId, init_scoped_resource, MemoryKeyError, init_key_guard, refreshLinks, init_link_resolver, indexMemoryContent, init_index_content, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, init_retrieval, ExplicitSelfDuplicateError, applyRating, init_store, shouldPersistAutomaticTaskMemory, init_automatic_task_gate, guardTerminalTaskResultWrite, init_terminal_result_guard, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, init_get_tasks, requiresLeadToWrite, reservedNamespaceError, privateNamespaceError, reservedRoomKeyError, init_kv_reserved_namespaces, updateMcpServerChecked, init_mcp_server_checked_update, updateTouchesStdioExecution, init_mcp_server_stdio_gate, canReadMemory, init_access, getLinksForMemory, init_links_store, attachDemotionEvidence, init_demotion_evidence, expandCandidatesWithGraph, init_graph_expansion, isApiDraining, drainApi, init_api_drain, markKapsoMessageRead, sendKapsoReaction, init_client, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, init_config2, changesAllowMerge, init_repo_merge_policy, updateSwarmRepoChecked, init_repo_checked_update, getCombConfig, init_config3, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, sessionAccessTopic, sessionPresenceRoot, init_auth2, RoomOperationSchema, init_document, removeAwarenessStates, init_awareness, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, init_rooms, init_scheduler2, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, init_key_browser, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, init_events, mergeScheduleTiming, validateRecurringTiming, init_validate, followUpThreadForSourceTask, evaluateFollowUpRedelegation, init_follow_up_redelegation_guard, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, init_send_task, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, init_steer_task, skipReasonFrom, finalizeSkippedTaskReaction, init_task_skip, IMPROVEMENT_TEXT_MAX, IMPROVEMENT_STATUSES, IMPROVEMENT_SOURCES, ImprovementError, isImprovementsEnabled, getImprovement, listImprovements, createImprovement, approveAndSend, discardImprovement, improvementLeakHints, init_improvements, recomputeSessionCost, init_session_cost_recompute, canClaim, init_budget_admission, emitBudgetRefusalSideEffects, init_budget_refusal_notify, workflowModelErrors, init_model_validation, patchWorkflowDefinition, init_patch_definition, idempotencyKeyHeader, readIdempotencyKey, replayAcceptedOperation, init_idempotency_key, resolveScriptsOnlyMode, init_scripts_only_mode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer, init_server };
|
|
147387
|
+
export { safeParse, getObjectShape, getLiteralValue, init_zod_compat, LATEST_PROTOCOL_VERSION, DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, ErrorCode, isJSONRPCErrorResponse, JSONRPCMessageSchema, EmptyResultSchema, isInitializeRequest, InitializeResultSchema, CreateTaskResultSchema, ListResourcesResultSchema, ListResourceTemplatesResultSchema, ReadResourceResultSchema, ResourceListChangedNotificationSchema, ListPromptsResultSchema, GetPromptResultSchema, PromptListChangedNotificationSchema, ListToolsResultSchema, CallToolResultSchema, ToolListChangedNotificationSchema, ListChangedOptionsBaseSchema, CreateMessageRequestSchema, CreateMessageResultSchema, CreateMessageResultWithToolsSchema, ElicitRequestSchema, ElicitResultSchema, CompleteResultSchema, McpError, init_types, Protocol, mergeCapabilities, init_protocol, AjvJsonSchemaValidator, init_ajv_provider, assertToolsCallTaskCapability, assertClientRequestTaskCapability, init_helpers, McpServer, init_mcp, referencedBundlePaths, skillDirs, init_manifest_format, recoverIncompleteRuns, init_recovery, handleWebhookTrigger, verifyHmacSignature, decodeStandardWebhookSecret, verifyStandardWebhookSignature, verifyTokenEquality, WebhookError, init_triggers, snapshotAndUpdateWorkflow, init_version, applyPreTaskCreate, init_apply_task_create, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, init_raw_llm, getExecutorRegistry2, initWorkflows2, init_workflows, isGitHubEnabled, initGitHub, verifyWebhookSignature, getWorkerInstallationToken, init_app, isReservedProviderEvent, init_event_waits, stripSiblingBlock, init_sibling_block, createTaskWithSiblingAwareness, init_sibling_awareness, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, init_scheduler, ExtensionAssetConflictError, hashOf, scriptHash, liveScriptSpec, liveWorkflowSpec, skillSpecOf, liveSkillSpec, skillHash, init_assets, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, init_db, SDK_ALLOWLIST, mcpToolNameForSdkMethod, init_sdk_allowlist, MCP_OVERFLOW_NAMESPACE, mcpOverflowAuthError, init_kv_overflow, hasKvViewArgs, resolveKvView, init_kv_view, COLOR_LITERAL_THRESHOLD, countColorLiterals, init_color_literals, toolErr, createToolRegistrar, init_utils, handleMcpBridge, init_mcp_bridge, Redacted, init_redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, init_response_limit, retry, init_retry, ExtensionConfigError, init_loader, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, init_lifecycle, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, hasNativeToolHandlers2, listRegistered2, dispatchPre2, dispatchPost2, init_dispatcher, resolveIdentity, renderIdentity, init_identity, dismissedNamespace, dismissUnmappedIdentity, restoreUnmappedIdentity, recordUnmappedIdentity, init_unmapped_identities, getDeliveredSlackMessageTs, foldIntoPendingSlackTask, init_slack_fold, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, init_task_attachment_store, transcribeAudioNotes, init_transcription, init_templates, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, attachSlackFilesToDraft, notifySlackFileFailures, init_inbound_files, pendingWorkForAgent, countPoolRuntimes, computeDesired, init_demand, isRuntimePoolWakeable, isAgentReachable, isAgentOnDemand, init_reachability, isAddressedToOtherUser, broadcastMatches, routeMessage, extractTaskFromMessage, init_router, extractSlackMessageText, slackInboundMessageText, collectSlackMessageFiles, init_message_text, createAdditiveBuffer, init_additive_buffer, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, init_agentmail, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, repointTrackerSyncBySwarmId, init_tracker, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, init_azure_devops, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, init_azure_devops2, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, init_rbac_audit, getTelemetryIngestAnchor, init_telemetry_ingest_anchor, initApiTelemetry, syncTelemetryEnabled, init_telemetry_enable, isBitbucketEnabled, initBitbucket, verifyBitbucketWebhook, isDuplicateDelivery, markDeliveryProcessed, pullRequestEventOf, pullRequestCommentEventOf, handlePullRequestCreated2, handlePullRequestCommentCreated, handlePullRequestClosed, init_bitbucket, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, init_github, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, init_gitlab, isChatSdkEnabled, getChatSdkConfig, init_config, errorMessage, init_logger, resolveAdapterApiUrl, init_adapters, trackBackground, init_background, TelegramBotApiError, callTelegramBotApi, init_telegram_api, isTrustedTeamsServiceUrl, init_teams_origin, getSessionLabels, rememberSessionLabel, getResourceSessionLabels, init_session_labels, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, init_runtime, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, init_metadata, registerJiraWebhook, deleteJiraWebhook, init_webhook_lifecycle, isJiraEnabled, initJira, init_app2, handleJiraWebhook, init_webhook, init_jira, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, init_sync, isLinearEnabled, initLinear, init_app3, init_linear, init_slack, verifyPageSession, LEGACY_PAGE_SESSION_COOKIE, isCookieSafePageId, extractPageSession, extractLegacyPageSession, extractAndVerifyCookie, isLocalDevPageRequest, pageSessionSetCookies, init_page_session, resolveHttpRequestAuth, init_auth, getDeploymentEnvValue2, loadGlobalConfigsIntoEnv2, reloadGlobalConfigsAndIntegrations2, scheduleIntegrationsReload2, handleCore2, init_core, runTaskUiScriptAction, init_script_actions, REBOOT_RETRY_PIN_TAG2, getPinCandidateAgent2, resolveLeadOnlyRecoveryAssignment2, getResumeGeneration2, getNextResumeGeneration2, inheritedModelSelection2, nextFallback2, createWorkerTaskFollowUp2, createResumeFollowUp2, createRerouteDecisionTask2, createPoolStarvationDecisionTask2, init_worker_follow_up, MCP_MAX_TOOL_INPUT_ELEMENTS, MCP_MAX_REQUEST_BODY_BYTES, init_mcp_limits, userCtx, init_task_tool_ctx, resolveRequestPrincipal, requestPrincipal, agentFirstPrincipal, requireAuthKind, rejectGuest, init_request_principal, resolveTaskRequester, init_task_requester, handleApps, init_apps, parseScene, init_elements, MAX_OBJECT_BYTES, init_write_object, cancelApprovalRequest, cancelApprovalRequestAndRun, init_approval_cancel, getUserCommsPrefs, init_requester_comms, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, init_get_task_details, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, init_cancel_task, DbQueryTimeoutError, DbQueryConcurrencyCapError, executeReadOnlyQuery, getDbQueryHttpBudgetMs, init_db_query_shared, assertSelectOnlyQuery, executeReadOnlyQueryGated, handleDbQuery, init_db_query, snapshotMetric, init_version2, AssetKeyAuthorizationError, authorizeAssetKeyWrite, init_asset_key_auth, getPageEditCounter, init_page_versions, snapshotPage, init_version3, DEFAULT_THEME_ID, THEME_PRESET_IDS, getThemePreset, init_presets, readThemeFields, init_page_fields, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, init_app_validation, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, init_presets2, scopedResourceScopeIdSchema, resolveScopedResourceId, init_scoped_resource, MemoryKeyError, init_key_guard, refreshLinks, init_link_resolver, indexMemoryContent, init_index_content, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, init_retrieval, ExplicitSelfDuplicateError, applyRating, init_store, shouldPersistAutomaticTaskMemory, init_automatic_task_gate, guardTerminalTaskResultWrite, init_terminal_result_guard, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, init_get_tasks, requiresLeadToWrite, reservedNamespaceError, privateNamespaceError, reservedRoomKeyError, init_kv_reserved_namespaces, updateMcpServerChecked, init_mcp_server_checked_update, updateTouchesStdioExecution, init_mcp_server_stdio_gate, canReadMemory, init_access, getLinksForMemory, init_links_store, attachDemotionEvidence, init_demotion_evidence, expandCandidatesWithGraph, init_graph_expansion, isApiDraining, drainApi, init_api_drain, markKapsoMessageRead, sendKapsoReaction, init_client, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, init_config2, changesMergePolicy, init_repo_merge_policy, updateSwarmRepoChecked, init_repo_checked_update, getCombConfig, init_config3, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, sessionAccessTopic, sessionPresenceRoot, init_auth2, RoomOperationSchema, init_document, removeAwarenessStates, init_awareness, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, init_rooms, init_scheduler2, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, init_key_browser, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, init_events, mergeScheduleTiming, validateRecurringTiming, init_validate, followUpThreadForSourceTask, evaluateFollowUpRedelegation, init_follow_up_redelegation_guard, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, init_send_task, setSheetRange, appendSheetRows, clearSheetRange, init_service, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, init_steer_task, skipReasonFrom, finalizeSkippedTaskReaction, init_task_skip, IMPROVEMENT_TEXT_MAX, IMPROVEMENT_STATUSES, IMPROVEMENT_SOURCES, ImprovementError, isImprovementsEnabled, getImprovement, listImprovements, createImprovement, approveAndSend, discardImprovement, improvementLeakHints, init_improvements, recomputeSessionCost, init_session_cost_recompute, canClaim, init_budget_admission, emitBudgetRefusalSideEffects, init_budget_refusal_notify, workflowModelErrors, init_model_validation, patchWorkflowDefinition, init_patch_definition, idempotencyKeyHeader, readIdempotencyKey, replayAcceptedOperation, init_idempotency_key, resolveScriptsOnlyMode, init_scripts_only_mode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer, init_server };
|