@karmaniverous/jeeves-meta 0.1.0 → 0.2.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/README.md +31 -26
- package/dist/cli.js +2013 -0
- package/dist/index.d.ts +108 -4
- package/dist/index.js +367 -162
- package/package.json +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ declare function pruneArchive(metaPath: string, maxArchive: number): number;
|
|
|
41
41
|
declare const synthConfigSchema: z.ZodObject<{
|
|
42
42
|
watchPaths: z.ZodArray<z.ZodString>;
|
|
43
43
|
watcherUrl: z.ZodURL;
|
|
44
|
+
gatewayUrl: z.ZodDefault<z.ZodURL>;
|
|
45
|
+
gatewayApiKey: z.ZodOptional<z.ZodString>;
|
|
44
46
|
architectEvery: z.ZodDefault<z.ZodNumber>;
|
|
45
47
|
depthWeight: z.ZodDefault<z.ZodNumber>;
|
|
46
48
|
maxArchive: z.ZodDefault<z.ZodNumber>;
|
|
@@ -151,6 +153,28 @@ declare function readLatestArchive(metaPath: string): MetaJson | null;
|
|
|
151
153
|
*/
|
|
152
154
|
declare function createSnapshot(metaPath: string, meta: MetaJson): string;
|
|
153
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Load and resolve jeeves-meta config with \@file: indirection.
|
|
158
|
+
*
|
|
159
|
+
* @module configLoader
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Load synth config from a JSON file, resolving \@file: references.
|
|
164
|
+
*
|
|
165
|
+
* @param configPath - Path to jeeves-meta.config.json.
|
|
166
|
+
* @returns Validated SynthConfig with resolved prompt strings.
|
|
167
|
+
*/
|
|
168
|
+
declare function loadSynthConfig(configPath: string): SynthConfig;
|
|
169
|
+
/**
|
|
170
|
+
* Resolve config path from --config flag or JEEVES_META_CONFIG env var.
|
|
171
|
+
*
|
|
172
|
+
* @param args - CLI arguments (process.argv.slice(2)).
|
|
173
|
+
* @returns Resolved config path.
|
|
174
|
+
* @throws If no config path found.
|
|
175
|
+
*/
|
|
176
|
+
declare function resolveConfigPath(args: string[]): string;
|
|
177
|
+
|
|
154
178
|
/**
|
|
155
179
|
* Ensure meta.json exists in each .meta/ directory.
|
|
156
180
|
*
|
|
@@ -226,6 +250,14 @@ interface OwnershipTree {
|
|
|
226
250
|
* @returns The ownership tree with parent/child relationships.
|
|
227
251
|
*/
|
|
228
252
|
declare function buildOwnershipTree(metaPaths: string[]): OwnershipTree;
|
|
253
|
+
/**
|
|
254
|
+
* Find a node in the ownership tree by meta path or owner path.
|
|
255
|
+
*
|
|
256
|
+
* @param tree - The ownership tree to search.
|
|
257
|
+
* @param targetPath - Path to search for (meta path or owner path).
|
|
258
|
+
* @returns The matching node, or undefined if not found.
|
|
259
|
+
*/
|
|
260
|
+
declare function findNode(tree: OwnershipTree, targetPath: string): MetaNode | undefined;
|
|
229
261
|
|
|
230
262
|
/**
|
|
231
263
|
* Compute the file scope owned by a meta node.
|
|
@@ -372,8 +404,10 @@ interface ScanFile {
|
|
|
372
404
|
}
|
|
373
405
|
/** Parameters for a scan request. */
|
|
374
406
|
interface ScanParams {
|
|
375
|
-
/**
|
|
376
|
-
pathPrefix
|
|
407
|
+
/** File path prefix to match. Required unless filter is provided. */
|
|
408
|
+
pathPrefix?: string;
|
|
409
|
+
/** Qdrant filter object for structural queries. */
|
|
410
|
+
filter?: Record<string, unknown>;
|
|
377
411
|
/** Filter files modified after this Unix timestamp (seconds). */
|
|
378
412
|
modifiedAfter?: number;
|
|
379
413
|
/** Which payload fields to return (default: all). */
|
|
@@ -646,6 +680,40 @@ declare function createSynthEngine(config: SynthConfig, executor: SynthExecutor,
|
|
|
646
680
|
*/
|
|
647
681
|
declare function toSynthError(step: SynthError['step'], err: unknown, code?: string): SynthError;
|
|
648
682
|
|
|
683
|
+
/**
|
|
684
|
+
* SynthExecutor implementation using the OpenClaw gateway HTTP API.
|
|
685
|
+
*
|
|
686
|
+
* Lives in the library package so both plugin and runner can import it.
|
|
687
|
+
* Spawns sub-agent sessions via the gateway, polls for completion,
|
|
688
|
+
* and extracts output text.
|
|
689
|
+
*
|
|
690
|
+
* @module executor/GatewayExecutor
|
|
691
|
+
*/
|
|
692
|
+
|
|
693
|
+
/** Options for the GatewayExecutor. */
|
|
694
|
+
interface GatewayExecutorOptions {
|
|
695
|
+
/** OpenClaw gateway base URL. Default: http://127.0.0.1:3000 */
|
|
696
|
+
gatewayUrl?: string;
|
|
697
|
+
/** API key for gateway authentication. */
|
|
698
|
+
apiKey?: string;
|
|
699
|
+
/** Polling interval in ms. Default: 5000. */
|
|
700
|
+
pollIntervalMs?: number;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* SynthExecutor that spawns OpenClaw sessions via the gateway HTTP API.
|
|
704
|
+
*
|
|
705
|
+
* Used by both the OpenClaw plugin (in-process tool calls) and the
|
|
706
|
+
* runner/CLI (external invocation). Constructs from `gatewayUrl` and
|
|
707
|
+
* optional `apiKey` — typically sourced from `SynthConfig`.
|
|
708
|
+
*/
|
|
709
|
+
declare class GatewayExecutor implements SynthExecutor {
|
|
710
|
+
private readonly gatewayUrl;
|
|
711
|
+
private readonly apiKey;
|
|
712
|
+
private readonly pollIntervalMs;
|
|
713
|
+
constructor(options?: GatewayExecutorOptions);
|
|
714
|
+
spawn(task: string, options?: SynthSpawnOptions): Promise<SynthSpawnResult>;
|
|
715
|
+
}
|
|
716
|
+
|
|
649
717
|
/**
|
|
650
718
|
* File-system lock for preventing concurrent synthesis on the same meta.
|
|
651
719
|
*
|
|
@@ -675,6 +743,23 @@ declare function releaseLock(metaPath: string): void;
|
|
|
675
743
|
*/
|
|
676
744
|
declare function isLocked(metaPath: string): boolean;
|
|
677
745
|
|
|
746
|
+
/**
|
|
747
|
+
* Normalize file paths to forward slashes for consistency with watcher-indexed paths.
|
|
748
|
+
*
|
|
749
|
+
* Watcher indexes paths with forward slashes (`j:/domains/...`). This utility
|
|
750
|
+
* ensures all paths in the library use the same convention, regardless of
|
|
751
|
+
* the platform's native separator.
|
|
752
|
+
*
|
|
753
|
+
* @module normalizePath
|
|
754
|
+
*/
|
|
755
|
+
/**
|
|
756
|
+
* Normalize a file path to forward slashes.
|
|
757
|
+
*
|
|
758
|
+
* @param p - File path (may contain backslashes).
|
|
759
|
+
* @returns Path with all backslashes replaced by forward slashes.
|
|
760
|
+
*/
|
|
761
|
+
declare function normalizePath(p: string): string;
|
|
762
|
+
|
|
678
763
|
/**
|
|
679
764
|
* Paginated scan helper for exhaustive scope enumeration.
|
|
680
765
|
*
|
|
@@ -768,6 +853,25 @@ declare function isStale(scopePrefix: string, meta: MetaJson, watcher: WatcherCl
|
|
|
768
853
|
* @returns Staleness in seconds, or Infinity if never synthesized.
|
|
769
854
|
*/
|
|
770
855
|
declare function actualStaleness(meta: MetaJson): number;
|
|
856
|
+
/**
|
|
857
|
+
* Check whether the architect step should be triggered.
|
|
858
|
+
*
|
|
859
|
+
* @param meta - Current meta.json.
|
|
860
|
+
* @param structureChanged - Whether the structure hash changed.
|
|
861
|
+
* @param steerChanged - Whether the steer directive changed.
|
|
862
|
+
* @param architectEvery - Config: run architect every N cycles.
|
|
863
|
+
* @returns True if the architect step should run.
|
|
864
|
+
*/
|
|
865
|
+
declare function isArchitectTriggered(meta: MetaJson, structureChanged: boolean, steerChanged: boolean, architectEvery: number): boolean;
|
|
866
|
+
/**
|
|
867
|
+
* Detect whether the steer directive changed since the last archive.
|
|
868
|
+
*
|
|
869
|
+
* @param currentSteer - Current _steer value (or undefined).
|
|
870
|
+
* @param archiveSteer - Archive _steer value (or undefined).
|
|
871
|
+
* @param hasArchive - Whether an archive snapshot exists.
|
|
872
|
+
* @returns True if steer changed.
|
|
873
|
+
*/
|
|
874
|
+
declare function hasSteerChanged(currentSteer: string | undefined, archiveSteer: string | undefined, hasArchive: boolean): boolean;
|
|
771
875
|
|
|
772
876
|
/**
|
|
773
877
|
* Compute a structure hash from a sorted file listing.
|
|
@@ -821,5 +925,5 @@ declare class HttpWatcherClient implements WatcherClient {
|
|
|
821
925
|
unregisterRules(source: string): Promise<void>;
|
|
822
926
|
}
|
|
823
927
|
|
|
824
|
-
export { HttpWatcherClient, acquireLock, actualStaleness, buildArchitectTask, buildBuilderTask, buildContextPackage, buildCriticTask, buildOwnershipTree, computeEffectiveStaleness, computeEma, computeStructureHash, createSnapshot, createSynthEngine, ensureMetaJson, filterInScope, getScopeExclusions, getScopePrefix, globMetas, isLocked, isStale, listArchiveFiles, mergeAndWrite, metaJsonSchema, orchestrate, paginatedScan, parseArchitectOutput, parseBuilderOutput, parseCriticOutput, pruneArchive, readLatestArchive, releaseLock, selectCandidate, synthConfigSchema, synthErrorSchema, toSynthError };
|
|
825
|
-
export type { BuilderOutput, HttpWatcherClientOptions, InferenceRuleSpec, MergeOptions, MetaJson, MetaNode, OrchestrateResult, OwnershipTree, ScanFile, ScanParams, ScanResponse, StalenessCandidate, SynthConfig, SynthContext, SynthEngine, SynthError, SynthExecutor, SynthSpawnOptions, SynthSpawnResult, WatcherClient };
|
|
928
|
+
export { GatewayExecutor, HttpWatcherClient, acquireLock, actualStaleness, buildArchitectTask, buildBuilderTask, buildContextPackage, buildCriticTask, buildOwnershipTree, computeEffectiveStaleness, computeEma, computeStructureHash, createSnapshot, createSynthEngine, ensureMetaJson, filterInScope, findNode, getScopeExclusions, getScopePrefix, globMetas, hasSteerChanged, isArchitectTriggered, isLocked, isStale, listArchiveFiles, loadSynthConfig, mergeAndWrite, metaJsonSchema, normalizePath, orchestrate, paginatedScan, parseArchitectOutput, parseBuilderOutput, parseCriticOutput, pruneArchive, readLatestArchive, releaseLock, resolveConfigPath, selectCandidate, synthConfigSchema, synthErrorSchema, toSynthError };
|
|
929
|
+
export type { BuilderOutput, GatewayExecutorOptions, HttpWatcherClientOptions, InferenceRuleSpec, MergeOptions, MetaJson, MetaNode, OrchestrateResult, OwnershipTree, ScanFile, ScanParams, ScanResponse, StalenessCandidate, SynthConfig, SynthContext, SynthEngine, SynthError, SynthExecutor, SynthSpawnOptions, SynthSpawnResult, WatcherClient };
|