@karmaniverous/jeeves-meta 0.8.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,8 +128,9 @@ 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>;
133
+ _crossRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
128
134
  _architect: z.ZodOptional<z.ZodString>;
129
135
  _builder: z.ZodOptional<z.ZodString>;
130
136
  _critic: z.ZodOptional<z.ZodString>;
@@ -169,7 +175,7 @@ type MetaJson = z.infer<typeof metaJsonSchema>;
169
175
  * @param metaPath - Absolute path to the .meta directory.
170
176
  * @returns The latest archived meta, or null if no archives exist.
171
177
  */
172
- declare function readLatestArchive(metaPath: string): MetaJson | null;
178
+ declare function readLatestArchive(metaPath: string): Promise<MetaJson | null>;
173
179
 
174
180
  /**
175
181
  * Create archive snapshots of meta.json.
@@ -187,7 +193,7 @@ declare function readLatestArchive(metaPath: string): MetaJson | null;
187
193
  * @param meta - Current meta.json content.
188
194
  * @returns The archive file path.
189
195
  */
190
- declare function createSnapshot(metaPath: string, meta: MetaJson): string;
196
+ declare function createSnapshot(metaPath: string, meta: MetaJson): Promise<string>;
191
197
 
192
198
  /**
193
199
  * Shared constants for the jeeves-meta service package.
@@ -253,6 +259,8 @@ interface MetaContext {
253
259
  deltaFiles: string[];
254
260
  /** Child _content outputs, keyed by relative path. */
255
261
  childMetas: Record<string, unknown>;
262
+ /** Cross-referenced meta _content outputs, keyed by owner path. */
263
+ crossRefMetas: Record<string, unknown>;
256
264
  /** _content from the last cycle, or null on first run. */
257
265
  previousContent: string | null;
258
266
  /** _feedback from the last cycle, or null on first run. */
@@ -353,26 +361,6 @@ interface WatcherClient {
353
361
  walk(globs: string[]): Promise<string[]>;
354
362
  }
355
363
 
356
- /**
357
- * Discover .meta/ directories via watcher `/walk` endpoint.
358
- *
359
- * Uses filesystem enumeration through the watcher (not Qdrant) to find
360
- * all `.meta/meta.json` files and returns deduplicated meta directory paths.
361
- *
362
- * @module discovery/discoverMetas
363
- */
364
-
365
- /**
366
- * Discover all .meta/ directories via watcher walk.
367
- *
368
- * Uses the watcher's `/walk` endpoint to find all `.meta/meta.json` files
369
- * and returns deduplicated meta directory paths.
370
- *
371
- * @param watcher - WatcherClient for walk queries.
372
- * @returns Array of normalized .meta/ directory paths.
373
- */
374
- declare function discoverMetas(watcher: WatcherClient): Promise<string[]>;
375
-
376
364
  /**
377
365
  * Types for meta discovery and ownership tree.
378
366
  *
@@ -473,6 +461,26 @@ interface MetaListResult {
473
461
  */
474
462
  declare function listMetas(config: MetaConfig, watcher: WatcherClient): Promise<MetaListResult>;
475
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
+
476
484
  /**
477
485
  * Build the ownership tree from discovered .meta/ paths.
478
486
  *
@@ -499,6 +507,34 @@ declare function buildOwnershipTree(metaPaths: string[]): OwnershipTree;
499
507
  */
500
508
  declare function findNode(tree: OwnershipTree, targetPath: string): MetaNode | undefined;
501
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
+
502
538
  /**
503
539
  * Compute the file scope owned by a meta node.
504
540
  *
@@ -703,34 +739,6 @@ declare class GatewayExecutor implements MetaExecutor {
703
739
  spawn(task: string, options?: MetaSpawnOptions): Promise<MetaSpawnResult>;
704
740
  }
705
741
 
706
- /**
707
- * Pino logger factory.
708
- *
709
- * @module logger
710
- */
711
-
712
- /** Minimal logger interface accepted by library functions. */
713
- interface MinimalLogger {
714
- debug: (obj: Record<string, unknown>, msg: string) => void;
715
- info: (obj: Record<string, unknown>, msg: string) => void;
716
- warn: (obj: Record<string, unknown>, msg: string) => void;
717
- error: (obj: Record<string, unknown>, msg: string) => void;
718
- }
719
- /** Logger configuration options. */
720
- interface LoggerConfig {
721
- /** Log level (default: 'info'). */
722
- level?: string;
723
- /** Optional file path to write logs to. */
724
- file?: string;
725
- }
726
- /**
727
- * Create a pino logger instance.
728
- *
729
- * @param config - Optional logger configuration.
730
- * @returns Configured pino logger.
731
- */
732
- declare function createLogger(config?: LoggerConfig): pino.Logger;
733
-
734
742
  /**
735
743
  * Build task prompts for each synthesis step.
736
744
  *
@@ -782,7 +790,7 @@ declare function buildCriticTask(ctx: MetaContext, meta: MetaJson, config: MetaC
782
790
  * @param watcher - WatcherClient for scope enumeration.
783
791
  * @returns The computed context package.
784
792
  */
785
- 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>;
786
794
 
787
795
  /**
788
796
  * Parse subprocess outputs for each synthesis step.
@@ -881,7 +889,7 @@ interface MergeOptions {
881
889
  * @returns The updated MetaJson.
882
890
  * @throws If validation fails (malformed output).
883
891
  */
884
- declare function mergeAndWrite(options: MergeOptions): MetaJson;
892
+ declare function mergeAndWrite(options: MergeOptions): Promise<MetaJson>;
885
893
 
886
894
  /**
887
895
  * Progress reporting via OpenClaw gateway `/tools/invoke` → `message` tool.
@@ -1316,6 +1324,28 @@ interface RouteDeps {
1316
1324
  /** Register all HTTP routes on the Fastify instance. */
1317
1325
  declare function registerRoutes(app: FastifyInstance, deps: RouteDeps): void;
1318
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
+
1319
1349
  /** Sleep for a given number of milliseconds. */
1320
1350
  declare function sleep(ms: number): Promise<void>;
1321
1351
 
@@ -1382,5 +1412,5 @@ declare function registerShutdownHandlers(deps: ShutdownDeps): void;
1382
1412
  */
1383
1413
  declare function startService(config: ServiceConfig, configPath?: string): Promise<void>;
1384
1414
 
1385
- 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 };
1386
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 };