mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-12-05 22:39:19 +00:00
Web: the core keeps nested calls only as Durable shows them (`ToolView.calls`: live
`pi.live.nestedTools` slots, then the last list seen). A tool's contribution reads the rest:
`ToolActivity.nestedCalls(tool)` (code mode: its result's `details.calls`, live internal tools by
their script name, in plugins/codemode/nested.ts), `repeated(count, failed)` for an entry of
identical repeated calls ("N runs"; without it, the repeated tool's own summary), and a nested call's
`CallInput` (bash, PowerShell, terminal: a command line; without it, JSON) instead of core's
`args.command` guess. `isInterruptedError` moves to `@p2/app/v1`.
TUI: the built-in renderers move to the plugins' TUI facets (coding-tools: read, bash, edit, write,
grep, find, ls; powershell; codemode); the shell card stays a shared building block
(`createShellRenderers`). `ToolRenderers.nestedCalls` reads a call's calls for the card and for
resolvers such as quiet-tools (`resolveToolRenderers` keeps the registry's). `transcriptComponent`
takes the renderers to draw with; tests use `test/fixtures/tui-tools.ts`.
Behaviour and look unchanged.
(cherry picked from commit 00afdddbb6eb3dcb5207cac6ca8e496607ab1b61)
22 lines
784 B
TypeScript
22 lines
784 B
TypeScript
// The coding tools' TUI facet: their cards in the transcript, as pi draws them (cards.ts; bash with the shared shell
|
|
// card).
|
|
import { contribute, defineFacet } from "@p2/app/v1";
|
|
import { createShellRenderers, TuiToolRenderers } from "@p2/app/v1/tui";
|
|
import { editRenderers, findRenderers, grepRenderers, lsRenderers, readRenderers, writeRenderers } from "./cards.ts";
|
|
|
|
/** The coding tools' cards, by tool name. */
|
|
export const codingToolRenderers = {
|
|
read: readRenderers,
|
|
bash: createShellRenderers("$"),
|
|
edit: editRenderers,
|
|
write: writeRenderers,
|
|
grep: grepRenderers,
|
|
find: findRenderers,
|
|
ls: lsRenderers,
|
|
};
|
|
|
|
export default defineFacet((host) => {
|
|
contribute(host, "p2.tui-coding-tools", (self) => {
|
|
self.contribute(TuiToolRenderers, codingToolRenderers);
|
|
});
|
|
});
|