@pragma-sh/sdk 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/README.md +26 -0
- package/dist/index.cjs +1634 -0
- package/dist/index.d.cts +3038 -0
- package/dist/index.d.ts +3038 -0
- package/dist/index.js +1591 -0
- package/package.json +45 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,3038 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which world a terminal session's shell lives in. `native` runs the host's own shell through the host's PTY (a pseudo-terminal on macOS and Linux, ConPTY on Windows). `wsl` runs a Linux shell inside a WSL distribution, served by a Linux `pragma-server` running in that distribution. Only Windows offers a real choice; macOS and Linux always resolve to `native`.
|
|
3
|
+
*
|
|
4
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
5
|
+
* via the `definition` "TerminalBackend".
|
|
6
|
+
*/
|
|
7
|
+
type TerminalBackend = "native" | "wsl";
|
|
8
|
+
/**
|
|
9
|
+
* Top-level request/response RPC domains served by pragma-server over the Unix-socket frame protocol.
|
|
10
|
+
*
|
|
11
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
12
|
+
* via the `definition` "ProtocolRpcMethod".
|
|
13
|
+
*/
|
|
14
|
+
type ProtocolRpcMethod = "git" | "filesystem" | "database" | "kanban" | "worktrees" | "projects" | "tabs" | "settings" | "github" | "ai" | "exec" | "automations" | "plugins" | "tunnel" | "ports" | "scratchpads" | "whiteboards" | "wsl" | "fanouts";
|
|
15
|
+
/**
|
|
16
|
+
* Snapshot-then-delta subscription event streams served by pragma-server.
|
|
17
|
+
*
|
|
18
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
19
|
+
* via the `definition` "ProtocolEventKind".
|
|
20
|
+
*/
|
|
21
|
+
type ProtocolEventKind = "agentStatus" | "worktreeChanged" | "kanbanChanged" | "tabsChanged" | "fileChanged" | "echoMode" | "automationPending" | "automationsChanged" | "workspace" | "fanouts";
|
|
22
|
+
/**
|
|
23
|
+
* Stable protocol-level RPC error codes.
|
|
24
|
+
*
|
|
25
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
26
|
+
* via the `definition` "ProtocolErrorCode".
|
|
27
|
+
*/
|
|
28
|
+
type ProtocolErrorCode = "invalidPayload" | "unsupportedMethod" | "notFound" | "staleWrite" | "permissionDenied" | "internal";
|
|
29
|
+
/**
|
|
30
|
+
* How a desktop update is applied. `reload` swaps the webview UI overlay and leaves the host running. `restart` always runs the full OS installer.
|
|
31
|
+
*
|
|
32
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
33
|
+
* via the `definition` "UpdateApplyMode".
|
|
34
|
+
*/
|
|
35
|
+
type UpdateApplyMode = "reload" | "restart";
|
|
36
|
+
/**
|
|
37
|
+
* Installer target id sent on the check request so a restart offer returns the right asset.
|
|
38
|
+
*
|
|
39
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
40
|
+
* via the `definition` "UpdatePlatform".
|
|
41
|
+
*/
|
|
42
|
+
type UpdatePlatform = "darwin-aarch64" | "darwin-x86_64" | "linux-x86_64-deb" | "linux-x86_64-rpm" | "linux-x86_64-appimage" | "linux-aarch64-deb" | "linux-aarch64-rpm" | "linux-aarch64-appimage" | "windows-x86_64";
|
|
43
|
+
/**
|
|
44
|
+
* Lifecycle of one fanout. Deliberately separate from agent runtime status: an attempt's agent may be idle while the fanout is still `active`.
|
|
45
|
+
*
|
|
46
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
47
|
+
* via the `definition` "FanoutStatus".
|
|
48
|
+
*/
|
|
49
|
+
type FanoutStatus = "provisioning" | "active" | "attention" | "partial" | "ready" | "failed" | "interrupted" | "cancelled" | "finalizing" | "needsResolution" | "cleanupFailed" | "completed";
|
|
50
|
+
/**
|
|
51
|
+
* Lifecycle of one fanout attempt. `interrupted` means the host restarted while the attempt was live; its prompt is never replayed automatically.
|
|
52
|
+
*
|
|
53
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
54
|
+
* via the `definition` "FanoutMemberStatus".
|
|
55
|
+
*/
|
|
56
|
+
type FanoutMemberStatus = "pending" | "provisioning" | "running" | "attention" | "done" | "failed" | "interrupted" | "cancelled" | "selected";
|
|
57
|
+
/**
|
|
58
|
+
* Durable progress marker for the destructive pick transaction. Persisted after every successful step so a retry resumes at the first incomplete stage instead of repeating a destructive one.
|
|
59
|
+
*
|
|
60
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
61
|
+
* via the `definition` "FanoutFinalizeStage".
|
|
62
|
+
*/
|
|
63
|
+
type FanoutFinalizeStage = "validating" | "committingWinner" | "merging" | "promotingScratchpads" | "stoppingSessions" | "cleaningUp" | "completed";
|
|
64
|
+
/**
|
|
65
|
+
* Machine-readable reason a fanout operation failed, preserved through the CLI, the gateway, and the SDK so callers branch on a code rather than on message text.
|
|
66
|
+
*
|
|
67
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
68
|
+
* via the `definition` "FanoutFailureCode".
|
|
69
|
+
*/
|
|
70
|
+
type FanoutFailureCode = "invalidSelector" | "unknownAgent" | "unknownModel" | "unknownReasoning" | "activeFanoutExists" | "dirtyParent" | "worktreeCreateFailed" | "setupFailed" | "launchFailed" | "notFound" | "conflict" | "descendantWorktree" | "commitMessageFailed" | "mergeConflict" | "promotionFailed" | "cleanupFailed" | "internal";
|
|
71
|
+
/**
|
|
72
|
+
* Where a fanout's single parent comes from: an existing worktree, or a fresh coordination worktree created from a source worktree.
|
|
73
|
+
*
|
|
74
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
75
|
+
* via the `definition` "FanoutParentSpec".
|
|
76
|
+
*/
|
|
77
|
+
type FanoutParentSpec = FanoutExistingParent | FanoutNewParent;
|
|
78
|
+
/**
|
|
79
|
+
* Follow-up delivery outcome per member: `accepted` is the fire-and-forget terminal state, the rest are only observable when waiting.
|
|
80
|
+
*
|
|
81
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
82
|
+
* via the `definition` "FanoutDeliveryState".
|
|
83
|
+
*/
|
|
84
|
+
type FanoutDeliveryState = "accepted" | "delivered" | "failed" | "timedOut";
|
|
85
|
+
/**
|
|
86
|
+
* Optional agent capability used to exclude unsupported agent-verification scenarios.
|
|
87
|
+
*
|
|
88
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
89
|
+
* via the `definition` "AgentFeature".
|
|
90
|
+
*/
|
|
91
|
+
type AgentFeature = "questions" | "commandApproval" | "commands" | "subagents" | "abort" | "interrupt" | "usageLimits" | "sessionName";
|
|
92
|
+
/**
|
|
93
|
+
* Discriminates what a tab hosts: a shell terminal, an embedded browser, a file editor, a scratchpad, a whiteboard, a read-only diff, the read-only daemon log viewer, a pull-request review, or a plugin web view.
|
|
94
|
+
*
|
|
95
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
96
|
+
* via the `definition` "TabKind".
|
|
97
|
+
*/
|
|
98
|
+
type TabKind = "terminal" | "browser" | "editor" | "scratchpad" | "whiteboard" | "diff" | "log" | "pr-review" | "plugin-webview";
|
|
99
|
+
/**
|
|
100
|
+
* Runtime status an external agent reports for a terminal tab. `cleared` is a transient signal that removes the agent's indicator entirely (used when the agent process exits), as opposed to `done`, which leaves a green "finished, go look" dot.
|
|
101
|
+
*
|
|
102
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
103
|
+
* via the `definition` "AgentStatus".
|
|
104
|
+
*/
|
|
105
|
+
type AgentStatus = "running" | "attention" | "done" | "cleared";
|
|
106
|
+
/**
|
|
107
|
+
* Reason an agent needs the user's attention.
|
|
108
|
+
*
|
|
109
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
110
|
+
* via the `definition` "AgentAttentionKind".
|
|
111
|
+
*/
|
|
112
|
+
type AgentAttentionKind = "question" | "command";
|
|
113
|
+
/**
|
|
114
|
+
* Role/source for one rich agent message entry.
|
|
115
|
+
*
|
|
116
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
117
|
+
* via the `definition` "AgentMessageRole".
|
|
118
|
+
*/
|
|
119
|
+
type AgentMessageRole = "assistant" | "tool" | "user" | "system";
|
|
120
|
+
/**
|
|
121
|
+
* Lifecycle status for a tool call reported inside an AgentMessage.
|
|
122
|
+
*
|
|
123
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
124
|
+
* via the `definition` "AgentToolCallStatus".
|
|
125
|
+
*/
|
|
126
|
+
type AgentToolCallStatus = "running" | "done" | "error";
|
|
127
|
+
/**
|
|
128
|
+
* File interaction kind reported inside an AgentMessage.
|
|
129
|
+
*
|
|
130
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
131
|
+
* via the `definition` "AgentFileChangeKind".
|
|
132
|
+
*/
|
|
133
|
+
type AgentFileChangeKind = "read" | "edited" | "created" | "deleted";
|
|
134
|
+
/**
|
|
135
|
+
* Which axis of change a diff/listing record refers to. committed (base branch → HEAD), staged (HEAD → index), and unstaged (index → working tree) are the three listing axes. worktree (base branch → working tree) is the unified review side every Changes-sidebar click opens — it compares the file's current on-disk content against what used to be on the worktree at its fork point, regardless of which list the file appears in.
|
|
136
|
+
*
|
|
137
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
138
|
+
* via the `definition` "DiffSide".
|
|
139
|
+
*/
|
|
140
|
+
type DiffSide = "committed" | "staged" | "unstaged" | "worktree";
|
|
141
|
+
/**
|
|
142
|
+
* How a file changed relative to the diff base.
|
|
143
|
+
*
|
|
144
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
145
|
+
* via the `definition` "ChangeStatus".
|
|
146
|
+
*/
|
|
147
|
+
type ChangeStatus = "added" | "modified" | "deleted" | "renamed" | "untracked";
|
|
148
|
+
/**
|
|
149
|
+
* Column a prompt card lives in on the project Kanban board.
|
|
150
|
+
*
|
|
151
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
152
|
+
* via the `definition` "KanbanPromptStatus".
|
|
153
|
+
*/
|
|
154
|
+
type KanbanPromptStatus = "draft" | "inProgress" | "reviewNeeded" | "completed";
|
|
155
|
+
/**
|
|
156
|
+
* How a reviewed card was completed: committed and merged, committed with a PR opened, or finished manually.
|
|
157
|
+
*
|
|
158
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
159
|
+
* via the `definition` "KanbanCompletedAction".
|
|
160
|
+
*/
|
|
161
|
+
type KanbanCompletedAction = "commitMerge" | "commitPr" | "manual";
|
|
162
|
+
/**
|
|
163
|
+
* When the card's agent run is started. MVP supports manual start only.
|
|
164
|
+
*
|
|
165
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
166
|
+
* via the `definition` "KanbanSchedulingMode".
|
|
167
|
+
*/
|
|
168
|
+
type KanbanSchedulingMode = "manual";
|
|
169
|
+
/**
|
|
170
|
+
* Shared compile-time constants. Single source of truth for both the TypeScript frontend (src) and the Rust backend (src-tauri). Edit values.json; never edit generated code.
|
|
171
|
+
*/
|
|
172
|
+
interface Constants {
|
|
173
|
+
app: AppInfo;
|
|
174
|
+
window: WindowDefaults;
|
|
175
|
+
editorLaunchers: EditorLaunchers;
|
|
176
|
+
scripts: Scripts;
|
|
177
|
+
agents: Agents;
|
|
178
|
+
platform: Platform;
|
|
179
|
+
daemon: Daemon;
|
|
180
|
+
gateway: Gateway;
|
|
181
|
+
protocol: Protocol;
|
|
182
|
+
github: GitHub;
|
|
183
|
+
plugins: Plugins;
|
|
184
|
+
theme: Theme;
|
|
185
|
+
tunnel: Tunnel;
|
|
186
|
+
keybindings: KeybindingsFiles;
|
|
187
|
+
agentStatus: AgentStatusDefaults;
|
|
188
|
+
terminalDefaults: TerminalDefaults;
|
|
189
|
+
tabs: TabDefaults;
|
|
190
|
+
bench: Bench;
|
|
191
|
+
files: FileReadLimits;
|
|
192
|
+
scratchpads: Scratchpads;
|
|
193
|
+
whiteboards: WhiteboardDefaults;
|
|
194
|
+
fanout: FanoutDefaults;
|
|
195
|
+
updates: Updates;
|
|
196
|
+
onboarding: Onboarding;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
200
|
+
* via the `definition` "AppInfo".
|
|
201
|
+
*/
|
|
202
|
+
interface AppInfo {
|
|
203
|
+
/**
|
|
204
|
+
* Human-readable product name.
|
|
205
|
+
*/
|
|
206
|
+
name: string;
|
|
207
|
+
/**
|
|
208
|
+
* Reverse-DNS bundle identifier.
|
|
209
|
+
*/
|
|
210
|
+
identifier: string;
|
|
211
|
+
/**
|
|
212
|
+
* Semantic version string.
|
|
213
|
+
*/
|
|
214
|
+
version: string;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
218
|
+
* via the `definition` "WindowDefaults".
|
|
219
|
+
*/
|
|
220
|
+
interface WindowDefaults {
|
|
221
|
+
defaultWidth: number;
|
|
222
|
+
defaultHeight: number;
|
|
223
|
+
minWidth: number;
|
|
224
|
+
minHeight: number;
|
|
225
|
+
/**
|
|
226
|
+
* Height in px of the custom draggable titlebar strip the frontend reserves above the content. Must clear the inset macOS traffic lights.
|
|
227
|
+
*/
|
|
228
|
+
titlebarHeight: number;
|
|
229
|
+
/**
|
|
230
|
+
* macOS traffic-light button inset in px from the top-left window corner, applied via tauri-plugin-decorum so the controls center vertically within the custom titlebar.
|
|
231
|
+
*/
|
|
232
|
+
trafficLightInset: number;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
236
|
+
* via the `definition` "EditorLaunchers".
|
|
237
|
+
*/
|
|
238
|
+
interface EditorLaunchers {
|
|
239
|
+
defaultEditorId: string;
|
|
240
|
+
options: EditorLauncher[];
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
244
|
+
* via the `definition` "EditorLauncher".
|
|
245
|
+
*/
|
|
246
|
+
interface EditorLauncher {
|
|
247
|
+
id: string;
|
|
248
|
+
name: string;
|
|
249
|
+
/**
|
|
250
|
+
* Iconify icon name, preferably from the simple-icons namespace for branded editors.
|
|
251
|
+
*/
|
|
252
|
+
brandIcon: string;
|
|
253
|
+
/**
|
|
254
|
+
* Hex color used to render the monochrome Iconify brand glyph.
|
|
255
|
+
*/
|
|
256
|
+
brandColor: string;
|
|
257
|
+
/**
|
|
258
|
+
* Executable name used to launch the editor with the worktree path. Null uses the system file explorer.
|
|
259
|
+
*/
|
|
260
|
+
cliCommand: string | null;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Shared script execution limits used by project lifecycle scripts.
|
|
264
|
+
*
|
|
265
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
266
|
+
* via the `definition` "Scripts".
|
|
267
|
+
*/
|
|
268
|
+
interface Scripts {
|
|
269
|
+
/**
|
|
270
|
+
* Maximum number of headless project script commands Pragma runs at once. Interactive run scripts create terminal tabs and are not limited by this value.
|
|
271
|
+
*/
|
|
272
|
+
maxConcurrentCommands: number;
|
|
273
|
+
/**
|
|
274
|
+
* Project-root-relative POSIX path of the optional project script config file. Read by the Rust backend and matched against worktree file-watch events by the frontend to hot-reload script buttons.
|
|
275
|
+
*/
|
|
276
|
+
configPath: string;
|
|
277
|
+
/**
|
|
278
|
+
* Other agent orchestrators whose checked-in lifecycle-script config Pragma can import into `.pragma/scripts.json`. Order is the detection priority: when a project carries more than one, the first match wins.
|
|
279
|
+
*/
|
|
280
|
+
migrationSources: ScriptMigrationSource[];
|
|
281
|
+
/**
|
|
282
|
+
* Conventional-commit subject for the generated `.pragma/scripts.json` commit, written when the import prompt's commit toggle is on. The commit carries no trailers: the user is its sole author.
|
|
283
|
+
*/
|
|
284
|
+
migrationCommitMessage: string;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* One importable foreign script config: its identifier, display name, and the project-root-relative paths that identify it.
|
|
288
|
+
*
|
|
289
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
290
|
+
* via the `definition` "ScriptMigrationSource".
|
|
291
|
+
*/
|
|
292
|
+
interface ScriptMigrationSource {
|
|
293
|
+
/**
|
|
294
|
+
* Stable identifier the frontend sends back over IPC to import this source. Never a display string.
|
|
295
|
+
*/
|
|
296
|
+
id: string;
|
|
297
|
+
/**
|
|
298
|
+
* Tool name shown in the import prompt.
|
|
299
|
+
*/
|
|
300
|
+
label: string;
|
|
301
|
+
/**
|
|
302
|
+
* Project-root-relative POSIX paths this tool stores its lifecycle scripts in, in probe order.
|
|
303
|
+
*
|
|
304
|
+
* @minItems 1
|
|
305
|
+
*/
|
|
306
|
+
configPaths: [string, ...string[]];
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Shared agent-launch timing used by both the frontend's terminal-write scheduling and the Rust CLI/broker launch path.
|
|
310
|
+
*
|
|
311
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
312
|
+
* via the `definition` "Agents".
|
|
313
|
+
*/
|
|
314
|
+
interface Agents {
|
|
315
|
+
/**
|
|
316
|
+
* Delay before writing an agent's start command to a freshly spawned PTY, giving the shell time to become ready. There is no readiness signal from the PTY, so this is a best-effort fixed delay.
|
|
317
|
+
*/
|
|
318
|
+
startDelayMs: number;
|
|
319
|
+
/**
|
|
320
|
+
* Maximum extra wait for a bracketed-prefill agent to enter its alternate screen before the prompt is sent anyway.
|
|
321
|
+
*/
|
|
322
|
+
altScreenExtraWaitMs: number;
|
|
323
|
+
/**
|
|
324
|
+
* Delay after a late alternate-screen entry before sending the prompt, allowing the TUI input widget to mount.
|
|
325
|
+
*/
|
|
326
|
+
altScreenSettleMs: number;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Per-operating-system launch defaults shared by the Rust session layer and the TypeScript settings UI. Values here are defaults only: a project may override them in its `.pragma/config.json`.
|
|
330
|
+
*
|
|
331
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
332
|
+
* via the `definition` "Platform".
|
|
333
|
+
*/
|
|
334
|
+
interface Platform {
|
|
335
|
+
shells: DefaultShells;
|
|
336
|
+
wsl: Wsl;
|
|
337
|
+
defaultBackend: TerminalBackend;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Fallback shell used when the environment names none. On macOS and Linux the `SHELL` environment variable wins when it is set; Windows has no such convention, so the candidate list is probed in order instead.
|
|
341
|
+
*
|
|
342
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
343
|
+
* via the `definition` "DefaultShells".
|
|
344
|
+
*/
|
|
345
|
+
interface DefaultShells {
|
|
346
|
+
/**
|
|
347
|
+
* Shell launched on macOS when `SHELL` is unset.
|
|
348
|
+
*/
|
|
349
|
+
macos: string;
|
|
350
|
+
/**
|
|
351
|
+
* Shell launched on Linux when `SHELL` is unset.
|
|
352
|
+
*/
|
|
353
|
+
linux: string;
|
|
354
|
+
/**
|
|
355
|
+
* Windows shell candidates, probed in order and resolved against `PATH`. PowerShell 7+ (`pwsh.exe`) is preferred over the in-box Windows PowerShell (`powershell.exe`) because it ships the modern ConPTY behaviour; the last entry must be a shell that is present on every Windows install so resolution cannot fail.
|
|
356
|
+
*
|
|
357
|
+
* @minItems 1
|
|
358
|
+
*/
|
|
359
|
+
windows: [string, ...string[]];
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* How the Windows client reaches a Linux `pragma-server` running inside a WSL distribution. The Windows side never translates `\\wsl$\` paths: the Linux server owns its own filesystem world and is addressed exactly like a remote host.
|
|
363
|
+
*
|
|
364
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
365
|
+
* via the `definition` "Wsl".
|
|
366
|
+
*/
|
|
367
|
+
interface Wsl {
|
|
368
|
+
/**
|
|
369
|
+
* Executable used to run a command inside a WSL distribution.
|
|
370
|
+
*/
|
|
371
|
+
launcher: string;
|
|
372
|
+
/**
|
|
373
|
+
* Arguments that list installed distributions with their state and WSL version. The output is UTF-16LE encoded, which the parser has to decode before splitting.
|
|
374
|
+
*/
|
|
375
|
+
listArgs: string[];
|
|
376
|
+
/**
|
|
377
|
+
* Name of the Linux `pragma-server` executable expected on the distribution's PATH, or installed by Pragma into the distribution when it is missing.
|
|
378
|
+
*/
|
|
379
|
+
serverBinary: string;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Contract between the Pragma app and the detached PTY daemon.
|
|
383
|
+
*
|
|
384
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
385
|
+
* via the `definition` "Daemon".
|
|
386
|
+
*/
|
|
387
|
+
interface Daemon {
|
|
388
|
+
/**
|
|
389
|
+
* Internal daemon wire-protocol SemVer, spoken on Hello, `gateway.json` and `/v1/health`. Mirrored from crates/pragma-protocol's package version by `bun run generate`; do not edit by hand. Comparison is exact equality, and that is load-bearing: every peer here ships in one bundle, so a version that no longer matches is a stale process to evict, not a peer to negotiate with. Remote clients use `gateway.apiVersion` instead.
|
|
390
|
+
*/
|
|
391
|
+
protocolVersion: string;
|
|
392
|
+
/**
|
|
393
|
+
* File name of the server's local IPC endpoint inside the server directory. A Unix-domain socket on every supported platform: macOS and Linux use the kernel's AF_UNIX, Windows uses the AF_UNIX support present since Windows 10 build 17063. The server binds it and every native client connects to it, so the name must never be spelled out by hand on either side of the language boundary.
|
|
394
|
+
*/
|
|
395
|
+
socketFile: string;
|
|
396
|
+
/**
|
|
397
|
+
* File name of the startup lock the server holds inside the server directory, used to keep a second server from binding over a live one.
|
|
398
|
+
*/
|
|
399
|
+
lockFile: string;
|
|
400
|
+
/**
|
|
401
|
+
* File name the detached server writes its stdout and stderr to inside the server directory.
|
|
402
|
+
*/
|
|
403
|
+
logFile: string;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Local HTTP gateway discovery and authentication constants shared by Rust gateway code and TypeScript clients.
|
|
407
|
+
*
|
|
408
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
409
|
+
* via the `definition` "Gateway".
|
|
410
|
+
*/
|
|
411
|
+
interface Gateway {
|
|
412
|
+
/**
|
|
413
|
+
* SemVer of the client-facing gateway HTTP contract, advertised in the pairing payload so a remote client can reject an incompatible host before it stores a connection. Deliberately NOT `daemon.protocolVersion`: that one is the internal daemon frame protocol and is bumped by every desktop release, whereas Pragma Go and the web build embed their copy of this value at build time and ship on their own cadence. Comparison is exact equality, so bump this only on a breaking change to the `/v1` API, and only in the same release as a client build that embeds the new value — a client that never launches cannot be updated first.
|
|
414
|
+
*/
|
|
415
|
+
apiVersion: string;
|
|
416
|
+
/**
|
|
417
|
+
* Filename written beside daemon.sock with gateway port, token, pid, and protocol version.
|
|
418
|
+
*/
|
|
419
|
+
discoveryFile: string;
|
|
420
|
+
/**
|
|
421
|
+
* Filename written beside daemon.sock holding the persistent 0600 bearer token, so the token survives gateway restarts and stays stable across paired devices until explicitly regenerated.
|
|
422
|
+
*/
|
|
423
|
+
tokenFile: string;
|
|
424
|
+
/**
|
|
425
|
+
* Filename written beside daemon.sock holding devices that successfully authenticated with the gateway.
|
|
426
|
+
*/
|
|
427
|
+
devicesFile: string;
|
|
428
|
+
/**
|
|
429
|
+
* HTTP authorization header name used for bearer-token authentication.
|
|
430
|
+
*/
|
|
431
|
+
tokenHeader: string;
|
|
432
|
+
/**
|
|
433
|
+
* HTTP headers carrying installation-scoped mobile device metadata.
|
|
434
|
+
*/
|
|
435
|
+
deviceHeaders: {
|
|
436
|
+
id: string;
|
|
437
|
+
name: string;
|
|
438
|
+
platform: string;
|
|
439
|
+
appVersion: string;
|
|
440
|
+
};
|
|
441
|
+
push: GatewayPush;
|
|
442
|
+
web: GatewayWeb;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Expo push delivery constants. The gateway watches the agent status stream and pushes to every registered phone; the mobile app registers its Expo token through `/v1/push/tokens`.
|
|
446
|
+
*
|
|
447
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
448
|
+
* via the `definition` "GatewayPush".
|
|
449
|
+
*/
|
|
450
|
+
interface GatewayPush {
|
|
451
|
+
/**
|
|
452
|
+
* Expo push service endpoint the gateway POSTs batches of messages to.
|
|
453
|
+
*/
|
|
454
|
+
sendUrl: string;
|
|
455
|
+
/**
|
|
456
|
+
* Largest number of messages sent in one request; Expo documents 100 per call.
|
|
457
|
+
*/
|
|
458
|
+
batchSize: number;
|
|
459
|
+
/**
|
|
460
|
+
* How long a desktop presence heartbeat counts as current. While a heartbeat says the desktop is focused, phone pushes are suppressed — the user is already looking at the alert. A desktop that dies without blurring stops suppressing after this window.
|
|
461
|
+
*/
|
|
462
|
+
presenceTtlMs: number;
|
|
463
|
+
/**
|
|
464
|
+
* Accepted Expo push token prefixes. A token that matches none is rejected at registration rather than failing later inside Expo.
|
|
465
|
+
*/
|
|
466
|
+
tokenPrefixes: string[];
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Where the gateway serves the Pragma Go web bundle from, and how that bundle is staged. Shared so the Expo export, the staging script, the Rust static-file routes, and the desktop's shareable link all agree on one path.
|
|
470
|
+
*
|
|
471
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
472
|
+
* via the `definition` "GatewayWeb".
|
|
473
|
+
*/
|
|
474
|
+
interface GatewayWeb {
|
|
475
|
+
/**
|
|
476
|
+
* Default access state for the public Pragma Go browser bundle. Users override it with gateway.webEnabled in the global config file.
|
|
477
|
+
*/
|
|
478
|
+
enabled: boolean;
|
|
479
|
+
/**
|
|
480
|
+
* URL prefix the exported web bundle is deployed and served under. Passed to Expo as `EXPO_BASE_URL` at time so the asset URLs baked into `index.html` match the routes the gateway answers.
|
|
481
|
+
*/
|
|
482
|
+
basePath: string;
|
|
483
|
+
/**
|
|
484
|
+
* Filename inside the staged bundle listing every servable asset with its URL path, content type, and encoding. The gateway serves only what this manifest names, so a request path is looked up as a map key and never joined onto a filesystem path.
|
|
485
|
+
*/
|
|
486
|
+
manifestFile: string;
|
|
487
|
+
/**
|
|
488
|
+
* Directory name under the desktop app's Tauri resources holding the staged bundle.
|
|
489
|
+
*/
|
|
490
|
+
resourceDir: string;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Shared schema source of truth for the host-server RPC and subscription protocol. The frame codec itself lives in `pragma-protocol`; these values name the cross-language methods, events, and errors.
|
|
494
|
+
*
|
|
495
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
496
|
+
* via the `definition` "Protocol".
|
|
497
|
+
*/
|
|
498
|
+
interface Protocol {
|
|
499
|
+
rpcMethods: ProtocolRpcMethod[];
|
|
500
|
+
events: ProtocolEventKind[];
|
|
501
|
+
errors: ProtocolErrorCode[];
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* GitHub integration contract: the secret-free OAuth Device Flow client id, scopes, and the endpoint URLs shared by the Rust backend (device flow + token exchange) and the frontend Octokit client.
|
|
505
|
+
*
|
|
506
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
507
|
+
* via the `definition` "GitHub".
|
|
508
|
+
*/
|
|
509
|
+
interface GitHub {
|
|
510
|
+
/**
|
|
511
|
+
* Client id of the registered Pragma GitHub OAuth App (device flow enabled). No client secret — a distributed desktop app can't keep one secret.
|
|
512
|
+
*/
|
|
513
|
+
oauthClientId: string;
|
|
514
|
+
/**
|
|
515
|
+
* OAuth scopes requested during the device flow (e.g. `repo`).
|
|
516
|
+
*/
|
|
517
|
+
scopes: string[];
|
|
518
|
+
/**
|
|
519
|
+
* Endpoint that issues a device + user code (`POST https://github.com/login/device/code`).
|
|
520
|
+
*/
|
|
521
|
+
deviceCodeUrl: string;
|
|
522
|
+
/**
|
|
523
|
+
* Page the user opens to enter the user code (`https://github.com/login/device`).
|
|
524
|
+
*/
|
|
525
|
+
deviceVerifyUrl: string;
|
|
526
|
+
/**
|
|
527
|
+
* Endpoint polled to exchange an authorized device code for an access token.
|
|
528
|
+
*/
|
|
529
|
+
accessTokenUrl: string;
|
|
530
|
+
/**
|
|
531
|
+
* Base URL for the GitHub REST/GraphQL API (Octokit `baseUrl`).
|
|
532
|
+
*/
|
|
533
|
+
apiBaseUrl: string;
|
|
534
|
+
/**
|
|
535
|
+
* Pragma's public GitHub home page, linked from the pull-request signature footer.
|
|
536
|
+
*/
|
|
537
|
+
homepageUrl: string;
|
|
538
|
+
prSignature: PrSignature;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* The "Created with Pragma" footer appended to pull requests Pragma opens. The markers delimit the block so Pragma can strip it again when it renders a PR body, and so a body written by an older Pragma is still recognised.
|
|
542
|
+
*
|
|
543
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
544
|
+
* via the `definition` "PrSignature".
|
|
545
|
+
*/
|
|
546
|
+
interface PrSignature {
|
|
547
|
+
/**
|
|
548
|
+
* Whether the footer is appended when the user has not configured `github.prSignature`.
|
|
549
|
+
*/
|
|
550
|
+
enabled: boolean;
|
|
551
|
+
/**
|
|
552
|
+
* HTML comment opening the footer block. Everything from here to `endMarker` is Pragma-owned and is stripped before the body is shown in Pragma.
|
|
553
|
+
*/
|
|
554
|
+
startMarker: string;
|
|
555
|
+
/**
|
|
556
|
+
* HTML comment closing the footer block.
|
|
557
|
+
*/
|
|
558
|
+
endMarker: string;
|
|
559
|
+
/**
|
|
560
|
+
* Text of the small "Open worktree" link rendered under the footer heading.
|
|
561
|
+
*/
|
|
562
|
+
linkLabel: string;
|
|
563
|
+
/**
|
|
564
|
+
* Web redirector the badge links to, which forwards its query string to the `pragma://open` deep link. GitHub's markdown sanitizer keeps only `http`/`https`/`mailto` hrefs, so a `pragma://` URL would render as inert text.
|
|
565
|
+
*/
|
|
566
|
+
openUrl: string;
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Plugin-system constants shared by the Rust config reader and the TypeScript loader.
|
|
570
|
+
*
|
|
571
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
572
|
+
* via the `definition` "Plugins".
|
|
573
|
+
*/
|
|
574
|
+
interface Plugins {
|
|
575
|
+
/**
|
|
576
|
+
* Relative path of the Pragma config file that declares plugin entries. Resolved against the home directory for global plugins and against the project root for project plugins.
|
|
577
|
+
*/
|
|
578
|
+
configFileName: string;
|
|
579
|
+
/**
|
|
580
|
+
* Plugin storage scopes supported by the host runtime. v1 persists global plugin key/value state; project scope is reserved for project-addressed plugin config/storage layers.
|
|
581
|
+
*/
|
|
582
|
+
storageScopes: ("global" | "project")[];
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Optional color-theme override file read by the desktop app. Shared so the Rust reader/writer and the TypeScript theme runtime agree on the file location and the color-scheme blocks it may declare.
|
|
586
|
+
*
|
|
587
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
588
|
+
* via the `definition` "Theme".
|
|
589
|
+
*/
|
|
590
|
+
interface Theme {
|
|
591
|
+
/**
|
|
592
|
+
* Relative path of the optional theme file. Resolved against the home directory for the global theme and against the project root for a project theme — the same layout rule as `plugins.configFileName`. Both files are optional; the app merges built-in defaults <- global <- project per token.
|
|
593
|
+
*/
|
|
594
|
+
fileName: string;
|
|
595
|
+
/**
|
|
596
|
+
* Color-scheme blocks a theme file may declare under `colors`. Each maps to the matching CSS variable block in the app stylesheet (`:root` for light, `.dark` for dark).
|
|
597
|
+
*/
|
|
598
|
+
modes: ("light" | "dark")[];
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Defaults for the remote-access tunnel that exposes the local HTTP gateway to a paired mobile device. A user overrides these per-install via the `tunnel` key in `~/.pragma/config.json`. Shared so the Rust tunnel supervisor and any TypeScript config UI agree on the shipped defaults.
|
|
602
|
+
*
|
|
603
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
604
|
+
* via the `definition` "Tunnel".
|
|
605
|
+
*/
|
|
606
|
+
interface Tunnel {
|
|
607
|
+
/**
|
|
608
|
+
* Default tunnel command template. `{port}` is the only substitution and is replaced with the live gateway port. Ships targeting ngrok's JSON log output.
|
|
609
|
+
*/
|
|
610
|
+
defaultCommand: string;
|
|
611
|
+
/**
|
|
612
|
+
* Default regular expression whose first capture group is the public tunnel URL, matched against both stdout and stderr lines. Covers ngrok's JSON `"url":"https://…"` log and plain `https://…` URLs (e.g. cloudflared).
|
|
613
|
+
*/
|
|
614
|
+
defaultUrlPattern: string;
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Location of the editable keybindings file. Resolved against the home directory for global bindings and against the project root for project bindings, so Rust and the Settings UI agree on one path.
|
|
618
|
+
*
|
|
619
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
620
|
+
* via the `definition` "KeybindingsFiles".
|
|
621
|
+
*/
|
|
622
|
+
interface KeybindingsFiles {
|
|
623
|
+
/**
|
|
624
|
+
* Relative path of the keybindings file (e.g. `.pragma/keybindings.json`). A project file only needs the actions it overrides; missing actions fall back to the global file, then to the built-in defaults.
|
|
625
|
+
*/
|
|
626
|
+
configFileName: string;
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* Shipped defaults and limits for agent alert notifications and sounds. A user overrides these per install/project via the `agentStatus` key of `.pragma/config.json`.
|
|
630
|
+
*
|
|
631
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
632
|
+
* via the `definition` "AgentStatusDefaults".
|
|
633
|
+
*/
|
|
634
|
+
interface AgentStatusDefaults {
|
|
635
|
+
/**
|
|
636
|
+
* Relative directory scanned for alert sounds. Resolved against the home directory for global sounds and against the project root for project sounds.
|
|
637
|
+
*/
|
|
638
|
+
soundsDirName: string;
|
|
639
|
+
/**
|
|
640
|
+
* Longest allowed alert clip. Longer uploads are rejected rather than truncated.
|
|
641
|
+
*/
|
|
642
|
+
maxSoundSeconds: number;
|
|
643
|
+
/**
|
|
644
|
+
* Largest allowed alert clip in bytes, bounding what crosses IPC when a clip is imported or played.
|
|
645
|
+
*/
|
|
646
|
+
maxSoundBytes: number;
|
|
647
|
+
/**
|
|
648
|
+
* Lower-case file extensions (no dot) treated as alert sounds when listing the sounds directory.
|
|
649
|
+
*/
|
|
650
|
+
soundExtensions: string[];
|
|
651
|
+
/**
|
|
652
|
+
* Whether platform notifications fire for agent alerts when the user has not configured `agentStatus.notificationsEnabled`.
|
|
653
|
+
*/
|
|
654
|
+
notificationsEnabled: boolean;
|
|
655
|
+
notificationText: AgentNotificationText;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Templates for the text of an agent alert. Rendered identically by the desktop toast, the desktop platform notification, and the Expo push the gateway sends to a paired phone, so all three read the same. `{agent}`, `{project}`, `{worktree}`, and `{tab}` are substituted; no other placeholder is recognised.
|
|
659
|
+
*
|
|
660
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
661
|
+
* via the `definition` "AgentNotificationText".
|
|
662
|
+
*/
|
|
663
|
+
interface AgentNotificationText {
|
|
664
|
+
/**
|
|
665
|
+
* Title when the agent finished its turn. Takes `{agent}`.
|
|
666
|
+
*/
|
|
667
|
+
doneTitle: string;
|
|
668
|
+
/**
|
|
669
|
+
* Title when the agent needs attention for an unclassified reason. Takes `{agent}`.
|
|
670
|
+
*/
|
|
671
|
+
attentionTitle: string;
|
|
672
|
+
/**
|
|
673
|
+
* Title when the agent is waiting for an answer. Takes `{agent}`.
|
|
674
|
+
*/
|
|
675
|
+
questionTitle: string;
|
|
676
|
+
/**
|
|
677
|
+
* Title when the agent is asking to run a command. Takes `{agent}`.
|
|
678
|
+
*/
|
|
679
|
+
commandTitle: string;
|
|
680
|
+
/**
|
|
681
|
+
* Joins the project and worktree names in the body line.
|
|
682
|
+
*/
|
|
683
|
+
locationSeparator: string;
|
|
684
|
+
/**
|
|
685
|
+
* Appended to the body when the reporting tab has a name of its own. Takes `{tab}`.
|
|
686
|
+
*/
|
|
687
|
+
tabSuffix: string;
|
|
688
|
+
/**
|
|
689
|
+
* Body used when neither the project nor the worktree could be resolved — a report can arrive for a worktree the client has not loaded yet.
|
|
690
|
+
*/
|
|
691
|
+
unknownLocation: string;
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Shipped defaults for terminal launching. A user overrides these per install/project via the `terminal` key of `.pragma/config.json` (`TerminalSettings`).
|
|
695
|
+
*
|
|
696
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
697
|
+
* via the `definition` "TerminalDefaults".
|
|
698
|
+
*/
|
|
699
|
+
interface TerminalDefaults {
|
|
700
|
+
/**
|
|
701
|
+
* WSL distribution names hidden from the shell picker by default because they back other tools rather than interactive shells (Docker Desktop's VM distros).
|
|
702
|
+
*/
|
|
703
|
+
hiddenDistros: string[];
|
|
704
|
+
/**
|
|
705
|
+
* Whether a plain new tab defaults to the shell profile most recently picked for that project instead of the configured default terminal.
|
|
706
|
+
*/
|
|
707
|
+
rememberLastShell: boolean;
|
|
708
|
+
/**
|
|
709
|
+
* Largest file (typically an image) that may be dropped onto a terminal. The bytes are copied to the host that runs the PTY in one `filesystem` RPC, so this plus its base64 expansion must stay inside the protocol's frame limit.
|
|
710
|
+
*/
|
|
711
|
+
maxDroppedFileBytes: number;
|
|
712
|
+
/**
|
|
713
|
+
* Directory under the host's temporary directory that holds copies of files dropped onto a terminal, whose absolute paths are pasted into the PTY.
|
|
714
|
+
*/
|
|
715
|
+
droppedFilesDirName: string;
|
|
716
|
+
/**
|
|
717
|
+
* How long a per-drop directory under `droppedFilesDirName` may sit on disk before a sweep deletes it. The host sweeps once at startup and on a fixed interval after that (`DROPPED_FILES_SWEEP_INTERVAL` in `pragma-server`), so a drop is retained for at most this age plus one sweep interval.
|
|
718
|
+
*/
|
|
719
|
+
droppedFilesMaxAgeMs: number;
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Shipped tab defaults shared by the desktop app and any host that has to reason about a tab's name.
|
|
723
|
+
*
|
|
724
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
725
|
+
* via the `definition` "TabDefaults".
|
|
726
|
+
*/
|
|
727
|
+
interface TabDefaults {
|
|
728
|
+
/**
|
|
729
|
+
* Fallback title per tab kind, used for a tab whose shell or page has not named itself. A tab still carrying its default title has no name worth showing in a notification, so both languages compare against these.
|
|
730
|
+
*/
|
|
731
|
+
defaultTitles: {
|
|
732
|
+
fallback: string;
|
|
733
|
+
browser: string;
|
|
734
|
+
log: string;
|
|
735
|
+
scratchpad: string;
|
|
736
|
+
whiteboard: string;
|
|
737
|
+
prReview: string;
|
|
738
|
+
pluginWebview: string;
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Names the terminal benchmark (`@pragma-sh/bench`) and the desktop app agree on. The app installs the hook global in dev builds only; the benchmark's injected runner reads it back by the same name.
|
|
743
|
+
*
|
|
744
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
745
|
+
* via the `definition` "Bench".
|
|
746
|
+
*/
|
|
747
|
+
interface Bench {
|
|
748
|
+
/**
|
|
749
|
+
* `window` property under which a dev build exposes read-only access to its live xterm instances. Absent in production builds.
|
|
750
|
+
*/
|
|
751
|
+
hookGlobal: string;
|
|
752
|
+
/**
|
|
753
|
+
* `window` property the benchmark installs its own injected scenario runner under. Owned by the benchmark, never by the app.
|
|
754
|
+
*/
|
|
755
|
+
runnerGlobal: string;
|
|
756
|
+
/**
|
|
757
|
+
* Leading token of the status line the `pragma-bench tui` payload paints on its first row. The runner scans painted frames for it to learn which input the terminal has finished rendering.
|
|
758
|
+
*/
|
|
759
|
+
markerPrefix: string;
|
|
760
|
+
/**
|
|
761
|
+
* Title given to the terminal tab the benchmark opens, so a run is identifiable in the UI and reclaimable after a crash.
|
|
762
|
+
*/
|
|
763
|
+
tabTitle: string;
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Limits for reading a binary file in chunks over the `filesystem` RPC. A single chunk plus its base64 expansion must stay well inside the protocol's frame limit, so the host rejects any request for more than `chunkBytes` at once and the frontend loops until the whole file is read.
|
|
767
|
+
*
|
|
768
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
769
|
+
* via the `definition` "FileReadLimits".
|
|
770
|
+
*/
|
|
771
|
+
interface FileReadLimits {
|
|
772
|
+
/**
|
|
773
|
+
* Largest number of raw bytes one `readBytesRange` request may return. Base64 inflates this by 4/3 on the wire.
|
|
774
|
+
*/
|
|
775
|
+
chunkBytes: number;
|
|
776
|
+
/**
|
|
777
|
+
* Largest binary file a viewer will assemble in memory from chunks. Bigger files are refused with a message instead of exhausting the webview's heap.
|
|
778
|
+
*/
|
|
779
|
+
maxBinaryBytes: number;
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Managed scratchpad file contract shared by the CLI, desktop host, and editor.
|
|
783
|
+
*
|
|
784
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
785
|
+
* via the `definition` "Scratchpads".
|
|
786
|
+
*/
|
|
787
|
+
interface Scratchpads {
|
|
788
|
+
directory: string;
|
|
789
|
+
extension: string;
|
|
790
|
+
frontmatterKey: string;
|
|
791
|
+
version: number;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Host persistence and validation limits for worktree-scoped whiteboards.
|
|
795
|
+
*
|
|
796
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
797
|
+
* via the `definition` "WhiteboardDefaults".
|
|
798
|
+
*/
|
|
799
|
+
interface WhiteboardDefaults {
|
|
800
|
+
databaseFile: string;
|
|
801
|
+
defaultTitle: string;
|
|
802
|
+
maxTitleChars: number;
|
|
803
|
+
maxSceneBytes: number;
|
|
804
|
+
maxRenderDimension: number;
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Shipped defaults for fanout orchestration: the host state file, attempt branch naming, the member floor, and follow-up delivery timeouts. Both `pragma-server` and the desktop read these instead of hard-coding either side.
|
|
808
|
+
*
|
|
809
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
810
|
+
* via the `definition` "FanoutDefaults".
|
|
811
|
+
*/
|
|
812
|
+
interface FanoutDefaults {
|
|
813
|
+
/**
|
|
814
|
+
* Owner-only durable fanout record, written beside the server socket.
|
|
815
|
+
*/
|
|
816
|
+
stateFile: string;
|
|
817
|
+
/**
|
|
818
|
+
* Leading segment of every generated attempt branch (`<prefix>/<fanout>/<member>`).
|
|
819
|
+
*/
|
|
820
|
+
branchPrefix: string;
|
|
821
|
+
/**
|
|
822
|
+
* Fewest attempts a fanout may have. A single attempt is an ordinary agent launch.
|
|
823
|
+
*/
|
|
824
|
+
minMembers: number;
|
|
825
|
+
/**
|
|
826
|
+
* Default bound on concurrently launching attempts.
|
|
827
|
+
*/
|
|
828
|
+
defaultJobs: number;
|
|
829
|
+
/**
|
|
830
|
+
* How long a waiting follow-up send waits for each member's delivery receipt.
|
|
831
|
+
*/
|
|
832
|
+
deliveryTimeoutMs: number;
|
|
833
|
+
/**
|
|
834
|
+
* Environment variable exported into every attempt session with the owning fanout id.
|
|
835
|
+
*/
|
|
836
|
+
envFanoutId: string;
|
|
837
|
+
/**
|
|
838
|
+
* Environment variable exported into every attempt session with its member id.
|
|
839
|
+
*/
|
|
840
|
+
envMemberId: string;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Shipped defaults for desktop auto-updates. User overrides live in global `.pragma/config.json` under `updates`.
|
|
844
|
+
*
|
|
845
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
846
|
+
* via the `definition` "Updates".
|
|
847
|
+
*/
|
|
848
|
+
interface Updates {
|
|
849
|
+
/**
|
|
850
|
+
* Production Next.js check endpoint. Dev builds use `devCheckUrl` unless user overrides `other.serverUrl`.
|
|
851
|
+
*/
|
|
852
|
+
checkUrl: string;
|
|
853
|
+
/**
|
|
854
|
+
* Check endpoint used by `pragma-dev-*` builds so they never poll production.
|
|
855
|
+
*/
|
|
856
|
+
devCheckUrl: string;
|
|
857
|
+
/**
|
|
858
|
+
* How often a production (or opted-in) session re-checks for an update.
|
|
859
|
+
*/
|
|
860
|
+
pollIntervalMs: number;
|
|
861
|
+
/**
|
|
862
|
+
* Default for whether the desktop polls on launch and on an interval.
|
|
863
|
+
*/
|
|
864
|
+
autoDownload: boolean;
|
|
865
|
+
/**
|
|
866
|
+
* GitHub Release asset name for the per-release manifest.
|
|
867
|
+
*/
|
|
868
|
+
manifestFile: string;
|
|
869
|
+
/**
|
|
870
|
+
* Directory name under the instance data dir that holds the optional UI overlay (`<data>/<uiDirName>/<version>/`).
|
|
871
|
+
*/
|
|
872
|
+
uiDirName: string;
|
|
873
|
+
/**
|
|
874
|
+
* Sidebar button that applies a downloaded (or on-click) update.
|
|
875
|
+
*/
|
|
876
|
+
buttonLabel: string;
|
|
877
|
+
/**
|
|
878
|
+
* Link label for the GitHub Release notes URL.
|
|
879
|
+
*/
|
|
880
|
+
changelogLabel: string;
|
|
881
|
+
/**
|
|
882
|
+
* Modal title shown before a restart (installer) update.
|
|
883
|
+
*/
|
|
884
|
+
restartWarningTitle: string;
|
|
885
|
+
/**
|
|
886
|
+
* Modal body warning that the app server restarts and terminals stop.
|
|
887
|
+
*/
|
|
888
|
+
restartWarningBody: string;
|
|
889
|
+
/**
|
|
890
|
+
* Supported apply modes, in display order.
|
|
891
|
+
*
|
|
892
|
+
* @minItems 2
|
|
893
|
+
*/
|
|
894
|
+
applyModes: [UpdateApplyMode, UpdateApplyMode, ...UpdateApplyMode[]];
|
|
895
|
+
/**
|
|
896
|
+
* Installer platform ids the check API accepts.
|
|
897
|
+
*
|
|
898
|
+
* @minItems 1
|
|
899
|
+
*/
|
|
900
|
+
platforms: [UpdatePlatform, ...UpdatePlatform[]];
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Shipped values for the first-run onboarding flow: where its preview videos stream from, and which global skill directories the skills step can install into.
|
|
904
|
+
*
|
|
905
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
906
|
+
* via the `definition` "Onboarding".
|
|
907
|
+
*/
|
|
908
|
+
interface Onboarding {
|
|
909
|
+
/**
|
|
910
|
+
* Base URL the onboarding preview videos are streamed from (the marketing site's `public/media`). Videos are streamed rather than bundled so installers stay small.
|
|
911
|
+
*/
|
|
912
|
+
mediaBaseUrl: string;
|
|
913
|
+
skill: OnboardingSkill;
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* The Pragma skill offered during onboarding and the global directories it can be installed into.
|
|
917
|
+
*
|
|
918
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
919
|
+
* via the `definition` "OnboardingSkill".
|
|
920
|
+
*/
|
|
921
|
+
interface OnboardingSkill {
|
|
922
|
+
/**
|
|
923
|
+
* Directory name the skill is written as, inside each target directory.
|
|
924
|
+
*/
|
|
925
|
+
id: string;
|
|
926
|
+
/**
|
|
927
|
+
* Install destinations offered by the skills step.
|
|
928
|
+
*/
|
|
929
|
+
targets: OnboardingSkillTarget[];
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* One skill install destination. The frontend sends `id` over IPC; the backend resolves `directory` against the home directory.
|
|
933
|
+
*
|
|
934
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
935
|
+
* via the `definition` "OnboardingSkillTarget".
|
|
936
|
+
*/
|
|
937
|
+
interface OnboardingSkillTarget {
|
|
938
|
+
/**
|
|
939
|
+
* Stable identifier sent over IPC.
|
|
940
|
+
*/
|
|
941
|
+
id: string;
|
|
942
|
+
/**
|
|
943
|
+
* Directory holding the skill, relative to the user's home directory.
|
|
944
|
+
*/
|
|
945
|
+
directory: string;
|
|
946
|
+
/**
|
|
947
|
+
* Button label shown in onboarding.
|
|
948
|
+
*/
|
|
949
|
+
label: string;
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* One failure attached to a fanout or a single member.
|
|
953
|
+
*
|
|
954
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
955
|
+
* via the `definition` "FanoutFailure".
|
|
956
|
+
*/
|
|
957
|
+
interface FanoutFailure {
|
|
958
|
+
code: FanoutFailureCode;
|
|
959
|
+
message: string;
|
|
960
|
+
/**
|
|
961
|
+
* Member the failure belongs to, or null for a fanout-wide failure.
|
|
962
|
+
*/
|
|
963
|
+
memberId?: string | null;
|
|
964
|
+
/**
|
|
965
|
+
* Finalize stage the failure happened in, when it happened during a pick.
|
|
966
|
+
*/
|
|
967
|
+
stage?: FanoutFinalizeStage | null;
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* One requested attempt before resolution. `selector` is the raw `agent[.model[.reasoning]]` text a CLI caller typed; a structured caller may instead set the fields directly. Duplicate selectors are valid — sampling one model twice is a supported use.
|
|
971
|
+
*
|
|
972
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
973
|
+
* via the `definition` "FanoutMemberSelector".
|
|
974
|
+
*/
|
|
975
|
+
interface FanoutMemberSelector {
|
|
976
|
+
/**
|
|
977
|
+
* Raw selector text: a catalog agent id optionally followed by `.<modelId>` and `.<reasoningId>`.
|
|
978
|
+
*/
|
|
979
|
+
selector: string;
|
|
980
|
+
/**
|
|
981
|
+
* Explicit model id, overriding anything parsed out of `selector`.
|
|
982
|
+
*/
|
|
983
|
+
modelId?: string | null;
|
|
984
|
+
/**
|
|
985
|
+
* Explicit reasoning id, overriding both `selector` and the request-wide default.
|
|
986
|
+
*/
|
|
987
|
+
reasoningId?: string | null;
|
|
988
|
+
}
|
|
989
|
+
/**
|
|
990
|
+
* One durable fanout attempt: a worktree branched from the fanout's captured base commit, plus the agent-owned terminal tab running in it.
|
|
991
|
+
*
|
|
992
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
993
|
+
* via the `definition` "FanoutMember".
|
|
994
|
+
*/
|
|
995
|
+
interface FanoutMember {
|
|
996
|
+
id: string;
|
|
997
|
+
/**
|
|
998
|
+
* Stable creation order, so the comparison grid column order never shuffles.
|
|
999
|
+
*/
|
|
1000
|
+
ordinal: number;
|
|
1001
|
+
/**
|
|
1002
|
+
* The selector text this member was created from, retained for retry and display.
|
|
1003
|
+
*/
|
|
1004
|
+
selector: string;
|
|
1005
|
+
/**
|
|
1006
|
+
* Fully qualified plugin catalog id (`plugin.agent`) used to resolve launch metadata.
|
|
1007
|
+
*/
|
|
1008
|
+
catalogAgentId: string;
|
|
1009
|
+
/**
|
|
1010
|
+
* Runtime reporter/watcher id the agent event stream is keyed by. Never derive this at a call site — the host resolves it from the plugin's watcher metadata.
|
|
1011
|
+
*/
|
|
1012
|
+
runtimeAgentId: string;
|
|
1013
|
+
modelId: string | null;
|
|
1014
|
+
reasoningId: string | null;
|
|
1015
|
+
branch: string;
|
|
1016
|
+
worktreeId: string | null;
|
|
1017
|
+
tabId: string | null;
|
|
1018
|
+
/**
|
|
1019
|
+
* Tabs this member previously ran in. A retry moves the current tab id here.
|
|
1020
|
+
*/
|
|
1021
|
+
priorTabIds: string[];
|
|
1022
|
+
status: FanoutMemberStatus;
|
|
1023
|
+
failure: FanoutFailure | null;
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* One durable fanout: a single parent worktree, an immutable base commit, one shared prompt, and N isolated attempts. A parent may own at most one fanout that is not in a terminal state.
|
|
1027
|
+
*
|
|
1028
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1029
|
+
* via the `definition` "Fanout".
|
|
1030
|
+
*/
|
|
1031
|
+
interface Fanout {
|
|
1032
|
+
id: string;
|
|
1033
|
+
projectId: string;
|
|
1034
|
+
parentWorktreeId: string;
|
|
1035
|
+
/**
|
|
1036
|
+
* Worktree a newly-created coordination parent was branched from; null when an existing parent was used.
|
|
1037
|
+
*/
|
|
1038
|
+
sourceWorktreeId: string | null;
|
|
1039
|
+
/**
|
|
1040
|
+
* True when this fanout created its own parent worktree.
|
|
1041
|
+
*/
|
|
1042
|
+
ownsParent: boolean;
|
|
1043
|
+
/**
|
|
1044
|
+
* Exact parent HEAD captured at creation. Every attempt branches from it and every comparison diffs against it, even after the parent moves on.
|
|
1045
|
+
*/
|
|
1046
|
+
baseCommit: string;
|
|
1047
|
+
title: string;
|
|
1048
|
+
prompt: string;
|
|
1049
|
+
status: FanoutStatus;
|
|
1050
|
+
winningMemberId: string | null;
|
|
1051
|
+
finalizeStage: FanoutFinalizeStage | null;
|
|
1052
|
+
failure?: FanoutFailure | null;
|
|
1053
|
+
members: FanoutMember[];
|
|
1054
|
+
createdAt: string;
|
|
1055
|
+
updatedAt: string;
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1059
|
+
* via the `definition` "FanoutExistingParent".
|
|
1060
|
+
*/
|
|
1061
|
+
interface FanoutExistingParent {
|
|
1062
|
+
kind: "existing";
|
|
1063
|
+
worktreeId: string;
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1067
|
+
* via the `definition` "FanoutNewParent".
|
|
1068
|
+
*/
|
|
1069
|
+
interface FanoutNewParent {
|
|
1070
|
+
kind: "new";
|
|
1071
|
+
sourceWorktreeId: string;
|
|
1072
|
+
branch: string;
|
|
1073
|
+
title?: string | null;
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1076
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1077
|
+
* via the `definition` "FanoutCreateRequest".
|
|
1078
|
+
*/
|
|
1079
|
+
interface FanoutCreateRequest {
|
|
1080
|
+
projectId: string;
|
|
1081
|
+
parent: FanoutParentSpec;
|
|
1082
|
+
prompt: string;
|
|
1083
|
+
/**
|
|
1084
|
+
* Display title. Derived from the prompt's first line when omitted.
|
|
1085
|
+
*/
|
|
1086
|
+
title?: string | null;
|
|
1087
|
+
/**
|
|
1088
|
+
* Reasoning effort applied to every member that does not name its own.
|
|
1089
|
+
*/
|
|
1090
|
+
defaultReasoningId?: string | null;
|
|
1091
|
+
members: FanoutMemberSelector[];
|
|
1092
|
+
/**
|
|
1093
|
+
* Bound on concurrently launching attempts. Git worktree mutations are serialized regardless.
|
|
1094
|
+
*/
|
|
1095
|
+
jobs?: number | null;
|
|
1096
|
+
/**
|
|
1097
|
+
* Repeating a create with the same key returns the existing fanout instead of provisioning a second one.
|
|
1098
|
+
*/
|
|
1099
|
+
idempotencyKey?: string | null;
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Addresses one fanout by exactly one of its id or any worktree that belongs to it (its parent, or any attempt).
|
|
1103
|
+
*
|
|
1104
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1105
|
+
* via the `definition` "FanoutRef".
|
|
1106
|
+
*/
|
|
1107
|
+
interface FanoutRef {
|
|
1108
|
+
fanoutId?: string | null;
|
|
1109
|
+
worktreeId?: string | null;
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1112
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1113
|
+
* via the `definition` "FanoutReadRequest".
|
|
1114
|
+
*/
|
|
1115
|
+
interface FanoutReadRequest {
|
|
1116
|
+
fanoutId?: string | null;
|
|
1117
|
+
worktreeId?: string | null;
|
|
1118
|
+
memberId?: string | null;
|
|
1119
|
+
all?: boolean | null;
|
|
1120
|
+
lines?: number | null;
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* One member's terminal output. `text` is the escape-stripped rendering; `data` is the same bounded window as base64 raw bytes, which the SDK decodes to a Uint8Array.
|
|
1124
|
+
*
|
|
1125
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1126
|
+
* via the `definition` "FanoutReadTarget".
|
|
1127
|
+
*/
|
|
1128
|
+
interface FanoutReadTarget {
|
|
1129
|
+
memberId: string;
|
|
1130
|
+
worktreeId: string;
|
|
1131
|
+
tabId: string;
|
|
1132
|
+
runtimeAgentId: string;
|
|
1133
|
+
bytes: number;
|
|
1134
|
+
text: string;
|
|
1135
|
+
data: string;
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1139
|
+
* via the `definition` "FanoutReadResult".
|
|
1140
|
+
*/
|
|
1141
|
+
interface FanoutReadResult {
|
|
1142
|
+
fanoutId: string;
|
|
1143
|
+
targets: FanoutReadTarget[];
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Who a follow-up goes to: every live member, or one stable member id.
|
|
1147
|
+
*
|
|
1148
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1149
|
+
* via the `definition` "FanoutSendTarget".
|
|
1150
|
+
*/
|
|
1151
|
+
interface FanoutSendTarget {
|
|
1152
|
+
kind: "all" | "member";
|
|
1153
|
+
memberId?: string | null;
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1157
|
+
* via the `definition` "FanoutSendRequest".
|
|
1158
|
+
*/
|
|
1159
|
+
interface FanoutSendRequest {
|
|
1160
|
+
fanoutId?: string | null;
|
|
1161
|
+
worktreeId?: string | null;
|
|
1162
|
+
target: FanoutSendTarget;
|
|
1163
|
+
message: string;
|
|
1164
|
+
/**
|
|
1165
|
+
* Caller-supplied id making a retry idempotent: a message already delivered under this id is not typed twice.
|
|
1166
|
+
*/
|
|
1167
|
+
messageId?: string | null;
|
|
1168
|
+
/**
|
|
1169
|
+
* Wait for bounded per-member receipts (the default) instead of returning after durable enqueue.
|
|
1170
|
+
*/
|
|
1171
|
+
waitForDelivery?: boolean | null;
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1175
|
+
* via the `definition` "FanoutDeliveryReceipt".
|
|
1176
|
+
*/
|
|
1177
|
+
interface FanoutDeliveryReceipt {
|
|
1178
|
+
memberId: string;
|
|
1179
|
+
worktreeId: string;
|
|
1180
|
+
tabId: string;
|
|
1181
|
+
runtimeAgentId: string;
|
|
1182
|
+
messageId: string;
|
|
1183
|
+
state: FanoutDeliveryState;
|
|
1184
|
+
error?: string | null;
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1188
|
+
* via the `definition` "FanoutSendResult".
|
|
1189
|
+
*/
|
|
1190
|
+
interface FanoutSendResult {
|
|
1191
|
+
fanoutId: string;
|
|
1192
|
+
messageId: string;
|
|
1193
|
+
receipts: FanoutDeliveryReceipt[];
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Addresses one member of one fanout — used by retry and pick.
|
|
1197
|
+
*
|
|
1198
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1199
|
+
* via the `definition` "FanoutMemberRequest".
|
|
1200
|
+
*/
|
|
1201
|
+
interface FanoutMemberRequest {
|
|
1202
|
+
fanoutId?: string | null;
|
|
1203
|
+
worktreeId?: string | null;
|
|
1204
|
+
memberId: string;
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* The durable fanout after a mutation, plus any failures that did not abort it. `partial` is true when at least one member failed while others stayed healthy.
|
|
1208
|
+
*
|
|
1209
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1210
|
+
* via the `definition` "FanoutResult".
|
|
1211
|
+
*/
|
|
1212
|
+
interface FanoutResult {
|
|
1213
|
+
fanout: Fanout;
|
|
1214
|
+
partial: boolean;
|
|
1215
|
+
failures: FanoutFailure[];
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Outcome of the destructive pick transaction. A conflicted or partly-cleaned pick still returns the durable fanout so a caller can resume from `stage`.
|
|
1219
|
+
*
|
|
1220
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1221
|
+
* via the `definition` "FanoutPickResult".
|
|
1222
|
+
*/
|
|
1223
|
+
interface FanoutPickResult {
|
|
1224
|
+
fanout: Fanout;
|
|
1225
|
+
stage: FanoutFinalizeStage;
|
|
1226
|
+
winningMemberId: string;
|
|
1227
|
+
/**
|
|
1228
|
+
* Commit created from the winner's uncommitted changes, when there were any.
|
|
1229
|
+
*/
|
|
1230
|
+
commit?: string | null;
|
|
1231
|
+
/**
|
|
1232
|
+
* Parent-relative paths the winner's scratchpads were promoted to.
|
|
1233
|
+
*/
|
|
1234
|
+
promotedScratchpads: string[];
|
|
1235
|
+
deletedWorktreeIds: string[];
|
|
1236
|
+
/**
|
|
1237
|
+
* Attempt worktrees cleanup could not remove. Non-empty means `cleanupFailed`, never `completed`.
|
|
1238
|
+
*/
|
|
1239
|
+
survivingWorktreeIds: string[];
|
|
1240
|
+
failures: FanoutFailure[];
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Snapshot and delta payload of the `fanouts` subscription. v1 keeps deltas trivial: every delta is a full replacement of the host's fanout set.
|
|
1244
|
+
*
|
|
1245
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1246
|
+
* via the `definition` "FanoutSubscriptionPayload".
|
|
1247
|
+
*/
|
|
1248
|
+
interface FanoutSubscriptionPayload {
|
|
1249
|
+
fanouts: Fanout[];
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* Result of a fetch + ahead/behind comparison against the upstream of a worktree's branch — the create-PR pre-flight.
|
|
1253
|
+
*
|
|
1254
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1255
|
+
* via the `definition` "BranchSyncStatus".
|
|
1256
|
+
*/
|
|
1257
|
+
interface BranchSyncStatus {
|
|
1258
|
+
/**
|
|
1259
|
+
* The worktree's current branch.
|
|
1260
|
+
*/
|
|
1261
|
+
branch: string;
|
|
1262
|
+
/**
|
|
1263
|
+
* Commits the local branch is ahead of its upstream.
|
|
1264
|
+
*/
|
|
1265
|
+
ahead: number;
|
|
1266
|
+
/**
|
|
1267
|
+
* Commits the local branch is behind its upstream. Non-zero blocks PR creation.
|
|
1268
|
+
*/
|
|
1269
|
+
behind: number;
|
|
1270
|
+
/**
|
|
1271
|
+
* True when the branch already tracks a remote upstream; false means it must be pushed first.
|
|
1272
|
+
*/
|
|
1273
|
+
hasUpstream: boolean;
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* One concrete choice of shell world for a terminal session: the resolved form of a `TerminalSettings` default, or the profile a single tab was opened with. Carried on the spawn request so the session layer launches the same shell the picker named, and persisted on the tab so a respawned session keeps it.
|
|
1277
|
+
*
|
|
1278
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1279
|
+
* via the `definition` "ShellProfile".
|
|
1280
|
+
*/
|
|
1281
|
+
interface ShellProfile {
|
|
1282
|
+
backend: TerminalBackend;
|
|
1283
|
+
/**
|
|
1284
|
+
* WSL distribution launched when `backend` is `wsl`. Null uses the distribution WSL itself marks as default. Always null for `native`.
|
|
1285
|
+
*/
|
|
1286
|
+
distro?: string | null;
|
|
1287
|
+
}
|
|
1288
|
+
/**
|
|
1289
|
+
* One selectable reasoning-effort level for an agent model. Promoted from @pragma-sh/plugin so the catalog wire type has one source of truth.
|
|
1290
|
+
*
|
|
1291
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1292
|
+
* via the `definition` "AgentReasoning".
|
|
1293
|
+
*/
|
|
1294
|
+
interface AgentReasoning {
|
|
1295
|
+
id: string;
|
|
1296
|
+
name: string;
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* One selectable model for an agent, with optional reasoning levels.
|
|
1300
|
+
*
|
|
1301
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1302
|
+
* via the `definition` "AgentModelEntry".
|
|
1303
|
+
*/
|
|
1304
|
+
interface AgentModelEntry {
|
|
1305
|
+
id: string;
|
|
1306
|
+
name: string;
|
|
1307
|
+
reasoning?: AgentReasoning[];
|
|
1308
|
+
}
|
|
1309
|
+
/**
|
|
1310
|
+
* Reference to a plugin-contributed agent icon asset, fetched by content hash through the gateway `/v1/assets/{hash}` route.
|
|
1311
|
+
*
|
|
1312
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1313
|
+
* via the `definition` "AgentIcon".
|
|
1314
|
+
*/
|
|
1315
|
+
interface AgentIcon {
|
|
1316
|
+
/**
|
|
1317
|
+
* Lowercase-hex sha256 of the icon bytes; also the ETag and cache key.
|
|
1318
|
+
*/
|
|
1319
|
+
hash: string;
|
|
1320
|
+
/**
|
|
1321
|
+
* Icon MIME type (e.g. `image/svg+xml`).
|
|
1322
|
+
*/
|
|
1323
|
+
mime: string;
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* One launchable agent in the resolved plugin catalog.
|
|
1327
|
+
*
|
|
1328
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1329
|
+
* via the `definition` "CatalogAgent".
|
|
1330
|
+
*/
|
|
1331
|
+
interface CatalogAgent {
|
|
1332
|
+
id: string;
|
|
1333
|
+
name: string;
|
|
1334
|
+
/**
|
|
1335
|
+
* Id of the plugin that contributed this agent.
|
|
1336
|
+
*/
|
|
1337
|
+
pluginId: string;
|
|
1338
|
+
/**
|
|
1339
|
+
* Where the contributing plugin was resolved from. A `project` agent belongs to exactly one project root and must not be offered to another one.
|
|
1340
|
+
*/
|
|
1341
|
+
scope?: "global" | "project" | null;
|
|
1342
|
+
/**
|
|
1343
|
+
* Absolute root the contributing plugin was resolved from: the project root for `project` scope or the home directory for `global`.
|
|
1344
|
+
*/
|
|
1345
|
+
root?: string | null;
|
|
1346
|
+
/**
|
|
1347
|
+
* Runtime reporter/watcher id the agent event stream is keyed by, when the plugin declares a watcher. Callers must use this rather than re-deriving an id from the dotted catalog id.
|
|
1348
|
+
*/
|
|
1349
|
+
runtimeAgentId?: string | null;
|
|
1350
|
+
icon?: AgentIcon | null;
|
|
1351
|
+
models: AgentModelEntry[];
|
|
1352
|
+
/**
|
|
1353
|
+
* Capabilities the agent declares unsupported; agent verification skips matching scenarios.
|
|
1354
|
+
*/
|
|
1355
|
+
excludeFeatures?: AgentFeature[];
|
|
1356
|
+
launch: AgentLaunchConfig;
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* Resolved launch commands and terminal-input behavior needed by the persistent host to start an agent without a desktop webview.
|
|
1360
|
+
*
|
|
1361
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1362
|
+
* via the `definition` "AgentLaunchConfig".
|
|
1363
|
+
*/
|
|
1364
|
+
interface AgentLaunchConfig {
|
|
1365
|
+
commands: AgentLaunchCommand[];
|
|
1366
|
+
startupInput?: AgentStartupInput[];
|
|
1367
|
+
prefillDelayMs?: number;
|
|
1368
|
+
prefillMode?: "bracketed" | "plain";
|
|
1369
|
+
prefillSubmit?: string;
|
|
1370
|
+
prefillSubmitDelayMs?: number;
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1374
|
+
* via the `definition` "AgentLaunchCommand".
|
|
1375
|
+
*/
|
|
1376
|
+
interface AgentLaunchCommand {
|
|
1377
|
+
modelId: string | null;
|
|
1378
|
+
reasoningId: string | null;
|
|
1379
|
+
command: string[];
|
|
1380
|
+
}
|
|
1381
|
+
/**
|
|
1382
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1383
|
+
* via the `definition` "AgentStartupInput".
|
|
1384
|
+
*/
|
|
1385
|
+
interface AgentStartupInput {
|
|
1386
|
+
delayMs: number;
|
|
1387
|
+
data: string;
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* The resolved set of launchable agents contributed by all loaded plugins, assembled by the pragma-plugins sidecar and cached by pragma-server.
|
|
1391
|
+
*
|
|
1392
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1393
|
+
* via the `definition` "AgentCatalog".
|
|
1394
|
+
*/
|
|
1395
|
+
interface AgentCatalog {
|
|
1396
|
+
agents: CatalogAgent[];
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1400
|
+
* via the `definition` "Project".
|
|
1401
|
+
*/
|
|
1402
|
+
interface Project {
|
|
1403
|
+
id: string;
|
|
1404
|
+
name: string;
|
|
1405
|
+
path: string;
|
|
1406
|
+
/**
|
|
1407
|
+
* User-chosen emoji shown in the project switcher; null falls back to a favicon found in the checkout, then to the project name's initial.
|
|
1408
|
+
*/
|
|
1409
|
+
iconEmoji: string | null;
|
|
1410
|
+
orderIndex: number;
|
|
1411
|
+
createdAt: string;
|
|
1412
|
+
}
|
|
1413
|
+
/**
|
|
1414
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1415
|
+
* via the `definition` "Worktree".
|
|
1416
|
+
*/
|
|
1417
|
+
interface Worktree {
|
|
1418
|
+
id: string;
|
|
1419
|
+
projectId: string;
|
|
1420
|
+
parentId: string | null;
|
|
1421
|
+
branch: string;
|
|
1422
|
+
title: string | null;
|
|
1423
|
+
path: string;
|
|
1424
|
+
isMain: boolean;
|
|
1425
|
+
/**
|
|
1426
|
+
* True when the user has hidden this worktree from the sidebar. Persists across restarts.
|
|
1427
|
+
*/
|
|
1428
|
+
hidden: boolean;
|
|
1429
|
+
createdAt: string;
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1432
|
+
* A managed scratchpad plus its MDX source and attached-agent metadata, as served by the host's `scratchpads` RPC to clients that render the document themselves.
|
|
1433
|
+
*
|
|
1434
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1435
|
+
* via the `definition` "ScratchpadFile".
|
|
1436
|
+
*/
|
|
1437
|
+
interface ScratchpadFile {
|
|
1438
|
+
id: string;
|
|
1439
|
+
title: string;
|
|
1440
|
+
/**
|
|
1441
|
+
* Worktree-relative POSIX path to the scratchpad's MDX file.
|
|
1442
|
+
*/
|
|
1443
|
+
filePath: string;
|
|
1444
|
+
/**
|
|
1445
|
+
* The full MDX source, frontmatter included.
|
|
1446
|
+
*/
|
|
1447
|
+
contents: string;
|
|
1448
|
+
/**
|
|
1449
|
+
* Terminal tab id this scratchpad prompts, or null when nothing is attached.
|
|
1450
|
+
*/
|
|
1451
|
+
agentTabId: string | null;
|
|
1452
|
+
/**
|
|
1453
|
+
* Catalog agent id of the attached tab, or null when nothing is attached.
|
|
1454
|
+
*/
|
|
1455
|
+
agentId: string | null;
|
|
1456
|
+
/**
|
|
1457
|
+
* Epoch milliseconds the scratchpad was created, from its managed frontmatter.
|
|
1458
|
+
*/
|
|
1459
|
+
createdAt: number;
|
|
1460
|
+
}
|
|
1461
|
+
/**
|
|
1462
|
+
* Serializable Excalidraw scene. Core fields are validated while element, app-state, and binary-file extensions remain forward compatible with Excalidraw releases.
|
|
1463
|
+
*
|
|
1464
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1465
|
+
* via the `definition` "ExcalidrawScene".
|
|
1466
|
+
*/
|
|
1467
|
+
interface ExcalidrawScene {
|
|
1468
|
+
type: "excalidraw";
|
|
1469
|
+
version: number;
|
|
1470
|
+
source?: string;
|
|
1471
|
+
elements: {
|
|
1472
|
+
id: string;
|
|
1473
|
+
type: string;
|
|
1474
|
+
[k: string]: unknown;
|
|
1475
|
+
}[];
|
|
1476
|
+
appState: {
|
|
1477
|
+
[k: string]: unknown;
|
|
1478
|
+
};
|
|
1479
|
+
files: {
|
|
1480
|
+
[k: string]: unknown;
|
|
1481
|
+
};
|
|
1482
|
+
}
|
|
1483
|
+
/**
|
|
1484
|
+
* One durable worktree-scoped Excalidraw document.
|
|
1485
|
+
*
|
|
1486
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1487
|
+
* via the `definition` "Whiteboard".
|
|
1488
|
+
*/
|
|
1489
|
+
interface Whiteboard {
|
|
1490
|
+
id: string;
|
|
1491
|
+
worktreeId: string;
|
|
1492
|
+
title: string;
|
|
1493
|
+
scene: ExcalidrawScene;
|
|
1494
|
+
version: number;
|
|
1495
|
+
createdAt: number;
|
|
1496
|
+
updatedAt: number;
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1500
|
+
* via the `definition` "WhiteboardCreateInput".
|
|
1501
|
+
*/
|
|
1502
|
+
interface WhiteboardCreateInput {
|
|
1503
|
+
worktreeId: string;
|
|
1504
|
+
title: string;
|
|
1505
|
+
scene: ExcalidrawScene;
|
|
1506
|
+
}
|
|
1507
|
+
/**
|
|
1508
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1509
|
+
* via the `definition` "WhiteboardEditInput".
|
|
1510
|
+
*/
|
|
1511
|
+
interface WhiteboardEditInput {
|
|
1512
|
+
worktreeId: string;
|
|
1513
|
+
id: string;
|
|
1514
|
+
title: string;
|
|
1515
|
+
scene: ExcalidrawScene;
|
|
1516
|
+
expectedVersion: number;
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1520
|
+
* via the `definition` "WhiteboardListInput".
|
|
1521
|
+
*/
|
|
1522
|
+
interface WhiteboardListInput {
|
|
1523
|
+
worktreeId: string;
|
|
1524
|
+
query?: string;
|
|
1525
|
+
}
|
|
1526
|
+
/**
|
|
1527
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1528
|
+
* via the `definition` "WhiteboardIdInput".
|
|
1529
|
+
*/
|
|
1530
|
+
interface WhiteboardIdInput {
|
|
1531
|
+
worktreeId: string;
|
|
1532
|
+
id: string;
|
|
1533
|
+
}
|
|
1534
|
+
/**
|
|
1535
|
+
* Base64-encoded PNG rendering of one whiteboard.
|
|
1536
|
+
*
|
|
1537
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1538
|
+
* via the `definition` "WhiteboardViewResult".
|
|
1539
|
+
*/
|
|
1540
|
+
interface WhiteboardViewResult {
|
|
1541
|
+
data: string;
|
|
1542
|
+
}
|
|
1543
|
+
/**
|
|
1544
|
+
* One tool call surfaced by an agent message.
|
|
1545
|
+
*
|
|
1546
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1547
|
+
* via the `definition` "AgentToolCall".
|
|
1548
|
+
*/
|
|
1549
|
+
interface AgentToolCall {
|
|
1550
|
+
id: string;
|
|
1551
|
+
name: string;
|
|
1552
|
+
status: AgentToolCallStatus;
|
|
1553
|
+
summary?: string;
|
|
1554
|
+
}
|
|
1555
|
+
/**
|
|
1556
|
+
* A path touched by an agent, without file contents.
|
|
1557
|
+
*
|
|
1558
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1559
|
+
* via the `definition` "AgentFileChange".
|
|
1560
|
+
*/
|
|
1561
|
+
interface AgentFileChange {
|
|
1562
|
+
path: string;
|
|
1563
|
+
change: AgentFileChangeKind;
|
|
1564
|
+
}
|
|
1565
|
+
/**
|
|
1566
|
+
* Append-only rich message entry reported by an agent. Consumers upsert by id when tool-call state changes.
|
|
1567
|
+
*
|
|
1568
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1569
|
+
* via the `definition` "AgentMessage".
|
|
1570
|
+
*/
|
|
1571
|
+
interface AgentMessage {
|
|
1572
|
+
agent: string;
|
|
1573
|
+
worktreeId: string;
|
|
1574
|
+
tabId: string;
|
|
1575
|
+
id: string;
|
|
1576
|
+
role: AgentMessageRole;
|
|
1577
|
+
text?: string;
|
|
1578
|
+
toolCalls?: AgentToolCall[];
|
|
1579
|
+
files?: AgentFileChange[];
|
|
1580
|
+
/**
|
|
1581
|
+
* Count of active sub-agents visible to the reporting plugin; no nested transcript is carried.
|
|
1582
|
+
*/
|
|
1583
|
+
subAgentsActive: number;
|
|
1584
|
+
/**
|
|
1585
|
+
* Emitter timestamp in milliseconds since Unix epoch.
|
|
1586
|
+
*/
|
|
1587
|
+
ts: number;
|
|
1588
|
+
}
|
|
1589
|
+
/**
|
|
1590
|
+
* Status report sent by pragma-cli through pragma-server to native clients.
|
|
1591
|
+
*
|
|
1592
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1593
|
+
* via the `definition` "AgentReportPayload".
|
|
1594
|
+
*/
|
|
1595
|
+
interface AgentReportPayload {
|
|
1596
|
+
agent: string;
|
|
1597
|
+
worktreeId: string;
|
|
1598
|
+
tabId: string;
|
|
1599
|
+
/**
|
|
1600
|
+
* New agent status, or null for a status-less report (e.g. a `session-name` rename) that must leave the stored status untouched.
|
|
1601
|
+
*/
|
|
1602
|
+
status: AgentStatus | null;
|
|
1603
|
+
/**
|
|
1604
|
+
* Human-readable name of the agent's active session. Reported on session create/rename/switch; the client renames the hosting tab unless the user renamed it manually.
|
|
1605
|
+
*/
|
|
1606
|
+
sessionName?: string;
|
|
1607
|
+
attentionKind?: AgentAttentionKind | null;
|
|
1608
|
+
/**
|
|
1609
|
+
* The command (or tool invocation) the agent is asking permission to run. Set when attentionKind is `command` so a non-terminal client can show it and approve remotely.
|
|
1610
|
+
*/
|
|
1611
|
+
command?: string;
|
|
1612
|
+
/**
|
|
1613
|
+
* The question the agent is asking. Set when attentionKind is `question` so a non-terminal client can show it and answer remotely.
|
|
1614
|
+
*/
|
|
1615
|
+
question?: string;
|
|
1616
|
+
/**
|
|
1617
|
+
* Answer choices for a `question` attention. Empty/omitted when the question is free-text only or when attentionKind is `command`.
|
|
1618
|
+
*/
|
|
1619
|
+
options?: QuestionOption[];
|
|
1620
|
+
/**
|
|
1621
|
+
* Multiple questions for a `question` attention. When present, clients render a back/next question wizard and submit every answer together; the legacy `question`/`options` fields are still used for a single question.
|
|
1622
|
+
*/
|
|
1623
|
+
questions?: AgentQuestion[];
|
|
1624
|
+
/**
|
|
1625
|
+
* Correlation id for a command-approval or question round-trip. The reporter sets it on a `command`/`question` attention report and waits for a matching AgentDecision/AgentAnswer before proceeding.
|
|
1626
|
+
*/
|
|
1627
|
+
requestId?: string;
|
|
1628
|
+
}
|
|
1629
|
+
/**
|
|
1630
|
+
* A selectable answer to an agent question.
|
|
1631
|
+
*
|
|
1632
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1633
|
+
* via the `definition` "QuestionOption".
|
|
1634
|
+
*/
|
|
1635
|
+
interface QuestionOption {
|
|
1636
|
+
/**
|
|
1637
|
+
* Answer text sent back to the agent when selected.
|
|
1638
|
+
*/
|
|
1639
|
+
label: string;
|
|
1640
|
+
/**
|
|
1641
|
+
* Optional explanation shown beneath the answer label.
|
|
1642
|
+
*/
|
|
1643
|
+
description?: string;
|
|
1644
|
+
}
|
|
1645
|
+
/**
|
|
1646
|
+
* One question in a multi-question attention request. Each entry carries its own prompt and optional answer choices.
|
|
1647
|
+
*
|
|
1648
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1649
|
+
* via the `definition` "AgentQuestion".
|
|
1650
|
+
*/
|
|
1651
|
+
interface AgentQuestion {
|
|
1652
|
+
/**
|
|
1653
|
+
* The question the agent is asking.
|
|
1654
|
+
*/
|
|
1655
|
+
question: string;
|
|
1656
|
+
/**
|
|
1657
|
+
* Answer choices for this question. Empty/omitted when the question is free-text only.
|
|
1658
|
+
*/
|
|
1659
|
+
options?: QuestionOption[];
|
|
1660
|
+
}
|
|
1661
|
+
/**
|
|
1662
|
+
* Approve/deny verdict for a command-approval request, published by the controlling client and fanned out to agent subscribers. The waiting reporter (a blocking harness hook or a plugin watcher) matches it by requestId.
|
|
1663
|
+
*
|
|
1664
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1665
|
+
* via the `definition` "AgentDecision".
|
|
1666
|
+
*/
|
|
1667
|
+
interface AgentDecision {
|
|
1668
|
+
agent: string;
|
|
1669
|
+
worktreeId: string;
|
|
1670
|
+
tabId: string;
|
|
1671
|
+
requestId: string;
|
|
1672
|
+
/**
|
|
1673
|
+
* true to run the command, false to reject it.
|
|
1674
|
+
*/
|
|
1675
|
+
approved: boolean;
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* Reply to a `question` attention request, published by the controlling client and fanned out to agent subscribers. The waiting reporter (a blocking harness hook or a plugin watcher) matches it by requestId.
|
|
1679
|
+
*
|
|
1680
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1681
|
+
* via the `definition` "AgentAnswer".
|
|
1682
|
+
*/
|
|
1683
|
+
interface AgentAnswer {
|
|
1684
|
+
agent: string;
|
|
1685
|
+
worktreeId: string;
|
|
1686
|
+
tabId: string;
|
|
1687
|
+
requestId: string;
|
|
1688
|
+
/**
|
|
1689
|
+
* The reply text. Present when the question was answered; omitted when dismissed.
|
|
1690
|
+
*/
|
|
1691
|
+
answer?: string;
|
|
1692
|
+
/**
|
|
1693
|
+
* true when the question was dismissed without an answer.
|
|
1694
|
+
*/
|
|
1695
|
+
dismissed: boolean;
|
|
1696
|
+
}
|
|
1697
|
+
/**
|
|
1698
|
+
* Free-form input (an interjection) sent by the controlling client to a running agent and fanned out to agent subscribers. A blocking harness hook or a plugin watcher delivers `text` into the agent's turn (via a harness input API, or by writing it to the tab's PTY). Unlike AgentDecision/AgentAnswer this is not tied to an outstanding request; `requestId` is optional and only set when the interjection answers a specific prompt.
|
|
1699
|
+
*
|
|
1700
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1701
|
+
* via the `definition` "AgentInput".
|
|
1702
|
+
*/
|
|
1703
|
+
interface AgentInput {
|
|
1704
|
+
agent: string;
|
|
1705
|
+
worktreeId: string;
|
|
1706
|
+
tabId: string;
|
|
1707
|
+
/**
|
|
1708
|
+
* The message text to deliver to the running agent.
|
|
1709
|
+
*/
|
|
1710
|
+
text: string;
|
|
1711
|
+
/**
|
|
1712
|
+
* Optional correlation id when the interjection answers a specific outstanding prompt.
|
|
1713
|
+
*/
|
|
1714
|
+
requestId?: string;
|
|
1715
|
+
}
|
|
1716
|
+
/**
|
|
1717
|
+
* Transient request to interrupt a running agent's current turn, published by the controlling client and fanned out to agent subscribers. Delivery is best-effort with no replay buffer: a watcher subscribed to the matching tab sends an interrupt (ESC) to the agent's PTY. Unlike AgentDecision/AgentAnswer it is not required to carry a requestId.
|
|
1718
|
+
*
|
|
1719
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1720
|
+
* via the `definition` "AgentInterrupt".
|
|
1721
|
+
*/
|
|
1722
|
+
interface AgentInterrupt {
|
|
1723
|
+
agent: string;
|
|
1724
|
+
worktreeId: string;
|
|
1725
|
+
tabId: string;
|
|
1726
|
+
/**
|
|
1727
|
+
* Optional correlation id when the interrupt targets a specific outstanding request.
|
|
1728
|
+
*/
|
|
1729
|
+
requestId?: string;
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Mirror of the desktop app's entire workspace state (all projects, worktrees, and tabs), published to pragma-server so remote clients (e.g. a paired phone) can render the session launcher without registering as the controller. The desktop publishes the full snapshot on every mutation; v1 keeps deltas trivial (every delta is a full replacement).
|
|
1733
|
+
*
|
|
1734
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1735
|
+
* via the `definition` "WorkspaceSnapshot".
|
|
1736
|
+
*/
|
|
1737
|
+
interface WorkspaceSnapshot {
|
|
1738
|
+
projects: Project[];
|
|
1739
|
+
worktrees: Worktree[];
|
|
1740
|
+
tabs: Tab[];
|
|
1741
|
+
}
|
|
1742
|
+
/**
|
|
1743
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1744
|
+
* via the `definition` "Tab".
|
|
1745
|
+
*/
|
|
1746
|
+
interface Tab {
|
|
1747
|
+
id: string;
|
|
1748
|
+
projectId: string;
|
|
1749
|
+
worktreeId: string;
|
|
1750
|
+
kind: TabKind;
|
|
1751
|
+
title: string | null;
|
|
1752
|
+
/**
|
|
1753
|
+
* The current page URL for browser tabs; null for terminal tabs.
|
|
1754
|
+
*/
|
|
1755
|
+
url: string | null;
|
|
1756
|
+
/**
|
|
1757
|
+
* Worktree-relative path for editor/diff tabs; null for terminal/browser tabs.
|
|
1758
|
+
*/
|
|
1759
|
+
filePath: string | null;
|
|
1760
|
+
/**
|
|
1761
|
+
* Durable whiteboard id for whiteboard tabs; null for every other tab kind.
|
|
1762
|
+
*/
|
|
1763
|
+
whiteboardId: string | null;
|
|
1764
|
+
/**
|
|
1765
|
+
* Which diff side a diff tab shows; null for non-diff tabs.
|
|
1766
|
+
*/
|
|
1767
|
+
diffSide: DiffSide | null;
|
|
1768
|
+
/**
|
|
1769
|
+
* Commit hash a commit-scoped diff tab shows (first parent → commit); null for range diffs and non-diff tabs.
|
|
1770
|
+
*/
|
|
1771
|
+
diffCommit: string | null;
|
|
1772
|
+
/**
|
|
1773
|
+
* Pull-request number a pr-review tab reviews; null for non-PR tabs.
|
|
1774
|
+
*/
|
|
1775
|
+
prNumber: number | null;
|
|
1776
|
+
/**
|
|
1777
|
+
* Owning plugin id for plugin-webview tabs; null for non-plugin tabs.
|
|
1778
|
+
*/
|
|
1779
|
+
pluginId: string | null;
|
|
1780
|
+
/**
|
|
1781
|
+
* Plugin-defined web view id for plugin-webview tabs; null for non-plugin tabs.
|
|
1782
|
+
*/
|
|
1783
|
+
pluginViewId: string | null;
|
|
1784
|
+
/**
|
|
1785
|
+
* JSON-encoded payload supplied when opening a plugin-webview tab; null when omitted or for non-plugin tabs.
|
|
1786
|
+
*/
|
|
1787
|
+
pluginPayload: string | null;
|
|
1788
|
+
/**
|
|
1789
|
+
* Optional dedupe key used to focus an existing plugin-webview tab instead of opening another.
|
|
1790
|
+
*/
|
|
1791
|
+
pluginDedupeKey: string | null;
|
|
1792
|
+
/**
|
|
1793
|
+
* Catalog id of the agent launched into this terminal tab, set at launch time. Drives the tab's agent icon and default title; null for tabs without an agent.
|
|
1794
|
+
*/
|
|
1795
|
+
agentId: string | null;
|
|
1796
|
+
/**
|
|
1797
|
+
* True once the user has manually renamed a terminal tab via double-click/context menu. Shell-emitted title updates (OSC 0/2) and agent session-name renames are ignored while this is true. Always false for non-terminal tabs.
|
|
1798
|
+
*/
|
|
1799
|
+
userRenamed: boolean;
|
|
1800
|
+
/**
|
|
1801
|
+
* Fanout this terminal tab is an attempt of. Optional rather than nullable: absent on every tab that is not a fanout attempt.
|
|
1802
|
+
*/
|
|
1803
|
+
fanoutId?: string | null;
|
|
1804
|
+
/**
|
|
1805
|
+
* Fanout member this terminal tab runs. Always set together with `fanoutId`.
|
|
1806
|
+
*/
|
|
1807
|
+
fanoutMemberId?: string | null;
|
|
1808
|
+
/**
|
|
1809
|
+
* Shell profile this terminal tab was opened with, so a session respawned after a daemon restart returns to the same shell instead of the current default. Optional rather than nullable: absent on every tab created before shell selection existed, and on non-terminal tabs.
|
|
1810
|
+
*/
|
|
1811
|
+
shell?: ShellProfile | null;
|
|
1812
|
+
orderIndex: number;
|
|
1813
|
+
createdAt: string;
|
|
1814
|
+
}
|
|
1815
|
+
/**
|
|
1816
|
+
* Payload for the brokered `agentSessionLaunch` control method. The desktop creates or resolves the target worktree + tab, replies with `{ worktreeId, tabId }` immediately, then asynchronously spawns the agent + watcher through the proven Kanban background-launch sequence. Either an existing `worktreeId` or a `newWorktree` spec must be provided.
|
|
1817
|
+
*
|
|
1818
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1819
|
+
* via the `definition` "AgentSessionLaunchPayload".
|
|
1820
|
+
*/
|
|
1821
|
+
interface AgentSessionLaunchPayload {
|
|
1822
|
+
projectId: string;
|
|
1823
|
+
/**
|
|
1824
|
+
* Id of an existing worktree to launch into. Mutually exclusive with `newWorktree`.
|
|
1825
|
+
*/
|
|
1826
|
+
worktreeId: string | null;
|
|
1827
|
+
/**
|
|
1828
|
+
* Describes a fresh worktree to create when `worktreeId` is absent. Mutually exclusive with `worktreeId`.
|
|
1829
|
+
*/
|
|
1830
|
+
newWorktree: NewWorktreeSpec | null;
|
|
1831
|
+
agentId: string;
|
|
1832
|
+
modelId?: string | null;
|
|
1833
|
+
reasoningId?: string | null;
|
|
1834
|
+
/**
|
|
1835
|
+
* Raw shell snippet appended to the agent's base launch command instead of catalog model/reasoning args (for example `--model moonshot/kimi-k3`). Overrides `modelId`/`reasoningId` when set.
|
|
1836
|
+
*/
|
|
1837
|
+
modelCmd?: string | null;
|
|
1838
|
+
prompt?: string | null;
|
|
1839
|
+
/**
|
|
1840
|
+
* When true, the host server launches the session itself (PTY + watcher, no desktop tab) even while a desktop controller is connected. Used by `pragma-cli agent verify` so scenario sessions do not open a desktop tab per step.
|
|
1841
|
+
*/
|
|
1842
|
+
headless?: boolean | null;
|
|
1843
|
+
}
|
|
1844
|
+
/**
|
|
1845
|
+
* Spec for creating a fresh worktree as part of an `agentSessionLaunch` request. Omitted/optional fields fall back to Pragma defaults.
|
|
1846
|
+
*
|
|
1847
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1848
|
+
* via the `definition` "NewWorktreeSpec".
|
|
1849
|
+
*/
|
|
1850
|
+
interface NewWorktreeSpec {
|
|
1851
|
+
parentWorktreeId: string;
|
|
1852
|
+
branch: string;
|
|
1853
|
+
title?: string | null;
|
|
1854
|
+
}
|
|
1855
|
+
/**
|
|
1856
|
+
* A single entry in a worktree directory listing.
|
|
1857
|
+
*
|
|
1858
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1859
|
+
* via the `definition` "DirEntry".
|
|
1860
|
+
*/
|
|
1861
|
+
interface DirEntry {
|
|
1862
|
+
/**
|
|
1863
|
+
* The entry's file name (no directory part).
|
|
1864
|
+
*/
|
|
1865
|
+
name: string;
|
|
1866
|
+
/**
|
|
1867
|
+
* Worktree-relative POSIX path (forward slashes) to the entry.
|
|
1868
|
+
*/
|
|
1869
|
+
path: string;
|
|
1870
|
+
isDir: boolean;
|
|
1871
|
+
}
|
|
1872
|
+
/**
|
|
1873
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1874
|
+
* via the `definition` "ChangedFile".
|
|
1875
|
+
*/
|
|
1876
|
+
interface ChangedFile {
|
|
1877
|
+
/**
|
|
1878
|
+
* Worktree-relative POSIX path of the changed file.
|
|
1879
|
+
*/
|
|
1880
|
+
path: string;
|
|
1881
|
+
/**
|
|
1882
|
+
* Previous path for a rename; null otherwise.
|
|
1883
|
+
*/
|
|
1884
|
+
oldPath: string | null;
|
|
1885
|
+
status: ChangeStatus;
|
|
1886
|
+
side: DiffSide;
|
|
1887
|
+
/**
|
|
1888
|
+
* Lines added in this file's diff on its side. Null for binary files (git reports -/-) and for untracked files whose on-disk line count could not be determined.
|
|
1889
|
+
*/
|
|
1890
|
+
additions: number | null;
|
|
1891
|
+
/**
|
|
1892
|
+
* Lines removed in this file's diff on its side. Null for binary files and for untracked files. 0 for untracked files (a brand-new file has nothing to remove).
|
|
1893
|
+
*/
|
|
1894
|
+
deletions: number | null;
|
|
1895
|
+
}
|
|
1896
|
+
/**
|
|
1897
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1898
|
+
* via the `definition` "WorktreeChanges".
|
|
1899
|
+
*/
|
|
1900
|
+
interface WorktreeChanges {
|
|
1901
|
+
committed: ChangedFile[];
|
|
1902
|
+
staged: ChangedFile[];
|
|
1903
|
+
unstaged: ChangedFile[];
|
|
1904
|
+
}
|
|
1905
|
+
/**
|
|
1906
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1907
|
+
* via the `definition` "FileDiff".
|
|
1908
|
+
*/
|
|
1909
|
+
interface FileDiff {
|
|
1910
|
+
path: string;
|
|
1911
|
+
/**
|
|
1912
|
+
* The base-side text; empty when the file was added or is binary.
|
|
1913
|
+
*/
|
|
1914
|
+
oldText: string;
|
|
1915
|
+
/**
|
|
1916
|
+
* The new-side text; empty when the file was deleted or is binary.
|
|
1917
|
+
*/
|
|
1918
|
+
newText: string;
|
|
1919
|
+
/**
|
|
1920
|
+
* True when git reports the file as binary; old/new text are empty.
|
|
1921
|
+
*/
|
|
1922
|
+
binary: boolean;
|
|
1923
|
+
}
|
|
1924
|
+
/**
|
|
1925
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1926
|
+
* via the `definition` "FileContents".
|
|
1927
|
+
*/
|
|
1928
|
+
interface FileContents {
|
|
1929
|
+
path: string;
|
|
1930
|
+
/**
|
|
1931
|
+
* The decoded UTF-8 text; empty when binary or truncated.
|
|
1932
|
+
*/
|
|
1933
|
+
text: string;
|
|
1934
|
+
/**
|
|
1935
|
+
* True when the bytes are not valid UTF-8.
|
|
1936
|
+
*/
|
|
1937
|
+
binary: boolean;
|
|
1938
|
+
/**
|
|
1939
|
+
* True when the file exceeds the read cap and was not read.
|
|
1940
|
+
*/
|
|
1941
|
+
truncated: boolean;
|
|
1942
|
+
/**
|
|
1943
|
+
* On-disk size in bytes from the file metadata.
|
|
1944
|
+
*/
|
|
1945
|
+
byteSize: number;
|
|
1946
|
+
}
|
|
1947
|
+
/**
|
|
1948
|
+
* A persisted prompt card on a project's Kanban board, scoped by projectId.
|
|
1949
|
+
*
|
|
1950
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
1951
|
+
* via the `definition` "KanbanPromptCard".
|
|
1952
|
+
*/
|
|
1953
|
+
interface KanbanPromptCard {
|
|
1954
|
+
id: string;
|
|
1955
|
+
projectId: string;
|
|
1956
|
+
/**
|
|
1957
|
+
* The worktree backing this card once it starts running; null for a draft.
|
|
1958
|
+
*/
|
|
1959
|
+
worktreeId?: string | null;
|
|
1960
|
+
/**
|
|
1961
|
+
* Branch the card targets — an existing project worktree branch or a new one to create.
|
|
1962
|
+
*/
|
|
1963
|
+
branchName: string;
|
|
1964
|
+
prompt: string;
|
|
1965
|
+
agentId: string;
|
|
1966
|
+
/**
|
|
1967
|
+
* Selected model id for the agent launch; null uses the agent default.
|
|
1968
|
+
*/
|
|
1969
|
+
modelId?: string | null;
|
|
1970
|
+
/**
|
|
1971
|
+
* Selected reasoning level id for the agent launch; null uses automatic reasoning.
|
|
1972
|
+
*/
|
|
1973
|
+
reasoningId?: string | null;
|
|
1974
|
+
status: KanbanPromptStatus;
|
|
1975
|
+
/**
|
|
1976
|
+
* Terminal tab/daemon session id the agent runs in once started; null before launch.
|
|
1977
|
+
*/
|
|
1978
|
+
agentTabId?: string | null;
|
|
1979
|
+
/**
|
|
1980
|
+
* Which completion path finished the card; null until completed.
|
|
1981
|
+
*/
|
|
1982
|
+
completedAction?: KanbanCompletedAction | null;
|
|
1983
|
+
/**
|
|
1984
|
+
* URL of the pull request opened during completion, when applicable.
|
|
1985
|
+
*/
|
|
1986
|
+
pullRequestUrl?: string | null;
|
|
1987
|
+
/**
|
|
1988
|
+
* Number of the pull request opened during completion, when applicable.
|
|
1989
|
+
*/
|
|
1990
|
+
pullRequestNumber?: number | null;
|
|
1991
|
+
schedulingMode: KanbanSchedulingMode;
|
|
1992
|
+
/**
|
|
1993
|
+
* Reserved for scheduled runs; always null in the manual MVP.
|
|
1994
|
+
*/
|
|
1995
|
+
scheduledFor?: string | null;
|
|
1996
|
+
createdAt: string;
|
|
1997
|
+
updatedAt: string;
|
|
1998
|
+
/**
|
|
1999
|
+
* When the card first moved to inProgress; null before launch.
|
|
2000
|
+
*/
|
|
2001
|
+
startedAt?: string | null;
|
|
2002
|
+
/**
|
|
2003
|
+
* When the card moved to completed; null until completed.
|
|
2004
|
+
*/
|
|
2005
|
+
completedAt?: string | null;
|
|
2006
|
+
}
|
|
2007
|
+
/**
|
|
2008
|
+
* Payload for creating an agent-board draft through the brokered desktop controller.
|
|
2009
|
+
*
|
|
2010
|
+
* This interface was referenced by `Constants`'s JSON-Schema
|
|
2011
|
+
* via the `definition` "BoardDraftCreatePayload".
|
|
2012
|
+
*/
|
|
2013
|
+
interface BoardDraftCreatePayload {
|
|
2014
|
+
prompt: string;
|
|
2015
|
+
/**
|
|
2016
|
+
* Existing worktree whose project and branch receive the draft.
|
|
2017
|
+
*/
|
|
2018
|
+
worktreeId: string;
|
|
2019
|
+
agentId: string;
|
|
2020
|
+
modelId?: string | null;
|
|
2021
|
+
reasoningId?: string | null;
|
|
2022
|
+
}
|
|
2023
|
+
/**
|
|
2024
|
+
* Shared application constants.
|
|
2025
|
+
*
|
|
2026
|
+
* The values live in `values.json` and are validated against `schema.json`.
|
|
2027
|
+
* The same JSON is consumed by the Rust backend (see `src/lib.rs`), so this is
|
|
2028
|
+
* the single source of truth across both languages.
|
|
2029
|
+
*/
|
|
2030
|
+
declare const constants: Constants;
|
|
2031
|
+
type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
2032
|
+
interface PragmaClientConfig {
|
|
2033
|
+
baseUrl?: string;
|
|
2034
|
+
token?: string;
|
|
2035
|
+
fetch?: FetchLike;
|
|
2036
|
+
headers?: Record<string, string>;
|
|
2037
|
+
}
|
|
2038
|
+
interface RequestOptions {
|
|
2039
|
+
method?: string;
|
|
2040
|
+
body?: unknown;
|
|
2041
|
+
rawBody?: Uint8Array;
|
|
2042
|
+
headers?: Record<string, string>;
|
|
2043
|
+
signal?: AbortSignal;
|
|
2044
|
+
}
|
|
2045
|
+
declare class Transport {
|
|
2046
|
+
readonly baseUrl: string;
|
|
2047
|
+
readonly token: string;
|
|
2048
|
+
readonly fetch: FetchLike;
|
|
2049
|
+
readonly headers: Record<string, string>;
|
|
2050
|
+
constructor(config?: PragmaClientConfig);
|
|
2051
|
+
request<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
2052
|
+
raw(path: string, options?: RequestOptions): Promise<Response>;
|
|
2053
|
+
}
|
|
2054
|
+
/** Result of `client.agents.launch(...)`: the resolved worktree + tab. */
|
|
2055
|
+
interface AgentSessionLaunchResult {
|
|
2056
|
+
worktreeId: string;
|
|
2057
|
+
tabId: string;
|
|
2058
|
+
}
|
|
2059
|
+
interface AgentEvent {
|
|
2060
|
+
type: "agent";
|
|
2061
|
+
worktreeId: string;
|
|
2062
|
+
tabId: string;
|
|
2063
|
+
agent: string;
|
|
2064
|
+
/** Effective status; null/absent only for a status-less session-name report. */
|
|
2065
|
+
status?: AgentStatus | null;
|
|
2066
|
+
/** Session display name last reported by the agent, when present. */
|
|
2067
|
+
sessionName?: string | null;
|
|
2068
|
+
attentionKind: AgentAttentionKind | null;
|
|
2069
|
+
/** The command awaiting approval when `attentionKind` is `command`. */
|
|
2070
|
+
command?: string | null;
|
|
2071
|
+
/** The question awaiting an answer when `attentionKind` is `question`. */
|
|
2072
|
+
question?: string | null;
|
|
2073
|
+
/** Answer choices for a `question` attention, when present. */
|
|
2074
|
+
options?: QuestionOption[] | null;
|
|
2075
|
+
/** Multiple questions for a `question` attention, when present. */
|
|
2076
|
+
questions?: AgentQuestion[] | null;
|
|
2077
|
+
/** Correlation id for the command/question round-trip, when present. */
|
|
2078
|
+
requestId?: string | null;
|
|
2079
|
+
}
|
|
2080
|
+
interface AgentMessageEvent {
|
|
2081
|
+
type: "agentMessage";
|
|
2082
|
+
message: AgentMessage;
|
|
2083
|
+
}
|
|
2084
|
+
/** Approve/deny verdict fanned out to agent subscribers. */
|
|
2085
|
+
interface AgentDecisionEvent {
|
|
2086
|
+
type: "agentDecision";
|
|
2087
|
+
decision: AgentDecision;
|
|
2088
|
+
}
|
|
2089
|
+
/** Question reply fanned out to agent subscribers. */
|
|
2090
|
+
interface AgentAnswerEvent {
|
|
2091
|
+
type: "agentAnswer";
|
|
2092
|
+
answer: AgentAnswer;
|
|
2093
|
+
}
|
|
2094
|
+
/** Free-form interjection fanned out to agent subscribers. */
|
|
2095
|
+
interface AgentInputEvent {
|
|
2096
|
+
type: "agentInput";
|
|
2097
|
+
input: AgentInput;
|
|
2098
|
+
}
|
|
2099
|
+
/** Transient interrupt fanned out to agent subscribers. */
|
|
2100
|
+
interface AgentInterruptEvent {
|
|
2101
|
+
type: "agentInterrupt";
|
|
2102
|
+
interrupt: AgentInterrupt;
|
|
2103
|
+
}
|
|
2104
|
+
type AgentStreamEvent = AgentEvent | AgentMessageEvent | AgentDecisionEvent | AgentAnswerEvent | AgentInputEvent | AgentInterruptEvent;
|
|
2105
|
+
interface ReportOptions {
|
|
2106
|
+
agent: string;
|
|
2107
|
+
worktreeId?: string;
|
|
2108
|
+
kind?: AgentAttentionKind;
|
|
2109
|
+
/** Command text for a `command` attention report (shown in the approval toast). */
|
|
2110
|
+
command?: string;
|
|
2111
|
+
/** Question text for a `question` attention report (shown in the answer UI). */
|
|
2112
|
+
question?: string;
|
|
2113
|
+
/** Answer choices for a `question` attention report. */
|
|
2114
|
+
options?: QuestionOption[];
|
|
2115
|
+
/** Multiple questions for a `question` attention report. */
|
|
2116
|
+
questions?: AgentQuestion[];
|
|
2117
|
+
/** Correlation id so a waiting caller can match the resulting decision. */
|
|
2118
|
+
requestId?: string;
|
|
2119
|
+
client?: PragmaClient;
|
|
2120
|
+
env?: Record<string, string | undefined>;
|
|
2121
|
+
signal?: AbortSignal;
|
|
2122
|
+
}
|
|
2123
|
+
/** Options for {@link reportSessionName}: a session display name plus routing. */
|
|
2124
|
+
type ReportSessionNameOptions = Omit<ReportOptions, "kind"> & {
|
|
2125
|
+
/** The session's human-readable display name. */
|
|
2126
|
+
name: string;
|
|
2127
|
+
};
|
|
2128
|
+
type ReportMessageOptions = Omit<ReportOptions, "kind"> & {
|
|
2129
|
+
message: Omit<AgentMessage, "agent" | "worktreeId" | "tabId"> & Partial<Pick<AgentMessage, "agent" | "worktreeId" | "tabId">>;
|
|
2130
|
+
};
|
|
2131
|
+
/** Identifies the single running agent a {@link AgentConnection} is bound to. */
|
|
2132
|
+
interface ConnectOptions {
|
|
2133
|
+
/** Stable agent id of the running agent to connect to. */
|
|
2134
|
+
agent: string;
|
|
2135
|
+
/** The terminal tab hosting the agent. */
|
|
2136
|
+
tabId: string;
|
|
2137
|
+
/** The worktree hosting the agent. */
|
|
2138
|
+
worktreeId: string;
|
|
2139
|
+
/** Optional initial request sent as the first interjection on connect. */
|
|
2140
|
+
prompt?: string;
|
|
2141
|
+
/** Aborts the whole connection (read stream + in-flight sends). */
|
|
2142
|
+
signal?: AbortSignal;
|
|
2143
|
+
}
|
|
2144
|
+
/**
|
|
2145
|
+
* A single duplex channel to one running agent. Async-iterate it to read every
|
|
2146
|
+
* event routed to that agent + tab ({@link AgentStreamEvent} filtered to the
|
|
2147
|
+
* connect target); call the methods to talk back on the same channel —
|
|
2148
|
+
* {@link send} to interject, {@link answer} to reply to a question,
|
|
2149
|
+
* {@link decide} to approve/deny a command.
|
|
2150
|
+
*/
|
|
2151
|
+
interface AgentConnection extends AsyncIterable<AgentStreamEvent> {
|
|
2152
|
+
/** Interjects free-form text into the agent's turn. */
|
|
2153
|
+
send(text: string, options?: {
|
|
2154
|
+
requestId?: string;
|
|
2155
|
+
}): Promise<void>;
|
|
2156
|
+
/** Replies to a `question` attention request; `null` dismisses it. */
|
|
2157
|
+
answer(requestId: string, reply: string | null): Promise<void>;
|
|
2158
|
+
/** Approves (`true`) or denies (`false`) a `command` attention request. */
|
|
2159
|
+
decide(requestId: string, approved: boolean): Promise<void>;
|
|
2160
|
+
/** Interrupts the agent's current turn; a watcher sends ESC to its tab. */
|
|
2161
|
+
interrupt(requestId?: string): Promise<void>;
|
|
2162
|
+
/** Closes the read stream and releases the connection. */
|
|
2163
|
+
close(): void;
|
|
2164
|
+
}
|
|
2165
|
+
/** Agent status gateway namespace. */
|
|
2166
|
+
declare class AgentsClient {
|
|
2167
|
+
private readonly transport;
|
|
2168
|
+
constructor(transport: Transport);
|
|
2169
|
+
report(payload: AgentReportPayload, options?: {
|
|
2170
|
+
signal?: AbortSignal;
|
|
2171
|
+
}): Promise<void>;
|
|
2172
|
+
reportMessage(payload: AgentMessage, options?: {
|
|
2173
|
+
signal?: AbortSignal;
|
|
2174
|
+
}): Promise<void>;
|
|
2175
|
+
/** Publishes a command-approval verdict, fanned out to agent subscribers. */
|
|
2176
|
+
reportDecision(payload: AgentDecision, options?: {
|
|
2177
|
+
signal?: AbortSignal;
|
|
2178
|
+
}): Promise<void>;
|
|
2179
|
+
/** Publishes a reply to a question request, fanned out to agent subscribers. */
|
|
2180
|
+
reportAnswer(payload: AgentAnswer, options?: {
|
|
2181
|
+
signal?: AbortSignal;
|
|
2182
|
+
}): Promise<void>;
|
|
2183
|
+
/** Publishes a free-form interjection, fanned out to agent subscribers. */
|
|
2184
|
+
reportInput(payload: AgentInput, options?: {
|
|
2185
|
+
signal?: AbortSignal;
|
|
2186
|
+
}): Promise<void>;
|
|
2187
|
+
/** Publishes a transient interrupt, fanned out to agent subscribers. */
|
|
2188
|
+
reportInterrupt(payload: AgentInterrupt, options?: {
|
|
2189
|
+
signal?: AbortSignal;
|
|
2190
|
+
}): Promise<void>;
|
|
2191
|
+
reportStarted(options: ReportOptions): Promise<void>;
|
|
2192
|
+
reportStopped(options: ReportOptions): Promise<void>;
|
|
2193
|
+
reportAttention(options: ReportOptions): Promise<void>;
|
|
2194
|
+
reportCleared(options: ReportOptions): Promise<void>;
|
|
2195
|
+
/**
|
|
2196
|
+
* Reports the human-readable name of the agent's active session without
|
|
2197
|
+
* changing status. Pragma renames the hosting tab (user renames win). Call
|
|
2198
|
+
* again on every rename or session switch.
|
|
2199
|
+
*/
|
|
2200
|
+
reportSessionName(options: ReportSessionNameOptions): Promise<void>;
|
|
2201
|
+
/** Returns the resolved agent catalog assembled by the plugins sidecar. */
|
|
2202
|
+
catalog(options?: {
|
|
2203
|
+
signal?: AbortSignal;
|
|
2204
|
+
}): Promise<AgentCatalog>;
|
|
2205
|
+
/**
|
|
2206
|
+
* Launches a new agent session through the brokered `agentSessionLaunch`
|
|
2207
|
+
* control route. A connected desktop persists tab/worktree metadata; without
|
|
2208
|
+
* one, the persistent host can launch into an existing mirrored worktree.
|
|
2209
|
+
*/
|
|
2210
|
+
launch(payload: AgentSessionLaunchPayload, options?: {
|
|
2211
|
+
signal?: AbortSignal;
|
|
2212
|
+
}): Promise<AgentSessionLaunchResult>;
|
|
2213
|
+
markAgentsSeen(payload: {
|
|
2214
|
+
tabId: string;
|
|
2215
|
+
}, options?: {
|
|
2216
|
+
signal?: AbortSignal;
|
|
2217
|
+
}): Promise<void>;
|
|
2218
|
+
/**
|
|
2219
|
+
* Opens a single duplex channel to one running agent: async-iterate it to
|
|
2220
|
+
* read every event routed to `agent` + `tabId`, and use its methods to talk
|
|
2221
|
+
* back on the same channel ({@link AgentConnection.send} to interject,
|
|
2222
|
+
* {@link AgentConnection.answer} to reply to a question,
|
|
2223
|
+
* {@link AgentConnection.decide} to approve/deny a command). Supersedes the
|
|
2224
|
+
* old read-only agent-event subscription. When `prompt` is set it is delivered
|
|
2225
|
+
* as the first interjection before the connection is returned.
|
|
2226
|
+
*/
|
|
2227
|
+
connect(options: ConnectOptions): Promise<AgentConnection>;
|
|
2228
|
+
/** Raw, unfiltered agent event stream. Internal read half of {@link connect}. */
|
|
2229
|
+
private readStream;
|
|
2230
|
+
/**
|
|
2231
|
+
* Blocks on the agent event stream until an {@link AgentDecision} matching
|
|
2232
|
+
* `agent` + `requestId` arrives, resolving its `approved` verdict. Resolves
|
|
2233
|
+
* `null` on timeout, abort, or stream error so a caller can fall back to the
|
|
2234
|
+
* harness's own permission prompt.
|
|
2235
|
+
*/
|
|
2236
|
+
awaitDecision(params: {
|
|
2237
|
+
agent: string;
|
|
2238
|
+
requestId: string;
|
|
2239
|
+
timeoutMs?: number;
|
|
2240
|
+
signal?: AbortSignal;
|
|
2241
|
+
}): Promise<boolean | null>;
|
|
2242
|
+
/**
|
|
2243
|
+
* Blocks on the agent event stream until an {@link AgentAnswer} matching
|
|
2244
|
+
* `agent` + `requestId` arrives, resolving its reply text. Resolves `null` on
|
|
2245
|
+
* dismiss, timeout, abort, or stream error so a caller can fall back to the
|
|
2246
|
+
* harness's own question prompt.
|
|
2247
|
+
*/
|
|
2248
|
+
awaitAnswer(params: {
|
|
2249
|
+
agent: string;
|
|
2250
|
+
requestId: string;
|
|
2251
|
+
timeoutMs?: number;
|
|
2252
|
+
signal?: AbortSignal;
|
|
2253
|
+
}): Promise<string | null>;
|
|
2254
|
+
}
|
|
2255
|
+
/** Reports an agent started status. */
|
|
2256
|
+
declare function reportStarted(options: ReportOptions): Promise<void>;
|
|
2257
|
+
/** Reports an agent stopped/done status. */
|
|
2258
|
+
declare function reportStopped(options: ReportOptions): Promise<void>;
|
|
2259
|
+
/** Reports an agent attention status. */
|
|
2260
|
+
declare function reportAttention(options: ReportOptions): Promise<void>;
|
|
2261
|
+
/** Reports an agent cleared status. */
|
|
2262
|
+
declare function reportCleared(options: ReportOptions): Promise<void>;
|
|
2263
|
+
/**
|
|
2264
|
+
* Reports the session's display name without changing agent status. Pragma
|
|
2265
|
+
* renames the hosting tab unless the user renamed it manually; report again on
|
|
2266
|
+
* every rename or session switch.
|
|
2267
|
+
*/
|
|
2268
|
+
declare function reportSessionName(options: ReportSessionNameOptions): Promise<void>;
|
|
2269
|
+
/** Reports one rich agent message. No-ops unless Pragma gateway env is present. */
|
|
2270
|
+
declare function reportMessage(options: ReportMessageOptions): Promise<void>;
|
|
2271
|
+
/** Options for {@link awaitAgentDecision}. */
|
|
2272
|
+
interface AwaitDecisionOptions {
|
|
2273
|
+
agent: string;
|
|
2274
|
+
requestId: string;
|
|
2275
|
+
timeoutMs?: number;
|
|
2276
|
+
client?: PragmaClient;
|
|
2277
|
+
env?: Record<string, string | undefined>;
|
|
2278
|
+
signal?: AbortSignal;
|
|
2279
|
+
}
|
|
2280
|
+
/**
|
|
2281
|
+
* Resolves the approve/deny verdict a Pragma approval toast publishes for
|
|
2282
|
+
* `requestId`, or `null` when there is no Pragma gateway env, on timeout, or on
|
|
2283
|
+
* error. Used by a harness plugin (e.g. opencode's `permission.ask`) to turn a
|
|
2284
|
+
* remote approval into an in-process permission decision.
|
|
2285
|
+
*/
|
|
2286
|
+
declare function awaitAgentDecision(options: AwaitDecisionOptions): Promise<boolean | null>;
|
|
2287
|
+
/** Options for {@link awaitAgentAnswer}. */
|
|
2288
|
+
interface AwaitAnswerOptions {
|
|
2289
|
+
agent: string;
|
|
2290
|
+
requestId: string;
|
|
2291
|
+
timeoutMs?: number;
|
|
2292
|
+
client?: PragmaClient;
|
|
2293
|
+
env?: Record<string, string | undefined>;
|
|
2294
|
+
signal?: AbortSignal;
|
|
2295
|
+
}
|
|
2296
|
+
/**
|
|
2297
|
+
* Resolves the reply text a Pragma question toast publishes for `requestId`, or
|
|
2298
|
+
* `null` when there is no Pragma gateway env, on dismiss, on timeout, or on
|
|
2299
|
+
* error. Used by a harness plugin to turn a remote answer into an in-process
|
|
2300
|
+
* question response.
|
|
2301
|
+
*/
|
|
2302
|
+
declare function awaitAgentAnswer(options: AwaitAnswerOptions): Promise<string | null>;
|
|
2303
|
+
/** A fetched asset: its raw bytes and MIME type. */
|
|
2304
|
+
interface FetchedAsset {
|
|
2305
|
+
bytes: Uint8Array;
|
|
2306
|
+
mime: string;
|
|
2307
|
+
}
|
|
2308
|
+
/**
|
|
2309
|
+
* Gateway namespace for plugin-contributed assets (agent icons). Assets are
|
|
2310
|
+
* fetched by content hash through the authenticated SDK transport — never as
|
|
2311
|
+
* bare `<img>` URLs — so the bearer token rides the request header.
|
|
2312
|
+
*/
|
|
2313
|
+
declare class AssetsClient {
|
|
2314
|
+
private readonly transport;
|
|
2315
|
+
constructor(transport: Transport);
|
|
2316
|
+
/** Fetches an asset's raw bytes + MIME type by content hash. */
|
|
2317
|
+
fetch(hash: string, options?: {
|
|
2318
|
+
signal?: AbortSignal;
|
|
2319
|
+
}): Promise<FetchedAsset>;
|
|
2320
|
+
/** Fetches an asset and returns it as a `data:` URI, ready for an `<img src>`. */
|
|
2321
|
+
toDataUri(hash: string, options?: {
|
|
2322
|
+
signal?: AbortSignal;
|
|
2323
|
+
}): Promise<string>;
|
|
2324
|
+
}
|
|
2325
|
+
type ProtocolSubscriptionEvent = {
|
|
2326
|
+
type: "snapshot";
|
|
2327
|
+
subscription: ProtocolEventKind;
|
|
2328
|
+
payload: unknown;
|
|
2329
|
+
} | {
|
|
2330
|
+
type: "delta";
|
|
2331
|
+
subscription: ProtocolEventKind;
|
|
2332
|
+
payload: unknown;
|
|
2333
|
+
};
|
|
2334
|
+
/** Protocol event subscription namespace. */
|
|
2335
|
+
declare class EventsClient {
|
|
2336
|
+
private readonly transport;
|
|
2337
|
+
constructor(transport: Transport);
|
|
2338
|
+
subscribe(event: ProtocolEventKind, options?: {
|
|
2339
|
+
cursor?: string;
|
|
2340
|
+
worktreeId?: string;
|
|
2341
|
+
cwd?: string;
|
|
2342
|
+
signal?: AbortSignal;
|
|
2343
|
+
}): AsyncGenerator<ProtocolSubscriptionEvent>;
|
|
2344
|
+
}
|
|
2345
|
+
interface ExecRunRequest {
|
|
2346
|
+
cwd: string;
|
|
2347
|
+
commands: string[];
|
|
2348
|
+
env?: Array<[string, string]>;
|
|
2349
|
+
maxConcurrent?: number;
|
|
2350
|
+
}
|
|
2351
|
+
interface CommandResult {
|
|
2352
|
+
command: string;
|
|
2353
|
+
stdout: string;
|
|
2354
|
+
stderr: string;
|
|
2355
|
+
status: number | null;
|
|
2356
|
+
durationMs: number;
|
|
2357
|
+
}
|
|
2358
|
+
/** Headless command execution RPC namespace. */
|
|
2359
|
+
declare class ExecClient {
|
|
2360
|
+
private readonly transport;
|
|
2361
|
+
constructor(transport: Transport);
|
|
2362
|
+
run(payload: ExecRunRequest): Promise<CommandResult[]>;
|
|
2363
|
+
}
|
|
2364
|
+
/** Options accepted by every fanout call. */
|
|
2365
|
+
interface FanoutRequestOptions {
|
|
2366
|
+
signal?: AbortSignal;
|
|
2367
|
+
}
|
|
2368
|
+
/** One member's terminal output, with the base64 wire field decoded. */
|
|
2369
|
+
interface FanoutReadTargetBytes extends Omit<FanoutReadTarget, "data"> {
|
|
2370
|
+
/** The same window as raw bytes. Callers never see the base64 wire form. */
|
|
2371
|
+
raw: Uint8Array;
|
|
2372
|
+
}
|
|
2373
|
+
/** A read result whose targets carry decoded bytes. */
|
|
2374
|
+
interface FanoutReadResultBytes {
|
|
2375
|
+
fanoutId: string;
|
|
2376
|
+
targets: FanoutReadTargetBytes[];
|
|
2377
|
+
}
|
|
2378
|
+
/** A fanout subscription event: a snapshot then full-replacement deltas. */
|
|
2379
|
+
type FanoutSubscriptionEvent = {
|
|
2380
|
+
type: "snapshot";
|
|
2381
|
+
subscription: ProtocolEventKind;
|
|
2382
|
+
payload: FanoutSubscriptionPayload;
|
|
2383
|
+
} | {
|
|
2384
|
+
type: "delta";
|
|
2385
|
+
subscription: ProtocolEventKind;
|
|
2386
|
+
payload: FanoutSubscriptionPayload;
|
|
2387
|
+
};
|
|
2388
|
+
/**
|
|
2389
|
+
* Fanout orchestration: launching one prompt into several isolated attempts,
|
|
2390
|
+
* following them, and finally picking one.
|
|
2391
|
+
*
|
|
2392
|
+
* Every method goes through the local gateway to the host that owns the
|
|
2393
|
+
* project — the same `fanouts` RPC `pragma-cli` uses — so a fanout behaves
|
|
2394
|
+
* identically whether it was started from a terminal, from the desktop, or from
|
|
2395
|
+
* a script, and whether or not the desktop app is running.
|
|
2396
|
+
*/
|
|
2397
|
+
declare class FanoutsClient {
|
|
2398
|
+
private readonly transport;
|
|
2399
|
+
private readonly events;
|
|
2400
|
+
constructor(transport: Transport, events: EventsClient);
|
|
2401
|
+
/**
|
|
2402
|
+
* Provisions a whole fanout: the parent, one worktree per attempt branched
|
|
2403
|
+
* from one captured commit, and one agent-owned terminal tab in each.
|
|
2404
|
+
*
|
|
2405
|
+
* Resolves once every attempt has launched or failed. A partly-provisioned
|
|
2406
|
+
* fanout resolves rather than throwing — `partial` is true and `failures`
|
|
2407
|
+
* names the members to retry — because the healthy attempts are real and
|
|
2408
|
+
* already running.
|
|
2409
|
+
*/
|
|
2410
|
+
create(request: FanoutCreateRequest, options?: FanoutRequestOptions): Promise<FanoutResult>;
|
|
2411
|
+
/** Reads one fanout by id, or by any worktree that belongs to it. */
|
|
2412
|
+
get(reference: FanoutRef, options?: FanoutRequestOptions): Promise<Fanout>;
|
|
2413
|
+
/**
|
|
2414
|
+
* Bounded terminal output for one member (`memberId`) or every member
|
|
2415
|
+
* (`all: true`). The raw bytes arrive base64-encoded and are decoded here, so
|
|
2416
|
+
* callers see a `Uint8Array` and never the wire form.
|
|
2417
|
+
*/
|
|
2418
|
+
read(request: FanoutReadRequest, options?: FanoutRequestOptions): Promise<FanoutReadResultBytes>;
|
|
2419
|
+
/**
|
|
2420
|
+
* Delivers a follow-up to one member or to every live member.
|
|
2421
|
+
*
|
|
2422
|
+
* Waits for per-member delivery receipts unless `waitForDelivery` is false.
|
|
2423
|
+
* Passing the same `messageId` twice is safe: a member that already took the
|
|
2424
|
+
* message is not typed into again.
|
|
2425
|
+
*/
|
|
2426
|
+
send(request: FanoutSendRequest, options?: FanoutRequestOptions): Promise<FanoutSendResult>;
|
|
2427
|
+
/**
|
|
2428
|
+
* Relaunches one member's agent in its existing worktree. The worktree is
|
|
2429
|
+
* reused deliberately — it may already hold work — and the previous tab moves
|
|
2430
|
+
* into the member's history.
|
|
2431
|
+
*/
|
|
2432
|
+
retry(request: FanoutMemberRequest, options?: FanoutRequestOptions): Promise<FanoutResult>;
|
|
2433
|
+
/** Stops every attempt and releases the parent. Checkouts are kept. */
|
|
2434
|
+
cancel(reference: FanoutRef, options?: FanoutRequestOptions): Promise<FanoutResult>;
|
|
2435
|
+
/**
|
|
2436
|
+
* **Destructive.** Commits the winner's uncommitted work under an
|
|
2437
|
+
* AI-generated message, merges it into the parent, promotes its scratchpads,
|
|
2438
|
+
* and then deletes every attempt worktree and branch — the winner included.
|
|
2439
|
+
*
|
|
2440
|
+
* There is deliberately no confirmation flag here: confirming is the UI's and
|
|
2441
|
+
* the CLI's job. A merge conflict or a failed cleanup resolves with the
|
|
2442
|
+
* durable fanout and a `stage` to resume from rather than throwing.
|
|
2443
|
+
*/
|
|
2444
|
+
pick(request: FanoutMemberRequest, options?: FanoutRequestOptions): Promise<FanoutPickResult>;
|
|
2445
|
+
/**
|
|
2446
|
+
* Typed fanout snapshot-then-delta subscription. v1 keeps deltas trivial:
|
|
2447
|
+
* every delta carries the host's full fanout set.
|
|
2448
|
+
*/
|
|
2449
|
+
subscribe(options?: {
|
|
2450
|
+
fanoutId?: string;
|
|
2451
|
+
signal?: AbortSignal;
|
|
2452
|
+
}): AsyncGenerator<FanoutSubscriptionEvent>;
|
|
2453
|
+
private narrow;
|
|
2454
|
+
private rpc;
|
|
2455
|
+
}
|
|
2456
|
+
interface WorktreePathRequest {
|
|
2457
|
+
root: string;
|
|
2458
|
+
path: string;
|
|
2459
|
+
}
|
|
2460
|
+
interface WriteFileRequest extends WorktreePathRequest {
|
|
2461
|
+
contents: string;
|
|
2462
|
+
}
|
|
2463
|
+
interface RenameRequest {
|
|
2464
|
+
root: string;
|
|
2465
|
+
from: string;
|
|
2466
|
+
to: string;
|
|
2467
|
+
}
|
|
2468
|
+
/** Filesystem RPC namespace. */
|
|
2469
|
+
declare class FsClient {
|
|
2470
|
+
private readonly transport;
|
|
2471
|
+
constructor(transport: Transport);
|
|
2472
|
+
listDir(payload: WorktreePathRequest): Promise<DirEntry[]>;
|
|
2473
|
+
createFile(payload: WorktreePathRequest): Promise<void>;
|
|
2474
|
+
createFolder(payload: WorktreePathRequest): Promise<void>;
|
|
2475
|
+
pathExists(payload: WorktreePathRequest): Promise<boolean>;
|
|
2476
|
+
readFile(payload: WorktreePathRequest): Promise<FileContents>;
|
|
2477
|
+
writeFile(payload: WriteFileRequest): Promise<void>;
|
|
2478
|
+
rename(payload: RenameRequest): Promise<void>;
|
|
2479
|
+
delete(payload: WorktreePathRequest): Promise<void>;
|
|
2480
|
+
private rpc;
|
|
2481
|
+
}
|
|
2482
|
+
interface MergedStatusItem {
|
|
2483
|
+
id: string;
|
|
2484
|
+
root: string;
|
|
2485
|
+
branch: string;
|
|
2486
|
+
parentBranch: string | null;
|
|
2487
|
+
}
|
|
2488
|
+
interface GithubRepoInfo {
|
|
2489
|
+
remoteUrl: string;
|
|
2490
|
+
defaultBranch: string;
|
|
2491
|
+
headBranch: string;
|
|
2492
|
+
}
|
|
2493
|
+
type GitPayload = Record<string, unknown>;
|
|
2494
|
+
/** Git RPC namespace. */
|
|
2495
|
+
declare class GitClient {
|
|
2496
|
+
private readonly transport;
|
|
2497
|
+
constructor(transport: Transport);
|
|
2498
|
+
worktreeChanges(payload: {
|
|
2499
|
+
root: string;
|
|
2500
|
+
parentBranch?: string | null;
|
|
2501
|
+
}): Promise<WorktreeChanges>;
|
|
2502
|
+
mergedStatus(payload: {
|
|
2503
|
+
items: MergedStatusItem[];
|
|
2504
|
+
}): Promise<Record<string, boolean>>;
|
|
2505
|
+
fileDiff(payload: GitPayload): Promise<FileDiff>;
|
|
2506
|
+
discardUnstagedFile(payload: GitPayload): Promise<void>;
|
|
2507
|
+
discardAllUnstaged(payload: {
|
|
2508
|
+
root: string;
|
|
2509
|
+
}): Promise<void>;
|
|
2510
|
+
stageFile(payload: {
|
|
2511
|
+
root: string;
|
|
2512
|
+
path: string;
|
|
2513
|
+
}): Promise<void>;
|
|
2514
|
+
stageAll(payload: {
|
|
2515
|
+
root: string;
|
|
2516
|
+
}): Promise<void>;
|
|
2517
|
+
unstageFile(payload: {
|
|
2518
|
+
root: string;
|
|
2519
|
+
path: string;
|
|
2520
|
+
oldPath?: string | null;
|
|
2521
|
+
}): Promise<void>;
|
|
2522
|
+
unstageAll(payload: {
|
|
2523
|
+
root: string;
|
|
2524
|
+
}): Promise<void>;
|
|
2525
|
+
commitStaged(payload: {
|
|
2526
|
+
root: string;
|
|
2527
|
+
message: string;
|
|
2528
|
+
}): Promise<void>;
|
|
2529
|
+
mergeWorktreeToParent(payload: GitPayload): Promise<void>;
|
|
2530
|
+
prFileDiff(payload: GitPayload): Promise<FileDiff>;
|
|
2531
|
+
githubRepoInfo(payload: {
|
|
2532
|
+
root: string;
|
|
2533
|
+
}): Promise<GithubRepoInfo>;
|
|
2534
|
+
githubDefaultPrTitle(payload: {
|
|
2535
|
+
root: string;
|
|
2536
|
+
}): Promise<string>;
|
|
2537
|
+
githubFetchAndSync(payload: {
|
|
2538
|
+
root: string;
|
|
2539
|
+
}): Promise<BranchSyncStatus>;
|
|
2540
|
+
githubPullBranch(payload: {
|
|
2541
|
+
root: string;
|
|
2542
|
+
}): Promise<void>;
|
|
2543
|
+
githubSyncBranch(payload: {
|
|
2544
|
+
root: string;
|
|
2545
|
+
}): Promise<void>;
|
|
2546
|
+
githubPushBranch(payload: {
|
|
2547
|
+
root: string;
|
|
2548
|
+
}): Promise<void>;
|
|
2549
|
+
githubDeleteRemoteBranch(payload: {
|
|
2550
|
+
root: string;
|
|
2551
|
+
}): Promise<void>;
|
|
2552
|
+
ensurePragmaExcluded(payload: {
|
|
2553
|
+
projectRoot: string;
|
|
2554
|
+
}): Promise<void>;
|
|
2555
|
+
createWorktree(payload: {
|
|
2556
|
+
parentRoot: string;
|
|
2557
|
+
branch: string;
|
|
2558
|
+
path: string;
|
|
2559
|
+
}): Promise<void>;
|
|
2560
|
+
removeWorktree(payload: {
|
|
2561
|
+
repoRoot: string;
|
|
2562
|
+
worktreePath: string;
|
|
2563
|
+
force: boolean;
|
|
2564
|
+
}): Promise<void>;
|
|
2565
|
+
deleteBranch(payload: {
|
|
2566
|
+
repoRoot: string;
|
|
2567
|
+
branch: string;
|
|
2568
|
+
}): Promise<void>;
|
|
2569
|
+
isDirty(payload: {
|
|
2570
|
+
root: string;
|
|
2571
|
+
}): Promise<boolean>;
|
|
2572
|
+
private rpc;
|
|
2573
|
+
}
|
|
2574
|
+
/** Body of `GET /v1/health`. */
|
|
2575
|
+
interface GatewayHealth {
|
|
2576
|
+
status: string;
|
|
2577
|
+
protocolVersion: string;
|
|
2578
|
+
gatewayVersion: string;
|
|
2579
|
+
/**
|
|
2580
|
+
* `gateway.apiVersion` — the client-facing `/v1` contract this host speaks.
|
|
2581
|
+
*
|
|
2582
|
+
* Optional because a host older than the release that added it answers
|
|
2583
|
+
* without the field; a remote client treats that as "unknown", not
|
|
2584
|
+
* "incompatible".
|
|
2585
|
+
*/
|
|
2586
|
+
apiVersion?: string;
|
|
2587
|
+
}
|
|
2588
|
+
/**
|
|
2589
|
+
* Gateway namespace for the liveness probe.
|
|
2590
|
+
*
|
|
2591
|
+
* `/v1/health` is one of the gateway's unauthenticated routes, so this answers
|
|
2592
|
+
* even when a token has gone stale — which is what makes it useful for telling
|
|
2593
|
+
* "the host is gone" apart from "the host rejected us".
|
|
2594
|
+
*/
|
|
2595
|
+
declare class HealthClient {
|
|
2596
|
+
private readonly transport;
|
|
2597
|
+
constructor(transport: Transport);
|
|
2598
|
+
/** Fetches the host's health, including its protocol and gateway versions. */
|
|
2599
|
+
check(options?: {
|
|
2600
|
+
signal?: AbortSignal;
|
|
2601
|
+
}): Promise<GatewayHealth>;
|
|
2602
|
+
}
|
|
2603
|
+
/** What a test push reached, and what the push service refused. */
|
|
2604
|
+
interface PushTestResult {
|
|
2605
|
+
/** How many registered phones the notification was addressed to. */
|
|
2606
|
+
sent: number;
|
|
2607
|
+
/** One line per message the push service rejected, with its reason. */
|
|
2608
|
+
errors: string[];
|
|
2609
|
+
}
|
|
2610
|
+
/** One phone registered for Expo push notifications on this host. */
|
|
2611
|
+
interface PushRegistration {
|
|
2612
|
+
/** Gateway device id (the `x-pragma-device-id` header the client sends). */
|
|
2613
|
+
deviceId: string;
|
|
2614
|
+
name: string;
|
|
2615
|
+
platform: string;
|
|
2616
|
+
/** Expo push token, or null once the device unregisters. */
|
|
2617
|
+
pushToken: string | null;
|
|
2618
|
+
registeredAt: number;
|
|
2619
|
+
}
|
|
2620
|
+
/** Push notification gateway namespace. */
|
|
2621
|
+
declare class PushClient {
|
|
2622
|
+
private readonly transport;
|
|
2623
|
+
constructor(transport: Transport);
|
|
2624
|
+
/**
|
|
2625
|
+
* Registers (or refreshes) this installation's Expo push token, so agent
|
|
2626
|
+
* alerts reach the phone while it is away from the app. The device is
|
|
2627
|
+
* identified by the `x-pragma-device-id` header the client already sends.
|
|
2628
|
+
*/
|
|
2629
|
+
register(payload: {
|
|
2630
|
+
token: string;
|
|
2631
|
+
}, options?: {
|
|
2632
|
+
signal?: AbortSignal;
|
|
2633
|
+
}): Promise<void>;
|
|
2634
|
+
/** Stops push delivery to this installation (unpair, or notifications off). */
|
|
2635
|
+
unregister(options?: {
|
|
2636
|
+
signal?: AbortSignal;
|
|
2637
|
+
}): Promise<void>;
|
|
2638
|
+
/** Lists every phone currently registered for push on this host. */
|
|
2639
|
+
list(options?: {
|
|
2640
|
+
signal?: AbortSignal;
|
|
2641
|
+
}): Promise<PushRegistration[]>;
|
|
2642
|
+
/**
|
|
2643
|
+
* Sends a test notification to every registered phone and reports what the
|
|
2644
|
+
* push service made of it. `sent` counts the phones addressed; `errors`
|
|
2645
|
+
* carries a line per message the push service refused, which is the only
|
|
2646
|
+
* place a project-wide credential problem is ever named.
|
|
2647
|
+
*/
|
|
2648
|
+
test(options?: {
|
|
2649
|
+
signal?: AbortSignal;
|
|
2650
|
+
}): Promise<PushTestResult>;
|
|
2651
|
+
/**
|
|
2652
|
+
* Reports whether the desktop window is focused. While a recent heartbeat says
|
|
2653
|
+
* it is, the gateway holds back phone pushes — the user is already looking at
|
|
2654
|
+
* the desktop alert. Heartbeats expire (`gateway.push.presenceTtlMs`), so a
|
|
2655
|
+
* desktop that dies without blurring stops suppressing on its own.
|
|
2656
|
+
*/
|
|
2657
|
+
presence(payload: {
|
|
2658
|
+
focused: boolean;
|
|
2659
|
+
}, options?: {
|
|
2660
|
+
signal?: AbortSignal;
|
|
2661
|
+
}): Promise<void>;
|
|
2662
|
+
}
|
|
2663
|
+
/**
|
|
2664
|
+
* The on-disk shapes every scratchpad client shares.
|
|
2665
|
+
*
|
|
2666
|
+
* They live in their own module (and their own package) because the desktop
|
|
2667
|
+
* editor, the SDK, the read-only viewer, and the native clients all read and
|
|
2668
|
+
* write the same two files — the MDX with its managed frontmatter, and the
|
|
2669
|
+
* sibling comment thread — and a second definition of either shape is how they
|
|
2670
|
+
* drift apart.
|
|
2671
|
+
*/
|
|
2672
|
+
/** One block of the rendered document a comment can be attached to. */
|
|
2673
|
+
interface ScratchpadBlock {
|
|
2674
|
+
/** Index of the block among the document's top-level rendered blocks. */
|
|
2675
|
+
index: number;
|
|
2676
|
+
/** Plain-text excerpt of the block, used as the comment's quote. */
|
|
2677
|
+
quote: string;
|
|
2678
|
+
}
|
|
2679
|
+
/** One persisted scratchpad comment, in the desktop's on-disk shape. */
|
|
2680
|
+
interface ScratchpadComment {
|
|
2681
|
+
id: string;
|
|
2682
|
+
/**
|
|
2683
|
+
* ProseMirror document positions the desktop editor decorates. A native
|
|
2684
|
+
* client has no ProseMirror document, so it writes `0`/`0` and anchors by
|
|
2685
|
+
* {@link ScratchpadComment.quote} and {@link ScratchpadComment.blockIndex}
|
|
2686
|
+
* instead; the desktop then renders the comment without a highlight rather
|
|
2687
|
+
* than highlighting the wrong range.
|
|
2688
|
+
*/
|
|
2689
|
+
from: number;
|
|
2690
|
+
to: number;
|
|
2691
|
+
quote: string;
|
|
2692
|
+
text: string;
|
|
2693
|
+
createdAt: number;
|
|
2694
|
+
resolvedAt: number | null;
|
|
2695
|
+
/** Rendered block this comment was attached to, when written on mobile. */
|
|
2696
|
+
blockIndex?: number;
|
|
2697
|
+
}
|
|
2698
|
+
/** Options for {@link ScratchpadsClient.getScratchpads}. */
|
|
2699
|
+
interface GetScratchpadsOptions {
|
|
2700
|
+
/** Absolute path of the worktree whose scratchpads should be listed. */
|
|
2701
|
+
root: string;
|
|
2702
|
+
signal?: AbortSignal;
|
|
2703
|
+
}
|
|
2704
|
+
/** One scratchpad, addressed the way every host RPC addresses a file. */
|
|
2705
|
+
interface ScratchpadRef {
|
|
2706
|
+
/** Absolute path of the worktree the scratchpad lives in. */
|
|
2707
|
+
root: string;
|
|
2708
|
+
/** Worktree-relative POSIX path of the scratchpad's MDX file. */
|
|
2709
|
+
filePath: string;
|
|
2710
|
+
}
|
|
2711
|
+
/** Options for {@link ScratchpadsClient.comment}. */
|
|
2712
|
+
interface CommentScratchpadOptions extends ScratchpadRef {
|
|
2713
|
+
/** The rendered block the comment is anchored to. */
|
|
2714
|
+
block: ScratchpadBlock;
|
|
2715
|
+
/** The comment body. Trimmed before it is stored. */
|
|
2716
|
+
text: string;
|
|
2717
|
+
/** Comment id. Generated when omitted. */
|
|
2718
|
+
id?: string;
|
|
2719
|
+
/** Creation timestamp in epoch milliseconds. Defaults to now. */
|
|
2720
|
+
createdAt?: number;
|
|
2721
|
+
}
|
|
2722
|
+
/** Options for {@link ScratchpadsClient.attachAgent}. */
|
|
2723
|
+
interface AttachScratchpadAgentOptions extends ScratchpadRef {
|
|
2724
|
+
/** Terminal tab id hosting the agent the scratchpad should prompt. */
|
|
2725
|
+
tabId: string;
|
|
2726
|
+
/** Catalog agent id of that tab (e.g. `pragma.claude-code`). */
|
|
2727
|
+
agentId: string;
|
|
2728
|
+
/** Current MDX source, when the caller already holds it, to skip a read. */
|
|
2729
|
+
contents?: string;
|
|
2730
|
+
}
|
|
2731
|
+
/** Options for {@link ScratchpadsClient.sendAttached}. */
|
|
2732
|
+
interface SendAttachedOptions extends ScratchpadRef {
|
|
2733
|
+
/** Worktree the attached tab belongs to. */
|
|
2734
|
+
worktreeId: string;
|
|
2735
|
+
/** Text delivered to the agent as an interjection. */
|
|
2736
|
+
text: string;
|
|
2737
|
+
/** Current MDX source, when the caller already holds it, to skip a read. */
|
|
2738
|
+
contents?: string;
|
|
2739
|
+
signal?: AbortSignal;
|
|
2740
|
+
}
|
|
2741
|
+
/**
|
|
2742
|
+
* Outcome of {@link ScratchpadsClient.sendAttached}: `delivered: false` means
|
|
2743
|
+
* the scratchpad names no agent, not that delivery failed.
|
|
2744
|
+
*/
|
|
2745
|
+
type SendAttachedResult = {
|
|
2746
|
+
delivered: false;
|
|
2747
|
+
} | {
|
|
2748
|
+
delivered: true;
|
|
2749
|
+
/** Runtime agent id the interjection was addressed to. */
|
|
2750
|
+
agent: string;
|
|
2751
|
+
/** Tab the interjection was sent to. */
|
|
2752
|
+
tabId: string;
|
|
2753
|
+
};
|
|
2754
|
+
/**
|
|
2755
|
+
* Gateway namespace for a worktree's managed scratchpads.
|
|
2756
|
+
*
|
|
2757
|
+
* The host lists the worktree's scratchpad directory and parses each file's
|
|
2758
|
+
* managed frontmatter, so every client sees the same contract the desktop does:
|
|
2759
|
+
* the MDX source plus the agent tab the scratchpad is attached to.
|
|
2760
|
+
*
|
|
2761
|
+
* Everything past {@link ScratchpadsClient.getScratchpads} is composed from the
|
|
2762
|
+
* filesystem and agent namespaces rather than served by a route of its own, but
|
|
2763
|
+
* belongs here because the composition *is* the contract: the comment thread
|
|
2764
|
+
* lives in a sibling file whose name only `@pragma-sh/scratchpad-contract` knows,
|
|
2765
|
+
* the attachment lives in managed frontmatter, and a prompt has to be addressed
|
|
2766
|
+
* to the running agent's runtime id rather than its catalog id. Re-deriving any
|
|
2767
|
+
* of that per client is how the three drift apart.
|
|
2768
|
+
*/
|
|
2769
|
+
declare class ScratchpadsClient {
|
|
2770
|
+
private readonly transport;
|
|
2771
|
+
private readonly fs;
|
|
2772
|
+
private readonly agents;
|
|
2773
|
+
constructor(transport: Transport, fs: FsClient, agents: AgentsClient);
|
|
2774
|
+
/** Lists every managed scratchpad in one worktree, source included. */
|
|
2775
|
+
getScratchpads(options: GetScratchpadsOptions): Promise<ScratchpadFile[]>;
|
|
2776
|
+
/**
|
|
2777
|
+
* Reads a scratchpad's comment thread. A scratchpad that was never commented
|
|
2778
|
+
* on has no sibling file, which reads as an empty thread rather than an error.
|
|
2779
|
+
*/
|
|
2780
|
+
getComments(options: ScratchpadRef): Promise<ScratchpadComment[]>;
|
|
2781
|
+
/**
|
|
2782
|
+
* Appends one comment anchored to a rendered block and returns it.
|
|
2783
|
+
*
|
|
2784
|
+
* Read-modify-write against the whole file: the thread is small, and the
|
|
2785
|
+
* desktop rewrites it wholesale too, so a partial append would be the odd one
|
|
2786
|
+
* out. Concurrent callers must serialize their own writes.
|
|
2787
|
+
*/
|
|
2788
|
+
comment(options: CommentScratchpadOptions): Promise<ScratchpadComment>;
|
|
2789
|
+
/** Replaces a scratchpad's comment thread wholesale. */
|
|
2790
|
+
setComments(options: ScratchpadRef, comments: readonly ScratchpadComment[]): Promise<void>;
|
|
2791
|
+
/**
|
|
2792
|
+
* Records the agent tab a scratchpad prompts, in its managed frontmatter.
|
|
2793
|
+
*
|
|
2794
|
+
* The attachment lives in the file rather than in client state so it survives
|
|
2795
|
+
* the session that created it and reads the same from every client.
|
|
2796
|
+
*/
|
|
2797
|
+
attachAgent(options: AttachScratchpadAgentOptions): Promise<void>;
|
|
2798
|
+
/**
|
|
2799
|
+
* Sends text to the agent this scratchpad is attached to.
|
|
2800
|
+
*
|
|
2801
|
+
* Resolves `{ delivered: false }` when nothing is attached — the common case,
|
|
2802
|
+
* because a scratchpad outlives the session that wrote it — so a caller can
|
|
2803
|
+
* raise its own "attach an agent" UI instead of catching an error. Delivery
|
|
2804
|
+
* itself is fire-and-forget past the gateway: the watcher attached to that
|
|
2805
|
+
* session types the text into the agent's TUI, and a tab whose session has
|
|
2806
|
+
* already exited drops it.
|
|
2807
|
+
*/
|
|
2808
|
+
sendAttached(options: SendAttachedOptions): Promise<SendAttachedResult>;
|
|
2809
|
+
private readScratchpad;
|
|
2810
|
+
private writeComments;
|
|
2811
|
+
}
|
|
2812
|
+
/**
|
|
2813
|
+
* The runtime agent id a report must carry.
|
|
2814
|
+
*
|
|
2815
|
+
* Frontmatter stores the catalog id (`plugin.agent`), while the agent event
|
|
2816
|
+
* stream is keyed by the plugin's own runtime id — its last segment. Sending
|
|
2817
|
+
* the qualified id makes the message invisible to the running agent.
|
|
2818
|
+
*/
|
|
2819
|
+
declare function runtimeAgentId2(agentId: string): string;
|
|
2820
|
+
interface SpawnSessionRequest {
|
|
2821
|
+
cwd: string;
|
|
2822
|
+
cols?: number;
|
|
2823
|
+
rows?: number;
|
|
2824
|
+
worktreeId?: string;
|
|
2825
|
+
}
|
|
2826
|
+
interface SpawnSessionResponse {
|
|
2827
|
+
sessionId: string;
|
|
2828
|
+
worktreeId: string;
|
|
2829
|
+
cwd: string;
|
|
2830
|
+
}
|
|
2831
|
+
type SessionEvent = {
|
|
2832
|
+
type: "output";
|
|
2833
|
+
sessionId: string;
|
|
2834
|
+
dataBase64: string;
|
|
2835
|
+
} | {
|
|
2836
|
+
type: "title";
|
|
2837
|
+
sessionId: string;
|
|
2838
|
+
title: string;
|
|
2839
|
+
} | {
|
|
2840
|
+
type: "exit";
|
|
2841
|
+
sessionId: string;
|
|
2842
|
+
code: number | null;
|
|
2843
|
+
} | {
|
|
2844
|
+
type: "echoMode";
|
|
2845
|
+
sessionId: string;
|
|
2846
|
+
echo: boolean;
|
|
2847
|
+
};
|
|
2848
|
+
interface StreamOptions {
|
|
2849
|
+
signal?: AbortSignal;
|
|
2850
|
+
}
|
|
2851
|
+
/** PTY session gateway namespace. */
|
|
2852
|
+
declare class SessionsClient {
|
|
2853
|
+
private readonly transport;
|
|
2854
|
+
constructor(transport: Transport);
|
|
2855
|
+
spawn(payload: SpawnSessionRequest, options?: {
|
|
2856
|
+
signal?: AbortSignal;
|
|
2857
|
+
}): Promise<SpawnSessionResponse>;
|
|
2858
|
+
attach(sessionId: string, options?: StreamOptions): AsyncGenerator<SessionEvent>;
|
|
2859
|
+
write(sessionId: string, bytes: Uint8Array, options?: {
|
|
2860
|
+
signal?: AbortSignal;
|
|
2861
|
+
}): Promise<void>;
|
|
2862
|
+
resize(sessionId: string, payload: {
|
|
2863
|
+
cols: number;
|
|
2864
|
+
rows: number;
|
|
2865
|
+
}, options?: {
|
|
2866
|
+
signal?: AbortSignal;
|
|
2867
|
+
}): Promise<void>;
|
|
2868
|
+
kill(sessionId: string, options?: {
|
|
2869
|
+
signal?: AbortSignal;
|
|
2870
|
+
}): Promise<void>;
|
|
2871
|
+
/** Renames the workspace tab associated with a session. */
|
|
2872
|
+
rename(sessionId: string, title: string): Promise<void>;
|
|
2873
|
+
killForCwd(cwd: string, options?: {
|
|
2874
|
+
signal?: AbortSignal;
|
|
2875
|
+
}): Promise<void>;
|
|
2876
|
+
}
|
|
2877
|
+
/** A color scheme a `.pragma/theme.json` may declare under `colors`. */
|
|
2878
|
+
type ThemeMode = (typeof constants.theme.modes)[number];
|
|
2879
|
+
/** Color overrides for one scheme, keyed by token name (no `--` prefix). */
|
|
2880
|
+
type ThemeOverrides = Partial<Record<string, string>>;
|
|
2881
|
+
/** Which theme-file scopes existed on the host. */
|
|
2882
|
+
interface ThemeSources {
|
|
2883
|
+
/** `~/.pragma/theme.json` was present. */
|
|
2884
|
+
global: boolean;
|
|
2885
|
+
/** `<root>/.pragma/theme.json` was present (only when a root was requested). */
|
|
2886
|
+
project: boolean;
|
|
2887
|
+
}
|
|
2888
|
+
/**
|
|
2889
|
+
* The host's user theme: `global` layered under `project`, per token. Shipped
|
|
2890
|
+
* defaults are deliberately absent — they belong to the app doing the
|
|
2891
|
+
* rendering, so a client applies these on top of its own.
|
|
2892
|
+
*/
|
|
2893
|
+
interface HostTheme {
|
|
2894
|
+
colors: Partial<Record<ThemeMode, ThemeOverrides>>;
|
|
2895
|
+
sources: ThemeSources;
|
|
2896
|
+
}
|
|
2897
|
+
/** Options for {@link ThemeClient.get}. */
|
|
2898
|
+
interface GetThemeOptions {
|
|
2899
|
+
/**
|
|
2900
|
+
* Absolute root of a project whose `.pragma/theme.json` should layer over the
|
|
2901
|
+
* global one. Omit for the global theme alone.
|
|
2902
|
+
*/
|
|
2903
|
+
root?: string;
|
|
2904
|
+
signal?: AbortSignal;
|
|
2905
|
+
}
|
|
2906
|
+
/**
|
|
2907
|
+
* Gateway namespace for the host's user theme (`.pragma/theme.json`).
|
|
2908
|
+
*
|
|
2909
|
+
* The host returns overrides only — never the desktop's shipped defaults — so a
|
|
2910
|
+
* client mirrors the user's customisation on top of its own base palette.
|
|
2911
|
+
*/
|
|
2912
|
+
declare class ThemeClient {
|
|
2913
|
+
private readonly transport;
|
|
2914
|
+
constructor(transport: Transport);
|
|
2915
|
+
/** Fetches the host's merged theme overrides. */
|
|
2916
|
+
get(options?: GetThemeOptions): Promise<HostTheme>;
|
|
2917
|
+
}
|
|
2918
|
+
/** Whiteboard list input requiring the optional query field. */
|
|
2919
|
+
interface WhiteboardSearchInput extends WhiteboardListInput {
|
|
2920
|
+
query: string;
|
|
2921
|
+
}
|
|
2922
|
+
/** Input selecting one whiteboard for PNG rendering. */
|
|
2923
|
+
interface WhiteboardViewInput extends WhiteboardIdInput {
|
|
2924
|
+
/** Uses Excalidraw's dark palette. */
|
|
2925
|
+
dark?: boolean;
|
|
2926
|
+
}
|
|
2927
|
+
/** Decoded PNG bytes returned by whiteboard rendering. */
|
|
2928
|
+
type WhiteboardViewBytes = Uint8Array;
|
|
2929
|
+
/** Durable Excalidraw whiteboard RPC namespace. */
|
|
2930
|
+
declare class WhiteboardsClient {
|
|
2931
|
+
private readonly transport;
|
|
2932
|
+
constructor(transport: Transport);
|
|
2933
|
+
/** Creates one worktree-scoped whiteboard. */
|
|
2934
|
+
create(input: WhiteboardCreateInput): Promise<Whiteboard>;
|
|
2935
|
+
/** Gets one whiteboard by durable id. */
|
|
2936
|
+
get(input: WhiteboardIdInput): Promise<Whiteboard>;
|
|
2937
|
+
/** Lists whiteboards for one worktree, optionally filtering by query. */
|
|
2938
|
+
list(input: WhiteboardListInput): Promise<Whiteboard[]>;
|
|
2939
|
+
/** Searches whiteboard titles and element text within one worktree. */
|
|
2940
|
+
search(input: WhiteboardSearchInput): Promise<Whiteboard[]>;
|
|
2941
|
+
/** Replaces one whiteboard after its optimistic version check. */
|
|
2942
|
+
edit(input: WhiteboardEditInput): Promise<Whiteboard>;
|
|
2943
|
+
/** Deletes one whiteboard by durable id. */
|
|
2944
|
+
delete(input: WhiteboardIdInput): Promise<void>;
|
|
2945
|
+
/** Requests a rendered whiteboard and returns its decoded PNG bytes. */
|
|
2946
|
+
view(input: WhiteboardViewInput): Promise<WhiteboardViewBytes>;
|
|
2947
|
+
private rpc;
|
|
2948
|
+
}
|
|
2949
|
+
/** A workspace subscription event: a snapshot then full-replacement deltas. */
|
|
2950
|
+
type WorkspaceSubscriptionEvent = {
|
|
2951
|
+
type: "snapshot";
|
|
2952
|
+
subscription: ProtocolEventKind;
|
|
2953
|
+
payload: WorkspaceSnapshot;
|
|
2954
|
+
} | {
|
|
2955
|
+
type: "delta";
|
|
2956
|
+
subscription: ProtocolEventKind;
|
|
2957
|
+
payload: WorkspaceSnapshot;
|
|
2958
|
+
};
|
|
2959
|
+
/**
|
|
2960
|
+
* Typed workspace snapshot-then-delta subscription. v1 keeps deltas trivial:
|
|
2961
|
+
* every delta carries a full replacement snapshot. Delegates to the generic
|
|
2962
|
+
* {@link EventsClient} and narrows the payload to {@link WorkspaceSnapshot}.
|
|
2963
|
+
*/
|
|
2964
|
+
declare class WorkspaceClient {
|
|
2965
|
+
private readonly events;
|
|
2966
|
+
constructor(events: EventsClient);
|
|
2967
|
+
subscribe(options?: {
|
|
2968
|
+
signal?: AbortSignal;
|
|
2969
|
+
}): AsyncGenerator<WorkspaceSubscriptionEvent>;
|
|
2970
|
+
private narrow;
|
|
2971
|
+
}
|
|
2972
|
+
/** Fetch-based client for the local Pragma HTTP gateway. */
|
|
2973
|
+
declare class PragmaClient {
|
|
2974
|
+
readonly fs: FsClient;
|
|
2975
|
+
readonly git: GitClient;
|
|
2976
|
+
readonly exec: ExecClient;
|
|
2977
|
+
readonly sessions: SessionsClient;
|
|
2978
|
+
readonly agents: AgentsClient;
|
|
2979
|
+
readonly assets: AssetsClient;
|
|
2980
|
+
readonly events: EventsClient;
|
|
2981
|
+
readonly workspace: WorkspaceClient;
|
|
2982
|
+
readonly fanouts: FanoutsClient;
|
|
2983
|
+
readonly push: PushClient;
|
|
2984
|
+
readonly theme: ThemeClient;
|
|
2985
|
+
readonly health: HealthClient;
|
|
2986
|
+
readonly scratchpads: ScratchpadsClient;
|
|
2987
|
+
/** Durable Excalidraw whiteboards. */
|
|
2988
|
+
readonly whiteboards: WhiteboardsClient;
|
|
2989
|
+
private readonly transport;
|
|
2990
|
+
constructor(config?: PragmaClientConfig);
|
|
2991
|
+
rpc<T = unknown>(method: string, payload: unknown, options?: {
|
|
2992
|
+
signal?: AbortSignal;
|
|
2993
|
+
}): Promise<T>;
|
|
2994
|
+
/** Creates a draft on the agent board for an existing worktree. */
|
|
2995
|
+
createBoardDraft(payload: BoardDraftCreatePayload, options?: {
|
|
2996
|
+
signal?: AbortSignal;
|
|
2997
|
+
}): Promise<KanbanPromptCard>;
|
|
2998
|
+
}
|
|
2999
|
+
/** Encodes bytes to base64 without `Buffer`. */
|
|
3000
|
+
declare function bytesToBase64(bytes: Uint8Array): string;
|
|
3001
|
+
/** Decodes base64 to bytes without `Buffer`. */
|
|
3002
|
+
declare function base64ToBytes(value: string): Uint8Array;
|
|
3003
|
+
/** Environment variable names used by the gateway SDK. */
|
|
3004
|
+
declare const PRAGMA_ENV_KEYS: {
|
|
3005
|
+
readonly gatewayUrl: "PRAGMA_GATEWAY_URL";
|
|
3006
|
+
readonly gatewayToken: "PRAGMA_GATEWAY_TOKEN";
|
|
3007
|
+
readonly tabId: "PRAGMA_TAB_ID";
|
|
3008
|
+
readonly worktreeId: "PRAGMA_WORKTREE_ID";
|
|
3009
|
+
};
|
|
3010
|
+
type PragmaEnv = Record<string, string | undefined>;
|
|
3011
|
+
/** Reads one env var from an injected env object or guarded `globalThis.process`. */
|
|
3012
|
+
declare function readEnv(name: string, env?: PragmaEnv): string | undefined;
|
|
3013
|
+
/** Returns true when enough Pragma gateway/session env is present for agent reports. */
|
|
3014
|
+
declare function hasPragmaEnvironment(env?: PragmaEnv): boolean;
|
|
3015
|
+
/** Error returned by the Pragma HTTP gateway. */
|
|
3016
|
+
declare class PragmaGatewayError extends Error {
|
|
3017
|
+
readonly code: string;
|
|
3018
|
+
readonly httpStatus: number;
|
|
3019
|
+
/**
|
|
3020
|
+
* Domain error detail the gateway code cannot express — for a fanout, the
|
|
3021
|
+
* `FanoutFailure` (its own failure code, the member it belongs to, and the
|
|
3022
|
+
* finalize stage it stopped at). Present only when the host sent one.
|
|
3023
|
+
*/
|
|
3024
|
+
readonly details?: unknown;
|
|
3025
|
+
readonly cause?: unknown;
|
|
3026
|
+
constructor(message: string, info: {
|
|
3027
|
+
code: string;
|
|
3028
|
+
httpStatus: number;
|
|
3029
|
+
details?: unknown;
|
|
3030
|
+
cause?: unknown;
|
|
3031
|
+
});
|
|
3032
|
+
}
|
|
3033
|
+
/** Network, configuration, and non-JSON transport failure. */
|
|
3034
|
+
declare class PragmaTransportError extends Error {
|
|
3035
|
+
readonly cause?: unknown;
|
|
3036
|
+
constructor(message: string, cause?: unknown);
|
|
3037
|
+
}
|
|
3038
|
+
export { runtimeAgentId2 as runtimeAgentId, reportStopped, reportStarted, reportSessionName, reportMessage, reportCleared, reportAttention, readEnv, hasPragmaEnvironment, bytesToBase64, base64ToBytes, awaitAgentDecision, awaitAgentAnswer, WriteFileRequest, WorktreePathRequest, WorktreeChanges, WorkspaceSubscriptionEvent, WorkspaceSnapshot, WorkspaceClient, WhiteboardsClient, WhiteboardViewResult, WhiteboardViewInput, WhiteboardViewBytes, WhiteboardSearchInput, WhiteboardListInput, WhiteboardIdInput, WhiteboardEditInput, WhiteboardCreateInput, Whiteboard, ThemeSources, ThemeOverrides, ThemeMode, ThemeClient, StreamOptions, SpawnSessionResponse, SpawnSessionRequest, SessionEvent, SendAttachedResult, SendAttachedOptions, ScratchpadsClient, ScratchpadRef, ScratchpadFile, ScratchpadComment, ScratchpadBlock, ReportSessionNameOptions, ReportOptions, ReportMessageOptions, RenameRequest, QuestionOption, PushTestResult, PushRegistration, PushClient, PragmaTransportError, PragmaGatewayError, PragmaClientConfig, PragmaClient, PRAGMA_ENV_KEYS, MergedStatusItem, KanbanPromptCard, HostTheme, HealthClient, GithubRepoInfo, GitPayload, GetThemeOptions, GetScratchpadsOptions, GatewayHealth, FileDiff, FileContents, FetchedAsset, FanoutsClient, FanoutSubscriptionPayload, FanoutSubscriptionEvent, FanoutStatus, FanoutSendTarget, FanoutSendResult, FanoutSendRequest, FanoutResult, FanoutRequestOptions, FanoutRef, FanoutReadTargetBytes, FanoutReadTarget, FanoutReadResultBytes, FanoutReadResult, FanoutReadRequest, FanoutPickResult, FanoutParentSpec, FanoutNewParent, FanoutMemberStatus, FanoutMemberSelector, FanoutMemberRequest, FanoutMember, FanoutFinalizeStage, FanoutFailureCode, FanoutFailure, FanoutExistingParent, FanoutDeliveryState, FanoutDeliveryReceipt, FanoutCreateRequest, Fanout, ExecRunRequest, ExcalidrawScene, DirEntry, ConnectOptions, CommentScratchpadOptions, CommandResult, CatalogAgent, BranchSyncStatus, BoardDraftCreatePayload, AwaitDecisionOptions, AwaitAnswerOptions, AttachScratchpadAgentOptions, AssetsClient, AgentStreamEvent, AgentStatus, AgentSessionLaunchResult, AgentSessionLaunchPayload, AgentReportPayload, AgentReasoning, AgentQuestion, AgentModelEntry, AgentMessageEvent, AgentMessage, AgentInterruptEvent, AgentInterrupt, AgentInputEvent, AgentInput, AgentIcon, AgentEvent, AgentDecisionEvent, AgentDecision, AgentConnection, AgentCatalog, AgentAttentionKind, AgentAnswerEvent, AgentAnswer };
|