@rucher/carnet 0.2.0-beta.8 → 0.2.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,19 +38,19 @@ declare const MAIN_FAILED_EMOJI = "⚠";
38
38
  declare const LEGEND = "⚙️ main working · ⏸ waiting on you · ⚠ turn failed · 💬 discussing · ❓ answer · 👀 review · 📥 apply · 🧪 test · ⏳ running";
39
39
  declare const KIND_ABBREVIATIONS: {
40
40
  readonly research: 'rs';
41
- readonly analyze: 'an';
41
+ readonly plan: 'pl';
42
42
  readonly implement: 'im';
43
43
  readonly review: 'rv';
44
44
  };
45
45
  declare function kindTag(kind: keyof typeof KIND_ABBREVIATIONS): string;
46
46
  declare const KIND_TAG_PATTERN: RegExp;
47
- declare const KIND_LEGEND = "[rs] research · [an] analyze · [im] implement · [rv] review";
47
+ declare const KIND_LEGEND = "[rs] research · [pl] plan · [im] implement · [rv] review";
48
48
  declare function isAgentStatus(value: unknown): value is AgentStatus;
49
49
  declare function isUserActionStatus(value: unknown): value is UserActionStatus;
50
50
  declare const OPEN_AGENT_STATUSES: readonly ["running", "discussing", "answer", "review", "apply", "test"];
51
- declare const AGENT_KINDS: readonly ['research', 'analyze', 'implement', 'review'];
51
+ declare const AGENT_KINDS: readonly ['research', 'plan', 'implement', 'review'];
52
52
  type AgentKind = (typeof AGENT_KINDS)[number];
53
- declare const DEFAULT_AGENT_KIND: AgentKind;
53
+ declare const KIND_REQUIRED = "kind is required: research, plan, implement or review";
54
54
  declare function isAgentKind(value: unknown): value is AgentKind;
55
55
  interface Agent {
56
56
  session: string;
@@ -65,21 +65,25 @@ interface Agent {
65
65
  reportPath: string | null;
66
66
  baseCommit: string | null;
67
67
  worktree: string | null;
68
+ sandbox: string | null;
68
69
  queueOrder: number | null;
69
70
  hostAgentId: string | null;
70
71
  pendingStatus: AgentStatus | null;
71
72
  doneAt: string | null;
72
73
  startedAt: string;
73
74
  updatedAt: string;
75
+ statusSince: string;
74
76
  }
75
77
  interface StartAgentInput {
76
78
  name: string;
77
79
  task: string;
78
- kind?: AgentKind | undefined;
80
+ kind: AgentKind;
79
81
  target?: string | undefined;
80
82
  baseCommit?: string | undefined;
81
83
  worktree?: string | undefined;
84
+ sandbox?: string | undefined;
82
85
  }
86
+ declare const SANDBOX_KINDS: readonly AgentKind[];
83
87
  interface UpdateAgentInput {
84
88
  status: AgentStatus;
85
89
  note?: string | null | undefined;
@@ -97,6 +101,7 @@ declare const REPORTING_NOTE = "reporting";
97
101
  declare const PUBLISH_FALLBACK_MILLISECONDS = 120000;
98
102
  declare function statusWhenDone(kind: AgentKind, hasQuestions: boolean): AgentStatus;
99
103
  interface PromoteAgentInput {
104
+ kind: AgentKind | undefined;
100
105
  worktree?: string | undefined;
101
106
  baseCommit?: string | undefined;
102
107
  }
@@ -200,6 +205,8 @@ interface HostToolPayload {
200
205
  path?: string | undefined;
201
206
  file_path?: string | undefined;
202
207
  command?: string | undefined;
208
+ subagent_type?: string | undefined;
209
+ launched_names?: string[] | undefined;
203
210
  }
204
211
  interface ResumeCommand {
205
212
  command: string;
@@ -447,6 +454,7 @@ interface StatusLine {
447
454
  emoji: string;
448
455
  action: string | null;
449
456
  note: string | null;
457
+ pinned: boolean;
450
458
  }
451
459
  interface StatusView {
452
460
  time: string;
@@ -498,6 +506,9 @@ declare function renderStatus(view: StatusView, options?: RenderOptions): string
498
506
  interface CarnetOptions {
499
507
  now?: () => Date;
500
508
  }
509
+ interface ClosedAgent extends Agent {
510
+ sandboxRemoved: boolean;
511
+ }
501
512
  declare class Carnet {
502
513
  readonly workspace: Workspace | null;
503
514
  readonly db: DatabaseSync;
@@ -534,18 +545,23 @@ declare class Carnet {
534
545
  staleTemp: (olderThanMilliseconds: number) => Session[];
535
546
  resetDead: (isAlive: (processId: number) => boolean) => Session[];
536
547
  };
548
+ private releaseSandbox;
549
+ releaseClosedSandboxes(session?: string): number;
537
550
  readonly agents: {
538
551
  get: (session: string, name: string) => Agent | undefined;
539
552
  start: (session: string, input: StartAgentInput) => Agent;
540
553
  update: (session: string, name: string, input: UpdateAgentInput) => Agent;
541
554
  finish: (session: string, name: string, input: FinishAgentInput) => Agent;
542
- drop: (session: string, name: string, reason?: string) => Agent;
543
- close: (session: string, name: string, event: Omit<LogEventInput, 'agent'>) => Agent;
544
- promote: (session: string, name: string, input: PromoteAgentInput) => Agent;
555
+ drop: (session: string, name: string, reason?: string) => ClosedAgent;
556
+ close: (session: string, name: string, event: Omit<LogEventInput, 'agent'>) => ClosedAgent;
557
+ promote: (session: string, name: string, input: PromoteAgentInput) => ClosedAgent;
545
558
  list: (session: string, options?: ListAgentsOptions) => Agent[];
546
559
  reorderQueue: (session: string, names: string[]) => Agent[];
547
560
  byHostAgentId: (session: string, hostAgentId: string) => Agent | undefined;
548
- pairSubagent: (session: string, hostAgentId: string) => Agent | undefined;
561
+ pairSubagent: (session: string, hostAgentId: string, names?: readonly string[]) => Agent | undefined;
562
+ unpaired: (session: string, names: readonly string[]) => Agent | undefined;
563
+ pendingPlan: (session: string) => Agent | undefined;
564
+ requestLaunch: (session: string, name: string) => void;
549
565
  stopSubagent: (session: string, hostAgentId: string, names?: string[]) => Agent | undefined;
550
566
  };
551
567
  readonly questions: {
@@ -612,5 +628,5 @@ interface ResolvedCarnet {
612
628
  }
613
629
  declare function openResolvedCarnet(options?: OpenCarnetOptions): ResolvedCarnet;
614
630
  declare function openWorkspaceCarnet(workspace: Workspace | null, options?: OpenCarnetOptions): Carnet;
615
- export { NoteKind as $, dropWorkspace as $t, renderMemory as A, USER_ACTION_STATUSES as An, ResumeCommand as At, AddNoteResult as B, SESSION_EVENT_TYPES as Bn, resolveWorkspace as Bt, renderNotesSummary as C, KIND_LEGEND as Cn, HostRender as Ct, MEMORY_MAX_CHARACTERS as D, MAIN_WAITING_EMOJI as Dn, HostSubagentPayload as Dt, renderTableLine as E, MAIN_FAILED_EMOJI as En, HostStopPayload as Et, formatClock as F, AgentEventType as Fn, WorkspaceResolution as Ft, ListNotesOptions as G, INSTRUCTIONS_FILE as Gt, DEFAULT_HALF_LIFE_DAYS as H, isEventType as Hn, AGENTS_FILE as Ht, TURNS as I, CarnetEvent as In, isInside as It, Note as J, WorkspaceFile as Jt, NOTE_KINDS as K, WORKSPACE_FILE as Kt, Turn as L, EVENT_TYPES as Ln, repoNameFor as Lt, StatusView as M, isAgentStatus as Mn, hostById as Mt, StatusViewOptions as N, isUserActionStatus as Nn, ResolveWorkspaceOptions as Nt, MemoryOptions as O, MAIN_WORKING_EMOJI as On, HostToolPayload as Ot, buildStatusView as P, kindTag as Pn, WorkspaceOrigin as Pt, NoteDetail as Q, definitionInstructions as Qt, TurnOptions as R, EventType as Rn, repoPathFor as Rt, renderNotes as S, KIND_ABBREVIATIONS as Sn, HostPromptPayload as St, renderStatus as T, LEGEND as Tn, HostSessionPayload as Tt, DUPLICATE_SIMILARITY as U, CreateWorkspaceOptions as Ut, CiteNoteInput as V, SessionEventType as Vn, workspaceLabel as Vt, DropNoteInput as W, DropWorkspaceOptions as Wt, NoteActivityKind as X, addWorkspaceRepo as Xt, NoteActivity as Y, WorkspaceRepo as Yt, NoteCitation as Z, createWorkspace as Zt, RenderOptions as _, isAgentKind as _n, SessionKind as _t, openCarnet as a, workspaceExists as an, sessionNoteActivity as at, renderMainLine as b, AgentStatus as bn, DEFAULT_HOST as bt, BLOCKED_HEADER as c, Agent as cn, SetTableInput as ct, MAIN_IDLE as d, FinishAgentInput as dn, CreateSessionInput as dt, expandHome as en, STALE_AFTER_ACTIVE_DAYS as et, MAIN_WAITING_SUFFIX as f, ListAgentsOptions as fn, HookEnv as ft, NotesMode as g, UpdateAgentInput as gn, Session as gt, NOTES_HEADER as h, StartAgentInput as hn, MINIMUM_ID_PREFIX as ht, ResolvedCarnet as i, removeWorkspaceRepo as in, memoryHalfLife as it, StatusLine as j, UserActionStatus as jn, allHosts as jt, memoryMaxCharacters as k, OPEN_AGENT_STATUSES as kn, LaunchOptions as kt, MAIN_FAILED_SUFFIX as l, AgentKind as ln, TableItem as lt, NOTES_FOLD_LINES as m, REPORTING_NOTE as mn, ListSessionsOptions as mt, CarnetOptions as n, listWorkspaces as nn, isNoteKind as nt, openResolvedCarnet as o, workspaceHosts as on, similarity as ot, MAIN_WORKING_SUFFIX as p, PUBLISH_FALLBACK_MILLISECONDS as pn, HookSessionPayload as pt, NOTE_TEXT_LIMIT as q, Workspace as qt, OpenCarnetOptions as r, loadWorkspace as rn, localDay as rt, openWorkspaceCarnet as s, AGENT_KINDS as sn, workspaceRepoNames as st, Carnet as t, isWorkspaceName as tn, WeightedNote as tt, MAIN_HEADER as u, DEFAULT_AGENT_KIND as un, MergeResult as ut, SIMILAR_PREFIX as v, statusWhenDone as vn, SessionStatus as vt, renderSections as w, KIND_TAG_PATTERN as wn, HostSessionEndPayload as wt, renderNoteLine as x, EMOJI as xn, Host as xt, renderAgentLine as y, AGENT_STATUSES as yn, shortId as yt, AddNoteInput as z, LogEventInput as zn, requireWorkspace as zt };
616
- //# sourceMappingURL=carnet-MC9WeQ6h.d.mts.map
631
+ export { NoteDetail as $, definitionInstructions as $t, memoryMaxCharacters as A, MAIN_WORKING_EMOJI as An, LaunchOptions as At, AddNoteInput as B, EventType as Bn, requireWorkspace as Bt, renderNotes as C, EMOJI as Cn, HostPromptPayload as Ct, renderTableLine as D, LEGEND as Dn, HostStopPayload as Dt, renderStatus as E, KIND_TAG_PATTERN as En, HostSessionPayload as Et, buildStatusView as F, isUserActionStatus as Fn, WorkspaceOrigin as Ft, DropNoteInput as G, DropWorkspaceOptions as Gt, CiteNoteInput as H, SESSION_EVENT_TYPES as Hn, workspaceLabel as Ht, formatClock as I, kindTag as In, WorkspaceResolution as It, NOTE_TEXT_LIMIT as J, Workspace as Jt, ListNotesOptions as K, INSTRUCTIONS_FILE as Kt, TURNS as L, AgentEventType as Ln, isInside as Lt, StatusLine as M, USER_ACTION_STATUSES as Mn, allHosts as Mt, StatusView as N, UserActionStatus as Nn, hostById as Nt, MEMORY_MAX_CHARACTERS as O, MAIN_FAILED_EMOJI as On, HostSubagentPayload as Ot, StatusViewOptions as P, isAgentStatus as Pn, ResolveWorkspaceOptions as Pt, NoteCitation as Q, createWorkspace as Qt, Turn as R, CarnetEvent as Rn, repoNameFor as Rt, renderNoteLine as S, AgentStatus as Sn, Host as St, renderSections as T, KIND_LEGEND as Tn, HostSessionEndPayload as Tt, DEFAULT_HALF_LIFE_DAYS as U, SessionEventType as Un, AGENTS_FILE as Ut, AddNoteResult as V, LogEventInput as Vn, resolveWorkspace as Vt, DUPLICATE_SIMILARITY as W, isEventType as Wn, CreateWorkspaceOptions as Wt, NoteActivity as X, WorkspaceRepo as Xt, Note as Y, WorkspaceFile as Yt, NoteActivityKind as Z, addWorkspaceRepo as Zt, NotesMode as _, StartAgentInput as _n, Session as _t, ResolvedCarnet as a, removeWorkspaceRepo as an, memoryHalfLife as at, renderAgentLine as b, statusWhenDone as bn, shortId as bt, openWorkspaceCarnet as c, AGENT_KINDS as cn, workspaceRepoNames as ct, MAIN_HEADER as d, FinishAgentInput as dn, MergeResult as dt, dropWorkspace as en, NoteKind as et, MAIN_IDLE as f, KIND_REQUIRED as fn, CreateSessionInput as ft, NOTES_HEADER as g, SANDBOX_KINDS as gn, MINIMUM_ID_PREFIX as gt, NOTES_FOLD_LINES as h, REPORTING_NOTE as hn, ListSessionsOptions as ht, OpenCarnetOptions as i, loadWorkspace as in, localDay as it, renderMemory as j, OPEN_AGENT_STATUSES as jn, ResumeCommand as jt, MemoryOptions as k, MAIN_WAITING_EMOJI as kn, HostToolPayload as kt, BLOCKED_HEADER as l, Agent as ln, SetTableInput as lt, MAIN_WORKING_SUFFIX as m, PUBLISH_FALLBACK_MILLISECONDS as mn, HookSessionPayload as mt, CarnetOptions as n, isWorkspaceName as nn, WeightedNote as nt, openCarnet as o, workspaceExists as on, sessionNoteActivity as ot, MAIN_WAITING_SUFFIX as p, ListAgentsOptions as pn, HookEnv as pt, NOTE_KINDS as q, WORKSPACE_FILE as qt, ClosedAgent as r, listWorkspaces as rn, isNoteKind as rt, openResolvedCarnet as s, workspaceHosts as sn, similarity as st, Carnet as t, expandHome as tn, STALE_AFTER_ACTIVE_DAYS as tt, MAIN_FAILED_SUFFIX as u, AgentKind as un, TableItem as ut, RenderOptions as v, UpdateAgentInput as vn, SessionKind as vt, renderNotesSummary as w, KIND_ABBREVIATIONS as wn, HostRender as wt, renderMainLine as x, AGENT_STATUSES as xn, DEFAULT_HOST as xt, SIMILAR_PREFIX as y, isAgentKind as yn, SessionStatus as yt, TurnOptions as z, EVENT_TYPES as zn, repoPathFor as zt };
632
+ //# sourceMappingURL=carnet-DcHESFRd.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carnet-DcHESFRd.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/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;KAUD,sBAAsB;cAErB;KAED,2BAA2B;cAE1B,OAAO,OAAO,QAAQ;cAStB;cACA;cACA;cAEA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cA+QW;iBAEG,QAAQ;UC3VP;EACf,SAAS;EACT;EACA;EACA;EACA;;UCJe;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;;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;UAEV;EAEf;;UCGe;EACf;EACA,MAAM;EACN,QAAQ;EACR;EAEA;EACA;EACA;;UAGe;EACf;EACA;EACA,OAAO;EACP,MAAM;EACN,SAAS;EACT,SAAS;EACT,SAAS;EACT,OAAO;;UAGQ;EACf,OAAO;;iBAwFO,YAAY,MAAM;iBAMlB,gBACd,KAAK,KACL,SAAS,SACT,UAAS,oBACR;cCxHU;iBAWG,oBAAoB;UAKnB;EACf;EACA;;UAGQ;EACR;EACA,OAAO;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AY,SAAO,UAAY;IAExC,UAAO,SAAY,SAAO,cAAc,UAAY;IAEpD,YAAS,cAAe;;WAGjB;IACP,OAAI,SAAY,SAAO,UAAY,sBAAAC;IAEnC,SAAM,SAAY,SAAO,UAAY,gBAAgB;IAErD,WAAQ,SAAY;;EAGtB;;UAKe,0BAA0B;EACzC;EACA;EACA;EACA,MAAM,OAAO;EACb;;iBASc,WAAW,UAAS,oBAAyB;UAI5C;EACf,QAAQ;EACR,YAAY;;iBAGE,mBAAmB,UAAS,oBAAyB;iBAWrD,oBACd,WAAW,kBACX,UAAS,oBACR"}
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as NoteKind, $t as dropWorkspace, A as renderMemory, An as USER_ACTION_STATUSES, At as ResumeCommand, B as AddNoteResult, Bn as SESSION_EVENT_TYPES, Bt as resolveWorkspace, C as renderNotesSummary, Cn as KIND_LEGEND, Ct as HostRender, D as MEMORY_MAX_CHARACTERS, Dn as MAIN_WAITING_EMOJI, Dt as HostSubagentPayload, E as renderTableLine, En as MAIN_FAILED_EMOJI, Et as HostStopPayload, F as formatClock, Fn as AgentEventType, Ft as WorkspaceResolution, G as ListNotesOptions, Gt as INSTRUCTIONS_FILE, H as DEFAULT_HALF_LIFE_DAYS, Hn as isEventType, Ht as AGENTS_FILE, I as TURNS, In as CarnetEvent, It as isInside, J as Note, Jt as WorkspaceFile, K as NOTE_KINDS, Kt as WORKSPACE_FILE, L as Turn, Ln as EVENT_TYPES, Lt as repoNameFor, M as StatusView, Mn as isAgentStatus, Mt as hostById, N as StatusViewOptions, Nn as isUserActionStatus, Nt as ResolveWorkspaceOptions, O as MemoryOptions, On as MAIN_WORKING_EMOJI, Ot as HostToolPayload, P as buildStatusView, Pn as kindTag, Pt as WorkspaceOrigin, Q as NoteDetail, Qt as definitionInstructions, R as TurnOptions, Rn as EventType, Rt as repoPathFor, S as renderNotes, Sn as KIND_ABBREVIATIONS, St as HostPromptPayload, T as renderStatus, Tn as LEGEND, Tt as HostSessionPayload, U as DUPLICATE_SIMILARITY, Ut as CreateWorkspaceOptions, V as CiteNoteInput, Vn as SessionEventType, Vt as workspaceLabel, W as DropNoteInput, Wt as DropWorkspaceOptions, X as NoteActivityKind, Xt as addWorkspaceRepo, Y as NoteActivity, Yt as WorkspaceRepo, Z as NoteCitation, Zt as createWorkspace, _ as RenderOptions, _n as isAgentKind, _t as SessionKind, a as openCarnet, an as workspaceExists, at as sessionNoteActivity, b as renderMainLine, bn as AgentStatus, bt as DEFAULT_HOST, c as BLOCKED_HEADER, cn as Agent, ct as SetTableInput, d as MAIN_IDLE, dn as FinishAgentInput, dt as CreateSessionInput, en as expandHome, et as STALE_AFTER_ACTIVE_DAYS, f as MAIN_WAITING_SUFFIX, fn as ListAgentsOptions, ft as HookEnv, g as NotesMode, gn as UpdateAgentInput, gt as Session, h as NOTES_HEADER, hn as StartAgentInput, ht as MINIMUM_ID_PREFIX, i as ResolvedCarnet, in as removeWorkspaceRepo, it as memoryHalfLife, j as StatusLine, jn as UserActionStatus, jt as allHosts, k as memoryMaxCharacters, kn as OPEN_AGENT_STATUSES, kt as LaunchOptions, l as MAIN_FAILED_SUFFIX, ln as AgentKind, lt as TableItem, m as NOTES_FOLD_LINES, mn as REPORTING_NOTE, mt as ListSessionsOptions, n as CarnetOptions, nn as listWorkspaces, nt as isNoteKind, o as openResolvedCarnet, on as workspaceHosts, ot as similarity, p as MAIN_WORKING_SUFFIX, pn as PUBLISH_FALLBACK_MILLISECONDS, pt as HookSessionPayload, q as NOTE_TEXT_LIMIT, qt as Workspace, r as OpenCarnetOptions, rn as loadWorkspace, rt as localDay, s as openWorkspaceCarnet, sn as AGENT_KINDS, st as workspaceRepoNames, t as Carnet, tn as isWorkspaceName, tt as WeightedNote, u as MAIN_HEADER, un as DEFAULT_AGENT_KIND, ut as MergeResult, v as SIMILAR_PREFIX, vn as statusWhenDone, vt as SessionStatus, w as renderSections, wn as KIND_TAG_PATTERN, wt as HostSessionEndPayload, x as renderNoteLine, xn as EMOJI, xt as Host, y as renderAgentLine, yn as AGENT_STATUSES, yt as shortId, z as AddNoteInput, zn as LogEventInput, zt as requireWorkspace } from "./carnet-MC9WeQ6h.mjs";
1
+ import { $ as NoteDetail, $t as definitionInstructions, A as memoryMaxCharacters, An as MAIN_WORKING_EMOJI, At as LaunchOptions, B as AddNoteInput, Bn as EventType, Bt as requireWorkspace, C as renderNotes, Cn as EMOJI, Ct as HostPromptPayload, D as renderTableLine, Dn as LEGEND, Dt as HostStopPayload, E as renderStatus, En as KIND_TAG_PATTERN, Et as HostSessionPayload, F as buildStatusView, Fn as isUserActionStatus, Ft as WorkspaceOrigin, G as DropNoteInput, Gt as DropWorkspaceOptions, H as CiteNoteInput, Hn as SESSION_EVENT_TYPES, Ht as workspaceLabel, I as formatClock, In as kindTag, It as WorkspaceResolution, J as NOTE_TEXT_LIMIT, Jt as Workspace, K as ListNotesOptions, Kt as INSTRUCTIONS_FILE, L as TURNS, Ln as AgentEventType, Lt as isInside, M as StatusLine, Mn as USER_ACTION_STATUSES, Mt as allHosts, N as StatusView, Nn as UserActionStatus, Nt as hostById, O as MEMORY_MAX_CHARACTERS, On as MAIN_FAILED_EMOJI, Ot as HostSubagentPayload, P as StatusViewOptions, Pn as isAgentStatus, Pt as ResolveWorkspaceOptions, Q as NoteCitation, Qt as createWorkspace, R as Turn, Rn as CarnetEvent, Rt as repoNameFor, S as renderNoteLine, Sn as AgentStatus, St as Host, T as renderSections, Tn as KIND_LEGEND, Tt as HostSessionEndPayload, U as DEFAULT_HALF_LIFE_DAYS, Un as SessionEventType, Ut as AGENTS_FILE, V as AddNoteResult, Vn as LogEventInput, Vt as resolveWorkspace, W as DUPLICATE_SIMILARITY, Wn as isEventType, Wt as CreateWorkspaceOptions, X as NoteActivity, Xt as WorkspaceRepo, Y as Note, Yt as WorkspaceFile, Z as NoteActivityKind, Zt as addWorkspaceRepo, _ as NotesMode, _n as StartAgentInput, _t as Session, a as ResolvedCarnet, an as removeWorkspaceRepo, at as memoryHalfLife, b as renderAgentLine, bn as statusWhenDone, bt as shortId, c as openWorkspaceCarnet, cn as AGENT_KINDS, ct as workspaceRepoNames, d as MAIN_HEADER, dn as FinishAgentInput, dt as MergeResult, en as dropWorkspace, et as NoteKind, f as MAIN_IDLE, fn as KIND_REQUIRED, ft as CreateSessionInput, g as NOTES_HEADER, gn as SANDBOX_KINDS, gt as MINIMUM_ID_PREFIX, h as NOTES_FOLD_LINES, hn as REPORTING_NOTE, ht as ListSessionsOptions, i as OpenCarnetOptions, in as loadWorkspace, it as localDay, j as renderMemory, jn as OPEN_AGENT_STATUSES, jt as ResumeCommand, k as MemoryOptions, kn as MAIN_WAITING_EMOJI, kt as HostToolPayload, l as BLOCKED_HEADER, ln as Agent, lt as SetTableInput, m as MAIN_WORKING_SUFFIX, mn as PUBLISH_FALLBACK_MILLISECONDS, mt as HookSessionPayload, n as CarnetOptions, nn as isWorkspaceName, nt as WeightedNote, o as openCarnet, on as workspaceExists, ot as sessionNoteActivity, p as MAIN_WAITING_SUFFIX, pn as ListAgentsOptions, pt as HookEnv, q as NOTE_KINDS, qt as WORKSPACE_FILE, r as ClosedAgent, rn as listWorkspaces, rt as isNoteKind, s as openResolvedCarnet, sn as workspaceHosts, st as similarity, t as Carnet, tn as expandHome, tt as STALE_AFTER_ACTIVE_DAYS, u as MAIN_FAILED_SUFFIX, un as AgentKind, ut as TableItem, v as RenderOptions, vn as UpdateAgentInput, vt as SessionKind, w as renderNotesSummary, wn as KIND_ABBREVIATIONS, wt as HostRender, x as renderMainLine, xn as AGENT_STATUSES, xt as DEFAULT_HOST, y as SIMILAR_PREFIX, yn as isAgentKind, yt as SessionStatus, z as TurnOptions, zn as EVENT_TYPES, zt as repoPathFor } from "./carnet-DcHESFRd.mjs";
2
2
  import { DatabaseSync } from "node:sqlite";
3
3
  interface MoveOptions {
4
4
  merge?: boolean | undefined;
@@ -24,7 +24,7 @@ export declare function openDatabase(path: string): DatabaseSync;
24
24
  export declare const migrations: readonly string[];
25
25
  export declare function schemaVersion(db: DatabaseSync): number;
26
26
  export declare function migrate(db: DatabaseSync): void;
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_BLOCKER' | '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
+ 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_BLOCKER' | 'INVALID_KIND' | 'INVALID_SANDBOX' | 'INVALID_QUESTIONS' | 'QUESTION_NOT_FOUND' | 'FINDING_NOT_FOUND' | 'REASON_REQUIRED' | 'SECTION_NOT_FOUND' | 'REPORT_MISSING' | 'INVALID_STATUS' | 'INVALID_EVENT_TYPE' | 'COMMIT_REQUIRED';
28
28
  export declare class CarnetError extends Error {
29
29
  readonly code: CarnetErrorCode;
30
30
  constructor(code: CarnetErrorCode, message: string);
@@ -43,6 +43,7 @@ export declare function defaultRunDirectory(name: string, env?: NodeJS.ProcessEn
43
43
  export declare function promptsDirectory(env?: NodeJS.ProcessEnv): string;
44
44
  export declare function corePromptPath(env?: NodeJS.ProcessEnv): string;
45
45
  export declare function reportsDirectory(workspace: Workspace): string;
46
+ export declare function sandboxesDirectory(workspace: Workspace): string;
46
47
  export declare function reportPath(workspace: Workspace, agentName: string): string;
47
48
  export declare function handleSessionEnd(carnet: Carnet, payload: HostSessionEndPayload): Session | undefined;
48
49
  export declare function handleStop(carnet: Carnet, payload: HostStopPayload): void;
@@ -78,12 +79,13 @@ export declare function outsideRucherContext(workspace: Workspace | null, env?:
78
79
  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)";
79
80
  export declare const RULES_UPDATED_NOTICE = "rucher: rules updated, will apply after the next compaction or in a new session";
80
81
  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.";
82
+ 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, asks for their report and its next 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 (/rucher:report), 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.";
82
83
  export declare function handleUserPromptSubmit(carnet: Carnet, host: Host, payload: HostPromptPayload, options?: TurnOptions): Session;
83
84
  export declare function handleToolUse(carnet: Carnet, payload: HostToolPayload, env: HookEnv, options?: TurnOptions): string | undefined;
84
85
  export declare const WAITING_TOOL = "AskUserQuestion";
85
86
  export declare function handleToolStart(carnet: Carnet, payload: HostToolPayload): void;
86
87
  export declare function guardSubagentCall(carnet: Carnet, payload: HostToolPayload, scratchRoot: string): string | undefined;
88
+ export declare function guardMainLaunch(carnet: Carnet, payload: HostToolPayload): string | undefined;
87
89
  export declare const GUARDED_TOOLS: Set<string>;
88
90
  interface GuardInput {
89
91
  kind: AgentKind;
@@ -92,10 +94,20 @@ interface GuardInput {
92
94
  command?: string | undefined;
93
95
  cwd?: string | undefined;
94
96
  worktree?: string | null | undefined;
97
+ sandbox?: string | null | undefined;
95
98
  scratchRoot: string;
96
99
  }
97
100
  export declare function guardToolCall(input: GuardInput): string | undefined;
98
101
  export declare function kindOfAgentType(agentType: string | undefined): AgentKind | undefined;
102
+ export declare const LAUNCH_TOOLS: ReadonlySet<string>;
103
+ export declare const BUILT_IN_PLAN_DENIED = "In a Rucher session a plan agent is a Rucher fork, never the built-in Plan subagent: use /rucher:start:plan (agent_start with kind plan, then Agent with subagent_type fork and the agent name as description). For a question with no change, use /rucher:start:research.";
104
+ interface LaunchCall {
105
+ toolName: string;
106
+ subagentType?: string | undefined;
107
+ named?: Agent | undefined;
108
+ pendingPlan?: Agent | undefined;
109
+ }
110
+ export declare function guardLaunch(call: LaunchCall): string | undefined;
99
111
  export declare function transcriptTitle(path: string): string | undefined;
100
112
  export declare function workspaceSettings(workspace: Workspace): Record<string, unknown>;
101
113
  export declare const claudeCode: Host;
@@ -116,6 +128,7 @@ export declare const NOTE_MAX = 60;
116
128
  export declare function sanitizeNote(text: string): string;
117
129
  export declare const STATUS_LINE_LABEL = "rucher";
118
130
  export declare function renderStatusLine(view: StatusView, lag?: string | null): string;
131
+ export declare function labelStatusLine(line: string): string;
119
132
  export declare function statusLinePath(sessionId: string, env?: NodeJS.ProcessEnv): string;
120
133
  interface StatusLineOptions {
121
134
  env?: NodeJS.ProcessEnv | undefined;
@@ -149,5 +162,5 @@ export declare function markdownCopy(content: string): string;
149
162
  export declare function removeStaleCopies(directory: string, keep: ReadonlySet<string>): string[];
150
163
  export declare function writeGenerated(path: string, content: string): boolean;
151
164
  export declare function mergeSettings(base: Record<string, unknown>, extra: Record<string, unknown>): Record<string, unknown>;
152
- 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, BLOCKED_HEADER, 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, KIND_TAG_PATTERN, LEGEND, type LaunchOptions, type ListAgentsOptions, type ListNotesOptions, type ListSessionsOptions, type LogEventInput, MAIN_FAILED_EMOJI, MAIN_FAILED_SUFFIX, MAIN_HEADER, MAIN_IDLE, 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 StatusLineOptions, type StatusView, type StatusViewOptions, type StepAgentInput, TURNS, type TableItem, type Turn, type TurnOptions, 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, kindTag, 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 };
165
+ 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, BLOCKED_HEADER, Carnet, type CarnetErrorCode, type CarnetEvent, type CarnetOptions, type CiteNoteInput, type ClosedAgent, 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, KIND_ABBREVIATIONS, KIND_LEGEND, KIND_REQUIRED, KIND_TAG_PATTERN, LEGEND, type LaunchOptions, type ListAgentsOptions, type ListNotesOptions, type ListSessionsOptions, type LogEventInput, MAIN_FAILED_EMOJI, MAIN_FAILED_SUFFIX, MAIN_HEADER, MAIN_IDLE, 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, SANDBOX_KINDS, 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 StatusLineOptions, type StatusView, type StatusViewOptions, type StepAgentInput, TURNS, type TableItem, type Turn, type TurnOptions, 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, kindTag, 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 };
153
166
  //# 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/guard.ts","../src/hosts/claude-code.ts","../src/purge.ts","../src/resume.ts","../src/subagents.ts","../src/status/note.ts","../src/status/line.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,eAAe;qBCjD1C;wBAEG,aAAa,eAAe;qBCQ/B;wBAwYG,cAAc,IAAI;wBASlB,QAAQ,IAAI;KC9ZhB;qBAsCC,oBAAoB;WAEpB,MAAM;EADjB,YACW,MAAM,iBACf;;UCrCa;EACf;EACA;EACA;EACA;;wBAQc,YAAY,MAAK,OAAO,aAA2B;wBAuBnD,aAAa,MAAM,OAAO;wBAI1B,oBAAoB,MAAM,OAAO;wBAIjC,oBAAoB,cAAc,MAAM,OAAO;wBAI/C,oBAAoB,cAAc,MAAM,OAAO;wBAI/C,iBAAiB,MAAM,OAAO;wBAI9B,eAAe,MAAM,OAAO;wBAI5B,iBAAiB,WAAW;wBAI5B,WAAW,WAAW,WAAW;wBC/DjC,iBACd,QAAQ,QACR,SAAS,wBACR;wBAOa,WAAW,QAAQ,QAAQ,SAAS;UCEnC;EACf,SAAS;EACT;EACA;EACA;;wBAoDc,mBACd,QAAQ,QACR,SAAS,oBACT,KAAK,UACJ;qBCpEU;UAEI;EACf;EACA;EACA,MAAM;;UAGS;EACf;EACA;;UAGe;EACf;EACA;;wBASc,UAAU,MAAK,OAAO;wBAItB,eAAe,WAAW;wBA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AAM;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/launch.ts","../src/hosts/claude-code.ts","../src/purge.ts","../src/resume.ts","../src/subagents.ts","../src/status/note.ts","../src/status/line.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,eAAe;qBCjD1C;wBAEG,aAAa,eAAe;qBCQ/B;wBAybG,cAAc,IAAI;wBASlB,QAAQ,IAAI;KC/chB;qBAuCC,oBAAoB;WAEpB,MAAM;EADjB,YACW,MAAM,iBACf;;UCtCa;EACf;EACA;EACA;EACA;;wBAQc,YAAY,MAAK,OAAO,aAA2B;wBAuBnD,aAAa,MAAM,OAAO;wBAI1B,oBAAoB,MAAM,OAAO;wBAIjC,oBAAoB,cAAc,MAAM,OAAO;wBAI/C,oBAAoB,cAAc,MAAM,OAAO;wBAI/C,iBAAiB,MAAM,OAAO;wBAI9B,eAAe,MAAM,OAAO;wBAI5B,iBAAiB,WAAW;wBAI5B,mBAAmB,WAAW;wBAI9B,WAAW,WAAW,WAAW;wBCnEjC,iBACd,QAAQ,QACR,SAAS,wBACR;wBAOa,WAAW,QAAQ,QAAQ,SAAS;UCEnC;E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AO;UAI9C;EACf,MAAM,OAAO;EACb;;wBAKc,gBACd,QAAQ,QACR,mBACA,UAAS;KCjDN,0BAA0B;qBAElB;KAQD,oBAAoB;UAEf;EACf;EACA,MAAM;EACN;EACA;EACA,OAAO;;wBAYO,UAAU,QAAQ,QAAQ,iBAAiB,OAAO;UC/BjD;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"}
package/dist/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
- import { $ as requireWorkspace, $t as corePromptPath, A as renderNotesSummary, An as MAIN_FAILED_EMOJI, At as workspaceRules, B as DUPLICATE_SIMILARITY, Bn as isEventType, Bt as dropWorkspace, C as NOTES_FOLD_LINES, Cn as sanitizeNote, Ct as appendPromptFile, D as renderMainLine, Dn as KIND_LEGEND, Dt as outsideRucherContext, E as renderAgentLine, En as KIND_ABBREVIATIONS, Et as compactReminder, F as purgeDays, Fn as isAgentStatus, Ft as INSTRUCTIONS_FILE, G as localDay, Gt as removeWorkspaceRepo, H as NOTE_TEXT_LIMIT, Ht as isWorkspaceName, I as MEMORY_MAX_CHARACTERS, In as isUserActionStatus, It as WORKSPACE_FILE, J as similarity, K as memoryHalfLife, Kt as workspaceExists, L as memoryMaxCharacters, Ln as kindTag, Lt as addWorkspaceRepo, M as renderStatus, Mn as MAIN_WORKING_EMOJI, Mt as MINIMUM_ID_PREFIX, N as renderTableLine, Nt as shortId, O as renderNoteLine, On as KIND_TAG_PATTERN, Ot as rulesText, P as DEFAULT_PURGE_DAYS, Pn as USER_ACTION_STATUSES, Pt as AGENTS_FILE, Q as repoPathFor, R as renderMemory, Rn as EVENT_TYPES, Rt as createWorkspace, S as MAIN_WORKING_SUFFIX, Sn as NOTE_MAX, St as SUBAGENT_RULES, T as SIMILAR_PREFIX, Tn as EMOJI, Tt as baseRules, U as STALE_AFTER_ACTIVE_DAYS, Ut as listWorkspaces, V as NOTE_KINDS, Vn as CarnetError, Vt as expandHome, W as isNoteKind, Wt as loadWorkspace, X as isInside, Y as workspaceRepoNames, Z as repoNameFor, _ as BLOCKED_HEADER, _n as REPORTING_NOTE, _t as removeStaleCopies, a as formatEventLine, an as rucherPaths, at as workspaceLastActive, b as MAIN_IDLE, bt as PROMPT_FILE, c as Carnet, cn as MEMORY_DB, ct as allHosts, d as openWorkspaceCarnet, dn as migrations, dt as transcriptTitle, en as databasePath, et as resolveWorkspace, f as PAIRING_WINDOW_MILLISECONDS, fn as schemaVersion, ft as workspaceSettings, g as TURNS, gn as PUBLISH_FALLBACK_MILLISECONDS, gt as mergeSettings, h as formatClock, ht as markdownCopy, i as RESUME_MAX_CHARACTERS, in as reportsDirectory, it as sessionWorkspaceName, j as renderSections, jn as MAIN_WAITING_EMOJI, jt as CORE_RULES, k as renderNotes, kn as LEGEND, kt as rulesVersion, l as openCarnet, ln as openDatabase, lt as hostById, m as buildStatusView, mn as DEFAULT_AGENT_KIND, mt as MARKDOWN_MARKER, n as stepAgent, nn as promptsDirectory, nt as archiveWorkspaceSessions, o as resumeContext, on as workspaceDefinition, ot as workspaceSessionCounts, p as STOPPED_NOTE, pn as AGENT_KINDS, pt as GENERATED_MARKER, q as sessionNoteActivity, qt as workspaceHosts, r as RESUME_EVENTS, rn as reportPath, rt as deleteWorkspaceNotes, s as sessionLabel, sn as workspacesDirectory, st as DEFAULT_HOST, t as AGENT_STEPS, tn as defaultRunDirectory, tt as workspaceLabel, u as openResolvedCarnet, un as migrate, ut as claudeCode, v as MAIN_FAILED_SUFFIX, vn as isAgentKind, vt as writeGenerated, w as NOTES_HEADER, wn as AGENT_STATUSES, wt as assemblePrompt, x as MAIN_WAITING_SUFFIX, xn as statusWhenDone, xt as RULES_UPDATED_NOTICE, y as MAIN_HEADER, yt as OUTSIDE_RUCHER_NOTICE, z as DEFAULT_HALF_LIFE_DAYS, zn as SESSION_EVENT_TYPES, zt as definitionInstructions } from "./steps-xzr8iVWn.mjs";
1
+ import { $ as repoPathFor, A as renderNotesSummary, An as KIND_ABBREVIATIONS, At as rulesVersion, B as DEFAULT_HALF_LIFE_DAYS, Bn as isUserActionStatus, Bt as definitionInstructions, C as NOTES_FOLD_LINES, Ct as SUBAGENT_RULES, D as renderMainLine, Dn as sanitizeNote, Dt as compactReminder, E as renderAgentLine, En as NOTE_MAX, Et as baseRules, F as purgeDays, Fn as MAIN_WAITING_EMOJI, Ft as AGENTS_FILE, G as isNoteKind, Gn as CarnetError, Gt as loadWorkspace, H as NOTE_KINDS, Hn as EVENT_TYPES, Ht as expandHome, In as MAIN_WORKING_EMOJI, It as INSTRUCTIONS_FILE, J as sessionNoteActivity, Jt as workspaceHosts, K as localDay, Kt as removeWorkspaceRepo, L as MEMORY_MAX_CHARACTERS, Lt as WORKSPACE_FILE, M as renderStatus, Mn as KIND_TAG_PATTERN, Mt as CORE_RULES, N as renderTableLine, Nn as LEGEND, Nt as MINIMUM_ID_PREFIX, O as renderNoteLine, On as AGENT_STATUSES, Ot as outsideRucherContext, P as DEFAULT_PURGE_DAYS, Pn as MAIN_FAILED_EMOJI, Pt as shortId, Q as repoNameFor, R as memoryMaxCharacters, Rn as USER_ACTION_STATUSES, Rt as addWorkspaceRepo, S as MAIN_WORKING_SUFFIX, Sn as isAgentKind, St as RULES_UPDATED_NOTICE, T as SIMILAR_PREFIX, Tn as statusWhenDone, Tt as assemblePrompt, U as NOTE_TEXT_LIMIT, Un as SESSION_EVENT_TYPES, Ut as isWorkspaceName, V as DUPLICATE_SIMILARITY, Vn as kindTag, Vt as dropWorkspace, W as STALE_AFTER_ACTIVE_DAYS, Wn as isEventType, Wt as listWorkspaces, X as workspaceRepoNames, Y as similarity, Z as isInside, _ as BLOCKED_HEADER, _n as KIND_REQUIRED, _t as mergeSettings, a as formatEventLine, an as reportsDirectory, at as sessionWorkspaceName, b as MAIN_IDLE, bn as REPORTING_NOTE, bt as OUTSIDE_RUCHER_NOTICE, c as Carnet, cn as workspaceDefinition, ct as DEFAULT_HOST, d as openWorkspaceCarnet, dn as openDatabase, dt as claudeCode, en as corePromptPath, et as requireWorkspace, f as PAIRING_WINDOW_MILLISECONDS, fn as migrate, ft as transcriptTitle, g as TURNS, gt as markdownCopy, h as formatClock, hn as AGENT_KINDS, ht as MARKDOWN_MARKER, i as RESUME_MAX_CHARACTERS, in as reportPath, it as deleteWorkspaceNotes, j as renderSections, jn as KIND_LEGEND, jt as workspaceRules, k as renderNotes, kn as EMOJI, kt as rulesText, l as openCarnet, ln as workspacesDirectory, lt as allHosts, m as buildStatusView, mn as schemaVersion, mt as GENERATED_MARKER, n as stepAgent, nn as defaultRunDirectory, nt as workspaceLabel, o as resumeContext, on as rucherPaths, ot as workspaceLastActive, p as STOPPED_NOTE, pn as migrations, pt as workspaceSettings, q as memoryHalfLife, qt as workspaceExists, r as RESUME_EVENTS, rn as promptsDirectory, rt as archiveWorkspaceSessions, s as sessionLabel, sn as sandboxesDirectory, st as workspaceSessionCounts, t as AGENT_STEPS, tn as databasePath, tt as resolveWorkspace, u as openResolvedCarnet, un as MEMORY_DB, ut as hostById, v as MAIN_FAILED_SUFFIX, vt as removeStaleCopies, w as NOTES_HEADER, wt as appendPromptFile, x as MAIN_WAITING_SUFFIX, xn as SANDBOX_KINDS, xt as PROMPT_FILE, y as MAIN_HEADER, yn as PUBLISH_FALLBACK_MILLISECONDS, yt as writeGenerated, z as renderMemory, zn as isAgentStatus, zt as createWorkspace } from "./steps-wNm8GU_c.mjs";
2
2
  import { mkdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
3
3
  import { isAbsolute, join, relative, resolve } from "node:path";
4
+ import { homedir } from "node:os";
4
5
  // src/move.ts
5
6
  function count(carnet, sql, ...parameters) {
6
7
  return Number(carnet.db.prepare(sql).get(...parameters).total);
@@ -144,7 +145,7 @@ const READ_ONLY_BASH = [
144
145
  label: "sed -i"
145
146
  },
146
147
  {
147
- pattern: /\bgit\s+(add|commit|push|stash|reset|checkout|switch|merge|rebase|cherry-pick|apply|restore|rm|mv|tag)\b/,
148
+ pattern: /\bgit\s+(?:-[Cc]\s+\S+\s+)*(add|commit|push|stash|reset|checkout|switch|merge|rebase|cherry-pick|apply|restore|rm|mv|tag)\b/,
148
149
  label: "git write"
149
150
  },
150
151
  {
@@ -152,7 +153,11 @@ const READ_ONLY_BASH = [
152
153
  label: "package install"
153
154
  }
154
155
  ];
155
- const PUBLISH_BASH = /\bgit\s+(commit|push|stash)\b/;
156
+ const PUBLISH_BASH = /\bgit\s+(?:-[Cc]\s+\S+\s+)*(commit|push|stash)\b/;
157
+ const PUSH_BASH = /\bgit\s+(?:-[Cc]\s+\S+\s+)*push\b/;
158
+ const GLOBAL_INSTALL = /\b(npm|pnpm|yarn|bun)\s[^;&|]*(\s-g\b|\s--global\b)/;
159
+ const LEADING_CD = /^\s*cd\s+([^\s;&|]+)\s*(?:&&|;)/;
160
+ const SHELL_WORDS = /[\s;&|()<>]+/;
156
161
  const REDIRECT = /(?:^|[^<>&\d=-])\d?>>?(?!=)\s*([^\s;&|)]+)/g;
157
162
  const QUOTED = /'[^']*'|"(?:[^"\\]|\\.)*"/g;
158
163
  function inside(path, folder) {
@@ -160,11 +165,25 @@ function inside(path, folder) {
160
165
  return rest === "" || !rest.startsWith("..") && !isAbsolute(rest);
161
166
  }
162
167
  function absolute(path, cwd) {
168
+ if (path === "~" || path.startsWith("~/")) return join(homedir(), path.slice(1));
163
169
  return isAbsolute(path) ? path : resolve(cwd ?? "/", path);
164
170
  }
171
+ function writable(path, input) {
172
+ return inside(path, input.scratchRoot) || !!input.sandbox && inside(path, input.sandbox);
173
+ }
165
174
  function writableRedirect(target, input) {
166
175
  if (target === "/dev/null" || target.startsWith("&")) return true;
167
- return inside(absolute(target, input.cwd), input.scratchRoot);
176
+ return writable(absolute(target, input.cwd), input);
177
+ }
178
+ function pathLike(word) {
179
+ return word.startsWith("/") || word.startsWith("~") || /(^|\/)\.\.(\/|$)/.test(word);
180
+ }
181
+ function confinedToSandbox(input, sandbox) {
182
+ const command = input.command ?? "";
183
+ const lead = LEADING_CD.exec(command);
184
+ const directory = lead ? absolute(lead[1] ?? "", input.cwd) : input.cwd ?? "/";
185
+ if (!inside(directory, sandbox)) return false;
186
+ return command.split(SHELL_WORDS).flatMap((word) => word.replace(/^['"]|['"]$/g, "").split("=")).filter(pathLike).every((word) => word === "/dev/null" || writable(absolute(word, directory), input));
168
187
  }
169
188
  function readOnlyBashViolation(input) {
170
189
  const command = input.command ?? "";
@@ -180,18 +199,56 @@ function guardToolCall(input) {
180
199
  if (inside(path, input.worktree) || inside(path, input.scratchRoot)) return void 0;
181
200
  return `${contract} limits writes to its worktree ${input.worktree}`;
182
201
  }
202
+ const sandbox = input.sandbox;
183
203
  if (FILE_TOOLS.has(input.toolName)) {
184
- if (input.filePath && inside(absolute(input.filePath, input.cwd), input.scratchRoot)) return;
185
- return `${contract} is read-only: write only the report in the scratchpad`;
204
+ if (input.filePath && writable(absolute(input.filePath, input.cwd), input)) return void 0;
205
+ return sandbox ? `${contract} limits writes to its sandbox ${sandbox} and the scratchpad` : `${contract} is read-only: write only the report in the scratchpad`;
186
206
  }
187
- if (input.toolName === "Bash") {
207
+ if (input.toolName !== "Bash") return void 0;
208
+ if (!sandbox) {
188
209
  const violation = readOnlyBashViolation(input);
189
210
  return violation ? `${contract} is read-only: ${violation} is not allowed` : void 0;
190
211
  }
212
+ const command = input.command ?? "";
213
+ if (PUSH_BASH.test(command)) return `${contract} forbids git push`;
214
+ if (GLOBAL_INSTALL.test(command)) return `${contract} forbids global package installs`;
215
+ const violation = readOnlyBashViolation(input);
216
+ if (!violation || confinedToSandbox(input, sandbox)) return void 0;
217
+ return `${contract} limits writing commands to its sandbox ${sandbox}: ${violation} is not allowed here`;
191
218
  }
192
219
  function kindOfAgentType(agentType) {
193
220
  return /^rucher[\w-]*:(research|review)$/.exec(agentType ?? "")?.[1];
194
221
  }
222
+ // src/launch.ts
223
+ const LAUNCH_TOOLS = /* @__PURE__ */ new Set([
224
+ "Agent",
225
+ "Task",
226
+ "EnterPlanMode"
227
+ ]);
228
+ const BUILT_IN_PLAN_DENIED = "In a Rucher session a plan agent is a Rucher fork, never the built-in Plan subagent: use /rucher:start:plan (agent_start with kind plan, then Agent with subagent_type fork and the agent name as description). For a question with no change, use /rucher:start:research.";
229
+ const EXPECTED_TYPES = {
230
+ research: "fork, or the rucher research agent with --cold",
231
+ plan: "fork",
232
+ implement: "fork",
233
+ review: "the rucher review agent"
234
+ };
235
+ function fitsKind(kind, subagentType) {
236
+ const type = subagentType ?? "";
237
+ if (kind === "plan" || kind === "implement") return type === "fork";
238
+ if (kind === "research") return type === "fork" || /(^|:)research$/.test(type);
239
+ return /(^|:)review$/.test(type);
240
+ }
241
+ function guardLaunch(call) {
242
+ if (call.toolName === "EnterPlanMode") {
243
+ const pending = call.pendingPlan;
244
+ if (!pending) return void 0;
245
+ return `${pending.name} is a Rucher plan agent waiting for its fork: launch it with Agent, subagent_type fork and description ${pending.name}, instead of plan mode.`;
246
+ }
247
+ if (call.subagentType === "Plan") return BUILT_IN_PLAN_DENIED;
248
+ const named = call.named;
249
+ if (!named || fitsKind(named.kind, call.subagentType)) return void 0;
250
+ return `${named.name} is a Rucher ${named.kind} agent: launch it with subagent_type ${EXPECTED_TYPES[named.kind]}, not ${call.subagentType ?? "no subagent_type"}.`;
251
+ }
195
252
  // src/hook/post-tool-use.ts
196
253
  function handleToolUse(carnet, payload, env, options = {}) {
197
254
  if (payload.agent_id) return void 0;
@@ -221,9 +278,23 @@ function guardSubagentCall(carnet, payload, scratchRoot) {
221
278
  command: payload.command,
222
279
  cwd: payload.cwd,
223
280
  worktree: agent?.worktree,
281
+ sandbox: agent?.sandbox,
224
282
  scratchRoot
225
283
  });
226
284
  }
285
+ function guardMainLaunch(carnet, payload) {
286
+ if (payload.agent_id || !payload.tool_name) return void 0;
287
+ if (!carnet.sessions.get(payload.session_id)) return void 0;
288
+ const named = carnet.agents.unpaired(payload.session_id, payload.launched_names ?? []);
289
+ const reason = guardLaunch({
290
+ toolName: payload.tool_name,
291
+ subagentType: payload.subagent_type,
292
+ named,
293
+ pendingPlan: payload.tool_name === "EnterPlanMode" ? carnet.agents.pendingPlan(payload.session_id) : void 0
294
+ });
295
+ if (!reason && named && payload.tool_name !== "EnterPlanMode") carnet.agents.requestLaunch(payload.session_id, named.name);
296
+ return reason;
297
+ }
227
298
  // src/status/line.ts
228
299
  const STATUS_LINE_LABEL = "rucher";
229
300
  const TURN_LABELS = {
@@ -237,7 +308,7 @@ function counts(lines) {
237
308
  return [...byEmoji].map(([emoji, count]) => `${emoji}${count}`).join(" ");
238
309
  }
239
310
  function renderStatusLine(view, lag = null) {
240
- if (lag) return `${STATUS_LINE_LABEL} · ${lag}`;
311
+ if (lag) return lag;
241
312
  const parts = [];
242
313
  if (view.turn) parts.push(TURN_LABELS[view.turn]);
243
314
  const [next] = view.waiting;
@@ -248,7 +319,10 @@ function renderStatusLine(view, lag = null) {
248
319
  }
249
320
  if (view.running.length > 0) parts.push(`${EMOJI.running}${view.running.length}`);
250
321
  if (view.blocked.length > 0) parts.push(`⛓${view.blocked.length}`);
251
- return parts.length === 0 ? "" : [STATUS_LINE_LABEL, ...parts].join(" · ");
322
+ return parts.join(" · ");
323
+ }
324
+ function labelStatusLine(line) {
325
+ return line ? `${STATUS_LINE_LABEL} · ${line}` : "";
252
326
  }
253
327
  function statusLinePath(sessionId, env) {
254
328
  return join(rucherPaths(env).state, "status", `${sessionId}.txt`);
@@ -282,6 +356,6 @@ function renderRunDirectory(workspace, options = {}) {
282
356
  }
283
357
  return result;
284
358
  }
285
- export { AGENTS_FILE, AGENT_KINDS, AGENT_STATUSES, AGENT_STEPS, BLOCKED_HEADER, CORE_RULES, Carnet, CarnetError, DEFAULT_AGENT_KIND, DEFAULT_HALF_LIFE_DAYS, DEFAULT_HOST, DEFAULT_PURGE_DAYS, DUPLICATE_SIMILARITY, EMOJI, EVENT_TYPES, GENERATED_MARKER, GUARDED_TOOLS, INSTRUCTIONS_FILE, KIND_ABBREVIATIONS, KIND_LEGEND, KIND_TAG_PATTERN, LEGEND, MAIN_FAILED_EMOJI, MAIN_FAILED_SUFFIX, MAIN_HEADER, MAIN_IDLE, MAIN_WAITING_EMOJI, MAIN_WAITING_SUFFIX, MAIN_WORKING_EMOJI, MAIN_WORKING_SUFFIX, MARKDOWN_MARKER, MEMORY_DB, MEMORY_MAX_CHARACTERS, MINIMUM_ID_PREFIX, NOTES_FOLD_LINES, NOTES_HEADER, NOTE_KINDS, NOTE_MAX, NOTE_TEXT_LIMIT, OUTSIDE_RUCHER_NOTICE, PAIRING_WINDOW_MILLISECONDS, PROMPT_FILE, PUBLISH_FALLBACK_MILLISECONDS, REPORTING_NOTE, RESUME_EVENTS, RESUME_MAX_CHARACTERS, RULES_UPDATED_NOTICE, SESSION_EVENT_TYPES, SIMILAR_PREFIX, STALE_AFTER_ACTIVE_DAYS, STATUS_LINE_LABEL, STOPPED_NOTE, SUBAGENT_RULES, TURNS, USER_ACTION_STATUSES, WAITING_TOOL, WORKSPACE_FILE, addWorkspaceRepo, allHosts, appendPromptFile, archiveWorkspaceSessions, assemblePrompt, baseRules, buildStatusView, claudeCode, compactReminder, corePromptPath, createWorkspace, databasePath, defaultRunDirectory, definitionInstructions, deleteWorkspaceNotes, dropWorkspace, expandHome, formatClock, formatEventLine, guardSubagentCall, guardToolCall, handleSessionEnd, handleSessionStart, handleStop, handleToolStart, handleToolUse, handleUserPromptSubmit, hostById, isAgentKind, isAgentStatus, isEventType, isInside, isNoteKind, isUserActionStatus, isWorkspaceName, kindOfAgentType, kindTag, listWorkspaces, loadWorkspace, localDay, markdownCopy, memoryHalfLife, memoryMaxCharacters, mergeSettings, migrate, migrations, moveSession, openCarnet, openDatabase, openResolvedCarnet, openWorkspaceCarnet, outsideRucherContext, promptsDirectory, purgeDays, removeStaleCopies, removeWorkspaceRepo, renderAgentLine, renderMainLine, renderMemory, renderNoteLine, renderNotes, renderNotesSummary, renderRunDirectory, renderSections, renderStatus, renderStatusLine, renderTableLine, repoNameFor, repoPathFor, reportPath, reportsDirectory, requireWorkspace, resolveWorkspace, resumeContext, rucherPaths, rulesText, rulesVersion, sanitizeNote, schemaVersion, sessionLabel, sessionNoteActivity, sessionWorkspaceName, shortId, similarity, statusLinePath, statusWhenDone, stepAgent, transcriptTitle, workspaceDefinition, workspaceExists, workspaceHosts, workspaceLabel, workspaceLastActive, workspaceRepoNames, workspaceRules, workspaceSessionCounts, workspaceSettings, workspacesDirectory, writeGenerated, writeStatusLine };
359
+ export { AGENTS_FILE, AGENT_KINDS, AGENT_STATUSES, AGENT_STEPS, BLOCKED_HEADER, BUILT_IN_PLAN_DENIED, CORE_RULES, Carnet, CarnetError, DEFAULT_HALF_LIFE_DAYS, DEFAULT_HOST, DEFAULT_PURGE_DAYS, DUPLICATE_SIMILARITY, EMOJI, EVENT_TYPES, GENERATED_MARKER, GUARDED_TOOLS, INSTRUCTIONS_FILE, KIND_ABBREVIATIONS, KIND_LEGEND, KIND_REQUIRED, KIND_TAG_PATTERN, LAUNCH_TOOLS, LEGEND, MAIN_FAILED_EMOJI, MAIN_FAILED_SUFFIX, MAIN_HEADER, MAIN_IDLE, MAIN_WAITING_EMOJI, MAIN_WAITING_SUFFIX, MAIN_WORKING_EMOJI, MAIN_WORKING_SUFFIX, MARKDOWN_MARKER, MEMORY_DB, MEMORY_MAX_CHARACTERS, MINIMUM_ID_PREFIX, NOTES_FOLD_LINES, NOTES_HEADER, NOTE_KINDS, NOTE_MAX, NOTE_TEXT_LIMIT, OUTSIDE_RUCHER_NOTICE, PAIRING_WINDOW_MILLISECONDS, PROMPT_FILE, PUBLISH_FALLBACK_MILLISECONDS, REPORTING_NOTE, RESUME_EVENTS, RESUME_MAX_CHARACTERS, RULES_UPDATED_NOTICE, SANDBOX_KINDS, SESSION_EVENT_TYPES, SIMILAR_PREFIX, STALE_AFTER_ACTIVE_DAYS, STATUS_LINE_LABEL, STOPPED_NOTE, SUBAGENT_RULES, TURNS, USER_ACTION_STATUSES, WAITING_TOOL, WORKSPACE_FILE, addWorkspaceRepo, allHosts, appendPromptFile, archiveWorkspaceSessions, assemblePrompt, baseRules, buildStatusView, claudeCode, compactReminder, corePromptPath, createWorkspace, databasePath, defaultRunDirectory, definitionInstructions, deleteWorkspaceNotes, dropWorkspace, expandHome, formatClock, formatEventLine, guardLaunch, guardMainLaunch, guardSubagentCall, guardToolCall, handleSessionEnd, handleSessionStart, handleStop, handleToolStart, handleToolUse, handleUserPromptSubmit, hostById, isAgentKind, isAgentStatus, isEventType, isInside, isNoteKind, isUserActionStatus, isWorkspaceName, kindOfAgentType, kindTag, labelStatusLine, listWorkspaces, loadWorkspace, localDay, markdownCopy, memoryHalfLife, memoryMaxCharacters, mergeSettings, migrate, migrations, moveSession, openCarnet, openDatabase, openResolvedCarnet, openWorkspaceCarnet, outsideRucherContext, promptsDirectory, purgeDays, removeStaleCopies, removeWorkspaceRepo, renderAgentLine, renderMainLine, renderMemory, renderNoteLine, renderNotes, renderNotesSummary, renderRunDirectory, renderSections, renderStatus, renderStatusLine, renderTableLine, repoNameFor, repoPathFor, reportPath, reportsDirectory, requireWorkspace, resolveWorkspace, resumeContext, rucherPaths, rulesText, rulesVersion, sandboxesDirectory, sanitizeNote, schemaVersion, sessionLabel, sessionNoteActivity, sessionWorkspaceName, shortId, similarity, statusLinePath, statusWhenDone, stepAgent, transcriptTitle, workspaceDefinition, workspaceExists, workspaceHosts, workspaceLabel, workspaceLastActive, workspaceRepoNames, workspaceRules, workspaceSessionCounts, workspaceSettings, workspacesDirectory, writeGenerated, writeStatusLine };
286
360
 
287
361
  //# sourceMappingURL=index.mjs.map