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.
- package/CHANGELOG.md +13 -0
- package/LICENCE.md +7 -0
- package/node_modules/pi-common/package.json +22 -0
- package/node_modules/pi-common/src/auth-config.ts +290 -0
- package/node_modules/pi-common/src/auth.ts +63 -0
- package/node_modules/pi-common/src/cache.ts +60 -0
- package/node_modules/pi-common/src/errors.ts +47 -0
- package/node_modules/pi-common/src/http-client.ts +118 -0
- package/node_modules/pi-common/src/index.ts +7 -0
- package/node_modules/pi-common/src/rate-limiter.ts +32 -0
- package/node_modules/pi-common/src/tool-result.ts +27 -0
- package/node_modules/pi-mono-ask-user-question/CHANGELOG.md +185 -0
- package/node_modules/pi-mono-ask-user-question/README.md +226 -0
- package/node_modules/pi-mono-ask-user-question/index.ts +923 -0
- package/node_modules/pi-mono-ask-user-question/package.json +29 -0
- package/node_modules/pi-mono-auto-fix/CHANGELOG.md +59 -0
- package/node_modules/pi-mono-auto-fix/README.md +77 -0
- package/node_modules/pi-mono-auto-fix/index.ts +488 -0
- package/node_modules/pi-mono-auto-fix/package.json +23 -0
- package/node_modules/pi-mono-btw/CHANGELOG.md +180 -0
- package/node_modules/pi-mono-btw/README.md +24 -0
- package/node_modules/pi-mono-btw/index.ts +499 -0
- package/node_modules/pi-mono-btw/package.json +29 -0
- package/node_modules/pi-mono-clear/CHANGELOG.md +180 -0
- package/node_modules/pi-mono-clear/README.md +40 -0
- package/node_modules/pi-mono-clear/index.ts +45 -0
- package/node_modules/pi-mono-clear/package.json +29 -0
- package/node_modules/pi-mono-context/CHANGELOG.md +12 -0
- package/node_modules/pi-mono-context/README.md +74 -0
- package/node_modules/pi-mono-context/index.ts +641 -0
- package/node_modules/pi-mono-context/package.json +29 -0
- package/node_modules/pi-mono-context-guard/CHANGELOG.md +195 -0
- package/node_modules/pi-mono-context-guard/README.md +81 -0
- package/node_modules/pi-mono-context-guard/index.ts +212 -0
- package/node_modules/pi-mono-context-guard/package.json +23 -0
- package/node_modules/pi-mono-figma/CHANGELOG.md +59 -0
- package/node_modules/pi-mono-figma/README.md +236 -0
- package/node_modules/pi-mono-figma/__tests__/code-connect.test.ts +32 -0
- package/node_modules/pi-mono-figma/__tests__/figma-assets.test.ts +38 -0
- package/node_modules/pi-mono-figma/__tests__/figma-component-hints.test.ts +23 -0
- package/node_modules/pi-mono-figma/__tests__/figma-implementation-layout.test.ts +47 -0
- package/node_modules/pi-mono-figma/__tests__/figma-search.test.ts +51 -0
- package/node_modules/pi-mono-figma/__tests__/figma-summarizer.test.ts +65 -0
- package/node_modules/pi-mono-figma/__tests__/fixtures/complex-auto-layout.json +115 -0
- package/node_modules/pi-mono-figma/__tests__/fixtures/component-instance.json +50 -0
- package/node_modules/pi-mono-figma/__tests__/fixtures/hidden-and-vectors.json +28 -0
- package/node_modules/pi-mono-figma/__tests__/fixtures/variables-and-styles.json +40 -0
- package/node_modules/pi-mono-figma/docs/live-selection-bridge.md +16 -0
- package/node_modules/pi-mono-figma/index.ts +6 -0
- package/node_modules/pi-mono-figma/package.json +33 -0
- package/node_modules/pi-mono-figma/skills/figma/SKILL.md +143 -0
- package/node_modules/pi-mono-figma/src/code-connect.ts +110 -0
- package/node_modules/pi-mono-figma/src/figma-assets.ts +146 -0
- package/node_modules/pi-mono-figma/src/figma-cache.ts +6 -0
- package/node_modules/pi-mono-figma/src/figma-client.ts +471 -0
- package/node_modules/pi-mono-figma/src/figma-component-hints.ts +87 -0
- package/node_modules/pi-mono-figma/src/figma-implementation.ts +264 -0
- package/node_modules/pi-mono-figma/src/figma-schemas.ts +139 -0
- package/node_modules/pi-mono-figma/src/figma-search.ts +195 -0
- package/node_modules/pi-mono-figma/src/figma-summarizer.ts +673 -0
- package/node_modules/pi-mono-figma/src/figma-tokens.ts +57 -0
- package/node_modules/pi-mono-figma/src/figma-tools.ts +352 -0
- package/node_modules/pi-mono-linear/CHANGELOG.md +44 -0
- package/node_modules/pi-mono-linear/README.md +159 -0
- package/node_modules/pi-mono-linear/index.ts +6 -0
- package/node_modules/pi-mono-linear/package.json +30 -0
- package/node_modules/pi-mono-linear/skills/linear/SKILL.md +107 -0
- package/node_modules/pi-mono-linear/src/linear-client.ts +339 -0
- package/node_modules/pi-mono-linear/src/linear-queries.ts +101 -0
- package/node_modules/pi-mono-linear/src/linear-schemas.ts +90 -0
- package/node_modules/pi-mono-linear/src/linear-tools.ts +362 -0
- package/node_modules/pi-mono-loop/CHANGELOG.md +163 -0
- package/node_modules/pi-mono-loop/README.md +54 -0
- package/node_modules/pi-mono-loop/index.ts +291 -0
- package/node_modules/pi-mono-loop/package.json +26 -0
- package/node_modules/pi-mono-multi-edit/CHANGELOG.md +232 -0
- package/node_modules/pi-mono-multi-edit/README.md +244 -0
- package/node_modules/pi-mono-multi-edit/__tests__/classic.test.ts +277 -0
- package/node_modules/pi-mono-multi-edit/__tests__/diff.test.ts +77 -0
- package/node_modules/pi-mono-multi-edit/__tests__/patch.test.ts +287 -0
- package/node_modules/pi-mono-multi-edit/benchmark-edits.ts +966 -0
- package/node_modules/pi-mono-multi-edit/classic.ts +435 -0
- package/node_modules/pi-mono-multi-edit/diff.ts +143 -0
- package/node_modules/pi-mono-multi-edit/index.ts +266 -0
- package/node_modules/pi-mono-multi-edit/package.json +37 -0
- package/node_modules/pi-mono-multi-edit/patch.ts +463 -0
- package/node_modules/pi-mono-multi-edit/types.ts +53 -0
- package/node_modules/pi-mono-multi-edit/workspace.ts +85 -0
- package/node_modules/pi-mono-review/CHANGELOG.md +190 -0
- package/node_modules/pi-mono-review/README.md +30 -0
- package/node_modules/pi-mono-review/common.ts +930 -0
- package/node_modules/pi-mono-review/index.ts +8 -0
- package/node_modules/pi-mono-review/package.json +29 -0
- package/node_modules/pi-mono-review/review-tui.ts +194 -0
- package/node_modules/pi-mono-review/review.ts +119 -0
- package/node_modules/pi-mono-review/reviewer.ts +339 -0
- package/node_modules/pi-mono-sentinel/CHANGELOG.md +158 -0
- package/node_modules/pi-mono-sentinel/README.md +87 -0
- package/node_modules/pi-mono-sentinel/__tests__/output-scanner.test.ts +109 -0
- package/node_modules/pi-mono-sentinel/__tests__/permissions.test.ts +202 -0
- package/node_modules/pi-mono-sentinel/__tests__/whitelist.test.ts +59 -0
- package/node_modules/pi-mono-sentinel/guards/execution-tracker.ts +281 -0
- package/node_modules/pi-mono-sentinel/guards/output-scanner.ts +232 -0
- package/node_modules/pi-mono-sentinel/guards/permission-gate.ts +170 -0
- package/node_modules/pi-mono-sentinel/index.ts +43 -0
- package/node_modules/pi-mono-sentinel/package.json +26 -0
- package/node_modules/pi-mono-sentinel/patterns/permissions.ts +175 -0
- package/node_modules/pi-mono-sentinel/patterns/read-targets.ts +104 -0
- package/node_modules/pi-mono-sentinel/patterns/secrets.ts +143 -0
- package/node_modules/pi-mono-sentinel/session.ts +95 -0
- package/node_modules/pi-mono-sentinel/specs/2026/04/sentinel/001-permission-gate.md +145 -0
- package/node_modules/pi-mono-sentinel/types.ts +39 -0
- package/node_modules/pi-mono-sentinel/whitelist.ts +86 -0
- package/node_modules/pi-mono-simplify/CHANGELOG.md +163 -0
- package/node_modules/pi-mono-simplify/README.md +56 -0
- package/node_modules/pi-mono-simplify/index.ts +78 -0
- package/node_modules/pi-mono-simplify/package.json +29 -0
- package/node_modules/pi-mono-status-line/CHANGELOG.md +180 -0
- package/node_modules/pi-mono-status-line/README.md +96 -0
- package/node_modules/pi-mono-status-line/basic.ts +89 -0
- package/node_modules/pi-mono-status-line/expert.ts +689 -0
- package/node_modules/pi-mono-status-line/index.ts +54 -0
- package/node_modules/pi-mono-status-line/package.json +29 -0
- package/node_modules/pi-mono-team-mode/CHANGELOG.md +278 -0
- package/node_modules/pi-mono-team-mode/README.md +246 -0
- package/node_modules/pi-mono-team-mode/__tests__/agent-manager-transient.test.ts +75 -0
- package/node_modules/pi-mono-team-mode/__tests__/delegation-manager.test.ts +118 -0
- package/node_modules/pi-mono-team-mode/__tests__/formatters.test.ts +104 -0
- package/node_modules/pi-mono-team-mode/__tests__/model-config.test.ts +272 -0
- package/node_modules/pi-mono-team-mode/__tests__/notification-box.test.ts +34 -0
- package/node_modules/pi-mono-team-mode/__tests__/parallel-utils.test.ts +32 -0
- package/node_modules/pi-mono-team-mode/__tests__/pi-stream-parser.test.ts +64 -0
- package/node_modules/pi-mono-team-mode/__tests__/prompts.test.ts +106 -0
- package/node_modules/pi-mono-team-mode/__tests__/store.test.ts +164 -0
- package/node_modules/pi-mono-team-mode/__tests__/tasks.test.ts +267 -0
- package/node_modules/pi-mono-team-mode/__tests__/teammate-specs.test.ts +114 -0
- package/node_modules/pi-mono-team-mode/__tests__/widget.test.ts +41 -0
- package/node_modules/pi-mono-team-mode/__tests__/worktree.test.ts +78 -0
- package/node_modules/pi-mono-team-mode/core/chain-utils.ts +90 -0
- package/node_modules/pi-mono-team-mode/core/fs-utils.ts +44 -0
- package/node_modules/pi-mono-team-mode/core/model-config.ts +432 -0
- package/node_modules/pi-mono-team-mode/core/parallel-utils.ts +48 -0
- package/node_modules/pi-mono-team-mode/core/prompts.ts +158 -0
- package/node_modules/pi-mono-team-mode/core/store.ts +156 -0
- package/node_modules/pi-mono-team-mode/core/tasks.ts +99 -0
- package/node_modules/pi-mono-team-mode/core/teammate-specs.ts +124 -0
- package/node_modules/pi-mono-team-mode/core/types.ts +160 -0
- package/node_modules/pi-mono-team-mode/index.ts +825 -0
- package/node_modules/pi-mono-team-mode/managers/agent-manager.ts +654 -0
- package/node_modules/pi-mono-team-mode/managers/delegation-manager.ts +211 -0
- package/node_modules/pi-mono-team-mode/managers/task-manager.ts +238 -0
- package/node_modules/pi-mono-team-mode/managers/team-manager.ts +59 -0
- package/node_modules/pi-mono-team-mode/package.json +33 -0
- package/node_modules/pi-mono-team-mode/runtime/pi-stream-parser.ts +194 -0
- package/node_modules/pi-mono-team-mode/runtime/subprocess.ts +183 -0
- package/node_modules/pi-mono-team-mode/runtime/transient-session.ts +196 -0
- package/node_modules/pi-mono-team-mode/runtime/worktree.ts +90 -0
- package/node_modules/pi-mono-team-mode/ui/formatters.ts +149 -0
- package/node_modules/pi-mono-team-mode/ui/notification-box.ts +55 -0
- package/node_modules/pi-mono-team-mode/ui/widget.ts +94 -0
- package/package.json +76 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# pi-mono-context-guard
|
|
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
|
+
### Minor Changes
|
|
173
|
+
|
|
174
|
+
- Add context-guard and grep extensions; improve multi-edit with dedup
|
|
175
|
+
|
|
176
|
+
**New: `pi-mono-context-guard`**
|
|
177
|
+
Extension that keeps the LLM context window lean with three guards:
|
|
178
|
+
|
|
179
|
+
- `read` without `limit` → auto-injects `limit=120`
|
|
180
|
+
- Read dedup → mtime-based stub for unchanged files (~20 tokens vs full content re-send)
|
|
181
|
+
- `bash` with unbounded `rg` → appends `| head -60`
|
|
182
|
+
|
|
183
|
+
Listens to `context-guard:file-modified` events to invalidate the dedup cache after edits.
|
|
184
|
+
`/context-guard` command to inspect and toggle guards at runtime.
|
|
185
|
+
|
|
186
|
+
**New: `pi-mono-grep`**
|
|
187
|
+
Dedicated ripgrep wrapper tool. Replaces raw `rg` in bash with a structured tool that has
|
|
188
|
+
`head_limit=60` built into the schema, `output_mode` (files_with_matches / content / count),
|
|
189
|
+
pagination via `offset`, and automatic VCS directory exclusions.
|
|
190
|
+
Prompt guidelines instruct the model to always use `grep` instead of bash+rg.
|
|
191
|
+
|
|
192
|
+
**Updated: `pi-mono-multi-edit`**
|
|
193
|
+
|
|
194
|
+
- Per-call read cache in `createRealWorkspace` deduplicates disk reads within a single `execute()` invocation (preflight + real-apply)
|
|
195
|
+
- Emits `context-guard:file-modified` event after every real `writeText` and `deleteFile` so context-guard can evict stale dedup cache entries
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# context-guard extension
|
|
2
|
+
|
|
3
|
+
Keeps pi sessions lean by preventing common context-window waste during tool use.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
This extension intercepts tool calls and applies three safeguards:
|
|
8
|
+
|
|
9
|
+
1. **Auto-limit `read` calls**
|
|
10
|
+
If the model calls `read` without a `limit`, `context-guard` injects a default limit of `120` lines and shows a notification. The model can continue with `offset` to paginate.
|
|
11
|
+
|
|
12
|
+
2. **Deduplicate unchanged `read` calls**
|
|
13
|
+
If the same file is read again with the same `offset` and `limit`, and the file has not changed on disk, the extension blocks the duplicate read and returns a short stub instead of sending the file content again.
|
|
14
|
+
|
|
15
|
+
3. **Bound raw `rg` output in `bash`**
|
|
16
|
+
If a `bash` command uses `rg` without an output-bounding operator such as `head`, `tail`, or `wc`, the extension appends `| head -60` automatically.
|
|
17
|
+
|
|
18
|
+
## Why it helps
|
|
19
|
+
|
|
20
|
+
These guards reduce unnecessary token usage and make it harder for long sessions to burn context on repeated or unbounded file output.
|
|
21
|
+
|
|
22
|
+
## Current defaults
|
|
23
|
+
|
|
24
|
+
- `read` auto-limit: `120`
|
|
25
|
+
- `rg` head limit: `60`
|
|
26
|
+
- read guard: enabled
|
|
27
|
+
- read dedup guard: enabled
|
|
28
|
+
- raw `rg` guard: enabled
|
|
29
|
+
|
|
30
|
+
## Read dedup behavior
|
|
31
|
+
|
|
32
|
+
The dedup cache is scoped to the current session.
|
|
33
|
+
|
|
34
|
+
A cached `read` entry is only reused when all of the following are true:
|
|
35
|
+
|
|
36
|
+
- the same file path is requested
|
|
37
|
+
- the same `offset` is requested
|
|
38
|
+
- the same `limit` is requested
|
|
39
|
+
- the file's modification time has not changed
|
|
40
|
+
|
|
41
|
+
When a file changes, the cache entry is invalidated. The extension also listens for the `context-guard:file-modified` event so companion extensions such as `multi-edit` can evict stale cache entries immediately after writes.
|
|
42
|
+
|
|
43
|
+
## Example behaviors
|
|
44
|
+
|
|
45
|
+
### `read` without a limit
|
|
46
|
+
|
|
47
|
+
Input:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{ "path": "src/index.ts" }
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Effective call:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{ "path": "src/index.ts", "limit": 120 }
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Duplicate `read` of an unchanged file
|
|
60
|
+
|
|
61
|
+
Instead of re-sending the file contents, the extension returns a short message telling the agent to reuse the earlier `read` result.
|
|
62
|
+
|
|
63
|
+
### Raw `rg` inside `bash`
|
|
64
|
+
|
|
65
|
+
Input:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
rg "TODO" src
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Effective command:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
rg "TODO" src | head -60
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Files
|
|
78
|
+
|
|
79
|
+
- `index.ts` — extension entry point
|
|
80
|
+
- `package.json` — package metadata
|
|
81
|
+
- `CHANGELOG.md` — release history
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* context-guard — keep the LLM context window lean.
|
|
3
|
+
*
|
|
4
|
+
* Intercepts tool calls before they execute and applies three guards:
|
|
5
|
+
*
|
|
6
|
+
* 1. `read` without `limit`
|
|
7
|
+
* → auto-injects `limit: DEFAULT_READ_LIMIT` and notifies the user.
|
|
8
|
+
* The model can paginate with `offset` if it needs more.
|
|
9
|
+
*
|
|
10
|
+
* 2. `read` for a file already seen this session (mtime unchanged)
|
|
11
|
+
* → blocks the call and returns a stub:
|
|
12
|
+
* "File unchanged since last read — refer to the earlier result."
|
|
13
|
+
* (~20 tokens vs re-sending the full content). Evicted when
|
|
14
|
+
* multi-edit emits `context-guard:file-modified`.
|
|
15
|
+
*
|
|
16
|
+
* 3. `bash` using `rg` without any output-bounding operator
|
|
17
|
+
* → appends `| head -N` so grep dumps don't fill the context window.
|
|
18
|
+
*
|
|
19
|
+
* All guards are enabled by default.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { stat } from "node:fs/promises";
|
|
23
|
+
import { resolve } from "node:path";
|
|
24
|
+
|
|
25
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
26
|
+
import { isToolCallEventType } from "@mariozechner/pi-coding-agent";
|
|
27
|
+
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
// Defaults
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
const DEFAULTS = {
|
|
33
|
+
readLimit: 120,
|
|
34
|
+
rgHeadLimit: 60,
|
|
35
|
+
readGuard: true,
|
|
36
|
+
dedupGuard: true,
|
|
37
|
+
rgGuard: true,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
type Config = typeof DEFAULTS;
|
|
41
|
+
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
// Read dedup cache
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
|
|
46
|
+
/** What we remember about a past read. */
|
|
47
|
+
type ReadEntry = {
|
|
48
|
+
/** mtime in milliseconds at the time of the read. */
|
|
49
|
+
mtimeMs: number;
|
|
50
|
+
/** offset used (undefined = start of file). */
|
|
51
|
+
offset: number | undefined;
|
|
52
|
+
/** limit used (undefined = whole file). */
|
|
53
|
+
limit: number | undefined;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const FILE_UNCHANGED_STUB =
|
|
57
|
+
"File unchanged since last read. The content from the earlier Read " +
|
|
58
|
+
"tool_result in this conversation is still current — refer to that " +
|
|
59
|
+
"instead of re-reading.";
|
|
60
|
+
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
// Helpers
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
|
|
65
|
+
function usesUnboundedRg(cmd: string): boolean {
|
|
66
|
+
if (!/(?:^|[|;&\s])rg\s/.test(cmd)) return false;
|
|
67
|
+
if (/\|\s*(?:head|tail|wc|less|more|grep\s+-c)/.test(cmd)) return false;
|
|
68
|
+
if (/\brg\b[^|]*\s(?:-l|--files-with-matches|-c|--count|--json)\b/.test(cmd)) return false;
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function appendHead(cmd: string, n: number): string {
|
|
73
|
+
return `${cmd.trimEnd().replace(/;+$/, "").trimEnd()} | head -${n}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
// Extension
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
|
|
80
|
+
export default function (pi: ExtensionAPI): void {
|
|
81
|
+
const cfg: Config = { ...DEFAULTS };
|
|
82
|
+
|
|
83
|
+
/** Session-scoped read cache: absolute path → last-seen read metadata. */
|
|
84
|
+
const readCache = new Map<string, ReadEntry>();
|
|
85
|
+
|
|
86
|
+
// -------------------------------------------------------------------------
|
|
87
|
+
// Cache invalidation — fired by multi-edit after every real file write
|
|
88
|
+
// -------------------------------------------------------------------------
|
|
89
|
+
pi.events.on("context-guard:file-modified", (data: { path: string }) => {
|
|
90
|
+
if (data?.path) {
|
|
91
|
+
readCache.delete(resolve(data.path));
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// -------------------------------------------------------------------------
|
|
96
|
+
// Reset cache on new session
|
|
97
|
+
// -------------------------------------------------------------------------
|
|
98
|
+
pi.on("session_start", async () => {
|
|
99
|
+
readCache.clear();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// -------------------------------------------------------------------------
|
|
103
|
+
// Guard 1 + 2: read — limit injection + dedup
|
|
104
|
+
// -------------------------------------------------------------------------
|
|
105
|
+
pi.on("tool_call", async (event, ctx) => {
|
|
106
|
+
if (!isToolCallEventType("read", event)) return;
|
|
107
|
+
|
|
108
|
+
// Guard 1: inject limit if missing
|
|
109
|
+
if (cfg.readGuard && event.input.limit === undefined) {
|
|
110
|
+
event.input.limit = cfg.readLimit;
|
|
111
|
+
ctx.ui.notify(
|
|
112
|
+
`[context-guard] read: auto-limit=${cfg.readLimit} (use offset to paginate)`,
|
|
113
|
+
"info",
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Guard 2: dedup — block if file is unchanged since last read
|
|
118
|
+
if (!cfg.dedupGuard) return;
|
|
119
|
+
|
|
120
|
+
const rawPath = event.input.path;
|
|
121
|
+
if (!rawPath) return;
|
|
122
|
+
|
|
123
|
+
// Normalise path the same way pi does (strip leading @, resolve relative)
|
|
124
|
+
const absolutePath = resolve(
|
|
125
|
+
ctx.cwd,
|
|
126
|
+
rawPath.startsWith("@") ? rawPath.slice(1) : rawPath,
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
const entry = readCache.get(absolutePath);
|
|
130
|
+
if (!entry) return;
|
|
131
|
+
|
|
132
|
+
// Only dedup exact range matches
|
|
133
|
+
const sameOffset = entry.offset === (event.input.offset ?? undefined);
|
|
134
|
+
const sameLimit = entry.limit === (event.input.limit ?? undefined);
|
|
135
|
+
if (!sameOffset || !sameLimit) return;
|
|
136
|
+
|
|
137
|
+
// Check mtime — if the file changed on disk, let it through
|
|
138
|
+
try {
|
|
139
|
+
const { mtimeMs } = await stat(absolutePath);
|
|
140
|
+
if (mtimeMs !== entry.mtimeMs) {
|
|
141
|
+
readCache.delete(absolutePath);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
} catch {
|
|
145
|
+
// stat failed (file deleted, permission error, etc.) — let tool handle it
|
|
146
|
+
readCache.delete(absolutePath);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// File is unchanged — block the call and return the stub
|
|
151
|
+
ctx.ui.notify(`[context-guard] read dedup: ${rawPath} unchanged`, "info");
|
|
152
|
+
return {
|
|
153
|
+
block: true,
|
|
154
|
+
reason: FILE_UNCHANGED_STUB,
|
|
155
|
+
};
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// -------------------------------------------------------------------------
|
|
159
|
+
// Populate cache after a successful read
|
|
160
|
+
// -------------------------------------------------------------------------
|
|
161
|
+
pi.on("tool_result", async (event) => {
|
|
162
|
+
if (!cfg.dedupGuard) return;
|
|
163
|
+
if (event.toolName !== "read") return;
|
|
164
|
+
if (event.isError) return;
|
|
165
|
+
|
|
166
|
+
const rawPath = (event.input as { path?: string }).path;
|
|
167
|
+
if (!rawPath) return;
|
|
168
|
+
|
|
169
|
+
// Only cache full successful text reads (not images, PDFs, etc.)
|
|
170
|
+
const resultText = event.content
|
|
171
|
+
.filter((b): b is { type: "text"; text: string } => b.type === "text")
|
|
172
|
+
.map((b) => b.text)
|
|
173
|
+
.join("");
|
|
174
|
+
|
|
175
|
+
// Skip stubs injected by us — don't overwrite the real entry
|
|
176
|
+
if (resultText === FILE_UNCHANGED_STUB) return;
|
|
177
|
+
|
|
178
|
+
const absolutePath = resolve(
|
|
179
|
+
(event.input as { path?: string; cwd?: string }).cwd ?? "",
|
|
180
|
+
rawPath.startsWith("@") ? rawPath.slice(1) : rawPath,
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
try {
|
|
184
|
+
const { mtimeMs } = await stat(absolutePath);
|
|
185
|
+
readCache.set(absolutePath, {
|
|
186
|
+
mtimeMs,
|
|
187
|
+
offset: (event.input as { offset?: number }).offset ?? undefined,
|
|
188
|
+
limit: (event.input as { limit?: number }).limit ?? undefined,
|
|
189
|
+
});
|
|
190
|
+
} catch {
|
|
191
|
+
// best-effort only
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// -------------------------------------------------------------------------
|
|
196
|
+
// Guard 3: bash — rg without head/tail/wc
|
|
197
|
+
// -------------------------------------------------------------------------
|
|
198
|
+
pi.on("tool_call", async (event, ctx) => {
|
|
199
|
+
if (!cfg.rgGuard) return;
|
|
200
|
+
if (!isToolCallEventType("bash", event)) return;
|
|
201
|
+
|
|
202
|
+
const cmd = event.input.command ?? "";
|
|
203
|
+
if (usesUnboundedRg(cmd)) {
|
|
204
|
+
event.input.command = appendHead(cmd, cfg.rgHeadLimit);
|
|
205
|
+
ctx.ui.notify(
|
|
206
|
+
`[context-guard] bash: appended | head -${cfg.rgHeadLimit} to rg`,
|
|
207
|
+
"info",
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pi-mono-context-guard",
|
|
3
|
+
"version": "1.7.2",
|
|
4
|
+
"description": "Pi extension that guards context window growth by auto-limiting read and rg output",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pi-package",
|
|
7
|
+
"pi-extension"
|
|
8
|
+
],
|
|
9
|
+
"peerDependencies": {
|
|
10
|
+
"@mariozechner/pi-coding-agent": "*",
|
|
11
|
+
"@sinclair/typebox": "*"
|
|
12
|
+
},
|
|
13
|
+
"pi": {
|
|
14
|
+
"extensions": [
|
|
15
|
+
"./index.ts"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/emanuelcasco/pi-mono-extensions.git",
|
|
21
|
+
"directory": "extensions/context-guard"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# pi-mono-figma
|
|
2
|
+
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add the all-in-one pi package and bundle the shared pi-common workspace package into distributed packages.
|
|
8
|
+
|
|
9
|
+
## 0.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
### Added: LLM-ready Figma workflow
|
|
14
|
+
|
|
15
|
+
- Added `figma_get_node_summary`, `figma_extract_text`, `figma_explain_node`, and `figma_get_implementation_context` processed tools.
|
|
16
|
+
- Added compact node summarization that ignores hidden nodes, vector internals, and component instance internals by default.
|
|
17
|
+
- Changed `figma_get_design_context` to return compact top-level file context or target-node summaries instead of full recursive file structure.
|
|
18
|
+
- Updated tool descriptions, README, and skill guidance to prefer processed tools and keep raw JSON tools as debugging escape hatches.
|
|
19
|
+
- Added response caps, truncation metadata, and next-step suggestions for summarized node output.
|
|
20
|
+
|
|
21
|
+
### Added: Dev Mode parity helpers
|
|
22
|
+
|
|
23
|
+
- Added golden fixture tests for Figma summarization and design-to-code helper behavior.
|
|
24
|
+
- Added `figma_find_nodes_by_name` and `figma_find_nodes_by_text` for compact path-aware layer/text search.
|
|
25
|
+
- Enriched `figma_get_implementation_context` with CSS layout, responsive, accessibility, design token, framework, and starter snippet hints.
|
|
26
|
+
- Added `figma_extract_assets` for SVG/icon exports, node renders, image fill downloads, hashes, byte sizes, suggested names, and node-path manifests.
|
|
27
|
+
- Added `figma_find_code_connect_mapping` for bounded local Code Connect/Figma reference discovery.
|
|
28
|
+
- Added `figma_get_component_implementation_hints` for higher-level component implementation guidance.
|
|
29
|
+
- Documented live selection parity as future plugin/bridge work rather than a REST baseline feature.
|
|
30
|
+
|
|
31
|
+
## 0.1.2
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
### Fixed: package extension entrypoint
|
|
36
|
+
|
|
37
|
+
- Added the package root `index.ts` extension entrypoint so pi can load the Figma tools from the published package manifest.
|
|
38
|
+
- Documented the extension's benefits over Figma MCP in the package README.
|
|
39
|
+
|
|
40
|
+
## 0.1.1
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
### Enhanced: auth setup
|
|
45
|
+
|
|
46
|
+
- Added `/figma-auth` command and `figma_configure_auth` tool for masked local token capture.
|
|
47
|
+
- Figma tools now prompt for a fresh token and retry once when auth is missing, invalid, or expired.
|
|
48
|
+
- Token setup writes to `~/.pi/agent/auth.json` without returning the token to the model.
|
|
49
|
+
|
|
50
|
+
## 0.1.0
|
|
51
|
+
|
|
52
|
+
### Minor Changes
|
|
53
|
+
|
|
54
|
+
### New Extension: figma
|
|
55
|
+
|
|
56
|
+
- Added native Figma REST API tools for file, node, styles, variables, components, component sets, component search, design-context, URL parsing, metadata, and node rendering workflows.
|
|
57
|
+
- Added bundled `figma` skill that explains when and how to use the native `figma_*` tools.
|
|
58
|
+
- Added authentication support via `FIGMA_TOKEN` and `~/.pi/agent/auth.json` at `.figma.token`.
|
|
59
|
+
- Added README documentation for token creation, required Figma file-content read scope, and setup/troubleshooting.
|