@karmaniverous/jeeves-meta 0.15.4 → 0.15.5
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/archive/index.d.ts +10 -0
- package/dist/archive/listArchive.d.ts +12 -0
- package/dist/archive/prune.d.ts +14 -0
- package/dist/archive/readArchive.d.ts +30 -0
- package/dist/archive/readLatest.d.ts +13 -0
- package/dist/archive/snapshot.d.ts +17 -0
- package/dist/bootstrap.d.ts +15 -0
- package/dist/cache.d.ts +22 -0
- package/dist/cli/jeeves-meta/index.js +199 -95
- package/dist/cli.d.ts +10 -0
- package/dist/configHotReload.d.ts +30 -0
- package/dist/configLoader.d.ts +37 -0
- package/dist/constants.d.ts +13 -0
- package/dist/customCliCommands.d.ts +13 -0
- package/dist/descriptor.d.ts +19 -0
- package/dist/discovery/buildMinimalNode.d.ts +22 -0
- package/dist/discovery/computeSummary.d.ts +17 -0
- package/dist/discovery/discoverMetas.d.ts +19 -0
- package/dist/discovery/index.d.ts +11 -0
- package/dist/discovery/listMetas.d.ts +63 -0
- package/dist/discovery/ownershipTree.d.ts +25 -0
- package/dist/discovery/scope.d.ts +47 -0
- package/dist/discovery/types.d.ts +25 -0
- package/dist/ema.d.ts +14 -0
- package/dist/errors.d.ts +15 -0
- package/dist/escapeGlob.d.ts +23 -0
- package/dist/executor/GatewayExecutor.d.ts +48 -0
- package/dist/executor/SpawnAbortedError.d.ts +9 -0
- package/dist/executor/SpawnTimeoutError.d.ts +13 -0
- package/dist/executor/index.d.ts +8 -0
- package/dist/index.d.ts +34 -1580
- package/dist/index.js +182 -109
- package/dist/interfaces/MetaContext.d.ts +36 -0
- package/dist/interfaces/MetaExecutor.d.ts +46 -0
- package/dist/interfaces/WatcherClient.d.ts +75 -0
- package/dist/interfaces/index.d.ts +8 -0
- package/dist/lock.d.ts +70 -0
- package/dist/logger/index.d.ts +27 -0
- package/dist/mtimeFilter.d.ts +26 -0
- package/dist/normalizePath.d.ts +6 -0
- package/dist/orchestrator/buildTask.d.ts +38 -0
- package/dist/orchestrator/contextPackage.d.ts +30 -0
- package/dist/orchestrator/index.d.ts +10 -0
- package/dist/orchestrator/orchestratePhase.d.ts +38 -0
- package/dist/orchestrator/parseOutput.d.ts +41 -0
- package/dist/orchestrator/runPhase.d.ts +40 -0
- package/dist/phaseState/derivePhaseState.d.ts +41 -0
- package/dist/phaseState/index.d.ts +9 -0
- package/dist/phaseState/invalidate.d.ts +41 -0
- package/dist/phaseState/phaseScheduler.d.ts +57 -0
- package/dist/phaseState/phaseTransitions.d.ts +83 -0
- package/dist/progress/index.d.ts +38 -0
- package/dist/prompts/index.d.ts +15 -0
- package/dist/queue/index.d.ts +131 -0
- package/dist/readMetaJson.d.ts +17 -0
- package/dist/routes/__testUtils.d.ts +37 -0
- package/dist/routes/config.d.ts +11 -0
- package/dist/routes/configApply.d.ts +13 -0
- package/dist/routes/index.d.ts +50 -0
- package/dist/routes/metas.d.ts +9 -0
- package/dist/routes/metasUpdate.d.ts +11 -0
- package/dist/routes/preview.d.ts +8 -0
- package/dist/routes/queue.d.ts +13 -0
- package/dist/routes/seed.d.ts +8 -0
- package/dist/routes/status.d.ts +13 -0
- package/dist/routes/synthesize.d.ts +12 -0
- package/dist/routes/unlock.d.ts +8 -0
- package/dist/rules/healthCheck.d.ts +36 -0
- package/dist/rules/index.d.ts +39 -0
- package/dist/rules/verify.d.ts +22 -0
- package/dist/scheduler/index.d.ts +66 -0
- package/dist/scheduling/index.d.ts +7 -0
- package/dist/scheduling/staleness.d.ts +68 -0
- package/dist/scheduling/weightedFormula.d.ts +38 -0
- package/dist/schema/config.d.ts +54 -0
- package/dist/schema/error.d.ts +6 -0
- package/dist/schema/index.d.ts +8 -0
- package/dist/schema/meta.d.ts +71 -0
- package/dist/seed/autoSeed.d.ts +30 -0
- package/dist/seed/createMeta.d.ts +38 -0
- package/dist/seed/index.d.ts +7 -0
- package/dist/server.d.ts +24 -0
- package/dist/shutdown/index.d.ts +33 -0
- package/dist/structureHash.d.ts +15 -0
- package/dist/watcher-client/HttpWatcherClient.d.ts +38 -0
- package/dist/watcher-client/index.d.ts +6 -0
- package/package.json +16 -26
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Archive module — snapshot creation, pruning, and reading.
|
|
3
|
+
*
|
|
4
|
+
* @module archive
|
|
5
|
+
*/
|
|
6
|
+
export { listArchiveFiles } from './listArchive.js';
|
|
7
|
+
export { pruneArchive } from './prune.js';
|
|
8
|
+
export { readArchiveFromDisk, readArchiveFromWatcher } from './readArchive.js';
|
|
9
|
+
export { readLatestArchive } from './readLatest.js';
|
|
10
|
+
export { createSnapshot } from './snapshot.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List archive snapshot files in chronological order.
|
|
3
|
+
*
|
|
4
|
+
* @module archive/listArchive
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* List archive .json files sorted chronologically (oldest first).
|
|
8
|
+
*
|
|
9
|
+
* @param metaPath - Absolute path to the .meta directory.
|
|
10
|
+
* @returns Array of absolute paths to archive files, or empty if none.
|
|
11
|
+
*/
|
|
12
|
+
export declare function listArchiveFiles(metaPath: string): string[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prune old archive snapshots beyond maxArchive.
|
|
3
|
+
*
|
|
4
|
+
* @module archive/prune
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Prune archive directory to keep at most maxArchive snapshots.
|
|
8
|
+
* Removes the oldest files.
|
|
9
|
+
*
|
|
10
|
+
* @param metaPath - Absolute path to the .meta directory.
|
|
11
|
+
* @param maxArchive - Maximum snapshots to retain.
|
|
12
|
+
* @returns Number of files pruned.
|
|
13
|
+
*/
|
|
14
|
+
export declare function pruneArchive(metaPath: string, maxArchive: number): Promise<number>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Archive reading helpers — watcher scan with filesystem fallback.
|
|
3
|
+
*
|
|
4
|
+
* Used by the GET /metas/:path route to retrieve archive history.
|
|
5
|
+
* Prefers watcher scan for performance; falls back to disk reads
|
|
6
|
+
* when the watcher is unavailable.
|
|
7
|
+
*
|
|
8
|
+
* @module archive/readArchive
|
|
9
|
+
*/
|
|
10
|
+
import type { WatcherClient } from '../interfaces/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* Read archive history via watcher scan.
|
|
13
|
+
*
|
|
14
|
+
* @param watcher - WatcherClient with scan support.
|
|
15
|
+
* @param metaPath - Absolute path to the .meta/ directory.
|
|
16
|
+
* @param metaArchiveProperty - Additional filter properties for archive points.
|
|
17
|
+
* @param limit - Max entries to return (newest first). Undefined = all.
|
|
18
|
+
* @param projectMeta - Field projection function.
|
|
19
|
+
* @returns Array of projected archive entries, newest first.
|
|
20
|
+
*/
|
|
21
|
+
export declare function readArchiveFromWatcher(watcher: WatcherClient, metaPath: string, metaArchiveProperty: Record<string, unknown>, limit: number | undefined, projectMeta: (m: Record<string, unknown>) => Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
|
|
22
|
+
/**
|
|
23
|
+
* Read archive history from disk (fallback).
|
|
24
|
+
*
|
|
25
|
+
* @param metaPath - Absolute path to the .meta/ directory.
|
|
26
|
+
* @param limit - Max entries to return (newest first). Undefined = all.
|
|
27
|
+
* @param projectMeta - Field projection function.
|
|
28
|
+
* @returns Array of projected archive entries, newest first.
|
|
29
|
+
*/
|
|
30
|
+
export declare function readArchiveFromDisk(metaPath: string, limit: number | undefined, projectMeta: (m: Record<string, unknown>) => Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read the latest archive snapshot for steer change detection.
|
|
3
|
+
*
|
|
4
|
+
* @module archive/readLatest
|
|
5
|
+
*/
|
|
6
|
+
import type { MetaJson } from '../schema/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Read the most recent archive snapshot.
|
|
9
|
+
*
|
|
10
|
+
* @param metaPath - Absolute path to the .meta directory.
|
|
11
|
+
* @returns The latest archived meta, or null if no archives exist.
|
|
12
|
+
*/
|
|
13
|
+
export declare function readLatestArchive(metaPath: string): Promise<MetaJson | null>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create archive snapshots of meta.json.
|
|
3
|
+
*
|
|
4
|
+
* Copies current meta.json to archive/\{ISO-timestamp\}.json with
|
|
5
|
+
* _archived: true and _archivedAt added.
|
|
6
|
+
*
|
|
7
|
+
* @module archive/snapshot
|
|
8
|
+
*/
|
|
9
|
+
import type { MetaJson } from '../schema/index.js';
|
|
10
|
+
/**
|
|
11
|
+
* Create an archive snapshot of the current meta.json.
|
|
12
|
+
*
|
|
13
|
+
* @param metaPath - Absolute path to the .meta directory.
|
|
14
|
+
* @param meta - Current meta.json content.
|
|
15
|
+
* @returns The archive file path.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createSnapshot(metaPath: string, meta: MetaJson): Promise<string>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service bootstrap — wire up all components and start listening.
|
|
3
|
+
*
|
|
4
|
+
* @module bootstrap
|
|
5
|
+
*/
|
|
6
|
+
import { type ServiceConfig } from './schema/config.js';
|
|
7
|
+
/**
|
|
8
|
+
* Bootstrap the service: create logger, build server, start listening,
|
|
9
|
+
* wire scheduler, queue processing, rule registration, config hot-reload,
|
|
10
|
+
* startup lock cleanup, and shutdown.
|
|
11
|
+
*
|
|
12
|
+
* @param config - Validated service configuration.
|
|
13
|
+
* @param configPath - Optional path to config file for hot-reload.
|
|
14
|
+
*/
|
|
15
|
+
export declare function startService(config: ServiceConfig, configPath?: string): Promise<void>;
|
package/dist/cache.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-memory cache for listMetas results with TTL and concurrent refresh guard.
|
|
3
|
+
*
|
|
4
|
+
* @module cache
|
|
5
|
+
*/
|
|
6
|
+
import { type MetaListResult } from './discovery/index.js';
|
|
7
|
+
import type { WatcherClient } from './interfaces/index.js';
|
|
8
|
+
import type { ServiceConfig } from './schema/config.js';
|
|
9
|
+
/**
|
|
10
|
+
* Caches listMetas results to avoid expensive repeated filesystem walks.
|
|
11
|
+
* Supports concurrent refresh coalescing and manual invalidation.
|
|
12
|
+
*/
|
|
13
|
+
export declare class MetaCache {
|
|
14
|
+
private result;
|
|
15
|
+
private updatedAt;
|
|
16
|
+
private refreshPromise;
|
|
17
|
+
/** Get cached result or refresh if stale. */
|
|
18
|
+
get(config: ServiceConfig, watcher: WatcherClient): Promise<MetaListResult>;
|
|
19
|
+
/** Force-expire the cache so next get() triggers a refresh. */
|
|
20
|
+
invalidate(): void;
|
|
21
|
+
private refresh;
|
|
22
|
+
}
|
|
@@ -1181,11 +1181,11 @@ var hasRequiredRetry$1;
|
|
|
1181
1181
|
function requireRetry$1 () {
|
|
1182
1182
|
if (hasRequiredRetry$1) return retry$1;
|
|
1183
1183
|
hasRequiredRetry$1 = 1;
|
|
1184
|
-
(function (exports
|
|
1184
|
+
(function (exports) {
|
|
1185
1185
|
var RetryOperation = requireRetry_operation();
|
|
1186
1186
|
|
|
1187
|
-
exports
|
|
1188
|
-
var timeouts = exports
|
|
1187
|
+
exports.operation = function(options) {
|
|
1188
|
+
var timeouts = exports.timeouts(options);
|
|
1189
1189
|
return new RetryOperation(timeouts, {
|
|
1190
1190
|
forever: options && options.forever,
|
|
1191
1191
|
unref: options && options.unref,
|
|
@@ -1193,7 +1193,7 @@ function requireRetry$1 () {
|
|
|
1193
1193
|
});
|
|
1194
1194
|
};
|
|
1195
1195
|
|
|
1196
|
-
exports
|
|
1196
|
+
exports.timeouts = function(options) {
|
|
1197
1197
|
if (options instanceof Array) {
|
|
1198
1198
|
return [].concat(options);
|
|
1199
1199
|
}
|
|
@@ -1230,7 +1230,7 @@ function requireRetry$1 () {
|
|
|
1230
1230
|
return timeouts;
|
|
1231
1231
|
};
|
|
1232
1232
|
|
|
1233
|
-
exports
|
|
1233
|
+
exports.createTimeout = function(attempt, opts) {
|
|
1234
1234
|
var random = (opts.randomize)
|
|
1235
1235
|
? (Math.random() + 1)
|
|
1236
1236
|
: 1;
|
|
@@ -1241,7 +1241,7 @@ function requireRetry$1 () {
|
|
|
1241
1241
|
return timeout;
|
|
1242
1242
|
};
|
|
1243
1243
|
|
|
1244
|
-
exports
|
|
1244
|
+
exports.wrap = function(obj, options, methods) {
|
|
1245
1245
|
if (options instanceof Array) {
|
|
1246
1246
|
methods = options;
|
|
1247
1247
|
options = null;
|
|
@@ -1261,7 +1261,7 @@ function requireRetry$1 () {
|
|
|
1261
1261
|
var original = obj[method];
|
|
1262
1262
|
|
|
1263
1263
|
obj[method] = function retryWrapper(original) {
|
|
1264
|
-
var op = exports
|
|
1264
|
+
var op = exports.operation(options);
|
|
1265
1265
|
var args = Array.prototype.slice.call(arguments, 1);
|
|
1266
1266
|
var callback = args.pop();
|
|
1267
1267
|
|
|
@@ -4270,7 +4270,7 @@ var hasRequiredRe;
|
|
|
4270
4270
|
function requireRe () {
|
|
4271
4271
|
if (hasRequiredRe) return re.exports;
|
|
4272
4272
|
hasRequiredRe = 1;
|
|
4273
|
-
(function (module, exports
|
|
4273
|
+
(function (module, exports) {
|
|
4274
4274
|
|
|
4275
4275
|
const {
|
|
4276
4276
|
MAX_SAFE_COMPONENT_LENGTH,
|
|
@@ -4278,14 +4278,14 @@ function requireRe () {
|
|
|
4278
4278
|
MAX_LENGTH,
|
|
4279
4279
|
} = requireConstants();
|
|
4280
4280
|
const debug = requireDebug();
|
|
4281
|
-
exports
|
|
4281
|
+
exports = module.exports = {};
|
|
4282
4282
|
|
|
4283
4283
|
// The actual regexps go on exports.re
|
|
4284
|
-
const re = exports
|
|
4285
|
-
const safeRe = exports
|
|
4286
|
-
const src = exports
|
|
4287
|
-
const safeSrc = exports
|
|
4288
|
-
const t = exports
|
|
4284
|
+
const re = exports.re = [];
|
|
4285
|
+
const safeRe = exports.safeRe = [];
|
|
4286
|
+
const src = exports.src = [];
|
|
4287
|
+
const safeSrc = exports.safeSrc = [];
|
|
4288
|
+
const t = exports.t = {};
|
|
4289
4289
|
let R = 0;
|
|
4290
4290
|
|
|
4291
4291
|
const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
|
|
@@ -4408,7 +4408,7 @@ function requireRe () {
|
|
|
4408
4408
|
createToken('GTLT', '((?:<|>)?=?)');
|
|
4409
4409
|
|
|
4410
4410
|
// Something like "2.*" or "1.2.x".
|
|
4411
|
-
// Note that "x.x" is a valid xRange
|
|
4411
|
+
// Note that "x.x" is a valid xRange identifier, meaning "any version"
|
|
4412
4412
|
// Only the first item is strictly required.
|
|
4413
4413
|
createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
4414
4414
|
createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
@@ -4449,7 +4449,7 @@ function requireRe () {
|
|
|
4449
4449
|
createToken('LONETILDE', '(?:~>?)');
|
|
4450
4450
|
|
|
4451
4451
|
createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
4452
|
-
exports
|
|
4452
|
+
exports.tildeTrimReplace = '$1~';
|
|
4453
4453
|
|
|
4454
4454
|
createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
4455
4455
|
createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
@@ -4459,7 +4459,7 @@ function requireRe () {
|
|
|
4459
4459
|
createToken('LONECARET', '(?:\\^)');
|
|
4460
4460
|
|
|
4461
4461
|
createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
4462
|
-
exports
|
|
4462
|
+
exports.caretTrimReplace = '$1^';
|
|
4463
4463
|
|
|
4464
4464
|
createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
4465
4465
|
createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
@@ -4472,7 +4472,7 @@ function requireRe () {
|
|
|
4472
4472
|
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
|
4473
4473
|
createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
|
|
4474
4474
|
}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
4475
|
-
exports
|
|
4475
|
+
exports.comparatorTrimReplace = '$1$2$3';
|
|
4476
4476
|
|
|
4477
4477
|
// Something like `1.2.3 - 1.2.4`
|
|
4478
4478
|
// Note that these all use the loose form, because they'll be
|
|
@@ -5404,6 +5404,62 @@ function requireCoerce () {
|
|
|
5404
5404
|
return coerce_1;
|
|
5405
5405
|
}
|
|
5406
5406
|
|
|
5407
|
+
var truncate_1;
|
|
5408
|
+
var hasRequiredTruncate;
|
|
5409
|
+
|
|
5410
|
+
function requireTruncate () {
|
|
5411
|
+
if (hasRequiredTruncate) return truncate_1;
|
|
5412
|
+
hasRequiredTruncate = 1;
|
|
5413
|
+
|
|
5414
|
+
const parse = requireParse();
|
|
5415
|
+
const constants = requireConstants();
|
|
5416
|
+
const SemVer = requireSemver$1();
|
|
5417
|
+
|
|
5418
|
+
const truncate = (version, truncation, options) => {
|
|
5419
|
+
if (!constants.RELEASE_TYPES.includes(truncation)) {
|
|
5420
|
+
return null
|
|
5421
|
+
}
|
|
5422
|
+
|
|
5423
|
+
const clonedVersion = cloneInputVersion(version, options);
|
|
5424
|
+
return clonedVersion && doTruncation(clonedVersion, truncation)
|
|
5425
|
+
};
|
|
5426
|
+
|
|
5427
|
+
const cloneInputVersion = (version, options) => {
|
|
5428
|
+
const versionStringToParse = (
|
|
5429
|
+
version instanceof SemVer ? version.version : version
|
|
5430
|
+
);
|
|
5431
|
+
|
|
5432
|
+
return parse(versionStringToParse, options)
|
|
5433
|
+
};
|
|
5434
|
+
|
|
5435
|
+
const doTruncation = (version, truncation) => {
|
|
5436
|
+
if (isPrerelease(truncation)) {
|
|
5437
|
+
return version.version
|
|
5438
|
+
}
|
|
5439
|
+
|
|
5440
|
+
version.prerelease = [];
|
|
5441
|
+
|
|
5442
|
+
switch (truncation) {
|
|
5443
|
+
case 'major':
|
|
5444
|
+
version.minor = 0;
|
|
5445
|
+
version.patch = 0;
|
|
5446
|
+
break
|
|
5447
|
+
case 'minor':
|
|
5448
|
+
version.patch = 0;
|
|
5449
|
+
break
|
|
5450
|
+
}
|
|
5451
|
+
|
|
5452
|
+
return version.format()
|
|
5453
|
+
};
|
|
5454
|
+
|
|
5455
|
+
const isPrerelease = (type) => {
|
|
5456
|
+
return type.startsWith('pre')
|
|
5457
|
+
};
|
|
5458
|
+
|
|
5459
|
+
truncate_1 = truncate;
|
|
5460
|
+
return truncate_1;
|
|
5461
|
+
}
|
|
5462
|
+
|
|
5407
5463
|
var lrucache;
|
|
5408
5464
|
var hasRequiredLrucache;
|
|
5409
5465
|
|
|
@@ -6853,6 +6909,7 @@ function requireSemver () {
|
|
|
6853
6909
|
const lte = requireLte();
|
|
6854
6910
|
const cmp = requireCmp();
|
|
6855
6911
|
const coerce = requireCoerce();
|
|
6912
|
+
const truncate = requireTruncate();
|
|
6856
6913
|
const Comparator = requireComparator();
|
|
6857
6914
|
const Range = requireRange();
|
|
6858
6915
|
const satisfies = requireSatisfies();
|
|
@@ -6891,6 +6948,7 @@ function requireSemver () {
|
|
|
6891
6948
|
lte,
|
|
6892
6949
|
cmp,
|
|
6893
6950
|
coerce,
|
|
6951
|
+
truncate,
|
|
6894
6952
|
Comparator,
|
|
6895
6953
|
Range,
|
|
6896
6954
|
satisfies,
|
|
@@ -7335,31 +7393,31 @@ var hasRequiredExtraTypings;
|
|
|
7335
7393
|
function requireExtraTypings () {
|
|
7336
7394
|
if (hasRequiredExtraTypings) return extraTypings.exports;
|
|
7337
7395
|
hasRequiredExtraTypings = 1;
|
|
7338
|
-
(function (module, exports
|
|
7396
|
+
(function (module, exports) {
|
|
7339
7397
|
const commander = require$$0;
|
|
7340
7398
|
|
|
7341
|
-
exports
|
|
7399
|
+
exports = module.exports = {};
|
|
7342
7400
|
|
|
7343
7401
|
// Return a different global program than commander,
|
|
7344
7402
|
// and don't also return it as default export.
|
|
7345
|
-
exports
|
|
7403
|
+
exports.program = new commander.Command();
|
|
7346
7404
|
|
|
7347
7405
|
/**
|
|
7348
7406
|
* Expose classes. The FooT versions are just types, so return Commander original implementations!
|
|
7349
7407
|
*/
|
|
7350
7408
|
|
|
7351
|
-
exports
|
|
7352
|
-
exports
|
|
7353
|
-
exports
|
|
7354
|
-
exports
|
|
7355
|
-
exports
|
|
7356
|
-
exports
|
|
7357
|
-
exports
|
|
7409
|
+
exports.Argument = commander.Argument;
|
|
7410
|
+
exports.Command = commander.Command;
|
|
7411
|
+
exports.CommanderError = commander.CommanderError;
|
|
7412
|
+
exports.Help = commander.Help;
|
|
7413
|
+
exports.InvalidArgumentError = commander.InvalidArgumentError;
|
|
7414
|
+
exports.InvalidOptionArgumentError = commander.InvalidArgumentError; // Deprecated
|
|
7415
|
+
exports.Option = commander.Option;
|
|
7358
7416
|
|
|
7359
|
-
exports
|
|
7360
|
-
exports
|
|
7417
|
+
exports.createCommand = (name) => new commander.Command(name);
|
|
7418
|
+
exports.createOption = (flags, description) =>
|
|
7361
7419
|
new commander.Option(flags, description);
|
|
7362
|
-
exports
|
|
7420
|
+
exports.createArgument = (name, description) =>
|
|
7363
7421
|
new commander.Argument(name, description);
|
|
7364
7422
|
} (extraTypings, extraTypings.exports));
|
|
7365
7423
|
return extraTypings.exports;
|
|
@@ -8418,6 +8476,106 @@ function sleepAsync(ms) {
|
|
|
8418
8476
|
return new Promise((r) => setTimeout(r, ms));
|
|
8419
8477
|
}
|
|
8420
8478
|
|
|
8479
|
+
/**
|
|
8480
|
+
* Shared component descriptor constants for jeeves-meta.
|
|
8481
|
+
*
|
|
8482
|
+
* Single source of truth consumed by both the service descriptor and
|
|
8483
|
+
* the OpenClaw plugin registration.
|
|
8484
|
+
*/
|
|
8485
|
+
/** Shared jeeves-meta component descriptor constants. */
|
|
8486
|
+
const META_COMPONENT = {
|
|
8487
|
+
name: 'meta',
|
|
8488
|
+
servicePackage: '@karmaniverous/jeeves-meta',
|
|
8489
|
+
pluginPackage: '@karmaniverous/jeeves-meta-openclaw',
|
|
8490
|
+
defaultPort: 1938};
|
|
8491
|
+
|
|
8492
|
+
/**
|
|
8493
|
+
* Structured error schema from a synthesis step failure.
|
|
8494
|
+
*
|
|
8495
|
+
*/
|
|
8496
|
+
/** Zod schema for synthesis step errors. */
|
|
8497
|
+
z.object({
|
|
8498
|
+
/** Which step failed: 'architect', 'builder', or 'critic'. */
|
|
8499
|
+
step: z.enum(['architect', 'builder', 'critic']),
|
|
8500
|
+
/** Error classification code. */
|
|
8501
|
+
code: z.string(),
|
|
8502
|
+
/** Human-readable error message. */
|
|
8503
|
+
message: z.string(),
|
|
8504
|
+
});
|
|
8505
|
+
|
|
8506
|
+
/** Zod schema for the core (library-compatible) meta configuration. */
|
|
8507
|
+
/** Zod schema for the core (library-compatible) meta configuration. */
|
|
8508
|
+
const metaConfigSchema = z.object({
|
|
8509
|
+
/** Watcher service base URL. */
|
|
8510
|
+
watcherUrl: z.url(),
|
|
8511
|
+
/** OpenClaw gateway base URL for subprocess spawning. */
|
|
8512
|
+
gatewayUrl: z.url().default('http://127.0.0.1:18789'),
|
|
8513
|
+
/** Optional API key for gateway authentication. */
|
|
8514
|
+
gatewayApiKey: z.string().optional(),
|
|
8515
|
+
/** Run architect every N cycles (per meta). */
|
|
8516
|
+
architectEvery: z.number().int().min(1).default(10),
|
|
8517
|
+
/** Exponent for depth weighting in staleness formula. */
|
|
8518
|
+
depthWeight: z.number().min(0).default(0.5),
|
|
8519
|
+
/** Maximum archive snapshots to retain per meta. */
|
|
8520
|
+
maxArchive: z.number().int().min(1).default(20),
|
|
8521
|
+
/** Maximum lines of context to include in subprocess prompts. */
|
|
8522
|
+
maxLines: z.number().int().min(50).default(500),
|
|
8523
|
+
/** Architect subprocess timeout in seconds. */
|
|
8524
|
+
architectTimeout: z.number().int().min(30).default(180),
|
|
8525
|
+
/** Builder subprocess timeout in seconds. */
|
|
8526
|
+
builderTimeout: z.number().int().min(60).default(360),
|
|
8527
|
+
/** Critic subprocess timeout in seconds. */
|
|
8528
|
+
criticTimeout: z.number().int().min(30).default(240),
|
|
8529
|
+
/** Thinking level for spawned synthesis sessions. */
|
|
8530
|
+
thinking: z.string().default('low'),
|
|
8531
|
+
/** Resolved architect system prompt text. Falls back to built-in default. */
|
|
8532
|
+
defaultArchitect: z.string().optional(),
|
|
8533
|
+
/** Resolved critic system prompt text. Falls back to built-in default. */
|
|
8534
|
+
defaultCritic: z.string().optional(),
|
|
8535
|
+
/** Skip unchanged candidates, bump _generatedAt. */
|
|
8536
|
+
skipUnchanged: z.boolean().default(true),
|
|
8537
|
+
/** Watcher metadata properties applied to live .meta/meta.json files. */
|
|
8538
|
+
metaProperty: z.record(z.string(), z.unknown()).default({ _meta: 'current' }),
|
|
8539
|
+
/** Watcher metadata properties applied to archive snapshots. */
|
|
8540
|
+
metaArchiveProperty: z
|
|
8541
|
+
.record(z.string(), z.unknown())
|
|
8542
|
+
.default({ _meta: 'archive' }),
|
|
8543
|
+
});
|
|
8544
|
+
|
|
8545
|
+
/**
|
|
8546
|
+
* Normalize file paths to forward slashes for consistency with watcher-indexed paths.
|
|
8547
|
+
*
|
|
8548
|
+
* Watcher indexes paths with forward slashes (`j:/domains/...`). This utility
|
|
8549
|
+
* ensures all paths in the library use the same convention, regardless of
|
|
8550
|
+
* the platform's native separator.
|
|
8551
|
+
*
|
|
8552
|
+
*/
|
|
8553
|
+
/**
|
|
8554
|
+
* Normalize a file path to forward slashes.
|
|
8555
|
+
*
|
|
8556
|
+
* @param p - File path (may contain backslashes).
|
|
8557
|
+
* @returns Path with all backslashes replaced by forward slashes.
|
|
8558
|
+
*/
|
|
8559
|
+
function normalizePath(p) {
|
|
8560
|
+
return p.replaceAll('\\', '/');
|
|
8561
|
+
}
|
|
8562
|
+
/** Valid states for a synthesis phase. */
|
|
8563
|
+
const phaseStatuses = [
|
|
8564
|
+
'fresh',
|
|
8565
|
+
'stale',
|
|
8566
|
+
'pending',
|
|
8567
|
+
'running',
|
|
8568
|
+
'failed',
|
|
8569
|
+
];
|
|
8570
|
+
/** Zod schema for a per-phase status value. */
|
|
8571
|
+
const phaseStatusSchema = z.enum(phaseStatuses);
|
|
8572
|
+
/** Zod schema for the per-meta phase state record. */
|
|
8573
|
+
z.object({
|
|
8574
|
+
architect: phaseStatusSchema,
|
|
8575
|
+
builder: phaseStatusSchema,
|
|
8576
|
+
critic: phaseStatusSchema,
|
|
8577
|
+
});
|
|
8578
|
+
|
|
8421
8579
|
/**
|
|
8422
8580
|
* Compute summary statistics from an array of MetaEntry objects.
|
|
8423
8581
|
*
|
|
@@ -8491,25 +8649,6 @@ function computeSummary(entries, depthWeight) {
|
|
|
8491
8649
|
};
|
|
8492
8650
|
}
|
|
8493
8651
|
|
|
8494
|
-
/**
|
|
8495
|
-
* Normalize file paths to forward slashes for consistency with watcher-indexed paths.
|
|
8496
|
-
*
|
|
8497
|
-
* Watcher indexes paths with forward slashes (`j:/domains/...`). This utility
|
|
8498
|
-
* ensures all paths in the library use the same convention, regardless of
|
|
8499
|
-
* the platform's native separator.
|
|
8500
|
-
*
|
|
8501
|
-
* @module normalizePath
|
|
8502
|
-
*/
|
|
8503
|
-
/**
|
|
8504
|
-
* Normalize a file path to forward slashes.
|
|
8505
|
-
*
|
|
8506
|
-
* @param p - File path (may contain backslashes).
|
|
8507
|
-
* @returns Path with all backslashes replaced by forward slashes.
|
|
8508
|
-
*/
|
|
8509
|
-
function normalizePath(p) {
|
|
8510
|
-
return p.replaceAll('\\', '/');
|
|
8511
|
-
}
|
|
8512
|
-
|
|
8513
8652
|
/**
|
|
8514
8653
|
* Discover .meta/ directories via watcher `/walk` endpoint.
|
|
8515
8654
|
*
|
|
@@ -9185,43 +9324,6 @@ function applyHotReloadedConfig(newConfig) {
|
|
|
9185
9324
|
*
|
|
9186
9325
|
* @module schema/config
|
|
9187
9326
|
*/
|
|
9188
|
-
/** Zod schema for the core (library-compatible) meta configuration. */
|
|
9189
|
-
const metaConfigSchema = z.object({
|
|
9190
|
-
/** Watcher service base URL. */
|
|
9191
|
-
watcherUrl: z.url(),
|
|
9192
|
-
/** OpenClaw gateway base URL for subprocess spawning. */
|
|
9193
|
-
gatewayUrl: z.url().default('http://127.0.0.1:18789'),
|
|
9194
|
-
/** Optional API key for gateway authentication. */
|
|
9195
|
-
gatewayApiKey: z.string().optional(),
|
|
9196
|
-
/** Run architect every N cycles (per meta). */
|
|
9197
|
-
architectEvery: z.number().int().min(1).default(10),
|
|
9198
|
-
/** Exponent for depth weighting in staleness formula. */
|
|
9199
|
-
depthWeight: z.number().min(0).default(0.5),
|
|
9200
|
-
/** Maximum archive snapshots to retain per meta. */
|
|
9201
|
-
maxArchive: z.number().int().min(1).default(20),
|
|
9202
|
-
/** Maximum lines of context to include in subprocess prompts. */
|
|
9203
|
-
maxLines: z.number().int().min(50).default(500),
|
|
9204
|
-
/** Architect subprocess timeout in seconds. */
|
|
9205
|
-
architectTimeout: z.number().int().min(30).default(180),
|
|
9206
|
-
/** Builder subprocess timeout in seconds. */
|
|
9207
|
-
builderTimeout: z.number().int().min(60).default(360),
|
|
9208
|
-
/** Critic subprocess timeout in seconds. */
|
|
9209
|
-
criticTimeout: z.number().int().min(30).default(240),
|
|
9210
|
-
/** Thinking level for spawned synthesis sessions. */
|
|
9211
|
-
thinking: z.string().default('low'),
|
|
9212
|
-
/** Resolved architect system prompt text. Falls back to built-in default. */
|
|
9213
|
-
defaultArchitect: z.string().optional(),
|
|
9214
|
-
/** Resolved critic system prompt text. Falls back to built-in default. */
|
|
9215
|
-
defaultCritic: z.string().optional(),
|
|
9216
|
-
/** Skip unchanged candidates, bump _generatedAt. */
|
|
9217
|
-
skipUnchanged: z.boolean().default(true),
|
|
9218
|
-
/** Watcher metadata properties applied to live .meta/meta.json files. */
|
|
9219
|
-
metaProperty: z.record(z.string(), z.unknown()).default({ _meta: 'current' }),
|
|
9220
|
-
/** Watcher metadata properties applied to archive snapshots. */
|
|
9221
|
-
metaArchiveProperty: z
|
|
9222
|
-
.record(z.string(), z.unknown())
|
|
9223
|
-
.default({ _meta: 'archive' }),
|
|
9224
|
-
});
|
|
9225
9327
|
/** Zod schema for logging configuration. */
|
|
9226
9328
|
const loggingSchema = z.object({
|
|
9227
9329
|
/** Log level. */
|
|
@@ -9493,8 +9595,10 @@ class GatewayExecutor {
|
|
|
9493
9595
|
...(options?.thinking ? { thinking: options.thinking } : {}),
|
|
9494
9596
|
...(options?.model ? { model: options.model } : {}),
|
|
9495
9597
|
});
|
|
9496
|
-
const details = (spawnResult.result?.details ??
|
|
9497
|
-
|
|
9598
|
+
const details = (spawnResult.result?.details ??
|
|
9599
|
+
spawnResult.result ??
|
|
9600
|
+
{});
|
|
9601
|
+
const sessionKey = details.childSessionKey ?? details.sessionKey;
|
|
9498
9602
|
if (typeof sessionKey !== 'string' || !sessionKey) {
|
|
9499
9603
|
throw new Error('Gateway sessions_spawn returned no sessionKey: ' +
|
|
9500
9604
|
JSON.stringify(spawnResult));
|
|
@@ -12476,7 +12580,7 @@ function registerMetasUpdateRoute(app, deps) {
|
|
|
12476
12580
|
const metaDir = resolveMetaDir(targetPath);
|
|
12477
12581
|
let meta;
|
|
12478
12582
|
try {
|
|
12479
|
-
meta =
|
|
12583
|
+
meta = await readMetaJson(metaDir);
|
|
12480
12584
|
}
|
|
12481
12585
|
catch {
|
|
12482
12586
|
return reply.status(404).send({
|
|
@@ -12812,7 +12916,7 @@ function registerSeedRoute(app, deps) {
|
|
|
12812
12916
|
* @module constants
|
|
12813
12917
|
*/
|
|
12814
12918
|
/** Default HTTP port for the jeeves-meta service. */
|
|
12815
|
-
const DEFAULT_PORT =
|
|
12919
|
+
const DEFAULT_PORT = META_COMPONENT.defaultPort;
|
|
12816
12920
|
/** Default port as a string (for Commander CLI defaults). */
|
|
12817
12921
|
const DEFAULT_PORT_STR = String(DEFAULT_PORT);
|
|
12818
12922
|
/** Service name identifier. */
|
|
@@ -13654,11 +13758,11 @@ function registerCustomCliCommands(program) {
|
|
|
13654
13758
|
* Parsed jeeves-meta component descriptor.
|
|
13655
13759
|
*/
|
|
13656
13760
|
const metaDescriptor = jeevesComponentDescriptorSchema.parse({
|
|
13657
|
-
name:
|
|
13761
|
+
name: META_COMPONENT.name,
|
|
13658
13762
|
version: SERVICE_VERSION,
|
|
13659
|
-
servicePackage:
|
|
13660
|
-
pluginPackage:
|
|
13661
|
-
defaultPort:
|
|
13763
|
+
servicePackage: META_COMPONENT.servicePackage,
|
|
13764
|
+
pluginPackage: META_COMPONENT.pluginPackage,
|
|
13765
|
+
defaultPort: META_COMPONENT.defaultPort,
|
|
13662
13766
|
// The runtime Zod custom validator only checks for a .parse() method.
|
|
13663
13767
|
// Use unknown cast to bridge the Zod v4 (service) → v3 (core SDK) type gap.
|
|
13664
13768
|
configSchema: serviceConfigSchema,
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commander CLI for jeeves-meta service.
|
|
3
|
+
*
|
|
4
|
+
* Uses `createServiceCli` from the core SDK for standard commands
|
|
5
|
+
* (start, status, config, init, service). Custom domain-specific
|
|
6
|
+
* commands are registered via `descriptor.customCliCommands`.
|
|
7
|
+
*
|
|
8
|
+
* @module cli
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared live config hot-reload support.
|
|
3
|
+
*
|
|
4
|
+
* Used by both file-watch reloads in bootstrap and POST /config/apply
|
|
5
|
+
* via the component descriptor's onConfigApply callback.
|
|
6
|
+
*
|
|
7
|
+
* @module configHotReload
|
|
8
|
+
*/
|
|
9
|
+
import type { Logger } from 'pino';
|
|
10
|
+
import type { Scheduler } from './scheduler/index.js';
|
|
11
|
+
import type { ServiceConfig } from './schema/config.js';
|
|
12
|
+
/**
|
|
13
|
+
* Fields that require a service restart to take effect.
|
|
14
|
+
*
|
|
15
|
+
* Shared between the descriptor's `onConfigApply` and the file-watcher
|
|
16
|
+
* hot-reload in `bootstrap.ts`.
|
|
17
|
+
*/
|
|
18
|
+
export declare const RESTART_REQUIRED_FIELDS: readonly ["port", "watcherUrl", "gatewayUrl", "gatewayApiKey", "defaultArchitect", "defaultCritic"];
|
|
19
|
+
interface ConfigHotReloadRuntime {
|
|
20
|
+
config: ServiceConfig;
|
|
21
|
+
logger: Logger;
|
|
22
|
+
scheduler: Scheduler | null;
|
|
23
|
+
}
|
|
24
|
+
/** Register the active service runtime for config-apply hot reload. */
|
|
25
|
+
export declare function registerConfigHotReloadRuntime(nextRuntime: ConfigHotReloadRuntime): void;
|
|
26
|
+
/** Clear the registered runtime. Primarily for tests. */
|
|
27
|
+
export declare function clearConfigHotReloadRuntime(): void;
|
|
28
|
+
/** Apply hot-reloadable config changes to the live shared config object. */
|
|
29
|
+
export declare function applyHotReloadedConfig(newConfig: ServiceConfig): void;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load and resolve jeeves-meta service config.
|
|
3
|
+
*
|
|
4
|
+
* Supports \@file: indirection and environment-variable substitution (dollar-brace pattern).
|
|
5
|
+
*
|
|
6
|
+
* @module configLoader
|
|
7
|
+
*/
|
|
8
|
+
import { type ServiceConfig } from './schema/config.js';
|
|
9
|
+
/**
|
|
10
|
+
* Migrate legacy config path to the new canonical location.
|
|
11
|
+
*
|
|
12
|
+
* If the old path `{configRoot}/jeeves-meta.config.json` exists and the new
|
|
13
|
+
* path `{configRoot}/jeeves-meta/config.json` does NOT exist, copies the file
|
|
14
|
+
* to the new location and logs a warning.
|
|
15
|
+
*
|
|
16
|
+
* @param configRoot - Root directory for configuration files.
|
|
17
|
+
* @param warn - Optional callback for logging the migration warning.
|
|
18
|
+
*/
|
|
19
|
+
export declare function migrateConfigPath(configRoot: string, warn?: (msg: string) => void): void;
|
|
20
|
+
/**
|
|
21
|
+
* Resolve config path from --config flag or JEEVES_META_CONFIG env var.
|
|
22
|
+
*
|
|
23
|
+
* @param args - CLI arguments (process.argv.slice(2)).
|
|
24
|
+
* @returns Resolved config path.
|
|
25
|
+
* @throws If no config path found.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveConfigPath(args: string[]): string;
|
|
28
|
+
/**
|
|
29
|
+
* Load service config from a JSON file.
|
|
30
|
+
*
|
|
31
|
+
* Resolves \@file: references for defaultArchitect and defaultCritic,
|
|
32
|
+
* and substitutes environment-variable placeholders throughout.
|
|
33
|
+
*
|
|
34
|
+
* @param configPath - Path to config JSON file.
|
|
35
|
+
* @returns Validated ServiceConfig.
|
|
36
|
+
*/
|
|
37
|
+
export declare function loadServiceConfig(configPath: string): ServiceConfig;
|