/** * CC `execPromptHook` 的**逐字**移植面:两档系统提示 + `{ok, reason, impossible?}` 判词的解析与映射。 * * ── 为什么单独一个文件 ────────────────────────────────────────────────────────────────────────── * 本仓有 clay 的**提示词面锚定 CC 逐字**令(偏离仅限超集/品牌二类且需登记)。把这两段正文与它们的 * 判词形收在一处,才谈得上机器看守(见 `test/cc-stop-prompt.test.ts` 的字节钉)。 * * ── 出处(我**第一手**核过,不是照抄转述)──────────────────────────────────────────────────────── * `sema-agent/cc-decoded` 的 `pretty220.js:609309` 起(219/218 同构)。逐字核实的四件: * · 两档判据是 **hook 事件名**:`c = r === "Stop" || r === "SubagentStop"` ⇒ 这两个事件用**完整版**,其余用简版; * · user 消息也被包装(见 {@link wrapCondition}),原文预设**会话就在上文**("transcript **above**"); * · 评估者 `thinkingConfig: { type: "disabled", mechanical: !0 }`([ref] P4-2:引文补 `mechanical` 键)+ * **`tools: []`** —— 它是**纯判官**,不能自己去查; * · 会话消息**整段前置**(`s && s.length > 0 ? [...prepend(s), p] : [p]`),不是摘要。 * ⚠️ 语料把**正文/标点**非 ASCII 存成 `\uXXXX` 六字符字面量(正文里那两个破折号是 `\u2014`)——**grep 真字符会全假阴**。 * 所以下面也用 `\u2014` 转义:源码保持 ASCII,运行时是同一个字符。 * ([ref] P4-5 量词修:locale/语言名表是例外——`日本語`/`русский` 等 127 个字面非 ASCII 字节在语料里 * 存活;另注 `grep -c` 数行不数次,计数用它会低估。) * ⚠️ **为什么必须自己核**:cli 报过他们移植的那段是**第三种措辞**(与 CC 220 的两个分支都不逐字相同, * 应是从更早版本移植后 CC 改过而没跟)。转述会漂,语料不会。 */ /** 完整版(**Stop / SubagentStop** 用)。CC `pretty220.js` 逐字。 */ export declare const CC_STOP_PROMPT_SYSTEM_FULL = "You are evaluating a stop-condition hook in Claude Code. Read the conversation transcript carefully, then judge whether the user-provided condition is satisfied.\n\nYour response must be a JSON object with one of these shapes:\n- {\"ok\": true, \"reason\": \"\"}\n- {\"ok\": false, \"reason\": \"\"}\n- {\"ok\": false, \"impossible\": true, \"reason\": \"\"}\n\nAlways include a \"reason\" field, quoting specific text from the transcript whenever possible. If the transcript does not contain clear evidence that the condition is satisfied, return {\"ok\": false, \"reason\": \"insufficient evidence in transcript\"}.\n\nOnly use {\"ok\": false, \"impossible\": true} when the condition is genuinely unachievable in this session \u2014 for example: the condition is self-contradictory, it depends on a resource or capability that is unavailable, or the assistant has explicitly tried, exhausted reasonable approaches, and stated it cannot be done. Apply your own judgment when deciding this \u2014 the assistant claiming the goal is impossible is evidence, not proof; independently confirm the condition is genuinely unachievable rather than deferring to the assistant's self-assessment. Do not use it just because the goal has not been reached yet or because progress is slow. When in doubt, return {\"ok\": false} without \"impossible\"."; /** 简版(其余事件用)。CC `pretty220.js` 逐字。 */ export declare const CC_STOP_PROMPT_SYSTEM_SIMPLE = "You are evaluating a hook condition in Claude Code. Judge whether the user-provided condition is met.\n\nYour response must be a JSON object with one of these shapes:\n- {\"ok\": true, \"reason\": \"\"}\n- {\"ok\": false, \"reason\": \"\"}\n\nAlways include a \"reason\" field."; /** 事件名 → 用哪一档。CC 判据逐字:`r === "Stop" || r === "SubagentStop"`。 */ export declare function ccPromptSystemFor(event: string): string; /** * CC 对 user 消息的包装(**仅**完整版档位)。原文逐字,注意 "transcript **above**" —— * 它预设会话已经在上文,所以调用方必须真的把会话放在前面,否则这句话本身就是在骗模型。 */ export declare function wrapCondition(event: string, condition: string): string; /** CC 的判词形:`{ ok, reason, impossible? }`(zod 原文:impossible = "only meaningful when ok is false")。 */ export interface CcPromptVerdict { ok: boolean; reason?: string; impossible?: boolean; } /** * 解析模型判词。**解析不出来 ⇒ `undefined`**(= 无判决),绝不臆测成 `ok:false` —— * 🔴 Stop 钩子的 `ok:false` **等于拦住停止**,把"读不懂"当成"没满足"会让一次解析失败变成一次拦停。 */ export declare function parseCcVerdict(text: string): CcPromptVerdict | undefined; /** * CC 条件评估者的**输出额度**。 * * 🔴 为什么不能用载体缺省(1024):CC 的系统提示**明确要求**评估者 * 「quote evidence from the transcript」——判词天然带引文;而**推理档模型的 thinking 与输出共用**这份额度。 * cli 的 live 围栏实测两种失败形,**同一根因**:①判词 JSON 被截断(`{"ok": true, "reason": "The first user…` 然后没了) * ②一个字都没吐出来(thinking 吃光)。**两种都导致判词整条被丢弃 ⇒ fail-open(该拦没拦)** —— * 而用户设 `enforced` 的全部意义就是「没达成别停」,这正是守卫在最需要它的时候静默失效。 * * 4096 的取法:判词本身是个小 JSON + 一段引文(几百 token 足够),其余留给 thinking; * 同时它安全地低于所有在用模型的输出硬顶(超硬顶会让整请求 400)。 */ export declare const CC_EVALUATOR_MAX_OUTPUT_TOKENS = 4096; //# sourceMappingURL=cc-stop-prompt.d.ts.map