@autopilot-harness/port-grok-build 0.6.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.
- package/LICENSE +21 -0
- package/dist/index.d.ts +137 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +466 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Autopilot Harness contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { type PhaseActionConfig, type ReviewEngine, type StateStore } from "@autopilot-harness/core";
|
|
2
|
+
/** Grok Build UserPromptSubmit stdin (camelCase + snake_case). */
|
|
3
|
+
export interface GrokSubmitPayload {
|
|
4
|
+
session_id?: string;
|
|
5
|
+
sessionId?: string;
|
|
6
|
+
prompt?: string;
|
|
7
|
+
/** Informational — store uses install-root projectRoot. */
|
|
8
|
+
cwd?: string;
|
|
9
|
+
workspaceRoot?: string;
|
|
10
|
+
workspace_root?: string;
|
|
11
|
+
transcript_path?: string;
|
|
12
|
+
transcriptPath?: string;
|
|
13
|
+
conversation_id?: string;
|
|
14
|
+
conversationId?: string;
|
|
15
|
+
permission_mode?: string;
|
|
16
|
+
permissionMode?: string;
|
|
17
|
+
promptId?: string;
|
|
18
|
+
turn_id?: string;
|
|
19
|
+
model?: string;
|
|
20
|
+
hook_event_name?: string;
|
|
21
|
+
hookEventName?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Grok Build PostToolUse stdin. */
|
|
24
|
+
export interface GrokEditPayload {
|
|
25
|
+
session_id?: string;
|
|
26
|
+
sessionId?: string;
|
|
27
|
+
conversation_id?: string;
|
|
28
|
+
conversationId?: string;
|
|
29
|
+
cwd?: string;
|
|
30
|
+
workspaceRoot?: string;
|
|
31
|
+
workspace_root?: string;
|
|
32
|
+
tool_name?: string;
|
|
33
|
+
toolName?: string;
|
|
34
|
+
tool_input?: Record<string, unknown> | string;
|
|
35
|
+
toolInput?: Record<string, unknown> | string;
|
|
36
|
+
}
|
|
37
|
+
/** Grok Build Stop stdin (no StopFailure / StopCancelled in this port). */
|
|
38
|
+
export interface GrokStopPayload {
|
|
39
|
+
session_id?: string;
|
|
40
|
+
sessionId?: string;
|
|
41
|
+
conversation_id?: string;
|
|
42
|
+
conversationId?: string;
|
|
43
|
+
cwd?: string;
|
|
44
|
+
workspaceRoot?: string;
|
|
45
|
+
workspace_root?: string;
|
|
46
|
+
transcript_path?: string;
|
|
47
|
+
transcriptPath?: string;
|
|
48
|
+
status?: string;
|
|
49
|
+
stop_hook_active?: boolean;
|
|
50
|
+
stopHookActive?: boolean;
|
|
51
|
+
hook_event_name?: string;
|
|
52
|
+
hookEventName?: string;
|
|
53
|
+
last_assistant_message?: string;
|
|
54
|
+
lastAssistantMessage?: string;
|
|
55
|
+
turn_id?: string;
|
|
56
|
+
promptId?: string;
|
|
57
|
+
/** Gate only genuine completions (`end_turn`); session-end reasons must not continue. */
|
|
58
|
+
reason?: unknown;
|
|
59
|
+
error?: unknown;
|
|
60
|
+
message?: unknown;
|
|
61
|
+
}
|
|
62
|
+
export interface GrokPortConfig {
|
|
63
|
+
phaseActions?: PhaseActionConfig;
|
|
64
|
+
}
|
|
65
|
+
export declare const GROK_PLATFORM = "grok-build";
|
|
66
|
+
/**
|
|
67
|
+
* Public research (2026-09): hard cap 8 Stop continuations / turn; no raise/disable
|
|
68
|
+
* knob found. See plans/v0.6-grok-build/research-stop-cap.md.
|
|
69
|
+
*/
|
|
70
|
+
export declare const GROK_STOP_CAP_RAISE_FOUND = false;
|
|
71
|
+
/** Host per-turn Stop continue cap when raise is absent. */
|
|
72
|
+
export declare const GROK_STOP_PER_TURN_BLOCK_CAP = 8;
|
|
73
|
+
/**
|
|
74
|
+
* PostToolUse matcher draft (Grok native + Claude aliases).
|
|
75
|
+
* Live smoke may widen; dirty-arm covers shell edits.
|
|
76
|
+
*/
|
|
77
|
+
export declare const GROK_POST_TOOL_USE_MATCHER = "search_replace|Edit|Write|MultiEdit|write_file|WriteFile";
|
|
78
|
+
export declare const MAX_NEED_PICK_SLUGS = 40;
|
|
79
|
+
export declare const MAX_NEED_PICK_CONTEXT_CHARS = 2000;
|
|
80
|
+
export declare const MAX_HOOK_STDIO_CHARS = 8192;
|
|
81
|
+
export declare const MAX_TOOL_ARGS_JSON_CHARS = 1048576;
|
|
82
|
+
export interface GrokSubmitResult {
|
|
83
|
+
decision?: "block";
|
|
84
|
+
reason?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface GrokStopResult {
|
|
87
|
+
decision?: "block";
|
|
88
|
+
reason?: string;
|
|
89
|
+
continue?: boolean;
|
|
90
|
+
stopReason?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Map stopHookActive → ReviewEngine loopCount.
|
|
94
|
+
* true ⇒ already in auto-continuation chain this turn.
|
|
95
|
+
*/
|
|
96
|
+
export declare function loopCountFromStopHookActive(payload: GrokStopPayload): number;
|
|
97
|
+
export declare function collectGrokStopErrorText(payload: GrokStopPayload): string;
|
|
98
|
+
export declare function normalizeGrokStopStatus(payload: GrokStopPayload, opts?: {
|
|
99
|
+
status?: "completed" | "error" | "aborted";
|
|
100
|
+
}): "completed" | "error" | "aborted";
|
|
101
|
+
/**
|
|
102
|
+
* Session-end / non-completion Stop fires must not Autopilot-continue.
|
|
103
|
+
* Gate only when reason is absent/empty or a known completion value (`end_turn`).
|
|
104
|
+
* Unknown or non-string reasons: do not continue (fail closed on continue).
|
|
105
|
+
*/
|
|
106
|
+
export declare function isGrokStopCompletionReason(payload: GrokStopPayload): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* needPick / busy / hard-error body for UPS decision:block (user-visible).
|
|
109
|
+
* Grok allowing UPS discards stdout — no additionalContext Channel A.
|
|
110
|
+
*/
|
|
111
|
+
export declare function buildNeedPickContext(userMessage: unknown, candidates?: ReadonlyArray<{
|
|
112
|
+
slug?: string;
|
|
113
|
+
}>): string;
|
|
114
|
+
/** UPS block result — preferred Grok channel for needPick / busy / hard errors. */
|
|
115
|
+
export declare function blockSubmit(userMessage: unknown, fallback: string): GrokSubmitResult;
|
|
116
|
+
export declare function filePathsFromGrokEdit(payload: GrokEditPayload): string[];
|
|
117
|
+
/** File-mutating tools Autopilot arms (shell → dirty-arm on Stop). */
|
|
118
|
+
export declare function isGrokEditTool(toolName: string): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* UserPromptSubmit → core triggers / FSM.
|
|
121
|
+
* Allowing UPS stdout is discarded by Grok — ON/RUN success returns {}.
|
|
122
|
+
* needPick / busy / hard errors → decision:block + reason (user-visible).
|
|
123
|
+
* permission_mode is ignored (no auto-ON).
|
|
124
|
+
*/
|
|
125
|
+
export declare function handleUserPromptSubmit(store: StateStore, payload: GrokSubmitPayload, projectRoot: string, portConfig?: GrokPortConfig): GrokSubmitResult;
|
|
126
|
+
/** PostToolUse → markCodeEdited for search_replace / Edit / Write / …. */
|
|
127
|
+
export declare function handlePostToolUse(store: StateStore, payload: GrokEditPayload, projectRoot: string): void;
|
|
128
|
+
/**
|
|
129
|
+
* Stop → ReviewEngine.
|
|
130
|
+
* Continue: decision:block + reason only (never also additionalContext).
|
|
131
|
+
* Hard stop: continue:false when loop ends (Grok-supported).
|
|
132
|
+
* Host caps ≤8/turn when GROK_STOP_CAP_RAISE_FOUND is false.
|
|
133
|
+
*/
|
|
134
|
+
export declare function handleStop(engine: ReviewEngine, payload: GrokStopPayload, opts?: {
|
|
135
|
+
status?: "completed" | "error" | "aborted";
|
|
136
|
+
}): GrokStopResult;
|
|
137
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAwBL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAEjC,kEAAkE;AAClE,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IAC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
+
import { applyOff, applyOn, applyReplan, applyResume, applyResumeReview, applyRun, applyTrackPick, ensureAmbientReviewSession, effectiveReviewingItemId, firstUnchecked, isChannelANeedPick, isHarnessFollowupMessage, isProductCodeEdit, isRecoverOrStuckFollowupMessage, isSafeTrackSlug, isUserAbortText, loadProjectHookConfig, loadProjectReviewConfig, notePlansDirEdit, parseAdvanceNextItemId, parseChecklist, parseTrigger, } from "@autopilot-harness/core";
|
|
2
|
+
export const GROK_PLATFORM = "grok-build";
|
|
3
|
+
/**
|
|
4
|
+
* Public research (2026-09): hard cap 8 Stop continuations / turn; no raise/disable
|
|
5
|
+
* knob found. See plans/v0.6-grok-build/research-stop-cap.md.
|
|
6
|
+
*/
|
|
7
|
+
export const GROK_STOP_CAP_RAISE_FOUND = false;
|
|
8
|
+
/** Host per-turn Stop continue cap when raise is absent. */
|
|
9
|
+
export const GROK_STOP_PER_TURN_BLOCK_CAP = 8;
|
|
10
|
+
/**
|
|
11
|
+
* PostToolUse matcher draft (Grok native + Claude aliases).
|
|
12
|
+
* Live smoke may widen; dirty-arm covers shell edits.
|
|
13
|
+
*/
|
|
14
|
+
export const GROK_POST_TOOL_USE_MATCHER = "search_replace|Edit|Write|MultiEdit|write_file|WriteFile";
|
|
15
|
+
export const MAX_NEED_PICK_SLUGS = 40;
|
|
16
|
+
export const MAX_NEED_PICK_CONTEXT_CHARS = 2_000;
|
|
17
|
+
export const MAX_HOOK_STDIO_CHARS = 8_192;
|
|
18
|
+
export const MAX_TOOL_ARGS_JSON_CHARS = 1_048_576;
|
|
19
|
+
function sid(p) {
|
|
20
|
+
for (const v of [
|
|
21
|
+
p.session_id,
|
|
22
|
+
p.sessionId,
|
|
23
|
+
p.conversation_id,
|
|
24
|
+
p.conversationId,
|
|
25
|
+
]) {
|
|
26
|
+
if (typeof v === "string") {
|
|
27
|
+
const t = v.trim();
|
|
28
|
+
if (t)
|
|
29
|
+
return t;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return "";
|
|
33
|
+
}
|
|
34
|
+
function clipText(text, max = MAX_HOOK_STDIO_CHARS) {
|
|
35
|
+
if (text.length <= max)
|
|
36
|
+
return text;
|
|
37
|
+
return `${text.slice(0, max - 1)}…`;
|
|
38
|
+
}
|
|
39
|
+
function blockReason(message, fallback) {
|
|
40
|
+
const m = typeof message === "string" ? message.trim() : "";
|
|
41
|
+
return m || fallback;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Map stopHookActive → ReviewEngine loopCount.
|
|
45
|
+
* true ⇒ already in auto-continuation chain this turn.
|
|
46
|
+
*/
|
|
47
|
+
export function loopCountFromStopHookActive(payload) {
|
|
48
|
+
const active = payload.stop_hook_active ?? payload.stopHookActive;
|
|
49
|
+
return active === true ? 1 : 0;
|
|
50
|
+
}
|
|
51
|
+
export function collectGrokStopErrorText(payload) {
|
|
52
|
+
if (!payload || typeof payload !== "object")
|
|
53
|
+
return "";
|
|
54
|
+
const parts = [];
|
|
55
|
+
try {
|
|
56
|
+
const push = (value) => {
|
|
57
|
+
if (typeof value === "string" && value.trim()) {
|
|
58
|
+
parts.push(value);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
62
|
+
const o = value;
|
|
63
|
+
for (const key of ["message", "error", "name", "stack", "detail"]) {
|
|
64
|
+
const nested = o[key];
|
|
65
|
+
if (typeof nested === "string" && nested.trim())
|
|
66
|
+
parts.push(nested);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
push(payload.error);
|
|
71
|
+
push(payload.message);
|
|
72
|
+
push(payload.reason);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return "";
|
|
76
|
+
}
|
|
77
|
+
return clipText(parts.join("\n"));
|
|
78
|
+
}
|
|
79
|
+
export function normalizeGrokStopStatus(payload, opts) {
|
|
80
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
81
|
+
return opts?.status ?? "completed";
|
|
82
|
+
}
|
|
83
|
+
const statusRaw = String(payload.status ?? "")
|
|
84
|
+
.toLowerCase()
|
|
85
|
+
.trim();
|
|
86
|
+
const errText = collectGrokStopErrorText(payload);
|
|
87
|
+
if (statusRaw === "aborted" ||
|
|
88
|
+
statusRaw === "cancelled" ||
|
|
89
|
+
statusRaw === "canceled") {
|
|
90
|
+
return "aborted";
|
|
91
|
+
}
|
|
92
|
+
if (opts?.status === "aborted")
|
|
93
|
+
return "aborted";
|
|
94
|
+
if (statusRaw === "error" || statusRaw === "failed") {
|
|
95
|
+
if (isUserAbortText(errText))
|
|
96
|
+
return "aborted";
|
|
97
|
+
return "error";
|
|
98
|
+
}
|
|
99
|
+
if (opts?.status === "error") {
|
|
100
|
+
if (isUserAbortText(errText))
|
|
101
|
+
return "aborted";
|
|
102
|
+
return "error";
|
|
103
|
+
}
|
|
104
|
+
if (opts?.status === "completed")
|
|
105
|
+
return "completed";
|
|
106
|
+
if (!statusRaw && isUserAbortText(errText))
|
|
107
|
+
return "aborted";
|
|
108
|
+
return "completed";
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Session-end / non-completion Stop fires must not Autopilot-continue.
|
|
112
|
+
* Gate only when reason is absent/empty or a known completion value (`end_turn`).
|
|
113
|
+
* Unknown or non-string reasons: do not continue (fail closed on continue).
|
|
114
|
+
*/
|
|
115
|
+
export function isGrokStopCompletionReason(payload) {
|
|
116
|
+
const raw = payload?.reason;
|
|
117
|
+
if (raw == null)
|
|
118
|
+
return true;
|
|
119
|
+
if (typeof raw !== "string")
|
|
120
|
+
return false;
|
|
121
|
+
const r = raw.trim().toLowerCase();
|
|
122
|
+
if (!r)
|
|
123
|
+
return true;
|
|
124
|
+
if (r === "end_turn" || r === "endturn" || r === "completed")
|
|
125
|
+
return true;
|
|
126
|
+
// channel_closed / shutdown / anything else → do not continue
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* needPick / busy / hard-error body for UPS decision:block (user-visible).
|
|
131
|
+
* Grok allowing UPS discards stdout — no additionalContext Channel A.
|
|
132
|
+
*/
|
|
133
|
+
export function buildNeedPickContext(userMessage, candidates) {
|
|
134
|
+
const fromMessage = typeof userMessage === "string" && userMessage.trim().length > 0
|
|
135
|
+
? userMessage.trim()
|
|
136
|
+
: "";
|
|
137
|
+
const slugs = [
|
|
138
|
+
...new Set((candidates ?? [])
|
|
139
|
+
.map((c) => (c && typeof c.slug === "string" ? c.slug.trim() : ""))
|
|
140
|
+
.filter((s) => s.length > 0 && isSafeTrackSlug(s))),
|
|
141
|
+
].slice(0, MAX_NEED_PICK_SLUGS);
|
|
142
|
+
let ctx = fromMessage ||
|
|
143
|
+
(slugs.length > 0
|
|
144
|
+
? `Select a plan to execute:\n\n${slugs
|
|
145
|
+
.map((s, i) => ` ${i + 1}. ${s}`)
|
|
146
|
+
.join("\n")}\n\nReply with a number or /autopilot-run <slug>.`
|
|
147
|
+
: "Select a plan to execute. Reply with a number or /autopilot-run <slug>.");
|
|
148
|
+
if (ctx.length > MAX_NEED_PICK_CONTEXT_CHARS) {
|
|
149
|
+
ctx = `${ctx.slice(0, MAX_NEED_PICK_CONTEXT_CHARS - 1)}…`;
|
|
150
|
+
}
|
|
151
|
+
return ctx;
|
|
152
|
+
}
|
|
153
|
+
/** UPS block result — preferred Grok channel for needPick / busy / hard errors. */
|
|
154
|
+
export function blockSubmit(userMessage, fallback) {
|
|
155
|
+
return {
|
|
156
|
+
decision: "block",
|
|
157
|
+
reason: clipText(blockReason(typeof userMessage === "string" ? userMessage : undefined, fallback), MAX_NEED_PICK_CONTEXT_CHARS + 256),
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function toolInputObject(payload) {
|
|
161
|
+
const input = payload.tool_input ?? payload.toolInput;
|
|
162
|
+
if (!input)
|
|
163
|
+
return null;
|
|
164
|
+
if (typeof input === "object" && !Array.isArray(input)) {
|
|
165
|
+
return input;
|
|
166
|
+
}
|
|
167
|
+
if (typeof input === "string") {
|
|
168
|
+
if (input.length > MAX_TOOL_ARGS_JSON_CHARS)
|
|
169
|
+
return null;
|
|
170
|
+
try {
|
|
171
|
+
const parsed = JSON.parse(input);
|
|
172
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
173
|
+
return parsed;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
export function filePathsFromGrokEdit(payload) {
|
|
183
|
+
const input = toolInputObject(payload);
|
|
184
|
+
if (!input)
|
|
185
|
+
return [];
|
|
186
|
+
const candidates = [
|
|
187
|
+
input.file_path,
|
|
188
|
+
input.filePath,
|
|
189
|
+
input.path,
|
|
190
|
+
input.target_file,
|
|
191
|
+
input.targetFile,
|
|
192
|
+
input.notebook_path,
|
|
193
|
+
input.notebookPath,
|
|
194
|
+
];
|
|
195
|
+
for (const c of candidates) {
|
|
196
|
+
if (typeof c === "string" && c.trim() && !/[\0\r\n]/.test(c)) {
|
|
197
|
+
return [c.trim()];
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return [];
|
|
201
|
+
}
|
|
202
|
+
/** File-mutating tools Autopilot arms (shell → dirty-arm on Stop). */
|
|
203
|
+
export function isGrokEditTool(toolName) {
|
|
204
|
+
const n = toolName.trim();
|
|
205
|
+
return (n === "search_replace" ||
|
|
206
|
+
n === "Edit" ||
|
|
207
|
+
n === "Write" ||
|
|
208
|
+
n === "MultiEdit" ||
|
|
209
|
+
n === "write_file" ||
|
|
210
|
+
n === "WriteFile");
|
|
211
|
+
}
|
|
212
|
+
function stampGrokPlatform(store, conversationId, projectRoot) {
|
|
213
|
+
const session = store.getSession(conversationId);
|
|
214
|
+
if (!session || session.platform === GROK_PLATFORM)
|
|
215
|
+
return;
|
|
216
|
+
store.upsertSession({
|
|
217
|
+
conversation_id: conversationId,
|
|
218
|
+
project_root: session.project_root || projectRoot,
|
|
219
|
+
code_root: session.code_root || projectRoot,
|
|
220
|
+
platform: GROK_PLATFORM,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* UserPromptSubmit → core triggers / FSM.
|
|
225
|
+
* Allowing UPS stdout is discarded by Grok — ON/RUN success returns {}.
|
|
226
|
+
* needPick / busy / hard errors → decision:block + reason (user-visible).
|
|
227
|
+
* permission_mode is ignored (no auto-ON).
|
|
228
|
+
*/
|
|
229
|
+
export function handleUserPromptSubmit(store, payload, projectRoot, portConfig) {
|
|
230
|
+
try {
|
|
231
|
+
return handleUserPromptSubmitInner(store, payload, projectRoot, portConfig);
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
return {};
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function handleUserPromptSubmitInner(store, payload, projectRoot, portConfig) {
|
|
238
|
+
const conversationId = sid(payload);
|
|
239
|
+
if (!conversationId)
|
|
240
|
+
return {};
|
|
241
|
+
const prompt = typeof payload.prompt === "string" ? payload.prompt : "";
|
|
242
|
+
try {
|
|
243
|
+
store.clearPendingFollowupIf(conversationId, isRecoverOrStuckFollowupMessage);
|
|
244
|
+
}
|
|
245
|
+
catch {
|
|
246
|
+
/* best-effort */
|
|
247
|
+
}
|
|
248
|
+
const session = store.getSession(conversationId);
|
|
249
|
+
const hookCfg = loadProjectHookConfig(projectRoot);
|
|
250
|
+
const trigger = parseTrigger({
|
|
251
|
+
prompt,
|
|
252
|
+
conversationId,
|
|
253
|
+
projectRoot,
|
|
254
|
+
pendingAction: session?.pending_action,
|
|
255
|
+
triggers: hookCfg.triggers,
|
|
256
|
+
});
|
|
257
|
+
const actionConfig = {
|
|
258
|
+
...portConfig?.phaseActions,
|
|
259
|
+
plansDir: portConfig?.phaseActions?.plansDir ?? hookCfg.plansDir,
|
|
260
|
+
};
|
|
261
|
+
const gateFallback = "Autopilot rejected this prompt. Check `npx autopilot-harness status`.";
|
|
262
|
+
if (trigger) {
|
|
263
|
+
if (trigger.kind === "off") {
|
|
264
|
+
applyOff(store, conversationId);
|
|
265
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
266
|
+
return {};
|
|
267
|
+
}
|
|
268
|
+
if (trigger.kind === "on") {
|
|
269
|
+
const result = applyOn(store, conversationId, projectRoot, {
|
|
270
|
+
initialBrief: trigger.initialBrief,
|
|
271
|
+
slug: trigger.slug,
|
|
272
|
+
platform: GROK_PLATFORM,
|
|
273
|
+
});
|
|
274
|
+
if (!result.ok) {
|
|
275
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
276
|
+
return blockSubmit(result.userMessage, gateFallback);
|
|
277
|
+
}
|
|
278
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
279
|
+
return {};
|
|
280
|
+
}
|
|
281
|
+
if (trigger.kind === "resume") {
|
|
282
|
+
const result = applyResume(store, conversationId, {
|
|
283
|
+
slug: trigger.slug,
|
|
284
|
+
});
|
|
285
|
+
if (!result.ok) {
|
|
286
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
287
|
+
return blockSubmit(result.userMessage, gateFallback);
|
|
288
|
+
}
|
|
289
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
290
|
+
return {};
|
|
291
|
+
}
|
|
292
|
+
if (trigger.kind === "resume_review") {
|
|
293
|
+
applyResumeReview(store, conversationId);
|
|
294
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
295
|
+
return {};
|
|
296
|
+
}
|
|
297
|
+
if (trigger.kind === "run") {
|
|
298
|
+
const result = applyRun(store, conversationId, projectRoot, {
|
|
299
|
+
slug: trigger.slug,
|
|
300
|
+
config: actionConfig,
|
|
301
|
+
platform: GROK_PLATFORM,
|
|
302
|
+
});
|
|
303
|
+
if (!result.ok) {
|
|
304
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
305
|
+
if (isChannelANeedPick(result)) {
|
|
306
|
+
return blockSubmit(buildNeedPickContext(result.userMessage, result.candidates), gateFallback);
|
|
307
|
+
}
|
|
308
|
+
return blockSubmit(result.userMessage, gateFallback);
|
|
309
|
+
}
|
|
310
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
311
|
+
return {};
|
|
312
|
+
}
|
|
313
|
+
if (trigger.kind === "replan") {
|
|
314
|
+
const result = applyReplan(store, conversationId, projectRoot, {
|
|
315
|
+
slug: trigger.slug,
|
|
316
|
+
config: actionConfig,
|
|
317
|
+
platform: GROK_PLATFORM,
|
|
318
|
+
});
|
|
319
|
+
if (!result.ok) {
|
|
320
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
321
|
+
if (isChannelANeedPick(result)) {
|
|
322
|
+
return blockSubmit(buildNeedPickContext(result.userMessage, result.candidates), gateFallback);
|
|
323
|
+
}
|
|
324
|
+
return blockSubmit(result.userMessage, gateFallback);
|
|
325
|
+
}
|
|
326
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
327
|
+
return {};
|
|
328
|
+
}
|
|
329
|
+
if (trigger.kind === "track_pick" && trigger.trackPick) {
|
|
330
|
+
const result = applyTrackPick(store, conversationId, projectRoot, trigger.trackPick, { config: actionConfig, platform: GROK_PLATFORM });
|
|
331
|
+
if (!result.ok) {
|
|
332
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
333
|
+
if (isChannelANeedPick(result)) {
|
|
334
|
+
return blockSubmit(buildNeedPickContext(result.userMessage, result.candidates), gateFallback);
|
|
335
|
+
}
|
|
336
|
+
return blockSubmit(result.userMessage, gateFallback);
|
|
337
|
+
}
|
|
338
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
339
|
+
return {};
|
|
340
|
+
}
|
|
341
|
+
return {};
|
|
342
|
+
}
|
|
343
|
+
if (!isHarnessFollowupMessage(prompt)) {
|
|
344
|
+
store.clearChainPending(conversationId);
|
|
345
|
+
}
|
|
346
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
347
|
+
return {};
|
|
348
|
+
}
|
|
349
|
+
function armCodeEdited(store, conversationId, projectRoot) {
|
|
350
|
+
const cfg = loadProjectReviewConfig(projectRoot);
|
|
351
|
+
if (cfg.reviewScope === "project") {
|
|
352
|
+
ensureAmbientReviewSession(store, conversationId, projectRoot, cfg.reviewScope, GROK_PLATFORM);
|
|
353
|
+
}
|
|
354
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
355
|
+
const session = store.getSession(conversationId);
|
|
356
|
+
const checklistPath = session?.checklist_path?.trim() ?? "";
|
|
357
|
+
let checklistSnap = null;
|
|
358
|
+
if (checklistPath) {
|
|
359
|
+
try {
|
|
360
|
+
checklistSnap = parseChecklist(checklistPath, { projectRoot });
|
|
361
|
+
}
|
|
362
|
+
catch {
|
|
363
|
+
/* still arm */
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
store.markCodeEdited(conversationId, (chain) => {
|
|
367
|
+
const fromPending = parseAdvanceNextItemId(chain.pending_followup);
|
|
368
|
+
if (checklistSnap) {
|
|
369
|
+
if (fromPending && effectiveReviewingItemId(checklistSnap, fromPending)) {
|
|
370
|
+
return fromPending;
|
|
371
|
+
}
|
|
372
|
+
return firstUnchecked(checklistSnap)?.id ?? null;
|
|
373
|
+
}
|
|
374
|
+
return fromPending;
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
/** PostToolUse → markCodeEdited for search_replace / Edit / Write / …. */
|
|
378
|
+
export function handlePostToolUse(store, payload, projectRoot) {
|
|
379
|
+
try {
|
|
380
|
+
handlePostToolUseInner(store, payload, projectRoot);
|
|
381
|
+
}
|
|
382
|
+
catch {
|
|
383
|
+
/* fail-open */
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
function handlePostToolUseInner(store, payload, projectRoot) {
|
|
387
|
+
const conversationId = sid(payload);
|
|
388
|
+
const toolName = String(payload.tool_name ?? payload.toolName ?? "").trim();
|
|
389
|
+
if (!conversationId || !isGrokEditTool(toolName))
|
|
390
|
+
return;
|
|
391
|
+
const filePaths = filePathsFromGrokEdit(payload);
|
|
392
|
+
if (filePaths.length === 0) {
|
|
393
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
let plansDir;
|
|
397
|
+
try {
|
|
398
|
+
plansDir = loadProjectHookConfig(projectRoot).plansDir;
|
|
399
|
+
}
|
|
400
|
+
catch {
|
|
401
|
+
plansDir = undefined;
|
|
402
|
+
}
|
|
403
|
+
let armed = false;
|
|
404
|
+
for (const filePath of filePaths) {
|
|
405
|
+
try {
|
|
406
|
+
notePlansDirEdit(store, conversationId, projectRoot, filePath, plansDir);
|
|
407
|
+
}
|
|
408
|
+
catch {
|
|
409
|
+
/* best-effort */
|
|
410
|
+
}
|
|
411
|
+
if (!isProductCodeEdit(filePath, { projectRoot }))
|
|
412
|
+
continue;
|
|
413
|
+
if (!armed) {
|
|
414
|
+
armCodeEdited(store, conversationId, projectRoot);
|
|
415
|
+
armed = true;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (!armed) {
|
|
419
|
+
stampGrokPlatform(store, conversationId, projectRoot);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Stop → ReviewEngine.
|
|
424
|
+
* Continue: decision:block + reason only (never also additionalContext).
|
|
425
|
+
* Hard stop: continue:false when loop ends (Grok-supported).
|
|
426
|
+
* Host caps ≤8/turn when GROK_STOP_CAP_RAISE_FOUND is false.
|
|
427
|
+
*/
|
|
428
|
+
export function handleStop(engine, payload, opts) {
|
|
429
|
+
try {
|
|
430
|
+
return handleStopInner(engine, payload, opts);
|
|
431
|
+
}
|
|
432
|
+
catch {
|
|
433
|
+
return {};
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
function handleStopInner(engine, payload, opts) {
|
|
437
|
+
const conversationId = sid(payload);
|
|
438
|
+
if (!conversationId)
|
|
439
|
+
return {};
|
|
440
|
+
if (!isGrokStopCompletionReason(payload)) {
|
|
441
|
+
return {};
|
|
442
|
+
}
|
|
443
|
+
const status = normalizeGrokStopStatus(payload, opts);
|
|
444
|
+
const transcriptRaw = payload.transcript_path ?? payload.transcriptPath;
|
|
445
|
+
const transcriptPath = typeof transcriptRaw === "string" && transcriptRaw.trim()
|
|
446
|
+
? transcriptRaw.trim()
|
|
447
|
+
: undefined;
|
|
448
|
+
const action = engine.handleStop({
|
|
449
|
+
conversationId,
|
|
450
|
+
status,
|
|
451
|
+
loopCount: loopCountFromStopHookActive(payload),
|
|
452
|
+
transcriptPath,
|
|
453
|
+
platform: GROK_PLATFORM,
|
|
454
|
+
});
|
|
455
|
+
if (!action?.message)
|
|
456
|
+
return {};
|
|
457
|
+
const reason = clipText(blockReason(action.message, "Autopilot followup"), MAX_HOOK_STDIO_CHARS);
|
|
458
|
+
if (!action.loop) {
|
|
459
|
+
return { continue: false, stopReason: reason };
|
|
460
|
+
}
|
|
461
|
+
return {
|
|
462
|
+
decision: "block",
|
|
463
|
+
reason,
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,OAAO,EACP,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,0BAA0B,EAC1B,wBAAwB,EACxB,cAAc,EACd,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,+BAA+B,EAC/B,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,YAAY,GAKb,MAAM,yBAAyB,CAAC;AAqEjC,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,CAAC;AAC/C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,4BAA4B,GA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AS,EAAE,2BAA2B,CAAC,OAAO,CAAC;QAC/C,cAAc;QACd,QAAQ,EAAE,aAAa;KACxB,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM,EAAE,OAAO;QAAE,OAAO,EAAE,CAAC;IAEhC,MAAM,MAAM,GAAG,QAAQ,CACrB,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,oBAAoB,CAAC,EACjD,oBAAoB,CACrB,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IACjD,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,OAAO;QACjB,MAAM;KACP,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@autopilot-harness/port-grok-build",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Autopilot harness host port for Grok Build CLI hooks (degraded Stop ≤8/turn unless raise found)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/mt2007/autopilot-harness.git",
|
|
9
|
+
"directory": "packages/ports/grok-build"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/mt2007/autopilot-harness#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/mt2007/autopilot-harness/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@autopilot-harness/core": "0.6.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"typescript": "^5.8.2"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=22"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"author": "mt2007 (https://github.com/mt2007)",
|
|
40
|
+
"keywords": [
|
|
41
|
+
"autopilot",
|
|
42
|
+
"harness",
|
|
43
|
+
"agent",
|
|
44
|
+
"ai",
|
|
45
|
+
"vibecoding",
|
|
46
|
+
"grok",
|
|
47
|
+
"grok-build",
|
|
48
|
+
"xai",
|
|
49
|
+
"checklist",
|
|
50
|
+
"code-review"
|
|
51
|
+
],
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsc -p tsconfig.json",
|
|
54
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
55
|
+
}
|
|
56
|
+
}
|