dsh-llm-verifier 0.6.6 → 0.6.7

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.
Files changed (64) hide show
  1. package/README.md +1 -0
  2. package/lib/{auto-DzlnuWAr.js → auto-DkUMv8FV.js} +40 -6
  3. package/lib/auto-DkUMv8FV.js.map +1 -0
  4. package/lib/{caller-BUK7OgUs.js → caller-Blp4l--v.js} +27 -6
  5. package/lib/caller-Blp4l--v.js.map +1 -0
  6. package/lib/caller.js +1 -1
  7. package/lib/client.js +8 -0
  8. package/lib/client.js.map +1 -1
  9. package/lib/index.js +299 -8
  10. package/lib/index.js.map +1 -1
  11. package/lib/replay.js +1 -1
  12. package/lib/types/cache.d.ts.map +1 -1
  13. package/lib/types/cache.js +30 -2
  14. package/lib/types/cache.js.map +1 -1
  15. package/lib/types/client-fields.d.ts +1 -0
  16. package/lib/types/client-fields.d.ts.map +1 -1
  17. package/lib/types/client-fields.js +3 -0
  18. package/lib/types/client-fields.js.map +1 -1
  19. package/lib/types/client-i18n.d.ts +6 -0
  20. package/lib/types/client-i18n.d.ts.map +1 -1
  21. package/lib/types/client-i18n.js +4 -0
  22. package/lib/types/client-i18n.js.map +1 -1
  23. package/lib/types/config.d.ts +9 -0
  24. package/lib/types/config.d.ts.map +1 -1
  25. package/lib/types/config.js +2 -0
  26. package/lib/types/config.js.map +1 -1
  27. package/lib/types/index.d.ts +1 -0
  28. package/lib/types/index.d.ts.map +1 -1
  29. package/lib/types/index.js +52 -6
  30. package/lib/types/index.js.map +1 -1
  31. package/lib/types/session.d.ts +12 -3
  32. package/lib/types/session.d.ts.map +1 -1
  33. package/lib/types/session.js +12 -3
  34. package/lib/types/session.js.map +1 -1
  35. package/lib/types/tool-decision.d.ts +45 -0
  36. package/lib/types/tool-decision.d.ts.map +1 -0
  37. package/lib/types/tool-decision.js +32 -0
  38. package/lib/types/tool-decision.js.map +1 -0
  39. package/lib/types/top-logprobs.d.ts.map +1 -1
  40. package/lib/types/top-logprobs.js +29 -8
  41. package/lib/types/top-logprobs.js.map +1 -1
  42. package/lib/types/workspace.d.ts +75 -0
  43. package/lib/types/workspace.d.ts.map +1 -0
  44. package/lib/types/workspace.js +243 -0
  45. package/lib/types/workspace.js.map +1 -0
  46. package/package.json +10 -10
  47. package/scripts/check-harness-types.mjs +114 -0
  48. package/src/cache.test.ts +78 -0
  49. package/src/cache.ts +31 -2
  50. package/src/client-fields.ts +4 -0
  51. package/src/client-i18n.ts +4 -0
  52. package/src/config.test.ts +12 -0
  53. package/src/config.ts +11 -0
  54. package/src/index.test.ts +156 -3
  55. package/src/index.ts +53 -7
  56. package/src/session.ts +12 -3
  57. package/src/tool-decision.test.ts +24 -0
  58. package/src/tool-decision.ts +51 -0
  59. package/src/top-logprobs.test.ts +15 -0
  60. package/src/top-logprobs.ts +28 -6
  61. package/src/workspace.test.ts +195 -0
  62. package/src/workspace.ts +312 -0
  63. package/lib/auto-DzlnuWAr.js.map +0 -1
  64. package/lib/caller-BUK7OgUs.js.map +0 -1
@@ -170,6 +170,23 @@ async function callTopLogprobs(route, model, prompt, maxTokens, reasoningEffort,
170
170
  function resolveCapabilityFile(cacheDir, cwd = process.cwd()) {
171
171
  return join(isAbsolute(cacheDir) ? cacheDir : resolve(cwd, cacheDir), "capabilities-v1.json");
172
172
  }
173
+ /** Replace failures that are a transient lock rather than a verdict about the capability file directory. */
174
+ const TRANSIENT_REPLACE_CODES = /* @__PURE__ */ new Set([
175
+ "EPERM",
176
+ "EACCES",
177
+ "EBUSY"
178
+ ]);
179
+ let replaceOrdinal = 0;
180
+ async function replaceFile(temporary, target) {
181
+ for (let attempt = 1;; attempt += 1) try {
182
+ await rename(temporary, target);
183
+ return;
184
+ } catch (error) {
185
+ const code = error.code;
186
+ if (attempt >= 5 || code === void 0 || !TRANSIENT_REPLACE_CODES.has(code)) throw error;
187
+ await new Promise((resolve) => setTimeout(resolve, attempt * 10));
188
+ }
189
+ }
173
190
  var TopLogprobCapabilityCache = class {
174
191
  file;
175
192
  now;
@@ -231,15 +248,19 @@ var TopLogprobCapabilityCache = class {
231
248
  const key = provider + "\0" + model;
232
249
  this.unsupported.delete(key);
233
250
  if (this.file === void 0) return;
234
- this.writing = this.writing.then(() => this.ensureLoaded()).then(() => {
251
+ const next = this.writing.catch(() => {}).then(() => this.ensureLoaded()).then(() => {
235
252
  this.unsupported.delete(key);
236
253
  return this.writeDocument();
237
- }).catch(() => {});
254
+ });
255
+ this.writing = next;
256
+ next.catch(() => {});
238
257
  }
239
258
  /** Serialize behind hydration so an early mark never clobbers not-yet-loaded entries. */
240
259
  persist() {
241
260
  if (this.file === void 0) return;
242
- this.writing = this.writing.then(() => this.ensureLoaded()).then(() => this.writeDocument()).catch(() => {});
261
+ const next = this.writing.catch(() => {}).then(() => this.ensureLoaded()).then(() => this.writeDocument());
262
+ this.writing = next;
263
+ next.catch(() => {});
243
264
  }
244
265
  async writeDocument() {
245
266
  const snapshot = {
@@ -247,10 +268,10 @@ var TopLogprobCapabilityCache = class {
247
268
  entries: Object.fromEntries(this.unsupported)
248
269
  };
249
270
  await mkdir(dirname(this.file), { recursive: true });
250
- const temporary = this.file + ".tmp-" + process.pid;
271
+ const temporary = this.file + ".tmp-" + process.pid + "-" + ++replaceOrdinal;
251
272
  await writeFile(temporary, JSON.stringify(snapshot), "utf8");
252
273
  try {
253
- await rename(temporary, this.file);
274
+ await replaceFile(temporary, this.file);
254
275
  } catch (error) {
255
276
  await unlink(temporary).catch(() => {});
256
277
  throw error;
@@ -741,4 +762,4 @@ function emptyUsage() {
741
762
  //#endregion
742
763
  export { attachUsage as a, emptyUsage as c, generationClient as d, partialUsage as f, resolveCapabilityFile as g, TopLogprobCapabilityCache as h, addUsage as i, fallbackDeepFreeze as l, requestAttempts as m, GENERATION_TEMPERATURE as n, callVerifier as o, predictScoringChannel as p, RequestLimiter as r, callVerifierText as s, GENERATION_MAX_TOKENS as t, generateCandidate as u };
743
764
 
744
- //# sourceMappingURL=caller-BUK7OgUs.js.map
765
+ //# sourceMappingURL=caller-Blp4l--v.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caller-Blp4l--v.js","names":[],"sources":["../src/top-logprobs.ts","../src/caller.ts"],"sourcesContent":["import type { Context } from '@deepseek-ai/cordis'\nimport { credentialRef } from '@deepseek-ai/dsh-credentials'\nimport { mkdir, readFile, rename, unlink, writeFile } from 'node:fs/promises'\nimport { dirname, isAbsolute, join, resolve } from 'node:path'\nimport type { CompletionLogprobs, TokenAlternative } from './core.ts'\nimport type { UsageStats, VerifierImage } from './caller.ts'\n\n/**\n * The two scoring channels are the logprob expectation (this file) and the explicit tag reply\n * (caller.ts). Upstream has a THIRD one worth knowing about before inventing anything new:\n * when an open-model server does not emit the score tags at all, it prefills the tag itself and\n * constrains the next token to the twenty scale letters, then reads that token's distribution\n * (llm-as-a-verifier `_score_tags_by_prefill`: vLLM/SGLang `continue_final_message` plus\n * `structured_outputs`). That turns ANY OpenAI-compatible server into a distribution-scoring\n * judge, which is strictly more informative than our explicit-tag channel's single sampled letter\n * — it is why upstream can run K=1 and we average repeats instead.\n *\n * NOT implemented here, deliberately: the direct transport below speaks to whichever\n * OpenAI-compatible endpoint a provider declares, and the prefill/grammar parameters are\n * vLLM/SGLang extensions that a normal endpoint rejects. Two preconditions before adding it:\n * (1) the DSH stream adapter exposes prefill or a constrained-decoding option, or the route is\n * known to be a local inference server; (2) the capability probe can detect support at runtime and\n * degrade to explicit tags — NEVER keyed off a provider or model name (AGENTS.md rule 7). If it\n * lands, it belongs in `callTopLogprobs` as an opt-in third mode, and `autoTrackRepeats` could\n * then drop.\n */\nexport interface TopLogprobRoute {\n baseURL: string\n apiKey?: string\n headers?: Record<string, string>\n deepSeekThinking: boolean\n}\nexport interface TopLogprobCompletion extends CompletionLogprobs { usage: UsageStats; scoringMode: 'top-logprobs' }\nexport class TopLogprobsUnsupportedError extends Error { constructor(message: string) { super(message); this.name = 'TopLogprobsUnsupportedError' } }\n/**\n * A provider-level rejection of the direct transport that is not a logprobs\n * capability answer (bad request, auth, quota, malformed body). It downgrades\n * this topic to the DSH stream instead of failing the whole verification.\n */\nexport class TopLogprobsRouteError extends TopLogprobsUnsupportedError { constructor(message: string, readonly status?: number) { super(message); this.name = 'TopLogprobsRouteError' } }\n\nfunction object(value: unknown): Record<string, unknown> | undefined { return typeof value === 'object' && value !== null && !Array.isArray(value) ? value as Record<string, unknown> : undefined }\nfunction text(value: unknown): string | undefined { return typeof value === 'string' && value.trim() ? value.trim() : undefined }\nfunction endpoint(baseURL: string): string { return baseURL.replace(/\\/+$/, '') + '/chat/completions' }\nfunction dataUrl(image: VerifierImage): string { return 'data:' + image.mediaType + ';base64,' + Buffer.from(image.data.buffer, image.data.byteOffset, image.data.byteLength).toString('base64') }\n\nasync function credential(ctx: Context, name: string | undefined): Promise<string | undefined> {\n if (!name) return undefined\n const provider = ctx.get('credentials')\n return (await provider?.resolve(credentialRef(name)))?.value\n}\n\nexport async function resolveTopLogprobRoute(ctx: Context, provider: string): Promise<TopLogprobRoute | undefined> {\n const settings = ctx.get('settings')\n if (provider === 'deepseek-official') {\n const value = settings ? object(settings.get('llm-deepseek' as never)) ?? {} : {}\n const apiKeyEnv = text(value.apiKeyEnv) ?? 'DEEPSEEK_API_KEY'\n const apiKey = await credential(ctx, apiKeyEnv)\n if (!apiKey) return undefined\n return { baseURL: text(value.baseURL) ?? 'https://api.deepseek.com', apiKey, deepSeekThinking: true }\n }\n if (!settings) return undefined\n const root = object(settings.get('llm-pi-ai' as never))\n const profiles = object(root?.providers)\n const profile = object(profiles?.[provider])\n // Only explicitly OpenAI-compatible profiles are safe to serialize directly.\n // Other DSH adapters keep their private protocol and use the explicit-tag fallback.\n if (!profile || profile.api !== 'openai-completions') return undefined\n const baseURL = text(profile.baseURL)\n if (!baseURL || !/^https:\\/\\//i.test(baseURL)) return undefined\n const apiKey = await credential(ctx, text(profile.apiKeyEnv))\n const rawHeaders = object(profile.headers)\n const headers = rawHeaders === undefined ? undefined : Object.fromEntries(Object.entries(rawHeaders).filter((entry): entry is [string, string] => typeof entry[1] === 'string'))\n return { baseURL, ...(apiKey ? { apiKey } : {}), ...(headers ? { headers } : {}), deepSeekThinking: false }\n}\n\nexport async function callTopLogprobs(route: TopLogprobRoute, model: string, prompt: string, maxTokens: number, reasoningEffort: string | undefined, signal?: AbortSignal, images?: readonly VerifierImage[], attempt = 1, temperature = 0.2): Promise<TopLogprobCompletion> {\n const content: string | Record<string, unknown>[] = images?.length ? [{ type: 'text', text: prompt }, ...images.map(image => ({ type: 'image_url', image_url: { url: dataUrl(image) } }))] : prompt\n const thinking = route.deepSeekThinking && reasoningEffort ? reasoningEffort === 'off' ? { thinking: { type: 'disabled' } } : { thinking: { type: 'enabled' }, reasoning_effort: reasoningEffort } : {}\n const response = await fetch(endpoint(route.baseURL), {\n method: 'POST', redirect: 'error', signal,\n headers: { 'content-type': 'application/json', ...(route.apiKey ? { authorization: 'Bearer ' + route.apiKey } : {}), ...route.headers },\n body: JSON.stringify({ model, messages: [{ role: 'user', content }], max_tokens: maxTokens, temperature, logprobs: true, top_logprobs: 20, ...thinking }),\n })\n const raw = await response.text()\n if (!response.ok) {\n const excerpt = raw.slice(0, 1000)\n const message = 'llm-verifier: top_logprobs request failed with HTTP ' + response.status + ': ' + excerpt\n if ([400, 404, 405, 415, 422].includes(response.status) && /logprob|top_logprobs|unsupported|unknown (?:field|parameter)|unrecognized (?:field|parameter)|not support/i.test(excerpt)) throw new TopLogprobsUnsupportedError('provider rejected top_logprobs: HTTP ' + response.status + ' ' + excerpt)\n // Throttling and server faults stay generic so the shared retry wrapper can\n // attempt again; every other rejection downgrades to the DSH stream.\n if (response.status === 408 || response.status === 409 || response.status === 429 || response.status >= 500) throw new Error(message)\n throw new TopLogprobsRouteError(message, response.status)\n }\n let body: Record<string, unknown>\n try { body = object(JSON.parse(raw)) ?? {} } catch { throw new TopLogprobsRouteError('llm-verifier: top_logprobs endpoint returned invalid JSON', response.status) }\n const choices = Array.isArray(body.choices) ? body.choices : []\n const choice = object(choices[0])\n const message = object(choice?.message)\n const answer = typeof message?.content === 'string' ? message.content : ''\n const logprobs = object(choice?.logprobs)\n const rows = Array.isArray(logprobs?.content) ? logprobs.content : []\n if (!rows.length) throw new TopLogprobsUnsupportedError('provider returned no token logprobs')\n const tokens: string[] = []\n const positions: TokenAlternative[][] = []\n for (const rawRow of rows) {\n const row = object(rawRow) ?? {}\n const token = typeof row.token === 'string' ? row.token : ''\n tokens.push(token)\n const top = Array.isArray(row.top_logprobs) ? row.top_logprobs : []\n const alternatives = top.flatMap(value => { const item = object(value); return item && typeof item.token === 'string' && typeof item.logprob === 'number' ? [{ token: item.token, logprob: item.logprob }] : [] })\n if (!alternatives.length && typeof row.logprob === 'number') alternatives.push({ token, logprob: row.logprob })\n positions.push(alternatives)\n }\n const rawUsage = object(body.usage) ?? {}\n const promptDetails = object(rawUsage.prompt_tokens_details) ?? {}\n const completionDetails = object(rawUsage.completion_tokens_details) ?? {}\n const cached = Number(rawUsage.prompt_cache_hit_tokens ?? promptDetails.cached_tokens ?? 0) || 0\n const input = Number(rawUsage.prompt_tokens ?? 0) || 0\n return { text: answer, tokens, positions, scoringMode: 'top-logprobs', usage: { calls: 1, attempts: attempt, retries: attempt - 1, inputTokens: Math.max(0, input - cached), cachedInputTokens: cached, outputTokens: Number(rawUsage.completion_tokens ?? 0) || 0, reasoningTokens: Number(completionDetails.reasoning_tokens ?? 0) || 0 } }\n}\n\n/** Marks older than this are dropped on hydration so a provider that later gains logprobs support is re-probed. */\nexport const CAPABILITY_TTL_MS = 24 * 60 * 60 * 1000\n\ninterface CapabilityDocument { version: 1; entries: Record<string, number> }\n\n/** Resolves the capability memory file beside the score cache inside the topic verifier directory. */\nexport function resolveCapabilityFile(cacheDir: string, cwd = process.cwd()): string {\n const root = isAbsolute(cacheDir) ? cacheDir : resolve(cwd, cacheDir)\n return join(root, 'capabilities-v1.json')\n}\n\n/** Replace failures that are a transient lock rather than a verdict about the capability file directory. */\nconst TRANSIENT_REPLACE_CODES = new Set(['EPERM', 'EACCES', 'EBUSY'])\n\nlet replaceOrdinal = 0\n\nasync function replaceFile(temporary: string, target: string): Promise<void> {\n for (let attempt = 1; ; attempt += 1) {\n try {\n await rename(temporary, target)\n return\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code\n if (attempt >= 5 || code === undefined || !TRANSIENT_REPLACE_CODES.has(code)) throw error\n await new Promise(resolve => setTimeout(resolve, attempt * 10))\n }\n }\n}\n\nexport class TopLogprobCapabilityCache {\n private readonly unsupported = new Map<string, number>()\n private loaded = false\n private hydrating: Promise<void> | undefined\n private writing: Promise<void> = Promise.resolve()\n\n constructor(private readonly file?: string, private readonly now: () => number = Date.now) {}\n\n /** Expired marks are dropped so a provider that later gains logprobs support is re-probed. */\n isUnsupported(provider: string, model: string): boolean {\n const key = provider + '\\0' + model\n const markedAt = this.unsupported.get(key)\n if (markedAt === undefined) return false\n if (this.now() - markedAt > CAPABILITY_TTL_MS) { this.unsupported.delete(key); return false }\n return true\n }\n\n /** Hydrates persisted marks once; in-process marks always win over file contents. */\n async ensureLoaded(): Promise<void> {\n if (this.loaded || this.file === undefined) return\n this.hydrating ??= (async () => {\n try {\n const document = JSON.parse(await readFile(this.file!, 'utf8')) as CapabilityDocument\n const entries = document !== null && typeof document === 'object' && document.version === 1 && typeof document.entries === 'object' && document.entries !== null ? document.entries : {}\n const now = this.now()\n for (const [key, markedAt] of Object.entries(entries)) {\n if (typeof markedAt !== 'number' || !Number.isFinite(markedAt) || markedAt < 0 || now - markedAt > CAPABILITY_TTL_MS) continue\n // Max-merge: never let an older persisted stamp clobber a fresher in-process probe.\n const existing = this.unsupported.get(key)\n if (existing === undefined || existing < markedAt) this.unsupported.set(key, markedAt)\n }\n } catch { /* a missing or unreadable file simply starts empty */ }\n this.loaded = true\n })()\n await this.hydrating\n }\n\n markUnsupported(provider: string, model: string): void {\n this.unsupported.set(provider + '\\0' + model, this.now())\n this.persist()\n }\n\n /**\n * Forget one provider/model mark so the next call re-probes instead of replaying a cached answer.\n *\n * The judge probe exists to answer \"which scoring channel is this judge on\". Replaying a mark\n * written up to {@link CAPABILITY_TTL_MS} ago — possibly under a different provider\n * configuration — would answer a different, stale question. The removal is persisted, so a host\n * restart cannot resurrect the old mark.\n *\n * The delete is repeated INSIDE the serialized write: hydration max-merges the file into memory,\n * so deleting only beforehand would let the very write we schedule put the entry back.\n * @param provider - provider id the mark belongs to.\n * @param model - model id the mark belongs to.\n */\n forget(provider: string, model: string): void {\n const key = provider + '\\0' + model\n this.unsupported.delete(key)\n if (this.file === undefined) return\n const next = this.writing\n .catch(() => {})\n .then(() => this.ensureLoaded())\n .then(() => { this.unsupported.delete(key); return this.writeDocument() })\n this.writing = next\n next.catch(() => { /* capability memory is best-effort */ })\n }\n\n /** Serialize behind hydration so an early mark never clobbers not-yet-loaded entries. */\n private persist(): void {\n if (this.file === undefined) return\n const next = this.writing\n .catch(() => {})\n .then(() => this.ensureLoaded())\n .then(() => this.writeDocument())\n this.writing = next\n next.catch(() => { /* capability memory is best-effort; the next mark rewrites the file */ })\n }\n\n private async writeDocument(): Promise<void> {\n const snapshot: CapabilityDocument = { version: 1, entries: Object.fromEntries(this.unsupported) }\n await mkdir(dirname(this.file!), { recursive: true })\n const temporary = this.file! + '.tmp-' + process.pid + '-' + (++replaceOrdinal)\n await writeFile(temporary, JSON.stringify(snapshot), 'utf8')\n try { await replaceFile(temporary, this.file!) } catch (error) { await unlink(temporary).catch(() => {}); throw error }\n }\n\n /** Resolves once the trailing persistence attempt settles; exposed for tests. */\n flush(): Promise<void> { return this.writing }\n}\n","import { BlockAssembler, ReasoningEffortId, createUserMessage, type ContentBlock, type FinishReason, type LlmRuntime } from '@deepseek-ai/dsh-llm'\nimport * as LlmModule from '@deepseek-ai/dsh-llm'\n\n/**\n * Deep-freeze a call-options graph, leaving any live AbortSignal mutable.\n *\n * The host re-exports its own `deepFreeze` from `@deepseek-ai/dsh-llm` on the 0.1.1 line; the\n * 0.1.5 line moved the helper to `@deepseek-ai/dsh-util-values` and no longer re-exports it, so\n * the fallback below is what actually runs there. Both implementations must carry the same rule\n * (\"leaving live AbortSignal objects mutable\" — the host's own wording), because freezing a\n * signal breaks the transport twice over: Node >= 26.5 initializes the signal's internal event\n * map lazily, so the first `addEventListener` throws \"Cannot assign to read only property\n * 'Symbol(kEvents)'\", and on every Node version the attempt timeout's `controller.abort()` throws\n * the same way on 'Symbol(kAborted)'. The signal belongs to this call's retry loop and is still\n * unsubscribed when the options are frozen, which is what makes the ordering fatal.\n */\nfunction deepFreeze<T>(value: T): T {\n const mod = LlmModule as unknown as Record<string, unknown>\n if (typeof mod.deepFreeze === 'function') {\n return (mod.deepFreeze as Function)(value)\n }\n return fallbackDeepFreeze(value)\n}\n\n/**\n * The graph walk used when the host exports no `deepFreeze`; exported for tests.\n * @param value - value to freeze.\n * @returns The same value, with every reachable enumerable child frozen except live AbortSignals.\n */\nexport function fallbackDeepFreeze<T>(value: T): T {\n // See deepFreeze(): a frozen signal fails on the transport's first subscription.\n if (value instanceof AbortSignal) return value\n if (value && typeof value === 'object' && !Object.isFrozen(value)) {\n Object.freeze(value)\n for (const key of Object.keys(value)) {\n fallbackDeepFreeze((value as Record<string, unknown>)[key])\n }\n }\n return value\n}\nimport type { AttachmentStore } from '@deepseek-ai/dsh-attachment'\nimport type { CompletionLogprobs } from './core.ts'\nimport { TopLogprobCapabilityCache, TopLogprobsUnsupportedError, callTopLogprobs, resolveTopLogprobRoute } from './top-logprobs.ts'\nimport type { Context } from '@deepseek-ai/cordis'\n\nexport interface VerifierClientConfig {\n ctx: Context\n llm: LlmRuntime\n attachments: AttachmentStore\n topLogprobCapabilities: TopLogprobCapabilityCache\n provider: string\n model: string\n /** User-facing judge name for tool output; cosmetic only, never part of the scoring cache identity. */\n label?: string\n reasoningEffort?: string\n maxTokens: number\n temperature: number\n timeoutMs: number\n maxRetries: number\n retryBaseDelayMs: number\n limiter?: RequestLimiter\n}\n\nexport interface VerifierImage {\n data: Uint8Array\n mediaType: 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif'\n}\n\nexport interface UsageStats {\n calls: number\n attempts: number\n retries: number\n inputTokens: number\n cachedInputTokens: number\n outputTokens: number\n reasoningTokens: number\n /**\n * At least one attempt's usage is UNKNOWN (an earlier attempt failed and was retried, or a\n * response came back unusable). The token counts are a floor, never a confident total.\n */\n usageIncomplete?: boolean\n}\n\nexport type ScoringMode = 'top-logprobs' | 'explicit-tag'\nexport interface VerifierCompletion extends CompletionLogprobs {\n usage: UsageStats\n scoringMode: ScoringMode\n /**\n * The direct logprob transport was attempted and the provider rejected it, so this\n * answer came from the explicit-tag fallback. Diagnostics only: it never changes the\n * score, and it is recorded so a silent downgrade is visible in the statistics.\n */\n channelFallback?: boolean\n}\n\n/**\n * Where a finally-failed request records how many attempts it already spent.\n *\n * A failure that never returned usage leaves the tokens UNKNOWN, not zero. The attempt\n * count is the one fact the transport does know, so it is carried on the error itself\n * (the engine catches per-judge errors) instead of being discarded.\n */\nconst REQUEST_ATTEMPTS = Symbol('llm-verifier.requestAttempts')\n\n/** Attempts one failed verifier request already spent; 0 when the error carries none. */\nexport function requestAttempts(error: unknown): number {\n if (typeof error !== 'object' || error === null) return 0\n const value = (error as { [REQUEST_ATTEMPTS]?: unknown })[REQUEST_ATTEMPTS]\n return typeof value === 'number' && Number.isSafeInteger(value) && value > 0 ? value : 0\n}\n\n/**\n * Usage the transport DID return for a response that then turned out unusable.\n *\n * A parse failure or a truncated judge answer happened after the request was billed, so the\n * engine must not fold it into a zero-cost failure. The usage rides on the error next to the\n * attempt count; one error can carry both (a retried call whose final answer also failed).\n */\nconst PARTIAL_USAGE = Symbol('llm-verifier.partialUsage')\n\n/** Usage a completed-but-unusable response already cost; undefined when the error carries none. */\nexport function partialUsage<T = UsageStats>(error: unknown): T | undefined {\n if (typeof error !== 'object' || error === null) return undefined\n const value = (error as { [PARTIAL_USAGE]?: unknown })[PARTIAL_USAGE]\n return typeof value === 'object' && value !== null ? value as T : undefined\n}\n\n/** Attach the usage a completed-but-unusable response already cost to its error. */\nexport function attachUsage(error: unknown, usage: UsageStats): void {\n if (typeof error === 'object' && error !== null) (error as { [PARTIAL_USAGE]?: UsageStats })[PARTIAL_USAGE] = usage\n}\n\n/**\n * An error for a response that came back and was billed but produced no usable verdict.\n *\n * The usage is attached so the failure row reports known requests and tokens instead of zero.\n */\nfunction unusable(reason: string, attempt: number, raw: { inputTokens?: number; outputTokens?: number; cacheReadTokens?: number; cacheWriteTokens?: number; reasoningTokens?: number } | undefined): Error {\n const error = new Error('llm-verifier: ' + reason)\n attachUsage(error, usage(attempt, raw ?? {}))\n return error\n}\n\n/**\n * Describe why a finished stream is unusable.\n *\n * `FinishReason.failure` is the host's SERIALIZABLE facts record (`{message, code, status?,\n * providerRetryAfterMs?, requestId?}`), not the error the adapter threw: `normalizeLlmFailure`\n * detaches the facts at the adapter boundary, so the stack and the cause are already gone before\n * this plugin sees them. The machine code and the provider status ARE carried, and dropping them\n * left the board with one line and no way to tell an auth failure from a transport one.\n */\nfunction failureMessage(finish: FinishReason): string | undefined {\n if (finish.kind === 'error' || finish.kind === 'aborted') {\n const failure = finish.failure\n const facts = [\n failure.code,\n failure.status === undefined ? undefined : 'HTTP ' + failure.status,\n failure.requestId === undefined ? undefined : 'request ' + failure.requestId,\n ].filter((fact): fact is string => typeof fact === 'string' && fact.length > 0)\n return facts.length > 0 ? failure.message + ' [' + facts.join(', ') + ']' : failure.message\n }\n if (finish.kind === 'max-tokens') return 'verifier response reached max tokens before completing its answer'\n return undefined\n}\n\nasync function delay(ms: number, signal?: AbortSignal): Promise<void> {\n if (signal?.aborted) throw signal.reason\n await new Promise<void>((resolve, reject) => {\n const timer = setTimeout(resolve, ms)\n const abort = () => { clearTimeout(timer); reject(signal?.reason) }\n signal?.addEventListener('abort', abort, { once: true })\n })\n}\n\nfunction usage(attempts: number, value = {} as { inputTokens?: number; outputTokens?: number; cacheReadTokens?: number; cacheWriteTokens?: number; reasoningTokens?: number }): UsageStats {\n return { calls: 1, attempts, retries: attempts - 1, inputTokens: value.inputTokens ?? 0, cachedInputTokens: (value.cacheReadTokens ?? 0) + (value.cacheWriteTokens ?? 0), outputTokens: value.outputTokens ?? 0, reasoningTokens: value.reasoningTokens ?? 0 }\n}\n\n/** Transient failures worth another attempt; anything else fails fast. */\nconst RETRYABLE_MESSAGE = /rate|quota|timeout|timed out|temporar|network|fetch|socket|5\\d\\d/i\n\n/**\n * Run one logical verifier request under the configured timeout, retrying\n * transient failures with exponential backoff.\n *\n * Every channel goes through this wrapper — including the direct top_logprobs\n * transport, which used to bypass both the timeout and the retry budget.\n * @param config - resolved verifier client configuration.\n * @param signal - caller's abort signal (tool call or turn boundary).\n * @param run - one attempt; receives its own deadline signal and 1-based attempt number.\n * @returns The first successful completion.\n */\nfunction attachAttempts(error: unknown, attempt: number): void {\n if (typeof error === 'object' && error !== null) (error as { [REQUEST_ATTEMPTS]?: number })[REQUEST_ATTEMPTS] = attempt\n}\n\n/**\n * A fresh error for one aborted call.\n *\n * Never annotate and rethrow the shared `signal.reason`: several concurrent requests share it,\n * and the engine attaches its accumulator to the thrown error, so one object carries several\n * accumulators and they get merged repeatedly. The wrapper preserves the message and name.\n */\nfunction abortFailure(reason: unknown, attempt: number): Error {\n const source = reason instanceof Error ? reason : new Error(reason === undefined ? 'llm-verifier: request aborted' : String(reason))\n const error = new Error(source.message)\n error.name = source.name\n attachAttempts(error, attempt)\n return error\n}\n\n/** Token-only addition: call/attempt counters already describe the logical request. */\nfunction addTokens(target: Pick<UsageStats, 'inputTokens' | 'cachedInputTokens' | 'outputTokens' | 'reasoningTokens'>, source: Pick<UsageStats, 'inputTokens' | 'cachedInputTokens' | 'outputTokens' | 'reasoningTokens'>): void {\n target.inputTokens += source.inputTokens\n target.cachedInputTokens += source.cachedInputTokens\n target.outputTokens += source.outputTokens\n target.reasoningTokens += source.reasoningTokens\n}\n\nasync function retrying<T>(config: VerifierClientConfig, signal: AbortSignal | undefined, run: (signal: AbortSignal, attempt: number) => Promise<T>): Promise<T> {\n let attempt = 0\n // Tokens an earlier attempt already paid for but never delivered a usable result. They are\n // real cost, so they follow the chain into whichever exit happens (success, final failure or\n // cancellation) instead of being discarded when no attempt ultimately succeeds.\n const carried = { inputTokens: 0, cachedInputTokens: 0, outputTokens: 0, reasoningTokens: 0 }\n let unknownFailure = false\n // The usage the chain must be able to report: everything already spent plus this attempt's own\n // billed response. `unknown` (some attempt's tokens never came back) is what makes it a floor.\n const spent = (billed: UsageStats | undefined, unknown: boolean): UsageStats => ({\n calls: billed === undefined ? 0 : billed.calls,\n attempts: attempt,\n retries: Math.max(0, attempt - 1),\n inputTokens: carried.inputTokens + (billed?.inputTokens ?? 0),\n cachedInputTokens: carried.cachedInputTokens + (billed?.cachedInputTokens ?? 0),\n outputTokens: carried.outputTokens + (billed?.outputTokens ?? 0),\n reasoningTokens: carried.reasoningTokens + (billed?.reasoningTokens ?? 0),\n ...(unknown ? { usageIncomplete: true } : {}),\n })\n const cancel = (reason: unknown, billed: UsageStats | undefined, unknown: boolean): never => {\n const error = abortFailure(reason, attempt)\n attachUsage(error, spent(billed, unknown))\n throw error\n }\n while (true) {\n if (signal?.aborted) cancel(signal.reason, undefined, false)\n attempt += 1\n const controller = new AbortController()\n let timedOut = false\n const timeout = setTimeout(() => { timedOut = true; controller.abort(new Error('llm-verifier: request timed out')) }, config.timeoutMs)\n const abort = () => controller.abort(signal?.reason)\n signal?.addEventListener('abort', abort, { once: true })\n try {\n const value = await run(controller.signal, attempt)\n if (typeof value === 'object' && value !== null) {\n const usage = (value as { usage?: UsageStats }).usage\n if (usage !== undefined) {\n addTokens(usage, carried)\n // Only a failed attempt whose tokens never came back makes the total a floor.\n if (unknownFailure) usage.usageIncomplete = true\n }\n }\n return value\n } catch (error) {\n const billed = partialUsage<UsageStats>(error)\n if (signal?.aborted) cancel(signal.reason ?? error, billed, unknownFailure || billed === undefined)\n // A deadline abort is retryable even when the adapter wraps the reason in\n // its own error type with an unrelated message.\n const retryable = timedOut || (error instanceof Error && RETRYABLE_MESSAGE.test(error.message))\n if (attempt > config.maxRetries || !retryable) {\n // Every attempt of the chain goes onto the thrown error: the last response alone would\n // report a fraction of the requests and tokens the invocation really spent.\n if (billed === undefined) unknownFailure = true\n const failure = typeof error === 'object' && error !== null ? error : new Error(String(error))\n attachAttempts(failure, attempt)\n attachUsage(failure, spent(billed, unknownFailure || billed === undefined))\n throw failure\n }\n if (billed === undefined) unknownFailure = true\n else addTokens(carried, billed)\n try {\n await delay(Math.min(30000, config.retryBaseDelayMs * 2 ** (attempt - 1) * (0.8 + Math.random() * 0.4)), signal)\n } catch (waitError) {\n // Cancelled while waiting to retry: the attempts and the tokens already spent are real.\n cancel(signal?.reason ?? waitError, undefined, unknownFailure)\n }\n } finally {\n clearTimeout(timeout)\n signal?.removeEventListener('abort', abort)\n }\n }\n}\n\n/** One attachment per image object per process: retries must not duplicate attachments. */\nconst imageRefs = new WeakMap<VerifierImage, Promise<unknown>>()\n\n/**\n * One plain-text completion through the DSH stream.\n *\n * Shared by the explicit-tag judge path and by best-of-N generation, which differ in exactly one\n * place: a `max-tokens` finish. A truncated JUDGE answer is unusable — its verdict tags may never\n * have been emitted — so it stays a hard error. A truncated DRAFT is still a candidate the operator\n * already paid for, and the judge can see that the text stops mid-sentence and score it accordingly,\n * so generation receives the text plus a `truncated` flag.\n * @param config - resolved verifier client configuration.\n * @param prompt - the rendered prompt.\n * @param signal - the attempt's deadline signal.\n * @param images - attachments to send, if any.\n * @param attempt - 1-based attempt number for usage accounting.\n * @param tolerateTruncation - return the text of a max-tokens finish instead of throwing.\n * @returns The completion (with `truncated`) when it produced text.\n */\nasync function callTextCompletion(config: VerifierClientConfig, prompt: string, signal: AbortSignal | undefined, images: readonly VerifierImage[] | undefined, attempt: number, tolerateTruncation: boolean): Promise<VerifierCompletion & { truncated: boolean }> {\n const content: ContentBlock[] = [{ type: 'text', text: prompt }]\n for (const image of images ?? []) {\n let pending = imageRefs.get(image)\n if (pending === undefined) {\n const promise = Promise.resolve()\n .then(() => config.attachments.saveImage({ data: image.data, mediaType: image.mediaType }))\n .catch(error => {\n if (imageRefs.get(image) === pending) {\n imageRefs.delete(image)\n }\n throw error\n })\n pending = promise\n imageRefs.set(image, pending)\n }\n content.push({ type: 'image', attachment: await pending as never })\n }\n const messages = [createUserMessage({ content, source: { kind: 'plugin', plugin: 'dsh-llm-verifier' } })]\n const assembler = new BlockAssembler()\n const options = deepFreeze({\n provider: config.provider,\n model: config.model,\n ...(config.reasoningEffort ? { reasoningEffort: ReasoningEffortId(config.reasoningEffort) } : {}),\n messages,\n maxTokens: config.maxTokens,\n temperature: config.temperature,\n signal,\n })\n for await (const chunk of config.llm.stream(options)) assembler.push(chunk)\n let truncated = false\n if (assembler.finish.kind === 'max-tokens') {\n if (!tolerateTruncation) throw unusable('model call failed: ' + failureMessage(assembler.finish), attempt, assembler.usage)\n truncated = true\n } else {\n const failed = failureMessage(assembler.finish)\n if (failed !== undefined) throw unusable('model call failed: ' + failed, attempt, assembler.usage)\n }\n const text = assembler.blocks().filter((block): block is Extract<ContentBlock, { type: 'text' }> => block.type === 'text').map(block => block.text).join('')\n if (!text.trim()) throw unusable('selected DSH model produced no text', attempt, assembler.usage)\n // DSH adapters expose provider-neutral text/usage but not top-logprob candidates.\n // extractScore() therefore uses the model's explicit final A–T tags.\n return { text, tokens: [], positions: [], scoringMode: 'explicit-tag', usage: usage(attempt, assembler.usage), truncated }\n}\n\n/** Explicit-tag judge completion: fail-closed, so a truncated answer is an error and never a score. */\nasync function callExplicitTag(config: VerifierClientConfig, prompt: string, signal: AbortSignal | undefined, images: readonly VerifierImage[] | undefined, attempt: number): Promise<VerifierCompletion> {\n return callTextCompletion(config, prompt, signal, images, attempt, false)\n}\n\nexport class RequestLimiter {\n private active = 0\n private readonly queue: Array<() => void> = []\n constructor(readonly limit: number) { if (!Number.isSafeInteger(limit) || limit < 1) throw new Error('llm-verifier: request concurrency limit must be a positive integer') }\n async run<T>(operation: () => Promise<T>, signal?: AbortSignal): Promise<T> {\n if (signal?.aborted) throw signal.reason\n if (this.active >= this.limit) await new Promise<void>((resolve, reject) => {\n const enter = () => { signal?.removeEventListener('abort', abort); resolve() }\n const abort = () => { const index = this.queue.indexOf(enter); if (index >= 0) this.queue.splice(index, 1); reject(signal?.reason) }\n this.queue.push(enter); signal?.addEventListener('abort', abort, { once: true })\n })\n if (signal?.aborted) {\n this.queue.shift()?.()\n throw signal.reason\n }\n this.active += 1\n try { return await operation() } finally { this.active -= 1; this.queue.shift()?.() }\n }\n}\n\n/** Best-effort pre-call channel prediction for cache identity only; callAutomatic() stays the runtime source of truth. */\nexport async function predictScoringChannel(config: VerifierClientConfig): Promise<ScoringMode> {\n await config.topLogprobCapabilities.ensureLoaded()\n return config.topLogprobCapabilities.isUnsupported(config.provider, config.model) ? 'explicit-tag' : 'top-logprobs'\n}\n\nasync function callAutomatic(config: VerifierClientConfig, prompt: string, signal: AbortSignal | undefined, images: readonly VerifierImage[] | undefined, attempt: number): Promise<VerifierCompletion> {\n await config.topLogprobCapabilities.ensureLoaded()\n let fellBack = false\n if (!config.topLogprobCapabilities.isUnsupported(config.provider, config.model)) {\n const route = await resolveTopLogprobRoute(config.ctx, config.provider)\n if (route !== undefined) {\n try { return await callTopLogprobs(route, config.model, prompt, config.maxTokens, config.reasoningEffort, signal, images, attempt, config.temperature) }\n catch (error) {\n // Both a capability rejection and a non-retryable provider rejection of\n // the direct transport fall back to the DSH stream instead of failing\n // the whole verification.\n if (!(error instanceof TopLogprobsUnsupportedError)) throw error\n config.topLogprobCapabilities.markUnsupported(config.provider, config.model)\n // A runtime downgrade AFTER a live attempt, unlike the capability probe that\n // finds no route at all: only this one is a fallback worth counting.\n fellBack = true\n }\n } else config.topLogprobCapabilities.markUnsupported(config.provider, config.model)\n }\n const completion = await callExplicitTag(config, prompt, signal, images, attempt)\n return fellBack ? { ...completion, channelFallback: true } : completion\n}\n\nexport async function callVerifier(config: VerifierClientConfig, prompt: string, signal?: AbortSignal, images?: readonly VerifierImage[]): Promise<VerifierCompletion> {\n const invoke = () => retrying(config, signal, (attemptSignal, attempt) => callAutomatic(config, prompt, attemptSignal, images, attempt))\n return config.limiter === undefined ? invoke() : config.limiter.run(invoke, signal)\n}\n\n/**\n * Best-of-N generation sampling constants.\n *\n * Deliberately NOT the judge's temperature: best-of-N only pays off when the drafts actually\n * differ, and the judge's low default (0.2) would produce N near-copies — the tool would then\n * spend N times the money choosing between the same answer.\n */\nexport const GENERATION_TEMPERATURE = 1\n/**\n * Output ceiling for one draft.\n *\n * 4096 was a guess in the plan, and the first real end-to-end acceptance disproved it: a\n * \"function + 12 test cases + a note\" task truncated ALL THREE drafts, so the tool returned\n * nothing at all. The measured cause is reasoning tokens: on a trivial 2-draft run the session\n * model (deepseek-official/deepseek-flash) spent 16363 reasoning tokens out of 17254 output\n * tokens — roughly 8k of reasoning PER DRAFT, which eats any 4096 budget before the answer starts.\n *\n * 16384 is about 2x that measured per-draft spend, and it is also the largest ceiling that keeps\n * a pairwise judge prompt inside the plugin's own evidence limit: two drafts at 16384 tokens are\n * roughly 130k characters against a 240k explicit-evidence ceiling (EXPLICIT_MAX_TOTAL_CHARS).\n * `maxTokens` is a ceiling rather than a reservation, so a draft that needs less room costs\n * exactly what it did before. A task whose answer genuinely needs more is too large for this tool,\n * and its truncation is REPORTED instead of being silently returned.\n */\nexport const GENERATION_MAX_TOKENS = 16384\n\nexport interface GenerationTarget {\n provider: string\n model: string\n reasoningEffort?: string\n}\n\n/** One draft: plain text, never scored, plus whether it ran into the output ceiling. */\nexport interface GeneratedCandidate extends VerifierCompletion { truncated: boolean }\n\n/**\n * Re-point an existing verifier client at the model that should draft the candidates.\n *\n * Everything transport-shaped (context, llm runtime, attachments, capability memory, limiter,\n * timeout, retry budget) is inherited; only the route and the two generation-specific scalars\n * are replaced. `reasoningEffort` comes from the target and is never inherited from the base,\n * because the base is a judge: a leftover judge effort would silently draft with the wrong model\n * settings.\n * @param base - any configured verifier client (the primary judge is the cheapest source).\n * @param target - the model that writes the drafts.\n * @param maxTokens - output ceiling for this attempt.\n * @returns A client config safe to pass to {@link callGeneratedText}.\n */\nexport function generationClient(base: VerifierClientConfig, target: GenerationTarget, maxTokens = GENERATION_MAX_TOKENS): VerifierClientConfig {\n return {\n ctx: base.ctx,\n llm: base.llm,\n attachments: base.attachments,\n topLogprobCapabilities: base.topLogprobCapabilities,\n provider: target.provider,\n model: target.model,\n label: target.provider + '/' + target.model,\n ...(target.reasoningEffort === undefined ? {} : { reasoningEffort: target.reasoningEffort }),\n maxTokens,\n temperature: GENERATION_TEMPERATURE,\n timeoutMs: base.timeoutMs,\n maxRetries: base.maxRetries,\n retryBaseDelayMs: base.retryBaseDelayMs,\n ...(base.limiter === undefined ? {} : { limiter: base.limiter }),\n }\n}\n\n/**\n * One best-of-N draft.\n *\n * A named seam over the plain-text path: generation has no A–T contract and no scoring channel, and\n * the name keeps it distinct from the judge calls at every call site and in the decision snapshot.\n *\n * Hitting the output ceiling is deliberately NOT an error here. The operator already paid for those\n * tokens, and the judge can see for itself that the text stops mid-sentence. That is exactly why the\n * judge's fail-closed max-tokens handling was split out of this path: before the split, one long\n * task made the whole tool return zero candidates.\n * @param base - any configured verifier client (the primary judge is the cheapest source).\n * @param target - the model that writes the draft (normally the session model).\n * @param prompt - the rendered drafting prompt.\n * @param signal - caller's abort signal.\n * @returns The draft text, token usage, and whether it ran into the ceiling.\n */\nexport async function generateCandidate(base: VerifierClientConfig, target: GenerationTarget, prompt: string, signal?: AbortSignal): Promise<GeneratedCandidate> {\n return callGeneratedText(generationClient(base, target), prompt, signal)\n}\n\n/** Generation transport: the judge's timeout/retry/limiter wrappers, with truncation as a result. */\nasync function callGeneratedText(config: VerifierClientConfig, prompt: string, signal: AbortSignal | undefined): Promise<GeneratedCandidate> {\n const invoke = () => retrying(config, signal, (attemptSignal, attempt) => callTextCompletion(config, prompt, attemptSignal, undefined, attempt, true))\n return config.limiter === undefined ? invoke() : config.limiter.run(invoke, signal)\n}\n\n/** Plain-text verifier call for conservative JSON routing; probability labels are intentionally bypassed. */\nexport async function callVerifierText(config: VerifierClientConfig, prompt: string, signal?: AbortSignal): Promise<VerifierCompletion> {\n const invoke = () => retrying(config, signal, (attemptSignal, attempt) => callExplicitTag(config, prompt, attemptSignal, undefined, attempt))\n return config.limiter === undefined ? invoke() : config.limiter.run(invoke, signal)\n}\nexport function addUsage(target: UsageStats, source: UsageStats): void { for (const key of ['calls', 'attempts', 'retries', 'inputTokens', 'cachedInputTokens', 'outputTokens', 'reasoningTokens'] as const) target[key] += source[key] ?? 0 }\nexport function emptyUsage(): UsageStats { return { calls: 0, attempts: 0, retries: 0, inputTokens: 0, cachedInputTokens: 0, outputTokens: 0, reasoningTokens: 0 } }\n"],"mappings":";;;;;;AAiCA,IAAa,8BAAb,cAAiD,MAAM;CAAE,YAAY,SAAiB;EAAE,MAAM,OAAO;EAAG,KAAK,OAAO;CAA8B;AAAE;;;;;;AAMpJ,IAAa,wBAAb,cAA2C,4BAA4B;CAAwC;CAAtC,YAAY,SAAiB,QAA0B;EAAE,MAAM,OAAO;EAAhC,KAAA,SAAA;EAAmC,KAAK,OAAO;CAAwB;AAAE;AAExL,SAAS,OAAO,OAAqD;CAAE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK,IAAI,QAAmC,KAAA;AAAU;AAClM,SAAS,KAAK,OAAoC;CAAE,OAAO,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI,MAAM,KAAK,IAAI,KAAA;AAAU;AAChI,SAAS,SAAS,SAAyB;CAAE,OAAO,QAAQ,QAAQ,QAAQ,EAAE,IAAI;AAAoB;AACtG,SAAS,QAAQ,OAA8B;CAAE,OAAO,UAAU,MAAM,YAAY,aAAa,OAAO,KAAK,MAAM,KAAK,QAAQ,MAAM,KAAK,YAAY,MAAM,KAAK,UAAU,CAAC,CAAC,SAAS,QAAQ;AAAE;AAEjM,eAAe,WAAW,KAAc,MAAuD;CAC7F,IA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E;;AAGA,eAAe,kBAAkB,QAA8B,QAAgB,QAA8D;CAC3I,MAAM,eAAe,SAAS,QAAQ,SAAS,eAAe,YAAY,mBAAmB,QAAQ,QAAQ,eAAe,KAAA,GAAW,SAAS,IAAI,CAAC;CACrJ,OAAO,OAAO,YAAY,KAAA,IAAY,OAAO,IAAI,OAAO,QAAQ,IAAI,QAAQ,MAAM;AACpF;;AAGA,eAAsB,iBAAiB,QAA8B,QAAgB,QAAmD;CACtI,MAAM,eAAe,SAAS,QAAQ,SAAS,eAAe,YAAY,gBAAgB,QAAQ,QAAQ,eAAe,KAAA,GAAW,OAAO,CAAC;CAC5I,OAAO,OAAO,YAAY,KAAA,IAAY,OAAO,IAAI,OAAO,QAAQ,IAAI,QAAQ,MAAM;AACpF;AACA,SAAgB,SAAS,QAAoB,QAA0B;CAAE,KAAK,MAAM,OAAO;EAAC;EAAS;EAAY;EAAW;EAAe;EAAqB;EAAgB;CAAiB,GAAY,OAAO,QAAQ,OAAO,QAAQ;AAAE;AAC7O,SAAgB,aAAyB;CAAE,OAAO;EAAE,OAAO;EAAG,UAAU;EAAG,SAAS;EAAG,aAAa;EAAG,mBAAmB;EAAG,cAAc;EAAG,iBAAiB;CAAE;AAAE"}
package/lib/caller.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as attachUsage, c as emptyUsage, d as generationClient, f as partialUsage, i as addUsage, l as fallbackDeepFreeze, m as requestAttempts, n as GENERATION_TEMPERATURE, o as callVerifier, p as predictScoringChannel, r as RequestLimiter, s as callVerifierText, t as GENERATION_MAX_TOKENS, u as generateCandidate } from "./caller-BUK7OgUs.js";
1
+ import { a as attachUsage, c as emptyUsage, d as generationClient, f as partialUsage, i as addUsage, l as fallbackDeepFreeze, m as requestAttempts, n as GENERATION_TEMPERATURE, o as callVerifier, p as predictScoringChannel, r as RequestLimiter, s as callVerifierText, t as GENERATION_MAX_TOKENS, u as generateCandidate } from "./caller-Blp4l--v.js";
2
2
  export { GENERATION_MAX_TOKENS, GENERATION_TEMPERATURE, RequestLimiter, addUsage, attachUsage, callVerifier, callVerifierText, emptyUsage, fallbackDeepFreeze, generateCandidate, generationClient, partialUsage, predictScoringChannel, requestAttempts };
package/lib/client.js CHANGED
@@ -331,6 +331,8 @@ window.__ModuleLoader__.load({
331
331
  "field.captureDecisions.help": "将裁判调用的提示词与原始回复脱敏后保存在本话题下,用于看板中追溯评审理由。",
332
332
  "field.autoVerifySubagents.title": "同时验收子 Agent",
333
333
  "field.autoVerifySubagents.help": "是否对派生的子 Agent 会话同样执行自动复核与验收。开启后会消耗更多裁判额度。",
334
+ "field.autoWorkspaceEvidence.title": "接入真实文件改动证据",
335
+ "field.autoWorkspaceEvidence.help": "会话验收(显式 verifier_current_session 与自动最终验收)是否附带宿主记录的本轮真实文件改动:改动文件清单、增删行数与逐文件前后对比。证据来自宿主机对工作区的观测,而不是 Agent 自述;受累进证据的单项/总字符上限约束,任何读取失败都静默降级为不带该证据。需要 DSH 0.1.6 及以上宿主,旧宿主自动忽略本项。",
334
336
  "section.routing": "自动路由",
335
337
  "section.budgets": "预算与限额",
336
338
  "section.storage": "存储与观测",
@@ -675,6 +677,8 @@ window.__ModuleLoader__.load({
675
677
  "field.captureDecisions.help": "Saves sanitized prompts and raw outputs of judge calls in the topic directory for dashboard tracing.",
676
678
  "field.autoVerifySubagents.title": "Verify Subagent Sessions",
677
679
  "field.autoVerifySubagents.help": "Whether to also run automatic routing and acceptance on delegated child sessions. Consumes additional judge budget.",
680
+ "field.autoWorkspaceEvidence.title": "Attach real file-change evidence",
681
+ "field.autoWorkspaceEvidence.help": "Whether session acceptance (the explicit verifier_current_session tool and the automatic final gate) carries the host's own record of what this turn changed on disk: the changed-file list with added/deleted counts, plus a per-file before/after comparison. The evidence comes from the host observing the workspace rather than from the agent's own account, is bounded by the per-item and combined character caps, and any read failure degrades silently to no evidence. Requires a DSH 0.1.6+ host; older hosts ignore this setting.",
678
682
  "section.routing": "Automatic Routing",
679
683
  "section.budgets": "Budgets & Limits",
680
684
  "section.storage": "Storage & Observability",
@@ -2605,6 +2609,7 @@ window.__ModuleLoader__.load({
2605
2609
  autoVerifyTeamTasks: import_lib.default.boolean().default(true),
2606
2610
  autoVerifyPlanMode: import_lib.default.boolean().default(true),
2607
2611
  autoVerifySubagents: import_lib.default.boolean().default(false),
2612
+ autoWorkspaceEvidence: import_lib.default.boolean().default(true),
2608
2613
  provider: import_lib.default.string().default("deepseek-official"),
2609
2614
  model: import_lib.default.string().default("deepseek-flash"),
2610
2615
  reasoningEffort: import_lib.default.string(),
@@ -2689,6 +2694,7 @@ window.__ModuleLoader__.load({
2689
2694
  autoPriceOnline: true,
2690
2695
  priceProviderOverride: "",
2691
2696
  autoVerifySubagents: false,
2697
+ autoWorkspaceEvidence: true,
2692
2698
  extraJudges: []
2693
2699
  };
2694
2700
  /**
@@ -2816,6 +2822,7 @@ window.__ModuleLoader__.load({
2816
2822
  toggle("autoVerifyTeamTasks", "routing"),
2817
2823
  toggle("autoVerifyPlanMode", "routing"),
2818
2824
  toggle("autoVerifySubagents", "routing"),
2825
+ toggle("autoWorkspaceEvidence", "routing"),
2819
2826
  select("autoProcessSelection", "routing", "processSelection"),
2820
2827
  number("maxProcessCyclesPerTask", "routing", {
2821
2828
  min: 1,
@@ -3012,6 +3019,7 @@ window.__ModuleLoader__.load({
3012
3019
  autoPriceOnline: v.autoPriceOnline !== false,
3013
3020
  priceProviderOverride: typeof v.priceProviderOverride === "string" ? v.priceProviderOverride.trim() : "",
3014
3021
  autoVerifySubagents: v.autoVerifySubagents === true,
3022
+ autoWorkspaceEvidence: v.autoWorkspaceEvidence !== false,
3015
3023
  extraJudges: normalizeExtraJudges(v.extraJudges)
3016
3024
  };
3017
3025
  }