@dungle-scrubs/harness-cli-normalizer 0.4.1 → 0.4.3
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/README.md +30 -3
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +8 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +4 -1
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/exit-codes.js +1 -1
- package/dist/cli/exit-codes.js.map +1 -1
- package/dist/cli/help.d.ts +3 -3
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +27 -5
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/render.d.ts.map +1 -1
- package/dist/cli/render.js +15 -1
- package/dist/cli/render.js.map +1 -1
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +49 -15
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/session.d.ts.map +1 -1
- package/dist/cli/session.js +107 -9
- package/dist/cli/session.js.map +1 -1
- package/dist/execution/events.d.ts +12 -1
- package/dist/execution/events.d.ts.map +1 -1
- package/dist/execution/events.js.map +1 -1
- package/dist/execution/failure.d.ts.map +1 -1
- package/dist/execution/failure.js.map +1 -1
- package/dist/execution/open-session.d.ts +5 -0
- package/dist/execution/open-session.d.ts.map +1 -1
- package/dist/execution/open-session.js +136 -4
- package/dist/execution/open-session.js.map +1 -1
- package/dist/execution/stream-turn.d.ts +7 -0
- package/dist/execution/stream-turn.d.ts.map +1 -1
- package/dist/execution/stream-turn.js +67 -13
- package/dist/execution/stream-turn.js.map +1 -1
- package/dist/interpretation/argv.d.ts +5 -0
- package/dist/interpretation/argv.d.ts.map +1 -1
- package/dist/interpretation/argv.js +4 -3
- package/dist/interpretation/argv.js.map +1 -1
- package/dist/interpretation/presence.d.ts.map +1 -1
- package/dist/interpretation/presence.js +3 -1
- package/dist/interpretation/presence.js.map +1 -1
- package/dist/interpretation/question.d.ts +54 -0
- package/dist/interpretation/question.d.ts.map +1 -0
- package/dist/interpretation/question.js +126 -0
- package/dist/interpretation/question.js.map +1 -0
- package/dist/interpretation/session-input.d.ts.map +1 -1
- package/dist/interpretation/session-input.js +5 -0
- package/dist/interpretation/session-input.js.map +1 -1
- package/dist/knowledge/claude-code.d.ts.map +1 -1
- package/dist/knowledge/claude-code.js +2 -0
- package/dist/knowledge/claude-code.js.map +1 -1
- package/dist/knowledge/descriptor.d.ts +16 -3
- package/dist/knowledge/descriptor.d.ts.map +1 -1
- package/dist/knowledge/descriptor.js +1 -1
- package/dist/knowledge/descriptor.js.map +1 -1
- package/dist/knowledge/pi.d.ts.map +1 -1
- package/dist/knowledge/pi.js +21 -7
- package/dist/knowledge/pi.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/args.ts +6 -0
- package/src/cli/config.ts +4 -1
- package/src/cli/exit-codes.ts +1 -1
- package/src/cli/help.ts +27 -5
- package/src/cli/render.ts +16 -1
- package/src/cli/run.ts +54 -19
- package/src/cli/session.ts +113 -11
- package/src/execution/events.ts +19 -1
- package/src/execution/failure.ts +1 -6
- package/src/execution/open-session.ts +146 -4
- package/src/execution/stream-turn.ts +74 -13
- package/src/interpretation/argv.ts +9 -3
- package/src/interpretation/presence.ts +3 -1
- package/src/interpretation/question.ts +158 -0
- package/src/interpretation/session-input.ts +5 -0
- package/src/knowledge/claude-code.ts +2 -0
- package/src/knowledge/descriptor.ts +14 -3
- package/src/knowledge/pi.ts +21 -7
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Question escalation (issue #41): the protocol that lets a headless
|
|
3
|
+
* worker ask the CALLER's user a question. Transport is the prompt - no
|
|
4
|
+
* harness ships native question conveyance - so hcn prepends a protocol
|
|
5
|
+
* contract (escalateQuestions true, the default) or the state-the-
|
|
6
|
+
* assumption instruction (false). The worker's final message then carries
|
|
7
|
+
* a fenced `hcn-question` block; detection is structured-first (fields
|
|
8
|
+
* parsed from the block, prose rendered downstream from them).
|
|
9
|
+
*
|
|
10
|
+
* Ratified design note (2026-08-19): autonomy and escalateQuestions are
|
|
11
|
+
* independent flags carving the same substrate by ORIGIN - autonomy =
|
|
12
|
+
* interrupts the harness raises (permission gates), escalateQuestions =
|
|
13
|
+
* interrupts the model raises (judgment gaps). The true-mode preamble
|
|
14
|
+
* must therefore never conflate asking with permission: "you may ask" is
|
|
15
|
+
* never "you lack permission." Both preambles open with the same marker
|
|
16
|
+
* so composition is idempotent (a composed prompt is never re-composed).
|
|
17
|
+
*/
|
|
18
|
+
/** The shared first line of both preambles - also the idempotence marker
|
|
19
|
+
* for composeEscalatedPrompt. */
|
|
20
|
+
export const QUESTION_PREAMBLE_MARKER = "[hcn question protocol]";
|
|
21
|
+
export const ESCALATION_PREAMBLE = `${QUESTION_PREAMBLE_MARKER}
|
|
22
|
+
You are running headless: no one is watching this session live, but a caller relays answers between turns. This protocol never changes your permissions - asking is not how you obtain permission, and it never removes any permission this run already has. Use the tools you have exactly as granted.
|
|
23
|
+
If and only if a genuine decision you cannot make defensibly blocks correct progress, ask by ending your turn: emit one fenced code block tagged hcn-question, as the last content of your final message, containing a single JSON object:
|
|
24
|
+
|
|
25
|
+
\`\`\`hcn-question
|
|
26
|
+
{"question": "<the decision you need made>", "options": ["<option 1>", "<option 2>"], "recommended": "<one of options>"}
|
|
27
|
+
\`\`\`
|
|
28
|
+
|
|
29
|
+
Say nothing after the block. Your turn ends there; the caller's user will answer, and your next turn continues from that answer. For every choice you can make defensibly yourself, do not ask - decide, act, and state the decision you made.`;
|
|
30
|
+
export const NO_ESCALATION_PREAMBLE = `${QUESTION_PREAMBLE_MARKER}
|
|
31
|
+
You are running headless and no one will answer you in this session. Never ask a question, never request input or confirmation, and never end your turn awaiting a reply. When a decision is ambiguous, pick the most defensible reading, state the assumption you proceeded under in one sentence, and continue to completion.`;
|
|
32
|
+
/** Session-mode variant (issue #44): the worker lives in ONE persistent
|
|
33
|
+
* session with a live stdin - the ask stops generation but the session
|
|
34
|
+
* stays open, and the answer arrives as the next user message on the
|
|
35
|
+
* same session. No exit, no resume. */
|
|
36
|
+
export const SESSION_ESCALATION_PREAMBLE = `${QUESTION_PREAMBLE_MARKER}
|
|
37
|
+
You are running in a persistent session: no one is watching live, but the caller relays answers back into this same session. This protocol never changes your permissions - asking is not how you obtain permission, and it never removes any permission this run already has. Use the tools you have exactly as granted.
|
|
38
|
+
If and only if a genuine decision you cannot make defensibly blocks correct progress, ask by stopping: emit one fenced code block tagged hcn-question, as the last content of your reply, containing a single JSON object:
|
|
39
|
+
|
|
40
|
+
\`\`\`hcn-question
|
|
41
|
+
{"question": "<the decision you need made>", "options": ["<option 1>", "<option 2>"], "recommended": "<one of options>"}
|
|
42
|
+
\`\`\`
|
|
43
|
+
|
|
44
|
+
Say nothing after the block and stop generating. The caller's user will answer, and the answer arrives as the next user message in this session - continue from it. For every choice you can make defensibly yourself, do not ask - decide, act, and state the decision you made.`;
|
|
45
|
+
/** Compose the transport preamble onto a prompt. `mode` selects the
|
|
46
|
+
* contract wording: "turn" (exit-and-resume transport, hcn run) or
|
|
47
|
+
* "session" (live channel, hcn session). Idempotent: a prompt that
|
|
48
|
+
* already carries any preamble passes through unchanged - a turn-mode
|
|
49
|
+
* preamble is never re-composed into a session one (the marker matches
|
|
50
|
+
* both; the already-composed contract stands). */
|
|
51
|
+
export const composeEscalatedPrompt = (prompt, escalate, mode = "turn") => prompt.startsWith(QUESTION_PREAMBLE_MARKER)
|
|
52
|
+
? prompt
|
|
53
|
+
: `${mode === "session" && escalate ? SESSION_ESCALATION_PREAMBLE : escalate ? ESCALATION_PREAMBLE : NO_ESCALATION_PREAMBLE}\n\n${prompt}`;
|
|
54
|
+
const FENCE_OPEN = /(?:^|\n)[ \t]*```[ \t]*hcn-question[ \t]*(?=\n)/g;
|
|
55
|
+
/** All hcn-question fence bodies in a text, in order. */
|
|
56
|
+
const fenceBodies = (text) => {
|
|
57
|
+
const out = [];
|
|
58
|
+
FENCE_OPEN.lastIndex = 0;
|
|
59
|
+
for (let m = FENCE_OPEN.exec(text); m !== null; m = FENCE_OPEN.exec(text)) {
|
|
60
|
+
const bodyStart = m.index + m[0].length;
|
|
61
|
+
// The closing fence may be indented like the opener (probe evidence:
|
|
62
|
+
// indented blocks occur), so match newline + optional spaces + ```.
|
|
63
|
+
const close = text.slice(bodyStart).search(/\n[ \t]*```/);
|
|
64
|
+
if (close === -1) {
|
|
65
|
+
// Unclosed fence: the body runs to end-of-text. Only meaningful
|
|
66
|
+
// when nothing follows the opener - take it as a candidate anyway.
|
|
67
|
+
out.push({ body: text.slice(bodyStart), closed: false });
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
const bodyEnd = bodyStart + close;
|
|
71
|
+
out.push({ body: text.slice(bodyStart, bodyEnd), closed: true });
|
|
72
|
+
FENCE_OPEN.lastIndex = bodyEnd;
|
|
73
|
+
}
|
|
74
|
+
return out;
|
|
75
|
+
};
|
|
76
|
+
const parseBlock = (body) => {
|
|
77
|
+
let raw;
|
|
78
|
+
try {
|
|
79
|
+
raw = JSON.parse(body);
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
return { malformed: `hcn-question block is not valid JSON: ${e.message}` };
|
|
83
|
+
}
|
|
84
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
85
|
+
return { malformed: "hcn-question block must be a JSON object" };
|
|
86
|
+
}
|
|
87
|
+
const obj = raw;
|
|
88
|
+
const { question, options, recommended } = obj;
|
|
89
|
+
if (typeof question !== "string" || question.trim() === "") {
|
|
90
|
+
return { malformed: 'hcn-question block field "question" must be a non-empty string' };
|
|
91
|
+
}
|
|
92
|
+
if (!Array.isArray(options) ||
|
|
93
|
+
options.length === 0 ||
|
|
94
|
+
options.some((o) => typeof o !== "string" || o.trim() === "")) {
|
|
95
|
+
return {
|
|
96
|
+
malformed: 'hcn-question block field "options" must be an array of non-empty strings',
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (recommended !== undefined && typeof recommended !== "string") {
|
|
100
|
+
return { malformed: 'hcn-question block field "recommended" must be a string' };
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
block: {
|
|
104
|
+
question,
|
|
105
|
+
options,
|
|
106
|
+
...(recommended !== undefined ? { recommended } : {}),
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
/** Detect the hcn-question block in a message text. The LAST block wins
|
|
111
|
+
* (the protocol makes the block the turn's final content; a corrected
|
|
112
|
+
* re-emit supersedes an earlier one). An empty candidate body (a bare
|
|
113
|
+
* unclosed opener with nothing after it) is not a detection. */
|
|
114
|
+
export const detectQuestionBlock = (text) => {
|
|
115
|
+
const candidates = fenceBodies(text);
|
|
116
|
+
for (let i = candidates.length - 1; i >= 0; i--) {
|
|
117
|
+
const candidate = candidates[i];
|
|
118
|
+
if (candidate === undefined)
|
|
119
|
+
continue;
|
|
120
|
+
if (candidate.body.trim() === "")
|
|
121
|
+
continue;
|
|
122
|
+
return parseBlock(candidate.body);
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=question.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.js","sourceRoot":"","sources":["../../src/interpretation/question.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;iCACiC;AACjC,MAAM,CAAC,MAAM,wBAAwB,GAAG,yBAAyB,CAAC;AAElE,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,wBAAwB;;;;;;;;+OAQiL,CAAC;AAEhP,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,wBAAwB;gUAC+P,CAAC;AAEjU;;;uCAGuC;AACvC,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,wBAAwB;;;;;;;;kRAQ4M,CAAC;AAEnR;;;;;kDAKkD;AAClD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,MAAc,EACd,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W,oBAAoB,QAAQ,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"session-input.d.ts","sourceRoot":"","sources":["../../src/interpretation/session-input.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EAErB,MAAM,4BAA4B,CAAC;AAIpC,MAAM,MAAM,iBAAiB,GAAG,gCAAgC,GAAG,gCAAgC,CAAC;AAEpG,qBAAa,wBAAyB,SAAQ,KAAK;IACrC,QAAQ,CAAC,KAAK,EAAE,iBAAiB;IAA7C,YAAqB,KAAK,EAAE,iBAAiB,EAG5C;CACF;AAKD,eAAO,MAAM,mBAAmB,YAAa,iBAAiB,KAAG,oBAUhE,CAAC;AAEF,eAAO,MAAM,kBAAkB,UAAW,oBAAoB,QAAQ,MAAM,KAAG,MAa9E,CAAC"}
|
|
@@ -27,6 +27,11 @@ export const encodeSessionInput = (input, text) => {
|
|
|
27
27
|
type: "user",
|
|
28
28
|
message: { role: "user", content: [{ type: "text", text }] },
|
|
29
29
|
})}\n`;
|
|
30
|
+
case "pi-rpc-prompt":
|
|
31
|
+
// Verified against pi 0.84.2 rpc (spike fixtures): a prompt command
|
|
32
|
+
// while idle; hcn never writes mid-run (it queues sends itself), so
|
|
33
|
+
// no streamingBehavior field is ever needed.
|
|
34
|
+
return `${JSON.stringify({ id: "hcn-send", type: "prompt", message: text })}\n`;
|
|
30
35
|
}
|
|
31
36
|
};
|
|
32
37
|
//# sourceMappingURL=session-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-input.js","sourceRoot":"","sources":["../../src/interpretation/session-input.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAC5B,KAAK;IAA1B,YAAqB,KAAwB;QAC3C,KAAK,CAAC,0BAA0B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AO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE;aAC7D,CAAC,IAAI,CAAC;QACT,KAAK,eAAe;YAClB,oEAAoE;YACpE,oEAAoE;YACpE,6CAA6C;YAC7C,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC;IACpF,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../src/knowledge/claude-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAc,KAAK,iBAAiB,EAAc,MAAM,iBAAiB,CAAC;AAGjF,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../src/knowledge/claude-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAc,KAAK,iBAAiB,EAAc,MAAM,iBAAiB,CAAC;AAGjF,eAAO,MAAM,UAAU,EAAE,iBAyKvB,CAAC"}
|
|
@@ -60,6 +60,8 @@ export const claudeCode = deepFreeze({
|
|
|
60
60
|
],
|
|
61
61
|
idFlag: "--session-id",
|
|
62
62
|
input: { kind: "claude-sdk-user-message" },
|
|
63
|
+
turnEnd: { type: "result" },
|
|
64
|
+
identityProbe: null,
|
|
63
65
|
},
|
|
64
66
|
output: {
|
|
65
67
|
// --output-format/--include-partial-messages only work with --print, so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../src/knowledge/claude-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,UAAU,EAA0B,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE5E,MAAM,CAAC,MAAM,UAAU,GAAsB,UAAU,CAAC;IACtD,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE,QAAQ;IACb,eAAe,EAAE,SAAS;IAC1B,aAAa,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,2BAA2B,EAAE;IACpE,MAAM,EAAE;QACN,SAAS,EAAE,CAAC,IAAI,CAAC;QACjB,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,YAAY;QACzB,SAAS,EAAE,gBAAgB;QAC3B,uEAAuE;QACvE,qEAAqE;QACrE,wEAAwE;QACxE,WAAW,EAAE,CAAC,iBAAiB,EAAE,aAAa,EAAE,WAAW,EAAE,4BAA4B,CAAC;QAC1F,MAAM,EAAE,cAAc;KACvB;IACD,MAAM,EAAE;QACN,wEAAwE;QACxE,yEAAyE;QACzE,wEAAwE;QACxE,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,CAAC,IAAI,CAAC;QACf,OAAO,EAAE,UAAU;QACnB,SAAS,EAAE,OAAO;QAClB,UAAU,EAAE,CAAC,IAAI,CAAC;KACnB;IACD,WAAW,EAAE;QACX,0EAA0E;QAC1E,sEAAsE;QACtE,kEAAkE;QAClE,KAAK,EAAE;YACL,gBAAgB;YAChB,aAAa;YACb,iBAAiB;YACjB,aAAa;YACb,4BAA4B;YAC5B,WAAW;YACX,mBAAmB;YACnB,SAAS;SACV;QACD,MAAM,EAAE,cAAc;QACtB,KAAK,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE;
|
|
1
|
+
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../src/knowledge/claude-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,UAAU,EAA0B,UAAU,EAAE,MAAM,i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: T) => T;
|
|
19
19
|
export type StreamingGranularity = "token" | "message" | "none";
|
|
20
20
|
export type HarnessMode = "headless-turn" | "headless-session" | "interactive";
|
|
21
|
-
export declare const SESSION_INPUT_KINDS: readonly ["claude-sdk-user-message"];
|
|
21
|
+
export declare const SESSION_INPUT_KINDS: readonly ["claude-sdk-user-message", "pi-rpc-prompt"];
|
|
22
22
|
export type SessionInputKind = (typeof SESSION_INPUT_KINDS)[number];
|
|
23
23
|
export interface SessionInputContract {
|
|
24
24
|
readonly kind: SessionInputKind;
|
|
@@ -208,11 +208,24 @@ export interface HarnessDescriptor {
|
|
|
208
208
|
};
|
|
209
209
|
/** Persistent headless session support: the exact flag set that opens one
|
|
210
210
|
* lucid-owned process serving many turns, or null when the harness has no
|
|
211
|
-
* such mode. `idFlag` pins the caller-assigned session identity.
|
|
211
|
+
* such mode. `idFlag` pins the caller-assigned session identity.
|
|
212
|
+
* `turnEnd` is the stdout record that delimits one turn (claude: the
|
|
213
|
+
* `result` record; pi rpc: `agent_settled`). `identityProbe`, when
|
|
214
|
+
* present, names a command the runner writes at spawn whose response
|
|
215
|
+
* carries the session id - pi rpc is identity-silent at startup (spike
|
|
216
|
+
* evidence: test/fixtures/pi-rpc-spike), so identity needs a round trip. */
|
|
212
217
|
readonly sessionMode: {
|
|
213
218
|
readonly flags: readonly string[];
|
|
214
|
-
|
|
219
|
+
/** Pin an EXISTING session id; null when the harness only accepts
|
|
220
|
+
* caller ids that already exist (pi rpc: `--session` refuses unknown
|
|
221
|
+
* ids - spike evidence), so fresh sessions omit the flag and the
|
|
222
|
+
* harness mints the id, readable via `identityProbe`. */
|
|
223
|
+
readonly idFlag: string | null;
|
|
215
224
|
readonly input: SessionInputContract;
|
|
225
|
+
readonly turnEnd: Readonly<Record<string, string>>;
|
|
226
|
+
readonly identityProbe: {
|
|
227
|
+
readonly command: string;
|
|
228
|
+
} | null;
|
|
216
229
|
} | null;
|
|
217
230
|
/** Streaming is a property of the INVOCATION, not the harness: each pin
|
|
218
231
|
* names the flag set that unlocks a granularity, checked in order, first
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor.d.ts","sourceRoot":"","sources":["../../src/knowledge/descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,eAAO,MAAM,aAAa,YAAI,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAU,CAAC;AACxE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;mCAEmC;AACnC,uEAAuE;AACvE,eAAO,MAAM,UAAU,QAAoE,CAAC;AAE5F,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,CAAC,KAAG,CAMxC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhE,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,kBAAkB,GAAG,aAAa,CAAC;AAE/E,eAAO,MAAM,mBAAmB,YAAI,yBAAyB,CAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"descriptor.d.ts","sourceRoot":"","sources":["../../src/knowledge/descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,eAAO,MAAM,aAAa,YAAI,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAU,CAAC;AACxE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;mCAEmC;AACnC,uEAAuE;AACvE,eAAO,MAAM,UAAU,QAAoE,CAAC;AAE5F,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,CAAC,KAAG,CAMxC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhE,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,kBAAkB,GAAG,aAAa,CAAC;AAE/E,eAAO,MAAM,mBAAm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AAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QACpC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QACpC,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAC;QAC3C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;QAC7B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;YAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YACtB,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;SAClC,CAAC,CAAC;QACH,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;YACjC,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,YAAY,CAAC;YAChE,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;YACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;SACnC,CAAC,CAAC;QACH,QAAQ,CAAC,aAAa,EAAE,iBAAiB,GAAG,aAAa,GAAG,UAAU,CAAC;KACxE,CAAC;CACH"}
|
|
@@ -22,7 +22,7 @@ export const deepFreeze = (value) => {
|
|
|
22
22
|
}
|
|
23
23
|
return value;
|
|
24
24
|
};
|
|
25
|
-
export const SESSION_INPUT_KINDS = ["claude-sdk-user-message"];
|
|
25
|
+
export const SESSION_INPUT_KINDS = ["claude-sdk-user-message", "pi-rpc-prompt"];
|
|
26
26
|
/** The turn-option vocabulary is closed for the same reason `LimitCode` is:
|
|
27
27
|
* a descriptor must not invent an option a consumer has no field for. Every
|
|
28
28
|
* key here maps to a field on `TurnOptions`; adding a key without a consumer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor.js","sourceRoot":"","sources":["../../src/knowledge/descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,IAA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owledge/pi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAc,KAAK,iBAAiB,EAAc,MAAM,iBAAiB,CAAC;AAGjF,eAAO,MAAM,KAAK,EAAE,iBAiJlB,CAAC"}
|
package/dist/knowledge/pi.js
CHANGED
|
@@ -36,11 +36,23 @@ export const piCli = deepFreeze({
|
|
|
36
36
|
onMissing: "create",
|
|
37
37
|
extraFlags: ["-p", "--mode", "json"],
|
|
38
38
|
},
|
|
39
|
-
// --mode rpc exists on 0.84.2
|
|
40
|
-
// against a live run
|
|
41
|
-
// spike
|
|
42
|
-
//
|
|
43
|
-
|
|
39
|
+
// --mode rpc exists on 0.84.2 and its session semantics are now VERIFIED
|
|
40
|
+
// against a live run (2026-08-19 spike, evidence at
|
|
41
|
+
// test/fixtures/pi-rpc-spike): JSONL both directions, agent_settled
|
|
42
|
+
// delimits turns, steer/follow_up queue mid-run (hcn never needs them -
|
|
43
|
+
// it queues sends itself), identity is silent at startup and readable
|
|
44
|
+
// only via a get_state round trip, stdin EOF exits rc=0. The claude
|
|
45
|
+
// slice remains the proven vertical (D-003); this entry is the second.
|
|
46
|
+
sessionMode: {
|
|
47
|
+
flags: ["--mode", "rpc"],
|
|
48
|
+
// `--session <id>` requires an EXISTING id ("No session found" on a
|
|
49
|
+
// fresh uuid - live-verified); fresh sessions omit it and pi mints
|
|
50
|
+
// the id, readable only through the get_state probe.
|
|
51
|
+
idFlag: null,
|
|
52
|
+
input: { kind: "pi-rpc-prompt" },
|
|
53
|
+
turnEnd: { type: "agent_settled" },
|
|
54
|
+
identityProbe: { command: "get_state" },
|
|
55
|
+
},
|
|
44
56
|
output: {
|
|
45
57
|
// pi -p prints plain text; --mode json emits structured v3 records
|
|
46
58
|
// INCLUDING assistantMessageEvent text_delta tokens (verified 0.84.2),
|
|
@@ -87,10 +99,12 @@ export const piCli = deepFreeze({
|
|
|
87
99
|
images: false,
|
|
88
100
|
streamingByMode: {
|
|
89
101
|
"headless-turn": "token",
|
|
90
|
-
|
|
102
|
+
// rpc mode streams the same assistantMessageEvent deltas json mode
|
|
103
|
+
// does (spike fixture 02: text/thinking deltas under message_update).
|
|
104
|
+
"headless-session": "token",
|
|
91
105
|
interactive: "none",
|
|
92
106
|
},
|
|
93
|
-
session:
|
|
107
|
+
session: true,
|
|
94
108
|
},
|
|
95
109
|
turnOptions: {
|
|
96
110
|
effort: { kind: "effort", render: { kind: "flag-value", flag: "--thinking" } },
|
package/dist/knowledge/pi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi.js","sourceRoot":"","sources":["../../src/knowledge/pi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAA0B,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE5E,MAAM,CAAC,MAAM,KAAK,GAAsB,UAAU,CAAC;IACjD,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,IAAI;IACT,eAAe,EAAE,QAAQ;IACzB,aAAa,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,iCAAiC,EAAE;IAC1E,MAAM,EAAE;QACN,mEAAmE;QACnE,oEAAoE;QACpE,oEAAoE;QACpE,yDAAyD;QACzD,SAAS,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC;QACnC,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,YAAY;QACzB,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,cAAc;KACvB;IACD,MAAM,EAAE;QACN,uEAAuE;QACvE,qEAAqE;QACrE,yDAAyD;QACzD,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,UAAU;QACnB,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,CAAC,IAAI,EAAE,QAAQ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ACtB,WAAW,EAAE,iBAAiB;QAC9B,wBAAwB,EAAE,IAAI;QAC9B,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE;YACR,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE;YACtC,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE;YACtC,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE;YACtC,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE;YACvC,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE;YACvC,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE;YACvC,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE;SACtC;QACD,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,iBAAiB;KACjC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/cli/args.ts
CHANGED
|
@@ -179,6 +179,8 @@ export const parseTurnOptions = (values: Record<string, unknown>): TurnOptions =
|
|
|
179
179
|
else if (values["no-write"] === true) opts.write = false;
|
|
180
180
|
if (values.shell === true) opts.shell = true;
|
|
181
181
|
else if (values["no-shell"] === true) opts.shell = false;
|
|
182
|
+
if (values["escalate-questions"] === true) opts.escalateQuestions = true;
|
|
183
|
+
else if (values["no-escalate-questions"] === true) opts.escalateQuestions = false;
|
|
182
184
|
|
|
183
185
|
if (values["max-steps"] !== undefined) {
|
|
184
186
|
const n = Number(values["max-steps"]);
|
|
@@ -277,6 +279,8 @@ const KNOWN_FLAGS = new Set([
|
|
|
277
279
|
"--no-write",
|
|
278
280
|
"--shell",
|
|
279
281
|
"--no-shell",
|
|
282
|
+
"--escalate-questions",
|
|
283
|
+
"--no-escalate-questions",
|
|
280
284
|
"--max-steps",
|
|
281
285
|
"--no-tools",
|
|
282
286
|
"--no-instruction-files",
|
|
@@ -421,6 +425,8 @@ export const parseCommonFlags = (
|
|
|
421
425
|
"no-write": { type: "boolean" as const },
|
|
422
426
|
shell: { type: "boolean" as const },
|
|
423
427
|
"no-shell": { type: "boolean" as const },
|
|
428
|
+
"escalate-questions": { type: "boolean" as const },
|
|
429
|
+
"no-escalate-questions": { type: "boolean" as const },
|
|
424
430
|
"max-steps": { type: "string" as const },
|
|
425
431
|
"no-tools": { type: "boolean" as const },
|
|
426
432
|
"no-instruction-files": { type: "boolean" as const },
|
package/src/cli/config.ts
CHANGED
|
@@ -66,10 +66,13 @@ const KNOWN_KEYS = new Set([
|
|
|
66
66
|
"maxSteps",
|
|
67
67
|
"toolsets",
|
|
68
68
|
"timeout",
|
|
69
|
+
// issue #41: question escalation (behavior instruction, not a turn
|
|
70
|
+
// option - it rides the prompt preamble, never a harness flag).
|
|
71
|
+
"escalateQuestions",
|
|
69
72
|
]);
|
|
70
73
|
|
|
71
74
|
const LIST_KEYS = new Set(["tools", "excludeTools"]);
|
|
72
|
-
const BOOL_KEYS = new Set(["autonomy", "write", "shell"]);
|
|
75
|
+
const BOOL_KEYS = new Set(["autonomy", "write", "shell", "escalateQuestions"]);
|
|
73
76
|
|
|
74
77
|
/** Parse + validate config text. Throws ConfigError with the offending key
|
|
75
78
|
* named on any violation - never warns and continues. */
|
package/src/cli/exit-codes.ts
CHANGED
|
@@ -5,7 +5,7 @@ export const EXIT_REFUSAL = 2;
|
|
|
5
5
|
export const EXIT_FAILURE = 1;
|
|
6
6
|
|
|
7
7
|
export const exitCodeForCause = (cause: ExitCause): number => {
|
|
8
|
-
if (cause === "clean") return EXIT_CLEAN;
|
|
8
|
+
if (cause === "clean" || cause === "awaiting-input") return EXIT_CLEAN;
|
|
9
9
|
// All non-clean causes are failures that should be exit 1, except refusal is already handled separately
|
|
10
10
|
return EXIT_FAILURE;
|
|
11
11
|
};
|
package/src/cli/help.ts
CHANGED
|
@@ -42,6 +42,12 @@ Options:
|
|
|
42
42
|
--no-write Disable write
|
|
43
43
|
--shell Enable shell (muse)
|
|
44
44
|
--no-shell Disable shell
|
|
45
|
+
--escalate-questions Let the worker ask the caller's user when a
|
|
46
|
+
genuine decision blocks progress (DEFAULT;
|
|
47
|
+
prompt-preamble transport, question event +
|
|
48
|
+
done cause "awaiting-input", exit 0)
|
|
49
|
+
--no-escalate-questions Worker never asks: it states the assumption it
|
|
50
|
+
proceeded under and continues
|
|
45
51
|
--max-steps <n> Max steps (muse, 1-10000)
|
|
46
52
|
--timeout <seconds> Wall-clock budget for the run (all harnesses,
|
|
47
53
|
hcn-enforced; 0 disables; no default)
|
|
@@ -51,7 +57,11 @@ Options:
|
|
|
51
57
|
--no-skills Disable skills discovery facet
|
|
52
58
|
--cwd <path> Working directory for spawn
|
|
53
59
|
--env KEY=VAL Environment (repeatable; KEY= deletes)
|
|
54
|
-
--resume <uuid> Resume session id (UUID)
|
|
60
|
+
--resume <uuid> Resume session id (UUID). The answer path for
|
|
61
|
+
question escalation: resume with the chosen
|
|
62
|
+
answer as the prompt; id continuity per
|
|
63
|
+
harness (claude stable, pi/muse caller-assigned,
|
|
64
|
+
codex minted via identity event)
|
|
55
65
|
-- Passthrough: native harness args verbatim
|
|
56
66
|
(failures surface as labeled native errors)
|
|
57
67
|
--json NDJSON HarnessEvent to stdout
|
|
@@ -64,20 +74,27 @@ Defaults with no flags:
|
|
|
64
74
|
> harness default. The profile pins: effort medium, sandbox
|
|
65
75
|
workspace-write (codex only; other harnesses report divergence),
|
|
66
76
|
discovery on, autonomy off, write/shell on. timeout and max-steps have
|
|
67
|
-
no default.
|
|
77
|
+
no default. Question escalation defaults ON (config key
|
|
78
|
+
"escalateQuestions"; it is a prompt preamble, never a harness flag).
|
|
79
|
+
Provenance prints to stderr on every run; see
|
|
68
80
|
'hcn inspect <harness>' for the resolved argv of a bare run.
|
|
69
81
|
`;
|
|
70
82
|
|
|
71
|
-
export const SESSION_HELP = `hcn session - Interactive session (
|
|
83
|
+
export const SESSION_HELP = `hcn session - Interactive session (claude, pi)
|
|
72
84
|
|
|
73
85
|
Usage: hcn session <harness> [options]
|
|
74
86
|
|
|
75
87
|
Arguments:
|
|
76
|
-
<harness>
|
|
88
|
+
<harness> claude | pi (others have no sessionMode)
|
|
77
89
|
|
|
78
90
|
Options:
|
|
79
91
|
--model <id> Model for the session
|
|
80
|
-
--session-id <uuid> Session id (UUID, else random
|
|
92
|
+
--session-id <uuid> Session id (UUID, else random; re-enters an
|
|
93
|
+
existing session)
|
|
94
|
+
--escalate-questions Worker may ask; question renders as a pickable
|
|
95
|
+
menu, the answer flows back into the SAME live
|
|
96
|
+
session (DEFAULT)
|
|
97
|
+
--no-escalate-questions Worker never asks; states its assumption
|
|
81
98
|
--cwd <path> Working directory
|
|
82
99
|
--help Show help
|
|
83
100
|
--version Show version
|
|
@@ -102,8 +119,13 @@ Options:
|
|
|
102
119
|
--autonomy / --no-autonomy
|
|
103
120
|
--write / --no-write
|
|
104
121
|
--shell / --no-shell
|
|
122
|
+
--escalate-questions / --no-escalate-questions
|
|
123
|
+
(accepted; renders nothing - rides the run prompt)
|
|
105
124
|
--max-steps <n>
|
|
106
125
|
--no-tools, --no-instruction-files, --no-extensions, --no-skills
|
|
126
|
+
--escalate-questions / --no-escalate-questions
|
|
127
|
+
Accepted; renders nothing in argv (the mode
|
|
128
|
+
rides the run prompt, not a harness flag)
|
|
107
129
|
--cwd <path>
|
|
108
130
|
--env KEY=VAL
|
|
109
131
|
--resume <uuid>
|
package/src/cli/render.ts
CHANGED
|
@@ -4,6 +4,7 @@ const dim = (s: string) => `\x1b[2m${s}\x1b[0m`;
|
|
|
4
4
|
const cyan = (s: string) => `\x1b[36m${s}\x1b[0m`;
|
|
5
5
|
const green = (s: string) => `\x1b[32m${s}\x1b[0m`;
|
|
6
6
|
const red = (s: string) => `\x1b[31m${s}\x1b[0m`;
|
|
7
|
+
const blue = (s: string) => `\x1b[34m${s}\x1b[0m`;
|
|
7
8
|
const yellow = (s: string) => `\x1b[33m${s}\x1b[0m`;
|
|
8
9
|
|
|
9
10
|
export interface RenderState {
|
|
@@ -36,6 +37,15 @@ export const renderEvent = (event: HarnessEvent, state: RenderState): void => {
|
|
|
36
37
|
case "limit":
|
|
37
38
|
process.stdout.write(yellow(`\n ⚠ limit: ${event.code} ${event.message}`));
|
|
38
39
|
break;
|
|
40
|
+
case "question":
|
|
41
|
+
// issue #41: the structured question fields ARE the question - this
|
|
42
|
+
// render is a convenience view of them, not the contract.
|
|
43
|
+
process.stdout.write(blue(`\n ? ${event.question}\n`));
|
|
44
|
+
for (const option of event.options) {
|
|
45
|
+
const mark = option === event.recommended ? "*" : " ";
|
|
46
|
+
process.stdout.write(blue(` ${mark} ${option}\n`));
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
39
49
|
case "error":
|
|
40
50
|
process.stdout.write(red(`\n ✗ ${event.message}`));
|
|
41
51
|
break;
|
|
@@ -54,7 +64,12 @@ export const renderEvent = (event: HarnessEvent, state: RenderState): void => {
|
|
|
54
64
|
break;
|
|
55
65
|
}
|
|
56
66
|
case "done": {
|
|
57
|
-
const mark =
|
|
67
|
+
const mark =
|
|
68
|
+
event.cause === "clean" || event.cause === "awaiting-input"
|
|
69
|
+
? event.cause === "awaiting-input"
|
|
70
|
+
? blue("○ awaiting input")
|
|
71
|
+
: green("○ clean")
|
|
72
|
+
: red(`○ ${event.cause}`);
|
|
58
73
|
const tail = event.failure ? ` ${event.failure.class}: ${event.failure.message}` : "";
|
|
59
74
|
process.stdout.write(`\n ${mark} (exit ${event.exitCode ?? "none"})${tail}\n`);
|
|
60
75
|
break;
|