@engenty/wizards-runtime 0.11.5 → 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 +3 -2
- package/apps/runtime/dist/agents/chat-clients.js +3 -0
- package/apps/runtime/dist/agents/studio-assistant.js +25 -4
- package/apps/runtime/dist/agents/subscription.js +24 -11
- package/apps/runtime/dist/auth/index.js +15 -2
- package/apps/runtime/dist/data/chat-models.json +116 -0
- package/apps/runtime/dist/docs/user-guide/models.md +15 -5
- package/apps/runtime/dist/env.js +5 -0
- 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 -4
- package/apps/runtime/dist/services/chat-models.js +58 -0
- package/apps/runtime/dist/services/wizards.js +8 -0
- package/apps/web/dist/assets/{AboutDialog-B525L37O.js → AboutDialog-30Mc1_N_.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-gInSm1Xe.js → ChangelogDialog-Vjxg6JV8.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-C0TmdCrb.js → CodeEditor-CmMRfVhS.js} +1 -1
- package/apps/web/dist/assets/{EditorPage-7t3vhZi6.js → EditorPage-Di5KB-Ei.js} +1 -1
- package/apps/web/dist/assets/{FlowPreview-BBN-APkG.js → FlowPreview-BkcO3iCf.js} +1 -1
- package/apps/web/dist/assets/{Harness-fAoC908y.js → Harness-D_Hr80Fo.js} +1 -1
- package/apps/web/dist/assets/{Marketplace-CotMMcJ-.js → Marketplace-BxFBMUsi.js} +2 -2
- package/apps/web/dist/assets/{NewWizardChannels-X32lBGMf.js → NewWizardChannels-BIzOtfc8.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-DMoqDhsh.js → NewWizardPage-BenzMrPD.js} +1 -1
- package/apps/web/dist/assets/{OnboardingPage-BjZy-bhI.js → OnboardingPage-DuckyzQr.js} +1 -1
- package/apps/web/dist/assets/{PreviewPane-Bt-ForJG.js → PreviewPane-D9hmriSm.js} +2 -2
- package/apps/web/dist/assets/{ProjectPage-B5a-nod-.js → ProjectPage-A8Z8cS1E.js} +1 -1
- package/apps/web/dist/assets/{PublicRunner-Cq_XzX54.js → PublicRunner-QPvlEAxx.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly-DX3beZJz.js → ReadOnly-DFn32cvo.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-ByP15ndy.js +2 -0
- package/apps/web/dist/assets/{SetupPage-BI9bgEkI.js → SetupPage-WNHH74hu.js} +1 -1
- package/apps/web/dist/assets/{SharePage-Ch-1oLBs.js → SharePage-Bw4TRWtv.js} +1 -1
- package/apps/web/dist/assets/changelog-Dr9tAFY9.js +1 -0
- package/apps/web/dist/assets/{coins-D_yN56kT.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/{phone-DxC6eM6O.js → phone-DymZ7rLO.js} +1 -1
- package/apps/web/dist/assets/{runners-SQHfvvNQ.js → runners-UfKeoOe4.js} +1 -1
- package/apps/web/dist/assets/{session-4CTNIlai.js → session-COf_im0l.js} +1 -1
- package/apps/web/dist/assets/{settings-menu-B0af5EBE.js → settings-menu-mtOjI15L.js} +1 -1
- package/apps/web/dist/assets/{theme-mtamawa_.js → theme-DWoTWDAG.js} +1 -1
- package/apps/web/dist/assets/{ui-CL8v8Goa.js → ui-D_0Xdrjh.js} +2 -2
- package/apps/web/dist/assets/{upload-DXJQU2lL.js → upload-BizIzwxa.js} +1 -1
- package/apps/web/dist/assets/{useMutation-DwRYrG3V.js → useMutation-BJfRETsQ.js} +1 -1
- package/apps/web/dist/assets/{volume-2-CYbbBiXP.js → volume-2-BGkyA8T9.js} +1 -1
- package/apps/web/dist/assets/{wrench-D8lG2BH7.js → wrench-Be5zav03.js} +1 -1
- package/apps/web/dist/index.html +9 -9
- package/apps/web/dist/mcp/flow.html +2 -2
- 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/run.d.ts +1 -0
- package/node_modules/@engenty/wizards-shared/dist/run.js +2 -0
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/web/dist/assets/SettingsPage-DPuwA3QL.js +0 -2
- package/apps/web/dist/assets/changelog-BlJc9UFS.js +0 -1
- package/apps/web/dist/assets/i18n-Dy3fTQM3.js +0 -55
- package/apps/web/dist/assets/index-Dt1Ps3ge.js +0 -34
- package/apps/web/dist/assets/index-rX7eCvWh.css +0 -1
|
@@ -320,8 +320,9 @@ export async function runArchitect(input) {
|
|
|
320
320
|
const w = await ownedWizard(input.userId, input.wizardId);
|
|
321
321
|
const files = await listFiles(input.userId, input.wizardId);
|
|
322
322
|
let changed = false;
|
|
323
|
-
// Building a wizard is the hardest job here: widgets are code
|
|
324
|
-
|
|
323
|
+
// Building a wizard is the hardest job here: widgets are code, so the editor chat starts on
|
|
324
|
+
// extra effort.
|
|
325
|
+
const resolved = await chatModel(input.way, input.extra === false ? "standard" : "high");
|
|
325
326
|
const tools = buildTools(input, resolved, () => {
|
|
326
327
|
changed = true;
|
|
327
328
|
});
|
|
@@ -40,6 +40,7 @@ const claude = {
|
|
|
40
40
|
"",
|
|
41
41
|
"--append-system-prompt",
|
|
42
42
|
call.system,
|
|
43
|
+
...(call.model ? ["--model", call.model] : []),
|
|
43
44
|
...(call.session ? ["--resume", call.session] : []),
|
|
44
45
|
],
|
|
45
46
|
stdin: (call) => `${JSON.stringify({
|
|
@@ -134,6 +135,7 @@ const codex = {
|
|
|
134
135
|
const options = [
|
|
135
136
|
"--json",
|
|
136
137
|
"--skip-git-repo-check",
|
|
138
|
+
...(call.model ? ["-m", call.model] : []),
|
|
137
139
|
// Only this server's tools: none of the person's own MCP servers start.
|
|
138
140
|
"--ignore-user-config",
|
|
139
141
|
"-c",
|
|
@@ -220,6 +222,7 @@ const cursor = {
|
|
|
220
222
|
"--workspace",
|
|
221
223
|
call.dir,
|
|
222
224
|
"--approve-mcps",
|
|
225
|
+
...(call.model && call.model !== "auto" ? ["--model", call.model] : []),
|
|
223
226
|
...(call.session ? ["--resume", call.session] : []),
|
|
224
227
|
],
|
|
225
228
|
stdin: (call) => call.message,
|
|
@@ -8,7 +8,7 @@ import { knowsTools } from "../assistant/knows.js";
|
|
|
8
8
|
import { PRIMER } from "../assistant/primer.js";
|
|
9
9
|
import { currentFeatures } from "../features.js";
|
|
10
10
|
import { managed } from "../manage.js";
|
|
11
|
-
import { agentModel, attachTools, chatModel, contextWindowOf, costOf, gatewayTools,
|
|
11
|
+
import { agentModel, attachTools, chatModel, contextWindowOf, costOf, gatewayTools, totalUsage, usageOf, } from "../models.js";
|
|
12
12
|
import { knowledgeCounts } from "../services/knowledge.js";
|
|
13
13
|
import { addProjectFileFromUrl, projectFileContent, projectFiles, updateProjectFile, } from "../services/project-files.js";
|
|
14
14
|
import { documentText } from "../services/project-index.js";
|
|
@@ -18,7 +18,7 @@ import { currentTenant } from "../tenants/tenant.js";
|
|
|
18
18
|
import { serverText } from "../texts.js";
|
|
19
19
|
import { assistantPageOf, assistantToolsOf } from "../tools/plugin.js";
|
|
20
20
|
import { attempt as attemptTool, imageOutput } from "../tools/shared.js";
|
|
21
|
-
import {
|
|
21
|
+
import { chatTurnWay } from "./subscription.js";
|
|
22
22
|
import { readWebsite } from "./website.js";
|
|
23
23
|
/** How a message written meanwhile reaches the model. */
|
|
24
24
|
export function signalText(taken) {
|
|
@@ -680,8 +680,8 @@ export async function runStudioAssistant(input) {
|
|
|
680
680
|
// this grew during it.
|
|
681
681
|
let changes = 0;
|
|
682
682
|
// The way the settings chose for the studio's chats: on a client, its tools reach it over MCP.
|
|
683
|
-
const way =
|
|
684
|
-
const resolved = await chatModel(way, "standard");
|
|
683
|
+
const way = await chatTurnWay(managed);
|
|
684
|
+
const resolved = await chatModel(way, input.extra ? "high" : "standard");
|
|
685
685
|
const wrote = () => {
|
|
686
686
|
changes++;
|
|
687
687
|
input.onChanged?.();
|
|
@@ -709,6 +709,27 @@ export async function runStudioAssistant(input) {
|
|
|
709
709
|
}),
|
|
710
710
|
...(space ? spaceTools(input, space, wrote, brandOn) : {}),
|
|
711
711
|
};
|
|
712
|
+
// On everyday effort the chat can offer extra effort for work that asks for more: a card with
|
|
713
|
+
// a button, while it goes on answering.
|
|
714
|
+
if (!input.extra) {
|
|
715
|
+
tools.suggest_extra_effort = createTool({
|
|
716
|
+
id: "suggest_extra_effort",
|
|
717
|
+
description: "Offers the person extra effort (a more capable model) with a button under your answer. Call it once, before you start, when the work is demanding: building or changing a wizard with many steps, writing a widget (code), a long or intricate flow, hard analysis. Never for everyday questions or small changes. Say nothing about the button yourself and go on with your answer.",
|
|
718
|
+
inputSchema: z.object({
|
|
719
|
+
reason: z
|
|
720
|
+
.string()
|
|
721
|
+
.min(3)
|
|
722
|
+
.max(160)
|
|
723
|
+
.describe("Why this work needs more, in the person's language, one short sentence."),
|
|
724
|
+
}),
|
|
725
|
+
execute: async ({ reason }) => {
|
|
726
|
+
const card = { plugin: "", tool: "extraEffort", data: { reason } };
|
|
727
|
+
cards.push(card);
|
|
728
|
+
input.onCard?.(card);
|
|
729
|
+
return { shown: true };
|
|
730
|
+
},
|
|
731
|
+
});
|
|
732
|
+
}
|
|
712
733
|
// What the tenant's plugins let the assistant do besides: a source of knowledge, say.
|
|
713
734
|
if (space) {
|
|
714
735
|
Object.assign(tools, await assistantToolsOf({
|
|
@@ -4,11 +4,14 @@ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node
|
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
import { createInterface } from "node:readline";
|
|
7
|
+
import { note } from "@engenty/wizards-shared/run";
|
|
7
8
|
import { internalKey } from "../auth/keys.js";
|
|
8
9
|
import { env } from "../env.js";
|
|
9
10
|
import { resolveEnv } from "../harness/env.js";
|
|
10
11
|
import { detectHarness, harness, signedOut } from "../harness/index.js";
|
|
11
|
-
import {
|
|
12
|
+
import { ModelUnavailableError } from "../model-errors.js";
|
|
13
|
+
import { CHAT_WAYS, chatWayReady, localModelSettings, } from "../models.js";
|
|
14
|
+
import { chatModelId } from "../services/chat-models.js";
|
|
12
15
|
import { ServiceError } from "../services/errors.js";
|
|
13
16
|
import { deleteSetting, readSetting, writeSetting } from "../settings.js";
|
|
14
17
|
import { serverText } from "../texts.js";
|
|
@@ -120,6 +123,7 @@ export async function subscriptionTurn(input) {
|
|
|
120
123
|
mcpUrl: mcpUrl(),
|
|
121
124
|
dir,
|
|
122
125
|
mcpConfigFile: input.client === "claude" ? mcpConfig() : undefined,
|
|
126
|
+
model: (await chatModelId(input.client, input.extra === false ? "normal" : "extra")) ?? undefined,
|
|
123
127
|
images,
|
|
124
128
|
};
|
|
125
129
|
const h = harness(input.client);
|
|
@@ -210,26 +214,35 @@ export async function subscriptionTurn(input) {
|
|
|
210
214
|
}
|
|
211
215
|
}
|
|
212
216
|
/** The ways that can answer the studio's chats now, in the order the settings offer them. */
|
|
213
|
-
export async function chatWays(
|
|
214
|
-
const ready = await Promise.all(CHAT_WAYS.map((w) => chatWayReady(w
|
|
217
|
+
export async function chatWays() {
|
|
218
|
+
const ready = await Promise.all(CHAT_WAYS.map((w) => chatWayReady(w)));
|
|
215
219
|
return CHAT_WAYS.filter((_, i) => ready[i]);
|
|
216
220
|
}
|
|
217
221
|
/**
|
|
218
222
|
* What answers the studio's chats, Goose and the editor's chat, on a runtime that runs alone: the
|
|
219
|
-
* way chosen while it can answer, else
|
|
223
|
+
* way chosen while it can answer, else Claude Code where it is the source of models, else the
|
|
224
|
+
* first way that is ready. Null where none is: the chat then says what to set up.
|
|
220
225
|
*/
|
|
221
|
-
export async function chatEngine(
|
|
226
|
+
export async function chatEngine() {
|
|
222
227
|
const chosen = await readSetting("chat-engine");
|
|
223
|
-
if (chosen && CHAT_WAYS.includes(chosen) && (await chatWayReady(chosen
|
|
228
|
+
if (chosen && CHAT_WAYS.includes(chosen) && (await chatWayReady(chosen))) {
|
|
224
229
|
return chosen;
|
|
225
230
|
}
|
|
226
|
-
|
|
227
|
-
// Nothing chosen: where Claude Code is the source of models, it answers the chat too.
|
|
228
|
-
if (claude && localModelSettings().source === "claude") {
|
|
231
|
+
if (localModelSettings().source === "claude" && (await chatWayReady("claude"))) {
|
|
229
232
|
return "claude";
|
|
230
233
|
}
|
|
231
|
-
|
|
232
|
-
|
|
234
|
+
return (await chatWays())[0] ?? null;
|
|
235
|
+
}
|
|
236
|
+
/** The way a turn runs on: a cloud runtime's own classes, else `chatEngine`, or a refusal naming what to set up. */
|
|
237
|
+
export async function chatTurnWay(managed) {
|
|
238
|
+
if (managed) {
|
|
239
|
+
return "models";
|
|
240
|
+
}
|
|
241
|
+
const way = await chatEngine();
|
|
242
|
+
if (!way) {
|
|
243
|
+
throw new ModelUnavailableError(note("chatNoWay"));
|
|
244
|
+
}
|
|
245
|
+
return way;
|
|
233
246
|
}
|
|
234
247
|
export function setChatEngine(way) {
|
|
235
248
|
return writeSetting("chat-engine", way);
|
|
@@ -74,6 +74,8 @@ const WISH_MAX = 600;
|
|
|
74
74
|
const STATE_COOKIE = "wz_oauth";
|
|
75
75
|
const SESSION_DAYS = 30;
|
|
76
76
|
const SCOPE = "openid profile email offline_access wizards:read wizards:write wizards:publish runs:test";
|
|
77
|
+
/** Marks the state of a sign-in started again (nanoid never makes a dot). */
|
|
78
|
+
const AGAIN = "again.";
|
|
77
79
|
// The desktop app shows a server in its window but signs in through the system browser
|
|
78
80
|
// (Google refuses embedded views). The finished session travels back as a one-time code in an
|
|
79
81
|
// `engenty-wizards://` link; it only counts in the window that asked for it, which holds the
|
|
@@ -272,7 +274,8 @@ export const authRoutes = new Hono()
|
|
|
272
274
|
const ticket = unseal(c.req.query("desktop") ?? "");
|
|
273
275
|
const state = {
|
|
274
276
|
verifier,
|
|
275
|
-
|
|
277
|
+
// A second try after a sign-in whose state stayed in another browser: marked, so it runs once.
|
|
278
|
+
nonce: c.req.query("again") === "1" ? `${AGAIN}${nanoid(16)}` : nanoid(16),
|
|
276
279
|
returnTo: safeReturn(c.req.query("return")),
|
|
277
280
|
exp: Date.now() + 15 * 60_000,
|
|
278
281
|
...(ticket && ticket.exp > Date.now() ? { desktop: ticket.desktop } : {}),
|
|
@@ -331,9 +334,19 @@ export const authRoutes = new Hono()
|
|
|
331
334
|
}
|
|
332
335
|
const state = unseal(getCookie(c, STATE_COOKIE) ?? "");
|
|
333
336
|
deleteCookie(c, STATE_COOKIE, { path: `${basePath}/api/auth` });
|
|
334
|
-
if (!code
|
|
337
|
+
if (!code) {
|
|
335
338
|
return c.redirect(`${home}?signin=failed`);
|
|
336
339
|
}
|
|
340
|
+
if (!state || state.exp < Date.now() || state.nonce !== rawState) {
|
|
341
|
+
// The sign-in began in another browser (the e-mail link opened on the phone): its state is
|
|
342
|
+
// there. The account is signed in here now, so a sign-in started here goes through without
|
|
343
|
+
// a page. Once: a second miss is a failure.
|
|
344
|
+
if (rawState.startsWith(AGAIN)) {
|
|
345
|
+
return c.redirect(`${home}?signin=failed`);
|
|
346
|
+
}
|
|
347
|
+
const again = new URLSearchParams({ again: "1", return: home });
|
|
348
|
+
return c.redirect(`${basePath}/api/auth/login?${again}`);
|
|
349
|
+
}
|
|
337
350
|
try {
|
|
338
351
|
const tokens = await tokenRequest({
|
|
339
352
|
grant_type: "authorization_code",
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"updated": "2026-10-22",
|
|
4
|
+
"ways": {
|
|
5
|
+
"claude": {
|
|
6
|
+
"normal": "sonnet",
|
|
7
|
+
"extra": "opus",
|
|
8
|
+
"models": [
|
|
9
|
+
{
|
|
10
|
+
"id": "sonnet",
|
|
11
|
+
"label": "Sonnet"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"id": "opus",
|
|
15
|
+
"label": "Opus"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "haiku",
|
|
19
|
+
"label": "Haiku"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"codex": {
|
|
24
|
+
"normal": "gpt-6.1-sol",
|
|
25
|
+
"extra": "gpt-6-astra",
|
|
26
|
+
"models": [
|
|
27
|
+
{
|
|
28
|
+
"id": "gpt-6.1-sol",
|
|
29
|
+
"label": "GPT-6.1 Sol"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "gpt-6-astra",
|
|
33
|
+
"label": "GPT-6 Astra"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"id": "gpt-6-luna",
|
|
37
|
+
"label": "GPT-6 Luna"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"cursor": {
|
|
42
|
+
"normal": "auto",
|
|
43
|
+
"extra": "auto",
|
|
44
|
+
"models": [
|
|
45
|
+
{
|
|
46
|
+
"id": "auto",
|
|
47
|
+
"label": "Auto"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"openai": {
|
|
52
|
+
"normal": "openai:gpt-5.5",
|
|
53
|
+
"extra": "openai:gpt-5.5",
|
|
54
|
+
"models": [
|
|
55
|
+
{
|
|
56
|
+
"id": "openai:gpt-5.5",
|
|
57
|
+
"label": "GPT-5.5"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"id": "openai:gpt-5.4-mini",
|
|
61
|
+
"label": "GPT-5.4 mini"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"anthropic": {
|
|
66
|
+
"normal": "anthropic:claude-sonnet-5-5",
|
|
67
|
+
"extra": "anthropic:claude-opus-5-5",
|
|
68
|
+
"models": [
|
|
69
|
+
{
|
|
70
|
+
"id": "anthropic:claude-sonnet-5-5",
|
|
71
|
+
"label": "Claude Sonnet 5.5"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"id": "anthropic:claude-opus-5-5",
|
|
75
|
+
"label": "Claude Opus 5.5"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "anthropic:claude-haiku-4-5",
|
|
79
|
+
"label": "Claude Haiku 4.5"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"google": {
|
|
84
|
+
"normal": "google:gemini-flash-latest",
|
|
85
|
+
"extra": "google:gemini-pro-latest",
|
|
86
|
+
"models": [
|
|
87
|
+
{
|
|
88
|
+
"id": "google:gemini-pro-latest",
|
|
89
|
+
"label": "Gemini Pro"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"id": "google:gemini-flash-latest",
|
|
93
|
+
"label": "Gemini Flash"
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"gateway": {
|
|
98
|
+
"normal": "deepseek/deepseek-v4.1-flash",
|
|
99
|
+
"extra": "moonshotai/kimi-k3",
|
|
100
|
+
"models": [
|
|
101
|
+
{
|
|
102
|
+
"id": "moonshotai/kimi-k3",
|
|
103
|
+
"label": "Kimi K3"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"id": "deepseek/deepseek-v4.1-flash",
|
|
107
|
+
"label": "DeepSeek V4.1 Flash"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"id": "zai/glm-5.3",
|
|
111
|
+
"label": "GLM 5.3"
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -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
|
|
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$/, "")
|
|
@@ -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
|
}
|
|
@@ -45,6 +45,7 @@ import { isAdminRole, mayBuild, mayCreate, projectWritable, requireAdmin, requir
|
|
|
45
45
|
import { architectTurn } from "../services/architect.js";
|
|
46
46
|
import { addMessage, assistantLayout, assistantWidth, currentChat, earlierChats, foldChat, newChat, openChat, readChat, turnHistory, } from "../services/assistant-chats.js";
|
|
47
47
|
import { describeGradient, themeLooks } from "../services/brand.js";
|
|
48
|
+
import { chatCatalog, chatModelChoices, setChatModelChoice } from "../services/chat-models.js";
|
|
48
49
|
import { checkForCloud, cloudLinked, cloudSpaces, cloudState, forgetCloud, publishAndSync, pushSharing, removeFromCloud, replaceCloudSpaces, rotateInCloud, syncToCloud, } from "../services/cloud.js";
|
|
49
50
|
import { notFound, ServiceError } from "../services/errors.js";
|
|
50
51
|
import { deleteFile, listFiles, readFile, writeFile } from "../services/files.js";
|
|
@@ -67,7 +68,7 @@ import { addTableRow, createPage, createTable, deletePage, deleteTable, deleteTa
|
|
|
67
68
|
import { deleteTheme, listThemes, saveTheme } from "../services/themes.js";
|
|
68
69
|
import { deleteTranslation, editTranslation, isLangCode, publishedDefinition, } from "../services/translations.js";
|
|
69
70
|
import { draftWidgetPreview } from "../services/widgets.js";
|
|
70
|
-
import { createWizard, deleteWizard, draftChanges, duplicateWizard, ownedWizard, rotateShareLink, updateWizardSettings, writableWizard, writeDraft, } from "../services/wizards.js";
|
|
71
|
+
import { createWizard, deleteWizard, draftChanges, duplicateWizard, hasWizards, ownedWizard, rotateShareLink, updateWizardSettings, writableWizard, writeDraft, } from "../services/wizards.js";
|
|
71
72
|
import { deleteSetting, readSetting, writeSetting } from "../settings.js";
|
|
72
73
|
import { projectShareTargets, sharePreview } from "../sharing/index.js";
|
|
73
74
|
import { keepCloudForAll, mergesSeen, proposeMerge, resolveConflict, startSpace, stopSpace, syncAll, syncView, undoMerge, } from "../sync/client.js";
|
|
@@ -313,10 +314,17 @@ export const studio = new Hono()
|
|
|
313
314
|
onboarding: await onboardingFor(user, person?.tenants ?? []),
|
|
314
315
|
/** The organization still has the name the Manage-App gave it at sign-up: its first admin names it. */
|
|
315
316
|
startingName: managed ? startingName(info?.name) : false,
|
|
317
|
+
/** The organization has made a wizard: the studio's offer to install it waits for that. */
|
|
318
|
+
hasWizards: await hasWizards(),
|
|
316
319
|
/** What answers the studio's chats (Goose, the editor's chat): the text classes, a subscription, a key or the credits. */
|
|
317
|
-
chatEngine: managed ? "models" : await chatEngine(
|
|
320
|
+
chatEngine: managed ? "models" : await chatEngine(),
|
|
318
321
|
/** The ways that can answer the studio's chats now. */
|
|
319
|
-
chatWays: managed ? ["models"] : await chatWays(
|
|
322
|
+
chatWays: managed ? ["models"] : await chatWays(),
|
|
323
|
+
/** The models of the chats per way, and what the person chose: everyday work and extra effort. */
|
|
324
|
+
chatModels: {
|
|
325
|
+
ways: (await chatCatalog()).ways,
|
|
326
|
+
chosen: await chatModelChoices(),
|
|
327
|
+
},
|
|
320
328
|
aiReady: (await hasTextModel()) || (!managed && (await subscriptionClients()).length > 0),
|
|
321
329
|
mcpUrl: `${env.appUrl}/api/mcp`,
|
|
322
330
|
/**
|
|
@@ -507,6 +515,7 @@ export const studio = new Hono()
|
|
|
507
515
|
project,
|
|
508
516
|
writable,
|
|
509
517
|
message,
|
|
518
|
+
extra: body.extra,
|
|
510
519
|
page,
|
|
511
520
|
browserTools: body.tools,
|
|
512
521
|
lang: body.lang,
|
|
@@ -1249,8 +1258,8 @@ export const studio = new Hono()
|
|
|
1249
1258
|
.post("/wizards/:id/chat", async (c) => {
|
|
1250
1259
|
const user = c.get("user");
|
|
1251
1260
|
const wizardId = c.req.param("id");
|
|
1252
|
-
const { message } = z
|
|
1253
|
-
.object({ message: z.string().min(1).max(8000) })
|
|
1261
|
+
const { message, extra } = z
|
|
1262
|
+
.object({ message: z.string().min(1).max(8000), extra: z.boolean().optional() })
|
|
1254
1263
|
.parse(await c.req.json());
|
|
1255
1264
|
await writableWizard(user.id, wizardId);
|
|
1256
1265
|
if (!(await canSpend())) {
|
|
@@ -1260,7 +1269,7 @@ export const studio = new Hono()
|
|
|
1260
1269
|
const abort = new AbortController();
|
|
1261
1270
|
stream.onAbort(() => abort.abort());
|
|
1262
1271
|
try {
|
|
1263
|
-
const result = await asAssistantIn(wizardId, user, () => architectTurn(user.id, wizardId, message, requestLang(c), {
|
|
1272
|
+
const result = await asAssistantIn(wizardId, user, () => architectTurn(user.id, wizardId, message, requestLang(c), extra, {
|
|
1264
1273
|
signal: abort.signal,
|
|
1265
1274
|
onText: (delta) => {
|
|
1266
1275
|
void stream.writeSSE({ event: "text", data: JSON.stringify(delta) });
|
|
@@ -1637,6 +1646,30 @@ export const studio = new Hono()
|
|
|
1637
1646
|
}
|
|
1638
1647
|
closeTerminal(c.req.param("id"));
|
|
1639
1648
|
return c.json({ ok: true });
|
|
1649
|
+
})
|
|
1650
|
+
.put("/local/chat-models", async (c) => {
|
|
1651
|
+
if (managed) {
|
|
1652
|
+
return c.notFound();
|
|
1653
|
+
}
|
|
1654
|
+
const body = z
|
|
1655
|
+
.object({
|
|
1656
|
+
way: z.enum(CHAT_WAYS),
|
|
1657
|
+
normal: z.string().min(1).max(120).nullable().optional(),
|
|
1658
|
+
extra: z.string().min(1).max(120).nullable().optional(),
|
|
1659
|
+
})
|
|
1660
|
+
.parse(await c.req.json());
|
|
1661
|
+
// Null puts a model back to what the catalog names.
|
|
1662
|
+
const choice = (await chatModelChoices())[body.way] ?? {};
|
|
1663
|
+
for (const effort of ["normal", "extra"]) {
|
|
1664
|
+
if (body[effort] === null) {
|
|
1665
|
+
delete choice[effort];
|
|
1666
|
+
}
|
|
1667
|
+
else if (body[effort]) {
|
|
1668
|
+
choice[effort] = body[effort];
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
await setChatModelChoice(body.way, choice);
|
|
1672
|
+
return c.json({ ok: true });
|
|
1640
1673
|
})
|
|
1641
1674
|
.put("/local/chat", async (c) => {
|
|
1642
1675
|
if (managed) {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { eq } from "drizzle-orm";
|
|
2
2
|
import { runArchitect } from "../agents/architect.js";
|
|
3
|
-
import {
|
|
3
|
+
import { chatTurnWay, subscriptionTurn } from "../agents/subscription.js";
|
|
4
4
|
import { listConnectors } from "../connectors/external.js";
|
|
5
5
|
import { db, schema } from "../db/client.js";
|
|
6
6
|
import { managed } from "../manage.js";
|
|
7
|
-
import { hasTextModel } from "../models.js";
|
|
8
7
|
import { serverText } from "../texts.js";
|
|
9
8
|
import { draftFiles, readFile } from "./files.js";
|
|
10
9
|
import { ownedProject } from "./projects.js";
|
|
@@ -33,7 +32,7 @@ async function attachedImages(userId, wizardId, message) {
|
|
|
33
32
|
/** One studio chat turn: the architect reads the draft, its workspace and the thread, and changes them with tools. */
|
|
34
33
|
export async function architectTurn(userId, wizardId, message,
|
|
35
34
|
/** The language the admin reads: the lines about what it does, and its stock replies. */
|
|
36
|
-
lang, io) {
|
|
35
|
+
lang, extra, io) {
|
|
37
36
|
// Asked before the first model call: a wizard that is not changed here costs nothing to refuse.
|
|
38
37
|
const w = await writableWizard(userId, wizardId);
|
|
39
38
|
const history = await wizardMessages(w.id);
|
|
@@ -42,7 +41,7 @@ lang, io) {
|
|
|
42
41
|
const userMessageId = await addMessage(w.id, { role: "user", content: message });
|
|
43
42
|
try {
|
|
44
43
|
// A runtime that runs alone can answer the chat on the admin's own subscription or key.
|
|
45
|
-
const engine =
|
|
44
|
+
const engine = await chatTurnWay(managed);
|
|
46
45
|
const result = engine === "claude" || engine === "codex" || engine === "cursor"
|
|
47
46
|
? {
|
|
48
47
|
...(await subscriptionTurn({
|
|
@@ -55,6 +54,7 @@ lang, io) {
|
|
|
55
54
|
onThought: io.onThought,
|
|
56
55
|
onBuilding: io.onBuilding,
|
|
57
56
|
images,
|
|
57
|
+
extra,
|
|
58
58
|
lang,
|
|
59
59
|
})),
|
|
60
60
|
unfinished: false,
|
|
@@ -64,6 +64,7 @@ lang, io) {
|
|
|
64
64
|
userId,
|
|
65
65
|
wizardId: w.id,
|
|
66
66
|
message,
|
|
67
|
+
extra,
|
|
67
68
|
history: history.map((m) => ({ role: m.role, content: m.content })),
|
|
68
69
|
connectors: await listConnectors(project.id),
|
|
69
70
|
signal: io.signal,
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { env } from "../env.js";
|
|
4
|
+
import { readSetting, writeSetting } from "../settings.js";
|
|
5
|
+
/**
|
|
6
|
+
* The models the studio's chats (Goose, the editor's chat) run on, per way: the model of
|
|
7
|
+
* everyday work and the one that extra effort switches to. The list is the server's word, so a
|
|
8
|
+
* new model needs no new release: the runtime asks `CHAT_MODELS_URL` at the start and every day
|
|
9
|
+
* after, and keeps what it last got. `data/chat-models.json` is the fallback in the repository.
|
|
10
|
+
*/
|
|
11
|
+
const entry = z.object({ id: z.string().min(1), label: z.string().min(1) });
|
|
12
|
+
const way = z.object({
|
|
13
|
+
/** The model of everyday work. */
|
|
14
|
+
normal: z.string().min(1),
|
|
15
|
+
/** The model of extra effort. */
|
|
16
|
+
extra: z.string().min(1),
|
|
17
|
+
models: z.array(entry),
|
|
18
|
+
});
|
|
19
|
+
const catalog = z.object({
|
|
20
|
+
version: z.literal(1),
|
|
21
|
+
updated: z.string().optional(),
|
|
22
|
+
ways: z.record(z.string(), way),
|
|
23
|
+
});
|
|
24
|
+
const DAY = 24 * 3600_000;
|
|
25
|
+
const bundled = catalog.parse(JSON.parse(readFileSync(new URL("../data/chat-models.json", import.meta.url), "utf8")));
|
|
26
|
+
let current = bundled;
|
|
27
|
+
let asked = 0;
|
|
28
|
+
/** The catalog now: what the server last said, else the file in the repository. */
|
|
29
|
+
export async function chatCatalog() {
|
|
30
|
+
if (env.chatModelsUrl && Date.now() - asked > DAY) {
|
|
31
|
+
asked = Date.now();
|
|
32
|
+
try {
|
|
33
|
+
const res = await fetch(env.chatModelsUrl, { signal: AbortSignal.timeout(8_000) });
|
|
34
|
+
const parsed = res.ok ? catalog.safeParse(await res.json()) : null;
|
|
35
|
+
if (parsed?.success) {
|
|
36
|
+
current = parsed.data;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// The server does not answer: the last list stays.
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return current;
|
|
44
|
+
}
|
|
45
|
+
const KEY = "chat-models";
|
|
46
|
+
export async function chatModelChoices() {
|
|
47
|
+
return (await readSetting(KEY)) ?? {};
|
|
48
|
+
}
|
|
49
|
+
export async function setChatModelChoice(wayId, choice) {
|
|
50
|
+
const all = await chatModelChoices();
|
|
51
|
+
const next = { ...all, [wayId]: choice };
|
|
52
|
+
await writeSetting(KEY, next);
|
|
53
|
+
}
|
|
54
|
+
/** The model id a way runs for everyday work or for extra effort: the person's, else the catalog's. */
|
|
55
|
+
export async function chatModelId(wayId, effort) {
|
|
56
|
+
const chosen = (await chatModelChoices())[wayId]?.[effort];
|
|
57
|
+
return chosen ?? (await chatCatalog()).ways[wayId]?.[effort] ?? null;
|
|
58
|
+
}
|
|
@@ -96,6 +96,14 @@ export async function listWizards(_userId, projectId) {
|
|
|
96
96
|
});
|
|
97
97
|
return rows.map(wizardSummary);
|
|
98
98
|
}
|
|
99
|
+
/** The organization has made a wizard: the studio offers itself as an app from then on. */
|
|
100
|
+
export async function hasWizards() {
|
|
101
|
+
const row = await db.query.wizard.findFirst({
|
|
102
|
+
columns: { id: true },
|
|
103
|
+
where: eq(schema.wizard.tenantId, currentTenant()),
|
|
104
|
+
});
|
|
105
|
+
return Boolean(row);
|
|
106
|
+
}
|
|
99
107
|
export async function publishedVersion(w) {
|
|
100
108
|
if (w.publishedVersion === null) {
|
|
101
109
|
return null;
|