@causyne/agent 1.20.20 → 1.20.23
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 +57 -100
- package/src/agentLoop.ts +57 -101
- package/src/engines/reverseHarness.js +25 -3
- package/src/engines/reverseHarness.ts +30 -3
- package/src/providers/antigravity.js +43 -26
- package/src/providers/antigravity.ts +41 -24
- package/src/smartToolsUse.js +26 -3
- package/src/smartToolsUse.ts +29 -3
- package/src/tools/reverseEngineering.js +464 -24
- package/src/tools/reverseEngineering.ts +473 -25
- package/src/providers/budgetEnforcer.js +0 -136
- package/src/providers/budgetEnforcer.ts +0 -143
|
@@ -80,10 +80,26 @@ export class SovereignReverseHarness {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
const nodeDir = path.dirname(process.execPath);
|
|
84
|
+
const homeDir = process.env.HOME || '';
|
|
85
|
+
const buildToolsDirs = [
|
|
86
|
+
path.join(homeDir, 'Library/Android/sdk/build-tools/36.1.0'),
|
|
87
|
+
path.join(homeDir, 'Library/Android/sdk/build-tools/35.0.0'),
|
|
88
|
+
path.join(homeDir, 'Library/Android/sdk/platform-tools'),
|
|
89
|
+
'/opt/homebrew/bin',
|
|
90
|
+
'/usr/local/bin'
|
|
91
|
+
].filter(d => fs.existsSync(d));
|
|
92
|
+
|
|
93
|
+
const augmentedPath = [nodeDir, ...buildToolsDirs, process.env.PATH || ''].join(':');
|
|
94
|
+
|
|
83
95
|
const mcpClient = new McpClient({
|
|
84
96
|
name: 'causyne_reverse_engineering',
|
|
85
97
|
command,
|
|
86
98
|
args,
|
|
99
|
+
env: {
|
|
100
|
+
...process.env,
|
|
101
|
+
PATH: augmentedPath
|
|
102
|
+
},
|
|
87
103
|
timeoutMs: 60_000
|
|
88
104
|
});
|
|
89
105
|
|
|
@@ -186,15 +202,26 @@ export class SovereignReverseHarness {
|
|
|
186
202
|
const ext = path.extname(resolved).toLowerCase();
|
|
187
203
|
if (ext === '.apk' || ext === '.aab') {
|
|
188
204
|
const pkg = await this.callEngineTool('inspect_android_package', { path: resolved }, signal);
|
|
189
|
-
if (pkg.success)
|
|
205
|
+
if (pkg.success && pkg.output && !pkg.output.includes('capability_unavailable') && !pkg.output.includes('REA_JADX_MCP_JAR')) {
|
|
206
|
+
return pkg;
|
|
207
|
+
}
|
|
190
208
|
|
|
191
209
|
const dec = await this.callEngineTool('decode_android_resources', { path: resolved }, signal);
|
|
192
|
-
if (dec.success)
|
|
210
|
+
if (dec.success && dec.output && !dec.output.includes('capability_unavailable') && !dec.output.includes('apktool launcher was not found')) {
|
|
211
|
+
return dec;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return {
|
|
215
|
+
success: false,
|
|
216
|
+
toolName: 'inspect_android_package',
|
|
217
|
+
error: 'Engine APK tools unavailable; delegating to sovereign native inspector.',
|
|
218
|
+
source: 'fallback'
|
|
219
|
+
};
|
|
193
220
|
}
|
|
194
221
|
|
|
195
222
|
// Try primary session / overview tools
|
|
196
223
|
const open = await this.callEngineTool('open_binary', { path: resolved }, signal);
|
|
197
|
-
if (open.success) return open;
|
|
224
|
+
if (open.success && open.output && !open.output.includes('"architecture":null')) return open;
|
|
198
225
|
|
|
199
226
|
const layout = await this.callEngineTool('inspect_binary_layout', { path: resolved }, signal);
|
|
200
227
|
if (layout.success) return layout;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { formatToolContracts, toolContractUpdate, contractFingerprint } from './toolContracts.js';
|
|
2
|
-
|
|
2
|
+
export function noncachedTokens(usage) {
|
|
3
|
+
if (!usage)
|
|
4
|
+
return 0;
|
|
5
|
+
const finite = (value) => Number.isFinite(value) ? Math.max(0, value ?? 0) : 0;
|
|
6
|
+
const input = usage.uncachedPromptTokens !== undefined
|
|
7
|
+
? finite(usage.uncachedPromptTokens)
|
|
8
|
+
: finite(usage.cachedPromptTokens) > finite(usage.promptTokens)
|
|
9
|
+
? finite(usage.promptTokens)
|
|
10
|
+
: Math.max(0, finite(usage.promptTokens) - finite(usage.cachedPromptTokens));
|
|
11
|
+
return input + finite(usage.completionTokens);
|
|
12
|
+
}
|
|
3
13
|
import { determineToolScope } from '../smartToolsUse.js';
|
|
4
14
|
import { PEER_COLLABORATION_POLICY } from './collaborationPolicy.js';
|
|
5
15
|
import { spawn } from 'node:child_process';
|
|
@@ -966,9 +976,9 @@ export class AntigravityProvider extends LLMProvider {
|
|
|
966
976
|
}
|
|
967
977
|
};
|
|
968
978
|
const configuredActions = Number(options.maxNativeActions);
|
|
969
|
-
const isAutonomous = options.hardBudget === false
|
|
979
|
+
const isAutonomous = options.hardBudget === false;
|
|
970
980
|
let maxNativeActions = Number.isSafeInteger(configuredActions) && configuredActions >= 0
|
|
971
|
-
? configuredActions : desktopTask ? 12 : 35;
|
|
981
|
+
? configuredActions : desktopTask ? 12 : isAutonomous ? Infinity : 35;
|
|
972
982
|
let nativeActionStarts = 0;
|
|
973
983
|
let lastMutationActionIndex = 0;
|
|
974
984
|
let progressiveActionsCount = 0;
|
|
@@ -995,7 +1005,7 @@ export class AntigravityProvider extends LLMProvider {
|
|
|
995
1005
|
const hasExplicitLimit = (Number.isFinite(remainingTaskBudget) && remainingTaskBudget > 0)
|
|
996
1006
|
|| (Number.isFinite(rawTokenLimit) && rawTokenLimit > 0);
|
|
997
1007
|
const countReportedTotal = options.tokenBudgetBasis !== 'noncached';
|
|
998
|
-
const defaultTokenLimit =
|
|
1008
|
+
const defaultTokenLimit = 100_000;
|
|
999
1009
|
const tokenLimit = Number.isFinite(remainingTaskBudget) && remainingTaskBudget > 0
|
|
1000
1010
|
? remainingTaskBudget
|
|
1001
1011
|
: (Number.isFinite(rawTokenLimit) && rawTokenLimit > 0
|
|
@@ -1203,19 +1213,9 @@ export class AntigravityProvider extends LLMProvider {
|
|
|
1203
1213
|
}
|
|
1204
1214
|
}
|
|
1205
1215
|
}
|
|
1206
|
-
if (newNativeAction
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
// dynamically expand the autonomous runway so serious tasks are not interrupted!
|
|
1210
|
-
const hasRecentProgress = (nativeActionStarts - lastMutationActionIndex) <= 25 || progressiveActionsCount > 0;
|
|
1211
|
-
if (isAutonomous && hasRecentProgress && maxNativeActions < 500) {
|
|
1212
|
-
const extension = 50;
|
|
1213
|
-
maxNativeActions += extension;
|
|
1214
|
-
if (process.env.CAUSYNE_DEBUG === '1') {
|
|
1215
|
-
console.log(`[AUTONOMY] Dynamically extended native action runway (+${extension} -> ${maxNativeActions} actions) due to active progress.`);
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
else {
|
|
1216
|
+
if (newNativeAction) {
|
|
1217
|
+
nativeActionStarts++;
|
|
1218
|
+
if (!isAutonomous && Number.isFinite(maxNativeActions) && nativeActionStarts > maxNativeActions) {
|
|
1219
1219
|
const error = new Error(`Antigravity reached the ${maxNativeActions} native-action turn checkpoint. Work remains unfinished; continue from the saved session.`);
|
|
1220
1220
|
error.code = 'AGY_NATIVE_ACTION_BUDGET';
|
|
1221
1221
|
safeReject(error);
|
|
@@ -1487,10 +1487,20 @@ export class AntigravityProvider extends LLMProvider {
|
|
|
1487
1487
|
content = '';
|
|
1488
1488
|
}
|
|
1489
1489
|
const completedNativeActions = nativeActions.filter((a) => a.status === 'completed');
|
|
1490
|
-
if (!content &&
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
.
|
|
1490
|
+
if (!content && toolCalls.length === 0 && deniedActions.length === 0) {
|
|
1491
|
+
const anyActions = completedNativeActions.length > 0
|
|
1492
|
+
? completedNativeActions
|
|
1493
|
+
: nativeActions.length > 0
|
|
1494
|
+
? nativeActions
|
|
1495
|
+
: attemptedNativeTools;
|
|
1496
|
+
if (anyActions.length > 0) {
|
|
1497
|
+
content = `Antigravity executed: ${anyActions
|
|
1498
|
+
.map((a) => `${a.name}${a.detail ? ` (${a.detail})` : ''}`)
|
|
1499
|
+
.join(', ')}`;
|
|
1500
|
+
}
|
|
1501
|
+
else if (rawContent.trim()) {
|
|
1502
|
+
content = rawContent.trim();
|
|
1503
|
+
}
|
|
1494
1504
|
}
|
|
1495
1505
|
const usageIsReported = finalResultObj?.usage?.input_tokens != null
|
|
1496
1506
|
&& finalResultObj?.usage?.output_tokens != null
|
|
@@ -1599,17 +1609,24 @@ export class AntigravityProvider extends LLMProvider {
|
|
|
1599
1609
|
if (options.signal?.aborted || err?.name === 'AbortError') {
|
|
1600
1610
|
throw err;
|
|
1601
1611
|
}
|
|
1602
|
-
if (err?.code === 'PROVIDER_NO_PROGRESS')
|
|
1603
|
-
throw err;
|
|
1604
|
-
if (err?.partialUsage?.promptTokens + err?.partialUsage?.completionTokens > 0) {
|
|
1612
|
+
if (err?.code === 'AGY_NATIVE_ACTION_DENIED' || err?.code === 'AGY_TOKEN_BUDGET' || err?.code === 'PROVIDER_NO_PROGRESS') {
|
|
1605
1613
|
throw err;
|
|
1606
1614
|
}
|
|
1615
|
+
const msg = String(err?.message || '').toLowerCase();
|
|
1616
|
+
const isTransient = this._isTransientError(msg)
|
|
1617
|
+
|| err?.code === 'PROVIDER_EMPTY_RESPONSE'
|
|
1618
|
+
|| msg.includes('returned no response')
|
|
1619
|
+
|| msg.includes('connection reset')
|
|
1620
|
+
|| msg.includes('econnreset')
|
|
1621
|
+
|| msg.includes('socket hang up')
|
|
1622
|
+
|| msg.includes('streamgeneratecontent');
|
|
1607
1623
|
const canRetryResetConversation = hadConversation && !this.currentConversationId
|
|
1608
1624
|
&& err?.code !== 'AGY_NATIVE_ACTION_DENIED'
|
|
1609
1625
|
&& err?.code !== 'AGY_TOKEN_BUDGET';
|
|
1610
|
-
if (attempt < maxRetries && (
|
|
1626
|
+
if (attempt < maxRetries && (isTransient || canRetryResetConversation)) {
|
|
1611
1627
|
attempt++;
|
|
1612
|
-
|
|
1628
|
+
this.currentConversationId = null;
|
|
1629
|
+
const delay = Math.min(attempt * 1200, 3000);
|
|
1613
1630
|
await new Promise(r => setTimeout(r, delay));
|
|
1614
1631
|
continue;
|
|
1615
1632
|
}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { formatToolContracts, toolContractUpdate, contractFingerprint } from './toolContracts.js';
|
|
2
|
-
|
|
2
|
+
export function noncachedTokens(usage: { promptTokens?: number | undefined; completionTokens?: number | undefined; uncachedPromptTokens?: number | undefined; cachedPromptTokens?: number | undefined } | null | undefined): number {
|
|
3
|
+
if (!usage) return 0;
|
|
4
|
+
const finite = (value: number | undefined): number => Number.isFinite(value) ? Math.max(0, value ?? 0) : 0;
|
|
5
|
+
const input = usage.uncachedPromptTokens !== undefined
|
|
6
|
+
? finite(usage.uncachedPromptTokens)
|
|
7
|
+
: finite(usage.cachedPromptTokens) > finite(usage.promptTokens)
|
|
8
|
+
? finite(usage.promptTokens)
|
|
9
|
+
: Math.max(0, finite(usage.promptTokens) - finite(usage.cachedPromptTokens));
|
|
10
|
+
return input + finite(usage.completionTokens);
|
|
11
|
+
}
|
|
3
12
|
import { determineToolScope } from '../smartToolsUse.js';
|
|
4
13
|
import { PEER_COLLABORATION_POLICY } from './collaborationPolicy.js';
|
|
5
14
|
import { spawn } from 'node:child_process';
|
|
@@ -1008,9 +1017,9 @@ export class AntigravityProvider extends LLMProvider {
|
|
|
1008
1017
|
}
|
|
1009
1018
|
};
|
|
1010
1019
|
const configuredActions = Number(options.maxNativeActions);
|
|
1011
|
-
const isAutonomous = (options as any).hardBudget === false
|
|
1020
|
+
const isAutonomous = (options as any).hardBudget === false;
|
|
1012
1021
|
let maxNativeActions = Number.isSafeInteger(configuredActions) && configuredActions >= 0
|
|
1013
|
-
? configuredActions : desktopTask ? 12 : 35;
|
|
1022
|
+
? configuredActions : desktopTask ? 12 : isAutonomous ? Infinity : 35;
|
|
1014
1023
|
let nativeActionStarts = 0;
|
|
1015
1024
|
let lastMutationActionIndex = 0;
|
|
1016
1025
|
let progressiveActionsCount = 0;
|
|
@@ -1037,7 +1046,7 @@ export class AntigravityProvider extends LLMProvider {
|
|
|
1037
1046
|
const hasExplicitLimit = (Number.isFinite(remainingTaskBudget) && remainingTaskBudget > 0)
|
|
1038
1047
|
|| (Number.isFinite(rawTokenLimit) && rawTokenLimit > 0);
|
|
1039
1048
|
const countReportedTotal = options.tokenBudgetBasis !== 'noncached';
|
|
1040
|
-
const defaultTokenLimit =
|
|
1049
|
+
const defaultTokenLimit = 100_000;
|
|
1041
1050
|
const tokenLimit = Number.isFinite(remainingTaskBudget) && remainingTaskBudget > 0
|
|
1042
1051
|
? remainingTaskBudget
|
|
1043
1052
|
: (Number.isFinite(rawTokenLimit) && rawTokenLimit > 0
|
|
@@ -1258,18 +1267,9 @@ export class AntigravityProvider extends LLMProvider {
|
|
|
1258
1267
|
}
|
|
1259
1268
|
}
|
|
1260
1269
|
|
|
1261
|
-
if (newNativeAction
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
// dynamically expand the autonomous runway so serious tasks are not interrupted!
|
|
1265
|
-
const hasRecentProgress = (nativeActionStarts - lastMutationActionIndex) <= 25 || progressiveActionsCount > 0;
|
|
1266
|
-
if (isAutonomous && hasRecentProgress && maxNativeActions < 500) {
|
|
1267
|
-
const extension = 50;
|
|
1268
|
-
maxNativeActions += extension;
|
|
1269
|
-
if (process.env.CAUSYNE_DEBUG === '1') {
|
|
1270
|
-
console.log(`[AUTONOMY] Dynamically extended native action runway (+${extension} -> ${maxNativeActions} actions) due to active progress.`);
|
|
1271
|
-
}
|
|
1272
|
-
} else {
|
|
1270
|
+
if (newNativeAction) {
|
|
1271
|
+
nativeActionStarts++;
|
|
1272
|
+
if (!isAutonomous && Number.isFinite(maxNativeActions) && nativeActionStarts > maxNativeActions) {
|
|
1273
1273
|
const error = new Error(`Antigravity reached the ${maxNativeActions} native-action turn checkpoint. Work remains unfinished; continue from the saved session.`) as Error & { code: string };
|
|
1274
1274
|
error.code = 'AGY_NATIVE_ACTION_BUDGET';
|
|
1275
1275
|
safeReject(error);
|
|
@@ -1539,10 +1539,19 @@ export class AntigravityProvider extends LLMProvider {
|
|
|
1539
1539
|
|
|
1540
1540
|
const completedNativeActions = nativeActions.filter((a: ChatResponseAction) => a.status === 'completed');
|
|
1541
1541
|
|
|
1542
|
-
if (!content &&
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
.
|
|
1542
|
+
if (!content && toolCalls.length === 0 && deniedActions.length === 0) {
|
|
1543
|
+
const anyActions = completedNativeActions.length > 0
|
|
1544
|
+
? completedNativeActions
|
|
1545
|
+
: nativeActions.length > 0
|
|
1546
|
+
? nativeActions
|
|
1547
|
+
: attemptedNativeTools;
|
|
1548
|
+
if (anyActions.length > 0) {
|
|
1549
|
+
content = `Antigravity executed: ${anyActions
|
|
1550
|
+
.map((a: any) => `${a.name}${a.detail ? ` (${a.detail})` : ''}`)
|
|
1551
|
+
.join(', ')}`;
|
|
1552
|
+
} else if (rawContent.trim()) {
|
|
1553
|
+
content = rawContent.trim();
|
|
1554
|
+
}
|
|
1546
1555
|
}
|
|
1547
1556
|
|
|
1548
1557
|
const usageIsReported = finalResultObj?.usage?.input_tokens != null
|
|
@@ -1663,17 +1672,25 @@ export class AntigravityProvider extends LLMProvider {
|
|
|
1663
1672
|
if (options.signal?.aborted || err?.name === 'AbortError') {
|
|
1664
1673
|
throw err;
|
|
1665
1674
|
}
|
|
1666
|
-
if (err?.code === 'PROVIDER_NO_PROGRESS')
|
|
1667
|
-
if (err?.partialUsage?.promptTokens + err?.partialUsage?.completionTokens > 0) {
|
|
1675
|
+
if (err?.code === 'AGY_NATIVE_ACTION_DENIED' || err?.code === 'AGY_TOKEN_BUDGET' || err?.code === 'PROVIDER_NO_PROGRESS') {
|
|
1668
1676
|
throw err;
|
|
1669
1677
|
}
|
|
1678
|
+
const msg = String(err?.message || '').toLowerCase();
|
|
1679
|
+
const isTransient = this._isTransientError(msg)
|
|
1680
|
+
|| err?.code === 'PROVIDER_EMPTY_RESPONSE'
|
|
1681
|
+
|| msg.includes('returned no response')
|
|
1682
|
+
|| msg.includes('connection reset')
|
|
1683
|
+
|| msg.includes('econnreset')
|
|
1684
|
+
|| msg.includes('socket hang up')
|
|
1685
|
+
|| msg.includes('streamgeneratecontent');
|
|
1670
1686
|
const canRetryResetConversation =
|
|
1671
1687
|
hadConversation && !this.currentConversationId
|
|
1672
1688
|
&& (err as any)?.code !== 'AGY_NATIVE_ACTION_DENIED'
|
|
1673
1689
|
&& (err as any)?.code !== 'AGY_TOKEN_BUDGET';
|
|
1674
|
-
if (attempt < maxRetries && (
|
|
1690
|
+
if (attempt < maxRetries && (isTransient || canRetryResetConversation)) {
|
|
1675
1691
|
attempt++;
|
|
1676
|
-
|
|
1692
|
+
this.currentConversationId = null;
|
|
1693
|
+
const delay = Math.min(attempt * 1200, 3000);
|
|
1677
1694
|
await new Promise(r => setTimeout(r, delay));
|
|
1678
1695
|
continue;
|
|
1679
1696
|
}
|
package/src/smartToolsUse.js
CHANGED
|
@@ -130,8 +130,10 @@ const EXPLICIT_MEDIA_GENERATION_PATTERN = /\b(blender|3d model|render 3d|render
|
|
|
130
130
|
const EXPLICIT_WEB_ENGINEERING_PATTERN = /\b(build|create|make|design|develop|implement|redesign|buat\w*)\b[\s\S]*\b(web|website|webpage|webapp|landing page|dashboard|ui|frontend|threejs|three\.js|thre\.?js|3js|webgl|canvas)\b/i;
|
|
131
131
|
// Explicit game development intent
|
|
132
132
|
const EXPLICIT_GAME_DEV_PATTERN = /(?:\b(?:build|create|make|design|develop|scaffold|render|animate|code|program|buat\w*|bikin\w*)[\s\S]*(?:game|simulation|simulator|simulasi|interactive|3d|three\.?js|threejs|webgl|canvas3d|babylonjs|godot|unity|unreal|platformer|rpg|arcade)\b|\b(?:game|gamedev|godot|unity|unreal|platformer|rpg|arcade|simulator|simulation|simulasi|interactive)\b|\b3d\s*(?:game|app|simulator|simulation|scene|city|world|view|body|human|anatomy|model|mesh|character|rendering|visualization|experience|space|environment)\b|\bin 3d\b|[-_]3d\b|\b3d[-_]|\b(?:threejs|three\.js|webgl|canvas3d|babylonjs)\b)/i;
|
|
133
|
-
// Explicit
|
|
134
|
-
const
|
|
133
|
+
// Explicit reverse engineering and binary analysis intent
|
|
134
|
+
const EXPLICIT_REVERSE_ENGINEERING_PATTERN = /\b(reverse[-_ ]?engineering|decompile|disassemble|disasm|apk|aab|dex|radare|rizin|ghidra|jadx|apktool|mach-o|elf binary|portable executable|\.apk\b|\.aab\b|\.dex\b|\.so\b|\.dylib\b|\.wasm\b|\.asar\b)\b/i;
|
|
135
|
+
// Explicit software and systems engineering intent (backend, APIs, refactoring, algorithms, testing, architecture, CLI tools, Android/mobile)
|
|
136
|
+
const EXPLICIT_SOFTWARE_ENGINEERING_PATTERN = /(?:\b(?:build|create|code|program|develop|refactor|debug|fix|implement|test|optimize|write|add|modify|migrate|architect|architecture|engineer|benchmark|profile|audit|scaffold)\b[\s\S]*\b(?:api|backend|service|microservice|server|database|schema|endpoint|controller|auth|test|spec|algorithm|function|module|class|feature|script|pipeline|codebase|repo|repository|bug|issue|engine|tool|cli|library|sdk|migration|handler|worker|queue|stream|app|application|compose|jetpack|android|gradle|package)\b|\b(?:python|rust|golang|c\+\+|cpp|java|kotlin|swift|csharp|typescript|javascript|ruby|php|sql|bash|shell|docker|k8s|kubernetes|gradle|compose|android)\b)/i;
|
|
135
137
|
/**
|
|
136
138
|
* Select tools to preload based on prompt intent. This is never an allowlist:
|
|
137
139
|
* tool_search can add capabilities as the task develops.
|
|
@@ -141,7 +143,28 @@ export function determineToolScope(prompt, _taskShape) {
|
|
|
141
143
|
if (!text) {
|
|
142
144
|
return { toolScope: null, archetype: 'empty', suppressedPacks: [] };
|
|
143
145
|
}
|
|
144
|
-
// 1.
|
|
146
|
+
// 1. Reverse engineering & binary analysis intent
|
|
147
|
+
if (EXPLICIT_REVERSE_ENGINEERING_PATTERN.test(text)) {
|
|
148
|
+
const tools = new Set([
|
|
149
|
+
'reverse_engineering',
|
|
150
|
+
'fs_read',
|
|
151
|
+
'fs_write',
|
|
152
|
+
'fs_edit',
|
|
153
|
+
'fs_list',
|
|
154
|
+
'fs_search',
|
|
155
|
+
'sysRun',
|
|
156
|
+
'view_image',
|
|
157
|
+
'update_plan',
|
|
158
|
+
'tool_search'
|
|
159
|
+
]);
|
|
160
|
+
return {
|
|
161
|
+
toolScope: tools,
|
|
162
|
+
archetype: 'reverse_engineering',
|
|
163
|
+
suppressedPacks: ['media', 'game', 'web'],
|
|
164
|
+
reason: 'Reverse engineering intent prioritizes binary triage, decompilation, filesystem exploration, and terminal verification; suppresses creative packs.'
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
// 2. Desktop personalization (e.g. wallpaper / desktop background)
|
|
145
168
|
if (DESKTOP_PERSONALIZATION_PATTERN.test(text)) {
|
|
146
169
|
const tools = new Set([
|
|
147
170
|
'sysRun',
|
package/src/smartToolsUse.ts
CHANGED
|
@@ -176,9 +176,13 @@ const EXPLICIT_WEB_ENGINEERING_PATTERN =
|
|
|
176
176
|
const EXPLICIT_GAME_DEV_PATTERN =
|
|
177
177
|
/(?:\b(?:build|create|make|design|develop|scaffold|render|animate|code|program|buat\w*|bikin\w*)[\s\S]*(?:game|simulation|simulator|simulasi|interactive|3d|three\.?js|threejs|webgl|canvas3d|babylonjs|godot|unity|unreal|platformer|rpg|arcade)\b|\b(?:game|gamedev|godot|unity|unreal|platformer|rpg|arcade|simulator|simulation|simulasi|interactive)\b|\b3d\s*(?:game|app|simulator|simulation|scene|city|world|view|body|human|anatomy|model|mesh|character|rendering|visualization|experience|space|environment)\b|\bin 3d\b|[-_]3d\b|\b3d[-_]|\b(?:threejs|three\.js|webgl|canvas3d|babylonjs)\b)/i;
|
|
178
178
|
|
|
179
|
-
// Explicit
|
|
179
|
+
// Explicit reverse engineering and binary analysis intent
|
|
180
|
+
const EXPLICIT_REVERSE_ENGINEERING_PATTERN =
|
|
181
|
+
/\b(reverse[-_ ]?engineering|decompile|disassemble|disasm|apk|aab|dex|radare|rizin|ghidra|jadx|apktool|mach-o|elf binary|portable executable|\.apk\b|\.aab\b|\.dex\b|\.so\b|\.dylib\b|\.wasm\b|\.asar\b)\b/i;
|
|
182
|
+
|
|
183
|
+
// Explicit software and systems engineering intent (backend, APIs, refactoring, algorithms, testing, architecture, CLI tools, Android/mobile)
|
|
180
184
|
const EXPLICIT_SOFTWARE_ENGINEERING_PATTERN =
|
|
181
|
-
/(?:\b(?:build|create|code|program|develop|refactor|debug|fix|implement|test|optimize|write|add|modify|migrate|architect|engineer|benchmark|profile|audit)\b[\s\S]*\b(?:api|backend|service|microservice|server|database|schema|endpoint|controller|auth|test|spec|algorithm|function|module|class|feature|script|pipeline|codebase|repo|repository|bug|issue|engine|tool|cli|library|sdk|migration|handler|worker|queue|stream)\b|\b(?:python|rust|golang|c\+\+|cpp|java|typescript|javascript|ruby|php|sql|bash|shell|docker|k8s|kubernetes)\b)/i;
|
|
185
|
+
/(?:\b(?:build|create|code|program|develop|refactor|debug|fix|implement|test|optimize|write|add|modify|migrate|architect|architecture|engineer|benchmark|profile|audit|scaffold)\b[\s\S]*\b(?:api|backend|service|microservice|server|database|schema|endpoint|controller|auth|test|spec|algorithm|function|module|class|feature|script|pipeline|codebase|repo|repository|bug|issue|engine|tool|cli|library|sdk|migration|handler|worker|queue|stream|app|application|compose|jetpack|android|gradle|package)\b|\b(?:python|rust|golang|c\+\+|cpp|java|kotlin|swift|csharp|typescript|javascript|ruby|php|sql|bash|shell|docker|k8s|kubernetes|gradle|compose|android)\b)/i;
|
|
182
186
|
|
|
183
187
|
/**
|
|
184
188
|
* Select tools to preload based on prompt intent. This is never an allowlist:
|
|
@@ -193,7 +197,29 @@ export function determineToolScope(
|
|
|
193
197
|
return { toolScope: null, archetype: 'empty', suppressedPacks: [] };
|
|
194
198
|
}
|
|
195
199
|
|
|
196
|
-
// 1.
|
|
200
|
+
// 1. Reverse engineering & binary analysis intent
|
|
201
|
+
if (EXPLICIT_REVERSE_ENGINEERING_PATTERN.test(text)) {
|
|
202
|
+
const tools = new Set([
|
|
203
|
+
'reverse_engineering',
|
|
204
|
+
'fs_read',
|
|
205
|
+
'fs_write',
|
|
206
|
+
'fs_edit',
|
|
207
|
+
'fs_list',
|
|
208
|
+
'fs_search',
|
|
209
|
+
'sysRun',
|
|
210
|
+
'view_image',
|
|
211
|
+
'update_plan',
|
|
212
|
+
'tool_search'
|
|
213
|
+
]);
|
|
214
|
+
return {
|
|
215
|
+
toolScope: tools,
|
|
216
|
+
archetype: 'reverse_engineering',
|
|
217
|
+
suppressedPacks: ['media', 'game', 'web'],
|
|
218
|
+
reason: 'Reverse engineering intent prioritizes binary triage, decompilation, filesystem exploration, and terminal verification; suppresses creative packs.'
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// 2. Desktop personalization (e.g. wallpaper / desktop background)
|
|
197
223
|
if (DESKTOP_PERSONALIZATION_PATTERN.test(text)) {
|
|
198
224
|
const tools = new Set([
|
|
199
225
|
'sysRun',
|