@sayknow-cli/coding-agent 0.7.10 → 0.7.11

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,14 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.7.11] - 2026-10-22
6
+
7
+ ### Fixed
8
+
9
+ - Signed `thinking` and `redactedThinking` blocks stay inline in the session instead of being moved to the resident text cache. A lost cache file was replaced with placeholder text under the original signature, and Anthropic then rejected every request with `Invalid signature in thinking block`. Sessions that already lost such a blob now drop that reasoning block (text and signature together) instead of replaying the placeholder.
10
+ - Auto-compaction no longer fails with `Missing resident text blob` when old history already lost a resident blob; the spilled copy records the missing-content placeholder, so compaction can still replace the damaged history.
11
+ - A failed `/fork` rolled back to entries that still pointed into the resident store the fork had just disposed, so every large string in the session became unreadable afterwards. The rollback now restores the materialized entries.
12
+
5
13
  ## [0.7.10] - 2026-10-20
6
14
 
7
15
  ### Added
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@sayknow-cli/coding-agent",
4
- "version": "0.7.10",
4
+ "version": "0.7.11",
5
5
  "description": "Sayknow-CLI CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://sayknow-cli.com",
7
7
  "author": "jaybeyond",
@@ -54,12 +54,12 @@
54
54
  "@agentclientprotocol/sdk": "1.3.0",
55
55
  "@babel/parser": "^7.29.3",
56
56
  "@mozilla/readability": "^0.6.0",
57
- "@sayknow-cli/stats": "0.7.10",
58
- "@sayknow-cli/agent-core": "0.7.10",
59
- "@sayknow-cli/ai": "0.7.10",
60
- "@sayknow-cli/natives": "0.7.10",
61
- "@sayknow-cli/tui": "0.7.10",
62
- "@sayknow-cli/utils": "0.7.10",
57
+ "@sayknow-cli/stats": "0.7.11",
58
+ "@sayknow-cli/agent-core": "0.7.11",
59
+ "@sayknow-cli/ai": "0.7.11",
60
+ "@sayknow-cli/natives": "0.7.11",
61
+ "@sayknow-cli/tui": "0.7.11",
62
+ "@sayknow-cli/utils": "0.7.11",
63
63
  "@puppeteer/browsers": "^2.13.0",
64
64
  "@types/turndown": "5.0.6",
65
65
  "@xterm/headless": "^6.0.0",
@@ -2824,6 +2824,9 @@ function externalizeResidentValueSync(obj: unknown, stores: ResidentBlobStores,
2824
2824
  return changed ? result : obj;
2825
2825
  }
2826
2826
  if (typeof obj === "object") {
2827
+ // Signed reasoning replays byte-for-byte; keep it inline so a lost cache
2828
+ // file can never turn it into placeholder text under a valid signature.
2829
+ if (isSignedReasoningBlock(obj)) return obj;
2827
2830
  let changed = false;
2828
2831
  const entries: Array<readonly [string, unknown]> = [];
2829
2832
  for (const [childKey, value] of Object.entries(obj)) {
@@ -2840,6 +2843,34 @@ function prepareEntryForResidentSync(entry: FileEntry, stores: ResidentBlobStore
2840
2843
  return externalizeResidentValueSync(entry, stores) as FileEntry;
2841
2844
  }
2842
2845
 
2846
+ /**
2847
+ * Thinking and redacted-thinking blocks: providers verify their text against a
2848
+ * signature (Anthropic) or treat it as opaque replay data, so the bytes cannot
2849
+ * be substituted.
2850
+ */
2851
+ function isSignedReasoningBlock(obj: object): boolean {
2852
+ const type = (obj as { type?: unknown }).type;
2853
+ return type === "thinking" || type === "redactedThinking";
2854
+ }
2855
+
2856
+ /**
2857
+ * Reasoning whose resident blob is gone (sessions written before reasoning was
2858
+ * kept inline). The original bytes are unrecoverable, so drop the text and the
2859
+ * signature together: an empty unsigned block is skipped on replay, while
2860
+ * placeholder text under the original signature is rejected by the provider
2861
+ * (`Invalid signature in thinking block`) on every later request.
2862
+ */
2863
+ function withoutLostReasoning(obj: object): object {
2864
+ if ((obj as { type?: unknown }).type === "redactedThinking") return { type: "redactedThinking", data: "" };
2865
+ const kept: Record<string, unknown> = { type: "thinking", thinking: "" };
2866
+ for (const [childKey, value] of Object.entries(obj)) {
2867
+ if (childKey === "type" || childKey === "thinking" || childKey === "thinkingSignature") continue;
2868
+ if (isResidentBlobSentinel(value)) continue;
2869
+ kept[childKey] = value;
2870
+ }
2871
+ return kept;
2872
+ }
2873
+
2843
2874
  function materializeResidentValueSync(
2844
2875
  obj: unknown,
2845
2876
  stores: ResidentBlobStores,
@@ -2882,6 +2913,14 @@ function materializeResidentValueSync(
2882
2913
  return changed ? result : obj;
2883
2914
  }
2884
2915
  if (typeof obj === "object") {
2916
+ if (missingPolicy === "placeholder" && isSignedReasoningBlock(obj)) {
2917
+ try {
2918
+ return materializeResidentValueSync(obj, stores, key, cache, "throw");
2919
+ } catch (err) {
2920
+ if (!(err instanceof ResidentBlobMissingError)) throw err;
2921
+ return withoutLostReasoning(obj);
2922
+ }
2923
+ }
2885
2924
  let changed = false;
2886
2925
  const entries = Object.entries(obj).map(([childKey, value]) => {
2887
2926
  const newValue = materializeResidentValueSync(value, stores, childKey, cache, missingPolicy);
@@ -3070,7 +3109,17 @@ function coldSpillResidentValue(
3070
3109
  writes: ColdSpillWrite[],
3071
3110
  promotion: ColdSpillResidentPromotion,
3072
3111
  ): string {
3073
- const data = residentBlobBytesForColdSpill(value, promotion);
3112
+ // Spilled history is already covered by a compaction summary and never reaches
3113
+ // the provider again. A missing resident blob is unrecoverable either way;
3114
+ // failing here only blocked every later compaction, so the session could never
3115
+ // drop the damaged history.
3116
+ let data: Buffer;
3117
+ try {
3118
+ data = residentBlobBytesForColdSpill(value, promotion);
3119
+ } catch (err) {
3120
+ if (!(err instanceof ResidentBlobMissingError)) throw err;
3121
+ data = Buffer.from(residentBlobMissingPlaceholder(err), "utf8");
3122
+ }
3074
3123
  writes.push({ path: basePath, encoding: "utf8", data, originalChars: data.byteLength });
3075
3124
  return COLD_SPILL_NOTICE;
3076
3125
  }
@@ -5292,7 +5341,10 @@ export class SessionManager {
5292
5341
  const oldSessionFile = this.#sessionFile;
5293
5342
  const oldSessionId = this.#sessionId;
5294
5343
  const materializedEntries = materializeResidentEntriesForReadSync(this.#fileEntries, this.#residentBlobStores());
5295
- const oldFileEntries = this.#fileEntries;
5344
+ // Roll back from materialized text: the live entries hold resident sentinels
5345
+ // into the store that the fork disposes, so restoring them as-is would leave
5346
+ // every large string (and signed thinking) pointing at a deleted blob.
5347
+ const oldFileEntries = materializedEntries;
5296
5348
  const oldSessionName = this.#sessionName;
5297
5349
  const oldTitleSource = this.#titleSource;
5298
5350