pi-subagent-manager 1.10.0 → 1.11.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/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +836 -0
- package/dist/index.js.map +1 -0
- package/dist/orch/checklist-integration.d.ts +48 -0
- package/dist/orch/checklist-integration.d.ts.map +1 -0
- package/dist/orch/checklist-integration.js +204 -0
- package/dist/orch/checklist-integration.js.map +1 -0
- package/dist/orch/context-entries.d.ts +8 -0
- package/dist/orch/context-entries.d.ts.map +1 -0
- package/dist/orch/context-entries.js +8 -0
- package/dist/orch/context-entries.js.map +1 -0
- package/dist/orch/cost-ledger.d.ts +16 -0
- package/dist/orch/cost-ledger.d.ts.map +1 -0
- package/dist/orch/cost-ledger.js +43 -0
- package/dist/orch/cost-ledger.js.map +1 -0
- package/dist/orch/diagnostics.d.ts +13 -0
- package/dist/orch/diagnostics.d.ts.map +1 -0
- package/dist/orch/diagnostics.js +95 -0
- package/dist/orch/diagnostics.js.map +1 -0
- package/dist/orch/extensions.d.ts +15 -0
- package/dist/orch/extensions.d.ts.map +1 -0
- package/dist/orch/extensions.js +80 -0
- package/dist/orch/extensions.js.map +1 -0
- package/dist/orch/housekeeping-usage.d.ts +14 -0
- package/dist/orch/housekeeping-usage.d.ts.map +1 -0
- package/dist/orch/housekeeping-usage.js +27 -0
- package/dist/orch/housekeeping-usage.js.map +1 -0
- package/dist/orch/housekeeping.d.ts +89 -0
- package/dist/orch/housekeeping.d.ts.map +1 -0
- package/dist/orch/housekeeping.js +281 -0
- package/dist/orch/housekeeping.js.map +1 -0
- package/dist/orch/inherited-tools.d.ts +18 -0
- package/dist/orch/inherited-tools.d.ts.map +1 -0
- package/dist/orch/inherited-tools.js +71 -0
- package/dist/orch/inherited-tools.js.map +1 -0
- package/dist/orch/mailbox.d.ts +59 -0
- package/dist/orch/mailbox.d.ts.map +1 -0
- package/dist/orch/mailbox.js +196 -0
- package/dist/orch/mailbox.js.map +1 -0
- package/dist/orch/manager.d.ts +82 -0
- package/dist/orch/manager.d.ts.map +1 -0
- package/dist/orch/manager.js +1010 -0
- package/dist/orch/manager.js.map +1 -0
- package/dist/orch/paths.d.ts +7 -0
- package/dist/orch/paths.d.ts.map +1 -0
- package/dist/orch/paths.js +73 -0
- package/dist/orch/paths.js.map +1 -0
- package/dist/orch/prompt.d.ts +7 -0
- package/dist/orch/prompt.d.ts.map +1 -0
- package/dist/orch/prompt.js +34 -0
- package/dist/orch/prompt.js.map +1 -0
- package/dist/orch/registry.d.ts +49 -0
- package/dist/orch/registry.d.ts.map +1 -0
- package/dist/orch/registry.js +134 -0
- package/dist/orch/registry.js.map +1 -0
- package/dist/orch/runtime.d.ts +11 -0
- package/dist/orch/runtime.d.ts.map +1 -0
- package/dist/orch/runtime.js +882 -0
- package/dist/orch/runtime.js.map +1 -0
- package/dist/orch/tools.d.ts +6 -0
- package/dist/orch/tools.d.ts.map +1 -0
- package/dist/orch/tools.js +114 -0
- package/dist/orch/tools.js.map +1 -0
- package/dist/orch/transcript.d.ts +28 -0
- package/dist/orch/transcript.d.ts.map +1 -0
- package/dist/orch/transcript.js +176 -0
- package/dist/orch/transcript.js.map +1 -0
- package/dist/prefs/agent-import.d.ts +37 -0
- package/dist/prefs/agent-import.d.ts.map +1 -0
- package/dist/prefs/agent-import.js +196 -0
- package/dist/prefs/agent-import.js.map +1 -0
- package/dist/prefs/config.d.ts +108 -0
- package/dist/prefs/config.d.ts.map +1 -0
- package/dist/prefs/config.js +926 -0
- package/dist/prefs/config.js.map +1 -0
- package/dist/prefs/import-discovery.d.ts +28 -0
- package/dist/prefs/import-discovery.d.ts.map +1 -0
- package/dist/prefs/import-discovery.js +562 -0
- package/dist/prefs/import-discovery.js.map +1 -0
- package/dist/prefs/import-instructions.d.ts +3 -0
- package/dist/prefs/import-instructions.d.ts.map +1 -0
- package/{src/prefs/import-instructions.ts → dist/prefs/import-instructions.js} +1 -0
- package/dist/prefs/import-instructions.js.map +1 -0
- package/dist/prefs/models.d.ts +24 -0
- package/dist/prefs/models.d.ts.map +1 -0
- package/dist/prefs/models.js +57 -0
- package/dist/prefs/models.js.map +1 -0
- package/dist/prefs/settings.d.ts +89 -0
- package/dist/prefs/settings.d.ts.map +1 -0
- package/dist/prefs/settings.js +505 -0
- package/dist/prefs/settings.js.map +1 -0
- package/dist/types.d.ts +293 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/agent-loader.d.ts +21 -0
- package/dist/ui/agent-loader.d.ts.map +1 -0
- package/dist/ui/agent-loader.js +73 -0
- package/dist/ui/agent-loader.js.map +1 -0
- package/dist/ui/agent-navigation-editor.d.ts +46 -0
- package/dist/ui/agent-navigation-editor.d.ts.map +1 -0
- package/dist/ui/agent-navigation-editor.js +189 -0
- package/dist/ui/agent-navigation-editor.js.map +1 -0
- package/dist/ui/cost-footer.d.ts +37 -0
- package/dist/ui/cost-footer.d.ts.map +1 -0
- package/dist/ui/cost-footer.js +215 -0
- package/dist/ui/cost-footer.js.map +1 -0
- package/dist/ui/dialog.d.ts +135 -0
- package/dist/ui/dialog.d.ts.map +1 -0
- package/dist/ui/dialog.js +533 -0
- package/dist/ui/dialog.js.map +1 -0
- package/dist/ui/import-picker.d.ts +38 -0
- package/dist/ui/import-picker.d.ts.map +1 -0
- package/dist/ui/import-picker.js +211 -0
- package/dist/ui/import-picker.js.map +1 -0
- package/dist/ui/live-agent-view.d.ts +82 -0
- package/dist/ui/live-agent-view.d.ts.map +1 -0
- package/dist/ui/live-agent-view.js +546 -0
- package/dist/ui/live-agent-view.js.map +1 -0
- package/dist/ui/model-picker.d.ts +109 -0
- package/dist/ui/model-picker.d.ts.map +1 -0
- package/dist/ui/model-picker.js +549 -0
- package/dist/ui/model-picker.js.map +1 -0
- package/dist/ui/settings-ui.d.ts +17 -0
- package/dist/ui/settings-ui.d.ts.map +1 -0
- package/dist/ui/settings-ui.js +679 -0
- package/dist/ui/settings-ui.js.map +1 -0
- package/dist/ui/status-ui.d.ts +67 -0
- package/dist/ui/status-ui.d.ts.map +1 -0
- package/dist/ui/status-ui.js +487 -0
- package/dist/ui/status-ui.js.map +1 -0
- package/dist/ui/thread-tree.d.ts +22 -0
- package/dist/ui/thread-tree.d.ts.map +1 -0
- package/dist/ui/thread-tree.js +153 -0
- package/dist/ui/thread-tree.js.map +1 -0
- package/dist/ui/tool-picker.d.ts +46 -0
- package/dist/ui/tool-picker.d.ts.map +1 -0
- package/dist/ui/tool-picker.js +334 -0
- package/dist/ui/tool-picker.js.map +1 -0
- package/dist/ui/transcript-tool.d.ts +2 -0
- package/dist/ui/transcript-tool.d.ts.map +1 -0
- package/dist/ui/transcript-tool.js +100 -0
- package/dist/ui/transcript-tool.js.map +1 -0
- package/dist/ui/ui.d.ts +41 -0
- package/dist/ui/ui.d.ts.map +1 -0
- package/dist/ui/ui.js +1047 -0
- package/dist/ui/ui.js.map +1 -0
- package/docs/development.md +2 -1
- package/package.json +16 -4
- package/src/index.ts +0 -920
- package/src/orch/checklist-integration.ts +0 -230
- package/src/orch/context-entries.ts +0 -15
- package/src/orch/cost-ledger.ts +0 -56
- package/src/orch/diagnostics.ts +0 -95
- package/src/orch/extensions.ts +0 -83
- package/src/orch/housekeeping-usage.ts +0 -47
- package/src/orch/housekeeping.ts +0 -348
- package/src/orch/inherited-tools.ts +0 -84
- package/src/orch/mailbox.ts +0 -261
- package/src/orch/manager.ts +0 -1084
- package/src/orch/paths.ts +0 -73
- package/src/orch/prompt.ts +0 -39
- package/src/orch/registry.ts +0 -168
- package/src/orch/runtime.ts +0 -1041
- package/src/orch/tools.ts +0 -190
- package/src/orch/transcript.ts +0 -186
- package/src/prefs/agent-import.ts +0 -245
- package/src/prefs/config.ts +0 -1017
- package/src/prefs/import-discovery.ts +0 -643
- package/src/prefs/models.ts +0 -74
- package/src/prefs/settings.ts +0 -614
- package/src/types.ts +0 -271
- package/src/ui/agent-loader.ts +0 -98
- package/src/ui/agent-navigation-editor.ts +0 -233
- package/src/ui/cost-footer.ts +0 -230
- package/src/ui/dialog.ts +0 -678
- package/src/ui/import-picker.ts +0 -231
- package/src/ui/live-agent-view.ts +0 -600
- package/src/ui/model-picker.ts +0 -701
- package/src/ui/settings-ui.ts +0 -830
- package/src/ui/status-ui.ts +0 -628
- package/src/ui/thread-tree.ts +0 -173
- package/src/ui/tool-picker.ts +0 -398
- package/src/ui/transcript-tool.ts +0 -142
- package/src/ui/ui.ts +0 -1407
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ToolExecutionComponent,
|
|
3
|
-
type ToolDefinition,
|
|
4
|
-
createBashToolDefinition,
|
|
5
|
-
createPowerShellToolDefinition,
|
|
6
|
-
createReadToolDefinition,
|
|
7
|
-
createEditToolDefinition,
|
|
8
|
-
createWriteToolDefinition,
|
|
9
|
-
createGrepToolDefinition,
|
|
10
|
-
createFindToolDefinition,
|
|
11
|
-
createLsToolDefinition,
|
|
12
|
-
} from "@earendil-works/pi-coding-agent";
|
|
13
|
-
import { Text, stripTerminalSequences, type TUI } from "@earendil-works/pi-tui";
|
|
14
|
-
|
|
15
|
-
/** Only trusted pi built-ins: observing a transcript must never execute extension renderers. */
|
|
16
|
-
type Renderers = Pick<ToolDefinition<any, any>, "renderCall" | "renderResult">;
|
|
17
|
-
const renderers = new Map<string, Renderers>(
|
|
18
|
-
[
|
|
19
|
-
createBashToolDefinition(process.cwd()),
|
|
20
|
-
createPowerShellToolDefinition(process.cwd()),
|
|
21
|
-
createReadToolDefinition(process.cwd()),
|
|
22
|
-
createEditToolDefinition(process.cwd()),
|
|
23
|
-
createWriteToolDefinition(process.cwd()),
|
|
24
|
-
createGrepToolDefinition(process.cwd()),
|
|
25
|
-
createFindToolDefinition(process.cwd()),
|
|
26
|
-
createLsToolDefinition(process.cwd()),
|
|
27
|
-
].map((tool) => [
|
|
28
|
-
tool.name,
|
|
29
|
-
{ renderCall: tool.renderCall, renderResult: tool.renderResult } as Renderers,
|
|
30
|
-
]),
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
// Native edit call previews otherwise read today's file asynchronously. An observer must
|
|
34
|
-
// use the recorded result.diff, not inspect a possibly different worktree on every paint.
|
|
35
|
-
const edit = renderers.get("edit")!;
|
|
36
|
-
const editCall = edit.renderCall!;
|
|
37
|
-
edit.renderCall = (args, theme, context) =>
|
|
38
|
-
editCall(args, theme, { ...context, argsComplete: false });
|
|
39
|
-
|
|
40
|
-
// Pi's generic fallback is unbounded. Retain the native tool box/title, but bound
|
|
41
|
-
// unknown-tool previews by visual rows (extension tools can return enormous single lines).
|
|
42
|
-
const generic: Renderers = {
|
|
43
|
-
renderResult(result, options, theme) {
|
|
44
|
-
const output = result.content
|
|
45
|
-
.filter((block) => block.type === "text")
|
|
46
|
-
.map((block) => block.text)
|
|
47
|
-
.join("\n");
|
|
48
|
-
const bounded = options.expanded ? output : output.slice(0, 32768);
|
|
49
|
-
const component = new Text(theme.fg("toolOutput", bounded), 0, 0);
|
|
50
|
-
return {
|
|
51
|
-
invalidate() {
|
|
52
|
-
component.invalidate();
|
|
53
|
-
},
|
|
54
|
-
render(width) {
|
|
55
|
-
const rows = component.render(width);
|
|
56
|
-
if (options.expanded || (rows.length <= 5 && bounded.length === output.length)) return rows;
|
|
57
|
-
return [...rows.slice(0, 5), theme.fg("muted", "… more lines (Ctrl+O to expand)")];
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
function safeText(value: string): string {
|
|
63
|
-
return stripTerminalSequences(value)
|
|
64
|
-
.replace(/\r\n?/g, "\n")
|
|
65
|
-
.replace(/[\x00-\x08\x0b-\x1f\x7f-\x9f]/g, "");
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/** Sanitize args, content AND details before trusted renderers interpolate them. */
|
|
69
|
-
function sanitize(value: unknown, seen = new WeakSet<object>(), depth = 0): any {
|
|
70
|
-
if (typeof value === "string") return safeText(value);
|
|
71
|
-
if (!value || typeof value !== "object") return typeof value === "bigint" ? String(value) : value;
|
|
72
|
-
if (seen.has(value)) return "[Circular]";
|
|
73
|
-
if (depth > 64) return "[Nested data omitted]";
|
|
74
|
-
seen.add(value);
|
|
75
|
-
const safe = Array.isArray(value)
|
|
76
|
-
? value.map((item) => sanitize(item, seen, depth + 1))
|
|
77
|
-
: Object.fromEntries(
|
|
78
|
-
Object.entries(value).map(([key, item]) => [
|
|
79
|
-
safeText(key),
|
|
80
|
-
sanitize(item, seen, depth + 1),
|
|
81
|
-
]),
|
|
82
|
-
);
|
|
83
|
-
seen.delete(value);
|
|
84
|
-
return safe;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export function renderTranscriptTool(
|
|
88
|
-
name: string,
|
|
89
|
-
id: string,
|
|
90
|
-
args: unknown,
|
|
91
|
-
result: unknown,
|
|
92
|
-
isError: boolean,
|
|
93
|
-
running: boolean,
|
|
94
|
-
detail: "full" | "preview" | "compact",
|
|
95
|
-
width: number,
|
|
96
|
-
): string[] {
|
|
97
|
-
// The native shell renderer owns elapsed-time intervals after markExecutionStarted().
|
|
98
|
-
// An observer has no execution lifecycle to dispose, so intentionally don't start that clock.
|
|
99
|
-
const ui = { requestRender() {} } as TUI;
|
|
100
|
-
const component = new ToolExecutionComponent(
|
|
101
|
-
safeText(name),
|
|
102
|
-
safeText(id),
|
|
103
|
-
sanitize(args),
|
|
104
|
-
{ showImages: false },
|
|
105
|
-
renderers.get(name) ?? generic,
|
|
106
|
-
ui,
|
|
107
|
-
process.cwd(),
|
|
108
|
-
);
|
|
109
|
-
const data =
|
|
110
|
-
result && typeof result === "object" ? (result as Record<string, unknown>) : undefined;
|
|
111
|
-
const content = data?.content ?? result;
|
|
112
|
-
component.updateResult(
|
|
113
|
-
{
|
|
114
|
-
content: (Array.isArray(content) ? content : content === undefined ? [] : [content]).map(
|
|
115
|
-
(block) => {
|
|
116
|
-
// Never hand image payloads to pi (even showImages:false can trigger Kitty conversion).
|
|
117
|
-
if (block && typeof block === "object" && (block as { type?: string }).type === "image")
|
|
118
|
-
return { type: "text", text: "[Image — text-only observer]" };
|
|
119
|
-
if (block && typeof block === "object" && (block as { type?: string }).type === "text")
|
|
120
|
-
return {
|
|
121
|
-
type: "text",
|
|
122
|
-
text: safeText(String((block as { text?: unknown }).text ?? "")),
|
|
123
|
-
};
|
|
124
|
-
return {
|
|
125
|
-
type: "text",
|
|
126
|
-
text: safeText(
|
|
127
|
-
typeof block === "string" ? block : (JSON.stringify(sanitize(block)) ?? ""),
|
|
128
|
-
),
|
|
129
|
-
};
|
|
130
|
-
},
|
|
131
|
-
),
|
|
132
|
-
details: sanitize(data?.details),
|
|
133
|
-
isError: isError || data?.isError === true,
|
|
134
|
-
},
|
|
135
|
-
running,
|
|
136
|
-
);
|
|
137
|
-
component.setExpanded(detail === "full");
|
|
138
|
-
const lines = component.render(Math.max(3, width));
|
|
139
|
-
if (detail === "compact")
|
|
140
|
-
return lines.filter((line) => stripTerminalSequences(line).trim()).slice(0, 1);
|
|
141
|
-
return lines;
|
|
142
|
-
}
|