@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,7 +1,8 @@
|
|
|
1
|
-
import { PROJECT_LIMITS, projectFileLimit, } from "@engenty/wizards-shared/projects";
|
|
2
1
|
import { note } from "@engenty/wizards-shared/run";
|
|
2
|
+
import { SPACE_LIMITS, spaceFileLimit, } from "@engenty/wizards-shared/spaces";
|
|
3
3
|
import { generateText } from "ai";
|
|
4
4
|
import { and, asc, count, eq, max } from "drizzle-orm";
|
|
5
|
+
import { assertRwx } from "../broker/rwx.js";
|
|
5
6
|
import { db, schema } from "../db/client.js";
|
|
6
7
|
import { documentMime, UnreadableDocument } from "../documents/parse.js";
|
|
7
8
|
import { loadAsset, removeAsset, replaceAsset, saveAsset } from "../files/storage.js";
|
|
@@ -11,11 +12,11 @@ import { spaceFileChanged } from "../plugins/events.js";
|
|
|
11
12
|
import { prompt } from "../prompts.js";
|
|
12
13
|
import { dropLinks, putLink } from "../tenants/control.js";
|
|
13
14
|
import { safeFetch } from "../tools/net-guard.js";
|
|
14
|
-
import {
|
|
15
|
+
import { requireWritableSpace } from "./access.js";
|
|
15
16
|
import { notFound, ServiceError } from "./errors.js";
|
|
16
17
|
import { convertDocument, fillCategories } from "./knowledge-model.js";
|
|
17
|
-
import { dropIndex, indexedFile, keepText, queueIndex } from "./project-index.js";
|
|
18
18
|
import { setItemCategories } from "./space-categories.js";
|
|
19
|
+
import { dropIndex, indexedFile, keepText, queueIndex } from "./space-index.js";
|
|
19
20
|
/** Reading a file takes seconds to a few minutes; a row still `pending` after this was cut off. */
|
|
20
21
|
const STALE_MS = 15 * 60_000;
|
|
21
22
|
const SEEN_BY_MODEL = ["image/png", "image/jpeg", "image/webp", "image/gif"];
|
|
@@ -37,25 +38,33 @@ export function fileView(row) {
|
|
|
37
38
|
createdAt: row.createdAt.toISOString(),
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
|
-
export function
|
|
41
|
-
return db.query.
|
|
41
|
+
export function spaceFiles(spaceId, kind) {
|
|
42
|
+
return db.query.spaceFile.findMany({
|
|
42
43
|
where: kind
|
|
43
|
-
? and(eq(schema.
|
|
44
|
-
: eq(schema.
|
|
45
|
-
orderBy: [asc(schema.
|
|
44
|
+
? and(eq(schema.spaceFile.spaceId, spaceId), eq(schema.spaceFile.kind, kind))
|
|
45
|
+
: eq(schema.spaceFile.spaceId, spaceId),
|
|
46
|
+
orderBy: [asc(schema.spaceFile.position), asc(schema.spaceFile.createdAt)],
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
|
-
export async function
|
|
49
|
-
const row = await db.query.
|
|
50
|
-
where: and(eq(schema.
|
|
49
|
+
export async function spaceFile(spaceId, fileId) {
|
|
50
|
+
const row = await db.query.spaceFile.findFirst({
|
|
51
|
+
where: and(eq(schema.spaceFile.id, fileId), eq(schema.spaceFile.spaceId, spaceId)),
|
|
51
52
|
});
|
|
52
53
|
if (!row) {
|
|
53
54
|
throw notFound();
|
|
54
55
|
}
|
|
55
56
|
return row;
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
/**
|
|
59
|
+
* A file's bytes. A document's go out only to a `who` the broker lets read it (broker/rwx.ts),
|
|
60
|
+
* and to nobody when none is given; a logo, pattern or asset is the brand's, not Knowledge, and
|
|
61
|
+
* asks nobody.
|
|
62
|
+
*/
|
|
63
|
+
export async function spaceFileContent(spaceId, fileId, who = []) {
|
|
64
|
+
const row = await spaceFile(spaceId, fileId);
|
|
65
|
+
if (row.kind === "document") {
|
|
66
|
+
await assertRwx(spaceId, who, { kind: "document", id: row.id }, "r");
|
|
67
|
+
}
|
|
59
68
|
const found = await loadAsset(row.id);
|
|
60
69
|
if (!found) {
|
|
61
70
|
throw notFound();
|
|
@@ -76,8 +85,8 @@ function accepts(kind, mime) {
|
|
|
76
85
|
}
|
|
77
86
|
return true;
|
|
78
87
|
}
|
|
79
|
-
export async function
|
|
80
|
-
await
|
|
88
|
+
export async function addSpaceFile(spaceId, input) {
|
|
89
|
+
await requireWritableSpace(spaceId);
|
|
81
90
|
const declared = documentMime(input.name, input.mime) || "application/octet-stream";
|
|
82
91
|
if (!accepts(input.kind, declared)) {
|
|
83
92
|
throw new ServiceError("invalid", input.kind === "logo"
|
|
@@ -86,7 +95,7 @@ export async function addProjectFile(projectId, input) {
|
|
|
86
95
|
? note("patternImageSvgPng")
|
|
87
96
|
: note("filesGoHere"));
|
|
88
97
|
}
|
|
89
|
-
const limit =
|
|
98
|
+
const limit = spaceFileLimit(input.kind, declared);
|
|
90
99
|
if (!input.data.byteLength || input.data.byteLength > limit) {
|
|
91
100
|
throw new ServiceError("invalid", note("chooseFileUpTo", { mb: Math.round(limit / 1_000_000) }));
|
|
92
101
|
}
|
|
@@ -98,16 +107,16 @@ export async function addProjectFile(projectId, input) {
|
|
|
98
107
|
fallbackName: "datei",
|
|
99
108
|
});
|
|
100
109
|
const { mime, data, name } = checked;
|
|
101
|
-
const scope = and(eq(schema.
|
|
110
|
+
const scope = and(eq(schema.spaceFile.spaceId, spaceId), eq(schema.spaceFile.kind, input.kind));
|
|
102
111
|
const [{ n, last }] = await db
|
|
103
|
-
.select({ n: count(), last: max(schema.
|
|
104
|
-
.from(schema.
|
|
112
|
+
.select({ n: count(), last: max(schema.spaceFile.position) })
|
|
113
|
+
.from(schema.spaceFile)
|
|
105
114
|
.where(scope);
|
|
106
|
-
if (n >=
|
|
107
|
-
throw new ServiceError("refused", note("roomMostFiles", { count:
|
|
115
|
+
if (n >= SPACE_LIMITS.files[input.kind]) {
|
|
116
|
+
throw new ServiceError("refused", note("roomMostFiles", { count: SPACE_LIMITS.files[input.kind] }));
|
|
108
117
|
}
|
|
109
118
|
const ref = await saveAsset({
|
|
110
|
-
kind: input.kind === "logo" ? "logo" : "
|
|
119
|
+
kind: input.kind === "logo" ? "logo" : "space",
|
|
111
120
|
mime,
|
|
112
121
|
name,
|
|
113
122
|
data,
|
|
@@ -115,10 +124,10 @@ export async function addProjectFile(projectId, input) {
|
|
|
115
124
|
const description = input.description?.trim().slice(0, 600) ?? "";
|
|
116
125
|
const work = input.kind === "document" || (!description && SEEN_BY_MODEL.includes(mime));
|
|
117
126
|
const [row] = await db
|
|
118
|
-
.insert(schema.
|
|
127
|
+
.insert(schema.spaceFile)
|
|
119
128
|
.values({
|
|
120
129
|
id: ref.id,
|
|
121
|
-
|
|
130
|
+
spaceId,
|
|
122
131
|
kind: input.kind,
|
|
123
132
|
name,
|
|
124
133
|
mime,
|
|
@@ -142,15 +151,15 @@ export async function addProjectFile(projectId, input) {
|
|
|
142
151
|
return row;
|
|
143
152
|
}
|
|
144
153
|
/**
|
|
145
|
-
* Fetches a file from a public web address into the
|
|
154
|
+
* Fetches a file from a public web address into the space, as an upload of it would add it.
|
|
146
155
|
* A drawing a page holds inline comes as a `data:image/svg+xml` address. A web page where a
|
|
147
156
|
* picture was asked for is refused with the reason `page`.
|
|
148
157
|
*/
|
|
149
|
-
export async function
|
|
158
|
+
export async function addSpaceFileFromUrl(spaceId, input) {
|
|
150
159
|
const { url, kind, signal } = input;
|
|
151
160
|
const inline = url.match(/^data:image\/svg\+xml;base64,([A-Za-z0-9+/=]+)$/);
|
|
152
161
|
if (inline) {
|
|
153
|
-
return
|
|
162
|
+
return addSpaceFile(spaceId, {
|
|
154
163
|
kind,
|
|
155
164
|
name: `${kind}.svg`,
|
|
156
165
|
mime: "image/svg+xml",
|
|
@@ -175,12 +184,12 @@ export async function addProjectFileFromUrl(projectId, input) {
|
|
|
175
184
|
url: res.url,
|
|
176
185
|
});
|
|
177
186
|
}
|
|
178
|
-
if (Number(res.headers.get("content-length") ?? 0) >
|
|
187
|
+
if (Number(res.headers.get("content-length") ?? 0) > spaceFileLimit(kind, mime)) {
|
|
179
188
|
throw new ServiceError("invalid", note("addressFileTooLarge"));
|
|
180
189
|
}
|
|
181
190
|
const data = new Uint8Array(await res.arrayBuffer());
|
|
182
191
|
const name = decodeURIComponent(new URL(res.url).pathname.split("/").pop() || kind);
|
|
183
|
-
return
|
|
192
|
+
return addSpaceFile(spaceId, {
|
|
184
193
|
kind,
|
|
185
194
|
name,
|
|
186
195
|
mime,
|
|
@@ -206,11 +215,11 @@ async function slot(run) {
|
|
|
206
215
|
waiting.shift()?.();
|
|
207
216
|
}
|
|
208
217
|
}
|
|
209
|
-
async function
|
|
210
|
-
const p = await db.query.
|
|
218
|
+
async function spaceLine(spaceId) {
|
|
219
|
+
const p = await db.query.space.findFirst({ where: eq(schema.space.id, spaceId) });
|
|
211
220
|
return [p?.brand.name || p?.name, p?.brand.about?.slice(0, 300)].filter(Boolean).join(" — ");
|
|
212
221
|
}
|
|
213
|
-
/** One sentence about a picture, for whoever picks among the
|
|
222
|
+
/** One sentence about a picture, for whoever picks among the space's files later. */
|
|
214
223
|
async function describeImage(row, data) {
|
|
215
224
|
const seer = await textModel("low");
|
|
216
225
|
const result = await generateText({
|
|
@@ -224,7 +233,7 @@ async function describeImage(row, data) {
|
|
|
224
233
|
{ type: "file", data, mediaType: row.mime, filename: row.name },
|
|
225
234
|
{
|
|
226
235
|
type: "text",
|
|
227
|
-
text: `
|
|
236
|
+
text: `Space: ${await spaceLine(row.spaceId)}\nFile: ${row.name} (${row.kind})`,
|
|
228
237
|
},
|
|
229
238
|
],
|
|
230
239
|
},
|
|
@@ -253,8 +262,8 @@ async function categorize(row, items, text) {
|
|
|
253
262
|
: first?.startsWith("t:")
|
|
254
263
|
? { tableId: first.slice(2) }
|
|
255
264
|
: { fileId: row.id };
|
|
256
|
-
const changed = await fillCategories(row.
|
|
257
|
-
console.error("[
|
|
265
|
+
const changed = await fillCategories(row.spaceId, ref, text || row.description, row.name).catch((err) => {
|
|
266
|
+
console.error("[space-file] categories", row.name, err);
|
|
258
267
|
return false;
|
|
259
268
|
});
|
|
260
269
|
if (changed) {
|
|
@@ -269,9 +278,9 @@ async function categorize(row, items, text) {
|
|
|
269
278
|
async function prepare(row) {
|
|
270
279
|
await slot(async () => {
|
|
271
280
|
const set = (values) => db
|
|
272
|
-
.update(schema.
|
|
281
|
+
.update(schema.spaceFile)
|
|
273
282
|
.set({ ...values, updatedAt: new Date() })
|
|
274
|
-
.where(eq(schema.
|
|
283
|
+
.where(eq(schema.spaceFile.id, row.id));
|
|
275
284
|
try {
|
|
276
285
|
const found = await loadAsset(row.id);
|
|
277
286
|
if (!found) {
|
|
@@ -302,7 +311,7 @@ async function prepare(row) {
|
|
|
302
311
|
spaceFileChanged("space.file.ready", row);
|
|
303
312
|
}
|
|
304
313
|
catch (err) {
|
|
305
|
-
console.error("[
|
|
314
|
+
console.error("[space-file]", row.name, err);
|
|
306
315
|
await set({
|
|
307
316
|
status: "failed",
|
|
308
317
|
error: err instanceof UnreadableDocument ? err.message : "Reading didn’t work. Try again.",
|
|
@@ -310,32 +319,32 @@ async function prepare(row) {
|
|
|
310
319
|
}
|
|
311
320
|
});
|
|
312
321
|
}
|
|
313
|
-
export async function
|
|
314
|
-
await
|
|
315
|
-
const row = await
|
|
322
|
+
export async function reindexSpaceFile(spaceId, fileId) {
|
|
323
|
+
await requireWritableSpace(spaceId);
|
|
324
|
+
const row = await spaceFile(spaceId, fileId);
|
|
316
325
|
if (row.kind !== "document") {
|
|
317
326
|
throw new ServiceError("invalid", note("onlyDocumentsIndex"));
|
|
318
327
|
}
|
|
319
328
|
const [pending] = await db
|
|
320
|
-
.update(schema.
|
|
329
|
+
.update(schema.spaceFile)
|
|
321
330
|
.set({ status: "pending", error: null, updatedAt: new Date() })
|
|
322
|
-
.where(eq(schema.
|
|
331
|
+
.where(eq(schema.spaceFile.id, row.id))
|
|
323
332
|
.returning();
|
|
324
333
|
void prepare(pending);
|
|
325
334
|
return pending;
|
|
326
335
|
}
|
|
327
|
-
export async function
|
|
328
|
-
await
|
|
329
|
-
const row = await
|
|
336
|
+
export async function updateSpaceFile(spaceId, fileId, patch) {
|
|
337
|
+
await requireWritableSpace(spaceId);
|
|
338
|
+
const row = await spaceFile(spaceId, fileId);
|
|
330
339
|
const [updated] = await db
|
|
331
|
-
.update(schema.
|
|
340
|
+
.update(schema.spaceFile)
|
|
332
341
|
.set({
|
|
333
342
|
...(patch.name?.trim() ? { name: patch.name.trim().slice(0, 120) } : {}),
|
|
334
343
|
...(patch.description !== undefined
|
|
335
344
|
? { description: patch.description.trim().slice(0, 600) }
|
|
336
345
|
: {}),
|
|
337
346
|
})
|
|
338
|
-
.where(eq(schema.
|
|
347
|
+
.where(eq(schema.spaceFile.id, row.id))
|
|
339
348
|
.returning();
|
|
340
349
|
// Its name and description are what the index finds an asset by.
|
|
341
350
|
if (indexedFile(updated) && (patch.name !== undefined || patch.description !== undefined)) {
|
|
@@ -344,9 +353,9 @@ export async function updateProjectFile(projectId, fileId, patch) {
|
|
|
344
353
|
return updated;
|
|
345
354
|
}
|
|
346
355
|
/** Puts the files of one kind into the order of `ids`; the first logo is the one end users see. */
|
|
347
|
-
export async function
|
|
348
|
-
await
|
|
349
|
-
const rows = await
|
|
356
|
+
export async function orderSpaceFiles(spaceId, kind, ids) {
|
|
357
|
+
await requireWritableSpace(spaceId);
|
|
358
|
+
const rows = await spaceFiles(spaceId, kind);
|
|
350
359
|
const order = [...ids.filter((id) => rows.some((r) => r.id === id))];
|
|
351
360
|
for (const r of rows) {
|
|
352
361
|
if (!order.includes(r.id)) {
|
|
@@ -354,7 +363,7 @@ export async function orderProjectFiles(projectId, kind, ids) {
|
|
|
354
363
|
}
|
|
355
364
|
}
|
|
356
365
|
for (const [position, id] of order.entries()) {
|
|
357
|
-
await db.update(schema.
|
|
366
|
+
await db.update(schema.spaceFile).set({ position }).where(eq(schema.spaceFile.id, id));
|
|
358
367
|
}
|
|
359
368
|
}
|
|
360
369
|
async function removeRow(row) {
|
|
@@ -362,20 +371,20 @@ async function removeRow(row) {
|
|
|
362
371
|
// What it was read into goes with it; what a person changed since stays.
|
|
363
372
|
const { dropConverted } = await import("./knowledge-model.js");
|
|
364
373
|
await dropConverted(row.id);
|
|
365
|
-
await db.delete(schema.
|
|
374
|
+
await db.delete(schema.spaceFile).where(eq(schema.spaceFile.id, row.id));
|
|
366
375
|
await removeAsset(row.id);
|
|
367
376
|
if (row.kind === "logo" || row.mime.startsWith("font/")) {
|
|
368
377
|
await dropLinks([row.id]);
|
|
369
378
|
}
|
|
370
379
|
spaceFileChanged("space.file.removed", row);
|
|
371
380
|
}
|
|
372
|
-
export async function
|
|
373
|
-
await
|
|
374
|
-
await removeRow(await
|
|
381
|
+
export async function removeSpaceFile(spaceId, fileId) {
|
|
382
|
+
await requireWritableSpace(spaceId);
|
|
383
|
+
await removeRow(await spaceFile(spaceId, fileId));
|
|
375
384
|
}
|
|
376
|
-
/** Before a
|
|
377
|
-
export async function
|
|
378
|
-
for (const row of await
|
|
385
|
+
/** Before a space goes: its files leave the object store and the public links. */
|
|
386
|
+
export async function removeSpaceFiles(spaceId) {
|
|
387
|
+
for (const row of await spaceFiles(spaceId)) {
|
|
379
388
|
await removeRow(row);
|
|
380
389
|
}
|
|
381
390
|
}
|
|
@@ -386,13 +395,13 @@ export async function removeProjectFiles(projectId) {
|
|
|
386
395
|
* a step reads of it; without one only its name and description are found.
|
|
387
396
|
*/
|
|
388
397
|
export async function putOriginFile(origin, input) {
|
|
389
|
-
await
|
|
398
|
+
await requireWritableSpace(input.space);
|
|
390
399
|
const key = input.key.trim().slice(0, 300);
|
|
391
|
-
const existing = await db.query.
|
|
392
|
-
where: and(eq(schema.
|
|
400
|
+
const existing = await db.query.spaceFile.findFirst({
|
|
401
|
+
where: and(eq(schema.spaceFile.spaceId, input.space), eq(schema.spaceFile.origin, origin), eq(schema.spaceFile.originKey, key)),
|
|
393
402
|
});
|
|
394
403
|
const mime = documentMime(input.name, input.mime) || "application/octet-stream";
|
|
395
|
-
if (!input.data.byteLength || input.data.byteLength >
|
|
404
|
+
if (!input.data.byteLength || input.data.byteLength > spaceFileLimit("document", mime)) {
|
|
396
405
|
throw new ServiceError("invalid", note("emptyTooLargeDocument", { name: input.name }));
|
|
397
406
|
}
|
|
398
407
|
const name = input.name.slice(0, 120) || "datei";
|
|
@@ -412,21 +421,21 @@ export async function putOriginFile(origin, input) {
|
|
|
412
421
|
if (existing) {
|
|
413
422
|
// New content under the id it has: pages that name it as their original keep it.
|
|
414
423
|
await replaceAsset(existing.id, { mime, name, data: input.data });
|
|
415
|
-
await db.update(schema.
|
|
424
|
+
await db.update(schema.spaceFile).set(values).where(eq(schema.spaceFile.id, existing.id));
|
|
416
425
|
}
|
|
417
426
|
else {
|
|
418
427
|
const [{ n, last }] = await db
|
|
419
|
-
.select({ n: count(), last: max(schema.
|
|
420
|
-
.from(schema.
|
|
421
|
-
.where(and(eq(schema.
|
|
422
|
-
if (n >=
|
|
423
|
-
throw new ServiceError("refused", note("spaceMostDocuments", { count:
|
|
428
|
+
.select({ n: count(), last: max(schema.spaceFile.position) })
|
|
429
|
+
.from(schema.spaceFile)
|
|
430
|
+
.where(and(eq(schema.spaceFile.spaceId, input.space), eq(schema.spaceFile.kind, "document")));
|
|
431
|
+
if (n >= SPACE_LIMITS.files.document) {
|
|
432
|
+
throw new ServiceError("refused", note("spaceMostDocuments", { count: SPACE_LIMITS.files.document }));
|
|
424
433
|
}
|
|
425
|
-
const ref = await saveAsset({ kind: "
|
|
434
|
+
const ref = await saveAsset({ kind: "space", mime, name, data: input.data });
|
|
426
435
|
id = ref.id;
|
|
427
|
-
await db.insert(schema.
|
|
436
|
+
await db.insert(schema.spaceFile).values({
|
|
428
437
|
id: ref.id,
|
|
429
|
-
|
|
438
|
+
spaceId: input.space,
|
|
430
439
|
kind: "document",
|
|
431
440
|
position: (last ?? -1) + 1,
|
|
432
441
|
origin,
|
|
@@ -441,9 +450,9 @@ export async function putOriginFile(origin, input) {
|
|
|
441
450
|
return id;
|
|
442
451
|
}
|
|
443
452
|
/** Takes out a plugin's files, by key or all of them in the space; returns how many went. */
|
|
444
|
-
export async function removeOriginFiles(origin,
|
|
445
|
-
const rows = await db.query.
|
|
446
|
-
where: and(eq(schema.
|
|
453
|
+
export async function removeOriginFiles(origin, spaceId, key) {
|
|
454
|
+
const rows = await db.query.spaceFile.findMany({
|
|
455
|
+
where: and(eq(schema.spaceFile.spaceId, spaceId), eq(schema.spaceFile.origin, origin), key === undefined ? undefined : eq(schema.spaceFile.originKey, key)),
|
|
447
456
|
});
|
|
448
457
|
for (const row of rows) {
|
|
449
458
|
await removeRow(row);
|