@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.
Files changed (151) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +226 -2
  3. package/bin/pine.js +27 -0
  4. package/docs/SKILL.md +234 -0
  5. package/docs/references/agents.md +454 -0
  6. package/docs/references/coding.md +311 -0
  7. package/docs/references/computer.md +212 -0
  8. package/docs/references/configuration.md +310 -0
  9. package/docs/references/events.md +267 -0
  10. package/docs/references/mcp.md +420 -0
  11. package/docs/references/operations.md +394 -0
  12. package/docs/references/overview.md +195 -0
  13. package/docs/references/security.md +896 -0
  14. package/docs/references/setup.md +385 -0
  15. package/docs/references/sources.md +772 -0
  16. package/docs/references/stack.md +121 -0
  17. package/docs/references/tui.md +575 -0
  18. package/examples/home/.env.example +7 -0
  19. package/examples/home/USER.md +4 -0
  20. package/examples/home/agents/main/agent.json +4 -0
  21. package/examples/home/agents/main/workspace/AGENTS.md +14 -0
  22. package/examples/home/agents/main/workspace/MEMORY.md +4 -0
  23. package/examples/home/agents/main/workspace/SOUL.md +4 -0
  24. package/examples/home/models.json +62 -0
  25. package/examples/home/pine.json +34 -0
  26. package/examples/home/skills/README.txt +7 -0
  27. package/examples/launchd/com.pine.daemon.plist +32 -0
  28. package/examples/systemd/pine.service +22 -0
  29. package/mcp/browser.d.ts +99 -0
  30. package/mcp/browser.js +496 -0
  31. package/mcp/commands.d.ts +20 -0
  32. package/mcp/commands.js +88 -0
  33. package/mcp/computer.d.ts +139 -0
  34. package/mcp/computer.js +698 -0
  35. package/mcp/computer.swift +989 -0
  36. package/mcp/lib.d.ts +23 -0
  37. package/mcp/lib.js +52 -0
  38. package/mcp/web.d.ts +6 -0
  39. package/mcp/web.js +140 -0
  40. package/package.json +32 -4
  41. package/src/access.d.ts +112 -0
  42. package/src/access.js +438 -0
  43. package/src/actions.d.ts +75 -0
  44. package/src/actions.js +167 -0
  45. package/src/admin.d.ts +167 -0
  46. package/src/admin.js +625 -0
  47. package/src/agent-admin.d.ts +24 -0
  48. package/src/agent-admin.js +55 -0
  49. package/src/agents.d.ts +540 -0
  50. package/src/agents.js +2776 -0
  51. package/src/background.d.ts +29 -0
  52. package/src/background.js +100 -0
  53. package/src/cli.d.ts +2 -0
  54. package/src/cli.js +777 -0
  55. package/src/computer.d.ts +30 -0
  56. package/src/computer.js +32 -0
  57. package/src/config.d.ts +396 -0
  58. package/src/config.js +549 -0
  59. package/src/dev/claude-model.d.ts +37 -0
  60. package/src/dev/claude-model.js +204 -0
  61. package/src/env-file.d.ts +4 -0
  62. package/src/env-file.js +40 -0
  63. package/src/goals.d.ts +133 -0
  64. package/src/goals.js +316 -0
  65. package/src/http.d.ts +46 -0
  66. package/src/http.js +509 -0
  67. package/src/limiter.d.ts +32 -0
  68. package/src/limiter.js +84 -0
  69. package/src/login.d.ts +23 -0
  70. package/src/login.js +130 -0
  71. package/src/manual.d.ts +61 -0
  72. package/src/manual.js +443 -0
  73. package/src/mcp-config.d.ts +49 -0
  74. package/src/mcp-config.js +182 -0
  75. package/src/models.d.ts +90 -0
  76. package/src/models.js +274 -0
  77. package/src/net.d.ts +50 -0
  78. package/src/net.js +150 -0
  79. package/src/pine.d.ts +32 -0
  80. package/src/pine.js +134 -0
  81. package/src/programs.d.ts +123 -0
  82. package/src/programs.js +412 -0
  83. package/src/router.d.ts +56 -0
  84. package/src/router.js +164 -0
  85. package/src/sandbox-fs.d.ts +34 -0
  86. package/src/sandbox-fs.js +186 -0
  87. package/src/sandbox-linux.d.ts +96 -0
  88. package/src/sandbox-linux.js +297 -0
  89. package/src/sandbox-setup.d.ts +70 -0
  90. package/src/sandbox-setup.js +216 -0
  91. package/src/security.d.ts +238 -0
  92. package/src/security.js +660 -0
  93. package/src/skills.d.ts +67 -0
  94. package/src/skills.js +163 -0
  95. package/src/snapshots.d.ts +68 -0
  96. package/src/snapshots.js +306 -0
  97. package/src/source-types.d.ts +61 -0
  98. package/src/source-types.js +1 -0
  99. package/src/sources/command.d.ts +4 -0
  100. package/src/sources/command.js +77 -0
  101. package/src/sources/folder.d.ts +6 -0
  102. package/src/sources/folder.js +116 -0
  103. package/src/sources/ftp.d.ts +4 -0
  104. package/src/sources/ftp.js +307 -0
  105. package/src/sources/http.d.ts +4 -0
  106. package/src/sources/http.js +201 -0
  107. package/src/sources/mqtt.d.ts +18 -0
  108. package/src/sources/mqtt.js +97 -0
  109. package/src/sources/telegram.d.ts +22 -0
  110. package/src/sources/telegram.js +283 -0
  111. package/src/sources/webhook.d.ts +4 -0
  112. package/src/sources/webhook.js +52 -0
  113. package/src/sources.d.ts +344 -0
  114. package/src/sources.js +966 -0
  115. package/src/store.d.ts +99 -0
  116. package/src/store.js +277 -0
  117. package/src/timers.d.ts +83 -0
  118. package/src/timers.js +318 -0
  119. package/src/tools.d.ts +11 -0
  120. package/src/tools.js +1297 -0
  121. package/src/tui/app.d.ts +305 -0
  122. package/src/tui/app.js +3195 -0
  123. package/src/tui/client.d.ts +236 -0
  124. package/src/tui/client.js +131 -0
  125. package/src/tui/code-pane.d.ts +68 -0
  126. package/src/tui/code-pane.js +535 -0
  127. package/src/tui/highlight.d.ts +8 -0
  128. package/src/tui/highlight.js +86 -0
  129. package/src/tui/picture.d.ts +206 -0
  130. package/src/tui/picture.js +801 -0
  131. package/src/tui/run.d.ts +8 -0
  132. package/src/tui/run.js +97 -0
  133. package/src/tui/theme.d.ts +32 -0
  134. package/src/tui/theme.js +128 -0
  135. package/src/tui/undo.d.ts +5 -0
  136. package/src/tui/undo.js +50 -0
  137. package/src/tui/voice.d.ts +49 -0
  138. package/src/tui/voice.js +155 -0
  139. package/src/tui/voice.swift +223 -0
  140. package/src/types.d.ts +139 -0
  141. package/src/types.js +1 -0
  142. package/src/undo.d.ts +224 -0
  143. package/src/undo.js +465 -0
  144. package/src/update.d.ts +35 -0
  145. package/src/update.js +130 -0
  146. package/src/util.d.ts +65 -0
  147. package/src/util.js +171 -0
  148. package/src/watching.d.ts +20 -0
  149. package/src/watching.js +68 -0
  150. package/src/workspace-view.d.ts +72 -0
  151. package/src/workspace-view.js +221 -0
@@ -0,0 +1,30 @@
1
+ import type { Level } from "./config.ts";
2
+ /** The tools that only look. Everything else the server offers acts in an app. */
3
+ export declare const APP_LOOK: string[];
4
+ /** What a picture shows when it was asked for without an app. */
5
+ export declare const WHOLE_SCREEN = "the whole screen";
6
+ /**
7
+ * Which app a call is about: the name as the model gave it, and the key the owner's yes is kept
8
+ * under for the conversation. `apps` names none and is not asked about. A call that should name
9
+ * an app and does not gets none either: the server refuses it.
10
+ */
11
+ export declare function appTarget(tool: string, input: unknown): {
12
+ key: string;
13
+ name: string;
14
+ } | undefined;
15
+ /**
16
+ * Whether a session gets app control, and what pine tells the server then. App control acts as
17
+ * the owner in every app on their screen, so it goes to the owner's own conversations of an agent
18
+ * that works with the owner's account anyway ("auto" and "bypass" mode), and to nothing else: `undefined` means the server is not
19
+ * registered for the session. It exists on macOS only; `standIn` is a helper program named in the
20
+ * options, which tests use in place of the real one on any system.
21
+ */
22
+ export declare function computerSession(o: {
23
+ owner: boolean;
24
+ level: Level;
25
+ dataDir: string;
26
+ platform?: string;
27
+ standIn?: boolean;
28
+ }): {
29
+ helperDir: string;
30
+ } | undefined;
@@ -0,0 +1,32 @@
1
+ /** The tools that only look. Everything else the server offers acts in an app. */
2
+ export const APP_LOOK = ["apps", "app_snapshot", "app_screenshot"];
3
+ /** What a picture shows when it was asked for without an app. */
4
+ export const WHOLE_SCREEN = "the whole screen";
5
+ /**
6
+ * Which app a call is about: the name as the model gave it, and the key the owner's yes is kept
7
+ * under for the conversation. `apps` names none and is not asked about. A call that should name
8
+ * an app and does not gets none either: the server refuses it.
9
+ */
10
+ export function appTarget(tool, input) {
11
+ if (tool === "apps")
12
+ return undefined;
13
+ const given = input?.app;
14
+ const name = typeof given === "string" ? given.trim() : "";
15
+ if (name)
16
+ return { key: `app:${name.toLowerCase()}`, name };
17
+ return tool === "app_screenshot" ? { key: "screen", name: WHOLE_SCREEN } : undefined;
18
+ }
19
+ /**
20
+ * Whether a session gets app control, and what pine tells the server then. App control acts as
21
+ * the owner in every app on their screen, so it goes to the owner's own conversations of an agent
22
+ * that works with the owner's account anyway ("auto" and "bypass" mode), and to nothing else: `undefined` means the server is not
23
+ * registered for the session. It exists on macOS only; `standIn` is a helper program named in the
24
+ * options, which tests use in place of the real one on any system.
25
+ */
26
+ export function computerSession(o) {
27
+ if (!o.owner || (o.level !== "auto" && o.level !== "bypass"))
28
+ return undefined;
29
+ if ((o.platform ?? process.platform) !== "darwin" && !o.standIn)
30
+ return undefined;
31
+ return { helperDir: `${o.dataDir}/computer` };
32
+ }
@@ -0,0 +1,396 @@
1
+ import type { ReplyTarget } from "./types.ts";
2
+ import { type LogLevel } from "./util.ts";
3
+ /** One MCP server, in the shape of an `mcpServers` entry of pi's mcp.json, plus `agents` for global servers. */
4
+ export interface McpServerConfig {
5
+ command?: string;
6
+ args?: string[];
7
+ env?: Record<string, string>;
8
+ cwd?: string;
9
+ url?: string;
10
+ headers?: Record<string, string>;
11
+ exposure?: "direct" | "codemode" | "deferred" | "hidden";
12
+ toolExposure?: Record<string, string>;
13
+ description?: string;
14
+ enabled?: boolean;
15
+ timeout?: number;
16
+ /** Global servers only: which agents get it. Default ["*"]. */
17
+ agents?: string[];
18
+ /** Use a server that ships with pine ("web", "browser", "commands", "computer") instead of command/url. */
19
+ pine?: string;
20
+ options?: Record<string, unknown>;
21
+ /** Its results are outside content: a session that calls it counts as tainted. */
22
+ taints?: boolean;
23
+ /** When calls need the owner's approval. Default "never" ("tainted" for servers flagged sensitive by the docs). */
24
+ approve?: "never" | "tainted" | "always";
25
+ /**
26
+ * A local server (`command`) that runs inside the sandbox of the agent that uses it, so that it
27
+ * reaches what that agent's shell reaches and no more. Written by add_mcp_server: a program an
28
+ * agent proposed is never run with the daemon's own rights. One the owner adds runs as they do.
29
+ */
30
+ sandboxed?: boolean;
31
+ /** An agent's own servers only: the one conversation that gets it. Written by add_mcp_server for a server added for a conversation; it is removed with that conversation. */
32
+ session?: string;
33
+ [key: string]: unknown;
34
+ }
35
+ /**
36
+ * A source of outside events: a watched folder, an MQTT broker, a webhook, an FTP drop, a web
37
+ * address, or your own module. Like an MCP server it only is there; nothing happens until an agent
38
+ * subscribes to it. The remaining keys are the options of its type.
39
+ */
40
+ export interface SourceConfig {
41
+ /** A built-in type (see SOURCE_TYPES) ... */
42
+ type?: string;
43
+ /** ... or the path of a module whose default export is `(source) => void`. */
44
+ use?: string;
45
+ /** Where relative paths in the entry are resolved from. */
46
+ base: string;
47
+ /** One line for agents and people: what this source reports. */
48
+ description?: string;
49
+ /** Global sources only: the agents that may subscribe. Default: all. */
50
+ agents?: string[];
51
+ /** An agent's own sources only: the one conversation it was set up for. Other conversations do not see it, and it is removed with that conversation. */
52
+ session?: string;
53
+ /** Who its events speak for. "untrusted" (default): outside content, the subscriber wakes with its reduced tool set. "owner": your own device or schedule. */
54
+ trust: "owner" | "untrusted";
55
+ /** "subscribed" (default): runs only while an agent is subscribed. "always": runs from start, for routes that use its events. */
56
+ start: "subscribed" | "always";
57
+ enabled: boolean;
58
+ options: Record<string, any>;
59
+ }
60
+ export declare const SOURCE_TYPES: string[];
61
+ /** Topics only the daemon itself publishes on: the publish_event tool and route definitions refuse them. */
62
+ export declare const RESERVED_TOPICS: string[];
63
+ /**
64
+ * A subscription: one conversation of an agent listens to one source, and each event of the source
65
+ * arrives there as a message and wakes the agent into a turn. Several conversations of the same
66
+ * agent can listen to the same source, each with its own note.
67
+ */
68
+ export interface SubscriptionConfig {
69
+ source: string;
70
+ /** What the agent wants to do when it is woken, in its own or your words. Given to it with every event. */
71
+ note?: string;
72
+ /** Only events that match (same filter as routes; keys such as "event" and "payload.x"). */
73
+ when?: Record<string, unknown>;
74
+ /** Wait for quiet, then handle only the last event. */
75
+ debounceMs?: number;
76
+ /** Handle one event, then ignore the source for this long. Default 10 s, so a chatty device cannot keep a model busy. */
77
+ throttleMs: number;
78
+ /** Whether that is the default, as opposed to something the subscription said. A source somebody writes through is not held back by the default: every message counts. */
79
+ throttleDefault?: boolean;
80
+ /** The conversation that listens: the one the agent subscribed in. "main" unless said otherwise ("on-<source>" with `separate`). */
81
+ session: string;
82
+ /**
83
+ * true: wake it in a conversation of its own ("on-<source>", or `session`) instead, and for a
84
+ * source that is not yours with the reduced tool set. For sources that carry strangers' text.
85
+ */
86
+ separate: boolean;
87
+ /** Replaces the standard text the agent is woken with. Templates as in routes. */
88
+ prompt?: string;
89
+ }
90
+ export interface RouteConfig {
91
+ name: string;
92
+ on: string[];
93
+ when?: Record<string, unknown>;
94
+ /** Wait for this long without a new matching event, then handle only the last one. */
95
+ debounceMs?: number;
96
+ /** Handle the first event, then ignore matching events for this long. */
97
+ throttleMs?: number;
98
+ /** Template for the debounce/throttle bucket. Default: the event topic. */
99
+ key?: string;
100
+ /** Write world state: key template -> value template. */
101
+ set?: Record<string, unknown>;
102
+ /** Publish another event. With `call`, `{{result}}` holds the model's answer. */
103
+ publish?: {
104
+ topic: string;
105
+ payload?: unknown;
106
+ };
107
+ /** One model call without tools or history. */
108
+ call?: {
109
+ model?: string;
110
+ system?: string;
111
+ prompt: string;
112
+ };
113
+ /** Full agent turn. */
114
+ agent?: string;
115
+ prompt?: string;
116
+ session?: string;
117
+ whenBusy?: "queue" | "steer";
118
+ priority?: number;
119
+ /** Where the agent's final answer goes. Default: the event's own reply target. false: nowhere. */
120
+ reply?: ReplyTarget | false;
121
+ /** Override the event's trust. "owner" gives events on this route the agent's full tool set. */
122
+ trust?: "owner" | "untrusted";
123
+ /** Text put in front of the event for the agent, outside the "this is data" frame. Set by subscriptions, not in pine.json. */
124
+ preface?: string;
125
+ /**
126
+ * Set by subscriptions: the event is delivered into the subscriber's own conversation, with its
127
+ * usual tools, as outside content. The conversation is marked with this reason, as it would be
128
+ * after reading a web page.
129
+ */
130
+ taint?: string;
131
+ /** Short line for listings and the UI. Template. */
132
+ label?: string;
133
+ }
134
+ /**
135
+ * Something that happens at a time: every so often, at set times, or once. With a `task` it wakes
136
+ * an agent to do that task; without one it only publishes an event for a route to pick up.
137
+ *
138
+ * Like sources, servers and skills, a schedule is for all agents (pine.json), for one agent
139
+ * (agent.json) or for one conversation of an agent (agent.json, with `session`).
140
+ */
141
+ export interface ScheduleConfig {
142
+ name: string;
143
+ /** Five-field cron expression in local time. */
144
+ cron?: string;
145
+ /** Fixed interval such as "15m", in milliseconds. */
146
+ every?: number;
147
+ /** Once, at this moment (milliseconds since 1970). The schedule is removed when it has fired. */
148
+ at?: number;
149
+ /** What the agent is to do when it fires, written to the agent. */
150
+ task?: string;
151
+ /** The conversation that is woken. Leaving it out is the agent as such: its main conversation. */
152
+ session?: string;
153
+ topic: string;
154
+ payload?: unknown;
155
+ /** Fire once at startup when a cron time passed while the daemon was down. */
156
+ catchUp: boolean;
157
+ }
158
+ export interface HookConfig {
159
+ topic: string;
160
+ /** Shared secret: accepted as `Authorization: Bearer <secret>` or as an HMAC-SHA256 of the body in `X-Hub-Signature-256` / `X-Signature`. */
161
+ secret?: string;
162
+ }
163
+ /**
164
+ * How much an agent does without asking, and whether its shell and file tools run in a sandbox.
165
+ * One setting says both.
166
+ * bypass: no sandbox, and nothing asks.
167
+ * auto: no sandbox: the owner's whole user account and the network, like the owner at the
168
+ * terminal. Critical actions are checked, and after outside content what reaches out,
169
+ * sends something or changes the agent's memory.
170
+ * safe: in the sandbox: its own folders, and what the owner grants. Critical actions are checked.
171
+ * manual: in the sandbox where the machine has one; every action that changes or sends something
172
+ * waits for approval.
173
+ * pine's own home and code are closed to an agent in every mode. A run that outside content
174
+ * started is held to "safe" whatever the agent's mode.
175
+ */
176
+ export type Level = "manual" | "safe" | "auto" | "bypass";
177
+ /**
178
+ * "plan": the agent looks, reads and asks, and changes nothing; its answer is what it would do.
179
+ * It lies on top of a level (`AgentConfig.level`), which says how far the looking reaches.
180
+ */
181
+ export type Mode = Level | "plan";
182
+ export declare const LEVELS: Level[];
183
+ export declare const MODES: Mode[];
184
+ /** Whether a level leaves the sandbox off: the owner's whole account and the network. */
185
+ export declare const unsandboxed: (level: Level) => level is "auto" | "bypass";
186
+ export interface SandboxConfig {
187
+ /** Shell commands may open network connections. */
188
+ network: boolean;
189
+ /** Extra paths the agent may read / write, besides its workspace. */
190
+ read: string[];
191
+ write: string[];
192
+ /** Allow the shared temp directories (/tmp and the user's temp dir). */
193
+ sharedTmp: boolean;
194
+ env: Record<string, string>;
195
+ }
196
+ /** What a run triggered by an untrusted event may use. */
197
+ export interface UntrustedProfile {
198
+ tools: string[];
199
+ mcp: string[];
200
+ delegates: string[];
201
+ publish: string[];
202
+ stateWrite: boolean;
203
+ subagents: boolean;
204
+ }
205
+ export interface AgentConfig {
206
+ id: string;
207
+ /** pi agent dir of this agent: AGENTS.md, skills/, extensions/, settings.json, sessions/. */
208
+ dir: string;
209
+ description: string;
210
+ workspace: string;
211
+ model?: string;
212
+ thinking: string;
213
+ /** Allowlist of pi built-in tools. Undefined keeps pi's default set. */
214
+ tools?: string[];
215
+ mcp: Record<string, McpServerConfig>;
216
+ /** Which global MCP servers this agent gets: all that list it (true), none (false), or these names. */
217
+ globalMcp: boolean | string[];
218
+ /** Event sources only this agent can subscribe to. */
219
+ sources: Record<string, SourceConfig>;
220
+ /** What this agent's conversations are subscribed to: its own sources or global ones. */
221
+ subscribe: SubscriptionConfig[];
222
+ /** What this agent does at set times: for the agent as such, or (with `session`) for one conversation. */
223
+ schedules: ScheduleConfig[];
224
+ extensions: string[];
225
+ skills: string[];
226
+ /** Extra instruction files loaded into the system prompt, besides AGENTS.md in the agent dir and the workspace. */
227
+ context: string[];
228
+ /** Agents this one may hand tasks to. "*" means every other agent. */
229
+ delegates: string[];
230
+ subagents: {
231
+ enabled: boolean;
232
+ maxParallel: number;
233
+ tools?: string[];
234
+ mcp: boolean;
235
+ };
236
+ /** Topics the publish_event tool may publish to. */
237
+ publish: string[];
238
+ state: {
239
+ read: string[];
240
+ write: string[];
241
+ inject: string[];
242
+ };
243
+ trustWorkspace: boolean;
244
+ mode: Mode;
245
+ /** The mode beneath "plan": what the agent had before, and what decides its sandbox while it plans. The same as `mode` otherwise. */
246
+ level: Level;
247
+ /** Whether somebody chose the mode (agent.json, or defaults.mode). One that nobody chose follows what the machine can do: see `levelOf` in security.ts. */
248
+ modeSet: boolean;
249
+ sandbox: SandboxConfig;
250
+ /** Tool calls that always need the owner's approval: "tool" or "tool:argument-glob". */
251
+ approve: string[];
252
+ /** Tool calls that need approval once the session has seen outside content. */
253
+ approveWhenTainted: string[];
254
+ /** Profile for runs triggered by untrusted events; false refuses such runs. */
255
+ untrusted: UntrustedProfile | false;
256
+ bashTimeoutSec: number;
257
+ bashDeny: string[];
258
+ taskTimeoutSec: number;
259
+ idleMs: number;
260
+ settings: Record<string, unknown>;
261
+ }
262
+ export interface PineConfig {
263
+ home: string;
264
+ dataDir: string;
265
+ logLevel: LogLevel;
266
+ main?: string;
267
+ /** `mode`: for every agent that names none. Not set: auto for the main agent, safe for the others. */
268
+ defaults: {
269
+ model?: string; /** The model that judges whether a goal is met, as "provider/id". Not set: the agent's own. */
270
+ judge?: string;
271
+ thinking: string;
272
+ mode?: Mode;
273
+ bashTimeoutSec: number;
274
+ taskTimeoutSec: number;
275
+ idleMs: number;
276
+ settings: Record<string, unknown>;
277
+ };
278
+ limits: {
279
+ maxConcurrentRuns: number;
280
+ maxDelegationDepth: number;
281
+ /** Largest file the download tool fetches. */
282
+ maxDownloadMb: number;
283
+ maxEventHops: number;
284
+ modelHeadersTimeoutMs: number;
285
+ modelStreamIdleMs: number;
286
+ eventRetentionDays: number;
287
+ /** A conversation that is not pinned, not open in a tab, not subscribed to anything and without a schedule of its own is removed after this many days without a message. 0: never. */
288
+ conversationDays: number;
289
+ maxQueuedPerAgent: number;
290
+ maxEventChars: number;
291
+ /**
292
+ * Goal mode (src/goals.ts): how many rounds a goal gets before it stops and the owner has to
293
+ * say that it goes on. A round is a whole task with as many tool calls as it takes, bounded
294
+ * by taskTimeoutSec, so twenty of them are hours on a local model; and a small model that has
295
+ * not got there in twenty turns is more often stuck than nearly done.
296
+ */
297
+ goalRounds: number;
298
+ /** Goal mode: after this many rounds in a row that ended "not met" without a tool call, the goal is paused. 0: never. */
299
+ goalIdleRounds: number;
300
+ /** How long the judge of a goal may take before its silence counts as no verdict. */
301
+ goalJudgeMs: number;
302
+ };
303
+ security: {
304
+ approvalTimeoutMs: number;
305
+ /** How long a session stays tainted after it saw outside content. */
306
+ taint: "session" | "run" | "off";
307
+ /** Tool name globs whose results are outside content, besides MCP servers marked `taints`. */
308
+ taintTools: string[];
309
+ /** Keep bypass mode in force after a session has seen outside content. Off: such a session asks again. */
310
+ bypassWhenTainted: boolean;
311
+ /**
312
+ * Whether pine asks the owner itself when a call of an agent in the workspace scope needs a
313
+ * file or folder outside its sandbox, or the network (src/access.ts). Off: only the agent
314
+ * asks, with request_access.
315
+ */
316
+ askAccess: boolean;
317
+ };
318
+ /** Values that must never leave the daemon in events or messages. */
319
+ secrets: string[];
320
+ mcp: Record<string, McpServerConfig>;
321
+ /** Event sources every agent can subscribe to (or the agents an entry lists). */
322
+ sources: Record<string, SourceConfig>;
323
+ /** Source types of your own, besides the built-in ones: type name -> the module that implements it. */
324
+ sourceTypes: Record<string, string>;
325
+ /** Subscriptions for everyone: each agent that can use the source is woken in its main conversation. */
326
+ subscribe: SubscriptionConfig[];
327
+ extensions: string[];
328
+ skills: string[];
329
+ routes: RouteConfig[];
330
+ schedules: ScheduleConfig[];
331
+ http?: {
332
+ host: string;
333
+ port: number;
334
+ token?: string;
335
+ hooks: Record<string, HookConfig>;
336
+ };
337
+ agents: Record<string, AgentConfig>;
338
+ }
339
+ export declare class ConfigError extends Error {
340
+ problems: string[];
341
+ constructor(problems: string[]);
342
+ }
343
+ /** The pine checkout: bundled MCP servers and source types live here. */
344
+ export declare const PINE_ROOT: string;
345
+ /**
346
+ * How pine's own module files end: ".ts" in a checkout, where Node runs the sources as they are,
347
+ * ".js" in the published package, which holds them compiled (Node does not run TypeScript from
348
+ * inside node_modules). Used wherever pine names one of its own files at run time.
349
+ */
350
+ export declare const EXT: string;
351
+ export declare const defaultHome: () => string;
352
+ /** Read `<home>/pine.json`, `<home>/.env` and every `<home>/agents/<id>/agent.json`. Throws ConfigError. */
353
+ export declare function loadConfig(home?: string): PineConfig;
354
+ /** MCP servers an agent ends up with: its own, plus the global ones that include it. Own entries win. */
355
+ /** The main agent: the one pine.json names; without that entry the one called "main", else the first one. */
356
+ /**
357
+ * The files in an agent's workspace that are part of its prompt, in the order they enter it. They
358
+ * are the agent's own: it reads them as its instructions and keeps them up to date itself.
359
+ * AGENTS.md is how it works, SOUL.md who it is, MEMORY.md what should outlive a conversation.
360
+ */
361
+ export declare const WORKSPACE_FILES: string[];
362
+ /** What all agents know about the owner: one file in pine's home, in every agent's prompt, kept by the main agent. */
363
+ export declare const userFile: (cfg: PineConfig) => string;
364
+ /**
365
+ * Where skills lie that were set up by tool call. The place says whom a skill is for: all agents,
366
+ * one agent, or one conversation of an agent. All of it is inside pine's home, which agents read
367
+ * but do not write.
368
+ */
369
+ export declare const globalSkillsDir: (cfg: Pick<PineConfig, "home">) => string;
370
+ export declare const agentSkillsDir: (agent: Pick<AgentConfig, "dir">) => string;
371
+ export declare const conversationsDir: (agent: Pick<AgentConfig, "dir">) => string;
372
+ export declare function mainAgentId(cfg: PineConfig): string;
373
+ /**
374
+ * The MCP servers an agent has. `session`: the conversation asked for, which also gets the servers
375
+ * that were added for it alone; without it, every server the agent has in any conversation.
376
+ */
377
+ export declare function effectiveMcp(cfg: PineConfig, agent: AgentConfig, session?: string): Record<string, McpServerConfig>;
378
+ /** Turn a pine MCP entry into what pi's registerMcpServer() accepts. */
379
+ export declare function toPiMcp(name: string, server: McpServerConfig, extraOptions?: Record<string, unknown>): Record<string, unknown>;
380
+ /**
381
+ * The forms "subscribe" may have in a file, as a plain list of entries:
382
+ * `["camera", "printer"]`, `{ "camera": { "note": ... } }`, or the form pine itself writes,
383
+ * `[{ "source": "camera", "session": "main", "note": ... }]`, which is the only one that can
384
+ * say that two conversations listen to the same source.
385
+ */
386
+ export declare function rawSubscriptions(raw: unknown): Array<Record<string, any>>;
387
+ export declare function subscriptionFrom(v: Record<string, any>): SubscriptionConfig;
388
+ /** The source an agent means by a name: its own first, then a global one it is allowed to use. */
389
+ export declare function sourceFor(cfg: PineConfig, agentId: string, name: string): {
390
+ source: SourceConfig;
391
+ key: string;
392
+ scope: string;
393
+ } | undefined;
394
+ export declare const mcpTaints: (server: McpServerConfig) => boolean;
395
+ /** Agents `from` may delegate to. */
396
+ export declare function delegateTargets(cfg: PineConfig, from: AgentConfig): AgentConfig[];