@mariozechner/pi-coding-agent 0.57.0 → 0.58.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.
Files changed (85) hide show
  1. package/CHANGELOG.md +59 -1
  2. package/README.md +3 -1
  3. package/dist/core/agent-session.d.ts +9 -0
  4. package/dist/core/agent-session.d.ts.map +1 -1
  5. package/dist/core/agent-session.js +57 -9
  6. package/dist/core/agent-session.js.map +1 -1
  7. package/dist/core/export-html/index.d.ts +5 -2
  8. package/dist/core/export-html/index.d.ts.map +1 -1
  9. package/dist/core/export-html/index.js +4 -3
  10. package/dist/core/export-html/index.js.map +1 -1
  11. package/dist/core/export-html/template.js +11 -14
  12. package/dist/core/export-html/tool-renderer.d.ts +5 -2
  13. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  14. package/dist/core/export-html/tool-renderer.js +12 -5
  15. package/dist/core/export-html/tool-renderer.js.map +1 -1
  16. package/dist/core/extensions/index.d.ts +2 -2
  17. package/dist/core/extensions/index.d.ts.map +1 -1
  18. package/dist/core/extensions/index.js +1 -1
  19. package/dist/core/extensions/index.js.map +1 -1
  20. package/dist/core/extensions/types.d.ts +13 -1
  21. package/dist/core/extensions/types.d.ts.map +1 -1
  22. package/dist/core/extensions/types.js.map +1 -1
  23. package/dist/core/extensions/wrapper.d.ts +4 -11
  24. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  25. package/dist/core/extensions/wrapper.js +4 -78
  26. package/dist/core/extensions/wrapper.js.map +1 -1
  27. package/dist/core/index.d.ts +1 -1
  28. package/dist/core/index.d.ts.map +1 -1
  29. package/dist/core/index.js +1 -1
  30. package/dist/core/index.js.map +1 -1
  31. package/dist/core/resource-loader.d.ts.map +1 -1
  32. package/dist/core/resource-loader.js +1 -1
  33. package/dist/core/resource-loader.js.map +1 -1
  34. package/dist/core/session-manager.d.ts +1 -0
  35. package/dist/core/session-manager.d.ts.map +1 -1
  36. package/dist/core/session-manager.js +1 -1
  37. package/dist/core/session-manager.js.map +1 -1
  38. package/dist/core/system-prompt.d.ts.map +1 -1
  39. package/dist/core/system-prompt.js +5 -15
  40. package/dist/core/system-prompt.js.map +1 -1
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +1 -1
  44. package/dist/index.js.map +1 -1
  45. package/dist/main.d.ts.map +1 -1
  46. package/dist/main.js +41 -11
  47. package/dist/main.js.map +1 -1
  48. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  49. package/dist/modes/interactive/components/extension-editor.js +1 -0
  50. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  51. package/dist/modes/interactive/components/tree-selector.d.ts +17 -0
  52. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  53. package/dist/modes/interactive/components/tree-selector.js +111 -6
  54. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  55. package/dist/modes/interactive/interactive-mode.d.ts +1 -0
  56. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  57. package/dist/modes/interactive/interactive-mode.js +45 -0
  58. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  59. package/dist/utils/exif-orientation.d.ts +5 -0
  60. package/dist/utils/exif-orientation.d.ts.map +1 -0
  61. package/dist/utils/exif-orientation.js +158 -0
  62. package/dist/utils/exif-orientation.js.map +1 -0
  63. package/dist/utils/image-convert.d.ts.map +1 -1
  64. package/dist/utils/image-convert.js +5 -1
  65. package/dist/utils/image-convert.js.map +1 -1
  66. package/dist/utils/image-resize.d.ts.map +1 -1
  67. package/dist/utils/image-resize.js +6 -1
  68. package/dist/utils/image-resize.js.map +1 -1
  69. package/docs/extensions.md +41 -7
  70. package/docs/keybindings.md +9 -1
  71. package/docs/terminal-setup.md +28 -3
  72. package/docs/tmux.md +30 -8
  73. package/docs/tree.md +9 -0
  74. package/examples/extensions/antigravity-image-gen.ts +5 -4
  75. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  76. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  77. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  78. package/examples/extensions/custom-provider-gitlab-duo/test.ts +2 -2
  79. package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
  80. package/examples/extensions/preset.ts +2 -3
  81. package/examples/extensions/sandbox/index.ts +2 -3
  82. package/examples/extensions/tool-override.ts +2 -3
  83. package/examples/extensions/with-deps/package-lock.json +2 -2
  84. package/examples/extensions/with-deps/package.json +1 -1
  85. package/package.json +4 -4
package/docs/tree.md CHANGED
@@ -33,16 +33,25 @@ Sessions are stored as trees where each entry has an `id` and `parentId`. The "l
33
33
  | Key | Action |
34
34
  |-----|--------|
35
35
  | ↑/↓ | Navigate (depth-first order) |
36
+ | ←/→ | Page up/down |
37
+ | Ctrl+←/Ctrl+→ or Alt+←/Alt+→ | Fold/unfold and jump between branch segments |
36
38
  | Enter | Select node |
37
39
  | Escape/Ctrl+C | Cancel |
38
40
  | Ctrl+U | Toggle: user messages only |
39
41
  | Ctrl+O | Toggle: show all (including custom/label entries) |
40
42
 
43
+ `Ctrl+←` or `Alt+←` folds the current node if it is foldable. Foldable nodes are roots and branch segment starts that have visible children. If the current node is not foldable, or is already folded, the selection jumps up to the previous visible branch segment start.
44
+
45
+ `Ctrl+→` or `Alt+→` unfolds the current node if it is folded. Otherwise, the selection jumps down to the next visible branch segment start, or to the branch end when there is no further branch point.
46
+
41
47
  ### Display
42
48
 
43
49
  - Height: half terminal height
44
50
  - Current leaf marked with `← active`
45
51
  - Labels shown inline: `[label-name]`
52
+ - Foldable branch starts show `⊟` in the connector. Folded branches show `⊞`
53
+ - Active path marker `•` appears after the fold indicator when applicable
54
+ - Search and filter changes reset all folds
46
55
  - Default filter hides `label` and `custom` entries (shown in Ctrl+O mode)
47
56
  - Children sorted by timestamp (oldest first)
48
57
 
@@ -28,10 +28,9 @@
28
28
  import { randomUUID } from "node:crypto";
29
29
  import { existsSync, readFileSync } from "node:fs";
30
30
  import { mkdir, writeFile } from "node:fs/promises";
31
- import { homedir } from "node:os";
32
31
  import { join } from "node:path";
33
32
  import { StringEnum } from "@mariozechner/pi-ai";
34
- import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
33
+ import { type ExtensionAPI, getAgentDir } from "@mariozechner/pi-coding-agent";
35
34
  import { type Static, Type } from "@sinclair/typebox";
36
35
 
37
36
  const PROVIDER = "google-antigravity";
@@ -184,7 +183,8 @@ function readConfigFile(path: string): ExtensionConfig {
184
183
  }
185
184
 
186
185
  function loadConfig(cwd: string): ExtensionConfig {
187
- const globalConfig = readConfigFile(join(homedir(), ".pi", "agent", "extensions", "antigravity-image-gen.json"));
186
+ const globalPath = join(getAgentDir(), "extensions", "antigravity-image-gen.json");
187
+ const globalConfig = readConfigFile(globalPath);
188
188
  const projectConfig = readConfigFile(join(cwd, ".pi", "extensions", "antigravity-image-gen.json"));
189
189
  return { ...globalConfig, ...projectConfig };
190
190
  }
@@ -204,7 +204,8 @@ function resolveSaveConfig(params: ToolParams, cwd: string): SaveConfig {
204
204
  }
205
205
 
206
206
  if (mode === "global") {
207
- return { mode, outputDir: join(homedir(), ".pi", "agent", "generated-images") };
207
+ const outputDir = join(getAgentDir(), "generated-images");
208
+ return { mode, outputDir };
208
209
  }
209
210
 
210
211
  if (mode === "custom") {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "1.8.0",
9
+ "version": "1.9.0",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "1.8.0",
4
+ "version": "1.9.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "1.8.0",
4
+ "version": "1.9.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -10,7 +10,7 @@
10
10
 
11
11
  import { type Api, type Context, type Model, registerApiProvider, streamSimple } from "@mariozechner/pi-ai";
12
12
  import { readFileSync } from "fs";
13
- import { homedir } from "os";
13
+ import { getAgentDir } from "packages/coding-agent/src/config.js";
14
14
  import { join } from "path";
15
15
  import { MODELS, streamGitLabDuo } from "./index.js";
16
16
 
@@ -28,7 +28,7 @@ async function main() {
28
28
  }
29
29
 
30
30
  // Read auth
31
- const authPath = join(homedir(), ".pi", "agent", "auth.json");
31
+ const authPath = join(getAgentDir(), "extensions", "auth.json");
32
32
  const authData = JSON.parse(readFileSync(authPath, "utf-8"));
33
33
  const gitlabCred = authData["gitlab-duo"];
34
34
  if (!gitlabCred?.access) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-qwen-cli",
3
3
  "private": true,
4
- "version": "1.7.0",
4
+ "version": "1.8.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -39,10 +39,9 @@
39
39
  */
40
40
 
41
41
  import { existsSync, readFileSync } from "node:fs";
42
- import { homedir } from "node:os";
43
42
  import { join } from "node:path";
44
43
  import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
45
- import { DynamicBorder } from "@mariozechner/pi-coding-agent";
44
+ import { DynamicBorder, getAgentDir } from "@mariozechner/pi-coding-agent";
46
45
  import { Container, Key, type SelectItem, SelectList, Text } from "@mariozechner/pi-tui";
47
46
 
48
47
  // Preset configuration
@@ -68,7 +67,7 @@ interface PresetsConfig {
68
67
  * Project-local presets override global presets with the same name.
69
68
  */
70
69
  function loadPresets(cwd: string): PresetsConfig {
71
- const globalPath = join(homedir(), ".pi", "agent", "presets.json");
70
+ const globalPath = join(getAgentDir(), "presets.json");
72
71
  const projectPath = join(cwd, ".pi", "presets.json");
73
72
 
74
73
  let globalPresets: PresetsConfig = {};
@@ -39,11 +39,10 @@
39
39
 
40
40
  import { spawn } from "node:child_process";
41
41
  import { existsSync, readFileSync } from "node:fs";
42
- import { homedir } from "node:os";
43
42
  import { join } from "node:path";
44
43
  import { SandboxManager, type SandboxRuntimeConfig } from "@anthropic-ai/sandbox-runtime";
45
44
  import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
46
- import { type BashOperations, createBashTool } from "@mariozechner/pi-coding-agent";
45
+ import { type BashOperations, createBashTool, getAgentDir } from "@mariozechner/pi-coding-agent";
47
46
 
48
47
  interface SandboxConfig extends SandboxRuntimeConfig {
49
48
  enabled?: boolean;
@@ -75,7 +74,7 @@ const DEFAULT_CONFIG: SandboxConfig = {
75
74
 
76
75
  function loadConfig(cwd: string): SandboxConfig {
77
76
  const projectConfigPath = join(cwd, ".pi", "sandbox.json");
78
- const globalConfigPath = join(homedir(), ".pi", "agent", "sandbox.json");
77
+ const globalConfigPath = join(getAgentDir(), "extensions", "sandbox.json");
79
78
 
80
79
  let globalConfig: Partial<SandboxConfig> = {};
81
80
  let projectConfig: Partial<SandboxConfig> = {};
@@ -21,14 +21,13 @@
21
21
  */
22
22
 
23
23
  import type { TextContent } from "@mariozechner/pi-ai";
24
- import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
24
+ import { type ExtensionAPI, getAgentDir } from "@mariozechner/pi-coding-agent";
25
25
  import { Type } from "@sinclair/typebox";
26
26
  import { appendFileSync, constants, readFileSync } from "fs";
27
27
  import { access, readFile } from "fs/promises";
28
- import { homedir } from "os";
29
28
  import { join, resolve } from "path";
30
29
 
31
- const LOG_FILE = join(homedir(), ".pi", "agent", "read-access.log");
30
+ const LOG_FILE = join(getAgentDir(), "read-access.log");
32
31
 
33
32
  // Paths that are blocked from reading
34
33
  const BLOCKED_PATTERNS = [
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-with-deps",
9
- "version": "1.21.0",
9
+ "version": "1.22.0",
10
10
  "dependencies": {
11
11
  "ms": "^2.1.3"
12
12
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
3
  "private": true,
4
- "version": "1.21.0",
4
+ "version": "1.22.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mariozechner/pi-coding-agent",
3
- "version": "0.57.0",
3
+ "version": "0.58.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,9 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@mariozechner/jiti": "^2.6.2",
43
- "@mariozechner/pi-agent-core": "^0.57.0",
44
- "@mariozechner/pi-ai": "^0.57.0",
45
- "@mariozechner/pi-tui": "^0.57.0",
43
+ "@mariozechner/pi-agent-core": "^0.58.0",
44
+ "@mariozechner/pi-ai": "^0.58.0",
45
+ "@mariozechner/pi-tui": "^0.58.0",
46
46
  "@silvia-odwyer/photon-node": "^0.3.4",
47
47
  "chalk": "^5.5.0",
48
48
  "cli-highlight": "^2.1.11",