@caupulican/pi-adaptative 0.93.18 → 0.94.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 +31 -0
- package/README.md +3 -2
- package/dist/core/agent-session.d.ts +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +22 -12
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction-controller.d.ts +21 -0
- package/dist/core/compaction-controller.d.ts.map +1 -1
- package/dist/core/compaction-controller.js +149 -26
- package/dist/core/compaction-controller.js.map +1 -1
- package/dist/core/delegation/worker-agent-control-coordinator.d.ts.map +1 -1
- package/dist/core/delegation/worker-agent-control-coordinator.js +1 -0
- package/dist/core/delegation/worker-agent-control-coordinator.js.map +1 -1
- package/dist/core/delegation/worker-agent-control.d.ts +2 -0
- package/dist/core/delegation/worker-agent-control.d.ts.map +1 -1
- package/dist/core/delegation/worker-agent-control.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +0 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +0 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/types.d.ts +0 -4
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/foreground-lifecycle-adapter.d.ts +27 -0
- package/dist/core/foreground-lifecycle-adapter.d.ts.map +1 -0
- package/dist/core/foreground-lifecycle-adapter.js +61 -0
- package/dist/core/foreground-lifecycle-adapter.js.map +1 -0
- package/dist/core/foreground-lifecycle-controller.d.ts +48 -0
- package/dist/core/foreground-lifecycle-controller.d.ts.map +1 -0
- package/dist/core/foreground-lifecycle-controller.js +404 -0
- package/dist/core/foreground-lifecycle-controller.js.map +1 -0
- package/dist/core/foreground-recovery-controller.d.ts +3 -0
- package/dist/core/foreground-recovery-controller.d.ts.map +1 -1
- package/dist/core/foreground-recovery-controller.js +15 -1
- package/dist/core/foreground-recovery-controller.js.map +1 -1
- package/dist/core/goals/goal-state.d.ts.map +1 -1
- package/dist/core/goals/goal-state.js +9 -2
- package/dist/core/goals/goal-state.js.map +1 -1
- package/dist/core/keybindings.d.ts +2 -2
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +2 -2
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/memory/memory-manager.d.ts +22 -0
- package/dist/core/memory/memory-manager.d.ts.map +1 -1
- package/dist/core/memory/memory-manager.js +108 -49
- package/dist/core/memory/memory-manager.js.map +1 -1
- package/dist/core/model-router/session-buffer.d.ts +10 -2
- package/dist/core/model-router/session-buffer.d.ts.map +1 -1
- package/dist/core/model-router/session-buffer.js +35 -9
- package/dist/core/model-router/session-buffer.js.map +1 -1
- package/dist/core/model-router-controller.d.ts +20 -2
- package/dist/core/model-router-controller.d.ts.map +1 -1
- package/dist/core/model-router-controller.js +70 -17
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/provider-request-runtime-controller.d.ts +12 -1
- package/dist/core/provider-request-runtime-controller.d.ts.map +1 -1
- package/dist/core/provider-request-runtime-controller.js +45 -2
- package/dist/core/provider-request-runtime-controller.js.map +1 -1
- package/dist/core/tools/artifact-retrieve.d.ts.map +1 -1
- package/dist/core/tools/artifact-retrieve.js +0 -1
- package/dist/core/tools/artifact-retrieve.js.map +1 -1
- package/dist/core/tools/delegate.d.ts.map +1 -1
- package/dist/core/tools/delegate.js +4 -2
- package/dist/core/tools/delegate.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +0 -7
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +0 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +0 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +0 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/skill-audit.d.ts.map +1 -1
- package/dist/core/tools/skill-audit.js +0 -1
- package/dist/core/tools/skill-audit.js.map +1 -1
- package/dist/core/tools/skill.d.ts.map +1 -1
- package/dist/core/tools/skill.js +0 -1
- package/dist/core/tools/skill.js.map +1 -1
- package/dist/core/tools/skillify.d.ts.map +1 -1
- package/dist/core/tools/skillify.js +0 -1
- package/dist/core/tools/skillify.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +1 -2
- package/dist/core/tools/write.js.map +1 -1
- package/dist/modes/interactive/components/action-transcript.d.ts +24 -0
- package/dist/modes/interactive/components/action-transcript.d.ts.map +1 -0
- package/dist/modes/interactive/components/action-transcript.js +72 -0
- package/dist/modes/interactive/components/action-transcript.js.map +1 -0
- package/dist/modes/interactive/components/active-tool-call-registry.d.ts +12 -0
- package/dist/modes/interactive/components/active-tool-call-registry.d.ts.map +1 -0
- package/dist/modes/interactive/components/active-tool-call-registry.js +25 -0
- package/dist/modes/interactive/components/active-tool-call-registry.js.map +1 -0
- package/dist/modes/interactive/components/activity-lane.d.ts +1 -1
- package/dist/modes/interactive/components/activity-lane.d.ts.map +1 -1
- package/dist/modes/interactive/components/activity-lane.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +3 -3
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +16 -20
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +0 -2
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +0 -2
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +0 -7
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +2 -76
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/transcript-overlay.d.ts +15 -0
- package/dist/modes/interactive/components/transcript-overlay.d.ts.map +1 -0
- package/dist/modes/interactive/components/transcript-overlay.js +38 -0
- package/dist/modes/interactive/components/transcript-overlay.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +7 -4
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-event-controller.d.ts +3 -4
- package/dist/modes/interactive/interactive-event-controller.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-event-controller.js +11 -10
- package/dist/modes/interactive/interactive-event-controller.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +15 -13
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +105 -184
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/runtime-status-controller.d.ts +40 -0
- package/dist/modes/interactive/runtime-status-controller.d.ts.map +1 -0
- package/dist/modes/interactive/runtime-status-controller.js +147 -0
- package/dist/modes/interactive/runtime-status-controller.js.map +1 -0
- package/dist/modes/interactive/runtime-status.d.ts +15 -0
- package/dist/modes/interactive/runtime-status.d.ts.map +1 -0
- package/dist/modes/interactive/runtime-status.js +18 -0
- package/dist/modes/interactive/runtime-status.js.map +1 -0
- package/dist/modes/interactive/settings-selector-flow.d.ts.map +1 -1
- package/dist/modes/interactive/settings-selector-flow.js +3 -4
- package/dist/modes/interactive/settings-selector-flow.js.map +1 -1
- package/docs/UI_POLISH_ORCHESTRATION.md +4 -4
- package/docs/extensions.md +4 -12
- package/docs/json.md +1 -1
- package/docs/keybindings.md +3 -2
- package/docs/session-format.md +59 -4
- package/docs/settings.md +1 -1
- package/docs/task-steps.md +3 -3
- package/docs/tool-repair.md +1 -1
- package/docs/usage.md +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
- package/dist/modes/interactive/components/tool-group.d.ts +0 -25
- package/dist/modes/interactive/components/tool-group.d.ts.map +0 -1
- package/dist/modes/interactive/components/tool-group.js +0 -175
- package/dist/modes/interactive/components/tool-group.js.map +0 -1
- package/dist/modes/interactive/components/tool-panel-registry.d.ts +0 -30
- package/dist/modes/interactive/components/tool-panel-registry.d.ts.map +0 -1
- package/dist/modes/interactive/components/tool-panel-registry.js +0 -145
- package/dist/modes/interactive/components/tool-panel-registry.js.map +0 -1
package/docs/session-format.md
CHANGED
|
@@ -23,13 +23,14 @@ Sessions have a version field in the header:
|
|
|
23
23
|
- **Version 1**: Linear entry sequence (legacy, auto-migrated on load)
|
|
24
24
|
- **Version 2**: Tree structure with `id`/`parentId` linking
|
|
25
25
|
- **Version 3**: Renamed `hookMessage` role to `custom` (extensions unification)
|
|
26
|
+
- **Version 4**: Added bounded provider-request, foreground-tool, and compaction lifecycle records for crash recovery
|
|
26
27
|
|
|
27
|
-
Existing sessions are automatically migrated to the current version (
|
|
28
|
+
Existing sessions are automatically migrated to the current version (v4) when loaded.
|
|
28
29
|
|
|
29
30
|
## Source Files
|
|
30
31
|
|
|
31
32
|
Source on GitHub ([pi-mono](https://github.com/earendil-works/pi-mono)):
|
|
32
|
-
- [`packages/
|
|
33
|
+
- [`packages/agent/src/session/session-manager.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/agent/src/session/session-manager.ts) - Session entry types and SessionManager
|
|
33
34
|
- [`packages/coding-agent/src/core/messages.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/messages.ts) - Extended message types (BashExecutionMessage, CustomMessage, etc.)
|
|
34
35
|
- [`packages/ai/src/types.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/types.ts) - Base message types (UserMessage, AssistantMessage, ToolResultMessage)
|
|
35
36
|
- [`packages/agent/src/types.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/agent/src/types.ts) - AgentMessage union type
|
|
@@ -188,13 +189,13 @@ interface SessionEntryBase {
|
|
|
188
189
|
First line of the file. Metadata only, not part of the tree (no `id`/`parentId`).
|
|
189
190
|
|
|
190
191
|
```json
|
|
191
|
-
{"type":"session","version":
|
|
192
|
+
{"type":"session","version":4,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project"}
|
|
192
193
|
```
|
|
193
194
|
|
|
194
195
|
For sessions with a parent (created via `/fork`, `/clone`, or `newSession({ parentSession })`):
|
|
195
196
|
|
|
196
197
|
```json
|
|
197
|
-
{"type":"session","version":
|
|
198
|
+
{"type":"session","version":4,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project","parentSession":"/path/to/original/session.jsonl"}
|
|
198
199
|
```
|
|
199
200
|
|
|
200
201
|
### SessionMessageEntry
|
|
@@ -290,6 +291,37 @@ Session metadata (e.g., user-defined display name). Set via `/name`, `--name` /
|
|
|
290
291
|
|
|
291
292
|
The session name is displayed in the session selector (`/resume`) instead of the first message when set.
|
|
292
293
|
|
|
294
|
+
### Lifecycle Entries (v4)
|
|
295
|
+
|
|
296
|
+
Lifecycle entries make interrupted foreground work recoverable without duplicating provider-visible data. They participate in tree ancestry but are excluded from model context and hidden from ordinary `/tree` views.
|
|
297
|
+
|
|
298
|
+
`RequestSnapshotEntry` is force-flushed before provider transport. It contains only the accepted model identity, bounded SHA-256 fingerprints, and bounded message-entry IDs; it never stores prompt text, tool arguments, results, credentials, or headers.
|
|
299
|
+
|
|
300
|
+
```json
|
|
301
|
+
{"type":"request_snapshot","id":"r1","parentId":"u1","timestamp":"2026-08-21T12:00:00.000Z","requestId":"0198...","reason":"initial","api":"anthropic-messages","provider":"amazon-bedrock","modelId":"global.anthropic.claude-haiku-4-5-20251001-v1:0","effectiveConfigFingerprint":"...","systemFingerprint":"...","toolsFingerprint":"...","historyFingerprint":"...","messageEntryIds":["u1"]}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
`ForegroundToolStartEntry` is written after validation/policy checks and before a prepared tool body starts. Parallel waves are appended in one bounded batch.
|
|
305
|
+
|
|
306
|
+
```json
|
|
307
|
+
{"type":"foreground_tool_start","id":"t1","parentId":"a1","timestamp":"2026-08-21T12:00:01.000Z","requestId":"0198...","assistantMessageEntryId":"a1","callId":"toolu_123","toolName":"bash"}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
`ForegroundToolTerminalEntry` is written only after the canonical `toolResult` message. Its composite identity is `(requestId, assistantMessageEntryId, callId)`.
|
|
311
|
+
|
|
312
|
+
```json
|
|
313
|
+
{"type":"foreground_tool_terminal","id":"t2","parentId":"result1","timestamp":"2026-08-21T12:00:02.000Z","requestId":"0198...","assistantMessageEntryId":"a1","callId":"toolu_123","toolName":"bash","outcome":"success","resultMessageEntryId":"result1"}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
`CompactionStartEntry` and `CompactionEndEntry` bracket one complete compaction retry ladder. A successful end references the canonical `compaction` entry; interrupted runs are closed as `interrupted` during reopen repair.
|
|
317
|
+
|
|
318
|
+
```json
|
|
319
|
+
{"type":"compaction_start","id":"c1","parentId":"m1","timestamp":"2026-08-21T12:01:00.000Z","compactionId":"...","firstKeptEntryId":"m1","tokensBefore":50000}
|
|
320
|
+
{"type":"compaction_end","id":"c3","parentId":"c2","timestamp":"2026-08-21T12:01:03.000Z","compactionId":"...","outcome":"success","compactionEntryId":"c2"}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
On reopen, deterministic repair distinguishes calls that were never started from started calls whose outcome is unknown. Duplicate, contradictory, ambiguous, or out-of-order records are refused and surfaced for manual review rather than guessed.
|
|
324
|
+
|
|
293
325
|
## Tree Structure
|
|
294
326
|
|
|
295
327
|
Entries form a tree:
|
|
@@ -315,6 +347,7 @@ Entries form a tree:
|
|
|
315
347
|
- Then messages from `firstKeptEntryId` to compaction
|
|
316
348
|
- Then messages after compaction
|
|
317
349
|
4. Converts `BranchSummaryEntry` and `CustomMessageEntry` to appropriate message formats
|
|
350
|
+
5. Ignores lifecycle-only entries while preserving their ancestry for recovery
|
|
318
351
|
|
|
319
352
|
## Parsing Example
|
|
320
353
|
|
|
@@ -354,6 +387,21 @@ for (const line of lines) {
|
|
|
354
387
|
case "thinking_level_change":
|
|
355
388
|
console.log(`[${entry.id}] Thinking: ${entry.thinkingLevel}`);
|
|
356
389
|
break;
|
|
390
|
+
case "request_snapshot":
|
|
391
|
+
console.log(`[${entry.id}] Request ${entry.requestId}: ${entry.provider}/${entry.modelId}`);
|
|
392
|
+
break;
|
|
393
|
+
case "foreground_tool_start":
|
|
394
|
+
console.log(`[${entry.id}] Tool started: ${entry.toolName}/${entry.callId}`);
|
|
395
|
+
break;
|
|
396
|
+
case "foreground_tool_terminal":
|
|
397
|
+
console.log(`[${entry.id}] Tool ${entry.outcome}: ${entry.toolName}/${entry.callId}`);
|
|
398
|
+
break;
|
|
399
|
+
case "compaction_start":
|
|
400
|
+
console.log(`[${entry.id}] Compaction started: ${entry.compactionId}`);
|
|
401
|
+
break;
|
|
402
|
+
case "compaction_end":
|
|
403
|
+
console.log(`[${entry.id}] Compaction ${entry.outcome}: ${entry.compactionId}`);
|
|
404
|
+
break;
|
|
357
405
|
}
|
|
358
406
|
}
|
|
359
407
|
```
|
|
@@ -380,6 +428,7 @@ Key methods for working with sessions programmatically.
|
|
|
380
428
|
|
|
381
429
|
### Instance Methods - Appending (all return entry ID)
|
|
382
430
|
- `appendMessage(message)` - Add message
|
|
431
|
+
- `appendMessageBatch(entries)` - Atomically append a bounded source-order message/custom-message batch
|
|
383
432
|
- `appendThinkingLevelChange(level)` - Record thinking change
|
|
384
433
|
- `appendModelChange(provider, modelId)` - Record model change
|
|
385
434
|
- `appendCompaction(summary, firstKeptEntryId, tokensBefore, details?, fromHook?)` - Add compaction
|
|
@@ -387,6 +436,10 @@ Key methods for working with sessions programmatically.
|
|
|
387
436
|
- `appendSessionInfo(name)` - Set session display name
|
|
388
437
|
- `appendCustomMessageEntry(customType, content, display, details?)` - Extension message (in context)
|
|
389
438
|
- `appendLabelChange(targetId, label)` - Set/clear label
|
|
439
|
+
- `appendRequestSnapshot(snapshot)` - Force-flush a bounded accepted-request record
|
|
440
|
+
- `appendForegroundToolStarts(starts)` - Atomically reserve one prepared tool wave
|
|
441
|
+
- `appendForegroundToolTerminal(...)` - Link a started call to its canonical result
|
|
442
|
+
- `appendCompactionStart(...)` / `appendCompactionEnd(...)` - Bracket a compaction retry ladder
|
|
390
443
|
|
|
391
444
|
### Instance Methods - Tree Navigation
|
|
392
445
|
- `getLeafId()` - Current position
|
|
@@ -402,6 +455,8 @@ Key methods for working with sessions programmatically.
|
|
|
402
455
|
|
|
403
456
|
### Instance Methods - Context & Info
|
|
404
457
|
- `buildSessionContext()` - Get messages, thinkingLevel, and model for LLM
|
|
458
|
+
- `inspectSessionLifecycle()` - Validate the active branch lifecycle and classify incomplete work
|
|
459
|
+
- `planSessionLifecycleRepair()` - Produce a deterministic repair plan or a refusal with reasons
|
|
405
460
|
- `getEntries()` - All entries (excluding header)
|
|
406
461
|
- `getHeader()` - Session header metadata
|
|
407
462
|
- `getSessionName()` - Get display name from latest session_info entry
|
package/docs/settings.md
CHANGED
|
@@ -20,7 +20,7 @@ Edit directly or use `/settings` for common options.
|
|
|
20
20
|
| `defaultProvider` | string | - | Default provider (e.g., `"anthropic"`, `"openai"`) |
|
|
21
21
|
| `defaultModel` | string | - | Default model ID |
|
|
22
22
|
| `defaultThinkingLevel` | string | model default | `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`, `"max"`, or `"ultra"` |
|
|
23
|
-
| `hideThinkingBlock` | boolean | `true` | Hide thinking blocks in output. Press the thinking toggle (default
|
|
23
|
+
| `hideThinkingBlock` | boolean | `true` | Hide thinking blocks in output. Press the thinking toggle (default Shift+PageUp) to show them. |
|
|
24
24
|
| `thinkingBudgets` | object | - | Custom token budgets per thinking level |
|
|
25
25
|
|
|
26
26
|
#### thinkingBudgets
|
package/docs/task-steps.md
CHANGED
|
@@ -86,11 +86,11 @@ Native worker lanes emit terminal handoff notifications and retain bounded resul
|
|
|
86
86
|
|
|
87
87
|
## Native orchestration UI
|
|
88
88
|
|
|
89
|
-
Interactive
|
|
89
|
+
Interactive history uses the same action transcript as every other model tool: task, goal, delegation, skill, file, shell, and extension calls contribute once to the adjacent `Performing N actions` / `Performed N actions` row. Tool-specific cards never compete in collapsed history. Ctrl+T opens the transcript with bounded notes, evidence, changed files, blockers, and untrusted worker claims.
|
|
90
90
|
|
|
91
|
-
While work is open,
|
|
91
|
+
While work is open, the host-owned activity lane below the editor combines the active checklist with queued or running `worker` and `tmux-worker` lanes. It updates from session and terminal-lane events, never by polling output. It disappears when no checklist item or worker is active and survives extension reloads without becoming extension-owned state.
|
|
92
92
|
|
|
93
|
-
The visual contract is deliberately restrained for a keyboard-first terminal: semantic theme colors, status glyphs that remain meaningful without color, no animation, no hard frame, bounded rows, and width-safe truncation. Extension widgets still render independently; reloading or clearing them does not remove the native
|
|
93
|
+
The visual contract is deliberately restrained for a keyboard-first terminal: semantic theme colors, status glyphs that remain meaningful without color, no animation, no hard frame, bounded rows, and width-safe truncation. Extension widgets still render independently; reloading or clearing them does not remove the native activity lane.
|
|
94
94
|
|
|
95
95
|
## Persistence and isolation
|
|
96
96
|
|
package/docs/tool-repair.md
CHANGED
|
@@ -43,7 +43,7 @@ Example project settings:
|
|
|
43
43
|
|
|
44
44
|
## Visible signals
|
|
45
45
|
|
|
46
|
-
-
|
|
46
|
+
- Expanded Ctrl+T action details show `[repaired arguments]` when execution used repaired arguments.
|
|
47
47
|
- RPC `tool_execution_start`, `tool_execution_update`, and `tool_execution_end` events include a `repair` object when arguments were repaired.
|
|
48
48
|
- `/toolhealth` prints model adaptation records for this host: tool-probe verdicts, calibrated or failed text protocol, learned standing rules, teach statistics, recovery-log worker counters, and execution-failure counts by phase.
|
|
49
49
|
- `/toolrule-remove <provider/model> <mode>` removes one learned standing rule from the host-local adaptation store.
|
package/docs/usage.md
CHANGED
|
@@ -43,7 +43,7 @@ Pasted images are stored under `~/.pi/agent/state/attachments` by default and at
|
|
|
43
43
|
|
|
44
44
|
When an owner choice materially changes the result, the built-in `ask_question` interaction presents up to four questions together. It supports single choice, multi-select, an unrestricted multi-line custom **Other** answer, clipboard text or image paste, explicit **Skip**, configurable keyboard navigation, cancellation, and a final review before a multi-question answer is submitted. The request is checkpointed before display; `/resume` restores the original tool call, and large answers remain exact in a retrievable artifact while only a bounded projection enters prompt context. TUI and RPC hosts use the same fail-closed typed request. Image paste is refused with a visible explanation when the routed model cannot accept images instead of silently replacing it with a placeholder. Non-interactive sessions fail closed instead of inventing an answer, and worker sessions do not construct the question tool.
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
Every model-invoked skill, goal, task, worker, file, shell, and extension call contributes once to the same collapsed `Performing N actions` / `Performed N actions` transcript row. Ctrl+T opens the detailed transcript. Live task and worker state uses the single activity lane; durable labels and admitted preset or adaptive grant IDs remain visible after `/resume`. Completed worker output remains untrusted until the parent verifies it through the existing result and review contracts.
|
|
47
47
|
|
|
48
48
|
### Secret Store
|
|
49
49
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-custom-provider",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.94.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-custom-provider",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.94.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.52.0"
|
|
12
12
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-sandbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.94.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-sandbox",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.94.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sandbox-runtime": "^0.0.26"
|
|
12
12
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-with-deps",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.94.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-with-deps",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.94.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ms": "^2.1.3"
|
|
12
12
|
},
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caupulican/pi-adaptative",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.94.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@caupulican/pi-adaptative",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.94.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@caupulican/pi-agent-core": "^0.
|
|
13
|
-
"@caupulican/pi-ai": "^0.
|
|
14
|
-
"@caupulican/pi-tui": "^0.
|
|
12
|
+
"@caupulican/pi-agent-core": "^0.94.0",
|
|
13
|
+
"@caupulican/pi-ai": "^0.94.0",
|
|
14
|
+
"@caupulican/pi-tui": "^0.94.0",
|
|
15
15
|
"@silvia-odwyer/photon-node": "0.3.4",
|
|
16
16
|
"chalk": "5.6.2",
|
|
17
17
|
"cross-spawn": "7.0.6",
|
|
@@ -506,11 +506,11 @@
|
|
|
506
506
|
}
|
|
507
507
|
},
|
|
508
508
|
"node_modules/@caupulican/pi-agent-core": {
|
|
509
|
-
"version": "0.
|
|
510
|
-
"resolved": "https://registry.npmjs.org/@caupulican/pi-agent-core/-/pi-agent-core-0.
|
|
509
|
+
"version": "0.94.0",
|
|
510
|
+
"resolved": "https://registry.npmjs.org/@caupulican/pi-agent-core/-/pi-agent-core-0.94.0.tgz",
|
|
511
511
|
"license": "MIT",
|
|
512
512
|
"dependencies": {
|
|
513
|
-
"@caupulican/pi-ai": "^0.
|
|
513
|
+
"@caupulican/pi-ai": "^0.94.0",
|
|
514
514
|
"ignore": "7.0.5",
|
|
515
515
|
"typebox": "1.1.38",
|
|
516
516
|
"yaml": "2.9.0"
|
|
@@ -520,8 +520,8 @@
|
|
|
520
520
|
}
|
|
521
521
|
},
|
|
522
522
|
"node_modules/@caupulican/pi-ai": {
|
|
523
|
-
"version": "0.
|
|
524
|
-
"resolved": "https://registry.npmjs.org/@caupulican/pi-ai/-/pi-ai-0.
|
|
523
|
+
"version": "0.94.0",
|
|
524
|
+
"resolved": "https://registry.npmjs.org/@caupulican/pi-ai/-/pi-ai-0.94.0.tgz",
|
|
525
525
|
"license": "MIT",
|
|
526
526
|
"dependencies": {
|
|
527
527
|
"@anthropic-ai/sdk": "0.117.1",
|
|
@@ -546,8 +546,8 @@
|
|
|
546
546
|
}
|
|
547
547
|
},
|
|
548
548
|
"node_modules/@caupulican/pi-tui": {
|
|
549
|
-
"version": "0.
|
|
550
|
-
"resolved": "https://registry.npmjs.org/@caupulican/pi-tui/-/pi-tui-0.
|
|
549
|
+
"version": "0.94.0",
|
|
550
|
+
"resolved": "https://registry.npmjs.org/@caupulican/pi-tui/-/pi-tui-0.94.0.tgz",
|
|
551
551
|
"license": "MIT",
|
|
552
552
|
"dependencies": {
|
|
553
553
|
"get-east-asian-width": "1.6.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caupulican/pi-adaptative",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.94.0",
|
|
4
4
|
"description": "Adaptive fork of Pi coding agent for self-evolving agent harness experiments",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"piConfig": {
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
"postinstall": "node scripts/postinstall-python-runtime.mjs"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@caupulican/pi-agent-core": "^0.
|
|
93
|
-
"@caupulican/pi-ai": "^0.
|
|
94
|
-
"@caupulican/pi-tui": "^0.
|
|
92
|
+
"@caupulican/pi-agent-core": "^0.94.0",
|
|
93
|
+
"@caupulican/pi-ai": "^0.94.0",
|
|
94
|
+
"@caupulican/pi-tui": "^0.94.0",
|
|
95
95
|
"@silvia-odwyer/photon-node": "0.3.4",
|
|
96
96
|
"chalk": "5.6.2",
|
|
97
97
|
"cross-spawn": "7.0.6",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type Component } from "@caupulican/pi-tui";
|
|
2
|
-
import type { ToolExecutionComponent } from "./tool-execution.ts";
|
|
3
|
-
export declare class ToolGroupComponent implements Component {
|
|
4
|
-
readonly toolGroup: string;
|
|
5
|
-
private readonly tools;
|
|
6
|
-
private expanded;
|
|
7
|
-
constructor(toolGroup: string, tools?: ToolExecutionComponent[]);
|
|
8
|
-
addTool(tool: ToolExecutionComponent): void;
|
|
9
|
-
removeTool(tool: ToolExecutionComponent): boolean;
|
|
10
|
-
getToolCount(): number;
|
|
11
|
-
getOnlyTool(): ToolExecutionComponent | undefined;
|
|
12
|
-
setExpanded(expanded: boolean): void;
|
|
13
|
-
setShowImages(show: boolean): void;
|
|
14
|
-
setImageWidthCells(width: number): void;
|
|
15
|
-
invalidate(): void;
|
|
16
|
-
render(width: number): string[];
|
|
17
|
-
private renderCollapsed;
|
|
18
|
-
private formatCountLine;
|
|
19
|
-
private formatFileSnippet;
|
|
20
|
-
private formatLastAction;
|
|
21
|
-
private uniqueFiles;
|
|
22
|
-
private appendExpandHint;
|
|
23
|
-
private getBackgroundColor;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=tool-group.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-group.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,SAAS,EAAiC,MAAM,oBAAoB,CAAC;AAIxF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AA0ClE,qBAAa,kBAAmB,YAAW,SAAS;IACnD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;IACtD,OAAO,CAAC,QAAQ,CAAS;IAEzB,YAAY,SAAS,EAAE,MAAM,EAAE,KAAK,GAAE,sBAAsB,EAAO,EAGlE;IAED,OAAO,CAAC,IAAI,EAAE,sBAAsB,GAAG,IAAI,CAG1C;IAED,UAAU,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAKhD;IAED,YAAY,IAAI,MAAM,CAErB;IAED,WAAW,IAAI,sBAAsB,GAAG,SAAS,CAEhD;IAED,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAGnC;IAED,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAEjC;IAED,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAEtC;IAED,UAAU,IAAI,IAAI,CAEjB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAU9B;IAED,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,eAAe;IAiBvB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,kBAAkB;CAM1B"}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { Box, truncateToWidth, visibleWidth } from "@caupulican/pi-tui";
|
|
2
|
-
import { shortenPath } from "../../../core/tools/render-utils.js";
|
|
3
|
-
import { theme } from "../theme/theme.js";
|
|
4
|
-
import { keyText } from "./keybinding-hints.js";
|
|
5
|
-
const COLLAPSED_FILE_SNIPPET = 3;
|
|
6
|
-
/** Human nouns for collapsed group headers. Keys are toolGroup ids, not raw tool names. */
|
|
7
|
-
const GROUP_NOUNS = {
|
|
8
|
-
task_steps: { singular: "Task Step", plural: "Task Steps" },
|
|
9
|
-
pipeline: { singular: "Pipeline", plural: "Pipelines" },
|
|
10
|
-
skills: { singular: "Skill", plural: "Skills" },
|
|
11
|
-
delegate: { singular: "Worker", plural: "Workers" },
|
|
12
|
-
explore: { singular: "Search", plural: "Searches" },
|
|
13
|
-
};
|
|
14
|
-
function plural(count, singular, pluralForm = `${singular}s`) {
|
|
15
|
-
return `${count} ${count === 1 ? singular : pluralForm}`;
|
|
16
|
-
}
|
|
17
|
-
function humanizeGroupKey(raw) {
|
|
18
|
-
const words = raw
|
|
19
|
-
.replace(/[_-]+/g, " ")
|
|
20
|
-
.trim()
|
|
21
|
-
.split(/\s+/)
|
|
22
|
-
.filter(Boolean)
|
|
23
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase());
|
|
24
|
-
const last = words.at(-1) ?? "Tool";
|
|
25
|
-
const lastSingular = last.endsWith("s") && last.length > 1 ? last.slice(0, -1) : last;
|
|
26
|
-
const lastPlural = last.endsWith("s") ? last : `${last}s`;
|
|
27
|
-
return {
|
|
28
|
-
singular: [...words.slice(0, -1), lastSingular].join(" "),
|
|
29
|
-
plural: [...words.slice(0, -1), lastPlural].join(" "),
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function groupNoun(groupKey, tools) {
|
|
33
|
-
const mapped = GROUP_NOUNS[groupKey];
|
|
34
|
-
if (mapped)
|
|
35
|
-
return mapped;
|
|
36
|
-
const labels = [...new Set(tools.map((tool) => tool.getDisplayLabel()).filter((label) => label.length > 0))];
|
|
37
|
-
if (labels.length === 1)
|
|
38
|
-
return humanizeGroupKey(labels[0]);
|
|
39
|
-
if (groupKey)
|
|
40
|
-
return humanizeGroupKey(groupKey);
|
|
41
|
-
return { singular: "Tool", plural: "Tools" };
|
|
42
|
-
}
|
|
43
|
-
export class ToolGroupComponent {
|
|
44
|
-
constructor(toolGroup, tools = []) {
|
|
45
|
-
this.tools = [];
|
|
46
|
-
this.expanded = false;
|
|
47
|
-
this.toolGroup = toolGroup;
|
|
48
|
-
for (const tool of tools)
|
|
49
|
-
this.addTool(tool);
|
|
50
|
-
}
|
|
51
|
-
addTool(tool) {
|
|
52
|
-
tool.setExpanded(this.expanded);
|
|
53
|
-
this.tools.push(tool);
|
|
54
|
-
}
|
|
55
|
-
removeTool(tool) {
|
|
56
|
-
const index = this.tools.indexOf(tool);
|
|
57
|
-
if (index === -1)
|
|
58
|
-
return false;
|
|
59
|
-
this.tools.splice(index, 1);
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
getToolCount() {
|
|
63
|
-
return this.tools.length;
|
|
64
|
-
}
|
|
65
|
-
getOnlyTool() {
|
|
66
|
-
return this.tools.length === 1 ? this.tools[0] : undefined;
|
|
67
|
-
}
|
|
68
|
-
setExpanded(expanded) {
|
|
69
|
-
this.expanded = expanded;
|
|
70
|
-
for (const tool of this.tools)
|
|
71
|
-
tool.setExpanded(expanded);
|
|
72
|
-
}
|
|
73
|
-
setShowImages(show) {
|
|
74
|
-
for (const tool of this.tools)
|
|
75
|
-
tool.setShowImages(show);
|
|
76
|
-
}
|
|
77
|
-
setImageWidthCells(width) {
|
|
78
|
-
for (const tool of this.tools)
|
|
79
|
-
tool.setImageWidthCells(width);
|
|
80
|
-
}
|
|
81
|
-
invalidate() {
|
|
82
|
-
for (const tool of this.tools)
|
|
83
|
-
tool.invalidate();
|
|
84
|
-
}
|
|
85
|
-
render(width) {
|
|
86
|
-
if (this.tools.length === 0)
|
|
87
|
-
return [];
|
|
88
|
-
const safeWidth = Math.max(1, width);
|
|
89
|
-
if (this.expanded)
|
|
90
|
-
return this.tools.flatMap((tool) => tool.render(safeWidth));
|
|
91
|
-
const collapsed = this.renderCollapsed(safeWidth);
|
|
92
|
-
if (collapsed.length === 0)
|
|
93
|
-
return [];
|
|
94
|
-
const box = new Box(1, 1, (text) => theme.bg(this.getBackgroundColor(), text));
|
|
95
|
-
box.addChild({ render: (contentWidth) => this.renderCollapsed(contentWidth), invalidate: () => { } });
|
|
96
|
-
return [" ".repeat(safeWidth), ...box.render(safeWidth)];
|
|
97
|
-
}
|
|
98
|
-
renderCollapsed(width) {
|
|
99
|
-
const safeWidth = Math.max(1, width);
|
|
100
|
-
const lines = [this.formatCountLine(), ...this.formatFileSnippet(), ...this.formatLastAction()].filter((line) => line.trim().length > 0);
|
|
101
|
-
if (lines.length === 0)
|
|
102
|
-
return [];
|
|
103
|
-
lines[lines.length - 1] = this.appendExpandHint(lines[lines.length - 1], safeWidth);
|
|
104
|
-
return lines.map((line) => truncateToWidth(line, safeWidth, "..."));
|
|
105
|
-
}
|
|
106
|
-
formatCountLine() {
|
|
107
|
-
const editCount = this.tools.filter((tool) => tool.getToolName() === "edit").length;
|
|
108
|
-
const writeCount = this.tools.filter((tool) => tool.getToolName() === "write").length;
|
|
109
|
-
const errorCount = this.tools.filter((tool) => tool.isToolError()).length;
|
|
110
|
-
const files = this.uniqueFiles();
|
|
111
|
-
const parts = [];
|
|
112
|
-
if (editCount > 0)
|
|
113
|
-
parts.push(plural(editCount, "edit"));
|
|
114
|
-
if (writeCount > 0)
|
|
115
|
-
parts.push(plural(writeCount, "write"));
|
|
116
|
-
if (parts.length === 0) {
|
|
117
|
-
const noun = groupNoun(this.toolGroup, this.tools);
|
|
118
|
-
parts.push(plural(this.tools.length, noun.singular, noun.plural));
|
|
119
|
-
}
|
|
120
|
-
if (files.length > 0)
|
|
121
|
-
parts.push(plural(files.length, "file"));
|
|
122
|
-
if (errorCount > 0)
|
|
123
|
-
parts.push(plural(errorCount, "error"));
|
|
124
|
-
return theme.bold(parts.join(" · "));
|
|
125
|
-
}
|
|
126
|
-
formatFileSnippet() {
|
|
127
|
-
const files = this.uniqueFiles();
|
|
128
|
-
if (files.length === 0)
|
|
129
|
-
return [];
|
|
130
|
-
const shown = files.slice(0, COLLAPSED_FILE_SNIPPET);
|
|
131
|
-
const extra = files.length - shown.length;
|
|
132
|
-
const list = shown.join(", ") + (extra > 0 ? `, +${extra}` : "");
|
|
133
|
-
return [theme.fg("dim", list)];
|
|
134
|
-
}
|
|
135
|
-
formatLastAction() {
|
|
136
|
-
const last = [...this.tools].reverse().find((tool) => tool.isToolSuccess()) ?? this.tools[this.tools.length - 1];
|
|
137
|
-
if (!last)
|
|
138
|
-
return [];
|
|
139
|
-
const path = last.getDisplayPath();
|
|
140
|
-
const name = last.getDisplayLabel();
|
|
141
|
-
const label = path ? `${name} ${shortenPath(path)}` : name;
|
|
142
|
-
return [`${theme.fg("dim", "last: ")}${label}`];
|
|
143
|
-
}
|
|
144
|
-
uniqueFiles() {
|
|
145
|
-
const seen = new Set();
|
|
146
|
-
const files = [];
|
|
147
|
-
for (const tool of this.tools) {
|
|
148
|
-
const path = tool.getDisplayPath();
|
|
149
|
-
if (!path)
|
|
150
|
-
continue;
|
|
151
|
-
const display = shortenPath(path);
|
|
152
|
-
if (seen.has(display))
|
|
153
|
-
continue;
|
|
154
|
-
seen.add(display);
|
|
155
|
-
files.push(display);
|
|
156
|
-
}
|
|
157
|
-
return files;
|
|
158
|
-
}
|
|
159
|
-
appendExpandHint(line, width) {
|
|
160
|
-
const hint = theme.fg("dim", ` (${keyText("app.tools.expand")} to expand)`);
|
|
161
|
-
const hintWidth = visibleWidth(hint);
|
|
162
|
-
if (hintWidth >= width)
|
|
163
|
-
return truncateToWidth(hint, width, "...");
|
|
164
|
-
return truncateToWidth(line, width - hintWidth, "") + hint;
|
|
165
|
-
}
|
|
166
|
-
getBackgroundColor() {
|
|
167
|
-
const colors = this.tools.map((tool) => tool.getBackgroundColor());
|
|
168
|
-
if (colors.includes("toolErrorBg"))
|
|
169
|
-
return "toolErrorBg";
|
|
170
|
-
if (colors.includes("toolPendingBg"))
|
|
171
|
-
return "toolPendingBg";
|
|
172
|
-
return "toolSuccessBg";
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
//# sourceMappingURL=tool-group.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-group.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAkB,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAgB,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAEjC,2FAA2F;AAC3F,MAAM,WAAW,GAAyD;IACzE,UAAU,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE;IAC3D,QAAQ,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE;IACvD,MAAM,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE;IAC/C,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE;IACnD,OAAO,EAAE,EAAE,QAAQ,EAAE,QA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IAEO,kBAAkB;QACzB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC;QACnE,IAAI,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;YAAE,OAAO,aAAa,CAAC;QACzD,IAAI,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC;YAAE,OAAO,eAAe,CAAC;QAC7D,OAAO,eAAe,CAAC;IACxB,CAAC;CACD","sourcesContent":["import { Box, type Component, truncateToWidth, visibleWidth } from \"@caupulican/pi-tui\";\nimport { shortenPath } from \"../../../core/tools/render-utils.ts\";\nimport { type ThemeBg, theme } from \"../theme/theme.ts\";\nimport { keyText } from \"./keybinding-hints.ts\";\nimport type { ToolExecutionComponent } from \"./tool-execution.ts\";\n\nconst COLLAPSED_FILE_SNIPPET = 3;\n\n/** Human nouns for collapsed group headers. Keys are toolGroup ids, not raw tool names. */\nconst GROUP_NOUNS: Record<string, { singular: string; plural: string }> = {\n\ttask_steps: { singular: \"Task Step\", plural: \"Task Steps\" },\n\tpipeline: { singular: \"Pipeline\", plural: \"Pipelines\" },\n\tskills: { singular: \"Skill\", plural: \"Skills\" },\n\tdelegate: { singular: \"Worker\", plural: \"Workers\" },\n\texplore: { singular: \"Search\", plural: \"Searches\" },\n};\n\nfunction plural(count: number, singular: string, pluralForm = `${singular}s`): string {\n\treturn `${count} ${count === 1 ? singular : pluralForm}`;\n}\n\nfunction humanizeGroupKey(raw: string): { singular: string; plural: string } {\n\tconst words = raw\n\t\t.replace(/[_-]+/g, \" \")\n\t\t.trim()\n\t\t.split(/\\s+/)\n\t\t.filter(Boolean)\n\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase());\n\tconst last = words.at(-1) ?? \"Tool\";\n\tconst lastSingular = last.endsWith(\"s\") && last.length > 1 ? last.slice(0, -1) : last;\n\tconst lastPlural = last.endsWith(\"s\") ? last : `${last}s`;\n\treturn {\n\t\tsingular: [...words.slice(0, -1), lastSingular].join(\" \"),\n\t\tplural: [...words.slice(0, -1), lastPlural].join(\" \"),\n\t};\n}\n\nfunction groupNoun(groupKey: string, tools: readonly ToolExecutionComponent[]): { singular: string; plural: string } {\n\tconst mapped = GROUP_NOUNS[groupKey];\n\tif (mapped) return mapped;\n\tconst labels = [...new Set(tools.map((tool) => tool.getDisplayLabel()).filter((label) => label.length > 0))];\n\tif (labels.length === 1) return humanizeGroupKey(labels[0]);\n\tif (groupKey) return humanizeGroupKey(groupKey);\n\treturn { singular: \"Tool\", plural: \"Tools\" };\n}\n\nexport class ToolGroupComponent implements Component {\n\treadonly toolGroup: string;\n\tprivate readonly tools: ToolExecutionComponent[] = [];\n\tprivate expanded = false;\n\n\tconstructor(toolGroup: string, tools: ToolExecutionComponent[] = []) {\n\t\tthis.toolGroup = toolGroup;\n\t\tfor (const tool of tools) this.addTool(tool);\n\t}\n\n\taddTool(tool: ToolExecutionComponent): void {\n\t\ttool.setExpanded(this.expanded);\n\t\tthis.tools.push(tool);\n\t}\n\n\tremoveTool(tool: ToolExecutionComponent): boolean {\n\t\tconst index = this.tools.indexOf(tool);\n\t\tif (index === -1) return false;\n\t\tthis.tools.splice(index, 1);\n\t\treturn true;\n\t}\n\n\tgetToolCount(): number {\n\t\treturn this.tools.length;\n\t}\n\n\tgetOnlyTool(): ToolExecutionComponent | undefined {\n\t\treturn this.tools.length === 1 ? this.tools[0] : undefined;\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tfor (const tool of this.tools) tool.setExpanded(expanded);\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tfor (const tool of this.tools) tool.setShowImages(show);\n\t}\n\n\tsetImageWidthCells(width: number): void {\n\t\tfor (const tool of this.tools) tool.setImageWidthCells(width);\n\t}\n\n\tinvalidate(): void {\n\t\tfor (const tool of this.tools) tool.invalidate();\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.tools.length === 0) return [];\n\t\tconst safeWidth = Math.max(1, width);\n\t\tif (this.expanded) return this.tools.flatMap((tool) => tool.render(safeWidth));\n\n\t\tconst collapsed = this.renderCollapsed(safeWidth);\n\t\tif (collapsed.length === 0) return [];\n\t\tconst box = new Box(1, 1, (text) => theme.bg(this.getBackgroundColor(), text));\n\t\tbox.addChild({ render: (contentWidth) => this.renderCollapsed(contentWidth), invalidate: () => {} });\n\t\treturn [\" \".repeat(safeWidth), ...box.render(safeWidth)];\n\t}\n\n\tprivate renderCollapsed(width: number): string[] {\n\t\tconst safeWidth = Math.max(1, width);\n\t\tconst lines = [this.formatCountLine(), ...this.formatFileSnippet(), ...this.formatLastAction()].filter(\n\t\t\t(line) => line.trim().length > 0,\n\t\t);\n\t\tif (lines.length === 0) return [];\n\t\tlines[lines.length - 1] = this.appendExpandHint(lines[lines.length - 1], safeWidth);\n\t\treturn lines.map((line) => truncateToWidth(line, safeWidth, \"...\"));\n\t}\n\n\tprivate formatCountLine(): string {\n\t\tconst editCount = this.tools.filter((tool) => tool.getToolName() === \"edit\").length;\n\t\tconst writeCount = this.tools.filter((tool) => tool.getToolName() === \"write\").length;\n\t\tconst errorCount = this.tools.filter((tool) => tool.isToolError()).length;\n\t\tconst files = this.uniqueFiles();\n\t\tconst parts: string[] = [];\n\t\tif (editCount > 0) parts.push(plural(editCount, \"edit\"));\n\t\tif (writeCount > 0) parts.push(plural(writeCount, \"write\"));\n\t\tif (parts.length === 0) {\n\t\t\tconst noun = groupNoun(this.toolGroup, this.tools);\n\t\t\tparts.push(plural(this.tools.length, noun.singular, noun.plural));\n\t\t}\n\t\tif (files.length > 0) parts.push(plural(files.length, \"file\"));\n\t\tif (errorCount > 0) parts.push(plural(errorCount, \"error\"));\n\t\treturn theme.bold(parts.join(\" · \"));\n\t}\n\n\tprivate formatFileSnippet(): string[] {\n\t\tconst files = this.uniqueFiles();\n\t\tif (files.length === 0) return [];\n\t\tconst shown = files.slice(0, COLLAPSED_FILE_SNIPPET);\n\t\tconst extra = files.length - shown.length;\n\t\tconst list = shown.join(\", \") + (extra > 0 ? `, +${extra}` : \"\");\n\t\treturn [theme.fg(\"dim\", list)];\n\t}\n\n\tprivate formatLastAction(): string[] {\n\t\tconst last = [...this.tools].reverse().find((tool) => tool.isToolSuccess()) ?? this.tools[this.tools.length - 1];\n\t\tif (!last) return [];\n\t\tconst path = last.getDisplayPath();\n\t\tconst name = last.getDisplayLabel();\n\t\tconst label = path ? `${name} ${shortenPath(path)}` : name;\n\t\treturn [`${theme.fg(\"dim\", \"last: \")}${label}`];\n\t}\n\n\tprivate uniqueFiles(): string[] {\n\t\tconst seen = new Set<string>();\n\t\tconst files: string[] = [];\n\t\tfor (const tool of this.tools) {\n\t\t\tconst path = tool.getDisplayPath();\n\t\t\tif (!path) continue;\n\t\t\tconst display = shortenPath(path);\n\t\t\tif (seen.has(display)) continue;\n\t\t\tseen.add(display);\n\t\t\tfiles.push(display);\n\t\t}\n\t\treturn files;\n\t}\n\n\tprivate appendExpandHint(line: string, width: number): string {\n\t\tconst hint = theme.fg(\"dim\", ` (${keyText(\"app.tools.expand\")} to expand)`);\n\t\tconst hintWidth = visibleWidth(hint);\n\t\tif (hintWidth >= width) return truncateToWidth(hint, width, \"...\");\n\t\treturn truncateToWidth(line, width - hintWidth, \"\") + hint;\n\t}\n\n\tprivate getBackgroundColor(): ThemeBg {\n\t\tconst colors = this.tools.map((tool) => tool.getBackgroundColor());\n\t\tif (colors.includes(\"toolErrorBg\")) return \"toolErrorBg\";\n\t\tif (colors.includes(\"toolPendingBg\")) return \"toolPendingBg\";\n\t\treturn \"toolSuccessBg\";\n\t}\n}\n"]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ToolExecutionComponent } from "./tool-execution.ts";
|
|
2
|
-
export interface ToolPanelTenantScope {
|
|
3
|
-
sessionId?: string;
|
|
4
|
-
sessionFile?: string;
|
|
5
|
-
cwd: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function createToolPanelTenantKey(scope: ToolPanelTenantScope): string;
|
|
8
|
-
export declare function getToolPanelActionKey(scope: ToolPanelTenantScope, toolName: string, args: unknown): string | undefined;
|
|
9
|
-
export declare function getToolPanelResultActionKeys(scope: ToolPanelTenantScope, toolName: string, result: unknown): string[];
|
|
10
|
-
export declare function shouldReuseToolPanelInPlace(toolName: string, args: unknown): boolean;
|
|
11
|
-
export declare class ToolPanelRegistry {
|
|
12
|
-
private readonly panelsByAction;
|
|
13
|
-
private readonly activeByCallId;
|
|
14
|
-
private readonly actionKeyByCallId;
|
|
15
|
-
getReusable(actionKey: string | undefined, options?: {
|
|
16
|
-
allowActive?: boolean;
|
|
17
|
-
}): ToolExecutionComponent | undefined;
|
|
18
|
-
private rememberAction;
|
|
19
|
-
replaceActiveForAction(toolCallId: string, panel: ToolExecutionComponent, actionKey: string): void;
|
|
20
|
-
register(toolCallId: string, panel: ToolExecutionComponent, actionKey?: string): void;
|
|
21
|
-
registerAliases(panel: ToolExecutionComponent, actionKeys: string[]): void;
|
|
22
|
-
hasActive(toolCallId: string): boolean;
|
|
23
|
-
getActive(toolCallId: string): ToolExecutionComponent | undefined;
|
|
24
|
-
activeEntries(): IterableIterator<[string, ToolExecutionComponent]>;
|
|
25
|
-
isActive(panel: ToolExecutionComponent): boolean;
|
|
26
|
-
finish(toolCallId: string): void;
|
|
27
|
-
clearActive(): void;
|
|
28
|
-
clearAll(): void;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=tool-panel-registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-panel-registry.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-panel-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,MAAM,WAAW,oBAAoB;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,EAA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