@toon-protocol/views 0.2.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 (206) hide show
  1. package/dist/a2ui/A2UIRenderer.d.ts +47 -0
  2. package/dist/a2ui/A2UIRenderer.d.ts.map +1 -0
  3. package/dist/a2ui/A2UIRenderer.js +106 -0
  4. package/dist/a2ui/A2UIRenderer.js.map +1 -0
  5. package/dist/a2ui/binding.d.ts +46 -0
  6. package/dist/a2ui/binding.d.ts.map +1 -0
  7. package/dist/a2ui/binding.js +111 -0
  8. package/dist/a2ui/binding.js.map +1 -0
  9. package/dist/a2ui/index.d.ts +17 -0
  10. package/dist/a2ui/index.d.ts.map +1 -0
  11. package/dist/a2ui/index.js +17 -0
  12. package/dist/a2ui/index.js.map +1 -0
  13. package/dist/a2ui/types.d.ts +101 -0
  14. package/dist/a2ui/types.d.ts.map +1 -0
  15. package/dist/a2ui/types.js +64 -0
  16. package/dist/a2ui/types.js.map +1 -0
  17. package/dist/a2ui/validate.d.ts +55 -0
  18. package/dist/a2ui/validate.d.ts.map +1 -0
  19. package/dist/a2ui/validate.js +117 -0
  20. package/dist/a2ui/validate.js.map +1 -0
  21. package/dist/app/index.html +246 -0
  22. package/dist/app-bridge/ext-apps-bridge.d.ts +16 -0
  23. package/dist/app-bridge/ext-apps-bridge.d.ts.map +1 -0
  24. package/dist/app-bridge/ext-apps-bridge.js +66 -0
  25. package/dist/app-bridge/ext-apps-bridge.js.map +1 -0
  26. package/dist/app-bridge/types.d.ts +41 -0
  27. package/dist/app-bridge/types.d.ts.map +1 -0
  28. package/dist/app-bridge/types.js +10 -0
  29. package/dist/app-bridge/types.js.map +1 -0
  30. package/dist/app-entry.d.ts +13 -0
  31. package/dist/app-entry.d.ts.map +1 -0
  32. package/dist/app-entry.js +45 -0
  33. package/dist/app-entry.js.map +1 -0
  34. package/dist/atoms/defi.d.ts +3 -0
  35. package/dist/atoms/defi.d.ts.map +1 -0
  36. package/dist/atoms/defi.js +80 -0
  37. package/dist/atoms/defi.js.map +1 -0
  38. package/dist/atoms/fallback.d.ts +4 -0
  39. package/dist/atoms/fallback.d.ts.map +1 -0
  40. package/dist/atoms/fallback.js +15 -0
  41. package/dist/atoms/fallback.js.map +1 -0
  42. package/dist/atoms/forge.d.ts +3 -0
  43. package/dist/atoms/forge.d.ts.map +1 -0
  44. package/dist/atoms/forge.js +50 -0
  45. package/dist/atoms/forge.js.map +1 -0
  46. package/dist/atoms/interactive.d.ts +3 -0
  47. package/dist/atoms/interactive.d.ts.map +1 -0
  48. package/dist/atoms/interactive.js +99 -0
  49. package/dist/atoms/interactive.js.map +1 -0
  50. package/dist/atoms/layout.d.ts +3 -0
  51. package/dist/atoms/layout.d.ts.map +1 -0
  52. package/dist/atoms/layout.js +22 -0
  53. package/dist/atoms/layout.js.map +1 -0
  54. package/dist/atoms/media.d.ts +3 -0
  55. package/dist/atoms/media.d.ts.map +1 -0
  56. package/dist/atoms/media.js +92 -0
  57. package/dist/atoms/media.js.map +1 -0
  58. package/dist/atoms/onboard.d.ts +3 -0
  59. package/dist/atoms/onboard.d.ts.map +1 -0
  60. package/dist/atoms/onboard.js +26 -0
  61. package/dist/atoms/onboard.js.map +1 -0
  62. package/dist/atoms/registry.d.ts +35 -0
  63. package/dist/atoms/registry.d.ts.map +1 -0
  64. package/dist/atoms/registry.js +77 -0
  65. package/dist/atoms/registry.js.map +1 -0
  66. package/dist/atoms/social.d.ts +3 -0
  67. package/dist/atoms/social.d.ts.map +1 -0
  68. package/dist/atoms/social.js +52 -0
  69. package/dist/atoms/social.js.map +1 -0
  70. package/dist/atoms/types.d.ts +72 -0
  71. package/dist/atoms/types.d.ts.map +1 -0
  72. package/dist/atoms/types.js +11 -0
  73. package/dist/atoms/types.js.map +1 -0
  74. package/dist/catalog.d.ts +27 -0
  75. package/dist/catalog.d.ts.map +1 -0
  76. package/dist/catalog.js +121 -0
  77. package/dist/catalog.js.map +1 -0
  78. package/dist/components/mono-id.d.ts +16 -0
  79. package/dist/components/mono-id.d.ts.map +1 -0
  80. package/dist/components/mono-id.js +18 -0
  81. package/dist/components/mono-id.js.map +1 -0
  82. package/dist/components/ui/avatar.d.ts +12 -0
  83. package/dist/components/ui/avatar.d.ts.map +1 -0
  84. package/dist/components/ui/avatar.js +25 -0
  85. package/dist/components/ui/avatar.js.map +1 -0
  86. package/dist/components/ui/badge.d.ts +10 -0
  87. package/dist/components/ui/badge.d.ts.map +1 -0
  88. package/dist/components/ui/badge.js +26 -0
  89. package/dist/components/ui/badge.js.map +1 -0
  90. package/dist/components/ui/button.d.ts +11 -0
  91. package/dist/components/ui/button.d.ts.map +1 -0
  92. package/dist/components/ui/button.js +37 -0
  93. package/dist/components/ui/button.js.map +1 -0
  94. package/dist/components/ui/input.d.ts +4 -0
  95. package/dist/components/ui/input.d.ts.map +1 -0
  96. package/dist/components/ui/input.js +8 -0
  97. package/dist/components/ui/input.js.map +1 -0
  98. package/dist/components/ui/separator.d.ts +5 -0
  99. package/dist/components/ui/separator.d.ts.map +1 -0
  100. package/dist/components/ui/separator.js +9 -0
  101. package/dist/components/ui/separator.js.map +1 -0
  102. package/dist/components/ui/textarea.d.ts +4 -0
  103. package/dist/components/ui/textarea.d.ts.map +1 -0
  104. package/dist/components/ui/textarea.js +8 -0
  105. package/dist/components/ui/textarea.js.map +1 -0
  106. package/dist/examples.d.ts +39 -0
  107. package/dist/examples.d.ts.map +1 -0
  108. package/dist/examples.js +168 -0
  109. package/dist/examples.js.map +1 -0
  110. package/dist/filters.d.ts +40 -0
  111. package/dist/filters.d.ts.map +1 -0
  112. package/dist/filters.js +84 -0
  113. package/dist/filters.js.map +1 -0
  114. package/dist/index.d.ts +18 -0
  115. package/dist/index.d.ts.map +1 -0
  116. package/dist/index.js +18 -0
  117. package/dist/index.js.map +1 -0
  118. package/dist/lib/cn.d.ts +4 -0
  119. package/dist/lib/cn.d.ts.map +1 -0
  120. package/dist/lib/cn.js +7 -0
  121. package/dist/lib/cn.js.map +1 -0
  122. package/dist/lib/utils.d.ts +3 -0
  123. package/dist/lib/utils.d.ts.map +1 -0
  124. package/dist/lib/utils.js +6 -0
  125. package/dist/lib/utils.js.map +1 -0
  126. package/dist/main.d.ts +3 -0
  127. package/dist/main.d.ts.map +1 -0
  128. package/dist/main.js +7 -0
  129. package/dist/main.js.map +1 -0
  130. package/dist/mcp-ui/ConsentPrompt.d.ts +41 -0
  131. package/dist/mcp-ui/ConsentPrompt.d.ts.map +1 -0
  132. package/dist/mcp-ui/ConsentPrompt.js +45 -0
  133. package/dist/mcp-ui/ConsentPrompt.js.map +1 -0
  134. package/dist/mcp-ui/SandboxedAppRenderer.d.ts +54 -0
  135. package/dist/mcp-ui/SandboxedAppRenderer.d.ts.map +1 -0
  136. package/dist/mcp-ui/SandboxedAppRenderer.js +74 -0
  137. package/dist/mcp-ui/SandboxedAppRenderer.js.map +1 -0
  138. package/dist/mcp-ui/index.d.ts +18 -0
  139. package/dist/mcp-ui/index.d.ts.map +1 -0
  140. package/dist/mcp-ui/index.js +18 -0
  141. package/dist/mcp-ui/index.js.map +1 -0
  142. package/dist/mcp-ui/sandbox.d.ts +62 -0
  143. package/dist/mcp-ui/sandbox.d.ts.map +1 -0
  144. package/dist/mcp-ui/sandbox.js +78 -0
  145. package/dist/mcp-ui/sandbox.js.map +1 -0
  146. package/dist/parsers/media.d.ts +68 -0
  147. package/dist/parsers/media.d.ts.map +1 -0
  148. package/dist/parsers/media.js +124 -0
  149. package/dist/parsers/media.js.map +1 -0
  150. package/dist/parsers/nip34.d.ts +75 -0
  151. package/dist/parsers/nip34.d.ts.map +1 -0
  152. package/dist/parsers/nip34.js +142 -0
  153. package/dist/parsers/nip34.js.map +1 -0
  154. package/dist/parsers/social.d.ts +89 -0
  155. package/dist/parsers/social.d.ts.map +1 -0
  156. package/dist/parsers/social.js +136 -0
  157. package/dist/parsers/social.js.map +1 -0
  158. package/dist/render/node-shims/node-builtins.d.ts +30 -0
  159. package/dist/render/node-shims/node-builtins.d.ts.map +1 -0
  160. package/dist/render/node-shims/node-builtins.js +38 -0
  161. package/dist/render/node-shims/node-builtins.js.map +1 -0
  162. package/dist/render/resolve.d.ts +72 -0
  163. package/dist/render/resolve.d.ts.map +1 -0
  164. package/dist/render/resolve.js +115 -0
  165. package/dist/render/resolve.js.map +1 -0
  166. package/dist/runtime.d.ts +17 -0
  167. package/dist/runtime.d.ts.map +1 -0
  168. package/dist/runtime.js +218 -0
  169. package/dist/runtime.js.map +1 -0
  170. package/dist/server/apps-server.d.ts +32 -0
  171. package/dist/server/apps-server.d.ts.map +1 -0
  172. package/dist/server/apps-server.js +163 -0
  173. package/dist/server/apps-server.js.map +1 -0
  174. package/dist/server/backend.d.ts +148 -0
  175. package/dist/server/backend.d.ts.map +1 -0
  176. package/dist/server/backend.js +11 -0
  177. package/dist/server/backend.js.map +1 -0
  178. package/dist/server/daemon-backend.d.ts +113 -0
  179. package/dist/server/daemon-backend.d.ts.map +1 -0
  180. package/dist/server/daemon-backend.js +79 -0
  181. package/dist/server/daemon-backend.js.map +1 -0
  182. package/dist/server/daemon-main.d.ts +25 -0
  183. package/dist/server/daemon-main.d.ts.map +1 -0
  184. package/dist/server/daemon-main.js +165 -0
  185. package/dist/server/daemon-main.js.map +1 -0
  186. package/dist/server/fake-backend.d.ts +53 -0
  187. package/dist/server/fake-backend.d.ts.map +1 -0
  188. package/dist/server/fake-backend.js +157 -0
  189. package/dist/server/fake-backend.js.map +1 -0
  190. package/dist/server/fake-main.d.ts +15 -0
  191. package/dist/server/fake-main.d.ts.map +1 -0
  192. package/dist/server/fake-main.js +39 -0
  193. package/dist/server/fake-main.js.map +1 -0
  194. package/dist/spec.d.ts +67 -0
  195. package/dist/spec.d.ts.map +1 -0
  196. package/dist/spec.js +221 -0
  197. package/dist/spec.js.map +1 -0
  198. package/dist/tool-names.d.ts +27 -0
  199. package/dist/tool-names.d.ts.map +1 -0
  200. package/dist/tool-names.js +32 -0
  201. package/dist/tool-names.js.map +1 -0
  202. package/dist/types.d.ts +39 -0
  203. package/dist/types.d.ts.map +1 -0
  204. package/dist/types.js +20 -0
  205. package/dist/types.js.map +1 -0
  206. package/package.json +71 -0
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The real {@link ViewBridge} implementation, wrapping the official
3
+ * `@modelcontextprotocol/ext-apps` `App`. This is the ONLY module that imports
4
+ * the MCP SDK — the runtime and atoms depend solely on the {@link ViewBridge}
5
+ * interface, so swapping transports (or moving to mcp-ui) stays a one-file change.
6
+ *
7
+ * Data-flow grain (per the MCP Apps spec): dynamic data rides tool *results*.
8
+ * The agent-authored ViewSpec arrives as the `toon_render` tool result via the
9
+ * `ui/notifications/tool-result` notification (`App.ontoolresult`); free reads
10
+ * and writes go out via `App.callServerTool`.
11
+ */
12
+ import { type App } from '@modelcontextprotocol/ext-apps';
13
+ import { type ViewBridge } from './types.js';
14
+ /** Wrap a connected ext-apps `App` as a {@link ViewBridge}. */
15
+ export declare function createExtAppsBridge(app: App): ViewBridge;
16
+ //# sourceMappingURL=ext-apps-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ext-apps-bridge.d.ts","sourceRoot":"","sources":["../../src/app-bridge/ext-apps-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAG1D,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAoB/D,+DAA+D;AAC/D,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CA+BxD"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * The real {@link ViewBridge} implementation, wrapping the official
3
+ * `@modelcontextprotocol/ext-apps` `App`. This is the ONLY module that imports
4
+ * the MCP SDK — the runtime and atoms depend solely on the {@link ViewBridge}
5
+ * interface, so swapping transports (or moving to mcp-ui) stays a one-file change.
6
+ *
7
+ * Data-flow grain (per the MCP Apps spec): dynamic data rides tool *results*.
8
+ * The agent-authored ViewSpec arrives as the `toon_render` tool result via the
9
+ * `ui/notifications/tool-result` notification (`App.ontoolresult`); free reads
10
+ * and writes go out via `App.callServerTool`.
11
+ */
12
+ import {} from '@modelcontextprotocol/ext-apps';
13
+ import {} from '../types.js';
14
+ import {} from './types.js';
15
+ function extractEvents(structured) {
16
+ if (typeof structured === 'object' &&
17
+ structured !== null &&
18
+ Array.isArray(structured.events)) {
19
+ return structured.events;
20
+ }
21
+ return undefined;
22
+ }
23
+ function firstText(result) {
24
+ for (const block of result.content ?? []) {
25
+ if (block.type === 'text')
26
+ return block.text;
27
+ }
28
+ return undefined;
29
+ }
30
+ /** Wrap a connected ext-apps `App` as a {@link ViewBridge}. */
31
+ export function createExtAppsBridge(app) {
32
+ return {
33
+ async callTool(name, args) {
34
+ try {
35
+ const result = await app.callServerTool({ name, arguments: args });
36
+ const structured = result.structuredContent;
37
+ const outcome = { ok: result.isError !== true };
38
+ const events = extractEvents(structured);
39
+ if (events)
40
+ outcome.events = events;
41
+ if (structured !== undefined)
42
+ outcome.data = structured;
43
+ if (result.isError === true)
44
+ outcome.error = firstText(result) ?? 'tool error';
45
+ return outcome;
46
+ }
47
+ catch (err) {
48
+ return { ok: false, error: err instanceof Error ? err.message : String(err) };
49
+ }
50
+ },
51
+ notifyModel(text) {
52
+ void app.updateModelContext({ content: [{ type: 'text', text }] });
53
+ },
54
+ onSpec(cb) {
55
+ app.ontoolresult = (params) => {
56
+ const spec = params.structuredContent?.viewSpec;
57
+ if (spec !== undefined)
58
+ cb(spec);
59
+ };
60
+ return () => {
61
+ app.ontoolresult = undefined;
62
+ };
63
+ },
64
+ };
65
+ }
66
+ //# sourceMappingURL=ext-apps-bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ext-apps-bridge.js","sourceRoot":"","sources":["../../src/app-bridge/ext-apps-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAY,MAAM,gCAAgC,CAAC;AAE1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,CAAC;gBAC/E,OAAO,OAAO,CAAC;YACjB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;YAChF,CAAC;QACH,CAAC;QAED,WAAW,CAAC,IAAI;YACd,KAAK,GAAG,CAAC,kBAAkB,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;QACrE,CAAC;QAED,MAAM,CAAC,EAAE;YACP,GAAG,CAAC,YAAY,GAAG,CAAC,MAAsB,EAAE,EAAE;gBAC5C,MAAM,IAAI,GAAI,MAAM,CAAC,iBAAwD,EAAE,QAAQ,CAAC;gBACxF,IAAI,IAAI,KAAK,SAAS;oBAAE,EAAE,CAAC,IAAI,CAAC,CAAC;YACnC,CAAC,CAAC;YACF,OAAO,GAAG,EAAE;gBACV,GAAG,CAAC,YAAY,GAAG,SAAS,CAAC;YAC/B,CAAC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * The ViewBridge seam.
3
+ *
4
+ * The composition runtime depends ONLY on this interface, never on the MCP SDK
5
+ * directly. The real implementation ({@link ./ext-apps-bridge}) wraps the
6
+ * official `@modelcontextprotocol/ext-apps` `App`; tests inject a mock. Swapping
7
+ * to a different transport (or mcp-ui) is a one-file change here.
8
+ */
9
+ import { type NostrEvent } from '../types.js';
10
+ /** Normalized outcome of a server tool call. */
11
+ export interface ToolOutcome {
12
+ ok: boolean;
13
+ /** Events returned by a read tool (`toon_read`), if any. */
14
+ events?: NostrEvent[];
15
+ /** Arbitrary structured payload (e.g. a publish response). */
16
+ data?: unknown;
17
+ /** Error text when `ok` is false. */
18
+ error?: string;
19
+ }
20
+ export interface ViewBridge {
21
+ /**
22
+ * Invoke a server tool over the host bridge. Reads (`toon_read`) are free;
23
+ * writes (`toon_publish_unsigned`, `toon_upload_media`) are gated host-side
24
+ * (server-raised elicitation for spendy actions).
25
+ */
26
+ callTool(name: string, args: Record<string, unknown>): Promise<ToolOutcome>;
27
+ /** Feed a short note about what the user did back into the model's context. */
28
+ notifyModel(text: string): void;
29
+ /**
30
+ * Subscribe to incoming ViewSpecs (delivered as the `toon_render` tool
31
+ * result). Returns an unsubscribe fn.
32
+ */
33
+ onSpec(cb: (spec: unknown) => void): () => void;
34
+ /**
35
+ * Optional async confirmation gate for spendy actions. Return `true` to
36
+ * proceed, `false` to abort. Defaults to `window.confirm` in browser runtimes.
37
+ * Inject a custom function in tests to avoid real modal dialogs.
38
+ */
39
+ confirm?: (message: string) => Promise<boolean>;
40
+ }
41
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/app-bridge/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,gDAAgD;AAChD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,4DAA4D;IAC5D,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5E,+EAA+E;IAC/E,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;OAGG;IACH,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAChD;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACjD"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The ViewBridge seam.
3
+ *
4
+ * The composition runtime depends ONLY on this interface, never on the MCP SDK
5
+ * directly. The real implementation ({@link ./ext-apps-bridge}) wraps the
6
+ * official `@modelcontextprotocol/ext-apps` `App`; tests inject a mock. Swapping
7
+ * to a different transport (or mcp-ui) is a one-file change here.
8
+ */
9
+ import {} from '../types.js';
10
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/app-bridge/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAmB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Iframe entry for the MCP-app bundle.
3
+ *
4
+ * Connects the official ext-apps `App` (via the `useApp` hook), wraps it as a
5
+ * {@link ViewBridge}, and renders whatever ViewSpec the agent delivers through
6
+ * the `toon_render` tool result. This is the runtime root the `ui://toon/app`
7
+ * resource boots; it is compiled into the bundle, not unit-tested here.
8
+ */
9
+ import { type ReactNode } from 'react';
10
+ export declare function ToonApp(): ReactNode;
11
+ /** Mount the app into a host element (called by the bundle's HTML shell). */
12
+ export declare function mount(el: HTMLElement): void;
13
+ //# sourceMappingURL=app-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-entry.d.ts","sourceRoot":"","sources":["../src/app-entry.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAqBrE,wBAAgB,OAAO,IAAI,SAAS,CAgBnC;AAED,6EAA6E;AAC7E,wBAAgB,KAAK,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CAE3C"}
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Iframe entry for the MCP-app bundle.
4
+ *
5
+ * Connects the official ext-apps `App` (via the `useApp` hook), wraps it as a
6
+ * {@link ViewBridge}, and renders whatever ViewSpec the agent delivers through
7
+ * the `toon_render` tool result. This is the runtime root the `ui://toon/app`
8
+ * resource boots; it is compiled into the bundle, not unit-tested here.
9
+ */
10
+ import { useEffect, useMemo, useState } from 'react';
11
+ import { createRoot } from 'react-dom/client';
12
+ import { useApp, useHostStyleVariables, useHostFonts, } from '@modelcontextprotocol/ext-apps/react';
13
+ import { createExtAppsBridge } from './app-bridge/ext-apps-bridge.js';
14
+ import {} from './app-bridge/types.js';
15
+ import { ViewSpecRenderer } from './runtime.js';
16
+ function ViewHost({ bridge }) {
17
+ const [spec, setSpec] = useState(null);
18
+ useEffect(() => bridge.onSpec(setSpec), [bridge]);
19
+ if (spec == null) {
20
+ return _jsx("div", { className: "p-4 text-sm text-muted-foreground", children: "Waiting for a view\u2026" });
21
+ }
22
+ return _jsx(ViewSpecRenderer, { spec: spec, bridge: bridge });
23
+ }
24
+ export function ToonApp() {
25
+ const { app, isConnected, error } = useApp({
26
+ appInfo: { name: 'toon-views', version: '0.1.0' },
27
+ capabilities: {},
28
+ });
29
+ // Adopt the host's theme variables + fonts so the UI matches the surrounding
30
+ // chat; our globals.css provides the fallback when there's no host context.
31
+ useHostStyleVariables(app);
32
+ useHostFonts(app);
33
+ const bridge = useMemo(() => (app ? createExtAppsBridge(app) : null), [app]);
34
+ if (error)
35
+ return _jsxs("div", { className: "p-4 text-sm", children: ["Failed to connect: ", error.message] });
36
+ if (!isConnected || !bridge) {
37
+ return _jsx("div", { className: "p-4 text-sm text-muted-foreground", children: "Connecting\u2026" });
38
+ }
39
+ return _jsx(ViewHost, { bridge: bridge });
40
+ }
41
+ /** Mount the app into a host element (called by the bundle's HTML shell). */
42
+ export function mount(el) {
43
+ createRoot(el).render(_jsx(ToonApp, {}));
44
+ }
45
+ //# sourceMappingURL=app-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-entry.js","sourceRoot":"","sources":["../src/app-entry.tsx"],"names":[],"mappings":";AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,MAAM,EACN,qBAAqB,EACrB,YAAY,GACb,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,SAAS,QAAQ,CAAC,EAAE,MAAM,EAA0B;IAClD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAU,IAAI,CAAC,CAAC;IAChD,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAElD,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,OAAO,cAAK,SAAS,EAAC,mCAAmC,yCAA0B,CAAC;IACtF,CAAC;IACD,OAAO,KAAC,gBAAgB,IAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAI,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QACzC,OAAO,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE;QACjD,YAAY,EAAE,EAAE;KACjB,CAAC,CAAC;IACH,6EAA6E;IAC7E,4EAA4E;IAC5E,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC3B,YAAY,CAAC,GAAG,CAAC,CAAC;IAClB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAE7E,IAAI,KAAK;QAAE,OAAO,eAAK,SAAS,EAAC,aAAa,oCAAqB,KAAK,CAAC,OAAO,IAAO,CAAC;IACxF,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,EAAE,CAAC;QAC5B,OAAO,cAAK,SAAS,EAAC,mCAAmC,iCAAkB,CAAC;IAC9E,CAAC;IACD,OAAO,KAAC,QAAQ,IAAC,MAAM,EAAE,MAAM,GAAI,CAAC;AACtC,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,KAAK,CAAC,EAAe;IACnC,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,KAAC,OAAO,KAAG,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Atom } from './types.js';
2
+ export declare const defiAtoms: Atom[];
3
+ //# sourceMappingURL=defi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defi.d.ts","sourceRoot":"","sources":["../../src/atoms/defi.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,IAAI,EAAwB,MAAM,YAAY,CAAC;AAyN7D,eAAO,MAAM,SAAS,EAAE,IAAI,EAI3B,CAAC"}
@@ -0,0 +1,80 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * DeFi atoms — payment channels, swaps, settlement receipts.
4
+ *
5
+ * No key material or signing lives in the iframe: actions only call the tool
6
+ * (the daemon signs the source-asset claim and returns the target-chain claim).
7
+ */
8
+ import { useState } from 'react';
9
+ import { Button } from '@/components/ui/button.js';
10
+ import { Input } from '@/components/ui/input.js';
11
+ import { Badge } from '@/components/ui/badge.js';
12
+ import { MonoId } from '@/components/mono-id.js';
13
+ import {} from './types.js';
14
+ import { OPEN_CHANNEL_TOOL, SWAP_TOOL } from '../tool-names.js';
15
+ const ChannelCard = ({ props, actions }) => {
16
+ const channels = Array.isArray(props['channels'])
17
+ ? props['channels']
18
+ : [];
19
+ const destination = typeof props['destination'] === 'string' ? props['destination'] : undefined;
20
+ const [busy, setBusy] = useState(false);
21
+ const [opened, setOpened] = useState(null);
22
+ const open = async () => {
23
+ if (!actions['open'])
24
+ return;
25
+ setBusy(true);
26
+ try {
27
+ const args = destination ? { destination } : {};
28
+ const outcome = await actions['open'](args);
29
+ setOpened(outcome?.ok === false ? null : 'opened');
30
+ }
31
+ finally {
32
+ setBusy(false);
33
+ }
34
+ };
35
+ return (_jsxs("div", { className: "rounded-lg border border-border bg-card p-4", children: [_jsxs("div", { className: "mb-3 flex items-center justify-between", children: [_jsx("span", { className: "text-sm font-semibold", children: "Payment channels" }), channels.length > 0 && (_jsx(Badge, { variant: "secondary", children: channels.length }))] }), channels.length === 0 ? (_jsx("p", { className: "text-xs text-muted-foreground", children: "No channels open yet." })) : (_jsx("ul", { className: "mb-3 flex flex-col gap-2", children: channels.map((c, i) => (_jsxs("li", { className: "flex items-baseline justify-between border-l-2 border-border pl-2", children: [_jsx(MonoId, { value: c.channelId ?? '—' }), _jsxs("span", { className: "text-xs text-muted-foreground", children: ["nonce ", _jsx("span", { className: "font-medium text-foreground", children: c.nonce ?? 0 }), ' · ', c.cumulativeAmount ?? '0'] })] }, c.channelId ?? i))) })), actions['open'] ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { variant: "outline", size: "sm", disabled: busy, onClick: () => void open(), children: busy ? 'Opening…' : 'Open channel' }), opened ? (_jsx("span", { className: "text-xs text-muted-foreground", children: "Channel opened." })) : null] })) : null] }));
36
+ };
37
+ const SwapForm = ({ props, actions }) => {
38
+ const label = typeof props['label'] === 'string' ? props['label'] : 'Swap';
39
+ const pair = props['pair'] && typeof props['pair'] === 'object'
40
+ ? props['pair']
41
+ : undefined;
42
+ const [amount, setAmount] = useState('');
43
+ const [busy, setBusy] = useState(false);
44
+ const [done, setDone] = useState(null);
45
+ const submit = async () => {
46
+ const value = amount.trim();
47
+ if (!value || !actions['swap'])
48
+ return;
49
+ setBusy(true);
50
+ setDone(null);
51
+ try {
52
+ const outcome = await actions['swap']({ amount: value });
53
+ const failed = outcome?.ok === false;
54
+ setDone(failed ? 'fail' : 'ok');
55
+ if (!failed)
56
+ setAmount('');
57
+ }
58
+ finally {
59
+ setBusy(false);
60
+ }
61
+ };
62
+ return (_jsxs("div", { className: "rounded-lg border-l-2 border-ring bg-card p-4", children: [_jsx("div", { className: "mb-3", children: pair?.from?.assetCode && pair?.to?.assetCode ? (_jsxs("div", { className: "flex items-baseline gap-2", children: [_jsxs("span", { className: "font-semibold", children: [pair.from.assetCode, _jsx("span", { className: "mx-1.5 text-muted-foreground", children: "\u2192" }), pair.to.assetCode] }), pair.rate ? (_jsxs("span", { className: "text-xs text-muted-foreground", children: ["@ ", pair.rate] })) : null] })) : (_jsx("span", { className: "font-semibold", children: "Swap" })) }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Input, { type: "text", inputMode: "decimal", value: amount, onChange: (e) => setAmount(e.target.value), placeholder: "Amount (source micro-units)" }), _jsxs(Button, { disabled: busy || !amount.trim() || !actions['swap'], onClick: () => void submit(), className: "shrink-0", children: [busy ? 'Swapping…' : label, _jsx("span", { className: "ml-1 text-[10px] opacity-70", children: "(pays)" })] })] }), done === 'ok' ? (_jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: "Swap submitted." })) : null, done === 'fail' ? (_jsx("p", { className: "mt-2 text-xs text-destructive", children: "Swap failed \u2014 try again." })) : null] }));
63
+ };
64
+ const SettlementReceipt = ({ props }) => {
65
+ const receipt = props['receipt'] && typeof props['receipt'] === 'object'
66
+ ? props['receipt']
67
+ : undefined;
68
+ if (!receipt) {
69
+ return (_jsx("div", { className: "rounded-lg border border-dashed border-border p-4 text-sm text-muted-foreground", children: "No settlement yet \u2014 run a swap to see its receipt." }));
70
+ }
71
+ const claims = receipt.claims ?? [];
72
+ const succeeded = receipt.accepted !== false && receipt.state !== 'failed';
73
+ return (_jsxs("div", { className: "rounded-lg border border-border bg-card p-4", children: [_jsxs("div", { className: "mb-3 flex items-baseline justify-between", children: [_jsx("span", { className: "font-semibold text-sm", children: "Settlement receipt" }), _jsx(Badge, { variant: succeeded ? 'secondary' : 'destructive', children: receipt.state ?? (succeeded ? 'completed' : 'failed') })] }), _jsxs("div", { className: "mb-2 font-mono text-sm", children: [receipt.cumulativeSource ?? '0', _jsx("span", { className: "mx-1.5 text-muted-foreground", children: "\u2192" }), receipt.cumulativeTarget ?? '0', _jsxs("span", { className: "ml-2 text-xs text-muted-foreground", children: ["(", receipt.packetsAccepted ?? claims.length, " packet", claims.length !== 1 ? 's' : '', ")"] })] }), claims.length > 0 ? (_jsx("ul", { className: "flex flex-col gap-1.5 border-t border-border pt-2", children: claims.map((c, i) => (_jsxs("li", { className: "grid grid-cols-[auto_1fr] gap-x-3 text-xs", children: [_jsx("span", { className: "text-muted-foreground", children: "target" }), _jsxs("span", { children: [c.targetAmount ?? '0', " on ", _jsx(MonoId, { value: c.channelId ?? '—' })] }), _jsx("span", { className: "text-muted-foreground", children: "claim" }), _jsxs("span", { children: [_jsx(MonoId, { value: c.claimId ?? '—' }), " \u00B7 nonce ", c.nonce ?? '0'] })] }, c.claimId ?? i))) })) : null] }));
74
+ };
75
+ export const defiAtoms = [
76
+ { id: 'channel-card', kinds: [], writes: [{ name: OPEN_CHANNEL_TOOL }], Component: ChannelCard },
77
+ { id: 'swap-form', writes: [{ name: SWAP_TOOL, spendy: true }], Component: SwapForm },
78
+ { id: 'settlement-receipt', Component: SettlementReceipt },
79
+ ];
80
+ //# sourceMappingURL=defi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defi.js","sourceRoot":"","sources":["../../src/atoms/defi.tsx"],"names":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E,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE;IACrF,EAAE,EAAE,EAAE,oBAAoB,EAAE,SAAS,EAAE,iBAAiB,EAAE;CAC3D,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type Atom } from './types.js';
2
+ export declare const GENERIC_ATOM_ID = "generic-event";
3
+ export declare const fallbackAtom: Atom;
4
+ //# sourceMappingURL=fallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fallback.d.ts","sourceRoot":"","sources":["../../src/atoms/fallback.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,IAAI,EAAwB,MAAM,YAAY,CAAC;AAE7D,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAiC/C,eAAO,MAAM,YAAY,EAAE,IAAuD,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Fallback atom — renders any event the registry has no bespoke atom for as
4
+ * decoded JSON + raw tags. Guarantees non-zero coverage for every kind.
5
+ */
6
+ import {} from 'react';
7
+ import { MonoId } from '@/components/mono-id.js';
8
+ import {} from './types.js';
9
+ export const GENERIC_ATOM_ID = 'generic-event';
10
+ const GenericEvent = ({ events, props }) => {
11
+ const message = typeof props['message'] === 'string' ? props['message'] : undefined;
12
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [message ? (_jsx("p", { className: "text-sm text-muted-foreground", children: message })) : null, events.map((evt) => (_jsxs("div", { className: "rounded-md border border-border bg-muted/30 p-3 font-mono text-xs", children: [_jsxs("div", { className: "mb-2 flex items-center gap-2 text-muted-foreground", children: [_jsxs("span", { children: ["kind ", evt.kind] }), _jsx("span", { children: "\u00B7" }), _jsx(MonoId, { value: evt.id })] }), evt.content ? (_jsx("pre", { className: "whitespace-pre-wrap break-words text-foreground", children: evt.content })) : null, evt.tags.length > 0 ? (_jsx("pre", { className: "mt-1.5 whitespace-pre-wrap break-words text-muted-foreground", children: JSON.stringify(evt.tags, null, 2) })) : null] }, evt.id)))] }));
13
+ };
14
+ export const fallbackAtom = { id: GENERIC_ATOM_ID, Component: GenericEvent };
15
+ //# sourceMappingURL=fallback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fallback.js","sourceRoot":"","sources":["../../src/atoms/fallback.tsx"],"names":[],"mappings":";AAAA;;;GAGG;AACH,OAAO,EAAW,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAmC,MAAM,YAAY,CAAC;AAE7D,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;AAE/C,MAAM,YAAY,GAAwB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;IAC9D,MAAM,OAAO,GAAG,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpF,OAAO,CACL,eAAK,SAAS,EAAC,qBAAqB,aACjC,OAAO,CAAC,CAAC,CAAC,CACT,YAAG,SAAS,EAAC,+BAA+B,YAAE,OAAO,GAAK,CAC3D,CAAC,CAAC,CAAC,IAAI,EACP,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACnB,eAEE,SAAS,EAAC,mEAAmE,aAE7E,eAAK,SAAS,EAAC,oDAAoD,aACjE,oCAAY,GAAG,CAAC,IAAI,IAAQ,EAC5B,oCAAc,EACd,KAAC,MAAM,IAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAI,IACrB,EACL,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CACb,cAAK,SAAS,EAAC,iDAAiD,YAAE,GAAG,CAAC,OAAO,GAAO,CACrF,CAAC,CAAC,CAAC,IAAI,EACP,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CACrB,cAAK,SAAS,EAAC,8DAA8D,YAC1E,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,GAC9B,CACP,CAAC,CAAC,CAAC,IAAI,KAfH,GAAG,CAAC,EAAE,CAgBP,CACP,CAAC,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAS,EAAE,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Atom } from './types.js';
2
+ export declare const forgeAtoms: Atom[];
3
+ //# sourceMappingURL=forge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forge.d.ts","sourceRoot":"","sources":["../../src/atoms/forge.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,IAAI,EAAwB,MAAM,YAAY,CAAC;AA+F7D,eAAO,MAAM,UAAU,EAAE,IAAI,EAe5B,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /** Forge atoms — NIP-34 repo, issue, PR, comment thread (read). */
3
+ import {} from 'react';
4
+ import { Badge } from '@/components/ui/badge.js';
5
+ import { Button } from '@/components/ui/button.js';
6
+ import { MonoId } from '@/components/mono-id.js';
7
+ import { parseRepoAnnouncement, parseIssue, parsePR, parseComment, } from '../parsers/nip34.js';
8
+ import {} from './types.js';
9
+ const RepoCard = ({ events }) => {
10
+ const repo = events.map(parseRepoAnnouncement).find((r) => r !== null) ?? null;
11
+ if (!repo)
12
+ return null;
13
+ return (_jsxs("div", { className: "rounded-lg border border-border bg-card p-4", children: [_jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [_jsx("span", { className: "font-semibold", children: repo.name }), _jsx(Badge, { variant: "secondary", className: "shrink-0 font-mono text-[10px]", children: repo.defaultBranch })] }), repo.description ? (_jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: repo.description })) : null] }));
14
+ };
15
+ const IssueCard = ({ events, actions }) => {
16
+ const issue = events.map(parseIssue).find((i) => i !== null) ?? null;
17
+ if (!issue)
18
+ return null;
19
+ return (_jsxs("div", { className: "flex flex-col gap-1.5 border-b border-border py-3 first:pt-0 last:border-0 last:pb-0", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [_jsx("span", { className: "font-medium text-sm", children: issue.title }), issue.labels.map((l) => (_jsx(Badge, { variant: "secondary", className: "text-[10px]", children: l }, l)))] }), issue.content ? (_jsx("p", { className: "line-clamp-2 text-sm text-muted-foreground", children: issue.content })) : null, actions['comment'] ? (_jsx(Button, { variant: "ghost", size: "sm", className: "self-start h-6 px-0 text-xs text-muted-foreground hover:text-foreground", onClick: () => void actions['comment']?.({ parentId: issue.eventId }), children: "Comment" })) : null] }));
20
+ };
21
+ const PRCard = ({ events }) => {
22
+ const pr = events.map(parsePR).find((p) => p !== null) ?? null;
23
+ if (!pr)
24
+ return null;
25
+ return (_jsxs("div", { className: "flex flex-col gap-1.5 border-b border-border py-3 first:pt-0 last:border-0 last:pb-0", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Badge, { variant: pr.status === 'open' ? 'default' : 'secondary', className: "uppercase text-[10px]", children: pr.status }), _jsx("span", { className: "font-medium text-sm", children: pr.title || '(untitled patch)' })] }), _jsxs("div", { className: "text-xs text-muted-foreground", children: [pr.commitShas.length, " commit", pr.commitShas.length !== 1 ? 's' : '', " \u2192 ", pr.baseBranch] })] }));
26
+ };
27
+ const CommentThread = ({ events, actions }) => {
28
+ const comments = events
29
+ .map(parseComment)
30
+ .filter((c) => c !== null)
31
+ .sort((a, b) => a.createdAt - b.createdAt);
32
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [comments.map((c) => (_jsxs("div", { className: "rounded-md border border-border bg-card p-3", children: [_jsx("div", { className: "mb-1.5", children: _jsx(MonoId, { value: c.authorPubkey, className: "text-muted-foreground" }) }), _jsx("p", { className: "whitespace-pre-wrap break-words text-sm leading-relaxed", children: c.content })] }, c.eventId))), actions['comment'] ? (_jsx(Button, { variant: "ghost", size: "sm", className: "self-start h-6 px-0 text-xs text-muted-foreground hover:text-foreground", onClick: () => void actions['comment']?.(), children: "Add comment" })) : null] }));
33
+ };
34
+ export const forgeAtoms = [
35
+ { id: 'repo-card', kinds: [30617], Component: RepoCard },
36
+ {
37
+ id: 'issue-card',
38
+ kinds: [1621],
39
+ writes: [{ name: 'toon_publish_unsigned' }],
40
+ Component: IssueCard,
41
+ },
42
+ { id: 'pr-card', kinds: [1617], Component: PRCard },
43
+ {
44
+ id: 'comment-thread',
45
+ kinds: [1622],
46
+ writes: [{ name: 'toon_publish_unsigned' }],
47
+ Component: CommentThread,
48
+ },
49
+ ];
50
+ //# sourceMappingURL=forge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forge.js","sourceRoot":"","sources":["../../src/atoms/forge.tsx"],"names":[],"mappings":";AAAA,mEAAmE;AACnE,OAAO,EAAW,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,OAAO,EACP,YAAY,GAEb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAmC,MAAM,YAAY,CAAC;AAE7D,MAAM,QAAQ,GAAwB,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;IACnD,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC;IAC/E,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,OAAO,CACL,eAAK,SAAS,EAAC,6CAA6C,aAC1D,e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AAE,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC;QAC3C,SAAS,EAAE,aAAa;KACzB;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Atom } from './types.js';
2
+ export declare const interactiveAtoms: Atom[];
3
+ //# sourceMappingURL=interactive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../../src/atoms/interactive.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,IAAI,EAAyC,MAAM,YAAY,CAAC;AAmM9E,eAAO,MAAM,gBAAgB,EAAE,IAAI,EAIlC,CAAC"}
@@ -0,0 +1,99 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /** Interactive atoms that hold local UI state (composer, tabs, pay-confirm). */
3
+ import { Children, useEffect, useState } from 'react';
4
+ import { Button } from '@/components/ui/button.js';
5
+ import { Textarea } from '@/components/ui/textarea.js';
6
+ import { MonoId } from '@/components/mono-id.js';
7
+ import {} from './types.js';
8
+ const Composer = ({ props, actions }) => {
9
+ const [text, setText] = useState('');
10
+ const placeholder = typeof props['placeholder'] === 'string' ? props['placeholder'] : "What's happening?";
11
+ const label = typeof props['label'] === 'string' ? props['label'] : 'Post';
12
+ const submit = () => {
13
+ const value = text.trim();
14
+ if (!value || !actions['post'])
15
+ return;
16
+ void actions['post']({ content: value });
17
+ setText('');
18
+ };
19
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Textarea, { value: text, onChange: (e) => setText(e.target.value), placeholder: placeholder, rows: 3 }), _jsx("div", { className: "flex justify-end", children: _jsx(Button, { size: "sm", disabled: !text.trim() || !actions['post'], onClick: submit, children: label }) })] }));
20
+ };
21
+ const Tabs = ({ props, children }) => {
22
+ const labels = Array.isArray(props['labels'])
23
+ ? props['labels'].map(String)
24
+ : [];
25
+ const panels = Children.toArray(children);
26
+ const [active, setActive] = useState(0);
27
+ return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx("div", { className: "flex gap-0 border-b border-border", children: panels.map((_, i) => (_jsx("button", { type: "button", onClick: () => setActive(i), className: 'px-4 py-2 text-sm font-medium transition-colors ' +
28
+ (i === active
29
+ ? '-mb-px border-b-2 border-primary text-foreground'
30
+ : 'text-muted-foreground hover:text-foreground'), children: labels[i] ?? `Tab ${i + 1}` }, i))) }), _jsx("div", { children: panels[active] ?? null })] }));
31
+ };
32
+ const PayConfirm = ({ props, actions, readStatus }) => {
33
+ const placeholder = typeof props['placeholder'] === 'string' ? props['placeholder'] : "What's happening?";
34
+ const label = typeof props['label'] === 'string' ? props['label'] : 'Pay to post';
35
+ const [text, setText] = useState('');
36
+ const [phase, setPhase] = useState('idle');
37
+ const [status, setStatus] = useState(null);
38
+ const [statusError, setStatusError] = useState(false);
39
+ const [eventId, setEventId] = useState(null);
40
+ const [failed, setFailed] = useState(null);
41
+ useEffect(() => {
42
+ if (phase !== 'confirming' || status || statusError || !readStatus)
43
+ return;
44
+ let cancelled = false;
45
+ void readStatus()
46
+ .then((s) => { if (!cancelled)
47
+ setStatus(s); })
48
+ .catch(() => { if (!cancelled)
49
+ setStatusError(true); });
50
+ return () => { cancelled = true; };
51
+ }, [phase, status, statusError, readStatus]);
52
+ const review = () => {
53
+ if (!text.trim() || !actions['confirm'])
54
+ return;
55
+ setFailed(null);
56
+ setPhase('confirming');
57
+ };
58
+ const cancel = () => setPhase('idle');
59
+ const confirm = async () => {
60
+ const value = text.trim();
61
+ if (!value || !actions['confirm'])
62
+ return;
63
+ setPhase('publishing');
64
+ const outcome = await actions['confirm']({ content: value });
65
+ if (!outcome || outcome.ok === false) {
66
+ setFailed(outcome?.error ?? 'unknown');
67
+ setPhase('confirming');
68
+ return;
69
+ }
70
+ setEventId(outcome.eventId ?? null);
71
+ setPhase('receipt');
72
+ };
73
+ const reset = () => {
74
+ setText('');
75
+ setStatus(null);
76
+ setStatusError(false);
77
+ setEventId(null);
78
+ setFailed(null);
79
+ setPhase('idle');
80
+ };
81
+ const feeLabel = status
82
+ ? `${status.feePerEvent}${status.asset ? ` ${status.asset}` : ''}`
83
+ : statusError ? 'unavailable' : '…';
84
+ const chainLabel = status ? status.settlementChain : statusError ? 'unknown' : '…';
85
+ if (phase === 'receipt') {
86
+ return (_jsxs("div", { className: "rounded-lg border-l-2 border-primary bg-primary/5 p-4", children: [_jsx("div", { className: "mb-1 font-semibold text-primary", children: "Posted \u2014 and paid." }), _jsx("p", { className: "mb-3 text-xs text-muted-foreground", children: "The message is the money." }), _jsxs("dl", { className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-xs", children: [_jsx("dt", { className: "text-muted-foreground", children: "Event" }), _jsx("dd", { children: eventId ? _jsx(MonoId, { value: eventId, prefixLen: 12, suffixLen: 6 }) : '—' }), _jsx("dt", { className: "text-muted-foreground", children: "Fee paid" }), _jsxs("dd", { children: [feeLabel, " on ", chainLabel] })] }), _jsx("div", { className: "mt-3 flex justify-end", children: _jsx(Button, { variant: "outline", size: "sm", onClick: reset, children: "Post another" }) })] }));
87
+ }
88
+ if (phase === 'confirming' || phase === 'publishing') {
89
+ const publishing = phase === 'publishing';
90
+ return (_jsxs("div", { className: "flex flex-col gap-3 rounded-lg border-l-2 border-ring bg-card p-4", children: [_jsx("div", { className: "font-semibold text-sm", children: "Confirm pay-to-write" }), _jsx("blockquote", { className: "whitespace-pre-wrap rounded-md border-l-2 border-primary/40 bg-muted/50 px-3 py-2 text-sm", children: text }), _jsxs("p", { className: "text-xs text-muted-foreground", children: ["Sending this message pays", ' ', _jsx("span", { className: "font-medium text-foreground", children: feeLabel }), " per event, settling on", ' ', _jsx("span", { className: "font-medium text-foreground", children: chainLabel }), ". The message is the money."] }), failed ? (_jsxs("p", { className: "text-xs text-destructive", children: ["Publish failed: ", failed] })) : null, _jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(Button, { variant: "outline", size: "sm", disabled: publishing, onClick: cancel, children: "Cancel" }), _jsx(Button, { size: "sm", disabled: publishing || statusError, onClick: () => void confirm(), children: publishing ? 'Publishing…' : 'Confirm & pay' })] })] }));
91
+ }
92
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Textarea, { value: text, onChange: (e) => setText(e.target.value), placeholder: placeholder, rows: 3 }), _jsx("div", { className: "flex justify-end", children: _jsx(Button, { size: "sm", disabled: !text.trim() || !actions['confirm'], onClick: review, children: label }) })] }));
93
+ };
94
+ export const interactiveAtoms = [
95
+ { id: 'composer', writes: [{ name: 'toon_publish_unsigned' }], Component: Composer },
96
+ { id: 'tabs', Component: Tabs },
97
+ { id: 'pay-confirm', writes: [{ name: 'toon_publish_unsigned' }], Component: PayConfirm },
98
+ ];
99
+ //# sourceMappingURL=interactive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactive.js","sourceRoot":"","sources":["../../src/atoms/interactive.tsx"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAW,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAoD,MAAM,YAAY,CAAC;AAE9E,MAAM,QAAQ,GAAwB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE;IAC3D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACrC,MAAM,WAAW,GACf,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC;IACxF,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC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AI,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,OAAO,EAAE,YACjF,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,eAAe,GACtC,IACL,IACF,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,eAAK,SAAS,EAAC,qBAAqB,aAClC,KAAC,QAAQ,IACP,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACxC,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,CAAC,GACP,EACF,cAAK,SAAS,EAAC,kBAAkB,YAC/B,KAAC,MAAM,IACL,IAAI,EAAC,IAAI,EACT,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAC7C,OAAO,EAAE,MAAM,YAEd,KAAK,GACC,GACL,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAW;IACtC,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE;IACpF,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE;IAC/B,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE;CAC1F,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Atom } from './types.js';
2
+ export declare const layoutAtoms: Atom[];
3
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/atoms/layout.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAwB,MAAM,YAAY,CAAC;AA+B7D,eAAO,MAAM,WAAW,EAAE,IAAI,EAI7B,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /** Layout atoms — the agent's arrangement vocabulary. */
3
+ import {} from 'react';
4
+ import { cn } from '@/lib/utils.js';
5
+ import { Separator } from '@/components/ui/separator.js';
6
+ import {} from './types.js';
7
+ const Stack = ({ props, children }) => {
8
+ const direction = props['direction'] === 'row' ? 'flex-row' : 'flex-col';
9
+ const gap = typeof props['gap'] === 'number' ? props['gap'] : 3;
10
+ return _jsx("div", { className: cn('flex', direction, `gap-${gap}`), children: children });
11
+ };
12
+ const Section = ({ props, children }) => {
13
+ const title = typeof props['title'] === 'string' ? props['title'] : undefined;
14
+ return (_jsxs("section", { className: "flex flex-col gap-3", children: [title ? (_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("span", { className: "text-xs font-medium uppercase tracking-widest text-muted-foreground", children: title }), _jsx(Separator, { className: "flex-1" })] })) : null, children] }));
15
+ };
16
+ const Card = ({ children }) => (_jsx("div", { className: "rounded-lg border border-border bg-card p-4 text-card-foreground shadow-sm", children: children }));
17
+ export const layoutAtoms = [
18
+ { id: 'stack', Component: Stack },
19
+ { id: 'section', Component: Section },
20
+ { id: 'card', Component: Card },
21
+ ];
22
+ //# sourceMappingURL=layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/atoms/layout.tsx"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,OAAO,EAAW,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAmC,MAAM,YAAY,CAAC;AAE7D,MAAM,KAAK,GAAwB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;IACzD,MAAM,SAAS,GAAG,KAAK,C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