@miller-tech/uap 1.155.0 → 1.156.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.
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Mission acceptance gate — the per-turn judge composition extracted from
3
+ * deliver.ts (the spec registry's consumer twin): execution + visual gates in
4
+ * primary mode, spec resolution per root, judge invocation with runtime
5
+ * evidence, and the secondary-mode churn breaker. deliver.ts keeps only the
6
+ * wiring decision (acceptance on? primary or secondary?).
7
+ *
8
+ * Modes:
9
+ * - PRIMARY (no real project gates): the judge IS the convergence target, so
10
+ * the artifact must actually RUN before completeness is judged — the
11
+ * execution gate closes the gap where a 1-turn build could be declared
12
+ * delivered on the judge alone, and the visual gate watches it run (blank
13
+ * canvas / static rAF scene / runtime errors block acceptance).
14
+ * - SECONDARY (objective gates exist): this gate is reached ONLY on turns
15
+ * whose objective gates all passed; that fact is handed to the judge as
16
+ * evidence, and a bounded number of consecutive judge rejections hands the
17
+ * verdict back to the gates (churn breaker) instead of wedging.
18
+ */
19
+ import type { AcceptanceGate, LoopExecutor } from './convergence-loop.js';
20
+ import { runAcceptanceGate, type AcceptanceResult } from './acceptance-judge.js';
21
+ import { runExecutionGate } from './execution-gate.js';
22
+ import { runVisualGate } from './visual-gate.js';
23
+ import { buildUserPathsNote } from './user-validation.js';
24
+ import type { SpecRegistry } from './spec-registry.js';
25
+ /**
26
+ * Fold a raw judge result into the loop-facing verdict, honoring primary vs
27
+ * secondary mode. PURE — unit-tested in isolation from the model call.
28
+ *
29
+ * - Genuine fully-met verdict → pass.
30
+ * - PRIMARY (acceptance is the sole convergence target): an inconclusive /
31
+ * no-evidence verdict is NOT "done" — fail so the loop keeps building.
32
+ * A parse error also omits the score: runAcceptanceGate reports score:1 on
33
+ * its fail-open paths, which would otherwise saturate the loop's
34
+ * acceptance-progress (bestAcceptance) and mask real per-criterion gains.
35
+ * - SECONDARY (real objective gates exist): fail OPEN on judge flakiness — a
36
+ * green objective delivery is never blocked by the judge's nondeterminism.
37
+ */
38
+ export declare function resolveAcceptanceVerdict(r: AcceptanceResult, acceptancePrimary: boolean): {
39
+ passed: boolean;
40
+ feedback: string;
41
+ score?: number;
42
+ };
43
+ export interface MissionAcceptanceDeps {
44
+ /** Primary mode: the judge is the convergence target (no real gates). */
45
+ primary: boolean;
46
+ /** Spec + evidence + churn-breaker owner (see spec-registry.ts). */
47
+ specs: SpecRegistry;
48
+ /** The judge model call (JSON-verdict executor). */
49
+ judgeExecutor: LoopExecutor;
50
+ /** Breaker-override warning line — the one operator signal that the judge
51
+ * was overruled. Defaults to console.log; callers decorate with chalk. */
52
+ note?: (line: string) => void;
53
+ /** Test seams — default to the real gates. */
54
+ executionGate?: typeof runExecutionGate;
55
+ visualGate?: typeof runVisualGate;
56
+ judge?: typeof runAcceptanceGate;
57
+ userPathsNote?: typeof buildUserPathsNote;
58
+ }
59
+ /** Build the per-turn acceptance gate the convergence loop calls with a root. */
60
+ export declare function buildMissionAcceptanceGate(deps: MissionAcceptanceDeps): AcceptanceGate;
61
+ //# sourceMappingURL=mission-acceptance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mission-acceptance.d.ts","sourceRoot":"","sources":["../../src/delivery/mission-acceptance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EACL,iBAAiB,EAEjB,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAqB,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CACtC,CAAC,EAAE,gBAAgB,EACnB,iBAAiB,EAAE,OAAO,GACzB;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAavD;AAED,MAAM,WAAW,qBAAqB;IACpC,yEAAyE;IACzE,OAAO,EAAE,OAAO,CAAC;IACjB,oEAAoE;IACpE,KAAK,EAAE,YAAY,CAAC;IACpB,oDAAoD;IACpD,aAAa,EAAE,YAAY,CAAC;IAC5B;8EAC0E;IAC1E,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,8CAA8C;IAC9C,aAAa,CAAC,EAAE,OAAO,gBAAgB,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,aAAa,CAAC;IAClC,KAAK,CAAC,EAAE,OAAO,iBAAiB,CAAC;IACjC,aAAa,CAAC,EAAE,OAAO,kBAAkB,CAAC;CAC3C;AAED,iFAAiF;AACjF,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,qBAAqB,GAAG,cAAc,CAwDtF"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Mission acceptance gate — the per-turn judge composition extracted from
3
+ * deliver.ts (the spec registry's consumer twin): execution + visual gates in
4
+ * primary mode, spec resolution per root, judge invocation with runtime
5
+ * evidence, and the secondary-mode churn breaker. deliver.ts keeps only the
6
+ * wiring decision (acceptance on? primary or secondary?).
7
+ *
8
+ * Modes:
9
+ * - PRIMARY (no real project gates): the judge IS the convergence target, so
10
+ * the artifact must actually RUN before completeness is judged — the
11
+ * execution gate closes the gap where a 1-turn build could be declared
12
+ * delivered on the judge alone, and the visual gate watches it run (blank
13
+ * canvas / static rAF scene / runtime errors block acceptance).
14
+ * - SECONDARY (objective gates exist): this gate is reached ONLY on turns
15
+ * whose objective gates all passed; that fact is handed to the judge as
16
+ * evidence, and a bounded number of consecutive judge rejections hands the
17
+ * verdict back to the gates (churn breaker) instead of wedging.
18
+ */
19
+ import { runAcceptanceGate, formatAcceptanceReport, } from './acceptance-judge.js';
20
+ import { runExecutionGate } from './execution-gate.js';
21
+ import { runVisualGate, visualRuntimeNote } from './visual-gate.js';
22
+ import { buildUserPathsNote } from './user-validation.js';
23
+ /**
24
+ * Fold a raw judge result into the loop-facing verdict, honoring primary vs
25
+ * secondary mode. PURE — unit-tested in isolation from the model call.
26
+ *
27
+ * - Genuine fully-met verdict → pass.
28
+ * - PRIMARY (acceptance is the sole convergence target): an inconclusive /
29
+ * no-evidence verdict is NOT "done" — fail so the loop keeps building.
30
+ * A parse error also omits the score: runAcceptanceGate reports score:1 on
31
+ * its fail-open paths, which would otherwise saturate the loop's
32
+ * acceptance-progress (bestAcceptance) and mask real per-criterion gains.
33
+ * - SECONDARY (real objective gates exist): fail OPEN on judge flakiness — a
34
+ * green objective delivery is never blocked by the judge's nondeterminism.
35
+ */
36
+ export function resolveAcceptanceVerdict(r, acceptancePrimary) {
37
+ if (r.passed && !r.parseError)
38
+ return { passed: true, score: r.score, feedback: '' };
39
+ const gaps = `ACCEPTANCE GAPS — implement these to complete the spec:\n${formatAcceptanceReport(r)}`;
40
+ if (acceptancePrimary) {
41
+ if (r.parseError) {
42
+ return {
43
+ passed: false,
44
+ feedback: `Acceptance inconclusive (${r.parseError}). Keep implementing the spec — ensure the source files exist and are complete.`,
45
+ };
46
+ }
47
+ return { passed: false, score: r.score, feedback: gaps };
48
+ }
49
+ return { passed: r.passed, score: r.score, feedback: r.passed ? '' : gaps };
50
+ }
51
+ /** Build the per-turn acceptance gate the convergence loop calls with a root. */
52
+ export function buildMissionAcceptanceGate(deps) {
53
+ const executionGate = deps.executionGate ?? runExecutionGate;
54
+ const visualGate = deps.visualGate ?? runVisualGate;
55
+ const judge = deps.judge ?? runAcceptanceGate;
56
+ const userPathsNote = deps.userPathsNote ?? buildUserPathsNote;
57
+ // eslint-disable-next-line no-console
58
+ const note = deps.note ?? ((line) => console.log(line));
59
+ return async (root) => {
60
+ // Primary mode: the only objective rung is the trivial bootstrap, and the
61
+ // real execution gate joins via redetect only on the NEXT turn (one-turn
62
+ // lag). So gate the artifact's runtime HERE too — idempotent with the
63
+ // redetected execution rung on later turns.
64
+ let visualNote = '';
65
+ if (deps.primary) {
66
+ const exec = await executionGate(root);
67
+ if (!exec.passed) {
68
+ return {
69
+ passed: false,
70
+ feedback: `EXECUTION FAILED — the code must run before it can be accepted:\n${exec.outputTail}`,
71
+ };
72
+ }
73
+ // Visual gate: watch the artifact RUN — the observation summary becomes
74
+ // judge evidence (a code-evidence judge cannot see a never-started
75
+ // animation; this can).
76
+ const visual = await visualGate(root);
77
+ if (!visual.skipped && !visual.passed) {
78
+ return { passed: false, feedback: visual.feedback };
79
+ }
80
+ visualNote = visualRuntimeNote(visual);
81
+ }
82
+ const resolvedSpec = deps.specs.resolve(root);
83
+ const uvNote = userPathsNote(root);
84
+ const baseNote = deps.primary
85
+ ? visualNote
86
+ : 'Objective project gates (build/test suite) ALL PASSED on this turn — treat test/build-related requirements as objectively verified.';
87
+ const runtimeNote = [baseNote, uvNote?.note].filter(Boolean).join(' ');
88
+ const r = await judge({
89
+ spec: resolvedSpec,
90
+ projectRoot: root,
91
+ executor: deps.judgeExecutor,
92
+ ...(runtimeNote ? { runtimeNote } : {}),
93
+ });
94
+ const verdict = resolveAcceptanceVerdict(r, deps.primary);
95
+ // Secondary mode only: bounded consecutive judge rejections of
96
+ // objectively-green turns hand the verdict back to the gates.
97
+ if (!deps.primary) {
98
+ const checked = deps.specs.breaker(resolvedSpec, root).check(resolvedSpec, verdict);
99
+ if (checked.overridden) {
100
+ note('⚖ acceptance: judge rejected consecutive objectively-green turns — accepting on gates (raise UAP_DELIVER_ACCEPTANCE_FLIP_LIMIT to let the judge argue longer)');
101
+ }
102
+ return checked;
103
+ }
104
+ return verdict;
105
+ };
106
+ }
107
+ //# sourceMappingURL=mission-acceptance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mission-acceptance.js","sourceRo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CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO;YAC3B,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,qIAAqI,CAAC;QAC1I,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvE,MAAM,CAAC,GAAG,MAAM,KAAK,CAAC;YACpB,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,IAAI;YACjB,QAAQ,EAAE,IAAI,CAAC,aAAa;YAC5B,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACxC,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,wBAAwB,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1D,+DAA+D;QAC/D,8DAA8D;QAC9D,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YACpF,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;gBACvB,IAAI,CACF,+JAA+J,CAChK,CAAC;YACJ,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miller-tech/uap",
3
- "version": "1.155.0",
3
+ "version": "1.156.0",
4
4
  "description": "Autonomous AI agent memory system with CLAUDE.md protocol enforcement",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",