@autopilot-harness/port-hermes-agent 0.9.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 +135 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +772 -0
- package/dist/index.js.map +1 -0
- package/package.json +55 -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,135 @@
|
|
|
1
|
+
import { type PhaseActionConfig, type ReviewEngine, type StateStore } from "@autopilot-harness/core";
|
|
2
|
+
/** Hermes shell-hook envelope (top-level + event kwargs in `extra`). */
|
|
3
|
+
export interface HermesHookPayload {
|
|
4
|
+
hook_event_name?: string;
|
|
5
|
+
hookEventName?: string;
|
|
6
|
+
tool_name?: string | null;
|
|
7
|
+
toolName?: string | null;
|
|
8
|
+
tool_input?: Record<string, unknown> | string | null;
|
|
9
|
+
toolInput?: Record<string, unknown> | string | null;
|
|
10
|
+
session_id?: string;
|
|
11
|
+
sessionId?: string;
|
|
12
|
+
cwd?: string;
|
|
13
|
+
profile?: string;
|
|
14
|
+
extra?: Record<string, unknown>;
|
|
15
|
+
/**
|
|
16
|
+
* Some hosts flatten user_message onto the root.
|
|
17
|
+
* Hermes may pass a string, content list, or single content-part object.
|
|
18
|
+
*/
|
|
19
|
+
user_message?: string | readonly unknown[] | Record<string, unknown>;
|
|
20
|
+
userMessage?: string | readonly unknown[] | Record<string, unknown>;
|
|
21
|
+
prompt?: string | readonly unknown[] | Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
export type HermesSubmitPayload = HermesHookPayload;
|
|
24
|
+
export type HermesEditPayload = HermesHookPayload;
|
|
25
|
+
export type HermesPreVerifyPayload = HermesHookPayload;
|
|
26
|
+
export interface HermesPortConfig {
|
|
27
|
+
phaseActions?: PhaseActionConfig;
|
|
28
|
+
}
|
|
29
|
+
export declare const HERMES_PLATFORM = "hermes-agent";
|
|
30
|
+
/**
|
|
31
|
+
* Research 2026-09-15 (local Hermes v0.21.3): shell `_parse_pre_verify`
|
|
32
|
+
* maps decision:block / action:continue → continue. See research-hermes-hooks.md.
|
|
33
|
+
*/
|
|
34
|
+
export declare const HERMES_SHELL_PRE_VERIFY_CONTINUE_SUPPORTED = true;
|
|
35
|
+
/** Soft doctor tip — builds with `_parse_pre_verify` in shell_hooks. */
|
|
36
|
+
export declare const HERMES_SOFT_MIN_VERSION = "0.21.3";
|
|
37
|
+
/** Primary continue shape (Claude Stop); Hermes-native also accepted by host. */
|
|
38
|
+
export declare const HERMES_PRE_VERIFY_PRIMARY = "decision:block+reason";
|
|
39
|
+
/** Init writes this under `agent.max_verify_nudges` (raise only; never lower user higher). */
|
|
40
|
+
export declare const HERMES_INIT_MAX_VERIFY_NUDGES = 32;
|
|
41
|
+
/** Host default when unset. */
|
|
42
|
+
export declare const HERMES_DEFAULT_MAX_VERIFY_NUDGES = 3;
|
|
43
|
+
export declare const HERMES_ENV_HOME = "HERMES_HOME";
|
|
44
|
+
/** post_tool_call matcher (regex fullmatch). */
|
|
45
|
+
export declare const HERMES_POST_TOOL_MATCHER = "write_file|patch";
|
|
46
|
+
export declare const MAX_NEED_PICK_SLUGS = 40;
|
|
47
|
+
export declare const MAX_NEED_PICK_CONTEXT_CHARS = 2000;
|
|
48
|
+
export declare const MAX_HOOK_STDIO_CHARS = 8192;
|
|
49
|
+
export declare const MAX_TOOL_ARGS_JSON_CHARS = 1048576;
|
|
50
|
+
/** Cap host-reported changed_paths / edit path lists (DoS / pathological payloads). */
|
|
51
|
+
export declare const MAX_HERMES_CHANGED_PATHS = 256;
|
|
52
|
+
/** Reject absurd path strings from hostile tool_input / changed_paths. */
|
|
53
|
+
export declare const MAX_HERMES_PATH_CHARS = 4096;
|
|
54
|
+
/** Cap V4A / multi-file patch body parse size. */
|
|
55
|
+
export declare const MAX_HERMES_PATCH_BODY_CHARS = 1048576;
|
|
56
|
+
/**
|
|
57
|
+
* pre_llm_call / pre_verify stdout.
|
|
58
|
+
* Allow / hard-stop: empty-field object → runner should emit `{}` (research lock).
|
|
59
|
+
* Inject: `{ context }`. Continue: `{ decision:"block", reason }`.
|
|
60
|
+
*/
|
|
61
|
+
export interface HermesHookResult {
|
|
62
|
+
context?: string;
|
|
63
|
+
decision?: "block";
|
|
64
|
+
reason?: string;
|
|
65
|
+
/** Hermes-native continue (optional; primary is decision+reason). */
|
|
66
|
+
action?: "continue";
|
|
67
|
+
message?: string;
|
|
68
|
+
}
|
|
69
|
+
/** True when result has no defined fields → allow / silence (`{}` wire). */
|
|
70
|
+
export declare function isHermesAllowNoop(result: HermesHookResult | null | undefined): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Prefer install-root, then stdin cwd.
|
|
73
|
+
* Never returns process.cwd(). Do **not** fall back to HERMES_HOME — that is the
|
|
74
|
+
* profile config home, not the instrumented project (would mis-root Autopilot state).
|
|
75
|
+
* Also refuse stdin cwd when it is equal to / nested under HERMES_HOME (Hermes shell
|
|
76
|
+
* sets `cwd` to `Path.cwd()`, often the agent clone under `~/.hermes/...`).
|
|
77
|
+
* Always also refuse the Hermes default `~/.hermes` tree — profile HERMES_HOME may
|
|
78
|
+
* point at `~/.hermes/profiles/<name>` while the agent cwd stays under `~/.hermes/`.
|
|
79
|
+
*/
|
|
80
|
+
export declare function resolveHermesWorkspaceRoot(opts: {
|
|
81
|
+
installRoot?: string;
|
|
82
|
+
env?: NodeJS.ProcessEnv;
|
|
83
|
+
stdinCwd?: string;
|
|
84
|
+
}): string | null;
|
|
85
|
+
/** `extra.attempt` → ReviewEngine loopCount (0 when absent/invalid). */
|
|
86
|
+
export declare function loopCountFromHermesAttempt(payload: HermesPreVerifyPayload): number;
|
|
87
|
+
export declare function userMessageFromHermesSubmit(payload: HermesSubmitPayload): string;
|
|
88
|
+
export declare function changedPathsFromHermesPreVerify(payload: HermesPreVerifyPayload): string[];
|
|
89
|
+
export declare function buildNeedPickContext(userMessage: unknown, candidates?: ReadonlyArray<{
|
|
90
|
+
slug?: string;
|
|
91
|
+
}>): string;
|
|
92
|
+
/** Hermes cannot discard the user prompt — inject guidance as context. */
|
|
93
|
+
export declare function injectContext(text: string): HermesHookResult;
|
|
94
|
+
export declare function injectNeedPickContext(userMessage: unknown, candidates?: ReadonlyArray<{
|
|
95
|
+
slug?: string;
|
|
96
|
+
}>): HermesHookResult;
|
|
97
|
+
/**
|
|
98
|
+
* Parse paths from Hermes V4A / multi-file `patch` bodies
|
|
99
|
+
* (`*** Add|Update|Delete File:`, `*** Move|Rename File: a -> b`, `+++` lines).
|
|
100
|
+
*/
|
|
101
|
+
export declare function pathsFromHermesPatchBody(command: string): string[];
|
|
102
|
+
export declare function filePathsFromHermesEdit(payload: HermesEditPayload): string[];
|
|
103
|
+
export declare function isHermesEditTool(toolName: string): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* pre_llm_call → core triggers / FSM.
|
|
106
|
+
* Inject `{ context }` for needPick / busy / hard errors (cannot discard prompt).
|
|
107
|
+
* Allow → `{}` (runner emits JSON `{}`).
|
|
108
|
+
*/
|
|
109
|
+
export declare function handlePreLlmCall(store: StateStore, payload: HermesSubmitPayload, projectRoot: string, portConfig?: HermesPortConfig): HermesHookResult;
|
|
110
|
+
export declare const handleHermesPreLlmCall: typeof handlePreLlmCall;
|
|
111
|
+
/** @deprecated Alias for UPS-shaped call sites. */
|
|
112
|
+
export declare const handleUserPromptSubmit: typeof handlePreLlmCall;
|
|
113
|
+
/**
|
|
114
|
+
* post_tool_call → markCodeEdited for write_file / patch.
|
|
115
|
+
* Observer only — never block.
|
|
116
|
+
*/
|
|
117
|
+
export declare function handlePostToolCall(store: StateStore, payload: HermesEditPayload, projectRoot: string): void;
|
|
118
|
+
export declare const handleHermesPostToolCall: typeof handlePostToolCall;
|
|
119
|
+
/** @deprecated Alias for PostToolUse-shaped call sites. */
|
|
120
|
+
export declare const handlePostToolUse: typeof handlePostToolCall;
|
|
121
|
+
export declare function collectHermesErrorText(payload: HermesPreVerifyPayload): string;
|
|
122
|
+
export declare function normalizeHermesStopStatus(payload: HermesPreVerifyPayload, opts?: {
|
|
123
|
+
status?: "completed" | "error" | "aborted";
|
|
124
|
+
}): "completed" | "error" | "aborted";
|
|
125
|
+
/**
|
|
126
|
+
* pre_verify → ReviewEngine.
|
|
127
|
+
* Continue: `{ decision:"block", reason }` (Claude Stop; shell maps to continue).
|
|
128
|
+
* Hard-stop / no followup: `{}`.
|
|
129
|
+
* Also arms from `changed_paths` (Post matcher backup).
|
|
130
|
+
*/
|
|
131
|
+
export declare function handlePreVerify(engine: ReviewEngine, store: StateStore, payload: HermesPreVerifyPayload, projectRoot: string, opts?: {
|
|
132
|
+
status?: "completed" | "error" | "aborted";
|
|
133
|
+
}): HermesHookResult;
|
|
134
|
+
export declare const handleHermesPreVerify: typeof handlePreVerify;
|
|
135
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAwBL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAEjC,wEAAwE;AACxE,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpE,MAAM,CAAC,EAAE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B,gBAAgB,CAC9B,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,mBAAmB,EAC5B,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,gBAAgB,GAC5B,gBAAgB,CAMlB;AAED,eAAO,MAAM,sBAAsB,yBAAmB,CAAC;AACvD,mDAAmD;AACnD,eAAO,MAAM,sBAAsB,yBAAmB,CAAC;AA4MvD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,iBAAiB,EAC1B,WAAW,EAAE,MAAM,GAClB,IAAI,CAMN;AAED,eAAO,MAAM,wBAAwB,2BAAqB,CAAC;AAC3D,2DAA2D;AAC3D,eAAO,MAAM,iBAAiB,2BAAqB,CAAC;AAkBpD,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,sBAAsB,GAC9B,MAAM,CAUR;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,sBAAsB,EAC/B,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,GAAG,SAAS,CAAA;CAAE,GACpD,WAAW,GAAG,OAAO,GAAG,SAAS,CAUnC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,sBAAsB,EAC/B,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,GAAG,SAAS,CAAA;CAAE,GACpD,gBAAgB,CAMlB;AAED,eAAO,MAAM,qBAAqB,wBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,772 @@
|
|
|
1
|
+
import os from "node:os";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
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";
|
|
4
|
+
export const HERMES_PLATFORM = "hermes-agent";
|
|
5
|
+
/**
|
|
6
|
+
* Research 2026-09-15 (local Hermes v0.21.3): shell `_parse_pre_verify`
|
|
7
|
+
* maps decision:block / action:continue → continue. See research-hermes-hooks.md.
|
|
8
|
+
*/
|
|
9
|
+
export const HERMES_SHELL_PRE_VERIFY_CONTINUE_SUPPORTED = true;
|
|
10
|
+
/** Soft doctor tip — builds with `_parse_pre_verify` in shell_hooks. */
|
|
11
|
+
export const HERMES_SOFT_MIN_VERSION = "0.21.3";
|
|
12
|
+
/** Primary continue shape (Claude Stop); Hermes-native also accepted by host. */
|
|
13
|
+
export const HERMES_PRE_VERIFY_PRIMARY = "decision:block+reason";
|
|
14
|
+
/** Init writes this under `agent.max_verify_nudges` (raise only; never lower user higher). */
|
|
15
|
+
export const HERMES_INIT_MAX_VERIFY_NUDGES = 32;
|
|
16
|
+
/** Host default when unset. */
|
|
17
|
+
export const HERMES_DEFAULT_MAX_VERIFY_NUDGES = 3;
|
|
18
|
+
export const HERMES_ENV_HOME = "HERMES_HOME";
|
|
19
|
+
/** post_tool_call matcher (regex fullmatch). */
|
|
20
|
+
export const HERMES_POST_TOOL_MATCHER = "write_file|patch";
|
|
21
|
+
export const MAX_NEED_PICK_SLUGS = 40;
|
|
22
|
+
export const MAX_NEED_PICK_CONTEXT_CHARS = 2_000;
|
|
23
|
+
export const MAX_HOOK_STDIO_CHARS = 8_192;
|
|
24
|
+
export const MAX_TOOL_ARGS_JSON_CHARS = 1_048_576;
|
|
25
|
+
/** Cap host-reported changed_paths / edit path lists (DoS / pathological payloads). */
|
|
26
|
+
export const MAX_HERMES_CHANGED_PATHS = 256;
|
|
27
|
+
/** Reject absurd path strings from hostile tool_input / changed_paths. */
|
|
28
|
+
export const MAX_HERMES_PATH_CHARS = 4_096;
|
|
29
|
+
/** Cap V4A / multi-file patch body parse size. */
|
|
30
|
+
export const MAX_HERMES_PATCH_BODY_CHARS = 1_048_576;
|
|
31
|
+
/** True when result has no defined fields → allow / silence (`{}` wire). */
|
|
32
|
+
export function isHermesAllowNoop(result) {
|
|
33
|
+
if (result == null || typeof result !== "object" || Array.isArray(result)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
for (const value of Object.values(result)) {
|
|
37
|
+
if (value !== undefined && value !== null)
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
function sid(p) {
|
|
43
|
+
for (const v of [p.session_id, p.sessionId]) {
|
|
44
|
+
if (typeof v === "string") {
|
|
45
|
+
const t = v.trim();
|
|
46
|
+
// Match StateStore.isConversationIdOk — refuse controls before any mutation.
|
|
47
|
+
if (t && !/[\u0000-\u001f\u007f]/.test(t))
|
|
48
|
+
return t;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const extra = p.extra;
|
|
52
|
+
if (extra && typeof extra === "object") {
|
|
53
|
+
// Do NOT use parent_session_id — would stamp Autopilot state onto the parent
|
|
54
|
+
// when a child/subagent envelope leaks into this hook.
|
|
55
|
+
for (const key of ["session_id", "sessionId"]) {
|
|
56
|
+
const v = extra[key];
|
|
57
|
+
if (typeof v === "string") {
|
|
58
|
+
const t = v.trim();
|
|
59
|
+
if (t && !/[\u0000-\u001f\u007f]/.test(t))
|
|
60
|
+
return t;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return "";
|
|
65
|
+
}
|
|
66
|
+
function extraOf(p) {
|
|
67
|
+
return p.extra && typeof p.extra === "object" && !Array.isArray(p.extra)
|
|
68
|
+
? p.extra
|
|
69
|
+
: {};
|
|
70
|
+
}
|
|
71
|
+
function clipText(text, max = MAX_HOOK_STDIO_CHARS) {
|
|
72
|
+
if (text.length <= max)
|
|
73
|
+
return text;
|
|
74
|
+
return `${text.slice(0, max - 1)}…`;
|
|
75
|
+
}
|
|
76
|
+
function blockReason(message, fallback) {
|
|
77
|
+
const m = typeof message === "string" ? message.trim() : "";
|
|
78
|
+
return m || fallback;
|
|
79
|
+
}
|
|
80
|
+
/** True for POSIX absolute or Windows drive-absolute lexical paths. */
|
|
81
|
+
function isAbsoluteLexicalPath(p) {
|
|
82
|
+
return p.startsWith("/") || /^[A-Za-z]:\//i.test(p);
|
|
83
|
+
}
|
|
84
|
+
/** `/` or `C:/` — never a usable Autopilot project root. */
|
|
85
|
+
function isFilesystemRootPath(p) {
|
|
86
|
+
return p === "/" || /^[A-Za-z]:\/?$/i.test(p);
|
|
87
|
+
}
|
|
88
|
+
/** True when a path segment is exactly `.hermes` (profile / agent home trees). */
|
|
89
|
+
function isHermesDotDirTree(p) {
|
|
90
|
+
// Case-insensitive: APFS/Windows may treat `.Hermes` as the same directory.
|
|
91
|
+
return p.split("/").some((seg) => seg.toLowerCase() === ".hermes");
|
|
92
|
+
}
|
|
93
|
+
/** Absolute, non-root, and not under a `.hermes` directory segment. */
|
|
94
|
+
function isUsableHermesWorkspaceRoot(p) {
|
|
95
|
+
return (isAbsoluteLexicalPath(p) &&
|
|
96
|
+
!isFilesystemRootPath(p) &&
|
|
97
|
+
!isHermesDotDirTree(p));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Collapse `.` / `..` and unify separators without touching the real filesystem
|
|
101
|
+
* (avoids process.cwd / symlink TOCTOU). Closes `/proj/../.hermes/agent` bypasses.
|
|
102
|
+
*/
|
|
103
|
+
function normalizeLexicalPath(input) {
|
|
104
|
+
const raw = input.replace(/\\/g, "/");
|
|
105
|
+
const win = raw.match(/^([A-Za-z]:)(\/.*)?$/);
|
|
106
|
+
if (win) {
|
|
107
|
+
const drive = `${win[1].toUpperCase()}/`;
|
|
108
|
+
const body = (win[2] ?? "/").replace(/^\//, "");
|
|
109
|
+
return drive + collapsePathSegments(body).join("/");
|
|
110
|
+
}
|
|
111
|
+
const abs = raw.startsWith("/");
|
|
112
|
+
const collapsed = collapsePathSegments(raw);
|
|
113
|
+
if (abs) {
|
|
114
|
+
return collapsed.length === 0 ? "/" : `/${collapsed.join("/")}`;
|
|
115
|
+
}
|
|
116
|
+
return collapsed.join("/");
|
|
117
|
+
}
|
|
118
|
+
function collapsePathSegments(raw) {
|
|
119
|
+
const out = [];
|
|
120
|
+
for (const part of raw.split("/")) {
|
|
121
|
+
if (!part || part === ".")
|
|
122
|
+
continue;
|
|
123
|
+
if (part === "..") {
|
|
124
|
+
if (out.length > 0)
|
|
125
|
+
out.pop();
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
out.push(part);
|
|
129
|
+
}
|
|
130
|
+
return out;
|
|
131
|
+
}
|
|
132
|
+
/** POSIX-normalized prefix check (Hermes home guard; not a full realpath resolve). */
|
|
133
|
+
function isPathEqualOrUnder(candidate, root) {
|
|
134
|
+
const c = normalizeLexicalPath(candidate);
|
|
135
|
+
const r = normalizeLexicalPath(root);
|
|
136
|
+
// Filesystem root as "home" must not block every path — only exact root.
|
|
137
|
+
if (isFilesystemRootPath(r)) {
|
|
138
|
+
return c === r;
|
|
139
|
+
}
|
|
140
|
+
return c === r || c.startsWith(`${r}/`);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Prefer install-root, then stdin cwd.
|
|
144
|
+
* Never returns process.cwd(). Do **not** fall back to HERMES_HOME — that is the
|
|
145
|
+
* profile config home, not the instrumented project (would mis-root Autopilot state).
|
|
146
|
+
* Also refuse stdin cwd when it is equal to / nested under HERMES_HOME (Hermes shell
|
|
147
|
+
* sets `cwd` to `Path.cwd()`, often the agent clone under `~/.hermes/...`).
|
|
148
|
+
* Always also refuse the Hermes default `~/.hermes` tree — profile HERMES_HOME may
|
|
149
|
+
* point at `~/.hermes/profiles/<name>` while the agent cwd stays under `~/.hermes/`.
|
|
150
|
+
*/
|
|
151
|
+
export function resolveHermesWorkspaceRoot(opts) {
|
|
152
|
+
const clean = (value) => {
|
|
153
|
+
if (typeof value !== "string")
|
|
154
|
+
return null;
|
|
155
|
+
let t = value.trim();
|
|
156
|
+
if (!t || /[\0\r\n]/.test(t))
|
|
157
|
+
return null;
|
|
158
|
+
// Drop trailing separators (keep a lone filesystem root as-is for later guards).
|
|
159
|
+
if (!/^([A-Za-z]:)?[/\\]+$/i.test(t)) {
|
|
160
|
+
t = t.replace(/[/\\]+$/, "");
|
|
161
|
+
}
|
|
162
|
+
return t || null;
|
|
163
|
+
};
|
|
164
|
+
const installRaw = clean(opts.installRoot);
|
|
165
|
+
if (installRaw) {
|
|
166
|
+
const install = normalizeLexicalPath(installRaw);
|
|
167
|
+
// Same bar as stdin cwd: absolute, non-root, not a `.hermes` tree.
|
|
168
|
+
if (!isUsableHermesWorkspaceRoot(install)) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
return install;
|
|
172
|
+
}
|
|
173
|
+
const cwdRaw = clean(opts.stdinCwd);
|
|
174
|
+
if (!cwdRaw)
|
|
175
|
+
return null;
|
|
176
|
+
// Hermes shell `cwd` is Path.cwd() (absolute). Relative stdin cwd can collapse
|
|
177
|
+
// via `..` into `.hermes/...` and bypass absolute HERMES_HOME prefix checks.
|
|
178
|
+
const cwd = normalizeLexicalPath(cwdRaw);
|
|
179
|
+
if (!isUsableHermesWorkspaceRoot(cwd))
|
|
180
|
+
return null;
|
|
181
|
+
// Match factory: omit `env` → read process.env (guard must not depend on caller passing it).
|
|
182
|
+
const env = opts.env ?? process.env;
|
|
183
|
+
const blockedHomes = new Set();
|
|
184
|
+
const envHome = clean(env[HERMES_ENV_HOME]);
|
|
185
|
+
if (envHome) {
|
|
186
|
+
const home = normalizeLexicalPath(envHome);
|
|
187
|
+
if (isAbsoluteLexicalPath(home) && !isFilesystemRootPath(home)) {
|
|
188
|
+
blockedHomes.add(home);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const defaultHome = defaultHermesHomeDir(clean);
|
|
192
|
+
if (defaultHome)
|
|
193
|
+
blockedHomes.add(normalizeLexicalPath(defaultHome));
|
|
194
|
+
for (const home of blockedHomes) {
|
|
195
|
+
if (isPathEqualOrUnder(cwd, home))
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
return cwd;
|
|
199
|
+
}
|
|
200
|
+
function defaultHermesHomeDir(clean) {
|
|
201
|
+
try {
|
|
202
|
+
return clean(path.join(os.homedir(), ".hermes"));
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/** `extra.attempt` → ReviewEngine loopCount (0 when absent/invalid). */
|
|
209
|
+
export function loopCountFromHermesAttempt(payload) {
|
|
210
|
+
const raw = extraOf(payload).attempt;
|
|
211
|
+
if (typeof raw === "number" && Number.isFinite(raw) && raw >= 0) {
|
|
212
|
+
return Math.floor(raw);
|
|
213
|
+
}
|
|
214
|
+
if (typeof raw === "string" && raw.trim()) {
|
|
215
|
+
const n = Number(raw);
|
|
216
|
+
if (Number.isFinite(n) && n >= 0)
|
|
217
|
+
return Math.floor(n);
|
|
218
|
+
}
|
|
219
|
+
return 0;
|
|
220
|
+
}
|
|
221
|
+
/** Non-text multimodal part types (aligned with Hermes `message_content` + video types). */
|
|
222
|
+
const HERMES_NON_TEXT_PART_TYPES = new Set([
|
|
223
|
+
"image",
|
|
224
|
+
"image_url",
|
|
225
|
+
"input_image",
|
|
226
|
+
"audio",
|
|
227
|
+
"input_audio",
|
|
228
|
+
"file",
|
|
229
|
+
"input_file",
|
|
230
|
+
"document",
|
|
231
|
+
"video",
|
|
232
|
+
"video_url",
|
|
233
|
+
"input_video",
|
|
234
|
+
]);
|
|
235
|
+
/** Text field keys — Hermes `message_content._TEXT_KEYS` (no generic `value`). */
|
|
236
|
+
const HERMES_TEXT_PART_KEYS = [
|
|
237
|
+
"text",
|
|
238
|
+
"content",
|
|
239
|
+
"input_text",
|
|
240
|
+
"output_text",
|
|
241
|
+
"summary_text",
|
|
242
|
+
];
|
|
243
|
+
/** True when a content-list item is a non-text multimodal part (image/audio/file/video). */
|
|
244
|
+
function isNonTextHermesContentPart(o) {
|
|
245
|
+
const typeRaw = typeof o.type === "string" ? o.type.trim().toLowerCase() : "";
|
|
246
|
+
if (typeRaw && HERMES_NON_TEXT_PART_TYPES.has(typeRaw))
|
|
247
|
+
return true;
|
|
248
|
+
// Untyped / alternate shapes that still carry media payloads.
|
|
249
|
+
return ("image_url" in o ||
|
|
250
|
+
"imageUrl" in o ||
|
|
251
|
+
"video_url" in o ||
|
|
252
|
+
"videoUrl" in o);
|
|
253
|
+
}
|
|
254
|
+
function textFromOneHermesContentPart(o) {
|
|
255
|
+
if (isNonTextHermesContentPart(o))
|
|
256
|
+
return "";
|
|
257
|
+
for (const key of HERMES_TEXT_PART_KEYS) {
|
|
258
|
+
const t = o[key];
|
|
259
|
+
if (typeof t === "string" && t.trim()) {
|
|
260
|
+
return t.length > MAX_HOOK_STDIO_CHARS
|
|
261
|
+
? t.slice(0, MAX_HOOK_STDIO_CHARS)
|
|
262
|
+
: t;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return "";
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Flatten Hermes `user_message` for triggers / chain guards.
|
|
269
|
+
* Host may pass a string, a multimodal content list, or a single content part
|
|
270
|
+
* object (parity with Hermes `flatten_message_text`).
|
|
271
|
+
* Skips image/audio/file/video parts so urls/base64 are not treated as prompt text.
|
|
272
|
+
*/
|
|
273
|
+
function textFromHermesContent(value) {
|
|
274
|
+
if (typeof value === "string") {
|
|
275
|
+
if (!value.trim())
|
|
276
|
+
return "";
|
|
277
|
+
return value.length > MAX_HOOK_STDIO_CHARS
|
|
278
|
+
? value.slice(0, MAX_HOOK_STDIO_CHARS)
|
|
279
|
+
: value;
|
|
280
|
+
}
|
|
281
|
+
if (Array.isArray(value)) {
|
|
282
|
+
const parts = [];
|
|
283
|
+
let used = 0;
|
|
284
|
+
for (const item of value.slice(0, 64)) {
|
|
285
|
+
const remain = MAX_HOOK_STDIO_CHARS - used;
|
|
286
|
+
if (remain <= 0)
|
|
287
|
+
break;
|
|
288
|
+
let piece = "";
|
|
289
|
+
if (typeof item === "string") {
|
|
290
|
+
piece = item.trim() ? item : "";
|
|
291
|
+
}
|
|
292
|
+
else if (item && typeof item === "object" && !Array.isArray(item)) {
|
|
293
|
+
piece = textFromOneHermesContentPart(item);
|
|
294
|
+
}
|
|
295
|
+
if (!piece)
|
|
296
|
+
continue;
|
|
297
|
+
if (piece.length > remain)
|
|
298
|
+
piece = piece.slice(0, remain);
|
|
299
|
+
parts.push(piece);
|
|
300
|
+
used += piece.length + 1;
|
|
301
|
+
}
|
|
302
|
+
return parts.join("\n");
|
|
303
|
+
}
|
|
304
|
+
// Single content-part object (not wrapped in a list). null is typeof "object".
|
|
305
|
+
if (value && typeof value === "object") {
|
|
306
|
+
return textFromOneHermesContentPart(value);
|
|
307
|
+
}
|
|
308
|
+
return "";
|
|
309
|
+
}
|
|
310
|
+
export function userMessageFromHermesSubmit(payload) {
|
|
311
|
+
for (const root of [
|
|
312
|
+
payload.user_message,
|
|
313
|
+
payload.userMessage,
|
|
314
|
+
payload.prompt,
|
|
315
|
+
]) {
|
|
316
|
+
const text = textFromHermesContent(root);
|
|
317
|
+
if (text)
|
|
318
|
+
return text;
|
|
319
|
+
}
|
|
320
|
+
const extra = extraOf(payload);
|
|
321
|
+
for (const key of ["user_message", "userMessage", "prompt"]) {
|
|
322
|
+
const text = textFromHermesContent(extra[key]);
|
|
323
|
+
if (text)
|
|
324
|
+
return text;
|
|
325
|
+
}
|
|
326
|
+
return "";
|
|
327
|
+
}
|
|
328
|
+
function isSafeHermesPath(raw) {
|
|
329
|
+
const t = raw.trim();
|
|
330
|
+
return (t.length > 0 &&
|
|
331
|
+
t.length <= MAX_HERMES_PATH_CHARS &&
|
|
332
|
+
!/[\0\r\n]/.test(t));
|
|
333
|
+
}
|
|
334
|
+
export function changedPathsFromHermesPreVerify(payload) {
|
|
335
|
+
const raw = extraOf(payload).changed_paths ?? extraOf(payload).changedPaths;
|
|
336
|
+
if (!Array.isArray(raw))
|
|
337
|
+
return [];
|
|
338
|
+
const out = [];
|
|
339
|
+
for (const p of raw) {
|
|
340
|
+
if (out.length >= MAX_HERMES_CHANGED_PATHS)
|
|
341
|
+
break;
|
|
342
|
+
if (typeof p === "string" && isSafeHermesPath(p))
|
|
343
|
+
out.push(p.trim());
|
|
344
|
+
}
|
|
345
|
+
return out;
|
|
346
|
+
}
|
|
347
|
+
export function buildNeedPickContext(userMessage, candidates) {
|
|
348
|
+
const fromMessage = typeof userMessage === "string" && userMessage.trim().length > 0
|
|
349
|
+
? userMessage.trim()
|
|
350
|
+
: "";
|
|
351
|
+
const slugs = [
|
|
352
|
+
...new Set((candidates ?? [])
|
|
353
|
+
.map((c) => (c && typeof c.slug === "string" ? c.slug.trim() : ""))
|
|
354
|
+
.filter((s) => s.length > 0 && isSafeTrackSlug(s))),
|
|
355
|
+
].slice(0, MAX_NEED_PICK_SLUGS);
|
|
356
|
+
let ctx = fromMessage ||
|
|
357
|
+
(slugs.length > 0
|
|
358
|
+
? `[Autopilot] Select a plan to execute:\n\n${slugs
|
|
359
|
+
.map((s, i) => ` ${i + 1}. ${s}`)
|
|
360
|
+
.join("\n")}\n\nReply with a number or /autopilot-run <slug>.`
|
|
361
|
+
: "[Autopilot] Select a plan to execute. Reply with a number or /autopilot-run <slug>.");
|
|
362
|
+
if (ctx.length > MAX_NEED_PICK_CONTEXT_CHARS) {
|
|
363
|
+
ctx = `${ctx.slice(0, MAX_NEED_PICK_CONTEXT_CHARS - 1)}…`;
|
|
364
|
+
}
|
|
365
|
+
return ctx;
|
|
366
|
+
}
|
|
367
|
+
/** Hermes cannot discard the user prompt — inject guidance as context. */
|
|
368
|
+
export function injectContext(text) {
|
|
369
|
+
const t = text.trim();
|
|
370
|
+
if (!t)
|
|
371
|
+
return {};
|
|
372
|
+
return { context: clipText(t, MAX_NEED_PICK_CONTEXT_CHARS + 256) };
|
|
373
|
+
}
|
|
374
|
+
export function injectNeedPickContext(userMessage, candidates) {
|
|
375
|
+
return injectContext(buildNeedPickContext(userMessage, candidates));
|
|
376
|
+
}
|
|
377
|
+
function parseToolInput(payload) {
|
|
378
|
+
const raw = payload.tool_input ?? payload.toolInput;
|
|
379
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
380
|
+
return raw;
|
|
381
|
+
}
|
|
382
|
+
if (typeof raw === "string" && raw.trim()) {
|
|
383
|
+
if (raw.length > MAX_TOOL_ARGS_JSON_CHARS)
|
|
384
|
+
return null;
|
|
385
|
+
try {
|
|
386
|
+
const parsed = JSON.parse(raw);
|
|
387
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
388
|
+
return parsed;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
catch {
|
|
392
|
+
return null;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Parse paths from Hermes V4A / multi-file `patch` bodies
|
|
399
|
+
* (`*** Add|Update|Delete File:`, `*** Move|Rename File: a -> b`, `+++` lines).
|
|
400
|
+
*/
|
|
401
|
+
export function pathsFromHermesPatchBody(command) {
|
|
402
|
+
if (typeof command !== "string" || !command.trim())
|
|
403
|
+
return [];
|
|
404
|
+
const text = command.length > MAX_HERMES_PATCH_BODY_CHARS
|
|
405
|
+
? command.slice(0, MAX_HERMES_PATCH_BODY_CHARS)
|
|
406
|
+
: command;
|
|
407
|
+
const found = [];
|
|
408
|
+
const seen = new Set();
|
|
409
|
+
const push = (raw) => {
|
|
410
|
+
if (found.length >= MAX_HERMES_CHANGED_PATHS)
|
|
411
|
+
return;
|
|
412
|
+
let p = raw.trim();
|
|
413
|
+
if (!isSafeHermesPath(p) || p === "/dev/null")
|
|
414
|
+
return;
|
|
415
|
+
p = p.replace(/^[ab]\//, "");
|
|
416
|
+
if (!isSafeHermesPath(p) || seen.has(p))
|
|
417
|
+
return;
|
|
418
|
+
seen.add(p);
|
|
419
|
+
found.push(p);
|
|
420
|
+
};
|
|
421
|
+
for (const line of text.split(/\r?\n/)) {
|
|
422
|
+
if (found.length >= MAX_HERMES_CHANGED_PATHS)
|
|
423
|
+
break;
|
|
424
|
+
// Hermes uses `Move File`; Codex/Factory often use `Rename File`. Accept both.
|
|
425
|
+
// `\s*` after *** — Hermes allows `***Update File:` (no space).
|
|
426
|
+
const rename = line.match(/^\*\*\*\s*(?:Rename|Move)\s+File:\s*(.+?)\s*->\s*(.+?)\s*$/i);
|
|
427
|
+
if (rename?.[1] && rename[2]) {
|
|
428
|
+
push(rename[1]);
|
|
429
|
+
push(rename[2]);
|
|
430
|
+
continue;
|
|
431
|
+
}
|
|
432
|
+
const header = line.match(/^\*\*\*\s*(?:Add|Update|Delete)\s+File:\s*(.+?)\s*$/i);
|
|
433
|
+
if (header?.[1]) {
|
|
434
|
+
push(header[1]);
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
const plus = line.match(/^\+\+\+\s+(?:[ab]\/)?(.+?)\s*$/);
|
|
438
|
+
if (plus?.[1] && plus[1] !== "/dev/null") {
|
|
439
|
+
push(plus[1]);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return found;
|
|
443
|
+
}
|
|
444
|
+
export function filePathsFromHermesEdit(payload) {
|
|
445
|
+
const input = parseToolInput(payload);
|
|
446
|
+
if (!input)
|
|
447
|
+
return [];
|
|
448
|
+
// Match Hermes patch_tool: union top-level path with V4A header paths
|
|
449
|
+
// (mode=patch may set both; preferring path alone would miss body files or
|
|
450
|
+
// arm only a plans/ path while product files live in the patch body).
|
|
451
|
+
const found = [];
|
|
452
|
+
const seen = new Set();
|
|
453
|
+
const push = (raw) => {
|
|
454
|
+
if (found.length >= MAX_HERMES_CHANGED_PATHS)
|
|
455
|
+
return;
|
|
456
|
+
const t = raw.trim();
|
|
457
|
+
if (!isSafeHermesPath(t) || seen.has(t))
|
|
458
|
+
return;
|
|
459
|
+
seen.add(t);
|
|
460
|
+
found.push(t);
|
|
461
|
+
};
|
|
462
|
+
for (const c of [
|
|
463
|
+
input.path,
|
|
464
|
+
input.file_path,
|
|
465
|
+
input.filePath,
|
|
466
|
+
input.target_file,
|
|
467
|
+
input.targetFile,
|
|
468
|
+
]) {
|
|
469
|
+
if (typeof c === "string")
|
|
470
|
+
push(c);
|
|
471
|
+
}
|
|
472
|
+
for (const key of ["patch", "command"]) {
|
|
473
|
+
const body = input[key];
|
|
474
|
+
if (typeof body === "string" && body.trim()) {
|
|
475
|
+
for (const p of pathsFromHermesPatchBody(body))
|
|
476
|
+
push(p);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
return found;
|
|
480
|
+
}
|
|
481
|
+
export function isHermesEditTool(toolName) {
|
|
482
|
+
const n = toolName.trim();
|
|
483
|
+
return n === "write_file" || n === "patch";
|
|
484
|
+
}
|
|
485
|
+
function stampHermesPlatform(store, conversationId, projectRoot) {
|
|
486
|
+
const session = store.getSession(conversationId);
|
|
487
|
+
if (!session || session.platform === HERMES_PLATFORM)
|
|
488
|
+
return;
|
|
489
|
+
store.upsertSession({
|
|
490
|
+
conversation_id: conversationId,
|
|
491
|
+
project_root: session.project_root || projectRoot,
|
|
492
|
+
code_root: session.code_root || projectRoot,
|
|
493
|
+
platform: HERMES_PLATFORM,
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
function gateContext(userMessage, fallback) {
|
|
497
|
+
return injectContext(blockReason(typeof userMessage === "string" ? userMessage : undefined, fallback));
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* pre_llm_call → core triggers / FSM.
|
|
501
|
+
* Inject `{ context }` for needPick / busy / hard errors (cannot discard prompt).
|
|
502
|
+
* Allow → `{}` (runner emits JSON `{}`).
|
|
503
|
+
*/
|
|
504
|
+
export function handlePreLlmCall(store, payload, projectRoot, portConfig) {
|
|
505
|
+
try {
|
|
506
|
+
return handlePreLlmCallInner(store, payload, projectRoot, portConfig);
|
|
507
|
+
}
|
|
508
|
+
catch {
|
|
509
|
+
return {};
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
export const handleHermesPreLlmCall = handlePreLlmCall;
|
|
513
|
+
/** @deprecated Alias for UPS-shaped call sites. */
|
|
514
|
+
export const handleUserPromptSubmit = handlePreLlmCall;
|
|
515
|
+
function handlePreLlmCallInner(store, payload, projectRoot, portConfig) {
|
|
516
|
+
const conversationId = sid(payload);
|
|
517
|
+
if (!conversationId)
|
|
518
|
+
return {};
|
|
519
|
+
const prompt = userMessageFromHermesSubmit(payload);
|
|
520
|
+
try {
|
|
521
|
+
store.clearPendingFollowupIf(conversationId, isRecoverOrStuckFollowupMessage);
|
|
522
|
+
}
|
|
523
|
+
catch {
|
|
524
|
+
/* best-effort */
|
|
525
|
+
}
|
|
526
|
+
const session = store.getSession(conversationId);
|
|
527
|
+
const hookCfg = loadProjectHookConfig(projectRoot);
|
|
528
|
+
const trigger = parseTrigger({
|
|
529
|
+
prompt,
|
|
530
|
+
conversationId,
|
|
531
|
+
projectRoot,
|
|
532
|
+
pendingAction: session?.pending_action,
|
|
533
|
+
triggers: hookCfg.triggers,
|
|
534
|
+
});
|
|
535
|
+
const actionConfig = {
|
|
536
|
+
...portConfig?.phaseActions,
|
|
537
|
+
plansDir: portConfig?.phaseActions?.plansDir ?? hookCfg.plansDir,
|
|
538
|
+
};
|
|
539
|
+
const gateFallback = "[Autopilot] Rejected this prompt. Check `npx autopilot-harness status`.";
|
|
540
|
+
if (trigger) {
|
|
541
|
+
if (trigger.kind === "off") {
|
|
542
|
+
applyOff(store, conversationId);
|
|
543
|
+
stampHermesPlatform(store, conversationId, projectRoot);
|
|
544
|
+
return {};
|
|
545
|
+
}
|
|
546
|
+
if (trigger.kind === "on") {
|
|
547
|
+
const result = applyOn(store, conversationId, projectRoot, {
|
|
548
|
+
initialBrief: trigger.initialBrief,
|
|
549
|
+
slug: trigger.slug,
|
|
550
|
+
platform: HERMES_PLATFORM,
|
|
551
|
+
});
|
|
552
|
+
stampHermesPlatform(store, conversationId, projectRoot);
|
|
553
|
+
if (!result.ok)
|
|
554
|
+
return gateContext(result.userMessage, gateFallback);
|
|
555
|
+
return {};
|
|
556
|
+
}
|
|
557
|
+
if (trigger.kind === "resume") {
|
|
558
|
+
const result = applyResume(store, conversationId, {
|
|
559
|
+
slug: trigger.slug,
|
|
560
|
+
});
|
|
561
|
+
stampHermesPlatform(store, conversationId, projectRoot);
|
|
562
|
+
if (!result.ok)
|
|
563
|
+
return gateContext(result.userMessage, gateFallback);
|
|
564
|
+
return {};
|
|
565
|
+
}
|
|
566
|
+
if (trigger.kind === "resume_review") {
|
|
567
|
+
applyResumeReview(store, conversationId);
|
|
568
|
+
stampHermesPlatform(store, conversationId, projectRoot);
|
|
569
|
+
return {};
|
|
570
|
+
}
|
|
571
|
+
if (trigger.kind === "run") {
|
|
572
|
+
const result = applyRun(store, conversationId, projectRoot, {
|
|
573
|
+
slug: trigger.slug,
|
|
574
|
+
config: actionConfig,
|
|
575
|
+
platform: HERMES_PLATFORM,
|
|
576
|
+
});
|
|
577
|
+
stampHermesPlatform(store, conversationId, projectRoot);
|
|
578
|
+
if (!result.ok) {
|
|
579
|
+
if (isChannelANeedPick(result)) {
|
|
580
|
+
return injectNeedPickContext(result.userMessage, result.candidates);
|
|
581
|
+
}
|
|
582
|
+
return gateContext(result.userMessage, gateFallback);
|
|
583
|
+
}
|
|
584
|
+
return {};
|
|
585
|
+
}
|
|
586
|
+
if (trigger.kind === "replan") {
|
|
587
|
+
const result = applyReplan(store, conversationId, projectRoot, {
|
|
588
|
+
slug: trigger.slug,
|
|
589
|
+
config: actionConfig,
|
|
590
|
+
platform: HERMES_PLATFORM,
|
|
591
|
+
});
|
|
592
|
+
stampHermesPlatform(store, conversationId, projectRoot);
|
|
593
|
+
if (!result.ok) {
|
|
594
|
+
if (isChannelANeedPick(result)) {
|
|
595
|
+
return injectNeedPickContext(result.userMessage, result.candidates);
|
|
596
|
+
}
|
|
597
|
+
return gateContext(result.userMessage, gateFallback);
|
|
598
|
+
}
|
|
599
|
+
return {};
|
|
600
|
+
}
|
|
601
|
+
if (trigger.kind === "track_pick" && trigger.trackPick) {
|
|
602
|
+
const result = applyTrackPick(store, conversationId, projectRoot, trigger.trackPick, { config: actionConfig, platform: HERMES_PLATFORM });
|
|
603
|
+
stampHermesPlatform(store, conversationId, projectRoot);
|
|
604
|
+
if (!result.ok) {
|
|
605
|
+
if (isChannelANeedPick(result)) {
|
|
606
|
+
return injectNeedPickContext(result.userMessage, result.candidates);
|
|
607
|
+
}
|
|
608
|
+
return gateContext(result.userMessage, gateFallback);
|
|
609
|
+
}
|
|
610
|
+
return {};
|
|
611
|
+
}
|
|
612
|
+
return {};
|
|
613
|
+
}
|
|
614
|
+
// pre_verify continue may re-enter as a synthetic user turn — harness-owned.
|
|
615
|
+
if (!isHarnessFollowupMessage(prompt)) {
|
|
616
|
+
store.clearChainPending(conversationId);
|
|
617
|
+
}
|
|
618
|
+
stampHermesPlatform(store, conversationId, projectRoot);
|
|
619
|
+
return {};
|
|
620
|
+
}
|
|
621
|
+
function armCodeEdited(store, conversationId, projectRoot) {
|
|
622
|
+
const cfg = loadProjectReviewConfig(projectRoot);
|
|
623
|
+
if (cfg.reviewScope === "project") {
|
|
624
|
+
ensureAmbientReviewSession(store, conversationId, projectRoot, cfg.reviewScope, HERMES_PLATFORM);
|
|
625
|
+
}
|
|
626
|
+
stampHermesPlatform(store, conversationId, projectRoot);
|
|
627
|
+
const session = store.getSession(conversationId);
|
|
628
|
+
const checklistPath = session?.checklist_path?.trim() ?? "";
|
|
629
|
+
let checklistSnap = null;
|
|
630
|
+
if (checklistPath) {
|
|
631
|
+
try {
|
|
632
|
+
checklistSnap = parseChecklist(checklistPath, { projectRoot });
|
|
633
|
+
}
|
|
634
|
+
catch {
|
|
635
|
+
/* still arm */
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
store.markCodeEdited(conversationId, (chain) => {
|
|
639
|
+
const fromPending = parseAdvanceNextItemId(chain.pending_followup);
|
|
640
|
+
if (checklistSnap) {
|
|
641
|
+
if (fromPending && effectiveReviewingItemId(checklistSnap, fromPending)) {
|
|
642
|
+
return fromPending;
|
|
643
|
+
}
|
|
644
|
+
return firstUnchecked(checklistSnap)?.id ?? null;
|
|
645
|
+
}
|
|
646
|
+
return fromPending;
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
function armPaths(store, conversationId, projectRoot, filePaths) {
|
|
650
|
+
if (filePaths.length === 0) {
|
|
651
|
+
stampHermesPlatform(store, conversationId, projectRoot);
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
let plansDir;
|
|
655
|
+
try {
|
|
656
|
+
plansDir = loadProjectHookConfig(projectRoot).plansDir;
|
|
657
|
+
}
|
|
658
|
+
catch {
|
|
659
|
+
plansDir = undefined;
|
|
660
|
+
}
|
|
661
|
+
let armed = false;
|
|
662
|
+
for (const filePath of filePaths) {
|
|
663
|
+
try {
|
|
664
|
+
notePlansDirEdit(store, conversationId, projectRoot, filePath, plansDir);
|
|
665
|
+
}
|
|
666
|
+
catch {
|
|
667
|
+
/* best-effort */
|
|
668
|
+
}
|
|
669
|
+
if (!isProductCodeEdit(filePath, { projectRoot }))
|
|
670
|
+
continue;
|
|
671
|
+
if (!armed) {
|
|
672
|
+
armCodeEdited(store, conversationId, projectRoot);
|
|
673
|
+
armed = true;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
if (!armed) {
|
|
677
|
+
stampHermesPlatform(store, conversationId, projectRoot);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* post_tool_call → markCodeEdited for write_file / patch.
|
|
682
|
+
* Observer only — never block.
|
|
683
|
+
*/
|
|
684
|
+
export function handlePostToolCall(store, payload, projectRoot) {
|
|
685
|
+
try {
|
|
686
|
+
handlePostToolCallInner(store, payload, projectRoot);
|
|
687
|
+
}
|
|
688
|
+
catch {
|
|
689
|
+
/* fail-open */
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
export const handleHermesPostToolCall = handlePostToolCall;
|
|
693
|
+
/** @deprecated Alias for PostToolUse-shaped call sites. */
|
|
694
|
+
export const handlePostToolUse = handlePostToolCall;
|
|
695
|
+
function handlePostToolCallInner(store, payload, projectRoot) {
|
|
696
|
+
const conversationId = sid(payload);
|
|
697
|
+
const toolName = String(payload.tool_name ?? payload.toolName ?? "").trim();
|
|
698
|
+
if (!conversationId || !isHermesEditTool(toolName))
|
|
699
|
+
return;
|
|
700
|
+
armPaths(store, conversationId, projectRoot, filePathsFromHermesEdit(payload));
|
|
701
|
+
}
|
|
702
|
+
export function collectHermesErrorText(payload) {
|
|
703
|
+
const extra = extraOf(payload);
|
|
704
|
+
const parts = [];
|
|
705
|
+
const push = (value) => {
|
|
706
|
+
if (typeof value === "string" && value.trim())
|
|
707
|
+
parts.push(value);
|
|
708
|
+
};
|
|
709
|
+
push(extra.error);
|
|
710
|
+
push(extra.error_message);
|
|
711
|
+
push(extra.message);
|
|
712
|
+
return clipText(parts.join("\n"));
|
|
713
|
+
}
|
|
714
|
+
export function normalizeHermesStopStatus(payload, opts) {
|
|
715
|
+
if (opts?.status === "aborted")
|
|
716
|
+
return "aborted";
|
|
717
|
+
if (opts?.status === "error") {
|
|
718
|
+
const errText = collectHermesErrorText(payload);
|
|
719
|
+
if (isUserAbortText(errText))
|
|
720
|
+
return "aborted";
|
|
721
|
+
return "error";
|
|
722
|
+
}
|
|
723
|
+
const errText = collectHermesErrorText(payload);
|
|
724
|
+
if (isUserAbortText(errText))
|
|
725
|
+
return "aborted";
|
|
726
|
+
return opts?.status ?? "completed";
|
|
727
|
+
}
|
|
728
|
+
/**
|
|
729
|
+
* pre_verify → ReviewEngine.
|
|
730
|
+
* Continue: `{ decision:"block", reason }` (Claude Stop; shell maps to continue).
|
|
731
|
+
* Hard-stop / no followup: `{}`.
|
|
732
|
+
* Also arms from `changed_paths` (Post matcher backup).
|
|
733
|
+
*/
|
|
734
|
+
export function handlePreVerify(engine, store, payload, projectRoot, opts) {
|
|
735
|
+
try {
|
|
736
|
+
return handlePreVerifyInner(engine, store, payload, projectRoot, opts);
|
|
737
|
+
}
|
|
738
|
+
catch {
|
|
739
|
+
return {};
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
export const handleHermesPreVerify = handlePreVerify;
|
|
743
|
+
function handlePreVerifyInner(engine, store, payload, projectRoot, opts) {
|
|
744
|
+
const conversationId = sid(payload);
|
|
745
|
+
if (!conversationId)
|
|
746
|
+
return {};
|
|
747
|
+
// Backup dirty-arm from host-reported changed_paths.
|
|
748
|
+
try {
|
|
749
|
+
armPaths(store, conversationId, projectRoot, changedPathsFromHermesPreVerify(payload));
|
|
750
|
+
}
|
|
751
|
+
catch {
|
|
752
|
+
/* best-effort */
|
|
753
|
+
}
|
|
754
|
+
const status = normalizeHermesStopStatus(payload, opts);
|
|
755
|
+
const action = engine.handleStop({
|
|
756
|
+
conversationId,
|
|
757
|
+
status,
|
|
758
|
+
loopCount: loopCountFromHermesAttempt(payload),
|
|
759
|
+
platform: HERMES_PLATFORM,
|
|
760
|
+
});
|
|
761
|
+
if (!action?.message)
|
|
762
|
+
return {};
|
|
763
|
+
// Hard-stop (stuck / deliver-once): Hermes pre_verify has no stopReason channel —
|
|
764
|
+
// return {} so the turn finishes; ReviewEngine keeps pending_followup for RESUME/nudge.
|
|
765
|
+
if (!action.loop)
|
|
766
|
+
return {};
|
|
767
|
+
return {
|
|
768
|
+
decision: "block",
|
|
769
|
+
reason: clipText(blockReason(action.message, "Autopilot followup"), MAX_HOOK_STDIO_CHARS),
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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ACjB,MAAM,EAAE,QAAQ,CACd,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,oBAAoB,CAAC,EACjD,oBAAoB,CACrB;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@autopilot-harness/port-hermes-agent",
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"description": "Autopilot harness host port for Hermes Agent shell hooks (pre_llm_call context inject; post_tool_call dirty-arm; pre_verify decision:block+reason; soft min Hermes ≥0.21.3)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/mt2007/autopilot-harness.git",
|
|
9
|
+
"directory": "packages/ports/hermes-agent"
|
|
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.9.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
|
+
"hermes",
|
|
47
|
+
"hermes-agent",
|
|
48
|
+
"checklist",
|
|
49
|
+
"code-review"
|
|
50
|
+
],
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsc -p tsconfig.json",
|
|
53
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
54
|
+
}
|
|
55
|
+
}
|