@vincemakes/kiso-code 0.15.5 → 0.15.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.
@@ -0,0 +1,46 @@
1
+ /**
2
+ * REL-0152-D12 — the byte trace: what kiso actually sent, and when.
3
+ *
4
+ * Three defects in this round are only decidable from the byte stream:
5
+ *
6
+ * - REL-0152-D1, the stray `[` and `]` at the row edges. `[` is the
7
+ * CSI introducer and `]` the OSC introducer, so a lost ESC prints
8
+ * exactly those two characters and nothing else — but kiso emits no
9
+ * OSC at all, and every CSI it writes carries more than its
10
+ * introducer. Either the bytes leaving kiso already contain those
11
+ * characters (ours) or they do not (the terminal's parser). Nobody
12
+ * can tell from a screenshot, and three rounds have now tried.
13
+ * - REL-0152-D7, content that appears late or not at all. The frame
14
+ * that should have carried it either went out or did not.
15
+ * - the paste latency. The editor is measured at 146KB in 6ms, so if
16
+ * a paste still feels slow the time is being spent before kiso sees
17
+ * the bytes — which the arrival timestamps show directly.
18
+ *
19
+ * Set KISO_TRACE_BYTES to a path and every byte in BOTH directions is
20
+ * recorded with a millisecond stamp, then the file answers the question
21
+ * instead of another round of inference.
22
+ *
23
+ * KISO_TRACE_BYTES=/tmp/kiso-bytes.jsonl kiso chat
24
+ *
25
+ * One JSON object per line: {ms, dir, n, b} — the stamp relative to the
26
+ * trace's start, "out" or "in", the byte count, and the bytes as base64
27
+ * so no escape, control character or partial UTF-8 sequence is altered
28
+ * on the way to disk. Nothing is interpreted here; interpretation is
29
+ * what the trace exists to make possible.
30
+ *
31
+ * OFF unless the variable is set: zero cost, and it never turns itself
32
+ * on. What it records is the terminal traffic of one session — screen
33
+ * output and keystrokes — so it is a diagnostic a person switches on
34
+ * deliberately, for one run, when something is wrong.
35
+ */
36
+ /**
37
+ * Arm the trace if KISO_TRACE_BYTES names a file. Call once, before the
38
+ * dock is entered, so the first frame is in the record too.
39
+ *
40
+ * stdout is wrapped rather than tapped because there is no other way to
41
+ * see every write: the compositor, the CLI's own logging and node's
42
+ * error paths all reach the terminal through it. stdin is TAPPED — an
43
+ * extra "data" listener, which every listener receives — so the editor's
44
+ * own reading is untouched and the trace cannot swallow a keystroke.
45
+ */
46
+ export declare function armByteTrace(): void;
@@ -0,0 +1,103 @@
1
+ /**
2
+ * REL-0152-D12 — the byte trace: what kiso actually sent, and when.
3
+ *
4
+ * Three defects in this round are only decidable from the byte stream:
5
+ *
6
+ * - REL-0152-D1, the stray `[` and `]` at the row edges. `[` is the
7
+ * CSI introducer and `]` the OSC introducer, so a lost ESC prints
8
+ * exactly those two characters and nothing else — but kiso emits no
9
+ * OSC at all, and every CSI it writes carries more than its
10
+ * introducer. Either the bytes leaving kiso already contain those
11
+ * characters (ours) or they do not (the terminal's parser). Nobody
12
+ * can tell from a screenshot, and three rounds have now tried.
13
+ * - REL-0152-D7, content that appears late or not at all. The frame
14
+ * that should have carried it either went out or did not.
15
+ * - the paste latency. The editor is measured at 146KB in 6ms, so if
16
+ * a paste still feels slow the time is being spent before kiso sees
17
+ * the bytes — which the arrival timestamps show directly.
18
+ *
19
+ * Set KISO_TRACE_BYTES to a path and every byte in BOTH directions is
20
+ * recorded with a millisecond stamp, then the file answers the question
21
+ * instead of another round of inference.
22
+ *
23
+ * KISO_TRACE_BYTES=/tmp/kiso-bytes.jsonl kiso chat
24
+ *
25
+ * One JSON object per line: {ms, dir, n, b} — the stamp relative to the
26
+ * trace's start, "out" or "in", the byte count, and the bytes as base64
27
+ * so no escape, control character or partial UTF-8 sequence is altered
28
+ * on the way to disk. Nothing is interpreted here; interpretation is
29
+ * what the trace exists to make possible.
30
+ *
31
+ * OFF unless the variable is set: zero cost, and it never turns itself
32
+ * on. What it records is the terminal traffic of one session — screen
33
+ * output and keystrokes — so it is a diagnostic a person switches on
34
+ * deliberately, for one run, when something is wrong.
35
+ */
36
+ import { appendFileSync, writeFileSync } from "node:fs";
37
+ let path = null;
38
+ let start = 0;
39
+ function line(dir, data) {
40
+ if (path === null)
41
+ return;
42
+ const buf = typeof data === "string" ? Buffer.from(data, "utf8") : Buffer.from(data);
43
+ try {
44
+ appendFileSync(path, `${JSON.stringify({ ms: Date.now() - start, dir, n: buf.length, b: buf.toString("base64") })}\n`);
45
+ }
46
+ catch {
47
+ // a trace that fails must never take the session with it
48
+ path = null;
49
+ }
50
+ }
51
+ /**
52
+ * Arm the trace if KISO_TRACE_BYTES names a file. Call once, before the
53
+ * dock is entered, so the first frame is in the record too.
54
+ *
55
+ * stdout is wrapped rather than tapped because there is no other way to
56
+ * see every write: the compositor, the CLI's own logging and node's
57
+ * error paths all reach the terminal through it. stdin is TAPPED — an
58
+ * extra "data" listener, which every listener receives — so the editor's
59
+ * own reading is untouched and the trace cannot swallow a keystroke.
60
+ */
61
+ export function armByteTrace() {
62
+ const target = process.env.KISO_TRACE_BYTES;
63
+ if (target === undefined || target === "")
64
+ return;
65
+ path = target;
66
+ start = Date.now();
67
+ try {
68
+ writeFileSync(path, "");
69
+ }
70
+ catch {
71
+ path = null;
72
+ return;
73
+ }
74
+ const write = process.stdout.write.bind(process.stdout);
75
+ process.stdout.write = ((chunk, ...rest) => {
76
+ line("out", chunk);
77
+ return write(chunk, ...rest);
78
+ });
79
+ process.stdin.on("data", (chunk) => line("in", chunk));
80
+ // The environment goes in the record FIRST, because kiso emits
81
+ // DIFFERENT frame bytes per terminal — DEC 2026 synchronized output
82
+ // where it is supported, a cursor-hide degrade on Apple Terminal —
83
+ // so a capture that does not say which terminal made it cannot be
84
+ // compared against anything. Same for the size and the locale: a row
85
+ // is built to a width, and the ambiguous-width characters kiso uses
86
+ // in its own chrome (· … —) are one cell or two depending on how the
87
+ // terminal was told to treat them.
88
+ const env = {
89
+ TERM_PROGRAM: process.env.TERM_PROGRAM ?? null,
90
+ TERM_PROGRAM_VERSION: process.env.TERM_PROGRAM_VERSION ?? null,
91
+ TERM: process.env.TERM ?? null,
92
+ LANG: process.env.LANG ?? null,
93
+ LC_CTYPE: process.env.LC_CTYPE ?? null,
94
+ columns: process.stdout.columns ?? null,
95
+ rows: process.stdout.rows ?? null,
96
+ };
97
+ try {
98
+ appendFileSync(path, `${JSON.stringify({ ms: 0, dir: "env", n: 0, b: "", env })}\n`);
99
+ }
100
+ catch {
101
+ path = null;
102
+ }
103
+ }
package/dist/index.js CHANGED
@@ -42,6 +42,7 @@ import { autoCompactFromEnv, chat, contextWindowTokens, estimateCtxRatio } from
42
42
  import { loadProjectConfig, loadUserConfig, mergeConfigs, resolveAutoCompact, resolveContextWindow, resolveModel } from "./config.js";
43
43
  import { resume } from "./resume.js";
44
44
  import { resumeTail } from "./resume-tail.js";
45
+ import { armByteTrace } from "./byte-trace.js";
45
46
  import { collectSessionCards, projectSessionCard } from "./session-cards.js";
46
47
  // The moved exports stay reachable from this entry — the test imports
47
48
  // (project-trust, coding-agent) never change (B4: zero assertion changes).
@@ -630,6 +631,9 @@ async function main() {
630
631
  // swallows it — the standard "the stream may die under me" idiom.
631
632
  process.stdout.on("error", () => { });
632
633
  process.stderr.on("error", () => { });
634
+ // REL-0152-D12: armed only by KISO_TRACE_BYTES, and armed HERE so the
635
+ // banner and the first frame are in the record. Off by default.
636
+ armByteTrace();
633
637
  // Modes: --mode <name> wins over KISO_MODE — both applied before the
634
638
  // first makeAgent (the tier extensions read `current` live). The flag
635
639
  // is stripped from the positional args, so it works in any position.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-code",
3
- "version": "0.15.5",
3
+ "version": "0.15.6",
4
4
  "description": "kiso CLI \u2014 the durable coding agent that survives kill -9: kiso chat / kiso resume / kiso sessions.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -18,19 +18,19 @@
18
18
  "test": "vitest run"
19
19
  },
20
20
  "dependencies": {
21
- "@vincemakes/kiso-ask-ext": "0.15.5",
22
- "@vincemakes/kiso-core": "0.15.5",
23
- "@vincemakes/kiso-evals": "0.15.5",
24
- "@vincemakes/kiso-mcp-ext": "0.15.5",
25
- "@vincemakes/kiso-provider-anthropic": "0.15.5",
26
- "@vincemakes/kiso-provider-openai": "0.15.5",
27
- "@vincemakes/kiso-runtime": "0.15.5",
28
- "@vincemakes/kiso-skills-ext": "0.15.5",
29
- "@vincemakes/kiso-subagent-ext": "0.15.5",
30
- "@vincemakes/kiso-task-ext": "0.15.5",
31
- "@vincemakes/kiso-tools-node": "0.15.5",
32
- "@vincemakes/kiso-tui": "0.15.5",
33
- "@vincemakes/kiso-tui-cells": "0.15.5"
21
+ "@vincemakes/kiso-ask-ext": "0.15.6",
22
+ "@vincemakes/kiso-core": "0.15.6",
23
+ "@vincemakes/kiso-evals": "0.15.6",
24
+ "@vincemakes/kiso-mcp-ext": "0.15.6",
25
+ "@vincemakes/kiso-provider-anthropic": "0.15.6",
26
+ "@vincemakes/kiso-provider-openai": "0.15.6",
27
+ "@vincemakes/kiso-runtime": "0.15.6",
28
+ "@vincemakes/kiso-skills-ext": "0.15.6",
29
+ "@vincemakes/kiso-subagent-ext": "0.15.6",
30
+ "@vincemakes/kiso-task-ext": "0.15.6",
31
+ "@vincemakes/kiso-tools-node": "0.15.6",
32
+ "@vincemakes/kiso-tui": "0.15.6",
33
+ "@vincemakes/kiso-tui-cells": "0.15.6"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^26.1.2",