@sideboard-ai/core 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/dist/agents/cursor-runner.cjs +173 -0
- package/dist/agents/cursor-runner.d.cts +1 -0
- package/dist/agents/cursor-runner.d.ts +1 -0
- package/dist/agents/cursor-runner.js +102 -0
- package/dist/agents-OAX7XPKX.js +41 -0
- package/dist/app-settings-BDMLWCWI.js +61 -0
- package/dist/chunk-2M4OHXYX.js +198 -0
- package/dist/chunk-2R5VV4BA.js +143 -0
- package/dist/chunk-3DKGI32Q.js +92 -0
- package/dist/chunk-3WF3X46L.js +373 -0
- package/dist/chunk-AJ6ROGD7.js +74 -0
- package/dist/chunk-E4PWXO2C.js +4534 -0
- package/dist/chunk-HYRHI3QU.js +154 -0
- package/dist/chunk-ILQK4P5R.js +311 -0
- package/dist/chunk-LL7DTZ5B.js +1282 -0
- package/dist/chunk-M37RITA6.js +304 -0
- package/dist/chunk-TLJH3L2C.js +80 -0
- package/dist/chunk-WMCPLDW3.js +1413 -0
- package/dist/connected-teams-GF52Q7LB.js +22 -0
- package/dist/coordinator-prompt-6R2TX4WQ.js +22 -0
- package/dist/global-workspace-R44HGBU6.js +36 -0
- package/dist/index.cjs +9940 -0
- package/dist/index.d.cts +2284 -0
- package/dist/index.d.ts +2284 -0
- package/dist/index.js +929 -0
- package/dist/mcp/run-stdio.cjs +8654 -0
- package/dist/mcp/run-stdio.d.cts +2 -0
- package/dist/mcp/run-stdio.d.ts +2 -0
- package/dist/mcp/run-stdio.js +21 -0
- package/dist/paths-VPH3ITBK.js +26 -0
- package/dist/run-LF6E5IKL.js +10 -0
- package/dist/thread-store-UNPZNIFW.js +27 -0
- package/dist/title-4A2ATYNY.js +24 -0
- package/dist/workspaces-TCJFYI35.js +20 -0
- package/dist/worktree-NGFDN3J4.js +79 -0
- package/package.json +63 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,2284 @@
|
|
|
1
|
+
import { ResultPromise } from 'execa';
|
|
2
|
+
import { EventEmitter } from 'node:events';
|
|
3
|
+
|
|
4
|
+
type AgentKind = 'claude' | 'codex' | 'opencode' | 'brightsy' | 'cursor';
|
|
5
|
+
type SourceType = 'branch' | 'pr' | 'ticket' | 'orchestration' | 'adopt';
|
|
6
|
+
type ThreadStatus = 'idle' | 'queued' | 'running' | 'stopped' | 'error' | 'broken' | 'archived';
|
|
7
|
+
type Autonomy = 'default' | 'full';
|
|
8
|
+
/** Structured agent turn content (thinking / tools / text). */
|
|
9
|
+
type MessagePart = {
|
|
10
|
+
type: 'text';
|
|
11
|
+
text: string;
|
|
12
|
+
} | {
|
|
13
|
+
type: 'thinking';
|
|
14
|
+
text: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'tool';
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
input?: Record<string, unknown>;
|
|
20
|
+
/** Short human label (e.g. "Fetch latest from origin"). */
|
|
21
|
+
description?: string;
|
|
22
|
+
/** Command / path shown in the monospace pill. */
|
|
23
|
+
detail?: string;
|
|
24
|
+
result?: string;
|
|
25
|
+
status: 'running' | 'done' | 'error';
|
|
26
|
+
filePath?: string;
|
|
27
|
+
additions?: number;
|
|
28
|
+
deletions?: number;
|
|
29
|
+
};
|
|
30
|
+
/** Token usage for a single agent turn, aggregated across the turn's API calls. */
|
|
31
|
+
interface TokenUsage {
|
|
32
|
+
inputTokens: number;
|
|
33
|
+
outputTokens: number;
|
|
34
|
+
cacheReadTokens?: number;
|
|
35
|
+
cacheWriteTokens?: number;
|
|
36
|
+
}
|
|
37
|
+
interface ThreadMessage {
|
|
38
|
+
role: 'user' | 'agent' | 'summary';
|
|
39
|
+
text: string;
|
|
40
|
+
/** Structured parts for expandable tool/thinking UI. Optional for older threads. */
|
|
41
|
+
parts?: MessagePart[];
|
|
42
|
+
/** Agent turn duration in milliseconds (from turn start to message persist). */
|
|
43
|
+
durationMs?: number;
|
|
44
|
+
/** Token usage for this turn, when the agent CLI reports it. */
|
|
45
|
+
usage?: TokenUsage;
|
|
46
|
+
ts: string;
|
|
47
|
+
}
|
|
48
|
+
/** Composer / turn attachment (e.g. forked chat transcript). */
|
|
49
|
+
interface ThreadAttachment {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
kind: 'transcript' | 'file' | 'issue' | 'workspace';
|
|
53
|
+
content: string;
|
|
54
|
+
}
|
|
55
|
+
interface Thread {
|
|
56
|
+
id: string;
|
|
57
|
+
title: string;
|
|
58
|
+
sourceType: SourceType;
|
|
59
|
+
sourceRef: string;
|
|
60
|
+
branchName: string;
|
|
61
|
+
worktreePath: string;
|
|
62
|
+
repoPath: string;
|
|
63
|
+
agent: AgentKind;
|
|
64
|
+
/** Agent model alias (e.g. sonnet, opus). null = Auto / CLI default. */
|
|
65
|
+
model: string | null;
|
|
66
|
+
/** Prefer faster/cheaper turns (Claude: --effort low). */
|
|
67
|
+
fast: boolean;
|
|
68
|
+
/** Plan-only turns — analyze and plan without editing files (Conductor-style). */
|
|
69
|
+
planMode: boolean;
|
|
70
|
+
sessionId: string | null;
|
|
71
|
+
autonomy: Autonomy;
|
|
72
|
+
sourceIsFork: boolean;
|
|
73
|
+
status: ThreadStatus;
|
|
74
|
+
queue: string[];
|
|
75
|
+
parentThreadId: string | null;
|
|
76
|
+
/** Port of the default/primary run script (legacy + sidebar). */
|
|
77
|
+
devPort: number | null;
|
|
78
|
+
/** Named run scripts currently tracked for this thread. */
|
|
79
|
+
activeRuns?: ActiveRun[];
|
|
80
|
+
prUrl: string | null;
|
|
81
|
+
/** Cached PR title for Conductor-style sidebar labels (PR title > branch). */
|
|
82
|
+
prTitle: string | null;
|
|
83
|
+
/** When true, `title` is a manual override and is not overwritten by branch/PR sync. */
|
|
84
|
+
userSetTitle: boolean;
|
|
85
|
+
createdAt: string;
|
|
86
|
+
updatedAt: string;
|
|
87
|
+
messages: ThreadMessage[];
|
|
88
|
+
/** Pending composer attachments (forked transcripts, etc.). */
|
|
89
|
+
attachments: ThreadAttachment[];
|
|
90
|
+
lastError?: string | null;
|
|
91
|
+
}
|
|
92
|
+
interface CreateChatTabInput {
|
|
93
|
+
/** Existing thread in the worktree to clone workspace metadata from. */
|
|
94
|
+
fromThreadId: string;
|
|
95
|
+
agent?: AgentKind;
|
|
96
|
+
title?: string;
|
|
97
|
+
attachments?: ThreadAttachment[];
|
|
98
|
+
}
|
|
99
|
+
interface ForkChatTabInput {
|
|
100
|
+
threadId: string;
|
|
101
|
+
/** Inclusive message index to fork through; default = all messages. */
|
|
102
|
+
throughIndex?: number;
|
|
103
|
+
agent?: AgentKind;
|
|
104
|
+
title?: string;
|
|
105
|
+
}
|
|
106
|
+
/** Fork a thread into a new git worktree (new branch + worktree dir). */
|
|
107
|
+
interface ForkThreadWorktreeInput {
|
|
108
|
+
threadId: string;
|
|
109
|
+
/** Inclusive message index to seed transcript through; default = all messages. */
|
|
110
|
+
throughIndex?: number;
|
|
111
|
+
agent?: AgentKind;
|
|
112
|
+
title?: string;
|
|
113
|
+
}
|
|
114
|
+
interface ThreadOptionsPatch {
|
|
115
|
+
agent?: AgentKind;
|
|
116
|
+
model?: string | null;
|
|
117
|
+
fast?: boolean;
|
|
118
|
+
planMode?: boolean;
|
|
119
|
+
autonomy?: Autonomy;
|
|
120
|
+
}
|
|
121
|
+
interface AgentStatus {
|
|
122
|
+
agent: AgentKind;
|
|
123
|
+
installed: boolean;
|
|
124
|
+
authenticated: boolean;
|
|
125
|
+
linearMcp: boolean;
|
|
126
|
+
warnings: string[];
|
|
127
|
+
reason?: string;
|
|
128
|
+
}
|
|
129
|
+
interface BranchInfo {
|
|
130
|
+
name: string;
|
|
131
|
+
remote: boolean;
|
|
132
|
+
current: boolean;
|
|
133
|
+
}
|
|
134
|
+
interface PrInfo {
|
|
135
|
+
number: number;
|
|
136
|
+
title: string;
|
|
137
|
+
headRefName: string;
|
|
138
|
+
url: string;
|
|
139
|
+
isCrossRepository: boolean;
|
|
140
|
+
}
|
|
141
|
+
/** One CI check from `gh pr checks --json`, or a synthetic merge/review gate. */
|
|
142
|
+
interface PrCheckRun {
|
|
143
|
+
name: string;
|
|
144
|
+
state: string;
|
|
145
|
+
bucket: 'pass' | 'fail' | 'pending' | 'skipping' | 'cancel' | string;
|
|
146
|
+
startedAt: string | null;
|
|
147
|
+
completedAt: string | null;
|
|
148
|
+
link: string | null;
|
|
149
|
+
description: string | null;
|
|
150
|
+
workflow: string | null;
|
|
151
|
+
/**
|
|
152
|
+
* Origin of the row. Omitted / `ci` = GitHub Actions / check suite.
|
|
153
|
+
* `mergeability` / `review` are Sideboard synthetics (conflicts, behind, review).
|
|
154
|
+
*/
|
|
155
|
+
kind?: 'ci' | 'mergeability' | 'review';
|
|
156
|
+
}
|
|
157
|
+
interface PrActor {
|
|
158
|
+
login: string;
|
|
159
|
+
name?: string | null;
|
|
160
|
+
}
|
|
161
|
+
interface PrCommitInfo {
|
|
162
|
+
oid: string;
|
|
163
|
+
messageHeadline: string;
|
|
164
|
+
committedDate: string;
|
|
165
|
+
authors: PrActor[];
|
|
166
|
+
}
|
|
167
|
+
interface PrCommentInfo {
|
|
168
|
+
author: PrActor;
|
|
169
|
+
body: string;
|
|
170
|
+
createdAt: string;
|
|
171
|
+
}
|
|
172
|
+
interface PrReviewInfo {
|
|
173
|
+
author: PrActor;
|
|
174
|
+
state: string;
|
|
175
|
+
body: string;
|
|
176
|
+
submittedAt: string | null;
|
|
177
|
+
}
|
|
178
|
+
/** Rich PR payload for Sideboard Review tab (`gh pr view --json`). */
|
|
179
|
+
interface PrDetails {
|
|
180
|
+
number: number;
|
|
181
|
+
title: string;
|
|
182
|
+
body: string;
|
|
183
|
+
url: string;
|
|
184
|
+
state: string;
|
|
185
|
+
isDraft: boolean;
|
|
186
|
+
reviewDecision: string | null;
|
|
187
|
+
author: PrActor;
|
|
188
|
+
baseRefName: string;
|
|
189
|
+
headRefName: string;
|
|
190
|
+
additions: number;
|
|
191
|
+
deletions: number;
|
|
192
|
+
changedFiles: number;
|
|
193
|
+
commits: PrCommitInfo[];
|
|
194
|
+
comments: PrCommentInfo[];
|
|
195
|
+
reviews: PrReviewInfo[];
|
|
196
|
+
checks: PrCheckRun[];
|
|
197
|
+
}
|
|
198
|
+
interface IssueInfo {
|
|
199
|
+
id: string;
|
|
200
|
+
identifier: string;
|
|
201
|
+
title: string;
|
|
202
|
+
url: string;
|
|
203
|
+
labels: string[];
|
|
204
|
+
/** When set, which tracker produced this issue. */
|
|
205
|
+
provider?: 'linear' | 'github';
|
|
206
|
+
}
|
|
207
|
+
interface DiffFile {
|
|
208
|
+
path: string;
|
|
209
|
+
/** Git name-status letter (M/A/D/R/…). */
|
|
210
|
+
status: string;
|
|
211
|
+
patch: string;
|
|
212
|
+
/** From `git diff --numstat` when available. */
|
|
213
|
+
additions?: number;
|
|
214
|
+
deletions?: number;
|
|
215
|
+
}
|
|
216
|
+
/** Cursor-style Changes panel filters. */
|
|
217
|
+
type DiffScope = 'last_turn' | 'uncommitted' | 'staged' | 'unstaged' | 'commits';
|
|
218
|
+
interface DiffScopeStat {
|
|
219
|
+
files: number;
|
|
220
|
+
additions: number;
|
|
221
|
+
deletions: number;
|
|
222
|
+
}
|
|
223
|
+
/** One commit on the branch (for the Changes → Commits submenu). */
|
|
224
|
+
interface DiffCommit {
|
|
225
|
+
sha: string;
|
|
226
|
+
shortSha: string;
|
|
227
|
+
subject: string;
|
|
228
|
+
relativeTime: string;
|
|
229
|
+
}
|
|
230
|
+
interface DiffResult {
|
|
231
|
+
/** Active filter for this result. */
|
|
232
|
+
scope: DiffScope;
|
|
233
|
+
/** When scope is commits and a single commit is selected. */
|
|
234
|
+
commitSha?: string | null;
|
|
235
|
+
base: string;
|
|
236
|
+
files: DiffFile[];
|
|
237
|
+
stat: string;
|
|
238
|
+
dirty: boolean;
|
|
239
|
+
/** Commits on HEAD not yet on the remote tracking branch (0 if none/unknown). */
|
|
240
|
+
unpushed: number;
|
|
241
|
+
/** Counts for each filter option (for the Changes dropdown). */
|
|
242
|
+
scopeStats: Record<DiffScope, DiffScopeStat>;
|
|
243
|
+
/** True when a last-agent-turn baseline is available. */
|
|
244
|
+
hasLastTurnBase: boolean;
|
|
245
|
+
/** Recent commits on the branch (vs merge-base), for the Commits flyout. */
|
|
246
|
+
commits: DiffCommit[];
|
|
247
|
+
}
|
|
248
|
+
interface LandPreview {
|
|
249
|
+
branch: string;
|
|
250
|
+
target: string;
|
|
251
|
+
diffStat: string;
|
|
252
|
+
dirty: boolean;
|
|
253
|
+
blocked: boolean;
|
|
254
|
+
blockReason?: string;
|
|
255
|
+
isFork: boolean;
|
|
256
|
+
}
|
|
257
|
+
interface LandResult {
|
|
258
|
+
prUrl: string;
|
|
259
|
+
pushed: boolean;
|
|
260
|
+
committed: boolean;
|
|
261
|
+
}
|
|
262
|
+
type AgentEvent = {
|
|
263
|
+
type: 'stdout';
|
|
264
|
+
data: string;
|
|
265
|
+
} | {
|
|
266
|
+
type: 'stderr';
|
|
267
|
+
data: string;
|
|
268
|
+
} | {
|
|
269
|
+
type: 'session_id';
|
|
270
|
+
data: string;
|
|
271
|
+
} | {
|
|
272
|
+
type: 'thinking';
|
|
273
|
+
data: string;
|
|
274
|
+
} | {
|
|
275
|
+
type: 'tool_use';
|
|
276
|
+
id: string;
|
|
277
|
+
name: string;
|
|
278
|
+
input?: Record<string, unknown>;
|
|
279
|
+
} | {
|
|
280
|
+
type: 'tool_result';
|
|
281
|
+
id: string;
|
|
282
|
+
content?: string;
|
|
283
|
+
isError?: boolean;
|
|
284
|
+
} | {
|
|
285
|
+
type: 'usage';
|
|
286
|
+
data: TokenUsage;
|
|
287
|
+
} | {
|
|
288
|
+
type: 'exit';
|
|
289
|
+
data: number | null;
|
|
290
|
+
};
|
|
291
|
+
type OrchestratorEvent = {
|
|
292
|
+
type: 'turn_started';
|
|
293
|
+
threadId: string;
|
|
294
|
+
prompt: string;
|
|
295
|
+
} | {
|
|
296
|
+
type: 'turn_output';
|
|
297
|
+
threadId: string;
|
|
298
|
+
event: AgentEvent;
|
|
299
|
+
} | {
|
|
300
|
+
type: 'turn_finished';
|
|
301
|
+
threadId: string;
|
|
302
|
+
exitCode: number | null;
|
|
303
|
+
} | {
|
|
304
|
+
type: 'status_changed';
|
|
305
|
+
threadId: string;
|
|
306
|
+
status: ThreadStatus;
|
|
307
|
+
} | {
|
|
308
|
+
type: 'queue_changed';
|
|
309
|
+
threadId: string;
|
|
310
|
+
queue: string[];
|
|
311
|
+
} | {
|
|
312
|
+
type: 'context_compacted';
|
|
313
|
+
threadId: string;
|
|
314
|
+
olderCount: number;
|
|
315
|
+
method: 'claude' | 'extractive';
|
|
316
|
+
} | {
|
|
317
|
+
type: 'dev_server_started';
|
|
318
|
+
threadId: string;
|
|
319
|
+
port: number;
|
|
320
|
+
scriptName?: string;
|
|
321
|
+
} | {
|
|
322
|
+
type: 'dev_server_stopped';
|
|
323
|
+
threadId: string;
|
|
324
|
+
scriptName?: string;
|
|
325
|
+
} | {
|
|
326
|
+
type: 'run_output';
|
|
327
|
+
threadId: string;
|
|
328
|
+
scriptName: string;
|
|
329
|
+
line: string;
|
|
330
|
+
} | {
|
|
331
|
+
type: 'setup_started';
|
|
332
|
+
threadId: string;
|
|
333
|
+
} | {
|
|
334
|
+
type: 'setup_output';
|
|
335
|
+
threadId: string;
|
|
336
|
+
line: string;
|
|
337
|
+
} | {
|
|
338
|
+
type: 'setup_finished';
|
|
339
|
+
threadId: string;
|
|
340
|
+
exitCode: number | null;
|
|
341
|
+
} | {
|
|
342
|
+
type: 'orphan_worktrees';
|
|
343
|
+
orphans: Array<{
|
|
344
|
+
path: string;
|
|
345
|
+
repoPath: string;
|
|
346
|
+
}>;
|
|
347
|
+
} | {
|
|
348
|
+
type: 'error';
|
|
349
|
+
threadId: string;
|
|
350
|
+
message: string;
|
|
351
|
+
};
|
|
352
|
+
/** Active named run script (in-memory + mirrored on thread for UI). */
|
|
353
|
+
interface ActiveRun {
|
|
354
|
+
scriptName: string;
|
|
355
|
+
port: number;
|
|
356
|
+
ports: number[];
|
|
357
|
+
startedAt: string;
|
|
358
|
+
}
|
|
359
|
+
/** Live snapshot for the global orchestrator board. */
|
|
360
|
+
interface OrchestratorRuntime {
|
|
361
|
+
running: number;
|
|
362
|
+
maxConcurrent: number;
|
|
363
|
+
queued: number;
|
|
364
|
+
idle: number;
|
|
365
|
+
error: number;
|
|
366
|
+
stopped: number;
|
|
367
|
+
broken: number;
|
|
368
|
+
totalActive: number;
|
|
369
|
+
}
|
|
370
|
+
interface CreateThreadInput {
|
|
371
|
+
sourceType: Exclude<SourceType, 'orchestration'>;
|
|
372
|
+
sourceRef: string;
|
|
373
|
+
agent: AgentKind;
|
|
374
|
+
repoPath: string;
|
|
375
|
+
autonomy?: Autonomy;
|
|
376
|
+
/** Claude model id, or Brightsy `agent:` / `model:` target encoding. */
|
|
377
|
+
model?: string | null;
|
|
378
|
+
fast?: boolean;
|
|
379
|
+
planMode?: boolean;
|
|
380
|
+
/** Attachments available to the first prompt (and subsequent turns). */
|
|
381
|
+
attachments?: ThreadAttachment[];
|
|
382
|
+
title?: string;
|
|
383
|
+
parentThreadId?: string | null;
|
|
384
|
+
/** Optional first prompt — queued after the thread is created (Conductor-style). */
|
|
385
|
+
prompt?: string;
|
|
386
|
+
}
|
|
387
|
+
interface AdoptInput {
|
|
388
|
+
worktreePath: string;
|
|
389
|
+
agent: AgentKind;
|
|
390
|
+
title?: string;
|
|
391
|
+
sessionId?: string | null;
|
|
392
|
+
messages?: ThreadMessage[];
|
|
393
|
+
sourceRef?: string;
|
|
394
|
+
}
|
|
395
|
+
interface ConductorWorkspace {
|
|
396
|
+
id: string;
|
|
397
|
+
workspacePath: string;
|
|
398
|
+
branch: string;
|
|
399
|
+
workspaceName: string;
|
|
400
|
+
prTitle: string | null;
|
|
401
|
+
prDescription: string | null;
|
|
402
|
+
intendedTargetBranch: string | null;
|
|
403
|
+
notes: string | null;
|
|
404
|
+
claudeSessionId: string | null;
|
|
405
|
+
agentType: AgentKind | null;
|
|
406
|
+
messageCount: number;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
declare function appDataDir(): string;
|
|
410
|
+
declare function threadsDir(): string;
|
|
411
|
+
declare function locksDir(): string;
|
|
412
|
+
/** Conductor-style home root: ~/sideboard */
|
|
413
|
+
declare function sideboardHomeDir(): string;
|
|
414
|
+
declare function sideboardReposDir(): string;
|
|
415
|
+
declare function sideboardWorkspacesDir(): string;
|
|
416
|
+
declare function repoSlug(repoPath: string): string;
|
|
417
|
+
/**
|
|
418
|
+
* Worktree root for a repo (new threads).
|
|
419
|
+
* Default: ~/sideboard/workspaces/<repo-slug>/
|
|
420
|
+
* Override via [.sideboard|.conductor]/settings.toml [worktrees] root = "..."
|
|
421
|
+
*
|
|
422
|
+
* Existing threads keep whatever absolute worktreePath is stored on their record,
|
|
423
|
+
* so older repo-local checkouts continue to work until archived.
|
|
424
|
+
*/
|
|
425
|
+
declare function worktreesRoot(repoPath: string): string;
|
|
426
|
+
declare function threadFilePath(id: string): string;
|
|
427
|
+
declare function threadLockPath(id: string): string;
|
|
428
|
+
/** Empty synthetic cwd for global orchestration agents (not a git worktree). */
|
|
429
|
+
declare function globalAgentCwd(): string;
|
|
430
|
+
|
|
431
|
+
/** Well-known env keys managed from Settings → Agents (Conductor-style harnesses). */
|
|
432
|
+
declare const HARNESS_ENV_KEYS: {
|
|
433
|
+
readonly claude: "ANTHROPIC_API_KEY";
|
|
434
|
+
readonly codex: "CODEX_API_KEY";
|
|
435
|
+
readonly cursor: "CURSOR_API_KEY";
|
|
436
|
+
readonly opencode: null;
|
|
437
|
+
readonly brightsy: null;
|
|
438
|
+
};
|
|
439
|
+
type HarnessId = keyof typeof HARNESS_ENV_KEYS;
|
|
440
|
+
/** Claude Code harness options (executable override + Chrome). */
|
|
441
|
+
interface ClaudeHarnessSettings {
|
|
442
|
+
/** Absolute path to Claude Code. Empty/omitted = `claude` on PATH. */
|
|
443
|
+
executablePath?: string;
|
|
444
|
+
/** When true, pass `--chrome` on Claude turns. */
|
|
445
|
+
chromeEnabled?: boolean;
|
|
446
|
+
}
|
|
447
|
+
/** Local agent that runs the Brightsy cloud coordinator. */
|
|
448
|
+
type BrightsyCloudConnectAgent = 'claude' | 'codex' | 'opencode' | 'cursor';
|
|
449
|
+
/** Brightsy cloud remote-orchestrator preferences (Slack / Discord / Teams). */
|
|
450
|
+
interface BrightsyHarnessSettings {
|
|
451
|
+
/** When true, desktop app polls Brightsy for Sideboard cloud tasks. */
|
|
452
|
+
cloudConnectEnabled?: boolean;
|
|
453
|
+
/** Local agent used for the cloud coordinator (not Brightsy itself). */
|
|
454
|
+
cloudConnectAgent?: BrightsyCloudConnectAgent;
|
|
455
|
+
}
|
|
456
|
+
/** Preferred issue tracker for Create-from / Link issue. */
|
|
457
|
+
type IssueSource = 'linear' | 'github';
|
|
458
|
+
/**
|
|
459
|
+
* Sideboard-owned third-party connections (Account / Integrations).
|
|
460
|
+
* GitHub uses machine `gh` auth; Linear uses a stored API key.
|
|
461
|
+
*/
|
|
462
|
+
interface IntegrationsSettings {
|
|
463
|
+
/** Linear personal API key (https://linear.app/settings/api). */
|
|
464
|
+
linearApiKey?: string;
|
|
465
|
+
/**
|
|
466
|
+
* Preferred issue source for Create-from / Link issue (default: GitHub).
|
|
467
|
+
* When `linear` but no API key, runtime falls back to GitHub Issues.
|
|
468
|
+
*/
|
|
469
|
+
issueSource?: IssueSource;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Conductor-inspired power-user preferences (Settings → Advanced).
|
|
473
|
+
* Defaults match Conductor where applicable (auto-rename on, others off).
|
|
474
|
+
*/
|
|
475
|
+
interface AdvancedAppSettings {
|
|
476
|
+
/**
|
|
477
|
+
* Ask the agent to rename the temporary `thread/<team>` branch on first send.
|
|
478
|
+
* Conductor: Git → “Auto-rename placeholder branch on send” (default on).
|
|
479
|
+
*/
|
|
480
|
+
autoRenameBranch?: boolean;
|
|
481
|
+
/**
|
|
482
|
+
* After workspace setup finishes, start the default run/dev script.
|
|
483
|
+
* Conductor: `scripts.auto_run_after_setup` (default off).
|
|
484
|
+
*/
|
|
485
|
+
autoRunAfterSetup?: boolean;
|
|
486
|
+
/**
|
|
487
|
+
* Keep the Mac awake with `caffeinate` while any agent turn is running.
|
|
488
|
+
* Conductor: General → “Caffeinate while agents are running”.
|
|
489
|
+
*/
|
|
490
|
+
caffeinateWhileRunning?: boolean;
|
|
491
|
+
/**
|
|
492
|
+
* Keep the Mac awake with `caffeinate` while Brightsy cloud connect is listening
|
|
493
|
+
* (so Slack/Discord/Teams tasks can be polled). Default off.
|
|
494
|
+
*/
|
|
495
|
+
caffeinateWhileCloudConnect?: boolean;
|
|
496
|
+
/**
|
|
497
|
+
* When purging a thread, also delete its git branch.
|
|
498
|
+
* Conductor: `git.delete_branch_on_archive` (default off).
|
|
499
|
+
*/
|
|
500
|
+
deleteBranchOnPurge?: boolean;
|
|
501
|
+
/** Max concurrent agent turns across the orchestrator (default 3). */
|
|
502
|
+
maxConcurrent?: number;
|
|
503
|
+
/**
|
|
504
|
+
* Max Sideboard worktrees kept machine-wide before orphan cleanup
|
|
505
|
+
* (Cursor: cursor.worktreeMaxCount, default 25).
|
|
506
|
+
*/
|
|
507
|
+
worktreeMaxCount?: number;
|
|
508
|
+
/** Hours between automatic orphan worktree cleanup passes (default 6). */
|
|
509
|
+
worktreeCleanupIntervalHours?: number;
|
|
510
|
+
/** ISO timestamp of last successful orphan cleanup. */
|
|
511
|
+
worktreeLastCleanupAt?: string;
|
|
512
|
+
/** When true, reconcile auto-removes excess orphan worktrees. */
|
|
513
|
+
autoCleanupOrphans?: boolean;
|
|
514
|
+
}
|
|
515
|
+
interface AppSettings {
|
|
516
|
+
/** Environment variables injected into agent / hook processes (and process.env). */
|
|
517
|
+
environment: Record<string, string>;
|
|
518
|
+
/** Claude Code–specific harness settings. */
|
|
519
|
+
claude: ClaudeHarnessSettings;
|
|
520
|
+
/** Brightsy cloud connect preferences (Slack / Discord / Teams). */
|
|
521
|
+
brightsy: BrightsyHarnessSettings;
|
|
522
|
+
/** GitHub / Linear connections and issue-source preference. */
|
|
523
|
+
integrations: IntegrationsSettings;
|
|
524
|
+
/** Power-user / Conductor-style advanced preferences. */
|
|
525
|
+
advanced: AdvancedAppSettings;
|
|
526
|
+
}
|
|
527
|
+
declare function appSettingsPath(): string;
|
|
528
|
+
/** User-level Claude Code settings file (`~/.claude/settings.json`). */
|
|
529
|
+
declare function claudeUserSettingsPath(): string;
|
|
530
|
+
declare function loadAppSettings(): AppSettings;
|
|
531
|
+
declare function saveAppSettings(settings: AppSettings): AppSettings;
|
|
532
|
+
declare function updateAppEnvironment(patch: Record<string, string | null | undefined>): AppSettings;
|
|
533
|
+
declare function updateClaudeSettings(patch: {
|
|
534
|
+
executablePath?: string | null;
|
|
535
|
+
chromeEnabled?: boolean;
|
|
536
|
+
}): AppSettings;
|
|
537
|
+
declare function updateBrightsySettings(patch: {
|
|
538
|
+
cloudConnectEnabled?: boolean;
|
|
539
|
+
cloudConnectAgent?: BrightsyCloudConnectAgent | null;
|
|
540
|
+
}): AppSettings;
|
|
541
|
+
declare function updateIntegrationsSettings(patch: {
|
|
542
|
+
linearApiKey?: string | null;
|
|
543
|
+
issueSource?: IssueSource | null;
|
|
544
|
+
}): AppSettings;
|
|
545
|
+
/** True when Sideboard has a Linear API key stored. */
|
|
546
|
+
declare function isLinearConnected(settings?: AppSettings): boolean;
|
|
547
|
+
/** Preferred issue source (default GitHub). */
|
|
548
|
+
declare function getIssueSource(settings?: AppSettings): IssueSource;
|
|
549
|
+
/**
|
|
550
|
+
* Runtime issue source: honors preference, but falls back to GitHub when
|
|
551
|
+
* Linear is preferred and not connected.
|
|
552
|
+
*/
|
|
553
|
+
declare function resolveEffectiveIssueSource(settings?: AppSettings): IssueSource;
|
|
554
|
+
declare function getLinearApiKey(settings?: AppSettings): string | null;
|
|
555
|
+
declare function brightsyCloudConnectEnabled(settings?: AppSettings): boolean;
|
|
556
|
+
declare function brightsyCloudConnectAgent(settings?: AppSettings): BrightsyCloudConnectAgent;
|
|
557
|
+
declare function updateAdvancedSettings(patch: Partial<AdvancedAppSettings>): AppSettings;
|
|
558
|
+
/** Conductor default: on. */
|
|
559
|
+
declare function autoRenameBranchEnabled(settings?: AppSettings): boolean;
|
|
560
|
+
declare function autoRunAfterSetupEnabled(settings?: AppSettings): boolean;
|
|
561
|
+
declare function caffeinateWhileRunningEnabled(settings?: AppSettings): boolean;
|
|
562
|
+
declare function caffeinateWhileCloudConnectEnabled(settings?: AppSettings): boolean;
|
|
563
|
+
declare function deleteBranchOnPurgeEnabled(settings?: AppSettings): boolean;
|
|
564
|
+
declare function autoCleanupOrphansEnabled(settings?: AppSettings): boolean;
|
|
565
|
+
declare function maxConcurrentAgents(settings?: AppSettings): number;
|
|
566
|
+
/** Binary name or absolute path used to spawn Claude Code. */
|
|
567
|
+
declare function resolveClaudeExecutable(settings?: AppSettings): string;
|
|
568
|
+
declare function claudeChromeEnabled(settings?: AppSettings): boolean;
|
|
569
|
+
/**
|
|
570
|
+
* Apply Sideboard-managed environment onto a process env object.
|
|
571
|
+
* Does not overwrite keys already set in the host environment (shell wins),
|
|
572
|
+
* matching Conductor's "shell or Settings" layering for credentials.
|
|
573
|
+
*/
|
|
574
|
+
declare function applyAppEnvironment(target?: NodeJS.ProcessEnv, settings?: AppSettings): NodeJS.ProcessEnv;
|
|
575
|
+
/** Env for a child process: host env + Sideboard settings (settings fill gaps). */
|
|
576
|
+
declare function childEnvWithAppSettings(extra?: Record<string, string | undefined>): NodeJS.ProcessEnv;
|
|
577
|
+
declare function harnessEnvKey(harness: HarnessId): string | null;
|
|
578
|
+
|
|
579
|
+
declare function normalizeThread(raw: Thread): Thread;
|
|
580
|
+
declare function createEmptyThread(partial: Omit<Thread, 'id' | 'createdAt' | 'updatedAt' | 'messages' | 'queue' | 'status' | 'devPort' | 'activeRuns' | 'prUrl' | 'prTitle' | 'userSetTitle' | 'sessionId' | 'sourceIsFork' | 'parentThreadId' | 'autonomy' | 'model' | 'fast' | 'planMode' | 'attachments'> & Partial<Pick<Thread, 'sessionId' | 'sourceIsFork' | 'parentThreadId' | 'autonomy' | 'model' | 'fast' | 'planMode' | 'messages' | 'queue' | 'status' | 'devPort' | 'activeRuns' | 'prUrl' | 'prTitle' | 'userSetTitle' | 'attachments'>>): Thread;
|
|
581
|
+
declare function withThreadLock<T>(id: string, fn: () => Promise<T>): Promise<T>;
|
|
582
|
+
declare function readThread(id: string): Thread | null;
|
|
583
|
+
declare function writeThread(thread: Thread): void;
|
|
584
|
+
declare function listThreads(opts?: {
|
|
585
|
+
includeArchived?: boolean;
|
|
586
|
+
}): Thread[];
|
|
587
|
+
declare function deleteThreadRecord(id: string): void;
|
|
588
|
+
declare function updateThread(id: string, patch: Partial<Thread>): Thread;
|
|
589
|
+
declare function appendMessage(id: string, message: ThreadMessage): Thread;
|
|
590
|
+
declare function setStatus(id: string, status: ThreadStatus, lastError?: string | null): Thread;
|
|
591
|
+
declare function findThreadByRef(ref: string): Thread | null;
|
|
592
|
+
|
|
593
|
+
interface Workspace {
|
|
594
|
+
path: string;
|
|
595
|
+
name: string;
|
|
596
|
+
addedAt: string;
|
|
597
|
+
}
|
|
598
|
+
declare function listWorkspaces(): Workspace[];
|
|
599
|
+
declare function addWorkspace(repoPath: string): Promise<Workspace>;
|
|
600
|
+
declare function removeWorkspace(repoPath: string): void;
|
|
601
|
+
/** Ensure a repo path is registered (e.g. after creating a thread). */
|
|
602
|
+
declare function ensureWorkspace(repoPath: string): Promise<Workspace>;
|
|
603
|
+
/** Merge in repo paths discovered from existing threads. */
|
|
604
|
+
declare function syncWorkspacesFromThreads(repoPaths: string[]): Workspace[];
|
|
605
|
+
|
|
606
|
+
/** Sentinel repoPath for the home-less global orchestration workspace. */
|
|
607
|
+
declare const GLOBAL_WORKSPACE_ID = "__global__";
|
|
608
|
+
declare function isGlobalThread(thread: Pick<Thread, 'repoPath'> | null | undefined): boolean;
|
|
609
|
+
declare function isGlobalRepoPath(repoPath: string | null | undefined): boolean;
|
|
610
|
+
|
|
611
|
+
/** True for Global chats and legacy pinned-repo orchestration threads. */
|
|
612
|
+
declare function isOrchestratorThread(thread: Pick<Thread, 'sourceType' | 'repoPath'> | null | undefined): boolean;
|
|
613
|
+
/**
|
|
614
|
+
* True when a Global/orchestrator Claude session acted like a worktree coder
|
|
615
|
+
* (Bash/Read/etc) without ever calling Sideboard MCP — resume would keep that
|
|
616
|
+
* wrong identity ("empty worktree / not a git repo").
|
|
617
|
+
*/
|
|
618
|
+
declare function orchestratorSessionPoisonedByBuiltins(thread: Pick<Thread, 'messages'> | null | undefined): boolean;
|
|
619
|
+
declare function isCloudCoordinatorThread(thread: Pick<Thread, 'sourceType' | 'sourceRef' | 'title' | 'repoPath'>): boolean;
|
|
620
|
+
/** True when an orchestration chat still needs a soccer-team nickname. */
|
|
621
|
+
declare function orchestrationTitleNeedsSoccerNickname(thread: Pick<Thread, 'title' | 'sourceRef' | 'sourceType' | 'repoPath' | 'userSetTitle'>): boolean;
|
|
622
|
+
interface CreateGlobalChatOpts {
|
|
623
|
+
title?: string;
|
|
624
|
+
agent: AgentKind;
|
|
625
|
+
/** Goal / cloud marker on sourceRef. Title is always a soccer nickname. Cloud uses CLOUD_ORCHESTRATOR_GOAL as sourceRef. */
|
|
626
|
+
sourceRef?: string;
|
|
627
|
+
autonomy?: Autonomy;
|
|
628
|
+
model?: string | null;
|
|
629
|
+
fast?: boolean;
|
|
630
|
+
planMode?: boolean;
|
|
631
|
+
attachments?: ThreadAttachment[];
|
|
632
|
+
parentThreadId?: string | null;
|
|
633
|
+
}
|
|
634
|
+
/** Soccer-team slugs already used by active threads (orchestration + worktrees). */
|
|
635
|
+
declare function takenTeamSlugsForOrchestration(): string[];
|
|
636
|
+
/** Create a home-less orchestration chat under the Global workspace. */
|
|
637
|
+
declare function createGlobalChat(opts: CreateGlobalChatOpts): Thread;
|
|
638
|
+
/**
|
|
639
|
+
* Assign soccer nicknames to orchestration chats still using the cloud goal
|
|
640
|
+
* string, Untitled, or goal-as-title. Called from reconcile.
|
|
641
|
+
*/
|
|
642
|
+
declare function healOrchestrationSoccerTitles(): number;
|
|
643
|
+
declare function listGlobalThreads(includeArchived?: boolean): Thread[];
|
|
644
|
+
/** Find or create the singleton Brightsy cloud coordinator under Global. */
|
|
645
|
+
declare function ensureCloudCoordinator(agent: AgentKind): Thread;
|
|
646
|
+
|
|
647
|
+
declare function run(file: string, args: string[], opts?: {
|
|
648
|
+
cwd?: string;
|
|
649
|
+
reject?: boolean;
|
|
650
|
+
env?: Record<string, string>;
|
|
651
|
+
}): Promise<{
|
|
652
|
+
stdout: string;
|
|
653
|
+
stderr: string;
|
|
654
|
+
exitCode: number;
|
|
655
|
+
}>;
|
|
656
|
+
declare function git(args: string[], cwd: string, opts?: {
|
|
657
|
+
reject?: boolean;
|
|
658
|
+
}): Promise<{
|
|
659
|
+
stdout: string;
|
|
660
|
+
stderr: string;
|
|
661
|
+
exitCode: number;
|
|
662
|
+
}>;
|
|
663
|
+
declare function gh(args: string[], cwd: string, opts?: {
|
|
664
|
+
reject?: boolean;
|
|
665
|
+
}): Promise<{
|
|
666
|
+
stdout: string;
|
|
667
|
+
stderr: string;
|
|
668
|
+
exitCode: number;
|
|
669
|
+
}>;
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Memorable worktree / thread labels (Conductor-style nicknames).
|
|
673
|
+
* Slug is the directory + `thread/<slug>` branch; `name` is the UI title.
|
|
674
|
+
*/
|
|
675
|
+
interface TeamName {
|
|
676
|
+
name: string;
|
|
677
|
+
slug: string;
|
|
678
|
+
}
|
|
679
|
+
/** Famous soccer clubs — short, recognizable thread labels. */
|
|
680
|
+
declare const FAMOUS_SOCCER_TEAMS: readonly TeamName[];
|
|
681
|
+
declare function allocateTeamName(taken: Iterable<string>, random?: () => number): TeamName;
|
|
682
|
+
|
|
683
|
+
/** Canonical worktree path for grouping tabs (browser-safe, no node:path). */
|
|
684
|
+
declare function normalizeWorktreePath(worktreePath: string): string;
|
|
685
|
+
declare function worktreeNameFromPath(worktreePath: string): string;
|
|
686
|
+
/**
|
|
687
|
+
* True while the branch is still the Sideboard/Conductor-style placeholder
|
|
688
|
+
* (`thread/<soccer-team>` or equal to the worktree directory name).
|
|
689
|
+
*/
|
|
690
|
+
declare function isPlaceholderBranch(branchName: string, worktreePath: string): boolean;
|
|
691
|
+
/** Branch shown in the UI — team nickname while placeholder, else the real branch. */
|
|
692
|
+
declare function branchDisplayLabel(branchName: string, worktreePath: string): string;
|
|
693
|
+
/**
|
|
694
|
+
* Conductor-style sidebar label:
|
|
695
|
+
* user override → PR title → branch (task name after rename) → soccer-team nickname.
|
|
696
|
+
*/
|
|
697
|
+
declare function threadDisplayLabel(thread: {
|
|
698
|
+
branchName: string;
|
|
699
|
+
worktreePath: string;
|
|
700
|
+
title?: string | null;
|
|
701
|
+
prTitle?: string | null;
|
|
702
|
+
userSetTitle?: boolean;
|
|
703
|
+
}): string;
|
|
704
|
+
/** @deprecated Prefer threadDisplayLabel — kept for call sites that only have branch/path. */
|
|
705
|
+
declare function worktreeDisplayLabel(thread: {
|
|
706
|
+
branchName: string;
|
|
707
|
+
worktreePath: string;
|
|
708
|
+
title?: string | null;
|
|
709
|
+
prTitle?: string | null;
|
|
710
|
+
userSetTitle?: boolean;
|
|
711
|
+
}): string;
|
|
712
|
+
/** Stable worktree row label for a group of chat tabs. */
|
|
713
|
+
declare function worktreeDisplayLabelForGroup(threads: {
|
|
714
|
+
branchName: string;
|
|
715
|
+
worktreePath: string;
|
|
716
|
+
createdAt: string;
|
|
717
|
+
title?: string | null;
|
|
718
|
+
prTitle?: string | null;
|
|
719
|
+
userSetTitle?: boolean;
|
|
720
|
+
}[]): string;
|
|
721
|
+
|
|
722
|
+
declare function slugify(input: string): string;
|
|
723
|
+
declare function resolveRepoRoot(cwd: string): Promise<string>;
|
|
724
|
+
/**
|
|
725
|
+
* Parse `owner/name` from a git remote URL (SSH or HTTPS).
|
|
726
|
+
*/
|
|
727
|
+
declare function parseGithubSlugFromRemoteUrl(url: string): string | null;
|
|
728
|
+
/**
|
|
729
|
+
* Resolve `owner/name` for the GitHub repository connected to a local checkout.
|
|
730
|
+
* Used so Create-from PR/issue lists always target the selected workspace's remote
|
|
731
|
+
* (not whatever `gh` might infer from process cwd / upstream).
|
|
732
|
+
*
|
|
733
|
+
* Prefer **origin** over `gh repo view`. On Makerkit-style checkouts with both
|
|
734
|
+
* `origin` (your fork/product) and `upstream` (template), `gh repo view` often
|
|
735
|
+
* resolves to upstream — which lists the wrong open PRs in the create modal.
|
|
736
|
+
*/
|
|
737
|
+
declare function resolveGithubRepoSlug(repoPath: string): Promise<string | null>;
|
|
738
|
+
declare function resolveDefaultBranch(repoPath: string): Promise<string>;
|
|
739
|
+
/**
|
|
740
|
+
* Prefer `origin/<branch>` for diff/merge-base so Changes / Land don't inflate
|
|
741
|
+
* against a stale local default-branch tip (common after adopting a PR).
|
|
742
|
+
* Bare names like `main` upgrade when the remote-tracking ref exists; already-
|
|
743
|
+
* qualified refs (`origin/main`, `refs/…`) are left alone.
|
|
744
|
+
*
|
|
745
|
+
* `fallbackCwd` (usually the main repo) is tried when the worktree can't see
|
|
746
|
+
* the remote-tracking ref.
|
|
747
|
+
*/
|
|
748
|
+
declare function resolveDiffBaseRef(cwd: string, branchOrRef: string, fallbackCwd?: string): Promise<string>;
|
|
749
|
+
declare function listBranches(repoPath: string, opts?: {
|
|
750
|
+
unmergedOnly?: boolean;
|
|
751
|
+
}): Promise<BranchInfo[]>;
|
|
752
|
+
declare function listPrs(repoPath: string): Promise<PrInfo[]>;
|
|
753
|
+
declare function getPr(repoPath: string, number: number): Promise<PrInfo | null>;
|
|
754
|
+
/** Prefer PR URL, then PR source ref, then branch name for `gh pr …`. */
|
|
755
|
+
declare function resolvePrSelector(thread: Pick<Thread, 'prUrl' | 'sourceType' | 'sourceRef' | 'branchName'>): string | null;
|
|
756
|
+
/**
|
|
757
|
+
* Local conflict probe for when GitHub reports mergeable=UNKNOWN (common) or
|
|
758
|
+
* when `gh` can't see mergeability. Merges HEAD into `origin/<base>` via
|
|
759
|
+
* `git merge-tree --write-tree` (exit 1 + "CONFLICT" ⇒ conflicts).
|
|
760
|
+
*/
|
|
761
|
+
declare function detectLocalMergeConflicts(cwd: string, baseRefName: string | null): Promise<{
|
|
762
|
+
conflicting: boolean;
|
|
763
|
+
base: string;
|
|
764
|
+
files: string[];
|
|
765
|
+
}>;
|
|
766
|
+
/** CI checks for a PR (`gh pr checks <selector> --json …`), plus synthetic
|
|
767
|
+
* mergeability / review rows (conflicts are not reported by `gh pr checks`).
|
|
768
|
+
* Returns `null` when no PR exists for the selector (so UI can show “link a PR”
|
|
769
|
+
* instead of “no checks yet”). Returns `[]` when a PR exists but has no checks. */
|
|
770
|
+
declare function getPrChecks(cwd: string, selector: string): Promise<PrCheckRun[] | null>;
|
|
771
|
+
/** PR description / commits / reviews (+ checks) for the Review tab. */
|
|
772
|
+
declare function getPrDetails(cwd: string, selector: string): Promise<PrDetails | null>;
|
|
773
|
+
declare function fetchPrHead(repoPath: string, number: number, localBranch: string): Promise<void>;
|
|
774
|
+
interface CreateWorktreeResult {
|
|
775
|
+
branchName: string;
|
|
776
|
+
worktreePath: string;
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Prefer an up-to-date remote tip (`origin/<branch>`) after fetch so new
|
|
780
|
+
* worktrees don't fork from a stale local main/master.
|
|
781
|
+
* Local-only refs (e.g. fetched PR heads, existing thread branches) stay local.
|
|
782
|
+
*/
|
|
783
|
+
declare function resolveWorktreeStartPoint(repoPath: string, sourceRef: string): Promise<string>;
|
|
784
|
+
declare function createThreadWorktree(opts: {
|
|
785
|
+
repoPath: string;
|
|
786
|
+
sourceRef: string;
|
|
787
|
+
slug: string;
|
|
788
|
+
}): Promise<CreateWorktreeResult>;
|
|
789
|
+
declare function removeWorktree(repoPath: string, worktreePath: string, opts?: {
|
|
790
|
+
deleteBranch?: string;
|
|
791
|
+
}): Promise<void>;
|
|
792
|
+
declare function listWorktrees(repoPath: string): Promise<Array<{
|
|
793
|
+
path: string;
|
|
794
|
+
branch: string | null;
|
|
795
|
+
}>>;
|
|
796
|
+
declare function isDirty(worktreePath: string): Promise<boolean>;
|
|
797
|
+
declare function currentBranch(worktreePath: string): Promise<string>;
|
|
798
|
+
declare function commitAll(worktreePath: string, message: string): Promise<boolean>;
|
|
799
|
+
declare function pushBranch(worktreePath: string, branchName: string): Promise<void>;
|
|
800
|
+
/** Merge an open pull request via `gh pr merge` (squash by default).
|
|
801
|
+
* Draft PRs are marked ready first — GitHub rejects merge while still draft. */
|
|
802
|
+
declare function mergePr(cwd: string, selector: string, opts?: {
|
|
803
|
+
method?: 'merge' | 'squash' | 'rebase';
|
|
804
|
+
}): Promise<{
|
|
805
|
+
url: string;
|
|
806
|
+
state: string;
|
|
807
|
+
}>;
|
|
808
|
+
declare function createOrUpdatePr(worktreePath: string, opts: {
|
|
809
|
+
title: string;
|
|
810
|
+
body?: string;
|
|
811
|
+
base: string;
|
|
812
|
+
head: string;
|
|
813
|
+
draft?: boolean;
|
|
814
|
+
/** Open the GitHub PR form in the browser instead of creating via API. */
|
|
815
|
+
web?: boolean;
|
|
816
|
+
}): Promise<string>;
|
|
817
|
+
/** @deprecated Prefer allocateTeamSlug — kept for any external callers. */
|
|
818
|
+
declare function suggestSlug(source: string): string;
|
|
819
|
+
|
|
820
|
+
/** Slugs already used by worktree dirs, thread records, or `thread/<slug>` branches. */
|
|
821
|
+
declare function collectTakenTeamSlugs(repoPath: string): Set<string>;
|
|
822
|
+
/** Pick an unused soccer team for the worktree directory / branch slug. */
|
|
823
|
+
declare function allocateTeamSlug(repoPath: string): TeamName;
|
|
824
|
+
|
|
825
|
+
interface GitHubStatus {
|
|
826
|
+
connected: boolean;
|
|
827
|
+
login: string | null;
|
|
828
|
+
/** Hosts reported by `gh auth status` (usually github.com). */
|
|
829
|
+
hosts: string[];
|
|
830
|
+
/** Human-readable summary when disconnected. */
|
|
831
|
+
reason: string | null;
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Machine-global GitHub auth via the `gh` CLI (same path Sideboard uses for PRs).
|
|
835
|
+
*/
|
|
836
|
+
declare function getGitHubStatus(): Promise<GitHubStatus>;
|
|
837
|
+
/** Open interactive `gh auth login` in a terminal-friendly way (caller may spawn UI). */
|
|
838
|
+
declare function refreshGitHubAuth(): Promise<GitHubStatus>;
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* List open issues assigned to the authenticated Linear user via GraphQL.
|
|
842
|
+
* Uses Sideboard-stored API key (Account → Linear), not agent MCP.
|
|
843
|
+
*/
|
|
844
|
+
declare function listLinearIssuesDirect(opts?: {
|
|
845
|
+
limit?: number;
|
|
846
|
+
apiKey?: string | null;
|
|
847
|
+
}): Promise<IssueInfo[]>;
|
|
848
|
+
/** Probe Linear with the stored key (or provided key). */
|
|
849
|
+
declare function validateLinearApiKey(apiKey: string): Promise<boolean>;
|
|
850
|
+
|
|
851
|
+
interface ListIssuesResult {
|
|
852
|
+
source: IssueSource;
|
|
853
|
+
/** Preference before fallback (useful for “Set up Linear” UI). */
|
|
854
|
+
preferredSource: IssueSource;
|
|
855
|
+
linearConnected: boolean;
|
|
856
|
+
issues: IssueInfo[];
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* List GitHub Issues for the repo via `gh` (machine-global auth).
|
|
860
|
+
* Scoped to the workspace's connected GitHub remote via `--repo`.
|
|
861
|
+
*/
|
|
862
|
+
declare function listGitHubIssues(repoPath: string, opts?: {
|
|
863
|
+
limit?: number;
|
|
864
|
+
}): Promise<IssueInfo[]>;
|
|
865
|
+
/**
|
|
866
|
+
* Unified issue list for Create-from / Link issue / MCP / CLI.
|
|
867
|
+
* Uses Sideboard Account connections — not agent Linear MCP.
|
|
868
|
+
*/
|
|
869
|
+
declare function listIssues(repoPath: string): Promise<ListIssuesResult>;
|
|
870
|
+
|
|
871
|
+
/**
|
|
872
|
+
* Turn payload for agent CLIs.
|
|
873
|
+
* `cachedPrefix` is stable context (instructions, conversation seed) sent before
|
|
874
|
+
* the varying current request. Claude Code injects Anthropic cache_control on the
|
|
875
|
+
* assembled API request (system + tools + messages, max 4). Sideboard must not use
|
|
876
|
+
* `--input-format stream-json` for user input or attach cache_control — either
|
|
877
|
+
* adds a fifth breakpoint and triggers API 400 "Found 5".
|
|
878
|
+
*/
|
|
879
|
+
interface AgentTurnInput {
|
|
880
|
+
/** Stable prefix — instructions / session seed (cacheable, but no cache_control). */
|
|
881
|
+
cachedPrefix?: string;
|
|
882
|
+
/** Current user/turn content (after the stable prefix). */
|
|
883
|
+
prompt: string;
|
|
884
|
+
}
|
|
885
|
+
declare function normalizeTurnInput(input: string | AgentTurnInput): Required<Pick<AgentTurnInput, 'prompt'>> & AgentTurnInput;
|
|
886
|
+
/**
|
|
887
|
+
* Flatten to a single string for CLIs that don't accept cache_control blocks
|
|
888
|
+
* (Codex today; OpenCode `run` is plain text — OpenCode applies provider caching
|
|
889
|
+
* internally after it receives the message).
|
|
890
|
+
*/
|
|
891
|
+
declare function flattenTurnInput(input: string | AgentTurnInput): string;
|
|
892
|
+
/** Anthropic cache breakpoint shape (used when validating assembled requests). */
|
|
893
|
+
type AnthropicCacheControl = {
|
|
894
|
+
type: 'ephemeral';
|
|
895
|
+
ttl?: '5m' | '1h';
|
|
896
|
+
};
|
|
897
|
+
/**
|
|
898
|
+
* Anthropic content blocks for Claude stream-json user messages (legacy/tests).
|
|
899
|
+
* Production Claude turns use plain-text `-p` — see claudeAdapter.buildTurn.
|
|
900
|
+
* Always a single text block — never attach cache_control here.
|
|
901
|
+
*/
|
|
902
|
+
declare function buildCachedUserContent(input: string | AgentTurnInput): Array<{
|
|
903
|
+
type: 'text';
|
|
904
|
+
text: string;
|
|
905
|
+
}>;
|
|
906
|
+
/** NDJSON stdin line for `claude -p --input-format stream-json`. */
|
|
907
|
+
declare function buildClaudeStreamJsonUserMessage(input: string | AgentTurnInput): string;
|
|
908
|
+
type CacheControlCarrier = {
|
|
909
|
+
cache_control?: AnthropicCacheControl;
|
|
910
|
+
content?: unknown;
|
|
911
|
+
};
|
|
912
|
+
/**
|
|
913
|
+
* Walk nested Anthropic content blocks and verify 1h breakpoints never follow 5m
|
|
914
|
+
* ones (Anthropic rejects requests that violate this ordering).
|
|
915
|
+
*/
|
|
916
|
+
declare function findInvalidCacheControlTtlOrder(blocks: CacheControlCarrier[] | undefined): {
|
|
917
|
+
index: number;
|
|
918
|
+
ttl: '1h' | '5m';
|
|
919
|
+
} | null;
|
|
920
|
+
/** Count cache_control blocks in nested Anthropic content (API max is 4). */
|
|
921
|
+
declare function countCacheControlBlocks(blocks: CacheControlCarrier[] | undefined): number;
|
|
922
|
+
/** Anthropic allows at most four cache_control blocks per request. */
|
|
923
|
+
declare const MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS = 4;
|
|
924
|
+
|
|
925
|
+
interface TurnCommand {
|
|
926
|
+
file: string;
|
|
927
|
+
args: string[];
|
|
928
|
+
cwd: string;
|
|
929
|
+
env?: Record<string, string>;
|
|
930
|
+
/** When set, written to the child process stdin (e.g. Claude stream-json). */
|
|
931
|
+
stdin?: string;
|
|
932
|
+
}
|
|
933
|
+
interface AttachCommand {
|
|
934
|
+
file: string;
|
|
935
|
+
args: string[];
|
|
936
|
+
cwd: string;
|
|
937
|
+
env?: Record<string, string>;
|
|
938
|
+
}
|
|
939
|
+
interface AgentAdapter {
|
|
940
|
+
kind: AgentKind;
|
|
941
|
+
detect(): Promise<AgentStatus>;
|
|
942
|
+
buildTurn(thread: Thread, input: string | AgentTurnInput): Promise<TurnCommand>;
|
|
943
|
+
parseEvent(line: string): AgentEvent | AgentEvent[] | null;
|
|
944
|
+
resolveSessionId(worktreePath: string, cached: string | null): Promise<string | null>;
|
|
945
|
+
buildAttach(thread: Thread): Promise<AttachCommand>;
|
|
946
|
+
/** Optional: list Linear issues via this agent's MCP connector */
|
|
947
|
+
listLinearIssues?(repoPath: string): Promise<Array<{
|
|
948
|
+
id: string;
|
|
949
|
+
identifier: string;
|
|
950
|
+
title: string;
|
|
951
|
+
url: string;
|
|
952
|
+
labels: string[];
|
|
953
|
+
}>>;
|
|
954
|
+
}
|
|
955
|
+
declare const PLAN_MODE_INSTRUCTION = "Plan mode is active and must remain active until the user turns Plan mode off in the UI (or explicitly asks you to implement). Analyze the codebase, search and read files as needed, and produce or refine a clear implementation plan. Do not modify, create, or delete any files. Do not exit plan mode on your own.";
|
|
956
|
+
declare function permissionMode(thread: Pick<Thread, 'autonomy' | 'planMode'>): {
|
|
957
|
+
claude: string;
|
|
958
|
+
opencodePermission: string;
|
|
959
|
+
codexSandbox: 'read-only' | 'workspace-write';
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* Pure Brightsy chat-target helpers — safe to import from the Electron renderer
|
|
964
|
+
* (no Node / execa deps).
|
|
965
|
+
*/
|
|
966
|
+
type BrightsyChatTarget = {
|
|
967
|
+
type: 'agent' | 'model';
|
|
968
|
+
id: string;
|
|
969
|
+
name: string;
|
|
970
|
+
description?: string | null;
|
|
971
|
+
accountId?: string;
|
|
972
|
+
accountSlug?: string;
|
|
973
|
+
accountName?: string;
|
|
974
|
+
};
|
|
975
|
+
type BrightsyTeamTargets = {
|
|
976
|
+
accountId: string;
|
|
977
|
+
accountSlug: string;
|
|
978
|
+
accountName: string;
|
|
979
|
+
agents: BrightsyChatTarget[];
|
|
980
|
+
models: BrightsyChatTarget[];
|
|
981
|
+
};
|
|
982
|
+
type BrightsyChatTargets = {
|
|
983
|
+
/** Per connected-team agent/model lists for the composer picker. */
|
|
984
|
+
teams: BrightsyTeamTargets[];
|
|
985
|
+
/** Flat lists (active / first team) — backward compatible. */
|
|
986
|
+
agents: BrightsyChatTarget[];
|
|
987
|
+
models: BrightsyChatTarget[];
|
|
988
|
+
activeAccountId: string | null;
|
|
989
|
+
};
|
|
990
|
+
type DecodedBrightsyTarget = {
|
|
991
|
+
type: 'agent' | 'model';
|
|
992
|
+
id: string;
|
|
993
|
+
/** Team that owns this target (when encoded). */
|
|
994
|
+
accountId?: string;
|
|
995
|
+
};
|
|
996
|
+
/** Encode a Brightsy target into Thread.model (`agent:…` / `model:…` / `team:…:agent:…`). */
|
|
997
|
+
declare function encodeBrightsyTarget(type: 'agent' | 'model', id: string, accountId?: string | null): string;
|
|
998
|
+
/** Decode Thread.model for Brightsy turns. null/`default` → platform default agent. */
|
|
999
|
+
declare function decodeBrightsyTarget(model: string | null | undefined): DecodedBrightsyTarget;
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* Agents + models for each Sideboard-connected Brightsy team (composer picker).
|
|
1003
|
+
* Falls back to CLI list-targets when no teams are connected yet.
|
|
1004
|
+
*/
|
|
1005
|
+
declare function listBrightsyChatTargets(): Promise<BrightsyChatTargets>;
|
|
1006
|
+
/**
|
|
1007
|
+
* Brightsy hosted-agent adapter. `brightsy chat --json` emits NDJSON events
|
|
1008
|
+
* (text deltas, tool output, usage, error, done); the message is piped on
|
|
1009
|
+
* stdin. The CLI has no session resume, so resolveSessionId always returns
|
|
1010
|
+
* null and Sideboard seeds each turn from thread history. Brightsy agents run
|
|
1011
|
+
* server-side — they converse about the worktree but never edit local files.
|
|
1012
|
+
* All Brightsy agents/models use OpenRouter chat-completions syntax; the CLI
|
|
1013
|
+
* owns that wire format.
|
|
1014
|
+
*
|
|
1015
|
+
* Thread.model encodes the chat target as `agent:<id>` or `model:<id>`
|
|
1016
|
+
* (null → Default Agent).
|
|
1017
|
+
*/
|
|
1018
|
+
declare const brightsyAdapter: AgentAdapter;
|
|
1019
|
+
|
|
1020
|
+
declare const claudeAdapter: AgentAdapter;
|
|
1021
|
+
|
|
1022
|
+
declare const codexAdapter: AgentAdapter;
|
|
1023
|
+
|
|
1024
|
+
/** JSON payload written to the Cursor runner on stdin. */
|
|
1025
|
+
type CursorTurnRequest = {
|
|
1026
|
+
prompt: string;
|
|
1027
|
+
cwd: string;
|
|
1028
|
+
agentId?: string | null;
|
|
1029
|
+
model?: string | null;
|
|
1030
|
+
fast?: boolean;
|
|
1031
|
+
planMode?: boolean;
|
|
1032
|
+
apiKey?: string;
|
|
1033
|
+
};
|
|
1034
|
+
/** Subset of Cursor SDK stream messages we care about (keeps tests free of the SDK). */
|
|
1035
|
+
type CursorSdkStreamMessage = {
|
|
1036
|
+
type: string;
|
|
1037
|
+
agent_id?: string;
|
|
1038
|
+
text?: string;
|
|
1039
|
+
call_id?: string;
|
|
1040
|
+
name?: string;
|
|
1041
|
+
status?: string;
|
|
1042
|
+
args?: unknown;
|
|
1043
|
+
result?: unknown;
|
|
1044
|
+
message?: {
|
|
1045
|
+
role?: string;
|
|
1046
|
+
content?: Array<{
|
|
1047
|
+
type?: string;
|
|
1048
|
+
text?: string;
|
|
1049
|
+
id?: string;
|
|
1050
|
+
name?: string;
|
|
1051
|
+
input?: unknown;
|
|
1052
|
+
}>;
|
|
1053
|
+
};
|
|
1054
|
+
usage?: {
|
|
1055
|
+
inputTokens?: number;
|
|
1056
|
+
outputTokens?: number;
|
|
1057
|
+
cacheReadTokens?: number;
|
|
1058
|
+
cacheWriteTokens?: number;
|
|
1059
|
+
};
|
|
1060
|
+
};
|
|
1061
|
+
/**
|
|
1062
|
+
* Map a Cursor SDK stream message into Sideboard AgentEvent(s).
|
|
1063
|
+
* Mirrors how Conductor consumes `run.stream()` events.
|
|
1064
|
+
*/
|
|
1065
|
+
declare function cursorSdkMessageToEvents(msg: CursorSdkStreamMessage): AgentEvent[];
|
|
1066
|
+
/** Parse one NDJSON line emitted by the Cursor runner (already Sideboard AgentEvents). */
|
|
1067
|
+
declare function parseCursorRunnerLine(line: string): AgentEvent | AgentEvent[] | null;
|
|
1068
|
+
|
|
1069
|
+
declare const cursorAdapter: AgentAdapter;
|
|
1070
|
+
|
|
1071
|
+
declare const opencodeAdapter: AgentAdapter;
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* Electron / GUI apps often inherit a minimal PATH that omits Homebrew and
|
|
1075
|
+
* user bin dirs where `claude` / `codex` / `opencode` / `brightsy` live. Call
|
|
1076
|
+
* once at process start (and before agent spawns) so adapters can resolve CLIs.
|
|
1077
|
+
*/
|
|
1078
|
+
declare function ensureAgentPath(env?: NodeJS.ProcessEnv): string;
|
|
1079
|
+
|
|
1080
|
+
declare function getAdapter(kind: AgentKind): AgentAdapter;
|
|
1081
|
+
declare function allAdapters(): AgentAdapter[];
|
|
1082
|
+
|
|
1083
|
+
interface SpawnTurnHandle {
|
|
1084
|
+
pid: number | undefined;
|
|
1085
|
+
kill: () => void;
|
|
1086
|
+
done: Promise<{
|
|
1087
|
+
exitCode: number | null;
|
|
1088
|
+
sessionId: string | null;
|
|
1089
|
+
assistantText: string;
|
|
1090
|
+
parts: MessagePart[];
|
|
1091
|
+
usage: TokenUsage | null;
|
|
1092
|
+
}>;
|
|
1093
|
+
}
|
|
1094
|
+
declare function spawnAgentTurn(thread: Thread, input: string | AgentTurnInput, onEvent: (event: AgentEvent) => void): Promise<SpawnTurnHandle>;
|
|
1095
|
+
|
|
1096
|
+
declare function toolDetail(name: string, input?: Record<string, unknown>): string | undefined;
|
|
1097
|
+
declare function toolDescription(name: string, input?: Record<string, unknown>): string;
|
|
1098
|
+
declare function toolFilePath(input?: Record<string, unknown>): string | undefined;
|
|
1099
|
+
/** Apply a structured agent event onto an accumulated parts list. */
|
|
1100
|
+
declare function applyAgentEvent(parts: MessagePart[], event: AgentEvent): MessagePart[];
|
|
1101
|
+
declare function partsToAssistantText(parts: MessagePart[]): string;
|
|
1102
|
+
/**
|
|
1103
|
+
* Strip Brightsy CLI NDJSON control events that accidentally landed in transcript
|
|
1104
|
+
* text (`tool_use` / `tool_result` / …). Matches one or more concatenated objects.
|
|
1105
|
+
*/
|
|
1106
|
+
declare function stripBrightsyNdjsonNoise(text: string): string;
|
|
1107
|
+
/** True when a stdout line is Brightsy CLI NDJSON (should never be answer text). */
|
|
1108
|
+
declare function isBrightsyNdjsonLine(line: string): boolean;
|
|
1109
|
+
declare function finalizeParts(parts: MessagePart[]): MessagePart[];
|
|
1110
|
+
declare function normalizeParseResult(parsed: AgentEvent | AgentEvent[] | null): AgentEvent[];
|
|
1111
|
+
|
|
1112
|
+
/** Accumulate incremental usage (one CLI turn may report usage in several steps). */
|
|
1113
|
+
declare function mergeUsage(a: TokenUsage | null, b: TokenUsage): TokenUsage;
|
|
1114
|
+
/** Total tokens processed for a turn (input + output + cache reads/writes). */
|
|
1115
|
+
declare function totalTokens(u: TokenUsage): number;
|
|
1116
|
+
|
|
1117
|
+
interface McpServerStatus {
|
|
1118
|
+
name: string;
|
|
1119
|
+
connected: boolean;
|
|
1120
|
+
needsAuth: boolean;
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* Parse `claude mcp list` human output.
|
|
1124
|
+
* Example lines:
|
|
1125
|
+
* claude.ai Brightsy Ai: https://mcp.brightsy.ai/mcp - ✔ Connected
|
|
1126
|
+
* claude.ai Slack: https://mcp.slack.com/mcp - ! Needs authentication
|
|
1127
|
+
*/
|
|
1128
|
+
declare function parseMcpList(text: string): McpServerStatus[];
|
|
1129
|
+
/**
|
|
1130
|
+
* Claude Code turns MCP server display names into tool-name segments by
|
|
1131
|
+
* replacing any character outside [A-Za-z0-9_-] with `_`.
|
|
1132
|
+
* e.g. "claude.ai Brightsy Ai" → "claude_ai_Brightsy_Ai"
|
|
1133
|
+
* Tools are then `mcp__claude_ai_Brightsy_Ai__list_agents`.
|
|
1134
|
+
*/
|
|
1135
|
+
declare function sanitizeMcpServerName(name: string): string;
|
|
1136
|
+
/**
|
|
1137
|
+
* Allow-list entries for connected MCP servers.
|
|
1138
|
+
* Emit both server-level and tool-wildcard forms (no spaces — `--allowedTools`
|
|
1139
|
+
* splits on commas *and* spaces).
|
|
1140
|
+
*/
|
|
1141
|
+
declare function mcpAllowTools(servers: McpServerStatus[]): string[];
|
|
1142
|
+
declare function mcpAuthWarnings(servers: McpServerStatus[]): string[];
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* Conductor-style first-turn instruction: rename the placeholder branch to match
|
|
1146
|
+
* the task. Worktree directory stays the soccer-team nickname.
|
|
1147
|
+
*/
|
|
1148
|
+
declare function formatRenameBranchDirective(thread: Pick<Thread, 'worktreePath' | 'branchName'>, opts?: {
|
|
1149
|
+
customPrompt?: string | null;
|
|
1150
|
+
}): string | null;
|
|
1151
|
+
/**
|
|
1152
|
+
* Mandatory Sideboard isolation + landing guidance — agents must edit the thread
|
|
1153
|
+
* worktree and open PRs whose titles/bodies describe the *purpose of the changes*.
|
|
1154
|
+
*/
|
|
1155
|
+
declare function formatWorktreeDirective(thread: Pick<Thread, 'worktreePath' | 'repoPath' | 'branchName'> & Partial<Pick<Thread, 'title' | 'prUrl'>>): string;
|
|
1156
|
+
interface AgentInstructionFile {
|
|
1157
|
+
relativePath: string;
|
|
1158
|
+
content: string;
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Load agent instruction files from the worktree (CLAUDE.md, AGENTS.md, …).
|
|
1162
|
+
* These are project conventions the CLI may auto-load; we attach them explicitly
|
|
1163
|
+
* so non-interactive `-p` / `exec` turns always see them.
|
|
1164
|
+
*/
|
|
1165
|
+
declare function loadAgentInstructions(worktreePath: string, agent: AgentKind): AgentInstructionFile[];
|
|
1166
|
+
/** Format instruction files as a stable cacheable prefix (no current request). */
|
|
1167
|
+
declare function formatAgentInstructions(files: AgentInstructionFile[]): string | null;
|
|
1168
|
+
/** Prepend instruction files to the agent-facing prompt. */
|
|
1169
|
+
declare function withAgentInstructions(prompt: string, files: AgentInstructionFile[]): string;
|
|
1170
|
+
|
|
1171
|
+
declare function detectAgents(): Promise<AgentStatus[]>;
|
|
1172
|
+
declare function requireAgent(agent: AgentStatus['agent'], opts?: {
|
|
1173
|
+
requireLinear?: boolean;
|
|
1174
|
+
}): Promise<AgentStatus>;
|
|
1175
|
+
|
|
1176
|
+
type RunMode = 'concurrent' | 'nonconcurrent';
|
|
1177
|
+
interface RunScript {
|
|
1178
|
+
name: string;
|
|
1179
|
+
command: string;
|
|
1180
|
+
default?: boolean;
|
|
1181
|
+
/** Lucide-style icon name (Conductor-compatible). */
|
|
1182
|
+
icon?: string;
|
|
1183
|
+
/** Where the script is available: local, cloud, or both. */
|
|
1184
|
+
availableIn?: Array<'local' | 'cloud'>;
|
|
1185
|
+
}
|
|
1186
|
+
interface RepoSettings {
|
|
1187
|
+
/** Which file family was loaded */
|
|
1188
|
+
source: 'sideboard' | 'conductor';
|
|
1189
|
+
setup?: string;
|
|
1190
|
+
/** Script run before archive/purge tears down the worktree. */
|
|
1191
|
+
archive?: string;
|
|
1192
|
+
/** concurrent = multiple workspaces may run scripts; nonconcurrent = one at a time. */
|
|
1193
|
+
runMode: RunMode;
|
|
1194
|
+
filesToCopy?: string[];
|
|
1195
|
+
/** Glob patterns from settings (Conductor file_include_globs). */
|
|
1196
|
+
fileIncludeGlobs?: string[];
|
|
1197
|
+
runScripts: RunScript[];
|
|
1198
|
+
/** Optional override for worktree root (supports ~) */
|
|
1199
|
+
worktreesRoot?: string;
|
|
1200
|
+
editor?: string;
|
|
1201
|
+
/** Conductor-compatible agent prompt overrides from `[prompts]`. */
|
|
1202
|
+
prompts?: {
|
|
1203
|
+
renameBranch?: string;
|
|
1204
|
+
createPr?: string;
|
|
1205
|
+
general?: string;
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Load settings for a single checkout root.
|
|
1210
|
+
* Prefer `.sideboard`, fall back to `.conductor`. Overlay `settings.local.toml`.
|
|
1211
|
+
*/
|
|
1212
|
+
declare function loadRepoSettings(repoPath: string): RepoSettings | null;
|
|
1213
|
+
/**
|
|
1214
|
+
* Settings for a thread workspace.
|
|
1215
|
+
*
|
|
1216
|
+
* Scripts always run with cwd = worktree (not the main repo). Config resolution
|
|
1217
|
+
* matches Conductor:
|
|
1218
|
+
* 1. Committed `settings.toml` from the worktree (branch snapshot), else main repo
|
|
1219
|
+
* 2. Overlay main-repo `settings.local.toml` (machine-local, applies to all workspaces)
|
|
1220
|
+
* 3. Overlay worktree `settings.local.toml` if present
|
|
1221
|
+
*/
|
|
1222
|
+
declare function loadWorkspaceSettings(worktreePath: string, repoPath?: string | null): RepoSettings | null;
|
|
1223
|
+
/** @deprecated use loadRepoSettings */
|
|
1224
|
+
declare function loadConductorSettings(repoPath: string): RepoSettings | null;
|
|
1225
|
+
declare function hasRepoHook(repoPath: string): boolean;
|
|
1226
|
+
/** True if either the worktree or (optional) main repo has setup/run config. */
|
|
1227
|
+
declare function hasWorkspaceHook(worktreePath: string, repoPath?: string | null): boolean;
|
|
1228
|
+
/** @deprecated use hasRepoHook / hasWorkspaceHook */
|
|
1229
|
+
declare function hasConductorHook(worktreePath: string, repoPath?: string | null): boolean;
|
|
1230
|
+
declare function settingsSourceLabel(rootPath: string): string | null;
|
|
1231
|
+
/** Label including whether config was found in the worktree vs main repo. */
|
|
1232
|
+
declare function workspaceSettingsSourceLabel(worktreePath: string, repoPath?: string | null): string | null;
|
|
1233
|
+
interface RepoSetupInfo {
|
|
1234
|
+
/** `.sideboard` or `.conductor` settings exist. */
|
|
1235
|
+
hasConfig: boolean;
|
|
1236
|
+
/** `[scripts] setup = "..."` is defined in the loaded config. */
|
|
1237
|
+
hasSetupScript: boolean;
|
|
1238
|
+
configLabel: string | null;
|
|
1239
|
+
}
|
|
1240
|
+
/** Setup panel state for a thread worktree (falls back to main repo config). */
|
|
1241
|
+
declare function getRepoSetupInfo(worktreePath: string, repoPath?: string | null): RepoSetupInfo;
|
|
1242
|
+
|
|
1243
|
+
type ConductorSettings = RepoSettings;
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
* Read `.worktreeinclude` patterns (one per line; `#` comments; blank skipped).
|
|
1247
|
+
* Conductor: repo-root file listing gitignored files to copy into each worktree.
|
|
1248
|
+
*/
|
|
1249
|
+
declare function readWorktreeInclude(repoPath: string): string[];
|
|
1250
|
+
/**
|
|
1251
|
+
* Resolve files to copy using Conductor order:
|
|
1252
|
+
* 1. `.worktreeinclude`
|
|
1253
|
+
* 2. settings `filesToCopy` / `file_include_globs`
|
|
1254
|
+
* 3. default `.env*`
|
|
1255
|
+
*/
|
|
1256
|
+
declare function resolveFilesToCopy(repoPath: string): string[];
|
|
1257
|
+
declare function copyConfiguredFiles(repoPath: string, worktreePath: string): string[];
|
|
1258
|
+
declare function captureLoginEnv(): Promise<NodeJS.ProcessEnv>;
|
|
1259
|
+
interface WorkspaceScriptEnvOpts {
|
|
1260
|
+
worktreePath: string;
|
|
1261
|
+
repoPath: string;
|
|
1262
|
+
workspaceName?: string;
|
|
1263
|
+
defaultBranch?: string;
|
|
1264
|
+
ports?: number[];
|
|
1265
|
+
}
|
|
1266
|
+
/** Build Conductor/Sideboard env vars for setup/run scripts. */
|
|
1267
|
+
declare function buildWorkspaceScriptEnv(opts: WorkspaceScriptEnvOpts, baseEnv?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
1268
|
+
interface ScriptHandle {
|
|
1269
|
+
pid: number | undefined;
|
|
1270
|
+
kill: () => void;
|
|
1271
|
+
done: Promise<number | null>;
|
|
1272
|
+
child: ResultPromise;
|
|
1273
|
+
}
|
|
1274
|
+
declare function runSetupScript(repoPath: string, worktreePath: string, onLine?: (line: string) => void, opts?: {
|
|
1275
|
+
signal?: AbortSignal;
|
|
1276
|
+
defaultBranch?: string;
|
|
1277
|
+
}): Promise<{
|
|
1278
|
+
ran: boolean;
|
|
1279
|
+
exitCode: number | null;
|
|
1280
|
+
source: string | null;
|
|
1281
|
+
kill?: () => void;
|
|
1282
|
+
}>;
|
|
1283
|
+
declare function runArchiveScript(repoPath: string, worktreePath: string, onLine?: (line: string) => void): Promise<{
|
|
1284
|
+
ran: boolean;
|
|
1285
|
+
exitCode: number | null;
|
|
1286
|
+
}>;
|
|
1287
|
+
declare function listRunScripts(worktreePath: string, repoPath?: string | null): RunScript[];
|
|
1288
|
+
declare function getDefaultRunScript(worktreePath: string, repoPath?: string | null): RunScript | null;
|
|
1289
|
+
declare function getRunScript(worktreePath: string, repoPath: string | null | undefined, name?: string | null): RunScript | null;
|
|
1290
|
+
declare function getRunMode(worktreePath: string, repoPath?: string | null): 'concurrent' | 'nonconcurrent';
|
|
1291
|
+
declare function allocatePort(): Promise<number>;
|
|
1292
|
+
/** Allocate a contiguous block of ports (Conductor: CONDUCTOR_PORT … +9). */
|
|
1293
|
+
declare function allocatePortRange(size?: number): Promise<number[]>;
|
|
1294
|
+
interface DevServerHandle {
|
|
1295
|
+
pid: number | undefined;
|
|
1296
|
+
port: number;
|
|
1297
|
+
ports: number[];
|
|
1298
|
+
scriptName: string;
|
|
1299
|
+
kill: () => void;
|
|
1300
|
+
done: Promise<number | null>;
|
|
1301
|
+
}
|
|
1302
|
+
declare function startDevServer(repoPath: string, worktreePath: string, onLine?: (line: string) => void, opts?: {
|
|
1303
|
+
scriptName?: string;
|
|
1304
|
+
defaultBranch?: string;
|
|
1305
|
+
}): Promise<DevServerHandle | null>;
|
|
1306
|
+
|
|
1307
|
+
/**
|
|
1308
|
+
* Cursor `.cursor/worktrees.json` setup — used when Sideboard/Conductor
|
|
1309
|
+
* settings have no setup script.
|
|
1310
|
+
*
|
|
1311
|
+
* Docs: https://cursor.com/docs/configuration/worktrees
|
|
1312
|
+
*/
|
|
1313
|
+
interface CursorWorktreesConfig {
|
|
1314
|
+
'setup-worktree'?: string | string[];
|
|
1315
|
+
'setup-worktree-unix'?: string | string[];
|
|
1316
|
+
'setup-worktree-windows'?: string | string[];
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* Run Cursor worktree setup if `.cursor/worktrees.json` exists.
|
|
1320
|
+
* Prefers worktree copy, then main repo. Sets ROOT_WORKTREE_PATH to the main checkout.
|
|
1321
|
+
*/
|
|
1322
|
+
declare function runCursorWorktreeSetup(repoPath: string, worktreePath: string, onLine?: (line: string) => void): Promise<{
|
|
1323
|
+
ran: boolean;
|
|
1324
|
+
exitCode: number | null;
|
|
1325
|
+
source: string | null;
|
|
1326
|
+
}>;
|
|
1327
|
+
declare function hasCursorWorktreeSetup(worktreePath: string, repoPath?: string | null): boolean;
|
|
1328
|
+
|
|
1329
|
+
/** Stable codes for the Changes panel (Cursor-style empty states). */
|
|
1330
|
+
type GitWorktreeStatus = 'ok' | 'missing_worktree' | 'not_git';
|
|
1331
|
+
declare function inspectGitWorktree(worktreePath: string): Promise<GitWorktreeStatus>;
|
|
1332
|
+
/** `git init` in the worktree so Changes can track files (Cursor-style). */
|
|
1333
|
+
declare function initializeGitRepository(worktreePath: string): Promise<void>;
|
|
1334
|
+
/**
|
|
1335
|
+
* Snapshot current WIP as a stash commit (does not modify the working tree).
|
|
1336
|
+
* Used as the "Last Agent Turn" baseline.
|
|
1337
|
+
*/
|
|
1338
|
+
declare function captureTurnBaseline(worktreePath: string): Promise<string | null>;
|
|
1339
|
+
interface GetDiffOptions {
|
|
1340
|
+
base?: string;
|
|
1341
|
+
maxHunkChars?: number;
|
|
1342
|
+
scope?: DiffScope;
|
|
1343
|
+
/** Stash/commit SHA captured at the start of the last agent turn. */
|
|
1344
|
+
lastTurnBase?: string | null;
|
|
1345
|
+
/** When scope is `commits`, show only this commit's patch. */
|
|
1346
|
+
commitSha?: string | null;
|
|
1347
|
+
}
|
|
1348
|
+
/** Recent commits since merge-base (Cursor Commits submenu). */
|
|
1349
|
+
declare function listBranchCommits(worktreePath: string, repoPath: string, opts?: {
|
|
1350
|
+
base?: string;
|
|
1351
|
+
max?: number;
|
|
1352
|
+
}): Promise<DiffCommit[]>;
|
|
1353
|
+
/**
|
|
1354
|
+
* Change set for the Changes panel, filtered by Cursor-style scope.
|
|
1355
|
+
*/
|
|
1356
|
+
declare function getDiff(worktreePath: string, repoPath: string, opts?: GetDiffOptions): Promise<DiffResult>;
|
|
1357
|
+
/** Tracked + untracked (non-ignored) files in a worktree. */
|
|
1358
|
+
declare function listWorktreeFiles(worktreePath: string, opts?: {
|
|
1359
|
+
maxFiles?: number;
|
|
1360
|
+
}): Promise<string[]>;
|
|
1361
|
+
/** Read a text (or image) file from the worktree (capped). */
|
|
1362
|
+
declare function readWorktreeFile(worktreePath: string, relativePath: string, opts?: {
|
|
1363
|
+
maxBytes?: number;
|
|
1364
|
+
}): {
|
|
1365
|
+
path: string;
|
|
1366
|
+
content: string;
|
|
1367
|
+
truncated: boolean;
|
|
1368
|
+
binary: boolean;
|
|
1369
|
+
encoding: 'utf8' | 'base64';
|
|
1370
|
+
};
|
|
1371
|
+
/** Write a UTF-8 text file into the worktree. */
|
|
1372
|
+
declare function writeWorktreeFile(worktreePath: string, relativePath: string, content: string): {
|
|
1373
|
+
path: string;
|
|
1374
|
+
};
|
|
1375
|
+
/** Compact summary for MCP token-frugal payloads */
|
|
1376
|
+
declare function getDiffSummary(worktreePath: string, repoPath: string, opts?: {
|
|
1377
|
+
maxFiles?: number;
|
|
1378
|
+
maxHunkChars?: number;
|
|
1379
|
+
}): Promise<{
|
|
1380
|
+
base: string;
|
|
1381
|
+
dirty: boolean;
|
|
1382
|
+
stat: string;
|
|
1383
|
+
files: Array<{
|
|
1384
|
+
path: string;
|
|
1385
|
+
status: string;
|
|
1386
|
+
patch: string;
|
|
1387
|
+
additions?: number;
|
|
1388
|
+
deletions?: number;
|
|
1389
|
+
}>;
|
|
1390
|
+
truncated: boolean;
|
|
1391
|
+
}>;
|
|
1392
|
+
|
|
1393
|
+
interface SkillInfo {
|
|
1394
|
+
id: string;
|
|
1395
|
+
name: string;
|
|
1396
|
+
command: string;
|
|
1397
|
+
description: string;
|
|
1398
|
+
path: string;
|
|
1399
|
+
source: 'workspace' | 'user' | 'cli';
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Discover skills from the worktree + user/CLI skill locations.
|
|
1403
|
+
* Workspace skills win over user/CLI when command names collide.
|
|
1404
|
+
*/
|
|
1405
|
+
declare function discoverSkills(worktreePath: string): SkillInfo[];
|
|
1406
|
+
declare function readSkillBody(skillPath: string, maxChars?: number): string;
|
|
1407
|
+
|
|
1408
|
+
interface ExpandResult {
|
|
1409
|
+
/** Prompt sent to the agent (may include attachments / skill bodies). */
|
|
1410
|
+
agentPrompt: string;
|
|
1411
|
+
mentionedFiles: string[];
|
|
1412
|
+
skillsUsed: SkillInfo[];
|
|
1413
|
+
}
|
|
1414
|
+
/**
|
|
1415
|
+
* Expand @file mentions, /skill commands, and composer attachments into agent context.
|
|
1416
|
+
* Display text should remain the original user prompt.
|
|
1417
|
+
*/
|
|
1418
|
+
declare function expandComposerPrompt(worktreePath: string, prompt: string, opts?: {
|
|
1419
|
+
skills?: SkillInfo[];
|
|
1420
|
+
maxFileBytes?: number;
|
|
1421
|
+
attachments?: ThreadAttachment[];
|
|
1422
|
+
}): ExpandResult;
|
|
1423
|
+
|
|
1424
|
+
interface SummarizeResult {
|
|
1425
|
+
summary: string;
|
|
1426
|
+
method: 'claude' | 'extractive';
|
|
1427
|
+
}
|
|
1428
|
+
/**
|
|
1429
|
+
* Summarize a conversation transcript for agent continuity.
|
|
1430
|
+
* Prefers a fast Claude one-shot; falls back to extractive bullets.
|
|
1431
|
+
*/
|
|
1432
|
+
declare function summarizeConversation(transcript: string, opts?: {
|
|
1433
|
+
cwd?: string;
|
|
1434
|
+
timeoutMs?: number;
|
|
1435
|
+
}): Promise<SummarizeResult>;
|
|
1436
|
+
/** Deterministic fallback when Claude isn't available. */
|
|
1437
|
+
declare function extractiveSummary(transcript: string): string;
|
|
1438
|
+
|
|
1439
|
+
/** Rough char budget before we compact (≈ 25k tokens at ~4 chars/token). */
|
|
1440
|
+
declare const CONTEXT_COMPACT_CHARS = 100000;
|
|
1441
|
+
/** Keep this much recent transcript after compaction. */
|
|
1442
|
+
declare const CONTEXT_KEEP_RECENT_CHARS = 24000;
|
|
1443
|
+
/** Always keep at least this many trailing messages. */
|
|
1444
|
+
declare const CONTEXT_KEEP_RECENT_MESSAGES = 12;
|
|
1445
|
+
/** Don't bother compacting tiny threads. */
|
|
1446
|
+
declare const CONTEXT_MIN_MESSAGES = 10;
|
|
1447
|
+
interface CompactThresholds {
|
|
1448
|
+
maxChars?: number;
|
|
1449
|
+
keepRecentChars?: number;
|
|
1450
|
+
keepRecentMessages?: number;
|
|
1451
|
+
minMessages?: number;
|
|
1452
|
+
}
|
|
1453
|
+
declare function estimateMessageChars(message: ThreadMessage): number;
|
|
1454
|
+
declare function estimateThreadChars(messages: ThreadMessage[]): number;
|
|
1455
|
+
declare function shouldCompactContext(messages: ThreadMessage[], thresholds?: CompactThresholds): boolean;
|
|
1456
|
+
/** Split into older (to summarize) + recent (kept verbatim). */
|
|
1457
|
+
declare function splitForCompaction(messages: ThreadMessage[], thresholds?: CompactThresholds): {
|
|
1458
|
+
older: ThreadMessage[];
|
|
1459
|
+
recent: ThreadMessage[];
|
|
1460
|
+
};
|
|
1461
|
+
type TranscriptToolDetail = 'full' | 'summary' | 'none';
|
|
1462
|
+
/**
|
|
1463
|
+
* Format stored thread messages for agent context or summarization.
|
|
1464
|
+
* Use `tools: 'full'` when the transcript is sent back to the agent so tool
|
|
1465
|
+
* inputs/results are not truncated; `summary` keeps one-line tool labels for
|
|
1466
|
+
* compaction prompts.
|
|
1467
|
+
*/
|
|
1468
|
+
declare function formatMessagesAsTranscript(messages: ThreadMessage[], opts?: {
|
|
1469
|
+
tools?: TranscriptToolDetail;
|
|
1470
|
+
}): string;
|
|
1471
|
+
/**
|
|
1472
|
+
* Seed prompt for a fresh agent session (no --resume).
|
|
1473
|
+
* Includes summary + recent turns with full tool use data so continuity is not lost.
|
|
1474
|
+
* Pass `tools: 'none'` for hosts that choke on tool-heavy seeds (e.g. Brightsy).
|
|
1475
|
+
*/
|
|
1476
|
+
declare function buildSessionSeed(messages: ThreadMessage[], opts?: {
|
|
1477
|
+
tools?: TranscriptToolDetail;
|
|
1478
|
+
}): string | null;
|
|
1479
|
+
declare function applyCompaction(messages: ThreadMessage[], summaryText: string, thresholds?: CompactThresholds): ThreadMessage[];
|
|
1480
|
+
interface CompactResult {
|
|
1481
|
+
didCompact: boolean;
|
|
1482
|
+
thread: Thread;
|
|
1483
|
+
summary?: string;
|
|
1484
|
+
method?: 'claude' | 'extractive';
|
|
1485
|
+
olderCount?: number;
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* If the thread transcript is oversized, summarize older turns, keep recent ones,
|
|
1489
|
+
* and clear sessionId so the next agent turn starts fresh with a seed prompt.
|
|
1490
|
+
*/
|
|
1491
|
+
declare function maybeCompactContext(thread: Thread, thresholds?: CompactThresholds, summarize?: typeof summarizeConversation): Promise<CompactResult>;
|
|
1492
|
+
|
|
1493
|
+
declare function previewLand(thread: Thread): Promise<LandPreview>;
|
|
1494
|
+
declare function confirmLand(thread: Thread, opts?: {
|
|
1495
|
+
draft?: boolean;
|
|
1496
|
+
web?: boolean;
|
|
1497
|
+
}): Promise<LandResult>;
|
|
1498
|
+
|
|
1499
|
+
declare function createThread(input: CreateThreadInput, onSetupLine?: (line: string) => void): Promise<Thread>;
|
|
1500
|
+
/** @deprecated Prefer listIssues() from integrations/issues — agent-agnostic. */
|
|
1501
|
+
declare function listLinearIssues(agent: AgentKind, repoPath: string): Promise<{
|
|
1502
|
+
id: string;
|
|
1503
|
+
identifier: string;
|
|
1504
|
+
title: string;
|
|
1505
|
+
url: string;
|
|
1506
|
+
labels: string[];
|
|
1507
|
+
}[]>;
|
|
1508
|
+
|
|
1509
|
+
declare function sameWorktreePath(a: string, b: string): boolean;
|
|
1510
|
+
/** Soccer-team slugs already used by this worktree or sibling tab titles. */
|
|
1511
|
+
declare function takenTeamSlugsForChatTab(worktreePath: string): string[];
|
|
1512
|
+
declare function threadsSharingWorktree(worktreePath: string): Thread[];
|
|
1513
|
+
declare function formatTranscriptMarkdown(title: string, messages: ThreadMessage[]): string;
|
|
1514
|
+
declare function forkMessageSlice(from: Thread, throughIndex?: number): ThreadMessage[];
|
|
1515
|
+
declare function buildForkTranscriptAttachment(baseTitle: string, messages: ThreadMessage[]): ThreadAttachment;
|
|
1516
|
+
/** New chat tab in the same worktree (no new git worktree). */
|
|
1517
|
+
declare function createChatTab(input: CreateChatTabInput): Thread;
|
|
1518
|
+
/** Fork chat into a new tab with transcript attached in the composer. */
|
|
1519
|
+
declare function forkChatTab(input: ForkChatTabInput): Thread;
|
|
1520
|
+
|
|
1521
|
+
/** Fork into a new git worktree branched from the source thread's branch. */
|
|
1522
|
+
declare function forkThreadWorktree(input: ForkThreadWorktreeInput, onSetupLine?: (line: string) => void): Promise<Thread>;
|
|
1523
|
+
|
|
1524
|
+
/**
|
|
1525
|
+
* Conductor persists Cursor SDK agent IDs under cursor-sdk-store/<hash>/agents.ndjson
|
|
1526
|
+
* (not in sessions.claude_session_id). Prefer the newest durable agent for a cwd.
|
|
1527
|
+
*/
|
|
1528
|
+
declare function resolveConductorCursorAgentId(workspacePath: string): string | null;
|
|
1529
|
+
declare function adoptThread(input: AdoptInput): Promise<Thread>;
|
|
1530
|
+
declare function conductorDbPath(): string;
|
|
1531
|
+
declare function listConductorWorkspaces(): ConductorWorkspace[];
|
|
1532
|
+
declare function importConductorWorkspace(workspaceId: string): Thread;
|
|
1533
|
+
declare function importConductorWorkspaceAsync(workspaceId: string): Promise<Thread>;
|
|
1534
|
+
|
|
1535
|
+
interface OrphanWorktree {
|
|
1536
|
+
path: string;
|
|
1537
|
+
repoPath: string;
|
|
1538
|
+
mtimeMs: number;
|
|
1539
|
+
}
|
|
1540
|
+
/** Discover Sideboard worktrees on disk with no matching thread record. */
|
|
1541
|
+
declare function findOrphanWorktrees(repoPaths?: string[]): Promise<OrphanWorktree[]>;
|
|
1542
|
+
interface CleanupOrphansResult {
|
|
1543
|
+
removed: string[];
|
|
1544
|
+
kept: string[];
|
|
1545
|
+
orphans: OrphanWorktree[];
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* Cursor-style cleanup: keep newest worktrees up to maxCount across the machine,
|
|
1549
|
+
* remove older orphans (never removes paths still referenced by a thread).
|
|
1550
|
+
*/
|
|
1551
|
+
declare function cleanupOrphanWorktrees(opts?: {
|
|
1552
|
+
maxCount?: number;
|
|
1553
|
+
dryRun?: boolean;
|
|
1554
|
+
repoPaths?: string[];
|
|
1555
|
+
}): Promise<CleanupOrphansResult>;
|
|
1556
|
+
declare function shouldRunWorktreeCleanup(settings?: AppSettings): boolean;
|
|
1557
|
+
declare function worktreeCleanupSettings(): Pick<AdvancedAppSettings, 'worktreeMaxCount' | 'worktreeCleanupIntervalHours' | 'worktreeLastCleanupAt' | 'autoCleanupOrphans'>;
|
|
1558
|
+
|
|
1559
|
+
interface ApplyIntoMainResult {
|
|
1560
|
+
applied: boolean;
|
|
1561
|
+
method: 'merge' | 'cherry-pick';
|
|
1562
|
+
targetBranch: string;
|
|
1563
|
+
message: string;
|
|
1564
|
+
}
|
|
1565
|
+
/**
|
|
1566
|
+
* Cursor `/apply-worktree` analog: bring the thread branch into the main
|
|
1567
|
+
* checkout without landing a PR. Human-gated; leaves the thread intact.
|
|
1568
|
+
*/
|
|
1569
|
+
declare function applyThreadIntoMain(thread: Pick<Thread, 'repoPath' | 'worktreePath' | 'branchName'>, opts?: {
|
|
1570
|
+
method?: 'merge' | 'cherry-pick';
|
|
1571
|
+
targetBranch?: string;
|
|
1572
|
+
}): Promise<ApplyIntoMainResult>;
|
|
1573
|
+
|
|
1574
|
+
declare class Orchestrator {
|
|
1575
|
+
readonly events: EventEmitter<[never]>;
|
|
1576
|
+
private readonly processes;
|
|
1577
|
+
private readonly activeTurns;
|
|
1578
|
+
private readonly draining;
|
|
1579
|
+
/** Threads past setStatus(running) but not yet in activeTurns (spawn in flight). */
|
|
1580
|
+
private readonly startingTurns;
|
|
1581
|
+
/**
|
|
1582
|
+
* Threads intentionally force-stopped. Prevents runTurn from re-asserting
|
|
1583
|
+
* `running` after spawn, and from overwriting `stopped` with idle/error when
|
|
1584
|
+
* the killed turn's handle.done resolves.
|
|
1585
|
+
*/
|
|
1586
|
+
private readonly stoppedTurns;
|
|
1587
|
+
/** WIP snapshot SHA at the start of the latest agent turn (per thread). */
|
|
1588
|
+
private readonly turnBaselines;
|
|
1589
|
+
private maxConcurrent;
|
|
1590
|
+
private runningCount;
|
|
1591
|
+
constructor(opts?: {
|
|
1592
|
+
maxConcurrent?: number;
|
|
1593
|
+
});
|
|
1594
|
+
on(listener: (event: OrchestratorEvent) => void): () => void;
|
|
1595
|
+
private emit;
|
|
1596
|
+
/** True when disk says running but this process is not actually turning. */
|
|
1597
|
+
private isStaleRunningThread;
|
|
1598
|
+
reconcile(repoPath?: string, opts?: {
|
|
1599
|
+
/**
|
|
1600
|
+
* When true (default), mark disk-status `running` threads with no in-process
|
|
1601
|
+
* turn as stopped. Must stay false in Sideboard MCP subprocesses — they do
|
|
1602
|
+
* not own agent turns, so every live parent turn looks "dead".
|
|
1603
|
+
*/
|
|
1604
|
+
reclaimStaleTurns?: boolean;
|
|
1605
|
+
}): Promise<void>;
|
|
1606
|
+
getThreads(includeArchived?: boolean): Thread[];
|
|
1607
|
+
getThread(idOrRef: string): Thread | null;
|
|
1608
|
+
createThread(input: CreateThreadInput): Promise<Thread>;
|
|
1609
|
+
listWorkspaces(): Workspace[];
|
|
1610
|
+
addWorkspace(repoPath: string): Promise<Workspace>;
|
|
1611
|
+
removeWorkspace(repoPath: string): void;
|
|
1612
|
+
adopt(input: Parameters<typeof adoptThread>[0]): Promise<Thread>;
|
|
1613
|
+
listConductor(): ConductorWorkspace[];
|
|
1614
|
+
adoptFromConductor(workspaceId: string): Promise<Thread>;
|
|
1615
|
+
send(threadRef: string, prompt: string): Promise<Thread>;
|
|
1616
|
+
fanOut(threadRefs: string[], prompt: string): Promise<Thread[]>;
|
|
1617
|
+
private drainQueue;
|
|
1618
|
+
private runTurn;
|
|
1619
|
+
/**
|
|
1620
|
+
* Stop an in-flight agent turn.
|
|
1621
|
+
* Default `clearQueue: true` (force-stop): kills the turn AND empties queued prompts
|
|
1622
|
+
* so drainQueue cannot continue / re-start work after an intentional stop. Desktop,
|
|
1623
|
+
* CLI, MCP, and cloud-connect all share this default.
|
|
1624
|
+
*/
|
|
1625
|
+
stop(threadRef: string, opts?: {
|
|
1626
|
+
clearQueue?: boolean;
|
|
1627
|
+
}): Thread;
|
|
1628
|
+
startDev(threadRef: string, scriptName?: string): Promise<{
|
|
1629
|
+
port: number;
|
|
1630
|
+
scriptName: string;
|
|
1631
|
+
ports: number[];
|
|
1632
|
+
}>;
|
|
1633
|
+
stopDev(threadRef: string, scriptName?: string): void;
|
|
1634
|
+
listThreadRunScripts(threadRef: string): RunScript[];
|
|
1635
|
+
getActiveRuns(threadRef: string): ActiveRun[];
|
|
1636
|
+
runSetup(threadRef: string): Promise<{
|
|
1637
|
+
exitCode: number | null;
|
|
1638
|
+
source?: string | null;
|
|
1639
|
+
}>;
|
|
1640
|
+
cancelSetup(threadRef: string): void;
|
|
1641
|
+
applyIntoMain(threadRef: string, opts?: {
|
|
1642
|
+
method?: 'merge' | 'cherry-pick';
|
|
1643
|
+
targetBranch?: string;
|
|
1644
|
+
}): Promise<ApplyIntoMainResult>;
|
|
1645
|
+
cloneRepo(url: string, name?: string): Promise<{
|
|
1646
|
+
repoPath: string;
|
|
1647
|
+
workspace: Workspace;
|
|
1648
|
+
}>;
|
|
1649
|
+
listOrphanWorktrees(repoPath?: string): Promise<OrphanWorktree[]>;
|
|
1650
|
+
cleanupOrphans(opts?: {
|
|
1651
|
+
dryRun?: boolean;
|
|
1652
|
+
maxCount?: number;
|
|
1653
|
+
repoPath?: string;
|
|
1654
|
+
}): Promise<CleanupOrphansResult>;
|
|
1655
|
+
/**
|
|
1656
|
+
* Best-of-n / fanout: create N threads (one per agent) with the same prompt.
|
|
1657
|
+
*/
|
|
1658
|
+
bestOfN(opts: {
|
|
1659
|
+
prompt: string;
|
|
1660
|
+
agents: AgentKind[];
|
|
1661
|
+
repoPath: string;
|
|
1662
|
+
sourceType?: 'branch' | 'pr' | 'ticket';
|
|
1663
|
+
sourceRef?: string;
|
|
1664
|
+
title?: string;
|
|
1665
|
+
}): Promise<Thread[]>;
|
|
1666
|
+
waitForTurn(threadRef: string, timeoutMs?: number): Promise<Thread>;
|
|
1667
|
+
getTurnResult(threadRef: string): {
|
|
1668
|
+
text: string;
|
|
1669
|
+
status: string;
|
|
1670
|
+
sessionId: string | null;
|
|
1671
|
+
};
|
|
1672
|
+
private assertNotGlobal;
|
|
1673
|
+
diff(threadRef: string, opts?: {
|
|
1674
|
+
scope?: DiffScope;
|
|
1675
|
+
commitSha?: string | null;
|
|
1676
|
+
}): Promise<DiffResult>;
|
|
1677
|
+
diffSummary(threadRef: string): Promise<{
|
|
1678
|
+
base: string;
|
|
1679
|
+
dirty: boolean;
|
|
1680
|
+
stat: string;
|
|
1681
|
+
files: Array<{
|
|
1682
|
+
path: string;
|
|
1683
|
+
status: string;
|
|
1684
|
+
patch: string;
|
|
1685
|
+
additions?: number;
|
|
1686
|
+
deletions?: number;
|
|
1687
|
+
}>;
|
|
1688
|
+
truncated: boolean;
|
|
1689
|
+
}>;
|
|
1690
|
+
initializeGit(threadRef: string): Promise<void>;
|
|
1691
|
+
listFiles(threadRef: string): Promise<string[]>;
|
|
1692
|
+
readFile(threadRef: string, relativePath: string): Promise<{
|
|
1693
|
+
path: string;
|
|
1694
|
+
content: string;
|
|
1695
|
+
truncated: boolean;
|
|
1696
|
+
binary: boolean;
|
|
1697
|
+
encoding: 'utf8' | 'base64';
|
|
1698
|
+
}>;
|
|
1699
|
+
writeFile(threadRef: string, relativePath: string, content: string): Promise<{
|
|
1700
|
+
path: string;
|
|
1701
|
+
}>;
|
|
1702
|
+
listSkills(threadRef: string): SkillInfo[];
|
|
1703
|
+
previewLand(threadRef: string): Promise<LandPreview>;
|
|
1704
|
+
confirmLand(threadRef: string, opts?: {
|
|
1705
|
+
draft?: boolean;
|
|
1706
|
+
web?: boolean;
|
|
1707
|
+
}): Promise<LandResult>;
|
|
1708
|
+
mergePr(threadRef: string): Promise<{
|
|
1709
|
+
url: string;
|
|
1710
|
+
state: string;
|
|
1711
|
+
}>;
|
|
1712
|
+
/** Resolve PR selector and optionally persist `prUrl` when found. */
|
|
1713
|
+
private withPrSelector;
|
|
1714
|
+
getPrChecks(threadRef: string): Promise<PrCheckRun[] | null>;
|
|
1715
|
+
getPrDetails(threadRef: string): Promise<PrDetails | null>;
|
|
1716
|
+
setAutonomy(threadRef: string, autonomy: Autonomy): Thread;
|
|
1717
|
+
setThreadOptions(threadRef: string, patch: ThreadOptionsPatch): Thread;
|
|
1718
|
+
createChatTab(input: {
|
|
1719
|
+
fromThreadId: string;
|
|
1720
|
+
agent?: Thread['agent'];
|
|
1721
|
+
title?: string;
|
|
1722
|
+
}): Thread;
|
|
1723
|
+
forkChatTab(input: {
|
|
1724
|
+
threadId: string;
|
|
1725
|
+
throughIndex?: number;
|
|
1726
|
+
agent?: Thread['agent'];
|
|
1727
|
+
title?: string;
|
|
1728
|
+
}): Thread;
|
|
1729
|
+
forkThreadWorktree(input: {
|
|
1730
|
+
threadId: string;
|
|
1731
|
+
throughIndex?: number;
|
|
1732
|
+
agent?: Thread['agent'];
|
|
1733
|
+
title?: string;
|
|
1734
|
+
}): Promise<Thread>;
|
|
1735
|
+
renameThread(threadRef: string, title: string): Thread;
|
|
1736
|
+
setAttachments(threadRef: string, attachments: Thread['attachments']): Thread;
|
|
1737
|
+
listWorktreeChats(threadRef: string): Thread[];
|
|
1738
|
+
archive(threadRef: string): Promise<Thread>;
|
|
1739
|
+
purge(threadRef: string, opts?: {
|
|
1740
|
+
deleteBranch?: boolean;
|
|
1741
|
+
}): Promise<void>;
|
|
1742
|
+
restore(threadRef: string): Promise<Thread>;
|
|
1743
|
+
attachCommand(threadRef: string): Promise<AttachCommand>;
|
|
1744
|
+
setMaxConcurrent(n: number): void;
|
|
1745
|
+
getRuntime(): OrchestratorRuntime;
|
|
1746
|
+
private requireThread;
|
|
1747
|
+
}
|
|
1748
|
+
declare function getOrchestrator(): Orchestrator;
|
|
1749
|
+
declare function startOrchestration(opts: {
|
|
1750
|
+
goal: string;
|
|
1751
|
+
agent: AgentKind;
|
|
1752
|
+
/** Omit or pass GLOBAL_WORKSPACE_ID for a home-less Global chat. */
|
|
1753
|
+
repoPath?: string;
|
|
1754
|
+
autonomy?: Thread['autonomy'];
|
|
1755
|
+
model?: string | null;
|
|
1756
|
+
fast?: boolean;
|
|
1757
|
+
planMode?: boolean;
|
|
1758
|
+
attachments?: Thread['attachments'];
|
|
1759
|
+
}): Promise<Thread>;
|
|
1760
|
+
|
|
1761
|
+
type WorkspaceInventoryEntry = Workspace & {
|
|
1762
|
+
/** Best-effort GitHub `owner/repo` from remote / gh. */
|
|
1763
|
+
githubSlug?: string | null;
|
|
1764
|
+
};
|
|
1765
|
+
/** Sync formatter — include `githubSlug` when already resolved. */
|
|
1766
|
+
declare function formatWorkspaceInventory(workspaces: WorkspaceInventoryEntry[]): string;
|
|
1767
|
+
/** Resolve GitHub slugs for registered workspaces (best-effort). */
|
|
1768
|
+
declare function enrichWorkspacesWithGithub(workspaces: Workspace[]): Promise<WorkspaceInventoryEntry[]>;
|
|
1769
|
+
declare const COORDINATOR_TOOL_PLAYBOOK: string;
|
|
1770
|
+
/**
|
|
1771
|
+
* Short identity block prepended to every orchestration turn prompt.
|
|
1772
|
+
* Survives Claude `--resume` (which drops cachedPrefix).
|
|
1773
|
+
*/
|
|
1774
|
+
declare function coordinatorTurnReminder(opts: {
|
|
1775
|
+
parentId: string;
|
|
1776
|
+
goal?: string;
|
|
1777
|
+
}): string;
|
|
1778
|
+
/**
|
|
1779
|
+
* Write durable CLAUDE.md / AGENTS.md into the global synthetic cwd so Claude
|
|
1780
|
+
* (and other agents that load AGENTS.md) keep orchestrator identity on resume.
|
|
1781
|
+
*/
|
|
1782
|
+
declare function ensureGlobalCoordinatorCwd(): string;
|
|
1783
|
+
declare function coordinatorSystemPrompt(opts: {
|
|
1784
|
+
goal: string;
|
|
1785
|
+
parentId: string;
|
|
1786
|
+
workspaces: WorkspaceInventoryEntry[];
|
|
1787
|
+
/** cloud = Brightsy reply framing; desktop = local Orchestration chat */
|
|
1788
|
+
audience?: 'cloud' | 'desktop';
|
|
1789
|
+
}): string;
|
|
1790
|
+
|
|
1791
|
+
/**
|
|
1792
|
+
* Clone a repo into ~/sideboard/repos/<name> and register it as a workspace
|
|
1793
|
+
* (Conductor Quick-start parity).
|
|
1794
|
+
*/
|
|
1795
|
+
declare function cloneRepoIntoSideboard(opts: {
|
|
1796
|
+
url: string;
|
|
1797
|
+
name?: string;
|
|
1798
|
+
}): Promise<{
|
|
1799
|
+
repoPath: string;
|
|
1800
|
+
workspace: Workspace;
|
|
1801
|
+
}>;
|
|
1802
|
+
|
|
1803
|
+
/**
|
|
1804
|
+
* Sideboard MCP server — agent-facing judgment surface.
|
|
1805
|
+
* Deliberately excludes ready-for-review confirm_land and purge_thread.
|
|
1806
|
+
* Draft PRs are allowed via create_draft_pr.
|
|
1807
|
+
*/
|
|
1808
|
+
declare function startMcpServer(): Promise<void>;
|
|
1809
|
+
|
|
1810
|
+
interface BrightsyLocalConfig {
|
|
1811
|
+
access_token: string;
|
|
1812
|
+
refresh_token?: string;
|
|
1813
|
+
account_id: string;
|
|
1814
|
+
account_slug?: string;
|
|
1815
|
+
endpoint?: string;
|
|
1816
|
+
expires_at?: number;
|
|
1817
|
+
oauth_client_id?: string;
|
|
1818
|
+
}
|
|
1819
|
+
declare function brightsyConfigPath(): string;
|
|
1820
|
+
declare function loadBrightsyConfig(): BrightsyLocalConfig;
|
|
1821
|
+
|
|
1822
|
+
interface BrightsyAccount {
|
|
1823
|
+
id: string;
|
|
1824
|
+
name: string;
|
|
1825
|
+
slug: string;
|
|
1826
|
+
picture_url?: string;
|
|
1827
|
+
role?: string;
|
|
1828
|
+
is_personal_account?: boolean;
|
|
1829
|
+
active?: boolean;
|
|
1830
|
+
}
|
|
1831
|
+
interface ConnectedBrightsyTeamInfo {
|
|
1832
|
+
id: string;
|
|
1833
|
+
slug: string;
|
|
1834
|
+
name: string;
|
|
1835
|
+
expires_at?: number;
|
|
1836
|
+
}
|
|
1837
|
+
interface BrightsySession {
|
|
1838
|
+
connected: boolean;
|
|
1839
|
+
endpoint: string;
|
|
1840
|
+
/** CLI / Brightsy agent active team (~/.brightsy). */
|
|
1841
|
+
accountId: string | null;
|
|
1842
|
+
accountSlug: string | null;
|
|
1843
|
+
accounts: BrightsyAccount[];
|
|
1844
|
+
/** Teams connected in Sideboard for concurrent MCP injection. */
|
|
1845
|
+
connectedTeams: ConnectedBrightsyTeamInfo[];
|
|
1846
|
+
reason?: string;
|
|
1847
|
+
}
|
|
1848
|
+
/** List teams via `brightsy teams --json`. */
|
|
1849
|
+
declare function listBrightsyAccounts(): Promise<BrightsyAccount[]>;
|
|
1850
|
+
declare function getBrightsySession(): Promise<BrightsySession>;
|
|
1851
|
+
/**
|
|
1852
|
+
* Activate a Brightsy team for CLI + MCP (same as connecting in Settings).
|
|
1853
|
+
*/
|
|
1854
|
+
declare function switchBrightsyAccount(accountIdOrSlug: string): Promise<BrightsySession>;
|
|
1855
|
+
|
|
1856
|
+
/** Live status of the Brightsy cloud connect daemon in the desktop app. */
|
|
1857
|
+
interface CloudConnectStatus {
|
|
1858
|
+
enabled: boolean;
|
|
1859
|
+
running: boolean;
|
|
1860
|
+
agent: BrightsyCloudConnectAgent;
|
|
1861
|
+
endpoint: string | null;
|
|
1862
|
+
workspaces: Workspace[];
|
|
1863
|
+
lastError: string | null;
|
|
1864
|
+
lastLog: string | null;
|
|
1865
|
+
}
|
|
1866
|
+
/** Shared typed surface for Electron preload ↔ renderer (and docs). */
|
|
1867
|
+
interface IpcApi {
|
|
1868
|
+
detectAgents(): Promise<AgentStatus[]>;
|
|
1869
|
+
getAppSettings(): Promise<AppSettings>;
|
|
1870
|
+
saveAppSettings(settings: AppSettings): Promise<AppSettings>;
|
|
1871
|
+
updateAppEnvironment(patch: Record<string, string | null | undefined>): Promise<AppSettings>;
|
|
1872
|
+
updateClaudeSettings(patch: Partial<ClaudeHarnessSettings> & {
|
|
1873
|
+
executablePath?: string | null;
|
|
1874
|
+
}): Promise<AppSettings>;
|
|
1875
|
+
/** Native file picker for a Claude Code executable override. */
|
|
1876
|
+
pickClaudeExecutable(): Promise<string | null>;
|
|
1877
|
+
/** Absolute path for PATH `claude`, or null if missing. */
|
|
1878
|
+
resolveSystemClaudePath(): Promise<string | null>;
|
|
1879
|
+
/** Ensure `~/.claude/settings.json` exists and open it in the OS default app. */
|
|
1880
|
+
openClaudeUserSettings(): Promise<void>;
|
|
1881
|
+
listBrightsyChatTargets(): Promise<BrightsyChatTargets>;
|
|
1882
|
+
/** Brightsy login + connected teams (shared by CLI, Brightsy agent, and Claude MCP). */
|
|
1883
|
+
getBrightsySession(): Promise<BrightsySession>;
|
|
1884
|
+
/** Connect/activate a team for CLI + MCP (same as connectBrightsyTeam). */
|
|
1885
|
+
switchBrightsyAccount(accountIdOrSlug: string): Promise<BrightsySession>;
|
|
1886
|
+
/** Connect a team for CLI + MCP; activates it as the CLI session. */
|
|
1887
|
+
connectBrightsyTeam(accountIdOrSlug: string): Promise<BrightsySession>;
|
|
1888
|
+
/** Disconnect a team from the shared CLI + MCP selection. */
|
|
1889
|
+
disconnectBrightsyTeam(accountIdOrSlug: string): Promise<BrightsySession>;
|
|
1890
|
+
/** Brightsy cloud remote orchestrator status (desktop daemon). */
|
|
1891
|
+
getCloudConnectStatus(): Promise<CloudConnectStatus>;
|
|
1892
|
+
/** Enable/disable cloud connect and optionally set the coordinator agent. */
|
|
1893
|
+
setCloudConnect(opts: {
|
|
1894
|
+
enabled?: boolean;
|
|
1895
|
+
agent?: BrightsyCloudConnectAgent;
|
|
1896
|
+
}): Promise<CloudConnectStatus>;
|
|
1897
|
+
updateBrightsySettings(patch: Partial<BrightsyHarnessSettings> & {
|
|
1898
|
+
cloudConnectAgent?: BrightsyCloudConnectAgent | null;
|
|
1899
|
+
}): Promise<AppSettings>;
|
|
1900
|
+
updateAdvancedSettings(patch: Partial<AdvancedAppSettings>): Promise<AppSettings>;
|
|
1901
|
+
updateIntegrationsSettings(patch: {
|
|
1902
|
+
linearApiKey?: string | null;
|
|
1903
|
+
issueSource?: IssueSource | null;
|
|
1904
|
+
}): Promise<AppSettings>;
|
|
1905
|
+
/** Machine-global GitHub status via `gh`. */
|
|
1906
|
+
getGitHubStatus(): Promise<GitHubStatus>;
|
|
1907
|
+
/**
|
|
1908
|
+
* Unified issues for Create-from / Link issue (Linear API or GitHub Issues,
|
|
1909
|
+
* based on Account preference with Linear→GitHub fallback).
|
|
1910
|
+
*/
|
|
1911
|
+
listIssues(repoPath: string): Promise<ListIssuesResult>;
|
|
1912
|
+
listBranches(repoPath: string, opts?: {
|
|
1913
|
+
unmergedOnly?: boolean;
|
|
1914
|
+
}): Promise<BranchInfo[]>;
|
|
1915
|
+
listPrs(repoPath: string): Promise<PrInfo[]>;
|
|
1916
|
+
/** @deprecated Prefer listIssues — agent Linear MCP. */
|
|
1917
|
+
listLinearIssues(agent: AgentKind, repoPath: string): Promise<IssueInfo[]>;
|
|
1918
|
+
resolveRepoRoot(cwd: string): Promise<string>;
|
|
1919
|
+
getThreads(includeArchived?: boolean): Promise<Thread[]>;
|
|
1920
|
+
getThread(idOrRef: string): Promise<Thread | null>;
|
|
1921
|
+
getRuntime(): Promise<OrchestratorRuntime>;
|
|
1922
|
+
setMaxConcurrent(n: number): Promise<void>;
|
|
1923
|
+
createThread(input: CreateThreadInput): Promise<Thread>;
|
|
1924
|
+
createChatTab(input: CreateChatTabInput): Promise<Thread>;
|
|
1925
|
+
forkChatTab(input: ForkChatTabInput): Promise<Thread>;
|
|
1926
|
+
forkThreadWorktree(input: ForkThreadWorktreeInput): Promise<Thread>;
|
|
1927
|
+
renameThread(threadRef: string, title: string): Promise<Thread>;
|
|
1928
|
+
setAttachments(threadRef: string, attachments: ThreadAttachment[]): Promise<Thread>;
|
|
1929
|
+
listWorktreeChats(threadRef: string): Promise<Thread[]>;
|
|
1930
|
+
listWorkspaces(): Promise<Workspace[]>;
|
|
1931
|
+
addWorkspace(repoPath: string): Promise<Workspace>;
|
|
1932
|
+
removeWorkspace(repoPath: string): Promise<void>;
|
|
1933
|
+
adopt(input: AdoptInput): Promise<Thread>;
|
|
1934
|
+
listConductor(): Promise<ConductorWorkspace[]>;
|
|
1935
|
+
adoptFromConductor(workspaceId: string): Promise<Thread>;
|
|
1936
|
+
sendToThread(threadRef: string, prompt: string): Promise<Thread>;
|
|
1937
|
+
setAutonomy(threadRef: string, autonomy: Autonomy): Promise<Thread>;
|
|
1938
|
+
setThreadOptions(threadRef: string, patch: ThreadOptionsPatch): Promise<Thread>;
|
|
1939
|
+
fanOut(threadRefs: string[], prompt: string): Promise<Thread[]>;
|
|
1940
|
+
startOrchestration(opts: {
|
|
1941
|
+
goal: string;
|
|
1942
|
+
agent: AgentKind;
|
|
1943
|
+
/** Omit for Global workspace (home-less). */
|
|
1944
|
+
repoPath?: string;
|
|
1945
|
+
autonomy?: Autonomy;
|
|
1946
|
+
model?: string | null;
|
|
1947
|
+
fast?: boolean;
|
|
1948
|
+
planMode?: boolean;
|
|
1949
|
+
attachments?: ThreadAttachment[];
|
|
1950
|
+
}): Promise<Thread>;
|
|
1951
|
+
createGlobalChat(opts: {
|
|
1952
|
+
title?: string;
|
|
1953
|
+
agent: AgentKind;
|
|
1954
|
+
autonomy?: Autonomy;
|
|
1955
|
+
model?: string | null;
|
|
1956
|
+
fast?: boolean;
|
|
1957
|
+
planMode?: boolean;
|
|
1958
|
+
attachments?: ThreadAttachment[];
|
|
1959
|
+
}): Promise<Thread>;
|
|
1960
|
+
ensureCloudCoordinator(agent: AgentKind): Promise<Thread>;
|
|
1961
|
+
stopThread(threadRef: string): Promise<Thread>;
|
|
1962
|
+
getDiff(threadRef: string, opts?: {
|
|
1963
|
+
scope?: DiffScope;
|
|
1964
|
+
commitSha?: string | null;
|
|
1965
|
+
}): Promise<DiffResult>;
|
|
1966
|
+
/** `git init` in the thread worktree when Changes has no Git repo (Cursor-style). */
|
|
1967
|
+
initializeGit(threadRef: string): Promise<void>;
|
|
1968
|
+
/** CI checks for the thread's linked PR (`gh pr checks`). `null` = no PR. */
|
|
1969
|
+
getPrChecks(threadRef: string): Promise<PrCheckRun[] | null>;
|
|
1970
|
+
/** PR description / commits / reviews for the Review tab. */
|
|
1971
|
+
getPrDetails(threadRef: string): Promise<PrDetails | null>;
|
|
1972
|
+
listFiles(threadRef: string): Promise<string[]>;
|
|
1973
|
+
readFile(threadRef: string, relativePath: string): Promise<{
|
|
1974
|
+
path: string;
|
|
1975
|
+
content: string;
|
|
1976
|
+
truncated: boolean;
|
|
1977
|
+
binary: boolean;
|
|
1978
|
+
encoding: 'utf8' | 'base64';
|
|
1979
|
+
}>;
|
|
1980
|
+
writeFile(threadRef: string, relativePath: string, content: string): Promise<{
|
|
1981
|
+
path: string;
|
|
1982
|
+
}>;
|
|
1983
|
+
/** Watch the open file in the worktree; replaces any previous watch. */
|
|
1984
|
+
watchOpenFile(threadRef: string, relativePath: string): Promise<void>;
|
|
1985
|
+
unwatchOpenFile(): Promise<void>;
|
|
1986
|
+
/** Fired when the watched open file changes on disk. */
|
|
1987
|
+
onOpenFileChanged(listener: (payload: {
|
|
1988
|
+
threadRef: string;
|
|
1989
|
+
path: string;
|
|
1990
|
+
}) => void): () => void;
|
|
1991
|
+
listSkills(threadRef: string): Promise<Array<{
|
|
1992
|
+
id: string;
|
|
1993
|
+
name: string;
|
|
1994
|
+
command: string;
|
|
1995
|
+
description: string;
|
|
1996
|
+
path: string;
|
|
1997
|
+
source: 'workspace' | 'user' | 'cli';
|
|
1998
|
+
}>>;
|
|
1999
|
+
openInEditor(threadRef: string, editor?: string, relativePath?: string): Promise<void>;
|
|
2000
|
+
openWorktree(threadRef: string, target: 'finder' | 'cursor' | 'code' | 'xcode' | 'terminal' | 'datagrip'): Promise<void>;
|
|
2001
|
+
runDevScript(threadRef: string, scriptName?: string): Promise<{
|
|
2002
|
+
port: number;
|
|
2003
|
+
scriptName: string;
|
|
2004
|
+
ports: number[];
|
|
2005
|
+
}>;
|
|
2006
|
+
stopDevScript(threadRef: string, scriptName?: string): Promise<void>;
|
|
2007
|
+
listRunScripts(threadRef: string): Promise<Array<{
|
|
2008
|
+
name: string;
|
|
2009
|
+
command: string;
|
|
2010
|
+
default?: boolean;
|
|
2011
|
+
icon?: string;
|
|
2012
|
+
}>>;
|
|
2013
|
+
getActiveRuns(threadRef: string): Promise<Array<{
|
|
2014
|
+
scriptName: string;
|
|
2015
|
+
port: number;
|
|
2016
|
+
ports: number[];
|
|
2017
|
+
startedAt: string;
|
|
2018
|
+
}>>;
|
|
2019
|
+
previewLand(threadRef: string): Promise<LandPreview>;
|
|
2020
|
+
confirmLand(threadRef: string, opts?: {
|
|
2021
|
+
draft?: boolean;
|
|
2022
|
+
web?: boolean;
|
|
2023
|
+
}): Promise<LandResult>;
|
|
2024
|
+
/** Merge the thread's linked PR on GitHub (`gh pr merge`). */
|
|
2025
|
+
mergePr(threadRef: string): Promise<{
|
|
2026
|
+
url: string;
|
|
2027
|
+
state: string;
|
|
2028
|
+
}>;
|
|
2029
|
+
archiveThread(threadRef: string): Promise<Thread>;
|
|
2030
|
+
purgeThread(threadRef: string, opts?: {
|
|
2031
|
+
deleteBranch?: boolean;
|
|
2032
|
+
}): Promise<void>;
|
|
2033
|
+
restoreThread(threadRef: string): Promise<Thread>;
|
|
2034
|
+
applyIntoMain(threadRef: string, opts?: {
|
|
2035
|
+
method?: 'merge' | 'cherry-pick';
|
|
2036
|
+
targetBranch?: string;
|
|
2037
|
+
}): Promise<{
|
|
2038
|
+
applied: boolean;
|
|
2039
|
+
method: string;
|
|
2040
|
+
targetBranch: string;
|
|
2041
|
+
message: string;
|
|
2042
|
+
}>;
|
|
2043
|
+
cloneRepo(url: string, name?: string): Promise<{
|
|
2044
|
+
repoPath: string;
|
|
2045
|
+
workspace: Workspace;
|
|
2046
|
+
}>;
|
|
2047
|
+
listOrphanWorktrees(repoPath?: string): Promise<Array<{
|
|
2048
|
+
path: string;
|
|
2049
|
+
repoPath: string;
|
|
2050
|
+
mtimeMs: number;
|
|
2051
|
+
}>>;
|
|
2052
|
+
cleanupOrphans(opts?: {
|
|
2053
|
+
dryRun?: boolean;
|
|
2054
|
+
maxCount?: number;
|
|
2055
|
+
repoPath?: string;
|
|
2056
|
+
}): Promise<{
|
|
2057
|
+
removed: string[];
|
|
2058
|
+
kept: string[];
|
|
2059
|
+
}>;
|
|
2060
|
+
bestOfN(opts: {
|
|
2061
|
+
prompt: string;
|
|
2062
|
+
agents: AgentKind[];
|
|
2063
|
+
repoPath: string;
|
|
2064
|
+
sourceType?: 'branch' | 'pr' | 'ticket';
|
|
2065
|
+
sourceRef?: string;
|
|
2066
|
+
title?: string;
|
|
2067
|
+
}): Promise<Thread[]>;
|
|
2068
|
+
/** Attach into the native agent CLI (opens a PTY session when available). */
|
|
2069
|
+
attachThread(threadRef: string): Promise<{
|
|
2070
|
+
file: string;
|
|
2071
|
+
args: string[];
|
|
2072
|
+
cwd: string;
|
|
2073
|
+
}>;
|
|
2074
|
+
/** Embedded terminal (PTY) IPC. */
|
|
2075
|
+
terminal: {
|
|
2076
|
+
start(threadRef: string, cols?: number, rows?: number): Promise<{
|
|
2077
|
+
id: string;
|
|
2078
|
+
}>;
|
|
2079
|
+
/** Start a PTY running the native agent attach command. */
|
|
2080
|
+
attach(threadRef: string, cols?: number, rows?: number): Promise<{
|
|
2081
|
+
id: string;
|
|
2082
|
+
}>;
|
|
2083
|
+
write(id: string, data: string): Promise<void>;
|
|
2084
|
+
resize(id: string, cols: number, rows: number): Promise<void>;
|
|
2085
|
+
kill(id: string): Promise<void>;
|
|
2086
|
+
onData(listener: (payload: {
|
|
2087
|
+
id: string;
|
|
2088
|
+
data: string;
|
|
2089
|
+
}) => void): () => void;
|
|
2090
|
+
onExit(listener: (payload: {
|
|
2091
|
+
id: string;
|
|
2092
|
+
exitCode: number | null;
|
|
2093
|
+
}) => void): () => void;
|
|
2094
|
+
};
|
|
2095
|
+
/** Subscribe to orchestrator events; returns unsubscribe. */
|
|
2096
|
+
onEvent(listener: (event: OrchestratorEvent) => void): () => void;
|
|
2097
|
+
/** Subscribe to store directory changes (CLI threads appear live). */
|
|
2098
|
+
onThreadsChanged(listener: () => void): () => void;
|
|
2099
|
+
getRepoPath(): Promise<string>;
|
|
2100
|
+
setRepoPath(path: string): Promise<string>;
|
|
2101
|
+
pickRepoPath(): Promise<string | null>;
|
|
2102
|
+
/** Native file picker; returns attachments ready for the composer. */
|
|
2103
|
+
pickFiles(): Promise<ThreadAttachment[]>;
|
|
2104
|
+
/** Prefer worktree settings; optional main-repo fallback. */
|
|
2105
|
+
hasConductorHook(worktreePath: string, repoPath?: string | null): Promise<boolean>;
|
|
2106
|
+
getRepoSetupInfo(worktreePath: string, repoPath?: string | null): Promise<{
|
|
2107
|
+
hasConfig: boolean;
|
|
2108
|
+
hasSetupScript: boolean;
|
|
2109
|
+
configLabel: string | null;
|
|
2110
|
+
}>;
|
|
2111
|
+
runSetup(threadRef: string): Promise<{
|
|
2112
|
+
exitCode: number | null;
|
|
2113
|
+
}>;
|
|
2114
|
+
openExternal(url: string): Promise<void>;
|
|
2115
|
+
/** Main-process tsserver for real import/type diagnostics in the file UI. */
|
|
2116
|
+
tsserver: {
|
|
2117
|
+
start(worktreePath?: string): Promise<{
|
|
2118
|
+
success: boolean;
|
|
2119
|
+
error?: string;
|
|
2120
|
+
}>;
|
|
2121
|
+
stop(): Promise<{
|
|
2122
|
+
success: boolean;
|
|
2123
|
+
error?: string;
|
|
2124
|
+
}>;
|
|
2125
|
+
isRunning(): Promise<boolean>;
|
|
2126
|
+
openFile(absPath: string, content?: string): Promise<{
|
|
2127
|
+
success: boolean;
|
|
2128
|
+
error?: string;
|
|
2129
|
+
}>;
|
|
2130
|
+
closeFile(absPath: string): Promise<{
|
|
2131
|
+
success: boolean;
|
|
2132
|
+
error?: string;
|
|
2133
|
+
}>;
|
|
2134
|
+
updateFile(absPath: string, content: string): Promise<{
|
|
2135
|
+
success: boolean;
|
|
2136
|
+
error?: string;
|
|
2137
|
+
}>;
|
|
2138
|
+
diagnostics(absPath: string): Promise<{
|
|
2139
|
+
success: boolean;
|
|
2140
|
+
error?: string;
|
|
2141
|
+
semanticSeq?: number;
|
|
2142
|
+
syntacticSeq?: number;
|
|
2143
|
+
}>;
|
|
2144
|
+
onMessage(listener: (message: unknown) => void): () => void;
|
|
2145
|
+
};
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
interface SideboardCloudTask {
|
|
2149
|
+
id: string;
|
|
2150
|
+
user_id: string;
|
|
2151
|
+
account_id: string;
|
|
2152
|
+
device_id: string | null;
|
|
2153
|
+
source_agent_id: string;
|
|
2154
|
+
source_chat_id: string | null;
|
|
2155
|
+
message: {
|
|
2156
|
+
parts?: Array<{
|
|
2157
|
+
kind?: string;
|
|
2158
|
+
text?: string;
|
|
2159
|
+
}>;
|
|
2160
|
+
};
|
|
2161
|
+
messages?: Array<{
|
|
2162
|
+
role: 'cloud' | 'desktop';
|
|
2163
|
+
content: unknown;
|
|
2164
|
+
created_at?: string;
|
|
2165
|
+
}> | null;
|
|
2166
|
+
task_status: string;
|
|
2167
|
+
response: unknown;
|
|
2168
|
+
created_at: string;
|
|
2169
|
+
updated_at: string;
|
|
2170
|
+
expires_at: string | null;
|
|
2171
|
+
}
|
|
2172
|
+
type FetchLike = typeof fetch;
|
|
2173
|
+
type BrightsySideboardApiOptions = {
|
|
2174
|
+
cfg?: BrightsyLocalConfig;
|
|
2175
|
+
/**
|
|
2176
|
+
* Electron main should pass `net.fetch` (Chromium stack). Node's undici
|
|
2177
|
+
* `fetch` often surfaces as opaque "fetch failed" behind system proxies/VPN.
|
|
2178
|
+
*/
|
|
2179
|
+
fetchImpl?: FetchLike;
|
|
2180
|
+
};
|
|
2181
|
+
/** Expand undici/Electron `TypeError: fetch failed` with the underlying cause. */
|
|
2182
|
+
declare function formatBrightsyFetchError(err: unknown, url: string): string;
|
|
2183
|
+
/**
|
|
2184
|
+
* Minimal Brightsy HTTP client using ~/.brightsy/config.json (same session as CLI).
|
|
2185
|
+
*/
|
|
2186
|
+
declare class BrightsySideboardApi {
|
|
2187
|
+
private cfg;
|
|
2188
|
+
private readonly fetchImpl;
|
|
2189
|
+
constructor(cfgOrOpts?: BrightsyLocalConfig | BrightsySideboardApiOptions);
|
|
2190
|
+
get accountId(): string;
|
|
2191
|
+
get endpoint(): string;
|
|
2192
|
+
private request;
|
|
2193
|
+
private refreshIfNeeded;
|
|
2194
|
+
getAccess(): Promise<{
|
|
2195
|
+
enabled: boolean;
|
|
2196
|
+
allow_always: boolean;
|
|
2197
|
+
}>;
|
|
2198
|
+
setAccess(enabled: boolean, allow_always?: boolean): Promise<{
|
|
2199
|
+
enabled: boolean;
|
|
2200
|
+
allow_always: boolean;
|
|
2201
|
+
}>;
|
|
2202
|
+
getTasks(status?: string): Promise<SideboardCloudTask[]>;
|
|
2203
|
+
approveTask(taskId: string): Promise<void>;
|
|
2204
|
+
markRunning(taskId: string): Promise<void>;
|
|
2205
|
+
submitResponse(taskId: string, response: string): Promise<void>;
|
|
2206
|
+
}
|
|
2207
|
+
declare function taskMessageText(task: SideboardCloudTask): string;
|
|
2208
|
+
|
|
2209
|
+
/** Title / sourceRef for the singleton Brightsy cloud coordinator chat. */
|
|
2210
|
+
declare const CLOUD_ORCHESTRATOR_GOAL = "Cloud-connected Sideboard orchestrator";
|
|
2211
|
+
/**
|
|
2212
|
+
* First-line token for a desktop task that force-stops the in-progress
|
|
2213
|
+
* Brightsy-marked orchestration turn. Optional follow-up request may follow
|
|
2214
|
+
* on later lines.
|
|
2215
|
+
*/
|
|
2216
|
+
declare const SIDEBOARD_FORCE_STOP = "SIDEBOARD_FORCE_STOP";
|
|
2217
|
+
/** Fixed non-AI reply when the cloud coordinator is already busy. */
|
|
2218
|
+
declare const CLOUD_COORDINATOR_BUSY_REPLY: string;
|
|
2219
|
+
/** Fixed non-AI reply when a force-stop task had no follow-up request. */
|
|
2220
|
+
declare const CLOUD_COORDINATOR_STOPPED_REPLY: string;
|
|
2221
|
+
/** Fixed non-AI reply when wait_for_turn times out. */
|
|
2222
|
+
declare const CLOUD_COORDINATOR_TIMEOUT_REPLY: string;
|
|
2223
|
+
/**
|
|
2224
|
+
* Detect a force-stop directive on the first line of a desktop task message.
|
|
2225
|
+
* Force-stop is true only when that line (trimmed, case-insensitive) equals
|
|
2226
|
+
* {@link SIDEBOARD_FORCE_STOP}. Remainder is everything after the first line
|
|
2227
|
+
* (trimmed); empty when stop-only. When forceStop is false, remainder is the original message.
|
|
2228
|
+
*/
|
|
2229
|
+
declare function parseForceStopMessage(message: string): {
|
|
2230
|
+
forceStop: boolean;
|
|
2231
|
+
remainder: string;
|
|
2232
|
+
};
|
|
2233
|
+
|
|
2234
|
+
type CloudConnectAgent = Exclude<AgentKind, 'brightsy'>;
|
|
2235
|
+
interface CloudConnectOptions {
|
|
2236
|
+
agent: CloudConnectAgent;
|
|
2237
|
+
/** @deprecated Ignored — cloud connect uses the Global workspace coordinator. */
|
|
2238
|
+
repoPath?: string;
|
|
2239
|
+
/** Auto-enable Brightsy desktop access if disabled. Default true. */
|
|
2240
|
+
enableAccess?: boolean;
|
|
2241
|
+
/** When enabling access, set allow_always. Default true for connect daemon. */
|
|
2242
|
+
allowAlways?: boolean;
|
|
2243
|
+
pollIntervalMs?: number;
|
|
2244
|
+
onLog?: (line: string) => void;
|
|
2245
|
+
signal?: AbortSignal;
|
|
2246
|
+
/** Prefer Electron `net.fetch` when running in the desktop main process. */
|
|
2247
|
+
fetchImpl?: typeof fetch;
|
|
2248
|
+
/** Optional pre-built API client (tests / custom auth). */
|
|
2249
|
+
api?: BrightsySideboardApi;
|
|
2250
|
+
}
|
|
2251
|
+
/**
|
|
2252
|
+
* Poll Brightsy desktop inbound tasks and route them to the local
|
|
2253
|
+
* global orchestrator (coordinator chat + MCP across all workspaces).
|
|
2254
|
+
*/
|
|
2255
|
+
declare function runCloudConnect(opts: CloudConnectOptions): Promise<void>;
|
|
2256
|
+
|
|
2257
|
+
declare function listConnectedBrightsyTeams(): ConnectedBrightsyTeamInfo[];
|
|
2258
|
+
/**
|
|
2259
|
+
* Connect a team for MCP + CLI: mint/store a team token and make it the
|
|
2260
|
+
* active ~/.brightsy session (Brightsy agent / CLI).
|
|
2261
|
+
*/
|
|
2262
|
+
declare function connectBrightsyTeam(accountIdOrSlug: string): Promise<ConnectedBrightsyTeamInfo[]>;
|
|
2263
|
+
declare function disconnectBrightsyTeam(accountIdOrSlug: string): Promise<ConnectedBrightsyTeamInfo[]>;
|
|
2264
|
+
/** Sanitize slug for Claude MCP server / tool name segments. */
|
|
2265
|
+
declare function brightsyMcpServerName(slug: string): string;
|
|
2266
|
+
|
|
2267
|
+
/** Claude --allowedTools entries for Sideboard MCP. */
|
|
2268
|
+
declare const SIDEBOARD_MCP_ALLOWED_TOOLS: readonly ["mcp__sideboard", "mcp__sideboard__*"];
|
|
2269
|
+
/** Legacy single-server allow list (CLI ~/.brightsy fallback). */
|
|
2270
|
+
declare const BRIGHTSY_MCP_ALLOWED_TOOLS: readonly ["mcp__brightsy", "mcp__brightsy__*"];
|
|
2271
|
+
/** True when ~/.brightsy/config.json has a usable login session. */
|
|
2272
|
+
declare function isBrightsyConnected(): boolean;
|
|
2273
|
+
/** Allow-tool patterns for one or more Brightsy MCP server names. */
|
|
2274
|
+
declare function brightsyMcpAllowedTools(serverNames: string[]): string[];
|
|
2275
|
+
/**
|
|
2276
|
+
* Write a temp Claude `--mcp-config` JSON for injected Sideboard / Brightsy MCP.
|
|
2277
|
+
* Returns null when there is nothing to inject.
|
|
2278
|
+
*/
|
|
2279
|
+
declare function writeInjectedMcpConfig(opts: {
|
|
2280
|
+
includeSideboard?: boolean;
|
|
2281
|
+
includeBrightsy?: boolean;
|
|
2282
|
+
}): Promise<string | null>;
|
|
2283
|
+
|
|
2284
|
+
export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, type AgentStatus, type AgentTurnInput, type AnthropicCacheControl, type AppSettings, type ApplyIntoMainResult, type AttachCommand, type Autonomy, BRIGHTSY_MCP_ALLOWED_TOOLS, type BranchInfo, type BrightsyAccount, type BrightsyChatTarget, type BrightsyChatTargets, type BrightsyCloudConnectAgent, type BrightsyHarnessSettings, type BrightsySession, BrightsySideboardApi, type BrightsyTeamTargets, CLOUD_COORDINATOR_BUSY_REPLY, CLOUD_COORDINATOR_STOPPED_REPLY, CLOUD_COORDINATOR_TIMEOUT_REPLY, CLOUD_ORCHESTRATOR_GOAL, CONTEXT_COMPACT_CHARS, CONTEXT_KEEP_RECENT_CHARS, CONTEXT_KEEP_RECENT_MESSAGES, CONTEXT_MIN_MESSAGES, COORDINATOR_TOOL_PLAYBOOK, type ClaudeHarnessSettings, type CleanupOrphansResult, type CloudConnectAgent, type CloudConnectOptions, type CloudConnectStatus, type CompactResult, type CompactThresholds, type ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, type DevServerHandle, type DiffCommit, type DiffFile, type DiffResult, type DiffScope, type DiffScopeStat, type ExpandResult, FAMOUS_SOCCER_TEAMS, type ForkChatTabInput, type ForkThreadWorktreeInput, GLOBAL_WORKSPACE_ID, type GetDiffOptions, type GitHubStatus, type GitWorktreeStatus, HARNESS_ENV_KEYS, type HarnessId, type IntegrationsSettings, type IpcApi, type IssueInfo, type IssueSource, type LandPreview, type LandResult, type ListIssuesResult, MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS, type McpServerStatus, type MessagePart, Orchestrator, type OrchestratorEvent, type OrchestratorRuntime, type OrphanWorktree, PLAN_MODE_INSTRUCTION, type PrActor, type PrCheckRun, type PrCommentInfo, type PrCommitInfo, type PrDetails, type PrInfo, type PrReviewInfo, type RepoSettings, type RepoSetupInfo, type RunMode, type RunScript, SIDEBOARD_FORCE_STOP, SIDEBOARD_MCP_ALLOWED_TOOLS, type ScriptHandle, type SkillInfo, type SourceType, type SpawnTurnHandle, type SummarizeResult, type TeamName, type Thread, type ThreadAttachment, type ThreadMessage, type ThreadOptionsPatch, type ThreadStatus, type TokenUsage, type TranscriptToolDetail, type TurnCommand, type Workspace, type WorkspaceInventoryEntry, type WorkspaceScriptEnvOpts, addWorkspace, adoptThread, allAdapters, allocatePort, allocatePortRange, allocateTeamName, allocateTeamSlug, appDataDir, appSettingsPath, appendMessage, applyAgentEvent, applyAppEnvironment, applyCompaction, applyThreadIntoMain, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildForkTranscriptAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, captureLoginEnv, captureTurnBaseline, childEnvWithAppSettings, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, cloneRepoIntoSideboard, codexAdapter, collectTakenTeamSlugs, commitAll, conductorDbPath, confirmLand, connectBrightsyTeam, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, createChatTab, createEmptyThread, createGlobalChat, createOrUpdatePr, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, deleteBranchOnPurgeEnabled, deleteThreadRecord, detectAgents, detectLocalMergeConflicts, disconnectBrightsyTeam, discoverSkills, encodeBrightsyTarget, enrichWorkspacesWithGithub, ensureAgentPath, ensureCloudCoordinator, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatBrightsyFetchError, formatMessagesAsTranscript, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getBrightsySession, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getIssueSource, getLinearApiKey, getOrchestrator, getPr, getPrChecks, getPrDetails, getRepoSetupInfo, getRunMode, getRunScript, gh, git, globalAgentCwd, harnessEnvKey, hasConductorHook, hasCursorWorktreeSetup, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, importConductorWorkspace, importConductorWorkspaceAsync, initializeGitRepository, inspectGitWorktree, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isDirty, isGlobalRepoPath, isGlobalThread, isLinearConnected, isOrchestratorThread, isPlaceholderBranch, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listConductorWorkspaces, listConnectedBrightsyTeams, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
|