pi-ca-leash 0.10.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/AGENTS.md +77 -0
- package/ARCHITECTURE.md +290 -0
- package/CHANGELOG.md +158 -0
- package/DEVELOPMENT.md +197 -0
- package/KNOWN_LIMITS.md +80 -0
- package/LICENSE +21 -0
- package/README.md +288 -0
- package/extensions/backend-tool-actions.test.ts +59 -0
- package/extensions/backend-tool-actions.ts +31 -0
- package/extensions/command-drivers.test.ts +37 -0
- package/extensions/command-drivers.ts +126 -0
- package/extensions/command-parity.test.ts +560 -0
- package/extensions/command-visibility.test.ts +21 -0
- package/extensions/command-visibility.ts +10 -0
- package/extensions/index.ts +3218 -0
- package/extensions/llm-tools.test.ts +537 -0
- package/extensions/model-catalog.test.ts +34 -0
- package/extensions/model-catalog.ts +173 -0
- package/extensions/peer-history.test.ts +141 -0
- package/extensions/peer-history.ts +90 -0
- package/extensions/peer-naming.test.ts +25 -0
- package/extensions/peer-naming.ts +129 -0
- package/extensions/peer-relay.test.ts +122 -0
- package/extensions/peer-relay.ts +83 -0
- package/extensions/peer-ux.test.ts +239 -0
- package/extensions/peer-ux.ts +327 -0
- package/extensions/persistence.test.ts +68 -0
- package/extensions/persistence.ts +67 -0
- package/extensions/prompts/extension-log-tool.md +5 -0
- package/extensions/prompts/peer-ask-tool.md +5 -0
- package/extensions/prompts/peer-bridge-system.md +4 -0
- package/extensions/prompts/peer-history-tool.md +3 -0
- package/extensions/prompts/peer-init-user-help.md +11 -0
- package/extensions/prompts/peer-init.md +17 -0
- package/extensions/prompts/peer-interrupt-tool.md +2 -0
- package/extensions/prompts/peer-list-tool.md +3 -0
- package/extensions/prompts/peer-no-babysitting.md +6 -0
- package/extensions/prompts/peer-send-tool.md +5 -0
- package/extensions/prompts/peer-start-tool.md +7 -0
- package/extensions/prompts/peer-stop-tool.md +3 -0
- package/extensions/prompts/runtime-models-tool.md +6 -0
- package/extensions/prompts/subagent-list-tool.md +3 -0
- package/extensions/prompts/subagent-run-tool.md +6 -0
- package/extensions/prompts/subagent-status-tool.md +2 -0
- package/extensions/prompts/team-list-tool.md +2 -0
- package/extensions/prompts/team-message-tool.md +2 -0
- package/extensions/prompts/team-spawn-tool.md +5 -0
- package/extensions/prompts/team-stop-tool.md +2 -0
- package/extensions/prompts/team-task-tool.md +3 -0
- package/extensions/prompts.ts +41 -0
- package/extensions/runtime-driver.test.ts +38 -0
- package/extensions/runtime-driver.ts +33 -0
- package/extensions/runtime-safety.test.ts +21 -0
- package/extensions/runtime-safety.ts +49 -0
- package/extensions/support.test.ts +144 -0
- package/extensions/support.ts +205 -0
- package/extensions/tool-inputs.test.ts +45 -0
- package/extensions/tool-inputs.ts +79 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/bridge.d.ts +48 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/bridge.js +406 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/bridge.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/cli.d.ts +2 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/cli.js +18 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/cli.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/index.d.ts +5 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/index.js +5 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/index.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/persistence.d.ts +12 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/persistence.js +31 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/persistence.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/pi-intercom-transport.d.ts +12 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/pi-intercom-transport.js +347 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/pi-intercom-transport.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/types.d.ts +103 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/types.js +2 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/dist/types.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/intercom-bridge/package.json +32 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/cli.d.ts +2 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/cli.js +26 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/cli.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/driver-config.d.ts +4 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/driver-config.js +12 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/driver-config.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/drivers/claude-sdk.d.ts +8 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/drivers/claude-sdk.js +320 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/drivers/claude-sdk.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/drivers/codex-cli.d.ts +24 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/drivers/codex-cli.js +266 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/drivers/codex-cli.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/drivers/messages.d.ts +72 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/drivers/messages.js +2 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/drivers/messages.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/index.d.ts +6 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/index.js +5 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/index.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/persistence.d.ts +16 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/persistence.js +94 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/persistence.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/runtime.d.ts +31 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/runtime.js +409 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/runtime.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/types.d.ts +185 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/types.js +2 -0
- package/node_modules/@pi-claude-code-agent/runtime/dist/types.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/runtime/package.json +32 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/dist/backend.d.ts +34 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/dist/backend.js +327 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/dist/backend.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/dist/cli.d.ts +2 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/dist/cli.js +17 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/dist/cli.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/dist/index.d.ts +4 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/dist/index.js +4 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/dist/index.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/dist/persistence.d.ts +12 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/dist/persistence.js +81 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/dist/persistence.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/dist/types.d.ts +72 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/dist/types.js +2 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/dist/types.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/subagents-backend/package.json +32 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/dist/backend.d.ts +27 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/dist/backend.js +194 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/dist/backend.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/dist/cli.d.ts +2 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/dist/cli.js +21 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/dist/cli.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/dist/index.d.ts +4 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/dist/index.js +4 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/dist/index.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/dist/persistence.d.ts +8 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/dist/persistence.js +66 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/dist/persistence.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/dist/types.d.ts +41 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/dist/types.js +2 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/dist/types.js.map +1 -0
- package/node_modules/@pi-claude-code-agent/teams-backend/package.json +33 -0
- package/package.json +98 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Agent guidance for working in `pi-ca-leash`.
|
|
4
|
+
|
|
5
|
+
## Mission
|
|
6
|
+
|
|
7
|
+
Keep this repo honest.
|
|
8
|
+
|
|
9
|
+
This project is a **runtime-first local MVP** for Claude Code integration with pi. Do not rewrite it into a fake stateless provider integration and do not pretend upstream product integrations exist when they do not.
|
|
10
|
+
|
|
11
|
+
## Current scope
|
|
12
|
+
|
|
13
|
+
In scope:
|
|
14
|
+
- `packages/runtime` — Claude Code runtime abstraction
|
|
15
|
+
- `packages/intercom-bridge` — named peer bridge and optional live intercom transport
|
|
16
|
+
- `packages/subagents-backend` — local subagent backend package
|
|
17
|
+
- `packages/teams-backend` — local persistent teammate backend package
|
|
18
|
+
- `extensions/index.ts` — pi extension wiring, dashboard, transport monitoring, attention UX
|
|
19
|
+
|
|
20
|
+
Out of scope unless explicitly requested and proven possible:
|
|
21
|
+
- fake `pi-teams` integration
|
|
22
|
+
- claims of real upstream `pi-subagents` integration
|
|
23
|
+
- fake Claude fork/session-tree semantics
|
|
24
|
+
- broad architecture rewrites without tests
|
|
25
|
+
|
|
26
|
+
## Non-negotiable truths
|
|
27
|
+
|
|
28
|
+
- Claude Code is treated here as a **long-lived runtime**, not a normal stateless model provider.
|
|
29
|
+
- `runner=claude-code-agent` does **not** support real `fork`.
|
|
30
|
+
- Teams backend is **local-only** in this repo.
|
|
31
|
+
- Intercom broker transport is optional; local runtime-backed peers still work without it.
|
|
32
|
+
- If something is environment-dependent, say so plainly.
|
|
33
|
+
|
|
34
|
+
## Working style
|
|
35
|
+
|
|
36
|
+
- Prefer small, maintainable changes.
|
|
37
|
+
- Add or update tests before behavior changes when practical.
|
|
38
|
+
- Keep docs synchronized with reality.
|
|
39
|
+
- Remove stale docs instead of letting multiple contradictory docs survive.
|
|
40
|
+
- Do not add dependencies for imaginary integrations.
|
|
41
|
+
|
|
42
|
+
## Good commands
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm test
|
|
46
|
+
npm run build
|
|
47
|
+
npm run smoke -- "Reply with exactly: smoke-ok"
|
|
48
|
+
npm run demo:intercom -- "You are demo worker. Reply briefly."
|
|
49
|
+
npm run demo:subagent -- "Reply with exactly: subagent-ok"
|
|
50
|
+
npm run demo:teams -- "You are persistent teammate. Reply briefly."
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Files worth reading first
|
|
54
|
+
|
|
55
|
+
- `README.md`
|
|
56
|
+
- `ARCHITECTURE.md`
|
|
57
|
+
- `KNOWN_LIMITS.md`
|
|
58
|
+
- `CHANGELOG.md`
|
|
59
|
+
|
|
60
|
+
## Documentation policy
|
|
61
|
+
|
|
62
|
+
Keep documentation in English.
|
|
63
|
+
|
|
64
|
+
If you change behavior, update whichever of these are affected:
|
|
65
|
+
- `README.md` — public repo entrypoint
|
|
66
|
+
- `ARCHITECTURE.md` — how pieces fit together
|
|
67
|
+
- `KNOWN_LIMITS.md` — honest constraints
|
|
68
|
+
- `CHANGELOG.md` — notable user-visible changes
|
|
69
|
+
|
|
70
|
+
## Shareability standard
|
|
71
|
+
|
|
72
|
+
Before claiming the repo is ready to share:
|
|
73
|
+
- `npm test` must pass
|
|
74
|
+
- `npm run build` must pass
|
|
75
|
+
- README must match reality
|
|
76
|
+
- known limits must still be true
|
|
77
|
+
- no stale plan/session docs should remain
|
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`pi-ca-leash` is built around one idea:
|
|
6
|
+
|
|
7
|
+
> Claude Code should be integrated as a **stateful runtime** first, then adapted into pi-style workflows.
|
|
8
|
+
|
|
9
|
+
That leads to a layered design.
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
Claude SDK driver (default) Codex CLI driver (experimental)
|
|
13
|
+
↓ ↓
|
|
14
|
+
packages/runtime
|
|
15
|
+
↓
|
|
16
|
+
packages/intercom-bridge
|
|
17
|
+
↓
|
|
18
|
+
packages/subagents-backend packages/teams-backend
|
|
19
|
+
↓ ↓
|
|
20
|
+
extensions/index.ts
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Layers
|
|
24
|
+
|
|
25
|
+
### 1. Runtime layer
|
|
26
|
+
|
|
27
|
+
Path:
|
|
28
|
+
- `packages/runtime`
|
|
29
|
+
|
|
30
|
+
Responsibility:
|
|
31
|
+
- start driver-backed sessions
|
|
32
|
+
- resume/send messages into existing sessions
|
|
33
|
+
- normalize runtime events
|
|
34
|
+
- persist session state and transcript
|
|
35
|
+
- expose status, listing, event streaming, interrupt, and stop
|
|
36
|
+
|
|
37
|
+
This package is the source of truth for runtime session lifecycle.
|
|
38
|
+
|
|
39
|
+
Current drivers:
|
|
40
|
+
- `claude-sdk` is the default and most complete path.
|
|
41
|
+
- `codex-cli` exists as an experimental runtime driver with a narrower supported option set.
|
|
42
|
+
|
|
43
|
+
Important consequence:
|
|
44
|
+
- higher layers should not reinvent runtime session persistence or control semantics
|
|
45
|
+
|
|
46
|
+
### 2. Intercom bridge layer
|
|
47
|
+
|
|
48
|
+
Path:
|
|
49
|
+
- `packages/intercom-bridge`
|
|
50
|
+
|
|
51
|
+
Responsibility:
|
|
52
|
+
- give runtime sessions stable peer names
|
|
53
|
+
- map `send` / `ask` / `reply` style messages into runtime sends
|
|
54
|
+
- wait for the next idle cycle to determine replies
|
|
55
|
+
- persist peer registry for restart restore
|
|
56
|
+
- optionally bind peers to live `pi-intercom` transport when broker is reachable
|
|
57
|
+
- preserve per-peer runtime driver identity
|
|
58
|
+
|
|
59
|
+
Important consequence:
|
|
60
|
+
- intercom transport is optional
|
|
61
|
+
- the bridge still works locally without live broker presence
|
|
62
|
+
- peers may now be runtime-backed by different drivers
|
|
63
|
+
- extension startup can choose the default peer driver via `PI_CLAUDE_RUNTIME_DRIVER`
|
|
64
|
+
- public peer examples stay driver-agnostic; experimental Codex selection is primarily via startup default or LLM-callable tools
|
|
65
|
+
|
|
66
|
+
### 3. Subagent backend layer
|
|
67
|
+
|
|
68
|
+
Path:
|
|
69
|
+
- `packages/subagents-backend`
|
|
70
|
+
|
|
71
|
+
Responsibility:
|
|
72
|
+
- run bounded delegated jobs through the Claude runtime
|
|
73
|
+
- persist run artifacts in subagent-style layout
|
|
74
|
+
- map runtime states into run states
|
|
75
|
+
- support sync/async runs
|
|
76
|
+
- emit attention events for stale background runs
|
|
77
|
+
|
|
78
|
+
Truth:
|
|
79
|
+
- this is local backend logic in this repo
|
|
80
|
+
- backend API can thread runtime driver selection into runs
|
|
81
|
+
- it is not proof of real upstream `pi-subagents` product integration
|
|
82
|
+
- `context: fork` is rejected explicitly
|
|
83
|
+
|
|
84
|
+
### 4. Teams backend layer
|
|
85
|
+
|
|
86
|
+
Path:
|
|
87
|
+
- `packages/teams-backend`
|
|
88
|
+
|
|
89
|
+
Responsibility:
|
|
90
|
+
- keep persistent Claude-backed teammates alive across multiple messages/tasks
|
|
91
|
+
- assign tasks
|
|
92
|
+
- exchange direct messages
|
|
93
|
+
- persist teammate/task state
|
|
94
|
+
- restore teammate records after restart
|
|
95
|
+
|
|
96
|
+
Truth:
|
|
97
|
+
- this is a local teams backend only
|
|
98
|
+
- backend API can thread runtime driver selection into teammate spawn
|
|
99
|
+
- no external `pi-teams` integration is assumed here
|
|
100
|
+
|
|
101
|
+
### 5. Extension layer
|
|
102
|
+
|
|
103
|
+
Path:
|
|
104
|
+
- `extensions/index.ts`
|
|
105
|
+
- `extensions/model-catalog.ts`
|
|
106
|
+
- `extensions/prompts/`
|
|
107
|
+
|
|
108
|
+
Responsibility:
|
|
109
|
+
- wire runtime + bridge + backends into a pi extension
|
|
110
|
+
- expose operator commands
|
|
111
|
+
- render peer-first widget/dashboard surfaces
|
|
112
|
+
- stay lazy until `/peer init`, another actionable `/peer` command, or an LLM-callable runtime tool activates the workflow
|
|
113
|
+
- keep retained backend diagnostics behind explicit advanced views
|
|
114
|
+
- monitor live broker transport connectivity
|
|
115
|
+
- surface attention notifications
|
|
116
|
+
- persist local attention ack/snooze state
|
|
117
|
+
- expose a bundled, advisory model catalog for runtime model selection
|
|
118
|
+
- keep editable prompt/guidance text out of the main extension implementation
|
|
119
|
+
|
|
120
|
+
The extension is where operator UX lives.
|
|
121
|
+
|
|
122
|
+
Activation model:
|
|
123
|
+
- extension load registers slash commands, tools, and renderers only
|
|
124
|
+
- `session_start` does not create the widget, start the background monitor, or run live intercom checks while inactive
|
|
125
|
+
- `/peer init` activates the workflow, adds the one-time orchestration guide to the main agent context, and shows compact user help as a user-only UI notification
|
|
126
|
+
- the first actionable `/peer` command also activates the workflow and adds the agent guide once
|
|
127
|
+
- `/peer help` stays passive and shows user-only UI help
|
|
128
|
+
- after activation, the background monitor handles broker connectivity, attention notifications, peer relays, and visible dashboard refreshes
|
|
129
|
+
|
|
130
|
+
Context boundary:
|
|
131
|
+
- command acknowledgments, dashboards, model lists, history pages, and diagnostics are operator-facing UI notifications
|
|
132
|
+
- the main agent context receives only intentional agent-facing prompts, such as the one-time orchestration guide, and automated peer relays
|
|
133
|
+
- peer relays are wrapped follow-up turns containing the latest visible peer message so the orchestrator can decide whether to inspect more history
|
|
134
|
+
|
|
135
|
+
Prompt files:
|
|
136
|
+
- `extensions/prompts/peer-init.md` is the one-time main-agent orchestration guide added when peer mode is first activated
|
|
137
|
+
- `extensions/prompts/peer-init-user-help.md` is the compact user-facing command cheat sheet shown as a user-only UI notification with peer-mode activation
|
|
138
|
+
- `extensions/prompts/peer-no-babysitting.md` is included in peer start acknowledgments
|
|
139
|
+
- `extensions/prompts/*-tool.md` files provide LLM-callable tool snippets/guidelines
|
|
140
|
+
- `extensions/prompts/peer-bridge-system.md` is appended to runtime-backed peer sessions
|
|
141
|
+
|
|
142
|
+
### Model catalog layer
|
|
143
|
+
|
|
144
|
+
Path:
|
|
145
|
+
- `extensions/model-catalog.ts`
|
|
146
|
+
|
|
147
|
+
Responsibility:
|
|
148
|
+
- map runtime drivers to model-provider catalogs
|
|
149
|
+
- expose known model ids, labels, context windows, token limits, modality flags, and rough per-million-token costs
|
|
150
|
+
- expose a small deterministic alias map for common shorthand names, resolved before launching a runtime call
|
|
151
|
+
- expose a short advisory recommendation list for common use cases such as architecture, coding, quick checks, and cheap worker tasks
|
|
152
|
+
- provide advisory model-selection notes for `/peer`, `runtime_models`, and LLM-callable runtime tools
|
|
153
|
+
|
|
154
|
+
Current mapping:
|
|
155
|
+
- `claude-sdk` uses the Lanista `anthropic` catalog and passes models to the Claude SDK / Claude Code runtime.
|
|
156
|
+
- `codex-cli` uses the Lanista `openai-codex` catalog and passes models as `codex -m` / `codex --model` compatible ids.
|
|
157
|
+
|
|
158
|
+
Important consequence:
|
|
159
|
+
- the catalog is not an entitlement authority
|
|
160
|
+
- recommendation use cases are local product guidance, not upstream provider guarantees
|
|
161
|
+
- aliases only normalize shorthand into exact ids from the bundled catalog; they do not guarantee local provider access
|
|
162
|
+
- unknown model ids are passed through to the runtime instead of being hard-rejected
|
|
163
|
+
- actual availability can still differ by installed CLI version, account, region, and provider rollout state
|
|
164
|
+
|
|
165
|
+
## Updating the Model Catalog with Lanista
|
|
166
|
+
|
|
167
|
+
The bundled catalog is a static snapshot so `pi-ca-leash` does not need `lanista` at runtime.
|
|
168
|
+
|
|
169
|
+
To refresh it from Lanista:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
cd /Users/mhild/src/durandom/b4arena/lanista
|
|
173
|
+
.venv/bin/lanista fetch
|
|
174
|
+
.venv/bin/lanista --json agents anthropic
|
|
175
|
+
.venv/bin/lanista --json agents codex
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Then copy the relevant provider records into `extensions/model-catalog.ts`:
|
|
179
|
+
- Lanista `anthropic` -> `RUNTIME_MODEL_CATALOGS["claude-sdk"]`
|
|
180
|
+
- Lanista `openai-codex` -> `RUNTIME_MODEL_CATALOGS["codex-cli"]`
|
|
181
|
+
|
|
182
|
+
Keep these fields when updating entries:
|
|
183
|
+
- model id
|
|
184
|
+
- display name
|
|
185
|
+
- context window
|
|
186
|
+
- max output tokens
|
|
187
|
+
- reasoning flag
|
|
188
|
+
- input modalities
|
|
189
|
+
- input and output cost per million tokens
|
|
190
|
+
|
|
191
|
+
After updating the snapshot:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
npm test
|
|
195
|
+
npm run build
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Do not add a runtime dependency from this repo to Lanista unless the extension needs live model refresh. The default should stay deterministic and offline-friendly.
|
|
199
|
+
|
|
200
|
+
## Runtime-first design rationale
|
|
201
|
+
|
|
202
|
+
Why this shape exists:
|
|
203
|
+
- Claude Code is session-based and tool-using
|
|
204
|
+
- it has lifecycle concerns that do not fit a pure model-provider abstraction well
|
|
205
|
+
- intercom/subagents/teams all need long-lived session identity and persistence
|
|
206
|
+
|
|
207
|
+
So this repo chooses:
|
|
208
|
+
- one runtime core
|
|
209
|
+
- multiple adapters on top
|
|
210
|
+
- minimal duplication across higher layers
|
|
211
|
+
|
|
212
|
+
## Persistence model
|
|
213
|
+
|
|
214
|
+
Repository-local state is written under:
|
|
215
|
+
|
|
216
|
+
```text
|
|
217
|
+
.pi-ca-leash/
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Typical layout:
|
|
221
|
+
|
|
222
|
+
```text
|
|
223
|
+
.pi-ca-leash/
|
|
224
|
+
runtime/ # runtime sessions and transcripts
|
|
225
|
+
bridge/ # bridge peer registry
|
|
226
|
+
subagents/ # subagent run artifacts
|
|
227
|
+
teams/ # teammate and task records
|
|
228
|
+
extension/ # extension-local state such as attention ledger
|
|
229
|
+
log.md # append-only local feedback log for extension smoothing
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Interaction model
|
|
233
|
+
|
|
234
|
+
### Named peer flow
|
|
235
|
+
|
|
236
|
+
```text
|
|
237
|
+
user command
|
|
238
|
+
→ extension
|
|
239
|
+
→ immediate acknowledgment in main window
|
|
240
|
+
→ intercom bridge
|
|
241
|
+
→ runtime session send
|
|
242
|
+
→ wait for idle cycle
|
|
243
|
+
→ reply extraction
|
|
244
|
+
→ peer-first dashboard/widget update
|
|
245
|
+
→ final command result
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Subagent flow
|
|
249
|
+
|
|
250
|
+
```text
|
|
251
|
+
user command
|
|
252
|
+
→ extension
|
|
253
|
+
→ subagents backend
|
|
254
|
+
→ runtime start/send
|
|
255
|
+
→ persisted run status/events/result
|
|
256
|
+
→ attention monitoring if stale
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Teammate flow
|
|
260
|
+
|
|
261
|
+
```text
|
|
262
|
+
user command
|
|
263
|
+
→ extension
|
|
264
|
+
→ teams backend
|
|
265
|
+
→ bridge-backed persistent peer
|
|
266
|
+
→ task/message exchange over time
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## What is intentionally not abstracted further
|
|
270
|
+
|
|
271
|
+
This repo currently avoids extra abstraction layers unless they solve a real problem.
|
|
272
|
+
|
|
273
|
+
Examples:
|
|
274
|
+
- no fake generic team product adapter
|
|
275
|
+
- no fake upstream `pi-teams` compatibility layer
|
|
276
|
+
- no pseudo-fork illusion for Claude sessions
|
|
277
|
+
|
|
278
|
+
## Testing strategy
|
|
279
|
+
|
|
280
|
+
Current coverage:
|
|
281
|
+
- package-level tests for runtime, intercom bridge, subagent backend, and teams backend
|
|
282
|
+
- extension helper/state tests in `extensions/*.test.ts`
|
|
283
|
+
|
|
284
|
+
Current gap:
|
|
285
|
+
- no full end-to-end extension-host smoke test inside a real pi host runtime
|
|
286
|
+
|
|
287
|
+
See also:
|
|
288
|
+
- `README.md`
|
|
289
|
+
- `KNOWN_LIMITS.md`
|
|
290
|
+
- `CHANGELOG.md`
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this repository should be recorded here.
|
|
4
|
+
|
|
5
|
+
## 0.10.0 - 2026-05-03
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Root package is now publishable as a single npm package that bundles the internal runtime, bridge, subagents, and teams workspaces while keeping their build output inside the shipped tarball.
|
|
9
|
+
- Root install/build hooks now use `prepare` plus `prepack` instead of consumer-side `postinstall` rebuilds.
|
|
10
|
+
- README and package metadata now describe the package as a harness-aware Claude Code and Codex CLI extension, while still calling out Codex support as experimental.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- `peer_interrupt` now reports whether an interrupt signal was delivered, the runtime reason, resulting peer state, and whether follow-up input can be sent immediately.
|
|
14
|
+
- Peer list/dashboard waiting state now only flags explicit unresolved asks, avoiding false `waiting / needs input` rows for normal completion reports.
|
|
15
|
+
- Newly started peers now relay their first real `waiting`, `idle`, or `error` transition into the main context instead of suppressing the initial `needs input` signal.
|
|
16
|
+
|
|
17
|
+
## 0.9.0 - 2026-05-03
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- The compact peer-mode user help now uses a persistent user-only notification instead of the lower widget area, avoiding widget truncation without adding help text to the main agent context.
|
|
21
|
+
|
|
22
|
+
## 0.8.0 - 2026-05-03
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- Peer slash-command guidance, reports, dashboards, model lists, and history pages now use user-only UI notifications instead of custom chat messages, keeping them out of the main agent context.
|
|
26
|
+
- Agent-facing peer messages remain explicit: the one-time orchestration guide is added to the main agent context, and peer completion/block/failure relays still arrive as wrapped follow-up turns with the latest visible peer message.
|
|
27
|
+
|
|
28
|
+
## 0.7.0 - 2026-05-03
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
- `/peer init` now carries the one-time main-agent orchestration guide plus a compact user-facing command cheat sheet, while repeated peer tool prompts stay narrowly tool-specific.
|
|
32
|
+
- Runtime model selection now resolves common shorthand aliases such as `sonnet`, `opus`, `haiku`, `mini`, and `spark` to concrete catalog model ids before launching peers, subagents, or teammates.
|
|
33
|
+
- `/peer models` and `runtime_models` now show a shorter recommended model list by default, with advisory use cases and clearer `context window` / `max output` column labels; pass `all`, `advanced`, `verbose`, or `verbose: true` for the full catalog.
|
|
34
|
+
- Added `extension_log`, an LLM-callable local feedback tool that appends structured extension UX and interaction roughness notes to `.pi-ca-leash/log.md`.
|
|
35
|
+
- Peer/subagent/team launch surfaces now include prompt-size warnings for large delegated prompts, nudging agents toward smaller slices and file-based context.
|
|
36
|
+
- `runtime_models` reports bundled model aliases alongside exact model ids.
|
|
37
|
+
- Compact Peers widget rendering now uses a small adaptive table layout helper, including a wide-mode driver column and narrow-mode fallback.
|
|
38
|
+
- `/peer help` now includes versioned concept guidance, and `/peer about` reports installed version and runtime environment details without activating peer mode.
|
|
39
|
+
- Subagent and team LLM-callable tools are now hidden by default and only registered when `PI_CLAUDE_ENABLE_ADVANCED_COMMANDS=1`.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
- Runtime driver errors now add actionable hints for missing Claude Code/Codex executables, Bedrock credential routing, missing API keys, and prompt/context-length failures.
|
|
43
|
+
- Extension version reporting now reads the package version instead of a hardcoded constant.
|
|
44
|
+
|
|
45
|
+
## 0.3.0 - 2026-05-03
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
- Added `DEVELOPMENT.md` and linked it from `README.md` as the dedicated developer workflow and smoke-debugging guide.
|
|
49
|
+
- Added developer-oriented smoke helpers: `npm run smoke:dev`, `smoke:dev:codex`, `smoke:manual`, `smoke:manual:codex`, `smoke:last`, and `smoke:clean`.
|
|
50
|
+
- Added `npm run smoke:pi:auto` and `npm run smoke:pi:auto:codex` helpers that start pi against this checkout in JSON mode with an isolated runtime-only prompt, then write Markdown and raw event/stderr smoke artifacts under `.pi-ca-leash/smoke/auto/`.
|
|
51
|
+
- Added `npm run smoke:pi` and `npm run smoke:pi:codex` helpers that start pi against this checkout with `--no-extensions -e <repo-root>` for isolated pre-release hands-on smoke testing.
|
|
52
|
+
- Automated pi smoke runs now stop the `pi --no-session` child after an explicit `SMOKE_OK`/`SMOKE_FAIL` final marker instead of waiting for the idle CLI process to exit by itself.
|
|
53
|
+
- Extension startup is now lazy: loading registers commands/tools only, while `/peer init` or the first actionable `/peer` command starts the widget/background workflow and shows the operator guide.
|
|
54
|
+
- Moved core extension prompt/guidance text into editable files under `extensions/prompts/`.
|
|
55
|
+
- Added a bundled Lanista-derived runtime model catalog for `claude-sdk` and `codex-cli`, exposed through `runtime_models` and `/peer models`.
|
|
56
|
+
- `/peer start` can now include explicit driver and model fields in pipe syntax.
|
|
57
|
+
- Runtime tool guidance now points agents to `runtime_models` before choosing non-default model ids.
|
|
58
|
+
- Polished README setup, persistence, and runtime-driver wording around the current local MVP.
|
|
59
|
+
- Polished the compact Peers widget with peer counts, column labels, priority ordering, clearer context usage, and explicit local-mode broker warning text.
|
|
60
|
+
- Aligned workspace package versions with the root `0.3.0` package version.
|
|
61
|
+
- Reworked README into the single practical entrypoint, with the useful manual smoke and peer no-polling guidance folded in.
|
|
62
|
+
|
|
63
|
+
### Fixed
|
|
64
|
+
- `subagent_status` now accepts the same short run id prefixes shown by `subagent_run` and `subagent_list`, while still rejecting unknown or ambiguous prefixes.
|
|
65
|
+
- `--no-session` smoke runs no longer start dashboard/background peer polling or emit stale peer follow-up turns after cleanup.
|
|
66
|
+
|
|
67
|
+
### Removed
|
|
68
|
+
- Removed the redundant direct runtime dependency on `@anthropic-ai/sdk`; the runtime imports `@anthropic-ai/claude-agent-sdk`, and the root override remains as a guard for SDK resolution through that dependency tree.
|
|
69
|
+
- Removed unused internal TypeScript declarations found by `noUnusedLocals` / `noUnusedParameters` checks.
|
|
70
|
+
- Removed leftover standalone manual/stress-test Markdown files from the public repo root.
|
|
71
|
+
|
|
72
|
+
## 0.2.0 - 2026-05-03
|
|
73
|
+
|
|
74
|
+
### Changed
|
|
75
|
+
- Public slash-command UX now centers on `/peer` (`dashboard`, `start`, `ask`, `send`, `list`, `history`, `interrupt`, `stop`).
|
|
76
|
+
- Old `/claude-*` slash commands are hidden by default and only restored with `PI_CA_LEASH_ENABLE_LEGACY_COMMANDS=1`; old internal diagnostics additionally require `PI_CLAUDE_ENABLE_ADVANCED_COMMANDS=1`.
|
|
77
|
+
- Command result renderer, widget key/title, hints, and peer guidance now use `peer`/`pi-ca-leash` branding instead of `cca` or old extension labels.
|
|
78
|
+
- README install instructions now pin the public release as `git:github.com/durandom/pi-ca-leash@v0.2.0`.
|
|
79
|
+
- Pi host peer dependencies are marked optional so clean git installs do not download pi core packages unnecessarily.
|
|
80
|
+
- Root package overrides now guard `@anthropic-ai/sdk` resolution through the current Claude agent SDK dependency tree.
|
|
81
|
+
|
|
82
|
+
### Removed
|
|
83
|
+
- Scratch/planning markdown files that should not ship in the public package.
|
|
84
|
+
|
|
85
|
+
## 0.1.1 - 2026-05-03
|
|
86
|
+
|
|
87
|
+
### Fixed
|
|
88
|
+
- Git pi package installs now build workspace packages during install so extension imports can resolve package `dist/index.js` files.
|
|
89
|
+
- README install instructions now use the renamed `durandom/pi-ca-leash` repository URL.
|
|
90
|
+
|
|
91
|
+
## 0.1.0 - 2026-05-03
|
|
92
|
+
|
|
93
|
+
### Changed
|
|
94
|
+
- Renamed the pi package/extension surface to `pi-ca-leash` while keeping the internal runtime package names and honest `claude-code-agent` runner identity unchanged.
|
|
95
|
+
- Runtime now includes an optional experimental `codex-cli` driver, bridge peers now persist selected runtime driver identity, extension startup can select the default driver for new peers via `PI_CLAUDE_RUNTIME_DRIVER`, LLM-callable `peer_start` can override the driver per peer, subagent/team backend APIs can thread runtime driver selection, the runtime/subagent/team demo CLIs now honor `PI_CLAUDE_RUNTIME_DRIVER` for Codex-backed smoke checks, and the extension now exposes LLM-callable subagent/team tools.
|
|
96
|
+
- Extension default UX is now peer-first.
|
|
97
|
+
- Primary footer status line was removed from the main UX.
|
|
98
|
+
- Compact widget now shows one live row per peer with short activity summaries derived from runtime events.
|
|
99
|
+
- `/claude-dashboard` now defaults to a peer-first view, with retained backend diagnostics moved to `/claude-dashboard advanced`.
|
|
100
|
+
- `/claude-peer-start` and `/claude-peer-ask` now emit immediate acknowledgment messages before final completion.
|
|
101
|
+
- LLM-callable `peer_start` now returns and displays no-babysitting guidance, and `peer_ask` now returns and displays the outgoing prompt sent to the peer.
|
|
102
|
+
- Runtime Peers widget rows now include each peer's last update time.
|
|
103
|
+
- Claude SDK result usage now preserves last-known context-window metrics, and peer rows show `ctx <percent>%` when available.
|
|
104
|
+
- LLM-callable `peer_ask` now shows the outgoing prompt once as direct `[cca] Sent to peer` user feedback while keeping the tool result compact.
|
|
105
|
+
- Stopped peers are hidden from the compact Runtime Peers widget but remain visible in `/claude-dashboard`.
|
|
106
|
+
- Codex usage parsing now preserves cached/reasoning token counts internally, but compact peer rows only show `ctx <percent>%` when a trustworthy context-window percentage is available.
|
|
107
|
+
- Added fire-and-forget peer messaging via `peer_send` and `/claude-peer-send`, plus graceful peer interruption via `peer_interrupt` and `/claude-peer-interrupt`.
|
|
108
|
+
- `peer_ask` timeouts after successful delivery now return `delivered_and_running` instead of reporting a confusing delivery failure.
|
|
109
|
+
- `/claude-peer-start <prompt>` now auto-generates a short peer name, while `/claude-peer-start <name> | <prompt>` remains available as an explicit override.
|
|
110
|
+
- Internal slash commands (`/claude-dev-ping`, `/claude-runtime-list`, `/claude-subagent-*`, `/claude-attention-*`, `/claude-team-*`) are now hidden from the default UX and only reappear when pi starts with `PI_CLAUDE_ENABLE_ADVANCED_COMMANDS=1`.
|
|
111
|
+
- Peer completions now inject one wrapped follow-up turn into the main agent by default, carrying the peer's latest message when the peer finishes, needs input, or errors.
|
|
112
|
+
- Peer tool output and wrapped peer relays now fence latest visible peer messages as raw text blocks for cleaner multiline boundaries and safer relay inspection.
|
|
113
|
+
- LLM-callable peer tools now support explicit start-time `model` and `cwd`, and `peer_ask` can persistently switch the peer model for later turns.
|
|
114
|
+
- Main-agent peer transcript scrolling is now available through `peer_history(name, cursor?, limit?)`, including cursor-based paging through visible peer messages and tool activity.
|
|
115
|
+
- `peer_stop` can now bulk-stop all retained peers when explicitly confirmed with `all=true` and `confirmAll=true`.
|
|
116
|
+
- `peer_history` paging now counts visible history entries instead of raw transcript events, which makes scrolling behave more like a human reading backscroll.
|
|
117
|
+
- Runtime now preserves an explicitly requested model switch across resumed-session init events that report a stale prior model.
|
|
118
|
+
- Primary peer operations are now also exposed as LLM-callable tools: `peer_start`, `peer_list`, `peer_history`, `peer_ask`, and `peer_stop`.
|
|
119
|
+
- README, architecture notes, and known limits were updated to match peer-first MVP behavior.
|
|
120
|
+
|
|
121
|
+
### Notes
|
|
122
|
+
- Codex support is still partial: extension startup can choose a default peer driver, per-peer driver override exists on the LLM-callable `peer_start` tool, slash-command peer UX still has no per-peer driver selection, subagent/team driver threading is available through backend APIs and LLM-callable tools but not through slash-command/visual UX, and these surfaces are not being described as Codex-parity products.
|
|
123
|
+
- Historical session-plan docs were removed in favor of a single current documentation set.
|
|
124
|
+
|
|
125
|
+
## 2026-04-29
|
|
126
|
+
|
|
127
|
+
### Added
|
|
128
|
+
- Persisted intercom peer registry with restart restore.
|
|
129
|
+
- Optional live `pi-intercom` transport adapter.
|
|
130
|
+
- Late transport binding and retry logic for broker availability.
|
|
131
|
+
- Subagent backend rehydration from persisted runtime state.
|
|
132
|
+
- Attention events for stale background runs.
|
|
133
|
+
- Dashboard surfacing for intercom state and attention state.
|
|
134
|
+
- Intercom disconnect/reconnect notices in the extension.
|
|
135
|
+
- Attention list / ack / snooze extension commands.
|
|
136
|
+
- Persisted local attention ledger for ack/snooze state.
|
|
137
|
+
- Extension helper/state tests.
|
|
138
|
+
- Extension persistence tests.
|
|
139
|
+
|
|
140
|
+
### Changed
|
|
141
|
+
- Teams backend scope is now documented and enforced as **local-only**.
|
|
142
|
+
- README was rewritten around current reality instead of session-plan history.
|
|
143
|
+
- Package metadata was cleaned up to stop implying `pi-teams` integration.
|
|
144
|
+
|
|
145
|
+
### Removed
|
|
146
|
+
- Historical `docs/IMPLEMENTATION_PLAN.md`.
|
|
147
|
+
- Historical `docs/sessions/*` handoff/session documents.
|
|
148
|
+
- Remaining `pi-teams` roadmap narrative.
|
|
149
|
+
|
|
150
|
+
## 2026-04-25
|
|
151
|
+
|
|
152
|
+
### Added
|
|
153
|
+
- Initial monorepo structure.
|
|
154
|
+
- Claude runtime package.
|
|
155
|
+
- Intercom bridge package.
|
|
156
|
+
- Subagents backend package.
|
|
157
|
+
- Teams backend package.
|
|
158
|
+
- Initial tests and demo/smoke scripts.
|