@miller-tech/uap 2.19.5 → 2.21.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.
- package/config/model-profiles/qwen38.json +2 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/benchmarks/benchmark.d.ts +6 -6
- package/dist/bin/cli.js +15 -0
- package/dist/bin/cli.js.map +1 -1
- package/dist/cli/deliver.d.ts +9 -0
- package/dist/cli/deliver.d.ts.map +1 -1
- package/dist/cli/deliver.js +41 -1
- package/dist/cli/deliver.js.map +1 -1
- package/dist/delivery/agentic-executor.d.ts +13 -1
- package/dist/delivery/agentic-executor.d.ts.map +1 -1
- package/dist/delivery/agentic-executor.js +61 -10
- package/dist/delivery/agentic-executor.js.map +1 -1
- package/dist/delivery/applier.d.ts +37 -1
- package/dist/delivery/applier.d.ts.map +1 -1
- package/dist/delivery/applier.js +49 -7
- package/dist/delivery/applier.js.map +1 -1
- package/dist/delivery/convergence-loop.d.ts +48 -0
- package/dist/delivery/convergence-loop.d.ts.map +1 -1
- package/dist/delivery/convergence-loop.js +161 -14
- package/dist/delivery/convergence-loop.js.map +1 -1
- package/dist/delivery/failing-files.d.ts +48 -0
- package/dist/delivery/failing-files.d.ts.map +1 -0
- package/dist/delivery/failing-files.js +112 -0
- package/dist/delivery/failing-files.js.map +1 -0
- package/dist/delivery/gate-spawn.d.ts +66 -0
- package/dist/delivery/gate-spawn.d.ts.map +1 -0
- package/dist/delivery/gate-spawn.js +192 -0
- package/dist/delivery/gate-spawn.js.map +1 -0
- package/dist/delivery/pending-intents.d.ts +37 -4
- package/dist/delivery/pending-intents.d.ts.map +1 -1
- package/dist/delivery/pending-intents.js +178 -20
- package/dist/delivery/pending-intents.js.map +1 -1
- package/dist/delivery/prescribed-replay.d.ts +53 -0
- package/dist/delivery/prescribed-replay.d.ts.map +1 -0
- package/dist/delivery/prescribed-replay.js +196 -0
- package/dist/delivery/prescribed-replay.js.map +1 -0
- package/dist/delivery/self-gate.d.ts +29 -0
- package/dist/delivery/self-gate.d.ts.map +1 -1
- package/dist/delivery/self-gate.js +149 -13
- package/dist/delivery/self-gate.js.map +1 -1
- package/dist/delivery/verifier-ladder.d.ts +7 -0
- package/dist/delivery/verifier-ladder.d.ts.map +1 -1
- package/dist/delivery/verifier-ladder.js +13 -4
- package/dist/delivery/verifier-ladder.js.map +1 -1
- package/docs/architecture/adr/0005-ollama-compatible-surface.md +74 -0
- package/docs/guides/PROXY.md +48 -0
- package/package.json +2 -2
- package/src/policies/enforcers/__pycache__/_common.cpython-312.pyc +0 -0
- package/src/policies/enforcers/__pycache__/expert_review_required.cpython-312.pyc +0 -0
- package/src/policies/enforcers/__pycache__/quality_metrics_gate.cpython-312.pyc +0 -0
- package/templates/hooks/__pycache__/deliver_autoroute.cpython-312.pyc +0 -0
- package/tools/agents/scripts/__pycache__/toolcall_path_normalizer.cpython-312.pyc +0 -0
- package/tools/agents/scripts/anthropic_proxy.py +778 -49
- package/tools/agents/scripts/requirements-proxy.txt +1 -1
- package/tools/agents/tests/test_ollama_compat.py +320 -0
|
@@ -42,8 +42,36 @@ export interface PendingApplyResult {
|
|
|
42
42
|
reason: string;
|
|
43
43
|
}>;
|
|
44
44
|
}
|
|
45
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* An intent plus the log it was read from. The pending log lives at the repo
|
|
47
|
+
* level the DELIVERY GATE was enforcing, while a deliver mission's projectRoot
|
|
48
|
+
* can sit deeper (a crate inside a monorepo). Observed live (run
|
|
49
|
+
* 20261006T042017): the mission prescribed replaying
|
|
50
|
+
* `.uap/pending-deliver.jsonl`, the intents lived at the MONOREPO root's
|
|
51
|
+
* `.uap/`, and a crate-rooted lookup found nothing — the executor then
|
|
52
|
+
* hand-wrote a broken 19KB replacement for content that was already recorded.
|
|
53
|
+
*/
|
|
54
|
+
export interface RootedIntent {
|
|
55
|
+
root: string;
|
|
56
|
+
intent: PendingIntent;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Directories from projectRoot up to (and including) the git root whose
|
|
60
|
+
* `.uap/pending-deliver.jsonl` exists. Closest first.
|
|
61
|
+
*/
|
|
62
|
+
export declare function pendingLogRoots(projectRoot: string): string[];
|
|
63
|
+
/**
|
|
64
|
+
* Read all recorded intents, oldest first, merging every pending log from
|
|
65
|
+
* projectRoot up to the git root and deduping identical intents recorded at
|
|
66
|
+
* more than one level. Unparseable lines are ignored.
|
|
67
|
+
*/
|
|
46
68
|
export declare function readPendingIntents(projectRoot: string): PendingIntent[];
|
|
69
|
+
/**
|
|
70
|
+
* The archived (already-applied) intents, newest last, from every log level —
|
|
71
|
+
* the restore source for a mission that prescribes recorded content the tree
|
|
72
|
+
* has since clobbered (see prescribed-replay.ts).
|
|
73
|
+
*/
|
|
74
|
+
export declare function readAppliedIntents(projectRoot: string): RootedIntent[];
|
|
47
75
|
/**
|
|
48
76
|
* Deterministically apply the recorded intents for `file` (or every file when
|
|
49
77
|
* omitted). Replace-intents require the old_string to match EXACTLY ONCE in
|
|
@@ -51,9 +79,14 @@ export declare function readPendingIntents(projectRoot: string): PendingIntent[]
|
|
|
51
79
|
* the blocked Write would have done). Multiple intents for one file apply in
|
|
52
80
|
* recorded order, so a sequence of blocked Edits replays faithfully.
|
|
53
81
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
82
|
+
* Intents are read from EVERY pending log between projectRoot and the git
|
|
83
|
+
* root (see pendingLogRoots) — the delivery gate records at the level it was
|
|
84
|
+
* enforcing, which may be above a mission's projectRoot.
|
|
85
|
+
*
|
|
86
|
+
* Applied (and detected-already-applied) intents are consumed from the log
|
|
87
|
+
* they were read from — replay is idempotent across runs. Stale-anchor and
|
|
88
|
+
* pre-D1 skips are NOT consumed: they stay visible until an operator resolves
|
|
89
|
+
* or clears them.
|
|
57
90
|
*/
|
|
58
91
|
export declare function applyPendingIntents(projectRoot: string, file?: string): PendingApplyResult;
|
|
59
92
|
//# sourceMappingURL=pending-intents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pending-intents.d.ts","sourceRoot":"","sources":["../../src/delivery/pending-intents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;
|
|
1
|
+
{"version":3,"file":"pending-intents.d.ts","sourceRoot":"","sources":["../../src/delivery/pending-intents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACvE;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAA;KAAE,CAAC,CAAC;IACxE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC9D;AAKD;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,aAAa,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAsB7D;AAmBD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,EAAE,CAevE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,EAAE,CAmBtE;AAuCD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,kBAAkB,CAoI1F"}
|
|
@@ -19,17 +19,47 @@
|
|
|
19
19
|
* hook-detached + manual runs. Stale-anchor skips stay in the log so they
|
|
20
20
|
* remain loudly visible.
|
|
21
21
|
*/
|
|
22
|
-
import { existsSync, readFileSync, writeFileSync, appendFileSync } from 'fs';
|
|
23
|
-
import { join, resolve, relative, isAbsolute } from 'path';
|
|
22
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, writeFileSync, appendFileSync } from 'fs';
|
|
23
|
+
import { join, resolve, relative, isAbsolute, dirname } from 'path';
|
|
24
|
+
import { protectedWritePathReason } from './applier.js';
|
|
24
25
|
const PENDING_LOG = '.uap/pending-deliver.jsonl';
|
|
25
26
|
const APPLIED_LOG = '.uap/pending-deliver.applied.jsonl';
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Directories from projectRoot up to (and including) the git root whose
|
|
29
|
+
* `.uap/pending-deliver.jsonl` exists. Closest first.
|
|
30
|
+
*/
|
|
31
|
+
export function pendingLogRoots(projectRoot) {
|
|
32
|
+
const start = resolve(projectRoot);
|
|
33
|
+
const roots = [];
|
|
34
|
+
let dir = start;
|
|
35
|
+
let foundGit = false;
|
|
36
|
+
for (let hops = 0; hops < 16; hops++) {
|
|
37
|
+
if (existsSync(join(dir, PENDING_LOG)))
|
|
38
|
+
roots.push(dir);
|
|
39
|
+
if (existsSync(join(dir, '.git'))) {
|
|
40
|
+
foundGit = true;
|
|
41
|
+
break; // the git root is the boundary
|
|
42
|
+
}
|
|
43
|
+
const parent = dirname(dir);
|
|
44
|
+
if (parent === dir)
|
|
45
|
+
break;
|
|
46
|
+
dir = parent;
|
|
47
|
+
}
|
|
48
|
+
// No git boundary anywhere in reach (review X5/arch F5): the climb was about
|
|
49
|
+
// to walk straight out of the project into unrelated ancestors — $HOME/.uap
|
|
50
|
+
// pending logs from OTHER projects would merge into this run's replay set.
|
|
51
|
+
// Keep only the project root's own log; crossing repos is the git boundary's
|
|
52
|
+
// job, and there is none.
|
|
53
|
+
if (!foundGit)
|
|
54
|
+
return roots.filter((r) => r === start);
|
|
55
|
+
return roots;
|
|
56
|
+
}
|
|
57
|
+
/** Parse one log file into intents (tolerating garbage lines). */
|
|
58
|
+
function parseIntentsFile(path) {
|
|
59
|
+
if (!existsSync(path))
|
|
30
60
|
return [];
|
|
31
61
|
const intents = [];
|
|
32
|
-
for (const line of readFileSync(
|
|
62
|
+
for (const line of readFileSync(path, 'utf-8').split('\n')) {
|
|
33
63
|
const t = line.trim();
|
|
34
64
|
if (!t)
|
|
35
65
|
continue;
|
|
@@ -44,6 +74,57 @@ export function readPendingIntents(projectRoot) {
|
|
|
44
74
|
}
|
|
45
75
|
return intents;
|
|
46
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Read all recorded intents, oldest first, merging every pending log from
|
|
79
|
+
* projectRoot up to the git root and deduping identical intents recorded at
|
|
80
|
+
* more than one level. Unparseable lines are ignored.
|
|
81
|
+
*/
|
|
82
|
+
export function readPendingIntents(projectRoot) {
|
|
83
|
+
const seen = new Set();
|
|
84
|
+
const merged = [];
|
|
85
|
+
const rooted = [];
|
|
86
|
+
for (const root of pendingLogRoots(projectRoot)) {
|
|
87
|
+
for (const intent of parseIntentsFile(join(root, PENDING_LOG))) {
|
|
88
|
+
const key = intentKey(intent);
|
|
89
|
+
if (seen.has(key))
|
|
90
|
+
continue;
|
|
91
|
+
seen.add(key);
|
|
92
|
+
rooted.push({ root, intent });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
rooted.sort((a, b) => a.intent.ts - b.intent.ts);
|
|
96
|
+
for (const r of rooted)
|
|
97
|
+
merged.push(r.intent);
|
|
98
|
+
return merged;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The archived (already-applied) intents, newest last, from every log level —
|
|
102
|
+
* the restore source for a mission that prescribes recorded content the tree
|
|
103
|
+
* has since clobbered (see prescribed-replay.ts).
|
|
104
|
+
*/
|
|
105
|
+
export function readAppliedIntents(projectRoot) {
|
|
106
|
+
const seen = new Set();
|
|
107
|
+
const out = [];
|
|
108
|
+
let dir = resolve(projectRoot);
|
|
109
|
+
for (let hops = 0; hops < 16; hops++) {
|
|
110
|
+
if (existsSync(join(dir, APPLIED_LOG))) {
|
|
111
|
+
for (const intent of parseIntentsFile(join(dir, APPLIED_LOG))) {
|
|
112
|
+
const key = intentKey(intent);
|
|
113
|
+
if (seen.has(key))
|
|
114
|
+
continue;
|
|
115
|
+
seen.add(key);
|
|
116
|
+
out.push({ root: dir, intent });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (existsSync(join(dir, '.git')))
|
|
120
|
+
break;
|
|
121
|
+
const parent = dirname(dir);
|
|
122
|
+
if (parent === dir)
|
|
123
|
+
break;
|
|
124
|
+
dir = parent;
|
|
125
|
+
}
|
|
126
|
+
return out;
|
|
127
|
+
}
|
|
47
128
|
/** Stable identity for consume-filtering (ts + file + exact edit content). */
|
|
48
129
|
function intentKey(i) {
|
|
49
130
|
return JSON.stringify({ ts: i.ts, file_path: i.file_path, edit: i.edit ?? null });
|
|
@@ -87,17 +168,67 @@ function consumeIntents(root, consumed) {
|
|
|
87
168
|
* the blocked Write would have done). Multiple intents for one file apply in
|
|
88
169
|
* recorded order, so a sequence of blocked Edits replays faithfully.
|
|
89
170
|
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
171
|
+
* Intents are read from EVERY pending log between projectRoot and the git
|
|
172
|
+
* root (see pendingLogRoots) — the delivery gate records at the level it was
|
|
173
|
+
* enforcing, which may be above a mission's projectRoot.
|
|
174
|
+
*
|
|
175
|
+
* Applied (and detected-already-applied) intents are consumed from the log
|
|
176
|
+
* they were read from — replay is idempotent across runs. Stale-anchor and
|
|
177
|
+
* pre-D1 skips are NOT consumed: they stay visible until an operator resolves
|
|
178
|
+
* or clears them.
|
|
93
179
|
*/
|
|
94
180
|
export function applyPendingIntents(projectRoot, file) {
|
|
95
181
|
const root = resolve(projectRoot);
|
|
96
182
|
const wanted = file ? resolve(root, file) : null;
|
|
97
183
|
const result = { applied: [], skipped: [] };
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
184
|
+
const consumedByRoot = new Map();
|
|
185
|
+
// Merged oldest-first across levels, so a lower log cannot reorder history.
|
|
186
|
+
const seen = new Set();
|
|
187
|
+
const rooted = [];
|
|
188
|
+
for (const logRoot of pendingLogRoots(root)) {
|
|
189
|
+
for (const intent of parseIntentsFile(join(logRoot, PENDING_LOG))) {
|
|
190
|
+
const key = intentKey(intent);
|
|
191
|
+
if (seen.has(key))
|
|
192
|
+
continue;
|
|
193
|
+
seen.add(key);
|
|
194
|
+
rooted.push({ root: logRoot, intent });
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
rooted.sort((a, b) => a.intent.ts - b.intent.ts);
|
|
198
|
+
const markConsumed = (logRoot, intent) => {
|
|
199
|
+
const bucket = consumedByRoot.get(logRoot) ?? [];
|
|
200
|
+
bucket.push(intent);
|
|
201
|
+
consumedByRoot.set(logRoot, bucket);
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Deterministic replay gets the SAME write protections the model's writes
|
|
205
|
+
* get (review X1, CRITICAL): a planted `.uap/pending-deliver.jsonl` line
|
|
206
|
+
* previously landed its content in `.git/hooks/`, `.github/workflows/` or
|
|
207
|
+
* through a symlinked path with zero review, because replay used raw
|
|
208
|
+
* writeFileSync with only a lexical containment bound. Replay is the
|
|
209
|
+
* STRONGER trust case, not a weaker one — nothing looked at these bytes.
|
|
210
|
+
*/
|
|
211
|
+
const replayWriteRefusal = (abs, rel) => {
|
|
212
|
+
const reason = protectedWritePathReason(rel);
|
|
213
|
+
if (reason)
|
|
214
|
+
return `protected path — ${reason}`;
|
|
215
|
+
try {
|
|
216
|
+
if (existsSync(abs) && lstatSync(abs).isSymbolicLink())
|
|
217
|
+
return 'target is a symlink';
|
|
218
|
+
const realRoot = realpathSync(root);
|
|
219
|
+
const realParent = realpathSync(dirname(abs));
|
|
220
|
+
if (realParent !== realRoot && !realParent.startsWith(realRoot + '/')) {
|
|
221
|
+
return 'path resolves outside the project root via a symlink';
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
// Parent not on disk yet — the plain write below will create it (or fail
|
|
226
|
+
// loudly, caught per-intent).
|
|
227
|
+
}
|
|
228
|
+
return null;
|
|
229
|
+
};
|
|
230
|
+
for (const { root: logRoot, intent } of rooted) {
|
|
231
|
+
const abs = isAbsolute(intent.file_path) ? intent.file_path : resolve(logRoot, intent.file_path);
|
|
101
232
|
if (wanted && resolve(abs) !== wanted)
|
|
102
233
|
continue;
|
|
103
234
|
const rel = relative(root, abs);
|
|
@@ -105,6 +236,11 @@ export function applyPendingIntents(projectRoot, file) {
|
|
|
105
236
|
result.skipped.push({ file: intent.file_path, ts: intent.ts, reason: 'outside project root' });
|
|
106
237
|
continue;
|
|
107
238
|
}
|
|
239
|
+
const refusal = replayWriteRefusal(abs, rel.split('\\').join('/'));
|
|
240
|
+
if (refusal) {
|
|
241
|
+
result.skipped.push({ file: rel, ts: intent.ts, reason: refusal });
|
|
242
|
+
continue; // NOT consumed — a protected write stays visible for an operator to resolve
|
|
243
|
+
}
|
|
108
244
|
const edit = intent.edit;
|
|
109
245
|
if (!edit || (typeof edit.content !== 'string' && typeof edit.old_string !== 'string')) {
|
|
110
246
|
result.skipped.push({ file: rel, ts: intent.ts, reason: 'no replayable content recorded (pre-D1 intent)' });
|
|
@@ -113,12 +249,23 @@ export function applyPendingIntents(projectRoot, file) {
|
|
|
113
249
|
if (typeof edit.content === 'string') {
|
|
114
250
|
if (existsSync(abs) && readFileSync(abs, 'utf-8') === edit.content) {
|
|
115
251
|
result.skipped.push({ file: rel, ts: intent.ts, reason: 'already applied (content identical)' });
|
|
116
|
-
|
|
252
|
+
markConsumed(logRoot, intent);
|
|
117
253
|
continue;
|
|
118
254
|
}
|
|
119
|
-
|
|
255
|
+
try {
|
|
256
|
+
mkdirSync(dirname(abs), { recursive: true });
|
|
257
|
+
writeFileSync(abs, edit.content, 'utf-8');
|
|
258
|
+
}
|
|
259
|
+
catch (err) {
|
|
260
|
+
result.skipped.push({
|
|
261
|
+
file: rel,
|
|
262
|
+
ts: intent.ts,
|
|
263
|
+
reason: `write failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
264
|
+
});
|
|
265
|
+
continue; // not consumed — stays visible
|
|
266
|
+
}
|
|
120
267
|
result.applied.push({ file: rel, ts: intent.ts, kind: 'write' });
|
|
121
|
-
|
|
268
|
+
markConsumed(logRoot, intent);
|
|
122
269
|
continue;
|
|
123
270
|
}
|
|
124
271
|
if (!existsSync(abs)) {
|
|
@@ -136,7 +283,7 @@ export function applyPendingIntents(projectRoot, file) {
|
|
|
136
283
|
// contained in new).
|
|
137
284
|
if (newStr && newStr.includes(oldStr) && current.includes(newStr)) {
|
|
138
285
|
result.skipped.push({ file: rel, ts: intent.ts, reason: 'already applied (new content present)' });
|
|
139
|
-
|
|
286
|
+
markConsumed(logRoot, intent);
|
|
140
287
|
continue;
|
|
141
288
|
}
|
|
142
289
|
const count = current.split(oldStr).length - 1;
|
|
@@ -148,11 +295,22 @@ export function applyPendingIntents(projectRoot, file) {
|
|
|
148
295
|
});
|
|
149
296
|
continue;
|
|
150
297
|
}
|
|
151
|
-
|
|
298
|
+
try {
|
|
299
|
+
writeFileSync(abs, current.replace(oldStr, newStr), 'utf-8');
|
|
300
|
+
}
|
|
301
|
+
catch (err) {
|
|
302
|
+
result.skipped.push({
|
|
303
|
+
file: rel,
|
|
304
|
+
ts: intent.ts,
|
|
305
|
+
reason: `write failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
306
|
+
});
|
|
307
|
+
continue; // not consumed — stays visible
|
|
308
|
+
}
|
|
152
309
|
result.applied.push({ file: rel, ts: intent.ts, kind: 'replace' });
|
|
153
|
-
|
|
310
|
+
markConsumed(logRoot, intent);
|
|
154
311
|
}
|
|
155
|
-
|
|
312
|
+
for (const [logRoot, consumed] of consumedByRoot)
|
|
313
|
+
consumeIntents(logRoot, consumed);
|
|
156
314
|
return result;
|
|
157
315
|
}
|
|
158
316
|
//# sourceMappingURL=pending-intents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pending-intents.js","sourceRoot":"","sources":["../../src/delivery/pending-intents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAe3D,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACjD,MAAM,WAAW,GAAG,oCAAoC,CAAC;AAEzD,8EAA8E;AAC9E,MAAM,UAAU,kBAAkB,CAAC,WAAmB;IACpD,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC3C,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAChC,MAAM,OAAO,GAAoB,EAAE,CAAC;IACpC,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1D,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACtB,IAAI,CAAC,CAAC;YAAE,SAAS;QACjB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAkB,CAAC;YAC9C,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,SAAS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CAAC;YACH,SAAS,CAAC,+BAA+B;QAC3C,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;QACnE,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,cAAc;QAAE,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACpF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prescribed-replay preflight (U2)
|
|
3
|
+
*
|
|
4
|
+
* Some missions EXPLICITLY prescribe the deterministic mechanism: "the
|
|
5
|
+
* intended content is recorded as a replayable intent in
|
|
6
|
+
* .uap/pending-deliver.jsonl — replay it with `uap deliver --pending` rather
|
|
7
|
+
* than rewriting it". Executors ignore that instruction: the live failure
|
|
8
|
+
* (run 20261006T042017, rust-pg-ext M1 bench) spent its entire 12-round budget
|
|
9
|
+
* hand-rewriting a broken 19KB bench.rs while the recorded content sat in the
|
|
10
|
+
* pending/applied logs. A model told to replay can choose not to; the runner
|
|
11
|
+
* doing it before turn 1 leaves nothing to chance.
|
|
12
|
+
*
|
|
13
|
+
* Two sources, in order:
|
|
14
|
+
* 1. PENDING intents (never consumed) — replayed via applyPendingIntents.
|
|
15
|
+
* 2. APPLIED intents — when nothing is pending for a mission-named file but
|
|
16
|
+
* the tree's current content differs from the newest recorded intent
|
|
17
|
+
* content, the tree has clobbered the prescribed content (an earlier
|
|
18
|
+
* executor's rewrite). RESTORE it, loudly. Only fires on a fresh run
|
|
19
|
+
* (never a resume — resumed state may legitimately contain newer work) and
|
|
20
|
+
* only for files the mission text names. Opt out with
|
|
21
|
+
* UAP_DELIVER_NO_INTENT_RESTORE=1.
|
|
22
|
+
*/
|
|
23
|
+
export interface PrescribedReplayResult {
|
|
24
|
+
/** True when the mission text prescribes the pending-intent mechanism. */
|
|
25
|
+
triggered: boolean;
|
|
26
|
+
/** Pending intents replayed this preflight. */
|
|
27
|
+
applied: Array<{
|
|
28
|
+
file: string;
|
|
29
|
+
kind: 'replace' | 'write';
|
|
30
|
+
}>;
|
|
31
|
+
/** Files restored from the applied log (tree had clobbered them). */
|
|
32
|
+
restored: string[];
|
|
33
|
+
/** Human-readable actions, printed by the CLI. */
|
|
34
|
+
notes: string[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Does the mission prescribe the pending-intent replay mechanism? Prose that
|
|
38
|
+
* merely MENTIONS the log ("do not touch .uap/pending-deliver.jsonl") must not
|
|
39
|
+
* trigger a tree-mutating preflight (review arch F12 / quality F12): the
|
|
40
|
+
* trigger requires the prescriptive shape — a replay/recorded verb on the
|
|
41
|
+
* same line as the log path, or the imperative `uap deliver --pending` form.
|
|
42
|
+
*/
|
|
43
|
+
export declare function missionPrescribesReplay(instruction: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Run the preflight for a mission against projectRoot. Safe to call when the
|
|
46
|
+
* mission does not prescribe the mechanism (returns {triggered: false} without
|
|
47
|
+
* touching anything) and fail-soft on every IO error — a preflight must never
|
|
48
|
+
* block a run it was meant to help.
|
|
49
|
+
*/
|
|
50
|
+
export declare function prescribedReplayPreflight(projectRoot: string, instruction: string, opts?: {
|
|
51
|
+
resume?: boolean;
|
|
52
|
+
}): PrescribedReplayResult;
|
|
53
|
+
//# sourceMappingURL=prescribed-replay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prescribed-replay.d.ts","sourceRoot":"","sources":["../../src/delivery/prescribed-replay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAWH,MAAM,WAAW,sBAAsB;IACrC,0EAA0E;IAC1E,SAAS,EAAE,OAAO,CAAC;IACnB,+CAA+C;IAC/C,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAA;KAAE,CAAC,CAAC;IAC5D,qEAAqE;IACrE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kDAAkD;IAClD,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAMpE;AA+DD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1B,sBAAsB,CA8ExB"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prescribed-replay preflight (U2)
|
|
3
|
+
*
|
|
4
|
+
* Some missions EXPLICITLY prescribe the deterministic mechanism: "the
|
|
5
|
+
* intended content is recorded as a replayable intent in
|
|
6
|
+
* .uap/pending-deliver.jsonl — replay it with `uap deliver --pending` rather
|
|
7
|
+
* than rewriting it". Executors ignore that instruction: the live failure
|
|
8
|
+
* (run 20261006T042017, rust-pg-ext M1 bench) spent its entire 12-round budget
|
|
9
|
+
* hand-rewriting a broken 19KB bench.rs while the recorded content sat in the
|
|
10
|
+
* pending/applied logs. A model told to replay can choose not to; the runner
|
|
11
|
+
* doing it before turn 1 leaves nothing to chance.
|
|
12
|
+
*
|
|
13
|
+
* Two sources, in order:
|
|
14
|
+
* 1. PENDING intents (never consumed) — replayed via applyPendingIntents.
|
|
15
|
+
* 2. APPLIED intents — when nothing is pending for a mission-named file but
|
|
16
|
+
* the tree's current content differs from the newest recorded intent
|
|
17
|
+
* content, the tree has clobbered the prescribed content (an earlier
|
|
18
|
+
* executor's rewrite). RESTORE it, loudly. Only fires on a fresh run
|
|
19
|
+
* (never a resume — resumed state may legitimately contain newer work) and
|
|
20
|
+
* only for files the mission text names. Opt out with
|
|
21
|
+
* UAP_DELIVER_NO_INTENT_RESTORE=1.
|
|
22
|
+
*/
|
|
23
|
+
import { existsSync, lstatSync, readFileSync, realpathSync, writeFileSync } from 'fs';
|
|
24
|
+
import { basename, dirname, isAbsolute, relative, resolve } from 'path';
|
|
25
|
+
import { protectedWritePathReason } from './applier.js';
|
|
26
|
+
import { applyPendingIntents, readAppliedIntents, } from './pending-intents.js';
|
|
27
|
+
/**
|
|
28
|
+
* Does the mission prescribe the pending-intent replay mechanism? Prose that
|
|
29
|
+
* merely MENTIONS the log ("do not touch .uap/pending-deliver.jsonl") must not
|
|
30
|
+
* trigger a tree-mutating preflight (review arch F12 / quality F12): the
|
|
31
|
+
* trigger requires the prescriptive shape — a replay/recorded verb on the
|
|
32
|
+
* same line as the log path, or the imperative `uap deliver --pending` form.
|
|
33
|
+
*/
|
|
34
|
+
export function missionPrescribesReplay(instruction) {
|
|
35
|
+
return (/(?:replay\w*|recorded)[^\n]{0,200}pending-deliver|pending-deliver[^\n]{0,200}(?:replay\w*|recorded)/.test(instruction) || /uap\s+deliver\s+--pending/.test(instruction));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Mission-named path tokens (full slash paths and bare basenames). The
|
|
39
|
+
* restore bound matches on PATH TAILS, not bare basenames (review X4/arch
|
|
40
|
+
* F3): a mission naming `src/bench.rs` must not authorize restoring
|
|
41
|
+
* `vendor/bench.rs`. A bare basename in the mission (no directory part) still
|
|
42
|
+
* falls back to basename matching — the mission gave us nothing narrower.
|
|
43
|
+
*/
|
|
44
|
+
function missionPathTokens(mission) {
|
|
45
|
+
const tails = new Set();
|
|
46
|
+
const bases = new Set();
|
|
47
|
+
for (const m of mission.matchAll(/[\w.@-]+(?:\/[\w.@-]+)+/g)) {
|
|
48
|
+
const t = m[0].replace(/[.,;:)]+$/, '');
|
|
49
|
+
if (t.includes('//') || t.startsWith('http'))
|
|
50
|
+
continue;
|
|
51
|
+
if (!t.split('/').pop()?.includes('.'))
|
|
52
|
+
continue;
|
|
53
|
+
// Slash paths seed TAILS ONLY (review X4): seeding the bare-basename
|
|
54
|
+
// fallback from them too would let a mission naming `src/bench.rs`
|
|
55
|
+
// authorize every `*/bench.rs` in the tree.
|
|
56
|
+
tails.add(t.toLowerCase());
|
|
57
|
+
}
|
|
58
|
+
// Bare basenames: matched only on text with every SLASH PATH removed —
|
|
59
|
+
// otherwise `bench.rs` inside `src/bench.rs` seeds the basename fallback and
|
|
60
|
+
// defeats the tail bound (review X4).
|
|
61
|
+
const bareText = mission.replace(/[\w.@-]+(?:\/[\w.@-]+)+/g, ' ');
|
|
62
|
+
for (const m of bareText.matchAll(/\b[\w-]+\.(?:html|css|md|js|mjs|cjs|ts|tsx|json|py|rs|go)\b/g)) {
|
|
63
|
+
bases.add(m[0].toLowerCase());
|
|
64
|
+
}
|
|
65
|
+
return { tails, bases };
|
|
66
|
+
}
|
|
67
|
+
/** Does the mission name this project-relative path (tail or bare basename)? */
|
|
68
|
+
function missionNamesPath(relPosix, tokens) {
|
|
69
|
+
const rel = relPosix.toLowerCase();
|
|
70
|
+
for (const tail of tokens.tails) {
|
|
71
|
+
if (rel === tail || rel.endsWith('/' + tail))
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
return tokens.bases.has(basename(rel));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The same write protections the applier enforces (review X1, CRITICAL): the
|
|
78
|
+
* restore path used raw writeFileSync, so a planted applied-log line could
|
|
79
|
+
* land content in `.git/hooks/`, `.github/workflows/` or through a symlink.
|
|
80
|
+
* Restore is deterministic — nothing reviews these bytes — so it gets the
|
|
81
|
+
* STRONGER guard, not a weaker one.
|
|
82
|
+
*/
|
|
83
|
+
function restoreWriteRefusal(root, abs, relPosix) {
|
|
84
|
+
const reason = protectedWritePathReason(relPosix);
|
|
85
|
+
if (reason)
|
|
86
|
+
return `protected path — ${reason}`;
|
|
87
|
+
try {
|
|
88
|
+
if (existsSync(abs) && lstatSync(abs).isSymbolicLink())
|
|
89
|
+
return 'target is a symlink';
|
|
90
|
+
const realRoot = realpathSync(root);
|
|
91
|
+
const realParent = realpathSync(dirname(abs));
|
|
92
|
+
if (realParent !== realRoot && !realParent.startsWith(realRoot + '/')) {
|
|
93
|
+
return 'path resolves outside the project root via a symlink';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return null; // parent missing — the write below creates it or fails loudly
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Run the preflight for a mission against projectRoot. Safe to call when the
|
|
103
|
+
* mission does not prescribe the mechanism (returns {triggered: false} without
|
|
104
|
+
* touching anything) and fail-soft on every IO error — a preflight must never
|
|
105
|
+
* block a run it was meant to help.
|
|
106
|
+
*/
|
|
107
|
+
export function prescribedReplayPreflight(projectRoot, instruction, opts) {
|
|
108
|
+
const out = { triggered: false, applied: [], restored: [], notes: [] };
|
|
109
|
+
if (!missionPrescribesReplay(instruction))
|
|
110
|
+
return out;
|
|
111
|
+
out.triggered = true;
|
|
112
|
+
const root = resolve(projectRoot);
|
|
113
|
+
// 1. Replay pending intents (multi-level lookup is inside).
|
|
114
|
+
try {
|
|
115
|
+
const res = applyPendingIntents(root);
|
|
116
|
+
for (const a of res.applied) {
|
|
117
|
+
out.applied.push({ file: a.file, kind: a.kind });
|
|
118
|
+
out.notes.push(`replayed recorded intent (${a.kind}): ${a.file}`);
|
|
119
|
+
}
|
|
120
|
+
for (const s of res.skipped) {
|
|
121
|
+
if (s.reason.startsWith('already applied'))
|
|
122
|
+
continue; // idempotent — not news
|
|
123
|
+
out.notes.push(`intent skipped: ${s.file} (${s.reason})`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
out.notes.push(`pending-intent replay error (continuing): ${err instanceof Error ? err.message : String(err)}`);
|
|
128
|
+
}
|
|
129
|
+
// 2. Restore clobbered prescribed content from the applied log — only on a
|
|
130
|
+
// fresh run, only for mission-named files, only with recorded CONTENT
|
|
131
|
+
// (replace-intents are stale by construction once applied and moved).
|
|
132
|
+
if (opts?.resume || process.env.UAP_DELIVER_NO_INTENT_RESTORE === '1')
|
|
133
|
+
return out;
|
|
134
|
+
try {
|
|
135
|
+
const tokens = missionPathTokens(instruction);
|
|
136
|
+
if (tokens.bases.size === 0 && tokens.tails.size === 0)
|
|
137
|
+
return out;
|
|
138
|
+
// Newest recorded intent per file, across all levels.
|
|
139
|
+
const latest = new Map();
|
|
140
|
+
for (const ri of readAppliedIntents(root)) {
|
|
141
|
+
const edit = ri.intent.edit;
|
|
142
|
+
if (!edit || typeof edit.content !== 'string')
|
|
143
|
+
continue;
|
|
144
|
+
// Relative paths are relative to the LOG they were recorded in (the
|
|
145
|
+
// delivery gate records at the level it enforced), not to cwd.
|
|
146
|
+
const abs = isAbsolute(ri.intent.file_path)
|
|
147
|
+
? ri.intent.file_path
|
|
148
|
+
: resolve(ri.root, ri.intent.file_path);
|
|
149
|
+
const rel = relative(root, abs);
|
|
150
|
+
if (rel.startsWith('..'))
|
|
151
|
+
continue;
|
|
152
|
+
const relPosix = rel.split('\\').join('/');
|
|
153
|
+
if (!missionNamesPath(relPosix, tokens))
|
|
154
|
+
continue;
|
|
155
|
+
const prev = latest.get(rel);
|
|
156
|
+
if (!prev || prev.intent.ts <= ri.intent.ts)
|
|
157
|
+
latest.set(rel, ri);
|
|
158
|
+
}
|
|
159
|
+
for (const [rel, ri] of latest) {
|
|
160
|
+
const abs = resolve(root, rel);
|
|
161
|
+
const relPosix = rel.split('\\').join('/');
|
|
162
|
+
if (!existsSync(abs))
|
|
163
|
+
continue; // gone entirely — gates will say so
|
|
164
|
+
const refusal = restoreWriteRefusal(root, abs, relPosix);
|
|
165
|
+
if (refusal) {
|
|
166
|
+
out.notes.push(`restore of ${relPosix} refused (${refusal})`);
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
let current;
|
|
170
|
+
try {
|
|
171
|
+
current = readFileSync(abs, 'utf-8');
|
|
172
|
+
}
|
|
173
|
+
catch (err) {
|
|
174
|
+
out.notes.push(`restore of ${relPosix} skipped (unreadable: ${err instanceof Error ? err.message : String(err)})`);
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
const recorded = String(ri.intent.edit?.content);
|
|
178
|
+
if (current === recorded)
|
|
179
|
+
continue;
|
|
180
|
+
try {
|
|
181
|
+
writeFileSync(abs, recorded, 'utf-8');
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
out.notes.push(`restore of ${relPosix} failed (write error: ${err instanceof Error ? err.message : String(err)})`);
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
out.restored.push(relPosix);
|
|
188
|
+
out.notes.push(`restored ${relPosix} from the recorded intent (ts ${ri.intent.ts}) — the tree had clobbered the prescribed content`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
out.notes.push(`applied-intent restore skipped (continuing): ${err instanceof Error ? err.message : String(err)}`);
|
|
193
|
+
}
|
|
194
|
+
return out;
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=prescribed-replay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prescribed-replay.js","sourceRoot":"","sources":["../../src/delivery/prescribed-replay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,GAEnB,MAAM,sBAAs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