wizards 0.4.5 → 0.4.7
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/docs/dev/plugins/reference.md +3 -2
- package/apps/runtime/dist/docs/dev/plugins/runners.md +38 -2
- package/apps/runtime/dist/docs/dev/plugins/server.md +3 -2
- package/apps/runtime/dist/docs/dev/plugins/studio.md +2 -1
- package/apps/runtime/dist/plugins/channels.js +1 -0
- package/apps/runtime/dist/services/runners.js +17 -2
- package/apps/web/dist/assets/{AboutDialog-BCtnYRj2.js → AboutDialog-BtAuA44m.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-DBjoIIHL.js → ChangelogDialog-Cm25slr3.js} +1 -1
- package/apps/web/dist/assets/ChatView-BXtXWnqK.js +10 -0
- package/apps/web/dist/assets/EditorPage-B4jX_Ckc.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-BtpAdyt-.js → FlowPreview-BsfjDVv8.js} +1 -1
- package/apps/web/dist/assets/{Harness-DJJ_yMLY.js → Harness-B0hD5Pp7.js} +2 -2
- package/apps/web/dist/assets/{NewWizardChannels-BrYLMV6F.js → NewWizardChannels-DMDp9Ao5.js} +1 -1
- package/apps/web/dist/assets/NewWizardPage-aOisxyk2.js +7 -0
- package/apps/web/dist/assets/{OnboardingPage-jC6FidpF.js → OnboardingPage-Czb0pOyy.js} +1 -1
- package/apps/web/dist/assets/ProjectPage-DPCtb42K.js +1 -0
- package/apps/web/dist/assets/PublicRunner-CvyA-gkf.js +1 -0
- package/apps/web/dist/assets/{ReadOnly-B4nIGkoj.js → ReadOnly-DFysMEMF.js} +1 -1
- package/apps/web/dist/assets/RunDrawer-BCiPEz9g.js +4 -0
- package/apps/web/dist/assets/{RunnerView-CDCp61aq.js → RunnerView-4z6DMzE6.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-BKkOfz6P.js +1 -0
- package/apps/web/dist/assets/SetupPage-YFoU_nXK.js +1 -0
- package/apps/web/dist/assets/{SharePage-Bs4s73h4.js → SharePage-BBHiJ34e.js} +1 -1
- package/apps/web/dist/assets/changelog-D8WjOq7d.js +1 -0
- package/apps/web/dist/assets/{circle-alert-BueS7qO8.js → circle-alert-BVj6idzu.js} +1 -1
- package/apps/web/dist/assets/{esm-CjGdsKU4.js → esm-hSq-jeOG.js} +1 -1
- package/apps/web/dist/assets/index-CSeBGwy0.css +1 -0
- package/apps/web/dist/assets/index-DB_iwB35.js +14 -0
- package/apps/web/dist/assets/{lock-CkXYnQux.js → lock-BoWS-JhN.js} +1 -1
- package/apps/web/dist/assets/{phone-CHkEf-Dz.js → phone-CeqyvwK-.js} +1 -1
- package/apps/web/dist/assets/{settings-menu-CrVpArM_.js → settings-menu-BK8WpcGv.js} +1 -1
- package/apps/web/dist/assets/{ui-DrdqFaQt.js → ui-BbIh6SOJ.js} +28 -28
- package/apps/web/dist/assets/{upload-CzkkZqAo.js → upload-BQrAlHIG.js} +1 -1
- package/apps/web/dist/index.html +3 -3
- package/apps/web/dist/mcp/flow.html +2 -2
- package/node_modules/@engenty-wizards/plugin-sdk/dist/index.d.ts +24 -2
- package/node_modules/@engenty-wizards/plugin-sdk/dist/studio.d.ts +52 -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/node_modules/@engenty-wizards/shared/dist/runners.d.ts +12 -0
- package/package.json +1 -1
- package/apps/web/dist/assets/ChatView-BcyUYN0Q.js +0 -10
- package/apps/web/dist/assets/EditorPage-Ce1QD-DK.js +0 -3
- package/apps/web/dist/assets/NewWizardPage-827zwhhW.js +0 -7
- package/apps/web/dist/assets/ProjectPage-BYcM1-1H.js +0 -1
- package/apps/web/dist/assets/PublicRunner-BofZl0MO.js +0 -1
- package/apps/web/dist/assets/RunDrawer-Dx-BRCkY.js +0 -4
- package/apps/web/dist/assets/SettingsPage-B49nLHwv.js +0 -1
- package/apps/web/dist/assets/SetupPage-4tzzHUq0.js +0 -1
- package/apps/web/dist/assets/changelog-D-12LwZB.js +0 -1
- package/apps/web/dist/assets/index-BRDn-5v_.js +0 -14
- package/apps/web/dist/assets/index-mlnAPOdf.css +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Reference
|
|
3
3
|
description: Every call, type, address and setting of the plugin framework on one page.
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.4
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## Server half
|
|
@@ -43,7 +43,7 @@ The default export is a `WizardsPluginFactory`: `(wizards: WizardsPluginApi) =>
|
|
|
43
43
|
| `publicRef(): Promise<string>` | [Routes](./routes.md#shared-routes). The part of `publicUrl` that names the current tenant |
|
|
44
44
|
| `registerSharedRoute(route: PluginSharedRoute)` | [Routes](./routes.md#shared-routes). One route for every tenant; `handler({ request, path, params, query, inTenant })` |
|
|
45
45
|
| `sharedUrl(path): string` | The full address of a shared route, the same for every tenant |
|
|
46
|
-
| `channels.get()`, `.request({ userId, country, wish?, lang })`, `.withdraw()`, `.book({ kind, quantity, key, runId? })` | [Numbers of the Manage-App](./server.md#numbers-of-the-manage-app). `get`: `{ number, request, shared }` or `null` without a Manage-App |
|
|
46
|
+
| `channels.get()`, `.request({ userId, country, wish?, lang })`, `.withdraw()`, `.book({ kind, quantity, key, runId? })` | [Numbers of the Manage-App](./server.md#numbers-of-the-manage-app). `get`: `{ number, request, shared, allowed }` or `null` without a Manage-App |
|
|
47
47
|
| `registerMigrations(folder: string)` | [Tables](./tables.md). The folder is relative to the plugin's |
|
|
48
48
|
| `on(event, listener)` | [Events](./events.md). `event`: `"run.done"`, `"run.failed"`, `"run.cancelled"`, `"space.created"`, `"space.updated"`, `"space.deleted"`, `"space.file.ready"`, `"space.file.removed"` |
|
|
49
49
|
| `every(name, everyMs, handler)` | [Jobs](./server.md#jobs). Per tenant that has the plugin, at most once per `everyMs` (a minute at least). `handler({ tenantId, lastRun, signal })` |
|
|
@@ -243,6 +243,7 @@ The default export is a `StudioPlugin`: `(studio: StudioPluginContext) => void`.
|
|
|
243
243
|
| `studio.registerNav({ to, label, icon })` | An icon in the app bar. `label: () => string` |
|
|
244
244
|
| `studio.registerSettingsSection({ id, label, icon, component, menu? })` | A section at `/studio/settings/<id>` |
|
|
245
245
|
| `studio.registerShareSection({ runner, component })` | [Runners](./runners.md#the-runners-part-of-the-share-dialog). The runner's own settings for a wizard (a keyword), under the share dialog's gear once it is switched on and set up. `component` gets `{ wizard: { id, title } }` |
|
|
246
|
+
| `studio.registerShareSetup({ runner, title, component, notice? })` | [Runners](./runners.md#setting-up-inside-the-dialog). What "Einrichten" in the runner's row opens inside the share dialog. `component` gets `{ wizard, Actions, done(banner?) }`, `notice` `{ wizard, open }` |
|
|
246
247
|
| `studio.registerAssistantCard({ tool, component })` | Draws a tool's result in the space assistant's chat. `component` gets `{ data, send }` |
|
|
247
248
|
| `studio.registerSpaceSection({ id, group?, label, hint?, component })` | A section of a part of the space page at `/studio/space/<group>#<id>`; `group`: `info`, `knowledge` (default), `data` or `results` |
|
|
248
249
|
| `studio.registerSpacePart({ id, label, icon, after?, component })` | [A part of the plugin's own](./studio.md#a-part-of-the-plugins-own) at `/studio/space/<id>`, after `info`, `knowledge` or `data` (default) in the menu |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Runners
|
|
3
3
|
description: A door a wizard runs through, beside the page and the chat — a call, a messenger, a kiosk — and the run API that drives runs from it.
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.4
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
A runner is a way to run a wizard. The runtime has four: the stepped page at `/w/<token>`, the
|
|
@@ -37,7 +37,7 @@ server.registerRunner({
|
|
|
37
37
|
| `kind` | `page`: the person opens an address. `channel`: the runner has an address of its own (a number, a bot) and drives runs from its webhooks |
|
|
38
38
|
| `capabilities` | What the runner takes in and shows; see below |
|
|
39
39
|
| `page` | A page runner's handler: what `/w/<token>/<id>` answers with. Nobody is signed in. A page runner without one throws when it is registered |
|
|
40
|
-
| `problem` | `() => string \| null`, may be async: why the runner cannot be used in the current tenant right now ("Not connected: Settings → WhatsApp"), asked inside the tenant whenever the studio lists the runners.
|
|
40
|
+
| `problem` | `() => string \| { text, kind?, note?, plan? } \| null`, may be async: why the runner cannot be used in the current tenant right now ("Not connected: Settings → WhatsApp"), asked inside the tenant whenever the studio lists the runners. A text is something to set up: the share dialog's row says "Noch nicht eingerichtet" with "Einrichten". An object says its `kind`: `setup` (the same), `waiting` (asked for, waiting for someone else; the row has no button), `plan` (the tenant's plan does not have it; the row offers the plans, "`plan` ansehen"); `note` (`{ de, en }`) is what the row says instead ("Nummer angefragt", "Ab Pro") |
|
|
41
41
|
| `address` | A channel runner: `(wizard: { id, title, token }) => { number?, keyword?, link? } \| null`, may be async. Where a person reaches that wizard: the number, the keyword that picks it there, and a link that opens the channel with the keyword written (`sms:…`, `https://wa.me/…`). The share dialog shows the keyword and number under the runner's name, copies the link (else the number) and offers the link as a QR code. Asked for each wizard that has the runner on; null while it is not set up |
|
|
42
42
|
|
|
43
43
|
A page runner is served at `/w/<token>/<id>` for every wizard that switched it on. From
|
|
@@ -130,6 +130,42 @@ One section per runner. After a change, invalidating the query `["wizard-runners
|
|
|
130
130
|
redraws the row. The settings a channel needs once per tenant (the number, the token)
|
|
131
131
|
go into a [settings section](./studio.md).
|
|
132
132
|
|
|
133
|
+
### Setting up inside the dialog
|
|
134
|
+
|
|
135
|
+
What "Einrichten" in a row opens: without more, the plugin's settings section. A setup the studio
|
|
136
|
+
half registers opens inside the dialog instead, as a view with a back arrow, at the dialog's
|
|
137
|
+
height:
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
studio.registerShareSetup({
|
|
141
|
+
runner: "sms",
|
|
142
|
+
title: () => t("setupTitle"),
|
|
143
|
+
component: Setup,
|
|
144
|
+
notice: Notice,
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
function Setup({ wizard, Actions, done }: StudioShareSetupProps) {
|
|
148
|
+
return (
|
|
149
|
+
<>
|
|
150
|
+
<p>…</p>
|
|
151
|
+
<Actions>
|
|
152
|
+
<Button onClick={() => ask.mutate()}>Nummer anfragen</Button>
|
|
153
|
+
</Actions>
|
|
154
|
+
</>
|
|
155
|
+
);
|
|
156
|
+
// done({ title: "Nummer angefragt", text: "…", tone: "waiting" }) goes back.
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
| | |
|
|
161
|
+
|---|---|
|
|
162
|
+
| `title` | The view's heading, a function: the language can change |
|
|
163
|
+
| `component` | Gets `{ wizard: { id, title }, Actions, done }`. What it renders inside `Actions` goes to the foot of the dialog, where the dialog's own buttons are. `done(banner?)` goes back to the main view and asks the rows again; `banner` (`{ title, text?, tone? }`, `tone` `done` green or `waiting` plain) shows on top |
|
|
164
|
+
| `notice` | Optional: a banner above the rows while the runner has news ("Deine Nummer ist da"), drawn by the plugin, nothing while it has none. Gets `{ wizard, open }`; `open()` opens the setup. The dialog shows the first one of the runners that are on |
|
|
165
|
+
|
|
166
|
+
One setup per runner. A setup that asks the server for something calls the plugin's own routes;
|
|
167
|
+
the rows show what `problem` answers after `done`.
|
|
168
|
+
|
|
133
169
|
## A thread door from the SDK
|
|
134
170
|
|
|
135
171
|
A messenger runs a wizard one message at a time: a field per question, options to tap or to
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: The server half
|
|
3
3
|
description: The function a plugin exports, what it is handed, and the rules it runs under.
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.4
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
The server half is a file whose default export is a function. The runtime calls it once when the
|
|
@@ -97,7 +97,8 @@ the prices are the Manage-App's ([manage contract](https://github.com/engenty/wi
|
|
|
97
97
|
const channels = await server.channels.get();
|
|
98
98
|
// { number: { number: "+43…", country: "AT", kinds: ["sms", "call"], providerRef: "PN…" } | null,
|
|
99
99
|
// request: { id, country, wish, createdAt } | null,
|
|
100
|
-
// shared: [{ number, country, kinds }]
|
|
100
|
+
// shared: [{ number, country, kinds }],
|
|
101
|
+
// allowed: true } // false: the plan has no number of its own (Free)
|
|
101
102
|
|
|
102
103
|
await server.channels.request({ userId: request.user.id, country: "AT", lang: "de" });
|
|
103
104
|
await server.channels.book({ kind: "sms", quantity: segments, key: messageSid, runId });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: The studio half
|
|
3
3
|
description: Pages, icons in the app bar, sections of the settings and of the space page — written in React, built once, drawn inside the studio.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.4
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
The studio half is `ui/plugin.tsx`. Its default export is a function; the studio calls it after
|
|
@@ -89,6 +89,7 @@ export default defineStudioPlugin((studio) => {
|
|
|
89
89
|
| `studio.registerSettingsSection({ id, label, icon, component, menu? })` | A section of the settings at `/studio/settings/<id>`. `menu`: the user menu links to it directly |
|
|
90
90
|
| `studio.registerSpaceSection({ id, group?, label, hint?, component })` | A section of a part of the space page at `/studio/space/<group>#<id>`, below the part's own. See [The space](#the-space) |
|
|
91
91
|
| `studio.registerShareSection({ runner, component })` | A runner's own settings for a wizard (a keyword), under the share dialog's gear once the runner is on and set up. See [Runners](./runners.md#the-runners-part-of-the-share-dialog) |
|
|
92
|
+
| `studio.registerShareSetup({ runner, title, component, notice? })` | What "Einrichten" in the runner's row opens: a view inside the share dialog, with its buttons at the dialog's foot, and a banner of the runner's news. See [Runners](./runners.md#setting-up-inside-the-dialog) |
|
|
92
93
|
| `studio.registerAssistantCard({ tool, component })` | A card in the assistant's chat for what a tool of the server half returned. See [The space](./space.md#a-card-in-the-chat) |
|
|
93
94
|
|
|
94
95
|
- The studio's own addresses are taken: `/new`, `/edit`, `/settings`, `/space`, `/setup`,
|
|
@@ -22,17 +22,32 @@ export async function runnersOf(tenantId = currentTenant()) {
|
|
|
22
22
|
// A plugin's runner says per tenant whether it is ready (a number connected, a key set).
|
|
23
23
|
const ofPlugins = await Promise.all(plugins.flatMap((p) => [...p.runners.values()].map(async (r) => ({
|
|
24
24
|
...r.info,
|
|
25
|
-
|
|
25
|
+
...problemOf(r.problem
|
|
26
26
|
? await Promise.resolve()
|
|
27
27
|
.then(() => r.problem?.() ?? null)
|
|
28
28
|
.catch((err) => err.message || "The runner is not ready.")
|
|
29
|
-
: null,
|
|
29
|
+
: null),
|
|
30
30
|
}))));
|
|
31
31
|
return [
|
|
32
32
|
...BUILT_IN_RUNNERS.map((r) => CONVERSATION_RUNNERS.includes(r.id) ? { ...r, problem: talk } : r),
|
|
33
33
|
...ofPlugins,
|
|
34
34
|
];
|
|
35
35
|
}
|
|
36
|
+
/** A runner's answer to `problem`, as the studio lists it. */
|
|
37
|
+
function problemOf(answer) {
|
|
38
|
+
if (!answer) {
|
|
39
|
+
return { problem: null };
|
|
40
|
+
}
|
|
41
|
+
if (typeof answer === "string") {
|
|
42
|
+
return { problem: answer, problemKind: "setup" };
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
problem: answer.text || "The runner is not ready.",
|
|
46
|
+
problemKind: answer.kind ?? "setup",
|
|
47
|
+
problemNote: answer.note ?? null,
|
|
48
|
+
problemPlan: answer.kind === "plan" ? (answer.plan ?? null) : null,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
36
51
|
/**
|
|
37
52
|
* How a wizard is offered, on the runners there are: a runner switched on that is gone (a
|
|
38
53
|
* plugin the tenant lost) is left out, and the link opens the first one left.
|
|
@@ -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{In as r,Jt as i,Vn as a,Xt as o,Yt as s,cn as c,dn as l,in as u,on as d,pn as f,qt as p,tn as m}from"./ui-DrdqFaQt.js";import{t as h}from"./preload-helper-CNEI7N0N.js";import{H as g,U as _,W as v,_t as y}from"./index-BRDn-5v_.js";import{c as b,f as x}from"./settings-menu-CrVpArM_.js";import{ReleaseNotes as S,loadReleases as C,releaseDate as w,releaseLabel as T}from"./ChangelogDialog-DBjoIIHL.js";var E=e(t(),1),D=[{name:`engenty wizards`,description:{de:`KI-Wizards aus einer Beschreibung, mit einem Link geteilt.`,en:`AI wizards built from a description, shared with a link.`},homepage:`https://github.com/engenty/wizards`,license:`FSL-1.1-MIT`},{name:`engenty`,description:{de:`Konnektoren, Datentabellen, Suche und die Engenties stammen aus dem engenty-Framework.`,en:`Connectors, data tables, search and the engenties come from the engenty framework.`},homepage:`https://github.com/engenty/engenty`,license:`FSL-1.1-MIT`}],O=[{name:`Mastra`,description:{de:`Agent-Framework hinter den KI-Schritten.`,en:`Agent framework behind the AI steps.`},homepage:`https://github.com/mastra-ai/mastra`,license:`Apache-2.0`},{name:`AI SDK`,description:{de:`Modell-Aufrufe für Text, Bild, Video und Sprache.`,en:`Model calls for text, image, video and speech.`},homepage:`https://github.com/vercel/ai`,license:`Apache-2.0`},{name:`Model Context Protocol`,description:{de:`MCP-Server zum Bauen von Wizards, MCP-Client für Werkzeuge der Schritte.`,en:`MCP server for building wizards, MCP client for the steps' tools.`},homepage:`https://github.com/modelcontextprotocol/typescript-sdk`,license:`MIT`},{name:`Hono`,description:{de:`HTTP-API der Runtime.`,en:`The runtime's HTTP API.`},homepage:`https://github.com/honojs/hono`,license:`MIT`},{name:`Drizzle ORM`,description:{de:`Schema und Migrationen der Datenbanken.`,en:`Schema and migrations of the databases.`},homepage:`https://github.com/drizzle-team/drizzle-orm`,license:`Apache-2.0`},{name:`libSQL`,description:{de:`Eine Datenbank je Mandant, lokal als Datei oder bei Turso.`,en:`One database per tenant, a local file or at Turso.`},homepage:`https://github.com/tursodatabase/libsql`,license:`MIT`},{name:`Playwright`,description:{de:`Browser-Schritte sowie PDF- und PNG-Export.`,en:`Browser steps and the PDF and PNG export.`},homepage:`https://github.com/microsoft/playwright`,license:`Apache-2.0`},{name:`agentOS`,description:{de:`Sandbox für Code-Schritte ohne Docker.`,en:`Sandbox for code steps without Docker.`},homepage:`https://github.com/rivet-dev/agentos`,license:`Apache-2.0`},{name:`React`,description:{de:`UI-Bibliothek der Web-App.`,en:`UI library of the web app.`},homepage:`https://github.com/facebook/react`,license:`MIT`},{name:`Vite`,description:{de:`Build-Werkzeug der Web-App.`,en:`Build tool of the web app.`},homepage:`https://github.com/vitejs/vite`,license:`MIT`},{name:`Tailwind CSS`,description:{de:`Styling der Oberfläche.`,en:`Styling of the interface.`},homepage:`https://github.com/tailwindlabs/tailwindcss`,license:`MIT`},{name:`React Flow`,description:{de:`Das Diagramm der Schritte im Editor.`,en:`The diagram of steps in the editor.`},homepage:`https://github.com/xyflow/xyflow`,license:`MIT`},{name:`TanStack Query`,description:{de:`Server-Daten in der Web-App.`,en:`Server data in the web app.`},homepage:`https://github.com/TanStack/query`,license:`MIT`},{name:`xterm.js`,description:{de:`Das Terminal auf der Seite, in dem sich KI-Clients anmelden.`,en:`The terminal on the page where AI clients sign in.`},homepage:`https://github.com/xtermjs/xterm.js`,license:`MIT`},{name:`Lucide`,description:{de:`Icons.`,en:`Icons.`},homepage:`https://github.com/lucide-icons/lucide`,license:`ISC`},{name:`Geist & Geist Mono`,description:{de:`Schrift der Oberfläche.`,en:`Typeface of the interface.`},homepage:`https://github.com/vercel/geist-font`,license:`OFL-1.1`},{name:`Space Grotesk`,description:{de:`Schrift der Überschriften.`,en:`Typeface of the headings.`},homepage:`https://github.com/floriankarsten/space-grotesk`,license:`OFL-1.1`},{name:`git-cliff`,description:{de:`Erzeugt den Changelog aus den Commits.`,en:`Generates the changelog from the commits.`},homepage:`https://github.com/orhun/git-cliff`,license:`MIT OR Apache-2.0`}],k=e(n(),1),A=(e,...t)=>t.some(t=>t?.toLowerCase().includes(e));function j({name:e,homepage:t,version:n,license:i,description:a}){return(0,k.jsxs)(`li`,{className:`py-2.5`,children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,children:[t?(0,k.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,k.jsx)(r,{"aria-hidden":!0,className:`size-3 text-ink-4`})]}):(0,k.jsx)(`span`,{className:`font-medium text-[0.875rem] text-ink`,children:e}),n?(0,k.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:n}):null,(0,k.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:i})]}),a?(0,k.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:a}):null]})}function M({title:e,hint:t,children:n}){return(0,k.jsxs)(`section`,{className:`mt-6`,children:[(0,k.jsx)(`h3`,{className:`border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:e}),t?(0,k.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3`,children:t}):null,n]})}function N({credits:e}){return(0,k.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:e.map(e=>(0,k.jsx)(j,{name:e.name,homepage:e.homepage,license:e.license,description:e.description[c]},e.name))})}function P({label:e,packages:t}){return(0,k.jsxs)(`div`,{className:`mt-4`,children:[(0,k.jsx)(`h4`,{className:`font-medium text-[0.75rem] text-ink-3 tracking-wide`,children:e}),(0,k.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:t.map(e=>(0,k.jsx)(j,{...e},e.name))})]})}function F({active:e}){let[t,n]=(0,E.useState)(null),[r,a]=(0,E.useState)(``);(0,E.useEffect)(()=>{if(!e||t)return;let r=!1;return h(()=>import(`./oss-credits-BQQX0kvk.js`).then(e=>{r||n(e.default)}),[]),()=>{r=!0}},[e,t]),(0,E.useEffect)(()=>{e||a(``)},[e]);let s=r.trim().toLowerCase(),c=e=>s?e.filter(e=>A(s,e.name,e.license,e.description.de,e.description.en)):e,u=e=>s?e.filter(e=>A(s,e.name,e.license,e.version)):e,d=c(D),f=c(O),p=t?[{id:`shared`,label:l(`about.creditsShared`),packages:u(t.shared)},...t.groups.map(e=>({id:e.id,label:e.label,packages:u(e.packages)}))].filter(e=>e.packages.length>0):[],g=d.length===0&&f.length===0&&p.length===0;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`p`,{className:`mb-4 text-[0.875rem] text-ink-3`,children:l(`about.creditsHint`)}),(0,k.jsx)(o,{type:`search`,value:r,placeholder:l(`about.search`),onChange:e=>a(e.target.value)}),d.length>0?(0,k.jsx)(M,{title:l(`about.creditsProduct`),children:(0,k.jsx)(N,{credits:d})}):null,f.length>0?(0,k.jsx)(M,{title:l(`about.creditsBuiltWith`),children:(0,k.jsx)(N,{credits:f})}):null,t===null?(0,k.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,k.jsx)(m,{})}):p.length>0?(0,k.jsx)(M,{title:l(`about.creditsDeps`),hint:s?void 0:l(`about.creditsDepsHint`),children:p.map(e=>(0,k.jsx)(P,{label:e.label,packages:e.packages},e.id))}):null,t!==null&&g?(0,k.jsx)(i,{children:l(`about.noMatches`)}):null]})}var I=[`new`,`earlier`,`credits`],L=e=>l(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),R=e=>e===1?l(`about.change`):l(`about.changes`,{n:e});function z({open:e,onClose:t,me:n}){let r=n?.mode===`local`,{data:i,latest:o}=v(r&&e),[c,h]=(0,E.useState)(null),[D,O]=(0,E.useState)(`new`),A=x(I.indexOf(D)),j=i?.newer&&o?o:_;(0,E.useEffect)(()=>{if(!e)return;let t=!1;return h(null),C(j===`0.4.5`?void 0:j).then(e=>{t||h(e)}),()=>{t=!0}},[e,j]);let M=c?.find(e=>e.version===`v${j}`)??c?.[0]??null,N=c?.filter(e=>e!==M)??[],P=r?i?.kind??null:`cloud`;return(0,k.jsxs)(p,{open:e,onClose:t,wide:!0,height:`tall`,children:[(0,k.jsx)(`div`,{className:`-mt-2 -mr-2 sticky top-0 z-10 flex h-0 justify-end`,children:(0,k.jsx)(s,{label:l(`common.close`),onClick:t,children:(0,k.jsx)(f,{className:`size-4`})})}),(0,k.jsxs)(`div`,{className:`flex flex-col items-center pt-4 text-center`,children:[(0,k.jsx)(y,{size:96}),(0,k.jsxs)(`div`,{className:`mt-4 font-display font-semibold text-[1.5rem] tracking-tight`,children:[`engenty`,(0,k.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,k.jsx)(`span`,{className:`ml-1.5 font-normal text-ink-3`,children:`wizards`})]}),(0,k.jsxs)(`div`,{className:`mt-1 text-[0.9375rem] text-ink-3 tabular-nums`,children:[l(`about.version`,{v:_}),P?` · ${l(`about.kind.${P}`)}`:``]})]}),r?(0,k.jsx)(`div`,{className:`mt-5`,children:(0,k.jsx)(g,{enabled:e})}):null,(0,k.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,k.jsx)(u,{value:D,onChange:O,options:I.map(e=>({id:e,label:L(e)})),label:l(`about.title`)})}),(0,k.jsxs)(`div`,{className:d(`mt-5`,b(A)),children:[D===`new`?c===null?(0,k.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,k.jsx)(m,{})}):M?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[T(M),(0,k.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:w(M)})]}),(0,k.jsx)(`div`,{className:`mt-3`,children:(0,k.jsx)(S,{release:M})})]}):(0,k.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:l(`about.changelogEmpty`)}):null,D===`earlier`?(0,k.jsx)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:N.map(e=>(0,k.jsxs)(`details`,{className:`group/r py-2`,children:[(0,k.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-baseline gap-3 text-[0.875rem] [&::-webkit-details-marker]:hidden`,children:[(0,k.jsx)(a,{className:`size-3.5 shrink-0 self-center text-ink-4 transition group-open/r:rotate-90`}),(0,k.jsx)(`span`,{className:`font-medium text-ink tabular-nums`,children:T(e)}),(0,k.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:w(e)}),(0,k.jsx)(`span`,{className:`ml-auto text-[0.8125rem] text-ink-4`,children:R(e.commits.length)})]}),(0,k.jsx)(`div`,{className:`mt-2 pl-6`,children:(0,k.jsx)(S,{release:e})})]},e.version??`unreleased`))}):null,D===`credits`?(0,k.jsx)(F,{active:!0}):null]},D)]})}export{z as AboutDialog};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{$t as r,Kn as i,Qt as a,Vn as o,dn as s,en as c,gn as l,ln as u,on as d,pn as f,tn as p,vn as m}from"./ui-BbIh6SOJ.js";import{t as h}from"./preload-helper-CNEI7N0N.js";import{H as g,U as _,W as v,_t as y}from"./index-DB_iwB35.js";import{c as b,f as x}from"./settings-menu-BK8WpcGv.js";import{ReleaseNotes as S,loadReleases as C,releaseDate as w,releaseLabel as T}from"./ChangelogDialog-Cm25slr3.js";var E=e(t(),1),D=[{name:`engenty wizards`,description:{de:`KI-Wizards aus einer Beschreibung, mit einem Link geteilt.`,en:`AI wizards built from a description, shared with a link.`},homepage:`https://github.com/engenty/wizards`,license:`FSL-1.1-MIT`},{name:`engenty`,description:{de:`Konnektoren, Datentabellen, Suche und die Engenties stammen aus dem engenty-Framework.`,en:`Connectors, data tables, search and the engenties come from the engenty framework.`},homepage:`https://github.com/engenty/engenty`,license:`FSL-1.1-MIT`}],O=[{name:`Mastra`,description:{de:`Agent-Framework hinter den KI-Schritten.`,en:`Agent framework behind the AI steps.`},homepage:`https://github.com/mastra-ai/mastra`,license:`Apache-2.0`},{name:`AI SDK`,description:{de:`Modell-Aufrufe für Text, Bild, Video und Sprache.`,en:`Model calls for text, image, video and speech.`},homepage:`https://github.com/vercel/ai`,license:`Apache-2.0`},{name:`Model Context Protocol`,description:{de:`MCP-Server zum Bauen von Wizards, MCP-Client für Werkzeuge der Schritte.`,en:`MCP server for building wizards, MCP client for the steps' tools.`},homepage:`https://github.com/modelcontextprotocol/typescript-sdk`,license:`MIT`},{name:`Hono`,description:{de:`HTTP-API der Runtime.`,en:`The runtime's HTTP API.`},homepage:`https://github.com/honojs/hono`,license:`MIT`},{name:`Drizzle ORM`,description:{de:`Schema und Migrationen der Datenbanken.`,en:`Schema and migrations of the databases.`},homepage:`https://github.com/drizzle-team/drizzle-orm`,license:`Apache-2.0`},{name:`libSQL`,description:{de:`Eine Datenbank je Mandant, lokal als Datei oder bei Turso.`,en:`One database per tenant, a local file or at Turso.`},homepage:`https://github.com/tursodatabase/libsql`,license:`MIT`},{name:`Playwright`,description:{de:`Browser-Schritte sowie PDF- und PNG-Export.`,en:`Browser steps and the PDF and PNG export.`},homepage:`https://github.com/microsoft/playwright`,license:`Apache-2.0`},{name:`agentOS`,description:{de:`Sandbox für Code-Schritte ohne Docker.`,en:`Sandbox for code steps without Docker.`},homepage:`https://github.com/rivet-dev/agentos`,license:`Apache-2.0`},{name:`React`,description:{de:`UI-Bibliothek der Web-App.`,en:`UI library of the web app.`},homepage:`https://github.com/facebook/react`,license:`MIT`},{name:`Vite`,description:{de:`Build-Werkzeug der Web-App.`,en:`Build tool of the web app.`},homepage:`https://github.com/vitejs/vite`,license:`MIT`},{name:`Tailwind CSS`,description:{de:`Styling der Oberfläche.`,en:`Styling of the interface.`},homepage:`https://github.com/tailwindlabs/tailwindcss`,license:`MIT`},{name:`React Flow`,description:{de:`Das Diagramm der Schritte im Editor.`,en:`The diagram of steps in the editor.`},homepage:`https://github.com/xyflow/xyflow`,license:`MIT`},{name:`TanStack Query`,description:{de:`Server-Daten in der Web-App.`,en:`Server data in the web app.`},homepage:`https://github.com/TanStack/query`,license:`MIT`},{name:`xterm.js`,description:{de:`Das Terminal auf der Seite, in dem sich KI-Clients anmelden.`,en:`The terminal on the page where AI clients sign in.`},homepage:`https://github.com/xtermjs/xterm.js`,license:`MIT`},{name:`Lucide`,description:{de:`Icons.`,en:`Icons.`},homepage:`https://github.com/lucide-icons/lucide`,license:`ISC`},{name:`Geist & Geist Mono`,description:{de:`Schrift der Oberfläche.`,en:`Typeface of the interface.`},homepage:`https://github.com/vercel/geist-font`,license:`OFL-1.1`},{name:`Space Grotesk`,description:{de:`Schrift der Überschriften.`,en:`Typeface of the headings.`},homepage:`https://github.com/floriankarsten/space-grotesk`,license:`OFL-1.1`},{name:`git-cliff`,description:{de:`Erzeugt den Changelog aus den Commits.`,en:`Generates the changelog from the commits.`},homepage:`https://github.com/orhun/git-cliff`,license:`MIT OR Apache-2.0`}],k=e(n(),1),A=(e,...t)=>t.some(t=>t?.toLowerCase().includes(e));function j({name:e,homepage:t,version:n,license:r,description:i}){return(0,k.jsxs)(`li`,{className:`py-2.5`,children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,children:[t?(0,k.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,k.jsx)(o,{"aria-hidden":!0,className:`size-3 text-ink-4`})]}):(0,k.jsx)(`span`,{className:`font-medium text-[0.875rem] text-ink`,children:e}),n?(0,k.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:n}):null,(0,k.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:r})]}),i?(0,k.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:i}):null]})}function M({title:e,hint:t,children:n}){return(0,k.jsxs)(`section`,{className:`mt-6`,children:[(0,k.jsx)(`h3`,{className:`border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:e}),t?(0,k.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3`,children:t}):null,n]})}function N({credits:e}){return(0,k.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:e.map(e=>(0,k.jsx)(j,{name:e.name,homepage:e.homepage,license:e.license,description:e.description[f]},e.name))})}function P({label:e,packages:t}){return(0,k.jsxs)(`div`,{className:`mt-4`,children:[(0,k.jsx)(`h4`,{className:`font-medium text-[0.75rem] text-ink-3 tracking-wide`,children:e}),(0,k.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:t.map(e=>(0,k.jsx)(j,{...e},e.name))})]})}function F({active:e}){let[t,n]=(0,E.useState)(null),[i,a]=(0,E.useState)(``);(0,E.useEffect)(()=>{if(!e||t)return;let r=!1;return h(()=>import(`./oss-credits-BQQX0kvk.js`).then(e=>{r||n(e.default)}),[]),()=>{r=!0}},[e,t]),(0,E.useEffect)(()=>{e||a(``)},[e]);let o=i.trim().toLowerCase(),s=e=>o?e.filter(e=>A(o,e.name,e.license,e.description.de,e.description.en)):e,c=e=>o?e.filter(e=>A(o,e.name,e.license,e.version)):e,u=s(D),f=s(O),m=t?[{id:`shared`,label:l(`about.creditsShared`),packages:c(t.shared)},...t.groups.map(e=>({id:e.id,label:e.label,packages:c(e.packages)}))].filter(e=>e.packages.length>0):[],g=u.length===0&&f.length===0&&m.length===0;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`p`,{className:`mb-4 text-[0.875rem] text-ink-3`,children:l(`about.creditsHint`)}),(0,k.jsx)(p,{type:`search`,value:i,placeholder:l(`about.search`),onChange:e=>a(e.target.value)}),u.length>0?(0,k.jsx)(M,{title:l(`about.creditsProduct`),children:(0,k.jsx)(N,{credits:u})}):null,f.length>0?(0,k.jsx)(M,{title:l(`about.creditsBuiltWith`),children:(0,k.jsx)(N,{credits:f})}):null,t===null?(0,k.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,k.jsx)(d,{})}):m.length>0?(0,k.jsx)(M,{title:l(`about.creditsDeps`),hint:o?void 0:l(`about.creditsDepsHint`),children:m.map(e=>(0,k.jsx)(P,{label:e.label,packages:e.packages},e.id))}):null,t!==null&&g?(0,k.jsx)(r,{children:l(`about.noMatches`)}):null]})}var I=[`new`,`earlier`,`credits`],L=e=>l(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),R=e=>e===1?l(`about.change`):l(`about.changes`,{n:e});function z({open:e,onClose:t,me:n}){let r=n?.mode===`local`,{data:o,latest:f}=v(r&&e),[p,h]=(0,E.useState)(null),[D,O]=(0,E.useState)(`new`),A=x(I.indexOf(D)),j=o?.newer&&f?f:_;(0,E.useEffect)(()=>{if(!e)return;let t=!1;return h(null),C(j===`0.4.7`?void 0:j).then(e=>{t||h(e)}),()=>{t=!0}},[e,j]);let M=p?.find(e=>e.version===`v${j}`)??p?.[0]??null,N=p?.filter(e=>e!==M)??[],P=r?o?.kind??null:`cloud`;return(0,k.jsxs)(a,{open:e,onClose:t,wide:!0,height:`tall`,children:[(0,k.jsx)(`div`,{className:`-mt-2 -mr-2 sticky top-0 z-10 flex h-0 justify-end`,children:(0,k.jsx)(c,{label:l(`common.close`),onClick:t,children:(0,k.jsx)(m,{className:`size-4`})})}),(0,k.jsxs)(`div`,{className:`flex flex-col items-center pt-4 text-center`,children:[(0,k.jsx)(y,{size:96}),(0,k.jsxs)(`div`,{className:`mt-4 font-display font-semibold text-[1.5rem] tracking-tight`,children:[`engenty`,(0,k.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,k.jsx)(`span`,{className:`ml-1.5 font-normal text-ink-3`,children:`wizards`})]}),(0,k.jsxs)(`div`,{className:`mt-1 text-[0.9375rem] text-ink-3 tabular-nums`,children:[l(`about.version`,{v:_}),P?` · ${l(`about.kind.${P}`)}`:``]})]}),r?(0,k.jsx)(`div`,{className:`mt-5`,children:(0,k.jsx)(g,{enabled:e})}):null,(0,k.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,k.jsx)(u,{value:D,onChange:O,options:I.map(e=>({id:e,label:L(e)})),label:l(`about.title`)})}),(0,k.jsxs)(`div`,{className:s(`mt-5`,b(A)),children:[D===`new`?p===null?(0,k.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,k.jsx)(d,{})}):M?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[T(M),(0,k.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:w(M)})]}),(0,k.jsx)(`div`,{className:`mt-3`,children:(0,k.jsx)(S,{release:M})})]}):(0,k.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:l(`about.changelogEmpty`)}):null,D===`earlier`?(0,k.jsx)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:N.map(e=>(0,k.jsxs)(`details`,{className:`group/r py-2`,children:[(0,k.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-baseline gap-3 text-[0.875rem] [&::-webkit-details-marker]:hidden`,children:[(0,k.jsx)(i,{className:`size-3.5 shrink-0 self-center text-ink-4 transition group-open/r:rotate-90`}),(0,k.jsx)(`span`,{className:`font-medium text-ink tabular-nums`,children:T(e)}),(0,k.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:w(e)}),(0,k.jsx)(`span`,{className:`ml-auto text-[0.8125rem] text-ink-4`,children:R(e.commits.length)})]}),(0,k.jsx)(`div`,{className:`mt-2 pl-6`,children:(0,k.jsx)(S,{release:e})})]},e.version??`unreleased`))}):null,D===`credits`?(0,k.jsx)(F,{active:!0}):null]},D)]})}export{z as AboutDialog};
|
|
@@ -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{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{$t as r,Qt as i,dn as a,gn as o,on as s,tn as c}from"./ui-BbIh6SOJ.js";import{t as l}from"./preload-helper-CNEI7N0N.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/,``):o(`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/engenty-wizards/v${e}/apps/web/src/about/changelog.json`,{signal:AbortSignal.timeout(5e3)});if(t.ok)return await t.json()}catch{}return(await l(async()=>{let{default:e}=await import(`./changelog-D8WjOq7d.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:o(`about.breaking`)}):null]})]},e.id)})})}function y({open:e,onClose:t,version:n}){let[a,l]=(0,u.useState)(null),[f,h]=(0,u.useState)(``);(0,u.useEffect)(()=>{if(!e||a)return;let t=!1;return _(n).then(e=>{t||l(e)}),()=>{t=!0}},[e,a,n]),(0,u.useEffect)(()=>{e||h(``)},[e]);let y=a?g(a,f):[];return(0,d.jsxs)(i,{open:e,onClose:t,title:o(`about.changelog`),wide:!0,height:`tall`,children:[(0,d.jsx)(`p`,{className:`-mt-3 mb-4 text-[0.875rem] text-ink-3`,children:o(`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:o(`about.changelogEmpty`)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c,{type:`search`,value:f,placeholder:o(`about.search`),onChange:e=>h(e.target.value)}),y.length===0?(0,d.jsx)(r,{children:o(`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};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{$ as r,Bt as i,Cn as a,Ft as o,Lt as s,Mn as c,Pn as l,Rt as u,Sn as d,Tn as f,W as p,Yn as m,Zn as h,bt as g,dn as _,dt as v,en as y,fn as b,fr as x,ft as S,gn as C,kn as w,kt as T,lt as E,mt as D,nt as O,on as k,p as A,pn as j,pt as M,rn as N,rt as P,st as F,tr as I,tt as L,un as ee,ut as te,xn as R,yn as z,zt as ne}from"./ui-BbIh6SOJ.js";import{t as re}from"./phone-CeqyvwK-.js";import{Mt as ie,Q as ae,X as oe,Z as se,ft as ce,kt as le,t as ue,yt as de}from"./index-DB_iwB35.js";import{n as fe}from"./RunnerView-4z6DMzE6.js";var pe={name:`hand`,size:24,node:[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1fvzgz`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`,key:`1kc0my`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`,key:`10h0bg`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`1s1gnw`}]]};pe.node;var me=I(pe),he={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};he.node;var ge=I(he),_e={name:`video-off`,size:24,node:[[`path`,{d:`M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196`,key:`w8jjjt`}],[`path`,{d:`M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2`,key:`1xawa7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};_e.node;var B=I(_e),ve={name:`volume-x`,size:24,node:[[`path`,{d:`M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z`,key:`1p7khw`}],[`path`,{d:`m16.5 14.5 5-5`,key:`cul3yw`}],[`path`,{d:`m16.5 9.5 5 5`,key:`1akey5`}]]};ve.node;var ye=I(ve),be=x(),V=e(t(),1),H=e(n(),1),xe=typeof window<`u`&&window.matchMedia(`(pointer: coarse)`).matches;function Se({since:e}){let[t,n]=(0,V.useState)(Date.now());if((0,V.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),!e)return null;let r=Math.max(0,Math.floor((t-e)/1e3)),i=String(Math.floor(r/60)).padStart(2,`0`),a=String(r%60).padStart(2,`0`);return(0,H.jsxs)(`span`,{className:`font-mono text-[0.8125rem] text-white/60 tabular-nums`,children:[i,`:`,a]})}function U({label:e,on:t,danger:n,busy:r,onClick:i,children:a}){return(0,H.jsx)(`button`,{type:`button`,"aria-label":e,title:e,"aria-pressed":t,disabled:r,onClick:i,className:_(`flex size-12 items-center justify-center rounded-full transition disabled:opacity-50`,n?`bg-rose text-white hover:brightness-110`:t===!1?`bg-white text-neutral-900 hover:bg-white/90`:`bg-white/15 text-white hover:bg-white/25`),children:r?(0,H.jsx)(k,{className:`size-5`}):a})}function Ce({voice:e}){let t=(0,V.useRef)(null),{captions:n}=e;return(0,V.useEffect)(()=>{n.length&&t.current?.scrollIntoView({block:`end`})},[n]),n.length?(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 sm:px-5`,children:(0,H.jsxs)(`ol`,{className:`mx-auto flex max-w-[720px] flex-col gap-2 py-2`,children:[n.map(e=>(0,H.jsx)(`li`,{className:_(`text-[0.9375rem] leading-snug`,e.who===`bot`?`text-white/95`:`text-right text-white/50`),children:e.text},e.id)),(0,H.jsx)(`div`,{ref:t})]})}):null}function we({voice:e,view:t,video:n,className:r}){let i=e.state===`live`,a=e.state===`connecting`,[o,s]=(0,V.useState)(null),[c,u]=(0,V.useState)(!1);(0,V.useEffect)(()=>{s(i?Date.now():null)},[i]);let d=async()=>{u(!1),await e.start(),n&&await e.startCamera()},f=()=>{e.stop(),u(!0)},p=n||e.camera,m=[...e.captions].reverse().find(e=>e.who===`bot`),h=[...e.captions].reverse().find(e=>e.who===`me`),g=e.speaking?C(`talk.speaking`):e.listening?C(`talk.listening`):i?C(`talk.live`):a?C(`talk.connecting`):c?C(`video.ended`):``;return(0,H.jsxs)(`section`,{className:_(`relative flex min-h-0 flex-col bg-neutral-950 text-white`,`safe-top`,r),children:[(0,H.jsxs)(`div`,{className:`flex h-14 shrink-0 items-center gap-3 px-4 sm:px-5`,children:[(0,H.jsx)(`div`,{className:`min-w-0 flex-1 truncate font-display font-semibold text-[1rem] tracking-tight`,children:t?.wizard.title??``}),g?(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[0.8125rem] text-white/70`,children:[i?(0,H.jsx)(`span`,{className:_(`size-2 rounded-full`,e.speaking?`animate-pulse-dot bg-emerald-400`:`bg-rose`)}):null,g]}):null,(0,H.jsx)(Se,{since:o})]}),(0,H.jsxs)(`div`,{className:_(`grid min-h-0 gap-2 px-3 pb-2 sm:px-4`,p?`flex-1 grid-cols-1 sm:grid-cols-2`:`shrink-0 grid-cols-1`,!p&&i&&e.captions.length?`h-[38%]`:p?``:`flex-1`),children:[(0,H.jsxs)(`div`,{className:_(`relative min-h-0 overflow-hidden rounded-2xl bg-neutral-900`,!p&&`hidden`),children:[(0,H.jsx)(`video`,{ref:e.video,muted:!0,playsInline:!0,autoPlay:!0,className:_(`absolute inset-0 h-full w-full object-cover`,e.facing===`user`&&`-scale-x-100`,e.camera?`block`:`hidden`)}),e.camera?null:(0,H.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 text-white/50`,children:[(0,H.jsx)(B,{className:`size-8`}),(0,H.jsx)(`span`,{className:`text-[0.8125rem]`,children:C(`video.cameraOff`)})]}),(0,H.jsxs)(`span`,{className:`absolute bottom-2 left-3 rounded-md bg-black/50 px-2 py-0.5 text-[0.75rem]`,children:[C(`video.you`),e.muted?(0,H.jsx)(ie,{className:`ml-1.5 inline size-3`}):null]})]}),(0,H.jsxs)(`div`,{className:_(`relative flex min-h-0 items-center justify-center overflow-hidden rounded-2xl transition-shadow`,p?`bg-neutral-900`:`bg-transparent`,p&&e.speaking&&`ring-2 ring-emerald-400/70`),children:[(0,H.jsx)(`div`,{className:_(`rounded-full transition-shadow duration-500`,!p&&e.listening&&`shadow-[0_0_80px_20px_rgba(244,63,94,0.25)]`,!p&&e.speaking&&`shadow-[0_0_80px_20px_rgba(52,211,153,0.3)]`,e.speaking&&`animate-breathe`),children:(0,H.jsx)(ce,{kind:t?.wizard.avatar??`round`,size:p?140:200,fluffy:!0,interactive:!1})}),p?(0,H.jsx)(`span`,{className:`absolute bottom-2 left-3 max-w-[85%] truncate rounded-md bg-black/50 px-2 py-0.5 text-[0.75rem]`,children:t?.wizard.title??``}):null]})]}),i&&!p?(0,H.jsx)(Ce,{voice:e}):i&&(m||h)?(0,H.jsx)(`div`,{className:`shrink-0 px-4 pb-2 sm:px-5`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-[720px] space-y-1 text-center`,children:[h?(0,H.jsx)(`p`,{className:`line-clamp-1 text-[0.8125rem] text-white/50`,children:h.text}):null,m?(0,H.jsx)(`p`,{className:`line-clamp-3 text-[0.9375rem] text-white/95 leading-snug`,children:m.text}):null]})}):null,e.error?(0,H.jsx)(`p`,{className:`shrink-0 px-5 pb-2 text-center text-[0.8125rem] text-rose`,children:e.error}):null,(0,H.jsx)(`div`,{className:`flex shrink-0 items-center justify-center gap-3 px-4 pt-1 pb-4`,children:i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(U,{label:C(e.muted?`video.unmute`:`video.mute`),on:!e.muted,onClick:e.toggleMute,children:e.muted?(0,H.jsx)(ie,{className:`size-5`}):(0,H.jsx)(l,{className:`size-5`})}),(0,H.jsx)(U,{label:C(e.camera?`talk.cameraOff`:`talk.camera`),on:e.camera,onClick:()=>e.camera?e.stopCamera():void e.startCamera(),children:e.camera?(0,H.jsx)(z,{className:`size-5`}):(0,H.jsx)(B,{className:`size-5`})}),e.camera&&xe?(0,H.jsx)(U,{label:C(`video.flip`),onClick:()=>void e.flipCamera(),children:(0,H.jsx)(R,{className:`size-5`})}):null,(0,H.jsx)(U,{label:C(`video.leave`),danger:!0,onClick:f,children:(0,H.jsx)(le,{className:`size-5`})})]}):(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,disabled:a||!t?.talk,onClick:()=>void d(),className:`flex h-12 items-center gap-2 rounded-full bg-emerald-500 px-6 font-medium text-[0.9375rem] text-white transition hover:brightness-110 disabled:opacity-50`,children:[a?(0,H.jsx)(k,{className:`size-4`}):n?(0,H.jsx)(z,{className:`size-5`}):(0,H.jsx)(l,{className:`size-5`}),C(c?`video.rejoin`:n?`video.join`:`talk.start`)]}),!c&&!e.error?(0,H.jsx)(`p`,{className:`max-w-sm text-center text-[0.75rem] text-white/50`,children:C(n?`video.hint`:`talk.joinHint`)}):null]})})]})}var Te=e=>g[e.kind]!==`device`,Ee=1024,De=4e3;function W(e,t){return e?e.length>t?`${e.slice(0,t)} …`:e:``}function Oe(e,t,n=!1){let r=[`status: ${e.status}`,`camera: ${n?`on`:`off`}`];if(e.ask)return r.push(e.ask.kind===`confirm`?`question: the step wants to "${e.ask.action.summary}" in ${e.ask.service}; answer_ask allows or skips it`:`question: a sign-in at ${e.ask.site.host}; the person types it on the screen, wait`),r.join(`
|
|
2
|
+
`);if(e.status===`running`){let t=[...e.events].reverse().find(e=>e.type===`tool`||e.type===`info`||e.type===`step_started`);return r.push(`working on: ${e.step?.title??``}`),t&&r.push(`doing: ${b(t)}`),r.join(`
|
|
3
|
+
`)}if(e.status===`done`){r.push(`done. made:`);for(let{step:t,output:n}of e.shown)r.push(`- ${t.title}: ${W(n?.text,400)||`(a file, on the screen)`}`);return r.join(`
|
|
4
|
+
`)}if(e.status===`failed`)return r.push(`failed: ${e.error??``}; go_back or the person retries on the screen`),r.join(`
|
|
5
|
+
`);if(t){r.push(`page: ${t.step.title}`);for(let e of t.fields){let n=t.values[e.id],i=n!=null&&n!==``,a=Te(e)?`by voice`:e.kind===`image`?`with the camera (take_photo) or on the screen`:`on the screen only`,o=e.options?.length?`; options: ${e.options.join(` | `)}`:``;r.push(`- field ${e.id} (${e.kind}${e.required?`, required`:``}, ${a}): ${e.label}${e.help?` – ${e.help}`:``}${o}${i?` = ${W(String(Array.isArray(n)?n.join(`, `):n),120)}`:` = (open)`}`)}return r.join(`
|
|
6
|
+
`)}if(e.step?.type===`review`){r.push(`review: ${e.step.title}`);for(let{step:t,output:n}of e.shown)r.push(`- ${t.id} "${t.title}": ${W(n?.text,600)||`(a picture or file, on the screen)`}`);return r.push(`regenerate allowed: ${e.step.regenerate?`yes`:`no`}`),r.join(`
|
|
7
|
+
`)}return r.push(`step: ${e.step?.title??``}`),r.join(`
|
|
8
|
+
`)}function ke(e,t,n,r){let[i,a]=(0,V.useState)(`off`),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(!1),[f,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(`environment`),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)([]),x=(0,V.useRef)(null),S=(0,V.useRef)(null),w=(0,V.useRef)(0),T=(0,V.useRef)(!1);T.current=f;let E=(0,V.useRef)(null),D=(0,V.useRef)(null),O=(0,V.useRef)(null),k=(0,V.useRef)(null),A=(0,V.useRef)(t);A.current=t;let j=(0,V.useRef)(r);j.current=r;let M=(0,V.useRef)(n);M.current=n;let N=(0,V.useRef)(``),P=(0,V.useCallback)(e=>{let t=D.current;t&&t.readyState===`open`&&t.send(JSON.stringify(e))},[]),F=(0,V.useCallback)(()=>{let e=x.current;if(!T.current||!e||e.videoWidth===0)return null;let t=Math.min(1,Ee/e.videoWidth),n=document.createElement(`canvas`);return n.width=Math.round(e.videoWidth*t),n.height=Math.round(e.videoHeight*t),n.getContext(`2d`)?.drawImage(e,0,0,n.width,n.height),n.toDataURL(`image/jpeg`,.75)},[]),I=(0,V.useCallback)(()=>{for(let e of S.current?.getTracks()??[])e.stop();S.current=null,x.current&&(x.current.srcObject=null),m(!1)},[]),L=(0,V.useCallback)(async e=>{if(S.current)return;let t=e??`environment`;try{let e=await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:t},width:{ideal:1280}},audio:!1});S.current=e;let n=e.getVideoTracks()[0]?.getSettings().facingMode;g(n===`user`||n===`environment`?n:t),x.current&&(x.current.srcObject=e,await x.current.play().catch(()=>void 0)),m(!0)}catch(e){s(e.name===`NotAllowedError`?C(`talk.cameraDenied`):e.message)}},[]),ee=(0,V.useCallback)(async()=>{let e=h===`user`?`environment`:`user`;I(),await L(e)},[h,I,L]),te=(0,V.useCallback)(()=>{v(e=>{for(let t of k.current?.getAudioTracks()??[])t.enabled=e;return!e})},[]),R=(0,V.useCallback)(()=>{I(),D.current?.close(),D.current=null,E.current?.close(),E.current=null;for(let e of k.current?.getTracks()??[])e.stop();k.current=null,O.current&&=(O.current.srcObject=null,O.current.remove(),null),N.current=``,l(!1),d(!1),v(!1),a(`off`)},[I]);(0,V.useEffect)(()=>()=>R(),[R]);let z=(0,V.useCallback)(async(t,n)=>{let r=A.current,i=j.current,a=M.current;switch(t){case`get_state`:return r?Oe(r,i,T.current):`no run`;case`look`:{let e=F();return e?(P({type:`conversation.item.create`,item:{type:`message`,role:`user`,content:[{type:`input_text`,text:`[camera] what the person shows right now`},{type:`input_image`,image_url:e}]}}),`a picture arrived as the next message`):`the camera is off; ask the person to switch it on`}case`take_photo`:{if(!i)return`no page is open`;let t=i.fields.find(e=>e.id===String(n.field??``));if(t?.kind!==`image`)return`no such photo field on this page`;let r=F();if(!r)return`the camera is off; ask the person to switch it on`;try{let n=await(await fetch(r)).blob(),a=new File([n],`photo-${Date.now()}.jpg`,{type:`image/jpeg`}),o=await p.upload(`/api/runs/${e}/uploads`,a),s=i.values[t.id],c=t.multiple?[...Array.isArray(s)?s:s?[s]:[],o.id]:o.id,l=i.setField(t.id,c);return l?`refused: ${l}`:`the photo is in the field`}catch(e){return`failed: ${e.message}`}}case`set_field`:{if(!i)return`no page is open`;let e=i.setField(String(n.field??``),n.value);return e?`refused: ${e}`:`kept`}case`submit_page`:{if(!i)return`no page is open`;let e=i.fields.filter(e=>e.required&&Te(e)&&e.kind!==`toggle`&&(i.values[e.id]===void 0||i.values[e.id]===null||i.values[e.id]===``));return e.length?`still open: ${e.map(e=>e.id).join(`, `)}`:(i.submit(),`sent; wait for the next state`)}case`accept_review`:return r?.step?.type===`review`?await a.accept(r.step.id)?`accepted`:a.error??`refused`:`no review is open`;case`regenerate`:return r?.step?.type===`review`?await a.regenerate(r.step.id,String(n.target??``),String(n.note??``))?`the wizard makes it again; wait`:a.error??`refused`:`no review is open`;case`answer_ask`:if(!r?.ask)return`no question is open`;try{return await p.post(`/api/runs/${e}/ask/${r.ask.id}`,{type:n.allow?`done`:`skip`}),n.allow?`allowed`:`skipped`}catch(e){return`refused: ${e.message}`}case`go_back`:return await a.back()?`went back; wait for the state`:a.error??`refused`;default:return`unknown tool ${t}`}},[e,F,P]),ne=(0,V.useCallback)(async()=>{if(!E.current){s(null),b([]),a(`connecting`);try{let t=await p.post(`/api/runs/${e}/talk`),n=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});k.current=n;let r=new RTCPeerConnection;E.current=r;let i=document.createElement(`audio`);i.autoplay=!0,i.setAttribute(`playsinline`,``),document.body.append(i),O.current=i,r.ontrack=e=>{i.srcObject=e.streams[0]};for(let e of n.getTracks())r.addTrack(e,n);let o=r.createDataChannel(`oai-events`);D.current=o,o.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}switch(t.type){case`output_audio_buffer.started`:l(!0);break;case`output_audio_buffer.stopped`:case`output_audio_buffer.cleared`:l(!1);break;case`input_audio_buffer.speech_started`:{d(!0);let e=Date.now()-w.current>De?F():null;e&&(w.current=Date.now(),P({type:`conversation.item.create`,item:{type:`message`,role:`user`,content:[{type:`input_text`,text:`[camera] what the person shows while speaking`},{type:`input_image`,image_url:e}]}}));break}case`input_audio_buffer.speech_stopped`:d(!1);break;case`response.output_audio_transcript.done`:case`conversation.item.input_audio_transcription.completed`:{let e=String(t.transcript??``).trim();if(e){let n=t.type===`response.output_audio_transcript.done`?`bot`:`me`;b(t=>[...t.slice(-199),{id:`${Date.now()}:${n}`,who:n,text:e}])}break}case`response.function_call_arguments.done`:{let e=String(t.name??``),n=String(t.call_id??``),r={};try{r=JSON.parse(String(t.arguments??`{}`))}catch{}z(e,r).then(e=>{P({type:`conversation.item.create`,item:{type:`function_call_output`,call_id:n,output:e}}),P({type:`response.create`})});break}case`error`:s(String(t.error?.message??`error`))}},o.onopen=()=>{a(`live`);let e=A.current;e&&(N.current=Oe(e,j.current,T.current),P({type:`conversation.item.create`,item:{type:`message`,role:`user`,content:[{type:`input_text`,text:`[state]\n${N.current}\n\nGreet the person in one sentence and ask the first open field.`}]}}),P({type:`response.create`}))},o.onclose=()=>{E.current===r&&R()};let c=await r.createOffer();await r.setLocalDescription(c);let u=await fetch(t.endpoint,{method:`POST`,headers:{authorization:`Bearer ${t.clientSecret}`,"content-type":`application/sdp`},body:c.sdp});if(!u.ok)throw Error(`${C(`talk.failed`)} (${u.status})`);await r.setRemoteDescription({type:`answer`,sdp:await u.text()})}catch(e){R(),s(e.name===`NotAllowedError`?C(`chat.micDenied`):e.message),a(`error`)}}},[e,z,F,P,R]);return(0,V.useEffect)(()=>{if(i!==`live`||!t)return;let e=Oe(t,r,f);if(e===N.current)return;let n=N.current;N.current=e,P({type:`conversation.item.create`,item:{type:`message`,role:`user`,content:[{type:`input_text`,text:`[state]\n${e}`}]}}),(t.status===`running`&&n.startsWith(`status: running`)&&!n.includes(`working on: `)||t.status!==`running`||n.split(`
|
|
9
|
+
`)[1]!==e.split(`
|
|
10
|
+
`)[1])&&P({type:`response.create`})},[i,t,r,f,P]),{state:i,error:o,speaking:c,listening:u,start:ne,stop:R,camera:f,facing:h,startCamera:L,stopCamera:I,flipCamera:ee,muted:_,toggleMute:te,captions:y,video:x}}var G=(e,t,n)=>({key:e,who:`bot`,node:t,...n}),K=(e,t,n)=>({key:e,who:`me`,node:t,...n}),Ae=(0,V.createContext)(null),q=(0,V.createContext)(null);function je(){return(0,V.useContext)(q)?.voice??null}function Me({children:e}){let t=(0,V.useContext)(Ae);return t?(0,be.createPortal)(e,t):null}function Ne({header:e,footer:t,children:n}){let[r,i]=(0,V.useState)(null),a=(0,V.useRef)(null),o=(0,V.useRef)(null),s=(0,V.useRef)(!0);return(0,V.useLayoutEffect)(()=>{let e=a.current,t=o.current;if(!e||!t)return;let n=e.scrollTop,r=()=>{e.scrollHeight-e.scrollTop-e.clientHeight<120?s.current=!0:e.scrollTop<n&&(s.current=!1),n=e.scrollTop},i=null,c=new ResizeObserver(()=>{let r=t.querySelector(`[data-anchor]`);r&&r!==i?(i=r,e.scrollTop+=r.getBoundingClientRect().top-e.getBoundingClientRect().top-12,s.current=!1,n=e.scrollTop):s.current&&(e.scrollTop=e.scrollHeight)});return e.scrollTop=e.scrollHeight,e.addEventListener(`scroll`,r,{passive:!0}),c.observe(t),c.observe(e),()=>{c.disconnect(),e.removeEventListener(`scroll`,r)}},[]),(0,H.jsx)(Ae.Provider,{value:r,children:(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[e,(0,H.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,H.jsx)(`div`,{ref:o,className:`mx-auto flex w-full max-w-[760px] flex-col gap-3 px-3 pt-5 pb-4 sm:px-6`,children:n})}),(0,H.jsxs)(`div`,{className:`shrink-0 border-border-soft border-t bg-background`,onPointerDownCapture:()=>{s.current=!0},onKeyDownCapture:()=>{s.current=!0},children:[(0,H.jsx)(`div`,{ref:i,className:`mx-auto w-full max-w-[760px] px-3 pt-3 sm:px-6`}),t]})]})})}function J({avatar:e,lines:t}){let n=(0,V.useContext)(q),r=(0,V.useMemo)(()=>t.map(e=>({key:e.key,who:e.who,spoken:!e.bare&&!e.wide})),[t]),i=(0,V.useCallback)(e=>{let t=document.querySelector(`[data-say="${CSS.escape(e)}"]`);return t?.querySelector(`[data-say-text]`)?.getAttribute(`data-say-text`)??t?.innerText??null},[]);ae(!!n?.readAloud,n?.lang??j,r,i);let a=[];for(let e of t){let t=a.at(-1);t&&t.who===`bot`&&e.who===`bot`?t.lines.push(e):a.push({who:e.who,lines:[e]})}return a.map((t,n)=>t.who===`bot`?(0,H.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,H.jsx)(`div`,{className:`sticky top-1 shrink-0 pt-0.5`,children:(0,H.jsx)(ce,{kind:e,size:30,interactive:n>=a.length-2})}),(0,H.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-1.5`,children:t.lines.map(e=>(0,H.jsx)(`div`,{"data-anchor":e.anchor?``:void 0,"data-say":e.key,className:_(`animate-rise`,e.bare?`w-full pt-1`:`rounded-2xl rounded-tl-md text-[0.9375rem] text-ink leading-relaxed`,!e.bare&&(e.wide?_(`w-full bg-card p-4 shadow-soft ring-1 ring-border-soft`,e.wide===`most`&&`md:w-4/5`):`max-w-[min(36rem,100%)] bg-card px-4 py-2.5 shadow-soft ring-1 ring-border-soft`),e.tone===`error`&&`bg-rose-tint text-rose shadow-none ring-0`),children:e.node},e.key))})]},t.lines[0].key):t.lines.map(e=>(0,H.jsxs)(`div`,{className:`flex animate-rise flex-col items-end gap-1 pl-10`,children:[(0,H.jsx)(`div`,{className:`max-w-[min(32rem,100%)] whitespace-pre-wrap break-words rounded-2xl rounded-br-md bg-primary px-4 py-2.5 text-[0.9375rem] text-primary-foreground leading-relaxed`,children:e.node}),e.onEdit?(0,H.jsxs)(`button`,{type:`button`,onClick:e.onEdit,className:`inline-flex items-center gap-1 px-1 text-[0.75rem] text-ink-4 transition hover:text-ink-2 coarse:min-h-9`,children:[(0,H.jsx)(w,{className:`size-3`}),` `,C(`chat.change`)]}):null]},e.key)))}function Pe(){return(0,H.jsx)(`span`,{className:`inline-flex items-center gap-1 py-1.5`,role:`status`,"aria-label":C(`run.working`),children:[0,1,2].map(e=>(0,H.jsx)(`span`,{className:`size-1.5 animate-typing rounded-full bg-ink-3`,style:{animationDelay:`${e*160}ms`}},e))})}function Y({children:e}){return(0,H.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e})}var X=(e,t)=>G(e,(0,H.jsx)(Y,{children:t}),{bare:!0});function Z({onClick:e,children:t,primary:n,on:r,disabled:i,busy:a}){return(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":r,disabled:i||a,onClick:e,className:_(`inline-flex h-10 items-center gap-1.5 rounded-full px-4 font-medium text-[0.875rem] transition active:scale-[0.98] disabled:pointer-events-none disabled:opacity-50 coarse:h-11`,n?`bg-primary text-primary-foreground hover:brightness-[1.06]`:r?`bg-ember-tint text-ink ring-1 ring-ember`:`bg-card text-ink-2 ring-1 ring-input hover:text-ink hover:ring-ink-4`),children:[a?(0,H.jsx)(k,{className:`size-4`}):null,t]})}function Fe({initial:e=``,placeholder:t,multiline:n,inputProps:r,busy:i,disabled:a,inputRef:o,onSend:c}){let[u,f]=(0,V.useState)(e),p=(0,V.useRef)(null),m=o??p,g=(0,V.useContext)(q),v=A(u,f,{endpoint:g?`/api/runs/${g.runId}/transcribe`:void 0}),b=!!g&&v.supported&&!a;(0,V.useEffect)(()=>{if(!b)return;let e=e=>{(e.metaKey||e.ctrlKey)&&e.shiftKey&&e.key.toLowerCase()===`m`&&(e.preventDefault(),v.toggle())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b,v.toggle]),(0,V.useEffect)(()=>{!s&&!a&&m.current?.focus()},[a,m]);let x=()=>{i||a||(v.listening&&v.toggle(),c(u)!==!1&&f(``))},S=v.listening?C(`chat.listening`):v.processing?C(`chat.transcribing`):t,w=g?.voice??null,T=!!g?.call,E=g&&!T&&(oe||b||w)?(0,H.jsxs)(`div`,{className:`mb-1 flex shrink-0 items-center`,children:[w?(0,H.jsx)(y,{label:C(w.state===`live`?`talk.stop`:w.state===`connecting`?`talk.connecting`:`talk.start`),"aria-pressed":w.state===`live`,disabled:w.state===`connecting`,onClick:()=>w.state===`live`?w.stop():void w.start(),className:_(`size-9`,w.state===`live`&&`bg-rose-tint text-rose hover:bg-rose-tint hover:text-rose`,w.state===`off`&&g.talk&&`bg-primary text-primary-foreground hover:bg-primary`),children:w.state===`connecting`?(0,H.jsx)(k,{className:`size-4`}):w.state===`live`?(0,H.jsx)(le,{className:`size-4`}):(0,H.jsx)(re,{className:`size-4`})}):null,w?.state===`live`?(0,H.jsx)(y,{label:C(w.camera?`talk.cameraOff`:`talk.camera`),"aria-pressed":w.camera,onClick:()=>w.camera?w.stopCamera():void w.startCamera(),className:_(`size-9`,w.camera&&`text-ink`),children:w.camera?(0,H.jsx)(z,{className:`size-4`}):(0,H.jsx)(B,{className:`size-4`})}):null,oe?(0,H.jsx)(y,{label:C(g.readAloud?`chat.readAloudOff`:`chat.readAloud`),"aria-pressed":g.readAloud,onClick:()=>g.setReadAloud(!g.readAloud),className:_(`size-9`,g.readAloud&&`text-ink`),children:g.readAloud?(0,H.jsx)(de,{className:`size-4`}):(0,H.jsx)(ye,{className:`size-4`})}):null,b?(0,H.jsx)(y,{label:C(v.listening?`chat.dictateStop`:`chat.dictate`),"aria-pressed":v.listening,disabled:v.processing,onClick:v.toggle,className:_(`size-9`,v.listening&&`bg-rose-tint text-rose hover:bg-rose-tint hover:text-rose`),children:v.processing?(0,H.jsx)(k,{className:`size-4`}):v.listening?(0,H.jsx)(d,{className:`size-3.5 animate-pulse-dot fill-current`}):(0,H.jsx)(l,{className:`size-4`})}):null]}):null;return(0,H.jsxs)(`form`,{className:`pb-3`,onSubmit:e=>{e.preventDefault(),x()},children:[w&&!T?(0,H.jsx)(`video`,{ref:w.video,muted:!0,playsInline:!0,autoPlay:!0,className:_(`mb-2 ml-auto w-32 rounded-xl bg-black object-cover shadow-soft ring-1 ring-border-soft`,w.camera?`block`:`hidden`)}):null,(0,H.jsxs)(`div`,{className:_(`flex items-end gap-1 rounded-[1.375rem] border border-input bg-card pr-1.5 pl-1 transition focus-within:border-focus focus-within:ring-4 focus-within:ring-focus-glow`,a&&`opacity-60`),children:[E,n?(0,H.jsx)(ee,{ref:m,minRows:1,maxRows:6,value:u,disabled:a,placeholder:S,autoCapitalize:`sentences`,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!s&&!e.nativeEvent.isComposing&&(e.preventDefault(),x())},className:`min-h-11 border-0 bg-transparent py-2.5 shadow-none focus:ring-0`}):(0,H.jsx)(`input`,{ref:m,...r,value:u,disabled:a,placeholder:S,enterKeyHint:`send`,onChange:e=>f(e.target.value),className:`h-11 min-w-0 flex-1 bg-transparent px-3 text-[0.9375rem] text-ink outline-none placeholder:text-ink-4`}),(0,H.jsx)(`button`,{type:`submit`,"aria-label":C(`chat.send`),title:C(`chat.send`),disabled:i||a,className:`mb-1 flex size-9 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground transition hover:brightness-[1.06] disabled:opacity-40`,children:i?(0,H.jsx)(k,{className:`size-4`}):(0,H.jsx)(h,{className:`size-4`})})]}),v.error?(0,H.jsx)(`p`,{className:`mt-1.5 px-3 text-[0.75rem] text-rose`,children:v.error===`denied`?C(`chat.micDenied`):v.error}):T?null:w?.error?(0,H.jsx)(`p`,{className:`mt-1.5 px-3 text-[0.75rem] text-rose`,children:w.error}):w?.state===`live`?(0,H.jsx)(`p`,{className:`mt-1.5 px-3 text-[0.75rem] text-ink-3`,children:w.speaking?C(`talk.speaking`):w.listening?C(`talk.listening`):C(`talk.live`)}):g?.talk&&w?.state===`off`?(0,H.jsx)(`p`,{className:`mt-1.5 px-3 text-[0.75rem] text-ink-3`,children:C(`talk.hint`)}):null]})}function Q({placeholder:e=C(`chat.above`)}){return(0,H.jsx)(Me,{children:(0,H.jsx)(Fe,{disabled:!0,placeholder:e,onSend:()=>!1})})}function Ie(e){let t=g[e.kind];return t===`typed`&&!e.scan?`typed`:t===`tapped`?`tapped`:`control`}var Le=e=>e==null||e===``||Array.isArray(e)&&e.length===0;function Re(e,t){let n=e.kind===`toggle`||e.kind===`connection`||e.kind===`list`;if(Le(t))return e.required&&!n?C(`chat.required`):null;let r=String(t).trim();if(e.kind===`email`&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r))return C(`chat.badEmail`);if(e.kind===`url`)try{new URL(r)}catch{return C(`chat.badUrl`)}return e.kind===`number`&&!Number.isFinite(Number(r.replace(`,`,`.`)))?C(`chat.badNumber`):Array.isArray(t)&&e.multiple&&e.min&&t.length<e.min?C(`run.filesMin`,{n:t.length,min:e.min}):null}function ze(e,t){let n=e.kind===`textarea`?t.replace(/\s+$/,``):t.trim();if(n)return e.kind===`url`&&!/^[a-z][a-z0-9+.-]*:/i.test(n)?`https://${n}`:n}function Be({field:e}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`font-medium`,children:e.label}),e.help?(0,H.jsx)(`span`,{className:`mt-0.5 block text-[0.8125rem] text-ink-3`,children:e.help}):null]})}function Ve({step:e,only:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`font-medium`,children:e.title}),e.description?(0,H.jsx)(`span`,{className:`mt-0.5 block text-ink-2`,children:e.description}):null,t?.help?(0,H.jsx)(`span`,{className:`mt-1 block text-[0.8125rem] text-ink-3`,children:t.help}):null]})}function He({field:e,value:t,runId:n}){if(e.kind===`connection`)return(0,H.jsx)(H.Fragment,{children:typeof t==`string`&&t?t:C(`chat.connected`)});if(e.kind===`list`)return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(m,{className:`size-4`}),` `,C(`chat.checked`)]});if(e.kind===`toggle`)return(0,H.jsx)(H.Fragment,{children:C(t===!0?`run.yes`:`run.no`)});if(Le(t))return(0,H.jsx)(`span`,{className:`italic opacity-80`,children:C(`chat.skipped`)});switch(e.kind){case`multiselect`:return(0,H.jsx)(H.Fragment,{children:t.join(`, `)});case`date`:{let e=new Date(`${String(t)}T00:00`);return(0,H.jsx)(H.Fragment,{children:Number.isNaN(e.getTime())?String(t):new Intl.DateTimeFormat(j,{dateStyle:`long`}).format(e)})}case`color`:return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`size-4 rounded-full ring-1 ring-white/50`,style:{background:String(t)}}),String(t)]});case`image`:case`signature`:return(0,H.jsx)(`span`,{className:`-mx-1.5 flex flex-wrap gap-1.5`,children:(Array.isArray(t)?t:[String(t)]).map(t=>(0,H.jsx)(`img`,{src:r(`/api/runs/${n}/assets/${t}`),alt:``,className:_(`h-16 rounded-lg bg-white`,e.kind===`image`?`w-16 object-cover`:`object-contain px-1`)},t))});case`file`:{let e=Array.isArray(t)?t.length:1;return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(c,{className:`size-4`}),` `,C(e===1?`chat.file`:`chat.files`,{n:e})]})}case`audio`:{let e=t.seconds;return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(l,{className:`size-4`}),` `,C(`chat.voice`),e?` · ${Math.round(e)} s`:``]})}case`location`:{let e=t;return(0,H.jsx)(H.Fragment,{children:e.label||`${e.lat?.toFixed(5)}, ${e.lng?.toFixed(5)}`})}case`items`:return(0,H.jsx)(H.Fragment,{children:C(`chat.rows`,{n:Array.isArray(t)?t.length:0})});default:return(0,H.jsx)(H.Fragment,{children:String(t)})}}function Ue(e,t,n,r,i,a){let o=[G(t,(0,H.jsx)(Ve,{step:e,only:a}))];for(let e of i)a||o.push(G(`${t}:${e.id}`,(0,H.jsx)(Be,{field:e}))),o.push(K(`${t}:${e.id}:a`,(0,H.jsx)(He,{field:e,value:n[e.id],runId:r})));return o}var We=(e,t)=>e.fields.filter(e=>!e.when&&!T(e)||t[e.id]!==void 0&&t[e.id]!==null);function Ge(e,t){let n=[];e.wizard.description&&n.push(G(`hello`,e.wizard.description)),e.wizard.intro&&n.push(G(`intro`,e.wizard.intro));for(let[t,r]of e.answered.entries()){let i=`${t}:${r.id}`;if(r.type===`page`){let t=r.fields.length===1?r.fields[0]:void 0;n.push(...Ue(r,i,e.values,e.id,We(r,e.values),t))}else r.type===`review`&&(n.push(G(i,(0,H.jsx)(`span`,{className:`font-medium`,children:r.title}))),n.push(K(`${i}:a`,C(`run.accept`))))}let r=n.at(-1);return t&&r?.who===`me`&&(n[n.length-1]={...r,onEdit:t}),n}function Ke(e,t){return e.fields.filter(e=>!T(e)||t.decidedFields?.includes(e.id)).map(e=>t.options?.[e.id]?.length?{...e,options:t.options[e.id]}:e)}function qe({view:e,run:t,step:n,before:r}){let i=(0,V.useMemo)(()=>Ke(n,e),[n,e]),a=e.known??{},[s,c]=(0,V.useState)(()=>L(n,e)),[l,u]=(0,V.useState)(()=>n.fields.some(t=>e.values[t.id]!==void 0)?o(Ke(n,e),e.known??{},L(n,e)).slice(0,-1).map(e=>e.id):[]),[d,f]=(0,V.useState)({}),[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(!1),_=o(i,a,s),v=_.filter(e=>l.includes(e.id)),y=_.find(e=>!l.includes(e.id)),b=i.length===1?i[0]:void 0,x=v.at(-1),S=x?()=>u(e=>e.filter(e=>e!==x.id)):void 0;(0,V.useEffect)(()=>{let e=Object.keys(t.fieldErrors),n=o(i,a,s),r=n.findIndex(t=>e.includes(t.id));r>=0&&(u(n.slice(0,r).map(e=>e.id)),f(t.fieldErrors))},[t.fieldErrors]);let w=e=>{t.submitPage(n.id,e).then(g)},T=(0,V.useContext)(q),D=(0,V.useRef)(s);D.current=s;let O=T?.bindPage,k=(0,V.useRef)(w);k.current=w,(0,V.useEffect)(()=>{if(!O)return;let e=o(i,a,s);return O({step:n,fields:e,values:s,setField:(t,n)=>{let r=e.find(e=>e.id===t);return r?Re(r,n)||(c(e=>({...e,[t]:n})),u(e=>e.includes(t)?e:[...e,t]),f({}),null):`no such field on this page`},submit:()=>k.current(D.current)}),()=>O(null)},[O,n,i,a,s]);let A=e=>{if(!y)return!1;let t=Re(y,e);if(t)return f({[y.id]:t}),!1;let n={...s,[y.id]:e},r=[...l,y.id];return c(n),u(r),f({}),o(i,a,n).some(e=>!r.includes(e.id))||w(n),!0},j=[...r.map(e=>l.length?{...e,onEdit:void 0}:e),...Ue(n,`now:${n.id}`,s,e.id,v,b).map((e,t,n)=>t===n.length-1&&e.who===`me`&&y?{...e,onEdit:S}:e)];y?(Ie(y)===`control`?j.push(G(`now:${n.id}:${y.id}:control`,(0,H.jsx)(E,{field:y,value:s[y.id],values:s,runId:e.id,view:e,closed:e.closed?.[y.id],onChange:e=>c(t=>({...t,[y.id]:e})),onBusy:m}),{wide:!0})):b||j.push(G(`now:${n.id}:${y.id}`,(0,H.jsx)(Be,{field:y}))),d[y.id]&&j.push(G(`now:${n.id}:${y.id}:error`,d[y.id],{tone:`error`}))):t.busy||h?j.push(G(`sending`,(0,H.jsx)(Pe,{}))):t.error&&j.push(G(`send-error`,t.error,{tone:`error`}));let M=(0,H.jsx)(Q,{});if(h||!y&&l.length>0&&t.busy)M=(0,H.jsx)(Q,{placeholder:C(`run.working`)});else if(!y)j.push(X(`now:${n.id}:go`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Z,{primary:!0,busy:t.busy,onClick:()=>w(s),children:n.cta||C(`run.next`)}),S?(0,H.jsx)(Z,{onClick:S,disabled:t.busy,children:C(`run.back`)}):null]})));else{let r=Ie(y),i=!y.required&&y.kind!==`connection`&&y.kind!==`list`?(0,H.jsx)(Z,{onClick:()=>A(void 0),children:C(`chat.skip`)}):null;if(r===`typed`){i&&j.push(X(`now:${n.id}:${y.id}:replies`,i));let e=s[y.id];M=(0,H.jsx)(Me,{children:(0,H.jsx)(Fe,{initial:Le(e)?``:String(e),multiline:y.kind===`textarea`,placeholder:y.placeholder||(b?y.label:C(`chat.placeholder`)),inputProps:Je(y),busy:t.busy,onSend:e=>A(ze(y,e))},y.id)})}else if(r===`tapped`)j.push(G(`now:${n.id}:${y.id}:replies`,(0,H.jsx)(Ye,{field:y,view:e,value:s[y.id],onAnswer:A}),{bare:!0}));else{let e=_.filter(e=>!l.includes(e.id)).length===1;j.push(X(`now:${n.id}:${y.id}:replies`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Z,{primary:!0,disabled:p,onClick:()=>A(s[y.id]),children:e&&n.cta?n.cta:C(`chat.send`)}),i]})))}}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(J,{avatar:e.wizard.avatar,lines:j}),M]})}function Je(e){switch(e.kind){case`number`:return{inputMode:`decimal`,autoComplete:`off`};case`email`:return{type:`email`,inputMode:`email`,autoComplete:`email`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1};case`url`:return{inputMode:`url`,autoComplete:`url`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1};case`date`:return{type:`date`};default:return te(e)}}function Ye({field:e,view:t,value:n,onAnswer:r}){let i=new Set(t.closed?.[e.id]?.values.map(String)),[a,o]=(0,V.useState)(Array.isArray(n)?n:[]);if(e.kind===`toggle`)return(0,H.jsxs)(Y,{children:[(0,H.jsx)(Z,{on:n===!1,disabled:i.has(`false`),onClick:()=>r(!1),children:C(`run.no`)}),(0,H.jsx)(Z,{on:n===!0,disabled:i.has(`true`),onClick:()=>r(!0),children:C(`run.yes`)})]});let s=e.options??[];return e.kind===`multiselect`?(0,H.jsxs)(Y,{children:[s.map(e=>(0,H.jsx)(Z,{on:a.includes(e),onClick:()=>o(t=>t.includes(e)?t.filter(t=>t!==e):s.filter(n=>n===e||t.includes(n))),children:e},e)),(0,H.jsx)(Z,{primary:!0,disabled:e.required&&!a.length,onClick:()=>r(a),children:a.length||e.required?C(`chat.send`):C(`chat.skip`)})]}):(0,H.jsxs)(Y,{children:[s.map(e=>(0,H.jsx)(Z,{on:n===e,disabled:i.has(e),onClick:()=>r(e),children:e},e)),e.required?null:(0,H.jsx)(Z,{onClick:()=>r(void 0),children:C(`chat.skip`)})]})}function Xe({view:e}){let t=(0,V.useMemo)(()=>[...e.events].reverse().find(t=>t.type===`step_started`&&t.stepId===e.step?.id),[e.events,e.step?.id]),n=t?new Date(t.at).getTime():Date.now(),[i,o]=(0,V.useState)(Date.now());(0,V.useEffect)(()=>{let e=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(e)},[]);let s=e.events.filter(e=>(e.type===`tool`||e.type===`info`)&&new Date(e.at).getTime()>=n-500),c=s.at(-1),l=[...s].reverse().find(Qe),u=[...new Set(s.map(e=>e.asset).filter(e=>!!e))];return(0,H.jsxs)(`div`,{className:_(`flex max-w-full flex-col gap-1`,l?`w-full`:`w-96`),"data-say-text":t?.message??e.step?.title??C(`run.working`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(Pe,{}),(0,H.jsx)(`span`,{className:`font-medium`,children:t?.message??e.step?.title??C(`run.working`)}),(0,H.jsx)(`span`,{className:`text-[0.75rem] text-ink-4 tabular-nums`,children:C(`run.elapsed`,{s:Math.max(0,Math.round((i-n)/1e3))})})]}),c&&c!==l?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[0.8125rem] text-ink-3`,children:[(0,H.jsx)(a,{className:`size-3.5 shrink-0 animate-breathe text-ember`}),(0,H.jsx)(`span`,{className:`truncate`,children:b(c)})]}):null,l&&e.status===`running`?(0,H.jsx)(et,{runId:e.id,event:l}):null,u.length?(0,H.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:u.slice(-6).map(t=>(0,H.jsx)(`img`,{src:r(`/api/runs/${e.id}/assets/${t}`),alt:``,className:`size-14 rounded-lg bg-paper-2 object-cover ring-1 ring-border-soft`},t))}):null]})}var Ze=new Set([`opens`,`clicks`,`clicksOn`,`types`,`typesText`,`selects`,`scrolls`,`presses`,`goesBack`,`waitsForPage`,`fastLoop`,`looksAtPage`,`personDrives`,`agentDrives`]);function Qe(e){return!!e.note&&Ze.has(e.note.code)}var $e=1e4;function et({runId:e,event:t}){let[n,r]=(0,V.useState)(null),[a,o]=(0,V.useState)(`agent`),[s,c]=(0,V.useState)(!1),l=t.note?.code;if((0,V.useEffect)(()=>{l===`personDrives`?o(`person`):l===`agentDrives`&&o(`agent`)},[l]),(0,V.useEffect)(()=>{let t=()=>p.get(`/api/runs/${e}/browser/seat`).then(e=>o(e.seat)).catch(()=>void 0);if(t(),a!==`person`)return;let n=setInterval(t,$e);return()=>clearInterval(n)},[e,a]),n!==null&&n>=t.id)return null;let u=a===`person`,d=async()=>{c(!0);try{let t=await p.post(`/api/runs/${e}/browser/seat`,{to:u?`agent`:`person`});o(t.seat)}catch{}finally{c(!1)}};return(0,H.jsx)(i,{runId:e,driving:u,caption:b(t),hint:C(`browser.driving`),onBroken:()=>r(t.id),className:`mt-1.5`,action:(0,H.jsxs)(`button`,{type:`button`,disabled:s,onClick:()=>void d(),className:_(`flex h-8 items-center gap-1.5 rounded-full px-3 font-medium text-[0.8125rem] shadow-soft transition-colors disabled:opacity-60`,u?`bg-primary text-primary-foreground hover:bg-primary/90`:`bg-card/90 text-ink ring-1 ring-border-soft backdrop-blur hover:bg-card`),children:[u?(0,H.jsx)(ge,{className:`size-3.5`}):(0,H.jsx)(me,{className:`size-3.5`}),C(u?`browser.handBack`:`browser.takeOver`)]})},n??0)}function $({children:e,end:t}){return(0,H.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`h3`,{className:`font-display font-semibold text-[1rem]`,children:e}),t]})}function tt({view:e,run:t,step:n,before:r,asked:i,onNote:a}){let o=e.shown.filter(e=>e.output),[s,c]=(0,V.useState)(o.length===1?o[0].step.id:null),l=(0,V.useRef)(null),u=[...r,...i.map((e,t)=>K(`review:${n.id}:asked:${t}`,e)),G(`review:${n.id}`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`font-medium`,children:n.title}),n.description?(0,H.jsx)(`span`,{className:`mt-0.5 block text-ink-2`,children:n.description}):null]}),{anchor:!0}),...o.map(({step:t,output:r})=>G(`review:${n.id}:${t.id}`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)($,{children:t.title}),(0,H.jsx)(F,{base:`/api/runs/${e.id}`,step:t,output:r,onSurfaceAction:n.regenerate?()=>{c(t.id),l.current?.focus()}:void 0})]}),{wide:!0})),...e.lists.map(t=>G(`review:${n.id}:list:${t.def.id}`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)($,{children:t.def.title}),t.def.check?(0,H.jsx)(v,{runId:e.id,list:t}):(0,H.jsx)(M,{runId:e.id,list:t,editable:!0})]}),{wide:!0}))];t.error&&u.push(G(`review-error`,t.error,{tone:`error`}));let d=n.regenerate&&o.length>0;return u.push(X(`review:${n.id}:replies`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Z,{primary:!0,busy:t.busy,onClick:()=>void t.accept(n.id),children:[(0,H.jsx)(m,{className:`size-4`}),` `,C(`run.accept`)]}),d&&o.length>1?o.map(({step:e})=>(0,H.jsx)(Z,{on:s===e.id,onClick:()=>c(e.id),children:e.title},e.id)):null]}))),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(J,{avatar:e.wizard.avatar,lines:u}),d?(0,H.jsx)(Me,{children:(0,H.jsx)(Fe,{multiline:!0,inputRef:l,busy:t.busy,placeholder:o.length>1&&!s?C(`run.feedbackPick`):C(`run.feedbackPlaceholder`),disabled:!s,onSend:e=>{let r=e.trim();return!r||!s?!1:(a(r),t.regenerate(n.id,s,r),!0)}})}):(0,H.jsx)(Q,{})]})}function nt({view:e,run:t,step:n,before:r,onRestart:i}){let a=e.shown.filter(e=>e.output),o=`/api/runs/${e.id}`,s=[...r,G(`result:${n.id}`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`font-display font-semibold text-[1.0625rem]`,children:n.title}),n.message?(0,H.jsx)(`span`,{className:`mt-0.5 block text-ink-2`,children:n.message}):null]}),{anchor:!0}),...a.map(({step:e,output:t,formats:n,label:r})=>G(`result:${e.id}`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)($,{end:(0,H.jsx)(P,{base:o,stepId:e.id,formats:n,title:r??e.title}),children:r??e.title}),(0,H.jsx)(F,{base:o,step:e,output:t}),t?.assets?.some(e=>e.ai)?(0,H.jsx)(`p`,{className:`mt-3 text-[0.75rem] text-ink-3 leading-relaxed`,children:C(`ai.publish`)}):null]}),{wide:!0})),...e.lists.map(t=>G(`result:list:${t.def.id}`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)($,{end:(0,H.jsx)(S,{runId:e.id,list:t}),children:t.label??t.def.title}),(0,H.jsx)(M,{runId:e.id,list:t,editable:!0})]}),{wide:!0}))];return s.push(X(`result:replies`,(0,H.jsxs)(H.Fragment,{children:[a.length?(0,H.jsx)(ue,{runId:e.id,title:`${n.title} · ${e.wizard.title}`,initial:e.shareUrl?{url:e.shareUrl,expiresAt:e.expiresAt}:null}):null,i?(0,H.jsxs)(Z,{onClick:i,children:[(0,H.jsx)(f,{className:`size-4`}),` `,C(`run.again`)]}):null,e.canBack?(0,H.jsx)(Z,{onClick:()=>void t.back(),disabled:t.busy,children:C(`run.back`)}):null,e.keeps?(0,H.jsx)(`span`,{className:`ml-1`,children:(0,H.jsx)(D,{runId:e.id})}):null]}))),(0,H.jsx)(J,{avatar:e.wizard.avatar,lines:s})}function rt({runId:e,onRestart:t,onView:n,header:r,footer:i,talk:a=!1,call:o=!1}){let s=fe(e),{view:c}=s,[l,d]=(0,V.useState)(null),p=ke(e,c,s,l);(0,V.useEffect)(()=>{n?.(c)},[c,n]);let[m,h]=se(),g=(0,V.useMemo)(()=>({runId:e,lang:c?.lang??j,readAloud:m,setReadAloud:h,voice:c?.talk?p:null,talk:a,call:!!o,bindPage:d}),[e,c?.lang,c?.talk,m,h,p,a,o]);u(c?.status===`running`&&!c.ask),O(c);let[_,v]=(0,V.useState)({}),[y,b]=(0,V.useState)(null);(0,V.useEffect)(()=>{c&&c.status!==`running`&&b(null)},[c]);let x;if(s.notFound)x=(0,H.jsx)(`div`,{className:`py-24 text-center text-ink-3`,children:C(`run.notFound`)});else if(!c)x=(0,H.jsx)(`div`,{className:`flex justify-center py-24 text-ink-4`,children:(0,H.jsx)(k,{})});else{let e=c.step,n=c.status===`waiting_input`,r=Ge(c,c.canBack&&n&&!s.busy?()=>void s.back():void 0);if(c.status===`running`&&c.ask)x=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(J,{avatar:c.wizard.avatar,lines:[...r,G(`ask:${c.ask.id}`,(0,H.jsx)(ne,{runId:c.id,ask:c.ask}),{wide:!0})]}),(0,H.jsx)(Q,{})]});else if(c.status===`running`)x=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(J,{avatar:c.wizard.avatar,lines:[...r,...y?[K(`note`,y)]:[],G(`working:${e?.id}`,(0,H.jsx)(Xe,{view:c}),{wide:c.events.some(t=>t.stepId===e?.id&&Qe(t))?`most`:void 0})]}),(0,H.jsx)(Q,{placeholder:C(`run.working`)})]});else if(c.status===`failed`)x=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(J,{avatar:c.wizard.avatar,lines:[...r,G(`failed`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`font-medium`,children:C(`run.failed`)}),c.error?(0,H.jsx)(`span`,{className:`mt-0.5 block`,children:(0,H.jsx)(N,{text:c.error})}):null]}),{tone:`error`}),X(`failed:replies`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Z,{primary:!0,busy:s.busy,onClick:()=>void s.retry(),children:[(0,H.jsx)(f,{className:`size-4`}),` `,C(`run.retry`)]}),c.canBack?(0,H.jsx)(Z,{onClick:()=>void s.back(),disabled:s.busy,children:C(`run.back`)}):null]}))]}),(0,H.jsx)(Q,{})]});else if(c.status===`cancelled`)x=(0,H.jsx)(J,{avatar:c.wizard.avatar,lines:[...r,G(`cancelled`,C(`run.cancelled`)),...t?[X(`cancelled:replies`,(0,H.jsxs)(Z,{primary:!0,onClick:t,children:[(0,H.jsx)(f,{className:`size-4`}),` `,C(`run.again`)]}))]:[]]});else if(e?.type===`page`)x=(0,H.jsx)(qe,{view:c,run:s,step:e,before:r},e.id);else if(e?.type===`review`){let t=c.shown.map(e=>e.output?.at??``).join(`|`);x=(0,H.jsx)(tt,{view:c,run:s,step:e,before:r,asked:_[e.id]??[],onNote:t=>{b(t),v(n=>({...n,[e.id]:[...n[e.id]??[],t]}))}},`${e.id}:${t}`)}else x=e?.type===`result`?(0,H.jsx)(nt,{view:c,run:s,step:e,before:r,onRestart:t}):(0,H.jsx)(J,{avatar:c.wizard.avatar,lines:r})}return o?(0,H.jsx)(q.Provider,{value:g,children:(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col lg:flex-row`,children:[(0,H.jsx)(we,{voice:p,view:c,video:o===`video`,className:`h-[46dvh] shrink-0 lg:h-auto lg:min-h-0 lg:flex-1`}),(0,H.jsx)(`aside`,{className:`flex min-h-0 flex-1 flex-col border-border-soft border-t lg:w-[420px] lg:flex-none lg:border-t-0 lg:border-l`,children:(0,H.jsx)(Ne,{footer:i,children:x})})]})}):(0,H.jsx)(q.Provider,{value:g,children:(0,H.jsx)(Ne,{header:r,footer:i,children:x})})}export{J as a,Z as i,Ne as n,X as o,Q as r,je as s,rt as t};
|