@nimblebrain/synapse 0.16.0 → 0.17.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/README.md +61 -111
- package/dist/{chunk-SN7YXLAV.cjs → chunk-EHLQWCYV.cjs} +6 -6
- package/dist/{chunk-SN7YXLAV.cjs.map → chunk-EHLQWCYV.cjs.map} +1 -1
- package/dist/{chunk-ZMNYUGSF.cjs → chunk-FDMRJZKT.cjs} +576 -662
- package/dist/chunk-FDMRJZKT.cjs.map +1 -0
- package/dist/{chunk-E7OOOYVR.js → chunk-SRQNQ26I.js} +3 -3
- package/dist/{chunk-E7OOOYVR.js.map → chunk-SRQNQ26I.js.map} +1 -1
- package/dist/{chunk-RYWW6EHB.cjs → chunk-TXJMGQYF.cjs} +3 -5
- package/dist/chunk-TXJMGQYF.cjs.map +1 -0
- package/dist/{chunk-J5ICAHK2.js → chunk-UPDBDXQB.js} +4 -5
- package/dist/chunk-UPDBDXQB.js.map +1 -0
- package/dist/{chunk-GNTQJSQX.js → chunk-VYR6V47N.js} +573 -663
- package/dist/chunk-VYR6V47N.js.map +1 -0
- package/dist/codegen/cli.cjs +1 -1
- package/dist/codegen/cli.js +1 -1
- package/dist/codegen/index.d.cts +1 -1
- package/dist/codegen/index.d.ts +1 -1
- package/dist/connect.iife.global.js +28 -28
- package/dist/{detect-C_qmYsh9.d.cts → detect-BHYg26_d.d.cts} +1 -1
- package/dist/{detect-Dfd0upoz.d.ts → detect-Bf8Q_0dK.d.ts} +1 -1
- package/dist/host/index.cjs +14 -14
- package/dist/host/index.d.cts +3 -3
- package/dist/host/index.d.ts +3 -3
- package/dist/host/index.js +2 -2
- package/dist/index.cjs +28 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -26
- package/dist/index.d.ts +58 -26
- package/dist/index.js +3 -81
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +81 -140
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +66 -82
- package/dist/react/index.d.ts +66 -82
- package/dist/react/index.js +82 -136
- package/dist/react/index.js.map +1 -1
- package/dist/{server-ERRDGEZ7.js → server-5N76YCWC.js} +3 -3
- package/dist/{server-ERRDGEZ7.js.map → server-5N76YCWC.js.map} +1 -1
- package/dist/{server-P54IYX2G.cjs → server-QIYIJHD5.cjs} +3 -3
- package/dist/{server-P54IYX2G.cjs.map → server-QIYIJHD5.cjs.map} +1 -1
- package/dist/synapse-runtime.iife.global.js +28 -28
- package/dist/synapse-ui.iife.global.js +2 -2
- package/dist/{types-BSZasM8q.d.cts → types-uEO4VFJ2.d.cts} +87 -166
- package/dist/{types-BSZasM8q.d.ts → types-uEO4VFJ2.d.ts} +87 -166
- package/dist/vite/index.cjs +1 -1
- package/dist/vite/index.cjs.map +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/vite/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-GNTQJSQX.js.map +0 -1
- package/dist/chunk-J5ICAHK2.js.map +0 -1
- package/dist/chunk-RYWW6EHB.cjs.map +0 -1
- package/dist/chunk-ZMNYUGSF.cjs.map +0 -1
package/dist/react/index.d.cts
CHANGED
|
@@ -1,115 +1,99 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { C as ConnectOptions,
|
|
3
|
+
import { C as ConnectOptions, a as CallToolAsTaskOptions, T as TaskHandle, b as ToolCallResult, c as CallToolOptions, R as RequestFileOptions, F as FileResult, A as App, D as DataChangedEvent, M as ModelContext, d as Theme, e as ToolResultData } from '../types-uEO4VFJ2.cjs';
|
|
4
4
|
import { McpUiHostContext } from '@modelcontextprotocol/ext-apps';
|
|
5
5
|
import { Task } from '@modelcontextprotocol/sdk/types.js';
|
|
6
6
|
|
|
7
7
|
interface AppProviderProps extends ConnectOptions {
|
|
8
8
|
children: ReactNode;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Connect on mount and provide the {@link App} to everything below.
|
|
12
|
+
*
|
|
13
|
+
* Renders nothing until the handshake completes, so no hook below can observe
|
|
14
|
+
* a half-connected app and no tool call can be fired into a host that has not
|
|
15
|
+
* answered `ui/initialize` yet.
|
|
16
|
+
*/
|
|
17
|
+
declare function AppProvider({ children, ...options }: AppProviderProps): react_jsx_runtime.JSX.Element | null;
|
|
11
18
|
|
|
19
|
+
/** The connected app. Throws outside an `<AppProvider>`. */
|
|
12
20
|
declare function useApp(): App;
|
|
13
|
-
declare function useToolResult(): ToolResultData | null;
|
|
14
|
-
declare function useToolInput(): Record<string, unknown> | null;
|
|
15
|
-
declare function useConnectTheme(): Theme;
|
|
16
|
-
declare function useResize(): (width?: number, height?: number) => void;
|
|
17
|
-
|
|
18
|
-
interface SynapseProviderProps extends SynapseOptions {
|
|
19
|
-
children: ReactNode;
|
|
20
|
-
}
|
|
21
|
-
declare function SynapseProvider({ children, ...options }: SynapseProviderProps): react_jsx_runtime.JSX.Element;
|
|
22
|
-
|
|
23
|
-
declare function useSynapse(): Synapse;
|
|
24
|
-
declare function useCallTool<TOutput = unknown>(toolName: string): {
|
|
25
|
-
call: (args?: Record<string, unknown>) => Promise<ToolCallResult<TOutput>>;
|
|
26
|
-
isPending: boolean;
|
|
27
|
-
error: Error | null;
|
|
28
|
-
data: TOutput | null;
|
|
29
|
-
};
|
|
30
|
-
declare function useDataSync(callback: (event: DataChangedEvent) => void): void;
|
|
31
21
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* Actions are emitted by tools as deterministic side effects (e.g., "navigate
|
|
35
|
-
* to the board I just created"). The UI decides how to handle each action type.
|
|
22
|
+
* The current theme, re-rendering only when it actually moves.
|
|
36
23
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* if (action.type === "navigate") {
|
|
41
|
-
* const { entity, id } = action.payload as NavigatePayload;
|
|
42
|
-
* if (entity === "board") setSelectedBoardId(id);
|
|
43
|
-
* }
|
|
44
|
-
* });
|
|
45
|
-
* ```
|
|
24
|
+
* `App` filters `host-context-changed` notifications through a theme equality
|
|
25
|
+
* check, so a context update that leaves the derived theme untouched (a
|
|
26
|
+
* workspace switch, say) does not re-render every themed component.
|
|
46
27
|
*/
|
|
47
|
-
declare function
|
|
28
|
+
declare function useTheme(): Theme;
|
|
48
29
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* `displayMode`, `toolInfo`) plus any host extensions. Re-renders on every
|
|
53
|
-
* `ui/notifications/host-context-changed` notification.
|
|
30
|
+
* The full ext-apps host context — spec fields (`theme`, `styles`,
|
|
31
|
+
* `displayMode`, `toolInfo`) plus whatever the host publishes alongside.
|
|
32
|
+
* Re-renders on every `host-context-changed`.
|
|
54
33
|
*
|
|
55
|
-
* Prefer `useTheme()` when only theming matters
|
|
56
|
-
*
|
|
57
|
-
* fields like host-specific extensions, e.g. on NimbleBrain:
|
|
34
|
+
* Prefer `useTheme()` when only theming matters: it filters no-op fires.
|
|
35
|
+
* Reach for this one for host extensions, e.g. on NimbleBrain:
|
|
58
36
|
*
|
|
59
37
|
* ```tsx
|
|
60
38
|
* const { workspace } = useHostContext<{ workspace?: { id: string } }>();
|
|
61
39
|
* ```
|
|
62
40
|
*/
|
|
63
41
|
declare function useHostContext<T extends McpUiHostContext = McpUiHostContext>(): T;
|
|
42
|
+
/** The latest tool result pushed by the host, or `null` before one arrives. */
|
|
43
|
+
declare function useToolResult(): ToolResultData | null;
|
|
44
|
+
/** The arguments the host is calling the bound tool with, as they arrive. */
|
|
45
|
+
declare function useToolInput(): Record<string, unknown> | null;
|
|
46
|
+
/** Ask the host to resize this app's frame. */
|
|
47
|
+
declare function useResize(): (width?: number, height?: number) => void;
|
|
48
|
+
interface UseCallToolResult<TOutput> {
|
|
49
|
+
call: (args?: Record<string, unknown>, options?: CallToolOptions) => Promise<ToolCallResult<TOutput>>;
|
|
50
|
+
isPending: boolean;
|
|
51
|
+
error: Error | null;
|
|
52
|
+
data: TOutput | null;
|
|
53
|
+
}
|
|
54
|
+
/** Call one tool, with pending/error/data state for the latest call. */
|
|
55
|
+
declare function useCallTool<TOutput = unknown>(toolName: string): UseCallToolResult<TOutput>;
|
|
56
|
+
/** Run `callback` whenever the agent changes data this app displays. */
|
|
57
|
+
declare function useDataSync(callback: (event: DataChangedEvent) => void): void;
|
|
64
58
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* context — so a host-context update that doesn't move the theme (e.g. a
|
|
69
|
-
* workspace switch) does NOT cause this hook's consumers to re-render.
|
|
70
|
-
*
|
|
71
|
-
* Building this on `useHostContext` instead would skip the filter: every
|
|
72
|
-
* host-context-changed notification produces a new context reference, which
|
|
73
|
-
* would propagate through `useState` and force a re-render even when the
|
|
74
|
-
* derived theme is unchanged.
|
|
75
|
-
*/
|
|
76
|
-
declare function useTheme(): SynapseTheme;
|
|
77
|
-
declare function useAction(): (action: string, params?: Record<string, unknown>) => void;
|
|
78
|
-
declare function useChat(): (message: string, context?: {
|
|
79
|
-
action?: string;
|
|
80
|
-
entity?: string;
|
|
81
|
-
}) => void;
|
|
82
|
-
/**
|
|
83
|
-
* Push the app's visible state to the agent via ext-apps `ui/update-model-context`.
|
|
84
|
-
*
|
|
85
|
-
* **Imperative** (no args) — returns a push function you call manually:
|
|
86
|
-
* ```tsx
|
|
87
|
-
* const push = useVisibleState();
|
|
88
|
-
* push({ board: selectedBoard }, "Viewing board X");
|
|
89
|
-
* ```
|
|
59
|
+
* Push what the user is looking at to the agent (ext-apps
|
|
60
|
+
* `ui/update-model-context`), debounced so a selection the user drags through
|
|
61
|
+
* costs one frame rather than thirty.
|
|
90
62
|
*
|
|
91
|
-
* **Declarative**
|
|
63
|
+
* **Declarative** — pushes when `deps` change:
|
|
92
64
|
* ```tsx
|
|
93
|
-
*
|
|
65
|
+
* useModelContext(() => ({
|
|
94
66
|
* state: { board: selectedBoard },
|
|
95
67
|
* summary: `Viewing "${selectedBoard?.name}"`,
|
|
96
68
|
* }), [selectedBoard]);
|
|
97
69
|
* ```
|
|
70
|
+
*
|
|
71
|
+
* **Imperative** — returns a push function:
|
|
72
|
+
* ```tsx
|
|
73
|
+
* const push = useModelContext();
|
|
74
|
+
* push({ board: selectedBoard }, "Viewing board X");
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* The debounce lives here rather than on `app.updateModelContext`, which
|
|
78
|
+
* sends immediately: the rapid-change problem is a React one, and the plain
|
|
79
|
+
* method should do what it says.
|
|
98
80
|
*/
|
|
99
|
-
declare function
|
|
100
|
-
declare function
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
81
|
+
declare function useModelContext(): (state: Record<string, unknown>, summary?: string) => void;
|
|
82
|
+
declare function useModelContext(factory: () => ModelContext, deps: unknown[]): void;
|
|
83
|
+
/** Send a user message into the agent conversation. */
|
|
84
|
+
declare function useSendMessage(): (text: string, context?: {
|
|
85
|
+
action?: string;
|
|
86
|
+
entity?: string;
|
|
87
|
+
}) => void;
|
|
88
|
+
/** Trigger a host-side action. No-op off a NimbleBrain host. */
|
|
89
|
+
declare function useAction(): (name: string, params?: Record<string, unknown>) => void;
|
|
90
|
+
interface UseFileUploadResult {
|
|
105
91
|
pickFile: (options?: RequestFileOptions) => Promise<FileResult | null>;
|
|
106
92
|
pickFiles: (options?: RequestFileOptions) => Promise<FileResult[]>;
|
|
107
93
|
isPending: boolean;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
dispatch: StoreDispatch<TActions>;
|
|
112
|
-
};
|
|
94
|
+
}
|
|
95
|
+
/** The host's native file picker, with a pending flag. NimbleBrain only. */
|
|
96
|
+
declare function useFileUpload(): UseFileUploadResult;
|
|
113
97
|
interface UseCallToolAsTaskResult<TInput, TOutput> {
|
|
114
98
|
/**
|
|
115
99
|
* Start (or re-start) a task-augmented tool call. Returns the
|
|
@@ -140,7 +124,7 @@ interface UseCallToolAsTaskResult<TInput, TOutput> {
|
|
|
140
124
|
cancel(): Promise<void>;
|
|
141
125
|
}
|
|
142
126
|
/**
|
|
143
|
-
* React
|
|
127
|
+
* React wrapper around `callToolAsTask(app, …)`.
|
|
144
128
|
*
|
|
145
129
|
* Handles the full MCP 2025-11-25 task lifecycle:
|
|
146
130
|
*
|
|
@@ -162,4 +146,4 @@ interface UseCallToolAsTaskResult<TInput, TOutput> {
|
|
|
162
146
|
*/
|
|
163
147
|
declare function useCallToolAsTask<TInput = Record<string, unknown>, TOutput = unknown>(toolName: string): UseCallToolAsTaskResult<TInput, TOutput>;
|
|
164
148
|
|
|
165
|
-
export { AppProvider, type AppProviderProps,
|
|
149
|
+
export { AppProvider, type AppProviderProps, type UseCallToolAsTaskResult, type UseCallToolResult, type UseFileUploadResult, useAction, useApp, useCallTool, useCallToolAsTask, useDataSync, useFileUpload, useHostContext, useModelContext, useResize, useSendMessage, useTheme, useToolInput, useToolResult };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,115 +1,99 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { C as ConnectOptions,
|
|
3
|
+
import { C as ConnectOptions, a as CallToolAsTaskOptions, T as TaskHandle, b as ToolCallResult, c as CallToolOptions, R as RequestFileOptions, F as FileResult, A as App, D as DataChangedEvent, M as ModelContext, d as Theme, e as ToolResultData } from '../types-uEO4VFJ2.js';
|
|
4
4
|
import { McpUiHostContext } from '@modelcontextprotocol/ext-apps';
|
|
5
5
|
import { Task } from '@modelcontextprotocol/sdk/types.js';
|
|
6
6
|
|
|
7
7
|
interface AppProviderProps extends ConnectOptions {
|
|
8
8
|
children: ReactNode;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Connect on mount and provide the {@link App} to everything below.
|
|
12
|
+
*
|
|
13
|
+
* Renders nothing until the handshake completes, so no hook below can observe
|
|
14
|
+
* a half-connected app and no tool call can be fired into a host that has not
|
|
15
|
+
* answered `ui/initialize` yet.
|
|
16
|
+
*/
|
|
17
|
+
declare function AppProvider({ children, ...options }: AppProviderProps): react_jsx_runtime.JSX.Element | null;
|
|
11
18
|
|
|
19
|
+
/** The connected app. Throws outside an `<AppProvider>`. */
|
|
12
20
|
declare function useApp(): App;
|
|
13
|
-
declare function useToolResult(): ToolResultData | null;
|
|
14
|
-
declare function useToolInput(): Record<string, unknown> | null;
|
|
15
|
-
declare function useConnectTheme(): Theme;
|
|
16
|
-
declare function useResize(): (width?: number, height?: number) => void;
|
|
17
|
-
|
|
18
|
-
interface SynapseProviderProps extends SynapseOptions {
|
|
19
|
-
children: ReactNode;
|
|
20
|
-
}
|
|
21
|
-
declare function SynapseProvider({ children, ...options }: SynapseProviderProps): react_jsx_runtime.JSX.Element;
|
|
22
|
-
|
|
23
|
-
declare function useSynapse(): Synapse;
|
|
24
|
-
declare function useCallTool<TOutput = unknown>(toolName: string): {
|
|
25
|
-
call: (args?: Record<string, unknown>) => Promise<ToolCallResult<TOutput>>;
|
|
26
|
-
isPending: boolean;
|
|
27
|
-
error: Error | null;
|
|
28
|
-
data: TOutput | null;
|
|
29
|
-
};
|
|
30
|
-
declare function useDataSync(callback: (event: DataChangedEvent) => void): void;
|
|
31
21
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* Actions are emitted by tools as deterministic side effects (e.g., "navigate
|
|
35
|
-
* to the board I just created"). The UI decides how to handle each action type.
|
|
22
|
+
* The current theme, re-rendering only when it actually moves.
|
|
36
23
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* if (action.type === "navigate") {
|
|
41
|
-
* const { entity, id } = action.payload as NavigatePayload;
|
|
42
|
-
* if (entity === "board") setSelectedBoardId(id);
|
|
43
|
-
* }
|
|
44
|
-
* });
|
|
45
|
-
* ```
|
|
24
|
+
* `App` filters `host-context-changed` notifications through a theme equality
|
|
25
|
+
* check, so a context update that leaves the derived theme untouched (a
|
|
26
|
+
* workspace switch, say) does not re-render every themed component.
|
|
46
27
|
*/
|
|
47
|
-
declare function
|
|
28
|
+
declare function useTheme(): Theme;
|
|
48
29
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* `displayMode`, `toolInfo`) plus any host extensions. Re-renders on every
|
|
53
|
-
* `ui/notifications/host-context-changed` notification.
|
|
30
|
+
* The full ext-apps host context — spec fields (`theme`, `styles`,
|
|
31
|
+
* `displayMode`, `toolInfo`) plus whatever the host publishes alongside.
|
|
32
|
+
* Re-renders on every `host-context-changed`.
|
|
54
33
|
*
|
|
55
|
-
* Prefer `useTheme()` when only theming matters
|
|
56
|
-
*
|
|
57
|
-
* fields like host-specific extensions, e.g. on NimbleBrain:
|
|
34
|
+
* Prefer `useTheme()` when only theming matters: it filters no-op fires.
|
|
35
|
+
* Reach for this one for host extensions, e.g. on NimbleBrain:
|
|
58
36
|
*
|
|
59
37
|
* ```tsx
|
|
60
38
|
* const { workspace } = useHostContext<{ workspace?: { id: string } }>();
|
|
61
39
|
* ```
|
|
62
40
|
*/
|
|
63
41
|
declare function useHostContext<T extends McpUiHostContext = McpUiHostContext>(): T;
|
|
42
|
+
/** The latest tool result pushed by the host, or `null` before one arrives. */
|
|
43
|
+
declare function useToolResult(): ToolResultData | null;
|
|
44
|
+
/** The arguments the host is calling the bound tool with, as they arrive. */
|
|
45
|
+
declare function useToolInput(): Record<string, unknown> | null;
|
|
46
|
+
/** Ask the host to resize this app's frame. */
|
|
47
|
+
declare function useResize(): (width?: number, height?: number) => void;
|
|
48
|
+
interface UseCallToolResult<TOutput> {
|
|
49
|
+
call: (args?: Record<string, unknown>, options?: CallToolOptions) => Promise<ToolCallResult<TOutput>>;
|
|
50
|
+
isPending: boolean;
|
|
51
|
+
error: Error | null;
|
|
52
|
+
data: TOutput | null;
|
|
53
|
+
}
|
|
54
|
+
/** Call one tool, with pending/error/data state for the latest call. */
|
|
55
|
+
declare function useCallTool<TOutput = unknown>(toolName: string): UseCallToolResult<TOutput>;
|
|
56
|
+
/** Run `callback` whenever the agent changes data this app displays. */
|
|
57
|
+
declare function useDataSync(callback: (event: DataChangedEvent) => void): void;
|
|
64
58
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* context — so a host-context update that doesn't move the theme (e.g. a
|
|
69
|
-
* workspace switch) does NOT cause this hook's consumers to re-render.
|
|
70
|
-
*
|
|
71
|
-
* Building this on `useHostContext` instead would skip the filter: every
|
|
72
|
-
* host-context-changed notification produces a new context reference, which
|
|
73
|
-
* would propagate through `useState` and force a re-render even when the
|
|
74
|
-
* derived theme is unchanged.
|
|
75
|
-
*/
|
|
76
|
-
declare function useTheme(): SynapseTheme;
|
|
77
|
-
declare function useAction(): (action: string, params?: Record<string, unknown>) => void;
|
|
78
|
-
declare function useChat(): (message: string, context?: {
|
|
79
|
-
action?: string;
|
|
80
|
-
entity?: string;
|
|
81
|
-
}) => void;
|
|
82
|
-
/**
|
|
83
|
-
* Push the app's visible state to the agent via ext-apps `ui/update-model-context`.
|
|
84
|
-
*
|
|
85
|
-
* **Imperative** (no args) — returns a push function you call manually:
|
|
86
|
-
* ```tsx
|
|
87
|
-
* const push = useVisibleState();
|
|
88
|
-
* push({ board: selectedBoard }, "Viewing board X");
|
|
89
|
-
* ```
|
|
59
|
+
* Push what the user is looking at to the agent (ext-apps
|
|
60
|
+
* `ui/update-model-context`), debounced so a selection the user drags through
|
|
61
|
+
* costs one frame rather than thirty.
|
|
90
62
|
*
|
|
91
|
-
* **Declarative**
|
|
63
|
+
* **Declarative** — pushes when `deps` change:
|
|
92
64
|
* ```tsx
|
|
93
|
-
*
|
|
65
|
+
* useModelContext(() => ({
|
|
94
66
|
* state: { board: selectedBoard },
|
|
95
67
|
* summary: `Viewing "${selectedBoard?.name}"`,
|
|
96
68
|
* }), [selectedBoard]);
|
|
97
69
|
* ```
|
|
70
|
+
*
|
|
71
|
+
* **Imperative** — returns a push function:
|
|
72
|
+
* ```tsx
|
|
73
|
+
* const push = useModelContext();
|
|
74
|
+
* push({ board: selectedBoard }, "Viewing board X");
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* The debounce lives here rather than on `app.updateModelContext`, which
|
|
78
|
+
* sends immediately: the rapid-change problem is a React one, and the plain
|
|
79
|
+
* method should do what it says.
|
|
98
80
|
*/
|
|
99
|
-
declare function
|
|
100
|
-
declare function
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
81
|
+
declare function useModelContext(): (state: Record<string, unknown>, summary?: string) => void;
|
|
82
|
+
declare function useModelContext(factory: () => ModelContext, deps: unknown[]): void;
|
|
83
|
+
/** Send a user message into the agent conversation. */
|
|
84
|
+
declare function useSendMessage(): (text: string, context?: {
|
|
85
|
+
action?: string;
|
|
86
|
+
entity?: string;
|
|
87
|
+
}) => void;
|
|
88
|
+
/** Trigger a host-side action. No-op off a NimbleBrain host. */
|
|
89
|
+
declare function useAction(): (name: string, params?: Record<string, unknown>) => void;
|
|
90
|
+
interface UseFileUploadResult {
|
|
105
91
|
pickFile: (options?: RequestFileOptions) => Promise<FileResult | null>;
|
|
106
92
|
pickFiles: (options?: RequestFileOptions) => Promise<FileResult[]>;
|
|
107
93
|
isPending: boolean;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
dispatch: StoreDispatch<TActions>;
|
|
112
|
-
};
|
|
94
|
+
}
|
|
95
|
+
/** The host's native file picker, with a pending flag. NimbleBrain only. */
|
|
96
|
+
declare function useFileUpload(): UseFileUploadResult;
|
|
113
97
|
interface UseCallToolAsTaskResult<TInput, TOutput> {
|
|
114
98
|
/**
|
|
115
99
|
* Start (or re-start) a task-augmented tool call. Returns the
|
|
@@ -140,7 +124,7 @@ interface UseCallToolAsTaskResult<TInput, TOutput> {
|
|
|
140
124
|
cancel(): Promise<void>;
|
|
141
125
|
}
|
|
142
126
|
/**
|
|
143
|
-
* React
|
|
127
|
+
* React wrapper around `callToolAsTask(app, …)`.
|
|
144
128
|
*
|
|
145
129
|
* Handles the full MCP 2025-11-25 task lifecycle:
|
|
146
130
|
*
|
|
@@ -162,4 +146,4 @@ interface UseCallToolAsTaskResult<TInput, TOutput> {
|
|
|
162
146
|
*/
|
|
163
147
|
declare function useCallToolAsTask<TInput = Record<string, unknown>, TOutput = unknown>(toolName: string): UseCallToolAsTaskResult<TInput, TOutput>;
|
|
164
148
|
|
|
165
|
-
export { AppProvider, type AppProviderProps,
|
|
149
|
+
export { AppProvider, type AppProviderProps, type UseCallToolAsTaskResult, type UseCallToolResult, type UseFileUploadResult, useAction, useApp, useCallTool, useCallToolAsTask, useDataSync, useFileUpload, useHostContext, useModelContext, useResize, useSendMessage, useTheme, useToolInput, useToolResult };
|