@telora/daemon 0.18.37 → 0.18.49
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/build-info.json +5 -3
- package/dist/completion/advanceability.d.ts +66 -0
- package/dist/completion/advanceability.d.ts.map +1 -0
- package/dist/completion/advanceability.js +112 -0
- package/dist/completion/advanceability.js.map +1 -0
- package/dist/completion/event.d.ts +28 -52
- package/dist/completion/event.d.ts.map +1 -1
- package/dist/completion/event.js +79 -99
- package/dist/completion/event.js.map +1 -1
- package/dist/completion/progress-snapshot.d.ts +15 -4
- package/dist/completion/progress-snapshot.d.ts.map +1 -1
- package/dist/completion/progress-snapshot.js +20 -4
- package/dist/completion/progress-snapshot.js.map +1 -1
- package/dist/crash-recovery.d.ts +48 -0
- package/dist/crash-recovery.d.ts.map +1 -1
- package/dist/crash-recovery.js +166 -30
- package/dist/crash-recovery.js.map +1 -1
- package/dist/delivery-advance-block.d.ts +17 -1
- package/dist/delivery-advance-block.d.ts.map +1 -1
- package/dist/delivery-advance-block.js +31 -8
- package/dist/delivery-advance-block.js.map +1 -1
- package/dist/escalation-provenance.d.ts +5 -1
- package/dist/escalation-provenance.d.ts.map +1 -1
- package/dist/escalation-provenance.js +46 -4
- package/dist/escalation-provenance.js.map +1 -1
- package/dist/focus-executor.d.ts.map +1 -1
- package/dist/focus-executor.js +1 -0
- package/dist/focus-executor.js.map +1 -1
- package/dist/git-activity.d.ts +15 -0
- package/dist/git-activity.d.ts.map +1 -1
- package/dist/git-activity.js +24 -0
- package/dist/git-activity.js.map +1 -1
- package/dist/listener.d.ts.map +1 -1
- package/dist/listener.js +5 -0
- package/dist/listener.js.map +1 -1
- package/dist/loop-engine-types.d.ts +40 -0
- package/dist/loop-engine-types.d.ts.map +1 -0
- package/dist/loop-engine-types.js +11 -0
- package/dist/loop-engine-types.js.map +1 -0
- package/dist/loop-engine.d.ts +52 -0
- package/dist/loop-engine.d.ts.map +1 -1
- package/dist/loop-engine.js +91 -10
- package/dist/loop-engine.js.map +1 -1
- package/dist/loop-llm-flag.d.ts +32 -0
- package/dist/loop-llm-flag.d.ts.map +1 -0
- package/dist/loop-llm-flag.js +35 -0
- package/dist/loop-llm-flag.js.map +1 -0
- package/dist/loop-operational-block.d.ts +44 -0
- package/dist/loop-operational-block.d.ts.map +1 -0
- package/dist/loop-operational-block.js +47 -0
- package/dist/loop-operational-block.js.map +1 -0
- package/dist/merge-back-loop.d.ts.map +1 -1
- package/dist/merge-back-loop.js +1 -0
- package/dist/merge-back-loop.js.map +1 -1
- package/dist/nexus-incoming.d.ts +8 -7
- package/dist/nexus-incoming.d.ts.map +1 -1
- package/dist/nexus-incoming.js +10 -12
- package/dist/nexus-incoming.js.map +1 -1
- package/dist/nexus-intake-spawn.d.ts +57 -0
- package/dist/nexus-intake-spawn.d.ts.map +1 -0
- package/dist/nexus-intake-spawn.js +158 -0
- package/dist/nexus-intake-spawn.js.map +1 -0
- package/dist/nexus-intake.d.ts +117 -0
- package/dist/nexus-intake.d.ts.map +1 -0
- package/dist/nexus-intake.js +212 -0
- package/dist/nexus-intake.js.map +1 -0
- package/dist/types/focus.d.ts +24 -0
- package/dist/types/focus.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/crash-recovery-cleanup.d.ts +0 -21
- package/dist/crash-recovery-cleanup.d.ts.map +0 -1
- package/dist/crash-recovery-cleanup.js +0 -205
- package/dist/crash-recovery-cleanup.js.map +0 -1
- package/dist/crash-recovery-scan.d.ts +0 -19
- package/dist/crash-recovery-scan.d.ts.map +0 -1
- package/dist/crash-recovery-scan.js +0 -145
- package/dist/crash-recovery-scan.js.map +0 -1
- package/dist/crash-recovery-types.d.ts +0 -49
- package/dist/crash-recovery-types.d.ts.map +0 -1
- package/dist/crash-recovery-types.js +0 -13
- package/dist/crash-recovery-types.js.map +0 -1
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Worktree scanning for crash recovery.
|
|
3
|
-
*
|
|
4
|
-
* Parses `git worktree list` output and reconciles against DB sessions
|
|
5
|
-
* and active focuses to classify worktrees as active or orphaned.
|
|
6
|
-
*/
|
|
7
|
-
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
8
|
-
import { join, resolve } from 'node:path';
|
|
9
|
-
import { runGitSync } from './git.js';
|
|
10
|
-
import { defaultDeps } from './crash-recovery-types.js';
|
|
11
|
-
// ── Helpers ──────────────────────────────────────────────────────
|
|
12
|
-
/**
|
|
13
|
-
* Extract the focus ID prefix (last 8 hex chars) from a worktree directory name.
|
|
14
|
-
* Focus worktree directories follow: agent-{role}-{name}-{8-char-id}
|
|
15
|
-
*/
|
|
16
|
-
function extractFocusIdPrefix(dirName) {
|
|
17
|
-
const match = dirName.match(/-([0-9a-f]{8})$/);
|
|
18
|
-
return match ? match[1] : null;
|
|
19
|
-
}
|
|
20
|
-
// ── Worktree scanning ────────────────────────────────────────────
|
|
21
|
-
/**
|
|
22
|
-
* Parse `git worktree list --porcelain` to build a map of
|
|
23
|
-
* worktree path -> branch name for all registered worktrees.
|
|
24
|
-
*/
|
|
25
|
-
export function parseWorktreeList(repoPath) {
|
|
26
|
-
const result = runGitSync(['worktree', 'list', '--porcelain'], repoPath);
|
|
27
|
-
const map = new Map();
|
|
28
|
-
if (!result.success)
|
|
29
|
-
return map;
|
|
30
|
-
let currentPath = null;
|
|
31
|
-
for (const line of result.output.split('\n')) {
|
|
32
|
-
if (line.startsWith('worktree ')) {
|
|
33
|
-
currentPath = line.slice('worktree '.length);
|
|
34
|
-
}
|
|
35
|
-
else if (line.startsWith('branch refs/heads/') && currentPath) {
|
|
36
|
-
map.set(currentPath, line.slice('branch refs/heads/'.length));
|
|
37
|
-
currentPath = null;
|
|
38
|
-
}
|
|
39
|
-
else if (line === '') {
|
|
40
|
-
currentPath = null;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return map;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Scan the worktree directory and reconcile against active DB sessions
|
|
47
|
-
* to classify each worktree as active or orphaned.
|
|
48
|
-
*/
|
|
49
|
-
export async function detectOrphanedWorktrees(config, deps = defaultDeps) {
|
|
50
|
-
const { worktreeDir, repoPath } = config;
|
|
51
|
-
// 1. Read all subdirectories in worktreeDir
|
|
52
|
-
if (!existsSync(worktreeDir))
|
|
53
|
-
return [];
|
|
54
|
-
const entries = readdirSync(worktreeDir);
|
|
55
|
-
const subdirs = entries.filter((entry) => {
|
|
56
|
-
const fullPath = join(worktreeDir, entry);
|
|
57
|
-
try {
|
|
58
|
-
return statSync(fullPath).isDirectory();
|
|
59
|
-
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
console.debug(`[crash-recovery] Failed to stat ${fullPath} (may have been deleted):`, e.message);
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
if (subdirs.length === 0)
|
|
66
|
-
return [];
|
|
67
|
-
// 2. Parse git worktree list to map paths -> branch names
|
|
68
|
-
const worktreeMap = parseWorktreeList(repoPath);
|
|
69
|
-
// Build a reverse lookup: resolve worktree paths so we can match
|
|
70
|
-
const pathToBranch = new Map();
|
|
71
|
-
for (const [wtPath, branch] of worktreeMap) {
|
|
72
|
-
pathToBranch.set(resolve(wtPath), branch);
|
|
73
|
-
}
|
|
74
|
-
// 3. Query active sessions from DB
|
|
75
|
-
let activeSessions = [];
|
|
76
|
-
try {
|
|
77
|
-
activeSessions = await deps.getActiveSessions();
|
|
78
|
-
}
|
|
79
|
-
catch (err) {
|
|
80
|
-
console.warn(`[crash-recovery] Failed to query active sessions from DB: ${err instanceof Error ? err.message : String(err)}. ` +
|
|
81
|
-
`Treating all worktrees as orphaned.`);
|
|
82
|
-
}
|
|
83
|
-
// Build set of branch names with active sessions
|
|
84
|
-
const activeBranches = new Set(activeSessions.map((s) => s.branch_name));
|
|
85
|
-
// Build map of branch -> session for linking
|
|
86
|
-
const branchToSession = new Map();
|
|
87
|
-
for (const session of activeSessions) {
|
|
88
|
-
branchToSession.set(session.branch_name, session);
|
|
89
|
-
}
|
|
90
|
-
// 3b. Query active focuses to preserve persistent worktrees
|
|
91
|
-
const activeFocusIdPrefixes = new Set();
|
|
92
|
-
try {
|
|
93
|
-
const activeFocuses = await deps.getActiveFocuses(config.organizationId, config.productId);
|
|
94
|
-
for (const s of activeFocuses) {
|
|
95
|
-
activeFocusIdPrefixes.add(s.focus_id.slice(0, 8));
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
catch (err) {
|
|
99
|
-
console.warn(`[crash-recovery] Failed to query active focuses: ${err instanceof Error ? err.message : String(err)}. ` +
|
|
100
|
-
`Persistent focus worktrees may be incorrectly classified as orphaned.`);
|
|
101
|
-
}
|
|
102
|
-
// 4. Classify each worktree subdirectory
|
|
103
|
-
const orphans = [];
|
|
104
|
-
for (const subdir of subdirs) {
|
|
105
|
-
const fullPath = resolve(join(worktreeDir, subdir));
|
|
106
|
-
const branchName = pathToBranch.get(fullPath);
|
|
107
|
-
if (!branchName) {
|
|
108
|
-
// Directory exists but no git worktree entry -- likely a stale directory.
|
|
109
|
-
// Check if it belongs to an active focus before classifying as orphan.
|
|
110
|
-
const idPrefix = extractFocusIdPrefix(subdir);
|
|
111
|
-
if (idPrefix && activeFocusIdPrefixes.has(idPrefix)) {
|
|
112
|
-
console.log(`[crash-recovery] Worktree belongs to active focus (persistent, no git entry): ${fullPath}`);
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
// Try to infer branch from directory name (agent-role-delivery pattern).
|
|
116
|
-
console.log(`[crash-recovery] Worktree directory has no git entry: ${fullPath}`);
|
|
117
|
-
orphans.push({
|
|
118
|
-
worktreePath: fullPath,
|
|
119
|
-
branchName: subdir.replace(/-/g, '/').replace(/^agent\//, 'agent/'),
|
|
120
|
-
session: null,
|
|
121
|
-
});
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
if (activeBranches.has(branchName)) {
|
|
125
|
-
// Active session exists -- leave alone
|
|
126
|
-
console.log(`[crash-recovery] Worktree is active (has DB session): ${fullPath} [${branchName}]`);
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
// Check if this worktree belongs to an active focus (persistent worktree)
|
|
130
|
-
const idPrefix = extractFocusIdPrefix(subdir);
|
|
131
|
-
if (idPrefix && activeFocusIdPrefixes.has(idPrefix)) {
|
|
132
|
-
console.log(`[crash-recovery] Worktree belongs to active focus (persistent): ${fullPath} [${branchName}]`);
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
// No active session and no active focus -- orphaned
|
|
136
|
-
const session = branchToSession.get(branchName) ?? null;
|
|
137
|
-
orphans.push({
|
|
138
|
-
worktreePath: fullPath,
|
|
139
|
-
branchName,
|
|
140
|
-
session,
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
return orphans;
|
|
144
|
-
}
|
|
145
|
-
//# sourceMappingURL=crash-recovery-scan.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crash-recovery-scan.js","sourceRoot":"","sources":["../src/crash-recovery-scan.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,oEAAoE;AAEpE;;;GAGG;AACH,SAAS,oBAAoB,CAAC,OAAe;IAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC/C,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjC,CAAC;AAED,oEAAoE;AAEpE;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,MAAM,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ACX,CAAC;YACD,yEAAyE;YACzE,OAAO,CAAC,GAAG,CAAC,yDAAyD,QAAQ,EAAE,CAAC,CAAC;YACjF,OAAO,CAAC,IAAI,CAAC;gBACX,YAAY,EAAE,QAAQ;gBACtB,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC;gBACnE,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QAED,IAAI,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YACnC,uCAAuC;YACvC,OAAO,CAAC,GAAG,CAAC,yDAAyD,QAAQ,KAAK,UAAU,GAAG,CAAC,CAAC;YACjG,SAAS;QACX,CAAC;QAED,0EAA0E;QAC1E,MAAM,QAAQ,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;QAC9C,IAAI,QAAQ,IAAI,qBAAqB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpD,OAAO,CAAC,GAAG,CAAC,mEAAmE,QAAQ,KAAK,UAAU,GAAG,CAAC,CAAC;YAC3G,SAAS;QACX,CAAC;QAED,oDAAoD;QACpD,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC;QACxD,OAAO,CAAC,IAAI,CAAC;YACX,YAAY,EAAE,QAAQ;YACtB,UAAU;YACV,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Types and dependency injection for crash recovery.
|
|
3
|
-
*/
|
|
4
|
-
import type { AgentSession } from './types.js';
|
|
5
|
-
import { type CreateEscalationParams } from './queries/issues.js';
|
|
6
|
-
export interface OrphanedWorktree {
|
|
7
|
-
/** Absolute path to the worktree directory. */
|
|
8
|
-
worktreePath: string;
|
|
9
|
-
/** Git branch name (e.g. agent/developer/my-delivery). */
|
|
10
|
-
branchName: string;
|
|
11
|
-
/** DB session that was still marked active, if any. */
|
|
12
|
-
session: AgentSession | null;
|
|
13
|
-
}
|
|
14
|
-
export interface CleanupAction {
|
|
15
|
-
worktreePath: string;
|
|
16
|
-
branchName: string;
|
|
17
|
-
action: 'removed' | 'preserved' | 'safety-committed' | 'safety-committed-and-removed';
|
|
18
|
-
/** Set when a safety commit was created. */
|
|
19
|
-
commitHash?: string;
|
|
20
|
-
/** Set when the orphan was preserved due to unmerged commits. */
|
|
21
|
-
unmergedCommitCount?: number;
|
|
22
|
-
}
|
|
23
|
-
export interface RecoveryResult {
|
|
24
|
-
orphansDetected: number;
|
|
25
|
-
orphansCleaned: number;
|
|
26
|
-
orphansPreserved: number;
|
|
27
|
-
branchesPruned: number;
|
|
28
|
-
branchesPreserved: number;
|
|
29
|
-
actions: CleanupAction[];
|
|
30
|
-
errors: string[];
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Injectable dependencies for testing.
|
|
34
|
-
* Production code uses the defaults (real DB queries).
|
|
35
|
-
*/
|
|
36
|
-
export interface RecoveryDeps {
|
|
37
|
-
getActiveSessions: () => Promise<AgentSession[]>;
|
|
38
|
-
getActiveFocuses: (organizationId: string, productId?: string) => Promise<Array<{
|
|
39
|
-
focus_id: string;
|
|
40
|
-
focus_name: string;
|
|
41
|
-
assigned_agent_role_id: string | null;
|
|
42
|
-
}>>;
|
|
43
|
-
updateSession: (sessionId: string, updates: Record<string, unknown>) => Promise<unknown>;
|
|
44
|
-
createEscalation: (params: CreateEscalationParams) => Promise<{
|
|
45
|
-
escalationId: string | null;
|
|
46
|
-
} | void>;
|
|
47
|
-
}
|
|
48
|
-
export declare const defaultDeps: RecoveryDeps;
|
|
49
|
-
//# sourceMappingURL=crash-recovery-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crash-recovery-types.d.ts","sourceRoot":"","sources":["../src/crash-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E,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACzF,gBAAgB,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;CACvG;AAED,eAAO,MAAM,WAAW,EAAE,YAKzB,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Types and dependency injection for crash recovery.
|
|
3
|
-
*/
|
|
4
|
-
import { getActiveSessions, updateSession } from './queries/sessions.js';
|
|
5
|
-
import { createEscalation } from './queries/issues.js';
|
|
6
|
-
import { getActiveFocuses } from './queries/deliveries.js';
|
|
7
|
-
export const defaultDeps = {
|
|
8
|
-
getActiveSessions,
|
|
9
|
-
getActiveFocuses,
|
|
10
|
-
updateSession: (id, updates) => updateSession(id, updates),
|
|
11
|
-
createEscalation,
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=crash-recovery-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crash-recovery-types.js","sourceRoot":"","sources":["../src/crash-recovery-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAA+B,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AA4C3D,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,iBAAiB;IACjB,gBAAgB;IAChB,aAAa,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,OAA8C,CAAC;IACjG,gBAAgB;CACjB,CAAC"}
|