@eminent337/aery 0.1.19 → 0.1.21
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 +2 -2
- 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 +18 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/compaction.md +3 -3
- package/docs/custom-provider.md +4 -4
- package/docs/development.md +2 -2
- package/docs/extensions.md +28 -28
- package/docs/packages.md +1 -1
- package/docs/rpc.md +1 -1
- package/docs/sdk.md +25 -25
- package/docs/session.md +2 -2
- package/docs/skills.md +1 -1
- package/docs/termux.md +1 -1
- package/docs/tui.md +20 -20
- package/examples/extensions/README.md +2 -2
- package/examples/extensions/doom-overlay/README.md +1 -1
- package/examples/extensions/overlay-qa-tests.ts +5 -5
- package/examples/sdk/README.md +2 -2
- package/package.json +1 -1
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:** [`@
|
|
7
|
+
**Source:** [`@eminent337/aery-tui`](https://github.com/eminent337/aery/tree/main/packages/tui)
|
|
8
8
|
|
|
9
9
|
## Component Interface
|
|
10
10
|
|
|
@@ -33,7 +33,7 @@ The TUI appends a full SGR reset and OSC 8 reset at the end of each rendered lin
|
|
|
33
33
|
Components that display a text cursor and need IME (Input Method Editor) support should implement the `Focusable` interface:
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
|
-
import { CURSOR_MARKER, type Component, type Focusable } from "@
|
|
36
|
+
import { CURSOR_MARKER, type Component, type Focusable } from "@eminent337/aery-tui";
|
|
37
37
|
|
|
38
38
|
class MyInput implements Component, Focusable {
|
|
39
39
|
focused: boolean = false; // Set by TUI when focus changes
|
|
@@ -59,7 +59,7 @@ This enables IME candidate windows to appear at the correct position for CJK inp
|
|
|
59
59
|
When a container component (dialog, selector, etc.) contains an `Input` or `Editor` child, the container must implement `Focusable` and propagate the focus state to the child. Otherwise, the hardware cursor won't be positioned correctly for IME input.
|
|
60
60
|
|
|
61
61
|
```typescript
|
|
62
|
-
import { Container, type Focusable, Input } from "@
|
|
62
|
+
import { Container, type Focusable, Input } from "@eminent337/aery-tui";
|
|
63
63
|
|
|
64
64
|
class SearchDialog extends Container implements Focusable {
|
|
65
65
|
private searchInput: Input;
|
|
@@ -179,10 +179,10 @@ See [overlay-qa-tests.ts](../examples/extensions/overlay-qa-tests.ts) for compre
|
|
|
179
179
|
|
|
180
180
|
## Built-in Components
|
|
181
181
|
|
|
182
|
-
Import from `@
|
|
182
|
+
Import from `@eminent337/aery-tui`:
|
|
183
183
|
|
|
184
184
|
```typescript
|
|
185
|
-
import { Text, Box, Container, Spacer, Markdown } from "@
|
|
185
|
+
import { Text, Box, Container, Spacer, Markdown } from "@eminent337/aery-tui";
|
|
186
186
|
```
|
|
187
187
|
|
|
188
188
|
### Text
|
|
@@ -264,7 +264,7 @@ const image = new Image(
|
|
|
264
264
|
Use `matchesKey()` for key detection:
|
|
265
265
|
|
|
266
266
|
```typescript
|
|
267
|
-
import { matchesKey, Key } from "@
|
|
267
|
+
import { matchesKey, Key } from "@eminent337/aery-tui";
|
|
268
268
|
|
|
269
269
|
handleInput(data: string) {
|
|
270
270
|
if (matchesKey(data, Key.up)) {
|
|
@@ -290,7 +290,7 @@ handleInput(data: string) {
|
|
|
290
290
|
**Critical:** Each line from `render()` must not exceed the `width` parameter.
|
|
291
291
|
|
|
292
292
|
```typescript
|
|
293
|
-
import { visibleWidth, truncateToWidth } from "@
|
|
293
|
+
import { visibleWidth, truncateToWidth } from "@eminent337/aery-tui";
|
|
294
294
|
|
|
295
295
|
render(width: number): string[] {
|
|
296
296
|
// Truncate long lines
|
|
@@ -311,7 +311,7 @@ Example: Interactive selector
|
|
|
311
311
|
import {
|
|
312
312
|
matchesKey, Key,
|
|
313
313
|
truncateToWidth, visibleWidth
|
|
314
|
-
} from "@
|
|
314
|
+
} from "@eminent337/aery-tui";
|
|
315
315
|
|
|
316
316
|
class MySelector {
|
|
317
317
|
private items: string[];
|
|
@@ -425,8 +425,8 @@ renderResult(result, options, theme, context) {
|
|
|
425
425
|
**For Markdown**, use `getMarkdownTheme()`:
|
|
426
426
|
|
|
427
427
|
```typescript
|
|
428
|
-
import { getMarkdownTheme } from "@
|
|
429
|
-
import { Markdown } from "@
|
|
428
|
+
import { getMarkdownTheme } from "@eminent337/aery";
|
|
429
|
+
import { Markdown } from "@eminent337/aery-tui";
|
|
430
430
|
|
|
431
431
|
renderResult(result, options, theme, context) {
|
|
432
432
|
const mdTheme = getMarkdownTheme();
|
|
@@ -587,12 +587,12 @@ These patterns cover the most common UI needs in extensions. **Copy these patter
|
|
|
587
587
|
|
|
588
588
|
### Pattern 1: Selection Dialog (SelectList)
|
|
589
589
|
|
|
590
|
-
For letting users pick from a list of options. Use `SelectList` from `@
|
|
590
|
+
For letting users pick from a list of options. Use `SelectList` from `@eminent337/aery-tui` with `DynamicBorder` for framing.
|
|
591
591
|
|
|
592
592
|
```typescript
|
|
593
|
-
import type { ExtensionAPI } from "@
|
|
594
|
-
import { DynamicBorder } from "@
|
|
595
|
-
import { Container, type SelectItem, SelectList, Text } from "@
|
|
593
|
+
import type { ExtensionAPI } from "@eminent337/aery";
|
|
594
|
+
import { DynamicBorder } from "@eminent337/aery";
|
|
595
|
+
import { Container, type SelectItem, SelectList, Text } from "@eminent337/aery-tui";
|
|
596
596
|
|
|
597
597
|
pi.registerCommand("pick", {
|
|
598
598
|
handler: async (_args, ctx) => {
|
|
@@ -650,7 +650,7 @@ pi.registerCommand("pick", {
|
|
|
650
650
|
For operations that take time and should be cancellable. `BorderedLoader` shows a spinner and handles escape to cancel.
|
|
651
651
|
|
|
652
652
|
```typescript
|
|
653
|
-
import { BorderedLoader } from "@
|
|
653
|
+
import { BorderedLoader } from "@eminent337/aery";
|
|
654
654
|
|
|
655
655
|
pi.registerCommand("fetch", {
|
|
656
656
|
handler: async (_args, ctx) => {
|
|
@@ -679,11 +679,11 @@ pi.registerCommand("fetch", {
|
|
|
679
679
|
|
|
680
680
|
### Pattern 3: Settings/Toggles (SettingsList)
|
|
681
681
|
|
|
682
|
-
For toggling multiple settings. Use `SettingsList` from `@
|
|
682
|
+
For toggling multiple settings. Use `SettingsList` from `@eminent337/aery-tui` with `getSettingsListTheme()`.
|
|
683
683
|
|
|
684
684
|
```typescript
|
|
685
|
-
import { getSettingsListTheme } from "@
|
|
686
|
-
import { Container, type SettingItem, SettingsList, Text } from "@
|
|
685
|
+
import { getSettingsListTheme } from "@eminent337/aery";
|
|
686
|
+
import { Container, type SettingItem, SettingsList, Text } from "@eminent337/aery-tui";
|
|
687
687
|
|
|
688
688
|
pi.registerCommand("settings", {
|
|
689
689
|
handler: async (_args, ctx) => {
|
|
@@ -822,8 +822,8 @@ Token stats available via `ctx.sessionManager.getBranch()` and `ctx.model`.
|
|
|
822
822
|
Replace the main input editor with a custom implementation. Useful for modal editing (vim), different keybindings (emacs), or specialized input handling.
|
|
823
823
|
|
|
824
824
|
```typescript
|
|
825
|
-
import { CustomEditor, type ExtensionAPI } from "@
|
|
826
|
-
import { matchesKey, truncateToWidth } from "@
|
|
825
|
+
import { CustomEditor, type ExtensionAPI } from "@eminent337/aery";
|
|
826
|
+
import { matchesKey, truncateToWidth } from "@eminent337/aery-tui";
|
|
827
827
|
|
|
828
828
|
type Mode = "normal" | "insert";
|
|
829
829
|
|
|
@@ -137,7 +137,7 @@ cp permission-gate.ts ~/.pi/agent/extensions/
|
|
|
137
137
|
See [docs/extensions.md](../../docs/extensions.md) for full documentation.
|
|
138
138
|
|
|
139
139
|
```typescript
|
|
140
|
-
import type { ExtensionAPI } from "@
|
|
140
|
+
import type { ExtensionAPI } from "@eminent337/aery";
|
|
141
141
|
import { Type } from "@sinclair/typebox";
|
|
142
142
|
|
|
143
143
|
export default function (pi: ExtensionAPI) {
|
|
@@ -179,7 +179,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
179
179
|
|
|
180
180
|
**Use StringEnum for string parameters** (required for Google API compatibility):
|
|
181
181
|
```typescript
|
|
182
|
-
import { StringEnum } from "@
|
|
182
|
+
import { StringEnum } from "@eminent337/aery-ai";
|
|
183
183
|
|
|
184
184
|
// Good
|
|
185
185
|
action: StringEnum(["list", "add"] as const)
|
|
@@ -43,4 +43,4 @@ Height is calculated from width to maintain DOOM's 3.2:1 aspect ratio (accountin
|
|
|
43
43
|
|
|
44
44
|
- [id Software](https://github.com/id-Software/DOOM) for the original DOOM
|
|
45
45
|
- [doomgeneric](https://github.com/ozkl/doomgeneric) for the portable DOOM implementation
|
|
46
|
-
- [
|
|
46
|
+
- [aery-doom](https://github.com/eminent337/aery) for the original pi integration
|
|
@@ -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 aery-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/aery/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/aery\\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 aery-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", " (aery-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)}╯`));
|
package/examples/sdk/README.md
CHANGED
|
@@ -32,7 +32,7 @@ npx tsx examples/sdk/01-minimal.ts
|
|
|
32
32
|
## Quick Reference
|
|
33
33
|
|
|
34
34
|
```typescript
|
|
35
|
-
import { getModel } from "@
|
|
35
|
+
import { getModel } from "@eminent337/aery-ai";
|
|
36
36
|
import {
|
|
37
37
|
AuthStorage,
|
|
38
38
|
createAgentSession,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
codingTools,
|
|
44
44
|
readOnlyTools,
|
|
45
45
|
readTool, bashTool, editTool, writeTool,
|
|
46
|
-
} from "@
|
|
46
|
+
} from "@eminent337/aery";
|
|
47
47
|
|
|
48
48
|
// Auth and models setup
|
|
49
49
|
const authStorage = AuthStorage.create();
|