@particle-academy/agent-integrations 0.47.1 → 0.49.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.
package/dist/index.d.cts CHANGED
@@ -1,13 +1,11 @@
1
1
  import { M as MicroMcpServer } from './server-1y0n61R5.cjs';
2
2
  export { a as McpServerOptions, T as Transport, e as errorResult, r as rpcError, t as textResult } from './server-1y0n61R5.cjs';
3
- import { T as ToolHost } from './tool-host-D67N2a2h.cjs';
4
- export { a as ToolRegistry } from './tool-host-D67N2a2h.cjs';
3
+ export { T as ToolHost, a as ToolRegistry } from './tool-host-D67N2a2h.cjs';
5
4
  export { InProcessTransport, RelayChannel, RelayTransport, attachInProcess, attachRelay } from './mcp/index.cjs';
6
5
  export { C as CallToolResult, d as ContentBlock, I as InitializeResult, J as JsonObject, c as JsonRpcMessage, e as JsonRpcNotification, f as JsonRpcRequest, g as JsonValue, M as MCP_PROTOCOL_VERSION, b as ServerCapabilities, S as ServerInfo, h as ToolCallContext, T as ToolDefinition, a as ToolHandler } from './types-gzIpsUDE.cjs';
7
6
  export { HumanPlusDisposition, HumanPlusEvent, HumanPlusEventPage, HumanPlusEventQuery, HumanPlusEventStore, MemoryHumanPlusEventStore, NewHumanPlusEvent } from './human-plus/index.cjs';
8
7
  export { TuiBridgeOptions, TuiSurfaceRegistryLike, registerTuiBridge } from './bridges/tui.cjs';
9
- import { B as Bridge } from './types-DP5yQZQU.cjs';
10
- export { a as BridgeFactory } from './types-DP5yQZQU.cjs';
8
+ export { B as Bridge, a as BridgeFactory } from './types-DP5yQZQU.cjs';
11
9
  import { FormFieldDescriptor } from './bridges/forms.cjs';
12
10
  export { FormBridgeAdapter, FormBridgeOptions, registerFormBridge } from './bridges/forms.cjs';
13
11
  export { SheetsBridgeAdapter, SheetsBridgeOptions, registerSheetsBridge } from './bridges/sheets.cjs';
@@ -16,7 +14,7 @@ export { CodeBridgeAdapter, CodeBridgeOptions, registerCodeBridge } from './brid
16
14
  export { ChartsBridgeAdapter, ChartsBridgeOptions, registerChartsBridge } from './bridges/charts.cjs';
17
15
  export { GridBridgeAdapter, GridBridgeOptions, GridFilter, GridPagination, GridSort, GridState, registerGridBridge } from './bridges/grid.cjs';
18
16
  export { SceneBridgeAdapter, SceneBridgeOptions, SceneCamera, SceneObject, SceneObjectKind, SceneState, registerSceneBridge } from './bridges/scene.cjs';
19
- export { ScreenSnapshot, ScreensBridgeAdapter, ScreensBridgeOptions, registerScreensBridge } from './bridges/screens.cjs';
17
+ export { ScreenCreateSpec, ScreenSnapshot, ScreensAdapterCommit, ScreensAdapterResult, ScreensBridgeAdapter, ScreensBridgeOptions, registerScreensBridge } from './bridges/screens.cjs';
20
18
  export { SlidesBridgeAdapter, SlidesBridgeOptions, registerSlidesBridge } from './bridges/slides.cjs';
21
19
  export { MapBridgeAdapter, MapBridgeOptions, registerMapBridge } from './bridges/map.cjs';
22
20
  export { GitBridgeAdapter, GitBridgeOptions, GitProposal, registerGitBridge } from './bridges/git.cjs';
@@ -27,10 +25,9 @@ export { NavigationBridgeOptions, NavigationConfirmRequest, PageAction, PageRead
27
25
  export { CatalogBridgeAdapter, CatalogBridgeOptions, CatalogCheckoutArgs, CatalogPrice, CatalogProduct, registerCatalogBridge } from './bridges/catalog.cjs';
28
26
  export { FeatureDefinition, FeatureGrant, FeaturesBridgeAdapter, FeaturesBridgeOptions, registerFeaturesBridge } from './bridges/features.cjs';
29
27
  export { PASSKEY_BRIDGE_TOOLS, PasskeyBridgeAdapter, PasskeyBridgeOptions, PasskeyProposal, PasskeySummaryLike, PasskeySupport, PasskeySurfaceState, registerPasskeyBridge } from './bridges/passkeys.cjs';
30
- import { DocAdapter } from './bridges/doc.cjs';
31
- export { DocBridgeOptions, DocOpTool, registerDocBridge } from './bridges/doc.cjs';
28
+ export { DocAdapter, DocBridgeOptions, DocOpTool, registerDocBridge } from './bridges/doc.cjs';
32
29
  export { CmsBridgeOptions, CmsOp, cmsReducer, registerCmsBridge } from './bridges/cms.cjs';
33
- import { DocNode, StagePolicy, TreeOp } from '@particle-academy/fancy-doc-commons';
30
+ export { SCREEN_TEXT_NODE_TYPE, ScreenDocBridgeOptions, ScreenDocNode, ScreenDocOp, registerScreenDocBridge } from './bridges/screen-doc.cjs';
34
31
  import { RelayState } from './sharing/index.cjs';
35
32
  export { SseRelayOptions, SseRelayTransport, attachSseRelay } from './sharing/index.cjs';
36
33
  import { S as SessionDescriptor } from './token-BZ8doMam.cjs';
@@ -46,46 +43,7 @@ export { CLAUDE_CONNECTORS_URL, CONNECTOR_GLYPHS, CONNECTOR_TARGETS, ClaudeMark,
46
43
  export { D as DEFAULT_MCPB_ENTRY_POINT, b as MCPB_MANIFEST_VERSION, c as MCPB_MIN_NODE, M as McpbManifestInput, a as McpbTool, d as buildMcpbManifest, e as buildMcpbProxyStub } from './mcpb-BXOrsRnv.cjs';
47
44
  import '@particle-academy/fancy-sheets';
48
45
  import '@particle-academy/fancy-slides';
49
-
50
- /**
51
- * Reserved node type for a literal string child. Must match fancy-screens'
52
- * `TEXT_NODE_TYPE`; duplicated rather than imported to keep this bridge free of
53
- * a fancy-screens dependency.
54
- */
55
- declare const SCREEN_TEXT_NODE_TYPE = "#text";
56
- /** A screen document node — a `DocNode` plus the minted-id flag. */
57
- interface ScreenDocNode extends DocNode {
58
- /**
59
- * True when fancy-screens minted this id because the author supplied none.
60
- * A synthetic id is derived from position, so it is not a durable handle.
61
- */
62
- synthetic?: boolean;
63
- }
64
- type ScreenDocOp = TreeOp<ScreenDocNode>;
65
- interface ScreenDocBridgeOptions {
66
- adapter: DocAdapter<ScreenDocNode>;
67
- /**
68
- * Tool-name prefix. Default `"screen"` → `screen_add`, `screen_set_text`, …
69
- *
70
- * Tool names are global, so a host wiring more than one doc-driven screen at
71
- * once must give each a distinct prefix (`"screen_checkout"`).
72
- */
73
- surface?: string;
74
- agent?: {
75
- id: string;
76
- name?: string;
77
- color?: string;
78
- };
79
- /** Auto-apply vs. confirm per op (trust-but-verify). Default: auto. */
80
- stagePolicy?: StagePolicy<ScreenDocOp>;
81
- onPending?: (staged: {
82
- id: string;
83
- op: ScreenDocOp;
84
- label: string;
85
- }) => void;
86
- }
87
- /** Register the screen-content bridge (prefix `screen_`) over a screen's `DocTree`. */
88
- declare function registerScreenDocBridge(host: ToolHost, options: ScreenDocBridgeOptions): Bridge;
46
+ import '@particle-academy/fancy-doc-commons';
89
47
 
90
48
  /**
91
49
  * A page's contribution to the shared tool surface.
@@ -561,4 +519,4 @@ type SimulateUsersButtonProps = {
561
519
  */
562
520
  declare function SimulateUsersButton({ endpoint, count, label, csrfToken, onTriggered, onError, className, style, }: SimulateUsersButtonProps): react.JSX.Element;
563
521
 
564
- export { type AgentActivity, AgentActivityHighlight, type AgentActivityHighlightProps, AgentCursor, type AgentCursorProps, AgentPanel, type AgentPanelProps, Bridge, type BridgeContribution, BridgeContributions, BridgedForm, type BridgedFormProps, CoBrowseCursorLayer, type CoBrowseCursorLayerProps, CoBrowsePresence, type CoBrowsePresenceProps, type CoBrowseSession, type CoBrowseUserEvent, DocAdapter, FormFieldDescriptor, MicroMcpServer, NavigationBridgeAdapter, RelayState, SCREEN_TEXT_NODE_TYPE, type ScreenDocBridgeOptions, type ScreenDocNode, type ScreenDocOp, ScreensActivityBridge, type ScreensActivityBridgeProps, SessionDescriptor, ShareControls, type ShareControlsProps, SimulateUsersButton, type SimulateUsersButtonProps, ToolHost, type UseCoBrowseSessionOptions, buildAgentPrompt, registerScreenDocBridge, useCoBrowseSession };
522
+ export { type AgentActivity, AgentActivityHighlight, type AgentActivityHighlightProps, AgentCursor, type AgentCursorProps, AgentPanel, type AgentPanelProps, type BridgeContribution, BridgeContributions, BridgedForm, type BridgedFormProps, CoBrowseCursorLayer, type CoBrowseCursorLayerProps, CoBrowsePresence, type CoBrowsePresenceProps, type CoBrowseSession, type CoBrowseUserEvent, FormFieldDescriptor, MicroMcpServer, NavigationBridgeAdapter, RelayState, ScreensActivityBridge, type ScreensActivityBridgeProps, SessionDescriptor, ShareControls, type ShareControlsProps, SimulateUsersButton, type SimulateUsersButtonProps, type UseCoBrowseSessionOptions, buildAgentPrompt, useCoBrowseSession };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,11 @@
1
1
  import { M as MicroMcpServer } from './server-vq6qVl3T.js';
2
2
  export { a as McpServerOptions, T as Transport, e as errorResult, r as rpcError, t as textResult } from './server-vq6qVl3T.js';
3
- import { T as ToolHost } from './tool-host-LYfdPE8u.js';
4
- export { a as ToolRegistry } from './tool-host-LYfdPE8u.js';
3
+ export { T as ToolHost, a as ToolRegistry } from './tool-host-LYfdPE8u.js';
5
4
  export { InProcessTransport, RelayChannel, RelayTransport, attachInProcess, attachRelay } from './mcp/index.js';
6
5
  export { C as CallToolResult, d as ContentBlock, I as InitializeResult, J as JsonObject, c as JsonRpcMessage, e as JsonRpcNotification, f as JsonRpcRequest, g as JsonValue, M as MCP_PROTOCOL_VERSION, b as ServerCapabilities, S as ServerInfo, h as ToolCallContext, T as ToolDefinition, a as ToolHandler } from './types-gzIpsUDE.js';
7
6
  export { HumanPlusDisposition, HumanPlusEvent, HumanPlusEventPage, HumanPlusEventQuery, HumanPlusEventStore, MemoryHumanPlusEventStore, NewHumanPlusEvent } from './human-plus/index.js';
8
7
  export { TuiBridgeOptions, TuiSurfaceRegistryLike, registerTuiBridge } from './bridges/tui.js';
9
- import { B as Bridge } from './types-VX_9je7w.js';
10
- export { a as BridgeFactory } from './types-VX_9je7w.js';
8
+ export { B as Bridge, a as BridgeFactory } from './types-VX_9je7w.js';
11
9
  import { FormFieldDescriptor } from './bridges/forms.js';
12
10
  export { FormBridgeAdapter, FormBridgeOptions, registerFormBridge } from './bridges/forms.js';
13
11
  export { SheetsBridgeAdapter, SheetsBridgeOptions, registerSheetsBridge } from './bridges/sheets.js';
@@ -16,7 +14,7 @@ export { CodeBridgeAdapter, CodeBridgeOptions, registerCodeBridge } from './brid
16
14
  export { ChartsBridgeAdapter, ChartsBridgeOptions, registerChartsBridge } from './bridges/charts.js';
17
15
  export { GridBridgeAdapter, GridBridgeOptions, GridFilter, GridPagination, GridSort, GridState, registerGridBridge } from './bridges/grid.js';
18
16
  export { SceneBridgeAdapter, SceneBridgeOptions, SceneCamera, SceneObject, SceneObjectKind, SceneState, registerSceneBridge } from './bridges/scene.js';
19
- export { ScreenSnapshot, ScreensBridgeAdapter, ScreensBridgeOptions, registerScreensBridge } from './bridges/screens.js';
17
+ export { ScreenCreateSpec, ScreenSnapshot, ScreensAdapterCommit, ScreensAdapterResult, ScreensBridgeAdapter, ScreensBridgeOptions, registerScreensBridge } from './bridges/screens.js';
20
18
  export { SlidesBridgeAdapter, SlidesBridgeOptions, registerSlidesBridge } from './bridges/slides.js';
21
19
  export { MapBridgeAdapter, MapBridgeOptions, registerMapBridge } from './bridges/map.js';
22
20
  export { GitBridgeAdapter, GitBridgeOptions, GitProposal, registerGitBridge } from './bridges/git.js';
@@ -27,10 +25,9 @@ export { NavigationBridgeOptions, NavigationConfirmRequest, PageAction, PageRead
27
25
  export { CatalogBridgeAdapter, CatalogBridgeOptions, CatalogCheckoutArgs, CatalogPrice, CatalogProduct, registerCatalogBridge } from './bridges/catalog.js';
28
26
  export { FeatureDefinition, FeatureGrant, FeaturesBridgeAdapter, FeaturesBridgeOptions, registerFeaturesBridge } from './bridges/features.js';
29
27
  export { PASSKEY_BRIDGE_TOOLS, PasskeyBridgeAdapter, PasskeyBridgeOptions, PasskeyProposal, PasskeySummaryLike, PasskeySupport, PasskeySurfaceState, registerPasskeyBridge } from './bridges/passkeys.js';
30
- import { DocAdapter } from './bridges/doc.js';
31
- export { DocBridgeOptions, DocOpTool, registerDocBridge } from './bridges/doc.js';
28
+ export { DocAdapter, DocBridgeOptions, DocOpTool, registerDocBridge } from './bridges/doc.js';
32
29
  export { CmsBridgeOptions, CmsOp, cmsReducer, registerCmsBridge } from './bridges/cms.js';
33
- import { DocNode, StagePolicy, TreeOp } from '@particle-academy/fancy-doc-commons';
30
+ export { SCREEN_TEXT_NODE_TYPE, ScreenDocBridgeOptions, ScreenDocNode, ScreenDocOp, registerScreenDocBridge } from './bridges/screen-doc.js';
34
31
  import { RelayState } from './sharing/index.js';
35
32
  export { SseRelayOptions, SseRelayTransport, attachSseRelay } from './sharing/index.js';
36
33
  import { S as SessionDescriptor } from './token-BZ8doMam.js';
@@ -46,46 +43,7 @@ export { CLAUDE_CONNECTORS_URL, CONNECTOR_GLYPHS, CONNECTOR_TARGETS, ClaudeMark,
46
43
  export { D as DEFAULT_MCPB_ENTRY_POINT, b as MCPB_MANIFEST_VERSION, c as MCPB_MIN_NODE, M as McpbManifestInput, a as McpbTool, d as buildMcpbManifest, e as buildMcpbProxyStub } from './mcpb-BXOrsRnv.js';
47
44
  import '@particle-academy/fancy-sheets';
48
45
  import '@particle-academy/fancy-slides';
49
-
50
- /**
51
- * Reserved node type for a literal string child. Must match fancy-screens'
52
- * `TEXT_NODE_TYPE`; duplicated rather than imported to keep this bridge free of
53
- * a fancy-screens dependency.
54
- */
55
- declare const SCREEN_TEXT_NODE_TYPE = "#text";
56
- /** A screen document node — a `DocNode` plus the minted-id flag. */
57
- interface ScreenDocNode extends DocNode {
58
- /**
59
- * True when fancy-screens minted this id because the author supplied none.
60
- * A synthetic id is derived from position, so it is not a durable handle.
61
- */
62
- synthetic?: boolean;
63
- }
64
- type ScreenDocOp = TreeOp<ScreenDocNode>;
65
- interface ScreenDocBridgeOptions {
66
- adapter: DocAdapter<ScreenDocNode>;
67
- /**
68
- * Tool-name prefix. Default `"screen"` → `screen_add`, `screen_set_text`, …
69
- *
70
- * Tool names are global, so a host wiring more than one doc-driven screen at
71
- * once must give each a distinct prefix (`"screen_checkout"`).
72
- */
73
- surface?: string;
74
- agent?: {
75
- id: string;
76
- name?: string;
77
- color?: string;
78
- };
79
- /** Auto-apply vs. confirm per op (trust-but-verify). Default: auto. */
80
- stagePolicy?: StagePolicy<ScreenDocOp>;
81
- onPending?: (staged: {
82
- id: string;
83
- op: ScreenDocOp;
84
- label: string;
85
- }) => void;
86
- }
87
- /** Register the screen-content bridge (prefix `screen_`) over a screen's `DocTree`. */
88
- declare function registerScreenDocBridge(host: ToolHost, options: ScreenDocBridgeOptions): Bridge;
46
+ import '@particle-academy/fancy-doc-commons';
89
47
 
90
48
  /**
91
49
  * A page's contribution to the shared tool surface.
@@ -561,4 +519,4 @@ type SimulateUsersButtonProps = {
561
519
  */
562
520
  declare function SimulateUsersButton({ endpoint, count, label, csrfToken, onTriggered, onError, className, style, }: SimulateUsersButtonProps): react.JSX.Element;
563
521
 
564
- export { type AgentActivity, AgentActivityHighlight, type AgentActivityHighlightProps, AgentCursor, type AgentCursorProps, AgentPanel, type AgentPanelProps, Bridge, type BridgeContribution, BridgeContributions, BridgedForm, type BridgedFormProps, CoBrowseCursorLayer, type CoBrowseCursorLayerProps, CoBrowsePresence, type CoBrowsePresenceProps, type CoBrowseSession, type CoBrowseUserEvent, DocAdapter, FormFieldDescriptor, MicroMcpServer, NavigationBridgeAdapter, RelayState, SCREEN_TEXT_NODE_TYPE, type ScreenDocBridgeOptions, type ScreenDocNode, type ScreenDocOp, ScreensActivityBridge, type ScreensActivityBridgeProps, SessionDescriptor, ShareControls, type ShareControlsProps, SimulateUsersButton, type SimulateUsersButtonProps, ToolHost, type UseCoBrowseSessionOptions, buildAgentPrompt, registerScreenDocBridge, useCoBrowseSession };
522
+ export { type AgentActivity, AgentActivityHighlight, type AgentActivityHighlightProps, AgentCursor, type AgentCursorProps, AgentPanel, type AgentPanelProps, type BridgeContribution, BridgeContributions, BridgedForm, type BridgedFormProps, CoBrowseCursorLayer, type CoBrowseCursorLayerProps, CoBrowsePresence, type CoBrowsePresenceProps, type CoBrowseSession, type CoBrowseUserEvent, FormFieldDescriptor, MicroMcpServer, NavigationBridgeAdapter, RelayState, ScreensActivityBridge, type ScreensActivityBridgeProps, SessionDescriptor, ShareControls, type ShareControlsProps, SimulateUsersButton, type SimulateUsersButtonProps, type UseCoBrowseSessionOptions, buildAgentPrompt, useCoBrowseSession };
package/dist/index.js CHANGED
@@ -5,6 +5,9 @@ import { createSessionDescriptor, attachSseRelay } from './chunk-6TZ5IBRN.js';
5
5
  export { SseRelayTransport, attachSseRelay, buildShareConfig, buildShareUrl, createSessionDescriptor, describeSession, readSessionFromUrl } from './chunk-6TZ5IBRN.js';
6
6
  export { attachHeuristicsSink, mapActivityToEvent as mapActivityToHeuristicsEvent } from './chunk-7R6RMROL.js';
7
7
  export { useUndoStack } from './chunk-3WVXAB3D.js';
8
+ export { registerTuiBridge } from './chunk-JLHVQWOV.js';
9
+ import { useAgentActivity } from './chunk-UCKJAUBY.js';
10
+ export { useAgentActivity, useAgentActivityForScreen } from './chunk-UCKJAUBY.js';
8
11
  import { registerNavigationBridge } from './chunk-OHNGURUJ.js';
9
12
  export { registerNavigationBridge } from './chunk-OHNGURUJ.js';
10
13
  export { MemoryHumanPlusEventStore } from './chunk-PMI4C5S4.js';
@@ -12,25 +15,22 @@ export { useSheetsActivityHighlights, useSheetsAdapter } from './chunk-KHKSQEMC.
12
15
  import { ConnectorButtons } from './chunk-5HNTNIWY.js';
13
16
  export { CLAUDE_CONNECTORS_URL, CONNECTOR_GLYPHS, CONNECTOR_TARGETS, ClaudeMark, ConnectorButtons, CursorMark, DesktopMark, VscodeMark, WrenchMark, buildCursorDeeplink, buildManualConfig, buildManualConfigSnippet, buildVscodeDeeplink, connectorHref, encodeBase64Json, slugifyServerName } from './chunk-5HNTNIWY.js';
14
17
  export { DEFAULT_MCPB_ENTRY_POINT, MCPB_MANIFEST_VERSION, MCPB_MIN_NODE, buildMcpbManifest, buildMcpbProxyStub } from './chunk-GO2Y6H6U.js';
18
+ export { registerGitBridge } from './chunk-AXWMWYH5.js';
15
19
  export { registerFilesBridge } from './chunk-Z5NL5D4J.js';
16
20
  export { registerTerminalBridge } from './chunk-5ZWNCHZS.js';
17
21
  export { registerCatalogBridge } from './chunk-CS3CHGYC.js';
18
22
  export { registerFeaturesBridge } from './chunk-GVTBMJU6.js';
19
23
  export { PASSKEY_BRIDGE_TOOLS, registerPasskeyBridge } from './chunk-G6CRHFWU.js';
20
24
  export { cmsReducer, registerCmsBridge } from './chunk-SWWJUOCY.js';
21
- import { registerDocBridge } from './chunk-3HVYUMQF.js';
22
- export { registerDocBridge } from './chunk-3HVYUMQF.js';
23
- export { registerTuiBridge } from './chunk-JLHVQWOV.js';
24
- import { useAgentActivity } from './chunk-UCKJAUBY.js';
25
- export { useAgentActivity, useAgentActivityForScreen } from './chunk-UCKJAUBY.js';
26
25
  export { registerCodeBridge } from './chunk-FCXSR7I5.js';
27
26
  export { registerChartsBridge } from './chunk-36MKPTVD.js';
28
27
  export { registerGridBridge } from './chunk-MIDZWKIF.js';
29
28
  export { registerSceneBridge } from './chunk-RVMM4BHK.js';
30
- export { registerScreensBridge } from './chunk-7NVATRLE.js';
29
+ export { registerScreensBridge } from './chunk-HOZCDDRA.js';
30
+ export { SCREEN_TEXT_NODE_TYPE, registerScreenDocBridge } from './chunk-5JLTXHX6.js';
31
+ export { registerDocBridge } from './chunk-3HVYUMQF.js';
31
32
  export { registerSlidesBridge } from './chunk-VMRUW4B4.js';
32
33
  export { registerMapBridge } from './chunk-3UUF5KKZ.js';
33
- export { registerGitBridge } from './chunk-AXWMWYH5.js';
34
34
  export { RelayTransport, attachRelay } from './chunk-G6N2TQVO.js';
35
35
  import { attachInProcess } from './chunk-AFUULW5E.js';
36
36
  export { InProcessTransport, attachInProcess } from './chunk-AFUULW5E.js';
@@ -41,98 +41,12 @@ export { clearStack as clearUndoStack, ensureUndoToolsRegistered, pushUndoEntry,
41
41
  export { wrapToolWithActivity } from './chunk-2VENWGLZ.js';
42
42
  import { emitActivity, onActivity } from './chunk-C3TYI5TJ.js';
43
43
  export { emitActivity, onActivity, readActivityHistory, resetActivityRegistry } from './chunk-C3TYI5TJ.js';
44
- import { textResult, MicroMcpServer } from './chunk-CZV3WUW5.js';
44
+ import { MicroMcpServer } from './chunk-CZV3WUW5.js';
45
45
  export { MCP_PROTOCOL_VERSION, MicroMcpServer, ToolRegistry, errorResult, rpcError, textResult } from './chunk-CZV3WUW5.js';
46
- import { childrenOf, appendOrder } from '@particle-academy/fancy-doc-commons';
47
46
  import { useRef, useState, useEffect, useCallback, useMemo } from 'react';
48
47
  import { jsx, jsxs } from 'react/jsx-runtime';
49
48
  import { createPortal } from 'react-dom';
50
49
 
51
- var SCREEN_TEXT_NODE_TYPE = "#text";
52
- function registerScreenDocBridge(host, options) {
53
- const { adapter } = options;
54
- const surface = options.surface ?? "screen";
55
- const setText = {
56
- verb: "set_text",
57
- description: "Replace the literal text of an element node \u2014 the natural way to change a label, heading or paragraph. Pass the ELEMENT's id, not the text node's.",
58
- properties: {
59
- id: { type: "string", description: "Id of the element whose text to set." },
60
- text: { type: "string" }
61
- },
62
- required: ["id", "text"],
63
- build: (args, tree) => {
64
- const id = String(args.id);
65
- const node = tree.nodes[id];
66
- if (!node) return { error: `No node ${id}` };
67
- if (node.type === SCREEN_TEXT_NODE_TYPE) {
68
- return { t: "set_props", id, patch: { value: String(args.text) } };
69
- }
70
- const texts = childrenOf(tree, id).filter((c) => c.type === SCREEN_TEXT_NODE_TYPE);
71
- if (texts.length === 1) {
72
- return { t: "set_props", id: texts[0].id, patch: { value: String(args.text) } };
73
- }
74
- if (texts.length === 0) {
75
- return {
76
- t: "insert",
77
- node: {
78
- id: `${id}-text`,
79
- type: SCREEN_TEXT_NODE_TYPE,
80
- parent: id,
81
- order: appendOrder(tree, id),
82
- props: { value: String(args.text) }
83
- }
84
- };
85
- }
86
- return {
87
- error: `Node ${id} has ${texts.length} text children (${texts.map((t) => t.id).join(", ")}) \u2014 set_text on the one you mean`
88
- };
89
- },
90
- targetId: (args) => String(args.id)
91
- };
92
- const bridge = registerDocBridge(host, {
93
- adapter,
94
- surface,
95
- agent: options.agent,
96
- stagePolicy: options.stagePolicy,
97
- onPending: options.onPending,
98
- // Anything the AGENT adds is authored by definition — it chose or was given
99
- // the id — so it must not inherit the synthetic flag from its neighbours.
100
- makeNode: ({ id, type, parent, order }, props) => ({ id, type, parent, order, props }),
101
- describeNode: (n) => ({
102
- id: n.id,
103
- type: n.type,
104
- parent: n.parent,
105
- ...n.synthetic ? { synthetic: true } : {},
106
- ...n.type === SCREEN_TEXT_NODE_TYPE ? { text: String(n.props?.value ?? "") } : { props: Object.keys(n.props ?? {}) }
107
- }),
108
- opTools: [setText]
109
- });
110
- const disposeAddressable = host.registerTool(
111
- {
112
- name: `${surface}_addressable`,
113
- description: "List the node ids that are safe to remember and use later. Ids NOT listed here were minted from a node's position: they resolve today and silently point at a different node once a sibling is inserted above them. Address those in the same turn you read them, and never store one.",
114
- inputSchema: { type: "object", properties: {}, required: [], additionalProperties: false }
115
- },
116
- (async () => {
117
- const nodes = Object.values(adapter.get().nodes);
118
- const authored = nodes.filter((n) => !n.synthetic).map((n) => ({ id: n.id, type: n.type }));
119
- const syntheticCount = nodes.length - authored.length;
120
- return textResult(
121
- authored.length ? `${authored.length} addressable, ${syntheticCount} positional` : `no addressable ids \u2014 all ${syntheticCount} nodes are positional`,
122
- { addressable: authored, syntheticCount }
123
- );
124
- })
125
- );
126
- return {
127
- id: surface,
128
- title: "Screen content",
129
- dispose: () => {
130
- disposeAddressable();
131
- bridge.dispose();
132
- }
133
- };
134
- }
135
-
136
50
  // src/sharing/bridge-contributions.ts
137
51
  var BridgeContributions = class {
138
52
  constructor() {
@@ -593,6 +507,6 @@ function SimulateUsersButton({
593
507
  );
594
508
  }
595
509
 
596
- export { BridgeContributions, BridgedForm, CoBrowseCursorLayer, CoBrowsePresence, SCREEN_TEXT_NODE_TYPE, ScreensActivityBridge, SimulateUsersButton, registerScreenDocBridge, useCoBrowseSession };
510
+ export { BridgeContributions, BridgedForm, CoBrowseCursorLayer, CoBrowsePresence, ScreensActivityBridge, SimulateUsersButton, useCoBrowseSession };
597
511
  //# sourceMappingURL=index.js.map
598
512
  //# sourceMappingURL=index.js.map