@rucher/carnet 0.0.0-stage → 0.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +20 -2
- package/dist/carnet-CsFtIv2C.d.mts +447 -0
- package/dist/carnet-CsFtIv2C.d.mts.map +1 -0
- package/dist/index.d.mts +91 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +189 -0
- package/dist/index.mjs.map +1 -0
- package/dist/mcp.d.mts +40 -0
- package/dist/mcp.d.mts.map +1 -0
- package/dist/mcp.mjs +513 -0
- package/dist/mcp.mjs.map +1 -0
- package/dist/resume-CQRf2jIa.mjs +1764 -0
- package/dist/resume-CQRf2jIa.mjs.map +1 -0
- package/package.json +54 -3
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
|
-
#
|
|
1
|
+
# @rucher/carnet
|
|
2
2
|
|
|
3
|
-
|
|
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/reference.md`](https://github.com/Florian-Varrin/Rucher/blob/master/docs/reference.md) in the [repository](https://github.com/Florian-Varrin/Rucher).
|
|
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,447 @@
|
|
|
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
|
+
description?: string | undefined;
|
|
98
|
+
agent_transcript_path?: string | undefined;
|
|
99
|
+
}
|
|
100
|
+
interface HostSessionEndPayload {
|
|
101
|
+
session_id: string;
|
|
102
|
+
cwd?: string | undefined;
|
|
103
|
+
reason?: string | undefined;
|
|
104
|
+
}
|
|
105
|
+
interface HostToolPayload {
|
|
106
|
+
session_id: string;
|
|
107
|
+
cwd?: string | undefined;
|
|
108
|
+
tool_name?: string | undefined;
|
|
109
|
+
agent_id?: string | undefined;
|
|
110
|
+
path?: string | undefined;
|
|
111
|
+
}
|
|
112
|
+
interface ResumeCommand {
|
|
113
|
+
command: string;
|
|
114
|
+
args: string[];
|
|
115
|
+
}
|
|
116
|
+
interface LaunchOptions {
|
|
117
|
+
name?: string | null | undefined;
|
|
118
|
+
appendPromptFile?: string | undefined;
|
|
119
|
+
passthrough?: readonly string[] | undefined;
|
|
120
|
+
}
|
|
121
|
+
interface ContextFile {
|
|
122
|
+
path: string;
|
|
123
|
+
sync(group: Group, mode: 'merge' | 'exact'): ContextFileResult;
|
|
124
|
+
}
|
|
125
|
+
type ContextFileResult = 'written' | 'updated' | 'unchanged' | 'no-markers';
|
|
126
|
+
interface Host {
|
|
127
|
+
id: string;
|
|
128
|
+
displayName: string;
|
|
129
|
+
processId(env: NodeJS.ProcessEnv): number | null;
|
|
130
|
+
sessionIdFromEnvironment(env: NodeJS.ProcessEnv): string | undefined;
|
|
131
|
+
projectDirectory(env: NodeJS.ProcessEnv): string | undefined;
|
|
132
|
+
parseSessionPayload(json: string): HostSessionPayload;
|
|
133
|
+
parsePromptPayload(json: string): HostPromptPayload;
|
|
134
|
+
parseSubagentPayload(json: string): HostSubagentPayload;
|
|
135
|
+
parseSessionEndPayload(json: string): HostSessionEndPayload;
|
|
136
|
+
parseToolPayload(json: string): HostToolPayload;
|
|
137
|
+
subagentNames(payload: HostSubagentPayload): string[];
|
|
138
|
+
subagentInheritsContext(payload: HostSubagentPayload): boolean;
|
|
139
|
+
rendersSystemPrompt(source: string): boolean;
|
|
140
|
+
promptTitle(payload: HostPromptPayload): string | undefined;
|
|
141
|
+
launchCommand(sessionId: string, options?: LaunchOptions): ResumeCommand;
|
|
142
|
+
resumeCommand(session: Session, options?: LaunchOptions): ResumeCommand;
|
|
143
|
+
forkCommand(parent: Session, options?: LaunchOptions): ResumeCommand;
|
|
144
|
+
renameInstruction(name: string): string;
|
|
145
|
+
transcriptFiles(session: Session, env?: NodeJS.ProcessEnv): string[];
|
|
146
|
+
contextFiles: readonly ContextFile[];
|
|
147
|
+
}
|
|
148
|
+
declare const DEFAULT_HOST = "claude-code";
|
|
149
|
+
declare function allHosts(): Host[];
|
|
150
|
+
declare function hostById(id: string): Host;
|
|
151
|
+
type SessionKind = 'active' | 'temp';
|
|
152
|
+
type SessionStatus = 'running' | 'idle' | 'archived';
|
|
153
|
+
interface Session {
|
|
154
|
+
id: string;
|
|
155
|
+
name: string | null;
|
|
156
|
+
purpose: string | null;
|
|
157
|
+
kind: SessionKind;
|
|
158
|
+
status: SessionStatus;
|
|
159
|
+
cwd: string | null;
|
|
160
|
+
repo: string | null;
|
|
161
|
+
host: string;
|
|
162
|
+
hostPid: number | null;
|
|
163
|
+
hookedAt: string | null;
|
|
164
|
+
lastTitle: string | null;
|
|
165
|
+
parentId: string | null;
|
|
166
|
+
promptVersion: string | null;
|
|
167
|
+
createdAt: string;
|
|
168
|
+
lastActiveAt: string;
|
|
169
|
+
endedAt: string | null;
|
|
170
|
+
}
|
|
171
|
+
type HookSessionPayload = HostSessionPayload;
|
|
172
|
+
interface HookEnv {
|
|
173
|
+
host?: string | undefined;
|
|
174
|
+
processId?: number | null | undefined;
|
|
175
|
+
RUCHER_PURGE_DAYS?: string | undefined;
|
|
176
|
+
RUCHER_HOME?: string | undefined;
|
|
177
|
+
RUCHER_SESSION_ID?: string | undefined;
|
|
178
|
+
RUCHER_SESSION_KIND?: string | undefined;
|
|
179
|
+
RUCHER_SESSION_NAME?: string | undefined;
|
|
180
|
+
RUCHER_PROMPT_VERSION?: string | undefined;
|
|
181
|
+
RUCHER_MEMORY_MAX_CHARACTERS?: string | undefined;
|
|
182
|
+
RUCHER_MEMORY_HALF_LIFE_DAYS?: string | undefined;
|
|
183
|
+
}
|
|
184
|
+
interface CreateSessionInput {
|
|
185
|
+
id: string;
|
|
186
|
+
kind: SessionKind;
|
|
187
|
+
name?: string | null | undefined;
|
|
188
|
+
cwd: string;
|
|
189
|
+
repo?: string | null | undefined;
|
|
190
|
+
host?: string | undefined;
|
|
191
|
+
}
|
|
192
|
+
interface ListSessionsOptions {
|
|
193
|
+
includeTemp?: boolean | undefined;
|
|
194
|
+
includeArchived?: boolean | undefined;
|
|
195
|
+
}
|
|
196
|
+
declare const MINIMUM_ID_PREFIX = 4;
|
|
197
|
+
declare function shortId(id: string): string;
|
|
198
|
+
interface MergeResult {
|
|
199
|
+
session: Session;
|
|
200
|
+
movedAgents: string[];
|
|
201
|
+
closedAgents: string[];
|
|
202
|
+
movedEvents: number;
|
|
203
|
+
movedTable: boolean;
|
|
204
|
+
}
|
|
205
|
+
interface TableItem {
|
|
206
|
+
session: string;
|
|
207
|
+
text: string;
|
|
208
|
+
status: UserActionStatus | null;
|
|
209
|
+
mainWorking: boolean;
|
|
210
|
+
updatedAt: string;
|
|
211
|
+
}
|
|
212
|
+
interface SetTableInput {
|
|
213
|
+
text: string;
|
|
214
|
+
mainWorking: boolean;
|
|
215
|
+
status?: UserActionStatus | undefined;
|
|
216
|
+
}
|
|
217
|
+
declare const EVENT_TYPES: readonly ['started', 'finished', 'answered', 'applied', 'tested', 'committed', 'dropped'];
|
|
218
|
+
declare const SESSION_EVENT_TYPES: readonly ['session.started', 'session.resumed', 'session.ended', 'session.forked'];
|
|
219
|
+
type AgentEventType = (typeof EVENT_TYPES)[number];
|
|
220
|
+
type SessionEventType = (typeof SESSION_EVENT_TYPES)[number];
|
|
221
|
+
type EventType = AgentEventType | SessionEventType;
|
|
222
|
+
interface CarnetEvent {
|
|
223
|
+
id: number;
|
|
224
|
+
session: string;
|
|
225
|
+
at: string;
|
|
226
|
+
type: EventType;
|
|
227
|
+
agent: string | null;
|
|
228
|
+
commit: string | null;
|
|
229
|
+
link: string | null;
|
|
230
|
+
note: string | null;
|
|
231
|
+
}
|
|
232
|
+
interface LogEventInput {
|
|
233
|
+
type: EventType;
|
|
234
|
+
agent?: string | undefined;
|
|
235
|
+
commit?: string | undefined;
|
|
236
|
+
link?: string | undefined;
|
|
237
|
+
note?: string | undefined;
|
|
238
|
+
}
|
|
239
|
+
declare function isEventType(value: unknown): value is EventType;
|
|
240
|
+
declare const NOTE_KINDS: readonly ['dead_end', 'decision', 'learning'];
|
|
241
|
+
type NoteKind = (typeof NOTE_KINDS)[number];
|
|
242
|
+
declare const NOTE_TEXT_LIMIT = 200;
|
|
243
|
+
declare const DUPLICATE_SIMILARITY = 0.6;
|
|
244
|
+
declare const DEFAULT_HALF_LIFE_DAYS = 20;
|
|
245
|
+
declare const STALE_AFTER_ACTIVE_DAYS = 40;
|
|
246
|
+
declare function isNoteKind(value: string): value is NoteKind;
|
|
247
|
+
declare function memoryHalfLife(value: string | undefined): number;
|
|
248
|
+
interface Note {
|
|
249
|
+
id: number;
|
|
250
|
+
kind: NoteKind;
|
|
251
|
+
text: string;
|
|
252
|
+
repos: string[];
|
|
253
|
+
session: string | null;
|
|
254
|
+
agent: string | null;
|
|
255
|
+
similarNotes: number[];
|
|
256
|
+
createdAt: string;
|
|
257
|
+
droppedAt: string | null;
|
|
258
|
+
droppedReason: string | null;
|
|
259
|
+
droppedSession: string | null;
|
|
260
|
+
replacedBy: number | null;
|
|
261
|
+
}
|
|
262
|
+
interface NoteCitation {
|
|
263
|
+
id: number;
|
|
264
|
+
note: number;
|
|
265
|
+
session: string | null;
|
|
266
|
+
agent: string | null;
|
|
267
|
+
why: string;
|
|
268
|
+
at: string;
|
|
269
|
+
}
|
|
270
|
+
interface WeightedNote extends Note {
|
|
271
|
+
weight: number;
|
|
272
|
+
citationCount: number;
|
|
273
|
+
}
|
|
274
|
+
interface NoteDetail extends WeightedNote {
|
|
275
|
+
citations: NoteCitation[];
|
|
276
|
+
}
|
|
277
|
+
interface AddNoteInput {
|
|
278
|
+
kind: string;
|
|
279
|
+
text: string;
|
|
280
|
+
repos?: string[] | undefined;
|
|
281
|
+
session?: string | null | undefined;
|
|
282
|
+
agent?: string | null | undefined;
|
|
283
|
+
}
|
|
284
|
+
interface AddNoteResult {
|
|
285
|
+
note: Note;
|
|
286
|
+
similar: Note[];
|
|
287
|
+
}
|
|
288
|
+
interface ListNotesOptions {
|
|
289
|
+
kind?: string | undefined;
|
|
290
|
+
repo?: string | undefined;
|
|
291
|
+
general?: boolean | undefined;
|
|
292
|
+
query?: string | undefined;
|
|
293
|
+
includeDropped?: boolean | undefined;
|
|
294
|
+
halfLifeDays?: number | undefined;
|
|
295
|
+
}
|
|
296
|
+
interface DropNoteInput {
|
|
297
|
+
reason: string;
|
|
298
|
+
replacedBy?: number | undefined;
|
|
299
|
+
session?: string | null | undefined;
|
|
300
|
+
}
|
|
301
|
+
interface CiteNoteInput {
|
|
302
|
+
why: string;
|
|
303
|
+
session?: string | null | undefined;
|
|
304
|
+
agent?: string | null | undefined;
|
|
305
|
+
}
|
|
306
|
+
declare function groupRepoNames(group: Group): string[];
|
|
307
|
+
declare function similarity(first: string, second: string): number;
|
|
308
|
+
declare function localDay(date: Date): string;
|
|
309
|
+
type NoteActivityKind = 'added' | 'cited' | 'dropped';
|
|
310
|
+
interface NoteActivity {
|
|
311
|
+
activity: NoteActivityKind;
|
|
312
|
+
note: number;
|
|
313
|
+
kind: NoteKind;
|
|
314
|
+
text: string;
|
|
315
|
+
similarNotes: number[];
|
|
316
|
+
replacedBy: number | null;
|
|
317
|
+
at: string;
|
|
318
|
+
}
|
|
319
|
+
declare function sessionNoteActivity(ctx: Ctx, session: string): NoteActivity[];
|
|
320
|
+
interface StatusLine {
|
|
321
|
+
name: string;
|
|
322
|
+
status: AgentStatus;
|
|
323
|
+
emoji: string;
|
|
324
|
+
note: string | null;
|
|
325
|
+
}
|
|
326
|
+
interface StatusView {
|
|
327
|
+
time: string;
|
|
328
|
+
sessionName: string | null;
|
|
329
|
+
table: TableItem | null;
|
|
330
|
+
waiting: StatusLine[];
|
|
331
|
+
running: StatusLine[];
|
|
332
|
+
notes: NoteActivity[];
|
|
333
|
+
}
|
|
334
|
+
declare function formatClock(date: Date): string;
|
|
335
|
+
declare function buildStatusView(ctx: Ctx, session: Session): StatusView;
|
|
336
|
+
declare const MEMORY_MAX_CHARACTERS = 2000;
|
|
337
|
+
declare function memoryMaxCharacters(value: string | undefined): number;
|
|
338
|
+
interface MemoryOptions {
|
|
339
|
+
maxCharacters?: number | undefined;
|
|
340
|
+
halfLifeDays?: number | undefined;
|
|
341
|
+
}
|
|
342
|
+
interface MemoryScope {
|
|
343
|
+
title: string;
|
|
344
|
+
notes: WeightedNote[];
|
|
345
|
+
}
|
|
346
|
+
declare function renderMemory(scope: MemoryScope, maxCharacters?: number): string;
|
|
347
|
+
declare const MAIN_WORKING_SUFFIX = "(main working, not ready)";
|
|
348
|
+
declare function renderTableLine(item: TableItem): string;
|
|
349
|
+
declare function renderAgentLine(line: StatusLine): string;
|
|
350
|
+
declare const NOTES_HEADER = "Notes";
|
|
351
|
+
declare const NOTES_FOLD_LINES = 5;
|
|
352
|
+
declare const SIMILAR_PREFIX = "similar to ";
|
|
353
|
+
type NotesMode = 'full' | 'summary' | 'expanded';
|
|
354
|
+
interface RenderOptions {
|
|
355
|
+
notes?: NotesMode | undefined;
|
|
356
|
+
}
|
|
357
|
+
declare function renderNotesSummary(notes: NoteActivity[]): string;
|
|
358
|
+
declare function renderNoteLine(item: NoteActivity, idWidth: number): string;
|
|
359
|
+
declare function renderNotes(notes: NoteActivity[], mode?: NotesMode): string[];
|
|
360
|
+
declare function renderSections(view: StatusView, options?: RenderOptions): string;
|
|
361
|
+
declare function renderStatus(view: StatusView, options?: RenderOptions): string;
|
|
362
|
+
interface CarnetOptions {
|
|
363
|
+
now?: () => Date;
|
|
364
|
+
}
|
|
365
|
+
declare class Carnet {
|
|
366
|
+
readonly group: Group;
|
|
367
|
+
readonly db: DatabaseSync;
|
|
368
|
+
private readonly ctx;
|
|
369
|
+
constructor(group: Group, db: DatabaseSync, options?: CarnetOptions);
|
|
370
|
+
readonly sessions: {
|
|
371
|
+
get: (id: string) => Session | undefined;
|
|
372
|
+
find: (reference: string) => Session;
|
|
373
|
+
require: (id: string) => Session;
|
|
374
|
+
ensure: (id: string, cwd?: string) => Session;
|
|
375
|
+
upsertFromHook: (payload: HookSessionPayload, env?: HookEnv) => Session;
|
|
376
|
+
touch: (id: string) => void;
|
|
377
|
+
merge: (fromId: string, intoId: string) => MergeResult;
|
|
378
|
+
purge: (keepId: string, days: number) => string[];
|
|
379
|
+
name: (id: string, name: string, purpose?: string) => Session;
|
|
380
|
+
adoptTitle: (id: string, title: string | undefined) => Session;
|
|
381
|
+
list: (options?: ListSessionsOptions) => Session[];
|
|
382
|
+
drop: (id: string) => Session;
|
|
383
|
+
default: () => Session | undefined;
|
|
384
|
+
byName: (name: string) => Session | undefined;
|
|
385
|
+
byHostProcess: (host: string, processId: number) => Session | undefined;
|
|
386
|
+
recordPromptVersion: (id: string, version: string | null) => Session;
|
|
387
|
+
setParent: (id: string, parentId: string) => Session;
|
|
388
|
+
setStatus: (id: string, status: SessionStatus) => Session;
|
|
389
|
+
create: (input: CreateSessionInput) => Session;
|
|
390
|
+
setKind: (id: string, kind: SessionKind, name?: string | null) => Session;
|
|
391
|
+
end: (id: string) => Session;
|
|
392
|
+
rename: (id: string, name: string) => Session;
|
|
393
|
+
promote: (id: string, name?: string) => Session;
|
|
394
|
+
demote: (id: string) => Session;
|
|
395
|
+
staleTemp: (olderThanMilliseconds: number) => Session[];
|
|
396
|
+
resetDead: (isAlive: (processId: number) => boolean) => Session[];
|
|
397
|
+
};
|
|
398
|
+
readonly agents: {
|
|
399
|
+
get: (session: string, name: string) => Agent | undefined;
|
|
400
|
+
start: (session: string, input: StartAgentInput) => Agent;
|
|
401
|
+
update: (session: string, name: string, input: UpdateAgentInput) => Agent;
|
|
402
|
+
finish: (session: string, name: string, input: FinishAgentInput) => Agent;
|
|
403
|
+
drop: (session: string, name: string, reason?: string) => Agent;
|
|
404
|
+
list: (session: string, options?: ListAgentsOptions) => Agent[];
|
|
405
|
+
reorderQueue: (session: string, names: string[]) => Agent[];
|
|
406
|
+
pairSubagent: (session: string, hostAgentId: string) => Agent | undefined;
|
|
407
|
+
stopSubagent: (session: string, hostAgentId: string, names?: string[]) => Agent | undefined;
|
|
408
|
+
};
|
|
409
|
+
readonly table: {
|
|
410
|
+
get: (session: string) => TableItem | undefined;
|
|
411
|
+
set: (session: string, input: SetTableInput) => TableItem;
|
|
412
|
+
clear: (session: string) => void;
|
|
413
|
+
};
|
|
414
|
+
readonly events: {
|
|
415
|
+
log: (session: string, input: LogEventInput) => CarnetEvent;
|
|
416
|
+
read: (session: string, limit?: number, agentOnly?: boolean) => CarnetEvent[];
|
|
417
|
+
};
|
|
418
|
+
readonly notes: {
|
|
419
|
+
add: (input: AddNoteInput) => AddNoteResult;
|
|
420
|
+
get: (id: number) => Note | null;
|
|
421
|
+
show: (id: number, halfLifeDays?: number) => NoteDetail;
|
|
422
|
+
list: (options?: ListNotesOptions) => WeightedNote[];
|
|
423
|
+
stale: (halfLifeDays?: number) => WeightedNote[];
|
|
424
|
+
drop: (id: number, input: DropNoteInput) => Note;
|
|
425
|
+
cite: (id: number, input: CiteNoteInput) => NoteCitation;
|
|
426
|
+
recordActiveDay: () => void;
|
|
427
|
+
activity: (session: string) => NoteActivity[];
|
|
428
|
+
};
|
|
429
|
+
readonly memory: {
|
|
430
|
+
atStart: (session: Session, options?: MemoryOptions) => string | undefined;
|
|
431
|
+
ofSession: (session: Session, options?: MemoryOptions) => string | undefined;
|
|
432
|
+
forRepo: (session: Session, repo: string, options?: MemoryOptions) => string | undefined;
|
|
433
|
+
copyRepos: (from: string, into: string) => void;
|
|
434
|
+
};
|
|
435
|
+
readonly status: {
|
|
436
|
+
view: (session: Session) => StatusView;
|
|
437
|
+
render: (session: Session, options?: RenderOptions) => string;
|
|
438
|
+
sections: (session: Session) => string;
|
|
439
|
+
};
|
|
440
|
+
close(): void;
|
|
441
|
+
}
|
|
442
|
+
interface OpenCarnetOptions extends LocateOptions, CarnetOptions {
|
|
443
|
+
dbPath?: string;
|
|
444
|
+
}
|
|
445
|
+
declare function openCarnet(options?: OpenCarnetOptions): Carnet;
|
|
446
|
+
export { LogEventInput as $, EMOJI as $t, DUPLICATE_SIMILARITY as A, GROUP_FILE as At, NoteKind as B, repoNameFor as Bt, StatusView as C, HostToolPayload as Ct, AddNoteResult as D, hostById as Dt, AddNoteInput as E, allHosts as Et, Note as F, findGroupRoot as Ft, localDay as G, FinishAgentInput as Gt, WeightedNote as H, reportPathFor as Ht, NoteActivity as I, isGroupRoot as It, similarity as J, REPORTING_NOTE as Jt, memoryHalfLife as K, ListAgentsOptions as Kt, NoteActivityKind as L, isInside as Lt, ListNotesOptions as M, GroupFile as Mt, NOTE_KINDS as N, LocateOptions as Nt, CiteNoteInput as O, DB_FILE as Ot, NOTE_TEXT_LIMIT as P, REPORTS_DIRECTORY as Pt, EventType as Q, AgentStatus as Qt, NoteCitation as R, loadGroup as Rt, StatusLine as S, HostSubagentPayload as St, formatClock as T, ResumeCommand as Tt, groupRepoNames as U, reportsDirectoryOf as Ut, STALE_AFTER_ACTIVE_DAYS as V, repoPathFor as Vt, isNoteKind as W, Agent as Wt, CarnetEvent as X, UpdateAgentInput as Xt, AgentEventType as Y, StartAgentInput as Yt, EVENT_TYPES as Z, AGENT_STATUSES as Zt, renderTableLine as _, DEFAULT_HOST as _t, MAIN_WORKING_SUFFIX as a, isUserActionStatus as an, MergeResult as at, memoryMaxCharacters as b, HostSessionEndPayload as bt, NotesMode as c, HookSessionPayload as ct, renderAgentLine as d, Session as dt, LEGEND as en, SESSION_EVENT_TYPES as et, renderNoteLine as f, SessionKind as ft, renderStatus as g, ContextFileResult as gt, renderSections as h, ContextFile as ht, openCarnet as i, isAgentStatus as in, TableItem as it, DropNoteInput as j, Group as jt, DEFAULT_HALF_LIFE_DAYS as k, GROUP_DIRECTORY as kt, RenderOptions as l, ListSessionsOptions as lt, renderNotesSummary as m, shortId as mt, CarnetOptions as n, USER_ACTION_STATUSES as nn, isEventType as nt, NOTES_FOLD_LINES as o, CreateSessionInput as ot, renderNotes as p, SessionStatus as pt, sessionNoteActivity as q, PUBLISH_FALLBACK_MILLISECONDS as qt, OpenCarnetOptions as r, UserActionStatus as rn, SetTableInput as rt, NOTES_HEADER as s, HookEnv as st, Carnet as t, MAIN_WORKING_EMOJI as tn, SessionEventType as tt, SIMILAR_PREFIX as u, MINIMUM_ID_PREFIX as ut, MEMORY_MAX_CHARACTERS as v, Host as vt, buildStatusView as w, LaunchOptions as wt, renderMemory as x, HostSessionPayload as xt, MemoryOptions as y, HostPromptPayload as yt, NoteDetail as z, locateGroup as zt };
|
|
447
|
+
//# sourceMappingURL=carnet-CsFtIv2C.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carnet-CsFtIv2C.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/group/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;;cCJA;KAYD,sBAAsB;cAErB;KAUD,2BAA2B;cAE1B,OAAO,OAAO,QAAQ;cAWtB;cAEA;iBAGG,cAAc,iBAAiB,SAAS;iBAIxC,mBAAmB,iBAAiB,SAAS;UCxC5C;EACf;EACA;EACA;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EACA;EACA,MAAM;EACN,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAsBU,qBAAqB;UAEhB;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA,MAAM;EACN;EACA;EACA;EACA;;UAGe;EACf;EACA;;cAoPW;iBAEG,QAAQ;UC3TP;EACf,SAAS;EACT;EACA;EACA;EACA;;UCJe;EACf;EACA;EACA,QAAQ;EACR;EACA;;UAGe;EACf;EACA;EACA,SAAS;;cCbE;cAUA;KAOD,yBAAyB;KACzB,2BAA2B;KAC3B,YAAY,iBAAiB;UAIxB;EACf;EACA;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;;UAGe;EACf,MAAM;EACN;EACA;EACA;EACA;;iBAoBc,YAAY,iBAAiB,SAAS;cCzDzC;KACD,mBAAmB;cAElB;cACA;cACA;cACA;iBAIG,WAAW,gBAAgB,SAAS;iBAIpC,eAAe;UAKd;EACf;EACA,MAAM;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe,qBAAqB;EACpC;EACA;;UAGe,mBAAmB;EAClC,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf,MAAM;EACN,SAAS;;UAGM;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;;iBAkCc,eAAe,OAAO;iBAqBtB,WAAW,eAAe;iBAS1B,SAAS,MAAM;KAqOnB;UAEK;EACf,UAAU;EACV;EACA,MAAM;EACN;EACA;EACA;EACA;;iBAWc,oBAAoB,KAAK,KAAK,kBAAkB;UC1Y/C;EACf;EACA,QAAQ;EACR;EACA;;UAGe;EACf;EACA;EACA,OAAO;EACP,SAAS;EACT,SAAS;EACT,OAAO;;iBA6BO,YAAY,MAAM;iBAMlB,gBAAgB,KAAK,KAAK,SAAS,UAAU;cC5ChD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,OAAI,iBAAkB,cAAc,oBAF2BA;IAI/D,OAAI,iBAAkB,UAAY,sBAAAA;IAClC,eAAY,iBAAkB,oBADqBA;IAEnD,eAAY,iBAAkB,wBADiBA;IAG/C,eAAY,iBAAkB,qBAAqB,qBAFAA;;WAM5C;IACP,MAAG,oBALkEC;IAMrE,MAAG,iBAAkB,OAAS,kBAAAA;IAC9B,QAAK;;WAGE;IACP,MAAG,iBAAkB,OAAS,kBAAAC;IAC9B,OAAI,iBAAkB,gBAAgB,wBADKA;;WAKpC;IACP,MAAG,OAAU,iBAAAC;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,eAAe;EACxD;;iBAGc,WAAW,UAAS,oBAAyB"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { $ as LogEventInput, $t as EMOJI, A as DUPLICATE_SIMILARITY, At as GROUP_FILE, B as NoteKind, Bt as repoNameFor, C as StatusView, Ct as HostToolPayload, D as AddNoteResult, Dt as hostById, E as AddNoteInput, Et as allHosts, F as Note, Ft as findGroupRoot, G as localDay, Gt as FinishAgentInput, H as WeightedNote, Ht as reportPathFor, I as NoteActivity, It as isGroupRoot, J as similarity, Jt as REPORTING_NOTE, K as memoryHalfLife, Kt as ListAgentsOptions, L as NoteActivityKind, Lt as isInside, M as ListNotesOptions, Mt as GroupFile, N as NOTE_KINDS, Nt as LocateOptions, O as CiteNoteInput, Ot as DB_FILE, P as NOTE_TEXT_LIMIT, Pt as REPORTS_DIRECTORY, Q as EventType, Qt as AgentStatus, R as NoteCitation, Rt as loadGroup, S as StatusLine, St as HostSubagentPayload, T as formatClock, Tt as ResumeCommand, U as groupRepoNames, Ut as reportsDirectoryOf, V as STALE_AFTER_ACTIVE_DAYS, Vt as repoPathFor, W as isNoteKind, Wt as Agent, X as CarnetEvent, Xt as UpdateAgentInput, Y as AgentEventType, Yt as StartAgentInput, Z as EVENT_TYPES, Zt as AGENT_STATUSES, _ as renderTableLine, _t as DEFAULT_HOST, a as MAIN_WORKING_SUFFIX, an as isUserActionStatus, at as MergeResult, b as memoryMaxCharacters, bt as HostSessionEndPayload, c as NotesMode, ct as HookSessionPayload, d as renderAgentLine, dt as Session, en as LEGEND, et as SESSION_EVENT_TYPES, f as renderNoteLine, ft as SessionKind, g as renderStatus, gt as ContextFileResult, h as renderSections, ht as ContextFile, i as openCarnet, in as isAgentStatus, it as TableItem, j as DropNoteInput, jt as Group, k as DEFAULT_HALF_LIFE_DAYS, kt as GROUP_DIRECTORY, l as RenderOptions, lt as ListSessionsOptions, m as renderNotesSummary, mt as shortId, n as CarnetOptions, nn as USER_ACTION_STATUSES, nt as isEventType, o as NOTES_FOLD_LINES, ot as CreateSessionInput, p as renderNotes, pt as SessionStatus, q as sessionNoteActivity, qt as PUBLISH_FALLBACK_MILLISECONDS, r as OpenCarnetOptions, rn as UserActionStatus, rt as SetTableInput, s as NOTES_HEADER, st as HookEnv, t as Carnet, tn as MAIN_WORKING_EMOJI, tt as SessionEventType, u as SIMILAR_PREFIX, ut as MINIMUM_ID_PREFIX, v as MEMORY_MAX_CHARACTERS, vt as Host, w as buildStatusView, wt as LaunchOptions, x as renderMemory, xt as HostSessionPayload, y as MemoryOptions, yt as HostPromptPayload, z as NoteDetail, zt as locateGroup } from "./carnet-CsFtIv2C.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' | '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' | '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
|
+
export declare function handleSessionEnd(carnet: Carnet, payload: HostSessionEndPayload): Session | undefined;
|
|
31
|
+
interface SessionStartResult {
|
|
32
|
+
session: Session;
|
|
33
|
+
additionalContext?: string;
|
|
34
|
+
contextParts: string[];
|
|
35
|
+
notices: string[];
|
|
36
|
+
}
|
|
37
|
+
export declare function handleSessionStart(carnet: Carnet, payload: HookSessionPayload, env: HookEnv): SessionStartResult;
|
|
38
|
+
export declare const PROMPT_FILE = "prompt.md";
|
|
39
|
+
export declare const PROMPTS_DIRECTORY = "prompts";
|
|
40
|
+
interface PromptSession {
|
|
41
|
+
id: string;
|
|
42
|
+
name: string | null;
|
|
43
|
+
kind: SessionKind;
|
|
44
|
+
}
|
|
45
|
+
interface AssembledPrompt {
|
|
46
|
+
text: string;
|
|
47
|
+
version: string;
|
|
48
|
+
}
|
|
49
|
+
interface AppendPromptFile {
|
|
50
|
+
path: string;
|
|
51
|
+
version: string;
|
|
52
|
+
}
|
|
53
|
+
export declare function baseRules(env?: NodeJS.ProcessEnv): string;
|
|
54
|
+
export declare function groupRules(group: Group): string | undefined;
|
|
55
|
+
export declare function rulesText(group: Group, env?: NodeJS.ProcessEnv): string;
|
|
56
|
+
export declare function rulesVersion(group: Group, env?: NodeJS.ProcessEnv): string;
|
|
57
|
+
export declare function assemblePrompt(group: Group, session: PromptSession, env?: NodeJS.ProcessEnv): AssembledPrompt;
|
|
58
|
+
export declare function appendPromptFile(group: Group, session: PromptSession, env?: NodeJS.ProcessEnv): AppendPromptFile;
|
|
59
|
+
export declare function compactReminder(group: Group, env?: NodeJS.ProcessEnv): string;
|
|
60
|
+
export declare const OUTSIDE_RUCHER_CONTEXT = "This session was started without rucher, so the Rucher rules are not in its system prompt. Follow the Carnet server instructions and load the rucher skill before dispatching or applying forks.";
|
|
61
|
+
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)";
|
|
62
|
+
export declare const RULES_UPDATED_NOTICE = "rucher: rules updated, will apply after the next compaction or in a new session";
|
|
63
|
+
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.";
|
|
64
|
+
export declare const CORE_RULES = "- Work can be parallel, review stays sequential: forks work at the same time, the human handles their results one at a time.\n- The human keeps the hand: only the human launches forks, applies, tests and commits. Agents propose, they never push.\n- Status lives in Carnet: agent statuses, the \"On the table\" line and the journal go through the Carnet tools, never into status files nor chat updates. Update before and after each piece of work.\n- When a fork finishes, say only \"<name> finished, report ready\". Never summarise, quote or act on its report or final message until the human asks for that fork's report, even when answering about something else.\n- Forks never commit, push, stash or record notes. A fork writes its report to a file, ending with a Learnings section, calls agent_done as its last tool action, then replies with one line that carries no results, such as \"<name> done, report written\". Only the main agent records notes, at the end of a step.\n- To dispatch, apply or review forks, load the rucher skill: it holds the full workflow.";
|
|
65
|
+
export declare function handleUserPromptSubmit(carnet: Carnet, host: Host, payload: HostPromptPayload): Session;
|
|
66
|
+
export declare function handleToolUse(carnet: Carnet, payload: HostToolPayload, env: HookEnv): string | undefined;
|
|
67
|
+
export declare const REPOS_START = "<!-- rucher:repos start -->";
|
|
68
|
+
export declare const REPOS_END = "<!-- rucher:repos end -->";
|
|
69
|
+
export declare function transcriptTitle(path: string): string | undefined;
|
|
70
|
+
export declare function reposBlock(group: Group): string;
|
|
71
|
+
export declare function replaceReposBlock(content: string, group: Group): string | null;
|
|
72
|
+
export declare function groupInstructions(group: Group): string;
|
|
73
|
+
export declare function groupSettings(group: Group): string;
|
|
74
|
+
export declare const claudeCode: Host;
|
|
75
|
+
export declare const DEFAULT_PURGE_DAYS = 3;
|
|
76
|
+
export declare function purgeDays(value: string | undefined): number;
|
|
77
|
+
export declare const RESUME_EVENTS = 20;
|
|
78
|
+
export declare const RESUME_MAX_CHARACTERS = 2000;
|
|
79
|
+
interface ResumeContextOptions {
|
|
80
|
+
events?: number;
|
|
81
|
+
maxCharacters?: number;
|
|
82
|
+
}
|
|
83
|
+
export declare function formatEventLine(event: CarnetEvent): string;
|
|
84
|
+
export declare function sessionLabel(session: Session): string;
|
|
85
|
+
export declare function resumeContext(carnet: Carnet, session: Session, { events, maxCharacters }?: ResumeContextOptions): string;
|
|
86
|
+
export declare const PAIRING_WINDOW_MILLISECONDS = 60000;
|
|
87
|
+
export declare const STOPPED_NOTE = "stopped without agent_done";
|
|
88
|
+
export declare const NOTE_MAX = 60;
|
|
89
|
+
export declare function sanitizeNote(text: string): string;
|
|
90
|
+
export { AGENT_STATUSES, type AddNoteInput, type AddNoteResult, type Agent, type AgentEventType, type AgentStatus, type AppendPromptFile, type AssembledPrompt, Carnet, type CarnetErrorCode, type CarnetEvent, type CarnetOptions, type CiteNoteInput, type ContextFile, type ContextFileResult, type CreateSessionInput, DB_FILE, DEFAULT_HALF_LIFE_DAYS, DEFAULT_HOST, DUPLICATE_SIMILARITY, type DropNoteInput, 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 HostSessionEndPayload, type HostSessionPayload, type HostSubagentPayload, type HostToolPayload, type InitOptions, LEGEND, type LaunchOptions, type ListAgentsOptions, type ListNotesOptions, type ListSessionsOptions, type LocateOptions, type LogEventInput, MAIN_WORKING_EMOJI, MAIN_WORKING_SUFFIX, MEMORY_MAX_CHARACTERS, MINIMUM_ID_PREFIX, type MemoryOptions, type MergeResult, 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, REPORTS_DIRECTORY, type RenderOptions, type ResumeCommand, type ResumeContextOptions, 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 TableItem, USER_ACTION_STATUSES, type UpdateAgentInput, type UserActionStatus, type WeightedNote, allHosts, buildStatusView, findGroupRoot, formatClock, groupRepoNames, hostById, isAgentStatus, isEventType, isGroupRoot, isInside, isNoteKind, isUserActionStatus, loadGroup, localDay, locateGroup, memoryHalfLife, memoryMaxCharacters, openCarnet, renderAgentLine, renderMemory, renderNoteLine, renderNotes, renderNotesSummary, renderSections, renderStatus, renderTableLine, repoNameFor, repoPathFor, reportPathFor, reportsDirectoryOf, sessionNoteActivity, shortId, similarity };
|
|
91
|
+
//# 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-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"],"mappings":";;qBAGa;wBAEG,aAAa,eAAe;qBCH/B;wBAgLG,cAAc,IAAI;wBASlB,QAAQ,IAAI;KC3LhB;qBAsBC,oBAAoB;WAEpB,MAAM;EADjB,YACW,MAAM,iBACf;;UCTa;EACf;EACA;EACA;EACA,MAAM,OAAO;;wBAcC,UAAU,mBAAmB,UAAS,cAAmB;wBA0BzD,aAAa,cAAc,eAAe;wBAuB1C,gBAAgB,cAAc,eAAe;UC/E5C;EACf;EACA;;wBAOc,WAAW,MAAK,OAAO;wBAQvB,aAAa,MAAM,OAAO,aAAa;wBAmBvC,cACd,WAAW,gBACX,M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