@engenty/wizards-runtime 0.13.0 → 0.14.1
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 +26 -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/{0027_space_skill.sql → 0030_space_skill.sql} +8 -8
- 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-SpDcn8VZ.js +1 -0
- package/apps/web/dist/assets/CapabilitiesPage-Bgnm_3dk.js +2 -0
- package/apps/web/dist/assets/{ChangelogDialog-SwyId00t.js → ChangelogDialog-DAnjV6cZ.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-BwZsk5Al.js → CodeEditor-nxoOt8ge.js} +1 -1
- package/apps/web/dist/assets/EditorPage-B98C-9Nv.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-D8IYLg_S.js +1 -0
- package/apps/web/dist/assets/NewWizardPage-DlBt0Mfq.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-ztHT01ah.js +1 -0
- package/apps/web/dist/assets/PreviewPane-DC1kAi3x.js +9 -0
- package/apps/web/dist/assets/PublicRunner-D6lKP0j8.js +1 -0
- package/apps/web/dist/assets/ReadOnly-DFsuKPCw.js +1 -0
- package/apps/web/dist/assets/SettingsPage-DkHeCO2c.js +2 -0
- package/apps/web/dist/assets/SetupPage-DZ8xRkfS.js +1 -0
- package/apps/web/dist/assets/SharePage-494ZPsjQ.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-CWlU_BZP.js +2 -0
- package/apps/web/dist/assets/UpdateCheck-BKNkNJyG.js +2 -0
- package/apps/web/dist/assets/changelog-BhMZS-rs.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-Cngd_QDO.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-C0WQlRKB.js +118 -0
- package/apps/web/dist/assets/i18n-BJ7Ld6O6.js +55 -0
- package/apps/web/dist/assets/index-ClVtdDUZ.js +10 -0
- package/apps/web/dist/assets/index-D18DvnxX.css +1 -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-BCau3f6O.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
|
@@ -1,26 +1,53 @@
|
|
|
1
1
|
import { createTool } from "@mastra/core/tools";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { brokerCall, brokerConnected, reachesOutside, whereOf, whoOf, } from "../broker/index.js";
|
|
4
|
+
import { mailSearchInput, } from "../connectors/mail.js";
|
|
5
5
|
import { prompt } from "../prompts.js";
|
|
6
6
|
import { escapeHtml, htmlToPdf } from "../render/convert.js";
|
|
7
7
|
import { guardHtml } from "../render/guard.js";
|
|
8
8
|
import { attempt, clip } from "./shared.js";
|
|
9
|
+
reachesOutside("mail_search", { connection: "mail", action: "search", kind: "read" });
|
|
10
|
+
reachesOutside("mail_read", { connection: "mail", action: "read", kind: "read" });
|
|
11
|
+
reachesOutside("mail_save", [
|
|
12
|
+
{ connection: "mail", action: "read", kind: "read" },
|
|
13
|
+
{ connection: "mail", action: "get_attachment", kind: "read" },
|
|
14
|
+
]);
|
|
9
15
|
/**
|
|
10
16
|
* Read-only mail for a step that names a mail connection. The tools are the same whichever
|
|
11
17
|
* provider the person connected; attachments never pass through the model — they are saved.
|
|
18
|
+
* Every read goes through the broker, which holds the mailbox's account.
|
|
12
19
|
*/
|
|
13
20
|
export function mailTools(step, ctx, files) {
|
|
14
21
|
const connection = (ctx.def.connections ?? []).find((c) => c.kind === "mail" && step.connections?.includes(c.id));
|
|
15
22
|
if (!connection) {
|
|
16
23
|
return {};
|
|
17
24
|
}
|
|
25
|
+
const held = (def) => ({
|
|
26
|
+
kind: "store_secret",
|
|
27
|
+
def,
|
|
28
|
+
scope: ctx.store,
|
|
29
|
+
spaceId: ctx.space.id,
|
|
30
|
+
});
|
|
31
|
+
/** The mailbox's label, or the note that nothing is connected. */
|
|
18
32
|
const open = async () => {
|
|
19
|
-
const found = await
|
|
33
|
+
const found = await brokerConnected(held(connection));
|
|
20
34
|
if (!found) {
|
|
21
35
|
throw new Error(prompt("tools", "note.mail_not_connected"));
|
|
22
36
|
}
|
|
23
|
-
return found;
|
|
37
|
+
return found.label;
|
|
38
|
+
};
|
|
39
|
+
const read = async (action, input) => {
|
|
40
|
+
const out = await brokerCall({
|
|
41
|
+
who: whoOf(ctx.store.holder),
|
|
42
|
+
where: whereOf(ctx),
|
|
43
|
+
connection: held(connection),
|
|
44
|
+
action: { id: action, kind: "read" },
|
|
45
|
+
input,
|
|
46
|
+
});
|
|
47
|
+
if (!out.ok) {
|
|
48
|
+
throw new Error(out.refused === "not_connected" ? prompt("tools", "note.mail_not_connected") : out.reason);
|
|
49
|
+
}
|
|
50
|
+
return out.result;
|
|
24
51
|
};
|
|
25
52
|
const tools = {};
|
|
26
53
|
tools.mail_search = createTool({
|
|
@@ -28,9 +55,9 @@ export function mailTools(step, ctx, files) {
|
|
|
28
55
|
description: prompt("tools", "tool.mail_search"),
|
|
29
56
|
inputSchema: mailSearchInput,
|
|
30
57
|
execute: (input) => attempt(async () => {
|
|
31
|
-
const
|
|
58
|
+
const label = await open();
|
|
32
59
|
await ctx.emit("tool", { code: "searchesMail", params: { label } });
|
|
33
|
-
const { mails } = await
|
|
60
|
+
const { mails } = await read("search", input);
|
|
34
61
|
return {
|
|
35
62
|
mailbox: label,
|
|
36
63
|
total: mails.length,
|
|
@@ -43,8 +70,7 @@ export function mailTools(step, ctx, files) {
|
|
|
43
70
|
description: prompt("tools", "tool.mail_read"),
|
|
44
71
|
inputSchema: z.object({ id: z.string() }),
|
|
45
72
|
execute: ({ id }) => attempt(async () => {
|
|
46
|
-
const
|
|
47
|
-
const mail = await mailAction(connector, "read", { id }, actionCtx);
|
|
73
|
+
const mail = await read("read", { id });
|
|
48
74
|
const { html: _html, ...rest } = mail;
|
|
49
75
|
return { ...rest, text: clip(mail.text, 6000) };
|
|
50
76
|
}),
|
|
@@ -63,7 +89,7 @@ export function mailTools(step, ctx, files) {
|
|
|
63
89
|
.max(40),
|
|
64
90
|
}),
|
|
65
91
|
execute: ({ items }) => attempt(async () => {
|
|
66
|
-
const
|
|
92
|
+
const label = await open();
|
|
67
93
|
await ctx.emit("tool", {
|
|
68
94
|
code: "savesReceipts",
|
|
69
95
|
params: { count: items.length, label },
|
|
@@ -72,7 +98,10 @@ export function mailTools(step, ctx, files) {
|
|
|
72
98
|
for (const item of items) {
|
|
73
99
|
try {
|
|
74
100
|
if (item.attachment_id) {
|
|
75
|
-
const a = await
|
|
101
|
+
const a = await read("get_attachment", {
|
|
102
|
+
id: item.id,
|
|
103
|
+
attachment_id: item.attachment_id,
|
|
104
|
+
});
|
|
76
105
|
const kept = await files.keep(item.path, Buffer.from(a.data_base64, "base64"), {
|
|
77
106
|
mime: a.mime,
|
|
78
107
|
source: `E-Mail-Anhang „${a.name}“ aus ${label}`,
|
|
@@ -80,7 +109,7 @@ export function mailTools(step, ctx, files) {
|
|
|
80
109
|
saved.push({ id: item.id, saved: kept.path, size: kept.size });
|
|
81
110
|
}
|
|
82
111
|
else {
|
|
83
|
-
const mail = await
|
|
112
|
+
const mail = await read("read", { id: item.id });
|
|
84
113
|
const page = mail.html ??
|
|
85
114
|
`<pre style="white-space:pre-wrap;font:14px system-ui">${escapeHtml(mail.text)}</pre>`;
|
|
86
115
|
const head = `<div style="font:13px system-ui;color:#444;border-bottom:1px solid #ddd;padding-bottom:8px;margin-bottom:12px">${escapeHtml(mail.from ?? "")}<br>${escapeHtml(mail.date ?? "")}<br><b>${escapeHtml(mail.subject ?? "")}</b></div>`;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createTool } from "@mastra/core/tools";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { readableIds, subjectsOf } from "../broker/rwx.js";
|
|
3
4
|
import { prompt } from "../prompts.js";
|
|
4
5
|
import { runPages, writeRunPage } from "../services/space-data.js";
|
|
5
|
-
import { pageReadInput, readKnowledgePage } from "./project.js";
|
|
6
6
|
import { attempt, clip } from "./shared.js";
|
|
7
|
+
import { pageReadInput, readKnowledgePage } from "./space.js";
|
|
7
8
|
/**
|
|
8
9
|
* Pages for a step that lists "pages": Markdown its wizard keeps for every run — notes, a log, a
|
|
9
10
|
* summary that grows — its memory, shown in the studio's Memory tab and under Space → Data. Its
|
|
@@ -11,11 +12,16 @@ import { attempt, clip } from "./shared.js";
|
|
|
11
12
|
* writes into a copy of its own in the run's state, which goes with the run.
|
|
12
13
|
*/
|
|
13
14
|
export function pageTools(ctx) {
|
|
14
|
-
const
|
|
15
|
+
const spaceId = ctx.space.id;
|
|
15
16
|
const wizardId = ctx.store.wizardId;
|
|
16
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* The wizard's pages as this run sees them: those its holder may read, a test run's own
|
|
19
|
+
* writes over the real ones.
|
|
20
|
+
*/
|
|
17
21
|
const pages = async () => {
|
|
18
|
-
const
|
|
22
|
+
const all = await runPages(spaceId, wizardId);
|
|
23
|
+
const ok = new Set(await readableIds(spaceId, subjectsOf(ctx), "page", all.map((p) => p.id)));
|
|
24
|
+
const real = all.filter((p) => ok.has(p.id));
|
|
19
25
|
const copy = ctx.test ? (ctx.state.memory ?? {}) : {};
|
|
20
26
|
const lower = (t) => t.toLowerCase();
|
|
21
27
|
const written = Object.entries(copy).map(([title, markdown]) => ({ title, markdown }));
|
|
@@ -73,7 +79,7 @@ export function pageTools(ctx) {
|
|
|
73
79
|
});
|
|
74
80
|
return { title: before?.title ?? title, chars: markdown.length, test: true };
|
|
75
81
|
}
|
|
76
|
-
const page = await writeRunPage(
|
|
82
|
+
const page = await writeRunPage(spaceId, wizardId, input);
|
|
77
83
|
await ctx.emit("tool", { code: "writesPage", params: { title: page.title } });
|
|
78
84
|
return page;
|
|
79
85
|
}),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { pluginToolOf } from "@engenty/wizards-shared/definition";
|
|
2
2
|
import { note } from "@engenty/wizards-shared/run";
|
|
3
3
|
import { createTool } from "@mastra/core/tools";
|
|
4
|
+
import { whereOf, whoOf, withCaller } from "../broker/index.js";
|
|
4
5
|
import { StepError } from "../engine/types.js";
|
|
5
6
|
import { loadedPlugin, pluginIdsOf, pluginsOf } from "../plugins/registry.js";
|
|
6
7
|
import { attempt, clip } from "./shared.js";
|
|
@@ -10,26 +11,35 @@ export function pluginToolName(plugin, tool) {
|
|
|
10
11
|
}
|
|
11
12
|
/** What a plugin's tool learns of the step that calls it. */
|
|
12
13
|
function toolContext(ctx) {
|
|
13
|
-
const space = { id: ctx.
|
|
14
|
+
const space = { id: ctx.space.id, name: ctx.space.name };
|
|
14
15
|
return {
|
|
15
16
|
runId: ctx.runId,
|
|
16
17
|
stepId: ctx.stepId,
|
|
17
18
|
tenantId: ctx.tenantId,
|
|
18
19
|
space,
|
|
19
|
-
project: space,
|
|
20
20
|
wizard: { id: ctx.store.wizardId, title: ctx.def.title },
|
|
21
21
|
mode: ctx.test ? "test" : "live",
|
|
22
22
|
signal: ctx.signal,
|
|
23
23
|
emit: (message) => ctx.emit("tool", message),
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
+
/** Who an AI step calls as: the person running the wizard, an admin where their role says so. */
|
|
27
|
+
export function holderWho(ctx) {
|
|
28
|
+
return whoOf(ctx.store.holder, ctx.holder.kind === "person" ? ctx.holder.role : undefined);
|
|
29
|
+
}
|
|
30
|
+
/** Who a fixed step calls as: the step itself, for the person running the wizard. The broker hears it. */
|
|
31
|
+
export function stepWho(ctx) {
|
|
32
|
+
return { kind: "step", id: ctx.stepId, for: holderWho(ctx) };
|
|
33
|
+
}
|
|
34
|
+
/** Who a step's plugin tool calls for: the person running the wizard, in this run. The broker hears it. */
|
|
35
|
+
const callerOf = (ctx) => ({ who: holderWho(ctx), where: whereOf(ctx) });
|
|
26
36
|
/** A plugin's tool as an agent step calls it. */
|
|
27
37
|
function stepTool(plugin, tool, ctx) {
|
|
28
38
|
return createTool({
|
|
29
39
|
id: pluginToolName(plugin, tool.name),
|
|
30
40
|
description: tool.description,
|
|
31
41
|
inputSchema: tool.inputSchema,
|
|
32
|
-
execute: (input) => attempt(async () => tool.execute(input, toolContext(ctx))),
|
|
42
|
+
execute: (input) => attempt(() => withCaller(callerOf(ctx), async () => tool.execute(input, toolContext(ctx)))),
|
|
33
43
|
});
|
|
34
44
|
}
|
|
35
45
|
/** A plugin's tool by its `<plugin>.<tool>` id, as this tenant has it; a StepError where it does not. */
|
|
@@ -59,7 +69,8 @@ export async function callPluginTool(id, input, ctx) {
|
|
|
59
69
|
}));
|
|
60
70
|
}
|
|
61
71
|
try {
|
|
62
|
-
|
|
72
|
+
// A fixed step calls as the step, for the person running it.
|
|
73
|
+
return await withCaller({ who: stepWho(ctx), where: whereOf(ctx) }, async () => tool.execute(parsed.data, toolContext(ctx)));
|
|
63
74
|
}
|
|
64
75
|
catch (err) {
|
|
65
76
|
throw new StepError(String(err?.message ?? err).slice(0, 400));
|
|
@@ -94,7 +105,7 @@ export function spaceContextOf(ctx) {
|
|
|
94
105
|
return found;
|
|
95
106
|
}
|
|
96
107
|
async function gather(ctx) {
|
|
97
|
-
const space = { id: ctx.
|
|
108
|
+
const space = { id: ctx.space.id, name: ctx.space.name };
|
|
98
109
|
const result = { blocks: [], html: [], tools: {} };
|
|
99
110
|
for (const plugin of await pluginsOf(ctx.tenantId)) {
|
|
100
111
|
for (const context of plugin.contexts) {
|
|
@@ -122,6 +133,10 @@ async function gather(ctx) {
|
|
|
122
133
|
}
|
|
123
134
|
return result;
|
|
124
135
|
}
|
|
136
|
+
/** What a plugin's assistant tool says it does (`risk`), by the tool made of it; null: unmarked. */
|
|
137
|
+
export const assistantToolRisk = new WeakMap();
|
|
138
|
+
/** Which plugin a tool of the space assistant comes from, by the tool made of it. */
|
|
139
|
+
export const assistantToolPlugin = new WeakMap();
|
|
125
140
|
/** The tenant's plugins' tools of the space assistant (`registerAssistantTool`). */
|
|
126
141
|
export async function assistantToolsOf(turn) {
|
|
127
142
|
const tools = {};
|
|
@@ -133,24 +148,45 @@ export async function assistantToolsOf(turn) {
|
|
|
133
148
|
description: tool.description,
|
|
134
149
|
inputSchema: tool.inputSchema,
|
|
135
150
|
execute: (input) => attempt(async () => {
|
|
136
|
-
|
|
151
|
+
// A Work chat's tool calls as the person in the chat.
|
|
152
|
+
const caller = {
|
|
153
|
+
who: { kind: "person", id: turn.userId },
|
|
154
|
+
where: { spaceId: turn.space.id },
|
|
155
|
+
};
|
|
156
|
+
const result = await withCaller(caller, async () => tool.execute(input, {
|
|
137
157
|
tenantId: turn.tenantId,
|
|
138
158
|
space: turn.space,
|
|
139
159
|
userId: turn.userId,
|
|
140
160
|
signal: turn.signal,
|
|
141
161
|
emit: turn.emit,
|
|
142
162
|
changed: turn.changed,
|
|
143
|
-
});
|
|
163
|
+
}));
|
|
144
164
|
if (tool.card) {
|
|
145
165
|
turn.card({ plugin: plugin.source.id, tool: tool.name, data: result ?? null });
|
|
146
166
|
}
|
|
147
167
|
return result;
|
|
148
168
|
}),
|
|
149
169
|
});
|
|
170
|
+
assistantToolRisk.set(tools[id], tool.risk ?? null);
|
|
171
|
+
assistantToolPlugin.set(tools[id], plugin.source.id);
|
|
150
172
|
}
|
|
151
173
|
}
|
|
152
174
|
return tools;
|
|
153
175
|
}
|
|
176
|
+
/** How a Work chat names the plugins' assistant tools in its step lines, by the model's name. */
|
|
177
|
+
export async function assistantToolLabels(tenantId) {
|
|
178
|
+
const labels = {};
|
|
179
|
+
for (const plugin of await pluginsOf(tenantId)) {
|
|
180
|
+
for (const tool of plugin.assistantTools.values()) {
|
|
181
|
+
labels[pluginToolName(plugin.source.id, tool.name)] = {
|
|
182
|
+
plugin: plugin.source.manifest.name,
|
|
183
|
+
tool: tool.name,
|
|
184
|
+
label: tool.label ?? null,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return labels;
|
|
189
|
+
}
|
|
154
190
|
/**
|
|
155
191
|
* The admin talks to the space assistant from a plugin's own page: what the plugin says that page
|
|
156
192
|
* holds now, and its name. `null` when the tenant has no such plugin.
|
|
@@ -2,21 +2,23 @@ import { whereSchema } from "@engenty/wizards-shared/knowledge";
|
|
|
2
2
|
import { createTool } from "@mastra/core/tools";
|
|
3
3
|
import { and, eq } from "drizzle-orm";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
+
import { assertRwx, subjectsOf } from "../broker/rwx.js";
|
|
5
6
|
import { db, schema } from "../db/client.js";
|
|
6
7
|
import { prompt } from "../prompts.js";
|
|
7
8
|
import { filePaths, knowledgeCounts, listForStep, readPage, readTable, resolvePath, } from "../services/knowledge.js";
|
|
8
|
-
import { documentText, hasIndexEntries, searchKnowledge } from "../services/
|
|
9
|
+
import { documentText, hasIndexEntries, searchKnowledge } from "../services/space-index.js";
|
|
9
10
|
import { attempt, clip } from "./shared.js";
|
|
10
11
|
/**
|
|
11
12
|
* Knowledge, for every agent step of the space's wizards: search it (a question, filtered by
|
|
12
13
|
* categories first, checked by a classifier after), list it by categories, read a page, a table
|
|
13
14
|
* or a file whole by its path. Hits and reads look like files — a path, front matter, Markdown or
|
|
14
15
|
* CSV — so a model reads them as it reads files. The search also finds what the space's plugins
|
|
15
|
-
* put into the index.
|
|
16
|
+
* put into the index. Every read is the run's: its holder and its wizard ask the broker
|
|
17
|
+
* (broker/rwx.ts) before anything is handed out.
|
|
16
18
|
*/
|
|
17
|
-
const where = whereSchema.optional().describe(prompt("tools", "tool.
|
|
19
|
+
const where = whereSchema.optional().describe(prompt("tools", "tool.space.where"));
|
|
18
20
|
export const pageReadInput = {
|
|
19
|
-
path: z.string().describe("The page's path, as
|
|
21
|
+
path: z.string().describe("The page's path, as space_search or space_list give it: pages/…"),
|
|
20
22
|
section: z
|
|
21
23
|
.string()
|
|
22
24
|
.optional()
|
|
@@ -26,32 +28,34 @@ export const pageReadInput = {
|
|
|
26
28
|
/** A page of Knowledge by its path, for a step: its front matter and Markdown, in parts. */
|
|
27
29
|
export function readKnowledgePage(ctx, input) {
|
|
28
30
|
return attempt(async () => {
|
|
29
|
-
const read = await readPage(ctx.
|
|
31
|
+
const read = await readPage(ctx.space.id, input.path, input, subjectsOf(ctx));
|
|
30
32
|
await ctx.emit("tool", { code: "reads", params: { name: read.path } });
|
|
31
33
|
return read;
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
|
-
export async function
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
36
|
+
export async function spaceTools(ctx) {
|
|
37
|
+
const spaceId = ctx.space.id;
|
|
38
|
+
const who = subjectsOf(ctx);
|
|
39
|
+
const counts = await knowledgeCounts(spaceId);
|
|
40
|
+
const entries = await hasIndexEntries(spaceId);
|
|
38
41
|
if (!(counts.pages || counts.tables || counts.files || entries)) {
|
|
39
42
|
return {};
|
|
40
43
|
}
|
|
41
44
|
const tools = {
|
|
42
|
-
|
|
43
|
-
id: "
|
|
44
|
-
description: prompt("tools", "tool.
|
|
45
|
+
space_search: createTool({
|
|
46
|
+
id: "space_search",
|
|
47
|
+
description: prompt("tools", "tool.space_search"),
|
|
45
48
|
inputSchema: z.object({
|
|
46
49
|
query: z.string().describe("What to look for: a question or keywords"),
|
|
47
50
|
where,
|
|
48
51
|
limit: z.number().int().min(1).max(12).optional().describe("Items to get, 6 by default"),
|
|
49
52
|
}),
|
|
50
53
|
execute: (input) => attempt(async () => {
|
|
51
|
-
const found = await searchKnowledge(
|
|
54
|
+
const found = await searchKnowledge(spaceId, input.query, {
|
|
52
55
|
where: input.where,
|
|
53
56
|
limit: input.limit,
|
|
54
57
|
signal: ctx.signal,
|
|
58
|
+
who,
|
|
55
59
|
});
|
|
56
60
|
await ctx.emit("tool", {
|
|
57
61
|
code: "searchesKnowledge",
|
|
@@ -77,12 +81,12 @@ export async function projectTools(ctx) {
|
|
|
77
81
|
};
|
|
78
82
|
}),
|
|
79
83
|
}),
|
|
80
|
-
|
|
81
|
-
id: "
|
|
82
|
-
description: prompt("tools", "tool.
|
|
84
|
+
space_list: createTool({
|
|
85
|
+
id: "space_list",
|
|
86
|
+
description: prompt("tools", "tool.space_list"),
|
|
83
87
|
inputSchema: z.object({ where }),
|
|
84
88
|
execute: (input) => attempt(async () => {
|
|
85
|
-
const listed = await listForStep(
|
|
89
|
+
const listed = await listForStep(spaceId, input.where, who);
|
|
86
90
|
await ctx.emit("tool", { code: "listsKnowledge" });
|
|
87
91
|
return listed;
|
|
88
92
|
}),
|
|
@@ -108,16 +112,16 @@ export async function projectTools(ctx) {
|
|
|
108
112
|
offset: z.number().int().min(0).optional(),
|
|
109
113
|
}),
|
|
110
114
|
execute: (input) => attempt(async () => {
|
|
111
|
-
const read = await readTable(
|
|
115
|
+
const read = await readTable(spaceId, input.path, input, who);
|
|
112
116
|
await ctx.emit("tool", { code: "reads", params: { name: read.path } });
|
|
113
117
|
return read;
|
|
114
118
|
}),
|
|
115
119
|
});
|
|
116
120
|
}
|
|
117
121
|
if (counts.files) {
|
|
118
|
-
tools.
|
|
119
|
-
id: "
|
|
120
|
-
description: prompt("tools", "tool.
|
|
122
|
+
tools.space_document = createTool({
|
|
123
|
+
id: "space_document",
|
|
124
|
+
description: prompt("tools", "tool.space_document"),
|
|
121
125
|
inputSchema: z.object({
|
|
122
126
|
path: z
|
|
123
127
|
.string()
|
|
@@ -125,17 +129,18 @@ export async function projectTools(ctx) {
|
|
|
125
129
|
from: z.number().int().min(0).optional().describe("Character to start at"),
|
|
126
130
|
}),
|
|
127
131
|
execute: ({ path, from }) => attempt(async () => {
|
|
128
|
-
const found = await resolvePath(
|
|
132
|
+
const found = await resolvePath(spaceId, path.startsWith("files/") ? path : `files/${path}`);
|
|
129
133
|
if (found?.kind !== "file") {
|
|
130
|
-
const there = [...(await filePaths(
|
|
134
|
+
const there = [...(await filePaths(spaceId)).values()].slice(0, 40);
|
|
131
135
|
throw new Error(`No file "${path}". There are: ${there.join(", ")}`);
|
|
132
136
|
}
|
|
133
|
-
const file = await db.query.
|
|
134
|
-
where: and(eq(schema.
|
|
137
|
+
const file = await db.query.spaceFile.findFirst({
|
|
138
|
+
where: and(eq(schema.spaceFile.id, found.id), eq(schema.spaceFile.spaceId, spaceId)),
|
|
135
139
|
});
|
|
136
140
|
if (!file) {
|
|
137
141
|
throw new Error(`No file "${path}".`);
|
|
138
142
|
}
|
|
143
|
+
await assertRwx(spaceId, who, { kind: "document", id: file.id }, "r");
|
|
139
144
|
await ctx.emit("tool", { code: "reads", params: { name: file.name } });
|
|
140
145
|
const text = (await documentText(file)) || file.description;
|
|
141
146
|
const start = Math.min(from ?? 0, text.length);
|
|
@@ -3,6 +3,7 @@ import { TableColumnValueError } from "@engenty/wizards-shared/engenty/data-tabl
|
|
|
3
3
|
import { createTool } from "@mastra/core/tools";
|
|
4
4
|
import { eq } from "drizzle-orm";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
+
import { subjectsOf } from "../broker/rwx.js";
|
|
6
7
|
import { db, schema } from "../db/client.js";
|
|
7
8
|
import { parseDocument, scanDocument } from "../documents/parse.js";
|
|
8
9
|
import { loadAsset } from "../files/storage.js";
|
|
@@ -35,7 +36,7 @@ export async function personUploads(ctx) {
|
|
|
35
36
|
export async function resolveFile(ctx, file) {
|
|
36
37
|
const result = parseResultRef(file);
|
|
37
38
|
if (result) {
|
|
38
|
-
const found = await resultFile({ def: ctx.def, state: ctx.state, store: ctx.store }, result.from, result.format);
|
|
39
|
+
const found = await resultFile({ def: ctx.def, state: ctx.state, store: ctx.store, who: subjectsOf(ctx) }, result.from, result.format);
|
|
39
40
|
if (!found) {
|
|
40
41
|
throw new Error(`No result ${file}.`);
|
|
41
42
|
}
|
|
@@ -100,7 +101,7 @@ export function storeTools(ctx, uploads, keeper) {
|
|
|
100
101
|
description: prompt("tools", "tool.list_read", { catalog }),
|
|
101
102
|
inputSchema: z.object({ list: listId }),
|
|
102
103
|
execute: ({ list }) => attempt(async () => {
|
|
103
|
-
const rows = await listRows(ctx.store, defOf(list));
|
|
104
|
+
const rows = await listRows(ctx.store, defOf(list), subjectsOf(ctx));
|
|
104
105
|
return {
|
|
105
106
|
list,
|
|
106
107
|
total: rows.length,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { allFields, dataRef, widgetSize, } from "@engenty/wizards-shared/definition";
|
|
2
|
-
import { runTheme } from "@engenty/wizards-shared/projects";
|
|
3
2
|
import { note } from "@engenty/wizards-shared/run";
|
|
3
|
+
import { runTheme } from "@engenty/wizards-shared/spaces";
|
|
4
4
|
import { resolveRef } from "../engine/template.js";
|
|
5
5
|
import { StepError } from "../engine/types.js";
|
|
6
6
|
import { extFor, inlineAssetRefs, loadAsset } from "../files/storage.js";
|
|
@@ -10,17 +10,17 @@ import { mainLogoId } from "../services/brand.js";
|
|
|
10
10
|
import { snapshotFile } from "../services/files.js";
|
|
11
11
|
import { bundleWidget } from "./bundle.js";
|
|
12
12
|
import { MOTION_MEDIA_ORIGIN, probeWidget, renderMotion } from "./render.js";
|
|
13
|
-
export async function widgetBrand(
|
|
14
|
-
const logoId = await mainLogoId(
|
|
13
|
+
export async function widgetBrand(space) {
|
|
14
|
+
const logoId = await mainLogoId(space.id);
|
|
15
15
|
const logo = logoId ? await loadAsset(logoId) : null;
|
|
16
|
-
const colors =
|
|
16
|
+
const colors = space.brand.colors ?? [];
|
|
17
17
|
return {
|
|
18
|
-
name:
|
|
18
|
+
name: space.brand.name ?? "",
|
|
19
19
|
accent: colors[0]?.value ?? null,
|
|
20
20
|
logo: logo ? `data:${logo.row.mime};base64,${logo.data.toString("base64")}` : null,
|
|
21
21
|
colors,
|
|
22
|
-
facts: Object.fromEntries(
|
|
23
|
-
theme: runTheme(
|
|
22
|
+
facts: Object.fromEntries(space.facts.filter((f) => f.value.trim()).map((f) => [f.key, f.value])),
|
|
23
|
+
theme: runTheme(space.brand),
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
/** A widget inlines media up to this size; a video gets its media from the renderer instead. */
|
|
@@ -153,7 +153,7 @@ export async function runWidgetStep(step, ctx) {
|
|
|
153
153
|
entry: step.entry,
|
|
154
154
|
files: ctx.files,
|
|
155
155
|
data,
|
|
156
|
-
brand: await widgetBrand(ctx.
|
|
156
|
+
brand: await widgetBrand(ctx.space),
|
|
157
157
|
media: step.video ? MOTION_MEDIA_ORIGIN : undefined,
|
|
158
158
|
ai: origin,
|
|
159
159
|
});
|
|
@@ -201,7 +201,7 @@ export async function runWidgetStep(step, ctx) {
|
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
203
|
/** The widget with its sample data (or none) — for the studio preview and the architect's check. */
|
|
204
|
-
export async function widgetPreviewHtml(step, files,
|
|
204
|
+
export async function widgetPreviewHtml(step, files, space, data) {
|
|
205
205
|
let sample = data ?? {};
|
|
206
206
|
if (data === undefined && step.sample) {
|
|
207
207
|
const found = await snapshotFile(files, step.sample);
|
|
@@ -218,6 +218,6 @@ export async function widgetPreviewHtml(step, files, project, data) {
|
|
|
218
218
|
entry: step.entry,
|
|
219
219
|
files,
|
|
220
220
|
data: sample,
|
|
221
|
-
brand: await widgetBrand(
|
|
221
|
+
brand: await widgetBrand(space),
|
|
222
222
|
});
|
|
223
223
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{Hn as r,Qt as i,Xn as a,Xt as o,Yt as s,Zt as c,cn as l,ln as u,on as d,rn as f}from"./ui-Uqnx1UpK.js";import{t as p}from"./preload-helper-DpV6A1kQ.js";import{t as m}from"./logo-BpnjXTRy.js";import{s as h}from"./i18n-BJ7Ld6O6.js";import{g,h as _,m as v,t as y,u as b}from"./UpdateCheck-BKNkNJyG.js";import{ReleaseNotes as x,loadReleases as S,releaseDate as C,releaseLabel as w}from"./ChangelogDialog-DAnjV6cZ.js";var T=e(t(),1),E=[{name:`engenty wizards`,description:`credit.engenty-wizards`,homepage:`https://github.com/engenty/wizards`,license:`FSL-1.1-MIT`},{name:`engenty`,description:`credit.engenty`,homepage:`https://github.com/engenty/engenty`,license:`FSL-1.1-MIT`}],D=[{name:`Mastra`,description:`credit.mastra`,homepage:`https://github.com/mastra-ai/mastra`,license:`Apache-2.0`},{name:`AI SDK`,description:`credit.ai-sdk`,homepage:`https://github.com/vercel/ai`,license:`Apache-2.0`},{name:`Model Context Protocol`,description:`credit.model-context-protocol`,homepage:`https://github.com/modelcontextprotocol/typescript-sdk`,license:`MIT`},{name:`Hono`,description:`credit.hono`,homepage:`https://github.com/honojs/hono`,license:`MIT`},{name:`Drizzle ORM`,description:`credit.drizzle-orm`,homepage:`https://github.com/drizzle-team/drizzle-orm`,license:`Apache-2.0`},{name:`libSQL`,description:`credit.libsql`,homepage:`https://github.com/tursodatabase/libsql`,license:`MIT`},{name:`Playwright`,description:`credit.playwright`,homepage:`https://github.com/microsoft/playwright`,license:`Apache-2.0`},{name:`React`,description:`credit.react`,homepage:`https://github.com/facebook/react`,license:`MIT`},{name:`Vite`,description:`credit.vite`,homepage:`https://github.com/vitejs/vite`,license:`MIT`},{name:`Tailwind CSS`,description:`credit.tailwind-css`,homepage:`https://github.com/tailwindlabs/tailwindcss`,license:`MIT`},{name:`React Flow`,description:`credit.react-flow`,homepage:`https://github.com/xyflow/xyflow`,license:`MIT`},{name:`TanStack Query`,description:`credit.tanstack-query`,homepage:`https://github.com/TanStack/query`,license:`MIT`},{name:`xterm.js`,description:`credit.xterm-js`,homepage:`https://github.com/xtermjs/xterm.js`,license:`MIT`},{name:`Lucide`,description:`credit.lucide`,homepage:`https://github.com/lucide-icons/lucide`,license:`ISC`},{name:`Geist & Geist Mono`,description:`credit.geist-geist-mono`,homepage:`https://github.com/vercel/geist-font`,license:`OFL-1.1`},{name:`Space Grotesk`,description:`credit.space-grotesk`,homepage:`https://github.com/floriankarsten/space-grotesk`,license:`OFL-1.1`},{name:`git-cliff`,description:`credit.git-cliff`,homepage:`https://github.com/orhun/git-cliff`,license:`MIT OR Apache-2.0`}],O=e(n(),1),k=(e,...t)=>t.some(t=>t?.toLowerCase().includes(e));function A({name:e,homepage:t,version:n,license:i,description:a}){return(0,O.jsxs)(`li`,{className:`py-2.5`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,children:[t?(0,O.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 font-medium text-[0.875rem] text-ink underline-offset-4 hover:underline`,children:[e,(0,O.jsx)(r,{"aria-hidden":!0,className:`size-3 text-ink-4`})]}):(0,O.jsx)(`span`,{className:`font-medium text-[0.875rem] text-ink`,children:e}),n?(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:n}):null,(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:i})]}),a?(0,O.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:a}):null]})}function j({title:e,hint:t,children:n}){return(0,O.jsxs)(`section`,{className:`mt-6`,children:[(0,O.jsx)(`h3`,{className:`border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:e}),t?(0,O.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3`,children:t}):null,n]})}function M({credits:e}){return(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:e.map(e=>(0,O.jsx)(A,{name:e.name,homepage:e.homepage,license:e.license,description:h(e.description)},e.name))})}function N({label:e,packages:t}){return(0,O.jsxs)(`div`,{className:`mt-4`,children:[(0,O.jsx)(`h4`,{className:`font-medium text-[0.75rem] text-ink-3 tracking-wide`,children:e}),(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:t.map(e=>(0,O.jsx)(A,{...e},e.name))})]})}function P({active:e}){let[t,n]=(0,T.useState)(null),[r,a]=(0,T.useState)(``);(0,T.useEffect)(()=>{if(!e||t)return;let r=!1;return p(()=>import(`./oss-credits-IdX5bc71.js`).then(e=>{r||n(e.default)}),[]),()=>{r=!0}},[e,t]),(0,T.useEffect)(()=>{e||a(``)},[e]);let s=r.trim().toLowerCase(),c=e=>s?e.filter(e=>k(s,e.name,e.license,h(e.description))):e,l=e=>s?e.filter(e=>k(s,e.name,e.license,e.version)):e,u=c(E),d=c(D),m=t?[{id:`shared`,label:h(`about.creditsShared`),packages:l(t.shared)},...t.groups.map(e=>({id:e.id,label:e.label,packages:l(e.packages)}))].filter(e=>e.packages.length>0):[],g=u.length===0&&d.length===0&&m.length===0;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`mb-4 text-[0.875rem] text-ink-3`,children:h(`about.creditsHint`)}),(0,O.jsx)(i,{type:`search`,value:r,placeholder:h(`about.search`),onChange:e=>a(e.target.value)}),u.length>0?(0,O.jsx)(j,{title:h(`about.creditsProduct`),children:(0,O.jsx)(M,{credits:u})}):null,d.length>0?(0,O.jsx)(j,{title:h(`about.creditsBuiltWith`),children:(0,O.jsx)(M,{credits:d})}):null,t===null?(0,O.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,O.jsx)(f,{})}):m.length>0?(0,O.jsx)(j,{title:h(`about.creditsDeps`),hint:s?void 0:h(`about.creditsDepsHint`),children:m.map(e=>(0,O.jsx)(N,{label:e.label,packages:e.packages},e.id))}):null,t!==null&&g?(0,O.jsx)(o,{children:h(`about.noMatches`)}):null]})}var F=[`new`,`earlier`,`credits`],I=e=>h(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),L=e=>e===1?h(`about.change`):h(`about.changes`,{n:e});function R({me:e,active:t,initialTab:n=`new`}){let r=e?.mode===`local`,{data:i,latest:o}=_(r&&t),[s,c]=(0,T.useState)(null),[u,p]=(0,T.useState)(n);(0,T.useEffect)(()=>p(n),[n]);let E=v(F.indexOf(u)),D=i?.newer&&o?o:g;(0,T.useEffect)(()=>{if(!t)return;let e=!1;return c(null),S(D===`0.14.1`?void 0:D).then(t=>{e||c(t)}),()=>{e=!0}},[t,D]);let k=s?.find(e=>e.version===`v${D}`)??s?.[0]??null,A=s?.filter(e=>e!==k)??[],j=r?i?.kind??null:`cloud`;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`flex flex-col items-center pt-4 text-center`,children:[(0,O.jsx)(m,{size:96}),(0,O.jsxs)(`div`,{className:`mt-4 font-display font-semibold text-[1.5rem] tracking-tight`,children:[`engenty`,(0,O.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,O.jsx)(`span`,{className:`ml-1.5 font-normal text-ink-3`,children:`wizards`})]}),(0,O.jsxs)(`div`,{className:`mt-1 text-[0.9375rem] text-ink-3 tabular-nums`,children:[h(`about.version`,{v:g}),j?` · ${h(`about.kind.${j}`)}`:``]})]}),r?(0,O.jsx)(`div`,{className:`mt-5`,children:(0,O.jsx)(y,{enabled:t})}):null,(0,O.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,O.jsx)(d,{value:u,onChange:p,options:F.map(e=>({id:e,label:I(e)})),label:h(`about.title`)})}),(0,O.jsxs)(`div`,{className:l(`mt-5`,b(E)),children:[u===`new`?s===null?(0,O.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,O.jsx)(f,{})}):k?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[w(k),(0,O.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:C(k)})]}),(0,O.jsx)(`div`,{className:`mt-3`,children:(0,O.jsx)(x,{release:k})})]}):(0,O.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:h(`about.changelogEmpty`)}):null,u===`earlier`?(0,O.jsx)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:A.map(e=>(0,O.jsxs)(`details`,{className:`group/r py-2`,children:[(0,O.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-baseline gap-3 text-[0.875rem] [&::-webkit-details-marker]:hidden`,children:[(0,O.jsx)(a,{className:`size-3.5 shrink-0 self-center text-ink-4 transition group-open/r:rotate-90`}),(0,O.jsx)(`span`,{className:`font-medium text-ink tabular-nums`,children:w(e)}),(0,O.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:C(e)}),(0,O.jsx)(`span`,{className:`ml-auto text-[0.8125rem] text-ink-4`,children:L(e.commits.length)})]}),(0,O.jsx)(`div`,{className:`mt-2 pl-6`,children:(0,O.jsx)(x,{release:e})})]},e.version??`unreleased`))}):null,u===`credits`?(0,O.jsx)(P,{active:!0}):null]},u)]})}function z({open:e,onClose:t,me:n}){return(0,O.jsxs)(s,{open:e,onClose:t,wide:!0,height:`tall`,children:[(0,O.jsx)(`div`,{className:`-mt-2 -mr-2 sticky top-0 z-10 flex h-0 justify-end`,children:(0,O.jsx)(c,{label:h(`common.close`),onClick:t,children:(0,O.jsx)(u,{className:`size-4`})})}),(0,O.jsx)(R,{me:n,active:e})]})}export{z as AboutDialog,R as AboutPanel};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkillEditor-CqQMg2MC.js","assets/rolldown-runtime-hePW80VL.js","assets/jsx-runtime-BNakU3Ej.js","assets/ui-Uqnx1UpK.js","assets/preload-helper-DpV6A1kQ.js","assets/i18n-BJ7Ld6O6.js","assets/useMutation-DEkZhp5c.js","assets/Skills-CnhpgoOA.js","assets/circle-check-Bu9Z3mlJ.js","assets/upload-BchUnQGV.js","assets/code-xml-B4kLFZSj.js","assets/scroll-text-ChrjRu9Y.js","assets/eye-BpoKpIdt.js","assets/code-editor-CfTGqOpp.js","assets/dist-EBVTpvRr.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{$n as r,$t as i,G as a,Jt as o,Kt as s,Qn as c,Qt as l,Wr as u,Xn as d,Xt as f,Yt as p,_r as m,b as h,bn as g,cn as _,dr as v,fr as y,gr as b,lr as x,m as S,nn as C,on as w,q as T,qt as E,rn as D,sr as O,vn as k,vr as A,wn as j,yr as M}from"./ui-Uqnx1UpK.js";import{t as N}from"./useMutation-DEkZhp5c.js";import{t as P}from"./preload-helper-DpV6A1kQ.js";import{Lt as F,Nt as I,Pt as ee,Qt as te,Rt as ne,a as re,l as ie,m as ae,p as L,t as oe,un as se}from"./host-C0WQlRKB.js";import{a as ce,f as le,o as ue,r as de,s as R}from"./Skills-CnhpgoOA.js";import{n as z}from"./volume-2-CU_oy81Z.js";import{i as B,n as V,o as fe,r as pe,s as me,t as H}from"./connection-sign-in-Cngd_QDO.js";import{t as U}from"./scroll-text-ChrjRu9Y.js";import{b as he,d as W,n as ge,u as G}from"./session-SXPtTWRK.js";import{n as K,s as q}from"./i18n-BJ7Ld6O6.js";import{a as _e,c as ve,d as ye,f as be,i as xe,m as Se,p as Ce,r as we,u as Te}from"./UpdateCheck-BKNkNJyG.js";var Ee={name:`compass`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]};Ee.node;var De=O(Ee),J=e(t(),1),Oe=[`admins`,`members`,`all`],ke=[`read`,`write`,`destructive`,`send`],Ae=[`allow`,`ask`,`deny`],je={name:80,perSpace:200},Y=e(n(),1),X=e=>[`space-connections`,e];function Me(e){return M({enabled:!!e,queryKey:X(e),queryFn:()=>T.get(`/api/studio/spaces/${e}/connections`)})}function Ne(e){return M({enabled:!!e,queryKey:a.connectors(e),queryFn:()=>T.get(`/api/studio/spaces/${e}/connectors`)})}function Pe(e,t,n){let r=new Set(t.map(e=>e.connectorId));return e.filter(e=>e.sourceKind===`builtin`&&!r.has(e.id)&&(e.usable||n))}var Z={admins:`connection.audience.admins`,members:`connection.audience.members`,all:`connection.audience.all`},Fe={admins:`connection.audience.adminsHint`,members:`connection.audience.membersHint`,all:`connection.audience.allHint`},Ie={read:`connection.kind.read`,write:`connection.kind.write`,destructive:`connection.kind.destructive`,send:`connection.kind.send`},Le={read:`connection.kind.readHint`,write:`connection.kind.writeHint`,destructive:`connection.kind.destructiveHint`,send:`connection.kind.sendHint`},Re={allow:`connection.outcome.allow`,ask:`connection.outcome.ask`,deny:`connection.outcome.deny`},ze={space:`connection.signIn.space`,person:`connection.signIn.person`},Be={space:`connection.signIn.spaceHint`,person:`connection.signIn.personHint`},Ve=e=>new Intl.DateTimeFormat(K,{dateStyle:`medium`}).format(new Date(e));function He(e){let t=Math.round((Date.parse(e)-Date.now())/1e3),n=new Intl.RelativeTimeFormat(K,{numeric:`auto`});for(let[e,r]of[[`day`,86400],[`hour`,3600],[`minute`,60]])if(Math.abs(t)>=r)return n.format(Math.round(t/r),e);return n.format(0,`minute`)}function Q(e){let t=e.connector?.name??e.connectorId;return e.name===t?e.name:`${t} · ${e.name}`}function Ue(e){return e.signIn===`space`?e.account?q(`connection.asSpaceAccount`,{label:e.account.label}):q(`connection.asSpaceNotYet`):q(`connection.eachPersonCount`,{n:e.signedIn})}function We(e){return e.lastUsedAt?q(`connection.lastUsed`,{when:He(e.lastUsedAt)}):q(`connection.neverUsed`)}function Ge(e){let t=e.toLowerCase().replace(/^https?:\/\//,``).split(`/`)[0].split(`.`);return t.length>1?t[t.length-2]:t[0]}function Ke(e,t){if(!e)return null;let n=t.find(t=>t.id===e);if(n)return{connectorId:n.id};let r=t.find(t=>t.domain&&t.domain===e.toLowerCase());if(r)return{connectorId:r.id};let i=Ge(e),a=t.find(e=>e.sourceKind===`builtin`&&(e.id===i||e.id.endsWith(`-${i}`)||e.name.toLowerCase()===i));return a?{connectorId:a.id}:e.includes(`.`)?{domain:e}:null}function qe({name:e,large:t}){return(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:_(`flex shrink-0 items-center justify-center rounded-lg bg-paper-2 font-semibold text-ink-2`,t?`size-12 text-[0.9375rem]`:`size-9 text-[0.75rem]`),children:ge(e)||`?`})}function Je(){let[e,t]=v(),{space:n}=G(),r=W(),{narrow:i}=Ce(),a=u(),o=n?.id??``,s=e.get(`show`),c=e.get(`setup`),l=r&&!n?.readOnly,d=Me(o),f=Ne(o),p=d.data?.connections??[],m=p.find(e=>e.id===s)??null;ye(m?Q(m):null),pe((0,J.useCallback)(()=>{a.invalidateQueries({queryKey:[`space-connections`]}),a.invalidateQueries({queryKey:[`person-sign-ins`]})},[a])),(0,J.useEffect)(()=>{i||L().scrollTo({top:0})},[i,s]);let h=e=>i?t({show:e}):t(e===`all`?{}:{show:e},{replace:!0});return(0,Y.jsx)(Y.Fragment,{children:n?(0,Y.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:m?(0,Y.jsx)(Qe,{connection:m,connector:f.data?.find(e=>e.id===m.connectorId),writable:l,onGone:()=>h(`all`)},m.id):(0,Y.jsx)(Ye,{spaceId:n.id,connections:p,loading:d.isPending,error:d.error,connectors:f.data??[],writable:l,setup:c,onOpen:h,onSetUp:e=>{t({setup:e},{replace:!i}),i||L().scrollTo({top:0,behavior:`smooth`})},onSetUpDone:()=>t({},{replace:!0})})}):null})}function Ye({spaceId:e,connections:t,loading:n,error:r,connectors:i,writable:a,setup:o,onOpen:c,onSetUp:l,onSetUpDone:u}){let d=I(`unsetConnectors`),p=(0,J.useRef)(null),m=o&&i.length?Ke(o,i):null,g=m&&`domain`in m?m.domain:null;(0,J.useEffect)(()=>{g&&p.current?.scrollIntoView({block:`start`,behavior:`smooth`})},[g]);let v=Pe(i,t,d);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(h,{title:q(`capabilities.connectors`),hint:q(`capabilities.connectors.hint`),plain:!0,action:a&&o===null?(0,Y.jsxs)(s,{size:`sm`,onClick:()=>l(``),children:[(0,Y.jsx)(j,{className:`size-4`}),` `,q(`capabilities.connectors.add`)]}):null,children:[a&&o!==null?(0,Y.jsx)(Ze,{spaceId:e,connectors:i,initial:m&&`connectorId`in m?m.connectorId:``,onCancel:u,onDone:c},m&&`connectorId`in m?m.connectorId:`new`):null,(0,Y.jsx)(`h3`,{className:`px-1 pt-2 font-display font-semibold text-base`,children:q(`capabilities.inSpace`)}),r?(0,Y.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:r.message}):t.length?(0,Y.jsx)(E,{className:`flex flex-col divide-y divide-border-soft p-0`,children:t.map(e=>(0,Y.jsx)(Xe,{connection:e,onOpen:()=>c(e.id)},e.id))}):n?null:(0,Y.jsx)(E,{children:(0,Y.jsx)(f,{children:q(a?`capabilities.connectors.noneAdmin`:`capabilities.connectors.none`)})})]}),v.length?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 px-1`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold text-[0.875rem]`,children:q(`capabilities.connectors.builtin`)}),(0,Y.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:q(a?`capabilities.connectors.builtinHint`:`capabilities.connectors.builtinHintMember`)}),(0,Y.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,children:v.map(e=>(0,Y.jsx)(`li`,{children:a&&e.usable?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>l(e.id),title:q(`capabilities.connectors.setUpNamed`,{name:e.name}),className:`inline-flex h-8 items-center gap-1.5 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:[(0,Y.jsx)(j,{className:`size-3.5`,"aria-hidden":`true`}),e.name]}):(0,Y.jsx)(`span`,{title:e.missingSetup??void 0,className:_(`inline-flex h-8 items-center rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-3`,!e.usable&&`opacity-60`),children:e.name})},e.id))})]}):null,(0,Y.jsx)(`div`,{ref:p,className:`scroll-mt-6`,children:(0,Y.jsx)(h,{title:q(`capabilities.connectors.more`),hint:q(`capabilities.connectors.moreHint`),children:(0,Y.jsx)(me,{spaceId:e,readOnly:!a,embedded:!0,onSetUp:a?l:void 0,domain:g})})})]})}function Xe({connection:e,onOpen:t}){let n=u(),r=B(`/api/studio/connections/${encodeURIComponent(e.id)}/my-sign-in`,()=>n.invalidateQueries({queryKey:X(e.spaceId)})),i=Object.values(e.rules).includes(`ask`),a=e.signIn===`person`;return(0,Y.jsxs)(`div`,{className:`px-3.5 py-3 sm:px-5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:t,className:`-my-1 -ml-1 flex min-w-0 flex-1 items-center gap-3 rounded-lg p-1 text-left transition hover:bg-paper-2`,children:[(0,Y.jsx)(qe,{name:e.connector?.name??e.connectorId}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`truncate text-[0.9375rem]`,children:Q(e)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[0.8125rem] text-ink-3`,children:[a?(0,Y.jsx)(F,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}):(0,Y.jsx)(se,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{className:`truncate`,children:[Ue(e),` · `,We(e)]})]})]}),(0,Y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 max-sm:hidden`,children:[i?(0,Y.jsx)(o,{tone:`warn`,children:q(`connection.outcome.ask`)}):null,(0,Y.jsx)(o,{children:q(Z[e.audience])})]})]}),a?(0,Y.jsx)(H,{s:r,auth:e.connector?.auth,signedIn:!!e.mySignIn}):null]}),a?(0,Y.jsx)(V,{s:r,fields:e.connector?.fields??[],signedIn:!!e.mySignIn,confirmText:q(`konto.connectionSignOutConfirm`,{name:Q(e)}),className:`ml-12`}):null]})}function Ze({spaceId:e,connectors:t,initial:n,onCancel:r,onDone:a}){let o=u(),c=t.filter(e=>e.usable),[d,f]=(0,J.useState)(c.some(e=>e.id===n)?n:``),p=c.find(e=>e.id===d),[m,h]=(0,J.useState)(p?.name??``),[g,_]=(0,J.useState)(p?.auth===`oauth2`?`person`:`space`),[v,y]=(0,J.useState)(`members`),b=N({mutationFn:()=>T.post(`/api/studio/spaces/${e}/connections`,{connectorId:d,name:m.trim()||p?.name,signIn:g,audience:v}),onSuccess:async t=>{await o.invalidateQueries({queryKey:X(e)}),await o.invalidateQueries({queryKey:[`person-sign-ins`]}),a(t.id)}});return(0,Y.jsx)(E,{className:`p-3.5 sm:p-5`,children:(0,Y.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d&&b.mutate()},className:`flex flex-col gap-5`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`font-display font-semibold text-base`,children:q(`capabilities.connectors.add`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-[0.8125rem] text-ink-3`,children:q(`connection.setupHint`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(i,{children:q(`connection.connector`)}),(0,Y.jsx)(C,{value:d,onChange:e=>{let t=c.find(t=>t.id===e);(!m.trim()||m===p?.name)&&h(t?.name??``),f(e)},placeholder:q(`connection.connectorPick`),options:c.map(e=>({value:e.id,label:e.name}))})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(i,{hint:q(`connection.nameHint`),children:q(`connection.name`)}),(0,Y.jsx)(l,{value:m,maxLength:je.name,placeholder:q(`connection.namePlaceholder`),onChange:e=>h(e.target.value)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(i,{hint:q(Be[g]),children:q(`connection.signIn`)}),(0,Y.jsx)(w,{label:q(`connection.signIn`),value:g,onChange:_,options:[`space`,`person`].map(e=>({id:e,label:q(ze[e])}))}),(0,Y.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-3`,children:q(`connection.signInFixed`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(i,{hint:q(Fe[v]),children:q(`connection.audience`)}),(0,Y.jsx)(w,{label:q(`connection.audience`),value:v,onChange:y,options:Oe.map(e=>({id:e,label:q(Z[e])}))})]}),b.error?(0,Y.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:b.error.message}):null,(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(s,{type:`submit`,busy:b.isPending,disabled:!d,children:q(`capabilities.connectors.setUp`)}),(0,Y.jsx)(s,{type:`button`,variant:`ghost`,onClick:r,children:q(`orgSettings.cancel`)})]})]})})}function Qe({connection:e,connector:t,writable:n,onGone:r}){let i=u(),a=X(e.spaceId),c=()=>i.invalidateQueries({queryKey:a}),[d,f]=(0,J.useState)(e.name),[p,m]=(0,J.useState)(!1),h=`/api/studio/connections/${encodeURIComponent(e.id)}`,g=N({mutationFn:e=>T.patch(h,e),onSuccess:e=>{i.setQueryData(a,t=>t&&{connections:t.connections.map(t=>t.id===e.id?e:t)}),i.invalidateQueries({queryKey:[`person-sign-ins`]})}}),_=N({mutationFn:()=>T.del(h),onSuccess:async()=>{await c(),i.invalidateQueries({queryKey:[`person-sign-ins`]}),r()}}),v=B(`${h}/sign-in`,c),y=B(`${h}/my-sign-in`,c),b=()=>{let t=d.trim();t&&t!==e.name?g.mutate({name:t}):f(e.name)},x=e.connector?.name??e.connectorId,S=e.connector?.fields??[],C=e.setUpByName?q(`konto.connectionSetUpBy`,{name:e.setUpByName,when:Ve(e.setUpAt)}):q(`konto.connectionSetUpAt`,{when:Ve(e.setUpAt)}),D=n=>(t?.actions??[]).filter(e=>e.group===n).filter(t=>!e.actions.length||e.actions.includes(t.id));return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-4 px-1`,children:[(0,Y.jsx)(qe,{name:x,large:!0}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:x}),e.connector?.description?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[0.875rem] text-ink-3`,children:e.connector.description}):null]})]}),(0,Y.jsxs)(E,{className:`flex flex-col gap-5 p-3.5 sm:p-5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1`,children:[n?(0,Y.jsx)(l,{"aria-label":q(`connection.name`),className:`max-w-sm font-semibold`,value:d,maxLength:je.name,onChange:e=>f(e.target.value),onBlur:b,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),b())}}):(0,Y.jsx)(`b`,{className:`text-[0.9375rem]`,children:e.name}),(0,Y.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:n?C:q(`connection.adminsManage`)})]}),(0,Y.jsx)($,{label:q(`connection.signIn`),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[0.875rem]`,children:[e.signIn===`space`?(0,Y.jsx)(se,{className:`size-4 text-ink-3`,"aria-hidden":`true`}):(0,Y.jsx)(F,{className:`size-4 text-ink-3`,"aria-hidden":`true`}),q(ze[e.signIn])]}),(0,Y.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:q(Be[e.signIn])})]})}),e.signIn===`space`?(0,Y.jsx)($,{label:q(`connection.account`),children:(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-[0.875rem]`,children:e.account?q(`connection.accountSignedIn`,{label:e.account.label}):q(n?`connection.accountNotYetAdmin`:`connection.accountNotYet`)}),n?(0,Y.jsx)(H,{s:v,auth:e.connector?.auth,signedIn:!!e.account}):null]}),n?(0,Y.jsx)(V,{s:v,fields:S,signedIn:!!e.account,confirmText:q(`connection.signOutSpaceConfirm`,{name:Q(e)})}):null]})}):(0,Y.jsx)($,{label:q(`connection.people`),children:(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`span`,{className:`text-[0.875rem]`,children:[q(`connection.peopleSignedIn`,{n:e.signedIn}),` · `,e.mySignIn?q(`connection.youSignedIn`,{label:e.mySignIn.label}):q(`connection.youNotYet`)]}),(0,Y.jsx)(H,{s:y,auth:e.connector?.auth,signedIn:!!e.mySignIn})]}),(0,Y.jsx)(V,{s:y,fields:S,signedIn:!!e.mySignIn,confirmText:q(`konto.connectionSignOutConfirm`,{name:Q(e)})})]})}),(0,Y.jsx)($,{label:q(`connection.audience`),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[n?(0,Y.jsx)(`div`,{children:(0,Y.jsx)(w,{label:q(`connection.audience`),value:e.audience,onChange:e=>g.mutate({audience:e}),options:Oe.map(e=>({id:e,label:q(Z[e])}))})}):(0,Y.jsx)(`span`,{children:(0,Y.jsx)(o,{children:q(Z[e.audience])})}),(0,Y.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:q(Fe[e.audience])})]})}),(0,Y.jsx)(`div`,{className:`border-border-soft border-t`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold text-[0.875rem]`,children:q(`connection.rules`)}),ke.map(t=>{let r=D(t);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`font-medium text-[0.875rem]`,children:q(Ie[t])}),(0,Y.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:q(Le[t])}),r.length?(0,Y.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[0.6875rem] text-ink-4`,children:r.map(e=>e.id).join(` · `)}):null]}),(0,Y.jsx)(`div`,{className:`shrink-0`,children:n?(0,Y.jsx)(w,{label:q(Ie[t]),value:e.rules[t],onChange:n=>g.mutate({rules:{...e.rules,[t]:n}}),options:Ae.map(e=>({id:e,label:q(Re[e])}))}):(0,Y.jsx)(o,{tone:e.rules[t]===`ask`?`warn`:`neutral`,children:q(Re[e.rules[t]])})})]},t)}),(0,Y.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:q(n?`connection.askHint`:`connection.askHintMember`)})]}),g.error?(0,Y.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:g.error.message}):null]}),(0,Y.jsx)(E,{className:`flex flex-col gap-1 p-3.5 sm:p-5`,children:(0,Y.jsx)($,{label:q(`connection.use`),children:(0,Y.jsx)(`span`,{className:`text-[0.875rem]`,children:We(e)})})}),n?(0,Y.jsxs)(`div`,{className:`px-1`,children:[p?(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-lg bg-paper p-3 text-[0.875rem] ring-1 ring-border-soft`,children:[(0,Y.jsx)(`p`,{className:`min-w-48 flex-1`,children:q(`connection.removeConfirm`,{name:Q(e)})}),(0,Y.jsx)(s,{variant:`ghost`,onClick:()=>m(!1),children:q(`orgSettings.cancel`)}),(0,Y.jsx)(s,{variant:`danger`,busy:_.isPending,onClick:()=>_.mutate(),children:q(`connection.remove`)})]}):(0,Y.jsx)(s,{variant:`danger`,size:`sm`,onClick:()=>m(!0),children:q(`connection.remove`)}),_.error?(0,Y.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:_.error.message}):null]}):null]})}function $({label:e,children:t}){return(0,Y.jsxs)(`div`,{className:`grid gap-1.5 sm:grid-cols-[11rem_minmax(0,1fr)] sm:gap-4`,children:[(0,Y.jsx)(`span`,{className:`pt-0.5 text-[0.8125rem] text-ink-3`,children:e}),t]})}var $e=[`discover.example1`,`discover.example2`,`discover.example3`],et=(e,t)=>t===void 0?[`discover`,e]:[`discover`,e,t];function tt(){let[e,t]=v(),n=e.get(`q`)??``,[r,i]=(0,J.useState)(n);return(0,J.useEffect)(()=>i(e=>e.trim()===n.trim()?e:n),[n]),(0,J.useEffect)(()=>{let e=r.trim();if(e===n.trim())return;let i=setTimeout(()=>t(t=>{let n=new URLSearchParams(t);return e?n.set(`q`,e):n.delete(`q`),n},{replace:!0}),350);return()=>clearTimeout(i)},[r,n,t]),[r,i,n.trim()]}function nt({asked:e,onExample:t}){let{space:n}=G(),r=W(),i=I(`skills`),o=u(),[c,l]=(0,J.useState)(null),d=n?.id??``,f=M({queryKey:et(d,e),queryFn:()=>T.get(`/api/studio/spaces/${d}/discover?q=${encodeURIComponent(e)}`),enabled:!!d&&e.length>=2,staleTime:6e4}),m=e=>{o.setQueriesData({queryKey:et(d)},t=>t&&{...t,skills:t.skills.map(t=>t.ref===e?{...t,added:!0}:t)}),o.invalidateQueries({queryKey:a.skills(d)})},h=N({mutationFn:e=>T.post(`/api/studio/spaces/${d}/skills/registry`,{ref:e,mode:`demand`}),onSuccess:(e,t)=>m(t)}),_=f.data,v=_&&!_.skills.length&&!_.connectors.length&&!_.errors.skills&&!_.errors.connectors;return n?(0,Y.jsxs)(Y.Fragment,{children:[e.length<2?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 px-1 text-[0.875rem] text-ink-3`,children:[(0,Y.jsx)(`p`,{children:q(`discover.start`)}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:$e.map(e=>(0,Y.jsxs)(s,{variant:`secondary`,size:`sm`,onClick:()=>t(q(e)),children:[(0,Y.jsx)(g,{className:`size-3.5`}),` `,q(e)]},e))})]}):f.error?(0,Y.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:f.error.message}):_?v?(0,Y.jsx)(`p`,{className:`px-1 text-[0.875rem] text-ink-3`,children:q(`discover.none`,{q:e})}):(0,Y.jsxs)(Y.Fragment,{children:[i?(0,Y.jsx)(rt,{title:q(`space.skills`),count:_.skills.length,error:_.errors.skills,empty:q(`discover.groupNone`,{directory:`skills.sh`}),children:_.skills.map(e=>(0,Y.jsx)(ot,{hit:e,adding:h.isPending&&h.variables===e.ref,failed:h.isError&&h.variables===e.ref?h.error:null,onLook:()=>l(e.ref),onAdd:()=>h.mutate(e.ref)},e.ref))}):null,(0,Y.jsx)(rt,{title:q(`capabilities.connectors`),count:_.connectors.length,error:_.errors.connectors,empty:q(`discover.groupNone`,{directory:`integrations.sh`}),children:_.connectors.map(e=>(0,Y.jsx)(st,{hit:e,admin:r},e.domain))})]}):(0,Y.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,Y.jsx)(D,{className:`size-5`})}),(0,Y.jsx)(p,{open:c!==null,onClose:()=>l(null),wide:!0,height:`tall`,title:q(`skills.registryTitle`),children:c?(0,Y.jsx)(de,{spaceId:d,skillRef:c,onAdded:()=>{m(c),l(null)}},c):null})]}):null}function rt({title:e,count:t,error:n,empty:r,children:i}){return(0,Y.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-baseline gap-2 px-1`,children:[(0,Y.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:e}),t?(0,Y.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:t}):null]}),n?(0,Y.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:n}):t?(0,Y.jsx)(E,{className:`divide-y divide-border-soft`,children:i}):(0,Y.jsx)(`p`,{className:`px-1 text-[0.875rem] text-ink-3`,children:r})]})}function it({icon:e,name:t,mono:n,chip:r,line:i,source:a,error:o,children:s}){return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 px-3 py-3 sm:flex-nowrap`,children:[(0,Y.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-paper-2 text-ink-3`,children:(0,Y.jsx)(e,{className:`size-4`})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1 max-sm:basis-[calc(100%-3.25rem)]`,children:[(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:n?`font-medium font-mono text-[0.8125rem]`:`font-medium`,children:t}),r]}),i?(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-[0.8125rem] text-ink-2`,children:i}):null,(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-[0.75rem] text-ink-3`,children:a}),o?(0,Y.jsx)(`span`,{className:`mt-1 block text-[0.8125rem] text-rose`,children:o}):null]}),(0,Y.jsx)(`span`,{className:`flex shrink-0 items-center gap-2 max-sm:ml-[3.25rem]`,children:s})]})}function at(){return(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[0.8125rem] text-moss`,children:[(0,Y.jsx)(r,{className:`size-4`}),` `,q(`capabilities.inSpace`)]})}function ot({hit:e,adding:t,failed:n,onLook:r,onAdd:i}){return(0,Y.jsxs)(it,{icon:U,name:e.name,mono:!0,chip:e.official?(0,Y.jsx)(o,{tone:`live`,icon:(0,Y.jsx)(le,{className:`size-3`}),children:q(`skills.official`)}):(0,Y.jsx)(o,{tone:`warn`,children:q(`skills.unchecked`)}),error:n?.message,source:[`skills.sh`,e.source,q(`skills.installs`,{n:e.installs.toLocaleString(K)})].join(` · `),children:[(0,Y.jsx)(s,{variant:`ghost`,size:`sm`,onClick:r,children:q(`skills.open`)}),e.added?(0,Y.jsx)(at,{}):(0,Y.jsx)(s,{variant:`secondary`,size:`sm`,busy:t,onClick:i,children:q(`skills.add`)})]})}function st({hit:e,admin:t}){let n=m(),r=e.kinds.map(e=>e===`mcp`?`MCP`:`OpenAPI`);return(0,Y.jsx)(it,{icon:z,name:e.name,line:e.description||void 0,source:[`integrations.sh`,e.domain,...r].join(` · `),children:e.setUp?(0,Y.jsx)(at,{}):t?(0,Y.jsx)(s,{variant:`secondary`,size:`sm`,onClick:()=>n(`/capabilities/connectors?setup=${encodeURIComponent(e.domain)}`),children:q(`discover.setUp`)}):null})}var ct={skills:4,connections:5};function lt(){let{space:e}=G(),t=W(),n=m(),r=I(`skills`),i=I(`unsetConnectors`),[a,o]=v(),s=a.get(`tab`)===`discover`?`discover`:`space`,[c,l,u]=tt(),d=e?.id??``,p=R(r?e?.id:void 0),_=Me(d),y=Ne(d);if(!e)return null;let b=t&&!e.readOnly,S=c.trim().toLowerCase(),C=p.data?.skills??[],T=_.data?.connections??[],D=C.filter(e=>e.mode!==`off`).sort((e,t)=>e.mode===t.mode?0:e.mode===`always`?-1:1),O=S?C.filter(e=>e.name.includes(S)||e.description.toLowerCase().includes(S)):D,k=S?T.filter(e=>`${e.name} ${e.connector?.name??e.connectorId}`.toLowerCase().includes(S)):T,A=Pe(y.data??[],T,i),j=e=>o(t=>{let n=new URLSearchParams(t);return e===`discover`?n.set(`tab`,`discover`):n.delete(`tab`),n},{replace:!0});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[(0,Y.jsx)(h,{title:q(`nav.capabilities`),hint:q(`capabilities.overview.hint`),plain:!0,action:(0,Y.jsx)(ft,{entries:[...r&&!p.data?.readOnly?[{icon:U,label:q(`capabilities.overview.addSkill`),hint:q(`capabilities.overview.addSkillHint`),to:`/capabilities/skills`}]:[],...b?[{icon:z,label:q(`capabilities.overview.addConnection`),hint:q(`capabilities.overview.addConnectionHint`),to:`/capabilities/connectors?setup=`}]:[],{icon:De,label:q(`capabilities.discover`),hint:q(`capabilities.overview.discoverHint`),to:`/capabilities/overview?tab=discover`}]}),children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Y.jsx)(w,{value:s,onChange:j,options:[{id:`space`,label:q(`capabilities.inSpace`)},{id:`discover`,label:q(`capabilities.discover`)}],label:q(`nav.capabilities`)}),(0,Y.jsxs)(`form`,{className:`flex h-10 min-w-0 flex-1 basis-60 items-center gap-2 rounded-full border border-input bg-card px-4 focus-within:border-focus focus-within:ring-4 focus-within:ring-focus-glow`,onSubmit:e=>{e.preventDefault(),s===`space`&&S&&!O.length&&!k.length&&j(`discover`)},children:[(0,Y.jsx)(g,{className:`size-4 shrink-0 text-ink-3`}),(0,Y.jsx)(`input`,{type:`search`,value:c,"aria-label":q(s===`discover`?`discover.searchLabel`:`capabilities.overview.search`),placeholder:q(s===`discover`?`discover.search`:`capabilities.overview.search`),onChange:e=>l(e.target.value),className:`min-w-0 flex-1 bg-transparent text-[0.875rem] text-ink outline-none placeholder:text-ink-4`})]})]})}),(0,Y.jsx)(`div`,{className:`flex animate-rise flex-col gap-9`,children:s===`discover`?(0,Y.jsx)(nt,{asked:u,onExample:l}):(0,Y.jsxs)(Y.Fragment,{children:[r?(0,Y.jsx)(ut,{icon:U,title:q(`space.skills`),all:C.length,to:`/capabilities/skills`,children:p.error?(0,Y.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:p.error.message}):O.length?(0,Y.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2`,children:O.slice(0,ct.skills).map(e=>(0,Y.jsx)(dt,{skill:e,onOpen:()=>n(`/capabilities/skills?show=k:${e.id}`)},e.id))}):p.isPending?null:(0,Y.jsx)(E,{children:(0,Y.jsx)(f,{children:S?q(`capabilities.overview.nothing`,{q:c.trim()}):q(`capabilities.overview.noSkills`)})})}):null,(0,Y.jsxs)(ut,{icon:z,title:q(`capabilities.connectors`),all:T.length,to:`/capabilities/connectors`,children:[_.error?(0,Y.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:_.error.message}):k.length?(0,Y.jsx)(E,{className:`flex flex-col divide-y divide-border-soft p-0`,children:k.slice(0,ct.connections).map(e=>(0,Y.jsx)(Xe,{connection:e,onOpen:()=>n(`/capabilities/connectors?show=${encodeURIComponent(e.id)}`)},e.id))}):_.isPending?null:(0,Y.jsx)(E,{children:(0,Y.jsx)(f,{children:S?q(`capabilities.overview.nothing`,{q:c.trim()}):q(`capabilities.overview.noConnections`)})}),A.length&&!S?(0,Y.jsxs)(`p`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:[q(`capabilities.connectors.builtin`),`:`,` `,A.map((e,t)=>(0,Y.jsxs)(`span`,{children:[t?` · `:null,b&&e.usable?(0,Y.jsx)(x,{to:`/capabilities/connectors?setup=${encodeURIComponent(e.id)}`,className:`text-ink-2 hover:text-ink hover:underline`,children:e.name}):(0,Y.jsx)(`span`,{className:`text-ink-2`,children:e.name})]},e.id))]}):null]})]})},s)]})}function ut({icon:e,title:t,all:n,to:r,children:i}){return(0,Y.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-2 font-semibold text-[0.9375rem]`,children:[(0,Y.jsx)(e,{className:`size-4 text-ember-strong`,"aria-hidden":`true`}),t]}),(0,Y.jsxs)(x,{to:r,className:`inline-flex items-center gap-0.5 text-[0.8125rem] text-ink-3 transition hover:text-ink`,children:[q(`capabilities.overview.all`,{n}),(0,Y.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`})]})]}),i]})}function dt({skill:e,onOpen:t}){return(0,Y.jsxs)(`button`,{type:`button`,onClick:t,className:`flex min-w-0 flex-col gap-1.5 rounded-xl bg-card px-4 py-3 text-left shadow-soft ring-1 ring-border-soft transition hover:ring-border`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:_(`truncate font-medium font-mono text-[0.8125rem]`,e.mode===`off`&&`text-ink-3`),children:e.name}),(0,Y.jsx)(o,{tone:e.mode===`always`?`live`:`neutral`,children:q(`skills.mode.${e.mode}`)})]}),(0,Y.jsx)(`span`,{className:`line-clamp-2 text-[0.8125rem] text-ink-2`,children:e.description}),(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[0.75rem] text-ink-3`,children:[(0,Y.jsx)(ue,{skill:e}),e.runScripts?q(`capabilities.overview.scripts`):null]})]})}function ft({entries:e}){let[t,n]=(0,J.useState)(!1),r=(0,J.useRef)(null);return(0,J.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)},i=e=>e.key===`Escape`&&n(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,i)}},[t]),(0,Y.jsxs)(`div`,{className:`relative`,ref:r,children:[(0,Y.jsxs)(s,{size:`sm`,"aria-haspopup":`menu`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,Y.jsx)(j,{className:`size-4`}),` `,q(`skills.add`),(0,Y.jsx)(c,{className:`-mr-1 size-4`})]}),t?(0,Y.jsx)(`div`,{role:`menu`,className:`absolute top-10 right-0 z-50 w-72 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:e.map(e=>(0,Y.jsxs)(x,{to:e.to,role:`menuitem`,onClick:()=>n(!1),className:`flex w-full items-start gap-2.5 rounded-lg px-2.5 py-2 text-left transition hover:bg-accent`,children:[(0,Y.jsx)(e.icon,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium text-[0.875rem]`,children:e.label}),(0,Y.jsx)(`span`,{className:`block text-[0.8125rem] text-ink-3`,children:e.hint})]})]},e.to))}):null]})}var pt=(0,J.lazy)(()=>P(()=>import(`./SkillEditor-CqQMg2MC.js`).then(e=>({default:e.SkillEditor})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])));function mt(){let[e,t]=v(),{space:n}=G(),r=re(),{narrow:i}=Ce(),a=e.get(`show`),o=a?.startsWith(`k:`)?a:null,s=R(n?.id),c=ie(`skills`,r).filter(e=>e.plugin);ye(s.data?.skills.find(e=>`k:${e.id}`===o)?.name??null),(0,J.useEffect)(()=>{i||L().scrollTo({top:0})},[i,o]);let l=e=>i?t({show:e}):t(e===`all`?{}:{show:e},{replace:!0});return(0,Y.jsx)(Y.Fragment,{children:n?(0,Y.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:o?(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(pt,{skillId:o.slice(2),onGone:()=>l(`all`),onOpen:l,filesFirst:!0},o)}):s.data?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ce,{spaceId:n.id,data:s.data,onOpen:l,heading:q(`capabilities.inSpace`)}),c.flatMap(e=>e.sections).map(e=>r.spaceSections.find(t=>t.id===e.id)).filter(e=>e!==void 0).map(e=>(0,Y.jsx)(S,{id:e.id,children:(0,Y.jsx)(h,{title:e.label(),hint:e.hint?.(),plain:!0,children:(0,Y.jsx)(oe,{of:e,children:(0,Y.jsx)(e.component,{})})})},e.serial))]}):s.error?(0,Y.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:s.error.message}):null}):null})}var ht=[{id:`overview`,label:`capabilities.overview`,icon:te,element:lt,menu:!1},{id:`skills`,label:`space.skills`,icon:U,element:mt,feature:`skills`,menu:!1},{id:`connectors`,label:`capabilities.connectors`,icon:z,element:Je,menu:!1},{id:`protocol`,label:`capabilities.protocol`,icon:k,element:fe,admins:!0,menu:!1}];function gt(e,t=!0){return ht.filter(n=>n.element&&(!n.feature||e(n.feature))&&(t||!n.admins))}function _t(){let[e,t]=(0,J.useState)(null);return(0,J.useEffect)(()=>{let e=L(),n=()=>t(e.clientHeight);n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[]),e}function vt(){let e=I(`capabilities`),t=ee(),{section:n}=A(),[r]=v(),i=m(),a=b(),{space:o,loading:s}=G(),c=be(),[l,u]=(0,J.useState)(null),[d,p]=(0,J.useState)(null),[h,g]=(0,J.useState)(null),x=gt(e=>he(t,e),W()),S=x.find(e=>e.id===n),C=R(x.some(e=>e.id===`skills`)?o?.id:void 0),w=Me(o?.id??``),T={skills:C.data?.skills.length,connectors:w.data?.connections.length},E=x.map(e=>({id:e.id,label:q(e.label),icon:e.icon,to:e.menu===!1&&c?`/capabilities/${e.id}?show=page`:`/capabilities/${e.id}`,count:T[e.id]})),D=E.find(e=>e.id===S?.id),O=r.get(`show`)||r.has(`setup`)?2:1,k=S&&S.menu!==!1&&h!==S.id?1:0,j=Se(k),M=Se(O),N=(0,J.useMemo)(()=>({slot:l,narrow:c,setDetail:p}),[l,c]),P=_t();if(ae([{label:q(`nav.capabilities`),to:`/capabilities`},...D?[{label:D.label,to:D.to}]:[],...D&&d?[{label:d}]:[]]),!e)return(0,Y.jsx)(y,{to:`/`,replace:!0});if(n===`discover`){let e=new URLSearchParams(a.search);return e.set(`tab`,`discover`),(0,Y.jsx)(y,{to:{pathname:`/capabilities/overview`,search:`?${e}`},replace:!0})}if(!S&&x[0])return(0,Y.jsx)(y,{to:{pathname:`/capabilities/${x[0].id}`,search:a.search},replace:!0});let F=S?.element;return(0,Y.jsx)(ve.Provider,{value:N,children:(0,Y.jsx)(`div`,{className:`animate-rise`,children:(0,Y.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-[10.5rem_minmax(0,1fr)] md:gap-5 lg:grid-cols-[15rem_minmax(0,1fr)] lg:gap-10`,children:[(0,Y.jsxs)(`aside`,{className:_(`menu-scroll min-w-0 md:sticky md:top-6 md:self-start md:overflow-y-auto md:overscroll-contain`,c&&O===2&&`hidden`,c&&M===`back`&&Te(`back`)),style:!c&&P?{maxHeight:P-48,paddingBottom:`var(--assistant-dock, 0px)`}:void 0,children:[(0,Y.jsx)(xe,{title:q(`nav.capabilities`),open:k===1?D??null:null,onBack:x.length>1?()=>g(S?.id??null):void 0,root:{icon:ne,label:q(`nav.capabilities`),onOpen:()=>i(c?`/capabilities/overview?show=page`:`/capabilities/overview`),current:S?.id===`overview`}}),(0,Y.jsx)(`div`,{className:_(Te(j)),children:k===0?(0,Y.jsx)(_e,{entries:E.filter(e=>e.id!==`overview`),current:D,onPick:e=>{g(null),S?.menu===!1&&i(e.to)}}):(0,Y.jsx)(`div`,{ref:u})},k)]}),(0,Y.jsxs)(`div`,{className:_(`min-w-0`,c&&O<2&&`hidden`,c&&M===`deeper`&&Te(`deeper`)),children:[c&&D?(0,Y.jsx)(`div`,{className:`mb-3`,children:(0,Y.jsx)(we,{label:D.label,onBack:()=>i(D.to)})}):null,F?(0,Y.jsx)(F,{}):null,o||s?null:(0,Y.jsx)(f,{children:q(`settings.noSpace`)})]})]})})})}export{vt as CapabilitiesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{Qt as r,Xt as i,Yt as a,cn as o,rn as s}from"./ui-Uqnx1UpK.js";import{t as c}from"./preload-helper-DpV6A1kQ.js";import{s as l}from"./i18n-BJ7Ld6O6.js";var u=e(t(),1),d=e(n(),1);function f(e){switch(e.group){case`Added`:return{label:`NEW`,dot:`bg-moss`};case`Fixed`:return{label:`FIXED`,dot:`bg-amber`};case`Changed`:return{label:`CHANGED`,dot:`bg-cobalt`};case`Performance`:return{label:`PERFORMANCE`,dot:`bg-ember`};case`Deploy`:return{label:`DEPLOY`,dot:`bg-ink-4`};case`Docs`:return{label:`DOCS`,dot:`bg-ink-4`};default:return{label:`OTHER`,dot:`bg-ink-4`}}}var p=e=>e.version?e.version.replace(/^v/,``):l(`about.unreleased`),m=e=>e.timestamp?new Date(e.timestamp*1e3).toISOString().slice(0,10):``,h=e=>e.charAt(0).toUpperCase()+e.slice(1);function g(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=[];for(let t of e){if(`${p(t)} ${m(t)}`.toLowerCase().includes(n)){r.push(t);continue}let e=t.commits.filter(e=>`${f(e).label} ${e.scope??``} ${e.message}`.toLowerCase().includes(n));e.length>0&&r.push({...t,commits:e})}return r}async function _(e){if(e)try{let t=await fetch(`https://raw.githubusercontent.com/engenty/wizards/v${e}/apps/web/src/about/changelog.json`,{signal:AbortSignal.timeout(5e3)});if(t.ok)return await t.json()}catch{}return(await c(async()=>{let{default:e}=await import(`./changelog-BhMZS-rs.js`);return{default:e}},[])).default}function v({release:e}){return(0,d.jsx)(`ul`,{className:`flex flex-col gap-2`,children:e.commits.map(e=>{let t=f(e);return(0,d.jsxs)(`li`,{className:`flex items-start gap-2.5 text-[0.875rem]`,children:[(0,d.jsx)(`span`,{className:o(`mt-[7px] size-1.5 shrink-0 rounded-full`,t.dot)}),(0,d.jsxs)(`span`,{className:`min-w-0 text-ink-2`,children:[(0,d.jsxs)(`span`,{className:`font-semibold text-[0.75rem] text-ink tracking-wide`,children:[t.label,e.scope?` [${e.scope}]`:``]}),` `,h(e.message),e.breaking?(0,d.jsx)(`span`,{className:`ml-1.5 rounded-full bg-rose-tint px-1.5 py-0.5 font-medium text-[0.75rem] text-rose`,children:l(`about.breaking`)}):null]})]},e.id)})})}function y({open:e,onClose:t,version:n}){let[o,c]=(0,u.useState)(null),[f,h]=(0,u.useState)(``);(0,u.useEffect)(()=>{if(!e||o)return;let t=!1;return _(n).then(e=>{t||c(e)}),()=>{t=!0}},[e,o,n]),(0,u.useEffect)(()=>{e||h(``)},[e]);let y=o?g(o,f):[];return(0,d.jsxs)(a,{open:e,onClose:t,title:l(`about.changelog`),wide:!0,height:`tall`,children:[(0,d.jsx)(`p`,{className:`-mt-3 mb-4 text-[0.875rem] text-ink-3`,children:l(`about.changelogHint`)}),o===null?(0,d.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,d.jsx)(s,{})}):o.length===0?(0,d.jsx)(i,{children:l(`about.changelogEmpty`)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(r,{type:`search`,value:f,placeholder:l(`about.search`),onChange:e=>h(e.target.value)}),y.length===0?(0,d.jsx)(i,{children:l(`about.noMatches`)}):null,y.map(e=>(0,d.jsxs)(`section`,{className:`mt-6`,children:[(0,d.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[p(e),(0,d.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:m(e)})]}),(0,d.jsx)(`div`,{className:`mt-3`,children:(0,d.jsx)(v,{release:e})})]},e.version??`unreleased`))]})]})}export{y as ChangelogDialog,v as ReleaseNotes,_ as loadReleases,m as releaseDate,p as releaseLabel};
|