autodev-cli 1.4.172 → 1.4.174
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/cliExit.js +5 -0
- package/out/cliExit.js.map +1 -1
- package/out/commands/mcpOperate.js +151 -0
- package/out/commands/mcpOperate.js.map +1 -1
- package/out/core/grokEvents.d.ts +61 -0
- package/out/core/grokEvents.js +213 -0
- package/out/core/grokEvents.js.map +1 -0
- package/out/providers/grok/authClassify.d.ts +48 -0
- package/out/providers/grok/authClassify.js +81 -0
- package/out/providers/grok/authClassify.js.map +1 -0
- package/out/providers/grok/sessions.d.ts +11 -0
- package/out/providers/grok/sessions.js +64 -0
- package/out/providers/grok/sessions.js.map +1 -1
- package/out/providers/grok/tui.js +169 -15
- package/out/providers/grok/tui.js.map +1 -1
- package/out/rateLimit.js +10 -0
- package/out/rateLimit.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// grokEvents — pure parser/classifier for grok's OWN session event log.
|
|
4
|
+
//
|
|
5
|
+
// A grok session (loop OR operate) writes structured telemetry to
|
|
6
|
+
// ~/.grok/sessions/<url-encoded-cwd>/<session-id>/events.jsonl
|
|
7
|
+
// one JSON object per line. Observed record types (schema_version 1.0):
|
|
8
|
+
// • turn_started {turn_number, model_id, …} — a turn began
|
|
9
|
+
// • loop_started {loop_index} — an agent loop iteration began
|
|
10
|
+
// • phase_changed {phase} — phase transitions; observed
|
|
11
|
+
// phases: waiting_for_model, streaming_reasoning, streaming_text,
|
|
12
|
+
// tool_execution, permission_prompt (all NON-idle = actively working)
|
|
13
|
+
// • first_token {} — model started emitting
|
|
14
|
+
// • tool_started {tool_name, tool_call_id?} — a native tool call began
|
|
15
|
+
// • tool_completed {tool_name, outcome, duration_ms, tool_call_id?}
|
|
16
|
+
// outcome: "success" | "error"
|
|
17
|
+
// • permission_requested / permission_resolved {tool_name, decision?}
|
|
18
|
+
// • turn_ended {outcome} — the turn finished;
|
|
19
|
+
// outcome "completed" = a CLEAN turn end (grok 4.5 AND 4.7).
|
|
20
|
+
//
|
|
21
|
+
// These functions are intentionally PURE (no I/O): the operate bridge and the
|
|
22
|
+
// grok loop turn-detector both feed lines/objects in and share the exact same
|
|
23
|
+
// classification, so the mapping is unit-testable without a socket / tmux pane.
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.GROK_IDLE_PHASES = void 0;
|
|
27
|
+
exports.parseGrokEventLine = parseGrokEventLine;
|
|
28
|
+
exports.classifyGrokActivity = classifyGrokActivity;
|
|
29
|
+
exports.grokEventToHook = grokEventToHook;
|
|
30
|
+
exports.isOfficeMcpToolName = isOfficeMcpToolName;
|
|
31
|
+
exports.isCleanTurnOutcome = isCleanTurnOutcome;
|
|
32
|
+
exports.scanGrokTurnEnd = scanGrokTurnEnd;
|
|
33
|
+
exports.grokAssistantText = grokAssistantText;
|
|
34
|
+
/** Parse one events.jsonl line into a GrokEvent, or null for blank/non-JSON. */
|
|
35
|
+
function parseGrokEventLine(line) {
|
|
36
|
+
const s = (line || '').trim();
|
|
37
|
+
if (!s) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const o = JSON.parse(s);
|
|
42
|
+
if (o && typeof o === 'object' && typeof o.type === 'string') {
|
|
43
|
+
return o;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch { /* not JSON */ }
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
// grok phases that mean the turn is NOT actively working (idle / waiting for the
|
|
50
|
+
// user / done). None are observed in real dumps today — every real phase
|
|
51
|
+
// (streaming_*, tool_execution, waiting_for_model, permission_prompt) is active —
|
|
52
|
+
// but this list makes a future "idle"-style phase decay the badge instead of
|
|
53
|
+
// pinning it 'working'. `waiting_for_model` is explicitly ACTIVE (grok is mid-turn
|
|
54
|
+
// awaiting the model), so it is NOT here.
|
|
55
|
+
exports.GROK_IDLE_PHASES = new Set([
|
|
56
|
+
'idle', 'done', 'complete', 'completed', 'finished', 'ready', 'waiting_for_input', 'awaiting_input',
|
|
57
|
+
]);
|
|
58
|
+
/**
|
|
59
|
+
* Classify a grok event into a status signal for the operate status controller:
|
|
60
|
+
* 'working' — the session is actively doing work (keep/refresh the 'working'
|
|
61
|
+
* badge + re-arm the inactivity→idle timer)
|
|
62
|
+
* 'end' — the turn/loop finished (flip to idle NOW, don't wait 120s)
|
|
63
|
+
* null — no status meaning (ignore for status)
|
|
64
|
+
* The existing 120s inactivity timer still decays a stuck 'working' to idle.
|
|
65
|
+
*/
|
|
66
|
+
function classifyGrokActivity(ev) {
|
|
67
|
+
if (!ev) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
switch (ev.type) {
|
|
71
|
+
case 'turn_started':
|
|
72
|
+
case 'loop_started':
|
|
73
|
+
case 'first_token':
|
|
74
|
+
case 'tool_started':
|
|
75
|
+
case 'tool_completed': // a tool finished — still mid-turn activity
|
|
76
|
+
case 'permission_requested':
|
|
77
|
+
case 'permission_resolved':
|
|
78
|
+
return 'working';
|
|
79
|
+
case 'phase_changed':
|
|
80
|
+
return ev.phase && exports.GROK_IDLE_PHASES.has(ev.phase) ? 'end' : 'working';
|
|
81
|
+
case 'turn_ended':
|
|
82
|
+
case 'loop_ended':
|
|
83
|
+
return 'end';
|
|
84
|
+
default:
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Map a grok event to a tool hook the office renders, or null when the event is
|
|
90
|
+
* not a tool boundary (status-only). `tool_started` → PreToolUse; `tool_completed`
|
|
91
|
+
* → PostToolUse, or PostToolUseFailure when outcome === "error". Carries tool_name
|
|
92
|
+
* (+ tool_use_id when grok supplied one, so Pre/Post pair into one step card).
|
|
93
|
+
*/
|
|
94
|
+
function grokEventToHook(ev) {
|
|
95
|
+
if (!ev) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
const name = (ev.tool_name || '').trim();
|
|
99
|
+
if (!name) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
if (ev.type === 'tool_started') {
|
|
103
|
+
return { hook_event_name: 'PreToolUse', tool_name: name, tool_use_id: ev.tool_call_id };
|
|
104
|
+
}
|
|
105
|
+
if (ev.type === 'tool_completed') {
|
|
106
|
+
const failed = String(ev.outcome || '').toLowerCase() === 'error';
|
|
107
|
+
return {
|
|
108
|
+
hook_event_name: failed ? 'PostToolUseFailure' : 'PostToolUse',
|
|
109
|
+
tool_name: name,
|
|
110
|
+
tool_use_id: ev.tool_call_id,
|
|
111
|
+
outcome: ev.outcome,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
// Office-operator MCP tool verbs (+ the bridge-synthesized tools). The office
|
|
117
|
+
// logs its OWN MCP tools server-side (OfficeMcpController → provider
|
|
118
|
+
// 'mcp-operator'), so re-forwarding a grok tool event for them would double-render
|
|
119
|
+
// the same call in the Events feed. grok's NATIVE tools (read_file/edit/bash/…) are
|
|
120
|
+
// the high-value signal and are NOT in this set. Any `mcp__`-prefixed name is also
|
|
121
|
+
// treated as an office/MCP tool (the standard MCP tool prefix).
|
|
122
|
+
const OFFICE_TOOL_NAMES = new Set([
|
|
123
|
+
'whoami', 'get_tasks', 'start_task', 'complete_task', 'update_task', 'create_task',
|
|
124
|
+
'check_messages', 'send_message', 'set_status', 'get_events', 'get_office', 'get_agents',
|
|
125
|
+
'create_choice_request', 'get_choice_answer', 'wait_for_events', 'ask_user',
|
|
126
|
+
'graph_add_node', 'graph_add_edge', 'graph_query', 'graph_map', 'graph_search',
|
|
127
|
+
'graph_neighbors', 'graph_toc', 'graph_rollup', 'graph_pin', 'graph_supersede', 'graph_stats',
|
|
128
|
+
]);
|
|
129
|
+
/** True when a tool name is an office/MCP tool (logged server-side) rather than a
|
|
130
|
+
* grok native tool — such events must be skipped to avoid double-forwarding. */
|
|
131
|
+
function isOfficeMcpToolName(name) {
|
|
132
|
+
const n = (name || '').trim();
|
|
133
|
+
if (!n) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
if (n.startsWith('mcp__')) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
return OFFICE_TOOL_NAMES.has(n);
|
|
140
|
+
}
|
|
141
|
+
// grok `turn_ended` outcomes that mean the turn finished CLEANLY (no failure).
|
|
142
|
+
const CLEAN_TURN_OUTCOMES = new Set(['completed', 'complete', 'success', 'succeeded', 'done', 'ok']);
|
|
143
|
+
// Outcomes that mean the turn ended in a genuine failure/abort.
|
|
144
|
+
const ERROR_TURN_OUTCOMES = new Set(['error', 'failed', 'failure', 'cancelled', 'canceled', 'aborted', 'interrupted', 'timeout', 'timed_out']);
|
|
145
|
+
/** Is a grok `turn_ended` outcome a clean completion? Unknown/empty → false. */
|
|
146
|
+
function isCleanTurnOutcome(outcome) {
|
|
147
|
+
return CLEAN_TURN_OUTCOMES.has(String(outcome || '').toLowerCase());
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Scan grok event lines (or objects) for the LAST `turn_ended` and classify it:
|
|
151
|
+
* 'clean' — outcome is a completed/success value (the turn finished normally)
|
|
152
|
+
* 'error' — outcome is a failure/abort value
|
|
153
|
+
* null — no turn_ended present (turn still running / not seen this batch)
|
|
154
|
+
* Used by the grok loop turn-detector as CORROBORATION: a clean turn_ended is a
|
|
155
|
+
* positive done-signal, so a finished grok 4.7 turn (which may not print the
|
|
156
|
+
* grok-4.5 "Worked for N.Ns." pane marker) is recognized as a clean finish and
|
|
157
|
+
* NEVER misread as a StopFailure/watchdog hard-fail.
|
|
158
|
+
*/
|
|
159
|
+
function scanGrokTurnEnd(lines) {
|
|
160
|
+
let result = null;
|
|
161
|
+
for (const raw of lines) {
|
|
162
|
+
const ev = typeof raw === 'string' ? parseGrokEventLine(raw) : raw;
|
|
163
|
+
if (!ev || ev.type !== 'turn_ended') {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
const oc = String(ev.outcome || '').toLowerCase();
|
|
167
|
+
if (isCleanTurnOutcome(oc)) {
|
|
168
|
+
result = 'clean';
|
|
169
|
+
}
|
|
170
|
+
else if (ERROR_TURN_OUTCOMES.has(oc)) {
|
|
171
|
+
result = 'error';
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
result = 'error';
|
|
175
|
+
} // an unknown non-clean outcome is treated as a failure signal
|
|
176
|
+
}
|
|
177
|
+
return result;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Extract assistant prose from ONE grok chat_history.jsonl line, or null when the
|
|
181
|
+
* line is not assistant text (user/system/reasoning/tool_result/tool_calls-only).
|
|
182
|
+
* grok `content` is a plain string or an array of {type:'text',text} blocks.
|
|
183
|
+
*/
|
|
184
|
+
function grokAssistantText(line) {
|
|
185
|
+
const s = (line || '').trim();
|
|
186
|
+
if (!s) {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
let o;
|
|
190
|
+
try {
|
|
191
|
+
o = JSON.parse(s);
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
const kind = o.type || o.role;
|
|
197
|
+
if (kind !== 'assistant') {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
const c = o.content;
|
|
201
|
+
let text = '';
|
|
202
|
+
if (typeof c === 'string') {
|
|
203
|
+
text = c;
|
|
204
|
+
}
|
|
205
|
+
else if (Array.isArray(c)) {
|
|
206
|
+
text = c
|
|
207
|
+
.map(b => (b && b['type'] === 'text' ? String(b['text'] ?? '') : ''))
|
|
208
|
+
.filter(Boolean).join('\n');
|
|
209
|
+
}
|
|
210
|
+
text = text.trim();
|
|
211
|
+
return text || null;
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=grokEvents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@@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markers that mean grok hit an AUTH gate / failure rather than doing work:
|
|
3
|
+
* - the interactive OAuth/login gate (waiting for approval / device code / …)
|
|
4
|
+
* - grok's manual-login fallback outcome `Failed(ManualLogin)`
|
|
5
|
+
* - a failed silent token refresh
|
|
6
|
+
* - an explicit "please log in" / "manual login required" prompt
|
|
7
|
+
* Calibrated to grok's own strings; the loose "not logged in" / "session
|
|
8
|
+
* expired" prose is deliberately EXCLUDED so ordinary assistant output rendered
|
|
9
|
+
* in the pane can't trip a false reauth. The deterministic backstop for the
|
|
10
|
+
* proven root cause (auth.json missing) is the auth-file presence check the
|
|
11
|
+
* caller passes in, not a prose match.
|
|
12
|
+
*/
|
|
13
|
+
export declare const GROK_AUTH_MARKERS: RegExp;
|
|
14
|
+
/**
|
|
15
|
+
* grok's NATIVE turn-failure banner. This is grok-native text (not something
|
|
16
|
+
* autodev prints): grok emits it when its own turn/process is interrupted —
|
|
17
|
+
* "Turn failed: Grok stopped before this turn finished (the agent process
|
|
18
|
+
* exited or was restarted). Committed tool results were kept." On its own this
|
|
19
|
+
* is a TRANSIENT failure; only when credentials are ALSO absent is it auth.
|
|
20
|
+
*/
|
|
21
|
+
export declare const GROK_TURN_FAIL_MARKERS: RegExp;
|
|
22
|
+
/**
|
|
23
|
+
* The sentinel autodev writes to the grok stdout capture + the human-facing
|
|
24
|
+
* message on an auth failure. It contains the phrase `reauthentication required`
|
|
25
|
+
* which rateLimit.ts's AuthDetector matches, so the LOOP raises an AuthError and
|
|
26
|
+
* takes its dedicated reauth PAUSE (webhook + hooks-events 🔑 state) rather than
|
|
27
|
+
* reporting a generic hard-failure.
|
|
28
|
+
*/
|
|
29
|
+
export declare const GROK_REAUTH_MESSAGE = "reauthentication required \u2014 grok is not logged in (auth.json missing / manual login). Please run: grok login";
|
|
30
|
+
export type GrokTurnClass = 'reauth' | 'turn-failed' | null;
|
|
31
|
+
/**
|
|
32
|
+
* Classify a grok pane snapshot + auth-file state into a turn outcome.
|
|
33
|
+
*
|
|
34
|
+
* - 'reauth' → an AUTH failure (login gate, Failed(ManualLogin), failed
|
|
35
|
+
* refresh, OR a turn-failure banner while auth.json is
|
|
36
|
+
* absent). NEVER retried; surfaced as reauth_required.
|
|
37
|
+
* - 'turn-failed' → a TRANSIENT turn failure (grok's process exited/restarted
|
|
38
|
+
* mid-turn) with credentials present. Retryable with backoff.
|
|
39
|
+
* - null → no failure signal.
|
|
40
|
+
*
|
|
41
|
+
* `authPresent` = does `~/.grok/auth.json` exist and is it non-empty. A missing
|
|
42
|
+
* auth.json is itself the proven root cause (grok's silent refresh →
|
|
43
|
+
* Failed(ManualLogin) → the turn dies), so ANY turn-failure banner seen while
|
|
44
|
+
* auth is absent is treated as reauth, not a transient blip. Auth presence only
|
|
45
|
+
* DISAMBIGUATES an actual failure banner — a healthy, still-producing turn (no
|
|
46
|
+
* banner) is never flagged, so a mis-located auth.json can't brick a good turn.
|
|
47
|
+
*/
|
|
48
|
+
export declare function classifyGrokTurn(snapshot: string, authPresent: boolean): GrokTurnClass;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Pure classifiers for grok turn-end signals.
|
|
4
|
+
//
|
|
5
|
+
// A grok turn can end three ways we care about:
|
|
6
|
+
// - AUTH failure → grok is not logged in: `~/.grok/auth.json` went missing,
|
|
7
|
+
// its silent token refresh failed, or grok fell back to a
|
|
8
|
+
// manual-login gate (`Failed(ManualLogin)`). This can NEVER
|
|
9
|
+
// be retried away — the user must re-login — so it must be
|
|
10
|
+
// surfaced as `reauth_required` (the loop pauses + the office
|
|
11
|
+
// shows the 🔑 needs-auth state), NOT hammered with retries.
|
|
12
|
+
// - TRANSIENT turn failure → grok printed its native banner "Turn failed: Grok
|
|
13
|
+
// stopped before this turn finished (the agent process exited
|
|
14
|
+
// or was restarted)" while credentials are still present. The
|
|
15
|
+
// process blipped; the turn is retryable with backoff.
|
|
16
|
+
// - neither → no failure signal in this snapshot.
|
|
17
|
+
//
|
|
18
|
+
// These functions are intentionally PURE (no I/O) so tui.ts and the unit tests
|
|
19
|
+
// share the exact same detection. tui.ts supplies the live pane snapshot and the
|
|
20
|
+
// `~/.grok/auth.json` presence check; this module decides the outcome.
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.GROK_REAUTH_MESSAGE = exports.GROK_TURN_FAIL_MARKERS = exports.GROK_AUTH_MARKERS = void 0;
|
|
24
|
+
exports.classifyGrokTurn = classifyGrokTurn;
|
|
25
|
+
/**
|
|
26
|
+
* Markers that mean grok hit an AUTH gate / failure rather than doing work:
|
|
27
|
+
* - the interactive OAuth/login gate (waiting for approval / device code / …)
|
|
28
|
+
* - grok's manual-login fallback outcome `Failed(ManualLogin)`
|
|
29
|
+
* - a failed silent token refresh
|
|
30
|
+
* - an explicit "please log in" / "manual login required" prompt
|
|
31
|
+
* Calibrated to grok's own strings; the loose "not logged in" / "session
|
|
32
|
+
* expired" prose is deliberately EXCLUDED so ordinary assistant output rendered
|
|
33
|
+
* in the pane can't trip a false reauth. The deterministic backstop for the
|
|
34
|
+
* proven root cause (auth.json missing) is the auth-file presence check the
|
|
35
|
+
* caller passes in, not a prose match.
|
|
36
|
+
*/
|
|
37
|
+
exports.GROK_AUTH_MARKERS = /waiting for approval|approve in your browser|sign(?:ing)? in to grok|finish signing in|device code|please (?:log ?in|sign ?in)|manual[- ]?login(?: required)?|Failed\(\s*ManualLogin\s*\)|silent refresh (?:failed|error)/i;
|
|
38
|
+
/**
|
|
39
|
+
* grok's NATIVE turn-failure banner. This is grok-native text (not something
|
|
40
|
+
* autodev prints): grok emits it when its own turn/process is interrupted —
|
|
41
|
+
* "Turn failed: Grok stopped before this turn finished (the agent process
|
|
42
|
+
* exited or was restarted). Committed tool results were kept." On its own this
|
|
43
|
+
* is a TRANSIENT failure; only when credentials are ALSO absent is it auth.
|
|
44
|
+
*/
|
|
45
|
+
exports.GROK_TURN_FAIL_MARKERS = /turn failed:|stopped before this turn finished|the agent process (?:exited|was restarted)/i;
|
|
46
|
+
/**
|
|
47
|
+
* The sentinel autodev writes to the grok stdout capture + the human-facing
|
|
48
|
+
* message on an auth failure. It contains the phrase `reauthentication required`
|
|
49
|
+
* which rateLimit.ts's AuthDetector matches, so the LOOP raises an AuthError and
|
|
50
|
+
* takes its dedicated reauth PAUSE (webhook + hooks-events 🔑 state) rather than
|
|
51
|
+
* reporting a generic hard-failure.
|
|
52
|
+
*/
|
|
53
|
+
exports.GROK_REAUTH_MESSAGE = 'reauthentication required — grok is not logged in (auth.json missing / manual login). Please run: grok login';
|
|
54
|
+
/**
|
|
55
|
+
* Classify a grok pane snapshot + auth-file state into a turn outcome.
|
|
56
|
+
*
|
|
57
|
+
* - 'reauth' → an AUTH failure (login gate, Failed(ManualLogin), failed
|
|
58
|
+
* refresh, OR a turn-failure banner while auth.json is
|
|
59
|
+
* absent). NEVER retried; surfaced as reauth_required.
|
|
60
|
+
* - 'turn-failed' → a TRANSIENT turn failure (grok's process exited/restarted
|
|
61
|
+
* mid-turn) with credentials present. Retryable with backoff.
|
|
62
|
+
* - null → no failure signal.
|
|
63
|
+
*
|
|
64
|
+
* `authPresent` = does `~/.grok/auth.json` exist and is it non-empty. A missing
|
|
65
|
+
* auth.json is itself the proven root cause (grok's silent refresh →
|
|
66
|
+
* Failed(ManualLogin) → the turn dies), so ANY turn-failure banner seen while
|
|
67
|
+
* auth is absent is treated as reauth, not a transient blip. Auth presence only
|
|
68
|
+
* DISAMBIGUATES an actual failure banner — a healthy, still-producing turn (no
|
|
69
|
+
* banner) is never flagged, so a mis-located auth.json can't brick a good turn.
|
|
70
|
+
*/
|
|
71
|
+
function classifyGrokTurn(snapshot, authPresent) {
|
|
72
|
+
const s = snapshot || '';
|
|
73
|
+
if (exports.GROK_AUTH_MARKERS.test(s)) {
|
|
74
|
+
return 'reauth';
|
|
75
|
+
}
|
|
76
|
+
if (exports.GROK_TURN_FAIL_MARKERS.test(s)) {
|
|
77
|
+
return authPresent ? 'turn-failed' : 'reauth';
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=authClassify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authClassify.js","sourceRoot":"","sources":["../../../src/providers/grok/authClassify.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,8CAA8C;AAC9C,EAAE;AACF,gDAAgD;AAChD,+EAA+E;AAC/E,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,kFAAkF;AAClF,iFAAiF;AACjF,iFAAiF;AACjF,kFAAkF;AAClF,kFAAkF;AAClF,2EAA2E;AAC3E,0DAA0D;AAC1D,EAAE;AACF,+EAA+E;AAC/E,iFAAiF;AACjF,uEAAuE;AACvE,8EAA8E;;;AAwD9E,4CAKC;AA3DD;;;;;;;;;;;GAWG;AACU,QAAA,iBAAiB,GAC5B,4NAA4N,CAAC;AAE/N;;;;;;GAMG;AACU,QAAA,sBAAsB,GACjC,4FAA4F,CAAC;AAE/F;;;;;;GAMG;AACU,QAAA,mBAAmB,GAC9B,8GAA8G,CAAC;AAIjH;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,gBAAgB,CAAC,QAAgB,EAAE,WAAoB;IACrE,MAAM,CAAC,GAAG,QAAQ,IAAI,EAAE,CAAC;IACzB,IAAI,yBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAAC,OAAO,QAAQ,CAAC;IAAC,CAAC;IACnD,IAAI,8BAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAAC,OAAO,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC;IAAC,CAAC;IACtF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -13,6 +13,17 @@ export declare function listAllGrokSessions(): Array<{
|
|
|
13
13
|
updated: number;
|
|
14
14
|
cwd: string;
|
|
15
15
|
}>;
|
|
16
|
+
/** The per-session dir for `cwd`+`sessionId`: <base>/<encodeURIComponent(cwd)>/<id>. */
|
|
17
|
+
export declare function grokSessionDirFor(cwd: string, sessionId: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the NEWEST grok session directory for a workspace `cwd` — the folder
|
|
20
|
+
* holding that session's events.jsonl / chat_history.jsonl. Picks the most
|
|
21
|
+
* recently active session by the mtime of its events.jsonl (falling back to
|
|
22
|
+
* chat_history.jsonl, then the dir itself), so a resumed/active session is found
|
|
23
|
+
* even before grok's shared sqlite index catches up. Honors GROK_HOME. Returns
|
|
24
|
+
* undefined when grok has never run for this cwd. Read-only; never throws.
|
|
25
|
+
*/
|
|
26
|
+
export declare function newestGrokSessionDir(cwd: string): string | undefined;
|
|
16
27
|
export interface TranscriptMsg {
|
|
17
28
|
role: 'user' | 'assistant' | 'system' | 'tool';
|
|
18
29
|
text: string;
|
|
@@ -46,6 +46,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
46
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
47
|
exports.listGrokSessions = listGrokSessions;
|
|
48
48
|
exports.listAllGrokSessions = listAllGrokSessions;
|
|
49
|
+
exports.grokSessionDirFor = grokSessionDirFor;
|
|
50
|
+
exports.newestGrokSessionDir = newestGrokSessionDir;
|
|
49
51
|
exports.readGrokTranscript = readGrokTranscript;
|
|
50
52
|
const fs = __importStar(require("fs"));
|
|
51
53
|
const os = __importStar(require("os"));
|
|
@@ -128,6 +130,68 @@ function listAllGrokSessions() {
|
|
|
128
130
|
catch { /* ignore */ }
|
|
129
131
|
}
|
|
130
132
|
}
|
|
133
|
+
/** grok's sessions base dir (honors GROK_HOME), e.g. ~/.grok/sessions. */
|
|
134
|
+
function grokSessionsBase() {
|
|
135
|
+
const base = process.env['GROK_HOME'] || path.join(os.homedir(), '.grok');
|
|
136
|
+
return path.join(base, 'sessions');
|
|
137
|
+
}
|
|
138
|
+
/** The per-session dir for `cwd`+`sessionId`: <base>/<encodeURIComponent(cwd)>/<id>. */
|
|
139
|
+
function grokSessionDirFor(cwd, sessionId) {
|
|
140
|
+
return path.join(grokSessionsBase(), encodeURIComponent(cwd), sessionId);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Resolve the NEWEST grok session directory for a workspace `cwd` — the folder
|
|
144
|
+
* holding that session's events.jsonl / chat_history.jsonl. Picks the most
|
|
145
|
+
* recently active session by the mtime of its events.jsonl (falling back to
|
|
146
|
+
* chat_history.jsonl, then the dir itself), so a resumed/active session is found
|
|
147
|
+
* even before grok's shared sqlite index catches up. Honors GROK_HOME. Returns
|
|
148
|
+
* undefined when grok has never run for this cwd. Read-only; never throws.
|
|
149
|
+
*/
|
|
150
|
+
function newestGrokSessionDir(cwd) {
|
|
151
|
+
let encDir = '';
|
|
152
|
+
try {
|
|
153
|
+
encDir = path.join(grokSessionsBase(), encodeURIComponent(path.resolve(cwd)));
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
encDir = path.join(grokSessionsBase(), encodeURIComponent(cwd));
|
|
157
|
+
}
|
|
158
|
+
let entries;
|
|
159
|
+
try {
|
|
160
|
+
entries = fs.readdirSync(encDir);
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
let best;
|
|
166
|
+
let bestMs = -1;
|
|
167
|
+
for (const id of entries) {
|
|
168
|
+
const dir = path.join(encDir, id);
|
|
169
|
+
let stat;
|
|
170
|
+
try {
|
|
171
|
+
if (!fs.statSync(dir).isDirectory()) {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
const candidates = [path.join(dir, 'events.jsonl'), path.join(dir, 'chat_history.jsonl'), dir];
|
|
179
|
+
let ms = -1;
|
|
180
|
+
for (const c of candidates) {
|
|
181
|
+
try {
|
|
182
|
+
stat = fs.statSync(c);
|
|
183
|
+
ms = stat.mtimeMs;
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
catch { /* try next */ }
|
|
187
|
+
}
|
|
188
|
+
if (ms > bestMs) {
|
|
189
|
+
bestMs = ms;
|
|
190
|
+
best = dir;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return best;
|
|
194
|
+
}
|
|
131
195
|
/** Path to grok's clean structured transcript for a session under a given cwd. */
|
|
132
196
|
function grokChatHistoryPath(cwd, sessionId) {
|
|
133
197
|
const base = process.env['GROK_HOME'] || path.join(os.homedir(), '.grok');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../../src/providers/grok/sessions.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,wEAAwE;AACxE,EAAE;AACF,8CAA8C;AAC9C,kEAAkE;AAClE,8DAA8D;AAC9D,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,qDAAqD;AACrD,8EAA8E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmB9E,4CAmBC;AAKD,kDAkBC;AAwCD,gDA4CC;
|
|
1
|
+
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../../src/providers/grok/sessions.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,wEAAwE;AACxE,EAAE;AACF,8CAA8C;AAC9C,kEAAkE;AAClE,8DAA8D;AAC9D,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,qDAAqD;AACrD,8EAA8E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmB9E,4CAmBC;AAKD,kDAkBC;AASD,8CAEC;AAUD,oDAmBC;AAwCD,gDA4CC;AAvLD,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAE7B,SAAS,kBAAkB;IACzB,MAAM,IAAI,GAAG,OAAO,CAAC,G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