@mariozechner/pi-coding-agent 0.50.4 → 0.50.6

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.
@@ -654,6 +654,17 @@ ctx.compact({
654
654
  });
655
655
  ```
656
656
 
657
+ ### ctx.getSystemPrompt()
658
+
659
+ Returns the current effective system prompt. This includes any modifications made by `before_agent_start` handlers for the current turn.
660
+
661
+ ```typescript
662
+ pi.on("before_agent_start", (event, ctx) => {
663
+ const prompt = ctx.getSystemPrompt();
664
+ console.log(`System prompt length: ${prompt.length}`);
665
+ });
666
+ ```
667
+
657
668
  ## ExtensionCommandContext
658
669
 
659
670
  Command handlers receive `ExtensionCommandContext`, which extends `ExtensionContext` with session control methods. These are only available in commands because they can deadlock if called from event handlers.
@@ -1688,6 +1699,7 @@ All examples in [examples/extensions/](../examples/extensions/).
1688
1699
  | `dirty-repo-guard.ts` | Warn on dirty git repo | `on("session_before_*")`, `exec` |
1689
1700
  | `input-transform.ts` | Transform user input | `on("input")` |
1690
1701
  | `model-status.ts` | React to model changes | `on("model_select")`, `setStatus` |
1702
+ | `system-prompt-header.ts` | Display system prompt info | `on("agent_start")`, `getSystemPrompt` |
1691
1703
  | `claude-rules.ts` | Load rules from files | `on("session_start")`, `on("before_agent_start")` |
1692
1704
  | `file-trigger.ts` | File watcher triggers messages | `sendMessage` |
1693
1705
  | **Compaction & Sessions** |||
package/docs/providers.md CHANGED
@@ -75,7 +75,8 @@ Store credentials in `~/.pi/agent/auth.json`:
75
75
  {
76
76
  "anthropic": { "type": "api_key", "key": "sk-ant-..." },
77
77
  "openai": { "type": "api_key", "key": "sk-..." },
78
- "google": { "type": "api_key", "key": "..." }
78
+ "google": { "type": "api_key", "key": "..." },
79
+ "opencode": { "type": "api_key", "key": "..." }
79
80
  }
80
81
  ```
81
82
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "1.1.4",
9
+ "version": "1.1.6",
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.1.4",
4
+ "version": "1.1.6",
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.1.4",
4
+ "version": "1.1.6",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Displays a status widget showing the system prompt length.
3
+ *
4
+ * Demonstrates ctx.getSystemPrompt() for accessing the effective system prompt.
5
+ */
6
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
7
+
8
+ export default function (pi: ExtensionAPI) {
9
+ pi.on("agent_start", (_event, ctx) => {
10
+ const prompt = ctx.getSystemPrompt();
11
+ ctx.ui.setStatus("system-prompt", `System: ${prompt.length} chars`);
12
+ });
13
+
14
+ pi.on("session_shutdown", (_event, ctx) => {
15
+ ctx.ui.setStatus("system-prompt", undefined);
16
+ });
17
+ }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
- "version": "1.14.4",
3
+ "version": "1.14.6",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-with-deps",
9
- "version": "1.14.4",
9
+ "version": "1.14.6",
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.14.4",
4
+ "version": "1.14.6",
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.50.4",
3
+ "version": "0.50.6",
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
  "dependencies": {
41
41
  "@mariozechner/clipboard": "^0.3.0",
42
42
  "@mariozechner/jiti": "^2.6.2",
43
- "@mariozechner/pi-agent-core": "^0.50.4",
44
- "@mariozechner/pi-ai": "^0.50.4",
45
- "@mariozechner/pi-tui": "^0.50.4",
43
+ "@mariozechner/pi-agent-core": "^0.50.6",
44
+ "@mariozechner/pi-ai": "^0.50.6",
45
+ "@mariozechner/pi-tui": "^0.50.6",
46
46
  "@silvia-odwyer/photon-node": "^0.3.4",
47
47
  "chalk": "^5.5.0",
48
48
  "cli-highlight": "^2.1.11",