@vincemakes/kiso-code 0.1.38 → 0.1.40

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 (2) hide show
  1. package/dist/chat.js +23 -5
  2. package/package.json +8 -8
package/dist/chat.js CHANGED
@@ -100,8 +100,8 @@ function approvalDiff(name, input) {
100
100
  * and the consumer skips them — the pipe bytes stay identical.
101
101
  */
102
102
  /**
103
- * round 6 (the todo round): translate a do-not-compact-tagged tool result whose
104
- * content follows the todo echo contract (a [todo] header line + one
103
+ * round 6 (the task round): translate a do-not-compact-tagged tool result whose
104
+ * content follows the task echo contract (a [task] header line + one
105
105
  * `[pending|active|done] text` line per item) into the checklist cell's
106
106
  * structured items. Null = not a checklist — the ordinary result cell
107
107
  * renders. Keyed on the TAG (what the extension declared), never on a
@@ -114,7 +114,7 @@ function parseChecklist(tags, content) {
114
114
  const items = [];
115
115
  let header = "";
116
116
  for (const line of content.split("\n")) {
117
- const head = /^\[todo\] (.*)$/.exec(line);
117
+ const head = /^\[task\] (.*)$/.exec(line);
118
118
  if (head !== null) {
119
119
  header = head[1];
120
120
  continue;
@@ -172,6 +172,13 @@ function toRenderInput(ev) {
172
172
  export async function consumeRun(session, run, input, turnNo, faux, liveInput, statusCb) {
173
173
  let last;
174
174
  let usage = { in: null, out: null, cache: null, known: false };
175
+ // R-C item 4: the per-turn cache miss — the overlap with the previous
176
+ // prompt that SHOULD have been cached but was re-sent uncached:
177
+ // missed = min(prevIn, in) − cacheRead. Below the 1024-token floor
178
+ // (Anthropic's minimum cacheable block) it is noise — not surfaced.
179
+ const CACHE_MISS_FLOOR = 1024;
180
+ let prevIn = null;
181
+ let missed = null;
175
182
  // v3 §02: the recap line derives ENTIRELY from the local event stream
176
183
  // (zero tokens) — wall seconds, tool/edit counts, usage, ctx left.
177
184
  const turnStart = Date.now();
@@ -244,7 +251,7 @@ export async function consumeRun(session, run, input, turnNo, faux, liveInput, s
244
251
  reason = m[1];
245
252
  }
246
253
  body.toolResult(ev.callId, { content: text, isError: ev.isError, reason });
247
- // round 6 (the todo round): a result tagged do-not-compact whose content
254
+ // round 6 (the task round): a result tagged do-not-compact whose content
248
255
  // follows the checklist shape also renders as the durable
249
256
  // checklist cell (the CLI translates Event → the tui's own
250
257
  // shape; a non-matching parse falls back to the ordinary
@@ -260,10 +267,18 @@ export async function consumeRun(session, run, input, turnNo, faux, liveInput, s
260
267
  case "text_end":
261
268
  body.textEnd();
262
269
  break;
263
- case "usage":
270
+ case "usage": {
264
271
  usage = { in: ev.inputTokens, out: ev.outputTokens, cache: ev.cacheRead, known: ev.known };
272
+ // R-C item 4: min(prevIn, in) is the part that could have been
273
+ // cached; what cacheRead did NOT cover is the miss.
274
+ if (usage.in !== null && usage.cache !== null && prevIn !== null) {
275
+ const m = Math.min(prevIn, usage.in) - usage.cache;
276
+ missed = m > CACHE_MISS_FLOOR ? m : null;
277
+ }
278
+ prevIn = usage.in;
265
279
  statusCb?.(usage, estimateCtxRatio(session));
266
280
  break;
281
+ }
267
282
  case "uncertain_pending":
268
283
  // ruling #12 (ADR-0038): the ⚠ line is pure INFORMATION now — the
269
284
  // approval chain guards retries, and the human question belongs
@@ -305,6 +320,9 @@ export async function consumeRun(session, run, input, turnNo, faux, liveInput, s
305
320
  tools: toolCount,
306
321
  edits: editCount,
307
322
  usage,
323
+ // R-C item 4: only an above-floor miss is surfaced —
324
+ // the recap gains "· miss N" on the cache segment.
325
+ ...(missed !== null ? { missed } : {}),
308
326
  ctxLeftPct: Number.isFinite(ratio) ? (1 - ratio) * 100 : null,
309
327
  // W19: under plan the recap becomes the way-forward row
310
328
  // (the /mode hints are the mode's exits).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-code",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
4
4
  "description": "kiso CLI — the coding-agent reference product: kiso chat / kiso resume / kiso sessions.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -18,13 +18,13 @@
18
18
  "test": "vitest run"
19
19
  },
20
20
  "dependencies": {
21
- "@vincemakes/kiso-core": "0.1.30",
22
- "@vincemakes/kiso-evals": "0.1.31",
23
- "@vincemakes/kiso-provider-anthropic": "0.1.31",
24
- "@vincemakes/kiso-provider-openai": "0.1.31",
25
- "@vincemakes/kiso-runtime": "0.1.31",
26
- "@vincemakes/kiso-tools-node": "0.1.31",
27
- "@vincemakes/kiso-tui": "0.1.38"
21
+ "@vincemakes/kiso-core": "0.1.31",
22
+ "@vincemakes/kiso-evals": "0.1.32",
23
+ "@vincemakes/kiso-provider-anthropic": "0.1.32",
24
+ "@vincemakes/kiso-provider-openai": "0.1.32",
25
+ "@vincemakes/kiso-runtime": "0.1.32",
26
+ "@vincemakes/kiso-tools-node": "0.1.32",
27
+ "@vincemakes/kiso-tui": "0.1.40"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^26.1.2",