pi-mono-all 1.0.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.
Files changed (161) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENCE.md +7 -0
  3. package/node_modules/pi-common/package.json +22 -0
  4. package/node_modules/pi-common/src/auth-config.ts +290 -0
  5. package/node_modules/pi-common/src/auth.ts +63 -0
  6. package/node_modules/pi-common/src/cache.ts +60 -0
  7. package/node_modules/pi-common/src/errors.ts +47 -0
  8. package/node_modules/pi-common/src/http-client.ts +118 -0
  9. package/node_modules/pi-common/src/index.ts +7 -0
  10. package/node_modules/pi-common/src/rate-limiter.ts +32 -0
  11. package/node_modules/pi-common/src/tool-result.ts +27 -0
  12. package/node_modules/pi-mono-ask-user-question/CHANGELOG.md +185 -0
  13. package/node_modules/pi-mono-ask-user-question/README.md +226 -0
  14. package/node_modules/pi-mono-ask-user-question/index.ts +923 -0
  15. package/node_modules/pi-mono-ask-user-question/package.json +29 -0
  16. package/node_modules/pi-mono-auto-fix/CHANGELOG.md +59 -0
  17. package/node_modules/pi-mono-auto-fix/README.md +77 -0
  18. package/node_modules/pi-mono-auto-fix/index.ts +488 -0
  19. package/node_modules/pi-mono-auto-fix/package.json +23 -0
  20. package/node_modules/pi-mono-btw/CHANGELOG.md +180 -0
  21. package/node_modules/pi-mono-btw/README.md +24 -0
  22. package/node_modules/pi-mono-btw/index.ts +499 -0
  23. package/node_modules/pi-mono-btw/package.json +29 -0
  24. package/node_modules/pi-mono-clear/CHANGELOG.md +180 -0
  25. package/node_modules/pi-mono-clear/README.md +40 -0
  26. package/node_modules/pi-mono-clear/index.ts +45 -0
  27. package/node_modules/pi-mono-clear/package.json +29 -0
  28. package/node_modules/pi-mono-context/CHANGELOG.md +12 -0
  29. package/node_modules/pi-mono-context/README.md +74 -0
  30. package/node_modules/pi-mono-context/index.ts +641 -0
  31. package/node_modules/pi-mono-context/package.json +29 -0
  32. package/node_modules/pi-mono-context-guard/CHANGELOG.md +195 -0
  33. package/node_modules/pi-mono-context-guard/README.md +81 -0
  34. package/node_modules/pi-mono-context-guard/index.ts +212 -0
  35. package/node_modules/pi-mono-context-guard/package.json +23 -0
  36. package/node_modules/pi-mono-figma/CHANGELOG.md +59 -0
  37. package/node_modules/pi-mono-figma/README.md +236 -0
  38. package/node_modules/pi-mono-figma/__tests__/code-connect.test.ts +32 -0
  39. package/node_modules/pi-mono-figma/__tests__/figma-assets.test.ts +38 -0
  40. package/node_modules/pi-mono-figma/__tests__/figma-component-hints.test.ts +23 -0
  41. package/node_modules/pi-mono-figma/__tests__/figma-implementation-layout.test.ts +47 -0
  42. package/node_modules/pi-mono-figma/__tests__/figma-search.test.ts +51 -0
  43. package/node_modules/pi-mono-figma/__tests__/figma-summarizer.test.ts +65 -0
  44. package/node_modules/pi-mono-figma/__tests__/fixtures/complex-auto-layout.json +115 -0
  45. package/node_modules/pi-mono-figma/__tests__/fixtures/component-instance.json +50 -0
  46. package/node_modules/pi-mono-figma/__tests__/fixtures/hidden-and-vectors.json +28 -0
  47. package/node_modules/pi-mono-figma/__tests__/fixtures/variables-and-styles.json +40 -0
  48. package/node_modules/pi-mono-figma/docs/live-selection-bridge.md +16 -0
  49. package/node_modules/pi-mono-figma/index.ts +6 -0
  50. package/node_modules/pi-mono-figma/package.json +33 -0
  51. package/node_modules/pi-mono-figma/skills/figma/SKILL.md +143 -0
  52. package/node_modules/pi-mono-figma/src/code-connect.ts +110 -0
  53. package/node_modules/pi-mono-figma/src/figma-assets.ts +146 -0
  54. package/node_modules/pi-mono-figma/src/figma-cache.ts +6 -0
  55. package/node_modules/pi-mono-figma/src/figma-client.ts +471 -0
  56. package/node_modules/pi-mono-figma/src/figma-component-hints.ts +87 -0
  57. package/node_modules/pi-mono-figma/src/figma-implementation.ts +264 -0
  58. package/node_modules/pi-mono-figma/src/figma-schemas.ts +139 -0
  59. package/node_modules/pi-mono-figma/src/figma-search.ts +195 -0
  60. package/node_modules/pi-mono-figma/src/figma-summarizer.ts +673 -0
  61. package/node_modules/pi-mono-figma/src/figma-tokens.ts +57 -0
  62. package/node_modules/pi-mono-figma/src/figma-tools.ts +352 -0
  63. package/node_modules/pi-mono-linear/CHANGELOG.md +44 -0
  64. package/node_modules/pi-mono-linear/README.md +159 -0
  65. package/node_modules/pi-mono-linear/index.ts +6 -0
  66. package/node_modules/pi-mono-linear/package.json +30 -0
  67. package/node_modules/pi-mono-linear/skills/linear/SKILL.md +107 -0
  68. package/node_modules/pi-mono-linear/src/linear-client.ts +339 -0
  69. package/node_modules/pi-mono-linear/src/linear-queries.ts +101 -0
  70. package/node_modules/pi-mono-linear/src/linear-schemas.ts +90 -0
  71. package/node_modules/pi-mono-linear/src/linear-tools.ts +362 -0
  72. package/node_modules/pi-mono-loop/CHANGELOG.md +163 -0
  73. package/node_modules/pi-mono-loop/README.md +54 -0
  74. package/node_modules/pi-mono-loop/index.ts +291 -0
  75. package/node_modules/pi-mono-loop/package.json +26 -0
  76. package/node_modules/pi-mono-multi-edit/CHANGELOG.md +232 -0
  77. package/node_modules/pi-mono-multi-edit/README.md +244 -0
  78. package/node_modules/pi-mono-multi-edit/__tests__/classic.test.ts +277 -0
  79. package/node_modules/pi-mono-multi-edit/__tests__/diff.test.ts +77 -0
  80. package/node_modules/pi-mono-multi-edit/__tests__/patch.test.ts +287 -0
  81. package/node_modules/pi-mono-multi-edit/benchmark-edits.ts +966 -0
  82. package/node_modules/pi-mono-multi-edit/classic.ts +435 -0
  83. package/node_modules/pi-mono-multi-edit/diff.ts +143 -0
  84. package/node_modules/pi-mono-multi-edit/index.ts +266 -0
  85. package/node_modules/pi-mono-multi-edit/package.json +37 -0
  86. package/node_modules/pi-mono-multi-edit/patch.ts +463 -0
  87. package/node_modules/pi-mono-multi-edit/types.ts +53 -0
  88. package/node_modules/pi-mono-multi-edit/workspace.ts +85 -0
  89. package/node_modules/pi-mono-review/CHANGELOG.md +190 -0
  90. package/node_modules/pi-mono-review/README.md +30 -0
  91. package/node_modules/pi-mono-review/common.ts +930 -0
  92. package/node_modules/pi-mono-review/index.ts +8 -0
  93. package/node_modules/pi-mono-review/package.json +29 -0
  94. package/node_modules/pi-mono-review/review-tui.ts +194 -0
  95. package/node_modules/pi-mono-review/review.ts +119 -0
  96. package/node_modules/pi-mono-review/reviewer.ts +339 -0
  97. package/node_modules/pi-mono-sentinel/CHANGELOG.md +158 -0
  98. package/node_modules/pi-mono-sentinel/README.md +87 -0
  99. package/node_modules/pi-mono-sentinel/__tests__/output-scanner.test.ts +109 -0
  100. package/node_modules/pi-mono-sentinel/__tests__/permissions.test.ts +202 -0
  101. package/node_modules/pi-mono-sentinel/__tests__/whitelist.test.ts +59 -0
  102. package/node_modules/pi-mono-sentinel/guards/execution-tracker.ts +281 -0
  103. package/node_modules/pi-mono-sentinel/guards/output-scanner.ts +232 -0
  104. package/node_modules/pi-mono-sentinel/guards/permission-gate.ts +170 -0
  105. package/node_modules/pi-mono-sentinel/index.ts +43 -0
  106. package/node_modules/pi-mono-sentinel/package.json +26 -0
  107. package/node_modules/pi-mono-sentinel/patterns/permissions.ts +175 -0
  108. package/node_modules/pi-mono-sentinel/patterns/read-targets.ts +104 -0
  109. package/node_modules/pi-mono-sentinel/patterns/secrets.ts +143 -0
  110. package/node_modules/pi-mono-sentinel/session.ts +95 -0
  111. package/node_modules/pi-mono-sentinel/specs/2026/04/sentinel/001-permission-gate.md +145 -0
  112. package/node_modules/pi-mono-sentinel/types.ts +39 -0
  113. package/node_modules/pi-mono-sentinel/whitelist.ts +86 -0
  114. package/node_modules/pi-mono-simplify/CHANGELOG.md +163 -0
  115. package/node_modules/pi-mono-simplify/README.md +56 -0
  116. package/node_modules/pi-mono-simplify/index.ts +78 -0
  117. package/node_modules/pi-mono-simplify/package.json +29 -0
  118. package/node_modules/pi-mono-status-line/CHANGELOG.md +180 -0
  119. package/node_modules/pi-mono-status-line/README.md +96 -0
  120. package/node_modules/pi-mono-status-line/basic.ts +89 -0
  121. package/node_modules/pi-mono-status-line/expert.ts +689 -0
  122. package/node_modules/pi-mono-status-line/index.ts +54 -0
  123. package/node_modules/pi-mono-status-line/package.json +29 -0
  124. package/node_modules/pi-mono-team-mode/CHANGELOG.md +278 -0
  125. package/node_modules/pi-mono-team-mode/README.md +246 -0
  126. package/node_modules/pi-mono-team-mode/__tests__/agent-manager-transient.test.ts +75 -0
  127. package/node_modules/pi-mono-team-mode/__tests__/delegation-manager.test.ts +118 -0
  128. package/node_modules/pi-mono-team-mode/__tests__/formatters.test.ts +104 -0
  129. package/node_modules/pi-mono-team-mode/__tests__/model-config.test.ts +272 -0
  130. package/node_modules/pi-mono-team-mode/__tests__/notification-box.test.ts +34 -0
  131. package/node_modules/pi-mono-team-mode/__tests__/parallel-utils.test.ts +32 -0
  132. package/node_modules/pi-mono-team-mode/__tests__/pi-stream-parser.test.ts +64 -0
  133. package/node_modules/pi-mono-team-mode/__tests__/prompts.test.ts +106 -0
  134. package/node_modules/pi-mono-team-mode/__tests__/store.test.ts +164 -0
  135. package/node_modules/pi-mono-team-mode/__tests__/tasks.test.ts +267 -0
  136. package/node_modules/pi-mono-team-mode/__tests__/teammate-specs.test.ts +114 -0
  137. package/node_modules/pi-mono-team-mode/__tests__/widget.test.ts +41 -0
  138. package/node_modules/pi-mono-team-mode/__tests__/worktree.test.ts +78 -0
  139. package/node_modules/pi-mono-team-mode/core/chain-utils.ts +90 -0
  140. package/node_modules/pi-mono-team-mode/core/fs-utils.ts +44 -0
  141. package/node_modules/pi-mono-team-mode/core/model-config.ts +432 -0
  142. package/node_modules/pi-mono-team-mode/core/parallel-utils.ts +48 -0
  143. package/node_modules/pi-mono-team-mode/core/prompts.ts +158 -0
  144. package/node_modules/pi-mono-team-mode/core/store.ts +156 -0
  145. package/node_modules/pi-mono-team-mode/core/tasks.ts +99 -0
  146. package/node_modules/pi-mono-team-mode/core/teammate-specs.ts +124 -0
  147. package/node_modules/pi-mono-team-mode/core/types.ts +160 -0
  148. package/node_modules/pi-mono-team-mode/index.ts +825 -0
  149. package/node_modules/pi-mono-team-mode/managers/agent-manager.ts +654 -0
  150. package/node_modules/pi-mono-team-mode/managers/delegation-manager.ts +211 -0
  151. package/node_modules/pi-mono-team-mode/managers/task-manager.ts +238 -0
  152. package/node_modules/pi-mono-team-mode/managers/team-manager.ts +59 -0
  153. package/node_modules/pi-mono-team-mode/package.json +33 -0
  154. package/node_modules/pi-mono-team-mode/runtime/pi-stream-parser.ts +194 -0
  155. package/node_modules/pi-mono-team-mode/runtime/subprocess.ts +183 -0
  156. package/node_modules/pi-mono-team-mode/runtime/transient-session.ts +196 -0
  157. package/node_modules/pi-mono-team-mode/runtime/worktree.ts +90 -0
  158. package/node_modules/pi-mono-team-mode/ui/formatters.ts +149 -0
  159. package/node_modules/pi-mono-team-mode/ui/notification-box.ts +55 -0
  160. package/node_modules/pi-mono-team-mode/ui/widget.ts +94 -0
  161. package/package.json +76 -0
@@ -0,0 +1,180 @@
1
+ # pi-mono-status-line
2
+
3
+ ## 1.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ ### Fixed: ask-user-question
8
+
9
+ - Remove unused `StringEnum` import from `@mariozechner/pi-ai`.
10
+
11
+
12
+ ## 1.7.1
13
+
14
+ ### Patch Changes
15
+
16
+ ### Fixed: team-mode
17
+
18
+ - Widget no longer mislabels blocked or approval-pending teams as "running smoothly" — blockers and pending approvals are now detected via team summaries.
19
+ - Preserve in-flight work on re-emitted `session_start` events instead of tearing the runtime down and SIGTERM-ing live teammates.
20
+ - Auto-relaunch leaders for `running` teams after a session reset; surface failures as both a team signal and a UI notification.
21
+ - `createTeam` now defaults `repoRoots` to `[process.cwd()]` when the caller passes an empty array.
22
+ - Archive `process.json` into `history/` before a new task reuses the same role slot, so the prior task's final state is no longer silently clobbered.
23
+
24
+ ### Enhanced: team-mode
25
+
26
+ - Durable intent queue for subprocess handoff: `team_spawn_teammate` calls made from a teammate subprocess are written to disk and executed by the main session's `LeaderRuntime` instead of spawning orphaned grand-children.
27
+ - New tool `team_task_create_batch` lets the leader emit the full initial task DAG in one call, removing per-task LLM round-trips during bootstrap.
28
+ - `team_create` / `launchLeader` accept an `awaitBootstrap` option so the user sees the task graph before the tool returns; leader launch retries up to 3 times on transient failures.
29
+ - Persist per-turn debug artifacts (prompt, invocation, stderr, raw event stream) for both leader and teammate subprocesses, exposed via `TeammateSummary.debugArtifacts`.
30
+ - Track `exitCode`, `exitSignal`, `terminationReason`, `stderrTail`, `toolExecutions`, `model` and `modelProvider` on every `TeammateProcess` record.
31
+ - Provider detection now consults pi's `settings.json` and `auth.json` in addition to env vars; default model IDs aligned with the provider/model scheme.
32
+ - `collectPiOutput` supports `AbortSignal` cancellation.
33
+
34
+ ### Tests
35
+
36
+ - New `intent-queue` and `model-config` suites; expanded coverage across `leader-runtime`, `team-manager`, `team-query-tool` and `formatters`.
37
+
38
+
39
+ ## 1.7.0
40
+
41
+ ### Minor Changes
42
+
43
+ ### Enhanced: status-line
44
+
45
+ - Improved progress rendering and colors in expert mode
46
+
47
+ ### Enhanced: team-mode
48
+
49
+ - **LLM-driven leader** — replaced the hardcoded `research → synthesis → implementation → verification` state machine with a pi subprocess coordinator that authors the task graph via tool calls
50
+ - **New tool `team_task_create`** so the leader can author tasks at runtime
51
+ - **New tool `team_handoff`** for explicit teammate → teammate context handoffs (replaces regex-scraping of `Handoffs:` output sections)
52
+ - **File-based teammate specs** — drop `.claude/teammates/<role>.md` frontmatter files (`name`, `description`, `needsWorktree`, `hasMemory`, `modelTier`) to extend or override the seven built-in roles
53
+ - **Event-driven leader wakes** — mailbox messages addressed to the leader (or broadcast) trigger a debounced (~200ms) cycle instead of waiting for the 20s polling tick
54
+ - **Templates accept any string** — `fullstack` / `research` / `refactor` remain as built-ins, but unknown template keys are accepted and no-op gracefully
55
+ - **Provider config per team** — per-team model overrides via `/team models`
56
+ - Reduced leader overhead and parent-session token churn
57
+ - `spawnTeammate` now always appends the full runtime-built context (signals, mailbox, dependencies, team memory) so teammates get the richer snapshot even when the caller's `context` argument is brief
58
+
59
+ ### Breaking changes: team-mode
60
+
61
+ - Removed `LeaderPhase` enum and `currentPhase` field from `TeamRecord` / `TeamSummary`
62
+ - Removed `parseExplicitHandoffs` export and the legacy `Handoffs:` output parser — peer handoffs must go through the `team_handoff` tool
63
+ - Removed the deterministic auto-spawn loop (`ensureBootstrapTasks`) — all task authoring and teammate spawning is now the LLM leader's responsibility
64
+ - Removed `StringEnum` gate on `team_create`'s `template` parameter (now plain string)
65
+
66
+ ### Fixed: review
67
+
68
+ - Annotate diff lines so the model picks correct line numbers
69
+ - Fix slice chunk around lines for comments in the reviewer TUI
70
+
71
+ ### Documentation
72
+
73
+ - Updated root README and sentinel extension README
74
+ - Documented the new file-based teammate spec format and event-driven leader wake in the team-mode README
75
+
76
+ ## 1.6.0
77
+
78
+ ### Minor Changes
79
+
80
+ ### New Extension: sentinel
81
+
82
+ Replaced the `grep` extension with a new security-focused `sentinel` extension for monitoring and guarding sensitive operations.
83
+
84
+ ### Enhanced: team-mode
85
+
86
+ - Added comprehensive test suite with integration tests
87
+ - New mock helpers for subprocess testing
88
+ - Improved signal manager with better error handling
89
+ - Leader runtime refactoring for stability
90
+ - Team query tool with dedicated tests
91
+
92
+ ### Enhanced: status-line
93
+
94
+ - Added basic and expert mode displays
95
+ - Improved index.ts with better state management
96
+
97
+ ### Enhanced: clear
98
+
99
+ - Updated keyboard shortcut to `Ctrl+Shift+L`
100
+ - Better busy-state handling for shortcuts
101
+ - Added warning/cancel handling and error notifications
102
+
103
+ ### Enhanced: context-guard
104
+
105
+ - Improved read deduplication across sessions
106
+ - Added `context-guard:file-modified` event for cache eviction
107
+
108
+ ### Documentation
109
+
110
+ - Added dedicated README for `clear` extension
111
+ - Added dedicated README for `context-guard` extension
112
+ - Updated main README with improved extension descriptions
113
+
114
+ ## 1.5.0
115
+
116
+ ### Minor Changes
117
+
118
+ - ### `multi-edit` — diverge from upstream fork
119
+
120
+ The extension was originally derived from [mitsuhiko/agent-stuff](https://github.com/mitsuhiko/agent-stuff)'s `pi-extensions/multi-edit.ts`. This release rewrites the largest unmodified subsystems so the implementation is structurally distinct from upstream while keeping the public contract intact.
121
+
122
+ - **Modularized layout** — the 953-line `index.ts` is split into purpose-scoped modules: `types.ts`, `workspace.ts`, `classic.ts`, `patch.ts`, `diff.ts`, and a slim `index.ts` (~180 lines of registration + dispatch wiring).
123
+ - **New patch engine** — `patch.ts` is now a recursive-descent parser over a `LineCursor` class with `indexOf`-based hunk anchoring. Hunks are stored as `{ oldBlock, newBlock }` raw strings (previously `{ oldLines[], newLines[] }` arrays), letting the applier splice content directly instead of reconstructing line arrays per apply.
124
+ - **Two-pass diff renderer** — `diff.ts` now walks `diffLines` parts into a typed `Entry[]` stream and makes all gutter / context-collapse decisions in a second pass, replacing the prior single-loop state-flag design.
125
+ - **Polished classic edits** — extracted `groupEditsByPath`, `sortGroupByPosition`, `applyGroupToContent`, and `rollbackSnapshots` helpers; formalized the quote-fallback as an ordered `MATCH_PASSES` array so new normalizers (dashes, NBSP, etc.) can be added by appending one entry.
126
+ - **First contract test suite** — 34 tests under `__tests__/` cover classic edits (positional reordering, redundant-pair skip, quote fallback, atomic rollback, read-only preflight), patch operations (Add/Delete/Update round-trips, move-rejection, multi-op batches), and diff rendering (line-number gutter, context collapse, add/remove-only cases). Runs via `npm test` (`tsx --test`).
127
+ - **Dropped Codex apply_patch edge cases** (documented in `README.md` → "Codex apply_patch compatibility"): `*** End of File` sentinel hunks, 4-pass fuzzy `seekSequence` matching, implicit first hunk without `@@`, whitespace-tolerant anchoring. Common paths (Add/Delete/Update-single-chunk, Update with multiple hunks, Add+Update+Delete batches) are fully tested and preserved.
128
+ - **README attribution** — new "Origins" section crediting `mitsuhiko/agent-stuff` as the original source.
129
+
130
+ ## 1.4.0
131
+
132
+ ### Minor Changes
133
+
134
+ - Add teammate progress heartbeats and widget refresh improvements to team mode.
135
+
136
+ ## 1.3.0
137
+
138
+ ## 1.2.0
139
+
140
+ ### Minor Changes
141
+
142
+ - ### `multi-edit` — robustness improvements
143
+
144
+ - **No-op write guard**: skip file write and `context-guard:file-modified` event when new content is identical to what was last read — prevents unnecessary watcher churn
145
+ - **Early write-access check**: virtual workspace `checkWriteAccess` now validates real-filesystem permissions during the preflight pass so read-only files fail fast before any real file is touched
146
+ - **Curly-quote normalization**: new `findActualString` helper falls back to normalized quote matching (`"` / `'` ↔ `"` / `'`) when exact `oldText` search fails — the most common class of preflight mismatch
147
+ - **Atomic batch rollback**: `applyClassicEdits` gains a `rollbackOnError` option that restores all successfully written files when a later edit in the same batch fails
148
+
149
+ ### `ask-user-question` — UX fixes
150
+
151
+ - **Reliable text capture on submit**: answer is read directly from the editor before it clears itself, fixing a race where the stored value was always empty
152
+ - **Unified advance logic**: `advanceTab()` and `saveOtherModeText()` helpers replace scattered single-question fast-paths — behaviour is now consistent regardless of form length
153
+ - **Auto-advance on Enter / Tab**: pressing Enter or Tab in any question (text, radio with "Other", checkbox with "Other") advances to the next tab without requiring a separate click
154
+
155
+ ### `team-mode` — stability fixes
156
+
157
+ - **Infinite retry loop eliminated**: subprocess guard (`PI_TEAM_SUBPROCESS=1`) prevents spawned pi subprocesses from launching a ghost `LeaderRuntime` that immediately marks in-progress tasks as stalled
158
+ - **Stall detection grace period**: tasks updated within the last 2 × `LEADER_POLL_MS` (10 s) are skipped by `detectStalledTasks` — eliminates false positives on the spawning cycle
159
+ - **Circuit breaker**: tasks that stall more than `MAX_TASK_RETRIES` (3) times are permanently cancelled with a clear error signal instead of being silently re-queued
160
+ - **Concurrent cycle guard**: `runLeaderCycle` returns early if a cycle is already in-flight for the same team, preventing overlapping read-modify-write from the poll interval and completion handlers
161
+ - **Widget cleanup**: cancelled and completed teams are no longer shown in the team widget — only `initializing | running | paused | failed` states are displayed
162
+ - **Shorter auto-generated names**: `objectiveToName` now splits on non-alphanumeric characters (handles path separators), filters stopwords and extreme-length tokens, and hard-caps at 32 characters
163
+
164
+ ## 1.1.1
165
+
166
+ ### Patch Changes
167
+
168
+ - chore: update all packages for consistency and include team-mode fixes
169
+
170
+ ## 1.1.0
171
+
172
+ ## 1.0.0
173
+
174
+ ### Major Changes
175
+
176
+ - 199c367: First version of the extensions to upload to GitHub
177
+
178
+ ### Patch Changes
179
+
180
+ - Bump all packages to 0.1.1
@@ -0,0 +1,96 @@
1
+ # status-line extension
2
+
3
+ Configurable footer with two modes: **basic** (default) and **expert**.
4
+
5
+ ## Modes
6
+
7
+ ### Basic (default)
8
+
9
+ Original two-line layout with token stats.
10
+
11
+ ```
12
+ ~/my-project (main)
13
+ ↑582k ↓44k R7.0M W470k $6.918 24.0%/1.0M claude-opus-4-6 • high
14
+ ```
15
+
16
+ ### Expert
17
+
18
+ Rich footer with visual context gauge, enhanced git status, and subscription usage indicators.
19
+
20
+ Layout:
21
+
22
+ ```
23
+ gpt-5.4 (high) - ◔ 14% (38k/272k $0.33)
24
+ 🗀 ~/my-project ⎇ main * ↑2
25
+ Codex > 5h ◑ 46% 2h38m > Week ○ 12%
26
+ ```
27
+
28
+ Features:
29
+
30
+ - **Git status** — branch name, dirty indicator (`*`), ahead/behind arrows (`↑2 ↓1`)
31
+ - **Context gauge** — pie icon (`○ ◔ ◑ ◕ ●`) with color thresholds (green → yellow → red)
32
+ - **Session cost** — running `$` total next to the gauge
33
+ - **Subscription usage** — rate-limit progress icons for Claude Max, Codex, Copilot, and Gemini (auto-detected from the active provider, refreshed every 5 min)
34
+ - **Status-first layout** — model, current status, and context appear on the first line; cwd/git move to their own line for visibility
35
+
36
+ ## Configuration
37
+
38
+ Mode is resolved in this order (first hit wins):
39
+
40
+ 1. `PI_STATUS_LINE_MODE` environment variable
41
+ 2. `~/.pi/agent/status-line.json` → `{ "mode": "basic" | "expert" }`
42
+ 3. default: `basic`
43
+
44
+ ### Use cases
45
+
46
+ #### 1. Persistent mode across all sessions (config file)
47
+
48
+ Best for: setting your preferred mode once and forgetting about it.
49
+
50
+ ```bash
51
+ echo '{ "mode": "expert" }' > ~/.pi/agent/status-line.json
52
+ ```
53
+
54
+ Lives alongside pi's other config files (`auth.json`, `keybindings.json`, `models.json`). Survives shell restarts, applies to every terminal, and is independent of your shell profile.
55
+
56
+ #### 2. One-off override for a single session (env var inline)
57
+
58
+ Best for: trying out expert mode without committing, or temporarily switching back to basic while debugging.
59
+
60
+ ```bash
61
+ PI_STATUS_LINE_MODE=expert pi
62
+ ```
63
+
64
+ Only affects the pi invocation on that line. Your config file default stays untouched.
65
+
66
+ #### 3. Shell-scoped default (env var in shell profile)
67
+
68
+ Best for: per-machine or per-shell preferences, or sharing dotfiles across machines where you don't want to manage `~/.pi/agent/` on each.
69
+
70
+ ```bash
71
+ # ~/.zshrc or ~/.bashrc
72
+ export PI_STATUS_LINE_MODE=expert
73
+ ```
74
+
75
+ Takes precedence over the config file, so it's useful on a shared machine where you want your shell to override whatever is in `~/.pi/agent/`.
76
+
77
+ #### 4. Revert to basic mode
78
+
79
+ Either delete the config file, unset the env var, or explicitly set basic:
80
+
81
+ ```bash
82
+ # remove persistent config
83
+ rm ~/.pi/agent/status-line.json
84
+
85
+ # or explicitly write basic
86
+ echo '{ "mode": "basic" }' > ~/.pi/agent/status-line.json
87
+
88
+ # or one-off
89
+ PI_STATUS_LINE_MODE=basic pi
90
+ ```
91
+
92
+ ## Files
93
+
94
+ - `index.ts` — entry point (mode selector)
95
+ - `basic.ts` — basic mode implementation
96
+ - `expert.ts` — expert mode implementation
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Status Line — adds git branch next to the cwd in pi's footer.
3
+ *
4
+ * Keeps the same two-line layout as the default footer:
5
+ * Line 1: cwd (branch)
6
+ * Line 2: ↑input ↓output Rcache Wcache $cost (sub?) ctx%/limit model • thinking
7
+ */
8
+
9
+ import type { AssistantMessage } from "@mariozechner/pi-ai";
10
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
11
+ import { truncateToWidth, visibleWidth } from "@mariozechner/pi-tui";
12
+
13
+ function fmt(n: number): string {
14
+ if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M`;
15
+ if (n >= 1_000) return `${(n / 1_000).toFixed(1)}k`;
16
+ return `${n}`;
17
+ }
18
+
19
+ export default function (pi: ExtensionAPI) {
20
+ pi.on("session_start", (_event, ctx) => {
21
+ if (!ctx.hasUI) return;
22
+
23
+ ctx.ui.setFooter((tui, theme, footerData) => {
24
+ const unsub = footerData.onBranchChange(() => tui.requestRender());
25
+
26
+ return {
27
+ dispose: unsub,
28
+ invalidate() {},
29
+ render(width: number): string[] {
30
+ // --- Line 1: cwd + branch ---
31
+ const cwd = ctx.cwd.replace(/^\/Users\/[^/]+/, "~");
32
+ const branch = footerData.getGitBranch();
33
+ const branchStr = branch ? " " + theme.fg("accent", `(${branch})`) : "";
34
+ const line1 = truncateToWidth(theme.fg("dim", cwd) + branchStr, width);
35
+
36
+ // --- Line 2: stats + model ---
37
+ let input = 0;
38
+ let output = 0;
39
+ let cacheRead = 0;
40
+ let cacheWrite = 0;
41
+ let cost = 0;
42
+
43
+ for (const e of ctx.sessionManager.getBranch()) {
44
+ if (e.type === "message" && e.message.role === "assistant") {
45
+ const m = e.message as AssistantMessage;
46
+ input += m.usage.input;
47
+ output += m.usage.output;
48
+ cacheRead += m.usage.cacheRead;
49
+ cacheWrite += m.usage.cacheWrite;
50
+ cost += m.usage.cost.total;
51
+ }
52
+ }
53
+
54
+ const usage = ctx.getContextUsage();
55
+ let contextStr: string;
56
+ if (usage && usage.contextWindow > 0 && usage.percent !== null) {
57
+ contextStr = `${usage.percent.toFixed(1)}%/${fmt(usage.contextWindow)}`;
58
+ } else {
59
+ contextStr = "—";
60
+ }
61
+
62
+ const modelId = ctx.model?.id ?? "no-model";
63
+ const thinkingLevel = pi.getThinkingLevel();
64
+ const thinkingStr = thinkingLevel !== "off" ? ` • ${thinkingLevel}` : "";
65
+
66
+ // Extension statuses
67
+ const statuses = footerData.getExtensionStatuses();
68
+ const statusParts: string[] = [];
69
+ for (const [, text] of statuses) {
70
+ if (text) statusParts.push(text);
71
+ }
72
+ const statusStr = statusParts.length > 0 ? " " + statusParts.join(" ") : "";
73
+
74
+ const left = theme.fg(
75
+ "dim",
76
+ `↑${fmt(input)} ↓${fmt(output)} R${fmt(cacheRead)} W${fmt(cacheWrite)} $${cost.toFixed(3)} ${contextStr}`,
77
+ );
78
+
79
+ const right = theme.fg("text", modelId) + theme.fg("dim", thinkingStr) + statusStr;
80
+
81
+ const gap = Math.max(1, width - visibleWidth(left) - visibleWidth(right));
82
+ const line2 = truncateToWidth(left + " ".repeat(gap) + right, width);
83
+
84
+ return [line1, line2];
85
+ },
86
+ };
87
+ });
88
+ });
89
+ }