@powerhousedao/reactor-browser 6.2.3-dev.4 → 6.2.3-dev.41

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.
Files changed (86) hide show
  1. package/dist/{attachment-service-D3EhiAJ7.d.ts → attachment-service-B2UAo7sA.d.ts} +169 -59
  2. package/dist/attachment-service-B2UAo7sA.d.ts.map +1 -0
  3. package/dist/{client-BIHN_UyR.d.ts → client-BYd9eNbA.d.ts} +3 -3
  4. package/dist/client-BYd9eNbA.d.ts.map +1 -0
  5. package/dist/{client-D66jVnot.js → client-CSOLwWU9.js} +141 -20
  6. package/dist/client-CSOLwWU9.js.map +1 -0
  7. package/dist/{client-DjK30EQ-.js → client-Cq5avLW5.js} +35 -22
  8. package/dist/client-Cq5avLW5.js.map +1 -0
  9. package/dist/{document-by-id-B4FIzG1w.js → dispatch-t-XkZYGh.js} +393 -54
  10. package/dist/dispatch-t-XkZYGh.js.map +1 -0
  11. package/dist/document-by-id-CQZMsJ9I.js +16 -0
  12. package/dist/document-by-id-CQZMsJ9I.js.map +1 -0
  13. package/dist/{document-model-modules-bTP87nyr.js → document-model-modules-Bfi0VEWy.js} +32 -65
  14. package/dist/document-model-modules-Bfi0VEWy.js.map +1 -0
  15. package/dist/{document-operations-WeE6wIDt.js → document-operations-DJxHHfWq.js} +147 -120
  16. package/dist/document-operations-DJxHHfWq.js.map +1 -0
  17. package/dist/{global-OuINvEGT.d.ts → global-B0ewjXaM.d.ts} +50 -13
  18. package/dist/global-B0ewjXaM.d.ts.map +1 -0
  19. package/dist/{index-B33TKEqp.d.ts → index-Be363bAF.d.ts} +19 -98
  20. package/dist/index-Be363bAF.d.ts.map +1 -0
  21. package/dist/{index-BIVDXw3K.d.ts → index-rtDmzViP.d.ts} +3 -3
  22. package/dist/index-rtDmzViP.d.ts.map +1 -0
  23. package/dist/index.d.ts +383 -370
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +114 -39
  26. package/dist/index.js.map +1 -1
  27. package/dist/{inspector-proxy-6h5VKAwt.d.ts → inspector-proxy-DCowaeeH.d.ts} +11 -4
  28. package/dist/inspector-proxy-DCowaeeH.d.ts.map +1 -0
  29. package/dist/{make-ph-event-functions-DBq3iWYn.js → make-ph-event-functions-FzpvQtj6.js} +1 -1
  30. package/dist/{make-ph-event-functions-DBq3iWYn.js.map → make-ph-event-functions-FzpvQtj6.js.map} +1 -1
  31. package/dist/{pglite-CntadC_p-9NDG14dS.d.ts → pglite-CntadC_p-DTkdF8sr.d.ts} +11 -33
  32. package/dist/pglite-CntadC_p-DTkdF8sr.d.ts.map +1 -0
  33. package/dist/{relational-D1RB45sA.js → relational-ChC_AWAK.js} +3 -2
  34. package/dist/{relational-D1RB45sA.js.map → relational-ChC_AWAK.js.map} +1 -1
  35. package/dist/{renown-rqK8sokh.js → renown-C9pYZRqf.js} +7 -8
  36. package/dist/{renown-rqK8sokh.js.map → renown-C9pYZRqf.js.map} +1 -1
  37. package/dist/{renown-BHxwP7xU.js → renown-Def5iO8k.js} +2 -2
  38. package/dist/{renown-BHxwP7xU.js.map → renown-Def5iO8k.js.map} +1 -1
  39. package/dist/src/ai/index.d.ts +51 -62
  40. package/dist/src/ai/index.d.ts.map +1 -1
  41. package/dist/src/ai/index.js +5 -8
  42. package/dist/src/ai/index.js.map +1 -1
  43. package/dist/src/analytics/index.d.ts +36 -44
  44. package/dist/src/analytics/index.d.ts.map +1 -1
  45. package/dist/src/analytics/index.js +2 -2
  46. package/dist/src/analytics/index.js.map +1 -1
  47. package/dist/src/document-model.d.ts +3 -4
  48. package/dist/src/document-model.d.ts.map +1 -1
  49. package/dist/src/document-model.js.map +1 -1
  50. package/dist/src/graphql/client.d.ts +4 -3
  51. package/dist/src/graphql/client.js +1 -1
  52. package/dist/src/graphql-client/entry.d.ts +5 -4
  53. package/dist/src/graphql-client/entry.js +4 -4
  54. package/dist/src/relational/index.d.ts +8 -9
  55. package/dist/src/relational/index.d.ts.map +1 -1
  56. package/dist/src/relational/index.js +1 -1
  57. package/dist/src/renown/index.d.ts +3 -2
  58. package/dist/src/renown/index.js +2 -2
  59. package/dist/src/rpc/index.d.ts +52 -32
  60. package/dist/src/rpc/index.d.ts.map +1 -1
  61. package/dist/src/rpc/index.js +58 -9
  62. package/dist/src/rpc/index.js.map +1 -1
  63. package/dist/{store-BJYcr_FL.js → store-DInXcjal.js} +1 -1
  64. package/dist/{store-BJYcr_FL.js.map → store-DInXcjal.js.map} +1 -1
  65. package/dist/{switchboard-CaXQ4-5Q.js → switchboard-kKDuDWxY.js} +58 -6
  66. package/dist/switchboard-kKDuDWxY.js.map +1 -0
  67. package/dist/{types-6vDzbRRS.d.ts → types-520nWrB3.d.ts} +2 -2
  68. package/dist/types-520nWrB3.d.ts.map +1 -0
  69. package/dist/{types-Dcv1ZLoW.d.ts → types-Cww0HJmz.d.ts} +102 -17
  70. package/dist/types-Cww0HJmz.d.ts.map +1 -0
  71. package/package.json +15 -16
  72. package/dist/attachment-service-D3EhiAJ7.d.ts.map +0 -1
  73. package/dist/client-BIHN_UyR.d.ts.map +0 -1
  74. package/dist/client-D66jVnot.js.map +0 -1
  75. package/dist/client-DjK30EQ-.js.map +0 -1
  76. package/dist/document-by-id-B4FIzG1w.js.map +0 -1
  77. package/dist/document-model-modules-bTP87nyr.js.map +0 -1
  78. package/dist/document-operations-WeE6wIDt.js.map +0 -1
  79. package/dist/global-OuINvEGT.d.ts.map +0 -1
  80. package/dist/index-B33TKEqp.d.ts.map +0 -1
  81. package/dist/index-BIVDXw3K.d.ts.map +0 -1
  82. package/dist/inspector-proxy-6h5VKAwt.d.ts.map +0 -1
  83. package/dist/pglite-CntadC_p-9NDG14dS.d.ts.map +0 -1
  84. package/dist/switchboard-CaXQ4-5Q.js.map +0 -1
  85. package/dist/types-6vDzbRRS.d.ts.map +0 -1
  86. package/dist/types-Dcv1ZLoW.d.ts.map +0 -1
@@ -1,8 +1,6 @@
1
- import { PhAiToolAnnotations, PhAiToolDescriptor } from "@powerhousedao/shared/document-model";
2
1
  import { ISyncManager } from "@powerhousedao/reactor";
3
- import * as react_jsx_runtime0 from "react/jsx-runtime";
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
- }): react_jsx_runtime0.JSX.Element;
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
- }): react_jsx_runtime0.JSX.Element;
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
- }): react_jsx_runtime0.JSX.Element | null;
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 { AgentEvent, AiSettings, AiToolAnnotations, AiToolDescriptor, AiToolsProvider, ApprovalCard, ChatContext, ChatMessage, ChatPart, ChatWindow, DEFAULT_AI_SETTINGS, DriveSwitchboard, FULL_RESULT_TURNS, GQL_CHANNEL_SUFFIX, 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 };
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":";;;;;;;;;;;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,WAAA;;;;;;iBAcV,WAAA,CACd,IAAA,UACA,WAAA,GAAc,iBAAA;AAAA,KAKJ,aAAA;;KAQA,QAAA;EACN,IAAA;EAAc,IAAA;AAAA;EAEd,IAAA;EACA,UAAA;EACA,IAAA;EACA,IAAA;EACA,KAAA,EAAO,aAAA;EACP,MAAA;EACA,KAAA;AAAA;AAAA,UAGW,WAAA;EACf,EAAA;EACA,IAAA;EACA,KAAA,EAAO,QAAA;AAAA;;UAIQ,eAAA;EACf,UAAA;EACA,IAAA;EACA,IAAA;AAAA;;UAIe,WAAA;EACf,OAAA;EACA,SAAA;EACA,MAAA;EACA,QAAA;EACA,QAAA;EACA,YAAA;EACA,YAAA;EACA,UAAA;EACA,cAAA;EACA,qBAAA;AAAA;;KAIU,UAAA;EACN,IAAA;EAAoB,KAAA;AAAA;EAEpB,IAAA;EACA,UAAA;EACA,IAAA;EACA,IAAA;AAAA;EAGA,IAAA;EACA,UAA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A;;AR5IF;;;;iBQyKgB,4BAAA,CAA6B,MAAA;EAC3C,OAAA,EAAS,kBAAA;EACT,SAAA,EAAW,kBAAA;EACX,SAAA;AAAA;AAAA,cAYW,4BAAA;;UAGI,mBAAA;EACf,cAAA,SAAuB,YAAA;EACvB,kBAAA;EACA,aAAA,SAAsB,OAAA;EACtB,SAAA,UAAmB,KAAA;EACnB,SAAA;AAAA;;;;AR5KF;;;iBQqLgB,2BAAA,CACd,IAAA,GAAO,mBAAA,GACN,gBAAA"}
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"}
@@ -1,5 +1,5 @@
1
- import { S as useSelectedDriveSafe, s as useSelectedNode } from "../../document-model-modules-bTP87nyr.js";
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-CaXQ4-5Q.js";
1
+ import { p as useSelectedDriveSafe } from "../../document-model-modules-Bfi0VEWy.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-kKDuDWxY.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) => {