@rucher/carnet 0.2.0-beta.4 → 0.2.0-beta.6
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/README.md +2 -2
- package/dist/{carnet-DptiZiz8.d.mts → carnet-DHw_oXJs.d.mts} +47 -48
- package/dist/carnet-DHw_oXJs.d.mts.map +1 -0
- package/dist/index.d.mts +24 -25
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +20 -20
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.d.mts +2 -2
- package/dist/mcp.mjs +15 -15
- package/dist/mcp.mjs.map +1 -1
- package/dist/{steps-BeTGxQk4.mjs → steps-4ZTrBzcd.mjs} +256 -260
- package/dist/steps-4ZTrBzcd.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/carnet-DptiZiz8.d.mts.map +0 -1
- package/dist/steps-BeTGxQk4.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# @rucher/carnet
|
|
2
2
|
|
|
3
|
-
Shared state for Rucher:
|
|
3
|
+
Shared state for Rucher: workspaces, sessions, agents, the "On the table" line and the event journal, stored in one SQLite database for every workspace (`~/.local/share/rucher/carnet.db`, via `node:sqlite`), with workspaces defined in `~/.config/rucher/workspaces/<name>/workspace.json`.
|
|
4
4
|
|
|
5
5
|
Used by the `rucher` CLI and the Carnet MCP server. See [`docs/reference.md`](https://github.com/Florian-Varrin/Rucher/blob/master/docs/reference.md) in the [repository](https://github.com/Florian-Varrin/Rucher).
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
import { openCarnet } from '@rucher/carnet';
|
|
9
9
|
|
|
10
|
-
const carnet = openCarnet({
|
|
10
|
+
const carnet = openCarnet({ workspace: 'shop' });
|
|
11
11
|
const session = carnet.sessions.default();
|
|
12
12
|
if (session) console.log(carnet.status.render(session));
|
|
13
13
|
```
|
|
@@ -2,7 +2,7 @@ import { DatabaseSync } from "node:sqlite";
|
|
|
2
2
|
interface Ctx {
|
|
3
3
|
db: DatabaseSync;
|
|
4
4
|
now: () => Date;
|
|
5
|
-
|
|
5
|
+
workspace: string | null;
|
|
6
6
|
}
|
|
7
7
|
declare const AGENT_STATUSES: readonly ['running', 'discussing', 'answer', 'review', 'apply', 'test', 'commit', 'branch', 'closed'];
|
|
8
8
|
type AgentStatus = (typeof AGENT_STATUSES)[number];
|
|
@@ -50,71 +50,69 @@ interface ListAgentsOptions {
|
|
|
50
50
|
}
|
|
51
51
|
declare const REPORTING_NOTE = "reporting";
|
|
52
52
|
declare const PUBLISH_FALLBACK_MILLISECONDS = 120000;
|
|
53
|
-
interface
|
|
53
|
+
interface WorkspaceRepo {
|
|
54
54
|
path: string;
|
|
55
55
|
name: string;
|
|
56
56
|
}
|
|
57
|
-
interface
|
|
57
|
+
interface Workspace {
|
|
58
58
|
name: string;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
repos:
|
|
59
|
+
definition: string;
|
|
60
|
+
runDirectory: string;
|
|
61
|
+
repos: WorkspaceRepo[];
|
|
62
62
|
backends: Record<string, {
|
|
63
63
|
settings?: Record<string, unknown>;
|
|
64
64
|
}>;
|
|
65
65
|
}
|
|
66
|
-
interface
|
|
66
|
+
interface WorkspaceFile {
|
|
67
67
|
name?: string | undefined;
|
|
68
|
-
workspace?: string | undefined;
|
|
69
68
|
repos?: {
|
|
70
69
|
path: string;
|
|
71
70
|
name?: string | undefined;
|
|
72
71
|
}[] | undefined;
|
|
73
|
-
backends?:
|
|
72
|
+
backends?: Workspace['backends'] | undefined;
|
|
74
73
|
}
|
|
75
|
-
declare const
|
|
74
|
+
declare const WORKSPACE_FILE = "workspace.json";
|
|
76
75
|
declare const INSTRUCTIONS_FILE = "CLAUDE.md";
|
|
77
76
|
declare const AGENTS_FILE = "AGENTS.md";
|
|
78
|
-
declare function
|
|
77
|
+
declare function isWorkspaceName(name: string): boolean;
|
|
79
78
|
declare function expandHome(path: string, env?: NodeJS.ProcessEnv): string;
|
|
80
|
-
declare function
|
|
81
|
-
declare function
|
|
82
|
-
declare function
|
|
83
|
-
declare function
|
|
84
|
-
interface
|
|
79
|
+
declare function workspaceExists(name: string, env?: NodeJS.ProcessEnv): boolean;
|
|
80
|
+
declare function loadWorkspace(name: string, env?: NodeJS.ProcessEnv): Workspace;
|
|
81
|
+
declare function listWorkspaces(env?: NodeJS.ProcessEnv): Workspace[];
|
|
82
|
+
declare function workspaceHosts(workspace: Workspace): string[];
|
|
83
|
+
interface CreateWorkspaceOptions {
|
|
85
84
|
repos?: readonly string[] | undefined;
|
|
86
85
|
env?: NodeJS.ProcessEnv | undefined;
|
|
87
86
|
}
|
|
88
|
-
declare function
|
|
89
|
-
declare function
|
|
90
|
-
declare function
|
|
91
|
-
declare function
|
|
92
|
-
|
|
93
|
-
interface DropGroupOptions {
|
|
87
|
+
declare function createWorkspace(name: string, options?: CreateWorkspaceOptions): Workspace;
|
|
88
|
+
declare function definitionInstructions(workspace: Workspace): string;
|
|
89
|
+
declare function addWorkspaceRepo(name: string, repo: string, env?: NodeJS.ProcessEnv): Workspace;
|
|
90
|
+
declare function removeWorkspaceRepo(name: string, repo: string, env?: NodeJS.ProcessEnv): Workspace;
|
|
91
|
+
interface DropWorkspaceOptions {
|
|
94
92
|
purge?: boolean | undefined;
|
|
95
93
|
env?: NodeJS.ProcessEnv | undefined;
|
|
96
94
|
}
|
|
97
|
-
declare function
|
|
95
|
+
declare function dropWorkspace(name: string, options?: DropWorkspaceOptions): Workspace;
|
|
98
96
|
declare function isInside(directory: string, path: string): boolean;
|
|
99
|
-
declare function repoNameFor(
|
|
100
|
-
declare function repoPathFor(
|
|
101
|
-
type
|
|
102
|
-
interface
|
|
103
|
-
|
|
104
|
-
origin:
|
|
105
|
-
repo?:
|
|
106
|
-
}
|
|
107
|
-
interface
|
|
97
|
+
declare function repoNameFor(workspace: Workspace | null, path: string | undefined): string | null;
|
|
98
|
+
declare function repoPathFor(workspace: Workspace | null, path: string | undefined | null): string | null;
|
|
99
|
+
type WorkspaceOrigin = 'session' | 'option' | 'env' | 'run-directory' | 'repo' | 'none';
|
|
100
|
+
interface WorkspaceResolution {
|
|
101
|
+
workspace: Workspace | null;
|
|
102
|
+
origin: WorkspaceOrigin;
|
|
103
|
+
repo?: WorkspaceRepo | undefined;
|
|
104
|
+
}
|
|
105
|
+
interface ResolveWorkspaceOptions {
|
|
108
106
|
db?: DatabaseSync | undefined;
|
|
109
107
|
sessionId?: string | undefined;
|
|
110
|
-
|
|
108
|
+
workspace?: string | undefined;
|
|
111
109
|
cwd?: string | undefined;
|
|
112
110
|
env?: NodeJS.ProcessEnv | undefined;
|
|
113
111
|
}
|
|
114
|
-
declare function
|
|
115
|
-
declare function
|
|
116
|
-
declare function
|
|
117
|
-
declare function
|
|
112
|
+
declare function resolveWorkspace({ db, sessionId, workspace, cwd, env }?: ResolveWorkspaceOptions): WorkspaceResolution;
|
|
113
|
+
declare function workspaceLabel(workspace: Workspace | null): string;
|
|
114
|
+
declare function requireWorkspace(workspace: Workspace | null): Workspace;
|
|
115
|
+
declare function ambiguousWorkspaceContext(reason: string): string;
|
|
118
116
|
interface HostSessionPayload {
|
|
119
117
|
session_id: string;
|
|
120
118
|
cwd?: string | undefined;
|
|
@@ -181,7 +179,8 @@ interface Host {
|
|
|
181
179
|
forkCommand(parent: Session, options?: LaunchOptions): ResumeCommand;
|
|
182
180
|
renameInstruction(name: string): string;
|
|
183
181
|
transcriptFiles(session: Session, env?: NodeJS.ProcessEnv): string[];
|
|
184
|
-
|
|
182
|
+
hasConversation(session: Session, env?: NodeJS.ProcessEnv): boolean;
|
|
183
|
+
renderRunDirectory(workspace: Workspace): HostRender;
|
|
185
184
|
}
|
|
186
185
|
declare const DEFAULT_HOST = "claude-code";
|
|
187
186
|
declare function allHosts(): Host[];
|
|
@@ -190,7 +189,7 @@ type SessionKind = 'active' | 'temp';
|
|
|
190
189
|
type SessionStatus = 'running' | 'idle' | 'archived';
|
|
191
190
|
interface Session {
|
|
192
191
|
id: string;
|
|
193
|
-
|
|
192
|
+
workspace: string | null;
|
|
194
193
|
name: string | null;
|
|
195
194
|
purpose: string | null;
|
|
196
195
|
kind: SessionKind;
|
|
@@ -342,7 +341,7 @@ interface CiteNoteInput {
|
|
|
342
341
|
session?: string | null | undefined;
|
|
343
342
|
agent?: string | null | undefined;
|
|
344
343
|
}
|
|
345
|
-
declare function
|
|
344
|
+
declare function workspaceRepoNames(workspace: Workspace): string[];
|
|
346
345
|
declare function similarity(first: string, second: string): number;
|
|
347
346
|
declare function localDay(date: Date): string;
|
|
348
347
|
type NoteActivityKind = 'added' | 'cited' | 'dropped';
|
|
@@ -402,11 +401,11 @@ interface CarnetOptions {
|
|
|
402
401
|
now?: () => Date;
|
|
403
402
|
}
|
|
404
403
|
declare class Carnet {
|
|
405
|
-
readonly
|
|
404
|
+
readonly workspace: Workspace | null;
|
|
406
405
|
readonly db: DatabaseSync;
|
|
407
406
|
private readonly ctx;
|
|
408
|
-
constructor(db: DatabaseSync,
|
|
409
|
-
|
|
407
|
+
constructor(db: DatabaseSync, workspace: Workspace | null, options?: CarnetOptions);
|
|
408
|
+
requireWorkspace(): Workspace;
|
|
410
409
|
readonly sessions: {
|
|
411
410
|
get: (id: string) => Session | undefined;
|
|
412
411
|
find: (reference: string) => Session;
|
|
@@ -480,7 +479,7 @@ declare class Carnet {
|
|
|
480
479
|
close(): void;
|
|
481
480
|
}
|
|
482
481
|
interface OpenCarnetOptions extends CarnetOptions {
|
|
483
|
-
|
|
482
|
+
workspace?: string | undefined;
|
|
484
483
|
sessionId?: string | undefined;
|
|
485
484
|
cwd?: string | undefined;
|
|
486
485
|
env?: NodeJS.ProcessEnv | undefined;
|
|
@@ -489,9 +488,9 @@ interface OpenCarnetOptions extends CarnetOptions {
|
|
|
489
488
|
declare function openCarnet(options?: OpenCarnetOptions): Carnet;
|
|
490
489
|
interface ResolvedCarnet {
|
|
491
490
|
carnet: Carnet;
|
|
492
|
-
resolution:
|
|
491
|
+
resolution: WorkspaceResolution;
|
|
493
492
|
}
|
|
494
493
|
declare function openResolvedCarnet(options?: OpenCarnetOptions): ResolvedCarnet;
|
|
495
|
-
declare function
|
|
496
|
-
export { CarnetEvent as $,
|
|
497
|
-
//# sourceMappingURL=carnet-
|
|
494
|
+
declare function openWorkspaceCarnet(workspace: Workspace | null, options?: OpenCarnetOptions): Carnet;
|
|
495
|
+
export { CarnetEvent as $, isWorkspaceName as $t, AddNoteResult as A, ResolveWorkspaceOptions as At, NoteActivityKind as B, AGENTS_FILE as Bt, memoryMaxCharacters as C, HostSessionPayload as Ct, buildStatusView as D, ResumeCommand as Dt, StatusView as E, LaunchOptions as Et, ListNotesOptions as F, repoNameFor as Ft, WeightedNote as G, Workspace as Gt, NoteDetail as H, DropWorkspaceOptions as Ht, NOTE_KINDS as I, repoPathFor as It, memoryHalfLife as J, addWorkspaceRepo as Jt, isNoteKind as K, WorkspaceFile as Kt, NOTE_TEXT_LIMIT as L, requireWorkspace as Lt, DEFAULT_HALF_LIFE_DAYS as M, WorkspaceResolution as Mt, DUPLICATE_SIMILARITY as N, ambiguousWorkspaceContext as Nt, formatClock as O, allHosts as Ot, DropNoteInput as P, isInside as Pt, AgentEventType as Q, expandHome as Qt, Note as R, resolveWorkspace as Rt, MemoryOptions as S, HostSessionEndPayload as St, StatusLine as T, HostToolPayload as Tt, NoteKind as U, INSTRUCTIONS_FILE as Ut, NoteCitation as V, CreateWorkspaceOptions as Vt, STALE_AFTER_ACTIVE_DAYS as W, WORKSPACE_FILE as Wt, similarity as X, definitionInstructions as Xt, sessionNoteActivity as Y, createWorkspace as Yt, workspaceRepoNames as Z, dropWorkspace as Zt, renderNotesSummary as _, OPEN_AGENT_STATUSES as _n, shortId as _t, openCarnet as a, Agent as an, isEventType as at, renderTableLine as b, isAgentStatus as bn, HostPromptPayload as bt, MAIN_WORKING_SUFFIX as c, PUBLISH_FALLBACK_MILLISECONDS as cn, MergeResult as ct, NotesMode as d, UpdateAgentInput as dn, HookSessionPayload as dt, listWorkspaces as en, EVENT_TYPES as et, RenderOptions as f, AGENT_STATUSES as fn, ListSessionsOptions as ft, renderNotes as g, MAIN_WORKING_EMOJI as gn, SessionStatus as gt, renderNoteLine as h, LEGEND as hn, SessionKind as ht, ResolvedCarnet as i, workspaceHosts as in, SessionEventType as it, CiteNoteInput as j, WorkspaceOrigin as jt, AddNoteInput as k, hostById as kt, NOTES_FOLD_LINES as l, REPORTING_NOTE as ln, CreateSessionInput as lt, renderAgentLine as m, EMOJI as mn, Session as mt, CarnetOptions as n, removeWorkspaceRepo as nn, LogEventInput as nt, openResolvedCarnet as o, FinishAgentInput as on, SetTableInput as ot, SIMILAR_PREFIX as p, AgentStatus as pn, MINIMUM_ID_PREFIX as pt, localDay as q, WorkspaceRepo as qt, OpenCarnetOptions as r, workspaceExists as rn, SESSION_EVENT_TYPES as rt, openWorkspaceCarnet as s, ListAgentsOptions as sn, TableItem as st, Carnet as t, loadWorkspace as tn, EventType as tt, NOTES_HEADER as u, StartAgentInput as un, HookEnv as ut, renderSections as v, USER_ACTION_STATUSES as vn, DEFAULT_HOST as vt, renderMemory as w, HostSubagentPayload as wt, MEMORY_MAX_CHARACTERS as x, isUserActionStatus as xn, HostRender as xt, renderStatus as y, UserActionStatus as yn, Host as yt, NoteActivity as z, workspaceLabel as zt };
|
|
496
|
+
//# sourceMappingURL=carnet-DHw_oXJs.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carnet-DHw_oXJs.d.mts","names":["_$__merge_ts0.MergeResult","_$__agents_ts0.Agent","_$__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/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/table.ts","../src/events.ts","../src/notes.ts","../src/status/view.ts","../src/memory.ts","../src/status/render.ts","../src/carnet.ts"],"mappings":";UAEiB;EACf,IAAI;EACJ,WAAW;EAEX;;cCNW;KAYD,sBAAsB;cAErB;KAUD,2BAA2B;cAE1B,OAAO,OAAO,QAAQ;cAWtB;cAEA;iBAGG,cAAc,iBAAiB,SAAS;iBAIxC,mBAAmB,iBAAiB,SAAS;cAIhD;UC5CI;EACf;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf,QAAQ;EACR;EACA;;UAGe;EACf;EACA;;UAGe;EACf;;cAuCW;cACA;UC3EI;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA,OAAO;EACP,UAAU;IAAiB,WAAW;;;UAGvB;EACf;EACA;IAAU;IAAc;;EACxB,WAAW;;cAGA;cACA;cACA;iBAGG,gBAAgB;iBAahB,WAAW,cAAc,MAAK,OAAO;iBASrC,gBAAgB,cAAc,MAAM,OAAO;iBAkB3C,cAAc,cAAc,MAAK,OAAO,aAA2B;iBAcnE,eAAe,MAAK,OAAO,aAA2B;iBAStD,eAAe,WAAW;UAwBzB;EACf;EACA,MAAM,OAAO;;iBAGC,gBAAgB,cAAc,UAAS,yBAA8B;iBAkBrE,uBAAuB,WAAW;iBAWlC,iBAAiB,cAAc,cAAc,MAAM,OAAO,aAAa;iBAcvE,oBACd,cACA,cACA,MAAM,OAAO,aACZ;UAgBc;EACf;EACA,MAAM,OAAO;;iBAGC,cAAc,cAAc,UAAS,uBAA4B;iBChLjE,SAAS,mBAAmB;iBAa5B,YAAY,WAAW,kBAAkB;iBAIzC,YACd,WAAW,kBACX;KASU;UAEK;EACf,WAAW;EACX,QAAQ;EACR,OAAO;;UAGQ;EACf,KAAK;EACL;EACA;EACA;EACA,MAAM,OAAO;;iBA6CC,mBACd,IACA,WACA,WACA,KACA,QACC,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IACb,MAAG,eADsBC;IAEzB,OAAI,YAAa,0BADDC;IAEhB,OAAI,UAAa,qBAAAC;IACjB,QAAK,0BAD4BA;IAEjC,OAAI,YAAa,OAAS,kBAAAF;IAC1B,OAAI,YAAa,OAAS,kBAAAG;IAC1B;IACA,WAAQ,oBAF+BC;;WAKhC;IACP,UAAO,SAAY,SAAO,UAAY;IAEtC,YAAS,SAAY,SAAO,UAAY;IAExC,UAAO,SAAY,SAAO,cAAc,UAAY;IAEpD,YAAS,cAAe;;WAGjB;IACP,OAAI,SAAY,YAAAC;IAChB,SAAM,SAAY,SAAO,UAAY;IAErC,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 CarnetEvent, $t as
|
|
1
|
+
import { $ as CarnetEvent, $t as isWorkspaceName, A as AddNoteResult, At as ResolveWorkspaceOptions, B as NoteActivityKind, Bt as AGENTS_FILE, C as memoryMaxCharacters, Ct as HostSessionPayload, D as buildStatusView, Dt as ResumeCommand, E as StatusView, Et as LaunchOptions, F as ListNotesOptions, Ft as repoNameFor, G as WeightedNote, Gt as Workspace, H as NoteDetail, Ht as DropWorkspaceOptions, I as NOTE_KINDS, It as repoPathFor, J as memoryHalfLife, Jt as addWorkspaceRepo, K as isNoteKind, Kt as WorkspaceFile, L as NOTE_TEXT_LIMIT, Lt as requireWorkspace, M as DEFAULT_HALF_LIFE_DAYS, Mt as WorkspaceResolution, N as DUPLICATE_SIMILARITY, Nt as ambiguousWorkspaceContext, O as formatClock, Ot as allHosts, P as DropNoteInput, Pt as isInside, Q as AgentEventType, Qt as expandHome, R as Note, Rt as resolveWorkspace, S as MemoryOptions, St as HostSessionEndPayload, T as StatusLine, Tt as HostToolPayload, U as NoteKind, Ut as INSTRUCTIONS_FILE, V as NoteCitation, Vt as CreateWorkspaceOptions, W as STALE_AFTER_ACTIVE_DAYS, Wt as WORKSPACE_FILE, X as similarity, Xt as definitionInstructions, Y as sessionNoteActivity, Yt as createWorkspace, Z as workspaceRepoNames, Zt as dropWorkspace, _ as renderNotesSummary, _n as OPEN_AGENT_STATUSES, _t as shortId, a as openCarnet, an as Agent, at as isEventType, b as renderTableLine, bn as isAgentStatus, bt as HostPromptPayload, c as MAIN_WORKING_SUFFIX, cn as PUBLISH_FALLBACK_MILLISECONDS, ct as MergeResult, d as NotesMode, dn as UpdateAgentInput, dt as HookSessionPayload, en as listWorkspaces, et as EVENT_TYPES, f as RenderOptions, fn as AGENT_STATUSES, ft as ListSessionsOptions, g as renderNotes, gn as MAIN_WORKING_EMOJI, gt as SessionStatus, h as renderNoteLine, hn as LEGEND, ht as SessionKind, i as ResolvedCarnet, in as workspaceHosts, it as SessionEventType, j as CiteNoteInput, jt as WorkspaceOrigin, k as AddNoteInput, kt as hostById, l as NOTES_FOLD_LINES, ln as REPORTING_NOTE, lt as CreateSessionInput, m as renderAgentLine, mn as EMOJI, mt as Session, n as CarnetOptions, nn as removeWorkspaceRepo, nt as LogEventInput, o as openResolvedCarnet, on as FinishAgentInput, ot as SetTableInput, p as SIMILAR_PREFIX, pn as AgentStatus, pt as MINIMUM_ID_PREFIX, q as localDay, qt as WorkspaceRepo, r as OpenCarnetOptions, rn as workspaceExists, rt as SESSION_EVENT_TYPES, s as openWorkspaceCarnet, sn as ListAgentsOptions, st as TableItem, t as Carnet, tn as loadWorkspace, tt as EventType, u as NOTES_HEADER, un as StartAgentInput, ut as HookEnv, v as renderSections, vn as USER_ACTION_STATUSES, vt as DEFAULT_HOST, w as renderMemory, wt as HostSubagentPayload, x as MEMORY_MAX_CHARACTERS, xn as isUserActionStatus, xt as HostRender, y as renderStatus, yn as UserActionStatus, yt as Host, z as NoteActivity, zt as workspaceLabel } from "./carnet-DHw_oXJs.mjs";
|
|
2
2
|
import { DatabaseSync } from "node:sqlite";
|
|
3
3
|
interface MoveOptions {
|
|
4
4
|
merge?: boolean | undefined;
|
|
@@ -13,18 +13,17 @@ interface MoveResult {
|
|
|
13
13
|
movedTable: boolean;
|
|
14
14
|
keptNotes: number;
|
|
15
15
|
}
|
|
16
|
-
export declare function moveSession(carnet: Carnet, sessionId: string,
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function groupSessionCounts(db: DatabaseSync): Map<string, number>;
|
|
16
|
+
export declare function moveSession(carnet: Carnet, sessionId: string, targetWorkspace: string, options?: MoveOptions): MoveResult;
|
|
17
|
+
export declare function sessionWorkspaceName(db: DatabaseSync, sessionId: string): string | null | undefined;
|
|
18
|
+
export declare function archiveWorkspaceSessions(db: DatabaseSync, name: string, at: string): number;
|
|
19
|
+
export declare function deleteWorkspaceNotes(db: DatabaseSync, name: string): number;
|
|
20
|
+
export declare function workspaceSessionCounts(db: DatabaseSync): Map<string, number>;
|
|
22
21
|
export declare const MEMORY_DB = ":memory:";
|
|
23
22
|
export declare function openDatabase(path: string): DatabaseSync;
|
|
24
23
|
export declare const migrations: readonly string[];
|
|
25
24
|
export declare function schemaVersion(db: DatabaseSync): number;
|
|
26
25
|
export declare function migrate(db: DatabaseSync): void;
|
|
27
|
-
type CarnetErrorCode = '
|
|
26
|
+
type CarnetErrorCode = 'NO_WORKSPACE' | 'WORKSPACE_AMBIGUOUS' | 'WORKSPACE_EXISTS' | 'WORKSPACE_NOT_FOUND' | 'WORKSPACE_NAME_INVALID' | 'REPO_NOT_FOUND' | 'REPO_NAME_TAKEN' | 'NOTE_NOT_FOUND' | 'INVALID_NOTE' | 'UNKNOWN_HOST' | 'NO_SESSION' | 'SESSION_NOT_FOUND' | 'SESSION_AMBIGUOUS' | 'SESSION_NAME_TAKEN' | 'SESSION_NAME_REQUIRED' | 'SESSION_RUNNING' | 'SESSION_KIND_INVALID' | 'SESSION_MERGE_INVALID' | 'SESSION_EXISTS' | 'SESSION_MOVE_INVALID' | 'SESSION_CWD_MISSING' | 'RUN_DIRECTORY_FILE_CONFLICT' | 'WORKSPACE_INSTRUCTIONS_CONFLICT' | 'AGENT_EXISTS' | 'AGENT_NOT_FOUND' | 'INVALID_STATUS' | 'INVALID_EVENT_TYPE' | 'COMMIT_REQUIRED' | 'TABLE_STATUS_WITH_MAIN_WORKING';
|
|
28
27
|
export declare class CarnetError extends Error {
|
|
29
28
|
readonly code: CarnetErrorCode;
|
|
30
29
|
constructor(code: CarnetErrorCode, message: string);
|
|
@@ -37,13 +36,13 @@ interface RucherPaths {
|
|
|
37
36
|
}
|
|
38
37
|
export declare function rucherPaths(env?: NodeJS.ProcessEnv): RucherPaths;
|
|
39
38
|
export declare function databasePath(env?: NodeJS.ProcessEnv): string;
|
|
40
|
-
export declare function
|
|
41
|
-
export declare function
|
|
42
|
-
export declare function
|
|
39
|
+
export declare function workspacesDirectory(env?: NodeJS.ProcessEnv): string;
|
|
40
|
+
export declare function workspaceDefinition(name: string, env?: NodeJS.ProcessEnv): string;
|
|
41
|
+
export declare function defaultRunDirectory(name: string, env?: NodeJS.ProcessEnv): string;
|
|
43
42
|
export declare function promptsDirectory(env?: NodeJS.ProcessEnv): string;
|
|
44
43
|
export declare function corePromptPath(env?: NodeJS.ProcessEnv): string;
|
|
45
|
-
export declare function reportsDirectory(
|
|
46
|
-
export declare function reportPath(
|
|
44
|
+
export declare function reportsDirectory(workspace: Workspace): string;
|
|
45
|
+
export declare function reportPath(workspace: Workspace, agentName: string): string;
|
|
47
46
|
export declare function handleSessionEnd(carnet: Carnet, payload: HostSessionEndPayload): Session | undefined;
|
|
48
47
|
interface SessionStartResult {
|
|
49
48
|
session: Session;
|
|
@@ -67,13 +66,13 @@ interface AppendPromptFile {
|
|
|
67
66
|
version: string;
|
|
68
67
|
}
|
|
69
68
|
export declare function baseRules(env?: NodeJS.ProcessEnv): string;
|
|
70
|
-
export declare function
|
|
71
|
-
export declare function rulesText(
|
|
72
|
-
export declare function rulesVersion(
|
|
73
|
-
export declare function assemblePrompt(
|
|
74
|
-
export declare function appendPromptFile(
|
|
75
|
-
export declare function compactReminder(
|
|
76
|
-
export declare function outsideRucherContext(
|
|
69
|
+
export declare function workspaceRules(workspace: Workspace | null): string | undefined;
|
|
70
|
+
export declare function rulesText(workspace: Workspace | null, env?: NodeJS.ProcessEnv): string;
|
|
71
|
+
export declare function rulesVersion(workspace: Workspace | null, env?: NodeJS.ProcessEnv): string;
|
|
72
|
+
export declare function assemblePrompt(workspace: Workspace | null, session: PromptSession, env?: NodeJS.ProcessEnv): AssembledPrompt;
|
|
73
|
+
export declare function appendPromptFile(workspace: Workspace | null, session: PromptSession, env?: NodeJS.ProcessEnv): AppendPromptFile;
|
|
74
|
+
export declare function compactReminder(workspace: Workspace | null, env?: NodeJS.ProcessEnv): string;
|
|
75
|
+
export declare function outsideRucherContext(workspace: Workspace | null, env?: NodeJS.ProcessEnv): string;
|
|
77
76
|
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)";
|
|
78
77
|
export declare const RULES_UPDATED_NOTICE = "rucher: rules updated, will apply after the next compaction or in a new session";
|
|
79
78
|
export declare const SUBAGENT_RULES = "Rucher rules for sub-agents: never commit, push or stash. When your task asks for a report, write it to the file it names. If your prompt names you as a Carnet agent, call agent_update at meaningful progress and agent_done as your last tool action, then reply with one line.";
|
|
@@ -81,7 +80,7 @@ export declare const CORE_RULES = "- Work can be parallel, review stays sequenti
|
|
|
81
80
|
export declare function handleUserPromptSubmit(carnet: Carnet, host: Host, payload: HostPromptPayload): Session;
|
|
82
81
|
export declare function handleToolUse(carnet: Carnet, payload: HostToolPayload, env: HookEnv): string | undefined;
|
|
83
82
|
export declare function transcriptTitle(path: string): string | undefined;
|
|
84
|
-
export declare function
|
|
83
|
+
export declare function workspaceSettings(workspace: Workspace): Record<string, unknown>;
|
|
85
84
|
export declare const claudeCode: Host;
|
|
86
85
|
export declare const DEFAULT_PURGE_DAYS = 3;
|
|
87
86
|
export declare function purgeDays(value: string | undefined): number;
|
|
@@ -110,20 +109,20 @@ interface StepAgentInput {
|
|
|
110
109
|
}
|
|
111
110
|
export declare function stepAgent(carnet: Carnet, session: string, input: StepAgentInput): string;
|
|
112
111
|
interface RenderResult {
|
|
113
|
-
|
|
112
|
+
runDirectory: string;
|
|
114
113
|
written: string[];
|
|
115
114
|
removed: string[];
|
|
116
115
|
}
|
|
117
|
-
interface
|
|
116
|
+
interface RunDirectoryRenderOptions {
|
|
118
117
|
env?: NodeJS.ProcessEnv | undefined;
|
|
119
118
|
host?: string | undefined;
|
|
120
119
|
}
|
|
121
|
-
export declare function
|
|
120
|
+
export declare function renderRunDirectory(workspace: Workspace, options?: RunDirectoryRenderOptions): RenderResult;
|
|
122
121
|
export declare const GENERATED_MARKER = "generated by rucher, do not edit";
|
|
123
122
|
export declare const MARKDOWN_MARKER = "<!-- generated by rucher, do not edit -->\n";
|
|
124
123
|
export declare function markdownCopy(content: string): string;
|
|
125
124
|
export declare function removeStaleCopies(directory: string, keep: ReadonlySet<string>): string[];
|
|
126
125
|
export declare function writeGenerated(path: string, content: string): boolean;
|
|
127
126
|
export declare function mergeSettings(base: Record<string, unknown>, extra: Record<string, unknown>): Record<string, unknown>;
|
|
128
|
-
export { AGENTS_FILE, AGENT_STATUSES, type AddNoteInput, type AddNoteResult, type Agent, type AgentEventType, type AgentStatus, type AgentStep, type AppendPromptFile, type AssembledPrompt, Carnet, type CarnetErrorCode, type CarnetEvent, type CarnetOptions, type CiteNoteInput, type
|
|
127
|
+
export { AGENTS_FILE, AGENT_STATUSES, type AddNoteInput, type AddNoteResult, type Agent, type AgentEventType, type AgentStatus, type AgentStep, type AppendPromptFile, type AssembledPrompt, Carnet, type CarnetErrorCode, type CarnetEvent, type CarnetOptions, type CiteNoteInput, type CreateSessionInput, type CreateWorkspaceOptions, DEFAULT_HALF_LIFE_DAYS, DEFAULT_HOST, DUPLICATE_SIMILARITY, type DropNoteInput, type DropWorkspaceOptions, EMOJI, EVENT_TYPES, type EventType, type FinishAgentInput, type HookEnv, type HookSessionPayload, type Host, type HostPromptPayload, type HostRender, type HostSessionEndPayload, type HostSessionPayload, type HostSubagentPayload, type HostToolPayload, INSTRUCTIONS_FILE, LEGEND, type LaunchOptions, type ListAgentsOptions, type ListNotesOptions, type ListSessionsOptions, type LogEventInput, MAIN_WORKING_EMOJI, MAIN_WORKING_SUFFIX, MEMORY_MAX_CHARACTERS, MINIMUM_ID_PREFIX, type MemoryOptions, type MergeResult, type MoveOptions, type MoveResult, NOTES_FOLD_LINES, NOTES_HEADER, NOTE_KINDS, NOTE_TEXT_LIMIT, type Note, type NoteActivity, type NoteActivityKind, type NoteCitation, type NoteDetail, type NoteKind, type NotesMode, type OpenCarnetOptions, PUBLISH_FALLBACK_MILLISECONDS, type PromptSession, REPORTING_NOTE, type RenderOptions, type RenderResult, type ResolveWorkspaceOptions, type ResolvedCarnet, type ResumeCommand, type ResumeContextOptions, type RucherPaths, type RunDirectoryRenderOptions, SESSION_EVENT_TYPES, SIMILAR_PREFIX, STALE_AFTER_ACTIVE_DAYS, type Session, type SessionEventType, type SessionKind, type SessionStartResult, type SessionStatus, type SetTableInput, type StartAgentInput, type StatusLine, type StatusView, type StepAgentInput, type TableItem, USER_ACTION_STATUSES, type UpdateAgentInput, type UserActionStatus, WORKSPACE_FILE, type WeightedNote, type Workspace, type WorkspaceFile, type WorkspaceOrigin, type WorkspaceRepo, type WorkspaceResolution, addWorkspaceRepo, allHosts, ambiguousWorkspaceContext, buildStatusView, createWorkspace, definitionInstructions, dropWorkspace, expandHome, formatClock, hostById, isAgentStatus, isEventType, isInside, isNoteKind, isUserActionStatus, isWorkspaceName, listWorkspaces, loadWorkspace, localDay, memoryHalfLife, memoryMaxCharacters, openCarnet, openResolvedCarnet, openWorkspaceCarnet, removeWorkspaceRepo, renderAgentLine, renderMemory, renderNoteLine, renderNotes, renderNotesSummary, renderSections, renderStatus, renderTableLine, repoNameFor, repoPathFor, requireWorkspace, resolveWorkspace, sessionNoteActivity, shortId, similarity, workspaceExists, workspaceHosts, workspaceLabel, workspaceRepoNames };
|
|
129
128
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/move.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/move.ts","../src/workspace-rows.ts","../src/db/open.ts","../src/db/schema.ts","../src/errors.ts","../src/paths.ts","../src/hook/session-end.ts","../src/hook/session-start.ts","../src/prompt/prompt.ts","../src/prompt/core-rules.ts","../src/hook/user-prompt-submit.ts","../src/hook/post-tool-use.ts","../src/hosts/claude-code.ts","../src/purge.ts","../src/resume.ts","../src/subagents.ts","../src/status/note.ts","../src/steps.ts","../src/render.ts","../src/run-directory-files.ts"],"mappings":";;UAIiB;EACf;EACA;;UAGe;EACf,SAAS;EACT,MAAM;EACN;EACA;EACA;EACA;EACA;;wBAwBc,YACd,QAAQ,QACR,mBACA,yBACA,UAAS,cACR;wBC9Ba,qBACd,IAAI,cACJ;wBAQc,yBAAyB,IAAI,cAAc,cAAc;wBAiBzD,qBAAqB,IAAI,cAAc;wBAIvC,uBAAuB,IAAI,eAAe;qBC3C7C;wBAEG,aAAa,eAAe;qBCH/B;wBAgPG,cAAc,IAAI;wBASlB,QAAQ,IAAI;KC3PhB;qBA+BC,oBAAoB;WAEpB,MAAM;EADjB,YACW,MAAM,iBACf;;UC9Ba;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,iBAA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Ac;wBAiB7B,cACd,MAAM,yBACN,OAAO,0BACN"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as workspaceSessionCounts, $t as migrations, A as memoryMaxCharacters, At as addWorkspaceRepo, B as sessionNoteActivity, Bt as workspaceHosts, C as renderNotesSummary, Ct as workspaceRules, D as DEFAULT_PURGE_DAYS, Dt as AGENTS_FILE, E as renderTableLine, Et as shortId, F as NOTE_TEXT_LIMIT, Ft as isWorkspaceName, G as repoNameFor, Gt as reportPath, H as workspaceRepoNames, Ht as databasePath, I as STALE_AFTER_ACTIVE_DAYS, It as listWorkspaces, J as resolveWorkspace, Jt as workspaceDefinition, K as repoPathFor, Kt as reportsDirectory, L as isNoteKind, Lt as loadWorkspace, M as DEFAULT_HALF_LIFE_DAYS, Mt as definitionInstructions, N as DUPLICATE_SIMILARITY, Nt as dropWorkspace, O as purgeDays, Ot as INSTRUCTIONS_FILE, P as NOTE_KINDS, Pt as expandHome, Q as sessionWorkspaceName, Qt as migrate, R as localDay, Rt as removeWorkspaceRepo, S as renderNotes, St as rulesVersion, T as renderStatus, Tt as MINIMUM_ID_PREFIX, U as ambiguousWorkspaceContext, Ut as defaultRunDirectory, V as similarity, Vt as corePromptPath, W as isInside, Wt as promptsDirectory, X as archiveWorkspaceSessions, Xt as MEMORY_DB, Y as workspaceLabel, Yt as workspacesDirectory, Z as deleteWorkspaceNotes, Zt as openDatabase, _ as NOTES_FOLD_LINES, _t as assemblePrompt, a as formatEventLine, an as AGENT_STATUSES, at as workspaceSettings, b as renderAgentLine, bt as outsideRucherContext, c as Carnet, cn as MAIN_WORKING_EMOJI, ct as markdownCopy, d as openWorkspaceCarnet, dn as isAgentStatus, dt as writeGenerated, en as schemaVersion, et as DEFAULT_HOST, f as PAIRING_WINDOW_MILLISECONDS, fn as isUserActionStatus, ft as OUTSIDE_RUCHER_NOTICE, g as MAIN_WORKING_SUFFIX, gn as CarnetError, gt as appendPromptFile, h as formatClock, hn as isEventType, ht as SUBAGENT_RULES, i as RESUME_MAX_CHARACTERS, in as sanitizeNote, it as transcriptTitle, j as renderMemory, jt as createWorkspace, k as MEMORY_MAX_CHARACTERS, kt as WORKSPACE_FILE, l as openCarnet, lt as mergeSettings, m as buildStatusView, mn as SESSION_EVENT_TYPES, mt as RULES_UPDATED_NOTICE, n as stepAgent, nn as REPORTING_NOTE, nt as hostById, o as resumeContext, on as EMOJI, ot as GENERATED_MARKER, p as STOPPED_NOTE, pn as EVENT_TYPES, pt as PROMPT_FILE, q as requireWorkspace, qt as rucherPaths, r as RESUME_EVENTS, rn as NOTE_MAX, rt as claudeCode, s as sessionLabel, sn as LEGEND, st as MARKDOWN_MARKER, t as AGENT_STEPS, tn as PUBLISH_FALLBACK_MILLISECONDS, tt as allHosts, u as openResolvedCarnet, un as USER_ACTION_STATUSES, ut as removeStaleCopies, v as NOTES_HEADER, vt as baseRules, w as renderSections, wt as CORE_RULES, x as renderNoteLine, xt as rulesText, y as SIMILAR_PREFIX, yt as compactReminder, z as memoryHalfLife, zt as workspaceExists } from "./steps-4ZTrBzcd.mjs";
|
|
2
2
|
import { mkdirSync } from "node:fs";
|
|
3
3
|
// src/move.ts
|
|
4
4
|
function count(carnet, sql, ...parameters) {
|
|
@@ -7,16 +7,16 @@ function count(carnet, sql, ...parameters) {
|
|
|
7
7
|
function agentNames(carnet, session) {
|
|
8
8
|
return carnet.db.prepare("SELECT name FROM agents WHERE session = ? ORDER BY started_at, rowid").all(session).map((row) => row.name);
|
|
9
9
|
}
|
|
10
|
-
function sessionNamed(carnet,
|
|
11
|
-
const row = carnet.db.prepare("SELECT id FROM sessions WHERE
|
|
10
|
+
function sessionNamed(carnet, workspace, name) {
|
|
11
|
+
const row = carnet.db.prepare("SELECT id FROM sessions WHERE workspace = ? AND name = ?").get(workspace, name);
|
|
12
12
|
return row ? carnet.sessions.require(row.id) : null;
|
|
13
13
|
}
|
|
14
|
-
function moveSession(carnet, sessionId,
|
|
14
|
+
function moveSession(carnet, sessionId, targetWorkspace, options = {}) {
|
|
15
15
|
const session = carnet.sessions.require(sessionId);
|
|
16
|
-
if (session.
|
|
17
|
-
if (session.
|
|
18
|
-
const into = session.name ? sessionNamed(carnet,
|
|
19
|
-
if (into && !options.merge) throw new CarnetError("SESSION_NAME_TAKEN", `
|
|
16
|
+
if (session.workspace !== (carnet.workspace?.name ?? null)) throw new CarnetError("SESSION_NOT_FOUND", `Unknown session ${sessionId}`);
|
|
17
|
+
if (session.workspace === targetWorkspace) throw new CarnetError("SESSION_MOVE_INVALID", "The session is already in this workspace");
|
|
18
|
+
const into = session.name ? sessionNamed(carnet, targetWorkspace, session.name) : null;
|
|
19
|
+
if (into && !options.merge) throw new CarnetError("SESSION_NAME_TAKEN", `Workspace ${targetWorkspace} already has session ${into.name}: pass --merge to merge into it`);
|
|
20
20
|
const agents = agentNames(carnet, session.id);
|
|
21
21
|
const taken = new Set(into ? agentNames(carnet, into.id) : []);
|
|
22
22
|
const hasTable = (id) => carnet.db.prepare("SELECT 1 FROM table_items WHERE session = ?").get(id) !== void 0;
|
|
@@ -31,7 +31,7 @@ function moveSession(carnet, sessionId, targetGroup, options = {}) {
|
|
|
31
31
|
};
|
|
32
32
|
if (options.dryRun) return result;
|
|
33
33
|
if (into) carnet.sessions.merge(session.id, into.id);
|
|
34
|
-
carnet.db.prepare("UPDATE sessions SET
|
|
34
|
+
carnet.db.prepare("UPDATE sessions SET workspace = ? WHERE id = ?").run(targetWorkspace, session.id);
|
|
35
35
|
return result;
|
|
36
36
|
}
|
|
37
37
|
// src/hook/session-end.ts
|
|
@@ -78,11 +78,11 @@ function handleSessionStart(carnet, payload, env) {
|
|
|
78
78
|
if (source === "resume") contextParts.push(resumeContext(carnet, session));
|
|
79
79
|
const memory = startMemory(carnet, session, source, env);
|
|
80
80
|
if (memory) contextParts.push(memory);
|
|
81
|
-
if (source === "compact" && !launchedVersion) contextParts.push(compactReminder(carnet.
|
|
81
|
+
if (source === "compact" && !launchedVersion) contextParts.push(compactReminder(carnet.workspace, promptEnv));
|
|
82
82
|
else if (!env.RUCHER_SESSION_ID && !session.promptVersion) {
|
|
83
|
-
contextParts.push(outsideRucherContext(carnet.
|
|
83
|
+
contextParts.push(outsideRucherContext(carnet.workspace, promptEnv));
|
|
84
84
|
notices.push(OUTSIDE_RUCHER_NOTICE);
|
|
85
|
-
} else if (session.promptVersion && session.promptVersion !== rulesVersion(carnet.
|
|
85
|
+
} else if (session.promptVersion && session.promptVersion !== rulesVersion(carnet.workspace, promptEnv)) notices.push(RULES_UPDATED_NOTICE);
|
|
86
86
|
const additionalContext = contextParts.length ? contextParts.join("\n\n") : void 0;
|
|
87
87
|
return {
|
|
88
88
|
session,
|
|
@@ -100,7 +100,7 @@ function handleUserPromptSubmit(carnet, host, payload) {
|
|
|
100
100
|
// src/hook/post-tool-use.ts
|
|
101
101
|
function handleToolUse(carnet, payload, env) {
|
|
102
102
|
if (payload.agent_id) return void 0;
|
|
103
|
-
const repo = repoNameFor(carnet.
|
|
103
|
+
const repo = repoNameFor(carnet.workspace, payload.path);
|
|
104
104
|
if (!repo) return void 0;
|
|
105
105
|
const session = carnet.sessions.ensure(payload.session_id, payload.cwd);
|
|
106
106
|
return carnet.memory.forRepo(session, repo, {
|
|
@@ -109,21 +109,21 @@ function handleToolUse(carnet, payload, env) {
|
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
// src/render.ts
|
|
112
|
-
function
|
|
113
|
-
mkdirSync(
|
|
114
|
-
mkdirSync(reportsDirectory(
|
|
112
|
+
function renderRunDirectory(workspace, options = {}) {
|
|
113
|
+
mkdirSync(workspace.runDirectory, { recursive: true });
|
|
114
|
+
mkdirSync(reportsDirectory(workspace), { recursive: true });
|
|
115
115
|
const result = {
|
|
116
|
-
|
|
116
|
+
runDirectory: workspace.runDirectory,
|
|
117
117
|
written: [],
|
|
118
118
|
removed: []
|
|
119
119
|
};
|
|
120
|
-
for (const id of options.host ? [options.host] :
|
|
121
|
-
const rendered = hostById(id).
|
|
120
|
+
for (const id of options.host ? [options.host] : workspaceHosts(workspace)) {
|
|
121
|
+
const rendered = hostById(id).renderRunDirectory(workspace);
|
|
122
122
|
result.written.push(...rendered.written);
|
|
123
123
|
result.removed.push(...rendered.removed);
|
|
124
124
|
}
|
|
125
125
|
return result;
|
|
126
126
|
}
|
|
127
|
-
export { AGENTS_FILE, AGENT_STATUSES, AGENT_STEPS, CORE_RULES, Carnet, CarnetError, DEFAULT_HALF_LIFE_DAYS, DEFAULT_HOST, DEFAULT_PURGE_DAYS, DUPLICATE_SIMILARITY, EMOJI, EVENT_TYPES, GENERATED_MARKER,
|
|
127
|
+
export { AGENTS_FILE, AGENT_STATUSES, AGENT_STEPS, CORE_RULES, Carnet, CarnetError, DEFAULT_HALF_LIFE_DAYS, DEFAULT_HOST, DEFAULT_PURGE_DAYS, DUPLICATE_SIMILARITY, EMOJI, EVENT_TYPES, GENERATED_MARKER, INSTRUCTIONS_FILE, LEGEND, 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, STOPPED_NOTE, SUBAGENT_RULES, USER_ACTION_STATUSES, WORKSPACE_FILE, addWorkspaceRepo, allHosts, ambiguousWorkspaceContext, appendPromptFile, archiveWorkspaceSessions, assemblePrompt, baseRules, buildStatusView, claudeCode, compactReminder, corePromptPath, createWorkspace, databasePath, defaultRunDirectory, definitionInstructions, deleteWorkspaceNotes, dropWorkspace, expandHome, formatClock, formatEventLine, handleSessionEnd, handleSessionStart, handleToolUse, handleUserPromptSubmit, hostById, isAgentStatus, isEventType, isInside, isNoteKind, isUserActionStatus, isWorkspaceName, listWorkspaces, loadWorkspace, localDay, markdownCopy, memoryHalfLife, memoryMaxCharacters, mergeSettings, migrate, migrations, moveSession, openCarnet, openDatabase, openResolvedCarnet, openWorkspaceCarnet, outsideRucherContext, promptsDirectory, purgeDays, removeStaleCopies, removeWorkspaceRepo, renderAgentLine, renderMemory, renderNoteLine, renderNotes, renderNotesSummary, renderRunDirectory, renderSections, renderStatus, renderTableLine, repoNameFor, repoPathFor, reportPath, reportsDirectory, requireWorkspace, resolveWorkspace, resumeContext, rucherPaths, rulesText, rulesVersion, sanitizeNote, schemaVersion, sessionLabel, sessionNoteActivity, sessionWorkspaceName, shortId, similarity, stepAgent, transcriptTitle, workspaceDefinition, workspaceExists, workspaceHosts, workspaceLabel, workspaceRepoNames, workspaceRules, workspaceSessionCounts, workspaceSettings, workspacesDirectory, writeGenerated };
|
|
128
128
|
|
|
129
129
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/move.ts","../src/hook/session-end.ts","../src/hook/session-start.ts","../src/hook/user-prompt-submit.ts","../src/hook/post-tool-use.ts","../src/render.ts"],"sourcesContent":["import type { Carnet } from './carnet.ts';\nimport { CarnetError } from './errors.ts';\nimport type { Session } from './sessions.ts';\n\nexport interface MoveOptions {\n merge?: boolean | undefined;\n dryRun?: boolean | undefined;\n}\n\nexport interface MoveResult {\n session: Session;\n into: Session | null;\n movedAgents: string[];\n skippedAgents: string[];\n movedEvents: number;\n movedTable: boolean;\n keptNotes: number;\n}\n\nfunction count(carnet: Carnet, sql: string, ...parameters: string[]): number {\n return Number((carnet.db.prepare(sql).get(...parameters) as { total: number }).total);\n}\n\nfunction agentNames(carnet: Carnet, session: string): string[] {\n return (\n carnet.db\n .prepare('SELECT name FROM agents WHERE session = ? ORDER BY started_at, rowid')\n .all(session) as unknown as { name: string }[]\n ).map((row) => row.name);\n}\n\nfunction sessionNamed(carnet: Carnet, group: string, name: string): Session | null {\n const row = carnet.db\n .prepare('SELECT id FROM sessions WHERE group_name = ? AND name = ?')\n .get(group, name) as { id: string } | undefined;\n return row ? carnet.sessions.require(row.id) : null;\n}\n\n// One database holds every group: moving a session only changes its group, and its agents,\n// events and table line follow its id. Notes stay in the group they were written in.\nexport function moveSession(\n carnet: Carnet,\n sessionId: string,\n targetGroup: string,\n options: MoveOptions = {},\n): MoveResult {\n const session = carnet.sessions.require(sessionId);\n if (session.groupName !== (carnet.group?.name ?? null)) {\n throw new CarnetError('SESSION_NOT_FOUND', `Unknown session ${sessionId}`);\n }\n if (session.groupName === targetGroup) {\n throw new CarnetError('SESSION_MOVE_INVALID', 'The session is already in this group');\n }\n const into = session.name ? sessionNamed(carnet, targetGroup, session.name) : null;\n if (into && !options.merge) {\n throw new CarnetError(\n 'SESSION_NAME_TAKEN',\n `Group ${targetGroup} already has session ${into.name}: pass --merge to merge into it`,\n );\n }\n const agents = agentNames(carnet, session.id);\n const taken = new Set(into ? agentNames(carnet, into.id) : []);\n const hasTable = (id: string) =>\n carnet.db.prepare('SELECT 1 FROM table_items WHERE session = ?').get(id) !== undefined;\n const result: MoveResult = {\n session,\n into,\n movedAgents: agents.filter((name) => !taken.has(name)),\n skippedAgents: agents.filter((name) => taken.has(name)),\n movedEvents: count(\n carnet,\n 'SELECT COUNT(*) AS total FROM events WHERE session = ?',\n session.id,\n ),\n movedTable: hasTable(session.id) && !(into && hasTable(into.id)),\n keptNotes: count(\n carnet,\n 'SELECT COUNT(*) AS total FROM notes WHERE session = ? OR dropped_session = ?',\n session.id,\n session.id,\n ),\n };\n if (options.dryRun) return result;\n if (into) carnet.sessions.merge(session.id, into.id);\n carnet.db.prepare('UPDATE sessions SET group_name = ? WHERE id = ?').run(targetGroup, session.id);\n return result;\n}\n","import type { Carnet } from '../carnet.ts';\nimport type { HostSessionEndPayload } from '../hosts/host.ts';\nimport type { Session } from '../sessions.ts';\n\nexport function handleSessionEnd(\n carnet: Carnet,\n payload: HostSessionEndPayload,\n): Session | undefined {\n if (!carnet.sessions.get(payload.session_id)) return undefined;\n return carnet.sessions.end(payload.session_id);\n}\n","import type { Carnet } from '../carnet.ts';\nimport type { SessionEventType } from '../events.ts';\nimport {\n compactReminder,\n outsideRucherContext,\n OUTSIDE_RUCHER_NOTICE,\n RULES_UPDATED_NOTICE,\n rulesVersion,\n} from '../prompt/prompt.ts';\nimport { hostById } from '../hosts/host.ts';\nimport { memoryMaxCharacters } from '../memory.ts';\nimport { memoryHalfLife } from '../notes.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 contextParts: string[];\n notices: string[];\n}\n\nconst SOURCE_EVENTS: Readonly<Record<string, SessionEventType>> = {\n startup: 'session.started',\n resume: 'session.resumed',\n fork: 'session.forked',\n};\n\n// A fork gets a new id from the host; the launcher's env still carries the parent's.\nfunction adoptFork(carnet: Carnet, session: Session, env: HookEnv): Session {\n const parentId = env.RUCHER_SESSION_ID;\n if (!parentId || parentId === session.id || !carnet.sessions.get(parentId)) return session;\n let fork = carnet.sessions.setParent(session.id, parentId);\n carnet.memory.copyRepos(parentId, session.id);\n const kind = env.RUCHER_SESSION_KIND;\n if (kind === 'active' || kind === 'temp') {\n fork = carnet.sessions.setKind(session.id, kind, env.RUCHER_SESSION_NAME || null);\n }\n return fork;\n}\n\n// A fork inherits its parent's conversation, notes included.\nfunction startMemory(\n carnet: Carnet,\n session: Session,\n source: string,\n env: HookEnv,\n): string | undefined {\n const options = {\n maxCharacters: memoryMaxCharacters(env.RUCHER_MEMORY_MAX_CHARACTERS),\n halfLifeDays: memoryHalfLife(env.RUCHER_MEMORY_HALF_LIFE_DAYS),\n };\n if (source === 'startup' || source === 'clear') return carnet.memory.atStart(session, options);\n if (source === 'resume' || source === 'compact') return carnet.memory.ofSession(session, options);\n return undefined;\n}\n\nexport function handleSessionStart(\n carnet: Carnet,\n payload: HookSessionPayload,\n env: HookEnv,\n): SessionStartResult {\n let session = carnet.sessions.upsertFromHook(payload, env);\n const source = payload.source ?? '';\n if (source === 'fork') session = adoptFork(carnet, session, env);\n const event = SOURCE_EVENTS[source];\n if (event) carnet.events.log(session.id, { type: event });\n session = carnet.sessions.setStatus(session.id, 'running');\n carnet.sessions.purge(session.id, purgeDays(env.RUCHER_PURGE_DAYS));\n\n const promptEnv = { RUCHER_HOME: env.RUCHER_HOME };\n const launchedVersion = env.RUCHER_PROMPT_VERSION || null;\n const contextParts: string[] = [];\n const notices: string[] = [];\n if (hostById(session.host).rendersSystemPrompt(source)) {\n session = carnet.sessions.recordPromptVersion(session.id, launchedVersion);\n }\n if (source === 'resume') contextParts.push(resumeContext(carnet, session));\n const memory = startMemory(carnet, session, source, env);\n if (memory) contextParts.push(memory);\n if (source === 'compact' && !launchedVersion) {\n contextParts.push(compactReminder(carnet.group, promptEnv));\n } else if (!env.RUCHER_SESSION_ID && !session.promptVersion) {\n contextParts.push(outsideRucherContext(carnet.group, promptEnv));\n notices.push(OUTSIDE_RUCHER_NOTICE);\n } else if (\n session.promptVersion &&\n session.promptVersion !== rulesVersion(carnet.group, promptEnv)\n ) {\n notices.push(RULES_UPDATED_NOTICE);\n }\n const additionalContext = contextParts.length ? contextParts.join('\\n\\n') : undefined;\n return { session, contextParts, notices, ...(additionalContext ? { additionalContext } : {}) };\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 carnet.notes.recordActiveDay();\n return carnet.sessions.adoptTitle(payload.session_id, host.promptTitle(payload));\n}\n","import type { Carnet } from '../carnet.ts';\nimport { repoNameFor } from '../group/locate.ts';\nimport type { HostToolPayload } from '../hosts/host.ts';\nimport { memoryMaxCharacters } from '../memory.ts';\nimport { memoryHalfLife } from '../notes.ts';\nimport type { HookEnv } from '../sessions.ts';\n\nexport function handleToolUse(\n carnet: Carnet,\n payload: HostToolPayload,\n env: HookEnv,\n): string | undefined {\n // session_repos tracks the main conversation; a subagent's context is not it.\n if (payload.agent_id) return undefined;\n const repo = repoNameFor(carnet.group, payload.path);\n if (!repo) return undefined;\n const session = carnet.sessions.ensure(payload.session_id, payload.cwd);\n return carnet.memory.forRepo(session, repo, {\n maxCharacters: memoryMaxCharacters(env.RUCHER_MEMORY_MAX_CHARACTERS),\n halfLifeDays: memoryHalfLife(env.RUCHER_MEMORY_HALF_LIFE_DAYS),\n });\n}\n","import { mkdirSync } from 'node:fs';\nimport { type Group, groupHosts } from './group/group.ts';\nimport { hostById } from './hosts/host.ts';\nimport { reportsDirectory } from './paths.ts';\n\nexport interface RenderResult {\n workspace: string;\n written: string[];\n removed: string[];\n}\n\nexport interface WorkspaceRenderOptions {\n env?: NodeJS.ProcessEnv | undefined;\n host?: string | undefined;\n}\n\nexport function renderWorkspace(group: Group, options: WorkspaceRenderOptions = {}): RenderResult {\n mkdirSync(group.workspace, { recursive: true });\n mkdirSync(reportsDirectory(group), { recursive: true });\n const result: RenderResult = { workspace: group.workspace, written: [], removed: [] };\n for (const id of options.host ? [options.host] : groupHosts(group)) {\n const rendered = hostById(id).renderWorkspace(group);\n result.written.push(...rendered.written);\n result.removed.push(...rendered.removed);\n }\n return result;\n}\n"],"mappings":";;;AAmBA,SAAS,MAAM,QAAgB,KAAa,GAAG,YAA8B;CAC3E,OAAO,OAAQ,OAAO,GAAG,QAAQ,GAAG,CAAC,CAAC,IAAI,GAAG,UAAU,CAAC,CAAuB,KAAK;AACtF;AAEA,SAAS,WAAW,QAAgB,SAA2B;CAC7D,OACE,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K,YAAY,OAAO,CAAC;AACjF;;ACLA,SAAgB,cACd,QACA,SACA,KACoB;CAEpB,IAAI,QAAQ,UAAU,OAAO,KAAA;CAC7B,MAAM,OAAO,YAAY,OAAO,OAAO,QAAQ,IAAI;CACnD,IAAI,CAAC,MAAM,OAAO,KAAA;CAClB,MAAM,UAAU,OAAO,SAAS,OAAO,QAAQ,YAAY,QAAQ,GAAG;CACtE,OAAO,OAAO,OAAO,QAAQ,SAAS,MAAM;EAC1C,eAAe,oBAAoB,IAAI,4BAA4B;EACnE,cAAc,eAAe,IAAI,4BAA4B;CAC/D,CAAC;AACH;;ACLA,SAAgB,gBAAgB,OAAc,UAAkC,CAAC,GAAiB;CAChG,UAAU,MAAM,WAAW,EAAE,WAAW,KAAK,CAAC;CAC9C,UAAU,iBAAiB,KAAK,GAAG,EAAE,WAAW,KAAK,CAAC;CACtD,MAAM,SAAuB;EAAE,WAAW,MAAM;EAAW,SAAS,CAAC;EAAG,SAAS,CAAC;CAAE;CACpF,KAAK,MAAM,MAAM,QAAQ,OAAO,CAAC,QAAQ,IAAI,IAAI,WAAW,KAAK,GAAG;EAClE,MAAM,WAAW,SAAS,EAAE,CAAC,CAAC,gBAAgB,KAAK;EACnD,OAAO,QAAQ,KAAK,GAAG,SAAS,OAAO;EACvC,OAAO,QAAQ,KAAK,GAAG,SAAS,OAAO;CACzC;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/move.ts","../src/hook/session-end.ts","../src/hook/session-start.ts","../src/hook/user-prompt-submit.ts","../src/hook/post-tool-use.ts","../src/render.ts"],"sourcesContent":["import type { Carnet } from './carnet.ts';\nimport { CarnetError } from './errors.ts';\nimport type { Session } from './sessions.ts';\n\nexport interface MoveOptions {\n merge?: boolean | undefined;\n dryRun?: boolean | undefined;\n}\n\nexport interface MoveResult {\n session: Session;\n into: Session | null;\n movedAgents: string[];\n skippedAgents: string[];\n movedEvents: number;\n movedTable: boolean;\n keptNotes: number;\n}\n\nfunction count(carnet: Carnet, sql: string, ...parameters: string[]): number {\n return Number((carnet.db.prepare(sql).get(...parameters) as { total: number }).total);\n}\n\nfunction agentNames(carnet: Carnet, session: string): string[] {\n return (\n carnet.db\n .prepare('SELECT name FROM agents WHERE session = ? ORDER BY started_at, rowid')\n .all(session) as unknown as { name: string }[]\n ).map((row) => row.name);\n}\n\nfunction sessionNamed(carnet: Carnet, workspace: string, name: string): Session | null {\n const row = carnet.db\n .prepare('SELECT id FROM sessions WHERE workspace = ? AND name = ?')\n .get(workspace, name) as { id: string } | undefined;\n return row ? carnet.sessions.require(row.id) : null;\n}\n\n// One database holds every workspace: moving a session only changes its workspace, and its agents,\n// events and table line follow its id. Notes stay in the workspace they were written in.\nexport function moveSession(\n carnet: Carnet,\n sessionId: string,\n targetWorkspace: string,\n options: MoveOptions = {},\n): MoveResult {\n const session = carnet.sessions.require(sessionId);\n if (session.workspace !== (carnet.workspace?.name ?? null)) {\n throw new CarnetError('SESSION_NOT_FOUND', `Unknown session ${sessionId}`);\n }\n if (session.workspace === targetWorkspace) {\n throw new CarnetError('SESSION_MOVE_INVALID', 'The session is already in this workspace');\n }\n const into = session.name ? sessionNamed(carnet, targetWorkspace, session.name) : null;\n if (into && !options.merge) {\n throw new CarnetError(\n 'SESSION_NAME_TAKEN',\n `Workspace ${targetWorkspace} already has session ${into.name}: pass --merge to merge into it`,\n );\n }\n const agents = agentNames(carnet, session.id);\n const taken = new Set(into ? agentNames(carnet, into.id) : []);\n const hasTable = (id: string) =>\n carnet.db.prepare('SELECT 1 FROM table_items WHERE session = ?').get(id) !== undefined;\n const result: MoveResult = {\n session,\n into,\n movedAgents: agents.filter((name) => !taken.has(name)),\n skippedAgents: agents.filter((name) => taken.has(name)),\n movedEvents: count(\n carnet,\n 'SELECT COUNT(*) AS total FROM events WHERE session = ?',\n session.id,\n ),\n movedTable: hasTable(session.id) && !(into && hasTable(into.id)),\n keptNotes: count(\n carnet,\n 'SELECT COUNT(*) AS total FROM notes WHERE session = ? OR dropped_session = ?',\n session.id,\n session.id,\n ),\n };\n if (options.dryRun) return result;\n if (into) carnet.sessions.merge(session.id, into.id);\n carnet.db\n .prepare('UPDATE sessions SET workspace = ? WHERE id = ?')\n .run(targetWorkspace, session.id);\n return result;\n}\n","import type { Carnet } from '../carnet.ts';\nimport type { HostSessionEndPayload } from '../hosts/host.ts';\nimport type { Session } from '../sessions.ts';\n\nexport function handleSessionEnd(\n carnet: Carnet,\n payload: HostSessionEndPayload,\n): Session | undefined {\n if (!carnet.sessions.get(payload.session_id)) return undefined;\n return carnet.sessions.end(payload.session_id);\n}\n","import type { Carnet } from '../carnet.ts';\nimport type { SessionEventType } from '../events.ts';\nimport {\n compactReminder,\n outsideRucherContext,\n OUTSIDE_RUCHER_NOTICE,\n RULES_UPDATED_NOTICE,\n rulesVersion,\n} from '../prompt/prompt.ts';\nimport { hostById } from '../hosts/host.ts';\nimport { memoryMaxCharacters } from '../memory.ts';\nimport { memoryHalfLife } from '../notes.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 contextParts: string[];\n notices: string[];\n}\n\nconst SOURCE_EVENTS: Readonly<Record<string, SessionEventType>> = {\n startup: 'session.started',\n resume: 'session.resumed',\n fork: 'session.forked',\n};\n\n// A fork gets a new id from the host; the launcher's env still carries the parent's.\nfunction adoptFork(carnet: Carnet, session: Session, env: HookEnv): Session {\n const parentId = env.RUCHER_SESSION_ID;\n if (!parentId || parentId === session.id || !carnet.sessions.get(parentId)) return session;\n let fork = carnet.sessions.setParent(session.id, parentId);\n carnet.memory.copyRepos(parentId, session.id);\n const kind = env.RUCHER_SESSION_KIND;\n if (kind === 'active' || kind === 'temp') {\n fork = carnet.sessions.setKind(session.id, kind, env.RUCHER_SESSION_NAME || null);\n }\n return fork;\n}\n\n// A fork inherits its parent's conversation, notes included.\nfunction startMemory(\n carnet: Carnet,\n session: Session,\n source: string,\n env: HookEnv,\n): string | undefined {\n const options = {\n maxCharacters: memoryMaxCharacters(env.RUCHER_MEMORY_MAX_CHARACTERS),\n halfLifeDays: memoryHalfLife(env.RUCHER_MEMORY_HALF_LIFE_DAYS),\n };\n if (source === 'startup' || source === 'clear') return carnet.memory.atStart(session, options);\n if (source === 'resume' || source === 'compact') return carnet.memory.ofSession(session, options);\n return undefined;\n}\n\nexport function handleSessionStart(\n carnet: Carnet,\n payload: HookSessionPayload,\n env: HookEnv,\n): SessionStartResult {\n let session = carnet.sessions.upsertFromHook(payload, env);\n const source = payload.source ?? '';\n if (source === 'fork') session = adoptFork(carnet, session, env);\n const event = SOURCE_EVENTS[source];\n if (event) carnet.events.log(session.id, { type: event });\n session = carnet.sessions.setStatus(session.id, 'running');\n carnet.sessions.purge(session.id, purgeDays(env.RUCHER_PURGE_DAYS));\n\n const promptEnv = { RUCHER_HOME: env.RUCHER_HOME };\n const launchedVersion = env.RUCHER_PROMPT_VERSION || null;\n const contextParts: string[] = [];\n const notices: string[] = [];\n if (hostById(session.host).rendersSystemPrompt(source)) {\n session = carnet.sessions.recordPromptVersion(session.id, launchedVersion);\n }\n if (source === 'resume') contextParts.push(resumeContext(carnet, session));\n const memory = startMemory(carnet, session, source, env);\n if (memory) contextParts.push(memory);\n if (source === 'compact' && !launchedVersion) {\n contextParts.push(compactReminder(carnet.workspace, promptEnv));\n } else if (!env.RUCHER_SESSION_ID && !session.promptVersion) {\n contextParts.push(outsideRucherContext(carnet.workspace, promptEnv));\n notices.push(OUTSIDE_RUCHER_NOTICE);\n } else if (\n session.promptVersion &&\n session.promptVersion !== rulesVersion(carnet.workspace, promptEnv)\n ) {\n notices.push(RULES_UPDATED_NOTICE);\n }\n const additionalContext = contextParts.length ? contextParts.join('\\n\\n') : undefined;\n return { session, contextParts, notices, ...(additionalContext ? { additionalContext } : {}) };\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 carnet.notes.recordActiveDay();\n return carnet.sessions.adoptTitle(payload.session_id, host.promptTitle(payload));\n}\n","import type { Carnet } from '../carnet.ts';\nimport { repoNameFor } from '../workspace/locate.ts';\nimport type { HostToolPayload } from '../hosts/host.ts';\nimport { memoryMaxCharacters } from '../memory.ts';\nimport { memoryHalfLife } from '../notes.ts';\nimport type { HookEnv } from '../sessions.ts';\n\nexport function handleToolUse(\n carnet: Carnet,\n payload: HostToolPayload,\n env: HookEnv,\n): string | undefined {\n // session_repos tracks the main conversation; a subagent's context is not it.\n if (payload.agent_id) return undefined;\n const repo = repoNameFor(carnet.workspace, payload.path);\n if (!repo) return undefined;\n const session = carnet.sessions.ensure(payload.session_id, payload.cwd);\n return carnet.memory.forRepo(session, repo, {\n maxCharacters: memoryMaxCharacters(env.RUCHER_MEMORY_MAX_CHARACTERS),\n halfLifeDays: memoryHalfLife(env.RUCHER_MEMORY_HALF_LIFE_DAYS),\n });\n}\n","import { mkdirSync } from 'node:fs';\nimport { type Workspace, workspaceHosts } from './workspace/workspace.ts';\nimport { hostById } from './hosts/host.ts';\nimport { reportsDirectory } from './paths.ts';\n\nexport interface RenderResult {\n runDirectory: string;\n written: string[];\n removed: string[];\n}\n\nexport interface RunDirectoryRenderOptions {\n env?: NodeJS.ProcessEnv | undefined;\n host?: string | undefined;\n}\n\nexport function renderRunDirectory(\n workspace: Workspace,\n options: RunDirectoryRenderOptions = {},\n): RenderResult {\n mkdirSync(workspace.runDirectory, { recursive: true });\n mkdirSync(reportsDirectory(workspace), { recursive: true });\n const result: RenderResult = { runDirectory: workspace.runDirectory, written: [], removed: [] };\n for (const id of options.host ? [options.host] : workspaceHosts(workspace)) {\n const rendered = hostById(id).renderRunDirectory(workspace);\n result.written.push(...rendered.written);\n result.removed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ions, t as Carnet, yt as Host } from "./carnet-DHw_oXJs.mjs";
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
3
3
|
import { StdioServerHandle } from "@modelcontextprotocol/server/stdio";
|
|
4
4
|
import * as z from "zod/v4";
|
|
5
|
-
export declare const INSTRUCTIONS = "Carnet holds the forks, the \"On the table\" line, sessions, the journal and the
|
|
5
|
+
export declare const INSTRUCTIONS = "Carnet holds the forks, the \"On the table\" line, sessions, the journal and the workspace memory that the `rucher` CLI renders. The session is resolved automatically; pass `session` only to target another one. The workflow rules are in the system prompt and the rucher skill: load the skill before dispatching, applying or reviewing forks.\n\nWhich tool, when:\n- Dispatch: agent_start, then launch the fork in a later message.\n- Each step of a fork's work: agent_step (answered, applying, applied, tested, committed, dropped).\n- Main agent working on something else: table_set, table_clear.\n- Other moves: agent_update, agent_drop, queue_reorder. Recall: agent_list, log_read, session_resume_info, session_list.\n- Memory: note_list before an approach, note_add and note_drop at the end of a step (main agent), note_cite when a note changed what you did.\n- Session: session_new when the human names it, session_drop only when asked.\n- Fork: agent_update (running, short note) at progress, agent_done last.\n\nStatuses (the NEXT action): running ⏳ · discussing 💬 · answer ❓ · review 👀 · apply 📥 · test 🧪 · commit ✅ · branch 🌿. Notes and table text: under 60 characters, no paths, no backticks.";
|
|
6
6
|
interface SessionResolverOptions {
|
|
7
7
|
carnet: Carnet;
|
|
8
8
|
env?: NodeJS.ProcessEnv | undefined;
|