@mariozechner/pi-coding-agent 0.63.0 → 0.63.1

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 (40) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +2 -2
  3. package/dist/core/agent-session.d.ts +4 -3
  4. package/dist/core/agent-session.d.ts.map +1 -1
  5. package/dist/core/agent-session.js +64 -10
  6. package/dist/core/agent-session.js.map +1 -1
  7. package/dist/core/compaction/compaction.d.ts +1 -1
  8. package/dist/core/compaction/compaction.d.ts.map +1 -1
  9. package/dist/core/compaction/compaction.js +18 -17
  10. package/dist/core/compaction/compaction.js.map +1 -1
  11. package/dist/core/extensions/types.d.ts +7 -1
  12. package/dist/core/extensions/types.d.ts.map +1 -1
  13. package/dist/core/extensions/types.js.map +1 -1
  14. package/dist/core/package-manager.d.ts.map +1 -1
  15. package/dist/core/package-manager.js +34 -18
  16. package/dist/core/package-manager.js.map +1 -1
  17. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  18. package/dist/core/tools/edit-diff.js +50 -25
  19. package/dist/core/tools/edit-diff.js.map +1 -1
  20. package/dist/core/tools/edit.d.ts.map +1 -1
  21. package/dist/core/tools/edit.js +8 -1
  22. package/dist/core/tools/edit.js.map +1 -1
  23. package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
  24. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  25. package/dist/modes/interactive/components/tool-execution.js +2 -7
  26. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  27. package/dist/modes/interactive/interactive-mode.d.ts +0 -1
  28. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  29. package/dist/modes/interactive/interactive-mode.js +26 -64
  30. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  31. package/docs/extensions.md +11 -1
  32. package/docs/skills.md +3 -2
  33. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  34. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  35. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  36. package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
  37. package/examples/extensions/trigger-compact.ts +11 -1
  38. package/examples/extensions/with-deps/package-lock.json +2 -2
  39. package/examples/extensions/with-deps/package.json +1 -1
  40. package/package.json +4 -4
@@ -565,17 +565,27 @@ Before `tool_call` runs, pi waits for previously emitted Agent events to finish
565
565
 
566
566
  In the default parallel tool execution mode, sibling tool calls from the same assistant message are preflighted sequentially, then executed concurrently. `tool_call` is not guaranteed to see sibling tool results from that same assistant message in `ctx.sessionManager`.
567
567
 
568
+ `event.input` is mutable. Mutate it in place to patch tool arguments before execution.
569
+
570
+ Behavior guarantees:
571
+ - Mutations to `event.input` affect the actual tool execution
572
+ - Later `tool_call` handlers see mutations made by earlier handlers
573
+ - No re-validation is performed after your mutation
574
+ - Return values from `tool_call` only control blocking via `{ block: true, reason?: string }`
575
+
568
576
  ```typescript
569
577
  import { isToolCallEventType } from "@mariozechner/pi-coding-agent";
570
578
 
571
579
  pi.on("tool_call", async (event, ctx) => {
572
580
  // event.toolName - "bash", "read", "write", "edit", etc.
573
581
  // event.toolCallId
574
- // event.input - tool parameters
582
+ // event.input - tool parameters (mutable)
575
583
 
576
584
  // Built-in tools: no type params needed
577
585
  if (isToolCallEventType("bash", event)) {
578
586
  // event.input is { command: string; timeout?: number }
587
+ event.input.command = `source ~/.profile\n${event.input.command}`;
588
+
579
589
  if (event.input.command.includes("rm -rf")) {
580
590
  return { block: true, reason: "Dangerous command" };
581
591
  }
package/docs/skills.md CHANGED
@@ -34,8 +34,9 @@ Pi loads skills from:
34
34
  - CLI: `--skill <path>` (repeatable, additive even with `--no-skills`)
35
35
 
36
36
  Discovery rules:
37
- - Direct `.md` files in the skills directory root
38
- - Recursive `SKILL.md` files under subdirectories
37
+ - In `~/.pi/agent/skills/` and `.pi/skills/`, direct root `.md` files are discovered as individual skills
38
+ - In all skill locations, directories containing `SKILL.md` are discovered recursively
39
+ - In `~/.agents/skills/` and project `.agents/skills/`, root `.md` files are ignored
39
40
 
40
41
  Disable discovery with `--no-skills` (explicit `--skill` paths still load).
41
42
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "1.14.0",
3
+ "version": "1.14.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "1.14.0",
9
+ "version": "1.14.1",
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.14.0",
4
+ "version": "1.14.1",
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.14.0",
4
+ "version": "1.14.1",
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-qwen-cli",
3
3
  "private": true,
4
- "version": "1.13.0",
4
+ "version": "1.13.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -3,6 +3,8 @@ import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-age
3
3
  const COMPACT_THRESHOLD_TOKENS = 100_000;
4
4
 
5
5
  export default function (pi: ExtensionAPI) {
6
+ let previousTokens: number | null | undefined;
7
+
6
8
  const triggerCompaction = (ctx: ExtensionContext, customInstructions?: string) => {
7
9
  if (ctx.hasUI) {
8
10
  ctx.ui.notify("Compaction started", "info");
@@ -24,7 +26,15 @@ export default function (pi: ExtensionAPI) {
24
26
 
25
27
  pi.on("turn_end", (_event, ctx) => {
26
28
  const usage = ctx.getContextUsage();
27
- if (!usage || usage.tokens === null || usage.tokens <= COMPACT_THRESHOLD_TOKENS) {
29
+ const currentTokens = usage?.tokens ?? null;
30
+ if (currentTokens === null) {
31
+ return;
32
+ }
33
+
34
+ const crossedThreshold =
35
+ previousTokens !== undefined && previousTokens !== null && previousTokens <= COMPACT_THRESHOLD_TOKENS;
36
+ previousTokens = currentTokens;
37
+ if (!crossedThreshold || currentTokens <= COMPACT_THRESHOLD_TOKENS) {
28
38
  return;
29
39
  }
30
40
  triggerCompaction(ctx);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
- "version": "1.27.0",
3
+ "version": "1.27.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-with-deps",
9
- "version": "1.27.0",
9
+ "version": "1.27.1",
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.27.0",
4
+ "version": "1.27.1",
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.63.0",
3
+ "version": "0.63.1",
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.63.0",
44
- "@mariozechner/pi-ai": "^0.63.0",
45
- "@mariozechner/pi-tui": "^0.63.0",
43
+ "@mariozechner/pi-agent-core": "^0.63.1",
44
+ "@mariozechner/pi-ai": "^0.63.1",
45
+ "@mariozechner/pi-tui": "^0.63.1",
46
46
  "@silvia-odwyer/photon-node": "^0.3.4",
47
47
  "ajv": "^8.17.1",
48
48
  "chalk": "^5.5.0",