@mariozechner/pi-coding-agent 0.46.0 → 0.48.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 +61 -1
- package/README.md +34 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +10 -1
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +16 -3
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +125 -22
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +2 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +11 -4
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +249 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +17 -0
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +52 -23
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/template.css +0 -33
- package/dist/core/export-html/template.js +171 -18
- package/dist/core/export-html/tool-renderer.d.ts +35 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +57 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +8 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +41 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +45 -6
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +5 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +22 -28
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +5 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +8 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +43 -0
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +9 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +21 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +6 -37
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +19 -14
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +2 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +4 -1
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/index.d.ts +4 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +8 -3
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/path-utils.d.ts +1 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -1
- package/dist/core/tools/path-utils.js +7 -0
- package/dist/core/tools/path-utils.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +13 -2
- package/dist/core/tools/read.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +84 -14
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +2 -2
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +2 -2
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +2 -2
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +3 -3
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +5 -3
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +12 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +3 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +7 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +140 -4
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +123 -106
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +23 -3
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +7 -2
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +7 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/utils/frontmatter.d.ts +8 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +26 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js +6 -1
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +14 -1
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/photon.d.ts +28 -0
- package/dist/utils/photon.d.ts.map +1 -0
- package/dist/utils/photon.js +51 -0
- package/dist/utils/photon.js.map +1 -0
- package/docs/extensions.md +83 -4
- package/docs/rpc.md +17 -15
- package/docs/sdk.md +1 -1
- package/docs/tree.md +20 -2
- package/docs/tui.md +26 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/modal-editor.ts +1 -1
- package/examples/extensions/overlay-test.ts +8 -3
- package/examples/extensions/question.ts +1 -1
- package/examples/extensions/questionnaire.ts +1 -1
- package/examples/extensions/rainbow-editor.ts +1 -8
- package/examples/extensions/subagent/agents.ts +3 -32
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +6 -5
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { ExtensionAPI, ExtensionCommandContext, Theme } from "@mariozechner/pi-coding-agent";
|
|
12
|
-
import { matchesKey, visibleWidth } from "@mariozechner/pi-tui";
|
|
12
|
+
import { CURSOR_MARKER, type Focusable, matchesKey, visibleWidth } from "@mariozechner/pi-tui";
|
|
13
13
|
|
|
14
14
|
export default function (pi: ExtensionAPI) {
|
|
15
15
|
pi.registerCommand("overlay-test", {
|
|
@@ -28,9 +28,12 @@ export default function (pi: ExtensionAPI) {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
class OverlayTestComponent {
|
|
31
|
+
class OverlayTestComponent implements Focusable {
|
|
32
32
|
readonly width = 70;
|
|
33
33
|
|
|
34
|
+
/** Focusable interface - set by TUI when focus changes */
|
|
35
|
+
focused = false;
|
|
36
|
+
|
|
34
37
|
private selected = 0;
|
|
35
38
|
private items = [
|
|
36
39
|
{ label: "Search", hasInput: true, text: "", cursor: 0 },
|
|
@@ -123,7 +126,9 @@ class OverlayTestComponent {
|
|
|
123
126
|
const before = inputDisplay.slice(0, item.cursor);
|
|
124
127
|
const cursorChar = item.cursor < inputDisplay.length ? inputDisplay[item.cursor] : " ";
|
|
125
128
|
const after = inputDisplay.slice(item.cursor + 1);
|
|
126
|
-
|
|
129
|
+
// Emit hardware cursor marker for IME support when focused
|
|
130
|
+
const marker = this.focused ? CURSOR_MARKER : "";
|
|
131
|
+
inputDisplay = `${before}${marker}\x1b[7m${cursorChar}\x1b[27m${after}`;
|
|
127
132
|
}
|
|
128
133
|
content = `${prefix + label} ${inputDisplay}`;
|
|
129
134
|
} else {
|
|
@@ -90,7 +90,7 @@ export default function question(pi: ExtensionAPI) {
|
|
|
90
90
|
noMatch: (t) => theme.fg("warning", t),
|
|
91
91
|
},
|
|
92
92
|
};
|
|
93
|
-
const editor = new Editor(editorTheme);
|
|
93
|
+
const editor = new Editor(tui, editorTheme);
|
|
94
94
|
|
|
95
95
|
editor.onSubmit = (value) => {
|
|
96
96
|
const trimmed = value.trim();
|
|
@@ -119,7 +119,7 @@ export default function questionnaire(pi: ExtensionAPI) {
|
|
|
119
119
|
noMatch: (t) => theme.fg("warning", t),
|
|
120
120
|
},
|
|
121
121
|
};
|
|
122
|
-
const editor = new Editor(editorTheme);
|
|
122
|
+
const editor = new Editor(tui, editorTheme);
|
|
123
123
|
|
|
124
124
|
// Helpers
|
|
125
125
|
function refresh() {
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* Usage: pi --extension ./examples/extensions/rainbow-editor.ts
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { CustomEditor, type ExtensionAPI
|
|
8
|
-
import type { EditorTheme, TUI } from "@mariozechner/pi-tui";
|
|
7
|
+
import { CustomEditor, type ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
9
8
|
|
|
10
9
|
// Base colors (coral → yellow → green → teal → blue → purple → pink)
|
|
11
10
|
const COLORS: [number, number, number][] = [
|
|
@@ -44,14 +43,8 @@ function colorize(text: string, shinePos: number): string {
|
|
|
44
43
|
|
|
45
44
|
class RainbowEditor extends CustomEditor {
|
|
46
45
|
private animationTimer?: ReturnType<typeof setInterval>;
|
|
47
|
-
private tui: TUI;
|
|
48
46
|
private frame = 0;
|
|
49
47
|
|
|
50
|
-
constructor(tui: TUI, theme: EditorTheme, keybindings: KeybindingsManager) {
|
|
51
|
-
super(theme, keybindings);
|
|
52
|
-
this.tui = tui;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
48
|
private hasUltrathink(): boolean {
|
|
56
49
|
return /ultrathink/i.test(this.getText());
|
|
57
50
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as os from "node:os";
|
|
7
7
|
import * as path from "node:path";
|
|
8
|
+
import { parseFrontmatter } from "@mariozechner/pi-coding-agent";
|
|
8
9
|
|
|
9
10
|
export type AgentScope = "user" | "project" | "both";
|
|
10
11
|
|
|
@@ -23,36 +24,6 @@ export interface AgentDiscoveryResult {
|
|
|
23
24
|
projectAgentsDir: string | null;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
function parseFrontmatter(content: string): { frontmatter: Record<string, string>; body: string } {
|
|
27
|
-
const frontmatter: Record<string, string> = {};
|
|
28
|
-
const normalized = content.replace(/\r\n/g, "\n");
|
|
29
|
-
|
|
30
|
-
if (!normalized.startsWith("---")) {
|
|
31
|
-
return { frontmatter, body: normalized };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const endIndex = normalized.indexOf("\n---", 3);
|
|
35
|
-
if (endIndex === -1) {
|
|
36
|
-
return { frontmatter, body: normalized };
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const frontmatterBlock = normalized.slice(4, endIndex);
|
|
40
|
-
const body = normalized.slice(endIndex + 4).trim();
|
|
41
|
-
|
|
42
|
-
for (const line of frontmatterBlock.split("\n")) {
|
|
43
|
-
const match = line.match(/^([\w-]+):\s*(.*)$/);
|
|
44
|
-
if (match) {
|
|
45
|
-
let value = match[2].trim();
|
|
46
|
-
if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
|
|
47
|
-
value = value.slice(1, -1);
|
|
48
|
-
}
|
|
49
|
-
frontmatter[match[1]] = value;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return { frontmatter, body };
|
|
54
|
-
}
|
|
55
|
-
|
|
56
27
|
function loadAgentsFromDir(dir: string, source: "user" | "project"): AgentConfig[] {
|
|
57
28
|
const agents: AgentConfig[] = [];
|
|
58
29
|
|
|
@@ -79,7 +50,7 @@ function loadAgentsFromDir(dir: string, source: "user" | "project"): AgentConfig
|
|
|
79
50
|
continue;
|
|
80
51
|
}
|
|
81
52
|
|
|
82
|
-
const { frontmatter, body } = parseFrontmatter(content);
|
|
53
|
+
const { frontmatter, body } = parseFrontmatter<Record<string, string>>(content);
|
|
83
54
|
|
|
84
55
|
if (!frontmatter.name || !frontmatter.description) {
|
|
85
56
|
continue;
|
|
@@ -87,7 +58,7 @@ function loadAgentsFromDir(dir: string, source: "user" | "project"): AgentConfig
|
|
|
87
58
|
|
|
88
59
|
const tools = frontmatter.tools
|
|
89
60
|
?.split(",")
|
|
90
|
-
.map((t) => t.trim())
|
|
61
|
+
.map((t: string) => t.trim())
|
|
91
62
|
.filter(Boolean);
|
|
92
63
|
|
|
93
64
|
agents.push({
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-with-deps",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-with-deps",
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.12.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ms": "^2.1.3"
|
|
12
12
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mariozechner/pi-coding-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"piConfig": {
|
|
@@ -40,9 +40,10 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@mariozechner/clipboard": "^0.3.0",
|
|
42
42
|
"@mariozechner/jiti": "^2.6.2",
|
|
43
|
-
"@mariozechner/pi-agent-core": "^0.
|
|
44
|
-
"@mariozechner/pi-ai": "^0.
|
|
45
|
-
"@mariozechner/pi-tui": "^0.
|
|
43
|
+
"@mariozechner/pi-agent-core": "^0.48.0",
|
|
44
|
+
"@mariozechner/pi-ai": "^0.48.0",
|
|
45
|
+
"@mariozechner/pi-tui": "^0.48.0",
|
|
46
|
+
"@silvia-odwyer/photon-node": "^0.3.4",
|
|
46
47
|
"chalk": "^5.5.0",
|
|
47
48
|
"cli-highlight": "^2.1.11",
|
|
48
49
|
"diff": "^8.0.2",
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"marked": "^15.0.12",
|
|
52
53
|
"minimatch": "^10.1.1",
|
|
53
54
|
"proper-lockfile": "^4.1.2",
|
|
54
|
-
"
|
|
55
|
+
"yaml": "^2.8.2"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@types/diff": "^7.0.2",
|