@rucher/carnet 0.3.0-beta.3 → 0.4.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rucher/carnet",
3
- "version": "0.3.0-beta.3",
3
+ "version": "0.4.0-beta.0",
4
4
  "description": "Shared state for Rucher: sessions, agents, status and journal in SQLite",
5
5
  "keywords": [
6
6
  "agents",
@@ -37,6 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@modelcontextprotocol/server": "^2.4.0",
40
+ "yaml": "^2.9.1",
40
41
  "zod": "^4.2.0"
41
42
  },
42
43
  "devDependencies": {
@@ -1,646 +0,0 @@
1
- import { DatabaseSync } from "node:sqlite";
2
- interface Ctx {
3
- db: DatabaseSync;
4
- now: () => Date;
5
- workspace: string | null;
6
- }
7
- declare const EVENT_TYPES: readonly ['started', 'finished', 'answered', 'applied', 'tested', 'committed', 'dropped', 'injected', 'promoted', 'triaged'];
8
- declare const SESSION_EVENT_TYPES: readonly ['session.started', 'session.resumed', 'session.ended', 'session.forked'];
9
- type AgentEventType = (typeof EVENT_TYPES)[number];
10
- type SessionEventType = (typeof SESSION_EVENT_TYPES)[number];
11
- type EventType = AgentEventType | SessionEventType;
12
- interface CarnetEvent {
13
- id: number;
14
- session: string;
15
- at: string;
16
- type: EventType;
17
- agent: string | null;
18
- commit: string | null;
19
- link: string | null;
20
- note: string | null;
21
- }
22
- interface LogEventInput {
23
- type: EventType;
24
- agent?: string | undefined;
25
- commit?: string | undefined;
26
- link?: string | undefined;
27
- note?: string | undefined;
28
- }
29
- declare function isEventType(value: unknown): value is EventType;
30
- declare const AGENT_STATUSES: readonly ['running', 'discussing', 'answer', 'review', 'apply', 'test', 'closed'];
31
- type AgentStatus = (typeof AGENT_STATUSES)[number];
32
- declare const USER_ACTION_STATUSES: readonly ['discussing', 'answer', 'review', 'apply', 'test'];
33
- type UserActionStatus = (typeof USER_ACTION_STATUSES)[number];
34
- declare const EMOJI: Record<Exclude<AgentStatus, 'closed'>, string>;
35
- declare const MAIN_WORKING_EMOJI = "⚙️";
36
- declare const MAIN_WAITING_EMOJI = "⏸";
37
- declare const MAIN_FAILED_EMOJI = "⚠";
38
- declare const LEGEND = "⚙️ main working · ⏸ waiting on you · ⚠ turn failed · 💬 discussing · ❓ answer · 👀 review · 📥 apply · 🧪 test · ⏳ running";
39
- declare const KIND_ABBREVIATIONS: {
40
- readonly research: 'rs';
41
- readonly plan: 'pl';
42
- readonly implement: 'im';
43
- readonly review: 'rv';
44
- };
45
- declare function kindTag(kind: keyof typeof KIND_ABBREVIATIONS): string;
46
- declare const KIND_TAG_PATTERN: RegExp;
47
- declare const KIND_LEGEND = "[rs] research · [pl] plan · [im] implement · [rv] review";
48
- declare function isAgentStatus(value: unknown): value is AgentStatus;
49
- declare function isUserActionStatus(value: unknown): value is UserActionStatus;
50
- declare const OPEN_AGENT_STATUSES: readonly ["running", "discussing", "answer", "review", "apply", "test"];
51
- declare const AGENT_KINDS: readonly ['research', 'plan', 'implement', 'review'];
52
- type AgentKind = (typeof AGENT_KINDS)[number];
53
- declare const KIND_REQUIRED = "kind is required: research, plan, implement or review";
54
- declare function isAgentKind(value: unknown): value is AgentKind;
55
- interface Agent {
56
- session: string;
57
- name: string;
58
- kind: AgentKind;
59
- promotedFrom: AgentKind | null;
60
- target: string | null;
61
- blockedOn: string | null;
62
- task: string | null;
63
- status: AgentStatus;
64
- note: string | null;
65
- reportPath: string | null;
66
- baseCommit: string | null;
67
- worktree: string | null;
68
- sandbox: string | null;
69
- queueOrder: number | null;
70
- hostAgentId: string | null;
71
- pendingStatus: AgentStatus | null;
72
- doneAt: string | null;
73
- startedAt: string;
74
- updatedAt: string;
75
- statusSince: string;
76
- }
77
- interface StartAgentInput {
78
- name: string;
79
- task: string;
80
- kind: AgentKind;
81
- target?: string | undefined;
82
- baseCommit?: string | undefined;
83
- worktree?: string | undefined;
84
- sandbox?: string | undefined;
85
- }
86
- declare const SANDBOX_KINDS: readonly AgentKind[];
87
- interface UpdateAgentInput {
88
- status: AgentStatus;
89
- note?: string | null | undefined;
90
- reportPath?: string | undefined;
91
- blockedOn?: string | null | undefined;
92
- }
93
- interface FinishAgentInput {
94
- reportPath: string;
95
- hasQuestions: boolean;
96
- }
97
- interface ListAgentsOptions {
98
- includeClosed?: boolean;
99
- }
100
- declare const REPORTING_NOTE = "reporting";
101
- declare const PUBLISH_FALLBACK_MILLISECONDS = 120000;
102
- declare function statusWhenDone(kind: AgentKind, hasQuestions: boolean): AgentStatus;
103
- interface PromoteAgentInput {
104
- kind: AgentKind | undefined;
105
- worktree?: string | undefined;
106
- baseCommit?: string | undefined;
107
- }
108
- interface WorkspaceRepo {
109
- path: string;
110
- name: string;
111
- }
112
- interface Workspace {
113
- name: string;
114
- definition: string;
115
- runDirectory: string;
116
- repos: WorkspaceRepo[];
117
- backends: Record<string, {
118
- settings?: Record<string, unknown>;
119
- }>;
120
- }
121
- interface WorkspaceFile {
122
- name?: string | undefined;
123
- repos?: {
124
- path: string;
125
- name?: string | undefined;
126
- }[] | undefined;
127
- backends?: Workspace['backends'] | undefined;
128
- }
129
- declare const WORKSPACE_FILE = "workspace.json";
130
- declare const INSTRUCTIONS_FILE = "CLAUDE.md";
131
- declare const AGENTS_FILE = "AGENTS.md";
132
- declare function isWorkspaceName(name: string): boolean;
133
- declare function expandHome(path: string, env?: NodeJS.ProcessEnv): string;
134
- declare function workspaceExists(name: string, env?: NodeJS.ProcessEnv): boolean;
135
- declare function loadWorkspace(name: string, env?: NodeJS.ProcessEnv): Workspace;
136
- declare function listWorkspaces(env?: NodeJS.ProcessEnv): Workspace[];
137
- declare function workspaceHosts(workspace: Workspace): string[];
138
- interface CreateWorkspaceOptions {
139
- repos?: readonly string[] | undefined;
140
- env?: NodeJS.ProcessEnv | undefined;
141
- }
142
- declare function createWorkspace(name: string, options?: CreateWorkspaceOptions): Workspace;
143
- declare function definitionInstructions(workspace: Workspace): string;
144
- declare function addWorkspaceRepo(name: string, repo: string, env?: NodeJS.ProcessEnv): Workspace;
145
- declare function removeWorkspaceRepo(name: string, repo: string, env?: NodeJS.ProcessEnv): Workspace;
146
- interface DropWorkspaceOptions {
147
- purge?: boolean | undefined;
148
- env?: NodeJS.ProcessEnv | undefined;
149
- }
150
- declare function dropWorkspace(name: string, options?: DropWorkspaceOptions): Workspace;
151
- declare function isInside(directory: string, path: string): boolean;
152
- declare function repoNameFor(workspace: Workspace | null, path: string | undefined): string | null;
153
- declare function repoPathFor(workspace: Workspace | null, path: string | undefined | null): string | null;
154
- type WorkspaceOrigin = 'session' | 'option' | 'env' | 'run-directory' | 'none';
155
- interface WorkspaceResolution {
156
- workspace: Workspace | null;
157
- origin: WorkspaceOrigin;
158
- }
159
- interface ResolveWorkspaceOptions {
160
- db?: DatabaseSync | undefined;
161
- sessionId?: string | undefined;
162
- workspace?: string | undefined;
163
- cwd?: string | undefined;
164
- env?: NodeJS.ProcessEnv | undefined;
165
- }
166
- declare function resolveWorkspace({ db, sessionId, workspace, cwd, env }?: ResolveWorkspaceOptions): WorkspaceResolution;
167
- declare function workspaceLabel(workspace: Workspace | null): string;
168
- declare function requireWorkspace(workspace: Workspace | null): Workspace;
169
- interface UndoStep {
170
- command: string;
171
- run: () => void;
172
- }
173
- interface HostSessionPayload {
174
- session_id: string;
175
- cwd?: string | undefined;
176
- source?: string | undefined;
177
- session_title?: string | undefined;
178
- }
179
- interface HostPromptPayload {
180
- session_id: string;
181
- cwd?: string | undefined;
182
- session_title?: string | undefined;
183
- transcript_path?: string | undefined;
184
- }
185
- interface HostSubagentPayload {
186
- session_id: string;
187
- agent_id: string;
188
- agent_type?: string | undefined;
189
- cwd?: string | undefined;
190
- description?: string | undefined;
191
- agent_transcript_path?: string | undefined;
192
- }
193
- interface HostStopPayload {
194
- session_id: string;
195
- cwd?: string | undefined;
196
- failed: boolean;
197
- }
198
- interface HostSessionEndPayload {
199
- session_id: string;
200
- cwd?: string | undefined;
201
- reason?: string | undefined;
202
- }
203
- interface HostToolPayload {
204
- session_id: string;
205
- cwd?: string | undefined;
206
- tool_name?: string | undefined;
207
- agent_id?: string | undefined;
208
- agent_type?: string | undefined;
209
- path?: string | undefined;
210
- file_path?: string | undefined;
211
- command?: string | undefined;
212
- subagent_type?: string | undefined;
213
- launched_names?: string[] | undefined;
214
- }
215
- interface ResumeCommand {
216
- command: string;
217
- args: string[];
218
- }
219
- interface LaunchOptions {
220
- name?: string | null | undefined;
221
- appendPromptFile?: string | undefined;
222
- passthrough?: readonly string[] | undefined;
223
- directories?: readonly string[] | undefined;
224
- }
225
- interface HostRender {
226
- written: string[];
227
- removed: string[];
228
- }
229
- interface RelocatedFolder {
230
- from: string;
231
- to: string;
232
- }
233
- interface ProjectRelocation {
234
- moves: RelocatedFolder[];
235
- undo: UndoStep[];
236
- }
237
- interface Host {
238
- id: string;
239
- displayName: string;
240
- processId(env: NodeJS.ProcessEnv): number | null;
241
- sessionIdFromEnvironment(env: NodeJS.ProcessEnv): string | undefined;
242
- projectDirectory(env: NodeJS.ProcessEnv): string | undefined;
243
- parseSessionPayload(json: string): HostSessionPayload;
244
- parseStopPayload(json: string): HostStopPayload;
245
- parsePromptPayload(json: string): HostPromptPayload;
246
- parseSubagentPayload(json: string): HostSubagentPayload;
247
- parseSessionEndPayload(json: string): HostSessionEndPayload;
248
- parseToolPayload(json: string): HostToolPayload;
249
- subagentNames(payload: HostSubagentPayload): string[];
250
- subagentInheritsContext(payload: HostSubagentPayload): boolean;
251
- rendersSystemPrompt(source: string): boolean;
252
- promptTitle(payload: HostPromptPayload): string | undefined;
253
- launchCommand(sessionId: string, options?: LaunchOptions): ResumeCommand;
254
- resumeCommand(session: Session, options?: LaunchOptions): ResumeCommand;
255
- forkCommand(parent: Session, options?: LaunchOptions): ResumeCommand;
256
- renameInstruction(name: string): string;
257
- transcriptFiles(session: Session, env?: NodeJS.ProcessEnv): string[];
258
- hasConversation(session: Session, env?: NodeJS.ProcessEnv): boolean;
259
- continues(parent: Session, childId: string, env?: NodeJS.ProcessEnv): boolean;
260
- renderRunDirectory(workspace: Workspace): HostRender;
261
- relocateProject?(from: string, to: string, env: NodeJS.ProcessEnv, mode?: 'move' | 'merge'): ProjectRelocation | null;
262
- moveTrust?(from: string, to: string | null, env: NodeJS.ProcessEnv): boolean;
263
- }
264
- declare const DEFAULT_HOST = "claude-code";
265
- declare function allHosts(): Host[];
266
- declare function hostById(id: string): Host;
267
- type SessionKind = 'active' | 'temp';
268
- type SessionStatus = 'running' | 'idle' | 'archived';
269
- interface Session {
270
- id: string;
271
- workspace: string;
272
- name: string | null;
273
- purpose: string | null;
274
- kind: SessionKind;
275
- status: SessionStatus;
276
- cwd: string | null;
277
- repo: string | null;
278
- host: string;
279
- hostPid: number | null;
280
- hookedAt: string | null;
281
- lastTitle: string | null;
282
- parentId: string | null;
283
- promptVersion: string | null;
284
- pluginVersion: string | null;
285
- createdAt: string;
286
- lastActiveAt: string;
287
- endedAt: string | null;
288
- }
289
- type HookSessionPayload = HostSessionPayload;
290
- interface HookEnv {
291
- host?: string | undefined;
292
- processId?: number | null | undefined;
293
- RUCHER_PURGE_DAYS?: string | undefined;
294
- RUCHER_HOME?: string | undefined;
295
- RUCHER_SESSION_ID?: string | undefined;
296
- RUCHER_SESSION_KIND?: string | undefined;
297
- RUCHER_SESSION_NAME?: string | undefined;
298
- RUCHER_PROMPT_VERSION?: string | undefined;
299
- RUCHER_MEMORY_MAX_CHARACTERS?: string | undefined;
300
- RUCHER_MEMORY_HALF_LIFE_DAYS?: string | undefined;
301
- CLAUDE_CONFIG_DIR?: string | undefined;
302
- }
303
- interface CreateSessionInput {
304
- id: string;
305
- kind: SessionKind;
306
- name?: string | null | undefined;
307
- cwd: string;
308
- repo?: string | null | undefined;
309
- host?: string | undefined;
310
- }
311
- interface ListSessionsOptions {
312
- includeTemp?: boolean | undefined;
313
- includeArchived?: boolean | undefined;
314
- }
315
- declare const MINIMUM_ID_PREFIX = 4;
316
- declare function shortId(id: string): string;
317
- interface MergeResult {
318
- session: Session;
319
- movedAgents: string[];
320
- closedAgents: string[];
321
- movedEvents: number;
322
- movedTable: boolean;
323
- }
324
- interface QuestionInput {
325
- text: string;
326
- context?: string | undefined;
327
- recommendation: string;
328
- alternatives?: readonly string[] | undefined;
329
- }
330
- interface Question {
331
- n: number;
332
- total: number;
333
- text: string;
334
- context: string | null;
335
- recommendation: string;
336
- alternatives: string[];
337
- answer: string | null;
338
- answeredAt: string | null;
339
- }
340
- interface AnswerInput {
341
- n: number;
342
- answer: string;
343
- }
344
- declare const FINDING_SEVERITIES: readonly ['blocking', 'to_fix', 'suggestion'];
345
- type FindingSeverity = (typeof FINDING_SEVERITIES)[number];
346
- declare const FINDING_DECISIONS: readonly ['fix', 'sent', 'fixed', 'ignored'];
347
- type FindingDecision = (typeof FINDING_DECISIONS)[number];
348
- interface FindingInput {
349
- severity: FindingSeverity;
350
- location?: string | undefined;
351
- text: string;
352
- fix?: string | undefined;
353
- }
354
- interface Finding {
355
- n: number;
356
- total: number;
357
- severity: FindingSeverity;
358
- location: string | null;
359
- text: string;
360
- fix: string | null;
361
- decision: FindingDecision | null;
362
- reason: string | null;
363
- }
364
- interface DecisionInput {
365
- n: number;
366
- decision: FindingDecision;
367
- reason?: string | undefined;
368
- }
369
- interface TableItem {
370
- session: string;
371
- text: string;
372
- status: UserActionStatus | null;
373
- updatedAt: string;
374
- }
375
- interface SetTableInput {
376
- text: string;
377
- status?: UserActionStatus | undefined;
378
- }
379
- declare const NOTE_KINDS: readonly ['dead_end', 'decision', 'learning'];
380
- type NoteKind = (typeof NOTE_KINDS)[number];
381
- declare const NOTE_TEXT_LIMIT = 200;
382
- declare const DUPLICATE_SIMILARITY = 0.6;
383
- declare const DEFAULT_HALF_LIFE_DAYS = 20;
384
- declare const STALE_AFTER_ACTIVE_DAYS = 40;
385
- declare function isNoteKind(value: string): value is NoteKind;
386
- declare function memoryHalfLife(value: string | undefined): number;
387
- interface Note {
388
- id: number;
389
- kind: NoteKind;
390
- text: string;
391
- repos: string[];
392
- session: string | null;
393
- agent: string | null;
394
- similarNotes: number[];
395
- createdAt: string;
396
- droppedAt: string | null;
397
- droppedReason: string | null;
398
- droppedSession: string | null;
399
- replacedBy: number | null;
400
- }
401
- interface NoteCitation {
402
- id: number;
403
- note: number;
404
- session: string | null;
405
- agent: string | null;
406
- why: string;
407
- at: string;
408
- }
409
- interface WeightedNote extends Note {
410
- weight: number;
411
- citationCount: number;
412
- }
413
- interface NoteDetail extends WeightedNote {
414
- citations: NoteCitation[];
415
- }
416
- interface AddNoteInput {
417
- kind: string;
418
- text: string;
419
- repos?: string[] | undefined;
420
- session?: string | null | undefined;
421
- agent?: string | null | undefined;
422
- }
423
- interface AddNoteResult {
424
- note: Note;
425
- similar: Note[];
426
- }
427
- interface ListNotesOptions {
428
- kind?: string | undefined;
429
- repo?: string | undefined;
430
- general?: boolean | undefined;
431
- query?: string | undefined;
432
- includeDropped?: boolean | undefined;
433
- halfLifeDays?: number | undefined;
434
- }
435
- interface DropNoteInput {
436
- reason: string;
437
- replacedBy?: number | undefined;
438
- session?: string | null | undefined;
439
- }
440
- interface CiteNoteInput {
441
- why: string;
442
- session?: string | null | undefined;
443
- agent?: string | null | undefined;
444
- }
445
- declare function workspaceRepoNames(workspace: Workspace): string[];
446
- declare function similarity(first: string, second: string): number;
447
- declare function localDay(date: Date): string;
448
- type NoteActivityKind = 'added' | 'cited' | 'dropped';
449
- interface NoteActivity {
450
- activity: NoteActivityKind;
451
- note: number;
452
- kind: NoteKind;
453
- text: string;
454
- similarNotes: number[];
455
- replacedBy: number | null;
456
- at: string;
457
- }
458
- declare function sessionNoteActivity(ctx: Ctx, session: string): NoteActivity[];
459
- declare const TURNS: readonly ['working', 'waiting', 'failed'];
460
- type Turn = (typeof TURNS)[number];
461
- interface TurnOptions {
462
- trackTurn?: boolean | undefined;
463
- }
464
- interface StatusLine {
465
- name: string;
466
- kind: AgentKind;
467
- status: AgentStatus;
468
- emoji: string;
469
- action: string | null;
470
- note: string | null;
471
- pinned: boolean;
472
- }
473
- interface StatusView {
474
- time: string;
475
- sessionName: string | null;
476
- table: TableItem | null;
477
- turn: Turn | null;
478
- waiting: StatusLine[];
479
- blocked: StatusLine[];
480
- running: StatusLine[];
481
- notes: NoteActivity[];
482
- }
483
- interface StatusViewOptions {
484
- kind?: AgentKind | undefined;
485
- }
486
- declare function formatClock(date: Date): string;
487
- declare function buildStatusView(ctx: Ctx, session: Session, options?: StatusViewOptions): StatusView;
488
- declare const MEMORY_MAX_CHARACTERS = 2000;
489
- declare function memoryMaxCharacters(value: string | undefined): number;
490
- interface MemoryOptions {
491
- maxCharacters?: number | undefined;
492
- halfLifeDays?: number | undefined;
493
- }
494
- interface MemoryScope {
495
- title: string;
496
- notes: WeightedNote[];
497
- }
498
- declare function renderMemory(scope: MemoryScope, maxCharacters?: number): string;
499
- declare const MAIN_HEADER = "Main";
500
- declare const MAIN_WORKING_SUFFIX = "(main working)";
501
- declare const BLOCKED_HEADER = "Waiting on agents";
502
- declare const MAIN_WAITING_SUFFIX = "(waiting on you)";
503
- declare const MAIN_FAILED_SUFFIX = "(turn failed)";
504
- declare function renderTableLine(item: TableItem): string;
505
- declare const MAIN_IDLE = "idle";
506
- declare function renderMainLine(item: TableItem | null, turn: Turn | null): string;
507
- declare function renderAgentLine(line: StatusLine, nameWidth?: number): string;
508
- declare const NOTES_HEADER = "Notes";
509
- declare const NOTES_FOLD_LINES = 5;
510
- declare const SIMILAR_PREFIX = "similar to ";
511
- type NotesMode = 'full' | 'summary' | 'expanded';
512
- interface RenderOptions {
513
- notes?: NotesMode | undefined;
514
- }
515
- declare function renderNotesSummary(notes: NoteActivity[]): string;
516
- declare function renderNoteLine(item: NoteActivity, idWidth: number): string;
517
- declare function renderNotes(notes: NoteActivity[], mode?: NotesMode): string[];
518
- declare function renderSections(view: StatusView, options?: RenderOptions): string;
519
- declare function renderStatus(view: StatusView, options?: RenderOptions): string;
520
- interface CarnetOptions {
521
- now?: () => Date;
522
- }
523
- interface ClosedAgent extends Agent {
524
- sandboxRemoved: boolean;
525
- }
526
- declare class Carnet {
527
- readonly workspace: Workspace | null;
528
- readonly db: DatabaseSync;
529
- private readonly ctx;
530
- constructor(db: DatabaseSync, workspace: Workspace | null, options?: CarnetOptions);
531
- now(): Date;
532
- requireWorkspace(): Workspace;
533
- readonly sessions: {
534
- get: (id: string) => Session | undefined;
535
- find: (reference: string) => Session;
536
- require: (id: string) => Session;
537
- ensure: (id: string, cwd?: string) => Session;
538
- upsertFromHook: (payload: HookSessionPayload, env?: HookEnv) => Session;
539
- touch: (id: string) => void;
540
- merge: (fromId: string, intoId: string) => MergeResult;
541
- purge: (keepId: string, days: number) => string[];
542
- name: (id: string, name: string, purpose?: string) => Session;
543
- adoptTitle: (id: string, title: string | undefined) => Session;
544
- list: (options?: ListSessionsOptions) => Session[];
545
- drop: (id: string) => Session;
546
- default: () => Session | undefined;
547
- byName: (name: string) => Session | undefined;
548
- byHostProcess: (host: string, processId: number) => Session | undefined;
549
- recordPluginVersion: (id: string, version: string | null) => void;
550
- recordPromptVersion: (id: string, version: string | null) => Session;
551
- setParent: (id: string, parentId: string) => Session;
552
- setStatus: (id: string, status: SessionStatus) => Session;
553
- create: (input: CreateSessionInput) => Session;
554
- setKind: (id: string, kind: SessionKind, name?: string | null) => Session;
555
- end: (id: string) => Session;
556
- rename: (id: string, name: string) => Session;
557
- promote: (id: string, name?: string) => Session;
558
- demote: (id: string) => Session;
559
- staleTemp: (olderThanMilliseconds: number) => Session[];
560
- resetDead: (isAlive: (processId: number) => boolean) => Session[];
561
- };
562
- private releaseSandbox;
563
- releaseClosedSandboxes(session?: string): number;
564
- readonly agents: {
565
- get: (session: string, name: string) => Agent | undefined;
566
- start: (session: string, input: StartAgentInput) => Agent;
567
- update: (session: string, name: string, input: UpdateAgentInput) => Agent;
568
- finish: (session: string, name: string, input: FinishAgentInput) => Agent;
569
- drop: (session: string, name: string, reason?: string) => ClosedAgent;
570
- close: (session: string, name: string, event: Omit<LogEventInput, 'agent'>) => ClosedAgent;
571
- promote: (session: string, name: string, input: PromoteAgentInput) => ClosedAgent;
572
- list: (session: string, options?: ListAgentsOptions) => Agent[];
573
- reorderQueue: (session: string, names: string[]) => Agent[];
574
- byHostAgentId: (session: string, hostAgentId: string) => Agent | undefined;
575
- pairSubagent: (session: string, hostAgentId: string, names?: readonly string[], agentType?: string) => Agent | undefined;
576
- unpaired: (session: string, names: readonly string[]) => Agent | undefined;
577
- pendingPlan: (session: string) => Agent | undefined;
578
- requestLaunch: (session: string, name: string) => void;
579
- stopSubagent: (session: string, hostAgentId: string, names?: string[]) => Agent | undefined;
580
- };
581
- readonly questions: {
582
- list: (session: string, agent: string, openOnly?: boolean) => Question[];
583
- add: (session: string, agent: string, inputs: readonly QuestionInput[]) => Question[];
584
- answer: (session: string, agent: string, answers: readonly AnswerInput[]) => Question[];
585
- };
586
- readonly findings: {
587
- list: (session: string, agent: string, pendingOnly?: boolean) => Finding[];
588
- replace: (session: string, agent: string, inputs: readonly FindingInput[]) => Finding[];
589
- decide: (session: string, agent: string, decisions: readonly DecisionInput[]) => Finding[];
590
- };
591
- readonly table: {
592
- get: (session: string) => TableItem | undefined;
593
- set: (session: string, input: SetTableInput) => TableItem;
594
- clear: (session: string) => void;
595
- };
596
- readonly turn: {
597
- get: (session: string) => "failed" | "waiting" | "working" | null;
598
- start: (session: string) => void;
599
- wait: (session: string) => void;
600
- fail: (session: string) => void;
601
- end: (session: string) => void;
602
- };
603
- readonly events: {
604
- log: (session: string, input: LogEventInput) => CarnetEvent;
605
- read: (session: string, limit?: number, agentOnly?: boolean, kind?: AgentKind) => CarnetEvent[];
606
- };
607
- readonly notes: {
608
- add: (input: AddNoteInput) => AddNoteResult;
609
- get: (id: number) => Note | null;
610
- show: (id: number, halfLifeDays?: number) => NoteDetail;
611
- list: (options?: ListNotesOptions) => WeightedNote[];
612
- stale: (halfLifeDays?: number) => WeightedNote[];
613
- drop: (id: number, input: DropNoteInput) => Note;
614
- cite: (id: number, input: CiteNoteInput) => NoteCitation;
615
- recordActiveDay: () => void;
616
- activity: (session: string) => NoteActivity[];
617
- };
618
- readonly memory: {
619
- atStart: (session: Session, options?: MemoryOptions) => string | undefined;
620
- ofSession: (session: Session, options?: MemoryOptions) => string | undefined;
621
- forRepo: (session: Session, repo: string, options?: MemoryOptions) => string | undefined;
622
- copyRepos: (from: string, into: string) => void;
623
- };
624
- readonly status: {
625
- view: (session: Session, options?: StatusViewOptions) => StatusView;
626
- render: (session: Session, options?: RenderOptions & StatusViewOptions) => string;
627
- sections: (session: Session) => string;
628
- };
629
- close(): void;
630
- }
631
- interface OpenCarnetOptions extends CarnetOptions {
632
- workspace?: string | undefined;
633
- sessionId?: string | undefined;
634
- cwd?: string | undefined;
635
- env?: NodeJS.ProcessEnv | undefined;
636
- dbPath?: string | undefined;
637
- }
638
- declare function openCarnet(options?: OpenCarnetOptions): Carnet;
639
- interface ResolvedCarnet {
640
- carnet: Carnet;
641
- resolution: WorkspaceResolution;
642
- }
643
- declare function openResolvedCarnet(options?: OpenCarnetOptions): ResolvedCarnet;
644
- declare function openWorkspaceCarnet(workspace: Workspace | null, options?: OpenCarnetOptions): Carnet;
645
- export { NoteDetail as $, addWorkspaceRepo as $t, memoryMaxCharacters as A, MAIN_FAILED_EMOJI as An, LaunchOptions as At, AddNoteInput as B, CarnetEvent as Bn, repoNameFor as Bt, renderNotes as C, AGENT_STATUSES as Cn, HostPromptPayload as Ct, renderTableLine as D, KIND_LEGEND as Dn, HostStopPayload as Dt, renderStatus as E, KIND_ABBREVIATIONS as En, HostSessionPayload as Et, buildStatusView as F, UserActionStatus as Fn, hostById as Ft, DropNoteInput as G, SessionEventType as Gn, AGENTS_FILE as Gt, CiteNoteInput as H, EventType as Hn, requireWorkspace as Ht, formatClock as I, isAgentStatus as In, ResolveWorkspaceOptions as It, NOTE_TEXT_LIMIT as J, INSTRUCTIONS_FILE as Jt, ListNotesOptions as K, isEventType as Kn, CreateWorkspaceOptions as Kt, TURNS as L, isUserActionStatus as Ln, WorkspaceOrigin as Lt, StatusLine as M, MAIN_WORKING_EMOJI as Mn, RelocatedFolder as Mt, StatusView as N, OPEN_AGENT_STATUSES as Nn, ResumeCommand as Nt, MEMORY_MAX_CHARACTERS as O, KIND_TAG_PATTERN as On, HostSubagentPayload as Ot, StatusViewOptions as P, USER_ACTION_STATUSES as Pn, allHosts as Pt, NoteCitation as Q, WorkspaceRepo as Qt, Turn as R, kindTag as Rn, WorkspaceResolution as Rt, renderNoteLine as S, statusWhenDone as Sn, Host as St, renderSections as T, EMOJI as Tn, HostSessionEndPayload as Tt, DEFAULT_HALF_LIFE_DAYS as U, LogEventInput as Un, resolveWorkspace as Ut, AddNoteResult as V, EVENT_TYPES as Vn, repoPathFor as Vt, DUPLICATE_SIMILARITY as W, SESSION_EVENT_TYPES as Wn, workspaceLabel as Wt, NoteActivity as X, Workspace as Xt, Note as Y, WORKSPACE_FILE as Yt, NoteActivityKind as Z, WorkspaceFile as Zt, NotesMode as _, REPORTING_NOTE as _n, Session as _t, ResolvedCarnet as a, listWorkspaces as an, memoryHalfLife as at, renderAgentLine as b, UpdateAgentInput as bn, shortId as bt, openWorkspaceCarnet as c, workspaceExists as cn, workspaceRepoNames as ct, MAIN_HEADER as d, Agent as dn, MergeResult as dt, createWorkspace as en, NoteKind as et, MAIN_IDLE as f, AgentKind as fn, CreateSessionInput as ft, NOTES_HEADER as g, PUBLISH_FALLBACK_MILLISECONDS as gn, MINIMUM_ID_PREFIX as gt, NOTES_FOLD_LINES as h, ListAgentsOptions as hn, ListSessionsOptions as ht, OpenCarnetOptions as i, isWorkspaceName as in, localDay as it, renderMemory as j, MAIN_WAITING_EMOJI as jn, ProjectRelocation as jt, MemoryOptions as k, LEGEND as kn, HostToolPayload as kt, BLOCKED_HEADER as l, workspaceHosts as ln, SetTableInput as lt, MAIN_WORKING_SUFFIX as m, KIND_REQUIRED as mn, HookSessionPayload as mt, CarnetOptions as n, dropWorkspace as nn, WeightedNote as nt, openCarnet as o, loadWorkspace as on, sessionNoteActivity as ot, MAIN_WAITING_SUFFIX as p, FinishAgentInput as pn, HookEnv as pt, NOTE_KINDS as q, DropWorkspaceOptions as qt, ClosedAgent as r, expandHome as rn, isNoteKind as rt, openResolvedCarnet as s, removeWorkspaceRepo as sn, similarity as st, Carnet as t, definitionInstructions as tn, STALE_AFTER_ACTIVE_DAYS as tt, MAIN_FAILED_SUFFIX as u, AGENT_KINDS as un, TableItem as ut, RenderOptions as v, SANDBOX_KINDS as vn, SessionKind as vt, renderNotesSummary as w, AgentStatus as wn, HostRender as wt, renderMainLine as x, isAgentKind as xn, DEFAULT_HOST as xt, SIMILAR_PREFIX as y, StartAgentInput as yn, SessionStatus as yt, TurnOptions as z, AgentEventType as zn, isInside as zt };
646
- //# sourceMappingURL=carnet-D3zpKpdn.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"carnet-D3zpKpdn.d.mts","names":["_$__merge_ts0.MergeResult","_$__questions_ts0.Question","_$__findings_ts0.Finding","_$__table_ts0.TableItem","_$__events_ts0.CarnetEvent","_$__notes_ts0.AddNoteResult","_$__notes_ts0.Note","_$__notes_ts0.NoteDetail","_$__notes_ts0.WeightedNote","_$__notes_ts0.NoteCitation","_$__notes_ts0.NoteActivity","_$__status_view_ts0.StatusView"],"sources":["../src/context.ts","../src/events.ts","../src/status/model.ts","../src/agents.ts","../src/workspace/workspace.ts","../src/workspace/locate.ts","../src/workspace/undo.ts","../src/hosts/host.ts","../src/sessions.ts","../src/merge.ts","../src/questions.ts","../src/findings.ts","../src/table.ts","../src/notes.ts","../src/turn.ts","../src/status/view.ts","../src/memory.ts","../src/status/render.ts","../src/carnet.ts"],"mappings":";UAEiB;EACf,IAAI;EACJ,WAAW;EAEX;;cCFW;cAaA;KAOD,yBAAyB;KACzB,2BAA2B;KAC3B,YAAY,iBAAiB;UAIxB;EACf;EACA;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;;UAGe;EACf,M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G7C;iBAIG,YAAY;iBAIZ,SAAS,aAAa;KCvH1B;KACA;UAEK;EACf;EACA;EACA;EACA;EACA,MAAM;EACN,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAwBU,qBAAqB;UAEhB;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA,MAAM;EACN;EACA;EACA;EACA;;UAGe;EACf;EACA;;cA2QW;iBAEG,QAAQ;UCvVP;EACf,SAAS;EACT;EACA;EACA;EACA;;UCLe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;;cCtBW;KACD,0BAA0B;cAEzB;KACD,0BAA0B;UAerB;EACf,UAAU;EACV;EACA;EACA;;UAGe;EACf;EACA;EACA,UAAU;EACV;EACA;EACA;EACA,UAAU;EACV;;UAGe;EACf;EACA,UAAU;EACV;;UCtCe;EACf;EACA;EACA,QAAQ;EACR;;UAGe;EACf;EACA,SAAS;;cCVE;KACD,mBAAmB;cAElB;cACA;cACA;cACA;iBAIG,WAAW,gBAAgB,SAAS;iBAIpC,eAAe;UAKd;EACf;EACA,MAAM;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe,qBAAqB;EACpC;EACA;;UAGe,mBAAmB;EAClC,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf,MAAM;EACN,SAAS;;UAGM;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;;iBA0Cc,mBAAmB,WAAW;iBAqB9B,WAAW,eAAe;iBAS1B,SAAS,MAAM;KAsQnB;UAEK;EACf,UAAU;EACV;EACA,MAAM;EACN;EACA;EACA;EACA;;iBAec,oBAAoB,KAAK,KAAK,kBAAkB;cC3bnD;KACD,eAAe;UAEV;E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