@farmslot/agent-runtime 0.39.6 → 0.39.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
CHANGED
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
- Active-development baseline; add user-facing changes here before release or package publication.
|
|
10
10
|
|
|
11
|
+
## 0.39.7 - 2026-10-28
|
|
12
|
+
|
|
13
|
+
- Wait for Codex review folder consent before completing terminal startup; provisional startup frames no longer bypass Open restricted.
|
|
14
|
+
|
|
11
15
|
## 0.39.6 - 2026-10-28
|
|
12
16
|
|
|
13
17
|
- PR completion keeps linked criteria as evidence and checks worker-derived requirements without waiting for review.
|
package/package.json
CHANGED
|
@@ -19,19 +19,15 @@ const ENDINGS = [
|
|
|
19
19
|
// need review" (enter confirm · esc skip); unknown ones must fail, not wait out.
|
|
20
20
|
const PROMPT_MARKERS =
|
|
21
21
|
/folder access|open restricted|trust this folder|trust and continue|trust all|hooks need review|update available|enter continue|enter confirm|esc quit|esc back|esc skip|press enter|\(y\/n\)/i;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
// footer before Folder access appears, so an idle composer only counts as ready
|
|
26
|
-
// once it has held this long.
|
|
27
|
-
const LOADING = /OpenAI Codex \(v[^)]*\) loading/;
|
|
28
|
-
const IDLE_READY_MS = 1_500;
|
|
22
|
+
// Codex 0.165 paints its editable startup composer while folder consent is
|
|
23
|
+
// still pending. Neither an idle footer nor "esc to interrupt" completes this
|
|
24
|
+
// handshake: this untrusted review must observe and answer Open restricted.
|
|
29
25
|
|
|
30
26
|
const collapse = (text) => text.replace(/\s+/g, ' ').trim();
|
|
31
27
|
|
|
32
28
|
/**
|
|
33
29
|
* Classify a captured Codex pane: the exact Folder access screen for one of
|
|
34
|
-
* `folders`, any other prompt,
|
|
30
|
+
* `folders`, any other prompt, or starting. Composer text is not startup evidence.
|
|
35
31
|
*/
|
|
36
32
|
function classifyCodexLaunchScreen(pane, folders) {
|
|
37
33
|
const text = collapse(pane);
|
|
@@ -44,8 +40,6 @@ function classifyCodexLaunchScreen(pane, folders) {
|
|
|
44
40
|
return { kind: 'folder-access' };
|
|
45
41
|
}
|
|
46
42
|
if (PROMPT_MARKERS.test(text)) return { kind: 'prompt' };
|
|
47
|
-
if (WORKING.test(text)) return { kind: 'working' };
|
|
48
|
-
if (!LOADING.test(text) && COMPOSER.test(text)) return { kind: 'idle' };
|
|
49
43
|
return { kind: 'starting' };
|
|
50
44
|
}
|
|
51
45
|
|
|
@@ -57,18 +51,16 @@ const excerpt = (pane) =>
|
|
|
57
51
|
.join('\n');
|
|
58
52
|
|
|
59
53
|
/**
|
|
60
|
-
* Watch
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* the launch's single answer (false when another watcher of the same launch, or
|
|
65
|
-
* an earlier interrupted one, already holds it); without the claim Folder access
|
|
66
|
-
* is only waited out.
|
|
54
|
+
* Watch this untrusted review launch until the exact Folder access screen has
|
|
55
|
+
* been answered and disappeared. Other prompts, a dead terminal, or a deadline
|
|
56
|
+
* before that handshake fail the launch. `claimAnswer` atomically claims its
|
|
57
|
+
* single Enter; a replay may only wait for the already-claimed answer to settle.
|
|
67
58
|
*/
|
|
68
59
|
async function answerCodexFolderAccess({
|
|
69
60
|
capture,
|
|
70
61
|
sendEnter,
|
|
71
62
|
claimAnswer = () => true,
|
|
63
|
+
isAnswerClaimed = () => false,
|
|
72
64
|
folders,
|
|
73
65
|
timeoutMs = 15_000,
|
|
74
66
|
settleMs = 2_000,
|
|
@@ -78,23 +70,18 @@ async function answerCodexFolderAccess({
|
|
|
78
70
|
}) {
|
|
79
71
|
const deadline = now() + timeoutMs;
|
|
80
72
|
let answeredAt = null;
|
|
81
|
-
|
|
82
|
-
while (now() < deadline) {
|
|
73
|
+
while (now() < deadline || (answeredAt !== null && now() - answeredAt < settleMs)) {
|
|
83
74
|
await sleep(pollMs);
|
|
84
75
|
const pane = capture();
|
|
85
|
-
|
|
86
|
-
if (pane === null) break;
|
|
76
|
+
if (pane === null) throw new Error('Codex terminal exited before Folder access completed');
|
|
87
77
|
const screen = classifyCodexLaunchScreen(pane, folders);
|
|
88
|
-
if (
|
|
89
|
-
if (screen.kind === 'idle') {
|
|
90
|
-
idleSince ??= now();
|
|
91
|
-
if (now() - idleSince >= IDLE_READY_MS) break;
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
idleSince = null;
|
|
78
|
+
if (answeredAt === null && isAnswerClaimed()) answeredAt = now();
|
|
95
79
|
if (screen.kind === 'prompt')
|
|
96
80
|
throw new Error(`Codex showed an unexpected launch prompt:\n${excerpt(pane)}`);
|
|
97
|
-
if (screen.kind !== 'folder-access')
|
|
81
|
+
if (screen.kind !== 'folder-access') {
|
|
82
|
+
if (answeredAt !== null && now() - answeredAt >= settleMs) return 'restricted';
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
98
85
|
if (answeredAt === null) {
|
|
99
86
|
if (claimAnswer()) sendEnter();
|
|
100
87
|
answeredAt = now();
|
|
@@ -104,7 +91,7 @@ async function answerCodexFolderAccess({
|
|
|
104
91
|
);
|
|
105
92
|
}
|
|
106
93
|
}
|
|
107
|
-
|
|
94
|
+
throw new Error('Codex Folder access did not complete before the launch deadline');
|
|
108
95
|
}
|
|
109
96
|
|
|
110
97
|
module.exports = { answerCodexFolderAccess, classifyCodexLaunchScreen };
|
|
@@ -23,6 +23,7 @@ const target = input.session;
|
|
|
23
23
|
async function codexHandshake(marker, claim, record, folders) {
|
|
24
24
|
try {
|
|
25
25
|
await answerCodexFolderAccess({
|
|
26
|
+
isAnswerClaimed: () => fs.existsSync(claim),
|
|
26
27
|
capture: () => {
|
|
27
28
|
const pane = tmux(['capture-pane', '-p', '-t', target]);
|
|
28
29
|
return pane.status === 0 ? pane.stdout : null;
|