@encore-os/eos-spec 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/commands/archive.js +57 -3
  2. package/dist/commands/archive.js.map +1 -1
  3. package/dist/commands/close-out.d.ts +2 -0
  4. package/dist/commands/close-out.js +167 -0
  5. package/dist/commands/close-out.js.map +1 -0
  6. package/dist/commands/conformance.js +20 -1
  7. package/dist/commands/conformance.js.map +1 -1
  8. package/dist/commands/create.js +25 -4
  9. package/dist/commands/create.js.map +1 -1
  10. package/dist/commands/metrics.js +15 -0
  11. package/dist/commands/metrics.js.map +1 -1
  12. package/dist/commands/run.d.ts +10 -0
  13. package/dist/commands/run.js +230 -0
  14. package/dist/commands/run.js.map +1 -0
  15. package/dist/commands/validate.d.ts +7 -0
  16. package/dist/commands/validate.js +46 -7
  17. package/dist/commands/validate.js.map +1 -1
  18. package/dist/commands/walkthrough.d.ts +2 -0
  19. package/dist/commands/walkthrough.js +76 -0
  20. package/dist/commands/walkthrough.js.map +1 -0
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.js +15 -0
  23. package/dist/index.js.map +1 -1
  24. package/dist/lib/ai-call.d.ts +12 -0
  25. package/dist/lib/ai-call.js +6 -0
  26. package/dist/lib/ai-call.js.map +1 -1
  27. package/dist/lib/closeout-core.d.ts +46 -0
  28. package/dist/lib/closeout-core.js +34 -0
  29. package/dist/lib/closeout-core.js.map +1 -0
  30. package/dist/lib/closeout-predicate.d.ts +36 -0
  31. package/dist/lib/closeout-predicate.js +130 -0
  32. package/dist/lib/closeout-predicate.js.map +1 -0
  33. package/dist/lib/cost.js +7 -0
  34. package/dist/lib/cost.js.map +1 -1
  35. package/dist/lib/events.d.ts +15 -1
  36. package/dist/lib/events.js.map +1 -1
  37. package/dist/lib/frontmatter.d.ts +38 -0
  38. package/dist/lib/frontmatter.js +76 -0
  39. package/dist/lib/frontmatter.js.map +1 -1
  40. package/dist/lib/gate-executor.d.ts +80 -0
  41. package/dist/lib/gate-executor.js +311 -0
  42. package/dist/lib/gate-executor.js.map +1 -0
  43. package/dist/lib/llm-health.d.ts +28 -0
  44. package/dist/lib/llm-health.js +46 -0
  45. package/dist/lib/llm-health.js.map +1 -0
  46. package/dist/lib/metrics.d.ts +26 -0
  47. package/dist/lib/metrics.js +35 -0
  48. package/dist/lib/metrics.js.map +1 -1
  49. package/dist/lib/next-action.d.ts +10 -4
  50. package/dist/lib/next-action.js +10 -4
  51. package/dist/lib/next-action.js.map +1 -1
  52. package/dist/lib/ollama-embed.d.ts +5 -0
  53. package/dist/lib/ollama-embed.js +5 -0
  54. package/dist/lib/ollama-embed.js.map +1 -1
  55. package/dist/lib/output.d.ts +3 -0
  56. package/dist/lib/output.js +3 -0
  57. package/dist/lib/output.js.map +1 -1
  58. package/dist/lib/pipeline-config.js +10 -0
  59. package/dist/lib/pipeline-config.js.map +1 -1
  60. package/dist/lib/pipeline-map.js +9 -0
  61. package/dist/lib/pipeline-map.js.map +1 -1
  62. package/dist/lib/precedent-search.d.ts +1 -0
  63. package/dist/lib/precedent-search.js +19 -2
  64. package/dist/lib/precedent-search.js.map +1 -1
  65. package/dist/lib/predicate-registry.js +7 -0
  66. package/dist/lib/predicate-registry.js.map +1 -1
  67. package/dist/lib/run-pipeline.d.ts +118 -0
  68. package/dist/lib/run-pipeline.js +106 -0
  69. package/dist/lib/run-pipeline.js.map +1 -0
  70. package/dist/lib/scorecard.js +9 -0
  71. package/dist/lib/scorecard.js.map +1 -1
  72. package/dist/lib/spec-pure.d.ts +69 -4
  73. package/dist/lib/spec-pure.js +125 -15
  74. package/dist/lib/spec-pure.js.map +1 -1
  75. package/dist/lib/specs.d.ts +3 -3
  76. package/dist/lib/specs.js +43 -20
  77. package/dist/lib/specs.js.map +1 -1
  78. package/dist/lib/version.d.ts +1 -1
  79. package/dist/lib/version.js +1 -1
  80. package/dist/lib/walkthrough-coverage.d.ts +81 -0
  81. package/dist/lib/walkthrough-coverage.js +111 -0
  82. package/dist/lib/walkthrough-coverage.js.map +1 -0
  83. package/package.json +1 -1
@@ -0,0 +1,46 @@
1
+ import { type CloseoutDecision, type CloseoutOptions } from './closeout-predicate.js';
2
+ import { type ReconcileRow } from './reconcile-core.js';
3
+ import type { SpecFile } from './specs.js';
4
+ /**
5
+ * The per-spec close-out core (issue #30, TOOL-06 terminal complement), extracted
6
+ * so the `close-out` command stays a thin adapter and the verified status: ->
7
+ * complete write lives in ONE place the engine owns
8
+ * (docs/adr/0001-engine-owns-verified-close-out-status-promotion.md). fs-bound
9
+ * (reads + writes the spec markdown, delegates to the fs-bound reconcileSpec) — stays
10
+ * behind the package main entry, never `/pure`.
11
+ *
12
+ * close-out composes the three pipeline-tail steps the issue names, reusing their
13
+ * lib functions rather than shelling the CLI:
14
+ * 1. reconcile — heal `pipeline_status` from the on-disk artifacts so the gate
15
+ * sees the TRUE stage, not a stale frontmatter value (reconcileSpec).
16
+ * 2. verify-acs — the conservative gate reads the per-AC `status` that
17
+ * `verify-acs --write` has already promoted to `verified`
18
+ * (decideCloseout mirrors the `hasVerifiedAcceptanceCriteria` signal;
19
+ * close-out does NOT re-run the test harness — that is verify-acs's job).
20
+ * 3. complete — when (and only when) the gate says so, the engine writes
21
+ * `status: complete` (markSpecComplete). An optional `--update-registry`
22
+ * delegation to a consumer audit script remains a separate, explicit
23
+ * opt-in handled by the command layer.
24
+ */
25
+ export type CloseoutRow = {
26
+ id: string;
27
+ core: string;
28
+ /** The conservative gate's verdict (decideCloseout). */
29
+ decision: CloseoutDecision;
30
+ /** The status value written, or that WOULD be written in a dry-run, or null. */
31
+ status: 'complete' | 'in_progress' | null;
32
+ /** True only when this run actually wrote a new `status:` to the spec file. */
33
+ written: boolean;
34
+ /** The reconcile divergence row (pipeline_status recompute) computed as step 1. */
35
+ reconcile: ReconcileRow;
36
+ };
37
+ export type CloseoutSpecOptions = CloseoutOptions & {
38
+ /** When false (dry-run), compute the decision + reconcile divergence but write nothing. */
39
+ write: boolean;
40
+ };
41
+ /**
42
+ * Close out a single spec: reconcile, decide, and (when `write`) materialize the
43
+ * verified `status:` promotion. The decision is computed against the
44
+ * artifact-recomputed stage so a dry-run preview and a real write always agree.
45
+ */
46
+ export declare function closeOutSpec(repoRoot: string, spec: SpecFile, opts: CloseoutSpecOptions): CloseoutRow;
@@ -0,0 +1,34 @@
1
+ import { readFileSync, writeFileSync } from 'node:fs';
2
+ import { decideCloseout } from './closeout-predicate.js';
3
+ import { markSpecComplete, readFrontmatter, setStatus } from './frontmatter.js';
4
+ import { reconcileSpec } from './reconcile-core.js';
5
+ /**
6
+ * Close out a single spec: reconcile, decide, and (when `write`) materialize the
7
+ * verified `status:` promotion. The decision is computed against the
8
+ * artifact-recomputed stage so a dry-run preview and a real write always agree.
9
+ */
10
+ export function closeOutSpec(repoRoot, spec, opts) {
11
+ const { write, ...decisionOpts } = opts;
12
+ // Step 1 — reconcile. In a real run this writes the artifact-computed
13
+ // `pipeline_status` back; in a dry-run nothing is written, but we still capture the
14
+ // computed stage and feed it to the gate below so dry-run == apply.
15
+ const reconcile = reconcileSpec(repoRoot, spec, write);
16
+ // Step 2 — decide. Read the (possibly just-reconciled) frontmatter and overlay the
17
+ // artifact-computed stage so the gate keys on reality, not a stale/lagging value.
18
+ const text = readFileSync(spec.path, 'utf8');
19
+ const fm = readFrontmatter(text);
20
+ const effectiveFm = { ...fm, pipeline_status: reconcile.computed ?? fm.pipeline_status };
21
+ const decision = decideCloseout(effectiveFm, decisionOpts);
22
+ // Step 3 — promote. The engine OWNS the verified status write; it happens only when
23
+ // the gate returned a status AND --write (non-dry-run) was requested.
24
+ let written = false;
25
+ if (write && decision.nextStatus) {
26
+ const next = decision.nextStatus === 'complete' ? markSpecComplete(text) : setStatus(text, decision.nextStatus);
27
+ if (next !== text) {
28
+ writeFileSync(spec.path, next, 'utf8');
29
+ written = true;
30
+ }
31
+ }
32
+ return { id: spec.id, core: spec.core, decision, status: decision.nextStatus, written, reconcile };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CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;QAChH,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;YACvC,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACrG,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { SpecFrontmatter } from './frontmatter.js';
2
+ import { type RequirementStatus } from './requirements.js';
3
+ /** The pipeline stage a spec must have reached before close-out will promote it.
4
+ * It is the terminal stage of BOTH built-in layouts — `ENCORE1_PIPELINE_SCHEMA` and
5
+ * `BUILDER_PIPELINE_SCHEMA` `statusOrder` both end on it — kept as a named constant
6
+ * so the canonical predicate carries no magic string. A consumer on a custom layout
7
+ * can override it via {@link CloseoutOptions.terminalStage}. */
8
+ export declare const CLOSEOUT_TERMINAL_STAGE = "tasks_generated";
9
+ /** The default closeable AC vocabulary: encoreos's binary planned->verified model.
10
+ * A consumer on the builder/Switchboard model passes `['verified', 'hand_closed']`
11
+ * (and may add `'deferred'`) via {@link CloseoutOptions.closeableStatuses}. */
12
+ export declare const DEFAULT_CLOSEABLE_AC_STATUSES: readonly RequirementStatus[];
13
+ /** Pre-work `status:` values that close-out may UPGRADE to `in_progress` once work
14
+ * has demonstrably started (>=1 closeable AC) but the spec is not yet closeable. An
15
+ * empty/absent status is also treated as pre-work. Conservative: a status OUTSIDE
16
+ * this set is human-meaningful and is left untouched (we never clobber it). */
17
+ export declare const DEFAULT_PRE_WORK_STATUSES: readonly string[];
18
+ export type CloseoutOptions = {
19
+ /** AC statuses that count as terminally closed (default `['verified']`). */
20
+ closeableStatuses?: readonly string[];
21
+ /** The pipeline stage gating promotion (default `'tasks_generated'`). */
22
+ terminalStage?: string;
23
+ /** Pre-work statuses eligible for the in_progress nudge (default {@link DEFAULT_PRE_WORK_STATUSES}). */
24
+ preWorkStatuses?: readonly string[];
25
+ };
26
+ export type CloseoutDecision = {
27
+ /** `'complete'` => promote; `'in_progress'` => nudge a pre-work status; `null` => leave unchanged. */
28
+ nextStatus: 'complete' | 'in_progress' | null;
29
+ /** Human-readable justification — surfaced in `--json` output and per-spec telemetry. */
30
+ reason: string;
31
+ };
32
+ /**
33
+ * Decide whether the spec described by `fm` may be closed out. Pure over parsed
34
+ * frontmatter; see the module header for the canonical predicate and invariants.
35
+ */
36
+ export declare function decideCloseout(fm: SpecFrontmatter, opts?: CloseoutOptions): CloseoutDecision;
@@ -0,0 +1,130 @@
1
+ /**
2
+ * The conservative close-out gate (issue #30, TOOL-06 terminal complement).
3
+ *
4
+ * `decideCloseout` is the single source of truth for whether a spec's
5
+ * org-lifecycle `status:` may be promoted to `complete` — the verified close-out
6
+ * the engine now OWNS rather than delegating to a consumer audit script
7
+ * (docs/adr/0001-engine-owns-verified-close-out-status-promotion.md). It is a PURE
8
+ * leaf: it reads ONLY already-parsed frontmatter (no node:fs, no child_process, no
9
+ * network), so it sits behind the package main entry yet stays as cheap and
10
+ * side-effect-free as the predicate registry it mirrors. (Deliberately NOT wired
11
+ * into `/pure` — see CLAUDE.md; it is importable from the main graph.)
12
+ *
13
+ * The canonical predicate (deliberately conservative — never blind-stamp):
14
+ * closeable(spec) <=>
15
+ * nonEmpty(acceptance_criteria)
16
+ * AND acceptance_criteria.every(ac => ac.status in closeableStatuses)
17
+ * AND pipeline_status === terminalStage (default 'tasks_generated')
18
+ * => status: complete
19
+ * else: leave unchanged (null) — or nudge a *pre-work* status to in_progress once
20
+ * some ACs are terminal but the spec is not yet closeable.
21
+ *
22
+ * Two invariants the verb must never break:
23
+ * 1. NEVER downgrade an already complete / archived / superseded / deferred spec —
24
+ * those are terminal org-lifecycle states; close-out returns `null` for them.
25
+ * 2. NEVER promote past the evidence — a single `planned` AC, or a pipeline_status
26
+ * short of the terminal stage, blocks `complete`.
27
+ *
28
+ * The terminal AC vocabulary is PARAMETRIZED so both consuming layouts pass:
29
+ * - encoreos: the binary planned->verified model => closeableStatuses ['verified'].
30
+ * - Switchboard/builder: verified + hand_closed => ['verified', 'hand_closed'].
31
+ * It mirrors the existing `hasVerifiedAcceptanceCriteria` signal (which keys on
32
+ * `allAcceptanceCriteriaTerminal`) but is STRICTER by default: only `verified`
33
+ * closes a spec unless the consumer opts `hand_closed`/`deferred` in.
34
+ */
35
+ import { isCompleteStatus, isTerminalStatus } from './blockers.js';
36
+ import { normalizeAcceptanceCriteria } from './requirements.js';
37
+ /** The pipeline stage a spec must have reached before close-out will promote it.
38
+ * It is the terminal stage of BOTH built-in layouts — `ENCORE1_PIPELINE_SCHEMA` and
39
+ * `BUILDER_PIPELINE_SCHEMA` `statusOrder` both end on it — kept as a named constant
40
+ * so the canonical predicate carries no magic string. A consumer on a custom layout
41
+ * can override it via {@link CloseoutOptions.terminalStage}. */
42
+ export const CLOSEOUT_TERMINAL_STAGE = 'tasks_generated';
43
+ /** The default closeable AC vocabulary: encoreos's binary planned->verified model.
44
+ * A consumer on the builder/Switchboard model passes `['verified', 'hand_closed']`
45
+ * (and may add `'deferred'`) via {@link CloseoutOptions.closeableStatuses}. */
46
+ export const DEFAULT_CLOSEABLE_AC_STATUSES = ['verified'];
47
+ /** Pre-work `status:` values that close-out may UPGRADE to `in_progress` once work
48
+ * has demonstrably started (>=1 closeable AC) but the spec is not yet closeable. An
49
+ * empty/absent status is also treated as pre-work. Conservative: a status OUTSIDE
50
+ * this set is human-meaningful and is left untouched (we never clobber it). */
51
+ export const DEFAULT_PRE_WORK_STATUSES = [
52
+ 'draft',
53
+ 'todo',
54
+ 'backlog',
55
+ 'planned',
56
+ 'not started',
57
+ 'not_started',
58
+ 'stub',
59
+ 'new',
60
+ 'open',
61
+ ];
62
+ /** True when `status` is empty/absent or one of the pre-work values (eligible for the nudge). */
63
+ function isPreWork(status, set) {
64
+ if (status === undefined)
65
+ return true;
66
+ const norm = status.trim().toLowerCase();
67
+ if (norm === '')
68
+ return true;
69
+ return set.includes(norm);
70
+ }
71
+ /**
72
+ * Decide whether the spec described by `fm` may be closed out. Pure over parsed
73
+ * frontmatter; see the module header for the canonical predicate and invariants.
74
+ */
75
+ export function decideCloseout(fm, opts = {}) {
76
+ const closeable = opts.closeableStatuses ?? DEFAULT_CLOSEABLE_AC_STATUSES;
77
+ const terminalStage = opts.terminalStage ?? CLOSEOUT_TERMINAL_STAGE;
78
+ const preWork = opts.preWorkStatuses ?? DEFAULT_PRE_WORK_STATUSES;
79
+ // (1) Terminal-state guard: NEVER downgrade. An already complete/implemented spec,
80
+ // or an archived/superseded/blocked/deferred one, is left exactly as-is. Keys on the
81
+ // org-lifecycle `status` axis (+ the `superseded_by` pointer), mirroring the
82
+ // navigator's own terminal checks (isCompleteStatus / isTerminalStatus in blockers.ts).
83
+ if (isCompleteStatus(fm.status)) {
84
+ return { nextStatus: null, reason: `already complete (status: ${fm.status}); never downgrade` };
85
+ }
86
+ if (isTerminalStatus(fm.status, fm.superseded_by)) {
87
+ const why = fm.superseded_by ? `superseded_by: ${fm.superseded_by}` : `status: ${fm.status}`;
88
+ return { nextStatus: null, reason: `terminal org-lifecycle state (${why}); never downgrade` };
89
+ }
90
+ // (2) ACs are the unit of evidence. No well-formed AC => nothing to close out.
91
+ // (Malformed/id-less entries are dropped by normalizeAcceptanceCriteria — `validate`
92
+ // flags them separately — so they never silently satisfy the gate.)
93
+ const acs = normalizeAcceptanceCriteria(fm.acceptance_criteria).acs;
94
+ if (acs.length === 0) {
95
+ return { nextStatus: null, reason: 'no acceptance criteria — nothing to close out' };
96
+ }
97
+ const closeableSet = new Set(closeable);
98
+ const remaining = acs.filter((ac) => !closeableSet.has(ac.status));
99
+ const allCloseable = remaining.length === 0;
100
+ const someClosed = acs.some((ac) => closeableSet.has(ac.status));
101
+ const pipelineReady = fm.pipeline_status === terminalStage;
102
+ // (3) Closeable => promote to complete (the verified close-out the engine owns).
103
+ if (allCloseable && pipelineReady) {
104
+ return {
105
+ nextStatus: 'complete',
106
+ reason: `all ${acs.length} AC(s) in {${closeable.join(', ')}} and pipeline_status=${terminalStage}`,
107
+ };
108
+ }
109
+ // (4) Not closeable. Offer a conservative in_progress UPGRADE only when work has
110
+ // demonstrably started (>=1 closeable AC) AND the current status is pre-work — never
111
+ // a no-op restamp, never a clobber of a human-meaningful status, never a downgrade.
112
+ if (someClosed && !allCloseable && isPreWork(fm.status, preWork)) {
113
+ return {
114
+ nextStatus: 'in_progress',
115
+ reason: `work in progress — ${acs.length - remaining.length}/${acs.length} AC(s) closed, ${remaining.length} still open`,
116
+ };
117
+ }
118
+ // (5) Otherwise leave unchanged, with a precise reason for the no-op.
119
+ if (!allCloseable) {
120
+ return {
121
+ nextStatus: null,
122
+ reason: `${remaining.length}/${acs.length} AC(s) not in {${closeable.join(', ')}} (e.g. ${remaining[0].id})`,
123
+ };
124
+ }
125
+ return {
126
+ nextStatus: null,
127
+ reason: `ACs closeable but pipeline_status=${fm.pipeline_status ?? '(none)'} != ${terminalStage}`,
128
+ };
129
+ }
130
+ //# sourceMappingURL=closeout-predicate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"closeout-predicate.js","sourceRoot":"","sources":["../../src/lib/closeout-predicate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EAAE,2BAA2B,EAA0B,MAAM,mBAAmB,CAAC;AAExF;;;;iEAIiE;AACjE,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AAEzD;;gFAEgF;AAChF,MAAM,CAAC,MAAM,6BAA6B,GAAiC,CAAC,UAAU,CAAC,CAAC;AAExF;;;gFAGgF;A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,GAAG,SAAS,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,kBAAkB,SAAS,CAAC,MAAM,aAAa;SACzH,CAAC;IACJ,CAAC;IAED,sEAAsE;IACtE,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO;YACL,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,kBAAkB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,SAAS,CAAC,CAAC,CAAE,CAAC,EAAE,GAAG;SAC9G,CAAC;IACJ,CAAC;IACD,OAAO;QACL,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,qCAAqC,EAAE,CAAC,eAAe,IAAI,QAAQ,OAAO,aAAa,EAAE;KAClG,CAAC;AACJ,CAAC"}
package/dist/lib/cost.js CHANGED
@@ -2,6 +2,13 @@
2
2
  * Cross-package import is blocked by tools/eos-spec's tsconfig rootDir; tests assert parity. */
3
3
  export const MODEL_RATES = {
4
4
  'anthropic/claude-sonnet-4': { promptPer1m: 3, completionPer1m: 15 },
5
+ // TOOL-06 local models (`eos-spec run` default offload, Ollama): self-hosted, so
6
+ // their marginal token cost is $0. Listing them with zero rates makes a
7
+ // strict-local run report $0.0000 (an honest "free"), rather than `(unknown)`
8
+ // which a missing rate would yield. An unknown local model still returns null
9
+ // (handled in metrics) — only these named defaults are pinned to zero.
10
+ 'qwen3-coder:30b': { promptPer1m: 0, completionPer1m: 0 },
11
+ 'gpt-oss:20b': { promptPer1m: 0, completionPer1m: 0 },
5
12
  };
6
13
  export function computeCostUsd(model, tokens) {
7
14
  const rate = MODEL_RATES[model];
@@ -1 +1 @@
1
- {"version":3,"file":"cost.js","sourceRoot":"","sources":["../../src/lib/cost.ts"],"names":[],"mappings":"AAAA;iGACiG;AACjG,MAAM,CAAC,MAAM,WAAW,GAAqE;IAC3F,2BAA2B,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE;CACrE,CAAC;AAIF,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,MAAgB;IAC5D,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;AACnG,CAAC"}
1
+ {"version":3,"file":"cost.js","sourceRoot":"","sources":["../../src/lib/cost.ts"],"names":[],"mappings":"AAAA;iGACiG;AACjG,MAAM,CAAC,MAAM,WAAW,GAAqE;IAC3F,2BAA2B,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE;IACpE,iFAAiF;IACjF,wEAAwE;IACxE,8EAA8E;IAC9E,8EAA8E;IAC9E,uEAAuE;IACvE,iBAAiB,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE;IACzD,aAAa,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE;CACtD,CAAC;AAIF,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,MAAgB;IAC5D,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;AACnG,CAAC"}
@@ -20,12 +20,26 @@ export type EosSpecEvent = {
20
20
  /** Enforcement-gate fields (harness-spec-awareness design §4.6) — set when a
21
21
  * gate fires; consumed later by gate-precision reporting. Additive, optional. */
22
22
  gate?: string;
23
- verdict?: 'pass' | 'warn' | 'block';
23
+ /** 'info' marks an advisory gate that fired with nothing to flag (e.g. a
24
+ * zero-hit precedent run); 'error' marks a fail-open gate whose own logic
25
+ * threw — both keep silent paths measurable (issue #1077 / design §4.6). */
26
+ verdict?: 'pass' | 'warn' | 'block' | 'info' | 'error';
24
27
  overridden?: boolean;
25
28
  /** D1 halt-cause taxonomy: when ok=false, why. 'gate' = a governance gate
26
29
  * fired (expected, autonomy working); 'crash' = unexpected tooling failure.
27
30
  * Derived at read time if absent; writers may set it explicitly. */
28
31
  haltCause?: 'gate' | 'crash';
32
+ /** TOOL-06 (`eos-spec run`) gate-offload fields — set on a per-gate executor
33
+ * event so `metrics` can roll up per-gate model/executor/autonomy and the
34
+ * local-vs-cloud ratio. All optional + additive. */
35
+ /** Which executor ran the gate (e.g. 'direct-model'). Presence marks an event
36
+ * as a gate-offload event for the metrics execution rollup. */
37
+ executor?: string;
38
+ /** The run's autonomy mode the gate executed under ('drive'). */
39
+ autonomy?: string;
40
+ /** True when the gate fell back from an unhealthy LOCAL endpoint to the cloud
41
+ * gateway (AC-4). Absent/false ⇒ the gate ran on the local model. */
42
+ escalatedToCloud?: boolean;
29
43
  /** D3 run correlation: an opaque, PHI-free id for the originating process/run.
30
44
  * Set once per process (see RUN_ID below) — never a spec title/path. */
31
45
  runId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/lib/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA+B1C;;;;0EAI0E;AAC1E,MAAM,CAAC,MAAM,MAAM,GAAW,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,UAAU,EAAE,CAAC;AAE1E;kFACkF;AAClF,MAAM,CAAC,MAAM,oB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AAU,UAAU,CAAC,OAAgC;IACzD,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,IAAI,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QAC1C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;YAAE,SAAS;QACpD,MAAM,IAAI,GAAG,KAAK,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;QACjE,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -9,6 +9,8 @@ export type SpecFrontmatter = {
9
9
  status?: string;
10
10
  /** The id of the spec that supersedes this one. Present ⇒ terminal (C2/C3). */
11
11
  superseded_by?: string;
12
+ /** Ids this spec supersedes (the inverse edge of superseded_by). */
13
+ supersedes?: unknown;
12
14
  pipeline_status?: string;
13
15
  research_appendix?: string;
14
16
  acceptance_criteria?: unknown[];
@@ -34,6 +36,42 @@ export type SpecFrontmatter = {
34
36
  * Returns the text unchanged when there is no frontmatter block.
35
37
  */
36
38
  export declare function setPipelineStatus(text: string, status: string): string;
39
+ /**
40
+ * Surgically set the org-lifecycle `status:` field inside the leading frontmatter
41
+ * block (scalar field, exactly like {@link setPipelineStatus}). Replaces the
42
+ * existing top-level `status:` line or appends one. The replace regex is
43
+ * column-0-anchored, so it NEVER touches `pipeline_status:` (a different key) or an
44
+ * indented per-AC `status:` inside an `acceptance_criteria:` list item. Returns the
45
+ * text unchanged when there is no frontmatter block.
46
+ *
47
+ * This is the engine's canonical writer for the verified close-out promotion
48
+ * (docs/adr/0001-engine-owns-verified-close-out-status-promotion.md): close-out
49
+ * OWNS the `status:` -> complete write in-engine rather than delegating it to a
50
+ * consumer audit script. (`backfill` still owns the inverse DOWNGRADE via its own
51
+ * `rewriteStatusLine`; these are deliberately separate verbs.)
52
+ */
53
+ export declare function setStatus(text: string, status: string): string;
54
+ /**
55
+ * Mark a spec complete by setting `status: complete` — the verified close-out the
56
+ * engine owns (ADR-0001). A thin, intention-revealing wrapper over {@link setStatus};
57
+ * the `close-out` verb gates the call behind the conservative `decideCloseout`
58
+ * predicate, so this is only ever reached on real, AC-backed evidence.
59
+ */
60
+ export declare function markSpecComplete(text: string): string;
61
+ /**
62
+ * Surgically set `superseded_by: <id>` in the leading frontmatter block (scalar
63
+ * field, like pipeline_status). Replaces the existing line or appends one. Used by
64
+ * `archive --superseded-by` to record the successor on the archived spec (#1077).
65
+ */
66
+ export declare function setSupersededBy(text: string, id: string): string;
67
+ /**
68
+ * Idempotently add `id` to the `supersedes` array (flow style) in the leading
69
+ * frontmatter block, preserving any existing entries. Replaces an inline or
70
+ * block-form `supersedes:`; otherwise appends one. Returns the text unchanged
71
+ * when `id` is already present. The inverse edge of `setSupersededBy` — written to
72
+ * the SUCCESSOR spec by `archive --superseded-by` (#1077).
73
+ */
74
+ export declare function addSupersedes(text: string, id: string): string;
37
75
  /**
38
76
  * Idempotently set `artifacts.tasks: <rel>` inside the leading frontmatter block.
39
77
  * Replaces an existing `tasks:` child under `artifacts:`, inserts one under an
@@ -17,6 +17,82 @@ export function setPipelineStatus(text, status) {
17
17
  // function replacer avoids `$` in newBlock being treated as a backreference
18
18
  return text.replace(FRONTMATTER_RE, () => `---\n${newBlock}\n---`);
19
19
  }
20
+ /**
21
+ * Surgically set the org-lifecycle `status:` field inside the leading frontmatter
22
+ * block (scalar field, exactly like {@link setPipelineStatus}). Replaces the
23
+ * existing top-level `status:` line or appends one. The replace regex is
24
+ * column-0-anchored, so it NEVER touches `pipeline_status:` (a different key) or an
25
+ * indented per-AC `status:` inside an `acceptance_criteria:` list item. Returns the
26
+ * text unchanged when there is no frontmatter block.
27
+ *
28
+ * This is the engine's canonical writer for the verified close-out promotion
29
+ * (docs/adr/0001-engine-owns-verified-close-out-status-promotion.md): close-out
30
+ * OWNS the `status:` -> complete write in-engine rather than delegating it to a
31
+ * consumer audit script. (`backfill` still owns the inverse DOWNGRADE via its own
32
+ * `rewriteStatusLine`; these are deliberately separate verbs.)
33
+ */
34
+ export function setStatus(text, status) {
35
+ const match = FRONTMATTER_RE.exec(text);
36
+ if (!match)
37
+ return text;
38
+ const block = match[1];
39
+ const line = `status: ${status}`;
40
+ // `^status:` (no leading whitespace) cannot match `pipeline_status:` (starts with
41
+ // `p`) nor an indented list-item `status:` — only the top-level org-lifecycle key.
42
+ const statusLineRe = /^status:.*$/m;
43
+ const newBlock = statusLineRe.test(block) ? block.replace(statusLineRe, line) : `${block}\n${line}`;
44
+ if (newBlock === block)
45
+ return text;
46
+ return text.replace(FRONTMATTER_RE, () => `---\n${newBlock}\n---`);
47
+ }
48
+ /**
49
+ * Mark a spec complete by setting `status: complete` — the verified close-out the
50
+ * engine owns (ADR-0001). A thin, intention-revealing wrapper over {@link setStatus};
51
+ * the `close-out` verb gates the call behind the conservative `decideCloseout`
52
+ * predicate, so this is only ever reached on real, AC-backed evidence.
53
+ */
54
+ export function markSpecComplete(text) {
55
+ return setStatus(text, 'complete');
56
+ }
57
+ /**
58
+ * Surgically set `superseded_by: <id>` in the leading frontmatter block (scalar
59
+ * field, like pipeline_status). Replaces the existing line or appends one. Used by
60
+ * `archive --superseded-by` to record the successor on the archived spec (#1077).
61
+ */
62
+ export function setSupersededBy(text, id) {
63
+ const match = FRONTMATTER_RE.exec(text);
64
+ if (!match)
65
+ return text;
66
+ const block = match[1];
67
+ const line = `superseded_by: ${id}`;
68
+ const newBlock = /^superseded_by:.*$/m.test(block) ? block.replace(/^superseded_by:.*$/m, line) : `${block}\n${line}`;
69
+ if (newBlock === block)
70
+ return text;
71
+ return text.replace(FRONTMATTER_RE, () => `---\n${newBlock}\n---`);
72
+ }
73
+ /**
74
+ * Idempotently add `id` to the `supersedes` array (flow style) in the leading
75
+ * frontmatter block, preserving any existing entries. Replaces an inline or
76
+ * block-form `supersedes:`; otherwise appends one. Returns the text unchanged
77
+ * when `id` is already present. The inverse edge of `setSupersededBy` — written to
78
+ * the SUCCESSOR spec by `archive --superseded-by` (#1077).
79
+ */
80
+ export function addSupersedes(text, id) {
81
+ const match = FRONTMATTER_RE.exec(text);
82
+ if (!match)
83
+ return text;
84
+ const block = match[1];
85
+ const existing = (() => {
86
+ const v = readFrontmatter(text).supersedes;
87
+ return Array.isArray(v) ? v.filter((x) => typeof x === 'string') : [];
88
+ })();
89
+ if (existing.includes(id))
90
+ return text; // idempotent
91
+ const flow = `supersedes: [${[...existing, id].join(', ')}]`;
92
+ const keyRe = /^supersedes:.*$(\r?\n[ \t]+-.*$)*/m;
93
+ const newBlock = keyRe.test(block) ? block.replace(keyRe, flow) : `${block}\n${flow}`;
94
+ return text.replace(FRONTMATTER_RE, () => `---\n${newBlock}\n---`);
95
+ }
20
96
  /**
21
97
  * Idempotently set `artifacts.tasks: <rel>` inside the leading frontmatter block.
22
98
  * Replaces an existing `tasks:` child under `artifacts:`, inserts one under an
@@ -1 +1 @@
1
- {"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/lib/frontmatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAkCzD,MAAM,cAAc,GAAG,6BAA6B,CAAC;AAErD;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,MAAc;IAC5D,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,IAAI,CAAC,KAAK;QAAE,O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AAC;YAAE,GAAG,EAAE,CAAC;QACnE,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,KAAK,GAAG,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;QACnF,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACzE,CAAC;IACD,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,QAAQ,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,QAAQ,QAAQ,OAAO,CAAC,CAAC;AACrE,CAAC"}
@@ -0,0 +1,80 @@
1
+ import { logAiCall } from './ai-call.js';
2
+ import { type HealthResult } from './llm-health.js';
3
+ import type { SpecFile } from './specs.js';
4
+ /** Default LOCAL endpoint — Ollama's OpenAI-compatible API (issue #29). */
5
+ export declare const DEFAULT_LLM_BASE_URL = "http://localhost:11434/v1";
6
+ /** Default LOCAL model — overridable via EOS_SPEC_LLM_MODEL. */
7
+ export declare const DEFAULT_LOCAL_MODEL = "qwen3-coder:30b";
8
+ /** Result of a single model call (text + normalized token counts). */
9
+ export type GateModelResult = {
10
+ text: string;
11
+ tokens: {
12
+ prompt: number;
13
+ completion: number;
14
+ total: number;
15
+ };
16
+ };
17
+ /** Injectable model caller. The default dispatches a raw OpenAI-compatible fetch
18
+ * for the LOCAL endpoint and the `ai` SDK for the CLOUD gateway; tests inject a
19
+ * canned implementation. */
20
+ export type ModelCaller = (args: {
21
+ prompt: string;
22
+ model: string;
23
+ baseURL: string;
24
+ endpoint: 'local' | 'cloud';
25
+ }) => Promise<GateModelResult>;
26
+ /** The gates the Phase-1a direct-model executor knows how to drive (all produce a
27
+ * document / frontmatter / scaffold artifact — no coding-agent loop). */
28
+ export declare const SUPPORTED_GATES: ReadonlySet<string>;
29
+ export type DirectExecutorRequest = {
30
+ gate: string;
31
+ spec: SpecFile;
32
+ repoRoot: string;
33
+ /** Current spec file content (for prompt building). */
34
+ specText: string;
35
+ baseURL: string;
36
+ localModel: string;
37
+ cloudModel: string;
38
+ strictLocal: boolean;
39
+ /** Run autonomy mode, threaded onto the telemetry event ('drive'). */
40
+ autonomy: string;
41
+ };
42
+ export type DirectExecutorDeps = {
43
+ probe?: (baseURL: string, timeoutMs?: number) => Promise<HealthResult>;
44
+ callModel?: ModelCaller;
45
+ /** Writes the gate's artifact(s); returns the written paths (repo-relative). */
46
+ writeArtifacts?: (gate: string, spec: SpecFile, repoRoot: string, modelText: string) => string[];
47
+ /** Telemetry sink — default {@link logAiCall}. Injected in tests. */
48
+ log?: typeof logAiCall;
49
+ now?: () => number;
50
+ };
51
+ /** The executor's outcome — a superset of run-pipeline's `GateExecution`. */
52
+ export type GateExecResult = {
53
+ ok: boolean;
54
+ executor: 'direct-model';
55
+ endpoint?: 'local' | 'cloud';
56
+ model?: string;
57
+ escalatedToCloud?: boolean;
58
+ artifacts?: string[];
59
+ error?: string;
60
+ /** strict-local health halt — the run must stop with no fallback (AC-3). */
61
+ halt?: boolean;
62
+ tokens?: {
63
+ prompt: number;
64
+ completion: number;
65
+ total: number;
66
+ };
67
+ };
68
+ /** Build the gate-specific prompt routed to the model. draft-acs reuses the
69
+ * canonical AC-draft prompt (strict-JSON output the parser understands); the
70
+ * other gates ask for the document the gate's artifact captures. */
71
+ export declare function buildGatePrompt(gate: string, spec: SpecFile, specText: string): string;
72
+ /** Dispatch a gate to its artifact writer. Throws on an unsupported gate so the
73
+ * executor reports it as an error (the driver then halts). */
74
+ export declare function writeGateArtifacts(gate: string, spec: SpecFile, repoRoot: string, modelText: string): string[];
75
+ /**
76
+ * Execute one gate against the model and write its artifact. Decides local vs.
77
+ * cloud from a health probe + `--strict-local`, emits exactly one gate-tagged
78
+ * telemetry event, and returns the structured outcome the driver records.
79
+ */
80
+ export declare function directModelExecutor(req: DirectExecutorRequest, deps?: DirectExecutorDeps): Promise<GateExecResult>;