@rucher/carnet 0.2.0-beta.6 → 0.2.0-beta.8
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-DHw_oXJs.d.mts → carnet-MC9WeQ6h.d.mts} +162 -42
- package/dist/carnet-MC9WeQ6h.d.mts.map +1 -0
- package/dist/index.d.mts +33 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +165 -7
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.d.mts +4 -2
- package/dist/mcp.d.mts.map +1 -1
- package/dist/mcp.mjs +337 -27
- package/dist/mcp.mjs.map +1 -1
- package/dist/{steps-4ZTrBzcd.mjs → steps-xzr8iVWn.mjs} +644 -137
- package/dist/steps-xzr8iVWn.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/carnet-DHw_oXJs.d.mts.map +0 -1
- package/dist/steps-4ZTrBzcd.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @rucher/carnet
|
|
2
2
|
|
|
3
|
-
Shared state for Rucher: workspaces, sessions, agents, the
|
|
3
|
+
Shared state for Rucher: workspaces, sessions, agents, the Main 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
|
-
Used by the `rucher` CLI and the Carnet MCP server. See [
|
|
5
|
+
Used by the `rucher` CLI and the Carnet MCP server. See the [documentation](https://github.com/Florian-Varrin/Rucher/blob/master/docs/README.md) in the [repository](https://github.com/Florian-Varrin/Rucher).
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
import { openCarnet } from '@rucher/carnet';
|
|
@@ -4,19 +4,61 @@ interface Ctx {
|
|
|
4
4
|
now: () => Date;
|
|
5
5
|
workspace: string | null;
|
|
6
6
|
}
|
|
7
|
-
declare const
|
|
7
|
+
declare const EVENT_TYPES: readonly ['started', 'finished', 'answered', 'applied', 'tested', 'committed', 'dropped', 'injected', 'promoted', 'triaged'];
|
|
8
|
+
declare const SESSION_EVENT_TYPES: readonly ['session.started', 'session.resumed', 'session.ended', 'session.forked'];
|
|
9
|
+
type AgentEventType = (typeof EVENT_TYPES)[number];
|
|
10
|
+
type SessionEventType = (typeof SESSION_EVENT_TYPES)[number];
|
|
11
|
+
type EventType = AgentEventType | SessionEventType;
|
|
12
|
+
interface CarnetEvent {
|
|
13
|
+
id: number;
|
|
14
|
+
session: string;
|
|
15
|
+
at: string;
|
|
16
|
+
type: EventType;
|
|
17
|
+
agent: string | null;
|
|
18
|
+
commit: string | null;
|
|
19
|
+
link: string | null;
|
|
20
|
+
note: string | null;
|
|
21
|
+
}
|
|
22
|
+
interface LogEventInput {
|
|
23
|
+
type: EventType;
|
|
24
|
+
agent?: string | undefined;
|
|
25
|
+
commit?: string | undefined;
|
|
26
|
+
link?: string | undefined;
|
|
27
|
+
note?: string | undefined;
|
|
28
|
+
}
|
|
29
|
+
declare function isEventType(value: unknown): value is EventType;
|
|
30
|
+
declare const AGENT_STATUSES: readonly ['running', 'discussing', 'answer', 'review', 'apply', 'test', 'closed'];
|
|
8
31
|
type AgentStatus = (typeof AGENT_STATUSES)[number];
|
|
9
|
-
declare const USER_ACTION_STATUSES: readonly ['discussing', 'answer', 'review', 'apply', 'test'
|
|
32
|
+
declare const USER_ACTION_STATUSES: readonly ['discussing', 'answer', 'review', 'apply', 'test'];
|
|
10
33
|
type UserActionStatus = (typeof USER_ACTION_STATUSES)[number];
|
|
11
34
|
declare const EMOJI: Record<Exclude<AgentStatus, 'closed'>, string>;
|
|
12
35
|
declare const MAIN_WORKING_EMOJI = "⚙️";
|
|
13
|
-
declare const
|
|
36
|
+
declare const MAIN_WAITING_EMOJI = "⏸";
|
|
37
|
+
declare const MAIN_FAILED_EMOJI = "⚠";
|
|
38
|
+
declare const LEGEND = "⚙️ main working · ⏸ waiting on you · ⚠ turn failed · 💬 discussing · ❓ answer · 👀 review · 📥 apply · 🧪 test · ⏳ running";
|
|
39
|
+
declare const KIND_ABBREVIATIONS: {
|
|
40
|
+
readonly research: 'rs';
|
|
41
|
+
readonly analyze: 'an';
|
|
42
|
+
readonly implement: 'im';
|
|
43
|
+
readonly review: 'rv';
|
|
44
|
+
};
|
|
45
|
+
declare function kindTag(kind: keyof typeof KIND_ABBREVIATIONS): string;
|
|
46
|
+
declare const KIND_TAG_PATTERN: RegExp;
|
|
47
|
+
declare const KIND_LEGEND = "[rs] research · [an] analyze · [im] implement · [rv] review";
|
|
14
48
|
declare function isAgentStatus(value: unknown): value is AgentStatus;
|
|
15
49
|
declare function isUserActionStatus(value: unknown): value is UserActionStatus;
|
|
16
|
-
declare const OPEN_AGENT_STATUSES: readonly ["running", "discussing", "answer", "review", "apply", "test"
|
|
50
|
+
declare const OPEN_AGENT_STATUSES: readonly ["running", "discussing", "answer", "review", "apply", "test"];
|
|
51
|
+
declare const AGENT_KINDS: readonly ['research', 'analyze', 'implement', 'review'];
|
|
52
|
+
type AgentKind = (typeof AGENT_KINDS)[number];
|
|
53
|
+
declare const DEFAULT_AGENT_KIND: AgentKind;
|
|
54
|
+
declare function isAgentKind(value: unknown): value is AgentKind;
|
|
17
55
|
interface Agent {
|
|
18
56
|
session: string;
|
|
19
57
|
name: string;
|
|
58
|
+
kind: AgentKind;
|
|
59
|
+
promotedFrom: AgentKind | null;
|
|
60
|
+
target: string | null;
|
|
61
|
+
blockedOn: string | null;
|
|
20
62
|
task: string | null;
|
|
21
63
|
status: AgentStatus;
|
|
22
64
|
note: string | null;
|
|
@@ -33,13 +75,16 @@ interface Agent {
|
|
|
33
75
|
interface StartAgentInput {
|
|
34
76
|
name: string;
|
|
35
77
|
task: string;
|
|
78
|
+
kind?: AgentKind | undefined;
|
|
79
|
+
target?: string | undefined;
|
|
36
80
|
baseCommit?: string | undefined;
|
|
37
81
|
worktree?: string | undefined;
|
|
38
82
|
}
|
|
39
83
|
interface UpdateAgentInput {
|
|
40
84
|
status: AgentStatus;
|
|
41
|
-
note?: string | undefined;
|
|
85
|
+
note?: string | null | undefined;
|
|
42
86
|
reportPath?: string | undefined;
|
|
87
|
+
blockedOn?: string | null | undefined;
|
|
43
88
|
}
|
|
44
89
|
interface FinishAgentInput {
|
|
45
90
|
reportPath: string;
|
|
@@ -50,6 +95,11 @@ interface ListAgentsOptions {
|
|
|
50
95
|
}
|
|
51
96
|
declare const REPORTING_NOTE = "reporting";
|
|
52
97
|
declare const PUBLISH_FALLBACK_MILLISECONDS = 120000;
|
|
98
|
+
declare function statusWhenDone(kind: AgentKind, hasQuestions: boolean): AgentStatus;
|
|
99
|
+
interface PromoteAgentInput {
|
|
100
|
+
worktree?: string | undefined;
|
|
101
|
+
baseCommit?: string | undefined;
|
|
102
|
+
}
|
|
53
103
|
interface WorkspaceRepo {
|
|
54
104
|
path: string;
|
|
55
105
|
name: string;
|
|
@@ -96,11 +146,10 @@ declare function dropWorkspace(name: string, options?: DropWorkspaceOptions): Wo
|
|
|
96
146
|
declare function isInside(directory: string, path: string): boolean;
|
|
97
147
|
declare function repoNameFor(workspace: Workspace | null, path: string | undefined): string | null;
|
|
98
148
|
declare function repoPathFor(workspace: Workspace | null, path: string | undefined | null): string | null;
|
|
99
|
-
type WorkspaceOrigin = 'session' | 'option' | 'env' | 'run-directory' | '
|
|
149
|
+
type WorkspaceOrigin = 'session' | 'option' | 'env' | 'run-directory' | 'none';
|
|
100
150
|
interface WorkspaceResolution {
|
|
101
151
|
workspace: Workspace | null;
|
|
102
152
|
origin: WorkspaceOrigin;
|
|
103
|
-
repo?: WorkspaceRepo | undefined;
|
|
104
153
|
}
|
|
105
154
|
interface ResolveWorkspaceOptions {
|
|
106
155
|
db?: DatabaseSync | undefined;
|
|
@@ -112,7 +161,6 @@ interface ResolveWorkspaceOptions {
|
|
|
112
161
|
declare function resolveWorkspace({ db, sessionId, workspace, cwd, env }?: ResolveWorkspaceOptions): WorkspaceResolution;
|
|
113
162
|
declare function workspaceLabel(workspace: Workspace | null): string;
|
|
114
163
|
declare function requireWorkspace(workspace: Workspace | null): Workspace;
|
|
115
|
-
declare function ambiguousWorkspaceContext(reason: string): string;
|
|
116
164
|
interface HostSessionPayload {
|
|
117
165
|
session_id: string;
|
|
118
166
|
cwd?: string | undefined;
|
|
@@ -133,6 +181,11 @@ interface HostSubagentPayload {
|
|
|
133
181
|
description?: string | undefined;
|
|
134
182
|
agent_transcript_path?: string | undefined;
|
|
135
183
|
}
|
|
184
|
+
interface HostStopPayload {
|
|
185
|
+
session_id: string;
|
|
186
|
+
cwd?: string | undefined;
|
|
187
|
+
failed: boolean;
|
|
188
|
+
}
|
|
136
189
|
interface HostSessionEndPayload {
|
|
137
190
|
session_id: string;
|
|
138
191
|
cwd?: string | undefined;
|
|
@@ -143,7 +196,10 @@ interface HostToolPayload {
|
|
|
143
196
|
cwd?: string | undefined;
|
|
144
197
|
tool_name?: string | undefined;
|
|
145
198
|
agent_id?: string | undefined;
|
|
199
|
+
agent_type?: string | undefined;
|
|
146
200
|
path?: string | undefined;
|
|
201
|
+
file_path?: string | undefined;
|
|
202
|
+
command?: string | undefined;
|
|
147
203
|
}
|
|
148
204
|
interface ResumeCommand {
|
|
149
205
|
command: string;
|
|
@@ -166,6 +222,7 @@ interface Host {
|
|
|
166
222
|
sessionIdFromEnvironment(env: NodeJS.ProcessEnv): string | undefined;
|
|
167
223
|
projectDirectory(env: NodeJS.ProcessEnv): string | undefined;
|
|
168
224
|
parseSessionPayload(json: string): HostSessionPayload;
|
|
225
|
+
parseStopPayload(json: string): HostStopPayload;
|
|
169
226
|
parsePromptPayload(json: string): HostPromptPayload;
|
|
170
227
|
parseSubagentPayload(json: string): HostSubagentPayload;
|
|
171
228
|
parseSessionEndPayload(json: string): HostSessionEndPayload;
|
|
@@ -180,6 +237,7 @@ interface Host {
|
|
|
180
237
|
renameInstruction(name: string): string;
|
|
181
238
|
transcriptFiles(session: Session, env?: NodeJS.ProcessEnv): string[];
|
|
182
239
|
hasConversation(session: Session, env?: NodeJS.ProcessEnv): boolean;
|
|
240
|
+
continues(parent: Session, childId: string, env?: NodeJS.ProcessEnv): boolean;
|
|
183
241
|
renderRunDirectory(workspace: Workspace): HostRender;
|
|
184
242
|
}
|
|
185
243
|
declare const DEFAULT_HOST = "claude-code";
|
|
@@ -189,7 +247,7 @@ type SessionKind = 'active' | 'temp';
|
|
|
189
247
|
type SessionStatus = 'running' | 'idle' | 'archived';
|
|
190
248
|
interface Session {
|
|
191
249
|
id: string;
|
|
192
|
-
workspace: string
|
|
250
|
+
workspace: string;
|
|
193
251
|
name: string | null;
|
|
194
252
|
purpose: string | null;
|
|
195
253
|
kind: SessionKind;
|
|
@@ -202,6 +260,7 @@ interface Session {
|
|
|
202
260
|
lastTitle: string | null;
|
|
203
261
|
parentId: string | null;
|
|
204
262
|
promptVersion: string | null;
|
|
263
|
+
pluginVersion: string | null;
|
|
205
264
|
createdAt: string;
|
|
206
265
|
lastActiveAt: string;
|
|
207
266
|
endedAt: string | null;
|
|
@@ -218,6 +277,7 @@ interface HookEnv {
|
|
|
218
277
|
RUCHER_PROMPT_VERSION?: string | undefined;
|
|
219
278
|
RUCHER_MEMORY_MAX_CHARACTERS?: string | undefined;
|
|
220
279
|
RUCHER_MEMORY_HALF_LIFE_DAYS?: string | undefined;
|
|
280
|
+
CLAUDE_CONFIG_DIR?: string | undefined;
|
|
221
281
|
}
|
|
222
282
|
interface CreateSessionInput {
|
|
223
283
|
id: string;
|
|
@@ -240,41 +300,61 @@ interface MergeResult {
|
|
|
240
300
|
movedEvents: number;
|
|
241
301
|
movedTable: boolean;
|
|
242
302
|
}
|
|
303
|
+
interface QuestionInput {
|
|
304
|
+
text: string;
|
|
305
|
+
context?: string | undefined;
|
|
306
|
+
recommendation: string;
|
|
307
|
+
alternatives?: readonly string[] | undefined;
|
|
308
|
+
}
|
|
309
|
+
interface Question {
|
|
310
|
+
n: number;
|
|
311
|
+
total: number;
|
|
312
|
+
text: string;
|
|
313
|
+
context: string | null;
|
|
314
|
+
recommendation: string;
|
|
315
|
+
alternatives: string[];
|
|
316
|
+
answer: string | null;
|
|
317
|
+
answeredAt: string | null;
|
|
318
|
+
}
|
|
319
|
+
interface AnswerInput {
|
|
320
|
+
n: number;
|
|
321
|
+
answer: string;
|
|
322
|
+
}
|
|
323
|
+
declare const FINDING_SEVERITIES: readonly ['blocking', 'to_fix', 'suggestion'];
|
|
324
|
+
type FindingSeverity = (typeof FINDING_SEVERITIES)[number];
|
|
325
|
+
declare const FINDING_DECISIONS: readonly ['sent', 'fixed', 'ignored'];
|
|
326
|
+
type FindingDecision = (typeof FINDING_DECISIONS)[number];
|
|
327
|
+
interface FindingInput {
|
|
328
|
+
severity: FindingSeverity;
|
|
329
|
+
location?: string | undefined;
|
|
330
|
+
text: string;
|
|
331
|
+
fix?: string | undefined;
|
|
332
|
+
}
|
|
333
|
+
interface Finding {
|
|
334
|
+
n: number;
|
|
335
|
+
total: number;
|
|
336
|
+
severity: FindingSeverity;
|
|
337
|
+
location: string | null;
|
|
338
|
+
text: string;
|
|
339
|
+
fix: string | null;
|
|
340
|
+
decision: FindingDecision | null;
|
|
341
|
+
reason: string | null;
|
|
342
|
+
}
|
|
343
|
+
interface DecisionInput {
|
|
344
|
+
n: number;
|
|
345
|
+
decision: FindingDecision;
|
|
346
|
+
reason?: string | undefined;
|
|
347
|
+
}
|
|
243
348
|
interface TableItem {
|
|
244
349
|
session: string;
|
|
245
350
|
text: string;
|
|
246
351
|
status: UserActionStatus | null;
|
|
247
|
-
mainWorking: boolean;
|
|
248
352
|
updatedAt: string;
|
|
249
353
|
}
|
|
250
354
|
interface SetTableInput {
|
|
251
355
|
text: string;
|
|
252
|
-
mainWorking?: boolean | undefined;
|
|
253
356
|
status?: UserActionStatus | undefined;
|
|
254
357
|
}
|
|
255
|
-
declare const EVENT_TYPES: readonly ['started', 'finished', 'answered', 'applied', 'tested', 'committed', 'dropped'];
|
|
256
|
-
declare const SESSION_EVENT_TYPES: readonly ['session.started', 'session.resumed', 'session.ended', 'session.forked'];
|
|
257
|
-
type AgentEventType = (typeof EVENT_TYPES)[number];
|
|
258
|
-
type SessionEventType = (typeof SESSION_EVENT_TYPES)[number];
|
|
259
|
-
type EventType = AgentEventType | SessionEventType;
|
|
260
|
-
interface CarnetEvent {
|
|
261
|
-
id: number;
|
|
262
|
-
session: string;
|
|
263
|
-
at: string;
|
|
264
|
-
type: EventType;
|
|
265
|
-
agent: string | null;
|
|
266
|
-
commit: string | null;
|
|
267
|
-
link: string | null;
|
|
268
|
-
note: string | null;
|
|
269
|
-
}
|
|
270
|
-
interface LogEventInput {
|
|
271
|
-
type: EventType;
|
|
272
|
-
agent?: string | undefined;
|
|
273
|
-
commit?: string | undefined;
|
|
274
|
-
link?: string | undefined;
|
|
275
|
-
note?: string | undefined;
|
|
276
|
-
}
|
|
277
|
-
declare function isEventType(value: unknown): value is EventType;
|
|
278
358
|
declare const NOTE_KINDS: readonly ['dead_end', 'decision', 'learning'];
|
|
279
359
|
type NoteKind = (typeof NOTE_KINDS)[number];
|
|
280
360
|
declare const NOTE_TEXT_LIMIT = 200;
|
|
@@ -355,22 +435,34 @@ interface NoteActivity {
|
|
|
355
435
|
at: string;
|
|
356
436
|
}
|
|
357
437
|
declare function sessionNoteActivity(ctx: Ctx, session: string): NoteActivity[];
|
|
438
|
+
declare const TURNS: readonly ['working', 'waiting', 'failed'];
|
|
439
|
+
type Turn = (typeof TURNS)[number];
|
|
440
|
+
interface TurnOptions {
|
|
441
|
+
trackTurn?: boolean | undefined;
|
|
442
|
+
}
|
|
358
443
|
interface StatusLine {
|
|
359
444
|
name: string;
|
|
445
|
+
kind: AgentKind;
|
|
360
446
|
status: AgentStatus;
|
|
361
447
|
emoji: string;
|
|
448
|
+
action: string | null;
|
|
362
449
|
note: string | null;
|
|
363
450
|
}
|
|
364
451
|
interface StatusView {
|
|
365
452
|
time: string;
|
|
366
453
|
sessionName: string | null;
|
|
367
454
|
table: TableItem | null;
|
|
455
|
+
turn: Turn | null;
|
|
368
456
|
waiting: StatusLine[];
|
|
457
|
+
blocked: StatusLine[];
|
|
369
458
|
running: StatusLine[];
|
|
370
459
|
notes: NoteActivity[];
|
|
371
460
|
}
|
|
461
|
+
interface StatusViewOptions {
|
|
462
|
+
kind?: AgentKind | undefined;
|
|
463
|
+
}
|
|
372
464
|
declare function formatClock(date: Date): string;
|
|
373
|
-
declare function buildStatusView(ctx: Ctx, session: Session): StatusView;
|
|
465
|
+
declare function buildStatusView(ctx: Ctx, session: Session, options?: StatusViewOptions): StatusView;
|
|
374
466
|
declare const MEMORY_MAX_CHARACTERS = 2000;
|
|
375
467
|
declare function memoryMaxCharacters(value: string | undefined): number;
|
|
376
468
|
interface MemoryOptions {
|
|
@@ -382,9 +474,15 @@ interface MemoryScope {
|
|
|
382
474
|
notes: WeightedNote[];
|
|
383
475
|
}
|
|
384
476
|
declare function renderMemory(scope: MemoryScope, maxCharacters?: number): string;
|
|
385
|
-
declare const
|
|
477
|
+
declare const MAIN_HEADER = "Main";
|
|
478
|
+
declare const MAIN_WORKING_SUFFIX = "(main working)";
|
|
479
|
+
declare const BLOCKED_HEADER = "Waiting on agents";
|
|
480
|
+
declare const MAIN_WAITING_SUFFIX = "(waiting on you)";
|
|
481
|
+
declare const MAIN_FAILED_SUFFIX = "(turn failed)";
|
|
386
482
|
declare function renderTableLine(item: TableItem): string;
|
|
387
|
-
declare
|
|
483
|
+
declare const MAIN_IDLE = "idle";
|
|
484
|
+
declare function renderMainLine(item: TableItem | null, turn: Turn | null): string;
|
|
485
|
+
declare function renderAgentLine(line: StatusLine, nameWidth?: number): string;
|
|
388
486
|
declare const NOTES_HEADER = "Notes";
|
|
389
487
|
declare const NOTES_FOLD_LINES = 5;
|
|
390
488
|
declare const SIMILAR_PREFIX = "similar to ";
|
|
@@ -405,6 +503,7 @@ declare class Carnet {
|
|
|
405
503
|
readonly db: DatabaseSync;
|
|
406
504
|
private readonly ctx;
|
|
407
505
|
constructor(db: DatabaseSync, workspace: Workspace | null, options?: CarnetOptions);
|
|
506
|
+
now(): Date;
|
|
408
507
|
requireWorkspace(): Workspace;
|
|
409
508
|
readonly sessions: {
|
|
410
509
|
get: (id: string) => Session | undefined;
|
|
@@ -422,6 +521,7 @@ declare class Carnet {
|
|
|
422
521
|
default: () => Session | undefined;
|
|
423
522
|
byName: (name: string) => Session | undefined;
|
|
424
523
|
byHostProcess: (host: string, processId: number) => Session | undefined;
|
|
524
|
+
recordPluginVersion: (id: string, version: string | null) => void;
|
|
425
525
|
recordPromptVersion: (id: string, version: string | null) => Session;
|
|
426
526
|
setParent: (id: string, parentId: string) => Session;
|
|
427
527
|
setStatus: (id: string, status: SessionStatus) => Session;
|
|
@@ -440,19 +540,39 @@ declare class Carnet {
|
|
|
440
540
|
update: (session: string, name: string, input: UpdateAgentInput) => Agent;
|
|
441
541
|
finish: (session: string, name: string, input: FinishAgentInput) => Agent;
|
|
442
542
|
drop: (session: string, name: string, reason?: string) => Agent;
|
|
543
|
+
close: (session: string, name: string, event: Omit<LogEventInput, 'agent'>) => Agent;
|
|
544
|
+
promote: (session: string, name: string, input: PromoteAgentInput) => Agent;
|
|
443
545
|
list: (session: string, options?: ListAgentsOptions) => Agent[];
|
|
444
546
|
reorderQueue: (session: string, names: string[]) => Agent[];
|
|
547
|
+
byHostAgentId: (session: string, hostAgentId: string) => Agent | undefined;
|
|
445
548
|
pairSubagent: (session: string, hostAgentId: string) => Agent | undefined;
|
|
446
549
|
stopSubagent: (session: string, hostAgentId: string, names?: string[]) => Agent | undefined;
|
|
447
550
|
};
|
|
551
|
+
readonly questions: {
|
|
552
|
+
list: (session: string, agent: string, openOnly?: boolean) => Question[];
|
|
553
|
+
add: (session: string, agent: string, inputs: readonly QuestionInput[]) => Question[];
|
|
554
|
+
answer: (session: string, agent: string, answers: readonly AnswerInput[]) => Question[];
|
|
555
|
+
};
|
|
556
|
+
readonly findings: {
|
|
557
|
+
list: (session: string, agent: string, pendingOnly?: boolean) => Finding[];
|
|
558
|
+
replace: (session: string, agent: string, inputs: readonly FindingInput[]) => Finding[];
|
|
559
|
+
decide: (session: string, agent: string, decisions: readonly DecisionInput[]) => Finding[];
|
|
560
|
+
};
|
|
448
561
|
readonly table: {
|
|
449
562
|
get: (session: string) => TableItem | undefined;
|
|
450
563
|
set: (session: string, input: SetTableInput) => TableItem;
|
|
451
564
|
clear: (session: string) => void;
|
|
452
565
|
};
|
|
566
|
+
readonly turn: {
|
|
567
|
+
get: (session: string) => "failed" | "waiting" | "working" | null;
|
|
568
|
+
start: (session: string) => void;
|
|
569
|
+
wait: (session: string) => void;
|
|
570
|
+
fail: (session: string) => void;
|
|
571
|
+
end: (session: string) => void;
|
|
572
|
+
};
|
|
453
573
|
readonly events: {
|
|
454
574
|
log: (session: string, input: LogEventInput) => CarnetEvent;
|
|
455
|
-
read: (session: string, limit?: number, agentOnly?: boolean) => CarnetEvent[];
|
|
575
|
+
read: (session: string, limit?: number, agentOnly?: boolean, kind?: AgentKind) => CarnetEvent[];
|
|
456
576
|
};
|
|
457
577
|
readonly notes: {
|
|
458
578
|
add: (input: AddNoteInput) => AddNoteResult;
|
|
@@ -472,8 +592,8 @@ declare class Carnet {
|
|
|
472
592
|
copyRepos: (from: string, into: string) => void;
|
|
473
593
|
};
|
|
474
594
|
readonly status: {
|
|
475
|
-
view: (session: Session) => StatusView;
|
|
476
|
-
render: (session: Session, options?: RenderOptions) => string;
|
|
595
|
+
view: (session: Session, options?: StatusViewOptions) => StatusView;
|
|
596
|
+
render: (session: Session, options?: RenderOptions & StatusViewOptions) => string;
|
|
477
597
|
sections: (session: Session) => string;
|
|
478
598
|
};
|
|
479
599
|
close(): void;
|
|
@@ -492,5 +612,5 @@ interface ResolvedCarnet {
|
|
|
492
612
|
}
|
|
493
613
|
declare function openResolvedCarnet(options?: OpenCarnetOptions): ResolvedCarnet;
|
|
494
614
|
declare function openWorkspaceCarnet(workspace: Workspace | null, options?: OpenCarnetOptions): Carnet;
|
|
495
|
-
export {
|
|
496
|
-
//# sourceMappingURL=carnet-
|
|
615
|
+
export { NoteKind as $, dropWorkspace as $t, renderMemory as A, USER_ACTION_STATUSES as An, ResumeCommand as At, AddNoteResult as B, SESSION_EVENT_TYPES as Bn, resolveWorkspace as Bt, renderNotesSummary as C, KIND_LEGEND as Cn, HostRender as Ct, MEMORY_MAX_CHARACTERS as D, MAIN_WAITING_EMOJI as Dn, HostSubagentPayload as Dt, renderTableLine as E, MAIN_FAILED_EMOJI as En, HostStopPayload as Et, formatClock as F, AgentEventType as Fn, WorkspaceResolution as Ft, ListNotesOptions as G, INSTRUCTIONS_FILE as Gt, DEFAULT_HALF_LIFE_DAYS as H, isEventType as Hn, AGENTS_FILE as Ht, TURNS as I, CarnetEvent as In, isInside as It, Note as J, WorkspaceFile as Jt, NOTE_KINDS as K, WORKSPACE_FILE as Kt, Turn as L, EVENT_TYPES as Ln, repoNameFor as Lt, StatusView as M, isAgentStatus as Mn, hostById as Mt, StatusViewOptions as N, isUserActionStatus as Nn, ResolveWorkspaceOptions as Nt, MemoryOptions as O, MAIN_WORKING_EMOJI as On, HostToolPayload as Ot, buildStatusView as P, kindTag as Pn, WorkspaceOrigin as Pt, NoteDetail as Q, definitionInstructions as Qt, TurnOptions as R, EventType as Rn, repoPathFor as Rt, renderNotes as S, KIND_ABBREVIATIONS as Sn, HostPromptPayload as St, renderStatus as T, LEGEND as Tn, HostSessionPayload as Tt, DUPLICATE_SIMILARITY as U, CreateWorkspaceOptions as Ut, CiteNoteInput as V, SessionEventType as Vn, workspaceLabel as Vt, DropNoteInput as W, DropWorkspaceOptions as Wt, NoteActivityKind as X, addWorkspaceRepo as Xt, NoteActivity as Y, WorkspaceRepo as Yt, NoteCitation as Z, createWorkspace as Zt, RenderOptions as _, isAgentKind as _n, SessionKind as _t, openCarnet as a, workspaceExists as an, sessionNoteActivity as at, renderMainLine as b, AgentStatus as bn, DEFAULT_HOST as bt, BLOCKED_HEADER as c, Agent as cn, SetTableInput as ct, MAIN_IDLE as d, FinishAgentInput as dn, CreateSessionInput as dt, expandHome as en, STALE_AFTER_ACTIVE_DAYS as et, MAIN_WAITING_SUFFIX as f, ListAgentsOptions as fn, HookEnv as ft, NotesMode as g, UpdateAgentInput as gn, Session as gt, NOTES_HEADER as h, StartAgentInput as hn, MINIMUM_ID_PREFIX as ht, ResolvedCarnet as i, removeWorkspaceRepo as in, memoryHalfLife as it, StatusLine as j, UserActionStatus as jn, allHosts as jt, memoryMaxCharacters as k, OPEN_AGENT_STATUSES as kn, LaunchOptions as kt, MAIN_FAILED_SUFFIX as l, AgentKind as ln, TableItem as lt, NOTES_FOLD_LINES as m, REPORTING_NOTE as mn, ListSessionsOptions as mt, CarnetOptions as n, listWorkspaces as nn, isNoteKind as nt, openResolvedCarnet as o, workspaceHosts as on, similarity as ot, MAIN_WORKING_SUFFIX as p, PUBLISH_FALLBACK_MILLISECONDS as pn, HookSessionPayload as pt, NOTE_TEXT_LIMIT as q, Workspace as qt, OpenCarnetOptions as r, loadWorkspace as rn, localDay as rt, openWorkspaceCarnet as s, AGENT_KINDS as sn, workspaceRepoNames as st, Carnet as t, isWorkspaceName as tn, WeightedNote as tt, MAIN_HEADER as u, DEFAULT_AGENT_KIND as un, MergeResult as ut, SIMILAR_PREFIX as v, statusWhenDone as vn, SessionStatus as vt, renderSections as w, KIND_TAG_PATTERN as wn, HostSessionEndPayload as wt, renderNoteLine as x, EMOJI as xn, Host as xt, renderAgentLine as y, AGENT_STATUSES as yn, shortId as yt, AddNoteInput as z, LogEventInput as zn, requireWorkspace as zt };
|
|
616
|
+
//# sourceMappingURL=carnet-MC9WeQ6h.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carnet-MC9WeQ6h.d.mts","names":["_$__merge_ts0.MergeResult","_$__agents_ts0.Agent","_$__questions_ts0.Question","_$__findings_ts0.Finding","_$__table_ts0.TableItem","_$__events_ts0.CarnetEvent","_$__notes_ts0.AddNoteResult","_$__notes_ts0.Note","_$__notes_ts0.NoteDetail","_$__notes_ts0.WeightedNote","_$__notes_ts0.NoteCitation","_$__notes_ts0.NoteActivity","_$__status_view_ts0.StatusView"],"sources":["../src/context.ts","../src/events.ts","../src/status/model.ts","../src/agents.ts","../src/workspace/workspace.ts","../src/workspace/locate.ts","../src/hosts/host.ts","../src/sessions.ts","../src/merge.ts","../src/questions.ts","../src/findings.ts","../src/table.ts","../src/notes.ts","../src/turn.ts","../src/status/view.ts","../src/memory.ts","../src/status/render.ts","../src/carnet.ts"],"mappings":";UAEiB;EACf,IAAI;EACJ,WAAW;EAEX;;cCFW;cAaA;KAOD,yBAAyB;KACzB,2BAA2B;KAC3B,YAAY,iBAAiB;UAIxB;EACf;EACA;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;;UAGe;EACf,MAAM;EACN;EACA;EACA;EACA;;iBAqBc,YAAY,iBAAiB,SAAS;cCnEzC;KAUD,sBAAsB;cAErB;KAED,2BAA2B;cAE1B,OAAO,OAAO,QAAQ;cAStB;cACA;cACA;cAEA;cAGA;WACX;WACA;WACA;WACA;;iBAIc,QAAQ,mBAAmB;cAI9B,kBAAgB;cAEhB;iBAEG,cAAc,iBAAiB,SAAS;iBAIxC,mBAAmB,iBAAiB,SAAS;cAIhD;cClDA;KAED,oBAAoB;cAGnB,oBAAoB;iBAWjB,YAAY,iBAAiB,SAAS;UAWrC;EACf;EACA;EACA,MAAM;EACN,cAAc;EAEd;EAEA;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA,OAAO;EACP;EACA;EACA;;UAGe;EACf,QAAQ;EAER;EACA;EAEA;;UAGe;EACf;EACA;;UAGe;EACf;;cA+CW;cACA;iBA4JG,eAAe,MAAM,WAAW,wBAAwB;UAiDvD;EACf;EACA;;UCxUe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA,OAAO;EACP,UAAU;IAAiB,WAAW;;;UAGvB;EACf;EACA;IAAU;IAAc;;EACxB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ACrB,cAAc,mBAAmB,UAAU,gBAAgB;EAC3D,cAAc,SAAS,SAAS,UAAU,gBAAgB;EAC1D,YAAY,QAAQ,SAAS,UAAU,gBAAgB;EACvD,kBAAkB;EAClB,gBAAgB,SAAS,SAAS,MAAM,OAAO;EAC/C,gBAAgB,SAAS,SAAS,MAAM,OAAO;EAE/C,UAAU,QAAQ,SAAS,iBAAiB,MAAM,OAAO;EACzD,mBAAmB,WAAW,YAAY;;cAG/B;iBAIG,YAAY;iBAIZ,SAAS,aAAa;KCjG1B;KACA;UAEK;EACf;EACA;EACA;EACA;EACA,MAAM;EACN,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAwBU,qBAAqB;UAEhB;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA,MAAM;EACN;EACA;EACA;EACA;;UAGe;EACf;EACA;;cA+QW;iBAEG,QAAQ;UC3VP;EACf,SAAS;EACT;EACA;EACA;EACA;;UCJe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;;cCtBW;KACD,0BAA0B;cAEzB;KACD,0BAA0B;UAErB;EACf,UAAU;EACV;EACA;EACA;;UAGe;EACf;EACA;EACA,UAAU;EACV;EACA;EACA;EACA,UAAU;EACV;;UAGe;EACf;EACA,UAAU;EACV;;UCzBe;EACf;EACA;EACA,QAAQ;EACR;;UAGe;EACf;EACA,SAAS;;cCVE;KACD,mBAAmB;cAElB;cACA;cACA;cACA;iBAIG,WAAW,gBAAgB,SAAS;iBAIpC,eAAe;UAKd;EACf;EACA,MAAM;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe,qBAAqB;EACpC;EACA;;UAGe,mBAAmB;EAClC,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf,MA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kBAAAA;IAC9B,QAAK;;WAGE;IACP,MAAG;IACH,QAAK;IACL,OAAI;IACJ,OAAI;IACJ,MAAG;;WAGI;IACP,MAAG,iBAAkB,OAAS,kBAAAC;IAC9B,OAAI,iBAAkB,gBAAgB,qBAAqB,OAAS,cAAAA;;WAI7D;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,SAAO,UAAY,sBAAAC;IAEnC,SAAM,SAAY,SAAO,UAAY,gBAAgB;IAErD,WAAQ,SAAY;;EAGtB;;UAKe,0BAA0B;EACzC;EACA;EACA;EACA,MAAM,OAAO;EACb;;iBASc,WAAW,UAAS,oBAAyB;UAI5C;EACf,QAAQ;EACR,YAAY;;iBAGE,mBAAmB,UAAS,oBAAyB;iBAWrD,oBACd,WAAW,kBACX,UAAS,oBACR"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as NoteKind, $t as dropWorkspace, A as renderMemory, An as USER_ACTION_STATUSES, At as ResumeCommand, B as AddNoteResult, Bn as SESSION_EVENT_TYPES, Bt as resolveWorkspace, C as renderNotesSummary, Cn as KIND_LEGEND, Ct as HostRender, D as MEMORY_MAX_CHARACTERS, Dn as MAIN_WAITING_EMOJI, Dt as HostSubagentPayload, E as renderTableLine, En as MAIN_FAILED_EMOJI, Et as HostStopPayload, F as formatClock, Fn as AgentEventType, Ft as WorkspaceResolution, G as ListNotesOptions, Gt as INSTRUCTIONS_FILE, H as DEFAULT_HALF_LIFE_DAYS, Hn as isEventType, Ht as AGENTS_FILE, I as TURNS, In as CarnetEvent, It as isInside, J as Note, Jt as WorkspaceFile, K as NOTE_KINDS, Kt as WORKSPACE_FILE, L as Turn, Ln as EVENT_TYPES, Lt as repoNameFor, M as StatusView, Mn as isAgentStatus, Mt as hostById, N as StatusViewOptions, Nn as isUserActionStatus, Nt as ResolveWorkspaceOptions, O as MemoryOptions, On as MAIN_WORKING_EMOJI, Ot as HostToolPayload, P as buildStatusView, Pn as kindTag, Pt as WorkspaceOrigin, Q as NoteDetail, Qt as definitionInstructions, R as TurnOptions, Rn as EventType, Rt as repoPathFor, S as renderNotes, Sn as KIND_ABBREVIATIONS, St as HostPromptPayload, T as renderStatus, Tn as LEGEND, Tt as HostSessionPayload, U as DUPLICATE_SIMILARITY, Ut as CreateWorkspaceOptions, V as CiteNoteInput, Vn as SessionEventType, Vt as workspaceLabel, W as DropNoteInput, Wt as DropWorkspaceOptions, X as NoteActivityKind, Xt as addWorkspaceRepo, Y as NoteActivity, Yt as WorkspaceRepo, Z as NoteCitation, Zt as createWorkspace, _ as RenderOptions, _n as isAgentKind, _t as SessionKind, a as openCarnet, an as workspaceExists, at as sessionNoteActivity, b as renderMainLine, bn as AgentStatus, bt as DEFAULT_HOST, c as BLOCKED_HEADER, cn as Agent, ct as SetTableInput, d as MAIN_IDLE, dn as FinishAgentInput, dt as CreateSessionInput, en as expandHome, et as STALE_AFTER_ACTIVE_DAYS, f as MAIN_WAITING_SUFFIX, fn as ListAgentsOptions, ft as HookEnv, g as NotesMode, gn as UpdateAgentInput, gt as Session, h as NOTES_HEADER, hn as StartAgentInput, ht as MINIMUM_ID_PREFIX, i as ResolvedCarnet, in as removeWorkspaceRepo, it as memoryHalfLife, j as StatusLine, jn as UserActionStatus, jt as allHosts, k as memoryMaxCharacters, kn as OPEN_AGENT_STATUSES, kt as LaunchOptions, l as MAIN_FAILED_SUFFIX, ln as AgentKind, lt as TableItem, m as NOTES_FOLD_LINES, mn as REPORTING_NOTE, mt as ListSessionsOptions, n as CarnetOptions, nn as listWorkspaces, nt as isNoteKind, o as openResolvedCarnet, on as workspaceHosts, ot as similarity, p as MAIN_WORKING_SUFFIX, pn as PUBLISH_FALLBACK_MILLISECONDS, pt as HookSessionPayload, q as NOTE_TEXT_LIMIT, qt as Workspace, r as OpenCarnetOptions, rn as loadWorkspace, rt as localDay, s as openWorkspaceCarnet, sn as AGENT_KINDS, st as workspaceRepoNames, t as Carnet, tn as isWorkspaceName, tt as WeightedNote, u as MAIN_HEADER, un as DEFAULT_AGENT_KIND, ut as MergeResult, v as SIMILAR_PREFIX, vn as statusWhenDone, vt as SessionStatus, w as renderSections, wn as KIND_TAG_PATTERN, wt as HostSessionEndPayload, x as renderNoteLine, xn as EMOJI, xt as Host, y as renderAgentLine, yn as AGENT_STATUSES, yt as shortId, z as AddNoteInput, zn as LogEventInput, zt as requireWorkspace } from "./carnet-MC9WeQ6h.mjs";
|
|
2
2
|
import { DatabaseSync } from "node:sqlite";
|
|
3
3
|
interface MoveOptions {
|
|
4
4
|
merge?: boolean | undefined;
|
|
@@ -14,16 +14,17 @@ interface MoveResult {
|
|
|
14
14
|
keptNotes: number;
|
|
15
15
|
}
|
|
16
16
|
export declare function moveSession(carnet: Carnet, sessionId: string, targetWorkspace: string, options?: MoveOptions): MoveResult;
|
|
17
|
-
export declare function sessionWorkspaceName(db: DatabaseSync, sessionId: string): string |
|
|
17
|
+
export declare function sessionWorkspaceName(db: DatabaseSync, sessionId: string): string | undefined;
|
|
18
18
|
export declare function archiveWorkspaceSessions(db: DatabaseSync, name: string, at: string): number;
|
|
19
19
|
export declare function deleteWorkspaceNotes(db: DatabaseSync, name: string): number;
|
|
20
20
|
export declare function workspaceSessionCounts(db: DatabaseSync): Map<string, number>;
|
|
21
|
+
export declare function workspaceLastActive(db: DatabaseSync): Map<string, string>;
|
|
21
22
|
export declare const MEMORY_DB = ":memory:";
|
|
22
23
|
export declare function openDatabase(path: string): DatabaseSync;
|
|
23
24
|
export declare const migrations: readonly string[];
|
|
24
25
|
export declare function schemaVersion(db: DatabaseSync): number;
|
|
25
26
|
export declare function migrate(db: DatabaseSync): void;
|
|
26
|
-
type CarnetErrorCode = 'NO_WORKSPACE' | '
|
|
27
|
+
type CarnetErrorCode = 'NO_WORKSPACE' | 'WORKSPACE_EXISTS' | 'WORKSPACE_NOT_FOUND' | 'WORKSPACE_NAME_INVALID' | 'REPO_NOT_FOUND' | 'REPO_NAME_TAKEN' | 'NOTE_NOT_FOUND' | 'INVALID_NOTE' | 'UNKNOWN_HOST' | 'NO_SESSION' | 'SESSION_NOT_FOUND' | 'SESSION_AMBIGUOUS' | 'SESSION_NAME_TAKEN' | 'SESSION_NAME_REQUIRED' | 'SESSION_RUNNING' | 'SESSION_KIND_INVALID' | 'SESSION_MERGE_INVALID' | 'SESSION_EXISTS' | 'SESSION_MOVE_INVALID' | 'SESSION_CWD_MISSING' | 'RUN_DIRECTORY_FILE_CONFLICT' | 'WORKSPACE_INSTRUCTIONS_CONFLICT' | 'AGENT_EXISTS' | 'AGENT_NOT_FOUND' | 'INVALID_TARGET' | 'INVALID_BLOCKER' | 'INVALID_KIND' | 'INVALID_QUESTIONS' | 'QUESTION_NOT_FOUND' | 'FINDING_NOT_FOUND' | 'REASON_REQUIRED' | 'SECTION_NOT_FOUND' | 'REPORT_MISSING' | 'INVALID_STATUS' | 'INVALID_EVENT_TYPE' | 'COMMIT_REQUIRED';
|
|
27
28
|
export declare class CarnetError extends Error {
|
|
28
29
|
readonly code: CarnetErrorCode;
|
|
29
30
|
constructor(code: CarnetErrorCode, message: string);
|
|
@@ -44,6 +45,7 @@ export declare function corePromptPath(env?: NodeJS.ProcessEnv): string;
|
|
|
44
45
|
export declare function reportsDirectory(workspace: Workspace): string;
|
|
45
46
|
export declare function reportPath(workspace: Workspace, agentName: string): string;
|
|
46
47
|
export declare function handleSessionEnd(carnet: Carnet, payload: HostSessionEndPayload): Session | undefined;
|
|
48
|
+
export declare function handleStop(carnet: Carnet, payload: HostStopPayload): void;
|
|
47
49
|
interface SessionStartResult {
|
|
48
50
|
session: Session;
|
|
49
51
|
additionalContext?: string;
|
|
@@ -75,10 +77,25 @@ export declare function compactReminder(workspace: Workspace | null, env?: NodeJ
|
|
|
75
77
|
export declare function outsideRucherContext(workspace: Workspace | null, env?: NodeJS.ProcessEnv): string;
|
|
76
78
|
export declare const OUTSIDE_RUCHER_NOTICE = "rucher: session started without rucher, the Rucher rules are not in its system prompt (use rucher new, tmp or resume)";
|
|
77
79
|
export declare const RULES_UPDATED_NOTICE = "rucher: rules updated, will apply after the next compaction or in a new session";
|
|
78
|
-
export declare const SUBAGENT_RULES = "Rucher rules for sub-agents: never commit, push or stash. When your task asks for a report, write it to the file it names. If your prompt names you as a Carnet agent, call agent_update at meaningful progress and agent_done as your last tool action, then reply with one line.";
|
|
79
|
-
export declare const CORE_RULES = "- Work can be parallel, review stays sequential: forks work at the same time, the human handles their results one at a time.\n- The human keeps the hand: only the human launches
|
|
80
|
-
export declare function handleUserPromptSubmit(carnet: Carnet, host: Host, payload: HostPromptPayload): Session;
|
|
81
|
-
export declare function handleToolUse(carnet: Carnet, payload: HostToolPayload, env: HookEnv): string | undefined;
|
|
80
|
+
export declare const SUBAGENT_RULES = "Rucher rules for sub-agents: never commit, push or stash. When your task asks for a report, write it to the file it names. If your prompt names you as a Carnet agent, follow the contract of its kind, call agent_update at meaningful progress and agent_done as your last tool action, then reply with one line.";
|
|
81
|
+
export declare const CORE_RULES = "- Work can be parallel, review stays sequential: forks work at the same time, the human handles their results one at a time.\n- The human keeps the hand: only the human launches agents, triggers their final action (inject, validate, apply, triage), applies, tests and commits. Agents propose, they never push.\n- Status lives in Carnet: agent statuses, the Main line and the journal go through the Carnet tools, never into status files nor chat updates. Update before and after each piece of work.\n- When an agent finishes, say only \"<name> finished, report ready\". Never summarise, quote or act on its report or final message until the human asks for that report or its final action, even when answering about something else.\n- Agents never commit, push, stash or record notes. An agent follows its kind's contract, writes its report to a file ending with a Learnings section, calls agent_done as its last tool action, then replies with one line that carries no results, such as \"<name> done, report written\". Only the main agent records notes, at the end of a step.\n- To launch agents or handle their results, load the rucher skill: it holds the full workflow.";
|
|
82
|
+
export declare function handleUserPromptSubmit(carnet: Carnet, host: Host, payload: HostPromptPayload, options?: TurnOptions): Session;
|
|
83
|
+
export declare function handleToolUse(carnet: Carnet, payload: HostToolPayload, env: HookEnv, options?: TurnOptions): string | undefined;
|
|
84
|
+
export declare const WAITING_TOOL = "AskUserQuestion";
|
|
85
|
+
export declare function handleToolStart(carnet: Carnet, payload: HostToolPayload): void;
|
|
86
|
+
export declare function guardSubagentCall(carnet: Carnet, payload: HostToolPayload, scratchRoot: string): string | undefined;
|
|
87
|
+
export declare const GUARDED_TOOLS: Set<string>;
|
|
88
|
+
interface GuardInput {
|
|
89
|
+
kind: AgentKind;
|
|
90
|
+
toolName: string;
|
|
91
|
+
filePath?: string | undefined;
|
|
92
|
+
command?: string | undefined;
|
|
93
|
+
cwd?: string | undefined;
|
|
94
|
+
worktree?: string | null | undefined;
|
|
95
|
+
scratchRoot: string;
|
|
96
|
+
}
|
|
97
|
+
export declare function guardToolCall(input: GuardInput): string | undefined;
|
|
98
|
+
export declare function kindOfAgentType(agentType: string | undefined): AgentKind | undefined;
|
|
82
99
|
export declare function transcriptTitle(path: string): string | undefined;
|
|
83
100
|
export declare function workspaceSettings(workspace: Workspace): Record<string, unknown>;
|
|
84
101
|
export declare const claudeCode: Host;
|
|
@@ -97,6 +114,14 @@ export declare const PAIRING_WINDOW_MILLISECONDS = 60000;
|
|
|
97
114
|
export declare const STOPPED_NOTE = "stopped without agent_done";
|
|
98
115
|
export declare const NOTE_MAX = 60;
|
|
99
116
|
export declare function sanitizeNote(text: string): string;
|
|
117
|
+
export declare const STATUS_LINE_LABEL = "rucher";
|
|
118
|
+
export declare function renderStatusLine(view: StatusView, lag?: string | null): string;
|
|
119
|
+
export declare function statusLinePath(sessionId: string, env?: NodeJS.ProcessEnv): string;
|
|
120
|
+
interface StatusLineOptions {
|
|
121
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
122
|
+
lag?: string | null | undefined;
|
|
123
|
+
}
|
|
124
|
+
export declare function writeStatusLine(carnet: Carnet, sessionId: string, options?: StatusLineOptions): void;
|
|
100
125
|
type OpenAgentStatus = (typeof OPEN_AGENT_STATUSES)[number];
|
|
101
126
|
export declare const AGENT_STEPS: readonly ['answered', 'applying', 'applied', 'tested', 'committed', 'dropped'];
|
|
102
127
|
type AgentStep = (typeof AGENT_STEPS)[number];
|
|
@@ -124,5 +149,5 @@ export declare function markdownCopy(content: string): string;
|
|
|
124
149
|
export declare function removeStaleCopies(directory: string, keep: ReadonlySet<string>): string[];
|
|
125
150
|
export declare function writeGenerated(path: string, content: string): boolean;
|
|
126
151
|
export declare function mergeSettings(base: Record<string, unknown>, extra: Record<string, unknown>): Record<string, unknown>;
|
|
127
|
-
export { AGENTS_FILE, AGENT_STATUSES, type AddNoteInput, type AddNoteResult, type Agent, type AgentEventType, type AgentStatus, type AgentStep, type AppendPromptFile, type AssembledPrompt, Carnet, type CarnetErrorCode, type CarnetEvent, type CarnetOptions, type CiteNoteInput, type CreateSessionInput, type CreateWorkspaceOptions, DEFAULT_HALF_LIFE_DAYS, DEFAULT_HOST, DUPLICATE_SIMILARITY, type DropNoteInput, type DropWorkspaceOptions, EMOJI, EVENT_TYPES, type EventType, type FinishAgentInput, type HookEnv, type HookSessionPayload, type Host, type HostPromptPayload, type HostRender, type HostSessionEndPayload, type HostSessionPayload, type HostSubagentPayload, type HostToolPayload, INSTRUCTIONS_FILE, LEGEND, type LaunchOptions, type ListAgentsOptions, type ListNotesOptions, type ListSessionsOptions, type LogEventInput, MAIN_WORKING_EMOJI, MAIN_WORKING_SUFFIX, MEMORY_MAX_CHARACTERS, MINIMUM_ID_PREFIX, type MemoryOptions, type MergeResult, type MoveOptions, type MoveResult, NOTES_FOLD_LINES, NOTES_HEADER, NOTE_KINDS, NOTE_TEXT_LIMIT, type Note, type NoteActivity, type NoteActivityKind, type NoteCitation, type NoteDetail, type NoteKind, type NotesMode, type OpenCarnetOptions, PUBLISH_FALLBACK_MILLISECONDS, type PromptSession, REPORTING_NOTE, type RenderOptions, type RenderResult, type ResolveWorkspaceOptions, type ResolvedCarnet, type ResumeCommand, type ResumeContextOptions, type RucherPaths, type RunDirectoryRenderOptions, SESSION_EVENT_TYPES, SIMILAR_PREFIX, STALE_AFTER_ACTIVE_DAYS, type Session, type SessionEventType, type SessionKind, type SessionStartResult, type SessionStatus, type SetTableInput, type StartAgentInput, type StatusLine, type StatusView, type StepAgentInput, type TableItem, USER_ACTION_STATUSES, type UpdateAgentInput, type UserActionStatus, WORKSPACE_FILE, type WeightedNote, type Workspace, type WorkspaceFile, type WorkspaceOrigin, type WorkspaceRepo, type WorkspaceResolution, addWorkspaceRepo, allHosts,
|
|
152
|
+
export { AGENTS_FILE, AGENT_KINDS, AGENT_STATUSES, type AddNoteInput, type AddNoteResult, type Agent, type AgentEventType, type AgentKind, type AgentStatus, type AgentStep, type AppendPromptFile, type AssembledPrompt, BLOCKED_HEADER, Carnet, type CarnetErrorCode, type CarnetEvent, type CarnetOptions, type CiteNoteInput, type CreateSessionInput, type CreateWorkspaceOptions, DEFAULT_AGENT_KIND, DEFAULT_HALF_LIFE_DAYS, DEFAULT_HOST, DUPLICATE_SIMILARITY, type DropNoteInput, type DropWorkspaceOptions, EMOJI, EVENT_TYPES, type EventType, type FinishAgentInput, type HookEnv, type HookSessionPayload, type Host, type HostPromptPayload, type HostRender, type HostSessionEndPayload, type HostSessionPayload, type HostSubagentPayload, type HostToolPayload, INSTRUCTIONS_FILE, KIND_ABBREVIATIONS, KIND_LEGEND, KIND_TAG_PATTERN, LEGEND, type LaunchOptions, type ListAgentsOptions, type ListNotesOptions, type ListSessionsOptions, type LogEventInput, MAIN_FAILED_EMOJI, MAIN_FAILED_SUFFIX, MAIN_HEADER, MAIN_IDLE, MAIN_WAITING_EMOJI, MAIN_WAITING_SUFFIX, MAIN_WORKING_EMOJI, MAIN_WORKING_SUFFIX, MEMORY_MAX_CHARACTERS, MINIMUM_ID_PREFIX, type MemoryOptions, type MergeResult, type MoveOptions, type MoveResult, NOTES_FOLD_LINES, NOTES_HEADER, NOTE_KINDS, NOTE_TEXT_LIMIT, type Note, type NoteActivity, type NoteActivityKind, type NoteCitation, type NoteDetail, type NoteKind, type NotesMode, type OpenCarnetOptions, PUBLISH_FALLBACK_MILLISECONDS, type PromptSession, REPORTING_NOTE, type RenderOptions, type RenderResult, type ResolveWorkspaceOptions, type ResolvedCarnet, type ResumeCommand, type ResumeContextOptions, type RucherPaths, type RunDirectoryRenderOptions, SESSION_EVENT_TYPES, SIMILAR_PREFIX, STALE_AFTER_ACTIVE_DAYS, type Session, type SessionEventType, type SessionKind, type SessionStartResult, type SessionStatus, type SetTableInput, type StartAgentInput, type StatusLine, type StatusLineOptions, type StatusView, type StatusViewOptions, type StepAgentInput, TURNS, type TableItem, type Turn, type TurnOptions, USER_ACTION_STATUSES, type UpdateAgentInput, type UserActionStatus, WORKSPACE_FILE, type WeightedNote, type Workspace, type WorkspaceFile, type WorkspaceOrigin, type WorkspaceRepo, type WorkspaceResolution, addWorkspaceRepo, allHosts, buildStatusView, createWorkspace, definitionInstructions, dropWorkspace, expandHome, formatClock, hostById, isAgentKind, isAgentStatus, isEventType, isInside, isNoteKind, isUserActionStatus, isWorkspaceName, kindTag, listWorkspaces, loadWorkspace, localDay, memoryHalfLife, memoryMaxCharacters, openCarnet, openResolvedCarnet, openWorkspaceCarnet, removeWorkspaceRepo, renderAgentLine, renderMainLine, renderMemory, renderNoteLine, renderNotes, renderNotesSummary, renderSections, renderStatus, renderTableLine, repoNameFor, repoPathFor, requireWorkspace, resolveWorkspace, sessionNoteActivity, shortId, similarity, statusWhenDone, workspaceExists, workspaceHosts, workspaceLabel, workspaceRepoNames };
|
|
128
153
|
//# 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/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;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/move.ts","../src/workspace-rows.ts","../src/db/open.ts","../src/db/schema.ts","../src/errors.ts","../src/paths.ts","../src/hook/session-end.ts","../src/hook/session-start.ts","../src/prompt/prompt.ts","../src/prompt/core-rules.ts","../src/hook/user-prompt-submit.ts","../src/hook/post-tool-use.ts","../src/guard.ts","../src/hosts/claude-code.ts","../src/purge.ts","../src/resume.ts","../src/subagents.ts","../src/status/note.ts","../src/status/line.ts","../src/steps.ts","../src/render.ts","../src/run-directory-files.ts"],"mappings":";;UAIiB;EACf;EACA;;UAGe;EACf,SAAS;EACT,MAAM;EACN;EACA;EACA;EACA;EACA;;wBAwBc,YACd,QAAQ,QACR,mBACA,yBACA,UAAS,cACR;wBC/Ba,qBAAqB,IAAI,cAAc;wBAOvC,yBAAyB,IAAI,cAAc,cAAc;wBAiBzD,qBAAqB,IAAI,cAAc;wBAIvC,uBAAuB,IAAI,eAAe;wBAU1C,oBAAoB,IAAI,eAAe;qBCjD1C;wBAEG,aAAa,eAAe;qBCQ/B;wBAwYG,cAAc,IAAI;wBASlB,QAAQ,IAAI;KC9ZhB;qBAsCC,oBAAoB;WAEpB,MAAM;EADjB,YACW,MA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