@pmndrs/pine 0.0.0-stage → 0.1.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 +180 -2
- package/bin/pine.js +27 -0
- package/docs/SKILL.md +189 -0
- package/docs/references/agents.md +368 -0
- package/docs/references/coding.md +126 -0
- package/docs/references/configuration.md +229 -0
- package/docs/references/events.md +263 -0
- package/docs/references/mcp.md +257 -0
- package/docs/references/operations.md +280 -0
- package/docs/references/overview.md +186 -0
- package/docs/references/security.md +489 -0
- package/docs/references/setup.md +181 -0
- package/docs/references/sources.md +768 -0
- package/docs/references/stack.md +105 -0
- package/docs/references/tui.md +348 -0
- package/examples/home/.env.example +5 -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 +30 -0
- package/examples/home/skills/README.txt +7 -0
- package/examples/launchd/com.pine.daemon.plist +32 -0
- package/mcp/browser.d.ts +34 -0
- package/mcp/browser.js +228 -0
- package/mcp/commands.d.ts +20 -0
- package/mcp/commands.js +88 -0
- package/mcp/lib.d.ts +13 -0
- package/mcp/lib.js +50 -0
- package/mcp/web.d.ts +6 -0
- package/mcp/web.js +140 -0
- package/package.json +32 -4
- package/src/agent-admin.d.ts +24 -0
- package/src/agent-admin.js +55 -0
- package/src/agents.d.ts +343 -0
- package/src/agents.js +1587 -0
- package/src/cli.d.ts +2 -0
- package/src/cli.js +526 -0
- package/src/config.d.ts +351 -0
- package/src/config.js +514 -0
- package/src/dev/claude-model.d.ts +28 -0
- package/src/dev/claude-model.js +174 -0
- package/src/env-file.d.ts +4 -0
- package/src/env-file.js +40 -0
- package/src/http.d.ts +46 -0
- package/src/http.js +407 -0
- package/src/limiter.d.ts +32 -0
- package/src/limiter.js +84 -0
- package/src/login.d.ts +21 -0
- package/src/login.js +126 -0
- package/src/manual.d.ts +61 -0
- package/src/manual.js +425 -0
- package/src/mcp-config.d.ts +40 -0
- package/src/mcp-config.js +132 -0
- package/src/net.d.ts +36 -0
- package/src/net.js +122 -0
- package/src/pine.d.ts +32 -0
- package/src/pine.js +142 -0
- package/src/router.d.ts +56 -0
- package/src/router.js +164 -0
- package/src/sandbox-fs.d.ts +27 -0
- package/src/sandbox-fs.js +172 -0
- package/src/security.d.ts +121 -0
- package/src/security.js +363 -0
- package/src/skills.d.ts +67 -0
- package/src/skills.js +163 -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 +269 -0
- package/src/sources/webhook.d.ts +4 -0
- package/src/sources/webhook.js +52 -0
- package/src/sources.d.ts +339 -0
- package/src/sources.js +955 -0
- package/src/store.d.ts +89 -0
- package/src/store.js +251 -0
- package/src/timers.d.ts +83 -0
- package/src/timers.js +318 -0
- package/src/tools.d.ts +6 -0
- package/src/tools.js +777 -0
- package/src/tui/app.d.ts +209 -0
- package/src/tui/app.js +2223 -0
- package/src/tui/client.d.ts +178 -0
- package/src/tui/client.js +116 -0
- package/src/tui/code-pane.d.ts +51 -0
- package/src/tui/code-pane.js +398 -0
- package/src/tui/highlight.d.ts +8 -0
- package/src/tui/highlight.js +86 -0
- package/src/tui/picture.d.ts +141 -0
- package/src/tui/picture.js +571 -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/types.d.ts +124 -0
- package/src/types.js +1 -0
- package/src/update.d.ts +25 -0
- package/src/update.js +110 -0
- package/src/util.d.ts +32 -0
- package/src/util.js +116 -0
- package/src/watching.d.ts +20 -0
- package/src/watching.js +68 -0
- package/src/workspace-view.d.ts +38 -0
- package/src/workspace-view.js +160 -0
package/src/tui/app.d.ts
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { type SelectItem, type Terminal, TuiAltScreen } from "@earendil-works/pi-tui";
|
|
2
|
+
import type { Client } from "./client.ts";
|
|
3
|
+
export interface LinkSpan {
|
|
4
|
+
line: number;
|
|
5
|
+
from: number;
|
|
6
|
+
to: number;
|
|
7
|
+
url: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Web addresses in a block of plain screen lines, with the cells each one covers. A long address
|
|
11
|
+
* is wrapped over several lines; a line that runs to the right edge is read together with the next,
|
|
12
|
+
* and every piece of the address points to the whole of it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function findLinks(lines: string[], width: number): LinkSpan[];
|
|
15
|
+
/** The address under a cell, if any. */
|
|
16
|
+
export declare function urlAt(lines: string[], y: number, x: number, width: number): string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Text that a terminal pastes when files are dropped on it: one or more paths, with spaces
|
|
19
|
+
* escaped or the path in quotes, sometimes as file:// URLs. Returns the files (with `folders`: the folders) only when every
|
|
20
|
+
* piece of the text is an existing one; otherwise the text is ordinary input.
|
|
21
|
+
*/
|
|
22
|
+
export declare function droppedFiles(text: string, folders?: boolean): string[] | null;
|
|
23
|
+
/**
|
|
24
|
+
* Entries that match what was typed: every word must occur somewhere in the name or description,
|
|
25
|
+
* in any position ("dee" finds opencode-go/deepseek-v4.1-flash). If nothing matches that way,
|
|
26
|
+
* fall back to loose matching so a typo still finds something.
|
|
27
|
+
*/
|
|
28
|
+
export declare function searchItems(items: SelectItem[], query: string): SelectItem[];
|
|
29
|
+
/**
|
|
30
|
+
* The screen, with one addition: while a menu or question is open, a click next to it goes to the
|
|
31
|
+
* app (which closes the menu) instead of to whatever lies underneath.
|
|
32
|
+
*/
|
|
33
|
+
declare class Screen extends TuiAltScreen {
|
|
34
|
+
onOutside?: (e: any) => boolean;
|
|
35
|
+
protected dispatchMouseToOverlay(event: any): any;
|
|
36
|
+
/**
|
|
37
|
+
* A real picture is drawn above all text, so it would lie across a menu opened over it. Pictures
|
|
38
|
+
* that a menu or dialog covers are drawn as text for as long as it is there.
|
|
39
|
+
*/
|
|
40
|
+
protected compositeOverlays(lines: string[], width: number, height: number): string[];
|
|
41
|
+
}
|
|
42
|
+
export interface TuiOptions {
|
|
43
|
+
client: Client;
|
|
44
|
+
terminal: Terminal;
|
|
45
|
+
/** Called once when the user quits. */
|
|
46
|
+
onQuit?: () => void | Promise<void>;
|
|
47
|
+
/** Shown in the footer, for example "embedded daemon". */
|
|
48
|
+
mode?: string;
|
|
49
|
+
/** Hands a video file to a player when "open in player" is clicked. Default: the system's player. */
|
|
50
|
+
openFile?: (file: string) => void;
|
|
51
|
+
/** Opens a web address when it is clicked. Default: the system's browser. */
|
|
52
|
+
openUrl?: (url: string) => void;
|
|
53
|
+
/** Lets the user pick a folder; resolves with nothing when they do not. Default: the system's folder chooser (macOS). */
|
|
54
|
+
chooseFolder?: () => Promise<string | undefined>;
|
|
55
|
+
/** The folder pine was started in, offered in the folder menu. Default: the process's. */
|
|
56
|
+
cwd?: string;
|
|
57
|
+
/** MCP server administration that needs this machine: connection states and browser sign-in. */
|
|
58
|
+
mcp?: {
|
|
59
|
+
/** The configured servers. `states` also asks each one whether it connects, which takes a moment. */
|
|
60
|
+
list(states?: boolean): Promise<Array<{
|
|
61
|
+
name: string;
|
|
62
|
+
scope: string;
|
|
63
|
+
agents: string[];
|
|
64
|
+
target: string;
|
|
65
|
+
state?: string;
|
|
66
|
+
}>>;
|
|
67
|
+
login(name: string, onOutput: (text: string) => void): Promise<number>;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/** The terminal UI: one tab per conversation, a live event tab, slash commands, approval prompts. */
|
|
71
|
+
export declare class PineTui {
|
|
72
|
+
client: Client;
|
|
73
|
+
tui: Screen;
|
|
74
|
+
private editor;
|
|
75
|
+
private header;
|
|
76
|
+
private status;
|
|
77
|
+
private footer;
|
|
78
|
+
private dock;
|
|
79
|
+
private tabs;
|
|
80
|
+
private active;
|
|
81
|
+
private nextTabId;
|
|
82
|
+
private agents;
|
|
83
|
+
private commands;
|
|
84
|
+
private connected;
|
|
85
|
+
private notice;
|
|
86
|
+
private noticeTimer?;
|
|
87
|
+
private spinner?;
|
|
88
|
+
private frame;
|
|
89
|
+
private unsubscribe?;
|
|
90
|
+
private dialog?;
|
|
91
|
+
/** When a menu or question last closed. A key that closed it is not also a key for what lies under it. */
|
|
92
|
+
private dialogClosedAt;
|
|
93
|
+
/** Videos fetched from the daemon, as files for ffmpeg and the player. Removed when the UI closes. */
|
|
94
|
+
private mediaDir?;
|
|
95
|
+
private mediaCount;
|
|
96
|
+
private headerHits;
|
|
97
|
+
private footerHits;
|
|
98
|
+
private attachHits;
|
|
99
|
+
private attach;
|
|
100
|
+
private sessionModes;
|
|
101
|
+
private lastCtrlC;
|
|
102
|
+
private taints;
|
|
103
|
+
private bypassWhenTainted;
|
|
104
|
+
private opts;
|
|
105
|
+
private stopped;
|
|
106
|
+
/** While the tabs of last time are being opened again. */
|
|
107
|
+
private restoring;
|
|
108
|
+
/** The pane beside a conversation: changes, files, tool output. */
|
|
109
|
+
private code;
|
|
110
|
+
private codeOpen;
|
|
111
|
+
private codeRule;
|
|
112
|
+
constructor(opts: TuiOptions);
|
|
113
|
+
start(): Promise<void>;
|
|
114
|
+
/** Remember which conversations are open, so that the next start opens the same tabs. */
|
|
115
|
+
private saveTabs;
|
|
116
|
+
stop(): Promise<void>;
|
|
117
|
+
/** What is on screen, without colours. For tests and debugging. */
|
|
118
|
+
screen(): string[];
|
|
119
|
+
private newTab;
|
|
120
|
+
openTab(agent: string, session: string): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Open a tab on one task, typically a sub-agent: what it was given, what it thought and wrote,
|
|
123
|
+
* every tool call with the start of its result. A running task is followed live.
|
|
124
|
+
*/
|
|
125
|
+
openTask(id: number): Promise<void>;
|
|
126
|
+
private taskSummary;
|
|
127
|
+
private renderEntry;
|
|
128
|
+
private openEvents;
|
|
129
|
+
private activate;
|
|
130
|
+
private cycle;
|
|
131
|
+
/**
|
|
132
|
+
* The tab of a conversation other than an agent's main one is closed: what it was subscribed to
|
|
133
|
+
* on its own ends, the conversation itself stays in the agent's list. (The main conversation is
|
|
134
|
+
* the agent; its subscriptions stay.)
|
|
135
|
+
*/
|
|
136
|
+
private endLocal;
|
|
137
|
+
private closeTab;
|
|
138
|
+
/** Open or close the pane beside the conversation, optionally on one of its views. */
|
|
139
|
+
private showCode;
|
|
140
|
+
/** Give a conversation a folder to work in, or with `null` take it back to the agent's own workspace. */
|
|
141
|
+
private setFolder;
|
|
142
|
+
private pickFolder;
|
|
143
|
+
/**
|
|
144
|
+
* `pine <folder>`: a tab on the conversation that works in that folder. The one that already
|
|
145
|
+
* does is opened again; otherwise the main agent gets a new conversation named after the folder.
|
|
146
|
+
*/
|
|
147
|
+
openFolder(dir: string): Promise<void>;
|
|
148
|
+
private add;
|
|
149
|
+
private say;
|
|
150
|
+
/** A line that opens something on a click. */
|
|
151
|
+
private button;
|
|
152
|
+
/**
|
|
153
|
+
* Reserve a place for a picture and fill it once the picture is fetched and prepared, so it lands
|
|
154
|
+
* where it belongs however long that takes. Display only: nothing here reaches a model.
|
|
155
|
+
*/
|
|
156
|
+
private picture;
|
|
157
|
+
private fill;
|
|
158
|
+
/** A video that came over the API needs to be a file for ffmpeg and for the player. Kept until the UI closes. */
|
|
159
|
+
private keepVideo;
|
|
160
|
+
private video;
|
|
161
|
+
/**
|
|
162
|
+
* The pictures an answer points at with . A file in the agent's workspace is
|
|
163
|
+
* shown at once. A web address is not fetched until it is clicked: an address can carry
|
|
164
|
+
* information out, and an answer may repeat what a web page told the agent to write.
|
|
165
|
+
*/
|
|
166
|
+
private answerPictures;
|
|
167
|
+
/** An event that woke the agent, shown as what it is and not as something you typed: the source, and the start of what it reported. */
|
|
168
|
+
private eventLine;
|
|
169
|
+
private user;
|
|
170
|
+
/** Context and cache figures of a finished task, for the bottom bar. */
|
|
171
|
+
private takeStats;
|
|
172
|
+
private renderPast;
|
|
173
|
+
private flash;
|
|
174
|
+
/** Keys the app handles before the editor sees them. Returns true when the key is used up. */
|
|
175
|
+
private onKey;
|
|
176
|
+
/** A click on a web address. Only the web: nothing an answer contains may launch a program or open a file. */
|
|
177
|
+
private open;
|
|
178
|
+
private submit;
|
|
179
|
+
private attachFile;
|
|
180
|
+
/** Open a list over the conversation and resolve with what was chosen. */
|
|
181
|
+
private pick;
|
|
182
|
+
private pickAgent;
|
|
183
|
+
private pickSession;
|
|
184
|
+
private pickModel;
|
|
185
|
+
private pickReasoning;
|
|
186
|
+
private pickMode;
|
|
187
|
+
private isTainted;
|
|
188
|
+
private setMode;
|
|
189
|
+
private adopt;
|
|
190
|
+
private stopRunning;
|
|
191
|
+
private defineCommands;
|
|
192
|
+
private run;
|
|
193
|
+
private help;
|
|
194
|
+
private ask;
|
|
195
|
+
private closeDialog;
|
|
196
|
+
private answer;
|
|
197
|
+
private tabFor;
|
|
198
|
+
private onEvent;
|
|
199
|
+
/** Show one live event of a task in a tab. `depth` is counted from what the tab shows: 0 is its own task. */
|
|
200
|
+
private live;
|
|
201
|
+
private logEvent;
|
|
202
|
+
private refreshTaints;
|
|
203
|
+
private bypassPaused;
|
|
204
|
+
private renderHeader;
|
|
205
|
+
private renderAttachments;
|
|
206
|
+
private renderStatus;
|
|
207
|
+
private renderFooter;
|
|
208
|
+
}
|
|
209
|
+
export {};
|