throughline 0.3.17 → 0.3.18

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/README.md CHANGED
@@ -178,9 +178,16 @@ Example output (real values from a running 1M-context Opus session):
178
178
  - **Line-wrap safe.** Each line is truncated to `process.stdout.columns - 1`
179
179
  before drawing, preserving ANSI color codes. The redraw cursor math cannot
180
180
  desync on narrow terminals.
181
- - **Resize resilient.** Column width is polled every second, so pane drags that
182
- don't fire a terminal `resize` event (common in VS Code's integrated
183
- terminal) still trigger a full redraw.
181
+ - **Resize resilient via OSC 18t.** Windows ConPTY + VS Code task terminals
182
+ freeze `process.stdout.columns` at the PTY's initial size and never
183
+ propagate panel resizes into Node, so polling or `resize` events can't
184
+ catch them. Throughline queries the terminal itself with the CSI `18 t`
185
+ escape (`\x1b[18t`) every tick, parses the `\x1b[8;rows;cols t` reply off
186
+ stdin in raw mode, and uses the real current width for truncation. On
187
+ terminals that don't answer the query, the renderer falls back to
188
+ `process.stdout.columns → env.COLUMNS → 80`. When the width changes the
189
+ viewport is cleared in full (`\x1b[2J\x1b[3J\x1b[H`) before the next
190
+ frame so the previous, wrongly-sized frame can't stack beneath it.
184
191
  - **Per-row "last updated" stamp.** Each session row carries an 8-cell
185
192
  `just now` / `24m ago` stamp right after the session id, placed before the
186
193
  bar so narrow terminals don't truncate it. It resets to `just now` on every
@@ -256,6 +263,7 @@ entry to the `tasks` array yourself:
256
263
  | `throughline install --project` | Register hooks in `.claude/settings.json` for this repo only |
257
264
  | `throughline uninstall` | Remove Throughline hooks from the settings file |
258
265
  | `throughline monitor [--all] [--session <id>]` | Run the multi-session token monitor |
266
+ | `throughline monitor --diag` | Dump TTY/columns/env diagnostics (for debugging monitor render bugs) |
259
267
  | `throughline detail <time>` | Retrieve L2 body text and L3 tool I/O for a turn (see below) |
260
268
  | `throughline save-inflight` | Called by `/tl` to attach an in-flight memo (stdin) to the current baton |
261
269
  | `throughline doctor` | Check Node version, hook registration, DB writability, PATH |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "throughline",
3
- "version": "0.3.17",
3
+ "version": "0.3.18",
4
4
  "type": "module",
5
5
  "description": "Claude Code hooks plugin for structured context compression (/clear-safe persistent memory)",
6
6
  "keywords": [
@@ -14,6 +14,7 @@
14
14
 
15
15
  import { getDb } from './db.mjs';
16
16
  import { writeBaton } from './baton.mjs';
17
+ import { ensureMonitorTaskFile } from './vscode-task.mjs';
17
18
  import { appendFileSync, mkdirSync } from 'node:fs';
18
19
  import { join, dirname } from 'node:path';
19
20
  import { homedir } from 'node:os';
@@ -54,6 +55,16 @@ async function main() {
54
55
  const payload = JSON.parse(raw);
55
56
  const { session_id, cwd, prompt } = payload;
56
57
 
58
+ // VSCode 新規プロジェクトへの tasks.json 自動プロビジョニング。
59
+ // SessionStart/Stop に加えここでも呼ぶことで、どれか 1 つでも発火すれば初回メッセージ送信で
60
+ // tasks.json が生える。冪等性は ensureMonitorTaskFile 側で保証。/tl 判定より前に置く。
61
+ try {
62
+ ensureMonitorTaskFile({ cwd: cwd ?? process.cwd(), env: process.env });
63
+ } catch (err) {
64
+ const msg = err instanceof Error ? err.message : 'unknown';
65
+ process.stderr.write(`[vscode-task] ${msg}\n`);
66
+ }
67
+
57
68
  if (!isBatonCommand(prompt)) {
58
69
  process.exit(0);
59
70
  return;
@@ -21,6 +21,7 @@ import { getDb } from './db.mjs';
21
21
  import { consumeBaton } from './baton.mjs';
22
22
  import { mergeSpecificPredecessor, resolveMergeTarget } from './session-merger.mjs';
23
23
  import { buildResumeContext } from './resume-context.mjs';
24
+ import { ensureMonitorTaskFile } from './vscode-task.mjs';
24
25
  import { appendFileSync, mkdirSync } from 'node:fs';
25
26
  import { join, dirname } from 'node:path';
26
27
  import { homedir } from 'node:os';
@@ -55,6 +56,18 @@ async function main() {
55
56
  const db = getDb();
56
57
  const now = Date.now();
57
58
 
59
+ // 0. VSCode で開かれた新規プロジェクトに .vscode/tasks.json を自動プロビジョニング。
60
+ // Stop hook 側にも同じ呼び出しがあるが、Stop が発火しない環境(応答中断・IDE 挙動差)
61
+ // でも SessionStart は必ず走るので、新規プロジェクトでの自動起動を確実化する保険。
62
+ // 冪等性は ensureMonitorTaskFile 側で保証されており、Stop/UserPromptSubmit と重複呼び
63
+ // 出しされても安全。
64
+ try {
65
+ ensureMonitorTaskFile({ cwd: projectPath, env: process.env });
66
+ } catch (err) {
67
+ const msg = err instanceof Error ? err.message : 'unknown';
68
+ process.stderr.write(`[vscode-task] ${msg}\n`);
69
+ }
70
+
58
71
  // 1. sessions テーブルに INSERT OR IGNORE
59
72
  db.prepare(
60
73
  `INSERT OR IGNORE INTO sessions (session_id, project_path, status, created_at, updated_at)