@karmaniverous/jeeves-meta 0.9.0 → 0.10.0

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.
@@ -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,34 +739,6 @@ 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
  *
@@ -785,7 +790,7 @@ declare function buildCriticTask(ctx: MetaContext, meta: MetaJson, config: MetaC
785
790
  * @param watcher - WatcherClient for scope enumeration.
786
791
  * @returns The computed context package.
787
792
  */
788
- declare function buildContextPackage(node: MetaNode, meta: MetaJson, watcher: WatcherClient): Promise<MetaContext>;
793
+ declare function buildContextPackage(node: MetaNode, meta: MetaJson, watcher: WatcherClient, logger?: MinimalLogger): Promise<MetaContext>;
789
794
 
790
795
  /**
791
796
  * Parse subprocess outputs for each synthesis step.
@@ -884,7 +889,7 @@ interface MergeOptions {
884
889
  * @returns The updated MetaJson.
885
890
  * @throws If validation fails (malformed output).
886
891
  */
887
- declare function mergeAndWrite(options: MergeOptions): MetaJson;
892
+ declare function mergeAndWrite(options: MergeOptions): Promise<MetaJson>;
888
893
 
889
894
  /**
890
895
  * Progress reporting via OpenClaw gateway `/tools/invoke` → `message` tool.
@@ -1319,6 +1324,28 @@ interface RouteDeps {
1319
1324
  /** Register all HTTP routes on the Fastify instance. */
1320
1325
  declare function registerRoutes(app: FastifyInstance, deps: RouteDeps): void;
1321
1326
 
1327
+ /**
1328
+ * Post-registration verification of virtual rule application.
1329
+ *
1330
+ * After rules are registered with the watcher, verifies that .meta/meta.json
1331
+ * files are discoverable via watcher walk (which depends on virtual rules
1332
+ * being applied). Logs a warning if expected metas are not found.
1333
+ *
1334
+ * @module rules/verify
1335
+ */
1336
+
1337
+ /**
1338
+ * Verify that virtual rules are applied to indexed .meta/meta.json files.
1339
+ *
1340
+ * Runs a discovery pass and logs the result. If no metas are found but
1341
+ * the filesystem likely has some, logs a warning suggesting reindex.
1342
+ *
1343
+ * @param watcher - WatcherClient for discovery.
1344
+ * @param logger - Logger for reporting results.
1345
+ * @returns Number of metas discovered.
1346
+ */
1347
+ declare function verifyRuleApplication(watcher: WatcherClient, logger: MinimalLogger): Promise<number>;
1348
+
1322
1349
  /** Sleep for a given number of milliseconds. */
1323
1350
  declare function sleep(ms: number): Promise<void>;
1324
1351
 
@@ -1385,5 +1412,5 @@ declare function registerShutdownHandlers(deps: ShutdownDeps): void;
1385
1412
  */
1386
1413
  declare function startService(config: ServiceConfig, configPath?: string): Promise<void>;
1387
1414
 
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 };
1415
+ 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
1416
  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 };