@astralyn/pi 0.82.2 → 0.82.4
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.
- package/CHANGELOG.md +42 -0
- package/README.md +70 -634
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +3 -2
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +3 -2
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +31 -12
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/types.d.ts +11 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-resolver.d.ts +1 -0
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +13 -3
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +19 -1
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +3 -0
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +2 -0
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +6 -0
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/plan/constants.d.ts +31 -0
- package/dist/extensions/plan/constants.d.ts.map +1 -0
- package/dist/extensions/plan/constants.js +57 -0
- package/dist/extensions/plan/constants.js.map +1 -0
- package/dist/extensions/plan/index.d.ts +21 -0
- package/dist/extensions/plan/index.d.ts.map +1 -0
- package/dist/extensions/plan/index.js +291 -0
- package/dist/extensions/plan/index.js.map +1 -0
- package/dist/extensions/plan/schema.d.ts +15 -0
- package/dist/extensions/plan/schema.d.ts.map +1 -0
- package/dist/extensions/plan/schema.js +13 -0
- package/dist/extensions/plan/schema.js.map +1 -0
- package/dist/extensions/plan/state.d.ts +29 -0
- package/dist/extensions/plan/state.d.ts.map +1 -0
- package/dist/extensions/plan/state.js +74 -0
- package/dist/extensions/plan/state.js.map +1 -0
- package/dist/extensions/plan/storage.d.ts +18 -0
- package/dist/extensions/plan/storage.d.ts.map +1 -0
- package/dist/extensions/plan/storage.js +58 -0
- package/dist/extensions/plan/storage.js.map +1 -0
- package/dist/extensions/rewind/anchor.d.ts +29 -0
- package/dist/extensions/rewind/anchor.d.ts.map +1 -0
- package/dist/extensions/rewind/anchor.js +35 -0
- package/dist/extensions/rewind/anchor.js.map +1 -0
- package/dist/extensions/rewind/engine.d.ts +2 -6
- package/dist/extensions/rewind/engine.d.ts.map +1 -1
- package/dist/extensions/rewind/engine.js +41 -10
- package/dist/extensions/rewind/engine.js.map +1 -1
- package/dist/extensions/rewind/index.d.ts.map +1 -1
- package/dist/extensions/rewind/index.js +55 -21
- package/dist/extensions/rewind/index.js.map +1 -1
- package/dist/extensions/rewind/menu.d.ts.map +1 -1
- package/dist/extensions/rewind/menu.js +7 -2
- package/dist/extensions/rewind/menu.js.map +1 -1
- package/dist/extensions/rewind/restore.d.ts +26 -9
- package/dist/extensions/rewind/restore.d.ts.map +1 -1
- package/dist/extensions/rewind/restore.js +58 -16
- package/dist/extensions/rewind/restore.js.map +1 -1
- package/dist/extensions/subagent/activity.d.ts +1 -0
- package/dist/extensions/subagent/activity.d.ts.map +1 -1
- package/dist/extensions/subagent/activity.js +20 -4
- package/dist/extensions/subagent/activity.js.map +1 -1
- package/dist/extensions/subagent/agents.d.ts.map +1 -1
- package/dist/extensions/subagent/agents.js +2 -13
- package/dist/extensions/subagent/agents.js.map +1 -1
- package/dist/extensions/subagent/constants.d.ts +4 -3
- package/dist/extensions/subagent/constants.d.ts.map +1 -1
- package/dist/extensions/subagent/constants.js +9 -3
- package/dist/extensions/subagent/constants.js.map +1 -1
- package/dist/extensions/subagent/index.d.ts.map +1 -1
- package/dist/extensions/subagent/index.js +12 -5
- package/dist/extensions/subagent/index.js.map +1 -1
- package/dist/extensions/subagent/render.d.ts.map +1 -1
- package/dist/extensions/subagent/render.js +166 -41
- package/dist/extensions/subagent/render.js.map +1 -1
- package/dist/extensions/subagent/resolve.d.ts +2 -5
- package/dist/extensions/subagent/resolve.d.ts.map +1 -1
- package/dist/extensions/subagent/resolve.js +8 -13
- package/dist/extensions/subagent/resolve.js.map +1 -1
- package/dist/extensions/subagent/runner.d.ts +3 -1
- package/dist/extensions/subagent/runner.d.ts.map +1 -1
- package/dist/extensions/subagent/runner.js +111 -66
- package/dist/extensions/subagent/runner.js.map +1 -1
- package/dist/extensions/subagent/schema.d.ts +0 -6
- package/dist/extensions/subagent/schema.d.ts.map +1 -1
- package/dist/extensions/subagent/schema.js +2 -3
- package/dist/extensions/subagent/schema.js.map +1 -1
- package/dist/extensions/subagent/sdk-runner.d.ts.map +1 -1
- package/dist/extensions/subagent/sdk-runner.js +32 -16
- package/dist/extensions/subagent/sdk-runner.js.map +1 -1
- package/dist/extensions/subagent/types.d.ts +3 -2
- package/dist/extensions/subagent/types.d.ts.map +1 -1
- package/dist/extensions/subagent/types.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +3 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +10 -2
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +22 -13
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +31 -18
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/utils/coalescing-terminal.d.ts +62 -0
- package/dist/utils/coalescing-terminal.d.ts.map +1 -0
- package/dist/utils/coalescing-terminal.js +151 -0
- package/dist/utils/coalescing-terminal.js.map +1 -0
- package/docs/bundled/README.md +38 -0
- package/docs/bundled/extensions/README.md +19 -0
- package/docs/bundled/extensions/plan.md +31 -0
- package/docs/{distribution → bundled}/extensions/question.md +0 -11
- package/docs/{distribution → bundled}/extensions/rewind.md +19 -18
- package/docs/{distribution → bundled}/extensions/router.md +1 -14
- package/docs/{distribution → bundled}/extensions/statusline.md +1 -2
- package/docs/{distribution → bundled}/extensions/subagent.md +15 -22
- package/docs/bundled/extensions/todo.md +28 -0
- package/docs/{distribution → bundled}/themes.md +4 -11
- package/docs/{distribution → bundled}/tool-presentation.md +4 -10
- package/docs/compaction.md +18 -14
- package/docs/custom-provider.md +8 -8
- package/docs/docs.json +61 -9
- package/docs/extensions.md +14 -13
- package/docs/index.md +12 -7
- package/docs/json.md +4 -4
- package/docs/providers.md +1 -1
- package/docs/rpc.md +3 -9
- package/docs/session-format.md +5 -5
- package/docs/skills.md +1 -1
- package/docs/themes.md +4 -8
- package/docs/tui.md +1 -1
- package/examples/extensions/README.md +0 -1
- package/examples/extensions/custom-provider-anthropic/index.ts +4 -4
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/gondolin/index.ts +4 -6
- package/examples/extensions/message-renderer.ts +2 -2
- package/examples/extensions/overlay-qa-tests.ts +2 -2
- package/examples/extensions/project-trust.ts +2 -2
- package/examples/sdk/README.md +38 -44
- package/npm-shrinkwrap.json +2 -2
- package/package.json +6 -2
- package/docs/development.md +0 -68
- package/docs/distribution/README.md +0 -34
- package/docs/distribution/architecture.md +0 -102
- package/docs/distribution/extensions/README.md +0 -17
- package/docs/distribution/maintenance.md +0 -121
- package/docs/distribution/release.md +0 -85
- package/examples/extensions/subagent/README.md +0 -175
- package/examples/extensions/subagent/agents/planner.md +0 -37
- package/examples/extensions/subagent/agents/reviewer.md +0 -35
- package/examples/extensions/subagent/agents/scout.md +0 -50
- package/examples/extensions/subagent/agents/worker.md +0 -24
- package/examples/extensions/subagent/agents.ts +0 -126
- package/examples/extensions/subagent/index.ts +0 -1009
- package/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
- package/examples/extensions/subagent/prompts/implement.md +0 -10
- package/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
- /package/docs/{distribution → bundled}/extensions/deepwiki.md +0 -0
|
@@ -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="/
|
|
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
|
|
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
|
|
7
|
+
* cp examples/extensions/project-trust.ts ~/.pi/agent/extensions/
|
|
8
8
|
*
|
|
9
9
|
* Or:
|
|
10
10
|
*
|
|
11
|
-
* pi -e
|
|
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
|
*/
|
package/examples/sdk/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SDK Examples
|
|
2
2
|
|
|
3
|
-
Programmatic usage of pi
|
|
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-
|
|
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
|
-
|
|
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
|
-
//
|
|
49
|
+
// Select a built-in model.
|
|
50
|
+
const modelRuntime = await ModelRuntime.create();
|
|
50
51
|
const model = getModel("anthropic", "claude-opus-4-5");
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
|
58
|
-
const { session } = await createAgentSession({
|
|
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
|
-
//
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
|
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
|
-
//
|
|
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);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astralyn/pi",
|
|
3
|
-
"version": "0.82.
|
|
3
|
+
"version": "0.82.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@astralyn/pi",
|
|
9
|
-
"version": "0.82.
|
|
9
|
+
"version": "0.82.4",
|
|
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.
|
|
3
|
+
"version": "0.82.4",
|
|
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",
|
package/docs/development.md
DELETED
|
@@ -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.
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
# Distribution maintenance
|
|
2
|
-
|
|
3
|
-
This guide describes how to keep the standalone `@astralyn/pi` package aligned with upstream Pi. The repository contract in [`AGENTS.md`](../../AGENTS.md) is authoritative; publishing is covered separately in [`release.md`](release.md).
|
|
4
|
-
|
|
5
|
-
## Repository model
|
|
6
|
-
|
|
7
|
-
```text
|
|
8
|
-
origin private distribution repository
|
|
9
|
-
upstream earendil-works/pi monorepo
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
`main` contains a standalone package, not an upstream monorepo checkout. Upstream tags must therefore be inspected and selectively imported; never merge an upstream tag directly into `main`, because that would recreate every workspace.
|
|
13
|
-
|
|
14
|
-
## Ownership layers
|
|
15
|
-
|
|
16
|
-
| Layer | Typical paths | Policy |
|
|
17
|
-
|---|---|---|
|
|
18
|
-
| Upstream-aligned coding-agent | most of `src/**`, `test/**`, `docs/**`, `examples/**` | Import compatible changes from an upstream release tag. |
|
|
19
|
-
| Distribution-owned | `docs/distribution/**`, bundled personal extensions, ice-cream themes, release workflow, package identity | Preserve local design and update deliberately. |
|
|
20
|
-
| Hybrid | `src/core/agent-session.ts`, native tool presentation, built-in tools, keybindings, extension registration, `package.json`, `CHANGELOG.md` | Review function by function; retain upstream lifecycle semantics and local behavior. |
|
|
21
|
-
| Registry boundary | exact upstream AI, Agent core, and TUI dependencies | Upgrade together with the imported coding-agent release; never patch their installed files. |
|
|
22
|
-
|
|
23
|
-
Recurring hybrid hotspots include:
|
|
24
|
-
|
|
25
|
-
```text
|
|
26
|
-
src/extensions/index.ts
|
|
27
|
-
src/core/agent-session.ts
|
|
28
|
-
src/core/keybindings.ts
|
|
29
|
-
src/core/tools/*.ts
|
|
30
|
-
src/modes/interactive/components/tool-execution.ts
|
|
31
|
-
src/modes/interactive/interactive-mode.ts
|
|
32
|
-
src/modes/interactive/theme/theme.ts
|
|
33
|
-
package.json
|
|
34
|
-
CHANGELOG.md
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Synchronization workflow
|
|
38
|
-
|
|
39
|
-
Synchronize only against upstream release tags, never upstream `main`. Start from a clean branch and fetch tags:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
git status --short
|
|
43
|
-
git fetch upstream --tags
|
|
44
|
-
git tag --list 'v<upstream-minor>.*'
|
|
45
|
-
git switch -c sync/upstream-<version> main
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Extract the upstream coding-agent subtree into a temporary directory without changing the current checkout:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
tmp="$(mktemp -d)"
|
|
52
|
-
git archive v<version> packages/coding-agent | tar -x -C "$tmp"
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Review `$tmp/packages/coding-agent/` against the standalone root. Import upstream changes in bounded groups:
|
|
56
|
-
|
|
57
|
-
1. Review source and tests, paying special attention to the hybrid hotspots above.
|
|
58
|
-
2. Update product/API documentation and examples while retaining distribution-specific references.
|
|
59
|
-
3. Adapt upstream package and TypeScript changes to the standalone root rather than copying monorepo-relative paths.
|
|
60
|
-
4. Set the exact `@earendil-works/pi-ai`, `@earendil-works/pi-agent-core`, and `@earendil-works/pi-tui` versions published for that upstream release.
|
|
61
|
-
5. Run `npm install --ignore-scripts` to refresh `npm-shrinkwrap.json`, then inspect dependency and lifecycle-script changes.
|
|
62
|
-
|
|
63
|
-
Do not copy these upstream monorepo assumptions into the standalone repository:
|
|
64
|
-
|
|
65
|
-
- workspace declarations or `packages/*` paths;
|
|
66
|
-
- TypeScript or Vitest aliases to sibling source workspaces;
|
|
67
|
-
- Server, storage, model-catalog, binary, or multi-package release scripts;
|
|
68
|
-
- cross-package source modifications needed only by an unreleased upstream checkout.
|
|
69
|
-
|
|
70
|
-
If imported coding-agent code requires an API absent from the published upstream dependencies, stop and use a later compatible release. Do not solve the mismatch by vendoring or locally forking another package.
|
|
71
|
-
|
|
72
|
-
## Conflict policy
|
|
73
|
-
|
|
74
|
-
When reconciling upstream changes:
|
|
75
|
-
|
|
76
|
-
1. Preserve security fixes, protocol correctness, execution semantics, and public API compatibility first.
|
|
77
|
-
2. Keep local behavior only where it is intentionally documented and tested.
|
|
78
|
-
3. For native UI, integrate upstream execution changes before adapting presentation.
|
|
79
|
-
4. Keep model-facing output bounded and avoid schema/result changes for display-only work.
|
|
80
|
-
5. Prefer a small local type intersection or adapter over changing an upstream dependency API.
|
|
81
|
-
|
|
82
|
-
Git may detect many imports as renames from the historical `packages/coding-agent` path. Review content, not rename percentages.
|
|
83
|
-
|
|
84
|
-
## Dependency and lock maintenance
|
|
85
|
-
|
|
86
|
-
All direct registry dependencies are exact. When package metadata changes:
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
npm install --ignore-scripts
|
|
90
|
-
npm run check:pinned-deps
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
`npm-shrinkwrap.json` is both the development lock and the lock published with `@astralyn/pi`. Review new or changed transitive packages, platform-specific optional packages, and lifecycle scripts before accepting it. The pre-commit hook requires an explicit `PI_ALLOW_LOCKFILE_CHANGE=1` acknowledgment when committing an intentional shrinkwrap change.
|
|
94
|
-
|
|
95
|
-
## Verification
|
|
96
|
-
|
|
97
|
-
At minimum:
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
npm run build
|
|
101
|
-
npm run check
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Run focused tests for each changed subsystem. For native transcript changes, verify pending, success, error, collapsed, and expanded states, plus `Ctrl+O`, `/reload`, and `/tree` in a real TTY. The Ubuntu CI workflow runs Build, Check, and the full test suite.
|
|
105
|
-
|
|
106
|
-
Before integrating a synchronization branch:
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
git status --short
|
|
110
|
-
git diff --stat main...HEAD
|
|
111
|
-
git log --oneline main..HEAD
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
## Changelog and release ownership
|
|
115
|
-
|
|
116
|
-
- `CHANGELOG.md` is the runtime and release changelog for `@astralyn/pi`.
|
|
117
|
-
- `docs/**` remains structurally close to upstream coding-agent user/API documentation.
|
|
118
|
-
- `docs/distribution/**` records standalone architecture, bundled behavior, maintenance, and release operations.
|
|
119
|
-
- Dependency package changelogs are not copied; consult their upstream releases during synchronization.
|
|
120
|
-
|
|
121
|
-
After synchronization and verification, follow the [release checklist](release.md).
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
# Release checklist
|
|
2
|
-
|
|
3
|
-
This repository publishes one npm package from its root: `@astralyn/pi`. It does not use the upstream multi-package, binary, source-archive, or model-catalog release flows. Upstream synchronization is documented in [maintenance.md](maintenance.md).
|
|
4
|
-
|
|
5
|
-
## Scope and versioning
|
|
6
|
-
|
|
7
|
-
Track the upstream Pi `major.minor` line and reserve the patch number for this distribution's release sequence:
|
|
8
|
-
|
|
9
|
-
```text
|
|
10
|
-
upstream 0.82.x -> Fork 0.82.0, 0.82.1, 0.82.2, ...
|
|
11
|
-
upstream 0.83.x -> Fork 0.83.0, 0.83.1, 0.83.2, ...
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
The first distribution release after moving to a new upstream minor uses patch `0`. Every later release on that line uses the next unused patch, including releases that absorb an upstream patch update. Use `pi-v<full-version>` Git tags so they remain distinct from fetched upstream tags such as `v0.82.0`.
|
|
15
|
-
|
|
16
|
-
## Prepare the release
|
|
17
|
-
|
|
18
|
-
1. Start from a clean `main` branch and choose the next unused distribution version.
|
|
19
|
-
2. Move current `CHANGELOG.md` entries from `[Unreleased]` into one `## [<version>] - YYYY-MM-DD` section, then leave a new empty `[Unreleased]` section.
|
|
20
|
-
3. Update `package.json` version.
|
|
21
|
-
4. Refresh and review the authoritative shrinkwrap:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npm install --package-lock-only --ignore-scripts
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Direct dependencies are exact. If a synchronized upstream release is still blocked by the `.npmrc` age gate, prefer waiting; use `--min-release-age=0` only after explicitly verifying the package versions, provenance, and release contents.
|
|
28
|
-
|
|
29
|
-
Confirm `package.json` and the root entry in `npm-shrinkwrap.json` carry the same `@astralyn/pi` version and that the intended exact upstream AI, Agent core, and TUI versions are locked.
|
|
30
|
-
|
|
31
|
-
## Verify
|
|
32
|
-
|
|
33
|
-
Local development verification:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npm run build
|
|
37
|
-
npm run check
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Release verification runs on Ubuntu through GitHub Actions. The CI and publish workflows both install from `npm-shrinkwrap.json`, build, check, verify that generated files remain clean, and run the complete test suite.
|
|
41
|
-
|
|
42
|
-
## Review the package
|
|
43
|
-
|
|
44
|
-
After building, inspect the root package:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
npm pack --dry-run
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
The tarball must contain the built `dist`, product documentation, examples, README, changelog, and `npm-shrinkwrap.json`. It must not contain source workspaces or local configuration. For stronger verification, create a real tarball, install it in a temporary directory outside the repository, and run `pi --version` and `pi --list-models`.
|
|
51
|
-
|
|
52
|
-
## Publish and tag
|
|
53
|
-
|
|
54
|
-
Publishing uses npm Trusted Publishing through GitHub Actions OIDC. Configure the package once on npm:
|
|
55
|
-
|
|
56
|
-
```text
|
|
57
|
-
Publisher: GitHub Actions
|
|
58
|
-
Organization or user: ming-kang
|
|
59
|
-
Repository: pi
|
|
60
|
-
Workflow filename: publish-npm.yml
|
|
61
|
-
Environment name: (blank)
|
|
62
|
-
Allowed action: Allow npm publish
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
After the release commit is pushed and CI passes, trigger the workflow from an authenticated GitHub CLI session:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
gh workflow run publish-npm.yml --repo ming-kang/pi --ref main -f version=0.82.0
|
|
69
|
-
|
|
70
|
-
gh run list --repo ming-kang/pi --workflow publish-npm.yml --limit 1
|
|
71
|
-
gh run watch <run-id> --repo ming-kang/pi --exit-status
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
The workflow validates the requested version, repeats Ubuntu Build/Check/Test, publishes the repository root with provenance, and verifies the registry version. A normal push to `main` never publishes.
|
|
75
|
-
|
|
76
|
-
After publication, verify the registry and perform a global-install/self-update smoke test from a separate shell or after restarting Pi. Do not replace the package currently running the release session.
|
|
77
|
-
|
|
78
|
-
Finally tag the exact release commit:
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
git tag pi-v<full-version>
|
|
82
|
-
git push origin pi-v<full-version>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
No other package is published from this repository.
|