@powerhousedao/clint 0.0.0-stage → 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.
Files changed (53) hide show
  1. package/LICENSE +661 -0
  2. package/dist/build-skills-Cfj0OGnW.mjs +293 -0
  3. package/dist/build-skills-Cfj0OGnW.mjs.map +1 -0
  4. package/dist/dist-CUltriBW.mjs +1628 -0
  5. package/dist/dist-CUltriBW.mjs.map +1 -0
  6. package/dist/drive-BEshRPDR.mjs +84 -0
  7. package/dist/drive-BEshRPDR.mjs.map +1 -0
  8. package/dist/esm-C1DOsF1a.mjs +13140 -0
  9. package/dist/esm-C1DOsF1a.mjs.map +1 -0
  10. package/dist/events-BnwGFTjv.mjs +237 -0
  11. package/dist/events-BnwGFTjv.mjs.map +1 -0
  12. package/dist/folders-C-pFsTXT.mjs +256 -0
  13. package/dist/folders-C-pFsTXT.mjs.map +1 -0
  14. package/dist/index.d.mts +1005 -0
  15. package/dist/index.d.mts.map +1 -0
  16. package/dist/index.mjs +8 -0
  17. package/dist/local-signer-EFzJV3bn.mjs +128 -0
  18. package/dist/local-signer-EFzJV3bn.mjs.map +1 -0
  19. package/dist/markdown-D-sP2zw_.mjs +275 -0
  20. package/dist/markdown-D-sP2zw_.mjs.map +1 -0
  21. package/dist/proxy-BFR8GScT.mjs +302 -0
  22. package/dist/proxy-BFR8GScT.mjs.map +1 -0
  23. package/dist/proxy-routes-DP3ztsnS.mjs +215 -0
  24. package/dist/proxy-routes-DP3ztsnS.mjs.map +1 -0
  25. package/dist/reactor-C9VIUX1H.mjs +51 -0
  26. package/dist/reactor-C9VIUX1H.mjs.map +1 -0
  27. package/dist/rolldown-runtime-8H4AJuhK.mjs +14 -0
  28. package/dist/runners/clint-runner.d.mts +398 -0
  29. package/dist/runners/clint-runner.d.mts.map +1 -0
  30. package/dist/runners/clint-runner.mjs +522 -0
  31. package/dist/runners/clint-runner.mjs.map +1 -0
  32. package/dist/runners/mastra-runner.d.mts +300 -0
  33. package/dist/runners/mastra-runner.d.mts.map +1 -0
  34. package/dist/runners/mastra-runner.mjs +516 -0
  35. package/dist/runners/mastra-runner.mjs.map +1 -0
  36. package/dist/services-9E-r0nWl.mjs +999 -0
  37. package/dist/services-9E-r0nWl.mjs.map +1 -0
  38. package/dist/src-DD8PWpD5.mjs +4767 -0
  39. package/dist/src-DD8PWpD5.mjs.map +1 -0
  40. package/dist/start-b7Mn2cxB.mjs +1526 -0
  41. package/dist/start-b7Mn2cxB.mjs.map +1 -0
  42. package/dist/stdin-BjAO9gPK.mjs +17 -0
  43. package/dist/stdin-BjAO9gPK.mjs.map +1 -0
  44. package/dist/stream-DVuufwIj.mjs +148 -0
  45. package/dist/stream-DVuufwIj.mjs.map +1 -0
  46. package/dist/subscriptions-CfiflAsI.mjs +38 -0
  47. package/dist/subscriptions-CfiflAsI.mjs.map +1 -0
  48. package/dist/switchboard-CyvOavqL.mjs +57 -0
  49. package/dist/switchboard-CyvOavqL.mjs.map +1 -0
  50. package/dist/types-CRkoD-Mm.d.mts +1770 -0
  51. package/dist/types-CRkoD-Mm.d.mts.map +1 -0
  52. package/package.json +102 -3
  53. package/README.md +0 -3
@@ -0,0 +1,1005 @@
1
+ import { $ as OnFn, A as AgentStreamOptions, At as ToolOutputChunk, B as ConfigEnvVar, Bt as PROJECT_INDICATORS, C as ReserveAttachmentOptions, Ct as ServiceProxyRouteSpec, D as AgentPromptInput, Dt as StreamChunk, E as AgentProfileConfig, Et as SkillConfig, F as Cli, Ft as WorkItem, G as EventBus, Gt as buildSwitchboardRoutes, H as EmitFn, Ht as ProxyRoute, I as CliMetadata, It as WorkdirStore, J as LifecycleHandle, K as InferConfig, Kt as captureRoutePrefix, L as CliOptions, Lt as WrapRegistry, M as BootstrapOptions, Mt as Trigger, N as BootstrapResult, Nt as TriggerContext, O as AgentProvider, Ot as TextDeltaChunk, P as CaptureDefinition, Pt as TriggerOptions, Q as Logger, R as Command, Rt as SkillInfo, S as IAttachmentService, St as ServiceManager, T as AgentLoader, Tt as ServiceStatus, U as EndpointType, Ut as buildServiceRoutes, V as CoreContext, Vt as scanProjects, W as ErrorChunk, Wt as buildSwitchboardRouteSpecs, X as LifecycleInitContext, Y as LifecycleHook, Z as LogLevel, _ as TypedDocumentChangeEvent, _t as RoutineStatus, a as DriveConfig, at as ProcessManager, b as AttachmentResponse, bt as ServiceDefinition, c as FolderOperations, ct as ProjectScanner, d as ReactorContext, dt as ReadinessConfig, et as PhClintEvents, f as ReactorSetupContext, ft as ReadinessPattern, g as SwitchboardInstance, gt as RoutineConfig, h as SwitchboardConfig, ht as Routine, i as DocumentRegistry, it as ProcessHandle, j as BootTimings, jt as ToolResultChunk, k as AgentSetupContext, kt as ToolCallChunk, l as ReactorClientModule, lt as PromptConfig, m as SubscriptionConfig, mt as ResolvedInteractiveConfig, n as AttachmentRef, nt as PreflightContext, o as DriveEntry, ot as ProcessRunOptions, p as RegistryEntry, pt as Resolvable, q as InteractiveConfig, qt as isWsEndpointType, r as ConnectConfig, rt as PreflightResult, s as FolderEntry, st as ProjectScanResult, t as AnyRegistry, tt as PreflightCheck, u as ReactorConfiguration, ut as PromptsConfig, v as TypedReactorClient, vt as RunOptions, w as AgentContentPart, wt as ServiceStartOptions, x as AttachmentUploadResult, xt as ServiceInstanceStatus, y as AttachmentHeader, yt as ServiceBuildContext, z as CommandContext, zt as readSkills } from "./types-CRkoD-Mm.mjs";
2
+ import { z } from "zod";
3
+ import Handlebars from "handlebars";
4
+ import { IReactorClient } from "@powerhousedao/reactor";
5
+ import { Action as Action$1, DocumentModelModule } from "document-model";
6
+ //#region src/core/pkg.d.ts
7
+ interface PackageInfo {
8
+ /** Project root directory (parent of the `src/` file that called this). */
9
+ root: string;
10
+ /** Package name with `@scope/` stripped (e.g. `"foo-cli"` from `"@acme/foo-cli"`). */
11
+ name: string;
12
+ /** Package version as-is from package.json. */
13
+ version: string;
14
+ }
15
+ /**
16
+ * Read package identity from the nearest `package.json` above the calling
17
+ * source file. Pass `import.meta.url` — the function resolves the project
18
+ * root as the parent directory of the file's directory (i.e. `src/config.ts`
19
+ * → project root is `..`).
20
+ */
21
+ export declare function readPackageInfo(importMetaUrl: string): PackageInfo;
22
+ //#endregion
23
+ //#region src/core/command.d.ts
24
+ /**
25
+ * Define a command — the atomic unit of ph-clint.
26
+ * Compatible with Mastra createTool() shape.
27
+ */
28
+ export declare function defineCommand<TInput extends z.ZodType, TOutput = unknown, TConfig = Record<string, unknown>, R extends DocumentRegistry = any>(options: Command<TInput, TOutput, TConfig, R>): Command<TInput, TOutput, TConfig, R>;
29
+ //#endregion
30
+ //#region src/core/errors.d.ts
31
+ export declare function formatZodError(err: unknown, commandId?: string): string;
32
+ //#endregion
33
+ //#region src/core/logger.d.ts
34
+ export declare function createLogger(level?: LogLevel, sink?: (msg: string) => void): Logger;
35
+ //#endregion
36
+ //#region src/core/cli.d.ts
37
+ /**
38
+ * Define a CLI — the top-level entry point.
39
+ *
40
+ * When a `configSchema` is provided, TSchema is inferred automatically,
41
+ * giving typed `config` in agent factories, `Resolvable` callbacks, and
42
+ * interactive config.
43
+ */
44
+ export declare function defineCli<TSchema extends import("zod").ZodType = import("zod").ZodType<Record<string, unknown>>, TSecrets extends import("zod").ZodType = import("zod").ZodType<Record<string, unknown>>>(options: CliOptions<TSchema, TSecrets>): Cli;
45
+ //#endregion
46
+ //#region src/core/trigger.d.ts
47
+ /**
48
+ * Define a trigger — a pluggable object that produces work items for the routine loop.
49
+ *
50
+ * Generics:
51
+ * - `TState` — shape of `ctx.state`. Combine with `state: () => TState` to initialize.
52
+ * - `TConfig` — shape of `ctx.context.config`. Use the binding from `createTypes()` to avoid repeating.
53
+ * - `R` — DocumentRegistry, narrows `ctx.reactor()` and event payloads.
54
+ */
55
+ export declare function defineTrigger<TState = Record<string, unknown>, TConfig = Record<string, unknown>, R extends DocumentRegistry = AnyRegistry>(options: TriggerOptions<TState, TConfig, R>): Trigger<TState, TConfig, R>;
56
+ //#endregion
57
+ //#region src/integrations/powerhouse/change-trigger.d.ts
58
+ interface DocumentChangeTriggerOptions<R extends DocumentRegistry, T extends keyof R & string, TConfig = Record<string, unknown>, TState extends {
59
+ pending: number;
60
+ } = {
61
+ pending: number;
62
+ }> {
63
+ /** Unique trigger id for logging/routing. */
64
+ id: string;
65
+ /** The document type(s) to watch. Must be key(s) in the registry. */
66
+ documentType: T | T[];
67
+ /**
68
+ * The specific document id (or a function that resolves one from context).
69
+ * When omitted, the helper loads ALL documents of the watched type(s)
70
+ * via `client.find()` and passes the full array to `onChange`.
71
+ *
72
+ * When a function is provided, it's resolved lazily on each poll. Returning
73
+ * `undefined` skips the tick.
74
+ */
75
+ documentId?: string | ((ctx: TriggerContext<TState, TConfig, R>) => Promise<string | undefined>);
76
+ /**
77
+ * Fire once on startup before any event arrives — useful for reconciling
78
+ * against the current document state. Default: true.
79
+ */
80
+ initialReconcile?: boolean;
81
+ /**
82
+ * Optional predicate: called per-document after loading, before onChange.
83
+ * Return false to exclude a document from the batch. If all documents
84
+ * are filtered out, onChange is not called.
85
+ */
86
+ filter?: (doc: R[T]["document"], ctx: TriggerContext<TState, TConfig, R>) => boolean | Promise<boolean>;
87
+ /**
88
+ * User's change handler. Receives an array of loaded, type-narrowed
89
+ * documents and the full trigger context. Returns a work item for the
90
+ * routine loop to execute (or null to skip).
91
+ */
92
+ onChange: (docs: Array<R[T]["document"]>, ctx: TriggerContext<TState, TConfig, R>) => Promise<WorkItem | null>;
93
+ /**
94
+ * Call `onChange` even when zero documents are found. Default: false.
95
+ * Useful for triggers that need to perform work (e.g. bootstrapping from
96
+ * disk) regardless of whether any documents exist yet.
97
+ */
98
+ callOnEmpty?: boolean;
99
+ /**
100
+ * Optional initial state for the trigger's private slot. Defaults to
101
+ * `{ pending: 0 }`. When supplied, the shape MUST include a `pending:
102
+ * number` field — the helper bumps and drains it internally.
103
+ */
104
+ state?: () => TState;
105
+ }
106
+ /**
107
+ * Build a Trigger that listens for document change events on the event bus,
108
+ * coalesces them, loads matching documents, narrows to the registered type,
109
+ * and hands them to the user's onChange handler.
110
+ *
111
+ * Runtime behavior:
112
+ * 1. `setup()` subscribes to `powerhouse:document:changed`. For each event,
113
+ * if any documentType matches (and, when `documentId` is a literal
114
+ * string, the id also matches), bump the pending counter.
115
+ * 2. If `initialReconcile !== false`, `setup()` bumps pending once on
116
+ * startup so the first poll reconciles without waiting for an event.
117
+ * 3. `poll()` returns null unless pending > 0. When pending > 0:
118
+ * - If `documentId` is set: load single doc, wrap in `[doc]`
119
+ * - If `documentId` is omitted: `find()` all docs of matching type(s)
120
+ * Applies `filter` per-doc, then calls `onChange(docs, ctx)`.
121
+ * 4. pending is reset to 0 at the start of each poll drain — multiple
122
+ * events within a tick coalesce to one `onChange` call.
123
+ */
124
+ export declare function createDocumentChangeTrigger<R extends DocumentRegistry = AnyRegistry, T extends keyof R & string = keyof R & string, TConfig = Record<string, unknown>, TState extends {
125
+ pending: number;
126
+ } = {
127
+ pending: number;
128
+ }>(options: DocumentChangeTriggerOptions<R, T, TConfig, TState>): Trigger<TState, TConfig, R>;
129
+ //#endregion
130
+ //#region src/core/types-binding.d.ts
131
+ /**
132
+ * Options for `createTypes`.
133
+ *
134
+ * - `configSchema` — the CLI's Zod config schema (optionally merged with secrets).
135
+ * - `registry` — optional DocumentRegistry produced by `defineRegistry(...)`.
136
+ * Omit to fall back to `AnyRegistry` everywhere.
137
+ */
138
+ interface CreateTypesOptions<TSchema extends z.ZodType, R extends DocumentRegistry> {
139
+ configSchema: TSchema;
140
+ registry?: R;
141
+ }
142
+ /**
143
+ * Bundle of typed factories returned by `createTypes()`.
144
+ *
145
+ * Each factory pre-binds `TConfig` (inferred from `configSchema`) and `R`
146
+ * (from `registry`) so impl call sites only need to declare per-call
147
+ * generics such as `TState`.
148
+ */
149
+ interface TypedFactory<TConfig, R extends DocumentRegistry> {
150
+ /**
151
+ * Typed `defineCommand` — `ctx.config` is `TConfig`, `ctx.reactor()` is
152
+ * `ReactorContext<R>`.
153
+ */
154
+ defineCommand<TInput extends z.ZodType, TOutput = unknown>(options: {
155
+ id: string;
156
+ description: string;
157
+ inputSchema: TInput;
158
+ outputSchema?: z.ZodType<TOutput>;
159
+ prompt?: PromptConfig;
160
+ execute: (input: z.output<TInput>, ctx: CommandContext<TConfig, R>) => Promise<TOutput>;
161
+ }): Command<TInput, TOutput, TConfig, R>;
162
+ /**
163
+ * Typed `defineTrigger` — `ctx.state` is `TState`, `ctx.context.config`
164
+ * is `TConfig`, `ctx.reactor()` is `ReactorContext<R>`, and event bus
165
+ * payloads are narrowed by `R`.
166
+ */
167
+ defineTrigger<TState = Record<string, unknown>>(options: TriggerOptions<TState, TConfig, R>): Trigger<TState, TConfig, R>;
168
+ /**
169
+ * Typed `defineService` — `env` / `preflight` see the typed config.
170
+ * The registry generic is intentionally not threaded through services
171
+ * today: services don't access the reactor.
172
+ */
173
+ defineService(options: ServiceDefinition<TConfig>): ServiceDefinition<TConfig>;
174
+ /**
175
+ * Typed `createDocumentChangeTrigger` — `TConfig` and `R` are pre-bound
176
+ * from `createTypes`. At the call site, only `T` (documentType key) and
177
+ * optionally `TState` need to be declared.
178
+ */
179
+ createDocumentChangeTrigger<T extends keyof R & string, TState extends {
180
+ pending: number;
181
+ } = {
182
+ pending: number;
183
+ }>(options: DocumentChangeTriggerOptions<R, T, TConfig, TState>): Trigger<TState, TConfig, R>;
184
+ }
185
+ /**
186
+ * Bind a CLI's config schema and optional registry once; reuse the returned
187
+ * typed factories across every command/trigger/service in the impl.
188
+ *
189
+ * ```ts
190
+ * // impl/src/framework.ts
191
+ * import { z } from 'zod';
192
+ * import { createTypes, defineRegistry } from '@powerhousedao/ph-clint';
193
+ * import { PhClintProject } from '@powerhousedao/ph-clint-app/document-models/ph-clint-project';
194
+ *
195
+ * const configSchema = z.object({ projectDocumentId: z.string().optional() });
196
+ * const registry = defineRegistry([PhClintProject] as const);
197
+ *
198
+ * export const {
199
+ * defineCommand,
200
+ * defineTrigger,
201
+ * defineService,
202
+ * createDocumentChangeTrigger,
203
+ * } = createTypes({ configSchema, registry });
204
+ * ```
205
+ */
206
+ export declare function createTypes<TSchema extends z.ZodType, R extends DocumentRegistry = AnyRegistry>(_opts: CreateTypesOptions<TSchema, R>): TypedFactory<z.infer<TSchema>, R>;
207
+ //#endregion
208
+ //#region src/core/schema.d.ts
209
+ /**
210
+ * Schema introspection utilities for Zod v4.
211
+ *
212
+ * Uses the public Zod v4 API: .type, .shape, .description, .def,
213
+ * .isOptional(), and instanceof checks.
214
+ */
215
+ interface FieldInfo {
216
+ key: string;
217
+ description: string | undefined;
218
+ isOptional: boolean;
219
+ hasDefault: boolean;
220
+ defaultValue: unknown;
221
+ baseType: string;
222
+ sensitive: boolean;
223
+ }
224
+ /**
225
+ * Extract field entries from a ZodObject schema's shape.
226
+ * Returns an empty array for non-object schemas.
227
+ *
228
+ * When `sensitiveKeys` is provided, those fields are marked `sensitive: true`.
229
+ */
230
+ export declare function getSchemaFields(schema: z.ZodType, sensitiveKeys?: ReadonlySet<string>): FieldInfo[];
231
+ /**
232
+ * Convert a kebab-case slug to a Title Case string.
233
+ * E.g. 'document-modeling' → 'Document Modeling'
234
+ */
235
+ export declare function slugToTitle(slug: string): string;
236
+ //#endregion
237
+ //#region src/core/store.d.ts
238
+ /**
239
+ * Create a file-based WorkdirStore.
240
+ *
241
+ * @param cliWorkdir Working directory (resolved to absolute via `path.resolve(cwd, cliWorkdir)`).
242
+ * @param cliName CLI name, used to namespace under `.ph/`.
243
+ */
244
+ export declare function createWorkdirStore(cliWorkdir: string, cliName: string): WorkdirStore;
245
+ /**
246
+ * Create an in-memory WorkdirStore for testing or when no persistence is needed.
247
+ *
248
+ * @param cliWorkdir Working directory (defaults to `'.'`, resolved to absolute).
249
+ * @param cliName CLI name (defaults to `'test'`).
250
+ */
251
+ export declare function createMemoryWorkdirStore(cliWorkdir?: string, cliName?: string): WorkdirStore;
252
+ //#endregion
253
+ //#region src/core/config.d.ts
254
+ /**
255
+ * Convert a camelCase string to UPPER_SNAKE_CASE.
256
+ */
257
+ export declare function toUpperSnake(str: string): string;
258
+ /**
259
+ * Derive the environment variable name for a config field.
260
+ * E.g., configKeyToEnvVar('tasks', 'defaultPriority') → 'TASKS_DEFAULT_PRIORITY'
261
+ */
262
+ export declare function configKeyToEnvVar(cliName: string, field: string): string;
263
+ /**
264
+ * Return the path to the local config file for a CLI.
265
+ * Located at {workdir}/.ph/{cli-name}.config.local.json.
266
+ */
267
+ export declare function localConfigPath(workdir: string, cliName: string): string;
268
+ /**
269
+ * Return the path to the user-wide config file for a CLI.
270
+ * Located at ~/.ph/{cli-name}.config.user.json.
271
+ */
272
+ export declare function userConfigPath(cliName: string): string;
273
+ /**
274
+ * Return the path to a user-scope store folder for a CLI.
275
+ * Located at ~/.ph/{cli-name}/{subpath...}.
276
+ * When called with no subpath, returns the store root ~/.ph/{cli-name}/.
277
+ */
278
+ export declare function userStoreFolder(cliName: string, ...subpath: string[]): string;
279
+ /**
280
+ * Options for resolveConfig.
281
+ */
282
+ interface ResolveConfigOptions {
283
+ configSchema: z.ZodType;
284
+ cliName: string;
285
+ /** Resolved workspace directory (absolute path). */
286
+ workdir: string;
287
+ /** Path to a config file from --config flag (relative to cwd). */
288
+ configFile?: string;
289
+ /** Current working directory for resolving --config path. */
290
+ cwd?: string;
291
+ /** Implementation-level defaults (layer 5). */
292
+ implementationDefaults?: Record<string, unknown>;
293
+ }
294
+ /**
295
+ * Resolve config through 6 layers (highest priority first):
296
+ *
297
+ * 1. Config file (--config flag, path relative to cwd)
298
+ * 2. Environment variables ({CLINAME}_{FIELD_NAME})
299
+ * 3. Local config ({workdir}/.ph/{cli-name}.config.local.json)
300
+ * 4. User config (~/.ph/{cli-name}.config.user.json)
301
+ * 5. Implementation defaults (passed from project code)
302
+ * 6. Hardcoded defaults (from Zod schema .default() calls)
303
+ *
304
+ * Returns the validated, merged config object.
305
+ */
306
+ export declare function resolveConfig(opts: ResolveConfigOptions): Record<string, unknown>;
307
+ /**
308
+ * Identify config fields that are mandatory (no default, not optional)
309
+ * and have no value in the merged config.
310
+ */
311
+ export declare function getMissingRequiredFields(configSchema: z.ZodType, resolvedConfig: Record<string, unknown>): Array<{
312
+ key: string;
313
+ description: string;
314
+ }>;
315
+ //#endregion
316
+ //#region src/core/config-command.d.ts
317
+ interface ConfigCommandOptions {
318
+ cliName: string;
319
+ configSchema: z.ZodType;
320
+ /** Keys of config fields that are sensitive (from secretsSchema). */
321
+ sensitiveKeys?: ReadonlySet<string>;
322
+ /** Implementation defaults (layer 5). */
323
+ implementationDefaults?: Record<string, unknown>;
324
+ /** Config file from --config flag (already resolved to absolute). */
325
+ configFile?: string;
326
+ }
327
+ /**
328
+ * Create the built-in `config` command for a CLI.
329
+ */
330
+ export declare function createConfigCommand(opts: ConfigCommandOptions): Command;
331
+ /**
332
+ * Generate a detailed help page for the config command.
333
+ */
334
+ export declare function generateConfigCommandHelp(cliName: string, configSchema: z.ZodType, workdir: string, sensitiveKeys?: ReadonlySet<string>): string;
335
+ //#endregion
336
+ //#region src/core/workdir.d.ts
337
+ /**
338
+ * Options for resolving the working directory.
339
+ */
340
+ interface ResolveWorkdirOptions {
341
+ /** Implementation-level override (highest priority). */
342
+ implementationOverride?: string;
343
+ /** Value from --workdir CLI flag. */
344
+ cliFlag?: string;
345
+ /** Fallback directory (defaults to process.cwd()). */
346
+ fallback?: string;
347
+ }
348
+ /**
349
+ * Resolve the working directory through a 3-level precedence:
350
+ * 1. Fallback: cwd (always available)
351
+ * 2. CLI flag: --workdir value (user override)
352
+ * 3. Implementation override (project code sets it)
353
+ *
354
+ * Higher numbers override lower. Returns an absolute path.
355
+ */
356
+ export declare function resolveWorkdir(opts?: ResolveWorkdirOptions): string;
357
+ //#endregion
358
+ //#region src/core/events.d.ts
359
+ /**
360
+ * Create an event bus — a central EventEmitter-based bus for decoupled communication.
361
+ *
362
+ * The runtime is untyped (plain EventEmitter under the hood). The `R` generic
363
+ * only shapes the static typing of `emit` / `on` / `off` for framework events.
364
+ */
365
+ export declare function createEventBus<R extends DocumentRegistry = AnyRegistry>(): EventBus<R>;
366
+ //#endregion
367
+ //#region src/core/processes.d.ts
368
+ /**
369
+ * Create a process manager for running bounded shell commands.
370
+ * Inspired by the agent prototype's CLIExecutor.
371
+ */
372
+ export declare function createProcessManager(): ProcessManager;
373
+ //#endregion
374
+ //#region src/core/services.d.ts
375
+ /**
376
+ * Resolve the display name for a service definition.
377
+ * Uses `def.name` if provided, otherwise auto-generates from `def.id`.
378
+ */
379
+ export declare function resolveServiceName(def: ServiceDefinition<any>): string;
380
+ /**
381
+ * Identity wrapper for service definitions — provides type checking and IDE support.
382
+ */
383
+ export declare function defineService<TConfig = Record<string, unknown>>(opts: ServiceDefinition<TConfig>): ServiceDefinition<TConfig>;
384
+ interface ServiceManagerOptions {
385
+ config: Record<string, unknown>;
386
+ servicesDir: string;
387
+ eventBus?: EventBus;
388
+ }
389
+ /**
390
+ * Create a ServiceManager for managing long-running detached services.
391
+ */
392
+ export declare function createServiceManager(definitions: ServiceDefinition<any>[], opts: ServiceManagerOptions): ServiceManager;
393
+ //#endregion
394
+ //#region src/core/service-command.d.ts
395
+ /**
396
+ * Format a service instance status line for display.
397
+ */
398
+ export declare function formatStatus(s: ServiceInstanceStatus): string;
399
+ /**
400
+ * Create per-service commands for a service definition.
401
+ *
402
+ * For service `id: 'vetra'`, generates:
403
+ * - vetra-start: Start the service
404
+ * - vetra-stop: Stop the service
405
+ * - vetra-restart: Restart the service
406
+ * - vetra-ps: Show service status
407
+ * - vetra-logs: Tail service logs
408
+ * - vetra-manage: Open interactive panel (REPL only)
409
+ */
410
+ export declare function createServiceCommands(def: ServiceDefinition<any>): Command[];
411
+ //#endregion
412
+ //#region src/core/project-mapping.d.ts
413
+ interface ProjectMapping {
414
+ /** Project name. */
415
+ name: string;
416
+ /** On-disk location (if found by scanner). */
417
+ path: string | undefined;
418
+ /** Document ID (if linked via spec JSON or found in personal drive). */
419
+ documentId: string | undefined;
420
+ /** Document type. */
421
+ documentType: string | undefined;
422
+ /** Path in the personal drive folder structure. */
423
+ folderPath: string | undefined;
424
+ }
425
+ /**
426
+ * Merge on-disk scan results with personal drive folder entries
427
+ * to produce a unified project mapping.
428
+ *
429
+ * Links are matched by documentId. Projects without a documentId
430
+ * are still included (path-only). Drive documents without a matching
431
+ * on-disk project are also included (document-only).
432
+ */
433
+ export declare function getProjectMapping(scanResults: ProjectScanResult[], folders?: FolderOperations): Promise<ProjectMapping[]>;
434
+ //#endregion
435
+ //#region src/core/preflight.d.ts
436
+ /**
437
+ * Check if a TCP port is free by attempting to bind to it.
438
+ */
439
+ export declare function isPortFree(port: number): Promise<boolean>;
440
+ /**
441
+ * Check that the working directory satisfies a condition.
442
+ *
443
+ * @param test A function that receives the cwd and returns true if valid.
444
+ * @param message Error message on failure.
445
+ * @param hint Optional guidance.
446
+ */
447
+ export declare function checkWorkdir(test: (cwd: string) => boolean, message: string, hint?: string): PreflightCheck;
448
+ /**
449
+ * Check that a command is available on PATH, optionally matching a version.
450
+ *
451
+ * @param binary Binary name (e.g. 'ph', 'node', 'pnpm').
452
+ * @param options Optional version flag, version predicate, and hint.
453
+ */
454
+ export declare function checkCommand(binary: string, options?: {
455
+ versionFlag?: string;
456
+ versionTest?: (version: string) => boolean;
457
+ hint?: string;
458
+ }): PreflightCheck;
459
+ /**
460
+ * Check that a TCP port is available.
461
+ *
462
+ * @param port Port number, or a function that extracts it from the preflight context.
463
+ * @param label Human-readable name for the port (e.g. 'Connect Studio').
464
+ */
465
+ export declare function checkPort(port: number | ((ctx: PreflightContext) => number | undefined), label?: string): PreflightCheck;
466
+ //#endregion
467
+ //#region src/core/help-command.d.ts
468
+ interface HelpCommandOptions {
469
+ /** Lazy reference to the CLI's run function (resolved after defineCli returns). */
470
+ getCli: () => Cli;
471
+ }
472
+ /**
473
+ * Create the built-in `cli-docs` command for a CLI.
474
+ *
475
+ * Captures Commander's own help output so the agent sees exactly the same
476
+ * text the user gets from `mycli help` / `mycli help <command>`, with
477
+ * headings reworded for agent context.
478
+ */
479
+ export declare function createHelpCommand(opts: HelpCommandOptions): Command;
480
+ //#endregion
481
+ //#region src/core/init.d.ts
482
+ /**
483
+ * Options for installSkills.
484
+ */
485
+ interface InstallSkillsOptions {
486
+ /** WorkdirStore — used to compute the target `.mastra/skills/` folder. */
487
+ store: WorkdirStore;
488
+ /** Candidate directories containing pre-built skill artifacts. First existing wins. */
489
+ skillArtifacts: string[];
490
+ /** Optional output callback. Default: console.log. */
491
+ stdout?: (text: string) => void;
492
+ }
493
+ /**
494
+ * Copy pre-packaged skill folders into the store's `.mastra/skills/` directory.
495
+ *
496
+ * Iterates `skillArtifacts` and uses the first directory that exists.
497
+ * Clears the target before copying to avoid stale skills.
498
+ * Each skill folder is expected to contain at least a `SKILL.md` file.
499
+ *
500
+ * @returns The number of skill folders copied, or 0 if no source was found.
501
+ */
502
+ export declare function installSkills(options: InstallSkillsOptions): number;
503
+ //#endregion
504
+ //#region src/core/skill-commands.d.ts
505
+ /**
506
+ * Default Handlebars template for skill instructions.
507
+ */
508
+ export declare const DEFAULT_SKILL_INSTRUCTION = "Use your {{skillId}} skill for the following instructions: {{prompt}}";
509
+ /**
510
+ * A skill invocation result — returned by skill commands to signal
511
+ * that the dispatch layer should route to the agent with a skill prefix.
512
+ */
513
+ interface SkillInvocation {
514
+ type: "skill-invocation";
515
+ skillName: string;
516
+ userMessage?: string;
517
+ /** Handlebars template for rendering the agent instruction. */
518
+ instructionTemplate?: string;
519
+ /** Values for all input fields (prompt + any extra from inputSchema). */
520
+ inputValues?: Record<string, unknown>;
521
+ }
522
+ /**
523
+ * Type guard for SkillInvocation.
524
+ */
525
+ export declare function isSkillInvocation(v: unknown): v is SkillInvocation;
526
+ /**
527
+ * Create CLI commands from skill metadata and optional skill configs.
528
+ * Each skill becomes a thin command with a --prompt flag that returns a SkillInvocation.
529
+ *
530
+ * Emits warnings to stderr when a custom instructionTemplate omits {{prompt}}.
531
+ */
532
+ export declare function createSkillCommands(skills: SkillInfo[], skillConfigs?: Record<string, string | SkillConfig>): Command<any, SkillInvocation>[];
533
+ //#endregion
534
+ //#region src/core/templates.d.ts
535
+ /**
536
+ * Register the 8 standard Handlebars helpers on a Handlebars instance.
537
+ */
538
+ export declare function registerDefaultHelpers(hbs: typeof Handlebars): void;
539
+ /**
540
+ * Walk a Handlebars AST and return all top-level variable names referenced.
541
+ * Filters out known helpers and built-in block helpers.
542
+ */
543
+ export declare function extractTemplateVars(template: string): Set<string>;
544
+ /**
545
+ * Options for renderSkillTemplate.
546
+ */
547
+ interface RenderOptions {
548
+ /** Additional Handlebars helpers to register alongside defaults. */
549
+ helpers?: Record<string, (...args: unknown[]) => unknown>;
550
+ /** Additional known helper names to exclude from missing-variable detection. */
551
+ knownHelpers?: string[];
552
+ }
553
+ /**
554
+ * Result of rendering a skill template.
555
+ */
556
+ interface RenderResult {
557
+ rendered: string;
558
+ warnings: string[];
559
+ }
560
+ /**
561
+ * Render a Handlebars template with default helpers and missing-variable detection.
562
+ * Uses Handlebars.create() for isolation — no global state pollution.
563
+ */
564
+ export declare function renderSkillTemplate(template: string, context: Record<string, unknown>, options?: RenderOptions): RenderResult;
565
+ //#endregion
566
+ //#region src/core/routine.d.ts
567
+ interface RoutineOptions {
568
+ triggers: Trigger<any, any, any>[];
569
+ commands: Map<string, Command>;
570
+ tickInterval?: number;
571
+ idleInterval?: number;
572
+ context?: CommandContext;
573
+ eventBus?: EventBus;
574
+ processManager?: ProcessManager;
575
+ getReactor?: () => Promise<ReactorContext | undefined>;
576
+ getAgent?: () => Promise<AgentProvider | undefined>;
577
+ }
578
+ /**
579
+ * Create a routine — a tick-based execution loop with pluggable triggers.
580
+ * Inspired by the agent prototype's AgentRoutine.
581
+ *
582
+ * State machine: init → ready → running ↔ stopping
583
+ */
584
+ export declare function createRoutine(options: RoutineOptions): Routine;
585
+ //#endregion
586
+ //#region src/core/routine-service.d.ts
587
+ /**
588
+ * Create a ServiceManager adapter that wraps a Routine,
589
+ * giving it the same command surface as a process-based service.
590
+ */
591
+ export declare function createRoutineServiceAdapter(routine: Routine, config: RoutineConfig, eventBus?: EventBus): ServiceManager;
592
+ /**
593
+ * Create a composite ServiceManager that routes calls to the correct
594
+ * underlying manager based on service ID.
595
+ */
596
+ export declare function createCompositeServiceManager(managers: ServiceManager[], routeMap: Map<string, ServiceManager>): ServiceManager;
597
+ //#endregion
598
+ //#region src/core/stream.d.ts
599
+ /**
600
+ * Format a single StreamChunk into a display string.
601
+ *
602
+ * This is the framework-level formatter. The Mastra integration maps
603
+ * Mastra's fullStream chunks to StreamChunk first, then this renders them.
604
+ *
605
+ * Tool activity is styled with dim green (calls/results) and red (errors)
606
+ * so it's visually distinct from the agent's text output.
607
+ */
608
+ export declare function formatStreamChunk(chunk: StreamChunk): string;
609
+ /** A rendered stream element: the raw chunk paired with its formatted text. */
610
+ interface RenderedChunk {
611
+ chunk: StreamChunk;
612
+ formatted: string;
613
+ }
614
+ /**
615
+ * Consume a stream of StreamChunks and yield { chunk, formatted } pairs.
616
+ *
617
+ * Inserts an extra newline before the first text-delta after tool activity,
618
+ * so the agent's prose is visually separated from tool call/result lines.
619
+ */
620
+ export declare function renderStream(stream: AsyncGenerator<StreamChunk>): AsyncGenerator<RenderedChunk, void, unknown>;
621
+ //#endregion
622
+ //#region src/core/proxy.d.ts
623
+ interface ProxyServerOptions {
624
+ /** Port to listen on (0 = auto-assign). */
625
+ port: number;
626
+ /** Bind address (default '0.0.0.0'). */
627
+ host: string;
628
+ /**
629
+ * Browser-facing base URL when the proxy sits behind an ingress /
630
+ * reverse proxy (e.g. `https://vetra-agent.<tenant>.vetra.io`). When
631
+ * set, `url` returns this instead of the local listen address, so
632
+ * everything composed from it (the ready event's proxied switchboard /
633
+ * drive / mcp URLs) is reachable from outside the pod.
634
+ *
635
+ * A non-root pathname mounts the whole proxy surface under that base
636
+ * path (e.g. `https://host/myagent` → base path `/myagent`): incoming
637
+ * requests carry the prefix, it is stripped before route matching, and
638
+ * redirect Locations are re-prefixed with it.
639
+ */
640
+ publicUrl?: string;
641
+ logger: Logger;
642
+ }
643
+ interface ProxyServerInstance {
644
+ readonly port: number;
645
+ readonly host: string;
646
+ readonly url: string;
647
+ addRoute(route: ProxyRoute): void;
648
+ removeRoutesBySource(source: string): void;
649
+ getRoutes(): ReadonlyArray<Readonly<ProxyRoute>>;
650
+ stop(): Promise<void>;
651
+ }
652
+ /**
653
+ * Create and start an embedded reverse proxy server.
654
+ */
655
+ export declare function createProxyServer(options: ProxyServerOptions): Promise<ProxyServerInstance>;
656
+ //#endregion
657
+ //#region src/interactive/types.d.ts
658
+ /**
659
+ * Output from processing a REPL input line.
660
+ */
661
+ interface ReplOutput {
662
+ text: string;
663
+ type: "result" | "error" | "help" | "exit" | "empty" | "prompt" | "panel";
664
+ /** When type is 'prompt', the label to show instead of '> ' (e.g. "priority"). */
665
+ promptLabel?: string;
666
+ /** When type is 'panel', the panel identifier to render (e.g. 'services'). */
667
+ panelId?: string;
668
+ }
669
+ /**
670
+ * Options for creating a REPL session.
671
+ */
672
+ interface ReplSessionOptions {
673
+ cli: Cli;
674
+ context: CommandContext;
675
+ /** Agent provider for default command routing. Resolved by defineCli from integrations. */
676
+ agentProvider?: AgentProvider;
677
+ /** Thread ID for conversation memory (from --resume flag). */
678
+ threadId?: string;
679
+ }
680
+ /**
681
+ * A REPL session — processes input lines and returns output.
682
+ * The session is the testable logic layer, independent of Ink rendering.
683
+ */
684
+ interface ReplSession {
685
+ processInput(input: string): Promise<ReplOutput>;
686
+ getCompletions(partial: string): string[];
687
+ /** Get inline ghost suggestion (full input with first completion applied), or null. */
688
+ getGhostSuggestion(input: string): string | null;
689
+ /** Get suffix to append after applying a completion (e.g. ` "` for string flags). */
690
+ getCompletionSuffix(completion: string, input: string): string;
691
+ /** True when the session is waiting for a prompt answer. */
692
+ readonly isPrompting: boolean;
693
+ welcome: string | undefined;
694
+ /** The exit message (includes resume hint when a threadId is set). */
695
+ readonly exitMessage: string;
696
+ /** Callback invoked for each chunk during agent streaming. Receives the raw chunk and cumulative formatted text. */
697
+ onStreamChunk?: (chunk: StreamChunk, fullText: string) => void;
698
+ /** Number of trailing lines to show for tool output in the rolling window. */
699
+ outputWindow: number;
700
+ /** Abort the currently running agent stream. The LLM request is cancelled and the session stays on the same thread. */
701
+ abortCurrentStream(): void;
702
+ }
703
+ /**
704
+ * A single entry in the REPL history.
705
+ */
706
+ interface HistoryEntry {
707
+ id: number;
708
+ input: string;
709
+ output: string;
710
+ type: ReplOutput["type"];
711
+ }
712
+ //#endregion
713
+ //#region src/interactive/session.d.ts
714
+ /**
715
+ * Create a REPL session — the testable logic layer for interactive mode.
716
+ *
717
+ * The session processes input lines (e.g. `/greet --name Alice`),
718
+ * dispatches them to commands, and returns formatted output.
719
+ * It is independent of Ink rendering.
720
+ */
721
+ export declare function createReplSession(opts: ReplSessionOptions): ReplSession;
722
+ //#endregion
723
+ //#region src/interactive/router.d.ts
724
+ /**
725
+ * Parse REPL input into a structured command representation.
726
+ * Pure function — no side effects.
727
+ */
728
+ interface ParsedReplInput {
729
+ type: "command" | "exit" | "empty" | "unknown" | "text";
730
+ commandId?: string;
731
+ args?: string[];
732
+ raw: string;
733
+ }
734
+ /**
735
+ * Parse a REPL input line.
736
+ *
737
+ * - Empty/whitespace → { type: 'empty' }
738
+ * - /exit or /quit → { type: 'exit' }
739
+ * - /cmd --arg val → { type: 'command', commandId: 'cmd', args: ['--arg', 'val'] }
740
+ * - Anything else → { type: 'unknown' }
741
+ */
742
+ export declare function parseReplInput(input: string, commandIds: string[], hasDefaultCommand?: boolean): ParsedReplInput;
743
+ /**
744
+ * Tokenize an argument string, respecting quoted values.
745
+ *
746
+ * Examples:
747
+ * `--name Alice` → ['--name', 'Alice']
748
+ * `--title "Hello World"` → ['--title', 'Hello World']
749
+ * `--title 'Hello World'` → ['--title', 'Hello World']
750
+ */
751
+ export declare function tokenizeArgs(argsStr: string): string[];
752
+ //#endregion
753
+ //#region src/interactive/completions.d.ts
754
+ /**
755
+ * Get auto-completion suggestions for partial REPL input.
756
+ *
757
+ * Supports:
758
+ * - Command name completion: `/gr` → ['/greet']
759
+ * - Flag name completion: `/add --` → ['--title', '--priority', '--due']
760
+ * - Flag name after trailing space: `/add ` → ['--title', '--priority', '--due']
761
+ * - Enum value completion: `/list --filter d` → ['done']
762
+ * - No completions inside quoted strings
763
+ */
764
+ export declare function getCompletions(input: string, commands: Command[]): string[];
765
+ /**
766
+ * Get the suffix to append after a flag completion.
767
+ * Returns ` "` for non-boolean, non-enum fields (opening a value quote),
768
+ * empty string otherwise.
769
+ */
770
+ export declare function getCompletionSuffix(completion: string, input: string, commands: Command[]): string;
771
+ /**
772
+ * Get the ghost suggestion for the current input — the full input string
773
+ * with the first completion applied, suitable for inline preview.
774
+ *
775
+ * Returns null if no suggestion is available.
776
+ */
777
+ export declare function getGhostSuggestion(input: string, commands: Command[]): string | null;
778
+ /**
779
+ * Apply a completion candidate to the current input by replacing the last token.
780
+ * If the input ends with a trailing space, the completion is appended.
781
+ *
782
+ * For command completions (`/gr` + `/greet` → `/greet`), replaces the only token.
783
+ * For flag completions (`/greet --na` + `--name` → `/greet --name`), replaces the last token.
784
+ * For value completions (`/list --filter d` + `done` → `/list --filter done`), replaces the last token.
785
+ * For trailing space (`/add ` + `--title` → `/add --title`), appends.
786
+ */
787
+ export declare function applyCompletion(input: string, completion: string): string;
788
+ //#endregion
789
+ //#region src/interactive/markdown.d.ts
790
+ /**
791
+ * Render a markdown string for terminal display.
792
+ * Returns ANSI-formatted text suitable for terminal output.
793
+ *
794
+ * For plain text (no markdown), the output is the same as the input
795
+ * (with a trailing newline trimmed).
796
+ */
797
+ export declare function renderMarkdown(text: string): string;
798
+ //#endregion
799
+ //#region src/integrations/powerhouse/registry.d.ts
800
+ /**
801
+ * Extract the action union from a DocumentModelModule.
802
+ *
803
+ * `DocumentModelModule.actions` is `{ [actionName]: (input) => Action }` — the
804
+ * return types of those creators form the module's action union.
805
+ *
806
+ * If a module's actions map isn't typed tightly enough (because the module
807
+ * was annotated with `: DocumentModelModule<…>` instead of `satisfies`), the
808
+ * union collapses to `Action`. Not a correctness problem — just a DX
809
+ * degradation for that one module's execute/executeAsync narrowing.
810
+ */
811
+ type ActionOf<M> = M extends {
812
+ actions: infer Actions;
813
+ } ? Actions extends Record<string, (...args: never[]) => infer A> ? A : Action$1 : Action$1;
814
+ /**
815
+ * Infer a DocumentRegistry from a readonly tuple of DocumentModelModule instances.
816
+ *
817
+ * Literal inference requires each module's `documentModel.id` to be a literal
818
+ * type. Phase 4 changes codegen to emit modules with `as const satisfies
819
+ * DocumentModelModule<…>` so inference produces a typed registry. Modules
820
+ * typed with `:` annotations erase `id` to `string` and produce a
821
+ * single-keyed `{ [x: string]: RegistryEntry<...> }` registry — narrowing
822
+ * still works when callers pass a literal `T`, but `keyof R & string`
823
+ * collapses to `string` (no autocomplete for documentTypes lists).
824
+ */
825
+ type InferRegistry<T extends ReadonlyArray<DocumentModelModule<any>>> = { [M in T[number] as Extract<M["documentModel"]["global"]["id"], string>]: M extends DocumentModelModule<infer S> ? RegistryEntry<S, ActionOf<M>> : never; };
826
+ /**
827
+ * Build a DocumentRegistry from a tuple of DocumentModelModules.
828
+ *
829
+ * ```ts
830
+ * const registry = defineRegistry([PhClintProject, DocumentDrive] as const);
831
+ * // typeof registry:
832
+ * // {
833
+ * // 'powerhouse/ph-clint-project': RegistryEntry<PhClintProjectPHState, PhClintProjectAction>;
834
+ * // 'powerhouse/document-drive': RegistryEntry<DocumentDrivePHState, DocumentDriveAction>;
835
+ * // }
836
+ * ```
837
+ *
838
+ * Runtime value is a plain object keyed by `documentModel.id`. Consumers can
839
+ * introspect it to list registered types; Phase 3's
840
+ * `createDocumentChangeTrigger` also uses it for runtime lookup.
841
+ */
842
+ export declare function defineRegistry<const T extends ReadonlyArray<DocumentModelModule<any>>>(modules: T): InferRegistry<T>;
843
+ //#endregion
844
+ //#region src/integrations/powerhouse/ports.d.ts
845
+ /**
846
+ * DJB2 hash seeded with a salt → port in range 10000–59900.
847
+ *
848
+ * Deterministic: same (cliName, salt) always produces the same port.
849
+ */
850
+ export declare function defaultPort(cliName: string, salt: string): number;
851
+ /**
852
+ * Scan [port, port+range-1] for the first free port.
853
+ * Throws with a clear error if no port in the range is available.
854
+ *
855
+ * @param port Base port to start scanning from.
856
+ * @param range Number of ports to scan (default 1).
857
+ * @param label Human-readable label for error messages.
858
+ */
859
+ export declare function resolvePort(port: number, range: number, label: string): Promise<number>;
860
+ /**
861
+ * Stamp port and name defaults onto switchboard/connect sub-configs.
862
+ *
863
+ * Called synchronously in configureReactor() — no port scanning here,
864
+ * just default derivation. The actual port scan (resolvePort) happens
865
+ * later in startSwitchboardLayer() / connect preflight.
866
+ */
867
+ export declare function resolveReactorDefaults(cliName: string, config: Pick<ReactorConfiguration, "switchboard" | "connect">): {
868
+ switchboard?: SwitchboardConfig;
869
+ connect?: ConnectConfig;
870
+ };
871
+ //#endregion
872
+ //#region src/integrations/powerhouse/identity.d.ts
873
+ /**
874
+ * Deterministic identity derivation for per-CLI namespacing.
875
+ *
876
+ * Produces stable, reproducible identifiers from (cliName, salt) pairs.
877
+ * Used for drive IDs and other resources that must be consistent across
878
+ * sessions and systems.
879
+ *
880
+ * Placeholder implementation — will be replaced with Ed25519 public key
881
+ * derivation when document authorization is added.
882
+ */
883
+ /**
884
+ * Deterministic UUID-shaped identifier from (cliName, salt).
885
+ *
886
+ * Uses SHA-256 of `${cliName}:${salt}`, truncated to 128 bits and formatted
887
+ * as a UUID v4 string (version nibble = 4, variant = 10xx). Deterministic:
888
+ * same (cliName, salt) always produces the same ID across systems.
889
+ */
890
+ export declare function deterministicId(cliName: string, salt: string): string;
891
+ //#endregion
892
+ //#region src/integrations/powerhouse/switchboard.d.ts
893
+ interface StartSwitchboardOptions {
894
+ /** The ReactorClientModule from Phase 1. */
895
+ reactorModule: ReactorClientModule;
896
+ /** Hostname/IP to bind to. Default: 'localhost'. */
897
+ host?: string;
898
+ /** HTTP port for Switchboard. */
899
+ port: number;
900
+ /** Path for the Switchboard read model database. */
901
+ dbPath: string;
902
+ /** Default drive ID (for constructing the drive URL). */
903
+ driveId: string;
904
+ /**
905
+ * Registry URL for `HttpPackageLoader`. When set, the switchboard's
906
+ * `Packages` subgraph is registered (install/uninstall mutations) and
907
+ * dynamic package resolution is enabled.
908
+ */
909
+ registryUrl?: string;
910
+ }
911
+ /**
912
+ * Start Switchboard wrapping the caller-provided Reactor.
913
+ *
914
+ * Lazy-loads `@powerhousedao/switchboard/server` — it's an optional peer
915
+ * dependency. Hands the pre-built ReactorClientModule to switchboard's
916
+ * `startSwitchboard` so we don't construct a second Reactor.
917
+ */
918
+ export declare function startSwitchboard(options: StartSwitchboardOptions): Promise<SwitchboardInstance>;
919
+ //#endregion
920
+ //#region src/integrations/powerhouse/type-guard.d.ts
921
+ /**
922
+ * Type guard for discriminated narrowing in multi-type onChange handlers.
923
+ *
924
+ * Usage:
925
+ * onChange(docs, ctx) {
926
+ * for (const doc of docs) {
927
+ * if (isDocType(doc, 'powerhouse/ph-clint-project')) {
928
+ * // doc is narrowed to R['powerhouse/ph-clint-project']['document']
929
+ * }
930
+ * }
931
+ * }
932
+ */
933
+ export declare function isDocType<R extends DocumentRegistry, T extends keyof R & string>(doc: R[keyof R & string]["document"], type: T): doc is R[T]["document"];
934
+ //#endregion
935
+ //#region src/integrations/powerhouse/index.d.ts
936
+ /**
937
+ * Options for buildDefaultReactor().
938
+ */
939
+ interface BuildDefaultReactorOptions<R extends DocumentRegistry = AnyRegistry> {
940
+ /** Document model modules to register with the Reactor. */
941
+ documentModels: DocumentModelModule[];
942
+ /** Single drive (sugar for drives: [{ ...drive, role: 'personal' }]). */
943
+ drive?: DriveConfig;
944
+ /** Multi-drive configuration. First 'personal' drive = personalDriveId = driveId. */
945
+ drives?: Array<DriveConfig & {
946
+ role: "personal" | "watched";
947
+ remoteUrl?: string;
948
+ }>;
949
+ /** Subscribe to document changes → event bus. */
950
+ subscriptions?: SubscriptionConfig<R>;
951
+ }
952
+ /**
953
+ * Build a ReactorContext using the standard composition:
954
+ * buildReactor() + ensureDrive() + bridgeSubscriptions() + startSwitchboard().
955
+ *
956
+ * This is the common-case helper for configureReactor().create.
957
+ * Advanced users can write their own factory.
958
+ */
959
+ export declare function buildDefaultReactor<R extends DocumentRegistry = AnyRegistry>(ctx: ReactorSetupContext<R>, options: BuildDefaultReactorOptions<R>): Promise<ReactorContext<R>>;
960
+ //#endregion
961
+ //#region src/core/wraps.d.ts
962
+ /**
963
+ * The identity registry — every wrap is a passthrough.
964
+ *
965
+ * `agentStream` returns `inner` directly (not a wrapping async generator) so
966
+ * the no-instrumentation path adds zero generator frames per yield. The
967
+ * other wraps reduce to immediate `inner()` calls which V8 inlines.
968
+ */
969
+ export declare const IDENTITY_WRAPS: WrapRegistry;
970
+ /**
971
+ * Fold a list of LifecycleHandle contributions into a single WrapRegistry,
972
+ * starting from IDENTITY_WRAPS.
973
+ *
974
+ * Empty input (no lifecycle hooks registered, or every hook returned no
975
+ * contributions) yields IDENTITY_WRAPS — core's call sites are unconditional.
976
+ */
977
+ export declare function composeWraps(handles: LifecycleHandle[]): WrapRegistry;
978
+ //#endregion
979
+ //#region src/core/lifecycle.d.ts
980
+ interface LifecycleResult {
981
+ /** The composed wrap registry from all hook contributions. */
982
+ wraps: WrapRegistry;
983
+ /**
984
+ * Runs each handle's shutdown() in reverse-init order. The framework
985
+ * wires this into the existing `runtime.teardown()` chain — no new
986
+ * signal listeners are registered.
987
+ */
988
+ shutdown: () => Promise<void>;
989
+ /** The individual handles, exposed for tests and debugging. */
990
+ handles: LifecycleHandle[];
991
+ }
992
+ /**
993
+ * Run each registered lifecycle hook's `onInit` in declaration order with the
994
+ * given context, then compose their contributions into a single wrap registry.
995
+ *
996
+ * Empty input → IDENTITY_WRAPS, no-op shutdown.
997
+ *
998
+ * Errors from a hook's onInit propagate — a failing plugin halts CLI startup
999
+ * (a partial-init state is worse than failure).
1000
+ */
1001
+ export declare function initLifecycle(hooks: LifecycleHook[], ctx: LifecycleInitContext): Promise<LifecycleResult>;
1002
+ //#endregion
1003
+ export { type ActionOf, type AgentContentPart, type AgentLoader, type AgentProfileConfig, type AgentPromptInput, type AgentProvider, type AgentSetupContext, type AgentStreamOptions, type AnyRegistry, type AttachmentHeader, type AttachmentRef, type AttachmentResponse, type AttachmentUploadResult, type BootTimings, type BootstrapOptions, type BootstrapResult, type BuildDefaultReactorOptions, type CaptureDefinition, type Cli, type CliMetadata, type CliOptions, type Command, type CommandContext, type ConfigEnvVar, type ConnectConfig, type CoreContext, type CreateTypesOptions, type DocumentChangeTriggerOptions, type DocumentRegistry, type DriveConfig, type DriveEntry, type EmitFn, type EndpointType, type ErrorChunk, type EventBus, type FieldInfo, type FolderEntry, type FolderOperations, type HistoryEntry, type IAttachmentService, type InferConfig, type InferRegistry, type InstallSkillsOptions, type InteractiveConfig, type LifecycleHandle, type LifecycleHook, type LifecycleInitContext, type LifecycleResult, type LogLevel, type Logger, type OnFn, PROJECT_INDICATORS, type PackageInfo, type ParsedReplInput, type PhClintEvents, type PreflightCheck, type PreflightContext, type PreflightResult, type ProcessHandle, type ProcessManager, type ProcessRunOptions, type ProjectMapping, type ProjectScanResult, type ProjectScanner, type PromptConfig, type PromptsConfig, type ProxyRoute, type ProxyServerInstance, type ProxyServerOptions, type ReactorClientModule, type ReactorConfiguration, type ReactorContext, type ReactorSetupContext, type ReadinessConfig, type ReadinessPattern, type RegistryEntry, type RenderOptions, type RenderResult, type RenderedChunk, type ReplOutput, type ReplSession, type ReplSessionOptions, type ReserveAttachmentOptions, type Resolvable, type ResolvedInteractiveConfig, type Routine, type RoutineConfig, type RoutineStatus, type RunOptions, type ServiceBuildContext, type ServiceDefinition, type ServiceInstanceStatus, type ServiceManager, type ServiceProxyRouteSpec, type ServiceStartOptions, type ServiceStatus, type SkillConfig, type SkillInfo, type SkillInvocation, type StartSwitchboardOptions, type StreamChunk, type SubscriptionConfig, type SwitchboardConfig, type TextDeltaChunk, type ToolCallChunk, type ToolOutputChunk, type ToolResultChunk, type Trigger, type TriggerContext, type TriggerOptions, type TypedDocumentChangeEvent, type TypedFactory, type TypedReactorClient, type WorkItem, type WorkdirStore, type WrapRegistry, buildServiceRoutes, buildSwitchboardRouteSpecs, buildSwitchboardRoutes, captureRoutePrefix, isWsEndpointType, readSkills, scanProjects };
1004
+ export {};
1005
+ //# sourceMappingURL=index.d.mts.map