@rucher/carnet 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Florian Varrin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,21 @@
1
- # Temporary Holding Version
1
+ # @rucher/carnet
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Shared state for Rucher: groups, sessions, agents, the "On the table" line and the event journal, stored in one SQLite database per group (`<meta directory>/.rucher/carnet.db`, via `node:sqlite`).
4
+
5
+ Used by the `rucher` CLI and the Carnet MCP server. See `docs/carnet-spec.md` at the repository root.
6
+
7
+ ```ts
8
+ import { openCarnet } from '@rucher/carnet';
9
+
10
+ const carnet = openCarnet({ cwd: process.cwd() });
11
+ const session = carnet.sessions.default();
12
+ if (session) console.log(carnet.status.render(session));
13
+ ```
14
+
15
+ ## Development
16
+
17
+ ```bash
18
+ vp test
19
+ vp check
20
+ vp pack
21
+ ```
@@ -0,0 +1,261 @@
1
+ import { DatabaseSync } from "node:sqlite";
2
+ interface Ctx {
3
+ db: DatabaseSync;
4
+ now: () => Date;
5
+ }
6
+ declare const AGENT_STATUSES: readonly ['running', 'discussing', 'answer', 'review', 'apply', 'test', 'commit', 'branch', 'closed'];
7
+ type AgentStatus = (typeof AGENT_STATUSES)[number];
8
+ declare const USER_ACTION_STATUSES: readonly ['discussing', 'answer', 'review', 'apply', 'test', 'commit', 'branch'];
9
+ type UserActionStatus = (typeof USER_ACTION_STATUSES)[number];
10
+ declare const EMOJI: Record<Exclude<AgentStatus, 'closed'>, string>;
11
+ declare const MAIN_WORKING_EMOJI = "⚙️";
12
+ declare const LEGEND = "⚙️ main working · 💬 discussing · ❓ answer · 👀 review · 📥 apply · 🧪 test · ✅ commit · 🌿 branch · ⏳ running";
13
+ declare function isAgentStatus(value: unknown): value is AgentStatus;
14
+ declare function isUserActionStatus(value: unknown): value is UserActionStatus;
15
+ interface Agent {
16
+ session: string;
17
+ name: string;
18
+ task: string | null;
19
+ status: AgentStatus;
20
+ note: string | null;
21
+ reportPath: string | null;
22
+ baseCommit: string | null;
23
+ worktree: string | null;
24
+ queueOrder: number | null;
25
+ hostAgentId: string | null;
26
+ pendingStatus: AgentStatus | null;
27
+ doneAt: string | null;
28
+ startedAt: string;
29
+ updatedAt: string;
30
+ }
31
+ interface StartAgentInput {
32
+ name: string;
33
+ task: string;
34
+ baseCommit?: string | undefined;
35
+ worktree?: string | undefined;
36
+ }
37
+ interface UpdateAgentInput {
38
+ status: AgentStatus;
39
+ note?: string | undefined;
40
+ reportPath?: string | undefined;
41
+ }
42
+ interface FinishAgentInput {
43
+ reportPath: string;
44
+ hasQuestions: boolean;
45
+ }
46
+ interface ListAgentsOptions {
47
+ includeClosed?: boolean;
48
+ }
49
+ declare const REPORTING_NOTE = "reporting";
50
+ declare const PUBLISH_FALLBACK_MILLISECONDS = 120000;
51
+ declare const GROUP_DIRECTORY = ".rucher";
52
+ declare const REPORTS_DIRECTORY = "reports";
53
+ declare const GROUP_FILE = "group.json";
54
+ declare const DB_FILE = "carnet.db";
55
+ interface Group {
56
+ root: string;
57
+ name: string;
58
+ repos: string[];
59
+ hosts: string[];
60
+ dbPath: string;
61
+ }
62
+ interface GroupFile {
63
+ name: string;
64
+ repos: string[];
65
+ hosts?: string[] | undefined;
66
+ }
67
+ declare function isInside(directory: string, path: string): boolean;
68
+ declare function repoNameFor(group: Group, path: string | undefined): string | null;
69
+ declare function repoPathFor(group: Group, path: string | undefined | null): string | null;
70
+ declare function findGroupRoot(from: string): string | null;
71
+ declare function reportsDirectoryOf(group: Group): string;
72
+ declare function reportPathFor(group: Group, agentName: string): string;
73
+ declare function isGroupRoot(directory: string): boolean;
74
+ declare function loadGroup(root: string): Group;
75
+ interface LocateOptions {
76
+ cwd?: string;
77
+ env?: NodeJS.ProcessEnv;
78
+ }
79
+ declare function locateGroup({ cwd, env }?: LocateOptions): Group;
80
+ interface HostSessionPayload {
81
+ session_id: string;
82
+ cwd?: string | undefined;
83
+ source?: string | undefined;
84
+ session_title?: string | undefined;
85
+ }
86
+ interface HostPromptPayload {
87
+ session_id: string;
88
+ cwd?: string | undefined;
89
+ session_title?: string | undefined;
90
+ transcript_path?: string | undefined;
91
+ }
92
+ interface HostSubagentPayload {
93
+ session_id: string;
94
+ agent_id: string;
95
+ agent_type?: string | undefined;
96
+ cwd?: string | undefined;
97
+ }
98
+ interface ResumeCommand {
99
+ command: string;
100
+ args: string[];
101
+ }
102
+ interface ContextFile {
103
+ path: string;
104
+ sync(group: Group, mode: 'merge' | 'exact'): ContextFileResult;
105
+ }
106
+ type ContextFileResult = 'written' | 'updated' | 'unchanged' | 'no-markers';
107
+ interface Host {
108
+ id: string;
109
+ displayName: string;
110
+ processId(env: NodeJS.ProcessEnv): number | null;
111
+ sessionIdFromEnvironment(env: NodeJS.ProcessEnv): string | undefined;
112
+ projectDirectory(env: NodeJS.ProcessEnv): string | undefined;
113
+ parseSessionPayload(json: string): HostSessionPayload;
114
+ parsePromptPayload(json: string): HostPromptPayload;
115
+ parseSubagentPayload(json: string): HostSubagentPayload;
116
+ promptTitle(payload: HostPromptPayload): string | undefined;
117
+ resumeCommand(session: Session): ResumeCommand;
118
+ renameInstruction(name: string): string;
119
+ contextFiles: readonly ContextFile[];
120
+ }
121
+ declare const DEFAULT_HOST = "claude-code";
122
+ declare function allHosts(): Host[];
123
+ declare function hostById(id: string): Host;
124
+ type SessionStatus = 'temporary' | 'active' | 'dropped';
125
+ interface Session {
126
+ id: string;
127
+ name: string | null;
128
+ purpose: string | null;
129
+ status: SessionStatus;
130
+ cwd: string | null;
131
+ repo: string | null;
132
+ host: string;
133
+ hostPid: number | null;
134
+ hookedAt: string | null;
135
+ createdAt: string;
136
+ lastActiveAt: string;
137
+ }
138
+ type HookSessionPayload = HostSessionPayload;
139
+ interface HookEnv {
140
+ host?: string | undefined;
141
+ processId?: number | null | undefined;
142
+ RUCHER_PURGE_DAYS?: string | undefined;
143
+ }
144
+ interface ListSessionsOptions {
145
+ includeTemporary?: boolean | undefined;
146
+ includeDropped?: boolean | undefined;
147
+ }
148
+ declare const MINIMUM_ID_PREFIX = 4;
149
+ declare function shortId(id: string): string;
150
+ interface MergeResult {
151
+ session: Session;
152
+ movedAgents: string[];
153
+ closedAgents: string[];
154
+ movedEvents: number;
155
+ movedTable: boolean;
156
+ }
157
+ interface TableItem {
158
+ session: string;
159
+ text: string;
160
+ status: UserActionStatus | null;
161
+ mainWorking: boolean;
162
+ updatedAt: string;
163
+ }
164
+ interface SetTableInput {
165
+ text: string;
166
+ mainWorking: boolean;
167
+ status?: UserActionStatus | undefined;
168
+ }
169
+ declare const EVENT_TYPES: readonly ['started', 'finished', 'answered', 'applied', 'tested', 'committed', 'dropped'];
170
+ type EventType = (typeof EVENT_TYPES)[number];
171
+ interface CarnetEvent {
172
+ id: number;
173
+ session: string;
174
+ at: string;
175
+ type: EventType;
176
+ agent: string | null;
177
+ commit: string | null;
178
+ link: string | null;
179
+ note: string | null;
180
+ }
181
+ interface LogEventInput {
182
+ type: EventType;
183
+ agent?: string | undefined;
184
+ commit?: string | undefined;
185
+ link?: string | undefined;
186
+ note?: string | undefined;
187
+ }
188
+ declare function isEventType(value: unknown): value is EventType;
189
+ interface StatusLine {
190
+ name: string;
191
+ status: AgentStatus;
192
+ emoji: string;
193
+ note: string | null;
194
+ }
195
+ interface StatusView {
196
+ time: string;
197
+ sessionName: string | null;
198
+ table: TableItem | null;
199
+ waiting: StatusLine[];
200
+ running: StatusLine[];
201
+ }
202
+ declare function formatClock(date: Date): string;
203
+ declare function buildStatusView(ctx: Ctx, session: Session): StatusView;
204
+ interface CarnetOptions {
205
+ now?: () => Date;
206
+ }
207
+ declare class Carnet {
208
+ readonly group: Group;
209
+ readonly db: DatabaseSync;
210
+ private readonly ctx;
211
+ constructor(group: Group, db: DatabaseSync, options?: CarnetOptions);
212
+ readonly sessions: {
213
+ get: (id: string) => Session | undefined;
214
+ find: (reference: string) => Session;
215
+ require: (id: string) => Session;
216
+ ensure: (id: string, cwd?: string) => Session;
217
+ upsertFromHook: (payload: HookSessionPayload, env?: HookEnv) => Session;
218
+ touch: (id: string) => void;
219
+ merge: (fromId: string, intoId: string) => MergeResult;
220
+ purge: (keepId: string, days: number) => string[];
221
+ name: (id: string, name: string, purpose?: string) => Session;
222
+ adoptTitle: (id: string, title: string | undefined) => Session;
223
+ list: (options?: ListSessionsOptions) => Session[];
224
+ drop: (id: string) => Session;
225
+ default: () => Session | undefined;
226
+ byName: (name: string) => Session | undefined;
227
+ byHostProcess: (host: string, processId: number) => Session | undefined;
228
+ };
229
+ readonly agents: {
230
+ get: (session: string, name: string) => Agent | undefined;
231
+ start: (session: string, input: StartAgentInput) => Agent;
232
+ update: (session: string, name: string, input: UpdateAgentInput) => Agent;
233
+ finish: (session: string, name: string, input: FinishAgentInput) => Agent;
234
+ drop: (session: string, name: string, reason?: string) => Agent;
235
+ list: (session: string, options?: ListAgentsOptions) => Agent[];
236
+ reorderQueue: (session: string, names: string[]) => Agent[];
237
+ pairSubagent: (session: string, hostAgentId: string) => Agent | undefined;
238
+ stopSubagent: (session: string, hostAgentId: string) => Agent | undefined;
239
+ };
240
+ readonly table: {
241
+ get: (session: string) => TableItem | undefined;
242
+ set: (session: string, input: SetTableInput) => TableItem;
243
+ clear: (session: string) => void;
244
+ };
245
+ readonly events: {
246
+ log: (session: string, input: LogEventInput) => CarnetEvent;
247
+ read: (session: string, limit?: number) => CarnetEvent[];
248
+ };
249
+ readonly status: {
250
+ view: (session: Session) => StatusView;
251
+ render: (session: Session) => string;
252
+ sections: (session: Session) => string;
253
+ };
254
+ close(): void;
255
+ }
256
+ interface OpenCarnetOptions extends LocateOptions, CarnetOptions {
257
+ dbPath?: string;
258
+ }
259
+ declare function openCarnet(options?: OpenCarnetOptions): Carnet;
260
+ export { PUBLISH_FALLBACK_MILLISECONDS as $, HostSubagentPayload as A, REPORTS_DIRECTORY as B, shortId as C, Host as D, DEFAULT_HOST as E, GROUP_DIRECTORY as F, locateGroup as G, isGroupRoot as H, GROUP_FILE as I, reportPathFor as J, repoNameFor as K, Group as L, allHosts as M, hostById as N, HostPromptPayload as O, DB_FILE as P, ListAgentsOptions as Q, GroupFile as R, SessionStatus as S, ContextFileResult as T, isInside as U, findGroupRoot as V, loadGroup as W, Agent as X, reportsDirectoryOf as Y, FinishAgentInput as Z, HookEnv as _, StatusLine as a, EMOJI as at, MINIMUM_ID_PREFIX as b, formatClock as c, USER_ACTION_STATUSES as ct, EventType as d, isUserActionStatus as dt, REPORTING_NOTE as et, LogEventInput as f, MergeResult as g, TableItem as h, openCarnet as i, AgentStatus as it, ResumeCommand as j, HostSessionPayload as k, CarnetEvent as l, UserActionStatus as lt, SetTableInput as m, CarnetOptions as n, UpdateAgentInput as nt, StatusView as o, LEGEND as ot, isEventType as p, repoPathFor as q, OpenCarnetOptions as r, AGENT_STATUSES as rt, buildStatusView as s, MAIN_WORKING_EMOJI as st, Carnet as t, StartAgentInput as tt, EVENT_TYPES as u, isAgentStatus as ut, HookSessionPayload as v, ContextFile as w, Session as x, ListSessionsOptions as y, LocateOptions as z };
261
+ //# sourceMappingURL=carnet-CSdqWDas.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carnet-CSdqWDas.d.mts","names":["_$__merge_ts0.MergeResult","_$__agents_ts0.Agent","_$__table_ts0.TableItem","_$__events_ts0.CarnetEvent","_$__status_view_ts0.StatusView"],"sources":["../src/context.ts","../src/status/model.ts","../src/agents.ts","../src/group/locate.ts","../src/hosts/host.ts","../src/sessions.ts","../src/merge.ts","../src/table.ts","../src/events.ts","../src/status/view.ts","../src/carnet.ts"],"mappings":"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"}
@@ -0,0 +1,65 @@
1
+ import { $ as PUBLISH_FALLBACK_MILLISECONDS, A as HostSubagentPayload, B as REPORTS_DIRECTORY, C as shortId, D as Host, E as DEFAULT_HOST, F as GROUP_DIRECTORY, G as locateGroup, H as isGroupRoot, I as GROUP_FILE, J as reportPathFor, K as repoNameFor, L as Group, M as allHosts, N as hostById, O as HostPromptPayload, P as DB_FILE, Q as ListAgentsOptions, R as GroupFile, S as SessionStatus, T as ContextFileResult, U as isInside, V as findGroupRoot, W as loadGroup, X as Agent, Y as reportsDirectoryOf, Z as FinishAgentInput, _ as HookEnv, a as StatusLine, at as EMOJI, b as MINIMUM_ID_PREFIX, c as formatClock, ct as USER_ACTION_STATUSES, d as EventType, dt as isUserActionStatus, et as REPORTING_NOTE, f as LogEventInput, g as MergeResult, h as TableItem, i as openCarnet, it as AgentStatus, j as ResumeCommand, k as HostSessionPayload, l as CarnetEvent, lt as UserActionStatus, m as SetTableInput, n as CarnetOptions, nt as UpdateAgentInput, o as StatusView, ot as LEGEND, p as isEventType, q as repoPathFor, r as OpenCarnetOptions, rt as AGENT_STATUSES, s as buildStatusView, st as MAIN_WORKING_EMOJI, t as Carnet, tt as StartAgentInput, u as EVENT_TYPES, ut as isAgentStatus, v as HookSessionPayload, w as ContextFile, x as Session, y as ListSessionsOptions, z as LocateOptions } from "./carnet-CSdqWDas.mjs";
2
+ import { DatabaseSync } from "node:sqlite";
3
+ export declare const MEMORY_DB = ":memory:";
4
+ export declare function openDatabase(path: string): DatabaseSync;
5
+ export declare const migrations: readonly string[];
6
+ export declare function schemaVersion(db: DatabaseSync): number;
7
+ export declare function migrate(db: DatabaseSync): void;
8
+ type CarnetErrorCode = 'NO_GROUP' | 'GROUP_EXISTS' | 'REPO_NOT_FOUND' | 'UNKNOWN_HOST' | 'NO_SESSION' | 'SESSION_NOT_FOUND' | 'SESSION_AMBIGUOUS' | 'SESSION_NAME_TAKEN' | 'SESSION_MERGE_INVALID' | 'AGENT_EXISTS' | 'AGENT_NOT_FOUND' | 'INVALID_STATUS' | 'INVALID_EVENT_TYPE' | 'TABLE_STATUS_WITH_MAIN_WORKING';
9
+ export declare class CarnetError extends Error {
10
+ readonly code: CarnetErrorCode;
11
+ constructor(code: CarnetErrorCode, message: string);
12
+ }
13
+ interface InitOptions {
14
+ name?: string | undefined;
15
+ repos?: string[] | undefined;
16
+ hosts?: string[] | undefined;
17
+ env?: NodeJS.ProcessEnv | undefined;
18
+ }
19
+ export declare function initGroup(directory: string, options?: InitOptions): Group;
20
+ export declare function addGroupRepo(root: string, repo: string): Group;
21
+ export declare function removeGroupRepo(root: string, repo: string): Group;
22
+ interface GroupReference {
23
+ name: string;
24
+ path: string;
25
+ }
26
+ export declare function rucherHome(env?: NodeJS.ProcessEnv): string;
27
+ export declare function readRegistry(env?: NodeJS.ProcessEnv): GroupReference[];
28
+ export declare function registerGroup(reference: GroupReference, env?: NodeJS.ProcessEnv): GroupReference[];
29
+ export declare function unregisterGroups(paths: string[], env?: NodeJS.ProcessEnv): GroupReference[];
30
+ interface SessionStartResult {
31
+ session: Session;
32
+ additionalContext?: string;
33
+ }
34
+ export declare function handleSessionStart(carnet: Carnet, payload: HookSessionPayload, env: HookEnv): SessionStartResult;
35
+ export declare function handleUserPromptSubmit(carnet: Carnet, host: Host, payload: HostPromptPayload): Session;
36
+ export declare const REPOS_START = "<!-- rucher:repos start -->";
37
+ export declare const REPOS_END = "<!-- rucher:repos end -->";
38
+ export declare function transcriptTitle(path: string): string | undefined;
39
+ export declare function reposBlock(group: Group): string;
40
+ export declare function replaceReposBlock(content: string, group: Group): string | null;
41
+ export declare function groupInstructions(group: Group): string;
42
+ export declare function groupSettings(group: Group): string;
43
+ export declare const claudeCode: Host;
44
+ export declare const DEFAULT_PURGE_DAYS = 3;
45
+ export declare function purgeDays(value: string | undefined): number;
46
+ export declare const RESUME_EVENTS = 20;
47
+ export declare const RESUME_MAX_CHARACTERS = 2000;
48
+ interface ResumeContextOptions {
49
+ events?: number;
50
+ maxCharacters?: number;
51
+ }
52
+ export declare function formatEventLine(event: CarnetEvent): string;
53
+ export declare function sessionLabel(session: Session): string;
54
+ export declare function resumeContext(carnet: Carnet, session: Session, { events, maxCharacters }?: ResumeContextOptions): string;
55
+ export declare const PAIRING_WINDOW_MILLISECONDS = 60000;
56
+ export declare const STOPPED_NOTE = "stopped without agent_done";
57
+ export declare const NOTE_MAX = 60;
58
+ export declare function sanitizeNote(text: string): string;
59
+ export declare const MAIN_WORKING_SUFFIX = "(main working, not ready)";
60
+ export declare function renderTableLine(item: TableItem): string;
61
+ export declare function renderAgentLine(line: StatusLine): string;
62
+ export declare function renderSections(view: StatusView): string;
63
+ export declare function renderStatus(view: StatusView): string;
64
+ export { AGENT_STATUSES, type Agent, type AgentStatus, Carnet, type CarnetErrorCode, type CarnetEvent, type CarnetOptions, type ContextFile, type ContextFileResult, DB_FILE, DEFAULT_HOST, EMOJI, EVENT_TYPES, type EventType, type FinishAgentInput, GROUP_DIRECTORY, GROUP_FILE, type Group, type GroupFile, type GroupReference, type HookEnv, type HookSessionPayload, type Host, type HostPromptPayload, type HostSessionPayload, type HostSubagentPayload, type InitOptions, LEGEND, type ListAgentsOptions, type ListSessionsOptions, type LocateOptions, type LogEventInput, MAIN_WORKING_EMOJI, MINIMUM_ID_PREFIX, type MergeResult, type OpenCarnetOptions, PUBLISH_FALLBACK_MILLISECONDS, REPORTING_NOTE, REPORTS_DIRECTORY, type ResumeCommand, type ResumeContextOptions, type Session, type SessionStartResult, type SessionStatus, type SetTableInput, type StartAgentInput, type StatusLine, type StatusView, type TableItem, USER_ACTION_STATUSES, type UpdateAgentInput, type UserActionStatus, allHosts, buildStatusView, findGroupRoot, formatClock, hostById, isAgentStatus, isEventType, isGroupRoot, isInside, isUserActionStatus, loadGroup, locateGroup, openCarnet, repoNameFor, repoPathFor, reportPathFor, reportsDirectoryOf, shortId };
65
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/db/open.ts","../src/db/schema.ts","../src/errors.ts","../src/group/init.ts","../src/group/registry.ts","../src/hook/session-start.ts","../src/hook/user-prompt-submit.ts","../src/hosts/claude-code.ts","../src/purge.ts","../src/resume.ts","../src/subagents.ts","../src/status/note.ts","../src/status/render.ts"],"mappings":";;qBAGa;wBAEG,aAAa,eAAe;qBCH/B;wBA6EG,cAAc,IAAI;wBAKlB,QAAQ,IAAI;KCpFhB;qBAgBC,oBAAoB;WAEpB,MAAM;EADjB,YACW,MAAM,iBACf;;UCHa;EACf;EACA;EACA;EACA,MAAM,OAAO;;wBAcC,UAAU,mBAAmB,UAAS,cAAmB;wBAkBzD,aAAa,cAAc,eAAe;wBAa1C,gBAAgB,cAAc,eAAe;UC7D5C;EACf;EACA;;wBAOc,WAAW,MAAK,OAAO;wBAQvB,aAAa,MAAM,OAAO,aAAa;wBAmBvC,cACd,WAAW,gBACX,MAAM,OAAO,aACZ;wBAOa,iBAAiB,iBAAiB,MAAM,OAAO,aAAa;UC7C3D;EACf,SAAS;EACT;;wBAGc,mBACd,QAAQ,QACR,SAAS,oBACT,KAAK,UACJ;wBCVa,uBACd,QAAQ,QACR,MAAM,MACN,SAAS,oBACR;qBCgBU;qBACA;wBAeG,gBAAgB;wBAkBhB,WAAW,OAAO;wBAOlB,kBAAkB,iBAAiB,OAAO;wBAO1C,kBAAkB,OAAO;wBAiBzB,cAAc,OAAO;qBAmDxB,YAAY;qBC1IZ;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;qBCPhB;wBAEG,gBAAgB,MAAM;wBAKtB,gBAAgB,MAAM;wBAItB,eAAe,MAAM;wBAgBrB,aAAa,MAAM"}
package/dist/index.mjs ADDED
@@ -0,0 +1,71 @@
1
+ import { $ as schemaVersion, A as repoNameFor, B as hostById, C as GROUP_FILE, D as isInside, E as isGroupRoot, F as registerGroup, G as groupSettings, H as REPOS_START, I as rucherHome, J as transcriptTitle, K as replaceReposBlock, L as unregisterGroups, M as reportPathFor, N as reportsDirectoryOf, O as loadGroup, P as readRegistry, Q as migrations, R as DEFAULT_HOST, S as GROUP_DIRECTORY, T as findGroupRoot, U as claudeCode, V as REPOS_END, W as groupInstructions, X as openDatabase, Y as MEMORY_DB, Z as migrate, _ as DEFAULT_PURGE_DAYS, a as sessionLabel, at as EMOJI, b as shortId, c as PAIRING_WINDOW_MILLISECONDS, d as formatClock, dt as isUserActionStatus, et as PUBLISH_FALLBACK_MILLISECONDS, f as MAIN_WORKING_SUFFIX, ft as EVENT_TYPES, g as renderTableLine, h as renderStatus, i as resumeContext, it as AGENT_STATUSES, j as repoPathFor, k as locateGroup, l as STOPPED_NOTE, lt as USER_ACTION_STATUSES, m as renderSections, mt as CarnetError, n as RESUME_MAX_CHARACTERS, nt as NOTE_MAX, o as Carnet, ot as LEGEND, p as renderAgentLine, pt as isEventType, q as reposBlock, r as formatEventLine, rt as sanitizeNote, s as openCarnet, st as MAIN_WORKING_EMOJI, t as RESUME_EVENTS, tt as REPORTING_NOTE, u as buildStatusView, ut as isAgentStatus, v as purgeDays, w as REPORTS_DIRECTORY, x as DB_FILE, y as MINIMUM_ID_PREFIX, z as allHosts } from "./resume-Daotqfdq.mjs";
2
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
3
+ import { basename, join, resolve } from "node:path";
4
+ // src/group/init.ts
5
+ function writeGroupFile(root, file) {
6
+ writeFileSync(join(root, GROUP_DIRECTORY, GROUP_FILE), `${JSON.stringify(file, null, 2)}\n`);
7
+ }
8
+ function resolveRepo(root, repo) {
9
+ const path = resolve(root, repo);
10
+ if (!existsSync(path)) throw new CarnetError("REPO_NOT_FOUND", `Repo path does not exist: ${path}`);
11
+ return path;
12
+ }
13
+ function initGroup(directory, options = {}) {
14
+ const root = resolve(directory);
15
+ const groupDirectory = join(root, GROUP_DIRECTORY);
16
+ if (existsSync(groupDirectory)) throw new CarnetError("GROUP_EXISTS", `${root} is already a Rucher group`);
17
+ const name = options.name ?? basename(root);
18
+ const repos = (options.repos ?? []).map((repo) => resolveRepo(root, repo));
19
+ const hosts = (options.hosts?.length ? options.hosts : [DEFAULT_HOST]).map((id) => hostById(id).id);
20
+ mkdirSync(join(groupDirectory, REPORTS_DIRECTORY), { recursive: true });
21
+ writeGroupFile(root, {
22
+ name,
23
+ repos,
24
+ hosts
25
+ });
26
+ openDatabase(join(groupDirectory, DB_FILE)).close();
27
+ registerGroup({
28
+ name,
29
+ path: root
30
+ }, options.env);
31
+ return loadGroup(root);
32
+ }
33
+ function addGroupRepo(root, repo) {
34
+ const group = loadGroup(resolve(root));
35
+ const path = resolveRepo(group.root, repo);
36
+ if (!group.repos.includes(path)) writeGroupFile(group.root, {
37
+ name: group.name,
38
+ repos: [...group.repos, path],
39
+ hosts: group.hosts
40
+ });
41
+ return loadGroup(group.root);
42
+ }
43
+ function removeGroupRepo(root, repo) {
44
+ const group = loadGroup(resolve(root));
45
+ const path = resolve(group.root, repo);
46
+ if (!group.repos.includes(path)) throw new CarnetError("REPO_NOT_FOUND", `${path} is not a repo of ${group.name}`);
47
+ writeGroupFile(group.root, {
48
+ name: group.name,
49
+ repos: group.repos.filter((repo) => repo !== path),
50
+ hosts: group.hosts
51
+ });
52
+ return loadGroup(group.root);
53
+ }
54
+ // src/hook/session-start.ts
55
+ function handleSessionStart(carnet, payload, env) {
56
+ const session = carnet.sessions.upsertFromHook(payload, env);
57
+ carnet.sessions.purge(session.id, purgeDays(env.RUCHER_PURGE_DAYS));
58
+ if (payload.source !== "resume") return { session };
59
+ return {
60
+ session,
61
+ additionalContext: resumeContext(carnet, session)
62
+ };
63
+ }
64
+ // src/hook/user-prompt-submit.ts
65
+ function handleUserPromptSubmit(carnet, host, payload) {
66
+ carnet.sessions.ensure(payload.session_id, payload.cwd);
67
+ return carnet.sessions.adoptTitle(payload.session_id, host.promptTitle(payload));
68
+ }
69
+ export { AGENT_STATUSES, Carnet, CarnetError, DB_FILE, DEFAULT_HOST, DEFAULT_PURGE_DAYS, EMOJI, EVENT_TYPES, GROUP_DIRECTORY, GROUP_FILE, LEGEND, MAIN_WORKING_EMOJI, MAIN_WORKING_SUFFIX, MEMORY_DB, MINIMUM_ID_PREFIX, NOTE_MAX, PAIRING_WINDOW_MILLISECONDS, PUBLISH_FALLBACK_MILLISECONDS, REPORTING_NOTE, REPORTS_DIRECTORY, REPOS_END, REPOS_START, RESUME_EVENTS, RESUME_MAX_CHARACTERS, STOPPED_NOTE, USER_ACTION_STATUSES, addGroupRepo, allHosts, buildStatusView, claudeCode, findGroupRoot, formatClock, formatEventLine, groupInstructions, groupSettings, handleSessionStart, handleUserPromptSubmit, hostById, initGroup, isAgentStatus, isEventType, isGroupRoot, isInside, isUserActionStatus, loadGroup, locateGroup, migrate, migrations, openCarnet, openDatabase, purgeDays, readRegistry, registerGroup, removeGroupRepo, renderAgentLine, renderSections, renderStatus, renderTableLine, replaceReposBlock, repoNameFor, repoPathFor, reportPathFor, reportsDirectoryOf, reposBlock, resumeContext, rucherHome, sanitizeNote, schemaVersion, sessionLabel, shortId, transcriptTitle, unregisterGroups };
70
+
71
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/group/init.ts","../src/hook/session-start.ts","../src/hook/user-prompt-submit.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport { basename, join, resolve } from 'node:path';\nimport { CarnetError } from '../errors.ts';\nimport { openDatabase } from '../db/open.ts';\nimport { DEFAULT_HOST, hostById } from '../hosts/host.ts';\nimport {\n DB_FILE,\n GROUP_DIRECTORY,\n GROUP_FILE,\n REPORTS_DIRECTORY,\n type Group,\n type GroupFile,\n loadGroup,\n} from './locate.ts';\nimport { registerGroup } from './registry.ts';\n\nexport interface InitOptions {\n name?: string | undefined;\n repos?: string[] | undefined;\n hosts?: string[] | undefined;\n env?: NodeJS.ProcessEnv | undefined;\n}\n\nfunction writeGroupFile(root: string, file: GroupFile): void {\n writeFileSync(join(root, GROUP_DIRECTORY, GROUP_FILE), `${JSON.stringify(file, null, 2)}\\n`);\n}\n\nfunction resolveRepo(root: string, repo: string): string {\n const path = resolve(root, repo);\n if (!existsSync(path))\n throw new CarnetError('REPO_NOT_FOUND', `Repo path does not exist: ${path}`);\n return path;\n}\n\nexport function initGroup(directory: string, options: InitOptions = {}): Group {\n const root = resolve(directory);\n const groupDirectory = join(root, GROUP_DIRECTORY);\n if (existsSync(groupDirectory)) {\n throw new CarnetError('GROUP_EXISTS', `${root} is already a Rucher group`);\n }\n const name = options.name ?? basename(root);\n const repos = (options.repos ?? []).map((repo) => resolveRepo(root, repo));\n const hosts = (options.hosts?.length ? options.hosts : [DEFAULT_HOST]).map(\n (id) => hostById(id).id,\n );\n mkdirSync(join(groupDirectory, REPORTS_DIRECTORY), { recursive: true });\n writeGroupFile(root, { name, repos, hosts });\n openDatabase(join(groupDirectory, DB_FILE)).close();\n registerGroup({ name, path: root }, options.env);\n return loadGroup(root);\n}\n\nexport function addGroupRepo(root: string, repo: string): Group {\n const group = loadGroup(resolve(root));\n const path = resolveRepo(group.root, repo);\n if (!group.repos.includes(path)) {\n writeGroupFile(group.root, {\n name: group.name,\n repos: [...group.repos, path],\n hosts: group.hosts,\n });\n }\n return loadGroup(group.root);\n}\n\nexport function removeGroupRepo(root: string, repo: string): Group {\n const group = loadGroup(resolve(root));\n const path = resolve(group.root, repo);\n if (!group.repos.includes(path)) {\n throw new CarnetError('REPO_NOT_FOUND', `${path} is not a repo of ${group.name}`);\n }\n writeGroupFile(group.root, {\n name: group.name,\n repos: group.repos.filter((repo) => repo !== path),\n hosts: group.hosts,\n });\n return loadGroup(group.root);\n}\n","import type { Carnet } from '../carnet.ts';\nimport { purgeDays } from '../purge.ts';\nimport { resumeContext } from '../resume.ts';\nimport type { HookEnv, HookSessionPayload, Session } from '../sessions.ts';\n\nexport interface SessionStartResult {\n session: Session;\n additionalContext?: string;\n}\n\nexport function handleSessionStart(\n carnet: Carnet,\n payload: HookSessionPayload,\n env: HookEnv,\n): SessionStartResult {\n const session = carnet.sessions.upsertFromHook(payload, env);\n carnet.sessions.purge(session.id, purgeDays(env.RUCHER_PURGE_DAYS));\n if (payload.source !== 'resume') return { session };\n return { session, additionalContext: resumeContext(carnet, session) };\n}\n","import type { Carnet } from '../carnet.ts';\nimport type { Host, HostPromptPayload } from '../hosts/host.ts';\nimport type { Session } from '../sessions.ts';\n\nexport function handleUserPromptSubmit(\n carnet: Carnet,\n host: Host,\n payload: HostPromptPayload,\n): Session {\n carnet.sessions.ensure(payload.session_id, payload.cwd);\n return carnet.sessions.adoptTitle(payload.session_id, host.promptTitle(payload));\n}\n"],"mappings":";;;;AAuBA,SAAS,eAAe,MAAc,MAAuB;CAC3D,cAAc,KAAK,MAAM,iBAAiB,UAAU,GAAG,GAAG,KAAK,UAAU,MAAM,MAAM,CAAC,EAAE,GAAG;AAC7F;AAEA,SAAS,YAAY,MAAc,MAAsB;CACvD,MAAM,OAAO,QAAQ,MAAM,IAAI;CAC/B,IAAI,CAAC,WAAW,IAAI,GAClB,MAAM,IAAI,YAAY,kBAAkB,6BAA6B,MAAM;CAC7E,OAAO;AACT;AAEA,SAAgB,UAAU,WAAmB,UAAuB,CAAC,GAAU;CAC7E,MAAM,OAAO,QAAQ,SAAS;CAC9B,MAAM,iBAAiB,KAAK,MAAM,eAAe;CACjD,IAAI,WAAW,cAAc,GAC3B,MAAM,IAAI,YAAY,gBAAgB,GAAG,KAAK,2BAA2B;CAE3E,MAAM,OAAO,QAAQ,QAAQ,SAAS,IAAI;CAC1C,MAAM,SAAS,QAAQ,SAAS,CAAC,EAAA,CAAG,KAAK,SAAS,YAAY,MAAM,IAAI,CAAC;CACzE,MAAM,SAAS,QAAQ,OAAO,SAAS,QAAQ,QAAQ,CAAC,YAAY,EAAA,CAAG,KACpE,OAAO,SAAS,EAAE,CAAC,CAAC,EACvB;CACA,UAAU,KAAK,gBAAgB,iBAAiB,GAAG,EAAE,WAAW,KAAK,CAAC;CACtE,eAAe,MAAM;EAAE;EAAM;EAAO;CAAM,CAAC;CAC3C,aAAa,KAAK,gBAAgB,OAAO,CAAC,CAAC,CAAC,MAAM;CAClD,cAAc;EAAE;EAAM,MAAM;CAAK,GAAG,QAAQ,GAAG;CAC/C,OAAO,UAAU,IAAI;AACvB;AAEA,SAAgB,aAAa,MAAc,MAAqB;CAC9D,MAAM,QAAQ,UAAU,QAAQ,IAAI,CAAC;CACrC,MAAM,OAAO,YAAY,MAAM,MAAM,IAAI;CACzC,IAAI,CAAC,MAAM,MAAM,SAAS,IAAI,GAC5B,eAAe,MAAM,MAAM;EACzB,MAAM,MAAM;EACZ,OAAO,CAAC,GAAG,MAAM,OAAO,IAAI;EAC5B,OAAO,MAAM;CACf,CAAC;CAEH,OAAO,UAAU,MAAM,IAAI;AAC7B;AAEA,SAAgB,gBAAgB,MAAc,MAAqB;CACjE,MAAM,QAAQ,UAAU,QAAQ,IAAI,CAAC;CACrC,MAAM,OAAO,QAAQ,MAAM,MAAM,IAAI;CACrC,IAAI,CAAC,MAAM,MAAM,SAAS,IAAI,GAC5B,MAAM,IAAI,YAAY,kBAAkB,GAAG,KAAK,oBAAoB,MAAM,MAAM;CAElF,eAAe,MAAM,MAAM;EACzB,MAAM,MAAM;EACZ,OAAO,MAAM,MAAM,QAAQ,SAAS,SAAS,IAAI;EACjD,OAAO,MAAM;CACf,CAAC;CACD,OAAO,UAAU,MAAM,IAAI;AAC7B;;ACnEA,SAAgB,mBACd,QACA,SACA,KACoB;CACpB,MAAM,UAAU,OAAO,SAAS,eAAe,SAAS,GAAG;CAC3D,OAAO,SAAS,MAAM,QAAQ,IAAI,UAAU,IAAI,iBAAiB,CAAC;CAClE,IAAI,QAAQ,WAAW,UAAU,OAAO,EAAE,QAAQ;CAClD,OAAO;EAAE;EAAS,mBAAmB,cAAc,QAAQ,OAAO;CAAE;AACtE;;ACfA,SAAgB,uBACd,QACA,MACA,SACS;CACT,OAAO,SAAS,OAAO,QAAQ,YAAY,QAAQ,GAAG;CACtD,OAAO,OAAO,SAAS,WAAW,QAAQ,YAAY,KAAK,YAAY,OAAO,CAAC;AACjF"}
package/dist/mcp.d.mts ADDED
@@ -0,0 +1,40 @@
1
+ import { D as Host, r as OpenCarnetOptions, t as Carnet } from "./carnet-CSdqWDas.mjs";
2
+ import { McpServer } from "@modelcontextprotocol/server";
3
+ import { StdioServerHandle } from "@modelcontextprotocol/server/stdio";
4
+ import * as z from "zod/v4";
5
+ export declare const INSTRUCTIONS = "Carnet tracks the status of sub-agents (forks) for the human, in a shared database. Views are rendered by the `rucher` CLI.\n\nRules:\n- Never write status files (agents-status.md or similar) and never describe status updates in the chat. When a fork finishes, the main agent says only \"<name> finished, report ready\".\n- Update BEFORE and AFTER each piece of work, never batched at the end of a turn.\n- Your session is resolved automatically. Pass `session` only to target another session.\n\nMain agent:\n- agent_start before dispatching a fork (name, task), in an earlier message than the launch; launch parallel forks in the same order. Names are short, no paths.\n- table_set with main_working=true before applying, testing or fixing yourself; table_set with a status (or table_clear) when done.\n- log_event when a step is answered, applied, tested, committed or dropped.\n- When a fork finishes: say one line \"<name> finished, report ready\", copy its report to the report destination agent_start gave (.rucher/reports/<name>.md in the group meta directory) and call agent_update with that report_path. Present the report only when asked.\n- For dispatching, applying or reviewing forks, load the rucher skill: it holds the full workflow.\n- agent_drop when a fork's work is committed or abandoned. queue_reorder to change the handling order.\n- agent_list to recall where things stand.\n- Sessions: session_new when the human names this session (then ask them to /rename it the same way); session_list, session_resume_info and log_read to recall other sessions or the journal; session_drop only when the human asks.\n\nForks:\n- agent_update (status running, short note) at meaningful progress.\n- agent_done with the report path as your LAST tool action; has_questions=true when the report asks the human something. Then reply with one line only: the report holds the detail.\n- Never agent_start, never table_set.\n\nStatuses (emoji shown to the human = the NEXT action): running ⏳ fork working · discussing 💬 · answer ❓ human must answer · review 👀 human must review · apply 📥 · test 🧪 · commit ✅ · branch 🌿. Only the human applies, tests and commits.\n\nNotes and table text: under 60 characters, no paths, no backticks.";
6
+ interface SessionResolverOptions {
7
+ carnet: Carnet;
8
+ env?: NodeJS.ProcessEnv | undefined;
9
+ ppid?: number | undefined;
10
+ cwd?: string | undefined;
11
+ host?: Host | undefined;
12
+ }
13
+ interface SessionResolver {
14
+ resolve(override?: string): string;
15
+ }
16
+ export declare function createSessionResolver({ carnet, env, ppid, cwd, host }: SessionResolverOptions): SessionResolver;
17
+ export declare const SERVER_NAME = "carnet";
18
+ export declare const SERVER_VERSION = "0.0.0";
19
+ interface CarnetServerOptions extends Omit<SessionResolverOptions, 'carnet'> {
20
+ carnet: Carnet | (() => Carnet);
21
+ }
22
+ export declare function createCarnetServer(options: CarnetServerOptions): McpServer;
23
+ interface ServeCarnetOptions extends OpenCarnetOptions {
24
+ carnet?: Carnet;
25
+ ppid?: number;
26
+ }
27
+ export declare function serveCarnet(options?: ServeCarnetOptions): StdioServerHandle;
28
+ interface ToolOutput {
29
+ text: string;
30
+ data?: Record<string, unknown>;
31
+ }
32
+ interface ToolDefinition<Schema extends z.ZodObject = z.ZodObject> {
33
+ name: string;
34
+ description: string;
35
+ schema: Schema;
36
+ run: (carnet: Carnet, sessionId: string, args: z.infer<Schema>) => ToolOutput;
37
+ }
38
+ export declare const TOOLS: readonly ToolDefinition[];
39
+ export type { CarnetServerOptions, ServeCarnetOptions, SessionResolver, SessionResolverOptions, ToolDefinition, ToolOutput };
40
+ //# sourceMappingURL=mcp.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.d.mts","names":[],"sources":["../src/mcp/instructions.ts","../src/mcp/session.ts","../src/mcp/server.ts","../src/mcp/tools.ts"],"mappings":";;;;qBAAa;UCMI;EACf,QAAQ;EACR,MAAM,OAAO;EACb;EACA;EACA,OAAO;;UAGQ;EACf,QAAQ;;wBAGM,wBACd,QACA,KACA,MACA,KACA,QACC,yBAAyB;qBCXf;qBACA;UAEI,4BAA4B,KAAK;EAChD,QAAQ,gBAAgB;;wBAOV,mBAAmB,SAAS,sBAAsB;UAgCjD,2BAA2B;EAC1C,SAAS;EACT;;wBAGc,YAAY,UAAS,qBAA0B;UCnD9C;EACf;EACA,OAAO;;UAGQ,eAAe,eAAe,EAAE,YAAY,EAAE;EAC7D;EACA;EACA,QAAQ;EACR,MAAM,QAAQ,QAAQ,mBAAmB,MAAM,EAAE,MAAM,YAAY;;qBAoSxD,gBAAgB"}