@llblab/pi-kit 0.25.0 → 0.26.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/BACKLOG.md +5 -1
- package/CHANGELOG.md +6 -0
- package/README.md +9 -7
- package/node_modules/@llblab/pi-actors/AGENTS.md +2 -0
- package/node_modules/@llblab/pi-actors/CHANGELOG.md +4 -1
- package/node_modules/@llblab/pi-actors/LICENSE +21 -0
- package/node_modules/@llblab/pi-actors/README.md +1 -1
- package/node_modules/@llblab/pi-actors/docs/coordinator-delivery.md +1 -1
- package/node_modules/@llblab/pi-actors/package.json +4 -3
- package/node_modules/@llblab/pi-claude-usage/AGENTS.md +6 -3
- package/node_modules/@llblab/pi-claude-usage/BACKLOG.md +2 -1
- package/node_modules/@llblab/pi-claude-usage/CHANGELOG.md +8 -0
- package/node_modules/@llblab/pi-claude-usage/README.md +48 -3
- package/node_modules/@llblab/pi-claude-usage/index.ts +8 -1159
- package/node_modules/@llblab/pi-claude-usage/lib/extension.ts +30 -0
- package/node_modules/@llblab/pi-claude-usage/lib/fast.ts +24 -0
- package/node_modules/@llblab/pi-claude-usage/lib/query.ts +146 -0
- package/node_modules/@llblab/pi-claude-usage/lib/status-format.ts +297 -0
- package/node_modules/@llblab/pi-claude-usage/lib/status.ts +366 -0
- package/node_modules/@llblab/pi-claude-usage/lib/telegram.ts +44 -0
- package/node_modules/@llblab/pi-claude-usage/lib/usage-store.ts +221 -0
- package/node_modules/@llblab/pi-claude-usage/lib/usage.ts +128 -0
- package/node_modules/@llblab/pi-claude-usage/package.json +9 -5
- package/node_modules/@llblab/pi-clean-room/AGENTS.md +1 -0
- package/node_modules/@llblab/pi-clean-room/CHANGELOG.md +5 -0
- package/node_modules/@llblab/pi-clean-room/LICENSE +21 -0
- package/node_modules/@llblab/pi-clean-room/README.md +1 -1
- package/node_modules/@llblab/pi-clean-room/package.json +3 -2
- package/node_modules/@llblab/pi-codex-usage/AGENTS.md +9 -6
- package/node_modules/@llblab/pi-codex-usage/BACKLOG.md +2 -1
- package/node_modules/@llblab/pi-codex-usage/CHANGELOG.md +17 -0
- package/node_modules/@llblab/pi-codex-usage/README.md +75 -17
- package/node_modules/@llblab/pi-codex-usage/index.ts +8 -1602
- package/node_modules/@llblab/pi-codex-usage/lib/extension.ts +25 -0
- package/node_modules/@llblab/pi-codex-usage/lib/fast.ts +23 -0
- package/node_modules/@llblab/pi-codex-usage/lib/query.ts +368 -0
- package/node_modules/@llblab/pi-codex-usage/lib/status-format.ts +347 -0
- package/node_modules/@llblab/pi-codex-usage/lib/status.ts +435 -0
- package/node_modules/@llblab/pi-codex-usage/lib/telegram.ts +45 -0
- package/node_modules/@llblab/pi-codex-usage/lib/usage-store.ts +229 -0
- package/node_modules/@llblab/pi-codex-usage/lib/usage.ts +425 -0
- package/node_modules/@llblab/pi-codex-usage/package.json +11 -6
- package/node_modules/@llblab/pi-command-fast/AGENTS.md +7 -0
- package/node_modules/@llblab/pi-command-fast/BACKLOG.md +9 -0
- package/node_modules/@llblab/pi-command-fast/CHANGELOG.md +7 -0
- package/node_modules/@llblab/pi-command-fast/LICENSE +21 -0
- package/node_modules/@llblab/pi-command-fast/README.md +42 -0
- package/node_modules/@llblab/pi-command-fast/dist/command.d.ts +8 -0
- package/node_modules/@llblab/pi-command-fast/dist/command.js +52 -0
- package/node_modules/@llblab/pi-command-fast/dist/index.d.ts +3 -0
- package/node_modules/@llblab/pi-command-fast/dist/index.js +3 -0
- package/node_modules/@llblab/pi-command-fast/dist/models-json.d.ts +10 -0
- package/node_modules/@llblab/pi-command-fast/dist/models-json.js +81 -0
- package/node_modules/@llblab/pi-command-fast/package.json +49 -0
- package/node_modules/@llblab/pi-grow-loop/AGENTS.md +1 -0
- package/node_modules/@llblab/pi-grow-loop/CHANGELOG.md +4 -1
- package/node_modules/@llblab/pi-grow-loop/LICENSE +21 -0
- package/node_modules/@llblab/pi-grow-loop/README.md +1 -1
- package/node_modules/@llblab/pi-grow-loop/package.json +3 -2
- package/node_modules/@llblab/pi-state-flow/AGENTS.md +6 -5
- package/node_modules/@llblab/pi-state-flow/BACKLOG.md +3 -2
- package/node_modules/@llblab/pi-state-flow/CHANGELOG.md +7 -1
- package/node_modules/@llblab/pi-state-flow/LICENSE +21 -0
- package/node_modules/@llblab/pi-state-flow/README.md +5 -5
- package/node_modules/@llblab/pi-state-flow/dist/lib/compaction.d.ts +1 -1
- package/node_modules/@llblab/pi-state-flow/dist/lib/compaction.js +1 -1
- package/node_modules/@llblab/pi-state-flow/dist/lib/extension.js +238 -46
- package/node_modules/@llblab/pi-state-flow/dist/lib/git.d.ts +2 -2
- package/node_modules/@llblab/pi-state-flow/dist/lib/git.js +16 -5
- package/node_modules/@llblab/pi-state-flow/dist/lib/session.d.ts +10 -1
- package/node_modules/@llblab/pi-state-flow/dist/lib/session.js +60 -1
- package/node_modules/@llblab/pi-state-flow/dist/lib/snapshot.d.ts +6 -0
- package/node_modules/@llblab/pi-state-flow/dist/lib/snapshot.js +8 -5
- package/node_modules/@llblab/pi-state-flow/dist/package.json +10 -9
- package/node_modules/@llblab/pi-state-flow/docs/architecture.md +11 -7
- package/node_modules/@llblab/pi-state-flow/docs/compatibility.md +2 -2
- package/node_modules/@llblab/pi-state-flow/docs/fork-contract.md +4 -2
- package/node_modules/@llblab/pi-state-flow/docs/usage.md +14 -13
- package/node_modules/@llblab/pi-state-flow/lib/compaction.ts +2 -2
- package/node_modules/@llblab/pi-state-flow/lib/extension.ts +221 -46
- package/node_modules/@llblab/pi-state-flow/lib/git.ts +14 -5
- package/node_modules/@llblab/pi-state-flow/lib/session.ts +52 -1
- package/node_modules/@llblab/pi-state-flow/lib/snapshot.ts +7 -5
- package/node_modules/@llblab/pi-state-flow/package.json +10 -9
- package/node_modules/jsonc-parser/CHANGELOG.md +76 -0
- package/node_modules/jsonc-parser/LICENSE.md +21 -0
- package/node_modules/jsonc-parser/README.md +364 -0
- package/node_modules/jsonc-parser/SECURITY.md +41 -0
- package/node_modules/jsonc-parser/lib/esm/impl/edit.js +185 -0
- package/node_modules/jsonc-parser/lib/esm/impl/format.js +261 -0
- package/node_modules/jsonc-parser/lib/esm/impl/parser.js +659 -0
- package/node_modules/jsonc-parser/lib/esm/impl/scanner.js +443 -0
- package/node_modules/jsonc-parser/lib/esm/impl/string-intern.js +29 -0
- package/node_modules/jsonc-parser/lib/esm/main.d.ts +351 -0
- package/node_modules/jsonc-parser/lib/esm/main.js +178 -0
- package/node_modules/jsonc-parser/lib/umd/impl/edit.js +201 -0
- package/node_modules/jsonc-parser/lib/umd/impl/format.js +275 -0
- package/node_modules/jsonc-parser/lib/umd/impl/parser.js +682 -0
- package/node_modules/jsonc-parser/lib/umd/impl/scanner.js +456 -0
- package/node_modules/jsonc-parser/lib/umd/impl/string-intern.js +42 -0
- package/node_modules/jsonc-parser/lib/umd/main.d.ts +351 -0
- package/node_modules/jsonc-parser/lib/umd/main.js +194 -0
- package/node_modules/jsonc-parser/package.json +37 -0
- package/package.json +7 -7
package/BACKLOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
# Backlog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The 0.26.0 composition is recorded in [CHANGELOG.md](./CHANGELOG.md). Package pins, resource order and bundled runtime ownership remain authoritative in `package.json`.
|
|
4
|
+
|
|
5
|
+
## Carried checks
|
|
6
|
+
|
|
7
|
+
- **Installed 0.26.0 smoke (operator-owned):** After separately authorized installation/reload, check the exact released kit's terminal controls and optional Telegram rendering with disposable State Flow storage. Packed SDK validation does not certify the operator's running clients. Do not reconnect Telegram, change Pi settings or use live memory/usage/Recipe stores as fixtures without separate authorization.
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@llblab/pi-kit` are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.26.0: Pi 1.0 Cohort and Memory-Inert State Flow
|
|
6
|
+
|
|
7
|
+
- `Usage and Fast`: Advances Codex Usage to `0.12.0` and Claude Usage to `0.2.0`, sharing one persistent `/fast` command. Codex uses provider-level priority preference; Claude permits the Opus family. Both preserve quota coordination and redraw the terminal status without a quota request; backend capability and billing still apply.
|
|
8
|
+
- `Pi 1.0 Cohort`: Advances Actors to `0.54.0`, Clean Room to `0.3.0` and Grow Loop to `0.9.0`, requiring Pi 1.0.0 or newer and including their MIT licenses. Exact pins, bundled packages, explicit resource order and runtime ownership remain intact; Telegram and portable Skills retain their existing pins.
|
|
9
|
+
- `Memory-Inert State Flow`: Advances the exact State Flow pin to published `0.24.0`, fixing Pi 1.0 token-estimation compatibility. Off performs no automatic memory work and cancels owned pending operations without erasing accepted data. Read-only inspections validate current private authority; superseded Active preserves Passive's selected history. MIT LICENSE is included in the member package.
|
|
10
|
+
|
|
5
11
|
## 0.25.0 - 2026-10-02
|
|
6
12
|
|
|
7
13
|
- `State Flow Modes`: Advances the exact State Flow pin from `0.21.0` to `0.23.0`. Adds sparse-state handling and session-owned modes; new sessions now default to Off while retained choices and explicit global policy survive. Telegram adds mode radios and scope explanations, with opt-in barrier diagnostics. No State Flow memory is erased by switching modes.
|
package/README.md
CHANGED
|
@@ -12,12 +12,12 @@ Package links lead to the owning repositories for usage, documentation, issues,
|
|
|
12
12
|
|
|
13
13
|
| Package | Version | Purpose |
|
|
14
14
|
| --- | ---: | --- |
|
|
15
|
-
| [`@llblab/pi-actors`](https://github.com/llblab/pi-actors) | `0.
|
|
16
|
-
| [`@llblab/pi-claude-usage`](https://github.com/llblab/pi-claude-usage) | `0.
|
|
17
|
-
| [`@llblab/pi-clean-room`](https://github.com/llblab/pi-clean-room) | `0.
|
|
18
|
-
| [`@llblab/pi-codex-usage`](https://github.com/llblab/pi-codex-usage) | `0.
|
|
19
|
-
| [`@llblab/pi-grow-loop`](https://github.com/llblab/pi-grow-loop) | `0.
|
|
20
|
-
| [`@llblab/pi-state-flow`](https://github.com/llblab/pi-state-flow) | `0.
|
|
15
|
+
| [`@llblab/pi-actors`](https://github.com/llblab/pi-actors) | `0.54.0` | Inspectable local Runs, reusable Recipes, persistent tools, and delegation Skills |
|
|
16
|
+
| [`@llblab/pi-claude-usage`](https://github.com/llblab/pi-claude-usage) | `0.2.0` | Claude subscription quota status and shared per-model Fast toggle for Opus |
|
|
17
|
+
| [`@llblab/pi-clean-room`](https://github.com/llblab/pi-clean-room) | `0.3.0` | Isolated nested Pi TUI with named npm extensions and compatible model selection |
|
|
18
|
+
| [`@llblab/pi-codex-usage`](https://github.com/llblab/pi-codex-usage) | `0.12.0` | Shared Codex quota/Business credit status and persistent priority Fast toggle |
|
|
19
|
+
| [`@llblab/pi-grow-loop`](https://github.com/llblab/pi-grow-loop) | `0.9.0` | Visible continuation scheduling and bounded worker Skills through compiled, manifest-owned resources |
|
|
20
|
+
| [`@llblab/pi-state-flow`](https://github.com/llblab/pi-state-flow) | `0.24.0` | Scoped context/memory compiler with memory-inert Off, safe Passive/Active reacquisition, and read-only Telegram inspections |
|
|
21
21
|
| [`@llblab/pi-telegram`](https://github.com/llblab/pi-telegram) | `0.51.5` | Telegram companion with follower Thread `/new`, restore diagnostics, filterable Skills, files, voice, and controls |
|
|
22
22
|
| [`@llblab/skills`](https://github.com/llblab/skills) | `1.15.0` | Portable workflows for engineering, review, design, context maintenance, and other focused tasks |
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@ Versions are exact by design. An upstream release does not change an installed k
|
|
|
25
25
|
|
|
26
26
|
## Install
|
|
27
27
|
|
|
28
|
-
Requires **Pi 0.
|
|
28
|
+
Requires **Pi 1.0.0+** and **Node.js 22.19.0+**. State Flow requires its canonical checkpoint/tail storage format and does not convert unsupported stores in place. Preserve existing stores and consult the [owning package's storage guidance](https://github.com/llblab/pi-state-flow/blob/v0.24.0/docs/usage.md#moving-a-store-and-the-017-format-boundary) before changing installations.
|
|
29
29
|
|
|
30
30
|
From npm:
|
|
31
31
|
|
|
@@ -45,6 +45,8 @@ Prefer the kit instead of separately loading the same packages. If you already u
|
|
|
45
45
|
|
|
46
46
|
## Development
|
|
47
47
|
|
|
48
|
+
The `0.26.0` composition includes published Actors `0.54.0` and State Flow `0.24.0` alongside the Pi 1.0 usage, Clean Room and Grow Loop cohort. The packed bundle loads all seven extensions on Pi 1.0.0 and exercises Fast, State Flow modes and token estimation in disposable storage with no credentials or external requests. This does not certify installed-client rendering; carried checks remain in [Backlog](./BACKLOG.md).
|
|
49
|
+
|
|
48
50
|
```bash
|
|
49
51
|
npm install
|
|
50
52
|
npm run validate
|
|
@@ -26,6 +26,8 @@ Public Run verbs remain `spawn`, `message`, and `inspect`.
|
|
|
26
26
|
|
|
27
27
|
## Core Structure
|
|
28
28
|
|
|
29
|
+
Require Pi ≥1.0.0 for all declared Pi peers. Keep source and packed lifecycle tests aligned with that baseline; do not restore an older host floor independently of those checks. Validation fixtures must use temporary agent directories, never write into the operator's live Recipe registry.
|
|
30
|
+
|
|
29
31
|
```text
|
|
30
32
|
Pi host
|
|
31
33
|
-> index.ts composition root
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
> Each release keeps at most 8 outcome records of at most 512 characters.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 0.54.0: Pi 1.0 Baseline and Package Licensing
|
|
6
|
+
|
|
7
|
+
- `Licensing`: Includes the MIT LICENSE in source checkouts and npm packages, preserving existing author attribution.
|
|
8
|
+
- `Pi Baseline`: Requires Pi 1.0.0 or newer for both coding-agent and TUI peers. Source and installed-package lifecycle checks use the same baseline; runtime ownership, Recipe/Run semantics and persistent registries are unchanged. Stored-tool normalization tests now use a temporary agent registry rather than writing fixtures into the operator's home.
|
|
6
9
|
|
|
7
10
|
## 0.53.2: Stable Inspector Trace Sequences
|
|
8
11
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 llblab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -19,7 +19,7 @@ This topology does not require every task to become a subagent. Short work with
|
|
|
19
19
|
|
|
20
20
|
## Install
|
|
21
21
|
|
|
22
|
-
Requires Node.js 22.19.0 or newer and Pi 0.
|
|
22
|
+
Requires Node.js 22.19.0 or newer and Pi 1.0.0 or newer.
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
pi install npm:@llblab/pi-actors
|
|
@@ -191,7 +191,7 @@ Implementation is complete only when source and packed-extension tests prove:
|
|
|
191
191
|
10. Explicit steer reaches the next safe Pi boundary once and root terminal still batches later.
|
|
192
192
|
11. Overflow, corruption, journal backpressure, archive/prune races, and stale contexts fail safely.
|
|
193
193
|
12. Completion flushing precedes automatic Recipe review.
|
|
194
|
-
13. Pi 0.
|
|
194
|
+
13. Pi 1.0.0 is the minimum source and packed lifecycle baseline; coding-agent and TUI peers share that floor.
|
|
195
195
|
|
|
196
196
|
Focused observability and delivery tests precede TypeScript/build/import checks. The acceptance checkpoint then runs full product validation, dependency audit, package dry-run, and ABCd context validation.
|
|
197
197
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llblab/pi-actors",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Local Actor Kernel for Pi",
|
|
6
6
|
"keywords": [
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"prepack": "npm run build"
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
41
|
+
"LICENSE",
|
|
41
42
|
"index.ts",
|
|
42
43
|
"dist",
|
|
43
44
|
"lib",
|
|
@@ -61,8 +62,8 @@
|
|
|
61
62
|
"image": "https://raw.githubusercontent.com/llblab/pi-actors/main/banner.jpg"
|
|
62
63
|
},
|
|
63
64
|
"peerDependencies": {
|
|
64
|
-
"@earendil-works/pi-coding-agent": ">=0.
|
|
65
|
-
"@earendil-works/pi-tui": ">=0.
|
|
65
|
+
"@earendil-works/pi-coding-agent": ">=1.0.0",
|
|
66
|
+
"@earendil-works/pi-tui": ">=1.0.0"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
69
|
"@types/node": "latest",
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# Agent Notes
|
|
2
2
|
|
|
3
|
-
- `
|
|
3
|
+
- `Registry dependency`: Use published `@llblab/pi-command-fast@^0.1.0` with aligned registry lock metadata. Local folder links are only for explicitly requested development tests; rebuild the library's `dist/` after source edits and restore registry dependency/locks before consumer publication.
|
|
4
|
+
- `Pi baseline`: Every declared `@earendil-works/*` peer requires ≥1.0.0. Keep Pi peer lock identities aligned and validate against that host generation.
|
|
5
|
+
- `Statusline-first scope`: Own usage state + usage mode; keep quota reporting zero-configuration and optional Fast on the existing terminal status.
|
|
4
6
|
- Trigger: Considering commands, menus, persisted settings, or notification output.
|
|
5
|
-
- Action: Prefer deleting the surface unless it is required for the optimistic TUI status widget
|
|
7
|
+
- Action: Prefer deleting the surface unless it is required for the optimistic TUI status widget, optional `pi-telegram` `/start` status-line mirror, or the argument-free shared `/fast`. Register only the `anthropic` provider handler through `@llblab/pi-command-fast` on session_start; release on session_shutdown. Never register the command directly or gate it on quota auth. Claude Fast eligibility is consumer-owned: permit the `claude-opus-` family without a version allowlist; warn `Fast mode is supported only for Opus` for other families without writes. Family eligibility is not proof of backend support; preserve server capability/billing errors. For rejected models, ignore stale unsupported overrides in status/request adaptation, and leave Codex eligibility unchanged. The library owns session WeakMap/reload arbitration and generic JSONC; `lib/fast.ts` owns Claude semantics; require Pi ≥1.0.0 for its assembled-beta payload contract, rather than copying upstream beta defaults. ON is `speed: "fast"` in the current model override; OFF deletes the property. Preserve existing request speed/betas, append the required Fast beta to the native assembled list rather than replacing a header, and keep Fast out of quota state/Telegram. Toggle redraws through the final terminal boundary without a quota request or success notification; unreadable config fails closed for Fast only.
|
|
8
|
+
- `Domain boundaries`: `index.ts` is export-only; `lib/extension.ts` composes lifecycle/Fast registration and request hooks. `lib/status.ts` owns refresh orchestration and terminal timers; `usage-store.ts` owns claims/fencing/mutex, `query.ts` owns OAuth/HTTP, `usage.ts` owns quota normalization, `status-format.ts` owns presentation, and `telegram.ts` owns optional registration. Preserve mature quota/auth/leadership behavior, keep imports acyclic with no domain importing the entrypoint, and keep domain-focused tests in `tests/`. Do not merge usage extensions or redesign polling to add Fast.
|
|
6
9
|
- `Optimistic refresh`: Preserve the last good statusline bar during refresh and transient failures.
|
|
7
10
|
- Trigger: Updating quota polling or error handling.
|
|
8
11
|
- Action: Do not collapse the bar while a request is in flight; only show `n/a` or `error` after repeated failures or no usable quota.
|
|
@@ -17,4 +20,4 @@
|
|
|
17
20
|
- Action: Do not add fallbacks, CLI probes, or API-key paths; API keys have no subscription quota, so report `n/a`. `utilization` is a used percent.
|
|
18
21
|
- `Rate-limit discipline`: Quota polling must be shared across instances; HTTP 429 triggers shared backoff.
|
|
19
22
|
- Trigger: Changing refresh cadence, retries, locking, or adding fetch paths.
|
|
20
|
-
- Action: Keep the single shared-state protocol in
|
|
23
|
+
- Action: Keep the single shared-state protocol in `lib/usage-store.ts`, orchestrated by `lib/status.ts` (leader refreshes every minute, takeover after 90 seconds by claiming leadership before fetching, a non-waiting OS-backed SQLite mutex around claiming and fenced publication, atomic writes, shared failure backoff). Always re-read the file for request authorization (`owner` + `claimId` + lease) and publication; do not use an in-memory ownership fallback. Lock failures and failed claim writes must deny requests. `mutex.sqlite` stores no quota or leadership data: never unlink/replace it while instances run or evict a paused holder; close or process death releases the mutex. Keep network calls outside critical sections. Instances otherwise only read the file; never add per-instance polling or probing requests.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
# Backlog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
- Operator-owned terminal/optional Telegram visual smoke is separate from the packed offline Pi SDK smoke; no operator session reload was performed.
|
|
4
|
+
- A live Fast speed comparison remains blocked: the authorized short Opus 5.5 sample received `429 credits_required` with `org_level_disabled`. Further live testing needs operator-managed Fast credits/permission and fresh authorization; offline capture proves request shape, not served speed.
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0: Shared Fast Mode and Pi 1.0 Baseline
|
|
4
|
+
|
|
5
|
+
- Split the monolithic extension into cohesive `lib/` domains matching Codex Usage: composition, status lifecycle, shared state, OAuth query, quota normalization, formatting, Telegram and Fast. `index.ts` now only re-exports the unchanged public API; tests follow domain owners. Quota/auth/leadership, mutex/fencing/backoff, status redraw and Fast behavior are preserved.
|
|
6
|
+
- Added an argument-free `/fast` provider handler through `@llblab/pi-command-fast@^0.1.0`, sharing exactly one command with Codex Usage across load orders, duplicate dependency copies, independent sessions and reloads. Claude eligibility is restricted to the Opus family without a version allowlist; other families receive `Fast mode is supported only for Opus` without writes or quota requests, and stale unsupported overrides do not decorate status or activate the request bridge. Generic command dispatch and Codex eligibility are unchanged.
|
|
7
|
+
- Persisted `speed: "fast"` solely in the current Anthropic model override; OFF deletes it. The shared JSONC helper preserves comments and unrelated configuration with atomic replacement.
|
|
8
|
+
- Requires Pi ≥1.0.0 across coding-agent, AI and agent-core peers: older Anthropic transports do not expose the same assembled beta payload contract. Adapted native payloads with Fast speed and additive `fast-mode-2026-02-01` beta, preserving explicit speed and Pi-generated/configured betas through actual HTTP assembly. No provider replacement or header-default suppression.
|
|
9
|
+
- Appended dim lowercase ` fast` at the final terminal status boundary, including loading/error/n/a paths, with immediate silent redraw and no quota request. OAuth quota polling, SQLite mutex, claim fencing, stale display, retry/backoff, and Telegram remain unchanged. Tests now live in `tests/`.
|
|
10
|
+
|
|
3
11
|
## 0.1.1: Trusted CI Publication
|
|
4
12
|
|
|
5
13
|
- Releases use the configured npm Trusted Publisher for GitHub Actions, with provenance and workflow-owned GitHub Release creation. Public-package verification now allows approximately 30 minutes for npm processing, with a 35-minute step limit, while retaining exact commit and package-inventory checks.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# pi-claude-usage
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Pi extension for Anthropic Claude subscription usage state and optional Fast mode
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
+
This extension owns **usage state + usage mode**: zero-configuration quota reporting and an optional per-model Fast preference. Shared command arbitration/JSONC editing belong to [`@llblab/pi-command-fast`](https://github.com/llblab/pi-command-fast), a normal library dependency, not another Pi extension.
|
|
8
|
+
|
|
7
9
|
This repository is an adaptation of [`pi-codex-usage`](https://github.com/llblab/pi-codex-usage) for Anthropic Claude Pro/Max subscriptions. It keeps the statusline design, but reads quota from the Anthropic OAuth usage endpoint using Pi's own Anthropic login.
|
|
8
10
|
|
|
9
11
|
## Start Here
|
|
@@ -23,10 +25,12 @@ This repository is an adaptation of [`pi-codex-usage`](https://github.com/llblab
|
|
|
23
25
|
- Missing OAuth auth, API-key-only auth, or missing quota windows are shown as `n/a`, not as an error
|
|
24
26
|
- Network/provider failures keep the last good bar, then show `error` after repeated failures
|
|
25
27
|
- Any number of Pi instances share one request stream, see [Shared Refresh](#shared-refresh)
|
|
26
|
-
- No commands or configuration are required
|
|
28
|
+
- No commands or configuration are required for quota display; the optional shared `/fast` toggles native request speed
|
|
27
29
|
|
|
28
30
|
## Install
|
|
29
31
|
|
|
32
|
+
Requires Pi ≥1.0.0 for the native beta-preserving Fast bridge. Older Pi (including 0.84.2) assembles Anthropic headers differently and is not supported by this release.
|
|
33
|
+
|
|
30
34
|
From npm:
|
|
31
35
|
|
|
32
36
|
```bash
|
|
@@ -39,6 +43,47 @@ From git:
|
|
|
39
43
|
pi install git:github.com/llblab/pi-claude-usage
|
|
40
44
|
```
|
|
41
45
|
|
|
46
|
+
## Development
|
|
47
|
+
|
|
48
|
+
The shared `@llblab/pi-command-fast@^0.1.0` dependency now resolves from npm; no sibling library checkout is required.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm ci
|
|
52
|
+
npm run validate
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
For explicitly local library experiments, a temporary folder link reads the library's built `dist/`, not TypeScript source directly. Rebuild after source edits and restore the registry dependency/lock before publishing; see [Backlog](./BACKLOG.md).
|
|
56
|
+
|
|
57
|
+
## Fast mode
|
|
58
|
+
|
|
59
|
+
`/fast` takes no arguments and dispatches by the current **provider**. This consumer permits Fast for the **Opus family** (`claude-opus-` model IDs), without pinning versions. Sonnet, Haiku, Fable, Mythos and other families receive `Fast mode is supported only for Opus` without config writes or quota requests. Family eligibility does not guarantee backend support: older or otherwise unsupported Opus versions can still receive an API rejection. For eligible models it persists only the following model override in Pi's canonical `models.json` (honoring `PI_CODING_AGENT_DIR`):
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"providers": {
|
|
64
|
+
"anthropic": {
|
|
65
|
+
"modelOverrides": {
|
|
66
|
+
"your-current-model": { "speed": "fast" }
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
OFF deletes only `speed`; there is no normal/default sentinel or separate Fast config. JSONC comments, unrelated fields and other providers/models survive. State follows the selected model and restart; manual edits are reread on lifecycle refresh and every request. Stale `speed: "fast"` overrides on unsupported models do not enable the suffix or this extension's request bridge; they are preserved, not silently deleted. Remove such a stale property manually if needed.
|
|
74
|
+
|
|
75
|
+
When Claude Usage and Codex Usage are loaded together, their shared library registers **one** `/fast` in either load order, across separate physical library copies. Its WeakMap is keyed by session manager; shutdown releases registrations because Pi reload reuses that identity. Unrelated providers receive a concise unsupported-provider message; invalid arguments show `Usage: /fast`. Successful toggles are silent and immediately redraw the existing terminal status without a quota request:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
claude ██████▀▀▀▀ 6d fast
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Exactly lowercase ` fast` uses the existing dim/countdown role at the final terminal presentation boundary, including loading, single-window percentages, `n/a` and errors. Telegram, quota OAuth, polling, mutex, fencing and backoff are unchanged.
|
|
82
|
+
|
|
83
|
+
Native request adaptation adds `speed: "fast"` without overwriting an explicit speed. It adds `fast-mode-2026-02-01` to Pi's already-assembled request `betas`, preserving automatic OAuth/thinking/streaming and configured betas; the Anthropic SDK converts that list to the final `anthropic-beta` HTTP header. Setting a replacement header earlier would suppress Pi's automatic betas, so no header replacement or custom provider/transport is used. See [Anthropic Fast mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode).
|
|
84
|
+
|
|
85
|
+
Pi 1.0.0 accepts the extra override but does not propagate `speed` to native request options, so the bridge is necessary. There is no public command unregister/conditional-visibility API: `/fast` stays listed and checks the provider and consumer model capability when invoked. A stored preference/suffix is intent, not evidence that the backend served Fast. Anthropic also requires Fast usage credits and organization-level permission; a supported model can still be rejected (for example, `429 credits_required` with `org_level_disabled`). The extension never enables billing or buys credits.
|
|
86
|
+
|
|
42
87
|
## Statusline
|
|
43
88
|
|
|
44
89
|
```text
|
|
@@ -75,7 +120,7 @@ claude error
|
|
|
75
120
|
|
|
76
121
|
## Shared Refresh
|
|
77
122
|
|
|
78
|
-
The
|
|
123
|
+
The extension ships an export-only [`index.ts`](./index.ts) and a flat domain DAG under `lib/`, matching Codex Usage's layout. [`extension.ts`](./lib/extension.ts) composes lifecycle/Fast wiring; [`status.ts`](./lib/status.ts) orchestrates refresh and redraw; [`usage-store.ts`](./lib/usage-store.ts) owns shared claims/fencing/mutex; [`query.ts`](./lib/query.ts) owns OAuth/HTTP; [`usage.ts`](./lib/usage.ts) normalizes quotas; [`status-format.ts`](./lib/status-format.ts) formats values; [`telegram.ts`](./lib/telegram.ts) owns optional registration; [`fast.ts`](./lib/fast.ts) adapts native Fast requests. Domains never import the entrypoint, and tests are organized by domain in `tests/`.
|
|
79
124
|
|
|
80
125
|
To avoid independent polling, instances coordinate through `~/.pi/agent/tmp/pi-claude-usage/usage.json` (percentages and timestamps only, no tokens):
|
|
81
126
|
|