@karmaniverous/jeeves-meta 0.9.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -30,7 +30,7 @@ declare function listArchiveFiles(metaPath: string): string[];
30
30
  * @param maxArchive - Maximum snapshots to retain.
31
31
  * @returns Number of files pruned.
32
32
  */
33
- declare function pruneArchive(metaPath: string, maxArchive: number): number;
33
+ declare function pruneArchive(metaPath: string, maxArchive: number): Promise<number>;
34
34
 
35
35
  /**
36
36
  * Zod schema for jeeves-meta service configuration.
@@ -53,8 +53,8 @@ declare const metaConfigSchema: z.ZodObject<{
53
53
  builderTimeout: z.ZodDefault<z.ZodNumber>;
54
54
  criticTimeout: z.ZodDefault<z.ZodNumber>;
55
55
  thinking: z.ZodDefault<z.ZodString>;
56
- defaultArchitect: z.ZodString;
57
- defaultCritic: z.ZodString;
56
+ defaultArchitect: z.ZodOptional<z.ZodString>;
57
+ defaultCritic: z.ZodOptional<z.ZodString>;
58
58
  skipUnchanged: z.ZodDefault<z.ZodBoolean>;
59
59
  metaProperty: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
60
60
  metaArchiveProperty: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -74,8 +74,8 @@ declare const serviceConfigSchema: z.ZodObject<{
74
74
  builderTimeout: z.ZodDefault<z.ZodNumber>;
75
75
  criticTimeout: z.ZodDefault<z.ZodNumber>;
76
76
  thinking: z.ZodDefault<z.ZodString>;
77
- defaultArchitect: z.ZodString;
78
- defaultCritic: z.ZodString;
77
+ defaultArchitect: z.ZodOptional<z.ZodString>;
78
+ defaultCritic: z.ZodOptional<z.ZodString>;
79
79
  skipUnchanged: z.ZodDefault<z.ZodBoolean>;
80
80
  metaProperty: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
81
81
  metaArchiveProperty: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -89,6 +89,11 @@ declare const serviceConfigSchema: z.ZodObject<{
89
89
  level: z.ZodDefault<z.ZodString>;
90
90
  file: z.ZodOptional<z.ZodString>;
91
91
  }, z.core.$strip>>;
92
+ autoSeed: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
93
+ match: z.ZodString;
94
+ steer: z.ZodOptional<z.ZodString>;
95
+ crossRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
96
+ }, z.core.$strip>>>>;
92
97
  }, z.core.$strip>;
93
98
  /** Inferred type for service configuration. */
94
99
  type ServiceConfig = z.infer<typeof serviceConfigSchema>;
@@ -123,7 +128,7 @@ type MetaError = z.infer<typeof metaErrorSchema>;
123
128
 
124
129
  /** Zod schema for the reserved (underscore-prefixed) meta.json properties. */
125
130
  declare const metaJsonSchema: z.ZodObject<{
126
- _id: z.ZodUUID;
131
+ _id: z.ZodOptional<z.ZodUUID>;
127
132
  _steer: z.ZodOptional<z.ZodString>;
128
133
  _crossRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
129
134
  _architect: z.ZodOptional<z.ZodString>;
@@ -170,7 +175,7 @@ type MetaJson = z.infer<typeof metaJsonSchema>;
170
175
  * @param metaPath - Absolute path to the .meta directory.
171
176
  * @returns The latest archived meta, or null if no archives exist.
172
177
  */
173
- declare function readLatestArchive(metaPath: string): MetaJson | null;
178
+ declare function readLatestArchive(metaPath: string): Promise<MetaJson | null>;
174
179
 
175
180
  /**
176
181
  * Create archive snapshots of meta.json.
@@ -188,7 +193,7 @@ declare function readLatestArchive(metaPath: string): MetaJson | null;
188
193
  * @param meta - Current meta.json content.
189
194
  * @returns The archive file path.
190
195
  */
191
- declare function createSnapshot(metaPath: string, meta: MetaJson): string;
196
+ declare function createSnapshot(metaPath: string, meta: MetaJson): Promise<string>;
192
197
 
193
198
  /**
194
199
  * Shared constants for the jeeves-meta service package.
@@ -356,26 +361,6 @@ interface WatcherClient {
356
361
  walk(globs: string[]): Promise<string[]>;
357
362
  }
358
363
 
359
- /**
360
- * Discover .meta/ directories via watcher `/walk` endpoint.
361
- *
362
- * Uses filesystem enumeration through the watcher (not Qdrant) to find
363
- * all `.meta/meta.json` files and returns deduplicated meta directory paths.
364
- *
365
- * @module discovery/discoverMetas
366
- */
367
-
368
- /**
369
- * Discover all .meta/ directories via watcher walk.
370
- *
371
- * Uses the watcher's `/walk` endpoint to find all `.meta/meta.json` files
372
- * and returns deduplicated meta directory paths.
373
- *
374
- * @param watcher - WatcherClient for walk queries.
375
- * @returns Array of normalized .meta/ directory paths.
376
- */
377
- declare function discoverMetas(watcher: WatcherClient): Promise<string[]>;
378
-
379
364
  /**
380
365
  * Types for meta discovery and ownership tree.
381
366
  *
@@ -476,6 +461,26 @@ interface MetaListResult {
476
461
  */
477
462
  declare function listMetas(config: MetaConfig, watcher: WatcherClient): Promise<MetaListResult>;
478
463
 
464
+ /**
465
+ * Discover .meta/ directories via watcher `/walk` endpoint.
466
+ *
467
+ * Uses filesystem enumeration through the watcher (not Qdrant) to find
468
+ * all `.meta/meta.json` files and returns deduplicated meta directory paths.
469
+ *
470
+ * @module discovery/discoverMetas
471
+ */
472
+
473
+ /**
474
+ * Discover all .meta/ directories via watcher walk.
475
+ *
476
+ * Uses the watcher's `/walk` endpoint to find all `.meta/meta.json` files
477
+ * and returns deduplicated meta directory paths.
478
+ *
479
+ * @param watcher - WatcherClient for walk queries.
480
+ * @returns Array of normalized .meta/ directory paths.
481
+ */
482
+ declare function discoverMetas(watcher: WatcherClient): Promise<string[]>;
483
+
479
484
  /**
480
485
  * Build the ownership tree from discovered .meta/ paths.
481
486
  *
@@ -502,6 +507,34 @@ declare function buildOwnershipTree(metaPaths: string[]): OwnershipTree;
502
507
  */
503
508
  declare function findNode(tree: OwnershipTree, targetPath: string): MetaNode | undefined;
504
509
 
510
+ /**
511
+ * Pino logger factory.
512
+ *
513
+ * @module logger
514
+ */
515
+
516
+ /** Minimal logger interface accepted by library functions. */
517
+ interface MinimalLogger {
518
+ debug: (obj: Record<string, unknown>, msg: string) => void;
519
+ info: (obj: Record<string, unknown>, msg: string) => void;
520
+ warn: (obj: Record<string, unknown>, msg: string) => void;
521
+ error: (obj: Record<string, unknown>, msg: string) => void;
522
+ }
523
+ /** Logger configuration options. */
524
+ interface LoggerConfig {
525
+ /** Log level (default: 'info'). */
526
+ level?: string;
527
+ /** Optional file path to write logs to. */
528
+ file?: string;
529
+ }
530
+ /**
531
+ * Create a pino logger instance.
532
+ *
533
+ * @param config - Optional logger configuration.
534
+ * @returns Configured pino logger.
535
+ */
536
+ declare function createLogger(config?: LoggerConfig): pino.Logger;
537
+
505
538
  /**
506
539
  * Compute the file scope owned by a meta node.
507
540
  *
@@ -706,37 +739,13 @@ declare class GatewayExecutor implements MetaExecutor {
706
739
  spawn(task: string, options?: MetaSpawnOptions): Promise<MetaSpawnResult>;
707
740
  }
708
741
 
709
- /**
710
- * Pino logger factory.
711
- *
712
- * @module logger
713
- */
714
-
715
- /** Minimal logger interface accepted by library functions. */
716
- interface MinimalLogger {
717
- debug: (obj: Record<string, unknown>, msg: string) => void;
718
- info: (obj: Record<string, unknown>, msg: string) => void;
719
- warn: (obj: Record<string, unknown>, msg: string) => void;
720
- error: (obj: Record<string, unknown>, msg: string) => void;
721
- }
722
- /** Logger configuration options. */
723
- interface LoggerConfig {
724
- /** Log level (default: 'info'). */
725
- level?: string;
726
- /** Optional file path to write logs to. */
727
- file?: string;
728
- }
729
- /**
730
- * Create a pino logger instance.
731
- *
732
- * @param config - Optional logger configuration.
733
- * @returns Configured pino logger.
734
- */
735
- declare function createLogger(config?: LoggerConfig): pino.Logger;
736
-
737
742
  /**
738
743
  * Build task prompts for each synthesis step.
739
744
  *
745
+ * Prompts are compiled as Handlebars templates with access to config,
746
+ * meta, and scope context. The architect can write template expressions
747
+ * into its _builder output; these resolve when the builder task is compiled.
748
+ *
740
749
  * @module orchestrator/buildTask
741
750
  */
742
751
 
@@ -785,7 +794,7 @@ declare function buildCriticTask(ctx: MetaContext, meta: MetaJson, config: MetaC
785
794
  * @param watcher - WatcherClient for scope enumeration.
786
795
  * @returns The computed context package.
787
796
  */
788
- declare function buildContextPackage(node: MetaNode, meta: MetaJson, watcher: WatcherClient): Promise<MetaContext>;
797
+ declare function buildContextPackage(node: MetaNode, meta: MetaJson, watcher: WatcherClient, logger?: MinimalLogger): Promise<MetaContext>;
789
798
 
790
799
  /**
791
800
  * Parse subprocess outputs for each synthesis step.
@@ -884,7 +893,7 @@ interface MergeOptions {
884
893
  * @returns The updated MetaJson.
885
894
  * @throws If validation fails (malformed output).
886
895
  */
887
- declare function mergeAndWrite(options: MergeOptions): MetaJson;
896
+ declare function mergeAndWrite(options: MergeOptions): Promise<MetaJson>;
888
897
 
889
898
  /**
890
899
  * Progress reporting via OpenClaw gateway `/tools/invoke` → `message` tool.
@@ -1319,6 +1328,28 @@ interface RouteDeps {
1319
1328
  /** Register all HTTP routes on the Fastify instance. */
1320
1329
  declare function registerRoutes(app: FastifyInstance, deps: RouteDeps): void;
1321
1330
 
1331
+ /**
1332
+ * Post-registration verification of virtual rule application.
1333
+ *
1334
+ * After rules are registered with the watcher, verifies that .meta/meta.json
1335
+ * files are discoverable via watcher walk (which depends on virtual rules
1336
+ * being applied). Logs a warning if expected metas are not found.
1337
+ *
1338
+ * @module rules/verify
1339
+ */
1340
+
1341
+ /**
1342
+ * Verify that virtual rules are applied to indexed .meta/meta.json files.
1343
+ *
1344
+ * Runs a discovery pass and logs the result. If no metas are found but
1345
+ * the filesystem likely has some, logs a warning suggesting reindex.
1346
+ *
1347
+ * @param watcher - WatcherClient for discovery.
1348
+ * @param logger - Logger for reporting results.
1349
+ * @returns Number of metas discovered.
1350
+ */
1351
+ declare function verifyRuleApplication(watcher: WatcherClient, logger: MinimalLogger): Promise<number>;
1352
+
1322
1353
  /** Sleep for a given number of milliseconds. */
1323
1354
  declare function sleep(ms: number): Promise<void>;
1324
1355
 
@@ -1385,5 +1416,5 @@ declare function registerShutdownHandlers(deps: ShutdownDeps): void;
1385
1416
  */
1386
1417
  declare function startService(config: ServiceConfig, configPath?: string): Promise<void>;
1387
1418
 
1388
- export { DEFAULT_PORT, DEFAULT_PORT_STR, GatewayExecutor, HttpWatcherClient, ProgressReporter, RuleRegistrar, SERVICE_NAME, SERVICE_VERSION, Scheduler, SynthesisQueue, acquireLock, actualStaleness, buildArchitectTask, buildBuilderTask, buildContextPackage, buildCriticTask, buildOwnershipTree, cleanupStaleLocks, computeEffectiveStaleness, computeEma, computeStructureHash, createLogger, createServer, createSnapshot, discoverMetas, filterInScope, findNode, formatProgressEvent, getScopePrefix, hasSteerChanged, isArchitectTriggered, isLocked, isStale, listArchiveFiles, listMetas, loadServiceConfig, mergeAndWrite, metaConfigSchema, metaErrorSchema, metaJsonSchema, normalizePath, orchestrate, parseArchitectOutput, parseBuilderOutput, parseCriticOutput, pruneArchive, readLatestArchive, readLockState, registerRoutes, registerShutdownHandlers, releaseLock, resolveConfigPath, resolveMetaDir, selectCandidate, serviceConfigSchema, sleep, startService, toMetaError };
1419
+ export { DEFAULT_PORT, DEFAULT_PORT_STR, GatewayExecutor, HttpWatcherClient, ProgressReporter, RuleRegistrar, SERVICE_NAME, SERVICE_VERSION, Scheduler, SynthesisQueue, acquireLock, actualStaleness, buildArchitectTask, buildBuilderTask, buildContextPackage, buildCriticTask, buildOwnershipTree, cleanupStaleLocks, computeEffectiveStaleness, computeEma, computeStructureHash, createLogger, createServer, createSnapshot, discoverMetas, filterInScope, findNode, formatProgressEvent, getScopePrefix, hasSteerChanged, isArchitectTriggered, isLocked, isStale, listArchiveFiles, listMetas, loadServiceConfig, mergeAndWrite, metaConfigSchema, metaErrorSchema, metaJsonSchema, normalizePath, orchestrate, parseArchitectOutput, parseBuilderOutput, parseCriticOutput, pruneArchive, readLatestArchive, readLockState, registerRoutes, registerShutdownHandlers, releaseLock, resolveConfigPath, resolveMetaDir, selectCandidate, serviceConfigSchema, sleep, startService, toMetaError, verifyRuleApplication };
1389
1420
  export type { BuilderOutput, EnqueueResult, GatewayExecutorOptions, HttpWatcherClientOptions, InferenceRuleSpec, LockState, LoggerConfig, MergeOptions, MetaConfig, MetaContext, MetaEntry, MetaError, MetaExecutor, MetaJson, MetaListResult, MetaListSummary, MetaNode, MetaSpawnOptions, MetaSpawnResult, MinimalLogger, OrchestrateResult, OwnershipTree, ProgressCallback, ProgressEvent, ProgressPhase, ProgressReporterConfig, QueueItem, QueueState, RouteDeps, ServerOptions, ServiceConfig, ServiceStats, StalenessCandidate, WatcherClient };