@awebai/oats 0.46.0 → 0.48.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,159 @@
1
+ /** Private, bounded evidence from an already compared launch frame. No terminal
2
+ * operations or public raw-text diagnostics. A receipt is published last; a
3
+ * partial directory is retained on failure, never presented as a complete save. */
4
+ import * as fs from 'node:fs';
5
+ import { join, dirname, isAbsolute } from 'node:path';
6
+ import { createHash, randomUUID } from 'node:crypto';
7
+ import { execFileSync } from 'node:child_process';
8
+
9
+ const sha256 = bytes => createHash('sha256').update(bytes).digest('hex');
10
+ const same = (a, b) => a && b && a.dev === b.dev && a.ino === b.ino;
11
+ const fail = () => { throw new Error('private launch evidence unavailable'); };
12
+ const uid = () => process.getuid?.();
13
+ const identity = s => ({ dev: s.dev, ino: s.ino });
14
+
15
+ /** Decode only the private receipt's recognition tag. This is not evidence
16
+ * verification: collection must still bind bytes/identities and checked public
17
+ * outcome. Historical receipts remain unchanged on disk. */
18
+ export function launchPromptEvidenceRecognition(receipt) {
19
+ if (receipt?.version === 1 && receipt.kind === 'launch-prompt-unmatched'
20
+ && !Object.hasOwn(receipt, 'outcome') && !Object.hasOwn(receipt, 'recognition')) {
21
+ return { outcome: 'blocked', recognition: 'unmatched' };
22
+ }
23
+ if (receipt?.version === 2 && receipt.kind === 'launch-prompt-frame'
24
+ && ((receipt.outcome === 'blocked' && receipt.recognition === 'unmatched')
25
+ || (receipt.outcome === 'completed' && receipt.recognition === 'structural'))) {
26
+ return { outcome: receipt.outcome, recognition: receipt.recognition };
27
+ }
28
+ return null;
29
+ }
30
+
31
+ // Mode bits alone do not rule out an inherited macOS ACL (including one
32
+ // hidden behind the '@' xattr indicator). Never write private bytes first and
33
+ // then discover that another principal can read the candidate.
34
+ function privateAccess(path) {
35
+ const mac = process.platform === 'darwin';
36
+ const output = execFileSync('/bin/ls', mac ? ['-lde', path] : ['-ld', '--', path],
37
+ { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: 1000, maxBuffer: 16384, env: { ...process.env, LC_ALL: 'C' } });
38
+ const mode = output.split(/\s/, 1)[0];
39
+ if (mac) {
40
+ if (!/^[d-][-rwxStTs]{9}@?$/.test(mode) || output.trimEnd().split('\n').length !== 1) fail();
41
+ } else if (!/^[d-][-rwxStTs]{9}\.?$/.test(mode)) fail();
42
+ }
43
+
44
+ export function retainLaunchPromptFrame({ home, homeIdentity, startId, target, screen,
45
+ outcome = 'blocked', recognition = 'unmatched' }) {
46
+ const directories = new Map(), temps = new Map();
47
+ let ok = false;
48
+ function directory(path, privateMode = false) {
49
+ const s = fs.lstatSync(path);
50
+ if (!s.isDirectory() || s.uid !== uid() || (s.mode & 0o7022)
51
+ || (privateMode && (s.mode & 0o777) !== 0o700)
52
+ || fs.realpathSync.native(path) !== path) fail();
53
+ return s;
54
+ }
55
+ function check() {
56
+ if (!same(directory(home), homeIdentity)) fail();
57
+ for (const [path, saved] of directories) if (!same(directory(path, saved.privateMode), saved)) fail();
58
+ }
59
+ function ensure(path, privateMode) {
60
+ check();
61
+ try { fs.mkdirSync(path, { mode: 0o700 }); }
62
+ catch (error) { if (error.code !== 'EEXIST') throw error; }
63
+ const s = directory(path, privateMode);
64
+ if (privateMode) privateAccess(path);
65
+ directories.set(path, { ...identity(s), privateMode });
66
+ check();
67
+ syncDirectory(dirname(path));
68
+ }
69
+ function syncDirectory(path) {
70
+ check();
71
+ const fd = fs.openSync(path, fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW ?? 0) | (fs.constants.O_NONBLOCK ?? 0));
72
+ try {
73
+ if (!same(fs.fstatSync(fd), directories.get(path))) fail();
74
+ fs.fsyncSync(fd);
75
+ } finally { fs.closeSync(fd); }
76
+ check();
77
+ }
78
+ function verify(path, saved, bytes) {
79
+ check();
80
+ privateAccess(path);
81
+ const fd = fs.openSync(path, fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW ?? 0) | (fs.constants.O_NONBLOCK ?? 0));
82
+ try {
83
+ const s = fs.fstatSync(fd);
84
+ if (!s.isFile() || !same(s, saved) || s.nlink !== 1 || s.uid !== uid() || (s.mode & 0o7777) !== 0o600 || s.size !== bytes.length) fail();
85
+ // Read at most the expected bytes plus one: concurrent growth must not
86
+ // turn verification of a bounded frame into an unbounded file read.
87
+ const observed = Buffer.alloc(bytes.length + 1);
88
+ let length = 0;
89
+ while (length < observed.length) {
90
+ const count = fs.readSync(fd, observed, length, observed.length - length, length);
91
+ if (!count) break;
92
+ length += count;
93
+ }
94
+ if (length !== bytes.length || !observed.subarray(0, length).equals(bytes)) fail();
95
+ const after = fs.lstatSync(path);
96
+ if (!after.isFile() || !same(after, saved) || after.nlink !== 1 || after.uid !== uid()
97
+ || (after.mode & 0o7777) !== 0o600 || after.size !== bytes.length) fail();
98
+ } finally { fs.closeSync(fd); }
99
+ check();
100
+ }
101
+ function publish(dir, name, bytes) {
102
+ check();
103
+ const temp = join(dir, `.${randomUUID()}.tmp`), path = join(dir, name);
104
+ const fd = fs.openSync(temp, fs.constants.O_WRONLY | fs.constants.O_CREAT | fs.constants.O_EXCL | (fs.constants.O_NOFOLLOW ?? 0), 0o600);
105
+ let saved;
106
+ try {
107
+ saved = identity(fs.fstatSync(fd)); temps.set(temp, saved);
108
+ privateAccess(temp);
109
+ check();
110
+ if (!same(fs.lstatSync(temp), saved)) fail();
111
+ fs.writeFileSync(fd, bytes); fs.fsyncSync(fd);
112
+ } finally { fs.closeSync(fd); }
113
+ check();
114
+ // link is atomic and refuses ANY existing destination. Unlike rename it
115
+ // cannot overwrite a competing receipt or file between checks.
116
+ fs.linkSync(temp, path);
117
+ if (!same(fs.lstatSync(temp), saved)) fail();
118
+ fs.unlinkSync(temp); temps.delete(temp);
119
+ syncDirectory(dir);
120
+ verify(path, saved, bytes);
121
+ return saved;
122
+ }
123
+ try {
124
+ // This private receipt records the recognition being saved, not the final
125
+ // public launch result: a subsequent audit/cleanup failure can be incomplete.
126
+ if (!launchPromptEvidenceRecognition({ version: 2, kind: 'launch-prompt-frame', outcome, recognition })) fail();
127
+ if (typeof home !== 'string' || !isAbsolute(home) || !homeIdentity
128
+ || typeof startId !== 'string' || !startId.length || startId.length > 256 || startId.includes('\0')
129
+ || !target || !isAbsolute(target.socket || '') || !/^@\d+$/.test(target.windowId) || !/^%\d+$/.test(target.paneId) || !/^[1-9]\d*$/.test(String(target.pid))
130
+ || screen?.width !== 110 || screen?.height !== 35 || typeof screen.text !== 'string'
131
+ || !screen.text.endsWith('\n') || screen.text.split('\n').length !== 36) fail();
132
+ const bytes = Buffer.from(screen.text, 'utf8');
133
+ if (bytes.length > 64 * 1024) fail();
134
+ check();
135
+ directories.set(home, { ...identity(homeIdentity), privateMode: false });
136
+ const oats = join(home, '.oats'), root = join(oats, 'launch-prompt-evidence');
137
+ ensure(oats, false); ensure(root, true);
138
+ const dir = join(root, sha256(startId));
139
+ check(); fs.mkdirSync(dir, { mode: 0o700 }); // no overwrite/retry of an invocation
140
+ directories.set(dir, { ...identity(directory(dir, true)), privateMode: true });
141
+ privateAccess(dir);
142
+ syncDirectory(root);
143
+ const frameIdentity = publish(dir, 'frame.txt', bytes);
144
+ const receipt = Buffer.from(JSON.stringify({ version: 2, kind: 'launch-prompt-frame', outcome, recognition, home, homeIdentity: identity(homeIdentity), startId,
145
+ target: { socket: target.socket, windowId: target.windowId, paneId: target.paneId, pid: String(target.pid) },
146
+ width: 110, height: 35, bytes: bytes.length, signatureDigest: sha256(bytes), frame: 'frame.txt', frameIdentity,
147
+ source: 'controller-compared-frame', captureTime: null, retainedAt: new Date().toISOString() }) + '\n');
148
+ publish(dir, 'receipt.json', receipt);
149
+ verify(join(dir, 'frame.txt'), frameIdentity, bytes);
150
+ ok = true;
151
+ } catch { /* Do not expose raw text, OS errors, or a fabricated saved receipt. */ }
152
+ finally {
153
+ for (const [path, saved] of temps) {
154
+ try { check(); if (!same(fs.lstatSync(path), saved)) fail(); fs.unlinkSync(path); }
155
+ catch { ok = false; }
156
+ }
157
+ }
158
+ return { ok };
159
+ }
@@ -28,7 +28,7 @@ blocked outcome and sends no key. Captured folder-trust screens live only in
28
28
 
29
29
  Normal-output completion has a separate accepted finite policy: all surrounding
30
30
  bytes must equal one of the captured normal banners, except for its bounded
31
- directory line and the source-derived billing atoms described below. Candidates are the exact home, a home-directory-relative `~` spelling,
31
+ directory line and the source-derived header/footer variants described below. Candidates are the exact home, a home-directory-relative `~` spelling,
32
32
  and `~/…/` followed by nonempty whole-component suffixes within the user home.
33
33
  Every complete line must fit 110 columns. Only conservative ASCII path components
34
34
  without traversal or empty segments qualify. These variants can only terminate
@@ -45,8 +45,8 @@ network and real-home access, seeded onboarding/trust/feature flag, one Enter,
45
45
  stable bytes at 200ms/1s/3s, and verified private-server cleanup. The prompt and
46
46
  blank transition were byte-identical to the earlier captures. No configuration,
47
47
  credentials or extracted source is included. No task or real-account/channel
48
- connection was tested. Apart from the billing atoms below, other
49
- model/billing/effort/permission variants remain unqualified; a submitted answer can be followed by a retained blocked result.
48
+ connection was tested. Apart from the source-derived variants below, other
49
+ model/billing/effort/permission variants are not exact-frame candidates; a submitted answer can be followed by a retained blocked result.
50
50
 
51
51
  ## Source-derived subscription billing variants
52
52
 
@@ -76,9 +76,77 @@ proprietary extracted module is included.
76
76
  The reported Max journey is different evidence: its later retained pane has
77
77
  SHA256 `9eb587ab3ac7f97b746169619e02e3c8dd7df2c9069ff4368b6f0858c0964c68`,
78
78
  1597 bytes and 51 newline rows. It shows task activity and bypass-permissions
79
- mode. Captured at 2026-10-07T14:31:54.028296Z, it follows the submitted Enter at
79
+ mode. Its file mtime is 2026-10-07T14:31:54.028296Z (not an independently recorded
80
+ capture time); it follows the submitted Enter at
80
81
  14:31:45.365Z and block at 14:31:45.476Z. Its geometry, executable digest and
81
82
  plugin version were not independently recorded; no earlier raw frame exists.
82
83
  It is not padded, cropped or claimed as a qualified 110x35 first frame. See the
83
84
  [published operator evidence](https://github.com/awebai/oats/issues/754#issuecomment-6040215059).
84
85
  The billing-only extension does not recognize that later task-filled screen.
86
+
87
+ ## Source-derived empty Max/bypass/medium variants
88
+
89
+ **SOURCE-DERIVED / SYNTHETIC:** only the two existing empty banners with
90
+ `Claude Max` additionally qualify the bypass-permissions footer. The pinned
91
+ source ranges and hashes, exact changed row indices, sample home and complete
92
+ candidate digests are in
93
+ [the derivation manifest](claude-2.1.289-darwin-arm64/max-bypass-source.json).
94
+ No proprietary extracted modules or private task text are included.
95
+
96
+ The permission-mode table uses the same `⏵⏵` symbol for auto and bypass; only
97
+ colour differs, which plain captures omit. `kx` renders that symbol, the mode
98
+ indicator and ` on`; both modes take `dHe`'s same non-default branch with the
99
+ same hint. Thus the left text changes from `auto mode on` to
100
+ `bypass permissions on`, adding nine columns. The footer container has width
101
+ 110, horizontal padding 2 and a right status child with `marginLeft:auto`.
102
+ The alignment gap shrinks from 37 to 28 spaces; the effort glyph remains at
103
+ zero-based column 90 and the complete row remains 108 columns. The independent
104
+ `y8` effort rendering stays exactly `◐ medium · /effort`. All other bytes are
105
+ unchanged, except the already qualified header atom and finite home line.
106
+
107
+ The source supports this bounded transformation, not arbitrary renderer states.
108
+ Within these exact families, the displayed medium status is mandatory; other
109
+ content does not match an exact candidate. The separate post-answer structural
110
+ policy below can recognize additional bounded states. The #712 observed child screens corroborate the 62-column left footer
111
+ text, but have task/update rows and no effort status there; they are not these
112
+ fixtures. Full-frame comparison and all Enter guards remain unchanged.
113
+
114
+ Four later private operator captures motivated this work. Their SHA-256 values
115
+ are retained here as provenance only:
116
+
117
+ | Evidence | Bytes / newline rows | SHA-256 |
118
+ | --- | --- | --- |
119
+ | Journey start | 1597 / 51 | `9eb587ab3ac7f97b746169619e02e3c8dd7df2c9069ff4368b6f0858c0964c68` |
120
+ | Journey restart | 2449 / 51 | `c21cc6ac90487a18828ea2375243c642df2d6959b50a339a187132ec26dc213a` |
121
+ | Pre-rehearsal spawn | 3604 / 87 | `368170ecf1155e45f92a9c394972bf5a2ff0d56d2e03501f3d88615d0d2fab67` |
122
+ | Pre-rehearsal restart | 3180 / 87 | `88352f740e3e8f51f3613a057d7fe8aa41ae26efe20fb0ce24c7ac025fa70d9c` |
123
+
124
+ All follow controller geometry restoration; actual later-capture geometry,
125
+ executable hash and plugin version were not independently recorded. File mtime
126
+ is not capture time, and restoration dimensions are not capture dimensions.
127
+ No first post-answer frame survives. None is cropped, reflowed or published as
128
+ a raw 110x35 replay. These four captures remain provenance only, not qualified structural input.
129
+ The separate controller-compared regression and structural policy below do not
130
+ turn them into qualified captures or establish general Max success.
131
+
132
+ ## Post-answer structural completion
133
+
134
+ The [complete table](../../docs/launch-prompt-completion.md) defines the six modes,
135
+ five efforts, finite hints, exact region geometry and 21 marker forms.
136
+ [Source provenance](structural-completion.json) pins all 25 byte ranges against
137
+ the same executable hash. This is the non-Jt footer layout; remote feature flags
138
+ can change shape without binary drift. Unknown dialogs retaining a recognized
139
+ composer/footer can evade the marker set: the accepted risk concerns reporting
140
+ only, never another input action or a readiness claim.
141
+
142
+ The observed regression is a SANITIZED DERIVATIVE of the actual compared
143
+ 110x35 frame retained by the earlier controller after its one Enter. Only
144
+ zero-based home row 2 becomes `/fixture/home`; the manifest records separate
145
+ original/derivative byte counts and hashes. Outside that row, independent review
146
+ found only native constants and the launcher's literal `@TASK.md` reference, no
147
+ task body, account-personal or routing data. Four additional rows distinguish
148
+ this captured in-progress state from the empty source-derived family. Its
149
+ spinner verb is chosen per turn (or configured), its glyph animates and later
150
+ suffixes change. No exact spinner matcher or recurrence claim follows. The
151
+ empty footer derivation remains separately qualified; its arithmetic was not
152
+ disproved by observing a different startup state.
@@ -0,0 +1,88 @@
1
+ {
2
+ "binarySha256": "03d66745e3bb69ec727d66023696f3820bc0a00a8a5ba725eb6706d0c67cbe69",
3
+ "method": "read-only byte slices, binary not executed; no extracted modules copied",
4
+ "ranges": [
5
+ {
6
+ "description": "permission enum, indicator/symbol/color selectors",
7
+ "startInclusive": 179784383,
8
+ "endExclusive": 179785973,
9
+ "sha256": "290bd33df357cf05d275997cbe491bcb1689947829d9f106d6b1b9d2235384aa"
10
+ },
11
+ {
12
+ "description": "mode footer component kx",
13
+ "startInclusive": 208947546,
14
+ "endExclusive": 208948093,
15
+ "sha256": "bb9a808a262604016a60b52371acabdf71eb929a3d22a1d3b060e48cec8389cd"
16
+ },
17
+ {
18
+ "description": "footer state layout dHe",
19
+ "startInclusive": 209072435,
20
+ "endExclusive": 209082284,
21
+ "sha256": "3c52ece98f866e45e9dcc804616d2e601a58bd0d4b637ef3745fadc7ac0cae9d"
22
+ },
23
+ {
24
+ "description": "footer parent and right-aligned status",
25
+ "startInclusive": 209093603,
26
+ "endExclusive": 209099807,
27
+ "sha256": "5d9c5a87fdcbf304bce467c1569f7ddb6e10267929ba68184127a2adf7c6dda2"
28
+ },
29
+ {
30
+ "description": "effort label formatting",
31
+ "startInclusive": 208496116,
32
+ "endExclusive": 208496448,
33
+ "sha256": "840a01dd29dc8a6ccb0bdd5d4d4b4e93ac44711552725afa5bdbe278f31b846b"
34
+ }
35
+ ],
36
+ "candidates": [
37
+ {
38
+ "sourceCapture": "frame-07-after-channel-200ms.txt",
39
+ "sourceSha256": "1b30359fcb9181d02faf10ed0780812079222cf6c54b60ed468ce037c1ff37e7",
40
+ "candidateSha256": "e223df1791380aa2632bec04e584a821684991d1ce60a70426036dbcf5105c60",
41
+ "candidateBytes": 1194,
42
+ "rows": 35,
43
+ "geometry": {
44
+ "width": 110,
45
+ "height": 35
46
+ },
47
+ "changedRowIndices": [
48
+ 1,
49
+ 2,
50
+ 11
51
+ ],
52
+ "footer": {
53
+ "index": 11,
54
+ "oldGapSpaces": 37,
55
+ "newGapSpaces": 28,
56
+ "effortColumnZeroBased": 90,
57
+ "text": " \u23f5\u23f5 bypass permissions on (shift+tab to cycle) \u00b7 \u2190 for agents \u25d0 medium \u00b7 /effort"
58
+ },
59
+ "status": "SOURCE-DERIVED / SYNTHETIC, not an observed capture"
60
+ },
61
+ {
62
+ "sourceCapture": "frame-08-installed-after-channel-200ms.txt",
63
+ "sourceSha256": "f27d73189f2b1ba23899d99ba1596545f29d1d2494cb94b12ab314cf42426bef",
64
+ "candidateSha256": "0c83c1ccead19bfcd9bd6947a284948b30c551eae339258f66b6fe59b063c2e1",
65
+ "candidateBytes": 1128,
66
+ "rows": 35,
67
+ "geometry": {
68
+ "width": 110,
69
+ "height": 35
70
+ },
71
+ "changedRowIndices": [
72
+ 1,
73
+ 2,
74
+ 10
75
+ ],
76
+ "footer": {
77
+ "index": 10,
78
+ "oldGapSpaces": 37,
79
+ "newGapSpaces": 28,
80
+ "effortColumnZeroBased": 90,
81
+ "text": " \u23f5\u23f5 bypass permissions on (shift+tab to cycle) \u00b7 \u2190 for agents \u25d0 medium \u00b7 /effort"
82
+ },
83
+ "status": "SOURCE-DERIVED / SYNTHETIC, not an observed capture"
84
+ }
85
+ ],
86
+ "qualification": "SOURCE-DERIVED / SYNTHETIC complete empty Max/bypass/medium frames; not observed subscription captures",
87
+ "sampleHome": "/fixture/home"
88
+ }
@@ -0,0 +1,205 @@
1
+ {
2
+ "binarySha256": "03d66745e3bb69ec727d66023696f3820bc0a00a8a5ba725eb6706d0c67cbe69",
3
+ "version": "2.1.289",
4
+ "platform": "darwin-arm64",
5
+ "ranges": [
6
+ {
7
+ "id": "mode-symbols",
8
+ "start": 179782256,
9
+ "end": 179784383,
10
+ "sha256": "cc59173a00e4391864795bd39fa4da775cff19da9d858c3723b8878b7e4b1933"
11
+ },
12
+ {
13
+ "id": "mode-map",
14
+ "start": 179784383,
15
+ "end": 179785973,
16
+ "sha256": "290bd33df357cf05d275997cbe491bcb1689947829d9f106d6b1b9d2235384aa"
17
+ },
18
+ {
19
+ "id": "key-hint",
20
+ "start": 197498600,
21
+ "end": 197502800,
22
+ "sha256": "d666e7d25425520ac1b2e90f2e14e797b343d41df5f857ae645ec8f8c0f82103"
23
+ },
24
+ {
25
+ "id": "prompt-symbol",
26
+ "start": 187133430,
27
+ "end": 187133650,
28
+ "sha256": "29b53ed2eb87a241383e548d981fa1296bf72a386b46166e850b104d6201b220"
29
+ },
30
+ {
31
+ "id": "prompt-selector",
32
+ "start": 209099897,
33
+ "end": 209100980,
34
+ "sha256": "c8309eedb10e283a5a41261204c9dd8212b21bc50c9bbe2cf8d49192120b981a"
35
+ },
36
+ {
37
+ "id": "prompt-border",
38
+ "start": 209124438,
39
+ "end": 209125440,
40
+ "sha256": "61ba81594d61dc978f8e244c831465fc8fa4d0047c59a95136af9f85d41074e6"
41
+ },
42
+ {
43
+ "id": "editor-layout",
44
+ "start": 209158000,
45
+ "end": 209161530,
46
+ "sha256": "6f99e5bb96a73aa69fa977280c375e5829680041911e83aa634c28934e802b5f"
47
+ },
48
+ {
49
+ "id": "footer-mode",
50
+ "start": 208947546,
51
+ "end": 208948093,
52
+ "sha256": "bb9a808a262604016a60b52371acabdf71eb929a3d22a1d3b060e48cec8389cd"
53
+ },
54
+ {
55
+ "id": "footer-branches",
56
+ "start": 209072435,
57
+ "end": 209082570,
58
+ "sha256": "ea8c896b8d6225c76beddd9be6bd5d9c4d18ccefb15e35b79c725f2eafe45fe0"
59
+ },
60
+ {
61
+ "id": "footer-layout",
62
+ "start": 209093603,
63
+ "end": 209099807,
64
+ "sha256": "5d9c5a87fdcbf304bce467c1569f7ddb6e10267929ba68184127a2adf7c6dda2"
65
+ },
66
+ {
67
+ "id": "agent-hint",
68
+ "start": 209052245,
69
+ "end": 209055035,
70
+ "sha256": "4e528a20ee2cb4b931839f8eb72e33aada6940193e71c888c284e267fd3a974d"
71
+ },
72
+ {
73
+ "id": "effort",
74
+ "start": 208495700,
75
+ "end": 208496448,
76
+ "sha256": "ca7197f1491a673124e7ecc57e2c93198df1a8bdd4aa1bce9e1e0324ac5117a1"
77
+ },
78
+ {
79
+ "id": "trust",
80
+ "start": 213600100,
81
+ "end": 213603100,
82
+ "sha256": "a45e19812ac9f3d6002c2f9f6e4de3a2b156d83626712edaba016a9863d4f11a"
83
+ },
84
+ {
85
+ "id": "channel",
86
+ "start": 215139100,
87
+ "end": 215140720,
88
+ "sha256": "a6e330a9166ff933b226263ddda384c8a6d03167e3d5bd4d39ce3a1ba1b6a103"
89
+ },
90
+ {
91
+ "id": "managed-settings",
92
+ "start": 205478700,
93
+ "end": 205479600,
94
+ "sha256": "85b72e92961af88f400d9630ace4a42eb61ea55236622c6aa812cf59434aca9e"
95
+ },
96
+ {
97
+ "id": "api-key",
98
+ "start": 215175700,
99
+ "end": 215176620,
100
+ "sha256": "40979b32fca9c0d29f6546378f8105ae1074bd915d4672475822b0209ee839f0"
101
+ },
102
+ {
103
+ "id": "login",
104
+ "start": 203523150,
105
+ "end": 203523800,
106
+ "sha256": "44e632bee5f03f98df47fbfcde92d76dfbbb70cbc59cafa4de797b80c0e83e83"
107
+ },
108
+ {
109
+ "id": "permission-question",
110
+ "start": 208009000,
111
+ "end": 208009700,
112
+ "sha256": "63e00a8b392249ec7c730314f4f95931ff3f8b9d4182f15be6434b5c76b082de"
113
+ },
114
+ {
115
+ "id": "connection-question",
116
+ "start": 209416500,
117
+ "end": 209417050,
118
+ "sha256": "53ac231cb85f5f70d042daca6ee58748d880ed79f98a6e0b15f189aa6080654d"
119
+ },
120
+ {
121
+ "id": "permission-wait",
122
+ "start": 209207500,
123
+ "end": 209208080,
124
+ "sha256": "0f483d8338bdf69daacf8b671bcac4b7bbd95094f99da5d7ef919c36c3e54fa9"
125
+ },
126
+ {
127
+ "id": "confirmation-guide",
128
+ "start": 202713350,
129
+ "end": 202714100,
130
+ "sha256": "830d7821db28f650d2465690ab7d35076768b8c091f3667f945b839af4426555"
131
+ },
132
+ {
133
+ "id": "lower-cancel",
134
+ "start": 197647850,
135
+ "end": 197648260,
136
+ "sha256": "14947f734aa61d45fb13fb17e41294825b70598ca97f782486063995569848fa"
137
+ },
138
+ {
139
+ "id": "selection-dialog",
140
+ "start": 217942250,
141
+ "end": 217943000,
142
+ "sha256": "4a454e26a631e6c39fc490379d94be0e67b973f4fba3421137b9ef82a8e31d34"
143
+ },
144
+ {
145
+ "id": "gateway",
146
+ "start": 203506200,
147
+ "end": 203506740,
148
+ "sha256": "359b0da11cab049a15c9f8411c25a38b5d54d22007fc8439b328893170eb5963"
149
+ },
150
+ {
151
+ "id": "round-border-glyphs",
152
+ "start": 182630499,
153
+ "end": 182630665,
154
+ "sha256": "6b03cfc0d757ebd18a1f171a012e05e78af72dba34cd636f6843272282d14f5d"
155
+ }
156
+ ],
157
+ "note": "Read-only source qualification; no harness execution or copied modules. Marker set is finite, not exhaustive of unknown dialogs.",
158
+ "contract": "post-submitted-completion-v1",
159
+ "layout": "non-Jt (tengu_copper_thistle=false); no runtime flag inspection",
160
+ "acceptedRisk": "Unknown dialogs retaining the composer/footer can be misclassified completed; no subsequent input or readiness inference.",
161
+ "markers": [
162
+ "Accessing workspace:",
163
+ "Quick safety check:",
164
+ "Yes, I trust this folder",
165
+ "No, continue without these permissions",
166
+ "No, exit",
167
+ "WARNING: Loading development channels",
168
+ "I am using this for local development",
169
+ "Managed settings require approval",
170
+ "Yes, I trust these settings",
171
+ "No, exit Claude Code",
172
+ "Do you want to use this API key?",
173
+ "Detected a custom API key in your environment",
174
+ "Select login method:",
175
+ "Do you want to proceed?",
176
+ "Do you want to allow this connection?",
177
+ "Waiting for permission…",
178
+ "Enter to confirm",
179
+ "Esc to cancel",
180
+ "esc to cancel",
181
+ "Enter to select",
182
+ "Esc to exit"
183
+ ],
184
+ "observedRegression": {
185
+ "file": "test/fixtures/launch-prompts/claude-max-started-home-sanitized.txt",
186
+ "classification": "SANITIZED DERIVATIVE, not raw replay or exact spinner matcher",
187
+ "rawBytes": 1217,
188
+ "rawSha256": "bb59a8cf1ef0d1a07c7f298e4c6f51227f12e09e6c8ae16b2eb6bc4248436a93",
189
+ "derivativeBytes": 1156,
190
+ "derivativeSha256": "49c8073ae86da4325dc03587d4ff1568cc39b8f6dda0d451bc776b876adcb6a0",
191
+ "changedRowIndices": [
192
+ 2
193
+ ],
194
+ "sampleHome": "/fixture/home",
195
+ "geometry": {
196
+ "width": 110,
197
+ "height": 35
198
+ },
199
+ "source": "controller-compared-frame",
200
+ "captureTime": null,
201
+ "retainedAt": "2026-10-07T20:10:57.986Z",
202
+ "candidateHead": "57d993fc28681e8f4803d19bf227f19ff43f4aea",
203
+ "meaning": "Observed transient in-progress task turn; not idle, ready, or recurring spinner qualification."
204
+ }
205
+ }
@@ -1,6 +1,7 @@
1
1
  import { constants, openSync, closeSync, readSync, fstatSync, lstatSync, realpathSync, readFileSync } from "node:fs";
2
2
  import { createHash } from "node:crypto";
3
3
  import { homedir } from "node:os";
4
+ import { classifyClaudeLaunchCompletion } from "./launch-prompt-completion.mjs";
4
5
 
5
6
  const ROOT = new URL("./launch-prompt-fixtures/claude-2.1.289-darwin-arm64/", import.meta.url);
6
7
  const MANIFEST = JSON.parse(readFileSync(new URL("manifest.json", ROOT), "utf8"));
@@ -58,7 +59,7 @@ function captured(name) {
58
59
  }
59
60
 
60
61
  // Accepted as a completion-only finite policy, not a general claim about
61
- // Claude's path renderer. Apart from the source-derived billing atom below,
62
+ // Claude's path renderer. Apart from the source-derived header/footer below,
62
63
  // all surrounding bytes remain the captured frame.
63
64
  // Nothing produced here can match a prompt or authorize an input action.
64
65
  function completedFrames(home) {
@@ -79,11 +80,19 @@ function completedFrames(home) {
79
80
  // empty input/status frame remains exact; these are not account captures.
80
81
  // See launch-prompt-fixtures/README.md for the pinned source provenance.
81
82
  const billings = ["API Usage Billing", "Claude Max", "Claude Pro", "Claude Team", "Claude Enterprise"];
82
- return banners.flatMap(name => [...paths].filter(path => prefix.length + path.length <= MANIFEST.geometry.width).flatMap(path => billings.map(billing => {
83
+ return banners.flatMap(name => [...paths].filter(path => prefix.length + path.length <= MANIFEST.geometry.width).flatMap(path => billings.flatMap(billing => {
83
84
  const variant = captured(name).split("\n");
84
85
  variant[1] = "▝▜██████▀ Opus 5.5 · " + billing;
85
86
  variant[2] = prefix + path;
86
- return variant.join("\n");
87
+ const auto = variant.join("\n");
88
+ if (billing !== "Claude Max") return [auto];
89
+ // Source-qualified whole-frame variant, not normalization of pane output:
90
+ // the longer non-default mode label consumes nine columns of the gap.
91
+ const autoFooter = " ⏵⏵ auto mode on (shift+tab to cycle) · ← for agents" + " ".repeat(37) + "◐ medium · /effort";
92
+ const footer = name === banners[0] ? 11 : 10;
93
+ if (variant[footer] !== autoFooter) throw new Error("fixture footer integrity");
94
+ variant[footer] = " ⏵⏵ bypass permissions on (shift+tab to cycle) · ← for agents" + " ".repeat(28) + "◐ medium · /effort";
95
+ return [auto, variant.join("\n")];
87
96
  })));
88
97
  }
89
98
 
@@ -112,9 +121,11 @@ export function qualifyLaunchPromptFixtures({ home, harness, executablePath, arg
112
121
  frame(captured("frame-05-channel-seeded.txt"), "prompt", [], { class: "awebDevelopmentChannel" }),
113
122
  ...[[], ["awebDevelopmentChannel"]].flatMap(after => completedFrames(home).map(text => frame(text, "completed", after))),
114
123
  ] });
124
+ result.classifyCompletion = classifyClaudeLaunchCompletion;
115
125
  }
116
126
  } catch {
117
127
  result.fixtures = [];
128
+ delete result.classifyCompletion;
118
129
  }
119
130
  return result;
120
131
  }
@@ -17,7 +17,7 @@ const wait = ms => Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0,
17
17
  * frames (text, width, height), never a substring or whitespace normalization.
18
18
  * audit receives launch-prompt event data and returns appendEvent's checked result.
19
19
  */
20
- export function createLaunchPromptController({ home, startId, harness, policy = {}, transport, audit,
20
+ export function createLaunchPromptController({ home, startId, harness, policy = {}, transport, audit, retainFrame, classifyCompletion,
21
21
  now = () => performance.now(), sleep = wait, fixtures = [], geometry, validateExecutable, expectedHomeIdentity }) {
22
22
  const selectedHarness = typeof harness === "string" ? { name: harness } : { ...harness };
23
23
  const consent = { ...policy };
@@ -96,6 +96,12 @@ export function createLaunchPromptController({ home, startId, harness, policy =
96
96
  return candidates.length === 1 ? candidates[0] : null;
97
97
  }
98
98
  const exact = (a, b) => sameTarget(a, b) && a.width === b.width && a.height === b.height && a.text === b.text;
99
+ function retain(screen, outcome, recognition) {
100
+ try {
101
+ return retainFrame?.({ home, homeIdentity: { ...identity }, startId, target: { ...target },
102
+ screen: { text: screen.text, width: screen.width, height: screen.height }, outcome, recognition })?.ok === true;
103
+ } catch { return false; } // No raw text, OS diagnostic or private receipt escapes.
104
+ }
99
105
  function observe(t, before) {
100
106
  if (used) return terminal ?? { status: "blocked", answers: [], reason: "blocked: launch authority already used", receipt: [] };
101
107
  used = true;
@@ -140,8 +146,24 @@ export function createLaunchPromptController({ home, startId, harness, policy =
140
146
  sleep(Math.min(INTERVAL, remaining()));
141
147
  continue;
142
148
  }
143
- const match = matching(screen);
144
- if (!match) return finish("blocked", "blocked: unexpected prompt");
149
+ const submitted = answers.length === 1 && answers[0].status === "submitted";
150
+ // The initial exact question contains these same markers: completion
151
+ // policy is reachable ONLY after its sole key was durably submitted.
152
+ const completion = submitted ? classifyCompletion?.(screen) : null;
153
+ const match = completion === "blocked" ? null : matching(screen);
154
+ if (!match && completion === "completed") {
155
+ if (!retain(screen, "completed", "structural")) return finish("incomplete", "private launch evidence retention failed");
156
+ return finish("completed", "recognized launch boundary");
157
+ }
158
+ if (!match) {
159
+ let reason = "blocked: unexpected prompt";
160
+ if (submitted && screen.width === 110 && screen.height === 35 && retainFrame) {
161
+ // This is the exact object just compared, not a later pane capture.
162
+ // Private evidence cannot authorize input or change the launch outcome.
163
+ if (!retain(screen, "blocked", "unmatched")) reason += "; private launch evidence retention failed";
164
+ }
165
+ return finish("blocked", reason);
166
+ }
145
167
  const { fixture, frame } = match;
146
168
  const prior = answers.map(a => a.class);
147
169
  if (frame.kind === "completed") return finish("completed", "recognized launch boundary");