@acryldev/blends-frame 0.2.8 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -475,7 +475,8 @@ window.__ModuleLoader__.load({
475
475
  if (!isRecord$5(value)) throw new Error("github: not a readiness");
476
476
  if (value.status === "ready" && typeof value.account === "string") return {
477
477
  status: "ready",
478
- account: value.account
478
+ account: value.account,
479
+ ...value.via === "acryl" ? { via: "acryl" } : {}
479
480
  };
480
481
  if (value.status === "signed-out" && typeof value.say === "string" && typeof value.command === "string") return {
481
482
  status: "signed-out",
@@ -15177,13 +15178,14 @@ window.__ModuleLoader__.load({
15177
15178
  if (event.altKey || event.key.toLowerCase() !== "f") return false;
15178
15179
  return mac ? event.metaKey && !event.ctrlKey && !event.shiftKey : event.ctrlKey && event.shiftKey && !event.metaKey;
15179
15180
  }
15180
- const agent = (id, label, command, homepageUrl, color, yoloArgs = [], yoloEnv) => ({
15181
+ const agent = (id, label, command, homepageUrl, color, yoloArgs = [], yoloEnv, installCommand) => ({
15181
15182
  id,
15182
15183
  label,
15183
15184
  command,
15184
15185
  homepageUrl,
15185
15186
  yoloArgs,
15186
15187
  ...yoloEnv === void 0 ? {} : { yoloEnv },
15188
+ ...installCommand === void 0 ? {} : { installCommand },
15187
15189
  badge: {
15188
15190
  letter: [...label][0]?.toUpperCase() ?? "?",
15189
15191
  color
@@ -15192,15 +15194,15 @@ window.__ModuleLoader__.load({
15192
15194
  /** In the order the lists show them. Ids of agents that shipped earlier keep their spelling. */
15193
15195
  const KNOWN_AGENTS = [
15194
15196
  {
15195
- ...agent("claude", "Claude", "claude", "https://code.claude.com/docs", "#d97757", ["--dangerously-skip-permissions"]),
15197
+ ...agent("claude", "Claude", "claude", "https://code.claude.com/docs", "#d97757", ["--dangerously-skip-permissions"], void 0, "npm i -g @anthropic-ai/claude-code"),
15196
15198
  statusHooks: "claude"
15197
15199
  },
15198
- agent("codex", "Codex", "codex", "https://github.com/openai/codex", "#10a37f", ["--dangerously-bypass-approvals-and-sandbox"]),
15200
+ agent("codex", "Codex", "codex", "https://github.com/openai/codex", "#10a37f", ["--dangerously-bypass-approvals-and-sandbox"], void 0, "npm i -g @openai/codex"),
15199
15201
  agent("grok", "Grok", "grok", "https://x.ai/cli", "#94a3b8", ["--permission-mode", "bypassPermissions"]),
15200
15202
  agent("copilot", "GitHub Copilot", "copilot", "https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli", "#a78bfa", ["--yolo"]),
15201
15203
  agent("opencode", "OpenCode", "opencode", "https://opencode.ai/docs/cli/", "#94a3b8"),
15202
15204
  agent("ante", "Ante", "ante", "https://github.com/AntigmaLabs/ante-preview", "#fb923c", ["--yolo"]),
15203
- agent("pi", "Pi", "pi", "https://pi.dev", "#a78bfa"),
15205
+ agent("pi", "Pi", "pi", "https://pi.dev", "#a78bfa", [], void 0, "npm i -g @earendil-works/pi-coding-agent"),
15204
15206
  agent("omp", "OMP", "omp", "https://omp.sh", "#a78bfa"),
15205
15207
  agent("gemini", "Gemini", "gemini", "https://github.com/google-gemini/gemini-cli", "#4285f4", ["--yolo"]),
15206
15208
  agent("antigravity", "Antigravity", "agy", "https://antigravity.google/docs/cli-overview", "#4285f4", ["--dangerously-skip-permissions"]),
@@ -47870,7 +47872,23 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
47870
47872
  waiting,
47871
47873
  onConnected
47872
47874
  ]);
47873
- if (github.status === "checking" || github.status === "ready") return null;
47875
+ if (github.status === "checking") return null;
47876
+ if (github.status === "ready") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
47877
+ className: "acrylBlendsNote acrylBlendsConnected",
47878
+ role: "status",
47879
+ children: [
47880
+ "Connected as @",
47881
+ github.account,
47882
+ github.via === "acryl" && connect !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [" · ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
47883
+ type: "button",
47884
+ className: "acrylBlendsShareButton",
47885
+ onClick: () => {
47886
+ connect.disconnect().then(onConnected, () => {});
47887
+ },
47888
+ children: "Disconnect"
47889
+ })] })
47890
+ ]
47891
+ });
47874
47892
  const start = () => {
47875
47893
  if (connect === void 0) return;
47876
47894
  setConnecting({ status: "starting" });
@@ -47922,10 +47940,10 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
47922
47940
  onClick: start,
47923
47941
  children: connecting.status === "starting" ? "Connecting..." : "Connect GitHub"
47924
47942
  }) }),
47925
- github.status === "signed-out" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
47943
+ github.status === "signed-out" && connect === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
47926
47944
  className: "acrylBlendsConnectAlt",
47927
47945
  children: [
47928
- connect === void 0 ? "Open the Terminal and run:" : "Or in the Terminal:",
47946
+ "Open the Terminal and run:",
47929
47947
  " ",
47930
47948
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: github.command }),
47931
47949
  " ",
@@ -48312,7 +48330,16 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
48312
48330
  if (!response.ok) throw await failureOf(response);
48313
48331
  return parseGithubConnectState(await response.json());
48314
48332
  },
48315
- state: async () => parseGithubConnectState(await get(FRAME_PLUGINS_GITHUB_CONNECT_PATH))
48333
+ state: async () => parseGithubConnectState(await get(FRAME_PLUGINS_GITHUB_CONNECT_PATH)),
48334
+ async disconnect() {
48335
+ const response = await fetcher(FRAME_PLUGINS_GITHUB_PATH, {
48336
+ method: "DELETE",
48337
+ credentials: "same-origin",
48338
+ headers: { Accept: "application/json" }
48339
+ });
48340
+ if (!response.ok) throw await failureOf(response);
48341
+ return parseGithubReadiness(await response.json());
48342
+ }
48316
48343
  },
48317
48344
  async add(source) {
48318
48345
  const response = await fetcher(FRAME_PLUGINS_PULL_PATH, {
@@ -50284,6 +50311,100 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50284
50311
  return parseSnapshotCapture(await response.json());
50285
50312
  } };
50286
50313
  }
50314
+ // src/client/frame-control.ts
50315
+ /**
50316
+ * The frame's own UI, operable by the agent (the door's `frame` verb): the left panel (branches and versions), the right panel (the agents), Build and
50317
+ * Preview, and Settings. These are not part of the app page, so the door's page script, which runs in the canvas page, cannot see or click them; the
50318
+ * frame publishes this control on its own window and the page reaches it through `window.parent`, the way {@link installFrameView} publishes the mode.
50319
+ * The shapes match the door's page protocol (plugins/door/src/page/protocol.ts: `FRAME_CONTROL_KEY`, `FrameControl`); keep them in step.
50320
+ */
50321
+ const FRAME_CONTROL_KEY = Symbol.for("acryl.frame.control");
50322
+ const PANEL_NAME = {
50323
+ left: "left panel (branches and versions)",
50324
+ right: "right panel (the agents)"
50325
+ };
50326
+ /** What the person sees: Preview hides both panels whatever they were set to. */
50327
+ function stateOf(view, doc) {
50328
+ const { left, right, mode } = view.getSnapshot();
50329
+ const gear = doc.querySelector(".acrylBlendsSettings button[aria-label=\"Settings\"]");
50330
+ return {
50331
+ left: left && mode === "build",
50332
+ right: right && mode === "build",
50333
+ mode,
50334
+ settings: gear?.getAttribute("aria-expanded") === "true"
50335
+ };
50336
+ }
50337
+ const describe = (state) => `left panel ${state.left ? "open" : "closed"}, right panel ${state.right ? "open" : "closed"}, ${state.mode} mode${state.settings ? ", Settings open" : ""}`;
50338
+ const settle = (view) => new Promise((resolve) => {
50339
+ view.setTimeout(resolve, 50);
50340
+ });
50341
+ function frameControl(view, doc = document) {
50342
+ const setPanel = (panel, open) => {
50343
+ const shown = stateOf(view, doc)[panel];
50344
+ if (open && !shown) {
50345
+ if (panel === "left") view.showLeft();
50346
+ else view.showRight();
50347
+ }
50348
+ if (!open && shown) {
50349
+ if (panel === "left") view.toggleLeft();
50350
+ else view.toggleRight();
50351
+ }
50352
+ };
50353
+ return {
50354
+ state: () => stateOf(view, doc),
50355
+ async run(request) {
50356
+ const win = doc.defaultView ?? window;
50357
+ switch (request.action) {
50358
+ case "state": break;
50359
+ case "open":
50360
+ case "close":
50361
+ case "toggle": {
50362
+ const panel = request.panel;
50363
+ if (panel === void 0) throw new Error(`frame ${request.action} needs left or right`);
50364
+ setPanel(panel, request.action === "open" ? true : request.action === "close" ? false : !stateOf(view, doc)[panel]);
50365
+ await settle(win);
50366
+ return `${PANEL_NAME[panel]} ${stateOf(view, doc)[panel] ? "open" : "closed"}; frame: ${describe(stateOf(view, doc))}`;
50367
+ }
50368
+ case "build":
50369
+ case "preview":
50370
+ view.setMode(request.action);
50371
+ break;
50372
+ case "settings": {
50373
+ if (!stateOf(view, doc).settings) win.dispatchEvent(new Event(OPEN_SETTINGS_EVENT));
50374
+ if (request.section === void 0) {
50375
+ await settle(win);
50376
+ break;
50377
+ }
50378
+ const wanted = request.section.trim().toLowerCase();
50379
+ for (let tries = 0; tries < 20; tries += 1) {
50380
+ await settle(win);
50381
+ const button = [...doc.querySelectorAll("[role=\"dialog\"] button")].find((item) => item.textContent?.trim().toLowerCase() === wanted);
50382
+ if (button !== void 0) {
50383
+ button.click();
50384
+ await settle(win);
50385
+ return `Settings open at ${button.textContent?.trim() ?? request.section}; frame: ${describe(stateOf(view, doc))}`;
50386
+ }
50387
+ }
50388
+ throw new Error(`Settings has no section "${request.section}"`);
50389
+ }
50390
+ }
50391
+ await settle(win);
50392
+ return `frame: ${describe(stateOf(view, doc))}`;
50393
+ }
50394
+ };
50395
+ }
50396
+ /** Publish the control on the frame's window. @returns the disposer. */
50397
+ function installFrameControl(view) {
50398
+ const control = frameControl(view);
50399
+ Object.defineProperty(window, FRAME_CONTROL_KEY, {
50400
+ configurable: true,
50401
+ value: control
50402
+ });
50403
+ return () => {
50404
+ const own = window;
50405
+ if (own[FRAME_CONTROL_KEY] === control) delete own[FRAME_CONTROL_KEY];
50406
+ };
50407
+ }
50287
50408
  // src/client/view-state.ts
50288
50409
  /**
50289
50410
  * The frame's own view: which panels are open, their widths and which mode it is in. Both panels open on the first run; after that the person's choice
@@ -50609,6 +50730,7 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50609
50730
  };
50610
50731
  }, "@acryldev/blends-frame: the canvas service");
50611
50732
  ctx.effect(() => installFrameView(canvas, view), "@acryldev/blends-frame: the app page view");
50733
+ ctx.effect(() => installFrameControl(view), "@acryldev/blends-frame: frame control");
50612
50734
  let sidebarRight;
50613
50735
  const sidebarOpens = /* @__PURE__ */ new Set();
50614
50736
  ctx.inject(["sidebarRight"], (child) => {