wizards 0.4.1 → 0.4.3
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/reloading.md +3 -3
- package/apps/runtime/dist/docs/dev/plugins/runners.md +9 -12
- package/apps/runtime/dist/docs/user/test-and-share.md +22 -58
- package/apps/runtime/dist/media/conversation.js +7 -1
- package/apps/web/dist/assets/{AboutDialog-CXEpsI6L.js → AboutDialog-DWaBKvI6.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-Cc2APUGI.js → ChangelogDialog-BcM1gXPM.js} +1 -1
- package/apps/web/dist/assets/{ChatView-B2r4dW_m.js → ChatView-D0RRIl15.js} +2 -2
- package/apps/web/dist/assets/{EditorPage-CNAYlSms.js → EditorPage-DrJ6e_2q.js} +1 -1
- package/apps/web/dist/assets/{FlowPreview-DzU1nGDb.js → FlowPreview-S1s1yRaP.js} +1 -1
- package/apps/web/dist/assets/{Harness-ALQ9Csm6.js → Harness-DILx5Edb.js} +1 -1
- package/apps/web/dist/assets/{NewWizardChannels-DMPqHkCF.js → NewWizardChannels-CEILDADp.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-pi053e8N.js → NewWizardPage-DxOtK2E-.js} +1 -1
- package/apps/web/dist/assets/{OnboardingPage-TYNX6Umd.js → OnboardingPage-xoGrKIJ-.js} +1 -1
- package/apps/web/dist/assets/{ProjectPage-CvEkx_Ux.js → ProjectPage-6E5z4nZA.js} +1 -1
- package/apps/web/dist/assets/{PublicRunner-BrivKNHo.js → PublicRunner-Cab2jUy6.js} +1 -1
- package/apps/web/dist/assets/{RunDrawer-3osugizk.js → RunDrawer-B3FNYpgZ.js} +1 -1
- package/apps/web/dist/assets/{RunnerView-Ci4_WzVv.js → RunnerView-D6sGVnRy.js} +1 -1
- package/apps/web/dist/assets/{SettingsPage-DKntf7-9.js → SettingsPage-DHtIqmOJ.js} +1 -1
- package/apps/web/dist/assets/{SetupPage-DZQxEQyk.js → SetupPage-Cn9iQbJx.js} +1 -1
- package/apps/web/dist/assets/{SharePage-B9l4KthU.js → SharePage-CMr72PeU.js} +1 -1
- package/apps/web/dist/assets/changelog-DfmWTlav.js +1 -0
- package/apps/web/dist/assets/{esm-CuqXcPS3.js → esm-BPfTI3lL.js} +1 -1
- package/apps/web/dist/assets/index-B-D8UvL9.js +14 -0
- package/apps/web/dist/assets/{settings-menu-C7VsRpe9.js → settings-menu-BJm0CwOj.js} +1 -1
- package/apps/web/dist/index.html +1 -1
- package/package.json +1 -1
- package/apps/web/dist/assets/changelog-CxdXZo3V.js +0 -1
- package/apps/web/dist/assets/index-j09nLtEs.js +0 -14
- package/modules/calls/dist/client.css +0 -3
- package/modules/calls/dist/client.js +0 -1
- package/modules/calls/engenty.plugin.json +0 -8
- package/modules/calls/migrations/0001_init.sql +0 -26
- package/modules/calls/package.json +0 -25
- package/modules/calls/src/openai.ts +0 -155
- package/modules/calls/src/plugin.ts +0 -407
- package/modules/calls/src/rules.ts +0 -226
- package/modules/calls/src/schema.ts +0 -39
- package/modules/calls/src/session.ts +0 -353
- package/modules/calls/src/store.ts +0 -124
- package/modules/calls/src/twilio.ts +0 -90
- package/modules/calls/tsconfig.json +0 -10
- package/modules/calls/ui/Settings.tsx +0 -137
- package/modules/calls/ui/app.ts +0 -50
- package/modules/calls/ui/messages.ts +0 -81
- package/modules/calls/ui/parts.tsx +0 -36
- package/modules/calls/ui/plugin.tsx +0 -15
- package/modules/sms/dist/client.css +0 -3
- package/modules/sms/dist/client.js +0 -1
- package/modules/sms/engenty.plugin.json +0 -8
- package/modules/sms/migrations/0001_init.sql +0 -26
- package/modules/sms/package.json +0 -24
- package/modules/sms/src/plugin.ts +0 -329
- package/modules/sms/src/schema.ts +0 -26
- package/modules/sms/src/store.ts +0 -140
- package/modules/sms/src/surface.ts +0 -70
- package/modules/sms/src/twilio.ts +0 -130
- package/modules/sms/tsconfig.json +0 -10
- package/modules/sms/ui/Settings.tsx +0 -113
- package/modules/sms/ui/Share.tsx +0 -60
- package/modules/sms/ui/app.ts +0 -51
- package/modules/sms/ui/messages.ts +0 -70
- package/modules/sms/ui/parts.tsx +0 -36
- package/modules/sms/ui/plugin.tsx +0 -20
- package/modules/whatsapp/dist/client.css +0 -3
- package/modules/whatsapp/dist/client.js +0 -1
- package/modules/whatsapp/engenty.plugin.json +0 -8
- package/modules/whatsapp/migrations/0001_init.sql +0 -30
- package/modules/whatsapp/package.json +0 -24
- package/modules/whatsapp/src/graph.ts +0 -271
- package/modules/whatsapp/src/inbound.ts +0 -143
- package/modules/whatsapp/src/plugin.ts +0 -374
- package/modules/whatsapp/src/schema.ts +0 -32
- package/modules/whatsapp/src/store.ts +0 -156
- package/modules/whatsapp/src/surface.ts +0 -127
- package/modules/whatsapp/tsconfig.json +0 -10
- package/modules/whatsapp/ui/Settings.tsx +0 -141
- package/modules/whatsapp/ui/Share.tsx +0 -60
- package/modules/whatsapp/ui/app.ts +0 -54
- package/modules/whatsapp/ui/messages.ts +0 -80
- package/modules/whatsapp/ui/parts.tsx +0 -36
- package/modules/whatsapp/ui/plugin.tsx +0 -20
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: While it runs
|
|
3
3
|
description: Save a file and the plugin loads again — what reloads, what survives, and how to work on a plugin.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
A runtime that runs alone watches its plugins. You do not restart it while you write one.
|
|
@@ -67,8 +67,8 @@ A loop that needs no restart, from a checkout:
|
|
|
67
67
|
4. Open the plugin's page in the studio and edit. The server half reloads on save; the page
|
|
68
68
|
updates when the build finished.
|
|
69
69
|
|
|
70
|
-
The runtime's log names the plugins it loaded at start
|
|
71
|
-
|
|
70
|
+
The runtime's log names the plugins it loaded at start (`plugins: contacts, workdays`), and
|
|
71
|
+
prints why one did not load.
|
|
72
72
|
|
|
73
73
|
## On engenty.ai
|
|
74
74
|
|
|
@@ -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
|
+
version: 0.4.0
|
|
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
|
|
@@ -163,10 +163,9 @@ const door = new ThreadDoor({ runs: server.runs, surface, offered, watch, unwatc
|
|
|
163
163
|
| `watch(thread)`, `unwatch(runId)` | Hear the run (`runs.subscribe`) and call `door.resume` when it moves; the plugin keeps the subscriptions |
|
|
164
164
|
| `Thread` | `{ id, name, runId, state, lastInboundAt, lastMessageId }`: the plugin keeps it in a table per person and hands it to the door before and after |
|
|
165
165
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
through the Cloud API are WhatsApp's surface, numbered lines and links are SMS's.
|
|
166
|
+
A messenger plugin is a surface of this door: the webhook on a public route, the keyword table,
|
|
167
|
+
the number and the keyword in the share dialog are the plugin's; buttons and lists, or numbered
|
|
168
|
+
lines and links, are its surface.
|
|
170
169
|
|
|
171
170
|
## A call
|
|
172
171
|
|
|
@@ -179,13 +178,11 @@ const { apiKey, model } = await server.speech.conversation();
|
|
|
179
178
|
// Throws with the status 503 and the code `no_model` while no OpenAI key is set under Models.
|
|
180
179
|
```
|
|
181
180
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
the plugin
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
the run with `server.runs`. The audio never touches the runtime. What a voice cannot take is
|
|
188
|
-
texted as a link.
|
|
181
|
+
A call plugin keeps the audio out of the runtime: the telephony provider hands the call to the
|
|
182
|
+
speech model's SIP endpoint with a token in a header, the model's provider posts the incoming
|
|
183
|
+
call to the plugin's public route, and the plugin accepts it with the wizard's rules and tools
|
|
184
|
+
and answers the model's tool calls over a WebSocket, driving the run with `server.runs`. What a
|
|
185
|
+
voice cannot take goes out as a link.
|
|
189
186
|
|
|
190
187
|
## Not there yet
|
|
191
188
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Test and share
|
|
3
3
|
description: Try the wizard, publish it, and hand out its link or put it on a website.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## Test
|
|
@@ -81,65 +81,29 @@ The link opens the first browser channel that is on. The others answer under the
|
|
|
81
81
|
(`/steps`, `/chat`, `/talk` for live voice, `/video` for the video call) and are offered on the
|
|
82
82
|
wizard's first page: "Or: Chat". A switched-off address sends people to the link instead.
|
|
83
83
|
|
|
84
|
-
### WhatsApp
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
the
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
in the
|
|
91
|
-
|
|
92
|
-
Switch WhatsApp on for a wizard and its row in the share dialog shows its **keyword** and the
|
|
93
|
-
number; "Link" copies the link that writes it (`wa.me/<number>?text=<keyword>`), and the QR code
|
|
94
|
-
view draws it. The keyword is changed under the gear. Whoever sends the keyword to the number
|
|
95
|
-
starts the wizard; without a keyword, the number offers the wizards that are on.
|
|
96
|
-
|
|
97
|
-
In the thread the wizard asks one field per message: buttons for up to three choices, a list
|
|
98
|
-
for more, yes/no as buttons, a photo or a file sent in the chat, "send location" for a place, a
|
|
99
|
-
voice message for a text field where a listener is set up under Models. A page with a field only
|
|
100
|
-
the screen can take (a signature, a sign-in) arrives as a link to the wizard's page; the thread
|
|
101
|
-
goes on by itself once it was filled there. A review is the text with "Looks good" and "New
|
|
102
|
-
version"; the result arrives as text, pictures and documents, a widget or dashboard as a picture,
|
|
103
|
-
and a link to everything. "stop" ends a run, the keyword starts a new one.
|
|
104
|
-
|
|
105
|
-
What WhatsApp allows: a free message within 24 hours of the person's last one. A wizard that
|
|
106
|
-
finishes later can only reach back with an approved utility template with one placeholder; its
|
|
107
|
-
name goes into the settings, the link into the placeholder. Without one, the result waits for
|
|
108
|
-
the person's next message.
|
|
109
|
-
|
|
110
|
-
### SMS
|
|
111
|
-
|
|
112
|
-
With the SMS module a wizard runs by text message, through a Twilio account and number of your
|
|
113
|
-
own. Settings → SMS takes the Account SID, the auth token and the number; the webhook address
|
|
114
|
-
the page shows goes into the number's "A message comes in" field in Twilio. Switch SMS on for a
|
|
115
|
-
wizard and its row shows the keyword and the number; "Link" copies an `sms:` link that types it,
|
|
84
|
+
### WhatsApp, SMS and calls
|
|
85
|
+
|
|
86
|
+
On engenty.ai a wizard can also run in a WhatsApp thread, by text message and as a phone call,
|
|
87
|
+
where the team's plan includes them. These channels are not part of the open runtime: a local
|
|
88
|
+
install has them through its account in the cloud.
|
|
89
|
+
|
|
90
|
+
Switch one on for a wizard and its row in the share dialog shows the number and the **keyword**:
|
|
91
|
+
whoever sends the keyword to the number starts the wizard. "Link" copies a link that writes it,
|
|
116
92
|
and the QR code view draws it. The keyword is changed under the gear.
|
|
117
93
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
Settings → Calls takes the Twilio account, a Twilio number that can text, the OpenAI project ID,
|
|
133
|
-
the webhook secret of a webhook you add in the OpenAI dashboard for incoming calls and the
|
|
134
|
-
region (EU or US), and shows what to enter where: the voice webhook for Twilio's SIP domain and
|
|
135
|
-
phone number, the OpenAI webhook, and for WhatsApp the SIP server to set on the number in Meta's
|
|
136
|
-
calling settings (the Twilio SIP domain, port 5061). Switch "Call" on for a wizard; with several
|
|
137
|
-
on, the wizard asks which one at the start of the call. A WhatsApp call button or deep link whose
|
|
138
|
-
payload is a wizard's link token picks that wizard.
|
|
139
|
-
|
|
140
|
-
What a voice cannot take (a photo, a file, a signature) is texted as a link to the wizard's page,
|
|
141
|
-
and the call goes on once it was filled there. At the end the result is texted as a link too.
|
|
142
|
-
Each minute costs what OpenAI and Twilio charge.
|
|
94
|
+
- **WhatsApp**: one field per message, buttons for up to three choices, a list for more, a photo
|
|
95
|
+
or a file sent in the chat, "send location" for a place, a voice message for a text field. A
|
|
96
|
+
free message goes out within 24 hours of the person's last one; a wizard that finishes later
|
|
97
|
+
reaches back with an approved template, or waits for the person's next message.
|
|
98
|
+
- **SMS**: text only, choices as numbered lines answered with the number, a place as a typed
|
|
99
|
+
address; long texts come as their gist, every picture, document and the whole result as links.
|
|
100
|
+
- **Calls**: the speech model talks, as the chat's live voice does: one field at a time, choices
|
|
101
|
+
read out, e-mail addresses and numbers read back. With several wizards on for calls, the call
|
|
102
|
+
asks which one first.
|
|
103
|
+
|
|
104
|
+
What a channel cannot take (a signature, a sign-in; by text and on the phone also a photo or a
|
|
105
|
+
file) arrives as a link to the wizard's page, and the conversation goes on once it was filled
|
|
106
|
+
there. "stop" ends a run in a thread, the keyword starts a new one.
|
|
143
107
|
|
|
144
108
|
### Who can open the link
|
|
145
109
|
|
|
@@ -150,7 +150,13 @@ export async function mintConversation(view) {
|
|
|
150
150
|
tool_choice: "auto",
|
|
151
151
|
audio: {
|
|
152
152
|
// What the person said, written down: the call screen shows it as captions.
|
|
153
|
-
input: {
|
|
153
|
+
input: {
|
|
154
|
+
transcription: { model: "gpt-4o-mini-transcribe" },
|
|
155
|
+
// Phones and laptops play the wizard's voice through their own speakers, which the mic
|
|
156
|
+
// picks up: far-field filtering and a higher bar for speech keep it from interrupting itself.
|
|
157
|
+
noise_reduction: { type: "far_field" },
|
|
158
|
+
turn_detection: { type: "server_vad", threshold: 0.7, silence_duration_ms: 600 },
|
|
159
|
+
},
|
|
154
160
|
output: { voice: VOICES[view.lang] },
|
|
155
161
|
},
|
|
156
162
|
},
|
|
@@ -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{$t as r,An as i,Fn as a,Gt as o,Ht as s,Ut as c,Wt as l,Xt as u,an as d,rn as f,sn as p,tn as m}from"./ui-DTuixH4y.js";import{t as h}from"./preload-helper-CNEI7N0N.js";import{$ as g,H as _,V as v,gt as y}from"./index-j09nLtEs.js";import{c as b,f as x}from"./settings-menu-C7VsRpe9.js";import{ReleaseNotes as S,loadReleases as C,releaseDate as w,releaseLabel as T}from"./ChangelogDialog-Cc2APUGI.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: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)(i,{"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})]}),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[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),[r,i]=(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||i(``)},[e]);let a=r.trim().toLowerCase(),s=e=>a?e.filter(e=>A(a,e.name,e.license,e.description.de,e.description.en)):e,l=e=>a?e.filter(e=>A(a,e.name,e.license,e.version)):e,f=s(D),p=s(O),m=t?[{id:`shared`,label:d(`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=f.length===0&&p.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:d(`about.creditsHint`)}),(0,k.jsx)(o,{type:`search`,value:r,placeholder:d(`about.search`),onChange:e=>i(e.target.value)}),f.length>0?(0,k.jsx)(M,{title:d(`about.creditsProduct`),children:(0,k.jsx)(N,{credits:f})}):null,p.length>0?(0,k.jsx)(M,{title:d(`about.creditsBuiltWith`),children:(0,k.jsx)(N,{credits:p})}):null,t===null?(0,k.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,k.jsx)(u,{})}):m.length>0?(0,k.jsx)(M,{title:d(`about.creditsDeps`),hint:a?void 0:d(`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)(c,{children:d(`about.noMatches`)}):null]})}var I=[`new`,`earlier`,`credits`],L=e=>d(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),R=e=>e===1?d(`about.change`):d(`about.changes`,{n:e});function z({open:e,onClose:t,me:n}){let i=n?.mode===`local`,{data:o,latest:c}=_(i&&e),[f,h]=(0,E.useState)(null),[D,O]=(0,E.useState)(`new`),A=x(I.indexOf(D)),j=o?.newer&&c?c:g;(0,E.useEffect)(()=>{if(!e)return;let t=!1;return h(null),C(j===`0.4.1`?void 0:j).then(e=>{t||h(e)}),()=>{t=!0}},[e,j]);let M=f?.find(e=>e.version===`v${j}`)??f?.[0]??null,N=f?.filter(e=>e!==M)??[],P=i?o?.kind??null:`cloud`;return(0,k.jsxs)(s,{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)(l,{label:d(`common.close`),onClick:t,children:(0,k.jsx)(p,{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:[d(`about.version`,{v:g}),P?` · ${d(`about.kind.${P}`)}`:``]})]}),i?(0,k.jsx)(`div`,{className:`mt-5`,children:(0,k.jsx)(v,{enabled:e})}):null,(0,k.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,k.jsx)(r,{value:D,onChange:O,options:I.map(e=>({id:e,label:L(e)})),label:d(`about.title`)})}),(0,k.jsxs)(`div`,{className:m(`mt-5`,b(A)),children:[D===`new`?f===null?(0,k.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,k.jsx)(u,{})}):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:d(`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,An as i,Fn as a,Gt as o,Ht as s,Ut as c,Wt as l,Xt as u,an as d,rn as f,sn as p,tn as m}from"./ui-DTuixH4y.js";import{t as h}from"./preload-helper-CNEI7N0N.js";import{$ as g,H as _,V as v,gt as y}from"./index-B-D8UvL9.js";import{c as b,f as x}from"./settings-menu-BJm0CwOj.js";import{ReleaseNotes as S,loadReleases as C,releaseDate as w,releaseLabel as T}from"./ChangelogDialog-BcM1gXPM.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: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)(i,{"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})]}),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[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),[r,i]=(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||i(``)},[e]);let a=r.trim().toLowerCase(),s=e=>a?e.filter(e=>A(a,e.name,e.license,e.description.de,e.description.en)):e,l=e=>a?e.filter(e=>A(a,e.name,e.license,e.version)):e,f=s(D),p=s(O),m=t?[{id:`shared`,label:d(`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=f.length===0&&p.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:d(`about.creditsHint`)}),(0,k.jsx)(o,{type:`search`,value:r,placeholder:d(`about.search`),onChange:e=>i(e.target.value)}),f.length>0?(0,k.jsx)(M,{title:d(`about.creditsProduct`),children:(0,k.jsx)(N,{credits:f})}):null,p.length>0?(0,k.jsx)(M,{title:d(`about.creditsBuiltWith`),children:(0,k.jsx)(N,{credits:p})}):null,t===null?(0,k.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,k.jsx)(u,{})}):m.length>0?(0,k.jsx)(M,{title:d(`about.creditsDeps`),hint:a?void 0:d(`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)(c,{children:d(`about.noMatches`)}):null]})}var I=[`new`,`earlier`,`credits`],L=e=>d(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),R=e=>e===1?d(`about.change`):d(`about.changes`,{n:e});function z({open:e,onClose:t,me:n}){let i=n?.mode===`local`,{data:o,latest:c}=_(i&&e),[f,h]=(0,E.useState)(null),[D,O]=(0,E.useState)(`new`),A=x(I.indexOf(D)),j=o?.newer&&c?c:g;(0,E.useEffect)(()=>{if(!e)return;let t=!1;return h(null),C(j===`0.4.3`?void 0:j).then(e=>{t||h(e)}),()=>{t=!0}},[e,j]);let M=f?.find(e=>e.version===`v${j}`)??f?.[0]??null,N=f?.filter(e=>e!==M)??[],P=i?o?.kind??null:`cloud`;return(0,k.jsxs)(s,{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)(l,{label:d(`common.close`),onClick:t,children:(0,k.jsx)(p,{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:[d(`about.version`,{v:g}),P?` · ${d(`about.kind.${P}`)}`:``]})]}),i?(0,k.jsx)(`div`,{className:`mt-5`,children:(0,k.jsx)(v,{enabled:e})}):null,(0,k.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,k.jsx)(r,{value:D,onChange:O,options:I.map(e=>({id:e,label:L(e)})),label:d(`about.title`)})}),(0,k.jsxs)(`div`,{className:m(`mt-5`,b(A)),children:[D===`new`?f===null?(0,k.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,k.jsx)(u,{})}):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:d(`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 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{Gt as r,Ht as i,Ut as a,Xt as o,an as s,tn as c}from"./ui-DTuixH4y.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/,``):s(`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-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{Gt as r,Ht as i,Ut as a,Xt as o,an as s,tn as c}from"./ui-DTuixH4y.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/,``):s(`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-DfmWTlav.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:c(`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:s(`about.breaking`)}):null]})]},e.id)})})}function y({open:e,onClose:t,version:n}){let[c,l]=(0,u.useState)(null),[f,h]=(0,u.useState)(``);(0,u.useEffect)(()=>{if(!e||c)return;let t=!1;return _(n).then(e=>{t||l(e)}),()=>{t=!0}},[e,c,n]),(0,u.useEffect)(()=>{e||h(``)},[e]);let y=c?g(c,f):[];return(0,d.jsxs)(i,{open:e,onClose:t,title:s(`about.changelog`),wide:!0,height:`tall`,children:[(0,d.jsx)(`p`,{className:`-mt-3 mb-4 text-[0.875rem] text-ink-3`,children:s(`about.changelogHint`)}),c===null?(0,d.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,d.jsx)(o,{})}):c.length===0?(0,d.jsx)(a,{children:s(`about.changelogEmpty`)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(r,{type:`search`,value:f,placeholder:s(`about.search`),onChange:e=>h(e.target.value)}),y.length===0?(0,d.jsx)(a,{children:s(`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};
|
|
@@ -1,10 +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{At as r,Bn as i,Cn as a,Ft as o,J as s,Mt as c,Nt as l,Pt as u,Q as d,Rn as f,Wn as p,Wt as m,X as h,Xt as g,Z as _,an as v,at as y,c as b,cn as x,ct as S,dn as C,en as w,fn as T,ht as E,it as D,lt as O,mn as k,nn as A,nt as j,ot as M,qt as N,rn as P,st as F,tn as I,un as ee,vn as te,wt as L,xn as ne,z as R}from"./ui-DTuixH4y.js";import{t as re}from"./phone-BFD815nc.js";import{J as ie,Ot as ae,X as oe,Y as se,dt as ce,jt as le,qt as ue,t as de,vt as fe}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{At as r,Bn as i,Cn as a,Ft as o,J as s,Mt as c,Nt as l,Pt as u,Q as d,Rn as f,Wn as p,Wt as m,X as h,Xt as g,Z as _,an as v,at as y,c as b,cn as x,ct as S,dn as C,en as w,fn as T,ht as E,it as D,lt as O,mn as k,nn as A,nt as j,ot as M,qt as N,rn as P,st as F,tn as I,un as ee,vn as te,wt as L,xn as ne,z as R}from"./ui-DTuixH4y.js";import{t as re}from"./phone-BFD815nc.js";import{J as ie,Ot as ae,X as oe,Y as se,dt as ce,jt as le,qt as ue,t as de,vt as fe}from"./index-B-D8UvL9.js";import{n as pe}from"./RunnerView-D6sGVnRy.js";var me={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`}]]};me.node;var he=p(me),ge={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`}]]};ge.node;var _e=p(ge),ve={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`}]]};ve.node;var ye=p(ve),be={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`}]]};be.node;var xe=p(be),Se=ue(),z=e(t(),1),B=e(n(),1),Ce=typeof window<`u`&&window.matchMedia(`(pointer: coarse)`).matches;function we({since:e}){let[t,n]=(0,z.useState)(Date.now());if((0,z.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,B.jsxs)(`span`,{className:`font-mono text-[0.8125rem] text-white/60 tabular-nums`,children:[i,`:`,a]})}function V({label:e,on:t,danger:n,busy:r,onClick:i,children:a}){return(0,B.jsx)(`button`,{type:`button`,"aria-label":e,title:e,"aria-pressed":t,disabled:r,onClick:i,className:I(`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,B.jsx)(g,{className:`size-5`}):a})}function Te({voice:e}){let t=(0,z.useRef)(null),{captions:n}=e;return(0,z.useEffect)(()=>{n.length&&t.current?.scrollIntoView({block:`end`})},[n]),n.length?(0,B.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 sm:px-5`,children:(0,B.jsxs)(`ol`,{className:`mx-auto flex max-w-[720px] flex-col gap-2 py-2`,children:[n.map(e=>(0,B.jsx)(`li`,{className:I(`text-[0.9375rem] leading-snug`,e.who===`bot`?`text-white/95`:`text-right text-white/50`),children:e.text},e.id)),(0,B.jsx)(`div`,{ref:t})]})}):null}function Ee({voice:e,view:t,video:n,className:r}){let i=e.state===`live`,o=e.state===`connecting`,[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(!1);(0,z.useEffect)(()=>{c(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`),_=e.speaking?v(`talk.speaking`):e.listening?v(`talk.listening`):i?v(`talk.live`):o?v(`talk.connecting`):l?v(`video.ended`):``;return(0,B.jsxs)(`section`,{className:I(`relative flex min-h-0 flex-col bg-neutral-950 text-white`,`safe-top`,r),children:[(0,B.jsxs)(`div`,{className:`flex h-14 shrink-0 items-center gap-3 px-4 sm:px-5`,children:[(0,B.jsx)(`div`,{className:`min-w-0 flex-1 truncate font-display font-semibold text-[1rem] tracking-tight`,children:t?.wizard.title??``}),_?(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[0.8125rem] text-white/70`,children:[i?(0,B.jsx)(`span`,{className:I(`size-2 rounded-full`,e.speaking?`animate-pulse-dot bg-emerald-400`:`bg-rose`)}):null,_]}):null,(0,B.jsx)(we,{since:s})]}),(0,B.jsxs)(`div`,{className:I(`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,B.jsxs)(`div`,{className:I(`relative min-h-0 overflow-hidden rounded-2xl bg-neutral-900`,!p&&`hidden`),children:[(0,B.jsx)(`video`,{ref:e.video,muted:!0,playsInline:!0,autoPlay:!0,className:I(`absolute inset-0 h-full w-full object-cover`,e.facing===`user`&&`-scale-x-100`,e.camera?`block`:`hidden`)}),e.camera?null:(0,B.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 text-white/50`,children:[(0,B.jsx)(ye,{className:`size-8`}),(0,B.jsx)(`span`,{className:`text-[0.8125rem]`,children:v(`video.cameraOff`)})]}),(0,B.jsxs)(`span`,{className:`absolute bottom-2 left-3 rounded-md bg-black/50 px-2 py-0.5 text-[0.75rem]`,children:[v(`video.you`),e.muted?(0,B.jsx)(le,{className:`ml-1.5 inline size-3`}):null]})]}),(0,B.jsxs)(`div`,{className:I(`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,B.jsx)(`div`,{className:I(`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,B.jsx)(ce,{kind:t?.wizard.avatar??`round`,size:p?140:200,fluffy:!0,interactive:!1})}),p?(0,B.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,B.jsx)(Te,{voice:e}):i&&(m||h)?(0,B.jsx)(`div`,{className:`shrink-0 px-4 pb-2 sm:px-5`,children:(0,B.jsxs)(`div`,{className:`mx-auto max-w-[720px] space-y-1 text-center`,children:[h?(0,B.jsx)(`p`,{className:`line-clamp-1 text-[0.8125rem] text-white/50`,children:h.text}):null,m?(0,B.jsx)(`p`,{className:`line-clamp-3 text-[0.9375rem] text-white/95 leading-snug`,children:m.text}):null]})}):null,e.error?(0,B.jsx)(`p`,{className:`shrink-0 px-5 pb-2 text-center text-[0.8125rem] text-rose`,children:e.error}):null,(0,B.jsx)(`div`,{className:`flex shrink-0 items-center justify-center gap-3 px-4 pt-1 pb-4`,children:i?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{label:v(e.muted?`video.unmute`:`video.mute`),on:!e.muted,onClick:e.toggleMute,children:e.muted?(0,B.jsx)(le,{className:`size-5`}):(0,B.jsx)(a,{className:`size-5`})}),(0,B.jsx)(V,{label:v(e.camera?`talk.cameraOff`:`talk.camera`),on:e.camera,onClick:()=>e.camera?e.stopCamera():void e.startCamera(),children:e.camera?(0,B.jsx)(x,{className:`size-5`}):(0,B.jsx)(ye,{className:`size-5`})}),e.camera&&Ce?(0,B.jsx)(V,{label:v(`video.flip`),onClick:()=>void e.flipCamera(),children:(0,B.jsx)(ee,{className:`size-5`})}):null,(0,B.jsx)(V,{label:v(`video.leave`),danger:!0,onClick:f,children:(0,B.jsx)(ae,{className:`size-5`})})]}):(0,B.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,B.jsxs)(`button`,{type:`button`,disabled:o||!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:[o?(0,B.jsx)(g,{className:`size-4`}):n?(0,B.jsx)(x,{className:`size-5`}):(0,B.jsx)(a,{className:`size-5`}),v(l?`video.rejoin`:n?`video.join`:`talk.start`)]}),!l&&!e.error?(0,B.jsx)(`p`,{className:`max-w-sm text-center text-[0.75rem] text-white/50`,children:v(n?`video.hint`:`talk.joinHint`)}):null]})})]})}var De=e=>E[e.kind]!==`device`,Oe=1024,ke=4e3;function H(e,t){return e?e.length>t?`${e.slice(0,t)} …`:e:``}function U(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
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: ${A(t)}`),r.join(`
|
|
3
3
|
`)}if(e.status===`done`){r.push(`done. made:`);for(let{step:t,output:n}of e.shown)r.push(`- ${t.title}: ${H(n?.text,400)||`(a file, on the screen)`}`);return r.join(`
|
|
4
4
|
`)}if(e.status===`failed`)return r.push(`failed: ${e.error??``}; go_back or the person retries on the screen`),r.join(`
|
|
5
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=De(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?` = ${H(String(Array.isArray(n)?n.join(`, `):n),120)}`:` = (open)`}`)}return r.join(`
|
|
6
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}": ${H(n?.text,600)||`(a picture or file, on the screen)`}`);return r.push(`regenerate allowed: ${e.step.regenerate?`yes`:`no`}`),r.join(`
|
|
7
7
|
`)}return r.push(`step: ${e.step?.title??``}`),r.join(`
|
|
8
|
-
`)}function Ae(e,t,n,r){let[i,a]=(0,z.useState)(`off`),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(`environment`),[g,_]=(0,z.useState)(!1),[y,b]=(0,z.useState)([]),x=(0,z.useRef)(null),S=(0,z.useRef)(null),C=(0,z.useRef)(0),w=(0,z.useRef)(!1);w.current=f;let T=(0,z.useRef)(null),E=(0,z.useRef)(null),D=(0,z.useRef)(null),O=(0,z.useRef)(null),k=(0,z.useRef)(t);k.current=t;let A=(0,z.useRef)(r);A.current=r;let j=(0,z.useRef)(n);j.current=n;let M=(0,z.useRef)(``),N=(0,z.useCallback)(e=>{let t=E.current;t&&t.readyState===`open`&&t.send(JSON.stringify(e))},[]),P=(0,z.useCallback)(()=>{let e=x.current;if(!w.current||!e||e.videoWidth===0)return null;let t=Math.min(1,Oe/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)},[]),F=(0,z.useCallback)(()=>{for(let e of S.current?.getTracks()??[])e.stop();S.current=null,x.current&&(x.current.srcObject=null),p(!1)},[]),I=(0,z.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;h(n===`user`||n===`environment`?n:t),x.current&&(x.current.srcObject=e,await x.current.play().catch(()=>void 0)),p(!0)}catch(e){s(e.name===`NotAllowedError`?v(`talk.cameraDenied`):e.message)}},[]),ee=(0,z.useCallback)(async()=>{let e=m===`user`?`environment`:`user`;F(),await I(e)},[m,F,I]),te=(0,z.useCallback)(()=>{_(e=>{for(let t of O.current?.getAudioTracks()??[])t.enabled=e;return!e})},[]),L=(0,z.useCallback)(()=>{F(),E.current?.close(),E.current=null,T.current?.close(),T.current=null;for(let e of O.current?.getTracks()??[])e.stop();O.current=null,D.current&&=(D.current.srcObject=null,D.current.remove(),null),M.current=``,l(!1),d(!1),_(!1),a(`off`)},[F]);(0,z.useEffect)(()=>()=>L(),[L]);let ne=(0,z.useCallback)(async(t,n)=>{let r=k.current,i=A.current,a=j.current;switch(t){case`get_state`:return r?U(r,i,w.current):`no run`;case`look`:{let e=P();return e?(N({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=P();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 R.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&&De(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 R.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,P,N]),re=(0,z.useCallback)(async()=>{if(!T.current){s(null),b([]),a(`connecting`);try{let t=await R.post(`/api/runs/${e}/talk`),n=await navigator.mediaDevices.getUserMedia({audio:!0});O.current=n;let r=new RTCPeerConnection;T.current=r;let i=document.createElement(`audio`);i.autoplay=!0,i.setAttribute(`playsinline`,``),document.body.append(i),D.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`);E.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()-C.current>ke?P():null;e&&(C.current=Date.now(),N({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{}ne(e,r).then(e=>{N({type:`conversation.item.create`,item:{type:`function_call_output`,call_id:n,output:e}}),N({type:`response.create`})});break}case`error`:s(String(t.error?.message??`error`))}},o.onopen=()=>{a(`live`);let e=k.current;e&&(M.current=U(e,A.current,w.current),N({type:`conversation.item.create`,item:{type:`message`,role:`user`,content:[{type:`input_text`,text:`[state]\n${M.current}\n\nGreet the person in one sentence and ask the first open field.`}]}}),N({type:`response.create`}))},o.onclose=()=>{T.current===r&&L()};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(`${v(`talk.failed`)} (${u.status})`);await r.setRemoteDescription({type:`answer`,sdp:await u.text()})}catch(e){L(),s(e.name===`NotAllowedError`?v(`chat.micDenied`):e.message),a(`error`)}}},[e,ne,P,N,L]);return(0,z.useEffect)(()=>{if(i!==`live`||!t)return;let e=U(t,r,f);if(e===M.current)return;let n=M.current;M.current=e,N({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(`
|
|
8
|
+
`)}function Ae(e,t,n,r){let[i,a]=(0,z.useState)(`off`),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(`environment`),[g,_]=(0,z.useState)(!1),[y,b]=(0,z.useState)([]),x=(0,z.useRef)(null),S=(0,z.useRef)(null),C=(0,z.useRef)(0),w=(0,z.useRef)(!1);w.current=f;let T=(0,z.useRef)(null),E=(0,z.useRef)(null),D=(0,z.useRef)(null),O=(0,z.useRef)(null),k=(0,z.useRef)(t);k.current=t;let A=(0,z.useRef)(r);A.current=r;let j=(0,z.useRef)(n);j.current=n;let M=(0,z.useRef)(``),N=(0,z.useCallback)(e=>{let t=E.current;t&&t.readyState===`open`&&t.send(JSON.stringify(e))},[]),P=(0,z.useCallback)(()=>{let e=x.current;if(!w.current||!e||e.videoWidth===0)return null;let t=Math.min(1,Oe/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)},[]),F=(0,z.useCallback)(()=>{for(let e of S.current?.getTracks()??[])e.stop();S.current=null,x.current&&(x.current.srcObject=null),p(!1)},[]),I=(0,z.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;h(n===`user`||n===`environment`?n:t),x.current&&(x.current.srcObject=e,await x.current.play().catch(()=>void 0)),p(!0)}catch(e){s(e.name===`NotAllowedError`?v(`talk.cameraDenied`):e.message)}},[]),ee=(0,z.useCallback)(async()=>{let e=m===`user`?`environment`:`user`;F(),await I(e)},[m,F,I]),te=(0,z.useCallback)(()=>{_(e=>{for(let t of O.current?.getAudioTracks()??[])t.enabled=e;return!e})},[]),L=(0,z.useCallback)(()=>{F(),E.current?.close(),E.current=null,T.current?.close(),T.current=null;for(let e of O.current?.getTracks()??[])e.stop();O.current=null,D.current&&=(D.current.srcObject=null,D.current.remove(),null),M.current=``,l(!1),d(!1),_(!1),a(`off`)},[F]);(0,z.useEffect)(()=>()=>L(),[L]);let ne=(0,z.useCallback)(async(t,n)=>{let r=k.current,i=A.current,a=j.current;switch(t){case`get_state`:return r?U(r,i,w.current):`no run`;case`look`:{let e=P();return e?(N({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=P();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 R.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&&De(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 R.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,P,N]),re=(0,z.useCallback)(async()=>{if(!T.current){s(null),b([]),a(`connecting`);try{let t=await R.post(`/api/runs/${e}/talk`),n=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});O.current=n;let r=new RTCPeerConnection;T.current=r;let i=document.createElement(`audio`);i.autoplay=!0,i.setAttribute(`playsinline`,``),document.body.append(i),D.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`);E.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()-C.current>ke?P():null;e&&(C.current=Date.now(),N({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{}ne(e,r).then(e=>{N({type:`conversation.item.create`,item:{type:`function_call_output`,call_id:n,output:e}}),N({type:`response.create`})});break}case`error`:s(String(t.error?.message??`error`))}},o.onopen=()=>{a(`live`);let e=k.current;e&&(M.current=U(e,A.current,w.current),N({type:`conversation.item.create`,item:{type:`message`,role:`user`,content:[{type:`input_text`,text:`[state]\n${M.current}\n\nGreet the person in one sentence and ask the first open field.`}]}}),N({type:`response.create`}))},o.onclose=()=>{T.current===r&&L()};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(`${v(`talk.failed`)} (${u.status})`);await r.setRemoteDescription({type:`answer`,sdp:await u.text()})}catch(e){L(),s(e.name===`NotAllowedError`?v(`chat.micDenied`):e.message),a(`error`)}}},[e,ne,P,N,L]);return(0,z.useEffect)(()=>{if(i!==`live`||!t)return;let e=U(t,r,f);if(e===M.current)return;let n=M.current;M.current=e,N({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
9
|
`)[1]!==e.split(`
|
|
10
10
|
`)[1])&&N({type:`response.create`})},[i,t,r,f,N]),{state:i,error:o,speaking:c,listening:u,start:re,stop:L,camera:f,facing:m,startCamera:I,stopCamera:F,flipCamera:ee,muted:g,toggleMute:te,captions:y,video:x}}var W=(e,t,n)=>({key:e,who:`bot`,node:t,...n}),G=(e,t,n)=>({key:e,who:`me`,node:t,...n}),je=(0,z.createContext)(null),K=(0,z.createContext)(null);function Me(){return(0,z.useContext)(K)?.voice??null}function q({children:e}){let t=(0,z.useContext)(je);return t?(0,Se.createPortal)(e,t):null}function Ne({header:e,footer:t,children:n}){let[r,i]=(0,z.useState)(null),a=(0,z.useRef)(null),o=(0,z.useRef)(null),s=(0,z.useRef)(!0);return(0,z.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,B.jsx)(je.Provider,{value:r,children:(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[e,(0,B.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,B.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,B.jsxs)(`div`,{className:`shrink-0 border-border-soft border-t bg-background`,onPointerDownCapture:()=>{s.current=!0},onKeyDownCapture:()=>{s.current=!0},children:[(0,B.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,z.useContext)(K),r=(0,z.useMemo)(()=>t.map(e=>({key:e.key,who:e.who,spoken:!e.bare&&!e.wide})),[t]),i=(0,z.useCallback)(e=>{let t=document.querySelector(`[data-say="${CSS.escape(e)}"]`);return t?.querySelector(`[data-say-text]`)?.getAttribute(`data-say-text`)??t?.innerText??null},[]);oe(!!n?.readAloud,n?.lang??P,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,B.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,B.jsx)(`div`,{className:`sticky top-1 shrink-0 pt-0.5`,children:(0,B.jsx)(ce,{kind:e,size:30,interactive:n>=a.length-2})}),(0,B.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-1.5`,children:t.lines.map(e=>(0,B.jsx)(`div`,{"data-anchor":e.anchor?``:void 0,"data-say":e.key,className:I(`animate-rise`,e.bare?`w-full pt-1`:`rounded-2xl rounded-tl-md text-[0.9375rem] text-ink leading-relaxed`,!e.bare&&(e.wide?I(`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,B.jsxs)(`div`,{className:`flex animate-rise flex-col items-end gap-1 pl-10`,children:[(0,B.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,B.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,B.jsx)(te,{className:`size-3`}),` `,v(`chat.change`)]}):null]},e.key)))}function Pe(){return(0,B.jsx)(`span`,{className:`inline-flex items-center gap-1 py-1.5`,role:`status`,"aria-label":v(`run.working`),children:[0,1,2].map(e=>(0,B.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,B.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e})}var X=(e,t)=>W(e,(0,B.jsx)(Y,{children:t}),{bare:!0});function Z({onClick:e,children:t,primary:n,on:r,disabled:i,busy:a}){return(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":r,disabled:i||a,onClick:e,className:I(`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,B.jsx)(g,{className:`size-4`}):null,t]})}function Fe({initial:e=``,placeholder:t,multiline:n,inputProps:r,busy:o,disabled:s,inputRef:l,onSend:u}){let[d,f]=(0,z.useState)(e),p=(0,z.useRef)(null),h=l??p,_=(0,z.useContext)(K),y=b(d,f,{endpoint:_?`/api/runs/${_.runId}/transcribe`:void 0}),S=!!_&&y.supported&&!s;(0,z.useEffect)(()=>{if(!S)return;let e=e=>{(e.metaKey||e.ctrlKey)&&e.shiftKey&&e.key.toLowerCase()===`m`&&(e.preventDefault(),y.toggle())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[S,y.toggle]),(0,z.useEffect)(()=>{!c&&!s&&h.current?.focus()},[s,h]);let T=()=>{o||s||(y.listening&&y.toggle(),u(d)!==!1&&f(``))},E=y.listening?v(`chat.listening`):y.processing?v(`chat.transcribing`):t,D=_?.voice??null,O=!!_?.call,k=_&&!O&&(ie||S||D)?(0,B.jsxs)(`div`,{className:`mb-1 flex shrink-0 items-center`,children:[D?(0,B.jsx)(m,{label:v(D.state===`live`?`talk.stop`:D.state===`connecting`?`talk.connecting`:`talk.start`),"aria-pressed":D.state===`live`,disabled:D.state===`connecting`,onClick:()=>D.state===`live`?D.stop():void D.start(),className:I(`size-9`,D.state===`live`&&`bg-rose-tint text-rose hover:bg-rose-tint hover:text-rose`,D.state===`off`&&_.talk&&`bg-primary text-primary-foreground hover:bg-primary`),children:D.state===`connecting`?(0,B.jsx)(g,{className:`size-4`}):D.state===`live`?(0,B.jsx)(ae,{className:`size-4`}):(0,B.jsx)(re,{className:`size-4`})}):null,D?.state===`live`?(0,B.jsx)(m,{label:v(D.camera?`talk.cameraOff`:`talk.camera`),"aria-pressed":D.camera,onClick:()=>D.camera?D.stopCamera():void D.startCamera(),className:I(`size-9`,D.camera&&`text-ink`),children:D.camera?(0,B.jsx)(x,{className:`size-4`}):(0,B.jsx)(ye,{className:`size-4`})}):null,ie?(0,B.jsx)(m,{label:v(_.readAloud?`chat.readAloudOff`:`chat.readAloud`),"aria-pressed":_.readAloud,onClick:()=>_.setReadAloud(!_.readAloud),className:I(`size-9`,_.readAloud&&`text-ink`),children:_.readAloud?(0,B.jsx)(fe,{className:`size-4`}):(0,B.jsx)(xe,{className:`size-4`})}):null,S?(0,B.jsx)(m,{label:v(y.listening?`chat.dictateStop`:`chat.dictate`),"aria-pressed":y.listening,disabled:y.processing,onClick:y.toggle,className:I(`size-9`,y.listening&&`bg-rose-tint text-rose hover:bg-rose-tint hover:text-rose`),children:y.processing?(0,B.jsx)(g,{className:`size-4`}):y.listening?(0,B.jsx)(C,{className:`size-3.5 animate-pulse-dot fill-current`}):(0,B.jsx)(a,{className:`size-4`})}):null]}):null;return(0,B.jsxs)(`form`,{className:`pb-3`,onSubmit:e=>{e.preventDefault(),T()},children:[D&&!O?(0,B.jsx)(`video`,{ref:D.video,muted:!0,playsInline:!0,autoPlay:!0,className:I(`mb-2 ml-auto w-32 rounded-xl bg-black object-cover shadow-soft ring-1 ring-border-soft`,D.camera?`block`:`hidden`)}):null,(0,B.jsxs)(`div`,{className:I(`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`,s&&`opacity-60`),children:[k,n?(0,B.jsx)(w,{ref:h,minRows:1,maxRows:6,value:d,disabled:s,placeholder:E,autoCapitalize:`sentences`,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!c&&!e.nativeEvent.isComposing&&(e.preventDefault(),T())},className:`min-h-11 border-0 bg-transparent py-2.5 shadow-none focus:ring-0`}):(0,B.jsx)(`input`,{ref:h,...r,value:d,disabled:s,placeholder:E,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,B.jsx)(`button`,{type:`submit`,"aria-label":v(`chat.send`),title:v(`chat.send`),disabled:o||s,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:o?(0,B.jsx)(g,{className:`size-4`}):(0,B.jsx)(i,{className:`size-4`})})]}),y.error?(0,B.jsx)(`p`,{className:`mt-1.5 px-3 text-[0.75rem] text-rose`,children:y.error===`denied`?v(`chat.micDenied`):y.error}):O?null:D?.error?(0,B.jsx)(`p`,{className:`mt-1.5 px-3 text-[0.75rem] text-rose`,children:D.error}):D?.state===`live`?(0,B.jsx)(`p`,{className:`mt-1.5 px-3 text-[0.75rem] text-ink-3`,children:D.speaking?v(`talk.speaking`):D.listening?v(`talk.listening`):v(`talk.live`)}):_?.talk&&D?.state===`off`?(0,B.jsx)(`p`,{className:`mt-1.5 px-3 text-[0.75rem] text-ink-3`,children:v(`talk.hint`)}):null]})}function Q({placeholder:e=v(`chat.above`)}){return(0,B.jsx)(q,{children:(0,B.jsx)(Fe,{disabled:!0,placeholder:e,onSend:()=>!1})})}function Ie(e){let t=E[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?v(`chat.required`):null;let r=String(t).trim();if(e.kind===`email`&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r))return v(`chat.badEmail`);if(e.kind===`url`)try{new URL(r)}catch{return v(`chat.badUrl`)}return e.kind===`number`&&!Number.isFinite(Number(r.replace(`,`,`.`)))?v(`chat.badNumber`):Array.isArray(t)&&e.multiple&&e.min&&t.length<e.min?v(`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,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`font-medium`,children:e.label}),e.help?(0,B.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,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`font-medium`,children:e.title}),e.description?(0,B.jsx)(`span`,{className:`mt-0.5 block text-ink-2`,children:e.description}):null,t?.help?(0,B.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,B.jsx)(B.Fragment,{children:typeof t==`string`&&t?t:v(`chat.connected`)});if(e.kind===`list`)return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(f,{className:`size-4`}),` `,v(`chat.checked`)]});if(e.kind===`toggle`)return(0,B.jsx)(B.Fragment,{children:v(t===!0?`run.yes`:`run.no`)});if(Le(t))return(0,B.jsx)(`span`,{className:`italic opacity-80`,children:v(`chat.skipped`)});switch(e.kind){case`multiselect`:return(0,B.jsx)(B.Fragment,{children:t.join(`, `)});case`date`:{let e=new Date(`${String(t)}T00:00`);return(0,B.jsx)(B.Fragment,{children:Number.isNaN(e.getTime())?String(t):new Intl.DateTimeFormat(P,{dateStyle:`long`}).format(e)})}case`color`:return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`size-4 rounded-full ring-1 ring-white/50`,style:{background:String(t)}}),String(t)]});case`image`:case`signature`:return(0,B.jsx)(`span`,{className:`-mx-1.5 flex flex-wrap gap-1.5`,children:(Array.isArray(t)?t:[String(t)]).map(t=>(0,B.jsx)(`img`,{src:s(`/api/runs/${n}/assets/${t}`),alt:``,className:I(`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,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(ne,{className:`size-4`}),` `,v(e===1?`chat.file`:`chat.files`,{n:e})]})}case`audio`:{let e=t.seconds;return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(a,{className:`size-4`}),` `,v(`chat.voice`),e?` · ${Math.round(e)} s`:``]})}case`location`:{let e=t;return(0,B.jsx)(B.Fragment,{children:e.label||`${e.lat?.toFixed(5)}, ${e.lng?.toFixed(5)}`})}case`items`:return(0,B.jsx)(B.Fragment,{children:v(`chat.rows`,{n:Array.isArray(t)?t.length:0})});default:return(0,B.jsx)(B.Fragment,{children:String(t)})}}function Ue(e,t,n,r,i,a){let o=[W(t,(0,B.jsx)(Ve,{step:e,only:a}))];for(let e of i)a||o.push(W(`${t}:${e.id}`,(0,B.jsx)(Be,{field:e}))),o.push(G(`${t}:${e.id}:a`,(0,B.jsx)(He,{field:e,value:n[e.id],runId:r})));return o}var We=(e,t)=>e.fields.filter(e=>!e.when&&!L(e)||t[e.id]!==void 0&&t[e.id]!==null);function Ge(e,t){let n=[];e.wizard.description&&n.push(W(`hello`,e.wizard.description)),e.wizard.intro&&n.push(W(`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(W(i,(0,B.jsx)(`span`,{className:`font-medium`,children:r.title}))),n.push(G(`${i}:a`,v(`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=>!L(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:i}){let a=(0,z.useMemo)(()=>Ke(n,e),[n,e]),o=e.known??{},[s,c]=(0,z.useState)(()=>h(n,e)),[l,u]=(0,z.useState)(()=>n.fields.some(t=>e.values[t.id]!==void 0)?r(Ke(n,e),e.known??{},h(n,e)).slice(0,-1).map(e=>e.id):[]),[d,f]=(0,z.useState)({}),[p,m]=(0,z.useState)(!1),[g,_]=(0,z.useState)(!1),y=r(a,o,s),b=y.filter(e=>l.includes(e.id)),x=y.find(e=>!l.includes(e.id)),S=a.length===1?a[0]:void 0,C=b.at(-1),w=C?()=>u(e=>e.filter(e=>e!==C.id)):void 0;(0,z.useEffect)(()=>{let e=Object.keys(t.fieldErrors),n=r(a,o,s),i=n.findIndex(t=>e.includes(t.id));i>=0&&(u(n.slice(0,i).map(e=>e.id)),f(t.fieldErrors))},[t.fieldErrors]);let T=e=>{t.submitPage(n.id,e).then(_)},E=(0,z.useContext)(K),O=(0,z.useRef)(s);O.current=s;let k=E?.bindPage,A=(0,z.useRef)(T);A.current=T,(0,z.useEffect)(()=>{if(!k)return;let e=r(a,o,s);return k({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:()=>A.current(O.current)}),()=>k(null)},[k,n,a,o,s]);let j=e=>{if(!x)return!1;let t=Re(x,e);if(t)return f({[x.id]:t}),!1;let n={...s,[x.id]:e},i=[...l,x.id];return c(n),u(i),f({}),r(a,o,n).some(e=>!i.includes(e.id))||T(n),!0},M=[...i.map(e=>l.length?{...e,onEdit:void 0}:e),...Ue(n,`now:${n.id}`,s,e.id,b,S).map((e,t,n)=>t===n.length-1&&e.who===`me`&&x?{...e,onEdit:w}:e)];x?(Ie(x)===`control`?M.push(W(`now:${n.id}:${x.id}:control`,(0,B.jsx)(D,{field:x,value:s[x.id],values:s,runId:e.id,view:e,closed:e.closed?.[x.id],onChange:e=>c(t=>({...t,[x.id]:e})),onBusy:m}),{wide:!0})):S||M.push(W(`now:${n.id}:${x.id}`,(0,B.jsx)(Be,{field:x}))),d[x.id]&&M.push(W(`now:${n.id}:${x.id}:error`,d[x.id],{tone:`error`}))):t.busy||g?M.push(W(`sending`,(0,B.jsx)(Pe,{}))):t.error&&M.push(W(`send-error`,t.error,{tone:`error`}));let N=(0,B.jsx)(Q,{});if(g||!x&&l.length>0&&t.busy)N=(0,B.jsx)(Q,{placeholder:v(`run.working`)});else if(!x)M.push(X(`now:${n.id}:go`,(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Z,{primary:!0,busy:t.busy,onClick:()=>T(s),children:n.cta||v(`run.next`)}),w?(0,B.jsx)(Z,{onClick:w,disabled:t.busy,children:v(`run.back`)}):null]})));else{let r=Ie(x),i=!x.required&&x.kind!==`connection`&&x.kind!==`list`?(0,B.jsx)(Z,{onClick:()=>j(void 0),children:v(`chat.skip`)}):null;if(r===`typed`){i&&M.push(X(`now:${n.id}:${x.id}:replies`,i));let e=s[x.id];N=(0,B.jsx)(q,{children:(0,B.jsx)(Fe,{initial:Le(e)?``:String(e),multiline:x.kind===`textarea`,placeholder:x.placeholder||(S?x.label:v(`chat.placeholder`)),inputProps:Je(x),busy:t.busy,onSend:e=>j(ze(x,e))},x.id)})}else if(r===`tapped`)M.push(W(`now:${n.id}:${x.id}:replies`,(0,B.jsx)(Ye,{field:x,view:e,value:s[x.id],onAnswer:j}),{bare:!0}));else{let e=y.filter(e=>!l.includes(e.id)).length===1;M.push(X(`now:${n.id}:${x.id}:replies`,(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Z,{primary:!0,disabled:p,onClick:()=>j(s[x.id]),children:e&&n.cta?n.cta:v(`chat.send`)}),i]})))}}return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(J,{avatar:e.wizard.avatar,lines:M}),N]})}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 y(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,z.useState)(Array.isArray(n)?n:[]);if(e.kind===`toggle`)return(0,B.jsxs)(Y,{children:[(0,B.jsx)(Z,{on:n===!1,disabled:i.has(`false`),onClick:()=>r(!1),children:v(`run.no`)}),(0,B.jsx)(Z,{on:n===!0,disabled:i.has(`true`),onClick:()=>r(!0),children:v(`run.yes`)})]});let s=e.options??[];return e.kind===`multiselect`?(0,B.jsxs)(Y,{children:[s.map(e=>(0,B.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,B.jsx)(Z,{primary:!0,disabled:e.required&&!a.length,onClick:()=>r(a),children:a.length||e.required?v(`chat.send`):v(`chat.skip`)})]}):(0,B.jsxs)(Y,{children:[s.map(e=>(0,B.jsx)(Z,{on:n===e,disabled:i.has(e),onClick:()=>r(e),children:e},e)),e.required?null:(0,B.jsx)(Z,{onClick:()=>r(void 0),children:v(`chat.skip`)})]})}function Xe({view:e}){let t=(0,z.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(),[r,i]=(0,z.useState)(Date.now());(0,z.useEffect)(()=>{let e=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(e)},[]);let a=e.events.filter(e=>(e.type===`tool`||e.type===`info`)&&new Date(e.at).getTime()>=n-500),o=a.at(-1),c=[...a].reverse().find(Qe),l=[...new Set(a.map(e=>e.asset).filter(e=>!!e))];return(0,B.jsxs)(`div`,{className:I(`flex max-w-full flex-col gap-1`,c?`w-full`:`w-96`),"data-say-text":t?.message??e.step?.title??v(`run.working`),children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(Pe,{}),(0,B.jsx)(`span`,{className:`font-medium`,children:t?.message??e.step?.title??v(`run.working`)}),(0,B.jsx)(`span`,{className:`text-[0.75rem] text-ink-4 tabular-nums`,children:v(`run.elapsed`,{s:Math.max(0,Math.round((r-n)/1e3))})})]}),o&&o!==c?(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[0.8125rem] text-ink-3`,children:[(0,B.jsx)(T,{className:`size-3.5 shrink-0 animate-breathe text-ember`}),(0,B.jsx)(`span`,{className:`truncate`,children:A(o)})]}):null,c&&e.status===`running`?(0,B.jsx)(et,{runId:e.id,event:c}):null,l.length?(0,B.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:l.slice(-6).map(t=>(0,B.jsx)(`img`,{src:s(`/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,z.useState)(null),[i,a]=(0,z.useState)(`agent`),[s,c]=(0,z.useState)(!1),l=t.note?.code;if((0,z.useEffect)(()=>{l===`personDrives`?a(`person`):l===`agentDrives`&&a(`agent`)},[l]),(0,z.useEffect)(()=>{let t=()=>R.get(`/api/runs/${e}/browser/seat`).then(e=>a(e.seat)).catch(()=>void 0);if(t(),i!==`person`)return;let n=setInterval(t,$e);return()=>clearInterval(n)},[e,i]),n!==null&&n>=t.id)return null;let u=i===`person`,d=async()=>{c(!0);try{let t=await R.post(`/api/runs/${e}/browser/seat`,{to:u?`agent`:`person`});a(t.seat)}catch{}finally{c(!1)}};return(0,B.jsx)(o,{runId:e,driving:u,caption:A(t),hint:v(`browser.driving`),onBroken:()=>r(t.id),className:`mt-1.5`,action:(0,B.jsxs)(`button`,{type:`button`,disabled:s,onClick:()=>void d(),className:I(`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,B.jsx)(_e,{className:`size-3.5`}):(0,B.jsx)(he,{className:`size-3.5`}),v(u?`browser.handBack`:`browser.takeOver`)]})},n??0)}function $({children:e,end:t}){return(0,B.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,B.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,z.useState)(o.length===1?o[0].step.id:null),l=(0,z.useRef)(null),u=[...r,...i.map((e,t)=>G(`review:${n.id}:asked:${t}`,e)),W(`review:${n.id}`,(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`font-medium`,children:n.title}),n.description?(0,B.jsx)(`span`,{className:`mt-0.5 block text-ink-2`,children:n.description}):null]}),{anchor:!0}),...o.map(({step:t,output:r})=>W(`review:${n.id}:${t.id}`,(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)($,{children:t.title}),(0,B.jsx)(j,{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=>W(`review:${n.id}:list:${t.def.id}`,(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)($,{children:t.def.title}),t.def.check?(0,B.jsx)(M,{runId:e.id,list:t}):(0,B.jsx)(S,{runId:e.id,list:t,editable:!0})]}),{wide:!0}))];t.error&&u.push(W(`review-error`,t.error,{tone:`error`}));let d=n.regenerate&&o.length>0;return u.push(X(`review:${n.id}:replies`,(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(Z,{primary:!0,busy:t.busy,onClick:()=>void t.accept(n.id),children:[(0,B.jsx)(f,{className:`size-4`}),` `,v(`run.accept`)]}),d&&o.length>1?o.map(({step:e})=>(0,B.jsx)(Z,{on:s===e.id,onClick:()=>c(e.id),children:e.title},e.id)):null]}))),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(J,{avatar:e.wizard.avatar,lines:u}),d?(0,B.jsx)(q,{children:(0,B.jsx)(Fe,{multiline:!0,inputRef:l,busy:t.busy,placeholder:o.length>1&&!s?v(`run.feedbackPick`):v(`run.feedbackPlaceholder`),disabled:!s,onSend:e=>{let r=e.trim();return!r||!s?!1:(a(r),t.regenerate(n.id,s,r),!0)}})}):(0,B.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,W(`result:${n.id}`,(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`font-display font-semibold text-[1.0625rem]`,children:n.title}),n.message?(0,B.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})=>W(`result:${e.id}`,(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)($,{end:(0,B.jsx)(d,{base:o,stepId:e.id,formats:n,title:r??e.title}),children:r??e.title}),(0,B.jsx)(j,{base:o,step:e,output:t}),t?.assets?.some(e=>e.ai)?(0,B.jsx)(`p`,{className:`mt-3 text-[0.75rem] text-ink-3 leading-relaxed`,children:v(`ai.publish`)}):null]}),{wide:!0})),...e.lists.map(t=>W(`result:list:${t.def.id}`,(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)($,{end:(0,B.jsx)(F,{runId:e.id,list:t}),children:t.label??t.def.title}),(0,B.jsx)(S,{runId:e.id,list:t,editable:!0})]}),{wide:!0}))];return s.push(X(`result:replies`,(0,B.jsxs)(B.Fragment,{children:[a.length?(0,B.jsx)(de,{runId:e.id,title:`${n.title} · ${e.wizard.title}`,initial:e.shareUrl?{url:e.shareUrl,expiresAt:e.expiresAt}:null}):null,i?(0,B.jsxs)(Z,{onClick:i,children:[(0,B.jsx)(k,{className:`size-4`}),` `,v(`run.again`)]}):null,e.canBack?(0,B.jsx)(Z,{onClick:()=>void t.back(),disabled:t.busy,children:v(`run.back`)}):null,e.keeps?(0,B.jsx)(`span`,{className:`ml-1`,children:(0,B.jsx)(O,{runId:e.id})}):null]}))),(0,B.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=pe(e),{view:c}=s,[d,f]=(0,z.useState)(null),p=Ae(e,c,s,d);(0,z.useEffect)(()=>{n?.(c)},[c,n]);let[m,h]=se(),y=(0,z.useMemo)(()=>({runId:e,lang:c?.lang??P,readAloud:m,setReadAloud:h,voice:c?.talk?p:null,talk:a,call:!!o,bindPage:f}),[e,c?.lang,c?.talk,m,h,p,a,o]);l(c?.status===`running`&&!c.ask),_(c);let[b,x]=(0,z.useState)({}),[S,C]=(0,z.useState)(null);(0,z.useEffect)(()=>{c&&c.status!==`running`&&C(null)},[c]);let w;if(s.notFound)w=(0,B.jsx)(`div`,{className:`py-24 text-center text-ink-3`,children:v(`run.notFound`)});else if(!c)w=(0,B.jsx)(`div`,{className:`flex justify-center py-24 text-ink-4`,children:(0,B.jsx)(g,{})});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)w=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(J,{avatar:c.wizard.avatar,lines:[...r,W(`ask:${c.ask.id}`,(0,B.jsx)(u,{runId:c.id,ask:c.ask}),{wide:!0})]}),(0,B.jsx)(Q,{})]});else if(c.status===`running`)w=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(J,{avatar:c.wizard.avatar,lines:[...r,...S?[G(`note`,S)]:[],W(`working:${e?.id}`,(0,B.jsx)(Xe,{view:c}),{wide:c.events.some(t=>t.stepId===e?.id&&Qe(t))?`most`:void 0})]}),(0,B.jsx)(Q,{placeholder:v(`run.working`)})]});else if(c.status===`failed`)w=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(J,{avatar:c.wizard.avatar,lines:[...r,W(`failed`,(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`font-medium`,children:v(`run.failed`)}),c.error?(0,B.jsx)(`span`,{className:`mt-0.5 block`,children:(0,B.jsx)(N,{text:c.error})}):null]}),{tone:`error`}),X(`failed:replies`,(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(Z,{primary:!0,busy:s.busy,onClick:()=>void s.retry(),children:[(0,B.jsx)(k,{className:`size-4`}),` `,v(`run.retry`)]}),c.canBack?(0,B.jsx)(Z,{onClick:()=>void s.back(),disabled:s.busy,children:v(`run.back`)}):null]}))]}),(0,B.jsx)(Q,{})]});else if(c.status===`cancelled`)w=(0,B.jsx)(J,{avatar:c.wizard.avatar,lines:[...r,W(`cancelled`,v(`run.cancelled`)),...t?[X(`cancelled:replies`,(0,B.jsxs)(Z,{primary:!0,onClick:t,children:[(0,B.jsx)(k,{className:`size-4`}),` `,v(`run.again`)]}))]:[]]});else if(e?.type===`page`)w=(0,B.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(`|`);w=(0,B.jsx)(tt,{view:c,run:s,step:e,before:r,asked:b[e.id]??[],onNote:t=>{C(t),x(n=>({...n,[e.id]:[...n[e.id]??[],t]}))}},`${e.id}:${t}`)}else w=e?.type===`result`?(0,B.jsx)(nt,{view:c,run:s,step:e,before:r,onRestart:t}):(0,B.jsx)(J,{avatar:c.wizard.avatar,lines:r})}return o?(0,B.jsx)(K.Provider,{value:y,children:(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col lg:flex-row`,children:[(0,B.jsx)(Ee,{voice:p,view:c,video:o===`video`,className:`h-[46dvh] shrink-0 lg:h-auto lg:min-h-0 lg:flex-1`}),(0,B.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,B.jsx)(Ne,{footer:i,children:w})})]})}):(0,B.jsx)(K.Provider,{value:y,children:(0,B.jsx)(Ne,{header:r,footer:i,children:w})})}export{J as a,Z as i,Ne as n,X as o,Q as r,Me as s,rt as t};
|