@engenty/wizards-runtime 0.11.13 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/runtime/dist/app.js +2 -0
- package/apps/runtime/dist/cli/account.js +1 -1
- package/apps/runtime/dist/cli/features.js +45 -2
- package/apps/runtime/dist/docs/dev/plugins/reference.md +3 -3
- package/apps/runtime/dist/docs/dev/plugins/studio.md +1 -1
- package/apps/runtime/dist/docs/user-guide/models.md +22 -2
- package/apps/runtime/dist/docs/user-guide/server.md +15 -2
- package/apps/runtime/dist/features.js +9 -0
- package/apps/runtime/dist/index.js +7 -0
- package/apps/runtime/dist/local-models.js +192 -0
- package/apps/runtime/dist/models.js +250 -75
- package/apps/runtime/dist/plugins/install.js +120 -0
- package/apps/runtime/dist/plugins/loader.js +33 -3
- package/apps/runtime/dist/plugins/pro.js +9 -9
- package/apps/runtime/dist/prompts/tools.md +1 -1
- package/apps/runtime/dist/routes/plugins.js +110 -2
- package/apps/runtime/dist/routes/runtime-settings.js +108 -0
- package/apps/runtime/dist/routes/studio.js +64 -2
- package/apps/runtime/dist/services/project-files.js +11 -1
- package/apps/runtime/dist/services/project-index.js +47 -4
- package/apps/runtime/dist/texts.js +4 -0
- package/apps/runtime/dist/update.js +10 -2
- package/apps/web/dist/assets/AboutDialog-BOJjBIYk.js +1 -0
- package/apps/web/dist/assets/{ChangelogDialog-Cxwkcjdy.js → ChangelogDialog-I9DEn_ra.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-BijLsoJX.js → CodeEditor-BgUofYLQ.js} +1 -1
- package/apps/web/dist/assets/EditorPage-DEOxHFXn.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-Wjt28MdG.js → FlowPreview-C6DeATyk.js} +1 -1
- package/apps/web/dist/assets/{Marketplace-CpjRqTvn.js → Marketplace-Dt7ktvc3.js} +2 -2
- package/apps/web/dist/assets/{NewWizardChannels-CelW1MGq.js → NewWizardChannels-BrVFc6PV.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-Coswm2WX.js → NewWizardPage-Dl8sMR2e.js} +1 -1
- package/apps/web/dist/assets/OnboardingPage-BN5IfLGL.js +1 -0
- package/apps/web/dist/assets/{PreviewPane-BUwlltqA.js → PreviewPane-BDzDuTz1.js} +5 -5
- package/apps/web/dist/assets/ProjectPage-BqkkyEpP.js +1 -0
- package/apps/web/dist/assets/PublicRunner-bAakEGwv.js +1 -0
- package/apps/web/dist/assets/{ReadOnly-DZMZPM-W.js → ReadOnly-MBVPGEhw.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-DDe1BC-3.js +2 -0
- package/apps/web/dist/assets/SetupPage-CmTC9K8_.js +1 -0
- package/apps/web/dist/assets/{SharePage-DF8LO8-K.js → SharePage-D9_IxO3M.js} +1 -1
- package/apps/web/dist/assets/changelog-iTu1De5h.js +1 -0
- package/apps/web/dist/assets/i18n-7CvqRUdn.js +55 -0
- package/apps/web/dist/assets/index-CNwXyMzH.js +49 -0
- package/apps/web/dist/assets/index-Dxwbli0m.css +1 -0
- package/apps/web/dist/assets/{wrench-Dr19y-10.js → lock-D1093O6-.js} +1 -1
- package/apps/web/dist/assets/{phone-JGS60FQU.js → phone-YeDiW-kN.js} +1 -1
- package/apps/web/dist/assets/{runners-CwTP03YR.js → runners-DP0vYvTF.js} +1 -1
- package/apps/web/dist/assets/session-Bio3Vaq1.js +2 -0
- package/apps/web/dist/assets/{theme-D6QLPvJL.js → theme-AlaEfdLQ.js} +2 -2
- package/apps/web/dist/assets/{ui-Bhp_a_44.js → ui-CU-cIuyK.js} +2 -2
- package/apps/web/dist/assets/{upload-DPLDQsRT.js → upload-DbWtEr1f.js} +1 -1
- package/apps/web/dist/assets/{useMutation-Cmn8b7tT.js → useMutation-erJIov3t.js} +1 -1
- package/apps/web/dist/assets/{volume-2-DGqbhyPO.js → volume-2-V1P9DYWO.js} +1 -1
- package/apps/web/dist/index.html +8 -8
- package/apps/web/dist/manifest.webmanifest +1 -1
- package/apps/web/dist/mcp/flow.html +25 -25
- package/node_modules/@engenty/wizards/dist/plugin/studio.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +6 -0
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +6 -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/AboutDialog-pMHleH_y.js +0 -1
- package/apps/web/dist/assets/EditorPage-v7cpENx3.js +0 -3
- package/apps/web/dist/assets/Harness-BrP-ENHg.css +0 -1
- package/apps/web/dist/assets/Harness-TUpGhGX5.js +0 -16
- package/apps/web/dist/assets/OnboardingPage-C9XM_VXs.js +0 -1
- package/apps/web/dist/assets/ProjectPage-Cw7hdXO6.js +0 -1
- package/apps/web/dist/assets/PublicRunner-B5RGNs07.js +0 -1
- package/apps/web/dist/assets/SettingsPage-CfL1e3Vs.js +0 -2
- package/apps/web/dist/assets/SetupPage-BRPenYa-.js +0 -1
- package/apps/web/dist/assets/changelog-CO6ysfQg.js +0 -1
- package/apps/web/dist/assets/i18n-BYeH2Dmi.js +0 -55
- package/apps/web/dist/assets/index-BYZBN0xx.css +0 -1
- package/apps/web/dist/assets/index-Bl7qOZv0.js +0 -34
- package/apps/web/dist/assets/session-CngLvd02.js +0 -2
- package/apps/web/dist/assets/settings-menu-C0yo5q3t.js +0 -1
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { dirname } from "node:path";
|
|
2
3
|
import { Hono } from "hono";
|
|
3
4
|
import { streamSSE } from "hono/streaming";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { switchOn } from "../features.js";
|
|
4
7
|
import { managed } from "../manage.js";
|
|
5
|
-
import {
|
|
8
|
+
import { installedHere, installPluginFolder, installPluginZip, MAX_PLUGIN, removeInstalledPlugin, } from "../plugins/install.js";
|
|
9
|
+
import { foundPlugins, installedPluginsDir, pluginDirs, pluginOff, pluginProblems, reloadPlugin, rescanPlugins, setPluginOn, } from "../plugins/loader.js";
|
|
6
10
|
import { installPro, proState, refreshPro, removePro } from "../plugins/pro.js";
|
|
7
11
|
import { loadedPlugin, onPluginChange, pluginAsset, pluginIdsOf, pluginsOf, } from "../plugins/registry.js";
|
|
8
12
|
import { notFoundAnswer } from "./lang.js";
|
|
@@ -153,7 +157,12 @@ export const pluginRoutes = new Hono()
|
|
|
153
157
|
return c.json({ error: "This isn’t allowed here.", code: "forbidden" }, 403);
|
|
154
158
|
}
|
|
155
159
|
await rescanPlugins();
|
|
156
|
-
|
|
160
|
+
const found = await pluginsOf(c.get("user").tenantId);
|
|
161
|
+
// A plugin put into a folder counts as installed: Settings › Plugins stays from now on.
|
|
162
|
+
if (found.length) {
|
|
163
|
+
switchOn("plugins");
|
|
164
|
+
}
|
|
165
|
+
return c.json({ plugins: found.map(view) });
|
|
157
166
|
})
|
|
158
167
|
.post("/-/reload/:id", async (c) => {
|
|
159
168
|
if (!canReload(c.get("user"))) {
|
|
@@ -182,6 +191,7 @@ export const pluginRoutes = new Hono()
|
|
|
182
191
|
}
|
|
183
192
|
try {
|
|
184
193
|
await installPro(c.req.param("id"));
|
|
194
|
+
switchOn("plugins");
|
|
185
195
|
}
|
|
186
196
|
catch (err) {
|
|
187
197
|
const answer = answerOf(err);
|
|
@@ -207,6 +217,104 @@ export const pluginRoutes = new Hono()
|
|
|
207
217
|
throw err;
|
|
208
218
|
}
|
|
209
219
|
return c.json(await proState());
|
|
220
|
+
})
|
|
221
|
+
// Every plugin this computer has, switched off ones too: Settings › Plugins › Overview.
|
|
222
|
+
.get("/-/all", (c) => {
|
|
223
|
+
if (!canReload(c.get("user"))) {
|
|
224
|
+
return c.json(notFoundAnswer(c), 404);
|
|
225
|
+
}
|
|
226
|
+
return c.json({ plugins: allPlugins(), dir: installedPluginsDir() });
|
|
227
|
+
})
|
|
228
|
+
.put("/-/all/:id", async (c) => {
|
|
229
|
+
if (!canReload(c.get("user"))) {
|
|
230
|
+
return c.json({ error: "This isn’t allowed here.", code: "forbidden" }, 403);
|
|
231
|
+
}
|
|
232
|
+
const id = c.req.param("id");
|
|
233
|
+
const { on } = z.object({ on: z.boolean() }).parse(await c.req.json());
|
|
234
|
+
if (!foundPlugins().some((s) => s.id === id)) {
|
|
235
|
+
return c.json(notFoundAnswer(c), 404);
|
|
236
|
+
}
|
|
237
|
+
await setPluginOn(id, on);
|
|
238
|
+
return c.json({ plugins: allPlugins() });
|
|
239
|
+
})
|
|
240
|
+
// A zip as the form's `file`, or `{ path }` of a folder on this computer. Nobody checked it: the studio
|
|
241
|
+
// says so before it sends one.
|
|
242
|
+
.post("/-/install", async (c) => {
|
|
243
|
+
if (!canReload(c.get("user"))) {
|
|
244
|
+
return c.json({ error: "This isn’t allowed here.", code: "forbidden" }, 403);
|
|
245
|
+
}
|
|
246
|
+
try {
|
|
247
|
+
if (c.req.header("content-type")?.startsWith("application/json")) {
|
|
248
|
+
const { path } = z
|
|
249
|
+
.object({ path: z.string().trim().min(1).max(1000) })
|
|
250
|
+
.parse(await c.req.json());
|
|
251
|
+
await installPluginFolder(path);
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
if (Number(c.req.header("content-length") ?? 0) > MAX_PLUGIN) {
|
|
255
|
+
return c.json({ error: "The package is too large.", code: "too_large" }, 413);
|
|
256
|
+
}
|
|
257
|
+
const file = (await c.req.parseBody()).file;
|
|
258
|
+
if (!(file instanceof File)) {
|
|
259
|
+
return c.json({ error: "Choose a zip file.", code: "no_file" }, 400);
|
|
260
|
+
}
|
|
261
|
+
await installPluginZip(new Uint8Array(await file.arrayBuffer()));
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
catch (err) {
|
|
265
|
+
const answer = answerOf(err);
|
|
266
|
+
if (answer) {
|
|
267
|
+
return c.json(answer.body, answer.status);
|
|
268
|
+
}
|
|
269
|
+
throw err;
|
|
270
|
+
}
|
|
271
|
+
switchOn("plugins");
|
|
272
|
+
return c.json({ plugins: allPlugins() });
|
|
273
|
+
})
|
|
274
|
+
.delete("/-/all/:id", async (c) => {
|
|
275
|
+
if (!canReload(c.get("user"))) {
|
|
276
|
+
return c.json({ error: "This isn’t allowed here.", code: "forbidden" }, 403);
|
|
277
|
+
}
|
|
278
|
+
try {
|
|
279
|
+
await removeInstalledPlugin(c.req.param("id"));
|
|
280
|
+
}
|
|
281
|
+
catch (err) {
|
|
282
|
+
const answer = answerOf(err);
|
|
283
|
+
if (answer) {
|
|
284
|
+
return c.json(answer.body, answer.status);
|
|
285
|
+
}
|
|
286
|
+
throw err;
|
|
287
|
+
}
|
|
288
|
+
return c.json({ plugins: allPlugins() });
|
|
210
289
|
})
|
|
211
290
|
.all("/:id", dispatch)
|
|
212
291
|
.all("/:id/*", dispatch);
|
|
292
|
+
/**
|
|
293
|
+
* Where a plugin came from: shipped with the runtime (`modules/`), a Pro plugin of the plan
|
|
294
|
+
* (signed by engenty), installed in Settings › Plugins, or a folder of `PLUGINS_DIR`.
|
|
295
|
+
*/
|
|
296
|
+
function originOf(source) {
|
|
297
|
+
if (source.pro) {
|
|
298
|
+
return "pro";
|
|
299
|
+
}
|
|
300
|
+
if (installedHere(source.id)) {
|
|
301
|
+
return "installed";
|
|
302
|
+
}
|
|
303
|
+
return dirname(source.root) === pluginDirs()[0] ? "builtin" : "folder";
|
|
304
|
+
}
|
|
305
|
+
function allPlugins() {
|
|
306
|
+
return foundPlugins().map((source) => {
|
|
307
|
+
const plugin = loadedPlugin(source.id);
|
|
308
|
+
return {
|
|
309
|
+
id: source.id,
|
|
310
|
+
name: source.manifest.name,
|
|
311
|
+
version: source.manifest.version,
|
|
312
|
+
description: source.manifest.description ?? "",
|
|
313
|
+
origin: originOf(source),
|
|
314
|
+
on: !pluginOff(source.id),
|
|
315
|
+
root: source.root,
|
|
316
|
+
error: plugin?.error ?? null,
|
|
317
|
+
tools: plugin ? [...plugin.tools.values()].map((t) => `${source.id}.${t.name}`) : [],
|
|
318
|
+
};
|
|
319
|
+
});
|
|
320
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { defaultFeatures, FEATURE_NAME, parseFeatures, resolveFeatures, } from "@engenty/wizards-shared/features";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { packageVersion } from "../cli/home.js";
|
|
5
|
+
import { env } from "../env.js";
|
|
6
|
+
import { declaredFeatures, featuresFile, fileFeatures, remoteFeatures, writeFeature, } from "../features.js";
|
|
7
|
+
import { managed, userInfo } from "../manage.js";
|
|
8
|
+
import { localModelSettings } from "../models.js";
|
|
9
|
+
import { loadedPlugins } from "../plugins/registry.js";
|
|
10
|
+
import { installKind, restartRuntime, restarts } from "../update.js";
|
|
11
|
+
import { say } from "./lang.js";
|
|
12
|
+
/**
|
|
13
|
+
* Whether this person may change what holds for the whole runtime (Settings › Setup, Settings ›
|
|
14
|
+
* Feature switches): on a computer whoever uses it, in the cloud the platform's admins only. Not
|
|
15
|
+
* someone an admin is signed in as.
|
|
16
|
+
*/
|
|
17
|
+
export async function mayChangeRuntime(user) {
|
|
18
|
+
if (!managed) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
return !user.impersonatedBy && (await userInfo(user.id)).admin;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What holds for the whole runtime: how it runs, what it thinks with, its feature switches. The
|
|
25
|
+
* studio's Settings › Setup and Settings › Feature switches; refused to everyone else.
|
|
26
|
+
*/
|
|
27
|
+
export const runtimeSettingsRoutes = new Hono()
|
|
28
|
+
.use(async (c, next) => {
|
|
29
|
+
if (!(await mayChangeRuntime(c.get("user")))) {
|
|
30
|
+
return c.json({ error: say(c, "onlyPlatformAdmins"), code: "not_platform_admin" }, 403);
|
|
31
|
+
}
|
|
32
|
+
await next();
|
|
33
|
+
})
|
|
34
|
+
.get("/", (c) => {
|
|
35
|
+
const models = managed ? null : localModelSettings();
|
|
36
|
+
return c.json({
|
|
37
|
+
version: packageVersion(),
|
|
38
|
+
kind: managed ? "cloud" : installKind(),
|
|
39
|
+
role: env.role,
|
|
40
|
+
publicUrl: env.publicUrl,
|
|
41
|
+
dataDir: env.dataDir,
|
|
42
|
+
/** A libSQL server, or a file in the data folder; never its address, which may hold a token. */
|
|
43
|
+
database: env.databaseUrl ? "server" : "file",
|
|
44
|
+
files: env.s3.bucket ? "bucket" : "folder",
|
|
45
|
+
featuresFile: featuresFile(),
|
|
46
|
+
/** The command that started it starts it again after a restart. */
|
|
47
|
+
restarts: restarts(),
|
|
48
|
+
/** What a runtime that runs alone thinks with; null in the cloud, where the Manage-App says. */
|
|
49
|
+
models: models
|
|
50
|
+
? {
|
|
51
|
+
source: models.source,
|
|
52
|
+
keys: Object.entries(models.keys)
|
|
53
|
+
.filter(([, set]) => set)
|
|
54
|
+
.map(([name]) => name),
|
|
55
|
+
ollamaUrl: models.ollamaUrl,
|
|
56
|
+
}
|
|
57
|
+
: null,
|
|
58
|
+
plugins: loadedPlugins().map((p) => p.source.id),
|
|
59
|
+
});
|
|
60
|
+
})
|
|
61
|
+
.get("/features", async (c) => {
|
|
62
|
+
const declared = declaredFeatures();
|
|
63
|
+
const fromEnv = parseFeatures(process.env.FEATURES ?? "");
|
|
64
|
+
const remote = await remoteFeatures();
|
|
65
|
+
const fromFile = fileFeatures();
|
|
66
|
+
const all = resolveFeatures(defaultFeatures(declared), fromEnv, remote, fromFile);
|
|
67
|
+
const names = [
|
|
68
|
+
...new Set([
|
|
69
|
+
...Object.keys(declared),
|
|
70
|
+
...Object.keys(fromEnv),
|
|
71
|
+
...Object.keys(remote ?? {}),
|
|
72
|
+
...Object.keys(fromFile),
|
|
73
|
+
]),
|
|
74
|
+
];
|
|
75
|
+
const source = (name) => name in fromFile
|
|
76
|
+
? "file"
|
|
77
|
+
: remote && name in remote
|
|
78
|
+
? "remote"
|
|
79
|
+
: name in fromEnv
|
|
80
|
+
? "env"
|
|
81
|
+
: "default";
|
|
82
|
+
return c.json({
|
|
83
|
+
file: featuresFile(),
|
|
84
|
+
restarts: restarts(),
|
|
85
|
+
features: names.map((name) => ({
|
|
86
|
+
name,
|
|
87
|
+
on: all[name] === true,
|
|
88
|
+
source: source(name),
|
|
89
|
+
kind: declared[name]?.kind ?? null,
|
|
90
|
+
label: declared[name]?.label ?? null,
|
|
91
|
+
hint: declared[name]?.hint ?? null,
|
|
92
|
+
/** What it would be without this runtime's file. */
|
|
93
|
+
without: resolveFeatures(defaultFeatures(declared), fromEnv, remote)[name] === true,
|
|
94
|
+
})),
|
|
95
|
+
});
|
|
96
|
+
})
|
|
97
|
+
.put("/features/:name", async (c) => {
|
|
98
|
+
const name = c.req.param("name");
|
|
99
|
+
if (!FEATURE_NAME.test(name)) {
|
|
100
|
+
return c.json({ error: say(c, "notFound"), code: "unknown_feature" }, 404);
|
|
101
|
+
}
|
|
102
|
+
const { on } = z.object({ on: z.boolean().nullable() }).parse(await c.req.json());
|
|
103
|
+
// A switch set to what it would be anyway leaves the file: it follows the default again.
|
|
104
|
+
const without = resolveFeatures(defaultFeatures(declaredFeatures()), parseFeatures(process.env.FEATURES ?? ""), await remoteFeatures());
|
|
105
|
+
writeFeature(name, on === null || on === (without[name] === true) ? null : on);
|
|
106
|
+
return c.json({ ok: true });
|
|
107
|
+
})
|
|
108
|
+
.post("/restart", (c) => c.json({ restarting: restartRuntime() }));
|
|
@@ -33,12 +33,13 @@ import { freshAuth, loginEnv } from "../harness/env.js";
|
|
|
33
33
|
import { detectHarness, detectHarnesses, HARNESS_IDS, harness, installSpec, } from "../harness/index.js";
|
|
34
34
|
import { closeTerminal, openTerminal, resizeTerminal, subscribeTerminal, writeTerminal, } from "../harness/terminal.js";
|
|
35
35
|
import { connectorsView, filesView, spacesView, translationsView, wizardsView, wizardView, } from "../live/views.js";
|
|
36
|
+
import { downloadLocalModel, localModels, removeLocalModel, startLocalOllama, } from "../local-models.js";
|
|
36
37
|
import { installMail, managed, renameTenant, saveOrganizationProfile, tenantInfo, tenantMembers, userInfo, } from "../manage.js";
|
|
37
38
|
import { seenApps } from "../mcp/seen.js";
|
|
38
39
|
import { generateImageMedia, generateSpeechMedia, generateVideoMedia } from "../media/generate.js";
|
|
39
40
|
import { transcribeAudio } from "../media/transcribe.js";
|
|
40
41
|
import { errorText, saidOf } from "../model-errors.js";
|
|
41
|
-
import { blockedBinding, CHAT_WAYS, checkKey, classProblem, classWays, hasTextModel, LOCAL_KEYS, localModelSettings, ModelUnavailableError, modelSettings, saveLocalModels, saveModels, setUpKey, setUpOllama, storedKey, textModel, } from "../models.js";
|
|
42
|
+
import { blockedBinding, CHAT_WAYS, checkKey, classProblem, classWays, DECISION_CHOICES, EMBEDDING_CHOICES, embeddingModel, hasTextModel, LOCAL_KEYS, localModelSettings, ModelUnavailableError, modelSettings, saveLocalModels, saveModels, setUpKey, setUpOllama, storedKey, textModel, } from "../models.js";
|
|
42
43
|
import { refreshPro } from "../plugins/pro.js";
|
|
43
44
|
import { HTML_RESPONSE_CSP } from "../render/guard.js";
|
|
44
45
|
import { isAdminRole, mayBuild, mayCreate, projectWritable, requireAdmin, requireWritable, } from "../services/access.js";
|
|
@@ -59,7 +60,7 @@ import { pagePreview } from "../services/pages.js";
|
|
|
59
60
|
import { asAssistantIn, leave, markPresent, presentByItem, presentIn, } from "../services/presence.js";
|
|
60
61
|
import { profileSchema, saveProfile, saveUserLang, userLang, userProfile, } from "../services/profile.js";
|
|
61
62
|
import { addProjectFile, addProjectFileFromUrl, fileView, orderProjectFiles, projectFile, projectFileContent, reindexProjectFile, removeProjectFile, updateProjectFile, } from "../services/project-files.js";
|
|
62
|
-
import { documentText, queueIndex, searchKnowledge } from "../services/project-index.js";
|
|
63
|
+
import { documentText, queueIndex, reindexAll, searchKnowledge, } from "../services/project-index.js";
|
|
63
64
|
import { createProject, deleteProject, gradientSchema, ownedProject, projectLimitOrNull, projectPatchSchema, updateProject, } from "../services/projects.js";
|
|
64
65
|
import { runnersOf, wizardRunners } from "../services/runners.js";
|
|
65
66
|
import { draftStepView, listResults, listRuns, startTestRun } from "../services/runs.js";
|
|
@@ -78,6 +79,7 @@ import { serverText } from "../texts.js";
|
|
|
78
79
|
import { applyUpdate, updateStatus } from "../update.js";
|
|
79
80
|
import { bareMime, byteRange } from "./delivery.js";
|
|
80
81
|
import { notFoundAnswer, requestLang, say } from "./lang.js";
|
|
82
|
+
import { mayChangeRuntime } from "./runtime-settings.js";
|
|
81
83
|
const presenceSchema = z.object({
|
|
82
84
|
kind: z.enum(PRESENCE_KINDS),
|
|
83
85
|
item: z.string().min(1).max(100),
|
|
@@ -116,11 +118,22 @@ async function setupDone() {
|
|
|
116
118
|
}
|
|
117
119
|
return hasTextModel();
|
|
118
120
|
}
|
|
121
|
+
/** A model as Ollama names it: `name`, `name:tag`, `namespace/name:tag` or `hf.co/…`. */
|
|
122
|
+
const localModelName = z
|
|
123
|
+
.string()
|
|
124
|
+
.trim()
|
|
125
|
+
.min(1)
|
|
126
|
+
.max(120)
|
|
127
|
+
.regex(/^[\w.:/-]+$/);
|
|
119
128
|
const modelsInput = z.object({
|
|
120
129
|
source: z.enum([...HARNESS_IDS, "account", "own"]).optional(),
|
|
121
130
|
bindings: z.partialRecord(z.enum(MODEL_CLASSES), z.string().max(160)).optional(),
|
|
122
131
|
ollamaUrl: z.string().max(200).optional(),
|
|
123
132
|
creditFallback: z.boolean().optional(),
|
|
133
|
+
decision: z.enum(DECISION_CHOICES).optional(),
|
|
134
|
+
embedding: z.enum(EMBEDDING_CHOICES).optional(),
|
|
135
|
+
decisionLocal: z.string().max(120).optional(),
|
|
136
|
+
embeddingLocal: z.string().max(120).optional(),
|
|
124
137
|
keys: z.partialRecord(z.enum(LOCAL_KEYS), z.string().max(400)).optional(),
|
|
125
138
|
});
|
|
126
139
|
/** Alone the person changes everything; in an organization its owner and admins. */
|
|
@@ -280,6 +293,8 @@ export const studio = new Hono()
|
|
|
280
293
|
assistantDev: await assistantDevFor(user),
|
|
281
294
|
/** The person's organizations, their own first: the switcher lists them. Empty alone. */
|
|
282
295
|
organizations: person?.tenants ?? [],
|
|
296
|
+
/** The person may change what holds for the whole runtime: Settings › Setup and Feature switches. */
|
|
297
|
+
runtimeSettings: await mayChangeRuntime(user),
|
|
283
298
|
/** The person may make further organizations (the platform's admins), on the account page. */
|
|
284
299
|
mayCreateOrganization: person?.admin ?? false,
|
|
285
300
|
mode: managed ? "managed" : "local",
|
|
@@ -1462,8 +1477,55 @@ export const studio = new Hono()
|
|
|
1462
1477
|
code: "model_lacks",
|
|
1463
1478
|
}, 400);
|
|
1464
1479
|
}
|
|
1480
|
+
const embeddedBy = (await embeddingModel().catch(() => null))?.ref ?? null;
|
|
1465
1481
|
await saveModels(input);
|
|
1482
|
+
// Vectors of another model don't compare: every space goes into the index again.
|
|
1483
|
+
if (((await embeddingModel().catch(() => null))?.ref ?? null) !== embeddedBy) {
|
|
1484
|
+
void reindexAll().catch((err) => console.error("[models] reindex failed", err));
|
|
1485
|
+
}
|
|
1466
1486
|
return c.json(await modelSettings(requestLang(c)));
|
|
1487
|
+
})
|
|
1488
|
+
// Ollama on this computer: its models, what each can do, the ones to download, the downloads.
|
|
1489
|
+
.get("/models/local", async (c) => {
|
|
1490
|
+
if (managed) {
|
|
1491
|
+
return c.notFound();
|
|
1492
|
+
}
|
|
1493
|
+
return c.json(await localModels());
|
|
1494
|
+
})
|
|
1495
|
+
// A model pulled into Ollama. Where it is the embedding model now, the spaces are indexed with it after.
|
|
1496
|
+
.post("/models/local/pull", async (c) => {
|
|
1497
|
+
if (managed || !mayChangeModels(c.get("user"))) {
|
|
1498
|
+
return c.notFound();
|
|
1499
|
+
}
|
|
1500
|
+
const { model } = z.object({ model: localModelName }).parse(await c.req.json());
|
|
1501
|
+
const embeddedBy = (await embeddingModel().catch(() => null))?.ref ?? null;
|
|
1502
|
+
await downloadLocalModel(model, async () => {
|
|
1503
|
+
if (((await embeddingModel().catch(() => null))?.ref ?? null) !== embeddedBy) {
|
|
1504
|
+
await reindexAll();
|
|
1505
|
+
}
|
|
1506
|
+
});
|
|
1507
|
+
return c.json(await localModels());
|
|
1508
|
+
})
|
|
1509
|
+
.delete("/models/local", async (c) => {
|
|
1510
|
+
if (managed || !mayChangeModels(c.get("user"))) {
|
|
1511
|
+
return c.notFound();
|
|
1512
|
+
}
|
|
1513
|
+
const model = localModelName.parse(c.req.query("model"));
|
|
1514
|
+
try {
|
|
1515
|
+
await removeLocalModel(model);
|
|
1516
|
+
}
|
|
1517
|
+
catch (err) {
|
|
1518
|
+
return c.json({ error: say(c, "localModelNotRemoved", { error: err.message }) }, 400);
|
|
1519
|
+
}
|
|
1520
|
+
return c.json(await localModels());
|
|
1521
|
+
})
|
|
1522
|
+
// Ollama installed (on a Mac) and started, as `wizards setup` does.
|
|
1523
|
+
.post("/models/local/ollama", async (c) => {
|
|
1524
|
+
if (managed || !mayChangeModels(c.get("user"))) {
|
|
1525
|
+
return c.notFound();
|
|
1526
|
+
}
|
|
1527
|
+
await startLocalOllama();
|
|
1528
|
+
return c.json(await localModels());
|
|
1467
1529
|
})
|
|
1468
1530
|
// Whether a provider takes a key — the one typed, or the one stored. Nothing is generated.
|
|
1469
1531
|
.post("/models/keys/:provider/check", async (c) => {
|
|
@@ -14,7 +14,7 @@ import { safeFetch } from "../tools/net-guard.js";
|
|
|
14
14
|
import { requireWritableProject } from "./access.js";
|
|
15
15
|
import { notFound, ServiceError } from "./errors.js";
|
|
16
16
|
import { convertDocument, fillCategories } from "./knowledge-model.js";
|
|
17
|
-
import { dropIndex, keepText, queueIndex } from "./project-index.js";
|
|
17
|
+
import { dropIndex, indexedFile, keepText, queueIndex } from "./project-index.js";
|
|
18
18
|
import { setItemCategories } from "./space-categories.js";
|
|
19
19
|
/** Reading a file takes seconds to a few minutes; a row still `pending` after this was cut off. */
|
|
20
20
|
const STALE_MS = 15 * 60_000;
|
|
@@ -136,6 +136,9 @@ export async function addProjectFile(projectId, input) {
|
|
|
136
136
|
if (work) {
|
|
137
137
|
void prepare(row);
|
|
138
138
|
}
|
|
139
|
+
else if (indexedFile(row)) {
|
|
140
|
+
queueIndex(`f:${row.id}`);
|
|
141
|
+
}
|
|
139
142
|
return row;
|
|
140
143
|
}
|
|
141
144
|
/**
|
|
@@ -278,6 +281,9 @@ async function prepare(row) {
|
|
|
278
281
|
if (row.kind !== "document") {
|
|
279
282
|
const description = await describeImage(row, data).catch(() => "");
|
|
280
283
|
await set({ status: "ready", ...(description ? { description } : {}) });
|
|
284
|
+
if (indexedFile(row)) {
|
|
285
|
+
queueIndex(`f:${row.id}`);
|
|
286
|
+
}
|
|
281
287
|
spaceFileChanged("space.file.ready", row);
|
|
282
288
|
return;
|
|
283
289
|
}
|
|
@@ -331,6 +337,10 @@ export async function updateProjectFile(projectId, fileId, patch) {
|
|
|
331
337
|
})
|
|
332
338
|
.where(eq(schema.projectFile.id, row.id))
|
|
333
339
|
.returning();
|
|
340
|
+
// Its name and description are what the index finds an asset by.
|
|
341
|
+
if (indexedFile(updated) && (patch.name !== undefined || patch.description !== undefined)) {
|
|
342
|
+
queueIndex(`f:${row.id}`);
|
|
343
|
+
}
|
|
334
344
|
return updated;
|
|
335
345
|
}
|
|
336
346
|
/** Puts the files of one kind into the order of `ids`; the first logo is the one end users see. */
|
|
@@ -221,11 +221,37 @@ async function indexRows(tableId, rowIds) {
|
|
|
221
221
|
});
|
|
222
222
|
await writeUnits(scope, units);
|
|
223
223
|
}
|
|
224
|
+
/** An image, video or sound among a space's assets: found by its name and description. */
|
|
225
|
+
const MEDIA_ASSET = /^(image|video|audio)\//;
|
|
226
|
+
/** Whether the index holds a file: a document, or an image, video or sound asset. */
|
|
227
|
+
export function indexedFile(file) {
|
|
228
|
+
return file.kind === "document" || (file.kind === "asset" && MEDIA_ASSET.test(file.mime));
|
|
229
|
+
}
|
|
230
|
+
/** An asset stands in the index as one unit: its name, its kind, its categories, its description. */
|
|
231
|
+
async function indexAsset(file) {
|
|
232
|
+
const categories = await categoryRows(file.projectId);
|
|
233
|
+
const lines = categoryLines(categories, (await itemCategoriesOf([{ fileId: file.id }])).get(`f:${file.id}`));
|
|
234
|
+
const kind = file.mime.split("/")[0];
|
|
235
|
+
await writeUnits(eq(schema.projectChunk.fileId, file.id), [
|
|
236
|
+
{
|
|
237
|
+
projectId: file.projectId,
|
|
238
|
+
fileId: file.id,
|
|
239
|
+
heading: file.name,
|
|
240
|
+
idx: 0,
|
|
241
|
+
text: [head([file.name], [`${kind} asset`, ...lines]), file.description]
|
|
242
|
+
.filter(Boolean)
|
|
243
|
+
.join("\n\n"),
|
|
244
|
+
},
|
|
245
|
+
]);
|
|
246
|
+
}
|
|
224
247
|
async function indexFile(fileId) {
|
|
225
248
|
const file = await db.query.projectFile.findFirst({ where: eq(schema.projectFile.id, fileId) });
|
|
226
|
-
if (file
|
|
249
|
+
if (!(file && indexedFile(file) && file.status === "ready")) {
|
|
227
250
|
return;
|
|
228
251
|
}
|
|
252
|
+
if (file.kind === "asset") {
|
|
253
|
+
return indexAsset(file);
|
|
254
|
+
}
|
|
229
255
|
const converted = (await db.query.spacePage.findFirst({
|
|
230
256
|
where: eq(schema.spacePage.fileId, file.id),
|
|
231
257
|
columns: { id: true },
|
|
@@ -683,8 +709,8 @@ export async function reindexSpace(projectId) {
|
|
|
683
709
|
columns: { id: true },
|
|
684
710
|
}),
|
|
685
711
|
db.query.projectFile.findMany({
|
|
686
|
-
where: and(eq(schema.projectFile.projectId, projectId),
|
|
687
|
-
columns: { id: true },
|
|
712
|
+
where: and(eq(schema.projectFile.projectId, projectId), inArray(schema.projectFile.kind, ["document", "asset"])),
|
|
713
|
+
columns: { id: true, kind: true, mime: true },
|
|
688
714
|
}),
|
|
689
715
|
db
|
|
690
716
|
.select({ id: schema.spaceCategoryValue.id })
|
|
@@ -698,10 +724,27 @@ export async function reindexSpace(projectId) {
|
|
|
698
724
|
for (const t of tables) {
|
|
699
725
|
queueIndex(`t:${t.id}`);
|
|
700
726
|
}
|
|
701
|
-
for (const f of files) {
|
|
727
|
+
for (const f of files.filter(indexedFile)) {
|
|
702
728
|
queueIndex(`f:${f.id}`);
|
|
703
729
|
}
|
|
704
730
|
for (const v of values) {
|
|
705
731
|
queueIndex(`v:${v.id}`);
|
|
706
732
|
}
|
|
707
733
|
}
|
|
734
|
+
/** Every space into the index again, with the embedding model that is set up now. */
|
|
735
|
+
export async function reindexAll() {
|
|
736
|
+
const projects = await db.query.project.findMany({ columns: { id: true } });
|
|
737
|
+
for (const p of projects) {
|
|
738
|
+
await reindexSpace(p.id);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
/** The image, video and sound assets the index does not hold yet: added at start, once each. */
|
|
742
|
+
export async function indexMissingAssets() {
|
|
743
|
+
const rows = await db.all(sql `
|
|
744
|
+
SELECT f.id, f.kind, f.mime FROM project_file f
|
|
745
|
+
WHERE f.kind = 'asset' AND f.status = 'ready'
|
|
746
|
+
AND NOT EXISTS (SELECT 1 FROM project_chunk c WHERE c.file_id = f.id)`);
|
|
747
|
+
for (const row of rows.filter(indexedFile)) {
|
|
748
|
+
queueIndex(`f:${row.id}`);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
@@ -93,9 +93,11 @@ const EN = {
|
|
|
93
93
|
onlyAvailableCloud: "This is only available in the cloud.",
|
|
94
94
|
signedInAsSomeone: "You can’t do this while you’re signed in as someone else.",
|
|
95
95
|
onlyAvailableComputer: "This is only available on your computer.",
|
|
96
|
+
onlyPlatformAdmins: "Only the platform’s admins can change this.",
|
|
96
97
|
somethingWentWrongTry: "Something went wrong. Try again.",
|
|
97
98
|
unknownApp: "Unknown app.",
|
|
98
99
|
onlyOrganizationAdminsChange: "Only organization admins can change its models.",
|
|
100
|
+
localModelNotRemoved: "Ollama didn’t remove the model: {error}",
|
|
99
101
|
modelLacksForClass: "{model} lacks what the class {cls} can’t work without: {needs}. Choose another model for it.",
|
|
100
102
|
"need.tools": "tool calls",
|
|
101
103
|
"need.json": "JSON output",
|
|
@@ -277,9 +279,11 @@ const DE = {
|
|
|
277
279
|
onlyAvailableCloud: "Das gibt es nur in der Cloud.",
|
|
278
280
|
signedInAsSomeone: "Das geht nicht, solange du als jemand anderes angemeldet bist.",
|
|
279
281
|
onlyAvailableComputer: "Das gibt es nur auf deinem Computer.",
|
|
282
|
+
onlyPlatformAdmins: "Das ändern nur die Admins der Plattform.",
|
|
280
283
|
somethingWentWrongTry: "Da ist etwas schiefgelaufen. Versuch es noch einmal.",
|
|
281
284
|
unknownApp: "Diese App gibt es nicht.",
|
|
282
285
|
onlyOrganizationAdminsChange: "Nur Admins der Organisation ändern ihre Modelle.",
|
|
286
|
+
localModelNotRemoved: "Ollama hat das Modell nicht entfernt: {error}",
|
|
283
287
|
modelLacksForClass: "{model} fehlt, was die Klasse {cls} unbedingt braucht: {needs}. Wähle dafür ein anderes Modell.",
|
|
284
288
|
"need.tools": "Tool-Aufrufe",
|
|
285
289
|
"need.json": "JSON-Ausgabe",
|
|
@@ -22,9 +22,17 @@ let restart = null;
|
|
|
22
22
|
export function onRestart(shutdown) {
|
|
23
23
|
restart = shutdown;
|
|
24
24
|
}
|
|
25
|
-
function restarts() {
|
|
25
|
+
export function restarts() {
|
|
26
26
|
return process.env[RESTARTS] === "1" && restart !== null;
|
|
27
27
|
}
|
|
28
|
+
/** Starts the runtime again, where the command that started it does that; false where it can't. */
|
|
29
|
+
export function restartRuntime() {
|
|
30
|
+
if (!restarts()) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
setTimeout(() => restart?.(RESTART_EXIT), 500);
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
28
36
|
const enabled = () => !process.env.ENGENTY_WIZARDS_NO_UPDATE_CHECK;
|
|
29
37
|
/** The newest release GitHub knows; `fresh` asks again although the last answer still holds. */
|
|
30
38
|
async function newestRelease(fresh = false) {
|
|
@@ -54,7 +62,7 @@ async function newestRelease(fresh = false) {
|
|
|
54
62
|
cached = { at: Date.now(), ...found };
|
|
55
63
|
return found;
|
|
56
64
|
}
|
|
57
|
-
function installKind() {
|
|
65
|
+
export function installKind() {
|
|
58
66
|
return installedByScript() ? "script" : isCheckout() ? "checkout" : "npm";
|
|
59
67
|
}
|
|
60
68
|
export async function updateStatus(fresh = false) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{Bn as r,Jt as i,Nn as a,Xt as o,Yt as s,in as c,on as l,qt as u,sn as d,tn as f}from"./ui-CU-cIuyK.js";import{t as p}from"./preload-helper-DpV6A1kQ.js";import{t as m}from"./logo-CGNoptDg.js";import{s as h}from"./i18n-7CvqRUdn.js";import{Mt as g,Nt as _,V as v,et as y,it as b}from"./index-CNwXyMzH.js";import{ReleaseNotes as x,loadReleases as S,releaseDate as C,releaseLabel as w}from"./ChangelogDialog-I9DEn_ra.js";var T=e(t(),1),E=[{name:`engenty wizards`,description:`credit.engenty-wizards`,homepage:`https://github.com/engenty/wizards`,license:`FSL-1.1-MIT`},{name:`engenty`,description:`credit.engenty`,homepage:`https://github.com/engenty/engenty`,license:`FSL-1.1-MIT`}],D=[{name:`Mastra`,description:`credit.mastra`,homepage:`https://github.com/mastra-ai/mastra`,license:`Apache-2.0`},{name:`AI SDK`,description:`credit.ai-sdk`,homepage:`https://github.com/vercel/ai`,license:`Apache-2.0`},{name:`Model Context Protocol`,description:`credit.model-context-protocol`,homepage:`https://github.com/modelcontextprotocol/typescript-sdk`,license:`MIT`},{name:`Hono`,description:`credit.hono`,homepage:`https://github.com/honojs/hono`,license:`MIT`},{name:`Drizzle ORM`,description:`credit.drizzle-orm`,homepage:`https://github.com/drizzle-team/drizzle-orm`,license:`Apache-2.0`},{name:`libSQL`,description:`credit.libsql`,homepage:`https://github.com/tursodatabase/libsql`,license:`MIT`},{name:`Playwright`,description:`credit.playwright`,homepage:`https://github.com/microsoft/playwright`,license:`Apache-2.0`},{name:`React`,description:`credit.react`,homepage:`https://github.com/facebook/react`,license:`MIT`},{name:`Vite`,description:`credit.vite`,homepage:`https://github.com/vitejs/vite`,license:`MIT`},{name:`Tailwind CSS`,description:`credit.tailwind-css`,homepage:`https://github.com/tailwindlabs/tailwindcss`,license:`MIT`},{name:`React Flow`,description:`credit.react-flow`,homepage:`https://github.com/xyflow/xyflow`,license:`MIT`},{name:`TanStack Query`,description:`credit.tanstack-query`,homepage:`https://github.com/TanStack/query`,license:`MIT`},{name:`xterm.js`,description:`credit.xterm-js`,homepage:`https://github.com/xtermjs/xterm.js`,license:`MIT`},{name:`Lucide`,description:`credit.lucide`,homepage:`https://github.com/lucide-icons/lucide`,license:`ISC`},{name:`Geist & Geist Mono`,description:`credit.geist-geist-mono`,homepage:`https://github.com/vercel/geist-font`,license:`OFL-1.1`},{name:`Space Grotesk`,description:`credit.space-grotesk`,homepage:`https://github.com/floriankarsten/space-grotesk`,license:`OFL-1.1`},{name:`git-cliff`,description:`credit.git-cliff`,homepage:`https://github.com/orhun/git-cliff`,license:`MIT OR Apache-2.0`}],O=e(n(),1),k=(e,...t)=>t.some(t=>t?.toLowerCase().includes(e));function A({name:e,homepage:t,version:n,license:r,description:i}){return(0,O.jsxs)(`li`,{className:`py-2.5`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,children:[t?(0,O.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 font-medium text-[0.875rem] text-ink underline-offset-4 hover:underline`,children:[e,(0,O.jsx)(a,{"aria-hidden":!0,className:`size-3 text-ink-4`})]}):(0,O.jsx)(`span`,{className:`font-medium text-[0.875rem] text-ink`,children:e}),n?(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:n}):null,(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:r})]}),i?(0,O.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:i}):null]})}function j({title:e,hint:t,children:n}){return(0,O.jsxs)(`section`,{className:`mt-6`,children:[(0,O.jsx)(`h3`,{className:`border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:e}),t?(0,O.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3`,children:t}):null,n]})}function M({credits:e}){return(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:e.map(e=>(0,O.jsx)(A,{name:e.name,homepage:e.homepage,license:e.license,description:h(e.description)},e.name))})}function N({label:e,packages:t}){return(0,O.jsxs)(`div`,{className:`mt-4`,children:[(0,O.jsx)(`h4`,{className:`font-medium text-[0.75rem] text-ink-3 tracking-wide`,children:e}),(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:t.map(e=>(0,O.jsx)(A,{...e},e.name))})]})}function P({active:e}){let[t,n]=(0,T.useState)(null),[r,a]=(0,T.useState)(``);(0,T.useEffect)(()=>{if(!e||t)return;let r=!1;return p(()=>import(`./oss-credits-Da4KrYmP.js`).then(e=>{r||n(e.default)}),[]),()=>{r=!0}},[e,t]),(0,T.useEffect)(()=>{e||a(``)},[e]);let s=r.trim().toLowerCase(),c=e=>s?e.filter(e=>k(s,e.name,e.license,h(e.description))):e,l=e=>s?e.filter(e=>k(s,e.name,e.license,e.version)):e,u=c(E),d=c(D),m=t?[{id:`shared`,label:h(`about.creditsShared`),packages:l(t.shared)},...t.groups.map(e=>({id:e.id,label:e.label,packages:l(e.packages)}))].filter(e=>e.packages.length>0):[],g=u.length===0&&d.length===0&&m.length===0;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`mb-4 text-[0.875rem] text-ink-3`,children:h(`about.creditsHint`)}),(0,O.jsx)(o,{type:`search`,value:r,placeholder:h(`about.search`),onChange:e=>a(e.target.value)}),u.length>0?(0,O.jsx)(j,{title:h(`about.creditsProduct`),children:(0,O.jsx)(M,{credits:u})}):null,d.length>0?(0,O.jsx)(j,{title:h(`about.creditsBuiltWith`),children:(0,O.jsx)(M,{credits:d})}):null,t===null?(0,O.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,O.jsx)(f,{})}):m.length>0?(0,O.jsx)(j,{title:h(`about.creditsDeps`),hint:s?void 0:h(`about.creditsDepsHint`),children:m.map(e=>(0,O.jsx)(N,{label:e.label,packages:e.packages},e.id))}):null,t!==null&&g?(0,O.jsx)(i,{children:h(`about.noMatches`)}):null]})}var F=[`new`,`earlier`,`credits`],I=e=>h(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),L=e=>e===1?h(`about.change`):h(`about.changes`,{n:e});function R({me:e,active:t,initialTab:n=`new`}){let i=e?.mode===`local`,{data:a,latest:o}=g(i&&t),[s,u]=(0,T.useState)(null),[d,p]=(0,T.useState)(n);(0,T.useEffect)(()=>p(n),[n]);let E=b(F.indexOf(d)),D=a?.newer&&o?o:_;(0,T.useEffect)(()=>{if(!t)return;let e=!1;return u(null),S(D===`0.12.0`?void 0:D).then(t=>{e||u(t)}),()=>{e=!0}},[t,D]);let k=s?.find(e=>e.version===`v${D}`)??s?.[0]??null,A=s?.filter(e=>e!==k)??[],j=i?a?.kind??null:`cloud`;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`flex flex-col items-center pt-4 text-center`,children:[(0,O.jsx)(m,{size:96}),(0,O.jsxs)(`div`,{className:`mt-4 font-display font-semibold text-[1.5rem] tracking-tight`,children:[`engenty`,(0,O.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,O.jsx)(`span`,{className:`ml-1.5 font-normal text-ink-3`,children:`wizards`})]}),(0,O.jsxs)(`div`,{className:`mt-1 text-[0.9375rem] text-ink-3 tabular-nums`,children:[h(`about.version`,{v:_}),j?` · ${h(`about.kind.${j}`)}`:``]})]}),i?(0,O.jsx)(`div`,{className:`mt-5`,children:(0,O.jsx)(v,{enabled:t})}):null,(0,O.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,O.jsx)(c,{value:d,onChange:p,options:F.map(e=>({id:e,label:I(e)})),label:h(`about.title`)})}),(0,O.jsxs)(`div`,{className:l(`mt-5`,y(E)),children:[d===`new`?s===null?(0,O.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,O.jsx)(f,{})}):k?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[w(k),(0,O.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:C(k)})]}),(0,O.jsx)(`div`,{className:`mt-3`,children:(0,O.jsx)(x,{release:k})})]}):(0,O.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:h(`about.changelogEmpty`)}):null,d===`earlier`?(0,O.jsx)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:A.map(e=>(0,O.jsxs)(`details`,{className:`group/r py-2`,children:[(0,O.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-baseline gap-3 text-[0.875rem] [&::-webkit-details-marker]:hidden`,children:[(0,O.jsx)(r,{className:`size-3.5 shrink-0 self-center text-ink-4 transition group-open/r:rotate-90`}),(0,O.jsx)(`span`,{className:`font-medium text-ink tabular-nums`,children:w(e)}),(0,O.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:C(e)}),(0,O.jsx)(`span`,{className:`ml-auto text-[0.8125rem] text-ink-4`,children:L(e.commits.length)})]}),(0,O.jsx)(`div`,{className:`mt-2 pl-6`,children:(0,O.jsx)(x,{release:e})})]},e.version??`unreleased`))}):null,d===`credits`?(0,O.jsx)(P,{active:!0}):null]},d)]})}function z({open:e,onClose:t,me:n}){return(0,O.jsxs)(u,{open:e,onClose:t,wide:!0,height:`tall`,children:[(0,O.jsx)(`div`,{className:`-mt-2 -mr-2 sticky top-0 z-10 flex h-0 justify-end`,children:(0,O.jsx)(s,{label:h(`common.close`),onClick:t,children:(0,O.jsx)(d,{className:`size-4`})})}),(0,O.jsx)(R,{me:n,active:e})]})}export{z as AboutDialog,R as AboutPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{Jt as r,Xt as i,on as a,qt as o,tn as s}from"./ui-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{Jt as r,Xt as i,on as a,qt as o,tn as s}from"./ui-CU-cIuyK.js";import{t as c}from"./preload-helper-DpV6A1kQ.js";import{s as l}from"./i18n-7CvqRUdn.js";var u=e(t(),1),d=e(n(),1);function f(e){switch(e.group){case`Added`:return{label:`NEW`,dot:`bg-moss`};case`Fixed`:return{label:`FIXED`,dot:`bg-amber`};case`Changed`:return{label:`CHANGED`,dot:`bg-cobalt`};case`Performance`:return{label:`PERFORMANCE`,dot:`bg-ember`};case`Deploy`:return{label:`DEPLOY`,dot:`bg-ink-4`};case`Docs`:return{label:`DOCS`,dot:`bg-ink-4`};default:return{label:`OTHER`,dot:`bg-ink-4`}}}var p=e=>e.version?e.version.replace(/^v/,``):l(`about.unreleased`),m=e=>e.timestamp?new Date(e.timestamp*1e3).toISOString().slice(0,10):``,h=e=>e.charAt(0).toUpperCase()+e.slice(1);function g(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=[];for(let t of e){if(`${p(t)} ${m(t)}`.toLowerCase().includes(n)){r.push(t);continue}let e=t.commits.filter(e=>`${f(e).label} ${e.scope??``} ${e.message}`.toLowerCase().includes(n));e.length>0&&r.push({...t,commits:e})}return r}async function _(e){if(e)try{let t=await fetch(`https://raw.githubusercontent.com/engenty/wizards/v${e}/apps/web/src/about/changelog.json`,{signal:AbortSignal.timeout(5e3)});if(t.ok)return await t.json()}catch{}return(await c(async()=>{let{default:e}=await import(`./changelog-iTu1De5h.js`);return{default:e}},[])).default}function v({release:e}){return(0,d.jsx)(`ul`,{className:`flex flex-col gap-2`,children:e.commits.map(e=>{let t=f(e);return(0,d.jsxs)(`li`,{className:`flex items-start gap-2.5 text-[0.875rem]`,children:[(0,d.jsx)(`span`,{className:a(`mt-[7px] size-1.5 shrink-0 rounded-full`,t.dot)}),(0,d.jsxs)(`span`,{className:`min-w-0 text-ink-2`,children:[(0,d.jsxs)(`span`,{className:`font-semibold text-[0.75rem] text-ink tracking-wide`,children:[t.label,e.scope?` [${e.scope}]`:``]}),` `,h(e.message),e.breaking?(0,d.jsx)(`span`,{className:`ml-1.5 rounded-full bg-rose-tint px-1.5 py-0.5 font-medium text-[0.75rem] text-rose`,children:l(`about.breaking`)}):null]})]},e.id)})})}function y({open:e,onClose:t,version:n}){let[a,c]=(0,u.useState)(null),[f,h]=(0,u.useState)(``);(0,u.useEffect)(()=>{if(!e||a)return;let t=!1;return _(n).then(e=>{t||c(e)}),()=>{t=!0}},[e,a,n]),(0,u.useEffect)(()=>{e||h(``)},[e]);let y=a?g(a,f):[];return(0,d.jsxs)(o,{open:e,onClose:t,title:l(`about.changelog`),wide:!0,height:`tall`,children:[(0,d.jsx)(`p`,{className:`-mt-3 mb-4 text-[0.875rem] text-ink-3`,children:l(`about.changelogHint`)}),a===null?(0,d.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,d.jsx)(s,{})}):a.length===0?(0,d.jsx)(r,{children:l(`about.changelogEmpty`)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i,{type:`search`,value:f,placeholder:l(`about.search`),onChange:e=>h(e.target.value)}),y.length===0?(0,d.jsx)(r,{children:l(`about.noMatches`)}):null,y.map(e=>(0,d.jsxs)(`section`,{className:`mt-6`,children:[(0,d.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[p(e),(0,d.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:m(e)})]}),(0,d.jsx)(`div`,{className:`mt-3`,children:(0,d.jsx)(v,{release:e})})]},e.version??`unreleased`))]})]})}export{y as ChangelogDialog,v as ReleaseNotes,_ as loadReleases,m as releaseDate,p as releaseLabel};
|