@engenty/wizards-runtime 0.12.2 → 0.14.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/apps/runtime/dist/agents/architect.js +8 -7
- package/apps/runtime/dist/agents/goose-connections.js +82 -0
- package/apps/runtime/dist/agents/space-agent.js +9 -2
- package/apps/runtime/dist/agents/studio-assistant.js +126 -71
- package/apps/runtime/dist/agents/website.js +1 -1
- package/apps/runtime/dist/app.js +28 -3
- package/apps/runtime/dist/assistant/knows.js +6 -5
- package/apps/runtime/dist/authoring/guide.js +25 -5
- package/apps/runtime/dist/broker/account.js +166 -0
- package/apps/runtime/dist/broker/call.js +417 -0
- package/apps/runtime/dist/broker/caller.js +10 -0
- package/apps/runtime/dist/broker/grant.js +152 -0
- package/apps/runtime/dist/broker/host.js +51 -0
- package/apps/runtime/dist/broker/index.js +8 -0
- package/apps/runtime/dist/broker/kept.js +31 -0
- package/apps/runtime/dist/broker/log.js +240 -0
- package/apps/runtime/dist/broker/registry.js +9 -0
- package/apps/runtime/dist/broker/rwx.js +367 -0
- package/apps/runtime/dist/broker/send.js +189 -0
- package/apps/runtime/dist/connectors/builtin.js +1 -1
- package/apps/runtime/dist/connectors/external.js +38 -37
- package/apps/runtime/dist/connectors/index.js +30 -91
- package/apps/runtime/dist/connectors/mail.js +0 -8
- package/apps/runtime/dist/connectors/person-sign-ins.js +73 -0
- package/apps/runtime/dist/connectors/plugin-connections.js +65 -92
- package/apps/runtime/dist/connectors/smtp.js +1 -1
- package/apps/runtime/dist/connectors/space-connections.js +436 -0
- package/apps/runtime/dist/credits/estimate.js +3 -3
- package/apps/runtime/dist/db/adopt.js +3 -3
- package/apps/runtime/dist/db/client.js +9 -0
- package/apps/runtime/dist/db/live-triggers.js +65 -23
- package/apps/runtime/dist/db/migrations/tenant/0027_work_chats.sql +52 -0
- package/apps/runtime/dist/db/migrations/tenant/0028_chat_approvals.sql +17 -0
- package/apps/runtime/dist/db/migrations/tenant/0029_work_chats_live.sql +49 -0
- package/apps/runtime/dist/db/migrations/tenant/0031_space.sql +624 -0
- package/apps/runtime/dist/db/migrations/tenant/0032_rwx_rule.sql +18 -0
- package/apps/runtime/dist/db/migrations/tenant/0033_broker_log.sql +23 -0
- package/apps/runtime/dist/db/migrations/tenant/0034_space_connection.sql +35 -0
- package/apps/runtime/dist/db/migrations/tenant/0035_run_grant.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/0036_approval_held_for.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/0037_ways_out.sql +5 -0
- package/apps/runtime/dist/db/migrations/tenant/0038_heard.sql +11 -0
- package/apps/runtime/dist/db/migrations/tenant/0039_members_studio.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0027_snapshot.json +383 -155
- package/apps/runtime/dist/db/migrations/tenant/meta/0028_snapshot.json +4468 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0029_snapshot.json +4475 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0030_snapshot.json +4629 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0031_snapshot.json +4629 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0032_snapshot.json +4757 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0033_snapshot.json +5039 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0034_snapshot.json +5022 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0035_snapshot.json +5029 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0036_snapshot.json +5037 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0037_snapshot.json +5076 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0038_snapshot.json +5145 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0039_snapshot.json +5153 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +86 -2
- package/apps/runtime/dist/db/schema.js +295 -72
- package/apps/runtime/dist/docs/dev/architecture.md +215 -0
- package/apps/runtime/dist/docs/dev/broker.md +298 -0
- package/apps/runtime/dist/docs/dev/index.md +5 -1
- package/apps/runtime/dist/docs/dev/integration/index.md +2 -0
- package/apps/runtime/dist/docs/dev/meta.json +3 -0
- package/apps/runtime/dist/docs/dev/plugins/connections.md +8 -5
- package/apps/runtime/dist/docs/dev/plugins/events.md +1 -1
- package/apps/runtime/dist/docs/dev/plugins/examples.md +1 -0
- package/apps/runtime/dist/docs/dev/plugins/index.md +2 -2
- package/apps/runtime/dist/docs/dev/plugins/reference.md +3 -2
- package/apps/runtime/dist/docs/dev/plugins/space.md +16 -6
- package/apps/runtime/dist/docs/dev/plugins/studio.md +2 -2
- package/apps/runtime/dist/docs/dev/plugins/tools.md +0 -1
- package/apps/runtime/dist/docs/dev/skills.md +16 -9
- package/apps/runtime/dist/docs/dev/wizard-format/agent-steps.md +59 -6
- package/apps/runtime/dist/docs/dev/wizard-format/lists-and-connections.md +17 -2
- package/apps/runtime/dist/docs/dev/wizard-format/templates.md +2 -0
- package/apps/runtime/dist/docs/dev/wizard-format/views-and-widgets.md +22 -2
- package/apps/runtime/dist/docs/user-guide/capabilities.md +132 -0
- package/apps/runtime/dist/docs/user-guide/cloud-sync.md +2 -0
- package/apps/runtime/dist/docs/user-guide/command-line.md +1 -0
- package/apps/runtime/dist/docs/user-guide/connectors.md +63 -7
- package/apps/runtime/dist/docs/user-guide/index.md +10 -1
- package/apps/runtime/dist/docs/user-guide/meta.json +6 -1
- package/apps/runtime/dist/docs/user-guide/models.md +105 -30
- package/apps/runtime/dist/docs/user-guide/protocol.md +80 -0
- package/apps/runtime/dist/docs/user-guide/skills.md +8 -4
- package/apps/runtime/dist/docs/user-guide/space.md +5 -4
- package/apps/runtime/dist/docs/user-guide/together.md +29 -2
- package/apps/runtime/dist/docs/user-guide/troubleshooting.md +2 -2
- package/apps/runtime/dist/docs/user-guide/work-mode.md +128 -0
- package/apps/runtime/dist/engenty/connections-external/build-connector.js +2 -5
- package/apps/runtime/dist/engenty/connections-external/importer/classify.js +72 -0
- package/apps/runtime/dist/engenty/connections-google/connectors/gmail.js +1 -1
- package/apps/runtime/dist/engenty/connections-microsoft/outlook.js +3 -2
- package/apps/runtime/dist/engenty/connections-sdk/types.js +2 -0
- package/apps/runtime/dist/engenty/connections-slack/connector.js +2 -1
- package/apps/runtime/dist/engine/decide.js +1 -1
- package/apps/runtime/dist/engine/requirements.js +139 -11
- package/apps/runtime/dist/engine/resources.js +43 -12
- package/apps/runtime/dist/engine/runner.js +121 -27
- package/apps/runtime/dist/engine/steps.js +42 -16
- package/apps/runtime/dist/engine/template.js +35 -1
- package/apps/runtime/dist/env.js +9 -4
- package/apps/runtime/dist/index.js +18 -2
- package/apps/runtime/dist/link-preview.js +9 -0
- package/apps/runtime/dist/live/feed.js +2 -2
- package/apps/runtime/dist/live/origin.js +2 -2
- package/apps/runtime/dist/live/views.js +51 -26
- package/apps/runtime/dist/manage.js +32 -0
- package/apps/runtime/dist/mcp/flow-app.js +1 -1
- package/apps/runtime/dist/mcp/handler.js +55 -1
- package/apps/runtime/dist/mcp/seen.js +47 -0
- package/apps/runtime/dist/mcp/tools.js +75 -34
- package/apps/runtime/dist/models.js +203 -12
- package/apps/runtime/dist/motion-graphics/project.js +8 -8
- package/apps/runtime/dist/motion-graphics/step.js +2 -2
- package/apps/runtime/dist/motion-graphics/tools.js +1 -1
- package/apps/runtime/dist/plugins/events.js +2 -2
- package/apps/runtime/dist/plugins/jobs.js +4 -1
- package/apps/runtime/dist/plugins/loader.js +2 -2
- package/apps/runtime/dist/prompts/architect.md +3 -3
- package/apps/runtime/dist/prompts/authoring.md +46 -12
- package/apps/runtime/dist/prompts/goose.md +14 -13
- package/apps/runtime/dist/prompts/mcp.md +6 -6
- package/apps/runtime/dist/prompts/safety.md +18 -0
- package/apps/runtime/dist/prompts/services.md +4 -4
- package/apps/runtime/dist/prompts/step.md +3 -3
- package/apps/runtime/dist/prompts/tools.md +39 -10
- package/apps/runtime/dist/routes/api.js +31 -20
- package/apps/runtime/dist/routes/broker.js +316 -0
- package/apps/runtime/dist/routes/connections.js +71 -0
- package/apps/runtime/dist/routes/delivery.js +25 -0
- package/apps/runtime/dist/routes/discover.js +17 -0
- package/apps/runtime/dist/routes/live.js +11 -1
- package/apps/runtime/dist/routes/marketplace.js +3 -3
- package/apps/runtime/dist/routes/person.js +4 -1
- package/apps/runtime/dist/routes/plugins.js +3 -1
- package/apps/runtime/dist/routes/rules.js +26 -0
- package/apps/runtime/dist/routes/runs.js +59 -33
- package/apps/runtime/dist/routes/skills.js +6 -6
- package/apps/runtime/dist/routes/studio.js +256 -148
- package/apps/runtime/dist/routes/work.js +199 -0
- package/apps/runtime/dist/safety.js +60 -18
- package/apps/runtime/dist/sandbox/index.js +27 -0
- package/apps/runtime/dist/services/access.js +38 -17
- package/apps/runtime/dist/services/api.js +38 -13
- package/apps/runtime/dist/services/architect.js +3 -3
- package/apps/runtime/dist/services/assistant-chats.js +9 -1
- package/apps/runtime/dist/services/brand.js +12 -12
- package/apps/runtime/dist/services/broker-bell.js +69 -0
- package/apps/runtime/dist/services/broker-notify.js +127 -0
- package/apps/runtime/dist/services/client-steps.js +79 -0
- package/apps/runtime/dist/services/cloud.js +42 -42
- package/apps/runtime/dist/services/command-risk.js +51 -0
- package/apps/runtime/dist/services/discover.js +85 -0
- package/apps/runtime/dist/services/knowledge-model.js +13 -13
- package/apps/runtime/dist/services/knowledge.js +117 -80
- package/apps/runtime/dist/services/manage-reports.js +77 -7
- package/apps/runtime/dist/services/marketplace.js +7 -31
- package/apps/runtime/dist/services/members-studio.js +165 -0
- package/apps/runtime/dist/services/onboarding.js +22 -22
- package/apps/runtime/dist/services/package-file.js +1 -1
- package/apps/runtime/dist/services/package.js +22 -22
- package/apps/runtime/dist/services/pages.js +13 -9
- package/apps/runtime/dist/services/runs.js +4 -3
- package/apps/runtime/dist/services/seen.js +55 -0
- package/apps/runtime/dist/services/shares.js +28 -13
- package/apps/runtime/dist/services/site.js +23 -23
- package/apps/runtime/dist/services/skills-registry.js +15 -15
- package/apps/runtime/dist/services/skills.js +44 -44
- package/apps/runtime/dist/services/space-categories.js +35 -35
- package/apps/runtime/dist/services/space-data.js +130 -111
- package/apps/runtime/dist/services/{project-files.js → space-files.js} +84 -75
- package/apps/runtime/dist/services/{project-index.js → space-index.js} +116 -73
- package/apps/runtime/dist/services/space-origin.js +19 -11
- package/apps/runtime/dist/services/spaces.js +478 -598
- package/apps/runtime/dist/services/synced-spaces.js +668 -0
- package/apps/runtime/dist/services/themes.js +15 -15
- package/apps/runtime/dist/services/widgets.js +6 -6
- package/apps/runtime/dist/services/wizards.js +112 -38
- package/apps/runtime/dist/services/work-ai.js +257 -0
- package/apps/runtime/dist/services/work-approvals.js +104 -0
- package/apps/runtime/dist/services/work-chats.js +908 -0
- package/apps/runtime/dist/services/work-connections.js +90 -0
- package/apps/runtime/dist/services/work-files.js +85 -0
- package/apps/runtime/dist/services/work-mastra.js +73 -0
- package/apps/runtime/dist/services/work-sandbox.js +42 -0
- package/apps/runtime/dist/sharing/files.js +14 -4
- package/apps/runtime/dist/sharing/index.js +40 -39
- package/apps/runtime/dist/sharing/jobs.js +67 -17
- package/apps/runtime/dist/sharing/targets/connector.js +10 -6
- package/apps/runtime/dist/sharing/targets/email.js +10 -8
- package/apps/runtime/dist/sharing/targets/slack.js +10 -8
- package/apps/runtime/dist/sharing/targets/storage.js +6 -4
- package/apps/runtime/dist/store/index.js +14 -3
- package/apps/runtime/dist/store/shared-lists.js +4 -2
- package/apps/runtime/dist/sync/apply.js +2 -2
- package/apps/runtime/dist/sync/client.js +113 -113
- package/apps/runtime/dist/sync/hub.js +41 -41
- package/apps/runtime/dist/sync/log.js +12 -12
- package/apps/runtime/dist/sync/records.js +118 -120
- package/apps/runtime/dist/texts.js +44 -2
- package/apps/runtime/dist/tools/connections.js +112 -0
- package/apps/runtime/dist/tools/connector.js +157 -67
- package/apps/runtime/dist/tools/index.js +31 -15
- package/apps/runtime/dist/tools/mail.js +40 -11
- package/apps/runtime/dist/tools/pages.js +11 -5
- package/apps/runtime/dist/tools/plugin.js +43 -7
- package/apps/runtime/dist/tools/skills.js +1 -1
- package/apps/runtime/dist/tools/{project.js → space.js} +30 -25
- package/apps/runtime/dist/tools/store.js +3 -2
- package/apps/runtime/dist/widgets/step.js +10 -10
- package/apps/web/dist/assets/AboutDialog-DgfeipUc.js +1 -0
- package/apps/web/dist/assets/CapabilitiesPage-BoYJvgIu.js +2 -0
- package/apps/web/dist/assets/{ChangelogDialog-CKLgFL6r.js → ChangelogDialog-Duab4zTO.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-B3nto_26.js → CodeEditor-nxoOt8ge.js} +1 -1
- package/apps/web/dist/assets/EditorPage-ZrgGpYMC.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-zJCtixSi.js → FlowPreview-aMfwcPul.js} +1 -1
- package/apps/web/dist/assets/LangSwitch-DpD0inR4.js +1 -0
- package/apps/web/dist/assets/Marketplace-CpzD9pNQ.js +2 -0
- package/apps/web/dist/assets/NewWizardChannels-IB18afWN.js +1 -0
- package/apps/web/dist/assets/NewWizardPage-rYbcmPGG.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-ztHT01ah.js +1 -0
- package/apps/web/dist/assets/PreviewPane-DviWTLfi.js +9 -0
- package/apps/web/dist/assets/PublicRunner-C2geZhhM.js +1 -0
- package/apps/web/dist/assets/ReadOnly-kSb_Kbdm.js +1 -0
- package/apps/web/dist/assets/SettingsPage-DM2h8N0J.js +2 -0
- package/apps/web/dist/assets/SetupPage-Wfyz6xH4.js +1 -0
- package/apps/web/dist/assets/SharePage-CyWQorWB.js +1 -0
- package/apps/web/dist/assets/SkillEditor-CqQMg2MC.js +1 -0
- package/apps/web/dist/assets/Skills-CnhpgoOA.js +9 -0
- package/apps/web/dist/assets/SpacePage-q4Bk3N7k.js +2 -0
- package/apps/web/dist/assets/UpdateCheck-C2CE6CC3.js +2 -0
- package/apps/web/dist/assets/changelog-B6hN1Cp7.js +1 -0
- package/apps/web/dist/assets/circle-alert-C8Ma-bPY.js +1 -0
- package/apps/web/dist/assets/circle-check-Bu9Z3mlJ.js +1 -0
- package/apps/web/dist/assets/code-editor-CfTGqOpp.js +2 -0
- package/apps/web/dist/assets/{code-xml-Hx7YxCg0.js → code-xml-B4kLFZSj.js} +1 -1
- package/apps/web/dist/assets/connection-sign-in-CIiv0t2p.js +1 -0
- package/apps/web/dist/assets/esm-Xwn4GtqG.js +7 -0
- package/apps/web/dist/assets/{eye-BkMFLnYu.js → eye-BpoKpIdt.js} +1 -1
- package/apps/web/dist/assets/host-BrP-ENHg.css +1 -0
- package/apps/web/dist/assets/host-DJ7-p0Sc.js +118 -0
- package/apps/web/dist/assets/i18n-BJ7Ld6O6.js +55 -0
- package/apps/web/dist/assets/index-D18DvnxX.css +1 -0
- package/apps/web/dist/assets/index-D2akynS-.js +10 -0
- package/apps/web/dist/assets/logo-BpnjXTRy.js +1 -0
- package/apps/web/dist/assets/oss-credits-IdX5bc71.js +1 -0
- package/apps/web/dist/assets/{phone-DMfwuh9V.js → phone-Ctvf-Am-.js} +1 -1
- package/apps/web/dist/assets/read-aloud-Da_RSm2S.js +1 -0
- package/apps/web/dist/assets/{runners-D5qz6b_s.js → runners-CyIvJIHr.js} +1 -1
- package/apps/web/dist/assets/scroll-text-ChrjRu9Y.js +1 -0
- package/apps/web/dist/assets/session-SXPtTWRK.js +2 -0
- package/apps/web/dist/assets/theme-CbTcTFWy.js +11 -0
- package/apps/web/dist/assets/ui-Uqnx1UpK.js +82 -0
- package/apps/web/dist/assets/{upload-DQJwLSGj.js → upload-BchUnQGV.js} +1 -1
- package/apps/web/dist/assets/{useMutation-C20c2EH3.js → useMutation-DEkZhp5c.js} +1 -1
- package/apps/web/dist/assets/{volume-2-CC5qamYT.js → volume-2-CU_oy81Z.js} +1 -1
- package/apps/web/dist/assets/with-selector-CoMyWBAX.js +1 -0
- package/apps/web/dist/index.html +17 -10
- package/apps/web/dist/mcp/flow.html +119 -64
- package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +20 -10
- package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +7 -1
- package/node_modules/@engenty/wizards-shared/dist/assistant.js +11 -1
- package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +236 -2
- package/node_modules/@engenty/wizards-shared/dist/connectors.js +52 -2
- package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +257 -8
- package/node_modules/@engenty/wizards-shared/dist/definition.js +113 -15
- package/node_modules/@engenty/wizards-shared/dist/discover.d.ts +21 -0
- package/node_modules/@engenty/wizards-shared/dist/discover.js +1 -0
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +38 -2
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +38 -2
- package/node_modules/@engenty/wizards-shared/dist/fit.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/json-schema.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/json-schema.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/live.d.ts +2 -2
- package/node_modules/@engenty/wizards-shared/dist/live.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/marketplace.d.ts +0 -5
- package/node_modules/@engenty/wizards-shared/dist/marketplace.js +3 -1
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +115 -6
- package/node_modules/@engenty/wizards-shared/dist/run.js +135 -0
- package/node_modules/@engenty/wizards-shared/dist/runner-texts.d.ts +15 -1
- package/node_modules/@engenty/wizards-shared/dist/runner-texts.js +14 -0
- package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +42 -0
- package/node_modules/@engenty/wizards-shared/dist/rwx.js +29 -0
- package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/space-data.d.ts +2 -2
- package/node_modules/@engenty/wizards-shared/dist/{projects.d.ts → spaces.d.ts} +39 -15
- package/node_modules/@engenty/wizards-shared/dist/{projects.js → spaces.js} +16 -9
- package/node_modules/@engenty/wizards-shared/dist/store.d.ts +7 -2
- package/node_modules/@engenty/wizards-shared/dist/surface.d.ts +35 -4
- package/node_modules/@engenty/wizards-shared/dist/surface.js +121 -3
- package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/theme-look.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/tiers.d.ts +195 -0
- package/node_modules/@engenty/wizards-shared/dist/tiers.js +98 -0
- package/node_modules/@engenty/wizards-shared/dist/wizard-package.d.ts +2 -2
- package/node_modules/@engenty/wizards-shared/dist/wizard-package.js +3 -3
- package/package.json +4 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/plugin/skills/build-wizard/SKILL.md +1 -1
- package/apps/runtime/dist/services/projects.js +0 -473
- package/apps/web/dist/assets/AboutDialog-CLgnoYTI.js +0 -1
- package/apps/web/dist/assets/EditorPage-D9JDdAAI.js +0 -3
- package/apps/web/dist/assets/Marketplace-D4e0Oac9.js +0 -2
- package/apps/web/dist/assets/NewWizardChannels-B4N7GIYh.js +0 -1
- package/apps/web/dist/assets/NewWizardPage-Dpt0Mzk8.js +0 -7
- package/apps/web/dist/assets/OnboardingPage-CDoYVjRC.js +0 -1
- package/apps/web/dist/assets/PreviewPane-DPB5nEd5.js +0 -10
- package/apps/web/dist/assets/ProjectPage-408YOoNa.js +0 -10
- package/apps/web/dist/assets/PublicRunner-BZ66xdRX.js +0 -1
- package/apps/web/dist/assets/ReadOnly-C9oGMkUB.js +0 -1
- package/apps/web/dist/assets/SettingsPage-Dq3AZwJS.js +0 -2
- package/apps/web/dist/assets/SetupPage-CP3lbyZc.js +0 -1
- package/apps/web/dist/assets/SharePage-DdMm1Y8K.js +0 -1
- package/apps/web/dist/assets/SkillEditor-b5NMFB90.js +0 -1
- package/apps/web/dist/assets/changelog-82-DHogQ.js +0 -1
- package/apps/web/dist/assets/esm-BdxDT9Km.js +0 -7
- package/apps/web/dist/assets/i18n-CKKh3Pn0.js +0 -55
- package/apps/web/dist/assets/index-Cy2NHzAx.js +0 -49
- package/apps/web/dist/assets/index-wR_-1hfN.css +0 -1
- package/apps/web/dist/assets/lock-CGXM95Mi.js +0 -1
- package/apps/web/dist/assets/logo-CGNoptDg.js +0 -1
- package/apps/web/dist/assets/oss-credits-DpRWUPjD.js +0 -1
- package/apps/web/dist/assets/session-DRy0k0nh.js +0 -2
- package/apps/web/dist/assets/theme-DNPm6r4e.js +0 -11
- package/apps/web/dist/assets/ui-CwFQAfE-.js +0 -83
- /package/apps/runtime/dist/db/migrations/tenant/{0027_space_skill.sql → 0030_space_skill.sql} +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { CONNECTION_AUDIENCES, CONNECTION_SIGN_INS, } from "@engenty/wizards-shared/connectors";
|
|
2
|
+
import { RWX_FLAGS, RWX_RESOURCE_KINDS, RWX_SUBJECT_KINDS } from "@engenty/wizards-shared/rwx";
|
|
1
3
|
import { SKILL_MODES, SKILL_SOURCES, } from "@engenty/wizards-shared/skills";
|
|
2
4
|
import { sql } from "drizzle-orm";
|
|
3
5
|
import { blob, index, integer, primaryKey, real, sqliteTable, text, uniqueIndex, } from "drizzle-orm/sqlite-core";
|
|
4
6
|
const now = sql `(unixepoch() * 1000)`;
|
|
5
7
|
const createdAt = () => integer("created_at", { mode: "timestamp_ms" }).notNull().default(now);
|
|
6
8
|
const updatedAt = () => integer("updated_at", { mode: "timestamp_ms" }).notNull().default(now);
|
|
7
|
-
export const
|
|
9
|
+
export const space = sqliteTable("space", {
|
|
8
10
|
id: text("id").primaryKey(),
|
|
9
11
|
tenantId: text("tenant_id").notNull(),
|
|
10
12
|
name: text("name").notNull(),
|
|
@@ -15,19 +17,40 @@ export const project = sqliteTable("project", {
|
|
|
15
17
|
/** The space's public page at `<organization>.wizards.page/<slug>`; null until it is set up. */
|
|
16
18
|
page: text("page", { mode: "json" }).$type(),
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
20
|
+
* The space's own mail domains (`firma.at`): a guest's run may send to an address in one of
|
|
21
|
+
* them, besides the address the run itself collected (broker/send.ts). Admins set them.
|
|
22
|
+
*/
|
|
23
|
+
mailDomains: text("mail_domains", { mode: "json" }).$type().notNull().default([]),
|
|
24
|
+
/**
|
|
25
|
+
* How the space's admins hear of the broker's critical lines (docs/plans/broker.md,
|
|
26
|
+
* "Notifications"): under Work's bell, and by mail once an hour where nobody of them was in
|
|
27
|
+
* the app. Set through `PATCH /api/studio/spaces/:id`, on Fähigkeiten › Protokoll.
|
|
28
|
+
*/
|
|
29
|
+
notify: text("notify", { mode: "json" })
|
|
30
|
+
.$type()
|
|
31
|
+
.notNull()
|
|
32
|
+
.default({ bell: true, mail: "hourly" }),
|
|
33
|
+
/** When the hourly mail last went out, or was skipped because an admin had seen the bell. */
|
|
34
|
+
criticalMailedAt: integer("critical_mailed_at", { mode: "timestamp_ms" }),
|
|
35
|
+
/**
|
|
36
|
+
* „Mitglieder dürfen ins Studio“: the organization's members build here too, with less than
|
|
37
|
+
* its admins (services/members-studio.ts). One rule for all members; admins set it.
|
|
38
|
+
*/
|
|
39
|
+
membersStudio: integer("members_studio", { mode: "boolean" }).notNull().default(false),
|
|
40
|
+
/**
|
|
41
|
+
* `local`: the space of a local install, synced here when that install publishes. It keeps
|
|
19
42
|
* the ids it has there and is changed only by the next sync. Null: made on this runtime.
|
|
20
43
|
*/
|
|
21
44
|
origin: text("origin", { enum: ["local"] }),
|
|
22
45
|
syncedAt: integer("synced_at", { mode: "timestamp_ms" }),
|
|
23
46
|
createdAt: createdAt(),
|
|
24
47
|
updatedAt: updatedAt(),
|
|
25
|
-
}, (t) => [index("
|
|
48
|
+
}, (t) => [index("space_tenant").on(t.tenantId)]);
|
|
26
49
|
export const wizard = sqliteTable("wizard", {
|
|
27
50
|
id: text("id").primaryKey(),
|
|
28
|
-
|
|
51
|
+
spaceId: text("space_id")
|
|
29
52
|
.notNull()
|
|
30
|
-
.references(() =>
|
|
53
|
+
.references(() => space.id, { onDelete: "cascade" }),
|
|
31
54
|
tenantId: text("tenant_id").notNull(),
|
|
32
55
|
title: text("title").notNull(),
|
|
33
56
|
draft: text("draft", { mode: "json" }).$type().notNull(),
|
|
@@ -35,6 +58,8 @@ export const wizard = sqliteTable("wizard", {
|
|
|
35
58
|
shareToken: text("share_token").notNull(),
|
|
36
59
|
shareEnabled: integer("share_enabled", { mode: "boolean" }).notNull().default(true),
|
|
37
60
|
dailyRunLimit: integer("daily_run_limit").notNull().default(50),
|
|
61
|
+
/** How many emails guests' runs of this wizard send per day, from any address (broker/send.ts). */
|
|
62
|
+
dailyMailLimit: integer("daily_mail_limit").notNull().default(50),
|
|
38
63
|
starter: text("starter"),
|
|
39
64
|
/** The revision of the marketplace entry the wizard was made from. */
|
|
40
65
|
starterRevision: integer("starter_revision"),
|
|
@@ -46,10 +71,7 @@ export const wizard = sqliteTable("wizard", {
|
|
|
46
71
|
translate: integer("translate", { mode: "boolean" }).notNull().default(true),
|
|
47
72
|
createdAt: createdAt(),
|
|
48
73
|
updatedAt: updatedAt(),
|
|
49
|
-
}, (t) => [
|
|
50
|
-
uniqueIndex("wizard_share_token").on(t.shareToken),
|
|
51
|
-
index("wizard_project").on(t.projectId),
|
|
52
|
-
]);
|
|
74
|
+
}, (t) => [uniqueIndex("wizard_share_token").on(t.shareToken), index("wizard_space").on(t.spaceId)]);
|
|
53
75
|
export const wizardVersion = sqliteTable("wizard_version", {
|
|
54
76
|
id: text("id").primaryKey(),
|
|
55
77
|
wizardId: text("wizard_id")
|
|
@@ -114,6 +136,11 @@ export const run = sqliteTable("run", {
|
|
|
114
136
|
definition: text("definition", { mode: "json" }).$type().notNull(),
|
|
115
137
|
/** The workspace the run started with. */
|
|
116
138
|
files: text("files", { mode: "json" }).$type().notNull().default([]),
|
|
139
|
+
/**
|
|
140
|
+
* What the run may reach outside, from the definition it started on (broker/grant.ts); null
|
|
141
|
+
* on a run from before grants were kept, filled from its definition on first use.
|
|
142
|
+
*/
|
|
143
|
+
grant: text("grant", { mode: "json" }).$type(),
|
|
117
144
|
version: integer("version"),
|
|
118
145
|
mode: text("mode", { enum: ["test", "live"] }).notNull(),
|
|
119
146
|
/** The door the run came through: steps, chat, or a plugin's runner. Null: the page. */
|
|
@@ -235,24 +262,24 @@ export const asset = sqliteTable("asset", {
|
|
|
235
262
|
* A service imported as a connector, from the integrations registry or a pasted OpenAPI spec /
|
|
236
263
|
* MCP endpoint. The record is engenty's: actions, auth and source, normalised at import time.
|
|
237
264
|
*/
|
|
238
|
-
export const
|
|
239
|
-
|
|
265
|
+
export const spaceConnector = sqliteTable("space_connector", {
|
|
266
|
+
spaceId: text("space_id")
|
|
240
267
|
.notNull()
|
|
241
|
-
.references(() =>
|
|
268
|
+
.references(() => space.id, { onDelete: "cascade" }),
|
|
242
269
|
id: text("id").notNull(),
|
|
243
270
|
record: text("record", { mode: "json" }).$type().notNull(),
|
|
244
271
|
createdAt: createdAt(),
|
|
245
272
|
updatedAt: updatedAt(),
|
|
246
|
-
}, (t) => [primaryKey({ columns: [t.
|
|
273
|
+
}, (t) => [primaryKey({ columns: [t.spaceId, t.id] })]);
|
|
247
274
|
/**
|
|
248
|
-
* What a
|
|
275
|
+
* What a space holds for all its wizards: logos, assets (images, graphics, videos) and
|
|
249
276
|
* documents. `id` is the asset the content lives in. The first logo is the one end users see.
|
|
250
277
|
*/
|
|
251
|
-
export const
|
|
278
|
+
export const spaceFile = sqliteTable("space_file", {
|
|
252
279
|
id: text("id").primaryKey(),
|
|
253
|
-
|
|
280
|
+
spaceId: text("space_id")
|
|
254
281
|
.notNull()
|
|
255
|
-
.references(() =>
|
|
282
|
+
.references(() => space.id, { onDelete: "cascade" }),
|
|
256
283
|
kind: text("kind", { enum: ["logo", "asset", "document", "pattern"] }).notNull(),
|
|
257
284
|
name: text("name").notNull(),
|
|
258
285
|
mime: text("mime").notNull(),
|
|
@@ -279,24 +306,24 @@ export const projectFile = sqliteTable("project_file", {
|
|
|
279
306
|
createdAt: createdAt(),
|
|
280
307
|
updatedAt: updatedAt(),
|
|
281
308
|
}, (t) => [
|
|
282
|
-
index("
|
|
283
|
-
uniqueIndex("
|
|
309
|
+
index("space_file_space").on(t.spaceId, t.kind, t.position),
|
|
310
|
+
uniqueIndex("space_file_origin").on(t.spaceId, t.origin, t.originKey),
|
|
284
311
|
]);
|
|
285
312
|
/**
|
|
286
313
|
* The index of Knowledge: one unit per section of a page, row of a table, file, summary of a
|
|
287
314
|
* category's value, passage of a document read before pages, and passage of a plugin's text
|
|
288
315
|
* (`server.index`). Each unit's text starts with where it stands and its categories. Keywords
|
|
289
|
-
* live in two FTS5 tables, words (`
|
|
316
|
+
* live in two FTS5 tables, words (`space_chunk_fts`) and trigrams (`space_chunk_tri`), which
|
|
290
317
|
* triggers keep in step (see the migrations); `embedding` is the unit's vector as float32
|
|
291
318
|
* bytes, compared with libSQL's `vector_distance_cos`.
|
|
292
319
|
*/
|
|
293
|
-
export const
|
|
320
|
+
export const spaceChunk = sqliteTable("space_chunk", {
|
|
294
321
|
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
295
|
-
|
|
322
|
+
spaceId: text("space_id")
|
|
296
323
|
.notNull()
|
|
297
|
-
.references(() =>
|
|
324
|
+
.references(() => space.id, { onDelete: "cascade" }),
|
|
298
325
|
/** The document the passage is of; null for a plugin's text. */
|
|
299
|
-
fileId: text("file_id").references(() =>
|
|
326
|
+
fileId: text("file_id").references(() => spaceFile.id, { onDelete: "cascade" }),
|
|
300
327
|
/** What the unit is of: a page, a row (with its table), a table (FAQ format: a row), a value. */
|
|
301
328
|
pageId: text("page_id").references(() => spacePage.id, {
|
|
302
329
|
onDelete: "cascade",
|
|
@@ -325,13 +352,13 @@ export const projectChunk = sqliteTable("project_chunk", {
|
|
|
325
352
|
/** The model the vector was made with; only vectors of one model are compared. */
|
|
326
353
|
model: text("model"),
|
|
327
354
|
}, (t) => [
|
|
328
|
-
index("
|
|
329
|
-
index("
|
|
330
|
-
index("
|
|
331
|
-
index("
|
|
332
|
-
index("
|
|
333
|
-
index("
|
|
334
|
-
index("
|
|
355
|
+
index("space_chunk_space").on(t.spaceId, t.model),
|
|
356
|
+
index("space_chunk_file").on(t.fileId),
|
|
357
|
+
index("space_chunk_ref").on(t.spaceId, t.plugin, t.ref),
|
|
358
|
+
index("space_chunk_page").on(t.pageId),
|
|
359
|
+
index("space_chunk_row").on(t.rowId),
|
|
360
|
+
index("space_chunk_table").on(t.tableId),
|
|
361
|
+
index("space_chunk_value").on(t.valueId),
|
|
335
362
|
]);
|
|
336
363
|
// --- The space's data -------------------------------------------------------
|
|
337
364
|
// Tables and pages a space keeps, its own or one of its wizards'. Shared by everyone who works
|
|
@@ -340,9 +367,9 @@ export const projectChunk = sqliteTable("project_chunk", {
|
|
|
340
367
|
export const spaceTable = sqliteTable("space_table", {
|
|
341
368
|
id: text("id").primaryKey(),
|
|
342
369
|
tenantId: text("tenant_id").notNull(),
|
|
343
|
-
|
|
370
|
+
spaceId: text("space_id")
|
|
344
371
|
.notNull()
|
|
345
|
-
.references(() =>
|
|
372
|
+
.references(() => space.id, { onDelete: "cascade" }),
|
|
346
373
|
/** The wizard it belongs to; null: the space's own. */
|
|
347
374
|
wizardId: text("wizard_id").references(() => wizard.id, { onDelete: "cascade" }),
|
|
348
375
|
/**
|
|
@@ -370,13 +397,13 @@ export const spaceTable = sqliteTable("space_table", {
|
|
|
370
397
|
/** Why a person should look at it ("hardly readable"); null when nothing is in doubt. */
|
|
371
398
|
review: text("review"),
|
|
372
399
|
/** The file it was read from, kept as the evidence. */
|
|
373
|
-
fileId: text("file_id").references(() =>
|
|
400
|
+
fileId: text("file_id").references(() => spaceFile.id, { onDelete: "set null" }),
|
|
374
401
|
createdAt: createdAt(),
|
|
375
402
|
updatedAt: updatedAt(),
|
|
376
403
|
}, (t) => [
|
|
377
|
-
index("
|
|
404
|
+
index("space_table_space").on(t.spaceId, t.wizardId),
|
|
378
405
|
uniqueIndex("space_table_list").on(t.wizardId, t.list),
|
|
379
|
-
uniqueIndex("space_table_origin").on(t.
|
|
406
|
+
uniqueIndex("space_table_origin").on(t.spaceId, t.origin, t.originKey),
|
|
380
407
|
]);
|
|
381
408
|
/** A row of a table: cells by column id. Rows stand in the order they were added. */
|
|
382
409
|
export const spaceTableRow = sqliteTable("space_table_row", {
|
|
@@ -400,9 +427,9 @@ export const spaceTableRow = sqliteTable("space_table_row", {
|
|
|
400
427
|
export const spacePage = sqliteTable("space_page", {
|
|
401
428
|
id: text("id").primaryKey(),
|
|
402
429
|
tenantId: text("tenant_id").notNull(),
|
|
403
|
-
|
|
430
|
+
spaceId: text("space_id")
|
|
404
431
|
.notNull()
|
|
405
|
-
.references(() =>
|
|
432
|
+
.references(() => space.id, { onDelete: "cascade" }),
|
|
406
433
|
wizardId: text("wizard_id").references(() => wizard.id, { onDelete: "cascade" }),
|
|
407
434
|
parentId: text("parent_id").references(() => spacePage.id, {
|
|
408
435
|
onDelete: "cascade",
|
|
@@ -425,13 +452,13 @@ export const spacePage = sqliteTable("space_page", {
|
|
|
425
452
|
/** Why a person should look at it ("hardly readable"); null when nothing is in doubt. */
|
|
426
453
|
review: text("review"),
|
|
427
454
|
/** The file it was read from, kept as the evidence. */
|
|
428
|
-
fileId: text("file_id").references(() =>
|
|
455
|
+
fileId: text("file_id").references(() => spaceFile.id, { onDelete: "set null" }),
|
|
429
456
|
createdAt: createdAt(),
|
|
430
457
|
updatedAt: updatedAt(),
|
|
431
458
|
}, (t) => [
|
|
432
|
-
index("
|
|
459
|
+
index("space_page_space").on(t.spaceId, t.wizardId),
|
|
433
460
|
index("space_page_parent").on(t.parentId, t.position),
|
|
434
|
-
uniqueIndex("space_page_origin").on(t.
|
|
461
|
+
uniqueIndex("space_page_origin").on(t.spaceId, t.origin, t.originKey),
|
|
435
462
|
]);
|
|
436
463
|
// --- Categories -----------------------------------------------------------------
|
|
437
464
|
// Typed properties that run across Knowledge: set on pages, rows, tables and files, any number of
|
|
@@ -440,9 +467,9 @@ export const spacePage = sqliteTable("space_page", {
|
|
|
440
467
|
export const spaceCategory = sqliteTable("space_category", {
|
|
441
468
|
id: text("id").primaryKey(),
|
|
442
469
|
tenantId: text("tenant_id").notNull(),
|
|
443
|
-
|
|
470
|
+
spaceId: text("space_id")
|
|
444
471
|
.notNull()
|
|
445
|
-
.references(() =>
|
|
472
|
+
.references(() => space.id, { onDelete: "cascade" }),
|
|
446
473
|
name: text("name").notNull(),
|
|
447
474
|
type: text("type", { enum: ["choice", "date", "number", "text", "boolean"] }).notNull(),
|
|
448
475
|
/** A number's unit: `h`, `€`, `kg`. */
|
|
@@ -463,7 +490,7 @@ export const spaceCategory = sqliteTable("space_category", {
|
|
|
463
490
|
position: integer("position").notNull().default(0),
|
|
464
491
|
createdAt: createdAt(),
|
|
465
492
|
updatedAt: updatedAt(),
|
|
466
|
-
}, (t) => [uniqueIndex("space_category_name").on(t.
|
|
493
|
+
}, (t) => [uniqueIndex("space_category_name").on(t.spaceId, t.name)]);
|
|
467
494
|
/** A value of a choice: grows as items arrive; its summary is the summary of its items. */
|
|
468
495
|
export const spaceCategoryValue = sqliteTable("space_category_value", {
|
|
469
496
|
id: text("id").primaryKey(),
|
|
@@ -484,16 +511,16 @@ export const spaceCategoryValue = sqliteTable("space_category_value", {
|
|
|
484
511
|
*/
|
|
485
512
|
export const spaceItemCategory = sqliteTable("space_item_category", {
|
|
486
513
|
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
487
|
-
|
|
514
|
+
spaceId: text("space_id")
|
|
488
515
|
.notNull()
|
|
489
|
-
.references(() =>
|
|
516
|
+
.references(() => space.id, { onDelete: "cascade" }),
|
|
490
517
|
categoryId: text("category_id")
|
|
491
518
|
.notNull()
|
|
492
519
|
.references(() => spaceCategory.id, { onDelete: "cascade" }),
|
|
493
520
|
pageId: text("page_id").references(() => spacePage.id, { onDelete: "cascade" }),
|
|
494
521
|
rowId: text("row_id").references(() => spaceTableRow.id, { onDelete: "cascade" }),
|
|
495
522
|
tableId: text("table_id").references(() => spaceTable.id, { onDelete: "cascade" }),
|
|
496
|
-
fileId: text("file_id").references(() =>
|
|
523
|
+
fileId: text("file_id").references(() => spaceFile.id, { onDelete: "cascade" }),
|
|
497
524
|
valueId: text("value_id").references(() => spaceCategoryValue.id, { onDelete: "cascade" }),
|
|
498
525
|
text: text("text"),
|
|
499
526
|
num: real("num"),
|
|
@@ -516,9 +543,9 @@ export const spaceItemCategory = sqliteTable("space_item_category", {
|
|
|
516
543
|
export const spaceSkill = sqliteTable("space_skill", {
|
|
517
544
|
id: text("id").primaryKey(),
|
|
518
545
|
tenantId: text("tenant_id").notNull(),
|
|
519
|
-
|
|
546
|
+
spaceId: text("space_id")
|
|
520
547
|
.notNull()
|
|
521
|
-
.references(() =>
|
|
548
|
+
.references(() => space.id, { onDelete: "cascade" }),
|
|
522
549
|
/** Its name in the format: lower case and hyphens, unique in the space. */
|
|
523
550
|
name: text("name").notNull(),
|
|
524
551
|
description: text("description").notNull(),
|
|
@@ -539,7 +566,34 @@ export const spaceSkill = sqliteTable("space_skill", {
|
|
|
539
566
|
originHash: text("origin_hash"),
|
|
540
567
|
createdAt: createdAt(),
|
|
541
568
|
updatedAt: updatedAt(),
|
|
542
|
-
}, (t) => [uniqueIndex("space_skill_name").on(t.
|
|
569
|
+
}, (t) => [uniqueIndex("space_skill_name").on(t.spaceId, t.name)]);
|
|
570
|
+
// --- The broker: RWX ---------------------------------------------------------------
|
|
571
|
+
// One table of permissions per space (docs/plans/broker.md, "First: RWX"): who (a guest, a
|
|
572
|
+
// person, a role, Goose for a person, a wizard, a plugin) may read, write or execute what (a
|
|
573
|
+
// document, a table, a page …; `*` for all of a kind). Each flag is allow, deny or unset; unset
|
|
574
|
+
// means deny, and a deny wins over every allow. The runtime asks in broker/rwx.ts.
|
|
575
|
+
export const rwxRule = sqliteTable("rwx_rule", {
|
|
576
|
+
id: text("id").primaryKey(),
|
|
577
|
+
tenantId: text("tenant_id").notNull(),
|
|
578
|
+
spaceId: text("space_id")
|
|
579
|
+
.notNull()
|
|
580
|
+
.references(() => space.id, { onDelete: "cascade" }),
|
|
581
|
+
subjectKind: text("subject_kind", { enum: RWX_SUBJECT_KINDS }).notNull(),
|
|
582
|
+
/** `member`, `admin` or `owner` for a role; a user's, a wizard's or a plugin's id; null for a guest. */
|
|
583
|
+
subjectId: text("subject_id"),
|
|
584
|
+
resourceKind: text("resource_kind", { enum: RWX_RESOURCE_KINDS }).notNull(),
|
|
585
|
+
/** The resource's id, or `*` for every resource of the kind. */
|
|
586
|
+
resourceId: text("resource_id").notNull(),
|
|
587
|
+
r: text("r", { enum: RWX_FLAGS }),
|
|
588
|
+
w: text("w", { enum: RWX_FLAGS }),
|
|
589
|
+
x: text("x", { enum: RWX_FLAGS }),
|
|
590
|
+
/** Who wrote the row: a user's id, or `seed` for the rows every space starts with. */
|
|
591
|
+
createdBy: text("created_by").notNull(),
|
|
592
|
+
createdAt: createdAt(),
|
|
593
|
+
}, (t) => [
|
|
594
|
+
uniqueIndex("rwx_rule_key").on(t.spaceId, t.subjectKind, t.subjectId, t.resourceKind, t.resourceId),
|
|
595
|
+
index("rwx_rule_space").on(t.spaceId),
|
|
596
|
+
]);
|
|
543
597
|
export const assistantChat = sqliteTable("assistant_chat", {
|
|
544
598
|
id: text("id").primaryKey(),
|
|
545
599
|
tenantId: text("tenant_id").notNull(),
|
|
@@ -570,6 +624,102 @@ export const assistantMessage = sqliteTable("assistant_message", {
|
|
|
570
624
|
changed: integer("changed", { mode: "boolean" }).notNull().default(false),
|
|
571
625
|
createdAt: createdAt(),
|
|
572
626
|
}, (t) => [index("assistant_message_chat").on(t.chatId, t.createdAt)]);
|
|
627
|
+
// --- Work's chats (behind `workMode`) --------------------------------------------
|
|
628
|
+
// A chat belongs to a space, has members (people, later engenties) and lives in a section of
|
|
629
|
+
// the space's sidebar or in none. A sub-thread is a chat with a parent. A private chat is seen by
|
|
630
|
+
// its members only; any other chat by everyone of the tenant. The messages are Mastra's: a
|
|
631
|
+
// memory thread per chat (thread id = chat id, resource id = the space), in Mastra's tables of
|
|
632
|
+
// the same database (services/work-mastra.ts). The chat row keeps what the sidebar shows.
|
|
633
|
+
export const chatSection = sqliteTable("chat_section", {
|
|
634
|
+
id: text("id").primaryKey(),
|
|
635
|
+
tenantId: text("tenant_id").notNull(),
|
|
636
|
+
spaceId: text("space_id")
|
|
637
|
+
.notNull()
|
|
638
|
+
.references(() => space.id, { onDelete: "cascade" }),
|
|
639
|
+
name: text("name").notNull(),
|
|
640
|
+
position: integer("position").notNull().default(0),
|
|
641
|
+
createdBy: text("created_by").notNull(),
|
|
642
|
+
createdAt: createdAt(),
|
|
643
|
+
}, (t) => [index("chat_section_space").on(t.spaceId, t.position)]);
|
|
644
|
+
export const chat = sqliteTable("chat", {
|
|
645
|
+
id: text("id").primaryKey(),
|
|
646
|
+
tenantId: text("tenant_id").notNull(),
|
|
647
|
+
spaceId: text("space_id")
|
|
648
|
+
.notNull()
|
|
649
|
+
.references(() => space.id, { onDelete: "cascade" }),
|
|
650
|
+
title: text("title").notNull(),
|
|
651
|
+
sectionId: text("section_id").references(() => chatSection.id, { onDelete: "set null" }),
|
|
652
|
+
parentId: text("parent_id").references(() => chat.id, {
|
|
653
|
+
onDelete: "cascade",
|
|
654
|
+
}),
|
|
655
|
+
private: integer("private", { mode: "boolean" }).notNull().default(false),
|
|
656
|
+
createdBy: text("created_by").notNull(),
|
|
657
|
+
createdAt: createdAt(),
|
|
658
|
+
/** The last message's time, else when it was made: the sidebar's order. */
|
|
659
|
+
updatedAt: updatedAt(),
|
|
660
|
+
/** The last message for the sidebar: who wrote it ("ai" for the space's AI), its start. */
|
|
661
|
+
lastAuthorId: text("last_author_id"),
|
|
662
|
+
lastAuthorName: text("last_author_name"),
|
|
663
|
+
lastText: text("last_text"),
|
|
664
|
+
/** Since when the space's AI answers here; null while it doesn't. Others follow the turn. */
|
|
665
|
+
answeringSince: integer("answering_since", { mode: "timestamp_ms" }),
|
|
666
|
+
}, (t) => [index("chat_space").on(t.spaceId, t.updatedAt), index("chat_parent").on(t.parentId)]);
|
|
667
|
+
export const chatMember = sqliteTable("chat_member", {
|
|
668
|
+
chatId: text("chat_id")
|
|
669
|
+
.notNull()
|
|
670
|
+
.references(() => chat.id, { onDelete: "cascade" }),
|
|
671
|
+
kind: text("kind", { enum: ["person", "engenty"] }).notNull(),
|
|
672
|
+
/** A person's user id, an engenty's id. */
|
|
673
|
+
memberId: text("member_id").notNull(),
|
|
674
|
+
joinedAt: integer("joined_at", { mode: "timestamp_ms" }).notNull().default(now),
|
|
675
|
+
}, (t) => [
|
|
676
|
+
primaryKey({ columns: [t.chatId, t.kind, t.memberId] }),
|
|
677
|
+
index("chat_member_member").on(t.kind, t.memberId),
|
|
678
|
+
]);
|
|
679
|
+
/** What one person did with a chat: pinned it, archived it for themselves, read it up to when. */
|
|
680
|
+
export const chatState = sqliteTable("chat_state", {
|
|
681
|
+
chatId: text("chat_id")
|
|
682
|
+
.notNull()
|
|
683
|
+
.references(() => chat.id, { onDelete: "cascade" }),
|
|
684
|
+
userId: text("user_id").notNull(),
|
|
685
|
+
pinnedAt: integer("pinned_at", { mode: "timestamp_ms" }),
|
|
686
|
+
archivedAt: integer("archived_at", { mode: "timestamp_ms" }),
|
|
687
|
+
/** Null: never opened, or marked unread. */
|
|
688
|
+
readAt: integer("read_at", { mode: "timestamp_ms" }),
|
|
689
|
+
}, (t) => [primaryKey({ columns: [t.chatId, t.userId] })]);
|
|
690
|
+
/**
|
|
691
|
+
* A call of a tool that reaches past the space, held for a person's approval (Work chats, step 3
|
|
692
|
+
* piece 4). Approve runs the stored call once with the stored arguments; Deny doesn't. Either way
|
|
693
|
+
* the AI hears of it in the chat and goes on.
|
|
694
|
+
*/
|
|
695
|
+
export const chatApproval = sqliteTable("chat_approval", {
|
|
696
|
+
id: text("id").primaryKey(),
|
|
697
|
+
tenantId: text("tenant_id").notNull(),
|
|
698
|
+
chatId: text("chat_id")
|
|
699
|
+
.notNull()
|
|
700
|
+
.references(() => chat.id, { onDelete: "cascade" }),
|
|
701
|
+
toolName: text("tool_name").notNull(),
|
|
702
|
+
input: text("input", { mode: "json" }).$type(),
|
|
703
|
+
/** Who the turn was for: the call runs with their access, and they may decide. */
|
|
704
|
+
askedBy: text("asked_by").notNull(),
|
|
705
|
+
/**
|
|
706
|
+
* Whose decision it waits for: the asker's (a confirmed action, a plugin's tool), or the
|
|
707
|
+
* space's admins' („Mit Freigabe“ on a connection that signs in as the space, A7).
|
|
708
|
+
*/
|
|
709
|
+
heldFor: text("held_for", { enum: ["asker", "admins"] })
|
|
710
|
+
.notNull()
|
|
711
|
+
.default("asker"),
|
|
712
|
+
state: text("state", { enum: ["pending", "approved", "denied", "failed"] })
|
|
713
|
+
.notNull()
|
|
714
|
+
.default("pending"),
|
|
715
|
+
output: text("output", { mode: "json" }).$type(),
|
|
716
|
+
decidedBy: text("decided_by"),
|
|
717
|
+
decidedAt: integer("decided_at", { mode: "timestamp_ms" }),
|
|
718
|
+
createdAt: createdAt(),
|
|
719
|
+
}, (t) => [
|
|
720
|
+
index("chat_approval_chat").on(t.chatId, t.createdAt),
|
|
721
|
+
index("chat_approval_state").on(t.tenantId, t.state),
|
|
722
|
+
]);
|
|
573
723
|
// --- The wizard's store ------------------------------------------------------
|
|
574
724
|
// What a wizard keeps between runs for one person. `holder` is that person: "u:<userId>" for a
|
|
575
725
|
// signed-in admin, "v:<visitorId>" for an end user on a shared link.
|
|
@@ -634,26 +784,99 @@ export const marketplaceStar = sqliteTable("marketplace_star", {
|
|
|
634
784
|
createdAt: createdAt(),
|
|
635
785
|
}, (t) => [primaryKey({ columns: [t.tenantId, t.entryId] })]);
|
|
636
786
|
/**
|
|
637
|
-
*
|
|
638
|
-
*
|
|
787
|
+
* A connection of a space (docs/plans/capabilities.md, "Connections"): a service the space's
|
|
788
|
+
* admins set up, with how it signs in, who may use it and what each kind of action may do. One
|
|
789
|
+
* that signs in as the space keeps its secret here, sealed; one each person signs in to keeps
|
|
790
|
+
* theirs in `space_connection_sign_in`. Nobody owns it: `set_up_by` only records who did.
|
|
639
791
|
*/
|
|
640
|
-
export const
|
|
792
|
+
export const spaceConnection = sqliteTable("space_connection", {
|
|
641
793
|
id: text("id").primaryKey(),
|
|
642
|
-
|
|
643
|
-
projectId: text("project_id")
|
|
794
|
+
spaceId: text("space_id")
|
|
644
795
|
.notNull()
|
|
645
|
-
.references(() =>
|
|
646
|
-
/**
|
|
647
|
-
|
|
648
|
-
/**
|
|
796
|
+
.references(() => space.id, { onDelete: "cascade" }),
|
|
797
|
+
/** A built-in connector's id (`google-calendar`, `hubspot`) or a `space_connector` of the space. */
|
|
798
|
+
connectorId: text("connector_id").notNull(),
|
|
799
|
+
/** The plugin that set it up through `server.connections`, where one did. */
|
|
800
|
+
plugin: text("plugin"),
|
|
801
|
+
/** What people call it: „Vertrieb“, „Bestellungen“. */
|
|
802
|
+
name: text("name").notNull(),
|
|
803
|
+
/** A `space` sign-in: the account as the provider names it; null until signed in. */
|
|
804
|
+
label: text("label"),
|
|
805
|
+
signIn: text("sign_in", { enum: CONNECTION_SIGN_INS }).notNull(),
|
|
806
|
+
audience: text("audience", { enum: CONNECTION_AUDIENCES }).notNull(),
|
|
807
|
+
rules: text("rules", { mode: "json" }).$type().notNull(),
|
|
808
|
+
/** The connector's actions it is made for (the provider granted what they need); empty: every action. */
|
|
809
|
+
actions: text("actions", { mode: "json" }).$type().notNull().default([]),
|
|
810
|
+
/** A `space` sign-in's tokens or keys, sealed; the broker alone unseals them. */
|
|
811
|
+
secret: text("secret"),
|
|
812
|
+
setUpBy: text("set_up_by"),
|
|
813
|
+
setUpAt: integer("set_up_at", { mode: "timestamp_ms" }).notNull().default(now),
|
|
814
|
+
updatedAt: updatedAt(),
|
|
815
|
+
lastUsedAt: integer("last_used_at", { mode: "timestamp_ms" }),
|
|
816
|
+
}, (t) => [index("space_connection_space").on(t.spaceId)]);
|
|
817
|
+
/** A person's own sign-in to a connection in which each person signs in. `secret` is sealed. */
|
|
818
|
+
export const spaceConnectionSignIn = sqliteTable("space_connection_sign_in", {
|
|
819
|
+
connectionId: text("connection_id")
|
|
820
|
+
.notNull()
|
|
821
|
+
.references(() => spaceConnection.id, { onDelete: "cascade" }),
|
|
822
|
+
userId: text("user_id").notNull(),
|
|
823
|
+
/** The account as the provider names it. */
|
|
649
824
|
label: text("label").notNull(),
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
data: text("data").notNull(),
|
|
653
|
-
createdBy: text("created_by"),
|
|
654
|
-
createdAt: createdAt(),
|
|
825
|
+
secret: text("secret").notNull(),
|
|
826
|
+
signedInAt: integer("signed_in_at", { mode: "timestamp_ms" }).notNull().default(now),
|
|
655
827
|
updatedAt: updatedAt(),
|
|
656
|
-
}, (t) => [
|
|
828
|
+
}, (t) => [primaryKey({ columns: [t.connectionId, t.userId] })]);
|
|
829
|
+
/**
|
|
830
|
+
* Every call that reaches outside through the broker (`broker/call.ts`): who called, where, which
|
|
831
|
+
* connection and action, what was decided and how it went. Append-only; a secret never goes in.
|
|
832
|
+
*/
|
|
833
|
+
export const brokerLog = sqliteTable("broker_log", {
|
|
834
|
+
id: text("id").primaryKey(),
|
|
835
|
+
at: integer("at", { mode: "timestamp_ms" }).notNull(),
|
|
836
|
+
durationMs: integer("duration_ms").notNull(),
|
|
837
|
+
/** guest, person, admin, goose, plugin, step. */
|
|
838
|
+
whoKind: text("who_kind").notNull(),
|
|
839
|
+
whoId: text("who_id"),
|
|
840
|
+
runId: text("run_id"),
|
|
841
|
+
/** The step of the run that called; null outside a step. */
|
|
842
|
+
stepId: text("step_id"),
|
|
843
|
+
chatId: text("chat_id"),
|
|
844
|
+
wizardId: text("wizard_id"),
|
|
845
|
+
spaceId: text("space_id"),
|
|
846
|
+
connectionId: text("connection_id").notNull(),
|
|
847
|
+
actionId: text("action_id").notNull(),
|
|
848
|
+
/** read, write, destructive, send. */
|
|
849
|
+
kind: text("kind").notNull(),
|
|
850
|
+
/** The input's field names and sizes, one clipped value that is no secret, a hash of the whole. */
|
|
851
|
+
inputSummary: text("input_summary").notNull(),
|
|
852
|
+
/** allow, ask, deny. */
|
|
853
|
+
outcome: text("outcome").notNull(),
|
|
854
|
+
/** Which rule decided (broker/call.ts `decide`): `grant`, `audience`, `rules.write`, `policy`, …; null where none did. */
|
|
855
|
+
rule: text("rule"),
|
|
856
|
+
reason: text("reason"),
|
|
857
|
+
/** ok, declined, nobody, not_connected, or the error's class. */
|
|
858
|
+
result: text("result"),
|
|
859
|
+
resultSize: integer("result_size"),
|
|
860
|
+
critical: integer("critical", { mode: "boolean" }).notNull().default(false),
|
|
861
|
+
/** Which of the critical kinds (broker/log.ts `CriticalKind`); null where the row is not critical. */
|
|
862
|
+
criticalKind: text("critical_kind"),
|
|
863
|
+
}, (t) => [
|
|
864
|
+
index("broker_log_connection").on(t.connectionId, t.at),
|
|
865
|
+
index("broker_log_space").on(t.spaceId, t.at),
|
|
866
|
+
index("broker_log_critical").on(t.spaceId, t.critical, t.at),
|
|
867
|
+
index("broker_log_run").on(t.runId),
|
|
868
|
+
index("broker_log_wizard").on(t.wizardId, t.kind, t.at),
|
|
869
|
+
]);
|
|
870
|
+
/**
|
|
871
|
+
* When a person of the tenant was last in the app, and when they last opened Work's bell. The
|
|
872
|
+
* hourly mail of the broker's critical lines goes out only where no admin was in the app since
|
|
873
|
+
* the last one (broker/notify.ts); the bell's count is what came in since the bell was opened.
|
|
874
|
+
*/
|
|
875
|
+
export const personSeen = sqliteTable("person_seen", {
|
|
876
|
+
userId: text("user_id").primaryKey(),
|
|
877
|
+
seenAt: integer("seen_at", { mode: "timestamp_ms" }).notNull(),
|
|
878
|
+
bellSeenAt: integer("bell_seen_at", { mode: "timestamp_ms" }),
|
|
879
|
+
});
|
|
657
880
|
// --- The two-way sync -----------------------------------------------------------
|
|
658
881
|
// A space that syncs with the organization in the cloud (docs/plans/tenant-sync.md). Triggers
|
|
659
882
|
// on the synced tables note every write in `sync_change` (see the migration); the cloud numbers
|
|
@@ -661,13 +884,13 @@ export const pluginConnection = sqliteTable("plugin_connection", {
|
|
|
661
884
|
/** One change of an item: which space, which kind of item, which one. */
|
|
662
885
|
export const syncChange = sqliteTable("sync_change", {
|
|
663
886
|
seq: integer("seq").primaryKey({ autoIncrement: true }),
|
|
664
|
-
|
|
887
|
+
spaceId: text("space_id").notNull(),
|
|
665
888
|
kind: text("kind").notNull(),
|
|
666
889
|
item: text("item").notNull(),
|
|
667
890
|
at: integer("at", { mode: "timestamp_ms" }).notNull().default(now),
|
|
668
891
|
}, (t) => [
|
|
669
892
|
index("sync_change_item").on(t.kind, t.item),
|
|
670
|
-
index("
|
|
893
|
+
index("sync_change_space").on(t.spaceId, t.seq),
|
|
671
894
|
]);
|
|
672
895
|
/**
|
|
673
896
|
* Live changes (docs/plans/live-changes.md): triggers (`db/live-triggers.ts`) number every write
|
|
@@ -675,7 +898,7 @@ export const syncChange = sqliteTable("sync_change", {
|
|
|
675
898
|
*/
|
|
676
899
|
export const liveChange = sqliteTable("live_change", {
|
|
677
900
|
seq: integer("seq").primaryKey({ autoIncrement: true }),
|
|
678
|
-
|
|
901
|
+
spaceId: text("space_id"),
|
|
679
902
|
kind: text("kind").notNull(),
|
|
680
903
|
/** `put` or `del`. */
|
|
681
904
|
op: text("op").notNull(),
|
|
@@ -722,14 +945,14 @@ export const syncGuard = sqliteTable("sync_guard", {
|
|
|
722
945
|
export const syncBase = sqliteTable("sync_base", {
|
|
723
946
|
kind: text("kind").notNull(),
|
|
724
947
|
item: text("item").notNull(),
|
|
725
|
-
|
|
948
|
+
spaceId: text("space_id").notNull(),
|
|
726
949
|
seq: integer("seq").notNull(),
|
|
727
950
|
record: text("record", { mode: "json" }).$type(),
|
|
728
|
-
}, (t) => [primaryKey({ columns: [t.kind, t.item] }), index("
|
|
951
|
+
}, (t) => [primaryKey({ columns: [t.kind, t.item] }), index("sync_base_space").on(t.spaceId)]);
|
|
729
952
|
/** An item both sides changed, where the merge was not clean: it waits for the person. */
|
|
730
953
|
export const syncConflict = sqliteTable("sync_conflict", {
|
|
731
954
|
id: text("id").primaryKey(),
|
|
732
|
-
|
|
955
|
+
spaceId: text("space_id").notNull(),
|
|
733
956
|
kind: text("kind").notNull(),
|
|
734
957
|
item: text("item").notNull(),
|
|
735
958
|
/** The cloud's number of its version. */
|
|
@@ -742,7 +965,7 @@ export const syncConflict = sqliteTable("sync_conflict", {
|
|
|
742
965
|
/** A merge the sync made by itself: the notice on the item, and what undoes it. */
|
|
743
966
|
export const syncMerge = sqliteTable("sync_merge", {
|
|
744
967
|
id: text("id").primaryKey(),
|
|
745
|
-
|
|
968
|
+
spaceId: text("space_id").notNull(),
|
|
746
969
|
kind: text("kind").notNull(),
|
|
747
970
|
item: text("item").notNull(),
|
|
748
971
|
/** Labels of the places each side changed. */
|