@eminent337/aery 0.1.115 → 0.1.117
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 +4172 -16
- package/README.md +621 -34
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +2 -1
- package/dist/bun/cli.js.map +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +3 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -3
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +11 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +66 -46
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +5 -5
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +37 -36
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +2 -2
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +1 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +3 -3
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/custom-openai-compatible.d.ts +1 -0
- package/dist/core/custom-openai-compatible.d.ts.map +1 -1
- package/dist/core/custom-openai-compatible.js +30 -4
- package/dist/core/custom-openai-compatible.js.map +1 -1
- package/dist/core/export-html/template.css +45 -1
- package/dist/core/export-html/template.js +68 -4
- 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/loader.d.ts +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +2 -2
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +3 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +40 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +17 -3
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-registry.d.ts +6 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +59 -2
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +9 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/provider-display-names.d.ts +2 -0
- package/dist/core/provider-display-names.d.ts.map +1 -0
- package/dist/core/provider-display-names.js +35 -0
- package/dist/core/provider-display-names.js.map +1 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +1 -1
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +3 -3
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +18 -10
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +3 -3
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +1 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +2 -2
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +5 -5
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +2 -2
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +105 -125
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +1 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +50 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/core/tools/output-accumulator.js +178 -0
- package/dist/core/tools/output-accumulator.js.map +1 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +70 -13
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +2 -2
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +1 -1
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +23 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.js +2 -2
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +2 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +6 -1
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +5 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +19 -5
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +1 -3
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +9 -17
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +24 -27
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +4 -2
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +2 -1
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +9 -1
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +1 -1
- package/dist/modes/interactive/theme/light.json +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +8 -10
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts +2 -2
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +2 -2
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +4 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/utils/ansi.d.ts +2 -0
- package/dist/utils/ansi.d.ts.map +1 -0
- package/dist/utils/ansi.js +52 -0
- package/dist/utils/ansi.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +3 -3
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +9 -2
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/html.d.ts +7 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +40 -0
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/mime.d.ts +1 -0
- package/dist/utils/mime.d.ts.map +1 -1
- package/dist/utils/mime.js +59 -16
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/paths.d.ts +2 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +16 -0
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/pi-user-agent.d.ts +2 -0
- package/dist/utils/pi-user-agent.d.ts.map +1 -0
- package/dist/utils/pi-user-agent.js +5 -0
- package/dist/utils/pi-user-agent.js.map +1 -0
- package/dist/utils/syntax-highlight.d.ts +12 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -0
- package/dist/utils/syntax-highlight.js +118 -0
- package/dist/utils/syntax-highlight.js.map +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +76 -7
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/uuid.d.ts +2 -0
- package/dist/utils/uuid.d.ts.map +1 -0
- package/dist/utils/uuid.js +40 -0
- package/dist/utils/uuid.js.map +1 -0
- package/dist/utils/version-check.d.ts +7 -0
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +12 -5
- package/dist/utils/version-check.js.map +1 -1
- package/docs/compaction.md +16 -16
- package/docs/custom-provider.md +40 -32
- package/docs/development.md +4 -4
- package/docs/docs.json +20 -5
- package/docs/extensions.md +152 -102
- package/docs/index.md +16 -7
- package/docs/json.md +7 -7
- package/docs/keybindings.md +3 -3
- package/docs/models.md +48 -8
- package/docs/packages.md +41 -36
- package/docs/prompt-templates.md +2 -2
- package/docs/providers.md +52 -36
- package/docs/quickstart.md +20 -20
- package/docs/rpc.md +9 -9
- package/docs/sdk.md +31 -53
- package/docs/session-format.md +10 -10
- package/docs/sessions.md +9 -9
- package/docs/settings.md +12 -6
- package/docs/skills.md +4 -4
- package/docs/terminal-setup.md +6 -6
- package/docs/termux.md +6 -6
- package/docs/themes.md +7 -7
- package/docs/tmux.md +1 -1
- package/docs/tui.md +8 -8
- package/docs/usage.md +41 -39
- package/examples/extensions/README.md +3 -5
- package/examples/extensions/antigravity-image-gen.ts +9 -9
- package/examples/extensions/auto-commit-on-exit.ts +1 -1
- package/examples/extensions/bash-spawn-hook.ts +2 -2
- package/examples/extensions/built-in-tool-renderer.ts +1 -1
- package/examples/extensions/custom-compaction.ts +1 -1
- package/examples/extensions/custom-header.ts +2 -2
- package/examples/extensions/custom-provider-anthropic/index.ts +2 -2
- package/examples/extensions/custom-provider-anthropic/package-lock.json +4 -4
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/doom-overlay/README.md +2 -2
- package/examples/extensions/doom-overlay/doom/build.sh +2 -2
- package/examples/extensions/doom-overlay/index.ts +1 -1
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/handoff.ts +42 -5
- package/examples/extensions/hidden-thinking-label.ts +1 -1
- package/examples/extensions/inline-bash.ts +2 -2
- package/examples/extensions/input-transform.ts +3 -3
- package/examples/extensions/interactive-shell.ts +1 -1
- package/examples/extensions/mac-system-theme.ts +2 -2
- package/examples/extensions/minimal-mode.ts +1 -1
- package/examples/extensions/modal-editor.ts +1 -1
- package/examples/extensions/model-status.ts +1 -1
- package/examples/extensions/overlay-qa-tests.ts +6 -6
- package/examples/extensions/overlay-test.ts +1 -1
- package/examples/extensions/preset.ts +2 -2
- package/examples/extensions/provider-payload.ts +1 -1
- package/examples/extensions/rainbow-editor.ts +1 -1
- package/examples/extensions/rpc-demo.ts +1 -1
- package/examples/extensions/sandbox/index.ts +3 -3
- package/examples/extensions/sandbox/package-lock.json +7 -7
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/shutdown-command.ts +5 -5
- package/examples/extensions/ssh.ts +2 -2
- package/examples/extensions/subagent/README.md +2 -2
- package/examples/extensions/subagent/agents/aery-pods.md +1 -1
- package/examples/extensions/subagent/agents.ts +1 -1
- package/examples/extensions/subagent/index.ts +2 -2
- package/examples/extensions/titlebar-spinner.ts +1 -1
- package/examples/extensions/tool-override.ts +2 -2
- package/examples/extensions/truncated-tool.ts +1 -1
- package/examples/extensions/with-deps/package-lock.json +4 -4
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/extensions/working-indicator.ts +4 -4
- package/examples/extensions/working-message-test.ts +1 -1
- package/examples/sdk/01-minimal.ts +14 -10
- package/examples/sdk/02-custom-model.ts +12 -8
- package/examples/sdk/03-custom-prompt.ts +24 -16
- package/examples/sdk/04-skills.ts +2 -2
- package/examples/sdk/05-tools.ts +8 -4
- package/examples/sdk/06-extensions.ts +11 -7
- package/examples/sdk/07-context-files.ts +2 -2
- package/examples/sdk/08-prompt-templates.ts +2 -2
- package/examples/sdk/09-api-keys-and-oauth.ts +8 -4
- package/examples/sdk/10-settings.ts +4 -4
- package/examples/sdk/11-sessions.ts +4 -0
- package/examples/sdk/12-full-control.ts +11 -7
- package/examples/sdk/README.md +5 -8
- package/package.json +8 -14
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import type { ExtensionAPI, SessionEntry } from "@eminent337/aery";
|
|
16
16
|
import { BorderedLoader, convertToLlm, serializeConversation } from "@eminent337/aery";
|
|
17
17
|
import { complete, type Message } from "@eminent337/aery-ai";
|
|
18
|
+
import type { AgentMessage } from "@eminent337/aery-core";
|
|
18
19
|
|
|
19
20
|
const SYSTEM_PROMPT = `You are a context transfer assistant. Given a conversation history and the user's goal for a new thread, generate a focused prompt that:
|
|
20
21
|
|
|
@@ -38,6 +39,44 @@ Files involved:
|
|
|
38
39
|
## Task
|
|
39
40
|
[Clear description of what to do next based on user's goal]`;
|
|
40
41
|
|
|
42
|
+
function entryToMessage(entry: SessionEntry): AgentMessage | undefined {
|
|
43
|
+
if (entry.type === "message") {
|
|
44
|
+
return entry.message;
|
|
45
|
+
}
|
|
46
|
+
if (entry.type === "compaction") {
|
|
47
|
+
return {
|
|
48
|
+
role: "compactionSummary",
|
|
49
|
+
summary: entry.summary,
|
|
50
|
+
tokensBefore: entry.tokensBefore,
|
|
51
|
+
timestamp: new Date(entry.timestamp).getTime(),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function getHandoffMessages(branch: SessionEntry[]): AgentMessage[] {
|
|
58
|
+
let compactionIndex = -1;
|
|
59
|
+
for (let i = branch.length - 1; i >= 0; i--) {
|
|
60
|
+
if (branch[i].type === "compaction") {
|
|
61
|
+
compactionIndex = i;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (compactionIndex < 0) {
|
|
66
|
+
return branch.map(entryToMessage).filter((message) => message !== undefined);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const compaction = branch[compactionIndex];
|
|
70
|
+
const firstKeptIndex =
|
|
71
|
+
compaction.type === "compaction" ? branch.findIndex((entry) => entry.id === compaction.firstKeptEntryId) : -1;
|
|
72
|
+
const compactedBranch = [
|
|
73
|
+
compaction,
|
|
74
|
+
...(firstKeptIndex >= 0 ? branch.slice(firstKeptIndex, compactionIndex) : []),
|
|
75
|
+
...branch.slice(compactionIndex + 1),
|
|
76
|
+
];
|
|
77
|
+
return compactedBranch.map(entryToMessage).filter((message) => message !== undefined);
|
|
78
|
+
}
|
|
79
|
+
|
|
41
80
|
export default function (pi: ExtensionAPI) {
|
|
42
81
|
pi.registerCommand("handoff", {
|
|
43
82
|
description: "Transfer context to a new focused session",
|
|
@@ -58,11 +97,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
58
97
|
return;
|
|
59
98
|
}
|
|
60
99
|
|
|
61
|
-
// Gather conversation context from current branch
|
|
62
|
-
|
|
63
|
-
const messages =
|
|
64
|
-
.filter((entry): entry is SessionEntry & { type: "message" } => entry.type === "message")
|
|
65
|
-
.map((entry) => entry.message);
|
|
100
|
+
// Gather conversation context from current branch. If the branch was compacted,
|
|
101
|
+
// include the compaction summary plus entries from firstKeptEntryId onward.
|
|
102
|
+
const messages = getHandoffMessages(ctx.sessionManager.getBranch());
|
|
66
103
|
|
|
67
104
|
if (messages.length === 0) {
|
|
68
105
|
ctx.ui.notify("No conversation to hand off", "error");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Inline Bash Extension - expands inline bash commands in user prompts.
|
|
3
3
|
*
|
|
4
|
-
* Start
|
|
5
|
-
*
|
|
4
|
+
* Start pi with this extension:
|
|
5
|
+
* pi -e ./examples/extensions/inline-bash.ts
|
|
6
6
|
*
|
|
7
7
|
* Then type prompts with inline bash:
|
|
8
8
|
* What's in !{pwd}?
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Input Transform Example - demonstrates the `input` event for intercepting user input.
|
|
3
3
|
*
|
|
4
|
-
* Start
|
|
5
|
-
*
|
|
4
|
+
* Start pi with this extension:
|
|
5
|
+
* pi -e ./examples/extensions/input-transform.ts
|
|
6
6
|
*
|
|
7
|
-
* Then type these inside
|
|
7
|
+
* Then type these inside pi:
|
|
8
8
|
* ?quick What is TypeScript? → "Respond briefly: What is TypeScript?"
|
|
9
9
|
* ping → "pong" (instant, no LLM)
|
|
10
10
|
* time → current time (instant, no LLM)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* with full terminal access. The TUI suspends while they run.
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
|
-
*
|
|
8
|
+
* pi -e examples/extensions/interactive-shell.ts
|
|
9
9
|
*
|
|
10
10
|
* !vim file.txt # Auto-detected as interactive
|
|
11
11
|
* !i any-command # Force interactive mode with !i prefix
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Syncs
|
|
2
|
+
* Syncs pi theme with macOS system appearance (dark/light mode).
|
|
3
3
|
*
|
|
4
4
|
* Usage:
|
|
5
|
-
*
|
|
5
|
+
* pi -e examples/extensions/mac-system-theme.ts
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { exec } from "node:child_process";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Modal Editor - vim-like modal editing example
|
|
3
3
|
*
|
|
4
|
-
* Usage:
|
|
4
|
+
* Usage: pi --extension ./examples/extensions/modal-editor.ts
|
|
5
5
|
*
|
|
6
6
|
* - Escape: insert → normal mode (in normal mode, aborts agent)
|
|
7
7
|
* - i: normal → insert mode
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demonstrates the `model_select` hook which fires when the model changes
|
|
5
5
|
* via /model command, Ctrl+P cycling, or session restore.
|
|
6
6
|
*
|
|
7
|
-
* Usage:
|
|
7
|
+
* Usage: pi -e ./model-status.ts
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { ExtensionAPI } from "@eminent337/aery";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Overlay QA Tests - comprehensive overlay positioning and edge case tests
|
|
3
3
|
*
|
|
4
|
-
* Usage:
|
|
4
|
+
* Usage: pi --extension ./examples/extensions/overlay-qa-tests.ts
|
|
5
5
|
*
|
|
6
6
|
* Commands:
|
|
7
7
|
* /overlay-animation - Real-time animation demo (~30 FPS, proves DOOM-like rendering works)
|
|
@@ -28,7 +28,7 @@ import { spawn } from "child_process";
|
|
|
28
28
|
let globalToggleHandle: OverlayHandle | null = null;
|
|
29
29
|
|
|
30
30
|
export default function (pi: ExtensionAPI) {
|
|
31
|
-
// Animation demo - proves overlays can handle real-time updates (like
|
|
31
|
+
// Animation demo - proves overlays can handle real-time updates (like pi-doom would need)
|
|
32
32
|
pi.registerCommand("overlay-animation", {
|
|
33
33
|
description: "Test real-time animation in overlay (~30 FPS)",
|
|
34
34
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
@@ -473,13 +473,13 @@ class StreamingOverflowComponent extends BaseOverlay {
|
|
|
473
473
|
echo ""
|
|
474
474
|
for i in $(seq 1 100); do
|
|
475
475
|
# Simulate long file paths with OSC 8 hyperlinks (clickable) - tests width overflow
|
|
476
|
-
DIR="/Users/nicobailon/Documents/development/
|
|
476
|
+
DIR="/Users/nicobailon/Documents/development/pi-mono/packages/coding-agent/src/modes/interactive"
|
|
477
477
|
FILE="\${DIR}/components/very-long-component-name-that-exceeds-width-\${i}.ts"
|
|
478
478
|
echo -e "\\033]8;;file://\${FILE}\\007▶ read: \${FILE}\\033]8;;\\007"
|
|
479
479
|
|
|
480
480
|
# Add some colored status messages with long text
|
|
481
481
|
if [ $((i % 5)) -eq 0 ]; then
|
|
482
|
-
echo -e " \\033[32m✓ Successfully processed \${i} files in /Users/nicobailon/Documents/development/
|
|
482
|
+
echo -e " \\033[32m✓ Successfully processed \${i} files in /Users/nicobailon/Documents/development/pi-mono\\033[0m"
|
|
483
483
|
fi
|
|
484
484
|
if [ $((i % 7)) -eq 0 ]; then
|
|
485
485
|
echo -e " \\033[33m⚠ Warning: potential issue detected at line \${i} in very-long-component-name-that-exceeds-width.ts\\033[0m"
|
|
@@ -743,7 +743,7 @@ class SidepanelComponent extends BaseOverlay {
|
|
|
743
743
|
}
|
|
744
744
|
}
|
|
745
745
|
|
|
746
|
-
// Animation demo - proves overlays can handle real-time updates like
|
|
746
|
+
// Animation demo - proves overlays can handle real-time updates like pi-doom
|
|
747
747
|
class AnimationDemoComponent extends BaseOverlay {
|
|
748
748
|
private frame = 0;
|
|
749
749
|
private interval: ReturnType<typeof setInterval> | null = null;
|
|
@@ -819,7 +819,7 @@ class AnimationDemoComponent extends BaseOverlay {
|
|
|
819
819
|
lines.push(border("│") + padLine(``) + border("│"));
|
|
820
820
|
lines.push(border("│") + padLine(th.fg("dim", " This proves overlays can handle")) + border("│"));
|
|
821
821
|
lines.push(border("│") + padLine(th.fg("dim", " real-time game-like rendering.")) + border("│"));
|
|
822
|
-
lines.push(border("│") + padLine(th.fg("dim", " (
|
|
822
|
+
lines.push(border("│") + padLine(th.fg("dim", " (pi-doom uses same approach)")) + border("│"));
|
|
823
823
|
lines.push(border("│") + padLine(``) + border("│"));
|
|
824
824
|
lines.push(border("│") + padLine(th.fg("dim", " Press Esc to close")) + border("│"));
|
|
825
825
|
lines.push(border(`╰${"─".repeat(innerW)}╯`));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Overlay Test - validates overlay compositing with inline text inputs
|
|
3
3
|
*
|
|
4
|
-
* Usage:
|
|
4
|
+
* Usage: pi --extension ./examples/extensions/overlay-test.ts
|
|
5
5
|
*
|
|
6
6
|
* Run /overlay-test to show a floating overlay with:
|
|
7
7
|
* - Inline text inputs within menu items
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* ```
|
|
31
31
|
*
|
|
32
32
|
* Usage:
|
|
33
|
-
* - `
|
|
33
|
+
* - `pi --preset plan` - start with plan preset
|
|
34
34
|
* - `/preset` - show selector to switch presets mid-session
|
|
35
35
|
* - `/preset implement` - switch to implement preset directly
|
|
36
36
|
* - `Ctrl+Shift+U` - cycle through presets
|
|
@@ -69,7 +69,7 @@ interface PresetsConfig {
|
|
|
69
69
|
*/
|
|
70
70
|
function loadPresets(cwd: string): PresetsConfig {
|
|
71
71
|
const globalPath = join(getAgentDir(), "presets.json");
|
|
72
|
-
const projectPath = join(cwd, ".
|
|
72
|
+
const projectPath = join(cwd, ".pi", "presets.json");
|
|
73
73
|
|
|
74
74
|
let globalPresets: PresetsConfig = {};
|
|
75
75
|
let projectPresets: PresetsConfig = {};
|
|
@@ -3,7 +3,7 @@ import { join } from "node:path";
|
|
|
3
3
|
import type { ExtensionAPI } from "@eminent337/aery";
|
|
4
4
|
|
|
5
5
|
export default function (pi: ExtensionAPI) {
|
|
6
|
-
const logFile = join(process.cwd(), ".
|
|
6
|
+
const logFile = join(process.cwd(), ".pi", "provider-payload.log");
|
|
7
7
|
|
|
8
8
|
pi.on("before_provider_request", (event) => {
|
|
9
9
|
appendFileSync(logFile, `${JSON.stringify(event.payload, null, 2)}\n\n`, "utf8");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Rainbow Editor - highlights "ultrathink" with animated shine effect
|
|
3
3
|
*
|
|
4
|
-
* Usage:
|
|
4
|
+
* Usage: pi --extension ./examples/extensions/rainbow-editor.ts
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { CustomEditor, type ExtensionAPI } from "@eminent337/aery";
|
|
@@ -25,7 +25,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
25
25
|
// -- setTitle, setWidget, setStatus on session lifecycle --
|
|
26
26
|
|
|
27
27
|
pi.on("session_start", async (event, ctx) => {
|
|
28
|
-
ctx.ui.setTitle(event.reason === "new" ? "
|
|
28
|
+
ctx.ui.setTitle(event.reason === "new" ? "pi RPC Demo (new session)" : "pi RPC Demo");
|
|
29
29
|
ctx.ui.setWidget("rpc-demo", ["--- RPC Extension UI Demo ---", "Loaded and ready."]);
|
|
30
30
|
ctx.ui.setStatus("rpc-demo", `Turns: ${turnCount}`);
|
|
31
31
|
});
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
* ```
|
|
31
31
|
*
|
|
32
32
|
* Usage:
|
|
33
|
-
* - `
|
|
34
|
-
* - `
|
|
33
|
+
* - `pi -e ./sandbox` - sandbox enabled with default/config settings
|
|
34
|
+
* - `pi -e ./sandbox --no-sandbox` - disable sandboxing
|
|
35
35
|
* - `/sandbox` - show current sandbox configuration
|
|
36
36
|
*
|
|
37
37
|
* Setup:
|
|
@@ -77,7 +77,7 @@ const DEFAULT_CONFIG: SandboxConfig = {
|
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
function loadConfig(cwd: string): SandboxConfig {
|
|
80
|
-
const projectConfigPath = join(cwd, ".
|
|
80
|
+
const projectConfigPath = join(cwd, ".pi", "sandbox.json");
|
|
81
81
|
const globalConfigPath = join(getAgentDir(), "extensions", "sandbox.json");
|
|
82
82
|
|
|
83
83
|
let globalConfig: Partial<SandboxConfig> = {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
3
|
-
"version": "1.
|
|
2
|
+
"name": "aery-extension-sandbox",
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
|
-
"name": "
|
|
9
|
-
"version": "1.
|
|
8
|
+
"name": "aery-extension-sandbox",
|
|
9
|
+
"version": "1.4.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sandbox-runtime": "^0.0.26"
|
|
12
12
|
}
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"node_modules/lodash-es": {
|
|
65
|
-
"version": "4.
|
|
66
|
-
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.
|
|
67
|
-
"integrity": "sha512-
|
|
65
|
+
"version": "4.18.1",
|
|
66
|
+
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.18.1.tgz",
|
|
67
|
+
"integrity": "sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A==",
|
|
68
68
|
"license": "MIT"
|
|
69
69
|
},
|
|
70
70
|
"node_modules/shell-quote": {
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
* Shutdown Command Extension
|
|
3
3
|
*
|
|
4
4
|
* Adds a /quit command that allows extensions to trigger clean shutdown.
|
|
5
|
-
* Demonstrates how extensions can use ctx.shutdown() to exit
|
|
5
|
+
* Demonstrates how extensions can use ctx.shutdown() to exit pi cleanly.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type { ExtensionAPI } from "@eminent337/aery";
|
|
9
9
|
import { Type } from "typebox";
|
|
10
10
|
|
|
11
11
|
export default function (pi: ExtensionAPI) {
|
|
12
|
-
// Register a /quit command that cleanly exits
|
|
12
|
+
// Register a /quit command that cleanly exits pi
|
|
13
13
|
pi.registerCommand("quit", {
|
|
14
|
-
description: "Exit
|
|
14
|
+
description: "Exit pi cleanly",
|
|
15
15
|
handler: async (_args, ctx) => {
|
|
16
16
|
ctx.shutdown();
|
|
17
17
|
},
|
|
@@ -21,7 +21,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
21
21
|
pi.registerTool({
|
|
22
22
|
name: "finish_and_exit",
|
|
23
23
|
label: "Finish and Exit",
|
|
24
|
-
description: "Complete a task and exit
|
|
24
|
+
description: "Complete a task and exit pi",
|
|
25
25
|
parameters: Type.Object({}),
|
|
26
26
|
async execute(_toolCallId, _params, _signal, _onUpdate, ctx) {
|
|
27
27
|
// Do any final work here...
|
|
@@ -40,7 +40,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
40
40
|
pi.registerTool({
|
|
41
41
|
name: "deploy_and_exit",
|
|
42
42
|
label: "Deploy and Exit",
|
|
43
|
-
description: "Deploy the application and exit
|
|
43
|
+
description: "Deploy the application and exit pi",
|
|
44
44
|
parameters: Type.Object({
|
|
45
45
|
environment: Type.String({ description: "Target environment (e.g., production, staging)" }),
|
|
46
46
|
}),
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* When --ssh is provided, read/write/edit/bash run on the remote.
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* pi -e ./ssh.ts --ssh user@host
|
|
9
|
+
* pi -e ./ssh.ts --ssh user@host:/remote/path
|
|
10
10
|
*
|
|
11
11
|
* Requirements:
|
|
12
12
|
* - SSH key-based auth (no password prompts)
|
|
@@ -4,7 +4,7 @@ Delegate tasks to specialized subagents with isolated context windows.
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Isolated context**: Each subagent runs in a separate `
|
|
7
|
+
- **Isolated context**: Each subagent runs in a separate `pi` process
|
|
8
8
|
- **Streaming output**: See tool calls and progress as they happen
|
|
9
9
|
- **Parallel streaming**: All parallel tasks stream updates simultaneously
|
|
10
10
|
- **Markdown rendering**: Final output rendered with proper formatting (expanded view)
|
|
@@ -54,7 +54,7 @@ done
|
|
|
54
54
|
|
|
55
55
|
## Security Model
|
|
56
56
|
|
|
57
|
-
This tool executes a separate `
|
|
57
|
+
This tool executes a separate `pi` subprocess with a delegated system prompt and tool/model configuration.
|
|
58
58
|
|
|
59
59
|
**Project-local agents** (`.aery/agents/*.md`) are repo-controlled prompts that can instruct the model to read files, run bash commands, etc.
|
|
60
60
|
|
|
@@ -15,7 +15,7 @@ Pods handles:
|
|
|
15
15
|
- OpenAI-compatible API endpoints per model
|
|
16
16
|
- Interactive agent with file system tools for testing
|
|
17
17
|
|
|
18
|
-
Key env vars: HF_TOKEN (HuggingFace),
|
|
18
|
+
Key env vars: HF_TOKEN (HuggingFace), AERY_API_KEY (API auth).
|
|
19
19
|
Primary provider: DataCrunch (NFS volumes for shared model storage).
|
|
20
20
|
|
|
21
21
|
Rules:
|
|
@@ -85,7 +85,7 @@ function isDirectory(p: string): boolean {
|
|
|
85
85
|
function findNearestProjectAgentsDir(cwd: string): string | null {
|
|
86
86
|
let currentDir = cwd;
|
|
87
87
|
while (true) {
|
|
88
|
-
const candidate = path.join(currentDir, ".
|
|
88
|
+
const candidate = path.join(currentDir, ".pi", "agents");
|
|
89
89
|
if (isDirectory(candidate)) return candidate;
|
|
90
90
|
|
|
91
91
|
const parentDir = path.dirname(currentDir);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Subagent Tool - Delegate tasks to specialized agents
|
|
3
3
|
*
|
|
4
|
-
* Spawns a separate `
|
|
4
|
+
* Spawns a separate `pi` process for each subagent invocation,
|
|
5
5
|
* giving it an isolated context window.
|
|
6
6
|
*
|
|
7
7
|
* Supports three modes:
|
|
@@ -208,7 +208,7 @@ async function mapWithConcurrencyLimit<TIn, TOut>(
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
async function writePromptToTempFile(agentName: string, prompt: string): Promise<{ dir: string; filePath: string }> {
|
|
211
|
-
const tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "
|
|
211
|
+
const tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "pi-subagent-"));
|
|
212
212
|
const safeName = agentName.replace(/[^\w.-]+/g, "_");
|
|
213
213
|
const filePath = path.join(tmpDir, `prompt-${safeName}.md`);
|
|
214
214
|
await withFileMutationQueue(filePath, async () => {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* This is useful for:
|
|
6
6
|
* - Adding logging or auditing to tool calls
|
|
7
7
|
* - Implementing access control or sandboxing
|
|
8
|
-
* - Routing tool calls to remote systems (e.g.,
|
|
8
|
+
* - Routing tool calls to remote systems (e.g., pi-ssh-remote)
|
|
9
9
|
* - Modifying tool behavior for specific workflows
|
|
10
10
|
*
|
|
11
11
|
* This example overrides the `read` tool to:
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* is used automatically (syntax highlighting, line numbers, truncation warnings).
|
|
18
18
|
*
|
|
19
19
|
* Usage:
|
|
20
|
-
*
|
|
20
|
+
* pi -e ./tool-override.ts
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import { type ExtensionAPI, getAgentDir, withFileMutationQueue } from "@eminent337/aery";
|
|
@@ -109,7 +109,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
109
109
|
|
|
110
110
|
if (truncation.truncated) {
|
|
111
111
|
// Save full output to a temp file so LLM can access it if needed
|
|
112
|
-
const tempDir = await mkdtemp(join(tmpdir(), "
|
|
112
|
+
const tempDir = await mkdtemp(join(tmpdir(), "pi-rg-"));
|
|
113
113
|
const tempFile = join(tempDir, "output.txt");
|
|
114
114
|
await withFileMutationQueue(tempFile, async () => {
|
|
115
115
|
await writeFile(tempFile, output, "utf8");
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
3
|
-
"version": "0.
|
|
2
|
+
"name": "aery-extension-with-deps",
|
|
3
|
+
"version": "0.74.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
|
-
"name": "
|
|
9
|
-
"version": "0.
|
|
8
|
+
"name": "aery-extension-with-deps",
|
|
9
|
+
"version": "0.74.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ms": "^2.1.3"
|
|
12
12
|
},
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Working Indicator Extension
|
|
3
3
|
*
|
|
4
4
|
* Demonstrates `ctx.ui.setWorkingIndicator()` for customizing the inline
|
|
5
|
-
* working indicator shown while
|
|
5
|
+
* working indicator shown while pi is streaming a response.
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
|
-
*
|
|
8
|
+
* pi --extension examples/extensions/working-indicator.ts
|
|
9
9
|
*
|
|
10
10
|
* Commands:
|
|
11
11
|
* /working-indicator Show current mode
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* /working-indicator pulse Use a custom animated indicator
|
|
14
14
|
* /working-indicator none Hide the indicator entirely
|
|
15
15
|
* /working-indicator spinner Restore an animated spinner
|
|
16
|
-
* /working-indicator reset Restore
|
|
16
|
+
* /working-indicator reset Restore pi's default spinner
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import type { ExtensionAPI, ExtensionContext, WorkingIndicatorOptions } from "@eminent337/aery";
|
|
@@ -79,7 +79,7 @@ function describeMode(mode: WorkingIndicatorMode): string {
|
|
|
79
79
|
case "spinner":
|
|
80
80
|
return "custom spinner";
|
|
81
81
|
case "default":
|
|
82
|
-
return "
|
|
82
|
+
return "pi default spinner";
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* verify they survive across loader recreations (e.g. between agent turns).
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
|
-
*
|
|
8
|
+
* pi --extension examples/extensions/working-message-test.ts
|
|
9
9
|
*
|
|
10
10
|
* Then send a few messages in interactive mode. The working message should
|
|
11
11
|
* stay "Working... (custom)" with a brown dot indicator every time the
|
|
@@ -9,14 +9,18 @@ import { createAgentSession } from "@eminent337/aery";
|
|
|
9
9
|
|
|
10
10
|
const { session } = await createAgentSession();
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
12
|
+
try {
|
|
13
|
+
session.subscribe((event) => {
|
|
14
|
+
if (event.type === "message_update" && event.assistantMessageEvent.type === "text_delta") {
|
|
15
|
+
process.stdout.write(event.assistantMessageEvent.delta);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
17
18
|
|
|
18
|
-
await session.prompt("What files are in the current directory?");
|
|
19
|
-
session.state.messages.forEach((msg) => {
|
|
20
|
-
|
|
21
|
-
});
|
|
22
|
-
console.log();
|
|
19
|
+
await session.prompt("What files are in the current directory?");
|
|
20
|
+
session.state.messages.forEach((msg) => {
|
|
21
|
+
console.log(msg);
|
|
22
|
+
});
|
|
23
|
+
console.log();
|
|
24
|
+
} finally {
|
|
25
|
+
session.dispose();
|
|
26
|
+
}
|
|
@@ -38,12 +38,16 @@ if (available.length > 0) {
|
|
|
38
38
|
modelRegistry,
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
try {
|
|
42
|
+
session.subscribe((event) => {
|
|
43
|
+
if (event.type === "message_update" && event.assistantMessageEvent.type === "text_delta") {
|
|
44
|
+
process.stdout.write(event.assistantMessageEvent.delta);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
await session.prompt("Say hello in one sentence.");
|
|
49
|
+
console.log();
|
|
50
|
+
} finally {
|
|
51
|
+
session.dispose();
|
|
52
|
+
}
|
|
49
53
|
}
|