@t2000/engine 1.24.5 → 1.24.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/dist/index.d.ts CHANGED
@@ -2710,6 +2710,18 @@ interface MicrocompactResult extends Array<Message> {
2710
2710
  * later call with identical inputs gets replaced — necessary because
2711
2711
  * their results depend on mutable on-chain state that writes invalidate.
2712
2712
  *
2713
+ * [v1.24.6 / S.122] Tools whose `flags.mutating === true` are ALSO
2714
+ * implicitly non-cacheable. Each call to a write tool produces a NEW
2715
+ * on-chain transaction (different digest, different balance changes, real
2716
+ * state mutation) — replacing the second result with "[Same result as
2717
+ * call #N — identical inputs]" lies to the LLM, which then narrates
2718
+ * "transaction deduplicated" to the user even though the on-chain write
2719
+ * actually settled. Surfaced during S.121 smoke testing: a second
2720
+ * `send_transfer` with identical inputs produced a real on-chain tx but
2721
+ * the engine narrated as if it had been skipped. Explicit `cacheable`
2722
+ * still wins (a `cacheable: true` write would be a tool-author bug, but
2723
+ * we don't override it), so the rule is: mutating ⇒ default `false`.
2724
+ *
2713
2725
  * Returns a new array — does not mutate the input. The returned array
2714
2726
  * carries a `dedupedToolUseIds` property listing every tool-use ID whose
2715
2727
  * tool_result block was replaced with a back-reference this pass.
package/dist/index.js CHANGED
@@ -6595,7 +6595,9 @@ function microcompact(messages, tools) {
6595
6595
  const cacheableByName = /* @__PURE__ */ new Map();
6596
6596
  if (tools) {
6597
6597
  for (const t of tools) {
6598
- cacheableByName.set(t.name, t.cacheable ?? true);
6598
+ const explicit = t.cacheable;
6599
+ const isMutating = t.flags?.mutating === true;
6600
+ cacheableByName.set(t.name, explicit ?? !isMutating);
6599
6601
  }
6600
6602
  }
6601
6603
  const dedupedToolUseIds = /* @__PURE__ */ new Set();