@causyne/agent 1.20.0 → 1.20.5
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 +0 -18
- package/package.json +1 -1
- package/src/acp/client.js +2 -1
- package/src/acp/client.ts +2 -1
- package/src/acp/server.js +5 -6
- package/src/acp/server.ts +4 -6
- package/src/agentLoop.d.ts +1 -0
- package/src/agentLoop.js +505 -241
- package/src/agentLoop.ts +527 -258
- package/src/agentPolicy.js +9 -0
- package/src/agentPolicy.ts +9 -0
- package/src/approvalPolicy.js +55 -0
- package/src/approvalPolicy.ts +66 -0
- package/src/browser/browserRuntime.js +217 -14
- package/src/browser/browserRuntime.ts +255 -14
- package/src/browser/causyneBrowser.js +1215 -68
- package/src/browser/causyneBrowser.ts +1340 -72
- package/src/cliMode.js +52 -29
- package/src/commands.js +141 -17
- package/src/config.js +22 -12
- package/src/continuum/ui/continuumPicker.js +18 -1
- package/src/continuum/ui/continuumPicker.ts +19 -1
- package/src/dynamicCatalogue.js +87 -20
- package/src/dynamicCatalogue.ts +85 -15
- package/src/launchIntent.js +40 -0
- package/src/launchIntent.ts +49 -0
- package/src/memoryManager.js +26 -2
- package/src/modelCatalogue.js +2 -0
- package/src/planCache.js +320 -11
- package/src/planCache.ts +402 -13
- package/src/providers/acp.js +67 -1
- package/src/providers/acp.ts +65 -2
- package/src/providers/antigravity.d.ts +5 -1
- package/src/providers/antigravity.js +643 -32
- package/src/providers/antigravity.ts +671 -33
- package/src/providers/base.d.ts +9 -0
- package/src/providers/factory.js +2 -0
- package/src/providers/pi.js +157 -0
- package/src/providers/pi.ts +144 -0
- package/src/provisioning/capabilityProvisioner.js +17 -0
- package/src/provisioning/capabilityTools.js +1 -1
- package/src/sandbox.js +30 -39
- package/src/sessionJournal.js +53 -10
- package/src/sessionJournal.ts +64 -10
- package/src/taskShape.js +9 -9
- package/src/taskShape.ts +9 -9
- package/src/timeMachine.js +124 -0
- package/src/timeMachine.ts +141 -0
- package/src/toolPacks.js +4 -10
- package/src/tools/archive.js +196 -59
- package/src/tools/archive.ts +220 -0
- package/src/tools/browserAutomator.js +78 -9
- package/src/tools/browserAutomator.ts +90 -9
- package/src/tools/desktopOpen.js +114 -31
- package/src/tools/desktopOpen.ts +144 -0
- package/src/tools/gitExec.js +5 -3
- package/src/tools/nativeEngine.js +4 -3
- package/src/tools/nativeEngine.ts +5 -3
- package/src/tools/openSourceToolProvisioner.js +5 -4
- package/src/tools/openSourceToolProvisioner.ts +5 -4
- package/src/tools/registry.js +3 -0
- package/src/tools/screenshot.js +55 -71
- package/src/tools/screenshot.ts +70 -0
- package/src/tools/sysRun.js +284 -117
- package/src/tools/sysRun.ts +347 -0
- package/src/tools/toolSelfRepair.js +109 -2
- package/src/tools/toolSelfRepair.ts +100 -2
- package/src/tools/updatePlan.js +49 -1
- package/src/tools/updatePlan.ts +43 -1
- package/src/tools/viewImage.js +93 -78
- package/src/tools/viewImage.ts +116 -0
- package/src/tools/webFetch.js +20 -6
- package/src/tools/webFetch.ts +26 -6
- package/src/tui/block.d.ts +1 -0
- package/src/tui/chatRenderer.d.ts +21 -0
- package/src/tui/chatRenderer.js +34 -47
- package/src/tui/clipboardSync.js +28 -1
- package/src/tui/clipboardSync.ts +26 -1
- package/src/tui/codeProgress.js +299 -0
- package/src/tui/codeProgress.ts +304 -0
- package/src/tui/codeStreamRenderer.js +116 -0
- package/src/tui/codeStreamRenderer.ts +124 -0
- package/src/tui/commandPresentation.js +11 -0
- package/src/tui/commandPresentation.ts +18 -0
- package/src/tui/completion.js +45 -13
- package/src/tui/composerControls.js +66 -0
- package/src/tui/composerControls.ts +78 -0
- package/src/tui/diff.d.ts +2 -0
- package/src/tui/home.js +4 -2
- package/src/tui/homeTransition.js +21 -0
- package/src/tui/homeTransition.ts +27 -0
- package/src/tui/homeView.js +62 -0
- package/src/tui/homeView.ts +91 -0
- package/src/tui/layout.js +46 -0
- package/src/tui/layout.ts +52 -0
- package/src/tui/messageActionPlacement.js +16 -0
- package/src/tui/messageActionPlacement.ts +25 -0
- package/src/tui/messageInteraction.js +221 -0
- package/src/tui/messageInteraction.ts +275 -0
- package/src/tui/modelPicker.js +4 -24
- package/src/tui/modelPicker.ts +4 -20
- package/src/tui/mouseHover.js +6 -0
- package/src/tui/mouseHover.ts +5 -0
- package/src/tui/prompt.js +152 -76
- package/src/tui/resizeRecovery.js +15 -0
- package/src/tui/resizeRecovery.ts +27 -0
- package/src/tui/scrollInteraction.js +97 -0
- package/src/tui/scrollInteraction.ts +189 -0
- package/src/tui/sessionLayout.js +12 -0
- package/src/tui/sessionLayout.ts +12 -0
- package/src/tui/sessionPicker.js +111 -16
- package/src/tui/sessionPicker.ts +121 -16
- package/src/tui/sessionSidebar.js +78 -0
- package/src/tui/sessionSidebar.ts +95 -0
- package/src/tui/setup.js +1 -1
- package/src/tui/setup.ts +1 -1
- package/src/tui/stageSurface.js +120 -58
- package/src/tui/text.d.ts +5 -0
- package/src/tui/textLayout.js +23 -0
- package/src/tui/textLayout.ts +28 -0
- package/src/tui/viewport.js +204 -279
- package/src/tui/viewport.ts +326 -0
- package/src/types/contracts.ts +54 -0
- package/src/utils/paths.js +5 -4
- package/src/utils/paths.ts +5 -5
package/src/dynamicCatalogue.js
CHANGED
|
@@ -15,7 +15,7 @@ import { execFile } from 'node:child_process';
|
|
|
15
15
|
import { promisify } from 'node:util';
|
|
16
16
|
import { causyneHome } from './utils/paths.js';
|
|
17
17
|
import { MODEL_CATALOGUE, PEER_MODEL_CATALOGUE, DEFAULT_MODEL_BY_PROVIDER } from './modelCatalogue.js';
|
|
18
|
-
import { ANTIGRAVITY_MODELS, ANTIGRAVITY_LABEL_BY_ID, resolveAgyBinary } from './providers/antigravity.js';
|
|
18
|
+
import { ANTIGRAVITY_MODELS, ANTIGRAVITY_LABEL_BY_ID, registerAntigravityModel, parseAgyModelsOutput, resolveAgyBinary } from './providers/antigravity.js';
|
|
19
19
|
import { isBinaryOnPath, BUILTIN_PEER_PRESETS } from './acp/agentCatalog.js';
|
|
20
20
|
const execFileAsync = promisify(execFile);
|
|
21
21
|
const CACHE_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours
|
|
@@ -75,6 +75,8 @@ export function getCuratedModels(provider) {
|
|
|
75
75
|
const norm = normalizeProviderKey(provider);
|
|
76
76
|
if (norm === 'antigravity')
|
|
77
77
|
return [...ANTIGRAVITY_MODELS];
|
|
78
|
+
if (norm === 'pi')
|
|
79
|
+
return [...(MODEL_CATALOGUE['Pi (Local Peer)'] || [])];
|
|
78
80
|
const peer = peerIdFromProviderKey(norm);
|
|
79
81
|
if (peer)
|
|
80
82
|
return [...(PEER_MODEL_CATALOGUE[peer] ?? [])];
|
|
@@ -193,6 +195,14 @@ export function getAvailableProvidersOverview(config = {}) {
|
|
|
193
195
|
models: [...ANTIGRAVITY_MODELS],
|
|
194
196
|
setupInstruction: 'Install Antigravity IDE or agy CLI to enable Google AGY models.'
|
|
195
197
|
});
|
|
198
|
+
const hasPi = isBinaryOnPath('pi');
|
|
199
|
+
acpPeers.push({
|
|
200
|
+
id: 'pi', providerKey: 'pi', label: 'Pi coding agent',
|
|
201
|
+
installed: hasPi, status: hasPi ? 'ready' : 'not_installed',
|
|
202
|
+
isCurrent: currentProvider === 'pi', command: 'pi --mode rpc --no-tools',
|
|
203
|
+
models: ['default'],
|
|
204
|
+
setupInstruction: 'Install Pi CLI and configure its model login before selecting it in Causyne.'
|
|
205
|
+
});
|
|
196
206
|
// Standard ACP presets
|
|
197
207
|
const presetOrder = ['opencode', 'claude', 'codex', 'gemini', 'cursor', 'hermes', 'qwen', 'copilot', 'kimi', 'goose'];
|
|
198
208
|
for (const presetId of presetOrder) {
|
|
@@ -208,8 +218,15 @@ export function getAvailableProvidersOverview(config = {}) {
|
|
|
208
218
|
}
|
|
209
219
|
const providerKey = `acp/${preset.id}`;
|
|
210
220
|
const isCurrent = currentProvider === providerKey;
|
|
221
|
+
const cachedPeerModels = getCachedModels(providerKey) || getCachedModels(preset.id);
|
|
211
222
|
let models = [];
|
|
212
|
-
if (
|
|
223
|
+
if (cachedPeerModels && cachedPeerModels.length > 0) {
|
|
224
|
+
models = [...cachedPeerModels];
|
|
225
|
+
}
|
|
226
|
+
else if (preset.id === 'claude') {
|
|
227
|
+
models = detectClaudeModels();
|
|
228
|
+
}
|
|
229
|
+
else if (PEER_MODEL_CATALOGUE[preset.id]) {
|
|
213
230
|
models = [...(PEER_MODEL_CATALOGUE[preset.id] || [])];
|
|
214
231
|
}
|
|
215
232
|
else if (DEFAULT_MODEL_BY_PROVIDER[providerKey]) {
|
|
@@ -258,15 +275,52 @@ async function runModelList(command, args) {
|
|
|
258
275
|
}
|
|
259
276
|
function parseModelIds(lines) {
|
|
260
277
|
const models = [];
|
|
261
|
-
for (const
|
|
278
|
+
for (const rawLine of lines) {
|
|
279
|
+
const line = rawLine.replace(ANSI_ESCAPE, '').trim();
|
|
280
|
+
if (!line)
|
|
281
|
+
continue;
|
|
262
282
|
if (/^(fetching|loading|no models|error)/i.test(line))
|
|
263
283
|
continue;
|
|
264
284
|
if (line.endsWith('…') || line.endsWith('...'))
|
|
265
285
|
continue;
|
|
266
|
-
const
|
|
267
|
-
if (
|
|
268
|
-
|
|
269
|
-
|
|
286
|
+
const match = line.match(/^([a-z0-9_./-]+)/i);
|
|
287
|
+
if (match && match[1]) {
|
|
288
|
+
models.push(match[1]);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return [...new Set(models)];
|
|
292
|
+
}
|
|
293
|
+
function detectClaudeModels() {
|
|
294
|
+
const models = [];
|
|
295
|
+
try {
|
|
296
|
+
const home = process.env.HOME || process.env.USERPROFILE || '';
|
|
297
|
+
if (home) {
|
|
298
|
+
const settingsFile = path.join(home, '.claude', 'settings.json');
|
|
299
|
+
if (fs.existsSync(settingsFile)) {
|
|
300
|
+
const content = fs.readFileSync(settingsFile, 'utf8');
|
|
301
|
+
const parsed = JSON.parse(content);
|
|
302
|
+
if (typeof parsed?.model === 'string' && parsed.model.trim()) {
|
|
303
|
+
models.push(parsed.model.trim());
|
|
304
|
+
}
|
|
305
|
+
if (Array.isArray(parsed?.availableModels)) {
|
|
306
|
+
for (const m of parsed.availableModels) {
|
|
307
|
+
if (typeof m === 'string' && m.trim())
|
|
308
|
+
models.push(m.trim());
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
catch {
|
|
315
|
+
// Ignore settings read errors
|
|
316
|
+
}
|
|
317
|
+
const envModel = process.env.ANTHROPIC_MODEL || process.env.CLAUDE_MODEL;
|
|
318
|
+
if (envModel && typeof envModel === 'string' && envModel.trim()) {
|
|
319
|
+
models.push(envModel.trim());
|
|
320
|
+
}
|
|
321
|
+
const curated = PEER_MODEL_CATALOGUE['claude'] ?? ['sonnet', 'opus', 'haiku'];
|
|
322
|
+
for (const m of curated) {
|
|
323
|
+
models.push(m);
|
|
270
324
|
}
|
|
271
325
|
return [...new Set(models)];
|
|
272
326
|
}
|
|
@@ -276,24 +330,37 @@ function parseModelIds(lines) {
|
|
|
276
330
|
*/
|
|
277
331
|
export async function discoverPeerModels(peerId) {
|
|
278
332
|
const peer = (peerId || '').toLowerCase().trim();
|
|
333
|
+
if (peer === 'claude') {
|
|
334
|
+
return detectClaudeModels();
|
|
335
|
+
}
|
|
279
336
|
const listing = PEER_MODEL_COMMANDS[peer];
|
|
280
|
-
if (
|
|
281
|
-
|
|
282
|
-
|
|
337
|
+
if (listing) {
|
|
338
|
+
const discovered = parseModelIds(await runModelList(listing.command, listing.args));
|
|
339
|
+
if (discovered.length > 0)
|
|
340
|
+
return discovered;
|
|
341
|
+
}
|
|
342
|
+
return PEER_MODEL_CATALOGUE[peer] ? [...PEER_MODEL_CATALOGUE[peer]] : [];
|
|
283
343
|
}
|
|
284
344
|
/** Ask Antigravity for its live model list and return the readable labels. */
|
|
285
345
|
export async function discoverAntigravityModels() {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
346
|
+
try {
|
|
347
|
+
const { stdout } = await execFileAsync(resolveAgyBinary(), ['models'], {
|
|
348
|
+
timeout: MODEL_LIST_TIMEOUT_MS,
|
|
349
|
+
maxBuffer: 4 * 1024 * 1024,
|
|
350
|
+
windowsHide: true
|
|
351
|
+
});
|
|
352
|
+
const parsed = parseAgyModelsOutput(stdout);
|
|
353
|
+
if (parsed.length > 0) {
|
|
354
|
+
for (const item of parsed) {
|
|
355
|
+
registerAntigravityModel(item.id, item.label);
|
|
356
|
+
}
|
|
357
|
+
return [...new Set(parsed.map((item) => item.label || item.id))];
|
|
358
|
+
}
|
|
295
359
|
}
|
|
296
|
-
|
|
360
|
+
catch {
|
|
361
|
+
// Fall back to current registered or baseline models
|
|
362
|
+
}
|
|
363
|
+
return [...ANTIGRAVITY_MODELS];
|
|
297
364
|
}
|
|
298
365
|
/** Read cache safely from ~/.causyne/models_cache.json */
|
|
299
366
|
export function readModelCache() {
|
package/src/dynamicCatalogue.ts
CHANGED
|
@@ -19,6 +19,8 @@ import { MODEL_CATALOGUE, PEER_MODEL_CATALOGUE, DEFAULT_MODEL_BY_PROVIDER } from
|
|
|
19
19
|
import {
|
|
20
20
|
ANTIGRAVITY_MODELS,
|
|
21
21
|
ANTIGRAVITY_LABEL_BY_ID,
|
|
22
|
+
registerAntigravityModel,
|
|
23
|
+
parseAgyModelsOutput,
|
|
22
24
|
resolveAgyBinary
|
|
23
25
|
} from './providers/antigravity.js';
|
|
24
26
|
import { isBinaryOnPath, BUILTIN_PEER_PRESETS } from './acp/agentCatalog.js';
|
|
@@ -81,6 +83,7 @@ export function peerIdFromProviderKey(provider: string): string | null {
|
|
|
81
83
|
export function getCuratedModels(provider: string): string[] {
|
|
82
84
|
const norm = normalizeProviderKey(provider);
|
|
83
85
|
if (norm === 'antigravity') return [...ANTIGRAVITY_MODELS];
|
|
86
|
+
if (norm === 'pi') return [...(MODEL_CATALOGUE['Pi (Local Peer)'] || [])];
|
|
84
87
|
const peer = peerIdFromProviderKey(norm);
|
|
85
88
|
if (peer) return [...(PEER_MODEL_CATALOGUE[peer] ?? [])];
|
|
86
89
|
if (norm === 'acp') return [...(MODEL_CATALOGUE['ACP (Peer Agents)'] ?? [])];
|
|
@@ -235,6 +238,15 @@ export function getAvailableProvidersOverview(
|
|
|
235
238
|
setupInstruction: 'Install Antigravity IDE or agy CLI to enable Google AGY models.'
|
|
236
239
|
});
|
|
237
240
|
|
|
241
|
+
const hasPi = isBinaryOnPath('pi');
|
|
242
|
+
acpPeers.push({
|
|
243
|
+
id: 'pi', providerKey: 'pi', label: 'Pi coding agent',
|
|
244
|
+
installed: hasPi, status: hasPi ? 'ready' : 'not_installed',
|
|
245
|
+
isCurrent: currentProvider === 'pi', command: 'pi --mode rpc --no-tools',
|
|
246
|
+
models: ['default'],
|
|
247
|
+
setupInstruction: 'Install Pi CLI and configure its model login before selecting it in Causyne.'
|
|
248
|
+
});
|
|
249
|
+
|
|
238
250
|
// Standard ACP presets
|
|
239
251
|
const presetOrder = ['opencode', 'claude', 'codex', 'gemini', 'cursor', 'hermes', 'qwen', 'copilot', 'kimi', 'goose'];
|
|
240
252
|
for (const presetId of presetOrder) {
|
|
@@ -251,8 +263,13 @@ export function getAvailableProvidersOverview(
|
|
|
251
263
|
const providerKey = `acp/${preset.id}`;
|
|
252
264
|
const isCurrent = currentProvider === providerKey;
|
|
253
265
|
|
|
266
|
+
const cachedPeerModels = getCachedModels(providerKey) || getCachedModels(preset.id);
|
|
254
267
|
let models: string[] = [];
|
|
255
|
-
if (
|
|
268
|
+
if (cachedPeerModels && cachedPeerModels.length > 0) {
|
|
269
|
+
models = [...cachedPeerModels];
|
|
270
|
+
} else if (preset.id === 'claude') {
|
|
271
|
+
models = detectClaudeModels();
|
|
272
|
+
} else if (PEER_MODEL_CATALOGUE[preset.id]) {
|
|
256
273
|
models = [...(PEER_MODEL_CATALOGUE[preset.id] || [])];
|
|
257
274
|
} else if (DEFAULT_MODEL_BY_PROVIDER[providerKey]) {
|
|
258
275
|
models = [DEFAULT_MODEL_BY_PROVIDER[providerKey]];
|
|
@@ -304,38 +321,91 @@ async function runModelList(command: string, args: string[]): Promise<string[]>
|
|
|
304
321
|
|
|
305
322
|
function parseModelIds(lines: string[]): string[] {
|
|
306
323
|
const models: string[] = [];
|
|
307
|
-
for (const
|
|
324
|
+
for (const rawLine of lines) {
|
|
325
|
+
const line = rawLine.replace(ANSI_ESCAPE, '').trim();
|
|
326
|
+
if (!line) continue;
|
|
308
327
|
if (/^(fetching|loading|no models|error)/i.test(line)) continue;
|
|
309
328
|
if (line.endsWith('…') || line.endsWith('...')) continue;
|
|
310
|
-
const
|
|
311
|
-
if (
|
|
312
|
-
|
|
329
|
+
const match = line.match(/^([a-z0-9_./-]+)/i);
|
|
330
|
+
if (match && match[1]) {
|
|
331
|
+
models.push(match[1]);
|
|
332
|
+
}
|
|
313
333
|
}
|
|
314
334
|
return [...new Set(models)];
|
|
315
335
|
}
|
|
316
336
|
|
|
337
|
+
function detectClaudeModels(): string[] {
|
|
338
|
+
const models: string[] = [];
|
|
339
|
+
try {
|
|
340
|
+
const home = process.env.HOME || process.env.USERPROFILE || '';
|
|
341
|
+
if (home) {
|
|
342
|
+
const settingsFile = path.join(home, '.claude', 'settings.json');
|
|
343
|
+
if (fs.existsSync(settingsFile)) {
|
|
344
|
+
const content = fs.readFileSync(settingsFile, 'utf8');
|
|
345
|
+
const parsed = JSON.parse(content) as { model?: string; availableModels?: string[] };
|
|
346
|
+
if (typeof parsed?.model === 'string' && parsed.model.trim()) {
|
|
347
|
+
models.push(parsed.model.trim());
|
|
348
|
+
}
|
|
349
|
+
if (Array.isArray(parsed?.availableModels)) {
|
|
350
|
+
for (const m of parsed.availableModels) {
|
|
351
|
+
if (typeof m === 'string' && m.trim()) models.push(m.trim());
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
} catch {
|
|
357
|
+
// Ignore settings read errors
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
const envModel = process.env.ANTHROPIC_MODEL || process.env.CLAUDE_MODEL;
|
|
361
|
+
if (envModel && typeof envModel === 'string' && envModel.trim()) {
|
|
362
|
+
models.push(envModel.trim());
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
const curated = PEER_MODEL_CATALOGUE['claude'] ?? ['sonnet', 'opus', 'haiku'];
|
|
366
|
+
for (const m of curated) {
|
|
367
|
+
models.push(m);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
return [...new Set(models)];
|
|
371
|
+
}
|
|
372
|
+
|
|
317
373
|
/**
|
|
318
374
|
* Ask a peer CLI which models its account can reach. Zero tokens: this runs the
|
|
319
375
|
* peer's own listing command, never a model request.
|
|
320
376
|
*/
|
|
321
377
|
export async function discoverPeerModels(peerId: string): Promise<string[]> {
|
|
322
378
|
const peer = (peerId || '').toLowerCase().trim();
|
|
379
|
+
if (peer === 'claude') {
|
|
380
|
+
return detectClaudeModels();
|
|
381
|
+
}
|
|
323
382
|
const listing = PEER_MODEL_COMMANDS[peer];
|
|
324
|
-
if (
|
|
325
|
-
|
|
383
|
+
if (listing) {
|
|
384
|
+
const discovered = parseModelIds(await runModelList(listing.command, listing.args));
|
|
385
|
+
if (discovered.length > 0) return discovered;
|
|
386
|
+
}
|
|
387
|
+
return PEER_MODEL_CATALOGUE[peer] ? [...PEER_MODEL_CATALOGUE[peer]] : [];
|
|
326
388
|
}
|
|
327
389
|
|
|
328
390
|
/** Ask Antigravity for its live model list and return the readable labels. */
|
|
329
391
|
export async function discoverAntigravityModels(): Promise<string[]> {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
392
|
+
try {
|
|
393
|
+
const { stdout } = await execFileAsync(resolveAgyBinary(), ['models'], {
|
|
394
|
+
timeout: MODEL_LIST_TIMEOUT_MS,
|
|
395
|
+
maxBuffer: 4 * 1024 * 1024,
|
|
396
|
+
windowsHide: true
|
|
397
|
+
});
|
|
398
|
+
const parsed = parseAgyModelsOutput(stdout);
|
|
399
|
+
if (parsed.length > 0) {
|
|
400
|
+
for (const item of parsed) {
|
|
401
|
+
registerAntigravityModel(item.id, item.label);
|
|
402
|
+
}
|
|
403
|
+
return [...new Set(parsed.map((item) => item.label || item.id))];
|
|
404
|
+
}
|
|
405
|
+
} catch {
|
|
406
|
+
// Fall back to current registered or baseline models
|
|
337
407
|
}
|
|
338
|
-
return [...
|
|
408
|
+
return [...ANTIGRAVITY_MODELS];
|
|
339
409
|
}
|
|
340
410
|
|
|
341
411
|
/** Read cache safely from ~/.causyne/models_cache.json */
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const LAUNCH_VERBS = /\b(open|launch|start|run|play|serve|preview|buka|jalankan|mainkan|pratinjau)\b/i;
|
|
2
|
+
const CHANGE_VERBS = /\b(create|build|make|write|edit|fix|modify|change|update|implement|generate|refactor|delete|remove|install|deploy|buat|bangun|tulis|ubah|perbaiki|hapus|pasang)\b/i;
|
|
3
|
+
const SERVER_COMMAND = /^\s*(?:python(?:3(?:\.\d+)?)?\s+(?:-u\s+)?(?:\S*\/)?server\.py\b|python(?:3(?:\.\d+)?)?\s+-m\s+http\.server\b|(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?(?:dev|start|serve)\b|(?:npx|bunx)\s+(?:vite|next\s+dev|http-server)\b|uvicorn\b|gunicorn\b|flask\s+run\b)/i;
|
|
4
|
+
const READ_ONLY_COMMAND = /^\s*(?:pwd|ls|rg|grep|cat|head|tail|find|which|where|ps|pgrep|lsof|netstat|ss|git\s+(?:status|diff|log|show)|node\s+(?:-v|--version)|python(?:3(?:\.\d+)?)?\s+(?:-V|--version))\b/i;
|
|
5
|
+
const OPEN_COMMAND = /^\s*(?:open|xdg-open|start)\s+\S+/i;
|
|
6
|
+
const LOCAL_HEALTH_CHECK = /^\s*curl\s+(?:(?:-I|-s|-S|-f|--head|--silent|--show-error|--fail|--max-time\s+\d+)\s+)*https?:\/\/(?:localhost|127\.0\.0\.1):\d+(?:\/\S*)?\s*$/i;
|
|
7
|
+
const PORT_CLEANUP_COMMAND = /^\s*(?:pkill|kill|fuser)\b/i;
|
|
8
|
+
const MUTATION_TOOLS = new Set([
|
|
9
|
+
'fs_write', 'fs_edit', 'fs_delete', 'fs_move',
|
|
10
|
+
'multi_edit', 'MultiEdit', 'edit_file', 'write_to_file', 'delete_file',
|
|
11
|
+
'create_skill', 'manage_local_dependencies'
|
|
12
|
+
]);
|
|
13
|
+
export function isLaunchOnlyPrompt(prompt) {
|
|
14
|
+
if (/\b(?:run|jalankan)\s+(?:the\s+)?(?:tests?|checks?|lint|benchmarks?|scripts?|commands?)\b/i.test(prompt))
|
|
15
|
+
return false;
|
|
16
|
+
return LAUNCH_VERBS.test(prompt) && !CHANGE_VERBS.test(prompt);
|
|
17
|
+
}
|
|
18
|
+
export function isServerLaunchCommand(command) {
|
|
19
|
+
return SERVER_COMMAND.test(command.trim());
|
|
20
|
+
}
|
|
21
|
+
/** A launch-only request authorizes inspection, starting the app, and opening it. */
|
|
22
|
+
export function launchScopeError(tool, args) {
|
|
23
|
+
if (MUTATION_TOOLS.has(tool)) {
|
|
24
|
+
return 'The user asked to open the existing project, not change its files or configuration.';
|
|
25
|
+
}
|
|
26
|
+
if (tool === 'sysRun' || tool === 'sysRunBg' || tool === 'terminal_persistent_shell') {
|
|
27
|
+
const command = String(args.command ?? args.input ?? '').trim();
|
|
28
|
+
if (OPEN_COMMAND.test(command) || isServerLaunchCommand(command) || LOCAL_HEALTH_CHECK.test(command) || PORT_CLEANUP_COMMAND.test(command)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
if (/[;&|><`$()]/.test(command)) {
|
|
32
|
+
return 'A launch-only request does not authorize chained shell commands. Use one scoped command per tool call.';
|
|
33
|
+
}
|
|
34
|
+
if (READ_ONLY_COMMAND.test(command)) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return 'The user asked to open the existing project. Use read-only inspection, a background server, or desktop.open; do not run unrelated commands.';
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const LAUNCH_VERBS = /\b(open|launch|start|run|play|serve|preview|buka|jalankan|mainkan|pratinjau)\b/i;
|
|
2
|
+
const CHANGE_VERBS = /\b(create|build|make|write|edit|fix|modify|change|update|implement|generate|refactor|delete|remove|install|deploy|buat|bangun|tulis|ubah|perbaiki|hapus|pasang)\b/i;
|
|
3
|
+
const SERVER_COMMAND = /^\s*(?:python(?:3(?:\.\d+)?)?\s+(?:-u\s+)?(?:\S*\/)?server\.py\b|python(?:3(?:\.\d+)?)?\s+-m\s+http\.server\b|(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?(?:dev|start|serve)\b|(?:npx|bunx)\s+(?:vite|next\s+dev|http-server)\b|uvicorn\b|gunicorn\b|flask\s+run\b)/i;
|
|
4
|
+
const READ_ONLY_COMMAND = /^\s*(?:pwd|ls|rg|grep|cat|head|tail|find|which|where|ps|pgrep|lsof|netstat|ss|git\s+(?:status|diff|log|show)|node\s+(?:-v|--version)|python(?:3(?:\.\d+)?)?\s+(?:-V|--version))\b/i;
|
|
5
|
+
const OPEN_COMMAND = /^\s*(?:open|xdg-open|start)\s+\S+/i;
|
|
6
|
+
const LOCAL_HEALTH_CHECK = /^\s*curl\s+(?:(?:-I|-s|-S|-f|--head|--silent|--show-error|--fail|--max-time\s+\d+)\s+)*https?:\/\/(?:localhost|127\.0\.0\.1):\d+(?:\/\S*)?\s*$/i;
|
|
7
|
+
const PORT_CLEANUP_COMMAND = /^\s*(?:pkill|kill|fuser)\b/i;
|
|
8
|
+
|
|
9
|
+
const MUTATION_TOOLS = new Set([
|
|
10
|
+
'fs_write', 'fs_edit', 'fs_delete', 'fs_move',
|
|
11
|
+
'multi_edit', 'MultiEdit', 'edit_file', 'write_to_file', 'delete_file',
|
|
12
|
+
'create_skill', 'manage_local_dependencies'
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
export function isLaunchOnlyPrompt(prompt: string): boolean {
|
|
16
|
+
if (/\b(?:run|jalankan)\s+(?:the\s+)?(?:tests?|checks?|lint|benchmarks?|scripts?|commands?)\b/i.test(prompt)) return false;
|
|
17
|
+
return LAUNCH_VERBS.test(prompt) && !CHANGE_VERBS.test(prompt);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function isServerLaunchCommand(command: string): boolean {
|
|
21
|
+
return SERVER_COMMAND.test(command.trim());
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** A launch-only request authorizes inspection, starting the app, and opening it. */
|
|
25
|
+
export function launchScopeError(tool: string, args: Record<string, unknown>): string | null {
|
|
26
|
+
if (MUTATION_TOOLS.has(tool)) {
|
|
27
|
+
return 'The user asked to open the existing project, not change its files or configuration.';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (tool === 'sysRun' || tool === 'sysRunBg' || tool === 'terminal_persistent_shell') {
|
|
31
|
+
const command = String(args.command ?? args.input ?? '').trim();
|
|
32
|
+
|
|
33
|
+
if (OPEN_COMMAND.test(command) || isServerLaunchCommand(command) || LOCAL_HEALTH_CHECK.test(command) || PORT_CLEANUP_COMMAND.test(command)) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (/[;&|><`$()]/.test(command)) {
|
|
38
|
+
return 'A launch-only request does not authorize chained shell commands. Use one scoped command per tool call.';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (READ_ONLY_COMMAND.test(command)) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return 'The user asked to open the existing project. Use read-only inspection, a background server, or desktop.open; do not run unrelated commands.';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return null;
|
|
49
|
+
}
|
package/src/memoryManager.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { resolveSession, createSession, getSession, switchSession, saveSessionMessages } from './sessionStore.js';
|
|
3
|
+
import { resolveSession, createSession, getSession, switchSession, saveSessionMessages, forkSession } from './sessionStore.js';
|
|
4
4
|
import os from 'os';
|
|
5
5
|
import { causyneHome } from './utils/paths.js';
|
|
6
6
|
|
|
@@ -59,6 +59,26 @@ export class MemoryManager {
|
|
|
59
59
|
return next;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Fork current session into a new conversation without copying permissions.
|
|
64
|
+
*
|
|
65
|
+
* @param {string} [title]
|
|
66
|
+
* @param {number} [upToMessageIndex]
|
|
67
|
+
* @returns {import('./sessionStore.js').SessionRecord | null}
|
|
68
|
+
*/
|
|
69
|
+
forkSession(title = null, upToMessageIndex = null) {
|
|
70
|
+
if (!this.session) return null;
|
|
71
|
+
const forked = forkSession(this.session.id, {
|
|
72
|
+
title: title || undefined,
|
|
73
|
+
upToMessageIndex: typeof upToMessageIndex === 'number' ? upToMessageIndex : undefined,
|
|
74
|
+
makeActive: true
|
|
75
|
+
});
|
|
76
|
+
if (forked) {
|
|
77
|
+
this.session = forked;
|
|
78
|
+
}
|
|
79
|
+
return forked;
|
|
80
|
+
}
|
|
81
|
+
|
|
62
82
|
ensureMemoryDir() {
|
|
63
83
|
if (!fs.existsSync(MEMORY_DIR)) {
|
|
64
84
|
fs.mkdirSync(MEMORY_DIR, { recursive: true, mode: 0o700 });
|
|
@@ -77,7 +97,11 @@ export class MemoryManager {
|
|
|
77
97
|
|
|
78
98
|
|
|
79
99
|
boundHistory(messages) {
|
|
80
|
-
const persistable = messages.filter(m =>
|
|
100
|
+
const persistable = messages.filter(m => {
|
|
101
|
+
if (m.role !== 'system') return true;
|
|
102
|
+
if (typeof m.content === 'string' && m.content.startsWith('[Continuum')) return true;
|
|
103
|
+
return false;
|
|
104
|
+
});
|
|
81
105
|
const bounded = [];
|
|
82
106
|
let totalChars = 0;
|
|
83
107
|
|
package/src/modelCatalogue.js
CHANGED
|
@@ -134,6 +134,7 @@ export const MODEL_CATALOGUE = {
|
|
|
134
134
|
'Claude Opus 5.5 (High)',
|
|
135
135
|
'GPT-OSS 120B (Medium)'
|
|
136
136
|
],
|
|
137
|
+
'Pi (Local Peer)': ['default'],
|
|
137
138
|
'ACP (Peer Agents)': ['opencode', 'claude', 'codex', 'gemini', 'cursor', 'hermes', 'qwen', 'copilot', 'kimi', 'goose'],
|
|
138
139
|
'OpenCode (ACP)': PEER_MODEL_CATALOGUE.opencode,
|
|
139
140
|
'Claude Code (ACP)': PEER_MODEL_CATALOGUE.claude
|
|
@@ -167,6 +168,7 @@ export const DEFAULT_MODEL_BY_PROVIDER = {
|
|
|
167
168
|
'acp/goose': 'goose',
|
|
168
169
|
'acp/hermes': 'hermes',
|
|
169
170
|
antigravity: 'Gemini 3.8 Flash (Low)',
|
|
171
|
+
pi: 'default',
|
|
170
172
|
'openai-compatible': ''
|
|
171
173
|
};
|
|
172
174
|
|