@eddyskywalker/dsh-chatgpt-subscription 0.9.5 → 0.9.6

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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - **修复用户实测缺陷:Claude 线路缓存命中为 0(每次请求都按全新输入计费)**。根因**不是显示问题**:Anthropic 的提示缓存要求**请求携带显式的 `cache_control` 断点**,而本插件的请求构建器虽然**支持**这个能力,却**从未开启**——`mapper.ts` 里的选项默认 `false`,且 **adapter 从未传过它**(全仓库搜索该标识符只出现在 mapper 自身与其测试中)。因此没有任何一个字节的 `cache_control` 发出过,服务端无从缓存,`cache_read_input_tokens` 自然永远是 0。
6
+ - **对照本地参照实现,问题更清楚**:`pi-ai` 的 `resolveCacheRetention()` **默认返回 `"short"`**,即**默认缓存**,只有显式设为 `"none"` 才关;本插件恰好相反。这个"默认值反转"就是缺陷本身。
7
+ - **修法(四件事)**:
8
+ 1. **默认开启缓存**,且选项语义改为**opt-out**(`cacheControl !== false`)。这一点很重要:旧设计的失败模式正是「选项存在、调用方忘了传」,所以**默认值必须是缓存行为**——测试证明,即使把 adapter 的参数删掉,缓存**依然生效**,从机制上杜绝同一类缺陷复现。
9
+ 2. **补上真正省钱的断点**:原先**只**能标 system 块(而且其自身注释就写着"只标它会缓存不到任何变化的东西");现在标**三处**——system 末块、**最后一条 user 消息的最后一个块**(跨轮复用历史的关键)、最后一个 tool。断点数量受 `MAX_CACHE_BREAKPOINTS = 4`(服务端硬上限)约束,并有测试用 13 条消息 + 图片 + 多工具的压力场景验证不超限。
10
+ 3. **标记时机正确**:在 `mergeClaudeMessages` **之后**、对**最终**请求体做标记,避免断点落在合并后会被移动的块上。
11
+ 4. **前缀稳定性已核查**:断点之上若存在逐轮变化的值,缓存会整体失效、断点等于白标。已确认 Claude 请求路径中**没有** `Date.now` / `Math.random` / UUID 等易变值(`cooldownMsFor` 的 `Date.now` 是重试时钟、不进请求字节),且 `leadingSystemText` 是**有序纯折叠**、不重排。
12
+ - **为什么"看不到"不是显示问题**:`tokenUsage()` 确实会省略值为 0 的计数器,但 harness 的累加器会把缺失**归一化为 0**(`usage.cacheReadTokens ?? 0`),所以"省略 0"与"字面 0"在 UI 上表现一致。用户看到的是**真实的 0**——因为服务端确实无缓存可命中。
13
+ - **验证**:`tsc` 三个项目 **0 错误**;按 CI 配方本地跑 `npm run typecheck` + `npm run build` + `npm test` + `npm pack --dry-run` **全部通过**;全量测试 **1595 通过 / 0 失败**,且在**隐藏参照快照**(CI 的真实条件)下同样绿(1593 通过 / 9 跳过)。**独立复核**:我另写脚本 dump 真实请求体,确认三处断点出现在正确位置、**不传任何选项时即为 3 个**(证明默认开启)、显式 opt-out 时为 0。
14
+ - **未验证项(如实说明)**:服务端**最小可缓存提示长度**(约 1024 token,随模型而异)不在任何本地来源中,无法离线核实;且**本次未向真实端点发过请求**。因此结论是「**请求现在携带了使服务端缓存成为可能的断点**」,**不是**「已观测到服务端返回 `cache_read_input_tokens`」。
15
+
16
+
5
17
  - **修复用户实测缺陷:选择 Claude Opus 5.5 必然失败(`claude_code_version_too_old`)**。上游原文:`Claude Code 2.1.251 does not support this model; version 2.1.280 or newer is required.` 那个 **2.1.251 是本插件自己申报的版本号**被服务端回显——本插件发布 `claude-opus-5-5`(该模型要求客户端 ≥ 2.1.280),却仍申报 2.1.251,两个数字自相矛盾,因此对该模型的每次请求都白花一个往返后被拒。**这是本插件引入的缺陷,与用户环境无关。**
6
18
  - **根因不只是"数字写旧了"**:加模型与抬版本之间没有任何强制关系,所以同类缺陷会反复出现。修法分两层。
7
19
  - **① 修正值与记录门槛**:`CLAUDE_CLI_VERSION` 由 `2.1.251` 改为 `2.1.283`(npm `latest` 的真实已发布版本,且 ≥ 2.1.280)。能力表新增可选字段 `minCliVersion`,**仅**给 `claude-opus-5-5` 填 `2.1.280`;其余 14 行**一律不填**,接口注释写明「缺省 = 未知门槛,不等于没有门槛」——不臆造无依据的数字。注:上游 npm `stable` tag 本身是 `2.1.274`,**低于该模型要求**,这正是 [anthropics/claude-code#96130](https://github.com/anthropics/claude-code/issues/96130) 报的坑。
package/lib/index.js CHANGED
@@ -24460,6 +24460,36 @@ function classifyFailure(status, bodyText, headers = {}) {
24460
24460
  * block may be replayed at all arrives at the END of the block, so a signed
24461
24461
  * block cannot be recognized before then, and a reasoning block that cannot be
24462
24462
  * replayed is not content the caller should be told it received.
24463
+ *
24464
+ * ---------------------------------------------------------------------------
24465
+ * 7. PROMPT CACHING IS ON BY DEFAULT, AND IT IS THE REQUEST THAT TURNS IT ON
24466
+ * ---------------------------------------------------------------------------
24467
+ *
24468
+ * Anthropic's prompt cache is REQUEST-DRIVEN: the server caches a prefix only
24469
+ * where the request puts an explicit cache_control breakpoint, and a request
24470
+ * with no breakpoint gets no cache_read_input_tokens back no matter how
24471
+ * identical its bytes are turn over turn. Emitting the breakpoints is therefore
24472
+ * this module's job, and it is the DEFAULT: ClaudeRequestOptions.cacheControl
24473
+ * is true unless a caller explicitly states false. The reference implementation
24474
+ * this line is transcribed from resolves the same way (its resolveCacheRetention
24475
+ * defaults to 'short'; only an explicit 'none' skips caching), and the
24476
+ * asymmetry is deliberate - a caller that says NOTHING must still get caching,
24477
+ * because an opt-in flag that one call site forgets to pass is exactly how this
24478
+ * request stopped carrying breakpoints in the first place.
24479
+ *
24480
+ * Three sites are marked, which is three of the four breakpoints the wire
24481
+ * accepts (see MAX_CACHE_BREAKPOINTS): the LAST system block, the last block of
24482
+ * the LAST user message, and the last tool. The first covers the identity block
24483
+ * and the caller's prompt; the second is what actually caches CONVERSATION
24484
+ * HISTORY across turns, since it sits at the end of everything the next turn
24485
+ * will resend; the third keeps the tool table inside the cached prefix instead
24486
+ * of behind the first message breakpoint.
24487
+ *
24488
+ * Where the marking happens matters as much as that it happens: the message
24489
+ * breakpoint goes on the FINAL merged list, after mergeClaudeMessages has
24490
+ * folded consecutive same-role turns together. Marking the pre-merge list can
24491
+ * land the breakpoint on a block the merge then moves back, which leaves a
24492
+ * marker in the request that caches nothing the next turn can reuse.
24463
24493
  */
24464
24494
  function isRecord$3(value) {
24465
24495
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -24504,6 +24534,20 @@ const CLAUDE_CODE_IDENTITY_TEXT = "You are Claude Code, Anthropic's official CLI
24504
24534
  /** Answer room the budget clamp always leaves below the response ceiling. */
24505
24535
  const MIN_ANSWER_TOKENS = 1024;
24506
24536
  /**
24537
+ * Block types the wire accepts a cache_control marker on.
24538
+ *
24539
+ * A marker on any other block is a request the server rejects, so the last
24540
+ * block of the last user message is marked only when its type is one of these
24541
+ * (TRANSCRIBED from the reference, which guards on exactly this set). The
24542
+ * absence of thinking blocks is not an oversight: they only ever appear in
24543
+ * ASSISTANT turns, and this module never marks an assistant block.
24544
+ */
24545
+ const CACHE_MARKABLE_BLOCK_TYPES = /* @__PURE__ */ new Set([
24546
+ "text",
24547
+ "image",
24548
+ "tool_result"
24549
+ ]);
24550
+ /**
24507
24551
  * Thinking budget one level asks for, before any clamp.
24508
24552
  *
24509
24553
  * TRANSCRIBED from simple-options.js lines 38-43. The values are the
@@ -25065,13 +25109,15 @@ function leadingSystemText(options) {
25065
25109
  * The system array for one request: identity first, always.
25066
25110
  *
25067
25111
  * The identity block is not conditional on anything (see the module doc). The
25068
- * optional ephemeral cache marker is opt-in and goes on the LAST block, which
25069
- * is the Anthropic-recommended shape: a breakpoint at the end of the prompt
25070
- * caches everything above it, so marking the user block also covers the
25071
- * identity block, while marking the identity block alone would cache nothing
25072
- * that changes.
25112
+ * ephemeral cache marker goes on the LAST block and is ON BY DEFAULT, which is
25113
+ * the Anthropic-recommended shape: a breakpoint at the end of the prompt caches
25114
+ * everything above it, so marking the user block also covers the identity
25115
+ * block, while marking the identity block alone would cache nothing that
25116
+ * changes.
25117
+ *
25118
+ * @param cacheControl - false is the opt-OUT; the default requests caching.
25073
25119
  */
25074
- function buildClaudeSystemBlocks(options, systemCacheControl = false) {
25120
+ function buildClaudeSystemBlocks(options, cacheControl = true) {
25075
25121
  const blocks = [{
25076
25122
  type: "text",
25077
25123
  text: CLAUDE_CODE_IDENTITY_TEXT
@@ -25081,12 +25127,74 @@ function buildClaudeSystemBlocks(options, systemCacheControl = false) {
25081
25127
  type: "text",
25082
25128
  text: userText
25083
25129
  });
25084
- if (systemCacheControl) {
25130
+ if (cacheControl) {
25085
25131
  const last = blocks[blocks.length - 1];
25086
25132
  last.cache_control = { type: "ephemeral" };
25087
25133
  }
25088
25134
  return blocks;
25089
25135
  }
25136
+ /**
25137
+ * The last block worth a cache breakpoint on the message list, if any.
25138
+ *
25139
+ * TRANSCRIBED from the reference, which marks the last block of the last USER
25140
+ * message and nothing else. Two guards come with it, and both are load-bearing:
25141
+ * the last message must be a user turn (a history ending on an assistant turn -
25142
+ * a prefill-shaped request - gets no message breakpoint rather than a marker
25143
+ * somewhere it was not asked for), and the block must be one the wire accepts a
25144
+ * marker on. An unmarkable block yields NO breakpoint rather than one moved
25145
+ * onto an earlier turn: an unmasked request is merely uncached, while a marker
25146
+ * on a block type the wire rejects fails the whole turn.
25147
+ */
25148
+ function lastCacheableUserBlock(messages) {
25149
+ const lastMessage = messages[messages.length - 1];
25150
+ if (lastMessage === void 0 || lastMessage.role !== "user") return void 0;
25151
+ const block = lastMessage.content[lastMessage.content.length - 1];
25152
+ if (block === void 0) return void 0;
25153
+ return CACHE_MARKABLE_BLOCK_TYPES.has(String(block.type)) ? block : void 0;
25154
+ }
25155
+ /**
25156
+ * Put the cache breakpoints on one built body, and report how many landed.
25157
+ *
25158
+ * Split out from the builder so the marking runs against the FINAL shape - the
25159
+ * merged message list and the full tool array - rather than against the
25160
+ * intermediate one (see the module doc's section 7). An assistant turn after
25161
+ * the last user turn (a truncated history, or a request that appends an
25162
+ * assistant preamble) leaves that turn's tail unmarked; marking it would put
25163
+ * the marker below the assistant content and cache a prefix the next request
25164
+ * does not resend.
25165
+ *
25166
+ * @param body - the built body, mutated in place: it was created by this module
25167
+ * and has not been handed to a caller yet.
25168
+ * @returns the number of breakpoints written.
25169
+ */
25170
+ function markClaudeCacheBreakpoints(body) {
25171
+ let marked = 0;
25172
+ const system = body.system;
25173
+ if (Array.isArray(system)) {
25174
+ const last = system[system.length - 1];
25175
+ if (last !== void 0) {
25176
+ last.cache_control = { type: "ephemeral" };
25177
+ marked += 1;
25178
+ }
25179
+ }
25180
+ const messages = body.messages;
25181
+ if (Array.isArray(messages)) {
25182
+ const target = lastCacheableUserBlock(messages);
25183
+ if (target !== void 0) {
25184
+ target.cache_control = { type: "ephemeral" };
25185
+ marked += 1;
25186
+ }
25187
+ }
25188
+ const tools = body.tools;
25189
+ if (Array.isArray(tools) && tools.length > 0) {
25190
+ const last = tools[tools.length - 1];
25191
+ if (last !== void 0) {
25192
+ last.cache_control = { type: "ephemeral" };
25193
+ marked += 1;
25194
+ }
25195
+ }
25196
+ return marked;
25197
+ }
25090
25198
  /** One tool definition in the wire shape. */
25091
25199
  function wireTool(tool, names) {
25092
25200
  const schema = isRecord$3(tool.parameters) ? { ...tool.parameters } : {
@@ -25286,7 +25394,8 @@ function mergeClaudeMessages(entries) {
25286
25394
  *
25287
25395
  * @param options - request options carrying the normalized conversation.
25288
25396
  * @param images - images read for this request by resolveRequestImages.
25289
- * @param request - cache and translation options.
25397
+ * @param request - cache and translation options. Caching is the DEFAULT and
25398
+ * is skipped only when request.cacheControl is explicitly false.
25290
25399
  */
25291
25400
  function buildClaudeRequestBody(options, images = NO_RESOLVED_IMAGES, request = {}) {
25292
25401
  const names = request.toolNames ?? claudeToolNames(options.tools);
@@ -25312,11 +25421,12 @@ function buildClaudeRequestBody(options, images = NO_RESOLVED_IMAGES, request =
25312
25421
  }
25313
25422
  const thinkingEnabled = thinking !== void 0 && thinking.type !== "disabled";
25314
25423
  const temperatureAllowed = claudeModelSupportsTemperature(options.model) && !thinkingEnabled;
25315
- return {
25424
+ const caching = request.cacheControl !== false;
25425
+ const body = {
25316
25426
  model: options.model,
25317
25427
  max_tokens: maxTokens,
25318
25428
  stream: true,
25319
- system: buildClaudeSystemBlocks(options, request.systemCacheControl === true),
25429
+ system: buildClaudeSystemBlocks(options, caching),
25320
25430
  messages: mergeClaudeMessages(entries),
25321
25431
  ...options.tools !== void 0 && options.tools.length > 0 ? { tools: options.tools.map((tool) => wireTool(tool, names)) } : {},
25322
25432
  ...thinking === void 0 ? {} : { thinking },
@@ -25324,6 +25434,8 @@ function buildClaudeRequestBody(options, images = NO_RESOLVED_IMAGES, request =
25324
25434
  ...temperatureAllowed && options.temperature !== void 0 ? { temperature: options.temperature } : {},
25325
25435
  ...options.stop !== void 0 && options.stop.length > 0 ? { stop_sequences: [...options.stop] } : {}
25326
25436
  };
25437
+ if (caching) markClaudeCacheBreakpoints(body);
25438
+ return body;
25327
25439
  }
25328
25440
  /**
25329
25441
  * Fresh stream state.
@@ -27241,7 +27353,10 @@ var ClaudeAdapter = class extends LlmAdapter {
27241
27353
  * no credentials were resolved for it.
27242
27354
  */
27243
27355
  async attemptRequest(credentials, requestOptions, images, toolNames, thinking, signal, fetchFn) {
27244
- const body = JSON.stringify(buildClaudeRequestBody(requestOptions, images, { toolNames }));
27356
+ const body = JSON.stringify(buildClaudeRequestBody(requestOptions, images, {
27357
+ toolNames,
27358
+ cacheControl: true
27359
+ }));
27245
27360
  try {
27246
27361
  return await fetchFn("https://api.anthropic.com/v1/messages?beta=true", {
27247
27362
  method: "POST",
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/host/claude/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoHG;AAEH,OAAO,EACL,UAAU,EACV,QAAQ,EACR,iBAAiB,EAEjB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,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WAAW,CAAC;IAanE;;;;;;;;;;OAUG;YACW,iBAAiB;IA8C/B;;;;;;;;OAQG;YACW,cAAc;YA4Cb,aAAa;CAuI7B;AAsBD;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,GAC/B,iBAAiB,GAAG,SAAS,CAI/B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAI3F;AAiBD,6DAA6D;AAC7D,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,GAAE,MAAmB,GAAG,MAAM,CAUtF;AAED,2DAA2D;AAC3D,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAO7D;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,QAAQ,CA8D3D;AAED,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,CAAA"}
@@ -144,6 +144,36 @@
144
144
  * block may be replayed at all arrives at the END of the block, so a signed
145
145
  * block cannot be recognized before then, and a reasoning block that cannot be
146
146
  * replayed is not content the caller should be told it received.
147
+ *
148
+ * ---------------------------------------------------------------------------
149
+ * 7. PROMPT CACHING IS ON BY DEFAULT, AND IT IS THE REQUEST THAT TURNS IT ON
150
+ * ---------------------------------------------------------------------------
151
+ *
152
+ * Anthropic's prompt cache is REQUEST-DRIVEN: the server caches a prefix only
153
+ * where the request puts an explicit cache_control breakpoint, and a request
154
+ * with no breakpoint gets no cache_read_input_tokens back no matter how
155
+ * identical its bytes are turn over turn. Emitting the breakpoints is therefore
156
+ * this module's job, and it is the DEFAULT: ClaudeRequestOptions.cacheControl
157
+ * is true unless a caller explicitly states false. The reference implementation
158
+ * this line is transcribed from resolves the same way (its resolveCacheRetention
159
+ * defaults to 'short'; only an explicit 'none' skips caching), and the
160
+ * asymmetry is deliberate - a caller that says NOTHING must still get caching,
161
+ * because an opt-in flag that one call site forgets to pass is exactly how this
162
+ * request stopped carrying breakpoints in the first place.
163
+ *
164
+ * Three sites are marked, which is three of the four breakpoints the wire
165
+ * accepts (see MAX_CACHE_BREAKPOINTS): the LAST system block, the last block of
166
+ * the LAST user message, and the last tool. The first covers the identity block
167
+ * and the caller's prompt; the second is what actually caches CONVERSATION
168
+ * HISTORY across turns, since it sits at the end of everything the next turn
169
+ * will resend; the third keeps the tool table inside the cached prefix instead
170
+ * of behind the first message breakpoint.
171
+ *
172
+ * Where the marking happens matters as much as that it happens: the message
173
+ * breakpoint goes on the FINAL merged list, after mergeClaudeMessages has
174
+ * folded consecutive same-role turns together. Marking the pre-merge list can
175
+ * land the breakpoint on a block the merge then moves back, which leaves a
176
+ * marker in the request that caches nothing the next turn can reuse.
147
177
  */
148
178
  import { type ContentBlock, type GenerateOptions, type StreamChunk } from '../common/llm-compat.ts';
149
179
  import type { AttachmentStore } from '@deepseek-ai/dsh-attachment';
@@ -156,6 +186,15 @@ import type { AttachmentStore } from '@deepseek-ai/dsh-attachment';
156
186
  export declare const CLAUDE_CODE_IDENTITY_TEXT = "You are Claude Code, Anthropic's official CLI for Claude.";
157
187
  /** Answer room the budget clamp always leaves below the response ceiling. */
158
188
  export declare const MIN_ANSWER_TOKENS = 1024;
189
+ /**
190
+ * Cache breakpoints one Messages request may carry.
191
+ *
192
+ * TRANSCRIBED from the wire's own limit and the reference implementation's
193
+ * reading of it. This module marks at most three (see the module doc), so the
194
+ * budget is never the binding constraint - the constant exists so a test can
195
+ * assert that against the REAL number rather than a magic three.
196
+ */
197
+ export declare const MAX_CACHE_BREAKPOINTS = 4;
159
198
  /**
160
199
  * Thinking budget one level asks for, before any clamp.
161
200
  *
@@ -375,20 +414,35 @@ export declare function leadingSystemText(options: GenerateOptions): string | un
375
414
  * The system array for one request: identity first, always.
376
415
  *
377
416
  * The identity block is not conditional on anything (see the module doc). The
378
- * optional ephemeral cache marker is opt-in and goes on the LAST block, which
379
- * is the Anthropic-recommended shape: a breakpoint at the end of the prompt
380
- * caches everything above it, so marking the user block also covers the
381
- * identity block, while marking the identity block alone would cache nothing
382
- * that changes.
417
+ * ephemeral cache marker goes on the LAST block and is ON BY DEFAULT, which is
418
+ * the Anthropic-recommended shape: a breakpoint at the end of the prompt caches
419
+ * everything above it, so marking the user block also covers the identity
420
+ * block, while marking the identity block alone would cache nothing that
421
+ * changes.
422
+ *
423
+ * @param cacheControl - false is the opt-OUT; the default requests caching.
424
+ */
425
+ export declare function buildClaudeSystemBlocks(options: GenerateOptions, cacheControl?: boolean): AnthropicBlock[];
426
+ /**
427
+ * How many cache_control markers one built body carries.
428
+ *
429
+ * Walks the finished body rather than counting calls to the marker: the number
430
+ * the wire enforces is the number of markers IN THE BYTES, so a test that
431
+ * counts its own marking calls could pass while the body carried a fourth
432
+ * breakpoint from somewhere else. Used by the tests only.
383
433
  */
384
- export declare function buildClaudeSystemBlocks(options: GenerateOptions, systemCacheControl?: boolean): AnthropicBlock[];
434
+ export declare function countClaudeCacheBreakpoints(body: unknown): number;
385
435
  /** Options this builder reads beyond GenerateOptions. */
386
436
  export interface ClaudeRequestOptions {
387
437
  /**
388
- * Put an ephemeral cache breakpoint on the last system block. Default false,
389
- * so the marker is opt-in.
438
+ * Emit prompt-cache breakpoints. Default TRUE: caching is what a caller that
439
+ * states nothing gets (see the module doc). Pass false only to opt out.
440
+ *
441
+ * When on, breakpoints go on the last system block, the last block of the
442
+ * last user message, and the last tool - at most
443
+ * {@link MAX_CACHE_BREAKPOINTS} in total.
390
444
  */
391
- systemCacheControl?: boolean;
445
+ cacheControl?: boolean;
392
446
  /**
393
447
  * Tool-name translation to use. Pass the same value to createStreamState so
394
448
  * the response side maps back through the identical table.
@@ -405,7 +459,8 @@ export interface ClaudeRequestOptions {
405
459
  *
406
460
  * @param options - request options carrying the normalized conversation.
407
461
  * @param images - images read for this request by resolveRequestImages.
408
- * @param request - cache and translation options.
462
+ * @param request - cache and translation options. Caching is the DEFAULT and
463
+ * is skipped only when request.cacheControl is explicitly false.
409
464
  */
410
465
  export declare function buildClaudeRequestBody(options: GenerateOptions, images?: ResolvedRequestImages, request?: ClaudeRequestOptions): Record<string, unknown>;
411
466
  /** One tool_use block accumulating across input_json_delta fragments. */
@@ -1 +1 @@
1
- {"version":3,"file":"mapper.d.ts","sourceRoot":"","sources":["../../../../src/host/claude/mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkJG;AAEH,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,eAAe,EAEpB,KAAK,WAAW,EAEjB,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,6BAA6B,CAAA;AA8DtF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,8DAA8D,CAAA;AAEpG,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,OAAO,CAAA;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKpE,CAAA;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,WAAW,CAAA;AAE9C,sEAAsE;AACtE,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;AAE1E;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAKpF;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,M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AO,CAAA;IACnB,WAAW,EAAE,OAAO,CAAA;IACpB,uCAAuC;IACvC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB,eAAe,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,CAAC,EAAE,eAAe,GAAG,iBAAiB,CAqBhF;AAiKD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,WAAW,EAAE,CAWnE;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAInE;AAqBD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,WAAW,EAAE,CAkKvF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eddyskywalker/dsh-chatgpt-subscription",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "DSH provider plugin for Codex access through a ChatGPT subscription.",
5
5
  "author": {
6
6
  "name": "eddyskywalker",