@engenty/wizards-runtime 0.11.4 → 0.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/runtime/dist/agents/architect.js +6 -7
- package/apps/runtime/dist/agents/chat-clients.js +3 -0
- package/apps/runtime/dist/agents/studio-assistant.js +26 -7
- package/apps/runtime/dist/agents/subscription.js +24 -11
- package/apps/runtime/dist/assistant/knows.js +1 -1
- package/apps/runtime/dist/auth/index.js +15 -2
- package/apps/runtime/dist/authoring/guide.js +2 -8
- package/apps/runtime/dist/credits/estimate.js +1 -1
- package/apps/runtime/dist/data/chat-models.json +116 -0
- package/apps/runtime/dist/db/migrations/tenant/0025_drop_mcp_servers.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0025_snapshot.json +3959 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +7 -0
- package/apps/runtime/dist/db/schema.js +0 -4
- package/apps/runtime/dist/docs/dev/plugins/events.md +2 -2
- package/apps/runtime/dist/docs/dev/wizard-format/agent-steps.md +1 -2
- package/apps/runtime/dist/docs/dev/wizard-format/wizard-file.md +6 -8
- package/apps/runtime/dist/docs/user-guide/cloud-sync.md +2 -2
- package/apps/runtime/dist/docs/user-guide/connectors.md +1 -10
- package/apps/runtime/dist/docs/user-guide/models.md +15 -5
- package/apps/runtime/dist/docs/user-guide/steps.md +2 -3
- package/apps/runtime/dist/engine/steps.js +126 -131
- package/apps/runtime/dist/env.js +5 -0
- package/apps/runtime/dist/live/views.js +1 -3
- package/apps/runtime/dist/mcp/tools.js +1 -1
- package/apps/runtime/dist/models.js +8 -9
- package/apps/runtime/dist/routes/studio.js +39 -6
- package/apps/runtime/dist/services/architect.js +5 -5
- package/apps/runtime/dist/services/chat-models.js +58 -0
- package/apps/runtime/dist/services/package-file.js +0 -1
- package/apps/runtime/dist/services/package.js +0 -10
- package/apps/runtime/dist/services/projects.js +1 -31
- package/apps/runtime/dist/services/spaces.js +5 -23
- package/apps/runtime/dist/services/wizards.js +8 -0
- package/apps/runtime/dist/sync/records.js +0 -9
- package/apps/runtime/dist/tools/index.js +0 -28
- package/apps/web/dist/assets/{AboutDialog-B7ThTqw4.js → AboutDialog-30Mc1_N_.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-DBpXTjxr.js → ChangelogDialog-Vjxg6JV8.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-BTcAUlGY.js → CodeEditor-CmMRfVhS.js} +1 -1
- package/apps/web/dist/assets/EditorPage-Di5KB-Ei.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-Sjnlj0OO.js → FlowPreview-BkcO3iCf.js} +1 -1
- package/apps/web/dist/assets/{Harness-BKl73EG5.js → Harness-D_Hr80Fo.js} +1 -1
- package/apps/web/dist/assets/Marketplace-BxFBMUsi.js +2 -0
- package/apps/web/dist/assets/{NewWizardChannels-DarxdQRt.js → NewWizardChannels-BIzOtfc8.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-BCoPZjp5.js → NewWizardPage-BenzMrPD.js} +1 -1
- package/apps/web/dist/assets/{OnboardingPage-qV_YA_mZ.js → OnboardingPage-DuckyzQr.js} +1 -1
- package/apps/web/dist/assets/{PreviewPane-B5_GY6Cv.js → PreviewPane-D9hmriSm.js} +2 -2
- package/apps/web/dist/assets/{ProjectPage-Bcc81_KO.js → ProjectPage-A8Z8cS1E.js} +1 -1
- package/apps/web/dist/assets/{PublicRunner-hlxaESAv.js → PublicRunner-QPvlEAxx.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly-BUnTzhA3.js → ReadOnly-DFn32cvo.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-ByP15ndy.js +2 -0
- package/apps/web/dist/assets/{SetupPage-DAgnVxDA.js → SetupPage-WNHH74hu.js} +1 -1
- package/apps/web/dist/assets/{SharePage-aKBNZDby.js → SharePage-Bw4TRWtv.js} +1 -1
- package/apps/web/dist/assets/changelog-Dr9tAFY9.js +1 -0
- package/apps/web/dist/assets/{coins-C8RAtYAu.js → coins-DTH3SKgZ.js} +1 -1
- package/apps/web/dist/assets/i18n-CLxuuhp_.js +55 -0
- package/apps/web/dist/assets/index-Bha72INy.css +1 -0
- package/apps/web/dist/assets/index-HhslPV6N.js +34 -0
- package/apps/web/dist/assets/oss-credits-CZT1KRIp.js +1 -0
- package/apps/web/dist/assets/{phone-DTuPPVhC.js → phone-DymZ7rLO.js} +1 -1
- package/apps/web/dist/assets/{runners-BcK_yEKU.js → runners-UfKeoOe4.js} +1 -1
- package/apps/web/dist/assets/{session-C7ciCzbV.js → session-COf_im0l.js} +1 -1
- package/apps/web/dist/assets/{settings-menu-b7am2SP5.js → settings-menu-mtOjI15L.js} +1 -1
- package/apps/web/dist/assets/{theme-BOAjs_xb.js → theme-DWoTWDAG.js} +1 -1
- package/apps/web/dist/assets/{ui-DKK_O65k.js → ui-D_0Xdrjh.js} +2 -2
- package/apps/web/dist/assets/{upload-Cbcw8l_0.js → upload-BizIzwxa.js} +1 -1
- package/apps/web/dist/assets/{useMutation-D8Bpwvs1.js → useMutation-BJfRETsQ.js} +1 -1
- package/apps/web/dist/assets/{volume-2-CgRP_A7r.js → volume-2-BGkyA8T9.js} +1 -1
- package/apps/web/dist/assets/{wrench-me5bf7bd.js → wrench-Be5zav03.js} +1 -1
- package/apps/web/dist/index.html +9 -9
- package/apps/web/dist/mcp/flow.html +3 -3
- package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +1 -0
- package/node_modules/@engenty/wizards-shared/dist/assistant.js +2 -0
- package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +0 -4
- package/node_modules/@engenty/wizards-shared/dist/definition.js +0 -3
- package/node_modules/@engenty/wizards-shared/dist/fit.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/fit.js +0 -4
- package/node_modules/@engenty/wizards-shared/dist/marketplace.js +2 -2
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +1 -2
- package/node_modules/@engenty/wizards-shared/dist/run.js +2 -4
- package/node_modules/@engenty/wizards-shared/dist/wizard-package.d.ts +0 -4
- package/node_modules/@engenty/wizards-shared/dist/wizard-package.js +0 -5
- package/package.json +1 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/web/dist/assets/EditorPage-B_cFXR-B.js +0 -3
- package/apps/web/dist/assets/Marketplace-BNu-Hjzu.js +0 -2
- package/apps/web/dist/assets/SettingsPage-BoA-ykQU.js +0 -2
- package/apps/web/dist/assets/changelog-DwJOKc4z.js +0 -1
- package/apps/web/dist/assets/i18n-Bq6dt_qv.js +0 -55
- package/apps/web/dist/assets/index-BdwA-8jc.js +0 -34
- package/apps/web/dist/assets/index-DQc1EITf.css +0 -1
- package/apps/web/dist/assets/oss-credits-C6bPkfSE.js +0 -1
|
@@ -13,10 +13,6 @@ export const project = sqliteTable("project", {
|
|
|
13
13
|
themes: text("themes", { mode: "json" }).$type().notNull().default([]),
|
|
14
14
|
/** The space's public page at `<organization>.wizards.page/<slug>`; null until it is set up. */
|
|
15
15
|
page: text("page", { mode: "json" }).$type(),
|
|
16
|
-
mcpServers: text("mcp_servers", { mode: "json" })
|
|
17
|
-
.$type()
|
|
18
|
-
.notNull()
|
|
19
|
-
.default([]),
|
|
20
16
|
/**
|
|
21
17
|
* `local`: the project of a local install, synced here when that install publishes. It keeps
|
|
22
18
|
* the ids it has there and is changed only by the next sync. Null: made on this runtime.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Events
|
|
3
3
|
description: Do something when a run ends or a space changes – keep who it was, post a message, read a new document.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.11.3
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
A plugin can listen to runs that reach their end, and to spaces that change.
|
|
@@ -36,7 +36,7 @@ server.on("run.done", async ({ run, wizard, values }) => {
|
|
|
36
36
|
| Event | A space | Gets |
|
|
37
37
|
|---|---|---|
|
|
38
38
|
| `space.created` | was made here, or arrived from engenty wizards on someone’s computer | `{ space: { id } }` |
|
|
39
|
-
| `space.updated` | changed its name, its brand (Info and Brand)
|
|
39
|
+
| `space.updated` | changed its name, its brand (Info and Brand) or its facts, or arrived again from a computer | `{ space: { id } }` |
|
|
40
40
|
| `space.deleted` | was deleted | `{ space: { id } }` |
|
|
41
41
|
| `space.file.ready` | has a file that was read: a document is in the index now | `{ space: { id }, file: { id, name, kind, mime } }` |
|
|
42
42
|
| `space.file.removed` | lost a file | `{ space: { id }, file: { id, name, kind, mime } }` |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Agent steps
|
|
3
3
|
description: An AI step's instructions, tools, output, model class, decisions, and one run per entry.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.11.3
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
An `agent` step is an AI step. It reads its `instructions`, may call tools, and returns its
|
|
@@ -26,7 +26,6 @@ output.
|
|
|
26
26
|
| Key | What the step may use |
|
|
27
27
|
|---|---|
|
|
28
28
|
| `tools` | Built-in tools: `web_search`, `web_fetch`, `browser`, `sandbox`, `image`, `http`, `pages`, `code`. A plugin’s tool by its full id, `<plugin>.<tool>` |
|
|
29
|
-
| `mcp` | Ids of the space’s connected systems (MCP servers) |
|
|
30
29
|
| `connections` | Ids of the wizard’s connections. See [Lists and connections](./lists-and-connections.md) |
|
|
31
30
|
|
|
32
31
|
A wizard that names a plugin’s tool runs only where that plugin is installed. See
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: The .wizard file
|
|
3
3
|
description: The zip a wizard travels in, its folders and manifest, how to make one by hand, and what the import does with it.
|
|
4
|
-
version: 0.11.
|
|
4
|
+
version: 0.11.3
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
A `.wizard` file is a zip with the wizard’s definition and its workspace. The studio exports
|
|
@@ -67,7 +67,6 @@ A path starts with a letter, a digit, `_` or `-`. So hidden files such as `.env`
|
|
|
67
67
|
"connectors": [
|
|
68
68
|
{ "id": "billomat", "name": "Billomat", "domain": "billomat.com", "sourceKind": "openapi" }
|
|
69
69
|
],
|
|
70
|
-
"mcpServers": [{ "id": "notion", "name": "Notion" }],
|
|
71
70
|
"themes": [{ "id": "invoice-calm", "name": "Invoice, calm", "colors": [ … ] }],
|
|
72
71
|
"knowledge": { "pages": 12, "truncated": false }
|
|
73
72
|
}
|
|
@@ -81,12 +80,11 @@ A path starts with a letter, a digit, `_` or `-`. So hidden files such as `.env`
|
|
|
81
80
|
| `exportedAt` | When the file was made |
|
|
82
81
|
| `definition` | The wizard. See [The wizard format](./index.md) |
|
|
83
82
|
| `connectors` | Imported connectors the wizard’s connections name: `id`, `name`, `domain` and `sourceKind` (`openapi` or `mcp`), at most 50 |
|
|
84
|
-
| `mcpServers` | The space’s connected systems its agent steps name: `id` and `name`, at most 10 |
|
|
85
83
|
| `themes` | The space’s themes the definition names, in full, at most 8. See [Themes](./themes.md#in-a-wizard-file) |
|
|
86
84
|
| `knowledge` | Only with Knowledge: how many pages, and whether the cap left some out |
|
|
87
85
|
|
|
88
|
-
`connectors`
|
|
89
|
-
|
|
86
|
+
`connectors` holds names, never addresses, headers or credentials. It lets the import tell you
|
|
87
|
+
what the space you import into still needs.
|
|
90
88
|
|
|
91
89
|
## Knowledge
|
|
92
90
|
|
|
@@ -113,7 +111,7 @@ A `.wizard` file holds the wizard, not what it collected or what the space owns:
|
|
|
113
111
|
- runs, results and uploads
|
|
114
112
|
- the rows of its lists and the accounts people connected
|
|
115
113
|
- the space’s brand, facts and Knowledge, unless Knowledge was asked for
|
|
116
|
-
- the addresses and credentials of connectors
|
|
114
|
+
- the addresses and credentials of connectors
|
|
117
115
|
- translations and the wizard’s published versions
|
|
118
116
|
|
|
119
117
|
The studio’s export holds the draft. The website package and the export over the API hold the
|
|
@@ -142,8 +140,8 @@ file without `"format": "engenty-wizard"` is read as a definition.
|
|
|
142
140
|
1. It checks the zip against the limits before it unpacks anything.
|
|
143
141
|
2. It checks the definition and that every path it names is in the workspace.
|
|
144
142
|
3. It makes a new wizard in the space: a draft, not published, with the workspace’s files.
|
|
145
|
-
4. It tells you which connectors
|
|
143
|
+
4. It tells you which connectors the space still lacks.
|
|
146
144
|
|
|
147
145
|
What belongs to the space is checked only here, because only the space has it: its connectors
|
|
148
|
-
and their actions
|
|
146
|
+
and their actions and its plugins’ tools. A manifest of a newer version
|
|
149
147
|
is refused, with a note that the file comes from a newer version of engenty wizards.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Spaces in the cloud
|
|
3
3
|
description: How engenty wizards on your computer keeps its spaces the same as your organization’s spaces at engenty.ai, both ways, and what happens when both sides change the same thing.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.11.3
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
With an account signed in, engenty wizards on your computer keeps its spaces the same as your
|
|
@@ -21,7 +21,7 @@ work in another one, sign in again and pick it (Settings → Account, or
|
|
|
21
21
|
| Wizards: the draft, its files, translations and the chat you built it with | Chats with the studio’s assistant |
|
|
22
22
|
| Knowledge: pages, tables and their rows, categories | What wizards keep for people: their lists, files and sign-ins |
|
|
23
23
|
| The space’s files | Connected accounts and keys |
|
|
24
|
-
| Connectors | The model settings
|
|
24
|
+
| Connectors | The model settings |
|
|
25
25
|
|
|
26
26
|
Publishing on your computer publishes the wizard here, then in the cloud, as its next version
|
|
27
27
|
there. Its address at engenty.ai stays the same. If the cloud can’t be reached, the studio
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Connectors
|
|
3
3
|
description: Services a wizard works in for the person who runs it – built in, from the registry or over MCP.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.11.3
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
Settings → Connectors lists the services the space’s wizards can work in. A wizard uses a connector
|
|
@@ -79,12 +79,3 @@ attachments. It never writes. The person chooses how to connect:
|
|
|
79
79
|
| Any mailbox over IMAP | Nothing |
|
|
80
80
|
| “Gmail” button | The Google client, with the Gmail API enabled and the scope `gmail.readonly`. On your computer without one, your engenty account |
|
|
81
81
|
| “Outlook” button | The Microsoft client, with the delegated permission `Mail.Read` |
|
|
82
|
-
|
|
83
|
-
## Connected systems
|
|
84
|
-
|
|
85
|
-
This section also holds “Connected systems”: MCP servers of your own, each with a name, its MCP
|
|
86
|
-
URL and, if the server wants one, an authorization header. AI steps read from and write to these
|
|
87
|
-
systems only where you allow the server on the step.
|
|
88
|
-
|
|
89
|
-
This is the other direction of [AI apps](./ai-apps.md): here engenty calls other servers, there
|
|
90
|
-
your AI app calls engenty.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Models and account
|
|
3
3
|
description: What runs the AI in your wizards – an AI client on your computer, your own API keys, a local model or credits.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.11.1
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
Settings → Models decides what runs the AI in your wizards. On your computer you set it up
|
|
@@ -127,11 +127,21 @@ images, video, voice and voice notes.
|
|
|
127
127
|
|---|---|
|
|
128
128
|
| Your subscription: Claude Code, Codex, Cursor Agent | The program on this computer answers, using your sign-in there. It works only through the tools of engenty wizards: it runs no commands and changes no files of its own |
|
|
129
129
|
| Your own API key: OpenAI, Anthropic, Google Gemini, Vercel AI Gateway | A model of that provider answers, on your key |
|
|
130
|
-
|
|
|
131
|
-
| engenty credits | The credits pay, through your account |
|
|
130
|
+
| engenty credits | The credits pay, through your account. engenty picks the models |
|
|
132
131
|
|
|
133
|
-
The list shows each program that is installed and signed in. Without a choice,
|
|
134
|
-
|
|
132
|
+
The list shows each program that is installed and signed in. Without a choice, Claude Code answers
|
|
133
|
+
where it is the source of your models, else the first way that is ready. With none ready, the chat
|
|
134
|
+
says what to set up. The chat has its own models, apart from Text & reasoning.
|
|
135
|
+
|
|
136
|
+
Under the choice, **Model** is what answers everyday questions and **Extra effort** is the more
|
|
137
|
+
capable one. Both default to the newest model of the way, which the runtime asks the server for
|
|
138
|
+
every day, so a new model needs no update. Pick another from the list, or **Another model …** to
|
|
139
|
+
type any name.
|
|
140
|
+
|
|
141
|
+
In a message box’s **+** menu, **Extra effort** switches the chat to the more capable model for the
|
|
142
|
+
conversation. The editor chat starts with it on, Goose with it off. When Goose sees demanding work,
|
|
143
|
+
it offers a button under its answer. In the cloud, the organization’s credits pay and engenty picks
|
|
144
|
+
the models.
|
|
135
145
|
|
|
136
146
|
## Account
|
|
137
147
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Steps
|
|
3
3
|
description: What a wizard is made of – pages, AI steps, generated media, widgets, reviews and the result.
|
|
4
|
-
version: 0.11.
|
|
4
|
+
version: 0.11.3
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
A wizard runs its steps from top to bottom. The last step is always the result.
|
|
@@ -80,12 +80,11 @@ PDFs, scans and photos, Word, Excel, CSV and saved mails. Where the space has Kn
|
|
|
80
80
|
searches it too. Every AI step also knows the space’s Info and Brand: its title, what it says
|
|
81
81
|
about itself, its facts and colours.
|
|
82
82
|
|
|
83
|
-
Further tools come from
|
|
83
|
+
Further tools come from two places:
|
|
84
84
|
|
|
85
85
|
- **The person’s accounts**: connectors the wizard uses, where the person connects their own
|
|
86
86
|
account during the run. The step gets the service’s actions as tools. Reading is free; before
|
|
87
87
|
anything changes in the person’s account, they are asked. See [Connectors](./connectors.md).
|
|
88
|
-
- **Connected systems** (MCP servers) of the space, where you allow them on the step.
|
|
89
88
|
- **Plugins** installed in engenty wizards. See [Plugins](./plugins.md).
|
|
90
89
|
|
|
91
90
|
### Model class
|
|
@@ -483,143 +483,138 @@ export async function runAgentStep(step, ctx) {
|
|
|
483
483
|
}
|
|
484
484
|
const resolved = await textModel(step.model ?? "standard", { ...ctx.call, effort: step.effort });
|
|
485
485
|
const uploads = await personUploads(ctx);
|
|
486
|
-
const { tools, assets, instructions
|
|
486
|
+
const { tools, assets, instructions } = await buildStepTools(step, ctx, resolved, uploads);
|
|
487
487
|
// A step without tools of its own and without uploads: the run's device may answer it alone.
|
|
488
488
|
attachTools(resolved, tools, step.tools.length === 0 && uploads.length === 0);
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
:
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
photos
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
others
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
489
|
+
const photos = await seenPhotos(step, ctx, resolved, uploads);
|
|
490
|
+
const others = uploads.filter((u) => !photos.some((p) => p.upload === u));
|
|
491
|
+
const formatHint = step.output.format === "markdown"
|
|
492
|
+
? "Answer with the finished result in clean Markdown — no preamble, no closing remarks."
|
|
493
|
+
: step.output.format === "text"
|
|
494
|
+
? "Answer with the finished result as plain text — no Markdown, no preamble."
|
|
495
|
+
: [
|
|
496
|
+
"Finish with everything the result needs in your final answer, ending with one ```json block in exactly this shape (keys as named, lists as lists):",
|
|
497
|
+
shapeLines(outputSchema(step).shape).join("\n"),
|
|
498
|
+
'Write the parts in this order, each entry complete before the next. Its values are read on a phone: short names without hedges (doubt goes into its own field, "ca. 1 Becher"), only the values a field allows, no filler entries ("if needed").',
|
|
499
|
+
].join("\n");
|
|
500
|
+
const system = [
|
|
501
|
+
groundRules(ctx),
|
|
502
|
+
step.tools.includes("browser") ? BROWSER_RULES : "",
|
|
503
|
+
instructions ?? "",
|
|
504
|
+
`Today is ${today(ctx)}.`,
|
|
505
|
+
brandBlock(ctx),
|
|
506
|
+
// Knowledge: what the space holds for its wizards, and how to find and read it.
|
|
507
|
+
await knowledgeBlock(ctx.project.id),
|
|
508
|
+
// What the space's plugins hold for its wizards: a wiki, questions and answers.
|
|
509
|
+
...(await spaceContextOf(ctx)).blocks,
|
|
510
|
+
formatHint,
|
|
511
|
+
]
|
|
512
|
+
.filter(Boolean)
|
|
513
|
+
.join("\n\n");
|
|
514
|
+
const prompt = [
|
|
515
|
+
`# TASK\n${renderTemplate(step.instructions, ctx.scope)}`,
|
|
516
|
+
`# THE PERSON'S ANSWERS (data)\n${answersAsText(ctx.scope) || "(none)"}`,
|
|
517
|
+
photos.length
|
|
518
|
+
? `# PHOTOS THE PERSON GAVE\nThey are attached to this message, in this order — look at them yourself, do not call read_document for them.\n${photos
|
|
519
|
+
.map((p, i) => `${i + 1}. ${p.upload.ref} — ${p.upload.name}, from "${p.upload.field}"`)
|
|
520
|
+
.join("\n")}`
|
|
521
|
+
: "",
|
|
522
|
+
others.length
|
|
523
|
+
? `# FILES THE PERSON GAVE\nRead them with read_document or scan_documents.\n${others
|
|
524
|
+
.map((u) => `- ${u.ref} — ${u.name} (${u.mime}), from "${u.field}"`)
|
|
525
|
+
.join("\n")}`
|
|
526
|
+
: "",
|
|
527
|
+
await revisionBlock(ctx, step.id),
|
|
528
|
+
]
|
|
529
|
+
.filter(Boolean)
|
|
530
|
+
.join("\n\n");
|
|
531
|
+
// A decision needs no agent: its questions go to the classifier class in one call.
|
|
532
|
+
if (isDecisionStep(step) && uploads.length === 0) {
|
|
533
|
+
return decideStep(step, prompt, ctx);
|
|
534
|
+
}
|
|
535
|
+
const agent = new Agent({
|
|
536
|
+
id: `step-${step.id}`,
|
|
537
|
+
name: step.title,
|
|
538
|
+
instructions: system,
|
|
539
|
+
model: agentModel(resolved),
|
|
540
|
+
tools,
|
|
541
|
+
});
|
|
542
|
+
// Working through a mailbox or a row of portals takes many small tool calls.
|
|
543
|
+
const maxSteps = step.tools.includes("browser") || step.connections?.length ? 60 : 20;
|
|
544
|
+
for (const [i, photo] of photos.entries()) {
|
|
545
|
+
await ctx.emit("info", { code: "photo", params: { n: i + 1, total: photos.length } }, photo.id);
|
|
546
|
+
}
|
|
547
|
+
const message = photos.length
|
|
548
|
+
? [
|
|
549
|
+
{
|
|
550
|
+
role: "user",
|
|
551
|
+
content: [
|
|
552
|
+
{ type: "text", text: prompt },
|
|
553
|
+
...photos.map((p) => ({
|
|
554
|
+
type: "file",
|
|
555
|
+
data: p.data,
|
|
556
|
+
mediaType: p.mime,
|
|
557
|
+
filename: p.upload.name,
|
|
558
|
+
})),
|
|
559
|
+
],
|
|
560
|
+
},
|
|
529
561
|
]
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
562
|
+
: prompt;
|
|
563
|
+
// A json step streams, so the person sees its entries as they are written (`found`).
|
|
564
|
+
const result = step.output.format === "json"
|
|
565
|
+
? await streamWithProgress(agent, message, { maxSteps, abortSignal: ctx.signal }, step, ctx)
|
|
566
|
+
: await agent.generate(message, { maxSteps, abortSignal: ctx.signal });
|
|
567
|
+
await ctx.chargeUsd(costOf(resolved, await totalUsage(result)));
|
|
568
|
+
// `result.text` strings together what the model said between tool calls ("I open the page …").
|
|
569
|
+
// A written result is its last message; structuring keeps everything, numbers may sit anywhere.
|
|
570
|
+
const closing = String(result.steps?.at?.(-1)?.text ?? "").trim();
|
|
571
|
+
const everything = (result.text ?? "").trim();
|
|
572
|
+
const text = step.output.format === "json" ? everything : closing || everything;
|
|
573
|
+
if (step.output.format !== "json") {
|
|
574
|
+
if (!text && !assets.length) {
|
|
575
|
+
throw new StepError(runNote("stepNotReturnResult"));
|
|
535
576
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
data: p.data,
|
|
557
|
-
mediaType: p.mime,
|
|
558
|
-
filename: p.upload.name,
|
|
559
|
-
})),
|
|
560
|
-
],
|
|
561
|
-
},
|
|
562
|
-
]
|
|
563
|
-
: prompt;
|
|
564
|
-
// A json step streams, so the person sees its entries as they are written (`found`).
|
|
565
|
-
const result = step.output.format === "json"
|
|
566
|
-
? await streamWithProgress(agent, message, { maxSteps, abortSignal: ctx.signal }, step, ctx)
|
|
567
|
-
: await agent.generate(message, { maxSteps, abortSignal: ctx.signal });
|
|
568
|
-
await ctx.chargeUsd(costOf(resolved, await totalUsage(result)));
|
|
569
|
-
// `result.text` strings together what the model said between tool calls ("I open the page …").
|
|
570
|
-
// A written result is its last message; structuring keeps everything, numbers may sit anywhere.
|
|
571
|
-
const closing = String(result.steps?.at?.(-1)?.text ?? "").trim();
|
|
572
|
-
const everything = (result.text ?? "").trim();
|
|
573
|
-
const text = step.output.format === "json" ? everything : closing || everything;
|
|
574
|
-
if (step.output.format !== "json") {
|
|
575
|
-
if (!text && !assets.length) {
|
|
576
|
-
throw new StepError(runNote("stepNotReturnResult"));
|
|
577
|
-
}
|
|
578
|
-
return { text, assets: assets.length ? assets : undefined, at: new Date().toISOString() };
|
|
579
|
-
}
|
|
580
|
-
const { schema, shape } = outputSchema(step);
|
|
581
|
-
// The agent mostly writes the JSON itself; a second model only structures what does not fit.
|
|
582
|
-
// Having it copy kilobytes of JSON again is slow and can fail on its own.
|
|
583
|
-
let output = ownJson(text, schema, shape);
|
|
584
|
-
if (!output) {
|
|
585
|
-
const structurer = await textModel("classifier", ctx.call);
|
|
586
|
-
const structured = await generateText({
|
|
587
|
-
model: structurer.model,
|
|
588
|
-
abortSignal: ctx.signal,
|
|
589
|
-
// The JSON Schema built from the shape, strict: every key required, no other keys.
|
|
590
|
-
output: Output.object({
|
|
591
|
-
schema: jsonSchema(shapeJsonSchema(shape), {
|
|
592
|
-
validate: (value) => {
|
|
593
|
-
const parsed = schema.safeParse(value);
|
|
594
|
-
return parsed.success
|
|
595
|
-
? { success: true, value: parsed.data }
|
|
596
|
-
: { success: false, error: parsed.error };
|
|
597
|
-
},
|
|
598
|
-
}),
|
|
577
|
+
return { text, assets: assets.length ? assets : undefined, at: new Date().toISOString() };
|
|
578
|
+
}
|
|
579
|
+
const { schema, shape } = outputSchema(step);
|
|
580
|
+
// The agent mostly writes the JSON itself; a second model only structures what does not fit.
|
|
581
|
+
// Having it copy kilobytes of JSON again is slow and can fail on its own.
|
|
582
|
+
let output = ownJson(text, schema, shape);
|
|
583
|
+
if (!output) {
|
|
584
|
+
const structurer = await textModel("classifier", ctx.call);
|
|
585
|
+
const structured = await generateText({
|
|
586
|
+
model: structurer.model,
|
|
587
|
+
abortSignal: ctx.signal,
|
|
588
|
+
// The JSON Schema built from the shape, strict: every key required, no other keys.
|
|
589
|
+
output: Output.object({
|
|
590
|
+
schema: jsonSchema(shapeJsonSchema(shape), {
|
|
591
|
+
validate: (value) => {
|
|
592
|
+
const parsed = schema.safeParse(value);
|
|
593
|
+
return parsed.success
|
|
594
|
+
? { success: true, value: parsed.data }
|
|
595
|
+
: { success: false, error: parsed.error };
|
|
596
|
+
},
|
|
599
597
|
}),
|
|
600
|
-
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
const json = recordsOf(shape, output);
|
|
606
|
-
// A view written once is bound to this run's data; `true` asks a model for one.
|
|
607
|
-
const surface = Array.isArray(step.output.surface)
|
|
608
|
-
? { components: step.output.surface, data: json }
|
|
609
|
-
: step.output.surface
|
|
610
|
-
? await composeSurface(step, json, ctx)
|
|
611
|
-
: undefined;
|
|
612
|
-
return {
|
|
613
|
-
text,
|
|
614
|
-
json,
|
|
615
|
-
...(surface ? { surface } : {}),
|
|
616
|
-
assets: assets.length ? assets : undefined,
|
|
617
|
-
at: new Date().toISOString(),
|
|
618
|
-
};
|
|
619
|
-
}
|
|
620
|
-
finally {
|
|
621
|
-
await close();
|
|
598
|
+
}),
|
|
599
|
+
prompt: `Turn this result into the requested structure. Keep every number and source exactly.\n\n${text}`,
|
|
600
|
+
});
|
|
601
|
+
await ctx.chargeUsd(costOf(structurer, structured.usage));
|
|
602
|
+
output = structured.output;
|
|
622
603
|
}
|
|
604
|
+
const json = recordsOf(shape, output);
|
|
605
|
+
// A view written once is bound to this run's data; `true` asks a model for one.
|
|
606
|
+
const surface = Array.isArray(step.output.surface)
|
|
607
|
+
? { components: step.output.surface, data: json }
|
|
608
|
+
: step.output.surface
|
|
609
|
+
? await composeSurface(step, json, ctx)
|
|
610
|
+
: undefined;
|
|
611
|
+
return {
|
|
612
|
+
text,
|
|
613
|
+
json,
|
|
614
|
+
...(surface ? { surface } : {}),
|
|
615
|
+
assets: assets.length ? assets : undefined,
|
|
616
|
+
at: new Date().toISOString(),
|
|
617
|
+
};
|
|
623
618
|
}
|
|
624
619
|
// --- generate ----------------------------------------------------------------
|
|
625
620
|
/** The images a name stands for: an image field's uploads, or the images an earlier step made. */
|
package/apps/runtime/dist/env.js
CHANGED
|
@@ -145,6 +145,11 @@ export const env = {
|
|
|
145
145
|
* The marketplace (docs/marketplace-contract.md): searched live, its starters and what people
|
|
146
146
|
* starred kept for offline use. `off` = none.
|
|
147
147
|
*/
|
|
148
|
+
/**
|
|
149
|
+
* Where the models of the studio's chats come from (services/chat-models.ts): a JSON the server
|
|
150
|
+
* keeps up to date, asked daily. Empty: only the file in the repository.
|
|
151
|
+
*/
|
|
152
|
+
chatModelsUrl: str("CHAT_MODELS_URL", "https://engenty.ai/chat-models.json").replace(/^off$/, ""),
|
|
148
153
|
marketplace: {
|
|
149
154
|
url: str("MARKETPLACE_URL", "https://engenty.ai/wizards")
|
|
150
155
|
.replace(/^off$/, "")
|
|
@@ -9,7 +9,7 @@ import { cloudLinked, cloudState } from "../services/cloud.js";
|
|
|
9
9
|
import { ServiceError } from "../services/errors.js";
|
|
10
10
|
import { presentIn } from "../services/presence.js";
|
|
11
11
|
import { fileView, projectFiles } from "../services/project-files.js";
|
|
12
|
-
import { listProjects,
|
|
12
|
+
import { listProjects, ownedProject } from "../services/projects.js";
|
|
13
13
|
import { getPage, getRow, getTableHeader } from "../services/space-data.js";
|
|
14
14
|
import { publishedDefinition, translationsOf } from "../services/translations.js";
|
|
15
15
|
import { listWizards, ownedWizard, wizardMessages, wizardState } from "../services/wizards.js";
|
|
@@ -24,7 +24,6 @@ export async function spacesView(r) {
|
|
|
24
24
|
facts: p.facts,
|
|
25
25
|
/** The space's public page; null until it is set up. */
|
|
26
26
|
page: p.page ?? null,
|
|
27
|
-
mcpServers: maskedServers(p),
|
|
28
27
|
wizardCount: p.wizardCount,
|
|
29
28
|
/** `local`: synced from a local install, where it is changed. */
|
|
30
29
|
origin: p.origin,
|
|
@@ -58,7 +57,6 @@ export async function wizardView(r, id) {
|
|
|
58
57
|
source: m.source,
|
|
59
58
|
client: m.client,
|
|
60
59
|
})),
|
|
61
|
-
mcpServers: project.mcpServers.map((s) => ({ id: s.id, name: s.name })),
|
|
62
60
|
};
|
|
63
61
|
}
|
|
64
62
|
/** The languages the published wizard is kept in, each original text with its translation. */
|
|
@@ -171,7 +171,7 @@ export function registerTools(server, who) {
|
|
|
171
171
|
const project = projectId
|
|
172
172
|
? await ownedProject(who.userId, projectId)
|
|
173
173
|
: await defaultProject(who.userId);
|
|
174
|
-
return authoringGuide(
|
|
174
|
+
return authoringGuide(await listConnectors(project.id), await pluginToolsOf(who.tenantId));
|
|
175
175
|
});
|
|
176
176
|
// --- connectors ------------------------------------------------------------
|
|
177
177
|
tool("find_connectors", "wizards:read", {
|
|
@@ -21,6 +21,7 @@ import { hasFfmpeg } from "./media/ffmpeg.js";
|
|
|
21
21
|
import { ModelUnavailableError, saidOf } from "./model-errors.js";
|
|
22
22
|
import { seal, unseal } from "./secrets/crypto.js";
|
|
23
23
|
import { vaultDelete, vaultGet, vaultSet } from "./secrets/vault.js";
|
|
24
|
+
import { chatModelId } from "./services/chat-models.js";
|
|
24
25
|
import { readSetting, writeSetting } from "./settings.js";
|
|
25
26
|
import { currentTenant, currentTenantOrNull } from "./tenants/tenant.js";
|
|
26
27
|
import { serverText } from "./texts.js";
|
|
@@ -442,11 +443,11 @@ async function ownTextModel(cls, meta) {
|
|
|
442
443
|
return { model, ref: route.ref, vendor: vendorOf(route.ref), gateway, metered: false };
|
|
443
444
|
}
|
|
444
445
|
/**
|
|
445
|
-
* What answers the studio's chats, Goose and the editor's chat:
|
|
446
|
-
*
|
|
446
|
+
* What answers the studio's chats, Goose and the editor's chat: an installed client on its
|
|
447
|
+
* subscription, one provider's own key, or the credits. The chat has its own models, apart from
|
|
448
|
+
* the classes the wizards' steps run on (services/chat-models.ts).
|
|
447
449
|
*/
|
|
448
450
|
export const CHAT_WAYS = [
|
|
449
|
-
"models",
|
|
450
451
|
"claude",
|
|
451
452
|
"codex",
|
|
452
453
|
"cursor",
|
|
@@ -457,10 +458,7 @@ export const CHAT_WAYS = [
|
|
|
457
458
|
"account",
|
|
458
459
|
];
|
|
459
460
|
/** Whether a way can answer now: the client signed in, the key there, the account linked. */
|
|
460
|
-
export async function chatWayReady(way
|
|
461
|
-
if (way === "models") {
|
|
462
|
-
return textModelReady;
|
|
463
|
-
}
|
|
461
|
+
export async function chatWayReady(way) {
|
|
464
462
|
if (managed) {
|
|
465
463
|
return false;
|
|
466
464
|
}
|
|
@@ -482,13 +480,14 @@ export async function chatModel(way, cls) {
|
|
|
482
480
|
if (way === "models") {
|
|
483
481
|
return textModel(cls);
|
|
484
482
|
}
|
|
483
|
+
const effort = cls === "high" ? "extra" : "normal";
|
|
485
484
|
const cfg = await config();
|
|
486
485
|
const client = harness(way);
|
|
487
486
|
if (client) {
|
|
488
487
|
if (!(await detectHarness(client.id))?.version) {
|
|
489
488
|
throw new ModelUnavailableError(notInstalled(client));
|
|
490
489
|
}
|
|
491
|
-
const alias = client.classes[cls];
|
|
490
|
+
const alias = (await chatModelId(way, effort)) ?? client.classes[cls];
|
|
492
491
|
return {
|
|
493
492
|
model: client.model(alias),
|
|
494
493
|
ref: `${client.id}/${alias}`,
|
|
@@ -504,7 +503,7 @@ export async function chatModel(way, cls) {
|
|
|
504
503
|
}
|
|
505
504
|
return viaCredits({ kind: "credits", access, model: null }, cls, {}, (gateway, id) => gateway(id));
|
|
506
505
|
}
|
|
507
|
-
const ref = providerInfo(way)?.text?.[cls];
|
|
506
|
+
const ref = (await chatModelId(way, effort)) ?? providerInfo(way)?.text?.[cls];
|
|
508
507
|
if (!ref) {
|
|
509
508
|
throw new ModelUnavailableError(note("noModelFor", { makes: note("makesText") }));
|
|
510
509
|
}
|