@agimon-ai/po-workflow 0.0.0-alpha.1 → 0.0.0-alpha.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.
@@ -0,0 +1,1634 @@
1
+ import { createApiClient, defineActivityGroup, defineChannelFile, defineFill, defineNativePlugin, defineSessionStore, nativeApiTransport, sessionApiAddress } from "@agimon-ai/po-core/native";
2
+ import { Badge, Button, CodeBlock, Dot, Input, ListRow, Markdown, Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, Textarea, WorkflowIcon } from "@agimon-ai/po-native-components";
3
+ import { createElement, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
4
+ import { View } from "react-native-unistyles/components/native/View";
5
+ import { Text } from "react-native-unistyles/components/native/Text";
6
+ import { ScrollView } from "react-native-unistyles/components/native/ScrollView";
7
+ import { StyleSheet } from "react-native-unistyles";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ //#region src/extensions/workspaces/(frontend)/fill/Workflows.home.native.ts
10
+ var Workflows_home_native_default = defineFill({ data: {
11
+ version: 1,
12
+ label: "Workflows",
13
+ source: "workflow_runs",
14
+ destination: "workflows"
15
+ } });
16
+ //#endregion
17
+ //#region src/types/webWorkflows.ts
18
+ const WORKFLOW_RUNS_TYPE = "workflow_runs";
19
+ const WORKFLOW_CATALOG_TYPE = "workflow_catalog";
20
+ //#endregion
21
+ //#region src/extensions/workspaces/sessions/(frontend)/_lib/runDuration.ts
22
+ /**
23
+ * Local copy of the host's formatRunDuration (src/web/lib/sessionSummary.ts):
24
+ * this plugin keeps zero host-lib imports so its later move into the owning
25
+ * package is a file relocation.
26
+ */
27
+ const MINUTE_MS = 6e4;
28
+ const HOUR_MS = 60 * MINUTE_MS;
29
+ function formatRunDuration(elapsedMs) {
30
+ if (elapsedMs < MINUTE_MS) return "<1m";
31
+ if (elapsedMs < HOUR_MS) return `${Math.floor(elapsedMs / MINUTE_MS)}m`;
32
+ const hours = Math.floor(elapsedMs / HOUR_MS);
33
+ const minutes = Math.floor(elapsedMs % HOUR_MS / MINUTE_MS);
34
+ return `${hours}h ${String(minutes).padStart(2, "0")}m`;
35
+ }
36
+ //#endregion
37
+ //#region src/extensions/workspaces/sessions/(frontend)/_lib/workflowActivity.ts
38
+ const PAUSED_STATES = /* @__PURE__ */ new Set(["paused", "pause_requested"]);
39
+ function workflowRunIdentity(run) {
40
+ return `${run.workspace}/${run.runKey}`;
41
+ }
42
+ function toneOf(run) {
43
+ if (run.stage === "running") return run.executionState !== void 0 && PAUSED_STATES.has(run.executionState) ? "paused" : "running";
44
+ if (run.stage === "error") return "failed";
45
+ if (run.outcome !== void 0 && run.outcome !== "success") return run.outcome === "failed" ? "failed" : "skipped";
46
+ return "done";
47
+ }
48
+ function detailOf(run, tone) {
49
+ if (tone === "paused") return "paused; resume it from the owning session";
50
+ if (tone === "failed") return run.errorMessage ?? (run.failedJob === void 0 ? "failed" : `job '${run.failedJob}' failed`);
51
+ if (tone === "running") {
52
+ if (run.position === void 0) return "starting";
53
+ return run.position.step === void 0 ? run.position.job : `${run.position.job} · ${run.position.step}`;
54
+ }
55
+ return run.outcome ?? "done";
56
+ }
57
+ function elapsedOf(run, now) {
58
+ const start = Date.parse(run.startedAt);
59
+ if (!Number.isFinite(start)) return "";
60
+ const end = run.finishedAt === void 0 ? now : Date.parse(run.finishedAt);
61
+ return formatRunDuration(Math.max(0, (Number.isFinite(end) ? end : now) - start));
62
+ }
63
+ /** The hub's presented order is kept: it already puts live runs first. */
64
+ function workflowActivityRows(runs, now, sessionId = null) {
65
+ return runs.map((run) => {
66
+ const tone = toneOf(run);
67
+ return {
68
+ identity: workflowRunIdentity(run),
69
+ runKey: run.runKey,
70
+ name: run.displayName,
71
+ tone,
72
+ elapsed: elapsedOf(run, now),
73
+ detail: detailOf(run, tone),
74
+ ...run.ownerSessionId === void 0 || run.ownerSessionId === sessionId ? {} : { ownerSessionId: run.ownerSessionId }
75
+ };
76
+ });
77
+ }
78
+ const GROUP_OF = {
79
+ running: "running",
80
+ paused: "running",
81
+ failed: "failed",
82
+ done: "successful",
83
+ skipped: "successful"
84
+ };
85
+ const GROUP_ORDER = [
86
+ "running",
87
+ "failed",
88
+ "successful"
89
+ ];
90
+ /** Rows split by outcome, in the order the dock shows them; empty groups are dropped. */
91
+ function workflowActivityGroups(rows) {
92
+ return GROUP_ORDER.map((name) => ({
93
+ name,
94
+ rows: rows.filter((row) => GROUP_OF[row.tone] === name),
95
+ openByDefault: name !== "successful"
96
+ })).filter((group) => group.rows.length > 0);
97
+ }
98
+ //#endregion
99
+ //#region src/extensions/workspaces/sessions/(frontend)/_lib/workflowsStore.native.ts
100
+ const workflows = defineSessionStore({
101
+ runs: [],
102
+ focusedRun: void 0,
103
+ pendingLaunch: void 0
104
+ });
105
+ function isRecord$2(value) {
106
+ return typeof value === "object" && value !== null && !Array.isArray(value);
107
+ }
108
+ /** Points the workflows tab at one run; the activity dock uses this before opening the tab. */
109
+ function focusRun(sessionId, identity) {
110
+ workflows.update(sessionId, (current) => ({
111
+ ...current,
112
+ focusedRun: identity
113
+ }));
114
+ }
115
+ /** Removes a deleted run immediately while the registry channel catches up. */
116
+ function removeRun(sessionId, identity) {
117
+ workflows.update(sessionId, (current) => {
118
+ const runs = current.runs.filter((run) => workflowRunIdentity(run) !== identity);
119
+ return {
120
+ ...current,
121
+ runs,
122
+ focusedRun: current.focusedRun === identity ? runs[0] === void 0 ? void 0 : workflowRunIdentity(runs[0]) : current.focusedRun
123
+ };
124
+ });
125
+ }
126
+ /**
127
+ * Sends a launch line to the session and remembers what was already running.
128
+ *
129
+ * The cockpit's only channel to a session is a prompt frame, so a launch is
130
+ * the verb the extension registers for exactly this; see web/launchLine.ts.
131
+ */
132
+ function requestLaunch(send, sessionId, line, workflowPath) {
133
+ send(sessionId, {
134
+ type: "prompt",
135
+ message: line
136
+ });
137
+ workflows.update(sessionId, (current) => ({
138
+ ...current,
139
+ pendingLaunch: {
140
+ workflowPath,
141
+ knownRuns: current.runs.map(workflowRunIdentity)
142
+ }
143
+ }));
144
+ }
145
+ /** The plugin's session data channel: 'workflow_runs' payloads into the store. */
146
+ const workflowRunsChannel = workflows.channel({
147
+ channel: WORKFLOW_RUNS_TYPE,
148
+ parse(input) {
149
+ if (!isRecord$2(input) || !Array.isArray(input.runs)) return null;
150
+ return { runs: input.runs.filter(isRecord$2) };
151
+ },
152
+ reduce: (current, { runs }) => {
153
+ const pending = current.pendingLaunch;
154
+ if (pending === void 0) return {
155
+ ...current,
156
+ runs
157
+ };
158
+ const known = new Set(pending.knownRuns);
159
+ const arrived = runs.find((run) => !known.has(workflowRunIdentity(run)));
160
+ if (arrived === void 0) return {
161
+ ...current,
162
+ runs
163
+ };
164
+ return {
165
+ ...current,
166
+ runs,
167
+ focusedRun: workflowRunIdentity(arrived),
168
+ pendingLaunch: void 0
169
+ };
170
+ }
171
+ });
172
+ //#endregion
173
+ //#region src/extensions/workspaces/sessions/(frontend)/activity-group/workflows.native.ts
174
+ var workflows_native_default = defineActivityGroup({
175
+ keys: "w r",
176
+ icon: () => createElement(WorkflowIcon),
177
+ widgetKeys: ["workflow-mcp-progress", "workflow-mcp-follow"],
178
+ order: 30,
179
+ activeSource: {
180
+ subscribe(listener) {
181
+ const subscription = workflows.store.subscribe(listener);
182
+ return () => subscription.unsubscribe();
183
+ },
184
+ isActive(sessionId) {
185
+ return workflows.select(workflows.store.state, sessionId).runs.some((run) => run.stage === "running");
186
+ }
187
+ }
188
+ });
189
+ //#endregion
190
+ //#region src/extensions/workspaces/sessions/(frontend)/_lib/catalogStore.native.ts
191
+ const catalog = defineSessionStore({
192
+ cwd: "",
193
+ workflows: [],
194
+ warning: void 0,
195
+ open: false,
196
+ filter: "",
197
+ prompt: "",
198
+ selected: void 0,
199
+ inspected: void 0,
200
+ launch: void 0
201
+ });
202
+ function isRecord$1(value) {
203
+ return typeof value === "object" && value !== null && !Array.isArray(value);
204
+ }
205
+ function openCatalog(sessionId, prompt = "") {
206
+ catalog.update(sessionId, (current) => ({
207
+ ...current,
208
+ open: true,
209
+ prompt
210
+ }));
211
+ }
212
+ function closeCatalog(sessionId) {
213
+ catalog.update(sessionId, (current) => ({
214
+ ...current,
215
+ open: false,
216
+ prompt: "",
217
+ launch: void 0
218
+ }));
219
+ }
220
+ /** Rows whose name, path, tag or job matches the filter, case-insensitively. */
221
+ function filterCatalog(workflows, filter) {
222
+ const needle = filter.trim().toLowerCase();
223
+ if (needle === "") return [...workflows];
224
+ return workflows.filter((workflow) => [
225
+ workflow.name,
226
+ workflow.relativePath,
227
+ workflow.description,
228
+ ...workflow.tags,
229
+ ...workflow.jobs.map((job) => job.name)
230
+ ].join("\n").toLowerCase().includes(needle));
231
+ }
232
+ /** The plugin's catalog channel: 'workflow_catalog' payloads into the store. */
233
+ const workflowCatalogChannel = catalog.channel({
234
+ channel: WORKFLOW_CATALOG_TYPE,
235
+ parse(input) {
236
+ if (!isRecord$1(input) || typeof input.cwd !== "string" || !Array.isArray(input.workflows)) return null;
237
+ return {
238
+ cwd: input.cwd,
239
+ workflows: input.workflows.filter(isRecord$1),
240
+ ...typeof input.warning === "string" ? { warning: input.warning } : {}
241
+ };
242
+ },
243
+ reduce(current, payload) {
244
+ const paths = new Set(payload.workflows.map((workflow) => workflow.path));
245
+ return {
246
+ ...current,
247
+ cwd: payload.cwd,
248
+ workflows: payload.workflows,
249
+ warning: payload.warning,
250
+ selected: current.selected !== void 0 && paths.has(current.selected) ? current.selected : void 0,
251
+ inspected: current.inspected !== void 0 && paths.has(current.inspected) ? current.inspected : void 0,
252
+ launch: current.launch !== void 0 && paths.has(current.launch) ? current.launch : void 0
253
+ };
254
+ }
255
+ });
256
+ //#endregion
257
+ //#region src/extensions/workspaces/sessions/(frontend)/channel/workflow-catalog.native.ts
258
+ var workflow_catalog_native_default = defineChannelFile(workflowCatalogChannel);
259
+ //#endregion
260
+ //#region src/extensions/workspaces/sessions/(frontend)/channel/workflow-runs.native.ts
261
+ var workflow_runs_native_default = defineChannelFile(workflowRunsChannel);
262
+ //#endregion
263
+ //#region src/extensions/workspaces/sessions/(frontend)/_lib/launchLine.ts
264
+ /**
265
+ * The `/workflow-launch` line the dialog sends.
266
+ *
267
+ * WHY THE BUILDER LIVES HERE AND THE PARSER DOES NOT:
268
+ * Cockpit code is compiled into the host bundle and may import only this
269
+ * package's own web and type modules, so it cannot share the session's parser.
270
+ * The two are pinned together by a test that parses what this writes, which is
271
+ * the only guarantee that matters: the line has to survive the trip.
272
+ */
273
+ const WORKFLOW_LAUNCH_VERB = "/workflow-launch";
274
+ /** Reserved keys; every other pair is one of the workflow's own inputs. */
275
+ const RUNNER_KEY = "runner";
276
+ const COMMAND_KEY = "command";
277
+ const CHOICE_KEY = "choice";
278
+ /** Quotes a value that carries whitespace, which is how a value survives tokenizing. */
279
+ function quote(value) {
280
+ return /\s/.test(value) ? `"${value}"` : value;
281
+ }
282
+ function reservedPair(key, value) {
283
+ return value === void 0 || value === "" ? [] : [`${key}=${quote(value)}`];
284
+ }
285
+ function workflowLaunchLine(request) {
286
+ const pairs = [
287
+ ...reservedPair(RUNNER_KEY, request.runner),
288
+ ...reservedPair(COMMAND_KEY, request.command),
289
+ ...reservedPair(CHOICE_KEY, request.choice),
290
+ ...Object.entries(request.inputs).filter(([, value]) => value !== "").map(([key, value]) => `${key}=${quote(value)}`)
291
+ ];
292
+ const prompt = request.prompt?.trim();
293
+ return [
294
+ WORKFLOW_LAUNCH_VERB,
295
+ quote(request.workflow),
296
+ ...pairs,
297
+ ...prompt ? [prompt] : []
298
+ ].join(" ");
299
+ }
300
+ /** The trigger that makes a prompt mandatory. */
301
+ const USER_PROMPT_TRIGGER = "user_prompt";
302
+ /** What the dialog will not let a reader send, worded the way the session would answer. */
303
+ function launchProblems(workflow, request) {
304
+ const problems = [];
305
+ if (workflow.triggers.includes(USER_PROMPT_TRIGGER) && (request.prompt ?? "").trim() === "") problems.push("This workflow is triggered by a prompt, so it needs one.");
306
+ const missing = workflow.inputs.filter((input) => input.required === true && (request.inputs[input.name] ?? "") === "").map((input) => input.name);
307
+ if (missing.length > 0) problems.push(`Missing required input${missing.length > 1 ? "s" : ""}: ${missing.join(", ")}.`);
308
+ return problems;
309
+ }
310
+ /** The default a field starts with: what the workflow declared, or empty. */
311
+ function initialInputs(workflow) {
312
+ return Object.fromEntries(workflow.inputs.map((input) => [input.name, input.default ?? ""]));
313
+ }
314
+ /** The runner a launch starts on: the workflow's first declared one, when it declares any. */
315
+ function initialRunner(workflow) {
316
+ return workflow.runners?.[0];
317
+ }
318
+ /** The command templated steps start on: the one their steps list first. */
319
+ function initialCommand(workflow) {
320
+ return workflow.commands?.[0];
321
+ }
322
+ /** The choice a launch starts on: `default` when declared, else the first. */
323
+ function initialChoice(workflow) {
324
+ const choices = workflow.choices ?? [];
325
+ return choices.includes("default") ? "default" : choices[0];
326
+ }
327
+ //#endregion
328
+ //#region src/types/apiRoutes.ts
329
+ /**
330
+ * This package's routes, as data.
331
+ *
332
+ * No scope and no base path. The build reads both off
333
+ * `src/extensions/(backend)/api/workflow/`, so the mount is stated once, by the
334
+ * folder that creates it. The same API answers at all three scopes, because a
335
+ * global contribution cascades into workspace and session; the folder under
336
+ * `workspaces/sessions/` only re-mounts it for a session's own server.
337
+ *
338
+ * This is the one file the routes, the Hono app and the browser all read, so a
339
+ * path cannot move on one side alone. The page used to build the hub's own
340
+ * absolute URL and then rewrite its plugin prefix with String.replace to reach
341
+ * a session, which is exactly the kind of copy that can move by one character
342
+ * without anything noticing.
343
+ *
344
+ * `:workspace` and `:runKey` are Hono's own parameter syntax, because the app
345
+ * registers `path` verbatim.
346
+ */
347
+ /** One run, which every route below addresses. */
348
+ const RUN = "/runs/:workspace/:runKey";
349
+ /**
350
+ * The artifact route's parameter, as Hono spells a multi-segment match.
351
+ *
352
+ * An artifact is named by its path inside the run directory, so `reports/a.md`
353
+ * is one parameter across two segments. The client's `params` substitution
354
+ * fills a single segment and percent-encodes the slash with it, so the page
355
+ * substitutes this one itself; see the page's `_lib/terminalApi.ts`.
356
+ */
357
+ const ARTIFACT_NAME_PARAM = ":name{.+}";
358
+ /**
359
+ * The step whose pane a terminal route reads: a step ref's id. Absent, the
360
+ * route follows the run's current step, which is one of a parallel group's.
361
+ */
362
+ const STEP_TARGET_PARAM = "step";
363
+ const ARTIFACT_DOWNLOAD_PARAM = "download";
364
+ const api = createApiClient({
365
+ /**
366
+ * The terminal, as server-sent events.
367
+ *
368
+ * `stream: true` gets a URL and no call method: the consumer is the browser's
369
+ * own `EventSource`, and a relayed call would buffer a stream that never ends.
370
+ */
371
+ snapshot: {
372
+ method: "GET",
373
+ path: `${RUN}/screen`,
374
+ query: [STEP_TARGET_PARAM],
375
+ response: void 0
376
+ },
377
+ screen: {
378
+ method: "GET",
379
+ path: `${RUN}/screen/stream`,
380
+ query: [STEP_TARGET_PARAM],
381
+ stream: true
382
+ },
383
+ control: {
384
+ method: "POST",
385
+ path: `${RUN}/control`,
386
+ response: void 0
387
+ },
388
+ keys: {
389
+ method: "POST",
390
+ path: `${RUN}/keys`
391
+ },
392
+ resize: {
393
+ method: "POST",
394
+ path: `${RUN}/resize`,
395
+ response: void 0
396
+ },
397
+ remove: {
398
+ method: "DELETE",
399
+ path: RUN,
400
+ response: void 0
401
+ },
402
+ stop: {
403
+ method: "POST",
404
+ path: `${RUN}/stop`,
405
+ response: void 0
406
+ },
407
+ /** Guidance for the agent session the running step is in, like steering a Team sub-agent. */
408
+ steer: {
409
+ method: "POST",
410
+ path: `${RUN}/steer`,
411
+ response: void 0
412
+ },
413
+ /**
414
+ * Launch a workflow into the mounting session's own runtime, which then owns
415
+ * the run. A dispatcher session reaches its root's session mount through this.
416
+ */
417
+ launch: {
418
+ method: "POST",
419
+ path: "/launch",
420
+ response: void 0
421
+ },
422
+ openRunDirectory: {
423
+ method: "POST",
424
+ path: `${RUN}/open-directory`,
425
+ response: void 0
426
+ },
427
+ artifacts: {
428
+ method: "GET",
429
+ path: `${RUN}/artifacts`,
430
+ query: ["directory"],
431
+ response: void 0
432
+ },
433
+ /** One artifact: its metadata and text, or its raw bytes under `raw=1`. */
434
+ artifact: {
435
+ method: "GET",
436
+ path: `${RUN}/artifacts/${ARTIFACT_NAME_PARAM}`,
437
+ query: ["raw", ARTIFACT_DOWNLOAD_PARAM],
438
+ response: void 0
439
+ }
440
+ }, {
441
+ scopes: [
442
+ "global",
443
+ "workspace",
444
+ "session"
445
+ ],
446
+ basePath: "workflow",
447
+ transport: nativeApiTransport,
448
+ sessionAddress: sessionApiAddress
449
+ });
450
+ //#endregion
451
+ //#region src/extensions/workspaces/sessions/(frontend)/_lib/terminalApi.native.ts
452
+ /**
453
+ * The page's half of this package's hub API: one run's terminal and the files
454
+ * its run directory holds.
455
+ *
456
+ * These are adapters now, not a transport. The generated client owns the URL
457
+ * and the sealed transport with it, so nothing here spells a mount. What stays
458
+ * is this package's own vocabulary: which refusals the reader is shown, and the
459
+ * shapes the terminal expects back.
460
+ *
461
+ * A run belongs to its multiplexer rather than to a session, so the same API
462
+ * answers at the hub and inside a session's own server. Passing a session id
463
+ * addresses that session's copy and passing none addresses the hub. The deleted
464
+ * builder made that branch the other way round: it always built the hub's
465
+ * absolute URL, then rewrote the plugin prefix into the session's with
466
+ * String.replace, so a session's URL was a hub URL with its head swapped.
467
+ */
468
+ const UNREACHABLE = "The cockpit hub is unreachable.";
469
+ /** The hub, or one session's own copy of it; a null session id is the hub. */
470
+ function scoped(sessionId) {
471
+ return sessionId == null ? api.global : api.session(sessionId);
472
+ }
473
+ /** The run every route addresses, as the route table's two path parameters. */
474
+ function runParams(workspace, runKey) {
475
+ return {
476
+ workspace,
477
+ runKey
478
+ };
479
+ }
480
+ function isRecord(value) {
481
+ return typeof value === "object" && value !== null && !Array.isArray(value);
482
+ }
483
+ /**
484
+ * The message a reader is shown: the route's own words, or why there were none.
485
+ *
486
+ * `error` is optional because an answered call that simply carried the wrong
487
+ * shape reaches here too, and that result has no error field at all.
488
+ */
489
+ function messageOf(result, fallback) {
490
+ if (result.status === 0) return UNREACHABLE;
491
+ return result.error === void 0 || result.error === "" ? fallback : result.error;
492
+ }
493
+ /**
494
+ * One artifact's URL, with its path filled in.
495
+ *
496
+ * An artifact is named by its path inside the run directory, which Hono matches
497
+ * as the one multi-segment parameter `:name{.+}`. The client's own `params`
498
+ * substitution fills a single segment and percent-encodes the separating slash
499
+ * with it, which would move every nested artifact's URL, so that one segment is
500
+ * substituted here instead: each segment encoded, the slashes between them
501
+ * kept. Everything left of it still comes from the client.
502
+ */
503
+ function artifactUrl(scope, workspace, runKey, artifactPath, query) {
504
+ return scope.artifact.url({
505
+ params: runParams(workspace, runKey),
506
+ ...query === void 0 ? {} : { query }
507
+ }).replace(ARTIFACT_NAME_PARAM, artifactPath.split("/").map(encodeURIComponent).join("/"));
508
+ }
509
+ /** The pane a terminal call names, when it reads one step's rather than the run's current one. */
510
+ function stepBody(step) {
511
+ return step === void 0 ? {} : { step };
512
+ }
513
+ /** One finite screen read over the session-bound sealed transport. */
514
+ async function readScreen(workspace, runKey, sessionId, step, signal) {
515
+ const response = await nativeApiTransport(scoped(sessionId).snapshot.url({
516
+ params: runParams(workspace, runKey),
517
+ query: { [STEP_TARGET_PARAM]: step }
518
+ }), { signal });
519
+ const body = await response.json();
520
+ if (!response.ok) throw new Error(isRecord(body) && typeof body.error === "string" ? body.error : "The screen could not be read.");
521
+ if (!isRecord(body) || !Array.isArray(body.lines) || body.lines.length > 48 || !body.lines.every((line) => typeof line === "string" && line.length <= 4096) || !isRecord(body.capabilities) || typeof body.capabilities.readable !== "boolean" || typeof body.capabilities.writable !== "boolean" || typeof body.capabilities.resizable !== "boolean") throw new Error("The workflow hub returned an invalid screen.");
522
+ return body;
523
+ }
524
+ /** Takes the keyboard for one run, renewing when this page already holds it. */
525
+ async function takeControl(workspace, runKey, token, sessionId, step) {
526
+ const result = await scoped(sessionId).control({
527
+ params: runParams(workspace, runKey),
528
+ body: {
529
+ token,
530
+ ...stepBody(step)
531
+ }
532
+ });
533
+ if (result.status === 0) return {
534
+ held: false,
535
+ reason: UNREACHABLE
536
+ };
537
+ if (isRecord(result.data) && typeof result.data.held === "boolean") return result.data;
538
+ return {
539
+ held: false,
540
+ reason: messageOf(result, "The run refused the keyboard.")
541
+ };
542
+ }
543
+ async function releaseControl(workspace, runKey, token, sessionId, step) {
544
+ await scoped(sessionId).control({
545
+ params: runParams(workspace, runKey),
546
+ body: {
547
+ token,
548
+ release: true,
549
+ ...stepBody(step)
550
+ }
551
+ });
552
+ }
553
+ /** Sends literal keystrokes; the reason comes back when the lease has moved on. */
554
+ async function sendKeys(workspace, runKey, token, data, sessionId, step) {
555
+ const result = await scoped(sessionId).keys({
556
+ params: runParams(workspace, runKey),
557
+ body: {
558
+ token,
559
+ data,
560
+ ...stepBody(step)
561
+ }
562
+ });
563
+ if (result.ok) return {};
564
+ return { error: messageOf(result, "The run would not take those keys.") };
565
+ }
566
+ /** Matches the run's terminal to the viewport of whoever holds the keyboard. */
567
+ async function resizeRun(workspace, runKey, token, columns, rows, sessionId, step) {
568
+ await scoped(sessionId).resize({
569
+ params: runParams(workspace, runKey),
570
+ body: {
571
+ token,
572
+ columns,
573
+ rows,
574
+ ...stepBody(step)
575
+ }
576
+ });
577
+ }
578
+ /** Permanently removes one settled run and its run directory. */
579
+ async function deleteWorkflowRun(workspace, runKey, sessionId) {
580
+ const result = await scoped(sessionId).remove({ params: runParams(workspace, runKey) });
581
+ if (!result.ok) return { error: messageOf(result, "The workflow could not be deleted.") };
582
+ if (result.data.deleted === true) return { result: { deleted: true } };
583
+ return { error: "The workflow hub returned an invalid deletion response." };
584
+ }
585
+ /** Asks the engine running a workflow to stop it; the run settles on its own shortly after. */
586
+ async function stopWorkflowRun(workspace, runKey, sessionId) {
587
+ const result = await scoped(sessionId).stop({ params: runParams(workspace, runKey) });
588
+ if (!result.ok) return { error: messageOf(result, "The workflow could not be stopped.") };
589
+ if (result.data.requested === true) return { result: { requested: true } };
590
+ return { error: "The workflow hub returned an invalid stop response." };
591
+ }
592
+ /**
593
+ * Sends guidance to the agent session a running step is in: the run's current
594
+ * step, or `step`, the session of one step of a parallel group.
595
+ */
596
+ async function steerStep(workspace, runKey, message, sessionId, step) {
597
+ const result = await scoped(sessionId).steer({
598
+ params: runParams(workspace, runKey),
599
+ body: step === void 0 ? { message } : {
600
+ message,
601
+ step
602
+ }
603
+ });
604
+ if (!result.ok) return { error: messageOf(result, "The step would not take that guidance.") };
605
+ if (result.data.delivered === true) return { result: { delivered: true } };
606
+ return { error: "The workflow hub returned an invalid steer response." };
607
+ }
608
+ async function fetchArtifacts(workspace, runKey, sessionId, directory) {
609
+ const result = await scoped(sessionId).artifacts({
610
+ params: runParams(workspace, runKey),
611
+ query: { directory }
612
+ });
613
+ if (!result.ok) return { error: messageOf(result, "This run has no directory to read.") };
614
+ return { artifacts: result.data };
615
+ }
616
+ /** Trusted same-origin URL for browser-native media previews and downloads. */
617
+ function artifactContentUrl(workspace, runKey, path, download = false, sessionId) {
618
+ return artifactUrl(scoped(sessionId), workspace, runKey, path, {
619
+ ["raw"]: 1,
620
+ ...download ? { [ARTIFACT_DOWNLOAD_PARAM]: 1 } : {}
621
+ });
622
+ }
623
+ /**
624
+ * One artifact's metadata and text.
625
+ *
626
+ * The only route here that addresses itself rather than being called: its path
627
+ * parameter spans segments, so the URL comes from `artifactUrl` and the request
628
+ * goes over the same sealed transport the client is built on.
629
+ */
630
+ async function fetchArtifact(workspace, runKey, path, sessionId) {
631
+ try {
632
+ const response = await nativeApiTransport(artifactUrl(scoped(sessionId), workspace, runKey, path));
633
+ const body = await response.json();
634
+ if (!response.ok) {
635
+ const error = isRecord(body) && typeof body.error === "string" && body.error !== "" ? body.error : "";
636
+ return { error: error === "" ? "That file has not been written." : error };
637
+ }
638
+ return { artifact: body };
639
+ } catch {
640
+ return { error: UNREACHABLE };
641
+ }
642
+ }
643
+ const MAX_MEDIA_BYTES = 5242880;
644
+ const MAX_FRAME_BYTES = 65536;
645
+ /** Drain each UTF-8 snapshot before asking the server for another screen. */
646
+ function finiteScreenReader(load) {
647
+ let bytes = /* @__PURE__ */ new Uint8Array(0);
648
+ let cursor = 0;
649
+ let generation = 0;
650
+ let frame;
651
+ return async (from, previous, signal) => {
652
+ if (signal.aborted) throw new Error("Preview cancelled.");
653
+ let reset = previous !== String(generation) || from !== cursor;
654
+ if (!frame || cursor >= bytes.length || reset) {
655
+ const next = await load(signal);
656
+ if (signal.aborted) throw new Error("Preview cancelled.");
657
+ frame = next;
658
+ bytes = utf8(next.lines.join("\r\n"));
659
+ cursor = 0;
660
+ generation += 1;
661
+ reset = true;
662
+ }
663
+ const chunk = bytes.subarray(cursor, cursor + MAX_FRAME_BYTES);
664
+ cursor += chunk.length;
665
+ return {
666
+ chunk: base64(chunk),
667
+ offset: cursor,
668
+ reset,
669
+ generation: String(generation),
670
+ exists: frame.capabilities.readable,
671
+ hasMore: cursor < bytes.length,
672
+ ended: frame.ended === true
673
+ };
674
+ };
675
+ }
676
+ /** Raw media uses the same scoped sealed route as artifact metadata. */
677
+ async function fetchArtifactMedia(workspace, runKey, path, sessionId, signal) {
678
+ if (signal.aborted) throw new Error("Preview cancelled.");
679
+ const response = await nativeApiTransport(artifactContentUrl(workspace, runKey, path, false, sessionId), { signal });
680
+ if (signal.aborted) throw new Error("Preview cancelled.");
681
+ if (!response.ok) throw new Error("That artifact could not be read.");
682
+ const mimeType = (response.headers.get("content-type") ?? "").split(";")[0].trim().toLowerCase();
683
+ if (!/^(application\/pdf|image\/(png|jpeg|gif|webp|bmp)|audio\/(mpeg|mp4|wav|x-wav|ogg|webm|aac|flac)|video\/(mp4|webm|quicktime|ogg))$/.test(mimeType)) throw new Error("This artifact type cannot be previewed.");
684
+ if (Number(response.headers.get("content-length")) > MAX_MEDIA_BYTES) throw new Error("This artifact exceeds the 5 MiB preview limit.");
685
+ const bytes = await response.arrayBuffer();
686
+ if (signal.aborted) throw new Error("Preview cancelled.");
687
+ if (bytes.byteLength > MAX_MEDIA_BYTES) throw new Error("This artifact exceeds the 5 MiB preview limit.");
688
+ return {
689
+ data: base64(new Uint8Array(bytes)),
690
+ mimeType
691
+ };
692
+ }
693
+ function base64(bytes) {
694
+ const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
695
+ const parts = [];
696
+ let chunk = "";
697
+ for (let offset = 0; offset < bytes.length; offset += 3) {
698
+ const first = bytes[offset];
699
+ const second = bytes[offset + 1];
700
+ const third = bytes[offset + 2];
701
+ chunk += alphabet[first >> 2] + alphabet[(first & 3) << 4 | (second ?? 0) >> 4] + (second === void 0 ? "=" : alphabet[(second & 15) << 2 | (third ?? 0) >> 6]) + (third === void 0 ? "=" : alphabet[third & 63]);
702
+ if (chunk.length >= 8192) {
703
+ parts.push(chunk);
704
+ chunk = "";
705
+ }
706
+ }
707
+ parts.push(chunk);
708
+ return parts.join("");
709
+ }
710
+ function utf8(text) {
711
+ const bytes = [];
712
+ for (const character of text) {
713
+ let code = character.codePointAt(0);
714
+ if (code >= 55296 && code <= 57343) code = 65533;
715
+ if (code < 128) bytes.push(code);
716
+ else if (code < 2048) bytes.push(192 | code >> 6, 128 | code & 63);
717
+ else if (code < 65536) bytes.push(224 | code >> 12, 128 | code >> 6 & 63, 128 | code & 63);
718
+ else bytes.push(240 | code >> 18, 128 | code >> 12 & 63, 128 | code >> 6 & 63, 128 | code & 63);
719
+ }
720
+ return Uint8Array.from(bytes);
721
+ }
722
+ /** Binds a save to this package's guarded sealed route and one file version. */
723
+ async function prepareArtifactSave(workspace, runKey, path, sessionId, signal) {
724
+ const load = async (headers, signal) => {
725
+ if (signal.aborted) throw new Error("Download cancelled.");
726
+ return nativeApiTransport(artifactContentUrl(workspace, runKey, path, true, sessionId), {
727
+ headers,
728
+ signal
729
+ });
730
+ };
731
+ const probe = await load({ Range: "bytes=0-0" }, signal);
732
+ if (signal.aborted) throw new Error("Download cancelled.");
733
+ const range = /^bytes 0-0\/(\d+)$/u.exec(probe.headers.get("content-range") ?? "");
734
+ const empty = probe.status === 416 && probe.headers.get("content-range") === "bytes */0" || probe.status === 200 && probe.headers.get("content-length") === "0";
735
+ if (!empty && (probe.status !== 206 || !range)) throw new Error("The file does not support bounded downloads.");
736
+ const size = empty ? 0 : Number(range[1]);
737
+ if (!Number.isSafeInteger(size) || size < 0) throw new Error("Invalid file size.");
738
+ if ((await probe.arrayBuffer()).byteLength !== (empty ? 0 : 1)) throw new Error("Invalid file response.");
739
+ const version = probe.headers.get("etag");
740
+ if (!version) throw new Error("The file has no version validator.");
741
+ return {
742
+ name: path.split(/[\\/]/u).at(-1) ?? "",
743
+ mimeType: probe.headers.get("content-type")?.split(";")[0]?.trim() || "application/octet-stream",
744
+ size,
745
+ signal,
746
+ read: async (offset, count, signal) => {
747
+ if (!Number.isSafeInteger(offset) || !Number.isSafeInteger(count) || offset < 0 || count < 1 || count > 1048576 || offset + count > size) throw new Error("Invalid download range.");
748
+ const end = offset + count - 1;
749
+ const response = await load({
750
+ Range: `bytes=${offset}-${end}`,
751
+ "If-Match": version
752
+ }, signal);
753
+ if (signal.aborted) throw new Error("Download cancelled.");
754
+ if (response.status !== 206 || response.headers.get("etag") !== version || response.headers.get("content-range") !== `bytes ${offset}-${end}/${size}`) throw new Error("The file changed or its range response is invalid.");
755
+ const bytes = new Uint8Array(await response.arrayBuffer());
756
+ if (signal.aborted) throw new Error("Download cancelled.");
757
+ if (bytes.byteLength !== count) throw new Error("The file response is incomplete.");
758
+ return bytes;
759
+ }
760
+ };
761
+ }
762
+ //#endregion
763
+ //#region src/extensions/workspaces/sessions/(frontend)/_components/WorkflowPanel.native.tsx
764
+ function useWorkflows(sessionId) {
765
+ const subscribe = useCallback((listener) => {
766
+ const sub = workflows.store.subscribe(listener);
767
+ return () => sub.unsubscribe();
768
+ }, []);
769
+ return useSyncExternalStore(subscribe, () => workflows.select(workflows.store.state, sessionId));
770
+ }
771
+ function workflowTab(run) {
772
+ const identity = workflowRunIdentity(run);
773
+ return {
774
+ id: `workflows-run-${run.workspace}-${run.runKey}`.replace(/[^\w-]+/g, "-"),
775
+ label: run.displayName,
776
+ retainComposer: true,
777
+ panel: (props) => /* @__PURE__ */ jsx(WorkflowPanel, {
778
+ ...props,
779
+ identity
780
+ })
781
+ };
782
+ }
783
+ function WorkflowLauncher(props) {
784
+ const subscribe = useCallback((listener) => {
785
+ const sub = catalog.store.subscribe(listener);
786
+ return () => sub.unsubscribe();
787
+ }, []);
788
+ const state = useSyncExternalStore(subscribe, () => catalog.select(catalog.store.state, props.sessionId));
789
+ const [filter, setFilter] = useState("");
790
+ const [selected, setSelected] = useState();
791
+ if (props.sessionId === null || !state.open) return null;
792
+ const workflow = state.workflows.find((item) => item.path === selected);
793
+ return /* @__PURE__ */ jsx(Sheet, {
794
+ open: true,
795
+ onOpenChange: (open) => {
796
+ if (!open) {
797
+ closeCatalog(props.sessionId);
798
+ setSelected(void 0);
799
+ }
800
+ },
801
+ children: /* @__PURE__ */ jsxs(SheetContent, { children: [/* @__PURE__ */ jsx(SheetHeader, { children: /* @__PURE__ */ jsx(SheetTitle, { children: workflow ? `Launch ${workflow.name}` : "Launch a workflow" }) }), /* @__PURE__ */ jsx(SheetBody, { children: workflow ? /* @__PURE__ */ jsx(WorkflowLaunch, {
802
+ ...props,
803
+ sessionId: props.sessionId,
804
+ workflow,
805
+ initialPrompt: state.prompt,
806
+ onClose: () => {
807
+ closeCatalog(props.sessionId);
808
+ setSelected(void 0);
809
+ }
810
+ }, workflow.path) : /* @__PURE__ */ jsxs(View, {
811
+ style: styles.body,
812
+ children: [
813
+ /* @__PURE__ */ jsx(Input, {
814
+ accessibilityLabel: "Find a workflow",
815
+ value: filter,
816
+ onChangeText: setFilter,
817
+ placeholder: "Find a workflow"
818
+ }),
819
+ state.warning ? /* @__PURE__ */ jsx(Text, {
820
+ style: styles.error,
821
+ children: state.warning
822
+ }) : null,
823
+ filterCatalog(state.workflows, filter).map((item) => /* @__PURE__ */ jsx(ListRow, {
824
+ title: /* @__PURE__ */ jsx(Button, {
825
+ variant: "ghost",
826
+ onPress: () => setSelected(item.path),
827
+ children: item.name || item.relativePath
828
+ }),
829
+ description: `${item.description}\n${item.tags.join(", ")} · ${item.jobs.map((job) => job.name).join(", ")}`
830
+ }, item.path)),
831
+ state.workflows.length === 0 ? /* @__PURE__ */ jsx(Text, {
832
+ style: styles.meta,
833
+ children: "No workflows reported yet."
834
+ }) : null
835
+ ]
836
+ }) })] })
837
+ });
838
+ }
839
+ function Choice({ label, options, value, onChange }) {
840
+ return /* @__PURE__ */ jsxs(View, { children: [/* @__PURE__ */ jsx(Text, {
841
+ style: styles.meta,
842
+ children: label
843
+ }), options.map((option) => /* @__PURE__ */ jsx(Button, {
844
+ variant: "outline",
845
+ accessibilityState: { selected: value === option },
846
+ onPress: () => onChange(option),
847
+ children: option
848
+ }, option))] });
849
+ }
850
+ function WorkflowLaunch({ sessionId, workflow, initialPrompt, sendSessionFrame, onClose }) {
851
+ const [prompt, setPrompt] = useState(initialPrompt);
852
+ const [inputs, setInputs] = useState(() => initialInputs(workflow));
853
+ const [runner, setRunner] = useState(() => initialRunner(workflow));
854
+ const [command, setCommand] = useState(() => initialCommand(workflow));
855
+ const [choice, setChoice] = useState(() => initialChoice(workflow));
856
+ const [error, setError] = useState();
857
+ const request = {
858
+ workflow: workflow.name || workflow.relativePath,
859
+ inputs,
860
+ runner,
861
+ command,
862
+ choice,
863
+ ...prompt.trim() === "" ? {} : { prompt: prompt.trim() }
864
+ };
865
+ const problems = launchProblems(workflow, request);
866
+ const line = workflowLaunchLine(request);
867
+ return /* @__PURE__ */ jsxs(View, {
868
+ style: styles.body,
869
+ children: [
870
+ /* @__PURE__ */ jsx(Text, {
871
+ style: styles.meta,
872
+ children: workflow.description
873
+ }),
874
+ /* @__PURE__ */ jsx(Textarea, {
875
+ accessibilityLabel: "Workflow prompt",
876
+ placeholder: "What should this workflow do?",
877
+ value: prompt,
878
+ onChangeText: setPrompt
879
+ }),
880
+ workflow.inputs.map((input) => {
881
+ const options = input.options ?? (input.type === "boolean" ? ["true", "false"] : void 0);
882
+ return /* @__PURE__ */ jsxs(View, { children: [/* @__PURE__ */ jsxs(Text, {
883
+ style: styles.meta,
884
+ children: [
885
+ input.name,
886
+ input.required ? " (required)" : "",
887
+ " · ",
888
+ input.description
889
+ ]
890
+ }), options ? /* @__PURE__ */ jsx(Choice, {
891
+ label: input.name,
892
+ options,
893
+ value: inputs[input.name],
894
+ onChange: (value) => setInputs((current) => ({
895
+ ...current,
896
+ [input.name]: value
897
+ }))
898
+ }) : /* @__PURE__ */ jsx(Input, {
899
+ accessibilityLabel: input.name,
900
+ value: inputs[input.name] ?? "",
901
+ onChangeText: (value) => setInputs((current) => ({
902
+ ...current,
903
+ [input.name]: value
904
+ }))
905
+ })] }, input.name);
906
+ }),
907
+ workflow.runners?.length ? /* @__PURE__ */ jsx(Choice, {
908
+ label: "Runner",
909
+ options: workflow.runners,
910
+ value: runner,
911
+ onChange: setRunner
912
+ }) : null,
913
+ workflow.commands?.length ? /* @__PURE__ */ jsx(Choice, {
914
+ label: "Command",
915
+ options: workflow.commands,
916
+ value: command,
917
+ onChange: setCommand
918
+ }) : null,
919
+ workflow.choices?.length ? /* @__PURE__ */ jsx(Choice, {
920
+ label: "Choice",
921
+ options: workflow.choices,
922
+ value: choice,
923
+ onChange: setChoice
924
+ }) : null,
925
+ /* @__PURE__ */ jsx(CodeBlock, { text: line }),
926
+ problems.map((problem) => /* @__PURE__ */ jsx(Text, {
927
+ style: styles.meta,
928
+ children: problem
929
+ }, problem)),
930
+ error ? /* @__PURE__ */ jsx(Text, {
931
+ style: styles.error,
932
+ children: error
933
+ }) : null,
934
+ /* @__PURE__ */ jsx(Button, {
935
+ testID: "launch-workflow-submit",
936
+ disabled: problems.length > 0,
937
+ onPress: () => {
938
+ try {
939
+ requestLaunch(sendSessionFrame, sessionId, line, workflow.path);
940
+ onClose();
941
+ } catch (cause) {
942
+ setError(cause instanceof Error ? cause.message : String(cause));
943
+ }
944
+ },
945
+ children: "Launch"
946
+ })
947
+ ]
948
+ });
949
+ }
950
+ function WorkflowPanel(props) {
951
+ const state = useWorkflows(props.sessionId);
952
+ const run = state.runs.find((item) => workflowRunIdentity(item) === props.identity);
953
+ const [confirmDelete, setConfirmDelete] = useState(false);
954
+ const [busy, setBusy] = useState(false);
955
+ const [error, setError] = useState();
956
+ const act = async (action) => {
957
+ if (busy) return;
958
+ setBusy(true);
959
+ setError(void 0);
960
+ try {
961
+ await action();
962
+ } catch (cause) {
963
+ setError(cause instanceof Error ? cause.message : String(cause));
964
+ } finally {
965
+ setBusy(false);
966
+ }
967
+ };
968
+ if (!run) return /* @__PURE__ */ jsx(Text, {
969
+ style: styles.meta,
970
+ children: "This run is no longer listed."
971
+ });
972
+ return /* @__PURE__ */ jsxs(ScrollView, {
973
+ contentContainerStyle: styles.body,
974
+ children: [
975
+ /* @__PURE__ */ jsx(Text, {
976
+ style: styles.title,
977
+ children: run.displayName
978
+ }),
979
+ /* @__PURE__ */ jsx(Badge, { children: run.executionState ?? run.outcome ?? run.stage }),
980
+ /* @__PURE__ */ jsx(Text, {
981
+ style: styles.meta,
982
+ children: run.errorMessage ?? `${run.position?.job ?? ""} ${run.position?.step ?? ""}`
983
+ }),
984
+ state.runs.length > 1 ? state.runs.map((item) => /* @__PURE__ */ jsx(Button, {
985
+ variant: "ghost",
986
+ onPress: () => {
987
+ if (props.sessionId !== null) focusRun(props.sessionId, workflowRunIdentity(item));
988
+ props.openTransientTab(workflowTab(item));
989
+ },
990
+ children: item.displayName
991
+ }, workflowRunIdentity(item))) : null,
992
+ run.executionState === "paused" || run.executionState === "pause_requested" ? /* @__PURE__ */ jsx(Text, {
993
+ style: styles.meta,
994
+ children: "Waiting to be resumed. Ask the agent in this conversation to resume it."
995
+ }) : null,
996
+ run.jobs.map((job) => /* @__PURE__ */ jsxs(View, { children: [/* @__PURE__ */ jsxs(Button, {
997
+ variant: "ghost",
998
+ onPress: () => props.openTransientTab(stepTab(run, job.name)),
999
+ children: [
1000
+ job.name,
1001
+ " · ",
1002
+ job.status
1003
+ ]
1004
+ }), job.steps.map((step) => /* @__PURE__ */ jsx(ListRow, {
1005
+ title: /* @__PURE__ */ jsx(Button, {
1006
+ variant: "ghost",
1007
+ onPress: () => props.openTransientTab(stepTab(run, job.name, step.name)),
1008
+ children: step.name
1009
+ }),
1010
+ description: step.status
1011
+ }, step.name))] }, job.name)),
1012
+ /* @__PURE__ */ jsx(Text, {
1013
+ style: styles.title,
1014
+ children: "Artifacts"
1015
+ }),
1016
+ /* @__PURE__ */ jsx(WorkflowArtifacts, {
1017
+ ...props,
1018
+ run
1019
+ }),
1020
+ error ? /* @__PURE__ */ jsx(Text, {
1021
+ style: styles.error,
1022
+ children: error
1023
+ }) : null,
1024
+ run.stage === "running" ? /* @__PURE__ */ jsx(Button, {
1025
+ variant: "danger-outline",
1026
+ disabled: busy || props.sessionId === null,
1027
+ onPress: () => void act(async () => {
1028
+ const result = await stopWorkflowRun(run.workspace, run.runKey, props.sessionId);
1029
+ if ("error" in result) throw new Error(result.error);
1030
+ }),
1031
+ children: "Stop workflow"
1032
+ }) : /* @__PURE__ */ jsx(Button, {
1033
+ variant: "danger-outline",
1034
+ disabled: props.sessionId === null,
1035
+ onPress: () => setConfirmDelete(true),
1036
+ children: "Delete run…"
1037
+ }),
1038
+ /* @__PURE__ */ jsx(Sheet, {
1039
+ open: confirmDelete,
1040
+ onOpenChange: setConfirmDelete,
1041
+ children: /* @__PURE__ */ jsxs(SheetContent, { children: [/* @__PURE__ */ jsx(SheetHeader, { children: /* @__PURE__ */ jsx(SheetTitle, { children: "Delete this run?" }) }), /* @__PURE__ */ jsxs(SheetBody, { children: [/* @__PURE__ */ jsx(Text, {
1042
+ style: styles.meta,
1043
+ children: "This permanently removes the settled run and its directory."
1044
+ }), /* @__PURE__ */ jsx(Button, {
1045
+ variant: "danger-outline",
1046
+ disabled: busy,
1047
+ onPress: () => void act(async () => {
1048
+ const result = await deleteWorkflowRun(run.workspace, run.runKey, props.sessionId);
1049
+ if ("error" in result) throw new Error(result.error);
1050
+ if (props.sessionId !== null) removeRun(props.sessionId, props.identity);
1051
+ setConfirmDelete(false);
1052
+ props.closeTransientTab(`workflows-run-${run.workspace}-${run.runKey}`.replace(/[^\w-]+/g, "-"));
1053
+ }),
1054
+ children: "Delete"
1055
+ })] })] })
1056
+ })
1057
+ ]
1058
+ });
1059
+ }
1060
+ function stepTab(run, job, step) {
1061
+ const workspace = run.workspace;
1062
+ const runKey = run.runKey;
1063
+ return {
1064
+ id: `workflows-step-${workspace}-${runKey}-${job}${step === void 0 ? "" : `-${step}`}`.replace(/[^\w-]+/g, "-"),
1065
+ label: `${run.displayName} › ${step ?? job}`,
1066
+ panel: (props) => /* @__PURE__ */ jsx(WorkflowStep, {
1067
+ ...props,
1068
+ workspace,
1069
+ runKey,
1070
+ job,
1071
+ step
1072
+ })
1073
+ };
1074
+ }
1075
+ function WorkflowStep({ sessionId, workspace, runKey, job, step, renderSessionTranscript, renderRunnerTerminal }) {
1076
+ const run = useWorkflows(sessionId).runs.find((item) => item.workspace === workspace && item.runKey === runKey);
1077
+ const steps = run?.jobs.find((item) => item.name === job)?.steps;
1078
+ const target = step === void 0 ? steps?.at(-1) : steps?.find((item) => item.name === step);
1079
+ const [message, setMessage] = useState("");
1080
+ const [error, setError] = useState();
1081
+ const [busy, setBusy] = useState(false);
1082
+ const ref = target?.ref;
1083
+ const session = ref?.kind === "session" ? ref.id : void 0;
1084
+ return /* @__PURE__ */ jsxs(View, {
1085
+ style: styles.screen,
1086
+ children: [
1087
+ /* @__PURE__ */ jsxs(Text, {
1088
+ style: styles.title,
1089
+ children: [
1090
+ job,
1091
+ step === void 0 ? "" : ` › ${step}`,
1092
+ " · ",
1093
+ target?.status
1094
+ ]
1095
+ }),
1096
+ session ? renderSessionTranscript?.(session) : /* @__PURE__ */ jsx(WorkflowTerminal, {
1097
+ sessionId,
1098
+ workspace,
1099
+ runKey,
1100
+ pane: ref?.kind === "pane" ? ref.id : void 0,
1101
+ renderRunnerTerminal
1102
+ }, `${sessionId}:${workspace}:${runKey}:${ref?.id ?? ""}`),
1103
+ session && run?.stage === "running" && target?.status === "running" ? /* @__PURE__ */ jsxs(View, {
1104
+ style: styles.body,
1105
+ children: [/* @__PURE__ */ jsx(Textarea, {
1106
+ accessibilityLabel: "Step guidance",
1107
+ value: message,
1108
+ onChangeText: setMessage
1109
+ }), /* @__PURE__ */ jsx(Button, {
1110
+ disabled: busy || message.trim() === "",
1111
+ onPress: () => {
1112
+ setBusy(true);
1113
+ steerStep(workspace, runKey, message.trim(), sessionId, session).then((result) => {
1114
+ if ("error" in result) setError(result.error);
1115
+ else {
1116
+ setMessage("");
1117
+ setError(void 0);
1118
+ }
1119
+ }).catch((cause) => setError(cause instanceof Error ? cause.message : String(cause))).finally(() => setBusy(false));
1120
+ },
1121
+ children: "Send guidance"
1122
+ })]
1123
+ }) : null,
1124
+ error ? /* @__PURE__ */ jsx(Text, {
1125
+ style: styles.error,
1126
+ children: error
1127
+ }) : null
1128
+ ]
1129
+ });
1130
+ }
1131
+ function WorkflowTerminal({ sessionId, workspace, runKey, pane, renderRunnerTerminal }) {
1132
+ const [capabilities, setCapabilities] = useState();
1133
+ const [token, setToken] = useState();
1134
+ const [notice, setNotice] = useState();
1135
+ const [columns, setColumns] = useState("80");
1136
+ const [rows, setRows] = useState("24");
1137
+ const [busy, setBusy] = useState(false);
1138
+ const [lifetime] = useState(() => new AbortController());
1139
+ useEffect(() => () => lifetime.abort(), [lifetime]);
1140
+ useEffect(() => {
1141
+ if (token === void 0) return;
1142
+ return () => {
1143
+ releaseControl(workspace, runKey, token, sessionId, pane).catch(() => {});
1144
+ };
1145
+ }, [
1146
+ workspace,
1147
+ runKey,
1148
+ token,
1149
+ sessionId,
1150
+ pane
1151
+ ]);
1152
+ const request = useMemo(() => ({
1153
+ key: `${sessionId}:${workspace}:${runKey}:${pane ?? ""}`,
1154
+ read: finiteScreenReader(async (signal) => {
1155
+ const frame = await readScreen(workspace, runKey, sessionId, pane, signal);
1156
+ if (!signal.aborted && !lifetime.signal.aborted) setCapabilities(frame.capabilities);
1157
+ return frame;
1158
+ }),
1159
+ write: async (text) => {
1160
+ if (token === void 0) throw new Error("Take control before typing into this run.");
1161
+ const result = await sendKeys(workspace, runKey, token, text, sessionId, pane);
1162
+ if (result.error) {
1163
+ if (!lifetime.signal.aborted) {
1164
+ setNotice(result.error);
1165
+ setToken(void 0);
1166
+ }
1167
+ throw new Error(result.error);
1168
+ }
1169
+ }
1170
+ }), [
1171
+ sessionId,
1172
+ workspace,
1173
+ runKey,
1174
+ pane,
1175
+ token,
1176
+ lifetime
1177
+ ]);
1178
+ const arm = async () => {
1179
+ setBusy(true);
1180
+ try {
1181
+ const grant = await takeControl(workspace, runKey, void 0, sessionId, pane);
1182
+ if (lifetime.signal.aborted) {
1183
+ if (grant.held && grant.token) await releaseControl(workspace, runKey, grant.token, sessionId, pane);
1184
+ return;
1185
+ }
1186
+ if (grant.held && grant.token) {
1187
+ setToken(grant.token);
1188
+ setNotice(void 0);
1189
+ } else setNotice(grant.reason ?? "The keyboard is not available for this run.");
1190
+ } catch (cause) {
1191
+ if (!lifetime.signal.aborted) setNotice(cause instanceof Error ? cause.message : String(cause));
1192
+ } finally {
1193
+ if (!lifetime.signal.aborted) setBusy(false);
1194
+ }
1195
+ };
1196
+ return /* @__PURE__ */ jsxs(View, {
1197
+ style: styles.transcript,
1198
+ children: [
1199
+ /* @__PURE__ */ jsx(Badge, { children: token ? "keyboard yours" : "watching" }),
1200
+ capabilities?.writable ? /* @__PURE__ */ jsx(Button, {
1201
+ variant: "outline",
1202
+ disabled: busy,
1203
+ onPress: () => {
1204
+ if (token) setToken(void 0);
1205
+ else arm();
1206
+ },
1207
+ children: token ? "Release keyboard" : "Take control"
1208
+ }) : null,
1209
+ /* @__PURE__ */ jsx(View, {
1210
+ style: styles.transcript,
1211
+ children: renderRunnerTerminal?.(request)
1212
+ }),
1213
+ capabilities?.reason ? /* @__PURE__ */ jsx(Text, {
1214
+ style: styles.meta,
1215
+ children: capabilities.reason
1216
+ }) : null,
1217
+ token && capabilities?.resizable ? /* @__PURE__ */ jsxs(View, { children: [
1218
+ /* @__PURE__ */ jsx(Input, {
1219
+ accessibilityLabel: "Terminal columns",
1220
+ keyboardType: "number-pad",
1221
+ value: columns,
1222
+ onChangeText: setColumns
1223
+ }),
1224
+ /* @__PURE__ */ jsx(Input, {
1225
+ accessibilityLabel: "Terminal rows",
1226
+ keyboardType: "number-pad",
1227
+ value: rows,
1228
+ onChangeText: setRows
1229
+ }),
1230
+ /* @__PURE__ */ jsx(Button, {
1231
+ variant: "outline",
1232
+ disabled: !Number.isInteger(Number(columns)) || !Number.isInteger(Number(rows)) || Number(columns) < 1 || Number(rows) < 1,
1233
+ onPress: () => {
1234
+ resizeRun(workspace, runKey, token, Number(columns), Number(rows), sessionId, pane).catch((cause) => {
1235
+ if (!lifetime.signal.aborted) setNotice(cause instanceof Error ? cause.message : String(cause));
1236
+ });
1237
+ },
1238
+ children: "Resize terminal"
1239
+ })
1240
+ ] }) : null,
1241
+ notice ? /* @__PURE__ */ jsx(Text, {
1242
+ style: styles.meta,
1243
+ children: notice
1244
+ }) : null
1245
+ ]
1246
+ });
1247
+ }
1248
+ function WorkflowArtifacts(props) {
1249
+ const { run, sessionId, openTransientTab } = props;
1250
+ const [directory, setDirectory] = useState();
1251
+ const [listing, setListing] = useState();
1252
+ const [error, setError] = useState();
1253
+ useEffect(() => {
1254
+ let active = true;
1255
+ fetchArtifacts(run.workspace, run.runKey, sessionId, directory).then((result) => {
1256
+ if (active) {
1257
+ if ("error" in result) setError(result.error);
1258
+ else {
1259
+ setListing(result.artifacts);
1260
+ setError(void 0);
1261
+ }
1262
+ }
1263
+ }).catch((cause) => {
1264
+ if (active) setError(cause instanceof Error ? cause.message : String(cause));
1265
+ });
1266
+ return () => {
1267
+ active = false;
1268
+ };
1269
+ }, [
1270
+ run.workspace,
1271
+ run.runKey,
1272
+ sessionId,
1273
+ directory,
1274
+ run.stage
1275
+ ]);
1276
+ return /* @__PURE__ */ jsxs(View, { children: [
1277
+ error ? /* @__PURE__ */ jsx(Text, {
1278
+ style: styles.error,
1279
+ children: error
1280
+ }) : null,
1281
+ directory ? /* @__PURE__ */ jsx(Button, {
1282
+ variant: "ghost",
1283
+ onPress: () => setDirectory(directory.includes("/") ? directory.slice(0, directory.lastIndexOf("/")) : void 0),
1284
+ children: "Parent directory"
1285
+ }) : null,
1286
+ listing?.artifacts.map((item) => /* @__PURE__ */ jsx(ListRow, {
1287
+ title: /* @__PURE__ */ jsx(Button, {
1288
+ variant: "ghost",
1289
+ disabled: item.kind !== "directory" && item.state !== "written" && item.state !== "empty",
1290
+ onPress: () => {
1291
+ if (item.kind === "directory") setDirectory(item.path);
1292
+ else {
1293
+ const workspace = run.workspace;
1294
+ const runKey = run.runKey;
1295
+ const path = item.path;
1296
+ openTransientTab({
1297
+ id: `workflows-artifact-${workspace}-${runKey}-${path}`.replace(/[^\w-]+/g, "-"),
1298
+ label: path,
1299
+ panel: (panelProps) => /* @__PURE__ */ jsx(ArtifactPreview, {
1300
+ ...panelProps,
1301
+ workspace,
1302
+ runKey,
1303
+ path
1304
+ })
1305
+ });
1306
+ }
1307
+ },
1308
+ children: item.path
1309
+ }),
1310
+ description: `${item.state} · ${item.description}`
1311
+ }, item.path))
1312
+ ] });
1313
+ }
1314
+ function ArtifactPreview({ sessionId, workspace, runKey, path, renderFilePreview, renderMediaPreview, nativeSaveFile }) {
1315
+ const [content, setContent] = useState();
1316
+ const [error, setError] = useState();
1317
+ const [raw, setRaw] = useState(false);
1318
+ useEffect(() => {
1319
+ let active = true;
1320
+ fetchArtifact(workspace, runKey, path, sessionId).then((result) => {
1321
+ if (active) {
1322
+ if ("error" in result) setError(result.error);
1323
+ else setContent(result.artifact);
1324
+ }
1325
+ }).catch((cause) => {
1326
+ if (active) setError(cause instanceof Error ? cause.message : String(cause));
1327
+ });
1328
+ return () => {
1329
+ active = false;
1330
+ };
1331
+ }, [
1332
+ workspace,
1333
+ runKey,
1334
+ path,
1335
+ sessionId
1336
+ ]);
1337
+ const downloadController = useRef(void 0);
1338
+ const [saving, setSaving] = useState(false);
1339
+ const [saveNote, setSaveNote] = useState();
1340
+ useEffect(() => () => downloadController.current?.abort(), [
1341
+ workspace,
1342
+ runKey,
1343
+ path,
1344
+ sessionId
1345
+ ]);
1346
+ const download = async () => {
1347
+ if (!nativeSaveFile || saving) return;
1348
+ const controller = new AbortController();
1349
+ downloadController.current = controller;
1350
+ setSaving(true);
1351
+ try {
1352
+ await nativeSaveFile(await prepareArtifactSave(workspace, runKey, path, sessionId, controller.signal));
1353
+ if (!controller.signal.aborted) setSaveNote("Saved.");
1354
+ } catch (error) {
1355
+ if (!controller.signal.aborted) setSaveNote(error instanceof Error ? error.message : String(error));
1356
+ } finally {
1357
+ setSaving(false);
1358
+ }
1359
+ };
1360
+ return /* @__PURE__ */ jsxs(ScrollView, {
1361
+ contentContainerStyle: styles.body,
1362
+ children: [
1363
+ /* @__PURE__ */ jsx(Text, {
1364
+ style: styles.title,
1365
+ children: path
1366
+ }),
1367
+ /* @__PURE__ */ jsx(Button, {
1368
+ variant: "outline",
1369
+ disabled: !nativeSaveFile || saving,
1370
+ onPress: () => void download(),
1371
+ children: "Download"
1372
+ }),
1373
+ saving ? /* @__PURE__ */ jsx(Button, {
1374
+ variant: "ghost",
1375
+ onPress: () => downloadController.current?.abort(),
1376
+ children: "Cancel download"
1377
+ }) : null,
1378
+ saveNote ? /* @__PURE__ */ jsx(Text, {
1379
+ style: styles.meta,
1380
+ children: saveNote
1381
+ }) : null,
1382
+ error ? /* @__PURE__ */ jsx(Text, {
1383
+ style: styles.error,
1384
+ children: error
1385
+ }) : null,
1386
+ content?.text !== void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
1387
+ /* @__PURE__ */ jsx(Button, {
1388
+ variant: "outline",
1389
+ onPress: () => setRaw((value) => !value),
1390
+ children: raw ? "Preview" : "Raw source"
1391
+ }),
1392
+ !raw && /\.(md|markdown)$/i.test(path) ? /* @__PURE__ */ jsx(Markdown, { text: content.text }) : !raw && /\.(html|htm)$/i.test(path) ? renderFilePreview?.({
1393
+ key: `${sessionId}:${workspace}:${runKey}:${path}`,
1394
+ html: content.text,
1395
+ title: path
1396
+ }) : !raw && /\.(csv|tsv)$/i.test(path) ? /* @__PURE__ */ jsx(DelimitedArtifact, {
1397
+ text: content.text,
1398
+ delimiter: /\.csv$/i.test(path) ? "," : " "
1399
+ }) : /* @__PURE__ */ jsx(CodeBlock, { text: !raw && /\.json$/i.test(path) ? prettyJson(content.text) : content.text }),
1400
+ content.truncated ? /* @__PURE__ */ jsx(Text, {
1401
+ style: styles.meta,
1402
+ children: "This preview was truncated."
1403
+ }) : null
1404
+ ] }) : content ? /* @__PURE__ */ jsx(BinaryArtifactPreview, {
1405
+ sessionId,
1406
+ workspace,
1407
+ runKey,
1408
+ path,
1409
+ renderMediaPreview
1410
+ }) : /* @__PURE__ */ jsx(Text, {
1411
+ style: styles.meta,
1412
+ children: "Loading preview…"
1413
+ })
1414
+ ]
1415
+ });
1416
+ }
1417
+ function BinaryArtifactPreview({ sessionId, workspace, runKey, path, renderMediaPreview }) {
1418
+ const requestKey = JSON.stringify([
1419
+ sessionId,
1420
+ workspace,
1421
+ runKey,
1422
+ path
1423
+ ]);
1424
+ const [loaded, setLoaded] = useState();
1425
+ const media = loaded?.key === requestKey ? loaded.media : void 0;
1426
+ const error = loaded?.key === requestKey ? loaded.error : void 0;
1427
+ useEffect(() => {
1428
+ const controller = new AbortController();
1429
+ fetchArtifactMedia(workspace, runKey, path, sessionId, controller.signal).then((value) => {
1430
+ if (!controller.signal.aborted) setLoaded({
1431
+ key: requestKey,
1432
+ media: value
1433
+ });
1434
+ }).catch((cause) => {
1435
+ if (!controller.signal.aborted) setLoaded({
1436
+ key: requestKey,
1437
+ error: cause instanceof Error ? cause.message : String(cause)
1438
+ });
1439
+ });
1440
+ return () => controller.abort();
1441
+ }, [
1442
+ workspace,
1443
+ runKey,
1444
+ path,
1445
+ sessionId,
1446
+ requestKey
1447
+ ]);
1448
+ return media ? renderMediaPreview?.({
1449
+ key: `${sessionId}:${workspace}:${runKey}:${path}`,
1450
+ ...media,
1451
+ title: path,
1452
+ path
1453
+ }) : /* @__PURE__ */ jsx(Text, {
1454
+ style: styles.meta,
1455
+ children: error ?? "Loading preview…"
1456
+ });
1457
+ }
1458
+ function prettyJson(text) {
1459
+ try {
1460
+ return JSON.stringify(JSON.parse(text), null, 2);
1461
+ } catch {
1462
+ return text;
1463
+ }
1464
+ }
1465
+ function DelimitedArtifact({ text, delimiter }) {
1466
+ const rows = [];
1467
+ let row = [];
1468
+ let cell = "";
1469
+ let quoted = false;
1470
+ for (let index = 0; index <= text.length && rows.length < 500; index += 1) {
1471
+ const character = text[index] ?? "\n";
1472
+ if (quoted) {
1473
+ if (character === "\"" && text[index + 1] === "\"") {
1474
+ cell += "\"";
1475
+ index += 1;
1476
+ } else if (character === "\"") quoted = false;
1477
+ else cell += character;
1478
+ } else if (character === "\"" && cell === "") quoted = true;
1479
+ else if (character === delimiter) {
1480
+ row.push(cell);
1481
+ cell = "";
1482
+ } else if (character === "\n") {
1483
+ row.push(cell.replace(/\r$/, ""));
1484
+ rows.push(row);
1485
+ row = [];
1486
+ cell = "";
1487
+ } else cell += character;
1488
+ }
1489
+ return /* @__PURE__ */ jsx(ScrollView, {
1490
+ horizontal: true,
1491
+ children: /* @__PURE__ */ jsx(View, { children: rows.map((cells, index) => /* @__PURE__ */ jsx(View, {
1492
+ style: styles.tableRow,
1493
+ children: cells.map((value, column) => /* @__PURE__ */ jsx(Text, {
1494
+ style: styles.tableCell,
1495
+ children: value
1496
+ }, column))
1497
+ }, index)) })
1498
+ });
1499
+ }
1500
+ const styles = StyleSheet.create((theme) => ({
1501
+ screen: {
1502
+ flex: 1,
1503
+ backgroundColor: theme.colors.bg,
1504
+ padding: theme.spacing(3),
1505
+ uni__dependencies: [0]
1506
+ },
1507
+ transcript: { flex: 1 },
1508
+ tableRow: { flexDirection: "row" },
1509
+ tableCell: {
1510
+ color: theme.colors.text,
1511
+ fontSize: theme.fontSize.sm,
1512
+ padding: theme.spacing(2),
1513
+ width: theme.spacing(30),
1514
+ borderWidth: 1,
1515
+ borderColor: theme.colors.border,
1516
+ uni__dependencies: [0]
1517
+ },
1518
+ body: {
1519
+ padding: theme.spacing(3),
1520
+ gap: theme.spacing(2),
1521
+ uni__dependencies: [0]
1522
+ },
1523
+ title: {
1524
+ color: theme.colors.hi,
1525
+ fontSize: theme.fontSize.base,
1526
+ fontWeight: "600",
1527
+ uni__dependencies: [0]
1528
+ },
1529
+ meta: {
1530
+ color: theme.colors.dim,
1531
+ fontSize: theme.fontSize.sm,
1532
+ uni__dependencies: [0]
1533
+ },
1534
+ error: {
1535
+ color: theme.colors.red,
1536
+ fontSize: theme.fontSize.sm,
1537
+ uni__dependencies: [0]
1538
+ }
1539
+ }));
1540
+ //#endregion
1541
+ //#region src/extensions/workspaces/sessions/(frontend)/fill/WorkflowLauncher.overlay.native.tsx
1542
+ var WorkflowLauncher_overlay_native_default = defineFill({ component: WorkflowLauncher });
1543
+ //#endregion
1544
+ //#region src/extensions/workspaces/sessions/(frontend)/fill/_components/WorkflowsActivitySection.native.tsx
1545
+ function WorkflowsActivitySection({ sessionId, openSession, openTransientTab }) {
1546
+ const state = useWorkflows(sessionId);
1547
+ const [now, setNow] = useState(() => Date.now());
1548
+ const [folded, setFolded] = useState({});
1549
+ useEffect(() => {
1550
+ const timer = setInterval(() => setNow(Date.now()), 1e4);
1551
+ return () => clearInterval(timer);
1552
+ }, []);
1553
+ const groups = workflowActivityGroups(workflowActivityRows(state.runs, now, sessionId));
1554
+ return /* @__PURE__ */ jsxs(View, { children: [groups.map((group) => {
1555
+ const open = folded[group.name] ?? group.openByDefault;
1556
+ return /* @__PURE__ */ jsxs(View, { children: [/* @__PURE__ */ jsxs(Button, {
1557
+ variant: "ghost",
1558
+ accessibilityState: { expanded: open },
1559
+ onPress: () => setFolded((current) => ({
1560
+ ...current,
1561
+ [group.name]: !open
1562
+ })),
1563
+ children: [
1564
+ group.name,
1565
+ " · ",
1566
+ group.rows.length
1567
+ ]
1568
+ }), open ? group.rows.map((row) => /* @__PURE__ */ jsx(ListRow, {
1569
+ leading: /* @__PURE__ */ jsx(Dot, { tone: row.tone === "failed" ? "red" : row.tone === "running" || row.tone === "paused" ? "yellow" : row.tone === "done" ? "green" : "muted" }),
1570
+ title: /* @__PURE__ */ jsx(Button, {
1571
+ variant: "ghost",
1572
+ testID: `activity-workflow-${row.runKey}`,
1573
+ onPress: () => {
1574
+ if (row.ownerSessionId && openSession) {
1575
+ openSession(row.ownerSessionId);
1576
+ return;
1577
+ }
1578
+ const run = state.runs.find((item) => `${item.workspace}/${item.runKey}` === row.identity);
1579
+ if (sessionId !== null) focusRun(sessionId, row.identity);
1580
+ if (run) openTransientTab(workflowTab(run));
1581
+ },
1582
+ children: row.name
1583
+ }),
1584
+ description: `${row.detail} · ${row.elapsed}`
1585
+ }, row.identity)) : null] }, group.name);
1586
+ }), groups.length === 0 ? /* @__PURE__ */ jsx(Button, {
1587
+ variant: "ghost",
1588
+ testID: "activity-workflow-launch",
1589
+ disabled: sessionId === null,
1590
+ onPress: () => {
1591
+ if (sessionId !== null) openCatalog(sessionId);
1592
+ },
1593
+ children: "Launch a workflow"
1594
+ }) : null] });
1595
+ }
1596
+ //#endregion
1597
+ //#region src/extensions/workspaces/sessions/(frontend)/fill/Workflows.activity.workflows.native.tsx
1598
+ var Workflows_activity_workflows_native_default = defineFill({ component: WorkflowsActivitySection });
1599
+ //#endregion
1600
+ //#region generated/native.ts
1601
+ const via = (identity, value) => value === void 0 ? void 0 : {
1602
+ ...identity,
1603
+ ...value
1604
+ };
1605
+ const nativePlugin = defineNativePlugin({
1606
+ id: "workflows",
1607
+ workspace: { get fills() {
1608
+ return [via({
1609
+ slot: "home",
1610
+ id: "workflows"
1611
+ }, Workflows_home_native_default)];
1612
+ } },
1613
+ session: {
1614
+ get activityGroups() {
1615
+ return [via({ name: "workflows" }, workflows_native_default)];
1616
+ },
1617
+ get channels() {
1618
+ return [via({ channel: "workflow_catalog" }, workflow_catalog_native_default), via({ channel: "workflow_runs" }, workflow_runs_native_default)];
1619
+ },
1620
+ get fills() {
1621
+ return [via({
1622
+ slot: "overlay",
1623
+ id: "workflow-launcher"
1624
+ }, WorkflowLauncher_overlay_native_default), via({
1625
+ slot: "activity.workflows",
1626
+ id: "workflows"
1627
+ }, Workflows_activity_workflows_native_default)];
1628
+ }
1629
+ }
1630
+ });
1631
+ //#endregion
1632
+ export { nativePlugin };
1633
+
1634
+ //# sourceMappingURL=native.mjs.map