wizards 0.2.55 → 0.2.56
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/README.md +2 -2
- package/apps/runtime/dist/cli/autostart.js +1 -1
- package/apps/runtime/dist/cli/machine.js +5 -48
- package/apps/runtime/dist/cli/report.js +1 -1
- package/apps/runtime/dist/docs/dev/index.md +4 -4
- package/apps/runtime/dist/docs/dev/plugins/connections.md +4 -3
- package/apps/runtime/dist/docs/dev/plugins/events.md +1 -0
- package/apps/runtime/dist/docs/dev/plugins/examples.md +10 -9
- package/apps/runtime/dist/docs/dev/plugins/index.md +4 -3
- package/apps/runtime/dist/docs/dev/plugins/layout.md +2 -1
- package/apps/runtime/dist/docs/dev/plugins/meta.json +0 -1
- package/apps/runtime/dist/docs/dev/plugins/quick-start.md +4 -3
- package/apps/runtime/dist/docs/dev/plugins/reference.md +36 -14
- package/apps/runtime/dist/docs/dev/plugins/reloading.md +5 -5
- package/apps/runtime/dist/docs/dev/plugins/routes.md +30 -6
- package/apps/runtime/dist/docs/dev/plugins/runners.md +15 -10
- package/apps/runtime/dist/docs/dev/plugins/server.md +16 -7
- package/apps/runtime/dist/docs/dev/plugins/shipping.md +4 -26
- package/apps/runtime/dist/docs/dev/plugins/space.md +66 -53
- package/apps/runtime/dist/docs/dev/plugins/starters.md +10 -7
- package/apps/runtime/dist/docs/dev/plugins/studio.md +33 -12
- package/apps/runtime/dist/docs/dev/plugins/styling.md +19 -9
- package/apps/runtime/dist/docs/dev/plugins/tables.md +6 -4
- package/apps/runtime/dist/docs/dev/plugins/tools.md +22 -12
- package/apps/runtime/dist/docs/dev/wizard-format.md +3 -2
- package/apps/runtime/dist/docs/user/ai-apps.md +3 -1
- package/apps/runtime/dist/docs/user/assistant.md +5 -3
- package/apps/runtime/dist/docs/user/build-a-wizard.md +14 -2
- package/apps/runtime/dist/docs/user/command-line.md +16 -14
- package/apps/runtime/dist/docs/user/connectors.md +17 -12
- package/apps/runtime/dist/docs/user/data.md +14 -9
- package/apps/runtime/dist/docs/user/first-start.md +13 -6
- package/apps/runtime/dist/docs/user/index.md +2 -1
- package/apps/runtime/dist/docs/user/install.md +19 -11
- package/apps/runtime/dist/docs/user/models.md +44 -22
- package/apps/runtime/dist/docs/user/plugins.md +9 -4
- package/apps/runtime/dist/docs/user/run.md +14 -9
- package/apps/runtime/dist/docs/user/server.md +7 -5
- package/apps/runtime/dist/docs/user/space.md +15 -8
- package/apps/runtime/dist/docs/user/steps.md +33 -13
- package/apps/runtime/dist/docs/user/test-and-share.md +41 -25
- package/apps/runtime/dist/docs/user/troubleshooting.md +15 -7
- package/apps/runtime/dist/docs/user/wordpress.md +59 -49
- package/apps/runtime/dist/engine/runner.js +40 -18
- package/apps/runtime/dist/env.js +6 -3
- package/apps/runtime/dist/harness/apple.js +36 -21
- package/apps/runtime/dist/harness/claude.js +1 -1
- package/apps/runtime/dist/harness/model.js +2 -2
- package/apps/runtime/dist/limits.js +7 -4
- package/apps/runtime/dist/media/conversation.js +6 -5
- package/apps/runtime/dist/model-errors.js +22 -1
- package/apps/runtime/dist/models.js +30 -7
- package/apps/runtime/dist/plugins/pro-keys.js +1 -1
- package/apps/runtime/dist/plugins/pro-state.js +1 -1
- package/apps/runtime/dist/plugins/pro.js +1 -1
- package/apps/runtime/dist/plugins/runs.js +14 -10
- package/apps/runtime/dist/render/browser-path.js +54 -0
- package/apps/runtime/dist/routes/runs.js +51 -31
- package/apps/runtime/dist/routes/studio.js +7 -3
- package/apps/runtime/dist/services/api.js +3 -1
- package/apps/runtime/dist/services/package-file.js +8 -8
- package/apps/runtime/dist/update.js +1 -1
- package/apps/web/dist/assets/AboutDialog-Bv7p9iGr.js +1 -0
- package/apps/web/dist/assets/{ChangelogDialog-BLmJABe4.js → ChangelogDialog-D4sBrhi-.js} +1 -1
- package/apps/web/dist/assets/{ChatView-YAiOT6mt.js → ChatView-Bntm0u8V.js} +1 -1
- package/apps/web/dist/assets/{EditorPage-C0zMXwlF.js → EditorPage-DaVeNzHU.js} +2 -2
- package/apps/web/dist/assets/{FlowPreview-B4lbmeha.js → FlowPreview-C0tTz51A.js} +1 -1
- package/apps/web/dist/assets/{Harness-_riwRD-c.js → Harness-De-PsLFA.js} +1 -1
- package/apps/web/dist/assets/{Marketplace-B0Nki6J6.js → Marketplace-7Bdv7Gd5.js} +2 -2
- package/apps/web/dist/assets/{NewWizardPage-DkvGgROv.js → NewWizardPage-CV7jrSkz.js} +1 -1
- package/apps/web/dist/assets/{ProjectPage-CFRIPset.js → ProjectPage-CBCd24oM.js} +1 -1
- package/apps/web/dist/assets/{PublicRunner-QJuQB7ff.js → PublicRunner-CVmkHSnC.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly-DiOfNtVr.js → ReadOnly-zQecD9OB.js} +1 -1
- package/apps/web/dist/assets/{RunDrawer-LjUX3yIv.js → RunDrawer-CvzuYc0d.js} +1 -1
- package/apps/web/dist/assets/{RunnerView-DkJVfUeG.js → RunnerView-BtZp1FD6.js} +1 -1
- package/apps/web/dist/assets/SettingsPage--Zj2pTgf.js +1 -0
- package/apps/web/dist/assets/SetupPage-F_e8f1to.js +1 -0
- package/apps/web/dist/assets/{SharePage-CCimr8XT.js → SharePage-DLivbYu6.js} +1 -1
- package/apps/web/dist/assets/{brand-CwLcF9JR.js → brand-DIKyySmf.js} +1 -1
- package/apps/web/dist/assets/changelog-CWualFcc.js +1 -0
- package/apps/web/dist/assets/{circle-alert-BEDKtkJy.js → circle-alert-B9b9Vb9k.js} +1 -1
- package/apps/web/dist/assets/{esm-BCwno33N.js → esm-BMtXxAe0.js} +1 -1
- package/apps/web/dist/assets/{index-Dq-Wj6Yo.js → index-MlQy_Qoy.js} +4 -4
- package/apps/web/dist/assets/{lock-Ce2ofIWG.js → lock-BNvsUKTg.js} +1 -1
- package/apps/web/dist/assets/session-CSbo-pmx.js +1 -0
- package/apps/web/dist/assets/{settings-menu-DX0JnPBR.js → settings-menu-JtMfy9en.js} +1 -1
- package/apps/web/dist/assets/{ui-mkL5nF_f.js → ui-FW7ypPI6.js} +1 -1
- package/apps/web/dist/assets/{upload-BfrqabpO.js → upload-MQ_24gSb.js} +1 -1
- package/apps/web/dist/assets/{volume-2-C3GeMqc-.js → volume-2-B1mj20eS.js} +1 -1
- package/apps/web/dist/index.html +6 -6
- package/apps/web/dist/install.sh +2 -2
- package/apps/web/dist/mcp/flow.html +1 -1
- package/modules/calls/dist/client.css +1 -1
- package/modules/sms/dist/client.css +1 -1
- package/modules/whatsapp/dist/client.css +1 -1
- package/node_modules/@engenty-wizards/shared/dist/run.d.ts +152 -2
- package/node_modules/@engenty-wizards/shared/dist/run.js +135 -1
- package/package.json +2 -2
- package/apps/runtime/dist/docs/dev/plugins/pro-modules.md +0 -59
- package/apps/web/dist/assets/AboutDialog-BelD7JCn.js +0 -1
- package/apps/web/dist/assets/SettingsPage-BKZ1KLfP.js +0 -1
- package/apps/web/dist/assets/SetupPage-Rqlo16Lk.js +0 -1
- package/apps/web/dist/assets/changelog-Bg5ZBu5p.js +0 -1
- package/apps/web/dist/assets/session-BuVghS-e.js +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: The server half
|
|
3
3
|
description: The function a plugin exports, what it is handed, and the rules it runs under.
|
|
4
|
+
version: 0.2.56
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
The server half is a file whose default export is a function. The runtime calls it once when the
|
|
@@ -36,16 +37,22 @@ export default definePlugin((wizards) => {
|
|
|
36
37
|
| `registerTool(tool)` | A tool for AI steps | [Tools](./tools.md) |
|
|
37
38
|
| `registerSpaceContext(context)` | A block and tools for every AI step of a space | [The space](./space.md) |
|
|
38
39
|
| `registerAssistantTool(tool)` | A tool of the space assistant | [The space](./space.md#tools-of-the-space-assistant) |
|
|
39
|
-
| `
|
|
40
|
+
| `registerAssistantContext(context)` | What the space assistant is told on the plugin's own page | [The space](./space.md#the-assistant-on-the-plugins-own-page) |
|
|
41
|
+
| `spaceData.putPage(input)`, `putTable`, `putFile`, `putDocument`, `putCategories`, … | Knowledge of a space: pages, tables, files and Kategorien | [The space](./space.md#knowledge-a-plugin-writes) |
|
|
40
42
|
| `index.put(entry)`, `index.remove(space, key?)` | Texts in the space's search index | [The space](./space.md#the-search-index) |
|
|
41
43
|
| `registerHttpRoute(route)` | A route below `/api/studio/plugins/<id>` | [Routes](./routes.md) |
|
|
42
44
|
| `registerPublicRoute(route)`, `publicUrl(path)` | A route anyone may call, and its address | [Routes](./routes.md#public-routes) |
|
|
45
|
+
| `registerRunner(runner)` | A door a wizard runs through, beside the page and the chat | [Runners](./runners.md) |
|
|
46
|
+
| `runs.start(…)`, `report`, `answerPage`, … | Drives runs from the plugin's own door | [Runners](./runners.md#drive-a-run) |
|
|
47
|
+
| `speech.conversation()` | The tenant's realtime speech model, for a call | [Runners](./runners.md#a-call) |
|
|
43
48
|
| `registerMigrations(folder)` | `.sql` files with the plugin's tables | [Tables](./tables.md) |
|
|
44
49
|
| `on(event, listener)` | Called when a run ends or a space changes | [Events](./events.md) |
|
|
45
|
-
| `connections.
|
|
50
|
+
| `connections.available(…)`, `start`, `connect`, `list`, `call`, … | Accounts of a space, through the built-in connectors | [Accounts](./connections.md) |
|
|
51
|
+
| `registerStarter(starter)` | A wizard the plugin brings as a template | [Starters](./starters.md) |
|
|
46
52
|
| `every(name, everyMs, handler)` | A job, again and again | below |
|
|
47
53
|
| `web.fetch(url, init?)`, `web.read(url)` | Requests to the web, guarded | below |
|
|
48
54
|
| `documents.parse(file)` | A file as Markdown | below |
|
|
55
|
+
| `secrets.seal(value)`, `secrets.unseal(sealed)` | Keys of the plugin's own, sealed for a table | below |
|
|
49
56
|
| `getTenantDb()` | The database of the tenant the current request, step or event belongs to | [Tables](./tables.md) |
|
|
50
57
|
| `generate(request)` | Asks a model of the current tenant | below |
|
|
51
58
|
| `onUnload(fn)` | Something to undo when the plugin unloads | below |
|
|
@@ -68,7 +75,7 @@ values in a [table](./tables.md).
|
|
|
68
75
|
|
|
69
76
|
## Tenants
|
|
70
77
|
|
|
71
|
-
A runtime serves one tenant on a person's computer and many
|
|
78
|
+
A runtime serves one tenant on a person's computer and many on engenty.ai.
|
|
72
79
|
Either way a plugin never names a tenant:
|
|
73
80
|
|
|
74
81
|
- A route, a tool and a listener each run inside one tenant.
|
|
@@ -116,6 +123,7 @@ server.every("refresh", 60 * 60_000, async ({ tenantId, lastRun, signal }) => {
|
|
|
116
123
|
|
|
117
124
|
- The handler runs for every tenant that has the plugin, inside that tenant, at most once per
|
|
118
125
|
`everyMs`. A minute is the least.
|
|
126
|
+
- A job's name is lower case, digits and `_`, once per plugin.
|
|
119
127
|
- When it ran is kept: a restart does not start the count again. A runtime that was off runs a
|
|
120
128
|
due job once when it starts, not once per turn it missed. A local install runs jobs while it
|
|
121
129
|
runs.
|
|
@@ -137,9 +145,9 @@ const res = await server.web.fetch(`${origin}/sitemap.xml`, {
|
|
|
137
145
|
|
|
138
146
|
- Both refuse addresses of this machine and of the local network, after a redirect too, as the
|
|
139
147
|
runtime's own requests do.
|
|
140
|
-
- `read` gives the page's text as Markdown and
|
|
141
|
-
hardly any text without its scripts is drawn in a browser first. `etag`
|
|
142
|
-
`lastModified` are what the server sent, for asking later whether the page changed. `jsonld`
|
|
148
|
+
- `read` gives the page's text as Markdown and its links, absolute and each once (up to
|
|
149
|
+
2,000). A page with hardly any text without its scripts is drawn in a browser first. `etag`
|
|
150
|
+
and `lastModified` are what the server sent, for asking later whether the page changed. `jsonld`
|
|
143
151
|
is the page's structured data (its `application/ld+json` blocks, parsed): a shop's product
|
|
144
152
|
page says title, price, availability and image there exactly, without a model.
|
|
145
153
|
- `fetch` is `fetch` behind the guard: for a sitemap, `robots.txt`, a question with
|
|
@@ -186,6 +194,7 @@ is mended.
|
|
|
186
194
|
|
|
187
195
|
## Imports
|
|
188
196
|
|
|
189
|
-
`@engenty-wizards/plugin-sdk
|
|
197
|
+
`@engenty-wizards/plugin-sdk` (and `@engenty-wizards/plugin-sdk/thread`), `zod`, `drizzle-orm` and
|
|
198
|
+
`drizzle-orm/sqlite-core` come from the
|
|
190
199
|
runtime's own copies, so a schema or a table a plugin makes is one the runtime understands. See
|
|
191
200
|
[Files and manifest](./layout.md#dependencies) for everything else.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Shipping
|
|
3
3
|
description: Hand a plugin to someone else, put it into a server's image, and decide which tenant has it.
|
|
4
|
+
version: 0.2.56
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
## To someone's install
|
|
@@ -61,34 +62,11 @@ installed app and in the Docker image. A module there is part of the open produc
|
|
|
61
62
|
A plugin that is not part of the open product stays out of `modules/` and goes into a folder of
|
|
62
63
|
`PLUGINS_DIR`.
|
|
63
64
|
|
|
64
|
-
engenty's own closed plugins reach a local install as [Pro modules](./pro-modules): signed
|
|
65
|
-
packages from the linked account, on while its plan includes them.
|
|
66
|
-
|
|
67
65
|
## Which tenant has a plugin
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
| As the runtime of a Manage-App | The plugins in `PLUGINS_DEFAULT`, and the ones the Manage-App lists for that tenant |
|
|
73
|
-
|
|
74
|
-
In a runtime of a Manage-App:
|
|
75
|
-
|
|
76
|
-
- Plugins are installed by whoever runs the runtime, into the image or a folder of
|
|
77
|
-
`PLUGINS_DIR`. A tenant cannot install one.
|
|
78
|
-
- `PLUGINS_DEFAULT` is a comma-separated list of ids every tenant has.
|
|
79
|
-
- The Manage-App switches further ones on per tenant: `modules` in its answer to
|
|
80
|
-
`GET /v1/tenants/:id`
|
|
81
|
-
([manage-contract.md](https://github.com/engenty/engenty-wizards/blob/main/docs/manage-contract.md)).
|
|
82
|
-
It learns which plugins a runtime carries from `GET /api/internal/plugins` (with the
|
|
83
|
-
runtime's service key), so a plan's modules are picked from what exists.
|
|
84
|
-
- For a tenant without a plugin, that plugin does not exist: no routes, no tools, no listeners,
|
|
85
|
-
no studio half.
|
|
86
|
-
- A plugin's tables are made in every tenant's database, whether the tenant has the plugin or
|
|
87
|
-
not.
|
|
88
|
-
- Nothing reloads while it runs.
|
|
89
|
-
|
|
90
|
-
So one image serves tenants with different sets of plugins: the plugin is in the image, and the
|
|
91
|
-
Manage-App decides who has it.
|
|
67
|
+
On an install of your own, on your computer or your own server, every tenant has every plugin
|
|
68
|
+
the runtime loaded. On engenty.ai the service installs the plugins and switches them on per
|
|
69
|
+
account; a person cannot install one there.
|
|
92
70
|
|
|
93
71
|
## Versions
|
|
94
72
|
|
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: The space
|
|
3
|
-
description:
|
|
3
|
+
description: Knowledge a plugin writes, a block and tools for every AI step of a space, texts in its search index, tools and cards of its assistant.
|
|
4
|
+
version: 0.2.56
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
A space holds what all its wizards share: a title, logos, colours, facts, and
|
|
7
|
-
tables and files with their Kategorien. A plugin writes
|
|
8
|
-
know, to what its search finds, and to what its assistant can do. The runtime's
|
|
9
|
-
[run event](./events.md) is a space's
|
|
7
|
+
A space holds what all its wizards share: a title, logos, colours, facts, and Knowledge —
|
|
8
|
+
pages, tables and files with their Kategorien. A plugin writes Knowledge, adds to what the
|
|
9
|
+
space's AI steps know, to what its search finds, and to what its assistant can do. The runtime's
|
|
10
|
+
own tables call a space a project: `wizard.projectId` in a [run event](./events.md) is a space's
|
|
11
|
+
id.
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## Knowledge a plugin writes
|
|
12
14
|
|
|
13
|
-
`server.spaceData` writes pages, tables and files into a space's
|
|
15
|
+
`server.spaceData` writes pages, tables and files into a space's Knowledge under keys of the
|
|
14
16
|
plugin's own, with their Kategorien. Every write is indexed: `project_search` finds it a moment
|
|
15
|
-
later, filtered by its Kategorien and checked like everything else in
|
|
17
|
+
later, filtered by its Kategorien and checked like everything else in Knowledge. `space` is the
|
|
18
|
+
space's id.
|
|
16
19
|
|
|
17
20
|
```ts
|
|
18
21
|
// The source's Kategorien, once. `proposed: true` shows them to the person to take first.
|
|
19
22
|
await server.spaceData.putCategories({
|
|
20
23
|
space,
|
|
21
24
|
categories: [
|
|
22
|
-
{ name: "
|
|
23
|
-
{ name: "
|
|
24
|
-
{ name: "
|
|
25
|
+
{ name: "Team", type: "choice", hint: "folder name" },
|
|
26
|
+
{ name: "Meeting date", type: "date" },
|
|
27
|
+
{ name: "Duration", type: "number", unit: "h" },
|
|
25
28
|
],
|
|
26
29
|
});
|
|
27
30
|
|
|
@@ -29,10 +32,10 @@ await server.spaceData.putCategories({
|
|
|
29
32
|
await server.spaceData.putPage({
|
|
30
33
|
space,
|
|
31
34
|
key: `${source.id}:2026-03-14`,
|
|
32
|
-
label: "
|
|
33
|
-
title: "
|
|
35
|
+
label: "Meeting notes",
|
|
36
|
+
title: "Weekly meeting, 14 March 2026",
|
|
34
37
|
markdown,
|
|
35
|
-
categories: {
|
|
38
|
+
categories: { Team: "Sales", "Meeting date": "2026-03-14", Duration: 1.5 },
|
|
36
39
|
fill: true, // a model fills the Kategorien the entry did not bring
|
|
37
40
|
});
|
|
38
41
|
|
|
@@ -42,18 +45,18 @@ const doc = await server.spaceData.putDocument({ space, key, label, name, mime,
|
|
|
42
45
|
|
|
43
46
|
| `server.spaceData.` | Does |
|
|
44
47
|
|---|---|
|
|
45
|
-
| `putCategories({ space, categories, proposed? })` | Adds Kategorien, or values to known ones. Types: `choice`, `date`, `number` (with `unit`), `text`, `boolean`. `column: { table, column }` makes a column of a table the plugin wrote one |
|
|
48
|
+
| `putCategories({ space, categories, proposed? })` | Adds Kategorien, or values to known ones. Types: `choice` (with `values`, `multiple`, `ordered`), `date`, `number` (with `unit`), `text`, `boolean`. `column: { table, column }` makes a column of a table the plugin wrote one |
|
|
46
49
|
| `putPage(input)` | A page: `title`, `markdown`, `parent` (the key of a page to stand under), `original` (the file it was read from), `categories`, `fill`, `review` (why a person should look) |
|
|
47
50
|
| `putTable(input)` | A table: typed `columns`, `rows` (cells by column id, they replace the rows the key had), `format: "faq"` |
|
|
48
51
|
| `putFile(input)` | A file that is no page: found by its name, `description` and Kategorien; `text` is what a step reads of it |
|
|
49
52
|
| `putDocument(input)` | A file read as an upload is. Gives what it became: `items` (pages, tables), `review` when it read badly or not at all |
|
|
50
53
|
| `readPages(space, { parent? })` | The space's own pages, whoever wrote them, with their Markdown: `{ id, title, path, parentId, markdown, origin, originKey, updatedAt }` |
|
|
51
|
-
| `files(space, kind?)`, `readFile(space, id)` | The space's files (`document` when
|
|
54
|
+
| `files(space, kind?)`, `readFile(space, id)` | The space's files of a kind (`logo`, `asset`, `document`; `document` when none is named), newest first, and one with its bytes: a price list someone dropped into Knowledge |
|
|
52
55
|
| `list(space)` | Everything the plugin wrote, by key, with its path and `state` |
|
|
53
56
|
| `remove(space, key?)` | Takes out one key, or everything of the plugin in the space |
|
|
54
|
-
| `summarize(space, category?, value?)` | Writes the
|
|
57
|
+
| `summarize(space, category?, value?)` | Writes the Overview of values with three items or more; a model call each. Gives how many it wrote |
|
|
55
58
|
|
|
56
|
-
- `label` is what the person knows the source as;
|
|
59
|
+
- `label` is what the person knows the source as; Knowledge shows it beside the item.
|
|
57
60
|
- A person who changes an item keeps it: the plugin's next write answers `state: "kept"` and
|
|
58
61
|
changes nothing, and `remove` leaves it.
|
|
59
62
|
- What a step reads of an item is its path: `pages/…`, `tables/…`, `files/…`.
|
|
@@ -87,11 +90,14 @@ server.registerSpaceContext({
|
|
|
87
90
|
it.
|
|
88
91
|
- The tools are [tools](./tools.md) like the ones a step lists; the model sees
|
|
89
92
|
`<plugin>_<name>`. Their names and the names of the plugin's other tools are one list.
|
|
93
|
+
- A model on the device calls no tools: Apple Intelligence on a Mac, or the phone a run is
|
|
94
|
+
followed on, which answers only steps that list no tools themselves. The step then gets the
|
|
95
|
+
block without the tools.
|
|
90
96
|
|
|
91
97
|
## The search index
|
|
92
98
|
|
|
93
|
-
Every agent step can search the space with `project_search`. It finds
|
|
94
|
-
and by `server.spaceData` — and the texts plugins put in themselves, outside
|
|
99
|
+
Every agent step can search the space with `project_search`. It finds Knowledge — written by
|
|
100
|
+
people and by `server.spaceData` — and the texts plugins put in themselves, outside Knowledge:
|
|
95
101
|
|
|
96
102
|
```ts
|
|
97
103
|
await server.index.put({
|
|
@@ -108,12 +114,12 @@ await server.index.remove(space.id); // every text of the plugin in the space
|
|
|
108
114
|
|
|
109
115
|
- Putting a key again replaces what it held.
|
|
110
116
|
- A text is cut into passages. Its title is searched with it, and a hit is called by it. The test
|
|
111
|
-
search under
|
|
117
|
+
search under Knowledge shows hits as a step gets them.
|
|
112
118
|
- The index searches by words and by trigrams (codes, parts of compounds); with an embedding model
|
|
113
119
|
set up, also by meaning. A classifier then judges each candidate.
|
|
114
|
-
- Such a text has no Kategorien: a search with a filter leaves it out. Write
|
|
120
|
+
- Such a text has no Kategorien: a search with a filter leaves it out. Write Knowledge with
|
|
115
121
|
`server.spaceData` when it should be filtered.
|
|
116
|
-
- A step gets `project_search` as soon as the space has
|
|
122
|
+
- A step gets `project_search` as soon as the space has Knowledge or a plugin's text.
|
|
117
123
|
- A tenant without the plugin does not find its texts. They go with the space when it is
|
|
118
124
|
deleted.
|
|
119
125
|
|
|
@@ -125,14 +131,14 @@ it tools:
|
|
|
125
131
|
|
|
126
132
|
```ts
|
|
127
133
|
server.registerAssistantTool({
|
|
128
|
-
name: "
|
|
129
|
-
description: "
|
|
130
|
-
inputSchema: z.object({
|
|
134
|
+
name: "draft_page",
|
|
135
|
+
description: "Drafts a page of the space's wiki on a topic the person names.",
|
|
136
|
+
inputSchema: z.object({ topic: z.string() }),
|
|
131
137
|
card: true,
|
|
132
|
-
execute: async ({
|
|
133
|
-
turn.emit("
|
|
134
|
-
const
|
|
135
|
-
return {
|
|
138
|
+
execute: async ({ topic }, turn) => {
|
|
139
|
+
turn.emit("Writing the draft …");
|
|
140
|
+
const draft = await draftPage(turn.space.id, topic, turn.signal);
|
|
141
|
+
return { title: draft.title, words: draft.words };
|
|
136
142
|
},
|
|
137
143
|
});
|
|
138
144
|
```
|
|
@@ -155,20 +161,21 @@ With `card: true` the result also goes to the chat. The studio half draws it:
|
|
|
155
161
|
|
|
156
162
|
```tsx
|
|
157
163
|
studio.registerAssistantCard({
|
|
158
|
-
tool: "
|
|
164
|
+
tool: "draft_page",
|
|
159
165
|
component: ({ data, send }) => (
|
|
160
166
|
<Card className="flex items-center gap-3 p-4">
|
|
161
167
|
<span className="flex-1 text-[0.875rem]">
|
|
162
|
-
{data.
|
|
168
|
+
{data.title}: {data.words} words
|
|
163
169
|
</span>
|
|
164
|
-
<Button size="sm" onClick={() => send("
|
|
165
|
-
|
|
170
|
+
<Button size="sm" onClick={() => send("Publish it")}>
|
|
171
|
+
Publish it
|
|
166
172
|
</Button>
|
|
167
173
|
</Card>
|
|
168
174
|
),
|
|
169
175
|
});
|
|
170
176
|
```
|
|
171
177
|
|
|
178
|
+
- `tool` is the name the server half registered, without the plugin's prefix.
|
|
172
179
|
- The card stands below the assistant's answer. Without a card for the tool, nothing shows.
|
|
173
180
|
- `data` is what `execute` returned, sent as it is: keep it small.
|
|
174
181
|
- `send(message)` sends a message to the assistant as if the person typed it.
|
|
@@ -188,26 +195,26 @@ plugin's assistant tools first.
|
|
|
188
195
|
const Assistant = studio.Assistant;
|
|
189
196
|
|
|
190
197
|
<Assistant
|
|
191
|
-
title="
|
|
192
|
-
hello="
|
|
193
|
-
placeholder="
|
|
198
|
+
title="Ask about your contacts"
|
|
199
|
+
hello="I find people who ran a wizard and tidy the list."
|
|
200
|
+
placeholder="e.g. “Who ran the quote wizard last week?” …"
|
|
194
201
|
suggestions={[
|
|
195
|
-
{ label: "
|
|
196
|
-
{ label: "
|
|
202
|
+
{ label: "Who came back more than once?" },
|
|
203
|
+
{ label: "Remove the contacts of …", fill: true },
|
|
197
204
|
]}
|
|
198
|
-
onChanged={() => queryClient.invalidateQueries({ queryKey: ["
|
|
205
|
+
onChanged={() => queryClient.invalidateQueries({ queryKey: ["contacts"] })}
|
|
199
206
|
/>
|
|
200
207
|
```
|
|
201
208
|
|
|
202
209
|
```ts
|
|
203
210
|
server.registerAssistantContext({
|
|
204
|
-
block: async (space) => `THE
|
|
211
|
+
block: async (space) => `THE CONTACTS ON THIS PAGE: ${await contactsText(space.id)} …`,
|
|
205
212
|
});
|
|
206
213
|
```
|
|
207
214
|
|
|
208
215
|
- `studio.Assistant` draws nothing: place it once, anywhere in the page. `title` and `hello`
|
|
209
216
|
greet before the first message; up to three `suggestions` stand under them. A click sends one
|
|
210
|
-
at once; `fill: true` puts it into the field to finish first.
|
|
217
|
+
at once (its `message`, or the label); `fill: true` puts it into the field to finish first.
|
|
211
218
|
- `block` is asked once per message, only when the person writes from the plugin's page. A
|
|
212
219
|
block is cut at 8,000 characters; one that throws is logged and left out.
|
|
213
220
|
- In a read-only space the assistant has none of the space's tools nor the plugins'.
|
|
@@ -220,36 +227,42 @@ address and the trail of the top bar.
|
|
|
220
227
|
|
|
221
228
|
```tsx
|
|
222
229
|
studio.useAssistantPage({
|
|
223
|
-
open:
|
|
224
|
-
selection: picked,
|
|
225
|
-
summary: `${
|
|
230
|
+
open: person ? { kind: "contact", id: String(person.id), label: person.email } : undefined,
|
|
231
|
+
selection: picked.map(String),
|
|
232
|
+
summary: `${contacts.length} contacts · ${withoutName} without a name`,
|
|
226
233
|
// A page of full-height tables keeps the assistant small, at the lower right.
|
|
227
234
|
compact: true,
|
|
228
235
|
});
|
|
229
236
|
```
|
|
230
237
|
|
|
238
|
+
- `open` is `{ kind, id?, label }`; `selection` the ids of what the person picked;
|
|
239
|
+
`fields` is `{ id, label, value }[]`.
|
|
240
|
+
- It takes the words of `studio.Assistant` too (`title`, `hello`, `placeholder`, `suggestions`,
|
|
241
|
+
`onChanged`): one call can do both.
|
|
242
|
+
- The data may change on every render; it is read when the person sends.
|
|
243
|
+
|
|
231
244
|
### Tools in the page
|
|
232
245
|
|
|
233
246
|
`studio.useAssistantTool` gives the assistant a tool that runs in the browser while the page is
|
|
234
|
-
shown: it filters a list, opens an item, picks a tab. The model sees it as `<plugin>_<name
|
|
235
|
-
`run` gets the arguments and returns what the assistant
|
|
236
|
-
never saves: saving stays with the server half's tools.
|
|
247
|
+
shown: it filters a list, opens an item, picks a tab. The model sees it as `<plugin>_<name>`
|
|
248
|
+
(a `-` in the plugin's id becomes `_`); `run` gets the arguments and returns what the assistant
|
|
249
|
+
learns. It changes what the page shows, never saves: saving stays with the server half's tools.
|
|
237
250
|
|
|
238
251
|
```tsx
|
|
239
252
|
studio.useAssistantTool(
|
|
240
|
-
"
|
|
253
|
+
"filter_contacts",
|
|
241
254
|
{
|
|
242
|
-
description: "Shows only the
|
|
255
|
+
description: "Shows only the contacts that match: of a wizard, by words.",
|
|
243
256
|
parameters: {
|
|
244
257
|
type: "object",
|
|
245
258
|
properties: {
|
|
246
|
-
|
|
259
|
+
wizard: { type: "string" },
|
|
247
260
|
query: { type: "string" },
|
|
248
261
|
},
|
|
249
262
|
},
|
|
250
263
|
},
|
|
251
|
-
({
|
|
252
|
-
setFilter({
|
|
264
|
+
({ wizard, query }) => {
|
|
265
|
+
setFilter({ wizard: wizard as string | undefined, query: query as string | undefined });
|
|
253
266
|
return { shown: count };
|
|
254
267
|
},
|
|
255
268
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Starters
|
|
3
3
|
description: Wizards a plugin brings as templates — how to register one, where it shows, and what a wizard made from it gets.
|
|
4
|
+
version: 0.2.56
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
A starter is a wizard a plugin brings as a template. It stands beside the marketplace's starters
|
|
@@ -12,11 +13,12 @@ import { readFileSync } from "node:fs";
|
|
|
12
13
|
const read = (path: string) => readFileSync(wizards.resolvePath(path), "utf8");
|
|
13
14
|
|
|
14
15
|
server.registerStarter({
|
|
15
|
-
id: "
|
|
16
|
-
title: "
|
|
17
|
-
description: "
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
id: "follow-up",
|
|
17
|
+
title: "Follow up a contact",
|
|
18
|
+
description: "Looks the person up and drafts a follow-up e-mail.",
|
|
19
|
+
language: "en",
|
|
20
|
+
definition: JSON.parse(read("starters/follow-up.json")),
|
|
21
|
+
files: { "widget/card.html": read("starters/card.html") },
|
|
20
22
|
});
|
|
21
23
|
```
|
|
22
24
|
|
|
@@ -36,12 +38,12 @@ an id that is not allowed and an id registered twice throw, and the plugin does
|
|
|
36
38
|
error names the starter:
|
|
37
39
|
|
|
38
40
|
```
|
|
39
|
-
Starter "
|
|
41
|
+
Starter "follow-up": steps.2.fields: …
|
|
40
42
|
```
|
|
41
43
|
|
|
42
44
|
## Where it shows
|
|
43
45
|
|
|
44
|
-
The starter is known as `<plugin id>.<starter id>`: `
|
|
46
|
+
The starter is known as `<plugin id>.<starter id>`: `contacts.follow-up`. A marketplace entry's id
|
|
45
47
|
has no dot, so the two never meet.
|
|
46
48
|
|
|
47
49
|
| Where | |
|
|
@@ -49,6 +51,7 @@ has no dot, so the two never meet.
|
|
|
49
51
|
| New wizard in the studio | First among the templates, with the plugin's name on its card. It cannot be starred: it is always there, also without a connection |
|
|
50
52
|
| `GET /api/studio/marketplace` | First on the first page, with `plugin: { id, name }` |
|
|
51
53
|
| MCP `list_starters`, `get_starter`, `create_wizard` | Listed first with `plugin`; `starterId` takes its id |
|
|
54
|
+
| `GET /api/v1/templates`, for programs with a key | First, with `plugin`; `POST /api/v1/wizards` takes its id as `starterId` |
|
|
52
55
|
|
|
53
56
|
Only the tenants that have the plugin see it, by the same rule as its tools
|
|
54
57
|
([Which tenant has a plugin](./shipping.md#which-tenant-has-a-plugin)). Words and filters of a search find it by its title, its description
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: The studio half
|
|
3
3
|
description: Pages, icons in the app bar, sections of the settings and of the space page — written in React, built once, drawn inside the studio.
|
|
4
|
+
version: 0.2.56
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
The studio half is `ui/plugin.tsx`. Its default export is a function; the studio calls it after
|
|
@@ -88,7 +89,7 @@ export default defineStudioPlugin((studio) => {
|
|
|
88
89
|
| `studio.registerSettingsSection({ id, label, icon, component, menu? })` | A section of the settings at `/studio/settings/<id>`. `menu`: the user menu links to it directly |
|
|
89
90
|
| `studio.registerSpaceSection({ id, group?, label, hint?, component })` | A section of a part of the space page at `/studio/space/<group>#<id>`, below the part's own. See [The space](#the-space) |
|
|
90
91
|
| `studio.registerShareSection({ runner, component })` | A runner's own part of the share dialog, under its row once the runner is on for the wizard. See [Runners](./runners.md#the-runners-part-of-the-share-dialog) |
|
|
91
|
-
| `studio.registerAssistantCard({ tool, component })` | A card in the
|
|
92
|
+
| `studio.registerAssistantCard({ tool, component })` | A card in the assistant's chat for what a tool of the server half returned. See [The space](./space.md#a-card-in-the-chat) |
|
|
92
93
|
|
|
93
94
|
- The studio's own addresses are taken: `/new`, `/edit`, `/settings`, `/space`, `/setup`,
|
|
94
95
|
`/sign-in`.
|
|
@@ -117,15 +118,15 @@ studio.registerSettingsSection({
|
|
|
117
118
|
|
|
118
119
|
## The space
|
|
119
120
|
|
|
120
|
-
A space holds what all its wizards share: a title, logos, colours, facts and
|
|
121
|
-
space page, behind the
|
|
121
|
+
A space holds what all its wizards share: a title, logos, colours, facts and Knowledge. The
|
|
122
|
+
space page, behind the house icon (Space) in the app bar, shows them in four parts:
|
|
122
123
|
|
|
123
124
|
| Part | `group` | Holds |
|
|
124
125
|
|---|---|---|
|
|
125
|
-
| Info &
|
|
126
|
-
|
|
|
127
|
-
|
|
|
128
|
-
|
|
|
126
|
+
| Info & brand | `info` | Basics, Logos, Colours, Assets, Facts |
|
|
127
|
+
| Knowledge | `knowledge` | Documents, pages, tables and files with their Kategorien: what every AI step looks things up in |
|
|
128
|
+
| Data | `data` | What the wizards keep |
|
|
129
|
+
| Results | `results` | The runs that reached their result |
|
|
129
130
|
|
|
130
131
|
A plugin adds a section to one of them, below the part's own:
|
|
131
132
|
|
|
@@ -149,14 +150,14 @@ studio.registerSpaceSection({
|
|
|
149
150
|
});
|
|
150
151
|
```
|
|
151
152
|
|
|
152
|
-
- `group` is the part; without one the section stands under
|
|
153
|
+
- `group` is the part; without one the section stands under Knowledge.
|
|
153
154
|
- The studio draws the heading and the hint above the section, as it does for the space's own,
|
|
154
155
|
and lists the section in the part's menu under the plugin's name. The component draws the
|
|
155
156
|
rest, usually a `Card`.
|
|
156
157
|
- `id` is the section's anchor: `/studio/space/data#contacts` opens the page there, and so does
|
|
157
|
-
`/studio/space#contacts`. In
|
|
158
|
-
`/studio/space/knowledge?show=s:<id>`, where `#<id>` leads too. Ids are unique on the whole
|
|
159
|
-
`logos`, `colors`, `assets`, `documents`, `facts`.
|
|
158
|
+
`/studio/space#contacts`. In Knowledge a section is a page of its own:
|
|
159
|
+
`/studio/space/knowledge?show=s:<id>`, where `#<id>` leads too. Ids are unique on the whole
|
|
160
|
+
page; the space's own are taken: `base`, `logos`, `colors`, `assets`, `documents`, `facts`.
|
|
160
161
|
- `studio.useSpace()` is a hook: `{ id, name, readOnly }`, or `null` while there is none. A
|
|
161
162
|
component that calls it draws again when the person picks another space. `readOnly`: the
|
|
162
163
|
space came from a local install, or nothing is built on this runtime; show it, change nothing.
|
|
@@ -203,11 +204,31 @@ Each gives the parsed JSON. Use them with `useQuery` and `useMutation`, as the p
|
|
|
203
204
|
|---|---|
|
|
204
205
|
| `user` | `{ id, name, email }` |
|
|
205
206
|
| `tenant` | `{ id, role }`, the role `owner`, `admin` or `member` |
|
|
206
|
-
| `mode` | `"local"`: the runtime runs alone. `"managed"`:
|
|
207
|
+
| `mode` | `"local"`: the runtime runs alone. `"managed"`: on engenty.ai |
|
|
207
208
|
|
|
208
209
|
Hide what a member may not do, and guard it on the server too with `role: "admin"` on the
|
|
209
210
|
route.
|
|
210
211
|
|
|
212
|
+
`studio.plugin` is the plugin itself: `{ id, name, version }`.
|
|
213
|
+
|
|
214
|
+
## Where the page stands
|
|
215
|
+
|
|
216
|
+
The top bar shows a trail after the space's name. `studio.useCrumbs` is a hook that sets it
|
|
217
|
+
while the page is shown, in place of a heading of the page's own:
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
studio.useCrumbs([{ label: t("title"), to: "/contacts" }, { label: person.name ?? person.email }]);
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
- Each step is `{ label, to? }`; the last one is the page itself. A phone does not show the trail.
|
|
224
|
+
- The assistant names the page by its trail.
|
|
225
|
+
|
|
226
|
+
## The assistant
|
|
227
|
+
|
|
228
|
+
The studio's assistant stands on a plugin's pages too. `studio.Assistant`,
|
|
229
|
+
`studio.useAssistantPage` and `studio.useAssistantTool` tell it what to say there, what the page
|
|
230
|
+
shows and what it may do in it. See [The space](./space.md#the-assistant-on-the-plugins-own-page).
|
|
231
|
+
|
|
211
232
|
## Build it
|
|
212
233
|
|
|
213
234
|
The studio half is built to two files, `dist/client.js` and `dist/client.css`. The build needs
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Styles and components
|
|
3
3
|
description: The studio's components, Tailwind against the studio's theme, and why a plugin's styles never leak.
|
|
4
|
+
version: 0.2.56
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
A plugin's page should look like the studio. Two things make that easy: the studio's components
|
|
@@ -16,20 +17,23 @@ and its theme.
|
|
|
16
17
|
| `IconButton` | An action that is only an icon | `label`: its name for screen readers and the tooltip |
|
|
17
18
|
| `Input`, `Textarea` | Text. The textarea grows with its content | `minRows`, `maxRows` on the textarea |
|
|
18
19
|
| `Select` | One of a list | `value`, `onChange(value)`, `options: { value, label, disabled? }[]`, `placeholder` |
|
|
19
|
-
| `Segmented` | One or several of a few | `value`, `onChange`, `options: string[]`, `multi` |
|
|
20
|
-
| `
|
|
20
|
+
| `Segmented` | One or several of a few | `value`, `onChange`, `options: string[]`, `multi`, `disabled` (options shown but not to be picked) |
|
|
21
|
+
| `Tabs` | A row of tabs; the panels are yours | `value`, `onChange`, `options: { id, label }[]`, `label` (for screen readers) |
|
|
22
|
+
| `Switch` | On or off | `checked`, `onChange(checked)`, `label`, `disabled` |
|
|
21
23
|
| `Swatch` | A colour | The native colour input's |
|
|
22
24
|
| `Label` | A field's label | `hint`, `required` |
|
|
23
25
|
| `Card` | A surface | |
|
|
24
|
-
| `Chip` | A state in a word | `tone`: `neutral` (default), `live`, `warn`, `ember` |
|
|
26
|
+
| `Chip` | A state in a word | `tone`: `neutral` (default), `live`, `warn`, `ember` · `icon` (in place of the live dot) · `title` (on hover) |
|
|
25
27
|
| `DatePicker` | A date from a month | `value` ("YYYY-MM-DD" or ""), `onChange`, `min`, `max`, `clearable` |
|
|
26
28
|
| `DateRangePicker` | A day or a period in one month: the first click is the start, the second the end | `from`, `to`, `onChange({ from, to })`, `min`, `max` |
|
|
27
29
|
| `TimePicker` | A time of day from an hour and a minute column; arrow keys on the field move it by `step` | `value` ("HH:MM" or ""), `onChange`, `step` (minutes, default 5), `compact` (narrow, no clock) |
|
|
28
|
-
| `PageMenu` | A page's own menu: a list at the side with one level below that slides in, tabs on a phone | `title`, `entries` ({ id, label, icon
|
|
30
|
+
| `PageMenu` | A page's own menu: a list at the side with one level below that slides in, tabs on a phone | `title`, `entries` ({ id, label, icon?, to, entries? }), `current`, `footer` |
|
|
29
31
|
| `Composer` | The field a message is written in: text, dictation, files, send | `onSend(text, files)` (false keeps the draft), `placeholder`, `disabled`, `attach`, `floating` |
|
|
30
|
-
| `Dialog` | A modal | `open`, `onClose`, `title`, `wide` |
|
|
32
|
+
| `Dialog` | A modal; on a phone it fills the screen | `open`, `onClose`, `title`, `wide` (`true`, or `"page"` for a document), `height="tall"` (for tabs, folds or lists: its height does not jump), `bare` (the children are the panel) |
|
|
31
33
|
| `Spinner`, `Empty` | Loading, and nothing there yet | |
|
|
34
|
+
| `LinkedText` | A sentence with its web addresses as links, named by their host | `text` |
|
|
32
35
|
| `cn(...)` | Joins class names, skipping what is false | |
|
|
36
|
+
| `dateText(date, withWeekday?)` | A "YYYY-MM-DD" date in the studio's language: "Wed 14 Oct 2026" | |
|
|
33
37
|
|
|
34
38
|
```tsx
|
|
35
39
|
import { Button, Card, Chip, Label, Input } from "@engenty-wizards/web/ui";
|
|
@@ -46,6 +50,11 @@ import { Button, Card, Chip, Label, Input } from "@engenty-wizards/web/ui";
|
|
|
46
50
|
|
|
47
51
|
Icons are from `lucide-react`.
|
|
48
52
|
|
|
53
|
+
Most of these components live in the runner package (`@engenty-wizards/runner`), so a wizard's
|
|
54
|
+
run page looks like the studio. Import them from `@engenty-wizards/web/ui` all the same: that
|
|
55
|
+
is the import the studio shares. `@engenty-wizards/runner` is not shared and would be bundled
|
|
56
|
+
into `client.js`.
|
|
57
|
+
|
|
49
58
|
## Tailwind
|
|
50
59
|
|
|
51
60
|
A plugin writes Tailwind classes, as the studio does. The build collects the classes the
|
|
@@ -66,7 +75,8 @@ The theme's names are the studio's:
|
|
|
66
75
|
| Variants | `dark:` and `coarse:` (a finger, not a mouse) beside Tailwind's own |
|
|
67
76
|
|
|
68
77
|
The full list is
|
|
69
|
-
[
|
|
78
|
+
[packages/runner/src/theme.css](https://github.com/engenty/wizards/blob/main/packages/runner/src/theme.css):
|
|
79
|
+
the studio and a wizard's run page share it.
|
|
70
80
|
|
|
71
81
|
## Rules
|
|
72
82
|
|
|
@@ -81,9 +91,9 @@ The full list is
|
|
|
81
91
|
|
|
82
92
|
`client.css` is built so that it cannot change how the studio looks:
|
|
83
93
|
|
|
84
|
-
- Every rule applies only inside what the plugin draws. The studio wraps each page
|
|
85
|
-
|
|
86
|
-
below that.
|
|
94
|
+
- Every rule applies only inside what the plugin draws. The studio wraps each page, section,
|
|
95
|
+
app bar icon, part of the share dialog and assistant card of a plugin in an element with
|
|
96
|
+
`data-plugin="<id>"`, and every rule of `client.css` is nested below that.
|
|
87
97
|
- The rules sit in a layer above the studio's utilities, so inside the plugin's part the
|
|
88
98
|
plugin's stylesheet decides.
|
|
89
99
|
- The theme is used by reference: `client.css` carries the names' uses, none of the variables
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Tables
|
|
3
3
|
description: A plugin's own tables in every tenant's database — SQL files that run once, and Drizzle to read and write.
|
|
4
|
+
version: 0.2.56
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
Every tenant has a database of its own (libSQL, the SQLite dialect). A plugin's tables are made
|
|
@@ -65,8 +66,8 @@ await db()
|
|
|
65
66
|
await db().delete(person).where(eq(person.id, id));
|
|
66
67
|
```
|
|
67
68
|
|
|
68
|
-
Call `getTenantDb()` inside the handler, the tool or the
|
|
69
|
-
tenant.
|
|
69
|
+
Call `getTenantDb()` inside the handler, the tool, the listener or the job. Outside of them
|
|
70
|
+
there is no tenant.
|
|
70
71
|
|
|
71
72
|
## How the files run
|
|
72
73
|
|
|
@@ -78,8 +79,9 @@ tenant.
|
|
|
78
79
|
| When | A database gets the files when it opens. The open ones get them when the plugin loads, also when it loads again with a new file |
|
|
79
80
|
| Never back | Nothing is taken back. Unloading or removing a plugin leaves its tables and rows |
|
|
80
81
|
|
|
81
|
-
A file that fails is logged with the plugin's id and the file's name, and the files after it
|
|
82
|
-
wait for that database until it is mended. The tenant's database
|
|
82
|
+
A file that fails is logged with the plugin's id and the file's name, and the files after it,
|
|
83
|
+
other plugins' included, wait for that database until it is mended. The tenant's database
|
|
84
|
+
still opens.
|
|
83
85
|
|
|
84
86
|
## Rules
|
|
85
87
|
|