@causyne/agent 1.20.8 → 1.20.10
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 +2 -1
- package/src/agentLoop.js +291 -103
- package/src/agentLoop.ts +322 -109
- package/src/browser/causyneBrowser.js +36 -0
- package/src/browser/causyneBrowser.ts +36 -1
- package/src/commands.js +25 -0
- package/src/compiledSkills.js +7330 -319
- package/src/computerUse/types.js +8 -0
- package/src/computerUse/types.ts +121 -0
- package/src/computerUse/visionGrounding.js +87 -29
- package/src/computerUse/visionGrounding.ts +108 -36
- package/src/contextManager.js +16 -0
- package/src/decisionPolicy.js +7 -9
- package/src/decisionPolicy.ts +7 -9
- package/src/documentEngine/antiSlopAuditor.js +13 -43
- package/src/documentEngine/antiSlopAuditor.ts +15 -47
- package/src/documentEngine/documentForge.js +3 -3
- package/src/documentEngine/documentForge.ts +3 -3
- package/src/launchIntent.js +3 -3
- package/src/launchIntent.ts +3 -3
- package/src/planCache.js +4 -14
- package/src/planCache.ts +4 -14
- package/src/providers/acp.js +4 -2
- package/src/providers/acp.ts +4 -2
- package/src/providers/antigravity.js +191 -28
- package/src/providers/antigravity.ts +192 -27
- package/src/providers/base.d.ts +2 -0
- package/src/providers/pi.js +3 -1
- package/src/providers/pi.ts +4 -2
- package/src/provisioning/capabilityProvisioner.js +2 -7
- package/src/provisioning/npmInstall.js +19 -0
- package/src/provisioning/npmInstall.ts +19 -0
- package/src/sandbox.js +7 -10
- package/src/smartToolsUse.js +223 -0
- package/src/smartToolsUse.ts +284 -0
- package/src/stallGuard.js +356 -0
- package/src/stallGuard.ts +432 -0
- package/src/taskShape.js +7 -7
- package/src/taskShape.ts +7 -7
- package/src/toolPacks.js +5 -5
- package/src/tools/blenderAutomator.js +198 -11
- package/src/tools/browserAutomator.js +3 -3
- package/src/tools/browserAutomator.ts +3 -3
- package/src/tools/documentForge.js +1 -1
- package/src/tools/documentForge.ts +1 -1
- package/src/tools/fsRead.js +91 -80
- package/src/tools/fsRead.ts +125 -0
- package/src/tools/peerAgent.js +1 -1
- package/src/tools/peerAgent.ts +1 -1
- package/src/tools/screenshot.js +5 -1
- package/src/tools/screenshot.ts +5 -1
- package/src/tools/toolScanner.js +19 -0
- package/src/tools/toolScanner.ts +17 -0
- package/src/tools/toolSelfRepair.js +63 -1
- package/src/tools/toolSelfRepair.ts +61 -1
- package/src/tools/visionInspector.js +80 -142
- package/src/tools/visionInspector.ts +110 -0
- package/src/tui/chatboxClipboard.js +152 -0
- package/src/tui/chatboxClipboard.ts +201 -0
- package/src/tui/clipboardSync.js +38 -7
- package/src/tui/clipboardSync.ts +39 -7
- package/src/tui/codeProgress.js +89 -18
- package/src/tui/codeProgress.ts +102 -17
- package/src/tui/codeStreamRenderer.js +7 -2
- package/src/tui/codeStreamRenderer.ts +7 -2
- package/src/tui/composerControls.js +9 -0
- package/src/tui/composerControls.ts +9 -0
- package/src/tui/dialogs.js +8 -3
- package/src/tui/diff.d.ts +1 -0
- package/src/tui/lineEditor.js +166 -14
- package/src/tui/mouseHover.js +6 -2
- package/src/tui/mouseHover.ts +7 -2
- package/src/tui/prompt.js +96 -19
- package/src/tui/stageSurface.js +3 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import crypto from 'node:crypto';
|
|
2
2
|
import fs from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
4
5
|
import { capabilityDirectory, ensureCapability, loadCapabilityPackage } from '../provisioning/capabilityProvisioner.js';
|
|
5
6
|
import { resolveBrowserRuntime } from './browserRuntime.js';
|
|
6
7
|
import { assertPublicWebUrl } from './urlPolicy.js';
|
|
@@ -864,6 +865,14 @@ export class CausyneBrowser {
|
|
|
864
865
|
return route.continue();
|
|
865
866
|
try {
|
|
866
867
|
const parsed = new URL(url);
|
|
868
|
+
if (parsed.protocol === 'file:') {
|
|
869
|
+
const workspace = await fs.realpath(this.workspace);
|
|
870
|
+
const file = await fs.realpath(fileURLToPath(parsed));
|
|
871
|
+
if (!isWithin(workspace, file))
|
|
872
|
+
throw new Error('File is outside the selected workspace');
|
|
873
|
+
await route.continue();
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
867
876
|
if (parsed.protocol === 'ws:' || parsed.protocol === 'wss:') {
|
|
868
877
|
parsed.protocol = parsed.protocol === 'wss:' ? 'https:' : 'http:';
|
|
869
878
|
await this.validateUrl(parsed.href);
|
|
@@ -1046,6 +1055,21 @@ export class CausyneBrowser {
|
|
|
1046
1055
|
state.lastSnapshot = '';
|
|
1047
1056
|
state.lastStructure = null;
|
|
1048
1057
|
}
|
|
1058
|
+
async preview(state, filePath, workspace) {
|
|
1059
|
+
const root = await fs.realpath(workspace);
|
|
1060
|
+
const target = await fs.realpath(path.resolve(root, filePath));
|
|
1061
|
+
if (!isWithin(root, target) || !/\.html?$/i.test(target)) {
|
|
1062
|
+
throw new Error('Preview requires an HTML file inside the selected workspace');
|
|
1063
|
+
}
|
|
1064
|
+
await state.page.goto(pathToFileURL(target).href, { waitUntil: 'domcontentloaded', timeout: NAVIGATION_TIMEOUT_MS });
|
|
1065
|
+
await state.page.waitForLoadState('domcontentloaded', { timeout: NAVIGATION_TIMEOUT_MS });
|
|
1066
|
+
if (state.page.url() !== pathToFileURL(target).href) {
|
|
1067
|
+
throw new Error('Preview navigated away from the selected workspace file');
|
|
1068
|
+
}
|
|
1069
|
+
state.refs.clear();
|
|
1070
|
+
state.lastSnapshot = '';
|
|
1071
|
+
state.lastStructure = null;
|
|
1072
|
+
}
|
|
1049
1073
|
async navigateWithMacroFallback(state, action) {
|
|
1050
1074
|
const { targetUrl, macroName, macroQuery } = this.resolveTargetUrl(action);
|
|
1051
1075
|
if (macroName === '@google_search' && macroQuery) {
|
|
@@ -1378,6 +1402,12 @@ export class CausyneBrowser {
|
|
|
1378
1402
|
await this.navigateWithMacroFallback(state, action);
|
|
1379
1403
|
return { action: action.type, tabId: state.id, url: state.page.url(), title: await state.page.title() };
|
|
1380
1404
|
}
|
|
1405
|
+
if (action.type === 'preview') {
|
|
1406
|
+
if (typeof action.filePath !== 'string')
|
|
1407
|
+
throw new Error('preview requires filePath');
|
|
1408
|
+
await this.preview(state, action.filePath, workspace);
|
|
1409
|
+
return { action: action.type, tabId: state.id, url: state.page.url(), title: await state.page.title() };
|
|
1410
|
+
}
|
|
1381
1411
|
if (action.type === 'snapshot' || action.type === 'scrape') {
|
|
1382
1412
|
const snapshot = await this.snapshot(action.offset ?? 0);
|
|
1383
1413
|
return {
|
|
@@ -1588,6 +1618,12 @@ export function validateBrowserActSandbox(args, workspaceRoot, isInternalUrl, is
|
|
|
1588
1618
|
for (const action of actions) {
|
|
1589
1619
|
if (!action || typeof action !== 'object')
|
|
1590
1620
|
continue;
|
|
1621
|
+
if (action.type === 'preview') {
|
|
1622
|
+
const filePath = typeof action.filePath === 'string' ? action.filePath : '';
|
|
1623
|
+
if (!filePath || !/\.html?$/i.test(filePath) || !isPathAllowed(path.resolve(workspaceRoot, filePath))) {
|
|
1624
|
+
return { allowed: false, reason: 'Preview requires an HTML file inside the selected workspace', risk: 'forbidden' };
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1591
1627
|
const rawUrl = typeof action.url === 'string' ? action.url.trim() : '';
|
|
1592
1628
|
const rawMacro = typeof action.macro === 'string' ? action.macro.trim() : '';
|
|
1593
1629
|
if (rawMacro) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import crypto from 'node:crypto';
|
|
2
2
|
import fs from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
4
5
|
|
|
5
6
|
import {
|
|
6
7
|
capabilityDirectory,
|
|
@@ -419,7 +420,7 @@ export type BrowserActionType =
|
|
|
419
420
|
| 'listTabs' | 'list_tabs'
|
|
420
421
|
| 'closeTab' | 'close_tab'
|
|
421
422
|
| 'search'
|
|
422
|
-
| 'goto' | 'open' | 'navigate'
|
|
423
|
+
| 'goto' | 'open' | 'navigate' | 'preview'
|
|
423
424
|
| 'snapshot' | 'scrape'
|
|
424
425
|
| 'click' | 'clickIndex'
|
|
425
426
|
| 'type' | 'typeIndex' | 'fill'
|
|
@@ -1123,6 +1124,13 @@ export class CausyneBrowser {
|
|
|
1123
1124
|
if (/^(about:|data:|blob:|moz-extension:)/i.test(url)) return route.continue();
|
|
1124
1125
|
try {
|
|
1125
1126
|
const parsed = new URL(url);
|
|
1127
|
+
if (parsed.protocol === 'file:') {
|
|
1128
|
+
const workspace = await fs.realpath(this.workspace);
|
|
1129
|
+
const file = await fs.realpath(fileURLToPath(parsed));
|
|
1130
|
+
if (!isWithin(workspace, file)) throw new Error('File is outside the selected workspace');
|
|
1131
|
+
await route.continue();
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1126
1134
|
if (parsed.protocol === 'ws:' || parsed.protocol === 'wss:') {
|
|
1127
1135
|
parsed.protocol = parsed.protocol === 'wss:' ? 'https:' : 'http:';
|
|
1128
1136
|
await this.validateUrl(parsed.href);
|
|
@@ -1291,6 +1299,22 @@ export class CausyneBrowser {
|
|
|
1291
1299
|
state.lastStructure = null;
|
|
1292
1300
|
}
|
|
1293
1301
|
|
|
1302
|
+
private async preview(state: TabState, filePath: string, workspace: string): Promise<void> {
|
|
1303
|
+
const root = await fs.realpath(workspace);
|
|
1304
|
+
const target = await fs.realpath(path.resolve(root, filePath));
|
|
1305
|
+
if (!isWithin(root, target) || !/\.html?$/i.test(target)) {
|
|
1306
|
+
throw new Error('Preview requires an HTML file inside the selected workspace');
|
|
1307
|
+
}
|
|
1308
|
+
await state.page.goto(pathToFileURL(target).href, { waitUntil: 'domcontentloaded', timeout: NAVIGATION_TIMEOUT_MS });
|
|
1309
|
+
await state.page.waitForLoadState('domcontentloaded', { timeout: NAVIGATION_TIMEOUT_MS });
|
|
1310
|
+
if (state.page.url() !== pathToFileURL(target).href) {
|
|
1311
|
+
throw new Error('Preview navigated away from the selected workspace file');
|
|
1312
|
+
}
|
|
1313
|
+
state.refs.clear();
|
|
1314
|
+
state.lastSnapshot = '';
|
|
1315
|
+
state.lastStructure = null;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1294
1318
|
private async navigateWithMacroFallback(state: TabState, action: BrowserAction): Promise<void> {
|
|
1295
1319
|
const { targetUrl, macroName, macroQuery } = this.resolveTargetUrl(action);
|
|
1296
1320
|
if (macroName === '@google_search' && macroQuery) {
|
|
@@ -1603,6 +1627,11 @@ export class CausyneBrowser {
|
|
|
1603
1627
|
await this.navigateWithMacroFallback(state, action);
|
|
1604
1628
|
return { action: action.type, tabId: state.id, url: state.page.url(), title: await state.page.title() };
|
|
1605
1629
|
}
|
|
1630
|
+
if (action.type === 'preview') {
|
|
1631
|
+
if (typeof action.filePath !== 'string') throw new Error('preview requires filePath');
|
|
1632
|
+
await this.preview(state, action.filePath, workspace);
|
|
1633
|
+
return { action: action.type, tabId: state.id, url: state.page.url(), title: await state.page.title() };
|
|
1634
|
+
}
|
|
1606
1635
|
if (action.type === 'snapshot' || action.type === 'scrape') {
|
|
1607
1636
|
const snapshot = await this.snapshot(action.offset ?? 0);
|
|
1608
1637
|
return {
|
|
@@ -1808,6 +1837,12 @@ export function validateBrowserActSandbox(
|
|
|
1808
1837
|
let hasDownload = false;
|
|
1809
1838
|
for (const action of actions) {
|
|
1810
1839
|
if (!action || typeof action !== 'object') continue;
|
|
1840
|
+
if (action.type === 'preview') {
|
|
1841
|
+
const filePath = typeof action.filePath === 'string' ? action.filePath : '';
|
|
1842
|
+
if (!filePath || !/\.html?$/i.test(filePath) || !isPathAllowed(path.resolve(workspaceRoot, filePath))) {
|
|
1843
|
+
return { allowed: false, reason: 'Preview requires an HTML file inside the selected workspace', risk: 'forbidden' };
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1811
1846
|
const rawUrl = typeof action.url === 'string' ? action.url.trim() : '';
|
|
1812
1847
|
const rawMacro = typeof action.macro === 'string' ? action.macro.trim() : '';
|
|
1813
1848
|
if (rawMacro) {
|
package/src/commands.js
CHANGED
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
import fs from 'fs';
|
|
46
46
|
import os from 'os';
|
|
47
47
|
import path from 'path';
|
|
48
|
+
import { runCopyCommand, runPasteCommand } from './tui/chatboxClipboard.js';
|
|
48
49
|
|
|
49
50
|
export const SCOPES = ['local'];
|
|
50
51
|
|
|
@@ -991,6 +992,30 @@ export const COMMANDS = [
|
|
|
991
992
|
}
|
|
992
993
|
},
|
|
993
994
|
|
|
995
|
+
{
|
|
996
|
+
name: 'copy',
|
|
997
|
+
aliases: ['cp', 'clip'],
|
|
998
|
+
scope: 'local',
|
|
999
|
+
usage: '/copy [input | last | <text>]',
|
|
1000
|
+
description: 'Copy chatbox input, last assistant response, or text to system clipboard',
|
|
1001
|
+
run: (argv, ctx) => {
|
|
1002
|
+
const res = runCopyCommand(argv, ctx);
|
|
1003
|
+
return res.ok ? ok(res.output) : fail(res.output);
|
|
1004
|
+
}
|
|
1005
|
+
},
|
|
1006
|
+
|
|
1007
|
+
{
|
|
1008
|
+
name: 'paste',
|
|
1009
|
+
aliases: ['pasteclip'],
|
|
1010
|
+
scope: 'local',
|
|
1011
|
+
usage: '/paste [text]',
|
|
1012
|
+
description: 'Paste clipboard content or text into the chatbox input',
|
|
1013
|
+
run: (argv, ctx) => {
|
|
1014
|
+
const res = runPasteCommand(argv, ctx);
|
|
1015
|
+
return res.ok ? ok(res.output) : fail(res.output);
|
|
1016
|
+
}
|
|
1017
|
+
},
|
|
1018
|
+
|
|
994
1019
|
{
|
|
995
1020
|
name: 'stop',
|
|
996
1021
|
aliases: ['abort'],
|