@sapiom/harness 0.8.5 → 0.8.7
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/CHANGELOG.md +22 -0
- package/dist/core/adapters/codex.d.ts +9 -15
- package/dist/core/adapters/codex.d.ts.map +1 -1
- package/dist/core/adapters/codex.js +109 -27
- package/dist/core/adapters/codex.js.map +1 -1
- package/dist/core/session-manager.d.ts +70 -31
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +285 -65
- package/dist/core/session-manager.js.map +1 -1
- package/dist/shared/types.d.ts +38 -22
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/shared/types.js.map +1 -1
- package/dist/web/assets/{index-BAW1BY7L.js → index-CDiqjxvC.js} +30 -30
- package/dist/web/index.html +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @sapiom/harness
|
|
2
2
|
|
|
3
|
+
## 0.8.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5409191: Recognize the Codex CLI 0.143 empty-composer screen so accepting a new
|
|
8
|
+
directory's trust prompt releases Agent Studio's held initial prompt. Also
|
|
9
|
+
best-effort recognize future composer copy changes from the input marker and
|
|
10
|
+
cwd footer while known onboarding fragments remain blocking.
|
|
11
|
+
|
|
12
|
+
## 0.8.6
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 3d79aab: Release held Agent Studio prompts into Codex once its terminal has rendered a
|
|
17
|
+
stable, non-blocking screen. Partial terminal repaints retain recognized
|
|
18
|
+
blockers until the empty composer is positively identified, while a bounded
|
|
19
|
+
fallback prevents animation or an incomplete repaint from waiting forever.
|
|
20
|
+
Initial prompts remain held through Codex trust, sign-in, and setup flows, and
|
|
21
|
+
Claude Code's SessionStart readiness behavior is unchanged. Codex may now
|
|
22
|
+
report `ready: true` before its first rollout/transcript exists: readiness
|
|
23
|
+
describes an input-safe TUI, not durable conversation metadata.
|
|
24
|
+
|
|
3
25
|
## 0.8.5
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -39,24 +39,18 @@ export declare class CodexAdapter implements HarnessAdapter {
|
|
|
39
39
|
launch(opts: LaunchOpts): SpawnSpec;
|
|
40
40
|
resume(agentSessionId: string, opts: LaunchOpts): SpawnSpec;
|
|
41
41
|
/**
|
|
42
|
-
* See `HarnessAdapter.detectBlockingPrompt`. Codex
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* injection that needs it — a scrollback check is the only thing that
|
|
51
|
-
* can stand in for it up to that point.
|
|
52
|
-
*/
|
|
53
|
-
/**
|
|
54
|
-
* See `HarnessAdapter.readyFallback`: `isReadyEnough` may trust a settled,
|
|
55
|
-
* prompt-free scrollback immediately — Codex's real readiness signal cannot
|
|
56
|
-
* arrive before the first injection needs it (see detectBlockingPrompt).
|
|
42
|
+
* See `HarnessAdapter.readyFallback` and `detectBlockingPrompt`. Codex's
|
|
43
|
+
* rollout file — and therefore the SessionStart-equivalent event
|
|
44
|
+
* `SessionManager` otherwise waits on — isn't written until the first turn
|
|
45
|
+
* is submitted. Confirmed empirically against codex-cli 0.134.0: an idle,
|
|
46
|
+
* fully-interactive session produces no rollout for as long as nothing is
|
|
47
|
+
* submitted. SessionManager therefore publishes fallback readiness after a
|
|
48
|
+
* non-blocking frame settles (or reaches its bounded liveness ceiling),
|
|
49
|
+
* while retaining the same check at request time.
|
|
57
50
|
*/
|
|
58
51
|
readonly readyFallback: "immediate";
|
|
59
52
|
detectBlockingPrompt(scrollback: string): boolean;
|
|
53
|
+
detectReadyPrompt(terminalOutput: string): boolean;
|
|
60
54
|
/**
|
|
61
55
|
* See `HarnessAdapter.canResume`. Reuses the same rollout walk +
|
|
62
56
|
* `session_meta` read `listPastSessions` is built on, so "codex has this
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AASH,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,SAAS,EACV,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AASH,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,SAAS,EACV,MAAM,uBAAuB,CAAC;AAiH/B,MAAM,WAAW,mBAAmB;IAClC,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAuHD,qBAAa,YAAa,YAAW,cAAc;IACjD,QAAQ,CAAC,EAAE,EAAG,OAAO,CAAU;IAC/B,QAAQ,CAAC,WAAW,EAAG,iBAAiB,CAAU;IAClD;;;0EAGsE;IACtE,QAAQ,CAAC,oBAAoB,EAAG,aAAa,CAAU;IACvD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,GAAE,mBAAwB;IAKvC,MAAM,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAetC,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS;IAWnC,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,SAAS;IAS3D;;;;;;;;;OASG;IACH,QAAQ,CAAC,aAAa,EAAG,WAAW,CAAU;IAE9C,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAOjD,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO;IAUlD;;;;;;;;;;;;OAYG;IACG,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWhE,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;CAyClE;AA8DD,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,cAAc,CAEhF"}
|
|
@@ -33,18 +33,98 @@ const execFileAsync = promisify(execFile);
|
|
|
33
33
|
const ROLLOUT_HEAD_BYTES = 65536;
|
|
34
34
|
const MAX_SCAN_DEPTH = 4; // ~/.codex/sessions/YYYY/MM/DD/*.jsonl
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* so even a stripped buffer runs the words together with no separator at
|
|
42
|
-
* all; `\s*` between them tolerates that (and ordinary whitespace, in case
|
|
43
|
-
* a future TUI revision renders differently). See `detectBlockingPrompt`
|
|
44
|
-
* for why this exists at all (Codex's own structured readiness signal can't
|
|
45
|
-
* be relied on standalone, unlike Claude Code's).
|
|
36
|
+
* Turn a rendered phrase into a pattern that also matches Codex's cursor-
|
|
37
|
+
* positioned output. Confirmed against real captures: the TUI can position
|
|
38
|
+
* each *word* separately instead of emitting literal spaces
|
|
39
|
+
* (`trust\x1b[3;16Hthe\x1b[3;20H...`), so `stripAnsi()` leaves adjacent words.
|
|
40
|
+
* `\s*` accepts both that representation and ordinary terminal text.
|
|
46
41
|
*/
|
|
47
|
-
|
|
42
|
+
function tuiPhrase(phrase) {
|
|
43
|
+
const escapedWords = phrase
|
|
44
|
+
.trim()
|
|
45
|
+
.split(/\s+/)
|
|
46
|
+
.map((word) => word.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
47
|
+
return new RegExp(escapedWords.join("\\s*"), "i");
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Recognizable signatures for Codex screens that need a human choice before
|
|
51
|
+
* the composer is safe for injected input. A signature may require multiple
|
|
52
|
+
* phrases so ordinary agent output mentioning one short label does not hold
|
|
53
|
+
* later programmatic input indefinitely.
|
|
54
|
+
*
|
|
55
|
+
* These strings are verified against codex-cli 0.147.0's onboarding, auth,
|
|
56
|
+
* model-migration, personality, and theme-picker sources. Detection remains
|
|
57
|
+
* deliberately best-effort: when Codex adds a new interactive startup screen,
|
|
58
|
+
* its stable rendered copy must be added here.
|
|
59
|
+
*/
|
|
60
|
+
const BLOCKING_PROMPT_SIGNATURES = [
|
|
61
|
+
[
|
|
62
|
+
tuiPhrase("trust the contents of this directory"),
|
|
63
|
+
tuiPhrase("Yes, continue"),
|
|
64
|
+
tuiPhrase("No, quit"),
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
tuiPhrase("Sign in with ChatGPT to use Codex as part of your paid plan"),
|
|
68
|
+
tuiPhrase("connect an API key for usage-based billing"),
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
tuiPhrase("Finish signing in via your browser"),
|
|
72
|
+
tuiPhrase("open the following link to authenticate"),
|
|
73
|
+
],
|
|
74
|
+
[
|
|
75
|
+
tuiPhrase("Preparing device code login"),
|
|
76
|
+
tuiPhrase("Open this link in your browser and sign in"),
|
|
77
|
+
],
|
|
78
|
+
[
|
|
79
|
+
tuiPhrase("Use your own OpenAI API key for usage-based billing"),
|
|
80
|
+
tuiPhrase("Paste or type your API key"),
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
tuiPhrase("Before you start"),
|
|
84
|
+
tuiPhrase("Decide how much autonomy you want to grant Codex"),
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
tuiPhrase("Codex just got an upgrade"),
|
|
88
|
+
tuiPhrase("Choose how you'd like Codex to proceed"),
|
|
89
|
+
],
|
|
90
|
+
[
|
|
91
|
+
tuiPhrase("Select Personality"),
|
|
92
|
+
tuiPhrase("Choose a communication style for Codex"),
|
|
93
|
+
],
|
|
94
|
+
[tuiPhrase("Select Syntax Theme"), tuiPhrase("Type to filter themes")],
|
|
95
|
+
];
|
|
96
|
+
/**
|
|
97
|
+
* Stable empty-composer copy across supported Codex CLI releases. This is not
|
|
98
|
+
* required for the ordinary already-trusted path; SessionManager uses it to
|
|
99
|
+
* prove that a previously detected onboarding screen has actually been
|
|
100
|
+
* replaced. Keep older copy here as well as newer copy: a real 0.143.0 startup
|
|
101
|
+
* renders "Use /skills to list available skills", while 0.147.0 renders "Ask
|
|
102
|
+
* Codex to do anything". Without both, accepting a trust prompt on 0.143.0
|
|
103
|
+
* leaves the safety latch closed even though the composer is visible.
|
|
104
|
+
*/
|
|
105
|
+
const READY_PROMPT_PATTERNS = [
|
|
106
|
+
tuiPhrase("Ask Codex to do anything"),
|
|
107
|
+
tuiPhrase("Use /skills to list available skills"),
|
|
108
|
+
];
|
|
109
|
+
/**
|
|
110
|
+
* Copy-independent composer proof. Codex's empty input row carries the `›`
|
|
111
|
+
* marker and its footer separates the mode from the cwd with `·`; onboarding
|
|
112
|
+
* selectors can use the same marker, but do not render that cwd footer. The
|
|
113
|
+
* blocker check in SessionManager still wins when a known modal and the
|
|
114
|
+
* underlying composer are present in the same diff-rendered frame.
|
|
115
|
+
*/
|
|
116
|
+
const COMPOSER_INPUT_MARKER = /›/u;
|
|
117
|
+
const COMPOSER_CWD_FOOTER = /·\s*(?:~[\\/]|\/|[A-Za-z]:[\\/])/u;
|
|
118
|
+
/**
|
|
119
|
+
* A modal can repaint only its moved selection row while leaving Codex's
|
|
120
|
+
* underlying footer visible. Full blocker detection deliberately requires a
|
|
121
|
+
* whole multi-phrase signature, but clearing an already-latched blocker is
|
|
122
|
+
* stricter: any one known modal fragment vetoes composer readiness until a
|
|
123
|
+
* clean frame arrives.
|
|
124
|
+
*/
|
|
125
|
+
function hasBlockingPromptFragment(rendered) {
|
|
126
|
+
return BLOCKING_PROMPT_SIGNATURES.some((signature) => signature.some((pattern) => pattern.test(rendered)));
|
|
127
|
+
}
|
|
48
128
|
/** Read only the head of a (possibly huge) rollout file and extract its
|
|
49
129
|
* `session_meta` entry. Codex always writes `session_meta` as the first
|
|
50
130
|
* line, but this tolerates a few leading blank/malformed lines defensively. */
|
|
@@ -169,21 +249,14 @@ export class CodexAdapter {
|
|
|
169
249
|
* too and neither adapter needs a rehydration-specific code path. */
|
|
170
250
|
this.systemPromptDelivery = "launch-flag";
|
|
171
251
|
/**
|
|
172
|
-
* See `HarnessAdapter.detectBlockingPrompt`. Codex
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* injection that needs it — a scrollback check is the only thing that
|
|
181
|
-
* can stand in for it up to that point.
|
|
182
|
-
*/
|
|
183
|
-
/**
|
|
184
|
-
* See `HarnessAdapter.readyFallback`: `isReadyEnough` may trust a settled,
|
|
185
|
-
* prompt-free scrollback immediately — Codex's real readiness signal cannot
|
|
186
|
-
* arrive before the first injection needs it (see detectBlockingPrompt).
|
|
252
|
+
* See `HarnessAdapter.readyFallback` and `detectBlockingPrompt`. Codex's
|
|
253
|
+
* rollout file — and therefore the SessionStart-equivalent event
|
|
254
|
+
* `SessionManager` otherwise waits on — isn't written until the first turn
|
|
255
|
+
* is submitted. Confirmed empirically against codex-cli 0.134.0: an idle,
|
|
256
|
+
* fully-interactive session produces no rollout for as long as nothing is
|
|
257
|
+
* submitted. SessionManager therefore publishes fallback readiness after a
|
|
258
|
+
* non-blocking frame settles (or reaches its bounded liveness ceiling),
|
|
259
|
+
* while retaining the same check at request time.
|
|
187
260
|
*/
|
|
188
261
|
this.readyFallback = "immediate";
|
|
189
262
|
this.binary = options.binary ?? "codex";
|
|
@@ -223,7 +296,16 @@ export class CodexAdapter {
|
|
|
223
296
|
};
|
|
224
297
|
}
|
|
225
298
|
detectBlockingPrompt(scrollback) {
|
|
226
|
-
|
|
299
|
+
const rendered = stripAnsi(scrollback);
|
|
300
|
+
return BLOCKING_PROMPT_SIGNATURES.some((signature) => signature.every((pattern) => pattern.test(rendered)));
|
|
301
|
+
}
|
|
302
|
+
detectReadyPrompt(terminalOutput) {
|
|
303
|
+
const rendered = stripAnsi(terminalOutput);
|
|
304
|
+
if (hasBlockingPromptFragment(rendered))
|
|
305
|
+
return false;
|
|
306
|
+
return (READY_PROMPT_PATTERNS.some((pattern) => pattern.test(rendered)) ||
|
|
307
|
+
(COMPOSER_INPUT_MARKER.test(rendered) &&
|
|
308
|
+
COMPOSER_CWD_FOOTER.test(rendered)));
|
|
227
309
|
}
|
|
228
310
|
/**
|
|
229
311
|
* See `HarnessAdapter.canResume`. Reuses the same rollout walk +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../../src/core/adapters/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAStC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C;;;;4BAI4B;AAC5B,MAAM,kBAAkB,GAAG,KAAM,CAAC;AAClC,MAAM,cAAc,GAAG,CAAC,CAAC,CAAC,uCAAuC;AAEjE
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../../src/core/adapters/codex.ts"],"names":[],"mapp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1B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;YAC3D,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,0BAA0B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACtE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CACX,oDAAoD,IAAI,CAAC,gBAAgB,oDAAqD,GAAa,CAAC,OAAO,EAAE,CACtJ,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAA6B;IAC9D,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -250,29 +250,63 @@ export declare class SessionManager {
|
|
|
250
250
|
* care that the session is active right now, not each individual chunk.
|
|
251
251
|
*/
|
|
252
252
|
private recordActivity;
|
|
253
|
+
/**
|
|
254
|
+
* Maintain a readiness-only view of terminal output. Codex's Ratatui loop
|
|
255
|
+
* emits a ~500-byte cursor/erase repaint every 80ms even when the visible
|
|
256
|
+
* screen is unchanged. Counting those chunks as startup progress both
|
|
257
|
+
* prevents the 700ms settle window from ever completing and pushes a real
|
|
258
|
+
* sign-in/trust prompt out of the raw 4KB tail. Synchronized-output markers
|
|
259
|
+
* give us an atomic repaint boundary: retain the latest repaint containing
|
|
260
|
+
* visible text, keep a bounded union for diff-rendered blocking prompts,
|
|
261
|
+
* and ignore control-only frames. Non-Ratatui adapters fall back to an
|
|
262
|
+
* ordinary rolling buffer.
|
|
263
|
+
*/
|
|
264
|
+
private recordReadinessOutput;
|
|
265
|
+
private hasVisibleReadinessContent;
|
|
266
|
+
private noteReadinessContent;
|
|
267
|
+
private commitReadinessOutput;
|
|
253
268
|
setAgentSessionId(id: string, agentSessionId: string): void;
|
|
254
269
|
/**
|
|
255
270
|
* Marks a session's TUI as genuinely interactive — see `HarnessSession.ready`.
|
|
256
|
-
* Called from the ingest pipeline when a SessionStart(-equivalent)
|
|
257
|
-
* is processed for this session (real hook for Claude Code, tailer-
|
|
258
|
-
* translated for Codex)
|
|
259
|
-
* ready is a silent no-op.
|
|
271
|
+
* Called either from the ingest pipeline when a SessionStart(-equivalent)
|
|
272
|
+
* event is processed for this session (real hook for Claude Code, tailer-
|
|
273
|
+
* translated for Codex), or from an adapter-declared readiness fallback.
|
|
274
|
+
* Idempotent; a session that's exited or already ready is a silent no-op.
|
|
260
275
|
*/
|
|
261
276
|
setReady(id: string): void;
|
|
262
277
|
/**
|
|
263
278
|
* Whether `id` should be treated as ready to receive programmatic input
|
|
264
|
-
* right now
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
* standalone, and a scrollback guess would just reopen the exact race
|
|
273
|
-
* this mechanism exists to close.
|
|
279
|
+
* right now. A real/fallback `session.ready` signal normally suffices; an
|
|
280
|
+
* immediate-fallback adapter gets one last recognized-blocker scan because
|
|
281
|
+
* readiness is latched while its TUI can still paint a late onboarding
|
|
282
|
+
* frame. Before readiness, immediate and legacy detect-only adapters require
|
|
283
|
+
* at least `READY_SETTLE_MS` of quiet output (or the bounded liveness
|
|
284
|
+
* ceiling) and a clean recent-screen view. Claude Code has no immediate
|
|
285
|
+
* shortcut — its SessionStart hook (or preserved 20-second hook-timeout
|
|
286
|
+
* path) controls readiness.
|
|
274
287
|
*/
|
|
275
288
|
private isReadyEnough;
|
|
289
|
+
private isImmediateFallbackSettled;
|
|
290
|
+
/** The best available current frame, excluding older diff repaint history.
|
|
291
|
+
* Used after readiness has latched so ordinary agent output that quotes old
|
|
292
|
+
* onboarding copy cannot permanently gate later writes. */
|
|
293
|
+
private currentReadinessOutput;
|
|
294
|
+
/** A bounded union of recent diff repaints, including an unfinished current
|
|
295
|
+
* repaint. This is intentionally only used before immediate readiness. */
|
|
296
|
+
private recentReadinessOutput;
|
|
297
|
+
/** Preserve a recognized blocker across Ratatui's partial row repaints. The
|
|
298
|
+
* latch is cleared only by a positive empty-composer match in a clean current
|
|
299
|
+
* frame; merely failing to re-render every phrase is not evidence that the
|
|
300
|
+
* screen was dismissed. */
|
|
301
|
+
private refreshImmediatePromptState;
|
|
302
|
+
private hasImmediateBlockingPrompt;
|
|
303
|
+
/** The original readiness-buffer check retained for Claude's hook-timeout
|
|
304
|
+
* and legacy detect-only adapters. Their fallback semantics must not change
|
|
305
|
+
* merely because Codex needs partial-frame reconstruction. */
|
|
306
|
+
private hasRetainedBlockingPrompt;
|
|
307
|
+
/** Scan only the best available current frame; dismissed full-screen prompts
|
|
308
|
+
* remain in older scrollback forever and must not block already-ready input. */
|
|
309
|
+
private hasCurrentBlockingPrompt;
|
|
276
310
|
/**
|
|
277
311
|
* Polls `isReadyEnough` until it's true, the session's pty goes away
|
|
278
312
|
* (killed/exited — it's never going to become ready now), or `timeoutMs`
|
|
@@ -293,28 +327,33 @@ export declare class SessionManager {
|
|
|
293
327
|
setBoundWorkflowPath(id: string, workflowPath: string | null): void;
|
|
294
328
|
private spawn;
|
|
295
329
|
/**
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
* Bash resolves no `.cmd`, so a machine whose only node is a .cmd shim runs
|
|
301
|
-
* zero hooks) the session looked fine in the terminal while every held
|
|
302
|
-
* prompt was silently dropped after the SPA's timeout.
|
|
330
|
+
* Publishes adapter-declared fallback readiness so the SPA's held first
|
|
331
|
+
* prompt can be released even when the harness's real lifecycle signal
|
|
332
|
+
* cannot arrive yet (Codex) or never arrived (Claude Code with a broken
|
|
333
|
+
* SessionStart hook).
|
|
303
334
|
*
|
|
304
|
-
*
|
|
305
|
-
* - fires no earlier than HOOK_READY_FALLBACK_MS after spawn — a healthy
|
|
306
|
-
* hook (1–3s) always wins the race, so behaviour only changes on
|
|
307
|
-
* machines where the hook is already broken;
|
|
335
|
+
* Both modes are conservative on purpose:
|
|
308
336
|
* - requires SOME output — a pty that hasn't drawn anything yet isn't an
|
|
309
|
-
* interactive TUI
|
|
310
|
-
* - keeps waiting while
|
|
311
|
-
*
|
|
312
|
-
* can never answer a dialog the user hasn't seen — once the user
|
|
313
|
-
* dismisses it, the next poll flips ready;
|
|
337
|
+
* interactive TUI, it's still starting;
|
|
338
|
+
* - keeps waiting while an adapter-recognized blocking prompt is on screen,
|
|
339
|
+
* so known trust/login/setup screens are not answered by injected input;
|
|
314
340
|
* - dies with the handle (exit clears the interval; a replaced handle is
|
|
315
341
|
* detected via the ptys map, same idempotency rule as markExited()).
|
|
342
|
+
*
|
|
343
|
+
* `"immediate"` (Codex) reuses the same quiet-window/ceiling and frame rule
|
|
344
|
+
* as `isReadyEnough()`, but proactively calls `setReady()` once output is
|
|
345
|
+
* stable or reaches the bounded liveness ceiling. That status event closes
|
|
346
|
+
* the first-prompt deadlock:
|
|
347
|
+
* Codex writes no rollout/session_meta before turn one, while the SPA waits
|
|
348
|
+
* for `ready` before submitting turn one. Only an EXPLICIT declaration arms
|
|
349
|
+
* this persistent state transition; detect-only legacy adapters retain their
|
|
350
|
+
* request-time `isReadyEnough()` compatibility path without being promoted.
|
|
351
|
+
*
|
|
352
|
+
* `"hook-timeout"` (Claude Code) retains its generous 20s delay: a healthy
|
|
353
|
+
* hook (1–3s) always wins the race, so behaviour only changes on machines
|
|
354
|
+
* where the hook is already broken.
|
|
316
355
|
*/
|
|
317
|
-
private
|
|
356
|
+
private armReadyFallback;
|
|
318
357
|
/**
|
|
319
358
|
* Transitions a session to "exited". Shared by node-pty's own `onExit`
|
|
320
359
|
* callback and `kill()`'s missed-event fallback (see `kill()`) — both are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../../src/core/session-manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,EAGL,KAAK,oBAAoB,EAC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