@rucher/carnet 0.2.0-beta.6 → 0.2.0-beta.7

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.
@@ -4,19 +4,58 @@ interface Ctx {
4
4
  now: () => Date;
5
5
  workspace: string | null;
6
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;
7
30
  declare const AGENT_STATUSES: readonly ['running', 'discussing', 'answer', 'review', 'apply', 'test', 'commit', 'branch', 'closed'];
8
31
  type AgentStatus = (typeof AGENT_STATUSES)[number];
9
32
  declare const USER_ACTION_STATUSES: readonly ['discussing', 'answer', 'review', 'apply', 'test', 'commit', 'branch'];
10
33
  type UserActionStatus = (typeof USER_ACTION_STATUSES)[number];
11
34
  declare const EMOJI: Record<Exclude<AgentStatus, 'closed'>, string>;
12
35
  declare const MAIN_WORKING_EMOJI = "⚙️";
13
- declare const LEGEND = "⚙️ main working · 💬 discussing · ❓ answer · 👀 review · 📥 apply · 🧪 test · ✅ commit · 🌿 branch · ⏳ running";
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 · ✅ commit · 🌿 branch · ⏳ running";
39
+ declare const KIND_ABBREVIATIONS: {
40
+ readonly research: 'rs';
41
+ readonly analyze: 'an';
42
+ readonly implement: 'im';
43
+ readonly review: 'rv';
44
+ };
45
+ declare const KIND_LEGEND = "rs research · an analyze · im implement · rv review";
14
46
  declare function isAgentStatus(value: unknown): value is AgentStatus;
15
47
  declare function isUserActionStatus(value: unknown): value is UserActionStatus;
16
48
  declare const OPEN_AGENT_STATUSES: readonly ["running", "discussing", "answer", "review", "apply", "test", "commit", "branch"];
49
+ declare const AGENT_KINDS: readonly ['research', 'analyze', 'implement', 'review'];
50
+ type AgentKind = (typeof AGENT_KINDS)[number];
51
+ declare const DEFAULT_AGENT_KIND: AgentKind;
52
+ declare function isAgentKind(value: unknown): value is AgentKind;
17
53
  interface Agent {
18
54
  session: string;
19
55
  name: string;
56
+ kind: AgentKind;
57
+ promotedFrom: AgentKind | null;
58
+ target: string | null;
20
59
  task: string | null;
21
60
  status: AgentStatus;
22
61
  note: string | null;
@@ -33,12 +72,14 @@ interface Agent {
33
72
  interface StartAgentInput {
34
73
  name: string;
35
74
  task: string;
75
+ kind?: AgentKind | undefined;
76
+ target?: string | undefined;
36
77
  baseCommit?: string | undefined;
37
78
  worktree?: string | undefined;
38
79
  }
39
80
  interface UpdateAgentInput {
40
81
  status: AgentStatus;
41
- note?: string | undefined;
82
+ note?: string | null | undefined;
42
83
  reportPath?: string | undefined;
43
84
  }
44
85
  interface FinishAgentInput {
@@ -50,6 +91,11 @@ interface ListAgentsOptions {
50
91
  }
51
92
  declare const REPORTING_NOTE = "reporting";
52
93
  declare const PUBLISH_FALLBACK_MILLISECONDS = 120000;
94
+ declare function statusWhenDone(kind: AgentKind, hasQuestions: boolean): AgentStatus;
95
+ interface PromoteAgentInput {
96
+ worktree?: string | undefined;
97
+ baseCommit?: string | undefined;
98
+ }
53
99
  interface WorkspaceRepo {
54
100
  path: string;
55
101
  name: string;
@@ -96,11 +142,10 @@ declare function dropWorkspace(name: string, options?: DropWorkspaceOptions): Wo
96
142
  declare function isInside(directory: string, path: string): boolean;
97
143
  declare function repoNameFor(workspace: Workspace | null, path: string | undefined): string | null;
98
144
  declare function repoPathFor(workspace: Workspace | null, path: string | undefined | null): string | null;
99
- type WorkspaceOrigin = 'session' | 'option' | 'env' | 'run-directory' | 'repo' | 'none';
145
+ type WorkspaceOrigin = 'session' | 'option' | 'env' | 'run-directory' | 'none';
100
146
  interface WorkspaceResolution {
101
147
  workspace: Workspace | null;
102
148
  origin: WorkspaceOrigin;
103
- repo?: WorkspaceRepo | undefined;
104
149
  }
105
150
  interface ResolveWorkspaceOptions {
106
151
  db?: DatabaseSync | undefined;
@@ -112,7 +157,6 @@ interface ResolveWorkspaceOptions {
112
157
  declare function resolveWorkspace({ db, sessionId, workspace, cwd, env }?: ResolveWorkspaceOptions): WorkspaceResolution;
113
158
  declare function workspaceLabel(workspace: Workspace | null): string;
114
159
  declare function requireWorkspace(workspace: Workspace | null): Workspace;
115
- declare function ambiguousWorkspaceContext(reason: string): string;
116
160
  interface HostSessionPayload {
117
161
  session_id: string;
118
162
  cwd?: string | undefined;
@@ -133,6 +177,11 @@ interface HostSubagentPayload {
133
177
  description?: string | undefined;
134
178
  agent_transcript_path?: string | undefined;
135
179
  }
180
+ interface HostStopPayload {
181
+ session_id: string;
182
+ cwd?: string | undefined;
183
+ failed: boolean;
184
+ }
136
185
  interface HostSessionEndPayload {
137
186
  session_id: string;
138
187
  cwd?: string | undefined;
@@ -143,7 +192,10 @@ interface HostToolPayload {
143
192
  cwd?: string | undefined;
144
193
  tool_name?: string | undefined;
145
194
  agent_id?: string | undefined;
195
+ agent_type?: string | undefined;
146
196
  path?: string | undefined;
197
+ file_path?: string | undefined;
198
+ command?: string | undefined;
147
199
  }
148
200
  interface ResumeCommand {
149
201
  command: string;
@@ -166,6 +218,7 @@ interface Host {
166
218
  sessionIdFromEnvironment(env: NodeJS.ProcessEnv): string | undefined;
167
219
  projectDirectory(env: NodeJS.ProcessEnv): string | undefined;
168
220
  parseSessionPayload(json: string): HostSessionPayload;
221
+ parseStopPayload(json: string): HostStopPayload;
169
222
  parsePromptPayload(json: string): HostPromptPayload;
170
223
  parseSubagentPayload(json: string): HostSubagentPayload;
171
224
  parseSessionEndPayload(json: string): HostSessionEndPayload;
@@ -189,7 +242,7 @@ type SessionKind = 'active' | 'temp';
189
242
  type SessionStatus = 'running' | 'idle' | 'archived';
190
243
  interface Session {
191
244
  id: string;
192
- workspace: string | null;
245
+ workspace: string;
193
246
  name: string | null;
194
247
  purpose: string | null;
195
248
  kind: SessionKind;
@@ -240,41 +293,61 @@ interface MergeResult {
240
293
  movedEvents: number;
241
294
  movedTable: boolean;
242
295
  }
296
+ interface QuestionInput {
297
+ text: string;
298
+ context?: string | undefined;
299
+ recommendation: string;
300
+ alternatives?: readonly string[] | undefined;
301
+ }
302
+ interface Question {
303
+ n: number;
304
+ total: number;
305
+ text: string;
306
+ context: string | null;
307
+ recommendation: string;
308
+ alternatives: string[];
309
+ answer: string | null;
310
+ answeredAt: string | null;
311
+ }
312
+ interface AnswerInput {
313
+ n: number;
314
+ answer: string;
315
+ }
316
+ declare const FINDING_SEVERITIES: readonly ['blocking', 'to_fix', 'suggestion'];
317
+ type FindingSeverity = (typeof FINDING_SEVERITIES)[number];
318
+ declare const FINDING_DECISIONS: readonly ['sent', 'fixed', 'ignored'];
319
+ type FindingDecision = (typeof FINDING_DECISIONS)[number];
320
+ interface FindingInput {
321
+ severity: FindingSeverity;
322
+ location?: string | undefined;
323
+ text: string;
324
+ fix?: string | undefined;
325
+ }
326
+ interface Finding {
327
+ n: number;
328
+ total: number;
329
+ severity: FindingSeverity;
330
+ location: string | null;
331
+ text: string;
332
+ fix: string | null;
333
+ decision: FindingDecision | null;
334
+ reason: string | null;
335
+ }
336
+ interface DecisionInput {
337
+ n: number;
338
+ decision: FindingDecision;
339
+ reason?: string | undefined;
340
+ }
243
341
  interface TableItem {
244
342
  session: string;
245
343
  text: string;
246
344
  status: UserActionStatus | null;
247
- mainWorking: boolean;
248
345
  updatedAt: string;
249
346
  }
250
347
  interface SetTableInput {
251
348
  text: string;
252
- mainWorking?: boolean | undefined;
253
349
  status?: UserActionStatus | undefined;
254
350
  }
255
- declare const EVENT_TYPES: readonly ['started', 'finished', 'answered', 'applied', 'tested', 'committed', 'dropped'];
256
- declare const SESSION_EVENT_TYPES: readonly ['session.started', 'session.resumed', 'session.ended', 'session.forked'];
257
- type AgentEventType = (typeof EVENT_TYPES)[number];
258
- type SessionEventType = (typeof SESSION_EVENT_TYPES)[number];
259
- type EventType = AgentEventType | SessionEventType;
260
- interface CarnetEvent {
261
- id: number;
262
- session: string;
263
- at: string;
264
- type: EventType;
265
- agent: string | null;
266
- commit: string | null;
267
- link: string | null;
268
- note: string | null;
269
- }
270
- interface LogEventInput {
271
- type: EventType;
272
- agent?: string | undefined;
273
- commit?: string | undefined;
274
- link?: string | undefined;
275
- note?: string | undefined;
276
- }
277
- declare function isEventType(value: unknown): value is EventType;
278
351
  declare const NOTE_KINDS: readonly ['dead_end', 'decision', 'learning'];
279
352
  type NoteKind = (typeof NOTE_KINDS)[number];
280
353
  declare const NOTE_TEXT_LIMIT = 200;
@@ -355,22 +428,30 @@ interface NoteActivity {
355
428
  at: string;
356
429
  }
357
430
  declare function sessionNoteActivity(ctx: Ctx, session: string): NoteActivity[];
431
+ declare const TURNS: readonly ['working', 'waiting', 'failed'];
432
+ type Turn = (typeof TURNS)[number];
358
433
  interface StatusLine {
359
434
  name: string;
435
+ kind: AgentKind;
360
436
  status: AgentStatus;
361
437
  emoji: string;
438
+ action: string | null;
362
439
  note: string | null;
363
440
  }
364
441
  interface StatusView {
365
442
  time: string;
366
443
  sessionName: string | null;
367
444
  table: TableItem | null;
445
+ turn: Turn | null;
368
446
  waiting: StatusLine[];
369
447
  running: StatusLine[];
370
448
  notes: NoteActivity[];
371
449
  }
450
+ interface StatusViewOptions {
451
+ kind?: AgentKind | undefined;
452
+ }
372
453
  declare function formatClock(date: Date): string;
373
- declare function buildStatusView(ctx: Ctx, session: Session): StatusView;
454
+ declare function buildStatusView(ctx: Ctx, session: Session, options?: StatusViewOptions): StatusView;
374
455
  declare const MEMORY_MAX_CHARACTERS = 2000;
375
456
  declare function memoryMaxCharacters(value: string | undefined): number;
376
457
  interface MemoryOptions {
@@ -382,9 +463,13 @@ interface MemoryScope {
382
463
  notes: WeightedNote[];
383
464
  }
384
465
  declare function renderMemory(scope: MemoryScope, maxCharacters?: number): string;
385
- declare const MAIN_WORKING_SUFFIX = "(main working, not ready)";
466
+ declare const MAIN_HEADER = "Main";
467
+ declare const MAIN_WORKING_SUFFIX = "(main working)";
468
+ declare const MAIN_WAITING_SUFFIX = "(waiting on you)";
469
+ declare const MAIN_FAILED_SUFFIX = "(turn failed)";
386
470
  declare function renderTableLine(item: TableItem): string;
387
- declare function renderAgentLine(line: StatusLine): string;
471
+ declare function renderMainLine(item: TableItem | null, turn: Turn | null): string | null;
472
+ declare function renderAgentLine(line: StatusLine, nameWidth?: number): string;
388
473
  declare const NOTES_HEADER = "Notes";
389
474
  declare const NOTES_FOLD_LINES = 5;
390
475
  declare const SIMILAR_PREFIX = "similar to ";
@@ -405,6 +490,7 @@ declare class Carnet {
405
490
  readonly db: DatabaseSync;
406
491
  private readonly ctx;
407
492
  constructor(db: DatabaseSync, workspace: Workspace | null, options?: CarnetOptions);
493
+ now(): Date;
408
494
  requireWorkspace(): Workspace;
409
495
  readonly sessions: {
410
496
  get: (id: string) => Session | undefined;
@@ -440,19 +526,39 @@ declare class Carnet {
440
526
  update: (session: string, name: string, input: UpdateAgentInput) => Agent;
441
527
  finish: (session: string, name: string, input: FinishAgentInput) => Agent;
442
528
  drop: (session: string, name: string, reason?: string) => Agent;
529
+ close: (session: string, name: string, event: Omit<LogEventInput, 'agent'>) => Agent;
530
+ promote: (session: string, name: string, input: PromoteAgentInput) => Agent;
443
531
  list: (session: string, options?: ListAgentsOptions) => Agent[];
444
532
  reorderQueue: (session: string, names: string[]) => Agent[];
533
+ byHostAgentId: (session: string, hostAgentId: string) => Agent | undefined;
445
534
  pairSubagent: (session: string, hostAgentId: string) => Agent | undefined;
446
535
  stopSubagent: (session: string, hostAgentId: string, names?: string[]) => Agent | undefined;
447
536
  };
537
+ readonly questions: {
538
+ list: (session: string, agent: string, openOnly?: boolean) => Question[];
539
+ add: (session: string, agent: string, inputs: readonly QuestionInput[]) => Question[];
540
+ answer: (session: string, agent: string, answers: readonly AnswerInput[]) => Question[];
541
+ };
542
+ readonly findings: {
543
+ list: (session: string, agent: string, pendingOnly?: boolean) => Finding[];
544
+ replace: (session: string, agent: string, inputs: readonly FindingInput[]) => Finding[];
545
+ decide: (session: string, agent: string, decisions: readonly DecisionInput[]) => Finding[];
546
+ };
448
547
  readonly table: {
449
548
  get: (session: string) => TableItem | undefined;
450
549
  set: (session: string, input: SetTableInput) => TableItem;
451
550
  clear: (session: string) => void;
452
551
  };
552
+ readonly turn: {
553
+ get: (session: string) => "failed" | "waiting" | "working" | null;
554
+ start: (session: string) => void;
555
+ wait: (session: string) => void;
556
+ fail: (session: string) => void;
557
+ end: (session: string) => void;
558
+ };
453
559
  readonly events: {
454
560
  log: (session: string, input: LogEventInput) => CarnetEvent;
455
- read: (session: string, limit?: number, agentOnly?: boolean) => CarnetEvent[];
561
+ read: (session: string, limit?: number, agentOnly?: boolean, kind?: AgentKind) => CarnetEvent[];
456
562
  };
457
563
  readonly notes: {
458
564
  add: (input: AddNoteInput) => AddNoteResult;
@@ -472,8 +578,8 @@ declare class Carnet {
472
578
  copyRepos: (from: string, into: string) => void;
473
579
  };
474
580
  readonly status: {
475
- view: (session: Session) => StatusView;
476
- render: (session: Session, options?: RenderOptions) => string;
581
+ view: (session: Session, options?: StatusViewOptions) => StatusView;
582
+ render: (session: Session, options?: RenderOptions & StatusViewOptions) => string;
477
583
  sections: (session: Session) => string;
478
584
  };
479
585
  close(): void;
@@ -492,5 +598,5 @@ interface ResolvedCarnet {
492
598
  }
493
599
  declare function openResolvedCarnet(options?: OpenCarnetOptions): ResolvedCarnet;
494
600
  declare function openWorkspaceCarnet(workspace: Workspace | null, options?: OpenCarnetOptions): Carnet;
495
- export { CarnetEvent as $, isWorkspaceName as $t, AddNoteResult as A, ResolveWorkspaceOptions as At, NoteActivityKind as B, AGENTS_FILE as Bt, memoryMaxCharacters as C, HostSessionPayload as Ct, buildStatusView as D, ResumeCommand as Dt, StatusView as E, LaunchOptions as Et, ListNotesOptions as F, repoNameFor as Ft, WeightedNote as G, Workspace as Gt, NoteDetail as H, DropWorkspaceOptions as Ht, NOTE_KINDS as I, repoPathFor as It, memoryHalfLife as J, addWorkspaceRepo as Jt, isNoteKind as K, WorkspaceFile as Kt, NOTE_TEXT_LIMIT as L, requireWorkspace as Lt, DEFAULT_HALF_LIFE_DAYS as M, WorkspaceResolution as Mt, DUPLICATE_SIMILARITY as N, ambiguousWorkspaceContext as Nt, formatClock as O, allHosts as Ot, DropNoteInput as P, isInside as Pt, AgentEventType as Q, expandHome as Qt, Note as R, resolveWorkspace as Rt, MemoryOptions as S, HostSessionEndPayload as St, StatusLine as T, HostToolPayload as Tt, NoteKind as U, INSTRUCTIONS_FILE as Ut, NoteCitation as V, CreateWorkspaceOptions as Vt, STALE_AFTER_ACTIVE_DAYS as W, WORKSPACE_FILE as Wt, similarity as X, definitionInstructions as Xt, sessionNoteActivity as Y, createWorkspace as Yt, workspaceRepoNames as Z, dropWorkspace as Zt, renderNotesSummary as _, OPEN_AGENT_STATUSES as _n, shortId as _t, openCarnet as a, Agent as an, isEventType as at, renderTableLine as b, isAgentStatus as bn, HostPromptPayload as bt, MAIN_WORKING_SUFFIX as c, PUBLISH_FALLBACK_MILLISECONDS as cn, MergeResult as ct, NotesMode as d, UpdateAgentInput as dn, HookSessionPayload as dt, listWorkspaces as en, EVENT_TYPES as et, RenderOptions as f, AGENT_STATUSES as fn, ListSessionsOptions as ft, renderNotes as g, MAIN_WORKING_EMOJI as gn, SessionStatus as gt, renderNoteLine as h, LEGEND as hn, SessionKind as ht, ResolvedCarnet as i, workspaceHosts as in, SessionEventType as it, CiteNoteInput as j, WorkspaceOrigin as jt, AddNoteInput as k, hostById as kt, NOTES_FOLD_LINES as l, REPORTING_NOTE as ln, CreateSessionInput as lt, renderAgentLine as m, EMOJI as mn, Session as mt, CarnetOptions as n, removeWorkspaceRepo as nn, LogEventInput as nt, openResolvedCarnet as o, FinishAgentInput as on, SetTableInput as ot, SIMILAR_PREFIX as p, AgentStatus as pn, MINIMUM_ID_PREFIX as pt, localDay as q, WorkspaceRepo as qt, OpenCarnetOptions as r, workspaceExists as rn, SESSION_EVENT_TYPES as rt, openWorkspaceCarnet as s, ListAgentsOptions as sn, TableItem as st, Carnet as t, loadWorkspace as tn, EventType as tt, NOTES_HEADER as u, StartAgentInput as un, HookEnv as ut, renderSections as v, USER_ACTION_STATUSES as vn, DEFAULT_HOST as vt, renderMemory as w, HostSubagentPayload as wt, MEMORY_MAX_CHARACTERS as x, isUserActionStatus as xn, HostRender as xt, renderStatus as y, UserActionStatus as yn, Host as yt, NoteActivity as z, workspaceLabel as zt };
496
- //# sourceMappingURL=carnet-DHw_oXJs.d.mts.map
601
+ export { isNoteKind as $, listWorkspaces as $t, StatusView as A, AgentEventType as An, ResolveWorkspaceOptions as At, DUPLICATE_SIMILARITY as B, CreateWorkspaceOptions as Bt, renderStatus as C, MAIN_WAITING_EMOJI as Cn, HostStopPayload as Ct, memoryMaxCharacters as D, UserActionStatus as Dn, ResumeCommand as Dt, MemoryOptions as E, USER_ACTION_STATUSES as En, LaunchOptions as Et, Turn as F, SESSION_EVENT_TYPES as Fn, repoPathFor as Ft, Note as G, WorkspaceFile as Gt, ListNotesOptions as H, INSTRUCTIONS_FILE as Ht, AddNoteInput as I, SessionEventType as In, requireWorkspace as It, NoteCitation as J, createWorkspace as Jt, NoteActivity as K, WorkspaceRepo as Kt, AddNoteResult as L, isEventType as Ln, resolveWorkspace as Lt, buildStatusView as M, EVENT_TYPES as Mn, WorkspaceResolution as Mt, formatClock as N, EventType as Nn, isInside as Nt, renderMemory as O, isAgentStatus as On, allHosts as Ot, TURNS as P, LogEventInput as Pn, repoNameFor as Pt, WeightedNote as Q, isWorkspaceName as Qt, CiteNoteInput as R, workspaceLabel as Rt, renderSections as S, MAIN_FAILED_EMOJI as Sn, HostSessionPayload as St, MEMORY_MAX_CHARACTERS as T, OPEN_AGENT_STATUSES as Tn, HostToolPayload as Tt, NOTE_KINDS as U, WORKSPACE_FILE as Ut, DropNoteInput as V, DropWorkspaceOptions as Vt, NOTE_TEXT_LIMIT as W, Workspace as Wt, NoteKind as X, dropWorkspace as Xt, NoteDetail as Y, definitionInstructions as Yt, STALE_AFTER_ACTIVE_DAYS as Z, expandHome as Zt, renderAgentLine as _, AgentStatus as _n, DEFAULT_HOST as _t, openCarnet as a, Agent as an, SetTableInput as at, renderNotes as b, KIND_LEGEND as bn, HostRender as bt, MAIN_FAILED_SUFFIX as c, FinishAgentInput as cn, CreateSessionInput as ct, MAIN_WORKING_SUFFIX as d, REPORTING_NOTE as dn, ListSessionsOptions as dt, loadWorkspace as en, localDay as et, NOTES_FOLD_LINES as f, StartAgentInput as fn, MINIMUM_ID_PREFIX as ft, SIMILAR_PREFIX as g, AGENT_STATUSES as gn, shortId as gt, RenderOptions as h, statusWhenDone as hn, SessionStatus as ht, ResolvedCarnet as i, AGENT_KINDS as in, workspaceRepoNames as it, StatusViewOptions as j, CarnetEvent as jn, WorkspaceOrigin as jt, StatusLine as k, isUserActionStatus as kn, hostById as kt, MAIN_HEADER as l, ListAgentsOptions as ln, HookEnv as lt, NotesMode as m, isAgentKind as mn, SessionKind as mt, CarnetOptions as n, workspaceExists as nn, sessionNoteActivity as nt, openResolvedCarnet as o, AgentKind as on, TableItem as ot, NOTES_HEADER as p, UpdateAgentInput as pn, Session as pt, NoteActivityKind as q, addWorkspaceRepo as qt, OpenCarnetOptions as r, workspaceHosts as rn, similarity as rt, openWorkspaceCarnet as s, DEFAULT_AGENT_KIND as sn, MergeResult as st, Carnet as t, removeWorkspaceRepo as tn, memoryHalfLife as tt, MAIN_WAITING_SUFFIX as u, PUBLISH_FALLBACK_MILLISECONDS as un, HookSessionPayload as ut, renderMainLine as v, EMOJI as vn, Host as vt, renderTableLine as w, MAIN_WORKING_EMOJI as wn, HostSubagentPayload as wt, renderNotesSummary as x, LEGEND as xn, HostSessionEndPayload as xt, renderNoteLine as y, KIND_ABBREVIATIONS as yn, HostPromptPayload as yt, DEFAULT_HALF_LIFE_DAYS as z, AGENTS_FILE as zt };
602
+ //# sourceMappingURL=carnet-jmxAmm-u.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carnet-jmxAmm-u.d.mts","names":["_$__merge_ts0.MergeResult","_$__agents_ts0.Agent","_$__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/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,MAAM;EACN;EACA;EACA;EACA;;iBAqBc,YAAY,iBAAiB,SAAS;cCnEzC;KAYD,sBAAsB;cAErB;KAUD,2BAA2B;cAE1B,OAAO,OAAO,QA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A;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;;UCzBe;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;UCOV;EACf;EACA,MAAM;EACN,QAAQ;EACR;EAEA;EACA;;UAGe;EACf;EACA;EACA,OAAO;EACP,MAAM;EACN,SAAS;EACT,SAAS;EACT,OAAO;;UAGQ;EACf,OAAO;;iBAkFO,YAAY,MAAM;iBAMlB,gBACd,KAAK,KACL,SAAS,SACT,UAAS,oBACR;cChHU;iBAWG,oBAAoB;UAKnB;EACf;EACA;;UAGQ;EACR;EACA,OAAO;;iBAsBO,aAAa,OAAO,aAAa;cC1CpC;cACA;cACA;cACA;iBAEG,gBAAgB,MAAM;iBAUtB,eAAe,MAAM,kBAAkB,MAAM;iBAM7C,gBAAgB,MAAM,YAAY;cAarC;cACA;cAGA;K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AAmB,UAAS,oBAAyB;iBAWrD,oBACd,WAAW,kBACX,UAAS,oBACR"}
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as CarnetEvent, $t as isWorkspaceName, A as AddNoteResult, At as ResolveWorkspaceOptions, B as NoteActivityKind, Bt as AGENTS_FILE, C as memoryMaxCharacters, Ct as HostSessionPayload, D as buildStatusView, Dt as ResumeCommand, E as StatusView, Et as LaunchOptions, F as ListNotesOptions, Ft as repoNameFor, G as WeightedNote, Gt as Workspace, H as NoteDetail, Ht as DropWorkspaceOptions, I as NOTE_KINDS, It as repoPathFor, J as memoryHalfLife, Jt as addWorkspaceRepo, K as isNoteKind, Kt as WorkspaceFile, L as NOTE_TEXT_LIMIT, Lt as requireWorkspace, M as DEFAULT_HALF_LIFE_DAYS, Mt as WorkspaceResolution, N as DUPLICATE_SIMILARITY, Nt as ambiguousWorkspaceContext, O as formatClock, Ot as allHosts, P as DropNoteInput, Pt as isInside, Q as AgentEventType, Qt as expandHome, R as Note, Rt as resolveWorkspace, S as MemoryOptions, St as HostSessionEndPayload, T as StatusLine, Tt as HostToolPayload, U as NoteKind, Ut as INSTRUCTIONS_FILE, V as NoteCitation, Vt as CreateWorkspaceOptions, W as STALE_AFTER_ACTIVE_DAYS, Wt as WORKSPACE_FILE, X as similarity, Xt as definitionInstructions, Y as sessionNoteActivity, Yt as createWorkspace, Z as workspaceRepoNames, Zt as dropWorkspace, _ as renderNotesSummary, _n as OPEN_AGENT_STATUSES, _t as shortId, a as openCarnet, an as Agent, at as isEventType, b as renderTableLine, bn as isAgentStatus, bt as HostPromptPayload, c as MAIN_WORKING_SUFFIX, cn as PUBLISH_FALLBACK_MILLISECONDS, ct as MergeResult, d as NotesMode, dn as UpdateAgentInput, dt as HookSessionPayload, en as listWorkspaces, et as EVENT_TYPES, f as RenderOptions, fn as AGENT_STATUSES, ft as ListSessionsOptions, g as renderNotes, gn as MAIN_WORKING_EMOJI, gt as SessionStatus, h as renderNoteLine, hn as LEGEND, ht as SessionKind, i as ResolvedCarnet, in as workspaceHosts, it as SessionEventType, j as CiteNoteInput, jt as WorkspaceOrigin, k as AddNoteInput, kt as hostById, l as NOTES_FOLD_LINES, ln as REPORTING_NOTE, lt as CreateSessionInput, m as renderAgentLine, mn as EMOJI, mt as Session, n as CarnetOptions, nn as removeWorkspaceRepo, nt as LogEventInput, o as openResolvedCarnet, on as FinishAgentInput, ot as SetTableInput, p as SIMILAR_PREFIX, pn as AgentStatus, pt as MINIMUM_ID_PREFIX, q as localDay, qt as WorkspaceRepo, r as OpenCarnetOptions, rn as workspaceExists, rt as SESSION_EVENT_TYPES, s as openWorkspaceCarnet, sn as ListAgentsOptions, st as TableItem, t as Carnet, tn as loadWorkspace, tt as EventType, u as NOTES_HEADER, un as StartAgentInput, ut as HookEnv, v as renderSections, vn as USER_ACTION_STATUSES, vt as DEFAULT_HOST, w as renderMemory, wt as HostSubagentPayload, x as MEMORY_MAX_CHARACTERS, xn as isUserActionStatus, xt as HostRender, y as renderStatus, yn as UserActionStatus, yt as Host, z as NoteActivity, zt as workspaceLabel } from "./carnet-DHw_oXJs.mjs";
1
+ import { $ as isNoteKind, $t as listWorkspaces, A as StatusView, An as AgentEventType, At as ResolveWorkspaceOptions, B as DUPLICATE_SIMILARITY, Bt as CreateWorkspaceOptions, C as renderStatus, Cn as MAIN_WAITING_EMOJI, Ct as HostStopPayload, D as memoryMaxCharacters, Dn as UserActionStatus, Dt as ResumeCommand, E as MemoryOptions, En as USER_ACTION_STATUSES, Et as LaunchOptions, F as Turn, Fn as SESSION_EVENT_TYPES, Ft as repoPathFor, G as Note, Gt as WorkspaceFile, H as ListNotesOptions, Ht as INSTRUCTIONS_FILE, I as AddNoteInput, In as SessionEventType, It as requireWorkspace, J as NoteCitation, Jt as createWorkspace, K as NoteActivity, Kt as WorkspaceRepo, L as AddNoteResult, Ln as isEventType, Lt as resolveWorkspace, M as buildStatusView, Mn as EVENT_TYPES, Mt as WorkspaceResolution, N as formatClock, Nn as EventType, Nt as isInside, O as renderMemory, On as isAgentStatus, Ot as allHosts, P as TURNS, Pn as LogEventInput, Pt as repoNameFor, Q as WeightedNote, Qt as isWorkspaceName, R as CiteNoteInput, Rt as workspaceLabel, S as renderSections, Sn as MAIN_FAILED_EMOJI, St as HostSessionPayload, T as MEMORY_MAX_CHARACTERS, Tn as OPEN_AGENT_STATUSES, Tt as HostToolPayload, U as NOTE_KINDS, Ut as WORKSPACE_FILE, V as DropNoteInput, Vt as DropWorkspaceOptions, W as NOTE_TEXT_LIMIT, Wt as Workspace, X as NoteKind, Xt as dropWorkspace, Y as NoteDetail, Yt as definitionInstructions, Z as STALE_AFTER_ACTIVE_DAYS, Zt as expandHome, _ as renderAgentLine, _n as AgentStatus, _t as DEFAULT_HOST, a as openCarnet, an as Agent, at as SetTableInput, b as renderNotes, bn as KIND_LEGEND, bt as HostRender, c as MAIN_FAILED_SUFFIX, cn as FinishAgentInput, ct as CreateSessionInput, d as MAIN_WORKING_SUFFIX, dn as REPORTING_NOTE, dt as ListSessionsOptions, en as loadWorkspace, et as localDay, f as NOTES_FOLD_LINES, fn as StartAgentInput, ft as MINIMUM_ID_PREFIX, g as SIMILAR_PREFIX, gn as AGENT_STATUSES, gt as shortId, h as RenderOptions, hn as statusWhenDone, ht as SessionStatus, i as ResolvedCarnet, in as AGENT_KINDS, it as workspaceRepoNames, j as StatusViewOptions, jn as CarnetEvent, jt as WorkspaceOrigin, k as StatusLine, kn as isUserActionStatus, kt as hostById, l as MAIN_HEADER, ln as ListAgentsOptions, lt as HookEnv, m as NotesMode, mn as isAgentKind, mt as SessionKind, n as CarnetOptions, nn as workspaceExists, nt as sessionNoteActivity, o as openResolvedCarnet, on as AgentKind, ot as TableItem, p as NOTES_HEADER, pn as UpdateAgentInput, pt as Session, q as NoteActivityKind, qt as addWorkspaceRepo, r as OpenCarnetOptions, rn as workspaceHosts, rt as similarity, s as openWorkspaceCarnet, sn as DEFAULT_AGENT_KIND, st as MergeResult, t as Carnet, tn as removeWorkspaceRepo, tt as memoryHalfLife, u as MAIN_WAITING_SUFFIX, un as PUBLISH_FALLBACK_MILLISECONDS, ut as HookSessionPayload, v as renderMainLine, vn as EMOJI, vt as Host, w as renderTableLine, wn as MAIN_WORKING_EMOJI, wt as HostSubagentPayload, x as renderNotesSummary, xn as LEGEND, xt as HostSessionEndPayload, y as renderNoteLine, yn as KIND_ABBREVIATIONS, yt as HostPromptPayload, z as DEFAULT_HALF_LIFE_DAYS, zt as AGENTS_FILE } from "./carnet-jmxAmm-u.mjs";
2
2
  import { DatabaseSync } from "node:sqlite";
3
3
  interface MoveOptions {
4
4
  merge?: boolean | undefined;
@@ -14,16 +14,17 @@ interface MoveResult {
14
14
  keptNotes: number;
15
15
  }
16
16
  export declare function moveSession(carnet: Carnet, sessionId: string, targetWorkspace: string, options?: MoveOptions): MoveResult;
17
- export declare function sessionWorkspaceName(db: DatabaseSync, sessionId: string): string | null | undefined;
17
+ export declare function sessionWorkspaceName(db: DatabaseSync, sessionId: string): string | undefined;
18
18
  export declare function archiveWorkspaceSessions(db: DatabaseSync, name: string, at: string): number;
19
19
  export declare function deleteWorkspaceNotes(db: DatabaseSync, name: string): number;
20
20
  export declare function workspaceSessionCounts(db: DatabaseSync): Map<string, number>;
21
+ export declare function workspaceLastActive(db: DatabaseSync): Map<string, string>;
21
22
  export declare const MEMORY_DB = ":memory:";
22
23
  export declare function openDatabase(path: string): DatabaseSync;
23
24
  export declare const migrations: readonly string[];
24
25
  export declare function schemaVersion(db: DatabaseSync): number;
25
26
  export declare function migrate(db: DatabaseSync): void;
26
- type CarnetErrorCode = 'NO_WORKSPACE' | 'WORKSPACE_AMBIGUOUS' | 'WORKSPACE_EXISTS' | 'WORKSPACE_NOT_FOUND' | 'WORKSPACE_NAME_INVALID' | 'REPO_NOT_FOUND' | 'REPO_NAME_TAKEN' | 'NOTE_NOT_FOUND' | 'INVALID_NOTE' | 'UNKNOWN_HOST' | 'NO_SESSION' | 'SESSION_NOT_FOUND' | 'SESSION_AMBIGUOUS' | 'SESSION_NAME_TAKEN' | 'SESSION_NAME_REQUIRED' | 'SESSION_RUNNING' | 'SESSION_KIND_INVALID' | 'SESSION_MERGE_INVALID' | 'SESSION_EXISTS' | 'SESSION_MOVE_INVALID' | 'SESSION_CWD_MISSING' | 'RUN_DIRECTORY_FILE_CONFLICT' | 'WORKSPACE_INSTRUCTIONS_CONFLICT' | 'AGENT_EXISTS' | 'AGENT_NOT_FOUND' | 'INVALID_STATUS' | 'INVALID_EVENT_TYPE' | 'COMMIT_REQUIRED' | 'TABLE_STATUS_WITH_MAIN_WORKING';
27
+ type CarnetErrorCode = 'NO_WORKSPACE' | 'WORKSPACE_EXISTS' | 'WORKSPACE_NOT_FOUND' | 'WORKSPACE_NAME_INVALID' | 'REPO_NOT_FOUND' | 'REPO_NAME_TAKEN' | 'NOTE_NOT_FOUND' | 'INVALID_NOTE' | 'UNKNOWN_HOST' | 'NO_SESSION' | 'SESSION_NOT_FOUND' | 'SESSION_AMBIGUOUS' | 'SESSION_NAME_TAKEN' | 'SESSION_NAME_REQUIRED' | 'SESSION_RUNNING' | 'SESSION_KIND_INVALID' | 'SESSION_MERGE_INVALID' | 'SESSION_EXISTS' | 'SESSION_MOVE_INVALID' | 'SESSION_CWD_MISSING' | 'RUN_DIRECTORY_FILE_CONFLICT' | 'WORKSPACE_INSTRUCTIONS_CONFLICT' | 'AGENT_EXISTS' | 'AGENT_NOT_FOUND' | 'INVALID_TARGET' | 'INVALID_KIND' | 'INVALID_QUESTIONS' | 'QUESTION_NOT_FOUND' | 'FINDING_NOT_FOUND' | 'REASON_REQUIRED' | 'SECTION_NOT_FOUND' | 'REPORT_MISSING' | 'INVALID_STATUS' | 'INVALID_EVENT_TYPE' | 'COMMIT_REQUIRED';
27
28
  export declare class CarnetError extends Error {
28
29
  readonly code: CarnetErrorCode;
29
30
  constructor(code: CarnetErrorCode, message: string);
@@ -44,6 +45,7 @@ export declare function corePromptPath(env?: NodeJS.ProcessEnv): string;
44
45
  export declare function reportsDirectory(workspace: Workspace): string;
45
46
  export declare function reportPath(workspace: Workspace, agentName: string): string;
46
47
  export declare function handleSessionEnd(carnet: Carnet, payload: HostSessionEndPayload): Session | undefined;
48
+ export declare function handleStop(carnet: Carnet, payload: HostStopPayload): void;
47
49
  interface SessionStartResult {
48
50
  session: Session;
49
51
  additionalContext?: string;
@@ -75,10 +77,25 @@ export declare function compactReminder(workspace: Workspace | null, env?: NodeJ
75
77
  export declare function outsideRucherContext(workspace: Workspace | null, env?: NodeJS.ProcessEnv): string;
76
78
  export declare const OUTSIDE_RUCHER_NOTICE = "rucher: session started without rucher, the Rucher rules are not in its system prompt (use rucher new, tmp or resume)";
77
79
  export declare const RULES_UPDATED_NOTICE = "rucher: rules updated, will apply after the next compaction or in a new session";
78
- export declare const SUBAGENT_RULES = "Rucher rules for sub-agents: never commit, push or stash. When your task asks for a report, write it to the file it names. If your prompt names you as a Carnet agent, call agent_update at meaningful progress and agent_done as your last tool action, then reply with one line.";
79
- export declare const CORE_RULES = "- Work can be parallel, review stays sequential: forks work at the same time, the human handles their results one at a time.\n- The human keeps the hand: only the human launches forks, applies, tests and commits. Agents propose, they never push.\n- Status lives in Carnet: agent statuses, the \"On the table\" line and the journal go through the Carnet tools, never into status files nor chat updates. Update before and after each piece of work.\n- When a fork finishes, say only \"<name> finished, report ready\". Never summarise, quote or act on its report or final message until the human asks for that fork's report, even when answering about something else.\n- Forks never commit, push, stash or record notes. A fork writes its report to a file, ending with a Learnings section, calls agent_done as its last tool action, then replies with one line that carries no results, such as \"<name> done, report written\". Only the main agent records notes, at the end of a step.\n- To dispatch, apply or review forks, load the rucher skill: it holds the full workflow.";
80
+ export declare const SUBAGENT_RULES = "Rucher rules for sub-agents: never commit, push or stash. When your task asks for a report, write it to the file it names. If your prompt names you as a Carnet agent, follow the contract of its kind, call agent_update at meaningful progress and agent_done as your last tool action, then reply with one line.";
81
+ export declare const CORE_RULES = "- Work can be parallel, review stays sequential: forks work at the same time, the human handles their results one at a time.\n- The human keeps the hand: only the human launches agents, triggers their final action (inject, validate, apply, triage), applies, tests and commits. Agents propose, they never push.\n- Status lives in Carnet: agent statuses, the Main line and the journal go through the Carnet tools, never into status files nor chat updates. Update before and after each piece of work.\n- When an agent finishes, say only \"<name> finished, report ready\". Never summarise, quote or act on its report or final message until the human asks for that report or its final action, even when answering about something else.\n- Agents never commit, push, stash or record notes. An agent follows its kind's contract, writes its report to a file ending with a Learnings section, calls agent_done as its last tool action, then replies with one line that carries no results, such as \"<name> done, report written\". Only the main agent records notes, at the end of a step.\n- To launch agents or handle their results, load the rucher skill: it holds the full workflow.";
80
82
  export declare function handleUserPromptSubmit(carnet: Carnet, host: Host, payload: HostPromptPayload): Session;
81
83
  export declare function handleToolUse(carnet: Carnet, payload: HostToolPayload, env: HookEnv): string | undefined;
84
+ export declare const WAITING_TOOL = "AskUserQuestion";
85
+ export declare function handleToolStart(carnet: Carnet, payload: HostToolPayload): void;
86
+ export declare function guardSubagentCall(carnet: Carnet, payload: HostToolPayload, scratchRoot: string): string | undefined;
87
+ export declare const GUARDED_TOOLS: Set<string>;
88
+ interface GuardInput {
89
+ kind: AgentKind;
90
+ toolName: string;
91
+ filePath?: string | undefined;
92
+ command?: string | undefined;
93
+ cwd?: string | undefined;
94
+ worktree?: string | null | undefined;
95
+ scratchRoot: string;
96
+ }
97
+ export declare function guardToolCall(input: GuardInput): string | undefined;
98
+ export declare function kindOfAgentType(agentType: string | undefined): AgentKind | undefined;
82
99
  export declare function transcriptTitle(path: string): string | undefined;
83
100
  export declare function workspaceSettings(workspace: Workspace): Record<string, unknown>;
84
101
  export declare const claudeCode: Host;
@@ -124,5 +141,5 @@ export declare function markdownCopy(content: string): string;
124
141
  export declare function removeStaleCopies(directory: string, keep: ReadonlySet<string>): string[];
125
142
  export declare function writeGenerated(path: string, content: string): boolean;
126
143
  export declare function mergeSettings(base: Record<string, unknown>, extra: Record<string, unknown>): Record<string, unknown>;
127
- export { AGENTS_FILE, AGENT_STATUSES, type AddNoteInput, type AddNoteResult, type Agent, type AgentEventType, type AgentStatus, type AgentStep, type AppendPromptFile, type AssembledPrompt, Carnet, type CarnetErrorCode, type CarnetEvent, type CarnetOptions, type CiteNoteInput, type CreateSessionInput, type CreateWorkspaceOptions, DEFAULT_HALF_LIFE_DAYS, DEFAULT_HOST, DUPLICATE_SIMILARITY, type DropNoteInput, type DropWorkspaceOptions, EMOJI, EVENT_TYPES, type EventType, type FinishAgentInput, type HookEnv, type HookSessionPayload, type Host, type HostPromptPayload, type HostRender, type HostSessionEndPayload, type HostSessionPayload, type HostSubagentPayload, type HostToolPayload, INSTRUCTIONS_FILE, LEGEND, type LaunchOptions, type ListAgentsOptions, type ListNotesOptions, type ListSessionsOptions, type LogEventInput, MAIN_WORKING_EMOJI, MAIN_WORKING_SUFFIX, MEMORY_MAX_CHARACTERS, MINIMUM_ID_PREFIX, type MemoryOptions, type MergeResult, type MoveOptions, type MoveResult, NOTES_FOLD_LINES, NOTES_HEADER, NOTE_KINDS, NOTE_TEXT_LIMIT, type Note, type NoteActivity, type NoteActivityKind, type NoteCitation, type NoteDetail, type NoteKind, type NotesMode, type OpenCarnetOptions, PUBLISH_FALLBACK_MILLISECONDS, type PromptSession, REPORTING_NOTE, type RenderOptions, type RenderResult, type ResolveWorkspaceOptions, type ResolvedCarnet, type ResumeCommand, type ResumeContextOptions, type RucherPaths, type RunDirectoryRenderOptions, SESSION_EVENT_TYPES, SIMILAR_PREFIX, STALE_AFTER_ACTIVE_DAYS, type Session, type SessionEventType, type SessionKind, type SessionStartResult, type SessionStatus, type SetTableInput, type StartAgentInput, type StatusLine, type StatusView, type StepAgentInput, type TableItem, USER_ACTION_STATUSES, type UpdateAgentInput, type UserActionStatus, WORKSPACE_FILE, type WeightedNote, type Workspace, type WorkspaceFile, type WorkspaceOrigin, type WorkspaceRepo, type WorkspaceResolution, addWorkspaceRepo, allHosts, ambiguousWorkspaceContext, buildStatusView, createWorkspace, definitionInstructions, dropWorkspace, expandHome, formatClock, hostById, isAgentStatus, isEventType, isInside, isNoteKind, isUserActionStatus, isWorkspaceName, listWorkspaces, loadWorkspace, localDay, memoryHalfLife, memoryMaxCharacters, openCarnet, openResolvedCarnet, openWorkspaceCarnet, removeWorkspaceRepo, renderAgentLine, renderMemory, renderNoteLine, renderNotes, renderNotesSummary, renderSections, renderStatus, renderTableLine, repoNameFor, repoPathFor, requireWorkspace, resolveWorkspace, sessionNoteActivity, shortId, similarity, workspaceExists, workspaceHosts, workspaceLabel, workspaceRepoNames };
144
+ export { AGENTS_FILE, AGENT_KINDS, AGENT_STATUSES, type AddNoteInput, type AddNoteResult, type Agent, type AgentEventType, type AgentKind, type AgentStatus, type AgentStep, type AppendPromptFile, type AssembledPrompt, Carnet, type CarnetErrorCode, type CarnetEvent, type CarnetOptions, type CiteNoteInput, type CreateSessionInput, type CreateWorkspaceOptions, DEFAULT_AGENT_KIND, DEFAULT_HALF_LIFE_DAYS, DEFAULT_HOST, DUPLICATE_SIMILARITY, type DropNoteInput, type DropWorkspaceOptions, EMOJI, EVENT_TYPES, type EventType, type FinishAgentInput, type HookEnv, type HookSessionPayload, type Host, type HostPromptPayload, type HostRender, type HostSessionEndPayload, type HostSessionPayload, type HostSubagentPayload, type HostToolPayload, INSTRUCTIONS_FILE, KIND_ABBREVIATIONS, KIND_LEGEND, LEGEND, type LaunchOptions, type ListAgentsOptions, type ListNotesOptions, type ListSessionsOptions, type LogEventInput, MAIN_FAILED_EMOJI, MAIN_FAILED_SUFFIX, MAIN_HEADER, MAIN_WAITING_EMOJI, MAIN_WAITING_SUFFIX, MAIN_WORKING_EMOJI, MAIN_WORKING_SUFFIX, MEMORY_MAX_CHARACTERS, MINIMUM_ID_PREFIX, type MemoryOptions, type MergeResult, type MoveOptions, type MoveResult, NOTES_FOLD_LINES, NOTES_HEADER, NOTE_KINDS, NOTE_TEXT_LIMIT, type Note, type NoteActivity, type NoteActivityKind, type NoteCitation, type NoteDetail, type NoteKind, type NotesMode, type OpenCarnetOptions, PUBLISH_FALLBACK_MILLISECONDS, type PromptSession, REPORTING_NOTE, type RenderOptions, type RenderResult, type ResolveWorkspaceOptions, type ResolvedCarnet, type ResumeCommand, type ResumeContextOptions, type RucherPaths, type RunDirectoryRenderOptions, SESSION_EVENT_TYPES, SIMILAR_PREFIX, STALE_AFTER_ACTIVE_DAYS, type Session, type SessionEventType, type SessionKind, type SessionStartResult, type SessionStatus, type SetTableInput, type StartAgentInput, type StatusLine, type StatusView, type StatusViewOptions, type StepAgentInput, TURNS, type TableItem, type Turn, USER_ACTION_STATUSES, type UpdateAgentInput, type UserActionStatus, WORKSPACE_FILE, type WeightedNote, type Workspace, type WorkspaceFile, type WorkspaceOrigin, type WorkspaceRepo, type WorkspaceResolution, addWorkspaceRepo, allHosts, buildStatusView, createWorkspace, definitionInstructions, dropWorkspace, expandHome, formatClock, hostById, isAgentKind, isAgentStatus, isEventType, isInside, isNoteKind, isUserActionStatus, isWorkspaceName, listWorkspaces, loadWorkspace, localDay, memoryHalfLife, memoryMaxCharacters, openCarnet, openResolvedCarnet, openWorkspaceCarnet, removeWorkspaceRepo, renderAgentLine, renderMainLine, renderMemory, renderNoteLine, renderNotes, renderNotesSummary, renderSections, renderStatus, renderTableLine, repoNameFor, repoPathFor, requireWorkspace, resolveWorkspace, sessionNoteActivity, shortId, similarity, statusWhenDone, workspaceExists, workspaceHosts, workspaceLabel, workspaceRepoNames };
128
145
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/move.ts","../src/workspace-rows.ts","../src/db/open.ts","../src/db/schema.ts","../src/errors.ts","../src/paths.ts","../src/hook/session-end.ts","../src/hook/session-start.ts","../src/prompt/prompt.ts","../src/prompt/core-rules.ts","../src/hook/user-prompt-submit.ts","../src/hook/post-tool-use.ts","../src/hosts/claude-code.ts","../src/purge.ts","../src/resume.ts","../src/subagents.ts","../src/status/note.ts","../src/steps.ts","../src/render.ts","../src/run-directory-files.ts"],"mapp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AAS,oBACR;wBCDa,cACd,QAAQ,QACR,SAAS,iBACT,KAAK;wBC0FS,gBAAgB;wBA4DhB,kBAAkB,WAAW,YAAY;qBA2D5C,YAAY;qBCzNZ;wBAGG,UAAU;qBCAb;qBACA;UAEI;EACf;EACA;;wBAGc,gBAAgB,OAAO;wBAYvB,aAAa,SAAS;wBAKtB,cACd,QAAQ,QACR,SAAS,WACP,QAAwB,kBAAyC;qBC7BxD;qBACA;qBCLA;wBAWG,aAAa;KCPxB,0BAA0B;qBAElB;KAQD,oBAAoB;UAEf;EACf;EACA,MAAM;EACN;EACA;EACA,OAAO;;wBAkBO,UAAU,QAAQ,QAAQ,iBAAiB,OAAO;UClCjD;EACf;EACA;EACA;;UAGe;EACf,MAAM,OAAO;EACb;;wBAGc,mBACd,WAAW,WACX,UAAS,4BACR;qBCfU;qBAkBA;wBAEG,aAAa;wBAWb,kBAAkB,mBAAmB,MAAM;wBAa3C,eAAe,cAAc;wBAiB7B,cACd,MAAM,yBACN,OAAO,0BACN"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/move.ts","../src/workspace-rows.ts","../src/db/open.ts","../src/db/schema.ts","../src/errors.ts","../src/paths.ts","../src/hook/session-end.ts","../src/hook/session-start.ts","../src/prompt/prompt.ts","../src/prompt/core-rules.ts","../src/hook/user-prompt-submit.ts","../src/hook/post-tool-use.ts","../src/guard.ts","../src/hosts/claude-code.ts","../src/purge.ts","../src/resume.ts","../src/subagents.ts","../src/status/note.ts","../src/steps.ts","../src/render.ts","../src/run-directory-files.ts"],"mappings":";;UAIiB;EACf;EACA;;UAGe;EACf,SAAS;EACT,MAAM;EACN;EACA;EACA;EACA;EACA;;wBAwBc,YACd,QAAQ,QACR,mBACA,yBACA,UAAS,cACR;wBC/Ba,qBAAqB,IAAI,cAAc;wBAOvC,yBAAyB,IAAI,cAAc,cAAc;wBAiBzD,qBAAqB,IAAI,cAAc;wBAIvC,uBAAuB,IAAI,eAAe;wBAU1C,oBAAoB,IAAI,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