@substrate-ai/sdlc 0.19.54
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/events.d.ts +336 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +11 -0
- package/dist/events.js.map +1 -0
- package/dist/gating/conflict-detector.d.ts +59 -0
- package/dist/gating/conflict-detector.d.ts.map +1 -0
- package/dist/gating/conflict-detector.js +101 -0
- package/dist/gating/conflict-detector.js.map +1 -0
- package/dist/gating/dispatch-gate.d.ts +42 -0
- package/dist/gating/dispatch-gate.d.ts.map +1 -0
- package/dist/gating/dispatch-gate.js +197 -0
- package/dist/gating/dispatch-gate.js.map +1 -0
- package/dist/gating/index.d.ts +9 -0
- package/dist/gating/index.d.ts.map +1 -0
- package/dist/gating/index.js +8 -0
- package/dist/gating/index.js.map +1 -0
- package/dist/gating/types.d.ts +98 -0
- package/dist/gating/types.d.ts.map +1 -0
- package/dist/gating/types.js +8 -0
- package/dist/gating/types.js.map +1 -0
- package/dist/handlers/event-bridge.d.ts +56 -0
- package/dist/handlers/event-bridge.d.ts.map +1 -0
- package/dist/handlers/event-bridge.js +140 -0
- package/dist/handlers/event-bridge.js.map +1 -0
- package/dist/handlers/index.d.ts +15 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +14 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/sdlc-code-review-handler.d.ts +119 -0
- package/dist/handlers/sdlc-code-review-handler.d.ts.map +1 -0
- package/dist/handlers/sdlc-code-review-handler.js +131 -0
- package/dist/handlers/sdlc-code-review-handler.js.map +1 -0
- package/dist/handlers/sdlc-create-story-handler.d.ts +97 -0
- package/dist/handlers/sdlc-create-story-handler.d.ts.map +1 -0
- package/dist/handlers/sdlc-create-story-handler.js +91 -0
- package/dist/handlers/sdlc-create-story-handler.js.map +1 -0
- package/dist/handlers/sdlc-dev-story-handler.d.ts +121 -0
- package/dist/handlers/sdlc-dev-story-handler.d.ts.map +1 -0
- package/dist/handlers/sdlc-dev-story-handler.js +288 -0
- package/dist/handlers/sdlc-dev-story-handler.js.map +1 -0
- package/dist/handlers/sdlc-phase-handler.d.ts +32 -0
- package/dist/handlers/sdlc-phase-handler.d.ts.map +1 -0
- package/dist/handlers/sdlc-phase-handler.js +166 -0
- package/dist/handlers/sdlc-phase-handler.js.map +1 -0
- package/dist/handlers/types.d.ts +132 -0
- package/dist/handlers/types.d.ts.map +1 -0
- package/dist/handlers/types.js +10 -0
- package/dist/handlers/types.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/learning/failure-classifier.d.ts +23 -0
- package/dist/learning/failure-classifier.d.ts.map +1 -0
- package/dist/learning/failure-classifier.js +75 -0
- package/dist/learning/failure-classifier.js.map +1 -0
- package/dist/learning/finding-classifier.d.ts +25 -0
- package/dist/learning/finding-classifier.d.ts.map +1 -0
- package/dist/learning/finding-classifier.js +37 -0
- package/dist/learning/finding-classifier.js.map +1 -0
- package/dist/learning/finding-lifecycle.d.ts +69 -0
- package/dist/learning/finding-lifecycle.d.ts.map +1 -0
- package/dist/learning/finding-lifecycle.js +162 -0
- package/dist/learning/finding-lifecycle.js.map +1 -0
- package/dist/learning/finding-store.d.ts +16 -0
- package/dist/learning/finding-store.d.ts.map +1 -0
- package/dist/learning/finding-store.js +26 -0
- package/dist/learning/finding-store.js.map +1 -0
- package/dist/learning/findings-injector.d.ts +34 -0
- package/dist/learning/findings-injector.d.ts.map +1 -0
- package/dist/learning/findings-injector.js +140 -0
- package/dist/learning/findings-injector.js.map +1 -0
- package/dist/learning/index.d.ts +8 -0
- package/dist/learning/index.d.ts.map +1 -0
- package/dist/learning/index.js +10 -0
- package/dist/learning/index.js.map +1 -0
- package/dist/learning/relevance-scorer.d.ts +25 -0
- package/dist/learning/relevance-scorer.d.ts.map +1 -0
- package/dist/learning/relevance-scorer.js +49 -0
- package/dist/learning/relevance-scorer.js.map +1 -0
- package/dist/learning/types.d.ts +55 -0
- package/dist/learning/types.d.ts.map +1 -0
- package/dist/learning/types.js +36 -0
- package/dist/learning/types.js.map +1 -0
- package/dist/orchestrator/graph-orchestrator.d.ts +208 -0
- package/dist/orchestrator/graph-orchestrator.d.ts.map +1 -0
- package/dist/orchestrator/graph-orchestrator.js +213 -0
- package/dist/orchestrator/graph-orchestrator.js.map +1 -0
- package/dist/run-manifest/cli-flags.d.ts +11 -0
- package/dist/run-manifest/cli-flags.d.ts.map +1 -0
- package/dist/run-manifest/cli-flags.js +10 -0
- package/dist/run-manifest/cli-flags.js.map +1 -0
- package/dist/run-manifest/index.d.ts +10 -0
- package/dist/run-manifest/index.d.ts.map +1 -0
- package/dist/run-manifest/index.js +10 -0
- package/dist/run-manifest/index.js.map +1 -0
- package/dist/run-model/cli-flags.d.ts +27 -0
- package/dist/run-model/cli-flags.d.ts.map +1 -0
- package/dist/run-model/cli-flags.js +31 -0
- package/dist/run-model/cli-flags.js.map +1 -0
- package/dist/run-model/index.d.ts +21 -0
- package/dist/run-model/index.d.ts.map +1 -0
- package/dist/run-model/index.js +19 -0
- package/dist/run-model/index.js.map +1 -0
- package/dist/run-model/per-story-state.d.ts +62 -0
- package/dist/run-model/per-story-state.d.ts.map +1 -0
- package/dist/run-model/per-story-state.js +70 -0
- package/dist/run-model/per-story-state.js.map +1 -0
- package/dist/run-model/recovery-history.d.ts +56 -0
- package/dist/run-model/recovery-history.d.ts.map +1 -0
- package/dist/run-model/recovery-history.js +83 -0
- package/dist/run-model/recovery-history.js.map +1 -0
- package/dist/run-model/run-manifest.d.ts +146 -0
- package/dist/run-model/run-manifest.d.ts.map +1 -0
- package/dist/run-model/run-manifest.js +481 -0
- package/dist/run-model/run-manifest.js.map +1 -0
- package/dist/run-model/schemas.d.ts +117 -0
- package/dist/run-model/schemas.d.ts.map +1 -0
- package/dist/run-model/schemas.js +83 -0
- package/dist/run-model/schemas.js.map +1 -0
- package/dist/run-model/supervisor-lock.d.ts +104 -0
- package/dist/run-model/supervisor-lock.d.ts.map +1 -0
- package/dist/run-model/supervisor-lock.js +284 -0
- package/dist/run-model/supervisor-lock.js.map +1 -0
- package/dist/run-model/types.d.ts +74 -0
- package/dist/run-model/types.d.ts.map +1 -0
- package/dist/run-model/types.js +8 -0
- package/dist/run-model/types.js.map +1 -0
- package/dist/run-model/verification-result.d.ts +60 -0
- package/dist/run-model/verification-result.d.ts.map +1 -0
- package/dist/run-model/verification-result.js +55 -0
- package/dist/run-model/verification-result.js.map +1 -0
- package/dist/verification/checks/acceptance-criteria-evidence-check.d.ts +21 -0
- package/dist/verification/checks/acceptance-criteria-evidence-check.d.ts.map +1 -0
- package/dist/verification/checks/acceptance-criteria-evidence-check.js +159 -0
- package/dist/verification/checks/acceptance-criteria-evidence-check.js.map +1 -0
- package/dist/verification/checks/build-check.d.ts +52 -0
- package/dist/verification/checks/build-check.d.ts.map +1 -0
- package/dist/verification/checks/build-check.js +160 -0
- package/dist/verification/checks/build-check.js.map +1 -0
- package/dist/verification/checks/index.d.ts +15 -0
- package/dist/verification/checks/index.d.ts.map +1 -0
- package/dist/verification/checks/index.js +15 -0
- package/dist/verification/checks/index.js.map +1 -0
- package/dist/verification/checks/phantom-review-check.d.ts +29 -0
- package/dist/verification/checks/phantom-review-check.d.ts.map +1 -0
- package/dist/verification/checks/phantom-review-check.js +70 -0
- package/dist/verification/checks/phantom-review-check.js.map +1 -0
- package/dist/verification/checks/trivial-output-check.d.ts +47 -0
- package/dist/verification/checks/trivial-output-check.d.ts.map +1 -0
- package/dist/verification/checks/trivial-output-check.js +72 -0
- package/dist/verification/checks/trivial-output-check.js.map +1 -0
- package/dist/verification/index.d.ts +13 -0
- package/dist/verification/index.d.ts.map +1 -0
- package/dist/verification/index.js +13 -0
- package/dist/verification/index.js.map +1 -0
- package/dist/verification/types.d.ts +149 -0
- package/dist/verification/types.d.ts.map +1 -0
- package/dist/verification/types.js +12 -0
- package/dist/verification/types.js.map +1 -0
- package/dist/verification/verification-pipeline.d.ts +65 -0
- package/dist/verification/verification-pipeline.d.ts.map +1 -0
- package/dist/verification/verification-pipeline.js +149 -0
- package/dist/verification/verification-pipeline.js.map +1 -0
- package/graphs/sdlc-pipeline.dot +42 -0
- package/package.json +22 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RecoveryEntry and CostAccumulation schemas — Story 52-8.
|
|
3
|
+
*
|
|
4
|
+
* Provides Zod schemas and TypeScript types for recovery history and cost
|
|
5
|
+
* accumulation data stored in the run manifest. Consumed by Epic 53 cost
|
|
6
|
+
* governance and Epic 54 recovery engine.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// RecoveryOutcome
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
/**
|
|
13
|
+
* Outcome of a recovery attempt.
|
|
14
|
+
*
|
|
15
|
+
* The string fallback must be last in the union so Zod evaluates the literal
|
|
16
|
+
* variants first — a leading z.string() would swallow all literals. This
|
|
17
|
+
* follows the v0.19.6 extensible union pattern used throughout the codebase.
|
|
18
|
+
*/
|
|
19
|
+
export const RecoveryOutcomeSchema = z.union([
|
|
20
|
+
z.literal('retried'),
|
|
21
|
+
z.literal('escalated'),
|
|
22
|
+
z.literal('skipped'),
|
|
23
|
+
z.string(), // extensible fallback — must be last (v0.19.6 pattern)
|
|
24
|
+
]);
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// RecoveryEntry
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
/**
|
|
29
|
+
* A single recovery attempt recorded in the run manifest.
|
|
30
|
+
*
|
|
31
|
+
* `attempt_number` is 1-indexed: 1 = first retry, NOT the initial dispatch.
|
|
32
|
+
* The initial dispatch of a story is never recorded as a RecoveryEntry.
|
|
33
|
+
*
|
|
34
|
+
* `strategy` is free-form (e.g., `'retry-with-context'`, `'re-scope'`).
|
|
35
|
+
*
|
|
36
|
+
* `cost_usd` is the cost of THIS single retry attempt only — NOT cumulative.
|
|
37
|
+
* Cumulative per-story retry cost is tracked in `CostAccumulation.per_story`.
|
|
38
|
+
*/
|
|
39
|
+
export const RecoveryEntrySchema = z.object({
|
|
40
|
+
/** Story key that triggered this recovery attempt (e.g. '52-8'). */
|
|
41
|
+
story_key: z.string(),
|
|
42
|
+
/** 1-indexed attempt number — 1 = first retry, not initial dispatch. */
|
|
43
|
+
attempt_number: z.number().int().nonnegative(),
|
|
44
|
+
/** Recovery strategy applied (e.g., 'retry-with-context', 're-scope'). */
|
|
45
|
+
strategy: z.string(),
|
|
46
|
+
/** Root cause classification string (informational, for completion report). */
|
|
47
|
+
root_cause: z.string(),
|
|
48
|
+
/** Outcome of this recovery attempt. */
|
|
49
|
+
outcome: RecoveryOutcomeSchema,
|
|
50
|
+
/** Cost of this single retry attempt in USD (NOT cumulative). */
|
|
51
|
+
cost_usd: z.number().nonnegative(),
|
|
52
|
+
/** ISO-8601 timestamp when this recovery was initiated. */
|
|
53
|
+
timestamp: z.string(),
|
|
54
|
+
});
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
// CostAccumulation
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
/**
|
|
59
|
+
* Accumulated retry cost data for a pipeline run.
|
|
60
|
+
*
|
|
61
|
+
* `per_story` maps story_key → sum of all RecoveryEntry.cost_usd for that
|
|
62
|
+
* story. It does NOT include the initial dispatch cost, which is tracked in
|
|
63
|
+
* `PerStoryState.cost_usd`.
|
|
64
|
+
*
|
|
65
|
+
* `run_total` is the sum of all RecoveryEntry.cost_usd values in the run
|
|
66
|
+
* (i.e., total retry cost only, not total run cost).
|
|
67
|
+
*
|
|
68
|
+
* An empty `{ per_story: {}, run_total: 0 }` is the valid initial value.
|
|
69
|
+
*/
|
|
70
|
+
export const CostAccumulationSchema = z.object({
|
|
71
|
+
/**
|
|
72
|
+
* Per-story cumulative retry cost in USD.
|
|
73
|
+
* Maps story_key → sum of all RecoveryEntry.cost_usd for that story.
|
|
74
|
+
* Does NOT include the initial dispatch cost (tracked in PerStoryState.cost_usd).
|
|
75
|
+
*/
|
|
76
|
+
per_story: z.record(z.string(), z.number().nonnegative()),
|
|
77
|
+
/**
|
|
78
|
+
* Total retry cost for the entire run in USD.
|
|
79
|
+
* Equal to sum of all RecoveryEntry.cost_usd values.
|
|
80
|
+
*/
|
|
81
|
+
run_total: z.number().nonnegative(),
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=recovery-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recovery-history.js","sourceRoot":"","sources":["../../src/run-model/recovery-history.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC3C,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IACpB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IACtB,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IACpB,CAAC,CAAC,MAAM,EAAE,EAAE,uDAAuD;CACpE,CAAC,CAAA;AAIF,8EAA8E;AAC9E,gBAAgB;AAChB,8EAA8E;AAE9E;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,oEAAoE;IACpE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,wEAAwE;IACxE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC9C,0EAA0E;IAC1E,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,+EAA+E;IAC/E,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,wCAAwC;IACxC,OAAO,EAAE,qBAAqB;IAC9B,iEAAiE;IACjE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE;IAClC,2DAA2D;IAC3D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAA;AAIF,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C;;;;OAIG;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;IACzD;;;OAGG;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE;CACpC,CAAC,CAAA"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RunManifest — atomic file-backed run state — Story 52-1.
|
|
3
|
+
*
|
|
4
|
+
* Provides typed read/write operations with atomic file replacement
|
|
5
|
+
* so run state survives process crashes without corruption.
|
|
6
|
+
*
|
|
7
|
+
* File layout (relative to baseDir):
|
|
8
|
+
* {run-id}.json — primary manifest
|
|
9
|
+
* {run-id}.json.bak — backup written before rename
|
|
10
|
+
* {run-id}.json.tmp — temporary write target (fsync'd before rename)
|
|
11
|
+
*/
|
|
12
|
+
import type { RunManifestData } from './types.js';
|
|
13
|
+
import type { RecoveryEntry } from './recovery-history.js';
|
|
14
|
+
import type { CliFlags } from './cli-flags.js';
|
|
15
|
+
import type { PerStoryState } from './per-story-state.js';
|
|
16
|
+
/**
|
|
17
|
+
* Minimal interface for Dolt query access needed by the degraded-mode fallback.
|
|
18
|
+
* Consumers inject a real `DatabaseAdapter` (from @substrate-ai/core) or null.
|
|
19
|
+
*/
|
|
20
|
+
export interface IDoltAdapter {
|
|
21
|
+
query<T = unknown>(sql: string, params?: unknown[]): Promise<T[]>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Typed, atomic file-backed run manifest.
|
|
25
|
+
*
|
|
26
|
+
* Each instance is bound to a specific run ID and base directory.
|
|
27
|
+
* Use `RunManifest.create()` to initialize a new manifest,
|
|
28
|
+
* or `RunManifest.read()` to load an existing one.
|
|
29
|
+
*/
|
|
30
|
+
export declare class RunManifest {
|
|
31
|
+
readonly runId: string;
|
|
32
|
+
readonly baseDir: string;
|
|
33
|
+
/** Optional Dolt adapter for degraded-mode fallback on read. */
|
|
34
|
+
private doltAdapter;
|
|
35
|
+
constructor(runId: string, baseDir?: string, doltAdapter?: IDoltAdapter | null);
|
|
36
|
+
get primaryPath(): string;
|
|
37
|
+
get bakPath(): string;
|
|
38
|
+
get tmpPath(): string;
|
|
39
|
+
/**
|
|
40
|
+
* Read this manifest from disk (multi-tier fallback).
|
|
41
|
+
*
|
|
42
|
+
* Delegates to `RunManifest.read()` with this instance's runId, baseDir,
|
|
43
|
+
* and doltAdapter. Primarily used by `SupervisorLock` (and tests that mock it).
|
|
44
|
+
*
|
|
45
|
+
* @throws ManifestReadError if all sources fail
|
|
46
|
+
*/
|
|
47
|
+
read(): Promise<RunManifestData>;
|
|
48
|
+
/**
|
|
49
|
+
* Atomically update specific fields in the manifest.
|
|
50
|
+
*
|
|
51
|
+
* Reads the current manifest, merges in the provided partial data (shallow
|
|
52
|
+
* merge), then writes the result atomically. Generation is incremented and
|
|
53
|
+
* `updated_at` is refreshed by `write()`.
|
|
54
|
+
*
|
|
55
|
+
* Callers should pass only the fields they intend to change. Do NOT use this
|
|
56
|
+
* to change `run_id` or `created_at` — those are immutable after creation.
|
|
57
|
+
*
|
|
58
|
+
* @throws ManifestReadError if the current manifest cannot be read
|
|
59
|
+
*/
|
|
60
|
+
update(partial: Partial<Omit<RunManifestData, 'generation' | 'updated_at'>>): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Atomically write the manifest to disk.
|
|
63
|
+
*
|
|
64
|
+
* Sequence:
|
|
65
|
+
* 1. Auto-increment `generation`, set `updated_at`
|
|
66
|
+
* 2. Serialize to JSON and validate round-trip
|
|
67
|
+
* 3. Ensure baseDir exists (mkdir -p)
|
|
68
|
+
* 4. Write to `.tmp` via open → write → datasync → close (fsync)
|
|
69
|
+
* 5. If primary exists, copy to `.bak`
|
|
70
|
+
* 6. Rename `.tmp` → primary path
|
|
71
|
+
*/
|
|
72
|
+
write(data: Omit<RunManifestData, 'generation' | 'updated_at'>): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Return a bound `RunManifest` instance without performing any file I/O.
|
|
75
|
+
*
|
|
76
|
+
* Use `open()` when you want to call instance methods (`read()`, `patchCLIFlags()`)
|
|
77
|
+
* on an existing run without reading the manifest upfront.
|
|
78
|
+
*
|
|
79
|
+
* ```typescript
|
|
80
|
+
* await RunManifest.open(runId, runsDir).patchCLIFlags(cliFlags)
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
static open(runId: string, baseDir?: string, doltAdapter?: IDoltAdapter | null): RunManifest;
|
|
84
|
+
/**
|
|
85
|
+
* Read the current manifest (or create a minimal default), merge the provided
|
|
86
|
+
* CLI flags into `cli_flags`, and write the result atomically.
|
|
87
|
+
*
|
|
88
|
+
* Non-fatal: callers should wrap in try/catch and log a warning on failure.
|
|
89
|
+
* The pipeline must not abort if manifest write fails.
|
|
90
|
+
*/
|
|
91
|
+
patchCLIFlags(flags: CliFlags): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Atomically upsert the per-story lifecycle state for a single story key.
|
|
94
|
+
*
|
|
95
|
+
* Reads the current manifest (or creates a minimal default if absent),
|
|
96
|
+
* shallowly merges `updates` into `per_story_state[storyKey]`, and writes
|
|
97
|
+
* the result atomically via a single `write()` call.
|
|
98
|
+
*
|
|
99
|
+
* Fields not included in `updates` on an existing entry are preserved unchanged.
|
|
100
|
+
*
|
|
101
|
+
* Non-fatal: callers MUST wrap in `.catch((err) => logger.warn(...))`.
|
|
102
|
+
* The pipeline must never abort due to a manifest write failure.
|
|
103
|
+
*
|
|
104
|
+
* @param storyKey - Story key (e.g. '52-4')
|
|
105
|
+
* @param updates - Partial PerStoryState fields to merge
|
|
106
|
+
*/
|
|
107
|
+
patchStoryState(storyKey: string, updates: Partial<PerStoryState>): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Atomically append a recovery entry and update cost accumulation.
|
|
110
|
+
*
|
|
111
|
+
* Reads the current manifest, appends `entry` to `recovery_history[]`,
|
|
112
|
+
* increments `cost_accumulation.per_story[entry.story_key]` by `entry.cost_usd`,
|
|
113
|
+
* increments `cost_accumulation.run_total` by `entry.cost_usd`, then writes
|
|
114
|
+
* atomically via a single `write()` call.
|
|
115
|
+
*
|
|
116
|
+
* Non-fatal: callers MUST wrap in `.catch((err) => logger.warn(...))`.
|
|
117
|
+
* The pipeline must never abort due to a manifest write failure.
|
|
118
|
+
*
|
|
119
|
+
* `entry.cost_usd` is the cost of this single retry attempt only (NOT cumulative).
|
|
120
|
+
* Cumulative per-story retry cost is tracked in `cost_accumulation.per_story`.
|
|
121
|
+
*
|
|
122
|
+
* @param entry - Recovery entry to append (attempt_number is 1-indexed)
|
|
123
|
+
*/
|
|
124
|
+
appendRecoveryEntry(entry: RecoveryEntry): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Create a new manifest with `generation: 0` and write it.
|
|
127
|
+
* Returns a bound `RunManifest` instance.
|
|
128
|
+
*/
|
|
129
|
+
static create(runId: string, initialData: Omit<RunManifestData, 'generation' | 'updated_at' | 'created_at'>, baseDir?: string, doltAdapter?: IDoltAdapter | null): Promise<RunManifest>;
|
|
130
|
+
/**
|
|
131
|
+
* Read a manifest from disk with multi-tier fallback.
|
|
132
|
+
*
|
|
133
|
+
* Attempts sources in order:
|
|
134
|
+
* 1. Primary `.json`
|
|
135
|
+
* 2. Backup `.json.bak` (preferred over primary if generation is higher)
|
|
136
|
+
* 3. Temporary `.json.tmp`
|
|
137
|
+
* 4. Dolt degraded reconstruction (if doltAdapter is provided)
|
|
138
|
+
*
|
|
139
|
+
* Generation tiebreak: if `.bak` has a higher `generation` than primary,
|
|
140
|
+
* `.bak` is preferred (indicates primary was overwritten mid-rename).
|
|
141
|
+
*
|
|
142
|
+
* @throws ManifestReadError if all sources fail
|
|
143
|
+
*/
|
|
144
|
+
static read(runId: string, baseDir?: string, doltAdapter?: IDoltAdapter | null): Promise<RunManifestData>;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=run-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-manifest.d.ts","sourceRoot":"","sources":["../../src/run-model/run-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAY,MAAM,YAAY,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAMzD;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAA;CAClE;AA6GD;;;;;;GAMG;AACH,qBAAa,WAAW;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAExB,gEAAgE;IAChE,OAAO,CAAC,WAAW,CAAqB;gBAE5B,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,MAAyB,EAAE,WAAW,GAAE,YAAY,GAAG,IAAW;IAUtG,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;IAMD;;;;;;;OAOG;IACG,IAAI,IAAI,OAAO,CAAC,eAAe,CAAC;IAQtC;;;;;;;;;;;OAWG;IACG,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,YAAY,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAajG;;;;;;;;;;OAUG;IACG,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IA+CpF;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAI,CACT,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,MAAyB,EAClC,WAAW,GAAE,YAAY,GAAG,IAAW,GACtC,WAAW;IAQd;;;;;;OAMG;IACG,aAAa,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAmCnD;;;;;;;;;;;;;;OAcG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAuDvF;;;;;;;;;;;;;;;OAeG;IACG,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IA4C9D;;;OAGG;WACU,MAAM,CACjB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC,EAC9E,OAAO,GAAE,MAAyB,EAClC,WAAW,GAAE,YAAY,GAAG,IAAW,GACtC,OAAO,CAAC,WAAW,CAAC;IAiBvB;;;;;;;;;;;;;OAaG;WACU,IAAI,CACf,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,MAAyB,EAClC,WAAW,GAAE,YAAY,GAAG,IAAW,GACtC,OAAO,CAAC,eAAe,CAAC;CA0D5B"}
|