@particle-academy/agent-integrations 0.2.4 → 0.4.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 (132) hide show
  1. package/README.md +20 -0
  2. package/dist/bridges/charts.d.cts +39 -0
  3. package/dist/bridges/charts.d.ts +39 -0
  4. package/dist/bridges/code.d.cts +47 -0
  5. package/dist/bridges/code.d.ts +47 -0
  6. package/dist/bridges/flow.d.cts +4 -3
  7. package/dist/bridges/flow.d.ts +4 -3
  8. package/dist/bridges/forms.d.cts +76 -0
  9. package/dist/bridges/forms.d.ts +76 -0
  10. package/dist/bridges/scene.d.cts +54 -0
  11. package/dist/bridges/scene.d.ts +54 -0
  12. package/dist/bridges/screens.d.cts +78 -0
  13. package/dist/bridges/screens.d.ts +78 -0
  14. package/dist/bridges/sheets.d.cts +62 -0
  15. package/dist/bridges/sheets.d.ts +62 -0
  16. package/dist/bridges/whiteboard.d.cts +4 -3
  17. package/dist/bridges/whiteboard.d.ts +4 -3
  18. package/dist/bridges-charts.cjs +167 -0
  19. package/dist/bridges-charts.cjs.map +1 -0
  20. package/dist/bridges-charts.js +6 -0
  21. package/dist/bridges-charts.js.map +1 -0
  22. package/dist/bridges-code.cjs +219 -0
  23. package/dist/bridges-code.cjs.map +1 -0
  24. package/dist/bridges-code.js +6 -0
  25. package/dist/bridges-code.js.map +1 -0
  26. package/dist/bridges-flow.cjs +78 -19
  27. package/dist/bridges-flow.cjs.map +1 -1
  28. package/dist/bridges-flow.js +4 -2
  29. package/dist/bridges-forms.cjs +205 -0
  30. package/dist/bridges-forms.cjs.map +1 -0
  31. package/dist/bridges-forms.js +6 -0
  32. package/dist/bridges-forms.js.map +1 -0
  33. package/dist/bridges-scene.cjs +250 -0
  34. package/dist/bridges-scene.cjs.map +1 -0
  35. package/dist/bridges-scene.js +6 -0
  36. package/dist/bridges-scene.js.map +1 -0
  37. package/dist/bridges-screens.cjs +227 -0
  38. package/dist/bridges-screens.cjs.map +1 -0
  39. package/dist/bridges-screens.js +6 -0
  40. package/dist/bridges-screens.js.map +1 -0
  41. package/dist/bridges-sheets.cjs +327 -0
  42. package/dist/bridges-sheets.cjs.map +1 -0
  43. package/dist/bridges-sheets.js +6 -0
  44. package/dist/bridges-sheets.js.map +1 -0
  45. package/dist/bridges-whiteboard.cjs +226 -40
  46. package/dist/bridges-whiteboard.cjs.map +1 -1
  47. package/dist/bridges-whiteboard.js +5 -2
  48. package/dist/{chunk-5ZUHNNLR.js → chunk-3KSZNGNW.js} +81 -43
  49. package/dist/chunk-3KSZNGNW.js.map +1 -0
  50. package/dist/chunk-4BL5M3U3.js +158 -0
  51. package/dist/chunk-4BL5M3U3.js.map +1 -0
  52. package/dist/{chunk-QGCF7YKW.js → chunk-4KAIV6OD.js} +40 -12
  53. package/dist/chunk-4KAIV6OD.js.map +1 -0
  54. package/dist/chunk-52S7XYZK.js +38 -0
  55. package/dist/chunk-52S7XYZK.js.map +1 -0
  56. package/dist/chunk-57ZDHD53.js +180 -0
  57. package/dist/chunk-57ZDHD53.js.map +1 -0
  58. package/dist/chunk-E4AICMFZ.js +83 -0
  59. package/dist/chunk-E4AICMFZ.js.map +1 -0
  60. package/dist/chunk-GQ7XXK7G.js +124 -0
  61. package/dist/chunk-GQ7XXK7G.js.map +1 -0
  62. package/dist/chunk-HSTW7ZNO.js +172 -0
  63. package/dist/chunk-HSTW7ZNO.js.map +1 -0
  64. package/dist/chunk-IANI25IT.js +280 -0
  65. package/dist/chunk-IANI25IT.js.map +1 -0
  66. package/dist/{chunk-FLEOQUKF.js → chunk-JMYPUAFH.js} +17 -2
  67. package/dist/chunk-JMYPUAFH.js.map +1 -0
  68. package/dist/chunk-JU2N4KK6.js +34 -0
  69. package/dist/chunk-JU2N4KK6.js.map +1 -0
  70. package/dist/{chunk-2VOQJKSU.js → chunk-N3H4DXY5.js} +44 -22
  71. package/dist/chunk-N3H4DXY5.js.map +1 -0
  72. package/dist/chunk-NTDZWGYB.js +120 -0
  73. package/dist/chunk-NTDZWGYB.js.map +1 -0
  74. package/dist/chunk-RGO42EQ6.js +25 -0
  75. package/dist/chunk-RGO42EQ6.js.map +1 -0
  76. package/dist/chunk-X66JWQBB.js +37 -0
  77. package/dist/chunk-X66JWQBB.js.map +1 -0
  78. package/dist/chunk-XRAJSOPS.js +203 -0
  79. package/dist/chunk-XRAJSOPS.js.map +1 -0
  80. package/dist/index.cjs +1766 -127
  81. package/dist/index.cjs.map +1 -1
  82. package/dist/index.d.cts +99 -3
  83. package/dist/index.d.ts +99 -3
  84. package/dist/index.js +115 -9
  85. package/dist/index.js.map +1 -1
  86. package/dist/mcp/index.d.cts +5 -2
  87. package/dist/mcp/index.d.ts +5 -2
  88. package/dist/mcp.cjs +37 -9
  89. package/dist/mcp.cjs.map +1 -1
  90. package/dist/mcp.js +1 -1
  91. package/dist/presence/index.d.cts +136 -0
  92. package/dist/presence/index.d.ts +136 -0
  93. package/dist/presence.cjs +107 -0
  94. package/dist/presence.cjs.map +1 -0
  95. package/dist/presence.js +5 -0
  96. package/dist/presence.js.map +1 -0
  97. package/dist/registry-2DRURS6U.js +3 -0
  98. package/dist/registry-2DRURS6U.js.map +1 -0
  99. package/dist/server-BsSwfemr.d.cts +63 -0
  100. package/dist/server-Du3-IGqM.d.ts +63 -0
  101. package/dist/sharing/index.d.cts +3 -1
  102. package/dist/sharing/index.d.ts +3 -1
  103. package/dist/sharing.cjs +68 -0
  104. package/dist/sharing.cjs.map +1 -1
  105. package/dist/sharing.js +1 -1
  106. package/dist/sheets-adapter.cjs +96 -0
  107. package/dist/sheets-adapter.cjs.map +1 -0
  108. package/dist/sheets-adapter.d.cts +115 -0
  109. package/dist/sheets-adapter.d.ts +115 -0
  110. package/dist/sheets-adapter.js +4 -0
  111. package/dist/sheets-adapter.js.map +1 -0
  112. package/dist/styles.css +57 -0
  113. package/dist/styles.css.map +1 -1
  114. package/dist/tool-host-BQuUygLF.d.cts +60 -0
  115. package/dist/tool-host-C8JMMGYq.d.ts +60 -0
  116. package/dist/{types-CRPA_D0z.d.ts → types-CCSBGW9T.d.cts} +2 -2
  117. package/dist/{types-DR5AS6Rd.d.cts → types-DIVNcIQO.d.ts} +2 -2
  118. package/dist/types-aOQLTW0E.d.cts +112 -0
  119. package/dist/types-aOQLTW0E.d.ts +112 -0
  120. package/dist/undo/index.d.cts +69 -0
  121. package/dist/undo/index.d.ts +69 -0
  122. package/dist/undo.cjs +163 -0
  123. package/dist/undo.cjs.map +1 -0
  124. package/dist/undo.js +5 -0
  125. package/dist/undo.js.map +1 -0
  126. package/package.json +1 -1
  127. package/dist/chunk-2VOQJKSU.js.map +0 -1
  128. package/dist/chunk-5ZUHNNLR.js.map +0 -1
  129. package/dist/chunk-FLEOQUKF.js.map +0 -1
  130. package/dist/chunk-QGCF7YKW.js.map +0 -1
  131. package/dist/server-Bv985us3.d.cts +0 -173
  132. package/dist/server-Bv985us3.d.ts +0 -173
package/README.md CHANGED
@@ -16,6 +16,26 @@ npm install @particle-academy/agent-integrations
16
16
  import "@particle-academy/agent-integrations/styles.css";
17
17
  ```
18
18
 
19
+ ## When you don't need an MCP server
20
+
21
+ If your agent runs in the same JS process as the surfaces it drives (an embedded chat widget, an in-page worker, an SSR-time tool loop), you don't need any of MCP's JSON-RPC framing. Use **`ToolRegistry`** — a plain in-memory tool host that the bridges register against. Agents drive the surface with `host.callTool("sheet_set_cell", { … })` directly.
22
+
23
+ ```ts
24
+ import {
25
+ ToolRegistry,
26
+ registerSheetsBridge,
27
+ useSheetsAdapter,
28
+ } from "@particle-academy/agent-integrations";
29
+
30
+ const host = new ToolRegistry();
31
+ registerSheetsBridge(host, { adapter });
32
+
33
+ // in-process agent:
34
+ await host.callTool("sheet_set_cell", { address: "B3", value: 42 });
35
+ ```
36
+
37
+ Need both? `MicroMcpServer` extends `ToolRegistry`, so the same instance serves direct in-process calls **and** SSE-relayed remote agents at the same time. Bridges accept either — every `register*Bridge(host, …)` signature takes a `ToolHost`.
38
+
19
39
  ## Architecture
20
40
 
21
41
  ```
@@ -0,0 +1,39 @@
1
+ import { T as ToolHost } from '../tool-host-BQuUygLF.cjs';
2
+ import { B as Bridge } from '../types-CCSBGW9T.cjs';
3
+ import '../types-aOQLTW0E.cjs';
4
+
5
+ /**
6
+ * Adapter wires a single fancy-echarts chart to the bridge. Charts are
7
+ * already prop-driven, so the adapter just exposes the data + option
8
+ * setters and a way to read what's currently rendered.
9
+ */
10
+ type ChartsBridgeAdapter = {
11
+ /** Stable id for this chart instance. */
12
+ id: string;
13
+ title?: string;
14
+ screenId?: string;
15
+ /** Read the current ECharts option object the chart is rendering. */
16
+ getOption: () => Record<string, unknown>;
17
+ /** Replace the entire option. */
18
+ setOption: (option: Record<string, unknown>) => void;
19
+ /** Convenience: shallow-merge a partial option update. */
20
+ updateOption?: (partial: Record<string, unknown>) => void;
21
+ /** Read just the data series (subset of option for quick agent reads). */
22
+ getData?: () => unknown;
23
+ /** Update only the data, leaving axes/colors/etc. alone. */
24
+ updateData?: (data: unknown) => void;
25
+ };
26
+ type ChartsBridgeOptions = {
27
+ adapter: ChartsBridgeAdapter;
28
+ agent?: {
29
+ id: string;
30
+ name?: string;
31
+ color?: string;
32
+ };
33
+ };
34
+ /**
35
+ * registerChartsBridge — schema-aware MCP access to a single chart.
36
+ */
37
+ declare function registerChartsBridge(host: ToolHost, options: ChartsBridgeOptions): Bridge;
38
+
39
+ export { type ChartsBridgeAdapter, type ChartsBridgeOptions, registerChartsBridge };
@@ -0,0 +1,39 @@
1
+ import { T as ToolHost } from '../tool-host-C8JMMGYq.js';
2
+ import { B as Bridge } from '../types-DIVNcIQO.js';
3
+ import '../types-aOQLTW0E.js';
4
+
5
+ /**
6
+ * Adapter wires a single fancy-echarts chart to the bridge. Charts are
7
+ * already prop-driven, so the adapter just exposes the data + option
8
+ * setters and a way to read what's currently rendered.
9
+ */
10
+ type ChartsBridgeAdapter = {
11
+ /** Stable id for this chart instance. */
12
+ id: string;
13
+ title?: string;
14
+ screenId?: string;
15
+ /** Read the current ECharts option object the chart is rendering. */
16
+ getOption: () => Record<string, unknown>;
17
+ /** Replace the entire option. */
18
+ setOption: (option: Record<string, unknown>) => void;
19
+ /** Convenience: shallow-merge a partial option update. */
20
+ updateOption?: (partial: Record<string, unknown>) => void;
21
+ /** Read just the data series (subset of option for quick agent reads). */
22
+ getData?: () => unknown;
23
+ /** Update only the data, leaving axes/colors/etc. alone. */
24
+ updateData?: (data: unknown) => void;
25
+ };
26
+ type ChartsBridgeOptions = {
27
+ adapter: ChartsBridgeAdapter;
28
+ agent?: {
29
+ id: string;
30
+ name?: string;
31
+ color?: string;
32
+ };
33
+ };
34
+ /**
35
+ * registerChartsBridge — schema-aware MCP access to a single chart.
36
+ */
37
+ declare function registerChartsBridge(host: ToolHost, options: ChartsBridgeOptions): Bridge;
38
+
39
+ export { type ChartsBridgeAdapter, type ChartsBridgeOptions, registerChartsBridge };
@@ -0,0 +1,47 @@
1
+ import { T as ToolHost } from '../tool-host-BQuUygLF.cjs';
2
+ import { B as Bridge } from '../types-CCSBGW9T.cjs';
3
+ import '../types-aOQLTW0E.cjs';
4
+
5
+ /**
6
+ * Adapter the host wires to a fancy-code CodeEditor (typically via the
7
+ * useCodeEditor hook's context value).
8
+ */
9
+ type CodeBridgeAdapter = {
10
+ /** Stable id for this editor instance. */
11
+ id: string;
12
+ /** Display label. */
13
+ title?: string;
14
+ /** Optional fancy-screens screen id. */
15
+ screenId?: string;
16
+ /** Read the current document text. */
17
+ getValue: () => string;
18
+ /** Replace the document. */
19
+ setValue: (value: string) => void;
20
+ /** Read the current selection text (empty string if none). */
21
+ getSelection?: () => string;
22
+ /** Replace the current selection with text. */
23
+ replaceSelection?: (text: string) => void;
24
+ /** Programmatic focus. */
25
+ focus?: () => void;
26
+ /** Read / set the active language. */
27
+ getLanguage?: () => string;
28
+ /** Set the active language. */
29
+ setLanguage?: (lang: string) => void;
30
+ };
31
+ type CodeBridgeOptions = {
32
+ adapter: CodeBridgeAdapter;
33
+ agent?: {
34
+ id: string;
35
+ name?: string;
36
+ color?: string;
37
+ };
38
+ };
39
+ /**
40
+ * registerCodeBridge — schema-aware MCP access to a single CodeEditor.
41
+ * Tools cover read, full replace, append, selection replace, language
42
+ * switch, and a streaming append helper for "type characters into the
43
+ * editor over time" UX.
44
+ */
45
+ declare function registerCodeBridge(host: ToolHost, options: CodeBridgeOptions): Bridge;
46
+
47
+ export { type CodeBridgeAdapter, type CodeBridgeOptions, registerCodeBridge };
@@ -0,0 +1,47 @@
1
+ import { T as ToolHost } from '../tool-host-C8JMMGYq.js';
2
+ import { B as Bridge } from '../types-DIVNcIQO.js';
3
+ import '../types-aOQLTW0E.js';
4
+
5
+ /**
6
+ * Adapter the host wires to a fancy-code CodeEditor (typically via the
7
+ * useCodeEditor hook's context value).
8
+ */
9
+ type CodeBridgeAdapter = {
10
+ /** Stable id for this editor instance. */
11
+ id: string;
12
+ /** Display label. */
13
+ title?: string;
14
+ /** Optional fancy-screens screen id. */
15
+ screenId?: string;
16
+ /** Read the current document text. */
17
+ getValue: () => string;
18
+ /** Replace the document. */
19
+ setValue: (value: string) => void;
20
+ /** Read the current selection text (empty string if none). */
21
+ getSelection?: () => string;
22
+ /** Replace the current selection with text. */
23
+ replaceSelection?: (text: string) => void;
24
+ /** Programmatic focus. */
25
+ focus?: () => void;
26
+ /** Read / set the active language. */
27
+ getLanguage?: () => string;
28
+ /** Set the active language. */
29
+ setLanguage?: (lang: string) => void;
30
+ };
31
+ type CodeBridgeOptions = {
32
+ adapter: CodeBridgeAdapter;
33
+ agent?: {
34
+ id: string;
35
+ name?: string;
36
+ color?: string;
37
+ };
38
+ };
39
+ /**
40
+ * registerCodeBridge — schema-aware MCP access to a single CodeEditor.
41
+ * Tools cover read, full replace, append, selection replace, language
42
+ * switch, and a streaming append helper for "type characters into the
43
+ * editor over time" UX.
44
+ */
45
+ declare function registerCodeBridge(host: ToolHost, options: CodeBridgeOptions): Bridge;
46
+
47
+ export { type CodeBridgeAdapter, type CodeBridgeOptions, registerCodeBridge };
@@ -1,5 +1,6 @@
1
- import { M as MicroMcpServer } from '../server-Bv985us3.cjs';
2
- import { B as Bridge } from '../types-DR5AS6Rd.cjs';
1
+ import { T as ToolHost } from '../tool-host-BQuUygLF.cjs';
2
+ import { B as Bridge } from '../types-CCSBGW9T.cjs';
3
+ import '../types-aOQLTW0E.cjs';
3
4
 
4
5
  type FlowNode = {
5
6
  id: string;
@@ -67,6 +68,6 @@ type FlowBridgeOptions = {
67
68
  * mutation tools (add / update / delete nodes + edges), and optional
68
69
  * run/cancel if the host provides those callbacks.
69
70
  */
70
- declare function registerFlowBridge(server: MicroMcpServer, options: FlowBridgeOptions): Bridge;
71
+ declare function registerFlowBridge(host: ToolHost, options: FlowBridgeOptions): Bridge;
71
72
 
72
73
  export { type FlowBridgeAdapter, type FlowBridgeOptions, registerFlowBridge };
@@ -1,5 +1,6 @@
1
- import { M as MicroMcpServer } from '../server-Bv985us3.js';
2
- import { B as Bridge } from '../types-CRPA_D0z.js';
1
+ import { T as ToolHost } from '../tool-host-C8JMMGYq.js';
2
+ import { B as Bridge } from '../types-DIVNcIQO.js';
3
+ import '../types-aOQLTW0E.js';
3
4
 
4
5
  type FlowNode = {
5
6
  id: string;
@@ -67,6 +68,6 @@ type FlowBridgeOptions = {
67
68
  * mutation tools (add / update / delete nodes + edges), and optional
68
69
  * run/cancel if the host provides those callbacks.
69
70
  */
70
- declare function registerFlowBridge(server: MicroMcpServer, options: FlowBridgeOptions): Bridge;
71
+ declare function registerFlowBridge(host: ToolHost, options: FlowBridgeOptions): Bridge;
71
72
 
72
73
  export { type FlowBridgeAdapter, type FlowBridgeOptions, registerFlowBridge };
@@ -0,0 +1,76 @@
1
+ import { T as ToolHost } from '../tool-host-BQuUygLF.cjs';
2
+ import { B as Bridge } from '../types-CCSBGW9T.cjs';
3
+ import '../types-aOQLTW0E.cjs';
4
+
5
+ /**
6
+ * Field descriptor — what the host says about each form field. Mirrors the
7
+ * subset of HTML / react-fancy input shapes agents care about.
8
+ */
9
+ type FormFieldDescriptor = {
10
+ /** Form-local field name. Matches the key the host uses in its values map. */
11
+ name: string;
12
+ /** Display label. */
13
+ label?: string;
14
+ /** Logical type. Drives validation + agent expectations. */
15
+ type: "text" | "textarea" | "number" | "email" | "password" | "url" | "date" | "select" | "multi-select" | "checkbox" | "switch" | "radio" | "file" | "json";
16
+ /** Allowed values for select / radio. */
17
+ options?: Array<{
18
+ value: string;
19
+ label: string;
20
+ }>;
21
+ /** Whether the field must be filled before submit. */
22
+ required?: boolean;
23
+ /** Free-text hint surfaced to the agent. */
24
+ description?: string;
25
+ /** Default value (presented in get_value when nothing set). */
26
+ defaultValue?: unknown;
27
+ };
28
+ /**
29
+ * Adapter the host wires per form. Matches the controlled-state pattern
30
+ * react-fancy already uses (`value` / `onValueChange`); this adapter just
31
+ * exposes those state slots in a form-shaped way the bridge can call.
32
+ */
33
+ type FormBridgeAdapter = {
34
+ /** Stable id for the form (used in form_describe + presence target). */
35
+ id: string;
36
+ /** Display title for human-readable logs. */
37
+ title?: string;
38
+ /** Optional fancy-screens screen id this form belongs to. */
39
+ screenId?: string;
40
+ /** Field descriptors. The bridge uses these for schema introspection
41
+ * (form_describe). Agents call this first to know what to fill. */
42
+ getFields: () => FormFieldDescriptor[];
43
+ /** Read a single field's current value. */
44
+ getValue: (name: string) => unknown;
45
+ /** Read all values as { fieldName: value }. */
46
+ getValues: () => Record<string, unknown>;
47
+ /** Set a single field's value. The host wires this to its setState. */
48
+ setValue: (name: string, value: unknown) => void;
49
+ /** Set many at once. Defaults to calling setValue in a loop. */
50
+ setValues?: (values: Record<string, unknown>) => void;
51
+ /** Programmatically focus a field (host implements DOM focus). Optional. */
52
+ focus?: (name: string) => void;
53
+ /** Submit the form. Returns the values that were submitted (or rejection). */
54
+ submit?: () => Promise<{
55
+ ok: boolean;
56
+ values?: Record<string, unknown>;
57
+ error?: string;
58
+ }>;
59
+ };
60
+ type FormBridgeOptions = {
61
+ adapter: FormBridgeAdapter;
62
+ /** Identity tagged into activity events. */
63
+ agent?: {
64
+ id: string;
65
+ name?: string;
66
+ color?: string;
67
+ };
68
+ };
69
+ /**
70
+ * registerFormBridge — wires schema-driven MCP access to a single form.
71
+ * Hosts can register multiple bridges (one per form on the screen) by
72
+ * giving each adapter a distinct `id`.
73
+ */
74
+ declare function registerFormBridge(host: ToolHost, options: FormBridgeOptions): Bridge;
75
+
76
+ export { type FormBridgeAdapter, type FormBridgeOptions, type FormFieldDescriptor, registerFormBridge };
@@ -0,0 +1,76 @@
1
+ import { T as ToolHost } from '../tool-host-C8JMMGYq.js';
2
+ import { B as Bridge } from '../types-DIVNcIQO.js';
3
+ import '../types-aOQLTW0E.js';
4
+
5
+ /**
6
+ * Field descriptor — what the host says about each form field. Mirrors the
7
+ * subset of HTML / react-fancy input shapes agents care about.
8
+ */
9
+ type FormFieldDescriptor = {
10
+ /** Form-local field name. Matches the key the host uses in its values map. */
11
+ name: string;
12
+ /** Display label. */
13
+ label?: string;
14
+ /** Logical type. Drives validation + agent expectations. */
15
+ type: "text" | "textarea" | "number" | "email" | "password" | "url" | "date" | "select" | "multi-select" | "checkbox" | "switch" | "radio" | "file" | "json";
16
+ /** Allowed values for select / radio. */
17
+ options?: Array<{
18
+ value: string;
19
+ label: string;
20
+ }>;
21
+ /** Whether the field must be filled before submit. */
22
+ required?: boolean;
23
+ /** Free-text hint surfaced to the agent. */
24
+ description?: string;
25
+ /** Default value (presented in get_value when nothing set). */
26
+ defaultValue?: unknown;
27
+ };
28
+ /**
29
+ * Adapter the host wires per form. Matches the controlled-state pattern
30
+ * react-fancy already uses (`value` / `onValueChange`); this adapter just
31
+ * exposes those state slots in a form-shaped way the bridge can call.
32
+ */
33
+ type FormBridgeAdapter = {
34
+ /** Stable id for the form (used in form_describe + presence target). */
35
+ id: string;
36
+ /** Display title for human-readable logs. */
37
+ title?: string;
38
+ /** Optional fancy-screens screen id this form belongs to. */
39
+ screenId?: string;
40
+ /** Field descriptors. The bridge uses these for schema introspection
41
+ * (form_describe). Agents call this first to know what to fill. */
42
+ getFields: () => FormFieldDescriptor[];
43
+ /** Read a single field's current value. */
44
+ getValue: (name: string) => unknown;
45
+ /** Read all values as { fieldName: value }. */
46
+ getValues: () => Record<string, unknown>;
47
+ /** Set a single field's value. The host wires this to its setState. */
48
+ setValue: (name: string, value: unknown) => void;
49
+ /** Set many at once. Defaults to calling setValue in a loop. */
50
+ setValues?: (values: Record<string, unknown>) => void;
51
+ /** Programmatically focus a field (host implements DOM focus). Optional. */
52
+ focus?: (name: string) => void;
53
+ /** Submit the form. Returns the values that were submitted (or rejection). */
54
+ submit?: () => Promise<{
55
+ ok: boolean;
56
+ values?: Record<string, unknown>;
57
+ error?: string;
58
+ }>;
59
+ };
60
+ type FormBridgeOptions = {
61
+ adapter: FormBridgeAdapter;
62
+ /** Identity tagged into activity events. */
63
+ agent?: {
64
+ id: string;
65
+ name?: string;
66
+ color?: string;
67
+ };
68
+ };
69
+ /**
70
+ * registerFormBridge — wires schema-driven MCP access to a single form.
71
+ * Hosts can register multiple bridges (one per form on the screen) by
72
+ * giving each adapter a distinct `id`.
73
+ */
74
+ declare function registerFormBridge(host: ToolHost, options: FormBridgeOptions): Bridge;
75
+
76
+ export { type FormBridgeAdapter, type FormBridgeOptions, type FormFieldDescriptor, registerFormBridge };
@@ -0,0 +1,54 @@
1
+ import { T as ToolHost } from '../tool-host-BQuUygLF.cjs';
2
+ import { B as Bridge } from '../types-CCSBGW9T.cjs';
3
+ import '../types-aOQLTW0E.cjs';
4
+
5
+ /**
6
+ * Loose Scene types — mirror the public surface of fancy-3d's Scene
7
+ * descriptor (engine-agnostic JSON the package's adapters consume).
8
+ */
9
+ type SceneObjectKind = "box" | "sphere" | "cylinder" | "plane" | "screen" | "group" | "custom";
10
+ type SceneObject = {
11
+ id: string;
12
+ kind: SceneObjectKind | string;
13
+ position?: [number, number, number];
14
+ rotation?: [number, number, number];
15
+ scale?: [number, number, number];
16
+ color?: string;
17
+ /** Free-form per-kind config (e.g. text content for screens). */
18
+ props?: Record<string, unknown>;
19
+ children?: SceneObject[];
20
+ };
21
+ type SceneCamera = {
22
+ position?: [number, number, number];
23
+ target?: [number, number, number];
24
+ fov?: number;
25
+ };
26
+ type SceneState = {
27
+ objects: SceneObject[];
28
+ camera?: SceneCamera;
29
+ background?: string;
30
+ };
31
+ type SceneBridgeAdapter = {
32
+ id: string;
33
+ title?: string;
34
+ screenId?: string;
35
+ getScene: () => SceneState;
36
+ setScene: (next: SceneState) => void;
37
+ /** Convenience: set just the camera without touching objects. */
38
+ setCamera?: (next: SceneCamera) => void;
39
+ };
40
+ type SceneBridgeOptions = {
41
+ adapter: SceneBridgeAdapter;
42
+ agent?: {
43
+ id: string;
44
+ name?: string;
45
+ color?: string;
46
+ };
47
+ };
48
+ /**
49
+ * registerSceneBridge — schema-aware MCP access to a fancy-3d Scene.
50
+ * Tools cover read, add/update/delete object, set camera, set background.
51
+ */
52
+ declare function registerSceneBridge(host: ToolHost, options: SceneBridgeOptions): Bridge;
53
+
54
+ export { type SceneBridgeAdapter, type SceneBridgeOptions, type SceneCamera, type SceneObject, type SceneObjectKind, type SceneState, registerSceneBridge };
@@ -0,0 +1,54 @@
1
+ import { T as ToolHost } from '../tool-host-C8JMMGYq.js';
2
+ import { B as Bridge } from '../types-DIVNcIQO.js';
3
+ import '../types-aOQLTW0E.js';
4
+
5
+ /**
6
+ * Loose Scene types — mirror the public surface of fancy-3d's Scene
7
+ * descriptor (engine-agnostic JSON the package's adapters consume).
8
+ */
9
+ type SceneObjectKind = "box" | "sphere" | "cylinder" | "plane" | "screen" | "group" | "custom";
10
+ type SceneObject = {
11
+ id: string;
12
+ kind: SceneObjectKind | string;
13
+ position?: [number, number, number];
14
+ rotation?: [number, number, number];
15
+ scale?: [number, number, number];
16
+ color?: string;
17
+ /** Free-form per-kind config (e.g. text content for screens). */
18
+ props?: Record<string, unknown>;
19
+ children?: SceneObject[];
20
+ };
21
+ type SceneCamera = {
22
+ position?: [number, number, number];
23
+ target?: [number, number, number];
24
+ fov?: number;
25
+ };
26
+ type SceneState = {
27
+ objects: SceneObject[];
28
+ camera?: SceneCamera;
29
+ background?: string;
30
+ };
31
+ type SceneBridgeAdapter = {
32
+ id: string;
33
+ title?: string;
34
+ screenId?: string;
35
+ getScene: () => SceneState;
36
+ setScene: (next: SceneState) => void;
37
+ /** Convenience: set just the camera without touching objects. */
38
+ setCamera?: (next: SceneCamera) => void;
39
+ };
40
+ type SceneBridgeOptions = {
41
+ adapter: SceneBridgeAdapter;
42
+ agent?: {
43
+ id: string;
44
+ name?: string;
45
+ color?: string;
46
+ };
47
+ };
48
+ /**
49
+ * registerSceneBridge — schema-aware MCP access to a fancy-3d Scene.
50
+ * Tools cover read, add/update/delete object, set camera, set background.
51
+ */
52
+ declare function registerSceneBridge(host: ToolHost, options: SceneBridgeOptions): Bridge;
53
+
54
+ export { type SceneBridgeAdapter, type SceneBridgeOptions, type SceneCamera, type SceneObject, type SceneObjectKind, type SceneState, registerSceneBridge };
@@ -0,0 +1,78 @@
1
+ import { T as ToolHost } from '../tool-host-BQuUygLF.cjs';
2
+ import { B as Bridge } from '../types-CCSBGW9T.cjs';
3
+ import '../types-aOQLTW0E.cjs';
4
+
5
+ /**
6
+ * Loose snapshot of a screen — what's in fancy-screens' ScreenMeta plus
7
+ * the host's optional activity status. Kept here so this bridge has no
8
+ * hard dep on fancy-screens.
9
+ */
10
+ type ScreenSnapshot = {
11
+ id: string;
12
+ title?: string;
13
+ /** Whether this screen is the one the human / agent is looking at. */
14
+ active: boolean;
15
+ /** Optional category / kind (e.g. "form", "whiteboard"). */
16
+ kind?: string;
17
+ };
18
+ /**
19
+ * Spec for a dynamically-created screen. The host's `createScreen`
20
+ * implementation looks up `kind` in its template registry and instantiates
21
+ * the matching surface (form / whiteboard / sheet / chart / markdown / etc.).
22
+ */
23
+ type ScreenCreateSpec = {
24
+ id: string;
25
+ title?: string;
26
+ /** Template kind. Hosts decide the catalog. */
27
+ kind: string;
28
+ /** Template-specific config. Form: { fields }. Sheet: { headers }. etc. */
29
+ config?: Record<string, unknown>;
30
+ };
31
+ /**
32
+ * Adapter exposes the host's screen-navigation surface to the bridge.
33
+ * Hosts wire this up against react-router, a custom tab state, or the
34
+ * fancy-screens registry — wherever "current screen" lives.
35
+ *
36
+ * The optional create / destroy / update hooks let agents author screens
37
+ * dynamically against a host-defined template catalog.
38
+ */
39
+ type ScreensBridgeAdapter = {
40
+ /** List every available screen. */
41
+ listScreens: () => ScreenSnapshot[];
42
+ /** Read which screen is currently active. */
43
+ getActive: () => string | null;
44
+ /** Navigate to a screen by id. Host updates router / tab state. */
45
+ setActive: (screenId: string) => void;
46
+ /** Optional: instantiate a new screen from a template + config. */
47
+ createScreen?: (spec: ScreenCreateSpec) => void;
48
+ /** Optional: remove a previously-created screen. */
49
+ destroyScreen?: (screenId: string) => void;
50
+ /** Optional: shallow-merge new config into an existing screen. */
51
+ updateScreenContent?: (screenId: string, partial: Record<string, unknown>) => void;
52
+ /** Optional: enumerate the kinds the host knows how to instantiate. */
53
+ listKinds?: () => Array<{
54
+ kind: string;
55
+ label?: string;
56
+ description?: string;
57
+ configSchema?: unknown;
58
+ }>;
59
+ };
60
+ type ScreensBridgeOptions = {
61
+ adapter: ScreensBridgeAdapter;
62
+ agent?: {
63
+ id: string;
64
+ name?: string;
65
+ color?: string;
66
+ };
67
+ };
68
+ /**
69
+ * registerScreensBridge — top-level navigation bridge so agents can
70
+ * switch between screens (`screens_navigate`) and discover what surfaces
71
+ * exist (`screens_list`, `screens_describe_active`).
72
+ *
73
+ * Pair with the per-surface bridges (whiteboard, form, sheet, etc.) so
74
+ * the agent has both navigation and per-screen control.
75
+ */
76
+ declare function registerScreensBridge(host: ToolHost, options: ScreensBridgeOptions): Bridge;
77
+
78
+ export { type ScreenCreateSpec, type ScreenSnapshot, type ScreensBridgeAdapter, type ScreensBridgeOptions, registerScreensBridge };
@@ -0,0 +1,78 @@
1
+ import { T as ToolHost } from '../tool-host-C8JMMGYq.js';
2
+ import { B as Bridge } from '../types-DIVNcIQO.js';
3
+ import '../types-aOQLTW0E.js';
4
+
5
+ /**
6
+ * Loose snapshot of a screen — what's in fancy-screens' ScreenMeta plus
7
+ * the host's optional activity status. Kept here so this bridge has no
8
+ * hard dep on fancy-screens.
9
+ */
10
+ type ScreenSnapshot = {
11
+ id: string;
12
+ title?: string;
13
+ /** Whether this screen is the one the human / agent is looking at. */
14
+ active: boolean;
15
+ /** Optional category / kind (e.g. "form", "whiteboard"). */
16
+ kind?: string;
17
+ };
18
+ /**
19
+ * Spec for a dynamically-created screen. The host's `createScreen`
20
+ * implementation looks up `kind` in its template registry and instantiates
21
+ * the matching surface (form / whiteboard / sheet / chart / markdown / etc.).
22
+ */
23
+ type ScreenCreateSpec = {
24
+ id: string;
25
+ title?: string;
26
+ /** Template kind. Hosts decide the catalog. */
27
+ kind: string;
28
+ /** Template-specific config. Form: { fields }. Sheet: { headers }. etc. */
29
+ config?: Record<string, unknown>;
30
+ };
31
+ /**
32
+ * Adapter exposes the host's screen-navigation surface to the bridge.
33
+ * Hosts wire this up against react-router, a custom tab state, or the
34
+ * fancy-screens registry — wherever "current screen" lives.
35
+ *
36
+ * The optional create / destroy / update hooks let agents author screens
37
+ * dynamically against a host-defined template catalog.
38
+ */
39
+ type ScreensBridgeAdapter = {
40
+ /** List every available screen. */
41
+ listScreens: () => ScreenSnapshot[];
42
+ /** Read which screen is currently active. */
43
+ getActive: () => string | null;
44
+ /** Navigate to a screen by id. Host updates router / tab state. */
45
+ setActive: (screenId: string) => void;
46
+ /** Optional: instantiate a new screen from a template + config. */
47
+ createScreen?: (spec: ScreenCreateSpec) => void;
48
+ /** Optional: remove a previously-created screen. */
49
+ destroyScreen?: (screenId: string) => void;
50
+ /** Optional: shallow-merge new config into an existing screen. */
51
+ updateScreenContent?: (screenId: string, partial: Record<string, unknown>) => void;
52
+ /** Optional: enumerate the kinds the host knows how to instantiate. */
53
+ listKinds?: () => Array<{
54
+ kind: string;
55
+ label?: string;
56
+ description?: string;
57
+ configSchema?: unknown;
58
+ }>;
59
+ };
60
+ type ScreensBridgeOptions = {
61
+ adapter: ScreensBridgeAdapter;
62
+ agent?: {
63
+ id: string;
64
+ name?: string;
65
+ color?: string;
66
+ };
67
+ };
68
+ /**
69
+ * registerScreensBridge — top-level navigation bridge so agents can
70
+ * switch between screens (`screens_navigate`) and discover what surfaces
71
+ * exist (`screens_list`, `screens_describe_active`).
72
+ *
73
+ * Pair with the per-surface bridges (whiteboard, form, sheet, etc.) so
74
+ * the agent has both navigation and per-screen control.
75
+ */
76
+ declare function registerScreensBridge(host: ToolHost, options: ScreensBridgeOptions): Bridge;
77
+
78
+ export { type ScreenCreateSpec, type ScreenSnapshot, type ScreensBridgeAdapter, type ScreensBridgeOptions, registerScreensBridge };