@desplega.ai/agent-swarm 2.10.0 → 2.12.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-11m13kx4.js +16 -0
- package/dist/{acp-targets-arrwv4f0.js → acp-targets-311gcyvw.js} +9 -9
- package/dist/{actions-y0d2n1c2.js → actions-c4chgxp6.js} +27 -24
- package/dist/{agent-fs-provision-tpj7sktd.js → agent-fs-provision-0b9awm5n.js} +10 -5
- package/dist/{amp-adapter-vmmnmw8d.js → amp-adapter-r0veq6x5.js} +3 -3
- package/dist/{anthropic-messages-zdca3gv1.js → anthropic-messages-88b7s3n9.js} +177 -25
- package/dist/{app-wb7w45dq.js → app-hn5fftf5.js} +7 -6
- package/dist/{approval-notifications-7mqr6vbd.js → approval-notifications-3g6yc8nv.js} +7 -6
- package/dist/{assistant-gf60454p.js → assistant-cpjgpjvp.js} +29 -26
- package/dist/{azure-openai-responses-b3y7fz36.js → azure-openai-responses-jeaas6x0.js} +10 -10
- package/dist/{boot-args-schema-qxmd59sr.js → boot-args-schema-hce1av1h.js} +1 -1
- package/dist/{boot-reembed-5tmeskj2.js → boot-reembed-bztbxc4z.js} +1 -1
- package/dist/{boot-reembed-wb44vc3s.js → boot-reembed-d7xcym0j.js} +1 -1
- package/dist/{boot-scrub-sweep-25bxhnw4.js → boot-scrub-sweep-mkmm16gk.js} +2 -2
- package/dist/{boot-seeds-nj9za0vk.js → boot-seeds-arrkbe8t.js} +4 -4
- package/dist/{boxd-wn235q80.js → boxd-68n75y1s.js} +2 -2
- package/dist/{claude-adapter-d3krpdyb.js → claude-adapter-ykpyr5p8.js} +8 -8
- package/dist/{claude-managed-adapter-t8nfgcgz.js → claude-managed-adapter-ssg6z4bt.js} +4 -4
- package/dist/{claude-managed-setup-7y4pwd81.js → claude-managed-setup-trd59v7b.js} +4 -4
- package/dist/{claude-sdk-session-d138zy0e.js → claude-sdk-session-yjcze0j1.js} +10941 -10412
- package/dist/{cli-vq2eg24x.js → cli-01tvvtad.js} +63 -60
- package/dist/cli-04zc3f7b.js +68 -0
- package/dist/{cli-01k6wpr9.js → cli-0k1a0sde.js} +7 -7
- package/dist/{cli-j6te8keb.js → cli-0pp1yjg2.js} +8 -8
- package/dist/{cli-0b4zam62.js → cli-0vcqcwfn.js} +18 -0
- package/dist/{cli-wwp1bd3n.js → cli-12vek61e.js} +564 -97
- package/dist/{cli-rqx70rcz.js → cli-17qzb39j.js} +5 -2
- package/dist/{cli-124ntmf0.js → cli-1htmtqc2.js} +143 -63
- package/dist/{cli-3f8zbtqa.js → cli-2amwhyv2.js} +15 -11
- package/dist/{cli-7sf9sb0w.js → cli-2m6yaq6b.js} +1 -1
- package/dist/{cli-6cwr32fe.js → cli-2tw284hj.js} +422 -140
- package/dist/{cli-6ehs4mta.js → cli-2z2c4k6q.js} +18 -4
- package/dist/{cli-nstkanmx.js → cli-39qm0rtm.js} +8 -8
- package/dist/{cli-hnamkvnc.js → cli-3p288654.js} +2 -2
- package/dist/{cli-4ymxrwg5.js → cli-4dyzzkfb.js} +2 -2
- package/dist/{cli-3kd08rej.js → cli-4jjrhy48.js} +1 -1
- package/dist/{cli-kxn3747f.js → cli-4se3x6qm.js} +1 -26
- package/dist/cli-52nfye5j.js +673 -0
- package/dist/cli-55tc8cj4.js +252 -0
- package/dist/cli-5r95eqbh.js +186 -0
- package/dist/{cli-6037prsx.js → cli-5tg94mdw.js} +13 -13
- package/dist/{cli-2spnz7ye.js → cli-5x03v6en.js} +11137 -8332
- package/dist/{cli-y4ccxtz5.js → cli-5z0g0e8v.js} +153 -6
- package/dist/{cli-8y43jx2r.js → cli-6p8p2e6r.js} +16 -9
- package/dist/{cli-539h29es.js → cli-72yms3ey.js} +224 -189
- package/dist/{cli-y8p78ekx.js → cli-73q4g5nx.js} +21 -21
- package/dist/{cli-p74md7t8.js → cli-7b7rxz22.js} +13 -15
- package/dist/{cli-43ms35q9.js → cli-7wy8gbwb.js} +3 -3
- package/dist/{cli-7mv4h3sn.js → cli-7yn42w6m.js} +2 -2
- package/dist/{cli-gabsjg8x.js → cli-8hp56wat.js} +3 -2
- package/dist/cli-8mfdbdhe.js +43 -0
- package/dist/{cli-zcfpsfzf.js → cli-96234j5w.js} +3 -3
- package/dist/{cli-1z4qggfe.js → cli-9fvk9mv8.js} +30 -21
- package/dist/{cli-2rnd5j3t.js → cli-9qe5y107.js} +2 -2
- package/dist/{cli-5mpy301f.js → cli-9t7syepg.js} +1 -1
- package/dist/{cli-7cp6aa1q.js → cli-9y4tgrkf.js} +23 -177
- package/dist/{cli-7evph51z.js → cli-a49frv85.js} +2 -2
- package/dist/{cli-3aaeb78m.js → cli-agjbj5x0.js} +95 -10
- package/dist/{cli-th1dkc2v.js → cli-b93d81yg.js} +2 -2
- package/dist/{cli-qj39vrc6.js → cli-bhgrhedp.js} +1 -1
- package/dist/{cli-2xv18ywz.js → cli-bmqp0ser.js} +2 -2
- package/dist/{cli-9fjr27ez.js → cli-bp6k9acz.js} +18 -22
- package/dist/{cli-5a6pqy45.js → cli-bpje8n65.js} +31 -4
- package/dist/{cli-2v2zdm0a.js → cli-bz97ff9n.js} +2 -2
- package/dist/{cli-3caf7pmg.js → cli-c7j31hq9.js} +3 -3
- package/dist/{cli-t9ga4qmb.js → cli-cah298e5.js} +40 -33
- package/dist/{cli-aw83sr40.js → cli-cjqyse9q.js} +3 -3
- package/dist/{cli-b6px1k1q.js → cli-dd2k2mcd.js} +1 -1
- package/dist/{cli-nv4xsvmk.js → cli-dkvtfgn4.js} +7 -7
- package/dist/{cli-7r162fxe.js → cli-e3ahxq5y.js} +23 -17
- package/dist/{cli-3et6fmfe.js → cli-e8n0hdzd.js} +1 -1
- package/dist/{cli-tsa40663.js → cli-ebqx630g.js} +3 -3
- package/dist/{cli-kbtzfrxj.js → cli-en6dmkxd.js} +3 -3
- package/dist/{cli-m9cvf7vs.js → cli-eq4kew31.js} +14 -14
- package/dist/{cli-fcfbct2j.js → cli-eqq0hwvx.js} +5 -5
- package/dist/{cli-7zm3b3f5.js → cli-ercwc8xn.js} +1 -1
- package/dist/{cli-vs9vdpy0.js → cli-ex1y88j3.js} +1 -1
- package/dist/{cli-mk7c5ac4.js → cli-fxd1mwtr.js} +2 -2
- package/dist/{cli-91pkxres.js → cli-fy4gb74g.js} +2 -2
- package/dist/{cli-fq2rr3jb.js → cli-fyaq4zdv.js} +6 -6
- package/dist/{cli-cc93xzes.js → cli-gfy6hbd9.js} +28 -17
- package/dist/{cli-s1khw52h.js → cli-h70a2mxy.js} +71 -17
- package/dist/cli-hbvgzjq4.js +69 -0
- package/dist/{cli-qx4f057j.js → cli-hhc47ack.js} +4 -4
- package/dist/{cli-q5srsxq2.js → cli-j5gtytvg.js} +154 -41
- package/dist/{cli-psffsanb.js → cli-js10kdk7.js} +6 -1
- package/dist/{cli-54vrpgm0.js → cli-k3facve0.js} +8 -5
- package/dist/{cli-vsw91x06.js → cli-k5jx8jya.js} +10 -6
- package/dist/{cli-tr27kwyg.js → cli-krbcr00p.js} +261 -6
- package/dist/{cli-5qhfv9rw.js → cli-kwr5qv5g.js} +44 -17
- package/dist/{cli-md50mj0r.js → cli-m5qtmrbc.js} +3 -3
- package/dist/{cli-vfqvrd82.js → cli-ma9ys8rt.js} +2 -2
- package/dist/{cli-w16kwbzw.js → cli-mbwmqb5w.js} +1 -1
- package/dist/{cli-w1q68d8x.js → cli-mcymtvwn.js} +322 -72
- package/dist/{cli-k3q2va86.js → cli-mq2fbgva.js} +66 -5
- package/dist/{cli-xqdz5cqm.js → cli-mz7ycqn8.js} +1 -0
- package/dist/{cli-kpgcm7xy.js → cli-n85m2wkq.js} +1 -1
- package/dist/{cli-v8z0yga9.js → cli-n8f0fs3c.js} +4 -4
- package/dist/{cli-mys27d03.js → cli-nja15knq.js} +3 -3
- package/dist/{cli-zk7v5s89.js → cli-pe3yxedk.js} +3 -3
- package/dist/{cli-v46zsvqk.js → cli-ph95yejc.js} +2 -2
- package/dist/{cli-6237rnyr.js → cli-pqfecppn.js} +1 -1
- package/dist/{cli-qrta34nb.js → cli-q2dywc8h.js} +4 -4
- package/dist/{cli-k6nejceb.js → cli-q4z9s6zs.js} +2 -2
- package/dist/{cli-s1zqk1aj.js → cli-q8tc22bj.js} +15 -9
- package/dist/{cli-hg42n3hx.js → cli-qrzq3hvg.js} +8 -8
- package/dist/{cli-43evxwj4.js → cli-r0mz92by.js} +9 -4
- package/dist/{cli-jrbq4djp.js → cli-r14ac1y0.js} +1 -1
- package/dist/{cli-5gpqgs8b.js → cli-rtmqzat7.js} +2 -2
- package/dist/{cli-tvgqesec.js → cli-s6zk31gr.js} +4 -4
- package/dist/{cli-6ym4jhzp.js → cli-sv2r3bw8.js} +7 -7
- package/dist/{cli-wafmk3fn.js → cli-t75xngj1.js} +12 -12
- package/dist/{cli-x40a0w9j.js → cli-tdk7jtka.js} +1 -1
- package/dist/{cli-zeh2mhkg.js → cli-tm60vtax.js} +1 -1
- package/dist/cli-tsfkcd4v.js +30 -0
- package/dist/{cli-8st34zhr.js → cli-v9ya390t.js} +57 -19
- package/dist/{cli-zfqg6fzn.js → cli-vbppqvte.js} +3 -3
- package/dist/{cli-p0n7b5rz.js → cli-wvjqaqcp.js} +2907 -151
- package/dist/{cli-sb4426be.js → cli-xf4z5bdn.js} +5 -5
- package/dist/{cli-p0c3vtch.js → cli-xm34qj8m.js} +772 -515
- package/dist/{cli-z0m452jr.js → cli-ya3kf4gs.js} +1 -1
- package/dist/{cli-had1p04a.js → cli-yegz2g06.js} +4 -4
- package/dist/{cli-k5yewqgd.js → cli-yfpc6qy9.js} +3 -3
- package/dist/{cli-q2d3e1k1.js → cli-z4f346g5.js} +1 -1
- package/dist/{cli-yab6sh8p.js → cli-zcghfsdg.js} +23 -4
- package/dist/cli.js +34 -30
- package/dist/{cloudflare-workers-ai-system-one-4aysy6rh.js → cloudflare-workers-ai-system-one-w3m0fbf8.js} +2 -2
- package/dist/{codex-adapter-exfdbj73.js → codex-adapter-wc6e4wct.js} +8 -8
- package/dist/{codex-hook-59atdwd8.js → codex-hook-aqtj17yr.js} +1 -1
- package/dist/{codex-login-a239g1ah.js → codex-login-1ven7yje.js} +1 -1
- package/dist/{codex-session-runner-xhznc4g3.js → codex-session-runner-ppfgjd97.js} +9 -9
- package/dist/{commands-d8g349v4.js → commands-tsv2vx5b.js} +3 -3
- package/dist/{controller-mwgdmb8y.js → controller-ye4sdwsy.js} +4 -4
- package/dist/{controllers-connect-5v7qx04j.js → controllers-connect-zn4dg69h.js} +25 -22
- package/dist/core-dxcy02sc.js +41 -0
- package/dist/{cursor-adapter-p2q5h35d.js → cursor-adapter-q2g9vwts.js} +2 -2
- package/dist/{db-wcw0b2j8.js → db-3r1fyr2n.js} +6 -2
- package/dist/{db-qpganbeb.js → db-g111qn9j.js} +3 -3
- package/dist/{devin-adapter-zp4tqq53.js → devin-adapter-t8d86q9x.js} +1 -1
- package/dist/{dispatcher-8d8s49yz.js → dispatcher-4q8s0mx8.js} +22 -19
- package/dist/{docker-09tkkg0n.js → docker-1b41eysj.js} +51 -14
- package/dist/{dsh-adapter-me0twn13.js → dsh-adapter-mmcw1z5s.js} +2 -2
- package/dist/{e2b-3v1e745x.js → e2b-ew8c5j5v.js} +3 -3
- package/dist/{e2b-sm28k0k3.js → e2b-xm60c8ad.js} +6 -6
- package/dist/{easter-egg-3d-wv7w5ty6.js → easter-egg-3d-04ke6hcp.js} +1 -1
- package/dist/{embedding-space-e48xchqa.js → embedding-space-kcdn52vz.js} +6 -6
- package/dist/{embeddings-tgq2afbq.js → embeddings-jnzcd91a.js} +1 -1
- package/dist/{event-bus-xr83x566.js → event-bus-v4ywhc2p.js} +1 -1
- package/dist/{execute-8rhwrk7f.js → execute-74amghty.js} +8 -4
- package/dist/{external-channel-8bt3j2pm.js → external-channel-v9zgxnxz.js} +2 -2
- package/dist/fx-adapter-0ar6pqm3.js +19 -0
- package/dist/{google-generative-ai-bh0djqjp.js → google-generative-ai-sw77egmr.js} +9 -9
- package/dist/{google-vertex-prjbw8dj.js → google-vertex-rrw93g8h.js} +9 -9
- package/dist/grok-adapter-t6m74fb1.js +19 -0
- package/dist/handlers-9kwcrc4k.js +38 -0
- package/dist/{heartbeat-x0056ra5.js → heartbeat-p8pk1msj.js} +25 -22
- package/dist/{hook-a7vmn2st.js → hook-k1h73zd7.js} +5 -5
- package/dist/{hook-mrd2ayxv.js → hook-p5reemds.js} +8 -8
- package/dist/{http-ym9c5svp.js → http-ms1z5xxy.js} +2549 -224
- package/dist/index-23cdfzr6.js +39 -0
- package/dist/{index-01ns1pkw.js → index-76zzxtzf.js} +1 -1
- package/dist/{index-ny60jcat.js → index-fbkqhvvj.js} +40 -18
- package/dist/index-g7kkjs5b.js +38 -0
- package/dist/{index-x6azjwm8.js → index-gjn6qfgn.js} +1 -1
- package/dist/{index-b5wgnm78.js → index-kdmkfjt7.js} +4 -4
- package/dist/{index-p46tvwtx.js → index-kn63q1gr.js} +28 -25
- package/dist/{index-9myfj74s.js → index-kzdqn3dd.js} +3 -3
- package/dist/{index-4a0670yh.js → index-p2f5xg64.js} +6 -6
- package/dist/index-stk36pa5.js +43 -0
- package/dist/{k8s-m56sw868.js → k8s-fy8hbhkg.js} +73 -14
- package/dist/{keepalive-7yxg8z4c.js → keepalive-031js8jz.js} +4 -4
- package/dist/lead-mfggjtfk.js +77 -0
- package/dist/{llama-cpp-classify-nfgswa1m.js → llama-cpp-classify-yvb8vh7w.js} +2 -2
- package/dist/{maintenance-6tefxmk1.js → maintenance-sq9v3qx9.js} +1 -1
- package/dist/{mistral-conversations-tm2vd4gc.js → mistral-conversations-w4bncwbt.js} +7 -7
- package/dist/{node-7qsx5kvm.js → node-z67yjre7.js} +19 -13
- package/dist/{oauth-refresh-sweep-70cavc3a.js → oauth-refresh-sweep-zqmnyvs8.js} +3 -3
- package/dist/object-webhooks-r24wwb5y.js +21 -0
- package/dist/{onboard-fja65z08.js → onboard-p25yhh7t.js} +5 -5
- package/dist/{openai-codex-responses-sxjv60xx.js → openai-codex-responses-70g39cgz.js} +20 -14
- package/dist/{openai-completions-0c7qnhsx.js → openai-completions-cv3hp4h5.js} +18 -11
- package/dist/{openai-decisions-ytp6w6xh.js → openai-decisions-fyq1p9f9.js} +2 -2
- package/dist/{openai-responses-a7h29chp.js → openai-responses-trsvnks6.js} +13 -11
- package/dist/{opencode-adapter-hakkm7yh.js → opencode-adapter-wcjc4zdk.js} +7 -7
- package/dist/{openrouter-images-xr9gme9x.js → openrouter-images-0jj12a2q.js} +6 -6
- package/dist/{otel-impl-7zhnt6gj.js → otel-impl-ff1gf20m.js} +2 -2
- package/dist/{pending-h01yzpx4.js → pending-hxj5yatb.js} +23 -20
- package/dist/{pi-messages-2j0fpqwq.js → pi-messages-zk3g4esn.js} +1 -1
- package/dist/{pi-mono-adapter-f52hz743.js → pi-mono-adapter-vkp4zz7p.js} +19 -18
- package/dist/{pricing-refresh-fzxvk2zf.js → pricing-refresh-9w7gx41w.js} +2 -2
- package/dist/{rbac-roles-9v6vhgbs.js → rbac-roles-84aw10nz.js} +3 -3
- package/dist/{rbac-roles-hfgh8sba.js → rbac-roles-hz74vckp.js} +2 -2
- package/dist/{registry-32b1mft6.js → registry-eeyx1201.js} +1 -1
- package/dist/{render-v2-1rgspxzf.js → render-v2-nrdkg9gf.js} +7 -6
- package/dist/{resume-tqy61x24.js → resume-s6ey36rh.js} +9 -8
- package/dist/{runtime-exkxyx5f.js → runtime-x0b4pyam.js} +2 -2
- package/dist/{session-access-3act7vt4.js → session-access-xv49tk14.js} +4 -4
- package/dist/{session-source-backfill-82qe7fqq.js → session-source-backfill-r5j988ah.js} +3 -3
- package/dist/{setup-ry1vfdef.js → setup-mj0krk1p.js} +1 -1
- package/dist/thread-buffer-temgaqsy.js +41 -0
- package/dist/tree-visibility-cbrsfaar.js +24 -0
- package/dist/{typesafe-system-one-vcfj2ak8.js → typesafe-system-one-qkvkgrcz.js} +2 -2
- package/dist/{user-merge-jobs-bx6bf7db.js → user-merge-jobs-f9d8nwnw.js} +3 -3
- package/dist/{virtual-modules-s0rjzcqq.js → virtual-modules-ns0ryw05.js} +32 -10
- package/dist/{work-objects-z2e5tv03.js → work-objects-pydhzast.js} +25 -22
- package/dist/worker-efcemc22.js +77 -0
- package/dist/{worker-follow-up-y3xeg89w.js → worker-follow-up-9z2xec5e.js} +22 -19
- package/dist/{x-wg164ss9.js → x-3dtaf2r9.js} +2 -2
- package/openapi.json +2040 -559
- package/package.json +15 -11
- package/src/azure-devops/auth.ts +2 -3
- package/src/be/agent-fs-identity.ts +46 -0
- package/src/be/agent-history.ts +215 -0
- package/src/be/db/agents.ts +34 -12
- package/src/be/db/request-composition.ts +190 -0
- package/src/be/db/runtime.ts +15 -0
- package/src/be/db/slack-trees.ts +220 -10
- package/src/be/db/tasks/human-free.ts +3 -2
- package/src/be/db/tasks/write.ts +2 -2
- package/src/be/db/workflow-run-retention.ts +101 -0
- package/src/be/db-client.ts +23 -1
- package/src/be/db-retention-defaults.ts +46 -0
- package/src/be/db-retention.ts +55 -6
- package/src/be/db.ts +2 -0
- package/src/be/mcp-events/catalog.ts +108 -0
- package/src/be/mcp-events/dispatcher.ts +202 -0
- package/src/be/mcp-events/protocol.ts +296 -0
- package/src/be/mcp-events/store.ts +231 -0
- package/src/be/mcp-events/webhook.ts +226 -0
- package/src/be/memory/providers/sqlite-store.ts +110 -24
- package/src/be/memory/review-recall-filter.ts +22 -0
- package/src/be/memory/search-candidates.ts +5 -7
- package/src/be/memory/types.ts +5 -0
- package/src/be/migrations/322_runtime_pool_workspace.sql +8 -0
- package/src/be/migrations/323_slack_task_tree_visibility.sql +9 -0
- package/src/be/migrations/326_slack_reconcile_pages.sql +13 -0
- package/src/be/migrations/327_mcp_event_subscriptions.sql +57 -0
- package/src/be/migrations/329_workflow_run_retention.sql +9 -0
- package/src/be/migrations/330_request_composition.sql +22 -0
- package/src/be/migrations/332_primitive_objects.sql +31 -0
- package/src/be/migrations/334_agent_history.sql +23 -0
- package/src/be/migrations/335_primitive_object_webhooks.sql +36 -0
- package/src/be/model-profile-check.ts +1 -1
- package/src/be/multi-runtime.ts +32 -4
- package/src/be/primitives/boards/elements.ts +717 -0
- package/src/be/primitives/boards/excalifont-metrics.json +516 -0
- package/src/be/primitives/boards/service.ts +121 -0
- package/src/be/primitives/object-webhooks.ts +348 -0
- package/src/be/primitives/objects.ts +686 -0
- package/src/be/primitives/sheets/a1.ts +136 -0
- package/src/be/primitives/sheets/engine-worker.ts +194 -0
- package/src/be/primitives/sheets/engine.ts +199 -0
- package/src/be/primitives/sheets/format.ts +106 -0
- package/src/be/primitives/sheets/service.ts +415 -0
- package/src/be/primitives/write-object.ts +83 -0
- package/src/be/runtime-pools/controllers.ts +18 -3
- package/src/be/runtime-pools/db.ts +15 -4
- package/src/be/runtime-pools/supervisor.ts +42 -2
- package/src/be/script-credential-broker.ts +8 -27
- package/src/be/scripts/typecheck.ts +216 -0
- package/src/be/seed/agent-fs-provision.ts +18 -0
- package/src/be/swarm-config-guard.ts +10 -2
- package/src/be/users.ts +19 -0
- package/src/commands/context-preamble.ts +11 -4
- package/src/commands/credential-outcome-report.ts +33 -9
- package/src/commands/e2b-stack-wizard.tsx +12 -6
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/onboard/steps/harness.tsx +1 -1
- package/src/commands/provider-credentials.ts +1 -0
- package/src/commands/runner.ts +116 -12
- package/src/e2b/env.ts +3 -1
- package/src/extensions/catalog.generated.json +1 -1
- package/src/fs/agent-fs-provider.ts +33 -2
- package/src/github/app.ts +59 -14
- package/src/gitlab/auth.ts +3 -4
- package/src/heartbeat/heartbeat.ts +11 -11
- package/src/http/agent-lifecycle.ts +152 -0
- package/src/http/agents.ts +12 -0
- package/src/http/all-routes.ts +4 -0
- package/src/http/auth.ts +2 -1
- package/src/http/config.ts +2 -1
- package/src/http/core.ts +2 -0
- package/src/http/github-token.ts +66 -0
- package/src/http/index.ts +36 -0
- package/src/http/mcp-user.ts +11 -8
- package/src/http/mcp.ts +58 -42
- package/src/http/object-webhooks.ts +101 -0
- package/src/http/operator-actor.ts +2 -1
- package/src/http/prompt-templates.ts +1 -0
- package/src/http/request-composition.ts +310 -0
- package/src/http/sessions.ts +7 -0
- package/src/http/tasks.ts +6 -1
- package/src/http/tool-schema-estimate.ts +95 -0
- package/src/http/workflows.ts +61 -11
- package/src/integrations/chat-sdk/inbound.ts +2 -2
- package/src/integrations/chat-sdk/outbound-files.ts +3 -2
- package/src/prompts/base-prompt.ts +133 -7
- package/src/prompts/resolver.ts +41 -2
- package/src/providers/acp-targets.ts +2 -2
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/opencode-adapter.ts +76 -2
- package/src/providers/opencode-swarm-plugin.ts +22 -3
- package/src/providers/pi-mono-adapter.ts +1 -0
- package/src/providers/pi-mono-extension.ts +71 -0
- package/src/providers/pricing-sources.md +4 -0
- package/src/providers/request-composition-hook.ts +312 -0
- package/src/providers/types.ts +5 -0
- package/src/rbac/legacy-policy.ts +2 -0
- package/src/rbac/permissions.ts +5 -0
- package/src/runtime-providers/controller-protocol.ts +7 -0
- package/src/runtime-providers/docker.ts +80 -12
- package/src/runtime-providers/k8s.ts +111 -6
- package/src/runtime-providers/types.ts +17 -0
- package/src/scheduler/scheduler.ts +1 -1
- package/src/script-workflows/guest-ctx.ts +32 -0
- package/src/script-workflows/workflow-ctx.ts +2 -0
- package/src/scripts-runtime/ctx.ts +9 -1
- package/src/scripts-runtime/executors/native.ts +106 -21
- package/src/scripts-runtime/executors/quickjs-prelude.ts +9 -2
- package/src/scripts-runtime/executors/quickjs-runner.ts +12 -1
- package/src/scripts-runtime/sdk-allowlist.ts +88 -0
- package/src/scripts-runtime/swarm-sdk.ts +51 -3
- package/src/scripts-runtime/types/stdlib.d.ts +267 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +267 -0
- package/src/server-user.ts +16 -1
- package/src/server.ts +48 -0
- package/src/slack/ack.ts +10 -5
- package/src/slack/actions.ts +3 -3
- package/src/slack/app.ts +2 -0
- package/src/slack/assistant.ts +4 -4
- package/src/slack/blocks.ts +3 -3
- package/src/slack/handlers.ts +3 -3
- package/src/slack/reaction-shortcode.ts +23 -2
- package/src/slack/render-v2.ts +297 -200
- package/src/slack/responses.ts +7 -5
- package/src/slack/thread-buffer.ts +3 -3
- package/src/slack/tree-visibility.ts +64 -0
- package/src/tasks/worker-follow-up.ts +127 -17
- package/src/tests/agent-history.test.ts +313 -0
- package/src/tests/azure-devops-auth.test.ts +6 -0
- package/src/tests/azure-devops-outbound.test.ts +47 -14
- package/src/tests/base-prompt.test.ts +149 -1
- package/src/tests/chat-sdk-outbound-files.test.ts +3 -1
- package/src/tests/check-playwright-version.test.ts +33 -0
- package/src/tests/check-unit-test-allowlist.test.ts +193 -0
- package/src/tests/context-preamble-budget.test.ts +65 -0
- package/src/tests/credential-check.test.ts +12 -0
- package/src/tests/credential-outcome-report.test.ts +81 -1
- package/src/tests/db-client.test.ts +22 -0
- package/src/tests/db-retention-defaults.test.ts +244 -0
- package/src/tests/db-retention.test.ts +2 -1
- package/src/tests/db-task-read-contract.test.ts +2 -0
- package/src/tests/db-task-write-contract.test.ts +2 -0
- package/src/tests/deploy-release-dispatch.test.ts +332 -0
- package/src/tests/e2b-stack-wizard.test.tsx +156 -0
- package/src/tests/e2e-coverage-contract.test.ts +6 -2
- package/src/tests/e2e-diff-coverage.test.ts +154 -0
- package/src/tests/e2e-rerun-quarantine.test.ts +180 -0
- package/src/tests/e2e-shards.test.ts +137 -0
- package/src/tests/e2e-tracker-ingest.test.ts +266 -0
- package/src/tests/entrypoint-chown-no-follow.test.ts +69 -0
- package/src/tests/entrypoint-repo-clone-target.test.ts +112 -0
- package/src/tests/env-flag.test.ts +4 -2
- package/src/tests/event-loop-lag.test.ts +12 -18
- package/src/tests/extensions-example-slack-reply-gate.test.ts +15 -0
- package/src/tests/extensions-heartbeat.test.ts +34 -0
- package/src/tests/fixtures/base-prompt-baseline-cases.ts +78 -0
- package/src/tests/fixtures/base-prompt-baseline.json +18 -0
- package/src/tests/github-app-worker-auth-helper.test.ts +325 -0
- package/src/tests/github-installation-token-route.test.ts +199 -0
- package/src/tests/gitlab-auth.test.ts +10 -0
- package/src/tests/heartbeat.test.ts +38 -0
- package/src/tests/http-api-integration.test.ts +0 -6
- package/src/tests/mcp-user-events.test.ts +708 -0
- package/src/tests/memory-key-paths.test.ts +4 -1
- package/src/tests/memory-search-stall.test.ts +421 -0
- package/src/tests/migration-322-runtime-pool-workspace.test.ts +116 -0
- package/src/tests/migration-329-workflow-run-retention.test.ts +32 -0
- package/src/tests/model-profile-fallbacks.test.ts +236 -2
- package/src/tests/opencode-adapter.test.ts +97 -0
- package/src/tests/pi-mono-extension.test.ts +168 -0
- package/src/tests/preload-env.test.ts +61 -1
- package/src/tests/preload.ts +22 -0
- package/src/tests/primitives-boards.test.ts +686 -0
- package/src/tests/primitives-object-webhooks.test.ts +642 -0
- package/src/tests/primitives-objects.test.ts +248 -0
- package/src/tests/prompt-template-resolver.test.ts +85 -0
- package/src/tests/reasoning-kind-ui-parity.test.ts +112 -0
- package/src/tests/reload-config.test.ts +45 -0
- package/src/tests/request-composition.test.ts +447 -0
- package/src/tests/runner-max-concurrent.test.ts +86 -0
- package/src/tests/runtime-pools-db.test.ts +80 -0
- package/src/tests/runtime-provider-registration.test.ts +8 -0
- package/src/tests/runtime-providers-docker.test.ts +192 -1
- package/src/tests/runtime-providers-k8s.test.ts +127 -0
- package/src/tests/runtime-remote-controller.test.ts +64 -1
- package/src/tests/runtime-supervisor.test.ts +101 -0
- package/src/tests/script-connections.test.ts +8 -0
- package/src/tests/script-native-sandbox-identity.test.ts +264 -0
- package/src/tests/scripts-namespaces.test.ts +211 -0
- package/src/tests/secret-scrub-gate.test.ts +1 -0
- package/src/tests/secret-scrubber-convex.test.ts +168 -0
- package/src/tests/secret-scrubber.test.ts +1 -1
- package/src/tests/session-tokens.test.ts +27 -0
- package/src/tests/sheet-engine.test.ts +58 -0
- package/src/tests/slack-blocks.test.ts +18 -0
- package/src/tests/slack-empty-icon-config.test.ts +113 -0
- package/src/tests/slack-file-tools-attachments.test.ts +74 -6
- package/src/tests/slack-reaction-config.test.ts +38 -2
- package/src/tests/slack-read-boundaries.test.ts +4 -2
- package/src/tests/slack-render-v2-query-plans.test.ts +100 -1
- package/src/tests/slack-render-v2-reconcile.test.ts +75 -4
- package/src/tests/slack-render-v2.test.ts +683 -11
- package/src/tests/swarm-config-reserved-keys.test.ts +1 -0
- package/src/tests/task-session-prompts.test.ts +37 -0
- package/src/tests/task-start-after-commit.test.ts +82 -0
- package/src/tests/ui-logs-parser.test.ts +67 -0
- package/src/tests/user-delete-perf.test.ts +36 -9
- package/src/tests/webhook-filter.test.ts +327 -0
- package/src/tests/workflow-async-v2.test.ts +19 -16
- package/src/tests/workflow-e2e.test.ts +1 -9
- package/src/tests/workflow-finalization-races.test.ts +553 -0
- package/src/tests/workflow-foreach.test.ts +2 -0
- package/src/tests/workflow-hitl-routing.test.ts +26 -20
- package/src/tests/workflow-http-v2.test.ts +105 -2
- package/src/tests/workflow-idempotency.test.ts +41 -0
- package/src/tests/workflow-mcp-webhook-filter.test.ts +214 -0
- package/src/tests/workflow-parallel-park.test.ts +297 -0
- package/src/tests/workflow-retry-v2.test.ts +158 -21
- package/src/tests/workflow-retry-validation.test.ts +13 -13
- package/src/tests/workflow-runs-retention.test.ts +533 -0
- package/src/tests/workflow-script-principal.test.ts +7 -2
- package/src/tests/workflow-tla-races.test.ts +36 -2
- package/src/tests/workflow-triggers-v2.test.ts +201 -0
- package/src/tests/workflow-wait-builtin-events.test.ts +3 -1
- package/src/tests/workflow-wait-event.test.ts +28 -2
- package/src/tests/workflow-wait-poller.test.ts +94 -0
- package/src/tests/workflow-wait-time.test.ts +7 -3
- package/src/tests/workflow-wait.ts +44 -0
- package/src/tools/boards.ts +260 -0
- package/src/tools/objects.ts +191 -0
- package/src/tools/sheets.ts +312 -0
- package/src/tools/slack-read.ts +10 -3
- package/src/tools/tool-config.ts +23 -0
- package/src/tools/workflows/create-workflow.ts +18 -4
- package/src/tools/workflows/patch-workflow-node.ts +4 -0
- package/src/tools/workflows/patch-workflow.ts +4 -0
- package/src/tools/workflows/update-workflow.ts +24 -3
- package/src/types.ts +216 -2
- package/src/utils/credentials.ts +7 -0
- package/src/utils/sandboxed-process.ts +47 -2
- package/src/utils/secret-scrubber.ts +61 -6
- package/src/workflows/checkpoint.ts +18 -0
- package/src/workflows/engine.ts +73 -31
- package/src/workflows/foreach-driver.ts +42 -4
- package/src/workflows/input.ts +29 -1
- package/src/workflows/patch-definition.ts +15 -1
- package/src/workflows/recovery.ts +6 -1
- package/src/workflows/resume.ts +11 -3
- package/src/workflows/retry-poller.ts +32 -6
- package/src/workflows/successor-routing.ts +108 -0
- package/src/workflows/task-step-routing.ts +5 -2
- package/src/workflows/triggers.ts +21 -36
- package/src/workflows/validation.ts +10 -0
- package/src/workflows/wait-poller.ts +6 -2
- package/src/workflows/webhook-filter.ts +203 -0
- package/templates/ai-toolbox.manifest.json +1 -1
- package/templates/extensions/slack-reply-gate/hooks.ts +8 -4
- package/templates/skills/agent-browser/SKILL.md +1 -0
- package/templates/skills/agent-browser/content.md +1 -0
- package/templates/skills/pages/content.md +5 -0
- package/templates/skills/swarm-docs/content.md +8 -1
- package/templates/skills/swarm-scripts/SKILL.md +1 -0
- package/templates/skills/swarm-scripts/content.md +1 -0
- package/templates/skills/tdd-planning/content.md +5 -2
- package/dist/acp-adapter-bht22g3k.js +0 -16
- package/dist/core-sxy4epp2.js +0 -38
- package/dist/fx-adapter-adtdb3jb.js +0 -19
- package/dist/grok-adapter-accnn9km.js +0 -19
- package/dist/handlers-1x77561e.js +0 -35
- package/dist/index-48qzcqzj.js +0 -35
- package/dist/index-rkvaambe.js +0 -36
- package/dist/index-xj1mq27m.js +0 -40
- package/dist/lead-enzn86bz.js +0 -74
- package/dist/thread-buffer-3x93yexa.js +0 -38
- package/dist/worker-zfcv2wbf.js +0 -74
- package/src/slack/socket-mode-guard.test.ts +0 -25
- package/src/tests/agent-activity.test.ts +0 -247
- package/src/tests/agent-fs-live-url.test.ts +0 -55
- package/src/tests/agentmail-inbox-mapping.test.ts +0 -73
- package/src/tests/approval-sweeps-config.test.ts +0 -47
- package/src/tests/cards.test.ts +0 -169
- package/src/tests/chat-sdk-facts.test.ts +0 -23
- package/src/tests/config-env-export-chat-sdk.test.ts +0 -11
- package/src/tests/core-auth.test.ts +0 -156
- package/src/tests/date-utils.test.ts +0 -48
- package/src/tests/db-context-versions.test.ts +0 -37
- package/src/tests/db-runtime.test.ts +0 -131
- package/src/tests/enabled-capabilities.test.ts +0 -20
- package/src/tests/extensions-example-mcp-install.test.ts +0 -67
- package/src/tests/extensions-lead-equivalence.test.ts +0 -70
- package/src/tests/get-workflow-run-tool.test.ts +0 -98
- package/src/tests/github-event-labels.test.ts +0 -24
- package/src/tests/haiku-5-5-pricing.test.ts +0 -38
- package/src/tests/http-log-scrubbing.test.ts +0 -123
- package/src/tests/http-semconv-attributes.test.ts +0 -92
- package/src/tests/identity.test.ts +0 -117
- package/src/tests/inbox-state.test.ts +0 -167
- package/src/tests/internal-ai/models.test.ts +0 -54
- package/src/tests/launch-password-rejection.test.ts +0 -140
- package/src/tests/list-total-cache.test.ts +0 -88
- package/src/tests/match-route.test.ts +0 -187
- package/src/tests/memory-feature-flags.test.ts +0 -45
- package/src/tests/memory-get-tool.test.ts +0 -269
- package/src/tests/memory-health-endpoint.test.ts +0 -78
- package/src/tests/memory-http-access.test.ts +0 -221
- package/src/tests/memory-retrieval-purge.test.ts +0 -99
- package/src/tests/multi-runtime-enabled-stats.test.ts +0 -229
- package/src/tests/openai-embedding-provider.test.ts +0 -159
- package/src/tests/org-identity.test.ts +0 -44
- package/src/tests/pages-actions-endpoint.test.ts +0 -103
- package/src/tests/pages-browser-sdk.test.ts +0 -76
- package/src/tests/pages-feedback-keys.test.ts +0 -121
- package/src/tests/pages-frame-ancestors.test.ts +0 -189
- package/src/tests/pages-list-endpoint.test.ts +0 -148
- package/src/tests/pages-password-mode.test.ts +0 -266
- package/src/tests/pages-public-authed-401.test.ts +0 -103
- package/src/tests/pages-public-html.test.ts +0 -297
- package/src/tests/pages-public-json-redirect.test.ts +0 -122
- package/src/tests/pages-view-count.test.ts +0 -245
- package/src/tests/prompt-templates-db.test.ts +0 -616
- package/src/tests/rbac-engine.test.ts +0 -742
- package/src/tests/repo-allow-merge-gate.test.ts +0 -389
- package/src/tests/route-def-find-route.test.ts +0 -192
- package/src/tests/runtime-stale-threshold.test.ts +0 -40
- package/src/tests/schedule-validation-helper.test.ts +0 -51
- package/src/tests/scheduled-tasks-api.test.ts +0 -355
- package/src/tests/scheduler-backoff.test.ts +0 -166
- package/src/tests/script-run-token.test.ts +0 -75
- package/src/tests/scripts-extract-signature.test.ts +0 -47
- package/src/tests/scripts-sdk-bridge-tool-failure.test.ts +0 -141
- package/src/tests/seed-workflow-dreaming.test.ts +0 -117
- package/src/tests/short-id.test.ts +0 -23
- package/src/tests/skill-files-http.test.ts +0 -222
- package/src/tests/skill-get-file-tool.test.ts +0 -110
- package/src/tests/skill-script-refs.test.ts +0 -63
- package/src/tests/skill-update-scope.test.ts +0 -252
- package/src/tests/skills-bundle.test.ts +0 -99
- package/src/tests/slack-app-icon.test.ts +0 -94
- package/src/tests/slack-assistant-comention.test.ts +0 -139
- package/src/tests/slack-delete.test.ts +0 -157
- package/src/tests/slack-inbound-diagnostics-auth.test.ts +0 -93
- package/src/tests/slack-manifest.test.ts +0 -23
- package/src/tests/slack-task-output.test.ts +0 -90
- package/src/tests/store-progress-output-guidance.test.ts +0 -34
- package/src/tests/swarm-diff.test.ts +0 -728
- package/src/tests/task-lifecycle-events.test.ts +0 -53
- package/src/tests/template-asset-config.test.ts +0 -18
- package/src/tests/template-fetch.test.ts +0 -490
- package/src/tests/themes-page-theme.test.ts +0 -155
- package/src/tests/tool-annotations.test.ts +0 -442
- package/src/tests/tool-output-agent-id.test.ts +0 -202
- package/src/tests/update-profile-agentid.test.ts +0 -248
- package/src/tests/whoami-route.test.ts +0 -162
- package/src/tests/workflow-definition-telemetry.test.ts +0 -134
- package/src/tests/workflow-patch.test.ts +0 -169
- package/src/tests/workflow-run-steps-index.test.ts +0 -65
- package/src/tests/workflow-schedule-trigger.test.ts +0 -104
- package/src/tests/workflow-step-claims.test.ts +0 -152
- package/src/tests/workflow-step-order.test.ts +0 -92
- package/src/tests/workflow-trigger-schema.test.ts +0 -359
- package/src/tests/workflow-versions.test.ts +0 -240
|
@@ -176,6 +176,7 @@ import {
|
|
|
176
176
|
init_model_catalog_store,
|
|
177
177
|
explicitModelErrorForAgent,
|
|
178
178
|
init_model_validation2,
|
|
179
|
+
configPools,
|
|
179
180
|
checkProfileForAgent,
|
|
180
181
|
init_model_profile_check,
|
|
181
182
|
rowToAgentTask,
|
|
@@ -206,6 +207,7 @@ import {
|
|
|
206
207
|
countAgentDispatchesInThread2,
|
|
207
208
|
findRecentCancelledTaskInThread2,
|
|
208
209
|
init_read,
|
|
210
|
+
hasUnreadableCredentialAllowlist,
|
|
209
211
|
listModelProfiles,
|
|
210
212
|
getModelProfileByName,
|
|
211
213
|
modelProfileRefError,
|
|
@@ -374,6 +376,7 @@ import {
|
|
|
374
376
|
installMcpServer2,
|
|
375
377
|
uninstallMcpServer2,
|
|
376
378
|
getAgentMcpServers2,
|
|
379
|
+
getAvailableKeyIndices2,
|
|
377
380
|
getUserById2,
|
|
378
381
|
getAllUsers2,
|
|
379
382
|
createUser2,
|
|
@@ -400,27 +403,27 @@ import {
|
|
|
400
403
|
recordInlineScriptRun2,
|
|
401
404
|
exports_db,
|
|
402
405
|
init_db4
|
|
403
|
-
} from "./cli-
|
|
406
|
+
} from "./cli-12vek61e.js";
|
|
404
407
|
import {
|
|
405
408
|
assertMayActOnOperatorGrantedTarget2,
|
|
406
409
|
getUserGrant2,
|
|
407
410
|
init_rbac_roles
|
|
408
|
-
} from "./cli-
|
|
411
|
+
} from "./cli-ma9ys8rt.js";
|
|
409
412
|
import {
|
|
410
413
|
ensurePricingSeeded2,
|
|
411
414
|
ensureRbacSeeded2,
|
|
412
415
|
ensureModelProfilesSeeded2,
|
|
413
416
|
init_boot_seeds
|
|
414
|
-
} from "./cli-
|
|
417
|
+
} from "./cli-nja15knq.js";
|
|
415
418
|
import {
|
|
416
419
|
requestModelCatalogRefresh2,
|
|
417
420
|
startPricingRefreshLoop2,
|
|
418
421
|
init_pricing_refresh
|
|
419
|
-
} from "./cli-
|
|
422
|
+
} from "./cli-b93d81yg.js";
|
|
420
423
|
import {
|
|
421
424
|
workflowEventBus2,
|
|
422
425
|
init_event_bus
|
|
423
|
-
} from "./cli-
|
|
426
|
+
} from "./cli-z4f346g5.js";
|
|
424
427
|
import {
|
|
425
428
|
slackCode,
|
|
426
429
|
slackMissingScopeMessage,
|
|
@@ -429,7 +432,7 @@ import {
|
|
|
429
432
|
externalChannelToolError2,
|
|
430
433
|
getChannelBlockReason2,
|
|
431
434
|
init_external_channel
|
|
432
|
-
} from "./cli-
|
|
435
|
+
} from "./cli-fxd1mwtr.js";
|
|
433
436
|
import {
|
|
434
437
|
tableToAscii2,
|
|
435
438
|
init_dist8
|
|
@@ -491,8 +494,8 @@ import {
|
|
|
491
494
|
getSlackApp2,
|
|
492
495
|
startSlackApp2,
|
|
493
496
|
stopSlackAppUnderLifecycleLock2,
|
|
494
|
-
|
|
495
|
-
} from "./cli-
|
|
497
|
+
init_app4
|
|
498
|
+
} from "./cli-72yms3ey.js";
|
|
496
499
|
import {
|
|
497
500
|
AGENT_MAX_TASKS_CONFIG_KEY,
|
|
498
501
|
resetAgentMaxTasksMirror,
|
|
@@ -513,7 +516,7 @@ import {
|
|
|
513
516
|
postApprovalCancellationUpdates2,
|
|
514
517
|
createApprovalFollowUpTask2,
|
|
515
518
|
init_approval_notifications
|
|
516
|
-
} from "./cli-
|
|
519
|
+
} from "./cli-gfy6hbd9.js";
|
|
517
520
|
import {
|
|
518
521
|
shapeApprovalResolution,
|
|
519
522
|
init_approval_resolution,
|
|
@@ -537,21 +540,15 @@ import {
|
|
|
537
540
|
resumeFromChildRun2,
|
|
538
541
|
initWaitBusSubscriptions2,
|
|
539
542
|
init_resume
|
|
540
|
-
} from "./cli-
|
|
543
|
+
} from "./cli-e3ahxq5y.js";
|
|
541
544
|
import {
|
|
542
|
-
FilesError,
|
|
543
|
-
providerPath,
|
|
544
|
-
normalizeStoredKey,
|
|
545
|
-
init_provider,
|
|
546
|
-
AgentFsProvider,
|
|
547
|
-
init_agent_fs_provider,
|
|
548
545
|
getFileStorageProvider2,
|
|
549
546
|
init_registry2
|
|
550
|
-
} from "./cli-
|
|
547
|
+
} from "./cli-5r95eqbh.js";
|
|
551
548
|
import {
|
|
552
549
|
getRuntimePool2,
|
|
553
550
|
init_db2
|
|
554
|
-
} from "./cli-
|
|
551
|
+
} from "./cli-q8tc22bj.js";
|
|
555
552
|
import {
|
|
556
553
|
duplicateGuardedQueryKey,
|
|
557
554
|
parseQueryParams,
|
|
@@ -587,17 +584,17 @@ import {
|
|
|
587
584
|
findRoute,
|
|
588
585
|
route,
|
|
589
586
|
init_route_def
|
|
590
|
-
} from "./cli-
|
|
587
|
+
} from "./cli-39qm0rtm.js";
|
|
591
588
|
import {
|
|
592
589
|
COMPOSIO_HTTP_METHODS,
|
|
593
590
|
executeComposioRequest,
|
|
594
591
|
composioArgsFromParts,
|
|
595
592
|
init_composio
|
|
596
|
-
} from "./cli-
|
|
593
|
+
} from "./cli-ercwc8xn.js";
|
|
597
594
|
import {
|
|
598
595
|
object,
|
|
599
596
|
init_v4_mini
|
|
600
|
-
} from "./cli-
|
|
597
|
+
} from "./cli-vbppqvte.js";
|
|
601
598
|
import {
|
|
602
599
|
addMinutes,
|
|
603
600
|
init_date_fns
|
|
@@ -610,7 +607,7 @@ import {
|
|
|
610
607
|
init_types2,
|
|
611
608
|
LlmRater,
|
|
612
609
|
init_llm
|
|
613
|
-
} from "./cli-
|
|
610
|
+
} from "./cli-bmqp0ser.js";
|
|
614
611
|
import {
|
|
615
612
|
require_dist,
|
|
616
613
|
ConnectionAuthInputSchema,
|
|
@@ -689,7 +686,7 @@ import {
|
|
|
689
686
|
init_typecheck,
|
|
690
687
|
parseSkillContent,
|
|
691
688
|
init_skill_parser
|
|
692
|
-
} from "./cli-
|
|
689
|
+
} from "./cli-mcymtvwn.js";
|
|
693
690
|
import {
|
|
694
691
|
detachedProcessGroup,
|
|
695
692
|
registerProcessGroup,
|
|
@@ -704,13 +701,57 @@ import {
|
|
|
704
701
|
ensureToken,
|
|
705
702
|
ensureTokenOrThrow,
|
|
706
703
|
init_ensure_token
|
|
707
|
-
} from "./cli-
|
|
704
|
+
} from "./cli-9qe5y107.js";
|
|
705
|
+
import {
|
|
706
|
+
A1Error,
|
|
707
|
+
refOf,
|
|
708
|
+
parseCell,
|
|
709
|
+
parseRange,
|
|
710
|
+
capToUsed,
|
|
711
|
+
formatRange,
|
|
712
|
+
areaOf,
|
|
713
|
+
assertInBounds,
|
|
714
|
+
init_a1,
|
|
715
|
+
MAX_TABS,
|
|
716
|
+
MAX_CELLS,
|
|
717
|
+
MAX_FILE_BYTES,
|
|
718
|
+
MAX_RANGE_CELLS,
|
|
719
|
+
SheetDocSchema,
|
|
720
|
+
checkTabName,
|
|
721
|
+
newTab,
|
|
722
|
+
usedExtent,
|
|
723
|
+
constantInput,
|
|
724
|
+
init_format,
|
|
725
|
+
PRIMITIVE_KINDS,
|
|
726
|
+
PRIMITIVE_KIND_NAMES,
|
|
727
|
+
ObjectsError,
|
|
728
|
+
NO_AGENT_FS_IDENTITY,
|
|
729
|
+
clientFor,
|
|
730
|
+
createObject,
|
|
731
|
+
getObject,
|
|
732
|
+
recordObjectVersion,
|
|
733
|
+
listObjects,
|
|
734
|
+
reindexObjects,
|
|
735
|
+
init_objects
|
|
736
|
+
} from "./cli-52nfye5j.js";
|
|
737
|
+
import {
|
|
738
|
+
agentFsClientFor,
|
|
739
|
+
init_agent_fs_identity
|
|
740
|
+
} from "./cli-hbvgzjq4.js";
|
|
741
|
+
import {
|
|
742
|
+
FilesError,
|
|
743
|
+
providerPath,
|
|
744
|
+
normalizeStoredKey,
|
|
745
|
+
init_provider,
|
|
746
|
+
AgentFsProvider,
|
|
747
|
+
init_agent_fs_provider
|
|
748
|
+
} from "./cli-9y4tgrkf.js";
|
|
708
749
|
import {
|
|
709
750
|
SLACK_LEAVE_THREAD_DISABLE,
|
|
710
751
|
isSlackLeaveThreadDisabled,
|
|
711
752
|
leaveSlackThread,
|
|
712
753
|
init_left_threads
|
|
713
|
-
} from "./cli-
|
|
754
|
+
} from "./cli-r14ac1y0.js";
|
|
714
755
|
import {
|
|
715
756
|
require_fast_deep_equal
|
|
716
757
|
} from "./cli-bhp11egn.js";
|
|
@@ -738,6 +779,7 @@ import {
|
|
|
738
779
|
SystemOneDecisionConfigSchema,
|
|
739
780
|
SystemOneDecisionExecutor,
|
|
740
781
|
init_system_one_decision,
|
|
782
|
+
adoptStoredContext,
|
|
741
783
|
checkpointStep,
|
|
742
784
|
checkpointStepFailure,
|
|
743
785
|
checkpointStepWaiting,
|
|
@@ -748,6 +790,9 @@ import {
|
|
|
748
790
|
loadCompletedStepRouting,
|
|
749
791
|
init_completed_step_routing,
|
|
750
792
|
resolveInputValue,
|
|
793
|
+
serverRefInputKeys,
|
|
794
|
+
serverRefInputDeniedMessage,
|
|
795
|
+
agentMaySetServerRefInput,
|
|
751
796
|
getSecretInputKeys,
|
|
752
797
|
init_input,
|
|
753
798
|
validateJsonSchema,
|
|
@@ -756,7 +801,10 @@ import {
|
|
|
756
801
|
workflowSaveWarnings,
|
|
757
802
|
withSaveWarnings,
|
|
758
803
|
init_readiness,
|
|
804
|
+
hasOwedSuccessors,
|
|
805
|
+
init_successor_routing,
|
|
759
806
|
init_template,
|
|
807
|
+
validateOutputSchema,
|
|
760
808
|
runStepValidation,
|
|
761
809
|
init_validation,
|
|
762
810
|
TriggerSchemaError,
|
|
@@ -788,7 +836,7 @@ import {
|
|
|
788
836
|
validateDefinition,
|
|
789
837
|
applyDefinitionPatch,
|
|
790
838
|
init_definition2
|
|
791
|
-
} from "./cli-
|
|
839
|
+
} from "./cli-j5gtytvg.js";
|
|
792
840
|
import {
|
|
793
841
|
isMultiRuntimeEnabled,
|
|
794
842
|
init_multi_runtime2
|
|
@@ -800,7 +848,7 @@ import {
|
|
|
800
848
|
} from "./cli-ytyvpye5.js";
|
|
801
849
|
import {
|
|
802
850
|
init_v4
|
|
803
|
-
} from "./cli-
|
|
851
|
+
} from "./cli-4jjrhy48.js";
|
|
804
852
|
import {
|
|
805
853
|
require_dist2
|
|
806
854
|
} from "./cli-xf1wn5ns.js";
|
|
@@ -811,11 +859,11 @@ import {
|
|
|
811
859
|
import {
|
|
812
860
|
canProvisionKind,
|
|
813
861
|
init_runtime_providers
|
|
814
|
-
} from "./cli-
|
|
862
|
+
} from "./cli-s6zk31gr.js";
|
|
815
863
|
import {
|
|
816
864
|
publicEndpointSsrfOptions,
|
|
817
865
|
init_mcp_wrapper
|
|
818
|
-
} from "./cli-
|
|
866
|
+
} from "./cli-bz97ff9n.js";
|
|
819
867
|
import {
|
|
820
868
|
findUserById,
|
|
821
869
|
findUserByExternalId,
|
|
@@ -830,7 +878,7 @@ import {
|
|
|
830
878
|
resolveSessionToken,
|
|
831
879
|
fingerprintApiKey,
|
|
832
880
|
init_users
|
|
833
|
-
} from "./cli-
|
|
881
|
+
} from "./cli-k5jx8jya.js";
|
|
834
882
|
import {
|
|
835
883
|
resolveGitHubHost,
|
|
836
884
|
getGitHubLinkConfig,
|
|
@@ -843,7 +891,7 @@ import {
|
|
|
843
891
|
ampBillsCacheWrites,
|
|
844
892
|
resolveAmpModel,
|
|
845
893
|
init_amp_models
|
|
846
|
-
} from "./cli-
|
|
894
|
+
} from "./cli-tm60vtax.js";
|
|
847
895
|
import {
|
|
848
896
|
normalizeAssetKey,
|
|
849
897
|
defaultAssetKey,
|
|
@@ -896,6 +944,8 @@ import {
|
|
|
896
944
|
SUPERSEDED_WORKFLOW_TASK_REASON,
|
|
897
945
|
WorkflowDefinitionSchema,
|
|
898
946
|
WorkflowNodePatchSchema,
|
|
947
|
+
WEBHOOK_FILTER_PRESETS,
|
|
948
|
+
WebhookDeliveryFilterSchema,
|
|
899
949
|
TriggerConfigSchema,
|
|
900
950
|
CooldownConfigSchema,
|
|
901
951
|
InputValueSchema,
|
|
@@ -915,7 +965,7 @@ import {
|
|
|
915
965
|
KvNamespaceSchema,
|
|
916
966
|
KvKeySchema,
|
|
917
967
|
init_types5
|
|
918
|
-
} from "./cli-
|
|
968
|
+
} from "./cli-5z0g0e8v.js";
|
|
919
969
|
import {
|
|
920
970
|
generateDefaultClaudeMd2,
|
|
921
971
|
generateDefaultSoulMd2,
|
|
@@ -926,7 +976,7 @@ import {
|
|
|
926
976
|
init_task_attachment_links,
|
|
927
977
|
contentSha256,
|
|
928
978
|
init_profile_sync
|
|
929
|
-
} from "./cli-
|
|
979
|
+
} from "./cli-agjbj5x0.js";
|
|
930
980
|
import {
|
|
931
981
|
isSteeringEnabled2,
|
|
932
982
|
init_steering_enabled
|
|
@@ -937,9 +987,14 @@ import {
|
|
|
937
987
|
init_config4
|
|
938
988
|
} from "./cli-eetzmsy5.js";
|
|
939
989
|
import {
|
|
990
|
+
modelFamilyOf,
|
|
991
|
+
windowForModelFamily,
|
|
992
|
+
init_model_rate_limit_windows,
|
|
993
|
+
keySuffix,
|
|
994
|
+
splitCredentialPool,
|
|
940
995
|
selectCredential,
|
|
941
996
|
init_credentials2
|
|
942
|
-
} from "./cli-
|
|
997
|
+
} from "./cli-js10kdk7.js";
|
|
943
998
|
import {
|
|
944
999
|
findInterpolationTokens,
|
|
945
1000
|
interpolate,
|
|
@@ -949,12 +1004,12 @@ import {
|
|
|
949
1004
|
init_registry3,
|
|
950
1005
|
resolveTemplate,
|
|
951
1006
|
init_resolver
|
|
952
|
-
} from "./cli-
|
|
1007
|
+
} from "./cli-2z2c4k6q.js";
|
|
953
1008
|
import {
|
|
954
1009
|
init_zod
|
|
955
|
-
} from "./cli-
|
|
1010
|
+
} from "./cli-96234j5w.js";
|
|
956
1011
|
import {
|
|
957
|
-
|
|
1012
|
+
safeParse2,
|
|
958
1013
|
safeParseAsync,
|
|
959
1014
|
toJSONSchema,
|
|
960
1015
|
string2,
|
|
@@ -980,7 +1035,7 @@ import {
|
|
|
980
1035
|
ZodIssueCode,
|
|
981
1036
|
datetime,
|
|
982
1037
|
number3
|
|
983
|
-
} from "./cli-
|
|
1038
|
+
} from "./cli-qrzq3hvg.js";
|
|
984
1039
|
import {
|
|
985
1040
|
MAX_PROFILE_FILE_LENGTH,
|
|
986
1041
|
getConfiguredAppUrls,
|
|
@@ -1002,7 +1057,7 @@ import {
|
|
|
1002
1057
|
import {
|
|
1003
1058
|
init_package,
|
|
1004
1059
|
package_default
|
|
1005
|
-
} from "./cli-
|
|
1060
|
+
} from "./cli-2amwhyv2.js";
|
|
1006
1061
|
import {
|
|
1007
1062
|
getNodeEnv,
|
|
1008
1063
|
isDevOrTestNodeEnv,
|
|
@@ -1022,7 +1077,7 @@ import {
|
|
|
1022
1077
|
registerVolatileSecret,
|
|
1023
1078
|
registerSensitiveKeyName,
|
|
1024
1079
|
init_secret_scrubber
|
|
1025
|
-
} from "./cli-
|
|
1080
|
+
} from "./cli-bpje8n65.js";
|
|
1026
1081
|
import {
|
|
1027
1082
|
__toESM,
|
|
1028
1083
|
__commonJS,
|
|
@@ -1049,9 +1104,9 @@ function objectFromShape(shape) {
|
|
|
1049
1104
|
return objectType(shape);
|
|
1050
1105
|
throw new Error("Mixed Zod versions detected in object shape.");
|
|
1051
1106
|
}
|
|
1052
|
-
function
|
|
1107
|
+
function safeParse(schema, data) {
|
|
1053
1108
|
if (isZ4Schema(schema)) {
|
|
1054
|
-
const result =
|
|
1109
|
+
const result = safeParse2(schema, data);
|
|
1055
1110
|
return result;
|
|
1056
1111
|
}
|
|
1057
1112
|
const v3Schema = schema;
|
|
@@ -3506,7 +3561,7 @@ function getMethodLiteral(schema) {
|
|
|
3506
3561
|
return value;
|
|
3507
3562
|
}
|
|
3508
3563
|
function parseWithCompat(schema, data) {
|
|
3509
|
-
const result =
|
|
3564
|
+
const result = safeParse(schema, data);
|
|
3510
3565
|
if (!result.success) {
|
|
3511
3566
|
throw result.error;
|
|
3512
3567
|
}
|
|
@@ -4086,7 +4141,7 @@ class Protocol {
|
|
|
4086
4141
|
return reject(response);
|
|
4087
4142
|
}
|
|
4088
4143
|
try {
|
|
4089
|
-
const parseResult =
|
|
4144
|
+
const parseResult = safeParse(resultSchema, response.result);
|
|
4090
4145
|
if (!parseResult.success) {
|
|
4091
4146
|
reject(parseResult.error);
|
|
4092
4147
|
} else {
|
|
@@ -11030,7 +11085,7 @@ var init_server3 = __esm(() => {
|
|
|
11030
11085
|
const method = methodValue;
|
|
11031
11086
|
if (method === "tools/call") {
|
|
11032
11087
|
const wrappedHandler = async (request, extra) => {
|
|
11033
|
-
const validatedRequest =
|
|
11088
|
+
const validatedRequest = safeParse(CallToolRequestSchema, request);
|
|
11034
11089
|
if (!validatedRequest.success) {
|
|
11035
11090
|
const errorMessage = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);
|
|
11036
11091
|
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${errorMessage}`);
|
|
@@ -11038,14 +11093,14 @@ var init_server3 = __esm(() => {
|
|
|
11038
11093
|
const { params } = validatedRequest.data;
|
|
11039
11094
|
const result = await Promise.resolve(handler(request, extra));
|
|
11040
11095
|
if (params.task) {
|
|
11041
|
-
const taskValidationResult =
|
|
11096
|
+
const taskValidationResult = safeParse(CreateTaskResultSchema, result);
|
|
11042
11097
|
if (!taskValidationResult.success) {
|
|
11043
11098
|
const errorMessage = taskValidationResult.error instanceof Error ? taskValidationResult.error.message : String(taskValidationResult.error);
|
|
11044
11099
|
throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage}`);
|
|
11045
11100
|
}
|
|
11046
11101
|
return taskValidationResult.data;
|
|
11047
11102
|
}
|
|
11048
|
-
const validationResult =
|
|
11103
|
+
const validationResult = safeParse(CallToolResultSchema, result);
|
|
11049
11104
|
if (!validationResult.success) {
|
|
11050
11105
|
const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
|
|
11051
11106
|
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${errorMessage}`);
|
|
@@ -12176,6 +12231,10 @@ var init_mcp = __esm(() => {
|
|
|
12176
12231
|
});
|
|
12177
12232
|
|
|
12178
12233
|
// src/github/app.ts
|
|
12234
|
+
function decodePrivateKey(raw) {
|
|
12235
|
+
return raw.startsWith("-----BEGIN") ? raw.replace(/\\n/g, `
|
|
12236
|
+
`) : Buffer.from(raw, "base64").toString("utf-8");
|
|
12237
|
+
}
|
|
12179
12238
|
function isGitHubEnabled() {
|
|
12180
12239
|
if (isEnvFlagEnabled("GITHUB_DISABLE", false)) {
|
|
12181
12240
|
return false;
|
|
@@ -12215,12 +12274,7 @@ function initGitHub() {
|
|
|
12215
12274
|
appId = process.env.GITHUB_APP_ID ?? null;
|
|
12216
12275
|
const rawPrivateKey = process.env.GITHUB_APP_PRIVATE_KEY ?? null;
|
|
12217
12276
|
if (appId && rawPrivateKey) {
|
|
12218
|
-
|
|
12219
|
-
privateKey = rawPrivateKey.replace(/\\n/g, `
|
|
12220
|
-
`);
|
|
12221
|
-
} else {
|
|
12222
|
-
privateKey = Buffer.from(rawPrivateKey, "base64").toString("utf-8");
|
|
12223
|
-
}
|
|
12277
|
+
privateKey = decodePrivateKey(rawPrivateKey);
|
|
12224
12278
|
console.log("[GitHub] App credentials loaded for bot reactions");
|
|
12225
12279
|
} else {
|
|
12226
12280
|
console.log("[GitHub] No App credentials, bot reactions disabled");
|
|
@@ -12260,15 +12314,16 @@ async function verifyWebhookSignature(payload, signature) {
|
|
|
12260
12314
|
}
|
|
12261
12315
|
return isValid;
|
|
12262
12316
|
}
|
|
12263
|
-
async function generateAppJWT() {
|
|
12264
|
-
|
|
12317
|
+
async function generateAppJWT(creds = { appId, privateKey }) {
|
|
12318
|
+
const { appId: appId2, privateKey: privateKey2 } = creds;
|
|
12319
|
+
if (!appId2 || !privateKey2) {
|
|
12265
12320
|
return null;
|
|
12266
12321
|
}
|
|
12267
12322
|
const now = Math.floor(Date.now() / 1000);
|
|
12268
12323
|
const payload = {
|
|
12269
12324
|
iat: now - 60,
|
|
12270
12325
|
exp: now + 600,
|
|
12271
|
-
iss:
|
|
12326
|
+
iss: appId2
|
|
12272
12327
|
};
|
|
12273
12328
|
const base64url = (data) => {
|
|
12274
12329
|
const base64 = Buffer.isBuffer(data) ? data.toString("base64") : Buffer.from(data).toString("base64");
|
|
@@ -12282,7 +12337,7 @@ async function generateAppJWT() {
|
|
|
12282
12337
|
const crypto2 = await import("node:crypto");
|
|
12283
12338
|
const sign = crypto2.createSign("RSA-SHA256");
|
|
12284
12339
|
sign.update(signingInput);
|
|
12285
|
-
const signature = sign.sign(
|
|
12340
|
+
const signature = sign.sign(privateKey2);
|
|
12286
12341
|
const signatureB64 = base64url(signature);
|
|
12287
12342
|
return `${signingInput}.${signatureB64}`;
|
|
12288
12343
|
} catch (error) {
|
|
@@ -12291,11 +12346,14 @@ async function generateAppJWT() {
|
|
|
12291
12346
|
}
|
|
12292
12347
|
}
|
|
12293
12348
|
async function getInstallationToken(installationId) {
|
|
12349
|
+
return (await mintInstallationToken(installationId, { appId, privateKey }, 60000))?.token ?? null;
|
|
12350
|
+
}
|
|
12351
|
+
async function mintInstallationToken(installationId, creds, minValidityMs) {
|
|
12294
12352
|
const cached = tokenCache.get(installationId);
|
|
12295
|
-
if (cached && cached.expiresAt > Date.now() +
|
|
12296
|
-
return cached
|
|
12353
|
+
if (cached && cached.expiresAt > Date.now() + minValidityMs) {
|
|
12354
|
+
return cached;
|
|
12297
12355
|
}
|
|
12298
|
-
const jwt = await generateAppJWT();
|
|
12356
|
+
const jwt = await generateAppJWT(creds);
|
|
12299
12357
|
if (!jwt) {
|
|
12300
12358
|
console.log("[GitHub] No JWT available, cannot get installation token");
|
|
12301
12359
|
return null;
|
|
@@ -12316,16 +12374,33 @@ async function getInstallationToken(installationId) {
|
|
|
12316
12374
|
}
|
|
12317
12375
|
const data = await response.json();
|
|
12318
12376
|
const expiresAt = new Date(data.expires_at).getTime();
|
|
12319
|
-
|
|
12377
|
+
const minted = { token: data.token, expiresAt };
|
|
12378
|
+
tokenCache.set(installationId, minted);
|
|
12320
12379
|
console.log(`[GitHub] Got installation token for ${installationId}, expires at ${data.expires_at}`);
|
|
12321
|
-
return
|
|
12380
|
+
return minted;
|
|
12322
12381
|
} catch (error) {
|
|
12323
12382
|
console.error("[GitHub] Error getting installation token:", error);
|
|
12324
12383
|
return null;
|
|
12325
12384
|
}
|
|
12326
12385
|
}
|
|
12386
|
+
async function getWorkerInstallationToken() {
|
|
12387
|
+
if (isEnvFlagEnabled("GITHUB_DISABLE", false))
|
|
12388
|
+
return { status: "unconfigured" };
|
|
12389
|
+
const workerAppId = process.env.GITHUB_APP_ID?.trim();
|
|
12390
|
+
const rawKey = process.env.GITHUB_APP_PRIVATE_KEY?.trim();
|
|
12391
|
+
const rawInstallation = process.env.GITHUB_APP_INSTALLATION_ID?.trim() ?? "";
|
|
12392
|
+
if (!workerAppId || !rawKey || !/^[1-9][0-9]{0,15}$/.test(rawInstallation)) {
|
|
12393
|
+
return { status: "unconfigured" };
|
|
12394
|
+
}
|
|
12395
|
+
if (!resolveGitHubHost().ok)
|
|
12396
|
+
return { status: "error" };
|
|
12397
|
+
const minted = await mintInstallationToken(Number(rawInstallation), { appId: workerAppId, privateKey: decodePrivateKey(rawKey) }, 600000);
|
|
12398
|
+
if (!minted)
|
|
12399
|
+
return { status: "error" };
|
|
12400
|
+
return { status: "ok", token: minted.token, expiresAt: new Date(minted.expiresAt).toISOString() };
|
|
12401
|
+
}
|
|
12327
12402
|
var initialized = false, webhookSecret = null, appId = null, privateKey = null, tokenCache;
|
|
12328
|
-
var
|
|
12403
|
+
var init_app = __esm(() => {
|
|
12329
12404
|
init_env_flag();
|
|
12330
12405
|
init_github_host();
|
|
12331
12406
|
tokenCache = new Map;
|
|
@@ -12423,7 +12498,7 @@ async function addGraphQLReaction(nodeId, reaction, installationId) {
|
|
|
12423
12498
|
var init_reactions = __esm(() => {
|
|
12424
12499
|
init_github_host();
|
|
12425
12500
|
init_secret_scrubber();
|
|
12426
|
-
|
|
12501
|
+
init_app();
|
|
12427
12502
|
});
|
|
12428
12503
|
|
|
12429
12504
|
// src/github/task-reactions.ts
|
|
@@ -20089,7 +20164,7 @@ async function completeIfSettled(runId, ctx) {
|
|
|
20089
20164
|
if (await getRunLineageBlock(runId))
|
|
20090
20165
|
return false;
|
|
20091
20166
|
const steps = await getWorkflowRunStepsByRunId2(runId);
|
|
20092
|
-
if (retryPendingNodeIds(steps).size > 0)
|
|
20167
|
+
if (retryPendingNodeIds(steps).size > 0 || hasOwedSuccessors(runId))
|
|
20093
20168
|
return false;
|
|
20094
20169
|
const latest = new Map;
|
|
20095
20170
|
for (const step of steps)
|
|
@@ -20099,6 +20174,7 @@ async function completeIfSettled(runId, ctx) {
|
|
|
20099
20174
|
return false;
|
|
20100
20175
|
}
|
|
20101
20176
|
}
|
|
20177
|
+
await adoptStoredContext(runId, ctx);
|
|
20102
20178
|
await updateWorkflowRun2(runId, {
|
|
20103
20179
|
status: "completed",
|
|
20104
20180
|
context: ctx,
|
|
@@ -20158,7 +20234,7 @@ async function recoverWaitingRuns(registry) {
|
|
|
20158
20234
|
await finalizeOrWait2(stuck.runId);
|
|
20159
20235
|
} else {
|
|
20160
20236
|
const secretKeys = getSecretInputKeys(workflow.input);
|
|
20161
|
-
await walkGraph(workflow.definition, stuck.runId, ctx, routing.successors, registry, workflow.id, secretKeys);
|
|
20237
|
+
await walkGraph(workflow.definition, stuck.runId, ctx, routing.successors, registry, workflow.id, secretKeys, { successorDebt: routing.successorDebt });
|
|
20162
20238
|
}
|
|
20163
20239
|
recovered++;
|
|
20164
20240
|
} catch (err) {
|
|
@@ -20212,7 +20288,7 @@ async function recoverApprovalWaitingRuns(registry) {
|
|
|
20212
20288
|
continue;
|
|
20213
20289
|
if (routing.successors.length > 0) {
|
|
20214
20290
|
const secretKeys = getSecretInputKeys(workflow.input);
|
|
20215
|
-
await walkGraph(workflow.definition, stuck.runId, ctx, routing.successors, registry, workflow.id, secretKeys);
|
|
20291
|
+
await walkGraph(workflow.definition, stuck.runId, ctx, routing.successors, registry, workflow.id, secretKeys, { successorDebt: routing.successorDebt });
|
|
20216
20292
|
} else {
|
|
20217
20293
|
await finalizeOrWait2(stuck.runId);
|
|
20218
20294
|
}
|
|
@@ -20289,6 +20365,7 @@ var init_recovery = __esm(() => {
|
|
|
20289
20365
|
init_db4();
|
|
20290
20366
|
init_workflow_runs();
|
|
20291
20367
|
init_approval_resolution();
|
|
20368
|
+
init_checkpoint();
|
|
20292
20369
|
init_completed_step_routing();
|
|
20293
20370
|
init_constants();
|
|
20294
20371
|
init_engine();
|
|
@@ -20296,6 +20373,7 @@ var init_recovery = __esm(() => {
|
|
|
20296
20373
|
init_foreach_driver();
|
|
20297
20374
|
init_input();
|
|
20298
20375
|
init_resume();
|
|
20376
|
+
init_successor_routing();
|
|
20299
20377
|
init_task_step_routing();
|
|
20300
20378
|
});
|
|
20301
20379
|
|
|
@@ -20303,6 +20381,7 @@ var init_recovery = __esm(() => {
|
|
|
20303
20381
|
function startRetryPoller(registry, intervalMs = 5000) {
|
|
20304
20382
|
if (pollerTimeout !== null)
|
|
20305
20383
|
return;
|
|
20384
|
+
const generation = pollerGeneration;
|
|
20306
20385
|
async function poll() {
|
|
20307
20386
|
try {
|
|
20308
20387
|
const retryableSteps = await getRetryableSteps2();
|
|
@@ -20371,7 +20450,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20371
20450
|
if (!drive.joined)
|
|
20372
20451
|
continue;
|
|
20373
20452
|
if (drive.successors.length > 0) {
|
|
20374
|
-
await walkGraph(workflow.definition, run.id, ctx, drive.successors, registry, workflow.id);
|
|
20453
|
+
await walkGraph(workflow.definition, run.id, ctx, drive.successors, registry, workflow.id, undefined, { successorDebt: drive.successorDebt });
|
|
20375
20454
|
} else {
|
|
20376
20455
|
await completeRunIfSettled(run.id, ctx);
|
|
20377
20456
|
}
|
|
@@ -20380,10 +20459,15 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20380
20459
|
if (!waiting)
|
|
20381
20460
|
continue;
|
|
20382
20461
|
if (result.waitFor === "workflow.child.finished") {
|
|
20383
|
-
const { resumeFromChildRun } = await import("./resume-
|
|
20462
|
+
const { resumeFromChildRun } = await import("./resume-s6ey36rh.js");
|
|
20384
20463
|
await resumeFromChildRun(step.id, registry);
|
|
20385
20464
|
}
|
|
20386
20465
|
} else {
|
|
20466
|
+
const outputSchemaError = validateOutputSchema(node, result);
|
|
20467
|
+
if (outputSchemaError) {
|
|
20468
|
+
await checkpointStepFailure(run.id, step.id, outputSchemaError, step.retryCount, undefined, { fence });
|
|
20469
|
+
continue;
|
|
20470
|
+
}
|
|
20387
20471
|
let validationPassed;
|
|
20388
20472
|
if (node.validation) {
|
|
20389
20473
|
const validationResult = await runStepValidation(registry, node, result.output, ctx, meta);
|
|
@@ -20435,7 +20519,8 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20435
20519
|
} catch (err) {
|
|
20436
20520
|
console.error("[workflows] Retry poller error:", err);
|
|
20437
20521
|
}
|
|
20438
|
-
|
|
20522
|
+
if (generation === pollerGeneration)
|
|
20523
|
+
pollerTimeout = setTimeout(poll, intervalMs);
|
|
20439
20524
|
}
|
|
20440
20525
|
pollerTimeout = setTimeout(poll, intervalMs);
|
|
20441
20526
|
}
|
|
@@ -20475,8 +20560,9 @@ async function completeRunIfSettled(runId, ctx) {
|
|
|
20475
20560
|
return;
|
|
20476
20561
|
const steps = await getWorkflowRunStepsByRunId2(runId);
|
|
20477
20562
|
const live = steps.some((s) => s.status === "running" || s.status === "waiting" || s.status === "failed" && s.nextRetryAt != null);
|
|
20478
|
-
if (live)
|
|
20563
|
+
if (live || hasOwedSuccessors(runId))
|
|
20479
20564
|
return;
|
|
20565
|
+
await adoptStoredContext(runId, ctx);
|
|
20480
20566
|
await updateWorkflowRun2(runId, {
|
|
20481
20567
|
status: "completed",
|
|
20482
20568
|
context: ctx,
|
|
@@ -20484,7 +20570,7 @@ async function completeRunIfSettled(runId, ctx) {
|
|
|
20484
20570
|
});
|
|
20485
20571
|
});
|
|
20486
20572
|
}
|
|
20487
|
-
var pollerTimeout = null, RETRYABLE_RUN_STATUSES;
|
|
20573
|
+
var pollerTimeout = null, pollerGeneration = 0, RETRYABLE_RUN_STATUSES;
|
|
20488
20574
|
var init_retry_poller = __esm(() => {
|
|
20489
20575
|
init_db4();
|
|
20490
20576
|
init_workflow_runs();
|
|
@@ -20494,6 +20580,7 @@ var init_retry_poller = __esm(() => {
|
|
|
20494
20580
|
init_foreach_driver();
|
|
20495
20581
|
init_foreach_join();
|
|
20496
20582
|
init_step_input();
|
|
20583
|
+
init_successor_routing();
|
|
20497
20584
|
init_validation();
|
|
20498
20585
|
RETRYABLE_RUN_STATUSES = new Set(["running", "waiting", "failed"]);
|
|
20499
20586
|
});
|
|
@@ -20501,6 +20588,127 @@ var init_retry_poller = __esm(() => {
|
|
|
20501
20588
|
// src/workflows/templates.ts
|
|
20502
20589
|
var init_templates2 = () => {};
|
|
20503
20590
|
|
|
20591
|
+
// src/workflows/webhook-filter.ts
|
|
20592
|
+
function headerValue(headers, name) {
|
|
20593
|
+
const target = name.toLowerCase();
|
|
20594
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
20595
|
+
if (key.toLowerCase() !== target)
|
|
20596
|
+
continue;
|
|
20597
|
+
const first = Array.isArray(value) ? value[0] : value;
|
|
20598
|
+
return typeof first === "string" ? first : undefined;
|
|
20599
|
+
}
|
|
20600
|
+
return;
|
|
20601
|
+
}
|
|
20602
|
+
function isPreset(value) {
|
|
20603
|
+
return typeof value === "string" && WEBHOOK_FILTER_PRESETS.includes(value);
|
|
20604
|
+
}
|
|
20605
|
+
function listed(value) {
|
|
20606
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null) {
|
|
20607
|
+
return [value];
|
|
20608
|
+
}
|
|
20609
|
+
return value;
|
|
20610
|
+
}
|
|
20611
|
+
function valueAllowed(value, allowed) {
|
|
20612
|
+
return allowed.some((candidate) => Object.is(candidate, value));
|
|
20613
|
+
}
|
|
20614
|
+
function readBodyPath(body, path) {
|
|
20615
|
+
let current = body;
|
|
20616
|
+
for (const segment of path.split(".")) {
|
|
20617
|
+
if (Array.isArray(current)) {
|
|
20618
|
+
if (!/^(0|[1-9]\d*)$/.test(segment) || !Object.hasOwn(current, segment)) {
|
|
20619
|
+
return { found: false };
|
|
20620
|
+
}
|
|
20621
|
+
current = current[Number(segment)];
|
|
20622
|
+
continue;
|
|
20623
|
+
}
|
|
20624
|
+
if (current === null || typeof current !== "object")
|
|
20625
|
+
return { found: false };
|
|
20626
|
+
if (!Object.hasOwn(current, segment))
|
|
20627
|
+
return { found: false };
|
|
20628
|
+
current = current[segment];
|
|
20629
|
+
}
|
|
20630
|
+
return { found: true, value: current };
|
|
20631
|
+
}
|
|
20632
|
+
function clauseMatches(clause, headers, body) {
|
|
20633
|
+
if (clause.source === "header") {
|
|
20634
|
+
return valueAllowed(headerValue(headers, clause.path), clause.allowed);
|
|
20635
|
+
}
|
|
20636
|
+
const read = readBodyPath(body, clause.path);
|
|
20637
|
+
return read.found && valueAllowed(read.value, clause.allowed);
|
|
20638
|
+
}
|
|
20639
|
+
function observedEvent(clause, headers, body) {
|
|
20640
|
+
if (clause.source === "header")
|
|
20641
|
+
return headerValue(headers, clause.path) ?? null;
|
|
20642
|
+
const read = readBodyPath(body, clause.path);
|
|
20643
|
+
return read.found && typeof read.value === "string" ? read.value : null;
|
|
20644
|
+
}
|
|
20645
|
+
function invalid(message) {
|
|
20646
|
+
return { action: "invalid", message };
|
|
20647
|
+
}
|
|
20648
|
+
function decideWebhookDelivery(trigger, headers, body) {
|
|
20649
|
+
if (trigger.preset !== undefined && !isPreset(trigger.preset)) {
|
|
20650
|
+
return invalid(WEBHOOK_PRESET_INVALID_MESSAGE);
|
|
20651
|
+
}
|
|
20652
|
+
if (trigger.eventHeader !== undefined && (typeof trigger.eventHeader !== "string" || trigger.eventHeader.length === 0)) {
|
|
20653
|
+
return invalid(WEBHOOK_EVENT_HEADER_INVALID_MESSAGE);
|
|
20654
|
+
}
|
|
20655
|
+
if (trigger.events != null) {
|
|
20656
|
+
if (!Array.isArray(trigger.events) || trigger.events.some((event) => typeof event !== "string")) {
|
|
20657
|
+
return invalid(WEBHOOK_EVENTS_INVALID_MESSAGE);
|
|
20658
|
+
}
|
|
20659
|
+
}
|
|
20660
|
+
const clauses = [];
|
|
20661
|
+
const events = Array.isArray(trigger.events) ? trigger.events : [];
|
|
20662
|
+
if (events.length > 0) {
|
|
20663
|
+
const preset = isPreset(trigger.preset) ? trigger.preset : "github";
|
|
20664
|
+
const source = typeof trigger.eventHeader === "string" ? { source: "header", path: trigger.eventHeader } : EVENT_SOURCES[preset];
|
|
20665
|
+
clauses.push({ ...source, allowed: events, origin: "events" });
|
|
20666
|
+
}
|
|
20667
|
+
if (trigger.filter !== undefined) {
|
|
20668
|
+
const parsed = WebhookDeliveryFilterSchema.safeParse(trigger.filter);
|
|
20669
|
+
if (!parsed.success)
|
|
20670
|
+
return invalid(WEBHOOK_FILTER_INVALID_MESSAGE);
|
|
20671
|
+
for (const [name, allowed] of Object.entries(parsed.data.headers ?? {})) {
|
|
20672
|
+
clauses.push({ source: "header", path: name, allowed: listed(allowed), origin: "filter" });
|
|
20673
|
+
}
|
|
20674
|
+
for (const [path, allowed] of Object.entries(parsed.data.body ?? {})) {
|
|
20675
|
+
clauses.push({ source: "body", path, allowed: listed(allowed), origin: "filter" });
|
|
20676
|
+
}
|
|
20677
|
+
}
|
|
20678
|
+
for (const clause of clauses) {
|
|
20679
|
+
if (clauseMatches(clause, headers, body))
|
|
20680
|
+
continue;
|
|
20681
|
+
if (clause.origin === "events") {
|
|
20682
|
+
return {
|
|
20683
|
+
action: "skip",
|
|
20684
|
+
skip: {
|
|
20685
|
+
skipped: true,
|
|
20686
|
+
reason: "event-not-allowed",
|
|
20687
|
+
event: observedEvent(clause, headers, body)
|
|
20688
|
+
}
|
|
20689
|
+
};
|
|
20690
|
+
}
|
|
20691
|
+
return {
|
|
20692
|
+
action: "skip",
|
|
20693
|
+
skip: {
|
|
20694
|
+
skipped: true,
|
|
20695
|
+
reason: "filter-not-matched",
|
|
20696
|
+
match: { source: clause.source, path: clause.path }
|
|
20697
|
+
}
|
|
20698
|
+
};
|
|
20699
|
+
}
|
|
20700
|
+
return { action: "allow" };
|
|
20701
|
+
}
|
|
20702
|
+
var WEBHOOK_FILTER_INVALID_MESSAGE = "Webhook trigger filter is invalid", WEBHOOK_PRESET_INVALID_MESSAGE = "Webhook trigger preset is invalid", WEBHOOK_EVENTS_INVALID_MESSAGE = "Webhook trigger events allowlist is invalid", WEBHOOK_EVENT_HEADER_INVALID_MESSAGE = "Webhook trigger eventHeader is invalid", EVENT_SOURCES;
|
|
20703
|
+
var init_webhook_filter = __esm(() => {
|
|
20704
|
+
init_types5();
|
|
20705
|
+
EVENT_SOURCES = {
|
|
20706
|
+
github: { source: "header", path: "X-GitHub-Event" },
|
|
20707
|
+
gitlab: { source: "header", path: "X-Gitlab-Event" },
|
|
20708
|
+
"standard-webhooks": { source: "body", path: "type" }
|
|
20709
|
+
};
|
|
20710
|
+
});
|
|
20711
|
+
|
|
20504
20712
|
// src/workflows/triggers.ts
|
|
20505
20713
|
import crypto2 from "node:crypto";
|
|
20506
20714
|
function getHeader(headers, name) {
|
|
@@ -20592,12 +20800,6 @@ async function verifyWebhookRequest(trigger, rawBody, headers) {
|
|
|
20592
20800
|
throw new WebhookError("Invalid signature", 401);
|
|
20593
20801
|
}
|
|
20594
20802
|
}
|
|
20595
|
-
function filteredWebhookEvent(trigger, headers) {
|
|
20596
|
-
if (!trigger.events || trigger.events.length === 0)
|
|
20597
|
-
return;
|
|
20598
|
-
const event = getHeader(headers, trigger.eventHeader || DEFAULT_EVENT_HEADER) ?? null;
|
|
20599
|
-
return event !== null && trigger.events.includes(event) ? undefined : event;
|
|
20600
|
-
}
|
|
20601
20803
|
async function handleWebhookTrigger(workflowId, payload, headers, registry, options = {}) {
|
|
20602
20804
|
const workflow = await getWorkflow2(workflowId);
|
|
20603
20805
|
if (!workflow) {
|
|
@@ -20613,12 +20815,16 @@ async function handleWebhookTrigger(workflowId, payload, headers, registry, opti
|
|
|
20613
20815
|
}
|
|
20614
20816
|
} else {
|
|
20615
20817
|
await verifyWebhookRequest(webhookTrigger, typeof payload === "string" ? payload : JSON.stringify(payload), headers);
|
|
20616
|
-
const filtered = filteredWebhookEvent(webhookTrigger, headers);
|
|
20617
|
-
if (filtered !== undefined) {
|
|
20618
|
-
return { skipped: true, reason: "event-not-allowed", event: filtered };
|
|
20619
|
-
}
|
|
20620
20818
|
}
|
|
20621
20819
|
const triggerData = parseTriggerPayload(payload);
|
|
20820
|
+
if (webhookTrigger) {
|
|
20821
|
+
const decision = decideWebhookDelivery(webhookTrigger, headers, triggerData);
|
|
20822
|
+
if (decision.action === "invalid") {
|
|
20823
|
+
throw new WebhookError(decision.message, 500);
|
|
20824
|
+
}
|
|
20825
|
+
if (decision.action === "skip")
|
|
20826
|
+
return decision.skip;
|
|
20827
|
+
}
|
|
20622
20828
|
const runId = await startWorkflowExecution2(workflow, triggerData, registry, {
|
|
20623
20829
|
triggerType: "event",
|
|
20624
20830
|
requestedByUserId: options.requestedByUserId
|
|
@@ -20767,11 +20973,12 @@ function timingSafeEqualHex(providedHex, expected) {
|
|
|
20767
20973
|
return false;
|
|
20768
20974
|
}
|
|
20769
20975
|
}
|
|
20770
|
-
var DEFAULT_HMAC_HEADER = "X-Hub-Signature-256", FALLBACK_HMAC_HEADERS,
|
|
20976
|
+
var DEFAULT_HMAC_HEADER = "X-Hub-Signature-256", FALLBACK_HMAC_HEADERS, STANDARD_WEBHOOK_SECRET_PREFIX = "whsec_", WebhookError;
|
|
20771
20977
|
var init_triggers = __esm(() => {
|
|
20772
20978
|
init_db4();
|
|
20773
20979
|
init_engine();
|
|
20774
20980
|
init_input();
|
|
20981
|
+
init_webhook_filter();
|
|
20775
20982
|
FALLBACK_HMAC_HEADERS = ["x-hub-signature-256", "x-signature", "x-webhook-signature"];
|
|
20776
20983
|
WebhookError = class WebhookError extends Error {
|
|
20777
20984
|
statusCode;
|
|
@@ -20836,6 +21043,7 @@ var init_version = __esm(() => {
|
|
|
20836
21043
|
function startWaitPoller(registry, intervalMs = 5000) {
|
|
20837
21044
|
if (pollerTimeout2 !== null)
|
|
20838
21045
|
return;
|
|
21046
|
+
const generation = pollerGeneration2;
|
|
20839
21047
|
async function poll() {
|
|
20840
21048
|
try {
|
|
20841
21049
|
const dueWaits = await getDueWaitStates2();
|
|
@@ -20850,11 +21058,12 @@ function startWaitPoller(registry, intervalMs = 5000) {
|
|
|
20850
21058
|
} catch (err) {
|
|
20851
21059
|
console.error("[workflows] Wait poller tick error:", err);
|
|
20852
21060
|
}
|
|
20853
|
-
|
|
21061
|
+
if (generation === pollerGeneration2)
|
|
21062
|
+
pollerTimeout2 = setTimeout(poll, intervalMs);
|
|
20854
21063
|
}
|
|
20855
21064
|
pollerTimeout2 = setTimeout(poll, intervalMs);
|
|
20856
21065
|
}
|
|
20857
|
-
var pollerTimeout2 = null;
|
|
21066
|
+
var pollerTimeout2 = null, pollerGeneration2 = 0;
|
|
20858
21067
|
var init_wait_poller = __esm(() => {
|
|
20859
21068
|
init_db4();
|
|
20860
21069
|
init_resume();
|
|
@@ -21121,7 +21330,7 @@ var init_notify = __esm(() => {
|
|
|
21121
21330
|
}
|
|
21122
21331
|
}
|
|
21123
21332
|
case "slack": {
|
|
21124
|
-
const { getSlackApp } = await import("./app-
|
|
21333
|
+
const { getSlackApp } = await import("./app-hn5fftf5.js");
|
|
21125
21334
|
let app = getSlackApp();
|
|
21126
21335
|
if (!app) {
|
|
21127
21336
|
if (!isSlackConfigured()) {
|
|
@@ -21254,7 +21463,7 @@ var init_property_match = __esm(() => {
|
|
|
21254
21463
|
async function executeRawLlm(config) {
|
|
21255
21464
|
let modelName = config.model ?? "google/gemini-3-flash-preview";
|
|
21256
21465
|
try {
|
|
21257
|
-
const { createOpenAI } = await import("./index-
|
|
21466
|
+
const { createOpenAI } = await import("./index-kzdqn3dd.js");
|
|
21258
21467
|
const llmConfig = await resolveWorkflowLlmConfig(config.model);
|
|
21259
21468
|
modelName = llmConfig.model;
|
|
21260
21469
|
const provider = createOpenAI({
|
|
@@ -21264,7 +21473,7 @@ async function executeRawLlm(config) {
|
|
|
21264
21473
|
});
|
|
21265
21474
|
const model = provider(llmConfig.model);
|
|
21266
21475
|
if (config.schema) {
|
|
21267
|
-
const { generateObject, jsonSchema } = await import("./index-
|
|
21476
|
+
const { generateObject, jsonSchema } = await import("./index-kdmkfjt7.js");
|
|
21268
21477
|
const { object } = await generateObject({
|
|
21269
21478
|
model,
|
|
21270
21479
|
schema: jsonSchema(config.schema),
|
|
@@ -21278,7 +21487,7 @@ async function executeRawLlm(config) {
|
|
|
21278
21487
|
output: { result: object, model: modelName }
|
|
21279
21488
|
};
|
|
21280
21489
|
}
|
|
21281
|
-
const { generateText } = await import("./index-
|
|
21490
|
+
const { generateText } = await import("./index-kdmkfjt7.js");
|
|
21282
21491
|
const { text } = await generateText({
|
|
21283
21492
|
model,
|
|
21284
21493
|
prompt: config.prompt
|
|
@@ -21838,8 +22047,8 @@ var init_validate3 = __esm(() => {
|
|
|
21838
22047
|
const interpolatedPrompt = this.deps.interpolate(prompt, context);
|
|
21839
22048
|
const outputStr = typeof targetOutput === "string" ? targetOutput : JSON.stringify(targetOutput);
|
|
21840
22049
|
try {
|
|
21841
|
-
const { createOpenAI } = await import("./index-
|
|
21842
|
-
const { generateObject, jsonSchema } = await import("./index-
|
|
22050
|
+
const { createOpenAI } = await import("./index-kzdqn3dd.js");
|
|
22051
|
+
const { generateObject, jsonSchema } = await import("./index-kdmkfjt7.js");
|
|
21843
22052
|
const llmConfig = await resolveWorkflowLlmConfig();
|
|
21844
22053
|
const provider = createOpenAI({
|
|
21845
22054
|
baseURL: llmConfig.baseURL,
|
|
@@ -23745,7 +23954,7 @@ function isMcpToolAllowedForScripts(mcpToolName) {
|
|
|
23745
23954
|
function mcpToolNameForSdkMethod(name) {
|
|
23746
23955
|
return SDK_TOOL_NAME_MAP[name] ?? name;
|
|
23747
23956
|
}
|
|
23748
|
-
var SDK_TOOL_NAME_MAP, SDK_ALLOWLIST, MCP_TOOL_NAMES, REST_ONLY_SDK_METHODS;
|
|
23957
|
+
var SDK_TOOL_NAME_MAP, SDK_ALLOWLIST, MCP_TOOL_NAMES, REST_ONLY_SDK_METHODS, SDK_NAMESPACES;
|
|
23749
23958
|
var init_sdk_allowlist = __esm(() => {
|
|
23750
23959
|
SDK_TOOL_NAME_MAP = {
|
|
23751
23960
|
memory_search: "memory-search",
|
|
@@ -23775,6 +23984,24 @@ var init_sdk_allowlist = __esm(() => {
|
|
|
23775
23984
|
room_change: "room-change",
|
|
23776
23985
|
room_reset: "room-reset",
|
|
23777
23986
|
room_decode: "room-decode",
|
|
23987
|
+
objects_create: "object-create",
|
|
23988
|
+
objects_get: "object-get",
|
|
23989
|
+
objects_list: "object-list",
|
|
23990
|
+
objects_reindex: "object-reindex",
|
|
23991
|
+
sheets_create: "sheet-create",
|
|
23992
|
+
sheets_get: "sheet-get",
|
|
23993
|
+
sheets_list: "sheet-list",
|
|
23994
|
+
sheets_getRange: "sheet-get-range",
|
|
23995
|
+
sheets_setRange: "sheet-set-range",
|
|
23996
|
+
sheets_appendRows: "sheet-append-rows",
|
|
23997
|
+
sheets_clearRange: "sheet-clear-range",
|
|
23998
|
+
sheets_addTab: "sheet-add-tab",
|
|
23999
|
+
boards_create: "board-create",
|
|
24000
|
+
boards_get: "board-get",
|
|
24001
|
+
boards_list: "board-list",
|
|
24002
|
+
boards_addElements: "board-add-elements",
|
|
24003
|
+
boards_updateElements: "board-update-elements",
|
|
24004
|
+
boards_removeElements: "board-remove-elements",
|
|
23778
24005
|
repo_list: "get-repos",
|
|
23779
24006
|
repo_update: "update-repo",
|
|
23780
24007
|
schedule_list: "list-schedules",
|
|
@@ -23908,6 +24135,11 @@ var init_sdk_allowlist = __esm(() => {
|
|
|
23908
24135
|
SDK_ALLOWLIST = Object.keys(SDK_TOOL_NAME_MAP);
|
|
23909
24136
|
MCP_TOOL_NAMES = new Set(Object.values(SDK_TOOL_NAME_MAP));
|
|
23910
24137
|
REST_ONLY_SDK_METHODS = ["savings_calibrationGet", "savings_calibrationRun"];
|
|
24138
|
+
SDK_NAMESPACES = Object.freeze({
|
|
24139
|
+
objects: ["create", "get", "list", "reindex"],
|
|
24140
|
+
sheets: ["create", "get", "list", "getRange", "setRange", "appendRows", "clearRange", "addTab"],
|
|
24141
|
+
boards: ["create", "get", "list", "addElements", "updateElements", "removeElements"]
|
|
24142
|
+
});
|
|
23911
24143
|
});
|
|
23912
24144
|
|
|
23913
24145
|
// src/kv-overflow.ts
|
|
@@ -24550,7 +24782,7 @@ function setPreloadedTools(server, names) {
|
|
|
24550
24782
|
async function applyPreToolCall(name, args, requestInfo, inputSchema) {
|
|
24551
24783
|
if (requestInfo.callOrigin !== "mcp")
|
|
24552
24784
|
return { args };
|
|
24553
|
-
const dispatcher = await import("./dispatcher-
|
|
24785
|
+
const dispatcher = await import("./dispatcher-4q8s0mx8.js");
|
|
24554
24786
|
const result = await dispatcher.dispatchPre("pre.tool.call", { tool: name, args, requestInfo }, inputSchema ? {
|
|
24555
24787
|
validateModify: async (data) => {
|
|
24556
24788
|
const schema = normalizeObjectSchema(inputSchema) ?? inputSchema;
|
|
@@ -24937,7 +25169,7 @@ async function invokeToolInProcess(args) {
|
|
|
24937
25169
|
}
|
|
24938
25170
|
return tool.inputSchema ? await Promise.resolve(tool.handler(handlerArgs, extra)) : await Promise.resolve(tool.handler(extra));
|
|
24939
25171
|
}
|
|
24940
|
-
function
|
|
25172
|
+
function headerValue2(req, name) {
|
|
24941
25173
|
const value = req.headers[name];
|
|
24942
25174
|
return Array.isArray(value) ? value[0] : value;
|
|
24943
25175
|
}
|
|
@@ -24948,8 +25180,8 @@ async function handleMcpBridge(req, res, pathSegments, _queryParams, myAgentId)
|
|
|
24948
25180
|
if (!parsed)
|
|
24949
25181
|
return true;
|
|
24950
25182
|
const { tool: toolName, args } = parsed.body;
|
|
24951
|
-
const sourceTaskId =
|
|
24952
|
-
const runtimeInstanceId =
|
|
25183
|
+
const sourceTaskId = headerValue2(req, "x-source-task-id");
|
|
25184
|
+
const runtimeInstanceId = headerValue2(req, "x-runtime-instance-id");
|
|
24953
25185
|
try {
|
|
24954
25186
|
const result = await invokeToolInProcess({
|
|
24955
25187
|
toolName,
|
|
@@ -24957,7 +25189,7 @@ async function handleMcpBridge(req, res, pathSegments, _queryParams, myAgentId)
|
|
|
24957
25189
|
agentId: myAgentId,
|
|
24958
25190
|
sourceTaskId,
|
|
24959
25191
|
runtimeInstanceId,
|
|
24960
|
-
callOrigin: resolveBridgeCallOrigin2(myAgentId,
|
|
25192
|
+
callOrigin: resolveBridgeCallOrigin2(myAgentId, headerValue2(req, "x-extension-token"))
|
|
24961
25193
|
});
|
|
24962
25194
|
if (result && typeof result === "object" && "structuredContent" in result) {
|
|
24963
25195
|
json(res, result.structuredContent);
|
|
@@ -25879,6 +26111,7 @@ var init_swarm_sdk = __esm(() => {
|
|
|
25879
26111
|
"app-query",
|
|
25880
26112
|
"resolve-user",
|
|
25881
26113
|
"room-decode",
|
|
26114
|
+
"sheet-get-range",
|
|
25882
26115
|
"read-messages",
|
|
25883
26116
|
"check-model-profile",
|
|
25884
26117
|
"preview-prompt-template"
|
|
@@ -27928,9 +28161,7 @@ function verifyAzureDevOpsWebhook(authorizationHeader) {
|
|
|
27928
28161
|
if (separator === -1)
|
|
27929
28162
|
return false;
|
|
27930
28163
|
const password = decoded.slice(separator + 1);
|
|
27931
|
-
|
|
27932
|
-
return false;
|
|
27933
|
-
return crypto.timingSafeEqual(Buffer.from(password), Buffer.from(webhookSecret3));
|
|
28164
|
+
return verifyTokenEquality(webhookSecret3, password);
|
|
27934
28165
|
}
|
|
27935
28166
|
function getAzureDevOpsToken() {
|
|
27936
28167
|
return apiToken;
|
|
@@ -27977,6 +28208,7 @@ function resetAzureDevOps() {
|
|
|
27977
28208
|
var initialized3 = false, webhookSecret3 = null, apiToken = null, orgUrl = null, AZURE_DEVOPS_BOT_NAME;
|
|
27978
28209
|
var init_auth3 = __esm(() => {
|
|
27979
28210
|
init_env_flag();
|
|
28211
|
+
init_triggers();
|
|
27980
28212
|
AZURE_DEVOPS_BOT_NAME = process.env.AZURE_DEVOPS_BOT_NAME ?? "agent-swarm-bot";
|
|
27981
28213
|
});
|
|
27982
28214
|
|
|
@@ -31397,7 +31629,7 @@ var init_handlers4 = __esm(() => {
|
|
|
31397
31629
|
init_sibling_awareness();
|
|
31398
31630
|
init_env_flag();
|
|
31399
31631
|
init_github_host();
|
|
31400
|
-
|
|
31632
|
+
init_app();
|
|
31401
31633
|
init_mentions();
|
|
31402
31634
|
init_task_reactions();
|
|
31403
31635
|
init_templates7();
|
|
@@ -31410,7 +31642,7 @@ var init_handlers4 = __esm(() => {
|
|
|
31410
31642
|
|
|
31411
31643
|
// src/github/index.ts
|
|
31412
31644
|
var init_github = __esm(() => {
|
|
31413
|
-
|
|
31645
|
+
init_app();
|
|
31414
31646
|
init_handlers4();
|
|
31415
31647
|
init_mentions();
|
|
31416
31648
|
init_reactions();
|
|
@@ -31438,9 +31670,7 @@ function verifyGitLabWebhook(tokenHeader) {
|
|
|
31438
31670
|
return false;
|
|
31439
31671
|
if (!tokenHeader)
|
|
31440
31672
|
return false;
|
|
31441
|
-
|
|
31442
|
-
return false;
|
|
31443
|
-
return crypto.timingSafeEqual(Buffer.from(tokenHeader), Buffer.from(webhookSecret5));
|
|
31673
|
+
return verifyTokenEquality(webhookSecret5, tokenHeader);
|
|
31444
31674
|
}
|
|
31445
31675
|
function getGitLabToken() {
|
|
31446
31676
|
return apiToken3;
|
|
@@ -31460,6 +31690,7 @@ function resetGitLab() {
|
|
|
31460
31690
|
var initialized5 = false, webhookSecret5 = null, apiToken3 = null, gitlabUrl = "https://gitlab.com";
|
|
31461
31691
|
var init_auth5 = __esm(() => {
|
|
31462
31692
|
init_env_flag();
|
|
31693
|
+
init_triggers();
|
|
31463
31694
|
});
|
|
31464
31695
|
|
|
31465
31696
|
// src/gitlab/reactions.ts
|
|
@@ -34870,7 +35101,7 @@ async function callerAgentFs(agentId) {
|
|
|
34870
35101
|
function chatFileOfPath(path, access) {
|
|
34871
35102
|
const segments = pathSegments(path);
|
|
34872
35103
|
const name = segments.at(-1);
|
|
34873
|
-
const key = segments.
|
|
35104
|
+
const key = segments.join("/");
|
|
34874
35105
|
const keyScrubber = createValueScrubber([{ value: access.apiKey, name: "AGENT_FS_API_KEY" }]);
|
|
34875
35106
|
return {
|
|
34876
35107
|
name,
|
|
@@ -36177,7 +36408,7 @@ async function notifySlack(text) {
|
|
|
36177
36408
|
return;
|
|
36178
36409
|
}
|
|
36179
36410
|
try {
|
|
36180
|
-
const { getSlackApp } = await import("./app-
|
|
36411
|
+
const { getSlackApp } = await import("./app-hn5fftf5.js");
|
|
36181
36412
|
const app = getSlackApp();
|
|
36182
36413
|
if (!app) {
|
|
36183
36414
|
console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
|
|
@@ -36248,7 +36479,7 @@ async function deleteJiraWebhook(webhookId) {
|
|
|
36248
36479
|
console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
|
|
36249
36480
|
}
|
|
36250
36481
|
async function overwriteWebhookIds(next) {
|
|
36251
|
-
const { getDbClient } = await import("./db-
|
|
36482
|
+
const { getDbClient } = await import("./db-3r1fyr2n.js");
|
|
36252
36483
|
await getDbClient().transaction(async (tx) => {
|
|
36253
36484
|
const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
|
|
36254
36485
|
if (!row) {
|
|
@@ -36421,7 +36652,7 @@ function warnIfMcpBaseUrlLooksLikeAppUrl() {
|
|
|
36421
36652
|
}
|
|
36422
36653
|
}
|
|
36423
36654
|
var initialized6 = false;
|
|
36424
|
-
var
|
|
36655
|
+
var init_app2 = __esm(() => {
|
|
36425
36656
|
init_oauth();
|
|
36426
36657
|
init_constants3();
|
|
36427
36658
|
init_env_flag();
|
|
@@ -36520,7 +36751,7 @@ var init_webhook = __esm(() => {
|
|
|
36520
36751
|
// src/jira/index.ts
|
|
36521
36752
|
var init_jira = __esm(() => {
|
|
36522
36753
|
init_adf();
|
|
36523
|
-
|
|
36754
|
+
init_app2();
|
|
36524
36755
|
init_sync2();
|
|
36525
36756
|
init_webhook();
|
|
36526
36757
|
init_webhook_lifecycle();
|
|
@@ -109031,7 +109262,7 @@ function warnIfMcpBaseUrlLooksLikeAppUrl2() {
|
|
|
109031
109262
|
}
|
|
109032
109263
|
}
|
|
109033
109264
|
var initialized7 = false, unsubscribeRefresh = null;
|
|
109034
|
-
var
|
|
109265
|
+
var init_app3 = __esm(() => {
|
|
109035
109266
|
init_oauth();
|
|
109036
109267
|
init_ensure_token();
|
|
109037
109268
|
init_constants3();
|
|
@@ -109042,7 +109273,7 @@ var init_app2 = __esm(() => {
|
|
|
109042
109273
|
|
|
109043
109274
|
// src/linear/index.ts
|
|
109044
109275
|
var init_linear = __esm(() => {
|
|
109045
|
-
|
|
109276
|
+
init_app3();
|
|
109046
109277
|
});
|
|
109047
109278
|
|
|
109048
109279
|
// src/slack/files.ts
|
|
@@ -109274,7 +109505,7 @@ var init_router = __esm(() => {
|
|
|
109274
109505
|
|
|
109275
109506
|
// src/slack/index.ts
|
|
109276
109507
|
var init_slack = __esm(() => {
|
|
109277
|
-
|
|
109508
|
+
init_app4();
|
|
109278
109509
|
init_files();
|
|
109279
109510
|
init_router();
|
|
109280
109511
|
});
|
|
@@ -109529,7 +109760,7 @@ async function resolveHttpRequestAuth(req, apiKey, options = {}) {
|
|
|
109529
109760
|
const bearer = extractBearer(req);
|
|
109530
109761
|
if (!bearer)
|
|
109531
109762
|
return null;
|
|
109532
|
-
if (apiKey && bearer
|
|
109763
|
+
if (apiKey && verifyTokenEquality(apiKey, bearer)) {
|
|
109533
109764
|
const pageSession = singleHeader(req, "x-page-session");
|
|
109534
109765
|
if (pageSession !== null) {
|
|
109535
109766
|
const pageId = singleHeader(req, "x-page-id");
|
|
@@ -109574,6 +109805,7 @@ var init_auth = __esm(() => {
|
|
|
109574
109805
|
init_db4();
|
|
109575
109806
|
init_users();
|
|
109576
109807
|
init_page_session();
|
|
109808
|
+
init_triggers();
|
|
109577
109809
|
});
|
|
109578
109810
|
|
|
109579
109811
|
// src/http/openapi.ts
|
|
@@ -109738,20 +109970,22 @@ async function loadGlobalConfigsIntoEnv2(override = false) {
|
|
|
109738
109970
|
if (updated.length > 0) {
|
|
109739
109971
|
refreshSecretScrubberCache();
|
|
109740
109972
|
}
|
|
109973
|
+
const { syncSlackTreeVisibility } = await import("./tree-visibility-cbrsfaar.js");
|
|
109974
|
+
await syncSlackTreeVisibility();
|
|
109741
109975
|
return updated;
|
|
109742
109976
|
}
|
|
109743
109977
|
async function reloadGlobalConfigsAndIntegrations2() {
|
|
109744
109978
|
return runWithoutRequestAuth(() => runSlackLifecycleExclusive(() => reloadGlobalConfigsAndIntegrationsInner()));
|
|
109745
109979
|
}
|
|
109746
109980
|
async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
109747
|
-
const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-
|
|
109981
|
+
const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-76zzxtzf.js");
|
|
109748
109982
|
const wasEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
|
|
109749
109983
|
const updated = await loadGlobalConfigsIntoEnv2(true);
|
|
109750
109984
|
await syncTelemetryEnabled("settings").catch((err) => {
|
|
109751
109985
|
console.error("[config-reload] telemetry re-init failed (non-fatal):", err);
|
|
109752
109986
|
});
|
|
109753
109987
|
await stopSlackAppUnderLifecycleLock2();
|
|
109754
|
-
const { resetFileStorageProvider } = await import("./registry-
|
|
109988
|
+
const { resetFileStorageProvider } = await import("./registry-eeyx1201.js");
|
|
109755
109989
|
resetFileStorageProvider();
|
|
109756
109990
|
resetEmbeddingProvider();
|
|
109757
109991
|
const isEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
|
|
@@ -109760,7 +109994,7 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
|
109760
109994
|
integrations.push("embeddings");
|
|
109761
109995
|
}
|
|
109762
109996
|
if (isEmbeddingsConfigured) {
|
|
109763
|
-
import("./embedding-space-
|
|
109997
|
+
import("./embedding-space-kcdn52vz.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: !wasEmbeddingsConfigured })).catch((err) => {
|
|
109764
109998
|
console.error("[config-reload] embedding maintenance failed (non-fatal):", err);
|
|
109765
109999
|
});
|
|
109766
110000
|
}
|
|
@@ -114974,6 +115208,1773 @@ var init_app_upsert = __esm(() => {
|
|
|
114974
115208
|
init_utils();
|
|
114975
115209
|
});
|
|
114976
115210
|
|
|
115211
|
+
// node_modules/fractional-indexing/src/index.js
|
|
115212
|
+
function getDigitIndex(digits) {
|
|
115213
|
+
let m = digitIndexCache.get(digits);
|
|
115214
|
+
if (m === undefined) {
|
|
115215
|
+
m = new Uint8Array(256);
|
|
115216
|
+
for (let i = 0;i < digits.length; i++) {
|
|
115217
|
+
m[digits.charCodeAt(i)] = i;
|
|
115218
|
+
}
|
|
115219
|
+
digitIndexCache.set(digits, m);
|
|
115220
|
+
}
|
|
115221
|
+
return m;
|
|
115222
|
+
}
|
|
115223
|
+
function midpoint(a, b, digits, lookup) {
|
|
115224
|
+
const zero = digits[0];
|
|
115225
|
+
if (b != null && a >= b) {
|
|
115226
|
+
throw new Error(a + " >= " + b);
|
|
115227
|
+
}
|
|
115228
|
+
if (a.slice(-1) === zero || b && b.slice(-1) === zero) {
|
|
115229
|
+
throw new Error("trailing zero");
|
|
115230
|
+
}
|
|
115231
|
+
if (b) {
|
|
115232
|
+
let n = 0;
|
|
115233
|
+
while ((a[n] || zero) === b[n]) {
|
|
115234
|
+
n++;
|
|
115235
|
+
}
|
|
115236
|
+
if (n > 0) {
|
|
115237
|
+
return b.slice(0, n) + midpoint(a.slice(n), b.slice(n), digits, lookup);
|
|
115238
|
+
}
|
|
115239
|
+
}
|
|
115240
|
+
const digitA = a ? lookup[a.charCodeAt(0)] : 0;
|
|
115241
|
+
const digitB = b != null ? lookup[b.charCodeAt(0)] : digits.length;
|
|
115242
|
+
if (digitB - digitA > 1) {
|
|
115243
|
+
const midDigit = Math.round(0.5 * (digitA + digitB));
|
|
115244
|
+
return digits[midDigit];
|
|
115245
|
+
} else {
|
|
115246
|
+
if (b && b.length > 1) {
|
|
115247
|
+
return b.slice(0, 1);
|
|
115248
|
+
} else {
|
|
115249
|
+
return digits[digitA] + midpoint(a.slice(1), null, digits, lookup);
|
|
115250
|
+
}
|
|
115251
|
+
}
|
|
115252
|
+
}
|
|
115253
|
+
function validateInteger(int, intDigits, intLookup) {
|
|
115254
|
+
if (int.length !== getIntegerLength(int[0], intDigits, intLookup)) {
|
|
115255
|
+
throw new Error("invalid integer part of order key: " + int);
|
|
115256
|
+
}
|
|
115257
|
+
}
|
|
115258
|
+
function getIntegerLength(head, intDigits, intLookup) {
|
|
115259
|
+
const i = intLookup[head.charCodeAt(0)];
|
|
115260
|
+
if (intDigits[i] === head) {
|
|
115261
|
+
const half = intDigits.length / 2;
|
|
115262
|
+
return i < half ? half - i + 1 : i - half + 2;
|
|
115263
|
+
}
|
|
115264
|
+
throw new Error("invalid order key head: " + head);
|
|
115265
|
+
}
|
|
115266
|
+
function getIntegerPart(key, intDigits, intLookup) {
|
|
115267
|
+
const integerPartLength = getIntegerLength(key[0], intDigits, intLookup);
|
|
115268
|
+
if (integerPartLength > key.length) {
|
|
115269
|
+
throw new Error("invalid order key: " + key);
|
|
115270
|
+
}
|
|
115271
|
+
return key.slice(0, integerPartLength);
|
|
115272
|
+
}
|
|
115273
|
+
function validateOrderKey(key, digits, intDigits, intLookup) {
|
|
115274
|
+
if (isSmallestInteger(key, digits, intDigits)) {
|
|
115275
|
+
throw new Error("invalid order key: " + key);
|
|
115276
|
+
}
|
|
115277
|
+
const i = getIntegerPart(key, intDigits, intLookup);
|
|
115278
|
+
const f = key.slice(i.length);
|
|
115279
|
+
if (f.slice(-1) === digits[0]) {
|
|
115280
|
+
throw new Error("invalid order key: " + key);
|
|
115281
|
+
}
|
|
115282
|
+
}
|
|
115283
|
+
function incrementInteger(x, digits, lookup, intDigits, intLookup) {
|
|
115284
|
+
validateInteger(x, intDigits, intLookup);
|
|
115285
|
+
const head = x[0];
|
|
115286
|
+
const zero = digits[0];
|
|
115287
|
+
let trailing = "";
|
|
115288
|
+
for (let i = x.length - 1;i >= 1; i--) {
|
|
115289
|
+
const d = lookup[x.charCodeAt(i)] + 1;
|
|
115290
|
+
if (d === digits.length) {
|
|
115291
|
+
trailing = zero + trailing;
|
|
115292
|
+
} else {
|
|
115293
|
+
return head + x.slice(1, i) + digits[d] + trailing;
|
|
115294
|
+
}
|
|
115295
|
+
}
|
|
115296
|
+
const headIndex = intLookup[head.charCodeAt(0)];
|
|
115297
|
+
if (headIndex === intDigits.length - 1) {
|
|
115298
|
+
return null;
|
|
115299
|
+
}
|
|
115300
|
+
const h = intDigits[headIndex + 1];
|
|
115301
|
+
const lengthDelta = getIntegerLength(h, intDigits, intLookup) - getIntegerLength(head, intDigits, intLookup);
|
|
115302
|
+
return h + (lengthDelta > 0 ? trailing + zero : lengthDelta < 0 ? trailing.slice(1) : trailing);
|
|
115303
|
+
}
|
|
115304
|
+
function decrementInteger(x, digits, lookup, intDigits, intLookup) {
|
|
115305
|
+
validateInteger(x, intDigits, intLookup);
|
|
115306
|
+
const head = x[0];
|
|
115307
|
+
const last = digits[digits.length - 1];
|
|
115308
|
+
let trailing = "";
|
|
115309
|
+
for (let i = x.length - 1;i >= 1; i--) {
|
|
115310
|
+
const d = lookup[x.charCodeAt(i)] - 1;
|
|
115311
|
+
if (d === -1) {
|
|
115312
|
+
trailing = last + trailing;
|
|
115313
|
+
} else {
|
|
115314
|
+
return head + x.slice(1, i) + digits[d] + trailing;
|
|
115315
|
+
}
|
|
115316
|
+
}
|
|
115317
|
+
const headIndex = intLookup[head.charCodeAt(0)];
|
|
115318
|
+
if (headIndex === 0) {
|
|
115319
|
+
return null;
|
|
115320
|
+
}
|
|
115321
|
+
const h = intDigits[headIndex - 1];
|
|
115322
|
+
const lengthDelta = getIntegerLength(h, intDigits, intLookup) - getIntegerLength(head, intDigits, intLookup);
|
|
115323
|
+
return h + (lengthDelta > 0 ? trailing + last : lengthDelta < 0 ? trailing.slice(1) : trailing);
|
|
115324
|
+
}
|
|
115325
|
+
function isSmallestInteger(key, digits, intDigits) {
|
|
115326
|
+
let byDigit = repeatedKeysCache.get(intDigits);
|
|
115327
|
+
if (byDigit === undefined) {
|
|
115328
|
+
byDigit = new Map;
|
|
115329
|
+
repeatedKeysCache.set(intDigits, byDigit);
|
|
115330
|
+
}
|
|
115331
|
+
const zeroCode = digits.charCodeAt(0);
|
|
115332
|
+
let cached = byDigit.get(zeroCode);
|
|
115333
|
+
if (cached === undefined) {
|
|
115334
|
+
cached = intDigits[0] + digits[0].repeat(intDigits.length / 2);
|
|
115335
|
+
byDigit.set(zeroCode, cached);
|
|
115336
|
+
}
|
|
115337
|
+
return key === cached;
|
|
115338
|
+
}
|
|
115339
|
+
function isStrictlyAscending(s) {
|
|
115340
|
+
for (let i = 1;i < s.length; i++) {
|
|
115341
|
+
if (s.charCodeAt(i - 1) >= s.charCodeAt(i)) {
|
|
115342
|
+
return false;
|
|
115343
|
+
}
|
|
115344
|
+
}
|
|
115345
|
+
return true;
|
|
115346
|
+
}
|
|
115347
|
+
function isSingleByte(s) {
|
|
115348
|
+
for (let i = 0;i < s.length; i++) {
|
|
115349
|
+
if (s.charCodeAt(i) > 255) {
|
|
115350
|
+
return false;
|
|
115351
|
+
}
|
|
115352
|
+
}
|
|
115353
|
+
return true;
|
|
115354
|
+
}
|
|
115355
|
+
function validateDigits(digits) {
|
|
115356
|
+
if (validatedDigits.has(digits)) {
|
|
115357
|
+
return;
|
|
115358
|
+
}
|
|
115359
|
+
if (digits.length < 2 || !isStrictlyAscending(digits)) {
|
|
115360
|
+
throw new Error("digits must be at least 2 characters in strictly ascending character " + "code order: " + digits);
|
|
115361
|
+
}
|
|
115362
|
+
if (!isSingleByte(digits)) {
|
|
115363
|
+
throw new Error("digits must be single-byte (char code 0-255): " + digits);
|
|
115364
|
+
}
|
|
115365
|
+
validatedDigits.add(digits);
|
|
115366
|
+
}
|
|
115367
|
+
function validateIntDigits(intDigits) {
|
|
115368
|
+
if (validatedIntDigits.has(intDigits)) {
|
|
115369
|
+
return;
|
|
115370
|
+
}
|
|
115371
|
+
if (intDigits.length < 2 || intDigits.length % 2 !== 0 || !isStrictlyAscending(intDigits)) {
|
|
115372
|
+
throw new Error("intDigits must be an even number of at least 2 characters in strictly " + "ascending character code order: " + intDigits);
|
|
115373
|
+
}
|
|
115374
|
+
if (!isSingleByte(intDigits)) {
|
|
115375
|
+
throw new Error("intDigits must be single-byte (char code 0-255): " + intDigits);
|
|
115376
|
+
}
|
|
115377
|
+
validatedIntDigits.add(intDigits);
|
|
115378
|
+
}
|
|
115379
|
+
function generateKeyBetween(a, b, digits = undefined, intDigits = undefined) {
|
|
115380
|
+
if (intDigits !== undefined) {
|
|
115381
|
+
validateIntDigits(intDigits);
|
|
115382
|
+
} else {
|
|
115383
|
+
intDigits = digits ?? BASE_52_DIGITS;
|
|
115384
|
+
}
|
|
115385
|
+
if (digits !== undefined) {
|
|
115386
|
+
validateDigits(digits);
|
|
115387
|
+
} else {
|
|
115388
|
+
digits = BASE_62_DIGITS;
|
|
115389
|
+
}
|
|
115390
|
+
const lookup = getDigitIndex(digits);
|
|
115391
|
+
const intLookup = getDigitIndex(intDigits);
|
|
115392
|
+
if (a != null) {
|
|
115393
|
+
validateOrderKey(a, digits, intDigits, intLookup);
|
|
115394
|
+
}
|
|
115395
|
+
if (b != null) {
|
|
115396
|
+
validateOrderKey(b, digits, intDigits, intLookup);
|
|
115397
|
+
}
|
|
115398
|
+
if (a != null && b != null) {
|
|
115399
|
+
if (a > b) {
|
|
115400
|
+
const temp = a;
|
|
115401
|
+
a = b;
|
|
115402
|
+
b = temp;
|
|
115403
|
+
}
|
|
115404
|
+
}
|
|
115405
|
+
if (a == null) {
|
|
115406
|
+
if (b == null) {
|
|
115407
|
+
const head = intDigits[intDigits.length / 2];
|
|
115408
|
+
return head + digits[0];
|
|
115409
|
+
}
|
|
115410
|
+
const ib = getIntegerPart(b, intDigits, intLookup);
|
|
115411
|
+
const fb = b.slice(ib.length);
|
|
115412
|
+
if (isSmallestInteger(ib, digits, intDigits)) {
|
|
115413
|
+
return ib + midpoint("", fb, digits, lookup);
|
|
115414
|
+
}
|
|
115415
|
+
if (ib < b) {
|
|
115416
|
+
return ib;
|
|
115417
|
+
}
|
|
115418
|
+
const res = decrementInteger(ib, digits, lookup, intDigits, intLookup);
|
|
115419
|
+
if (res == null) {
|
|
115420
|
+
throw new Error("cannot decrement any more");
|
|
115421
|
+
}
|
|
115422
|
+
return res;
|
|
115423
|
+
}
|
|
115424
|
+
if (b == null) {
|
|
115425
|
+
const ia = getIntegerPart(a, intDigits, intLookup);
|
|
115426
|
+
const fa = a.slice(ia.length);
|
|
115427
|
+
const i = incrementInteger(ia, digits, lookup, intDigits, intLookup);
|
|
115428
|
+
return i == null ? ia + midpoint(fa, null, digits, lookup) : i;
|
|
115429
|
+
}
|
|
115430
|
+
const ia = getIntegerPart(a, intDigits, intLookup);
|
|
115431
|
+
const fa = a.slice(ia.length);
|
|
115432
|
+
const ib = getIntegerPart(b, intDigits, intLookup);
|
|
115433
|
+
const fb = b.slice(ib.length);
|
|
115434
|
+
if (ia === ib) {
|
|
115435
|
+
return ia + midpoint(fa, fb, digits, lookup);
|
|
115436
|
+
}
|
|
115437
|
+
const i = incrementInteger(ia, digits, lookup, intDigits, intLookup);
|
|
115438
|
+
if (i == null) {
|
|
115439
|
+
throw new Error("cannot increment any more");
|
|
115440
|
+
}
|
|
115441
|
+
if (i < b) {
|
|
115442
|
+
return i;
|
|
115443
|
+
}
|
|
115444
|
+
return ia + midpoint(fa, null, digits, lookup);
|
|
115445
|
+
}
|
|
115446
|
+
function generateNKeysBetween(a, b, n, digits = undefined, intDigits = undefined) {
|
|
115447
|
+
if (intDigits !== undefined) {
|
|
115448
|
+
validateIntDigits(intDigits);
|
|
115449
|
+
} else {
|
|
115450
|
+
intDigits = digits ?? BASE_52_DIGITS;
|
|
115451
|
+
}
|
|
115452
|
+
if (digits !== undefined) {
|
|
115453
|
+
validateDigits(digits);
|
|
115454
|
+
} else {
|
|
115455
|
+
digits = BASE_62_DIGITS;
|
|
115456
|
+
}
|
|
115457
|
+
if (n === 0) {
|
|
115458
|
+
return [];
|
|
115459
|
+
}
|
|
115460
|
+
if (n === 1) {
|
|
115461
|
+
return [generateKeyBetween(a, b, digits, intDigits)];
|
|
115462
|
+
}
|
|
115463
|
+
if (b == null) {
|
|
115464
|
+
let c = generateKeyBetween(a, b, digits, intDigits);
|
|
115465
|
+
const result = [c];
|
|
115466
|
+
for (let i = 0;i < n - 1; i++) {
|
|
115467
|
+
c = generateKeyBetween(c, b, digits, intDigits);
|
|
115468
|
+
result.push(c);
|
|
115469
|
+
}
|
|
115470
|
+
return result;
|
|
115471
|
+
}
|
|
115472
|
+
if (a == null) {
|
|
115473
|
+
let c = generateKeyBetween(a, b, digits, intDigits);
|
|
115474
|
+
const result = [c];
|
|
115475
|
+
for (let i = 0;i < n - 1; i++) {
|
|
115476
|
+
c = generateKeyBetween(a, c, digits, intDigits);
|
|
115477
|
+
result.push(c);
|
|
115478
|
+
}
|
|
115479
|
+
result.reverse();
|
|
115480
|
+
return result;
|
|
115481
|
+
}
|
|
115482
|
+
const mid = Math.floor(n / 2);
|
|
115483
|
+
const c = generateKeyBetween(a, b, digits, intDigits);
|
|
115484
|
+
return [
|
|
115485
|
+
...generateNKeysBetween(a, c, mid, digits, intDigits),
|
|
115486
|
+
c,
|
|
115487
|
+
...generateNKeysBetween(c, b, n - mid - 1, digits, intDigits)
|
|
115488
|
+
];
|
|
115489
|
+
}
|
|
115490
|
+
var BASE_62_DIGITS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", BASE_52_DIGITS, digitIndexCache, repeatedKeysCache, validatedDigits, validatedIntDigits;
|
|
115491
|
+
var init_src = __esm(() => {
|
|
115492
|
+
BASE_52_DIGITS = BASE_62_DIGITS.slice(10);
|
|
115493
|
+
digitIndexCache = new Map;
|
|
115494
|
+
repeatedKeysCache = new Map;
|
|
115495
|
+
validatedDigits = new Set;
|
|
115496
|
+
validatedIntDigits = new Set;
|
|
115497
|
+
});
|
|
115498
|
+
|
|
115499
|
+
// src/be/primitives/boards/excalifont-metrics.json
|
|
115500
|
+
var excalifont_metrics_default;
|
|
115501
|
+
var init_excalifont_metrics = __esm(() => {
|
|
115502
|
+
excalifont_metrics_default = {
|
|
115503
|
+
$comment: "Generated by scripts/gen-excalifont-metrics.ts. Advance width per character, in ems.",
|
|
115504
|
+
font: "Excalifont (Excalidraw 0.18.1, SIL OFL 1.1)",
|
|
115505
|
+
lineHeight: 1.25,
|
|
115506
|
+
fallback: 0.5702,
|
|
115507
|
+
wide: 1,
|
|
115508
|
+
widths: {
|
|
115509
|
+
"0": 0.664,
|
|
115510
|
+
"1": 0.427,
|
|
115511
|
+
"2": 0.7,
|
|
115512
|
+
"3": 0.608,
|
|
115513
|
+
"4": 0.585,
|
|
115514
|
+
"5": 0.618,
|
|
115515
|
+
"6": 0.64,
|
|
115516
|
+
"7": 0.558,
|
|
115517
|
+
"8": 0.636,
|
|
115518
|
+
"9": 0.629,
|
|
115519
|
+
" ": 0.4,
|
|
115520
|
+
"!": 0.314,
|
|
115521
|
+
'"': 0.371,
|
|
115522
|
+
"#": 0.783,
|
|
115523
|
+
$: 0.721,
|
|
115524
|
+
"%": 0.928,
|
|
115525
|
+
"&": 0.718,
|
|
115526
|
+
"'": 0.218,
|
|
115527
|
+
"(": 0.441,
|
|
115528
|
+
")": 0.402,
|
|
115529
|
+
"*": 0.525,
|
|
115530
|
+
"+": 0.55,
|
|
115531
|
+
",": 0.257,
|
|
115532
|
+
"-": 0.411,
|
|
115533
|
+
".": 0.274,
|
|
115534
|
+
"/": 0.561,
|
|
115535
|
+
":": 0.264,
|
|
115536
|
+
";": 0.298,
|
|
115537
|
+
"<": 0.55,
|
|
115538
|
+
"=": 0.55,
|
|
115539
|
+
">": 0.55,
|
|
115540
|
+
"?": 0.466,
|
|
115541
|
+
"@": 0.829,
|
|
115542
|
+
A: 0.676,
|
|
115543
|
+
B: 0.761,
|
|
115544
|
+
C: 0.629,
|
|
115545
|
+
D: 0.78,
|
|
115546
|
+
E: 0.707,
|
|
115547
|
+
F: 0.661,
|
|
115548
|
+
G: 0.78,
|
|
115549
|
+
H: 0.573,
|
|
115550
|
+
I: 0.545,
|
|
115551
|
+
J: 0.569,
|
|
115552
|
+
K: 0.613,
|
|
115553
|
+
L: 0.543,
|
|
115554
|
+
M: 0.766,
|
|
115555
|
+
N: 0.632,
|
|
115556
|
+
O: 0.767,
|
|
115557
|
+
P: 0.698,
|
|
115558
|
+
Q: 0.768,
|
|
115559
|
+
R: 0.736,
|
|
115560
|
+
S: 0.622,
|
|
115561
|
+
T: 0.857,
|
|
115562
|
+
U: 0.73,
|
|
115563
|
+
V: 0.592,
|
|
115564
|
+
W: 0.786,
|
|
115565
|
+
X: 0.628,
|
|
115566
|
+
Y: 0.564,
|
|
115567
|
+
Z: 0.832,
|
|
115568
|
+
"[": 0.472,
|
|
115569
|
+
"\\": 0.589,
|
|
115570
|
+
"]": 0.497,
|
|
115571
|
+
"^": 0.51,
|
|
115572
|
+
_: 0.67,
|
|
115573
|
+
"`": 0.6,
|
|
115574
|
+
a: 0.576,
|
|
115575
|
+
b: 0.555,
|
|
115576
|
+
c: 0.504,
|
|
115577
|
+
d: 0.605,
|
|
115578
|
+
e: 0.537,
|
|
115579
|
+
f: 0.497,
|
|
115580
|
+
g: 0.555,
|
|
115581
|
+
h: 0.567,
|
|
115582
|
+
i: 0.244,
|
|
115583
|
+
j: 0.328,
|
|
115584
|
+
k: 0.533,
|
|
115585
|
+
l: 0.225,
|
|
115586
|
+
m: 0.663,
|
|
115587
|
+
n: 0.526,
|
|
115588
|
+
o: 0.6,
|
|
115589
|
+
p: 0.537,
|
|
115590
|
+
q: 0.539,
|
|
115591
|
+
r: 0.412,
|
|
115592
|
+
s: 0.543,
|
|
115593
|
+
t: 0.553,
|
|
115594
|
+
u: 0.548,
|
|
115595
|
+
v: 0.525,
|
|
115596
|
+
w: 0.693,
|
|
115597
|
+
x: 0.591,
|
|
115598
|
+
y: 0.53,
|
|
115599
|
+
z: 0.572,
|
|
115600
|
+
"{": 0.504,
|
|
115601
|
+
"|": 0.299,
|
|
115602
|
+
"}": 0.544,
|
|
115603
|
+
"~": 0.669,
|
|
115604
|
+
" ": 0.4,
|
|
115605
|
+
"¡": 0.29,
|
|
115606
|
+
"¢": 0.489,
|
|
115607
|
+
"£": 0.71,
|
|
115608
|
+
"¥": 0.656,
|
|
115609
|
+
"¦": 0.299,
|
|
115610
|
+
"¨": 0.6,
|
|
115611
|
+
"©": 0.858,
|
|
115612
|
+
ª: 0.422,
|
|
115613
|
+
"«": 0.649,
|
|
115614
|
+
"®": 0.65,
|
|
115615
|
+
"¯": 0.6,
|
|
115616
|
+
"°": 0.412,
|
|
115617
|
+
"±": 0.55,
|
|
115618
|
+
"´": 0.6,
|
|
115619
|
+
"¶": 0.643,
|
|
115620
|
+
"·": 0.2,
|
|
115621
|
+
"¸": 0.6,
|
|
115622
|
+
º: 0.422,
|
|
115623
|
+
"»": 0.668,
|
|
115624
|
+
"¼": 0.762,
|
|
115625
|
+
"½": 0.762,
|
|
115626
|
+
"¾": 0.868,
|
|
115627
|
+
"¿": 0.455,
|
|
115628
|
+
À: 0.676,
|
|
115629
|
+
Á: 0.676,
|
|
115630
|
+
Â: 0.676,
|
|
115631
|
+
Ã: 0.676,
|
|
115632
|
+
Ä: 0.676,
|
|
115633
|
+
Å: 0.676,
|
|
115634
|
+
Æ: 1.028,
|
|
115635
|
+
Ç: 0.629,
|
|
115636
|
+
È: 0.707,
|
|
115637
|
+
É: 0.707,
|
|
115638
|
+
Ê: 0.707,
|
|
115639
|
+
Ë: 0.707,
|
|
115640
|
+
Ì: 0.545,
|
|
115641
|
+
Í: 0.545,
|
|
115642
|
+
Î: 0.545,
|
|
115643
|
+
Ï: 0.545,
|
|
115644
|
+
Ð: 0.815,
|
|
115645
|
+
Ñ: 0.632,
|
|
115646
|
+
Ò: 0.767,
|
|
115647
|
+
Ó: 0.767,
|
|
115648
|
+
Ô: 0.767,
|
|
115649
|
+
Õ: 0.767,
|
|
115650
|
+
Ö: 0.767,
|
|
115651
|
+
"×": 0.55,
|
|
115652
|
+
Ø: 0.772,
|
|
115653
|
+
Ù: 0.73,
|
|
115654
|
+
Ú: 0.73,
|
|
115655
|
+
Û: 0.73,
|
|
115656
|
+
Ü: 0.73,
|
|
115657
|
+
Ý: 0.564,
|
|
115658
|
+
Þ: 0.678,
|
|
115659
|
+
ß: 0.573,
|
|
115660
|
+
à: 0.542,
|
|
115661
|
+
á: 0.542,
|
|
115662
|
+
â: 0.542,
|
|
115663
|
+
ã: 0.542,
|
|
115664
|
+
ä: 0.542,
|
|
115665
|
+
å: 0.542,
|
|
115666
|
+
æ: 0.909,
|
|
115667
|
+
ç: 0.504,
|
|
115668
|
+
è: 0.551,
|
|
115669
|
+
é: 0.551,
|
|
115670
|
+
ê: 0.551,
|
|
115671
|
+
ë: 0.551,
|
|
115672
|
+
ì: 0.244,
|
|
115673
|
+
í: 0.244,
|
|
115674
|
+
î: 0.244,
|
|
115675
|
+
ï: 0.244,
|
|
115676
|
+
ð: 0.514,
|
|
115677
|
+
ñ: 0.526,
|
|
115678
|
+
ò: 0.561,
|
|
115679
|
+
ó: 0.561,
|
|
115680
|
+
ô: 0.561,
|
|
115681
|
+
õ: 0.561,
|
|
115682
|
+
ö: 0.561,
|
|
115683
|
+
"÷": 0.55,
|
|
115684
|
+
ø: 0.617,
|
|
115685
|
+
ù: 0.508,
|
|
115686
|
+
ú: 0.508,
|
|
115687
|
+
û: 0.508,
|
|
115688
|
+
ü: 0.508,
|
|
115689
|
+
ý: 0.522,
|
|
115690
|
+
þ: 0.568,
|
|
115691
|
+
ÿ: 0.522,
|
|
115692
|
+
Ā: 0.676,
|
|
115693
|
+
ā: 0.576,
|
|
115694
|
+
Ă: 0.676,
|
|
115695
|
+
ă: 0.542,
|
|
115696
|
+
Ą: 0.676,
|
|
115697
|
+
ą: 0.542,
|
|
115698
|
+
Ć: 0.629,
|
|
115699
|
+
ć: 0.504,
|
|
115700
|
+
Ĉ: 0.629,
|
|
115701
|
+
ĉ: 0.504,
|
|
115702
|
+
Ċ: 0.629,
|
|
115703
|
+
ċ: 0.504,
|
|
115704
|
+
Č: 0.629,
|
|
115705
|
+
č: 0.504,
|
|
115706
|
+
Ď: 0.78,
|
|
115707
|
+
ď: 0.605,
|
|
115708
|
+
Đ: 0.815,
|
|
115709
|
+
đ: 0.615,
|
|
115710
|
+
Ē: 0.707,
|
|
115711
|
+
ē: 0.537,
|
|
115712
|
+
Ĕ: 0.707,
|
|
115713
|
+
ĕ: 0.551,
|
|
115714
|
+
Ė: 0.707,
|
|
115715
|
+
ė: 0.551,
|
|
115716
|
+
Ę: 0.707,
|
|
115717
|
+
ę: 0.551,
|
|
115718
|
+
Ě: 0.707,
|
|
115719
|
+
ě: 0.551,
|
|
115720
|
+
Ĝ: 0.78,
|
|
115721
|
+
ĝ: 0.555,
|
|
115722
|
+
Ğ: 0.78,
|
|
115723
|
+
ğ: 0.555,
|
|
115724
|
+
Ġ: 0.78,
|
|
115725
|
+
ġ: 0.555,
|
|
115726
|
+
Ģ: 0.78,
|
|
115727
|
+
ģ: 0.555,
|
|
115728
|
+
Ĥ: 0.573,
|
|
115729
|
+
ĥ: 0.567,
|
|
115730
|
+
Ħ: 0.664,
|
|
115731
|
+
ħ: 0.621,
|
|
115732
|
+
Ĩ: 0.545,
|
|
115733
|
+
ĩ: 0.244,
|
|
115734
|
+
Ī: 0.545,
|
|
115735
|
+
ī: 0.244,
|
|
115736
|
+
Ĭ: 0.545,
|
|
115737
|
+
ĭ: 0.244,
|
|
115738
|
+
Į: 0.545,
|
|
115739
|
+
į: 0.244,
|
|
115740
|
+
İ: 0.545,
|
|
115741
|
+
ı: 0.244,
|
|
115742
|
+
IJ: 0.905,
|
|
115743
|
+
ij: 0.572,
|
|
115744
|
+
Ĵ: 0.569,
|
|
115745
|
+
ĵ: 0.328,
|
|
115746
|
+
Ķ: 0.613,
|
|
115747
|
+
ķ: 0.533,
|
|
115748
|
+
Ĺ: 0.543,
|
|
115749
|
+
ĺ: 0.225,
|
|
115750
|
+
Ļ: 0.543,
|
|
115751
|
+
ļ: 0.225,
|
|
115752
|
+
Ľ: 0.543,
|
|
115753
|
+
ľ: 0.225,
|
|
115754
|
+
Ŀ: 0.543,
|
|
115755
|
+
ŀ: 0.331,
|
|
115756
|
+
Ł: 0.63,
|
|
115757
|
+
ł: 0.408,
|
|
115758
|
+
Ń: 0.632,
|
|
115759
|
+
ń: 0.526,
|
|
115760
|
+
Ņ: 0.632,
|
|
115761
|
+
ņ: 0.526,
|
|
115762
|
+
Ň: 0.632,
|
|
115763
|
+
ň: 0.526,
|
|
115764
|
+
ʼn: 0.573,
|
|
115765
|
+
Ō: 0.767,
|
|
115766
|
+
ō: 0.6,
|
|
115767
|
+
Ŏ: 0.767,
|
|
115768
|
+
ŏ: 0.561,
|
|
115769
|
+
Ő: 0.767,
|
|
115770
|
+
ő: 0.561,
|
|
115771
|
+
Œ: 1.21,
|
|
115772
|
+
œ: 0.92,
|
|
115773
|
+
Ŕ: 0.736,
|
|
115774
|
+
ŕ: 0.412,
|
|
115775
|
+
Ŗ: 0.736,
|
|
115776
|
+
ŗ: 0.412,
|
|
115777
|
+
Ř: 0.736,
|
|
115778
|
+
ř: 0.412,
|
|
115779
|
+
Ś: 0.622,
|
|
115780
|
+
ś: 0.543,
|
|
115781
|
+
Ŝ: 0.622,
|
|
115782
|
+
ŝ: 0.543,
|
|
115783
|
+
Ş: 0.622,
|
|
115784
|
+
ş: 0.543,
|
|
115785
|
+
Š: 0.622,
|
|
115786
|
+
š: 0.543,
|
|
115787
|
+
Ţ: 0.857,
|
|
115788
|
+
ţ: 0.553,
|
|
115789
|
+
Ť: 0.857,
|
|
115790
|
+
ť: 0.553,
|
|
115791
|
+
Ŧ: 0.857,
|
|
115792
|
+
ŧ: 0.608,
|
|
115793
|
+
Ũ: 0.73,
|
|
115794
|
+
ũ: 0.508,
|
|
115795
|
+
Ū: 0.73,
|
|
115796
|
+
ū: 0.548,
|
|
115797
|
+
Ŭ: 0.73,
|
|
115798
|
+
ŭ: 0.508,
|
|
115799
|
+
Ů: 0.73,
|
|
115800
|
+
ů: 0.508,
|
|
115801
|
+
Ű: 0.73,
|
|
115802
|
+
ű: 0.508,
|
|
115803
|
+
Ų: 0.73,
|
|
115804
|
+
ų: 0.548,
|
|
115805
|
+
Ŵ: 0.786,
|
|
115806
|
+
ŵ: 0.693,
|
|
115807
|
+
Ŷ: 0.564,
|
|
115808
|
+
ŷ: 0.522,
|
|
115809
|
+
Ÿ: 0.564,
|
|
115810
|
+
Ź: 0.832,
|
|
115811
|
+
ź: 0.572,
|
|
115812
|
+
Ż: 0.832,
|
|
115813
|
+
ż: 0.572,
|
|
115814
|
+
Ž: 0.832,
|
|
115815
|
+
ž: 0.572,
|
|
115816
|
+
";": 0.298,
|
|
115817
|
+
"΄": 0.262,
|
|
115818
|
+
"΅": 0.669,
|
|
115819
|
+
Ά: 0.671,
|
|
115820
|
+
"·": 0.2,
|
|
115821
|
+
Έ: 0.823,
|
|
115822
|
+
Ή: 0.662,
|
|
115823
|
+
Ί: 0.664,
|
|
115824
|
+
Ό: 0.846,
|
|
115825
|
+
Ύ: 0.892,
|
|
115826
|
+
Ώ: 0.785,
|
|
115827
|
+
ΐ: 0.301,
|
|
115828
|
+
Α: 0.676,
|
|
115829
|
+
Β: 0.761,
|
|
115830
|
+
Γ: 0.558,
|
|
115831
|
+
Ε: 0.707,
|
|
115832
|
+
Ζ: 0.832,
|
|
115833
|
+
Η: 0.573,
|
|
115834
|
+
Θ: 0.748,
|
|
115835
|
+
Ι: 0.545,
|
|
115836
|
+
Κ: 0.613,
|
|
115837
|
+
Λ: 0.645,
|
|
115838
|
+
Μ: 0.766,
|
|
115839
|
+
Ν: 0.632,
|
|
115840
|
+
Ξ: 0.604,
|
|
115841
|
+
Ο: 0.767,
|
|
115842
|
+
Π: 0.586,
|
|
115843
|
+
Ρ: 0.698,
|
|
115844
|
+
Σ: 0.723,
|
|
115845
|
+
Τ: 0.857,
|
|
115846
|
+
Υ: 0.706,
|
|
115847
|
+
Φ: 0.693,
|
|
115848
|
+
Χ: 0.628,
|
|
115849
|
+
Ψ: 0.649,
|
|
115850
|
+
Ϊ: 0.545,
|
|
115851
|
+
Ϋ: 0.706,
|
|
115852
|
+
ά: 0.575,
|
|
115853
|
+
έ: 0.478,
|
|
115854
|
+
ή: 0.464,
|
|
115855
|
+
ί: 0.301,
|
|
115856
|
+
ΰ: 0.514,
|
|
115857
|
+
α: 0.575,
|
|
115858
|
+
β: 0.578,
|
|
115859
|
+
γ: 0.478,
|
|
115860
|
+
δ: 0.552,
|
|
115861
|
+
ε: 0.478,
|
|
115862
|
+
ζ: 0.431,
|
|
115863
|
+
η: 0.464,
|
|
115864
|
+
θ: 0.585,
|
|
115865
|
+
ι: 0.301,
|
|
115866
|
+
κ: 0.527,
|
|
115867
|
+
λ: 0.483,
|
|
115868
|
+
μ: 0.528,
|
|
115869
|
+
ν: 0.477,
|
|
115870
|
+
ξ: 0.47,
|
|
115871
|
+
ο: 0.536,
|
|
115872
|
+
π: 0.599,
|
|
115873
|
+
ρ: 0.52,
|
|
115874
|
+
ς: 0.411,
|
|
115875
|
+
σ: 0.516,
|
|
115876
|
+
τ: 0.479,
|
|
115877
|
+
υ: 0.514,
|
|
115878
|
+
φ: 0.643,
|
|
115879
|
+
χ: 0.486,
|
|
115880
|
+
ψ: 0.605,
|
|
115881
|
+
ω: 0.692,
|
|
115882
|
+
ϊ: 0.301,
|
|
115883
|
+
ϋ: 0.514,
|
|
115884
|
+
ό: 0.536,
|
|
115885
|
+
ύ: 0.514,
|
|
115886
|
+
ώ: 0.692,
|
|
115887
|
+
Ϗ: 0.613,
|
|
115888
|
+
ϗ: 0.566,
|
|
115889
|
+
Ѐ: 0.707,
|
|
115890
|
+
Ё: 0.707,
|
|
115891
|
+
Ђ: 0.73,
|
|
115892
|
+
Ѓ: 0.558,
|
|
115893
|
+
Є: 0.657,
|
|
115894
|
+
Ѕ: 0.622,
|
|
115895
|
+
І: 0.545,
|
|
115896
|
+
Ї: 0.545,
|
|
115897
|
+
Ј: 0.569,
|
|
115898
|
+
Љ: 1.029,
|
|
115899
|
+
Њ: 0.887,
|
|
115900
|
+
Ћ: 0.744,
|
|
115901
|
+
Ќ: 0.613,
|
|
115902
|
+
Ѝ: 0.62,
|
|
115903
|
+
Ў: 0.582,
|
|
115904
|
+
Џ: 0.607,
|
|
115905
|
+
А: 0.676,
|
|
115906
|
+
Б: 0.637,
|
|
115907
|
+
В: 0.761,
|
|
115908
|
+
Г: 0.558,
|
|
115909
|
+
Д: 0.745,
|
|
115910
|
+
Е: 0.707,
|
|
115911
|
+
Ж: 0.833,
|
|
115912
|
+
З: 0.632,
|
|
115913
|
+
И: 0.62,
|
|
115914
|
+
Й: 0.62,
|
|
115915
|
+
К: 0.613,
|
|
115916
|
+
Л: 0.666,
|
|
115917
|
+
М: 0.766,
|
|
115918
|
+
Н: 0.573,
|
|
115919
|
+
О: 0.767,
|
|
115920
|
+
П: 0.586,
|
|
115921
|
+
Р: 0.698,
|
|
115922
|
+
С: 0.629,
|
|
115923
|
+
Т: 0.857,
|
|
115924
|
+
У: 0.582,
|
|
115925
|
+
Ф: 0.693,
|
|
115926
|
+
Х: 0.628,
|
|
115927
|
+
Ц: 0.607,
|
|
115928
|
+
Ч: 0.591,
|
|
115929
|
+
Ш: 0.781,
|
|
115930
|
+
Щ: 0.792,
|
|
115931
|
+
Ъ: 0.687,
|
|
115932
|
+
Ы: 0.789,
|
|
115933
|
+
Ь: 0.637,
|
|
115934
|
+
Э: 0.65,
|
|
115935
|
+
Ю: 0.876,
|
|
115936
|
+
Я: 0.64,
|
|
115937
|
+
а: 0.576,
|
|
115938
|
+
б: 0.573,
|
|
115939
|
+
в: 0.513,
|
|
115940
|
+
г: 0.419,
|
|
115941
|
+
д: 0.553,
|
|
115942
|
+
е: 0.537,
|
|
115943
|
+
ж: 0.648,
|
|
115944
|
+
з: 0.509,
|
|
115945
|
+
и: 0.53,
|
|
115946
|
+
й: 0.53,
|
|
115947
|
+
к: 0.529,
|
|
115948
|
+
л: 0.548,
|
|
115949
|
+
м: 0.595,
|
|
115950
|
+
н: 0.541,
|
|
115951
|
+
о: 0.6,
|
|
115952
|
+
п: 0.551,
|
|
115953
|
+
р: 0.537,
|
|
115954
|
+
с: 0.504,
|
|
115955
|
+
т: 0.489,
|
|
115956
|
+
у: 0.53,
|
|
115957
|
+
ф: 0.602,
|
|
115958
|
+
х: 0.591,
|
|
115959
|
+
ц: 0.506,
|
|
115960
|
+
ч: 0.508,
|
|
115961
|
+
ш: 0.653,
|
|
115962
|
+
щ: 0.672,
|
|
115963
|
+
ъ: 0.598,
|
|
115964
|
+
ы: 0.699,
|
|
115965
|
+
ь: 0.509,
|
|
115966
|
+
э: 0.539,
|
|
115967
|
+
ю: 0.743,
|
|
115968
|
+
я: 0.554,
|
|
115969
|
+
ѐ: 0.551,
|
|
115970
|
+
ё: 0.551,
|
|
115971
|
+
ђ: 0.604,
|
|
115972
|
+
ѓ: 0.419,
|
|
115973
|
+
є: 0.543,
|
|
115974
|
+
ѕ: 0.543,
|
|
115975
|
+
і: 0.244,
|
|
115976
|
+
ї: 0.244,
|
|
115977
|
+
ј: 0.328,
|
|
115978
|
+
љ: 0.806,
|
|
115979
|
+
њ: 0.739,
|
|
115980
|
+
ћ: 0.621,
|
|
115981
|
+
ќ: 0.529,
|
|
115982
|
+
ѝ: 0.53,
|
|
115983
|
+
ў: 0.522,
|
|
115984
|
+
џ: 0.513,
|
|
115985
|
+
Ѣ: 0.784,
|
|
115986
|
+
ѣ: 0.64,
|
|
115987
|
+
Ѳ: 0.767,
|
|
115988
|
+
ѳ: 0.6,
|
|
115989
|
+
Ѵ: 0.609,
|
|
115990
|
+
ѵ: 0.531,
|
|
115991
|
+
Ґ: 0.558,
|
|
115992
|
+
ґ: 0.44,
|
|
115993
|
+
Ә: 0.657,
|
|
115994
|
+
ә: 0.544,
|
|
115995
|
+
Ӣ: 0.62,
|
|
115996
|
+
ӣ: 0.53,
|
|
115997
|
+
Ӧ: 0.767,
|
|
115998
|
+
ӧ: 0.6,
|
|
115999
|
+
Ө: 0.767,
|
|
116000
|
+
ө: 0.6,
|
|
116001
|
+
Ӯ: 0.582,
|
|
116002
|
+
ӯ: 0.53,
|
|
116003
|
+
"–": 0.702,
|
|
116004
|
+
"—": 0.935,
|
|
116005
|
+
"‘": 0.267,
|
|
116006
|
+
"’": 0.304,
|
|
116007
|
+
"‚": 0.239,
|
|
116008
|
+
"“": 0.412,
|
|
116009
|
+
"”": 0.428,
|
|
116010
|
+
"„": 0.428,
|
|
116011
|
+
"†": 0.549,
|
|
116012
|
+
"•": 0.522,
|
|
116013
|
+
"․": 0.274,
|
|
116014
|
+
"‥": 0.548,
|
|
116015
|
+
"…": 0.709
|
|
116016
|
+
}
|
|
116017
|
+
};
|
|
116018
|
+
});
|
|
116019
|
+
|
|
116020
|
+
// src/be/primitives/boards/elements.ts
|
|
116021
|
+
function measureText(text, fontSize) {
|
|
116022
|
+
const lines = text.split(`
|
|
116023
|
+
`);
|
|
116024
|
+
const em = Math.max(...lines.map((line) => [...line].reduce((sum, char) => {
|
|
116025
|
+
const known = widths[char];
|
|
116026
|
+
if (known !== undefined)
|
|
116027
|
+
return sum + known;
|
|
116028
|
+
return sum + ((char.codePointAt(0) ?? 0) >= 11904 ? excalifont_metrics_default.wide : excalifont_metrics_default.fallback);
|
|
116029
|
+
}, 0)));
|
|
116030
|
+
return {
|
|
116031
|
+
width: Math.max(1, Math.ceil(em * fontSize * WIDTH_SAFETY)),
|
|
116032
|
+
height: Math.ceil(lines.length * fontSize * LINE_HEIGHT)
|
|
116033
|
+
};
|
|
116034
|
+
}
|
|
116035
|
+
function newElementId() {
|
|
116036
|
+
const bytes = crypto.getRandomValues(new Uint8Array(21));
|
|
116037
|
+
return Array.from(bytes, (b) => ID_ALPHABET[b & 63]).join("");
|
|
116038
|
+
}
|
|
116039
|
+
function colorPair(color, where) {
|
|
116040
|
+
if (color === undefined)
|
|
116041
|
+
return;
|
|
116042
|
+
const named = Object.hasOwn(PALETTE, color) ? PALETTE[color] : undefined;
|
|
116043
|
+
if (named)
|
|
116044
|
+
return [named[0], named[1]];
|
|
116045
|
+
if (HEX.test(color))
|
|
116046
|
+
return [STROKE, color];
|
|
116047
|
+
throw new ObjectsError(`${where}: color '${color}' is not a palette name (${Object.keys(PALETTE).join(", ")}) or #rrggbb`);
|
|
116048
|
+
}
|
|
116049
|
+
function baseElement(type, geometry, now) {
|
|
116050
|
+
return {
|
|
116051
|
+
id: newElementId(),
|
|
116052
|
+
type,
|
|
116053
|
+
...geometry,
|
|
116054
|
+
angle: 0,
|
|
116055
|
+
strokeColor: STROKE,
|
|
116056
|
+
backgroundColor: "transparent",
|
|
116057
|
+
fillStyle: "solid",
|
|
116058
|
+
strokeWidth: 2,
|
|
116059
|
+
strokeStyle: "solid",
|
|
116060
|
+
roughness: 1,
|
|
116061
|
+
opacity: 100,
|
|
116062
|
+
groupIds: [],
|
|
116063
|
+
frameId: null,
|
|
116064
|
+
index: null,
|
|
116065
|
+
roundness: type === "rectangle" ? { type: 3 } : type === "diamond" || type === "arrow" ? { type: 2 } : null,
|
|
116066
|
+
seed: randomInt(),
|
|
116067
|
+
version: 1,
|
|
116068
|
+
versionNonce: randomInt(),
|
|
116069
|
+
isDeleted: false,
|
|
116070
|
+
boundElements: [],
|
|
116071
|
+
updated: now,
|
|
116072
|
+
link: null,
|
|
116073
|
+
locked: false
|
|
116074
|
+
};
|
|
116075
|
+
}
|
|
116076
|
+
function textElement(text, fontSize, at, containerId, now) {
|
|
116077
|
+
const size = measureText(text, fontSize);
|
|
116078
|
+
return {
|
|
116079
|
+
...baseElement("text", { ...at, ...size }, now),
|
|
116080
|
+
boundElements: null,
|
|
116081
|
+
text,
|
|
116082
|
+
originalText: text,
|
|
116083
|
+
fontSize,
|
|
116084
|
+
fontFamily: FONT_FAMILY_EXCALIFONT,
|
|
116085
|
+
textAlign: containerId ? "center" : "left",
|
|
116086
|
+
verticalAlign: containerId ? "middle" : "top",
|
|
116087
|
+
containerId,
|
|
116088
|
+
autoResize: true,
|
|
116089
|
+
lineHeight: LINE_HEIGHT
|
|
116090
|
+
};
|
|
116091
|
+
}
|
|
116092
|
+
function fitContainer(type, label, min) {
|
|
116093
|
+
const inner = {
|
|
116094
|
+
width: label.width + 2 * BOUND_TEXT_PADDING + LABEL_MARGIN,
|
|
116095
|
+
height: label.height + 2 * BOUND_TEXT_PADDING + LABEL_MARGIN
|
|
116096
|
+
};
|
|
116097
|
+
const scale = type === "ellipse" ? Math.SQRT2 : type === "diamond" ? 2 : 1;
|
|
116098
|
+
return {
|
|
116099
|
+
width: Math.max(min.width, Math.ceil(inner.width * scale)),
|
|
116100
|
+
height: Math.max(min.height, Math.ceil(inner.height * scale))
|
|
116101
|
+
};
|
|
116102
|
+
}
|
|
116103
|
+
function centerLabel(container, label) {
|
|
116104
|
+
if (container.type === "arrow") {
|
|
116105
|
+
const points = container.points ?? [[0, 0]];
|
|
116106
|
+
const first = points[0] ?? [0, 0];
|
|
116107
|
+
const last = points[points.length - 1] ?? first;
|
|
116108
|
+
label.x = container.x + ((first[0] ?? 0) + (last[0] ?? 0)) / 2 - label.width / 2;
|
|
116109
|
+
label.y = container.y + ((first[1] ?? 0) + (last[1] ?? 0)) / 2 - label.height / 2;
|
|
116110
|
+
return;
|
|
116111
|
+
}
|
|
116112
|
+
const c = center(container);
|
|
116113
|
+
label.x = c.x - label.width / 2;
|
|
116114
|
+
label.y = c.y - label.height / 2;
|
|
116115
|
+
}
|
|
116116
|
+
function route2(from, to) {
|
|
116117
|
+
const a = { x: from.x + from.width / 2, y: from.y + from.height / 2 };
|
|
116118
|
+
const b = { x: to.x + to.width / 2, y: to.y + to.height / 2 };
|
|
116119
|
+
const dx = b.x - a.x;
|
|
116120
|
+
const dy = b.y - a.y;
|
|
116121
|
+
const gapFrom = from.bound ? BINDING_GAP : 0;
|
|
116122
|
+
const gapTo = to.bound ? BINDING_GAP : 0;
|
|
116123
|
+
if (Math.abs(dx) >= Math.abs(dy)) {
|
|
116124
|
+
const s = dx >= 0 ? 1 : -1;
|
|
116125
|
+
return {
|
|
116126
|
+
start: [a.x + s * (from.width / 2 + gapFrom), a.y],
|
|
116127
|
+
end: [b.x - s * (to.width / 2 + gapTo), b.y]
|
|
116128
|
+
};
|
|
116129
|
+
}
|
|
116130
|
+
const s = dy >= 0 ? 1 : -1;
|
|
116131
|
+
return {
|
|
116132
|
+
start: [a.x, a.y + s * (from.height / 2 + gapFrom)],
|
|
116133
|
+
end: [b.x, b.y - s * (to.height / 2 + gapTo)]
|
|
116134
|
+
};
|
|
116135
|
+
}
|
|
116136
|
+
function placeArrow(arrow, from, to) {
|
|
116137
|
+
const { start, end } = route2(from, to);
|
|
116138
|
+
arrow.x = start[0];
|
|
116139
|
+
arrow.y = start[1];
|
|
116140
|
+
arrow.points = [
|
|
116141
|
+
[0, 0],
|
|
116142
|
+
[end[0] - start[0], end[1] - start[1]]
|
|
116143
|
+
];
|
|
116144
|
+
arrow.width = Math.abs(end[0] - start[0]);
|
|
116145
|
+
arrow.height = Math.abs(end[1] - start[1]);
|
|
116146
|
+
}
|
|
116147
|
+
function boxOf(element) {
|
|
116148
|
+
return { x: element.x, y: element.y, width: element.width, height: element.height, bound: true };
|
|
116149
|
+
}
|
|
116150
|
+
function pointBox(arrow, end) {
|
|
116151
|
+
const points = arrow.points ?? [[0, 0]];
|
|
116152
|
+
const p = (end === "start" ? points[0] : points[points.length - 1]) ?? [0, 0];
|
|
116153
|
+
return { x: arrow.x + (p[0] ?? 0), y: arrow.y + (p[1] ?? 0), width: 0, height: 0, bound: false };
|
|
116154
|
+
}
|
|
116155
|
+
function parseScene(content, path) {
|
|
116156
|
+
if (!content || typeof content !== "object" || Array.isArray(content)) {
|
|
116157
|
+
throw new ObjectsError(`'${path}' is not an Excalidraw scene (not a JSON object)`);
|
|
116158
|
+
}
|
|
116159
|
+
const scene = content;
|
|
116160
|
+
if (scene.elements === undefined)
|
|
116161
|
+
scene.elements = [];
|
|
116162
|
+
if (!Array.isArray(scene.elements)) {
|
|
116163
|
+
throw new ObjectsError(`'${path}' is not an Excalidraw scene (elements is not an array)`);
|
|
116164
|
+
}
|
|
116165
|
+
for (const element of scene.elements) {
|
|
116166
|
+
if (!element || typeof element.id !== "string" || typeof element.type !== "string") {
|
|
116167
|
+
throw new ObjectsError(`'${path}' has an element without a string id and type`);
|
|
116168
|
+
}
|
|
116169
|
+
}
|
|
116170
|
+
return scene;
|
|
116171
|
+
}
|
|
116172
|
+
function liveById(scene) {
|
|
116173
|
+
return new Map(live(scene).map((e) => [e.id, e]));
|
|
116174
|
+
}
|
|
116175
|
+
function bump(elements, now) {
|
|
116176
|
+
for (const element of new Set(elements)) {
|
|
116177
|
+
element.version = (typeof element.version === "number" ? element.version : 0) + 1;
|
|
116178
|
+
element.versionNonce = randomInt();
|
|
116179
|
+
element.updated = now;
|
|
116180
|
+
}
|
|
116181
|
+
}
|
|
116182
|
+
function addRef(element, ref) {
|
|
116183
|
+
const refs = Array.isArray(element.boundElements) ? element.boundElements : [];
|
|
116184
|
+
if (!refs.some((r) => r.id === ref.id))
|
|
116185
|
+
refs.push(ref);
|
|
116186
|
+
element.boundElements = refs;
|
|
116187
|
+
}
|
|
116188
|
+
function dropRef(element, id) {
|
|
116189
|
+
if (Array.isArray(element.boundElements)) {
|
|
116190
|
+
element.boundElements = element.boundElements.filter((r) => r.id !== id);
|
|
116191
|
+
}
|
|
116192
|
+
}
|
|
116193
|
+
function assignIndexes(scene, added) {
|
|
116194
|
+
if (added.length === 0)
|
|
116195
|
+
return;
|
|
116196
|
+
const existing = scene.elements.filter((e) => !added.includes(e)).map((e) => e.index).filter((i) => typeof i === "string").sort();
|
|
116197
|
+
let keys;
|
|
116198
|
+
try {
|
|
116199
|
+
keys = generateNKeysBetween(existing[existing.length - 1] ?? null, null, added.length);
|
|
116200
|
+
} catch {
|
|
116201
|
+
keys = generateNKeysBetween(null, null, added.length);
|
|
116202
|
+
}
|
|
116203
|
+
added.forEach((element, i) => {
|
|
116204
|
+
element.index = keys[i] ?? null;
|
|
116205
|
+
});
|
|
116206
|
+
}
|
|
116207
|
+
function layoutOrigin(scene) {
|
|
116208
|
+
const elements = live(scene);
|
|
116209
|
+
if (elements.length === 0)
|
|
116210
|
+
return { x: 0, y: 0 };
|
|
116211
|
+
return {
|
|
116212
|
+
x: Math.min(...elements.map((e) => e.x)),
|
|
116213
|
+
y: Math.max(...elements.map((e) => e.y + e.height)) + LAYOUT_GAP
|
|
116214
|
+
};
|
|
116215
|
+
}
|
|
116216
|
+
function layoutPositions(sizes, layout, origin) {
|
|
116217
|
+
if (layout === "grid") {
|
|
116218
|
+
const cols = Math.max(1, Math.ceil(Math.sqrt(sizes.length)));
|
|
116219
|
+
const cellW = Math.max(...sizes.map((s) => s.width), 0);
|
|
116220
|
+
const cellH = Math.max(...sizes.map((s) => s.height), 0);
|
|
116221
|
+
return sizes.map((s, i) => ({
|
|
116222
|
+
x: origin.x + i % cols * (cellW + LAYOUT_GAP) + (cellW - s.width) / 2,
|
|
116223
|
+
y: origin.y + Math.floor(i / cols) * (cellH + LAYOUT_GAP) + (cellH - s.height) / 2
|
|
116224
|
+
}));
|
|
116225
|
+
}
|
|
116226
|
+
let cursor = 0;
|
|
116227
|
+
return sizes.map((s) => {
|
|
116228
|
+
const at = layout === "row" ? { x: origin.x + cursor, y: origin.y } : { x: origin.x, y: origin.y + cursor };
|
|
116229
|
+
cursor += (layout === "row" ? s.width : s.height) + LAYOUT_GAP;
|
|
116230
|
+
return at;
|
|
116231
|
+
});
|
|
116232
|
+
}
|
|
116233
|
+
function addElements(scene, input, now = Date.now()) {
|
|
116234
|
+
const shapes = input.shapes ?? [];
|
|
116235
|
+
const arrows = input.arrows ?? [];
|
|
116236
|
+
const byKey = new Map;
|
|
116237
|
+
const keys = new Set;
|
|
116238
|
+
const added = {};
|
|
116239
|
+
const appended = [];
|
|
116240
|
+
const touched = [];
|
|
116241
|
+
const existing = liveById(scene);
|
|
116242
|
+
const planned = shapes.map((shape, i) => {
|
|
116243
|
+
const where = `shapes[${i}]`;
|
|
116244
|
+
if (shape.key !== undefined) {
|
|
116245
|
+
if (keys.has(shape.key))
|
|
116246
|
+
throw new ObjectsError(`${where}: duplicate key '${shape.key}'`);
|
|
116247
|
+
keys.add(shape.key);
|
|
116248
|
+
}
|
|
116249
|
+
const label = shape.label ?? "";
|
|
116250
|
+
if (shape.type === "text" && label.trim() === "") {
|
|
116251
|
+
throw new ObjectsError(`${where}: a text shape needs a non-empty label`);
|
|
116252
|
+
}
|
|
116253
|
+
const colors = colorPair(shape.color, where);
|
|
116254
|
+
const min = {
|
|
116255
|
+
width: shape.width ?? DEFAULT_SIZE.width,
|
|
116256
|
+
height: shape.height ?? DEFAULT_SIZE.height
|
|
116257
|
+
};
|
|
116258
|
+
const labelSize = label ? measureText(label, SHAPE_FONT_SIZE) : { width: 0, height: 0 };
|
|
116259
|
+
const size = shape.type === "text" ? labelSize : fitContainer(shape.type, labelSize, min);
|
|
116260
|
+
return { shape, label, colors, size };
|
|
116261
|
+
});
|
|
116262
|
+
const auto = planned.filter((p) => p.shape.x === undefined || p.shape.y === undefined);
|
|
116263
|
+
const positions = layoutPositions(auto.map((p) => p.size), input.layout ?? "row", layoutOrigin(scene));
|
|
116264
|
+
for (const [i, p] of planned.entries()) {
|
|
116265
|
+
const slot = auto.indexOf(p);
|
|
116266
|
+
const at = slot >= 0 ? positions[slot] : undefined;
|
|
116267
|
+
const x = p.shape.x ?? at?.x ?? 0;
|
|
116268
|
+
const y = p.shape.y ?? at?.y ?? 0;
|
|
116269
|
+
let element;
|
|
116270
|
+
if (p.shape.type === "text") {
|
|
116271
|
+
element = textElement(p.label, SHAPE_FONT_SIZE, { x, y }, null, now);
|
|
116272
|
+
if (p.colors)
|
|
116273
|
+
element.strokeColor = p.colors[0];
|
|
116274
|
+
appended.push(element);
|
|
116275
|
+
} else {
|
|
116276
|
+
element = baseElement(p.shape.type, { x, y, ...p.size }, now);
|
|
116277
|
+
if (p.colors)
|
|
116278
|
+
[element.strokeColor, element.backgroundColor] = p.colors;
|
|
116279
|
+
appended.push(element);
|
|
116280
|
+
if (p.label) {
|
|
116281
|
+
const text = textElement(p.label, SHAPE_FONT_SIZE, { x, y }, element.id, now);
|
|
116282
|
+
centerLabel(element, text);
|
|
116283
|
+
addRef(element, { type: "text", id: text.id });
|
|
116284
|
+
appended.push(text);
|
|
116285
|
+
}
|
|
116286
|
+
}
|
|
116287
|
+
if (p.shape.key !== undefined)
|
|
116288
|
+
byKey.set(p.shape.key, element);
|
|
116289
|
+
added[p.shape.key ?? `shapes[${i}]`] = element.id;
|
|
116290
|
+
}
|
|
116291
|
+
const resolve = (ref, where) => {
|
|
116292
|
+
const element = byKey.get(ref) ?? existing.get(ref);
|
|
116293
|
+
if (!element) {
|
|
116294
|
+
throw new ObjectsError(`${where}: '${ref}' is not a shape key in this call or a live element id`);
|
|
116295
|
+
}
|
|
116296
|
+
if (element.type === "arrow" || element.type === "line" || element.containerId) {
|
|
116297
|
+
throw new ObjectsError(`${where}: '${ref}' is a ${element.containerId ? "label" : element.type}; bind arrows to shapes`);
|
|
116298
|
+
}
|
|
116299
|
+
return element;
|
|
116300
|
+
};
|
|
116301
|
+
for (const [i, input] of arrows.entries()) {
|
|
116302
|
+
const where = `arrows[${i}]`;
|
|
116303
|
+
const from = resolve(input.from, `${where}.from`);
|
|
116304
|
+
const to = resolve(input.to, `${where}.to`);
|
|
116305
|
+
if (from === to)
|
|
116306
|
+
throw new ObjectsError(`${where}: an arrow needs two different shapes`);
|
|
116307
|
+
const arrow = {
|
|
116308
|
+
...baseElement("arrow", { x: 0, y: 0, width: 0, height: 0 }, now),
|
|
116309
|
+
points: [],
|
|
116310
|
+
lastCommittedPoint: null,
|
|
116311
|
+
startBinding: { elementId: from.id, focus: 0, gap: BINDING_GAP },
|
|
116312
|
+
endBinding: { elementId: to.id, focus: 0, gap: BINDING_GAP },
|
|
116313
|
+
startArrowhead: null,
|
|
116314
|
+
endArrowhead: "arrow",
|
|
116315
|
+
elbowed: false
|
|
116316
|
+
};
|
|
116317
|
+
placeArrow(arrow, boxOf(from), boxOf(to));
|
|
116318
|
+
addRef(from, { type: "arrow", id: arrow.id });
|
|
116319
|
+
addRef(to, { type: "arrow", id: arrow.id });
|
|
116320
|
+
for (const end of [from, to])
|
|
116321
|
+
if (!appended.includes(end))
|
|
116322
|
+
touched.push(end);
|
|
116323
|
+
appended.push(arrow);
|
|
116324
|
+
if (input.label) {
|
|
116325
|
+
const text = textElement(input.label, ARROW_FONT_SIZE, { x: 0, y: 0 }, arrow.id, now);
|
|
116326
|
+
text.textAlign = "center";
|
|
116327
|
+
text.verticalAlign = "middle";
|
|
116328
|
+
centerLabel(arrow, text);
|
|
116329
|
+
addRef(arrow, { type: "text", id: text.id });
|
|
116330
|
+
appended.push(text);
|
|
116331
|
+
}
|
|
116332
|
+
added[`arrows[${i}]`] = arrow.id;
|
|
116333
|
+
}
|
|
116334
|
+
scene.elements.push(...appended);
|
|
116335
|
+
assignIndexes(scene, appended);
|
|
116336
|
+
bump(touched, now);
|
|
116337
|
+
return added;
|
|
116338
|
+
}
|
|
116339
|
+
function rerouteArrows(scene, element, touched) {
|
|
116340
|
+
const byId = liveById(scene);
|
|
116341
|
+
for (const arrow of live(scene)) {
|
|
116342
|
+
if (arrow.type !== "arrow")
|
|
116343
|
+
continue;
|
|
116344
|
+
const startId = arrow.startBinding?.elementId;
|
|
116345
|
+
const endId = arrow.endBinding?.elementId;
|
|
116346
|
+
if (startId !== element.id && endId !== element.id)
|
|
116347
|
+
continue;
|
|
116348
|
+
const start = startId ? byId.get(startId) : undefined;
|
|
116349
|
+
const end = endId ? byId.get(endId) : undefined;
|
|
116350
|
+
placeArrow(arrow, start ? boxOf(start) : pointBox(arrow, "start"), end ? boxOf(end) : pointBox(arrow, "end"));
|
|
116351
|
+
touched.push(arrow);
|
|
116352
|
+
const label = labelOf(scene, arrow);
|
|
116353
|
+
if (label) {
|
|
116354
|
+
centerLabel(arrow, label);
|
|
116355
|
+
touched.push(label);
|
|
116356
|
+
}
|
|
116357
|
+
}
|
|
116358
|
+
}
|
|
116359
|
+
function setLabel(scene, element, label, now, touched, appended) {
|
|
116360
|
+
if (element.type === "text") {
|
|
116361
|
+
if (label.trim() === "")
|
|
116362
|
+
throw new ObjectsError(`${element.id}: a text element needs a non-empty label`);
|
|
116363
|
+
const size = measureText(label, element.fontSize ?? SHAPE_FONT_SIZE);
|
|
116364
|
+
Object.assign(element, { text: label, originalText: label, ...size });
|
|
116365
|
+
return;
|
|
116366
|
+
}
|
|
116367
|
+
const existing = labelOf(scene, element);
|
|
116368
|
+
if (label === "") {
|
|
116369
|
+
if (existing) {
|
|
116370
|
+
dropRef(element, existing.id);
|
|
116371
|
+
if (appended.includes(existing)) {
|
|
116372
|
+
scene.elements.splice(scene.elements.indexOf(existing), 1);
|
|
116373
|
+
appended.splice(appended.indexOf(existing), 1);
|
|
116374
|
+
} else {
|
|
116375
|
+
existing.isDeleted = true;
|
|
116376
|
+
touched.push(existing);
|
|
116377
|
+
}
|
|
116378
|
+
}
|
|
116379
|
+
return;
|
|
116380
|
+
}
|
|
116381
|
+
const fontSize = element.type === "arrow" ? ARROW_FONT_SIZE : SHAPE_FONT_SIZE;
|
|
116382
|
+
if (existing) {
|
|
116383
|
+
Object.assign(existing, {
|
|
116384
|
+
text: label,
|
|
116385
|
+
originalText: label,
|
|
116386
|
+
...measureText(label, existing.fontSize ?? fontSize)
|
|
116387
|
+
});
|
|
116388
|
+
touched.push(existing);
|
|
116389
|
+
return;
|
|
116390
|
+
}
|
|
116391
|
+
const text = textElement(label, fontSize, { x: element.x, y: element.y }, element.id, now);
|
|
116392
|
+
text.textAlign = "center";
|
|
116393
|
+
text.verticalAlign = "middle";
|
|
116394
|
+
addRef(element, { type: "text", id: text.id });
|
|
116395
|
+
scene.elements.push(text);
|
|
116396
|
+
appended.push(text);
|
|
116397
|
+
}
|
|
116398
|
+
function updateElements(scene, patches, now = Date.now()) {
|
|
116399
|
+
const byId = liveById(scene);
|
|
116400
|
+
const touched = [];
|
|
116401
|
+
const appended = [];
|
|
116402
|
+
for (const [i, patch] of patches.entries()) {
|
|
116403
|
+
const where = `patches[${i}]`;
|
|
116404
|
+
const element = byId.get(patch.elementId);
|
|
116405
|
+
if (!element)
|
|
116406
|
+
throw new ObjectsError(`${where}: no live element '${patch.elementId}'`);
|
|
116407
|
+
if (element.type === "text" && element.containerId) {
|
|
116408
|
+
throw new ObjectsError(`${where}: '${element.id}' is the label of '${element.containerId}'; patch that element`);
|
|
116409
|
+
}
|
|
116410
|
+
const moves = [patch.x, patch.y, patch.width, patch.height].some((v) => v !== undefined);
|
|
116411
|
+
if (element.type === "arrow" && moves) {
|
|
116412
|
+
throw new ObjectsError(`${where}: arrows follow the shapes they bind; move or resize the shapes`);
|
|
116413
|
+
}
|
|
116414
|
+
touched.push(element);
|
|
116415
|
+
const colors = colorPair(patch.color, where);
|
|
116416
|
+
if (colors) {
|
|
116417
|
+
element.strokeColor = colors[0];
|
|
116418
|
+
if (element.type !== "text" && element.type !== "arrow")
|
|
116419
|
+
element.backgroundColor = colors[1];
|
|
116420
|
+
}
|
|
116421
|
+
if (patch.x !== undefined)
|
|
116422
|
+
element.x = patch.x;
|
|
116423
|
+
if (patch.y !== undefined)
|
|
116424
|
+
element.y = patch.y;
|
|
116425
|
+
if (patch.width !== undefined)
|
|
116426
|
+
element.width = patch.width;
|
|
116427
|
+
if (patch.height !== undefined)
|
|
116428
|
+
element.height = patch.height;
|
|
116429
|
+
if (patch.label !== undefined)
|
|
116430
|
+
setLabel(scene, element, patch.label, now, touched, appended);
|
|
116431
|
+
const label = element.type === "text" ? undefined : labelOf(scene, element);
|
|
116432
|
+
if (label) {
|
|
116433
|
+
if (element.type !== "arrow") {
|
|
116434
|
+
Object.assign(element, fitContainer(element.type, label, element));
|
|
116435
|
+
}
|
|
116436
|
+
centerLabel(element, label);
|
|
116437
|
+
touched.push(label);
|
|
116438
|
+
}
|
|
116439
|
+
if (element.type !== "arrow" && (moves || patch.label !== undefined))
|
|
116440
|
+
rerouteArrows(scene, element, touched);
|
|
116441
|
+
}
|
|
116442
|
+
assignIndexes(scene, appended);
|
|
116443
|
+
bump(touched.filter((e) => !appended.includes(e)), now);
|
|
116444
|
+
return patches.map((p) => p.elementId);
|
|
116445
|
+
}
|
|
116446
|
+
function removeElements(scene, elementIds, now = Date.now()) {
|
|
116447
|
+
const byId = liveById(scene);
|
|
116448
|
+
const unknown = elementIds.filter((id) => !byId.has(id));
|
|
116449
|
+
if (unknown.length > 0)
|
|
116450
|
+
throw new ObjectsError(`no live element: ${unknown.join(", ")}`);
|
|
116451
|
+
const touched = [];
|
|
116452
|
+
for (const id of new Set(elementIds)) {
|
|
116453
|
+
const element = byId.get(id);
|
|
116454
|
+
if (!element || element.isDeleted)
|
|
116455
|
+
continue;
|
|
116456
|
+
element.isDeleted = true;
|
|
116457
|
+
touched.push(element);
|
|
116458
|
+
if (element.containerId) {
|
|
116459
|
+
const container = byId.get(element.containerId);
|
|
116460
|
+
if (container) {
|
|
116461
|
+
dropRef(container, element.id);
|
|
116462
|
+
touched.push(container);
|
|
116463
|
+
}
|
|
116464
|
+
}
|
|
116465
|
+
const label = labelOf(scene, element);
|
|
116466
|
+
if (label) {
|
|
116467
|
+
label.isDeleted = true;
|
|
116468
|
+
touched.push(label);
|
|
116469
|
+
}
|
|
116470
|
+
if (element.type === "arrow") {
|
|
116471
|
+
for (const binding of [element.startBinding, element.endBinding]) {
|
|
116472
|
+
const end = binding ? byId.get(binding.elementId) : undefined;
|
|
116473
|
+
if (end) {
|
|
116474
|
+
dropRef(end, element.id);
|
|
116475
|
+
touched.push(end);
|
|
116476
|
+
}
|
|
116477
|
+
}
|
|
116478
|
+
continue;
|
|
116479
|
+
}
|
|
116480
|
+
for (const arrow of live(scene)) {
|
|
116481
|
+
if (arrow.type !== "arrow")
|
|
116482
|
+
continue;
|
|
116483
|
+
if (arrow.startBinding?.elementId === element.id)
|
|
116484
|
+
arrow.startBinding = null;
|
|
116485
|
+
else if (arrow.endBinding?.elementId === element.id)
|
|
116486
|
+
arrow.endBinding = null;
|
|
116487
|
+
else
|
|
116488
|
+
continue;
|
|
116489
|
+
touched.push(arrow);
|
|
116490
|
+
}
|
|
116491
|
+
}
|
|
116492
|
+
bump(touched, now);
|
|
116493
|
+
return [...new Set(elementIds)];
|
|
116494
|
+
}
|
|
116495
|
+
function summarize(scene) {
|
|
116496
|
+
const elements = live(scene);
|
|
116497
|
+
const labels = new Map(elements.filter((e) => e.type === "text" && e.containerId).map((e) => [e.containerId, e.text ?? ""]));
|
|
116498
|
+
const liveIds = new Set(elements.map((e) => e.id));
|
|
116499
|
+
return elements.filter((e) => !(e.type === "text" && e.containerId)).map((e) => ({
|
|
116500
|
+
id: e.id,
|
|
116501
|
+
type: e.type,
|
|
116502
|
+
text: e.type === "text" ? e.text ?? "" : labels.get(e.id) ?? null,
|
|
116503
|
+
x: e.x,
|
|
116504
|
+
y: e.y,
|
|
116505
|
+
width: e.width,
|
|
116506
|
+
height: e.height,
|
|
116507
|
+
boundTo: e.type === "arrow" ? [e.startBinding?.elementId ?? null, e.endBinding?.elementId ?? null] : (e.boundElements ?? []).filter((r) => r.type === "arrow" && liveIds.has(r.id)).map((r) => r.id)
|
|
116508
|
+
}));
|
|
116509
|
+
}
|
|
116510
|
+
var SHAPE_TYPES, LAYOUTS, PALETTE, STROKE = "#1e1e1e", FONT_FAMILY_EXCALIFONT = 5, LINE_HEIGHT, SHAPE_FONT_SIZE = 20, ARROW_FONT_SIZE = 16, BOUND_TEXT_PADDING = 5, LABEL_MARGIN = 20, DEFAULT_SIZE, BINDING_GAP = 4, LAYOUT_GAP = 80, WIDTH_SAFETY = 1.05, HEX, ID_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-", widths, randomInt = () => (crypto.getRandomValues(new Uint32Array(1))[0] ?? 1) >>> 1 || 1, center = (e) => ({ x: e.x + e.width / 2, y: e.y + e.height / 2 }), live = (scene) => scene.elements.filter((e) => !e.isDeleted), labelOf = (scene, container) => live(scene).find((e) => e.type === "text" && e.containerId === container.id);
|
|
116511
|
+
var init_elements = __esm(() => {
|
|
116512
|
+
init_src();
|
|
116513
|
+
init_objects();
|
|
116514
|
+
init_excalifont_metrics();
|
|
116515
|
+
SHAPE_TYPES = ["rectangle", "ellipse", "diamond", "text"];
|
|
116516
|
+
LAYOUTS = ["row", "column", "grid"];
|
|
116517
|
+
PALETTE = {
|
|
116518
|
+
blue: ["#1971c2", "#a5d8ff"],
|
|
116519
|
+
green: ["#2f9e44", "#b2f2bb"],
|
|
116520
|
+
yellow: ["#f08c00", "#ffec99"],
|
|
116521
|
+
red: ["#e03131", "#ffc9c9"],
|
|
116522
|
+
violet: ["#6741d9", "#d0bfff"],
|
|
116523
|
+
orange: ["#e8590c", "#ffd8a8"],
|
|
116524
|
+
gray: ["#495057", "#e9ecef"],
|
|
116525
|
+
teal: ["#0c8599", "#96f2d7"]
|
|
116526
|
+
};
|
|
116527
|
+
LINE_HEIGHT = excalifont_metrics_default.lineHeight;
|
|
116528
|
+
DEFAULT_SIZE = { width: 200, height: 80 };
|
|
116529
|
+
HEX = /^#[0-9a-fA-F]{6}$/;
|
|
116530
|
+
widths = excalifont_metrics_default.widths;
|
|
116531
|
+
});
|
|
116532
|
+
|
|
116533
|
+
// src/be/primitives/write-object.ts
|
|
116534
|
+
async function mutateObject(input) {
|
|
116535
|
+
const kind = PRIMITIVE_KINDS[input.kind];
|
|
116536
|
+
if (!kind)
|
|
116537
|
+
throw new ObjectsError(`unknown kind '${input.kind}'`);
|
|
116538
|
+
const { provider, scope } = await clientFor(input.agentId);
|
|
116539
|
+
for (let attempt = 1;; attempt += 1) {
|
|
116540
|
+
const { object, missing, content } = await getObject({
|
|
116541
|
+
agentId: input.agentId,
|
|
116542
|
+
id: input.id,
|
|
116543
|
+
path: input.path,
|
|
116544
|
+
includeContent: true
|
|
116545
|
+
});
|
|
116546
|
+
if (object.kind !== input.kind) {
|
|
116547
|
+
throw new ObjectsError(`object ${object.id} is a ${object.kind}, not a ${input.kind}`);
|
|
116548
|
+
}
|
|
116549
|
+
if (missing) {
|
|
116550
|
+
throw new ObjectsError(`the file for ${object.kind} ${object.id} at '${object.path}' is missing; run object-reindex`);
|
|
116551
|
+
}
|
|
116552
|
+
if (!content || typeof content !== "object" || Array.isArray(content)) {
|
|
116553
|
+
throw new ObjectsError(`'${object.path}' is not a JSON object`);
|
|
116554
|
+
}
|
|
116555
|
+
if (object.fileVersion === null) {
|
|
116556
|
+
throw new ObjectsError(`agent-fs returned no version for '${object.path}'; refusing an unguarded write`);
|
|
116557
|
+
}
|
|
116558
|
+
const result = input.mutate(content, object);
|
|
116559
|
+
const body = JSON.stringify(kind.withId(content, object.id), null, 2);
|
|
116560
|
+
if (Buffer.byteLength(body) > MAX_OBJECT_BYTES) {
|
|
116561
|
+
throw new ObjectsError(`'${object.path}' would exceed ${MAX_OBJECT_BYTES} bytes; nothing written`);
|
|
116562
|
+
}
|
|
116563
|
+
try {
|
|
116564
|
+
const written = await provider.upload(scope(object.path), body, {
|
|
116565
|
+
contentType: kind.contentType,
|
|
116566
|
+
ifMatch: String(object.fileVersion),
|
|
116567
|
+
message: input.message
|
|
116568
|
+
});
|
|
116569
|
+
const version = Number.isFinite(Number(written.version)) ? Number(written.version) : null;
|
|
116570
|
+
await recordObjectVersion(object.id, version);
|
|
116571
|
+
return { object: { ...object, fileVersion: version }, version, result };
|
|
116572
|
+
} catch (error) {
|
|
116573
|
+
if (!(error instanceof FilesError && error.code === "Conflict"))
|
|
116574
|
+
throw error;
|
|
116575
|
+
if (attempt >= MAX_WRITE_ATTEMPTS) {
|
|
116576
|
+
throw new ObjectsError(`concurrent writers changed '${object.path}' ${attempt} times in a row; retry`);
|
|
116577
|
+
}
|
|
116578
|
+
}
|
|
116579
|
+
}
|
|
116580
|
+
}
|
|
116581
|
+
var MAX_OBJECT_BYTES, MAX_WRITE_ATTEMPTS = 4;
|
|
116582
|
+
var init_write_object = __esm(() => {
|
|
116583
|
+
init_provider();
|
|
116584
|
+
init_objects();
|
|
116585
|
+
MAX_OBJECT_BYTES = 5 * 1024 * 1024;
|
|
116586
|
+
});
|
|
116587
|
+
|
|
116588
|
+
// src/be/primitives/boards/service.ts
|
|
116589
|
+
async function createBoard(input) {
|
|
116590
|
+
let added = {};
|
|
116591
|
+
const object = await createObject({
|
|
116592
|
+
agentId: input.agentId,
|
|
116593
|
+
kind: "board",
|
|
116594
|
+
path: input.path,
|
|
116595
|
+
title: input.title,
|
|
116596
|
+
build: (empty) => {
|
|
116597
|
+
added = addElements(parseScene(empty, input.path), input);
|
|
116598
|
+
return empty;
|
|
116599
|
+
}
|
|
116600
|
+
});
|
|
116601
|
+
return { object, added };
|
|
116602
|
+
}
|
|
116603
|
+
async function getBoard(input) {
|
|
116604
|
+
const { object, missing, content } = await getObject({ ...ref(input), includeContent: true });
|
|
116605
|
+
if (object.kind !== "board")
|
|
116606
|
+
throw new ObjectsError(`object ${object.id} is a ${object.kind}, not a board`);
|
|
116607
|
+
if (missing) {
|
|
116608
|
+
throw new ObjectsError(`the file for board ${object.id} at '${object.path}' is missing; run object-reindex`);
|
|
116609
|
+
}
|
|
116610
|
+
const scene = parseScene(content, object.path);
|
|
116611
|
+
return {
|
|
116612
|
+
object,
|
|
116613
|
+
version: object.fileVersion,
|
|
116614
|
+
elements: input.detail === "full" ? scene.elements.filter((e) => !e.isDeleted) : summarize(scene)
|
|
116615
|
+
};
|
|
116616
|
+
}
|
|
116617
|
+
function listBoards(input) {
|
|
116618
|
+
return listObjects({ ...input, kind: "board" });
|
|
116619
|
+
}
|
|
116620
|
+
async function addBoardElements(input) {
|
|
116621
|
+
if (!input.shapes?.length && !input.arrows?.length) {
|
|
116622
|
+
throw new ObjectsError("pass at least one shape or arrow");
|
|
116623
|
+
}
|
|
116624
|
+
const { object, version, result } = await mutateObject({
|
|
116625
|
+
...ref(input),
|
|
116626
|
+
message: "add board elements",
|
|
116627
|
+
mutate: (content, o) => addElements(parseScene(content, o.path), input)
|
|
116628
|
+
});
|
|
116629
|
+
return { object, version, added: result };
|
|
116630
|
+
}
|
|
116631
|
+
async function updateBoardElements(input) {
|
|
116632
|
+
if (input.patches.length === 0)
|
|
116633
|
+
throw new ObjectsError("pass at least one patch");
|
|
116634
|
+
const { object, version, result } = await mutateObject({
|
|
116635
|
+
...ref(input),
|
|
116636
|
+
message: "update board elements",
|
|
116637
|
+
mutate: (content, o) => updateElements(parseScene(content, o.path), input.patches)
|
|
116638
|
+
});
|
|
116639
|
+
return { object, version, updated: result };
|
|
116640
|
+
}
|
|
116641
|
+
async function removeBoardElements(input) {
|
|
116642
|
+
if (input.elementIds.length === 0)
|
|
116643
|
+
throw new ObjectsError("pass at least one element id");
|
|
116644
|
+
const { object, version, result } = await mutateObject({
|
|
116645
|
+
...ref(input),
|
|
116646
|
+
message: "remove board elements",
|
|
116647
|
+
mutate: (content, o) => removeElements(parseScene(content, o.path), input.elementIds)
|
|
116648
|
+
});
|
|
116649
|
+
return { object, version, removed: result };
|
|
116650
|
+
}
|
|
116651
|
+
var ref = (input) => {
|
|
116652
|
+
if (!input.id && !input.path)
|
|
116653
|
+
throw new ObjectsError("pass `id` or `path`");
|
|
116654
|
+
return { agentId: input.agentId, id: input.id, path: input.path, kind: "board" };
|
|
116655
|
+
};
|
|
116656
|
+
var init_service = __esm(() => {
|
|
116657
|
+
init_objects();
|
|
116658
|
+
init_write_object();
|
|
116659
|
+
init_elements();
|
|
116660
|
+
});
|
|
116661
|
+
|
|
116662
|
+
// src/tools/objects.ts
|
|
116663
|
+
async function refusing(agentId, run) {
|
|
116664
|
+
try {
|
|
116665
|
+
return { value: await run() };
|
|
116666
|
+
} catch (error) {
|
|
116667
|
+
if (error instanceof ObjectsError || error instanceof FilesError) {
|
|
116668
|
+
return { error: toolErr(error.message, { data: { yourAgentId: agentId } }) };
|
|
116669
|
+
}
|
|
116670
|
+
throw error;
|
|
116671
|
+
}
|
|
116672
|
+
}
|
|
116673
|
+
var objectOutputSchema, KindSchema, summary = (o) => `${o.kind} ${o.id} at ${o.path}${o.link ? ` (${o.link})` : ""}`, registerObjectCreateTool = (server) => {
|
|
116674
|
+
createToolRegistrar(server)("object-create", {
|
|
116675
|
+
title: "Create primitive object",
|
|
116676
|
+
annotations: { readOnlyHint: false, idempotentHint: false },
|
|
116677
|
+
description: "Create a primitive object file on your default agent-fs drive, as your own agent-fs identity, and give it a stable id. Create-only: refuses when the path exists (use object-reindex to adopt an existing file). Kind `board` writes an empty Excalidraw scene and needs a `.excalidraw` path. Kind `sheet` writes an empty `swarm-sheet/1` workbook and needs a `.sheet.json` path (edit it with the sheet-* tools).",
|
|
116678
|
+
inputSchema: object2({
|
|
116679
|
+
kind: KindSchema.describe("Object kind. `board`: an Excalidraw scene (.excalidraw). `sheet`: a spreadsheet (.sheet.json)."),
|
|
116680
|
+
path: string2().min(1).describe("Drive path, e.g. /boards/roadmap.excalidraw."),
|
|
116681
|
+
title: string2().max(200).optional()
|
|
116682
|
+
}),
|
|
116683
|
+
outputSchema: swarmToolOutputSchema({
|
|
116684
|
+
yourAgentId: string2().optional(),
|
|
116685
|
+
object: objectOutputSchema.optional()
|
|
116686
|
+
})
|
|
116687
|
+
}, async ({ kind, path, title }, requestInfo) => {
|
|
116688
|
+
const result = await refusing(requestInfo.agentId, () => createObject({ agentId: requestInfo.agentId, kind, path, title }));
|
|
116689
|
+
if ("error" in result)
|
|
116690
|
+
return result.error;
|
|
116691
|
+
return toolOk(`Created ${summary(result.value)}.`, {
|
|
116692
|
+
data: { yourAgentId: requestInfo.agentId, object: result.value }
|
|
116693
|
+
});
|
|
116694
|
+
});
|
|
116695
|
+
}, registerObjectGetTool = (server) => {
|
|
116696
|
+
createToolRegistrar(server)("object-get", {
|
|
116697
|
+
title: "Get primitive object",
|
|
116698
|
+
description: "Get a primitive object on your default agent-fs drive by `id` or `path`. `missing: true` means the row exists but the file is gone. `includeContent` returns the parsed file.",
|
|
116699
|
+
annotations: { readOnlyHint: true },
|
|
116700
|
+
inputSchema: object2({
|
|
116701
|
+
id: string2().min(1).optional(),
|
|
116702
|
+
path: string2().min(1).optional(),
|
|
116703
|
+
includeContent: boolean().optional()
|
|
116704
|
+
}),
|
|
116705
|
+
outputSchema: swarmToolOutputSchema({
|
|
116706
|
+
yourAgentId: string2().optional(),
|
|
116707
|
+
object: objectOutputSchema.optional(),
|
|
116708
|
+
missing: boolean().optional(),
|
|
116709
|
+
content: unknown().optional()
|
|
116710
|
+
})
|
|
116711
|
+
}, async ({ id, path, includeContent }, requestInfo) => {
|
|
116712
|
+
const result = await refusing(requestInfo.agentId, () => getObject({ agentId: requestInfo.agentId, id, path, includeContent }));
|
|
116713
|
+
if ("error" in result)
|
|
116714
|
+
return result.error;
|
|
116715
|
+
const { object, missing, content } = result.value;
|
|
116716
|
+
return toolOk(missing ? `File for ${summary(object)} is missing.` : `Found ${summary(object)}.`, {
|
|
116717
|
+
data: {
|
|
116718
|
+
yourAgentId: requestInfo.agentId,
|
|
116719
|
+
object,
|
|
116720
|
+
missing,
|
|
116721
|
+
...content === undefined ? {} : { content }
|
|
116722
|
+
}
|
|
116723
|
+
});
|
|
116724
|
+
});
|
|
116725
|
+
}, registerObjectListTool = (server) => {
|
|
116726
|
+
createToolRegistrar(server)("object-list", {
|
|
116727
|
+
title: "List primitive objects",
|
|
116728
|
+
description: "List primitive objects on your default agent-fs drive, newest first. Hides objects whose file agent-fs reported deleted. Filter by `kind` and path `prefix`. Pagination via limit (max 200) and offset.",
|
|
116729
|
+
annotations: { readOnlyHint: true },
|
|
116730
|
+
inputSchema: object2({
|
|
116731
|
+
kind: KindSchema.optional(),
|
|
116732
|
+
prefix: string2().optional(),
|
|
116733
|
+
limit: number2().int().positive().max(200).optional(),
|
|
116734
|
+
offset: number2().int().nonnegative().optional()
|
|
116735
|
+
}),
|
|
116736
|
+
outputSchema: swarmToolOutputSchema({
|
|
116737
|
+
yourAgentId: string2().optional(),
|
|
116738
|
+
objects: array2(objectOutputSchema).optional(),
|
|
116739
|
+
total: number2().optional()
|
|
116740
|
+
})
|
|
116741
|
+
}, async ({ kind, prefix, limit, offset }, requestInfo) => {
|
|
116742
|
+
const result = await refusing(requestInfo.agentId, () => listObjects({ agentId: requestInfo.agentId, kind, prefix, limit, offset }));
|
|
116743
|
+
if ("error" in result)
|
|
116744
|
+
return result.error;
|
|
116745
|
+
const { objects, total } = result.value;
|
|
116746
|
+
return toolOk(`Found ${objects.length} of ${total} objects.`, {
|
|
116747
|
+
details: objects.length > 0 ? objects.map((o) => `- ${summary(o)}`).join(`
|
|
116748
|
+
`) : undefined,
|
|
116749
|
+
data: { yourAgentId: requestInfo.agentId, objects, total }
|
|
116750
|
+
});
|
|
116751
|
+
});
|
|
116752
|
+
}, registerObjectReindexTool = (server) => {
|
|
116753
|
+
createToolRegistrar(server)("object-reindex", {
|
|
116754
|
+
title: "Reindex primitive objects",
|
|
116755
|
+
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({ kind: KindSchema.optional() }),
|
|
116758
|
+
outputSchema: swarmToolOutputSchema({
|
|
116759
|
+
yourAgentId: string2().optional(),
|
|
116760
|
+
scanned: number2().optional(),
|
|
116761
|
+
unchanged: number2().optional(),
|
|
116762
|
+
adopted: array2(string2()).optional(),
|
|
116763
|
+
restored: array2(string2()).optional(),
|
|
116764
|
+
missing: array2(string2()).optional(),
|
|
116765
|
+
conflicts: array2(looseObject({ path: string2(), reason: string2() })).optional(),
|
|
116766
|
+
truncated: boolean().optional(),
|
|
116767
|
+
cutBy: _enum2(["files", "reads", "time", "bytes"]).nullable().optional()
|
|
116768
|
+
})
|
|
116769
|
+
}, async ({ kind }, requestInfo) => {
|
|
116770
|
+
const result = await refusing(requestInfo.agentId, () => reindexObjects({ agentId: requestInfo.agentId, kind }));
|
|
116771
|
+
if ("error" in result)
|
|
116772
|
+
return result.error;
|
|
116773
|
+
const report = result.value;
|
|
116774
|
+
return toolOk(`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
|
+
});
|
|
116776
|
+
};
|
|
116777
|
+
var init_objects2 = __esm(() => {
|
|
116778
|
+
init_zod();
|
|
116779
|
+
init_objects();
|
|
116780
|
+
init_provider();
|
|
116781
|
+
init_utils();
|
|
116782
|
+
objectOutputSchema = looseObject({
|
|
116783
|
+
id: string2().optional(),
|
|
116784
|
+
kind: string2().optional(),
|
|
116785
|
+
orgId: string2().optional(),
|
|
116786
|
+
driveId: string2().optional(),
|
|
116787
|
+
path: string2().optional(),
|
|
116788
|
+
title: string2().nullable().optional(),
|
|
116789
|
+
fileVersion: number2().nullable().optional(),
|
|
116790
|
+
ownerAgentId: string2().nullable().optional(),
|
|
116791
|
+
deletedAt: string2().nullable().optional(),
|
|
116792
|
+
createdAt: string2().optional(),
|
|
116793
|
+
updatedAt: string2().optional(),
|
|
116794
|
+
link: string2().nullable().optional()
|
|
116795
|
+
});
|
|
116796
|
+
KindSchema = _enum2(PRIMITIVE_KIND_NAMES);
|
|
116797
|
+
});
|
|
116798
|
+
|
|
116799
|
+
// src/tools/boards.ts
|
|
116800
|
+
var Coord, Size, Color, ShapeSchema, ArrowSchema, Shapes, Arrows, LayoutSchema, IdOrPath, boardOut, Added, where = (o) => `${o.path}${o.link ? ` (${o.link})` : ""}`, registerBoardCreateTool = (server) => {
|
|
116801
|
+
createToolRegistrar(server)("board-create", {
|
|
116802
|
+
title: "Create board",
|
|
116803
|
+
annotations: { readOnlyHint: false, idempotentHint: false },
|
|
116804
|
+
description: "Create an Excalidraw board (`.excalidraw`) on your default agent-fs drive, as your own agent-fs identity, optionally with shapes and bound arrows. Create-only: refuses when the path exists. `added` maps each shape key (or `shapes[i]`) and `arrows[i]` to its element id.",
|
|
116805
|
+
inputSchema: object2({
|
|
116806
|
+
path: string2().min(1).describe("Drive path ending in .excalidraw."),
|
|
116807
|
+
title: string2().max(200).optional(),
|
|
116808
|
+
shapes: Shapes,
|
|
116809
|
+
arrows: Arrows,
|
|
116810
|
+
layout: LayoutSchema
|
|
116811
|
+
}),
|
|
116812
|
+
outputSchema: swarmToolOutputSchema({ ...boardOut, added: Added.optional() })
|
|
116813
|
+
}, async (args, requestInfo) => {
|
|
116814
|
+
const agentId = requestInfo.agentId;
|
|
116815
|
+
const result = await refusing(agentId, () => createBoard({ agentId, ...args }));
|
|
116816
|
+
if ("error" in result)
|
|
116817
|
+
return result.error;
|
|
116818
|
+
const { object, added } = result.value;
|
|
116819
|
+
return toolOk(`Created board ${object.id} at ${where(object)}.`, {
|
|
116820
|
+
data: { yourAgentId: agentId, object, version: object.fileVersion, added }
|
|
116821
|
+
});
|
|
116822
|
+
});
|
|
116823
|
+
}, registerBoardGetTool = (server) => {
|
|
116824
|
+
createToolRegistrar(server)("board-get", {
|
|
116825
|
+
title: "Get board",
|
|
116826
|
+
annotations: { readOnlyHint: true },
|
|
116827
|
+
description: "Read a board by `id` or `path`. `detail: summary` (default) lists live elements as id, type, text, x, y, width, height and boundTo (arrow: [from, to]; shape: its arrow ids); a shape's label folds into its text. `detail: full` returns the raw Excalidraw elements.",
|
|
116828
|
+
inputSchema: object2({
|
|
116829
|
+
...IdOrPath,
|
|
116830
|
+
detail: _enum2(["summary", "full"]).optional()
|
|
116831
|
+
}),
|
|
116832
|
+
outputSchema: swarmToolOutputSchema({
|
|
116833
|
+
...boardOut,
|
|
116834
|
+
elements: array2(looseObject({})).optional()
|
|
116835
|
+
})
|
|
116836
|
+
}, async (args, requestInfo) => {
|
|
116837
|
+
const agentId = requestInfo.agentId;
|
|
116838
|
+
const result = await refusing(agentId, () => getBoard({ agentId, ...args }));
|
|
116839
|
+
if ("error" in result)
|
|
116840
|
+
return result.error;
|
|
116841
|
+
const { object, version, elements } = result.value;
|
|
116842
|
+
return toolOk(`Board ${object.id} at ${where(object)}: ${elements.length} elements, version ${version}.`, {
|
|
116843
|
+
data: { yourAgentId: agentId, object, version, elements }
|
|
116844
|
+
});
|
|
116845
|
+
});
|
|
116846
|
+
}, registerBoardListTool = (server) => {
|
|
116847
|
+
createToolRegistrar(server)("board-list", {
|
|
116848
|
+
title: "List boards",
|
|
116849
|
+
annotations: { readOnlyHint: true },
|
|
116850
|
+
description: "List boards on your default agent-fs drive, newest first. Filter by path `prefix`. Pagination via limit (max 200) and offset.",
|
|
116851
|
+
inputSchema: object2({
|
|
116852
|
+
prefix: string2().optional(),
|
|
116853
|
+
limit: number2().int().positive().max(200).optional(),
|
|
116854
|
+
offset: number2().int().nonnegative().optional()
|
|
116855
|
+
}),
|
|
116856
|
+
outputSchema: swarmToolOutputSchema({
|
|
116857
|
+
yourAgentId: string2().optional(),
|
|
116858
|
+
objects: array2(objectOutputSchema).optional(),
|
|
116859
|
+
total: number2().optional()
|
|
116860
|
+
})
|
|
116861
|
+
}, async (args, requestInfo) => {
|
|
116862
|
+
const agentId = requestInfo.agentId;
|
|
116863
|
+
const result = await refusing(agentId, () => listBoards({ agentId, ...args }));
|
|
116864
|
+
if ("error" in result)
|
|
116865
|
+
return result.error;
|
|
116866
|
+
const { objects, total } = result.value;
|
|
116867
|
+
return toolOk(`Found ${objects.length} of ${total} boards.`, {
|
|
116868
|
+
details: objects.length > 0 ? objects.map((o) => `- ${o.id} at ${where(o)}`).join(`
|
|
116869
|
+
`) : undefined,
|
|
116870
|
+
data: { yourAgentId: agentId, objects, total }
|
|
116871
|
+
});
|
|
116872
|
+
});
|
|
116873
|
+
}, registerBoardAddElementsTool = (server) => {
|
|
116874
|
+
createToolRegistrar(server)("board-add-elements", {
|
|
116875
|
+
title: "Add board elements",
|
|
116876
|
+
annotations: { readOnlyHint: false, idempotentHint: false },
|
|
116877
|
+
description: "Add shapes (rectangle, ellipse, diamond, text) and arrows to a board. Arrows bind both ends to shapes, named by a `key` from this call or an existing element id. Shapes without x/y are laid out below existing content. Writes with the file version and re-applies on a concurrent change (3 retries).",
|
|
116878
|
+
inputSchema: object2({ ...IdOrPath, shapes: Shapes, arrows: Arrows, layout: LayoutSchema }),
|
|
116879
|
+
outputSchema: swarmToolOutputSchema({ ...boardOut, added: Added.optional() })
|
|
116880
|
+
}, async (args, requestInfo) => {
|
|
116881
|
+
const agentId = requestInfo.agentId;
|
|
116882
|
+
const result = await refusing(agentId, () => addBoardElements({ agentId, ...args }));
|
|
116883
|
+
if ("error" in result)
|
|
116884
|
+
return result.error;
|
|
116885
|
+
const { object, version, added } = result.value;
|
|
116886
|
+
return toolOk(`Added ${Object.keys(added).length} elements to board ${object.id}, version ${version}.`, {
|
|
116887
|
+
data: { yourAgentId: agentId, object, version, added }
|
|
116888
|
+
});
|
|
116889
|
+
});
|
|
116890
|
+
}, registerBoardUpdateElementsTool = (server) => {
|
|
116891
|
+
createToolRegistrar(server)("board-update-elements", {
|
|
116892
|
+
title: "Update board elements",
|
|
116893
|
+
annotations: { readOnlyHint: false, idempotentHint: true },
|
|
116894
|
+
description: "Patch board elements by id: label (empty string removes a shape's label), x, y, width, height, color. Bound labels and arrows follow; arrows themselves take only label and color. Each touched element gets a new version, so an open editor repaints it.",
|
|
116895
|
+
inputSchema: object2({
|
|
116896
|
+
...IdOrPath,
|
|
116897
|
+
patches: array2(object2({
|
|
116898
|
+
elementId: string2().min(1),
|
|
116899
|
+
label: string2().max(2000).optional(),
|
|
116900
|
+
x: Coord.optional(),
|
|
116901
|
+
y: Coord.optional(),
|
|
116902
|
+
width: Size.optional(),
|
|
116903
|
+
height: Size.optional(),
|
|
116904
|
+
color: Color.optional()
|
|
116905
|
+
})).min(1).max(200)
|
|
116906
|
+
}),
|
|
116907
|
+
outputSchema: swarmToolOutputSchema({ ...boardOut, updated: array2(string2()).optional() })
|
|
116908
|
+
}, async (args, requestInfo) => {
|
|
116909
|
+
const agentId = requestInfo.agentId;
|
|
116910
|
+
const result = await refusing(agentId, () => updateBoardElements({ agentId, ...args }));
|
|
116911
|
+
if ("error" in result)
|
|
116912
|
+
return result.error;
|
|
116913
|
+
const { object, version, updated } = result.value;
|
|
116914
|
+
return toolOk(`Updated ${updated.length} elements on board ${object.id}, version ${version}.`, {
|
|
116915
|
+
data: { yourAgentId: agentId, object, version, updated }
|
|
116916
|
+
});
|
|
116917
|
+
});
|
|
116918
|
+
}, registerBoardRemoveElementsTool = (server) => {
|
|
116919
|
+
createToolRegistrar(server)("board-remove-elements", {
|
|
116920
|
+
title: "Remove board elements",
|
|
116921
|
+
annotations: { readOnlyHint: false, idempotentHint: true, destructiveHint: true },
|
|
116922
|
+
description: "Remove board elements by id (sets `isDeleted: true`, the Excalidraw convention). A shape's label goes with it and its arrows are unbound; a removed arrow leaves its shapes. Refuses unknown ids before writing.",
|
|
116923
|
+
inputSchema: object2({
|
|
116924
|
+
...IdOrPath,
|
|
116925
|
+
elementIds: array2(string2().min(1)).min(1).max(500)
|
|
116926
|
+
}),
|
|
116927
|
+
outputSchema: swarmToolOutputSchema({ ...boardOut, removed: array2(string2()).optional() })
|
|
116928
|
+
}, async (args, requestInfo) => {
|
|
116929
|
+
const agentId = requestInfo.agentId;
|
|
116930
|
+
const result = await refusing(agentId, () => removeBoardElements({ agentId, ...args }));
|
|
116931
|
+
if ("error" in result)
|
|
116932
|
+
return result.error;
|
|
116933
|
+
const { object, version, removed } = result.value;
|
|
116934
|
+
return toolOk(`Removed ${removed.length} elements from board ${object.id}, version ${version}.`, {
|
|
116935
|
+
data: { yourAgentId: agentId, object, version, removed }
|
|
116936
|
+
});
|
|
116937
|
+
});
|
|
116938
|
+
};
|
|
116939
|
+
var init_boards = __esm(() => {
|
|
116940
|
+
init_zod();
|
|
116941
|
+
init_elements();
|
|
116942
|
+
init_service();
|
|
116943
|
+
init_objects2();
|
|
116944
|
+
init_utils();
|
|
116945
|
+
Coord = number2().min(-1e6).max(1e6);
|
|
116946
|
+
Size = number2().positive().max(1e4);
|
|
116947
|
+
Color = string2().max(32).describe(`A palette name (${Object.keys(PALETTE).join(", ")}) or #rrggbb (background).`);
|
|
116948
|
+
ShapeSchema = object2({
|
|
116949
|
+
key: string2().min(1).max(64).optional().describe("Your name for the shape, so arrows in the same call can point at it."),
|
|
116950
|
+
type: _enum2(SHAPE_TYPES),
|
|
116951
|
+
x: Coord.optional(),
|
|
116952
|
+
y: Coord.optional(),
|
|
116953
|
+
width: Size.optional().describe("Minimum width; a shape grows to fit its label."),
|
|
116954
|
+
height: Size.optional().describe("Minimum height; a shape grows to fit its label."),
|
|
116955
|
+
label: string2().max(2000).optional().describe("Text inside the shape; required for `text`."),
|
|
116956
|
+
color: Color.optional()
|
|
116957
|
+
});
|
|
116958
|
+
ArrowSchema = object2({
|
|
116959
|
+
from: string2().min(1).max(64).describe("A shape `key` from this call or an existing element id."),
|
|
116960
|
+
to: string2().min(1).max(64).describe("A shape `key` from this call or an existing element id."),
|
|
116961
|
+
label: string2().max(500).optional()
|
|
116962
|
+
});
|
|
116963
|
+
Shapes = array2(ShapeSchema).max(200).optional();
|
|
116964
|
+
Arrows = array2(ArrowSchema).max(200).optional();
|
|
116965
|
+
LayoutSchema = _enum2(LAYOUTS).optional().describe("How shapes without x/y are placed, below existing content. Default `row`.");
|
|
116966
|
+
IdOrPath = {
|
|
116967
|
+
id: string2().min(1).optional().describe("Board object id."),
|
|
116968
|
+
path: string2().min(1).optional().describe("Board path on your default drive.")
|
|
116969
|
+
};
|
|
116970
|
+
boardOut = {
|
|
116971
|
+
yourAgentId: string2().optional(),
|
|
116972
|
+
object: objectOutputSchema.optional(),
|
|
116973
|
+
version: number2().nullable().optional()
|
|
116974
|
+
};
|
|
116975
|
+
Added = record2(string2(), string2());
|
|
116976
|
+
});
|
|
116977
|
+
|
|
114977
116978
|
// src/workflows/approval-cancel.ts
|
|
114978
116979
|
async function cancelApprovalRequest(input) {
|
|
114979
116980
|
const finalReason = input.reason ?? "Cancelled through the API";
|
|
@@ -120052,18 +122053,45 @@ function inheritedModelSelection2(parent) {
|
|
|
120052
122053
|
...parent.profile ? { profile: parent.profile } : {}
|
|
120053
122054
|
};
|
|
120054
122055
|
}
|
|
122056
|
+
async function keyPoolOf(parent, profileName, options) {
|
|
122057
|
+
const keyType = parent.credentialKeyType;
|
|
122058
|
+
if (!keyType || !parent.credentialKeySuffix || !parent.agentId)
|
|
122059
|
+
return null;
|
|
122060
|
+
const profile = await getModelProfileByName(profileName);
|
|
122061
|
+
if (!profile || hasUnreadableCredentialAllowlist(profile)) {
|
|
122062
|
+
return null;
|
|
122063
|
+
}
|
|
122064
|
+
const pools = await configPools(parent.agentId, {
|
|
122065
|
+
vcsRepo: parent.vcsRepo,
|
|
122066
|
+
includeRepoSecrets: options.includeRepoSecrets
|
|
122067
|
+
});
|
|
122068
|
+
const pool = pools.get(keyType);
|
|
122069
|
+
if (pool === undefined)
|
|
122070
|
+
return null;
|
|
122071
|
+
const suffixes = splitCredentialPool(pool).map(keySuffix);
|
|
122072
|
+
const allowlist = profile.credentials?.[keyType];
|
|
122073
|
+
const usable = (suffix) => !allowlist || allowlist.includes(suffix);
|
|
122074
|
+
const size = suffixes.filter(usable).length;
|
|
122075
|
+
if (size < 2)
|
|
122076
|
+
return null;
|
|
122077
|
+
const family = modelFamilyOf(parent.resolvedModel ?? profile.model);
|
|
122078
|
+
const { availableIndices } = await getAvailableKeyIndices2(keyType, suffixes.length, "global", null, family && windowForModelFamily(family) ? family : undefined, suffixes);
|
|
122079
|
+
const free = availableIndices.map((i) => suffixes[i]).filter((suffix) => usable(suffix) && suffix !== parent.credentialKeySuffix).length;
|
|
122080
|
+
return { keyType, size, free };
|
|
122081
|
+
}
|
|
120055
122082
|
async function nextFallback2(parent, errorClass, options = {}) {
|
|
120056
122083
|
const current = parent.resolvedProfile;
|
|
120057
122084
|
if (!current || !parent.agentId)
|
|
120058
122085
|
return { kind: "none", message: null };
|
|
120059
122086
|
const hops = parent.fallbackHops ?? [];
|
|
120060
|
-
const
|
|
122087
|
+
const profileHops = hops.filter((hop) => hop.from !== hop.profile);
|
|
122088
|
+
const path = profileHops.length > 0 ? [profileHops[0].from, ...profileHops.map((hop) => hop.profile)] : [current];
|
|
120061
122089
|
if (path[path.length - 1] !== current)
|
|
120062
122090
|
path.push(current);
|
|
120063
122091
|
const visited = new Set(path);
|
|
120064
122092
|
const skipped = [];
|
|
120065
122093
|
const judged = new Set;
|
|
120066
|
-
let configured =
|
|
122094
|
+
let configured = profileHops.length > 0;
|
|
120067
122095
|
if (parent.routingAffinity?.leadOnly) {
|
|
120068
122096
|
const agent = await getAgentById2(parent.agentId);
|
|
120069
122097
|
if (!agent?.isLead || !isAgentEligibleForTask2(agent, parent)) {
|
|
@@ -120076,6 +122104,21 @@ async function nextFallback2(parent, errorClass, options = {}) {
|
|
|
120076
122104
|
};
|
|
120077
122105
|
}
|
|
120078
122106
|
}
|
|
122107
|
+
let keysExhausted = "";
|
|
122108
|
+
if (KEY_SCOPED_ERRORS.has(errorClass)) {
|
|
122109
|
+
const pool = await keyPoolOf(parent, current, options);
|
|
122110
|
+
if (pool) {
|
|
122111
|
+
const retries = hops.filter((hop) => hop.from === current && hop.profile === current).length;
|
|
122112
|
+
if (pool.free > 0 && retries < pool.size) {
|
|
122113
|
+
return {
|
|
122114
|
+
kind: "picked",
|
|
122115
|
+
profile: current,
|
|
122116
|
+
hop: { from: current, profile: current, errorClass, at: new Date().toISOString() }
|
|
122117
|
+
};
|
|
122118
|
+
}
|
|
122119
|
+
keysExhausted = pool.free > 0 ? `no key retry left (${retries} retries on a pool of ${pool.size} ${pool.keyType} keys); ` : `no key left (all ${pool.size} ${pool.keyType} keys are rate-limited or just failed); `;
|
|
122120
|
+
}
|
|
122121
|
+
}
|
|
120079
122122
|
for (let i = path.length - 1;i >= 0; i--) {
|
|
120080
122123
|
const profile = await getModelProfileByName(path[i]);
|
|
120081
122124
|
for (const name of profile?.fallbacks ?? []) {
|
|
@@ -120104,12 +122147,16 @@ async function nextFallback2(parent, errorClass, options = {}) {
|
|
|
120104
122147
|
skipped.push({ profile: name, reason: result ? firstFailingRow(result) : "not found" });
|
|
120105
122148
|
}
|
|
120106
122149
|
}
|
|
120107
|
-
if (!configured)
|
|
120108
|
-
return {
|
|
122150
|
+
if (!configured) {
|
|
122151
|
+
return {
|
|
122152
|
+
kind: "none",
|
|
122153
|
+
message: keysExhausted ? `${errorClass} on ${current}; ${keysExhausted}no fallback configured` : null
|
|
122154
|
+
};
|
|
122155
|
+
}
|
|
120109
122156
|
const skippedText = skipped.length > 0 ? `; skipped: ${skipped.map((s) => `${s.profile} (${s.reason})`).join(", ")}` : "";
|
|
120110
122157
|
return {
|
|
120111
122158
|
kind: "none",
|
|
120112
|
-
message: `${errorClass} on ${current}; no fallback left (tried: ${path.join(" → ")})${skippedText}`
|
|
122159
|
+
message: `${errorClass} on ${current}; ${keysExhausted}no fallback left (tried: ${path.join(" → ")})${skippedText}`
|
|
120113
122160
|
};
|
|
120114
122161
|
}
|
|
120115
122162
|
function firstFailingRow(result) {
|
|
@@ -120405,10 +122452,11 @@ async function createResumeFollowUp2(args) {
|
|
|
120405
122452
|
].join(`
|
|
120406
122453
|
`);
|
|
120407
122454
|
const priority = Math.min(100, (parent.priority ?? 50) + 10);
|
|
122455
|
+
const generation = args.reason === "provider_fallback" ? getResumeGeneration2(parent) : getNextResumeGeneration2(parent);
|
|
120408
122456
|
const tags = [
|
|
120409
122457
|
"auto-resume",
|
|
120410
122458
|
`reason:${args.reason}`,
|
|
120411
|
-
`${RESUME_GENERATION_TAG_PREFIX}${
|
|
122459
|
+
...generation > 0 ? [`${RESUME_GENERATION_TAG_PREFIX}${generation}`] : []
|
|
120412
122460
|
];
|
|
120413
122461
|
if (args.reason === "crash_recovery" && preferredAgentId === parent.agentId) {
|
|
120414
122462
|
tags.push(CRASH_RECOVERY_PIN_TAG);
|
|
@@ -120539,7 +122587,7 @@ async function createPoolStarvationDecisionTask2(args) {
|
|
|
120539
122587
|
});
|
|
120540
122588
|
return { kind: "created", task: created };
|
|
120541
122589
|
}
|
|
120542
|
-
var TaskFollowUpModifySchema, WORKER_LIVENESS_WINDOW_SECONDS, RESUME_GENERATION_TAG_PREFIX = "resume-generation:", CRASH_RECOVERY_PIN_TAG = "crash-recovery-pin", GRACEFUL_SHUTDOWN_PIN_TAG = "graceful-shutdown-pin", REBOOT_RETRY_PIN_TAG2 = "reboot-retry-pin", LIVE_CHAINED_TASK_STATUSES, MAX_CONTINUATION_HOPS = 32;
|
|
122590
|
+
var TaskFollowUpModifySchema, WORKER_LIVENESS_WINDOW_SECONDS, RESUME_GENERATION_TAG_PREFIX = "resume-generation:", CRASH_RECOVERY_PIN_TAG = "crash-recovery-pin", GRACEFUL_SHUTDOWN_PIN_TAG = "graceful-shutdown-pin", REBOOT_RETRY_PIN_TAG2 = "reboot-retry-pin", KEY_SCOPED_ERRORS, LIVE_CHAINED_TASK_STATUSES, MAX_CONTINUATION_HOPS = 32;
|
|
120543
122591
|
var init_worker_follow_up = __esm(() => {
|
|
120544
122592
|
init_zod();
|
|
120545
122593
|
init_db4();
|
|
@@ -120552,7 +122600,9 @@ var init_worker_follow_up = __esm(() => {
|
|
|
120552
122600
|
init_resolver();
|
|
120553
122601
|
init_deferred_task_waits();
|
|
120554
122602
|
init_types5();
|
|
122603
|
+
init_credentials2();
|
|
120555
122604
|
init_env_flag();
|
|
122605
|
+
init_model_rate_limit_windows();
|
|
120556
122606
|
init_task_attachment_links();
|
|
120557
122607
|
init_context_key();
|
|
120558
122608
|
init_follow_up_gate();
|
|
@@ -120565,6 +122615,7 @@ var init_worker_follow_up = __esm(() => {
|
|
|
120565
122615
|
followUpConfig: true
|
|
120566
122616
|
}).partial().extend({ description: string2().trim().min(1).optional() }).strict();
|
|
120567
122617
|
WORKER_LIVENESS_WINDOW_SECONDS = Number(process.env.WORKER_LIVENESS_WINDOW_SECONDS || "30");
|
|
122618
|
+
KEY_SCOPED_ERRORS = new Set(["rate_limit", "credits"]);
|
|
120568
122619
|
LIVE_CHAINED_TASK_STATUSES = new Set([
|
|
120569
122620
|
"offered",
|
|
120570
122621
|
"reviewing",
|
|
@@ -135885,6 +137936,655 @@ var init_send_task = __esm(() => {
|
|
|
135885
137936
|
]);
|
|
135886
137937
|
});
|
|
135887
137938
|
|
|
137939
|
+
// src/be/primitives/sheets/engine.ts
|
|
137940
|
+
function workerSpecifier() {
|
|
137941
|
+
if (import.meta.url.includes("/$bunfs/"))
|
|
137942
|
+
return "./be/primitives/sheets/engine-worker.ts";
|
|
137943
|
+
return new URL("./engine-worker.ts", import.meta.url).href;
|
|
137944
|
+
}
|
|
137945
|
+
function cellsAfter(tabs, patches) {
|
|
137946
|
+
const refs = new Map(tabs.map((tab) => [tab.name, new Set(Object.keys(tab.cells))]));
|
|
137947
|
+
for (const patch of patches) {
|
|
137948
|
+
const tab = refs.get(patch.tab);
|
|
137949
|
+
if (!tab)
|
|
137950
|
+
continue;
|
|
137951
|
+
const ref = refOf(patch.row, patch.col);
|
|
137952
|
+
if (patch.input === "")
|
|
137953
|
+
tab.delete(ref);
|
|
137954
|
+
else
|
|
137955
|
+
tab.add(ref);
|
|
137956
|
+
}
|
|
137957
|
+
let total = 0;
|
|
137958
|
+
for (const tab of refs.values())
|
|
137959
|
+
total += tab.size;
|
|
137960
|
+
return total;
|
|
137961
|
+
}
|
|
137962
|
+
function literalSpill(patches) {
|
|
137963
|
+
let total = 0;
|
|
137964
|
+
for (const { input } of patches) {
|
|
137965
|
+
if (!input.startsWith("="))
|
|
137966
|
+
continue;
|
|
137967
|
+
for (const match of input.matchAll(ARRAY_SIZE)) {
|
|
137968
|
+
total += Math.ceil(Number(match[1])) * Math.ceil(Number(match[2] ?? 1));
|
|
137969
|
+
}
|
|
137970
|
+
}
|
|
137971
|
+
return total;
|
|
137972
|
+
}
|
|
137973
|
+
|
|
137974
|
+
class SheetEngine {
|
|
137975
|
+
worker;
|
|
137976
|
+
queue = Promise.resolve();
|
|
137977
|
+
nextId = 1;
|
|
137978
|
+
pending = new Map;
|
|
137979
|
+
total = 0;
|
|
137980
|
+
spawn() {
|
|
137981
|
+
const worker = new Worker(workerSpecifier());
|
|
137982
|
+
worker.unref?.();
|
|
137983
|
+
return new Promise((resolve, reject) => {
|
|
137984
|
+
const timer = setTimeout(() => {
|
|
137985
|
+
worker.terminate();
|
|
137986
|
+
reject(new ObjectsError("sheet engine failed to start in time; retry"));
|
|
137987
|
+
}, ENGINE_TIMEOUT_MS);
|
|
137988
|
+
worker.addEventListener("message", function onReady(event) {
|
|
137989
|
+
if (event.data.type !== "ready")
|
|
137990
|
+
return;
|
|
137991
|
+
clearTimeout(timer);
|
|
137992
|
+
worker.removeEventListener("message", onReady);
|
|
137993
|
+
resolve(worker);
|
|
137994
|
+
});
|
|
137995
|
+
worker.addEventListener("error", (event) => {
|
|
137996
|
+
clearTimeout(timer);
|
|
137997
|
+
reject(new Error(`sheet engine failed to start: ${event.message}`));
|
|
137998
|
+
}, { once: true });
|
|
137999
|
+
});
|
|
138000
|
+
}
|
|
138001
|
+
kill() {
|
|
138002
|
+
const pending = this.worker;
|
|
138003
|
+
this.worker = undefined;
|
|
138004
|
+
pending?.then((worker) => worker.terminate()).catch(() => {});
|
|
138005
|
+
}
|
|
138006
|
+
recalc(tabs, patches, options) {
|
|
138007
|
+
const caller = options.caller ?? "";
|
|
138008
|
+
const mine = this.pending.get(caller) ?? 0;
|
|
138009
|
+
if (this.total >= MAX_ENGINE_CALLS || mine >= MAX_ENGINE_CALLS_PER_CALLER) {
|
|
138010
|
+
return Promise.reject(new ObjectsError("sheet engine is busy with other recalculations; retry in a few seconds"));
|
|
138011
|
+
}
|
|
138012
|
+
const cells = cellsAfter(tabs, patches);
|
|
138013
|
+
const spill = literalSpill(patches);
|
|
138014
|
+
if (cells + spill > options.maxCells) {
|
|
138015
|
+
const spilled = spill > 0 ? ` (${spill} of them spilled by array formulas)` : "";
|
|
138016
|
+
return Promise.reject(new ObjectsError(`the workbook would exceed ${options.maxCells} cells: this write leaves ${cells + spill}${spilled}`));
|
|
138017
|
+
}
|
|
138018
|
+
this.pending.set(caller, mine + 1);
|
|
138019
|
+
this.total++;
|
|
138020
|
+
const release = () => {
|
|
138021
|
+
this.total--;
|
|
138022
|
+
const left = (this.pending.get(caller) ?? 1) - 1;
|
|
138023
|
+
if (left > 0)
|
|
138024
|
+
this.pending.set(caller, left);
|
|
138025
|
+
else
|
|
138026
|
+
this.pending.delete(caller);
|
|
138027
|
+
};
|
|
138028
|
+
const run = async () => {
|
|
138029
|
+
this.worker ??= this.spawn();
|
|
138030
|
+
let worker;
|
|
138031
|
+
try {
|
|
138032
|
+
worker = await this.worker;
|
|
138033
|
+
} catch (error) {
|
|
138034
|
+
this.worker = undefined;
|
|
138035
|
+
throw error;
|
|
138036
|
+
}
|
|
138037
|
+
const id = this.nextId++;
|
|
138038
|
+
const timeoutMs = options.timeoutMs ?? ENGINE_TIMEOUT_MS;
|
|
138039
|
+
return new Promise((resolve, reject) => {
|
|
138040
|
+
const done = () => {
|
|
138041
|
+
clearTimeout(timer);
|
|
138042
|
+
worker.removeEventListener("message", onMessage);
|
|
138043
|
+
worker.removeEventListener("error", onError);
|
|
138044
|
+
};
|
|
138045
|
+
const timer = setTimeout(() => {
|
|
138046
|
+
done();
|
|
138047
|
+
this.kill();
|
|
138048
|
+
reject(new ObjectsError(`sheet engine timed out after ${timeoutMs} ms; the workbook is too heavy to recalculate`));
|
|
138049
|
+
}, timeoutMs);
|
|
138050
|
+
const onMessage = (event) => {
|
|
138051
|
+
const message = event.data;
|
|
138052
|
+
if (message.type === "result" && message.id === id) {
|
|
138053
|
+
done();
|
|
138054
|
+
resolve({ cells: message.cells, changed: message.changed });
|
|
138055
|
+
} else if (message.type === "error" && message.id === id) {
|
|
138056
|
+
done();
|
|
138057
|
+
if (message.fatal)
|
|
138058
|
+
this.kill();
|
|
138059
|
+
reject(new ObjectsError(message.message));
|
|
138060
|
+
}
|
|
138061
|
+
};
|
|
138062
|
+
const onError = (event) => {
|
|
138063
|
+
done();
|
|
138064
|
+
this.kill();
|
|
138065
|
+
reject(new Error(`sheet engine crashed: ${event.message}`));
|
|
138066
|
+
};
|
|
138067
|
+
worker.addEventListener("message", onMessage);
|
|
138068
|
+
worker.addEventListener("error", onError);
|
|
138069
|
+
const request = { id, tabs, patches, maxCells: options.maxCells };
|
|
138070
|
+
worker.postMessage(request);
|
|
138071
|
+
});
|
|
138072
|
+
};
|
|
138073
|
+
const result = this.queue.then(run, run).finally(release);
|
|
138074
|
+
this.queue = result.catch(() => {});
|
|
138075
|
+
return result;
|
|
138076
|
+
}
|
|
138077
|
+
stop() {
|
|
138078
|
+
this.kill();
|
|
138079
|
+
}
|
|
138080
|
+
}
|
|
138081
|
+
var ENGINE_TIMEOUT_MS = 1e4, MAX_ENGINE_CALLS = 8, MAX_ENGINE_CALLS_PER_CALLER = 2, ARRAY_SIZE, shared, sheetEngine = () => {
|
|
138082
|
+
shared ??= new SheetEngine;
|
|
138083
|
+
return shared;
|
|
138084
|
+
};
|
|
138085
|
+
var init_engine2 = __esm(() => {
|
|
138086
|
+
init_objects();
|
|
138087
|
+
init_a1();
|
|
138088
|
+
ARRAY_SIZE = /\b(?:SEQUENCE|RANDARRAY|MAKEARRAY)\(\s*(\d+(?:\.\d+)?)\s*(?:,\s*(\d+(?:\.\d+)?)\s*[,)])?/gi;
|
|
138089
|
+
});
|
|
138090
|
+
|
|
138091
|
+
// src/be/primitives/sheets/service.ts
|
|
138092
|
+
async function load(target) {
|
|
138093
|
+
const { object, missing, content } = await getObject({ ...target, includeContent: true });
|
|
138094
|
+
if (object.kind !== "sheet") {
|
|
138095
|
+
throw new ObjectsError(`object ${object.id} is a ${object.kind}, not a sheet`);
|
|
138096
|
+
}
|
|
138097
|
+
if (missing) {
|
|
138098
|
+
throw new ObjectsError(`the file for ${object.path} is missing on the drive; run object-reindex`);
|
|
138099
|
+
}
|
|
138100
|
+
const parsed = SheetDocSchema.safeParse(content);
|
|
138101
|
+
if (!parsed.success) {
|
|
138102
|
+
const issue = parsed.error.issues[0];
|
|
138103
|
+
throw new ObjectsError(`${object.path} is not a valid swarm-sheet/1 workbook: ${issue?.path.join(".") || "document"}: ${issue?.message}`);
|
|
138104
|
+
}
|
|
138105
|
+
if (object.fileVersion === null) {
|
|
138106
|
+
throw new ObjectsError(`agent-fs returned no version for ${object.path}; cannot write safely`);
|
|
138107
|
+
}
|
|
138108
|
+
return { object, version: object.fileVersion, doc: parsed.data };
|
|
138109
|
+
}
|
|
138110
|
+
async function save(agentId, object, doc, version, op) {
|
|
138111
|
+
const body = JSON.stringify(doc, null, 2);
|
|
138112
|
+
if (Buffer.byteLength(body) > MAX_FILE_BYTES) {
|
|
138113
|
+
throw new ObjectsError(`the sheet would exceed ${MAX_FILE_BYTES} bytes (5 MiB)`);
|
|
138114
|
+
}
|
|
138115
|
+
const client = agentId ? await agentFsClientFor(agentId) : undefined;
|
|
138116
|
+
if (!client)
|
|
138117
|
+
throw new ObjectsError(NO_AGENT_FS_IDENTITY);
|
|
138118
|
+
const { orgId, driveId } = client.identity;
|
|
138119
|
+
const saved = await client.provider.upload({ taskId: "", name: "", key: object.path, orgId, driveId }, body, { contentType: "application/json", ifMatch: String(version), message: `sheet ${op}` });
|
|
138120
|
+
const next = saved.version ? Number(saved.version) : version + 1;
|
|
138121
|
+
await getDbClient2().run("UPDATE primitive_objects SET fileVersion = ?, updatedAt = ? WHERE id = ?", [next, new Date().toISOString(), object.id]);
|
|
138122
|
+
return next;
|
|
138123
|
+
}
|
|
138124
|
+
async function mutate(target, op, apply) {
|
|
138125
|
+
for (let attempt = 1;; attempt++) {
|
|
138126
|
+
const { object, version, doc } = await load(target);
|
|
138127
|
+
const { doc: next, result } = await apply(structuredClone(doc));
|
|
138128
|
+
if (!next)
|
|
138129
|
+
return { version, result };
|
|
138130
|
+
try {
|
|
138131
|
+
return { version: await save(target.agentId, object, next, version, op), result };
|
|
138132
|
+
} catch (error) {
|
|
138133
|
+
if (!(error instanceof FilesError && error.code === "Conflict"))
|
|
138134
|
+
throw error;
|
|
138135
|
+
if (attempt >= MAX_ATTEMPTS) {
|
|
138136
|
+
throw new ObjectsError(`concurrent writers changed ${object.path} ${MAX_ATTEMPTS} times; retry`);
|
|
138137
|
+
}
|
|
138138
|
+
}
|
|
138139
|
+
}
|
|
138140
|
+
}
|
|
138141
|
+
function findTab(doc, name) {
|
|
138142
|
+
if (name === undefined)
|
|
138143
|
+
return doc.tabs[0];
|
|
138144
|
+
const tab = doc.tabs.find((t) => t.name === name) ?? doc.tabs.find((t) => t.name.toLowerCase() === name.toLowerCase());
|
|
138145
|
+
if (!tab) {
|
|
138146
|
+
throw new ObjectsError(`no tab '${name}' (tabs: ${doc.tabs.map((t) => t.name).join(", ")})`);
|
|
138147
|
+
}
|
|
138148
|
+
return tab;
|
|
138149
|
+
}
|
|
138150
|
+
function inputFor(value) {
|
|
138151
|
+
if (typeof value !== "string")
|
|
138152
|
+
return constantInput(value);
|
|
138153
|
+
if (value.length > 1 && value.startsWith("="))
|
|
138154
|
+
return value;
|
|
138155
|
+
if (value.startsWith("'="))
|
|
138156
|
+
return value;
|
|
138157
|
+
return constantInput(value);
|
|
138158
|
+
}
|
|
138159
|
+
async function recalc(agentId, doc, patches) {
|
|
138160
|
+
const { cells, changed } = await sheetEngine().recalc(doc.tabs, patches, {
|
|
138161
|
+
maxCells: MAX_CELLS,
|
|
138162
|
+
caller: agentId
|
|
138163
|
+
});
|
|
138164
|
+
doc.tabs.forEach((tab, i) => {
|
|
138165
|
+
tab.cells = cells[i] ?? {};
|
|
138166
|
+
});
|
|
138167
|
+
return changed;
|
|
138168
|
+
}
|
|
138169
|
+
function checkArea(range, what) {
|
|
138170
|
+
const area = areaOf(range);
|
|
138171
|
+
if (area > MAX_RANGE_CELLS) {
|
|
138172
|
+
throw new ObjectsError(`${what} covers ${area} cells; the limit is ${MAX_RANGE_CELLS} per call`);
|
|
138173
|
+
}
|
|
138174
|
+
}
|
|
138175
|
+
async function createSheet(input) {
|
|
138176
|
+
const { tabs } = input;
|
|
138177
|
+
if (tabs) {
|
|
138178
|
+
refuse(() => {
|
|
138179
|
+
if (tabs.length === 0 || tabs.length > MAX_TABS)
|
|
138180
|
+
throw new A1Error(`tabs: 1-${MAX_TABS} tabs`);
|
|
138181
|
+
const seen = new Set;
|
|
138182
|
+
for (const tab of tabs) {
|
|
138183
|
+
if (seen.has(checkTabName(tab.name).toLowerCase()))
|
|
138184
|
+
throw new A1Error(`duplicate tab '${tab.name}'`);
|
|
138185
|
+
seen.add(tab.name.toLowerCase());
|
|
138186
|
+
const cells = (tab.rows ?? []).reduce((n, row) => n + row.length, 0);
|
|
138187
|
+
if (cells > MAX_RANGE_CELLS)
|
|
138188
|
+
throw new A1Error(`tab '${tab.name}' has ${cells} initial cells; the limit is ${MAX_RANGE_CELLS}`);
|
|
138189
|
+
}
|
|
138190
|
+
});
|
|
138191
|
+
}
|
|
138192
|
+
const created = await createObject({
|
|
138193
|
+
agentId: input.agentId,
|
|
138194
|
+
kind: "sheet",
|
|
138195
|
+
path: input.path,
|
|
138196
|
+
title: input.title
|
|
138197
|
+
});
|
|
138198
|
+
if (!tabs)
|
|
138199
|
+
return { object: created, link: created.link };
|
|
138200
|
+
try {
|
|
138201
|
+
const { version } = await mutate({ agentId: input.agentId, id: created.id }, "create tabs", async (doc) => {
|
|
138202
|
+
doc.tabs = tabs.map((t) => newTab(t.name));
|
|
138203
|
+
const patches = tabs.flatMap((t) => (t.rows ?? []).flatMap((row, r) => row.map((value, c) => ({
|
|
138204
|
+
tab: t.name,
|
|
138205
|
+
row: r + 1,
|
|
138206
|
+
col: c + 1,
|
|
138207
|
+
input: inputFor(value)
|
|
138208
|
+
}))));
|
|
138209
|
+
await recalc(input.agentId, doc, patches);
|
|
138210
|
+
return { doc, result: null };
|
|
138211
|
+
});
|
|
138212
|
+
return { object: { ...created, fileVersion: version }, link: created.link };
|
|
138213
|
+
} catch (error) {
|
|
138214
|
+
if (error instanceof ObjectsError) {
|
|
138215
|
+
throw new ObjectsError(`created ${created.path} (id ${created.id}) but could not write its tabs: ${error.message}`);
|
|
138216
|
+
}
|
|
138217
|
+
throw error;
|
|
138218
|
+
}
|
|
138219
|
+
}
|
|
138220
|
+
async function getSheet(target) {
|
|
138221
|
+
const { object, version, doc } = await load(target);
|
|
138222
|
+
return { object, version, tabs: doc.tabs.map(tabSummary) };
|
|
138223
|
+
}
|
|
138224
|
+
async function getSheetRange(target) {
|
|
138225
|
+
const { version, doc } = await load(target);
|
|
138226
|
+
const spec = refuse(() => parseRange(target.range));
|
|
138227
|
+
const tab = findTab(doc, spec.tab);
|
|
138228
|
+
const range = capToUsed(spec, usedExtent(tab));
|
|
138229
|
+
if (!range)
|
|
138230
|
+
return {
|
|
138231
|
+
range: formatRange(tab.name, { ...spec, r2: spec.r1, c2: spec.c1 }),
|
|
138232
|
+
values: [],
|
|
138233
|
+
version
|
|
138234
|
+
};
|
|
138235
|
+
checkArea(range, "the range");
|
|
138236
|
+
const values = [];
|
|
138237
|
+
const formulas = [];
|
|
138238
|
+
for (let r = range.r1;r <= range.r2; r++) {
|
|
138239
|
+
const row = [];
|
|
138240
|
+
const formulaRow = [];
|
|
138241
|
+
for (let c = range.c1;c <= range.c2; c++) {
|
|
138242
|
+
const cell = tab.cells[refOf(r, c)];
|
|
138243
|
+
const value = cell?.v ?? null;
|
|
138244
|
+
row.push(value);
|
|
138245
|
+
formulaRow.push(cell?.f ?? value);
|
|
138246
|
+
}
|
|
138247
|
+
values.push(row);
|
|
138248
|
+
formulas.push(formulaRow);
|
|
138249
|
+
}
|
|
138250
|
+
return {
|
|
138251
|
+
range: formatRange(tab.name, range),
|
|
138252
|
+
values,
|
|
138253
|
+
...target.formulas ? { formulas } : {},
|
|
138254
|
+
version
|
|
138255
|
+
};
|
|
138256
|
+
}
|
|
138257
|
+
async function setSheetRange(target) {
|
|
138258
|
+
const spec = refuse(() => parseRange(target.range));
|
|
138259
|
+
if (spec.open)
|
|
138260
|
+
throw new ObjectsError("setRange needs a bounded range such as 'Tab!B2:C3', not a whole column or row");
|
|
138261
|
+
const rows = target.values.length;
|
|
138262
|
+
const cols = Math.max(0, ...target.values.map((row) => row.length));
|
|
138263
|
+
if (rows === 0 || cols === 0)
|
|
138264
|
+
throw new ObjectsError("values is empty");
|
|
138265
|
+
if (target.values.some((row) => row.length !== cols))
|
|
138266
|
+
throw new ObjectsError("values must be a rectangle: every row needs the same length");
|
|
138267
|
+
const single = spec.r1 === spec.r2 && spec.c1 === spec.c2;
|
|
138268
|
+
const range = single ? { ...spec, r2: spec.r1 + rows - 1, c2: spec.c1 + cols - 1 } : spec;
|
|
138269
|
+
const height = range.r2 - range.r1 + 1;
|
|
138270
|
+
const width = range.c2 - range.c1 + 1;
|
|
138271
|
+
if (height !== rows || width !== cols) {
|
|
138272
|
+
throw new ObjectsError(`values is ${rows}x${cols} but the range is ${height}x${width}`);
|
|
138273
|
+
}
|
|
138274
|
+
refuse(() => assertInBounds(range));
|
|
138275
|
+
checkArea(range, "the range");
|
|
138276
|
+
const { version, result } = await mutate(target, "set range", async (doc) => {
|
|
138277
|
+
const tab = findTab(doc, spec.tab);
|
|
138278
|
+
const patches = target.values.flatMap((row, i) => row.map((value, j) => ({
|
|
138279
|
+
tab: tab.name,
|
|
138280
|
+
row: range.r1 + i,
|
|
138281
|
+
col: range.c1 + j,
|
|
138282
|
+
input: inputFor(value)
|
|
138283
|
+
})));
|
|
138284
|
+
const changed = await recalc(target.agentId, doc, patches);
|
|
138285
|
+
const inRange = (ref) => {
|
|
138286
|
+
const [name, a1] = [ref.slice(0, ref.lastIndexOf("!")), ref.slice(ref.lastIndexOf("!") + 1)];
|
|
138287
|
+
const { row, col } = parseCell(a1);
|
|
138288
|
+
return name === tab.name && row >= range.r1 && row <= range.r2 && col >= range.c1 && col <= range.c2;
|
|
138289
|
+
};
|
|
138290
|
+
const direct = changed.filter(inRange).length;
|
|
138291
|
+
return {
|
|
138292
|
+
doc: changed.length ? doc : undefined,
|
|
138293
|
+
result: {
|
|
138294
|
+
range: formatRange(tab.name, range),
|
|
138295
|
+
changed: direct,
|
|
138296
|
+
recalculated: changed.length - direct
|
|
138297
|
+
}
|
|
138298
|
+
};
|
|
138299
|
+
});
|
|
138300
|
+
return { ...result, version };
|
|
138301
|
+
}
|
|
138302
|
+
async function appendSheetRows(target) {
|
|
138303
|
+
const cells = target.rows.reduce((n, row) => n + row.length, 0);
|
|
138304
|
+
if (cells === 0)
|
|
138305
|
+
throw new ObjectsError("rows is empty");
|
|
138306
|
+
if (cells > MAX_RANGE_CELLS)
|
|
138307
|
+
throw new ObjectsError(`rows hold ${cells} cells; the limit is ${MAX_RANGE_CELLS} per call`);
|
|
138308
|
+
const { version, result } = await mutate(target, "append rows", async (doc) => {
|
|
138309
|
+
const tab = findTab(doc, target.tab);
|
|
138310
|
+
const first = usedExtent(tab).rows + 1;
|
|
138311
|
+
const cols = Math.max(...target.rows.map((row) => row.length));
|
|
138312
|
+
const range = { r1: first, c1: 1, r2: first + target.rows.length - 1, c2: cols };
|
|
138313
|
+
refuse(() => assertInBounds(range));
|
|
138314
|
+
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
|
+
const changed = await recalc(target.agentId, doc, patches);
|
|
138316
|
+
return {
|
|
138317
|
+
doc: changed.length ? doc : undefined,
|
|
138318
|
+
result: { range: formatRange(tab.name, range) }
|
|
138319
|
+
};
|
|
138320
|
+
});
|
|
138321
|
+
return { ...result, version };
|
|
138322
|
+
}
|
|
138323
|
+
async function clearSheetRange(target) {
|
|
138324
|
+
const spec = refuse(() => parseRange(target.range));
|
|
138325
|
+
const { version, result } = await mutate(target, "clear range", async (doc) => {
|
|
138326
|
+
const tab = findTab(doc, spec.tab);
|
|
138327
|
+
const range = capToUsed(spec, usedExtent(tab));
|
|
138328
|
+
if (!range)
|
|
138329
|
+
return {
|
|
138330
|
+
result: { range: formatRange(tab.name, { ...spec, r2: spec.r1, c2: spec.c1 }), cleared: 0 }
|
|
138331
|
+
};
|
|
138332
|
+
checkArea(range, "the range");
|
|
138333
|
+
const patches = Object.entries(tab.cells).flatMap(([ref, cell]) => {
|
|
138334
|
+
const { row, col } = parseCell(ref);
|
|
138335
|
+
const inside = row >= range.r1 && row <= range.r2 && col >= range.c1 && col <= range.c2;
|
|
138336
|
+
return inside && !cell.s ? [{ tab: tab.name, row, col, input: "" }] : [];
|
|
138337
|
+
});
|
|
138338
|
+
if (patches.length === 0)
|
|
138339
|
+
return { result: { range: formatRange(tab.name, range), cleared: 0 } };
|
|
138340
|
+
await recalc(target.agentId, doc, patches);
|
|
138341
|
+
return { doc, result: { range: formatRange(tab.name, range), cleared: patches.length } };
|
|
138342
|
+
});
|
|
138343
|
+
return { ...result, version };
|
|
138344
|
+
}
|
|
138345
|
+
async function addSheetTab(target) {
|
|
138346
|
+
const { version, result } = await mutate(target, "add tab", async (doc) => {
|
|
138347
|
+
refuse(() => checkTabName(target.name));
|
|
138348
|
+
if (doc.tabs.some((t) => t.name.toLowerCase() === target.name.toLowerCase())) {
|
|
138349
|
+
throw new ObjectsError(`a tab named '${target.name}' already exists`);
|
|
138350
|
+
}
|
|
138351
|
+
if (doc.tabs.length >= MAX_TABS)
|
|
138352
|
+
throw new ObjectsError(`a sheet holds at most ${MAX_TABS} tabs`);
|
|
138353
|
+
const at = target.after === undefined ? doc.tabs.length : doc.tabs.indexOf(findTab(doc, target.after)) + 1;
|
|
138354
|
+
doc.tabs.splice(at, 0, newTab(target.name));
|
|
138355
|
+
return { doc, result: { tabs: doc.tabs.map((t) => t.name) } };
|
|
138356
|
+
});
|
|
138357
|
+
return { ...result, version };
|
|
138358
|
+
}
|
|
138359
|
+
var MAX_ATTEMPTS = 4, refuse = (run) => {
|
|
138360
|
+
try {
|
|
138361
|
+
return run();
|
|
138362
|
+
} catch (error) {
|
|
138363
|
+
if (error instanceof A1Error)
|
|
138364
|
+
throw new ObjectsError(error.message);
|
|
138365
|
+
throw error;
|
|
138366
|
+
}
|
|
138367
|
+
}, tabSummary = (tab) => {
|
|
138368
|
+
const { rows, cols } = usedExtent(tab);
|
|
138369
|
+
return { name: tab.name, rows, cols, freezeRows: tab.freezeRows ?? 0 };
|
|
138370
|
+
}, listSheets = (input) => listObjects({ ...input, kind: "sheet" });
|
|
138371
|
+
var init_service2 = __esm(() => {
|
|
138372
|
+
init_provider();
|
|
138373
|
+
init_agent_fs_identity();
|
|
138374
|
+
init_db4();
|
|
138375
|
+
init_objects();
|
|
138376
|
+
init_a1();
|
|
138377
|
+
init_engine2();
|
|
138378
|
+
init_format();
|
|
138379
|
+
});
|
|
138380
|
+
|
|
138381
|
+
// src/tools/sheets.ts
|
|
138382
|
+
async function refusing2(agentId, run) {
|
|
138383
|
+
try {
|
|
138384
|
+
return { value: await run() };
|
|
138385
|
+
} catch (error) {
|
|
138386
|
+
if (error instanceof ObjectsError || error instanceof FilesError) {
|
|
138387
|
+
return { error: toolErr(error.message, { data: { yourAgentId: agentId } }) };
|
|
138388
|
+
}
|
|
138389
|
+
throw error;
|
|
138390
|
+
}
|
|
138391
|
+
}
|
|
138392
|
+
var objectOutputSchema2, CellValue, Grid, RANGE_HELP = "A1 range such as `Tasks!B2:C3`, `A1:C10` (first tab), `'My tab'!A:A` (whole column, capped to the used range) or `B2`.", dataShape, outputSchema, ID2 = "Object id (from sheet-create or sheet-list).", PATH = "Drive path of the `.sheet.json` file, instead of `id`.", WRITE, registerSheetCreateTool = (server) => {
|
|
138393
|
+
createToolRegistrar(server)("sheet-create", {
|
|
138394
|
+
title: "Create sheet",
|
|
138395
|
+
annotations: WRITE,
|
|
138396
|
+
description: "Create a spreadsheet (`swarm-sheet/1`, a `.sheet.json` file) on your default agent-fs drive, as your own agent-fs identity. Create-only: refuses when the path exists. Optional `tabs` name the tabs (default one tab `Sheet1`) and may seed each with `rows` from A1. Formulas recompute with a spreadsheet engine; limits: 20 tabs, 50,000 cells, 5 MiB.",
|
|
138397
|
+
inputSchema: object2({
|
|
138398
|
+
path: string2().min(1).describe("Drive path ending in `.sheet.json`, e.g. /qa/tracker.sheet.json."),
|
|
138399
|
+
title: string2().max(200).optional(),
|
|
138400
|
+
tabs: array2(object2({ name: string2().min(1).max(31), rows: Grid.optional() })).optional().describe("Tabs to create, each with an optional `rows` grid written from A1.")
|
|
138401
|
+
}),
|
|
138402
|
+
outputSchema
|
|
138403
|
+
}, async ({ path, title, tabs }, requestInfo) => {
|
|
138404
|
+
const result = await refusing2(requestInfo.agentId, () => createSheet({ agentId: requestInfo.agentId, path, title, tabs }));
|
|
138405
|
+
if ("error" in result)
|
|
138406
|
+
return result.error;
|
|
138407
|
+
const { object, link } = result.value;
|
|
138408
|
+
return toolOk(`Created sheet ${object.id} at ${object.path}${link ? ` (${link})` : ""}.`, {
|
|
138409
|
+
data: { yourAgentId: requestInfo.agentId, ...result.value }
|
|
138410
|
+
});
|
|
138411
|
+
});
|
|
138412
|
+
}, registerSheetGetTool = (server) => {
|
|
138413
|
+
createToolRegistrar(server)("sheet-get", {
|
|
138414
|
+
title: "Get sheet",
|
|
138415
|
+
annotations: { readOnlyHint: true },
|
|
138416
|
+
description: "Get a sheet's object, current agent-fs `version` and its tabs (name, used rows and columns, frozen rows). Read cells with sheet-get-range.",
|
|
138417
|
+
inputSchema: object2({
|
|
138418
|
+
id: string2().min(1).optional().describe(ID2),
|
|
138419
|
+
path: string2().min(1).optional().describe(PATH)
|
|
138420
|
+
}),
|
|
138421
|
+
outputSchema
|
|
138422
|
+
}, async ({ id, path }, requestInfo) => {
|
|
138423
|
+
const result = await refusing2(requestInfo.agentId, () => getSheet({ agentId: requestInfo.agentId, id, path }));
|
|
138424
|
+
if ("error" in result)
|
|
138425
|
+
return result.error;
|
|
138426
|
+
const { object, tabs, version } = result.value;
|
|
138427
|
+
return toolOk(`Sheet ${object.id} at ${object.path}: ${tabs.length} tab(s), version ${version}.`, {
|
|
138428
|
+
data: { yourAgentId: requestInfo.agentId, ...result.value }
|
|
138429
|
+
});
|
|
138430
|
+
});
|
|
138431
|
+
}, registerSheetListTool = (server) => {
|
|
138432
|
+
createToolRegistrar(server)("sheet-list", {
|
|
138433
|
+
title: "List sheets",
|
|
138434
|
+
annotations: { readOnlyHint: true },
|
|
138435
|
+
description: "List sheets on your default agent-fs drive, newest first. Filter by path `prefix`. Pagination via limit (max 200) and offset.",
|
|
138436
|
+
inputSchema: object2({
|
|
138437
|
+
prefix: string2().optional(),
|
|
138438
|
+
limit: number2().int().positive().max(200).optional(),
|
|
138439
|
+
offset: number2().int().nonnegative().optional()
|
|
138440
|
+
}),
|
|
138441
|
+
outputSchema
|
|
138442
|
+
}, async ({ prefix, limit, offset }, requestInfo) => {
|
|
138443
|
+
const result = await refusing2(requestInfo.agentId, () => listSheets({ agentId: requestInfo.agentId, prefix, limit, offset }));
|
|
138444
|
+
if ("error" in result)
|
|
138445
|
+
return result.error;
|
|
138446
|
+
const { objects, total } = result.value;
|
|
138447
|
+
return toolOk(`Found ${objects.length} of ${total} sheets.`, {
|
|
138448
|
+
details: objects.length > 0 ? objects.map((o) => `- ${o.id} at ${o.path}`).join(`
|
|
138449
|
+
`) : undefined,
|
|
138450
|
+
data: { yourAgentId: requestInfo.agentId, ...result.value }
|
|
138451
|
+
});
|
|
138452
|
+
});
|
|
138453
|
+
}, registerSheetGetRangeTool = (server) => {
|
|
138454
|
+
createToolRegistrar(server)("sheet-get-range", {
|
|
138455
|
+
title: "Read sheet range",
|
|
138456
|
+
annotations: { readOnlyHint: true },
|
|
138457
|
+
description: "Read cached values from a range (at most 10,000 cells). Formula cells return their computed value; an error cell returns its error text such as `#DIV/0!`; spilled cells (SEQUENCE, UNIQUE, ...) are included. `formulas: true` also returns the formulas.",
|
|
138458
|
+
inputSchema: object2({
|
|
138459
|
+
id: string2().min(1).optional().describe(ID2),
|
|
138460
|
+
path: string2().min(1).optional().describe(PATH),
|
|
138461
|
+
range: string2().min(1).describe(RANGE_HELP),
|
|
138462
|
+
formulas: boolean().optional().describe("Also return `formulas[][]`: the formula text where a cell has one, else the value.")
|
|
138463
|
+
}),
|
|
138464
|
+
outputSchema
|
|
138465
|
+
}, async ({ id, path, range, formulas }, requestInfo) => {
|
|
138466
|
+
const result = await refusing2(requestInfo.agentId, () => getSheetRange({ agentId: requestInfo.agentId, id, path, range, formulas }));
|
|
138467
|
+
if ("error" in result)
|
|
138468
|
+
return result.error;
|
|
138469
|
+
return toolOk(`Read ${result.value.range} at version ${result.value.version}.`, {
|
|
138470
|
+
data: { yourAgentId: requestInfo.agentId, ...result.value }
|
|
138471
|
+
});
|
|
138472
|
+
});
|
|
138473
|
+
}, registerSheetSetRangeTool = (server) => {
|
|
138474
|
+
createToolRegistrar(server)("sheet-set-range", {
|
|
138475
|
+
title: "Write sheet range",
|
|
138476
|
+
annotations: WRITE,
|
|
138477
|
+
description: "Write a rectangle of `values` and recompute every formula. A string starting with `=` is a formula; start with `'=` to store literal text that begins with `=`; other strings stay text even when they look like numbers, so send numbers as numbers; null clears the cell. A single-cell `range` is the top-left corner; a larger `range` must match the values' size. Retries on a concurrent write: other cells merge, the same cell is last writer wins.",
|
|
138478
|
+
inputSchema: object2({
|
|
138479
|
+
id: string2().min(1).optional().describe(ID2),
|
|
138480
|
+
path: string2().min(1).optional().describe(PATH),
|
|
138481
|
+
range: string2().min(1).describe(RANGE_HELP),
|
|
138482
|
+
values: Grid.describe("Rows of cell values, all the same length (at most 10,000 cells).")
|
|
138483
|
+
}),
|
|
138484
|
+
outputSchema
|
|
138485
|
+
}, async ({ id, path, range, values }, requestInfo) => {
|
|
138486
|
+
const result = await refusing2(requestInfo.agentId, () => setSheetRange({ agentId: requestInfo.agentId, id, path, range, values }));
|
|
138487
|
+
if ("error" in result)
|
|
138488
|
+
return result.error;
|
|
138489
|
+
const r = result.value;
|
|
138490
|
+
return toolOk(`Wrote ${r.range}: ${r.changed} changed, ${r.recalculated} recalculated, version ${r.version}.`, { data: { yourAgentId: requestInfo.agentId, ...r } });
|
|
138491
|
+
});
|
|
138492
|
+
}, registerSheetAppendRowsTool = (server) => {
|
|
138493
|
+
createToolRegistrar(server)("sheet-append-rows", {
|
|
138494
|
+
title: "Append sheet rows",
|
|
138495
|
+
annotations: WRITE,
|
|
138496
|
+
description: "Append rows below the last used row of a tab, starting at column A. Same value rules as sheet-set-range; null skips a cell. Returns the range written.",
|
|
138497
|
+
inputSchema: object2({
|
|
138498
|
+
id: string2().min(1).optional().describe(ID2),
|
|
138499
|
+
path: string2().min(1).optional().describe(PATH),
|
|
138500
|
+
tab: string2().min(1).describe("Tab name."),
|
|
138501
|
+
rows: Grid.describe("Rows to append (at most 10,000 cells).")
|
|
138502
|
+
}),
|
|
138503
|
+
outputSchema
|
|
138504
|
+
}, async ({ id, path, tab, rows }, requestInfo) => {
|
|
138505
|
+
const result = await refusing2(requestInfo.agentId, () => appendSheetRows({ agentId: requestInfo.agentId, id, path, tab, rows }));
|
|
138506
|
+
if ("error" in result)
|
|
138507
|
+
return result.error;
|
|
138508
|
+
return toolOk(`Appended ${result.value.range}, version ${result.value.version}.`, {
|
|
138509
|
+
data: { yourAgentId: requestInfo.agentId, ...result.value }
|
|
138510
|
+
});
|
|
138511
|
+
});
|
|
138512
|
+
}, registerSheetClearRangeTool = (server) => {
|
|
138513
|
+
createToolRegistrar(server)("sheet-clear-range", {
|
|
138514
|
+
title: "Clear sheet range",
|
|
138515
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
|
|
138516
|
+
description: "Clear the contents of a range and recompute dependents. A whole-column or whole-row range is capped to the used range. Spilled cells go when their anchor is cleared.",
|
|
138517
|
+
inputSchema: object2({
|
|
138518
|
+
id: string2().min(1).optional().describe(ID2),
|
|
138519
|
+
path: string2().min(1).optional().describe(PATH),
|
|
138520
|
+
range: string2().min(1).describe(RANGE_HELP)
|
|
138521
|
+
}),
|
|
138522
|
+
outputSchema
|
|
138523
|
+
}, async ({ id, path, range }, requestInfo) => {
|
|
138524
|
+
const result = await refusing2(requestInfo.agentId, () => clearSheetRange({ agentId: requestInfo.agentId, id, path, range }));
|
|
138525
|
+
if ("error" in result)
|
|
138526
|
+
return result.error;
|
|
138527
|
+
const r = result.value;
|
|
138528
|
+
return toolOk(`Cleared ${r.cleared} cell(s) in ${r.range}, version ${r.version}.`, {
|
|
138529
|
+
data: { yourAgentId: requestInfo.agentId, ...r }
|
|
138530
|
+
});
|
|
138531
|
+
});
|
|
138532
|
+
}, registerSheetAddTabTool = (server) => {
|
|
138533
|
+
createToolRegistrar(server)("sheet-add-tab", {
|
|
138534
|
+
title: "Add sheet tab",
|
|
138535
|
+
annotations: WRITE,
|
|
138536
|
+
description: "Add an empty tab (1-31 characters, none of `[]:*?/\\`), at the end or after the tab named `after`. A sheet holds at most 20 tabs.",
|
|
138537
|
+
inputSchema: object2({
|
|
138538
|
+
id: string2().min(1).optional().describe(ID2),
|
|
138539
|
+
path: string2().min(1).optional().describe(PATH),
|
|
138540
|
+
name: string2().min(1).max(31).describe("New tab name."),
|
|
138541
|
+
after: string2().optional().describe("Insert after this tab; default: at the end.")
|
|
138542
|
+
}),
|
|
138543
|
+
outputSchema
|
|
138544
|
+
}, async ({ id, path, name, after }, requestInfo) => {
|
|
138545
|
+
const result = await refusing2(requestInfo.agentId, () => addSheetTab({ agentId: requestInfo.agentId, id, path, name, after }));
|
|
138546
|
+
if ("error" in result)
|
|
138547
|
+
return result.error;
|
|
138548
|
+
return toolOk(`Tabs now: ${result.value.tabs.join(", ")} (version ${result.value.version}).`, {
|
|
138549
|
+
data: { yourAgentId: requestInfo.agentId, ...result.value }
|
|
138550
|
+
});
|
|
138551
|
+
});
|
|
138552
|
+
};
|
|
138553
|
+
var init_sheets = __esm(() => {
|
|
138554
|
+
init_zod();
|
|
138555
|
+
init_objects();
|
|
138556
|
+
init_service2();
|
|
138557
|
+
init_provider();
|
|
138558
|
+
init_utils();
|
|
138559
|
+
objectOutputSchema2 = looseObject({
|
|
138560
|
+
id: string2().optional(),
|
|
138561
|
+
kind: string2().optional(),
|
|
138562
|
+
path: string2().optional(),
|
|
138563
|
+
title: string2().nullable().optional(),
|
|
138564
|
+
fileVersion: number2().nullable().optional(),
|
|
138565
|
+
link: string2().nullable().optional()
|
|
138566
|
+
});
|
|
138567
|
+
CellValue = union3([number2(), string2(), boolean(), _null()]);
|
|
138568
|
+
Grid = array2(array2(CellValue));
|
|
138569
|
+
dataShape = {
|
|
138570
|
+
yourAgentId: string2().optional(),
|
|
138571
|
+
object: objectOutputSchema2.optional(),
|
|
138572
|
+
objects: array2(objectOutputSchema2).optional(),
|
|
138573
|
+
total: number2().optional(),
|
|
138574
|
+
link: string2().nullable().optional(),
|
|
138575
|
+
version: number2().optional(),
|
|
138576
|
+
tabs: array2(unknown()).optional(),
|
|
138577
|
+
range: string2().optional(),
|
|
138578
|
+
values: array2(array2(unknown())).optional(),
|
|
138579
|
+
formulas: array2(array2(unknown())).optional(),
|
|
138580
|
+
changed: number2().optional(),
|
|
138581
|
+
recalculated: number2().optional(),
|
|
138582
|
+
cleared: number2().optional()
|
|
138583
|
+
};
|
|
138584
|
+
outputSchema = swarmToolOutputSchema(dataShape);
|
|
138585
|
+
WRITE = { readOnlyHint: false, idempotentHint: false };
|
|
138586
|
+
});
|
|
138587
|
+
|
|
135888
138588
|
// src/tools/skills/skill-create.ts
|
|
135889
138589
|
var registerSkillCreateTool = (server) => {
|
|
135890
138590
|
createToolRegistrar(server)("skill-create", {
|
|
@@ -136860,7 +139560,7 @@ var init_slack_archive_channel = __esm(() => {
|
|
|
136860
139560
|
init_zod();
|
|
136861
139561
|
init_db4();
|
|
136862
139562
|
init_rbac();
|
|
136863
|
-
|
|
139563
|
+
init_app4();
|
|
136864
139564
|
init_channel_join();
|
|
136865
139565
|
init_channel_lifecycle();
|
|
136866
139566
|
init_utils();
|
|
@@ -136922,7 +139622,7 @@ var init_slack_create_channel = __esm(() => {
|
|
|
136922
139622
|
init_zod();
|
|
136923
139623
|
init_db4();
|
|
136924
139624
|
init_rbac();
|
|
136925
|
-
|
|
139625
|
+
init_app4();
|
|
136926
139626
|
init_channel_join();
|
|
136927
139627
|
init_channel_lifecycle();
|
|
136928
139628
|
init_utils();
|
|
@@ -137273,7 +139973,7 @@ var init_slack_delete = __esm(() => {
|
|
|
137273
139973
|
init_zod();
|
|
137274
139974
|
init_db4();
|
|
137275
139975
|
init_rbac();
|
|
137276
|
-
|
|
139976
|
+
init_app4();
|
|
137277
139977
|
init_message_text();
|
|
137278
139978
|
init_utils();
|
|
137279
139979
|
});
|
|
@@ -137815,7 +140515,7 @@ ${fetchCommand}`,
|
|
|
137815
140515
|
var init_slack_download_file = __esm(() => {
|
|
137816
140516
|
init_zod();
|
|
137817
140517
|
init_db4();
|
|
137818
|
-
|
|
140518
|
+
init_app4();
|
|
137819
140519
|
init_files();
|
|
137820
140520
|
init_inbound_files();
|
|
137821
140521
|
init_utils();
|
|
@@ -137876,7 +140576,7 @@ var init_slack_invite_to_channel = __esm(() => {
|
|
|
137876
140576
|
init_zod();
|
|
137877
140577
|
init_db4();
|
|
137878
140578
|
init_rbac();
|
|
137879
|
-
|
|
140579
|
+
init_app4();
|
|
137880
140580
|
init_channel_join();
|
|
137881
140581
|
init_channel_lifecycle();
|
|
137882
140582
|
init_utils();
|
|
@@ -138042,7 +140742,7 @@ var SlackChannelSchema, registerSlackListChannelsTool = (server) => {
|
|
|
138042
140742
|
var init_slack_list_channels = __esm(() => {
|
|
138043
140743
|
init_zod();
|
|
138044
140744
|
init_db4();
|
|
138045
|
-
|
|
140745
|
+
init_app4();
|
|
138046
140746
|
init_utils();
|
|
138047
140747
|
SlackChannelSchema = looseObject({
|
|
138048
140748
|
id: string2().optional(),
|
|
@@ -138176,7 +140876,7 @@ var init_slack_post = __esm(() => {
|
|
|
138176
140876
|
init_db4();
|
|
138177
140877
|
init_cards();
|
|
138178
140878
|
init_rbac();
|
|
138179
|
-
|
|
140879
|
+
init_app4();
|
|
138180
140880
|
init_blocks();
|
|
138181
140881
|
init_channel_join();
|
|
138182
140882
|
init_dm();
|
|
@@ -138197,14 +140897,21 @@ var AUTO_DOWNLOAD_DIR = "/app/shared/downloads/slack", USERS_INFO_CONCURRENCY =
|
|
|
138197
140897
|
channelId: string2().optional().describe("Slack channel ID to read from (requires lead privileges). A user ID (U…/W…) reads the bot's DM with that user."),
|
|
138198
140898
|
threadTs: string2().optional().describe("Thread timestamp (required with channelId for thread history)."),
|
|
138199
140899
|
limit: number2().int().min(1).max(100).default(20).describe("Maximum number of messages to retrieve (default: 20, max: 100)."),
|
|
138200
|
-
includeFiles: boolean().
|
|
140900
|
+
includeFiles: boolean().optional().describe("Include and download file attachments. Defaults to false for direct channelId reads, and true for taskId or inboxMessageId reads. From a task, files are also stored as attachments of that task.")
|
|
138201
140901
|
}),
|
|
138202
140902
|
outputSchema: swarmToolOutputSchema({
|
|
138203
140903
|
channelId: string2().optional(),
|
|
138204
140904
|
threadTs: string2().optional(),
|
|
138205
140905
|
messages: array2(SlackMessageSchema).optional()
|
|
138206
140906
|
})
|
|
138207
|
-
}, async ({
|
|
140907
|
+
}, async ({
|
|
140908
|
+
inboxMessageId,
|
|
140909
|
+
taskId,
|
|
140910
|
+
channelId,
|
|
140911
|
+
threadTs,
|
|
140912
|
+
limit = 20,
|
|
140913
|
+
includeFiles = Boolean(inboxMessageId || taskId)
|
|
140914
|
+
}, requestInfo, _meta) => {
|
|
138208
140915
|
if (!requestInfo.agentId) {
|
|
138209
140916
|
return toolErr("Agent ID not found.", { data: { messages: [] } });
|
|
138210
140917
|
}
|
|
@@ -138412,7 +141119,7 @@ var init_slack_read = __esm(() => {
|
|
|
138412
141119
|
init_zod();
|
|
138413
141120
|
init_db4();
|
|
138414
141121
|
init_rbac();
|
|
138415
|
-
|
|
141122
|
+
init_app4();
|
|
138416
141123
|
init_channel_join();
|
|
138417
141124
|
init_dm();
|
|
138418
141125
|
init_external_channel();
|
|
@@ -138597,7 +141304,7 @@ var init_slack_reply = __esm(() => {
|
|
|
138597
141304
|
init_db4();
|
|
138598
141305
|
init_task_citations2();
|
|
138599
141306
|
init_cards();
|
|
138600
|
-
|
|
141307
|
+
init_app4();
|
|
138601
141308
|
init_blocks();
|
|
138602
141309
|
init_channel_join();
|
|
138603
141310
|
init_external_channel();
|
|
@@ -138698,7 +141405,7 @@ var init_slack_start_thread = __esm(() => {
|
|
|
138698
141405
|
init_zod();
|
|
138699
141406
|
init_db4();
|
|
138700
141407
|
init_rbac();
|
|
138701
|
-
|
|
141408
|
+
init_app4();
|
|
138702
141409
|
init_blocks();
|
|
138703
141410
|
init_channel_join();
|
|
138704
141411
|
init_dm();
|
|
@@ -138790,7 +141497,7 @@ var init_slack_update = __esm(() => {
|
|
|
138790
141497
|
init_zod();
|
|
138791
141498
|
init_db4();
|
|
138792
141499
|
init_rbac();
|
|
138793
|
-
|
|
141500
|
+
init_app4();
|
|
138794
141501
|
init_blocks();
|
|
138795
141502
|
init_external_channel();
|
|
138796
141503
|
init_message_text();
|
|
@@ -138993,7 +141700,7 @@ var init_slack_upload_file = __esm(() => {
|
|
|
138993
141700
|
init_zod();
|
|
138994
141701
|
init_db4();
|
|
138995
141702
|
init_rbac();
|
|
138996
|
-
|
|
141703
|
+
init_app4();
|
|
138997
141704
|
init_external_channel();
|
|
138998
141705
|
init_files();
|
|
138999
141706
|
init_utils();
|
|
@@ -139314,7 +142021,7 @@ async function readScriptActionAllowlist() {
|
|
|
139314
142021
|
const [row] = await getSwarmConfigs2({ scope: "global", key: UI_SPEC_SCRIPT_ACTIONS_KEY });
|
|
139315
142022
|
if (row)
|
|
139316
142023
|
return row.value;
|
|
139317
|
-
const { getDeploymentEnvValue } = await import("./core-
|
|
142024
|
+
const { getDeploymentEnvValue } = await import("./core-dxcy02sc.js");
|
|
139318
142025
|
return getDeploymentEnvValue(UI_SPEC_SCRIPT_ACTIONS_KEY);
|
|
139319
142026
|
}
|
|
139320
142027
|
async function loadScriptActionLookups() {
|
|
@@ -141201,7 +143908,7 @@ async function emitBudgetRefusalSideEffects(ctx, inserted) {
|
|
|
141201
143908
|
console.warn(`[budget-refusal-notify] Failed to create follow-up task for budget refusal (task=${ctx.task.id.slice(0, 8)}): ${err}`);
|
|
141202
143909
|
}
|
|
141203
143910
|
}
|
|
141204
|
-
import("./event-bus-
|
|
143911
|
+
import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
|
|
141205
143912
|
workflowEventBus.emit("task.budget_refused", {
|
|
141206
143913
|
taskId: ctx.task.id,
|
|
141207
143914
|
agentId: ctx.agentId,
|
|
@@ -142209,7 +144916,7 @@ async function sendAndFormat(params, agentId, contextMessageId) {
|
|
|
142209
144916
|
return toolErr(errorMessage, { data: { yourAgentId: agentId } });
|
|
142210
144917
|
}
|
|
142211
144918
|
}
|
|
142212
|
-
var SESSION_WINDOW_HINT = 'Outside the 24h WhatsApp session window — free-form text is rejected. Use a pre-approved template message (see the `kapso-whatsapp` skill, "Send a template").',
|
|
144919
|
+
var SESSION_WINDOW_HINT = 'Outside the 24h WhatsApp session window — free-form text is rejected. Use a pre-approved template message (see the `kapso-whatsapp` skill, "Send a template").', outputSchema2, registerSendWhatsappMessageTool = (server) => {
|
|
142213
144920
|
createToolRegistrar(server)("send-whatsapp-message", {
|
|
142214
144921
|
title: "Send WhatsApp Message",
|
|
142215
144922
|
annotations: { openWorldHint: true },
|
|
@@ -142220,7 +144927,7 @@ var SESSION_WINDOW_HINT = 'Outside the 24h WhatsApp session window — free-form
|
|
|
142220
144927
|
body: string2().min(1).describe("Message text."),
|
|
142221
144928
|
previewUrl: boolean().optional().describe("Render a link preview for URLs in the body (default false).")
|
|
142222
144929
|
}),
|
|
142223
|
-
outputSchema
|
|
144930
|
+
outputSchema: outputSchema2
|
|
142224
144931
|
}, async ({ phoneNumberId, to, body, previewUrl }, requestInfo) => {
|
|
142225
144932
|
return sendAndFormat({ phoneNumberId, to, body, previewUrl }, requestInfo.agentId, undefined);
|
|
142226
144933
|
});
|
|
@@ -142235,7 +144942,7 @@ var SESSION_WINDOW_HINT = 'Outside the 24h WhatsApp session window — free-form
|
|
|
142235
144942
|
inReplyTo: string2().min(1).describe("The inbound WAMID to quote-reply (set as context.message_id)."),
|
|
142236
144943
|
body: string2().min(1).describe("Reply text.")
|
|
142237
144944
|
}),
|
|
142238
|
-
outputSchema
|
|
144945
|
+
outputSchema: outputSchema2
|
|
142239
144946
|
}, async ({ phoneNumberId, to, inReplyTo, body }, requestInfo) => {
|
|
142240
144947
|
return sendAndFormat({ phoneNumberId, to, body }, requestInfo.agentId, inReplyTo);
|
|
142241
144948
|
});
|
|
@@ -142245,7 +144952,7 @@ var init_whatsapp_message = __esm(() => {
|
|
|
142245
144952
|
init_client();
|
|
142246
144953
|
init_config2();
|
|
142247
144954
|
init_utils();
|
|
142248
|
-
|
|
144955
|
+
outputSchema2 = swarmToolOutputSchema({
|
|
142249
144956
|
yourAgentId: string2().optional(),
|
|
142250
144957
|
messageId: string2().optional(),
|
|
142251
144958
|
sessionWindowExpired: boolean().optional()
|
|
@@ -142344,16 +145051,16 @@ var registerCreateWorkflowTool = (server) => {
|
|
|
142344
145051
|
` + "- 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.
|
|
142345
145052
|
` + "- 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.
|
|
142346
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 } }.
|
|
142347
|
-
` + "- WEBHOOK
|
|
145054
|
+
` + "- 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.
|
|
142348
145055
|
` + "- 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.",
|
|
142349
145056
|
inputSchema: object2({
|
|
142350
145057
|
name: string2().describe("Unique name for the workflow"),
|
|
142351
145058
|
key: AssetKeySchema.optional().describe("Logical namespace. Defaults to a shared/workflow:<id>/ resource key."),
|
|
142352
145059
|
description: string2().optional().describe("Description of what this workflow does"),
|
|
142353
145060
|
definition: WorkflowDefinitionSchema.describe("The workflow definition with nodes (each node has id, type, config, and optional next/retry/validation)"),
|
|
142354
|
-
triggers: array2(TriggerConfigSchema).optional().describe("Optional trigger configurations (webhook, schedule, event).
|
|
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."),
|
|
142355
145062
|
cooldown: CooldownConfigSchema.optional().describe("Optional cooldown configuration to prevent re-triggering too frequently"),
|
|
142356
|
-
input: record2(string2(), InputValueSchema).optional().describe("Optional input values resolved at execution time (env vars like VAR_NAME, secrets secret.NAME, or literals)"),
|
|
145063
|
+
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)."),
|
|
142357
145064
|
dir: string2().min(1).startsWith("/").optional().describe("Default working directory for all agent-task nodes (absolute path, e.g. /tmp/workspace)"),
|
|
142358
145065
|
vcsRepo: string2().min(1).optional().describe("Default VCS repo for all agent-task nodes (e.g. org/repo)"),
|
|
142359
145066
|
triggerSchema: record2(string2(), unknown()).optional().describe("Optional JSON-Schema object that validates incoming trigger payloads. " + "Supported keywords: type, required, properties, enum, const, items. " + "Other JSON-Schema keywords are silently ignored.")
|
|
@@ -142387,6 +145094,10 @@ var registerCreateWorkflowTool = (server) => {
|
|
|
142387
145094
|
if (modelErrors.length > 0) {
|
|
142388
145095
|
return toolErr(`Invalid definition: ${modelErrors.join("; ")}`);
|
|
142389
145096
|
}
|
|
145097
|
+
const refKeys = serverRefInputKeys(input);
|
|
145098
|
+
if (refKeys.length > 0 && !await agentMaySetServerRefInput(requestInfo.agentId)) {
|
|
145099
|
+
return toolErr(serverRefInputDeniedMessage(refKeys));
|
|
145100
|
+
}
|
|
142390
145101
|
const createdBy = await resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId) ?? undefined;
|
|
142391
145102
|
const assetKey = key ? await authorizeAssetKeyWrite(key, createdBy) : undefined;
|
|
142392
145103
|
const workflow = await createWorkflow2({
|
|
@@ -142428,6 +145139,7 @@ var init_create_workflow = __esm(() => {
|
|
|
142428
145139
|
init_types5();
|
|
142429
145140
|
init_workflows();
|
|
142430
145141
|
init_definition2();
|
|
145142
|
+
init_input();
|
|
142431
145143
|
init_model_validation();
|
|
142432
145144
|
init_readiness();
|
|
142433
145145
|
});
|
|
@@ -142685,6 +145397,12 @@ async function patchWorkflowDefinition(options) {
|
|
|
142685
145397
|
const existing = await getWorkflow2(id);
|
|
142686
145398
|
if (!existing)
|
|
142687
145399
|
return { ok: false, reason: "not_found" };
|
|
145400
|
+
if (options.serverRefInputAllowed === false) {
|
|
145401
|
+
const refKeys = serverRefInputKeys(existing.input);
|
|
145402
|
+
if (refKeys.length > 0) {
|
|
145403
|
+
return { ok: false, reason: "forbidden", errors: [serverRefInputDeniedMessage(refKeys)] };
|
|
145404
|
+
}
|
|
145405
|
+
}
|
|
142688
145406
|
const patchResult = applyDefinitionPatch(existing.definition, patch);
|
|
142689
145407
|
if (patchResult.errors.length > 0) {
|
|
142690
145408
|
return { ok: false, reason: "patch", errors: patchResult.errors };
|
|
@@ -142718,6 +145436,7 @@ async function patchWorkflowDefinition(options) {
|
|
|
142718
145436
|
var init_patch_definition = __esm(() => {
|
|
142719
145437
|
init_db4();
|
|
142720
145438
|
init_definition2();
|
|
145439
|
+
init_input();
|
|
142721
145440
|
init_model_validation();
|
|
142722
145441
|
init_version();
|
|
142723
145442
|
});
|
|
@@ -142778,6 +145497,7 @@ var registerPatchWorkflowTool = (server) => {
|
|
|
142778
145497
|
},
|
|
142779
145498
|
registry: getExecutorRegistry2(),
|
|
142780
145499
|
snapshotAgentId: requestInfo.agentId,
|
|
145500
|
+
serverRefInputAllowed: !!requestInfo.agentId && await agentMaySetServerRefInput(requestInfo.agentId),
|
|
142781
145501
|
updates
|
|
142782
145502
|
});
|
|
142783
145503
|
if (!result.ok) {
|
|
@@ -142786,6 +145506,8 @@ var registerPatchWorkflowTool = (server) => {
|
|
|
142786
145506
|
if (result.reason === "patch") {
|
|
142787
145507
|
return toolErr(`Patch errors: ${result.errors.join("; ")}`);
|
|
142788
145508
|
}
|
|
145509
|
+
if (result.reason === "forbidden")
|
|
145510
|
+
return toolErr(result.errors.join("; "));
|
|
142789
145511
|
return toolErr(`Invalid definition: ${result.errors.join("; ")}`);
|
|
142790
145512
|
}
|
|
142791
145513
|
const { workflow, version } = result;
|
|
@@ -142823,6 +145545,7 @@ var init_patch_workflow = __esm(() => {
|
|
|
142823
145545
|
init_utils();
|
|
142824
145546
|
init_types5();
|
|
142825
145547
|
init_workflows();
|
|
145548
|
+
init_input();
|
|
142826
145549
|
init_patch_definition();
|
|
142827
145550
|
init_readiness();
|
|
142828
145551
|
});
|
|
@@ -142851,6 +145574,7 @@ var registerPatchWorkflowNodeTool = (server) => {
|
|
|
142851
145574
|
patch: { update: [{ nodeId, node: nodeFields }] },
|
|
142852
145575
|
registry: getExecutorRegistry2(),
|
|
142853
145576
|
snapshotAgentId: requestInfo.agentId,
|
|
145577
|
+
serverRefInputAllowed: !!requestInfo.agentId && await agentMaySetServerRefInput(requestInfo.agentId),
|
|
142854
145578
|
updates: updatedBy !== undefined ? { updatedBy } : {}
|
|
142855
145579
|
});
|
|
142856
145580
|
if (!result.ok) {
|
|
@@ -142859,6 +145583,8 @@ var registerPatchWorkflowNodeTool = (server) => {
|
|
|
142859
145583
|
if (result.reason === "patch") {
|
|
142860
145584
|
return toolErr(`Patch errors: ${result.errors.join("; ")}`);
|
|
142861
145585
|
}
|
|
145586
|
+
if (result.reason === "forbidden")
|
|
145587
|
+
return toolErr(result.errors.join("; "));
|
|
142862
145588
|
return toolErr(`Invalid definition: ${result.errors.join("; ")}`);
|
|
142863
145589
|
}
|
|
142864
145590
|
const { workflow, version } = result;
|
|
@@ -142887,6 +145613,7 @@ var init_patch_workflow_node = __esm(() => {
|
|
|
142887
145613
|
init_utils();
|
|
142888
145614
|
init_types5();
|
|
142889
145615
|
init_workflows();
|
|
145616
|
+
init_input();
|
|
142890
145617
|
init_patch_definition();
|
|
142891
145618
|
init_readiness();
|
|
142892
145619
|
});
|
|
@@ -143116,14 +145843,14 @@ var registerUpdateWorkflowTool = (server) => {
|
|
|
143116
145843
|
createToolRegistrar(server)("update-workflow", {
|
|
143117
145844
|
title: "Update Workflow",
|
|
143118
145845
|
annotations: { destructiveHint: false },
|
|
143119
|
-
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
|
|
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.",
|
|
143120
145847
|
inputSchema: object2({
|
|
143121
145848
|
id: string2().uuid().describe("Workflow ID to update"),
|
|
143122
145849
|
key: AssetKeySchema.optional().describe("Move to a logical namespace."),
|
|
143123
145850
|
name: string2().optional().describe("New name for the workflow"),
|
|
143124
145851
|
description: string2().optional().describe("New description"),
|
|
143125
145852
|
definition: WorkflowDefinitionSchema.optional().describe("New workflow definition"),
|
|
143126
|
-
triggers: array2(TriggerConfigSchema).optional().describe("
|
|
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."),
|
|
143127
145854
|
cooldown: CooldownConfigSchema.optional().nullable().describe("New cooldown configuration (null to remove)"),
|
|
143128
145855
|
input: record2(string2(), InputValueSchema).optional().nullable().describe("New input values (null to remove)"),
|
|
143129
145856
|
dir: string2().min(1).startsWith("/").optional().nullable().describe("Default working directory for all agent-task nodes (null to remove)"),
|
|
@@ -143173,6 +145900,10 @@ var registerUpdateWorkflowTool = (server) => {
|
|
|
143173
145900
|
return toolErr(`Invalid definition: ${modelErrors.join("; ")}`);
|
|
143174
145901
|
}
|
|
143175
145902
|
}
|
|
145903
|
+
const refKeys = serverRefInputKeys(input !== undefined ? input : definition ? existing.input : undefined);
|
|
145904
|
+
if (refKeys.length > 0 && !(requestInfo.agentId && await agentMaySetServerRefInput(requestInfo.agentId))) {
|
|
145905
|
+
return toolErr(serverRefInputDeniedMessage(refKeys));
|
|
145906
|
+
}
|
|
143176
145907
|
const updatedBy = await resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId) ?? undefined;
|
|
143177
145908
|
const assetKey = key === undefined ? undefined : await authorizeAssetKeyWrite(key, updatedBy);
|
|
143178
145909
|
const { workflow, version } = await snapshotAndUpdateWorkflow(id, {
|
|
@@ -143217,6 +145948,7 @@ var init_update_workflow = __esm(() => {
|
|
|
143217
145948
|
init_types5();
|
|
143218
145949
|
init_workflows();
|
|
143219
145950
|
init_definition2();
|
|
145951
|
+
init_input();
|
|
143220
145952
|
init_model_validation();
|
|
143221
145953
|
init_readiness();
|
|
143222
145954
|
init_version();
|
|
@@ -143511,6 +146243,26 @@ async function createServer(opts = {}) {
|
|
|
143511
146243
|
registerRoomResetTool(server);
|
|
143512
146244
|
registerRoomDecodeTool(server);
|
|
143513
146245
|
}
|
|
146246
|
+
if (hasCapability("primitives")) {
|
|
146247
|
+
registerObjectCreateTool(server);
|
|
146248
|
+
registerObjectGetTool(server);
|
|
146249
|
+
registerObjectListTool(server);
|
|
146250
|
+
registerObjectReindexTool(server);
|
|
146251
|
+
registerSheetCreateTool(server);
|
|
146252
|
+
registerSheetGetTool(server);
|
|
146253
|
+
registerSheetListTool(server);
|
|
146254
|
+
registerSheetGetRangeTool(server);
|
|
146255
|
+
registerSheetSetRangeTool(server);
|
|
146256
|
+
registerSheetAppendRowsTool(server);
|
|
146257
|
+
registerSheetClearRangeTool(server);
|
|
146258
|
+
registerSheetAddTabTool(server);
|
|
146259
|
+
registerBoardCreateTool(server);
|
|
146260
|
+
registerBoardGetTool(server);
|
|
146261
|
+
registerBoardListTool(server);
|
|
146262
|
+
registerBoardAddElementsTool(server);
|
|
146263
|
+
registerBoardUpdateElementsTool(server);
|
|
146264
|
+
registerBoardRemoveElementsTool(server);
|
|
146265
|
+
}
|
|
143514
146266
|
if (hasCapability("slack")) {
|
|
143515
146267
|
registerSlackReplyTool(server);
|
|
143516
146268
|
registerSlackReadTool(server);
|
|
@@ -143597,6 +146349,7 @@ var init_server = __esm(() => {
|
|
|
143597
146349
|
init_app_rows();
|
|
143598
146350
|
init_app_sync();
|
|
143599
146351
|
init_app_upsert();
|
|
146352
|
+
init_boards();
|
|
143600
146353
|
init_cancel_approval_request();
|
|
143601
146354
|
init_cancel_task();
|
|
143602
146355
|
init_chat_open_dm();
|
|
@@ -143641,6 +146394,7 @@ var init_server = __esm(() => {
|
|
|
143641
146394
|
init_list_model_profiles();
|
|
143642
146395
|
init_my_agent_info();
|
|
143643
146396
|
init_oauth_access_token();
|
|
146397
|
+
init_objects2();
|
|
143644
146398
|
init_poll_task();
|
|
143645
146399
|
init_post_message();
|
|
143646
146400
|
init_prompt_templates();
|
|
@@ -143668,6 +146422,7 @@ var init_server = __esm(() => {
|
|
|
143668
146422
|
init_script_search();
|
|
143669
146423
|
init_script_upsert();
|
|
143670
146424
|
init_send_task();
|
|
146425
|
+
init_sheets();
|
|
143671
146426
|
init_skills();
|
|
143672
146427
|
init_slack_archive_channel();
|
|
143673
146428
|
init_slack_create_channel();
|
|
@@ -143718,7 +146473,8 @@ var init_server = __esm(() => {
|
|
|
143718
146473
|
"agentmail",
|
|
143719
146474
|
"kapso",
|
|
143720
146475
|
"chat-sdk",
|
|
143721
|
-
"swarm-x"
|
|
146476
|
+
"swarm-x",
|
|
146477
|
+
"primitives"
|
|
143722
146478
|
];
|
|
143723
146479
|
DEFAULT_CAPABILITIES = [
|
|
143724
146480
|
"core",
|
|
@@ -143742,4 +146498,4 @@ var init_server = __esm(() => {
|
|
|
143742
146498
|
loggedToolAllowlistWarnings = new Set;
|
|
143743
146499
|
});
|
|
143744
146500
|
|
|
143745
|
-
export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, init_types, McpServer, init_mcp, referencedBundlePaths, skillDirs, init_manifest_format, recoverIncompleteRuns, init_recovery, handleWebhookTrigger, verifyHmacSignature, 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, 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_app, handleJiraWebhook, init_webhook, init_jira, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, init_sync, isLinearEnabled, initLinear, init_app2, 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 };
|
|
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 };
|