@astralyn/pi 0.82.2 → 0.82.3

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 (78) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +70 -634
  3. package/dist/core/extensions/types.d.ts +2 -0
  4. package/dist/core/extensions/types.d.ts.map +1 -1
  5. package/dist/core/extensions/types.js.map +1 -1
  6. package/dist/core/model-resolver.d.ts +1 -0
  7. package/dist/core/model-resolver.d.ts.map +1 -1
  8. package/dist/core/model-resolver.js +13 -3
  9. package/dist/core/model-resolver.js.map +1 -1
  10. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  11. package/dist/core/remote-catalog-provider.js +19 -1
  12. package/dist/core/remote-catalog-provider.js.map +1 -1
  13. package/dist/core/resource-loader.d.ts.map +1 -1
  14. package/dist/core/resource-loader.js +3 -0
  15. package/dist/core/resource-loader.js.map +1 -1
  16. package/dist/extensions/llama/provider.d.ts.map +1 -1
  17. package/dist/extensions/llama/provider.js +6 -0
  18. package/dist/extensions/llama/provider.js.map +1 -1
  19. package/dist/modes/interactive/components/custom-message.d.ts +3 -1
  20. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  21. package/dist/modes/interactive/components/custom-message.js +10 -2
  22. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  23. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  24. package/dist/modes/interactive/components/scoped-models-selector.js +22 -13
  25. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  26. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  27. package/dist/modes/interactive/interactive-mode.js +28 -16
  28. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  29. package/docs/bundled/README.md +38 -0
  30. package/docs/bundled/extensions/README.md +18 -0
  31. package/docs/{distribution → bundled}/extensions/question.md +0 -11
  32. package/docs/{distribution → bundled}/extensions/rewind.md +0 -10
  33. package/docs/{distribution → bundled}/extensions/router.md +1 -14
  34. package/docs/{distribution → bundled}/extensions/statusline.md +1 -2
  35. package/docs/{distribution → bundled}/extensions/subagent.md +0 -7
  36. package/docs/bundled/extensions/todo.md +28 -0
  37. package/docs/{distribution → bundled}/themes.md +4 -11
  38. package/docs/{distribution → bundled}/tool-presentation.md +4 -10
  39. package/docs/compaction.md +12 -12
  40. package/docs/custom-provider.md +8 -8
  41. package/docs/docs.json +57 -9
  42. package/docs/extensions.md +10 -11
  43. package/docs/index.md +12 -7
  44. package/docs/json.md +4 -4
  45. package/docs/providers.md +1 -1
  46. package/docs/rpc.md +3 -9
  47. package/docs/session-format.md +5 -5
  48. package/docs/skills.md +1 -1
  49. package/docs/themes.md +4 -8
  50. package/docs/tui.md +1 -1
  51. package/examples/extensions/README.md +0 -1
  52. package/examples/extensions/custom-provider-anthropic/index.ts +4 -4
  53. package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
  54. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  55. package/examples/extensions/gondolin/index.ts +4 -6
  56. package/examples/extensions/message-renderer.ts +2 -2
  57. package/examples/extensions/overlay-qa-tests.ts +2 -2
  58. package/examples/extensions/project-trust.ts +2 -2
  59. package/examples/sdk/README.md +38 -44
  60. package/npm-shrinkwrap.json +2 -2
  61. package/package.json +6 -2
  62. package/docs/development.md +0 -68
  63. package/docs/distribution/README.md +0 -34
  64. package/docs/distribution/architecture.md +0 -102
  65. package/docs/distribution/extensions/README.md +0 -17
  66. package/docs/distribution/maintenance.md +0 -121
  67. package/docs/distribution/release.md +0 -85
  68. package/examples/extensions/subagent/README.md +0 -175
  69. package/examples/extensions/subagent/agents/planner.md +0 -37
  70. package/examples/extensions/subagent/agents/reviewer.md +0 -35
  71. package/examples/extensions/subagent/agents/scout.md +0 -50
  72. package/examples/extensions/subagent/agents/worker.md +0 -24
  73. package/examples/extensions/subagent/agents.ts +0 -126
  74. package/examples/extensions/subagent/index.ts +0 -1009
  75. package/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
  76. package/examples/extensions/subagent/prompts/implement.md +0 -10
  77. package/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
  78. /package/docs/{distribution → bundled}/extensions/deepwiki.md +0 -0
@@ -28,11 +28,11 @@ Existing sessions are automatically migrated to the current version (v3) when lo
28
28
 
29
29
  ## Source Files
30
30
 
31
- Source on GitHub ([pi-mono](https://github.com/earendil-works/pi-mono)):
32
- - [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/session-manager.ts) - Session entry types and SessionManager
33
- - [`packages/coding-agent/src/core/messages.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/messages.ts) - Extended message types (BashExecutionMessage, CustomMessage, etc.)
34
- - [`packages/ai/src/types.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/types.ts) - Base message types (UserMessage, AssistantMessage, ToolResultMessage)
35
- - [`packages/agent/src/types.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/agent/src/types.ts) - AgentMessage union type
31
+ Distribution source on GitHub ([ming-kang/pi](https://github.com/ming-kang/pi)):
32
+ - [`src/core/session-manager.ts`](https://github.com/ming-kang/pi/blob/main/src/core/session-manager.ts) - Session entry types and SessionManager
33
+ - [`src/core/messages.ts`](https://github.com/ming-kang/pi/blob/main/src/core/messages.ts) - Extended message types (BashExecutionMessage, CustomMessage, etc.)
34
+ - [`packages/ai/src/types.ts`](https://github.com/earendil-works/pi/blob/v0.82.1/packages/ai/src/types.ts) - Base message types (UserMessage, AssistantMessage, ToolResultMessage)
35
+ - [`packages/agent/src/types.ts`](https://github.com/earendil-works/pi/blob/v0.82.1/packages/agent/src/types.ts) - AgentMessage union type
36
36
 
37
37
  For TypeScript definitions in your project, inspect `node_modules/@astralyn/pi/dist/` and `node_modules/@earendil-works/pi-ai/dist/`.
38
38
 
package/docs/skills.md CHANGED
@@ -131,7 +131,7 @@ cd /path/to/skill && npm install
131
131
  Use relative paths from the skill directory:
132
132
 
133
133
  ```markdown
134
- See [the reference guide](references/REFERENCE.md) for details.
134
+ See the reference guide at `references/REFERENCE.md` for details.
135
135
  ```
136
136
 
137
137
  ## Frontmatter
package/docs/themes.md CHANGED
@@ -52,7 +52,7 @@ vim ~/.pi/agent/themes/my-theme.json
52
52
 
53
53
  ```json
54
54
  {
55
- "$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
55
+ "$schema": "https://raw.githubusercontent.com/ming-kang/pi/main/src/modes/interactive/theme/theme-schema.json",
56
56
  "name": "my-theme",
57
57
  "vars": {
58
58
  "primary": "#00aaff",
@@ -123,7 +123,7 @@ vim ~/.pi/agent/themes/my-theme.json
123
123
 
124
124
  ```json
125
125
  {
126
- "$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
126
+ "$schema": "https://raw.githubusercontent.com/ming-kang/pi/main/src/modes/interactive/theme/theme-schema.json",
127
127
  "name": "my-theme",
128
128
  "vars": {
129
129
  "blue": "#0066cc",
@@ -292,10 +292,6 @@ echo $COLORTERM # Should output "truecolor" or "24bit"
292
292
 
293
293
  ## Examples
294
294
 
295
- See the built-in themes:
296
- - [dark.json](../src/modes/interactive/theme/dark.json)
297
- - [light.json](../src/modes/interactive/theme/light.json)
298
- - [ice-cream-dark.json](../src/modes/interactive/theme/ice-cream-dark.json)
299
- - [ice-cream-light.json](../src/modes/interactive/theme/ice-cream-light.json)
295
+ The built-in themes are selected by name: `dark`, `light`, `ice-cream-dark`, and `ice-cream-light`. When inspecting an installed package, their JSON assets are under `node_modules/@astralyn/pi/dist/modes/interactive/theme/` (the global-install equivalent is under Pi's npm package directory).
300
296
 
301
- The ice-cream palette and distribution-specific design notes are documented in [`docs/distribution/themes.md`](distribution/themes.md).
297
+ The ice-cream palette and bundled design notes are documented in [Bundled themes](bundled/themes.md).
package/docs/tui.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Extensions and custom tools can render custom TUI components for interactive user interfaces. This page covers the component system and available building blocks.
6
6
 
7
- **Source:** [`@earendil-works/pi-tui`](https://github.com/earendil-works/pi-mono/tree/main/packages/tui)
7
+ **Source:** [`@earendil-works/pi-tui@0.82.1`](https://github.com/earendil-works/pi/tree/v0.82.1/packages/tui)
8
8
 
9
9
  ## Component Interface
10
10
 
@@ -42,7 +42,6 @@ cp permission-gate.ts ~/.pi/agent/extensions/
42
42
  | `minimal-mode.ts` | Override built-in tool rendering for minimal display (only tool calls, no output in collapsed mode) |
43
43
  | `truncated-tool.ts` | Wraps ripgrep with proper output truncation (50KB/2000 lines) |
44
44
  | `ssh.ts` | Delegate all tools to a remote machine via SSH using pluggable operations |
45
- | `subagent/` | Delegate tasks to specialized subagents with isolated context windows |
46
45
 
47
46
  ### Commands & UI
48
47
 
@@ -8,15 +8,15 @@
8
8
  * - API key support via environment variable
9
9
  * - Two model definitions
10
10
  *
11
- * Usage:
11
+ * Usage (from the repository or package root):
12
12
  * # First install dependencies
13
- * cd packages/coding-agent/examples/extensions/custom-provider && npm install
13
+ * npm install --prefix examples/extensions/custom-provider-anthropic
14
14
  *
15
15
  * # With OAuth (run /login custom-anthropic first)
16
- * pi -e ./packages/coding-agent/examples/extensions/custom-provider
16
+ * pi -e examples/extensions/custom-provider-anthropic
17
17
  *
18
18
  * # With API key
19
- * CUSTOM_ANTHROPIC_API_KEY=sk-ant-... pi -e ./packages/coding-agent/examples/extensions/custom-provider
19
+ * CUSTOM_ANTHROPIC_API_KEY=sk-ant-... pi -e examples/extensions/custom-provider-anthropic
20
20
  *
21
21
  * Then use /model to select custom-anthropic/claude-sonnet-4-5
22
22
  */
@@ -4,8 +4,8 @@
4
4
  * Provides access to GitLab Duo AI models (Claude and GPT) through GitLab's AI Gateway.
5
5
  * Delegates to pi-ai's built-in Anthropic and OpenAI streaming implementations.
6
6
  *
7
- * Usage:
8
- * pi -e ./packages/coding-agent/examples/extensions/custom-provider-gitlab-duo
7
+ * Usage (from the repository or package root):
8
+ * pi -e examples/extensions/custom-provider-gitlab-duo
9
9
  * # Then /login gitlab-duo, or set GITLAB_TOKEN=glpat-...
10
10
  */
11
11
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
2
+ "$schema": "https://raw.githubusercontent.com/ming-kang/pi/main/src/modes/interactive/theme/theme-schema.json",
3
3
  "name": "dynamic-resources",
4
4
  "vars": {
5
5
  "cyan": "#00d7ff",
@@ -6,13 +6,11 @@
6
6
  * /workspace write through to the host; other guest filesystem changes are
7
7
  * isolated to the VM.
8
8
  *
9
- * Setup:
10
- * cd packages/coding-agent/examples/extensions/gondolin
11
- * npm install --ignore-scripts
9
+ * Setup (from the repository or package root):
10
+ * npm install --ignore-scripts --prefix examples/extensions/gondolin
12
11
  *
13
- * Usage:
14
- * cd /path/to/project
15
- * pi -e /path/to/pi/packages/coding-agent/examples/extensions/gondolin
12
+ * Usage (from the project that should be mounted at /workspace):
13
+ * pi -e /absolute/path/to/pi/examples/extensions/gondolin
16
14
  *
17
15
  * Requirements:
18
16
  * - Node.js >= 23.6.0 for @earendil-works/gondolin
@@ -12,7 +12,7 @@ import { Box, Text } from "@earendil-works/pi-tui";
12
12
 
13
13
  export default function (pi: ExtensionAPI) {
14
14
  // Register custom renderer for "status-update" messages
15
- pi.registerMessageRenderer("status-update", (message, { expanded }, theme) => {
15
+ pi.registerMessageRenderer("status-update", (message, { expanded, outputPad }, theme) => {
16
16
  const details = message.details as { level: string; timestamp: number } | undefined;
17
17
  const level = details?.level ?? "info";
18
18
 
@@ -29,7 +29,7 @@ export default function (pi: ExtensionAPI) {
29
29
  }
30
30
 
31
31
  // Use Box with customMessageBg for consistent styling
32
- const box = new Box(1, 1, (t) => theme.bg("customMessageBg", t));
32
+ const box = new Box(outputPad, 1, (t) => theme.bg("customMessageBg", t));
33
33
  box.addChild(new Text(text, 0, 0));
34
34
  return box;
35
35
  });
@@ -485,13 +485,13 @@ class StreamingOverflowComponent extends BaseOverlay {
485
485
  echo ""
486
486
  for i in $(seq 1 100); do
487
487
  # Simulate long file paths with OSC 8 hyperlinks (clickable) - tests width overflow
488
- DIR="/Users/nicobailon/Documents/development/pi-mono/packages/coding-agent/src/modes/interactive"
488
+ DIR="/opt/overlay-qa-fixtures/a-deliberately-long-project-directory/src/modes/interactive"
489
489
  FILE="\${DIR}/components/very-long-component-name-that-exceeds-width-\${i}.ts"
490
490
  echo -e "\\033]8;;file://\${FILE}\\007▶ read: \${FILE}\\033]8;;\\007"
491
491
 
492
492
  # Add some colored status messages with long text
493
493
  if [ $((i % 5)) -eq 0 ]; then
494
- echo -e " \\033[32m✓ Successfully processed \${i} files in /Users/nicobailon/Documents/development/pi-mono\\033[0m"
494
+ echo -e " \\033[32m✓ Successfully processed \${i} files in \${DIR}\\033[0m"
495
495
  fi
496
496
  if [ $((i % 7)) -eq 0 ]; then
497
497
  echo -e " \\033[33m⚠ Warning: potential issue detected at line \${i} in very-long-component-name-that-exceeds-width.ts\\033[0m"
@@ -4,11 +4,11 @@
4
4
  * Demonstrates the project_trust event. Install globally or pass via -e:
5
5
  *
6
6
  * mkdir -p ~/.pi/agent/extensions
7
- * cp packages/coding-agent/examples/extensions/project-trust.ts ~/.pi/agent/extensions/
7
+ * cp examples/extensions/project-trust.ts ~/.pi/agent/extensions/
8
8
  *
9
9
  * Or:
10
10
  *
11
- * pi -e packages/coding-agent/examples/extensions/project-trust.ts
11
+ * pi -e examples/extensions/project-trust.ts
12
12
  *
13
13
  * Try it in a project containing .pi, AGENTS.md/CLAUDE.md, or .agents/skills.
14
14
  */
@@ -1,6 +1,6 @@
1
1
  # SDK Examples
2
2
 
3
- Programmatic usage of pi-coding-agent via `createAgentSession()` and `createAgentSessionRuntime()`.
3
+ Programmatic usage of `@astralyn/pi` via `createAgentSession()` and `createAgentSessionRuntime()`.
4
4
 
5
5
  The runtime example shows how to build a recreate function that closes over process-global fixed inputs and recreates cwd-bound services and sessions as the active session cwd changes.
6
6
 
@@ -15,7 +15,7 @@ The runtime example shows how to build a recreate function that closes over proc
15
15
  | `05-tools.ts` | Built-in tool allowlists |
16
16
  | `06-extensions.ts` | Logging, blocking, result modification |
17
17
  | `07-context-files.ts` | AGENTS.md context files |
18
- | `08-slash-commands.ts` | File-based slash commands |
18
+ | `08-prompt-templates.ts` | File-based prompt templates |
19
19
  | `09-api-keys-and-oauth.ts` | API key resolution, OAuth config |
20
20
  | `10-settings.ts` | Override compaction, retry, terminal settings |
21
21
  | `11-sessions.ts` | In-memory, persistent, continue, list sessions |
@@ -24,75 +24,69 @@ The runtime example shows how to build a recreate function that closes over proc
24
24
 
25
25
  ## Running
26
26
 
27
+ From the repository root, or from the root of an unpacked npm package:
28
+
27
29
  ```bash
28
- cd packages/coding-agent
29
30
  npx tsx examples/sdk/01-minimal.ts
30
31
  ```
31
32
 
32
33
  ## Quick Reference
33
34
 
34
35
  ```typescript
35
- import { getModel } from "@earendil-works/pi-ai";
36
36
  import {
37
37
  createAgentSession,
38
38
  DefaultResourceLoader,
39
+ getAgentDir,
39
40
  ModelRuntime,
40
41
  SessionManager,
41
42
  SettingsManager,
42
43
  } from "@astralyn/pi";
44
+ import { getModel } from "@earendil-works/pi-ai/compat";
43
45
 
44
- const modelRuntime = await ModelRuntime.create();
45
-
46
- // Minimal
47
- const { session } = await createAgentSession({ modelRuntime });
46
+ // Minimal: uses the default model, resources, tools, settings, and session storage.
47
+ const { session } = await createAgentSession();
48
48
 
49
- // Custom model
49
+ // Select a built-in model.
50
+ const modelRuntime = await ModelRuntime.create();
50
51
  const model = getModel("anthropic", "claude-opus-4-5");
51
- const { session } = await createAgentSession({ model, thinkingLevel: "high", modelRuntime });
52
-
53
- // Modify prompt
54
- const loader = new DefaultResourceLoader({
55
- systemPromptOverride: (base) => `${base}\n\nBe concise.`,
52
+ if (model) {
53
+ const { session: modelSession } = await createAgentSession({
54
+ model,
55
+ thinkingLevel: "high",
56
+ modelRuntime,
57
+ });
58
+ }
59
+
60
+ // Replace the system prompt.
61
+ const resourceLoader = new DefaultResourceLoader({
62
+ cwd: process.cwd(),
63
+ agentDir: getAgentDir(),
64
+ systemPromptOverride: () => "You are helpful and concise.",
65
+ appendSystemPromptOverride: () => [],
56
66
  });
57
- await loader.reload();
58
- const { session } = await createAgentSession({ resourceLoader: loader, modelRuntime });
59
-
60
- // Read-only
61
- const { session } = await createAgentSession({ tools: ["read", "grep", "find", "ls"], modelRuntime });
62
-
63
- // In-memory
64
- const { session } = await createAgentSession({
67
+ await resourceLoader.reload();
68
+ const { session: promptSession } = await createAgentSession({
69
+ resourceLoader,
65
70
  sessionManager: SessionManager.inMemory(),
66
- modelRuntime,
67
71
  });
68
72
 
69
- // Full control
70
- const customRuntime = await ModelRuntime.create({
71
- authPath: "/my/app/auth.json",
72
- modelsPath: "/my/app/models.json",
73
+ // Enable only read-only built-in tools and keep the session in memory.
74
+ const { session: readOnlySession } = await createAgentSession({
75
+ tools: ["read", "grep", "find", "ls"],
76
+ sessionManager: SessionManager.inMemory(),
73
77
  });
74
- customRuntime.setRuntimeApiKey("anthropic", process.env.MY_KEY!);
75
78
 
76
- const resourceLoader = new DefaultResourceLoader({
77
- systemPromptOverride: () => "You are helpful.",
78
- extensionFactories: [myExtension],
79
- skillsOverride: () => ({ skills: [], diagnostics: [] }),
80
- agentsFilesOverride: () => ({ agentsFiles: [] }),
81
- promptsOverride: () => ({ prompts: [], diagnostics: [] }),
79
+ // Override settings without file I/O.
80
+ const settingsManager = SettingsManager.inMemory({
81
+ compaction: { enabled: false },
82
+ retry: { enabled: true, maxRetries: 2 },
82
83
  });
83
- await resourceLoader.reload();
84
-
85
- const { session } = await createAgentSession({
86
- model,
87
- modelRuntime: customRuntime,
88
- resourceLoader,
89
- tools: ["read", "bash", "my_tool"],
90
- customTools: [myTool],
84
+ const { session: configuredSession } = await createAgentSession({
85
+ settingsManager,
91
86
  sessionManager: SessionManager.inMemory(),
92
- settingsManager: SettingsManager.inMemory(),
93
87
  });
94
88
 
95
- // Run prompts
89
+ // Stream a response.
96
90
  session.subscribe((event) => {
97
91
  if (event.type === "message_update" && event.assistantMessageEvent.type === "text_delta") {
98
92
  process.stdout.write(event.assistantMessageEvent.delta);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@astralyn/pi",
3
- "version": "0.82.2",
3
+ "version": "0.82.3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@astralyn/pi",
9
- "version": "0.82.2",
9
+ "version": "0.82.3",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@earendil-works/pi-agent-core": "0.82.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astralyn/pi",
3
- "version": "0.82.2",
3
+ "version": "0.82.3",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "piConfig": {
@@ -31,11 +31,15 @@
31
31
  "clean": "shx rm -rf dist",
32
32
  "build": "tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js dist/rpc-entry.js && npm run copy-assets",
33
33
  "copy-assets": "shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/modes/interactive/assets && shx cp src/modes/interactive/assets/*.png dist/modes/interactive/assets/ && shx mkdir -p dist/core/export-html/vendor && shx cp src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/core/export-html/ && shx cp src/core/export-html/vendor/*.js dist/core/export-html/vendor/",
34
+ "dev": "node scripts/run-source.mjs",
34
35
  "format": "biome check --write .",
35
- "check": "biome check --error-on-warnings . && npm run check:pinned-deps && npm run check:ts-imports && tsgo --noEmit && tsgo -p tsconfig.examples.json",
36
+ "check": "biome check --error-on-warnings . && npm run check:pinned-deps && npm run check:ts-imports && npm run check:docs && tsgo --noEmit && tsgo -p tsconfig.examples.json",
36
37
  "check:pinned-deps": "node scripts/check-pinned-deps.mjs",
37
38
  "check:ts-imports": "node scripts/check-ts-relative-imports.mjs",
39
+ "check:docs": "node scripts/check-docs.mjs",
38
40
  "test": "vitest --run",
41
+ "test:isolated": "node scripts/test-isolated.mjs",
42
+ "diff:upstream": "node scripts/diff-upstream.mjs",
39
43
  "verify:package-install": "node scripts/verify-package-install.mjs",
40
44
  "profile:tui": "node scripts/profile-node.mjs --mode tui",
41
45
  "profile:rpc": "node scripts/profile-node.mjs --mode rpc",
@@ -1,68 +0,0 @@
1
- # Development
2
-
3
- See the repository [AGENTS.md](../AGENTS.md) for the distribution contract and coding conventions.
4
-
5
- ## Setup
6
-
7
- ```bash
8
- git clone https://github.com/ming-kang/pi
9
- cd pi
10
- npm install --ignore-scripts
11
- npm run build
12
- npm run check
13
- ```
14
-
15
- The repository is the standalone `@astralyn/pi` package. AI, Agent core, and TUI are installed as exact upstream npm dependencies; no sibling workspace build is required.
16
-
17
- Run from source:
18
-
19
- ```bash
20
- ./pi-test.sh
21
- ```
22
-
23
- The script can be invoked from any directory. Pi keeps the caller's current working directory. Use `./pi-test.sh --no-env` to clear provider credentials for the source run.
24
-
25
- ## Package identity
26
-
27
- Distribution identity and configuration directory defaults are defined in `package.json`:
28
-
29
- ```json
30
- {
31
- "name": "@astralyn/pi",
32
- "piConfig": {
33
- "configDir": ".pi"
34
- },
35
- "bin": {
36
- "pi": "dist/cli.js"
37
- }
38
- }
39
- ```
40
-
41
- ## Path resolution
42
-
43
- Pi supports npm installation and `tsx` source execution. Always use `src/config.ts` helpers such as `getPackageDir()` and `getThemeDir()` for package assets; do not derive asset paths directly from `__dirname`.
44
-
45
- ## Debug command
46
-
47
- `/debug` (hidden) writes rendered TUI lines and the latest model messages to `~/.pi/agent/pi-debug.log`.
48
-
49
- ## Testing
50
-
51
- ```bash
52
- npm run check
53
- node node_modules/vitest/dist/cli.js --run test/specific.test.ts
54
- ./test.sh # complete isolated test suite
55
- ```
56
-
57
- Release CI runs the full suite on Ubuntu. Interactive UI changes should also be verified in a real terminal.
58
-
59
- ## Project structure
60
-
61
- ```text
62
- src/ runtime source
63
- test/ automated tests and local test helpers
64
- docs/ product and public API documentation
65
- examples/ SDK and extension examples
66
- docs/distribution/ standalone distribution documentation
67
- scripts/ package maintenance scripts
68
- ```
@@ -1,34 +0,0 @@
1
- # Distribution documentation
2
-
3
- This directory contains documentation owned by the standalone `@astralyn/pi` distribution. Product usage and public API documentation inherited from upstream coding-agent lives one level above under `docs/`.
4
-
5
- ## User documentation
6
-
7
- - [Distribution overview](../../README.md) — package identity, installation, bundled features, and development entry points.
8
- - [Quickstart](../quickstart.md) — install, authenticate, and run a first session.
9
- - [User and API documentation](../index.md) — interactive mode, settings, customization, SDK, RPC, and platform notes.
10
- - [Extension API](../extensions.md) — write external TypeScript extensions.
11
- - [Theme API](../themes.md) — create and load custom themes.
12
-
13
- ## Architecture and design
14
-
15
- - [Architecture and dependency boundaries](architecture.md)
16
- - [Native tool presentation](tool-presentation.md)
17
- - [Bundled theme design](themes.md)
18
-
19
- ## Bundled extensions
20
-
21
- - [Catalog](extensions/README.md)
22
- - [deepwiki](extensions/deepwiki.md)
23
- - [question](extensions/question.md)
24
- - [rewind](extensions/rewind.md)
25
- - [router](extensions/router.md)
26
- - [statusline](extensions/statusline.md)
27
- - [subagent](extensions/subagent.md)
28
- - [todo](extensions/todo.md)
29
-
30
- ## Maintainer documentation
31
-
32
- - [Upstream synchronization](maintenance.md)
33
- - [OIDC npm release checklist](release.md)
34
- - [Repository contract](../../AGENTS.md)
@@ -1,102 +0,0 @@
1
- # Distribution architecture
2
-
3
- ## Purpose
4
-
5
- This repository is a standalone personal distribution of Pi's coding-agent package. Its goals are to:
6
-
7
- - maintain only code that ships in `@astralyn/pi`;
8
- - consume AI, Agent core, and TUI from upstream npm releases;
9
- - keep native tool presentation, bundled workflow extensions, themes, and context-safety behavior local to this package;
10
- - avoid cross-workspace source changes and multi-package release coordination.
11
-
12
- ## Package boundary
13
-
14
- The repository root is the npm package:
15
-
16
- ```text
17
- src/ coding-agent runtime
18
- test/ coding-agent tests
19
- docs/ product and API documentation
20
- examples/ SDK and extension examples
21
- docs/distribution/ distribution-owned documentation
22
- package.json @astralyn/pi
23
- npm-shrinkwrap.json development and published dependency lock
24
- ```
25
-
26
- The runtime boundary is explicit and versioned in `package.json`:
27
-
28
- - `@earendil-works/pi-ai`
29
- - `@earendil-works/pi-agent-core`
30
- - `@earendil-works/pi-tui`
31
-
32
- These are exact registry dependencies. Their source is not copied into this repository and local verification resolves the same published packages that npm users install. A coding-agent synchronization that needs new upstream APIs must update all compatible dependency versions in the same change.
33
-
34
- Presentation-only metadata such as `toolGroup` uses coding-agent-local intersection types rather than changing `AgentTool`. The long-tool-loop compaction implementation uses the upstream stateful Agent's public `prepareNextTurnWithContext` callback for successful same-run continuation. Exceptional fail-closed paths are represented locally as explicit error/aborted lifecycle boundaries because the stateful Agent does not expose its low-level graceful turn-stop callback.
35
-
36
- ## Core and extension boundary
37
-
38
- Pi core changes are reserved for behavior that must be global:
39
-
40
- - native tool call/result chrome and generic renderer fallback;
41
- - built-in renderer integration;
42
- - context-safety checks such as between-tool-batch auto-compaction;
43
- - globally configurable keybindings required by bundled UI.
44
-
45
- Personal workflow features remain self-contained extensions:
46
-
47
- ```text
48
- src/extensions/
49
- ├── deepwiki/
50
- ├── question/
51
- ├── todo/
52
- ├── rewind/
53
- ├── router/
54
- ├── statusline/
55
- └── subagent/
56
- ```
57
-
58
- They are registered as hidden `InlineExtension` entries in `src/extensions/index.ts`. No shared Fork framework, feature registry, or cross-extension internal API is used.
59
-
60
- ## Configuration compatibility
61
-
62
- The command remains `pi`, and settings and sessions remain under `~/.pi/agent`. Built-in extensions store their first-class data alongside the normal agent data, including:
63
-
64
- ```text
65
- ~/.pi/agent/router.json
66
- ~/.pi/agent/rewind/
67
- ```
68
-
69
- No separate Fork configuration layer is introduced.
70
-
71
- ## Themes
72
-
73
- `ice-cream-dark` and `ice-cream-light` are native theme assets under `src/modes/interactive/theme/`. The normal package build copies all theme JSON files into `dist`.
74
-
75
- ## Upstream synchronization
76
-
77
- The `upstream` remote still points to `earendil-works/pi`, but upstream monorepo tags are not merged into this standalone branch. Synchronization extracts and reviews only `packages/coding-agent/**` from an upstream release tag, maps that subtree to the repository root, and updates exact registry dependency versions. See [maintenance.md](maintenance.md).
78
-
79
- Recurring review hotspots are:
80
-
81
- ```text
82
- src/extensions/index.ts
83
- src/core/agent-session.ts
84
- src/core/keybindings.ts
85
- src/core/tools/*.ts
86
- src/modes/interactive/components/tool-execution.ts
87
- src/modes/interactive/interactive-mode.ts
88
- src/modes/interactive/theme/theme.ts
89
- package.json
90
- CHANGELOG.md
91
- ```
92
-
93
- ## Release model
94
-
95
- Only `@astralyn/pi` is published. Fork releases track the upstream `major.minor` line while using the patch number for this distribution's release sequence:
96
-
97
- ```text
98
- upstream 0.82.x -> Fork 0.82.0, 0.82.1, 0.82.2, ...
99
- upstream 0.83.x -> Fork 0.83.0, 0.83.1, 0.83.2, ...
100
- ```
101
-
102
- Tags use `pi-v<full-version>` so they do not collide with upstream `v<version>` tags. Ubuntu CI verifies the standalone package, and the manually dispatched publish workflow uploads the repository root with npm Trusted Publishing. No other package, binary release flow, model catalog, or update service is maintained here.
@@ -1,17 +0,0 @@
1
- # Bundled extensions
2
-
3
- These are extensions shipped by the distribution. For the public API used to write external extensions, see the [Extension API documentation](../../extensions.md).
4
-
5
- The bundled extensions are maintained as self-contained TypeScript modules under `src/extensions/` and registered as hidden built-in extensions.
6
-
7
- | Extension | Tool or command | Documentation |
8
- |---|---|---|
9
- | `deepwiki` | `deepwiki` | [deepwiki.md](deepwiki.md) |
10
- | `question` | `question` | [question.md](question.md) |
11
- | `todo` | `todo`, `/todos` | [todo.md](todo.md) |
12
- | `rewind` | `/rewind`, `/tree` lifecycle | [rewind.md](rewind.md) |
13
- | `router` | `/router` | [router.md](router.md) |
14
- | `statusline` | Footer | [statusline.md](statusline.md) |
15
- | `subagent` | `subagent`, `/agents` | [subagent.md](subagent.md) |
16
-
17
- The extensions continue to use Pi's public Extension API. Keeping their distribution notes here does not merge their implementations into the coding-agent core.