@karmaniverous/jeeves-meta 0.16.0 → 0.16.2

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.
@@ -1,26 +1,18 @@
1
1
  /**
2
- * Hybrid 3-layer synthesis queue.
2
+ * Synthesis queue.
3
3
  *
4
4
  * Layer 1: Current — the single item currently executing (at most one).
5
- * Layer 2: Overrides — items manually enqueued via POST /synthesize with path.
6
- * FIFO among overrides, ahead of automatic candidates.
7
- * Layer 3: Automatic — computed on read, not persisted. All metas with a
8
- * pending phase, ranked by scheduler priority.
9
- *
10
- * Legacy: `pending` array is the union of overrides + automatic.
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.
11
9
  *
12
10
  * @module queue
13
11
  */
14
12
  import type { Logger } from 'pino';
15
13
  import type { PhaseName } from '../schema/meta.js';
16
- /** A queued synthesis work item. */
17
- export interface QueueItem {
18
- path: string;
19
- priority: boolean;
20
- enqueuedAt: string;
21
- }
22
- /** An override entry in the explicit queue layer. */
23
- export interface OverrideEntry {
14
+ /** An entry in the synthesis queue. */
15
+ export interface QueueEntry {
24
16
  path: string;
25
17
  enqueuedAt: string;
26
18
  }
@@ -40,69 +32,35 @@ export interface QueueState {
40
32
  depth: number;
41
33
  items: Array<{
42
34
  path: string;
43
- priority: boolean;
44
35
  enqueuedAt: string;
45
36
  }>;
46
37
  }
47
38
  /**
48
- * Hybrid 3-layer synthesis queue.
39
+ * Synthesis queue.
49
40
  *
50
- * Only one synthesis runs at a time. Override items (explicit triggers)
51
- * take priority over automatic candidates.
41
+ * Only one synthesis runs at a time. Explicitly enqueued items
42
+ * take priority over automatic (computed-on-read) candidates.
52
43
  */
53
44
  export declare class SynthesisQueue {
54
- /** Legacy queue (used by processQueue for backward compat). */
55
- private queue;
56
- private currentItem;
45
+ private entries;
46
+ private currentPhaseItem;
57
47
  private processing;
58
48
  private logger;
59
49
  private onEnqueueCallback;
60
- /** Explicit override entries (3-layer model). */
61
- private overrideEntries;
62
- /** Currently executing item with phase info (3-layer model). */
63
- private currentPhaseItem;
64
50
  constructor(logger: Logger);
65
51
  /** Set a callback to invoke when a new (non-duplicate) item is enqueued. */
66
52
  onEnqueue(callback: () => void): void;
67
53
  /**
68
- * Add an explicit override entry (from POST /synthesize with path).
54
+ * Add an entry to the queue.
69
55
  * Deduped by path. Returns position and whether already queued.
70
56
  */
71
- enqueueOverride(path: string): EnqueueResult;
72
- /** Dequeue the next override entry, or undefined if empty. */
73
- dequeueOverride(): OverrideEntry | undefined;
74
- /** Get all override entries (shallow copy). */
75
- get overrides(): OverrideEntry[];
76
- /** Clear all override entries. Returns count removed. */
77
- clearOverrides(): number;
78
- /** Check if a path is in the override layer. */
79
- hasOverride(path: string): boolean;
80
- /** Set the currently executing phase item. */
81
- setCurrentPhase(path: string, phase: PhaseName): void;
82
- /** Clear the current phase item. */
83
- clearCurrentPhase(): void;
84
- /** The currently executing phase item, or null. */
85
- get currentPhase(): CurrentItem | null;
86
- /**
87
- * Add a path to the synthesis queue.
88
- *
89
- * @param path - Meta path to synthesize.
90
- * @param priority - If true, insert at front of queue.
91
- * @returns Position and whether the path was already queued.
92
- */
93
- enqueue(path: string, priority?: boolean): EnqueueResult;
94
- /** Remove and return the next item from the queue. */
95
- dequeue(): QueueItem | undefined;
96
- /** Mark the currently-running synthesis as complete. */
97
- complete(): void;
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[];
98
62
  /** Number of items waiting in the queue (excludes current). */
99
63
  get depth(): number;
100
- /** The item currently being synthesized, or null. */
101
- get current(): QueueItem | null;
102
- /** A shallow copy of the queued items. */
103
- get items(): QueueItem[];
104
- /** A shallow copy of the pending items (alias for items). */
105
- get pending(): QueueItem[];
106
64
  /**
107
65
  * Remove all pending items from the queue.
108
66
  * Does not affect the currently-running item.
@@ -112,16 +70,17 @@ export declare class SynthesisQueue {
112
70
  clear(): number;
113
71
  /** Check whether a path is in the queue or currently being synthesized. */
114
72
  has(path: string): boolean;
115
- /** Get the 0-indexed position of a path in the queue. */
116
- getPosition(path: string): number | null;
117
- /** Dequeue the next item: overrides first, then legacy queue. */
118
- private nextItem;
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;
119
79
  /** Return a snapshot of queue state for the /status endpoint. */
120
80
  getState(): QueueState;
121
81
  /**
122
- * Process queued items one at a time until all queues are empty.
82
+ * Process queued items one at a time until the queue is empty.
123
83
  *
124
- * Override entries are processed first (FIFO), then legacy queue items.
125
84
  * Re-entry is prevented: if already processing, the call returns
126
85
  * immediately. Errors are logged and do not block subsequent items.
127
86
  *
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Queue management and abort routes.
3
3
  *
4
- * - GET /queue — 3-layer queue model (current, overrides, automatic, pending)
5
- * - POST /queue/clear — remove override entries only
4
+ * - GET /queue — 3-layer queue model (current, pending, automatic)
5
+ * - POST /queue/clear — remove pending entries
6
6
  * - POST /synthesize/abort — abort the current synthesis
7
7
  *
8
8
  * @module routes/queue
@@ -49,6 +49,10 @@ export declare const serviceConfigSchema: z.ZodObject<{
49
49
  crossRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
50
50
  parentDepth: z.ZodOptional<z.ZodNumber>;
51
51
  }, z.core.$strip>>>>;
52
+ workspaceDir: z.ZodOptional<z.ZodString>;
53
+ stagingRetries: z.ZodDefault<z.ZodNumber>;
54
+ stagingRetryDelayMs: z.ZodDefault<z.ZodNumber>;
55
+ previewDeltaFilesCap: z.ZodDefault<z.ZodNumber>;
52
56
  }, z.core.$strip>;
53
57
  /** Inferred type for service configuration. */
54
58
  export type ServiceConfig = z.infer<typeof serviceConfigSchema>;
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "@karmaniverous/jeeves": "^0.5.12",
11
- "@karmaniverous/jeeves-meta-core": "^0.2.0",
11
+ "@karmaniverous/jeeves-meta-core": "^0.2.1",
12
12
  "commander": "^14",
13
13
  "croner": "^10",
14
14
  "fastify": "^5.8",
@@ -110,5 +110,5 @@
110
110
  },
111
111
  "type": "module",
112
112
  "types": "dist/index.d.ts",
113
- "version": "0.16.0"
113
+ "version": "0.16.2"
114
114
  }