@engenty/wizards-runtime 0.14.2 → 0.16.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/studio-assistant.js +180 -4
- package/apps/runtime/dist/agents/website.js +10 -5
- package/apps/runtime/dist/app.js +27 -2
- package/apps/runtime/dist/auth/index.js +5 -0
- package/apps/runtime/dist/broker/account.js +5 -0
- package/apps/runtime/dist/broker/call.js +2 -0
- package/apps/runtime/dist/broker/host.js +1 -0
- package/apps/runtime/dist/broker/index.js +5 -0
- package/apps/runtime/dist/broker/rwx.js +293 -11
- package/apps/runtime/dist/cli/main.js +7 -0
- package/apps/runtime/dist/cli/move-files.js +68 -0
- package/apps/runtime/dist/cli/move-folder-sources.js +120 -0
- package/apps/runtime/dist/connectors/plugin-connections.js +74 -4
- package/apps/runtime/dist/db/migrations/tenant/0040_rwx_elements.sql +21 -0
- package/apps/runtime/dist/db/migrations/tenant/0041_broker_log_client.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/0042_client_spaces.sql +16 -0
- package/apps/runtime/dist/db/migrations/tenant/0043_space_member_invite.sql +19 -0
- package/apps/runtime/dist/db/migrations/tenant/0044_client_portal.sql +8 -0
- package/apps/runtime/dist/db/migrations/tenant/0045_client_portal_no_slug.sql +2 -0
- package/apps/runtime/dist/db/migrations/tenant/0046_space_file_hash.sql +2 -0
- package/apps/runtime/dist/db/migrations/tenant/0047_knowledge_folders.sql +3 -0
- package/apps/runtime/dist/db/migrations/tenant/0048_space_chunk_kind.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/0049_knowledge_sources.sql +57 -0
- package/apps/runtime/dist/db/migrations/tenant/0050_dateien.sql +71 -0
- package/apps/runtime/dist/db/migrations/tenant/0051_dateien_drafts.sql +23 -0
- package/apps/runtime/dist/db/migrations/tenant/0052_dateien_plugin_kinds.sql +5 -0
- package/apps/runtime/dist/db/migrations/tenant/0053_dateien_file_title.sql +3 -0
- package/apps/runtime/dist/db/migrations/tenant/0054_dateien_ocr.sql +14 -0
- package/apps/runtime/dist/db/migrations/tenant/0055_dateien_doc_reread.sql +3 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0040_snapshot.json +5153 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0041_snapshot.json +5160 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0042_snapshot.json +5286 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0043_snapshot.json +5293 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0044_snapshot.json +5344 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0045_snapshot.json +5329 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0046_snapshot.json +5343 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0047_snapshot.json +5391 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0048_snapshot.json +5398 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0049_snapshot.json +5793 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0050_snapshot.json +6288 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0051_snapshot.json +6461 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0052_snapshot.json +6497 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0053_snapshot.json +6504 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0054_snapshot.json +6504 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0055_snapshot.json +6504 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +112 -0
- package/apps/runtime/dist/db/schema.js +296 -5
- package/apps/runtime/dist/docs/dev/api.md +49 -2
- package/apps/runtime/dist/docs/dev/architecture.md +13 -2
- package/apps/runtime/dist/docs/dev/plugins/connections.md +30 -2
- package/apps/runtime/dist/docs/dev/plugins/index.md +1 -1
- package/apps/runtime/dist/docs/dev/plugins/reference.md +7 -4
- package/apps/runtime/dist/docs/dev/plugins/server.md +11 -5
- package/apps/runtime/dist/docs/dev/plugins/space.md +130 -4
- package/apps/runtime/dist/docs/dev/plugins/studio.md +13 -3
- package/apps/runtime/dist/docs/user-guide/command-line.md +2 -0
- package/apps/runtime/dist/docs/user-guide/plugins.md +1 -1
- package/apps/runtime/dist/docs/user-guide/space.md +6 -6
- package/apps/runtime/dist/docs/user-guide/steps.md +1 -1
- package/apps/runtime/dist/documents/ocr.js +72 -0
- package/apps/runtime/dist/documents/parse.js +81 -12
- package/apps/runtime/dist/elements/caller.js +47 -0
- package/apps/runtime/dist/elements/catalogue.js +14 -0
- package/apps/runtime/dist/elements/connections.js +60 -0
- package/apps/runtime/dist/elements/gate.js +81 -0
- package/apps/runtime/dist/elements/knowledge.js +308 -0
- package/apps/runtime/dist/elements/outside.js +103 -0
- package/apps/runtime/dist/elements/specs.js +102 -0
- package/apps/runtime/dist/elements/wizards.js +72 -0
- package/apps/runtime/dist/engenty/connections-google/connectors/drive.js +3 -0
- package/apps/runtime/dist/engenty/connections-microsoft/onedrive.js +3 -0
- package/apps/runtime/dist/engenty/connections-s3/s3.js +6 -0
- package/apps/runtime/dist/engine/runner.js +19 -2
- package/apps/runtime/dist/engine/steps.js +1 -1
- package/apps/runtime/dist/env.js +11 -2
- package/apps/runtime/dist/files/blobs.js +57 -1
- package/apps/runtime/dist/files/objects.js +1 -0
- package/apps/runtime/dist/files/pictures.js +41 -0
- package/apps/runtime/dist/files/storage.js +14 -26
- package/apps/runtime/dist/files/thumbs.js +77 -0
- package/apps/runtime/dist/files/upload-check.js +2 -2
- package/apps/runtime/dist/index.js +22 -0
- package/apps/runtime/dist/live/views.js +2 -1
- package/apps/runtime/dist/manage.js +4 -1
- package/apps/runtime/dist/mcp/elements.js +88 -0
- package/apps/runtime/dist/mcp/handler.js +2 -0
- package/apps/runtime/dist/mcp/scopes.js +5 -0
- package/apps/runtime/dist/mcp/tools.js +5 -0
- package/apps/runtime/dist/models.js +82 -13
- package/apps/runtime/dist/mounts/cache.js +71 -0
- package/apps/runtime/dist/mounts/drafts.js +367 -0
- package/apps/runtime/dist/mounts/folder.js +148 -0
- package/apps/runtime/dist/mounts/mounts.js +1315 -0
- package/apps/runtime/dist/mounts/source.js +179 -0
- package/apps/runtime/dist/mounts/units.js +97 -0
- package/apps/runtime/dist/move-files.js +4 -0
- package/apps/runtime/dist/plugins/loader.js +73 -1
- package/apps/runtime/dist/plugins/registry.js +2 -0
- package/apps/runtime/dist/prompts/authoring.md +2 -2
- package/apps/runtime/dist/prompts/goose.md +13 -1
- package/apps/runtime/dist/prompts/tools.md +8 -2
- package/apps/runtime/dist/render/convert.js +188 -1
- package/apps/runtime/dist/routes/api.js +7 -2
- package/apps/runtime/dist/routes/client-contract.js +164 -0
- package/apps/runtime/dist/routes/client-spaces.js +58 -0
- package/apps/runtime/dist/routes/dateien.js +173 -0
- package/apps/runtime/dist/routes/elements.js +76 -0
- package/apps/runtime/dist/routes/plugins.js +2 -1
- package/apps/runtime/dist/routes/runs.js +24 -10
- package/apps/runtime/dist/routes/studio.js +168 -8
- package/apps/runtime/dist/secrets/signing.js +16 -0
- package/apps/runtime/dist/services/client-portal.js +439 -0
- package/apps/runtime/dist/services/client-spaces.js +228 -0
- package/apps/runtime/dist/services/cloud.js +2 -0
- package/apps/runtime/dist/services/knowledge-model.js +24 -8
- package/apps/runtime/dist/services/knowledge.js +72 -42
- package/apps/runtime/dist/services/links.js +17 -0
- package/apps/runtime/dist/services/members-studio.js +5 -1
- package/apps/runtime/dist/services/page-pictures.js +162 -0
- package/apps/runtime/dist/services/runs.js +22 -6
- package/apps/runtime/dist/services/space-categories.js +41 -5
- package/apps/runtime/dist/services/space-data.js +165 -8
- package/apps/runtime/dist/services/space-files.js +102 -19
- package/apps/runtime/dist/services/space-index.js +384 -41
- package/apps/runtime/dist/services/space-origin.js +25 -1
- package/apps/runtime/dist/services/space-sources.js +937 -0
- package/apps/runtime/dist/services/spaces.js +60 -12
- package/apps/runtime/dist/services/synced-spaces.js +10 -1
- package/apps/runtime/dist/services/work-ai.js +53 -24
- package/apps/runtime/dist/services/work-chats.js +3 -2
- package/apps/runtime/dist/services/work-connections.js +2 -2
- package/apps/runtime/dist/sharing/index.js +2 -0
- package/apps/runtime/dist/store/index.js +29 -8
- package/apps/runtime/dist/store/shared-lists.js +30 -17
- package/apps/runtime/dist/sync/records.js +22 -27
- package/apps/runtime/dist/texts.js +4 -0
- package/apps/runtime/dist/tools/index.js +5 -4
- package/apps/runtime/dist/tools/pages.js +1 -1
- package/apps/runtime/dist/tools/skills.js +80 -54
- package/apps/runtime/dist/tools/space.js +8 -152
- package/apps/runtime/dist/widgets/step.js +2 -1
- package/apps/web/dist/assets/AboutDialog-0q4P80yv.js +1 -0
- package/apps/web/dist/assets/BlockEditor-CUYFH_CU.js +173 -0
- package/apps/web/dist/assets/BlockEditor-CtW6lw0y.css +1 -0
- package/apps/web/dist/assets/CapabilitiesPage-BlZP8DYb.js +2 -0
- package/apps/web/dist/assets/{ChangelogDialog-D_dQOMIq.js → ChangelogDialog-CDN7kMs1.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-nxoOt8ge.js → CodeEditor-D-Y16fdk.js} +1 -1
- package/apps/web/dist/assets/EditorPage-CrMVsgUt.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-aMfwcPul.js → FlowPreview-DXnk7m9P.js} +1 -1
- package/apps/web/dist/assets/{LangSwitch-DpD0inR4.js → LangSwitch-Dkd0FBIH.js} +1 -1
- package/apps/web/dist/assets/Marketplace-Cty40VwG.js +2 -0
- package/apps/web/dist/assets/NewWizardChannels-Czool7s1.js +1 -0
- package/apps/web/dist/assets/NewWizardPage-CfVe_4a2.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-D3SEpTmt.js +1 -0
- package/apps/web/dist/assets/PreviewPane-CQDKQO6z.js +7 -0
- package/apps/web/dist/assets/PublicRunner-BDZNnlQw.js +1 -0
- package/apps/web/dist/assets/ReadOnly-B7MUySpC.js +1 -0
- package/apps/web/dist/assets/SettingsPage-Bgurv3l2.js +2 -0
- package/apps/web/dist/assets/SetupPage-C3km8vqv.js +1 -0
- package/apps/web/dist/assets/{SharePage-N80EhoD7.js → SharePage-UwEJBIzq.js} +1 -1
- package/apps/web/dist/assets/SkillEditor-BaEiqqXl.js +1 -0
- package/apps/web/dist/assets/Skills-Bv6XbKxc.js +9 -0
- package/apps/web/dist/assets/SpacePage-D9PXLSU_.js +2 -0
- package/apps/web/dist/assets/UpdateCheck-C7I43zFZ.js +2 -0
- package/apps/web/dist/assets/changelog-DwgWiSZb.js +1 -0
- package/apps/web/dist/assets/circle-check-DDLzlcXP.js +1 -0
- package/apps/web/dist/assets/code-DsnwzN1x.js +1 -0
- package/apps/web/dist/assets/code-editor-Ca5EAxmd.js +2 -0
- package/apps/web/dist/assets/code-xml-S4IFi5Jc.js +1 -0
- package/apps/web/dist/assets/connection-sign-in-hI3HXhq4.js +1 -0
- package/apps/web/dist/assets/{dist-H1UN89OA.js → dist-B3Ray2U5.js} +1 -1
- package/apps/web/dist/assets/dist-CQpLJoQZ.js +10 -0
- package/apps/web/dist/assets/{dist-GlRRx9Xl.js → dist-D1uGQ_tB.js} +1 -1
- package/apps/web/dist/assets/{dist-BdDd1FxP.js → dist-DFI-tsfx.js} +1 -1
- package/apps/web/dist/assets/eye-TJSuiHHO.js +1 -0
- package/apps/web/dist/assets/floating-ui.dom-pwdNGv4b.js +1 -0
- package/apps/web/dist/assets/host-D5hNHbhF.js +125 -0
- package/apps/web/dist/assets/i18n-BBzMbGoo.js +55 -0
- package/apps/web/dist/assets/index-CyBrvupM.js +10 -0
- package/apps/web/dist/assets/index-w-3J3ZJ9.css +1 -0
- package/apps/web/dist/assets/{json-CEsfHdlZ.js → json-Ce3iHrtf.js} +1 -1
- package/apps/web/dist/assets/link-CPL8pB1P.js +1 -0
- package/apps/web/dist/assets/list-checks-DaxmUPqK.js +1 -0
- package/apps/web/dist/assets/{markdown-5-I9_izp.js → markdown-hqKQy2pp.js} +1 -1
- package/apps/web/dist/assets/marked.esm-DQ7XA7AC.js +67 -0
- package/apps/web/dist/assets/oss-credits-BrwV0a4F.js +1 -0
- package/apps/web/dist/assets/pdf-Dg-raaUo.js +54 -0
- package/apps/web/dist/assets/pdf.worker.min-68CMzziE.js +1 -0
- package/apps/web/dist/assets/pdf.worker.min-CjEcRF4W.mjs +28 -0
- package/apps/web/dist/assets/phone-B4uKDBFq.js +1 -0
- package/apps/web/dist/assets/read-aloud-Bfp9_bUY.js +1 -0
- package/apps/web/dist/assets/{runners-CyIvJIHr.js → runners-CUpBpSji.js} +1 -1
- package/apps/web/dist/assets/scroll-text-BEnPzQEi.js +1 -0
- package/apps/web/dist/assets/session-CMQo8P-G.js +2 -0
- package/apps/web/dist/assets/table-5B9G3oA6.js +1 -0
- package/apps/web/dist/assets/theme-CdX0marK.js +11 -0
- package/apps/web/dist/assets/ui-BCfu5sia.js +16 -0
- package/apps/web/dist/assets/upload-CAlHC232.js +1 -0
- package/apps/web/dist/assets/{useMutation-DEkZhp5c.js → useMutation-1fV4Nnxq.js} +1 -1
- package/apps/web/dist/assets/viewers-ChriFcRy.js +2 -0
- package/apps/web/dist/assets/volume-2-BqlBtCIJ.js +1 -0
- package/apps/web/dist/assets/w3c-keyname-BOAvb0qz.js +1 -0
- package/apps/web/dist/assets/xlsx-CuSbHU4R.js +141 -0
- package/apps/web/dist/index.html +19 -14
- package/apps/web/dist/mcp/flow.html +2 -2
- package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +223 -4
- package/node_modules/@engenty/wizards/dist/plugin/mount.d.ts +123 -0
- package/node_modules/@engenty/wizards/dist/plugin/mount.js +7 -0
- package/node_modules/@engenty/wizards/dist/plugin/studio.d.ts +110 -1
- package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +24 -0
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +24 -0
- package/node_modules/@engenty/wizards-shared/dist/knowledge.d.ts +33 -4
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +6 -0
- package/node_modules/@engenty/wizards-shared/dist/run.js +12 -0
- package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +21 -4
- package/node_modules/@engenty/wizards-shared/dist/rwx.js +30 -3
- package/node_modules/@engenty/wizards-shared/dist/spaces.d.ts +11 -1
- package/node_modules/@engenty/wizards-shared/dist/spaces.js +9 -2
- package/node_modules/@engenty/wizards-shared/dist/text-merge.d.ts +6 -0
- package/node_modules/@engenty/wizards-shared/dist/text-merge.js +25 -0
- package/package.json +3 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/README.md +3 -0
- package/plugin/plugin.json +1 -1
- package/plugin/skills/work-in-space/SKILL.md +16 -0
- package/apps/web/dist/assets/AboutDialog-Cag3RJuT.js +0 -1
- package/apps/web/dist/assets/CapabilitiesPage-BQYiN0gT.js +0 -2
- package/apps/web/dist/assets/EditorPage-C4_8LsQN.js +0 -3
- package/apps/web/dist/assets/Marketplace-CpzD9pNQ.js +0 -2
- package/apps/web/dist/assets/NewWizardChannels-CcE3UMVb.js +0 -1
- package/apps/web/dist/assets/NewWizardPage-BzN7zrQx.js +0 -7
- package/apps/web/dist/assets/OnboardingPage-ztHT01ah.js +0 -1
- package/apps/web/dist/assets/PreviewPane-BabMbBZI.js +0 -9
- package/apps/web/dist/assets/PublicRunner-D-JmtqCi.js +0 -1
- package/apps/web/dist/assets/ReadOnly-GAORKKqV.js +0 -1
- package/apps/web/dist/assets/SettingsPage-BKAiYmXl.js +0 -2
- package/apps/web/dist/assets/SetupPage-C1EZZHIp.js +0 -1
- package/apps/web/dist/assets/SkillEditor-CqQMg2MC.js +0 -1
- package/apps/web/dist/assets/Skills-CnhpgoOA.js +0 -9
- package/apps/web/dist/assets/SpacePage-CRR8JvV1.js +0 -2
- package/apps/web/dist/assets/UpdateCheck-CfXZBQNv.js +0 -2
- package/apps/web/dist/assets/changelog-6MqC8Vy8.js +0 -1
- package/apps/web/dist/assets/circle-alert-C8Ma-bPY.js +0 -1
- package/apps/web/dist/assets/circle-check-Bu9Z3mlJ.js +0 -1
- package/apps/web/dist/assets/code-editor-CfTGqOpp.js +0 -2
- package/apps/web/dist/assets/code-xml-B4kLFZSj.js +0 -1
- package/apps/web/dist/assets/connection-sign-in-B2D0O8W-.js +0 -1
- package/apps/web/dist/assets/dist-EBVTpvRr.js +0 -10
- package/apps/web/dist/assets/eye-BpoKpIdt.js +0 -1
- package/apps/web/dist/assets/host-BlKXX7YK.js +0 -118
- package/apps/web/dist/assets/i18n-BJ7Ld6O6.js +0 -55
- package/apps/web/dist/assets/index-66tE1oti.js +0 -10
- package/apps/web/dist/assets/index-D18DvnxX.css +0 -1
- package/apps/web/dist/assets/oss-credits-IdX5bc71.js +0 -1
- package/apps/web/dist/assets/phone-Ctvf-Am-.js +0 -1
- package/apps/web/dist/assets/read-aloud-Da_RSm2S.js +0 -1
- package/apps/web/dist/assets/scroll-text-ChrjRu9Y.js +0 -1
- package/apps/web/dist/assets/session-SXPtTWRK.js +0 -2
- package/apps/web/dist/assets/theme-Br1S0j5h.js +0 -11
- package/apps/web/dist/assets/ui-Uqnx1UpK.js +0 -82
- package/apps/web/dist/assets/upload-BchUnQGV.js +0 -1
- package/apps/web/dist/assets/volume-2-CU_oy81Z.js +0 -1
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { validateWizard } from "@engenty/wizards-shared/definition";
|
|
2
2
|
import { tableColumnsSchema } from "@engenty/wizards-shared/engenty/data-tables";
|
|
3
3
|
import { SKILL_MODES, SKILL_SOURCES, } from "@engenty/wizards-shared/skills";
|
|
4
|
+
import { SPACE_FILE_KINDS } from "@engenty/wizards-shared/spaces";
|
|
4
5
|
import { themeSchema } from "@engenty/wizards-shared/theme";
|
|
5
6
|
import { and, asc, eq, inArray, isNull, ne, sql } from "drizzle-orm";
|
|
6
7
|
import { nanoid } from "nanoid";
|
|
7
8
|
import { z } from "zod";
|
|
8
9
|
import { db, schema } from "../db/client.js";
|
|
9
|
-
import {
|
|
10
|
-
import { objects } from "../files/objects.js";
|
|
11
|
-
import { extFor } from "../files/storage.js";
|
|
10
|
+
import { blobThumb, hasBlob, releaseBlob } from "../files/blobs.js";
|
|
12
11
|
import { spaceChanged } from "../plugins/events.js";
|
|
13
12
|
import { asSync } from "../services/access.js";
|
|
14
13
|
import { emitDraftChanged } from "../services/draft-events.js";
|
|
@@ -452,6 +451,8 @@ const table = {
|
|
|
452
451
|
spaceId: t.spaceId,
|
|
453
452
|
title: t.title,
|
|
454
453
|
slug: t.slug,
|
|
454
|
+
parentId: t.parentId,
|
|
455
|
+
position: t.position,
|
|
455
456
|
format: t.format,
|
|
456
457
|
columns: t.columns,
|
|
457
458
|
origin: t.origin,
|
|
@@ -470,6 +471,8 @@ const table = {
|
|
|
470
471
|
spaceId,
|
|
471
472
|
title: str(r.title) ?? "",
|
|
472
473
|
slug: str(r.slug),
|
|
474
|
+
parentId: str(r.parentId),
|
|
475
|
+
position: num(r.position) ?? 0,
|
|
473
476
|
format: (r.format === "faq" ? "faq" : null),
|
|
474
477
|
columns: tableColumnsSchema.parse(r.columns ?? []),
|
|
475
478
|
origin: str(r.origin),
|
|
@@ -720,7 +723,6 @@ const category = {
|
|
|
720
723
|
},
|
|
721
724
|
title: (r, item) => str(r?.name) ?? item,
|
|
722
725
|
};
|
|
723
|
-
const assetKey = (path) => `assets/${path}`;
|
|
724
726
|
const file = {
|
|
725
727
|
async read(id) {
|
|
726
728
|
const f = await db.query.spaceFile.findFirst({ where: eq(schema.spaceFile.id, id) });
|
|
@@ -737,9 +739,7 @@ const file = {
|
|
|
737
739
|
if (f.status !== "ready") {
|
|
738
740
|
return "skip";
|
|
739
741
|
}
|
|
740
|
-
|
|
741
|
-
const bytes = asset ? await objects.get(assetKey(asset.path)) : null;
|
|
742
|
-
if (!bytes) {
|
|
742
|
+
if (!f.hash || !(await hasBlob(f.hash))) {
|
|
743
743
|
return "skip";
|
|
744
744
|
}
|
|
745
745
|
return {
|
|
@@ -753,13 +753,14 @@ const file = {
|
|
|
753
753
|
description: f.description,
|
|
754
754
|
source: f.source,
|
|
755
755
|
position: f.position,
|
|
756
|
+
parentId: f.parentId,
|
|
756
757
|
textHash: f.textHash,
|
|
757
758
|
pages: f.pages,
|
|
758
759
|
chars: f.chars,
|
|
759
760
|
origin: f.origin,
|
|
760
761
|
originKey: f.originKey,
|
|
761
762
|
originLabel: f.originLabel,
|
|
762
|
-
content:
|
|
763
|
+
content: f.hash,
|
|
763
764
|
categories: await categoriesOf("fileId", id),
|
|
764
765
|
},
|
|
765
766
|
};
|
|
@@ -768,31 +769,24 @@ const file = {
|
|
|
768
769
|
await clearOrigin(schema.spaceFile, spaceId, id, r);
|
|
769
770
|
const mime = str(r.mime) ?? "application/octet-stream";
|
|
770
771
|
const name = str(r.name) ?? "file";
|
|
771
|
-
const kind = (
|
|
772
|
-
|
|
773
|
-
const
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
mime,
|
|
779
|
-
name,
|
|
780
|
-
path,
|
|
781
|
-
size: bytes.byteLength,
|
|
782
|
-
};
|
|
783
|
-
await db
|
|
784
|
-
.insert(schema.asset)
|
|
785
|
-
.values({ id, tenantId: currentTenant(), ...assetValues })
|
|
786
|
-
.onConflictDoUpdate({ target: schema.asset.id, set: assetValues });
|
|
772
|
+
const kind = (SPACE_FILE_KINDS.includes(r.kind) ? r.kind : "asset");
|
|
773
|
+
// The bytes came ahead of the record, by their hash (client.ts, hub.ts).
|
|
774
|
+
const hash = String(r.content);
|
|
775
|
+
if (!(await hasBlob(hash))) {
|
|
776
|
+
throw new Error("blob missing");
|
|
777
|
+
}
|
|
778
|
+
const before = await db.query.spaceFile.findFirst({ where: eq(schema.spaceFile.id, id) });
|
|
787
779
|
const values = {
|
|
788
780
|
spaceId,
|
|
789
781
|
kind,
|
|
790
782
|
name,
|
|
791
783
|
mime,
|
|
792
|
-
size:
|
|
784
|
+
size: num(r.size) ?? 0,
|
|
785
|
+
hash,
|
|
793
786
|
description: str(r.description) ?? "",
|
|
794
787
|
source: str(r.source),
|
|
795
788
|
position: num(r.position) ?? 0,
|
|
789
|
+
parentId: str(r.parentId),
|
|
796
790
|
status: "ready",
|
|
797
791
|
error: null,
|
|
798
792
|
textHash: str(r.textHash),
|
|
@@ -811,8 +805,9 @@ const file = {
|
|
|
811
805
|
});
|
|
812
806
|
await writeCategories(spaceId, "fileId", id, r.categories);
|
|
813
807
|
return async () => {
|
|
814
|
-
if (before
|
|
815
|
-
await
|
|
808
|
+
if (before?.hash !== hash) {
|
|
809
|
+
await releaseBlob(before?.hash);
|
|
810
|
+
void blobThumb(hash, mime).catch(() => null);
|
|
816
811
|
}
|
|
817
812
|
if (kind === "logo") {
|
|
818
813
|
await putLink(id, "logo", id);
|
|
@@ -61,6 +61,7 @@ const EN = {
|
|
|
61
61
|
doingLookAtFile: "Looking at a file…",
|
|
62
62
|
doingReadSkill: "Reading the skill {name}…",
|
|
63
63
|
doingDescribeFile: "Describing a file…",
|
|
64
|
+
doingWriteKnowledgePage: "Writing a page into Knowledge…",
|
|
64
65
|
doingWebSearch: "Searching the web…",
|
|
65
66
|
doingReadSite: "Reading {host}…",
|
|
66
67
|
doingReadWebsite: "Reading the website…",
|
|
@@ -97,6 +98,7 @@ const EN = {
|
|
|
97
98
|
invalidInput: "Invalid input",
|
|
98
99
|
internalError: "Internal error",
|
|
99
100
|
notSignedIn: "You’re not signed in.",
|
|
101
|
+
clientsNotHere: "This is for the team. Your client space is open to you in the client view.",
|
|
100
102
|
accountSuspended: "This account is suspended.",
|
|
101
103
|
tooLarge: "That is too large.",
|
|
102
104
|
tooManyStreams: "Too many studio windows are open. Close one, or reload in a moment.",
|
|
@@ -289,6 +291,7 @@ const DE = {
|
|
|
289
291
|
doingLookAtFile: "Sieht sich eine Datei an …",
|
|
290
292
|
doingReadSkill: "Liest den Skill {name} …",
|
|
291
293
|
doingDescribeFile: "Beschreibt eine Datei …",
|
|
294
|
+
doingWriteKnowledgePage: "Schreibt eine Seite ins Wissen …",
|
|
292
295
|
doingWebSearch: "Sucht im Web …",
|
|
293
296
|
doingReadSite: "Liest {host} …",
|
|
294
297
|
doingReadWebsite: "Liest die Website …",
|
|
@@ -326,6 +329,7 @@ const DE = {
|
|
|
326
329
|
internalError: "Interner Fehler",
|
|
327
330
|
schemaMismatch: "Der Wizard passt nicht zum Schema.",
|
|
328
331
|
notSignedIn: "Du bist nicht angemeldet.",
|
|
332
|
+
clientsNotHere: "Das ist für das Team. Dein Space ist für dich in der Ansicht für Kund:innen offen.",
|
|
329
333
|
accountSuspended: "Dieses Konto ist gesperrt.",
|
|
330
334
|
tooLarge: "Das ist zu groß.",
|
|
331
335
|
tooManyStreams: "Zu viele Fenster des Studios sind offen. Schließ eines, oder lade gleich neu.",
|
|
@@ -4,6 +4,8 @@ import { createTool } from "@mastra/core/tools";
|
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { brokerHost, reachesOutside, whereOf, whoOf } from "../broker/index.js";
|
|
6
6
|
import { documentMime, parseDocument } from "../documents/parse.js";
|
|
7
|
+
import { stepCaller } from "../elements/caller.js";
|
|
8
|
+
import { elementTools } from "../elements/catalogue.js";
|
|
7
9
|
import { generateImageMedia } from "../media/generate.js";
|
|
8
10
|
import { markMedia } from "../media/marking.js";
|
|
9
11
|
import { gatewayTools, isHarnessVendor, searchAllowed } from "../models.js";
|
|
@@ -20,8 +22,7 @@ import { assertPublicUrl, safeFetch } from "./net-guard.js";
|
|
|
20
22
|
import { pageTools } from "./pages.js";
|
|
21
23
|
import { pluginTools, spaceContextOf } from "./plugin.js";
|
|
22
24
|
import { clip, FileKeeper } from "./shared.js";
|
|
23
|
-
import {
|
|
24
|
-
import { spaceTools } from "./space.js";
|
|
25
|
+
import { skillsOf } from "./skills.js";
|
|
25
26
|
import { storeTools } from "./store.js";
|
|
26
27
|
// A request to a host is a send to that host; the broker holds a guest's run to the hosts in its grant.
|
|
27
28
|
reachesOutside("http_request", { connection: "host", action: "http_request", kind: "send" });
|
|
@@ -172,10 +173,10 @@ export async function buildStepTools(step, ctx, resolved, uploads) {
|
|
|
172
173
|
if (!idle) {
|
|
173
174
|
Object.assign(tools, storeTools(ctx, uploads, files));
|
|
174
175
|
}
|
|
175
|
-
Object.assign(tools, await spaceTools(ctx));
|
|
176
176
|
// The run's sandbox: a guest's run has none unless SANDBOX_GUESTS says so (engine/resources.ts).
|
|
177
177
|
const sandbox = allowed.has("sandbox") ? ctx.resources.sandboxCapabilities() : null;
|
|
178
|
-
|
|
178
|
+
// The space's Knowledge and skills, from the tool catalogue (elements/), for the run's holder.
|
|
179
|
+
Object.assign(tools, await elementTools(stepCaller(ctx, sandbox ? { handle: () => ctx.resources.sandboxHandle(), workdir: sandbox.workdir } : null), { knowledge: true, skills: await skillsOf(ctx) }));
|
|
179
180
|
Object.assign(tools, mailTools(step, ctx, files));
|
|
180
181
|
Object.assign(tools, await connectorTools(step, ctx, files));
|
|
181
182
|
Object.assign(tools, await pluginTools(step, ctx));
|
|
@@ -12,7 +12,7 @@ import { pageReadInput, readKnowledgePage } from "./space.js";
|
|
|
12
12
|
* writes into a copy of its own in the run's state, which goes with the run.
|
|
13
13
|
*/
|
|
14
14
|
export function pageTools(ctx) {
|
|
15
|
-
const spaceId = ctx.
|
|
15
|
+
const spaceId = ctx.dataSpace.id;
|
|
16
16
|
const wizardId = ctx.store.wizardId;
|
|
17
17
|
/**
|
|
18
18
|
* The wizard's pages as this run sees them: those its holder may read, a test run's own
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { skillMd } from "@engenty/wizards-shared/skills";
|
|
2
2
|
import { createTool } from "@mastra/core/tools";
|
|
3
|
-
import {
|
|
3
|
+
import { readableIds } from "../broker/rwx.js";
|
|
4
|
+
import { stepCaller } from "../elements/caller.js";
|
|
5
|
+
import { elementCall, mayDo } from "../elements/gate.js";
|
|
6
|
+
import { ELEMENT_SPECS } from "../elements/specs.js";
|
|
4
7
|
import { getBlob } from "../files/blobs.js";
|
|
5
8
|
import { prompt } from "../prompts.js";
|
|
6
9
|
import { activeSkills } from "../services/skills.js";
|
|
@@ -90,11 +93,15 @@ export function skillsBlock(skills, { tools, sandbox = false }) {
|
|
|
90
93
|
}
|
|
91
94
|
const byName = (skills, name) => [...skills.always, ...skills.demand].find((k) => k.name === name.trim().toLowerCase());
|
|
92
95
|
/**
|
|
93
|
-
* `skill_load` and `skill_read` over the skills that count
|
|
94
|
-
*
|
|
95
|
-
* `
|
|
96
|
+
* `skill_load` and `skill_read` over the skills that count, for the caller of the tool catalogue
|
|
97
|
+
* (elements/): reading a skill is `r` on it, its folder placed in the caller's sandbox for its
|
|
98
|
+
* scripts to run is `x` (docs/plans/modular.md). Each call is a line of the broker's log. None
|
|
99
|
+
* when the space has no skill a model could read.
|
|
96
100
|
*/
|
|
97
|
-
export function skillToolsOf(skills,
|
|
101
|
+
export function skillToolsOf(skills, caller) {
|
|
102
|
+
const sandbox = caller.sandbox ?? null;
|
|
103
|
+
const onRead = (name) => caller.note?.({ code: "readsSkill", params: { name } });
|
|
104
|
+
const asSkill = (k) => ({ kind: "skill", id: k.id });
|
|
98
105
|
const readable = [...skills.always, ...skills.demand];
|
|
99
106
|
if (!(skills.demand.length || skills.always.some((k) => k.files.length || (sandbox && runnable(k))))) {
|
|
100
107
|
return {};
|
|
@@ -106,6 +113,9 @@ export function skillToolsOf(skills, onRead, sandbox = null) {
|
|
|
106
113
|
if (!(sandbox && runnable(k))) {
|
|
107
114
|
return null;
|
|
108
115
|
}
|
|
116
|
+
if (!(await mayDo(caller, asSkill(k), "x"))) {
|
|
117
|
+
return { scripts: prompt("tools", "note.skill_scripts_refused") };
|
|
118
|
+
}
|
|
109
119
|
const folder = `${sandbox.workdir}/${skillFolder(k.name)}`;
|
|
110
120
|
try {
|
|
111
121
|
await placeSkill(sandbox.handle(), k);
|
|
@@ -120,25 +130,40 @@ export function skillToolsOf(skills, onRead, sandbox = null) {
|
|
|
120
130
|
};
|
|
121
131
|
};
|
|
122
132
|
return {
|
|
133
|
+
skill_list: createTool({
|
|
134
|
+
id: "skill_list",
|
|
135
|
+
description: ELEMENT_SPECS.skill_list.description(),
|
|
136
|
+
inputSchema: ELEMENT_SPECS.skill_list.input,
|
|
137
|
+
execute: (input) => attempt(() => elementCall(caller, { action: "skill_list", about: "skills", perm: "r", input }, async () => {
|
|
138
|
+
const ok = new Set(await readableIds(caller.space.id, caller.subjects, "skill", readable.map((k) => k.id)));
|
|
139
|
+
return {
|
|
140
|
+
skills: readable
|
|
141
|
+
.filter((k) => ok.has(k.id))
|
|
142
|
+
.map((k) => ({ name: k.name, description: k.description })),
|
|
143
|
+
};
|
|
144
|
+
})),
|
|
145
|
+
}),
|
|
123
146
|
skill_load: createTool({
|
|
124
147
|
id: "skill_load",
|
|
125
148
|
description: prompt("tools", "tool.skill_load", { names }),
|
|
126
|
-
inputSchema:
|
|
127
|
-
execute: (
|
|
128
|
-
const k = byName(skills, name);
|
|
149
|
+
inputSchema: ELEMENT_SPECS.skill_load.input,
|
|
150
|
+
execute: (input) => attempt(async () => {
|
|
151
|
+
const k = byName(skills, input.name);
|
|
129
152
|
if (!k) {
|
|
130
|
-
return { error: prompt("tools", "note.skill_unknown", { name, names }) };
|
|
153
|
+
return { error: prompt("tools", "note.skill_unknown", { name: input.name, names }) };
|
|
131
154
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
155
|
+
return elementCall(caller, { action: "skill_load", resource: asSkill(k), perm: "r", input }, async () => {
|
|
156
|
+
await onRead(k.name);
|
|
157
|
+
const placed = await place(k);
|
|
158
|
+
// In the sandbox, the files for its scripts are there too.
|
|
159
|
+
const files = placed?.folder ? [...k.files, ...k.blobFiles] : k.files;
|
|
160
|
+
return {
|
|
161
|
+
name: k.name,
|
|
162
|
+
instructions: clip(k.body, 60_000),
|
|
163
|
+
files: files.map((f) => f.path).sort(),
|
|
164
|
+
...placed,
|
|
165
|
+
};
|
|
166
|
+
});
|
|
142
167
|
}),
|
|
143
168
|
}),
|
|
144
169
|
skill_read: createTool({
|
|
@@ -146,52 +171,53 @@ export function skillToolsOf(skills, onRead, sandbox = null) {
|
|
|
146
171
|
description: runs
|
|
147
172
|
? prompt("tools", "tool.skill_read")
|
|
148
173
|
: `${prompt("tools", "tool.skill_read")} ${prompt("tools", "tool.skill_read.text_only")}`,
|
|
149
|
-
inputSchema:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
from: z.number().int().min(0).optional().describe("Character to continue a long file at"),
|
|
153
|
-
}),
|
|
154
|
-
execute: ({ name, path, from }) => attempt(async () => {
|
|
174
|
+
inputSchema: ELEMENT_SPECS.skill_read.input,
|
|
175
|
+
execute: (input) => attempt(async () => {
|
|
176
|
+
const { name, path, from } = input;
|
|
155
177
|
const k = byName(skills, name);
|
|
156
178
|
if (!k) {
|
|
157
179
|
return { error: prompt("tools", "note.skill_unknown", { name, names }) };
|
|
158
180
|
}
|
|
159
|
-
|
|
160
|
-
return { path, text: clip(skillMd(k), 60_000) };
|
|
161
|
-
}
|
|
162
|
-
const wanted = path.replace(/^\.?\//, "");
|
|
163
|
-
const file = k.files.find((f) => f.path === wanted);
|
|
164
|
-
if (!file && k.blobFiles.some((f) => f.path === wanted)) {
|
|
165
|
-
return { error: prompt("tools", "note.skill_blob", { path: wanted }) };
|
|
166
|
-
}
|
|
167
|
-
if (!file) {
|
|
168
|
-
return {
|
|
169
|
-
error: prompt("tools", "note.skill_no_file", {
|
|
170
|
-
path,
|
|
171
|
-
skill: k.name,
|
|
172
|
-
files: k.files.map((f) => f.path).join(", ") || "none",
|
|
173
|
-
}),
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
await onRead(`${k.name}/${file.path}`);
|
|
177
|
-
const start = from ?? 0;
|
|
178
|
-
const part = file.text.slice(start, start + 30_000);
|
|
179
|
-
const rest = file.text.length - start - part.length;
|
|
180
|
-
return {
|
|
181
|
-
path: file.path,
|
|
182
|
-
text: part,
|
|
183
|
-
...(rest > 0
|
|
184
|
-
? { more: prompt("tools", "note.skill_more", { rest, from: start + part.length }) }
|
|
185
|
-
: {}),
|
|
186
|
-
};
|
|
181
|
+
return elementCall(caller, { action: "skill_read", resource: asSkill(k), perm: "r", input }, () => readSkillFile(k, path, from, onRead));
|
|
187
182
|
}),
|
|
188
183
|
}),
|
|
189
184
|
};
|
|
190
185
|
}
|
|
186
|
+
/** A file of a skill, in parts: `SKILL.md` whole, a text file from `from`. */
|
|
187
|
+
async function readSkillFile(k, path, from, onRead) {
|
|
188
|
+
if (path === "SKILL.md") {
|
|
189
|
+
return { path, text: clip(skillMd(k), 60_000) };
|
|
190
|
+
}
|
|
191
|
+
const wanted = path.replace(/^\.?\//, "");
|
|
192
|
+
const file = k.files.find((f) => f.path === wanted);
|
|
193
|
+
if (!file && k.blobFiles.some((f) => f.path === wanted)) {
|
|
194
|
+
return { error: prompt("tools", "note.skill_blob", { path: wanted }) };
|
|
195
|
+
}
|
|
196
|
+
if (!file) {
|
|
197
|
+
return {
|
|
198
|
+
error: prompt("tools", "note.skill_no_file", {
|
|
199
|
+
path,
|
|
200
|
+
skill: k.name,
|
|
201
|
+
files: k.files.map((f) => f.path).join(", ") || "none",
|
|
202
|
+
}),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
await onRead(`${k.name}/${file.path}`);
|
|
206
|
+
const start = from ?? 0;
|
|
207
|
+
const part = file.text.slice(start, start + 30_000);
|
|
208
|
+
const rest = file.text.length - start - part.length;
|
|
209
|
+
return {
|
|
210
|
+
path: file.path,
|
|
211
|
+
text: part,
|
|
212
|
+
...(rest > 0
|
|
213
|
+
? { more: prompt("tools", "note.skill_more", { rest, from: start + part.length }) }
|
|
214
|
+
: {}),
|
|
215
|
+
};
|
|
216
|
+
}
|
|
191
217
|
/**
|
|
192
218
|
* The skill tools of an AI step: what it reads goes into the run's events. `sandbox`: the
|
|
193
219
|
* step's sandbox, where the folders of skills whose scripts may run go.
|
|
194
220
|
*/
|
|
195
221
|
export async function skillTools(ctx, sandbox = null) {
|
|
196
|
-
return skillToolsOf(await skillsOf(ctx), (
|
|
222
|
+
return skillToolsOf(await skillsOf(ctx), stepCaller(ctx, sandbox));
|
|
197
223
|
}
|
|
@@ -1,158 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { and, eq } from "drizzle-orm";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import { assertRwx, subjectsOf } from "../broker/rwx.js";
|
|
6
|
-
import { db, schema } from "../db/client.js";
|
|
7
|
-
import { prompt } from "../prompts.js";
|
|
8
|
-
import { filePaths, knowledgeCounts, listForStep, readPage, readTable, resolvePath, } from "../services/knowledge.js";
|
|
9
|
-
import { documentText, hasIndexEntries, searchKnowledge } from "../services/space-index.js";
|
|
10
|
-
import { attempt, clip } from "./shared.js";
|
|
1
|
+
import { stepCaller } from "../elements/caller.js";
|
|
2
|
+
import { knowledgeTools, readKnowledgePage as readPageAs } from "../elements/knowledge.js";
|
|
11
3
|
/**
|
|
12
|
-
* Knowledge, for every agent step of the space's wizards:
|
|
13
|
-
*
|
|
14
|
-
* or a file whole by its path. Hits and reads look like files — a path, front matter, Markdown or
|
|
15
|
-
* CSV — so a model reads them as it reads files. The search also finds what the space's plugins
|
|
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.
|
|
4
|
+
* Knowledge, for every agent step of the space's wizards: the catalogue's Knowledge tools
|
|
5
|
+
* (elements/knowledge.ts) for the run's holder and its wizard.
|
|
18
6
|
*/
|
|
19
|
-
|
|
20
|
-
export const pageReadInput = {
|
|
21
|
-
path: z.string().describe("The page's path, as space_search or space_list give it: pages/…"),
|
|
22
|
-
section: z
|
|
23
|
-
.string()
|
|
24
|
-
.optional()
|
|
25
|
-
.describe("Only this section: a heading of the page, or the start of one"),
|
|
26
|
-
from: z.number().int().min(0).optional().describe("Character to continue a long page at"),
|
|
27
|
-
};
|
|
7
|
+
export { pageReadInput } from "../elements/specs.js";
|
|
28
8
|
/** A page of Knowledge by its path, for a step: its front matter and Markdown, in parts. */
|
|
29
9
|
export function readKnowledgePage(ctx, input) {
|
|
30
|
-
return
|
|
31
|
-
const read = await readPage(ctx.space.id, input.path, input, subjectsOf(ctx));
|
|
32
|
-
await ctx.emit("tool", { code: "reads", params: { name: read.path } });
|
|
33
|
-
return read;
|
|
34
|
-
});
|
|
10
|
+
return readPageAs(stepCaller(ctx), input);
|
|
35
11
|
}
|
|
36
|
-
export
|
|
37
|
-
|
|
38
|
-
const who = subjectsOf(ctx);
|
|
39
|
-
const counts = await knowledgeCounts(spaceId);
|
|
40
|
-
const entries = await hasIndexEntries(spaceId);
|
|
41
|
-
if (!(counts.pages || counts.tables || counts.files || entries)) {
|
|
42
|
-
return {};
|
|
43
|
-
}
|
|
44
|
-
const tools = {
|
|
45
|
-
space_search: createTool({
|
|
46
|
-
id: "space_search",
|
|
47
|
-
description: prompt("tools", "tool.space_search"),
|
|
48
|
-
inputSchema: z.object({
|
|
49
|
-
query: z.string().describe("What to look for: a question or keywords"),
|
|
50
|
-
where,
|
|
51
|
-
limit: z.number().int().min(1).max(12).optional().describe("Items to get, 6 by default"),
|
|
52
|
-
}),
|
|
53
|
-
execute: (input) => attempt(async () => {
|
|
54
|
-
const found = await searchKnowledge(spaceId, input.query, {
|
|
55
|
-
where: input.where,
|
|
56
|
-
limit: input.limit,
|
|
57
|
-
signal: ctx.signal,
|
|
58
|
-
who,
|
|
59
|
-
});
|
|
60
|
-
await ctx.emit("tool", {
|
|
61
|
-
code: "searchesKnowledge",
|
|
62
|
-
params: {
|
|
63
|
-
query: input.query.slice(0, 60),
|
|
64
|
-
relevant: found.hits.length,
|
|
65
|
-
candidates: found.candidates,
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
return {
|
|
69
|
-
hits: found.hits.map((h) => ({
|
|
70
|
-
...(h.path ? { path: h.path } : {}),
|
|
71
|
-
title: h.title,
|
|
72
|
-
...(h.categories.length ? { categories: h.categories } : {}),
|
|
73
|
-
...(h.heading ? { section: h.heading } : {}),
|
|
74
|
-
...(h.sheet ? { page: h.sheet } : {}),
|
|
75
|
-
...(h.relevance !== null ? { relevance: h.relevance } : {}),
|
|
76
|
-
text: clip(h.text, 1500),
|
|
77
|
-
})),
|
|
78
|
-
checked: found.checked,
|
|
79
|
-
candidates: found.candidates,
|
|
80
|
-
...(found.filtered !== null ? { filtered: found.filtered } : {}),
|
|
81
|
-
};
|
|
82
|
-
}),
|
|
83
|
-
}),
|
|
84
|
-
space_list: createTool({
|
|
85
|
-
id: "space_list",
|
|
86
|
-
description: prompt("tools", "tool.space_list"),
|
|
87
|
-
inputSchema: z.object({ where }),
|
|
88
|
-
execute: (input) => attempt(async () => {
|
|
89
|
-
const listed = await listForStep(spaceId, input.where, who);
|
|
90
|
-
await ctx.emit("tool", { code: "listsKnowledge" });
|
|
91
|
-
return listed;
|
|
92
|
-
}),
|
|
93
|
-
}),
|
|
94
|
-
};
|
|
95
|
-
if (counts.pages) {
|
|
96
|
-
tools.page_read = createTool({
|
|
97
|
-
id: "page_read",
|
|
98
|
-
description: prompt("tools", "tool.page_read.knowledge"),
|
|
99
|
-
inputSchema: z.object(pageReadInput),
|
|
100
|
-
execute: (input) => readKnowledgePage(ctx, input),
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
if (counts.tables) {
|
|
104
|
-
tools.table_read = createTool({
|
|
105
|
-
id: "table_read",
|
|
106
|
-
description: prompt("tools", "tool.table_read"),
|
|
107
|
-
inputSchema: z.object({
|
|
108
|
-
path: z.string().describe("The table's path: tables/…"),
|
|
109
|
-
where: whereSchema.optional().describe("Filter by columns, by their names"),
|
|
110
|
-
columns: z.array(z.string()).max(40).optional().describe("Only these columns"),
|
|
111
|
-
limit: z.number().int().min(1).max(1000).optional(),
|
|
112
|
-
offset: z.number().int().min(0).optional(),
|
|
113
|
-
}),
|
|
114
|
-
execute: (input) => attempt(async () => {
|
|
115
|
-
const read = await readTable(spaceId, input.path, input, who);
|
|
116
|
-
await ctx.emit("tool", { code: "reads", params: { name: read.path } });
|
|
117
|
-
return read;
|
|
118
|
-
}),
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
if (counts.files) {
|
|
122
|
-
tools.space_document = createTool({
|
|
123
|
-
id: "space_document",
|
|
124
|
-
description: prompt("tools", "tool.space_document"),
|
|
125
|
-
inputSchema: z.object({
|
|
126
|
-
path: z
|
|
127
|
-
.string()
|
|
128
|
-
.describe("The file's path: files/…, as the page's front matter or a hit names it"),
|
|
129
|
-
from: z.number().int().min(0).optional().describe("Character to start at"),
|
|
130
|
-
}),
|
|
131
|
-
execute: ({ path, from }) => attempt(async () => {
|
|
132
|
-
const found = await resolvePath(spaceId, path.startsWith("files/") ? path : `files/${path}`);
|
|
133
|
-
if (found?.kind !== "file") {
|
|
134
|
-
const there = [...(await filePaths(spaceId)).values()].slice(0, 40);
|
|
135
|
-
throw new Error(`No file "${path}". There are: ${there.join(", ")}`);
|
|
136
|
-
}
|
|
137
|
-
const file = await db.query.spaceFile.findFirst({
|
|
138
|
-
where: and(eq(schema.spaceFile.id, found.id), eq(schema.spaceFile.spaceId, spaceId)),
|
|
139
|
-
});
|
|
140
|
-
if (!file) {
|
|
141
|
-
throw new Error(`No file "${path}".`);
|
|
142
|
-
}
|
|
143
|
-
await assertRwx(spaceId, who, { kind: "document", id: file.id }, "r");
|
|
144
|
-
await ctx.emit("tool", { code: "reads", params: { name: file.name } });
|
|
145
|
-
const text = (await documentText(file)) || file.description;
|
|
146
|
-
const start = Math.min(from ?? 0, text.length);
|
|
147
|
-
const part = text.slice(start, start + 12_000);
|
|
148
|
-
return {
|
|
149
|
-
path: found.path,
|
|
150
|
-
text: clip(part, 12_000),
|
|
151
|
-
next: start + part.length < text.length ? start + part.length : null,
|
|
152
|
-
length: text.length,
|
|
153
|
-
};
|
|
154
|
-
}),
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
return tools;
|
|
12
|
+
export function spaceTools(ctx) {
|
|
13
|
+
return knowledgeTools(stepCaller(ctx));
|
|
158
14
|
}
|
|
@@ -8,11 +8,12 @@ import { snapshotDataImages } from "../files/web-images.js";
|
|
|
8
8
|
import { markMedia } from "../media/marking.js";
|
|
9
9
|
import { mainLogoId } from "../services/brand.js";
|
|
10
10
|
import { snapshotFile } from "../services/files.js";
|
|
11
|
+
import { spaceFileContent } from "../services/space-files.js";
|
|
11
12
|
import { bundleWidget } from "./bundle.js";
|
|
12
13
|
import { MOTION_MEDIA_ORIGIN, probeWidget, renderMotion } from "./render.js";
|
|
13
14
|
export async function widgetBrand(space) {
|
|
14
15
|
const logoId = await mainLogoId(space.id);
|
|
15
|
-
const logo = logoId ? await
|
|
16
|
+
const logo = logoId ? await spaceFileContent(space.id, logoId).catch(() => null) : null;
|
|
16
17
|
const colors = space.brand.colors ?? [];
|
|
17
18
|
return {
|
|
18
19
|
name: space.brand.name ?? "",
|
|
@@ -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{Jn as r,fn as i,in as a,ln as o,mn as s,nn as c,rn as l,tn as u}from"./ui-BCfu5sia.js";import{t as d}from"./preload-helper-DpV6A1kQ.js";import{c as f,n as p}from"./marked.esm-DQ7XA7AC.js";import{t as m}from"./logo-BpnjXTRy.js";import{s as h}from"./i18n-BBzMbGoo.js";import{g,h as _,m as v,t as y,u as b}from"./UpdateCheck-C7I43zFZ.js";import{ReleaseNotes as x,loadReleases as S,releaseDate as C,releaseLabel as w}from"./ChangelogDialog-CDN7kMs1.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:r,description:i}){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)(f,{"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:r})]}),i?(0,O.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:i}):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,i]=(0,T.useState)(``);(0,T.useEffect)(()=>{if(!e||t)return;let r=!1;return d(()=>import(`./oss-credits-BrwV0a4F.js`).then(e=>{r||n(e.default)}),[]),()=>{r=!0}},[e,t]),(0,T.useEffect)(()=>{e||i(``)},[e]);let s=r.trim().toLowerCase(),l=e=>s?e.filter(e=>k(s,e.name,e.license,h(e.description))):e,u=e=>s?e.filter(e=>k(s,e.name,e.license,e.version)):e,f=l(E),p=l(D),m=t?[{id:`shared`,label:h(`about.creditsShared`),packages:u(t.shared)},...t.groups.map(e=>({id:e.id,label:e.label,packages:u(e.packages)}))].filter(e=>e.packages.length>0):[],g=f.length===0&&p.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)(a,{type:`search`,value:r,placeholder:h(`about.search`),onChange:e=>i(e.target.value)}),f.length>0?(0,O.jsx)(j,{title:h(`about.creditsProduct`),children:(0,O.jsx)(M,{credits:f})}):null,p.length>0?(0,O.jsx)(j,{title:h(`about.creditsBuiltWith`),children:(0,O.jsx)(M,{credits:p})}):null,t===null?(0,O.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,O.jsx)(o,{})}):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)(c,{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 a=e?.mode===`local`,{data:c,latest:l}=_(a&&t),[u,d]=(0,T.useState)(null),[f,p]=(0,T.useState)(n);(0,T.useEffect)(()=>p(n),[n]);let E=v(F.indexOf(f)),D=c?.newer&&l?l:g;(0,T.useEffect)(()=>{if(!t)return;let e=!1;return d(null),S(D===`0.16.0`?void 0:D).then(t=>{e||d(t)}),()=>{e=!0}},[t,D]);let k=u?.find(e=>e.version===`v${D}`)??u?.[0]??null,A=u?.filter(e=>e!==k)??[],j=a?c?.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}`)}`:``]})]}),a?(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)(i,{value:f,onChange:p,options:F.map(e=>({id:e,label:I(e)})),label:h(`about.title`)})}),(0,O.jsxs)(`div`,{className:s(`mt-5`,b(E)),children:[f===`new`?u===null?(0,O.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,O.jsx)(o,{})}):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,f===`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)(r,{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,f===`credits`?(0,O.jsx)(P,{active:!0}):null]},f)]})}function z({open:e,onClose:t,me:n}){return(0,O.jsxs)(u,{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)(l,{label:h(`common.close`),onClick:t,children:(0,O.jsx)(p,{className:`size-4`})})}),(0,O.jsx)(R,{me:n,active:e})]})}export{z as AboutDialog,R as AboutPanel};
|