@rucher/carnet 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/carnet-B9opMp0K.d.mts +1228 -0
- package/dist/carnet-B9opMp0K.d.mts.map +1 -0
- package/dist/index.d.mts +224 -21
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +410 -110
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.d.mts +4 -4
- package/dist/mcp.d.mts.map +1 -1
- package/dist/mcp.mjs +261 -154
- package/dist/mcp.mjs.map +1 -1
- package/dist/{steps-DfvHqzF0.mjs → usage-D3xjR_RF.mjs} +4657 -1993
- package/dist/usage-D3xjR_RF.mjs.map +1 -0
- package/package.json +2 -1
- package/dist/carnet-D3zpKpdn.d.mts +0 -646
- package/dist/carnet-D3zpKpdn.d.mts.map +0 -1
- package/dist/steps-DfvHqzF0.mjs.map +0 -1
|
@@ -0,0 +1,1228 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { DatabaseSync } from "node:sqlite";
|
|
3
|
+
declare const DELIVERABLES: readonly ['report', 'questions', 'plan', 'findings', 'worktree'];
|
|
4
|
+
declare const deliverable: z.ZodEnum<{
|
|
5
|
+
findings: "findings";
|
|
6
|
+
plan: "plan";
|
|
7
|
+
questions: "questions";
|
|
8
|
+
report: "report";
|
|
9
|
+
worktree: "worktree";
|
|
10
|
+
}>;
|
|
11
|
+
type Deliverable = z.infer<typeof deliverable>;
|
|
12
|
+
declare const attachment: z.ZodDiscriminatedUnion<readonly [z.ZodObject<{
|
|
13
|
+
type: z.ZodLiteral<"ref">;
|
|
14
|
+
id: z.ZodNumber;
|
|
15
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
16
|
+
type: z.ZodLiteral<"deliverable">;
|
|
17
|
+
agent: z.ZodNumber;
|
|
18
|
+
section: z.ZodEnum<{
|
|
19
|
+
plan: "plan";
|
|
20
|
+
report: "report";
|
|
21
|
+
}>;
|
|
22
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
23
|
+
type: z.ZodLiteral<"for_main">;
|
|
24
|
+
agent: z.ZodNumber;
|
|
25
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
26
|
+
type: z.ZodLiteral<"findings">;
|
|
27
|
+
review: z.ZodNumber;
|
|
28
|
+
n: z.ZodArray<z.ZodNumber>;
|
|
29
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
30
|
+
type: z.ZodLiteral<"notes">;
|
|
31
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
32
|
+
query: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>], "type">;
|
|
34
|
+
type Attachment = z.infer<typeof attachment>;
|
|
35
|
+
declare const attachments: z.ZodArray<z.ZodDiscriminatedUnion<readonly [z.ZodObject<{
|
|
36
|
+
type: z.ZodLiteral<"ref">;
|
|
37
|
+
id: z.ZodNumber;
|
|
38
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
39
|
+
type: z.ZodLiteral<"deliverable">;
|
|
40
|
+
agent: z.ZodNumber;
|
|
41
|
+
section: z.ZodEnum<{
|
|
42
|
+
plan: "plan";
|
|
43
|
+
report: "report";
|
|
44
|
+
}>;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
type: z.ZodLiteral<"for_main">;
|
|
47
|
+
agent: z.ZodNumber;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
type: z.ZodLiteral<"findings">;
|
|
50
|
+
review: z.ZodNumber;
|
|
51
|
+
n: z.ZodArray<z.ZodNumber>;
|
|
52
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
53
|
+
type: z.ZodLiteral<"notes">;
|
|
54
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
55
|
+
query: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>], "type">>;
|
|
57
|
+
declare const attachmentInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
58
|
+
type: z.ZodLiteral<"ref">;
|
|
59
|
+
id: z.ZodNumber;
|
|
60
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
61
|
+
type: z.ZodLiteral<"deliverable">;
|
|
62
|
+
agent: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
63
|
+
section: z.ZodEnum<{
|
|
64
|
+
plan: "plan";
|
|
65
|
+
report: "report";
|
|
66
|
+
}>;
|
|
67
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
68
|
+
type: z.ZodLiteral<"for_main">;
|
|
69
|
+
agent: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
70
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
+
type: z.ZodLiteral<"findings">;
|
|
72
|
+
review: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
73
|
+
n: z.ZodArray<z.ZodNumber>;
|
|
74
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
75
|
+
type: z.ZodLiteral<"notes">;
|
|
76
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
77
|
+
query: z.ZodOptional<z.ZodString>;
|
|
78
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"doc">;
|
|
80
|
+
path: z.ZodString;
|
|
81
|
+
}, z.core.$strip>], "type">;
|
|
82
|
+
type AttachmentInput = z.infer<typeof attachmentInput>;
|
|
83
|
+
declare const attachmentsInput: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
84
|
+
type: z.ZodLiteral<"ref">;
|
|
85
|
+
id: z.ZodNumber;
|
|
86
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
87
|
+
type: z.ZodLiteral<"deliverable">;
|
|
88
|
+
agent: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
89
|
+
section: z.ZodEnum<{
|
|
90
|
+
plan: "plan";
|
|
91
|
+
report: "report";
|
|
92
|
+
}>;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
type: z.ZodLiteral<"for_main">;
|
|
95
|
+
agent: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
96
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
97
|
+
type: z.ZodLiteral<"findings">;
|
|
98
|
+
review: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
99
|
+
n: z.ZodArray<z.ZodNumber>;
|
|
100
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
101
|
+
type: z.ZodLiteral<"notes">;
|
|
102
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
103
|
+
query: z.ZodOptional<z.ZodString>;
|
|
104
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
105
|
+
type: z.ZodLiteral<"doc">;
|
|
106
|
+
path: z.ZodString;
|
|
107
|
+
}, z.core.$strip>], "type">>;
|
|
108
|
+
declare const produced: z.ZodArray<z.ZodEnum<{
|
|
109
|
+
findings: "findings";
|
|
110
|
+
plan: "plan";
|
|
111
|
+
questions: "questions";
|
|
112
|
+
report: "report";
|
|
113
|
+
worktree: "worktree";
|
|
114
|
+
}>>;
|
|
115
|
+
type Produced = z.infer<typeof produced>;
|
|
116
|
+
declare const recommendedThen: z.ZodObject<{
|
|
117
|
+
option: z.ZodString;
|
|
118
|
+
reason: z.ZodString;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
type RecommendedThen = z.infer<typeof recommendedThen>;
|
|
121
|
+
declare const snapshot: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
122
|
+
type Snapshot = z.infer<typeof snapshot>;
|
|
123
|
+
interface Ctx {
|
|
124
|
+
db: DatabaseSync;
|
|
125
|
+
now: () => Date;
|
|
126
|
+
workspace: string | null;
|
|
127
|
+
}
|
|
128
|
+
declare const EVENT_TYPES: readonly ['started', 'finished', 'answered', 'applied', 'tested', 'committed', 'dropped', 'injected', 'promoted', 'triaged', 'reopened', 'briefed'];
|
|
129
|
+
declare const SESSION_EVENT_TYPES: readonly ['session.started', 'session.resumed', 'session.ended', 'session.forked'];
|
|
130
|
+
type AgentEventType = (typeof EVENT_TYPES)[number];
|
|
131
|
+
type SessionEventType = (typeof SESSION_EVENT_TYPES)[number];
|
|
132
|
+
type EventType = AgentEventType | SessionEventType;
|
|
133
|
+
interface CarnetEvent {
|
|
134
|
+
id: number;
|
|
135
|
+
session: string;
|
|
136
|
+
at: string;
|
|
137
|
+
type: EventType;
|
|
138
|
+
agent: string | null;
|
|
139
|
+
agentId: number | null;
|
|
140
|
+
commit: string | null;
|
|
141
|
+
link: string | null;
|
|
142
|
+
note: string | null;
|
|
143
|
+
payload: unknown;
|
|
144
|
+
}
|
|
145
|
+
interface LogEventInput {
|
|
146
|
+
type: EventType;
|
|
147
|
+
agent?: string | undefined;
|
|
148
|
+
agentId?: number | undefined;
|
|
149
|
+
payload?: unknown;
|
|
150
|
+
commit?: string | undefined;
|
|
151
|
+
link?: string | undefined;
|
|
152
|
+
note?: string | undefined;
|
|
153
|
+
}
|
|
154
|
+
declare function isEventType(value: unknown): value is EventType;
|
|
155
|
+
declare const AGENT_STATUSES: readonly ['running', 'discussing', 'answer', 'review', 'apply', 'test', 'closed'];
|
|
156
|
+
type AgentStatus = (typeof AGENT_STATUSES)[number];
|
|
157
|
+
declare const USER_ACTION_STATUSES: readonly ['discussing', 'answer', 'review', 'apply', 'test'];
|
|
158
|
+
type UserActionStatus = (typeof USER_ACTION_STATUSES)[number];
|
|
159
|
+
declare const EMOJI: Record<Exclude<AgentStatus, 'closed'>, string>;
|
|
160
|
+
declare const MAIN_WORKING_EMOJI = "⚙️";
|
|
161
|
+
declare const MAIN_WAITING_EMOJI = "⏸";
|
|
162
|
+
declare const MAIN_FAILED_EMOJI = "⚠";
|
|
163
|
+
declare const LEGEND = "⚙️ main working · ⏸ waiting on you · ⚠ turn failed · 💬 discussing · ❓ answer · 👀 review · 📥 apply · 🧪 test · ⏳ running";
|
|
164
|
+
declare const KIND_ABBREVIATIONS: {
|
|
165
|
+
readonly research: 'rs';
|
|
166
|
+
readonly plan: 'pl';
|
|
167
|
+
readonly implement: 'im';
|
|
168
|
+
readonly review: 'rv';
|
|
169
|
+
};
|
|
170
|
+
declare function kindTag(kind: keyof typeof KIND_ABBREVIATIONS): string;
|
|
171
|
+
declare const KIND_TAG_PATTERN: RegExp;
|
|
172
|
+
declare const KIND_LEGEND = "[rs] research · [pl] plan · [im] implement · [rv] review";
|
|
173
|
+
declare function isAgentStatus(value: unknown): value is AgentStatus;
|
|
174
|
+
declare function isUserActionStatus(value: unknown): value is UserActionStatus;
|
|
175
|
+
declare const OPEN_AGENT_STATUSES: readonly ["running", "discussing", "answer", "review", "apply", "test"];
|
|
176
|
+
declare const AGENT_KINDS: readonly ['research', 'plan', 'implement', 'review'];
|
|
177
|
+
type AgentKind = (typeof AGENT_KINDS)[number];
|
|
178
|
+
declare const KIND_REQUIRED = "kind is required: research, plan, implement or review";
|
|
179
|
+
type AgentMode = 'fork' | 'cold';
|
|
180
|
+
declare const KIND_MODES: Readonly<Record<AgentKind, AgentMode>>;
|
|
181
|
+
declare function agentMode(kind: AgentKind, choice?: {
|
|
182
|
+
cold?: boolean | undefined;
|
|
183
|
+
fork?: boolean | undefined;
|
|
184
|
+
}): AgentMode;
|
|
185
|
+
declare function isAgentKind(value: unknown): value is AgentKind;
|
|
186
|
+
type AgentContext = 'fork' | 'cold';
|
|
187
|
+
declare const CLAUDE_BACKEND = "claude";
|
|
188
|
+
interface Agent {
|
|
189
|
+
id: number;
|
|
190
|
+
session: string;
|
|
191
|
+
name: string;
|
|
192
|
+
kind: AgentKind;
|
|
193
|
+
promotedFrom: AgentKind | null;
|
|
194
|
+
target: string | null;
|
|
195
|
+
blockedOn: string | null;
|
|
196
|
+
task: string | null;
|
|
197
|
+
status: AgentStatus;
|
|
198
|
+
note: string | null;
|
|
199
|
+
reportPath: string | null;
|
|
200
|
+
baseCommit: string | null;
|
|
201
|
+
worktree: string | null;
|
|
202
|
+
sandbox: string | null;
|
|
203
|
+
queueOrder: number | null;
|
|
204
|
+
hostAgentId: string | null;
|
|
205
|
+
pendingStatus: AgentStatus | null;
|
|
206
|
+
doneAt: string | null;
|
|
207
|
+
startedAt: string;
|
|
208
|
+
updatedAt: string;
|
|
209
|
+
statusSince: string;
|
|
210
|
+
backend: string | null;
|
|
211
|
+
model: string | null;
|
|
212
|
+
backendRef: string | null;
|
|
213
|
+
kindDef: Snapshot | null;
|
|
214
|
+
context: AgentContext | null;
|
|
215
|
+
mission: string | null;
|
|
216
|
+
attachments: Attachment[] | null;
|
|
217
|
+
produced: Produced | null;
|
|
218
|
+
recommendedThen: RecommendedThen | null;
|
|
219
|
+
}
|
|
220
|
+
interface StartAgentInput {
|
|
221
|
+
name: string;
|
|
222
|
+
task: string;
|
|
223
|
+
kind: AgentKind;
|
|
224
|
+
target?: string | undefined;
|
|
225
|
+
baseCommit?: string | undefined;
|
|
226
|
+
worktree?: string | undefined;
|
|
227
|
+
sandbox?: string | undefined;
|
|
228
|
+
context?: AgentContext | undefined;
|
|
229
|
+
mission?: string | undefined;
|
|
230
|
+
attachments?: Attachment[] | undefined;
|
|
231
|
+
kindDef?: Snapshot | undefined;
|
|
232
|
+
backend?: string | undefined;
|
|
233
|
+
model?: string | undefined;
|
|
234
|
+
}
|
|
235
|
+
declare const SANDBOX_KINDS: readonly AgentKind[];
|
|
236
|
+
interface UpdateAgentInput {
|
|
237
|
+
status: AgentStatus;
|
|
238
|
+
note?: string | null | undefined;
|
|
239
|
+
reportPath?: string | undefined;
|
|
240
|
+
blockedOn?: string | null | undefined;
|
|
241
|
+
}
|
|
242
|
+
interface FinishAgentInput {
|
|
243
|
+
reportPath: string;
|
|
244
|
+
hasQuestions: boolean;
|
|
245
|
+
produced?: Produced | undefined;
|
|
246
|
+
recommendedThen?: RecommendedThen | undefined;
|
|
247
|
+
}
|
|
248
|
+
interface ListAgentsOptions {
|
|
249
|
+
includeClosed?: boolean;
|
|
250
|
+
}
|
|
251
|
+
declare const REPORTING_NOTE = "reporting";
|
|
252
|
+
declare const PUBLISH_FALLBACK_MILLISECONDS = 120000;
|
|
253
|
+
declare function statusWhenDone(kind: AgentKind, hasQuestions: boolean): AgentStatus;
|
|
254
|
+
interface PromoteAgentInput {
|
|
255
|
+
kind: AgentKind | undefined;
|
|
256
|
+
worktree?: string | undefined;
|
|
257
|
+
baseCommit?: string | undefined;
|
|
258
|
+
kindDef?: Snapshot | undefined;
|
|
259
|
+
cold?: boolean | undefined;
|
|
260
|
+
fork?: boolean | undefined;
|
|
261
|
+
mission?: string | undefined;
|
|
262
|
+
}
|
|
263
|
+
interface KindStep {
|
|
264
|
+
kind: string;
|
|
265
|
+
kindDef: Snapshot | null;
|
|
266
|
+
at: string | null;
|
|
267
|
+
}
|
|
268
|
+
declare const BACKENDS: readonly ['claude', 'cursor'];
|
|
269
|
+
type Backend = (typeof BACKENDS)[number];
|
|
270
|
+
declare const DECIDER_PROVIDERS: readonly ['cloudflare', 'typesafe', 'openai', 'ollama'];
|
|
271
|
+
declare const GESTURES: readonly ['permission', 'read', 'question', 'launch', 'plan', 'triage', 'apply', 'commit', 'push', 'pr'];
|
|
272
|
+
declare const DECISION_USAGES: readonly ['permission', 'launch', 'routing', 'question', 'findings', 'digest', 'notify', 'loop', 'plans', 'dream'];
|
|
273
|
+
interface RunPair {
|
|
274
|
+
backend?: Backend | undefined;
|
|
275
|
+
model?: string | undefined;
|
|
276
|
+
}
|
|
277
|
+
declare const pairSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
278
|
+
backend: z.ZodOptional<z.ZodString>;
|
|
279
|
+
model: z.ZodOptional<z.ZodString>;
|
|
280
|
+
}, z.core.$strict>]>, z.ZodTransform<RunPair, string | {
|
|
281
|
+
backend?: string | undefined;
|
|
282
|
+
model?: string | undefined;
|
|
283
|
+
}>>;
|
|
284
|
+
declare const configSchema: z.ZodObject<{
|
|
285
|
+
run: z.ZodOptional<z.ZodObject<{
|
|
286
|
+
default: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
287
|
+
backend: z.ZodOptional<z.ZodString>;
|
|
288
|
+
model: z.ZodOptional<z.ZodString>;
|
|
289
|
+
}, z.core.$strict>]>, z.ZodTransform<RunPair, string | {
|
|
290
|
+
backend?: string | undefined;
|
|
291
|
+
model?: string | undefined;
|
|
292
|
+
}>>>;
|
|
293
|
+
kinds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
294
|
+
backend: z.ZodOptional<z.ZodString>;
|
|
295
|
+
model: z.ZodOptional<z.ZodString>;
|
|
296
|
+
}, z.core.$strict>]>, z.ZodTransform<RunPair, string | {
|
|
297
|
+
backend?: string | undefined;
|
|
298
|
+
model?: string | undefined;
|
|
299
|
+
}>>>>;
|
|
300
|
+
}, z.core.$catchall<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
301
|
+
backend: z.ZodOptional<z.ZodString>;
|
|
302
|
+
model: z.ZodOptional<z.ZodString>;
|
|
303
|
+
}, z.core.$strict>]>, z.ZodTransform<RunPair, string | {
|
|
304
|
+
backend?: string | undefined;
|
|
305
|
+
model?: string | undefined;
|
|
306
|
+
}>>>>>;
|
|
307
|
+
autonomy: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
308
|
+
profile: z.ZodOptional<z.ZodString>;
|
|
309
|
+
shadow: z.ZodOptional<z.ZodBoolean>;
|
|
310
|
+
supervisor: z.ZodOptional<z.ZodString>;
|
|
311
|
+
gestures: z.ZodOptional<z.ZodObject<{
|
|
312
|
+
[x: string]: z.ZodOptional<z.ZodEnum<{
|
|
313
|
+
auto: "auto";
|
|
314
|
+
human: "human";
|
|
315
|
+
}>> | z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
316
|
+
auto: "auto";
|
|
317
|
+
human: "human";
|
|
318
|
+
}>, z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
319
|
+
auto: "auto";
|
|
320
|
+
human: "human";
|
|
321
|
+
}>>]>>;
|
|
322
|
+
}, z.core.$strict>>;
|
|
323
|
+
budget: z.ZodOptional<z.ZodObject<{
|
|
324
|
+
tokens: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>>;
|
|
325
|
+
waves: z.ZodOptional<z.ZodNumber>;
|
|
326
|
+
timeout: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>>;
|
|
327
|
+
reviewRounds: z.ZodOptional<z.ZodNumber>;
|
|
328
|
+
}, z.core.$strict>>;
|
|
329
|
+
stopAfterEscalations: z.ZodOptional<z.ZodNumber>;
|
|
330
|
+
}, z.core.$strict>]>>;
|
|
331
|
+
decider: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodString]>>;
|
|
332
|
+
decide: z.ZodOptional<z.ZodObject<{
|
|
333
|
+
model: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodString]>>;
|
|
334
|
+
fallback: z.ZodOptional<z.ZodEnum<{
|
|
335
|
+
"backend-small": "backend-small";
|
|
336
|
+
none: "none";
|
|
337
|
+
}>>;
|
|
338
|
+
decisions: z.ZodOptional<z.ZodObject<{
|
|
339
|
+
[x: string]: z.ZodOptional<z.ZodObject<{
|
|
340
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
341
|
+
off: "off";
|
|
342
|
+
on: "on";
|
|
343
|
+
shadow: "shadow";
|
|
344
|
+
}>>;
|
|
345
|
+
above: z.ZodOptional<z.ZodNumber>;
|
|
346
|
+
below: z.ZodOptional<z.ZodNumber>;
|
|
347
|
+
minConfidence: z.ZodOptional<z.ZodNumber>;
|
|
348
|
+
fallback: z.ZodOptional<z.ZodEnum<{
|
|
349
|
+
"backend-small": "backend-small";
|
|
350
|
+
none: "none";
|
|
351
|
+
}>>;
|
|
352
|
+
}, z.core.$strict>>;
|
|
353
|
+
}, z.core.$strict>>;
|
|
354
|
+
}, z.core.$strict>>;
|
|
355
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
356
|
+
coldAbove: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>>;
|
|
357
|
+
}, z.core.$strict>>;
|
|
358
|
+
waves: z.ZodOptional<z.ZodObject<{
|
|
359
|
+
launch: z.ZodOptional<z.ZodEnum<{
|
|
360
|
+
auto: "auto";
|
|
361
|
+
confirm: "confirm";
|
|
362
|
+
}>>;
|
|
363
|
+
}, z.core.$strict>>;
|
|
364
|
+
apply: z.ZodOptional<z.ZodObject<{
|
|
365
|
+
target: z.ZodOptional<z.ZodEnum<{
|
|
366
|
+
branch: "branch";
|
|
367
|
+
main: "main";
|
|
368
|
+
}>>;
|
|
369
|
+
check: z.ZodOptional<z.ZodString>;
|
|
370
|
+
}, z.core.$strict>>;
|
|
371
|
+
providers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
372
|
+
token: z.ZodOptional<z.ZodString>;
|
|
373
|
+
url: z.ZodOptional<z.ZodString>;
|
|
374
|
+
account: z.ZodOptional<z.ZodString>;
|
|
375
|
+
local: z.ZodOptional<z.ZodBoolean>;
|
|
376
|
+
}, z.core.$loose>>>;
|
|
377
|
+
}, z.core.$strict>;
|
|
378
|
+
type PairInput = z.input<typeof pairSchema>;
|
|
379
|
+
type ConfigFile = Omit<z.input<typeof configSchema>, 'run'> & {
|
|
380
|
+
run?: ({
|
|
381
|
+
default?: PairInput;
|
|
382
|
+
kinds?: Record<string, PairInput>;
|
|
383
|
+
} & Record<string, unknown>) | undefined;
|
|
384
|
+
};
|
|
385
|
+
/** One validated source, flattened to canonical dotted keys. */
|
|
386
|
+
type Source = Map<string, unknown>;
|
|
387
|
+
declare function parseConfig(value: unknown, origin: string): Source;
|
|
388
|
+
interface WorkspaceRepo {
|
|
389
|
+
path: string;
|
|
390
|
+
name: string;
|
|
391
|
+
}
|
|
392
|
+
interface Workspace {
|
|
393
|
+
name: string;
|
|
394
|
+
definition: string;
|
|
395
|
+
runDirectory: string;
|
|
396
|
+
repos: WorkspaceRepo[];
|
|
397
|
+
hosts: Record<string, {
|
|
398
|
+
settings?: Record<string, unknown>;
|
|
399
|
+
}>;
|
|
400
|
+
config: Source;
|
|
401
|
+
/** Why the config keys of workspace.json were ignored; they are then empty. */
|
|
402
|
+
configProblem?: string | undefined;
|
|
403
|
+
}
|
|
404
|
+
interface WorkspaceFile extends ConfigFile {
|
|
405
|
+
name?: string | undefined;
|
|
406
|
+
repos?: {
|
|
407
|
+
path: string;
|
|
408
|
+
name?: string | undefined;
|
|
409
|
+
}[] | undefined;
|
|
410
|
+
hosts?: Workspace['hosts'] | undefined;
|
|
411
|
+
/** Former name of hosts, still read. */
|
|
412
|
+
backends?: Workspace['hosts'] | undefined;
|
|
413
|
+
}
|
|
414
|
+
declare const WORKSPACE_FILE = "workspace.json";
|
|
415
|
+
declare const INSTRUCTIONS_FILE = "CLAUDE.md";
|
|
416
|
+
declare const AGENTS_FILE = "AGENTS.md";
|
|
417
|
+
declare const REPO_INSTRUCTIONS_DIRECTORY = "repos";
|
|
418
|
+
declare function isWorkspaceName(name: string): boolean;
|
|
419
|
+
declare function expandHome(path: string, env?: NodeJS.ProcessEnv): string;
|
|
420
|
+
declare function workspaceExists(name: string, env?: NodeJS.ProcessEnv): boolean;
|
|
421
|
+
declare function workspaceFileHosts(file: WorkspaceFile): Workspace['hosts'];
|
|
422
|
+
/** Writes hosts under its current name, so an older backends key moves on the next write. */
|
|
423
|
+
declare function serializeWorkspaceFile(file: WorkspaceFile): string;
|
|
424
|
+
declare function loadWorkspace(name: string, env?: NodeJS.ProcessEnv): Workspace;
|
|
425
|
+
/** The workspace config where it decides something: an ignored invalid config is refused there. */
|
|
426
|
+
declare function usableWorkspaceConfig(workspace: Workspace | null | undefined): Source | undefined;
|
|
427
|
+
declare function listWorkspaces(env?: NodeJS.ProcessEnv): Workspace[];
|
|
428
|
+
declare function workspaceHosts(workspace: Workspace): string[];
|
|
429
|
+
interface CreateWorkspaceOptions {
|
|
430
|
+
repos?: readonly string[] | undefined;
|
|
431
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
432
|
+
}
|
|
433
|
+
declare function createWorkspace(name: string, options?: CreateWorkspaceOptions): Workspace;
|
|
434
|
+
declare function definitionInstructions(workspace: Workspace): string;
|
|
435
|
+
declare function migrateInstructions(workspace: Workspace): boolean;
|
|
436
|
+
declare function repoInstructionsPath(workspace: Workspace, repoName: string): string;
|
|
437
|
+
interface RepoInstructionsFile {
|
|
438
|
+
repo: string;
|
|
439
|
+
path: string;
|
|
440
|
+
orphan: boolean;
|
|
441
|
+
}
|
|
442
|
+
declare function repoInstructionFiles(workspace: Workspace): RepoInstructionsFile[];
|
|
443
|
+
declare function addWorkspaceRepo(name: string, repo: string, env?: NodeJS.ProcessEnv): Workspace;
|
|
444
|
+
declare function removeWorkspaceRepo(name: string, repo: string, env?: NodeJS.ProcessEnv): Workspace;
|
|
445
|
+
interface DropWorkspaceOptions {
|
|
446
|
+
purge?: boolean | undefined;
|
|
447
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
448
|
+
}
|
|
449
|
+
declare function dropWorkspace(name: string, options?: DropWorkspaceOptions): Workspace;
|
|
450
|
+
declare function isInside(directory: string, path: string): boolean;
|
|
451
|
+
declare function repoNameFor(workspace: Workspace | null, path: string | undefined): string | null;
|
|
452
|
+
declare function repoPathFor(workspace: Workspace | null, path: string | undefined | null): string | null;
|
|
453
|
+
type WorkspaceOrigin = 'session' | 'option' | 'env' | 'run-directory' | 'none';
|
|
454
|
+
interface WorkspaceResolution {
|
|
455
|
+
workspace: Workspace | null;
|
|
456
|
+
origin: WorkspaceOrigin;
|
|
457
|
+
}
|
|
458
|
+
interface ResolveWorkspaceOptions {
|
|
459
|
+
db?: DatabaseSync | undefined;
|
|
460
|
+
sessionId?: string | undefined;
|
|
461
|
+
workspace?: string | undefined;
|
|
462
|
+
cwd?: string | undefined;
|
|
463
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
464
|
+
tolerant?: boolean | undefined;
|
|
465
|
+
}
|
|
466
|
+
declare function resolveWorkspace({ db, sessionId, workspace, cwd, env, tolerant }?: ResolveWorkspaceOptions): WorkspaceResolution;
|
|
467
|
+
declare function workspaceLabel(workspace: Workspace | null): string;
|
|
468
|
+
declare function requireWorkspace(workspace: Workspace | null): Workspace;
|
|
469
|
+
type LaunchMode = 'new' | 'resume' | 'fork' | 'agent';
|
|
470
|
+
interface SystemAppend {
|
|
471
|
+
path: string;
|
|
472
|
+
version: string;
|
|
473
|
+
}
|
|
474
|
+
interface McpServerEntry {
|
|
475
|
+
command: string;
|
|
476
|
+
args: string[];
|
|
477
|
+
env: Record<string, string>;
|
|
478
|
+
}
|
|
479
|
+
interface LaunchPlan {
|
|
480
|
+
mode: LaunchMode;
|
|
481
|
+
host: string;
|
|
482
|
+
orchestration: Orchestration;
|
|
483
|
+
sessionId?: string;
|
|
484
|
+
parentId?: string;
|
|
485
|
+
agentId?: string;
|
|
486
|
+
name: string | null;
|
|
487
|
+
cwd: string;
|
|
488
|
+
dirs: string[];
|
|
489
|
+
systemAppend: SystemAppend;
|
|
490
|
+
env: Record<string, string>;
|
|
491
|
+
model?: string;
|
|
492
|
+
mcp?: {
|
|
493
|
+
carnet: McpServerEntry;
|
|
494
|
+
};
|
|
495
|
+
rucherPlugin: 'load' | 'exclude';
|
|
496
|
+
knownChildren?: string[];
|
|
497
|
+
}
|
|
498
|
+
interface LaunchPlanInput {
|
|
499
|
+
mode: LaunchMode;
|
|
500
|
+
host: Host;
|
|
501
|
+
workspace: Workspace | null;
|
|
502
|
+
session: Pick<Session, 'id' | 'name' | 'promptVersion'>;
|
|
503
|
+
cwd: string;
|
|
504
|
+
dirs: string[];
|
|
505
|
+
systemAppend: SystemAppend;
|
|
506
|
+
kind?: SessionKind | undefined;
|
|
507
|
+
name?: string | null | undefined;
|
|
508
|
+
agentId?: string | undefined;
|
|
509
|
+
model?: string | undefined;
|
|
510
|
+
knownChildren?: string[] | undefined;
|
|
511
|
+
}
|
|
512
|
+
declare function withWorkspace(command: string, workspace: string | null | undefined): string;
|
|
513
|
+
declare function buildLaunchPlan(input: LaunchPlanInput): LaunchPlan;
|
|
514
|
+
interface PrepareNewOptions {
|
|
515
|
+
kind: SessionKind;
|
|
516
|
+
name?: string | undefined;
|
|
517
|
+
repoCwd: string;
|
|
518
|
+
env: NodeJS.ProcessEnv;
|
|
519
|
+
model?: string | undefined;
|
|
520
|
+
}
|
|
521
|
+
declare function prepareNew(carnet: Carnet, options: PrepareNewOptions): LaunchPlan;
|
|
522
|
+
interface PreparedResume {
|
|
523
|
+
plan: LaunchPlan;
|
|
524
|
+
notices: string[];
|
|
525
|
+
}
|
|
526
|
+
declare function prepareResume(carnet: Carnet, session: Session, env: NodeJS.ProcessEnv, options?: {
|
|
527
|
+
model?: string | undefined;
|
|
528
|
+
}): PreparedResume;
|
|
529
|
+
interface PrepareForkOptions {
|
|
530
|
+
name?: string | undefined;
|
|
531
|
+
active?: boolean | undefined;
|
|
532
|
+
env: NodeJS.ProcessEnv;
|
|
533
|
+
model?: string | undefined;
|
|
534
|
+
}
|
|
535
|
+
declare function checkForkOptions(carnet: Carnet, options: Pick<PrepareForkOptions, 'name' | 'active'>): void;
|
|
536
|
+
declare function prepareFork(carnet: Carnet, parent: Session, options: PrepareForkOptions): LaunchPlan;
|
|
537
|
+
declare function launchStarted(carnet: Carnet, plan: LaunchPlan): void;
|
|
538
|
+
declare function launchEnded(carnet: Carnet, plan: LaunchPlan): void;
|
|
539
|
+
interface UndoStep {
|
|
540
|
+
command: string;
|
|
541
|
+
run: () => void;
|
|
542
|
+
}
|
|
543
|
+
interface HostSessionPayload {
|
|
544
|
+
session_id: string;
|
|
545
|
+
cwd?: string | undefined;
|
|
546
|
+
source?: string | undefined;
|
|
547
|
+
session_title?: string | undefined;
|
|
548
|
+
}
|
|
549
|
+
interface HostPromptPayload {
|
|
550
|
+
session_id: string;
|
|
551
|
+
cwd?: string | undefined;
|
|
552
|
+
session_title?: string | undefined;
|
|
553
|
+
transcript_path?: string | undefined;
|
|
554
|
+
}
|
|
555
|
+
interface HostSubagentPayload {
|
|
556
|
+
session_id: string;
|
|
557
|
+
agent_id: string;
|
|
558
|
+
agent_type?: string | undefined;
|
|
559
|
+
cwd?: string | undefined;
|
|
560
|
+
description?: string | undefined;
|
|
561
|
+
agent_transcript_path?: string | undefined;
|
|
562
|
+
transcript_path?: string | undefined;
|
|
563
|
+
}
|
|
564
|
+
interface HostStopPayload {
|
|
565
|
+
session_id: string;
|
|
566
|
+
cwd?: string | undefined;
|
|
567
|
+
failed: boolean;
|
|
568
|
+
transcript_path?: string | undefined;
|
|
569
|
+
}
|
|
570
|
+
interface HostSessionEndPayload {
|
|
571
|
+
session_id: string;
|
|
572
|
+
cwd?: string | undefined;
|
|
573
|
+
reason?: string | undefined;
|
|
574
|
+
transcript_path?: string | undefined;
|
|
575
|
+
}
|
|
576
|
+
interface TranscriptChunk {
|
|
577
|
+
offset: number;
|
|
578
|
+
at: string | null;
|
|
579
|
+
text: string;
|
|
580
|
+
}
|
|
581
|
+
interface TranscriptSlice {
|
|
582
|
+
chunks: TranscriptChunk[];
|
|
583
|
+
nextOffset: number;
|
|
584
|
+
size: number;
|
|
585
|
+
}
|
|
586
|
+
interface HostToolPayload {
|
|
587
|
+
session_id: string;
|
|
588
|
+
cwd?: string | undefined;
|
|
589
|
+
tool_name?: string | undefined;
|
|
590
|
+
agent_id?: string | undefined;
|
|
591
|
+
agent_type?: string | undefined;
|
|
592
|
+
transcript_path?: string | undefined;
|
|
593
|
+
path?: string | undefined;
|
|
594
|
+
file_path?: string | undefined;
|
|
595
|
+
command?: string | undefined;
|
|
596
|
+
subagent_type?: string | undefined;
|
|
597
|
+
launched_names?: string[] | undefined;
|
|
598
|
+
}
|
|
599
|
+
interface HostCommand {
|
|
600
|
+
command: string;
|
|
601
|
+
args: string[];
|
|
602
|
+
env: Record<string, string>;
|
|
603
|
+
}
|
|
604
|
+
interface HostRender {
|
|
605
|
+
written: string[];
|
|
606
|
+
removed: string[];
|
|
607
|
+
}
|
|
608
|
+
interface RelocatedFolder {
|
|
609
|
+
from: string;
|
|
610
|
+
to: string;
|
|
611
|
+
}
|
|
612
|
+
interface ProjectRelocation {
|
|
613
|
+
moves: RelocatedFolder[];
|
|
614
|
+
undo: UndoStep[];
|
|
615
|
+
}
|
|
616
|
+
type Orchestration = 'main' | 'server';
|
|
617
|
+
interface HookHost {
|
|
618
|
+
processId(env: NodeJS.ProcessEnv): number | null;
|
|
619
|
+
sessionIdFromEnvironment(env: NodeJS.ProcessEnv): string | undefined;
|
|
620
|
+
projectDirectory(env: NodeJS.ProcessEnv): string | undefined;
|
|
621
|
+
parseSessionPayload(json: string): HostSessionPayload;
|
|
622
|
+
parseStopPayload(json: string): HostStopPayload;
|
|
623
|
+
parsePromptPayload(json: string): HostPromptPayload;
|
|
624
|
+
parseSubagentPayload(json: string): HostSubagentPayload;
|
|
625
|
+
parseSessionEndPayload(json: string): HostSessionEndPayload;
|
|
626
|
+
parseToolPayload(json: string): HostToolPayload;
|
|
627
|
+
subagentNames(payload: HostSubagentPayload): string[];
|
|
628
|
+
subagentInheritsContext(payload: HostSubagentPayload): boolean;
|
|
629
|
+
rendersSystemPrompt(source: string): boolean;
|
|
630
|
+
promptTitle(payload: HostPromptPayload): string | undefined;
|
|
631
|
+
}
|
|
632
|
+
interface TranscriptUsage {
|
|
633
|
+
turns: number;
|
|
634
|
+
input: number;
|
|
635
|
+
cacheRead: number;
|
|
636
|
+
cacheCreation: number;
|
|
637
|
+
output: number;
|
|
638
|
+
firstContext: number;
|
|
639
|
+
lastContext: number;
|
|
640
|
+
}
|
|
641
|
+
type LiveSession = {
|
|
642
|
+
kind: 'background';
|
|
643
|
+
id: string;
|
|
644
|
+
} | {
|
|
645
|
+
kind: 'interactive';
|
|
646
|
+
};
|
|
647
|
+
interface LaunchHost {
|
|
648
|
+
command(plan: LaunchPlan, passthrough?: readonly string[]): HostCommand;
|
|
649
|
+
liveSession?(sessionId: string, env?: NodeJS.ProcessEnv): LiveSession | undefined;
|
|
650
|
+
attachCommand?(id: string): HostCommand;
|
|
651
|
+
renameInstruction(name: string): string;
|
|
652
|
+
transcriptFiles(session: Session, env?: NodeJS.ProcessEnv): string[];
|
|
653
|
+
readTranscript?(path: string, fromOffset: number, maxBytes: number): TranscriptSlice;
|
|
654
|
+
transcriptUsage?(path: string): TranscriptUsage | undefined;
|
|
655
|
+
lastContext?(path: string): number | undefined;
|
|
656
|
+
hasConversation(session: Session, env?: NodeJS.ProcessEnv): boolean;
|
|
657
|
+
continues(parent: Session, childId: string, env?: NodeJS.ProcessEnv): boolean;
|
|
658
|
+
}
|
|
659
|
+
interface Host {
|
|
660
|
+
id: string;
|
|
661
|
+
displayName: string;
|
|
662
|
+
orchestration: Orchestration;
|
|
663
|
+
renderRunDirectory(workspace: Workspace): HostRender;
|
|
664
|
+
relocateProject?(from: string, to: string, env: NodeJS.ProcessEnv, mode?: 'move' | 'merge'): ProjectRelocation | null;
|
|
665
|
+
moveTrust?(from: string, to: string | null, env: NodeJS.ProcessEnv): boolean;
|
|
666
|
+
hooks?: HookHost;
|
|
667
|
+
launch?: LaunchHost;
|
|
668
|
+
}
|
|
669
|
+
declare const DEFAULT_HOST = "claude-code";
|
|
670
|
+
declare function allHosts(): Host[];
|
|
671
|
+
declare function hostById(id: string): Host;
|
|
672
|
+
declare function hookHost(id: string): HookHost;
|
|
673
|
+
declare function launchHost(id: string): LaunchHost;
|
|
674
|
+
type SessionKind = 'active' | 'temp';
|
|
675
|
+
type SessionStatus = 'running' | 'idle' | 'archived';
|
|
676
|
+
interface Session {
|
|
677
|
+
id: string;
|
|
678
|
+
workspace: string;
|
|
679
|
+
name: string | null;
|
|
680
|
+
purpose: string | null;
|
|
681
|
+
kind: SessionKind;
|
|
682
|
+
status: SessionStatus;
|
|
683
|
+
cwd: string | null;
|
|
684
|
+
repo: string | null;
|
|
685
|
+
host: string;
|
|
686
|
+
hostPid: number | null;
|
|
687
|
+
hookedAt: string | null;
|
|
688
|
+
lastTitle: string | null;
|
|
689
|
+
parentId: string | null;
|
|
690
|
+
promptVersion: string | null;
|
|
691
|
+
pluginVersion: string | null;
|
|
692
|
+
createdAt: string;
|
|
693
|
+
lastActiveAt: string;
|
|
694
|
+
endedAt: string | null;
|
|
695
|
+
backend: string | null;
|
|
696
|
+
model: string | null;
|
|
697
|
+
backendRef: string | null;
|
|
698
|
+
profile: string | null;
|
|
699
|
+
profileDef: Snapshot | null;
|
|
700
|
+
}
|
|
701
|
+
type HookSessionPayload = HostSessionPayload;
|
|
702
|
+
interface HookEnv {
|
|
703
|
+
host?: string | undefined;
|
|
704
|
+
processId?: number | null | undefined;
|
|
705
|
+
RUCHER_PURGE_DAYS?: string | undefined;
|
|
706
|
+
RUCHER_HOME?: string | undefined;
|
|
707
|
+
RUCHER_SESSION_ID?: string | undefined;
|
|
708
|
+
RUCHER_SESSION_KIND?: string | undefined;
|
|
709
|
+
RUCHER_SESSION_NAME?: string | undefined;
|
|
710
|
+
RUCHER_PROMPT_VERSION?: string | undefined;
|
|
711
|
+
RUCHER_MEMORY_MAX_CHARACTERS?: string | undefined;
|
|
712
|
+
RUCHER_MEMORY_HALF_LIFE_DAYS?: string | undefined;
|
|
713
|
+
CLAUDE_CONFIG_DIR?: string | undefined;
|
|
714
|
+
}
|
|
715
|
+
interface CreateSessionInput {
|
|
716
|
+
id: string;
|
|
717
|
+
kind: SessionKind;
|
|
718
|
+
name?: string | null | undefined;
|
|
719
|
+
cwd: string;
|
|
720
|
+
repo?: string | null | undefined;
|
|
721
|
+
host?: string | undefined;
|
|
722
|
+
}
|
|
723
|
+
interface ListSessionsOptions {
|
|
724
|
+
includeTemp?: boolean | undefined;
|
|
725
|
+
includeArchived?: boolean | undefined;
|
|
726
|
+
}
|
|
727
|
+
declare const MINIMUM_ID_PREFIX = 4;
|
|
728
|
+
declare function shortId(id: string): string;
|
|
729
|
+
interface MergeResult {
|
|
730
|
+
session: Session;
|
|
731
|
+
movedAgents: string[];
|
|
732
|
+
closedAgents: string[];
|
|
733
|
+
movedEvents: number;
|
|
734
|
+
movedTable: boolean;
|
|
735
|
+
}
|
|
736
|
+
interface QuestionInput {
|
|
737
|
+
text: string;
|
|
738
|
+
context?: string | undefined;
|
|
739
|
+
recommendation: string;
|
|
740
|
+
alternatives?: readonly string[] | undefined;
|
|
741
|
+
}
|
|
742
|
+
interface Question {
|
|
743
|
+
n: number;
|
|
744
|
+
total: number;
|
|
745
|
+
text: string;
|
|
746
|
+
context: string | null;
|
|
747
|
+
recommendation: string;
|
|
748
|
+
alternatives: string[];
|
|
749
|
+
answer: string | null;
|
|
750
|
+
answeredAt: string | null;
|
|
751
|
+
}
|
|
752
|
+
interface AnswerInput {
|
|
753
|
+
n: number;
|
|
754
|
+
answer: string;
|
|
755
|
+
}
|
|
756
|
+
declare const FINDING_SEVERITIES: readonly ['blocking', 'to_fix', 'suggestion'];
|
|
757
|
+
type FindingSeverity = (typeof FINDING_SEVERITIES)[number];
|
|
758
|
+
declare const FINDING_DECISIONS: readonly ['fix', 'sent', 'fixed', 'ignored', 'spawned', 'deferred'];
|
|
759
|
+
type FindingDecision = (typeof FINDING_DECISIONS)[number];
|
|
760
|
+
declare const FINDING_ROUTES: readonly ['send back', 'in main', 'implement', 'plan', 'research'];
|
|
761
|
+
type FindingRoute = (typeof FINDING_ROUTES)[number];
|
|
762
|
+
declare const SPAWN_KINDS: readonly ['implement', 'plan', 'research'];
|
|
763
|
+
type SpawnKind = (typeof SPAWN_KINDS)[number];
|
|
764
|
+
interface FindingInput {
|
|
765
|
+
severity: FindingSeverity;
|
|
766
|
+
location?: string | undefined;
|
|
767
|
+
text: string;
|
|
768
|
+
fix?: string | undefined;
|
|
769
|
+
route?: FindingRoute | undefined;
|
|
770
|
+
}
|
|
771
|
+
interface Finding {
|
|
772
|
+
n: number;
|
|
773
|
+
total: number;
|
|
774
|
+
severity: FindingSeverity;
|
|
775
|
+
location: string | null;
|
|
776
|
+
text: string;
|
|
777
|
+
fix: string | null;
|
|
778
|
+
decision: FindingDecision | null;
|
|
779
|
+
reason: string | null;
|
|
780
|
+
route: FindingRoute | null;
|
|
781
|
+
spawnName: string | null;
|
|
782
|
+
spawnKind: SpawnKind | null;
|
|
783
|
+
spawnedAgent: number | null;
|
|
784
|
+
deliveredAt: string | null;
|
|
785
|
+
}
|
|
786
|
+
interface DecisionInput {
|
|
787
|
+
n: number;
|
|
788
|
+
decision: FindingDecision;
|
|
789
|
+
reason?: string | undefined;
|
|
790
|
+
agent?: string | undefined;
|
|
791
|
+
kind?: SpawnKind | undefined;
|
|
792
|
+
}
|
|
793
|
+
type FindingFilter = 'all' | 'open' | 'undecided';
|
|
794
|
+
interface TableItem {
|
|
795
|
+
session: string;
|
|
796
|
+
text: string;
|
|
797
|
+
status: UserActionStatus | null;
|
|
798
|
+
updatedAt: string;
|
|
799
|
+
}
|
|
800
|
+
interface SetTableInput {
|
|
801
|
+
text: string;
|
|
802
|
+
status?: UserActionStatus | undefined;
|
|
803
|
+
}
|
|
804
|
+
declare const NOTE_KINDS: readonly ['dead_end', 'decision', 'learning'];
|
|
805
|
+
type NoteKind = (typeof NOTE_KINDS)[number];
|
|
806
|
+
declare const NOTE_TEXT_LIMIT = 200;
|
|
807
|
+
declare const DUPLICATE_SIMILARITY = 0.6;
|
|
808
|
+
declare const DEFAULT_HALF_LIFE_DAYS = 20;
|
|
809
|
+
declare const STALE_AFTER_ACTIVE_DAYS = 40;
|
|
810
|
+
declare function isNoteKind(value: string): value is NoteKind;
|
|
811
|
+
declare function memoryHalfLife(value: string | undefined): number;
|
|
812
|
+
interface Note {
|
|
813
|
+
id: number;
|
|
814
|
+
kind: NoteKind;
|
|
815
|
+
text: string;
|
|
816
|
+
repos: string[];
|
|
817
|
+
session: string | null;
|
|
818
|
+
agent: string | null;
|
|
819
|
+
similarNotes: number[];
|
|
820
|
+
createdAt: string;
|
|
821
|
+
droppedAt: string | null;
|
|
822
|
+
droppedReason: string | null;
|
|
823
|
+
droppedSession: string | null;
|
|
824
|
+
replacedBy: number | null;
|
|
825
|
+
}
|
|
826
|
+
interface NoteCitation {
|
|
827
|
+
id: number;
|
|
828
|
+
note: number;
|
|
829
|
+
session: string | null;
|
|
830
|
+
agent: string | null;
|
|
831
|
+
why: string;
|
|
832
|
+
at: string;
|
|
833
|
+
}
|
|
834
|
+
interface WeightedNote extends Note {
|
|
835
|
+
weight: number;
|
|
836
|
+
citationCount: number;
|
|
837
|
+
}
|
|
838
|
+
interface NoteDetail extends WeightedNote {
|
|
839
|
+
citations: NoteCitation[];
|
|
840
|
+
}
|
|
841
|
+
interface AddNoteInput {
|
|
842
|
+
kind: string;
|
|
843
|
+
text: string;
|
|
844
|
+
repos?: string[] | undefined;
|
|
845
|
+
session?: string | null | undefined;
|
|
846
|
+
agent?: string | null | undefined;
|
|
847
|
+
}
|
|
848
|
+
interface AddNoteResult {
|
|
849
|
+
note: Note;
|
|
850
|
+
similar: Note[];
|
|
851
|
+
}
|
|
852
|
+
interface ListNotesOptions {
|
|
853
|
+
kind?: string | undefined;
|
|
854
|
+
repo?: string | undefined;
|
|
855
|
+
general?: boolean | undefined;
|
|
856
|
+
query?: string | undefined;
|
|
857
|
+
includeDropped?: boolean | undefined;
|
|
858
|
+
halfLifeDays?: number | undefined;
|
|
859
|
+
}
|
|
860
|
+
interface DropNoteInput {
|
|
861
|
+
reason: string;
|
|
862
|
+
replacedBy?: number | undefined;
|
|
863
|
+
session?: string | null | undefined;
|
|
864
|
+
}
|
|
865
|
+
interface CiteNoteInput {
|
|
866
|
+
why: string;
|
|
867
|
+
session?: string | null | undefined;
|
|
868
|
+
agent?: string | null | undefined;
|
|
869
|
+
}
|
|
870
|
+
declare function workspaceRepoNames(workspace: Workspace): string[];
|
|
871
|
+
declare function similarity(first: string, second: string): number;
|
|
872
|
+
declare function localDay(date: Date): string;
|
|
873
|
+
interface DropNotesResult {
|
|
874
|
+
dropped: Note[];
|
|
875
|
+
skipped: {
|
|
876
|
+
id: number;
|
|
877
|
+
reason: string;
|
|
878
|
+
}[];
|
|
879
|
+
}
|
|
880
|
+
declare function dropNotes(ctx: Ctx, ids: number[], input: Omit<DropNoteInput, 'replacedBy'> & {
|
|
881
|
+
dryRun?: boolean | undefined;
|
|
882
|
+
}): DropNotesResult;
|
|
883
|
+
type NoteActivityKind = 'added' | 'cited' | 'dropped';
|
|
884
|
+
interface NoteActivity {
|
|
885
|
+
activity: NoteActivityKind;
|
|
886
|
+
note: number;
|
|
887
|
+
kind: NoteKind;
|
|
888
|
+
text: string;
|
|
889
|
+
similarNotes: number[];
|
|
890
|
+
replacedBy: number | null;
|
|
891
|
+
at: string;
|
|
892
|
+
}
|
|
893
|
+
declare function sessionNoteActivity(ctx: Ctx, session: string): NoteActivity[];
|
|
894
|
+
declare const REFERENCE_SCOPES: readonly ['session', 'agent'];
|
|
895
|
+
type ReferenceScope = (typeof REFERENCE_SCOPES)[number];
|
|
896
|
+
interface Reference {
|
|
897
|
+
id: number;
|
|
898
|
+
session: string;
|
|
899
|
+
scope: ReferenceScope;
|
|
900
|
+
path: string;
|
|
901
|
+
title: string | null;
|
|
902
|
+
bytes: number | null;
|
|
903
|
+
missing: boolean;
|
|
904
|
+
addedAt: string;
|
|
905
|
+
removedAt: string | null;
|
|
906
|
+
}
|
|
907
|
+
interface ListReferencesOptions {
|
|
908
|
+
ids?: readonly number[] | undefined;
|
|
909
|
+
all?: boolean | undefined;
|
|
910
|
+
}
|
|
911
|
+
declare function formatBytes(bytes: number | null): string;
|
|
912
|
+
declare function referenceLine(reference: Reference): string;
|
|
913
|
+
declare const SEARCH_LIMITS: {
|
|
914
|
+
readonly turnBytes: number;
|
|
915
|
+
readonly refreshBytes: number;
|
|
916
|
+
readonly sessionTranscriptCharacters: number;
|
|
917
|
+
readonly reportBytes: number;
|
|
918
|
+
};
|
|
919
|
+
type SearchSource = 'session' | 'agent' | 'note' | 'question' | 'finding' | 'event' | 'report' | 'transcript';
|
|
920
|
+
interface IndexOptions {
|
|
921
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
922
|
+
transcriptPath?: string | undefined;
|
|
923
|
+
maxBytes?: number | undefined;
|
|
924
|
+
}
|
|
925
|
+
declare function transcriptsIndexed(env?: NodeJS.ProcessEnv): boolean;
|
|
926
|
+
interface IndexResult {
|
|
927
|
+
read: number;
|
|
928
|
+
pending: boolean;
|
|
929
|
+
}
|
|
930
|
+
declare function searchQuery(question: string): string | null;
|
|
931
|
+
interface SearchHit {
|
|
932
|
+
source: SearchSource;
|
|
933
|
+
title: string;
|
|
934
|
+
snippet: string;
|
|
935
|
+
at: string | null;
|
|
936
|
+
agentId: number | null;
|
|
937
|
+
score: number;
|
|
938
|
+
}
|
|
939
|
+
interface SessionMatch {
|
|
940
|
+
session: Session;
|
|
941
|
+
score: number;
|
|
942
|
+
hits: SearchHit[];
|
|
943
|
+
partial: boolean;
|
|
944
|
+
}
|
|
945
|
+
interface NoteMatch {
|
|
946
|
+
number: number;
|
|
947
|
+
workspace: string;
|
|
948
|
+
kind: string;
|
|
949
|
+
snippet: string;
|
|
950
|
+
score: number;
|
|
951
|
+
}
|
|
952
|
+
interface SearchResults {
|
|
953
|
+
sessions: SessionMatch[];
|
|
954
|
+
notes: NoteMatch[];
|
|
955
|
+
}
|
|
956
|
+
interface SearchOptions {
|
|
957
|
+
all?: boolean | undefined;
|
|
958
|
+
limit?: number | undefined;
|
|
959
|
+
hitsPerSession?: number | undefined;
|
|
960
|
+
candidates?: number | undefined;
|
|
961
|
+
}
|
|
962
|
+
declare const SNIPPET_OPEN = "«";
|
|
963
|
+
declare const SNIPPET_CLOSE = "»";
|
|
964
|
+
declare const TURNS: readonly ['working', 'waiting', 'failed'];
|
|
965
|
+
type Turn = (typeof TURNS)[number];
|
|
966
|
+
interface TurnOptions {
|
|
967
|
+
trackTurn?: boolean | undefined;
|
|
968
|
+
}
|
|
969
|
+
interface StatusLine {
|
|
970
|
+
name: string;
|
|
971
|
+
kind: AgentKind;
|
|
972
|
+
status: AgentStatus;
|
|
973
|
+
emoji: string;
|
|
974
|
+
action: string | null;
|
|
975
|
+
note: string | null;
|
|
976
|
+
pinned: boolean;
|
|
977
|
+
}
|
|
978
|
+
interface StatusView {
|
|
979
|
+
time: string;
|
|
980
|
+
sessionName: string | null;
|
|
981
|
+
table: TableItem | null;
|
|
982
|
+
turn: Turn | null;
|
|
983
|
+
waiting: StatusLine[];
|
|
984
|
+
blocked: StatusLine[];
|
|
985
|
+
running: StatusLine[];
|
|
986
|
+
notes: NoteActivity[];
|
|
987
|
+
}
|
|
988
|
+
interface StatusViewOptions {
|
|
989
|
+
kind?: AgentKind | undefined;
|
|
990
|
+
}
|
|
991
|
+
declare function formatClock(date: Date): string;
|
|
992
|
+
declare function buildStatusView(ctx: Ctx, session: Session, options?: StatusViewOptions): StatusView;
|
|
993
|
+
type BriefPartType = 'workplace' | 'target' | 'reference' | 'deliverable' | 'for_main' | 'findings' | 'notes';
|
|
994
|
+
interface BriefPart {
|
|
995
|
+
type: BriefPartType;
|
|
996
|
+
title: string;
|
|
997
|
+
path?: string | undefined;
|
|
998
|
+
bytes?: number | null | undefined;
|
|
999
|
+
text?: string | undefined;
|
|
1000
|
+
missing?: boolean | undefined;
|
|
1001
|
+
}
|
|
1002
|
+
interface Brief {
|
|
1003
|
+
agentId: number;
|
|
1004
|
+
name: string;
|
|
1005
|
+
kind: string;
|
|
1006
|
+
context: AgentContext | null;
|
|
1007
|
+
task: string | null;
|
|
1008
|
+
mission: string | null;
|
|
1009
|
+
contract?: string | undefined;
|
|
1010
|
+
parts: BriefPart[];
|
|
1011
|
+
}
|
|
1012
|
+
interface BriefOptions {
|
|
1013
|
+
maxCharacters?: number | undefined;
|
|
1014
|
+
halfLifeDays?: number | undefined;
|
|
1015
|
+
}
|
|
1016
|
+
declare function planAsAnswered(title: string, report: string, questions: readonly Question[]): string | undefined;
|
|
1017
|
+
declare function buildBrief(ctx: Ctx, agentId: number, options?: BriefOptions): Brief;
|
|
1018
|
+
declare const MEMORY_MAX_CHARACTERS = 1000;
|
|
1019
|
+
declare function memoryMaxCharacters(value: string | undefined): number;
|
|
1020
|
+
interface MemoryOptions {
|
|
1021
|
+
maxCharacters?: number | undefined;
|
|
1022
|
+
halfLifeDays?: number | undefined;
|
|
1023
|
+
}
|
|
1024
|
+
interface MemoryScope {
|
|
1025
|
+
title: string;
|
|
1026
|
+
notes: WeightedNote[];
|
|
1027
|
+
}
|
|
1028
|
+
declare function renderMemory(scope: MemoryScope, maxCharacters?: number): string;
|
|
1029
|
+
declare const MAIN_HEADER = "Main";
|
|
1030
|
+
declare const MAIN_WORKING_SUFFIX = "(main working)";
|
|
1031
|
+
declare const BLOCKED_HEADER = "Waiting on agents";
|
|
1032
|
+
declare const MAIN_WAITING_SUFFIX = "(waiting on you)";
|
|
1033
|
+
declare const MAIN_FAILED_SUFFIX = "(turn failed)";
|
|
1034
|
+
declare function renderTableLine(item: TableItem): string;
|
|
1035
|
+
declare const MAIN_IDLE = "idle";
|
|
1036
|
+
declare function renderMainLine(item: TableItem | null, turn: Turn | null): string;
|
|
1037
|
+
declare function renderAgentLine(line: StatusLine, nameWidth?: number): string;
|
|
1038
|
+
declare const NOTES_HEADER = "Notes";
|
|
1039
|
+
declare const NOTES_FOLD_LINES = 5;
|
|
1040
|
+
declare const SIMILAR_PREFIX = "similar to ";
|
|
1041
|
+
type NotesMode = 'full' | 'summary' | 'expanded';
|
|
1042
|
+
interface RenderOptions {
|
|
1043
|
+
notes?: NotesMode | undefined;
|
|
1044
|
+
}
|
|
1045
|
+
declare function renderNotesSummary(notes: NoteActivity[]): string;
|
|
1046
|
+
declare function renderNoteLine(item: NoteActivity, idWidth: number): string;
|
|
1047
|
+
declare function renderNotes(notes: NoteActivity[], mode?: NotesMode): string[];
|
|
1048
|
+
declare function renderSections(view: StatusView, options?: RenderOptions): string;
|
|
1049
|
+
declare function renderStatus(view: StatusView, options?: RenderOptions): string;
|
|
1050
|
+
interface CarnetOptions {
|
|
1051
|
+
now?: () => Date;
|
|
1052
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
1053
|
+
}
|
|
1054
|
+
interface ClosedAgent extends Agent {
|
|
1055
|
+
sandboxRemoved: boolean;
|
|
1056
|
+
}
|
|
1057
|
+
declare class Carnet {
|
|
1058
|
+
readonly workspace: Workspace | null;
|
|
1059
|
+
readonly db: DatabaseSync;
|
|
1060
|
+
readonly env: NodeJS.ProcessEnv;
|
|
1061
|
+
private readonly ctx;
|
|
1062
|
+
constructor(db: DatabaseSync, workspace: Workspace | null, options?: CarnetOptions);
|
|
1063
|
+
now(): Date;
|
|
1064
|
+
requireWorkspace(): Workspace;
|
|
1065
|
+
readonly sessions: {
|
|
1066
|
+
get: (id: string) => Session | undefined;
|
|
1067
|
+
find: (reference: string) => Session;
|
|
1068
|
+
require: (id: string) => Session;
|
|
1069
|
+
ensure: (id: string, cwd?: string) => Session;
|
|
1070
|
+
upsertFromHook: (payload: HookSessionPayload, env?: HookEnv) => Session;
|
|
1071
|
+
touch: (id: string) => void;
|
|
1072
|
+
merge: (fromId: string, intoId: string) => MergeResult;
|
|
1073
|
+
purge: (keepId: string, days: number) => string[];
|
|
1074
|
+
name: (id: string, name: string, purpose?: string) => Session;
|
|
1075
|
+
adoptTitle: (id: string, title: string | undefined) => Session;
|
|
1076
|
+
list: (options?: ListSessionsOptions) => Session[];
|
|
1077
|
+
drop: (id: string) => Session;
|
|
1078
|
+
default: () => Session | undefined;
|
|
1079
|
+
byName: (name: string) => Session | undefined;
|
|
1080
|
+
byHostProcess: (host: string, processId: number) => Session | undefined;
|
|
1081
|
+
recordPluginVersion: (id: string, version: string | null) => void;
|
|
1082
|
+
recordPromptVersion: (id: string, version: string | null) => Session;
|
|
1083
|
+
setParent: (id: string, parentId: string) => Session;
|
|
1084
|
+
setStatus: (id: string, status: SessionStatus) => Session;
|
|
1085
|
+
create: (input: CreateSessionInput) => Session;
|
|
1086
|
+
setKind: (id: string, kind: SessionKind, name?: string | null) => Session;
|
|
1087
|
+
end: (id: string) => Session;
|
|
1088
|
+
rename: (id: string, name: string) => Session;
|
|
1089
|
+
promote: (id: string, name?: string) => Session;
|
|
1090
|
+
demote: (id: string) => Session;
|
|
1091
|
+
staleTemp: (olderThanMilliseconds: number) => Session[];
|
|
1092
|
+
resetDead: (isAlive: (processId: number) => boolean) => Session[];
|
|
1093
|
+
};
|
|
1094
|
+
private releaseSandbox;
|
|
1095
|
+
releaseClosedSandboxes(session?: string): number;
|
|
1096
|
+
readonly agents: {
|
|
1097
|
+
get: (session: string, name: string) => Agent | undefined;
|
|
1098
|
+
require: (session: string, name: string) => Agent;
|
|
1099
|
+
byId: (id: number) => Agent | undefined;
|
|
1100
|
+
kindHistory: (id: number) => KindStep[];
|
|
1101
|
+
resolveAttachments: (session: string, inputs: readonly AttachmentInput[]) => ({
|
|
1102
|
+
type: "ref";
|
|
1103
|
+
id: number;
|
|
1104
|
+
} | {
|
|
1105
|
+
type: "deliverable";
|
|
1106
|
+
agent: number;
|
|
1107
|
+
section: "plan" | "report";
|
|
1108
|
+
} | {
|
|
1109
|
+
type: "for_main";
|
|
1110
|
+
agent: number;
|
|
1111
|
+
} | {
|
|
1112
|
+
type: "findings";
|
|
1113
|
+
review: number;
|
|
1114
|
+
n: number[];
|
|
1115
|
+
} | {
|
|
1116
|
+
type: "notes";
|
|
1117
|
+
ids?: number[] | undefined;
|
|
1118
|
+
query?: string | undefined;
|
|
1119
|
+
})[];
|
|
1120
|
+
startWith: (session: string, input: Omit<StartAgentInput, 'attachments'>, attachments?: readonly AttachmentInput[]) => Agent;
|
|
1121
|
+
attach: (id: number, attachments: readonly Attachment[]) => Agent;
|
|
1122
|
+
start: (session: string, input: StartAgentInput) => Agent;
|
|
1123
|
+
update: (session: string, name: string, input: UpdateAgentInput) => Agent;
|
|
1124
|
+
moveStatus: (id: number, status: AgentStatus, note: string | null) => void;
|
|
1125
|
+
finish: (session: string, name: string, input: FinishAgentInput) => Agent;
|
|
1126
|
+
drop: (session: string, name: string, reason?: string) => ClosedAgent;
|
|
1127
|
+
close: (session: string, name: string, event: Omit<LogEventInput, 'agent' | 'agentId'>) => ClosedAgent;
|
|
1128
|
+
promote: (session: string, name: string, input: PromoteAgentInput) => ClosedAgent;
|
|
1129
|
+
list: (session: string, options?: ListAgentsOptions) => Agent[];
|
|
1130
|
+
reorderQueue: (session: string, names: string[]) => Agent[];
|
|
1131
|
+
byHostAgentId: (session: string, hostAgentId: string) => Agent | undefined;
|
|
1132
|
+
pairSubagent: (session: string, hostAgentId: string, names?: readonly string[], agentType?: string) => Agent | undefined;
|
|
1133
|
+
confirmSubagent: (session: string, hostAgentId: string, names: string[]) => Agent | undefined;
|
|
1134
|
+
fallbackCandidates: (session: string) => number;
|
|
1135
|
+
unpaired: (session: string, names: readonly string[]) => Agent | undefined;
|
|
1136
|
+
pendingPlan: (session: string) => Agent | undefined;
|
|
1137
|
+
requestLaunch: (session: string, name: string) => void;
|
|
1138
|
+
stopSubagent: (session: string, hostAgentId: string, names?: string[], usage?: TranscriptUsage) => Agent | undefined;
|
|
1139
|
+
};
|
|
1140
|
+
readonly questions: {
|
|
1141
|
+
list: (session: string, agent: string, openOnly?: boolean) => Question[];
|
|
1142
|
+
add: (session: string, agent: string, inputs: readonly QuestionInput[]) => Question[];
|
|
1143
|
+
answer: (session: string, agent: string, answers: readonly AnswerInput[]) => Question[];
|
|
1144
|
+
};
|
|
1145
|
+
readonly findings: {
|
|
1146
|
+
list: (session: string, agent: string, filter?: FindingFilter) => Finding[];
|
|
1147
|
+
replace: (session: string, agent: string, inputs: readonly FindingInput[]) => Finding[];
|
|
1148
|
+
decide: (session: string, agent: string, decisions: readonly DecisionInput[], override?: boolean) => Finding[];
|
|
1149
|
+
deliverSent: (session: string, agent: string) => Finding[];
|
|
1150
|
+
};
|
|
1151
|
+
readonly table: {
|
|
1152
|
+
get: (session: string) => TableItem | undefined;
|
|
1153
|
+
set: (session: string, input: SetTableInput) => TableItem;
|
|
1154
|
+
clear: (session: string) => void;
|
|
1155
|
+
};
|
|
1156
|
+
readonly turn: {
|
|
1157
|
+
get: (session: string) => "failed" | "waiting" | "working" | null;
|
|
1158
|
+
start: (session: string) => void;
|
|
1159
|
+
wait: (session: string) => void;
|
|
1160
|
+
fail: (session: string) => void;
|
|
1161
|
+
end: (session: string) => void;
|
|
1162
|
+
};
|
|
1163
|
+
readonly events: {
|
|
1164
|
+
log: (session: string, input: LogEventInput) => CarnetEvent;
|
|
1165
|
+
read: (session: string, limit?: number, agentOnly?: boolean, kind?: AgentKind) => CarnetEvent[];
|
|
1166
|
+
};
|
|
1167
|
+
readonly notes: {
|
|
1168
|
+
add: (input: AddNoteInput) => AddNoteResult;
|
|
1169
|
+
get: (id: number) => Note | null;
|
|
1170
|
+
show: (id: number, halfLifeDays?: number) => NoteDetail;
|
|
1171
|
+
list: (options?: ListNotesOptions) => WeightedNote[];
|
|
1172
|
+
stale: (halfLifeDays?: number) => WeightedNote[];
|
|
1173
|
+
drop: (id: number, input: DropNoteInput) => Note;
|
|
1174
|
+
dropMany: (ids: number[], input: Parameters<typeof dropNotes>[2]) => DropNotesResult;
|
|
1175
|
+
cite: (id: number, input: CiteNoteInput) => NoteCitation;
|
|
1176
|
+
recordActiveDay: () => void;
|
|
1177
|
+
activity: (session: string) => NoteActivity[];
|
|
1178
|
+
};
|
|
1179
|
+
readonly memory: {
|
|
1180
|
+
atStart: (session: Session, options?: MemoryOptions) => string | undefined;
|
|
1181
|
+
};
|
|
1182
|
+
readonly references: {
|
|
1183
|
+
add: (session: string, path: string, options?: {
|
|
1184
|
+
agent?: string | undefined;
|
|
1185
|
+
cwd?: string | undefined;
|
|
1186
|
+
}) => Reference;
|
|
1187
|
+
list: (session: string, options?: {
|
|
1188
|
+
agent?: string | undefined;
|
|
1189
|
+
all?: boolean | undefined;
|
|
1190
|
+
}) => Reference[];
|
|
1191
|
+
remove: (session: string, idOrPath: string) => Reference;
|
|
1192
|
+
};
|
|
1193
|
+
brief(session: string, name: string): Brief;
|
|
1194
|
+
readonly search: {
|
|
1195
|
+
index: (session: string, options?: IndexOptions) => IndexResult;
|
|
1196
|
+
refresh: (all?: boolean) => {
|
|
1197
|
+
pending: boolean;
|
|
1198
|
+
};
|
|
1199
|
+
reindex: (all?: boolean) => {
|
|
1200
|
+
sessions: number;
|
|
1201
|
+
};
|
|
1202
|
+
forgetTranscript: (session: string) => void;
|
|
1203
|
+
find: (question: string, options?: SearchOptions) => SearchResults;
|
|
1204
|
+
};
|
|
1205
|
+
readonly status: {
|
|
1206
|
+
view: (session: Session, options?: StatusViewOptions) => StatusView;
|
|
1207
|
+
render: (session: Session, options?: RenderOptions & StatusViewOptions) => string;
|
|
1208
|
+
sections: (session: Session) => string;
|
|
1209
|
+
};
|
|
1210
|
+
close(): void;
|
|
1211
|
+
}
|
|
1212
|
+
interface OpenCarnetOptions extends CarnetOptions {
|
|
1213
|
+
workspace?: string | undefined;
|
|
1214
|
+
sessionId?: string | undefined;
|
|
1215
|
+
cwd?: string | undefined;
|
|
1216
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
1217
|
+
dbPath?: string | undefined;
|
|
1218
|
+
tolerant?: boolean | undefined;
|
|
1219
|
+
}
|
|
1220
|
+
declare function openCarnet(options?: OpenCarnetOptions): Carnet;
|
|
1221
|
+
interface ResolvedCarnet {
|
|
1222
|
+
carnet: Carnet;
|
|
1223
|
+
resolution: WorkspaceResolution;
|
|
1224
|
+
}
|
|
1225
|
+
declare function openResolvedCarnet(options?: OpenCarnetOptions): ResolvedCarnet;
|
|
1226
|
+
declare function openWorkspaceCarnet(workspace: Workspace | null, options?: OpenCarnetOptions): Carnet;
|
|
1227
|
+
export { SearchResults as $, expandHome as $n, isAgentStatus as $r, HostStopPayload as $t, memoryMaxCharacters as A, ResolveWorkspaceOptions as An, KindStep as Ar, sessionNoteActivity as At, StatusViewOptions as B, CreateWorkspaceOptions as Bn, AGENT_STATUSES as Br, MINIMUM_ID_PREFIX as Bt, renderNotes as C, recommendedThen as Ci, checkForkOptions as Cn, AgentContext as Cr, NoteDetail as Ct, renderTableLine as D, prepareNew as Dn, FinishAgentInput as Dr, isNoteKind as Dt, renderStatus as E, prepareFork as En, CLAUDE_BACKEND as Er, WeightedNote as Et, BriefPartType as F, repoPathFor as Fn, StartAgentInput as Fr, MergeResult as Ft, TurnOptions as G, WORKSPACE_FILE as Gn, KIND_TAG_PATTERN as Gr, DEFAULT_HOST as Gt, formatClock as H, INSTRUCTIONS_FILE as Hn, EMOJI as Hr, SessionKind as Ht, buildBrief as I, requireWorkspace as In, UpdateAgentInput as Ir, CreateSessionInput as It, SEARCH_LIMITS as J, WorkspaceRepo as Jn, MAIN_WAITING_EMOJI as Jr, HostCommand as Jt, IndexOptions as K, Workspace as Kn, LEGEND as Kr, HookHost as Kt, planAsAnswered as L, resolveWorkspace as Ln, agentMode as Lr, HookEnv as Lt, Brief as M, WorkspaceResolution as Mn, PUBLISH_FALLBACK_MILLISECONDS as Mr, workspaceRepoNames as Mt, BriefOptions as N, isInside as Nn, REPORTING_NOTE as Nr, SetTableInput as Nt, MEMORY_MAX_CHARACTERS as O, prepareResume as On, KIND_MODES as Or, localDay as Ot, BriefPart as P, repoNameFor as Pn, SANDBOX_KINDS as Pr, TableItem as Pt, SearchOptions as Q, dropWorkspace as Qn, UserActionStatus as Qr, HostSessionPayload as Qt, StatusLine as R, workspaceLabel as Rn, isAgentKind as Rr, HookSessionPayload as Rt, renderNoteLine as S, produced as Si, buildLaunchPlan as Sn, Agent as Sr, NoteCitation as St, renderSections as T, launchStarted as Tn, AgentMode as Tr, STALE_AFTER_ACTIVE_DAYS as Tt, TURNS as U, REPO_INSTRUCTIONS_DIRECTORY as Un, KIND_ABBREVIATIONS as Ur, SessionStatus as Ut, buildStatusView as V, DropWorkspaceOptions as Vn, AgentStatus as Vr, Session as Vt, Turn as W, RepoInstructionsFile as Wn, KIND_LEGEND as Wr, shortId as Wt, SNIPPET_OPEN as X, createWorkspace as Xn, OPEN_AGENT_STATUSES as Xr, HostRender as Xt, SNIPPET_CLOSE as Y, addWorkspaceRepo as Yn, MAIN_WORKING_EMOJI as Yr, HostPromptPayload as Yt, SearchHit as Z, definitionInstructions as Zn, USER_ACTION_STATUSES as Zr, HostSessionEndPayload as Zt, NotesMode as _, attachment as _i, McpServerEntry as _n, GESTURES as _r, NOTE_KINDS as _t, ResolvedCarnet as a, EventType as ai, ProjectRelocation as an, repoInstructionFiles as ar, REFERENCE_SCOPES as at, renderAgentLine as b, attachmentsInput as bi, PreparedResume as bn, parseConfig as br, NoteActivity as bt, openWorkspaceCarnet as c, SessionEventType as ci, TranscriptSlice as cn, usableWorkspaceConfig as cr, formatBytes as ct, MAIN_HEADER as d, AttachmentInput as di, hookHost as dn, workspaceHosts as dr, AddNoteResult as dt, isUserActionStatus as ei, HostSubagentPayload as en, isWorkspaceName as er, SearchSource as et, MAIN_IDLE as f, DELIVERABLES as fi, hostById as fn, BACKENDS as fr, CiteNoteInput as ft, NOTES_HEADER as g, Snapshot as gi, LaunchPlanInput as gn, DECISION_USAGES as gr, ListNotesOptions as gt, NOTES_FOLD_LINES as h, RecommendedThen as hi, LaunchPlan as hn, DECIDER_PROVIDERS as hr, DropNoteInput as ht, OpenCarnetOptions as i, EVENT_TYPES as ii, Orchestration as in, removeWorkspaceRepo as ir, ListReferencesOptions as it, renderMemory as j, WorkspaceOrigin as jn, ListAgentsOptions as jr, similarity as jt, MemoryOptions as k, withWorkspace as kn, KIND_REQUIRED as kr, memoryHalfLife as kt, BLOCKED_HEADER as l, isEventType as li, TranscriptUsage as ln, workspaceExists as lr, referenceLine as lt, MAIN_WORKING_SUFFIX as m, Produced as mi, LaunchMode as mn, ConfigFile as mr, DUPLICATE_SIMILARITY as mt, CarnetOptions as n, AgentEventType as ni, LaunchHost as nn, loadWorkspace as nr, searchQuery as nt, openCarnet as o, LogEventInput as oi, RelocatedFolder as on, repoInstructionsPath as or, Reference as ot, MAIN_WAITING_SUFFIX as p, Deliverable as pi, launchHost as pn, Backend as pr, DEFAULT_HALF_LIFE_DAYS as pt, NoteMatch as q, WorkspaceFile as qn, MAIN_FAILED_EMOJI as qr, Host as qt, ClosedAgent as r, CarnetEvent as ri, LiveSession as rn, migrateInstructions as rr, transcriptsIndexed as rt, openResolvedCarnet as s, SESSION_EVENT_TYPES as si, TranscriptChunk as sn, serializeWorkspaceFile as sr, ReferenceScope as st, Carnet as t, kindTag as ti, HostToolPayload as tn, listWorkspaces as tr, SessionMatch as tt, MAIN_FAILED_SUFFIX as u, Attachment as ui, allHosts as un, workspaceFileHosts as ur, AddNoteInput as ut, RenderOptions as v, attachmentInput as vi, PrepareForkOptions as vn, RunPair as vr, NOTE_TEXT_LIMIT as vt, renderNotesSummary as w, snapshot as wi, launchEnded as wn, AgentKind as wr, NoteKind as wt, renderMainLine as x, deliverable as xi, SystemAppend as xn, AGENT_KINDS as xr, NoteActivityKind as xt, SIMILAR_PREFIX as y, attachments as yi, PrepareNewOptions as yn, Source as yr, Note as yt, StatusView as z, AGENTS_FILE as zn, statusWhenDone as zr, ListSessionsOptions as zt };
|
|
1228
|
+
//# sourceMappingURL=carnet-B9opMp0K.d.mts.map
|