@acryldev/blends-frame 0.1.6 → 0.2.1

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
@@ -5,8 +5,8 @@ window.__ModuleLoader__.load({
5
5
  var exports = module.exports;
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
7
  require("@deepseek-ai/dsh-client-ui-renderer/client");
8
- let acryl_app_shell_client = require("@acryldev/app-shell/client");
9
- let acryl_versions_client = require("@acryldev/versions/client");
8
+ let _acryldev_app_shell_client = require("@acryldev/app-shell/client");
9
+ let _acryldev_versions_client = require("@acryldev/versions/client");
10
10
  let react = require("react");
11
11
  let react_jsx_runtime = require("react/jsx-runtime");
12
12
  // src/contract.ts
@@ -168,6 +168,30 @@ window.__ModuleLoader__.load({
168
168
  const FRAME_PLUGINS_PATH = `${FRAME_API_PREFIX}/plugins`;
169
169
  const FRAME_PLUGINS_SWITCH_PATH = `${FRAME_API_PREFIX}/plugins/switch`;
170
170
  /** POST `{ name }`: what sharing this local plugin would do (a {@link SharePlan}); nothing leaves the machine. */
171
+ /** POST `{ owner?, visibility? }`: what sharing the whole app to GitHub would send (Settings > Share); sends nothing. */
172
+ const FRAME_APP_SHARE_PLAN_PATH = `${FRAME_API_PREFIX}/app/share-plan`;
173
+ /** POST `{ owner?, visibility?, confirm }`: share the app exactly as the confirmed plan says, or nothing. */
174
+ const FRAME_APP_SHARE_PATH = `${FRAME_API_PREFIX}/app/share`;
175
+ function parseAppSharePlan(value) {
176
+ if (!isRecord$5(value)) throw new Error("app share plan: not a plan");
177
+ const { repository, create, visibility, changes } = value;
178
+ if (typeof repository !== "string" || repository === "" || typeof create !== "boolean") throw new Error("app share plan: repository");
179
+ if (visibility !== "private" && visibility !== "public") throw new Error("app share plan: visibility");
180
+ if (typeof changes !== "number" || !Number.isSafeInteger(changes) || changes < 0) throw new Error("app share plan: changes");
181
+ return {
182
+ repository,
183
+ create,
184
+ visibility,
185
+ changes
186
+ };
187
+ }
188
+ function parseAppShared(value) {
189
+ if (!isRecord$5(value) || typeof value.remote !== "string" || typeof value.created !== "boolean") throw new Error("app share: where it went");
190
+ return {
191
+ remote: value.remote,
192
+ created: value.created
193
+ };
194
+ }
171
195
  const FRAME_PLUGINS_SHARE_PLAN_PATH = `${FRAME_API_PREFIX}/plugins/share-plan`;
172
196
  /** POST `{ name, confirm }`: publish it, only when `confirm` is the plan the person said yes to and it still holds. */
173
197
  const FRAME_PLUGINS_SHARE_PATH = `${FRAME_API_PREFIX}/plugins/share`;
@@ -2384,7 +2408,7 @@ window.__ModuleLoader__.load({
2384
2408
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("small", { children: [
2385
2409
  note.element === void 0 ? "nothing specific" : `pinned on ${note.element.label}`,
2386
2410
  " · ",
2387
- (0, acryl_versions_client.formatRelativeTime)(note.at)
2411
+ (0, _acryldev_versions_client.formatRelativeTime)(note.at)
2388
2412
  ] }),
2389
2413
  note.screenshot !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
2390
2414
  className: "acrylBlendsFeedbackThumb",
@@ -2988,7 +3012,7 @@ window.__ModuleLoader__.load({
2988
3012
  ]
2989
3013
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2990
3014
  className: "acrylBlendsMeta",
2991
- children: (0, acryl_versions_client.formatRelativeTime)(entry.at)
3015
+ children: (0, _acryldev_versions_client.formatRelativeTime)(entry.at)
2992
3016
  })]
2993
3017
  }, entry.hash))
2994
3018
  ]
@@ -3636,7 +3660,7 @@ window.__ModuleLoader__.load({
3636
3660
  "aria-hidden": "true",
3637
3661
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 3v10M3 8h10" })
3638
3662
  });
3639
- const PTY_NOTE = "Claude, Codex and Pi run as they are, in a terminal. They drive the app from inside: they know the ACRYL app's architecture through its skills, extend it with Cordis plugins, and use the app's UI through acryl-control.";
3663
+ const PTY_NOTE = "Claude, Codex and Pi run as they are, in a terminal. They drive the app from inside: they know the ACRYL app's architecture through its skills, extend it with Cordis plugins, and use the app's UI through @acryldev/control.";
3640
3664
  const baseName = (path) => path.slice(path.lastIndexOf("/") + 1);
3641
3665
  /** The strip's content width, kept current as the panel opens, closes or resizes. */
3642
3666
  function useStripWidth(ref) {
@@ -4272,6 +4296,7 @@ window.__ModuleLoader__.load({
4272
4296
  "data-mode": frameView.mode,
4273
4297
  "data-left": leftOpen ? "open" : "closed",
4274
4298
  "data-right": rightOpen ? "open" : "closed",
4299
+ "data-frame-state": state.status,
4275
4300
  children: [
4276
4301
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
4277
4302
  className: "acrylBlendsBar",
@@ -4512,7 +4537,7 @@ window.__ModuleLoader__.load({
4512
4537
  * for this one's answer and replace a live app page (section 30) - and nothing here reloads on its own: only `navigate` and `reload`, which only a
4513
4538
  * person or the door calls.
4514
4539
  */
4515
- /** The key the door publishes `{ windowId }` on the page's window (plugins/acryl-door/src/page/index.ts, `PAGE_KEY`). */
4540
+ /** The key the door publishes `{ windowId }` on the page's window (plugins/door/src/page/index.ts, `PAGE_KEY`). */
4516
4541
  const DOOR_PAGE_KEY = Symbol.for("acryl.door.page");
4517
4542
  /** The canvas as the frame renders it; one instance per client plugin lifetime. */
4518
4543
  var AppCanvasState = class {
@@ -4662,11 +4687,19 @@ window.__ModuleLoader__.load({
4662
4687
  * What the frame shows around the app, from the Host's state route. The frame reads it again while the page is visible, so a version an agent saves
4663
4688
  * or a file it changes shows without a reload; a failed re-read keeps what is shown, and an unchanged answer tells no one.
4664
4689
  */
4690
+ /**
4691
+ * Whether a scheduled read should run: while the page is visible, and always until the first successful answer. The canvas waits on that first
4692
+ * answer, and a page the browser reports hidden (a headless tab, a window behind another) would otherwise never retry a failed one.
4693
+ */
4694
+ function shouldReadOnTick(visibility, status) {
4695
+ return visibility === "visible" || status !== "ready";
4696
+ }
4665
4697
  var FrameStateStore = class {
4666
4698
  fetchImpl;
4667
4699
  view = Object.freeze({ status: "loading" });
4668
4700
  listeners = /* @__PURE__ */ new Set();
4669
4701
  generation = 0;
4702
+ inFlight;
4670
4703
  constructor(fetchImpl = (input, init) => fetch(input, init)) {
4671
4704
  this.fetchImpl = fetchImpl;
4672
4705
  }
@@ -4691,9 +4724,21 @@ window.__ModuleLoader__.load({
4691
4724
  const next = await this.read();
4692
4725
  return next.status === "ready" ? next.state : void 0;
4693
4726
  }
4727
+ /**
4728
+ * One read at a time: a tick while a read is still in flight joins that read instead of starting another, whose start would make the first
4729
+ * answer stale and drop it. With the Host's git-heavy read slower than the 5 s tick under load, every answer was superseded before it landed
4730
+ * and the page stayed 'loading' forever (the canvas never appeared: verify-ide-template's flake).
4731
+ */
4732
+ read() {
4733
+ if (this.inFlight !== void 0) return this.inFlight;
4734
+ const run = this.readOnce(++this.generation).finally(() => {
4735
+ if (this.inFlight === run) this.inFlight = void 0;
4736
+ });
4737
+ this.inFlight = run;
4738
+ return run;
4739
+ }
4694
4740
  /** One read of the Host's state, published to the page unless a newer read started meanwhile; returns what this read got. */
4695
- async read() {
4696
- const mine = ++this.generation;
4741
+ async readOnce(mine) {
4697
4742
  let next;
4698
4743
  try {
4699
4744
  const response = await this.fetchImpl(FRAME_STATE_PATH, { credentials: "same-origin" });
@@ -4716,7 +4761,7 @@ window.__ModuleLoader__.load({
4716
4761
  return next;
4717
4762
  }
4718
4763
  };
4719
- // ../acryl-workspace/lib/ui.js
4764
+ // ../workspace/lib/ui.js
4720
4765
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
4721
4766
  var _virtual_xterm_css_default = "/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * https://github.com/chjj/term.js\n * @license MIT\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n * Originally forked from (with the author's permission):\n * Fabrice Bellard's javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n */\n\n/**\n * Default styles for xterm.js\n */\n\n.xterm {\n cursor: text;\n position: relative;\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n}\n\n.xterm.focus,\n.xterm:focus {\n outline: none;\n}\n\n.xterm .xterm-helpers {\n position: absolute;\n top: 0;\n /**\n * The z-index of the helpers must be higher than the canvases in order for\n * IMEs to appear on top.\n */\n z-index: 5;\n}\n\n.xterm .xterm-helper-textarea {\n padding: 0;\n border: 0;\n margin: 0;\n /* Move textarea out of the screen to the far left, so that the cursor is not visible */\n position: absolute;\n opacity: 0;\n left: -9999em;\n top: 0;\n width: 0;\n height: 0;\n z-index: -5;\n /** Prevent wrapping so the IME appears against the textarea at the correct position */\n white-space: nowrap;\n overflow: hidden;\n resize: none;\n}\n\n.xterm .composition-view {\n /* TODO: Composition position got messed up somewhere */\n background: #000;\n color: #FFF;\n display: none;\n position: absolute;\n white-space: nowrap;\n z-index: 1;\n}\n\n.xterm .composition-view.active {\n display: block;\n}\n\n.xterm .xterm-viewport {\n /* On OS X this is required in order for the scroll bar to appear fully opaque */\n background-color: #000;\n overflow-y: scroll;\n cursor: default;\n position: absolute;\n right: 0;\n left: 0;\n top: 0;\n bottom: 0;\n}\n\n.xterm .xterm-screen {\n position: relative;\n}\n\n.xterm .xterm-screen canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.xterm .xterm-scroll-area {\n visibility: hidden;\n}\n\n.xterm-char-measure-element {\n display: inline-block;\n visibility: hidden;\n position: absolute;\n top: 0;\n left: -9999em;\n line-height: normal;\n}\n\n.xterm.enable-mouse-events {\n /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */\n cursor: default;\n}\n\n.xterm.xterm-cursor-pointer,\n.xterm .xterm-cursor-pointer {\n cursor: pointer;\n}\n\n.xterm.column-select.focus {\n /* Column selection mode */\n cursor: crosshair;\n}\n\n.xterm .xterm-accessibility:not(.debug),\n.xterm .xterm-message {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n z-index: 10;\n color: transparent;\n pointer-events: none;\n}\n\n.xterm .xterm-accessibility-tree:not(.debug) *::selection {\n color: transparent;\n}\n\n.xterm .xterm-accessibility-tree {\n user-select: text;\n white-space: pre;\n}\n\n.xterm .live-region {\n position: absolute;\n left: -9999px;\n width: 1px;\n height: 1px;\n overflow: hidden;\n}\n\n.xterm-dim {\n /* Dim should not apply to background, so the opacity of the foreground color is applied\n * explicitly in the generated class and reset to 1 here */\n opacity: 1 !important;\n}\n\n.xterm-underline-1 { text-decoration: underline; }\n.xterm-underline-2 { text-decoration: double underline; }\n.xterm-underline-3 { text-decoration: wavy underline; }\n.xterm-underline-4 { text-decoration: dotted underline; }\n.xterm-underline-5 { text-decoration: dashed underline; }\n\n.xterm-overline {\n text-decoration: overline;\n}\n\n.xterm-overline.xterm-underline-1 { text-decoration: overline underline; }\n.xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }\n.xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }\n.xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }\n.xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }\n\n.xterm-strikethrough {\n text-decoration: line-through;\n}\n\n.xterm-screen .xterm-decoration-container .xterm-decoration {\n z-index: 6;\n position: absolute;\n}\n\n.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {\n z-index: 7;\n}\n\n.xterm-decoration-overview-ruler {\n z-index: 8;\n position: absolute;\n top: 0;\n right: 0;\n pointer-events: none;\n}\n\n.xterm-decoration-top {\n z-index: 2;\n position: relative;\n}\n";
4722
4767
  var require_addon_fit = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -15190,7 +15235,7 @@ window.__ModuleLoader__.load({
15190
15235
  error: value.error
15191
15236
  };
15192
15237
  }
15193
- throw new Error("acryl-workspace: invalid terminal stream message");
15238
+ throw new Error("@acryldev/workspace: invalid terminal stream message");
15194
15239
  }
15195
15240
  /**
15196
15241
  * The browser end of one terminal's live stream (see `src/pty/stream.ts`).
@@ -15616,7 +15661,7 @@ window.__ModuleLoader__.load({
15616
15661
  return value !== null && typeof value === "object" && !Array.isArray(value);
15617
15662
  }
15618
15663
  function parseView(value) {
15619
- if (!isObject$1(value) || typeof value.id !== "string" || value.status !== "starting" && value.status !== "running" && value.status !== "exited" && value.status !== "error" || typeof value.output !== "string" || value.exitCode !== null && typeof value.exitCode !== "number" || value.error !== null && typeof value.error !== "string") throw new Error("acryl-workspace: invalid workspace PTY response");
15664
+ if (!isObject$1(value) || typeof value.id !== "string" || value.status !== "starting" && value.status !== "running" && value.status !== "exited" && value.status !== "error" || typeof value.output !== "string" || value.exitCode !== null && typeof value.exitCode !== "number" || value.error !== null && typeof value.error !== "string") throw new Error("@acryldev/workspace: invalid workspace PTY response");
15620
15665
  return {
15621
15666
  id: value.id,
15622
15667
  status: value.status,
@@ -15657,7 +15702,7 @@ window.__ModuleLoader__.load({
15657
15702
  credentials: "same-origin"
15658
15703
  });
15659
15704
  const body = await readJson(response);
15660
- if (!response.ok) throw new Error("acryl-workspace: workspace PTY read failed");
15705
+ if (!response.ok) throw new Error("@acryldev/workspace: workspace PTY read failed");
15661
15706
  return parseView(body);
15662
15707
  },
15663
15708
  async write(id, data) {
@@ -15669,7 +15714,7 @@ window.__ModuleLoader__.load({
15669
15714
  id,
15670
15715
  data
15671
15716
  })
15672
- })).ok) throw new Error("acryl-workspace: workspace PTY write failed");
15717
+ })).ok) throw new Error("@acryldev/workspace: workspace PTY write failed");
15673
15718
  },
15674
15719
  async resize(id, cols, rows) {
15675
15720
  if (!(await fetcher("/api/acryl-workspace/pty/resize", {
@@ -15681,7 +15726,7 @@ window.__ModuleLoader__.load({
15681
15726
  cols,
15682
15727
  rows
15683
15728
  })
15684
- })).ok) throw new Error("acryl-workspace: workspace PTY resize failed");
15729
+ })).ok) throw new Error("@acryldev/workspace: workspace PTY resize failed");
15685
15730
  },
15686
15731
  async close(id) {
15687
15732
  if (!(await fetcher("/api/acryl-workspace/pty/close", {
@@ -15689,7 +15734,7 @@ window.__ModuleLoader__.load({
15689
15734
  credentials: "same-origin",
15690
15735
  headers: { "content-type": "application/json" },
15691
15736
  body: JSON.stringify({ id })
15692
- })).ok) throw new Error("acryl-workspace: workspace PTY close failed");
15737
+ })).ok) throw new Error("@acryldev/workspace: workspace PTY close failed");
15693
15738
  }
15694
15739
  };
15695
15740
  }
@@ -16352,8 +16397,8 @@ window.__ModuleLoader__.load({
16352
16397
  ctx.effect(() => ctx.locale.register(SETTINGS_LOCALE_NAMESPACE, {
16353
16398
  zh,
16354
16399
  en
16355
- }), "acryl-workspace settings: dictionaries");
16356
- ctx.effect(() => installSettingsStyles(), "acryl-workspace settings: styles");
16400
+ }), "@acryldev/workspace settings: dictionaries");
16401
+ ctx.effect(() => installSettingsStyles(), "@acryldev/workspace settings: styles");
16357
16402
  }
16358
16403
  };
16359
16404
  }
@@ -47858,7 +47903,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
47858
47903
  // src/client/PluginsSection.tsx
47859
47904
  /** The Plugins page of Settings: search, the groups as chips, and one row per plugin with who made it, its state and its switch. */
47860
47905
  /** Copy a text to the clipboard; false when the browser refuses (a copy the person can still make by hand from the shown text). */
47861
- async function copyText(text) {
47906
+ async function copyText$1(text) {
47862
47907
  try {
47863
47908
  await navigator.clipboard.writeText(text);
47864
47909
  return true;
@@ -47938,7 +47983,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
47938
47983
  const copy = async (plugin, text, what) => {
47939
47984
  setSaid({
47940
47985
  key: plugin.key,
47941
- text: await copyText(text) ? `Copied ${what}.` : `Your browser did not allow copying; select it here: ${text}`
47986
+ text: await copyText$1(text) ? `Copied ${what}.` : `Your browser did not allow copying; select it here: ${text}`
47942
47987
  });
47943
47988
  };
47944
47989
  const viewSource = (plugin) => {
@@ -48172,7 +48217,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
48172
48217
  plugin,
48173
48218
  readGithub: registry.github,
48174
48219
  connectGithub: registry.connect,
48175
- copy: copyText,
48220
+ copy: copyText$1,
48176
48221
  onSaved: (saved) => {
48177
48222
  mark(plugin.key, { saved: {
48178
48223
  version: saved.version,
@@ -48610,6 +48655,221 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
48610
48655
  ]
48611
48656
  });
48612
48657
  }
48658
+ // src/client/ShareAppSection.tsx
48659
+ /**
48660
+ * Settings > Share, in every app (window or browser tab): send the whole app, as it is now, to a GitHub repository of the person's own. The plan
48661
+ * comes first (which repository, who can see it, what is saved first) and nothing leaves the computer until the person says yes. GitHub is
48662
+ * connected here the way the Plugins page connects it. Laid out as the App page is: a title, one line under it, one bordered row per thing.
48663
+ */
48664
+ function createShareAppApi(fetcher = (input, init) => fetch(input, init)) {
48665
+ const post = async (path, body) => {
48666
+ const response = await fetcher(path, {
48667
+ method: "POST",
48668
+ credentials: "same-origin",
48669
+ headers: {
48670
+ "Content-Type": "application/json",
48671
+ Accept: "application/json"
48672
+ },
48673
+ body: JSON.stringify(body)
48674
+ });
48675
+ if (!response.ok) throw await failureOf(response);
48676
+ return response.json();
48677
+ };
48678
+ return {
48679
+ plan: async (request) => parseAppSharePlan(await post(FRAME_APP_SHARE_PLAN_PATH, request)),
48680
+ share: async (request, confirm) => parseAppShared(await post(FRAME_APP_SHARE_PATH, {
48681
+ ...request,
48682
+ confirm
48683
+ }))
48684
+ };
48685
+ }
48686
+ async function copyText(text) {
48687
+ try {
48688
+ await navigator.clipboard.writeText(text);
48689
+ return true;
48690
+ } catch {
48691
+ return false;
48692
+ }
48693
+ }
48694
+ /** `github.com/ana/shop` from a remote address, for reading. */
48695
+ const readable = (remote) => remote.replace(/^git\+/u, "").replace(/^https?:\/\//u, "").replace(/\.git$/u, "");
48696
+ function ShareAppSection({ share, registry }) {
48697
+ const [github, setGithub] = (0, react.useState)({ status: "checking" });
48698
+ const [owner, setOwner] = (0, react.useState)("");
48699
+ const [visibility, setVisibility] = (0, react.useState)("private");
48700
+ const [step, setStep] = (0, react.useState)({ kind: "ask" });
48701
+ const [failure, setFailure] = (0, react.useState)(void 0);
48702
+ const readGithub = (0, react.useCallback)(() => {
48703
+ registry.github().then(setGithub, () => {
48704
+ setGithub({ status: "checking" });
48705
+ });
48706
+ }, [registry]);
48707
+ (0, react.useEffect)(() => {
48708
+ readGithub();
48709
+ }, [readGithub]);
48710
+ const request = {
48711
+ ...owner.trim() === "" ? {} : { owner: owner.trim() },
48712
+ visibility
48713
+ };
48714
+ const fail = (cause) => {
48715
+ setFailure(cause instanceof PlainFailure || cause instanceof Error ? cause.message : String(cause));
48716
+ };
48717
+ const review = (event) => {
48718
+ event.preventDefault();
48719
+ setFailure(void 0);
48720
+ setStep({ kind: "busy" });
48721
+ share.plan(request).then((plan) => {
48722
+ setStep({
48723
+ kind: "plan",
48724
+ plan
48725
+ });
48726
+ }, (cause) => {
48727
+ setStep({ kind: "ask" });
48728
+ fail(cause);
48729
+ });
48730
+ };
48731
+ const send = (plan) => {
48732
+ setFailure(void 0);
48733
+ setStep({
48734
+ kind: "sending",
48735
+ plan
48736
+ });
48737
+ share.share(request, plan).then((shared) => {
48738
+ setStep({
48739
+ kind: "shared",
48740
+ shared
48741
+ });
48742
+ }, (cause) => {
48743
+ setStep({
48744
+ kind: "plan",
48745
+ plan
48746
+ });
48747
+ fail(cause);
48748
+ });
48749
+ };
48750
+ const ready = github.status === "ready";
48751
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
48752
+ className: "acrylBlendsApp",
48753
+ children: [
48754
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: "Share" }),
48755
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
48756
+ className: "acrylBlendsPluginsSub",
48757
+ children: "Send this app, as it is now, to a GitHub repository of your own. Nothing is sent until you say yes."
48758
+ }),
48759
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GithubNote, {
48760
+ github,
48761
+ copy: copyText,
48762
+ connect: registry.connect,
48763
+ onConnected: readGithub
48764
+ }),
48765
+ failure !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
48766
+ className: "acrylBlendsNote",
48767
+ "data-error": true,
48768
+ role: "alert",
48769
+ children: failure
48770
+ }),
48771
+ step.kind === "shared" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
48772
+ className: "acrylBlendsAppRow",
48773
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: "Shared" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("small", {
48774
+ role: "status",
48775
+ children: [
48776
+ "Sent to ",
48777
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
48778
+ className: "acrylBlendsMeta",
48779
+ children: readable(step.shared.remote)
48780
+ }),
48781
+ step.shared.created ? " (a new repository)" : "",
48782
+ ". Every later version is saved there too. Someone you give access makes their own copy with",
48783
+ " ",
48784
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: `git clone ${step.shared.remote.replace(/^git\+/u, "")}` })
48785
+ ]
48786
+ })]
48787
+ }) : step.kind === "plan" || step.kind === "sending" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
48788
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
48789
+ className: "acrylBlendsAppRow",
48790
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: "Repository" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("small", { children: [readable(step.plan.create ? `github.com/${step.plan.repository}` : step.plan.repository), step.plan.create ? " (a new repository)" : ""] })]
48791
+ }),
48792
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
48793
+ className: "acrylBlendsAppRow",
48794
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: "Who can see it" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: step.plan.visibility === "private" ? "Only you and people you invite (private)" : "Anyone (public); listed in the Blends registry as Community" })]
48795
+ }),
48796
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
48797
+ className: "acrylBlendsAppRow",
48798
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: "What is sent" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: step.plan.changes === 0 ? "The versions saved so far" : `${String(step.plan.changes)} changed ${step.plan.changes === 1 ? "file is" : "files are"} saved first, then every saved version` })]
48799
+ }),
48800
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
48801
+ className: "acrylBlendsAppRow",
48802
+ children: [
48803
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: "Send it?" }),
48804
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
48805
+ className: "acrylBlendsAppControls",
48806
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
48807
+ type: "button",
48808
+ className: "acrylBlendsAppButton",
48809
+ disabled: step.kind === "sending",
48810
+ onClick: () => {
48811
+ send(step.plan);
48812
+ },
48813
+ children: step.kind === "sending" ? "Sending…" : "Yes, share this app"
48814
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
48815
+ type: "button",
48816
+ className: "acrylBlendsAppButton",
48817
+ disabled: step.kind === "sending",
48818
+ onClick: () => {
48819
+ setStep({ kind: "ask" });
48820
+ },
48821
+ children: "Not yet"
48822
+ })]
48823
+ }),
48824
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: "Nothing has been sent. It is sent only when you say yes." })
48825
+ ]
48826
+ })
48827
+ ] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
48828
+ className: "acrylBlendsAppRow",
48829
+ onSubmit: review,
48830
+ children: [
48831
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: "Share to GitHub" }),
48832
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
48833
+ className: "acrylBlendsAppControls",
48834
+ children: [
48835
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
48836
+ className: "acrylBlendsSearch",
48837
+ "aria-label": "GitHub account",
48838
+ placeholder: "GitHub account (blank: yours)",
48839
+ value: owner,
48840
+ onChange: (event) => {
48841
+ setOwner(event.target.value);
48842
+ }
48843
+ }),
48844
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
48845
+ className: "acrylBlendsSearch",
48846
+ "aria-label": "Who can see it",
48847
+ value: visibility,
48848
+ onChange: (event) => {
48849
+ setVisibility(event.target.value === "public" ? "public" : "private");
48850
+ },
48851
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
48852
+ value: "private",
48853
+ children: "Private: only you and people you invite"
48854
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
48855
+ value: "public",
48856
+ children: "Public: anyone, listed as Community"
48857
+ })]
48858
+ }),
48859
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
48860
+ type: "submit",
48861
+ className: "acrylBlendsAppButton",
48862
+ disabled: !ready || step.kind === "busy",
48863
+ children: step.kind === "busy" ? "Reading…" : "Review what would be sent"
48864
+ })
48865
+ ]
48866
+ }),
48867
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: ready ? "The plan comes first: which repository, who can see it, and what is saved first." : "Connect GitHub first (above)." })
48868
+ ]
48869
+ })
48870
+ ]
48871
+ });
48872
+ }
48613
48873
  // src/client/NameYourApp.tsx
48614
48874
  /**
48615
48875
  * The first start of a desktop product asks one thing, in the app's own window: "Name your app" (app-storage.md, "What the person sees"). The product's
@@ -48933,7 +49193,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
48933
49193
  });
48934
49194
  }
48935
49195
  // src/client/SettingsLauncher.tsx
48936
- /** The window event the Desktop's Settings... menu item sends (`plugins/desktop/frame.ts`, `openFrameSettings`); keep the string in step. */
49196
+ /** The window event the Desktop's Settings... menu item sends (`plugins/desktop-shell/frame.ts`, `openFrameSettings`); keep the string in step. */
48937
49197
  const OPEN_SETTINGS_EVENT = "acryl:open-settings";
48938
49198
  const GearIcon = () => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
48939
49199
  viewBox: "0 0 24 24",
@@ -49618,7 +49878,7 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
49618
49878
  };
49619
49879
  // src/client/tools.ts
49620
49880
  /**
49621
- * The right panel's tools, from the workspace's reusable client layers (`acryl-workspace/ui`): the live terminal sessions and the PTY, files and
49881
+ * The right panel's tools, from the workspace's reusable client layers (`@acryldev/workspace/ui`): the live terminal sessions and the PTY, files and
49622
49882
  * git routes its Host half serves (run by this frame's Host, see `../index.ts`). Built once per client activation; the effect that builds it
49623
49883
  * releases the sessions.
49624
49884
  */
@@ -49881,7 +50141,7 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
49881
50141
  // src/client/index.ts
49882
50142
  /**
49883
50143
  * Cordis Client plugin: the Blends frame owns the page's `root` slot and draws the workbench around the app (docs/design/blends-frame-mockup.html).
49884
- * It composes no IDE workbench: the ACRYL IDE keeps its own root owner (`acryl-workspace` through `acryl-app-shell`), and a Blueprint mounts one
50144
+ * It composes no IDE workbench: the ACRYL IDE keeps its own root owner (`@acryldev/workspace` through `@acryldev/app-shell`), and a Blueprint mounts one
49885
50145
  * of the two, never both, since `root` is a single slot.
49886
50146
  */
49887
50147
  const LOCALE_NAMESPACE = "acryl.blendsFrame";
@@ -49902,7 +50162,7 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
49902
50162
  }
49903
50163
  }
49904
50164
  function apply(ctx) {
49905
- const layout = new acryl_app_shell_client.DesktopLayoutState();
50165
+ const layout = new _acryldev_app_shell_client.DesktopLayoutState();
49906
50166
  const canvas = new AppCanvasState();
49907
50167
  const selection = new SelectionStore();
49908
50168
  const frameState = new FrameStateStore();
@@ -49936,7 +50196,7 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
49936
50196
  return active?.kind === "chat" && active.session !== void 0 && active.branch === checkedOut() ? active.session : void 0;
49937
50197
  }
49938
50198
  });
49939
- const versionsApi = (0, acryl_versions_client.createVersionsApi)();
50199
+ const versionsApi = (0, _acryldev_versions_client.createVersionsApi)();
49940
50200
  const sharedVersionsApi = createSharedVersionsApi();
49941
50201
  const branchesApi = createBranchesApi();
49942
50202
  const gitSyncApi = createGitSyncApi();
@@ -49987,15 +50247,15 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
49987
50247
  return draftInChat(ctx, current.id, feedbackTask(note));
49988
50248
  }
49989
50249
  };
49990
- ctx.effect(() => (0, acryl_app_shell_client.provideDesktopLayout)(ctx, layout), "acryl-blends-frame: layout service");
49991
- ctx.effect(() => ctx.slots.provideRoot({ hooks: { panelInfo: layout.panelInfo } }), "acryl-blends-frame: panel info");
50250
+ ctx.effect(() => (0, _acryldev_app_shell_client.provideDesktopLayout)(ctx, layout), "@acryldev/blends-frame: layout service");
50251
+ ctx.effect(() => ctx.slots.provideRoot({ hooks: { panelInfo: layout.panelInfo } }), "@acryldev/blends-frame: panel info");
49992
50252
  ctx.effect(() => {
49993
50253
  const dispose = ctx.reflect.provide("appCanvas", canvas);
49994
50254
  return () => {
49995
50255
  dispose();
49996
50256
  };
49997
- }, "acryl-blends-frame: the canvas service");
49998
- ctx.effect(() => installFrameView(canvas, view), "acryl-blends-frame: the app page view");
50257
+ }, "@acryldev/blends-frame: the canvas service");
50258
+ ctx.effect(() => installFrameView(canvas, view), "@acryldev/blends-frame: the app page view");
49999
50259
  let sidebarRight;
50000
50260
  const sidebarOpens = /* @__PURE__ */ new Set();
50001
50261
  ctx.inject(["sidebarRight"], (child) => {
@@ -50008,7 +50268,7 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50008
50268
  stop();
50009
50269
  sidebarRight = void 0;
50010
50270
  };
50011
- }, "acryl-blends-frame: the right sidebar");
50271
+ }, "@acryldev/blends-frame: the right sidebar");
50012
50272
  });
50013
50273
  const sidebar = {
50014
50274
  close: () => {
@@ -50025,12 +50285,12 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50025
50285
  }
50026
50286
  };
50027
50287
  ctx.effect(() => {
50028
- const stripped = (0, acryl_app_shell_client.stripLaunchToken)(window.location.href);
50288
+ const stripped = (0, _acryldev_app_shell_client.stripLaunchToken)(window.location.href);
50029
50289
  if (stripped !== void 0) window.history.replaceState(window.history.state, "", stripped);
50030
50290
  return () => {};
50031
- }, "acryl-blends-frame: strip the launch token");
50032
- ctx.effect(() => installFrameStyles(), "acryl-blends-frame: styles");
50033
- ctx.effect(() => installXtermStyles(), "acryl-blends-frame: terminal styles");
50291
+ }, "@acryldev/blends-frame: strip the launch token");
50292
+ ctx.effect(() => installFrameStyles(), "@acryldev/blends-frame: styles");
50293
+ ctx.effect(() => installXtermStyles(), "@acryldev/blends-frame: terminal styles");
50034
50294
  ctx.effect(() => {
50035
50295
  const closeTabOf = (terminalId) => {
50036
50296
  const tab = tabOfTerminal(tabs.getSnapshot(), terminalId);
@@ -50048,7 +50308,7 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50048
50308
  offTitle();
50049
50309
  tools.terminals.disposeAll();
50050
50310
  };
50051
- }, "acryl-blends-frame: terminal sessions");
50311
+ }, "@acryldev/blends-frame: terminal sessions");
50052
50312
  ctx.effect(() => {
50053
50313
  const quickOpen = (event) => {
50054
50314
  if (event.key.toLowerCase() !== "p" || !(event.metaKey || event.ctrlKey) || event.shiftKey || event.altKey) return;
@@ -50063,7 +50323,7 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50063
50323
  return () => {
50064
50324
  window.removeEventListener("keydown", quickOpen, true);
50065
50325
  };
50066
- }, "acryl-blends-frame: quick open");
50326
+ }, "@acryldev/blends-frame: quick open");
50067
50327
  ctx.slots.inject("settings.launcher", () => ctx.slots.register({ name: "settings.launcher" }, SettingsLauncher));
50068
50328
  ctx.slots.inject("settings.action", () => ctx.slots.register({
50069
50329
  name: "settings.action",
@@ -50071,7 +50331,7 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50071
50331
  order: 20
50072
50332
  }, SettingsExpand));
50073
50333
  ctx.effect(() => {
50074
- const presenter = new acryl_app_shell_client.DesktopThemePresenter();
50334
+ const presenter = new _acryldev_app_shell_client.DesktopThemePresenter();
50075
50335
  presenter.apply(ctx.theme.getTheme());
50076
50336
  const off = ctx.on("theme/change", (snapshot) => {
50077
50337
  presenter.apply(snapshot);
@@ -50081,10 +50341,10 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50081
50341
  off();
50082
50342
  presenter.dispose();
50083
50343
  };
50084
- }, "acryl-blends-frame: theme presenter");
50344
+ }, "@acryldev/blends-frame: theme presenter");
50085
50345
  ctx.effect(() => {
50086
50346
  const read = () => {
50087
- if (document.visibilityState === "visible") frameState.refresh();
50347
+ if (shouldReadOnTick(document.visibilityState, frameState.getSnapshot().status)) frameState.refresh();
50088
50348
  };
50089
50349
  frameState.refresh();
50090
50350
  const timer = window.setInterval(read, FRAME_STATE_INTERVAL_MS);
@@ -50095,14 +50355,14 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50095
50355
  document.removeEventListener("visibilitychange", read);
50096
50356
  window.removeEventListener("focus", read);
50097
50357
  };
50098
- }, "acryl-blends-frame: read the frame state");
50358
+ }, "@acryldev/blends-frame: read the frame state");
50099
50359
  ctx.effect(() => {
50100
50360
  const controller = new AbortController();
50101
50361
  appReload.run(controller.signal);
50102
50362
  return () => {
50103
50363
  controller.abort();
50104
50364
  };
50105
- }, "acryl-blends-frame: follow the app's code");
50365
+ }, "@acryldev/blends-frame: follow the app's code");
50106
50366
  ctx.effect(() => {
50107
50367
  branchChats.load();
50108
50368
  const reconcile = () => {
@@ -50134,12 +50394,12 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50134
50394
  offChats();
50135
50395
  offPrune();
50136
50396
  };
50137
- }, "acryl-blends-frame: the chat on screen is the checked-out branch's");
50397
+ }, "@acryldev/blends-frame: the chat on screen is the checked-out branch's");
50138
50398
  const agents = new AgentsState(createWorkspaceAgentsApi());
50139
50399
  ctx.effect(() => {
50140
50400
  agents.refresh();
50141
50401
  return () => {};
50142
- }, "acryl-blends-frame: load the agents");
50402
+ }, "@acryldev/blends-frame: load the agents");
50143
50403
  ctx.plugin(settingsSharedPlugin());
50144
50404
  ctx.plugin(agentsSettingsPlugin(agents));
50145
50405
  const appPlugins = createAppPluginsApi();
@@ -50221,13 +50481,15 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50221
50481
  child.effect(() => child.locale.register(LOCALE_NAMESPACE, {
50222
50482
  en: {
50223
50483
  plugins: "Plugins",
50224
- app: "App"
50484
+ app: "App",
50485
+ share: "Share"
50225
50486
  },
50226
50487
  zh: {
50227
50488
  plugins: "插件",
50228
- app: "应用"
50489
+ app: "应用",
50490
+ share: "分享"
50229
50491
  }
50230
- }), "acryl-blends-frame: dictionary");
50492
+ }), "@acryldev/blends-frame: dictionary");
50231
50493
  const t = child.locale.bind(LOCALE_NAMESPACE);
50232
50494
  if (desktop !== void 0) child.slots.inject("settings.section", () => child.slots.register({
50233
50495
  name: "settings.section",
@@ -50237,6 +50499,18 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50237
50499
  locale: LOCALE_NAMESPACE,
50238
50500
  inject: () => ({ app: desktop })
50239
50501
  }, AppSection));
50502
+ const shareApp = createShareAppApi();
50503
+ child.slots.inject("settings.section", () => child.slots.register({
50504
+ name: "settings.section",
50505
+ id: "acryl-blends-share",
50506
+ order: 6,
50507
+ label: () => t("share"),
50508
+ locale: LOCALE_NAMESPACE,
50509
+ inject: () => ({
50510
+ share: shareApp,
50511
+ registry
50512
+ })
50513
+ }, ShareAppSection));
50240
50514
  child.slots.inject("settings.section", () => child.slots.register({
50241
50515
  name: "settings.section",
50242
50516
  id: "acryl-blends-plugins",
@@ -50273,7 +50547,7 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50273
50547
  })
50274
50548
  }, TurnSaveFooter));
50275
50549
  ctx.inject(["sessions"], (child) => {
50276
- child.effect(() => chats.watch(child.sessions), "acryl-blends-frame: chats follow the sessions");
50550
+ child.effect(() => chats.watch(child.sessions), "@acryldev/blends-frame: chats follow the sessions");
50277
50551
  });
50278
50552
  ctx.plugin({
50279
50553
  name: "acryl-blends-frame-element-selection",
@@ -50360,7 +50634,7 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50360
50634
  log: (path) => versionsApi.log(path),
50361
50635
  save: async (path, message) => {
50362
50636
  await snapshot.capture().catch((cause) => {
50363
- console.warn(`acryl-blends-frame: the version was saved without a capture: ${cause instanceof Error ? cause.message : String(cause)}`);
50637
+ console.warn(`@acryldev/blends-frame: the version was saved without a capture: ${cause instanceof Error ? cause.message : String(cause)}`);
50364
50638
  });
50365
50639
  return versionsApi.save(path, message);
50366
50640
  },
@@ -50389,7 +50663,7 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50389
50663
  }
50390
50664
  }
50391
50665
  })
50392
- }, BlendsFrame), "acryl-blends-frame: root slot");
50666
+ }, BlendsFrame), "@acryldev/blends-frame: root slot");
50393
50667
  }
50394
50668
  exports.apply = apply;
50395
50669
  exports.inject = inject;