dual-brain 0.2.30 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dual-brain/docs/claude-code-extension-points.md +32 -0
- package/.dual-brain/docs/data-tools-capabilities.md +181 -0
- package/.dual-brain/docs/ecosystem-tools.md +91 -0
- package/.dual-brain/docs/panel-handoff.md +124 -0
- package/.dual-brain/docs/ruflo-analysis.md +48 -0
- package/bin/dual-brain.mjs +56 -56
- package/dist/mcp-server/index.d.ts +27 -0
- package/dist/mcp-server/index.js +359 -0
- package/dist/mcp-server/index.js.map +1 -0
- package/dist/src/agent-protocol.d.ts +163 -0
- package/dist/src/agent-protocol.js +368 -0
- package/dist/src/agent-protocol.js.map +1 -0
- package/dist/src/agents/registry.d.ts +52 -0
- package/dist/src/agents/registry.js +393 -0
- package/dist/src/agents/registry.js.map +1 -0
- package/dist/src/awareness.d.ts +93 -0
- package/dist/src/awareness.js +406 -0
- package/dist/src/awareness.js.map +1 -0
- package/dist/src/brief.d.ts +48 -0
- package/dist/src/brief.js +179 -0
- package/dist/src/brief.js.map +1 -0
- package/dist/src/calibration.d.ts +32 -0
- package/dist/src/calibration.js +133 -0
- package/dist/src/calibration.js.map +1 -0
- package/dist/src/checkpoint.d.ts +33 -0
- package/dist/src/checkpoint.js +99 -0
- package/dist/src/checkpoint.js.map +1 -0
- package/dist/src/ci-triage.d.ts +33 -0
- package/dist/src/ci-triage.js +193 -0
- package/dist/src/ci-triage.js.map +1 -0
- package/dist/src/cognitive-loop.d.ts +56 -0
- package/dist/src/cognitive-loop.js +495 -0
- package/dist/src/cognitive-loop.js.map +1 -0
- package/dist/src/collaboration.d.ts +147 -0
- package/dist/src/collaboration.js +438 -0
- package/dist/src/collaboration.js.map +1 -0
- package/dist/src/context-intel.d.ts +47 -0
- package/dist/src/context-intel.js +156 -0
- package/dist/src/context-intel.js.map +1 -0
- package/dist/src/context.d.ts +53 -0
- package/dist/src/context.js +332 -0
- package/dist/src/context.js.map +1 -0
- package/dist/src/continuity.d.ts +89 -0
- package/dist/src/continuity.js +230 -0
- package/dist/src/continuity.js.map +1 -0
- package/dist/src/cost-tracker.d.ts +47 -0
- package/dist/src/cost-tracker.js +170 -0
- package/dist/src/cost-tracker.js.map +1 -0
- package/dist/src/debrief.d.ts +53 -0
- package/dist/src/debrief.js +222 -0
- package/dist/src/debrief.js.map +1 -0
- package/dist/src/decide.d.ts +96 -0
- package/dist/src/decide.js +744 -0
- package/dist/src/decide.js.map +1 -0
- package/dist/src/decompose.d.ts +39 -0
- package/dist/src/decompose.js +218 -0
- package/dist/src/decompose.js.map +1 -0
- package/dist/src/detect.d.ts +91 -0
- package/dist/src/detect.js +544 -0
- package/dist/src/detect.js.map +1 -0
- package/dist/src/dispatch.d.ts +154 -0
- package/dist/src/dispatch.js +1306 -0
- package/dist/src/dispatch.js.map +1 -0
- package/dist/src/doctor.d.ts +421 -0
- package/dist/src/doctor.js +1689 -0
- package/dist/src/doctor.js.map +1 -0
- package/dist/src/engine.d.ts +70 -0
- package/dist/src/engine.js +155 -0
- package/dist/src/engine.js.map +1 -0
- package/dist/src/envelope.d.ts +36 -0
- package/dist/src/envelope.js +80 -0
- package/dist/src/envelope.js.map +1 -0
- package/dist/src/failure-memory.d.ts +55 -0
- package/dist/src/failure-memory.js +175 -0
- package/dist/src/failure-memory.js.map +1 -0
- package/dist/src/fx.d.ts +87 -0
- package/dist/src/fx.js +272 -0
- package/dist/src/fx.js.map +1 -0
- package/dist/src/governance.d.ts +93 -0
- package/dist/src/governance.js +261 -0
- package/dist/src/governance.js.map +1 -0
- package/dist/src/handoff.d.ts +11 -0
- package/dist/src/handoff.js +90 -0
- package/dist/src/handoff.js.map +1 -0
- package/dist/src/head-protocol.d.ts +76 -0
- package/dist/src/head-protocol.js +109 -0
- package/dist/src/head-protocol.js.map +1 -0
- package/dist/src/head.d.ts +222 -0
- package/dist/src/head.js +765 -0
- package/dist/src/head.js.map +1 -0
- package/dist/src/health.d.ts +132 -0
- package/dist/src/health.js +435 -0
- package/dist/src/health.js.map +1 -0
- package/dist/src/inbox.d.ts +70 -0
- package/dist/src/inbox.js +218 -0
- package/dist/src/inbox.js.map +1 -0
- package/dist/src/index.d.ts +33 -0
- package/dist/src/index.js +38 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/install-hooks.d.ts +13 -0
- package/dist/src/install-hooks.js +88 -0
- package/dist/src/install-hooks.js.map +1 -0
- package/dist/src/integrity.d.ts +59 -0
- package/dist/src/integrity.js +206 -0
- package/dist/src/integrity.js.map +1 -0
- package/dist/src/intelligence.d.ts +104 -0
- package/dist/src/intelligence.js +391 -0
- package/dist/src/intelligence.js.map +1 -0
- package/dist/src/ledger.d.ts +54 -0
- package/dist/src/ledger.js +179 -0
- package/dist/src/ledger.js.map +1 -0
- package/dist/src/living-docs.d.ts +14 -0
- package/dist/src/living-docs.js +197 -0
- package/dist/src/living-docs.js.map +1 -0
- package/dist/src/memory-tiers.d.ts +37 -0
- package/dist/src/memory-tiers.js +160 -0
- package/dist/src/memory-tiers.js.map +1 -0
- package/dist/src/model-profiles.d.ts +65 -0
- package/dist/src/model-profiles.js +568 -0
- package/dist/src/model-profiles.js.map +1 -0
- package/dist/src/models.d.ts +58 -0
- package/dist/src/models.js +327 -0
- package/dist/src/models.js.map +1 -0
- package/dist/src/narrative.d.ts +54 -0
- package/dist/src/narrative.js +163 -0
- package/dist/src/narrative.js.map +1 -0
- package/dist/src/nextstep.d.ts +16 -0
- package/dist/src/nextstep.js +103 -0
- package/dist/src/nextstep.js.map +1 -0
- package/dist/src/observer.d.ts +18 -0
- package/dist/src/observer.js +251 -0
- package/dist/src/observer.js.map +1 -0
- package/dist/src/outcome.d.ts +110 -0
- package/dist/src/outcome.js +377 -0
- package/dist/src/outcome.js.map +1 -0
- package/dist/src/pipeline.d.ts +167 -0
- package/dist/src/pipeline.js +1503 -0
- package/dist/src/pipeline.js.map +1 -0
- package/dist/src/playbook.d.ts +59 -0
- package/dist/src/playbook.js +238 -0
- package/dist/src/playbook.js.map +1 -0
- package/dist/src/pr-agent.d.ts +97 -0
- package/dist/src/pr-agent.js +195 -0
- package/dist/src/pr-agent.js.map +1 -0
- package/dist/src/predictive.d.ts +57 -0
- package/dist/src/predictive.js +230 -0
- package/dist/src/predictive.js.map +1 -0
- package/dist/src/profile.d.ts +294 -0
- package/dist/src/profile.js +1347 -0
- package/dist/src/profile.js.map +1 -0
- package/dist/src/prompt-audit.d.ts +22 -0
- package/dist/src/prompt-audit.js +194 -0
- package/dist/src/prompt-audit.js.map +1 -0
- package/dist/src/prompt-intel.d.ts +12 -0
- package/dist/src/prompt-intel.js +321 -0
- package/dist/src/prompt-intel.js.map +1 -0
- package/dist/src/provider-context.d.ts +121 -0
- package/dist/src/provider-context.js +222 -0
- package/dist/src/provider-context.js.map +1 -0
- package/dist/src/provider-manager.d.ts +92 -0
- package/dist/src/provider-manager.js +428 -0
- package/dist/src/provider-manager.js.map +1 -0
- package/dist/src/receipt.d.ts +87 -0
- package/dist/src/receipt.js +326 -0
- package/dist/src/receipt.js.map +1 -0
- package/dist/src/recommendations.d.ts +13 -0
- package/dist/src/recommendations.js +291 -0
- package/dist/src/recommendations.js.map +1 -0
- package/dist/src/redact.d.ts +15 -0
- package/dist/src/redact.js +129 -0
- package/dist/src/redact.js.map +1 -0
- package/dist/src/replit.d.ts +397 -0
- package/dist/src/replit.js +1160 -0
- package/dist/src/replit.js.map +1 -0
- package/dist/src/repo.d.ts +149 -0
- package/dist/src/repo.js +416 -0
- package/dist/src/repo.js.map +1 -0
- package/dist/src/revert.d.ts +30 -0
- package/dist/src/revert.js +166 -0
- package/dist/src/revert.js.map +1 -0
- package/dist/src/room.d.ts +102 -0
- package/dist/src/room.js +212 -0
- package/dist/src/room.js.map +1 -0
- package/dist/src/routing-advisor.d.ts +57 -0
- package/dist/src/routing-advisor.js +221 -0
- package/dist/src/routing-advisor.js.map +1 -0
- package/dist/src/self-correct.d.ts +40 -0
- package/dist/src/self-correct.js +137 -0
- package/dist/src/self-correct.js.map +1 -0
- package/dist/src/session-lock.d.ts +35 -0
- package/dist/src/session-lock.js +134 -0
- package/dist/src/session-lock.js.map +1 -0
- package/dist/src/session.d.ts +267 -0
- package/dist/src/session.js +1660 -0
- package/dist/src/session.js.map +1 -0
- package/dist/src/settings-tui.d.ts +5 -0
- package/dist/src/settings-tui.js +422 -0
- package/dist/src/settings-tui.js.map +1 -0
- package/dist/src/setup-flow.d.ts +63 -0
- package/dist/src/setup-flow.js +233 -0
- package/dist/src/setup-flow.js.map +1 -0
- package/dist/src/signal.d.ts +19 -0
- package/dist/src/signal.js +122 -0
- package/dist/src/signal.js.map +1 -0
- package/dist/src/simmer.d.ts +85 -0
- package/dist/src/simmer.js +224 -0
- package/dist/src/simmer.js.map +1 -0
- package/dist/src/state-export.d.ts +129 -0
- package/dist/src/state-export.js +233 -0
- package/dist/src/state-export.js.map +1 -0
- package/dist/src/strategy.d.ts +54 -0
- package/dist/src/strategy.js +95 -0
- package/dist/src/strategy.js.map +1 -0
- package/dist/src/subscription.d.ts +40 -0
- package/dist/src/subscription.js +189 -0
- package/dist/src/subscription.js.map +1 -0
- package/dist/src/templates.d.ts +208 -0
- package/dist/src/templates.js +238 -0
- package/dist/src/templates.js.map +1 -0
- package/dist/src/test.d.ts +9 -0
- package/dist/src/test.js +1173 -0
- package/dist/src/test.js.map +1 -0
- package/dist/src/think-engine.d.ts +67 -0
- package/dist/src/think-engine.js +412 -0
- package/dist/src/think-engine.js.map +1 -0
- package/dist/src/tui.d.ts +71 -0
- package/dist/src/tui.js +242 -0
- package/dist/src/tui.js.map +1 -0
- package/dist/src/types.d.ts +177 -0
- package/dist/src/types.js +6 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/update-check.d.ts +7 -0
- package/dist/src/update-check.js +36 -0
- package/dist/src/update-check.js.map +1 -0
- package/dist/src/wave-planner.d.ts +30 -0
- package/dist/src/wave-planner.js +281 -0
- package/dist/src/wave-planner.js.map +1 -0
- package/hooks/head-guard.sh +41 -0
- package/hooks/task-classifier.mjs +328 -0
- package/hooks/vibe-router.mjs +387 -0
- package/package.json +29 -153
- package/src/agents/registry.mjs +0 -405
- package/src/awareness.mjs +0 -425
- package/src/brief.mjs +0 -266
- package/src/calibration.mjs +0 -148
- package/src/checkpoint.mjs +0 -109
- package/src/ci-triage.mjs +0 -191
- package/src/cognitive-loop.mjs +0 -562
- package/src/collaboration.mjs +0 -545
- package/src/context-intel.mjs +0 -158
- package/src/context.mjs +0 -389
- package/src/continuity.mjs +0 -298
- package/src/cost-tracker.mjs +0 -184
- package/src/debrief.mjs +0 -228
- package/src/decide.mjs +0 -1099
- package/src/decompose.mjs +0 -331
- package/src/detect.mjs +0 -702
- package/src/dispatch.mjs +0 -1447
- package/src/doctor.mjs +0 -1607
- package/src/envelope.mjs +0 -139
- package/src/failure-memory.mjs +0 -178
- package/src/fx.mjs +0 -276
- package/src/governance.mjs +0 -279
- package/src/handoff.mjs +0 -87
- package/src/head-protocol.mjs +0 -128
- package/src/head.mjs +0 -952
- package/src/health.mjs +0 -528
- package/src/inbox.mjs +0 -195
- package/src/index.mjs +0 -44
- package/src/install-hooks.mjs +0 -100
- package/src/integrity.mjs +0 -245
- package/src/intelligence.mjs +0 -447
- package/src/ledger.mjs +0 -196
- package/src/living-docs.mjs +0 -210
- package/src/memory-tiers.mjs +0 -193
- package/src/models.mjs +0 -363
- package/src/narrative.mjs +0 -169
- package/src/nextstep.mjs +0 -100
- package/src/observer.mjs +0 -241
- package/src/outcome.mjs +0 -400
- package/src/pipeline.mjs +0 -1711
- package/src/playbook.mjs +0 -257
- package/src/pr-agent.mjs +0 -214
- package/src/predictive.mjs +0 -250
- package/src/profile.mjs +0 -1411
- package/src/prompt-audit.mjs +0 -231
- package/src/prompt-intel.mjs +0 -325
- package/src/provider-context.mjs +0 -257
- package/src/receipt.mjs +0 -344
- package/src/recommendations.mjs +0 -296
- package/src/redact.mjs +0 -192
- package/src/replit.mjs +0 -1210
- package/src/repo.mjs +0 -445
- package/src/revert.mjs +0 -149
- package/src/routing-advisor.mjs +0 -204
- package/src/self-correct.mjs +0 -147
- package/src/session-lock.mjs +0 -160
- package/src/session.mjs +0 -1655
- package/src/settings-tui.mjs +0 -373
- package/src/setup-flow.mjs +0 -223
- package/src/signal.mjs +0 -115
- package/src/simmer.mjs +0 -241
- package/src/strategy.mjs +0 -235
- package/src/subscription.mjs +0 -212
- package/src/templates.mjs +0 -260
- package/src/think-engine.mjs +0 -428
- package/src/tui.mjs +0 -276
- package/src/update-check.mjs +0 -35
- package/src/wave-planner.mjs +0 -294
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* session.ts — Persist task state between terminal sessions.
|
|
4
|
+
*
|
|
5
|
+
* Exports:
|
|
6
|
+
* loadSession(cwd) → session state or null (if stale/missing)
|
|
7
|
+
* saveSession(state, cwd) → write session atomically
|
|
8
|
+
* updateSession(patch, cwd) → merge partial update into existing session
|
|
9
|
+
* clearSession(cwd) → delete session file
|
|
10
|
+
* formatSessionCard(session, repo, health) → compact status card string (≤5 lines)
|
|
11
|
+
*/
|
|
12
|
+
export type SessionPhase = 'idle' | 'active' | 'paused' | 'complete' | 'failed';
|
|
13
|
+
export interface SessionState {
|
|
14
|
+
startedAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
objective: string | null;
|
|
17
|
+
branch: string | null;
|
|
18
|
+
filesChanged: string[];
|
|
19
|
+
commandsRun: string[];
|
|
20
|
+
lastResult: SessionResult | null;
|
|
21
|
+
provider: string | null;
|
|
22
|
+
nextAction: string | null;
|
|
23
|
+
}
|
|
24
|
+
export interface SessionResult {
|
|
25
|
+
status?: 'success' | 'failure' | 'partial';
|
|
26
|
+
summary?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface SessionPatch {
|
|
29
|
+
startedAt?: string;
|
|
30
|
+
updatedAt?: string;
|
|
31
|
+
objective?: string | null;
|
|
32
|
+
branch?: string | null;
|
|
33
|
+
filesChanged?: string[];
|
|
34
|
+
commandsRun?: string[];
|
|
35
|
+
lastResult?: SessionResult | null;
|
|
36
|
+
provider?: string | null;
|
|
37
|
+
nextAction?: string | null;
|
|
38
|
+
}
|
|
39
|
+
export interface RepoInfo {
|
|
40
|
+
name?: string;
|
|
41
|
+
type?: string;
|
|
42
|
+
packageManager?: string;
|
|
43
|
+
branch?: string;
|
|
44
|
+
dirty?: boolean;
|
|
45
|
+
commands?: {
|
|
46
|
+
test?: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface HealthInfo {
|
|
50
|
+
states?: Record<string, {
|
|
51
|
+
status?: string;
|
|
52
|
+
}>;
|
|
53
|
+
session?: unknown;
|
|
54
|
+
}
|
|
55
|
+
export interface ProfileInfo {
|
|
56
|
+
providers?: Record<string, {
|
|
57
|
+
enabled?: boolean;
|
|
58
|
+
}>;
|
|
59
|
+
}
|
|
60
|
+
export interface ReplitSession {
|
|
61
|
+
id: string;
|
|
62
|
+
name: string;
|
|
63
|
+
smartName?: string | null;
|
|
64
|
+
project: string;
|
|
65
|
+
promptCount: number;
|
|
66
|
+
lastActive: string;
|
|
67
|
+
isActive: boolean;
|
|
68
|
+
source: string;
|
|
69
|
+
age: string;
|
|
70
|
+
tool?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface SessionMeta {
|
|
73
|
+
[sessionId: string]: {
|
|
74
|
+
name?: string;
|
|
75
|
+
pinned?: boolean;
|
|
76
|
+
category?: string | null;
|
|
77
|
+
createdAt?: string;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export interface ArchivedSession {
|
|
81
|
+
id: string;
|
|
82
|
+
archived: boolean;
|
|
83
|
+
archivedAt: string;
|
|
84
|
+
[key: string]: unknown;
|
|
85
|
+
}
|
|
86
|
+
export interface EnrichedSession extends ReplitSession {
|
|
87
|
+
pinned: boolean;
|
|
88
|
+
category: string | null;
|
|
89
|
+
}
|
|
90
|
+
export interface SessionIndexEntry {
|
|
91
|
+
id: string;
|
|
92
|
+
topics: string[];
|
|
93
|
+
files: string[];
|
|
94
|
+
prompts: {
|
|
95
|
+
first: string;
|
|
96
|
+
last: string;
|
|
97
|
+
};
|
|
98
|
+
date: string | null;
|
|
99
|
+
messageCount: number;
|
|
100
|
+
tool: string;
|
|
101
|
+
smartName?: string;
|
|
102
|
+
archived?: boolean;
|
|
103
|
+
_fileSize: number;
|
|
104
|
+
}
|
|
105
|
+
export interface SessionSearchResult {
|
|
106
|
+
sessionId: string;
|
|
107
|
+
date: string | null;
|
|
108
|
+
relevance: number;
|
|
109
|
+
_score: number;
|
|
110
|
+
files: string[];
|
|
111
|
+
summary: string;
|
|
112
|
+
matchingLines: string[];
|
|
113
|
+
messageCount: number;
|
|
114
|
+
}
|
|
115
|
+
export interface RelatedSession {
|
|
116
|
+
sessionId: string;
|
|
117
|
+
smartName: string;
|
|
118
|
+
score: number;
|
|
119
|
+
matchedFiles: string[];
|
|
120
|
+
matchedTopics: string[];
|
|
121
|
+
date: string | null;
|
|
122
|
+
messageCount: number;
|
|
123
|
+
}
|
|
124
|
+
export interface SessionContext {
|
|
125
|
+
lastPrompt: string | null;
|
|
126
|
+
filesTouched: string[];
|
|
127
|
+
totalLines: number;
|
|
128
|
+
}
|
|
129
|
+
export interface ExtractedSessionMeta {
|
|
130
|
+
id: string;
|
|
131
|
+
date: string | null;
|
|
132
|
+
messageCount: number;
|
|
133
|
+
files: string[];
|
|
134
|
+
taskSummary: string | null;
|
|
135
|
+
firstPrompt: string | null;
|
|
136
|
+
lastPrompt: string | null;
|
|
137
|
+
duration: number | null;
|
|
138
|
+
}
|
|
139
|
+
export interface RoutingContext {
|
|
140
|
+
relatedSessions: Array<{
|
|
141
|
+
sessionId: string;
|
|
142
|
+
date: string | null;
|
|
143
|
+
taskSummary: string | null;
|
|
144
|
+
score: number;
|
|
145
|
+
messageCount: number;
|
|
146
|
+
files: string[];
|
|
147
|
+
}>;
|
|
148
|
+
riskSignals: string[];
|
|
149
|
+
priorAttempts: Array<{
|
|
150
|
+
sessionId: string;
|
|
151
|
+
date: string | null;
|
|
152
|
+
summary: string | null;
|
|
153
|
+
likelyIncomplete: boolean;
|
|
154
|
+
}>;
|
|
155
|
+
relevantFiles: string[];
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Load the session file. Returns null if missing or older than 24 hours.
|
|
159
|
+
*/
|
|
160
|
+
export declare function loadSession(cwd?: string): SessionState | null;
|
|
161
|
+
/**
|
|
162
|
+
* Write session state atomically (tmp + rename).
|
|
163
|
+
*/
|
|
164
|
+
export declare function saveSession(state: SessionPatch, cwd?: string): SessionState;
|
|
165
|
+
/**
|
|
166
|
+
* Merge a partial update into the existing session (or create a new one).
|
|
167
|
+
*/
|
|
168
|
+
export declare function updateSession(patch: SessionPatch, cwd?: string): SessionState;
|
|
169
|
+
/**
|
|
170
|
+
* Delete the session file.
|
|
171
|
+
*/
|
|
172
|
+
export declare function clearSession(cwd?: string): void;
|
|
173
|
+
/**
|
|
174
|
+
* Format a compact status card (≤5 lines) for display when running `dual-brain`.
|
|
175
|
+
*/
|
|
176
|
+
export declare function formatSessionCard(session: SessionState | null, repo: RepoInfo, health: HealthInfo | null, profile?: ProfileInfo): string;
|
|
177
|
+
/**
|
|
178
|
+
* Import sessions from replit-tools history.jsonl.
|
|
179
|
+
* Returns an array of session summary objects, sorted most-recent first.
|
|
180
|
+
* Returns [] gracefully if replit-tools is not present.
|
|
181
|
+
*/
|
|
182
|
+
export declare function importReplitSessions(cwd?: string): ReplitSession[];
|
|
183
|
+
export declare function getSessionMeta(cwd?: string): SessionMeta;
|
|
184
|
+
export declare function saveSessionMeta(meta: SessionMeta, cwd?: string): void;
|
|
185
|
+
/**
|
|
186
|
+
* Archive a session — moves it from active sessions.json to archive/sessions.json.
|
|
187
|
+
* The session data stays in the index (searchable), just flagged as archived.
|
|
188
|
+
* Non-destructive and reversible.
|
|
189
|
+
*/
|
|
190
|
+
export declare function archiveSession(sessionId: string, cwd?: string): void;
|
|
191
|
+
/**
|
|
192
|
+
* Return all archived sessions.
|
|
193
|
+
*/
|
|
194
|
+
export declare function getArchivedSessions(cwd?: string): ArchivedSession[];
|
|
195
|
+
export declare function renameSession(sessionId: string, name: string, cwd?: string): void;
|
|
196
|
+
export declare function pinSession(sessionId: string, cwd?: string): void;
|
|
197
|
+
export declare function unpinSession(sessionId: string, cwd?: string): void;
|
|
198
|
+
export declare function categorizeSession(sessionId: string, category: string, cwd?: string): void;
|
|
199
|
+
export declare function autoLabel(session: {
|
|
200
|
+
name?: string;
|
|
201
|
+
}): string | null;
|
|
202
|
+
export declare function enrichSessions(sessions: ReplitSession[], cwd?: string): EnrichedSession[];
|
|
203
|
+
/**
|
|
204
|
+
* Ensure Claude and Codex are configured to retain session history indefinitely.
|
|
205
|
+
* Mirrors what replit-tools does to prevent session cleanup/deletion.
|
|
206
|
+
*/
|
|
207
|
+
export declare function ensurePersistence(cwd?: string): string[];
|
|
208
|
+
/**
|
|
209
|
+
* Append-only mirror sync for Claude/Codex sessions (matches what replit-tools does).
|
|
210
|
+
* Files in the mirror only grow — if the source deletes a session, the mirror still has it.
|
|
211
|
+
*/
|
|
212
|
+
export declare function syncSessionMirror(cwd?: string): {
|
|
213
|
+
copied: number;
|
|
214
|
+
grew: number;
|
|
215
|
+
disabled?: boolean;
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Generate a smart human-readable session name from session index data.
|
|
219
|
+
*
|
|
220
|
+
* Priority:
|
|
221
|
+
* 1. Dominant file pattern (e.g. auth*.mjs -> "Refactor Auth Module")
|
|
222
|
+
* 2. Top topics (e.g. ['auth','token','refresh'] -> "Auth Token Refresh")
|
|
223
|
+
* 3. Fallback: first prompt truncated to 40 chars
|
|
224
|
+
*
|
|
225
|
+
* Rules: <=40 chars, Title Case, no file extensions, action-prefixed when detectable.
|
|
226
|
+
*/
|
|
227
|
+
export declare function generateSmartName(sessionData: {
|
|
228
|
+
topics?: string[];
|
|
229
|
+
files?: string[];
|
|
230
|
+
prompts?: {
|
|
231
|
+
first?: string;
|
|
232
|
+
};
|
|
233
|
+
}): string;
|
|
234
|
+
/**
|
|
235
|
+
* Build/update `.dualbrain/session-index.json` from Claude and Codex JSONL session files.
|
|
236
|
+
* Extracts topics, file references, prompt snippets, and metadata per session.
|
|
237
|
+
*/
|
|
238
|
+
export declare function buildSessionIndex(cwd?: string): Record<string, SessionIndexEntry>;
|
|
239
|
+
/**
|
|
240
|
+
* Search sessions using the replit-tools archive as primary source.
|
|
241
|
+
* Falls back to the parallel session index when archive is unavailable.
|
|
242
|
+
*
|
|
243
|
+
* Results include: { sessionId, date, relevance, files, summary, matchingLines }
|
|
244
|
+
* Sorted by relevance * recencyMultiplier descending.
|
|
245
|
+
*/
|
|
246
|
+
export declare function searchSessions(query: string, cwd?: string): SessionSearchResult[];
|
|
247
|
+
/**
|
|
248
|
+
* Find sessions related to a new task prompt and file list.
|
|
249
|
+
* Uses the session index (topics + files) — does not parse full JSONL files.
|
|
250
|
+
*/
|
|
251
|
+
export declare function findRelatedSessions(prompt: string, files?: string[], cwd?: string): RelatedSession[];
|
|
252
|
+
/**
|
|
253
|
+
* Get detailed context for a session (for smart resume preview).
|
|
254
|
+
* Reads the last 20 lines of the session JSONL to surface the most recent prompt
|
|
255
|
+
* and files touched.
|
|
256
|
+
*/
|
|
257
|
+
export declare function getSessionContext(sessionId: string, cwd?: string): SessionContext | null;
|
|
258
|
+
/**
|
|
259
|
+
* Extract structured metadata from a session JSONL file.
|
|
260
|
+
* Reads the file once; handles malformed entries gracefully.
|
|
261
|
+
*/
|
|
262
|
+
export declare function extractSessionMeta(sessionFilePath: string): ExtractedSessionMeta;
|
|
263
|
+
/**
|
|
264
|
+
* Build routing context from recent sessions (last 7 days) related to a task.
|
|
265
|
+
* Used by the dispatch pipeline to detect prior attempts and flag risk signals.
|
|
266
|
+
*/
|
|
267
|
+
export declare function getRoutingContext(cwd: string, taskDescription: string): RoutingContext;
|