crewly 1.20.359 → 1.20.361

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.
Files changed (99) hide show
  1. package/config/roles/developer/prompt.md +3 -1
  2. package/config/skills/registry.json +125 -1
  3. package/dist/backend/backend/src/constants.d.ts +132 -2
  4. package/dist/backend/backend/src/constants.d.ts.map +1 -1
  5. package/dist/backend/backend/src/constants.js +143 -3
  6. package/dist/backend/backend/src/constants.js.map +1 -1
  7. package/dist/backend/backend/src/index.d.ts +37 -0
  8. package/dist/backend/backend/src/index.d.ts.map +1 -1
  9. package/dist/backend/backend/src/index.js +106 -10
  10. package/dist/backend/backend/src/index.js.map +1 -1
  11. package/dist/backend/backend/src/services/agent/boot-pressure.d.ts +163 -0
  12. package/dist/backend/backend/src/services/agent/boot-pressure.d.ts.map +1 -0
  13. package/dist/backend/backend/src/services/agent/boot-pressure.js +235 -0
  14. package/dist/backend/backend/src/services/agent/boot-pressure.js.map +1 -0
  15. package/dist/backend/backend/src/services/agent/restore-queue.d.ts +50 -1
  16. package/dist/backend/backend/src/services/agent/restore-queue.d.ts.map +1 -1
  17. package/dist/backend/backend/src/services/agent/restore-queue.js +100 -5
  18. package/dist/backend/backend/src/services/agent/restore-queue.js.map +1 -1
  19. package/dist/backend/backend/src/services/memory/agent-memory-refresh.service.d.ts +11 -0
  20. package/dist/backend/backend/src/services/memory/agent-memory-refresh.service.d.ts.map +1 -1
  21. package/dist/backend/backend/src/services/memory/agent-memory-refresh.service.js +23 -2
  22. package/dist/backend/backend/src/services/memory/agent-memory-refresh.service.js.map +1 -1
  23. package/dist/backend/backend/src/services/messaging/deferred-start-retry.d.ts +8 -0
  24. package/dist/backend/backend/src/services/messaging/deferred-start-retry.d.ts.map +1 -1
  25. package/dist/backend/backend/src/services/messaging/deferred-start-retry.js +8 -0
  26. package/dist/backend/backend/src/services/messaging/deferred-start-retry.js.map +1 -1
  27. package/dist/backend/backend/src/services/wiki/wiki-log-entries.d.ts +7 -0
  28. package/dist/backend/backend/src/services/wiki/wiki-log-entries.d.ts.map +1 -1
  29. package/dist/backend/backend/src/services/wiki/wiki-log-entries.js +10 -0
  30. package/dist/backend/backend/src/services/wiki/wiki-log-entries.js.map +1 -1
  31. package/dist/backend/backend/src/services/wiki/wiki-log-rotation.service.d.ts +24 -0
  32. package/dist/backend/backend/src/services/wiki/wiki-log-rotation.service.d.ts.map +1 -1
  33. package/dist/backend/backend/src/services/wiki/wiki-log-rotation.service.js +75 -9
  34. package/dist/backend/backend/src/services/wiki/wiki-log-rotation.service.js.map +1 -1
  35. package/dist/backend/backend/src/services/wiki/wiki-maintenance.service.d.ts +19 -0
  36. package/dist/backend/backend/src/services/wiki/wiki-maintenance.service.d.ts.map +1 -1
  37. package/dist/backend/backend/src/services/wiki/wiki-maintenance.service.js +23 -2
  38. package/dist/backend/backend/src/services/wiki/wiki-maintenance.service.js.map +1 -1
  39. package/dist/backend/backend/src/services/wiki/work-record.service.d.ts +23 -1
  40. package/dist/backend/backend/src/services/wiki/work-record.service.d.ts.map +1 -1
  41. package/dist/backend/backend/src/services/wiki/work-record.service.js +33 -5
  42. package/dist/backend/backend/src/services/wiki/work-record.service.js.map +1 -1
  43. package/dist/backend/backend/src/services/worktree/low-disk-guard.d.ts +92 -8
  44. package/dist/backend/backend/src/services/worktree/low-disk-guard.d.ts.map +1 -1
  45. package/dist/backend/backend/src/services/worktree/low-disk-guard.js +98 -14
  46. package/dist/backend/backend/src/services/worktree/low-disk-guard.js.map +1 -1
  47. package/dist/backend/backend/src/services/worktree/tmp-janitor.d.ts +138 -0
  48. package/dist/backend/backend/src/services/worktree/tmp-janitor.d.ts.map +1 -0
  49. package/dist/backend/backend/src/services/worktree/tmp-janitor.js +199 -0
  50. package/dist/backend/backend/src/services/worktree/tmp-janitor.js.map +1 -0
  51. package/dist/backend/backend/src/services/worktree/transcript-janitor.d.ts +154 -0
  52. package/dist/backend/backend/src/services/worktree/transcript-janitor.d.ts.map +1 -0
  53. package/dist/backend/backend/src/services/worktree/transcript-janitor.js +357 -0
  54. package/dist/backend/backend/src/services/worktree/transcript-janitor.js.map +1 -0
  55. package/dist/backend/backend/src/services/worktree/workitem-worktree.service.d.ts.map +1 -1
  56. package/dist/backend/backend/src/services/worktree/workitem-worktree.service.js +7 -2
  57. package/dist/backend/backend/src/services/worktree/workitem-worktree.service.js.map +1 -1
  58. package/dist/backend/backend/src/services/worktree/worktree-dirty.d.ts +16 -4
  59. package/dist/backend/backend/src/services/worktree/worktree-dirty.d.ts.map +1 -1
  60. package/dist/backend/backend/src/services/worktree/worktree-dirty.js +21 -5
  61. package/dist/backend/backend/src/services/worktree/worktree-dirty.js.map +1 -1
  62. package/dist/backend/backend/src/services/worktree/worktree-git.d.ts +18 -0
  63. package/dist/backend/backend/src/services/worktree/worktree-git.d.ts.map +1 -1
  64. package/dist/backend/backend/src/services/worktree/worktree-git.js +60 -0
  65. package/dist/backend/backend/src/services/worktree/worktree-git.js.map +1 -1
  66. package/dist/backend/backend/src/services/worktree/worktree-janitor.service.d.ts +164 -25
  67. package/dist/backend/backend/src/services/worktree/worktree-janitor.service.d.ts.map +1 -1
  68. package/dist/backend/backend/src/services/worktree/worktree-janitor.service.js +494 -55
  69. package/dist/backend/backend/src/services/worktree/worktree-janitor.service.js.map +1 -1
  70. package/dist/backend/backend/src/services/worktree/worktree-tiers.d.ts +186 -0
  71. package/dist/backend/backend/src/services/worktree/worktree-tiers.d.ts.map +1 -0
  72. package/dist/backend/backend/src/services/worktree/worktree-tiers.js +279 -0
  73. package/dist/backend/backend/src/services/worktree/worktree-tiers.js.map +1 -0
  74. package/dist/backend/build-info.json +2 -2
  75. package/dist/cli/backend/src/constants.d.ts +132 -2
  76. package/dist/cli/backend/src/constants.d.ts.map +1 -1
  77. package/dist/cli/backend/src/constants.js +143 -3
  78. package/dist/cli/backend/src/constants.js.map +1 -1
  79. package/dist/cli/backend/src/services/agent/boot-pressure.d.ts +163 -0
  80. package/dist/cli/backend/src/services/agent/boot-pressure.d.ts.map +1 -0
  81. package/dist/cli/backend/src/services/agent/boot-pressure.js +235 -0
  82. package/dist/cli/backend/src/services/agent/boot-pressure.js.map +1 -0
  83. package/dist/cli/backend/src/services/agent/restore-queue.d.ts +50 -1
  84. package/dist/cli/backend/src/services/agent/restore-queue.d.ts.map +1 -1
  85. package/dist/cli/backend/src/services/agent/restore-queue.js +100 -5
  86. package/dist/cli/backend/src/services/agent/restore-queue.js.map +1 -1
  87. package/dist/cli/backend/src/services/wiki/wiki-log-entries.d.ts +7 -0
  88. package/dist/cli/backend/src/services/wiki/wiki-log-entries.d.ts.map +1 -1
  89. package/dist/cli/backend/src/services/wiki/wiki-log-entries.js +10 -0
  90. package/dist/cli/backend/src/services/wiki/wiki-log-entries.js.map +1 -1
  91. package/dist/cli/backend/src/services/worktree/low-disk-guard.d.ts +92 -8
  92. package/dist/cli/backend/src/services/worktree/low-disk-guard.d.ts.map +1 -1
  93. package/dist/cli/backend/src/services/worktree/low-disk-guard.js +98 -14
  94. package/dist/cli/backend/src/services/worktree/low-disk-guard.js.map +1 -1
  95. package/dist/cli/backend/src/services/worktree/worktree-git.d.ts +18 -0
  96. package/dist/cli/backend/src/services/worktree/worktree-git.d.ts.map +1 -1
  97. package/dist/cli/backend/src/services/worktree/worktree-git.js +60 -0
  98. package/dist/cli/backend/src/services/worktree/worktree-git.js.map +1 -1
  99. package/package.json +1 -1
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Transcript janitor — prunes Claude Code conversation transcripts of
3
+ * sessions Crewly launched (crewly#1354).
4
+ *
5
+ * Claude Code keeps every conversation under `<claude home>/projects/<cwd
6
+ * slug>/<id>.jsonl`, plus a sibling `<id>/` dir of tool results, and cleans
7
+ * them up after 30 days at most. Agents write far more than a person: one
8
+ * Mac held 10 GB, half older than a week. Agents on the default account share
9
+ * `~/.claude` with the owner's own sessions, so a blanket shorter retention
10
+ * would hit the owner too. This sweep therefore prunes only conversations it
11
+ * can prove Crewly launched:
12
+ *
13
+ * - the conversation id is one Crewly recorded (`session-state.json`,
14
+ * `last-conversations.json`, a handover file), or
15
+ * - the transcript's head carries Claude Code's `agentSetting` entry naming
16
+ * a known Crewly session (Crewly launches `claude --agent <session>`).
17
+ *
18
+ * Everything else is `foreign` and never touched. A transcript (and its
19
+ * sibling dir) goes when it is Crewly-launched, untouched for 14 days, and
20
+ * not the current conversation of a live or persisted session (`keepIds`).
21
+ * The first real pass only logs; deletion starts the next day (the service's
22
+ * arming rule).
23
+ *
24
+ * @module services/worktree/transcript-janitor
25
+ */
26
+ /** What identifies Crewly's conversations. */
27
+ export interface TranscriptSources {
28
+ /** Session names Crewly has launched (teams, persisted sessions, handover files, the orchestrator) */
29
+ knownSessionNames: ReadonlySet<string>;
30
+ /** Conversation ids Crewly recorded anywhere */
31
+ recordedIds: ReadonlySet<string>;
32
+ /** Conversation ids of live / persisted / remembered sessions — never pruned */
33
+ keepIds: ReadonlySet<string>;
34
+ }
35
+ /** Why a transcript was pruned or kept. */
36
+ export type TranscriptReason = 'old' | 'live-session' | 'recent' | 'foreign' | 'remove-failed';
37
+ /** Verdict for one transcript. */
38
+ export interface TranscriptVerdict {
39
+ /** Transcript file */
40
+ path: string;
41
+ /** Conversation id */
42
+ id: string;
43
+ /** Bytes of the transcript plus its sibling dir */
44
+ bytes: number;
45
+ /** What the sweep decided */
46
+ decision: 'prune' | 'keep';
47
+ /** The deciding rule */
48
+ reason: TranscriptReason;
49
+ /** `agentSetting` found in the head, when read */
50
+ agentSetting?: string | null;
51
+ /** True when deleted */
52
+ removed: boolean;
53
+ /** Error text when deletion failed */
54
+ error?: string;
55
+ }
56
+ /** Result of one transcript sweep. */
57
+ export interface TranscriptSweepSummary {
58
+ /** Claude homes scanned */
59
+ homes: string[];
60
+ /** Transcripts seen */
61
+ scanned: number;
62
+ /** Transcripts identified as Crewly-launched (any age) */
63
+ crewlyLaunched: number;
64
+ /** Deleted */
65
+ pruned: number;
66
+ /** Dry run: would be deleted */
67
+ wouldPrune: number;
68
+ /** Bytes freed */
69
+ freedBytes: number;
70
+ /** Dry run: bytes that would be freed */
71
+ wouldFreeBytes: number;
72
+ /** Kept, by reason (`recent` and `foreign` are counted here but not listed) */
73
+ keptReasons: Record<string, number>;
74
+ /** Verdicts for pruned / would-prune / live-session / failed transcripts */
75
+ transcripts: TranscriptVerdict[];
76
+ }
77
+ /** Input of {@link sweepTranscripts}. */
78
+ export interface TranscriptSweepInput {
79
+ /** Claude homes (`~/.claude`, each account's config dir) */
80
+ claudeHomes: readonly string[];
81
+ /** What identifies Crewly's conversations */
82
+ sources: TranscriptSources;
83
+ /** Current time (ms) */
84
+ now: number;
85
+ /** Max age before pruning (default TRANSCRIPT_MAX_AGE_MS) */
86
+ maxAgeMs?: number;
87
+ /** When true, nothing is deleted */
88
+ dryRun: boolean;
89
+ /** Size probe for sibling dirs (default: shallow stat walk) */
90
+ sizeOf?: (p: string) => Promise<number | null>;
91
+ /** Bytes read from a transcript head (default TRANSCRIPT_HEAD_BYTES) */
92
+ headBytes?: number;
93
+ }
94
+ /**
95
+ * The `agentSetting` Claude Code wrote at the top of a transcript, if any.
96
+ * Only the first `headBytes` are read.
97
+ *
98
+ * @param file - Transcript
99
+ * @param headBytes - Bytes to read (default TRANSCRIPT_HEAD_BYTES)
100
+ * @returns The agent name, or null when absent / unreadable
101
+ */
102
+ export declare function readAgentSetting(file: string, headBytes?: number): string | null;
103
+ /**
104
+ * Session name a handover file belongs to, from its name.
105
+ *
106
+ * @param fileName - `crewly-orc-restart-2026-10-10T22-44-14-888Z.md`
107
+ * @returns `crewly-orc`, or null when the name has another shape
108
+ */
109
+ export declare function sessionNameFromHandoverFile(fileName: string): string | null;
110
+ /**
111
+ * Every UUID in a text (lower-cased, de-duplicated).
112
+ *
113
+ * @param text - Any text
114
+ * @returns Ids
115
+ */
116
+ export declare function collectUuids(text: string): string[];
117
+ /**
118
+ * Claude homes to sweep: `~/.claude` and every account config dir under
119
+ * `<CREWLY_HOME>/claude-accounts/` that has a `projects/` folder.
120
+ *
121
+ * @param crewlyHome - CREWLY_HOME
122
+ * @param defaultHome - The default Claude home (default `~/.claude`)
123
+ * @returns Existing homes, de-duplicated
124
+ */
125
+ export declare function defaultClaudeHomes(crewlyHome: string, defaultHome?: string): string[];
126
+ /** Mutable builder for {@link TranscriptSources}. */
127
+ export interface TranscriptSourceSets {
128
+ knownSessionNames: Set<string>;
129
+ recordedIds: Set<string>;
130
+ keepIds: Set<string>;
131
+ }
132
+ /**
133
+ * Read Crewly's own records under CREWLY_HOME: `session-state.json`
134
+ * (persisted sessions: names + current ids, kept), `last-conversations.json`
135
+ * (stopped sessions: names + ids, kept) and the handover dir (names from file
136
+ * names; ids from the bodies of files newer than 30 days, recorded). Pure
137
+ * file reads — the live session backend and the teams store are added by the
138
+ * service.
139
+ *
140
+ * @param crewlyHome - CREWLY_HOME
141
+ * @param now - Current time (ms)
142
+ * @param into - Sets to add to (default: new ones)
143
+ * @returns The sets
144
+ */
145
+ export declare function readCrewlyRecords(crewlyHome: string, now: number, into?: TranscriptSourceSets): Promise<TranscriptSourceSets>;
146
+ /**
147
+ * One transcript sweep over the given Claude homes. Never throws; a home or
148
+ * project dir that cannot be read is skipped.
149
+ *
150
+ * @param input - Homes, sources, clock, dry-run flag
151
+ * @returns What was pruned and kept
152
+ */
153
+ export declare function sweepTranscripts(input: TranscriptSweepInput): Promise<TranscriptSweepSummary>;
154
+ //# sourceMappingURL=transcript-janitor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcript-janitor.d.ts","sourceRoot":"","sources":["../../../../../../backend/src/services/worktree/transcript-janitor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAcH,8CAA8C;AAC9C,MAAM,WAAW,iBAAiB;IACjC,sGAAsG;IACtG,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,gDAAgD;IAChD,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,gFAAg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/**
2
+ * Transcript janitor — prunes Claude Code conversation transcripts of
3
+ * sessions Crewly launched (crewly#1354).
4
+ *
5
+ * Claude Code keeps every conversation under `<claude home>/projects/<cwd
6
+ * slug>/<id>.jsonl`, plus a sibling `<id>/` dir of tool results, and cleans
7
+ * them up after 30 days at most. Agents write far more than a person: one
8
+ * Mac held 10 GB, half older than a week. Agents on the default account share
9
+ * `~/.claude` with the owner's own sessions, so a blanket shorter retention
10
+ * would hit the owner too. This sweep therefore prunes only conversations it
11
+ * can prove Crewly launched:
12
+ *
13
+ * - the conversation id is one Crewly recorded (`session-state.json`,
14
+ * `last-conversations.json`, a handover file), or
15
+ * - the transcript's head carries Claude Code's `agentSetting` entry naming
16
+ * a known Crewly session (Crewly launches `claude --agent <session>`).
17
+ *
18
+ * Everything else is `foreign` and never touched. A transcript (and its
19
+ * sibling dir) goes when it is Crewly-launched, untouched for 14 days, and
20
+ * not the current conversation of a live or persisted session (`keepIds`).
21
+ * The first real pass only logs; deletion starts the next day (the service's
22
+ * arming rule).
23
+ *
24
+ * @module services/worktree/transcript-janitor
25
+ */
26
+ import * as fs from 'fs';
27
+ import * as os from 'os';
28
+ import * as path from 'path';
29
+ import { HARNESS_CONSTANTS, ORC_CONVERSATION_CONSTANTS, ORCHESTRATOR_SESSION_NAME, WORKTREE_JANITOR_CONSTANTS } from '../../constants.js';
30
+ import { EventLoopYielder, latestTreeMtimeMs } from './worktree-janitor.git.js';
31
+ /** UUID as Claude Code names conversations. */
32
+ const UUID_RE = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
33
+ /** Handover file name: `<session>[-<kind>]-<ISO stamp>.md`; group 1 is everything before the stamp. */
34
+ const HANDOVER_NAME_RE = /^(.+)-\d{4}-\d{2}-\d{2}T[\d-]+Z\.md$/;
35
+ /**
36
+ * The `agentSetting` Claude Code wrote at the top of a transcript, if any.
37
+ * Only the first `headBytes` are read.
38
+ *
39
+ * @param file - Transcript
40
+ * @param headBytes - Bytes to read (default TRANSCRIPT_HEAD_BYTES)
41
+ * @returns The agent name, or null when absent / unreadable
42
+ */
43
+ export function readAgentSetting(file, headBytes = WORKTREE_JANITOR_CONSTANTS.TRANSCRIPT_HEAD_BYTES) {
44
+ try {
45
+ const fd = fs.openSync(file, 'r');
46
+ try {
47
+ const buf = Buffer.alloc(headBytes);
48
+ const n = fs.readSync(fd, buf, 0, buf.length, 0);
49
+ for (const line of buf.subarray(0, n).toString('utf8').split('\n')) {
50
+ if (!line.includes('"agentSetting"'))
51
+ continue;
52
+ try {
53
+ const entry = JSON.parse(line);
54
+ return typeof entry.agentSetting === 'string' ? entry.agentSetting : null;
55
+ }
56
+ catch {
57
+ // a cut line — keep looking
58
+ }
59
+ }
60
+ return null;
61
+ }
62
+ finally {
63
+ fs.closeSync(fd);
64
+ }
65
+ }
66
+ catch {
67
+ return null;
68
+ }
69
+ }
70
+ /**
71
+ * Session name a handover file belongs to, from its name.
72
+ *
73
+ * @param fileName - `crewly-orc-restart-2026-10-10T22-44-14-888Z.md`
74
+ * @returns `crewly-orc`, or null when the name has another shape
75
+ */
76
+ export function sessionNameFromHandoverFile(fileName) {
77
+ const m = HANDOVER_NAME_RE.exec(fileName);
78
+ if (!m)
79
+ return null;
80
+ let name = m[1];
81
+ // Session names can contain any dash-separated words, so only known kinds are stripped.
82
+ for (const kind of WORKTREE_JANITOR_CONSTANTS.HANDOVER_KINDS) {
83
+ if (name.endsWith(`-${kind}`)) {
84
+ name = name.slice(0, -(kind.length + 1));
85
+ break;
86
+ }
87
+ }
88
+ return name || null;
89
+ }
90
+ /**
91
+ * Every UUID in a text (lower-cased, de-duplicated).
92
+ *
93
+ * @param text - Any text
94
+ * @returns Ids
95
+ */
96
+ export function collectUuids(text) {
97
+ return [...new Set((text.match(UUID_RE) ?? []).map((u) => u.toLowerCase()))];
98
+ }
99
+ /**
100
+ * Claude homes to sweep: `~/.claude` and every account config dir under
101
+ * `<CREWLY_HOME>/claude-accounts/` that has a `projects/` folder.
102
+ *
103
+ * @param crewlyHome - CREWLY_HOME
104
+ * @param defaultHome - The default Claude home (default `~/.claude`)
105
+ * @returns Existing homes, de-duplicated
106
+ */
107
+ export function defaultClaudeHomes(crewlyHome, defaultHome = path.join(os.homedir(), '.claude')) {
108
+ const out = new Set();
109
+ if (fs.existsSync(path.join(defaultHome, WORKTREE_JANITOR_CONSTANTS.TRANSCRIPT_PROJECTS_DIR)))
110
+ out.add(defaultHome);
111
+ const accounts = path.join(crewlyHome, HARNESS_CONSTANTS.CLAUDE.ACCOUNTS.DIR);
112
+ let names = [];
113
+ try {
114
+ names = fs.readdirSync(accounts);
115
+ }
116
+ catch {
117
+ return [...out];
118
+ }
119
+ for (const n of names) {
120
+ const home = path.join(accounts, n);
121
+ try {
122
+ if (fs.lstatSync(home).isDirectory() && fs.existsSync(path.join(home, WORKTREE_JANITOR_CONSTANTS.TRANSCRIPT_PROJECTS_DIR)))
123
+ out.add(home);
124
+ }
125
+ catch {
126
+ // skip
127
+ }
128
+ }
129
+ return [...out];
130
+ }
131
+ /**
132
+ * Read Crewly's own records under CREWLY_HOME: `session-state.json`
133
+ * (persisted sessions: names + current ids, kept), `last-conversations.json`
134
+ * (stopped sessions: names + ids, kept) and the handover dir (names from file
135
+ * names; ids from the bodies of files newer than 30 days, recorded). Pure
136
+ * file reads — the live session backend and the teams store are added by the
137
+ * service.
138
+ *
139
+ * @param crewlyHome - CREWLY_HOME
140
+ * @param now - Current time (ms)
141
+ * @param into - Sets to add to (default: new ones)
142
+ * @returns The sets
143
+ */
144
+ export async function readCrewlyRecords(crewlyHome, now, into = { knownSessionNames: new Set(), recordedIds: new Set(), keepIds: new Set() }) {
145
+ into.knownSessionNames.add(ORCHESTRATOR_SESSION_NAME);
146
+ // session-state.json: { sessions: [{ name, claudeSessionId, ... }] }
147
+ try {
148
+ const raw = JSON.parse(await fs.promises.readFile(path.join(crewlyHome, 'session-state.json'), 'utf-8'));
149
+ const sessions = Array.isArray(raw.sessions) ? raw.sessions : [];
150
+ for (const s of sessions) {
151
+ if (typeof s?.name === 'string')
152
+ into.knownSessionNames.add(s.name);
153
+ if (typeof s?.claudeSessionId === 'string') {
154
+ into.keepIds.add(s.claudeSessionId.toLowerCase());
155
+ into.recordedIds.add(s.claudeSessionId.toLowerCase());
156
+ }
157
+ }
158
+ }
159
+ catch {
160
+ // absent or unreadable
161
+ }
162
+ // last-conversations.json: { <session>: { sessionId, cwd, at } }
163
+ try {
164
+ const raw = JSON.parse(await fs.promises.readFile(path.join(crewlyHome, ORC_CONVERSATION_CONSTANTS.LAST_CONVERSATIONS_FILE), 'utf-8'));
165
+ for (const [name, e] of Object.entries(raw)) {
166
+ into.knownSessionNames.add(name);
167
+ if (typeof e?.sessionId === 'string') {
168
+ into.keepIds.add(e.sessionId.toLowerCase());
169
+ into.recordedIds.add(e.sessionId.toLowerCase());
170
+ }
171
+ }
172
+ }
173
+ catch {
174
+ // absent
175
+ }
176
+ // handover/*.md: names from file names, ids from recent bodies
177
+ const handoverDir = path.join(crewlyHome, ORC_CONVERSATION_CONSTANTS.HANDOVER_DIR);
178
+ let files = [];
179
+ try {
180
+ files = await fs.promises.readdir(handoverDir);
181
+ }
182
+ catch {
183
+ return into;
184
+ }
185
+ const yielder = new EventLoopYielder();
186
+ for (const f of files) {
187
+ await yielder.tick();
188
+ if (!f.endsWith('.md'))
189
+ continue;
190
+ const name = sessionNameFromHandoverFile(f);
191
+ if (name)
192
+ into.knownSessionNames.add(name);
193
+ const full = path.join(handoverDir, f);
194
+ try {
195
+ const st = await fs.promises.stat(full);
196
+ if (now - st.mtimeMs > WORKTREE_JANITOR_CONSTANTS.TRANSCRIPT_HANDOVER_SCAN_MAX_AGE_MS)
197
+ continue;
198
+ for (const id of collectUuids(await fs.promises.readFile(full, 'utf-8')))
199
+ into.recordedIds.add(id);
200
+ }
201
+ catch {
202
+ // skip
203
+ }
204
+ }
205
+ return into;
206
+ }
207
+ /** Bytes of a directory by a shallow stat walk (no symlinks followed). */
208
+ async function shallowDirBytes(dir, depth) {
209
+ let total = 0;
210
+ const walk = async (p, level) => {
211
+ let st;
212
+ try {
213
+ st = await fs.promises.lstat(p);
214
+ }
215
+ catch {
216
+ return;
217
+ }
218
+ total += st.size;
219
+ if (!st.isDirectory() || level >= depth)
220
+ return;
221
+ let names;
222
+ try {
223
+ names = await fs.promises.readdir(p);
224
+ }
225
+ catch {
226
+ return;
227
+ }
228
+ for (const n of names)
229
+ await walk(path.join(p, n), level + 1);
230
+ };
231
+ await walk(dir, 0);
232
+ return total;
233
+ }
234
+ /**
235
+ * One transcript sweep over the given Claude homes. Never throws; a home or
236
+ * project dir that cannot be read is skipped.
237
+ *
238
+ * @param input - Homes, sources, clock, dry-run flag
239
+ * @returns What was pruned and kept
240
+ */
241
+ export async function sweepTranscripts(input) {
242
+ const maxAge = input.maxAgeMs ?? WORKTREE_JANITOR_CONSTANTS.TRANSCRIPT_MAX_AGE_MS;
243
+ const ext = WORKTREE_JANITOR_CONSTANTS.TRANSCRIPT_EXT;
244
+ const summary = {
245
+ homes: [...input.claudeHomes],
246
+ scanned: 0,
247
+ crewlyLaunched: 0,
248
+ pruned: 0,
249
+ wouldPrune: 0,
250
+ freedBytes: 0,
251
+ wouldFreeBytes: 0,
252
+ keptReasons: {},
253
+ transcripts: [],
254
+ };
255
+ const keep = (reason, verdict) => {
256
+ summary.keptReasons[reason] = (summary.keptReasons[reason] ?? 0) + 1;
257
+ if (verdict)
258
+ summary.transcripts.push(verdict);
259
+ };
260
+ const yielder = new EventLoopYielder();
261
+ for (const home of new Set(input.claudeHomes)) {
262
+ const projects = path.join(home, WORKTREE_JANITOR_CONSTANTS.TRANSCRIPT_PROJECTS_DIR);
263
+ let slugs;
264
+ try {
265
+ slugs = await fs.promises.readdir(projects, { withFileTypes: true });
266
+ }
267
+ catch {
268
+ continue;
269
+ }
270
+ for (const slug of slugs) {
271
+ if (!slug.isDirectory())
272
+ continue;
273
+ const dir = path.join(projects, slug.name);
274
+ let names;
275
+ try {
276
+ names = await fs.promises.readdir(dir);
277
+ }
278
+ catch {
279
+ continue;
280
+ }
281
+ for (const name of names) {
282
+ await yielder.tick();
283
+ if (!name.endsWith(ext))
284
+ continue;
285
+ const id = name.slice(0, -ext.length).toLowerCase();
286
+ const file = path.join(dir, name);
287
+ let st;
288
+ try {
289
+ st = await fs.promises.lstat(file);
290
+ }
291
+ catch {
292
+ continue;
293
+ }
294
+ if (!st.isFile())
295
+ continue;
296
+ summary.scanned += 1;
297
+ const sibling = path.join(dir, name.slice(0, -ext.length));
298
+ let siblingIsDir = false;
299
+ try {
300
+ siblingIsDir = (await fs.promises.lstat(sibling)).isDirectory();
301
+ }
302
+ catch {
303
+ siblingIsDir = false;
304
+ }
305
+ const base = { path: file, id, bytes: st.size, removed: false };
306
+ if (input.sources.keepIds.has(id)) {
307
+ keep('live-session', { ...base, decision: 'keep', reason: 'live-session' });
308
+ continue;
309
+ }
310
+ let newest = st.mtimeMs;
311
+ if (siblingIsDir) {
312
+ const m = await latestTreeMtimeMs(sibling, 1);
313
+ if (m !== null && m > newest)
314
+ newest = m;
315
+ }
316
+ if (input.now - newest < maxAge) {
317
+ keep('recent');
318
+ continue;
319
+ }
320
+ const agentSetting = readAgentSetting(file, input.headBytes);
321
+ const launched = input.sources.recordedIds.has(id) || (agentSetting !== null && input.sources.knownSessionNames.has(agentSetting));
322
+ if (!launched) {
323
+ keep('foreign');
324
+ continue;
325
+ }
326
+ summary.crewlyLaunched += 1;
327
+ let bytes = st.size;
328
+ if (siblingIsDir)
329
+ bytes += (input.sizeOf ? await input.sizeOf(sibling) : null) ?? (await shallowDirBytes(sibling, 4));
330
+ const verdict = { ...base, bytes, decision: 'prune', reason: 'old', agentSetting };
331
+ if (input.dryRun) {
332
+ summary.wouldPrune += 1;
333
+ summary.wouldFreeBytes += bytes;
334
+ summary.transcripts.push(verdict);
335
+ continue;
336
+ }
337
+ try {
338
+ await fs.promises.unlink(file);
339
+ if (siblingIsDir)
340
+ await fs.promises.rm(sibling, { recursive: true, force: true });
341
+ verdict.removed = true;
342
+ summary.pruned += 1;
343
+ summary.freedBytes += bytes;
344
+ summary.transcripts.push(verdict);
345
+ }
346
+ catch (err) {
347
+ verdict.decision = 'keep';
348
+ verdict.reason = 'remove-failed';
349
+ verdict.error = err instanceof Error ? err.message : String(err);
350
+ keep('remove-failed', verdict);
351
+ }
352
+ }
353
+ }
354
+ }
355
+ return summary;
356
+ }
357
+ //# sourceMappingURL=transcript-janitor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcript-janitor.js","sourceRoot":"","sources":["../../../../../../backend/src/services/worktree/transcript-janitor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAC1I,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEhF,+CAA+C;AAC/C,MAAM,OAAO,GAAG,oEAAoE,CAAC;AAErF,uGAAuG;AACvG,MAAM,gBAAgB,GAAG,sCAAsC,CAAC;AA2EhE;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,YAAoB,0BAA0B,CAAC,qBAAqB;IAClH,IAAI,CAAC;QACJ,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC;YACJ,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACpC,MAAM,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,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Y;wBAAE,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;oBAClF,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;oBACvB,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;oBACpB,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC;oBAC5B,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACnC,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACd,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC;oBAC1B,OAAO,CAAC,MAAM,GAAG,eAAe,CAAC;oBACjC,OAAO,CAAC,KAAK,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBACjE,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;gBAChC,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"workitem-worktree.service.d.ts","sourceRoot":"","sources":["../../../../../../backend/src/services/worktree/workitem-worktree.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAcN,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,MAAM,mBAAmB,CAAC;AAM3B,oFAAoF;AACpF,MAAM,WAAW,cAAc;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,IAAI,EAAE,MA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AM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAOxH,6FAA6F;YAC/E,YAAY;IAY1B,mEAAmE;YACrD,MAAM;IAoEpB,iEAAiE;YACnD,IAAI;IAalB;;;;;;;OAOG;IACG,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAoChF;;;;;;OAMG;IACG,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAMxF,wDAAwD;YAC1C,aAAa;IA+B3B;;;;;;;;OAQG;IACG,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC;IAmCnC,yCAAyC;YAC3B,SAAS;IAmDvB,8CAA8C;IAC9C,OAAO,CAAC,YAAY;IAIpB,gCAAgC;IAC1B,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAQpF,iFAAiF;YACnE,UAAU;IAOxB,yDAAyD;YAC3C,MAAM;IAOpB,kFAAkF;IAClF,OAAO,CAAC,SAAS;CAejB"}
1
+ {"version":3,"file":"workitem-worktree.service.d.ts","sourceRoot":"","sources":["../../../../../../backend/src/services/worktree/workitem-worktree.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAeN,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,MAAM,mBAAmB,CAAC;AAM3B,oFAAoF;AACpF,MAAM,WAAW,cAAc;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,qBAA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AC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAOxH,6FAA6F;YAC/E,YAAY;IAY1B,mEAAmE;YACrD,MAAM;IAwEpB,iEAAiE;YACnD,IAAI;IAalB;;;;;;;OAOG;IACG,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAoChF;;;;;;OAMG;IACG,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAMxF,wDAAwD;YAC1C,aAAa;IA+B3B;;;;;;;;OAQG;IACG,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC;IAmCnC,yCAAyC;YAC3B,SAAS;IAmDvB,8CAA8C;IAC9C,OAAO,CAAC,YAAY;IAIpB,gCAAgC;IAC1B,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAQpF,iFAAiF;YACnE,UAAU;IAOxB,yDAAyD;YAC3C,MAAM;IAOpB,kFAAkF;IAClF,OAAO,CAAC,SAAS;CAejB"}
@@ -30,7 +30,7 @@ import path from 'path';
30
30
  import { promises as fs } from 'fs';
31
31
  import { WORKTREE_CONSTANTS, FRESH_TASK_CONVERSATION_CONSTANTS } from '../../constants.js';
32
32
  import { LoggerService } from '../core/logger.service.js';
33
- import { runGit, getRepoRoot, resolveBaseRef, branchExists, sanitizeWorktreeId, listWorktrees, readIncludeFile, applySharedPaths, ensureExcluded, checkDirty, checkLanded, commitsBeyond, removeWorktree, } from './worktree-git.js';
33
+ import { runGit, getRepoRoot, resolveBaseRef, branchExists, sanitizeWorktreeId, listWorktrees, readIncludeFile, applySharedPaths, nestedInstallDirs, ensureExcluded, checkDirty, checkLanded, commitsBeyond, removeWorktree, } from './worktree-git.js';
34
34
  /** WorkItem statuses after which a leftover worktree may be swept. */
35
35
  const SWEEPABLE = new Set(['done', 'verified', 'cancelled', 'failed']);
36
36
  const NOTE_AUTHOR = 'worktree';
@@ -198,7 +198,12 @@ export class WorkItemWorktreeService {
198
198
  if (!added.ok)
199
199
  return this.fail(record, `git worktree add failed: ${added.stderr.trim()}`);
200
200
  const includes = await readIncludeFile(repo);
201
- const shared = await applySharedPaths(repo, wtPath, project.worktreeSharedDirs ?? WORKTREE_CONSTANTS.DEFAULT_SHARED_DIRS, includes.entries);
201
+ // Share the workspace packages' node_modules too when the lock file matches
202
+ // (crewly#1354) — a fresh install per worktree cost 2–3 GB each.
203
+ const sharedDirs = [...(project.worktreeSharedDirs ?? WORKTREE_CONSTANTS.DEFAULT_SHARED_DIRS)];
204
+ if (sharedDirs.includes('node_modules'))
205
+ sharedDirs.push(...(await nestedInstallDirs(repo, wtPath)));
206
+ const shared = await applySharedPaths(repo, wtPath, sharedDirs, includes.entries);
202
207
  record.symlinks = shared.symlinks;
203
208
  record.copies = shared.copies;
204
209
  record.copyHashes = shared.copyHashes;