@engenty/wizards-runtime 0.13.0 → 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 +101 -67
- package/apps/runtime/dist/agents/website.js +1 -1
- package/apps/runtime/dist/app.js +17 -1
- 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/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 +40 -5
- 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/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 +16 -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/resources.js +43 -12
- package/apps/runtime/dist/engine/runner.js +75 -23
- package/apps/runtime/dist/engine/steps.js +30 -12
- package/apps/runtime/dist/engine/template.js +18 -1
- package/apps/runtime/dist/env.js +9 -4
- package/apps/runtime/dist/index.js +18 -2
- 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 +7 -0
- package/apps/runtime/dist/mcp/flow-app.js +1 -1
- package/apps/runtime/dist/mcp/tools.js +75 -34
- package/apps/runtime/dist/models.js +1 -1
- package/apps/runtime/dist/motion-graphics/project.js +8 -8
- 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 +7 -7
- package/apps/runtime/dist/prompts/mcp.md +6 -6
- package/apps/runtime/dist/prompts/services.md +4 -4
- package/apps/runtime/dist/prompts/step.md +2 -2
- 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/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 +54 -33
- package/apps/runtime/dist/routes/skills.js +6 -6
- package/apps/runtime/dist/routes/studio.js +153 -144
- package/apps/runtime/dist/routes/work.js +199 -0
- 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 +74 -7
- 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 +7 -7
- 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 +23 -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 -612
- 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 +38 -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 +28 -13
- 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-SwyId00t.js → ChangelogDialog-Duab4zTO.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-BwZsk5Al.js → CodeEditor-nxoOt8ge.js} +1 -1
- package/apps/web/dist/assets/EditorPage-ZrgGpYMC.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-DtSpjVTl.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-TwKzzMtA.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-Brd-xPUJ.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-DhkHteoJ.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-G-XYaDgR.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-BYZTwJTD.js → upload-BchUnQGV.js} +1 -1
- package/apps/web/dist/assets/{useMutation-D0QP_k2-.js → useMutation-DEkZhp5c.js} +1 -1
- package/apps/web/dist/assets/{volume-2-CVHoxdGM.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 +6 -1
- package/node_modules/@engenty/wizards-shared/dist/assistant.js +6 -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 +150 -8
- package/node_modules/@engenty/wizards-shared/dist/definition.js +46 -11
- 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 +26 -2
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +26 -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.js +3 -1
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +54 -6
- package/node_modules/@engenty/wizards-shared/dist/run.js +85 -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/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-B-JxkELB.js +0 -1
- package/apps/web/dist/assets/EditorPage-DQ_2FOzI.js +0 -3
- package/apps/web/dist/assets/Marketplace-DoH4YO3D.js +0 -2
- package/apps/web/dist/assets/NewWizardChannels-Tgoexgj4.js +0 -1
- package/apps/web/dist/assets/NewWizardPage-B24AF482.js +0 -7
- package/apps/web/dist/assets/OnboardingPage-BEvq4slJ.js +0 -1
- package/apps/web/dist/assets/PreviewPane-B_v7Y8R7.js +0 -10
- package/apps/web/dist/assets/ProjectPage-ClRuhFJo.js +0 -10
- package/apps/web/dist/assets/PublicRunner-MicrpVsv.js +0 -1
- package/apps/web/dist/assets/ReadOnly-BXjv-MSv.js +0 -1
- package/apps/web/dist/assets/SettingsPage-DY8O1r43.js +0 -2
- package/apps/web/dist/assets/SetupPage-BOVkVpMu.js +0 -1
- package/apps/web/dist/assets/SharePage-DXGzJSnR.js +0 -1
- package/apps/web/dist/assets/SkillEditor-BzzTDeaU.js +0 -1
- package/apps/web/dist/assets/changelog-BLdS-0Bj.js +0 -1
- package/apps/web/dist/assets/esm-BdxDT9Km.js +0 -7
- package/apps/web/dist/assets/i18n-8-Sw11tB.js +0 -55
- package/apps/web/dist/assets/index-OsdQFHmh.js +0 -49
- package/apps/web/dist/assets/index-QPipX5Fi.css +0 -1
- package/apps/web/dist/assets/lock-C0uxcOlq.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-BWI-KENJ.js +0 -2
- package/apps/web/dist/assets/theme-D7krsx0_.js +0 -11
- package/apps/web/dist/assets/ui-DSXG3f49.js +0 -83
- /package/apps/runtime/dist/db/migrations/tenant/{0027_space_skill.sql → 0030_space_skill.sql} +0 -0
|
@@ -4,9 +4,10 @@ import { isTextMime } from "@engenty/wizards-shared/workspace";
|
|
|
4
4
|
import { Agent } from "@mastra/core/agent";
|
|
5
5
|
import { createTool } from "@mastra/core/tools";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
import { exampleWizard,
|
|
7
|
+
import { exampleWizard, spaceLines, } from "../authoring/guide.js";
|
|
8
8
|
import { wizardOpSchema } from "../authoring/ops.js";
|
|
9
9
|
import { importFromRegistry, listConnectors, searchRegistry } from "../connectors/external.js";
|
|
10
|
+
import { guideSpaceConnections } from "../connectors/space-connections.js";
|
|
10
11
|
import { agentModel, attachTools, chatModel, costOf, gatewayTools, totalUsage, } from "../models.js";
|
|
11
12
|
import { pluginToolsOf } from "../plugins/registry.js";
|
|
12
13
|
import { prompt } from "../prompts.js";
|
|
@@ -23,14 +24,14 @@ import { attempt as attemptTool, imageOutput } from "../tools/shared.js";
|
|
|
23
24
|
import { runScript } from "../widgets/script.js";
|
|
24
25
|
import { thoughtLine } from "./thought.js";
|
|
25
26
|
const MAX_STEPS = 45;
|
|
26
|
-
function systemPrompt(connectors, pluginTools) {
|
|
27
|
+
function systemPrompt(connectors, pluginTools, connections) {
|
|
27
28
|
return `${prompt("architect", "system", {
|
|
28
29
|
persona: prompt("architect", "persona"),
|
|
29
30
|
schema: prompt("authoring", "schema"),
|
|
30
31
|
principles: prompt("authoring", "principles", { sandbox: sandboxGuideLine() }),
|
|
31
32
|
widgets: prompt("authoring", "widgets"),
|
|
32
33
|
surfaces: prompt("authoring", "surfaces"),
|
|
33
|
-
|
|
34
|
+
space_tools: spaceLines(connectors, pluginTools, connections),
|
|
34
35
|
example: exampleWizard(),
|
|
35
36
|
how_you_work: prompt("architect", "how_you_work"),
|
|
36
37
|
})}\n\n${contentPolicy()}`;
|
|
@@ -80,7 +81,7 @@ const attempt = (run) => attemptTool(run, { limit: Number.POSITIVE_INFINITY });
|
|
|
80
81
|
function buildTools(input, resolved, wrote) {
|
|
81
82
|
const { userId, wizardId } = input;
|
|
82
83
|
const signal = input.signal;
|
|
83
|
-
const
|
|
84
|
+
const spaceId = async () => (await ownedWizard(userId, wizardId)).spaceId;
|
|
84
85
|
const tools = {
|
|
85
86
|
find_connectors: createTool({
|
|
86
87
|
id: "find_connectors",
|
|
@@ -99,7 +100,7 @@ function buildTools(input, resolved, wrote) {
|
|
|
99
100
|
.describe("Default: the service's MCP server if it has one, else its OpenAPI spec."),
|
|
100
101
|
}),
|
|
101
102
|
execute: async ({ domain, kind }) => attempt(async () => {
|
|
102
|
-
const result = await importFromRegistry(userId, await
|
|
103
|
+
const result = await importFromRegistry(userId, await spaceId(), { domain, kind });
|
|
103
104
|
wrote();
|
|
104
105
|
return result;
|
|
105
106
|
}),
|
|
@@ -108,7 +109,7 @@ function buildTools(input, resolved, wrote) {
|
|
|
108
109
|
id: "list_connectors",
|
|
109
110
|
description: prompt("mcp", "tool.list_connectors"),
|
|
110
111
|
inputSchema: z.object({}),
|
|
111
|
-
execute: async () => attempt(async () => ({ connectors: await listConnectors(await
|
|
112
|
+
execute: async () => attempt(async () => ({ connectors: await listConnectors(await spaceId()) })),
|
|
112
113
|
}),
|
|
113
114
|
replace_wizard: createTool({
|
|
114
115
|
id: "replace_wizard",
|
|
@@ -316,7 +317,7 @@ export async function runArchitect(input) {
|
|
|
316
317
|
// The system prompt is long and identical on every turn: cache it.
|
|
317
318
|
instructions: {
|
|
318
319
|
role: "system",
|
|
319
|
-
content: systemPrompt(input.connectors, await pluginToolsOf(currentTenant())),
|
|
320
|
+
content: systemPrompt(input.connectors, await pluginToolsOf(currentTenant()), await guideSpaceConnections(w.spaceId)),
|
|
320
321
|
providerOptions: { anthropic: { cacheControl: { type: "ephemeral" } } },
|
|
321
322
|
},
|
|
322
323
|
model: agentModel(resolved),
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { CONFIRM_ACTION_TOOL } from "@engenty/wizards-shared/assistant";
|
|
2
|
+
import { and, eq } from "drizzle-orm";
|
|
3
|
+
import { nanoid } from "nanoid";
|
|
4
|
+
import { db, schema } from "../db/client.js";
|
|
5
|
+
import { prompt } from "../prompts.js";
|
|
6
|
+
import { isAdminRole } from "../services/access.js";
|
|
7
|
+
import { closedToMe } from "../services/members-studio.js";
|
|
8
|
+
import { callConnection, connectionResult, connectionToolsOf, makeConnectionTools, usableConnections, } from "../tools/connections.js";
|
|
9
|
+
import { attempt } from "../tools/shared.js";
|
|
10
|
+
/*
|
|
11
|
+
* Goose's connections (docs/plans/capabilities.md, "Who sees what"): a personal copilot works
|
|
12
|
+
* with its person's own sign-ins alone. Its tools are the connections in which each person signs
|
|
13
|
+
* in, in the spaces where this person has, within their audience. Reads run; a write, a send or a
|
|
14
|
+
* delete asks the person first, on a card in Goose's own chat (the browser's `confirm_action`),
|
|
15
|
+
* with no hold for the admins: it is the person's own account. A connection that signs in as the
|
|
16
|
+
* space is never among them.
|
|
17
|
+
*/
|
|
18
|
+
/** The widest the person sees of what would be sent. */
|
|
19
|
+
const ASK_INPUT = 4000;
|
|
20
|
+
/** The person's own sign-ins, with the connection each belongs to. */
|
|
21
|
+
async function signedInConnections(userId) {
|
|
22
|
+
const rows = await db
|
|
23
|
+
.select({ row: schema.spaceConnection })
|
|
24
|
+
.from(schema.spaceConnectionSignIn)
|
|
25
|
+
.innerJoin(schema.spaceConnection, eq(schema.spaceConnection.id, schema.spaceConnectionSignIn.connectionId))
|
|
26
|
+
.where(and(eq(schema.spaceConnectionSignIn.userId, userId), eq(schema.spaceConnection.signIn, "person")));
|
|
27
|
+
return rows.map((r) => r.row);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Asks the person on a card in Goose's chat, where the browser offers one; `undefined` where it
|
|
31
|
+
* does not (an installed AI client as the model), so the broker answers that nobody can be asked.
|
|
32
|
+
*/
|
|
33
|
+
function confirmInChat(input) {
|
|
34
|
+
if (!input.browserTools.some((t) => t.name === CONFIRM_ACTION_TOOL)) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return async (ask) => {
|
|
38
|
+
if (ask.kind !== "confirm") {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const call = {
|
|
42
|
+
toolCallId: nanoid(10),
|
|
43
|
+
toolCallName: CONFIRM_ACTION_TOOL,
|
|
44
|
+
args: {
|
|
45
|
+
service: ask.service,
|
|
46
|
+
action: ask.action.summary,
|
|
47
|
+
destructive: ask.action.destructive,
|
|
48
|
+
input: ask.input.slice(0, ASK_INPUT),
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
input.onToolCall?.(call);
|
|
52
|
+
const out = (await input.callBrowser(call));
|
|
53
|
+
input.onToolResult?.({ toolCallId: call.toolCallId, content: JSON.stringify(out ?? null) });
|
|
54
|
+
return out?.confirmed === true ? { type: "done" } : { type: "skip" };
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const serviceOf = (tool) => `${tool.row.name} (${tool.connector.name})`;
|
|
58
|
+
/** Goose's tools for its person's connections; none where they signed in to none. */
|
|
59
|
+
export async function gooseConnectionTools(input) {
|
|
60
|
+
const userId = input.user.id;
|
|
61
|
+
const who = { kind: "goose", id: userId, admin: isAdminRole(input.user.role) };
|
|
62
|
+
// Not in a space whose Studio is closed to a member: Goose is the Studio's.
|
|
63
|
+
const signedIn = [];
|
|
64
|
+
for (const row of await signedInConnections(userId)) {
|
|
65
|
+
if (!(await closedToMe(row.spaceId))) {
|
|
66
|
+
signedIn.push(row);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const tools = connectionToolsOf(await usableConnections(signedIn, who));
|
|
70
|
+
if (!tools.length) {
|
|
71
|
+
return {};
|
|
72
|
+
}
|
|
73
|
+
const where = (tool) => ({ chatId: input.chat.id, spaceId: tool.row.spaceId });
|
|
74
|
+
const ask = confirmInChat(input);
|
|
75
|
+
return makeConnectionTools({
|
|
76
|
+
tools,
|
|
77
|
+
who,
|
|
78
|
+
where,
|
|
79
|
+
writeNote: () => prompt("tools", "connection.asks_person"),
|
|
80
|
+
write: (tool, fields) => attempt(async () => connectionResult(await callConnection(tool, who, where(tool), fields, ask ? { ask } : {}), serviceOf(tool))),
|
|
81
|
+
}).tools;
|
|
82
|
+
}
|
|
@@ -36,10 +36,17 @@ export function cacheMarks(prompt) {
|
|
|
36
36
|
return historyEnd || stepEnd ? marked(message) : message;
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
/** The input processor that sets those marks on each request. */
|
|
40
|
+
export const cacheMarksProcessor = {
|
|
40
41
|
id: "cache-marks",
|
|
41
42
|
processLLMRequest: ({ prompt }) => ({ prompt: cacheMarks(prompt) }),
|
|
42
43
|
};
|
|
44
|
+
/** Instructions as a system message with Anthropic's cache mark. */
|
|
45
|
+
export const markedInstructions = (content) => ({
|
|
46
|
+
role: "system",
|
|
47
|
+
content,
|
|
48
|
+
providerOptions: EPHEMERAL,
|
|
49
|
+
});
|
|
43
50
|
/** The agent for a request: its model, instructions and tools. */
|
|
44
51
|
export function spaceAgent(options) {
|
|
45
52
|
const tools = sortedTools(options.tools);
|
|
@@ -47,7 +54,7 @@ export function spaceAgent(options) {
|
|
|
47
54
|
return new Agent({
|
|
48
55
|
id: options.id,
|
|
49
56
|
name: options.name,
|
|
50
|
-
instructions:
|
|
57
|
+
instructions: markedInstructions(options.instructions),
|
|
51
58
|
model: agentModel(options.resolved),
|
|
52
59
|
tools: tools,
|
|
53
60
|
inputProcessors: [cacheMarksProcessor],
|
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
import { anthropic } from "@ai-sdk/anthropic";
|
|
2
|
+
import { CONFIRM_ACTION_TOOL } from "@engenty/wizards-shared/assistant";
|
|
2
3
|
import { textClassOf } from "@engenty/wizards-shared/definition";
|
|
3
|
-
import { cleanAssetSections, cleanLogoSections, FACT_TYPES, FONT_USES, factKey, gradientCss,
|
|
4
|
+
import { cleanAssetSections, cleanLogoSections, FACT_TYPES, FONT_USES, factKey, gradientCss, parseGradient, RULE_MARKS, SPACE_FILE_KINDS, SPACE_LIMITS, textStyleLine, } from "@engenty/wizards-shared/spaces";
|
|
4
5
|
import { pickedClass } from "@engenty/wizards-shared/tiers";
|
|
5
6
|
import { createTool } from "@mastra/core/tools";
|
|
6
7
|
import { nanoid } from "nanoid";
|
|
7
8
|
import { z } from "zod";
|
|
8
9
|
import { knowsTools } from "../assistant/knows.js";
|
|
10
|
+
import { subjectsOfGoose } from "../broker/rwx.js";
|
|
9
11
|
import { currentFeatures } from "../features.js";
|
|
10
12
|
import { managed } from "../manage.js";
|
|
11
13
|
import { chatModel, contextWindowOf, costOf, currentTier, gatewayTools, searchAllowed, textModel, totalUsage, usageOf, } from "../models.js";
|
|
12
14
|
import { prompt } from "../prompts.js";
|
|
13
15
|
import { contentPolicy } from "../safety.js";
|
|
14
16
|
import { knowledgeCounts } from "../services/knowledge.js";
|
|
15
|
-
import { addProjectFileFromUrl, projectFileContent, projectFiles, updateProjectFile, } from "../services/project-files.js";
|
|
16
|
-
import { documentText } from "../services/project-index.js";
|
|
17
|
-
import { ownedProject, updateProject } from "../services/projects.js";
|
|
18
17
|
import { activeSkills, skillList } from "../services/skills.js";
|
|
19
18
|
import { categoryRows } from "../services/space-categories.js";
|
|
19
|
+
import { addSpaceFileFromUrl, spaceFileContent, spaceFiles, updateSpaceFile, } from "../services/space-files.js";
|
|
20
|
+
import { documentText } from "../services/space-index.js";
|
|
21
|
+
import { ownedSpace, updateSpace } from "../services/spaces.js";
|
|
20
22
|
import { currentTenant } from "../tenants/tenant.js";
|
|
21
23
|
import { serverText } from "../texts.js";
|
|
22
24
|
import { assistantPageOf, assistantToolsOf } from "../tools/plugin.js";
|
|
23
25
|
import { attempt as attemptTool, imageOutput } from "../tools/shared.js";
|
|
24
26
|
import { skillToolsOf } from "../tools/skills.js";
|
|
27
|
+
import { gooseConnectionTools } from "./goose-connections.js";
|
|
25
28
|
import { spaceAgent } from "./space-agent.js";
|
|
26
29
|
import { chatTurnWay } from "./subscription.js";
|
|
27
30
|
import { readWebsite } from "./website.js";
|
|
@@ -30,12 +33,17 @@ export function signalText(taken) {
|
|
|
30
33
|
return prompt("goose", "signal", { messages: taken.map((s) => s.message).join("\n\n") });
|
|
31
34
|
}
|
|
32
35
|
const MAX_STEPS = 24;
|
|
33
|
-
/**
|
|
34
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The system prompt: these sections of prompts/goose.md, in this order. `capabilities`: Skills
|
|
38
|
+
* live in Fähigkeiten, at its address.
|
|
39
|
+
*/
|
|
40
|
+
function system(capabilities) {
|
|
35
41
|
return [
|
|
36
42
|
prompt("goose", "persona"),
|
|
37
43
|
prompt("goose", "voice"),
|
|
38
|
-
prompt("goose", "primer"
|
|
44
|
+
prompt("goose", "primer", {
|
|
45
|
+
skills: capabilities ? "/capabilities/skills" : "/skills",
|
|
46
|
+
}),
|
|
39
47
|
prompt("goose", "knows"),
|
|
40
48
|
prompt("goose", "page"),
|
|
41
49
|
prompt("goose", "space"),
|
|
@@ -82,13 +90,13 @@ function activity(tool, args, lang) {
|
|
|
82
90
|
}
|
|
83
91
|
/** A tool failure the model can read and fix, instead of a crashed turn: the whole message. */
|
|
84
92
|
const attempt = (run) => attemptTool(run, { limit: Number.POSITIVE_INFINITY });
|
|
85
|
-
async function
|
|
86
|
-
const p = await
|
|
87
|
-
const files = await
|
|
88
|
-
const categories = await categoryRows(
|
|
93
|
+
async function spaceState(userId, spaceId) {
|
|
94
|
+
const p = await ownedSpace(userId, spaceId);
|
|
95
|
+
const files = await spaceFiles(spaceId);
|
|
96
|
+
const categories = await categoryRows(spaceId);
|
|
89
97
|
return {
|
|
90
98
|
knowledge: {
|
|
91
|
-
...(await knowledgeCounts(
|
|
99
|
+
...(await knowledgeCounts(spaceId)),
|
|
92
100
|
categories: categories.map((c) => `${c.name} (${c.type}${c.proposed ? ", proposed" : ""})`),
|
|
93
101
|
},
|
|
94
102
|
title: p.brand.name ?? "",
|
|
@@ -172,10 +180,10 @@ async function projectState(userId, projectId) {
|
|
|
172
180
|
})),
|
|
173
181
|
};
|
|
174
182
|
}
|
|
175
|
-
function
|
|
183
|
+
export function gooseSpaceTools(input, space, wrote, on) {
|
|
176
184
|
const { signal } = input;
|
|
177
185
|
const userId = input.user.id;
|
|
178
|
-
const
|
|
186
|
+
const spaceId = space.id;
|
|
179
187
|
// Said from inside the tool: an installed AI client runs tools without the stream showing it.
|
|
180
188
|
const doing = (tool, args = {}) => {
|
|
181
189
|
const label = activity(tool, args, input.lang);
|
|
@@ -183,7 +191,7 @@ function spaceTools(input, project, wrote, on) {
|
|
|
183
191
|
input.onActivity?.(label);
|
|
184
192
|
}
|
|
185
193
|
};
|
|
186
|
-
// Tools of one step run together; writes to the
|
|
194
|
+
// Tools of one step run together; writes to the space's row take turns.
|
|
187
195
|
let turn = Promise.resolve();
|
|
188
196
|
const inTurn = (run) => {
|
|
189
197
|
const next = turn.then(run, run);
|
|
@@ -206,13 +214,29 @@ function spaceTools(input, project, wrote, on) {
|
|
|
206
214
|
inputSchema: z.object({
|
|
207
215
|
title: z.string().max(120).optional(),
|
|
208
216
|
about: z.string().max(8000).optional(),
|
|
217
|
+
brandName: z.string().max(120).optional(),
|
|
218
|
+
tagline: z.string().max(200).optional(),
|
|
219
|
+
voice: z
|
|
220
|
+
.array(z.object({ title: z.string().max(80), text: z.string().min(1).max(2000) }))
|
|
221
|
+
.max(12)
|
|
222
|
+
.optional()
|
|
223
|
+
.describe("Replaces the brand's voice blocks"),
|
|
224
|
+
links: z
|
|
225
|
+
.array(z.object({ label: z.string().max(80), url: z.string().min(1).max(600) }))
|
|
226
|
+
.max(20)
|
|
227
|
+
.optional()
|
|
228
|
+
.describe("Replaces the brand's links"),
|
|
209
229
|
}),
|
|
210
|
-
execute: ({ title, about }) => attempt(() => inTurn(async () => {
|
|
230
|
+
execute: ({ title, about, brandName, tagline, voice, links }) => attempt(() => inTurn(async () => {
|
|
211
231
|
doing("set_profile");
|
|
212
|
-
await
|
|
232
|
+
await updateSpace(userId, spaceId, {
|
|
213
233
|
brand: {
|
|
214
234
|
...(title !== undefined ? { name: title } : {}),
|
|
215
235
|
...(about !== undefined ? { about } : {}),
|
|
236
|
+
...(brandName !== undefined ? { brandName } : {}),
|
|
237
|
+
...(tagline !== undefined ? { tagline } : {}),
|
|
238
|
+
...(voice ? { voice: voice.map((b) => ({ id: nanoid(10), ...b })) } : {}),
|
|
239
|
+
...(links ? { links: links.map((l) => ({ id: nanoid(10), ...l })) } : {}),
|
|
216
240
|
},
|
|
217
241
|
});
|
|
218
242
|
wrote();
|
|
@@ -233,7 +257,7 @@ function spaceTools(input, project, wrote, on) {
|
|
|
233
257
|
}),
|
|
234
258
|
execute: ({ facts }) => attempt(() => inTurn(async () => {
|
|
235
259
|
doing("set_facts");
|
|
236
|
-
const p = await
|
|
260
|
+
const p = await ownedSpace(userId, spaceId);
|
|
237
261
|
const next = [...p.facts];
|
|
238
262
|
for (const f of facts) {
|
|
239
263
|
const label = f.label.trim();
|
|
@@ -251,10 +275,10 @@ function spaceTools(input, project, wrote, on) {
|
|
|
251
275
|
});
|
|
252
276
|
}
|
|
253
277
|
}
|
|
254
|
-
if (next.length >
|
|
255
|
-
throw new Error(`A
|
|
278
|
+
if (next.length > SPACE_LIMITS.facts) {
|
|
279
|
+
throw new Error(`A space holds at most ${SPACE_LIMITS.facts} facts.`);
|
|
256
280
|
}
|
|
257
|
-
await
|
|
281
|
+
await updateSpace(userId, spaceId, { facts: next });
|
|
258
282
|
wrote();
|
|
259
283
|
return { ok: true, facts: next.length };
|
|
260
284
|
})),
|
|
@@ -265,10 +289,10 @@ function spaceTools(input, project, wrote, on) {
|
|
|
265
289
|
inputSchema: z.object({ labels: z.array(z.string()).min(1) }),
|
|
266
290
|
execute: ({ labels }) => attempt(() => inTurn(async () => {
|
|
267
291
|
doing("remove_facts");
|
|
268
|
-
const p = await
|
|
292
|
+
const p = await ownedSpace(userId, spaceId);
|
|
269
293
|
const gone = new Set(labels.map((l) => l.trim().toLowerCase()));
|
|
270
294
|
const next = p.facts.filter((f) => !gone.has(f.label.toLowerCase()));
|
|
271
|
-
await
|
|
295
|
+
await updateSpace(userId, spaceId, { facts: next });
|
|
272
296
|
wrote();
|
|
273
297
|
return { ok: true, removed: p.facts.length - next.length };
|
|
274
298
|
})),
|
|
@@ -283,10 +307,10 @@ function spaceTools(input, project, wrote, on) {
|
|
|
283
307
|
value: z.string().regex(/^#[0-9a-fA-F]{6}$/),
|
|
284
308
|
section: z.string().max(80).optional().describe("A section's title"),
|
|
285
309
|
}))
|
|
286
|
-
.max(
|
|
310
|
+
.max(SPACE_LIMITS.colors),
|
|
287
311
|
sections: z
|
|
288
312
|
.array(z.object({ title: z.string().min(1).max(80) }))
|
|
289
|
-
.max(
|
|
313
|
+
.max(SPACE_LIMITS.logoSections)
|
|
290
314
|
.optional(),
|
|
291
315
|
}),
|
|
292
316
|
execute: ({ colors, sections }) => attempt(() => inTurn(async () => {
|
|
@@ -294,7 +318,7 @@ function spaceTools(input, project, wrote, on) {
|
|
|
294
318
|
if (!on.brandSections && (sections || colors.some((c) => c.section))) {
|
|
295
319
|
throw new Error("Colour sections are not available in this studio: pass the colours without them.");
|
|
296
320
|
}
|
|
297
|
-
const p = await
|
|
321
|
+
const p = await ownedSpace(userId, spaceId);
|
|
298
322
|
const groups = sections
|
|
299
323
|
? sections.map((s) => ({
|
|
300
324
|
id: p.brand.colorSections?.find((x) => x.title === s.title)?.id ?? nanoid(10),
|
|
@@ -305,7 +329,7 @@ function spaceTools(input, project, wrote, on) {
|
|
|
305
329
|
if (unknown.length) {
|
|
306
330
|
throw new Error(`No colour section named: ${unknown.map((c) => c.section).join(", ")}`);
|
|
307
331
|
}
|
|
308
|
-
await
|
|
332
|
+
await updateSpace(userId, spaceId, {
|
|
309
333
|
brand: {
|
|
310
334
|
colors: colors.map(({ section, ...c }) => {
|
|
311
335
|
const id = groups.find((s) => s.title === section)?.id;
|
|
@@ -331,16 +355,16 @@ function spaceTools(input, project, wrote, on) {
|
|
|
331
355
|
.describe("When to use these logos, in the person's language"),
|
|
332
356
|
logos: z.array(z.string()).describe("Ids of the space's logo files, in order"),
|
|
333
357
|
}))
|
|
334
|
-
.max(
|
|
358
|
+
.max(SPACE_LIMITS.logoSections),
|
|
335
359
|
}),
|
|
336
360
|
execute: ({ sections }) => attempt(() => inTurn(async () => {
|
|
337
361
|
doing("set_logo_sections");
|
|
338
|
-
const logos = (await
|
|
362
|
+
const logos = (await spaceFiles(spaceId, "logo")).map((f) => f.id);
|
|
339
363
|
const unknown = sections.flatMap((s) => s.logos).filter((id) => !logos.includes(id));
|
|
340
364
|
if (unknown.length) {
|
|
341
365
|
throw new Error(`Not a logo of this space: ${unknown.join(", ")}`);
|
|
342
366
|
}
|
|
343
|
-
await
|
|
367
|
+
await updateSpace(userId, spaceId, {
|
|
344
368
|
brand: {
|
|
345
369
|
logoSections: cleanLogoSections(sections.map((s) => ({ ...s, id: nanoid(10) })), logos),
|
|
346
370
|
},
|
|
@@ -358,16 +382,16 @@ function spaceTools(input, project, wrote, on) {
|
|
|
358
382
|
title: z.string().min(1).max(80),
|
|
359
383
|
assets: z.array(z.string()).describe("Ids of the space's asset files, in order"),
|
|
360
384
|
}))
|
|
361
|
-
.max(
|
|
385
|
+
.max(SPACE_LIMITS.logoSections),
|
|
362
386
|
}),
|
|
363
387
|
execute: ({ sections }) => attempt(() => inTurn(async () => {
|
|
364
388
|
doing("set_asset_sections");
|
|
365
|
-
const assets = (await
|
|
389
|
+
const assets = (await spaceFiles(spaceId, "asset")).map((f) => f.id);
|
|
366
390
|
const unknown = sections.flatMap((s) => s.assets).filter((id) => !assets.includes(id));
|
|
367
391
|
if (unknown.length) {
|
|
368
392
|
throw new Error(`Not an asset of this space: ${unknown.join(", ")}`);
|
|
369
393
|
}
|
|
370
|
-
await
|
|
394
|
+
await updateSpace(userId, spaceId, {
|
|
371
395
|
brand: {
|
|
372
396
|
assetSections: cleanAssetSections(sections.map((s) => ({ ...s, id: nanoid(10) })), assets),
|
|
373
397
|
},
|
|
@@ -395,7 +419,7 @@ function spaceTools(input, project, wrote, on) {
|
|
|
395
419
|
.optional()
|
|
396
420
|
.describe("All the licence allows it for, only where a source says so"),
|
|
397
421
|
}))
|
|
398
|
-
.max(
|
|
422
|
+
.max(SPACE_LIMITS.fonts),
|
|
399
423
|
textStyles: z
|
|
400
424
|
.array(z.object({
|
|
401
425
|
name: z.string().min(1).max(60),
|
|
@@ -406,17 +430,17 @@ function spaceTools(input, project, wrote, on) {
|
|
|
406
430
|
tracking: z.number().min(-20).max(50).describe("Letter spacing, % of the size"),
|
|
407
431
|
uppercase: z.boolean().optional(),
|
|
408
432
|
}))
|
|
409
|
-
.max(
|
|
433
|
+
.max(SPACE_LIMITS.textStyles)
|
|
410
434
|
.optional(),
|
|
411
435
|
}),
|
|
412
436
|
execute: ({ fonts, textStyles }) => attempt(() => inTurn(async () => {
|
|
413
437
|
doing("set_typography");
|
|
414
|
-
const p = await
|
|
438
|
+
const p = await ownedSpace(userId, spaceId);
|
|
415
439
|
const faces = fonts.map((f) => ({
|
|
416
440
|
...f,
|
|
417
441
|
id: p.brand.fonts?.find((x) => x.family === f.family)?.id ?? nanoid(10),
|
|
418
442
|
}));
|
|
419
|
-
await
|
|
443
|
+
await updateSpace(userId, spaceId, {
|
|
420
444
|
brand: {
|
|
421
445
|
fonts: faces,
|
|
422
446
|
...(textStyles
|
|
@@ -445,11 +469,11 @@ function spaceTools(input, project, wrote, on) {
|
|
|
445
469
|
description: z.string().max(400).optional().describe("When to use it"),
|
|
446
470
|
css: z.string().max(1000),
|
|
447
471
|
}))
|
|
448
|
-
.max(
|
|
472
|
+
.max(SPACE_LIMITS.gradients),
|
|
449
473
|
}),
|
|
450
474
|
execute: ({ section, gradients }) => attempt(() => inTurn(async () => {
|
|
451
475
|
doing("set_gradients");
|
|
452
|
-
const p = await
|
|
476
|
+
const p = await ownedSpace(userId, spaceId);
|
|
453
477
|
const sections = p.brand.colorSections ?? [];
|
|
454
478
|
const found = sections.find((s) => s.title === section && s.kind === "gradients");
|
|
455
479
|
const id = found?.id ?? nanoid(10);
|
|
@@ -458,7 +482,7 @@ function spaceTools(input, project, wrote, on) {
|
|
|
458
482
|
if (bad.length) {
|
|
459
483
|
throw new Error(`Not a gradient with hex stops: ${bad.join(", ")}`);
|
|
460
484
|
}
|
|
461
|
-
await
|
|
485
|
+
await updateSpace(userId, spaceId, {
|
|
462
486
|
brand: {
|
|
463
487
|
colorSections: found
|
|
464
488
|
? sections
|
|
@@ -492,11 +516,11 @@ function spaceTools(input, project, wrote, on) {
|
|
|
492
516
|
.optional()
|
|
493
517
|
.describe("do, dont, important, question, number; none for a plain note"),
|
|
494
518
|
}))
|
|
495
|
-
.max(
|
|
519
|
+
.max(SPACE_LIMITS.logoRules),
|
|
496
520
|
}),
|
|
497
521
|
execute: ({ of, rules }) => attempt(() => inTurn(async () => {
|
|
498
522
|
doing("set_rules");
|
|
499
|
-
await
|
|
523
|
+
await updateSpace(userId, spaceId, {
|
|
500
524
|
brand: of === "logos"
|
|
501
525
|
? { logoRules: rules }
|
|
502
526
|
: of === "colors"
|
|
@@ -512,7 +536,7 @@ function spaceTools(input, project, wrote, on) {
|
|
|
512
536
|
description: prompt("goose", "tool.save_file"),
|
|
513
537
|
inputSchema: z.object({
|
|
514
538
|
url: z.string(),
|
|
515
|
-
kind: z.enum(
|
|
539
|
+
kind: z.enum(SPACE_FILE_KINDS),
|
|
516
540
|
description: z
|
|
517
541
|
.string()
|
|
518
542
|
.max(600)
|
|
@@ -521,7 +545,7 @@ function spaceTools(input, project, wrote, on) {
|
|
|
521
545
|
}),
|
|
522
546
|
execute: ({ url, kind, description }) => attempt(async () => {
|
|
523
547
|
doing("save_file", { kind });
|
|
524
|
-
const row = await
|
|
548
|
+
const row = await addSpaceFileFromUrl(spaceId, { url, kind, description, signal });
|
|
525
549
|
wrote();
|
|
526
550
|
return { ok: true, id: row.id, name: row.name, mime: row.mime, size: row.size };
|
|
527
551
|
}),
|
|
@@ -532,7 +556,7 @@ function spaceTools(input, project, wrote, on) {
|
|
|
532
556
|
inputSchema: z.object({ id: z.string(), description: z.string().max(600) }),
|
|
533
557
|
execute: ({ id, description }) => attempt(async () => {
|
|
534
558
|
doing("describe_file");
|
|
535
|
-
await
|
|
559
|
+
await updateSpaceFile(spaceId, id, { description });
|
|
536
560
|
wrote();
|
|
537
561
|
return { ok: true };
|
|
538
562
|
}),
|
|
@@ -546,7 +570,7 @@ function spaceTools(input, project, wrote, on) {
|
|
|
546
570
|
}),
|
|
547
571
|
execute: ({ id, from }) => attempt(async () => {
|
|
548
572
|
doing("look_at_file");
|
|
549
|
-
const { row, data } = await
|
|
573
|
+
const { row, data } = await spaceFileContent(spaceId, id, subjectsOfGoose(userId, input.user.role));
|
|
550
574
|
if (row.kind === "document") {
|
|
551
575
|
const text = await documentText(row);
|
|
552
576
|
if (!text) {
|
|
@@ -635,13 +659,19 @@ function traced(tools, input, record) {
|
|
|
635
659
|
};
|
|
636
660
|
}
|
|
637
661
|
}
|
|
638
|
-
/** The part of the space page a route stands on. */
|
|
662
|
+
/** The part of the space page a route stands on; Skills have their own address, or Fähigkeiten's. */
|
|
639
663
|
function partOf(route) {
|
|
640
|
-
const m = route.match(/^\/space\/(info|brand|knowledge|data|results
|
|
641
|
-
return m
|
|
664
|
+
const m = route.match(/^\/space\/(info|brand|knowledge|data|results)/);
|
|
665
|
+
return m
|
|
666
|
+
? m[1]
|
|
667
|
+
: route === "/space"
|
|
668
|
+
? "info"
|
|
669
|
+
: /^\/(skills|capabilities\/skills)\b/.test(route)
|
|
670
|
+
? "skills"
|
|
671
|
+
: null;
|
|
642
672
|
}
|
|
643
673
|
/** How large each tool is in the prompt: its description and its schema, in characters. */
|
|
644
|
-
function toolSizes(tools) {
|
|
674
|
+
export function toolSizes(tools) {
|
|
645
675
|
return Object.entries(tools)
|
|
646
676
|
.map(([name, tool]) => {
|
|
647
677
|
let schema = "";
|
|
@@ -685,8 +715,8 @@ export async function runStudioAssistant(input) {
|
|
|
685
715
|
input.onChanged?.();
|
|
686
716
|
};
|
|
687
717
|
const cards = [];
|
|
688
|
-
const {
|
|
689
|
-
const
|
|
718
|
+
const { space } = input;
|
|
719
|
+
const writable = space && input.writable ? space : null;
|
|
690
720
|
const switches = await currentFeatures();
|
|
691
721
|
const brandOn = {
|
|
692
722
|
brandSections: switches.brandSections === true,
|
|
@@ -696,7 +726,7 @@ export async function runStudioAssistant(input) {
|
|
|
696
726
|
const tools = {
|
|
697
727
|
...knowsTools({
|
|
698
728
|
user: input.user,
|
|
699
|
-
|
|
729
|
+
space: space ? { id: space.id, name: space.name } : null,
|
|
700
730
|
lang: input.lang,
|
|
701
731
|
chatId: input.chat.id,
|
|
702
732
|
doing: (label) => input.onActivity?.(label),
|
|
@@ -705,7 +735,7 @@ export async function runStudioAssistant(input) {
|
|
|
705
735
|
input.onCard?.(card);
|
|
706
736
|
},
|
|
707
737
|
}),
|
|
708
|
-
...(
|
|
738
|
+
...(writable ? gooseSpaceTools(input, writable, wrote, brandOn) : {}),
|
|
709
739
|
};
|
|
710
740
|
// On everyday effort the chat can offer extra effort for work that asks for more: a card with
|
|
711
741
|
// a button, while it goes on answering.
|
|
@@ -729,10 +759,10 @@ export async function runStudioAssistant(input) {
|
|
|
729
759
|
});
|
|
730
760
|
}
|
|
731
761
|
// What the tenant's plugins let the assistant do besides: a source of knowledge, say.
|
|
732
|
-
if (
|
|
762
|
+
if (writable) {
|
|
733
763
|
Object.assign(tools, await assistantToolsOf({
|
|
734
764
|
tenantId: currentTenant(),
|
|
735
|
-
space: { id:
|
|
765
|
+
space: { id: writable.id, name: writable.name },
|
|
736
766
|
userId: input.user.id,
|
|
737
767
|
signal: input.signal ?? new AbortController().signal,
|
|
738
768
|
emit: (message) => input.onActivity?.(message),
|
|
@@ -743,14 +773,18 @@ export async function runStudioAssistant(input) {
|
|
|
743
773
|
},
|
|
744
774
|
}));
|
|
745
775
|
}
|
|
776
|
+
// The person's own sign-ins to the spaces' connections (goose-connections.ts): reads run, a
|
|
777
|
+
// write asks them on a card. Never a connection that signs in as the space.
|
|
778
|
+
Object.assign(tools, await gooseConnectionTools(input));
|
|
746
779
|
// The space's skills (docs/plans/skills.md): Goose reads them as a step does.
|
|
747
|
-
const skills =
|
|
748
|
-
const allSkills =
|
|
780
|
+
const skills = space && switches.skills === true ? await activeSkills(space.id) : null;
|
|
781
|
+
const allSkills = space && switches.skills === true ? await skillList(space.id) : [];
|
|
749
782
|
if (skills) {
|
|
750
783
|
Object.assign(tools, skillToolsOf(skills, (name) => input.onActivity?.(serverText(input.lang, "doingReadSkill", { name }))));
|
|
751
784
|
}
|
|
752
785
|
for (const spec of input.browserTools) {
|
|
753
|
-
|
|
786
|
+
// The confirm card is the runtime's to show, never the model's to call.
|
|
787
|
+
if (tools[spec.name] || spec.name === CONFIRM_ACTION_TOOL) {
|
|
754
788
|
continue;
|
|
755
789
|
}
|
|
756
790
|
const tool = browserTool(input, spec);
|
|
@@ -768,7 +802,7 @@ export async function runStudioAssistant(input) {
|
|
|
768
802
|
else if (search && resolved.gateway) {
|
|
769
803
|
tools.web_search = gatewayTools.perplexitySearch({ maxResults: 6 });
|
|
770
804
|
}
|
|
771
|
-
const instructions = system();
|
|
805
|
+
const instructions = system(switches.capabilities === true);
|
|
772
806
|
const agent = spaceAgent({
|
|
773
807
|
id: "studio-assistant",
|
|
774
808
|
name: "Studio assistant",
|
|
@@ -777,8 +811,8 @@ export async function runStudioAssistant(input) {
|
|
|
777
811
|
tools,
|
|
778
812
|
});
|
|
779
813
|
const page = input.page;
|
|
780
|
-
const pluginPage = page?.plugin &&
|
|
781
|
-
? await assistantPageOf(currentTenant(), page.plugin, { id:
|
|
814
|
+
const pluginPage = page?.plugin && space
|
|
815
|
+
? await assistantPageOf(currentTenant(), page.plugin, { id: space.id, name: space.name })
|
|
782
816
|
: null;
|
|
783
817
|
const part = page ? partOf(page.route) : null;
|
|
784
818
|
const { history } = input;
|
|
@@ -807,10 +841,10 @@ export async function runStudioAssistant(input) {
|
|
|
807
841
|
...pluginPage.blocks,
|
|
808
842
|
].join("\n\n")
|
|
809
843
|
: "",
|
|
810
|
-
|
|
811
|
-
? `The space now:\n\`\`\`json\n${JSON.stringify(await
|
|
812
|
-
:
|
|
813
|
-
? prompt("goose", "turn.space_read_only", { name:
|
|
844
|
+
writable
|
|
845
|
+
? `The space now:\n\`\`\`json\n${JSON.stringify(await spaceState(input.user.id, writable.id))}\n\`\`\``
|
|
846
|
+
: space
|
|
847
|
+
? prompt("goose", "turn.space_read_only", { name: space.name })
|
|
814
848
|
: "No space is open.",
|
|
815
849
|
part === "knowledge" ? prompt("goose", "turn.knowledge") : "",
|
|
816
850
|
allSkills.length
|
|
@@ -821,7 +855,7 @@ export async function runStudioAssistant(input) {
|
|
|
821
855
|
: part === "skills"
|
|
822
856
|
? prompt("goose", "turn.skills_empty")
|
|
823
857
|
: "",
|
|
824
|
-
|
|
858
|
+
writable && !(brandOn.brandSections && brandOn.brandRules && brandOn.typography)
|
|
825
859
|
? prompt("goose", "turn.off", {
|
|
826
860
|
missing: [
|
|
827
861
|
brandOn.brandSections ? "" : "sections of logos and colours, gradients and patterns",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FONT_WEIGHTS } from "@engenty/wizards-shared/
|
|
1
|
+
import { FONT_WEIGHTS } from "@engenty/wizards-shared/spaces";
|
|
2
2
|
import { webContext } from "../render/chromium.js";
|
|
3
3
|
import { htmlToMarkdown } from "../render/convert.js";
|
|
4
4
|
import { safeFetch } from "../tools/net-guard.js";
|