@powerhousedao/reactor-browser 6.2.2-dev.8 → 6.2.2-dev.80
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 +341 -0
- package/dist/attachment-service-LwpgZ358.d.ts +1057 -0
- package/dist/attachment-service-LwpgZ358.d.ts.map +1 -0
- package/dist/{client-u13cr-Vg.js → client-B8ezRmBB.js} +30 -3
- package/dist/client-B8ezRmBB.js.map +1 -0
- package/dist/client-BIHN_UyR.d.ts +14 -0
- package/dist/client-BIHN_UyR.d.ts.map +1 -0
- package/dist/{client-_Gh2Uf0E.js → client-D66jVnot.js} +79 -13
- package/dist/client-D66jVnot.js.map +1 -0
- package/dist/{document-by-id-dLYFX-xz.js → document-by-id-BSZqTN66.js} +81 -51
- package/dist/document-by-id-BSZqTN66.js.map +1 -0
- package/dist/document-model-modules-DMIR-uSD.js +411 -0
- package/dist/document-model-modules-DMIR-uSD.js.map +1 -0
- package/dist/document-operations-BO-SlTDw.js +2539 -0
- package/dist/document-operations-BO-SlTDw.js.map +1 -0
- package/dist/global-1rvI8VdA.d.ts +400 -0
- package/dist/global-1rvI8VdA.d.ts.map +1 -0
- package/dist/index-BE3wBHLP.d.ts +349 -0
- package/dist/index-BE3wBHLP.d.ts.map +1 -0
- package/dist/index-BIVDXw3K.d.ts +144 -0
- package/dist/index-BIVDXw3K.d.ts.map +1 -0
- package/dist/index.d.ts +313 -715
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +611 -1696
- package/dist/index.js.map +1 -1
- package/dist/{inspector-proxy-CvQDDxmT.d.ts → inspector-proxy-6h5VKAwt.d.ts} +4 -2
- package/dist/inspector-proxy-6h5VKAwt.d.ts.map +1 -0
- package/dist/{make-ph-event-functions-BHoLPif5.js → make-ph-event-functions-DBq3iWYn.js} +1 -1
- package/dist/{make-ph-event-functions-BHoLPif5.js.map → make-ph-event-functions-DBq3iWYn.js.map} +1 -1
- package/dist/{index-DS4W07Y8.d.ts → pglite-CntadC_p-9NDG14dS.d.ts} +2 -142
- package/dist/pglite-CntadC_p-9NDG14dS.d.ts.map +1 -0
- package/dist/{relational-Dj06-YkI.js → relational-D4sxGPz7.js} +2 -2
- package/dist/{relational-Dj06-YkI.js.map → relational-D4sxGPz7.js.map} +1 -1
- package/dist/renown-BHxwP7xU.js +97 -0
- package/dist/renown-BHxwP7xU.js.map +1 -0
- package/dist/{renown-D-1c_Bvx.js → renown-BIEv6bSI.js} +523 -57
- package/dist/renown-BIEv6bSI.js.map +1 -0
- package/dist/selected-document-xFBNPc9Q.js +42 -0
- package/dist/selected-document-xFBNPc9Q.js.map +1 -0
- package/dist/src/ai/index.d.ts +369 -0
- package/dist/src/ai/index.d.ts.map +1 -0
- package/dist/src/ai/index.js +1296 -0
- package/dist/src/ai/index.js.map +1 -0
- package/dist/src/analytics/index.d.ts +1 -1
- package/dist/src/analytics/index.js +2 -1
- package/dist/src/analytics/index.js.map +1 -1
- package/dist/src/graphql/client.d.ts +3 -2
- package/dist/src/graphql/client.js +1 -1
- package/dist/src/graphql-client/entry.d.ts +4 -0
- package/dist/src/graphql-client/entry.js +4 -0
- package/dist/src/relational/index.d.ts +1 -1
- package/dist/src/relational/index.js +1 -1
- package/dist/src/renown/index.d.ts +2 -2
- package/dist/src/renown/index.js +3 -2
- package/dist/src/rpc/index.d.ts +6 -3
- package/dist/src/rpc/index.d.ts.map +1 -1
- package/dist/src/rpc/index.js +41 -10
- package/dist/src/rpc/index.js.map +1 -1
- package/dist/store-BJYcr_FL.js +37 -0
- package/dist/store-BJYcr_FL.js.map +1 -0
- package/dist/{types-CPV0Cnsy.d.ts → types-6vDzbRRS.d.ts} +1 -1
- package/dist/{types-CPV0Cnsy.d.ts.map → types-6vDzbRRS.d.ts.map} +1 -1
- package/dist/{client-09xv0Dq6.d.ts → types-Dcv1ZLoW.d.ts} +87 -19
- package/dist/types-Dcv1ZLoW.d.ts.map +1 -0
- package/package.json +26 -10
- package/dist/client-09xv0Dq6.d.ts.map +0 -1
- package/dist/client-_Gh2Uf0E.js.map +0 -1
- package/dist/client-u13cr-Vg.js.map +0 -1
- package/dist/document-by-id-dLYFX-xz.js.map +0 -1
- package/dist/index-D3bV5rcl.d.ts +0 -216
- package/dist/index-D3bV5rcl.d.ts.map +0 -1
- package/dist/index-DS4W07Y8.d.ts.map +0 -1
- package/dist/inspector-proxy-CvQDDxmT.d.ts.map +0 -1
- package/dist/renown-D-1c_Bvx.js.map +0 -1
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import { PhAiToolAnnotations, PhAiToolDescriptor } from "@powerhousedao/shared/document-model";
|
|
2
|
+
import { ISyncManager } from "@powerhousedao/reactor";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
import { LanguageModel, ModelMessage } from "ai";
|
|
5
|
+
|
|
6
|
+
//#region src/ai/types.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Browser-side AI chat over the reactor.
|
|
9
|
+
*
|
|
10
|
+
* The chat agent is tool-agnostic: consumers (e.g. Connect) pass a lazy
|
|
11
|
+
* provider of {@link AiToolDescriptor}s. The descriptors mirror the
|
|
12
|
+
* provider-agnostic tool core in `@powerhousedao/reactor-mcp/tools`, so the
|
|
13
|
+
* same tool definitions drive both the MCP server and the in-browser chat.
|
|
14
|
+
*/
|
|
15
|
+
/** User-configured LLM connection settings, persisted in localStorage. */
|
|
16
|
+
interface AiSettings {
|
|
17
|
+
/** Master on/off for the in-browser assistant. Off by default. */
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
/** OpenAI-compatible base URL, e.g. `https://api.openai.com/v1` */
|
|
20
|
+
baseUrl: string;
|
|
21
|
+
/** API key. Sent only to the configured endpoint, never to Powerhouse. */
|
|
22
|
+
apiKey: string;
|
|
23
|
+
/** Model id the endpoint serves, e.g. `gpt-4o-mini`. */
|
|
24
|
+
model: string;
|
|
25
|
+
/**
|
|
26
|
+
* When false (default), write tools render an approval card and pause the
|
|
27
|
+
* agent loop until the user approves or rejects the action.
|
|
28
|
+
*/
|
|
29
|
+
autoApproveWrites: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** MCP-compatible annotation hints; structural, no MCP SDK dependency. */
|
|
32
|
+
type AiToolAnnotations = PhAiToolAnnotations;
|
|
33
|
+
/**
|
|
34
|
+
* Provider-agnostic tool descriptor accepted by the chat agent.
|
|
35
|
+
*
|
|
36
|
+
* Structurally compatible with the MCP tool records produced by
|
|
37
|
+
* `createReactorMcpProvider`: the callback parameter is `never` so any
|
|
38
|
+
* per-tool-args function type is assignable, and the result is `unknown`
|
|
39
|
+
* because the envelope shape (MCP `CallToolResult`) is unwrapped at the
|
|
40
|
+
* adapter boundary.
|
|
41
|
+
*/
|
|
42
|
+
type AiToolDescriptor = PhAiToolDescriptor;
|
|
43
|
+
/** Tool descriptors the app resolves when the user sends a message. */
|
|
44
|
+
type AiToolsProvider = () => Promise<AiToolDescriptor[]>;
|
|
45
|
+
/** Tool names whose execution mutates the reactor and requires approval. */
|
|
46
|
+
declare const WRITE_TOOLS: ReadonlySet<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Whether executing the tool mutates state and requires user approval:
|
|
49
|
+
* the built-in write tools, or any tool flagged destructive in its
|
|
50
|
+
* annotations (covers package-provided tools outside the built-in set).
|
|
51
|
+
*/
|
|
52
|
+
declare function isWriteTool(name: string, annotations?: AiToolAnnotations): boolean;
|
|
53
|
+
type ToolCallState = "awaiting-approval" | "executing" | "done" | "error" | "rejected";
|
|
54
|
+
/** One rendered unit inside a chat message. */
|
|
55
|
+
type ChatPart = {
|
|
56
|
+
type: "text";
|
|
57
|
+
text: string;
|
|
58
|
+
} | {
|
|
59
|
+
type: "tool";
|
|
60
|
+
toolCallId: string;
|
|
61
|
+
name: string;
|
|
62
|
+
args: unknown;
|
|
63
|
+
state: ToolCallState;
|
|
64
|
+
result?: unknown;
|
|
65
|
+
error?: string;
|
|
66
|
+
};
|
|
67
|
+
interface ChatMessage {
|
|
68
|
+
id: string;
|
|
69
|
+
role: "user" | "assistant";
|
|
70
|
+
parts: ChatPart[];
|
|
71
|
+
}
|
|
72
|
+
/** A write tool call the user must approve or reject. */
|
|
73
|
+
interface PendingApproval {
|
|
74
|
+
toolCallId: string;
|
|
75
|
+
name: string;
|
|
76
|
+
args: unknown;
|
|
77
|
+
}
|
|
78
|
+
/** Context snapshot injected into the agent system prompt. */
|
|
79
|
+
interface ChatContext {
|
|
80
|
+
driveId?: string;
|
|
81
|
+
driveName?: string;
|
|
82
|
+
nodeId?: string;
|
|
83
|
+
nodeName?: string;
|
|
84
|
+
nodeKind?: "file" | "folder";
|
|
85
|
+
documentType?: string;
|
|
86
|
+
documentName?: string;
|
|
87
|
+
documentId?: string;
|
|
88
|
+
switchboardUrl?: string;
|
|
89
|
+
switchboardGraphqlUrl?: string;
|
|
90
|
+
}
|
|
91
|
+
/** Events the agent emits while running a turn. */
|
|
92
|
+
type AgentEvent = {
|
|
93
|
+
type: "text-delta";
|
|
94
|
+
delta: string;
|
|
95
|
+
} | {
|
|
96
|
+
type: "tool-start";
|
|
97
|
+
toolCallId: string;
|
|
98
|
+
name: string;
|
|
99
|
+
args: unknown;
|
|
100
|
+
} | {
|
|
101
|
+
type: "approval-request";
|
|
102
|
+
toolCallId: string;
|
|
103
|
+
name: string;
|
|
104
|
+
args: unknown;
|
|
105
|
+
} | {
|
|
106
|
+
type: "approval-resolved";
|
|
107
|
+
toolCallId: string;
|
|
108
|
+
approved: boolean;
|
|
109
|
+
} | {
|
|
110
|
+
type: "tool-result";
|
|
111
|
+
toolCallId: string;
|
|
112
|
+
name: string;
|
|
113
|
+
state: "done" | "error" | "rejected";
|
|
114
|
+
result?: unknown;
|
|
115
|
+
error?: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Token accounting for the turn: the input tokens of the model's last
|
|
119
|
+
* step (i.e. the size of the context it was reasoning over).
|
|
120
|
+
*/
|
|
121
|
+
| {
|
|
122
|
+
type: "usage";
|
|
123
|
+
inputTokens: number;
|
|
124
|
+
} | {
|
|
125
|
+
type: "finish";
|
|
126
|
+
} | {
|
|
127
|
+
type: "error";
|
|
128
|
+
error: string;
|
|
129
|
+
};
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/ai/agent.d.ts
|
|
132
|
+
/** Hard cap on model round-trips per user message (each tool step counts). */
|
|
133
|
+
declare const MAX_AGENT_STEPS = 10;
|
|
134
|
+
/**
|
|
135
|
+
* Hard cap on the characters of one tool result fed back to the model.
|
|
136
|
+
*
|
|
137
|
+
* Large results (whole document states, catalog listings, schema
|
|
138
|
+
* summaries) accumulate across steps because every step resends the whole
|
|
139
|
+
* conversation; without a budget a few broad queries exhaust the model's
|
|
140
|
+
* context and stall the turn. Over-budget results are truncated with a
|
|
141
|
+
* marker so the model re-queries more narrowly.
|
|
142
|
+
*/
|
|
143
|
+
declare const MAX_TOOL_RESULT_CHARS = 12000;
|
|
144
|
+
/**
|
|
145
|
+
* Number of the most recent turns whose tool results are kept in full in
|
|
146
|
+
* the committed history. Tool results are re-derivable (the store is the
|
|
147
|
+
* source of truth), so results older than that window are replaced with
|
|
148
|
+
* one-line stubs: this is what keeps a long conversation from exhausting
|
|
149
|
+
* the model's context.
|
|
150
|
+
*/
|
|
151
|
+
declare const FULL_RESULT_TURNS = 2;
|
|
152
|
+
/** Tool results smaller than this are cheap to keep and are never stubbed. */
|
|
153
|
+
declare const STUB_MIN_CHARS = 500;
|
|
154
|
+
/**
|
|
155
|
+
* Replaces tool results older than the last {@link FULL_RESULT_TURNS}
|
|
156
|
+
* turns with one-line stubs naming the tool and its arguments. User and
|
|
157
|
+
* assistant messages are never touched, and tool calls keep their input,
|
|
158
|
+
* so the model can re-query any stubbed result with the same arguments.
|
|
159
|
+
* Idempotent: stubs are below {@link STUB_MIN_CHARS} and pass through.
|
|
160
|
+
*/
|
|
161
|
+
declare function stubStaleToolResults(history: ModelMessage[]): ModelMessage[];
|
|
162
|
+
declare function createReactorChatModel(settings: AiSettings): LanguageModel;
|
|
163
|
+
/**
|
|
164
|
+
* Unwraps the MCP `CallToolResult` envelope produced by the reactor tool
|
|
165
|
+
* core into a plain value for the AI SDK. Throws for error results so the
|
|
166
|
+
* SDK surfaces them as tool errors in the next model step.
|
|
167
|
+
*/
|
|
168
|
+
declare function unwrapToolResult(raw: unknown): unknown;
|
|
169
|
+
/** Builds the system prompt, grounding the agent in the current selection. */
|
|
170
|
+
declare function buildSystemPrompt(context: ChatContext): string;
|
|
171
|
+
interface ReactorChatAgentOptions {
|
|
172
|
+
settings: AiSettings;
|
|
173
|
+
tools: AiToolDescriptor[];
|
|
174
|
+
context: ChatContext;
|
|
175
|
+
onEvent: (event: AgentEvent) => void;
|
|
176
|
+
signal?: AbortSignal;
|
|
177
|
+
/** Test seam: override the model (e.g. a mock language model). */
|
|
178
|
+
model?: LanguageModel;
|
|
179
|
+
/** Prior conversation to continue (see {@link ReactorChatAgent.getHistory}). */
|
|
180
|
+
history?: ModelMessage[];
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Runs one tool-loop conversation turn against an OpenAI-compatible model.
|
|
184
|
+
*
|
|
185
|
+
* The agent keeps the model message history across turns. Write tools are
|
|
186
|
+
* gated by the AI SDK's tool approval: when auto-approval is off, the
|
|
187
|
+
* pending user decision is bridged through {@link approve}/{@link reject}.
|
|
188
|
+
*/
|
|
189
|
+
declare class ReactorChatAgent {
|
|
190
|
+
private readonly options;
|
|
191
|
+
private history;
|
|
192
|
+
private approvals;
|
|
193
|
+
constructor(options: ReactorChatAgentOptions);
|
|
194
|
+
/** The model history after the last completed turn, for the next agent. */
|
|
195
|
+
getHistory(): ModelMessage[];
|
|
196
|
+
/** Clears the conversation history (a fresh chat). */
|
|
197
|
+
reset(): void;
|
|
198
|
+
/** Approves a pending write tool call, resuming the agent loop. */
|
|
199
|
+
approve(toolCallId: string): void;
|
|
200
|
+
/** Rejects a pending write tool call; the rejection is fed to the model. */
|
|
201
|
+
reject(toolCallId: string): void;
|
|
202
|
+
private resolveApproval;
|
|
203
|
+
private cancelPendingApprovals;
|
|
204
|
+
/** Runs one user turn: appends the message, streams the model, commits history. */
|
|
205
|
+
send(text: string): Promise<void>;
|
|
206
|
+
/**
|
|
207
|
+
* Removes tool calls that were never executed (step cap or abort):
|
|
208
|
+
* OpenAI-compatible APIs reject a tool call without its tool result.
|
|
209
|
+
*/
|
|
210
|
+
private dropUnresolvedToolCalls;
|
|
211
|
+
private handleStreamPart;
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/ai/components/approval-card.d.ts
|
|
215
|
+
/**
|
|
216
|
+
* In-chat approval card for a write tool call. Approving or rejecting
|
|
217
|
+
* resolves the pending approval inside the agent loop.
|
|
218
|
+
*/
|
|
219
|
+
declare function ApprovalCard({
|
|
220
|
+
approval,
|
|
221
|
+
onApprove,
|
|
222
|
+
onReject
|
|
223
|
+
}: {
|
|
224
|
+
approval: PendingApproval;
|
|
225
|
+
onApprove: (toolCallId: string) => void;
|
|
226
|
+
onReject: (toolCallId: string) => void;
|
|
227
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/ai/use-reactor-chat.d.ts
|
|
230
|
+
interface UseReactorChatResult {
|
|
231
|
+
messages: ChatMessage[];
|
|
232
|
+
isStreaming: boolean;
|
|
233
|
+
pendingApprovals: PendingApproval[];
|
|
234
|
+
error: string | null;
|
|
235
|
+
settings: AiSettings;
|
|
236
|
+
configured: boolean;
|
|
237
|
+
send: (text: string) => void;
|
|
238
|
+
stop: () => void;
|
|
239
|
+
approve: (toolCallId: string) => void;
|
|
240
|
+
reject: (toolCallId: string) => void;
|
|
241
|
+
clear: () => void;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Drives one in-browser chat conversation against the reactor tools.
|
|
245
|
+
*
|
|
246
|
+
* `toolsProvider` lazily resolves the tool descriptors (e.g. from
|
|
247
|
+
* `createReactorMcpProvider` bound to `window.ph.reactorClient`) when the
|
|
248
|
+
* user sends a message, so the reactor does not need to be ready at render
|
|
249
|
+
* time.
|
|
250
|
+
*/
|
|
251
|
+
declare function useReactorChat(toolsProvider?: AiToolsProvider): UseReactorChatResult;
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region src/ai/components/chat-window.d.ts
|
|
254
|
+
/** The chat window panel, anchored above the FAB in the bottom-right. */
|
|
255
|
+
declare function ChatWindow({
|
|
256
|
+
chat,
|
|
257
|
+
onClose
|
|
258
|
+
}: {
|
|
259
|
+
chat: UseReactorChatResult;
|
|
260
|
+
onClose: () => void;
|
|
261
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/ai/components/reactor-chat-fab.d.ts
|
|
264
|
+
/**
|
|
265
|
+
* Bottom-right floating action button that opens the reactor AI chat window.
|
|
266
|
+
*
|
|
267
|
+
* `getTools` lazily resolves the reactor tool descriptors (from
|
|
268
|
+
* `createReactorMcpProvider` bound to the browser reactor client) when the
|
|
269
|
+
* user sends a message.
|
|
270
|
+
*/
|
|
271
|
+
declare function ReactorChatFab({
|
|
272
|
+
getTools
|
|
273
|
+
}: {
|
|
274
|
+
getTools?: AiToolsProvider;
|
|
275
|
+
}): react_jsx_runtime0.JSX.Element | null;
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region src/ai/context.d.ts
|
|
278
|
+
/**
|
|
279
|
+
* Snapshot of the current selection in the drive explorer, used to make the
|
|
280
|
+
* chat context-aware: "create a budget here" targets the selected drive,
|
|
281
|
+
* "summarize this document" targets the selected document.
|
|
282
|
+
*/
|
|
283
|
+
declare function useChatContext(): ChatContext;
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/ai/settings-store.d.ts
|
|
286
|
+
declare const DEFAULT_AI_SETTINGS: AiSettings;
|
|
287
|
+
type Listener = () => void;
|
|
288
|
+
/** Returns the current settings (stable snapshot for useSyncExternalStore). */
|
|
289
|
+
declare function getAiSettings(): AiSettings;
|
|
290
|
+
/** Merges a partial update, persists, and notifies subscribers. */
|
|
291
|
+
declare function updateAiSettings(patch: Partial<AiSettings>): AiSettings;
|
|
292
|
+
/** Clears all stored settings. */
|
|
293
|
+
declare function clearAiSettings(): void;
|
|
294
|
+
/** Subscribes to settings changes. Returns the unsubscribe function. */
|
|
295
|
+
declare function subscribeAiSettings(listener: Listener): () => void;
|
|
296
|
+
/** True when the endpoint, key and model are all configured. */
|
|
297
|
+
declare function isAiConfigured(settings: AiSettings): boolean;
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/ai/switchboard.d.ts
|
|
300
|
+
/**
|
|
301
|
+
* The switchboard serving a remote drive: the base URL the browser talks to
|
|
302
|
+
* and its GraphQL supergraph endpoint.
|
|
303
|
+
*/
|
|
304
|
+
interface DriveSwitchboard {
|
|
305
|
+
/** Switchboard base URL (e.g. `http://localhost:4001`). */
|
|
306
|
+
switchboardUrl: string;
|
|
307
|
+
/** GraphQL supergraph endpoint (`<base>/graphql`). */
|
|
308
|
+
graphqlUrl: string;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Reads the tab-side sync manager from the browser global. Returns
|
|
312
|
+
* `undefined` in non-browser environments or before the reactor client
|
|
313
|
+
* module is initialized.
|
|
314
|
+
*/
|
|
315
|
+
declare function getBrowserSyncManager(): ISyncManager | undefined;
|
|
316
|
+
/**
|
|
317
|
+
* Resolves the switchboard that serves a drive, if any.
|
|
318
|
+
*
|
|
319
|
+
* Every remote drive stores its switchboard's exact GraphQL channel
|
|
320
|
+
* endpoint in its sync remote — `channelConfig = { type: "gql",
|
|
321
|
+
* parameters: { url: "<origin>/graphql/r" } }` — and the switchboard base
|
|
322
|
+
* is that URL minus the `/graphql/r` suffix. Deriving it per drive (rather
|
|
323
|
+
* than from a global setting) is what keeps multi-switchboard deployments
|
|
324
|
+
* correct. Drives that are not synced to a remote switchboard (local
|
|
325
|
+
* drives, other channel types, unexpected shapes) return `undefined`.
|
|
326
|
+
*/
|
|
327
|
+
declare function resolveDriveSwitchboard(driveId: string | undefined, syncManager?: ISyncManager): DriveSwitchboard | undefined;
|
|
328
|
+
/**
|
|
329
|
+
* Introspection over the switchboard supergraph's root query and mutation
|
|
330
|
+
* fields. Types are requested with three levels of `ofType` nesting so
|
|
331
|
+
* that common shapes like `[X!]!` (LIST(NON_NULL(LIST(X)))) render fully.
|
|
332
|
+
*/
|
|
333
|
+
declare const SWITCHBOARD_INTROSPECTION_QUERY: string;
|
|
334
|
+
/** One root query or mutation field, reduced to a prompt-friendly line. */
|
|
335
|
+
type SchemaFieldSummary = {
|
|
336
|
+
name: string;
|
|
337
|
+
description?: string;
|
|
338
|
+
args: string;
|
|
339
|
+
returns: string;
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* Reduces a GraphQL `__schema` introspection payload (the `data.__schema`
|
|
343
|
+
* object) to a compact summary of its root query and mutation fields.
|
|
344
|
+
* Accepts `unknown` because the payload arrives over the wire.
|
|
345
|
+
*/
|
|
346
|
+
declare function summarizeIntrospectionSchema(schema: unknown): {
|
|
347
|
+
queries: SchemaFieldSummary[];
|
|
348
|
+
mutations: SchemaFieldSummary[];
|
|
349
|
+
truncated: boolean;
|
|
350
|
+
};
|
|
351
|
+
declare const SWITCHBOARD_SCHEMA_TOOL_NAME = "getSwitchboardSchema";
|
|
352
|
+
/** Test seams for {@link createSwitchboardSchemaTool}. */
|
|
353
|
+
interface SwitchboardToolDeps {
|
|
354
|
+
getSyncManager?: () => ISyncManager | undefined;
|
|
355
|
+
getSelectedDriveId?: () => string | undefined;
|
|
356
|
+
tokenProvider?: () => Promise<string | undefined>;
|
|
357
|
+
fetchImpl?: typeof fetch;
|
|
358
|
+
timeoutMs?: number;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Creates the read-only `getSwitchboardSchema` tool: it introspects the
|
|
362
|
+
* GraphQL supergraph of the switchboard serving a drive and returns a
|
|
363
|
+
* summary of its root queries and mutations. It reads the schema only and
|
|
364
|
+
* never modifies data.
|
|
365
|
+
*/
|
|
366
|
+
declare function createSwitchboardSchemaTool(deps?: SwitchboardToolDeps): AiToolDescriptor;
|
|
367
|
+
//#endregion
|
|
368
|
+
export { AgentEvent, AiSettings, AiToolAnnotations, AiToolDescriptor, AiToolsProvider, ApprovalCard, ChatContext, ChatMessage, ChatPart, ChatWindow, DEFAULT_AI_SETTINGS, DriveSwitchboard, FULL_RESULT_TURNS, MAX_AGENT_STEPS, MAX_TOOL_RESULT_CHARS, PendingApproval, ReactorChatAgent, ReactorChatAgentOptions, ReactorChatFab, STUB_MIN_CHARS, SWITCHBOARD_INTROSPECTION_QUERY, SWITCHBOARD_SCHEMA_TOOL_NAME, SchemaFieldSummary, SwitchboardToolDeps, ToolCallState, UseReactorChatResult, WRITE_TOOLS, buildSystemPrompt, clearAiSettings, createReactorChatModel, createSwitchboardSchemaTool, getAiSettings, getBrowserSyncManager, isAiConfigured, isWriteTool, resolveDriveSwitchboard, stubStaleToolResults, subscribeAiSettings, summarizeIntrospectionSchema, unwrapToolResult, updateAiSettings, useChatContext, useReactorChat };
|
|
369
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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":";;;;;;;;;;;AAeA;;;;UAAiB,UAAA;EAIf;EAFA,OAAA;EAMA;EAJA,OAAA;EASiB;EAPjB,MAAA;EAWU;EATV,KAAA;;;;AAoBF;EAfE,iBAAA;AAAA;;KAIU,iBAAA,GAAoB,mBAAA;AAchC;;;;;AAGA;;;;AAHA,KAHY,gBAAA,GAAmB,kBAAA;AAoB/B;AAAA,KAjBY,eAAA,SAAwB,OAAA,CAAQ,gBAAA;;cAG/B,WAAA,EAAa,WA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