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,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status Line — configurable footer extension for pi.
|
|
3
|
+
*
|
|
4
|
+
* Modes:
|
|
5
|
+
* - "basic" — cwd + branch, token stats, model info (original two-line layout)
|
|
6
|
+
* - "expert" — visual context gauge, git dirty/ahead/behind, subscription usage indicators
|
|
7
|
+
*
|
|
8
|
+
* Resolution order (first hit wins):
|
|
9
|
+
* 1. PI_STATUS_LINE_MODE environment variable
|
|
10
|
+
* 2. ~/.pi/agent/status-line.json → { "mode": "basic" | "expert" }
|
|
11
|
+
* 3. default → "basic"
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
15
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
16
|
+
import { homedir } from "node:os";
|
|
17
|
+
import { join } from "node:path";
|
|
18
|
+
import basicStatusLine from "./basic";
|
|
19
|
+
import expertStatusLine from "./expert";
|
|
20
|
+
|
|
21
|
+
type Mode = "basic" | "expert";
|
|
22
|
+
|
|
23
|
+
const CONFIG_PATH = join(homedir(), ".pi", "agent", "status-line.json");
|
|
24
|
+
const DEFAULT_MODE: Mode = "basic";
|
|
25
|
+
|
|
26
|
+
function readConfigMode(): Mode | undefined {
|
|
27
|
+
try {
|
|
28
|
+
if (!existsSync(CONFIG_PATH)) return undefined;
|
|
29
|
+
const raw = readFileSync(CONFIG_PATH, "utf-8");
|
|
30
|
+
const parsed = JSON.parse(raw) as { mode?: string };
|
|
31
|
+
if (parsed.mode === "basic" || parsed.mode === "expert") return parsed.mode;
|
|
32
|
+
} catch {}
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function resolveMode(): Mode {
|
|
37
|
+
const envMode = process.env.PI_STATUS_LINE_MODE;
|
|
38
|
+
if (envMode === "basic" || envMode === "expert") return envMode;
|
|
39
|
+
|
|
40
|
+
const configMode = readConfigMode();
|
|
41
|
+
if (configMode) return configMode;
|
|
42
|
+
|
|
43
|
+
return DEFAULT_MODE;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default function (pi: ExtensionAPI): void {
|
|
47
|
+
const mode = resolveMode();
|
|
48
|
+
|
|
49
|
+
if (mode === "expert") {
|
|
50
|
+
expertStatusLine(pi);
|
|
51
|
+
} else {
|
|
52
|
+
basicStatusLine(pi);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pi-mono-status-line",
|
|
3
|
+
"version": "1.7.2",
|
|
4
|
+
"description": "Pi extension that adds git branch and richer stats to the footer",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pi-package",
|
|
7
|
+
"pi-extension"
|
|
8
|
+
],
|
|
9
|
+
"peerDependencies": {
|
|
10
|
+
"@mariozechner/pi-ai": "*",
|
|
11
|
+
"@mariozechner/pi-coding-agent": "*",
|
|
12
|
+
"@mariozechner/pi-tui": "*",
|
|
13
|
+
"@sinclair/typebox": "*"
|
|
14
|
+
},
|
|
15
|
+
"pi": {
|
|
16
|
+
"extensions": [
|
|
17
|
+
"./index.ts"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/emanuelcasco/pi-mono-extensions.git",
|
|
23
|
+
"directory": "extensions/status-line"
|
|
24
|
+
},
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/emanuelcasco/pi-mono-extensions/issues"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/emanuelcasco/pi-mono-extensions#readme"
|
|
29
|
+
}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# pi-mono-team-mode
|
|
2
|
+
|
|
3
|
+
## 2.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Clarify coordinator prompt guidance so single coherent tasks are handled directly without creating a one-item TODO, reserving `task_create`/`task_update` for multi-task goals or dependency tracking.
|
|
8
|
+
|
|
9
|
+
## 2.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Add `runtime: "transient"` for fast one-shot in-process `agent` and `delegate` fan-out runs that return output directly without creating durable teammate records.
|
|
14
|
+
- Forward runtime selection through delegate parallel and chain steps, with validation for transient-incompatible durable options such as names, teams, worktrees, and background notifications.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Fix live team-mode metrics for tool-only assistant turns so the **● Agents** panel increments turns and token counts when workers respond with tool calls before text.
|
|
19
|
+
- Parse Pi's current usage shape (`input`, `output`, `cacheRead`, `cacheWrite`) in addition to legacy token field names.
|
|
20
|
+
|
|
21
|
+
## 2.2.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- Add explicit thinking-level support for team-mode workers, including `agent`/`delegate` parameters, teammate spec frontmatter, compact `model-config.json` tiers/roles defaults, persisted records, and subprocess `--thinking` propagation.
|
|
26
|
+
|
|
27
|
+
## 2.1.0
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
### Enhanced: team-mode
|
|
32
|
+
|
|
33
|
+
- Added `delegate` tool with:
|
|
34
|
+
- `tasks[]` foreground parallel mode (bounded concurrency + aggregated outputs)
|
|
35
|
+
- `chain[]` sequential mode with `{task}` / `{previous}` / `{chain_dir}` templating
|
|
36
|
+
- inner chain `parallel` fan-out/fan-in steps, plus per-step `output` / `reads`
|
|
37
|
+
- Added live pi stdout event parsing and in-memory teammate metrics (turns, tools, tokens, activity).
|
|
38
|
+
- Replaced one-line status summary with a multi-line **● Agents** widget showing active/queued teammates and live counters.
|
|
39
|
+
- Added styled `task-notification` message renderer for completion/failure boxes with metrics + transcript path.
|
|
40
|
+
- Updated coordinator prompt guidance to include task-board + `delegate` fan-out workflow.
|
|
41
|
+
- Added tests for parser, parallel helpers, delegation manager, widget rendering, and notification renderer.
|
|
42
|
+
|
|
43
|
+
## 2.0.0
|
|
44
|
+
|
|
45
|
+
### Major Changes — Complete Rewrite
|
|
46
|
+
|
|
47
|
+
### Enhanced: team-mode
|
|
48
|
+
|
|
49
|
+
- **Complete rewrite**: replaced the old team-orchestration model (leader-driven runtime with state machines, approval flows, signal manager, mailbox manager, intent queue) with a **flat peer-agent model** mirroring Claude Code's team-mode semantics.
|
|
50
|
+
- **New `agent` tool** — spawn an isolated pi subprocess worker. Returns immediately; completion arrives as a `<task-notification>` user-role message that wakes the coordinator event-driven (no polling, no leader subprocess).
|
|
51
|
+
- **New `send_message` tool** — continue an existing worker with full prior context (reuses `pi --session`). Pass `to: "*"` for swarm-wide broadcast.
|
|
52
|
+
- **New `task_stop` / `task_output` tools** — stop a running worker or read its current/last output.
|
|
53
|
+
- **New `task_create / task_update / task_list / task_get` tools** — shared TODO list with CAS version counters and file-system locking for safe concurrent edits across teammate subprocesses.
|
|
54
|
+
- **New `team_create / team_delete` tools** — lightweight namespaces grouping workers with shared isolation defaults.
|
|
55
|
+
- **Coordinator mode** (`PI_TEAM_MATE_COORDINATOR=1`) — injects a coordinator system prompt via `before_agent_start` hook, teaching the parent LLM the delegation discipline (synthesize — don't delegate understanding).
|
|
56
|
+
- **Event-driven worker wake** — worker completion pushes a user-role `<task-notification>` with `triggerTurn: true`, so the coordinator reacts immediately instead of polling.
|
|
57
|
+
- **Worktree isolation** — `isolation: "worktree"` sandboxes edits in git worktrees; clean worktrees auto-removed, dirty ones retained with path/branch surfaced in tool results.
|
|
58
|
+
- **Teammate specs** — drop `.pi/teammates/<role>.md` or `.claude/teammates/<role>.md` for role-based configuration (model tier, allowed tools, system prompt).
|
|
59
|
+
- **Model config** — `model-config.json` with provider catalogs (anthropic/openai-codex), role→tier mappings, tier resolution, and optional `taskCompletedHook` for quality gates.
|
|
60
|
+
- **Slash commands** — `/teammate list|status|stop`, `/team list|create|delete`, `/tasks list|show|clear`.
|
|
61
|
+
- **Keyboard shortcut** — `Ctrl+Shift+T` shows the shared task list.
|
|
62
|
+
- **Live status widget** — shows running/completed/failed/stopped teammates in the TUI status line.
|
|
63
|
+
- **Persistent storage** — teammates, teams, tasks, and runtime indices stored under `~/.pi/agent/extensions/team-mode/` with atomic writes and in-memory caching.
|
|
64
|
+
- **Comprehensive test suite** — 13 test files covering stores, managers, formatters, prompts, specs, model config, worktree, and tasks.
|
|
65
|
+
|
|
66
|
+
### Removed
|
|
67
|
+
|
|
68
|
+
- Removed `LeaderRuntime`, `ApprovalManager`, `MailboxManager`, `SignalManager`, `IntentQueue`, `WatchMode` — all replaced by the flat peer-agent model.
|
|
69
|
+
- Removed `LeaderPhase` enum and `currentPhase` from team records.
|
|
70
|
+
- Removed auto-spawn loops and deterministic task graph bootstrapping — the coordinator (LLM or human) drives all task creation and assignment via tool calls.
|
|
71
|
+
|
|
72
|
+
### Documentation
|
|
73
|
+
|
|
74
|
+
- Complete README rewrite documenting the new execution model, tool parity with Claude Code, and architecture.
|
|
75
|
+
|
|
76
|
+
## 1.7.2
|
|
77
|
+
|
|
78
|
+
### Patch Changes
|
|
79
|
+
|
|
80
|
+
### Fixed: ask-user-question
|
|
81
|
+
|
|
82
|
+
- Remove unused `StringEnum` import from `@mariozechner/pi-ai`.
|
|
83
|
+
|
|
84
|
+
## 1.7.1
|
|
85
|
+
|
|
86
|
+
### Patch Changes
|
|
87
|
+
|
|
88
|
+
### Fixed: team-mode
|
|
89
|
+
|
|
90
|
+
- Widget no longer mislabels blocked or approval-pending teams as "running smoothly" — blockers and pending approvals are now detected via team summaries.
|
|
91
|
+
- Preserve in-flight work on re-emitted `session_start` events instead of tearing the runtime down and SIGTERM-ing live teammates.
|
|
92
|
+
- Auto-relaunch leaders for `running` teams after a session reset; surface failures as both a team signal and a UI notification.
|
|
93
|
+
- `createTeam` now defaults `repoRoots` to `[process.cwd()]` when the caller passes an empty array.
|
|
94
|
+
- 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.
|
|
95
|
+
|
|
96
|
+
### Enhanced: team-mode
|
|
97
|
+
|
|
98
|
+
- 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.
|
|
99
|
+
- 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.
|
|
100
|
+
- `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.
|
|
101
|
+
- Persist per-turn debug artifacts (prompt, invocation, stderr, raw event stream) for both leader and teammate subprocesses, exposed via `TeammateSummary.debugArtifacts`.
|
|
102
|
+
- Track `exitCode`, `exitSignal`, `terminationReason`, `stderrTail`, `toolExecutions`, `model` and `modelProvider` on every `TeammateProcess` record.
|
|
103
|
+
- 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.
|
|
104
|
+
- `collectPiOutput` supports `AbortSignal` cancellation.
|
|
105
|
+
|
|
106
|
+
### Tests
|
|
107
|
+
|
|
108
|
+
- New `intent-queue` and `model-config` suites; expanded coverage across `leader-runtime`, `team-manager`, `team-query-tool` and `formatters`.
|
|
109
|
+
|
|
110
|
+
## 1.7.0
|
|
111
|
+
|
|
112
|
+
### Minor Changes
|
|
113
|
+
|
|
114
|
+
### Enhanced: status-line
|
|
115
|
+
|
|
116
|
+
- Improved progress rendering and colors in expert mode
|
|
117
|
+
|
|
118
|
+
### Enhanced: team-mode
|
|
119
|
+
|
|
120
|
+
- **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
|
|
121
|
+
- **New tool `team_task_create`** so the leader can author tasks at runtime
|
|
122
|
+
- **New tool `team_handoff`** for explicit teammate → teammate context handoffs (replaces regex-scraping of `Handoffs:` output sections)
|
|
123
|
+
- **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
|
|
124
|
+
- **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
|
|
125
|
+
- **Templates accept any string** — `fullstack` / `research` / `refactor` remain as built-ins, but unknown template keys are accepted and no-op gracefully
|
|
126
|
+
- **Provider config per team** — per-team model overrides via `/team models`
|
|
127
|
+
- Reduced leader overhead and parent-session token churn
|
|
128
|
+
- `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
|
|
129
|
+
|
|
130
|
+
### Breaking changes: team-mode
|
|
131
|
+
|
|
132
|
+
- Removed `LeaderPhase` enum and `currentPhase` field from `TeamRecord` / `TeamSummary`
|
|
133
|
+
- Removed `parseExplicitHandoffs` export and the legacy `Handoffs:` output parser — peer handoffs must go through the `team_handoff` tool
|
|
134
|
+
- Removed the deterministic auto-spawn loop (`ensureBootstrapTasks`) — all task authoring and teammate spawning is now the LLM leader's responsibility
|
|
135
|
+
- Removed `StringEnum` gate on `team_create`'s `template` parameter (now plain string)
|
|
136
|
+
|
|
137
|
+
### Fixed: review
|
|
138
|
+
|
|
139
|
+
- Annotate diff lines so the model picks correct line numbers
|
|
140
|
+
- Fix slice chunk around lines for comments in the reviewer TUI
|
|
141
|
+
|
|
142
|
+
### Documentation
|
|
143
|
+
|
|
144
|
+
- Updated root README and sentinel extension README
|
|
145
|
+
- Documented the new file-based teammate spec format and event-driven leader wake in the team-mode README
|
|
146
|
+
|
|
147
|
+
## 1.6.0
|
|
148
|
+
|
|
149
|
+
### Minor Changes
|
|
150
|
+
|
|
151
|
+
### New Extension: sentinel
|
|
152
|
+
|
|
153
|
+
Replaced the `grep` extension with a new security-focused `sentinel` extension for monitoring and guarding sensitive operations.
|
|
154
|
+
|
|
155
|
+
### Enhanced: team-mode
|
|
156
|
+
|
|
157
|
+
- Added comprehensive test suite with integration tests
|
|
158
|
+
- New mock helpers for subprocess testing
|
|
159
|
+
- Improved signal manager with better error handling
|
|
160
|
+
- Leader runtime refactoring for stability
|
|
161
|
+
- Team query tool with dedicated tests
|
|
162
|
+
|
|
163
|
+
### Enhanced: status-line
|
|
164
|
+
|
|
165
|
+
- Added basic and expert mode displays
|
|
166
|
+
- Improved index.ts with better state management
|
|
167
|
+
|
|
168
|
+
### Enhanced: clear
|
|
169
|
+
|
|
170
|
+
- Updated keyboard shortcut to `Ctrl+Shift+L`
|
|
171
|
+
- Better busy-state handling for shortcuts
|
|
172
|
+
- Added warning/cancel handling and error notifications
|
|
173
|
+
|
|
174
|
+
### Enhanced: context-guard
|
|
175
|
+
|
|
176
|
+
- Improved read deduplication across sessions
|
|
177
|
+
- Added `context-guard:file-modified` event for cache eviction
|
|
178
|
+
|
|
179
|
+
### Documentation
|
|
180
|
+
|
|
181
|
+
- Added dedicated README for `clear` extension
|
|
182
|
+
- Added dedicated README for `context-guard` extension
|
|
183
|
+
- Updated main README with improved extension descriptions
|
|
184
|
+
|
|
185
|
+
## 1.5.0
|
|
186
|
+
|
|
187
|
+
### Minor Changes
|
|
188
|
+
|
|
189
|
+
- ### `multi-edit` — diverge from upstream fork
|
|
190
|
+
|
|
191
|
+
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.
|
|
192
|
+
|
|
193
|
+
- **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).
|
|
194
|
+
- **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.
|
|
195
|
+
- **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.
|
|
196
|
+
- **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.
|
|
197
|
+
- **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`).
|
|
198
|
+
- **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.
|
|
199
|
+
- **README attribution** — new "Origins" section crediting `mitsuhiko/agent-stuff` as the original source.
|
|
200
|
+
|
|
201
|
+
## 1.4.0
|
|
202
|
+
|
|
203
|
+
### Minor Changes
|
|
204
|
+
|
|
205
|
+
- Add teammate progress heartbeats and widget refresh improvements to team mode.
|
|
206
|
+
|
|
207
|
+
## 1.3.0
|
|
208
|
+
|
|
209
|
+
### Patch Changes
|
|
210
|
+
|
|
211
|
+
- ### New Extensions
|
|
212
|
+
|
|
213
|
+
#### `loop`
|
|
214
|
+
|
|
215
|
+
New extension that runs a prompt or slash command on a recurring interval. Useful for periodic tasks, polling, and automated repeated actions within a pi session.
|
|
216
|
+
|
|
217
|
+
#### `simplify`
|
|
218
|
+
|
|
219
|
+
New extension that reviews changed code for reuse, quality, and efficiency, then automatically fixes any issues found. Integrates with `git diff` to scope the review to recent changes.
|
|
220
|
+
|
|
221
|
+
***
|
|
222
|
+
|
|
223
|
+
### Bug Fixes
|
|
224
|
+
|
|
225
|
+
#### `multi-edit`
|
|
226
|
+
|
|
227
|
+
- **Broader unicode normalization**: `findActualString` now handles the full range of Unicode single-quote variants (`‘’‚‛`) and double-quote variants (`“”„‟`) when falling back from exact match — fixes more curly-quote mismatch cases
|
|
228
|
+
- **Parallel write-access preflight**: `checkWriteAccess` calls are now issued concurrently via `Promise.all` instead of sequentially — faster batch preflight on large edit sets
|
|
229
|
+
- **Removed redundant `editOrder` array**: `Map` insertion order is now relied upon directly, simplifying the grouping loop
|
|
230
|
+
|
|
231
|
+
#### `team-mode`
|
|
232
|
+
|
|
233
|
+
- **Stall detection hardened**: introduced `STALL_BLOCKER_MARKER` / `STALL_BLOCKER_MESSAGE` constants so the marker used to detect and record abnormal process exits stays in sync — prevents duplicate stall reports
|
|
234
|
+
- **Leader cycle guard comment clarified**: `cycleRunning` guard comment now explicitly calls out the race between the poll interval and teammate-completion handlers
|
|
235
|
+
|
|
236
|
+
## 1.2.0
|
|
237
|
+
|
|
238
|
+
### Minor Changes
|
|
239
|
+
|
|
240
|
+
- ### `multi-edit` — robustness improvements
|
|
241
|
+
|
|
242
|
+
- **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
|
|
243
|
+
- **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
|
|
244
|
+
- **Curly-quote normalization**: new `findActualString` helper falls back to normalized quote matching (`"` / `'` ↔ `"` / `'`) when exact `oldText` search fails — the most common class of preflight mismatch
|
|
245
|
+
- **Atomic batch rollback**: `applyClassicEdits` gains a `rollbackOnError` option that restores all successfully written files when a later edit in the same batch fails
|
|
246
|
+
|
|
247
|
+
### `ask-user-question` — UX fixes
|
|
248
|
+
|
|
249
|
+
- **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
|
|
250
|
+
- **Unified advance logic**: `advanceTab()` and `saveOtherModeText()` helpers replace scattered single-question fast-paths — behaviour is now consistent regardless of form length
|
|
251
|
+
- **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
|
|
252
|
+
|
|
253
|
+
### `team-mode` — stability fixes
|
|
254
|
+
|
|
255
|
+
- **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
|
|
256
|
+
- **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
|
|
257
|
+
- **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
|
|
258
|
+
- **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
|
|
259
|
+
- **Widget cleanup**: cancelled and completed teams are no longer shown in the team widget — only `initializing | running | paused | failed` states are displayed
|
|
260
|
+
- **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
|
|
261
|
+
|
|
262
|
+
## 1.1.1
|
|
263
|
+
|
|
264
|
+
### Patch Changes
|
|
265
|
+
|
|
266
|
+
- chore: update all packages for consistency and include team-mode fixes
|
|
267
|
+
|
|
268
|
+
## 1.1.0
|
|
269
|
+
|
|
270
|
+
## 1.0.0
|
|
271
|
+
|
|
272
|
+
### Major Changes
|
|
273
|
+
|
|
274
|
+
- 199c367: First version of the extensions to upload to GitHub
|
|
275
|
+
|
|
276
|
+
### Patch Changes
|
|
277
|
+
|
|
278
|
+
- Bump all packages to 0.1.1
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# pi-mono-team-mode
|
|
2
|
+
|
|
3
|
+
A faithful port of **Claude Code's team-mode mode** to the pi coding agent. Named workers are spawned as pi subprocesses by default, the coordinator ends its turn after launching, and completion arrives as a `<task-notification>` user-role message that wakes the coordinator event-driven — no polling, no leader subprocess.
|
|
4
|
+
|
|
5
|
+
> **Sibling of `pi-mono-team-mode`.** `team-mode` is leader-driven (a coordinator subprocess runs on its own task graph). `team-mode` maps 1:1 to Claude Code's semantics instead.
|
|
6
|
+
|
|
7
|
+
## Parity with Claude Code
|
|
8
|
+
|
|
9
|
+
Everything below mirrors `claude-code/src/` behavior (`coordinator/coordinatorMode.ts`, `tools/AgentTool`, `tools/SendMessageTool`, `tools/Task*Tool`, `utils/swarm/teammatePromptAddendum.ts`).
|
|
10
|
+
|
|
11
|
+
| Claude Code | team-mode |
|
|
12
|
+
| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
13
|
+
| `Agent({ description, prompt, name?, team_name?, subagent_type?, isolation?, run_in_background? })` | `agent(...)` — same schema plus optional `runtime` selector |
|
|
14
|
+
| `subagent({ tasks })`-style fan-out | `delegate({ tasks: [...] })` |
|
|
15
|
+
| `subagent({ chain })`-style sequencing | `delegate({ task, chain: [...] })` |
|
|
16
|
+
| `SendMessage({ to, message })` | `send_message(...)` |
|
|
17
|
+
| `TaskStop({ task_id })` | `task_stop(...)` |
|
|
18
|
+
| `TaskOutput({ task_id })` | `task_output(...)` |
|
|
19
|
+
| `TaskCreate({ subject, description, activeForm?, metadata? })` | `task_create(...)` |
|
|
20
|
+
| `TaskUpdate({ task_id, status?, owner?, addBlocks?, addBlockedBy?, ... })` | `task_update(...)` |
|
|
21
|
+
| `TaskGet({ task_id })` | `task_get(...)` |
|
|
22
|
+
| `TaskList({ status?, owner? })` | `task_list(...)` |
|
|
23
|
+
| `TeamCreate / TeamDelete` | `team_create / team_delete` |
|
|
24
|
+
| `<task-notification>` XML wakes coordinator | Emitted via `pi.sendMessage({ triggerTurn: true })` on teammate end |
|
|
25
|
+
| Coordinator system prompt (`CLAUDE_CODE_COORDINATOR_MODE=1`) | `PI_TEAM_MATE_COORDINATOR=1` |
|
|
26
|
+
| Teammate prompt addendum (`TEAMMATE_SYSTEM_PROMPT_ADDENDUM`) | Prepended to every teammate's system prompt |
|
|
27
|
+
| Task ids namespaced `agent-*` | Same namespace; `task_stop` and `send_message` accept it |
|
|
28
|
+
|
|
29
|
+
## The execution model
|
|
30
|
+
|
|
31
|
+
Workers are **event-driven, not polled**. You don't write "spawn, wait, spawn the next" loops:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Turn 1 (coordinator):
|
|
35
|
+
agent({ description: "research auth", prompt: "..." }) → task_id: agent-r-ab1
|
|
36
|
+
agent({ description: "research billing", prompt: "..." })→ task_id: agent-b-c3d
|
|
37
|
+
"Investigating both — I'll report back." [turn ends]
|
|
38
|
+
|
|
39
|
+
...workers run in parallel; zero coordinator tokens burned...
|
|
40
|
+
|
|
41
|
+
Between turns:
|
|
42
|
+
<task-notification>
|
|
43
|
+
<task-id>agent-r-ab1</task-id>
|
|
44
|
+
<status>completed</status>
|
|
45
|
+
<summary>Agent "research auth" completed</summary>
|
|
46
|
+
<result>Found null pointer in src/auth/validate.ts:42...</result>
|
|
47
|
+
<usage><duration_ms>14230</duration_ms></usage>
|
|
48
|
+
</task-notification>
|
|
49
|
+
|
|
50
|
+
Turn 2 (coordinator, woken by the notification):
|
|
51
|
+
"Found the bug. I'll fix it."
|
|
52
|
+
send_message({ to: "agent-r-ab1", message: "Fix src/auth/validate.ts:42..." })
|
|
53
|
+
[turn ends]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
For a single coherent task, the coordinator should resolve it directly without creating a TODO item. Creating exactly one `task_create` entry is overhead, not coordination.
|
|
57
|
+
|
|
58
|
+
For a DAG of dependent tasks, the coordinator:
|
|
59
|
+
|
|
60
|
+
1. Seeds the TODO list via `task_create` (each task with `blocks`/`blockedBy` set via `task_update`).
|
|
61
|
+
2. Spawns a worker for each immediately-unblocked task, setting `task_update({ owner })` on the matching TODO.
|
|
62
|
+
3. **Ends its turn.**
|
|
63
|
+
4. On each `<task-notification>`, marks the TODO completed, checks what's newly unblocked, spawns the next wave.
|
|
64
|
+
|
|
65
|
+
The coordinator never waits — it runs briefly, reactively, on each notification.
|
|
66
|
+
|
|
67
|
+
## Install
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pi install npm:pi-mono-team-mode
|
|
71
|
+
# or load locally
|
|
72
|
+
pi -e /path/to/pi-extensions/extensions/team-mode/index.ts
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Coordinator mode
|
|
76
|
+
|
|
77
|
+
Set `PI_TEAM_MATE_COORDINATOR=1` on the pi session you want to act as coordinator:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
PI_TEAM_MATE_COORDINATOR=1 pi
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
This injects the coordinator system prompt at every turn via the `before_agent_start` hook. The prompt teaches the LLM the `<task-notification>` flow, the delegation discipline, and the "synthesize — don't hand off understanding" rule lifted straight from Claude Code.
|
|
84
|
+
|
|
85
|
+
## Teammate specs
|
|
86
|
+
|
|
87
|
+
Drop a markdown file into `.pi/teammates/<role>.md` (or `.claude/teammates/<role>.md`):
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
---
|
|
91
|
+
name: reviewer
|
|
92
|
+
description: reviews diffs for bugs and style violations
|
|
93
|
+
modelTier: deep
|
|
94
|
+
thinkingLevel: high
|
|
95
|
+
tools: read, bash, grep
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
You are a careful code reviewer. ...
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Frontmatter fields: `name`, `description`, `needsWorktree`, `hasMemory`, `modelTier`, `thinkingLevel`, `tools` (comma-separated). The body becomes the teammate's system prompt. The Claude Code teammate addendum (`send_message` instructions) is prepended automatically.
|
|
102
|
+
|
|
103
|
+
## Model and thinking selection
|
|
104
|
+
|
|
105
|
+
`agent(...)` and each `delegate` task accept both `model` and `thinking` (`thinking_level` is accepted as an alias):
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
agent({
|
|
109
|
+
description: "review diff",
|
|
110
|
+
prompt: "Review the current branch",
|
|
111
|
+
subagent_type: "reviewer",
|
|
112
|
+
model: "deep",
|
|
113
|
+
thinking: "high",
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Valid thinking levels are `off`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Team-mode passes the selected level to the teammate subprocess as `pi --thinking <level>`. Token budgets remain pi's responsibility via `~/.pi/agent/settings.json` `thinkingBudgets`.
|
|
118
|
+
|
|
119
|
+
`model-config.json` can define compact role/tier defaults:
|
|
120
|
+
|
|
121
|
+
```jsonc
|
|
122
|
+
{
|
|
123
|
+
"defaultTier": "md",
|
|
124
|
+
"tiers": {
|
|
125
|
+
"sm": {
|
|
126
|
+
"name": "Small",
|
|
127
|
+
"thinkingLevel": "low",
|
|
128
|
+
"description": "Simple tasks, deterministic outputs. Use for formatting, rewriting, classification",
|
|
129
|
+
},
|
|
130
|
+
"md": {
|
|
131
|
+
"name": "Medium",
|
|
132
|
+
"thinkingLevel": "medium",
|
|
133
|
+
"description": "Handles moderate complexity. Use for workflows, APIs, structured tasks",
|
|
134
|
+
},
|
|
135
|
+
"lg": {
|
|
136
|
+
"name": "Large",
|
|
137
|
+
"thinkingLevel": "high",
|
|
138
|
+
"description": "Strong reasoning, multi-step tasks. Use for reasoning, planning, debugging, decision support",
|
|
139
|
+
},
|
|
140
|
+
"xl": {
|
|
141
|
+
"name": "Deep",
|
|
142
|
+
"thinkingLevel": "xhigh",
|
|
143
|
+
"description": "Near-frontier capability, complex domains. Complex planning, abstraction, ambiguous problems",
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
"roles": {
|
|
147
|
+
"researcher": "sm",
|
|
148
|
+
"docs": "xs",
|
|
149
|
+
"backend": "md",
|
|
150
|
+
"frontend": "md",
|
|
151
|
+
"tester": "md",
|
|
152
|
+
"planner": "lg",
|
|
153
|
+
"reviewer": "md",
|
|
154
|
+
},
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Built-in provider catalogs map `xs`/`sm` to small models, `md` to default models, and `lg`/`xl` to large models. You can still override `providers` if you want exact model IDs per tier. Legacy `roleTiers`, `tierThinkingLevels`, and `roleThinkingLevels` remain supported.
|
|
159
|
+
|
|
160
|
+
Thinking resolution order is: explicit tool `thinking`, teammate spec `thinkingLevel`, `roles`/`roleTiers` tier metadata (`tiers[tier].thinkingLevel`), a legacy `:<thinking>` model suffix such as `gpt-5.4:high`, legacy `tierThinkingLevels`, then `defaultThinkingLevel`. If none applies, pi inherits its normal default.
|
|
161
|
+
|
|
162
|
+
## Execution runtimes
|
|
163
|
+
|
|
164
|
+
`agent` and `delegate` accept an explicit `runtime` selector:
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
agent({
|
|
168
|
+
description: "quick summary",
|
|
169
|
+
prompt: "Summarize README.md",
|
|
170
|
+
runtime: "transient",
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
delegate({
|
|
174
|
+
runtime: "transient",
|
|
175
|
+
tasks: [
|
|
176
|
+
{ description: "scan docs", prompt: "Find docs gaps" },
|
|
177
|
+
{ description: "scan tests", prompt: "Find missing coverage" },
|
|
178
|
+
],
|
|
179
|
+
});
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
- `runtime: "subprocess"` (default): durable, resumable workers backed by `pi --session`; supports `send_message`, names, teams, worktree isolation, background notifications, transcripts, and persistent records.
|
|
183
|
+
- `runtime: "transient"`: fast one-shot in-process `createAgentSession()` runs; returns output directly to the current tool call; does not create teammate records, cannot be resumed, and does not share the parent LLM context window.
|
|
184
|
+
|
|
185
|
+
Transient prompts must be fully self-contained. They only share the parent Node.js process/runtime infrastructure, not the coordinator conversation. Initial transient mode rejects `isolation: "worktree"`, `run_in_background: true`, `team_name`, and `name` because those imply durable teammate semantics.
|
|
186
|
+
|
|
187
|
+
Use transient mode for quick disposable research/summarization fan-out. Use subprocess mode for implementation work, resumable teammates, background work, worktrees, or anything that needs a stable `task_id` for later `send_message`.
|
|
188
|
+
|
|
189
|
+
## Storage
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
~/.pi/agent/extensions/team-mode/
|
|
193
|
+
├── model-config.json # provider/tier/role + taskCompletedHook
|
|
194
|
+
├── teammates/<agent-id>/record.json
|
|
195
|
+
├── teammates/<agent-id>/sessions/<id>.jsonl # pi --session target
|
|
196
|
+
├── teams/<team-id>/record.json
|
|
197
|
+
├── tasks/<parent-session-id>/<task-id>.json # shared TODO list
|
|
198
|
+
└── runtime/<parent-session-id>/index.json # teammate name → agent-id
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Override with `PI_TEAM_MATE_STORAGE_ROOT` for tests.
|
|
202
|
+
|
|
203
|
+
## Quality gates
|
|
204
|
+
|
|
205
|
+
Add to `model-config.json`:
|
|
206
|
+
|
|
207
|
+
```jsonc
|
|
208
|
+
{ "taskCompletedHook": "pnpm test --run" }
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
When a task transitions to `completed`, the hook runs in the task's cwd. Non-zero exit reverts the task to `failed` and attaches hook output (stdout + stderr, first 8 KB) to `result`. 2-minute timeout. Stale PID-based lock files are auto-recovered after 10 s.
|
|
212
|
+
|
|
213
|
+
## Concurrency model
|
|
214
|
+
|
|
215
|
+
- Each task is its own file under `tasks/<parent-session-id>/<task-id>.json`.
|
|
216
|
+
- `task_update` takes an exclusive filesystem lock (`<task-id>.lock` via `open(..., "wx")`) and bumps a CAS `version` counter.
|
|
217
|
+
- Stale locks (>10 s) are reclaimed automatically — safe across teammate subprocesses.
|
|
218
|
+
|
|
219
|
+
## Delegate groups + live progress
|
|
220
|
+
|
|
221
|
+
- `delegate({ tasks: [...] })` runs bounded parallel workers and returns aggregated output blocks.
|
|
222
|
+
- `delegate({ task, chain: [...] })` runs sequential chains with `{task}`, `{previous}`, `{chain_dir}` substitution and optional inner `parallel` fan-out.
|
|
223
|
+
- Per-step `output` and `reads` let chain steps exchange large artifacts through files in `{chain_dir}`.
|
|
224
|
+
- Parallel caps: `PI_TEAM_MATE_MAX_PARALLEL` (default `8`) and `PI_TEAM_MATE_PARALLEL_CONCURRENCY` (default `4`).
|
|
225
|
+
- Live TUI widget now renders a multi-line **● Agents** panel (spinner, turns/tool-uses/tokens/elapsed, activity hint, queued tail).
|
|
226
|
+
- `<task-notification>` messages are rendered as styled completion boxes (status glyph, counters, duration, transcript path).
|
|
227
|
+
|
|
228
|
+
## Slash commands & keybinding
|
|
229
|
+
|
|
230
|
+
- `/teammate list | status <name> | stop <name>`
|
|
231
|
+
- `/team list | create <name> | delete <id>`
|
|
232
|
+
- `/tasks list | show <id> | clear`
|
|
233
|
+
- **Ctrl+Shift+T** — show the shared task list (pi's built-in Ctrl+T toggles thinking blocks)
|
|
234
|
+
|
|
235
|
+
## Differences from Claude Code (honest)
|
|
236
|
+
|
|
237
|
+
- **Broadcast `to: "*"`** is not implemented. Swarm/persistent teammate pattern with mailboxes isn't needed for the one-shot worker model; each `send_message` resumes a teammate via `pi --session`, but injecting into an actively-running worker turn is not supported.
|
|
238
|
+
- **Tool restriction in coordinator mode** is prompt-only, not enforced. Claude Code's coordinator mode actually strips Bash/Edit/Write from the tool pool; pi's extension API doesn't expose tool removal from the main session. The coordinator prompt tells the LLM not to use those tools, but the LLM could still call them.
|
|
239
|
+
- **`TaskOutput` on a running worker** returns the teammate's last-saved record, not live stdout streaming. Completed workers return their final message faithfully.
|
|
240
|
+
|
|
241
|
+
## Tests
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
cd extensions/team-mode
|
|
245
|
+
npm test
|
|
246
|
+
```
|