@brett_lamy/ui 5.10.0 → 5.13.0

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.
Files changed (71) hide show
  1. package/dist/components/avatar.d.ts +4 -1
  2. package/dist/components/avatar.d.ts.map +1 -1
  3. package/dist/components/avatar.js +55 -47
  4. package/dist/components/canvas.d.ts +18 -0
  5. package/dist/components/canvas.d.ts.map +1 -1
  6. package/dist/components/canvas.js +79 -11
  7. package/dist/components/command-menu.js +1 -1
  8. package/dist/components/floating-chat.d.ts +1 -1
  9. package/dist/components/floating-sheet.d.ts +1 -1
  10. package/dist/components/hover-card.d.ts +69 -0
  11. package/dist/components/hover-card.d.ts.map +1 -0
  12. package/dist/components/hover-card.js +164 -0
  13. package/dist/components/list.d.ts +3 -0
  14. package/dist/components/list.d.ts.map +1 -1
  15. package/dist/components/list.js +265 -250
  16. package/dist/components/markdown-view.d.ts +3 -1
  17. package/dist/components/markdown-view.d.ts.map +1 -1
  18. package/dist/components/markdown-view.js +12 -11
  19. package/dist/components/open-code.d.ts +31 -0
  20. package/dist/components/open-code.d.ts.map +1 -0
  21. package/dist/components/open-code.js +253 -0
  22. package/dist/components/replay-preview.d.ts +2 -2
  23. package/dist/components/replay-preview.d.ts.map +1 -1
  24. package/dist/components/replay-preview.js +3 -3
  25. package/dist/components/sql-console.js +1 -1
  26. package/dist/components/tree.d.ts +4 -1
  27. package/dist/components/tree.d.ts.map +1 -1
  28. package/dist/components/tree.js +229 -202
  29. package/dist/components/tui-preview.d.ts +3 -0
  30. package/dist/components/tui-preview.d.ts.map +1 -0
  31. package/dist/components/tui-preview.js +3 -0
  32. package/dist/components/workspace.d.ts +11 -0
  33. package/dist/components/workspace.d.ts.map +1 -0
  34. package/dist/components/workspace.js +74 -0
  35. package/dist/index.css +1 -1
  36. package/dist/index.d.ts +17 -4
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +163 -156
  39. package/dist/lib/canvas-math.d.ts +1 -1
  40. package/dist/lib/canvas-math.d.ts.map +1 -1
  41. package/dist/lib/canvas-math.js +1 -1
  42. package/dist/lib/open-code-browser-agent.d.ts +7 -0
  43. package/dist/lib/open-code-browser-agent.d.ts.map +1 -0
  44. package/dist/lib/open-code-browser-agent.js +161 -0
  45. package/dist/lib/open-code-browser.d.ts +17 -0
  46. package/dist/lib/open-code-browser.d.ts.map +1 -0
  47. package/dist/lib/open-code-browser.js +252 -0
  48. package/dist/lib/open-code-host.d.ts +182 -0
  49. package/dist/lib/open-code-host.d.ts.map +1 -0
  50. package/dist/lib/open-code-host.js +118 -0
  51. package/dist/lib/open-code-keychain.d.ts +11 -0
  52. package/dist/lib/open-code-keychain.d.ts.map +1 -0
  53. package/dist/lib/open-code-keychain.js +19 -0
  54. package/dist/lib/open-code-preview.d.ts +16 -0
  55. package/dist/lib/open-code-preview.d.ts.map +1 -0
  56. package/dist/lib/open-code-preview.js +112 -0
  57. package/dist/lib/tailscale-connect.d.ts.map +1 -1
  58. package/dist/lib/tailscale-connect.js +97 -62
  59. package/dist/lib/tailscale-policy.d.ts +11 -2
  60. package/dist/lib/tailscale-policy.d.ts.map +1 -1
  61. package/dist/lib/tailscale-policy.js +27 -18
  62. package/dist/lib/tailscale-router/bridge.d.ts +7 -2
  63. package/dist/lib/tailscale-router/bridge.d.ts.map +1 -1
  64. package/dist/lib/tailscale-router/bridge.js +64 -57
  65. package/dist/lib/theme.d.ts.map +1 -1
  66. package/dist/lib/theme.js +8 -5
  67. package/dist/opencode.d.ts +7 -0
  68. package/dist/opencode.d.ts.map +1 -0
  69. package/dist/opencode.js +6 -0
  70. package/dist/tailscale-sw.js +237 -12
  71. package/package.json +21 -3
@@ -0,0 +1,161 @@
1
+ //#region src/lib/open-code-browser-agent.ts
2
+ function e(e) {
3
+ let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new WeakMap(), r = Math.floor(Math.random() * 1e9), i, a = (e) => (e ?? "").replace(/\s+/g, " ").trim(), o = (e) => {
4
+ if (e.closest("[hidden], [inert], [aria-hidden=\"true\"]")) return !1;
5
+ let t = getComputedStyle(e);
6
+ return t.display !== "none" && t.visibility !== "hidden";
7
+ }, s = (e) => {
8
+ let n = e.startsWith("@") ? t.get(e.slice(1)) : document.querySelector(e);
9
+ if (!n?.isConnected) throw Error("Element not found. Take a new snapshot after navigation or DOM changes.");
10
+ return n;
11
+ }, c = (e) => {
12
+ let t = e.getAttribute("role");
13
+ if (t) return t;
14
+ let n = e.tagName.toLowerCase();
15
+ if (/^h[1-6]$/.test(n)) return "heading";
16
+ if (n === "a" && e.hasAttribute("href")) return "link";
17
+ if (n === "button" || n === "summary") return "button";
18
+ if (n === "textarea" || e.getAttribute("contenteditable") === "true") return "textbox";
19
+ if (n === "select") return "combobox";
20
+ if (n === "input") {
21
+ let t = e.getAttribute("type") ?? "text";
22
+ return t === "hidden" ? "" : ["checkbox", "radio"].includes(t) ? t : [
23
+ "button",
24
+ "submit",
25
+ "reset"
26
+ ].includes(t) ? "button" : "textbox";
27
+ }
28
+ return n === "img" ? "img" : e.hasAttribute("tabindex") ? "button" : "";
29
+ }, l = (e) => {
30
+ let t = e.getAttribute("aria-labelledby");
31
+ if (t) return a(t.split(/\s+/).map((e) => document.getElementById(e)?.textContent ?? "").join(" "));
32
+ let n = e.getAttribute("aria-label") ?? e.getAttribute("alt");
33
+ if (n) return a(n);
34
+ if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) {
35
+ let t = Array.from(e.labels ?? []).map((e) => e.textContent).join(" ");
36
+ return a(t || e.getAttribute("placeholder") || e.getAttribute("title") || (e instanceof HTMLInputElement && ["submit", "button"].includes(e.type) ? e.value : ""));
37
+ }
38
+ return a(e.textContent || e.getAttribute("title")).slice(0, 300);
39
+ }, u = (e) => {
40
+ let i = typeof e.selector == "string" ? s(e.selector) : document.body, u = [`Page: ${document.title}`, `URL: ${location.href}`], d = 0, f = (i, s) => {
41
+ if (d >= 300 || !o(i) || /^(SCRIPT|STYLE|NOSCRIPT|TEMPLATE)$/.test(i.tagName) || typeof e.depth == "number" && s > e.depth) return;
42
+ let p = c(i), m = [
43
+ "button",
44
+ "link",
45
+ "textbox",
46
+ "checkbox",
47
+ "radio",
48
+ "combobox",
49
+ "switch",
50
+ "tab",
51
+ "menuitem",
52
+ "slider"
53
+ ].includes(p);
54
+ if (p && (e.interactive === !1 || m)) {
55
+ let a = n.get(i);
56
+ a || (a = `e${++r}`, n.set(i, a), t.set(a, i));
57
+ let o = [
58
+ i.hasAttribute("disabled") ? "disabled" : "",
59
+ i.getAttribute("aria-expanded") === "true" ? "expanded" : "",
60
+ i instanceof HTMLInputElement && i.checked ? "checked" : ""
61
+ ].filter(Boolean).join(", ");
62
+ u.push(`${" ".repeat(Math.min(s, 12))}- ${p} ${JSON.stringify(l(i))} [ref=${a}]${o ? ` [${o}]` : ""}${e.includeUrls && i instanceof HTMLAnchorElement ? ` ${i.href}` : ""}`), d++;
63
+ } else e.interactive === !1 && !i.children.length && a(i.textContent) && (u.push(`${" ".repeat(Math.min(s, 12))}- text ${JSON.stringify(a(i.textContent).slice(0, 500))}`), d++);
64
+ for (let e of i.children) f(e, s + 1);
65
+ };
66
+ f(i, 0), d >= 300 && u.push("Snapshot truncated at 300 entries. Scope the next snapshot with selector.");
67
+ for (let [e, n] of t) n.isConnected || t.delete(e);
68
+ return u.join("\n");
69
+ }, d = (e, t) => {
70
+ if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) {
71
+ let n = e instanceof HTMLInputElement ? HTMLInputElement.prototype : HTMLTextAreaElement.prototype;
72
+ Object.getOwnPropertyDescriptor(n, "value")?.set?.call(e, t);
73
+ } else if (e instanceof HTMLElement && e.isContentEditable) e.textContent = t;
74
+ else throw Error("The target is not an editable field.");
75
+ e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 }));
76
+ }, f = async (e, t) => {
77
+ if (e === "agent_browser_snapshot") return u(t);
78
+ if (e === "agent_browser_get_url") return location.href;
79
+ if (e === "agent_browser_get_text") return a(s(String(t.selector)).textContent);
80
+ if (e === "agent_browser_wait_for_selector") {
81
+ let e = t.state ?? "visible", n = Date.now() + Math.min(Number(t.waitTimeoutMs ?? 1e4), 3e4);
82
+ for (;;) {
83
+ let r;
84
+ try {
85
+ r = s(String(t.selector));
86
+ } catch {}
87
+ if (e === "attached" ? r : e === "detached" ? !r : e === "hidden" ? !r || !o(r) : r && o(r)) return `Selector is ${e}.`;
88
+ if (Date.now() >= n) throw Error(`Timed out waiting for selector to be ${e}.`);
89
+ await new Promise((e) => setTimeout(e, 50));
90
+ }
91
+ }
92
+ if (e === "agent_browser_press") {
93
+ let e = String(t.key).split("+"), n = e.pop() ?? "", r = document.activeElement ?? document.body, i = {
94
+ ctrlKey: e.includes("Control"),
95
+ metaKey: e.includes("Meta"),
96
+ altKey: e.includes("Alt"),
97
+ shiftKey: e.includes("Shift"),
98
+ bubbles: !0,
99
+ cancelable: !0,
100
+ key: n
101
+ }, a = !r.dispatchEvent(new KeyboardEvent("keydown", i));
102
+ if (!a && n === "Enter" && (r instanceof HTMLButtonElement || r instanceof HTMLAnchorElement ? r.click() : r instanceof HTMLInputElement ? r.form?.requestSubmit() : r instanceof HTMLTextAreaElement && d(r, r.value + "\n")), !a && n === " " && r instanceof HTMLButtonElement && r.click(), !a && n === "Tab") {
103
+ let e = Array.from(document.querySelectorAll("a[href],button,input,select,textarea,[tabindex]")).filter((e) => o(e) && !e.hasAttribute("disabled") && e.tabIndex >= 0);
104
+ e[(e.indexOf(r) + (i.shiftKey ? -1 : 1) + e.length) % e.length]?.focus();
105
+ }
106
+ return !a && n.toLowerCase() === "a" && (i.ctrlKey || i.metaKey) && (r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement) && r.select(), r.dispatchEvent(new KeyboardEvent("keyup", i)), `Pressed ${t.key}.`;
107
+ }
108
+ let n = s(String(t.selector));
109
+ if (n.hasAttribute("disabled")) throw Error("The target is disabled.");
110
+ if (e === "agent_browser_click") {
111
+ if (!(n instanceof HTMLElement)) throw Error("The target is not an HTML element.");
112
+ return n.focus(), n.click(), "Clicked.";
113
+ }
114
+ if (e === "agent_browser_fill" || e === "agent_browser_type") {
115
+ n instanceof HTMLElement && n.focus();
116
+ let r = n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement ? n.value : n.textContent ?? "";
117
+ return d(n, e === "agent_browser_type" ? r + String(t.text) : String(t.text)), "Field updated.";
118
+ }
119
+ if (e === "agent_browser_select") {
120
+ if (!(n instanceof HTMLSelectElement)) throw Error("The target is not a select.");
121
+ let e = t.values, r = Array.from(n.options).filter((t) => e.includes(t.value) || e.includes(t.label));
122
+ if (!r.length) throw Error("No matching option.");
123
+ for (let e of n.options) e.selected = r.includes(e);
124
+ return n.dispatchEvent(new Event("input", { bubbles: !0 })), n.dispatchEvent(new Event("change", { bubbles: !0 })), "Selection updated.";
125
+ }
126
+ throw Error(`Unsupported iframe tool: ${e}`);
127
+ }, p = (t) => {
128
+ i || t.source !== parent || t.origin !== e.parentOrigin || t.data?.type !== "bl-opencode-browser:connect" || t.data.session !== e.session || !t.ports[0] || (i = t.ports[0], i.onmessage = (e) => {
129
+ let { id: t, tool: n, args: r } = e.data;
130
+ f(n, r).then((e) => i?.postMessage({
131
+ id: t,
132
+ result: e
133
+ }), (e) => i?.postMessage({
134
+ id: t,
135
+ error: e instanceof Error ? e.message : String(e)
136
+ }));
137
+ }, i.start());
138
+ };
139
+ addEventListener("message", p);
140
+ let m = () => {
141
+ removeEventListener("message", p), i?.close();
142
+ };
143
+ addEventListener("pagehide", m, { once: !0 });
144
+ let h = () => parent.postMessage({
145
+ type: "bl-opencode-browser:ready",
146
+ session: e.session,
147
+ url: location.href
148
+ }, e.parentOrigin);
149
+ return document.readyState === "loading" ? addEventListener("DOMContentLoaded", h, { once: !0 }) : h(), m;
150
+ }
151
+ function t(t, n, r) {
152
+ let i = JSON.stringify({
153
+ session: n,
154
+ parentOrigin: r
155
+ }).replaceAll("<", "\\u003c"), a = `<script data-opencode-browser>(${e.toString()})(${i});<\/script>`, o = /<head(?:\s[^>]*)?>/i.exec(t);
156
+ if (o) return t.slice(0, o.index + o[0].length) + a + t.slice(o.index + o[0].length);
157
+ let s = /^\s*<!doctype[^>]*>/i.exec(t)?.[0].length ?? 0;
158
+ return t.slice(0, s) + a + t.slice(s);
159
+ }
160
+ //#endregion
161
+ export { t as injectOpenCodeBrowserAgent, e as installOpenCodeBrowserAgent };
@@ -0,0 +1,17 @@
1
+ import { OpenCodeMcpServer } from './open-code-host';
2
+ export interface OpenCodeBrowser {
3
+ server: OpenCodeMcpServer;
4
+ reset(): void;
5
+ connect(options: {
6
+ frame: HTMLIFrameElement;
7
+ session: string;
8
+ url: string;
9
+ port: number;
10
+ navigate?(path: string): void;
11
+ }): () => void;
12
+ }
13
+ /** One MCP server follows the component's currently selected, isolated app iframe. */
14
+ export declare function createOpenCodeBrowser(settings?: {
15
+ onConnectedChange?(connected: boolean): void;
16
+ }): OpenCodeBrowser;
17
+ //# sourceMappingURL=open-code-browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-code-browser.d.ts","sourceRoot":"","sources":["../../src/lib/open-code-browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAsK9D,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,IAAI,IAAI,CAAC;IACd,OAAO,CAAC,OAAO,EAAE;QACf,KAAK,EAAE,iBAAiB,CAAC;QACzB,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B,GAAG,MAAM,IAAI,CAAC;CAChB;AAED,sFAAsF;AACtF,wBAAgB,qBAAqB,CACnC,QAAQ,GAAE;IAAE,iBAAiB,CAAC,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAAA;CAAO,GAC9D,eAAe,CAqRjB"}
@@ -0,0 +1,252 @@
1
+ //#region src/lib/open-code-browser.ts
2
+ var e = {
3
+ type: "string",
4
+ description: "CSS selector or @ref from the latest snapshot."
5
+ }, t = [
6
+ {
7
+ name: "agent_browser_snapshot",
8
+ description: "Read the live app iframe as a semantic DOM snapshot with @refs. Use interactive:false to include page text. The iframe is already selected.",
9
+ inputSchema: {
10
+ type: "object",
11
+ properties: {
12
+ selector: e,
13
+ interactive: {
14
+ type: "boolean",
15
+ default: !0
16
+ },
17
+ includeUrls: { type: "boolean" },
18
+ depth: {
19
+ type: "integer",
20
+ minimum: 0
21
+ }
22
+ },
23
+ additionalProperties: !1
24
+ }
25
+ },
26
+ {
27
+ name: "agent_browser_click",
28
+ description: "Click a button or link in the app preview using a snapshot @ref or CSS selector.",
29
+ inputSchema: {
30
+ type: "object",
31
+ properties: { selector: e },
32
+ required: ["selector"],
33
+ additionalProperties: !1
34
+ }
35
+ },
36
+ ...["fill", "type"].map((t) => ({
37
+ name: `agent_browser_${t}`,
38
+ description: `${t === "fill" ? "Replace" : "Append to"} an app input value and dispatch input/change events.`,
39
+ inputSchema: {
40
+ type: "object",
41
+ properties: {
42
+ selector: e,
43
+ text: { type: "string" }
44
+ },
45
+ required: ["selector", "text"],
46
+ additionalProperties: !1
47
+ }
48
+ })),
49
+ {
50
+ name: "agent_browser_press",
51
+ description: "Dispatch a key in the focused app field. Enter submits forms, Tab moves focus, and Control+a/Meta+a selects text. Events are synthetic.",
52
+ inputSchema: {
53
+ type: "object",
54
+ properties: { key: { type: "string" } },
55
+ required: ["key"],
56
+ additionalProperties: !1
57
+ }
58
+ },
59
+ {
60
+ name: "agent_browser_select",
61
+ description: "Select app dropdown options by their value or label.",
62
+ inputSchema: {
63
+ type: "object",
64
+ properties: {
65
+ selector: e,
66
+ values: {
67
+ type: "array",
68
+ items: { type: "string" },
69
+ minItems: 1
70
+ }
71
+ },
72
+ required: ["selector", "values"],
73
+ additionalProperties: !1
74
+ }
75
+ },
76
+ {
77
+ name: "agent_browser_wait_for_selector",
78
+ description: "Wait for an element in the app iframe. Take a fresh snapshot after navigation.",
79
+ inputSchema: {
80
+ type: "object",
81
+ properties: {
82
+ selector: e,
83
+ state: {
84
+ type: "string",
85
+ enum: [
86
+ "visible",
87
+ "hidden",
88
+ "attached",
89
+ "detached"
90
+ ]
91
+ },
92
+ waitTimeoutMs: {
93
+ type: "integer",
94
+ minimum: 1,
95
+ maximum: 3e4
96
+ }
97
+ },
98
+ required: ["selector"],
99
+ additionalProperties: !1
100
+ }
101
+ },
102
+ {
103
+ name: "agent_browser_get_text",
104
+ description: "Read text from an app preview element.",
105
+ inputSchema: {
106
+ type: "object",
107
+ properties: { selector: e },
108
+ required: ["selector"],
109
+ additionalProperties: !1
110
+ }
111
+ },
112
+ {
113
+ name: "agent_browser_get_url",
114
+ description: "Get the current app iframe URL.",
115
+ inputSchema: {
116
+ type: "object",
117
+ properties: {},
118
+ additionalProperties: !1
119
+ }
120
+ },
121
+ {
122
+ name: "agent_browser_open",
123
+ description: "Navigate the selected app preview to a relative path or localhost URL on its current port. Other origins and ports are unavailable.",
124
+ inputSchema: {
125
+ type: "object",
126
+ properties: { url: { type: "string" } },
127
+ required: ["url"],
128
+ additionalProperties: !1
129
+ }
130
+ },
131
+ {
132
+ name: "agent_browser_reload",
133
+ description: "Reload the live app through the AlmostNode service worker. Existing snapshot refs expire.",
134
+ inputSchema: {
135
+ type: "object",
136
+ properties: {},
137
+ additionalProperties: !1
138
+ }
139
+ }
140
+ ];
141
+ function n(e, n) {
142
+ let r = t.find((t) => t.name === e);
143
+ if (!r) throw Error("Unknown iframe browser tool: " + e);
144
+ let i = r.inputSchema;
145
+ for (let e of i.required ?? []) if (!(e in n)) throw Error("Missing tool argument: " + e);
146
+ for (let [e, t] of Object.entries(n)) {
147
+ let n = i.properties[e];
148
+ if (!n || (n.type === "integer" ? !Number.isInteger(t) : n.type === "array" ? !Array.isArray(t) || !t.length || t.some((e) => typeof e != "string") : typeof t !== n.type) || n.enum && !n.enum.includes(t)) throw Error("Invalid tool argument: " + e);
149
+ if (typeof t == "number" && (n.minimum !== void 0 && t < n.minimum || n.maximum !== void 0 && t > n.maximum)) throw Error("Tool argument out of range: " + e);
150
+ }
151
+ }
152
+ function r(e = {}) {
153
+ let r = 0, i, a;
154
+ return {
155
+ reset() {
156
+ a = void 0, i?.reject(/* @__PURE__ */ Error("The OpenCode session stopped."));
157
+ },
158
+ server: {
159
+ name: "agent-browser",
160
+ version: "1",
161
+ instructions: "Control the live app preview with these Agent Browser-compatible iframe tools. They operate inside the currently selected AlmostNode app, never the terminal, host page or another browser tab. Start an app server before using them. Snapshot first, use its @refs for actions, and snapshot again to check the result. Refs expire after reload/navigation. Open only relative paths or localhost URLs on the selected port. This DOM adapter uses synthetic events; native CDP, screenshots and arbitrary browser tabs are not supported.",
162
+ tools: t,
163
+ async callTool(e, t, r) {
164
+ if (n(e, t), !a) throw Error("No app preview is open. Start an HTTP server in this workspace, then use the browser tools.");
165
+ let i = await a.call(e, t, r);
166
+ return { content: [{
167
+ type: "text",
168
+ text: typeof i == "string" ? i : JSON.stringify(i)
169
+ }] };
170
+ }
171
+ },
172
+ connect(t) {
173
+ let n = ++r;
174
+ e.onConnectedChange?.(!1);
175
+ let o = new URL(t.url).origin, s = new URL("./__virtual__/" + t.port + "/", t.url), c = s.href, l, u = !1, d = 0, f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set(), m = (e) => {
176
+ for (let t of f.values()) t.reject(Error(e));
177
+ f.clear();
178
+ }, h = (e) => u ? Promise.reject(/* @__PURE__ */ Error("The app preview is closed.")) : e.aborted ? Promise.reject(/* @__PURE__ */ Error("Browser tool cancelled.")) : l ? Promise.resolve() : new Promise((t, n) => {
179
+ let r = (r) => {
180
+ clearTimeout(o), e.removeEventListener("abort", a), p.delete(i), r ? n(r) : t();
181
+ }, i = {
182
+ resolve: () => r(),
183
+ reject: (e) => r(e)
184
+ }, a = () => r(/* @__PURE__ */ Error("Browser tool cancelled.")), o = setTimeout(() => r(/* @__PURE__ */ Error("The app browser bridge did not connect. Reload the preview; check that its HTML allows the injected browser script.")), 15e3);
185
+ p.add(i), e.addEventListener("abort", a, { once: !0 });
186
+ }), g = { async call(e, r, a) {
187
+ if (u) throw Error("The app preview is closed.");
188
+ if (a.aborted) throw Error("Browser tool cancelled.");
189
+ if (e === "agent_browser_open" || e === "agent_browser_reload") {
190
+ let o = e === "agent_browser_reload" ? new URL(c) : new URL(String(r.url), c);
191
+ if ([
192
+ "localhost",
193
+ "127.0.0.1",
194
+ "preview.internal"
195
+ ].includes(o.hostname) && /^https?:$/.test(o.protocol) && Number(o.port || (o.protocol === "https:" ? 443 : 80)) === t.port && (o = new URL(s.pathname + o.pathname.replace(/^\//, "") + o.search + o.hash, s)), e === "agent_browser_open" && String(r.url).startsWith("/") && !String(r.url).startsWith("//") && (o.pathname = s.pathname + new URL(String(r.url), s).pathname.replace(/^\//, "")), o.origin !== s.origin || !o.pathname.startsWith(s.pathname) || o.username || o.password) throw Error("Browser navigation is limited to the selected app port.");
196
+ if (!t.navigate) throw Error("The host must navigate through a fresh AlmostNode worker bootstrap.");
197
+ return i?.reject(/* @__PURE__ */ Error("Another browser navigation started.")), new Promise((e, r) => {
198
+ let c = (t, n) => {
199
+ clearTimeout(u), a.removeEventListener("abort", l), i === d && (i = void 0), t ? r(t) : e("Opened " + n);
200
+ }, l = () => c(/* @__PURE__ */ Error("Browser tool cancelled.")), u = setTimeout(() => c(/* @__PURE__ */ Error("The AlmostNode app did not reconnect after navigation.")), 2e4), d = {
201
+ generation: n,
202
+ port: t.port,
203
+ resolve: (e) => c(void 0, e),
204
+ reject: (e) => c(e)
205
+ };
206
+ i = d, a.addEventListener("abort", l, { once: !0 }), t.navigate?.("/" + o.pathname.slice(s.pathname.length) + o.search + o.hash);
207
+ });
208
+ }
209
+ return await h(a), new Promise((t, n) => {
210
+ let i = ++d, o = (e, r) => {
211
+ clearTimeout(c), a.removeEventListener("abort", s), f.delete(i), e ? n(e) : t(r);
212
+ }, s = () => o(/* @__PURE__ */ Error("Browser tool cancelled.")), c = setTimeout(() => o(/* @__PURE__ */ Error("The app browser tool timed out.")), 35e3);
213
+ f.set(i, {
214
+ resolve: (e) => o(void 0, e),
215
+ reject: (e) => o(e)
216
+ }), a.addEventListener("abort", s, { once: !0 }), l?.postMessage({
217
+ id: i,
218
+ tool: e,
219
+ args: r
220
+ });
221
+ });
222
+ } };
223
+ a = g;
224
+ let _ = (r) => {
225
+ if (u || r.source !== t.frame.contentWindow || r.origin !== o || r.data?.type !== "bl-opencode-browser:ready" || r.data.session !== t.session) return;
226
+ if (typeof r.data.url == "string") {
227
+ let e = new URL(r.data.url);
228
+ if (e.origin !== s.origin || !e.pathname.startsWith(s.pathname)) return;
229
+ c = e.href;
230
+ }
231
+ l?.close(), m("The app document changed. Take a new snapshot.");
232
+ let a = new MessageChannel();
233
+ l = a.port1, l.onmessage = (e) => {
234
+ let t = f.get(e.data?.id);
235
+ t && (typeof e.data.error == "string" ? t.reject(Error(e.data.error)) : t.resolve(e.data.result));
236
+ }, l.start(), t.frame.contentWindow?.postMessage({
237
+ type: "bl-opencode-browser:connect",
238
+ session: t.session
239
+ }, o, [a.port2]);
240
+ for (let e of p) e.resolve();
241
+ p.clear(), e.onConnectedChange?.(!0), i && i.generation < n && (i.port === t.port ? i.resolve(c) : i.reject(/* @__PURE__ */ Error("The selected app changed during navigation.")));
242
+ };
243
+ return window.addEventListener("message", _), () => {
244
+ u = !0, a === g && (a = void 0), e.onConnectedChange?.(!1), window.removeEventListener("message", _), l?.close(), m("The app preview was closed or replaced.");
245
+ for (let e of p) e.reject(/* @__PURE__ */ Error("The app preview was closed or replaced."));
246
+ p.clear();
247
+ };
248
+ }
249
+ };
250
+ }
251
+ //#endregion
252
+ export { r as createOpenCodeBrowser };
@@ -0,0 +1,182 @@
1
+ /** Structural bridge contracts: importing BL UI never loads a Node runtime. */
2
+ export interface OpenCodeWorkspaceStats {
3
+ isFile(): boolean;
4
+ isDirectory(): boolean;
5
+ size: number;
6
+ mtime: Date;
7
+ mtimeMs: number;
8
+ }
9
+ export interface OpenCodeWorkspaceBridge {
10
+ exists(path: string): boolean;
11
+ mkdir(path: string): void;
12
+ readFile(path: string): string | undefined;
13
+ writeFile(path: string, content: string): void;
14
+ readdir(path: string): {
15
+ name: string;
16
+ isDirectory(): boolean;
17
+ isFile(): boolean;
18
+ }[];
19
+ stat(path: string): OpenCodeWorkspaceStats | undefined;
20
+ remove?(path: string, options?: {
21
+ recursive?: boolean;
22
+ }): void;
23
+ rename?(from: string, to: string): void;
24
+ listFiles?(root?: string): string[];
25
+ }
26
+ export interface OpenCodeCommand {
27
+ command: string;
28
+ args: string[];
29
+ cwd?: string;
30
+ env?: Record<string, string>;
31
+ stdin?: string;
32
+ shell?: boolean | string;
33
+ signal?: AbortSignal;
34
+ }
35
+ export interface OpenCodeProcessBridge {
36
+ exec(input: OpenCodeCommand): Promise<{
37
+ stdout: string;
38
+ stderr: string;
39
+ code: number;
40
+ }>;
41
+ }
42
+ /** A host-owned MCP server attached directly to the in-page OpenCode backend. */
43
+ export interface OpenCodeMcpServer {
44
+ name: string;
45
+ version: '1';
46
+ instructions?: string;
47
+ tools: ReadonlyArray<{
48
+ name: string;
49
+ description: string;
50
+ inputSchema: {
51
+ readonly type: 'object';
52
+ readonly [key: string]: unknown;
53
+ };
54
+ }>;
55
+ callTool(name: string, args: Record<string, unknown>, signal: AbortSignal): Promise<{
56
+ content: Array<{
57
+ type: 'text';
58
+ text: string;
59
+ }>;
60
+ isError?: boolean;
61
+ }>;
62
+ }
63
+ export interface OpenCodePort {
64
+ port: number;
65
+ url: string;
66
+ name?: string;
67
+ }
68
+ export interface OpenCodeHostBridge {
69
+ id: string;
70
+ directory: string;
71
+ workspaceBridge: OpenCodeWorkspaceBridge;
72
+ processBridge: OpenCodeProcessBridge;
73
+ /** Additional MCP servers implemented by a trusted host. */
74
+ mcpServers?: ReadonlyArray<OpenCodeMcpServer>;
75
+ previews?: {
76
+ /** Register the host's service worker before opening any preview. Must not reload the page. */
77
+ ready(): Promise<void>;
78
+ list(): OpenCodePort[];
79
+ subscribe(listener: () => void): () => void;
80
+ /** Dispatch HTTP requests from AlmostNode's service worker to this container. */
81
+ fetch(port: number, request: Request): Promise<Response>;
82
+ setTarget?(port: number, target: Window | null): void;
83
+ };
84
+ dispose?(): void;
85
+ }
86
+ /** Both AlmostNode and @agent-wasm/core ContainerInstance satisfy this interface. */
87
+ export interface AlmostNodeOpenCodeContainer {
88
+ id: string;
89
+ vfs: {
90
+ existsSync(path: string): boolean;
91
+ mkdirSync(path: string, options: {
92
+ recursive: boolean;
93
+ }): void;
94
+ readFileSync(path: string, encoding: 'utf8'): string;
95
+ writeFileSync(path: string, content: string): void;
96
+ readdirSync(path: string): string[];
97
+ statSync(path: string): OpenCodeWorkspaceStats;
98
+ renameSync(from: string, to: string): void;
99
+ unlinkSync(path: string): void;
100
+ rmdirSync(path: string): void;
101
+ };
102
+ run(command: string, options?: {
103
+ cwd?: string;
104
+ env?: Record<string, string>;
105
+ signal?: AbortSignal;
106
+ }): Promise<{
107
+ stdout: string;
108
+ stderr: string;
109
+ exitCode: number;
110
+ }>;
111
+ serverBridge: {
112
+ ensureServiceWorkerReady(options: {
113
+ swUrl?: string;
114
+ reloadOnFirstControl: boolean;
115
+ }): Promise<void>;
116
+ getServerPorts(): number[];
117
+ getServerMetadata(port: number): {
118
+ ownerId?: string;
119
+ purpose?: string;
120
+ name?: string;
121
+ } | undefined;
122
+ getServerUrl(port: number): string;
123
+ handleRequest(port: number, method: string, url: string, headers: Record<string, string>, body?: ArrayBuffer): Promise<{
124
+ statusCode: number;
125
+ statusMessage?: string;
126
+ headers: Record<string, string>;
127
+ body: Uint8Array;
128
+ }>;
129
+ on(event: string, listener: (...args: unknown[]) => void): unknown;
130
+ off(event: string, listener: (...args: unknown[]) => void): unknown;
131
+ };
132
+ setHMRTargetForPort?(port: number, target: Window | null): void;
133
+ dispose(): void;
134
+ }
135
+ export interface AlmostNodeOpenCodeOptions {
136
+ directory?: string;
137
+ serviceWorkerUrl?: string;
138
+ /** The adapter otherwise borrows the container. */
139
+ disposeContainer?: boolean;
140
+ }
141
+ /** Connect OpenCode's real tools to an existing runtime's files, shell and HTTP servers. */
142
+ export declare function createAlmostNodeOpenCodeHost(container: AlmostNodeOpenCodeContainer, options?: AlmostNodeOpenCodeOptions): OpenCodeHostBridge;
143
+ export declare const createAgentWasmOpenCodeHost: typeof createAlmostNodeOpenCodeHost;
144
+ /** Opaque records owned by the runtime, encrypted and unlocked by the host. */
145
+ export interface OpenCodeKeychainStore {
146
+ readonly version: 1;
147
+ unlocked(): boolean;
148
+ load(): Promise<unknown>;
149
+ save(entries: unknown): Promise<void>;
150
+ subscribe(listener: () => void): () => void;
151
+ }
152
+ export type OpenCodeCredentialStore = OpenCodeKeychainStore;
153
+ export type OpenCodeConnectionStore = OpenCodeKeychainStore;
154
+ export interface OpenCodeRuntimeSession {
155
+ dispose(): void;
156
+ exited?: Promise<void>;
157
+ }
158
+ export interface OpenCodeRuntime {
159
+ version?: string;
160
+ capabilities?: {
161
+ credentialStore?: 1;
162
+ connectionStore?: 1;
163
+ hostMcp?: number;
164
+ };
165
+ mount(options: {
166
+ container: HTMLElement;
167
+ connectionContainer: HTMLElement;
168
+ directory?: string;
169
+ workspaceBridge?: OpenCodeWorkspaceBridge;
170
+ processBridge?: OpenCodeProcessBridge;
171
+ mcpServers?: ReadonlyArray<OpenCodeMcpServer>;
172
+ themeMode?: 'light' | 'dark';
173
+ credentialStore?: OpenCodeCredentialStore;
174
+ connectionStore?: OpenCodeConnectionStore;
175
+ }): Promise<OpenCodeRuntimeSession>;
176
+ }
177
+ export declare const DEFAULT_OPENCODE_RUNTIME_URL = "https://blamy.github.io/opencode/runtime.js";
178
+ /** Runtime code is an explicit trusted host capability, loaded only after Start. */
179
+ export declare function loadOpenCodeRuntime(url?: string): Promise<OpenCodeRuntime>;
180
+ /** Only preview the service-worker path on this origin, never a host-supplied remote URL. */
181
+ export declare function openCodePreviewUrl(port: OpenCodePort, base: string): string;
182
+ //# sourceMappingURL=open-code-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-code-host.d.ts","sourceRoot":"","sources":["../../src/lib/open-code-host.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,MAAM,WAAW,sBAAsB;IACrC,MAAM,IAAI,OAAO,CAAC;IAClB,WAAW,IAAI,OAAO,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC3C,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,OAAO,CACL,IAAI,EAAE,MAAM,GACX;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,IAAI,OAAO,CAAC;QAAC,MAAM,IAAI,OAAO,CAAA;KAAE,EAAE,CAAC;IACjE,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS,CAAC;IACvD,MAAM,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/D,MAAM,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACrC;A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