@karmaniverous/jeeves-meta 0.17.0 → 0.18.0-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/README.md +1 -2
- package/dist/cli/jeeves-meta/index.js +1235 -1198
- package/dist/prompts/architect.md +31 -59
- package/dist/prompts/critic.md +18 -33
- package/package.json +18 -22
- package/dist/archive/index.d.ts +0 -10
- package/dist/archive/listArchive.d.ts +0 -12
- package/dist/archive/prune.d.ts +0 -14
- package/dist/archive/readArchive.d.ts +0 -30
- package/dist/archive/readLatest.d.ts +0 -13
- package/dist/archive/snapshot.d.ts +0 -17
- package/dist/bootstrap.d.ts +0 -26
- package/dist/cache.d.ts +0 -22
- package/dist/cli/jeeves-meta/architect.md +0 -173
- package/dist/cli/jeeves-meta/critic.md +0 -104
- package/dist/cli.d.ts +0 -10
- package/dist/configHotReload.d.ts +0 -30
- package/dist/configLoader.d.ts +0 -36
- package/dist/constants.d.ts +0 -13
- package/dist/customCliCommands.d.ts +0 -13
- package/dist/descriptor.d.ts +0 -19
- package/dist/discovery/buildMinimalNode.d.ts +0 -22
- package/dist/discovery/computeSummary.d.ts +0 -17
- package/dist/discovery/discoverMetas.d.ts +0 -19
- package/dist/discovery/getAncestorMeta.d.ts +0 -16
- package/dist/discovery/index.d.ts +0 -12
- package/dist/discovery/listMetas.d.ts +0 -63
- package/dist/discovery/ownershipTree.d.ts +0 -25
- package/dist/discovery/scope.d.ts +0 -47
- package/dist/discovery/types.d.ts +0 -25
- package/dist/ema.d.ts +0 -14
- package/dist/errors.d.ts +0 -15
- package/dist/escapeGlob.d.ts +0 -23
- package/dist/executor/GatewayExecutor.d.ts +0 -79
- package/dist/executor/SpawnAbortedError.d.ts +0 -9
- package/dist/executor/SpawnTimeoutError.d.ts +0 -13
- package/dist/executor/index.d.ts +0 -8
- package/dist/index.d.ts +0 -35
- package/dist/index.js +0 -5797
- package/dist/interfaces/MetaContext.d.ts +0 -38
- package/dist/interfaces/MetaExecutor.d.ts +0 -44
- package/dist/interfaces/WatcherClient.d.ts +0 -75
- package/dist/interfaces/index.d.ts +0 -8
- package/dist/lock.d.ts +0 -70
- package/dist/logger/index.d.ts +0 -27
- package/dist/mtimeFilter.d.ts +0 -26
- package/dist/normalizePath.d.ts +0 -6
- package/dist/orchestrator/buildTask.d.ts +0 -38
- package/dist/orchestrator/contextPackage.d.ts +0 -30
- package/dist/orchestrator/index.d.ts +0 -10
- package/dist/orchestrator/orchestratePhase.d.ts +0 -44
- package/dist/orchestrator/parseOutput.d.ts +0 -42
- package/dist/orchestrator/runPhase.d.ts +0 -40
- package/dist/phaseState/derivePhaseState.d.ts +0 -39
- package/dist/phaseState/index.d.ts +0 -9
- package/dist/phaseState/invalidate.d.ts +0 -39
- package/dist/phaseState/phaseScheduler.d.ts +0 -76
- package/dist/phaseState/phaseTransitions.d.ts +0 -83
- package/dist/progress/index.d.ts +0 -73
- package/dist/prompts/index.d.ts +0 -12
- package/dist/queue/index.d.ts +0 -90
- package/dist/readMetaJson.d.ts +0 -17
- package/dist/routes/__testUtils.d.ts +0 -37
- package/dist/routes/config.d.ts +0 -11
- package/dist/routes/configApply.d.ts +0 -13
- package/dist/routes/index.d.ts +0 -50
- package/dist/routes/metas.d.ts +0 -9
- package/dist/routes/metasUpdate.d.ts +0 -11
- package/dist/routes/preview.d.ts +0 -8
- package/dist/routes/queue.d.ts +0 -13
- package/dist/routes/seed.d.ts +0 -8
- package/dist/routes/status.d.ts +0 -13
- package/dist/routes/synthesize.d.ts +0 -12
- package/dist/routes/unlock.d.ts +0 -8
- package/dist/rules/healthCheck.d.ts +0 -36
- package/dist/rules/index.d.ts +0 -37
- package/dist/rules/verify.d.ts +0 -22
- package/dist/scheduler/index.d.ts +0 -71
- package/dist/scheduling/index.d.ts +0 -7
- package/dist/scheduling/staleness.d.ts +0 -68
- package/dist/scheduling/weightedFormula.d.ts +0 -38
- package/dist/schema/config.d.ts +0 -67
- package/dist/schema/error.d.ts +0 -6
- package/dist/schema/index.d.ts +0 -8
- package/dist/schema/meta.d.ts +0 -72
- package/dist/seed/autoSeed.d.ts +0 -30
- package/dist/seed/createMeta.d.ts +0 -38
- package/dist/seed/index.d.ts +0 -7
- package/dist/server.d.ts +0 -24
- package/dist/shutdown/index.d.ts +0 -33
- package/dist/structureHash.d.ts +0 -15
- package/dist/watcher-client/HttpWatcherClient.d.ts +0 -38
- package/dist/watcher-client/index.d.ts +0 -6
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Corpus-wide phase scheduler.
|
|
3
|
-
*
|
|
4
|
-
* Selects the highest-priority ready phase across all metas.
|
|
5
|
-
* Priority: critic (band 1) \> builder (band 2) \> architect (band 3).
|
|
6
|
-
* Tiebreak within band: weighted staleness (§3.9).
|
|
7
|
-
*
|
|
8
|
-
* @module phaseState/phaseScheduler
|
|
9
|
-
*/
|
|
10
|
-
import type { MetaEntry } from '../discovery/listMetas.js';
|
|
11
|
-
import type { MetaNode } from '../discovery/types.js';
|
|
12
|
-
import type { MetaJson, PhaseName, PhaseState } from '../schema/index.js';
|
|
13
|
-
/** Input for phase candidate selection (from listMetas entries). */
|
|
14
|
-
export interface PhaseCandidateInput {
|
|
15
|
-
node: MetaNode;
|
|
16
|
-
meta: MetaJson;
|
|
17
|
-
phaseState: PhaseState;
|
|
18
|
-
actualStaleness: number;
|
|
19
|
-
locked: boolean;
|
|
20
|
-
disabled: boolean;
|
|
21
|
-
isOverride?: boolean;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Build phase candidates from listMetas entries.
|
|
25
|
-
*
|
|
26
|
-
* Derives phase state, auto-retries failed phases, and applies Tier 1
|
|
27
|
-
* cheap-invalidation (no I/O) for metas with persisted _phaseState.
|
|
28
|
-
* Used by orchestratePhase, queue route, and status route.
|
|
29
|
-
*/
|
|
30
|
-
export declare function buildPhaseCandidates(entries: MetaEntry[], architectEvery: number): PhaseCandidateInput[];
|
|
31
|
-
/** A candidate for phase-level scheduling. */
|
|
32
|
-
export interface PhaseCandidate {
|
|
33
|
-
node: MetaNode;
|
|
34
|
-
meta: MetaJson;
|
|
35
|
-
phaseState: PhaseState;
|
|
36
|
-
owedPhase: PhaseName;
|
|
37
|
-
band: 1 | 2 | 3;
|
|
38
|
-
actualStaleness: number;
|
|
39
|
-
effectiveStaleness: number;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Rank all eligible phase candidates by priority.
|
|
43
|
-
*
|
|
44
|
-
* Filters to pending phases, computes effective staleness, and sorts by
|
|
45
|
-
* band (ascending: critic first) then effective staleness (descending).
|
|
46
|
-
*
|
|
47
|
-
* Used by selectPhaseCandidate (returns first) and the queue route (returns all).
|
|
48
|
-
*/
|
|
49
|
-
export declare function rankPhaseCandidates(metas: PhaseCandidateInput[], depthWeight: number): PhaseCandidate[];
|
|
50
|
-
/**
|
|
51
|
-
* Select the best phase candidate across the corpus.
|
|
52
|
-
*
|
|
53
|
-
* @param metas - Array of (node, meta, phaseState, stalenessSeconds) tuples.
|
|
54
|
-
* @param depthWeight - Config depthWeight for staleness tiebreak.
|
|
55
|
-
* @returns The winning candidate, or null if no phase is ready.
|
|
56
|
-
*/
|
|
57
|
-
export declare function selectPhaseCandidate(metas: PhaseCandidateInput[], depthWeight: number): PhaseCandidate | null;
|
|
58
|
-
/** Result of Tier 2 candidate selection. */
|
|
59
|
-
export interface Tier2Candidate {
|
|
60
|
-
node: MetaNode;
|
|
61
|
-
meta: MetaJson;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Select the stalest all-fresh, non-disabled, non-locked meta for Tier 2
|
|
65
|
-
* invalidation. These are metas that Tier 1 considers fully fresh but may
|
|
66
|
-
* have structural or steer changes detectable only via I/O.
|
|
67
|
-
*
|
|
68
|
-
* @param metas - Phase candidate inputs (after Tier 1 filtering).
|
|
69
|
-
* @returns The stalest all-fresh candidate, or null if none exist.
|
|
70
|
-
*/
|
|
71
|
-
export declare function selectTier2Candidate(metas: PhaseCandidateInput[]): Tier2Candidate | null;
|
|
72
|
-
/**
|
|
73
|
-
* Select all fully-fresh, non-disabled, non-locked metas sorted by staleness
|
|
74
|
-
* (descending — stalest first) for Tier 2 invalidation scanning.
|
|
75
|
-
*/
|
|
76
|
-
export declare function selectAllTier2Candidates(metas: PhaseCandidateInput[]): Tier2Candidate[];
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure phase-state transition functions.
|
|
3
|
-
*
|
|
4
|
-
* Implements every row of the §8 "Transitions and invalidation cascade" table.
|
|
5
|
-
* No I/O — pure functions over PhaseState and documented inputs.
|
|
6
|
-
*
|
|
7
|
-
* @module phaseState/phaseTransitions
|
|
8
|
-
*/
|
|
9
|
-
import type { PhaseState } from '../schema/meta.js';
|
|
10
|
-
/**
|
|
11
|
-
* Create a fresh (fully-complete) phase state.
|
|
12
|
-
*/
|
|
13
|
-
export declare function freshPhaseState(): PhaseState;
|
|
14
|
-
/**
|
|
15
|
-
* Create a phase state for a never-synthesized meta (all pending from architect).
|
|
16
|
-
*/
|
|
17
|
-
export declare function initialPhaseState(): PhaseState;
|
|
18
|
-
/**
|
|
19
|
-
* Enforce the per-meta invariant: at most one phase is pending or running,
|
|
20
|
-
* and it is the first non-fresh phase in pipeline order.
|
|
21
|
-
*
|
|
22
|
-
* Stale phases that become the first non-fresh phase are promoted to pending.
|
|
23
|
-
*/
|
|
24
|
-
export declare function enforceInvariant(state: PhaseState): PhaseState;
|
|
25
|
-
/**
|
|
26
|
-
* Architect invalidated: architect → pending; builder, critic → stale.
|
|
27
|
-
* Triggers: first run, _structureHash change, _steer change,
|
|
28
|
-
* _crossRefs declaration change, _synthesisCount \>= architectEvery.
|
|
29
|
-
*/
|
|
30
|
-
export declare function invalidateArchitect(state: PhaseState): PhaseState;
|
|
31
|
-
/**
|
|
32
|
-
* Builder invalidated (scope mtime or cross-ref _content change):
|
|
33
|
-
* builder → pending; critic → stale.
|
|
34
|
-
* Only applies when architect is fresh; otherwise, builder stays stale.
|
|
35
|
-
*/
|
|
36
|
-
export declare function invalidateBuilder(state: PhaseState): PhaseState;
|
|
37
|
-
/**
|
|
38
|
-
* Architect completes successfully.
|
|
39
|
-
* architect → fresh; builder → pending; critic → stale.
|
|
40
|
-
*/
|
|
41
|
-
export declare function architectSuccess(state: PhaseState): PhaseState;
|
|
42
|
-
/**
|
|
43
|
-
* Builder completes successfully.
|
|
44
|
-
* builder → fresh; critic → pending.
|
|
45
|
-
*/
|
|
46
|
-
export declare function builderSuccess(state: PhaseState): PhaseState;
|
|
47
|
-
/**
|
|
48
|
-
* Critic completes successfully.
|
|
49
|
-
* critic → fresh. Meta becomes fully fresh.
|
|
50
|
-
*/
|
|
51
|
-
export declare function criticSuccess(state: PhaseState): PhaseState;
|
|
52
|
-
/**
|
|
53
|
-
* A phase fails (error, timeout, or abort).
|
|
54
|
-
* Target phase → failed; upstream and downstream unchanged.
|
|
55
|
-
*/
|
|
56
|
-
export declare function phaseFailed(state: PhaseState, phase: 'architect' | 'builder' | 'critic'): PhaseState;
|
|
57
|
-
/**
|
|
58
|
-
* Retry a failed phase: failed → pending.
|
|
59
|
-
* Only valid when the phase is currently failed.
|
|
60
|
-
*/
|
|
61
|
-
export declare function retryPhase(state: PhaseState, phase: 'architect' | 'builder' | 'critic'): PhaseState;
|
|
62
|
-
/**
|
|
63
|
-
* Retry all failed phases: each failed phase → pending.
|
|
64
|
-
* Used by scheduler ticks and queue reads to auto-promote failed phases.
|
|
65
|
-
*/
|
|
66
|
-
export declare function retryAllFailed(state: PhaseState): PhaseState;
|
|
67
|
-
/**
|
|
68
|
-
* Mark a phase as running (scheduler picks it).
|
|
69
|
-
*/
|
|
70
|
-
export declare function phaseRunning(state: PhaseState, phase: 'architect' | 'builder' | 'critic'): PhaseState;
|
|
71
|
-
/**
|
|
72
|
-
* Get the owed phase: first non-fresh phase in pipeline order, or null.
|
|
73
|
-
*/
|
|
74
|
-
export declare function getOwedPhase(state: PhaseState): 'architect' | 'builder' | 'critic' | null;
|
|
75
|
-
/**
|
|
76
|
-
* Check if a meta is fully fresh (all phases fresh).
|
|
77
|
-
*/
|
|
78
|
-
export declare function isFullyFresh(state: PhaseState): boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Get the scheduler priority band for a meta's owed phase.
|
|
81
|
-
* 1 = critic (highest), 2 = builder, 3 = architect, null = fully fresh.
|
|
82
|
-
*/
|
|
83
|
-
export declare function getPriorityBand(state: PhaseState): 1 | 2 | 3 | null;
|
package/dist/progress/index.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Progress reporting via OpenClaw gateway `/tools/invoke` → `message` tool.
|
|
3
|
-
*
|
|
4
|
-
* Progress events are rendered using Handlebars templates. Owner-path links
|
|
5
|
-
* are resolved via the jeeves-server resolve-path API, with graceful
|
|
6
|
-
* fallback to raw filesystem paths when the server is unreachable.
|
|
7
|
-
*
|
|
8
|
-
* @module progress
|
|
9
|
-
*/
|
|
10
|
-
import type { Logger } from 'pino';
|
|
11
|
-
export type ProgressPhase = 'architect' | 'builder' | 'critic';
|
|
12
|
-
export type ProgressEvent = {
|
|
13
|
-
type: 'phase_start' | 'phase_complete' | 'error';
|
|
14
|
-
/** Owner path (not .meta path) of the entity being synthesized. */
|
|
15
|
-
path: string;
|
|
16
|
-
phase?: ProgressPhase;
|
|
17
|
-
tokens?: number;
|
|
18
|
-
durationMs?: number;
|
|
19
|
-
error?: string;
|
|
20
|
-
};
|
|
21
|
-
/** Compiled Handlebars templates for the three progress event types. */
|
|
22
|
-
type CompiledTemplates = {
|
|
23
|
-
phaseStart: HandlebarsTemplateDelegate;
|
|
24
|
-
phaseEnd: HandlebarsTemplateDelegate;
|
|
25
|
-
phaseError: HandlebarsTemplateDelegate;
|
|
26
|
-
};
|
|
27
|
-
/** Raw (string) template config — mirrors the schema definition. */
|
|
28
|
-
export type TemplateStrings = {
|
|
29
|
-
phaseStart: string;
|
|
30
|
-
phaseEnd: string;
|
|
31
|
-
phaseError: string;
|
|
32
|
-
};
|
|
33
|
-
export type ProgressReporterConfig = {
|
|
34
|
-
gatewayUrl: string;
|
|
35
|
-
gatewayApiKey?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Messaging channel name (e.g. 'slack'). When set alongside reportTarget,
|
|
38
|
-
* included in the gateway message payload as `channel`.
|
|
39
|
-
* Legacy: if reportTarget is unset, reportChannel is used as the target
|
|
40
|
-
* (single-channel mode, backward compatible).
|
|
41
|
-
*/
|
|
42
|
-
reportChannel?: string;
|
|
43
|
-
/** Channel/user ID to send messages to. Takes priority over reportChannel as target. */
|
|
44
|
-
reportTarget?: string;
|
|
45
|
-
/**
|
|
46
|
-
* URL of the local jeeves-server instance, used to resolve filesystem paths
|
|
47
|
-
* to browse links via the resolve-path API.
|
|
48
|
-
* Default: http://127.0.0.1:1934
|
|
49
|
-
*/
|
|
50
|
-
serverUrl?: string;
|
|
51
|
-
/** Handlebars template strings for each progress event type. */
|
|
52
|
-
templates?: Partial<TemplateStrings>;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Render the appropriate template for a progress event.
|
|
56
|
-
*
|
|
57
|
-
* @param event - The progress event to render.
|
|
58
|
-
* @param templates - Compiled Handlebars templates.
|
|
59
|
-
* @param serverUrl - jeeves-server URL for resolve-path API.
|
|
60
|
-
* @returns Rendered message string.
|
|
61
|
-
*/
|
|
62
|
-
export declare function renderProgressEvent(event: ProgressEvent, templates: CompiledTemplates, serverUrl: string): Promise<string>;
|
|
63
|
-
export declare class ProgressReporter {
|
|
64
|
-
private readonly config;
|
|
65
|
-
private readonly logger;
|
|
66
|
-
private templates;
|
|
67
|
-
/** Snapshot of template source strings used to compile `this.templates`. */
|
|
68
|
-
private lastTemplateSource;
|
|
69
|
-
private readonly serverUrl;
|
|
70
|
-
constructor(config: ProgressReporterConfig, logger: Logger);
|
|
71
|
-
report(event: ProgressEvent): Promise<void>;
|
|
72
|
-
}
|
|
73
|
-
export {};
|
package/dist/prompts/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Built-in default prompts for the synthesis pipeline.
|
|
3
|
-
*
|
|
4
|
-
* Prompts ship as .md files bundled into dist/prompts/ via rollup-plugin-copy.
|
|
5
|
-
* Loaded at runtime relative to the compiled module location.
|
|
6
|
-
*
|
|
7
|
-
* @module prompts
|
|
8
|
-
*/
|
|
9
|
-
/** Built-in default architect prompt. */
|
|
10
|
-
export declare const DEFAULT_ARCHITECT_PROMPT: string;
|
|
11
|
-
/** Built-in default critic prompt. */
|
|
12
|
-
export declare const DEFAULT_CRITIC_PROMPT: string;
|
package/dist/queue/index.d.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Synthesis queue.
|
|
3
|
-
*
|
|
4
|
-
* Layer 1: Current — the single item currently executing (at most one).
|
|
5
|
-
* Layer 2: Pending — items enqueued via POST /synthesize (targeted) or
|
|
6
|
-
* scheduler tick (automatic). FIFO, ahead of automatic candidates.
|
|
7
|
-
* Layer 3: Automatic — computed on read (GET /queue), not persisted. All
|
|
8
|
-
* metas with a pending phase, ranked by scheduler priority.
|
|
9
|
-
*
|
|
10
|
-
* @module queue
|
|
11
|
-
*/
|
|
12
|
-
import type { Logger } from 'pino';
|
|
13
|
-
import type { PhaseName } from '../schema/meta.js';
|
|
14
|
-
/** An entry in the synthesis queue. */
|
|
15
|
-
export interface QueueEntry {
|
|
16
|
-
path: string;
|
|
17
|
-
enqueuedAt: string;
|
|
18
|
-
}
|
|
19
|
-
/** The currently executing item with phase info. */
|
|
20
|
-
export interface CurrentItem {
|
|
21
|
-
path: string;
|
|
22
|
-
phase: PhaseName;
|
|
23
|
-
startedAt: string;
|
|
24
|
-
}
|
|
25
|
-
/** Result returned by {@link SynthesisQueue.enqueue}. */
|
|
26
|
-
export interface EnqueueResult {
|
|
27
|
-
position: number;
|
|
28
|
-
alreadyQueued: boolean;
|
|
29
|
-
}
|
|
30
|
-
/** Snapshot of queue state for the /status endpoint. */
|
|
31
|
-
export interface QueueState {
|
|
32
|
-
depth: number;
|
|
33
|
-
items: Array<{
|
|
34
|
-
path: string;
|
|
35
|
-
enqueuedAt: string;
|
|
36
|
-
}>;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Synthesis queue.
|
|
40
|
-
*
|
|
41
|
-
* Only one synthesis runs at a time. Explicitly enqueued items
|
|
42
|
-
* take priority over automatic (computed-on-read) candidates.
|
|
43
|
-
*/
|
|
44
|
-
export declare class SynthesisQueue {
|
|
45
|
-
private entries;
|
|
46
|
-
private currentPhaseItem;
|
|
47
|
-
private processing;
|
|
48
|
-
private logger;
|
|
49
|
-
private onEnqueueCallback;
|
|
50
|
-
constructor(logger: Logger);
|
|
51
|
-
/** Set a callback to invoke when a new (non-duplicate) item is enqueued. */
|
|
52
|
-
onEnqueue(callback: () => void): void;
|
|
53
|
-
/**
|
|
54
|
-
* Add an entry to the queue.
|
|
55
|
-
* Deduped by path. Returns position and whether already queued.
|
|
56
|
-
*/
|
|
57
|
-
enqueue(path: string): EnqueueResult;
|
|
58
|
-
/** Dequeue the next entry, or undefined if empty. */
|
|
59
|
-
dequeue(): QueueEntry | undefined;
|
|
60
|
-
/** Get all queued entries (shallow copy). */
|
|
61
|
-
get items(): QueueEntry[];
|
|
62
|
-
/** Number of items waiting in the queue (excludes current). */
|
|
63
|
-
get depth(): number;
|
|
64
|
-
/**
|
|
65
|
-
* Remove all pending items from the queue.
|
|
66
|
-
* Does not affect the currently-running item.
|
|
67
|
-
*
|
|
68
|
-
* @returns The number of items removed.
|
|
69
|
-
*/
|
|
70
|
-
clear(): number;
|
|
71
|
-
/** Check whether a path is in the queue or currently being synthesized. */
|
|
72
|
-
has(path: string): boolean;
|
|
73
|
-
/** Set the currently executing phase item. */
|
|
74
|
-
setCurrentPhase(path: string, phase: PhaseName): void;
|
|
75
|
-
/** Clear the current phase item. */
|
|
76
|
-
clearCurrentPhase(): void;
|
|
77
|
-
/** The currently executing phase item, or null. */
|
|
78
|
-
get currentPhase(): CurrentItem | null;
|
|
79
|
-
/** Return a snapshot of queue state for the /status endpoint. */
|
|
80
|
-
getState(): QueueState;
|
|
81
|
-
/**
|
|
82
|
-
* Process queued items one at a time until the queue is empty.
|
|
83
|
-
*
|
|
84
|
-
* Re-entry is prevented: if already processing, the call returns
|
|
85
|
-
* immediately. Errors are logged and do not block subsequent items.
|
|
86
|
-
*
|
|
87
|
-
* @param synthesizeFn - Async function that performs synthesis for a path.
|
|
88
|
-
*/
|
|
89
|
-
processQueue(synthesizeFn: (path: string) => Promise<void>): Promise<void>;
|
|
90
|
-
}
|
package/dist/readMetaJson.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Read and parse a meta.json file from a `.meta/` directory.
|
|
3
|
-
*
|
|
4
|
-
* Shared utility to eliminate repeated `JSON.parse(readFileSync(...))` across
|
|
5
|
-
* discovery, orchestration, and route handlers.
|
|
6
|
-
*
|
|
7
|
-
* @module readMetaJson
|
|
8
|
-
*/
|
|
9
|
-
import type { MetaJson } from './schema/index.js';
|
|
10
|
-
/**
|
|
11
|
-
* Read and parse a meta.json file from a `.meta/` directory path (async).
|
|
12
|
-
*
|
|
13
|
-
* @param metaPath - Path to the `.meta/` directory.
|
|
14
|
-
* @returns Parsed meta.json content.
|
|
15
|
-
* @throws If the file doesn't exist or contains invalid JSON.
|
|
16
|
-
*/
|
|
17
|
-
export declare function readMetaJson(metaPath: string): Promise<MetaJson>;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared test utilities for route test files.
|
|
3
|
-
*
|
|
4
|
-
* Provides factories for RouteDeps, logger mocks, watcher mocks, and
|
|
5
|
-
* filesystem-based meta fixtures. Eliminates duplication across 9+ test files.
|
|
6
|
-
*
|
|
7
|
-
* @module routes/__testUtils
|
|
8
|
-
*/
|
|
9
|
-
import type { Logger } from 'pino';
|
|
10
|
-
import type { WatcherClient } from '../interfaces/index.js';
|
|
11
|
-
import type { RouteDeps } from './index.js';
|
|
12
|
-
/** Create a mock pino logger with all standard methods. */
|
|
13
|
-
export declare function makeTestLogger(): Logger;
|
|
14
|
-
/** Overrides for makeTestDeps — config can be partially specified. */
|
|
15
|
-
type TestDepsOverrides = Omit<Partial<RouteDeps>, 'config'> & {
|
|
16
|
-
config?: Partial<RouteDeps['config']>;
|
|
17
|
-
};
|
|
18
|
-
/** Create a RouteDeps object with sensible test defaults. */
|
|
19
|
-
export declare function makeTestDeps(overrides?: TestDepsOverrides): RouteDeps;
|
|
20
|
-
/**
|
|
21
|
-
* Create a mock WatcherClient that resolves walk() with given paths.
|
|
22
|
-
*
|
|
23
|
-
* @param metaJsonPaths - Paths to return from walk().
|
|
24
|
-
* @param scan - Optional custom scan mock (defaults to empty results).
|
|
25
|
-
*/
|
|
26
|
-
export declare function makeTestWatcher(metaJsonPaths?: string[], scan?: import("vitest").Mock<import("@vitest/spy").Procedure>): WatcherClient;
|
|
27
|
-
/** Create a mock WatcherClient that rejects walk() calls. */
|
|
28
|
-
export declare function makeFailingTestWatcher(): WatcherClient;
|
|
29
|
-
/**
|
|
30
|
-
* Create a .meta/meta.json on disk and return the meta.json path.
|
|
31
|
-
*
|
|
32
|
-
* @param ownerDir - The owner directory to create .meta/ in.
|
|
33
|
-
* @param meta - Additional meta fields (merged with default _id).
|
|
34
|
-
* @returns The path to the created meta.json file.
|
|
35
|
-
*/
|
|
36
|
-
export declare function createTestMeta(ownerDir: string, meta?: Record<string, unknown>): string;
|
|
37
|
-
export {};
|
package/dist/routes/config.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GET /config — query service configuration with optional JSONPath.
|
|
3
|
-
*
|
|
4
|
-
* Replaces the old GET /config/validate endpoint with the core SDK's
|
|
5
|
-
* `createConfigQueryHandler()` for JSONPath support.
|
|
6
|
-
*
|
|
7
|
-
* @module routes/config
|
|
8
|
-
*/
|
|
9
|
-
import type { FastifyInstance } from 'fastify';
|
|
10
|
-
import type { RouteDeps } from './index.js';
|
|
11
|
-
export declare function registerConfigRoute(app: FastifyInstance, deps: RouteDeps): void;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* POST /config/apply — apply a config patch using the runtime config path.
|
|
3
|
-
*
|
|
4
|
-
* The core SDK's `createConfigApplyHandler` derives the config path from
|
|
5
|
-
* `getComponentConfigDir()` which uses the npm global config root. This
|
|
6
|
-
* local implementation uses the actual runtime config path instead, so
|
|
7
|
-
* temp files are written alongside the active config file.
|
|
8
|
-
*
|
|
9
|
-
* @module routes/configApply
|
|
10
|
-
*/
|
|
11
|
-
import type { FastifyInstance } from 'fastify';
|
|
12
|
-
/** Register the POST /config/apply route. */
|
|
13
|
-
export declare function registerConfigApplyRoute(app: FastifyInstance, configPath?: string): void;
|
package/dist/routes/index.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Route registration for jeeves-meta service.
|
|
3
|
-
*
|
|
4
|
-
* @module routes
|
|
5
|
-
*/
|
|
6
|
-
import type { FastifyInstance } from 'fastify';
|
|
7
|
-
import type { Logger } from 'pino';
|
|
8
|
-
import type { MetaCache } from '../cache.js';
|
|
9
|
-
import type { GatewayExecutor } from '../executor/index.js';
|
|
10
|
-
import type { WatcherClient } from '../interfaces/index.js';
|
|
11
|
-
import type { SynthesisQueue } from '../queue/index.js';
|
|
12
|
-
import type { RuleRegistrar } from '../rules/index.js';
|
|
13
|
-
import type { Scheduler } from '../scheduler/index.js';
|
|
14
|
-
import type { ServiceConfig } from '../schema/config.js';
|
|
15
|
-
/** Runtime stats tracked by the service. */
|
|
16
|
-
export interface ServiceStats {
|
|
17
|
-
totalSyntheses: number;
|
|
18
|
-
totalTokens: number;
|
|
19
|
-
totalErrors: number;
|
|
20
|
-
lastCycleDurationMs: number | null;
|
|
21
|
-
lastCycleAt: string | null;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Large generated fields excluded from detail/update response projections.
|
|
25
|
-
* Shared between metas detail and metasUpdate routes.
|
|
26
|
-
*/
|
|
27
|
-
export declare const DEFAULT_EXCLUDE_FIELDS: Set<string>;
|
|
28
|
-
/** Dependencies injected into route handlers. */
|
|
29
|
-
export interface RouteDeps {
|
|
30
|
-
config: ServiceConfig;
|
|
31
|
-
logger: Logger;
|
|
32
|
-
queue: SynthesisQueue;
|
|
33
|
-
watcher: WatcherClient;
|
|
34
|
-
scheduler: Scheduler | null;
|
|
35
|
-
stats: ServiceStats;
|
|
36
|
-
/** Cached listMetas results with TTL. */
|
|
37
|
-
cache: MetaCache;
|
|
38
|
-
/** Service readiness flag — false during startup. */
|
|
39
|
-
ready: boolean;
|
|
40
|
-
/** Rule registrar for reporting registration state in /status. */
|
|
41
|
-
registrar?: RuleRegistrar;
|
|
42
|
-
/** Executor instance for abort support. */
|
|
43
|
-
executor?: Pick<GatewayExecutor, 'abort'>;
|
|
44
|
-
/** Set to true during graceful shutdown. */
|
|
45
|
-
shuttingDown?: boolean;
|
|
46
|
-
/** Runtime config file path for config-apply. */
|
|
47
|
-
configPath?: string;
|
|
48
|
-
}
|
|
49
|
-
/** Register all HTTP routes on the Fastify instance. */
|
|
50
|
-
export declare function registerRoutes(app: FastifyInstance, deps: RouteDeps): void;
|
package/dist/routes/metas.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GET /metas — list metas with optional filters.
|
|
3
|
-
* GET /metas/:path — single meta detail.
|
|
4
|
-
*
|
|
5
|
-
* @module routes/metas
|
|
6
|
-
*/
|
|
7
|
-
import type { FastifyInstance } from 'fastify';
|
|
8
|
-
import { type RouteDeps } from './index.js';
|
|
9
|
-
export declare function registerMetasRoutes(app: FastifyInstance, deps: RouteDeps): void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PATCH /metas/:path — update user-settable reserved properties on a meta.
|
|
3
|
-
*
|
|
4
|
-
* Supported fields: _steer, _emphasis, _depth, _crossRefs, _disabled.
|
|
5
|
-
* Set a field to null to remove it. Unknown keys are rejected.
|
|
6
|
-
*
|
|
7
|
-
* @module routes/metasUpdate
|
|
8
|
-
*/
|
|
9
|
-
import type { FastifyInstance } from 'fastify';
|
|
10
|
-
import { type RouteDeps } from './index.js';
|
|
11
|
-
export declare function registerMetasUpdateRoute(app: FastifyInstance, deps: RouteDeps): void;
|
package/dist/routes/preview.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GET /preview — dry-run synthesis preview.
|
|
3
|
-
*
|
|
4
|
-
* @module routes/preview
|
|
5
|
-
*/
|
|
6
|
-
import type { FastifyInstance } from 'fastify';
|
|
7
|
-
import type { RouteDeps } from './index.js';
|
|
8
|
-
export declare function registerPreviewRoute(app: FastifyInstance, deps: RouteDeps): void;
|
package/dist/routes/queue.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Queue management and abort routes.
|
|
3
|
-
*
|
|
4
|
-
* - GET /queue — 3-layer queue model (current, pending, automatic)
|
|
5
|
-
* - POST /queue/clear — remove pending entries
|
|
6
|
-
* - POST /synthesize/abort — abort the current synthesis
|
|
7
|
-
*
|
|
8
|
-
* @module routes/queue
|
|
9
|
-
*/
|
|
10
|
-
import type { FastifyInstance } from 'fastify';
|
|
11
|
-
import type { RouteDeps } from './index.js';
|
|
12
|
-
/** Register queue management routes. */
|
|
13
|
-
export declare function registerQueueRoutes(app: FastifyInstance, deps: RouteDeps): void;
|
package/dist/routes/seed.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* POST /seed — create a .meta/ directory with an empty meta.json.
|
|
3
|
-
*
|
|
4
|
-
* @module routes/seed
|
|
5
|
-
*/
|
|
6
|
-
import type { FastifyInstance } from 'fastify';
|
|
7
|
-
import type { RouteDeps } from './index.js';
|
|
8
|
-
export declare function registerSeedRoute(app: FastifyInstance, deps: RouteDeps): void;
|
package/dist/routes/status.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GET /status — service health and status overview.
|
|
3
|
-
*
|
|
4
|
-
* Uses the core SDK's `createStatusHandler` factory with a custom
|
|
5
|
-
* `getHealth` callback that preserves all existing health details.
|
|
6
|
-
*
|
|
7
|
-
* @module routes/status
|
|
8
|
-
*/
|
|
9
|
-
import { type ServiceState } from '@karmaniverous/jeeves-meta-core';
|
|
10
|
-
import type { FastifyInstance } from 'fastify';
|
|
11
|
-
import type { RouteDeps } from './index.js';
|
|
12
|
-
export type { ServiceState };
|
|
13
|
-
export declare function registerStatusRoute(app: FastifyInstance, deps: RouteDeps): void;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* POST /synthesize route handler.
|
|
3
|
-
*
|
|
4
|
-
* Path-targeted triggers create explicit override entries in the queue.
|
|
5
|
-
* Corpus-wide triggers discover the stalest candidate.
|
|
6
|
-
*
|
|
7
|
-
* @module routes/synthesize
|
|
8
|
-
*/
|
|
9
|
-
import type { FastifyInstance } from 'fastify';
|
|
10
|
-
import type { RouteDeps } from './index.js';
|
|
11
|
-
/** Register the POST /synthesize route. */
|
|
12
|
-
export declare function registerSynthesizeRoute(app: FastifyInstance, deps: RouteDeps): void;
|
package/dist/routes/unlock.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* POST /unlock — remove .lock from a .meta/ directory.
|
|
3
|
-
*
|
|
4
|
-
* @module routes/unlock
|
|
5
|
-
*/
|
|
6
|
-
import type { FastifyInstance } from 'fastify';
|
|
7
|
-
import type { RouteDeps } from './index.js';
|
|
8
|
-
export declare function registerUnlockRoute(app: FastifyInstance, deps: RouteDeps): void;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Periodic watcher health check for rule registration resilience.
|
|
3
|
-
*
|
|
4
|
-
* Pings watcher `/status` on a configurable interval, detects restarts
|
|
5
|
-
* (uptime decrease), and re-registers virtual rules automatically.
|
|
6
|
-
* Independent of the synthesis scheduler.
|
|
7
|
-
*
|
|
8
|
-
* @module rules/healthCheck
|
|
9
|
-
*/
|
|
10
|
-
import type { Logger } from 'pino';
|
|
11
|
-
import type { RuleRegistrar } from './index.js';
|
|
12
|
-
/**
|
|
13
|
-
* Manages the periodic watcher health check loop.
|
|
14
|
-
*
|
|
15
|
-
* Starts a `setInterval` that pings the watcher and delegates
|
|
16
|
-
* restart detection to `RuleRegistrar.checkAndReregister()`.
|
|
17
|
-
*/
|
|
18
|
-
export declare class WatcherHealthCheck {
|
|
19
|
-
private readonly watcherUrl;
|
|
20
|
-
private readonly intervalMs;
|
|
21
|
-
private readonly registrar;
|
|
22
|
-
private readonly logger;
|
|
23
|
-
private handle;
|
|
24
|
-
constructor(opts: {
|
|
25
|
-
watcherUrl: string;
|
|
26
|
-
intervalMs: number;
|
|
27
|
-
registrar: RuleRegistrar;
|
|
28
|
-
logger: Logger;
|
|
29
|
-
});
|
|
30
|
-
/** Start the periodic health check. No-op if intervalMs is 0. */
|
|
31
|
-
start(): void;
|
|
32
|
-
/** Stop the periodic health check. */
|
|
33
|
-
stop(): void;
|
|
34
|
-
/** Single health check iteration. */
|
|
35
|
-
private check;
|
|
36
|
-
}
|
package/dist/rules/index.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Virtual rule registration with jeeves-watcher.
|
|
3
|
-
*
|
|
4
|
-
* Service registers inference rules at startup (with retry) and
|
|
5
|
-
* re-registers opportunistically when watcher restart is detected.
|
|
6
|
-
*
|
|
7
|
-
* @module rules
|
|
8
|
-
*/
|
|
9
|
-
import type { Logger } from 'pino';
|
|
10
|
-
import type { WatcherClient } from '../interfaces/index.js';
|
|
11
|
-
import type { MetaConfig } from '../schema/config.js';
|
|
12
|
-
/**
|
|
13
|
-
* Manages virtual rule registration with watcher.
|
|
14
|
-
*
|
|
15
|
-
* - Registers at startup with exponential retry
|
|
16
|
-
* - Tracks watcher uptime for restart detection
|
|
17
|
-
* - Re-registers opportunistically when uptime decreases
|
|
18
|
-
*/
|
|
19
|
-
export declare class RuleRegistrar {
|
|
20
|
-
private readonly config;
|
|
21
|
-
private readonly logger;
|
|
22
|
-
private readonly watcherClient;
|
|
23
|
-
private lastWatcherUptime;
|
|
24
|
-
private registering;
|
|
25
|
-
constructor(config: MetaConfig, logger: Logger, watcher: WatcherClient);
|
|
26
|
-
/**
|
|
27
|
-
* Register rules with watcher. Retries with exponential backoff.
|
|
28
|
-
* Non-blocking — logs errors but never throws.
|
|
29
|
-
*/
|
|
30
|
-
register(): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Check watcher uptime and re-register if it decreased (restart detected).
|
|
33
|
-
*
|
|
34
|
-
* @param currentUptime - Current watcher uptime in seconds.
|
|
35
|
-
*/
|
|
36
|
-
checkAndReregister(currentUptime: number): Promise<void>;
|
|
37
|
-
}
|
package/dist/rules/verify.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Post-registration verification of virtual rule application.
|
|
3
|
-
*
|
|
4
|
-
* After rules are registered with the watcher, verifies that .meta/meta.json
|
|
5
|
-
* files are discoverable via watcher walk (which depends on virtual rules
|
|
6
|
-
* being applied). Logs a warning if expected metas are not found.
|
|
7
|
-
*
|
|
8
|
-
* @module rules/verify
|
|
9
|
-
*/
|
|
10
|
-
import type { WatcherClient } from '../interfaces/index.js';
|
|
11
|
-
import type { MinimalLogger } from '../logger/index.js';
|
|
12
|
-
/**
|
|
13
|
-
* Verify that virtual rules are applied to indexed .meta/meta.json files.
|
|
14
|
-
*
|
|
15
|
-
* Runs a discovery pass and logs the result. If no metas are found but
|
|
16
|
-
* the filesystem likely has some, logs a warning suggesting reindex.
|
|
17
|
-
*
|
|
18
|
-
* @param watcher - WatcherClient for discovery.
|
|
19
|
-
* @param logger - Logger for reporting results.
|
|
20
|
-
* @returns Number of metas discovered.
|
|
21
|
-
*/
|
|
22
|
-
export declare function verifyRuleApplication(watcher: WatcherClient, logger: MinimalLogger): Promise<number>;
|