@engenty/wizards-runtime 0.15.0 → 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 +138 -9
- package/apps/runtime/dist/agents/website.js +10 -5
- package/apps/runtime/dist/app.js +18 -0
- package/apps/runtime/dist/auth/index.js +5 -0
- package/apps/runtime/dist/broker/account.js +5 -0
- package/apps/runtime/dist/broker/index.js +5 -0
- package/apps/runtime/dist/broker/rwx.js +255 -7
- 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/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/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 +98 -0
- package/apps/runtime/dist/db/schema.js +294 -5
- package/apps/runtime/dist/docs/dev/api.md +25 -0
- 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 +5 -3
- package/apps/runtime/dist/elements/gate.js +1 -1
- package/apps/runtime/dist/elements/knowledge.js +181 -12
- package/apps/runtime/dist/elements/specs.js +1 -1
- package/apps/runtime/dist/elements/wizards.js +15 -2
- 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 +6 -0
- 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/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/goose.md +13 -1
- package/apps/runtime/dist/prompts/tools.md +5 -2
- package/apps/runtime/dist/render/convert.js +188 -1
- package/apps/runtime/dist/routes/api.js +6 -1
- 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 +2 -2
- 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 +29 -8
- package/apps/runtime/dist/services/work-chats.js +3 -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/pages.js +1 -1
- 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-Do7pwmFv.js → ChangelogDialog-CDN7kMs1.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-Cdox-51M.js → CodeEditor-D-Y16fdk.js} +1 -1
- package/apps/web/dist/assets/EditorPage-CrMVsgUt.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-BPS86xzA.js → FlowPreview-DXnk7m9P.js} +1 -1
- package/apps/web/dist/assets/{LangSwitch-BRHbi_Sd.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-PKHX8a8a.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-BoPaPsjN.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-7_FOHoEl.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 +3 -0
- package/node_modules/@engenty/wizards-shared/dist/run.js +6 -0
- package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +21 -4
- package/node_modules/@engenty/wizards-shared/dist/rwx.js +27 -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/plugin.json +1 -1
- package/apps/web/dist/assets/AboutDialog-DaWEIHFN.js +0 -1
- package/apps/web/dist/assets/CapabilitiesPage-Dt91U_sK.js +0 -2
- package/apps/web/dist/assets/EditorPage-DS_a5K3s.js +0 -3
- package/apps/web/dist/assets/Marketplace-CS7JTgiv.js +0 -2
- package/apps/web/dist/assets/NewWizardChannels-D-OLsex6.js +0 -1
- package/apps/web/dist/assets/NewWizardPage-BM_pkk41.js +0 -7
- package/apps/web/dist/assets/OnboardingPage-Cpn5pubC.js +0 -1
- package/apps/web/dist/assets/PreviewPane-BOk1-yO4.js +0 -9
- package/apps/web/dist/assets/PublicRunner-CgzMZb0r.js +0 -1
- package/apps/web/dist/assets/ReadOnly-8DEx-ly3.js +0 -1
- package/apps/web/dist/assets/SettingsPage-CcrknFcI.js +0 -2
- package/apps/web/dist/assets/SetupPage-D5nzjgPU.js +0 -1
- package/apps/web/dist/assets/SkillEditor-BsXTqNli.js +0 -1
- package/apps/web/dist/assets/Skills-C_X1ZsKg.js +0 -9
- package/apps/web/dist/assets/SpacePage-wZGqUoSQ.js +0 -2
- package/apps/web/dist/assets/UpdateCheck-D6x7MqEl.js +0 -2
- package/apps/web/dist/assets/changelog-M-eOBqgu.js +0 -1
- package/apps/web/dist/assets/circle-alert-DJbCyxcg.js +0 -1
- package/apps/web/dist/assets/circle-check-jqtsKi_b.js +0 -1
- package/apps/web/dist/assets/code-editor-BpCEnf8H.js +0 -2
- package/apps/web/dist/assets/code-xml-q88cSTV8.js +0 -1
- package/apps/web/dist/assets/connection-sign-in-UJ6xk-TD.js +0 -1
- package/apps/web/dist/assets/dist-EBVTpvRr.js +0 -10
- package/apps/web/dist/assets/eye-CgkvVlba.js +0 -1
- package/apps/web/dist/assets/host-Bd_bon_c.js +0 -118
- package/apps/web/dist/assets/i18n-0fUKyVRE.js +0 -55
- package/apps/web/dist/assets/index-D18DvnxX.css +0 -1
- package/apps/web/dist/assets/index-DOgwxnto.js +0 -10
- package/apps/web/dist/assets/oss-credits-IdX5bc71.js +0 -1
- package/apps/web/dist/assets/phone-CjPvZ0nk.js +0 -1
- package/apps/web/dist/assets/read-aloud-CLXo_asN.js +0 -1
- package/apps/web/dist/assets/scroll-text-2BhJO_W7.js +0 -1
- package/apps/web/dist/assets/session-CpYa5hwd.js +0 -2
- package/apps/web/dist/assets/theme-Bj3wNQR0.js +0 -11
- package/apps/web/dist/assets/ui-CktezodE.js +0 -82
- package/apps/web/dist/assets/upload-CHGCFVZK.js +0 -1
- package/apps/web/dist/assets/volume-2-Bw5KASy8.js +0 -1
|
@@ -6,6 +6,7 @@ import { CATEGORY_TYPES, whereSchema } from "@engenty/wizards-shared/knowledge";
|
|
|
6
6
|
import { PRESENCE_KINDS } from "@engenty/wizards-shared/live";
|
|
7
7
|
import { CLASS_NAMES, isCreditsRef, modelLabel } from "@engenty/wizards-shared/providers";
|
|
8
8
|
import { note } from "@engenty/wizards-shared/run";
|
|
9
|
+
import { AUDIENCES } from "@engenty/wizards-shared/rwx";
|
|
9
10
|
import { SPACE_FILE_KINDS } from "@engenty/wizards-shared/spaces";
|
|
10
11
|
import { MAX_MASK_LABEL_CHARS, MAX_MASK_LABELS, modelPolicySchema, } from "@engenty/wizards-shared/tiers";
|
|
11
12
|
import { PACKAGE_EXTENSION, PACKAGE_MAX_BYTES, PACKAGE_MIME, } from "@engenty/wizards-shared/wizard-package";
|
|
@@ -21,7 +22,7 @@ import { answerBrowser, awaitBrowser } from "../assistant/browser.js";
|
|
|
21
22
|
import { endRun, signalRun, startRun, takeSignals } from "../assistant/runs.js";
|
|
22
23
|
import { accountOverview, linkedAccount, startLink, unlink } from "../auth/account.js";
|
|
23
24
|
import { createLocalKey, deleteLocalKey, listLocalKeys } from "../auth/keys.js";
|
|
24
|
-
import { assertRwx, subjectsOfPerson } from "../broker/rwx.js";
|
|
25
|
+
import { assertRwx, folderAudience, setFolderAudience, subjectsOfPerson } from "../broker/rwx.js";
|
|
25
26
|
import { appStates, connectApps } from "../cli/connect.js";
|
|
26
27
|
import { layout } from "../cli/home.js";
|
|
27
28
|
import { connectorImportSchema, importConnector, previewSource, refreshConnector, registryService, removeConnector, searchRegistry, } from "../connectors/external.js";
|
|
@@ -65,9 +66,10 @@ import { profileSchema, saveProfile, saveUserLang, userLang, userProfile, } from
|
|
|
65
66
|
import { runnersOf, wizardRunners } from "../services/runners.js";
|
|
66
67
|
import { draftStepView, listResults, listRuns, startTestRun } from "../services/runs.js";
|
|
67
68
|
import { addCategoryValue, categoryRow, categoryValue, deleteCategory, deleteCategoryValue, mergeCategoryValues, orderCategoryValues, putCategory, renameCategoryValue, setItemCategory, updateCategory, } from "../services/space-categories.js";
|
|
68
|
-
import { addTableRow, createPage, createTable, deletePage, deleteTable, deleteTableRows, getPage, getTable, listSpaceData, orderSubPages, updatePage, updateTable, updateTableRow, } from "../services/space-data.js";
|
|
69
|
-
import { addSpaceFile, addSpaceFileFromUrl, fileView, orderSpaceFiles, reindexSpaceFile, removeSpaceFile, spaceFile, spaceFileContent, updateSpaceFile, } from "../services/space-files.js";
|
|
69
|
+
import { addTableRow, createPage, createTable, deletePage, deleteTable, deleteTableRows, getPage, getTable, listSpaceData, moveKnowledgeItem, orderSubPages, updatePage, updateTable, updateTableRow, } from "../services/space-data.js";
|
|
70
|
+
import { addSpaceFile, addSpaceFileFromUrl, fileView, orderSpaceFiles, pictureToBrand, reindexSpaceFile, removeSpaceFile, spaceFile, spaceFileContent, spaceFileThumb, updateSpaceFile, } from "../services/space-files.js";
|
|
70
71
|
import { documentText, queueIndex, reindexAll, searchKnowledge } from "../services/space-index.js";
|
|
72
|
+
import { addSourceEntries, getSource, keepItem, listSources, proposeSource, removeSource, setEntryIncluded, startSource, stopSource, takeSource, updateSourceSettings, } from "../services/space-sources.js";
|
|
71
73
|
import { createSpace, deleteSpace, gradientSchema, ownedSpace, spaceLimitOrNull, spacePatchSchema, updateSpace, } from "../services/spaces.js";
|
|
72
74
|
import { deleteTheme, listThemes, saveTheme } from "../services/themes.js";
|
|
73
75
|
import { deleteTranslation, editTranslation, isLangCode, publishedDefinition, } from "../services/translations.js";
|
|
@@ -322,6 +324,10 @@ export const studio = new Hono()
|
|
|
322
324
|
credits: managed ? await balanceCredits() : null,
|
|
323
325
|
/** Where the account, members, API keys and credits are managed. */
|
|
324
326
|
manageUrl: managed ? env.manage.url : null,
|
|
327
|
+
/** A client's place is the client portal, never the studio; null for everyone else. */
|
|
328
|
+
portalUrl: user.role === "client" && info?.pagesHost
|
|
329
|
+
? env.clientPortalUrl.replace("{host}", info.pagesHost)
|
|
330
|
+
: null,
|
|
325
331
|
account: linked
|
|
326
332
|
? {
|
|
327
333
|
name: linked.name,
|
|
@@ -674,6 +680,11 @@ export const studio = new Hono()
|
|
|
674
680
|
mime: file.type.split(";")[0].trim().toLowerCase(),
|
|
675
681
|
data: new Uint8Array(await file.arrayBuffer()),
|
|
676
682
|
});
|
|
683
|
+
// A document uploaded into a folder of Knowledge.
|
|
684
|
+
const parent = c.req.query("parent");
|
|
685
|
+
if (kind === "document" && parent) {
|
|
686
|
+
await moveKnowledgeItem(c.get("user").id, space.id, { key: `f:${row.id}`, parentId: parent });
|
|
687
|
+
}
|
|
677
688
|
return c.json(fileView(row));
|
|
678
689
|
})
|
|
679
690
|
.post("/spaces/:id/files/url", async (c) => {
|
|
@@ -765,6 +776,17 @@ export const studio = new Hono()
|
|
|
765
776
|
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
766
777
|
const { row, data } = await spaceFileContent(space.id, c.req.param("fileId"), whoOf(c));
|
|
767
778
|
return spaceFileResponse(c, row.mime, data);
|
|
779
|
+
})
|
|
780
|
+
// A page's picture into the brand's assets: the same bytes.
|
|
781
|
+
.post("/spaces/:id/files/:fileId/brand", async (c) => {
|
|
782
|
+
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
783
|
+
return c.json(fileView(await pictureToBrand(space.id, c.req.param("fileId"))));
|
|
784
|
+
})
|
|
785
|
+
// Its 320 px JPEG for lists and search: pictures and PDFs.
|
|
786
|
+
.get("/spaces/:id/files/:fileId/thumb", async (c) => {
|
|
787
|
+
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
788
|
+
const thumb = await spaceFileThumb(space.id, c.req.param("fileId"), whoOf(c));
|
|
789
|
+
return thumb ? spaceFileResponse(c, "image/jpeg", thumb) : c.notFound();
|
|
768
790
|
})
|
|
769
791
|
// A document as the models read it: its text as Markdown, or the start of it.
|
|
770
792
|
.get("/spaces/:id/files/:fileId/text", async (c) => {
|
|
@@ -781,13 +803,25 @@ export const studio = new Hono()
|
|
|
781
803
|
const text = await documentText(row);
|
|
782
804
|
return c.json({ text: text.slice(0, limit), chars: text.length });
|
|
783
805
|
})
|
|
784
|
-
// What a search of Knowledge finds for a question: the items an agent step would get.
|
|
806
|
+
// What a search of Knowledge finds for a question: the items an agent step would get. The
|
|
807
|
+
// palette asks twice: at once without the classifier (`check: false`), then with it.
|
|
785
808
|
.post("/spaces/:id/search", async (c) => {
|
|
786
809
|
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
787
810
|
const body = z
|
|
788
|
-
.object({
|
|
811
|
+
.object({
|
|
812
|
+
query: z.string().min(1).max(400),
|
|
813
|
+
where: whereSchema.optional(),
|
|
814
|
+
limit: z.number().int().min(1).max(12).optional(),
|
|
815
|
+
check: z.boolean().optional(),
|
|
816
|
+
})
|
|
789
817
|
.parse(await c.req.json());
|
|
790
|
-
return c.json(await searchKnowledge(space.id, body.query, {
|
|
818
|
+
return c.json(await searchKnowledge(space.id, body.query, {
|
|
819
|
+
where: body.where,
|
|
820
|
+
limit: body.limit,
|
|
821
|
+
check: body.check,
|
|
822
|
+
signal: c.req.raw.signal,
|
|
823
|
+
who: whoOf(c),
|
|
824
|
+
}));
|
|
791
825
|
})
|
|
792
826
|
.delete("/spaces/:id", async (c) => {
|
|
793
827
|
await deleteSpace(c.get("user").id, c.req.param("id"));
|
|
@@ -844,6 +878,128 @@ export const studio = new Hono()
|
|
|
844
878
|
})
|
|
845
879
|
// --- Knowledge: its items and categories ------------------------------------
|
|
846
880
|
.get("/spaces/:id/knowledge", async (c) => c.json(await listKnowledge(c.get("user").id, c.req.param("id"), whoOf(c))))
|
|
881
|
+
// Who besides the admins sees a folder and what lies in it: the team, clients, guests.
|
|
882
|
+
.get("/spaces/:id/knowledge/folders/:folderId/audience", async (c) => c.json({
|
|
883
|
+
see: await folderAudience(c.get("user").id, c.req.param("id"), c.req.param("folderId")),
|
|
884
|
+
}))
|
|
885
|
+
.put("/spaces/:id/knowledge/folders/:folderId/audience", async (c) => {
|
|
886
|
+
const body = z
|
|
887
|
+
.object({ see: z.array(z.enum(AUDIENCES)).max(AUDIENCES.length) })
|
|
888
|
+
.parse(await c.req.json());
|
|
889
|
+
await setFolderAudience(c.get("user").id, c.req.param("id"), c.req.param("folderId"), body.see);
|
|
890
|
+
return c.json({ see: body.see });
|
|
891
|
+
})
|
|
892
|
+
// An item moved into a folder (a page, or the top), at a place among its contents.
|
|
893
|
+
.post("/spaces/:id/knowledge/move", async (c) => {
|
|
894
|
+
const body = z
|
|
895
|
+
.object({
|
|
896
|
+
key: z.string().regex(/^[ptf]:[\w-]{1,40}$/),
|
|
897
|
+
parentId: z.string().max(40).nullable(),
|
|
898
|
+
index: z.number().int().min(0).max(100_000).optional(),
|
|
899
|
+
})
|
|
900
|
+
.parse(await c.req.json());
|
|
901
|
+
await moveKnowledgeItem(c.get("user").id, c.req.param("id"), body);
|
|
902
|
+
return c.json({ ok: true });
|
|
903
|
+
})
|
|
904
|
+
// „Als eigene Seite übernehmen“: what a source wrote becomes the space's own.
|
|
905
|
+
.post("/spaces/:id/knowledge/keep", async (c) => {
|
|
906
|
+
await requireAdmin();
|
|
907
|
+
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
908
|
+
const body = z
|
|
909
|
+
.object({ key: z.string().regex(/^[pt]:[\w-]{1,40}$/) })
|
|
910
|
+
.parse(await c.req.json());
|
|
911
|
+
await keepItem(space.id, body.key);
|
|
912
|
+
return c.json({ ok: true });
|
|
913
|
+
})
|
|
914
|
+
// --- sources of Knowledge: each fills a folder of its own ----------------------
|
|
915
|
+
.get("/spaces/:id/sources", async (c) => {
|
|
916
|
+
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
917
|
+
return c.json(await listSources(space.id));
|
|
918
|
+
})
|
|
919
|
+
.post("/spaces/:id/sources", async (c) => {
|
|
920
|
+
await requireAdmin();
|
|
921
|
+
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
922
|
+
const body = z
|
|
923
|
+
.object({
|
|
924
|
+
address: z.string().trim().min(1).max(1000),
|
|
925
|
+
kind: z.string().max(24).nullish(),
|
|
926
|
+
label: z.string().trim().max(120).nullish(),
|
|
927
|
+
})
|
|
928
|
+
.parse(await c.req.json());
|
|
929
|
+
return c.json(await proposeSource(space.id, body, { signal: c.req.raw.signal }));
|
|
930
|
+
})
|
|
931
|
+
.get("/spaces/:id/sources/:sourceId", async (c) => {
|
|
932
|
+
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
933
|
+
return c.json(await getSource(space.id, c.req.param("sourceId")));
|
|
934
|
+
})
|
|
935
|
+
.post("/spaces/:id/sources/:sourceId/take", async (c) => {
|
|
936
|
+
await requireAdmin();
|
|
937
|
+
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
938
|
+
const body = z
|
|
939
|
+
.object({ parentId: z.string().max(40).nullish() })
|
|
940
|
+
.parse(await c.req.json().catch(() => ({})));
|
|
941
|
+
return c.json(await takeSource(space.id, c.req.param("sourceId"), body));
|
|
942
|
+
})
|
|
943
|
+
.patch("/spaces/:id/sources/:sourceId", async (c) => {
|
|
944
|
+
await requireAdmin();
|
|
945
|
+
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
946
|
+
const patch = z
|
|
947
|
+
.object({
|
|
948
|
+
label: z.string().trim().min(1).max(120).optional(),
|
|
949
|
+
everyHours: z
|
|
950
|
+
.number()
|
|
951
|
+
.int()
|
|
952
|
+
.min(1)
|
|
953
|
+
.max(24 * 30)
|
|
954
|
+
.nullable()
|
|
955
|
+
.optional(),
|
|
956
|
+
rules: z
|
|
957
|
+
.array(z.object({ pattern: z.string().trim().min(1).max(200), reason: z.string().max(120) }))
|
|
958
|
+
.max(100)
|
|
959
|
+
.optional(),
|
|
960
|
+
})
|
|
961
|
+
.parse(await c.req.json());
|
|
962
|
+
return c.json(await updateSourceSettings(space.id, c.req.param("sourceId"), patch));
|
|
963
|
+
})
|
|
964
|
+
.post("/spaces/:id/sources/:sourceId/run", async (c) => {
|
|
965
|
+
await requireAdmin();
|
|
966
|
+
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
967
|
+
const { source } = await getSource(space.id, c.req.param("sourceId"));
|
|
968
|
+
if (source.state !== "taken") {
|
|
969
|
+
throw new ServiceError("invalid", "The source is not taken yet.");
|
|
970
|
+
}
|
|
971
|
+
startSource(source.id);
|
|
972
|
+
return c.json({ ok: true });
|
|
973
|
+
})
|
|
974
|
+
.post("/spaces/:id/sources/:sourceId/stop", async (c) => {
|
|
975
|
+
await requireAdmin();
|
|
976
|
+
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
977
|
+
const { source } = await getSource(space.id, c.req.param("sourceId"));
|
|
978
|
+
stopSource(source.id);
|
|
979
|
+
return c.json({ ok: true });
|
|
980
|
+
})
|
|
981
|
+
.post("/spaces/:id/sources/:sourceId/entries", async (c) => {
|
|
982
|
+
await requireAdmin();
|
|
983
|
+
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
984
|
+
const { addresses } = z
|
|
985
|
+
.object({ addresses: z.array(z.string().trim().url()).min(1).max(200) })
|
|
986
|
+
.parse(await c.req.json());
|
|
987
|
+
return c.json({
|
|
988
|
+
entries: await addSourceEntries(space.id, c.req.param("sourceId"), addresses),
|
|
989
|
+
});
|
|
990
|
+
})
|
|
991
|
+
.patch("/spaces/:id/sources/:sourceId/entries/:entryId", async (c) => {
|
|
992
|
+
await requireAdmin();
|
|
993
|
+
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
994
|
+
const { included } = z.object({ included: z.boolean() }).parse(await c.req.json());
|
|
995
|
+
return c.json(await setEntryIncluded(space.id, c.req.param("sourceId"), c.req.param("entryId"), included));
|
|
996
|
+
})
|
|
997
|
+
.delete("/spaces/:id/sources/:sourceId", async (c) => {
|
|
998
|
+
await requireAdmin();
|
|
999
|
+
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
1000
|
+
await removeSource(space.id, c.req.param("sourceId"));
|
|
1001
|
+
return c.json({ ok: true });
|
|
1002
|
+
})
|
|
847
1003
|
// What a link in a page names (`pages/bgb/p-281`): the studio opens it.
|
|
848
1004
|
.get("/spaces/:id/resolve", async (c) => {
|
|
849
1005
|
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
@@ -938,7 +1094,8 @@ export const studio = new Hono()
|
|
|
938
1094
|
await requireWritable(space);
|
|
939
1095
|
return c.json({ summary: await writeSummary(c.req.param("id")) });
|
|
940
1096
|
})
|
|
941
|
-
// A category a person sets on an item: `p:<page>`, `t:<table>`, `r:<row>`, `f:<file
|
|
1097
|
+
// A category a person sets on an item: `p:<page>`, `t:<table>`, `r:<row>`, `f:<file>`,
|
|
1098
|
+
// `m:<a file of a mount in Dateien>`.
|
|
942
1099
|
.put("/spaces/:id/items/:key/categories/:categoryId", async (c) => {
|
|
943
1100
|
const space = await ownedSpace(c.get("user").id, c.req.param("id"));
|
|
944
1101
|
await requireWritable(space);
|
|
@@ -952,7 +1109,9 @@ export const studio = new Hono()
|
|
|
952
1109
|
? { rowId: id }
|
|
953
1110
|
: key[0] === "f"
|
|
954
1111
|
? { fileId: id }
|
|
955
|
-
:
|
|
1112
|
+
: key[0] === "m"
|
|
1113
|
+
? { mountFileId: id }
|
|
1114
|
+
: null;
|
|
956
1115
|
if (!ref || key[1] !== ":") {
|
|
957
1116
|
throw new ServiceError("invalid", note("unknownEntry"));
|
|
958
1117
|
}
|
|
@@ -971,6 +1130,7 @@ export const studio = new Hono()
|
|
|
971
1130
|
.object({
|
|
972
1131
|
title: z.string().max(120),
|
|
973
1132
|
wizardId: z.string().nullish(),
|
|
1133
|
+
parentId: z.string().nullish(),
|
|
974
1134
|
columns: z.unknown().optional(),
|
|
975
1135
|
format: z.enum(["faq"]).nullish(),
|
|
976
1136
|
})
|
|
@@ -50,3 +50,19 @@ export function runTicketValid(runId, ticket) {
|
|
|
50
50
|
}
|
|
51
51
|
return sameSignature(`run:${runId}|${exp}`, sig);
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* A ticket that only reads one run: its view, its stream, its downloads. A client of the
|
|
55
|
+
* organization gets one for a run the firm shared with them (docs/plans/client-portal.md): they
|
|
56
|
+
* see it, they do not steer it.
|
|
57
|
+
*/
|
|
58
|
+
export function runViewTicket(runId, ttlSeconds = 12 * 3600) {
|
|
59
|
+
const exp = String(Math.floor(Date.now() / 1000) + ttlSeconds);
|
|
60
|
+
return `${exp}.${sign(`run-view:${runId}|${exp}`)}`;
|
|
61
|
+
}
|
|
62
|
+
export function runViewTicketValid(runId, ticket) {
|
|
63
|
+
const [exp, sig] = (ticket ?? "").split(".");
|
|
64
|
+
if (!exp || !sig || Number(exp) * 1000 < Date.now()) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return sameSignature(`run-view:${runId}|${exp}`, sig);
|
|
68
|
+
}
|