@causyne/agent 1.20.117 → 1.20.120
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 +7 -2
- package/src/agentLoop.js +29 -12
- package/src/agentLoop.ts +29 -16
- package/src/browser/causyneBrowser.js +231 -136
- package/src/browser/causyneBrowser.ts +229 -140
- package/src/browser/searchProviders.js +41 -30
- package/src/browser/searchProviders.ts +24 -14
- package/src/browser/workspacePathSafety.js +50 -0
- package/src/browser/workspacePathSafety.ts +50 -0
- package/src/browser/workspacePreview.js +27 -4
- package/src/browser/workspacePreview.ts +28 -4
- package/src/cliMode.js +20 -4
- package/src/commands.js +12 -14
- package/src/creative/liveBridge.js +34 -1
- package/src/creative/liveBridge.ts +28 -1
- package/src/observer/evidence.js +23 -0
- package/src/observer/evidence.ts +21 -0
- package/src/plugins/pluginManager.js +74 -0
- package/src/providers/anthropic.js +33 -17
- package/src/providers/base.js +14 -0
- package/src/providers/dashscope-byok.js +13 -7
- package/src/providers/deepseek.js +13 -18
- package/src/providers/gemini.js +33 -25
- package/src/providers/moonshot.js +13 -12
- package/src/providers/ollama.js +21 -21
- package/src/providers/openai-compatible.js +12 -19
- package/src/providers/openrouter.js +20 -90
- package/src/providers/openrouter.ts +31 -94
- package/src/providers/qwen-byok.js +13 -7
- package/src/providers/toolContracts.js +9 -3
- package/src/providers/toolContracts.ts +9 -3
- package/src/providers/wireNormalizer.js +238 -0
- package/src/providers/wireNormalizer.ts +279 -0
- package/src/providers/xai.js +13 -12
- package/src/reporting.js +12 -4
- package/src/skillsManager.js +3 -2
- package/src/skillsManager.ts +3 -2
- package/src/tools/browserAutomator.js +13 -1
- package/src/tools/browserAutomator.ts +13 -0
- package/src/tools/creativeApps.js +2 -1
- package/src/tools/creativeApps.ts +2 -1
- package/src/tools/gameAssetFetcher.js +130 -26
- package/src/tools/gameAssetHarvester.js +80 -58
- package/src/tools/nativeEngine.js +1 -1
- package/src/tools/nativeEngine.ts +1 -1
- package/src/tools/pluginManager.js +17 -2
- package/src/tools/registry.js +13 -0
- package/src/tools/toolScanner.js +596 -140
- package/src/tools/toolScanner.ts +665 -147
- package/src/tools/toolSelfRepair.js +243 -114
- package/src/tools/toolSelfRepair.ts +262 -111
- package/src/tools/webFetch.js +161 -24
- package/src/tools/webFetch.ts +157 -22
- package/src/tools/webSearch.js +33 -4
- package/src/tools/webSearch.ts +27 -4
- package/src/tui/composerControls.js +16 -3
- package/src/tui/composerControls.ts +14 -3
- package/src/tui/prompt.js +122 -16
- package/src/tui/sessionPicker.js +132 -35
- package/src/tui/sessionPicker.ts +153 -32
- package/src/tui/sessionPickerView.js +277 -34
- package/src/tui/sessionPickerView.ts +328 -34
- package/src/tui/statusLine.js +3 -0
- package/src/tui/statusLine.ts +5 -0
- package/src/tui/usageCard.js +119 -47
- package/src/tui/usageCard.ts +133 -49
- package/src/tui/workspaceIdentity.js +133 -0
- package/src/tui/workspaceIdentity.ts +146 -0
- package/src/tui/workspaceSwitch.js +2 -0
- package/src/tui/workspaceSwitch.ts +1 -0
- package/src/verification/boundedExplorer.js +119 -0
- package/src/verification/cliProbe.js +116 -0
- package/src/verification/featureMap.js +78 -0
- package/src/verification/interactivePty.js +188 -0
- package/src/verification/propertyProbe.js +121 -0
- package/src/verification/ptyProbe.js +125 -0
- package/src/verification/skillCatalog.d.ts +1 -0
- package/src/verification/skillCatalog.js +60 -0
- package/src/verification/statechart.js +143 -0
- package/src/verification/uiRuntime.js +57 -0
- package/src/verificationPlan.js +1 -1
- package/src/verificationPlan.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@causyne/agent",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.120",
|
|
4
4
|
"description": "Agentic AI for software, tools, and computer workflows",
|
|
5
5
|
"main": "bin/causyne.js",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,12 @@
|
|
|
32
32
|
"typecheck": "tsc -p tsconfig.json",
|
|
33
33
|
"typecheck:ts": "tsc -p tsconfig.strict.json",
|
|
34
34
|
"typecheck:js-ratchet": "tsc -p tsconfig.js-ratchet.json",
|
|
35
|
-
"typecheck:strict": "npm run typecheck:ts && npm run typecheck:js-ratchet"
|
|
35
|
+
"typecheck:strict": "npm run typecheck:ts && npm run typecheck:js-ratchet",
|
|
36
|
+
"verify:features": "node scripts/verify-features.mjs",
|
|
37
|
+
"verify:ui": "node scripts/verify-ui.mjs",
|
|
38
|
+
"verify:properties": "node --test --import ./tests/helpers/isolateState.js tests/boundedExplorer.test.ts tests/verificationPropertyProbe.test.ts",
|
|
39
|
+
"verify:statechart": "node scripts/verify-statechart.mjs",
|
|
40
|
+
"verify:tla": "node scripts/verify-tla.mjs"
|
|
36
41
|
},
|
|
37
42
|
"engines": {
|
|
38
43
|
"node": ">=24.0.0"
|
package/src/agentLoop.js
CHANGED
|
@@ -16,6 +16,7 @@ import { WorkspacePerception } from './perception.js';
|
|
|
16
16
|
import { audioFormatForMimeType } from './providers/base.js';
|
|
17
17
|
import { TaskBuffer } from './taskBuffer.js';
|
|
18
18
|
import { TOOL_DEFINITIONS, getDynamicTools, getSearchableToolDefinitions, resolveTool, canonicalToolName } from './tools/registry.js';
|
|
19
|
+
import { scanAndAdaptToolsForProvider } from './tools/toolScanner.js';
|
|
19
20
|
import { selfRepairToolCall, generateSelfRepairDiagnostic } from './tools/toolSelfRepair.js';
|
|
20
21
|
import { validateToolArguments } from './tools/argumentValidation.js';
|
|
21
22
|
import { Sandbox } from './sandbox.js';
|
|
@@ -40,7 +41,7 @@ import { requiresToolApproval, withToolAutonomyMode } from './approvalPolicy.js'
|
|
|
40
41
|
import { AGENT_USER_POLICY } from './agentPolicy.js';
|
|
41
42
|
import { VFETracker } from './vfeTracker.js';
|
|
42
43
|
import { coldObserver } from './observer/coldObserver.js';
|
|
43
|
-
import { isRenderedNativeBrowserAction, isVerificationCommand } from './observer/evidence.js';
|
|
44
|
+
import { inspectBrowserToolEvidence, isRenderedNativeBrowserAction, isVerificationCommand } from './observer/evidence.js';
|
|
44
45
|
import { CausyneObserver, defaultObserver, extractClaimedLocalUrls } from './observer.js';
|
|
45
46
|
import { TimeMachine, recoveryUserMessage, TIME_MACHINE_MAX_ATTEMPTS } from './timeMachine.js';
|
|
46
47
|
import { packForTool, isCoreTool, isGameIntent, isWebIntent, PACK_PLAYBOOKS, PACKS } from './toolPacks.js';
|
|
@@ -403,9 +404,10 @@ You possess native reverse engineering capabilities powered by the Reverse Engin
|
|
|
403
404
|
5. **Multiple Emulators/Devices**: When multiple devices or emulators are connected, specify \`-s <serial>\` (e.g. \`adb -s emulator-5554 ...\`) or set \`export ANDROID_SERIAL=<serial>\`.
|
|
404
405
|
|
|
405
406
|
# Universal Tool Calling & Registry Discipline
|
|
406
|
-
1. **Strict Registry Adherence**:
|
|
407
|
-
2. **
|
|
408
|
-
3. **
|
|
407
|
+
1. **Strict Root Registry Adherence**: Invoke ONLY tools registered in the active Causyne catalogue (native, plugin, or MCP) or permitted connected-peer capabilities across ACP/Antigravity/Pi. Use exact canonical parameter names and required fields defined in each tool schema without inventing or renaming parameters.
|
|
408
|
+
2. **Pre-Flight Universal Schema Scan (\`toolsScan\`)**: Before dispatching schemas to any provider API, Causyne scans and compiles every tool declaration into that provider's dialect without reducing or altering underlying tool capability. When an adapted schema asks for a JSON-encoded string on an object, array, or union parameter (e.g. multi-file paths or free-form properties), pass valid JSON so the runtime buffer decodes it transparently to its native type.
|
|
409
|
+
3. **Universal Self-Repair Buffer (\`toolsSelfRepair\`)**: Every tool call is filtered through \`toolsSelfRepair\`, which heals malformed JSON, decodes adapted free-form/polymorphic values, resolves parameter aliases, coerces types recursively, and emits structured \`selfRepairGuidance\` (\`expectedParameters\`) on incomplete invocations. Always read \`expectedParameters\` and re-invoke with the corrected arguments.
|
|
410
|
+
4. **Valid JSON Formatting**: Never emit raw unescaped newlines, single-quoted keys, or trailing commas inside tool call JSON strings.
|
|
409
411
|
|
|
410
412
|
# Completion
|
|
411
413
|
Answer directly when no tool is needed. For action tasks, continue until the authorized work is done or a real blocker is evidenced; then report the verified outcome or blocker concisely.
|
|
@@ -662,6 +664,8 @@ export class AgentLoop {
|
|
|
662
664
|
this.stallGuard = new StallGuardController();
|
|
663
665
|
this.smartToolsGovernor = new SmartToolsGovernor(4);
|
|
664
666
|
this._smartToolsNudge = null;
|
|
667
|
+
this.activeFreeFormPaths = new Map();
|
|
668
|
+
this._lastToolsScanKey = '';
|
|
665
669
|
// Sovereign Progressive Disclosure: which capability packs have entered the
|
|
666
670
|
// context window for this task. Nothing is disabled — see src/toolPacks.js.
|
|
667
671
|
this.unlockedPacks = new Set();
|
|
@@ -2295,6 +2299,21 @@ export class AgentLoop {
|
|
|
2295
2299
|
? eligibleTools.filter((tool) => this.toolScope.has(tool.name)) : eligibleTools;
|
|
2296
2300
|
const dynamicTools = this.smartTools.schemas(permittedTools, this.unlockedTools, this.unlockedPacks, this.config.grantAllTools === true);
|
|
2297
2301
|
const dynamicToolNames = dynamicTools.map((t) => t.name);
|
|
2302
|
+
// Pre-flight universal schema audit (toolsScan): verify dialect readiness and cache
|
|
2303
|
+
// adapted free-form/polymorphic paths for lossless decoding inside toolsSelfRepair.
|
|
2304
|
+
const activeProviderName = String(this.config?.provider || 'openai');
|
|
2305
|
+
const scanKey = `${activeProviderName}:${dynamicToolNames.join(',')}`;
|
|
2306
|
+
if (scanKey !== this._lastToolsScanKey) {
|
|
2307
|
+
const preflightScan = scanAndAdaptToolsForProvider(dynamicTools, activeProviderName);
|
|
2308
|
+
this.activeFreeFormPaths = preflightScan.freeFormPaths;
|
|
2309
|
+
this._lastToolsScanKey = scanKey;
|
|
2310
|
+
if (preflightScan.repairedCount > 0) {
|
|
2311
|
+
this.debugLog(`[toolsScan] Pre-flight compiled ${preflightScan.repairedCount}/${preflightScan.totalTools} schemas for '${activeProviderName}' (universalReady=${preflightScan.universalReady})`);
|
|
2312
|
+
}
|
|
2313
|
+
if (!preflightScan.universalReady) {
|
|
2314
|
+
this.debugLog(`[toolsScan] Residual compatibility issues on '${activeProviderName}': ${preflightScan.residualIssues.slice(0, 5).map((issue) => `${issue.tool}:${issue.code}`).join(', ')}`);
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2298
2317
|
// Dynamically inject the absolute latest System context
|
|
2299
2318
|
const autonomyMode = this.config.autonomyMode || 'C';
|
|
2300
2319
|
const allowedPaths = this.sandbox.grantAllAccess
|
|
@@ -3924,7 +3943,8 @@ You are operating in a text-and-code modality without direct image pixel renderi
|
|
|
3924
3943
|
const tool = resolveTool(functionName);
|
|
3925
3944
|
const toolSchema = tool?.schema?.parameters || tool?.schema?.input_schema;
|
|
3926
3945
|
const repair = selfRepairToolCall(toolCall, toolSchema, {
|
|
3927
|
-
cwd: this.workspaceRoot || process.cwd()
|
|
3946
|
+
cwd: this.workspaceRoot || process.cwd(),
|
|
3947
|
+
freeFormPaths: this.activeFreeFormPaths?.get(functionName)
|
|
3928
3948
|
});
|
|
3929
3949
|
if (repair.error) {
|
|
3930
3950
|
this.messages.push({
|
|
@@ -4439,14 +4459,11 @@ You are operating in a text-and-code modality without direct image pixel renderi
|
|
|
4439
4459
|
if (functionName === 'browser_act' && result?.success === true) {
|
|
4440
4460
|
const hasExplicitPlanInBatch = Array.isArray(response.toolCalls)
|
|
4441
4461
|
&& response.toolCalls.some((c) => canonicalToolName(c?.function?.name || '') === 'update_plan');
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
}
|
|
4445
|
-
const browserResults = Array.isArray(result.data) ? result.data : [];
|
|
4446
|
-
const allRuntimeErrors = browserResults.flatMap((item) => Array.isArray(item?.data?.runtimeErrors) ? item.data.runtimeErrors : []);
|
|
4447
|
-
const hasValidBrowserAction = browserResults.some((item) => ['preview', 'snapshot', 'scrape', 'screenshot'].includes(item?.action));
|
|
4448
|
-
if (allRuntimeErrors.length === 0 && (hasValidBrowserAction || result.url || result.tabId)) {
|
|
4462
|
+
const { verified, runtimeErrors: allRuntimeErrors } = inspectBrowserToolEvidence(result);
|
|
4463
|
+
if (verified) {
|
|
4449
4464
|
this.webVerificationState.browserActUsed = true;
|
|
4465
|
+
if (!hasExplicitPlanInBatch)
|
|
4466
|
+
this.advanceImplementationPlanProgress('verification');
|
|
4450
4467
|
}
|
|
4451
4468
|
else if (allRuntimeErrors.length > 0) {
|
|
4452
4469
|
this.webVerificationState.browserActUsed = false;
|
package/src/agentLoop.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { WorkspacePerception } from './perception.js';
|
|
|
17
17
|
import { audioFormatForMimeType } from './providers/base.js';
|
|
18
18
|
import { TaskBuffer } from './taskBuffer.js';
|
|
19
19
|
import { TOOL_DEFINITIONS, getDynamicTools, getSearchableToolDefinitions, resolveTool, canonicalToolName } from './tools/registry.js';
|
|
20
|
+
import { scanAndAdaptToolsForProvider } from './tools/toolScanner.js';
|
|
20
21
|
import { selfRepairToolCall, generateSelfRepairDiagnostic } from './tools/toolSelfRepair.js';
|
|
21
22
|
import { validateToolArguments } from './tools/argumentValidation.js';
|
|
22
23
|
import { Sandbox } from './sandbox.js';
|
|
@@ -52,7 +53,7 @@ import { requiresToolApproval, withToolAutonomyMode } from './approvalPolicy.js'
|
|
|
52
53
|
import { AGENT_USER_POLICY } from './agentPolicy.js';
|
|
53
54
|
import { VFETracker } from './vfeTracker.js';
|
|
54
55
|
import { coldObserver } from './observer/coldObserver.js';
|
|
55
|
-
import { isRenderedNativeBrowserAction, isVerificationCommand } from './observer/evidence.js';
|
|
56
|
+
import { inspectBrowserToolEvidence, isRenderedNativeBrowserAction, isVerificationCommand } from './observer/evidence.js';
|
|
56
57
|
import { CausyneObserver, defaultObserver, extractClaimedLocalUrls } from './observer.js';
|
|
57
58
|
import type { Observation } from './observer.js';
|
|
58
59
|
import { TimeMachine, recoveryUserMessage, TIME_MACHINE_MAX_ATTEMPTS } from './timeMachine.js';
|
|
@@ -485,9 +486,10 @@ You possess native reverse engineering capabilities powered by the Reverse Engin
|
|
|
485
486
|
5. **Multiple Emulators/Devices**: When multiple devices or emulators are connected, specify \`-s <serial>\` (e.g. \`adb -s emulator-5554 ...\`) or set \`export ANDROID_SERIAL=<serial>\`.
|
|
486
487
|
|
|
487
488
|
# Universal Tool Calling & Registry Discipline
|
|
488
|
-
1. **Strict Registry Adherence**:
|
|
489
|
-
2. **
|
|
490
|
-
3. **
|
|
489
|
+
1. **Strict Root Registry Adherence**: Invoke ONLY tools registered in the active Causyne catalogue (native, plugin, or MCP) or permitted connected-peer capabilities across ACP/Antigravity/Pi. Use exact canonical parameter names and required fields defined in each tool schema without inventing or renaming parameters.
|
|
490
|
+
2. **Pre-Flight Universal Schema Scan (\`toolsScan\`)**: Before dispatching schemas to any provider API, Causyne scans and compiles every tool declaration into that provider's dialect without reducing or altering underlying tool capability. When an adapted schema asks for a JSON-encoded string on an object, array, or union parameter (e.g. multi-file paths or free-form properties), pass valid JSON so the runtime buffer decodes it transparently to its native type.
|
|
491
|
+
3. **Universal Self-Repair Buffer (\`toolsSelfRepair\`)**: Every tool call is filtered through \`toolsSelfRepair\`, which heals malformed JSON, decodes adapted free-form/polymorphic values, resolves parameter aliases, coerces types recursively, and emits structured \`selfRepairGuidance\` (\`expectedParameters\`) on incomplete invocations. Always read \`expectedParameters\` and re-invoke with the corrected arguments.
|
|
492
|
+
4. **Valid JSON Formatting**: Never emit raw unescaped newlines, single-quoted keys, or trailing commas inside tool call JSON strings.
|
|
491
493
|
|
|
492
494
|
# Completion
|
|
493
495
|
Answer directly when no tool is needed. For action tasks, continue until the authorized work is done or a real blocker is evidenced; then report the verified outcome or blocker concisely.
|
|
@@ -762,6 +764,8 @@ export class AgentLoop {
|
|
|
762
764
|
this.stallGuard = new StallGuardController();
|
|
763
765
|
this.smartToolsGovernor = new SmartToolsGovernor(4);
|
|
764
766
|
this._smartToolsNudge = null;
|
|
767
|
+
this.activeFreeFormPaths = new Map<string, string[][]>();
|
|
768
|
+
this._lastToolsScanKey = '';
|
|
765
769
|
|
|
766
770
|
// Sovereign Progressive Disclosure: which capability packs have entered the
|
|
767
771
|
// context window for this task. Nothing is disabled — see src/toolPacks.js.
|
|
@@ -2378,6 +2382,22 @@ export class AgentLoop {
|
|
|
2378
2382
|
this.config.grantAllTools === true);
|
|
2379
2383
|
const dynamicToolNames = dynamicTools.map((t: any) => t.name);
|
|
2380
2384
|
|
|
2385
|
+
// Pre-flight universal schema audit (toolsScan): verify dialect readiness and cache
|
|
2386
|
+
// adapted free-form/polymorphic paths for lossless decoding inside toolsSelfRepair.
|
|
2387
|
+
const activeProviderName = String(this.config?.provider || 'openai');
|
|
2388
|
+
const scanKey = `${activeProviderName}:${dynamicToolNames.join(',')}`;
|
|
2389
|
+
if (scanKey !== this._lastToolsScanKey) {
|
|
2390
|
+
const preflightScan = scanAndAdaptToolsForProvider(dynamicTools, activeProviderName);
|
|
2391
|
+
this.activeFreeFormPaths = preflightScan.freeFormPaths;
|
|
2392
|
+
this._lastToolsScanKey = scanKey;
|
|
2393
|
+
if (preflightScan.repairedCount > 0) {
|
|
2394
|
+
this.debugLog(`[toolsScan] Pre-flight compiled ${preflightScan.repairedCount}/${preflightScan.totalTools} schemas for '${activeProviderName}' (universalReady=${preflightScan.universalReady})`);
|
|
2395
|
+
}
|
|
2396
|
+
if (!preflightScan.universalReady) {
|
|
2397
|
+
this.debugLog(`[toolsScan] Residual compatibility issues on '${activeProviderName}': ${preflightScan.residualIssues.slice(0, 5).map((issue) => `${issue.tool}:${issue.code}`).join(', ')}`);
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2381
2401
|
// Dynamically inject the absolute latest System context
|
|
2382
2402
|
const autonomyMode = this.config.autonomyMode || 'C';
|
|
2383
2403
|
const allowedPaths = this.sandbox.grantAllAccess
|
|
@@ -4090,7 +4110,8 @@ You are operating in a text-and-code modality without direct image pixel renderi
|
|
|
4090
4110
|
const tool = resolveTool(functionName);
|
|
4091
4111
|
const toolSchema = tool?.schema?.parameters || tool?.schema?.input_schema;
|
|
4092
4112
|
const repair = selfRepairToolCall(toolCall, toolSchema, {
|
|
4093
|
-
cwd: this.workspaceRoot || process.cwd()
|
|
4113
|
+
cwd: this.workspaceRoot || process.cwd(),
|
|
4114
|
+
freeFormPaths: this.activeFreeFormPaths?.get(functionName)
|
|
4094
4115
|
});
|
|
4095
4116
|
|
|
4096
4117
|
if (repair.error) {
|
|
@@ -4654,18 +4675,10 @@ You are operating in a text-and-code modality without direct image pixel renderi
|
|
|
4654
4675
|
if (functionName === 'browser_act' && result?.success === true) {
|
|
4655
4676
|
const hasExplicitPlanInBatch = Array.isArray(response.toolCalls)
|
|
4656
4677
|
&& response.toolCalls.some((c: any) => canonicalToolName(c?.function?.name || '') === 'update_plan');
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
}
|
|
4660
|
-
const browserResults = Array.isArray(result.data) ? result.data : [];
|
|
4661
|
-
const allRuntimeErrors = browserResults.flatMap((item: any) =>
|
|
4662
|
-
Array.isArray(item?.data?.runtimeErrors) ? item.data.runtimeErrors : []
|
|
4663
|
-
);
|
|
4664
|
-
const hasValidBrowserAction = browserResults.some((item: any) =>
|
|
4665
|
-
['preview', 'snapshot', 'scrape', 'screenshot'].includes(item?.action)
|
|
4666
|
-
);
|
|
4667
|
-
if (allRuntimeErrors.length === 0 && (hasValidBrowserAction || result.url || result.tabId)) {
|
|
4678
|
+
const { verified, runtimeErrors: allRuntimeErrors } = inspectBrowserToolEvidence(result);
|
|
4679
|
+
if (verified) {
|
|
4668
4680
|
this.webVerificationState.browserActUsed = true;
|
|
4681
|
+
if (!hasExplicitPlanInBatch) this.advanceImplementationPlanProgress('verification');
|
|
4669
4682
|
} else if (allRuntimeErrors.length > 0) {
|
|
4670
4683
|
this.webVerificationState.browserActUsed = false;
|
|
4671
4684
|
this.emitEvent({
|