autodev-cli 1.4.186 → 1.4.188
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/out/providers/grok/GrokAcpSession.d.ts +122 -0
- package/out/providers/grok/GrokAcpSession.js +506 -0
- package/out/providers/grok/GrokAcpSession.js.map +1 -0
- package/out/providers/grok/tui.d.ts +70 -13
- package/out/providers/grok/tui.js +388 -40
- package/out/providers/grok/tui.js.map +1 -1
- package/out/taskLoop.js +10 -0
- package/out/taskLoop.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { RateLimitDetector } from '../../rateLimit';
|
|
2
2
|
import type { ProviderId } from '../../providers';
|
|
3
|
+
export declare function grokAgentStdioSupported(): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Whether the persistent ACP path is active. Gated on grok supporting `agent
|
|
6
|
+
* stdio` AND the AUTODEV_GROK_PERSISTENT env override (default ON when supported;
|
|
7
|
+
* set to 'false'/'0'/'off' to force the legacy one-shot headless path).
|
|
8
|
+
*/
|
|
9
|
+
export declare function grokAcpEnabled(): boolean;
|
|
3
10
|
/** True while a grok turn is running for the given workspace root. */
|
|
4
11
|
export declare function isGrokTuiBusy(root: string): boolean;
|
|
5
12
|
/** Epoch-ms of the most recent streamed pane activity, or 0 if none. */
|
|
@@ -14,6 +21,17 @@ interface GrokRunOptions {
|
|
|
14
21
|
/** grok-tui: resume/continue a session so context accumulates across tasks. */
|
|
15
22
|
persist?: boolean;
|
|
16
23
|
sessionId?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Resume the MOST RECENT grok session for this cwd via `grok --continue` (grok's
|
|
26
|
+
* "-c, --continue" = continue the most recent session for the current working
|
|
27
|
+
* directory). This is ROBUST to id/tracking drift: an explicit `--resume <id>`
|
|
28
|
+
* errors instantly on the user's Windows grok when the stored id can't be matched
|
|
29
|
+
* for the cwd (a stale id, or a cwd-encoding mismatch), so every turn fell back to
|
|
30
|
+
* stateless. `--continue` lets grok pick the folder's newest session itself.
|
|
31
|
+
* MUST NOT be combined with `--session-id` (grok rejects that unless --fork-session,
|
|
32
|
+
* which we do NOT want) or with `sessionId`.
|
|
33
|
+
*/
|
|
34
|
+
continueSession?: boolean;
|
|
17
35
|
providerId?: ProviderId;
|
|
18
36
|
/**
|
|
19
37
|
* Headless grok-tui resume hang-probe. When > 0 (with `onResumeHang`), watch
|
|
@@ -32,6 +50,22 @@ interface GrokRunOptions {
|
|
|
32
50
|
*/
|
|
33
51
|
onResumeOk?: () => void;
|
|
34
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Pure builder for the grok session CLI flags, extracted so the mutually-exclusive
|
|
55
|
+
* invariants are unit-testable without spawning grok:
|
|
56
|
+
* - continueSession → `['--continue']` ONLY. NEVER with `--session-id` (grok rejects
|
|
57
|
+
* that combo unless `--fork-session`, which we never pass) and never an explicit id.
|
|
58
|
+
* - sessionId → `['--resume', <id>]` (legacy explicit-id resume; not used by the
|
|
59
|
+
* headless path anymore, kept for callers that pass a concrete id).
|
|
60
|
+
* - newSessionId → `['--session-id', <uuid>]` (bootstrap a brand-new named session).
|
|
61
|
+
* - none → `[]` (stateless: grok mints its own throwaway id).
|
|
62
|
+
* continueSession takes precedence, so `--continue` can never be emitted alongside an id.
|
|
63
|
+
*/
|
|
64
|
+
export declare function grokSessionArgsFor(args: {
|
|
65
|
+
continueSession?: boolean;
|
|
66
|
+
sessionId?: string;
|
|
67
|
+
newSessionId?: string;
|
|
68
|
+
}): string[];
|
|
35
69
|
export declare function sendGrokPrompt(root: string, promptFilePath: string, stdoutFile: string, exitFile: string, log: (msg: string) => void, opts?: GrokRunOptions): void;
|
|
36
70
|
/**
|
|
37
71
|
* grok-cli: PERSISTENT — a fresh HEADLESS grok process every turn, but launched
|
|
@@ -42,6 +76,24 @@ export declare function sendGrokPrompt(root: string, promptFilePath: string, std
|
|
|
42
76
|
* to a stateless relaunch instead of hanging the loop.
|
|
43
77
|
*/
|
|
44
78
|
export declare function sendGrokCliPrompt(root: string, promptFilePath: string, resolvedSessionId: string | undefined, stdoutFile: string, exitFile: string, log: (msg: string) => void, model?: string, showOutput?: () => void): void;
|
|
79
|
+
/**
|
|
80
|
+
* Fire-and-forget: run ONE turn through the persistent ACP session. Streams
|
|
81
|
+
* assistant text to stdoutFile and writes the exit code to exitFile exactly once
|
|
82
|
+
* at turn end — preserving the taskLoop contract byte-for-byte. The grok process
|
|
83
|
+
* STAYS ALIVE between turns; a crash/exit is detected and the NEXT turn respawns
|
|
84
|
+
* + session/load restores context. If the ACP handshake can't be established
|
|
85
|
+
* (older grok, or a transient spawn failure) it transparently FALLS BACK to the
|
|
86
|
+
* legacy one-shot headless path so nothing regresses.
|
|
87
|
+
*/
|
|
88
|
+
export declare function sendGrokAcpPrompt(root: string, promptFilePath: string, resolvedSessionId: string | undefined, stdoutFile: string, exitFile: string, log: (msg: string) => void, providerId: 'grok-cli' | 'grok-tui', model?: string, showOutput?: () => void): void;
|
|
89
|
+
/**
|
|
90
|
+
* Deliver a mid-run steer to the LIVE persistent grok process (a queued
|
|
91
|
+
* session/prompt). Returns true only when a live ACP session accepted it; false
|
|
92
|
+
* lets the caller fall back to the durable TODO buffer (at-least-once).
|
|
93
|
+
*/
|
|
94
|
+
export declare function steerGrokAcp(root: string, text: string, log: (msg: string) => void): boolean;
|
|
95
|
+
/** True if a persistent ACP session for this root is mid-turn. */
|
|
96
|
+
export declare function isGrokAcpBusy(root: string): boolean;
|
|
45
97
|
/**
|
|
46
98
|
* grok-tui: persistent — run the turn in the per-workspace tmux session so
|
|
47
99
|
* grok's in-process context accumulates across tasks. Falls back to the old
|
|
@@ -54,7 +106,7 @@ export declare function sendGrokCliPrompt(root: string, promptFilePath: string,
|
|
|
54
106
|
*
|
|
55
107
|
* - grok-tui + tmux → useTmux: true (persistent live pane; context accretes)
|
|
56
108
|
* - grok-tui + no tmux → useTmux: false (HEADLESS path — persistence handled there
|
|
57
|
-
* via `grok --
|
|
109
|
+
* via `grok --continue` behind the first_token hang-probe; see decideHeadlessGrokMode)
|
|
58
110
|
* - grok-cli → useTmux: false always (never uses tmux)
|
|
59
111
|
*/
|
|
60
112
|
export declare function decideGrokRunMode(opts: {
|
|
@@ -69,23 +121,28 @@ export declare function decideGrokRunMode(opts: {
|
|
|
69
121
|
* unit-testable. The `maxConsecutiveFailures` guard REPLACES the old permanent
|
|
70
122
|
* "resumeBroken" flag that doomed a whole run to statelessness after one hiccup.
|
|
71
123
|
*
|
|
72
|
-
* - no
|
|
73
|
-
*
|
|
74
|
-
* (`--session-id`, mints + persists a UUID; NOT `--
|
|
75
|
-
*
|
|
76
|
-
* - a
|
|
77
|
-
* `grok --
|
|
78
|
-
*
|
|
79
|
-
* -
|
|
124
|
+
* - no folder session yet → 'new-session': there is no
|
|
125
|
+
* session on disk for this cwd to continue, so bootstrap persistence with a fresh
|
|
126
|
+
* named session (`--session-id`, mints + persists a UUID; NOT `--continue`, which
|
|
127
|
+
* would have nothing to continue), behind the probe as a safety net.
|
|
128
|
+
* - a folder session exists, failures < max → 'continue': resume the cwd's
|
|
129
|
+
* most-recent session with `grok --continue` — robust to the stale-id / cwd-tracking
|
|
130
|
+
* drift that made an explicit `--resume <id>` error in ~1s on Windows. Gated by the
|
|
131
|
+
* first_token hang-probe. This is the STEADY STATE — every turn continues.
|
|
132
|
+
* - a folder session, failures >= max (sustained hang) → 'stateless' for exactly ONE
|
|
80
133
|
* breather turn (skip the probe cost once); the caller resets the counter so the
|
|
81
|
-
* NEXT turn returns to '
|
|
82
|
-
*
|
|
134
|
+
* NEXT turn returns to 'continue'. The folder session is untouched, so continuity is
|
|
135
|
+
* NEVER permanently abandoned — persistence self-heals.
|
|
136
|
+
*
|
|
137
|
+
* NOTE: the decision keys off FOLDER-SESSION PRESENCE (newestGrokSessionDir exists),
|
|
138
|
+
* NOT a stored id — because `--continue` needs no id, and keying off a stored id is
|
|
139
|
+
* exactly what let a stale/mismatched id drive a doomed `--resume`.
|
|
83
140
|
*/
|
|
84
141
|
export declare function decideHeadlessGrokMode(args: {
|
|
85
|
-
|
|
142
|
+
hasFolderSession: boolean;
|
|
86
143
|
consecutiveResumeFailures: number;
|
|
87
144
|
maxConsecutiveFailures?: number;
|
|
88
|
-
}): '
|
|
145
|
+
}): 'continue' | 'new-session' | 'stateless';
|
|
89
146
|
/**
|
|
90
147
|
* Pure verdict for the headless resume hang-probe (multi-round exponential, 1.4.185).
|
|
91
148
|
* 'ok' — grok emitted first_token → the resumed prompt is being answered;
|