@powerhousedao/reactor-mcp 6.2.3-dev.10 → 6.2.3-dev.101

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.
@@ -1,2 +1,778 @@
1
- import { _ as getDriveTool, a as ReactorMcpTools, c as addRemoteDriveTool, d as deleteDocumentTool, f as deleteDriveTool, g as getDocumentsTool, h as getDocumentTool, i as ReactorMcpProviderOptions, l as createDocumentTool, m as getDocumentModelsTool, n as toolWithCallback, o as addActionsTool, p as getDocumentModelSchemaTool, r as validateDocumentModelAction, s as addDriveTool, t as InvalidToolOutputError, u as createReactorMcpProvider, v as getDrivesTool } from "../index-DXl2_PJH.mjs";
2
- export { InvalidToolOutputError, ReactorMcpProviderOptions, ReactorMcpTools, addActionsTool, addDriveTool, addRemoteDriveTool, createDocumentTool, createReactorMcpProvider, deleteDocumentTool, deleteDriveTool, getDocumentModelSchemaTool, getDocumentModelsTool, getDocumentTool, getDocumentsTool, getDriveTool, getDrivesTool, toolWithCallback, validateDocumentModelAction };
1
+ import { CodegenStatusRegistry } from "@powerhousedao/shared/processors";
2
+ import { ConsistencyToken, IDriveWriteClient, IReactorClient, IReactorWriteClient } from "@powerhousedao/reactor";
3
+ import { z } from "zod";
4
+ import { Action, DocumentModelGlobalState, DocumentModelModule, DocumentSpecification, PHDocument } from "@powerhousedao/shared/document-model";
5
+ import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
6
+ //#region src/tools/client.d.ts
7
+ export type ReactorToolReadMethods = "get" | "resolveIdOrSlug" | "find" | "getOperations" | "getOutgoingRelationships" | "getIncomingRelationships" | "getOutgoingRelationshipEdges" | "getIncomingRelationshipEdges" | "getDocumentModelModules" | "getDocumentModelModule" | "getDocumentModelModuleForDocument";
8
+ export type ReactorToolWriteMethods = "create" | "createEmpty" | "execute" | "deleteDocument";
9
+ /** The write half's subset; each write returns a handle to await. */
10
+ export type ReactorToolWriteClient = Pick<IReactorWriteClient, ReactorToolWriteMethods> & {
11
+ readonly drives: Pick<IDriveWriteClient, "addFile">;
12
+ };
13
+ export type ReactorToolClient = Pick<IReactorClient, ReactorToolReadMethods | "newDocument"> & {
14
+ readonly write: ReactorToolWriteClient;
15
+ };
16
+ export type ReactorToolReadClient = Pick<IReactorClient, ReactorToolReadMethods>;
17
+ //#endregion
18
+ //#region src/tools/errors.d.ts
19
+ export declare const REACTOR_TOOL_ERROR_CODES: readonly ["NOT_FOUND", "FORBIDDEN", "INVALID_ACTION", "REDUCER_ERROR", "CONFLICT"];
20
+ export type ReactorToolErrorCode = (typeof REACTOR_TOOL_ERROR_CODES)[number];
21
+ /** One rejected action: its position in the batch and why. */
22
+ export type ActionFailure = {
23
+ index: number;
24
+ type: string;
25
+ code: Extract<ReactorToolErrorCode, "INVALID_ACTION" | "FORBIDDEN" | "REDUCER_ERROR">;
26
+ errors: string[];
27
+ };
28
+ export declare class ReactorToolError extends Error {
29
+ readonly code: ReactorToolErrorCode;
30
+ readonly failures?: ActionFailure[];
31
+ constructor(code: ReactorToolErrorCode, message: string, options?: {
32
+ failures?: ActionFailure[];
33
+ cause?: unknown;
34
+ });
35
+ toJSON(): {
36
+ code: ReactorToolErrorCode;
37
+ message: string;
38
+ failures?: ActionFailure[];
39
+ };
40
+ }
41
+ export declare function isReactorToolError(error: unknown): error is ReactorToolError;
42
+ /** Normalizes any thrown value to a {@link ReactorToolError}. */
43
+ export declare function toReactorToolError(error: unknown, fallback?: ReactorToolErrorCode): ReactorToolError;
44
+ export declare function notFound(message: string): ReactorToolError;
45
+ //#endregion
46
+ //#region src/tools/definition.d.ts
47
+ /** MCP tool annotations; structural, so no MCP SDK import is needed. */
48
+ export type ReactorToolAnnotations = {
49
+ title?: string;
50
+ readOnlyHint?: boolean;
51
+ destructiveHint?: boolean;
52
+ idempotentHint?: boolean;
53
+ openWorldHint?: boolean;
54
+ };
55
+ export type ToolContext<C = ReactorToolClient> = {
56
+ client: C;
57
+ signal?: AbortSignal;
58
+ };
59
+ export type ToolDefinition<I extends z.ZodObject = z.ZodObject, O extends z.ZodObject = z.ZodObject, C = ReactorToolClient, N extends string = string> = {
60
+ name: N;
61
+ title: string;
62
+ description: string;
63
+ inputSchema: I;
64
+ outputSchema: O;
65
+ annotations: ReactorToolAnnotations;
66
+ execute: (args: z.infer<I>, ctx: ToolContext<C>) => Promise<z.infer<O>>;
67
+ };
68
+ export type AnyToolDefinition<C = ReactorToolClient> = {
69
+ name: string;
70
+ title: string;
71
+ description: string;
72
+ inputSchema: z.ZodObject;
73
+ outputSchema: z.ZodObject;
74
+ annotations: ReactorToolAnnotations;
75
+ execute: (args: never, ctx: ToolContext<C>) => Promise<unknown>;
76
+ };
77
+ export declare function defineTool<I extends z.ZodObject, O extends z.ZodObject, N extends string, C = ReactorToolClient>(definition: ToolDefinition<I, O, C, N>): ToolDefinition<I, O, C, N>;
78
+ /** Whether running the tool can change state; unannotated tools count as writes. */
79
+ export declare function isWriteTool(annotations?: ReactorToolAnnotations): boolean;
80
+ /** Text of an error as the MCP and `ai` adapters report it. */
81
+ export declare function formatToolError(error: ReactorToolError): string;
82
+ export type McpToolRecord<D extends AnyToolDefinition<never>> = {
83
+ name: D["name"];
84
+ title: string;
85
+ description: string;
86
+ inputSchema: D["inputSchema"]["shape"];
87
+ outputSchema: D["outputSchema"]["shape"];
88
+ annotations: ReactorToolAnnotations;
89
+ callback: (args: z.infer<D["inputSchema"]>, extra?: {
90
+ signal?: AbortSignal;
91
+ }) => Promise<CallToolResult>;
92
+ };
93
+ /** Wraps a definition for `McpServer.registerTool`; errors become `isError` results. */
94
+ export declare function toMcpTool<D extends AnyToolDefinition<C>, C>(definition: D, ctx: ToolContext<C>): McpToolRecord<D>;
95
+ /** Structurally an `ai` SDK `Tool`; zod schemas are accepted as-is. */
96
+ export type AiSdkTool<D extends AnyToolDefinition<never>> = {
97
+ title: string;
98
+ description: string;
99
+ inputSchema: D["inputSchema"];
100
+ outputSchema: D["outputSchema"];
101
+ execute: (args: z.infer<D["inputSchema"]>, options?: {
102
+ abortSignal?: AbortSignal;
103
+ }) => Promise<z.infer<D["outputSchema"]>>;
104
+ };
105
+ export type AiSdkToolSet<D extends AnyToolDefinition<never>> = { [K in D["name"]]: AiSdkTool<Extract<D, {
106
+ name: K;
107
+ }>>; };
108
+ /** Builds an `ai` SDK ToolSet without importing `ai`; failures throw with the code in the message. */
109
+ export declare function toAiSdkTools<D extends AnyToolDefinition<C>, C>(definitions: readonly D[], ctx: ToolContext<C>): AiSdkToolSet<D>;
110
+ //#endregion
111
+ //#region src/tools/validation.d.ts
112
+ export declare const actionInputSchema: z.ZodObject<{
113
+ type: z.ZodString;
114
+ input: z.ZodOptional<z.ZodUnknown>;
115
+ scope: z.ZodOptional<z.ZodString>;
116
+ }, z.core.$strip>;
117
+ export type ActionInput = z.infer<typeof actionInputSchema>;
118
+ export type ValidateActionsOptions = {
119
+ /** Action types the caller may send; others fail as FORBIDDEN. */
120
+ allowedActionTypes?: readonly string[];
121
+ };
122
+ export type ValidatedActions = {
123
+ actions: Action[];
124
+ failures: ActionFailure[];
125
+ };
126
+ /** Builds the actions, collecting every failure instead of stopping at the first. */
127
+ export declare function validateActions(module: DocumentModelModule, inputs: readonly ActionInput[], options?: ValidateActionsOptions): ValidatedActions;
128
+ /** One line per failed action, did-you-mean for unknown types, and input schemas for shape errors. */
129
+ export declare function formatActionFailures(failures: readonly ActionFailure[], module?: DocumentModelModule): string;
130
+ /** The error for a batch with failures; the code is the batch's most severe one. */
131
+ export declare function actionFailuresError(failures: ActionFailure[], module?: DocumentModelModule): ReactorToolError;
132
+ //#endregion
133
+ //#region src/tools/operations.d.ts
134
+ export type Revision = Record<string, number>;
135
+ export type GetDocumentOptions = {
136
+ branch?: string;
137
+ /** A write receipt's token, to read after that write. */
138
+ token?: ConsistencyToken;
139
+ };
140
+ export declare function getDocument<T extends PHDocument = PHDocument>(client: ReactorToolReadClient, identifier: string, signal?: AbortSignal, options?: GetDocumentOptions): Promise<T>;
141
+ /** The model module for a type; an unknown type fails with did-you-mean. */
142
+ export declare function getDocumentModel(client: ReactorToolReadClient, documentType: string, signal?: AbortSignal): Promise<DocumentModelModule>;
143
+ /** Executes built actions and returns the new revision; any action not applied throws. */
144
+ export declare function executeBuiltActions(client: ReactorToolClient, document: PHDocument, actions: Action[], options?: {
145
+ branch?: string;
146
+ signal?: AbortSignal;
147
+ module?: DocumentModelModule;
148
+ }): Promise<Revision>;
149
+ export type ExecuteActionsOptions = ValidateActionsOptions & {
150
+ branch?: string;
151
+ signal?: AbortSignal;
152
+ };
153
+ /** The model module at the document's own version. */
154
+ export declare function getDocumentModelForDocument(client: ReactorToolReadClient, document: PHDocument, signal?: AbortSignal): Promise<DocumentModelModule>;
155
+ export type ActionError = {
156
+ /** reducer-error: the reducer threw; denied: a policy refused it; not-applied: nothing stored it. */
157
+ kind: "reducer-error" | "denied" | "not-applied";
158
+ message: string;
159
+ /** The model's error class, for a reducer error. */
160
+ name?: string;
161
+ /** The model's error code, for a reducer error. */
162
+ code?: string;
163
+ };
164
+ export type ActionResult = {
165
+ index: number;
166
+ type: string;
167
+ scope: string;
168
+ operationIndex?: number;
169
+ error?: ActionError;
170
+ };
171
+ export type ExecutedActions = {
172
+ documentId: string;
173
+ revision: Revision;
174
+ /** False when any result has an error. */
175
+ success: boolean;
176
+ results: ActionResult[];
177
+ };
178
+ /** Validates every action, then executes them as one batch and reports each action's outcome. */
179
+ export declare function executeActions(client: ReactorToolClient, documentId: string, inputs: readonly ActionInput[], options?: ExecuteActionsOptions): Promise<ExecutedActions>;
180
+ export type CreateDocumentInput = {
181
+ documentType: string;
182
+ name?: string;
183
+ /** Drive id or slug; the document becomes its child and a drive file. */
184
+ driveId?: string;
185
+ parentFolder?: string;
186
+ };
187
+ export type CreatedDocument = {
188
+ documentId: string;
189
+ documentType: string;
190
+ name: string;
191
+ driveId?: string;
192
+ revision: Revision;
193
+ };
194
+ /** Creates the document, filed into the drive when given; a half-done filing is rolled back. */
195
+ export declare function createDocument(client: ReactorToolClient, input: CreateDocumentInput, signal?: AbortSignal): Promise<CreatedDocument>;
196
+ /** Removes the document's node from each document drive filing it, then deletes it. */
197
+ export declare function deleteDocument(client: ReactorToolClient, documentId: string, signal?: AbortSignal): Promise<{
198
+ documentId: string;
199
+ }>;
200
+ //#endregion
201
+ //#region src/tools/codegen.d.ts
202
+ /** Marks a Vetra document's codegen queued once a global change is stored, and says how to follow it. */
203
+ export declare function codegenHint(codegen: CodegenStatusRegistry, client: ReactorToolReadClient, executed: {
204
+ documentId: string;
205
+ results: readonly ActionResult[];
206
+ }, signal?: AbortSignal): Promise<string | undefined>;
207
+ /** Vetra's code generation status, for hosts that run its codegen processor. */
208
+ export declare function codegenStatusTool(codegen: CodegenStatusRegistry): ToolDefinition<z.ZodObject<{
209
+ documentId: z.ZodOptional<z.ZodString>;
210
+ waitSeconds: z.ZodOptional<z.ZodNumber>;
211
+ }, z.core.$strip>, z.ZodObject<{
212
+ active: z.ZodBoolean;
213
+ settled: z.ZodBoolean;
214
+ documents: z.ZodArray<z.ZodObject<{
215
+ documentId: z.ZodString;
216
+ documentType: z.ZodString;
217
+ name: z.ZodOptional<z.ZodString>;
218
+ state: z.ZodEnum<{
219
+ done: "done";
220
+ failed: "failed";
221
+ queued: "queued";
222
+ running: "running";
223
+ skipped: "skipped";
224
+ "waiting-for-install": "waiting-for-install";
225
+ }>;
226
+ message: z.ZodOptional<z.ZodString>;
227
+ files: z.ZodOptional<z.ZodArray<z.ZodString>>;
228
+ updatedAt: z.ZodString;
229
+ }, z.core.$strip>>;
230
+ loadFailures: z.ZodArray<z.ZodObject<{
231
+ package: z.ZodString;
232
+ kind: z.ZodString;
233
+ message: z.ZodString;
234
+ updatedAt: z.ZodString;
235
+ }, z.core.$strip>>;
236
+ message: z.ZodOptional<z.ZodString>;
237
+ }, z.core.$strip>, ReactorToolClient, "getCodegenStatus">;
238
+ //#endregion
239
+ //#region src/tools/compact-schema.d.ts
240
+ export declare const compactDocumentModelSchemaSchema: z.ZodObject<{
241
+ id: z.ZodString;
242
+ name: z.ZodString;
243
+ version: z.ZodNumber;
244
+ actions: z.ZodArray<z.ZodObject<{
245
+ type: z.ZodString;
246
+ scope: z.ZodString;
247
+ input: z.ZodNullable<z.ZodString>;
248
+ }, z.core.$strip>>;
249
+ types: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
250
+ }, z.core.$strip>;
251
+ export type CompactDocumentModelSchema = z.infer<typeof compactDocumentModelSchemaSchema>;
252
+ /** The parts of a document model's latest specification that writing actions needs. */
253
+ export declare function compactDocumentModelSchema(model: DocumentModelGlobalState): CompactDocumentModelSchema;
254
+ //#endregion
255
+ //#region src/tools/documents.d.ts
256
+ export declare const DRIVE_DOCUMENT_TYPE = "powerhouse/document-drive";
257
+ /** Document types that hold files, as the reactor's drive containers. */
258
+ export declare const DRIVE_DOCUMENT_TYPES: ReadonlySet<string>;
259
+ export declare const DEFAULT_BRANCH = "main";
260
+ export type TrimLimits = {
261
+ maxArrayItems: number;
262
+ maxStringLength: number;
263
+ maxDepth: number;
264
+ };
265
+ export declare const DEFAULT_TRIM_LIMITS: TrimLimits;
266
+ /** Caps arrays, strings and depth, leaving a marker where it cut. */
267
+ export declare function trimValue(value: unknown, limits?: Partial<TrimLimits>): {
268
+ value: unknown;
269
+ truncated: boolean;
270
+ };
271
+ export declare const documentSummarySchema: z.ZodObject<{
272
+ id: z.ZodString;
273
+ documentType: z.ZodString;
274
+ name: z.ZodString;
275
+ }, z.core.$strip>;
276
+ export type DocumentSummary = z.infer<typeof documentSummarySchema>;
277
+ export declare function documentName(document: PHDocument): string;
278
+ export declare function documentSummary(document: PHDocument): DocumentSummary;
279
+ export declare const documentViewSchema: z.ZodObject<{
280
+ id: z.ZodString;
281
+ documentType: z.ZodString;
282
+ name: z.ZodString;
283
+ slug: z.ZodOptional<z.ZodString>;
284
+ branch: z.ZodString;
285
+ revision: z.ZodRecord<z.ZodString, z.ZodNumber>;
286
+ lastModifiedAtUtcIso: z.ZodOptional<z.ZodString>;
287
+ state: z.ZodUnknown;
288
+ truncated: z.ZodOptional<z.ZodBoolean>;
289
+ }, z.core.$strip>;
290
+ export type DocumentView = z.infer<typeof documentViewSchema>;
291
+ export type DocumentViewOptions = {
292
+ /** JSONPath against the whole state, e.g. `$.global.items[0]`. */
293
+ filter?: string;
294
+ /** Scopes shown without a filter; empty scopes are left out. */
295
+ scopes?: readonly string[];
296
+ limits?: Partial<TrimLimits>;
297
+ };
298
+ /** A filter's match is returned whole up to this many JSON characters. */
299
+ export declare const MAX_FILTERED_CHARS = 100000;
300
+ /** A compact document: header essentials plus model state, projected and trimmed. */
301
+ export declare function documentView(document: PHDocument, options?: DocumentViewOptions): DocumentView;
302
+ //#endregion
303
+ //#region src/tools/jsonpath.d.ts
304
+ type Segment = {
305
+ kind: "child";
306
+ keys: (string | number)[];
307
+ } | {
308
+ kind: "wildcard";
309
+ } | {
310
+ kind: "descend";
311
+ key: string;
312
+ } | {
313
+ kind: "recurse";
314
+ } | {
315
+ kind: "filter";
316
+ path: string[];
317
+ op?: Comparison;
318
+ value?: unknown;
319
+ };
320
+ type Comparison = "==" | "!=" | "<" | "<=" | ">" | ">=";
321
+ export declare class JsonPathError extends Error {
322
+ constructor(path: string, reason: string);
323
+ }
324
+ export declare function parseJsonPath(path: string): Segment[];
325
+ /** Every node `path` selects in `value`, in document order. */
326
+ export declare function queryJsonPath(value: unknown, path: string): unknown[];
327
+ export declare function applyJsonPath<T = unknown>(value: unknown, path: string): T;
328
+ //#endregion
329
+ //#region src/tools/reactor.d.ts
330
+ declare const targetParam: (what: string) => z.ZodOptional<z.ZodString>;
331
+ declare const aliasParam: z.ZodOptional<z.ZodString>;
332
+ /** The target named by `documentId` or one of its aliases; they must agree. */
333
+ export declare function targetId(tool: string, args: Record<string, unknown>, aliases: readonly string[]): string;
334
+ export declare const getDocumentModelsTool: ToolDefinition<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
335
+ documentModels: z.ZodArray<z.ZodObject<{
336
+ type: z.ZodString;
337
+ name: z.ZodString;
338
+ description: z.ZodString;
339
+ extension: z.ZodString;
340
+ authorName: z.ZodString;
341
+ authorWebsite: z.ZodString;
342
+ }, z.core.$strip>>;
343
+ }, z.core.$strip>, ReactorToolClient, "getDocumentModels">;
344
+ export declare const getDocumentModelSchemaTool: ToolDefinition<z.ZodObject<{
345
+ type: z.ZodString;
346
+ compact: z.ZodOptional<z.ZodBoolean>;
347
+ definition: z.ZodOptional<z.ZodBoolean>;
348
+ operation: z.ZodOptional<z.ZodString>;
349
+ state: z.ZodOptional<z.ZodEnum<{
350
+ global: "global";
351
+ local: "local";
352
+ }>>;
353
+ filter: z.ZodOptional<z.ZodString>;
354
+ }, z.core.$strip>, z.ZodObject<{
355
+ type: z.ZodString;
356
+ model: z.ZodOptional<z.ZodObject<{
357
+ type: z.ZodString;
358
+ name: z.ZodString;
359
+ description: z.ZodString;
360
+ version: z.ZodNumber;
361
+ modules: z.ZodArray<z.ZodObject<{
362
+ name: z.ZodString;
363
+ operations: z.ZodArray<z.ZodString>;
364
+ }, z.core.$strip>>;
365
+ }, z.core.$strip>>;
366
+ definition: z.ZodOptional<z.ZodUnknown>;
367
+ compact: z.ZodOptional<z.ZodObject<{
368
+ id: z.ZodString;
369
+ name: z.ZodString;
370
+ version: z.ZodNumber;
371
+ actions: z.ZodArray<z.ZodObject<{
372
+ type: z.ZodString;
373
+ scope: z.ZodString;
374
+ input: z.ZodNullable<z.ZodString>;
375
+ }, z.core.$strip>>;
376
+ types: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
377
+ }, z.core.$strip>>;
378
+ operation: z.ZodOptional<z.ZodObject<{
379
+ name: z.ZodString;
380
+ module: z.ZodString;
381
+ scope: z.ZodString;
382
+ description: z.ZodOptional<z.ZodString>;
383
+ schema: z.ZodOptional<z.ZodString>;
384
+ errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
385
+ name: z.ZodString;
386
+ description: z.ZodOptional<z.ZodString>;
387
+ }, z.core.$strip>>>;
388
+ }, z.core.$strip>>;
389
+ state: z.ZodOptional<z.ZodObject<{
390
+ scope: z.ZodString;
391
+ schema: z.ZodString;
392
+ initialValue: z.ZodOptional<z.ZodString>;
393
+ }, z.core.$strip>>;
394
+ value: z.ZodOptional<z.ZodUnknown>;
395
+ }, z.core.$strip>, ReactorToolClient, "getDocumentModelSchema">;
396
+ export declare const getDocumentTool: ToolDefinition<z.ZodObject<{
397
+ documentId: z.ZodOptional<z.ZodString>;
398
+ id: z.ZodOptional<z.ZodString>;
399
+ filter: z.ZodOptional<z.ZodString>;
400
+ }, z.core.$strip>, z.ZodObject<{
401
+ document: z.ZodObject<{
402
+ id: z.ZodString;
403
+ documentType: z.ZodString;
404
+ name: z.ZodString;
405
+ slug: z.ZodOptional<z.ZodString>;
406
+ branch: z.ZodString;
407
+ revision: z.ZodRecord<z.ZodString, z.ZodNumber>;
408
+ lastModifiedAtUtcIso: z.ZodOptional<z.ZodString>;
409
+ state: z.ZodUnknown;
410
+ truncated: z.ZodOptional<z.ZodBoolean>;
411
+ }, z.core.$strip>;
412
+ }, z.core.$strip>, ReactorToolClient, "getDocument">;
413
+ export declare const getDocumentsTool: ToolDefinition<z.ZodObject<{
414
+ documentId: z.ZodOptional<z.ZodString>;
415
+ driveId: z.ZodOptional<z.ZodString>;
416
+ parentId: z.ZodOptional<z.ZodString>;
417
+ }, z.core.$strip>, z.ZodObject<{
418
+ documents: z.ZodArray<z.ZodObject<{
419
+ id: z.ZodString;
420
+ documentType: z.ZodString;
421
+ name: z.ZodString;
422
+ }, z.core.$strip>>;
423
+ }, z.core.$strip>, ReactorToolClient, "getDocuments">;
424
+ export declare const getDrivesTool: ToolDefinition<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
425
+ drives: z.ZodArray<z.ZodObject<{
426
+ id: z.ZodString;
427
+ documentType: z.ZodString;
428
+ name: z.ZodString;
429
+ }, z.core.$strip>>;
430
+ }, z.core.$strip>, ReactorToolClient, "getDrives">;
431
+ export declare const getDriveTool: ToolDefinition<z.ZodObject<{
432
+ documentId: z.ZodOptional<z.ZodString>;
433
+ driveId: z.ZodOptional<z.ZodString>;
434
+ id: z.ZodOptional<z.ZodString>;
435
+ filter: z.ZodOptional<z.ZodString>;
436
+ }, z.core.$strip>, z.ZodObject<{
437
+ drive: z.ZodObject<{
438
+ id: z.ZodString;
439
+ documentType: z.ZodString;
440
+ name: z.ZodString;
441
+ slug: z.ZodOptional<z.ZodString>;
442
+ branch: z.ZodString;
443
+ revision: z.ZodRecord<z.ZodString, z.ZodNumber>;
444
+ lastModifiedAtUtcIso: z.ZodOptional<z.ZodString>;
445
+ state: z.ZodUnknown;
446
+ truncated: z.ZodOptional<z.ZodBoolean>;
447
+ }, z.core.$strip>;
448
+ }, z.core.$strip>, ReactorToolClient, "getDrive">;
449
+ export declare const createDocumentTool: ToolDefinition<z.ZodObject<{
450
+ documentType: z.ZodString;
451
+ name: z.ZodOptional<z.ZodString>;
452
+ driveId: z.ZodOptional<z.ZodString>;
453
+ parentFolder: z.ZodOptional<z.ZodString>;
454
+ }, z.core.$strip>, z.ZodObject<{
455
+ documentId: z.ZodString;
456
+ documentType: z.ZodString;
457
+ name: z.ZodString;
458
+ driveId: z.ZodOptional<z.ZodString>;
459
+ revision: z.ZodRecord<z.ZodString, z.ZodNumber>;
460
+ }, z.core.$strip>, ReactorToolClient, "createDocument">;
461
+ export declare const deleteDocumentTool: ToolDefinition<z.ZodObject<{
462
+ documentId: z.ZodOptional<z.ZodString>;
463
+ id: z.ZodOptional<z.ZodString>;
464
+ }, z.core.$strip>, z.ZodObject<{
465
+ documentId: z.ZodString;
466
+ }, z.core.$strip>, ReactorToolClient, "deleteDocument">;
467
+ export type ReactorToolsOptions = {
468
+ /** Action types `addActions` may send; others fail as FORBIDDEN. */
469
+ allowedActionTypes?: readonly string[];
470
+ /** Vetra's codegen status; `addActions` then says how to follow generation. */
471
+ codegenStatus?: CodegenStatusRegistry;
472
+ };
473
+ export declare function createAddActionsTool(options?: ReactorToolsOptions): ToolDefinition<z.ZodObject<{
474
+ documentId: z.ZodOptional<z.ZodString>;
475
+ id: z.ZodOptional<z.ZodString>;
476
+ actions: z.ZodArray<z.ZodObject<{
477
+ type: z.ZodString;
478
+ input: z.ZodOptional<z.ZodUnknown>;
479
+ scope: z.ZodOptional<z.ZodString>;
480
+ }, z.core.$strip>>;
481
+ }, z.core.$strip>, z.ZodObject<{
482
+ documentId: z.ZodString;
483
+ revision: z.ZodRecord<z.ZodString, z.ZodNumber>;
484
+ success: z.ZodBoolean;
485
+ results: z.ZodArray<z.ZodObject<{
486
+ index: z.ZodNumber;
487
+ type: z.ZodString;
488
+ scope: z.ZodString;
489
+ operationIndex: z.ZodOptional<z.ZodNumber>;
490
+ error: z.ZodOptional<z.ZodObject<{
491
+ kind: z.ZodEnum<{
492
+ denied: "denied";
493
+ "not-applied": "not-applied";
494
+ "reducer-error": "reducer-error";
495
+ }>;
496
+ message: z.ZodString;
497
+ name: z.ZodOptional<z.ZodString>;
498
+ code: z.ZodOptional<z.ZodString>;
499
+ }, z.core.$strip>>;
500
+ }, z.core.$strip>>;
501
+ codegen: z.ZodOptional<z.ZodString>;
502
+ }, z.core.$strip>, ReactorToolClient, "addActions">;
503
+ export declare const addActionsTool: ToolDefinition<z.ZodObject<{
504
+ documentId: z.ZodOptional<z.ZodString>;
505
+ id: z.ZodOptional<z.ZodString>;
506
+ actions: z.ZodArray<z.ZodObject<{
507
+ type: z.ZodString;
508
+ input: z.ZodOptional<z.ZodUnknown>;
509
+ scope: z.ZodOptional<z.ZodString>;
510
+ }, z.core.$strip>>;
511
+ }, z.core.$strip>, z.ZodObject<{
512
+ documentId: z.ZodString;
513
+ revision: z.ZodRecord<z.ZodString, z.ZodNumber>;
514
+ success: z.ZodBoolean;
515
+ results: z.ZodArray<z.ZodObject<{
516
+ index: z.ZodNumber;
517
+ type: z.ZodString;
518
+ scope: z.ZodString;
519
+ operationIndex: z.ZodOptional<z.ZodNumber>;
520
+ error: z.ZodOptional<z.ZodObject<{
521
+ kind: z.ZodEnum<{
522
+ denied: "denied";
523
+ "not-applied": "not-applied";
524
+ "reducer-error": "reducer-error";
525
+ }>;
526
+ message: z.ZodString;
527
+ name: z.ZodOptional<z.ZodString>;
528
+ code: z.ZodOptional<z.ZodString>;
529
+ }, z.core.$strip>>;
530
+ }, z.core.$strip>>;
531
+ codegen: z.ZodOptional<z.ZodString>;
532
+ }, z.core.$strip>, ReactorToolClient, "addActions">;
533
+ /** The tools every host mounts: reads, document create/delete and `addActions`. */
534
+ export declare function reactorTools(options?: ReactorToolsOptions): readonly [ToolDefinition<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
535
+ documentModels: z.ZodArray<z.ZodObject<{
536
+ type: z.ZodString;
537
+ name: z.ZodString;
538
+ description: z.ZodString;
539
+ extension: z.ZodString;
540
+ authorName: z.ZodString;
541
+ authorWebsite: z.ZodString;
542
+ }, z.core.$strip>>;
543
+ }, z.core.$strip>, ReactorToolClient, "getDocumentModels">, ToolDefinition<z.ZodObject<{
544
+ type: z.ZodString;
545
+ compact: z.ZodOptional<z.ZodBoolean>;
546
+ definition: z.ZodOptional<z.ZodBoolean>;
547
+ operation: z.ZodOptional<z.ZodString>;
548
+ state: z.ZodOptional<z.ZodEnum<{
549
+ global: "global";
550
+ local: "local";
551
+ }>>;
552
+ filter: z.ZodOptional<z.ZodString>;
553
+ }, z.core.$strip>, z.ZodObject<{
554
+ type: z.ZodString;
555
+ model: z.ZodOptional<z.ZodObject<{
556
+ type: z.ZodString;
557
+ name: z.ZodString;
558
+ description: z.ZodString;
559
+ version: z.ZodNumber;
560
+ modules: z.ZodArray<z.ZodObject<{
561
+ name: z.ZodString;
562
+ operations: z.ZodArray<z.ZodString>;
563
+ }, z.core.$strip>>;
564
+ }, z.core.$strip>>;
565
+ definition: z.ZodOptional<z.ZodUnknown>;
566
+ compact: z.ZodOptional<z.ZodObject<{
567
+ id: z.ZodString;
568
+ name: z.ZodString;
569
+ version: z.ZodNumber;
570
+ actions: z.ZodArray<z.ZodObject<{
571
+ type: z.ZodString;
572
+ scope: z.ZodString;
573
+ input: z.ZodNullable<z.ZodString>;
574
+ }, z.core.$strip>>;
575
+ types: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
576
+ }, z.core.$strip>>;
577
+ operation: z.ZodOptional<z.ZodObject<{
578
+ name: z.ZodString;
579
+ module: z.ZodString;
580
+ scope: z.ZodString;
581
+ description: z.ZodOptional<z.ZodString>;
582
+ schema: z.ZodOptional<z.ZodString>;
583
+ errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
584
+ name: z.ZodString;
585
+ description: z.ZodOptional<z.ZodString>;
586
+ }, z.core.$strip>>>;
587
+ }, z.core.$strip>>;
588
+ state: z.ZodOptional<z.ZodObject<{
589
+ scope: z.ZodString;
590
+ schema: z.ZodString;
591
+ initialValue: z.ZodOptional<z.ZodString>;
592
+ }, z.core.$strip>>;
593
+ value: z.ZodOptional<z.ZodUnknown>;
594
+ }, z.core.$strip>, ReactorToolClient, "getDocumentModelSchema">, ToolDefinition<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
595
+ drives: z.ZodArray<z.ZodObject<{
596
+ id: z.ZodString;
597
+ documentType: z.ZodString;
598
+ name: z.ZodString;
599
+ }, z.core.$strip>>;
600
+ }, z.core.$strip>, ReactorToolClient, "getDrives">, ToolDefinition<z.ZodObject<{
601
+ documentId: z.ZodOptional<z.ZodString>;
602
+ driveId: z.ZodOptional<z.ZodString>;
603
+ id: z.ZodOptional<z.ZodString>;
604
+ filter: z.ZodOptional<z.ZodString>;
605
+ }, z.core.$strip>, z.ZodObject<{
606
+ drive: z.ZodObject<{
607
+ id: z.ZodString;
608
+ documentType: z.ZodString;
609
+ name: z.ZodString;
610
+ slug: z.ZodOptional<z.ZodString>;
611
+ branch: z.ZodString;
612
+ revision: z.ZodRecord<z.ZodString, z.ZodNumber>;
613
+ lastModifiedAtUtcIso: z.ZodOptional<z.ZodString>;
614
+ state: z.ZodUnknown;
615
+ truncated: z.ZodOptional<z.ZodBoolean>;
616
+ }, z.core.$strip>;
617
+ }, z.core.$strip>, ReactorToolClient, "getDrive">, ToolDefinition<z.ZodObject<{
618
+ documentId: z.ZodOptional<z.ZodString>;
619
+ driveId: z.ZodOptional<z.ZodString>;
620
+ parentId: z.ZodOptional<z.ZodString>;
621
+ }, z.core.$strip>, z.ZodObject<{
622
+ documents: z.ZodArray<z.ZodObject<{
623
+ id: z.ZodString;
624
+ documentType: z.ZodString;
625
+ name: z.ZodString;
626
+ }, z.core.$strip>>;
627
+ }, z.core.$strip>, ReactorToolClient, "getDocuments">, ToolDefinition<z.ZodObject<{
628
+ documentId: z.ZodOptional<z.ZodString>;
629
+ id: z.ZodOptional<z.ZodString>;
630
+ filter: z.ZodOptional<z.ZodString>;
631
+ }, z.core.$strip>, z.ZodObject<{
632
+ document: z.ZodObject<{
633
+ id: z.ZodString;
634
+ documentType: z.ZodString;
635
+ name: z.ZodString;
636
+ slug: z.ZodOptional<z.ZodString>;
637
+ branch: z.ZodString;
638
+ revision: z.ZodRecord<z.ZodString, z.ZodNumber>;
639
+ lastModifiedAtUtcIso: z.ZodOptional<z.ZodString>;
640
+ state: z.ZodUnknown;
641
+ truncated: z.ZodOptional<z.ZodBoolean>;
642
+ }, z.core.$strip>;
643
+ }, z.core.$strip>, ReactorToolClient, "getDocument">, ToolDefinition<z.ZodObject<{
644
+ documentType: z.ZodString;
645
+ name: z.ZodOptional<z.ZodString>;
646
+ driveId: z.ZodOptional<z.ZodString>;
647
+ parentFolder: z.ZodOptional<z.ZodString>;
648
+ }, z.core.$strip>, z.ZodObject<{
649
+ documentId: z.ZodString;
650
+ documentType: z.ZodString;
651
+ name: z.ZodString;
652
+ driveId: z.ZodOptional<z.ZodString>;
653
+ revision: z.ZodRecord<z.ZodString, z.ZodNumber>;
654
+ }, z.core.$strip>, ReactorToolClient, "createDocument">, ToolDefinition<z.ZodObject<{
655
+ documentId: z.ZodOptional<z.ZodString>;
656
+ id: z.ZodOptional<z.ZodString>;
657
+ actions: z.ZodArray<z.ZodObject<{
658
+ type: z.ZodString;
659
+ input: z.ZodOptional<z.ZodUnknown>;
660
+ scope: z.ZodOptional<z.ZodString>;
661
+ }, z.core.$strip>>;
662
+ }, z.core.$strip>, z.ZodObject<{
663
+ documentId: z.ZodString;
664
+ revision: z.ZodRecord<z.ZodString, z.ZodNumber>;
665
+ success: z.ZodBoolean;
666
+ results: z.ZodArray<z.ZodObject<{
667
+ index: z.ZodNumber;
668
+ type: z.ZodString;
669
+ scope: z.ZodString;
670
+ operationIndex: z.ZodOptional<z.ZodNumber>;
671
+ error: z.ZodOptional<z.ZodObject<{
672
+ kind: z.ZodEnum<{
673
+ denied: "denied";
674
+ "not-applied": "not-applied";
675
+ "reducer-error": "reducer-error";
676
+ }>;
677
+ message: z.ZodString;
678
+ name: z.ZodOptional<z.ZodString>;
679
+ code: z.ZodOptional<z.ZodString>;
680
+ }, z.core.$strip>>;
681
+ }, z.core.$strip>>;
682
+ codegen: z.ZodOptional<z.ZodString>;
683
+ }, z.core.$strip>, ReactorToolClient, "addActions">, ToolDefinition<z.ZodObject<{
684
+ documentId: z.ZodOptional<z.ZodString>;
685
+ id: z.ZodOptional<z.ZodString>;
686
+ }, z.core.$strip>, z.ZodObject<{
687
+ documentId: z.ZodString;
688
+ }, z.core.$strip>, ReactorToolClient, "deleteDocument">];
689
+ export type ReactorTool = ReturnType<typeof reactorTools>[number];
690
+ //#endregion
691
+ //#region src/tools/schema.d.ts
692
+ /** Marks a base action that runs in whichever scope it is sent to; never itself a scope. */
693
+ export declare const ANY_SCOPE = "any";
694
+ export declare const BASE_OPERATIONS: readonly ModelOperation[];
695
+ export declare const modelOperationSchema: z.ZodObject<{
696
+ name: z.ZodString;
697
+ module: z.ZodString;
698
+ scope: z.ZodString;
699
+ description: z.ZodOptional<z.ZodString>;
700
+ schema: z.ZodOptional<z.ZodString>;
701
+ }, z.core.$strip>;
702
+ export type ModelOperation = z.infer<typeof modelOperationSchema>;
703
+ export declare const documentModelInfoSchema: z.ZodObject<{
704
+ type: z.ZodString;
705
+ name: z.ZodString;
706
+ description: z.ZodString;
707
+ extension: z.ZodString;
708
+ authorName: z.ZodString;
709
+ authorWebsite: z.ZodString;
710
+ }, z.core.$strip>;
711
+ export type DocumentModelInfo = z.infer<typeof documentModelInfoSchema>;
712
+ export declare function documentModelInfo(module: DocumentModelModule): DocumentModelInfo;
713
+ export declare function latestSpecification(module: DocumentModelModule): DocumentSpecification | undefined;
714
+ /** The model's operations in its latest specification, without the base ones. */
715
+ export declare function modelOperations(module: DocumentModelModule): ModelOperation[];
716
+ /** @experimental */
717
+ export type ResolvedOperation = {
718
+ readonly operation: ModelOperation;
719
+ readonly base: boolean;
720
+ readonly creatorKey?: string;
721
+ };
722
+ /**
723
+ * @experimental The operation an action type names: a base action the base
724
+ * reducer reduces itself, else the model's own (by stored name, then by action
725
+ * type), else the base NOOP.
726
+ */
727
+ export declare function resolveOperation(module: DocumentModelModule, type: string): ResolvedOperation | undefined;
728
+ /** Every action type the document accepts: the model's and the base ones. */
729
+ export declare function actionOperations(module: DocumentModelModule): ModelOperation[];
730
+ export declare const documentModelSummarySchema: z.ZodObject<{
731
+ type: z.ZodString;
732
+ name: z.ZodString;
733
+ description: z.ZodString;
734
+ version: z.ZodNumber;
735
+ modules: z.ZodArray<z.ZodObject<{
736
+ name: z.ZodString;
737
+ operations: z.ZodArray<z.ZodString>;
738
+ }, z.core.$strip>>;
739
+ }, z.core.$strip>;
740
+ export type DocumentModelSummary = z.infer<typeof documentModelSummarySchema>;
741
+ /** Model name, latest version and its operation names by module. */
742
+ export declare function documentModelSummary(module: DocumentModelModule): DocumentModelSummary;
743
+ export declare const operationSliceSchema: z.ZodObject<{
744
+ name: z.ZodString;
745
+ module: z.ZodString;
746
+ scope: z.ZodString;
747
+ description: z.ZodOptional<z.ZodString>;
748
+ schema: z.ZodOptional<z.ZodString>;
749
+ errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
750
+ name: z.ZodString;
751
+ description: z.ZodOptional<z.ZodString>;
752
+ }, z.core.$strip>>>;
753
+ }, z.core.$strip>;
754
+ export type OperationSlice = z.infer<typeof operationSliceSchema>;
755
+ /** One operation's input schema; unknown names fail with did-you-mean. */
756
+ export declare function operationSchemaSlice(module: DocumentModelModule, operationName: string): OperationSlice;
757
+ export declare const stateSliceSchema: z.ZodObject<{
758
+ scope: z.ZodString;
759
+ schema: z.ZodString;
760
+ initialValue: z.ZodOptional<z.ZodString>;
761
+ }, z.core.$strip>;
762
+ export type StateSlice = z.infer<typeof stateSliceSchema>;
763
+ /** The state schema of one scope in the latest specification. */
764
+ export declare function stateSchemaSlice(module: DocumentModelModule, scope?: "global" | "local"): StateSlice;
765
+ //#endregion
766
+ //#region src/tools/suggest.d.ts
767
+ /** Closest `candidates` to `query`: containment first, then edit distance. */
768
+ export declare function suggestNames(query: string, candidates: readonly string[], max?: number): string[];
769
+ /** `Unknown <subject> "<value>".` plus a did-you-mean line and, when short, the known names. */
770
+ export declare function unknownValueMessage(subject: string, value: string, candidates: readonly string[], options?: {
771
+ knownLabel?: string;
772
+ inlineLimit?: number;
773
+ context?: string;
774
+ }): string;
775
+ //#endregion
776
+ export { aliasParam, targetParam };
777
+ export {};
778
+ //# sourceMappingURL=index.d.mts.map