@pmndre/pine 0.0.0-stage → 0.22.0
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/LICENSE +21 -0
- package/README.md +226 -2
- package/bin/pine.js +27 -0
- package/docs/SKILL.md +234 -0
- package/docs/references/agents.md +454 -0
- package/docs/references/coding.md +311 -0
- package/docs/references/computer.md +212 -0
- package/docs/references/configuration.md +310 -0
- package/docs/references/events.md +267 -0
- package/docs/references/mcp.md +420 -0
- package/docs/references/operations.md +394 -0
- package/docs/references/overview.md +195 -0
- package/docs/references/security.md +896 -0
- package/docs/references/setup.md +385 -0
- package/docs/references/sources.md +772 -0
- package/docs/references/stack.md +121 -0
- package/docs/references/tui.md +575 -0
- package/examples/home/.env.example +7 -0
- package/examples/home/USER.md +4 -0
- package/examples/home/agents/main/agent.json +4 -0
- package/examples/home/agents/main/workspace/AGENTS.md +14 -0
- package/examples/home/agents/main/workspace/MEMORY.md +4 -0
- package/examples/home/agents/main/workspace/SOUL.md +4 -0
- package/examples/home/models.json +62 -0
- package/examples/home/pine.json +34 -0
- package/examples/home/skills/README.txt +7 -0
- package/examples/launchd/com.pine.daemon.plist +32 -0
- package/examples/systemd/pine.service +22 -0
- package/mcp/browser.d.ts +99 -0
- package/mcp/browser.js +496 -0
- package/mcp/commands.d.ts +20 -0
- package/mcp/commands.js +88 -0
- package/mcp/computer.d.ts +139 -0
- package/mcp/computer.js +698 -0
- package/mcp/computer.swift +989 -0
- package/mcp/lib.d.ts +23 -0
- package/mcp/lib.js +52 -0
- package/mcp/web.d.ts +6 -0
- package/mcp/web.js +140 -0
- package/package.json +32 -4
- package/src/access.d.ts +112 -0
- package/src/access.js +438 -0
- package/src/actions.d.ts +75 -0
- package/src/actions.js +167 -0
- package/src/admin.d.ts +167 -0
- package/src/admin.js +625 -0
- package/src/agent-admin.d.ts +24 -0
- package/src/agent-admin.js +55 -0
- package/src/agents.d.ts +540 -0
- package/src/agents.js +2776 -0
- package/src/background.d.ts +29 -0
- package/src/background.js +100 -0
- package/src/cli.d.ts +2 -0
- package/src/cli.js +777 -0
- package/src/computer.d.ts +30 -0
- package/src/computer.js +32 -0
- package/src/config.d.ts +396 -0
- package/src/config.js +549 -0
- package/src/dev/claude-model.d.ts +37 -0
- package/src/dev/claude-model.js +204 -0
- package/src/env-file.d.ts +4 -0
- package/src/env-file.js +40 -0
- package/src/goals.d.ts +133 -0
- package/src/goals.js +316 -0
- package/src/http.d.ts +46 -0
- package/src/http.js +509 -0
- package/src/limiter.d.ts +32 -0
- package/src/limiter.js +84 -0
- package/src/login.d.ts +23 -0
- package/src/login.js +130 -0
- package/src/manual.d.ts +61 -0
- package/src/manual.js +443 -0
- package/src/mcp-config.d.ts +49 -0
- package/src/mcp-config.js +182 -0
- package/src/models.d.ts +90 -0
- package/src/models.js +274 -0
- package/src/net.d.ts +50 -0
- package/src/net.js +150 -0
- package/src/pine.d.ts +32 -0
- package/src/pine.js +134 -0
- package/src/programs.d.ts +123 -0
- package/src/programs.js +412 -0
- package/src/router.d.ts +56 -0
- package/src/router.js +164 -0
- package/src/sandbox-fs.d.ts +34 -0
- package/src/sandbox-fs.js +186 -0
- package/src/sandbox-linux.d.ts +96 -0
- package/src/sandbox-linux.js +297 -0
- package/src/sandbox-setup.d.ts +70 -0
- package/src/sandbox-setup.js +216 -0
- package/src/security.d.ts +238 -0
- package/src/security.js +660 -0
- package/src/skills.d.ts +67 -0
- package/src/skills.js +163 -0
- package/src/snapshots.d.ts +68 -0
- package/src/snapshots.js +306 -0
- package/src/source-types.d.ts +61 -0
- package/src/source-types.js +1 -0
- package/src/sources/command.d.ts +4 -0
- package/src/sources/command.js +77 -0
- package/src/sources/folder.d.ts +6 -0
- package/src/sources/folder.js +116 -0
- package/src/sources/ftp.d.ts +4 -0
- package/src/sources/ftp.js +307 -0
- package/src/sources/http.d.ts +4 -0
- package/src/sources/http.js +201 -0
- package/src/sources/mqtt.d.ts +18 -0
- package/src/sources/mqtt.js +97 -0
- package/src/sources/telegram.d.ts +22 -0
- package/src/sources/telegram.js +283 -0
- package/src/sources/webhook.d.ts +4 -0
- package/src/sources/webhook.js +52 -0
- package/src/sources.d.ts +344 -0
- package/src/sources.js +966 -0
- package/src/store.d.ts +99 -0
- package/src/store.js +277 -0
- package/src/timers.d.ts +83 -0
- package/src/timers.js +318 -0
- package/src/tools.d.ts +11 -0
- package/src/tools.js +1297 -0
- package/src/tui/app.d.ts +305 -0
- package/src/tui/app.js +3195 -0
- package/src/tui/client.d.ts +236 -0
- package/src/tui/client.js +131 -0
- package/src/tui/code-pane.d.ts +68 -0
- package/src/tui/code-pane.js +535 -0
- package/src/tui/highlight.d.ts +8 -0
- package/src/tui/highlight.js +86 -0
- package/src/tui/picture.d.ts +206 -0
- package/src/tui/picture.js +801 -0
- package/src/tui/run.d.ts +8 -0
- package/src/tui/run.js +97 -0
- package/src/tui/theme.d.ts +32 -0
- package/src/tui/theme.js +128 -0
- package/src/tui/undo.d.ts +5 -0
- package/src/tui/undo.js +50 -0
- package/src/tui/voice.d.ts +49 -0
- package/src/tui/voice.js +155 -0
- package/src/tui/voice.swift +223 -0
- package/src/types.d.ts +139 -0
- package/src/types.js +1 -0
- package/src/undo.d.ts +224 -0
- package/src/undo.js +465 -0
- package/src/update.d.ts +35 -0
- package/src/update.js +130 -0
- package/src/util.d.ts +65 -0
- package/src/util.js +171 -0
- package/src/watching.d.ts +20 -0
- package/src/watching.js +68 -0
- package/src/workspace-view.d.ts +72 -0
- package/src/workspace-view.js +221 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { type Component } from "@earendil-works/pi-tui";
|
|
2
|
+
/**
|
|
3
|
+
* Pictures in the conversation. Display only: nothing here is sent to a model.
|
|
4
|
+
*
|
|
5
|
+
* Two ways to draw one. A terminal with the Kitty graphics protocol (kitty, Ghostty, WezTerm) gets
|
|
6
|
+
* the real picture. Every other terminal gets coloured half blocks: each character cell shows two
|
|
7
|
+
* pixels, one as the colour of "▀" and one as its background. For that the picture has to be
|
|
8
|
+
* decoded and scaled, which macOS's own `sips` does; it also turns jpg, gif and webp into the png
|
|
9
|
+
* the Kitty protocol wants.
|
|
10
|
+
*/
|
|
11
|
+
export interface Pixels {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
/** width * height * 3 bytes, rows from the top. */
|
|
15
|
+
rgb: Uint8Array;
|
|
16
|
+
}
|
|
17
|
+
export interface Prepared {
|
|
18
|
+
name: string;
|
|
19
|
+
widthPx: number;
|
|
20
|
+
heightPx: number;
|
|
21
|
+
/** Base64 png, scaled down to at most 1200 pixels on its longer side. */
|
|
22
|
+
png?: string;
|
|
23
|
+
/** A small copy for the half-block drawing. */
|
|
24
|
+
pixels?: Pixels;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Write a copy of a picture as png or bmp, at most `limit` pixels on its longer side: with
|
|
28
|
+
* macOS's sips, and with ffmpeg where there is no sips (Linux).
|
|
29
|
+
*/
|
|
30
|
+
export declare function scaled(dir: string, source: string, limit: number, format: "png" | "bmp", tool?: "sips" | "ffmpeg" | undefined): Promise<boolean>;
|
|
31
|
+
/** Read an uncompressed 24 or 32 bit BMP, the simplest format sips and ffmpeg write. Transparent parts are shown on dark grey. */
|
|
32
|
+
export declare function parseBmp(b: Buffer): Pixels | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Make a picture ready to draw. Returns what could be made: without a converter (no sips, no
|
|
35
|
+
* ffmpeg) a png still shows on a Kitty-protocol terminal, and anything else is shown as a line of text.
|
|
36
|
+
*/
|
|
37
|
+
export declare function prepare(bytes: Buffer, mime: string, name: string): Promise<Prepared>;
|
|
38
|
+
/** Draw a picture with half blocks, at most `maxCols` cells wide and `maxRows` lines high. */
|
|
39
|
+
export declare function halfBlocks(p: Pixels, maxCols: number, maxRows: number, trueColor?: boolean): string[];
|
|
40
|
+
/**
|
|
41
|
+
* The lines of a screen, with every real picture that `covered` says something lies over drawn as
|
|
42
|
+
* text instead. `covered` gets the picture's place: its first line and column, its width and height.
|
|
43
|
+
* Returns the same array when no picture is covered.
|
|
44
|
+
*/
|
|
45
|
+
export declare function picturesAsText(lines: string[], covered: (row: number, col: number, width: number, height: number) => boolean): string[];
|
|
46
|
+
/** One picture in the conversation: a thumbnail that a click enlarges and a second click shrinks again. */
|
|
47
|
+
export declare class Picture implements Component {
|
|
48
|
+
private p;
|
|
49
|
+
private large;
|
|
50
|
+
private images;
|
|
51
|
+
private cache?;
|
|
52
|
+
constructor(prepared: Prepared);
|
|
53
|
+
invalidate(): void;
|
|
54
|
+
handleMouse(e: any): {
|
|
55
|
+
handled: boolean;
|
|
56
|
+
render: boolean;
|
|
57
|
+
} | undefined;
|
|
58
|
+
/** The drawing itself, without a caption: the real picture where the terminal can show one, half blocks otherwise, nothing if neither works. */
|
|
59
|
+
body(width: number, large?: boolean): string[];
|
|
60
|
+
blocks(id: number, cols: number): string[];
|
|
61
|
+
render(width: number): string[];
|
|
62
|
+
}
|
|
63
|
+
/** A place in the conversation that is filled in later, so a picture lands where it belongs however long it takes to load. */
|
|
64
|
+
export declare class Slot implements Component {
|
|
65
|
+
inner?: Component;
|
|
66
|
+
invalidate(): void;
|
|
67
|
+
handleMouse(e: any): import("@earendil-works/pi-tui").TuiMouseEventResult | undefined;
|
|
68
|
+
render(width: number): string[];
|
|
69
|
+
}
|
|
70
|
+
/** Whether videos can be played in the conversation (ffmpeg is installed). */
|
|
71
|
+
export declare const canPlayVideo: boolean;
|
|
72
|
+
export interface PreparedVideo {
|
|
73
|
+
file: string;
|
|
74
|
+
name: string;
|
|
75
|
+
seconds?: number;
|
|
76
|
+
poster: Prepared;
|
|
77
|
+
}
|
|
78
|
+
/** Get a video file ready to show: a still from its start, and how long it runs. */
|
|
79
|
+
export declare function prepareVideo(file: string, name: string): Promise<PreparedVideo>;
|
|
80
|
+
/** A png from raw pixels (3 bytes each, rows from the top): what the Kitty graphics protocol takes. Fast, lightly compressed. */
|
|
81
|
+
export declare function pngFromRgb(rgb: Uint8Array, width: number, height: number): Buffer;
|
|
82
|
+
/**
|
|
83
|
+
* One video in the conversation. It plays at the size it is shown in. The picture itself is the
|
|
84
|
+
* size switch (click to enlarge, click to shrink), the first word of the caption is play and pause.
|
|
85
|
+
*
|
|
86
|
+
* Frames are drawn the way pictures are: as real images where the terminal has the Kitty graphics
|
|
87
|
+
* protocol (each frame replaces the last under one image id), as half blocks everywhere else.
|
|
88
|
+
*/
|
|
89
|
+
export declare class Video implements Component {
|
|
90
|
+
private v;
|
|
91
|
+
private still;
|
|
92
|
+
private redraw;
|
|
93
|
+
private open;
|
|
94
|
+
private child?;
|
|
95
|
+
private ticker?;
|
|
96
|
+
private frame?;
|
|
97
|
+
/** The current frame as a real image, on terminals that can show one. */
|
|
98
|
+
private shown?;
|
|
99
|
+
private imageId;
|
|
100
|
+
private paused;
|
|
101
|
+
private large;
|
|
102
|
+
/** Seconds of the video shown so far. */
|
|
103
|
+
private position;
|
|
104
|
+
private width;
|
|
105
|
+
private captionRow;
|
|
106
|
+
/** The lines the frame takes on screen. */
|
|
107
|
+
private shownRows;
|
|
108
|
+
private playTo;
|
|
109
|
+
private openFrom;
|
|
110
|
+
constructor(video: PreparedVideo, redraw: () => void, open: (file: string) => void);
|
|
111
|
+
invalidate(): void;
|
|
112
|
+
get state(): "idle" | "playing" | "paused";
|
|
113
|
+
/** The cells a frame fills: the same room the still takes at the current size, in the video's own shape. */
|
|
114
|
+
private size;
|
|
115
|
+
/**
|
|
116
|
+
* The pixels to decode a frame at. For half blocks: one pixel per half cell. For real images: as
|
|
117
|
+
* many pixels as those cells have on screen, up to a width that a terminal takes ten times a second.
|
|
118
|
+
*/
|
|
119
|
+
private pixels;
|
|
120
|
+
/** Play, or go on after a pause. At the end it starts over. */
|
|
121
|
+
play(): void;
|
|
122
|
+
pause(): void;
|
|
123
|
+
/** Decode from `from` seconds on, at the current size. `hold`: show one frame and stay paused there. */
|
|
124
|
+
private start;
|
|
125
|
+
/** Back to the still. */
|
|
126
|
+
stop(): void;
|
|
127
|
+
private resize;
|
|
128
|
+
handleMouse(e: any): {
|
|
129
|
+
handled: boolean;
|
|
130
|
+
render: boolean;
|
|
131
|
+
} | undefined;
|
|
132
|
+
blocks(_id: number, cols: number): string[];
|
|
133
|
+
render(width: number): string[];
|
|
134
|
+
}
|
|
135
|
+
/** Stop whatever video is playing, for example when the UI closes. */
|
|
136
|
+
export declare function stopVideos(): void;
|
|
137
|
+
/**
|
|
138
|
+
* A program that plays a sound file: the command, with the file as its last argument. `from` says
|
|
139
|
+
* how it is told where in the file to start (arguments in front of the file); what it writes to
|
|
140
|
+
* its output when the sound starts sets the clock. A player that has
|
|
141
|
+
* it is ended at a pause and started again from there; one without it is held and let go
|
|
142
|
+
* (SIGSTOP), which not every program takes well: macOS's afplay goes on as if it had played.
|
|
143
|
+
*/
|
|
144
|
+
export interface SoundPlayer {
|
|
145
|
+
command: string[];
|
|
146
|
+
from?: (seconds: number) => string[];
|
|
147
|
+
}
|
|
148
|
+
/** What plays sound on this computer. Undefined: nothing here can. */
|
|
149
|
+
export declare function soundPlayer(): SoundPlayer | undefined;
|
|
150
|
+
export interface PreparedSound {
|
|
151
|
+
file: string;
|
|
152
|
+
name: string;
|
|
153
|
+
seconds?: number;
|
|
154
|
+
}
|
|
155
|
+
/** Get a sound file ready: how long it runs, where that can be told. */
|
|
156
|
+
export declare function prepareSound(file: string, name: string): Promise<PreparedSound>;
|
|
157
|
+
/**
|
|
158
|
+
* One sound in the conversation: a line with play and pause, like a video's. A pause ends the
|
|
159
|
+
* player and play starts one from where it was, as a video does with ffmpeg; a player that
|
|
160
|
+
* cannot start in the middle is held instead (see SoundPlayer). At the end the line is back at
|
|
161
|
+
* the start.
|
|
162
|
+
*/
|
|
163
|
+
export declare class Sound implements Component {
|
|
164
|
+
private s;
|
|
165
|
+
private player;
|
|
166
|
+
private redraw;
|
|
167
|
+
private open;
|
|
168
|
+
private child?;
|
|
169
|
+
private ticker?;
|
|
170
|
+
private paused;
|
|
171
|
+
/** Milliseconds played before the last pause, and when it went on from there. */
|
|
172
|
+
private before;
|
|
173
|
+
private since;
|
|
174
|
+
private failed;
|
|
175
|
+
private playTo;
|
|
176
|
+
private openFrom;
|
|
177
|
+
constructor(sound: PreparedSound, player: SoundPlayer | undefined, redraw: () => void, open: (file: string) => void);
|
|
178
|
+
invalidate(): void;
|
|
179
|
+
get state(): "idle" | "playing" | "paused";
|
|
180
|
+
private played;
|
|
181
|
+
/** The player and whatever it started, as one: the sandbox in front of it may be a process of its own. */
|
|
182
|
+
private signal;
|
|
183
|
+
/** Play, or go on after a pause. One sound at a time: another one that is playing stops. */
|
|
184
|
+
play(): void;
|
|
185
|
+
pause(): void;
|
|
186
|
+
/** Back to the start. */
|
|
187
|
+
stop(): void;
|
|
188
|
+
handleMouse(e: any): {
|
|
189
|
+
handled: boolean;
|
|
190
|
+
render: boolean;
|
|
191
|
+
} | undefined;
|
|
192
|
+
render(width: number): string[];
|
|
193
|
+
}
|
|
194
|
+
/** Stop whatever sound is playing, for example when the UI closes. */
|
|
195
|
+
export declare function stopSounds(): void;
|
|
196
|
+
export declare const isAudioFile: (name: string) => boolean;
|
|
197
|
+
export declare const isVideoFile: (name: string) => boolean;
|
|
198
|
+
export declare const isImageFile: (name: string) => boolean;
|
|
199
|
+
export declare const mimeOf: (name: string) => "" | "image/gif" | "image/jpeg" | "image/png" | "image/webp";
|
|
200
|
+
export interface PictureRef {
|
|
201
|
+
caption: string;
|
|
202
|
+
target: string;
|
|
203
|
+
remote: boolean;
|
|
204
|
+
}
|
|
205
|
+
/** The pictures an answer points at with . Code blocks are left alone. */
|
|
206
|
+
export declare function picturesIn(markdown: string, max?: number): PictureRef[];
|