@powerhousedao/reactor-browser 6.2.3-dev.6 → 6.2.3-dev.60
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/{attachment-service-D3EhiAJ7.d.ts → attachment-service-DG6UkyMv.d.ts} +362 -65
- package/dist/attachment-service-DG6UkyMv.d.ts.map +1 -0
- package/dist/{client-BIHN_UyR.d.ts → client-BnGewICj.d.ts} +3 -3
- package/dist/client-BnGewICj.d.ts.map +1 -0
- package/dist/{client-D66jVnot.js → client-CXDpILj6.js} +232 -32
- package/dist/client-CXDpILj6.js.map +1 -0
- package/dist/{client-DjK30EQ-.js → client-Cq5avLW5.js} +35 -22
- package/dist/client-Cq5avLW5.js.map +1 -0
- package/dist/{document-by-id-B4FIzG1w.js → dispatch-C1VVTn5S.js} +393 -54
- package/dist/dispatch-C1VVTn5S.js.map +1 -0
- package/dist/document-by-id-BRDkvmpn.js +16 -0
- package/dist/document-by-id-BRDkvmpn.js.map +1 -0
- package/dist/{document-model-modules-bTP87nyr.js → document-model-modules-Gsh1Xr7j.js} +60 -68
- package/dist/document-model-modules-Gsh1Xr7j.js.map +1 -0
- package/dist/{document-operations-WeE6wIDt.js → document-operations-BSzcF0mu.js} +805 -167
- package/dist/document-operations-BSzcF0mu.js.map +1 -0
- package/dist/{global-OuINvEGT.d.ts → global-BuSwbbY0.d.ts} +59 -13
- package/dist/global-BuSwbbY0.d.ts.map +1 -0
- package/dist/{index-B33TKEqp.d.ts → index-ewIc3pEO.d.ts} +19 -98
- package/dist/index-ewIc3pEO.d.ts.map +1 -0
- package/dist/{index-BIVDXw3K.d.ts → index-rtDmzViP.d.ts} +3 -3
- package/dist/index-rtDmzViP.d.ts.map +1 -0
- package/dist/index.d.ts +395 -371
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +116 -47
- package/dist/index.js.map +1 -1
- package/dist/inspector-proxy-DODqs15F.d.ts +25 -0
- package/dist/inspector-proxy-DODqs15F.d.ts.map +1 -0
- package/dist/{make-ph-event-functions-DBq3iWYn.js → make-ph-event-functions-CdsvEl5t.js} +4 -2
- package/dist/{make-ph-event-functions-DBq3iWYn.js.map → make-ph-event-functions-CdsvEl5t.js.map} +1 -1
- package/dist/{pglite-CntadC_p-9NDG14dS.d.ts → pglite-CntadC_p-DTkdF8sr.d.ts} +11 -33
- package/dist/pglite-CntadC_p-DTkdF8sr.d.ts.map +1 -0
- package/dist/{relational-D1RB45sA.js → relational-DxHuX41f.js} +66 -5
- package/dist/relational-DxHuX41f.js.map +1 -0
- package/dist/{renown-rqK8sokh.js → renown-CPAeJt5L.js} +7 -8
- package/dist/{renown-rqK8sokh.js.map → renown-CPAeJt5L.js.map} +1 -1
- package/dist/{renown-BHxwP7xU.js → renown-D05wkobG.js} +2 -2
- package/dist/{renown-BHxwP7xU.js.map → renown-D05wkobG.js.map} +1 -1
- package/dist/src/ai/index.d.ts +51 -62
- package/dist/src/ai/index.d.ts.map +1 -1
- package/dist/src/ai/index.js +5 -8
- package/dist/src/ai/index.js.map +1 -1
- package/dist/src/analytics/index.d.ts +36 -44
- package/dist/src/analytics/index.d.ts.map +1 -1
- package/dist/src/analytics/index.js +2 -2
- package/dist/src/analytics/index.js.map +1 -1
- package/dist/src/document-model.d.ts +3 -4
- package/dist/src/document-model.d.ts.map +1 -1
- package/dist/src/document-model.js.map +1 -1
- package/dist/src/graphql/client.d.ts +4 -3
- package/dist/src/graphql/client.js +1 -1
- package/dist/src/graphql-client/entry.d.ts +5 -4
- package/dist/src/graphql-client/entry.js +4 -4
- package/dist/src/relational/index.d.ts +15 -9
- package/dist/src/relational/index.d.ts.map +1 -1
- package/dist/src/relational/index.js +1 -1
- package/dist/src/renown/index.d.ts +3 -2
- package/dist/src/renown/index.js +2 -2
- package/dist/src/rpc/index.d.ts +176 -138
- package/dist/src/rpc/index.d.ts.map +1 -1
- package/dist/src/rpc/index.js +421 -618
- package/dist/src/rpc/index.js.map +1 -1
- package/dist/{store-BJYcr_FL.js → store-DInXcjal.js} +1 -1
- package/dist/{store-BJYcr_FL.js.map → store-DInXcjal.js.map} +1 -1
- package/dist/{switchboard-CaXQ4-5Q.js → switchboard-3vHbIV5W.js} +58 -6
- package/dist/switchboard-3vHbIV5W.js.map +1 -0
- package/dist/{types-Dcv1ZLoW.d.ts → types-0Fh1tNjy.d.ts} +242 -17
- package/dist/types-0Fh1tNjy.d.ts.map +1 -0
- package/dist/{types-6vDzbRRS.d.ts → types-520nWrB3.d.ts} +2 -2
- package/dist/types-520nWrB3.d.ts.map +1 -0
- package/package.json +19 -20
- package/dist/attachment-service-D3EhiAJ7.d.ts.map +0 -1
- package/dist/client-BIHN_UyR.d.ts.map +0 -1
- package/dist/client-D66jVnot.js.map +0 -1
- package/dist/client-DjK30EQ-.js.map +0 -1
- package/dist/document-by-id-B4FIzG1w.js.map +0 -1
- package/dist/document-model-modules-bTP87nyr.js.map +0 -1
- package/dist/document-operations-WeE6wIDt.js.map +0 -1
- package/dist/global-OuINvEGT.d.ts.map +0 -1
- package/dist/index-B33TKEqp.d.ts.map +0 -1
- package/dist/index-BIVDXw3K.d.ts.map +0 -1
- package/dist/inspector-proxy-6h5VKAwt.d.ts +0 -257
- package/dist/inspector-proxy-6h5VKAwt.d.ts.map +0 -1
- package/dist/pglite-CntadC_p-9NDG14dS.d.ts.map +0 -1
- package/dist/relational-D1RB45sA.js.map +0 -1
- package/dist/switchboard-CaXQ4-5Q.js.map +0 -1
- package/dist/types-6vDzbRRS.d.ts.map +0 -1
- package/dist/types-Dcv1ZLoW.d.ts.map +0 -1
package/dist/src/ai/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { PhAiToolAnnotations, PhAiToolDescriptor } from "@powerhousedao/shared/document-model";
|
|
2
1
|
import { ISyncManager } from "@powerhousedao/reactor";
|
|
3
|
-
import
|
|
2
|
+
import { PhAiToolAnnotations, PhAiToolDescriptor } from "@powerhousedao/shared/document-model";
|
|
4
3
|
import { LanguageModel, ModelMessage } from "ai";
|
|
5
|
-
|
|
6
4
|
//#region src/ai/types.d.ts
|
|
7
5
|
/**
|
|
8
6
|
* Browser-side AI chat over the reactor.
|
|
@@ -13,7 +11,7 @@ import { LanguageModel, ModelMessage } from "ai";
|
|
|
13
11
|
* same tool definitions drive both the MCP server and the in-browser chat.
|
|
14
12
|
*/
|
|
15
13
|
/** User-configured LLM connection settings, persisted in localStorage. */
|
|
16
|
-
interface AiSettings {
|
|
14
|
+
export interface AiSettings {
|
|
17
15
|
/** Master on/off for the in-browser assistant. Off by default. */
|
|
18
16
|
enabled: boolean;
|
|
19
17
|
/** OpenAI-compatible base URL, e.g. `https://api.openai.com/v1` */
|
|
@@ -29,7 +27,7 @@ interface AiSettings {
|
|
|
29
27
|
autoApproveWrites: boolean;
|
|
30
28
|
}
|
|
31
29
|
/** MCP-compatible annotation hints; structural, no MCP SDK dependency. */
|
|
32
|
-
type AiToolAnnotations = PhAiToolAnnotations;
|
|
30
|
+
export type AiToolAnnotations = PhAiToolAnnotations;
|
|
33
31
|
/**
|
|
34
32
|
* Provider-agnostic tool descriptor accepted by the chat agent.
|
|
35
33
|
*
|
|
@@ -39,20 +37,20 @@ type AiToolAnnotations = PhAiToolAnnotations;
|
|
|
39
37
|
* because the envelope shape (MCP `CallToolResult`) is unwrapped at the
|
|
40
38
|
* adapter boundary.
|
|
41
39
|
*/
|
|
42
|
-
type AiToolDescriptor = PhAiToolDescriptor;
|
|
40
|
+
export type AiToolDescriptor = PhAiToolDescriptor;
|
|
43
41
|
/** Tool descriptors the app resolves when the user sends a message. */
|
|
44
|
-
type AiToolsProvider = () => Promise<AiToolDescriptor[]>;
|
|
42
|
+
export type AiToolsProvider = () => Promise<AiToolDescriptor[]>;
|
|
45
43
|
/** Tool names whose execution mutates the reactor and requires approval. */
|
|
46
|
-
declare const WRITE_TOOLS: ReadonlySet<string>;
|
|
44
|
+
export declare const WRITE_TOOLS: ReadonlySet<string>;
|
|
47
45
|
/**
|
|
48
46
|
* Whether executing the tool mutates state and requires user approval:
|
|
49
47
|
* the built-in write tools, or any tool flagged destructive in its
|
|
50
48
|
* annotations (covers package-provided tools outside the built-in set).
|
|
51
49
|
*/
|
|
52
|
-
declare function isWriteTool(name: string, annotations?: AiToolAnnotations): boolean;
|
|
53
|
-
type ToolCallState = "awaiting-approval" | "executing" | "done" | "error" | "rejected";
|
|
50
|
+
export declare function isWriteTool(name: string, annotations?: AiToolAnnotations): boolean;
|
|
51
|
+
export type ToolCallState = "awaiting-approval" | "executing" | "done" | "error" | "rejected";
|
|
54
52
|
/** One rendered unit inside a chat message. */
|
|
55
|
-
type ChatPart = {
|
|
53
|
+
export type ChatPart = {
|
|
56
54
|
type: "text";
|
|
57
55
|
text: string;
|
|
58
56
|
} | {
|
|
@@ -64,19 +62,19 @@ type ChatPart = {
|
|
|
64
62
|
result?: unknown;
|
|
65
63
|
error?: string;
|
|
66
64
|
};
|
|
67
|
-
interface ChatMessage {
|
|
65
|
+
export interface ChatMessage {
|
|
68
66
|
id: string;
|
|
69
67
|
role: "user" | "assistant";
|
|
70
68
|
parts: ChatPart[];
|
|
71
69
|
}
|
|
72
70
|
/** A write tool call the user must approve or reject. */
|
|
73
|
-
interface PendingApproval {
|
|
71
|
+
export interface PendingApproval {
|
|
74
72
|
toolCallId: string;
|
|
75
73
|
name: string;
|
|
76
74
|
args: unknown;
|
|
77
75
|
}
|
|
78
76
|
/** Context snapshot injected into the agent system prompt. */
|
|
79
|
-
interface ChatContext {
|
|
77
|
+
export interface ChatContext {
|
|
80
78
|
driveId?: string;
|
|
81
79
|
driveName?: string;
|
|
82
80
|
nodeId?: string;
|
|
@@ -89,7 +87,7 @@ interface ChatContext {
|
|
|
89
87
|
switchboardGraphqlUrl?: string;
|
|
90
88
|
}
|
|
91
89
|
/** Events the agent emits while running a turn. */
|
|
92
|
-
type AgentEvent = {
|
|
90
|
+
export type AgentEvent = {
|
|
93
91
|
type: "text-delta";
|
|
94
92
|
delta: string;
|
|
95
93
|
} | {
|
|
@@ -113,12 +111,12 @@ type AgentEvent = {
|
|
|
113
111
|
state: "done" | "error" | "rejected";
|
|
114
112
|
result?: unknown;
|
|
115
113
|
error?: string;
|
|
116
|
-
}
|
|
114
|
+
} |
|
|
117
115
|
/**
|
|
118
116
|
* Token accounting for the turn: the input tokens of the model's last
|
|
119
117
|
* step (i.e. the size of the context it was reasoning over).
|
|
120
118
|
*/
|
|
121
|
-
|
|
119
|
+
{
|
|
122
120
|
type: "usage";
|
|
123
121
|
inputTokens: number;
|
|
124
122
|
} | {
|
|
@@ -130,7 +128,7 @@ type AgentEvent = {
|
|
|
130
128
|
//#endregion
|
|
131
129
|
//#region src/ai/agent.d.ts
|
|
132
130
|
/** Hard cap on model round-trips per user message (each tool step counts). */
|
|
133
|
-
declare const MAX_AGENT_STEPS = 10;
|
|
131
|
+
export declare const MAX_AGENT_STEPS = 10;
|
|
134
132
|
/**
|
|
135
133
|
* Hard cap on the characters of one tool result fed back to the model.
|
|
136
134
|
*
|
|
@@ -140,7 +138,7 @@ declare const MAX_AGENT_STEPS = 10;
|
|
|
140
138
|
* context and stall the turn. Over-budget results are truncated with a
|
|
141
139
|
* marker so the model re-queries more narrowly.
|
|
142
140
|
*/
|
|
143
|
-
declare const MAX_TOOL_RESULT_CHARS = 12000;
|
|
141
|
+
export declare const MAX_TOOL_RESULT_CHARS = 12000;
|
|
144
142
|
/**
|
|
145
143
|
* Number of the most recent turns whose tool results are kept in full in
|
|
146
144
|
* the committed history. Tool results are re-derivable (the store is the
|
|
@@ -148,9 +146,9 @@ declare const MAX_TOOL_RESULT_CHARS = 12000;
|
|
|
148
146
|
* one-line stubs: this is what keeps a long conversation from exhausting
|
|
149
147
|
* the model's context.
|
|
150
148
|
*/
|
|
151
|
-
declare const FULL_RESULT_TURNS = 2;
|
|
149
|
+
export declare const FULL_RESULT_TURNS = 2;
|
|
152
150
|
/** Tool results smaller than this are cheap to keep and are never stubbed. */
|
|
153
|
-
declare const STUB_MIN_CHARS = 500;
|
|
151
|
+
export declare const STUB_MIN_CHARS = 500;
|
|
154
152
|
/**
|
|
155
153
|
* Replaces tool results older than the last {@link FULL_RESULT_TURNS}
|
|
156
154
|
* turns with one-line stubs naming the tool and its arguments. User and
|
|
@@ -158,17 +156,17 @@ declare const STUB_MIN_CHARS = 500;
|
|
|
158
156
|
* so the model can re-query any stubbed result with the same arguments.
|
|
159
157
|
* Idempotent: stubs are below {@link STUB_MIN_CHARS} and pass through.
|
|
160
158
|
*/
|
|
161
|
-
declare function stubStaleToolResults(history: ModelMessage[]): ModelMessage[];
|
|
162
|
-
declare function createReactorChatModel(settings: AiSettings): LanguageModel;
|
|
159
|
+
export declare function stubStaleToolResults(history: ModelMessage[]): ModelMessage[];
|
|
160
|
+
export declare function createReactorChatModel(settings: AiSettings): LanguageModel;
|
|
163
161
|
/**
|
|
164
162
|
* Unwraps the MCP `CallToolResult` envelope produced by the reactor tool
|
|
165
163
|
* core into a plain value for the AI SDK. Throws for error results so the
|
|
166
164
|
* SDK surfaces them as tool errors in the next model step.
|
|
167
165
|
*/
|
|
168
|
-
declare function unwrapToolResult(raw: unknown): unknown;
|
|
166
|
+
export declare function unwrapToolResult(raw: unknown): unknown;
|
|
169
167
|
/** Builds the system prompt, grounding the agent in the current selection. */
|
|
170
|
-
declare function buildSystemPrompt(context: ChatContext): string;
|
|
171
|
-
interface ReactorChatAgentOptions {
|
|
168
|
+
export declare function buildSystemPrompt(context: ChatContext): string;
|
|
169
|
+
export interface ReactorChatAgentOptions {
|
|
172
170
|
settings: AiSettings;
|
|
173
171
|
tools: AiToolDescriptor[];
|
|
174
172
|
context: ChatContext;
|
|
@@ -186,7 +184,7 @@ interface ReactorChatAgentOptions {
|
|
|
186
184
|
* gated by the AI SDK's tool approval: when auto-approval is off, the
|
|
187
185
|
* pending user decision is bridged through {@link approve}/{@link reject}.
|
|
188
186
|
*/
|
|
189
|
-
declare class ReactorChatAgent {
|
|
187
|
+
export declare class ReactorChatAgent {
|
|
190
188
|
private readonly options;
|
|
191
189
|
private history;
|
|
192
190
|
private approvals;
|
|
@@ -216,18 +214,14 @@ declare class ReactorChatAgent {
|
|
|
216
214
|
* In-chat approval card for a write tool call. Approving or rejecting
|
|
217
215
|
* resolves the pending approval inside the agent loop.
|
|
218
216
|
*/
|
|
219
|
-
declare function ApprovalCard({
|
|
220
|
-
approval,
|
|
221
|
-
onApprove,
|
|
222
|
-
onReject
|
|
223
|
-
}: {
|
|
217
|
+
export declare function ApprovalCard({ approval, onApprove, onReject }: {
|
|
224
218
|
approval: PendingApproval;
|
|
225
219
|
onApprove: (toolCallId: string) => void;
|
|
226
220
|
onReject: (toolCallId: string) => void;
|
|
227
|
-
}):
|
|
221
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
228
222
|
//#endregion
|
|
229
223
|
//#region src/ai/use-reactor-chat.d.ts
|
|
230
|
-
interface UseReactorChatResult {
|
|
224
|
+
export interface UseReactorChatResult {
|
|
231
225
|
messages: ChatMessage[];
|
|
232
226
|
isStreaming: boolean;
|
|
233
227
|
pendingApprovals: PendingApproval[];
|
|
@@ -248,17 +242,14 @@ interface UseReactorChatResult {
|
|
|
248
242
|
* user sends a message, so the reactor does not need to be ready at render
|
|
249
243
|
* time.
|
|
250
244
|
*/
|
|
251
|
-
declare function useReactorChat(toolsProvider?: AiToolsProvider): UseReactorChatResult;
|
|
245
|
+
export declare function useReactorChat(toolsProvider?: AiToolsProvider): UseReactorChatResult;
|
|
252
246
|
//#endregion
|
|
253
247
|
//#region src/ai/components/chat-window.d.ts
|
|
254
248
|
/** The chat window panel, anchored above the FAB in the bottom-right. */
|
|
255
|
-
declare function ChatWindow({
|
|
256
|
-
chat,
|
|
257
|
-
onClose
|
|
258
|
-
}: {
|
|
249
|
+
export declare function ChatWindow({ chat, onClose }: {
|
|
259
250
|
chat: UseReactorChatResult;
|
|
260
251
|
onClose: () => void;
|
|
261
|
-
}):
|
|
252
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
262
253
|
//#endregion
|
|
263
254
|
//#region src/ai/components/reactor-chat-fab.d.ts
|
|
264
255
|
/**
|
|
@@ -268,11 +259,9 @@ declare function ChatWindow({
|
|
|
268
259
|
* `createReactorMcpProvider` bound to the browser reactor client) when the
|
|
269
260
|
* user sends a message.
|
|
270
261
|
*/
|
|
271
|
-
declare function ReactorChatFab({
|
|
272
|
-
getTools
|
|
273
|
-
}: {
|
|
262
|
+
export declare function ReactorChatFab({ getTools }: {
|
|
274
263
|
getTools?: AiToolsProvider;
|
|
275
|
-
}):
|
|
264
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
276
265
|
//#endregion
|
|
277
266
|
//#region src/ai/context.d.ts
|
|
278
267
|
/**
|
|
@@ -280,28 +269,28 @@ declare function ReactorChatFab({
|
|
|
280
269
|
* chat context-aware: "create a budget here" targets the selected drive,
|
|
281
270
|
* "summarize this document" targets the selected document.
|
|
282
271
|
*/
|
|
283
|
-
declare function useChatContext(): ChatContext;
|
|
272
|
+
export declare function useChatContext(): ChatContext;
|
|
284
273
|
//#endregion
|
|
285
274
|
//#region src/ai/settings-store.d.ts
|
|
286
|
-
declare const DEFAULT_AI_SETTINGS: AiSettings;
|
|
275
|
+
export declare const DEFAULT_AI_SETTINGS: AiSettings;
|
|
287
276
|
type Listener = () => void;
|
|
288
277
|
/** Returns the current settings (stable snapshot for useSyncExternalStore). */
|
|
289
|
-
declare function getAiSettings(): AiSettings;
|
|
278
|
+
export declare function getAiSettings(): AiSettings;
|
|
290
279
|
/** Merges a partial update, persists, and notifies subscribers. */
|
|
291
|
-
declare function updateAiSettings(patch: Partial<AiSettings>): AiSettings;
|
|
280
|
+
export declare function updateAiSettings(patch: Partial<AiSettings>): AiSettings;
|
|
292
281
|
/** Clears all stored settings. */
|
|
293
|
-
declare function clearAiSettings(): void;
|
|
282
|
+
export declare function clearAiSettings(): void;
|
|
294
283
|
/** Subscribes to settings changes. Returns the unsubscribe function. */
|
|
295
|
-
declare function subscribeAiSettings(listener: Listener): () => void;
|
|
284
|
+
export declare function subscribeAiSettings(listener: Listener): () => void;
|
|
296
285
|
/** True when the endpoint, key and model are all configured. */
|
|
297
|
-
declare function isAiConfigured(settings: AiSettings): boolean;
|
|
286
|
+
export declare function isAiConfigured(settings: AiSettings): boolean;
|
|
298
287
|
//#endregion
|
|
299
288
|
//#region src/ai/switchboard.d.ts
|
|
300
289
|
/**
|
|
301
290
|
* The switchboard serving a remote drive: the base URL the browser talks to
|
|
302
291
|
* and its GraphQL supergraph endpoint.
|
|
303
292
|
*/
|
|
304
|
-
interface DriveSwitchboard {
|
|
293
|
+
export interface DriveSwitchboard {
|
|
305
294
|
/** Switchboard base URL (e.g. `http://localhost:4001`). */
|
|
306
295
|
switchboardUrl: string;
|
|
307
296
|
/** GraphQL supergraph endpoint (`<base>/graphql`). */
|
|
@@ -312,9 +301,9 @@ interface DriveSwitchboard {
|
|
|
312
301
|
* `undefined` in non-browser environments or before the reactor client
|
|
313
302
|
* module is initialized.
|
|
314
303
|
*/
|
|
315
|
-
declare function getBrowserSyncManager(): ISyncManager | undefined;
|
|
304
|
+
export declare function getBrowserSyncManager(): ISyncManager | undefined;
|
|
316
305
|
/** Suffix of the per-drive GraphQL channel endpoint the switchboard serves. */
|
|
317
|
-
declare const GQL_CHANNEL_SUFFIX = "/graphql/r";
|
|
306
|
+
export declare const GQL_CHANNEL_SUFFIX = "/graphql/r";
|
|
318
307
|
/**
|
|
319
308
|
* Resolves the switchboard that serves a drive, if any.
|
|
320
309
|
*
|
|
@@ -326,15 +315,15 @@ declare const GQL_CHANNEL_SUFFIX = "/graphql/r";
|
|
|
326
315
|
* correct. Drives that are not synced to a remote switchboard (local
|
|
327
316
|
* drives, other channel types, unexpected shapes) return `undefined`.
|
|
328
317
|
*/
|
|
329
|
-
declare function resolveDriveSwitchboard(driveId: string | undefined, syncManager?: ISyncManager): DriveSwitchboard | undefined;
|
|
318
|
+
export declare function resolveDriveSwitchboard(driveId: string | undefined, syncManager?: ISyncManager): DriveSwitchboard | undefined;
|
|
330
319
|
/**
|
|
331
320
|
* Introspection over the switchboard supergraph's root query and mutation
|
|
332
321
|
* fields. Types are requested with three levels of `ofType` nesting so
|
|
333
322
|
* that common shapes like `[X!]!` (LIST(NON_NULL(LIST(X)))) render fully.
|
|
334
323
|
*/
|
|
335
|
-
declare const SWITCHBOARD_INTROSPECTION_QUERY: string;
|
|
324
|
+
export declare const SWITCHBOARD_INTROSPECTION_QUERY: string;
|
|
336
325
|
/** One root query or mutation field, reduced to a prompt-friendly line. */
|
|
337
|
-
type SchemaFieldSummary = {
|
|
326
|
+
export type SchemaFieldSummary = {
|
|
338
327
|
name: string;
|
|
339
328
|
description?: string;
|
|
340
329
|
args: string;
|
|
@@ -345,14 +334,14 @@ type SchemaFieldSummary = {
|
|
|
345
334
|
* object) to a compact summary of its root query and mutation fields.
|
|
346
335
|
* Accepts `unknown` because the payload arrives over the wire.
|
|
347
336
|
*/
|
|
348
|
-
declare function summarizeIntrospectionSchema(schema: unknown): {
|
|
337
|
+
export declare function summarizeIntrospectionSchema(schema: unknown): {
|
|
349
338
|
queries: SchemaFieldSummary[];
|
|
350
339
|
mutations: SchemaFieldSummary[];
|
|
351
340
|
truncated: boolean;
|
|
352
341
|
};
|
|
353
|
-
declare const SWITCHBOARD_SCHEMA_TOOL_NAME = "getSwitchboardSchema";
|
|
342
|
+
export declare const SWITCHBOARD_SCHEMA_TOOL_NAME = "getSwitchboardSchema";
|
|
354
343
|
/** Test seams for {@link createSwitchboardSchemaTool}. */
|
|
355
|
-
interface SwitchboardToolDeps {
|
|
344
|
+
export interface SwitchboardToolDeps {
|
|
356
345
|
getSyncManager?: () => ISyncManager | undefined;
|
|
357
346
|
getSelectedDriveId?: () => string | undefined;
|
|
358
347
|
tokenProvider?: () => Promise<string | undefined>;
|
|
@@ -365,7 +354,7 @@ interface SwitchboardToolDeps {
|
|
|
365
354
|
* summary of its root queries and mutations. It reads the schema only and
|
|
366
355
|
* never modifies data.
|
|
367
356
|
*/
|
|
368
|
-
declare function createSwitchboardSchemaTool(deps?: SwitchboardToolDeps): AiToolDescriptor;
|
|
357
|
+
export declare function createSwitchboardSchemaTool(deps?: SwitchboardToolDeps): AiToolDescriptor;
|
|
369
358
|
//#endregion
|
|
370
|
-
export {
|
|
359
|
+
export {};
|
|
371
360
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/ai/types.ts","../../../src/ai/agent.ts","../../../src/ai/components/approval-card.tsx","../../../src/ai/use-reactor-chat.ts","../../../src/ai/components/chat-window.tsx","../../../src/ai/components/reactor-chat-fab.tsx","../../../src/ai/context.ts","../../../src/ai/settings-store.ts","../../../src/ai/switchboard.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/ai/types.ts","../../../src/ai/agent.ts","../../../src/ai/components/approval-card.tsx","../../../src/ai/use-reactor-chat.ts","../../../src/ai/components/chat-window.tsx","../../../src/ai/components/reactor-chat-fab.tsx","../../../src/ai/context.ts","../../../src/ai/settings-store.ts","../../../src/ai/switchboard.ts"],"mappings":";;;;;;;;;;;;;iBAeiB;;EAEf;;EAEA;;EAEA;;EAEA;;;;;EAKA;;;YAIU,oBAAoB;;;;;;;;;;YAWpB,mBAAmB;;YAGnB,wBAAwB,QAAQ;;qBAG/B,aAAa;;;;;;wBAcV,YACd,cACA,cAAc;YAKJ;;YAQA;EACN;EAAc;;EAEd;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;;iBAGW;EACf;EACA;EACA,OAAO;;;iBAIQ;EACf;EACA;EACA;;;iBAIe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;YAIU;EACN;EAAoB;;EAEpB;EACA;EACA;EACA;;EAGA;EACA;EACA;EACA;;EAEA;EAA2B;EAAoB;;EAE/C;EACA;EACA;EACA;EACA;EACA;;;;;;;EAMA;EAAe;;EACf;;EACA;EAAe;;;;;qBC/HR;;;;;;;;;;qBAWA;;;;;;;;qBA0BA;;qBAGA;;;;;;;;wBAiCG,qBAAqB,SAAS,iBAAiB;wBAiE/C,uBAAuB,UAAU,aAAa;;;;;;wBAc9C,iBAAiB;;wBAmCjB,kBAAkB,SAAS;iBAiD1B;EACf,UAAU;EACV,OAAO;EACP,SAAS;EACT,UAAU,OAAO;EACjB,SAAS;;EAET,QAAQ;;EAER,UAAU;;;;;;;;;qBAUC;mBAIkB;UAHrB;UACA;EAER,YAA6B,SAAS;;EAKtC,cAAc;;EAKd;;EAMA,QAAQ;;EAKR,OAAO;UAIC;UAQA;;EAQF,KAAK,eAAe;;;;;UA8FlB;UA8BA;;;;;;;;wBC3aM,eACd,UACA,WACA;EAEA,UAAU;EACV,YAAY;EACZ,WAAW;gCACZ,IAAA;;;iBCagB;EACf,UAAU;EACV;EACA,kBAAkB;EAClB;EACA,UAAU;EACV;EACA,OAAO;EACP;EACA,UAAU;EACV,SAAS;EACT;;;;;;;;;;wBAWc,eACd,gBAAgB,kBACf;;;;wBCyDa,aACd,MACA;EAEA,MAAM;EACN;gCACD,IAAA;;;;;;;;;;wBC/Ge,iBAAiB;EAAc,WAAW;gCAAiB,IAAA;;;;;;;;wBCF3D,kBAAkB;;;qBCRrB,qBAAqB;KAQ7B;;wBA6CW,iBAAiB;;wBAKjB,iBAAiB,OAAO,QAAQ,cAAc;;wBAQ9C;;wBAWA,oBAAoB,UAAU;;wBAQ9B,eAAe,UAAU;;;;;;;iBChFxB;;EAEf;;EAEA;;;;;;;wBAQc,yBAAyB;;qBAQ5B;;;;;;;;;;;;wBAaG,wBACd,6BACA,cAAc,eACb;;;;;;qBAoDU;;YA6GD;EACV;EACA;EACA;EACA;;;;;;;wBA6Bc,6BAA6B;EAC3C,SAAS;EACT,WAAW;EACX;;qBAYW;;iBAGI;EACf,uBAAuB;EACvB;EACA,sBAAsB;EACtB,mBAAmB;EACnB;;;;;;;;wBASc,4BACd,OAAO,sBACN"}
|
package/dist/src/ai/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as getBrowserSyncManager, i as createSwitchboardSchemaTool, l as useSelectedDocumentId, n as SWITCHBOARD_INTROSPECTION_QUERY, o as resolveDriveSwitchboard, r as SWITCHBOARD_SCHEMA_TOOL_NAME, s as summarizeIntrospectionSchema, t as GQL_CHANNEL_SUFFIX } from "../../switchboard-
|
|
1
|
+
import { m as useSelectedDriveSafe } from "../../document-model-modules-Gsh1Xr7j.js";
|
|
2
|
+
import { a as getBrowserSyncManager, i as createSwitchboardSchemaTool, l as useSelectedDocumentId, n as SWITCHBOARD_INTROSPECTION_QUERY, o as resolveDriveSwitchboard, p as useSelectedNode, r as SWITCHBOARD_SCHEMA_TOOL_NAME, s as summarizeIntrospectionSchema, t as GQL_CHANNEL_SUFFIX } from "../../switchboard-3vHbIV5W.js";
|
|
3
3
|
import { isFileNode, isFolderNode } from "@powerhousedao/shared/document-drive";
|
|
4
4
|
import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -12,7 +12,7 @@ import ReactMarkdown from "react-markdown";
|
|
|
12
12
|
import remarkGfm from "remark-gfm";
|
|
13
13
|
//#region src/ai/types.ts
|
|
14
14
|
/** Tool names whose execution mutates the reactor and requires approval. */
|
|
15
|
-
const WRITE_TOOLS = new Set([
|
|
15
|
+
const WRITE_TOOLS = /* @__PURE__ */ new Set([
|
|
16
16
|
"createDocument",
|
|
17
17
|
"addActions",
|
|
18
18
|
"deleteDocument",
|
|
@@ -204,6 +204,7 @@ function buildSystemPrompt(context) {
|
|
|
204
204
|
* pending user decision is bridged through {@link approve}/{@link reject}.
|
|
205
205
|
*/
|
|
206
206
|
var ReactorChatAgent = class {
|
|
207
|
+
options;
|
|
207
208
|
history;
|
|
208
209
|
approvals = /* @__PURE__ */ new Map();
|
|
209
210
|
constructor(options) {
|
|
@@ -398,7 +399,6 @@ var ReactorChatAgent = class {
|
|
|
398
399
|
});
|
|
399
400
|
break;
|
|
400
401
|
}
|
|
401
|
-
default: break;
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
404
|
};
|
|
@@ -927,10 +927,7 @@ function useReactorChat(toolsProvider) {
|
|
|
927
927
|
error: event.error
|
|
928
928
|
} : part)));
|
|
929
929
|
break;
|
|
930
|
-
case "error":
|
|
931
|
-
setError(event.error);
|
|
932
|
-
break;
|
|
933
|
-
case "finish": break;
|
|
930
|
+
case "error": setError(event.error);
|
|
934
931
|
}
|
|
935
932
|
}, []);
|
|
936
933
|
const send = useCallback((text) => {
|