@desplega.ai/agent-swarm 2.13.0 → 2.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/acp-adapter-x1qqgzwx.js +17 -0
- package/dist/{acp-targets-86f0sh6g.js → acp-targets-mz8c5dnt.js} +10 -10
- package/dist/{actions-zv8vcxvr.js → actions-5ft3qp5a.js} +27 -27
- package/dist/{agent-fs-provision-jqshb33y.js → agent-fs-provision-6fgz7wvz.js} +4 -4
- package/dist/{amp-adapter-gt503ywc.js → amp-adapter-nthn8ezm.js} +3 -3
- package/dist/{app-6t4k5rh1.js → app-535m78qw.js} +10 -10
- package/dist/{approval-notifications-fcfw063h.js → approval-notifications-dewbk403.js} +11 -11
- package/dist/{assistant-9dzybh12.js → assistant-39zyabv2.js} +28 -28
- package/dist/{boot-args-schema-xzfp2feg.js → boot-args-schema-bqv5bf77.js} +1 -1
- package/dist/{boot-reembed-3jz0p2jk.js → boot-reembed-157c0gcz.js} +1 -1
- package/dist/{boot-reembed-r88wngfg.js → boot-reembed-fas7z3zn.js} +1 -1
- package/dist/{boot-scrub-sweep-scrqhw48.js → boot-scrub-sweep-tmec0be2.js} +2 -2
- package/dist/{boot-seeds-vb2dcrrb.js → boot-seeds-32zm50x2.js} +4 -4
- package/dist/{boxd-68n75y1s.js → boxd-hr8rsxzq.js} +1 -1
- package/dist/{claude-adapter-h3mp9hgs.js → claude-adapter-gwq7x2nj.js} +9 -9
- package/dist/{claude-managed-adapter-kpbyj2vb.js → claude-managed-adapter-rkvw6fvq.js} +4 -4
- package/dist/{claude-managed-setup-0efr3wkg.js → claude-managed-setup-0vgz4d1j.js} +6 -6
- package/dist/{claude-sdk-session-03dw669q.js → claude-sdk-session-5wbwxy8c.js} +20967 -19390
- package/dist/{cli-z64t9pe6.js → cli-0f7n3td3.js} +1 -1
- package/dist/{cli-j53hpbsm.js → cli-0xwb7zpt.js} +2 -2
- package/dist/{cli-wxwv3t11.js → cli-1f48qdnb.js} +55 -13
- package/dist/{cli-gfcv679k.js → cli-1gevjrc1.js} +1 -1
- package/dist/{cli-0jkenasr.js → cli-2v4xxnx2.js} +1 -1
- package/dist/{cli-hc6e4tac.js → cli-2wde56gv.js} +6 -6
- package/dist/{cli-mh7pdxe0.js → cli-31vt7baf.js} +17 -17
- package/dist/{cli-ercwc8xn.js → cli-3mf04tkh.js} +1 -1
- package/dist/{cli-s6zk31gr.js → cli-43dsqhcp.js} +4 -4
- package/dist/{cli-1dbv9mj9.js → cli-4djg31jh.js} +1 -1
- package/dist/{cli-tn91wc6e.js → cli-50whymxq.js} +1 -1
- package/dist/{cli-js10kdk7.js → cli-5basv0e7.js} +19 -5
- package/dist/{cli-b2jh3dyb.js → cli-5k1hvycs.js} +4 -4
- package/dist/{cli-dkejt425.js → cli-62fjschk.js} +7 -7
- package/dist/{cli-zqmmy073.js → cli-69eq6gdk.js} +18 -18
- package/dist/{cli-qm3ntjqs.js → cli-6rmryz03.js} +13 -13
- package/dist/{cli-mz34pxbk.js → cli-7m6bbtab.js} +11 -11
- package/dist/{cli-wv20kbr3.js → cli-8a4qg44m.js} +5 -5
- package/dist/{cli-2m6yaq6b.js → cli-8fj8yfmk.js} +1 -1
- package/dist/{cli-9m9kyw77.js → cli-8qvte9hn.js} +2 -2
- package/dist/{cli-x05p2d05.js → cli-9tevdxyf.js} +1 -1
- package/dist/{cli-qec9bynj.js → cli-a6rzw649.js} +3 -3
- package/dist/{cli-ex1y88j3.js → cli-at67kvnp.js} +1 -1
- package/dist/{cli-yn4kt85g.js → cli-b0kqw55g.js} +1 -1
- package/dist/{cli-n3qe7tyr.js → cli-b0m3bg0f.js} +134 -3
- package/dist/{cli-xfjn2kyq.js → cli-bp2rt28p.js} +9 -9
- package/dist/{cli-2jk4s7z1.js → cli-c9bwawf9.js} +3 -3
- package/dist/{cli-wndegmns.js → cli-cmgdptmx.js} +3 -3
- package/dist/{cli-3p288654.js → cli-cpkxh68d.js} +2 -2
- package/dist/{cli-117g15t4.js → cli-cs26ed89.js} +8 -8
- package/dist/{cli-prf7kz78.js → cli-d0jb2qnt.js} +603 -78
- package/dist/{cli-8hp56wat.js → cli-d2epqm0y.js} +1 -1
- package/dist/{cli-wrhbym01.js → cli-d528acsw.js} +6 -6
- package/dist/{cli-tstj6e8e.js → cli-dnvmwsvc.js} +310 -88
- package/dist/{cli-9fsagra4.js → cli-e87fg3en.js} +1 -1
- package/dist/{cli-jj3c5nyb.js → cli-erh1rgh4.js} +116 -56
- package/dist/{cli-f1952kjy.js → cli-ewb028rs.js} +4 -4
- package/dist/{cli-ct8sz3np.js → cli-f1sdh8ca.js} +6 -6
- package/dist/{cli-0b655smz.js → cli-fcwrd7bh.js} +5 -5
- package/dist/{cli-eb279wn3.js → cli-fgm2mad9.js} +2 -2
- package/dist/{cli-bpje8n65.js → cli-fp65jdp2.js} +31 -6
- package/dist/{cli-dnh64e8e.js → cli-g0b3ma7r.js} +7 -7
- package/dist/{cli-avxh26pd.js → cli-gc7jkf4a.js} +4 -4
- package/dist/{cli-2skf1mdf.js → cli-gedf48yw.js} +4 -4
- package/dist/{cli-ajjvqhf3.js → cli-getrvmtx.js} +27 -6
- package/dist/{cli-c8v2yvej.js → cli-gq6qhmrr.js} +2 -2
- package/dist/{cli-mbwmqb5w.js → cli-h0ewec3d.js} +1 -1
- package/dist/{cli-tdk7jtka.js → cli-hv3820ez.js} +1 -1
- package/dist/{cli-avqkr20b.js → cli-j2ybkdk2.js} +2 -2
- package/dist/{cli-pqfecppn.js → cli-je587f74.js} +1 -1
- package/dist/{cli-hgsxnjyg.js → cli-jkkcm72j.js} +13 -13
- package/dist/{cli-g6j6ac3h.js → cli-ka13xx6b.js} +2 -2
- package/dist/{cli-t35hx078.js → cli-m1wddksc.js} +2 -2
- package/dist/{cli-50w82h6m.js → cli-mwxez0pz.js} +1 -0
- package/dist/{cli-nc6a8b5b.js → cli-n14r8h4n.js} +2 -2
- package/dist/{cli-y4a4458j.js → cli-n46d87mj.js} +3 -3
- package/dist/{cli-0dg7ytxm.js → cli-nkfv398a.js} +1096 -75
- package/dist/{cli-fhvk2nvp.js → cli-nvqq3232.js} +9 -9
- package/dist/{cli-bhgrhedp.js → cli-q8aq48v1.js} +1 -1
- package/dist/{cli-6a40p4kv.js → cli-qn79645p.js} +1 -1
- package/dist/{cli-hbq0kwxz.js → cli-r4fphq38.js} +4 -4
- package/dist/{cli-47hz21se.js → cli-r8ddn0hf.js} +4 -5
- package/dist/{cli-hpb9x72z.js → cli-rvhaahfv.js} +9 -9
- package/dist/{cli-qhhb30e8.js → cli-s08zsqva.js} +9 -9
- package/dist/{cli-sdh61g52.js → cli-s6fhqbz1.js} +2 -2
- package/dist/{cli-y518qkjg.js → cli-sjk85d7v.js} +13 -12
- package/dist/{cli-ytc7fpza.js → cli-t25rq8mg.js} +4 -4
- package/dist/{cli-sq913bh1.js → cli-t9nxq30h.js} +8 -8
- package/dist/{cli-49f5jyhh.js → cli-tbdw3f92.js} +3 -3
- package/dist/{cli-1v82d2w6.js → cli-tceqvv6h.js} +4 -4
- package/dist/{cli-fz9pcjsw.js → cli-tgmate57.js} +4 -4
- package/dist/{cli-rtmqzat7.js → cli-vdfngx2g.js} +2 -2
- package/dist/{cli-9w8712tq.js → cli-vr4eyq6p.js} +43 -14
- package/dist/{cli-z4f346g5.js → cli-vx9acp12.js} +1 -1
- package/dist/{cli-7dbhnsj9.js → cli-wdtqkqnq.js} +4 -4
- package/dist/{cli-kde4ky90.js → cli-x5yb8zc8.js} +2 -2
- package/dist/{cli-w14j2z4k.js → cli-x7aqhxj5.js} +2 -2
- package/dist/{cli-kspxjftk.js → cli-xerdrnqs.js} +15 -6
- package/dist/{cli-48nvk6sb.js → cli-xhkek467.js} +2 -2
- package/dist/{cli-dka73bak.js → cli-xysy1g8x.js} +152 -12
- package/dist/{cli-7wy8gbwb.js → cli-ya1cj689.js} +1 -1
- package/dist/{cli-n85m2wkq.js → cli-zkbz8m2q.js} +3 -2
- package/dist/{cli-0pazkmd4.js → cli-zm6bkx3e.js} +4 -4
- package/dist/{cli-6h88mn9q.js → cli-zqy28rwx.js} +4 -4
- package/dist/cli.js +30 -29
- package/dist/{codex-adapter-f3yp0kaj.js → codex-adapter-x25xfbnh.js} +8 -8
- package/dist/{codex-hook-262cekfp.js → codex-hook-c0nvm30r.js} +2 -2
- package/dist/{codex-login-1ven7yje.js → codex-login-ven5cz5j.js} +1 -1
- package/dist/{codex-session-runner-ns4mv70p.js → codex-session-runner-kn5xnrvp.js} +9 -9
- package/dist/{commands-5bzf2tfw.js → commands-8n59gxmy.js} +3 -3
- package/dist/{controller-5xt7kvfm.js → controller-wn3vd217.js} +3 -3
- package/dist/{controllers-connect-0gg13mzp.js → controllers-connect-09gvkrhc.js} +28 -28
- package/dist/core-2b8bv6ny.js +42 -0
- package/dist/{cursor-adapter-p0c5zv6r.js → cursor-adapter-w1681kp1.js} +2 -2
- package/dist/{db-2s68ycq7.js → db-e71keqxk.js} +3 -3
- package/dist/{db-q7q639k5.js → db-spg81qtr.js} +2 -2
- package/dist/{devin-adapter-t8d86q9x.js → devin-adapter-fs90ab4v.js} +1 -1
- package/dist/{dispatcher-j2y1q7ae.js → dispatcher-fr4vawwb.js} +25 -25
- package/dist/{docker-1b41eysj.js → docker-1h33jvh9.js} +2 -2
- package/dist/{dsh-adapter-pgnkf4st.js → dsh-adapter-g9yqv09y.js} +2 -2
- package/dist/{e2b-xm60c8ad.js → e2b-jnk0yeva.js} +2 -2
- package/dist/{e2b-ew8c5j5v.js → e2b-y7e5kmzf.js} +2 -2
- package/dist/{easter-egg-3d-0kea97jf.js → easter-egg-3d-ac9tv9a6.js} +1 -1
- package/dist/{embedding-space-3n6mhhmy.js → embedding-space-an77f45k.js} +6 -6
- package/dist/{embeddings-jfmj6yme.js → embeddings-jkrehejr.js} +1 -1
- package/dist/{event-bus-v4ywhc2p.js → event-bus-08t2b4y2.js} +1 -1
- package/dist/{execute-tjrej979.js → execute-3mys4nta.js} +1 -1
- package/dist/{external-channel-jy8w2gg3.js → external-channel-s6zxpts9.js} +2 -2
- package/dist/fx-adapter-4yet1c4f.js +20 -0
- package/dist/grok-adapter-8ge6tw7m.js +20 -0
- package/dist/handlers-0r9evrdj.js +41 -0
- package/dist/heartbeat-jjpb44e5.js +50 -0
- package/dist/{hook-fv1jwrv7.js → hook-68gbs87k.js} +6 -6
- package/dist/{hook-bpnncsec.js → hook-y6n23zzj.js} +8 -8
- package/dist/{http-bpa26czn.js → http-8c6y008s.js} +404 -146
- package/dist/{index-w216g9y9.js → index-0vthtbc2.js} +38 -22
- package/dist/index-1v23363p.js +39 -0
- package/dist/index-30qw6vyw.js +44 -0
- package/dist/index-6bm3w6cn.js +40 -0
- package/dist/{index-s8re7mvq.js → index-6h3r0vpe.js} +1 -1
- package/dist/{index-620y7jzq.js → index-7dgxveck.js} +3 -3
- package/dist/{index-4k7m5dgj.js → index-maddg9ys.js} +143 -103
- package/dist/{index-0h6qd4p1.js → index-mbpxhc4w.js} +3 -4
- package/dist/index-rz8ve510.js +569 -0
- package/dist/{index-mpj0z9e0.js → index-we3nd2t0.js} +1 -1
- package/dist/{index-pe3d8jfy.js → index-whysn1wf.js} +1 -1
- package/dist/{index-52tgbhrw.js → index-xcw7hjt5.js} +28 -28
- package/dist/{index-8p0j4h4j.js → index-ym9fgxad.js} +94 -89
- package/dist/{k8s-fy8hbhkg.js → k8s-8326q0rq.js} +2 -2
- package/dist/{keepalive-d6z12s04.js → keepalive-7e9r5dvp.js} +5 -4
- package/dist/lead-3jpc7kcr.js +79 -0
- package/dist/{maintenance-7kac6g2g.js → maintenance-d3erjvcg.js} +1 -1
- package/dist/{oauth-refresh-sweep-t1xjetbh.js → oauth-refresh-sweep-0qh70988.js} +4 -3
- package/dist/{object-webhooks-6rdagg0r.js → object-webhooks-ac7v2q5p.js} +7 -7
- package/dist/{onboard-32y1cfxy.js → onboard-5yphtken.js} +4 -4
- package/dist/{opencode-adapter-enp3v31n.js → opencode-adapter-0xvyba4m.js} +8 -8
- package/dist/{otel-impl-k0tm5ptj.js → otel-impl-svqp691q.js} +2 -2
- package/dist/{pending-24zebgvs.js → pending-bn4xe5br.js} +26 -26
- package/dist/{pi-mono-adapter-yj72xxxe.js → pi-mono-adapter-763s8a3w.js} +20 -18
- package/dist/{pricing-refresh-cf25x38j.js → pricing-refresh-kfc215mf.js} +2 -2
- package/dist/{rbac-roles-0wydd22m.js → rbac-roles-3bznvkpt.js} +3 -3
- package/dist/{rbac-roles-at6crb3r.js → rbac-roles-6r4h2ghj.js} +2 -2
- package/dist/{render-v2-nvcw0jd7.js → render-v2-f3qedbpy.js} +10 -10
- package/dist/{resume-y4w0k5v3.js → resume-vcag4ann.js} +13 -13
- package/dist/{runtime-vpe43hx0.js → runtime-x0s55z2t.js} +1 -1
- package/dist/{session-access-gkyvnfye.js → session-access-nwzve8q2.js} +5 -5
- package/dist/{session-source-backfill-3w2st4m2.js → session-source-backfill-jpqfzmgz.js} +2 -2
- package/dist/{setup-axxvqtys.js → setup-d2smwaem.js} +1 -1
- package/dist/thread-buffer-8fc703jc.js +42 -0
- package/dist/{tree-visibility-y4fqvab5.js → tree-visibility-dwzc8en0.js} +2 -2
- package/dist/{user-merge-jobs-kcmwvrc6.js → user-merge-jobs-4ce7kma2.js} +3 -3
- package/dist/{virtual-modules-7d92dct1.js → virtual-modules-78a6yw71.js} +3 -3
- package/dist/{work-objects-f708e069.js → work-objects-m0w1e7q8.js} +28 -28
- package/dist/worker-3p2vq107.js +79 -0
- package/dist/{worker-follow-up-0by8wztc.js → worker-follow-up-e3t6f895.js} +25 -25
- package/dist/{x-3dtaf2r9.js → x-asbrnafg.js} +2 -2
- package/openapi.json +1795 -1623
- package/package.json +13 -12
- package/src/apps/catalog.generated.json +726 -0
- package/src/apps/definition.ts +24 -7
- package/src/apps/page-validator.ts +225 -3
- package/src/be/db.ts +38 -10
- package/src/be/mcp-proxy.ts +5 -4
- package/src/be/migrations/340_api_key_spend_cap.sql +5 -0
- package/src/be/migrations/341_user_token_expiry.sql +4 -0
- package/src/be/schedules/validate.ts +26 -0
- package/src/be/scripts/run-credential.ts +55 -1
- package/src/be/scripts/typecheck.ts +4 -4
- package/src/be/scripts/user-code-mode.ts +160 -0
- package/src/be/swarm-config-guard.ts +4 -0
- package/src/be/users.ts +48 -7
- package/src/commands/credential-outcome-report.ts +5 -2
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/provider-credentials.ts +19 -0
- package/src/commands/provider-error-class.ts +4 -1
- package/src/commands/rate-limit-outcome.ts +48 -3
- package/src/commands/runner.ts +113 -55
- package/src/commands/worktree-reaper.ts +600 -0
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/http/agents.ts +4 -0
- package/src/http/api-keys.ts +27 -3
- package/src/http/pages-public.ts +40 -4
- package/src/http/pool-keys.ts +21 -2
- package/src/http/schedules.ts +28 -3
- package/src/http/script-connection-proxy.ts +18 -6
- package/src/http/script-connections.ts +12 -4
- package/src/http/script-runs.ts +12 -3
- package/src/http/scripts.ts +2 -11
- package/src/http/tasks.ts +6 -10
- package/src/http/users.ts +1 -0
- package/src/integrations/chat-sdk/adapters.ts +29 -0
- package/src/integrations/chat-sdk/limits.ts +3 -0
- package/src/integrations/chat-sdk/rocketchat/README.md +8 -0
- package/src/integrations/chat-sdk/rocketchat/index.ts +790 -0
- package/src/integrations/chat-sdk/rocketchat/markdown.ts +210 -0
- package/src/integrations/chat-sdk/rocketchat/types.ts +249 -0
- package/src/integrations/chat-sdk/runtime.ts +11 -5
- package/src/integrations/chat-sdk/schema.ts +37 -3
- package/src/integrations/chat-sdk/status.ts +9 -0
- package/src/mcp-client/http-client.ts +3 -1
- package/src/oauth/identity-capture.ts +6 -1
- package/src/oauth/mcp-wrapper.ts +10 -3
- package/src/oauth/wrapper.ts +15 -3
- package/src/prompts/session-templates.ts +1 -0
- package/src/providers/acp-targets.ts +2 -2
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/providers/pi-mono-adapter.ts +4 -2
- package/src/providers/runtime-dependencies.ts +1 -1
- package/src/rbac/legacy-policy.ts +3 -0
- package/src/rbac/permissions.ts +9 -0
- package/src/scripts-runtime/executors/native.ts +225 -67
- package/src/scripts-runtime/mcp-client.ts +2 -1
- package/src/scripts-runtime/swarm-sdk.ts +2 -1
- package/src/scripts-runtime/types/stdlib.d.ts +4 -4
- package/src/scripts-runtime/types/swarm-extension.d.ts +7 -7
- package/src/scripts-runtime/types/swarm-sdk.d.ts +4 -4
- package/src/server-user.ts +98 -0
- package/src/slack/enrich.ts +14 -11
- package/src/tests/agents-list-model-display.test.ts +23 -0
- package/src/tests/apps-spike2.test.ts +35 -0
- package/src/tests/base-prompt.test.ts +1 -0
- package/src/tests/chat-sdk-rocketchat-vendored.test.ts +67 -0
- package/src/tests/chat-sdk-status-route.test.ts +13 -1
- package/src/tests/codex-app-server.test.ts +4 -6
- package/src/tests/deploy-guard.test.ts +24 -0
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/ensure-token.test.ts +2 -2
- package/src/tests/entrypoint-repo-autoclone-args.test.ts +202 -0
- package/src/tests/fake-dns.ts +47 -0
- package/src/tests/fixtures/base-prompt-baseline.json +12 -12
- package/src/tests/latest-model-report.test.ts +138 -0
- package/src/tests/mcp-oauth-dcr-reuse.test.ts +5 -2
- package/src/tests/mcp-oauth-ensure-token.test.ts +3 -2
- package/src/tests/mcp-oauth-manual-client.test.ts +6 -1
- package/src/tests/mcp-oauth-wrapper.test.ts +20 -4
- package/src/tests/mcp-outbound-fetch-guard.test.ts +169 -0
- package/src/tests/mcp-server-ssrf.test.ts +2 -0
- package/src/tests/mcp-user-route.test.ts +10 -1
- package/src/tests/memory-search-stall.test.ts +5 -0
- package/src/tests/oauth-connection-fetch-guard.test.ts +162 -0
- package/src/tests/oauth-token-endpoint-fetch-guard.test.ts +121 -0
- package/src/tests/oauth-wrapper.test.ts +1 -2
- package/src/tests/pages-head-v2.test.ts +2 -1
- package/src/tests/script-connections-http.test.ts +8 -3
- package/src/tests/script-connections-mcp.test.ts +14 -10
- package/src/tests/script-connections-sql.test.ts +6 -2
- package/src/tests/script-connections.test.ts +4 -0
- package/src/tests/slack-thread-participants.test.ts +14 -3
- package/src/tests/spend-cap-credentials.test.ts +34 -0
- package/src/tests/spend-cap-outcome.test.ts +67 -0
- package/src/tests/subscription-first.test.ts +119 -0
- package/src/tests/worktree-reaper.test.ts +424 -0
- package/src/tools/get-task-details.ts +247 -5
- package/src/tools/schedules/patch-schedule.ts +26 -1
- package/src/tools/schedules/update-schedule.ts +28 -2
- package/src/tools/script-common.ts +37 -22
- package/src/tools/script-query-types.ts +1 -1
- package/src/tools/script-run.ts +1 -1
- package/src/tools/script-search.ts +12 -10
- package/src/tools/utils.ts +7 -1
- package/src/utils/credentials.ts +36 -1
- package/src/utils/egress-guard.ts +40 -10
- package/src/utils/error-tracker.ts +17 -0
- package/templates/skills/apps/SKILL.md +191 -2
- package/templates/skills/apps/content.md +191 -2
- package/templates/skills/boards-and-sheets/content.md +11 -0
- package/templates/skills/chat-sdk/content.md +2 -2
- package/templates/skills/pages/content.md +11 -0
- package/templates/skills/swarm-docs/content.md +4 -0
- package/templates/skills/swarm-scripts/SKILL.md +1 -0
- package/templates/skills/swarm-scripts/content.md +1 -0
- package/templates/workflows/ralph-loop/content.md +6 -6
- package/dist/acp-adapter-cn53011z.js +0 -17
- package/dist/cli-pr0eze3x.js +0 -149
- package/dist/core-0fqtbrxa.js +0 -42
- package/dist/fx-adapter-k6w3jvz9.js +0 -20
- package/dist/grok-adapter-4q5tssw0.js +0 -20
- package/dist/handlers-qxgfvvsf.js +0 -41
- package/dist/heartbeat-6tr2w2da.js +0 -50
- package/dist/index-0mcxjdsa.js +0 -44
- package/dist/index-dz4q23ag.js +0 -40
- package/dist/index-s175jckx.js +0 -39
- package/dist/lead-p3hx7h35.js +0 -79
- package/dist/thread-buffer-rwa7d4dx.js +0 -42
- package/dist/worker-8rg9gz74.js +0 -79
- /package/dist/{cli-m4ejz4nj.js → cli-cah298e5.js} +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { lookup } from "node:dns/promises";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Outbound-request guard shared by the OAuth/MCP fetchers
|
|
5
|
-
*
|
|
4
|
+
* Outbound-request guard shared by the OAuth/MCP fetchers and the quickjs
|
|
5
|
+
* script executor.
|
|
6
6
|
*
|
|
7
|
-
* `assertUrlSafe` checks the URL string only. `
|
|
8
|
-
*
|
|
9
|
-
* it re-checks
|
|
7
|
+
* `assertUrlSafe` checks the URL string only. `createGuardedFetch` (and
|
|
8
|
+
* `createSsrfGuardedFetch` on top of it) also resolves the hostname, so a
|
|
9
|
+
* public name that points at a private address is refused, and it re-checks
|
|
10
|
+
* every redirect hop.
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
// ─── Address classification ──────────────────────────────────────────────────
|
|
@@ -174,7 +175,7 @@ export interface SsrfGuardOptions {
|
|
|
174
175
|
* allowed), and loopback/private/link-local hosts (unless allowed). Checks the
|
|
175
176
|
* string only: the WHATWG parser normalizes decimal, octal and hex IPv4 forms
|
|
176
177
|
* first, but a public name that resolves to a private address passes. Use
|
|
177
|
-
* `
|
|
178
|
+
* `createSsrfGuardedFetch` where that matters.
|
|
178
179
|
*/
|
|
179
180
|
export function assertUrlSafe(rawUrl: string, opts: SsrfGuardOptions = {}): URL {
|
|
180
181
|
let parsed: URL;
|
|
@@ -231,6 +232,10 @@ export type GuardedFetchOptions = {
|
|
|
231
232
|
resolve?: (hostname: string) => Promise<string[]>;
|
|
232
233
|
/** A destination the host itself is calling (for example the swarm API). Skips the policy. */
|
|
233
234
|
isTrusted?: (url: URL) => boolean;
|
|
235
|
+
/** Extra check run on every hop before the policy; throw to refuse the hop. */
|
|
236
|
+
checkUrl?: (url: URL) => void;
|
|
237
|
+
/** Prefix of refusal messages. Without it, messages name the script egress settings. */
|
|
238
|
+
label?: string;
|
|
234
239
|
};
|
|
235
240
|
|
|
236
241
|
export class EgressDeniedError extends Error {
|
|
@@ -317,12 +322,14 @@ export async function assertEgressAllowed(
|
|
|
317
322
|
url: URL,
|
|
318
323
|
options: GuardedFetchOptions,
|
|
319
324
|
): Promise<string | null> {
|
|
325
|
+
options.checkUrl?.(url);
|
|
320
326
|
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
321
327
|
// data:/blob: never leave the process.
|
|
322
328
|
if (url.protocol === "data:" || url.protocol === "blob:") return null;
|
|
323
329
|
throw new EgressDeniedError(`Script egress refused: unsupported protocol ${url.protocol}`);
|
|
324
330
|
}
|
|
325
331
|
if (options.isTrusted?.(url)) return null;
|
|
332
|
+
const label = options.label ?? "Script egress refused";
|
|
326
333
|
|
|
327
334
|
const { policy } = options;
|
|
328
335
|
if (policy.allowlist && policy.allowlist.length > 0) {
|
|
@@ -336,7 +343,7 @@ export async function assertEgressAllowed(
|
|
|
336
343
|
const host = stripBrackets(url.hostname);
|
|
337
344
|
const denied = () =>
|
|
338
345
|
new EgressDeniedError(
|
|
339
|
-
|
|
346
|
+
`${label}: ${url.host} is a private or loopback address.${options.label ? "" : " Add it to SCRIPT_EGRESS_ALLOWLIST or set SCRIPT_EGRESS_ALLOW_PRIVATE=true"}`,
|
|
340
347
|
);
|
|
341
348
|
if (isLoopbackName(host)) throw denied();
|
|
342
349
|
if (isIPv4Literal(host) || isIPv6Literal(host)) {
|
|
@@ -348,11 +355,11 @@ export async function assertEgressAllowed(
|
|
|
348
355
|
addresses = await (options.resolve ?? defaultResolve)(host);
|
|
349
356
|
} catch (error) {
|
|
350
357
|
throw new EgressDeniedError(
|
|
351
|
-
|
|
358
|
+
`${label}: could not resolve ${host} (${error instanceof Error ? error.message : String(error)})`,
|
|
352
359
|
);
|
|
353
360
|
}
|
|
354
361
|
if (addresses.length === 0) {
|
|
355
|
-
throw new EgressDeniedError(
|
|
362
|
+
throw new EgressDeniedError(`${label}: ${host} resolved to no address`);
|
|
356
363
|
}
|
|
357
364
|
// Deny when ANY answer is private: a mixed answer set is a rebinding setup.
|
|
358
365
|
if (addresses.some(isPrivateAddress)) throw denied();
|
|
@@ -522,7 +529,9 @@ export function createGuardedFetch(
|
|
|
522
529
|
if (mode === "error")
|
|
523
530
|
throw new TypeError(`fetch redirect refused (redirect: "error"): ${url.href}`);
|
|
524
531
|
if (hop >= MAX_REDIRECTS) {
|
|
525
|
-
throw new EgressDeniedError(
|
|
532
|
+
throw new EgressDeniedError(
|
|
533
|
+
`${options.label ?? "Script egress refused"}: more than ${MAX_REDIRECTS} redirects`,
|
|
534
|
+
);
|
|
526
535
|
}
|
|
527
536
|
await response.body?.cancel().catch(() => {});
|
|
528
537
|
const next = new URL(location, url);
|
|
@@ -539,6 +548,27 @@ export function createGuardedFetch(
|
|
|
539
548
|
return Object.assign(guarded, { preconnect: baseFetch.preconnect }) as typeof fetch;
|
|
540
549
|
}
|
|
541
550
|
|
|
551
|
+
/**
|
|
552
|
+
* A fetch for API-side calls to user-supplied URLs (MCP OAuth discovery and
|
|
553
|
+
* token endpoints, external MCP servers). Every hop passes `assertUrlSafe`
|
|
554
|
+
* with `opts`; unless `opts.allowPrivateHosts`, a hostname must resolve only
|
|
555
|
+
* to public addresses and the request connects to the checked address.
|
|
556
|
+
* Redirects are followed manually and re-checked.
|
|
557
|
+
*/
|
|
558
|
+
export function createSsrfGuardedFetch(
|
|
559
|
+
opts: SsrfGuardOptions,
|
|
560
|
+
// Late-bound so a replaced globalThis.fetch (tests) is honoured.
|
|
561
|
+
baseFetch: typeof fetch = ((input, init) => fetch(input, init)) as typeof fetch,
|
|
562
|
+
): typeof fetch {
|
|
563
|
+
return createGuardedFetch(baseFetch, {
|
|
564
|
+
policy: { allowPrivate: opts.allowPrivateHosts === true, allowlist: null },
|
|
565
|
+
checkUrl: (url) => {
|
|
566
|
+
assertUrlSafe(url.href, opts);
|
|
567
|
+
},
|
|
568
|
+
label: "Outbound request refused",
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
|
|
542
572
|
/** Parses the comma-separated `SCRIPT_EGRESS_ALLOWLIST` value. Empty = null. */
|
|
543
573
|
export function parseEgressAllowlist(value: string | undefined): string[] | null {
|
|
544
574
|
const entries = (value ?? "")
|
|
@@ -38,6 +38,17 @@ export interface RateLimitWindowInfo {
|
|
|
38
38
|
|
|
39
39
|
export type RateLimitWindowTelemetry = Record<string, RateLimitWindowInfo>;
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* A key that hit its provider spend limit (OpenRouter key limit or credits).
|
|
43
|
+
* `resetsAt` is null when the provider names no reset: the key stays benched
|
|
44
|
+
* until someone edits it.
|
|
45
|
+
*/
|
|
46
|
+
export interface SpendCap {
|
|
47
|
+
limitUsd: number | null;
|
|
48
|
+
spendUsd: number | null;
|
|
49
|
+
resetsAt: string | null;
|
|
50
|
+
}
|
|
51
|
+
|
|
41
52
|
/**
|
|
42
53
|
* Parses a rate_limit_event into one window entry per key of `unifiedWindows`
|
|
43
54
|
* (when present) merged with the top-level entry when they share a key. The
|
|
@@ -168,6 +179,12 @@ export function redactRateLimitEventLine(line: string): string {
|
|
|
168
179
|
*/
|
|
169
180
|
export const MAX_RATE_LIMIT_RESET_MS = 7 * 24 * 60 * 60 * 1000;
|
|
170
181
|
|
|
182
|
+
/**
|
|
183
|
+
* Longest a spend-capped key stays benched: a monthly key limit resets up to
|
|
184
|
+
* 31 days out, and a cap with no reset holds this long unless the key is edited.
|
|
185
|
+
*/
|
|
186
|
+
export const MAX_SPEND_CAP_HOLD_MS = 31 * 24 * 60 * 60 * 1000;
|
|
187
|
+
|
|
171
188
|
/**
|
|
172
189
|
* Single source of truth for "does this text look like a rate-limit signal?".
|
|
173
190
|
* Shared by the runner's cooldown gate and {@link parseStderrForErrors} so the
|
|
@@ -531,9 +531,9 @@ The sidebar lists pages in definition order and marks the current one. Below 768
|
|
|
531
531
|
|
|
532
532
|
Param `kind` is `string` by default, or `number` / `boolean`; `required` defaults to false. The names `mode`, `apiUrl`, `apiKey`, `email`, and `name` are reserved. `/apps/<id>` renders `defaultPage`; `/apps/<id>/p/<page>?issueId=42` is the shareable deep link for another page. Browser navigation is client-side, so app state and polled data stay warm across page changes.
|
|
533
533
|
|
|
534
|
-
Within each page, `root` names one entry in its non-empty `elements` map. Elements are a flat, single-parent tree: ids are map keys, `children` contains ids (not nested elements), all elements must be reachable from `root`, and cycles, missing children, or shared children are invalid. Element and Form/UI ids are page-local. Element keys are `type`, `props`, `children`, `on`, `visible`, `repeat`, and `watch`; only components with a `default` child slot accept `children` (Stack, Grid, Split, Tabs, Accordion, Container, Card, Section, Drawer, and
|
|
534
|
+
Within each page, `root` names one entry in its non-empty `elements` map. Elements are a flat, single-parent tree: ids are map keys, `children` contains ids (not nested elements), all elements must be reachable from `root`, and cycles, missing children, or shared children are invalid. Element and Form/UI ids are page-local. Element keys are `type`, `props`, `children`, `on`, `visible`, `repeat`, and `watch`; only components with a `default` child slot accept `children` (Stack, Grid, Split, Tabs, Accordion, Container, Card, Section, Drawer, Dialog, and Svg). `watch` maps state paths to an action step or chain. A page may also declare `state`: page-local values read and written at `/local/<name>` (see Low-level primitives).
|
|
535
535
|
|
|
536
|
-
## Component catalog (all
|
|
536
|
+
## Component catalog (all 52)
|
|
537
537
|
|
|
538
538
|
Props reject unknown keys. A `{"$state":"..."}` binding may replace a literal prop value at any depth.
|
|
539
539
|
|
|
@@ -590,6 +590,13 @@ Tones: Badge, Metric and Progress `tone` take `neutral`, `success`, `active`, `e
|
|
|
590
590
|
| `Approval` | `requestId` | `showResolved` (default true), `compact`, `onResolved`; one approval request answered in place by the viewer; see below. |
|
|
591
591
|
| `SessionThread` | `id`, `sessionKey` | `scope`, `placeholder`, `onDispatch`, `fill`; the dashboard's session conversation (the "Session about this page" panel) for one session per viewer and key, with a composer that steers or chains tasks; the draft is mirrored to `/ui/<id>/value`; see below. |
|
|
592
592
|
| `PageFrame` | `pageId` | `device` (`desktop` default, or `mobile`: a 390 px wide frame), `height` (default `640px`), `fill`; a live, clickable swarm Page that reloads when the page changes; see below. |
|
|
593
|
+
| `Input` | none | Low-level text field: `value` (bind two-way with `$bindState` / `$bindItem`), `id` (the `ui.focus` target), `label`, `placeholder`, `type: "text"` or `"password"`, `inputMode`, `autoComplete: "off"` or `"one-time-code"`, `maxLength`, `size: "default"` or `"cell"` (square one-character box), `selectOnFocus`, `disabled`; chains `onInput`, `onPaste`, `onKeyDown:<Key>`; see Low-level primitives. |
|
|
594
|
+
| `Svg` | `width`, `height` on the outer Svg | Vector drawing in `width` x `height` user units, scaled to its container; `label` (accessible name). Children: `Rect`, `Line`, `Path`, `Circle`, `SvgText`, or a nested `Svg` (a group offset by `x`/`y`, the place for `repeat`). |
|
|
595
|
+
| `Rect` | `x`, `y`, `width`, `height` | `rx`, `fill`, `stroke`, `strokeWidth`, `opacity`, `title` (tooltip); only inside an Svg. |
|
|
596
|
+
| `Line` | `x1`, `y1`, `x2`, `y2` | `stroke`, `strokeWidth`, `opacity`, `dashed`; only inside an Svg. |
|
|
597
|
+
| `Path` | `d` | `fill`, `stroke`, `strokeWidth`, `opacity`; `d` holds path commands and numbers only; only inside an Svg. |
|
|
598
|
+
| `Circle` | `cx`, `cy`, `r` | `fill`, `stroke`, `strokeWidth`, `opacity`, `title`; only inside an Svg. |
|
|
599
|
+
| `SvgText` | `x`, `y`, `text` | `anchor: "start", "middle", "end"`, `size`, `weight: "normal"` or `"bold"`, `fill`; only inside an Svg. |
|
|
593
600
|
|
|
594
601
|
Table details:
|
|
595
602
|
|
|
@@ -858,6 +865,7 @@ Valid `$state` roots are:
|
|
|
858
865
|
- `/actions/<declaredAction>/...`
|
|
859
866
|
- `/route/page` for the active page name
|
|
860
867
|
- `/route/params/<declaredParam>` for a param declared on the current page
|
|
868
|
+
- `/local/<name>/...`, where the current page declares `<name>` in its `state`
|
|
861
869
|
|
|
862
870
|
`/route` is mirrored as `{ page, params }`. Only declared params appear. Values are coerced by their declared kind: `number` becomes a number when possible; boolean strings `true`/`1` become true; failed number coercion remains the raw string.
|
|
863
871
|
|
|
@@ -898,6 +906,178 @@ The `studio` page's `SessionThread` with `"sessionKey": { "$state": "/route/para
|
|
|
898
906
|
|
|
899
907
|
A failed step halts its chain: when `app.action`, `app.mutate`, `swarm.sdk` or `swarm.call` fails (a thrown error, a script action that returns `ok: false`, a non-2xx `swarm.call`), the steps after it do not run and the error shows as an error toast. A step's `onError` (`{ set }` or `{ action }`) runs first, and the chain still halts. So a `ui.toast` after a write is a real success message. A `Form`'s failed `app.mutate` shows inline under the fields instead of a toast. A task-backed `app.action` succeeds once the task is created; the task's own failure shows in the page banner and does not halt the chain. A Table bulk action reads each step's own outcome, as before.
|
|
900
908
|
|
|
909
|
+
## Low-level primitives
|
|
910
|
+
|
|
911
|
+
Compose custom widgets (a code input, a timeline, a Gantt chart) from page-local state, a bindable `Input`, three `ui.*` steps, expressions, and `Svg` shapes. No custom component needed.
|
|
912
|
+
|
|
913
|
+
**Page state.** `pages.<page>.state` maps names to initial JSON values. The page reads them at `{ "$state": "/local/<name>/..." }` and only this root is writable. Each page has its own `/local`, even when two pages declare the same name. The values are seeded on first render and survive navigation; patching `pages.<page>.state.<name>` replaces that entry. Reusable elements cannot read or write `/local`.
|
|
914
|
+
|
|
915
|
+
**Input.** `value: { "$bindState": "/local/<name>/..." }` binds two-way; inside a `repeat` over a `/local` list, `{ "$bindItem": "" }` binds the item itself (`"field"` binds a field of it). `$bindState` and `$bindItem` are valid only on `Input.value`. Event chains are props, run by the Input:
|
|
916
|
+
|
|
917
|
+
- `onInput`: after every edit; `{ "$chain": "value" }` is the new text.
|
|
918
|
+
- `onPaste`: instead of the browser paste; `{ "$chain": "text" }` is the clipboard text.
|
|
919
|
+
- `onKeyDown:<Key>`: instead of that key's default. Keys: `Backspace`, `Delete`, `Enter`, `Escape`, `Tab`, `ArrowLeft`, `ArrowRight`, `ArrowUp`, `ArrowDown`, `Home`, `End`.
|
|
920
|
+
|
|
921
|
+
`$state` reads inside these chains resolve at render time. To read the newest value, use `$chain`, or put the chain in a `watch`. A state write inside a `watch` chain re-runs the watch and cancels the steps after it, so make `ui.set` the last step there.
|
|
922
|
+
|
|
923
|
+
**Steps.**
|
|
924
|
+
|
|
925
|
+
- `ui.set`: `{ path, value }` writes `value` to a `/local/...` path. A literal path must name declared state; `path` may be an expression, e.g. `{ "$join": [["/local/otp", { "$index": true }], "/"] }`.
|
|
926
|
+
- `ui.focus`: `{ id, index? }` focuses the `Input` with that literal `id` on this page. Inside a `repeat`, `index` picks the item. A missing target is a no-op.
|
|
927
|
+
- `ui.when`: `{ value, eq? }` continues the chain only when `value` equals `eq` (or is truthy without `eq`); otherwise the rest of the chain is skipped quietly.
|
|
928
|
+
|
|
929
|
+
**Expressions.** An object with one operator key and an operand array, valid in any prop or action param. Operands are literals or bindings (`$state`, `$item`, `$index`, `$chain`, another expression):
|
|
930
|
+
|
|
931
|
+
| Operator | Operands | Result |
|
|
932
|
+
|---|---|---|
|
|
933
|
+
| `$add`, `$mul`, `$min`, `$max` | 1 or more numbers | sum, product, minimum, maximum |
|
|
934
|
+
| `$sub`, `$div` | exactly 2 numbers | difference, quotient |
|
|
935
|
+
| `$split` | text, separator (default `""`), optional limit | array of strings |
|
|
936
|
+
| `$join` | array, separator (default `""`) | text |
|
|
937
|
+
| `$length` | 1 value | length of a text or array (`0` for null) |
|
|
938
|
+
|
|
939
|
+
A non-numeric operand, or a division by zero, yields no value and the attribute is left out.
|
|
940
|
+
|
|
941
|
+
**Svg.** `Svg` draws in `width` x `height` user units. Shape attributes (`x`, `y`, `width`, `height`, `x1`..`y2`, `cx`, `cy`, `r`, `d`) accept expressions, so a bar is `x = 100 + (start - min) * scale`. A nested `Svg` is a group: put `repeat` on it to draw its shapes once per item. Colors are palette tokens (`chart-1`..`chart-5`, `primary`, `success`, `warning`, `error`, `info`, `muted`, `foreground`, `background`, `border`, `none`). The validator rejects unknown attributes, raw colors, a `Path.d` with anything but path commands and numbers, shapes outside an Svg, and non-shape Svg children.
|
|
942
|
+
|
|
943
|
+
### Example: 6-cell code input
|
|
944
|
+
|
|
945
|
+
Typing advances to the next cell, Backspace clears the cell and moves back, pasting a 6-character code fills every cell, and the `watch` submits once all 6 are filled. Replace the `ui.toast` step with an `app.action` to verify the code server-side.
|
|
946
|
+
|
|
947
|
+
```json
|
|
948
|
+
{
|
|
949
|
+
"models": {},
|
|
950
|
+
"defaultPage": "verify",
|
|
951
|
+
"pages": {
|
|
952
|
+
"verify": {
|
|
953
|
+
"title": "Verify",
|
|
954
|
+
"state": { "otp": ["", "", "", "", "", ""], "code": "" },
|
|
955
|
+
"root": "root",
|
|
956
|
+
"elements": {
|
|
957
|
+
"root": {
|
|
958
|
+
"type": "Stack",
|
|
959
|
+
"props": { "gap": "md", "padding": "md" },
|
|
960
|
+
"children": ["heading", "cells", "submitted"],
|
|
961
|
+
"watch": {
|
|
962
|
+
"/local/otp": [
|
|
963
|
+
{ "action": "ui.when", "params": { "value": { "$length": [{ "$join": [{ "$state": "/local/otp" }, ""] }] }, "eq": 6 } },
|
|
964
|
+
{ "action": "ui.toast", "params": { "message": "Code submitted", "tone": "success" } },
|
|
965
|
+
{ "action": "ui.set", "params": { "path": "/local/code", "value": { "$join": [{ "$state": "/local/otp" }, ""] } } }
|
|
966
|
+
]
|
|
967
|
+
}
|
|
968
|
+
},
|
|
969
|
+
"heading": { "type": "Heading", "props": { "text": "Enter the 6-digit code", "level": "h2" } },
|
|
970
|
+
"cells": {
|
|
971
|
+
"type": "Stack",
|
|
972
|
+
"props": { "direction": "row", "gap": "sm" },
|
|
973
|
+
"repeat": { "statePath": "/local/otp" },
|
|
974
|
+
"children": ["cell"]
|
|
975
|
+
},
|
|
976
|
+
"cell": {
|
|
977
|
+
"type": "Input",
|
|
978
|
+
"props": {
|
|
979
|
+
"id": "otp",
|
|
980
|
+
"value": { "$bindItem": "" },
|
|
981
|
+
"size": "cell",
|
|
982
|
+
"maxLength": 1,
|
|
983
|
+
"inputMode": "numeric",
|
|
984
|
+
"autoComplete": "one-time-code",
|
|
985
|
+
"selectOnFocus": true,
|
|
986
|
+
"onInput": [
|
|
987
|
+
{ "action": "ui.when", "params": { "value": { "$length": [{ "$chain": "value" }] }, "eq": 1 } },
|
|
988
|
+
{ "action": "ui.focus", "params": { "id": "otp", "index": { "$min": [{ "$add": [{ "$index": true }, 1] }, 5] } } }
|
|
989
|
+
],
|
|
990
|
+
"onKeyDown:Backspace": [
|
|
991
|
+
{ "action": "ui.set", "params": { "path": { "$join": [["/local/otp", { "$index": true }], "/"] }, "value": "" } },
|
|
992
|
+
{ "action": "ui.focus", "params": { "id": "otp", "index": { "$max": [{ "$sub": [{ "$index": true }, 1] }, 0] } } }
|
|
993
|
+
],
|
|
994
|
+
"onPaste": [
|
|
995
|
+
{ "action": "ui.when", "params": { "value": { "$length": [{ "$chain": "text" }] }, "eq": 6 } },
|
|
996
|
+
{ "action": "ui.set", "params": { "path": "/local/otp", "value": { "$split": [{ "$chain": "text" }, ""] } } },
|
|
997
|
+
{ "action": "ui.focus", "params": { "id": "otp", "index": 5 } }
|
|
998
|
+
]
|
|
999
|
+
}
|
|
1000
|
+
},
|
|
1001
|
+
"submitted": {
|
|
1002
|
+
"type": "Text",
|
|
1003
|
+
"props": { "content": { "$state": "/local/code" }, "tone": "muted" },
|
|
1004
|
+
"visible": { "$state": "/local/code" }
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
```
|
|
1011
|
+
|
|
1012
|
+
### Example: Gantt timeline
|
|
1013
|
+
|
|
1014
|
+
Each task is a bar at `x = 100 + (start - min) * scale`, `width = days * scale`, one row per item of a repeated list; the dashed line marks day 12. Bind `repeat.statePath` to `/queries/<q>/data` to draw rows from a query instead.
|
|
1015
|
+
|
|
1016
|
+
```json
|
|
1017
|
+
{
|
|
1018
|
+
"models": {},
|
|
1019
|
+
"defaultPage": "plan",
|
|
1020
|
+
"pages": {
|
|
1021
|
+
"plan": {
|
|
1022
|
+
"title": "Plan",
|
|
1023
|
+
"state": {
|
|
1024
|
+
"axis": { "min": 3, "scale": 24 },
|
|
1025
|
+
"tasks": [
|
|
1026
|
+
{ "name": "Research", "start": 3, "days": 4 },
|
|
1027
|
+
{ "name": "Design", "start": 6, "days": 5 },
|
|
1028
|
+
{ "name": "Build", "start": 10, "days": 8 },
|
|
1029
|
+
{ "name": "QA", "start": 16, "days": 4 },
|
|
1030
|
+
{ "name": "Launch", "start": 20, "days": 2 }
|
|
1031
|
+
]
|
|
1032
|
+
},
|
|
1033
|
+
"root": "card",
|
|
1034
|
+
"elements": {
|
|
1035
|
+
"card": { "type": "Card", "props": { "title": "Launch plan", "description": "Days 3-22" }, "children": ["chart"] },
|
|
1036
|
+
"chart": {
|
|
1037
|
+
"type": "Svg",
|
|
1038
|
+
"props": { "width": 640, "height": 200, "label": "Gantt chart of the launch plan" },
|
|
1039
|
+
"children": ["axis", "today", "rows"]
|
|
1040
|
+
},
|
|
1041
|
+
"axis": { "type": "Line", "props": { "x1": 100, "y1": 190, "x2": 632, "y2": 190, "stroke": "border" } },
|
|
1042
|
+
"today": {
|
|
1043
|
+
"type": "Line",
|
|
1044
|
+
"props": {
|
|
1045
|
+
"x1": { "$add": [100, { "$mul": [{ "$sub": [12, { "$state": "/local/axis/min" }] }, { "$state": "/local/axis/scale" }] }] },
|
|
1046
|
+
"y1": 8,
|
|
1047
|
+
"x2": { "$add": [100, { "$mul": [{ "$sub": [12, { "$state": "/local/axis/min" }] }, { "$state": "/local/axis/scale" }] }] },
|
|
1048
|
+
"y2": 190,
|
|
1049
|
+
"stroke": "error",
|
|
1050
|
+
"dashed": true
|
|
1051
|
+
}
|
|
1052
|
+
},
|
|
1053
|
+
"rows": { "type": "Svg", "props": {}, "repeat": { "statePath": "/local/tasks" }, "children": ["label", "bar"] },
|
|
1054
|
+
"label": {
|
|
1055
|
+
"type": "SvgText",
|
|
1056
|
+
"props": {
|
|
1057
|
+
"x": 0,
|
|
1058
|
+
"y": { "$add": [26, { "$mul": [{ "$index": true }, 34] }] },
|
|
1059
|
+
"text": { "$item": "name" },
|
|
1060
|
+
"size": 13
|
|
1061
|
+
}
|
|
1062
|
+
},
|
|
1063
|
+
"bar": {
|
|
1064
|
+
"type": "Rect",
|
|
1065
|
+
"props": {
|
|
1066
|
+
"x": { "$add": [100, { "$mul": [{ "$sub": [{ "$item": "start" }, { "$state": "/local/axis/min" }] }, { "$state": "/local/axis/scale" }] }] },
|
|
1067
|
+
"y": { "$add": [14, { "$mul": [{ "$index": true }, 34] }] },
|
|
1068
|
+
"width": { "$mul": [{ "$item": "days" }, { "$state": "/local/axis/scale" }] },
|
|
1069
|
+
"height": 24,
|
|
1070
|
+
"rx": 4,
|
|
1071
|
+
"fill": "chart-2",
|
|
1072
|
+
"title": { "$item": "name" }
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
```
|
|
1080
|
+
|
|
901
1081
|
## Patch semantics
|
|
902
1082
|
|
|
903
1083
|
`app-patch.definition` is RFC 7396 JSON Merge Patch applied to the stored definition:
|
|
@@ -1024,6 +1204,15 @@ Create this with `app-upsert`:
|
|
|
1024
1204
|
|
|
1025
1205
|
The tool returns `{ appId, url: "/apps/<id>" }`. Open that URL to verify the live UI, then continue with the read-patch-validate loop above.
|
|
1026
1206
|
|
|
1207
|
+
## Embed a sheet or board
|
|
1208
|
+
|
|
1209
|
+
`{ "type": "ObjectEmbed", "props": { "objectId": "<object id>" } }` shows a live, editable sheet or board (see the `boards-and-sheets` skill). Optional props: `height` (160-1200), `readOnly`, and for sheets `tab` and `range`. To show the same object on an HTML page instead, use the page snippet, where `${APP_URL}` is the dashboard origin:
|
|
1210
|
+
|
|
1211
|
+
```html
|
|
1212
|
+
<script type="module" src="${APP_URL}/embed/v1/swarm-object.js"></script>
|
|
1213
|
+
<swarm-object object-id="<object id>"></swarm-object>
|
|
1214
|
+
```
|
|
1215
|
+
|
|
1027
1216
|
## View and screenshot a live app
|
|
1028
1217
|
|
|
1029
1218
|
- An app renders at `<dashboard>/apps/<id>`. Two view modes are set by query string: `?mode=full` (full-viewport overlay with a slim header) and `?mode=chromeless` (only the rendered page, the embed surface). `app.navigate` keeps only `?mode`.
|
|
@@ -526,9 +526,9 @@ The sidebar lists pages in definition order and marks the current one. Below 768
|
|
|
526
526
|
|
|
527
527
|
Param `kind` is `string` by default, or `number` / `boolean`; `required` defaults to false. The names `mode`, `apiUrl`, `apiKey`, `email`, and `name` are reserved. `/apps/<id>` renders `defaultPage`; `/apps/<id>/p/<page>?issueId=42` is the shareable deep link for another page. Browser navigation is client-side, so app state and polled data stay warm across page changes.
|
|
528
528
|
|
|
529
|
-
Within each page, `root` names one entry in its non-empty `elements` map. Elements are a flat, single-parent tree: ids are map keys, `children` contains ids (not nested elements), all elements must be reachable from `root`, and cycles, missing children, or shared children are invalid. Element and Form/UI ids are page-local. Element keys are `type`, `props`, `children`, `on`, `visible`, `repeat`, and `watch`; only components with a `default` child slot accept `children` (Stack, Grid, Split, Tabs, Accordion, Container, Card, Section, Drawer, and
|
|
529
|
+
Within each page, `root` names one entry in its non-empty `elements` map. Elements are a flat, single-parent tree: ids are map keys, `children` contains ids (not nested elements), all elements must be reachable from `root`, and cycles, missing children, or shared children are invalid. Element and Form/UI ids are page-local. Element keys are `type`, `props`, `children`, `on`, `visible`, `repeat`, and `watch`; only components with a `default` child slot accept `children` (Stack, Grid, Split, Tabs, Accordion, Container, Card, Section, Drawer, Dialog, and Svg). `watch` maps state paths to an action step or chain. A page may also declare `state`: page-local values read and written at `/local/<name>` (see Low-level primitives).
|
|
530
530
|
|
|
531
|
-
## Component catalog (all
|
|
531
|
+
## Component catalog (all 52)
|
|
532
532
|
|
|
533
533
|
Props reject unknown keys. A `{"$state":"..."}` binding may replace a literal prop value at any depth.
|
|
534
534
|
|
|
@@ -585,6 +585,13 @@ Tones: Badge, Metric and Progress `tone` take `neutral`, `success`, `active`, `e
|
|
|
585
585
|
| `Approval` | `requestId` | `showResolved` (default true), `compact`, `onResolved`; one approval request answered in place by the viewer; see below. |
|
|
586
586
|
| `SessionThread` | `id`, `sessionKey` | `scope`, `placeholder`, `onDispatch`, `fill`; the dashboard's session conversation (the "Session about this page" panel) for one session per viewer and key, with a composer that steers or chains tasks; the draft is mirrored to `/ui/<id>/value`; see below. |
|
|
587
587
|
| `PageFrame` | `pageId` | `device` (`desktop` default, or `mobile`: a 390 px wide frame), `height` (default `640px`), `fill`; a live, clickable swarm Page that reloads when the page changes; see below. |
|
|
588
|
+
| `Input` | none | Low-level text field: `value` (bind two-way with `$bindState` / `$bindItem`), `id` (the `ui.focus` target), `label`, `placeholder`, `type: "text"` or `"password"`, `inputMode`, `autoComplete: "off"` or `"one-time-code"`, `maxLength`, `size: "default"` or `"cell"` (square one-character box), `selectOnFocus`, `disabled`; chains `onInput`, `onPaste`, `onKeyDown:<Key>`; see Low-level primitives. |
|
|
589
|
+
| `Svg` | `width`, `height` on the outer Svg | Vector drawing in `width` x `height` user units, scaled to its container; `label` (accessible name). Children: `Rect`, `Line`, `Path`, `Circle`, `SvgText`, or a nested `Svg` (a group offset by `x`/`y`, the place for `repeat`). |
|
|
590
|
+
| `Rect` | `x`, `y`, `width`, `height` | `rx`, `fill`, `stroke`, `strokeWidth`, `opacity`, `title` (tooltip); only inside an Svg. |
|
|
591
|
+
| `Line` | `x1`, `y1`, `x2`, `y2` | `stroke`, `strokeWidth`, `opacity`, `dashed`; only inside an Svg. |
|
|
592
|
+
| `Path` | `d` | `fill`, `stroke`, `strokeWidth`, `opacity`; `d` holds path commands and numbers only; only inside an Svg. |
|
|
593
|
+
| `Circle` | `cx`, `cy`, `r` | `fill`, `stroke`, `strokeWidth`, `opacity`, `title`; only inside an Svg. |
|
|
594
|
+
| `SvgText` | `x`, `y`, `text` | `anchor: "start", "middle", "end"`, `size`, `weight: "normal"` or `"bold"`, `fill`; only inside an Svg. |
|
|
588
595
|
|
|
589
596
|
Table details:
|
|
590
597
|
|
|
@@ -853,6 +860,7 @@ Valid `$state` roots are:
|
|
|
853
860
|
- `/actions/<declaredAction>/...`
|
|
854
861
|
- `/route/page` for the active page name
|
|
855
862
|
- `/route/params/<declaredParam>` for a param declared on the current page
|
|
863
|
+
- `/local/<name>/...`, where the current page declares `<name>` in its `state`
|
|
856
864
|
|
|
857
865
|
`/route` is mirrored as `{ page, params }`. Only declared params appear. Values are coerced by their declared kind: `number` becomes a number when possible; boolean strings `true`/`1` become true; failed number coercion remains the raw string.
|
|
858
866
|
|
|
@@ -893,6 +901,178 @@ The `studio` page's `SessionThread` with `"sessionKey": { "$state": "/route/para
|
|
|
893
901
|
|
|
894
902
|
A failed step halts its chain: when `app.action`, `app.mutate`, `swarm.sdk` or `swarm.call` fails (a thrown error, a script action that returns `ok: false`, a non-2xx `swarm.call`), the steps after it do not run and the error shows as an error toast. A step's `onError` (`{ set }` or `{ action }`) runs first, and the chain still halts. So a `ui.toast` after a write is a real success message. A `Form`'s failed `app.mutate` shows inline under the fields instead of a toast. A task-backed `app.action` succeeds once the task is created; the task's own failure shows in the page banner and does not halt the chain. A Table bulk action reads each step's own outcome, as before.
|
|
895
903
|
|
|
904
|
+
## Low-level primitives
|
|
905
|
+
|
|
906
|
+
Compose custom widgets (a code input, a timeline, a Gantt chart) from page-local state, a bindable `Input`, three `ui.*` steps, expressions, and `Svg` shapes. No custom component needed.
|
|
907
|
+
|
|
908
|
+
**Page state.** `pages.<page>.state` maps names to initial JSON values. The page reads them at `{ "$state": "/local/<name>/..." }` and only this root is writable. Each page has its own `/local`, even when two pages declare the same name. The values are seeded on first render and survive navigation; patching `pages.<page>.state.<name>` replaces that entry. Reusable elements cannot read or write `/local`.
|
|
909
|
+
|
|
910
|
+
**Input.** `value: { "$bindState": "/local/<name>/..." }` binds two-way; inside a `repeat` over a `/local` list, `{ "$bindItem": "" }` binds the item itself (`"field"` binds a field of it). `$bindState` and `$bindItem` are valid only on `Input.value`. Event chains are props, run by the Input:
|
|
911
|
+
|
|
912
|
+
- `onInput`: after every edit; `{ "$chain": "value" }` is the new text.
|
|
913
|
+
- `onPaste`: instead of the browser paste; `{ "$chain": "text" }` is the clipboard text.
|
|
914
|
+
- `onKeyDown:<Key>`: instead of that key's default. Keys: `Backspace`, `Delete`, `Enter`, `Escape`, `Tab`, `ArrowLeft`, `ArrowRight`, `ArrowUp`, `ArrowDown`, `Home`, `End`.
|
|
915
|
+
|
|
916
|
+
`$state` reads inside these chains resolve at render time. To read the newest value, use `$chain`, or put the chain in a `watch`. A state write inside a `watch` chain re-runs the watch and cancels the steps after it, so make `ui.set` the last step there.
|
|
917
|
+
|
|
918
|
+
**Steps.**
|
|
919
|
+
|
|
920
|
+
- `ui.set`: `{ path, value }` writes `value` to a `/local/...` path. A literal path must name declared state; `path` may be an expression, e.g. `{ "$join": [["/local/otp", { "$index": true }], "/"] }`.
|
|
921
|
+
- `ui.focus`: `{ id, index? }` focuses the `Input` with that literal `id` on this page. Inside a `repeat`, `index` picks the item. A missing target is a no-op.
|
|
922
|
+
- `ui.when`: `{ value, eq? }` continues the chain only when `value` equals `eq` (or is truthy without `eq`); otherwise the rest of the chain is skipped quietly.
|
|
923
|
+
|
|
924
|
+
**Expressions.** An object with one operator key and an operand array, valid in any prop or action param. Operands are literals or bindings (`$state`, `$item`, `$index`, `$chain`, another expression):
|
|
925
|
+
|
|
926
|
+
| Operator | Operands | Result |
|
|
927
|
+
|---|---|---|
|
|
928
|
+
| `$add`, `$mul`, `$min`, `$max` | 1 or more numbers | sum, product, minimum, maximum |
|
|
929
|
+
| `$sub`, `$div` | exactly 2 numbers | difference, quotient |
|
|
930
|
+
| `$split` | text, separator (default `""`), optional limit | array of strings |
|
|
931
|
+
| `$join` | array, separator (default `""`) | text |
|
|
932
|
+
| `$length` | 1 value | length of a text or array (`0` for null) |
|
|
933
|
+
|
|
934
|
+
A non-numeric operand, or a division by zero, yields no value and the attribute is left out.
|
|
935
|
+
|
|
936
|
+
**Svg.** `Svg` draws in `width` x `height` user units. Shape attributes (`x`, `y`, `width`, `height`, `x1`..`y2`, `cx`, `cy`, `r`, `d`) accept expressions, so a bar is `x = 100 + (start - min) * scale`. A nested `Svg` is a group: put `repeat` on it to draw its shapes once per item. Colors are palette tokens (`chart-1`..`chart-5`, `primary`, `success`, `warning`, `error`, `info`, `muted`, `foreground`, `background`, `border`, `none`). The validator rejects unknown attributes, raw colors, a `Path.d` with anything but path commands and numbers, shapes outside an Svg, and non-shape Svg children.
|
|
937
|
+
|
|
938
|
+
### Example: 6-cell code input
|
|
939
|
+
|
|
940
|
+
Typing advances to the next cell, Backspace clears the cell and moves back, pasting a 6-character code fills every cell, and the `watch` submits once all 6 are filled. Replace the `ui.toast` step with an `app.action` to verify the code server-side.
|
|
941
|
+
|
|
942
|
+
```json
|
|
943
|
+
{
|
|
944
|
+
"models": {},
|
|
945
|
+
"defaultPage": "verify",
|
|
946
|
+
"pages": {
|
|
947
|
+
"verify": {
|
|
948
|
+
"title": "Verify",
|
|
949
|
+
"state": { "otp": ["", "", "", "", "", ""], "code": "" },
|
|
950
|
+
"root": "root",
|
|
951
|
+
"elements": {
|
|
952
|
+
"root": {
|
|
953
|
+
"type": "Stack",
|
|
954
|
+
"props": { "gap": "md", "padding": "md" },
|
|
955
|
+
"children": ["heading", "cells", "submitted"],
|
|
956
|
+
"watch": {
|
|
957
|
+
"/local/otp": [
|
|
958
|
+
{ "action": "ui.when", "params": { "value": { "$length": [{ "$join": [{ "$state": "/local/otp" }, ""] }] }, "eq": 6 } },
|
|
959
|
+
{ "action": "ui.toast", "params": { "message": "Code submitted", "tone": "success" } },
|
|
960
|
+
{ "action": "ui.set", "params": { "path": "/local/code", "value": { "$join": [{ "$state": "/local/otp" }, ""] } } }
|
|
961
|
+
]
|
|
962
|
+
}
|
|
963
|
+
},
|
|
964
|
+
"heading": { "type": "Heading", "props": { "text": "Enter the 6-digit code", "level": "h2" } },
|
|
965
|
+
"cells": {
|
|
966
|
+
"type": "Stack",
|
|
967
|
+
"props": { "direction": "row", "gap": "sm" },
|
|
968
|
+
"repeat": { "statePath": "/local/otp" },
|
|
969
|
+
"children": ["cell"]
|
|
970
|
+
},
|
|
971
|
+
"cell": {
|
|
972
|
+
"type": "Input",
|
|
973
|
+
"props": {
|
|
974
|
+
"id": "otp",
|
|
975
|
+
"value": { "$bindItem": "" },
|
|
976
|
+
"size": "cell",
|
|
977
|
+
"maxLength": 1,
|
|
978
|
+
"inputMode": "numeric",
|
|
979
|
+
"autoComplete": "one-time-code",
|
|
980
|
+
"selectOnFocus": true,
|
|
981
|
+
"onInput": [
|
|
982
|
+
{ "action": "ui.when", "params": { "value": { "$length": [{ "$chain": "value" }] }, "eq": 1 } },
|
|
983
|
+
{ "action": "ui.focus", "params": { "id": "otp", "index": { "$min": [{ "$add": [{ "$index": true }, 1] }, 5] } } }
|
|
984
|
+
],
|
|
985
|
+
"onKeyDown:Backspace": [
|
|
986
|
+
{ "action": "ui.set", "params": { "path": { "$join": [["/local/otp", { "$index": true }], "/"] }, "value": "" } },
|
|
987
|
+
{ "action": "ui.focus", "params": { "id": "otp", "index": { "$max": [{ "$sub": [{ "$index": true }, 1] }, 0] } } }
|
|
988
|
+
],
|
|
989
|
+
"onPaste": [
|
|
990
|
+
{ "action": "ui.when", "params": { "value": { "$length": [{ "$chain": "text" }] }, "eq": 6 } },
|
|
991
|
+
{ "action": "ui.set", "params": { "path": "/local/otp", "value": { "$split": [{ "$chain": "text" }, ""] } } },
|
|
992
|
+
{ "action": "ui.focus", "params": { "id": "otp", "index": 5 } }
|
|
993
|
+
]
|
|
994
|
+
}
|
|
995
|
+
},
|
|
996
|
+
"submitted": {
|
|
997
|
+
"type": "Text",
|
|
998
|
+
"props": { "content": { "$state": "/local/code" }, "tone": "muted" },
|
|
999
|
+
"visible": { "$state": "/local/code" }
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
```
|
|
1006
|
+
|
|
1007
|
+
### Example: Gantt timeline
|
|
1008
|
+
|
|
1009
|
+
Each task is a bar at `x = 100 + (start - min) * scale`, `width = days * scale`, one row per item of a repeated list; the dashed line marks day 12. Bind `repeat.statePath` to `/queries/<q>/data` to draw rows from a query instead.
|
|
1010
|
+
|
|
1011
|
+
```json
|
|
1012
|
+
{
|
|
1013
|
+
"models": {},
|
|
1014
|
+
"defaultPage": "plan",
|
|
1015
|
+
"pages": {
|
|
1016
|
+
"plan": {
|
|
1017
|
+
"title": "Plan",
|
|
1018
|
+
"state": {
|
|
1019
|
+
"axis": { "min": 3, "scale": 24 },
|
|
1020
|
+
"tasks": [
|
|
1021
|
+
{ "name": "Research", "start": 3, "days": 4 },
|
|
1022
|
+
{ "name": "Design", "start": 6, "days": 5 },
|
|
1023
|
+
{ "name": "Build", "start": 10, "days": 8 },
|
|
1024
|
+
{ "name": "QA", "start": 16, "days": 4 },
|
|
1025
|
+
{ "name": "Launch", "start": 20, "days": 2 }
|
|
1026
|
+
]
|
|
1027
|
+
},
|
|
1028
|
+
"root": "card",
|
|
1029
|
+
"elements": {
|
|
1030
|
+
"card": { "type": "Card", "props": { "title": "Launch plan", "description": "Days 3-22" }, "children": ["chart"] },
|
|
1031
|
+
"chart": {
|
|
1032
|
+
"type": "Svg",
|
|
1033
|
+
"props": { "width": 640, "height": 200, "label": "Gantt chart of the launch plan" },
|
|
1034
|
+
"children": ["axis", "today", "rows"]
|
|
1035
|
+
},
|
|
1036
|
+
"axis": { "type": "Line", "props": { "x1": 100, "y1": 190, "x2": 632, "y2": 190, "stroke": "border" } },
|
|
1037
|
+
"today": {
|
|
1038
|
+
"type": "Line",
|
|
1039
|
+
"props": {
|
|
1040
|
+
"x1": { "$add": [100, { "$mul": [{ "$sub": [12, { "$state": "/local/axis/min" }] }, { "$state": "/local/axis/scale" }] }] },
|
|
1041
|
+
"y1": 8,
|
|
1042
|
+
"x2": { "$add": [100, { "$mul": [{ "$sub": [12, { "$state": "/local/axis/min" }] }, { "$state": "/local/axis/scale" }] }] },
|
|
1043
|
+
"y2": 190,
|
|
1044
|
+
"stroke": "error",
|
|
1045
|
+
"dashed": true
|
|
1046
|
+
}
|
|
1047
|
+
},
|
|
1048
|
+
"rows": { "type": "Svg", "props": {}, "repeat": { "statePath": "/local/tasks" }, "children": ["label", "bar"] },
|
|
1049
|
+
"label": {
|
|
1050
|
+
"type": "SvgText",
|
|
1051
|
+
"props": {
|
|
1052
|
+
"x": 0,
|
|
1053
|
+
"y": { "$add": [26, { "$mul": [{ "$index": true }, 34] }] },
|
|
1054
|
+
"text": { "$item": "name" },
|
|
1055
|
+
"size": 13
|
|
1056
|
+
}
|
|
1057
|
+
},
|
|
1058
|
+
"bar": {
|
|
1059
|
+
"type": "Rect",
|
|
1060
|
+
"props": {
|
|
1061
|
+
"x": { "$add": [100, { "$mul": [{ "$sub": [{ "$item": "start" }, { "$state": "/local/axis/min" }] }, { "$state": "/local/axis/scale" }] }] },
|
|
1062
|
+
"y": { "$add": [14, { "$mul": [{ "$index": true }, 34] }] },
|
|
1063
|
+
"width": { "$mul": [{ "$item": "days" }, { "$state": "/local/axis/scale" }] },
|
|
1064
|
+
"height": 24,
|
|
1065
|
+
"rx": 4,
|
|
1066
|
+
"fill": "chart-2",
|
|
1067
|
+
"title": { "$item": "name" }
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
```
|
|
1075
|
+
|
|
896
1076
|
## Patch semantics
|
|
897
1077
|
|
|
898
1078
|
`app-patch.definition` is RFC 7396 JSON Merge Patch applied to the stored definition:
|
|
@@ -1019,6 +1199,15 @@ Create this with `app-upsert`:
|
|
|
1019
1199
|
|
|
1020
1200
|
The tool returns `{ appId, url: "/apps/<id>" }`. Open that URL to verify the live UI, then continue with the read-patch-validate loop above.
|
|
1021
1201
|
|
|
1202
|
+
## Embed a sheet or board
|
|
1203
|
+
|
|
1204
|
+
`{ "type": "ObjectEmbed", "props": { "objectId": "<object id>" } }` shows a live, editable sheet or board (see the `boards-and-sheets` skill). Optional props: `height` (160-1200), `readOnly`, and for sheets `tab` and `range`. To show the same object on an HTML page instead, use the page snippet, where `${APP_URL}` is the dashboard origin:
|
|
1205
|
+
|
|
1206
|
+
```html
|
|
1207
|
+
<script type="module" src="${APP_URL}/embed/v1/swarm-object.js"></script>
|
|
1208
|
+
<swarm-object object-id="<object id>"></swarm-object>
|
|
1209
|
+
```
|
|
1210
|
+
|
|
1022
1211
|
## View and screenshot a live app
|
|
1023
1212
|
|
|
1024
1213
|
- An app renders at `<dashboard>/apps/<id>`. Two view modes are set by query string: `?mode=full` (full-viewport overlay with a slim header) and `?mode=chromeless` (only the rendered page, the embed surface). `app.navigate` keeps only `?mode`.
|
|
@@ -158,6 +158,17 @@ export default async function (args, ctx) {
|
|
|
158
158
|
- `updateElements` patches `label` (an empty string removes it), `x`, `y`, `width`, `height` and `color`. Bound labels and arrows follow. Arrows take only `label` and `color`.
|
|
159
159
|
- `removeElements` sets `isDeleted: true`. A shape takes its label with it and unbinds its arrows.
|
|
160
160
|
|
|
161
|
+
## Embed in an app or a page
|
|
162
|
+
|
|
163
|
+
An app shows a live, editable sheet or board with `{ "type": "ObjectEmbed", "props": { "objectId": "<object id>" } }`. A page shows it with this snippet, where `${APP_URL}` is the dashboard origin:
|
|
164
|
+
|
|
165
|
+
```html
|
|
166
|
+
<script type="module" src="${APP_URL}/embed/v1/swarm-object.js"></script>
|
|
167
|
+
<swarm-object object-id="<object id>"></swarm-object>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Optional attributes: `height` (160-1200 px), `readonly`, and for sheets `tab` and `range` (`B2:F20` or `Tab!B2:F20`). Only signed-in viewers see the object. A public or password page guest sees "sign in to the swarm to view", and a page opened with the shared swarm key is read-only.
|
|
171
|
+
|
|
161
172
|
## Hand it over quietly
|
|
162
173
|
|
|
163
174
|
Put the file where the person already works: send its `link` in the thread reply, the report or the task output they asked for. Do not announce sheets or boards as a feature and do not post about them unprompted. If they ask what the link is, say it is an editable spreadsheet or diagram on the shared drive.
|