@mars-sea/dsh-commandcode-provider 0.11.13 → 0.11.16

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/lib/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import { Context } from "@deepseek-ai/cordis";
7
7
  import { AttachmentStore } from "@deepseek-ai/dsh-attachment";
8
8
  import { CommandDefinition } from "@deepseek-ai/dsh-commands";
9
9
  //#region src/adapter.d.ts
10
- declare const COMMAND_CODE_CLI_VERSION = "1.65.0";
10
+ declare const COMMAND_CODE_CLI_VERSION = "1.65.2";
11
11
  declare const DEFAULT_API_BASE = "https://api.commandcode.ai";
12
12
  declare const DEFAULT_GENERATE_MAX_TOKENS = 64000;
13
13
  declare const DEFAULT_MAX_OUTPUT_TOKENS = 65536;
@@ -789,8 +789,9 @@ declare const KNOWN_EFFORTS: Readonly<Record<string, readonly string[]>>;
789
789
  declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
790
790
  /**
791
791
  * Models WITHOUT a zero-data-retention upstream, per the official CLI's own
792
- * registry (`command-code@1.65.0` `dist/cli.mjs`: `modelSupportsZdr(id)` is
793
- * exactly `!nonZdrSet.has(canonicalize(id))`, and `knownModelSupportsZdr`
792
+ * registry (`command-code@1.65.2` `dist/cli.mjs`, unchanged from 1.65.0:
793
+ * `modelSupportsZdr(id)` is exactly `!nonZdrSet.has(canonicalize(id))`, and
794
+ * `knownModelSupportsZdr`
794
795
  * carries the same membership in the sibling route table — the union is this
795
796
  * set). The official docs (commandcode.ai/docs/resources/zdr) put it in prose
796
797
  * — "99% of our models have ZDR-capable upstreams … only a small handful of
package/lib/index.js CHANGED
@@ -395,8 +395,9 @@ const KNOWN_IMAGE_MODELS = /* @__PURE__ */ new Set([
395
395
  ]);
396
396
  /**
397
397
  * Models WITHOUT a zero-data-retention upstream, per the official CLI's own
398
- * registry (`command-code@1.65.0` `dist/cli.mjs`: `modelSupportsZdr(id)` is
399
- * exactly `!nonZdrSet.has(canonicalize(id))`, and `knownModelSupportsZdr`
398
+ * registry (`command-code@1.65.2` `dist/cli.mjs`, unchanged from 1.65.0:
399
+ * `modelSupportsZdr(id)` is exactly `!nonZdrSet.has(canonicalize(id))`, and
400
+ * `knownModelSupportsZdr`
400
401
  * carries the same membership in the sibling route table — the union is this
401
402
  * set). The official docs (commandcode.ai/docs/resources/zdr) put it in prose
402
403
  * — "99% of our models have ZDR-capable upstreams … only a small handful of
@@ -3004,20 +3005,19 @@ function openStreamTrace(scope, options = {}) {
3004
3005
  * and API key or subscription, and Command Code's terms apply.
3005
3006
  *
3006
3007
  * Wire protocol (reverse-engineered by the pi plugin, command-code@1.28.4;
3007
- * re-verified against command-code@1.62.0 — endpoints, request shape, and
3008
- * stream events unchanged):
3008
+ * re-verified through command-code@1.65.2):
3009
3009
  * POST {apiBase}/alpha/generate
3010
3010
  * body: { config, memory, taste, skills, params: { model, messages, tools,
3011
3011
  * system, max_tokens, temperature, stream, reasoning_effort? }, threadId }
3012
3012
  * SSE-ish JSONL events: text-delta | reasoning-start/delta/end | tool-call
3013
- * | tool-result | finish | error
3013
+ * | tool-result | cache-write-tokens | finish | error
3014
3014
  * Model catalog: GET {apiBase}/provider/v1/models -> { object: 'list', data: [...] }
3015
3015
  *
3016
3016
  * The adapter is deliberately free of cordis/schemastery: it receives a
3017
3017
  * per-request options thunk and an API-key resolver from the plugin entry
3018
3018
  * (src/index.ts), so a settings change reaches the very next request.
3019
3019
  */
3020
- const COMMAND_CODE_CLI_VERSION = "1.65.0";
3020
+ const COMMAND_CODE_CLI_VERSION = "1.65.2";
3021
3021
  const DEFAULT_API_BASE = "https://api.commandcode.ai";
3022
3022
  const DEFAULT_GENERATE_MAX_TOKENS = 64e3;
3023
3023
  const DEFAULT_MAX_OUTPUT_TOKENS = 65536;
@@ -4102,6 +4102,7 @@ function createBlockAssembler() {
4102
4102
  reasoningContent: "",
4103
4103
  sawContent: false,
4104
4104
  finishReason: void 0,
4105
+ cliCacheWriteTokens: void 0,
4105
4106
  openAiToolCalls: []
4106
4107
  };
4107
4108
  }
@@ -4304,6 +4305,7 @@ var CommandCodeAdapter = class extends LlmAdapter {
4304
4305
  name: entry ? `${entry.name} (CC)` : model,
4305
4306
  description: capabilityDescription(model, entry?.contextWindow),
4306
4307
  inputModalities: vision ? ["text", "image"] : ["text"],
4308
+ toolUpdate: "addition-only",
4307
4309
  ...entry ? {
4308
4310
  context: { contextWindow: entry.contextWindow },
4309
4311
  defaultMaxTokens: Math.min(entry.maxTokens, DEFAULT_GENERATE_MAX_TOKENS)
@@ -5029,22 +5031,29 @@ function handleCliEvent(asm, event) {
5029
5031
  });
5030
5032
  break;
5031
5033
  }
5034
+ case "cache-write-tokens": {
5035
+ const cacheWrite = numberValue(event.cacheWriteTokens);
5036
+ if (cacheWrite !== void 0 && cacheWrite >= 0) asm.cliCacheWriteTokens = cacheWrite;
5037
+ break;
5038
+ }
5032
5039
  case "finish": {
5033
5040
  asm.finishReason = stringValue(event.finishReason);
5034
5041
  chunks.push(...closeText(asm), ...closeReasoning(asm));
5035
5042
  const usage = isRecord(event.totalUsage) ? event.totalUsage : void 0;
5036
- if (usage) {
5037
- const details = isRecord(usage.inputTokenDetails) ? usage.inputTokenDetails : void 0;
5038
- const totalInput = numberValue(usage.inputTokens) ?? 0;
5043
+ const capturedCacheWrite = asm.cliCacheWriteTokens;
5044
+ if (usage || capturedCacheWrite !== void 0) {
5045
+ const details = isRecord(usage?.inputTokenDetails) ? usage.inputTokenDetails : void 0;
5046
+ const totalInput = numberValue(usage?.inputTokens) ?? 0;
5039
5047
  const cacheRead = numberValue(details?.cacheReadTokens) ?? 0;
5040
- const cacheWrite = numberValue(details?.cacheWriteTokens) ?? 0;
5048
+ const reportedCacheWrite = numberValue(details?.cacheWriteTokens) ?? 0;
5049
+ const cacheWrite = reportedCacheWrite === 0 && capturedCacheWrite !== void 0 ? capturedCacheWrite : reportedCacheWrite;
5041
5050
  const tokenUsage = {
5042
5051
  inputTokens: numberValue(details?.noCacheTokens) ?? Math.max(0, totalInput - cacheRead - cacheWrite),
5043
- outputTokens: numberValue(usage.outputTokens) ?? 0,
5052
+ outputTokens: numberValue(usage?.outputTokens) ?? 0,
5044
5053
  cacheReadTokens: cacheRead,
5045
5054
  cacheWriteTokens: cacheWrite
5046
5055
  };
5047
- const reasoningTokens = numberValue((isRecord(usage.outputTokenDetails) ? usage.outputTokenDetails : void 0)?.reasoningTokens) ?? numberValue(usage.reasoningTokens);
5056
+ const reasoningTokens = numberValue((isRecord(usage?.outputTokenDetails) ? usage.outputTokenDetails : void 0)?.reasoningTokens) ?? numberValue(usage?.reasoningTokens);
5048
5057
  if (reasoningTokens !== void 0) tokenUsage.reasoningTokens = reasoningTokens;
5049
5058
  chunks.push({
5050
5059
  type: "usage",
@@ -7277,7 +7286,7 @@ function transportBudgetMessage(failureMessage, maxRetries) {
7277
7286
  * as an internal advisor instead: the command guard in `./command-guard.ts`
7278
7287
  * asks it whether a shell command is safe to auto-approve.
7279
7288
  *
7280
- * The three question types are the whole vocabulary (command-code@1.65.0
7289
+ * The three question types are the whole vocabulary (command-code@1.65.2
7281
7290
  * `systemOneRequestSchema`, unchanged since 1.64.0):
7282
7291
  *
7283
7292
  * - `noul` — "is this true?", optional `criteria: { true, false }` describing
@@ -8123,7 +8132,7 @@ function applyCommandGuard(ctx, deps) {
8123
8132
  * Mark one schema field volatile.
8124
8133
  *
8125
8134
  * `.volatile()` is unconditional: the mark is a schemastery 3.18.3 feature and
8126
- * the only engine this bundle supports (`dsh 0.1.7-rc.1`) pins `~3.18.4`, so
8135
+ * the only engine this bundle supports (`dsh 0.1.7-rc.2`) pins `~3.18.4`, so
8127
8136
  * the method is always present. It is reached through a structural member
8128
8137
  * rather than schemastery's own typing so the function can keep the caller's
8129
8138
  * declared field type, which is what lets `Config` stay the plain shape every