@cchistory/lite 0.8.0 → 0.8.2
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/INSTALL.md +1 -1
- package/apps/lite-cli/dist/agent-contract.d.ts.map +1 -1
- package/apps/lite-cli/dist/agent-contract.js +37 -19
- package/apps/lite-cli/dist/agent-contract.js.map +1 -1
- package/apps/lite-cli/dist/help.d.ts +7 -0
- package/apps/lite-cli/dist/help.d.ts.map +1 -0
- package/apps/lite-cli/dist/help.js +75 -0
- package/apps/lite-cli/dist/help.js.map +1 -0
- package/apps/lite-cli/dist/index.d.ts.map +1 -1
- package/apps/lite-cli/dist/index.js +409 -200
- package/apps/lite-cli/dist/index.js.map +1 -1
- package/apps/lite-cli/dist/index.test.js +38 -76
- package/apps/lite-cli/dist/index.test.js.map +1 -1
- package/apps/lite-cli/dist/json-v2.d.ts.map +1 -1
- package/apps/lite-cli/dist/json-v2.js +18 -1
- package/apps/lite-cli/dist/json-v2.js.map +1 -1
- package/apps/lite-cli/dist/stats-command.d.ts.map +1 -1
- package/apps/lite-cli/dist/stats-command.js +19 -5
- package/apps/lite-cli/dist/stats-command.js.map +1 -1
- package/apps/lite-cli/dist/stats-command.test.js +33 -3
- package/apps/lite-cli/dist/stats-command.test.js.map +1 -1
- package/apps/lite-cli/dist/stats-render.d.ts +3 -2
- package/apps/lite-cli/dist/stats-render.d.ts.map +1 -1
- package/apps/lite-cli/dist/stats-render.js +309 -78
- package/apps/lite-cli/dist/stats-render.js.map +1 -1
- package/apps/lite-cli/dist/stats-visuals.d.ts +38 -0
- package/apps/lite-cli/dist/stats-visuals.d.ts.map +1 -0
- package/apps/lite-cli/dist/stats-visuals.js +239 -0
- package/apps/lite-cli/dist/stats-visuals.js.map +1 -0
- package/apps/lite-cli/dist/usability.test.d.ts +2 -0
- package/apps/lite-cli/dist/usability.test.d.ts.map +1 -0
- package/apps/lite-cli/dist/usability.test.js +170 -0
- package/apps/lite-cli/dist/usability.test.js.map +1 -0
- package/apps/lite-cli/dist/version.d.ts +1 -1
- package/apps/lite-cli/dist/version.js +1 -1
- package/apps/lite-tui/dist/clipboard.d.ts +18 -0
- package/apps/lite-tui/dist/clipboard.d.ts.map +1 -0
- package/apps/lite-tui/dist/clipboard.js +85 -0
- package/apps/lite-tui/dist/clipboard.js.map +1 -0
- package/apps/lite-tui/dist/index.d.ts +2 -0
- package/apps/lite-tui/dist/index.d.ts.map +1 -1
- package/apps/lite-tui/dist/index.js +282 -7
- package/apps/lite-tui/dist/index.js.map +1 -1
- package/apps/lite-tui/dist/input.d.ts +11 -0
- package/apps/lite-tui/dist/input.d.ts.map +1 -1
- package/apps/lite-tui/dist/input.js +33 -3
- package/apps/lite-tui/dist/input.js.map +1 -1
- package/apps/lite-tui/dist/model.d.ts +6 -0
- package/apps/lite-tui/dist/model.d.ts.map +1 -1
- package/apps/lite-tui/dist/model.js +70 -8
- package/apps/lite-tui/dist/model.js.map +1 -1
- package/apps/lite-tui/dist/render.d.ts +1 -1
- package/apps/lite-tui/dist/render.d.ts.map +1 -1
- package/apps/lite-tui/dist/render.js +26 -9
- package/apps/lite-tui/dist/render.js.map +1 -1
- package/apps/lite-tui/dist/state.d.ts +11 -1
- package/apps/lite-tui/dist/state.d.ts.map +1 -1
- package/apps/lite-tui/dist/state.js +69 -5
- package/apps/lite-tui/dist/state.js.map +1 -1
- package/apps/lite-tui/dist/stats-dashboard.test.js +59 -2
- package/apps/lite-tui/dist/stats-dashboard.test.js.map +1 -1
- package/apps/lite-tui/dist/stats-matrix-render.d.ts +9 -0
- package/apps/lite-tui/dist/stats-matrix-render.d.ts.map +1 -0
- package/apps/lite-tui/dist/stats-matrix-render.js +239 -0
- package/apps/lite-tui/dist/stats-matrix-render.js.map +1 -0
- package/apps/lite-tui/dist/stats-query.d.ts +4 -3
- package/apps/lite-tui/dist/stats-query.d.ts.map +1 -1
- package/apps/lite-tui/dist/stats-query.js +24 -3
- package/apps/lite-tui/dist/stats-query.js.map +1 -1
- package/apps/lite-tui/dist/stats-render.d.ts.map +1 -1
- package/apps/lite-tui/dist/stats-render.js +111 -99
- package/apps/lite-tui/dist/stats-render.js.map +1 -1
- package/apps/lite-tui/dist/stats-state.d.ts +15 -2
- package/apps/lite-tui/dist/stats-state.d.ts.map +1 -1
- package/apps/lite-tui/dist/stats-state.js +52 -3
- package/apps/lite-tui/dist/stats-state.js.map +1 -1
- package/apps/lite-tui/dist/stats-visuals.d.ts +29 -0
- package/apps/lite-tui/dist/stats-visuals.d.ts.map +1 -0
- package/apps/lite-tui/dist/stats-visuals.js +283 -0
- package/apps/lite-tui/dist/stats-visuals.js.map +1 -0
- package/apps/lite-tui/dist/usability.test.d.ts +2 -0
- package/apps/lite-tui/dist/usability.test.d.ts.map +1 -0
- package/apps/lite-tui/dist/usability.test.js +269 -0
- package/apps/lite-tui/dist/usability.test.js.map +1 -0
- package/apps/lite-tui/dist/version.d.ts +1 -1
- package/apps/lite-tui/dist/version.js +1 -1
- package/docs/guide/for-agents.md +11 -7
- package/docs/guide/lite.md +108 -38
- package/node_modules/@cchistory/canonical/dist/codex-usage.d.ts +7 -0
- package/node_modules/@cchistory/canonical/dist/codex-usage.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/codex-usage.js +169 -0
- package/node_modules/@cchistory/canonical/dist/codex-usage.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/conversation-evidence.d.ts +1 -0
- package/node_modules/@cchistory/canonical/dist/conversation-evidence.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/conversation-evidence.js +6 -0
- package/node_modules/@cchistory/canonical/dist/conversation-evidence.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/index.d.ts +2 -1
- package/node_modules/@cchistory/canonical/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/index.js +2 -1
- package/node_modules/@cchistory/canonical/dist/index.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/index.test.js +3 -0
- package/node_modules/@cchistory/canonical/dist/index.test.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/model-name-matching.d.ts +12 -0
- package/node_modules/@cchistory/canonical/dist/model-name-matching.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/model-name-matching.js +225 -0
- package/node_modules/@cchistory/canonical/dist/model-name-matching.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/model-name-matching.test.d.ts +2 -0
- package/node_modules/@cchistory/canonical/dist/model-name-matching.test.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/model-name-matching.test.js +72 -0
- package/node_modules/@cchistory/canonical/dist/model-name-matching.test.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/model-pricing-catalog.d.ts +4 -1
- package/node_modules/@cchistory/canonical/dist/model-pricing-catalog.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/model-pricing-catalog.js +325 -76
- package/node_modules/@cchistory/canonical/dist/model-pricing-catalog.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/projection-audit.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/projection-audit.js +3 -1
- package/node_modules/@cchistory/canonical/dist/projection-audit.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/session-interpreter.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/session-interpreter.js +5 -2
- package/node_modules/@cchistory/canonical/dist/session-interpreter.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/usage-breakdown.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/usage-breakdown.js +115 -25
- package/node_modules/@cchistory/canonical/dist/usage-breakdown.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/usage-diagnostics.d.ts +47 -0
- package/node_modules/@cchistory/canonical/dist/usage-diagnostics.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/usage-diagnostics.js +380 -0
- package/node_modules/@cchistory/canonical/dist/usage-diagnostics.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/usage-diagnostics.test.d.ts +2 -0
- package/node_modules/@cchistory/canonical/dist/usage-diagnostics.test.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/usage-diagnostics.test.js +325 -0
- package/node_modules/@cchistory/canonical/dist/usage-diagnostics.test.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/usage-pricing-config.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/usage-pricing-config.js +23 -0
- package/node_modules/@cchistory/canonical/dist/usage-pricing-config.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/usage-pricing.d.ts +7 -1
- package/node_modules/@cchistory/canonical/dist/usage-pricing.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/usage-pricing.js +44 -116
- package/node_modules/@cchistory/canonical/dist/usage-pricing.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/usage-pricing.test.js +137 -0
- package/node_modules/@cchistory/canonical/dist/usage-pricing.test.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/usage-time.d.ts +25 -1
- package/node_modules/@cchistory/canonical/dist/usage-time.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/usage-time.js +82 -1
- package/node_modules/@cchistory/canonical/dist/usage-time.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/usage.d.ts +8 -1
- package/node_modules/@cchistory/canonical/dist/usage.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/usage.js +53 -11
- package/node_modules/@cchistory/canonical/dist/usage.js.map +1 -1
- package/node_modules/@cchistory/canonical/package.json +1 -1
- package/node_modules/@cchistory/domain/dist/index.d.ts +4 -1
- package/node_modules/@cchistory/domain/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/domain/dist/index.js.map +1 -1
- package/node_modules/@cchistory/domain/dist/usage-pricing.d.ts +84 -1
- package/node_modules/@cchistory/domain/dist/usage-pricing.d.ts.map +1 -1
- package/node_modules/@cchistory/domain/package.json +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.d.ts +3 -2
- package/node_modules/@cchistory/live-runtime/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.js +5 -1
- package/node_modules/@cchistory/live-runtime/dist/index.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.test.js +77 -0
- package/node_modules/@cchistory/live-runtime/dist/index.test.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/package.json +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/discovery.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/parser.js +1 -6
- package/node_modules/@cchistory/source-adapters/dist/core/parser.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/path-utils.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/path-utils.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/core/path-utils.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/probe.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/probe.js +1 -31
- package/node_modules/@cchistory/source-adapters/dist/core/probe.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/tokens.test.js +15 -15
- package/node_modules/@cchistory/source-adapters/dist/core/tokens.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts +1 -3
- package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex/runtime.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex/runtime.js +25 -18
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex/runtime.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex.js +18 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex.test.js +67 -0
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/runtime-types.d.ts +0 -5
- package/node_modules/@cchistory/source-adapters/dist/platforms/runtime-types.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/types.d.ts +2 -0
- package/node_modules/@cchistory/source-adapters/dist/platforms/types.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/types.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/package.json +1 -1
- package/package.json +5 -5
- package/skills/using-cchistory-lite/SKILL.md +9 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usability.test.d.ts","sourceRoot":"","sources":["../src/usability.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { PassThrough } from "node:stream";
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { scanLiteHistory } from "@cchistory/live-runtime";
|
|
9
|
+
import { buildOsc52Sequence, copyTextToClipboard } from "./clipboard.js";
|
|
10
|
+
import { configureColorPolicy, stripAnsi } from "./colors.js";
|
|
11
|
+
import { runLiteTui } from "./index.js";
|
|
12
|
+
import { resolveLiteInputEffect } from "./input.js";
|
|
13
|
+
import { KeyDecoder } from "./keys.js";
|
|
14
|
+
import { LiteBrowserModel } from "./model.js";
|
|
15
|
+
import { renderLiteFrame } from "./render.js";
|
|
16
|
+
import { createLiteBrowserState, reduceLiteBrowserState, shouldRunSearch } from "./state.js";
|
|
17
|
+
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../..");
|
|
18
|
+
const codexRoot = path.join(repoRoot, "mock_data", ".codex", "sessions");
|
|
19
|
+
const evidenceFixtureRoot = path.join(repoRoot, "mock_data", "fixtures", "agent-evidence");
|
|
20
|
+
const emptyHome = path.join(repoRoot, "mock_data", "empty-home");
|
|
21
|
+
function pressKeys(model, initial, raw) {
|
|
22
|
+
const decoder = new KeyDecoder();
|
|
23
|
+
let state = initial;
|
|
24
|
+
for (const key of decoder.push(raw)) {
|
|
25
|
+
const effect = resolveLiteInputEffect(state, key);
|
|
26
|
+
if (effect.type === "action")
|
|
27
|
+
state = reduceLiteBrowserState(model, state, effect.action);
|
|
28
|
+
}
|
|
29
|
+
const trailing = decoder.flushPendingEscape();
|
|
30
|
+
if (trailing) {
|
|
31
|
+
const effect = resolveLiteInputEffect(state, trailing);
|
|
32
|
+
if (effect.type === "action")
|
|
33
|
+
state = reduceLiteBrowserState(model, state, effect.action);
|
|
34
|
+
}
|
|
35
|
+
return state;
|
|
36
|
+
}
|
|
37
|
+
test("TUI stats S opens Top Sessions, Enter drills into the session, and t auto-switches to hour on today/24h", async () => {
|
|
38
|
+
configureColorPolicy({ color: false });
|
|
39
|
+
const snapshot = await scanLiteHistory({
|
|
40
|
+
homeDir: emptyHome,
|
|
41
|
+
hostname: "cchistory-tui-usability-test",
|
|
42
|
+
sourceRefs: ["codex"],
|
|
43
|
+
sourceRoots: [{ sourceRef: "codex", baseDir: codexRoot }],
|
|
44
|
+
contextMode: "none",
|
|
45
|
+
safeMode: true,
|
|
46
|
+
});
|
|
47
|
+
const model = new LiteBrowserModel(snapshot, { quotaLimitUsd: 100 });
|
|
48
|
+
let state = reduceLiteBrowserState(model, createLiteBrowserState(model), { type: "toggle-stats" });
|
|
49
|
+
// Unpinned t cycles all -> today -> automatically switches bucket to hour
|
|
50
|
+
assert.equal(state.stats.timeBucket, "day");
|
|
51
|
+
state = pressKeys(model, state, "t");
|
|
52
|
+
assert.equal(state.stats.timePreset, "today");
|
|
53
|
+
assert.equal(state.stats.timeBucket, "hour");
|
|
54
|
+
// Reset filters, open Top Sessions with S, and drill into the selected session with Enter
|
|
55
|
+
state = pressKeys(model, state, "cS");
|
|
56
|
+
assert.equal(state.stats.view, "sessions");
|
|
57
|
+
const sessionsFrame = renderLiteFrame(model, state, { width: 120, height: 34 });
|
|
58
|
+
assert.match(sessionsFrame, /▸ Top Sessions/);
|
|
59
|
+
state = pressKeys(model, state, "\r");
|
|
60
|
+
assert.equal(state.overlay, "none");
|
|
61
|
+
assert.equal(state.browseScope, "sessions");
|
|
62
|
+
assert.match(state.status?.text ?? "", /Opened .*press i to return/);
|
|
63
|
+
// Pressing i returns right back to stats with Top Sessions view preserved
|
|
64
|
+
state = pressKeys(model, state, "i");
|
|
65
|
+
assert.equal(state.overlay, "stats");
|
|
66
|
+
assert.equal(state.stats.view, "sessions");
|
|
67
|
+
});
|
|
68
|
+
test("TUI CJK 2-char queries auto-search without Enter while 2-char ASCII still waits for Enter", async () => {
|
|
69
|
+
const snapshot = await scanLiteHistory({
|
|
70
|
+
homeDir: emptyHome,
|
|
71
|
+
sourceRefs: ["codex"],
|
|
72
|
+
sourceRoots: [{ sourceRef: "codex", baseDir: codexRoot }],
|
|
73
|
+
contextMode: "none",
|
|
74
|
+
safeMode: true,
|
|
75
|
+
});
|
|
76
|
+
const model = new LiteBrowserModel(snapshot);
|
|
77
|
+
const base = createLiteBrowserState(model);
|
|
78
|
+
const latinShort = pressKeys(model, base, "/ab");
|
|
79
|
+
assert.equal(shouldRunSearch(latinShort), false);
|
|
80
|
+
const cjkTwoChar = pressKeys(model, base, "/部署");
|
|
81
|
+
assert.equal(shouldRunSearch(cjkTwoChar), true);
|
|
82
|
+
const cjkOneChar = pressKeys(model, base, "/部");
|
|
83
|
+
assert.equal(shouldRunSearch(cjkOneChar), false);
|
|
84
|
+
});
|
|
85
|
+
test("TUI Ctrl+F loads assistant replies on demand and finds assistant-only text", async () => {
|
|
86
|
+
const seenScans = [];
|
|
87
|
+
const fullEvidence = await scanLiteHistory({
|
|
88
|
+
homeDir: emptyHome,
|
|
89
|
+
sourceRefs: ["codex"],
|
|
90
|
+
sourceRoots: [{ sourceRef: "codex", baseDir: evidenceFixtureRoot }],
|
|
91
|
+
contextMode: "none",
|
|
92
|
+
retainConversationEvidence: true,
|
|
93
|
+
safeMode: true,
|
|
94
|
+
});
|
|
95
|
+
const assistantMsg = fullEvidence.data.conversation_evidence?.find((m) => m.role === "assistant");
|
|
96
|
+
assert.ok(assistantMsg);
|
|
97
|
+
const replyOnlyWord = assistantMsg.text
|
|
98
|
+
.split(/\s+/u)
|
|
99
|
+
.map((word) => word.replace(/[^A-Za-z0-9_-]/gu, ""))
|
|
100
|
+
.find((word) => word.length >= 6 &&
|
|
101
|
+
!fullEvidence.data.turns.some((t) => t.canonical_text.toLowerCase().includes(word.toLowerCase())));
|
|
102
|
+
assert.ok(replyOnlyWord);
|
|
103
|
+
const input = new PassThrough();
|
|
104
|
+
const output = new PassThrough();
|
|
105
|
+
const stdout = [];
|
|
106
|
+
let sentToggle = false;
|
|
107
|
+
let sentQuit = false;
|
|
108
|
+
const exitCode = await runLiteTui(["--search", replyOnlyWord], {
|
|
109
|
+
cwd: repoRoot,
|
|
110
|
+
homeDir: emptyHome,
|
|
111
|
+
isInteractiveTerminal: true,
|
|
112
|
+
input,
|
|
113
|
+
output,
|
|
114
|
+
columns: 110,
|
|
115
|
+
rows: 32,
|
|
116
|
+
stdout: (text) => {
|
|
117
|
+
stdout.push(text);
|
|
118
|
+
const plain = stripAnsi(text);
|
|
119
|
+
if (!sentToggle && plain.includes("[prompts")) {
|
|
120
|
+
sentToggle = true;
|
|
121
|
+
input.push("\x06"); // Ctrl+F to enable +replies search
|
|
122
|
+
}
|
|
123
|
+
else if (sentToggle && !sentQuit && plain.includes("[+replies") && /[1-9]\d* matches/u.test(plain)) {
|
|
124
|
+
sentQuit = true;
|
|
125
|
+
input.push("\x03"); // Ctrl+C exits cleanly even while search input is focused
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
stderr: () => { },
|
|
129
|
+
scan: async (options) => {
|
|
130
|
+
seenScans.push(options);
|
|
131
|
+
return scanLiteHistory({
|
|
132
|
+
...options,
|
|
133
|
+
sourceRefs: ["codex"],
|
|
134
|
+
sourceRoots: [{ sourceRef: "codex", baseDir: evidenceFixtureRoot }],
|
|
135
|
+
safeMode: true,
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
assert.equal(exitCode, 0);
|
|
140
|
+
assert.equal(seenScans.length, 2);
|
|
141
|
+
assert.equal(seenScans[0]?.retainConversationEvidence, undefined);
|
|
142
|
+
assert.equal(seenScans[1]?.retainConversationEvidence, true);
|
|
143
|
+
assert.equal(seenScans[1]?.contextMode, "none");
|
|
144
|
+
assert.ok(sentQuit, "Ctrl+F should find the assistant-only match");
|
|
145
|
+
});
|
|
146
|
+
test("TUI E exports calibrated pricing JSON safely, y copies resume, R exits and prints resume, and --dir scopes snapshot", async () => {
|
|
147
|
+
const tempDir = await mkdtemp(path.join(os.tmpdir(), "cchistory-tui-usability-"));
|
|
148
|
+
try {
|
|
149
|
+
const snapshot = await scanLiteHistory({
|
|
150
|
+
homeDir: emptyHome,
|
|
151
|
+
sourceRefs: ["codex"],
|
|
152
|
+
sourceRoots: [{ sourceRef: "codex", baseDir: codexRoot }],
|
|
153
|
+
contextMode: "none",
|
|
154
|
+
safeMode: true,
|
|
155
|
+
});
|
|
156
|
+
const exportPath = path.join(tempDir, "tui-pricing.json");
|
|
157
|
+
const copied = [];
|
|
158
|
+
// 1. Export pricing via --stats + E + path + Enter, then reject .cchistory export, then copy with y and exit-print with R
|
|
159
|
+
const input = new PassThrough();
|
|
160
|
+
const output = new PassThrough();
|
|
161
|
+
const stdout = [];
|
|
162
|
+
let phase = 0;
|
|
163
|
+
const code = await runLiteTui(["--stats", "--since", "24h", "--quota", "80"], {
|
|
164
|
+
cwd: tempDir,
|
|
165
|
+
homeDir: tempDir,
|
|
166
|
+
isInteractiveTerminal: true,
|
|
167
|
+
input,
|
|
168
|
+
output,
|
|
169
|
+
columns: 120,
|
|
170
|
+
rows: 34,
|
|
171
|
+
scan: async () => snapshot,
|
|
172
|
+
copyToClipboard: async (text) => {
|
|
173
|
+
copied.push(text);
|
|
174
|
+
return { ok: true, via: "osc52" };
|
|
175
|
+
},
|
|
176
|
+
stdout: (text) => {
|
|
177
|
+
stdout.push(text);
|
|
178
|
+
const plain = stripAnsi(text);
|
|
179
|
+
if (phase === 0 && plain.includes("▸ Statistics")) {
|
|
180
|
+
phase = 1;
|
|
181
|
+
// Clear default "./cchistory-pricing.json" (24 chars) via backspaces and type explicit exportPath
|
|
182
|
+
input.push(`E${"\x7f".repeat(30)}${exportPath}\r`);
|
|
183
|
+
}
|
|
184
|
+
else if (phase === 1 && plain.includes("Exported pricing config")) {
|
|
185
|
+
phase = 2;
|
|
186
|
+
// Close stats with i, copy resume command with y, then quit & print resume with R
|
|
187
|
+
input.push("iyR");
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
stderr: () => { },
|
|
191
|
+
});
|
|
192
|
+
assert.equal(code, 0);
|
|
193
|
+
const exported = JSON.parse(await readFile(exportPath, "utf8"));
|
|
194
|
+
assert.equal(exported.schema, "cchistory-lite-pricing/v1");
|
|
195
|
+
assert.equal(exported.quota?.custom_usd, 80);
|
|
196
|
+
assert.equal(copied.length, 1);
|
|
197
|
+
assert.ok(copied[0].length > 0);
|
|
198
|
+
const finalOut = stripAnsi(stdout.join(""));
|
|
199
|
+
assert.ok(finalOut.includes(copied[0]), "R should print the resume command/session ID cleanly on exit");
|
|
200
|
+
// 2. --dir scopes non-interactive frame to 0 sessions when no history ran in tempDir
|
|
201
|
+
const scopedOut = [];
|
|
202
|
+
assert.equal(await runLiteTui(["--dir", tempDir, "--no-color"], {
|
|
203
|
+
cwd: tempDir,
|
|
204
|
+
homeDir: tempDir,
|
|
205
|
+
isInteractiveTerminal: false,
|
|
206
|
+
columns: 100,
|
|
207
|
+
rows: 24,
|
|
208
|
+
stdout: (t) => scopedOut.push(t),
|
|
209
|
+
stderr: () => { },
|
|
210
|
+
scan: async () => snapshot,
|
|
211
|
+
}), 0);
|
|
212
|
+
const frame = scopedOut.join("");
|
|
213
|
+
assert.match(frame, /0 sessions · 0 turns/);
|
|
214
|
+
assert.match(frame, /dir:/);
|
|
215
|
+
// 3. Pricing export rejects .cchistory and native source roots
|
|
216
|
+
const unsafeInput = new PassThrough();
|
|
217
|
+
const unsafeStdout = [];
|
|
218
|
+
let unsafePhase = 0;
|
|
219
|
+
const unsafePath = path.join(tempDir, ".cchistory", "pricing.json");
|
|
220
|
+
assert.equal(await runLiteTui(["--stats"], {
|
|
221
|
+
cwd: tempDir,
|
|
222
|
+
homeDir: tempDir,
|
|
223
|
+
isInteractiveTerminal: true,
|
|
224
|
+
input: unsafeInput,
|
|
225
|
+
output: new PassThrough(),
|
|
226
|
+
columns: 120,
|
|
227
|
+
rows: 34,
|
|
228
|
+
scan: async () => snapshot,
|
|
229
|
+
stdout: (text) => {
|
|
230
|
+
unsafeStdout.push(text);
|
|
231
|
+
const plain = stripAnsi(text);
|
|
232
|
+
if (unsafePhase === 0 && plain.includes("▸ Statistics")) {
|
|
233
|
+
unsafePhase = 1;
|
|
234
|
+
unsafeInput.push(`E${"\x7f".repeat(30)}${unsafePath}\r`);
|
|
235
|
+
}
|
|
236
|
+
else if (unsafePhase === 1 && plain.includes("Full store path")) {
|
|
237
|
+
unsafePhase = 2;
|
|
238
|
+
unsafeInput.push("q");
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
stderr: () => { },
|
|
242
|
+
}), 0);
|
|
243
|
+
assert.equal(unsafePhase, 2, "TUI export should reject .cchistory destination");
|
|
244
|
+
}
|
|
245
|
+
finally {
|
|
246
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
test("clipboard helper builds valid OSC 52 sequence and degrades safely when native tools fail", async () => {
|
|
250
|
+
const seq = buildOsc52Sequence("cd /tmp && codex resume abc");
|
|
251
|
+
assert.ok(seq.startsWith("\x1b]52;c;"));
|
|
252
|
+
assert.ok(seq.endsWith("\x07"));
|
|
253
|
+
const b64 = seq.slice("\x1b]52;c;".length, -1);
|
|
254
|
+
assert.equal(Buffer.from(b64, "base64").toString("utf8"), "cd /tmp && codex resume abc");
|
|
255
|
+
const written = [];
|
|
256
|
+
const res = await copyTextToClipboard("hello", {
|
|
257
|
+
writeOsc52: (s) => written.push(s),
|
|
258
|
+
runCommand: async () => false,
|
|
259
|
+
});
|
|
260
|
+
assert.equal(res.ok, true);
|
|
261
|
+
assert.equal(res.via, "osc52");
|
|
262
|
+
assert.equal(written.length, 1);
|
|
263
|
+
const noneRes = await copyTextToClipboard("hello", {
|
|
264
|
+
runCommand: async () => false,
|
|
265
|
+
});
|
|
266
|
+
assert.equal(noneRes.ok, false);
|
|
267
|
+
assert.equal(noneRes.via, "none");
|
|
268
|
+
});
|
|
269
|
+
//# sourceMappingURL=usability.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usability.test.js","sourceRoot":"","sources":["../src/usability.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAA+B,MAAM,yBAAyB,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAA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CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,6BAA6B,CAAC,CAAC;IAEzF,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAG,MAAM,mBAAmB,CAAC,OAAO,EAAE;QAC7C,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAClC,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,KAAK;KAC9B,CAAC,CAAC;IACH,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAC3B,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAEhC,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,OAAO,EAAE;QACjD,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,KAAK;KAC9B,CAAC,CAAC;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAChC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACpC,CAAC,CAAC,CAAC"}
|
package/docs/guide/for-agents.md
CHANGED
|
@@ -21,13 +21,17 @@ derivation → one in-memory snapshot → projections → the surface you called
|
|
|
21
21
|
not a missing feature.
|
|
22
22
|
- The TUI holds one snapshot. Shell holds one collection plus a bounded detail
|
|
23
23
|
cache; each response identifies its actual read. Refresh replaces these on success.
|
|
24
|
-
- Context-light scans (the default for collection, search, and
|
|
25
|
-
release full assistant/tool context after projecting turns and
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
- Context-light scans (the default for collection, search, stats, and Markdown
|
|
25
|
+
export reads) release full assistant/tool context after projecting turns and
|
|
26
|
+
sessions. CLI `search` (default `--content conversation`), `query`/`shell`
|
|
27
|
+
conversation search, and Markdown `export` additionally retain masked
|
|
28
|
+
user/reply evidence without full tool/system bodies. Pass `--prompts-only`
|
|
29
|
+
on CLI `search` to skip reply evidence retention. Full-context paths —
|
|
30
|
+
JSON/JSONL `export`, `show session <exact id>`, and context-matching
|
|
31
|
+
`show` / `query` replies — retain more and therefore cost more.
|
|
32
|
+
- Collection commands (`ls`, `latest`, `sample`, `search`, `tree projects`,
|
|
33
|
+
`query`, `shell`) default to `--dir=$PWD`. `stats` defaults to all discovered
|
|
34
|
+
history on the machine unless `--dir` is provided.
|
|
31
35
|
|
|
32
36
|
## Cost model
|
|
33
37
|
|
package/docs/guide/lite.md
CHANGED
|
@@ -49,7 +49,7 @@ globally:
|
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
51
|
pnpm run lite:link # installs cchistory-lite
|
|
52
|
-
pnpm run lite:tui:link # installs cchistory-lite-tui (
|
|
52
|
+
pnpm run lite:tui:link # installs standalone cchistory-lite-tui (`cchistory-lite tui` also resolves the sibling build directly)
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
Re-run the link commands after rebuilding to pick up changes; remove them with
|
|
@@ -100,9 +100,10 @@ ls [projects|sessions|families|sources] [--limit <n>|--all] [--dir <path>]
|
|
|
100
100
|
latest [sessions|turns] [N] [--dir <path>]
|
|
101
101
|
sample [N] [--dir <path>] [--no-dir]
|
|
102
102
|
tree [projects|project <ref>|session <ref>] [--dir <path>]
|
|
103
|
-
search <query> [--
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
search <query> [--content conversation|prompts] [--prompts-only] [--group-by session|message]
|
|
104
|
+
[--project <ref>] [--source <ref>] [--dir <path>] [--no-dir] [--limit <n>] [--offset <n>]
|
|
105
|
+
show project|session|turn|source <ref> [--full] [--compact]
|
|
106
|
+
stats [--by source|project|model|session|hour|hour_of_day|day|week|month[,...]] [--project <ref>] [--model <pattern>]
|
|
106
107
|
[--since <window>] [--from <time>] [--to <time>] [--tz <zone>]
|
|
107
108
|
[--week-mode rolling_7d|iso_week|custom_reset] [--pricing <file>] [--quota <usd>]
|
|
108
109
|
[--explain-pricing] [--export-pricing <file|->] [--dir <path>] [--no-dir]
|
|
@@ -110,7 +111,9 @@ query --request <file|-> | --sql <text> | --sql-file <file|-> [--params <JSON-ar
|
|
|
110
111
|
[--dir <path>] [--no-dir]
|
|
111
112
|
shell [--dir <path>] [--no-dir] [--idle-timeout <seconds>]
|
|
112
113
|
export --format jsonl|json|markdown [--out <file>|-]
|
|
113
|
-
tui
|
|
114
|
+
tui [--dir <path>] [--no-dir] [--stats] [--since <window>]
|
|
115
|
+
[--project <ref> | --session <ref> | --turn <ref>] [--search <query>]
|
|
116
|
+
[--pricing <file>] [--quota <usd>]
|
|
114
117
|
help [command]
|
|
115
118
|
agent [skill|guide]
|
|
116
119
|
```
|
|
@@ -119,15 +122,47 @@ Use `--json` for compact `cchistory-lite/v2` read output, or
|
|
|
119
122
|
`--json=canonical` for full `cchistory-lite-canonical/v1` evidence. Each one-shot
|
|
120
123
|
history command performs a fresh canonical scan (sources is metadata-only unless --complete); use `query` to batch agent reads into
|
|
121
124
|
one scan, `shell` to keep one directory-scoped snapshot in memory, or the TUI
|
|
122
|
-
to amortize a scan across interactive browsing. `--json`, `query`, and
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
to amortize a scan across interactive browsing. `--json`, `query`, `shell`, and the
|
|
126
|
+
human collection commands (`ls`, `latest`, `sample`, `search`, `tree projects`)
|
|
127
|
+
default to `--dir=$PWD` and print the chosen scope on stderr; pass `--no-dir` to
|
|
128
|
+
disable that scope. `stats` and `tui` default to all discovered history on the
|
|
129
|
+
machine and accept `--dir <path>` to narrow to one directory. `--dir` filters
|
|
126
130
|
sessions by working directory and bounds the source-byte estimate to files that
|
|
127
|
-
may match. Bound further with `--source`, `--limit-files`, or `sample`.
|
|
128
|
-
`export`
|
|
131
|
+
may match. Bound further with `--source`, `--limit-files`, or `sample`. Unscoped
|
|
132
|
+
`stats`, `tui`, and `export` scan every selected source and estimate every selected
|
|
129
133
|
root.
|
|
130
134
|
|
|
135
|
+
Running `cchistory-lite` with no arguments (or `cchistory-lite help`) prints a concise
|
|
136
|
+
command overview; run `cchistory-lite help <command>` for full command options, or
|
|
137
|
+
`cchistory-lite agent` for the machine-readable JSON contract.
|
|
138
|
+
|
|
139
|
+
`search` defaults to full conversation search (`--content conversation`), checking
|
|
140
|
+
session titles, user prompts, and assistant replies while keeping a context-light
|
|
141
|
+
scan (heavy tool outputs and system messages are not retained). Pass `--prompts-only`
|
|
142
|
+
(or `--content prompts`) to restrict search to titles and user prompts, and
|
|
143
|
+
`--group-by message` to return every matching message instead of one top-level row
|
|
144
|
+
per session.
|
|
145
|
+
|
|
146
|
+
`show turn <ref>` wraps and displays the complete assistant replies by default
|
|
147
|
+
together with the session's `Resume` command and tool call statuses (`--compact`
|
|
148
|
+
switches back to single-line reply previews). `show session <ref> --full` prints
|
|
149
|
+
every turn's complete prompt, assistant replies, and tool calls in order.
|
|
150
|
+
|
|
151
|
+
`stats` defaults to whole-machine scope (`--dir` narrows to one directory). For
|
|
152
|
+
short windows (`--since today`, `--since 24h`, or `--from`/`--to` ranges within 48
|
|
153
|
+
hours), time rollups automatically switch from `day` to `hour` unless `--by`
|
|
154
|
+
explicitly chooses a bucket, and zero-fill intermediate empty hours so real time
|
|
155
|
+
gaps stay visible. `--by hour_of_day` aggregates all 24 clock hours (`00:00`–`23:00`).
|
|
156
|
+
`--by session` ranks the highest-cost/token sessions
|
|
157
|
+
with subagent and tool counts. Terminal `stats` renders a 5-component cost-mix bar,
|
|
158
|
+
a dual-marker quota pace gauge (actual spend vs elapsed period time when `--quota`
|
|
159
|
+
is given), cache hit rate with estimated cache savings and `>200K` long-context
|
|
160
|
+
call count, a gap-filled time trend sparkline, a 24-hour `00–23` clock activity
|
|
161
|
+
strip, and max-normalized 1/8th-block comparison bars with share `%` and cache-hit
|
|
162
|
+
rates in rollup tables (adapting to terminal width and degrading cleanly under
|
|
163
|
+
`NO_COLOR=1` or non-TTY output). JSON `stats` responses include additive
|
|
164
|
+
`efficiency` and `quota_pace` fields.
|
|
165
|
+
|
|
131
166
|
`ls` shows 20 rows by default. Pass `--limit <n>` or `--all`; JSON collection
|
|
132
167
|
payloads include the untruncated `total` and returned `shown` counts. `ls families`
|
|
133
168
|
is a read-only inventory of parent sessions that have delegated subagents: combined
|
|
@@ -159,9 +194,10 @@ bounds the pre-flight memory estimate to source files that may match that
|
|
|
159
194
|
working directory. It expands `~`,
|
|
160
195
|
resolves relative paths from the current directory, and matches lexical path
|
|
161
196
|
segments. Sessions without `working_directory` are excluded. It applies to
|
|
162
|
-
`latest`, `sample`, `ls projects`, `ls sessions`, `search`, `stats`, and
|
|
197
|
+
`latest`, `sample`, `ls projects`, `ls sessions`, `search`, `stats`, `tui`, and
|
|
163
198
|
`tree projects`; the latter keeps projects as containers but removes non-matching
|
|
164
|
-
sessions, turns, and empty projects. `sources`, `export`,
|
|
199
|
+
sessions, turns, and empty projects. `sources`, `export`, unscoped `stats`/`tui`,
|
|
200
|
+
and `--no-dir`
|
|
165
201
|
still walk every selected adapter root. Use `--source <slot>` or `--limit-files`
|
|
166
202
|
to shrink an unscoped estimate, and `--source-root <slot>=<path>` when the
|
|
167
203
|
native history itself is in a non-default location (the adapter's default tree,
|
|
@@ -305,12 +341,16 @@ do not automatically retry with broader filters or a disabled guard.
|
|
|
305
341
|
|
|
306
342
|
## Lite TUI
|
|
307
343
|
|
|
308
|
-
`cchistory-lite-tui`
|
|
344
|
+
`cchistory-lite-tui` (and `cchistory-lite tui`, which resolves the sibling build
|
|
345
|
+
and forwards TUI flags) is a full-screen, keyboard-driven browser over one
|
|
309
346
|
context-light snapshot held for the process lifetime. It accepts
|
|
310
|
-
`--source-root`, `--source`, `--limit-files`, `--safe`,
|
|
311
|
-
`--quota`, and can open directly at one
|
|
347
|
+
`--source-root`, `--source`, `--dir`, `--no-dir`, `--limit-files`, `--safe`,
|
|
348
|
+
`--stats`, `--since`, `--pricing`, and `--quota`, and can open directly at one
|
|
349
|
+
focused object, search query, or stats dashboard:
|
|
312
350
|
|
|
313
351
|
```bash
|
|
352
|
+
cchistory-lite tui --dir /path/to/project
|
|
353
|
+
cchistory-lite tui --stats --since today --quota 100
|
|
314
354
|
cchistory-lite-tui --project <ref>
|
|
315
355
|
cchistory-lite-tui --session <ref>
|
|
316
356
|
cchistory-lite-tui --turn <ref>
|
|
@@ -327,33 +367,61 @@ Up/Down or j/k move cursor Tab / Shift+Tab next / previous pane
|
|
|
327
367
|
PgUp/PgDn page Enter drill into the focused pane
|
|
328
368
|
g / G first / last Esc back or close an overlay
|
|
329
369
|
p / S projects / sessions t / d turns / detail pane
|
|
330
|
-
/ search
|
|
331
|
-
|
|
370
|
+
/ search (Ctrl+F: replies) i usage & cost stats
|
|
371
|
+
y / Y copy resume / Q&A R exit and print resume command
|
|
372
|
+
s source status ? help
|
|
332
373
|
r refresh from disk q quit and release snapshot
|
|
333
374
|
```
|
|
334
375
|
|
|
335
|
-
In the usage stats dashboard (`i`), four panels (`By project`, `By model`,
|
|
336
|
-
`By source`, and `By day`/`week`/`month`) show
|
|
337
|
-
|
|
376
|
+
In the usage stats dashboard (`i`), four fixed-column panels (`By project`, `By model`,
|
|
377
|
+
`By source`, and `By hour`/`hour_of_day`/`day`/`week`/`month`) show max-normalized
|
|
378
|
+
1/8th-block bars, tokens, multiplier-adjusted USD cost, cache hit rates,
|
|
379
|
+
a 5-component cost-mix bar, a diagnostics strip (cache savings, `>200K` tier
|
|
380
|
+
calls, and `00–23h` clock rhythm), a gap-filled trend sparkline, and a dual-marker
|
|
381
|
+
period quota pace gauge:
|
|
338
382
|
press `Tab`/`1-4` to focus a panel, `Space`/`Enter` to toggle multi-dimensional
|
|
339
|
-
cross-filters (`c` clears), `t`/`b`/`w`/`o` to cycle time window
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
383
|
+
cross-filters (`c` clears), `t`/`b`/`w`/`o` to cycle time window (`today`/`24h`
|
|
384
|
+
auto-switches the time panel to gap-filled `hour` unless `b` was pinned manually),
|
|
385
|
+
bucket (including `hour_of_day` `00–23`), week reset mode, or sort order, `v` to
|
|
386
|
+
open the Matrix breakdown table (`g` cycles `Project × Model` / `Model × Time` /
|
|
387
|
+
`Project × Time` / `All 4`; shows `In`/`CR`/`CW`/`Out`/`Hit`/`Mult`/`List$`/`Adj$`,
|
|
388
|
+
`←/→` toggles columns on narrow terminals, and a pinned bottom inspector shows the
|
|
389
|
+
selected row's complete untruncated labels and metrics), `S` to
|
|
390
|
+
open the Top Sessions ranking (`Enter` jumps directly into that session in the
|
|
391
|
+
browser, and `i` returns to the preserved stats view), `m` to calibrate
|
|
392
|
+
per-model/per-component multipliers and aliases in memory (`+`/`-`, `0`/`1`/`u`,
|
|
393
|
+
`a` alias, `e` value, `R` reset), `E` to export the calibrated pricing config JSON
|
|
394
|
+
(checked against `.cchistory`, `cchistory.sqlite`, symlinks, and native source
|
|
395
|
+
roots), and `$` to set a period USD quota.
|
|
396
|
+
Both CLI `stats` and TUI use the bundled offline `models.dev/api.json` snapshot,
|
|
397
|
+
supplemented with missing direct-provider models from a pinned LiteLLM snapshot
|
|
344
398
|
(plus local `--pricing` / `CCHISTORY_PRICING_CONFIG` overrides, see
|
|
345
399
|
[pricing.example.json](pricing.example.json)) and never access the network at
|
|
346
|
-
runtime.
|
|
347
|
-
|
|
348
|
-
|
|
400
|
+
runtime. Generic name matching handles provider prefixes, separator spellings, dates and tool
|
|
401
|
+
suffixes such as `Build` against the catalog, so `grok-4.6-build` and `grok-4.7-build` resolve
|
|
402
|
+
without per-version aliases. Exact names and authored separator spellings take priority;
|
|
403
|
+
numeric versions stay distinct. `Fast`, `Flex` and other rate qualifiers retain their own
|
|
404
|
+
prices: `grok-4.7-fast` resolves to the official Grok Build Fast rates and context tiers.
|
|
405
|
+
A variant with missing prices, or an ambiguous spelling with conflicting prices, keeps its
|
|
406
|
+
tokens under unpriced usage. Configured aliases carry Fast/Flex qualifiers to their targets;
|
|
407
|
+
explicit aliases and price overrides select gateway-specific rates. Native independent
|
|
408
|
+
calls use their own model and timestamp, including Codex compaction requests and calls
|
|
409
|
+
with `turn_id: null`. Overview and source/project/day rollups retain unique user-turn
|
|
410
|
+
counts. Context price tiers apply to individual recorded calls; turn-only evidence uses
|
|
411
|
+
base rates. See [pricing sources and accounting comparisons](../research/2026-11-17-ccusage-accounting.md)
|
|
412
|
+
for the manual catalog refresh and reproducible ccusage comparison.
|
|
349
413
|
|
|
350
414
|
The interactive TUI uses the alternate screen and raw keyboard input. Search
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
415
|
+
auto-runs from 2 characters for CJK queries and from 4 characters for Latin
|
|
416
|
+
queries (shorter queries run on Enter). Inside search, press `Ctrl+F` to toggle
|
|
417
|
+
between prompt/title search and full-conversation search (which runs a one-time
|
|
418
|
+
context-light rescan retaining masked assistant replies). Startup and refresh
|
|
419
|
+
scans are context-light. Press Enter on the Detail pane to load full conversation
|
|
420
|
+
context for only that session. `y` copies the active session's resume command
|
|
421
|
+
(via OSC 52 and native clipboard tools), `Y` copies the active turn's prompt and
|
|
422
|
+
assistant reply, and `R` exits the TUI and prints the resume command directly to
|
|
423
|
+
stdout. A failed refresh keeps the previous complete snapshot available. When
|
|
424
|
+
stdout is not interactive, the TUI renders one fixed snapshot frame and exits 0.
|
|
357
425
|
|
|
358
426
|
## One-Way Export
|
|
359
427
|
|
|
@@ -367,9 +435,11 @@ cchistory-lite export --format jsonl --out -
|
|
|
367
435
|
```
|
|
368
436
|
|
|
369
437
|
JSON and JSONL output carry the schema marker
|
|
370
|
-
`cchistory-lite-export/v1`.
|
|
371
|
-
|
|
372
|
-
|
|
438
|
+
`cchistory-lite-export/v1`. Markdown export stays context-light while retaining
|
|
439
|
+
masked user prompts and assistant replies, grouping conversations by session with
|
|
440
|
+
titles, metadata, and `Resume` commands. Lite has no import command, and Full must
|
|
441
|
+
not treat this output as a restorable evidence bundle because it does not contain
|
|
442
|
+
copied raw parser input.
|
|
373
443
|
|
|
374
444
|
## Canonical Semantics Contract
|
|
375
445
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role: Resolve Codex usage evidence into independent calls, including matched
|
|
3
|
+
* compaction requests and calls without assistant text. Owns no source reads.
|
|
4
|
+
*/
|
|
5
|
+
import type { ConversationAtom, ParsedSessionMetadata, SourceFragment } from "@cchistory/domain";
|
|
6
|
+
export declare function resolveCodexUsageAtoms(draft: Readonly<ParsedSessionMetadata>, atoms: readonly ConversationAtom[], fragments: readonly SourceFragment[]): readonly ConversationAtom[];
|
|
7
|
+
//# sourceMappingURL=codex-usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-usage.d.ts","sourceRoot":"","sources":["../src/codex-usage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,cAAc,EAAqB,MAAM,mBAAmB,CAAC;AA8BpH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,QAAQ,CAAC,qBAAqB,CAAC,EAAE,KAAK,EAAE,SAAS,gBAAgB,EAAE,EAAE,SAAS,EAAE,SAAS,cAAc,EAAE,GAC/G,SAAS,gBAAgB,EAAE,CA6H7B"}
|