@acryldev/blends 1.7.10 → 1.7.11

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.
@@ -1,4 +1,4 @@
1
- import { _ as UiRequest, n as AuditEntry, r as ChannelToHost, v as UiResult } from "./protocol-DdQgl224.js";
1
+ import { C as UiRequest, n as AuditEntry, r as ChannelToHost, w as UiResult } from "./protocol-CbLZdkJ5.js";
2
2
 
3
3
  //#region ../../../plugins/door/src/host/channel.d.ts
4
4
  /** The slice of a page's stream the channel needs, so tests can supply their own. */
@@ -1,5 +1,5 @@
1
- import { f as UiActionResult, y as UiSnapshot } from "../protocol-DdQgl224.js";
2
- import { i as UiChannel, r as PageStream, t as AuditLog } from "../audit-B2H3sUfg.js";
1
+ import { T as UiSnapshot, v as UiActionResult } from "../protocol-CbLZdkJ5.js";
2
+ import { i as UiChannel, r as PageStream, t as AuditLog } from "../audit-D0McL8hN.js";
3
3
  import { Context } from "@deepseek-ai/cordis";
4
4
  import z from "@deepseek-ai/schemastery";
5
5
 
@@ -283,8 +283,8 @@ declare class Door {
283
283
  */
284
284
  /** Every verb, in the order `brief` lists them. */
285
285
  /** The verbs that only use the page: what a page-only door (a production assistant) offers. */
286
- declare const PAGE_VERBS: readonly ["look", "act"];
287
- declare const VERBS: readonly ["brief", "look", "act", "plugin-list", "plugin-add", "plugin-pull", "plugin-publish", "plugin-remove", "plugin-reload", "tool-list", "tool-call", "window-list", "window-open", "window-focus", "window-close", "window-resize", "menu-list", "menu-click"];
286
+ declare const PAGE_VERBS: readonly ["look", "act", "frame"];
287
+ declare const VERBS: readonly ["brief", "look", "act", "frame", "plugin-list", "plugin-add", "plugin-pull", "plugin-publish", "plugin-remove", "plugin-reload", "tool-list", "tool-call", "window-list", "window-open", "window-focus", "window-close", "window-resize", "menu-list", "menu-click"];
288
288
  type Verb = (typeof VERBS)[number];
289
289
  /** The JSON Schema of a verb's arguments, as MCP lists it. */
290
290
  interface ArgumentsSchema {
@@ -3,8 +3,8 @@ import { r as streamSSE } from "../streaming-CL2i3hX_.js";
3
3
  import { o as pageAuthority } from "../loopback-only-0nTL30Zt.js";
4
4
  import "../helpers-qmReU164.js";
5
5
  import { n as clientModules } from "../client-modules-ChLgW0l9.js";
6
- import { a as MAX_WAIT_MS, d as parseChannelToHost, l as UiControlError, p as parseUiRequest, r as MAX_SNAPSHOT_NODES, u as WINDOW_ID } from "../protocol-8HjYa5OX.js";
7
- import { a as INVALID_JSON, c as operatorOnly, d as AuditLog, f as auditPath, i as DOOR_PREFIX, l as privateApi, o as error, p as UiChannel, r as pageChannelRoutes, s as jsonBody, t as renderSnapshot, u as readJson } from "../snapshot-text-Cyl69OKv.js";
6
+ import { a as MAX_SNAPSHOT_NODES, d as UiControlError, f as WINDOW_ID, h as parseUiRequest, p as parseChannelToHost, s as MAX_WAIT_MS } from "../protocol-BKXK53WF.js";
7
+ import { a as INVALID_JSON, c as operatorOnly, d as AuditLog, f as auditPath, i as DOOR_PREFIX, l as privateApi, o as error, p as UiChannel, r as pageChannelRoutes, s as jsonBody, t as renderSnapshot, u as readJson } from "../snapshot-text-BYY2gA98.js";
8
8
  import "../src-BycZ1HUQ.js";
9
9
  import "../middleware-B8gJUDgl.js";
10
10
  import { isAbsolute, join, relative, resolve } from "node:path";
@@ -299,11 +299,16 @@ function shellRoutes(prefix, secret, channel, heartbeatMs = SHELL_HEARTBEAT_MS)
299
299
  */
300
300
  /** Every verb, in the order `brief` lists them. */
301
301
  /** The verbs that only use the page: what a page-only door (a production assistant) offers. */
302
- const PAGE_VERBS = ["look", "act"];
302
+ const PAGE_VERBS = [
303
+ "look",
304
+ "act",
305
+ "frame"
306
+ ];
303
307
  const VERBS = [
304
308
  "brief",
305
309
  "look",
306
310
  "act",
311
+ "frame",
307
312
  "plugin-list",
308
313
  "plugin-add",
309
314
  "plugin-pull",
@@ -445,6 +450,38 @@ const VERB_SPECS = {
445
450
  additionalProperties: false
446
451
  }
447
452
  },
453
+ "frame": {
454
+ usage: "frame [open|close|toggle left|right | settings [<section>] | build | preview]: the ACRYL frame around the app (its panels, mode, Settings); alone, its state",
455
+ description: "Operate the ACRYL frame around the app, which is not part of the app's page: open, close or toggle its left panel (branches and versions) or right panel (the agents), open Settings (optionally at a section such as App or Share), or switch Build and Preview. Without an action it says what is open (look says it too). A request to collapse, open or show these is done here, never by editing the app.",
456
+ arguments: {
457
+ type: "object",
458
+ properties: {
459
+ action: {
460
+ type: "string",
461
+ enum: [
462
+ "state",
463
+ "open",
464
+ "close",
465
+ "toggle",
466
+ "settings",
467
+ "build",
468
+ "preview"
469
+ ],
470
+ description: "default: state"
471
+ },
472
+ panel: {
473
+ type: "string",
474
+ enum: ["left", "right"],
475
+ description: "open, close, toggle: left is branches and versions, right is the agents"
476
+ },
477
+ section: {
478
+ type: "string",
479
+ description: "settings: the section to show, e.g. App, Share, Plugins"
480
+ }
481
+ },
482
+ additionalProperties: false
483
+ }
484
+ },
448
485
  "plugin-list": {
449
486
  usage: "plugin list: the plugins installed while the app runs",
450
487
  description: "The plugins installed into the running app.",
@@ -715,6 +752,17 @@ var Door = class {
715
752
  text: `done${result.target === void 0 ? "" : `: ${result.target.role} "${result.target.name}"`}${result.detail === void 0 ? "" : ` (${result.detail})`}; look again before the next act`
716
753
  };
717
754
  }
755
+ case "frame": {
756
+ const { window, rest } = this.windowOf(input, scope);
757
+ const result = await this.callPage("frame", this.parse({
758
+ ...rest,
759
+ op: "frame"
760
+ }), signal, window, scope.page);
761
+ return {
762
+ value: result,
763
+ text: result.detail ?? "done"
764
+ };
765
+ }
718
766
  case "plugin-list": return this.plugin((plugins) => plugins.list(), false, this.installed());
719
767
  case "plugin-add": return this.plugin((extensions) => extensions.install(this.insideApp(input.folder)));
720
768
  case "plugin-pull": return input.from === void 0 ? this.pull(input.source) : this.pullList(input.from, input.source);
@@ -763,6 +811,7 @@ var Door = class {
763
811
  read.length === 0 ? "No AGENTS.md or skill in the folder." : `Read first: ${read.join(", ")}.`,
764
812
  `Page: ${value.page}${value.page === "not open" ? " (open the app in a browser to look and act)" : ""}.`,
765
813
  `Live plugins: ${value.plugins}.`,
814
+ "Asked to click, open, close, collapse, show or type on screen? Operate the interface (look, then act inside the page, frame for the ACRYL frame around it); never edit code for it unless the person asks to change the app.",
766
815
  "Verbs:",
767
816
  ...value.verbs.map((line) => ` ${line}`)
768
817
  ].join("\n")
@@ -1,6 +1,6 @@
1
1
  import { t as Acryl } from "../app-DGqSNBSd.js";
2
- import { n as AuditEntry, y as UiSnapshot } from "../protocol-DdQgl224.js";
3
- import { i as UiChannel, n as auditPath, r as PageStream, t as AuditLog } from "../audit-B2H3sUfg.js";
2
+ import { T as UiSnapshot, n as AuditEntry } from "../protocol-CbLZdkJ5.js";
3
+ import { i as UiChannel, n as auditPath, r as PageStream, t as AuditLog } from "../audit-D0McL8hN.js";
4
4
 
5
5
  //#region ../../../plugins/door/src/host/page-routes.d.ts
6
6
  /** How often the Host writes a `ping`; the page gives up on a stream that is silent for three of these. */
package/lib/door/host.js CHANGED
@@ -1,2 +1,2 @@
1
- import { d as AuditLog, f as auditPath, n as HEARTBEAT_MS, p as UiChannel, r as pageChannelRoutes, t as renderSnapshot } from "../snapshot-text-Cyl69OKv.js";
1
+ import { d as AuditLog, f as auditPath, n as HEARTBEAT_MS, p as UiChannel, r as pageChannelRoutes, t as renderSnapshot } from "../snapshot-text-BYY2gA98.js";
2
2
  export { AuditLog, HEARTBEAT_MS, UiChannel, auditPath, pageChannelRoutes, renderSnapshot };
@@ -1,4 +1,4 @@
1
- import { _ as UiRequest, v as UiResult } from "../protocol-DdQgl224.js";
1
+ import { C as UiRequest, l as FrameControl, w as UiResult } from "../protocol-CbLZdkJ5.js";
2
2
 
3
3
  //#region ../../../plugins/door/src/page/driver/driver.d.ts
4
4
  interface DriverActivity {
@@ -24,6 +24,8 @@ interface UiDriverOptions {
24
24
  } | {
25
25
  readonly path: string;
26
26
  }) => void;
27
+ /** The ACRYL frame around the page, when there is one: `look` reports it and `frame` operates it. */
28
+ readonly frame?: () => FrameControl | undefined;
27
29
  }
28
30
  declare class UiDriver {
29
31
  private readonly refs;
@@ -56,6 +58,8 @@ declare class UiDriver {
56
58
  /** @param signal - the Host cancelled the call. @throws UiControlError. */
57
59
  handle(request: UiRequest, signal?: AbortSignal): Promise<UiResult>;
58
60
  private run;
61
+ /** The frame's state, or undefined when the page is not in a frame or the frame cannot be read. */
62
+ private frameState;
59
63
  /**
60
64
  * Run an act that may start a navigation (a click on a link, Enter in a form) and say so: the browser asks `beforeunload` when a navigation starts, during the act or a
61
65
  * moment after it. The answer is sent before the page goes; the Host then waits for the next page instead of reading this one again.
package/lib/door/page.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as MAX_WAIT_MS, f as parseChannelToPage, l as UiControlError, o as MUTATING_OPS, r as MAX_SNAPSHOT_NODES } from "../protocol-8HjYa5OX.js";
1
+ import { a as MAX_SNAPSHOT_NODES, c as MUTATING_OPS, d as UiControlError, m as parseChannelToPage, s as MAX_WAIT_MS } from "../protocol-BKXK53WF.js";
2
2
  //#region ../../../plugins/door/src/page/socket-source.ts
3
3
  function socketSource(socket) {
4
4
  const listeners = /* @__PURE__ */ new Map();
@@ -1062,10 +1062,25 @@ var UiDriver = class {
1062
1062
  }
1063
1063
  async run(request, signal) {
1064
1064
  switch (request.op) {
1065
- case "snapshot": return this.snapshots.snapshot({
1066
- ...request.cursor === void 0 ? {} : { cursor: request.cursor },
1067
- ...request.maxNodes === void 0 ? {} : { maxNodes: request.maxNodes }
1068
- });
1065
+ case "snapshot": {
1066
+ const snapshot = this.snapshots.snapshot({
1067
+ ...request.cursor === void 0 ? {} : { cursor: request.cursor },
1068
+ ...request.maxNodes === void 0 ? {} : { maxNodes: request.maxNodes }
1069
+ });
1070
+ const frame = this.frameState();
1071
+ return frame === void 0 ? snapshot : {
1072
+ ...snapshot,
1073
+ frame
1074
+ };
1075
+ }
1076
+ case "frame": {
1077
+ const control = this.options.frame?.();
1078
+ if (control === void 0) throw new UiControlError("not-actionable", "this page is not inside the ACRYL frame (it runs on its own), so there is no frame to operate");
1079
+ return {
1080
+ ok: true,
1081
+ detail: await control.run(request)
1082
+ };
1083
+ }
1069
1084
  case "click": return await this.watchLeaving(() => click(this.env, request), signal);
1070
1085
  case "type": return await this.watchLeaving(() => typeText(this.env, request), signal);
1071
1086
  case "select": return selectOption(this.env, request);
@@ -1076,6 +1091,14 @@ var UiDriver = class {
1076
1091
  case "navigate": return this.leave({ path: request.path }, `going to ${request.path}`);
1077
1092
  }
1078
1093
  }
1094
+ /** The frame's state, or undefined when the page is not in a frame or the frame cannot be read. */
1095
+ frameState() {
1096
+ try {
1097
+ return this.options.frame?.()?.state();
1098
+ } catch {
1099
+ return;
1100
+ }
1101
+ }
1079
1102
  /**
1080
1103
  * Run an act that may start a navigation (a click on a link, Enter in a form) and say so: the browser asks `beforeunload` when a navigation starts, during the act or a
1081
1104
  * moment after it. The answer is sent before the page goes; the Host then waits for the next page instead of reading this one again.
@@ -1,2 +1,2 @@
1
- import { C as parseUiRequest, S as parseChannelToPage, _ as UiRequest, a as DEFAULT_SNAPSHOT_NODES, b as WINDOW_ID, c as MAX_WAIT_MS, d as UI_OPS, f as UiActionResult, g as UiOp, h as UiNode, i as ChannelToPage, l as MUTATING_OPS, m as UiErrorCode, n as AuditEntry, o as MAX_SNAPSHOT_NODES, p as UiControlError, r as ChannelToHost, s as MAX_TEXT_LENGTH, t as APP_PATH, u as UI_ERROR_CODES, v as UiResult, x as parseChannelToHost, y as UiSnapshot } from "../protocol-DdQgl224.js";
2
- export { APP_PATH, AuditEntry, ChannelToHost, ChannelToPage, DEFAULT_SNAPSHOT_NODES, MAX_SNAPSHOT_NODES, MAX_TEXT_LENGTH, MAX_WAIT_MS, MUTATING_OPS, UI_ERROR_CODES, UI_OPS, UiActionResult, UiControlError, UiErrorCode, UiNode, UiOp, UiRequest, UiResult, UiSnapshot, WINDOW_ID, parseChannelToHost, parseChannelToPage, parseUiRequest };
1
+ import { C as UiRequest, D as parseChannelToHost, E as WINDOW_ID, O as parseChannelToPage, S as UiOp, T as UiSnapshot, _ as UI_OPS, a as DEFAULT_SNAPSHOT_NODES, b as UiErrorCode, c as FrameAction, d as FrameState, f as MAX_SNAPSHOT_NODES, g as UI_ERROR_CODES, h as MUTATING_OPS, i as ChannelToPage, k as parseUiRequest, l as FrameControl, m as MAX_WAIT_MS, n as AuditEntry, o as FRAME_ACTIONS, p as MAX_TEXT_LENGTH, r as ChannelToHost, s as FRAME_CONTROL_KEY, t as APP_PATH, u as FramePanel, v as UiActionResult, w as UiResult, x as UiNode, y as UiControlError } from "../protocol-CbLZdkJ5.js";
2
+ export { APP_PATH, AuditEntry, ChannelToHost, ChannelToPage, DEFAULT_SNAPSHOT_NODES, FRAME_ACTIONS, FRAME_CONTROL_KEY, FrameAction, FrameControl, FramePanel, FrameState, MAX_SNAPSHOT_NODES, MAX_TEXT_LENGTH, MAX_WAIT_MS, MUTATING_OPS, UI_ERROR_CODES, UI_OPS, UiActionResult, UiControlError, UiErrorCode, UiNode, UiOp, UiRequest, UiResult, UiSnapshot, WINDOW_ID, parseChannelToHost, parseChannelToPage, parseUiRequest };
@@ -1,2 +1,2 @@
1
- import { a as MAX_WAIT_MS, c as UI_OPS, d as parseChannelToHost, f as parseChannelToPage, i as MAX_TEXT_LENGTH, l as UiControlError, n as DEFAULT_SNAPSHOT_NODES, o as MUTATING_OPS, p as parseUiRequest, r as MAX_SNAPSHOT_NODES, s as UI_ERROR_CODES, t as APP_PATH, u as WINDOW_ID } from "../protocol-8HjYa5OX.js";
2
- export { APP_PATH, DEFAULT_SNAPSHOT_NODES, MAX_SNAPSHOT_NODES, MAX_TEXT_LENGTH, MAX_WAIT_MS, MUTATING_OPS, UI_ERROR_CODES, UI_OPS, UiControlError, WINDOW_ID, parseChannelToHost, parseChannelToPage, parseUiRequest };
1
+ import { a as MAX_SNAPSHOT_NODES, c as MUTATING_OPS, d as UiControlError, f as WINDOW_ID, h as parseUiRequest, i as FRAME_CONTROL_KEY, l as UI_ERROR_CODES, m as parseChannelToPage, n as DEFAULT_SNAPSHOT_NODES, o as MAX_TEXT_LENGTH, p as parseChannelToHost, r as FRAME_ACTIONS, s as MAX_WAIT_MS, t as APP_PATH, u as UI_OPS } from "../protocol-BKXK53WF.js";
2
+ export { APP_PATH, DEFAULT_SNAPSHOT_NODES, FRAME_ACTIONS, FRAME_CONTROL_KEY, MAX_SNAPSHOT_NODES, MAX_TEXT_LENGTH, MAX_WAIT_MS, MUTATING_OPS, UI_ERROR_CODES, UI_OPS, UiControlError, WINDOW_ID, parseChannelToHost, parseChannelToPage, parseUiRequest };
@@ -6,6 +6,20 @@
6
6
  * Everything crossing the channel is validated here once, so neither side trusts the other's JSON. The page imports this file too, so it
7
7
  * lives with the page code and has no Node imports.
8
8
  */
9
+ /**
10
+ * The ACRYL frame around a canvas page: its own panels, mode and Settings, which are not part of the app's page. The frame publishes a
11
+ * {@link FrameControl} on its window under {@link FRAME_CONTROL_KEY}; the door's page script, running in the canvas, reaches it as `window.parent`.
12
+ */
13
+ const FRAME_CONTROL_KEY = Symbol.for("acryl.frame.control");
14
+ const FRAME_ACTIONS = [
15
+ "state",
16
+ "open",
17
+ "close",
18
+ "toggle",
19
+ "settings",
20
+ "build",
21
+ "preview"
22
+ ];
9
23
  /** The operations the driver performs on the page. */
10
24
  const UI_OPS = [
11
25
  "snapshot",
@@ -16,7 +30,8 @@ const UI_OPS = [
16
30
  "scroll",
17
31
  "wait",
18
32
  "reload",
19
- "navigate"
33
+ "navigate",
34
+ "frame"
20
35
  ];
21
36
  /** Operations that change the page, so each call needs approval. `snapshot`, `scroll` and `wait` only look. */
22
37
  const MUTATING_OPS = [
@@ -25,7 +40,8 @@ const MUTATING_OPS = [
25
40
  "select",
26
41
  "press",
27
42
  "reload",
28
- "navigate"
43
+ "navigate",
44
+ "frame"
29
45
  ];
30
46
  /** A place in the app to go to: a path on the page's own origin (`/demo`, `/notes?q=a#top`), never another site and never a `//host` address. */
31
47
  const APP_PATH = /^\/(?![/\\])[^\0\\]{0,2000}$/u;
@@ -158,6 +174,26 @@ function parseUiRequest(value) {
158
174
  op,
159
175
  path: value.path
160
176
  };
177
+ case "frame": {
178
+ only([
179
+ "action",
180
+ "panel",
181
+ "section"
182
+ ]);
183
+ const action = value.action === void 0 ? "state" : value.action;
184
+ if (!FRAME_ACTIONS.includes(action)) return invalid(`frame action must be one of ${FRAME_ACTIONS.join(", ")}`);
185
+ const panel = value.panel;
186
+ if (panel !== void 0 && panel !== "left" && panel !== "right") return invalid("panel must be left or right");
187
+ if ((action === "open" || action === "close" || action === "toggle") && panel === void 0) return invalid(`frame ${String(action)} needs a panel: left (branches and versions) or right (the agents)`);
188
+ const section = value.section === void 0 ? void 0 : text(value.section, 80);
189
+ if (section !== void 0 && action !== "settings") return invalid("section goes with settings");
190
+ return {
191
+ op,
192
+ action,
193
+ ...panel === void 0 ? {} : { panel },
194
+ ...section === void 0 ? {} : { section }
195
+ };
196
+ }
161
197
  default: return invalid(`unknown op ${String(op)}`);
162
198
  }
163
199
  }
@@ -214,4 +250,4 @@ function parseChannelToHost(value) {
214
250
  return null;
215
251
  }
216
252
  //#endregion
217
- export { MAX_WAIT_MS as a, UI_OPS as c, parseChannelToHost as d, parseChannelToPage as f, MAX_TEXT_LENGTH as i, UiControlError as l, DEFAULT_SNAPSHOT_NODES as n, MUTATING_OPS as o, parseUiRequest as p, MAX_SNAPSHOT_NODES as r, UI_ERROR_CODES as s, APP_PATH as t, WINDOW_ID as u };
253
+ export { MAX_SNAPSHOT_NODES as a, MUTATING_OPS as c, UiControlError as d, WINDOW_ID as f, parseUiRequest as h, FRAME_CONTROL_KEY as i, UI_ERROR_CODES as l, parseChannelToPage as m, DEFAULT_SNAPSHOT_NODES as n, MAX_TEXT_LENGTH as o, parseChannelToHost as p, FRAME_ACTIONS as r, MAX_WAIT_MS as s, APP_PATH as t, UI_OPS as u };
@@ -6,8 +6,30 @@
6
6
  * Everything crossing the channel is validated here once, so neither side trusts the other's JSON. The page imports this file too, so it
7
7
  * lives with the page code and has no Node imports.
8
8
  */
9
+ /**
10
+ * The ACRYL frame around a canvas page: its own panels, mode and Settings, which are not part of the app's page. The frame publishes a
11
+ * {@link FrameControl} on its window under {@link FRAME_CONTROL_KEY}; the door's page script, running in the canvas, reaches it as `window.parent`.
12
+ */
13
+ declare const FRAME_CONTROL_KEY: symbol;
14
+ declare const FRAME_ACTIONS: readonly ["state", "open", "close", "toggle", "settings", "build", "preview"];
15
+ type FrameAction = (typeof FRAME_ACTIONS)[number];
16
+ type FramePanel = 'left' | 'right';
17
+ /** What the frame shows: its left panel (branches and versions), its right panel (the agents), its mode, and whether Settings is open. */
18
+ interface FrameState {
19
+ readonly left: boolean;
20
+ readonly right: boolean;
21
+ readonly mode: 'build' | 'preview';
22
+ readonly settings: boolean;
23
+ }
24
+ interface FrameControl {
25
+ state(): FrameState;
26
+ /** Do one frame action; the answer says what changed. @throws Error with a reason a person can read. */
27
+ run(request: Extract<UiRequest, {
28
+ readonly op: 'frame';
29
+ }>): string | Promise<string>;
30
+ }
9
31
  /** The operations the driver performs on the page. */
10
- declare const UI_OPS: readonly ["snapshot", "click", "type", "select", "press", "scroll", "wait", "reload", "navigate"];
32
+ declare const UI_OPS: readonly ["snapshot", "click", "type", "select", "press", "scroll", "wait", "reload", "navigate", "frame"];
11
33
  type UiOp = (typeof UI_OPS)[number];
12
34
  /** Operations that change the page, so each call needs approval. `snapshot`, `scroll` and `wait` only look. */
13
35
  declare const MUTATING_OPS: readonly UiOp[];
@@ -47,6 +69,8 @@ interface UiSnapshot {
47
69
  readonly total: number;
48
70
  /** Pass to the next snapshot call to continue, or absent when this is everything. */
49
71
  readonly nextCursor?: number;
72
+ /** The ACRYL frame around this page, when the page is in one. */
73
+ readonly frame?: FrameState;
50
74
  }
51
75
  type UiRequest = {
52
76
  readonly op: 'snapshot';
@@ -86,6 +110,11 @@ type UiRequest = {
86
110
  } | {
87
111
  readonly op: 'navigate';
88
112
  readonly path: string;
113
+ } | {
114
+ readonly op: 'frame';
115
+ readonly action: FrameAction;
116
+ readonly panel?: FramePanel;
117
+ readonly section?: string;
89
118
  };
90
119
  /** What the page did, and to which control (for the audit log and the approval prompt). */
91
120
  interface UiActionResult {
@@ -157,4 +186,4 @@ interface AuditEntry {
157
186
  readonly approval: 'asked' | 'none' | 'not-needed' | 'token';
158
187
  }
159
188
  //#endregion
160
- export { parseUiRequest as C, parseChannelToPage as S, UiRequest as _, DEFAULT_SNAPSHOT_NODES as a, WINDOW_ID as b, MAX_WAIT_MS as c, UI_OPS as d, UiActionResult as f, UiOp as g, UiNode as h, ChannelToPage as i, MUTATING_OPS as l, UiErrorCode as m, AuditEntry as n, MAX_SNAPSHOT_NODES as o, UiControlError as p, ChannelToHost as r, MAX_TEXT_LENGTH as s, APP_PATH as t, UI_ERROR_CODES as u, UiResult as v, parseChannelToHost as x, UiSnapshot as y };
189
+ export { UiRequest as C, parseChannelToHost as D, WINDOW_ID as E, parseChannelToPage as O, UiOp as S, UiSnapshot as T, UI_OPS as _, DEFAULT_SNAPSHOT_NODES as a, UiErrorCode as b, FrameAction as c, FrameState as d, MAX_SNAPSHOT_NODES as f, UI_ERROR_CODES as g, MUTATING_OPS as h, ChannelToPage as i, parseUiRequest as k, FrameControl as l, MAX_WAIT_MS as m, AuditEntry as n, FRAME_ACTIONS as o, MAX_TEXT_LENGTH as p, ChannelToHost as r, FRAME_CONTROL_KEY as s, APP_PATH as t, FramePanel as u, UiActionResult as v, UiResult as w, UiNode as x, UiControlError as y };
@@ -4,7 +4,7 @@ import { t as methodNotAllowed } from "./method-not-allowed-B3nMAp1f.js";
4
4
  import { r as streamSSE } from "./streaming-CL2i3hX_.js";
5
5
  import { a as loopbackOnly, i as loopbackAuthority } from "./loopback-only-0nTL30Zt.js";
6
6
  import "./helpers-qmReU164.js";
7
- import { d as parseChannelToHost, l as UiControlError, u as WINDOW_ID } from "./protocol-8HjYa5OX.js";
7
+ import { d as UiControlError, f as WINDOW_ID, p as parseChannelToHost } from "./protocol-BKXK53WF.js";
8
8
  import "./src-BycZ1HUQ.js";
9
9
  import "./middleware-B8gJUDgl.js";
10
10
  import { dirname, join } from "node:path";
@@ -591,7 +591,7 @@ function renderSnapshot(snapshot, more = (cursor) => `call ui_snapshot with curs
591
591
  return `${" ".repeat(Math.min(node.depth, 8))}- ${node.role}${node.name === "" ? "" : ` ${JSON.stringify(node.name)}`}${level}${states}${value}${options} [ref=${node.ref}]`;
592
592
  });
593
593
  const rest = snapshot.nextCursor === void 0 ? "" : `\n(${String(snapshot.total - snapshot.nextCursor)} more elements; ${more(snapshot.nextCursor)})`;
594
- return `Page: ${snapshot.title || "(untitled)"}\nSnapshot ${String(snapshot.generation)}, ${String(snapshot.nodes.length)} of ${String(snapshot.total)} elements:\n${lines.join("\n")}${rest}`;
594
+ return `${snapshot.frame === void 0 ? "" : `Frame (the ACRYL window around the app, not part of the app): left panel (branches, versions) ${snapshot.frame.left ? "open" : "closed"}, right panel (agents) ${snapshot.frame.right ? "open" : "closed"}, ${snapshot.frame.mode} mode${snapshot.frame.settings ? ", Settings open" : ""}. Operate it with frame (open|close|toggle left|right, settings [section], build, preview), never by editing code.\n`}Page: ${snapshot.title || "(untitled)"}\nSnapshot ${String(snapshot.generation)}, ${String(snapshot.nodes.length)} of ${String(snapshot.total)} elements:\n${lines.join("\n")}${rest}`;
595
595
  }
596
596
  //#endregion
597
597
  export { INVALID_JSON as a, operatorOnly as c, AuditLog as d, auditPath as f, DOOR_PREFIX as i, privateApi as l, HEARTBEAT_MS as n, error as o, UiChannel as p, pageChannelRoutes as r, jsonBody as s, renderSnapshot as t, readJson as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/blends",
3
- "version": "1.7.10",
3
+ "version": "1.7.11",
4
4
  "description": "The Acryl web framework (import { Acryl } from \"acrylblends\") and the acrylblends command that scaffolds Cordis apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/door",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "The door of an ACRYL framework app, one Cordis plugin: an agent working in the app folder looks at the running page (snapshots with refs), acts on it (click, type, select, press, scroll, wait) and installs plugins live, through .acryl/bin/acryl; loopback only, with a per-run secret in .acryl/door.json, an audit log, and an in-page indicator with a kill switch",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -4,7 +4,7 @@
4
4
  * `.acryl/door.json` upward, or `--dir`), never through PATH or a machine-wide registry, so it reaches only the app running from that
5
5
  * folder. The secret is read from that file and sent as a `Bearer` header; it is never printed.
6
6
  *
7
- * acryl brief | look | act <op> ... | plugin list|add|remove|reload | tool list|call | window list|open|focus|close|resize | menu list|click | verbs (--json for the raw value)
7
+ * acryl brief | look | act <op> ... | frame ... | plugin list|add|remove|reload | tool list|call | window list|open|focus|close|resize | menu list|click | verbs (--json for the raw value)
8
8
  * acryl control <...> the same, the ACRYL Host form (`control snapshot`, `control click`, ... are look and act)
9
9
  *
10
10
  * Exit codes: 0 done, 1 the verb failed (its code and message are printed), 2 a usage error, 3 no running app in this folder.
@@ -43,6 +43,7 @@ const USAGE = `usage: acryl <verb> [options] [--json] [--dir <app folder>]
43
43
  act navigate --path <path of the app, e.g. /demo>
44
44
  act wait (--text <t> | --role <role> [--name <n>]) [--gone] [--timeout-ms <ms>]
45
45
  (look and every act take --window <n>: the desktop window whose page it is for; window list prints the numbers)
46
+ frame [open|close|toggle left|right | settings [<section>] | build | preview] (the ACRYL frame around the app; alone, what is open)
46
47
  plugin list | plugin add <folder> | plugin pull <source> | plugin publish <name> [--owner <account>] [--license <id>] | plugin remove <name> | plugin reload
47
48
  window list | window open [--path <p>] | window focus --id <n> | window close --id <n> [--force]
48
49
  window resize --id <n> --width <px> --height <px>
@@ -136,6 +137,16 @@ export function parseInvocation(argv: readonly string[], env: NodeJS.ProcessEnv
136
137
  ...(set.has('--gone') ? { gone: true } : {}),
137
138
  })
138
139
  }
140
+ case 'frame': {
141
+ const action = second ?? 'state'
142
+ if (action === 'open' || action === 'close' || action === 'toggle') {
143
+ if (third !== 'left' && third !== 'right') throw new UsageError(`frame ${action} needs left (branches and versions) or right (the agents)`)
144
+ return make('frame', { action, panel: third })
145
+ }
146
+ if (action === 'settings') return make('frame', { action, ...(third === undefined ? {} : { section: words.slice(2).join(' ') }) })
147
+ if (action === 'state' || action === 'build' || action === 'preview') return make('frame', { action })
148
+ throw new UsageError(`frame needs open|close|toggle left|right, settings [section], build or preview\n${USAGE}`)
149
+ }
139
150
  case 'plugin': {
140
151
  if (second === 'list' || second === 'reload') return make(`plugin-${second}`)
141
152
  if (second === 'add') { if (third === undefined) throw new UsageError('plugin add needs a folder, e.g. plugin add plugins/pomodoro'); return make('plugin-add', { folder: third }) }
@@ -191,6 +191,11 @@ export class Door {
191
191
  const result = await this.act(input, signal, scope)
192
192
  return { value: result, text: `done${result.target === undefined ? '' : `: ${result.target.role} "${result.target.name}"`}${result.detail === undefined ? '' : ` (${result.detail})`}; look again before the next act` }
193
193
  }
194
+ case 'frame': {
195
+ const { window, rest } = this.windowOf(input, scope)
196
+ const result = await this.callPage('frame', this.parse({ ...rest, op: 'frame' }), signal, window, scope.page) as UiActionResult
197
+ return { value: result, text: result.detail ?? 'done' }
198
+ }
194
199
  case 'plugin-list': return this.plugin(plugins => plugins.list(), false, this.installed())
195
200
  case 'plugin-add': return this.plugin(extensions => extensions.install(this.insideApp(input.folder)))
196
201
  case 'plugin-pull': return input.from === undefined ? this.pull(input.source) : this.pullList(input.from, input.source)
@@ -230,6 +235,7 @@ export class Door {
230
235
  read.length === 0 ? 'No AGENTS.md or skill in the folder.' : `Read first: ${read.join(', ')}.`,
231
236
  `Page: ${value.page}${value.page === 'not open' ? ' (open the app in a browser to look and act)' : ''}.`,
232
237
  `Live plugins: ${value.plugins}.`,
238
+ 'Asked to click, open, close, collapse, show or type on screen? Operate the interface (look, then act inside the page, frame for the ACRYL frame around it); never edit code for it unless the person asks to change the app.',
233
239
  'Verbs:',
234
240
  ...value.verbs.map(line => ` ${line}`),
235
241
  ].join('\n')
@@ -7,9 +7,9 @@ import { MAX_SNAPSHOT_NODES, MAX_WAIT_MS } from '../page/protocol.ts'
7
7
 
8
8
  /** Every verb, in the order `brief` lists them. */
9
9
  /** The verbs that only use the page: what a page-only door (a production assistant) offers. */
10
- export const PAGE_VERBS = ['look', 'act'] as const satisfies readonly Verb[]
10
+ export const PAGE_VERBS = ['look', 'act', 'frame'] as const satisfies readonly Verb[]
11
11
 
12
- export const VERBS = ['brief', 'look', 'act', 'plugin-list', 'plugin-add', 'plugin-pull', 'plugin-publish', 'plugin-remove', 'plugin-reload', 'tool-list', 'tool-call', 'window-list', 'window-open', 'window-focus', 'window-close', 'window-resize', 'menu-list', 'menu-click'] as const
12
+ export const VERBS = ['brief', 'look', 'act', 'frame', 'plugin-list', 'plugin-add', 'plugin-pull', 'plugin-publish', 'plugin-remove', 'plugin-reload', 'tool-list', 'tool-call', 'window-list', 'window-open', 'window-focus', 'window-close', 'window-resize', 'menu-list', 'menu-click'] as const
13
13
  export type Verb = (typeof VERBS)[number]
14
14
 
15
15
  /** The JSON Schema of a verb's arguments, as MCP lists it. */
@@ -76,6 +76,19 @@ export const VERB_SPECS: Readonly<Record<Verb, VerbSpec>> = {
76
76
  additionalProperties: false,
77
77
  },
78
78
  },
79
+ 'frame': {
80
+ usage: 'frame [open|close|toggle left|right | settings [<section>] | build | preview]: the ACRYL frame around the app (its panels, mode, Settings); alone, its state',
81
+ description: 'Operate the ACRYL frame around the app, which is not part of the app\'s page: open, close or toggle its left panel (branches and versions) or right panel (the agents), open Settings (optionally at a section such as App or Share), or switch Build and Preview. Without an action it says what is open (look says it too). A request to collapse, open or show these is done here, never by editing the app.',
82
+ arguments: {
83
+ type: 'object',
84
+ properties: {
85
+ action: { type: 'string', enum: ['state', 'open', 'close', 'toggle', 'settings', 'build', 'preview'], description: 'default: state' },
86
+ panel: { type: 'string', enum: ['left', 'right'], description: 'open, close, toggle: left is branches and versions, right is the agents' },
87
+ section: { type: 'string', description: 'settings: the section to show, e.g. App, Share, Plugins' },
88
+ },
89
+ additionalProperties: false,
90
+ },
91
+ },
79
92
  'plugin-list': {
80
93
  usage: 'plugin list: the plugins installed while the app runs',
81
94
  description: 'The plugins installed into the running app.',
@@ -5,7 +5,7 @@
5
5
  * shows. It touches only the document it is given, never another window and never the OS.
6
6
  */
7
7
 
8
- import { UiControlError, MUTATING_OPS, type UiActionResult, type UiRequest, type UiResult } from '../protocol.ts'
8
+ import { UiControlError, MUTATING_OPS, type FrameControl, type FrameState, type UiActionResult, type UiRequest, type UiResult } from '../protocol.ts'
9
9
  import { click, pressKey, scroll, selectOption, typeText, wait, type ActionEnvironment } from './actions.ts'
10
10
  import { RefTable } from './ref-table.ts'
11
11
  import { SnapshotBuilder } from './snapshot.ts'
@@ -39,6 +39,8 @@ export interface UiDriverOptions {
39
39
  readonly touched?: (element: Element) => void
40
40
  /** Leave the page: reload it, or go to a path of the app. Default: the document's own `location`, a moment after the answer is sent. */
41
41
  readonly leave?: (to: { readonly reload: true } | { readonly path: string }) => void
42
+ /** The ACRYL frame around the page, when there is one: `look` reports it and `frame` operates it. */
43
+ readonly frame?: () => FrameControl | undefined
42
44
  }
43
45
 
44
46
  function realSleep(ms: number, signal: AbortSignal): Promise<void> {
@@ -151,7 +153,17 @@ export class UiDriver {
151
153
 
152
154
  private async run(request: UiRequest, signal: AbortSignal): Promise<UiResult> {
153
155
  switch (request.op) {
154
- case 'snapshot': return this.snapshots.snapshot({ ...(request.cursor === undefined ? {} : { cursor: request.cursor }), ...(request.maxNodes === undefined ? {} : { maxNodes: request.maxNodes }) })
156
+ case 'snapshot': {
157
+ const snapshot = this.snapshots.snapshot({ ...(request.cursor === undefined ? {} : { cursor: request.cursor }), ...(request.maxNodes === undefined ? {} : { maxNodes: request.maxNodes }) })
158
+ const frame = this.frameState()
159
+ return frame === undefined ? snapshot : { ...snapshot, frame }
160
+ }
161
+ case 'frame': {
162
+ const control = this.options.frame?.()
163
+ if (control === undefined) throw new UiControlError('not-actionable', 'this page is not inside the ACRYL frame (it runs on its own), so there is no frame to operate')
164
+ const detail = await control.run(request)
165
+ return { ok: true, detail }
166
+ }
155
167
  case 'click': return await this.watchLeaving(() => click(this.env, request), signal)
156
168
  case 'type': return await this.watchLeaving(() => typeText(this.env, request), signal)
157
169
  case 'select': return selectOption(this.env, request)
@@ -163,6 +175,15 @@ export class UiDriver {
163
175
  }
164
176
  }
165
177
 
178
+ /** The frame's state, or undefined when the page is not in a frame or the frame cannot be read. */
179
+ private frameState(): FrameState | undefined {
180
+ try {
181
+ return this.options.frame?.()?.state()
182
+ } catch {
183
+ return undefined
184
+ }
185
+ }
186
+
166
187
  /**
167
188
  * Run an act that may start a navigation (a click on a link, Enter in a form) and say so: the browser asks `beforeunload` when a navigation starts, during the act or a
168
189
  * moment after it. The answer is sent before the page goes; the Host then waits for the next page instead of reading this one again.
@@ -10,6 +10,7 @@ import { UiDriver } from './driver/driver.ts'
10
10
  import { mountIndicator } from './indicator.ts'
11
11
  import { mountOutlines } from './outline.ts'
12
12
  import { UserInputClock } from './user-input.ts'
13
+ import { FRAME_CONTROL_KEY, type FrameControl } from './protocol.ts'
13
14
 
14
15
  export const DOOR_BASE = '/api/acryl-door'
15
16
 
@@ -48,6 +49,16 @@ export function startDoor(document: Document, base: string = DOOR_BASE): () => v
48
49
  document: () => document,
49
50
  msSinceUserInput: clock.msSince,
50
51
  touched: (element) => { outlines.touched(element) },
52
+ // The ACRYL frame publishes its control on its own window; this page is its canvas (same origin). A page on its own has no parent and no frame.
53
+ frame: () => {
54
+ try {
55
+ if (view.parent === view) return undefined
56
+ const control = (view.parent as unknown as Record<symbol, FrameControl | undefined>)[FRAME_CONTROL_KEY]
57
+ return typeof control?.run === 'function' && typeof control.state === 'function' ? control : undefined
58
+ } catch {
59
+ return undefined
60
+ }
61
+ },
51
62
  // A host that serves the app under a prefix (the ACRYL frame's canvas) marks its pages: an app path navigates under that prefix, so the same
52
63
  // `act navigate --path /board` reaches the app's /board in the frame and on the app's own server.
53
64
  ...(appBase === '' ? {} : {