@ironbee-ai/cli 0.11.4 → 0.13.0
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/CHANGELOG.md +12 -0
- package/README.md +17 -3
- package/dist/assets/banner.txt +1 -1
- package/dist/clients/claude/hooks/session-start.d.ts.map +1 -1
- package/dist/clients/claude/hooks/session-start.js +7 -0
- package/dist/clients/claude/hooks/session-start.js.map +1 -1
- package/dist/clients/claude/hooks/session-status.d.ts +129 -0
- package/dist/clients/claude/hooks/session-status.d.ts.map +1 -0
- package/dist/clients/claude/hooks/session-status.js +450 -0
- package/dist/clients/claude/hooks/session-status.js.map +1 -0
- package/dist/clients/claude/index.d.ts +26 -0
- package/dist/clients/claude/index.d.ts.map +1 -1
- package/dist/clients/claude/index.js +151 -0
- package/dist/clients/claude/index.js.map +1 -1
- package/dist/clients/cursor/index.d.ts.map +1 -1
- package/dist/clients/cursor/index.js +6 -0
- package/dist/clients/cursor/index.js.map +1 -1
- package/dist/clients/registry.d.ts +8 -9
- package/dist/clients/registry.d.ts.map +1 -1
- package/dist/clients/registry.js +13 -11
- package/dist/clients/registry.js.map +1 -1
- package/dist/commands/config.d.ts +5 -4
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +10 -4
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/hook.js +44 -0
- package/dist/commands/hook.js.map +1 -1
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +4 -5
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/register.d.ts +0 -1
- package/dist/commands/register.d.ts.map +1 -1
- package/dist/commands/register.js +7 -27
- package/dist/commands/register.js.map +1 -1
- package/dist/commands/statusline-toggle.d.ts +29 -0
- package/dist/commands/statusline-toggle.d.ts.map +1 -0
- package/dist/commands/statusline-toggle.js +114 -0
- package/dist/commands/statusline-toggle.js.map +1 -0
- package/dist/commands/statusline.d.ts +24 -0
- package/dist/commands/statusline.d.ts.map +1 -0
- package/dist/commands/statusline.js +79 -0
- package/dist/commands/statusline.js.map +1 -0
- package/dist/commands/uninstall.d.ts +2 -3
- package/dist/commands/uninstall.d.ts.map +1 -1
- package/dist/commands/uninstall.js +3 -4
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/unregister.d.ts +0 -1
- package/dist/commands/unregister.d.ts.map +1 -1
- package/dist/commands/unregister.js +3 -24
- package/dist/commands/unregister.js.map +1 -1
- package/dist/hooks/core/session-state.d.ts +25 -0
- package/dist/hooks/core/session-state.d.ts.map +1 -1
- package/dist/hooks/core/session-state.js +49 -1
- package/dist/hooks/core/session-state.js.map +1 -1
- package/dist/index.js +35 -15
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +64 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +48 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/event.d.ts +60 -0
- package/dist/lib/event.d.ts.map +1 -1
- package/dist/lib/event.js +1 -0
- package/dist/lib/event.js.map +1 -1
- package/dist/lib/fs-prune.d.ts +20 -0
- package/dist/lib/fs-prune.d.ts.map +1 -0
- package/dist/lib/fs-prune.js +72 -0
- package/dist/lib/fs-prune.js.map +1 -0
- package/dist/lib/gitignore.d.ts.map +1 -1
- package/dist/lib/gitignore.js +11 -0
- package/dist/lib/gitignore.js.map +1 -1
- package/dist/lib/install-snapshots.d.ts +70 -0
- package/dist/lib/install-snapshots.d.ts.map +1 -0
- package/dist/lib/install-snapshots.js +168 -0
- package/dist/lib/install-snapshots.js.map +1 -0
- package/dist/lib/projects-registry.d.ts +6 -13
- package/dist/lib/projects-registry.d.ts.map +1 -1
- package/dist/lib/projects-registry.js +11 -46
- package/dist/lib/projects-registry.js.map +1 -1
- package/dist/tui/command.d.ts +18 -0
- package/dist/tui/command.d.ts.map +1 -0
- package/dist/tui/command.js +87 -0
- package/dist/tui/command.js.map +1 -0
- package/dist/tui/config/area.d.ts +6 -0
- package/dist/tui/config/area.d.ts.map +1 -0
- package/dist/tui/config/area.js +16 -0
- package/dist/tui/config/area.js.map +1 -0
- package/dist/tui/config/docs.d.ts +28 -0
- package/dist/tui/config/docs.d.ts.map +1 -0
- package/dist/tui/config/docs.js +68 -0
- package/dist/tui/config/docs.js.map +1 -0
- package/dist/tui/config/edit.d.ts +36 -0
- package/dist/tui/config/edit.d.ts.map +1 -0
- package/dist/tui/config/edit.js +69 -0
- package/dist/tui/config/edit.js.map +1 -0
- package/dist/tui/config/introspect.d.ts +58 -0
- package/dist/tui/config/introspect.d.ts.map +1 -0
- package/dist/tui/config/introspect.js +93 -0
- package/dist/tui/config/introspect.js.map +1 -0
- package/dist/tui/config/schema.d.ts +81 -0
- package/dist/tui/config/schema.d.ts.map +1 -0
- package/dist/tui/config/schema.js +534 -0
- package/dist/tui/config/schema.js.map +1 -0
- package/dist/tui/config/tree.d.ts +39 -0
- package/dist/tui/config/tree.d.ts.map +1 -0
- package/dist/tui/config/tree.js +59 -0
- package/dist/tui/config/tree.js.map +1 -0
- package/dist/tui/config/value.d.ts +75 -0
- package/dist/tui/config/value.d.ts.map +1 -0
- package/dist/tui/config/value.js +228 -0
- package/dist/tui/config/value.js.map +1 -0
- package/dist/tui/config/view.d.ts +13 -0
- package/dist/tui/config/view.d.ts.map +1 -0
- package/dist/tui/config/view.js +423 -0
- package/dist/tui/config/view.js.map +1 -0
- package/dist/tui/import/area.d.ts +11 -0
- package/dist/tui/import/area.d.ts.map +1 -0
- package/dist/tui/import/area.js +202 -0
- package/dist/tui/import/area.js.map +1 -0
- package/dist/tui/index.d.ts +9 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +14 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/platforms/area.d.ts +12 -0
- package/dist/tui/platforms/area.d.ts.map +1 -0
- package/dist/tui/platforms/area.js +228 -0
- package/dist/tui/platforms/area.js.map +1 -0
- package/dist/tui/projects/area.d.ts +26 -0
- package/dist/tui/projects/area.d.ts.map +1 -0
- package/dist/tui/projects/area.js +588 -0
- package/dist/tui/projects/area.js.map +1 -0
- package/dist/tui/queue/area.d.ts +11 -0
- package/dist/tui/queue/area.d.ts.map +1 -0
- package/dist/tui/queue/area.js +338 -0
- package/dist/tui/queue/area.js.map +1 -0
- package/dist/tui/queue/read.d.ts +49 -0
- package/dist/tui/queue/read.d.ts.map +1 -0
- package/dist/tui/queue/read.js +261 -0
- package/dist/tui/queue/read.js.map +1 -0
- package/dist/tui/sessions/area.d.ts +10 -0
- package/dist/tui/sessions/area.d.ts.map +1 -0
- package/dist/tui/sessions/area.js +266 -0
- package/dist/tui/sessions/area.js.map +1 -0
- package/dist/tui/sessions/read.d.ts +79 -0
- package/dist/tui/sessions/read.d.ts.map +1 -0
- package/dist/tui/sessions/read.js +202 -0
- package/dist/tui/sessions/read.js.map +1 -0
- package/dist/tui/shell/area.d.ts +47 -0
- package/dist/tui/shell/area.d.ts.map +1 -0
- package/dist/tui/shell/area.js +13 -0
- package/dist/tui/shell/area.js.map +1 -0
- package/dist/tui/shell/frame.d.ts +23 -0
- package/dist/tui/shell/frame.d.ts.map +1 -0
- package/dist/tui/shell/frame.js +91 -0
- package/dist/tui/shell/frame.js.map +1 -0
- package/dist/tui/shell/registry.d.ts +11 -0
- package/dist/tui/shell/registry.d.ts.map +1 -0
- package/dist/tui/shell/registry.js +29 -0
- package/dist/tui/shell/registry.js.map +1 -0
- package/dist/tui/shell/rerender.d.ts +16 -0
- package/dist/tui/shell/rerender.d.ts.map +1 -0
- package/dist/tui/shell/rerender.js +34 -0
- package/dist/tui/shell/rerender.js.map +1 -0
- package/dist/tui/shell/session.d.ts +75 -0
- package/dist/tui/shell/session.d.ts.map +1 -0
- package/dist/tui/shell/session.js +333 -0
- package/dist/tui/shell/session.js.map +1 -0
- package/dist/tui/shell/shell.d.ts +16 -0
- package/dist/tui/shell/shell.d.ts.map +1 -0
- package/dist/tui/shell/shell.js +213 -0
- package/dist/tui/shell/shell.js.map +1 -0
- package/dist/tui/shell/util.d.ts +18 -0
- package/dist/tui/shell/util.d.ts.map +1 -0
- package/dist/tui/shell/util.js +31 -0
- package/dist/tui/shell/util.js.map +1 -0
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.13.0 (2026-05-24)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **tui:** add full-screen TUI ([#17](https://github.com/ironbee-ai/ironbee-cli/issues/17)) ([e3d9d71](https://github.com/ironbee-ai/ironbee-cli/commit/e3d9d712bfd80c3a559101c8662bb056f9ba628e))
|
|
8
|
+
|
|
9
|
+
## 0.12.0 (2026-05-23)
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **statusline:** add session_status events via a chained statusline wrapper ([#16](https://github.com/ironbee-ai/ironbee-cli/issues/16)) ([a0a5a10](https://github.com/ironbee-ai/ironbee-cli/commit/a0a5a109d9691531711ec1d20ecc5d176aafcc15))
|
|
14
|
+
|
|
3
15
|
## 0.11.4 (2026-05-21)
|
|
4
16
|
|
|
5
17
|
### Features
|
package/README.md
CHANGED
|
@@ -159,6 +159,18 @@ Turns off enforcement but keeps the telemetry path intact. Session lifecycle and
|
|
|
159
159
|
|
|
160
160
|
The toggle re-renders all client artifacts (hooks, skill, rule, MCP servers, permissions) atomically. The change takes effect on the next agent session — restart your editor / agent after toggling.
|
|
161
161
|
|
|
162
|
+
### Optional: statusline `session_status` events (Claude)
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
ironbee statusline enable
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Wraps your Claude Code statusline so that, on every statusline tick, IronBee emits a `session_status` event carrying live **context-window size**, **cost**, and **subscription rate-limit utilization** — signals that are unavailable to hooks or the transcript and can only be read from the statusline. Your existing statusline keeps rendering exactly as before: IronBee installs its wrapper into `.claude/settings.local.json` (the highest-priority, gitignored settings layer) and **chains** to whatever statusline you already had (committed project, global, or local), so the display is unchanged — we just piggyback the telemetry.
|
|
169
|
+
|
|
170
|
+
Auto-enabled when a collector is configured (same as analytics); otherwise opt in with `ironbee statusline enable` or `statusLine.enable: true`. `ironbee statusline disable` restores your original statusline and stops the events. If you change your upstream statusline mid-session, `ironbee statusline sync` re-resolves it for active sessions (otherwise it's picked up on the next session). The change takes effect on the next agent session — restart your editor after toggling.
|
|
171
|
+
|
|
172
|
+
> Claude-only — Cursor has no equivalent statusline mechanism. The events ship through the same queue + collector pipeline as everything else; nothing is written when no collector is configured.
|
|
173
|
+
|
|
162
174
|
### Cursor: additional setup
|
|
163
175
|
|
|
164
176
|
Cursor requires manual activation of MCP servers after install:
|
|
@@ -179,6 +191,7 @@ The next time your AI agent edits code, IronBee will require verification before
|
|
|
179
191
|
ironbee install [project-dir] [--client <name>] [--all] Set up hooks and config; --all → batch across every registered project
|
|
180
192
|
ironbee uninstall [project-dir] [--client <name>] [--all] [-y] Remove hooks and config; --all → batch wipe across every registered project (destructive, prompts unless --yes)
|
|
181
193
|
ironbee update Update IronBee CLI to the latest version (npm self-update)
|
|
194
|
+
ironbee tui [area] Interactive full-screen TUI — browse & drive everything (config / platforms / projects / sessions / queue / import). See docs/tui.md
|
|
182
195
|
ironbee status [project-dir] Show verdict status for active sessions
|
|
183
196
|
ironbee verify [session-id] Dry-run verdict validation
|
|
184
197
|
ironbee analyze [session-id] Analyze session metrics (or all sessions)
|
|
@@ -187,13 +200,14 @@ ironbee browser <enable|disable> [-g|--local] [--client <name>] Manage the b
|
|
|
187
200
|
ironbee backend <enable|disable> [-g|--local] [--client <name>] Manage the runtime-agnostic backend protocol cycle (HTTP/gRPC/GraphQL/WS via backend-devtools)
|
|
188
201
|
ironbee node <enable|disable> [-g|--local] [--client <name>] Manage the Node.js runtime debug cycle (V8 inspector probes via node-devtools)
|
|
189
202
|
ironbee verification <enable|disable> [-g|--local] [--client <name>] Master verification toggle (enable = enforce; disable = monitoring-only, no enforcement but sessions/tools still ship to collector)
|
|
203
|
+
ironbee statusline <enable|disable|sync> [-g|--local] [--client <name>] Manage the Claude statusline integration (emits session_status events — context-window size, cost, subscription rate-limits — and chains your existing statusline). sync re-resolves the chained statusline for active sessions
|
|
190
204
|
ironbee config get <key> [-g|--project|--local] Read a config value (default: merged effective value; flags narrow to one of the three layers)
|
|
191
205
|
ironbee config set <key> <value> [-g|--local] [--client <name>] [--no-rerender] [--json] [--apply-all|--no-apply-all] Write a config value; auto re-renders client artifacts on artifact-affecting keys; -g writes global, --local writes project-local (gitignored)
|
|
192
206
|
ironbee config unset <key> [-g|--local] [--client <name>] [--no-rerender] [--apply-all|--no-apply-all] Remove a config value (idempotent); same target / rerender rules as set
|
|
193
207
|
ironbee config list [-g|--project|--local] Print the entire config (merged / global / project / local)
|
|
194
208
|
ironbee config path [-g|--local] Print the on-disk path of the targeted config file (project default; -g for global, --local for project-local)
|
|
195
|
-
ironbee register [-p <dir>]
|
|
196
|
-
ironbee unregister [-p <dir>]
|
|
209
|
+
ironbee register [-p <dir>] Add this project (path) to the user-home inventory (no artifact writes)
|
|
210
|
+
ironbee unregister [-p <dir>] Remove this project from the user-home inventory (no artifact writes)
|
|
197
211
|
ironbee queue status [--session <id>] Queue status per session (counts, recent dead-letter errors)
|
|
198
212
|
ironbee queue drain [--session <id>] Synchronously drain pending snapshots
|
|
199
213
|
ironbee queue dead-letter list|stats|retry|clear Inspect / retry / clear dead-letter entries
|
|
@@ -320,7 +334,7 @@ Target flags are mutually exclusive: pass at most one of `-g/--global`, `--proje
|
|
|
320
334
|
|
|
321
335
|
**Type coercion** — `set` parses the value as JSON when it can (`true`/`42`/`[…]`/`{…}`) and falls back to a raw string when JSON parse fails. URLs and paths pass through unquoted; pass `--json` to force strict JSON parsing (e.g. when you want the literal string `"42"` instead of the number `42`).
|
|
322
336
|
|
|
323
|
-
**Smart artifact re-render** — when a top-level key affects installed client artifacts (`verification`, `collector`, `browser`, `backend`, `node`, `browserDevTools`, `backendDevTools`, `nodeDevTools`), `set` and `unset` re-render the client files (hooks, MCP entries, skill, rule, permissions) automatically — same code path `verification enable` / `backend enable` / `node enable` use. Other keys (`maxRetries`, `recording`, `jobQueue`, `analytics`, `import`, `ignoredVerifyPatterns`) are pure config flips that the next agent session picks up — no rerender needed.
|
|
337
|
+
**Smart artifact re-render** — when a top-level key affects installed client artifacts (`verification`, `telemetry`, `statusLine`, `collector`, `browser`, `backend`, `node`, `browserDevTools`, `backendDevTools`, `nodeDevTools`), `set` and `unset` re-render the client files (hooks, MCP entries, skill, rule, permissions, statusline) automatically — same code path `verification enable` / `backend enable` / `node enable` use. Other keys (`maxRetries`, `recording`, `jobQueue`, `analytics`, `import`, `ignoredVerifyPatterns`) are pure config flips that the next agent session picks up — no rerender needed.
|
|
324
338
|
|
|
325
339
|
Pass `--no-rerender` to skip the rerender on artifact-affecting keys (handy for scripted bulk edits — follow up with `ironbee install` to resync). If a rerender fails midway, the config file is rolled back to its prior bytes so disk state never diverges from installed artifacts.
|
|
326
340
|
|
package/dist/assets/banner.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-start.d.ts","sourceRoot":"","sources":["../../../../src/clients/claude/hooks/session-start.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"session-start.d.ts","sourceRoot":"","sources":["../../../../src/clients/claude/hooks/session-start.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiBH,wBAAsB,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiG3D"}
|
|
@@ -13,6 +13,7 @@ const actions_1 = require("../../../hooks/core/actions");
|
|
|
13
13
|
const session_state_1 = require("../../../hooks/core/session-state");
|
|
14
14
|
const util_1 = require("../util");
|
|
15
15
|
const config_1 = require("../../../lib/config");
|
|
16
|
+
const session_status_1 = require("./session-status");
|
|
16
17
|
const logger_1 = require("../../../lib/logger");
|
|
17
18
|
const output_1 = require("../../../lib/output");
|
|
18
19
|
const stdin_1 = require("../../../lib/stdin");
|
|
@@ -38,6 +39,12 @@ async function run(projectDir) {
|
|
|
38
39
|
// them on next start.
|
|
39
40
|
(0, session_state_1.setUserEmail)(sessionDir, (0, util_1.getClaudeUserEmail)());
|
|
40
41
|
(0, session_state_1.setUsage)(sessionDir, (0, util_1.resolveClaudeUsage)());
|
|
42
|
+
// Resolve + cache the chained statusline command once per session so the
|
|
43
|
+
// statusline wrapper reads a single state.json field per tick instead of
|
|
44
|
+
// walking the settings cascade. Gated on the feature; harmless when off.
|
|
45
|
+
if ((0, config_1.isSessionStatusEnabled)((0, config_1.loadConfig)(projectDir))) {
|
|
46
|
+
(0, session_state_1.setChainedStatusLine)(sessionDir, (0, session_status_1.resolveChainTarget)(projectDir) ?? null);
|
|
47
|
+
}
|
|
41
48
|
const entry = {
|
|
42
49
|
...(0, actions_1.baseFields)(actionsFile),
|
|
43
50
|
type: "session_start",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-start.js","sourceRoot":"","sources":["../../../../src/clients/claude/hooks/session-start.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;
|
|
1
|
+
{"version":3,"file":"session-start.js","sourceRoot":"","sources":["../../../../src/clients/claude/hooks/session-start.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAiBH,kBAiGC;AAhHD,yDAA2F;AAC3F,qEAA6I;AAC7I,kCAAiE;AACjE,gDAAiG;AACjG,qDAAsD;AACtD,gDAAyD;AACzD,gDAAmD;AACnD,8CAA+C;AAC/C,sDAA2D;AAOpD,KAAK,UAAU,GAAG,CAAC,UAAkB;IACxC,IAAI,KAA8B,CAAC;IACnC,IAAI,CAAC;QACD,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAS,GAAE,CAA4B,CAAC;IAC/D,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QAClB,eAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE,CAAC,CAAC;QAC5C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.command`. On every statusline tick
|
|
5
|
+
* it does two independent things:
|
|
6
|
+
* 1. Submits a `session_status` event (context-window size, cost,
|
|
7
|
+
* subscription rate-limits) to the queue — signals unavailable to hooks
|
|
8
|
+
* or the transcript.
|
|
9
|
+
* 2. Chains to the user's ORIGINAL statusline command so their statusline
|
|
10
|
+
* keeps rendering exactly as before (we wrap, never replace).
|
|
11
|
+
*
|
|
12
|
+
* The event submit is fire-and-forget and must NEVER block or break the
|
|
13
|
+
* statusline render. The chain target is resolved once at SessionStart and
|
|
14
|
+
* cached in state.json; this wrapper falls back to live cascade resolution
|
|
15
|
+
* if the cache is missing/unreadable, so a cache miss can never make the
|
|
16
|
+
* user's statusline vanish.
|
|
17
|
+
*/
|
|
18
|
+
import { SessionStatusEvent } from "../../../lib/event";
|
|
19
|
+
/** Subset of the statusline stdin JSON this wrapper consumes. */
|
|
20
|
+
interface StatusLinePayload {
|
|
21
|
+
session_id?: string;
|
|
22
|
+
model?: {
|
|
23
|
+
id?: string;
|
|
24
|
+
};
|
|
25
|
+
workspace?: {
|
|
26
|
+
project_dir?: string;
|
|
27
|
+
};
|
|
28
|
+
cost?: {
|
|
29
|
+
total_cost_usd?: number;
|
|
30
|
+
total_duration_ms?: number;
|
|
31
|
+
total_api_duration_ms?: number;
|
|
32
|
+
total_lines_added?: number;
|
|
33
|
+
total_lines_removed?: number;
|
|
34
|
+
};
|
|
35
|
+
context_window?: {
|
|
36
|
+
total_input_tokens?: number;
|
|
37
|
+
total_output_tokens?: number;
|
|
38
|
+
context_window_size?: number;
|
|
39
|
+
used_percentage?: number;
|
|
40
|
+
remaining_percentage?: number;
|
|
41
|
+
current_usage?: {
|
|
42
|
+
input_tokens?: number;
|
|
43
|
+
output_tokens?: number;
|
|
44
|
+
cache_creation_input_tokens?: number;
|
|
45
|
+
cache_read_input_tokens?: number;
|
|
46
|
+
} | null;
|
|
47
|
+
};
|
|
48
|
+
rate_limits?: {
|
|
49
|
+
five_hour?: {
|
|
50
|
+
used_percentage?: number;
|
|
51
|
+
resets_at?: number;
|
|
52
|
+
};
|
|
53
|
+
seven_day?: {
|
|
54
|
+
used_percentage?: number;
|
|
55
|
+
resets_at?: number;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* True only when the command is EXACTLY our bare wrapper invocation. A tight
|
|
61
|
+
* match so a user who wraps us themselves (`tee >(ironbee hook session-status)
|
|
62
|
+
* | real-cmd`) is NOT mis-identified as "ours" — that compound is their own
|
|
63
|
+
* statusline and must be chained, not skipped.
|
|
64
|
+
*/
|
|
65
|
+
export declare function isIronbeeStatusLine(command: string | undefined): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Resolve the project dir anchor. Prefers `CLAUDE_PROJECT_DIR` to stay
|
|
68
|
+
* consistent with every other hook and with SessionStart (session runtime
|
|
69
|
+
* files — state.json, queue — live under exactly this path), falling back to
|
|
70
|
+
* the statusline's `workspace.project_dir` and finally cwd. NOT canonicalized
|
|
71
|
+
* — the snapshot store canonicalizes internally on lookup, and the session
|
|
72
|
+
* dir must match the raw path SessionStart wrote under.
|
|
73
|
+
*/
|
|
74
|
+
export declare function resolveProjectDir(input: StatusLinePayload): string;
|
|
75
|
+
/**
|
|
76
|
+
* Resolve the chain target = the statusline command Claude Code WOULD run
|
|
77
|
+
* without us = the highest-priority non-ours `statusLine.command` across the
|
|
78
|
+
* settings layers, walking high → low:
|
|
79
|
+
* 1. localSettings layer — our wrapper overwrote it, so the original lives
|
|
80
|
+
* in the install snapshot.
|
|
81
|
+
* 2. projectSettings (`.claude/settings.json`) — untouched, read live.
|
|
82
|
+
* 3. userSettings (`~/.claude/settings.json`) — untouched, read live.
|
|
83
|
+
* First non-ours wins. `undefined` = nothing to chain.
|
|
84
|
+
*/
|
|
85
|
+
export declare function resolveChainTarget(projectDir: string): string | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Strip the bracketed runtime suffix from the model id
|
|
88
|
+
* (`claude-opus-4-7[1m]` → `claude-opus-4-7`). The `[1m]` extended-context
|
|
89
|
+
* marker is redundant on the event — `context_window.context_window_size`
|
|
90
|
+
* already carries the effective window — so we keep the model field a clean
|
|
91
|
+
* canonical id.
|
|
92
|
+
*/
|
|
93
|
+
export declare function normalizeModelId(id: string | undefined): string;
|
|
94
|
+
/**
|
|
95
|
+
* Build the wire event. Maps fields EXPLICITLY from the statusline JSON (R12)
|
|
96
|
+
* so our wire contract is independent of host JSON drift. `model` is the flat
|
|
97
|
+
* id string. `actionsFile` is only the derivation anchor for `baseFields`
|
|
98
|
+
* (id/session_id/project_name + user/usage) — we never write to it.
|
|
99
|
+
*/
|
|
100
|
+
export declare function buildSessionStatusEvent(input: StatusLinePayload, projectDir: string, sessionId: string): SessionStatusEvent;
|
|
101
|
+
/**
|
|
102
|
+
* Deterministic per-tick id. `total_duration_ms` is monotonic within a
|
|
103
|
+
* session (`Date.now() - startTime`), so each tick gets a distinct id and the
|
|
104
|
+
* backend keeps every tick; a cancelled-then-refired identical tick collides
|
|
105
|
+
* on the same id (dedup). UUID-shaped via the same hashing convention as the
|
|
106
|
+
* analytics deterministic ids.
|
|
107
|
+
*/
|
|
108
|
+
export declare function deriveSessionStatusEventId(sessionId: string, totalDurationMs: number): string;
|
|
109
|
+
/**
|
|
110
|
+
* Signature over the RESOURCE-METRIC fields of the event — the fields that
|
|
111
|
+
* only change on an API response. Deliberately EXCLUDES:
|
|
112
|
+
* - `cost.total_duration` / `total_api_duration` — wall-clock durations that
|
|
113
|
+
* tick up on every statusline fire (including them would make the
|
|
114
|
+
* signature differ every tick, defeating the dedup).
|
|
115
|
+
* - `id` / `timestamp` — per-emit, not metrics.
|
|
116
|
+
* - `activity_id` — correlation metadata, not a resource metric (a new turn
|
|
117
|
+
* with frozen metrics shouldn't re-emit; the next real metric change
|
|
118
|
+
* captures the new activity_id).
|
|
119
|
+
* Used by skip-if-unchanged: two ticks with the same signature carry the same
|
|
120
|
+
* resource snapshot, so the later one is a redundant emit and is skipped.
|
|
121
|
+
*/
|
|
122
|
+
export declare function computeSessionStatusSignature(e: SessionStatusEvent): string;
|
|
123
|
+
/**
|
|
124
|
+
* Statusline entry point. Reads stdin, submits the event (gated, fire-and-
|
|
125
|
+
* forget), then chains the user's original statusline.
|
|
126
|
+
*/
|
|
127
|
+
export declare function runSessionStatus(): Promise<void>;
|
|
128
|
+
export {};
|
|
129
|
+
//# sourceMappingURL=session-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-status.d.ts","sourceRoot":"","sources":["../../../../src/clients/claude/hooks/session-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAeH,OAAO,EAAuC,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAO7F,iEAAiE;AACjE,UAAU,iBAAiB;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,SAAS,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,IAAI,CAAC,EAAE;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAChC,CAAC;IACF,cAAc,CAAC,EAAE;QACb,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,aAAa,CAAC,EAAE;YACZ,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,aAAa,CAAC,EAAE,MAAM,CAAC;YACvB,2BA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