@causyne/agent 1.18.0 → 1.20.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/package.json +1 -1
- package/src/agentLoop.js +2348 -2531
- package/src/agentLoop.ts +2865 -0
- package/src/checkpoints.d.ts +4 -0
- package/src/cliMode.js +30 -17
- package/src/commands.js +307 -57
- package/src/config.js +22 -0
- package/src/contextManager.d.ts +10 -0
- package/src/continuum/adapters/antigravity.js +193 -0
- package/src/continuum/adapters/antigravity.ts +204 -0
- package/src/continuum/adapters/base.js +48 -0
- package/src/continuum/adapters/base.ts +57 -0
- package/src/continuum/adapters/causyne.js +66 -0
- package/src/continuum/adapters/causyne.ts +72 -0
- package/src/continuum/adapters/claudeCode.js +171 -0
- package/src/continuum/adapters/claudeCode.ts +179 -0
- package/src/continuum/adapters/codex.js +181 -0
- package/src/continuum/adapters/codex.ts +193 -0
- package/src/continuum/adapters/opencode.js +134 -0
- package/src/continuum/adapters/opencode.ts +153 -0
- package/src/continuum/compactor.js +54 -0
- package/src/continuum/compactor.ts +83 -0
- package/src/continuum/index.js +8 -0
- package/src/continuum/index.ts +9 -0
- package/src/continuum/ingest.js +63 -0
- package/src/continuum/ingest.ts +89 -0
- package/src/continuum/sanitizer.js +55 -0
- package/src/continuum/sanitizer.ts +59 -0
- package/src/continuum/scanner.js +86 -0
- package/src/continuum/scanner.ts +106 -0
- package/src/continuum/types.js +3 -0
- package/src/continuum/types.ts +51 -0
- package/src/continuum/ui/continuumPicker.js +111 -0
- package/src/continuum/ui/continuumPicker.ts +145 -0
- package/src/cortex/autoCondenser.d.ts +2 -0
- package/src/cortex/vectorDb.d.ts +1 -0
- package/src/designPalettes.d.ts +2 -0
- package/src/devMode.d.ts +1 -0
- package/src/dynamicCatalogue.js +5 -3
- package/src/dynamicCatalogue.ts +7 -4
- package/src/embodimentSession.d.ts +2 -0
- package/src/entrypoint.js +12 -0
- package/src/memory.d.ts +1 -0
- package/src/memoryManager.d.ts +1 -0
- package/src/memoryManager.js +10 -6
- package/src/modelIds.d.ts +2 -0
- package/src/outputStore.d.ts +4 -0
- package/src/providers/acp.js +320 -299
- package/src/providers/acp.ts +360 -0
- package/src/providers/antigravity.js +387 -278
- package/src/providers/antigravity.ts +450 -0
- package/src/providers/base.d.ts +68 -0
- package/src/providers/factory.d.ts +1 -0
- package/src/provisioning/capabilityProvisioner.d.ts +2 -0
- package/src/sandbox.d.ts +1 -0
- package/src/sessionJournal.js +14 -1
- package/src/sessionJournal.ts +21 -1
- package/src/skillsManager.d.ts +3 -0
- package/src/slopDetector.d.ts +3 -0
- package/src/taskBuffer.d.ts +1 -0
- package/src/tokenTracker.d.ts +1 -0
- package/src/toolPacks.d.ts +8 -0
- package/src/tools/registry.d.ts +4 -0
- package/src/tui/chatRenderer.js +148 -8
- package/src/tui/clipboardSync.js +36 -0
- package/src/tui/clipboardSync.ts +36 -0
- package/src/tui/dialogs.js +15 -2
- package/src/tui/home.js +2 -1
- package/src/tui/modelPicker.js +254 -0
- package/src/tui/modelPicker.ts +318 -0
- package/src/tui/prompt.js +90 -8
- package/src/tui/selectList.js +20 -0
- package/src/tui/sessionPicker.js +185 -0
- package/src/tui/sessionPicker.ts +259 -0
- package/src/tui/stageSurface.js +9 -0
- package/src/tui/statusLine.js +5 -5
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// Continuum TUI Picker: interactive modal dialog for browsing and adopting peer agent sessions.
|
|
2
|
+
// Authorship: Strict TypeScript (Causyne Agent).
|
|
3
|
+
|
|
4
|
+
// @ts-expect-error untyped local TUI dialogs
|
|
5
|
+
import { SelectLayer, TextLayer } from '../../tui/dialogs.js';
|
|
6
|
+
// @ts-expect-error untyped local TUI theme
|
|
7
|
+
import { GLYPHS } from '../../tui/theme.js';
|
|
8
|
+
import type { ContinuumSessionSummary } from '../types.js';
|
|
9
|
+
import { ContinuumScanner } from '../scanner.js';
|
|
10
|
+
import { adoptContinuumSession } from '../ingest.js';
|
|
11
|
+
|
|
12
|
+
function formatTimeAgo(timestamp: number): string {
|
|
13
|
+
const diffMs = Date.now() - timestamp;
|
|
14
|
+
const minutes = Math.floor(diffMs / (60 * 1000));
|
|
15
|
+
if (minutes < 60) return `${Math.max(1, minutes)}m ago`;
|
|
16
|
+
const hours = Math.floor(minutes / 60);
|
|
17
|
+
if (hours < 24) return `${hours}h ago`;
|
|
18
|
+
const days = Math.floor(hours / 24);
|
|
19
|
+
return `${days}d ago`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function buildContinuumItems(sessions: ContinuumSessionSummary[]) {
|
|
23
|
+
return sessions.map(s => {
|
|
24
|
+
const timeAgo = formatTimeAgo(s.updatedAt);
|
|
25
|
+
const ws = s.workspacePath ? s.workspacePath.split('/').pop() || s.workspacePath : '';
|
|
26
|
+
const desc = `${s.messageCount} msg${s.messageCount === 1 ? '' : 's'} ${GLYPHS.dot} ${timeAgo}${ws ? ` ${GLYPHS.dot} ${ws}` : ''}`;
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
label: s.title,
|
|
30
|
+
description: desc,
|
|
31
|
+
category: s.sourceLabel,
|
|
32
|
+
hint: s.sourceLabel,
|
|
33
|
+
searchText: `${s.sourceLabel} ${s.title} ${s.workspacePath} ${s.snippet}`,
|
|
34
|
+
value: s
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Launch the interactive Continuum session picker.
|
|
41
|
+
*/
|
|
42
|
+
export async function runInteractiveContinuum(
|
|
43
|
+
prompt: { openLayer: (layer: unknown) => void; closeLayer?: () => void },
|
|
44
|
+
options: {
|
|
45
|
+
scanner?: ContinuumScanner;
|
|
46
|
+
loop?: {
|
|
47
|
+
messages: Array<{ role: string; content?: unknown }>;
|
|
48
|
+
memoryManager?: {
|
|
49
|
+
useSession: (id: string) => unknown;
|
|
50
|
+
loadHistory?: () => Array<{ role: string; content?: unknown }>;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
} = {}
|
|
54
|
+
): Promise<string> {
|
|
55
|
+
const scanner = options.scanner || new ContinuumScanner();
|
|
56
|
+
const sessions = await scanner.scanAllSessions({ limit: 80 });
|
|
57
|
+
|
|
58
|
+
if (sessions.length === 0) {
|
|
59
|
+
return 'No peer agent sessions found across Antigravity, OpenCode, Codex, or Claude Code on this machine.';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const items = buildContinuumItems(sessions);
|
|
63
|
+
|
|
64
|
+
const pickedSession = await new Promise<ContinuumSessionSummary | null>((resolve) => {
|
|
65
|
+
const layer = new SelectLayer({
|
|
66
|
+
title: `Continuum · Cross-Agent Sessions (${sessions.length})`,
|
|
67
|
+
placeholder: 'search past agent conversations (antigravity, opencode, codex, claude)...',
|
|
68
|
+
emptyText: 'no matching sessions found',
|
|
69
|
+
width: 78,
|
|
70
|
+
height: 20,
|
|
71
|
+
footer: `enter adopt session ${GLYPHS.dot} esc cancel`,
|
|
72
|
+
items,
|
|
73
|
+
onPick: (item: { value: ContinuumSessionSummary } | null) => {
|
|
74
|
+
resolve(item ? item.value : null);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
prompt.openLayer(layer);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
if (!pickedSession) {
|
|
81
|
+
return 'Cancelled. Session was not changed.';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Ingest the chosen session
|
|
85
|
+
const adoptRes = await adoptContinuumSession(pickedSession.id, {
|
|
86
|
+
scanner,
|
|
87
|
+
currentLoopMessages: options.loop?.messages
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
if (!adoptRes.ok) {
|
|
91
|
+
return `Failed to adopt session: ${adoptRes.error}`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (options.loop) {
|
|
95
|
+
if (options.loop.memoryManager) {
|
|
96
|
+
options.loop.memoryManager.useSession(adoptRes.sessionId);
|
|
97
|
+
if (typeof options.loop.memoryManager.loadHistory === 'function') {
|
|
98
|
+
options.loop.messages = options.loop.memoryManager.loadHistory();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return `✓ Successfully adopted session "${adoptRes.title}" from ${adoptRes.sourcePlatform.toUpperCase()} (${adoptRes.messageCount} messages compacted).\n New active Causyne session: ${adoptRes.sessionId}. Continue working seamlessly.`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Open a preview text modal showing the full conversation transcript for a session.
|
|
108
|
+
*/
|
|
109
|
+
export async function openContinuumPreview(
|
|
110
|
+
sessionId: string,
|
|
111
|
+
prompt: { openLayer: (layer: unknown) => void },
|
|
112
|
+
scanner?: ContinuumScanner
|
|
113
|
+
): Promise<boolean> {
|
|
114
|
+
const sc = scanner || new ContinuumScanner();
|
|
115
|
+
const detail = await sc.fetchSession(sessionId);
|
|
116
|
+
|
|
117
|
+
if (!detail || !detail.messages) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const lines: string[] = [
|
|
122
|
+
`Source: ${detail.sourceLabel} · Messages: ${detail.messages.length} · Workspace: ${detail.workspacePath || '(default)'}`,
|
|
123
|
+
'─'.repeat(70),
|
|
124
|
+
''
|
|
125
|
+
];
|
|
126
|
+
|
|
127
|
+
for (const msg of detail.messages) {
|
|
128
|
+
const rolePrefix = msg.role === 'user' ? '👤 USER' : '🤖 ASSISTANT';
|
|
129
|
+
lines.push(`${rolePrefix}:`);
|
|
130
|
+
for (const textLine of msg.content.split('\n')) {
|
|
131
|
+
lines.push(` ${textLine}`);
|
|
132
|
+
}
|
|
133
|
+
lines.push('');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const layer = new TextLayer({
|
|
137
|
+
title: `Preview: ${detail.title}`,
|
|
138
|
+
lines,
|
|
139
|
+
width: 76,
|
|
140
|
+
height: 22
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
prompt.openLayer(layer);
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const cortexDb: any;
|
package/src/devMode.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function isDevEmulator(...args: any[]): any;
|
package/src/dynamicCatalogue.js
CHANGED
|
@@ -165,16 +165,18 @@ export function getAvailableProvidersOverview(config = {}) {
|
|
|
165
165
|
];
|
|
166
166
|
const byok = byokDefs.map((def) => {
|
|
167
167
|
const isCurrent = currentProvider === def.id || (def.id === 'qwen' && currentProvider === 'dashscope-byok');
|
|
168
|
-
const
|
|
169
|
-
|| Boolean(
|
|
168
|
+
const hasStoredKey = Boolean(isCurrent && config.apiKey)
|
|
169
|
+
|| Boolean(config.providerKeys && (config.providerKeys[def.id] || (def.id === 'qwen' && config.providerKeys['dashscope-byok'])))
|
|
170
170
|
|| Boolean(def.envVar && process.env[def.envVar]);
|
|
171
|
+
const isConfigured = def.id === 'ollama' || hasStoredKey;
|
|
171
172
|
return {
|
|
172
173
|
id: def.id,
|
|
173
174
|
label: def.label,
|
|
174
175
|
isConfigured,
|
|
175
176
|
isCurrent,
|
|
176
177
|
models: def.models,
|
|
177
|
-
defaultModel: def.defaultModel
|
|
178
|
+
defaultModel: def.defaultModel,
|
|
179
|
+
envVar: def.envVar
|
|
178
180
|
};
|
|
179
181
|
});
|
|
180
182
|
const acpPeers = [];
|
package/src/dynamicCatalogue.ts
CHANGED
|
@@ -111,6 +111,7 @@ export interface ByokProviderInfo {
|
|
|
111
111
|
isCurrent: boolean;
|
|
112
112
|
models: string[];
|
|
113
113
|
defaultModel: string;
|
|
114
|
+
envVar?: string | undefined;
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
export interface AcpPeerInfo {
|
|
@@ -137,7 +138,7 @@ export interface ProviderOverview {
|
|
|
137
138
|
* checking configured state for BYOK and installation status for ACP agents.
|
|
138
139
|
*/
|
|
139
140
|
export function getAvailableProvidersOverview(
|
|
140
|
-
config: { provider?: string; apiKey?: string; model?: string } = {}
|
|
141
|
+
config: { provider?: string; apiKey?: string; model?: string; providerKeys?: Record<string, string> } = {}
|
|
141
142
|
): ProviderOverview {
|
|
142
143
|
const currentProvider = config.provider || '';
|
|
143
144
|
const currentModel = config.model || '';
|
|
@@ -202,9 +203,10 @@ export function getAvailableProvidersOverview(
|
|
|
202
203
|
|
|
203
204
|
const byok: ByokProviderInfo[] = byokDefs.map((def) => {
|
|
204
205
|
const isCurrent = currentProvider === def.id || (def.id === 'qwen' && currentProvider === 'dashscope-byok');
|
|
205
|
-
const
|
|
206
|
-
|| Boolean(
|
|
206
|
+
const hasStoredKey = Boolean(isCurrent && config.apiKey)
|
|
207
|
+
|| Boolean(config.providerKeys && (config.providerKeys[def.id] || (def.id === 'qwen' && config.providerKeys['dashscope-byok'])))
|
|
207
208
|
|| Boolean(def.envVar && process.env[def.envVar]);
|
|
209
|
+
const isConfigured = def.id === 'ollama' || hasStoredKey;
|
|
208
210
|
|
|
209
211
|
return {
|
|
210
212
|
id: def.id,
|
|
@@ -212,7 +214,8 @@ export function getAvailableProvidersOverview(
|
|
|
212
214
|
isConfigured,
|
|
213
215
|
isCurrent,
|
|
214
216
|
models: def.models,
|
|
215
|
-
defaultModel: def.defaultModel
|
|
217
|
+
defaultModel: def.defaultModel,
|
|
218
|
+
envVar: def.envVar
|
|
216
219
|
};
|
|
217
220
|
});
|
|
218
221
|
|
package/src/entrypoint.js
CHANGED
|
@@ -198,6 +198,18 @@ program
|
|
|
198
198
|
process.exit(result.ok ? 0 : 1);
|
|
199
199
|
});
|
|
200
200
|
|
|
201
|
+
program
|
|
202
|
+
.command('continuum [action] [args...]')
|
|
203
|
+
.alias('resume')
|
|
204
|
+
.description('Cross-agent session extraction & resumption (Antigravity, OpenCode, Codex, Claude Code)')
|
|
205
|
+
.allowUnknownOption()
|
|
206
|
+
.action(async (action, args) => {
|
|
207
|
+
const argv = action ? [action, ...(args || [])] : [];
|
|
208
|
+
const result = await runCommand('continuum', argv, { surface: 'terminal' });
|
|
209
|
+
console.log('\n' + (result.output || '') + '\n');
|
|
210
|
+
process.exit(result.ok ? 0 : 1);
|
|
211
|
+
});
|
|
212
|
+
|
|
201
213
|
program
|
|
202
214
|
.command('exec <command>')
|
|
203
215
|
.description('Quick execute a command using the agent terminal')
|
package/src/memory.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getMemoryContextString(...args: any[]): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const MemoryManager: any;
|
package/src/memoryManager.js
CHANGED
|
@@ -30,7 +30,7 @@ export class MemoryManager {
|
|
|
30
30
|
* directory — so typing continue in a new project resumed a conversation
|
|
31
31
|
* from a different one, months old. See src/sessionStore.js.
|
|
32
32
|
*/
|
|
33
|
-
constructor(workspace = process.cwd(), sessionId = null) {
|
|
33
|
+
constructor(workspace = process.cwd(), sessionId = null, options = {}) {
|
|
34
34
|
this.ensureMemoryDir();
|
|
35
35
|
this.workspace = workspace;
|
|
36
36
|
if (sessionId) {
|
|
@@ -38,7 +38,7 @@ export class MemoryManager {
|
|
|
38
38
|
// resolveSession(), which could silently attach it to a different chat.
|
|
39
39
|
this.session = getSession(sessionId) || createSession(workspace, 'Untitled', false);
|
|
40
40
|
} else {
|
|
41
|
-
this.session = resolveSession(workspace);
|
|
41
|
+
this.session = resolveSession(workspace, options);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -47,8 +47,8 @@ export class MemoryManager {
|
|
|
47
47
|
get sessionTitle() { return this.session ? this.session.title : ''; }
|
|
48
48
|
|
|
49
49
|
/** Abandon this conversation and open a clean one in the same workspace. */
|
|
50
|
-
startNewSession() {
|
|
51
|
-
this.session = createSession(this.workspace);
|
|
50
|
+
startNewSession(title = 'Untitled') {
|
|
51
|
+
this.session = createSession(this.workspace, title, true);
|
|
52
52
|
return this.session;
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -67,8 +67,12 @@ export class MemoryManager {
|
|
|
67
67
|
|
|
68
68
|
loadHistory() {
|
|
69
69
|
if (!this.session || !Array.isArray(this.session.messages)) return [];
|
|
70
|
-
//
|
|
71
|
-
return this.session.messages.filter(m =>
|
|
70
|
+
// Return conversation messages. Preserve Continuum context blocks, drop stale default system prompts.
|
|
71
|
+
return this.session.messages.filter(m => {
|
|
72
|
+
if (m.role !== 'system') return true;
|
|
73
|
+
if (typeof m.content === 'string' && m.content.startsWith('[Continuum')) return true;
|
|
74
|
+
return false;
|
|
75
|
+
});
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
|