@pmndre/pine 0.0.0-stage → 0.22.1
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
package/src/http.js
ADDED
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import http from "node:http";
|
|
3
|
+
import { mainAgentId } from "./config.js";
|
|
4
|
+
import { timingSafeEqual } from "./security.js";
|
|
5
|
+
import { addServer, listServers, removeServer } from "./mcp-config.js";
|
|
6
|
+
import { changes, diffOf, listDir, readText, findFiles } from "./workspace-view.js";
|
|
7
|
+
import { errText, topicMatches } from "./util.js";
|
|
8
|
+
const MAX_BODY = 1024 * 1024;
|
|
9
|
+
class HttpError extends Error {
|
|
10
|
+
status;
|
|
11
|
+
constructor(status, message) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.status = status;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Control API and webhooks. Every request except /health and /hook/* needs the bearer token.
|
|
18
|
+
* Requests that come from a web page (an Origin header, a foreign Host) are refused, so a site
|
|
19
|
+
* open in a browser on this machine cannot drive the daemon.
|
|
20
|
+
*/
|
|
21
|
+
export class HttpServer {
|
|
22
|
+
cfg;
|
|
23
|
+
bus;
|
|
24
|
+
state;
|
|
25
|
+
tasks;
|
|
26
|
+
manager;
|
|
27
|
+
approvals;
|
|
28
|
+
log;
|
|
29
|
+
token;
|
|
30
|
+
server;
|
|
31
|
+
hits = new Map();
|
|
32
|
+
port = 0;
|
|
33
|
+
sources;
|
|
34
|
+
constructor(deps) {
|
|
35
|
+
this.sources = deps.sources;
|
|
36
|
+
this.cfg = deps.cfg;
|
|
37
|
+
this.bus = deps.bus;
|
|
38
|
+
this.state = deps.state;
|
|
39
|
+
this.tasks = deps.tasks;
|
|
40
|
+
this.manager = deps.manager;
|
|
41
|
+
this.approvals = deps.approvals;
|
|
42
|
+
this.log = deps.log;
|
|
43
|
+
this.token = deps.token;
|
|
44
|
+
}
|
|
45
|
+
async start() {
|
|
46
|
+
const { host, port } = this.cfg.http;
|
|
47
|
+
this.server = http.createServer((req, res) => void this.handle(req, res));
|
|
48
|
+
this.server.requestTimeout = 30_000;
|
|
49
|
+
this.server.headersTimeout = 10_000;
|
|
50
|
+
await new Promise((resolve, reject) => {
|
|
51
|
+
this.server.once("error", reject);
|
|
52
|
+
this.server.listen(port, host, resolve);
|
|
53
|
+
});
|
|
54
|
+
this.port = this.server.address().port;
|
|
55
|
+
// With port 0 the system picked one. Others ask the configuration where the control port is
|
|
56
|
+
// (the browser gate never opens it).
|
|
57
|
+
this.cfg.http.port = this.port;
|
|
58
|
+
this.log.info(`http listening on ${host}:${this.port}`);
|
|
59
|
+
}
|
|
60
|
+
async stop() {
|
|
61
|
+
this.server?.closeAllConnections?.();
|
|
62
|
+
await new Promise((r) => (this.server ? this.server.close(() => r()) : r()));
|
|
63
|
+
}
|
|
64
|
+
async handle(req, res) {
|
|
65
|
+
const send = (status, body) => {
|
|
66
|
+
if (res.headersSent)
|
|
67
|
+
return;
|
|
68
|
+
res.writeHead(status, { "content-type": "application/json", "cache-control": "no-store", "x-content-type-options": "nosniff" });
|
|
69
|
+
res.end(JSON.stringify(body));
|
|
70
|
+
};
|
|
71
|
+
const sendPicture = (p) => {
|
|
72
|
+
if (!p)
|
|
73
|
+
return send(404, { error: "no such picture" });
|
|
74
|
+
res.writeHead(200, { "content-type": p.mime, "content-length": p.bytes.length, "cache-control": "no-store", "x-content-type-options": "nosniff" });
|
|
75
|
+
res.end(p.bytes);
|
|
76
|
+
};
|
|
77
|
+
try {
|
|
78
|
+
const url = new URL(req.url ?? "/", "http://pine.local");
|
|
79
|
+
const parts = url.pathname.split("/").filter(Boolean).map(decodeURIComponent);
|
|
80
|
+
const method = req.method ?? "GET";
|
|
81
|
+
if (method === "GET" && url.pathname === "/health")
|
|
82
|
+
return send(200, { ok: true });
|
|
83
|
+
if (parts[0] === "hook" && parts.length === 2 && method === "POST")
|
|
84
|
+
return send(202, await this.hook(parts[1], req));
|
|
85
|
+
this.guardBrowser(req);
|
|
86
|
+
const auth = req.headers.authorization ?? "";
|
|
87
|
+
if (!auth.startsWith("Bearer ") || !timingSafeEqual(auth.slice(7), this.token))
|
|
88
|
+
throw new HttpError(401, "missing or wrong bearer token");
|
|
89
|
+
if (method === "GET") {
|
|
90
|
+
const q = url.searchParams;
|
|
91
|
+
const num = (k) => (q.has(k) ? Number(q.get(k)) : undefined);
|
|
92
|
+
if (url.pathname === "/status")
|
|
93
|
+
return send(200, { ...this.manager.status(), agents: Object.keys(this.cfg.agents), approvals: this.approvals.pending().length, bypassWhenTainted: this.cfg.security.bypassWhenTainted });
|
|
94
|
+
if (url.pathname === "/agents")
|
|
95
|
+
return send(200, Object.values(this.cfg.agents).map((a) => ({ id: a.id, main: a.id === mainAgentId(this.cfg), description: a.description, workspace: a.workspace, model: a.model ?? this.cfg.defaults.model, thinking: a.thinking, mode: a.mode, delegates: a.delegates })));
|
|
96
|
+
if (url.pathname === "/tasks")
|
|
97
|
+
return send(200, this.tasks.list({ agent: q.get("agent") ?? undefined, session: q.get("session") ?? undefined, status: q.get("status") ?? undefined, limit: num("limit") }));
|
|
98
|
+
if (url.pathname === "/models")
|
|
99
|
+
return send(200, await this.manager.availableModels());
|
|
100
|
+
if (url.pathname === "/mcp")
|
|
101
|
+
return send(200, listServers(this.cfg));
|
|
102
|
+
if (url.pathname === "/sources")
|
|
103
|
+
return send(200, this.sources?.list() ?? []);
|
|
104
|
+
if (parts[0] === "agents" && parts[2] === "sources" && parts.length === 3) {
|
|
105
|
+
if (!this.cfg.agents[parts[1]])
|
|
106
|
+
throw new HttpError(404, "no such agent");
|
|
107
|
+
return send(200, this.sources?.available(parts[1]) ?? []);
|
|
108
|
+
}
|
|
109
|
+
if (parts[0] === "agents" && parts[2] === "sessions" && parts.length === 3) {
|
|
110
|
+
if (!this.cfg.agents[parts[1]])
|
|
111
|
+
throw new HttpError(404, "no such agent");
|
|
112
|
+
return send(200, this.manager.conversations(parts[1]));
|
|
113
|
+
}
|
|
114
|
+
if (url.pathname === "/ui/tabs")
|
|
115
|
+
return send(200, this.manager.uiTabs());
|
|
116
|
+
if (parts[0] === "tasks" && parts[2] === "transcript" && parts.length === 3) {
|
|
117
|
+
const t = this.manager.transcript(Number(parts[1]), q.get("full") === "1");
|
|
118
|
+
return t ? send(200, t) : send(404, { error: "no such task" });
|
|
119
|
+
}
|
|
120
|
+
// Pictures for a UI to show. They are never sent to a model from here.
|
|
121
|
+
if (parts[0] === "media" && parts[1] === "tool" && parts.length === 3)
|
|
122
|
+
return sendPicture(this.manager.toolImage(parts[2]));
|
|
123
|
+
if (parts[0] === "tasks" && parts[2] === "images" && parts.length === 4)
|
|
124
|
+
return sendPicture(this.manager.taskImage(Number(parts[1]), Number(parts[3])));
|
|
125
|
+
if (parts[0] === "agents" && parts[2] === "image" && parts.length === 3)
|
|
126
|
+
return sendPicture(this.manager.workspaceImage(parts[1], q.get("path") ?? "", q.get("session") ?? undefined));
|
|
127
|
+
// The folder a conversation works in, and what a UI shows of it: files, and what git says changed.
|
|
128
|
+
if (parts[0] === "agents" && parts[2] === "folder" && parts.length === 3) {
|
|
129
|
+
if (!this.cfg.agents[parts[1]])
|
|
130
|
+
throw new HttpError(404, "no such agent");
|
|
131
|
+
return send(200, { folder: this.manager.folderOf(parts[1], q.get("session") ?? "main"), workspace: this.cfg.agents[parts[1]].workspace });
|
|
132
|
+
}
|
|
133
|
+
// What a conversation's commands left running, for a UI to show and to stop.
|
|
134
|
+
if (parts[0] === "agents" && parts[2] === "programs" && parts.length === 3) {
|
|
135
|
+
if (!this.cfg.agents[parts[1]])
|
|
136
|
+
throw new HttpError(404, "no such agent");
|
|
137
|
+
return send(200, this.manager.programsOf(parts[1], q.get("session") ?? "main"));
|
|
138
|
+
}
|
|
139
|
+
if (parts[0] === "agents" && parts[2] === "todos" && parts.length === 3) {
|
|
140
|
+
if (!this.cfg.agents[parts[1]])
|
|
141
|
+
throw new HttpError(404, "no such agent");
|
|
142
|
+
return send(200, this.manager.todosOf(parts[1], q.get("session") ?? "main"));
|
|
143
|
+
}
|
|
144
|
+
// The goal the owner set for a conversation, and where it stands.
|
|
145
|
+
if (parts[0] === "agents" && parts[2] === "goal" && parts.length === 3) {
|
|
146
|
+
if (!this.cfg.agents[parts[1]])
|
|
147
|
+
throw new HttpError(404, "no such agent");
|
|
148
|
+
return send(200, { goal: this.manager.goals.get(parts[1], q.get("session") ?? "main") });
|
|
149
|
+
}
|
|
150
|
+
if (parts[0] === "agents" && parts[2] === "folders" && parts.length === 3) {
|
|
151
|
+
if (!this.cfg.agents[parts[1]])
|
|
152
|
+
throw new HttpError(404, "no such agent");
|
|
153
|
+
return send(200, this.manager.folders(parts[1]));
|
|
154
|
+
}
|
|
155
|
+
// What the owner's last message in a conversation changed in its folder (src/undo.ts).
|
|
156
|
+
if (parts[0] === "agents" && parts[2] === "view" && (parts[3] === "turn" || parts[3] === "turndiff") && parts.length === 4) {
|
|
157
|
+
if (!this.cfg.agents[parts[1]])
|
|
158
|
+
throw new HttpError(404, "no such agent");
|
|
159
|
+
const session = q.get("session") ?? "main";
|
|
160
|
+
const found = parts[3] === "turn" ? await this.manager.lastTurn(parts[1], session) : await this.manager.lastTurnDiff(parts[1], session, q.get("path") ?? "");
|
|
161
|
+
if (!found)
|
|
162
|
+
throw new HttpError(404, "nothing there");
|
|
163
|
+
return send(200, found);
|
|
164
|
+
}
|
|
165
|
+
if (parts[0] === "agents" && parts[2] === "view" && parts.length === 4) {
|
|
166
|
+
const root = this.manager.viewRoot(parts[1], q.get("session") ?? "main");
|
|
167
|
+
if (!root)
|
|
168
|
+
throw new HttpError(404, "no such agent");
|
|
169
|
+
const rel = q.get("path") ?? "";
|
|
170
|
+
const found = parts[3] === "find" ? { files: await findFiles(root, (q.get("q") ?? "").slice(0, 200)) } : parts[3] === "changes" ? { root, ...(await changes(root)) } : parts[3] === "diff" ? await diffOf(root, rel) : parts[3] === "tree" ? listDir(root, rel) : parts[3] === "file" ? readText(root, rel) : undefined;
|
|
171
|
+
if (!found)
|
|
172
|
+
throw new HttpError(404, "nothing there");
|
|
173
|
+
return send(200, found);
|
|
174
|
+
}
|
|
175
|
+
if (parts[0] === "tasks" && parts.length === 2) {
|
|
176
|
+
const t = this.tasks.get(Number(parts[1]));
|
|
177
|
+
return t ? send(200, t) : send(404, { error: "no such task" });
|
|
178
|
+
}
|
|
179
|
+
if (url.pathname === "/events")
|
|
180
|
+
return send(200, this.bus.query({ topic: q.get("topic") ?? undefined, after: num("after"), limit: num("limit") }));
|
|
181
|
+
if (url.pathname === "/events/stream")
|
|
182
|
+
return this.stream(req, res, q.get("topic") ?? "#");
|
|
183
|
+
if (url.pathname === "/state")
|
|
184
|
+
return send(200, this.state.list(q.get("key") ?? "#"));
|
|
185
|
+
if (url.pathname === "/approvals")
|
|
186
|
+
return send(200, this.approvals.pending());
|
|
187
|
+
throw new HttpError(404, "not found");
|
|
188
|
+
}
|
|
189
|
+
if (method !== "POST")
|
|
190
|
+
throw new HttpError(405, "method not allowed");
|
|
191
|
+
// A message may carry attached files; everything else stays small.
|
|
192
|
+
const isPrompt = parts[0] === "agents" && parts[2] === "prompt" && parts.length === 3;
|
|
193
|
+
const body = (await this.json(req, isPrompt ? 64 * MAX_BODY : MAX_BODY));
|
|
194
|
+
if (url.pathname === "/images/fetch") {
|
|
195
|
+
if (typeof body.url !== "string")
|
|
196
|
+
throw new HttpError(400, "url required");
|
|
197
|
+
try {
|
|
198
|
+
return sendPicture(await this.manager.fetchImage(body.url));
|
|
199
|
+
}
|
|
200
|
+
catch (e) {
|
|
201
|
+
throw new HttpError(502, errText(e));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (url.pathname === "/events") {
|
|
205
|
+
if (typeof body.topic !== "string")
|
|
206
|
+
throw new HttpError(400, "topic required");
|
|
207
|
+
const e = this.bus.publish(body.topic, body.payload ?? null, { source: "api", trust: body.trust === "untrusted" ? "untrusted" : "owner" });
|
|
208
|
+
return send(202, { id: e.id });
|
|
209
|
+
}
|
|
210
|
+
if (parts[0] === "agents" && parts[2] === "prompt" && parts.length === 3) {
|
|
211
|
+
if (typeof body.prompt !== "string" || !body.prompt)
|
|
212
|
+
throw new HttpError(400, "prompt required");
|
|
213
|
+
// "steer": if the conversation is working, the message goes into that work instead of waiting behind it.
|
|
214
|
+
const task = this.manager.submit({ agent: parts[1], prompt: body.prompt, session: body.session, trust: "owner", kind: "prompt", priority: 10, attachments: Array.isArray(body.attachments) ? body.attachments : undefined, whenBusy: body.whenBusy === "steer" ? "steer" : undefined, mentions: Array.isArray(body.mentions) ? body.mentions : undefined });
|
|
215
|
+
if (body.wait === false)
|
|
216
|
+
return send(202, { task: task.id, steered: task.meta.steered });
|
|
217
|
+
res.setTimeout(0);
|
|
218
|
+
req.on("close", () => !res.writableEnded && body.cancelOnDisconnect && this.manager.cancel(task.id));
|
|
219
|
+
return send(200, await this.manager.wait(task.id));
|
|
220
|
+
}
|
|
221
|
+
if (url.pathname === "/models/refresh") {
|
|
222
|
+
// The owner added or removed a model server with the pine command.
|
|
223
|
+
await this.manager.reloadModels();
|
|
224
|
+
return send(200, { ok: true });
|
|
225
|
+
}
|
|
226
|
+
if (url.pathname === "/mcp/refresh") {
|
|
227
|
+
await this.manager.refreshSessions();
|
|
228
|
+
return send(200, { ok: true });
|
|
229
|
+
}
|
|
230
|
+
if (url.pathname === "/mcp") {
|
|
231
|
+
// The owner adds or removes a server while the daemon runs; sessions pick it up when next used.
|
|
232
|
+
if (typeof body.name !== "string")
|
|
233
|
+
throw new HttpError(400, "name required");
|
|
234
|
+
const agent = typeof body.agent === "string" ? body.agent : undefined;
|
|
235
|
+
if (body.remove === true) {
|
|
236
|
+
if (!removeServer(this.cfg, body.name, agent))
|
|
237
|
+
throw new HttpError(404, "no such server");
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
if (!body.server || typeof body.server !== "object")
|
|
241
|
+
throw new HttpError(400, "server required");
|
|
242
|
+
if (JSON.stringify(body.server).includes("${"))
|
|
243
|
+
throw new HttpError(400, "a server that refers to ${NAME} values is read from the file at startup: add it with the daemon stopped, or restart afterwards");
|
|
244
|
+
addServer(this.cfg, body.name, body.server, agent);
|
|
245
|
+
}
|
|
246
|
+
await this.manager.refreshSessions(agent ? [agent] : undefined);
|
|
247
|
+
return send(200, { ok: true });
|
|
248
|
+
}
|
|
249
|
+
// Agents are made and removed by the owner here (`pine agent add`, `pine agent remove`), as the main agent does it by tool.
|
|
250
|
+
if (url.pathname === "/agents") {
|
|
251
|
+
if (typeof body.id !== "string" || typeof body.description !== "string" || typeof body.instructions !== "string")
|
|
252
|
+
throw new HttpError(400, "id, description and instructions required");
|
|
253
|
+
const made = await this.manager.addAgent({ id: body.id, description: body.description, instructions: body.instructions, model: typeof body.model === "string" ? body.model : undefined, tools: Array.isArray(body.tools) ? body.tools.map(String) : undefined });
|
|
254
|
+
return send(200, { id: made.id, workspace: made.workspace });
|
|
255
|
+
}
|
|
256
|
+
// (An address of its own, and the agent's name once more in the body: "/agents/<id>/remove" removes a conversation.)
|
|
257
|
+
if (parts[0] === "agents" && parts[2] === "erase" && parts.length === 3) {
|
|
258
|
+
if (body.agent !== parts[1])
|
|
259
|
+
throw new HttpError(400, `to remove the agent ${parts[1]} with everything it has, send { "agent": "${parts[1]}" }`);
|
|
260
|
+
return send(200, await this.manager.removeAgent(parts[1], body.keepFiles === true));
|
|
261
|
+
}
|
|
262
|
+
if (parts[0] === "agents" && parts[2] === "mode" && parts.length === 3) {
|
|
263
|
+
this.manager.setMode(parts[1], body.mode, body.anyway === true && typeof body.session === "string" ? body.session : undefined);
|
|
264
|
+
return send(200, { mode: body.mode });
|
|
265
|
+
}
|
|
266
|
+
if (parts[0] === "agents" && parts[2] === "compact" && parts.length === 3)
|
|
267
|
+
return send(202, { task: this.manager.compact(parts[1], typeof body.session === "string" ? body.session : "main").id });
|
|
268
|
+
if (parts[0] === "agents" && parts[2] === "thinking" && parts.length === 3) {
|
|
269
|
+
this.manager.setThinking(parts[1], String(body.level));
|
|
270
|
+
return send(200, { level: body.level });
|
|
271
|
+
}
|
|
272
|
+
if (parts[0] === "agents" && parts[2] === "model" && parts.length === 3) {
|
|
273
|
+
if (typeof body.model !== "string")
|
|
274
|
+
throw new HttpError(400, "model required");
|
|
275
|
+
await this.manager.setModel(parts[1], body.model);
|
|
276
|
+
return send(200, { model: body.model });
|
|
277
|
+
}
|
|
278
|
+
// Change an agent's settings (`pine agent update`), as the main agent does it by tool.
|
|
279
|
+
if (parts[0] === "agents" && parts[2] === "update" && parts.length === 3) {
|
|
280
|
+
if (!this.cfg.agents[parts[1]])
|
|
281
|
+
throw new HttpError(404, "no such agent");
|
|
282
|
+
const { agent: _a, ...change } = body;
|
|
283
|
+
try {
|
|
284
|
+
return send(200, await this.manager.updateAgent(parts[1], change));
|
|
285
|
+
}
|
|
286
|
+
catch (e) {
|
|
287
|
+
throw new HttpError(400, errText(e));
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (parts[0] === "agents" && (parts[2] === "subscribe" || parts[2] === "unsubscribe") && parts.length === 3) {
|
|
291
|
+
if (!this.sources)
|
|
292
|
+
throw new HttpError(404, "not found");
|
|
293
|
+
if (!this.cfg.agents[parts[1]])
|
|
294
|
+
throw new HttpError(404, "no such agent");
|
|
295
|
+
if (typeof body.source !== "string" || !body.source)
|
|
296
|
+
throw new HttpError(400, "source required");
|
|
297
|
+
try {
|
|
298
|
+
if (parts[2] === "unsubscribe") {
|
|
299
|
+
const sessions = await this.sources.unsubscribe(parts[1], body.source, typeof body.session === "string" ? body.session : undefined);
|
|
300
|
+
return send(200, { unsubscribed: sessions.length > 0, sessions });
|
|
301
|
+
}
|
|
302
|
+
const { source: _s, ...details } = body;
|
|
303
|
+
return send(200, await this.sources.subscribe(parts[1], body.source, details));
|
|
304
|
+
}
|
|
305
|
+
catch (e) {
|
|
306
|
+
throw new HttpError(400, errText(e));
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
// For all agents.
|
|
310
|
+
if ((url.pathname === "/subscribe" || url.pathname === "/unsubscribe") && this.sources) {
|
|
311
|
+
if (typeof body.source !== "string" || !body.source)
|
|
312
|
+
throw new HttpError(400, "source required");
|
|
313
|
+
try {
|
|
314
|
+
if (url.pathname === "/unsubscribe")
|
|
315
|
+
return send(200, { unsubscribed: await this.sources.unsubscribeAll(body.source) });
|
|
316
|
+
const { source: _s, ...details } = body;
|
|
317
|
+
return send(200, await this.sources.subscribeAll(body.source, details));
|
|
318
|
+
}
|
|
319
|
+
catch (e) {
|
|
320
|
+
throw new HttpError(400, errText(e));
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
// A conversation was closed in a UI: what it was subscribed to on its own ends with it.
|
|
324
|
+
if (parts[0] === "agents" && parts[2] === "close" && parts.length === 3) {
|
|
325
|
+
if (!this.cfg.agents[parts[1]])
|
|
326
|
+
throw new HttpError(404, "no such agent");
|
|
327
|
+
return send(200, { unsubscribed: (await this.sources?.closeSession(parts[1], String(body.session ?? ""))) ?? [] });
|
|
328
|
+
}
|
|
329
|
+
// The tabs a UI has open, kept so that it opens with the same ones next time.
|
|
330
|
+
if (url.pathname === "/ui/tabs")
|
|
331
|
+
return send(200, (this.manager.saveUiTabs(body.tabs, body.active, body.code, body.notify), { ok: true }));
|
|
332
|
+
if (parts[0] === "agents" && parts[2] === "folder" && parts.length === 3) {
|
|
333
|
+
if (!this.cfg.agents[parts[1]])
|
|
334
|
+
throw new HttpError(404, "no such agent");
|
|
335
|
+
try {
|
|
336
|
+
return send(200, await this.manager.setFolder(parts[1], String(body.session ?? "main"), typeof body.folder === "string" && body.folder ? body.folder : null));
|
|
337
|
+
}
|
|
338
|
+
catch (e) {
|
|
339
|
+
throw new HttpError(409, errText(e));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (parts[0] === "agents" && ["remove", "rename", "pin"].includes(parts[2]) && parts.length === 3) {
|
|
343
|
+
if (!this.cfg.agents[parts[1]])
|
|
344
|
+
throw new HttpError(404, "no such agent");
|
|
345
|
+
if (typeof body.session !== "string" || !body.session)
|
|
346
|
+
throw new HttpError(400, "session: the conversation's name");
|
|
347
|
+
try {
|
|
348
|
+
if (parts[2] === "pin")
|
|
349
|
+
return send(200, { pinned: this.manager.pinSession(parts[1], body.session, body.pinned !== false) });
|
|
350
|
+
if (parts[2] === "rename")
|
|
351
|
+
return send(200, await this.manager.renameSession(parts[1], body.session, String(body.to ?? "")));
|
|
352
|
+
return send(200, await this.manager.removeSession(parts[1], body.session));
|
|
353
|
+
}
|
|
354
|
+
catch (e) {
|
|
355
|
+
throw new HttpError(409, errText(e));
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
// Goal mode. This is the only way to a goal, and it is the owner's, like the folder of a conversation: no tool reaches it.
|
|
359
|
+
if (parts[0] === "agents" && parts[2] === "goal" && parts.length === 3) {
|
|
360
|
+
if (!this.cfg.agents[parts[1]])
|
|
361
|
+
throw new HttpError(404, "no such agent");
|
|
362
|
+
const session = String(body.session ?? "main");
|
|
363
|
+
const goals = this.manager.goals;
|
|
364
|
+
try {
|
|
365
|
+
if (body.action === "pause")
|
|
366
|
+
return send(200, { goal: goals.pause(parts[1], session) });
|
|
367
|
+
if (body.action === "resume")
|
|
368
|
+
return send(200, { goal: goals.resume(parts[1], session) });
|
|
369
|
+
if (body.action === "clear")
|
|
370
|
+
return send(200, { cleared: goals.clear(parts[1], session) });
|
|
371
|
+
if (body.action !== undefined)
|
|
372
|
+
throw new Error("action is pause, resume or clear; to set a goal send objective");
|
|
373
|
+
if (typeof body.objective !== "string")
|
|
374
|
+
throw new Error("objective required: what should be reached");
|
|
375
|
+
return send(200, { goal: goals.set(parts[1], session, body.objective) });
|
|
376
|
+
}
|
|
377
|
+
catch (e) {
|
|
378
|
+
throw new HttpError(400, errText(e));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
if (parts[0] === "agents" && parts[2] === "programs" && parts[3] === "stop" && parts.length === 4) {
|
|
382
|
+
if (!this.cfg.agents[parts[1]])
|
|
383
|
+
throw new HttpError(404, "no such agent");
|
|
384
|
+
return send(200, { stopped: this.manager.stopProgram(parts[1], String(body.session ?? "main"), Number(body.id)) });
|
|
385
|
+
}
|
|
386
|
+
// The owner takes back their last message in a conversation, or brings it back. Only here: no agent has a tool for it.
|
|
387
|
+
if (parts[0] === "agents" && (parts[2] === "undo" || parts[2] === "redo") && parts.length === 3) {
|
|
388
|
+
if (!this.cfg.agents[parts[1]])
|
|
389
|
+
throw new HttpError(404, "no such agent");
|
|
390
|
+
try {
|
|
391
|
+
return send(200, await this.manager[parts[2]](parts[1], String(body.session ?? "main")));
|
|
392
|
+
}
|
|
393
|
+
catch (e) {
|
|
394
|
+
throw new HttpError(409, errText(e));
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
if (parts[0] === "agents" && parts[2] === "reset" && parts.length === 3)
|
|
398
|
+
return send(200, { reset: await this.manager.resetSession(parts[1], body.session) });
|
|
399
|
+
if (parts[0] === "tasks" && parts[2] === "cancel" && parts.length === 3)
|
|
400
|
+
return send(200, { cancelled: this.manager.cancel(Number(parts[1])) });
|
|
401
|
+
if (parts[0] === "approvals" && parts.length === 2) {
|
|
402
|
+
const values = body.values && typeof body.values === "object" && !Array.isArray(body.values) ? body.values : undefined;
|
|
403
|
+
const missing = body.allow === true ? this.approvals.missing(parts[1], values) : [];
|
|
404
|
+
if (missing.length)
|
|
405
|
+
throw new HttpError(400, `this request needs you to enter ${missing.join(", ")}: answer it in the terminal UI, where it is typed without being shown`);
|
|
406
|
+
return send(200, { decided: this.approvals.decide(parts[1], body.allow === true, "api", body.always === true, values) });
|
|
407
|
+
}
|
|
408
|
+
if (url.pathname === "/state") {
|
|
409
|
+
if (typeof body.key !== "string")
|
|
410
|
+
throw new HttpError(400, "key required");
|
|
411
|
+
this.state.set(body.key, body.value ?? null, { source: "api" });
|
|
412
|
+
return send(200, { ok: true });
|
|
413
|
+
}
|
|
414
|
+
throw new HttpError(404, "not found");
|
|
415
|
+
}
|
|
416
|
+
catch (e) {
|
|
417
|
+
const status = e instanceof HttpError ? e.status : /unknown agent|too many queued|does not accept|invalid topic|invalid state key|busy|is not defined in models.json|mode must be one of|at most 10 files|larger than 20 MB|inbox folder|can attach files|usable server name|MCP server needs|not a valid URL|must use https|reasoning level must be/.test(errText(e)) ? 400 : 500;
|
|
418
|
+
if (status === 500)
|
|
419
|
+
this.log.error("http request failed", e);
|
|
420
|
+
send(status, { error: status === 500 ? "internal error" : errText(e) });
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
/** DNS rebinding and cross-site requests: only accept a loopback (or configured) Host, never an Origin. */
|
|
424
|
+
guardBrowser(req) {
|
|
425
|
+
if (req.headers.origin || req.headers["sec-fetch-site"])
|
|
426
|
+
throw new HttpError(403, "requests from web pages are not accepted");
|
|
427
|
+
const host = (req.headers.host ?? "").replace(/:\d+$/, "").replace(/^\[|\]$/g, "");
|
|
428
|
+
const allowed = ["127.0.0.1", "localhost", "::1", this.cfg.http.host];
|
|
429
|
+
if (!allowed.includes(host))
|
|
430
|
+
throw new HttpError(403, "unexpected Host header");
|
|
431
|
+
}
|
|
432
|
+
async raw(req, limit = MAX_BODY) {
|
|
433
|
+
const chunks = [];
|
|
434
|
+
let size = 0;
|
|
435
|
+
for await (const c of req) {
|
|
436
|
+
size += c.length;
|
|
437
|
+
if (size > limit)
|
|
438
|
+
throw new HttpError(413, "body too large");
|
|
439
|
+
chunks.push(c);
|
|
440
|
+
}
|
|
441
|
+
return Buffer.concat(chunks);
|
|
442
|
+
}
|
|
443
|
+
async json(req, limit = MAX_BODY) {
|
|
444
|
+
if (!(req.headers["content-type"] ?? "").startsWith("application/json"))
|
|
445
|
+
throw new HttpError(415, "content-type must be application/json");
|
|
446
|
+
const buf = await this.raw(req, limit);
|
|
447
|
+
try {
|
|
448
|
+
return buf.length ? JSON.parse(buf.toString("utf8")) : {};
|
|
449
|
+
}
|
|
450
|
+
catch {
|
|
451
|
+
throw new HttpError(400, "invalid JSON");
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
/** A webhook: outside content by definition, so the event is untrusted whatever it says. */
|
|
455
|
+
async hook(name, req) {
|
|
456
|
+
const hook = this.cfg.http.hooks[name];
|
|
457
|
+
// A running event source of type webhook (or one of your own) takes requests under its name.
|
|
458
|
+
const sourceHook = hook ? undefined : this.sources?.hookFor(name);
|
|
459
|
+
if (!hook && !sourceHook)
|
|
460
|
+
throw new HttpError(404, "not found");
|
|
461
|
+
const now = Date.now();
|
|
462
|
+
const recent = (this.hits.get(name) ?? []).filter((t) => now - t < 60_000);
|
|
463
|
+
if (recent.length >= 120)
|
|
464
|
+
throw new HttpError(429, "too many requests");
|
|
465
|
+
recent.push(now);
|
|
466
|
+
this.hits.set(name, recent);
|
|
467
|
+
const body = await this.raw(req);
|
|
468
|
+
if (sourceHook) {
|
|
469
|
+
try {
|
|
470
|
+
await sourceHook({ headers: req.headers, body });
|
|
471
|
+
}
|
|
472
|
+
catch (e) {
|
|
473
|
+
throw new HttpError(typeof e?.status === "number" ? e.status : 500, typeof e?.status === "number" ? errText(e) : "internal error");
|
|
474
|
+
}
|
|
475
|
+
return { id: 0 };
|
|
476
|
+
}
|
|
477
|
+
if (!hook)
|
|
478
|
+
throw new HttpError(404, "not found");
|
|
479
|
+
if (hook.secret) {
|
|
480
|
+
const bearer = (req.headers.authorization ?? "").replace(/^Bearer /, "");
|
|
481
|
+
const sig = String(req.headers["x-hub-signature-256"] ?? req.headers["x-signature"] ?? "").replace(/^sha256=/, "");
|
|
482
|
+
const expected = crypto.createHmac("sha256", hook.secret).update(body).digest("hex");
|
|
483
|
+
if (!(bearer && timingSafeEqual(bearer, hook.secret)) && !(sig && timingSafeEqual(sig, expected)))
|
|
484
|
+
throw new HttpError(401, "bad signature");
|
|
485
|
+
}
|
|
486
|
+
let payload;
|
|
487
|
+
try {
|
|
488
|
+
payload = JSON.parse(body.toString("utf8"));
|
|
489
|
+
}
|
|
490
|
+
catch {
|
|
491
|
+
payload = { text: body.toString("utf8") };
|
|
492
|
+
}
|
|
493
|
+
const e = this.bus.publish(hook.topic, payload, { source: "http", trust: "untrusted" });
|
|
494
|
+
return { id: e.id };
|
|
495
|
+
}
|
|
496
|
+
stream(req, res, pattern) {
|
|
497
|
+
res.writeHead(200, { "content-type": "text/event-stream", "cache-control": "no-store", connection: "keep-alive" });
|
|
498
|
+
res.write(": connected\n\n");
|
|
499
|
+
const off = this.bus.subscribe("#", (e) => {
|
|
500
|
+
if (topicMatches(pattern, e.topic))
|
|
501
|
+
res.write(`data: ${JSON.stringify(e)}\n\n`);
|
|
502
|
+
}, "http-stream");
|
|
503
|
+
const ping = setInterval(() => res.write(": ping\n\n"), 20_000);
|
|
504
|
+
req.on("close", () => {
|
|
505
|
+
off();
|
|
506
|
+
clearInterval(ping);
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
}
|
package/src/limiter.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounds how many agent runs talk to the model server at once. Higher priority waits less;
|
|
3
|
+
* equal priorities are first come, first served.
|
|
4
|
+
*/
|
|
5
|
+
export declare class Limiter {
|
|
6
|
+
max: number;
|
|
7
|
+
private active;
|
|
8
|
+
private seq;
|
|
9
|
+
private queue;
|
|
10
|
+
constructor(max: number);
|
|
11
|
+
get stats(): {
|
|
12
|
+
active: number;
|
|
13
|
+
waiting: number;
|
|
14
|
+
max: number;
|
|
15
|
+
};
|
|
16
|
+
acquire(priority?: number): Promise<Slot>;
|
|
17
|
+
take(priority: number): Promise<void>;
|
|
18
|
+
free(): void;
|
|
19
|
+
}
|
|
20
|
+
/** One run's place at the model server. A run that only waits for other runs lends its place out with suspend(). */
|
|
21
|
+
export declare class Slot {
|
|
22
|
+
private limiter;
|
|
23
|
+
private priority;
|
|
24
|
+
private held;
|
|
25
|
+
private done;
|
|
26
|
+
private waiters;
|
|
27
|
+
private reacquiring?;
|
|
28
|
+
constructor(limiter: Limiter, priority: number);
|
|
29
|
+
/** Give the place up while `fn` runs (a delegated task, sub-agents), then take one again before returning. */
|
|
30
|
+
suspend<T>(fn: () => Promise<T>): Promise<T>;
|
|
31
|
+
release(): void;
|
|
32
|
+
}
|
package/src/limiter.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounds how many agent runs talk to the model server at once. Higher priority waits less;
|
|
3
|
+
* equal priorities are first come, first served.
|
|
4
|
+
*/
|
|
5
|
+
export class Limiter {
|
|
6
|
+
max;
|
|
7
|
+
active = 0;
|
|
8
|
+
seq = 0;
|
|
9
|
+
queue = [];
|
|
10
|
+
constructor(max) {
|
|
11
|
+
this.max = Math.max(1, max);
|
|
12
|
+
}
|
|
13
|
+
get stats() {
|
|
14
|
+
return { active: this.active, waiting: this.queue.length, max: this.max };
|
|
15
|
+
}
|
|
16
|
+
async acquire(priority = 0) {
|
|
17
|
+
await this.take(priority);
|
|
18
|
+
return new Slot(this, priority);
|
|
19
|
+
}
|
|
20
|
+
take(priority) {
|
|
21
|
+
if (this.active < this.max) {
|
|
22
|
+
this.active++;
|
|
23
|
+
return Promise.resolve();
|
|
24
|
+
}
|
|
25
|
+
return new Promise((resolve) => {
|
|
26
|
+
this.queue.push({ priority, seq: this.seq++, resolve });
|
|
27
|
+
this.queue.sort((a, b) => b.priority - a.priority || a.seq - b.seq);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
free() {
|
|
31
|
+
const next = this.queue.shift();
|
|
32
|
+
if (next)
|
|
33
|
+
next.resolve();
|
|
34
|
+
else
|
|
35
|
+
this.active--;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** One run's place at the model server. A run that only waits for other runs lends its place out with suspend(). */
|
|
39
|
+
export class Slot {
|
|
40
|
+
limiter;
|
|
41
|
+
priority;
|
|
42
|
+
held = true;
|
|
43
|
+
done = false;
|
|
44
|
+
waiters = 0;
|
|
45
|
+
reacquiring;
|
|
46
|
+
constructor(limiter, priority) {
|
|
47
|
+
this.limiter = limiter;
|
|
48
|
+
this.priority = priority;
|
|
49
|
+
}
|
|
50
|
+
/** Give the place up while `fn` runs (a delegated task, sub-agents), then take one again before returning. */
|
|
51
|
+
async suspend(fn) {
|
|
52
|
+
this.waiters++;
|
|
53
|
+
if (this.reacquiring)
|
|
54
|
+
await this.reacquiring;
|
|
55
|
+
if (this.held && !this.done) {
|
|
56
|
+
this.held = false;
|
|
57
|
+
this.limiter.free();
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
return await fn();
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
this.waiters--;
|
|
64
|
+
if (this.waiters === 0 && !this.held && !this.done) {
|
|
65
|
+
// A run that already started goes ahead of runs that have not.
|
|
66
|
+
this.reacquiring = this.limiter.take(this.priority + 1000).then(() => {
|
|
67
|
+
this.held = true;
|
|
68
|
+
this.reacquiring = undefined;
|
|
69
|
+
if (this.done)
|
|
70
|
+
this.release();
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (this.reacquiring)
|
|
74
|
+
await this.reacquiring;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
release() {
|
|
78
|
+
this.done = true;
|
|
79
|
+
if (!this.held)
|
|
80
|
+
return;
|
|
81
|
+
this.held = false;
|
|
82
|
+
this.limiter.free();
|
|
83
|
+
}
|
|
84
|
+
}
|
package/src/login.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PineConfig } from "./config.ts";
|
|
2
|
+
export interface Prompter {
|
|
3
|
+
text(message: string): Promise<string>;
|
|
4
|
+
secret(message: string): Promise<string>;
|
|
5
|
+
say(line: string): void;
|
|
6
|
+
open(url: string): void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Read one line without showing it. The prompt stays on screen and says that the input is hidden,
|
|
10
|
+
* so a silent cursor is not mistaken for a hang. Works for typing and for pasting.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readSecret(message: string, input?: NodeJS.ReadableStream & {
|
|
13
|
+
setRawMode?(on: boolean): unknown;
|
|
14
|
+
isTTY?: boolean;
|
|
15
|
+
}, output?: NodeJS.WritableStream): Promise<string>;
|
|
16
|
+
/** Every provider pi knows here: its own and the ones of models.json. */
|
|
17
|
+
export declare function knownProviders(cfg: PineConfig): Promise<string[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Sign in to a model provider with pi's own login flow and store the credential in
|
|
20
|
+
* <home>/auth.json (mode 600). Agents cannot read that file.
|
|
21
|
+
*/
|
|
22
|
+
export declare function login(cfg: PineConfig, provider: string, type?: "api_key" | "oauth", prompter?: Prompter): Promise<string[]>;
|
|
23
|
+
export declare function logout(cfg: PineConfig, provider: string): Promise<void>;
|