@particle-academy/agent-integrations 0.2.4 → 0.3.4
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/bridges/charts.d.cts +39 -0
- package/dist/bridges/charts.d.ts +39 -0
- package/dist/bridges/code.d.cts +47 -0
- package/dist/bridges/code.d.ts +47 -0
- package/dist/bridges/flow.d.cts +3 -2
- package/dist/bridges/flow.d.ts +3 -2
- package/dist/bridges/forms.d.cts +76 -0
- package/dist/bridges/forms.d.ts +76 -0
- package/dist/bridges/scene.d.cts +54 -0
- package/dist/bridges/scene.d.ts +54 -0
- package/dist/bridges/sheets.d.cts +62 -0
- package/dist/bridges/sheets.d.ts +62 -0
- package/dist/bridges/whiteboard.d.cts +3 -2
- package/dist/bridges/whiteboard.d.ts +3 -2
- package/dist/bridges-charts.cjs +167 -0
- package/dist/bridges-charts.cjs.map +1 -0
- package/dist/bridges-charts.js +6 -0
- package/dist/bridges-charts.js.map +1 -0
- package/dist/bridges-code.cjs +219 -0
- package/dist/bridges-code.cjs.map +1 -0
- package/dist/bridges-code.js +6 -0
- package/dist/bridges-code.js.map +1 -0
- package/dist/bridges-flow.cjs +76 -17
- package/dist/bridges-flow.cjs.map +1 -1
- package/dist/bridges-flow.js +3 -1
- package/dist/bridges-forms.cjs +205 -0
- package/dist/bridges-forms.cjs.map +1 -0
- package/dist/bridges-forms.js +6 -0
- package/dist/bridges-forms.js.map +1 -0
- package/dist/bridges-scene.cjs +250 -0
- package/dist/bridges-scene.cjs.map +1 -0
- package/dist/bridges-scene.js +6 -0
- package/dist/bridges-scene.js.map +1 -0
- package/dist/bridges-sheets.cjs +327 -0
- package/dist/bridges-sheets.cjs.map +1 -0
- package/dist/bridges-sheets.js +6 -0
- package/dist/bridges-sheets.js.map +1 -0
- package/dist/bridges-whiteboard.cjs +224 -38
- package/dist/bridges-whiteboard.cjs.map +1 -1
- package/dist/bridges-whiteboard.js +4 -1
- package/dist/{chunk-2VOQJKSU.js → chunk-4IAVAFUV.js} +41 -19
- package/dist/chunk-4IAVAFUV.js.map +1 -0
- package/dist/chunk-52S7XYZK.js +38 -0
- package/dist/chunk-52S7XYZK.js.map +1 -0
- package/dist/chunk-ACBENYYO.js +124 -0
- package/dist/chunk-ACBENYYO.js.map +1 -0
- package/dist/chunk-DJOWMF6Q.js +25 -0
- package/dist/chunk-DJOWMF6Q.js.map +1 -0
- package/dist/{chunk-FLEOQUKF.js → chunk-JMYPUAFH.js} +17 -2
- package/dist/chunk-JMYPUAFH.js.map +1 -0
- package/dist/chunk-JU2N4KK6.js +34 -0
- package/dist/chunk-JU2N4KK6.js.map +1 -0
- package/dist/chunk-OEIULP2L.js +158 -0
- package/dist/chunk-OEIULP2L.js.map +1 -0
- package/dist/chunk-PDBF4W7E.js +280 -0
- package/dist/chunk-PDBF4W7E.js.map +1 -0
- package/dist/chunk-PHPXKSWI.js +120 -0
- package/dist/chunk-PHPXKSWI.js.map +1 -0
- package/dist/chunk-QJUTISFC.js +203 -0
- package/dist/chunk-QJUTISFC.js.map +1 -0
- package/dist/{chunk-5ZUHNNLR.js → chunk-TBEITXF4.js} +79 -41
- package/dist/chunk-TBEITXF4.js.map +1 -0
- package/dist/chunk-X66JWQBB.js +37 -0
- package/dist/chunk-X66JWQBB.js.map +1 -0
- package/dist/chunk-XYYSTJHW.js +172 -0
- package/dist/chunk-XYYSTJHW.js.map +1 -0
- package/dist/index.cjs +1411 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +96 -3
- package/dist/index.d.ts +96 -3
- package/dist/index.js +111 -7
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.cts +4 -2
- package/dist/mcp/index.d.ts +4 -2
- package/dist/presence/index.d.cts +136 -0
- package/dist/presence/index.d.ts +136 -0
- package/dist/presence.cjs +107 -0
- package/dist/presence.cjs.map +1 -0
- package/dist/presence.js +5 -0
- package/dist/presence.js.map +1 -0
- package/dist/registry-2DRURS6U.js +3 -0
- package/dist/registry-2DRURS6U.js.map +1 -0
- package/dist/server-BJu_AMH3.d.ts +64 -0
- package/dist/server-si-VvFxI.d.cts +64 -0
- package/dist/sharing/index.d.cts +2 -1
- package/dist/sharing/index.d.ts +2 -1
- package/dist/sharing.cjs +68 -0
- package/dist/sharing.cjs.map +1 -1
- package/dist/sharing.js +1 -1
- package/dist/styles.css +57 -0
- package/dist/styles.css.map +1 -1
- package/dist/{types-DR5AS6Rd.d.cts → types-Bf1ZoGmI.d.cts} +1 -1
- package/dist/{types-CRPA_D0z.d.ts → types-DXKpLuia.d.ts} +1 -1
- package/dist/types-DksGd5Y7.d.cts +112 -0
- package/dist/types-DksGd5Y7.d.ts +112 -0
- package/dist/undo/index.d.cts +69 -0
- package/dist/undo/index.d.ts +69 -0
- package/dist/undo.cjs +163 -0
- package/dist/undo.cjs.map +1 -0
- package/dist/undo.js +5 -0
- package/dist/undo.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-2VOQJKSU.js.map +0 -1
- package/dist/chunk-5ZUHNNLR.js.map +0 -1
- package/dist/chunk-FLEOQUKF.js.map +0 -1
- package/dist/server-Bv985us3.d.cts +0 -173
- package/dist/server-Bv985us3.d.ts +0 -173
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import { M as MicroMcpServer } from './server-si-VvFxI.cjs';
|
|
2
|
+
export { a as McpServerOptions, T as Transport, e as errorResult, r as rpcError, t as textResult } from './server-si-VvFxI.cjs';
|
|
2
3
|
export { InProcessTransport, RelayChannel, RelayTransport, attachInProcess, attachRelay } from './mcp/index.cjs';
|
|
3
|
-
export {
|
|
4
|
+
export { C as CallToolResult, c as ContentBlock, I as InitializeResult, d as JsonObject, J as JsonRpcMessage, e as JsonRpcNotification, f as JsonRpcRequest, g as JsonValue, M as MCP_PROTOCOL_VERSION, a as ServerCapabilities, S as ServerInfo, T as ToolDefinition, b as ToolHandler } from './types-DksGd5Y7.cjs';
|
|
5
|
+
export { B as Bridge, a as BridgeFactory } from './types-Bf1ZoGmI.cjs';
|
|
4
6
|
export { WhiteboardBridgeAdapter, WhiteboardBridgeOptions, registerWhiteboardBridge } from './bridges/whiteboard.cjs';
|
|
5
7
|
export { FlowBridgeAdapter, FlowBridgeOptions, registerFlowBridge } from './bridges/flow.cjs';
|
|
8
|
+
import { FormFieldDescriptor } from './bridges/forms.cjs';
|
|
9
|
+
export { FormBridgeAdapter, FormBridgeOptions, registerFormBridge } from './bridges/forms.cjs';
|
|
10
|
+
export { SheetsBridgeAdapter, SheetsBridgeOptions, registerSheetsBridge } from './bridges/sheets.cjs';
|
|
11
|
+
export { CodeBridgeAdapter, CodeBridgeOptions, registerCodeBridge } from './bridges/code.cjs';
|
|
12
|
+
export { ChartsBridgeAdapter, ChartsBridgeOptions, registerChartsBridge } from './bridges/charts.cjs';
|
|
13
|
+
export { SceneBridgeAdapter, SceneBridgeOptions, SceneCamera, SceneObject, SceneObjectKind, SceneState, registerSceneBridge } from './bridges/scene.cjs';
|
|
6
14
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
15
|
import { ReactNode, CSSProperties } from 'react';
|
|
8
16
|
import { SessionDescriptor } from './sharing/index.cjs';
|
|
9
17
|
export { RelayState, SseRelayOptions, SseRelayTransport, attachSseRelay, buildShareConfig, buildShareUrl, createSessionDescriptor, describeSession, readSessionFromUrl } from './sharing/index.cjs';
|
|
10
18
|
import { StickyNoteItem, ShapeItem, ConnectorItem, Stroke, Viewport } from '@particle-academy/fancy-whiteboard';
|
|
19
|
+
export { ActivityAgent, ActivityFilter, ActivityResolverContext, ActivityTargetResolver, ToolHandler as ActivityWrappedHandler, AgentActivityEvent, AgentActivityListener, AgentTarget, AgentTargetKind, emitActivity, onActivity, readActivityHistory, resetActivityRegistry, useAgentActivity, useAgentActivityForScreen, wrapToolWithActivity } from './presence/index.cjs';
|
|
20
|
+
export { UndoEntry, UndoToolsOptions, clearStack as clearUndoStack, ensureUndoToolsRegistered, pushUndoEntry, readHistory as readUndoHistory, redoOne, registerUndoTools, resetAllUndoStacks, undoOne, useUndoStack } from './undo/index.cjs';
|
|
11
21
|
|
|
12
22
|
type AgentActivity = {
|
|
13
23
|
id: string;
|
|
@@ -85,6 +95,89 @@ type AgentActivityHighlightProps = {
|
|
|
85
95
|
*/
|
|
86
96
|
declare function AgentActivityHighlight({ x, y, width, height, pulseKey, color, duration, className, style, }: AgentActivityHighlightProps): react_jsx_runtime.JSX.Element | null;
|
|
87
97
|
|
|
98
|
+
type BridgedFormProps = {
|
|
99
|
+
/** Stable id for this form. Used by agents in `form_*` tool calls. */
|
|
100
|
+
id: string;
|
|
101
|
+
/** Human title (also surfaced as the bridge title). */
|
|
102
|
+
title?: string;
|
|
103
|
+
/** Optional fancy-screens screen id this form lives in. */
|
|
104
|
+
screenId?: string;
|
|
105
|
+
/** Field descriptors — drives the agent-facing schema. */
|
|
106
|
+
fields: FormFieldDescriptor[];
|
|
107
|
+
/** Controlled values. */
|
|
108
|
+
values: Record<string, unknown>;
|
|
109
|
+
/** Setter — hosts pass their setState. */
|
|
110
|
+
onChange: (next: Record<string, unknown>) => void;
|
|
111
|
+
/** Optional submit handler. */
|
|
112
|
+
onSubmit?: () => Promise<{
|
|
113
|
+
ok: boolean;
|
|
114
|
+
values?: Record<string, unknown>;
|
|
115
|
+
error?: string;
|
|
116
|
+
}>;
|
|
117
|
+
/** The MicroMcpServer the bridge registers against. Pass null/undefined
|
|
118
|
+
* to render without a bridge (useful for stories / non-shared use). */
|
|
119
|
+
server?: MicroMcpServer | null;
|
|
120
|
+
/** Identity used in activity events. */
|
|
121
|
+
agent?: {
|
|
122
|
+
id: string;
|
|
123
|
+
name?: string;
|
|
124
|
+
color?: string;
|
|
125
|
+
};
|
|
126
|
+
children: ReactNode;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* BridgedForm — wraps a react-fancy form (or any controlled inputs)
|
|
130
|
+
* with a `registerFormBridge` lifecycle. Children render the actual form
|
|
131
|
+
* using `values` + `onChange`; this component only manages the bridge.
|
|
132
|
+
*
|
|
133
|
+
* Hosts use it like:
|
|
134
|
+
*
|
|
135
|
+
* <BridgedForm id="signup" fields={...} values={values} onChange={setValues} server={server}>
|
|
136
|
+
* <Field><Input value={values.email} onValueChange={(v) => onChange({ ...values, email: v })} /></Field>
|
|
137
|
+
* ...
|
|
138
|
+
* </BridgedForm>
|
|
139
|
+
*
|
|
140
|
+
* Agents can then call form_describe, form_set_value, form_submit, etc.
|
|
141
|
+
*/
|
|
142
|
+
declare function BridgedForm({ id, title, screenId, fields, values, onChange, onSubmit, server, agent, children, }: BridgedFormProps): react_jsx_runtime.JSX.Element;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Loose shape of the fancy-screens system context — kept here so this
|
|
146
|
+
* component doesn't hard-import `@particle-academy/fancy-screens`.
|
|
147
|
+
*/
|
|
148
|
+
type ScreenSystemLike = {
|
|
149
|
+
registry: Map<string, {
|
|
150
|
+
id: string;
|
|
151
|
+
agentActivity?: unknown;
|
|
152
|
+
}>;
|
|
153
|
+
updateScreen: (id: string, patch: {
|
|
154
|
+
agentActivity?: unknown;
|
|
155
|
+
}) => void;
|
|
156
|
+
};
|
|
157
|
+
type ScreensActivityBridgeProps = {
|
|
158
|
+
/** The value returned by `useScreenSystem()` from fancy-screens. */
|
|
159
|
+
system: ScreenSystemLike;
|
|
160
|
+
/** ms to wait after the last activity before clearing the screen's badge. Default 1500. */
|
|
161
|
+
fadeMs?: number;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* ScreensActivityBridge — subscribe to the in-process activity registry
|
|
165
|
+
* and patch each event into the matching screen's `agentActivity` field.
|
|
166
|
+
* Fade-out clears the badge after `fadeMs`.
|
|
167
|
+
*
|
|
168
|
+
* Use it once near the root of your app, ABOVE every <Screen>:
|
|
169
|
+
*
|
|
170
|
+
* const system = useScreenSystem();
|
|
171
|
+
* <>
|
|
172
|
+
* <ScreensActivityBridge system={system} />
|
|
173
|
+
* <Screen id="dashboard">…</Screen>
|
|
174
|
+
* <Screen id="form">…</Screen>
|
|
175
|
+
* </>
|
|
176
|
+
*
|
|
177
|
+
* Renders nothing; pure side-effect component.
|
|
178
|
+
*/
|
|
179
|
+
declare function ScreensActivityBridge({ system, fadeMs }: ScreensActivityBridgeProps): null;
|
|
180
|
+
|
|
88
181
|
type ShareControlsProps = {
|
|
89
182
|
/** The active session, or null when not sharing yet. */
|
|
90
183
|
session: SessionDescriptor | null;
|
|
@@ -152,4 +245,4 @@ type SharedWhiteboardProps = {
|
|
|
152
245
|
*/
|
|
153
246
|
declare function SharedWhiteboard({ initialNotes, initialShapes, initialConnectors, initialStrokes, initialViewport, agent, shareBaseUrl, onRegisterSession, showAgentPanel, showShareControls, broadcastEdits, height, header, className, style, }: SharedWhiteboardProps): react_jsx_runtime.JSX.Element;
|
|
154
247
|
|
|
155
|
-
export { type AgentActivity, AgentActivityHighlight, type AgentActivityHighlightProps, AgentCursor, type AgentCursorProps, AgentPanel, type AgentPanelProps, SessionDescriptor, ShareControls, type ShareControlsProps, SharedWhiteboard, type SharedWhiteboardProps };
|
|
248
|
+
export { type AgentActivity, AgentActivityHighlight, type AgentActivityHighlightProps, AgentCursor, type AgentCursorProps, AgentPanel, type AgentPanelProps, BridgedForm, type BridgedFormProps, FormFieldDescriptor, MicroMcpServer, ScreensActivityBridge, type ScreensActivityBridgeProps, SessionDescriptor, ShareControls, type ShareControlsProps, SharedWhiteboard, type SharedWhiteboardProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import { M as MicroMcpServer } from './server-BJu_AMH3.js';
|
|
2
|
+
export { a as McpServerOptions, T as Transport, e as errorResult, r as rpcError, t as textResult } from './server-BJu_AMH3.js';
|
|
2
3
|
export { InProcessTransport, RelayChannel, RelayTransport, attachInProcess, attachRelay } from './mcp/index.js';
|
|
3
|
-
export {
|
|
4
|
+
export { C as CallToolResult, c as ContentBlock, I as InitializeResult, d as JsonObject, J as JsonRpcMessage, e as JsonRpcNotification, f as JsonRpcRequest, g as JsonValue, M as MCP_PROTOCOL_VERSION, a as ServerCapabilities, S as ServerInfo, T as ToolDefinition, b as ToolHandler } from './types-DksGd5Y7.js';
|
|
5
|
+
export { B as Bridge, a as BridgeFactory } from './types-DXKpLuia.js';
|
|
4
6
|
export { WhiteboardBridgeAdapter, WhiteboardBridgeOptions, registerWhiteboardBridge } from './bridges/whiteboard.js';
|
|
5
7
|
export { FlowBridgeAdapter, FlowBridgeOptions, registerFlowBridge } from './bridges/flow.js';
|
|
8
|
+
import { FormFieldDescriptor } from './bridges/forms.js';
|
|
9
|
+
export { FormBridgeAdapter, FormBridgeOptions, registerFormBridge } from './bridges/forms.js';
|
|
10
|
+
export { SheetsBridgeAdapter, SheetsBridgeOptions, registerSheetsBridge } from './bridges/sheets.js';
|
|
11
|
+
export { CodeBridgeAdapter, CodeBridgeOptions, registerCodeBridge } from './bridges/code.js';
|
|
12
|
+
export { ChartsBridgeAdapter, ChartsBridgeOptions, registerChartsBridge } from './bridges/charts.js';
|
|
13
|
+
export { SceneBridgeAdapter, SceneBridgeOptions, SceneCamera, SceneObject, SceneObjectKind, SceneState, registerSceneBridge } from './bridges/scene.js';
|
|
6
14
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
15
|
import { ReactNode, CSSProperties } from 'react';
|
|
8
16
|
import { SessionDescriptor } from './sharing/index.js';
|
|
9
17
|
export { RelayState, SseRelayOptions, SseRelayTransport, attachSseRelay, buildShareConfig, buildShareUrl, createSessionDescriptor, describeSession, readSessionFromUrl } from './sharing/index.js';
|
|
10
18
|
import { StickyNoteItem, ShapeItem, ConnectorItem, Stroke, Viewport } from '@particle-academy/fancy-whiteboard';
|
|
19
|
+
export { ActivityAgent, ActivityFilter, ActivityResolverContext, ActivityTargetResolver, ToolHandler as ActivityWrappedHandler, AgentActivityEvent, AgentActivityListener, AgentTarget, AgentTargetKind, emitActivity, onActivity, readActivityHistory, resetActivityRegistry, useAgentActivity, useAgentActivityForScreen, wrapToolWithActivity } from './presence/index.js';
|
|
20
|
+
export { UndoEntry, UndoToolsOptions, clearStack as clearUndoStack, ensureUndoToolsRegistered, pushUndoEntry, readHistory as readUndoHistory, redoOne, registerUndoTools, resetAllUndoStacks, undoOne, useUndoStack } from './undo/index.js';
|
|
11
21
|
|
|
12
22
|
type AgentActivity = {
|
|
13
23
|
id: string;
|
|
@@ -85,6 +95,89 @@ type AgentActivityHighlightProps = {
|
|
|
85
95
|
*/
|
|
86
96
|
declare function AgentActivityHighlight({ x, y, width, height, pulseKey, color, duration, className, style, }: AgentActivityHighlightProps): react_jsx_runtime.JSX.Element | null;
|
|
87
97
|
|
|
98
|
+
type BridgedFormProps = {
|
|
99
|
+
/** Stable id for this form. Used by agents in `form_*` tool calls. */
|
|
100
|
+
id: string;
|
|
101
|
+
/** Human title (also surfaced as the bridge title). */
|
|
102
|
+
title?: string;
|
|
103
|
+
/** Optional fancy-screens screen id this form lives in. */
|
|
104
|
+
screenId?: string;
|
|
105
|
+
/** Field descriptors — drives the agent-facing schema. */
|
|
106
|
+
fields: FormFieldDescriptor[];
|
|
107
|
+
/** Controlled values. */
|
|
108
|
+
values: Record<string, unknown>;
|
|
109
|
+
/** Setter — hosts pass their setState. */
|
|
110
|
+
onChange: (next: Record<string, unknown>) => void;
|
|
111
|
+
/** Optional submit handler. */
|
|
112
|
+
onSubmit?: () => Promise<{
|
|
113
|
+
ok: boolean;
|
|
114
|
+
values?: Record<string, unknown>;
|
|
115
|
+
error?: string;
|
|
116
|
+
}>;
|
|
117
|
+
/** The MicroMcpServer the bridge registers against. Pass null/undefined
|
|
118
|
+
* to render without a bridge (useful for stories / non-shared use). */
|
|
119
|
+
server?: MicroMcpServer | null;
|
|
120
|
+
/** Identity used in activity events. */
|
|
121
|
+
agent?: {
|
|
122
|
+
id: string;
|
|
123
|
+
name?: string;
|
|
124
|
+
color?: string;
|
|
125
|
+
};
|
|
126
|
+
children: ReactNode;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* BridgedForm — wraps a react-fancy form (or any controlled inputs)
|
|
130
|
+
* with a `registerFormBridge` lifecycle. Children render the actual form
|
|
131
|
+
* using `values` + `onChange`; this component only manages the bridge.
|
|
132
|
+
*
|
|
133
|
+
* Hosts use it like:
|
|
134
|
+
*
|
|
135
|
+
* <BridgedForm id="signup" fields={...} values={values} onChange={setValues} server={server}>
|
|
136
|
+
* <Field><Input value={values.email} onValueChange={(v) => onChange({ ...values, email: v })} /></Field>
|
|
137
|
+
* ...
|
|
138
|
+
* </BridgedForm>
|
|
139
|
+
*
|
|
140
|
+
* Agents can then call form_describe, form_set_value, form_submit, etc.
|
|
141
|
+
*/
|
|
142
|
+
declare function BridgedForm({ id, title, screenId, fields, values, onChange, onSubmit, server, agent, children, }: BridgedFormProps): react_jsx_runtime.JSX.Element;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Loose shape of the fancy-screens system context — kept here so this
|
|
146
|
+
* component doesn't hard-import `@particle-academy/fancy-screens`.
|
|
147
|
+
*/
|
|
148
|
+
type ScreenSystemLike = {
|
|
149
|
+
registry: Map<string, {
|
|
150
|
+
id: string;
|
|
151
|
+
agentActivity?: unknown;
|
|
152
|
+
}>;
|
|
153
|
+
updateScreen: (id: string, patch: {
|
|
154
|
+
agentActivity?: unknown;
|
|
155
|
+
}) => void;
|
|
156
|
+
};
|
|
157
|
+
type ScreensActivityBridgeProps = {
|
|
158
|
+
/** The value returned by `useScreenSystem()` from fancy-screens. */
|
|
159
|
+
system: ScreenSystemLike;
|
|
160
|
+
/** ms to wait after the last activity before clearing the screen's badge. Default 1500. */
|
|
161
|
+
fadeMs?: number;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* ScreensActivityBridge — subscribe to the in-process activity registry
|
|
165
|
+
* and patch each event into the matching screen's `agentActivity` field.
|
|
166
|
+
* Fade-out clears the badge after `fadeMs`.
|
|
167
|
+
*
|
|
168
|
+
* Use it once near the root of your app, ABOVE every <Screen>:
|
|
169
|
+
*
|
|
170
|
+
* const system = useScreenSystem();
|
|
171
|
+
* <>
|
|
172
|
+
* <ScreensActivityBridge system={system} />
|
|
173
|
+
* <Screen id="dashboard">…</Screen>
|
|
174
|
+
* <Screen id="form">…</Screen>
|
|
175
|
+
* </>
|
|
176
|
+
*
|
|
177
|
+
* Renders nothing; pure side-effect component.
|
|
178
|
+
*/
|
|
179
|
+
declare function ScreensActivityBridge({ system, fadeMs }: ScreensActivityBridgeProps): null;
|
|
180
|
+
|
|
88
181
|
type ShareControlsProps = {
|
|
89
182
|
/** The active session, or null when not sharing yet. */
|
|
90
183
|
session: SessionDescriptor | null;
|
|
@@ -152,4 +245,4 @@ type SharedWhiteboardProps = {
|
|
|
152
245
|
*/
|
|
153
246
|
declare function SharedWhiteboard({ initialNotes, initialShapes, initialConnectors, initialStrokes, initialViewport, agent, shareBaseUrl, onRegisterSession, showAgentPanel, showShareControls, broadcastEdits, height, header, className, style, }: SharedWhiteboardProps): react_jsx_runtime.JSX.Element;
|
|
154
247
|
|
|
155
|
-
export { type AgentActivity, AgentActivityHighlight, type AgentActivityHighlightProps, AgentCursor, type AgentCursorProps, AgentPanel, type AgentPanelProps, SessionDescriptor, ShareControls, type ShareControlsProps, SharedWhiteboard, type SharedWhiteboardProps };
|
|
248
|
+
export { type AgentActivity, AgentActivityHighlight, type AgentActivityHighlightProps, AgentCursor, type AgentCursorProps, AgentPanel, type AgentPanelProps, BridgedForm, type BridgedFormProps, FormFieldDescriptor, MicroMcpServer, ScreensActivityBridge, type ScreensActivityBridgeProps, SessionDescriptor, ShareControls, type ShareControlsProps, SharedWhiteboard, type SharedWhiteboardProps };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
|
+
export { registerSceneBridge } from './chunk-QJUTISFC.js';
|
|
2
|
+
import { buildShareUrl, buildShareConfig, createSessionDescriptor, attachSseRelay } from './chunk-JMYPUAFH.js';
|
|
3
|
+
export { SseRelayTransport, attachSseRelay, buildShareConfig, buildShareUrl, createSessionDescriptor, describeSession, readSessionFromUrl } from './chunk-JMYPUAFH.js';
|
|
4
|
+
export { useAgentActivity, useAgentActivityForScreen } from './chunk-X66JWQBB.js';
|
|
5
|
+
export { useUndoStack } from './chunk-DJOWMF6Q.js';
|
|
1
6
|
import { attachInProcess } from './chunk-6LTKCNLF.js';
|
|
2
7
|
export { InProcessTransport, RelayTransport, attachInProcess, attachRelay } from './chunk-6LTKCNLF.js';
|
|
3
|
-
import { registerWhiteboardBridge } from './chunk-
|
|
4
|
-
export { registerWhiteboardBridge } from './chunk-
|
|
5
|
-
export {
|
|
8
|
+
import { registerWhiteboardBridge } from './chunk-TBEITXF4.js';
|
|
9
|
+
export { registerWhiteboardBridge } from './chunk-TBEITXF4.js';
|
|
10
|
+
export { clearStack as clearUndoStack, ensureUndoToolsRegistered, pushUndoEntry, readHistory as readUndoHistory, redoOne, registerUndoTools, resetAllUndoStacks, undoOne } from './chunk-ACBENYYO.js';
|
|
11
|
+
export { registerFlowBridge } from './chunk-4IAVAFUV.js';
|
|
12
|
+
import { registerFormBridge } from './chunk-OEIULP2L.js';
|
|
13
|
+
export { registerFormBridge } from './chunk-OEIULP2L.js';
|
|
14
|
+
export { registerSheetsBridge } from './chunk-PDBF4W7E.js';
|
|
15
|
+
export { registerCodeBridge } from './chunk-XYYSTJHW.js';
|
|
16
|
+
export { registerChartsBridge } from './chunk-PHPXKSWI.js';
|
|
17
|
+
export { wrapToolWithActivity } from './chunk-52S7XYZK.js';
|
|
18
|
+
import { onActivity } from './chunk-JU2N4KK6.js';
|
|
19
|
+
export { emitActivity, onActivity, readActivityHistory, resetActivityRegistry } from './chunk-JU2N4KK6.js';
|
|
6
20
|
import { MicroMcpServer } from './chunk-QGCF7YKW.js';
|
|
7
21
|
export { MCP_PROTOCOL_VERSION, MicroMcpServer, errorResult, rpcError, textResult } from './chunk-QGCF7YKW.js';
|
|
8
|
-
import {
|
|
9
|
-
export { SseRelayTransport, attachSseRelay, buildShareConfig, buildShareUrl, createSessionDescriptor, describeSession, readSessionFromUrl } from './chunk-FLEOQUKF.js';
|
|
10
|
-
import { useRef, useEffect, useState, useCallback, useMemo } from 'react';
|
|
22
|
+
import { useRef, useEffect, useState, useMemo, useCallback } from 'react';
|
|
11
23
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
12
24
|
import { Board, Connector, Shape, StickyNote, CursorLayer } from '@particle-academy/fancy-whiteboard';
|
|
13
25
|
|
|
@@ -174,6 +186,98 @@ function AgentActivityHighlight({
|
|
|
174
186
|
}
|
|
175
187
|
);
|
|
176
188
|
}
|
|
189
|
+
function BridgedForm({
|
|
190
|
+
id,
|
|
191
|
+
title,
|
|
192
|
+
screenId,
|
|
193
|
+
fields,
|
|
194
|
+
values,
|
|
195
|
+
onChange,
|
|
196
|
+
onSubmit,
|
|
197
|
+
server,
|
|
198
|
+
agent,
|
|
199
|
+
children
|
|
200
|
+
}) {
|
|
201
|
+
const valuesRef = useRef(values);
|
|
202
|
+
const onChangeRef = useRef(onChange);
|
|
203
|
+
const fieldsRef = useRef(fields);
|
|
204
|
+
const submitRef = useRef(onSubmit);
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
valuesRef.current = values;
|
|
207
|
+
}, [values]);
|
|
208
|
+
useEffect(() => {
|
|
209
|
+
onChangeRef.current = onChange;
|
|
210
|
+
}, [onChange]);
|
|
211
|
+
useEffect(() => {
|
|
212
|
+
fieldsRef.current = fields;
|
|
213
|
+
}, [fields]);
|
|
214
|
+
useEffect(() => {
|
|
215
|
+
submitRef.current = onSubmit;
|
|
216
|
+
}, [onSubmit]);
|
|
217
|
+
const focusElement = (name) => {
|
|
218
|
+
if (typeof document === "undefined") return;
|
|
219
|
+
const el = document.querySelector(`[data-form-id="${id}"] [name="${name}"]`);
|
|
220
|
+
el?.focus();
|
|
221
|
+
};
|
|
222
|
+
const adapter = useMemo(() => ({
|
|
223
|
+
id,
|
|
224
|
+
title,
|
|
225
|
+
screenId,
|
|
226
|
+
getFields: () => fieldsRef.current,
|
|
227
|
+
getValue: (name) => valuesRef.current[name],
|
|
228
|
+
getValues: () => ({ ...valuesRef.current }),
|
|
229
|
+
setValue: (name, v) => onChangeRef.current({ ...valuesRef.current, [name]: v }),
|
|
230
|
+
setValues: (next) => onChangeRef.current({ ...valuesRef.current, ...next }),
|
|
231
|
+
focus: focusElement,
|
|
232
|
+
submit: async () => {
|
|
233
|
+
if (!submitRef.current) {
|
|
234
|
+
return { ok: true, values: { ...valuesRef.current } };
|
|
235
|
+
}
|
|
236
|
+
return submitRef.current();
|
|
237
|
+
}
|
|
238
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
239
|
+
}), [id, title, screenId]);
|
|
240
|
+
useEffect(() => {
|
|
241
|
+
if (!server) return;
|
|
242
|
+
const bridge = registerFormBridge(server, { adapter, agent });
|
|
243
|
+
return () => bridge.dispose();
|
|
244
|
+
}, [server, adapter, agent]);
|
|
245
|
+
return /* @__PURE__ */ jsx("div", { "data-form-id": id, children });
|
|
246
|
+
}
|
|
247
|
+
function ScreensActivityBridge({ system, fadeMs = 1500 }) {
|
|
248
|
+
useEffect(() => {
|
|
249
|
+
const fadeTimers = /* @__PURE__ */ new Map();
|
|
250
|
+
const off = onActivity((event) => {
|
|
251
|
+
const screenId = event.target.screenId;
|
|
252
|
+
if (!screenId) return;
|
|
253
|
+
if (!system.registry.has(screenId)) return;
|
|
254
|
+
const activity = {
|
|
255
|
+
agentId: event.agentId,
|
|
256
|
+
agentName: event.agentName,
|
|
257
|
+
agentColor: event.agentColor,
|
|
258
|
+
action: event.action,
|
|
259
|
+
timestamp: event.timestamp,
|
|
260
|
+
elementId: event.target.elementId,
|
|
261
|
+
label: event.target.label
|
|
262
|
+
};
|
|
263
|
+
system.updateScreen(screenId, { agentActivity: activity });
|
|
264
|
+
const prev = fadeTimers.get(screenId);
|
|
265
|
+
if (prev) clearTimeout(prev);
|
|
266
|
+
fadeTimers.set(
|
|
267
|
+
screenId,
|
|
268
|
+
setTimeout(() => {
|
|
269
|
+
system.updateScreen(screenId, { agentActivity: null });
|
|
270
|
+
fadeTimers.delete(screenId);
|
|
271
|
+
}, event.ttlMs ?? fadeMs)
|
|
272
|
+
);
|
|
273
|
+
});
|
|
274
|
+
return () => {
|
|
275
|
+
off();
|
|
276
|
+
for (const t of fadeTimers.values()) clearTimeout(t);
|
|
277
|
+
};
|
|
278
|
+
}, [system, fadeMs]);
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
177
281
|
function ShareControls({
|
|
178
282
|
session,
|
|
179
283
|
onStart,
|
|
@@ -562,6 +666,6 @@ function resolveCenter(ref, notes, shapes) {
|
|
|
562
666
|
return ref;
|
|
563
667
|
}
|
|
564
668
|
|
|
565
|
-
export { AgentActivityHighlight, AgentCursor, AgentPanel, ShareControls, SharedWhiteboard };
|
|
669
|
+
export { AgentActivityHighlight, AgentCursor, AgentPanel, BridgedForm, ScreensActivityBridge, ShareControls, SharedWhiteboard };
|
|
566
670
|
//# sourceMappingURL=index.js.map
|
|
567
671
|
//# sourceMappingURL=index.js.map
|