dsh-harness-reflex 0.1.0 → 0.3.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/README.md +20 -6
- package/client.js +3511 -185
- package/dist/attribution.d.ts +266 -0
- package/dist/attribution.js +238 -0
- package/dist/attribution.js.map +1 -0
- package/dist/bridge.d.ts +311 -13
- package/dist/bridge.js +714 -42
- package/dist/bridge.js.map +1 -1
- package/dist/client-bundle.js +4 -1
- package/dist/client-bundle.js.map +1 -1
- package/dist/command.js +10 -0
- package/dist/command.js.map +1 -1
- package/dist/config.d.ts +530 -22
- package/dist/config.js +808 -27
- package/dist/config.js.map +1 -1
- package/dist/delegation-dispatch.d.ts +132 -0
- package/dist/delegation-dispatch.js +186 -0
- package/dist/delegation-dispatch.js.map +1 -0
- package/dist/delegation-health.d.ts +131 -0
- package/dist/delegation-health.js +97 -0
- package/dist/delegation-health.js.map +1 -0
- package/dist/delegation.d.ts +148 -0
- package/dist/delegation.js +186 -0
- package/dist/delegation.js.map +1 -0
- package/dist/effort-delegation.d.ts +144 -0
- package/dist/effort-delegation.js +280 -0
- package/dist/effort-delegation.js.map +1 -0
- package/dist/effort.d.ts +141 -0
- package/dist/effort.js +251 -9
- package/dist/effort.js.map +1 -1
- package/dist/host-patch.d.ts +156 -0
- package/dist/host-patch.js +534 -0
- package/dist/host-patch.js.map +1 -0
- package/dist/index.d.ts +12 -3
- package/dist/index.js +99 -7
- package/dist/index.js.map +1 -1
- package/dist/interventions.d.ts +98 -373
- package/dist/interventions.js +442 -1702
- package/dist/interventions.js.map +1 -1
- package/dist/panel-api.d.ts +328 -4
- package/dist/panel-api.js +322 -15
- package/dist/panel-api.js.map +1 -1
- package/dist/panel-mount.d.ts +81 -22
- package/dist/panel-mount.js +228 -7
- package/dist/panel-mount.js.map +1 -1
- package/dist/routing.d.ts +23 -18
- package/dist/routing.js +471 -153
- package/dist/routing.js.map +1 -1
- package/dist/session-audit.d.ts +70 -0
- package/dist/session-audit.js +73 -0
- package/dist/session-audit.js.map +1 -1
- package/dist/systemone-probe.d.ts +114 -0
- package/dist/systemone-probe.js +383 -0
- package/dist/systemone-probe.js.map +1 -0
- package/dist/testing.d.ts +212 -7
- package/dist/testing.js +333 -27
- package/dist/testing.js.map +1 -1
- package/dist/tools.d.ts +109 -3
- package/dist/tools.js +103 -4
- package/dist/tools.js.map +1 -1
- package/dist/unconfigured-backend.d.ts +72 -0
- package/dist/unconfigured-backend.js +94 -0
- package/dist/unconfigured-backend.js.map +1 -0
- package/dist/vendor/harness-reflex/backend/factory.d.ts +31 -1
- package/dist/vendor/harness-reflex/backend/factory.js +18 -3
- package/dist/vendor/harness-reflex/backend/factory.js.map +1 -1
- package/dist/vendor/harness-reflex/backend/jev.d.ts +20 -0
- package/dist/vendor/harness-reflex/backend/jev.js +11 -4
- package/dist/vendor/harness-reflex/backend/jev.js.map +1 -1
- package/dist/vendor/harness-reflex/backend/simple-jev.d.ts +16 -0
- package/dist/vendor/harness-reflex/backend/simple-jev.js +17 -6
- package/dist/vendor/harness-reflex/backend/simple-jev.js.map +1 -1
- package/dist/vendor/harness-reflex/core/closing.d.ts +90 -0
- package/dist/vendor/harness-reflex/core/closing.js +111 -0
- package/dist/vendor/harness-reflex/core/closing.js.map +1 -0
- package/dist/vendor/harness-reflex/core/evidence.d.ts +119 -0
- package/dist/vendor/harness-reflex/core/evidence.js +209 -0
- package/dist/vendor/harness-reflex/core/evidence.js.map +1 -0
- package/dist/vendor/harness-reflex/core/judge.d.ts +221 -0
- package/dist/vendor/harness-reflex/core/judge.js +251 -0
- package/dist/vendor/harness-reflex/core/judge.js.map +1 -0
- package/dist/vendor/harness-reflex/core/orchestrate-closing.d.ts +237 -0
- package/dist/vendor/harness-reflex/core/orchestrate-closing.js +250 -0
- package/dist/vendor/harness-reflex/core/orchestrate-closing.js.map +1 -0
- package/dist/vendor/harness-reflex/core/orchestrate-correction.d.ts +209 -0
- package/dist/vendor/harness-reflex/core/orchestrate-correction.js +141 -0
- package/dist/vendor/harness-reflex/core/orchestrate-correction.js.map +1 -0
- package/dist/vendor/harness-reflex/core/orchestrate-host.d.ts +225 -0
- package/dist/vendor/harness-reflex/core/orchestrate-host.js +80 -0
- package/dist/vendor/harness-reflex/core/orchestrate-host.js.map +1 -0
- package/dist/vendor/harness-reflex/core/orchestrate-stagnation.d.ts +259 -0
- package/dist/vendor/harness-reflex/core/orchestrate-stagnation.js +270 -0
- package/dist/vendor/harness-reflex/core/orchestrate-stagnation.js.map +1 -0
- package/dist/vendor/harness-reflex/core/orchestrate.d.ts +357 -0
- package/dist/vendor/harness-reflex/core/orchestrate.js +418 -0
- package/dist/vendor/harness-reflex/core/orchestrate.js.map +1 -0
- package/dist/vendor/harness-reflex/core/policy.d.ts +122 -0
- package/dist/vendor/harness-reflex/core/policy.js +102 -0
- package/dist/vendor/harness-reflex/core/policy.js.map +1 -0
- package/dist/vendor/harness-reflex/core/prune-plan.d.ts +141 -0
- package/dist/vendor/harness-reflex/core/prune-plan.js +390 -0
- package/dist/vendor/harness-reflex/core/prune-plan.js.map +1 -0
- package/dist/vendor/harness-reflex/core/text.d.ts +36 -0
- package/dist/vendor/harness-reflex/core/text.js +66 -0
- package/dist/vendor/harness-reflex/core/text.js.map +1 -0
- package/dist/vendor/harness-reflex/ports/audit.d.ts +18 -0
- package/dist/vendor/harness-reflex/ports/audit.js +11 -0
- package/dist/vendor/harness-reflex/ports/audit.js.map +1 -0
- package/dist/vendor/harness-reflex/ports/clock.d.ts +14 -0
- package/dist/vendor/harness-reflex/ports/clock.js +11 -0
- package/dist/vendor/harness-reflex/ports/clock.js.map +1 -0
- package/dist/vendor/harness-reflex/ports/decision.d.ts +75 -0
- package/dist/vendor/harness-reflex/ports/decision.js +2 -0
- package/dist/vendor/harness-reflex/ports/decision.js.map +1 -0
- package/dist/vendor/harness-reflex/ports/index.d.ts +14 -0
- package/dist/vendor/harness-reflex/ports/index.js +2 -0
- package/dist/vendor/harness-reflex/ports/index.js.map +1 -0
- package/dist/vendor/harness-reflex/ports/log.d.ts +22 -0
- package/dist/vendor/harness-reflex/ports/log.js +12 -0
- package/dist/vendor/harness-reflex/ports/log.js.map +1 -0
- package/dist/vendor/harness-reflex/ports/state.d.ts +46 -0
- package/dist/vendor/harness-reflex/ports/state.js +13 -0
- package/dist/vendor/harness-reflex/ports/state.js.map +1 -0
- package/package.json +25 -13
package/dist/effort.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effort.js","sourceRoot":"","sources":["../src/effort.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,oBAAoB,EAAmE,MAAM,aAAa,CAAC;AAEpH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC;AAKzF,oDAAoD;AACpD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AAKhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAU,CAAC;AAqB3D,uEAAuE;AACvE,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC,+DAA+D;AAC/D,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAwC;IAC5E,GAAG,EAAE,oHAAoH;IACzH,GAAG,EAAE,4KAA4K;IACjL,MAAM,EACJ,wOAAwO;IAC1O,IAAI,EAAE,gXAAgX;CACvX,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAsB,sBAAsB,CAAC,GAAG,CAChF,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,IAAI,yBAAyB,CAAC,KAAK,CAAC,EAAE,CA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ACH,SAAS,CAAC,QAA8C;QACtD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9B,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACnC,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAgB;QACrB,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC5D,IAAI,MAAsC,CAAC;QAC3C,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YAC3C,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,EAAE;gBAAE,MAAM,GAAG,MAAM,CAAC;QACzD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,OAAgB;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC;IACpC,CAAC;IAED,6EAA6E;IAC7E,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/**\n * Adaptive reasoning-effort interception for one agent turn.\n *\n * A deployment may configure `reasoningEffort: 'reflex'` (alias `'auto'`), or an\n * upstream caller may put either marker on the request itself. A deployment can\n * no longer pin a concrete level: fixed depth belongs to the model selector, so\n * configuration only answers \"should adaptive effort run at all?\". Neither\n * marker is\n * a physical effort id, so the `agent/request` waterfall cannot forward it: this\n * module turns the marker into a per-turn decision taken by the System 1 choice\n * backend (keyword heuristics offline, the Jev endpoint in production) and\n * projects the decided level onto the vocabulary the routed model actually\n * declares.\n *\n * A deterministic cue classifier runs whenever System 1 is unreachable,\n * malformed, or not confident enough to distinguish the levels. It keeps the\n * interceptor total: a decision is always produced, in milliseconds, and the\n * request never fails because System 1 did.\n *\n * Everything here is deliberately free of Cordis and DSH imports. The decision,\n * the projection, and the status feed are pure functions over plain data, so the\n * rewrite rules are directly testable and the request path stays allocation-light.\n */\nimport type { ChoiceRequest, ChoiceResponse, DecisionLedger } from './vendor/harness-reflex/index.js';\n\nimport { alignReasoningEffort, type PhysicalTarget, type ReasoningProbe, type ReasoningSupport } from './router.js';\n\n/**\n * Selectable reasoning-effort ladder, cheapest first. `minimal` and `max` are\n * part of the vocabulary so a physical model that declares them can be snapped\n * to; the adaptive decision itself only ever chooses `off`, `low`, `medium`, or\n * `high`, which every first-party adapter we target understands.\n */\nexport const EFFORT_LEVELS = ['off', 'minimal', 'low', 'medium', 'high', 'max'] as const;\n\n/** One selectable reasoning effort. */\nexport type EffortLevel = (typeof EFFORT_LEVELS)[number];\n\n/** Levels the adaptive decision may choose from. */\nexport const ADAPTIVE_EFFORT_LEVELS = ['off', 'low', 'medium', 'high'] as const;\n\n/** One level the adaptive decision may return. */\nexport type AdaptiveEffortLevel = (typeof ADAPTIVE_EFFORT_LEVELS)[number];\n\n/**\n * Marker asking the plugin to decide this turn's effort itself. `auto` is an\n * accepted alias of `reflex`; both are configurably equivalent to\n * {@link ReasoningEffortSetting}.\n */\nexport const EFFORT_TRIGGERS = ['reflex', 'auto'] as const;\n\n/** The adaptive trigger marker. */\nexport type EffortTrigger = (typeof EFFORT_TRIGGERS)[number];\n\n/**\n * What a deployment may put in `reasoningEffort`: only a trigger marker (decide\n * per turn). A concrete level is a model-selector choice, never a deployment\n * setting — pinning depth from configuration is not supported.\n */\nexport type ReasoningEffortSetting = EffortTrigger;\n\n/** Where one turn's effort came from. */\nexport type EffortSource = 'system-one' | 'cue-fallback';\n\n/** What the decided level became on the physical route. */\nexport type EffortOutcome = 'supported' | 'snapped' | 'cleared' | 'unknown' | 'passthrough';\n\n/** What asked for the decision. */\nexport type EffortTriggerKind = 'request' | 'config';\n\n/** Characters of the turn input handed to System 1 as the question. */\nexport const EFFORT_QUESTION_CHARS = 600;\n\n/** Characters of the turn input kept in the audit surfaces. */\nexport const EFFORT_AUDIT_TASK_CHARS = 160;\n\n/**\n * Scenario vocabulary of one adaptive level. The first token of every rendered\n * option is the level id, so a backend answer is parsed by prefix; the remaining\n * words are the evidence vocabulary that keyword-scoring backends match against\n * the question. It stays deliberately close to how a human reads a task\n * (\"rename this variable\" versus \"design the migration\"), and it carries the\n * common Chinese phrasings of the same tiers so a bilingual prompt lands on the\n * same level.\n */\nexport const EFFORT_LEVEL_DESCRIPTIONS: Record<AdaptiveEffortLevel, string> = {\n off: 'no thinking needed: greeting acknowledgement chit chat small talk thanks confirmation yes no 你好 您好 谢谢 好的 收到 继续 没问题',\n low: 'minimal thinking: rename typo whitespace formatting lint comment version bump revert reword simple lookup list files read file one liner 改名 重命名 错字 错别字 注释 格式化 简单 查看文件 列出文件',\n medium:\n 'moderate thinking: implement add write update fix change adjust extend wire register support expose test docs config endpoint handler function method class module service component cli api 实现 添加 编写 修改 修复 测试 单元测试 文档 配置 接口 函数 组件 命令行',\n high: 'deep thinking: architecture design security threat concurrency race deadlock performance optimize throughput latency scalability algorithm complexity migration distributed invariant protocol prove proof theorem analyze analysis root cause trade off audit benchmark profile semantics refactor backward compatibility 架构 并发 死锁 性能 优化 吞吐 延迟 迁移 分布式 不变量 证明 定理 根因 权衡 安全审计 语义'\n};\n\n/**\n * Candidate levels System 1 ranks against the turn input, in ladder order.\n *\n * Kept as the deployment-wide default (no model capability known yet). Once the\n * routed model is known, {@link buildEffortChoiceOptions} narrows this to the\n * levels that model actually declares, so the adaptive decision never has to be\n * snapped afterwards.\n */\nexport const EFFORT_CHOICE_OPTIONS: readonly string[] = ADAPTIVE_EFFORT_LEVELS.map(\n (level) => `${level} ${EFFORT_LEVEL_DESCRIPTIONS[level]}`\n);\n\n/** Matched cue words per tier, plus cheap shape facts about the input. */\nexport interface EffortCues {\n /** Characters in the trimmed turn input. */\n length: number;\n /** Ordering words that need no reasoning at all. */\n trivial: string[];\n /** Mechanical edits a smaller model handles as well as a large one. */\n light: string[];\n /** Ordinary implementation work. */\n moderate: string[];\n /** Work whose cost of being wrong justifies the expensive level. */\n deep: string[];\n}\n\n/** One adaptive decision, before it is projected onto a physical route. */\nexport interface EffortDecision {\n level: AdaptiveEffortLevel;\n source: EffortSource;\n /** 0 – 1 confidence of the winning evidence; 0 means nothing matched. */\n confidence: number;\n /** Wall-clock milliseconds the decision cost. */\n latencyMs: number;\n /** Verbatim evidence the decision rested on (matched cue words, or the option). */\n basis: string[];\n /** Set when System 1 answered but the engine still had to fall back to cues. */\n degradedReason?: string;\n}\n\n/** Executes one System 1 choice; matches `DecisionBackend['choice']`. */\nexport type EffortDecider = (request: ChoiceRequest) => Promise<ChoiceResponse>;\n\n/** Agent attribution carried into the audit surfaces. */\nexport interface EffortAgentFacts {\n agentId?: string;\n role?: string;\n delegationDepth?: number;\n}\n\n/** Everything one request needs decided about its reasoning effort. */\nexport interface EffortRequestContext {\n /** Effort the resolved request carries (after the LLM waterfall). */\n requested?: string;\n /** Physical route the rewritten request will reach. */\n target: PhysicalTarget;\n /** Capability lookup for that route; absent leaves the level unprojected. */\n probe?: ReasoningProbe;\n /** Turn input captured on `agent/pre-step`. */\n task?: string;\n agent?: EffortAgentFacts;\n turn?: number;\n step?: number;\n /** Provider the request named before routing, for the status line. */\n requestedProvider?: string;\n /** Model the request named before routing, for the status line. */\n requestedModel?: string;\n /** Whether routing moved the request onto another provider/model. */\n switched?: boolean;\n /** Whether the request stayed on the current model due to prompt-cache affinity. */\n heldForCache?: boolean;\n /**\n * Pre-computed capability result for `target`. Supplying it skips the second\n * probe when the caller already resolved the route's declared vocabulary.\n */\n support?: ReasoningSupport;\n}\n\n/** The rewrite instruction one request produces. */\nexport interface EffortResolution {\n /** Effort the rewritten request must carry; absent clears the key. */\n effort?: string;\n /** Whether the caller must rewrite `reasoningEffort`. */\n changed: boolean;\n outcome: EffortOutcome;\n /** Set when this turn's effort was decided by an adaptive trigger. */\n trigger?: EffortTriggerKind;\n /** The adaptive decision, when one was taken. */\n decision?: EffortDecision;\n /** Status-bar payload, when one was produced. */\n status?: ReflexEffortStatus;\n}\n\n/** One published effort status, shaped for a status bar and for the audit log. */\nexport interface ReflexEffortStatus {\n level: AdaptiveEffortLevel;\n /** Effort actually carried by the rewritten request; absent = cleared. */\n applied?: string;\n outcome: EffortOutcome;\n trigger: EffortTriggerKind;\n source: EffortSource;\n confidence: number;\n latencyMs: number;\n provider: string;\n model: string;\n /** Single-line rendering, ready for a status bar. */\n line: string;\n /** Unix epoch milliseconds of the decision. */\n at: number;\n agentId?: string;\n role?: string;\n delegationDepth?: number;\n turn?: number;\n step?: number;\n /** Verbatim evidence the decision rested on. */\n basis?: string[];\n /** Set when System 1 could not be used. */\n degradedReason?: string;\n /** Turn input excerpt; audit only, never re-sent to a model. */\n task?: string;\n /** Provider named by the request before routing (the virtual one, when routed). */\n requestedProvider?: string;\n /** Model named by the request before routing. */\n requestedModel?: string;\n /** Whether the request actually moved to another provider/model. */\n switched?: boolean;\n /** Whether the model was held to defend upstream prompt-cache affinity. */\n heldForCache?: boolean;\n /** Effort ids the routed model declares; `[]` when it declares none. */\n supportedEfforts?: string[];\n}\n\n/** Whether a value is the adaptive trigger marker. */\nexport function isEffortTrigger(value: string | undefined): value is EffortTrigger {\n return value !== undefined && (EFFORT_TRIGGERS as readonly string[]).includes(value);\n}\n\n/** Whether a value is a level the adaptive decision itself may return. */\nexport function isAdaptiveEffortLevel(value: string | undefined): value is AdaptiveEffortLevel {\n return value !== undefined && (ADAPTIVE_EFFORT_LEVELS as readonly string[]).includes(value);\n}\n\n/**\n * Position of one effort on the shared ladder.\n * @param level - any effort id.\n * @returns the zero-based rank, or -1 when the ladder does not know the id.\n */\nexport function effortRank(level: string): number {\n return (EFFORT_LEVELS as readonly string[]).indexOf(level);\n}\n\n/**\n * Choose the declared effort closest to the decided level.\n *\n * A physical model rarely declares exactly our four levels (DeepSeek, for one,\n * declares `off`, `low`, `high`, and `max`). Rather than letting an absent\n * `medium` collapse onto the provider default, this picks the neighbour on the\n * ladder; an exact tie takes the cheaper side, because the decision already\n * carries the intent and overspending is the failure mode that costs money.\n *\n * @param level - the decided level.\n * @param efforts - effort ids the target declares.\n * @param defaultEffort - the target's declared default, used when no id is rankable.\n * @returns the effort to send, or `undefined` when nothing can be ranked.\n */\nexport function snapEffort(\n level: EffortLevel,\n efforts: readonly string[],\n defaultEffort?: string\n): string | undefined {\n const wanted = EFFORT_LEVELS.indexOf(level);\n let best: string | undefined;\n let bestDistance = Number.POSITIVE_INFINITY;\n\n for (const candidate of efforts) {\n const rank = effortRank(candidate);\n if (rank < 0) continue;\n const distance = Math.abs(rank - wanted);\n if (distance < bestDistance) {\n best = candidate;\n bestDistance = distance;\n }\n }\n\n if (best !== undefined) return best;\n if (defaultEffort !== undefined && efforts.includes(defaultEffort)) return defaultEffort;\n return undefined;\n}\n\n/**\n * Project one decided level onto the routed model's declared vocabulary.\n *\n * - the target declares the level: send it unchanged;\n * - the target declares other levels: slide to the nearest declared neighbour;\n * - the target declares no reasoning at all: clear the key, so a\n * non-thinking model is asked exactly what it can answer;\n * - the capability is unknown (no LLM runtime, or a resolver failure): keep the\n * level and let the adapter decide, as it does for any other route.\n *\n * @param level - the decided level.\n * @param target - the physical route the request will reach.\n * @param probe - optional capability lookup.\n * @returns the effort to send (absent clears the key) and what happened.\n */\nexport async function projectEffort(\n level: EffortLevel,\n target: PhysicalTarget,\n probe?: ReasoningProbe\n): Promise<{ effort?: string; outcome: EffortOutcome }> {\n if (!probe) return { effort: level, outcome: 'unknown' };\n\n let support;\n try {\n support = await probe(target);\n } catch {\n return { effort: level, outcome: 'unknown' };\n }\n\n if (support.kind === 'unknown') return { effort: level, outcome: 'unknown' };\n if (support.kind === 'none') return { outcome: 'cleared' };\n if (support.efforts.includes(level)) return { effort: level, outcome: 'supported' };\n\n const snapped = snapEffort(level, support.efforts, support.defaultEffort);\n return snapped === undefined ? { outcome: 'cleared' } : { effort: snapped, outcome: 'snapped' };\n}\n\n/**\n * Project one decided level that was *already chosen inside* the model's\n * candidate set.\n *\n * Unlike {@link projectEffort} this never snaps silently: a decision taken\n * within the declared vocabulary is `supported` by construction, and only a\n * degenerate declaration (no adaptive id at all) can still need a slide. The\n * distinction is what removes `snapped` from the正常 path: the interceptor now\n * reads the declaration first instead of repairing the answer afterwards.\n *\n * @param level - the decided level.\n * @param support - the routed model's declared vocabulary.\n * @returns the effort to send (absent clears the key) and what happened.\n */\nexport function projectWithinSupport(\n level: AdaptiveEffortLevel,\n support: ReasoningSupport\n): { effort?: string; outcome: EffortOutcome } {\n if (support.kind === 'unknown') return { effort: level, outcome: 'unknown' };\n if (support.kind === 'none') return { outcome: 'cleared' };\n if (support.efforts.includes(level)) return { effort: level, outcome: 'supported' };\n\n const candidates = adaptiveCandidateLevels(support.efforts);\n const near = nearestCandidate(level, candidates);\n if (support.efforts.includes(near)) return { effort: near, outcome: 'supported' };\n\n const snapped = snapEffort(near, support.efforts, support.defaultEffort);\n return snapped === undefined ? { outcome: 'cleared' } : { effort: snapped, outcome: 'snapped' };\n}\n\n/**\n * Read the routed model's declared vocabulary, never throwing.\n * @param context - request context; a pre-computed `support` skips the probe.\n * @returns the declaration, or `unknown` when no probe can answer.\n */\nasync function resolveSupport(context: EffortRequestContext): Promise<ReasoningSupport> {\n if (context.support) return context.support;\n if (!context.probe) return { kind: 'unknown' };\n try {\n return await context.probe(context.target);\n } catch {\n return { kind: 'unknown' };\n }\n}\n\n/**\n * The adaptive levels a model that declares `efforts` can actually be asked for.\n *\n * This is the S3 fix in one function: instead of deciding on the fixed\n * `off/low/medium/high` ladder and snapping the answer afterwards (which made\n * `medium → low` on DeepSeek and `off → low` on GPT a *normal* outcome), the\n * candidate set is derived from the declaration first, so the decision and the\n * dispatched effort are the same value.\n *\n * - no declaration known: the whole adaptive ladder;\n * - a declared level is offered whenever it is an adaptive level (so DeepSeek's\n * `off/low/high` and GPT's `low/medium/high` are used as-is);\n * - a declaration that shares no adaptive id (Say `minimal`/`max` only) is\n * projected onto the nearest adaptive level, so a candidate set always exists.\n *\n * @param efforts - effort ids the routed model declares.\n * @returns candidate levels in ladder order, never empty.\n */\nexport function adaptiveCandidateLevels(efforts?: readonly string[]): AdaptiveEffortLevel[] {\n if (!efforts || efforts.length === 0) return [...ADAPTIVE_EFFORT_LEVELS];\n\n const declared = new Set(efforts);\n const direct = ADAPTIVE_EFFORT_LEVELS.filter((level) => declared.has(level));\n if (direct.length > 0) return direct;\n\n const projected = new Set<AdaptiveEffortLevel>();\n for (const effort of efforts) {\n const rank = effortRank(effort);\n if (rank < 0) continue;\n projected.add(nearestAdaptiveLevel(rank));\n }\n return projected.size === 0 ? [...ADAPTIVE_EFFORT_LEVELS] : ADAPTIVE_EFFORT_LEVELS.filter((level) => projected.has(level));\n}\n\n/**\n * Nearest adaptive level to one ladder rank, preferring the cheaper side.\n * @param rank - rank on {@link EFFORT_LEVELS}.\n * @returns the closest adaptive level.\n */\nfunction nearestAdaptiveLevel(rank: number): AdaptiveEffortLevel {\n let best: AdaptiveEffortLevel = 'medium';\n let bestDistance = Number.POSITIVE_INFINITY;\n for (const level of ADAPTIVE_EFFORT_LEVELS) {\n const distance = Math.abs(effortRank(level) - rank);\n if (distance < bestDistance) {\n best = level;\n bestDistance = distance;\n }\n }\n return best;\n}\n\n/**\n * Project one decided level into a candidate set.\n *\n * An exact member is returned unchanged (the normal case). A level the model\n * does not offer slides to the nearest candidate; an exact tie takes the cheaper\n * side, because the decision already carries the intent and overspending is the\n * failure mode that costs money.\n *\n * @param level - the decided level.\n * @param candidates - candidate levels derived from the model declaration.\n * @returns a member of `candidates`.\n */\nexport function nearestCandidate(level: AdaptiveEffortLevel, candidates: readonly AdaptiveEffortLevel[]): AdaptiveEffortLevel {\n const pool = candidates.length > 0 ? candidates : ADAPTIVE_EFFORT_LEVELS;\n if (pool.includes(level)) return level;\n\n const wanted = effortRank(level);\n let best: AdaptiveEffortLevel = pool[0] ?? level;\n let bestDistance = Number.POSITIVE_INFINITY;\n for (const candidate of pool) {\n const distance = Math.abs(effortRank(candidate) - wanted);\n if (distance < bestDistance) {\n best = candidate;\n bestDistance = distance;\n }\n }\n return best;\n}\n\n/**\n * Render the System 1 candidate options for one model declaration.\n *\n * A level the model does not declare is not silently dropped: its scenarios are\n * absorbed by the neighbouring candidates, so the backend still sees vocabulary\n * for every kind of task. `off` (below the cheapest candidate) is absorbed by\n * the cheapest one — GPT, whose lowest level is `low`, therefore answers `low`\n * for a greeting instead of producing `off → low (snapped)`. `medium`, which\n * sits *between* two declared levels, is absorbed by both neighbours, which is\n * what makes \"ordinary implementation work\" readable as either `low` or `high`\n * on a model that declares `off/low/high`.\n *\n * @param efforts - effort ids the routed model declares.\n * @returns one option per candidate, in ladder order.\n */\nexport function buildEffortChoiceOptions(efforts?: readonly string[]): string[] {\n const candidates = adaptiveCandidateLevels(efforts);\n const cheapest = candidates[0] ?? 'low';\n const absorbed = new Map<AdaptiveEffortLevel, AdaptiveEffortLevel[]>([\n ...candidates.map((level) => [level, [level]] as [AdaptiveEffortLevel, AdaptiveEffortLevel[]])\n ]);\n\n for (const missing of ADAPTIVE_EFFORT_LEVELS) {\n if (candidates.includes(missing)) continue;\n const below = candidates.filter((level) => effortRank(level) < effortRank(missing)).pop();\n const above = candidates.find((level) => effortRank(level) > effortRank(missing));\n if (below === undefined && above === undefined) {\n absorbed.get(cheapest)?.push(missing);\n continue;\n }\n // Below the cheapest candidate: the cheapest one answers for it.\n if (below === undefined) {\n if (above !== undefined) absorbed.get(above)?.push(missing);\n continue;\n }\n absorbed.get(below)?.push(missing);\n // Between two candidates: both neighbours offer it, so its vocabulary stays\n // reachable from either side of the gap.\n if (above !== undefined) absorbed.get(above)?.push(missing);\n }\n\n return candidates.map((level) => {\n const levels = (absorbed.get(level) ?? [level]).slice().sort((left, right) => effortRank(left) - effortRank(right));\n const description = levels.map((entry) => EFFORT_LEVEL_DESCRIPTIONS[entry]).join(' ');\n return `${level} ${description}`;\n });\n}\n\n/** Cue weights: an explicit deep cue outweighs a pile of mechanical ones. */\nconst CUE_WEIGHTS: Record<'trivial' | 'light' | 'moderate' | 'deep', number> = {\n trivial: 3,\n light: 2,\n moderate: 2,\n deep: 3\n};\n\n/** Priority used when two tiers score the same: more thinking wins. */\nconst CUE_TIE_BREAK: readonly (keyof typeof CUE_WEIGHTS)[] = ['deep', 'moderate', 'light', 'trivial'];\n\n/** Tier that decides the level when a tier wins the vote. */\nconst TIER_LEVEL: Record<keyof typeof CUE_WEIGHTS, AdaptiveEffortLevel> = {\n trivial: 'off',\n light: 'low',\n moderate: 'medium',\n deep: 'high'\n};\n\n/** Cue vocabulary. Order inside one tier does not matter; tiers are scored apart. */\nconst CUE_VOCABULARY: Record<'trivial' | 'light' | 'moderate' | 'deep', readonly RegExp[]> = {\n trivial: [\n /\\b(?:hi|hello|hey|yo|thanks|thank you|thx|ok|okay|yes|no|sure|ack|acknowledged|proceed|continue|go ahead|sounds good|got it)\\b/g,\n /(?:你好|您好|谢谢|好的|收到|继续|没问题)/g\n ],\n light: [\n /\\b(?:rename|typo|typos|whitespace|format|formatting|reformat|lint|comment|comments|docstring|version|bump|revert|reword|wording|typos?)\\b/g,\n /\\b(?:list|show)\\s+(?:the\\s+)?files?\\b/g,\n /\\b(?:read|open|cat)\\s+(?:the\\s+)?file\\b/g,\n /\\blook\\s?up\\b/g,\n /\\bone[- ]liner\\b/g,\n /\\bsimple\\b/g,\n /(?:改名|重命名|错字|错别字|注释|格式化|简单|查看文件|列出文件)/g\n ],\n moderate: [\n /\\b(?:implement|add|added|write|update|fix|fixed|change|adjust|extend|wire|register|support|expose|test|tests|docs|documentation|config|configuration|endpoint|handler|function|method|class|module|service|component|cli|api|refactor)\\b/g,\n /(?:实现|添加|编写|修改|修复|测试|单元测试|文档|配置|接口|函数|组件|命令行)/g\n ],\n deep: [\n /\\b(?:architect(?:ure|ural)?|design|security|threat|concurren(?:cy|t)|race condition|deadlock|performance|optimiz(?:e|ation)|throughput|latency|scal(?:e|ability|ing)|algorithm|complexity|migration|migrate|distributed|invariant|protocol|prove|proof|theorem|analy(?:ze|sis)|root cause|trade[- ]?off|audit|benchmark|profile|semantics|debug|backward compatib\\w*)\\b/g,\n /(?:架构|并发|死锁|性能|优化|吞吐|延迟|迁移|分布式|不变量|证明|定理|根因|权衡|安全审计|语义)/g\n ]\n};\n\n/**\n * Instructions that ask for a literal restatement rather than work: \"only return\n * this verbatim\", \"do not analyze it\", `原样返回`, and their kin.\n *\n * P9 is the regression this guards: the payload inside the quotes was scanned as\n * if the task were about architecture, concurrency, and proofs, and the turn was\n * billed at `high` for copying six words.\n */\nconst VERBATIM_INSTRUCTION =\n /(?:\\b(?:only|just)\\s+return|\\breturn\\b[^.;\\n]{0,40}?\\bverbatim|\\brepeat\\s+(?:it\\s+)?verbatim|\\bverbatim\\b|\\becho\\s+back\\b|\\bcopy\\s+verbatim\\b|\\bquoted text\\b|\\bwithout\\s+analyzing\\b|\\bdo\\s+not\\s+analyze\\b|\\bdon'?t\\s+analyze\\b|原样返回|原样发给我|原样发给|原样输出|原文照抄|照抄|只返回|仅返回|逐字|不分析|不要分析|无需分析)/iu;\n\n/** A negation clause whose cue words describe what *not* to do. */\nconst NEGATED_CUE_CLAUSE =\n /(?:\\b(?:without|do\\s+not|don'?t|never|no\\s+need\\s+to)\\s+(?:\\w+\\s+){0,2}(?:analy\\w*|prov\\w*|architect\\w*|design\\w*|audit\\w*|refactor\\w*|optimiz\\w*)|不(?:必|用|要)?(?:分析|证明|设计|重构|审计)|无需(?:分析|证明|设计|重构|审计))/giu;\n\n/** One quoted literal payload: ASCII or typographic quotation, backticks. */\nconst QUOTED_LITERAL = /\"[^\"\\n]*\"|'[^'\\n]*'|`[^`\\n]*`|“[^”\\n]*”|「[^」\\n]*」/gu;\n\n/** Placeholder substituted for a stripped quoted payload. */\nexport const QUOTED_LITERAL_PLACEHOLDER = '[quoted literal]';\n\n/** Result of removing restatement noise from one turn input. */\nexport interface CleanedEffortTask {\n /** The input with negation clauses and (for restatements) quoted payloads removed. */\n text: string;\n /** Whether the input asks for a literal restatement or echo. */\n verbatim: boolean;\n /** Quoted payloads that were stripped, longest first. */\n quoted: string[];\n}\n\n/**\n * Strip the parts of a turn input that can only mislead a depth classifier.\n *\n * Two independent cleanups, both evidence-driven:\n *\n * 1. Negation clauses (`without analyzing`, `不要分析`, ...) are removed\n * unconditionally: the words inside them name what the turn does *not* ask\n * for, so scoring them as depth cues is a pure false positive.\n * 2. When the turn is a restatement instruction, quoted payloads are replaced by\n * a neutral placeholder. The quoted words are data the model must echo, not\n * work it must reason about — P9's six deep-looking words are exactly that.\n *\n * @param task - the raw turn input.\n * @returns the cleaned text plus the facts the caller needs to explain it.\n */\nexport function cleanEffortTaskText(task: string): CleanedEffortTask {\n const original = task.trim();\n let text = original.replace(NEGATED_CUE_CLAUSE, ' ');\n const verbatim = VERBATIM_INSTRUCTION.test(original);\n const quoted: string[] = [];\n\n if (verbatim) {\n text = text.replace(QUOTED_LITERAL, (match) => {\n quoted.push(match);\n return ` ${QUOTED_LITERAL_PLACEHOLDER} `;\n });\n }\n\n return { text: text.replace(/\\s+/g, ' ').trim(), verbatim, quoted };\n}\n\n/**\n * Read the cue words and the shape facts of one turn input.\n * @param task - the turn input captured before the request.\n * @returns matched cue words per tier, deduplicated, plus the input length.\n */\nexport function readEffortCues(task: string): EffortCues {\n const cleaned = cleanEffortTaskText(task);\n const text = cleaned.text;\n const lower = text.toLowerCase();\n const cues: EffortCues = { length: text.length, trivial: [], light: [], moderate: [], deep: [] };\n\n for (const tier of CUE_TIE_BREAK) {\n const matched = new Set<string>();\n for (const pattern of CUE_VOCABULARY[tier]) {\n // A fresh lastIndex per call: a shared /g regex would carry state across turns.\n pattern.lastIndex = 0;\n for (const match of lower.matchAll(pattern)) {\n const word = match[0].trim();\n if (word.length > 0) matched.add(word);\n }\n }\n cues[tier] = [...matched];\n }\n\n if (cleaned.verbatim) {\n // The turn's real work is a copy, whatever words the payload contained. Any\n // depth cue that survived the cleanup came from the instruction's own\n // phrasing, and is not evidence about the task.\n cues.moderate = [];\n cues.deep = [];\n cues.light = [];\n cues.trivial = ['verbatim restatement'];\n }\n\n return cues;\n}\n\n/** One tier's vote. */\nexport interface EffortCueVote {\n level: AdaptiveEffortLevel;\n tier: keyof typeof CUE_WEIGHTS;\n score: number;\n total: number;\n basis: string[];\n /** The tier's level before it was projected into the model's candidate set. */\n decided?: AdaptiveEffortLevel;\n}\n\n/**\n * Decide one turn's effort from cue words alone.\n *\n * Deterministic by construction: tier weights, then the cheap shape facts\n * (a very short input that asks nothing else, a diff-sized input), then a fixed\n * tie-break that prefers more thinking. This is the fail-safe path, so it must\n * never depend on a backend, a clock, or a random source.\n *\n * @param cues - cue words of one turn input.\n * @param fallback - level used when no tier matches at all.\n * @param efforts - effort ids the routed model declares; omitted keeps the whole ladder.\n * @returns the winning level, its tier, and the evidence behind it.\n */\nexport function classifyByCues(\n cues: EffortCues,\n fallback: AdaptiveEffortLevel = 'medium',\n efforts?: readonly string[]\n): EffortCueVote {\n const scores: Record<keyof typeof CUE_WEIGHTS, number> = {\n trivial: CUE_WEIGHTS.trivial * cues.trivial.length,\n light: CUE_WEIGHTS.light * cues.light.length,\n moderate: CUE_WEIGHTS.moderate * cues.moderate.length,\n deep: CUE_WEIGHTS.deep * cues.deep.length\n };\n\n const totalCues = cues.trivial.length + cues.light.length + cues.moderate.length + cues.deep.length;\n if (cues.length > 0 && cues.length <= 24 && cues.light.length === 0 && cues.moderate.length === 0 && cues.deep.length === 0) {\n // \"ok go ahead\" is an instruction, not a task; it needs no reasoning budget.\n scores.trivial += 2;\n }\n if (cues.length > 600 && cues.deep.length === 0) {\n // A pasted diff or log is ordinary work with a large payload.\n scores.moderate += 1;\n }\n\n const total = scores.trivial + scores.light + scores.moderate + scores.deep;\n if (total === 0 || totalCues === 0) {\n const level = nearestCandidate(fallback, adaptiveCandidateLevels(efforts));\n return { level, tier: 'moderate', score: 0, total: 0, basis: [], decided: fallback };\n }\n\n let winner: keyof typeof CUE_WEIGHTS = 'moderate';\n for (const tier of CUE_TIE_BREAK) {\n if (scores[tier] > scores[winner]) winner = tier;\n }\n\n const decided = TIER_LEVEL[winner];\n return {\n level: nearestCandidate(decided, adaptiveCandidateLevels(efforts)),\n tier: winner,\n score: scores[winner],\n total,\n basis: cues[winner].slice(0, 8),\n decided\n };\n}\n\n/**\n * Build the System 1 choice request for one turn input.\n *\n * The candidate options are the routed model's own levels (see\n * {@link buildEffortChoiceOptions}), and the question is the cleaned turn input\n * (see {@link cleanEffortTaskText}). The context stays neutral on purpose: the\n * old implementation pasted the raw matched keyword list into\n * `reasoning depth cues in this task: architecture algorithm proof ...`, which\n * handed a keyword-scoring backend the exact words the cleanup had just removed\n * — the second half of the P9 regression.\n *\n * @param task - the turn input captured before the request.\n * @param cues - its cue words (already cleaned).\n * @param efforts - effort ids the routed model declares; omitted keeps the whole ladder.\n * @returns the question and the level candidates.\n */\nexport function buildEffortChoice(task: string, cues: EffortCues, efforts?: readonly string[]): ChoiceRequest {\n const cleaned = cleanEffortTaskText(task);\n const question =\n cleaned.text.length > 0 ? cleaned.text.slice(0, EFFORT_QUESTION_CHARS) : 'the agent received no new instruction this turn';\n const options = buildEffortChoiceOptions(efforts);\n\n let context: string | undefined;\n if (cleaned.verbatim) {\n context =\n `${QUOTED_LITERAL_PLACEHOLDER} marks a quoted payload the task only asks to restate; judge the instruction, not the quoted words.`;\n } else if (efforts !== undefined && efforts.length > 0) {\n // The candidate levels are already the head of every option below, so the\n // context only has to say *that* the choice is bounded — naming them again\n // would reward whichever description happens to spell a level out.\n context = 'the routed model offers a bounded set of reasoning levels; choose the one this turn needs';\n }\n\n return {\n question,\n options,\n ...(context === undefined ? {} : { context })\n };\n}\n\n/**\n * Read the level out of one candidate option.\n * @param option - an option produced by {@link EFFORT_CHOICE_OPTIONS}.\n * @returns the level id, or `undefined` for a foreign or malformed option.\n */\nexport function levelOfChoiceOption(option: string): AdaptiveEffortLevel | undefined {\n const head = option.trim().split(/\\s+/, 1)[0]?.toLowerCase();\n return isAdaptiveEffortLevel(head) ? head : undefined;\n}\n\n/** Options of {@link EffortInterceptor}. */\nexport interface EffortInterceptorOptions {\n /** Deployment `reasoningEffort`: the adaptive trigger marker. */\n setting?: ReasoningEffortSetting;\n /**\n * Deployment `effort.enabled` switch; `false` makes the whole interceptor\n * inert. Defaults to `true`, which is why an activation that never asked for\n * the switch behaves exactly as it did before it existed.\n */\n enabled?: boolean;\n /** Level used when no cue matches; defaults to `medium`. */\n fallback?: AdaptiveEffortLevel;\n /** Minimum System 1 confidence for its answer to be trusted; defaults to 0.3. */\n minConfidence?: number;\n /** System 1 choice execution. */\n decide: EffortDecider;\n /** Backend name recorded in the ledger. */\n backendName: string;\n /** Audit sink; one `effort-decision` entry per adaptive decision. */\n ledger?: DecisionLedger;\n /** Status feed the decision is published to. */\n feed?: EffortStatusFeed;\n /** Monotonic clock, injectable for tests. */\n now?: () => number;\n}\n\n/**\n * The live deployment policy of one {@link EffortInterceptor}.\n *\n * The same shape the activation resolves at startup. A config-only settings\n * save replaces this whole object (see {@link EffortInterceptor.updatePolicy}),\n * so every read on the request path answers with the value currently in force\n * without re-running the schema.\n */\nexport interface EffortPolicy {\n /** Whether adaptive effort may decide anything. */\n enabled: boolean;\n /** The adaptive trigger marker; absent means no deployment-level policy. */\n setting?: ReasoningEffortSetting;\n /** Level used when neither System 1 nor the cue classifier has evidence. */\n fallback: AdaptiveEffortLevel;\n /** Minimum System 1 confidence for its answer to be trusted. */\n minConfidence: number;\n /** Backend name recorded in the ledger; follows a live backend swap. */\n backendName?: string;\n}\n\n/**\n * Turns one request's marker into a rewritten reasoning effort.\n *\n * The interceptor is the whole policy in one place: it recognises the trigger,\n * asks System 1, falls back to cues, projects onto the route, audits, and\n * publishes. It never throws: a broken backend, a hostile option list, or a\n * failing ledger must not be able to veto an agent turn.\n *\n * The policy is mutable on purpose. The Cordis loader commits a config-only\n * save into this activation's volatile references without remounting the\n * plugin, so a restart is not available to rebuild this object; {@link updatePolicy}\n * swaps the values and every consumer — the request interception, the model\n * selector surface, the panel — reads the new ones on its next access.\n */\nexport class EffortInterceptor {\n #policy: EffortPolicy;\n /** Bumped on every policy change, so an in-turn cached decision is not reused across it. */\n #generation = 0;\n\n #decide: EffortDecider;\n #backendName: string;\n #ledger: DecisionLedger | undefined;\n #feed: EffortStatusFeed | undefined;\n #now: () => number;\n\n /**\n * @param options - deployment setting, System 1 seam, and audit sinks.\n */\n constructor(options: EffortInterceptorOptions) {\n this.#policy = {\n enabled: options.enabled ?? true,\n ...(options.setting === undefined ? {} : { setting: options.setting }),\n fallback: options.fallback ?? 'medium',\n minConfidence: options.minConfidence ?? 0.3\n };\n this.#decide = options.decide;\n this.#backendName = options.backendName;\n this.#ledger = options.ledger;\n this.#feed = options.feed;\n this.#now = options.now ?? (() => performance.now());\n }\n\n /** The policy currently in force. */\n get policy(): Readonly<EffortPolicy> {\n return this.#policy;\n }\n\n /** Monotonic version of the policy; equal across an unchanged request path. */\n get generation(): number {\n return this.#generation;\n }\n\n /** Deployment `reasoningEffort` marker; the deployment-level adaptive policy. */\n get setting(): ReasoningEffortSetting | undefined {\n return this.#policy.setting;\n }\n\n /**\n * The deployment switch. When `false` this interceptor decides nothing: no\n * System 1 round trip, no cue vote, no ledger entry, no status, and no rewrite\n * — only the marker is cleared, because it is an intent no adapter accepts.\n */\n get enabled(): boolean {\n return this.#policy.enabled;\n }\n\n /** Level used when no cue matches. */\n get fallback(): AdaptiveEffortLevel {\n return this.#policy.fallback;\n }\n\n /** Minimum System 1 confidence for its answer to be trusted. */\n get minConfidence(): number {\n return this.#policy.minConfidence;\n }\n\n /**\n * Replace the live policy after a config-only save.\n *\n * O(1) and allocation-light: this is the whole hot-path contract of a live\n * settings edit. The next request reads these fields directly; no schema is\n * parsed on the request path.\n * @param policy - the freshly resolved `effort` block.\n */\n updatePolicy(policy: EffortPolicy): void {\n this.#policy = {\n enabled: policy.enabled,\n ...(policy.setting === undefined ? {} : { setting: policy.setting }),\n fallback: policy.fallback,\n minConfidence: policy.minConfidence\n };\n if (policy.backendName !== undefined) this.#backendName = policy.backendName;\n this.#generation += 1;\n }\n\n /** Whether this activation has an adaptive policy to apply at all. */\n get adaptive(): boolean {\n return this.enabled && this.setting !== undefined;\n }\n\n /**\n * Decide what one request should carry.\n * @param context - resolved request, routed target, turn input, and attribution.\n * @returns the rewrite instruction, plus the audit status when a decision was taken.\n */\n async resolve(context: EffortRequestContext): Promise<EffortResolution> {\n const { requested } = context;\n\n if (!this.enabled) {\n // The switch is off, so this layer has no policy left: a concrete level or\n // a silent request is passed through untouched (the deployment asked for\n // the effort plumbing to stay out of the way), and a marker is *cleared*\n // rather than translated. Clearing is the safe fallback the adapter\n // boundary needs — the request lands on the provider's own default, and\n // the plugin's marker can never reach a provider that never heard of it.\n if (isEffortTrigger(requested)) return { changed: true, outcome: 'cleared' };\n return { changed: false, outcome: 'passthrough' };\n }\n\n if (isEffortTrigger(requested)) return this.#decideTurn('request', context);\n if (requested === undefined && isEffortTrigger(this.setting)) return this.#decideTurn('config', context);\n\n // Anything else is the caller's own business: an explicit concrete level is\n // passed through untouched, and only alignment onto the routed target's\n // vocabulary is applied, exactly as it was before this interceptor existed.\n // The outcome stays `passthrough` even when alignment moved the level: this\n // is not an adaptive decision, and the observation S3 asks for — \"is the\n // adaptive strategy still producing levels the model cannot answer?\" — is\n // read from the *decision* path's outcome, where `snapped` now means exactly\n // that a decided level did not exist in the routed model's own set.\n if (requested === undefined) return { changed: false, outcome: 'passthrough' };\n if (!context.probe) return { changed: false, effort: requested, outcome: 'unknown' };\n\n const aligned = await alignReasoningEffort(requested, context.target, context.probe);\n return {\n changed: aligned !== requested,\n ...(aligned === undefined ? {} : { effort: aligned }),\n outcome: 'passthrough'\n };\n }\n\n /**\n * Decide one adaptive turn: resolve the model's own levels, then System 1,\n * then the cue classifier as the fail-safe.\n *\n * The order is the S3 fix. The routed model's declared vocabulary is read\n * *first*; the decision is then taken inside that set, so \"decided `medium`\n * but dispatched `low`\" is no longer a normal outcome. A model that declares\n * no reasoning at all is decided from its cues alone — there is nothing to\n * choose, so the round trip would buy nothing.\n *\n * @param trigger - what asked for the decision.\n * @param context - request context.\n * @returns the rewrite instruction plus the status payload.\n */\n async #decideTurn(trigger: EffortTriggerKind, context: EffortRequestContext): Promise<EffortResolution> {\n const task = context.task ?? '';\n const started = this.#now();\n const support = await resolveSupport(context);\n const efforts = support.kind === 'declared' ? [...support.efforts] : undefined;\n\n if (support.kind === 'none') {\n // The model cannot think, so no System 1 round trip is worth buying: the\n // turn's level is still *reported* — the status row and the audit have to\n // say how deep the turn was — but the request must not carry the key.\n const decision = this.#decideByCues(\n readEffortCues(task),\n started,\n undefined,\n 'target model declares no reasoning; the level is reported but never sent'\n );\n const status = buildEffortStatus(decision, { outcome: 'cleared' }, trigger, context, support);\n this.#publish(decision, status, task);\n\n return { changed: context.requested !== undefined, outcome: 'cleared', trigger, decision, status };\n }\n\n const cues = readEffortCues(task);\n // A restatement instruction is decided by its shape, not by its content: the\n // payload may be unquoted (`原文照抄:design the migration protocol`) and the\n // instruction's own phrasing may survive the negation cleanup (`不要优化…`).\n // Asking a backend to grade those words would re-introduce exactly the P9\n // false positive the cleanup exists to remove, so the cue verdict stands.\n const attempt = cleanEffortTaskText(task).verbatim\n ? { reason: 'the turn is a restatement instruction; the payload is a copy, not work to grade' }\n : await this.#askSystemOne(task, cues, started, efforts);\n const decision = attempt.decision ?? this.#decideByCues(cues, started, efforts, attempt.reason);\n\n const projection = projectWithinSupport(decision.level, support);\n const status = buildEffortStatus(decision, projection, trigger, context, support);\n this.#publish(decision, status, task);\n\n return {\n changed: projection.effort !== context.requested,\n ...(projection.effort === undefined ? {} : { effort: projection.effort }),\n outcome: projection.outcome,\n trigger,\n decision,\n status\n };\n }\n\n /**\n * Ask System 1 for the level, tolerating every failure mode.\n * @param task - turn input.\n * @param cues - its cue words.\n * @param started - monotonic start of the decision.\n * @param efforts - effort ids the routed model declares, when known.\n * @returns the decision, or the diagnosis of why System 1 could not be trusted.\n */\n async #askSystemOne(task: string, cues: EffortCues, started: number, efforts?: readonly string[]): Promise<SystemOneAttempt> {\n let response: ChoiceResponse;\n try {\n response = await this.#decide(buildEffortChoice(task, cues, efforts));\n } catch (error) {\n return { reason: `system-one call failed: ${errorMessage(error)}` };\n }\n\n const option = String(response?.bestOption ?? '');\n const level = levelOfChoiceOption(option);\n if (level === undefined) return { reason: `system-one answered with an unknown option: ${option.slice(0, 40) || '(empty)'}` };\n\n const confidence = Number(response?.confidence);\n if (!Number.isFinite(confidence)) return { reason: `system-one answered without a confidence: ${option.slice(0, 40)}` };\n\n // A tie is not a decision. A backend that scores every option equally\n // answers `1 / candidates`, which for three or more candidates clears the\n // absolute floor while carrying no evidence at all — the winner is then\n // whichever level merely came first in the ladder. Require the answer to\n // beat the uniform baseline outright before it is trusted.\n const candidateCount = adaptiveCandidateLevels(efforts).length;\n const uniform = candidateCount > 1 ? 1 / candidateCount : 0;\n if (confidence < this.minConfidence) {\n return { reason: `system-one confidence ${confidence.toFixed(2)} is below the floor ${this.minConfidence.toFixed(2)}` };\n }\n if (confidence <= uniform) {\n return {\n reason: `system-one confidence ${confidence.toFixed(2)} does not beat the ${candidateCount}-way baseline ${uniform.toFixed(2)}`\n };\n }\n\n return {\n decision: {\n level: nearestCandidate(level, adaptiveCandidateLevels(efforts)),\n source: 'system-one',\n confidence,\n latencyMs: elapsed(this.#now(), started),\n basis: [option.trim().split(/\\s+/, 1)[0] ?? level]\n }\n };\n }\n\n /**\n * Deterministic fail-safe vote.\n * @param cues - cue words of the turn input.\n * @param started - monotonic start of the decision.\n * @param efforts - effort ids the routed model declares, when known.\n * @param reason - why System 1 was not used, when it was tried.\n * @returns the decision.\n */\n #decideByCues(cues: EffortCues, started: number, efforts?: readonly string[], reason?: string): EffortDecision {\n const vote = classifyByCues(cues, this.fallback, efforts);\n const confidence = vote.total > 0 ? Number((vote.score / vote.total).toFixed(4)) : 0;\n\n return {\n level: vote.level,\n source: 'cue-fallback',\n confidence,\n latencyMs: elapsed(this.#now(), started),\n basis: vote.basis,\n ...(reason === undefined ? {} : { degradedReason: reason })\n };\n }\n\n /**\n * Record one decision in the ledger and publish it to the status feed.\n * @param decision - the decision.\n * @param status - its published status.\n * @param task - the turn input the decision saw.\n */\n #publish(decision: EffortDecision, status: ReflexEffortStatus, task: string): void {\n try {\n this.#ledger?.record({\n type: 'effort-decision',\n backend: this.#backendName,\n latencyMs: decision.latencyMs,\n details: {\n goal: task.trim().slice(0, EFFORT_AUDIT_TASK_CHARS) || '(no turn input)',\n level: decision.level,\n applied: status.applied ?? null,\n outcome: status.outcome,\n trigger: status.trigger,\n source: decision.source,\n confidence: decision.confidence,\n basis: decision.basis,\n provider: status.provider,\n model: status.model,\n ...(decision.degradedReason ? { degraded: decision.degradedReason } : {}),\n ...(status.agentId ? { agentId: status.agentId } : {}),\n ...(status.role ? { role: status.role } : {}),\n ...(status.delegationDepth === undefined ? {} : { delegationDepth: status.delegationDepth }),\n ...(status.turn === undefined ? {} : { turn: status.turn }),\n ...(status.step === undefined ? {} : { step: status.step })\n }\n });\n } catch {\n // The ledger is an audit sink; losing an entry must never fail a turn.\n }\n\n try {\n this.#feed?.publish(status);\n } catch {\n // Same for the status feed.\n }\n }\n\n /**\n * The newest published status, for a status bar that polls instead of subscribing.\n * @param agentId - the agent to read; omit for the newest status of any agent.\n * @returns the current status, or `undefined` when nothing was decided yet.\n */\n statusFor(agentId?: string): ReflexEffortStatus | undefined {\n return this.#feed?.latest(agentId);\n }\n\n /** The status feed, when one was supplied. */\n get feed(): EffortStatusFeed | undefined {\n return this.#feed;\n }\n}\n\n/**\n * Outcome of one System 1 attempt: either a trusted decision, or why there is none.\n */\ninterface SystemOneAttempt {\n decision?: EffortDecision;\n reason?: string;\n}\n\n/** Short, single-line rendering of a caught value. */\nfunction errorMessage(error: unknown): string {\n const message = error instanceof Error ? error.message : String(error);\n return message.split('\\n', 1)[0]?.slice(0, 120) || 'unknown error';\n}\n\n/** Milliseconds since a monotonic start, never negative. */\nfunction elapsed(now: number, started: number): number {\n const delta = now - started;\n return Number.isFinite(delta) && delta > 0 ? Math.round(delta) : 0;\n}\n\n/**\n * Compose the published status of one decision.\n * @param decision - the decision.\n * @param projection - what it became on the physical route.\n * @param trigger - what asked for the decision.\n * @param context - request context.\n * @param support - the routed model's declared vocabulary, when it was read.\n * @returns the status payload.\n */\nfunction buildEffortStatus(\n decision: EffortDecision,\n projection: { effort?: string; outcome: EffortOutcome },\n trigger: EffortTriggerKind,\n context: EffortRequestContext,\n support?: ReasoningSupport\n): ReflexEffortStatus {\n const task = context.task?.trim() ?? '';\n const status: ReflexEffortStatus = {\n level: decision.level,\n ...(projection.effort === undefined ? {} : { applied: projection.effort }),\n outcome: projection.outcome,\n trigger,\n source: decision.source,\n confidence: decision.confidence,\n latencyMs: decision.latencyMs,\n provider: context.target.provider,\n model: context.target.model,\n line: '',\n at: Date.now(),\n ...(context.agent?.agentId ? { agentId: context.agent.agentId } : {}),\n ...(context.agent?.role ? { role: context.agent.role } : {}),\n ...(context.agent?.delegationDepth === undefined ? {} : { delegationDepth: context.agent.delegationDepth }),\n ...(context.turn === undefined ? {} : { turn: context.turn }),\n ...(context.step === undefined ? {} : { step: context.step }),\n ...(decision.basis.length === 0 ? {} : { basis: decision.basis }),\n ...(decision.degradedReason ? { degradedReason: decision.degradedReason } : {}),\n ...(task.length === 0 ? {} : { task: task.slice(0, EFFORT_AUDIT_TASK_CHARS) }),\n ...(context.requestedProvider === undefined ? {} : { requestedProvider: context.requestedProvider }),\n ...(context.requestedModel === undefined ? {} : { requestedModel: context.requestedModel }),\n ...(context.switched === undefined ? {} : { switched: context.switched }),\n ...(context.heldForCache === undefined ? {} : { heldForCache: context.heldForCache }),\n ...(support?.kind === 'declared' ? { supportedEfforts: [...support.efforts] } : {}),\n ...(support?.kind === 'none' ? { supportedEfforts: [] } : {})\n };\n\n return { ...status, line: formatEffortStatusLine(status) };\n}\n\n/**\n * Render one status as a single line for a status bar or a log record.\n * @param status - the status payload (its own `line` is ignored).\n * @returns the line, e.g. `reflex effort: medium → medium (system-one 0.62, 3ms) deepseek:reasoner`.\n */\nexport function formatEffortStatusLine(status: Omit<ReflexEffortStatus, 'line'> & { line?: string }): string {\n const applied = status.applied ?? 'none';\n const evidence = status.source === 'system-one' ? `system-one ${status.confidence.toFixed(2)}` : `cue-fallback ${status.confidence.toFixed(2)}`;\n const affinity = status.heldForCache ? ' (cache affinity)' : '';\n return `reflex effort: ${status.level} → ${applied} (${evidence}, ${status.latencyMs}ms) ${status.provider}:${status.model}${affinity}`;\n}\n\n/**\n * Process-local feed of the most recent effort decision per agent.\n *\n * This is the status-bar surface: a carrier (the GUI status row, a session\n * panel, or another plugin) subscribes once and renders {@link line} verbatim,\n * while anything that cannot subscribe can pull {@link latest} or\n * {@link statusLine}. It holds one entry per agent, so a long session cannot\n * grow it without bound.\n */\nexport class EffortStatusFeed {\n /** Most recent status per agent id; `''` is the fallback bucket. */\n readonly #latest = new Map<string, ReflexEffortStatus>();\n readonly #listeners = new Set<(status: ReflexEffortStatus) => void>();\n\n /**\n * Publish one status to every subscriber.\n * @param status - the status payload.\n */\n publish(status: ReflexEffortStatus): void {\n this.#latest.set(status.agentId ?? '', status);\n for (const listener of this.#listeners) {\n try {\n listener(status);\n } catch {\n // One broken carrier must not silence the others, or the decision itself.\n }\n }\n }\n\n /**\n * Subscribe to published statuses.\n * @param listener - receives every status from now on.\n * @returns the unsubscribe function.\n */\n subscribe(listener: (status: ReflexEffortStatus) => void): () => void {\n this.#listeners.add(listener);\n return () => {\n this.#listeners.delete(listener);\n };\n }\n\n /**\n * The latest status, per agent when one is named.\n * @param agentId - agent to read; omitted reads the most recent of any agent.\n * @returns the status, or `undefined` before the first decision.\n */\n latest(agentId?: string): ReflexEffortStatus | undefined {\n if (agentId !== undefined) return this.#latest.get(agentId);\n let newest: ReflexEffortStatus | undefined;\n for (const status of this.#latest.values()) {\n if (!newest || status.at >= newest.at) newest = status;\n }\n return newest;\n }\n\n /**\n * The rendered status bar line.\n * @param agentId - agent to read; omitted reads the most recent of any agent.\n * @returns the line, or `undefined` before the first decision.\n */\n statusLine(agentId?: string): string | undefined {\n return this.latest(agentId)?.line;\n }\n\n /** Forget every published status. Called when the activation is disposed. */\n clear(): void {\n this.#latest.clear();\n this.#listeners.clear();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"effort.js","sourceRoot":"","sources":["../src/effort.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,oBAAoB,EAAmE,MAAM,aAAa,CAAC;AAEpH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC;AAKzF,oDAAoD;AACpD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AAKhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAU,CAAC;AAqB3D,uEAAuE;AACvE,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAExC,+DAA+D;AAC/D,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAE3C,gFAAgF;AAChF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAwC;IAC5E,GAAG,EAAE,oHAAoH;IACzH,GAAG,EAAE,4KAA4K;IACjL,MAAM,EACJ,wOAAwO;IAC1O,IAAI,EAAE,gXAAgX;CACvX,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM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,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YAC3C,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,EAAE;gBAAE,MAAM,GAAG,MAAM,CAAC;QACzD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,OAAgB;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC;IACpC,CAAC;IAED,6EAA6E;IAC7E,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/**\n * Adaptive reasoning-effort interception for one agent turn.\n *\n * A deployment may configure `reasoningEffort: 'reflex'` (alias `'auto'`), or an\n * upstream caller may put either marker on the request itself. A deployment can\n * no longer pin a concrete level: fixed depth belongs to the model selector, so\n * configuration only answers \"should adaptive effort run at all?\". Neither\n * marker is\n * a physical effort id, so the `agent/request` waterfall cannot forward it: this\n * module turns the marker into a per-turn decision taken by the System 1 choice\n * backend (keyword heuristics offline, the Jev endpoint in production) and\n * projects the decided level onto the vocabulary the routed model actually\n * declares.\n *\n * A deterministic cue classifier runs whenever System 1 is unreachable,\n * malformed, or not confident enough to distinguish the levels. It keeps the\n * interceptor total: a decision is always produced, in milliseconds, and the\n * request never fails because System 1 did.\n *\n * Everything here is deliberately free of Cordis and DSH imports. The decision,\n * the projection, and the status feed are pure functions over plain data, so the\n * rewrite rules are directly testable and the request path stays allocation-light.\n */\nimport type { ChoiceRequest, ChoiceResponse, DecisionLedger } from './vendor/harness-reflex/index.js';\n\nimport { alignReasoningEffort, type PhysicalTarget, type ReasoningProbe, type ReasoningSupport } from './router.js';\n\n/**\n * Selectable reasoning-effort ladder, cheapest first. `minimal` and `max` are\n * part of the vocabulary so a physical model that declares them can be snapped\n * to; the adaptive decision itself only ever chooses `off`, `low`, `medium`, or\n * `high`, which every first-party adapter we target understands.\n */\nexport const EFFORT_LEVELS = ['off', 'minimal', 'low', 'medium', 'high', 'max'] as const;\n\n/** One selectable reasoning effort. */\nexport type EffortLevel = (typeof EFFORT_LEVELS)[number];\n\n/** Levels the adaptive decision may choose from. */\nexport const ADAPTIVE_EFFORT_LEVELS = ['off', 'low', 'medium', 'high'] as const;\n\n/** One level the adaptive decision may return. */\nexport type AdaptiveEffortLevel = (typeof ADAPTIVE_EFFORT_LEVELS)[number];\n\n/**\n * Marker asking the plugin to decide this turn's effort itself. `auto` is an\n * accepted alias of `reflex`; both are configurably equivalent to\n * {@link ReasoningEffortSetting}.\n */\nexport const EFFORT_TRIGGERS = ['reflex', 'auto'] as const;\n\n/** The adaptive trigger marker. */\nexport type EffortTrigger = (typeof EFFORT_TRIGGERS)[number];\n\n/**\n * What a deployment may put in `reasoningEffort`: only a trigger marker (decide\n * per turn). A concrete level is a model-selector choice, never a deployment\n * setting — pinning depth from configuration is not supported.\n */\nexport type ReasoningEffortSetting = EffortTrigger;\n\n/** Where one turn's effort came from. */\nexport type EffortSource = 'system-one' | 'cue-fallback';\n\n/** What the decided level became on the physical route. */\nexport type EffortOutcome = 'supported' | 'snapped' | 'cleared' | 'unknown' | 'passthrough';\n\n/** What asked for the decision. */\nexport type EffortTriggerKind = 'request' | 'config';\n\n/** Characters of the turn input handed to System 1 as the question. */\nexport const EFFORT_QUESTION_CHARS = 600;\n\n/**\n * Characters of *earlier turn* context prepended to a continuation reply.\n *\n * Deliberately a separate budget from {@link EFFORT_QUESTION_CHARS}: that one\n * bounds how much of the current turn is shown, this one bounds how much of the\n * session's history is borrowed. Raising the question budget must never widen\n * the history window as a side effect, and a continuation reply's own text is\n * only a few characters — the two limits answer different questions and are\n * kept independent on purpose.\n *\n * The whole decision input of one turn is therefore bounded by\n * `EFFORT_CONTEXT_CHARS + EFFORT_QUESTION_CHARS`, both constants, both known.\n */\nexport const EFFORT_CONTEXT_CHARS = 400;\n\n/** Characters of the turn input kept in the audit surfaces. */\nexport const EFFORT_AUDIT_TASK_CHARS = 160;\n\n/** How many earlier turns of a session may contribute context. Fixed window. */\nexport const EFFORT_CONTEXT_TURNS = 3;\n\n/**\n * Scenario vocabulary of one adaptive level. The first token of every rendered\n * option is the level id, so a backend answer is parsed by prefix; the remaining\n * words are the evidence vocabulary that keyword-scoring backends match against\n * the question. It stays deliberately close to how a human reads a task\n * (\"rename this variable\" versus \"design the migration\"), and it carries the\n * common Chinese phrasings of the same tiers so a bilingual prompt lands on the\n * same level.\n */\nexport const EFFORT_LEVEL_DESCRIPTIONS: Record<AdaptiveEffortLevel, string> = {\n off: 'no thinking needed: greeting acknowledgement chit chat small talk thanks confirmation yes no 你好 您好 谢谢 好的 收到 继续 没问题',\n low: 'minimal thinking: rename typo whitespace formatting lint comment version bump revert reword simple lookup list files read file one liner 改名 重命名 错字 错别字 注释 格式化 简单 查看文件 列出文件',\n medium:\n 'moderate thinking: implement add write update fix change adjust extend wire register support expose test docs config endpoint handler function method class module service component cli api 实现 添加 编写 修改 修复 测试 单元测试 文档 配置 接口 函数 组件 命令行',\n high: 'deep thinking: architecture design security threat concurrency race deadlock performance optimize throughput latency scalability algorithm complexity migration distributed invariant protocol prove proof theorem analyze analysis root cause trade off audit benchmark profile semantics refactor backward compatibility 架构 并发 死锁 性能 优化 吞吐 延迟 迁移 分布式 不变量 证明 定理 根因 权衡 安全审计 语义'\n};\n\n/**\n * Candidate levels System 1 ranks against the turn input, in ladder order.\n *\n * Kept as the deployment-wide default (no model capability known yet). Once the\n * routed model is known, {@link buildEffortChoiceOptions} narrows this to the\n * levels that model actually declares, so the adaptive decision never has to be\n * snapped afterwards.\n */\nexport const EFFORT_CHOICE_OPTIONS: readonly string[] = ADAPTIVE_EFFORT_LEVELS.map(\n (level) => `${level} ${EFFORT_LEVEL_DESCRIPTIONS[level]}`\n);\n\n/** Matched cue words per tier, plus cheap shape facts about the input. */\nexport interface EffortCues {\n /** Characters in the trimmed turn input. */\n length: number;\n /** Ordering words that need no reasoning at all. */\n trivial: string[];\n /** Mechanical edits a smaller model handles as well as a large one. */\n light: string[];\n /** Ordinary implementation work. */\n moderate: string[];\n /** Work whose cost of being wrong justifies the expensive level. */\n deep: string[];\n}\n\n/** One adaptive decision, before it is projected onto a physical route. */\nexport interface EffortDecision {\n level: AdaptiveEffortLevel;\n source: EffortSource;\n /** 0 – 1 confidence of the winning evidence; 0 means nothing matched. */\n confidence: number;\n /** Wall-clock milliseconds the decision cost. */\n latencyMs: number;\n /** Verbatim evidence the decision rested on (matched cue words, or the option). */\n basis: string[];\n /** Set when System 1 answered but the engine still had to fall back to cues. */\n degradedReason?: string;\n}\n\n/** Executes one System 1 choice; matches `DecisionBackend['choice']`. */\nexport type EffortDecider = (request: ChoiceRequest) => Promise<ChoiceResponse>;\n\n/** Agent attribution carried into the audit surfaces. */\nexport interface EffortAgentFacts {\n agentId?: string;\n role?: string;\n delegationDepth?: number;\n}\n\n/** Everything one request needs decided about its reasoning effort. */\nexport interface EffortRequestContext {\n /** Effort the resolved request carries (after the LLM waterfall). */\n requested?: string;\n /** Physical route the rewritten request will reach. */\n target: PhysicalTarget;\n /** Capability lookup for that route; absent leaves the level unprojected. */\n probe?: ReasoningProbe;\n /** Turn input captured on `agent/pre-step`. */\n task?: string;\n /**\n * Task text of earlier turns of this agent, oldest first.\n *\n * Always consulted, inside the fixed window, through\n * {@link composeEffortDecisionInput} (g-063): a short prompt can continue a\n * large task, and a short new instruction can name hard work, so grading text\n * in isolation answers a question the user did not ask. The caller supplies\n * observed turn text — never a session-log structure — keeping routing's ban on\n * depending on the session module's internals intact.\n */\n history?: readonly EffortContextTurn[];\n /**\n * The level the previous decision produced for this agent (g-063).\n *\n * Read from the routing layer's own `lastAdaptiveEffort` fact, which existed\n * since g-056 to recognise a header echo but never reached a decision. It is a\n * prior, not an answer: {@link composeEffortDecisionInput} puts it on the\n * decision input's opening line, and the prompt says it is to be weighed.\n */\n previousLevel?: string;\n agent?: EffortAgentFacts;\n turn?: number;\n step?: number;\n /** Provider the request named before routing, for the status line. */\n requestedProvider?: string;\n /** Model the request named before routing, for the status line. */\n requestedModel?: string;\n /** Whether routing moved the request onto another provider/model. */\n switched?: boolean;\n /** Whether the request stayed on the current model due to prompt-cache affinity. */\n heldForCache?: boolean;\n /**\n * Pre-computed capability result for `target`. Supplying it skips the second\n * probe when the caller already resolved the route's declared vocabulary.\n */\n support?: ReasoningSupport;\n}\n\n/** The rewrite instruction one request produces. */\nexport interface EffortResolution {\n /** Effort the rewritten request must carry; absent clears the key. */\n effort?: string;\n /** Whether the caller must rewrite `reasoningEffort`. */\n changed: boolean;\n outcome: EffortOutcome;\n /** Set when this turn's effort was decided by an adaptive trigger. */\n trigger?: EffortTriggerKind;\n /** The adaptive decision, when one was taken. */\n decision?: EffortDecision;\n /** Status-bar payload, when one was produced. */\n status?: ReflexEffortStatus;\n}\n\n/** One published effort status, shaped for a status bar and for the audit log. */\nexport interface ReflexEffortStatus {\n level: AdaptiveEffortLevel;\n /** Effort actually carried by the rewritten request; absent = cleared. */\n applied?: string;\n outcome: EffortOutcome;\n trigger: EffortTriggerKind;\n source: EffortSource;\n confidence: number;\n latencyMs: number;\n provider: string;\n model: string;\n /** Single-line rendering, ready for a status bar. */\n line: string;\n /** Unix epoch milliseconds of the decision. */\n at: number;\n agentId?: string;\n role?: string;\n delegationDepth?: number;\n turn?: number;\n step?: number;\n /** Verbatim evidence the decision rested on. */\n basis?: string[];\n /** Set when System 1 could not be used. */\n degradedReason?: string;\n /** Turn input excerpt; audit only, never re-sent to a model. */\n task?: string;\n /** Provider named by the request before routing (the virtual one, when routed). */\n requestedProvider?: string;\n /** Model named by the request before routing. */\n requestedModel?: string;\n /** Whether the request actually moved to another provider/model. */\n switched?: boolean;\n /** Whether the model was held to defend upstream prompt-cache affinity. */\n heldForCache?: boolean;\n /** Effort ids the routed model declares; `[]` when it declares none. */\n supportedEfforts?: string[];\n /**\n * Characters of earlier-turn context that went into this decision; absent when\n * the turn was graded on its own text (every new instruction). Present only\n * for a continuation reply, and never above `EFFORT_CONTEXT_CHARS`.\n */\n contextChars?: number;\n /** How many earlier turns that context came from, at most `EFFORT_CONTEXT_TURNS`. */\n contextTurns?: number;\n /**\n * The level the previous decision produced, when this decision was told it\n * (g-063). Absent on a session's first decision and after the prior aged out.\n */\n previousLevel?: string;\n}\n\n/** Whether a value is the adaptive trigger marker. */\nexport function isEffortTrigger(value: string | undefined): value is EffortTrigger {\n return value !== undefined && (EFFORT_TRIGGERS as readonly string[]).includes(value);\n}\n\n/** Whether a value is a level the adaptive decision itself may return. */\nexport function isAdaptiveEffortLevel(value: string | undefined): value is AdaptiveEffortLevel {\n return value !== undefined && (ADAPTIVE_EFFORT_LEVELS as readonly string[]).includes(value);\n}\n\n/**\n * Position of one effort on the shared ladder.\n * @param level - any effort id.\n * @returns the zero-based rank, or -1 when the ladder does not know the id.\n */\nexport function effortRank(level: string): number {\n return (EFFORT_LEVELS as readonly string[]).indexOf(level);\n}\n\n/**\n * Choose the declared effort closest to the decided level.\n *\n * A physical model rarely declares exactly our four levels (DeepSeek, for one,\n * declares `off`, `low`, `high`, and `max`). Rather than letting an absent\n * `medium` collapse onto the provider default, this picks the neighbour on the\n * ladder; an exact tie takes the cheaper side, because the decision already\n * carries the intent and overspending is the failure mode that costs money.\n *\n * @param level - the decided level.\n * @param efforts - effort ids the target declares.\n * @param defaultEffort - the target's declared default, used when no id is rankable.\n * @returns the effort to send, or `undefined` when nothing can be ranked.\n */\nexport function snapEffort(\n level: EffortLevel,\n efforts: readonly string[],\n defaultEffort?: string\n): string | undefined {\n const wanted = EFFORT_LEVELS.indexOf(level);\n let best: string | undefined;\n let bestDistance = Number.POSITIVE_INFINITY;\n\n for (const candidate of efforts) {\n const rank = effortRank(candidate);\n if (rank < 0) continue;\n const distance = Math.abs(rank - wanted);\n if (distance < bestDistance) {\n best = candidate;\n bestDistance = distance;\n }\n }\n\n if (best !== undefined) return best;\n if (defaultEffort !== undefined && efforts.includes(defaultEffort)) return defaultEffort;\n return undefined;\n}\n\n/**\n * Project one decided level onto the routed model's declared vocabulary.\n *\n * - the target declares the level: send it unchanged;\n * - the target declares other levels: slide to the nearest declared neighbour;\n * - the target declares no reasoning at all: clear the key, so a\n * non-thinking model is asked exactly what it can answer;\n * - the capability is unknown (no LLM runtime, or a resolver failure): keep the\n * level and let the adapter decide, as it does for any other route.\n *\n * @param level - the decided level.\n * @param target - the physical route the request will reach.\n * @param probe - optional capability lookup.\n * @returns the effort to send (absent clears the key) and what happened.\n */\nexport async function projectEffort(\n level: EffortLevel,\n target: PhysicalTarget,\n probe?: ReasoningProbe\n): Promise<{ effort?: string; outcome: EffortOutcome }> {\n if (!probe) return { effort: level, outcome: 'unknown' };\n\n let support;\n try {\n support = await probe(target);\n } catch {\n return { effort: level, outcome: 'unknown' };\n }\n\n if (support.kind === 'unknown') return { effort: level, outcome: 'unknown' };\n if (support.kind === 'none') return { outcome: 'cleared' };\n if (support.efforts.includes(level)) return { effort: level, outcome: 'supported' };\n\n const snapped = snapEffort(level, support.efforts, support.defaultEffort);\n return snapped === undefined ? { outcome: 'cleared' } : { effort: snapped, outcome: 'snapped' };\n}\n\n/**\n * Project one decided level that was *already chosen inside* the model's\n * candidate set.\n *\n * Unlike {@link projectEffort} this never snaps silently: a decision taken\n * within the declared vocabulary is `supported` by construction, and only a\n * degenerate declaration (no adaptive id at all) can still need a slide. The\n * distinction is what removes `snapped` from the正常 path: the interceptor now\n * reads the declaration first instead of repairing the answer afterwards.\n *\n * @param level - the decided level.\n * @param support - the routed model's declared vocabulary.\n * @returns the effort to send (absent clears the key) and what happened.\n */\nexport function projectWithinSupport(\n level: AdaptiveEffortLevel,\n support: ReasoningSupport\n): { effort?: string; outcome: EffortOutcome } {\n if (support.kind === 'unknown') return { effort: level, outcome: 'unknown' };\n if (support.kind === 'none') return { outcome: 'cleared' };\n if (support.efforts.includes(level)) return { effort: level, outcome: 'supported' };\n\n const candidates = adaptiveCandidateLevels(support.efforts);\n const near = nearestCandidate(level, candidates);\n if (support.efforts.includes(near)) return { effort: near, outcome: 'supported' };\n\n const snapped = snapEffort(near, support.efforts, support.defaultEffort);\n return snapped === undefined ? { outcome: 'cleared' } : { effort: snapped, outcome: 'snapped' };\n}\n\n/**\n * Read the routed model's declared vocabulary, never throwing.\n * @param context - request context; a pre-computed `support` skips the probe.\n * @returns the declaration, or `unknown` when no probe can answer.\n */\nasync function resolveSupport(context: EffortRequestContext): Promise<ReasoningSupport> {\n if (context.support) return context.support;\n if (!context.probe) return { kind: 'unknown' };\n try {\n return await context.probe(context.target);\n } catch {\n return { kind: 'unknown' };\n }\n}\n\n/**\n * The adaptive levels a model that declares `efforts` can actually be asked for.\n *\n * This is the S3 fix in one function: instead of deciding on the fixed\n * `off/low/medium/high` ladder and snapping the answer afterwards (which made\n * `medium → low` on DeepSeek and `off → low` on GPT a *normal* outcome), the\n * candidate set is derived from the declaration first, so the decision and the\n * dispatched effort are the same value.\n *\n * - no declaration known: the whole adaptive ladder;\n * - a declared level is offered whenever it is an adaptive level (so DeepSeek's\n * `off/low/high` and GPT's `low/medium/high` are used as-is);\n * - a declaration that shares no adaptive id (Say `minimal`/`max` only) is\n * projected onto the nearest adaptive level, so a candidate set always exists.\n *\n * @param efforts - effort ids the routed model declares.\n * @returns candidate levels in ladder order, never empty.\n */\nexport function adaptiveCandidateLevels(efforts?: readonly string[]): AdaptiveEffortLevel[] {\n if (!efforts || efforts.length === 0) return [...ADAPTIVE_EFFORT_LEVELS];\n\n const declared = new Set(efforts);\n const direct = ADAPTIVE_EFFORT_LEVELS.filter((level) => declared.has(level));\n if (direct.length > 0) return direct;\n\n const projected = new Set<AdaptiveEffortLevel>();\n for (const effort of efforts) {\n const rank = effortRank(effort);\n if (rank < 0) continue;\n projected.add(nearestAdaptiveLevel(rank));\n }\n return projected.size === 0 ? [...ADAPTIVE_EFFORT_LEVELS] : ADAPTIVE_EFFORT_LEVELS.filter((level) => projected.has(level));\n}\n\n/**\n * Nearest adaptive level to one ladder rank, preferring the cheaper side.\n * @param rank - rank on {@link EFFORT_LEVELS}.\n * @returns the closest adaptive level.\n */\nfunction nearestAdaptiveLevel(rank: number): AdaptiveEffortLevel {\n let best: AdaptiveEffortLevel = 'medium';\n let bestDistance = Number.POSITIVE_INFINITY;\n for (const level of ADAPTIVE_EFFORT_LEVELS) {\n const distance = Math.abs(effortRank(level) - rank);\n if (distance < bestDistance) {\n best = level;\n bestDistance = distance;\n }\n }\n return best;\n}\n\n/**\n * Project one decided level into a candidate set.\n *\n * An exact member is returned unchanged (the normal case). A level the model\n * does not offer slides to the nearest candidate; an exact tie takes the cheaper\n * side, because the decision already carries the intent and overspending is the\n * failure mode that costs money.\n *\n * @param level - the decided level.\n * @param candidates - candidate levels derived from the model declaration.\n * @returns a member of `candidates`.\n */\nexport function nearestCandidate(level: AdaptiveEffortLevel, candidates: readonly AdaptiveEffortLevel[]): AdaptiveEffortLevel {\n const pool = candidates.length > 0 ? candidates : ADAPTIVE_EFFORT_LEVELS;\n if (pool.includes(level)) return level;\n\n const wanted = effortRank(level);\n let best: AdaptiveEffortLevel = pool[0] ?? level;\n let bestDistance = Number.POSITIVE_INFINITY;\n for (const candidate of pool) {\n const distance = Math.abs(effortRank(candidate) - wanted);\n if (distance < bestDistance) {\n best = candidate;\n bestDistance = distance;\n }\n }\n return best;\n}\n\n/**\n * Render the System 1 candidate options for one model declaration.\n *\n * A level the model does not declare is not silently dropped: its scenarios are\n * absorbed by the neighbouring candidates, so the backend still sees vocabulary\n * for every kind of task. `off` (below the cheapest candidate) is absorbed by\n * the cheapest one — GPT, whose lowest level is `low`, therefore answers `low`\n * for a greeting instead of producing `off → low (snapped)`. `medium`, which\n * sits *between* two declared levels, is absorbed by both neighbours, which is\n * what makes \"ordinary implementation work\" readable as either `low` or `high`\n * on a model that declares `off/low/high`.\n *\n * @param efforts - effort ids the routed model declares.\n * @returns one option per candidate, in ladder order.\n */\nexport function buildEffortChoiceOptions(efforts?: readonly string[]): string[] {\n const candidates = adaptiveCandidateLevels(efforts);\n const cheapest = candidates[0] ?? 'low';\n const absorbed = new Map<AdaptiveEffortLevel, AdaptiveEffortLevel[]>([\n ...candidates.map((level) => [level, [level]] as [AdaptiveEffortLevel, AdaptiveEffortLevel[]])\n ]);\n\n for (const missing of ADAPTIVE_EFFORT_LEVELS) {\n if (candidates.includes(missing)) continue;\n const below = candidates.filter((level) => effortRank(level) < effortRank(missing)).pop();\n const above = candidates.find((level) => effortRank(level) > effortRank(missing));\n if (below === undefined && above === undefined) {\n absorbed.get(cheapest)?.push(missing);\n continue;\n }\n // Below the cheapest candidate: the cheapest one answers for it.\n if (below === undefined) {\n if (above !== undefined) absorbed.get(above)?.push(missing);\n continue;\n }\n absorbed.get(below)?.push(missing);\n // Between two candidates: both neighbours offer it, so its vocabulary stays\n // reachable from either side of the gap.\n if (above !== undefined) absorbed.get(above)?.push(missing);\n }\n\n return candidates.map((level) => {\n const levels = (absorbed.get(level) ?? [level]).slice().sort((left, right) => effortRank(left) - effortRank(right));\n const description = levels.map((entry) => EFFORT_LEVEL_DESCRIPTIONS[entry]).join(' ');\n return `${level} ${description}`;\n });\n}\n\n/** Cue weights: an explicit deep cue outweighs a pile of mechanical ones. */\nconst CUE_WEIGHTS: Record<'trivial' | 'light' | 'moderate' | 'deep', number> = {\n trivial: 3,\n light: 2,\n moderate: 2,\n deep: 3\n};\n\n/** Priority used when two tiers score the same: more thinking wins. */\nconst CUE_TIE_BREAK: readonly (keyof typeof CUE_WEIGHTS)[] = ['deep', 'moderate', 'light', 'trivial'];\n\n/** Tier that decides the level when a tier wins the vote. */\nconst TIER_LEVEL: Record<keyof typeof CUE_WEIGHTS, AdaptiveEffortLevel> = {\n trivial: 'off',\n light: 'low',\n moderate: 'medium',\n deep: 'high'\n};\n\n/** Cue vocabulary. Order inside one tier does not matter; tiers are scored apart. */\nconst CUE_VOCABULARY: Record<'trivial' | 'light' | 'moderate' | 'deep', readonly RegExp[]> = {\n trivial: [\n /\\b(?:hi|hello|hey|yo|thanks|thank you|thx|ok|okay|yes|no|sure|ack|acknowledged|proceed|continue|go ahead|sounds good|got it)\\b/g,\n /(?:你好|您好|谢谢|好的|收到|继续|没问题)/g\n ],\n light: [\n /\\b(?:rename|typo|typos|whitespace|format|formatting|reformat|lint|comment|comments|docstring|version|bump|revert|reword|wording|typos?)\\b/g,\n /\\b(?:list|show)\\s+(?:the\\s+)?files?\\b/g,\n /\\b(?:read|open|cat)\\s+(?:the\\s+)?file\\b/g,\n /\\blook\\s?up\\b/g,\n /\\bone[- ]liner\\b/g,\n /\\bsimple\\b/g,\n /(?:改名|重命名|错字|错别字|注释|格式化|简单|查看文件|列出文件)/g\n ],\n moderate: [\n /\\b(?:implement|add|added|write|update|fix|fixed|change|adjust|extend|wire|register|support|expose|test|tests|docs|documentation|config|configuration|endpoint|handler|function|method|class|module|service|component|cli|api|refactor)\\b/g,\n /(?:实现|添加|编写|修改|修复|测试|单元测试|文档|配置|接口|函数|组件|命令行)/g\n ],\n deep: [\n /\\b(?:architect(?:ure|ural)?|design|security|threat|concurren(?:cy|t)|race condition|deadlock|performance|optimiz(?:e|ation)|throughput|latency|scal(?:e|ability|ing)|algorithm|complexity|migration|migrate|distributed|invariant|protocol|prove|proof|theorem|analy(?:ze|sis)|root cause|trade[- ]?off|audit|benchmark|profile|semantics|debug|backward compatib\\w*)\\b/g,\n /(?:架构|并发|死锁|性能|优化|吞吐|延迟|迁移|分布式|不变量|证明|定理|根因|权衡|安全审计|语义)/g\n ]\n};\n\n/**\n * Instructions that ask for a literal restatement rather than work: \"only return\n * this verbatim\", \"do not analyze it\", `原样返回`, and their kin.\n *\n * P9 is the regression this guards: the payload inside the quotes was scanned as\n * if the task were about architecture, concurrency, and proofs, and the turn was\n * billed at `high` for copying six words.\n */\nconst VERBATIM_INSTRUCTION =\n /(?:\\b(?:only|just)\\s+return|\\breturn\\b[^.;\\n]{0,40}?\\bverbatim|\\brepeat\\s+(?:it\\s+)?verbatim|\\bverbatim\\b|\\becho\\s+back\\b|\\bcopy\\s+verbatim\\b|\\bquoted text\\b|\\bwithout\\s+analyzing\\b|\\bdo\\s+not\\s+analyze\\b|\\bdon'?t\\s+analyze\\b|原样返回|原样发给我|原样发给|原样输出|原文照抄|照抄|只返回|仅返回|逐字|不分析|不要分析|无需分析)/iu;\n\n/** A negation clause whose cue words describe what *not* to do. */\nconst NEGATED_CUE_CLAUSE =\n /(?:\\b(?:without|do\\s+not|don'?t|never|no\\s+need\\s+to)\\s+(?:\\w+\\s+){0,2}(?:analy\\w*|prov\\w*|architect\\w*|design\\w*|audit\\w*|refactor\\w*|optimiz\\w*)|不(?:必|用|要)?(?:分析|证明|设计|重构|审计)|无需(?:分析|证明|设计|重构|审计))/giu;\n\n/** One quoted literal payload: ASCII or typographic quotation, backticks. */\nconst QUOTED_LITERAL = /\"[^\"\\n]*\"|'[^'\\n]*'|`[^`\\n]*`|“[^”\\n]*”|「[^」\\n]*」/gu;\n\n/** Placeholder substituted for a stripped quoted payload. */\nexport const QUOTED_LITERAL_PLACEHOLDER = '[quoted literal]';\n\n/** Result of removing restatement noise from one turn input. */\nexport interface CleanedEffortTask {\n /** The input with negation clauses and (for restatements) quoted payloads removed. */\n text: string;\n /** Whether the input asks for a literal restatement or echo. */\n verbatim: boolean;\n /** Quoted payloads that were stripped, longest first. */\n quoted: string[];\n}\n\n/**\n * Strip the parts of a turn input that can only mislead a depth classifier.\n *\n * Two independent cleanups, both evidence-driven:\n *\n * 1. Negation clauses (`without analyzing`, `不要分析`, ...) are removed\n * unconditionally: the words inside them name what the turn does *not* ask\n * for, so scoring them as depth cues is a pure false positive.\n * 2. When the turn is a restatement instruction, quoted payloads are replaced by\n * a neutral placeholder. The quoted words are data the model must echo, not\n * work it must reason about — P9's six deep-looking words are exactly that.\n *\n * @param task - the raw turn input.\n * @returns the cleaned text plus the facts the caller needs to explain it.\n */\nexport function cleanEffortTaskText(task: string): CleanedEffortTask {\n const original = task.trim();\n let text = original.replace(NEGATED_CUE_CLAUSE, ' ');\n const verbatim = VERBATIM_INSTRUCTION.test(original);\n const quoted: string[] = [];\n\n if (verbatim) {\n text = text.replace(QUOTED_LITERAL, (match) => {\n quoted.push(match);\n return ` ${QUOTED_LITERAL_PLACEHOLDER} `;\n });\n }\n\n return { text: text.replace(/\\s+/g, ' ').trim(), verbatim, quoted };\n}\n\n/**\n * Read the cue words and the shape facts of one turn input.\n * @param task - the turn input captured before the request.\n * @returns matched cue words per tier, deduplicated, plus the input length.\n */\nexport function readEffortCues(task: string): EffortCues {\n const cleaned = cleanEffortTaskText(task);\n const text = cleaned.text;\n const lower = text.toLowerCase();\n const cues: EffortCues = { length: text.length, trivial: [], light: [], moderate: [], deep: [] };\n\n for (const tier of CUE_TIE_BREAK) {\n const matched = new Set<string>();\n for (const pattern of CUE_VOCABULARY[tier]) {\n // A fresh lastIndex per call: a shared /g regex would carry state across turns.\n pattern.lastIndex = 0;\n for (const match of lower.matchAll(pattern)) {\n const word = match[0].trim();\n if (word.length > 0) matched.add(word);\n }\n }\n cues[tier] = [...matched];\n }\n\n if (cleaned.verbatim) {\n // The turn's real work is a copy, whatever words the payload contained. Any\n // depth cue that survived the cleanup came from the instruction's own\n // phrasing, and is not evidence about the task.\n cues.moderate = [];\n cues.deep = [];\n cues.light = [];\n cues.trivial = ['verbatim restatement'];\n }\n\n return cues;\n}\n\n/** Politeness that may surround a continuation without being one. */\nconst CONTINUATION_FILLER = new Set([\n 'ok', 'okay', 'sure', 'yes', 'yeah', 'yep', 'alright', 'right', 'fine', 'great', 'cool', 'good', 'perfect',\n 'go', 'just', 'then', 'please', 'thanks', 'thank', 'you', 'on', 'ahead', 'and',\n '好的', '好', '行', '可以', '没问题', '那就', '就', '嗯', '对', '是的', '收到', '谢谢', '麻烦你', '请', '吧', '来', '做', '了', '的'\n]);\n\n/** Leading filler that may be glued to a Han verb: `那就继续`, `那就按这个来`. */\nconst CONTINUATION_LEAD = ['那就', '就这么'];\n\n/**\n * Multi-word English continuations. Split into tokens these are\n * `go`+`ahead`, `go`+`on`, `carry`+`on`, `keep`+`going`; each word is filler or\n * verb on its own, so the pair is what has to be recognised.\n */\nconst CONTINUATION_PHRASE = /\\b(?:go\\s+(?:ahead|on)|carry\\s+on|keep\\s+going)\\b/iu;\n\n/**\n * Words that *are* the continuation, as opposed to politeness around it.\n *\n * Agreeing — 同意, 赞成, 按这个来 — is the same act as \"continue\": it commits the\n * session to work already described rather than describing new work.\n */\nconst CONTINUATION_VERB = new Set([\n 'continue', 'proceed', 'carry', 'keep', 'going',\n '继续', '接着', '下一步', '按这个', '按这样', '就这么', '照这个', '往下', '同意', '赞成', '可以的'\n]);\n\n/** Longest continuation verb, used to bound the prefix scan. */\nconst CONTINUATION_VERB_MAX = Math.max(...[...CONTINUATION_VERB].map((word) => word.length));\n\n/** Split one reply into content-bearing pieces, dropping punctuation and spacing. */\nfunction replyTokens(text: string): string[] {\n return text\n .toLowerCase()\n .split(/[^\\p{Script=Han}a-z0-9]+/u)\n .filter((token) => token.length > 0);\n}\n\n/**\n * Whether one token is a continuation verb, alone or with trailing filler:\n * `继续`, `继续吧`, `继续做`, `按这个来`, `go`+`ahead` handled at token level.\n */\nfunction isContinuationVerb(token: string): boolean {\n if (CONTINUATION_VERB.has(token)) return true;\n for (const lead of CONTINUATION_LEAD) {\n if (token.startsWith(lead)) return isContinuationVerb(token.slice(lead.length));\n }\n // A Han run may carry trailing filler (\"继续吧\", \"那就继续吧\" splits into\n // \"那就\"+\"继续吧\"): match the longest known prefix whose remainder is all\n // filler, one character at a time. A shorter verb must still be tried when the\n // longest prefix's remainder is not filler, hence the loop rather than a return.\n for (let size = Math.min(token.length, CONTINUATION_VERB_MAX); size > 0; size -= 1) {\n const head = token.slice(0, size);\n if (!CONTINUATION_VERB.has(head)) continue;\n const rest = token.slice(size);\n if (rest.length === 0) return true;\n if (!/\\p{Script=Han}/u.test(rest)) continue;\n if ([...rest].every((char) => CONTINUATION_FILLER.has(char))) return true;\n }\n return false;\n}\n\n/**\n * Whether one turn input is a continuation reply rather than a new instruction.\n *\n * A continuation adds no task information of its own — \"继续\", \"同意\", \"go\n * ahead\" — so grading its few characters in isolation answers a question the\n * user did not ask. The caller decides the level from *what is being continued*\n * instead; see {@link composeEffortDecisionInput}.\n *\n * The rule is word-level rather than one clever pattern: every token must be a\n * continuation verb or filler, and at least one verb must be present. Any other\n * content word — `继续实现 parser`, `go ahead and implement it` — names work this\n * turn, so it is a new instruction and never a continuation. That is what keeps\n * the path from widening beyond the replies it is meant for.\n *\n * `同意` and `按这个来` are not in {@link CUE_VOCABULARY}, so they are named here\n * explicitly: without them the classifier would miss exactly the replies the\n * goal is about, and they would keep being graded as if they were the whole task.\n *\n * @param task - the raw turn input.\n * @returns whether the turn is a continuation reply.\n */\nexport function isContinuationReply(task: string): boolean {\n const text = cleanEffortTaskText(task).text;\n if (text.length === 0) return false;\n const tokens = replyTokens(text);\n if (tokens.length === 0) return false;\n\n // Every token must be filler or a continuation verb, and at least one must be\n // a verb. Filler may sit on either side of it (\"好的,继续\", \"继续吧,那就\"), so\n // the scan only has to reject a foreign word, not order the reply.\n let sawVerb = CONTINUATION_PHRASE.test(text);\n for (const token of tokens) {\n if (isContinuationVerb(token)) sawVerb = true;\n else if (!CONTINUATION_FILLER.has(token)) return false;\n }\n return sawVerb;\n}\n\n/** One earlier turn's text, as the continuation path may consult it. */\nexport interface EffortContextTurn {\n /** That turn's captured task text, already cleaned by the caller or here. */\n text: string;\n}\n\n/**\n * The previous level prefix, as it appears in the decision input.\n *\n * A structured first line rather than a sentence: System 1 is asked which level\n * a turn needs, and the level it chose last turn is a *prior* on that answer,\n * not part of the task. Keeping it on its own line lets the prompt say so, and\n * lets a test assert on it without parsing prose. English on both sides of the\n * page for the same reason the cue vocabulary is: it is read by a backend, not\n * by a user.\n */\nexport const EFFORT_PREVIOUS_LEVEL_PREFIX = '[previous level:';\n\n/**\n * Render the previous level as the decision input's opening line.\n * @param level - the level the previous decision produced.\n * @returns e.g. `[previous level: high]`; empty when there was no previous decision.\n */\nexport function formatPreviousLevelLine(level: string | undefined): string {\n const value = (level ?? '').trim();\n return value.length === 0 ? '' : `${EFFORT_PREVIOUS_LEVEL_PREFIX} ${value}]`;\n}\n\n/**\n * Compose the text one adaptive decision is graded on.\n *\n * **Every turn is graded on three things, in this order** (g-063):\n *\n * 1. the previous level, as a one-line prefix — what the last decision chose;\n * 2. the recent turns, inside the same window as before;\n * 3. this turn's own text, last.\n *\n * It used to be the other way round: a continuation reply (\"继续\", \"同意\") got the\n * history and every other turn got only its own text. That split was wrong for\n * the reason the continuation path was introduced for. A short prompt is not\n * the same thing as a small task — \"继续\" may be continuing a migration — and a\n * *new* instruction can be just as short (\"改成这样\") while the work it names is\n * everything the session has been doing. Grading text in isolation therefore\n * answers a question the user did not ask, whichever branch it happens in.\n *\n * The history is cut from its **end**: the most recent turns are the ones being\n * continued, so when the window overflows the oldest text is what goes first.\n *\n * Every part goes through {@link cleanEffortTaskText}: the history carries the\n * same architecture/proof vocabulary the current turn does, and it is exactly\n * that vocabulary that P9 showed must not leak into a decision as a raw keyword.\n *\n * @param task - the current turn input.\n * @param history - earlier turns of this session, oldest first.\n * @param previousLevel - the level the previous decision produced, when known.\n * @returns the text to grade, and how much history and state were actually used.\n */\nexport function composeEffortDecisionInput(\n task: string,\n history: readonly EffortContextTurn[] = [],\n previousLevel?: string\n): { text: string; contextChars: number; contextTurns: number; previousLevel?: string } {\n const earlier = (level: string): string => (level.trim().length === 0 ? '' : level.trim());\n const fromState = earlier(previousLevel ?? '');\n\n // The current turn is already recorded in the history by the time it is\n // decided (`agent/pre-step` runs first), so it is dropped here: a session's\n // own text must not be counted as its history, or the window would say it\n // used a turn that says nothing new.\n const current = cleanEffortTaskText(task).text;\n // Newest first, bounded by the turn window, then joined oldest-first inside\n // the window so the reading order matches the session's own.\n const recent = history\n .map((turn) => cleanEffortTaskText(turn.text).text)\n .filter((text) => text.length > 0 && text !== current)\n .slice(-EFFORT_CONTEXT_TURNS)\n .reverse();\n\n const kept: string[] = [];\n let budget = EFFORT_CONTEXT_CHARS;\n for (const text of recent) {\n if (budget <= 0) break;\n // A turn longer than what is left contributes its tail: the end of a task\n // description is the part a continuation is most likely about.\n const slice = text.length > budget ? text.slice(text.length - budget) : text;\n kept.push(slice);\n budget -= slice.length + 1; // +1 for the newline joining it to the next entry\n }\n const context = kept.reverse().join('\\n');\n\n const parts = [formatPreviousLevelLine(fromState), context, task].filter((part) => part.length > 0);\n return {\n text: parts.join('\\n'),\n contextChars: context.length,\n contextTurns: kept.length,\n ...(fromState.length === 0 ? {} : { previousLevel: fromState })\n };\n}\n\n/** One tier's vote. */\nexport interface EffortCueVote {\n level: AdaptiveEffortLevel;\n tier: keyof typeof CUE_WEIGHTS;\n score: number;\n total: number;\n basis: string[];\n /** The tier's level before it was projected into the model's candidate set. */\n decided?: AdaptiveEffortLevel;\n}\n\n/**\n * Decide one turn's effort from cue words alone.\n *\n * Deterministic by construction: tier weights, then the cheap shape facts\n * (a very short input that asks nothing else, a diff-sized input), then a fixed\n * tie-break that prefers more thinking. This is the fail-safe path, so it must\n * never depend on a backend, a clock, or a random source.\n *\n * @param cues - cue words of one turn input.\n * @param fallback - level used when no tier matches at all.\n * @param efforts - effort ids the routed model declares; omitted keeps the whole ladder.\n * @returns the winning level, its tier, and the evidence behind it.\n */\nexport function classifyByCues(\n cues: EffortCues,\n fallback: AdaptiveEffortLevel = 'medium',\n efforts?: readonly string[]\n): EffortCueVote {\n const scores: Record<keyof typeof CUE_WEIGHTS, number> = {\n trivial: CUE_WEIGHTS.trivial * cues.trivial.length,\n light: CUE_WEIGHTS.light * cues.light.length,\n moderate: CUE_WEIGHTS.moderate * cues.moderate.length,\n deep: CUE_WEIGHTS.deep * cues.deep.length\n };\n\n const totalCues = cues.trivial.length + cues.light.length + cues.moderate.length + cues.deep.length;\n if (cues.length > 0 && cues.length <= 24 && cues.light.length === 0 && cues.moderate.length === 0 && cues.deep.length === 0) {\n // \"ok go ahead\" is an instruction, not a task; it needs no reasoning budget.\n scores.trivial += 2;\n }\n if (cues.length > 600 && cues.deep.length === 0) {\n // A pasted diff or log is ordinary work with a large payload.\n scores.moderate += 1;\n }\n\n const total = scores.trivial + scores.light + scores.moderate + scores.deep;\n if (total === 0 || totalCues === 0) {\n const level = nearestCandidate(fallback, adaptiveCandidateLevels(efforts));\n return { level, tier: 'moderate', score: 0, total: 0, basis: [], decided: fallback };\n }\n\n let winner: keyof typeof CUE_WEIGHTS = 'moderate';\n for (const tier of CUE_TIE_BREAK) {\n if (scores[tier] > scores[winner]) winner = tier;\n }\n\n const decided = TIER_LEVEL[winner];\n return {\n level: nearestCandidate(decided, adaptiveCandidateLevels(efforts)),\n tier: winner,\n score: scores[winner],\n total,\n basis: cues[winner].slice(0, 8),\n decided\n };\n}\n\n/**\n * Build the System 1 choice request for one turn input.\n *\n * The candidate options are the routed model's own levels (see\n * {@link buildEffortChoiceOptions}), and the question is the cleaned turn input\n * (see {@link cleanEffortTaskText}). The context stays neutral on purpose: the\n * old implementation pasted the raw matched keyword list into\n * `reasoning depth cues in this task: architecture algorithm proof ...`, which\n * handed a keyword-scoring backend the exact words the cleanup had just removed\n * — the second half of the P9 regression.\n *\n * g-063 adds a second neutral clause, and only when the input really opens with\n * the previous level (see {@link composeEffortDecisionInput}): the line says the\n * prior is there to be *considered*, and that a short reply to a larger task, or\n * a new instruction inside a hard session, keeps the depth the session needs.\n * Without that clause a text-reading backend can read `[previous level: high]`\n * as the answer instead of as a hint.\n *\n * @param task - the turn input captured before the request.\n * @param cues - its cue words (already cleaned).\n * @param efforts - effort ids the routed model declares; omitted keeps the whole ladder.\n * @returns the question and the level candidates.\n */\nexport function buildEffortChoice(task: string, cues: EffortCues, efforts?: readonly string[]): ChoiceRequest {\n const cleaned = cleanEffortTaskText(task);\n const question =\n cleaned.text.length > 0 ? cleaned.text.slice(0, EFFORT_QUESTION_CHARS) : 'the agent received no new instruction this turn';\n const options = buildEffortChoiceOptions(efforts);\n\n let context: string | undefined;\n if (cleaned.verbatim) {\n context =\n `${QUOTED_LITERAL_PLACEHOLDER} marks a quoted payload the task only asks to restate; judge the instruction, not the quoted words.`;\n } else if (efforts !== undefined && efforts.length > 0) {\n // The candidate levels are already the head of every option below, so the\n // context only has to say *that* the choice is bounded — naming them again\n // would reward whichever description happens to spell a level out.\n context = 'the routed model offers a bounded set of reasoning levels; choose the one this turn needs';\n }\n\n const clauses: string[] = [];\n if (context !== undefined) clauses.push(context);\n // The prefix line is judged, not obeyed: today's text is the task, the earlier\n // turns and the previous level are only context for it.\n if (hasPreviousLevelPrefix(cleaned.text) || hasPreviousLevelPrefix(task)) {\n clauses.push(\n 'a leading [previous level: …] line is the level the last decision produced; weigh it with the task, do not copy it — a short reply or a short new instruction can still continue hard work'\n );\n }\n\n return {\n question,\n options,\n ...(clauses.length === 0 ? {} : { context: clauses.join('; ') })\n };\n}\n\n/**\n * Whether a decision input opens with the previous-level line.\n * @param text - the composed decision input.\n * @returns whether the structured prefix is present.\n */\nexport function hasPreviousLevelPrefix(text: string): boolean {\n return text.trimStart().startsWith(EFFORT_PREVIOUS_LEVEL_PREFIX);\n}\n\n/**\n * Read the level out of one candidate option.\n * @param option - an option produced by {@link EFFORT_CHOICE_OPTIONS}.\n * @returns the level id, or `undefined` for a foreign or malformed option.\n */\nexport function levelOfChoiceOption(option: string): AdaptiveEffortLevel | undefined {\n const head = option.trim().split(/\\s+/, 1)[0]?.toLowerCase();\n return isAdaptiveEffortLevel(head) ? head : undefined;\n}\n\n/** Options of {@link EffortInterceptor}. */\nexport interface EffortInterceptorOptions {\n /** Deployment `reasoningEffort`: the adaptive trigger marker. */\n setting?: ReasoningEffortSetting;\n /**\n * Deployment `effort.enabled` switch; `false` makes the whole interceptor\n * inert. Defaults to `true`, which is why an activation that never asked for\n * the switch behaves exactly as it did before it existed.\n */\n enabled?: boolean;\n /** Level used when no cue matches; defaults to `medium`. */\n fallback?: AdaptiveEffortLevel;\n /** Minimum System 1 confidence for its answer to be trusted; defaults to 0.3. */\n minConfidence?: number;\n /** System 1 choice execution. */\n decide: EffortDecider;\n /** Backend name recorded in the ledger. */\n backendName: string;\n /** Audit sink; one `effort-decision` entry per adaptive decision. */\n ledger?: DecisionLedger;\n /** Status feed the decision is published to. */\n feed?: EffortStatusFeed;\n /** Monotonic clock, injectable for tests. */\n now?: () => number;\n}\n\n/**\n * The live deployment policy of one {@link EffortInterceptor}.\n *\n * The same shape the activation resolves at startup. A config-only settings\n * save replaces this whole object (see {@link EffortInterceptor.updatePolicy}),\n * so every read on the request path answers with the value currently in force\n * without re-running the schema.\n */\nexport interface EffortPolicy {\n /** Whether adaptive effort may decide anything. */\n enabled: boolean;\n /** The adaptive trigger marker; absent means no deployment-level policy. */\n setting?: ReasoningEffortSetting;\n /** Level used when neither System 1 nor the cue classifier has evidence. */\n fallback: AdaptiveEffortLevel;\n /** Minimum System 1 confidence for its answer to be trusted. */\n minConfidence: number;\n /** Backend name recorded in the ledger; follows a live backend swap. */\n backendName?: string;\n}\n\n/**\n * Turns one request's marker into a rewritten reasoning effort.\n *\n * The interceptor is the whole policy in one place: it recognises the trigger,\n * asks System 1, falls back to cues, projects onto the route, audits, and\n * publishes. It never throws: a broken backend, a hostile option list, or a\n * failing ledger must not be able to veto an agent turn.\n *\n * The policy is mutable on purpose. The Cordis loader commits a config-only\n * save into this activation's volatile references without remounting the\n * plugin, so a restart is not available to rebuild this object; {@link updatePolicy}\n * swaps the values and every consumer — the request interception, the model\n * selector surface, the panel — reads the new ones on its next access.\n */\nexport class EffortInterceptor {\n #policy: EffortPolicy;\n /** Bumped on every policy change, so an in-turn cached decision is not reused across it. */\n #generation = 0;\n\n #decide: EffortDecider;\n #backendName: string;\n #ledger: DecisionLedger | undefined;\n #feed: EffortStatusFeed | undefined;\n #now: () => number;\n\n /**\n * @param options - deployment setting, System 1 seam, and audit sinks.\n */\n constructor(options: EffortInterceptorOptions) {\n this.#policy = {\n enabled: options.enabled ?? true,\n ...(options.setting === undefined ? {} : { setting: options.setting }),\n fallback: options.fallback ?? 'medium',\n minConfidence: options.minConfidence ?? 0.3\n };\n this.#decide = options.decide;\n this.#backendName = options.backendName;\n this.#ledger = options.ledger;\n this.#feed = options.feed;\n this.#now = options.now ?? (() => performance.now());\n }\n\n /** The policy currently in force. */\n get policy(): Readonly<EffortPolicy> {\n return this.#policy;\n }\n\n /** Monotonic version of the policy; equal across an unchanged request path. */\n get generation(): number {\n return this.#generation;\n }\n\n /** Deployment `reasoningEffort` marker; the deployment-level adaptive policy. */\n get setting(): ReasoningEffortSetting | undefined {\n return this.#policy.setting;\n }\n\n /**\n * The deployment switch. When `false` this interceptor decides nothing: no\n * System 1 round trip, no cue vote, no ledger entry, no status, and no rewrite\n * — only the marker is cleared, because it is an intent no adapter accepts.\n */\n get enabled(): boolean {\n return this.#policy.enabled;\n }\n\n /** Level used when no cue matches. */\n get fallback(): AdaptiveEffortLevel {\n return this.#policy.fallback;\n }\n\n /** Minimum System 1 confidence for its answer to be trusted. */\n get minConfidence(): number {\n return this.#policy.minConfidence;\n }\n\n /**\n * Replace the live policy after a config-only save.\n *\n * O(1) and allocation-light: this is the whole hot-path contract of a live\n * settings edit. The next request reads these fields directly; no schema is\n * parsed on the request path.\n * @param policy - the freshly resolved `effort` block.\n */\n updatePolicy(policy: EffortPolicy): void {\n this.#policy = {\n enabled: policy.enabled,\n ...(policy.setting === undefined ? {} : { setting: policy.setting }),\n fallback: policy.fallback,\n minConfidence: policy.minConfidence\n };\n if (policy.backendName !== undefined) this.#backendName = policy.backendName;\n this.#generation += 1;\n }\n\n /** Whether this activation has an adaptive policy to apply at all. */\n get adaptive(): boolean {\n return this.enabled && this.setting !== undefined;\n }\n\n /**\n * Decide what one request should carry.\n * @param context - resolved request, routed target, turn input, and attribution.\n * @returns the rewrite instruction, plus the audit status when a decision was taken.\n */\n async resolve(context: EffortRequestContext): Promise<EffortResolution> {\n const { requested } = context;\n\n if (!this.enabled) {\n // The switch is off, so this layer has no policy left: a concrete level or\n // a silent request is passed through untouched (the deployment asked for\n // the effort plumbing to stay out of the way), and a marker is *cleared*\n // rather than translated. Clearing is the safe fallback the adapter\n // boundary needs — the request lands on the provider's own default, and\n // the plugin's marker can never reach a provider that never heard of it.\n if (isEffortTrigger(requested)) return { changed: true, outcome: 'cleared' };\n return { changed: false, outcome: 'passthrough' };\n }\n\n if (isEffortTrigger(requested)) return this.#decideTurn('request', context);\n if (requested === undefined && isEffortTrigger(this.setting)) return this.#decideTurn('config', context);\n\n // Anything else is the caller's own business: an explicit concrete level is\n // passed through untouched, and only alignment onto the routed target's\n // vocabulary is applied, exactly as it was before this interceptor existed.\n // The outcome stays `passthrough` even when alignment moved the level: this\n // is not an adaptive decision, and the observation S3 asks for — \"is the\n // adaptive strategy still producing levels the model cannot answer?\" — is\n // read from the *decision* path's outcome, where `snapped` now means exactly\n // that a decided level did not exist in the routed model's own set.\n if (requested === undefined) return { changed: false, outcome: 'passthrough' };\n if (!context.probe) return { changed: false, effort: requested, outcome: 'unknown' };\n\n const aligned = await alignReasoningEffort(requested, context.target, context.probe);\n return {\n changed: aligned !== requested,\n ...(aligned === undefined ? {} : { effort: aligned }),\n outcome: 'passthrough'\n };\n }\n\n /**\n * Decide one adaptive turn: resolve the model's own levels, then System 1,\n * then the cue classifier as the fail-safe.\n *\n * The order is the S3 fix. The routed model's declared vocabulary is read\n * *first*; the decision is then taken inside that set, so \"decided `medium`\n * but dispatched `low`\" is no longer a normal outcome. A model that declares\n * no reasoning at all is decided from its cues alone — there is nothing to\n * choose, so the round trip would buy nothing.\n *\n * @param trigger - what asked for the decision.\n * @param context - request context.\n * @returns the rewrite instruction plus the status payload.\n */\n async #decideTurn(trigger: EffortTriggerKind, context: EffortRequestContext): Promise<EffortResolution> {\n const task = context.task ?? '';\n const started = this.#now();\n // Every turn is graded on the previous level, the recent turns and its own\n // text together (g-063). g-053 graded only continuation replies this way,\n // which left a short *new* instruction (\"改成这样\") as undecided as \"继续\".\n const decisionInput = composeEffortDecisionInput(task, context.history, context.previousLevel);\n const graded = decisionInput.text;\n const support = await resolveSupport(context);\n const efforts = support.kind === 'declared' ? [...support.efforts] : undefined;\n\n if (support.kind === 'none') {\n // The model cannot think, so no System 1 round trip is worth buying: the\n // turn's level is still *reported* — the status row and the audit have to\n // say how deep the turn was — but the request must not carry the key.\n const decision = this.#decideByCues(\n readEffortCues(graded),\n started,\n undefined,\n 'target model declares no reasoning; the level is reported but never sent'\n );\n const status = buildEffortStatus(decision, { outcome: 'cleared' }, trigger, context, support, decisionInput);\n this.#publish(decision, status, task);\n\n return { changed: context.requested !== undefined, outcome: 'cleared', trigger, decision, status };\n }\n\n const cues = readEffortCues(graded);\n // A restatement instruction is decided by its shape, not by its content: the\n // payload may be unquoted (`原文照抄:design the migration protocol`) and the\n // instruction's own phrasing may survive the negation cleanup (`不要优化…`).\n // Asking a backend to grade those words would re-introduce exactly the P9\n // false positive the cleanup exists to remove, so the cue verdict stands.\n const attempt = cleanEffortTaskText(task).verbatim\n ? { reason: 'the turn is a restatement instruction; the payload is a copy, not work to grade' }\n : await this.#askSystemOne(graded, cues, started, efforts);\n const decision = attempt.decision ?? this.#decideByCues(cues, started, efforts, attempt.reason);\n\n const projection = projectWithinSupport(decision.level, support);\n const status = buildEffortStatus(decision, projection, trigger, context, support, decisionInput);\n this.#publish(decision, status, task);\n\n return {\n changed: projection.effort !== context.requested,\n ...(projection.effort === undefined ? {} : { effort: projection.effort }),\n outcome: projection.outcome,\n trigger,\n decision,\n status\n };\n }\n\n /**\n * Ask System 1 for the level, tolerating every failure mode.\n * @param task - turn input.\n * @param cues - its cue words.\n * @param started - monotonic start of the decision.\n * @param efforts - effort ids the routed model declares, when known.\n * @returns the decision, or the diagnosis of why System 1 could not be trusted.\n */\n async #askSystemOne(task: string, cues: EffortCues, started: number, efforts?: readonly string[]): Promise<SystemOneAttempt> {\n let response: ChoiceResponse;\n try {\n response = await this.#decide(buildEffortChoice(task, cues, efforts));\n } catch (error) {\n return { reason: `system-one call failed: ${errorMessage(error)}` };\n }\n\n const option = String(response?.bestOption ?? '');\n const level = levelOfChoiceOption(option);\n if (level === undefined) return { reason: `system-one answered with an unknown option: ${option.slice(0, 40) || '(empty)'}` };\n\n const confidence = Number(response?.confidence);\n if (!Number.isFinite(confidence)) return { reason: `system-one answered without a confidence: ${option.slice(0, 40)}` };\n\n // A tie is not a decision. A backend that scores every option equally\n // answers `1 / candidates`, which for three or more candidates clears the\n // absolute floor while carrying no evidence at all — the winner is then\n // whichever level merely came first in the ladder. Require the answer to\n // beat the uniform baseline outright before it is trusted.\n const candidateCount = adaptiveCandidateLevels(efforts).length;\n const uniform = candidateCount > 1 ? 1 / candidateCount : 0;\n if (confidence < this.minConfidence) {\n return { reason: `system-one confidence ${confidence.toFixed(2)} is below the floor ${this.minConfidence.toFixed(2)}` };\n }\n if (confidence <= uniform) {\n return {\n reason: `system-one confidence ${confidence.toFixed(2)} does not beat the ${candidateCount}-way baseline ${uniform.toFixed(2)}`\n };\n }\n\n return {\n decision: {\n level: nearestCandidate(level, adaptiveCandidateLevels(efforts)),\n source: 'system-one',\n confidence,\n latencyMs: elapsed(this.#now(), started),\n basis: [option.trim().split(/\\s+/, 1)[0] ?? level]\n }\n };\n }\n\n /**\n * Deterministic fail-safe vote.\n * @param cues - cue words of the turn input.\n * @param started - monotonic start of the decision.\n * @param efforts - effort ids the routed model declares, when known.\n * @param reason - why System 1 was not used, when it was tried.\n * @returns the decision.\n */\n #decideByCues(cues: EffortCues, started: number, efforts?: readonly string[], reason?: string): EffortDecision {\n const vote = classifyByCues(cues, this.fallback, efforts);\n const confidence = vote.total > 0 ? Number((vote.score / vote.total).toFixed(4)) : 0;\n\n return {\n level: vote.level,\n source: 'cue-fallback',\n confidence,\n latencyMs: elapsed(this.#now(), started),\n basis: vote.basis,\n ...(reason === undefined ? {} : { degradedReason: reason })\n };\n }\n\n /**\n * Record one decision in the ledger and publish it to the status feed.\n * @param decision - the decision.\n * @param status - its published status.\n * @param task - the turn input the decision saw.\n */\n #publish(decision: EffortDecision, status: ReflexEffortStatus, task: string): void {\n try {\n this.#ledger?.record({\n type: 'effort-decision',\n backend: this.#backendName,\n latencyMs: decision.latencyMs,\n details: {\n goal: task.trim().slice(0, EFFORT_AUDIT_TASK_CHARS) || '(no turn input)',\n level: decision.level,\n applied: status.applied ?? null,\n outcome: status.outcome,\n trigger: status.trigger,\n source: decision.source,\n confidence: decision.confidence,\n basis: decision.basis,\n provider: status.provider,\n model: status.model,\n ...(decision.degradedReason ? { degraded: decision.degradedReason } : {}),\n ...(status.agentId ? { agentId: status.agentId } : {}),\n ...(status.role ? { role: status.role } : {}),\n ...(status.delegationDepth === undefined ? {} : { delegationDepth: status.delegationDepth }),\n ...(status.turn === undefined ? {} : { turn: status.turn }),\n ...(status.step === undefined ? {} : { step: status.step }),\n // g-053: the ledger has to show *that* earlier context was used, not\n // just the level that came out of it.\n ...(status.contextChars === undefined ? {} : { contextChars: status.contextChars, contextTurns: status.contextTurns }),\n // g-063: the previous level is part of the evidence, so the ledger has\n // to name the prior the decision was given, not only the text it saw.\n ...(status.previousLevel === undefined ? {} : { previousLevel: status.previousLevel })\n }\n });\n } catch {\n // The ledger is an audit sink; losing an entry must never fail a turn.\n }\n\n try {\n this.#feed?.publish(status);\n } catch {\n // Same for the status feed.\n }\n }\n\n /**\n * The newest published status, for a status bar that polls instead of subscribing.\n * @param agentId - the agent to read; omit for the newest status of any agent.\n * @returns the current status, or `undefined` when nothing was decided yet.\n */\n statusFor(agentId?: string): ReflexEffortStatus | undefined {\n return this.#feed?.latest(agentId);\n }\n\n /** The status feed, when one was supplied. */\n get feed(): EffortStatusFeed | undefined {\n return this.#feed;\n }\n}\n\n/**\n * Outcome of one System 1 attempt: either a trusted decision, or why there is none.\n */\ninterface SystemOneAttempt {\n decision?: EffortDecision;\n reason?: string;\n}\n\n/** Short, single-line rendering of a caught value. */\nfunction errorMessage(error: unknown): string {\n const message = error instanceof Error ? error.message : String(error);\n return message.split('\\n', 1)[0]?.slice(0, 120) || 'unknown error';\n}\n\n/** Milliseconds since a monotonic start, never negative. */\nfunction elapsed(now: number, started: number): number {\n const delta = now - started;\n return Number.isFinite(delta) && delta > 0 ? Math.round(delta) : 0;\n}\n\n/**\n * Compose the published status of one decision.\n * @param decision - the decision.\n * @param projection - what it became on the physical route.\n * @param trigger - what asked for the decision.\n * @param context - request context.\n * @param support - the routed model's declared vocabulary, when it was read.\n * @returns the status payload.\n */\nfunction buildEffortStatus(\n decision: EffortDecision,\n projection: { effort?: string; outcome: EffortOutcome },\n trigger: EffortTriggerKind,\n context: EffortRequestContext,\n support?: ReasoningSupport,\n decisionInput?: { contextChars: number; contextTurns: number; previousLevel?: string }\n): ReflexEffortStatus {\n const task = context.task?.trim() ?? '';\n const status: ReflexEffortStatus = {\n level: decision.level,\n ...(projection.effort === undefined ? {} : { applied: projection.effort }),\n outcome: projection.outcome,\n trigger,\n source: decision.source,\n confidence: decision.confidence,\n latencyMs: decision.latencyMs,\n provider: context.target.provider,\n model: context.target.model,\n line: '',\n at: Date.now(),\n ...(context.agent?.agentId ? { agentId: context.agent.agentId } : {}),\n ...(context.agent?.role ? { role: context.agent.role } : {}),\n ...(context.agent?.delegationDepth === undefined ? {} : { delegationDepth: context.agent.delegationDepth }),\n ...(context.turn === undefined ? {} : { turn: context.turn }),\n ...(context.step === undefined ? {} : { step: context.step }),\n ...(decision.basis.length === 0 ? {} : { basis: decision.basis }),\n ...(decision.degradedReason ? { degradedReason: decision.degradedReason } : {}),\n ...(task.length === 0 ? {} : { task: task.slice(0, EFFORT_AUDIT_TASK_CHARS) }),\n ...(context.requestedProvider === undefined ? {} : { requestedProvider: context.requestedProvider }),\n ...(context.requestedModel === undefined ? {} : { requestedModel: context.requestedModel }),\n ...(context.switched === undefined ? {} : { switched: context.switched }),\n ...(context.heldForCache === undefined ? {} : { heldForCache: context.heldForCache }),\n ...(support?.kind === 'declared' ? { supportedEfforts: [...support.efforts] } : {}),\n ...(support?.kind === 'none' ? { supportedEfforts: [] } : {}),\n // Audit trail of the decision input: how much earlier-turn text the decision\n // actually saw. Absent when the session has no earlier turn to show, so the\n // status keeps the shape it had before g-053 on a cold session.\n ...(decisionInput?.contextChars ? { contextChars: decisionInput.contextChars, contextTurns: decisionInput.contextTurns } : {}),\n // g-063: which level this decision was told about beforehand.\n ...(decisionInput?.previousLevel === undefined ? {} : { previousLevel: decisionInput.previousLevel })\n };\n\n return { ...status, line: formatEffortStatusLine(status) };\n}\n\n/**\n * Render one status as a single line for a status bar or a log record.\n * @param status - the status payload (its own `line` is ignored).\n * @returns the line, e.g. `reflex effort: medium → medium (system-one 0.62, 3ms) deepseek:reasoner`.\n */\nexport function formatEffortStatusLine(status: Omit<ReflexEffortStatus, 'line'> & { line?: string }): string {\n const applied = status.applied ?? 'none';\n const evidence = status.source === 'system-one' ? `system-one ${status.confidence.toFixed(2)}` : `cue-fallback ${status.confidence.toFixed(2)}`;\n const affinity = status.heldForCache ? ' (cache affinity)' : '';\n return `reflex effort: ${status.level} → ${applied} (${evidence}, ${status.latencyMs}ms) ${status.provider}:${status.model}${affinity}`;\n}\n\n/**\n * Process-local feed of the most recent effort decision per agent.\n *\n * This is the status-bar surface: a carrier (the GUI status row, a session\n * panel, or another plugin) subscribes once and renders {@link line} verbatim,\n * while anything that cannot subscribe can pull {@link latest} or\n * {@link statusLine}. It holds one entry per agent, so a long session cannot\n * grow it without bound.\n */\nexport class EffortStatusFeed {\n /** Most recent status per agent id; `''` is the fallback bucket. */\n readonly #latest = new Map<string, ReflexEffortStatus>();\n readonly #listeners = new Set<(status: ReflexEffortStatus) => void>();\n\n /**\n * Publish one status to every subscriber.\n * @param status - the status payload.\n */\n publish(status: ReflexEffortStatus): void {\n this.#latest.set(status.agentId ?? '', status);\n for (const listener of this.#listeners) {\n try {\n listener(status);\n } catch {\n // One broken carrier must not silence the others, or the decision itself.\n }\n }\n }\n\n /**\n * Subscribe to published statuses.\n * @param listener - receives every status from now on.\n * @returns the unsubscribe function.\n */\n subscribe(listener: (status: ReflexEffortStatus) => void): () => void {\n this.#listeners.add(listener);\n return () => {\n this.#listeners.delete(listener);\n };\n }\n\n /**\n * The latest status, per agent when one is named.\n * @param agentId - agent to read; omitted reads the most recent of any agent.\n * @returns the status, or `undefined` before the first decision.\n */\n latest(agentId?: string): ReflexEffortStatus | undefined {\n if (agentId !== undefined) return this.#latest.get(agentId);\n let newest: ReflexEffortStatus | undefined;\n for (const status of this.#latest.values()) {\n if (!newest || status.at >= newest.at) newest = status;\n }\n return newest;\n }\n\n /**\n * The rendered status bar line.\n * @param agentId - agent to read; omitted reads the most recent of any agent.\n * @returns the line, or `undefined` before the first decision.\n */\n statusLine(agentId?: string): string | undefined {\n return this.latest(agentId)?.line;\n }\n\n /** Forget every published status. Called when the activation is disposed. */\n clear(): void {\n this.#latest.clear();\n this.#listeners.clear();\n }\n}\n"]}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one file this plugin is allowed to edit outside its own settings section:
|
|
3
|
+
* the DSH **profile patch layer** (`$DSH_HOME/profiles/<profile>/cordis.patch.yml`,
|
|
4
|
+
* which the Host reports as `profileContext.patchPath`).
|
|
5
|
+
*
|
|
6
|
+
* The edit is deliberately a **line-level text edit**, never a parse-and-dump of
|
|
7
|
+
* the document. That is a safety property, not a shortcut:
|
|
8
|
+
*
|
|
9
|
+
* - the file belongs to the user and may carry `!!js` expressions, comments,
|
|
10
|
+
* anchors, and rows this plugin knows nothing about. A generic YAML round trip
|
|
11
|
+
* would re-emit them at best differently and at worst as inert strings — the
|
|
12
|
+
* Host parses this file with its own dialect, in which `!!js` is *code*. Text
|
|
13
|
+
* that is never interpreted cannot be changed by being written back;
|
|
14
|
+
* - the only thing this module needs to know is *where* the `tool-subagent` row
|
|
15
|
+
* is in the text, which is a question about a line's leading indent and its
|
|
16
|
+
* `id:` key, answerable without a grammar;
|
|
17
|
+
* - when a line-level edit cannot be placed with certainty, the module declines
|
|
18
|
+
* and says why. Refusing to guess is the whole design: nothing it cannot read
|
|
19
|
+
* exactly is ever rewritten.
|
|
20
|
+
*
|
|
21
|
+
* Path resolution, file I/O, and the clock are injected, so the tests drive it
|
|
22
|
+
* against a scratch directory and never touch the user's home.
|
|
23
|
+
*
|
|
24
|
+
* @module dsh-reflex/host-patch
|
|
25
|
+
*/
|
|
26
|
+
/** Environment variables the patch path is resolved from, in order of authority. */
|
|
27
|
+
export declare const PROFILE_DIR_ENV = "DSH_PROFILE_DIR";
|
|
28
|
+
/** Harness home variable, used when the profile directory was not exported. */
|
|
29
|
+
export declare const DSH_HOME_ENV = "DSH_HOME";
|
|
30
|
+
/** Patch file basename inside a profile directory. */
|
|
31
|
+
export declare const PROFILE_PATCH_FILENAME = "cordis.patch.yml";
|
|
32
|
+
/** Profile name variable, used when neither directory nor home is exported. */
|
|
33
|
+
export declare const DSH_PROFILE_ENV = "DSH_PROFILE";
|
|
34
|
+
/** Default profile name, matching the Host's own default. */
|
|
35
|
+
export declare const DEFAULT_PROFILE = "web";
|
|
36
|
+
/**
|
|
37
|
+
* The row this module edits, spelled the way the Host spells it.
|
|
38
|
+
*
|
|
39
|
+
* `id` is the loader entry id the Host mounts the delegation tool under. The
|
|
40
|
+
* package `name:` is deliberately not matched: a patch that re-points the row at
|
|
41
|
+
* another build is still the same entry as far as the loader is concerned.
|
|
42
|
+
*/
|
|
43
|
+
export declare const DELEGATION_ROW_ID = "tool-subagent";
|
|
44
|
+
/** The Host field that publishes `reasoning_effort` on the delegation tool. */
|
|
45
|
+
export declare const MODEL_SELECTION_FIELD = "modelSelection";
|
|
46
|
+
/** The marker comment the added row carries, naming the plugin that added it. */
|
|
47
|
+
export declare const OWNERSHIP_MARKER = "dsh-harness-reflex";
|
|
48
|
+
/**
|
|
49
|
+
* How a patch file was resolved for this Host.
|
|
50
|
+
*
|
|
51
|
+
* `source` says which fact produced the path, so the panel can explain — and so
|
|
52
|
+
* a test can prove nothing fell back to a guessed location silently.
|
|
53
|
+
*/
|
|
54
|
+
export interface PatchPathResolution {
|
|
55
|
+
/** Absolute path the plugin would edit, when one could be resolved. */
|
|
56
|
+
path?: string;
|
|
57
|
+
/** Which fact resolved it, or why it did not. */
|
|
58
|
+
source: typeof PROFILE_DIR_ENV | typeof DSH_HOME_ENV | typeof DSH_PROFILE_ENV | 'default-profile' | 'explicit' | 'unresolved';
|
|
59
|
+
/** Why the path is not authoritative, when it is not. */
|
|
60
|
+
reason?: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Resolve the profile patch file this Host boots from.
|
|
64
|
+
*
|
|
65
|
+
* The profile directory exported to shell tools is the authoritative answer (the
|
|
66
|
+
* Host computes it from the profile it actually loaded); the remaining sources
|
|
67
|
+
* reconstruct it for a Host that did not export it. The last one — the
|
|
68
|
+
* conventional location under the user's home — is a *guess*, which is why
|
|
69
|
+
* {@link PatchPathResolution.source} names it and {@link PatchPathResolution.reason}
|
|
70
|
+
* says so; a caller must not present it as a fact the Host confirmed.
|
|
71
|
+
* @param env - environment to read; defaults to `process.env`.
|
|
72
|
+
* @param home - user home, used only when nothing else is exported.
|
|
73
|
+
* @returns the resolution, with `path` absent when nothing could be resolved.
|
|
74
|
+
*/
|
|
75
|
+
export declare function resolveProfilePatchPath(env?: Record<string, string | undefined>, home?: string): PatchPathResolution;
|
|
76
|
+
/** What {@link planModelSelectionEdit} decided, and the document it produced. */
|
|
77
|
+
export interface PatchEditResult {
|
|
78
|
+
/**
|
|
79
|
+
* - `already-enabled`: the row already asks for the field; nothing to write;
|
|
80
|
+
* - `added-field`: a top-level field was merged into the existing row;
|
|
81
|
+
* - `added-field-after-name`: merged into the row's `name:`-only form (the
|
|
82
|
+
* field must follow `name:` because that row has no `config:` block yet);
|
|
83
|
+
* - `added-row`: the file had no such row, so one was appended;
|
|
84
|
+
* - the `refused-*` outcomes changed nothing and carry a reason.
|
|
85
|
+
*/
|
|
86
|
+
outcome: 'already-enabled' | 'added-field' | 'added-field-after-name' | 'added-row' | 'already-disabled' | 'refused-not-a-sequence' | 'refused-ambiguous-row' | 'refused-unreadable-row';
|
|
87
|
+
/** The rewritten document, present only for the additive outcomes. */
|
|
88
|
+
text?: string;
|
|
89
|
+
/** Single-line reason, for the outcomes that changed nothing. */
|
|
90
|
+
reason?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Plan the one edit this plugin makes to the user's patch.
|
|
94
|
+
*
|
|
95
|
+
* Pure: it returns the exact text to write, or the reason it will not write.
|
|
96
|
+
* Every user byte outside the edited row's span is carried through untouched,
|
|
97
|
+
* including comments, ordering, blank lines, `!!js` expressions, and line endings.
|
|
98
|
+
* @param document - the current patch text (`''` when the file does not exist).
|
|
99
|
+
* @returns the decision and, for the additive outcomes, the rewritten document.
|
|
100
|
+
*/
|
|
101
|
+
export declare function planModelSelectionEdit(document: string): PatchEditResult;
|
|
102
|
+
/** What one attempted edit did, as the panel reports it. */
|
|
103
|
+
export type HostPatchOutcome = PatchEditResult['outcome'] | 'unresolved' | 'write-failed';
|
|
104
|
+
/** Result of {@link enableHostModelSelection}. */
|
|
105
|
+
export interface HostPatchResult {
|
|
106
|
+
/** What happened. */
|
|
107
|
+
outcome: HostPatchOutcome;
|
|
108
|
+
/** Absolute path considered, when one was resolved. */
|
|
109
|
+
path?: string;
|
|
110
|
+
/** Which fact resolved that path. */
|
|
111
|
+
source?: PatchPathResolution['source'];
|
|
112
|
+
/** Single-line reason for the outcomes that changed nothing. */
|
|
113
|
+
reason?: string;
|
|
114
|
+
/** Byte size of the document before the edit (diagnostics). */
|
|
115
|
+
previousBytes?: number;
|
|
116
|
+
/** Backup file written before the edit, when one was. */
|
|
117
|
+
backupPath?: string;
|
|
118
|
+
}
|
|
119
|
+
/** Seams one edit needs; all defaulted in production, all injected in tests. */
|
|
120
|
+
export interface HostPatchOptions {
|
|
121
|
+
/** Absolute patch path; omit to resolve it from the environment. */
|
|
122
|
+
readonly path?: string;
|
|
123
|
+
/** Environment the path is resolved from when `path` is omitted. */
|
|
124
|
+
readonly env?: Record<string, string | undefined>;
|
|
125
|
+
/** User home used by the fallback resolution; defaults to the real one. */
|
|
126
|
+
readonly home?: string;
|
|
127
|
+
/** Clock, for the backup filename. */
|
|
128
|
+
readonly now?: () => number;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Turn `modelSelection` on for the delegation tool in the user's profile patch.
|
|
132
|
+
*
|
|
133
|
+
* The only write this plugin makes outside its own settings section. Each
|
|
134
|
+
* outcome is distinguishable and the function never throws: a patch it cannot
|
|
135
|
+
* edit exactly reports why, and the caller shows that reason rather than
|
|
136
|
+
* pretending the switch is effective.
|
|
137
|
+
* @param options - the path (or the environment it is resolved from) and a clock.
|
|
138
|
+
* @returns what happened, and where.
|
|
139
|
+
*/
|
|
140
|
+
export declare function enableHostModelSelection(options?: HostPatchOptions): HostPatchResult;
|
|
141
|
+
/**
|
|
142
|
+
* Read, without writing, whether the profile patch asks for the field.
|
|
143
|
+
*
|
|
144
|
+
* The panel calls this so its switch reflects the *file* rather than a memory of
|
|
145
|
+
* what this activation wrote: a user who removes the field by hand sees the
|
|
146
|
+
* switch fall back to "off" instead of being told a stale "on".
|
|
147
|
+
* @param options - the path (or the environment it is resolved from).
|
|
148
|
+
* @returns the current state, with the reason when it cannot be read.
|
|
149
|
+
*/
|
|
150
|
+
export declare function inspectHostModelSelection(options?: HostPatchOptions): {
|
|
151
|
+
path?: string;
|
|
152
|
+
source?: PatchPathResolution['source'];
|
|
153
|
+
enabled: boolean;
|
|
154
|
+
/** Why the state cannot be read, when it cannot. */
|
|
155
|
+
reason?: string;
|
|
156
|
+
};
|