@mariozechner/pi-coding-agent 0.57.1 → 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 (53) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +2 -0
  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/extensions/index.d.ts +1 -1
  8. package/dist/core/extensions/index.d.ts.map +1 -1
  9. package/dist/core/extensions/index.js +1 -1
  10. package/dist/core/extensions/index.js.map +1 -1
  11. package/dist/core/extensions/wrapper.d.ts +4 -11
  12. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  13. package/dist/core/extensions/wrapper.js +4 -78
  14. package/dist/core/extensions/wrapper.js.map +1 -1
  15. package/dist/core/index.d.ts +1 -1
  16. package/dist/core/index.d.ts.map +1 -1
  17. package/dist/core/index.js +1 -1
  18. package/dist/core/index.js.map +1 -1
  19. package/dist/core/session-manager.d.ts +1 -0
  20. package/dist/core/session-manager.d.ts.map +1 -1
  21. package/dist/core/session-manager.js +1 -1
  22. package/dist/core/session-manager.js.map +1 -1
  23. package/dist/core/system-prompt.d.ts.map +1 -1
  24. package/dist/core/system-prompt.js +5 -15
  25. package/dist/core/system-prompt.js.map +1 -1
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +1 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/utils/exif-orientation.d.ts +5 -0
  31. package/dist/utils/exif-orientation.d.ts.map +1 -0
  32. package/dist/utils/exif-orientation.js +158 -0
  33. package/dist/utils/exif-orientation.js.map +1 -0
  34. package/dist/utils/image-convert.d.ts.map +1 -1
  35. package/dist/utils/image-convert.js +5 -1
  36. package/dist/utils/image-convert.js.map +1 -1
  37. package/dist/utils/image-resize.d.ts.map +1 -1
  38. package/dist/utils/image-resize.js +6 -1
  39. package/dist/utils/image-resize.js.map +1 -1
  40. package/docs/extensions.md +16 -5
  41. package/docs/terminal-setup.md +10 -2
  42. package/examples/extensions/antigravity-image-gen.ts +5 -4
  43. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  44. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  45. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  46. package/examples/extensions/custom-provider-gitlab-duo/test.ts +2 -2
  47. package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
  48. package/examples/extensions/preset.ts +2 -3
  49. package/examples/extensions/sandbox/index.ts +2 -3
  50. package/examples/extensions/tool-override.ts +2 -3
  51. package/examples/extensions/with-deps/package-lock.json +2 -2
  52. package/examples/extensions/with-deps/package.json +1 -1
  53. package/package.json +4 -4
@@ -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.1",
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.1",
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.1",
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.1",
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.1",
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.1",
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.1",
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.1",
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.1",
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.1",
44
- "@mariozechner/pi-ai": "^0.57.1",
45
- "@mariozechner/pi-tui": "^0.57.1",
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",