@causyne/agent 1.20.63 → 1.20.68
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 +23 -15
- package/src/agentLoop.ts +23 -15
- package/src/approvalPolicy.js +19 -0
- package/src/approvalPolicy.ts +18 -0
- package/src/browser/causyneBrowser.js +34 -4
- package/src/browser/causyneBrowser.ts +32 -4
- package/src/cliMode.js +65 -36
- package/src/commands.js +48 -19
- package/src/contextManager.js +1 -1
- package/src/continuum/ui/continuumPicker.js +1 -1
- package/src/continuum/ui/continuumPicker.ts +1 -1
- package/src/embodimentSession.js +1 -1
- package/src/planCache.js +1 -1
- package/src/planCache.ts +1 -1
- package/src/promptMentions.js +7 -7
- package/src/promptMentions.ts +7 -7
- package/src/providers/dashscope-byok.js +1 -1
- package/src/providers/qwen-byok.js +1 -1
- package/src/skillsManager.d.ts +4 -1
- package/src/tokenTracker.js +1 -1
- package/src/tokenTracker.ts +1 -1
- package/src/tool-scripts/ax_snapshot.ps1 +10 -10
- package/src/tools/fsList.js +1 -1
- package/src/tools/memoryWrite.js +1 -1
- package/src/tools/memoryWrite.ts +1 -1
- package/src/tui/chatRenderer.js +3 -2
- package/src/tui/codeStreamRenderer.js +8 -5
- package/src/tui/codeStreamRenderer.ts +10 -5
- package/src/tui/composerControls.js +2 -0
- package/src/tui/composerControls.ts +2 -0
- package/src/tui/dialogs.js +36 -4
- package/src/tui/lineEditor.js +14 -21
- package/src/tui/modelPicker.js +1 -1
- package/src/tui/modelPicker.ts +1 -1
- package/src/tui/prompt.js +48 -16
- package/src/tui/sessionPicker.js +1 -1
- package/src/tui/sessionPicker.ts +1 -1
- package/src/tui/sessionSidebar.js +13 -0
- package/src/tui/sessionSidebar.ts +15 -0
- package/src/tui/skillAuthoring.js +147 -0
- package/src/tui/skillAuthoring.ts +172 -0
- package/src/tui/stage.js +1 -1
- package/src/tui/stageSurface.js +8 -10
- package/src/tui/theme.js +3 -0
- package/src/vfeTracker.js +1 -1
- package/src/vfeTracker.ts +1 -1
package/src/commands.js
CHANGED
|
@@ -191,7 +191,15 @@ export const COMMANDS = [
|
|
|
191
191
|
+ 'A skill name is one word: lowercase letters, digits and hyphens.');
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
if (
|
|
194
|
+
if (action === 'clear' || action === 'off' || action === 'reset') {
|
|
195
|
+
return { ok: true, effect: 'clear-skill', output: 'Active skill cleared.' };
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (!action || (action === 'new' && !target) || action === 'create') {
|
|
199
|
+
return { ok: true, effect: 'create-skill' };
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (action === 'mine' || action === 'list') {
|
|
195
203
|
const own = mine();
|
|
196
204
|
const problems = userSkillProblems();
|
|
197
205
|
const lines = [`Your own skills (${own.length})`, ''];
|
|
@@ -286,7 +294,11 @@ export const COMMANDS = [
|
|
|
286
294
|
label: domain,
|
|
287
295
|
description: `${skills.filter((s) => s.domain === domain).length} skills`
|
|
288
296
|
}));
|
|
289
|
-
|
|
297
|
+
const base = [
|
|
298
|
+
{ value: 'clear', label: 'clear', description: 'clear the currently active skill' },
|
|
299
|
+
...domains
|
|
300
|
+
];
|
|
301
|
+
return base.concat(skills.map((skill) => ({
|
|
290
302
|
value: `${skill.domain}/${skill.id}`,
|
|
291
303
|
// Rank against the skill id as well as the full path, so typing the
|
|
292
304
|
// skill name alone finds it without knowing which domain it lives in.
|
|
@@ -298,6 +310,10 @@ export const COMMANDS = [
|
|
|
298
310
|
run: (argv) => {
|
|
299
311
|
const [target] = argv;
|
|
300
312
|
|
|
313
|
+
if (target === 'clear' || target === 'off' || target === 'reset') {
|
|
314
|
+
return { ok: true, effect: 'clear-skill', output: 'Active skill cleared.' };
|
|
315
|
+
}
|
|
316
|
+
|
|
301
317
|
if (!target) {
|
|
302
318
|
const catalogue = listCompiledSkills();
|
|
303
319
|
if (catalogue.length === 0) return ok('No skills are compiled into this build.');
|
|
@@ -322,7 +338,18 @@ export const COMMANDS = [
|
|
|
322
338
|
summary.push(`${catalogue.length} skills across ${byDomain.size} domains.`);
|
|
323
339
|
summary.push('Read one with /skills <domain>/<skill>.');
|
|
324
340
|
|
|
325
|
-
|
|
341
|
+
const pickerItems = [
|
|
342
|
+
{
|
|
343
|
+
domain: 'custom',
|
|
344
|
+
id: 'create',
|
|
345
|
+
name: '+ Create new skill...',
|
|
346
|
+
description: 'Author a new custom procedure with interactive wizard',
|
|
347
|
+
isCreateAction: true
|
|
348
|
+
},
|
|
349
|
+
...catalogue
|
|
350
|
+
];
|
|
351
|
+
|
|
352
|
+
return { ok: true, output: summary.join('\n'), effect: 'pick-skill', items: pickerItems };
|
|
326
353
|
}
|
|
327
354
|
|
|
328
355
|
if (target.includes('/')) {
|
|
@@ -1302,7 +1329,7 @@ export const COMMANDS = [
|
|
|
1302
1329
|
lines.push('ACP PEER AGENTS (Local Coding Agents & CLI Engines)');
|
|
1303
1330
|
lines.push('────────────────────────────────────────────────────────────');
|
|
1304
1331
|
for (const peer of overview.acp) {
|
|
1305
|
-
const icon = peer.installed ? '
|
|
1332
|
+
const icon = peer.installed ? '✓' : '✕';
|
|
1306
1333
|
const status = peer.installed ? (peer.isCurrent ? 'READY (Active)' : 'READY') : 'NOT INSTALLED';
|
|
1307
1334
|
lines.push(` ${icon} ${peer.label.padEnd(24)} — ${status}`);
|
|
1308
1335
|
}
|
|
@@ -1356,7 +1383,7 @@ export const COMMANDS = [
|
|
|
1356
1383
|
lines.push('ACP PEER AGENTS (Local Agents & CLI Engines)');
|
|
1357
1384
|
lines.push('============================================================');
|
|
1358
1385
|
for (const peer of overview.acp) {
|
|
1359
|
-
const icon = peer.installed ? '
|
|
1386
|
+
const icon = peer.installed ? '✓' : '✕';
|
|
1360
1387
|
const status = peer.installed ? (peer.isCurrent ? 'READY (Active)' : 'READY') : 'NOT INSTALLED';
|
|
1361
1388
|
lines.push(` ${icon} ${peer.label} — ${status}`);
|
|
1362
1389
|
lines.push(` Command: ${peer.command}`);
|
|
@@ -1413,7 +1440,7 @@ export const COMMANDS = [
|
|
|
1413
1440
|
const latencyMs = Math.round(performance.now() - t0);
|
|
1414
1441
|
|
|
1415
1442
|
const outputLines = [
|
|
1416
|
-
|
|
1443
|
+
`✓ API Call Test Succeeded: "${targetProvider}" / "${providerInstance.model || targetModel || 'default'}"`,
|
|
1417
1444
|
'',
|
|
1418
1445
|
` • Round-trip Latency : ${latencyMs} ms`,
|
|
1419
1446
|
` • Response Content : ${JSON.stringify(response.content || '').slice(0, 80)}`,
|
|
@@ -1424,7 +1451,7 @@ export const COMMANDS = [
|
|
|
1424
1451
|
return ok(outputLines.join('\n'));
|
|
1425
1452
|
} catch (err) {
|
|
1426
1453
|
return fail(
|
|
1427
|
-
|
|
1454
|
+
`✕ API Call Test Failed for "${targetProvider}" / "${targetModel || config.model || 'default'}":\n\n`
|
|
1428
1455
|
+ ` Error: ${err.message || err}\n\n`
|
|
1429
1456
|
+ `Checks:\n`
|
|
1430
1457
|
+ ` - Verify the API key in /setup.\n`
|
|
@@ -1714,7 +1741,7 @@ export const COMMANDS = [
|
|
|
1714
1741
|
const detected = await detectAllPeers();
|
|
1715
1742
|
const lines = ['Discovered ACP Peer Agents', ''];
|
|
1716
1743
|
for (const item of detected) {
|
|
1717
|
-
const statusIcon = item.status === 'ready' ? '
|
|
1744
|
+
const statusIcon = item.status === 'ready' ? '✓' : (item.status === 'needs_auth' ? '△ ' : '✕');
|
|
1718
1745
|
lines.push(` ${statusIcon} ${item.id} (${item.label}) — ${item.status.toUpperCase()}`);
|
|
1719
1746
|
lines.push(` Command: ${item.command} ${item.args.join(' ')}`);
|
|
1720
1747
|
if (item.details) lines.push(` Details: ${item.details}`);
|
|
@@ -1732,7 +1759,7 @@ export const COMMANDS = [
|
|
|
1732
1759
|
const { resolveAgyBinary } = await import('./providers/antigravity.js');
|
|
1733
1760
|
const bin = resolveAgyBinary();
|
|
1734
1761
|
return ok(
|
|
1735
|
-
|
|
1762
|
+
`✓ Agent Peer Test Passed: "antigravity"\n\n`
|
|
1736
1763
|
+ `Agent: Google Antigravity (AGY)\n`
|
|
1737
1764
|
+ `Command: ${bin} --output-format json\n`
|
|
1738
1765
|
+ `Policy: local-cli\n`
|
|
@@ -1753,7 +1780,7 @@ export const COMMANDS = [
|
|
|
1753
1780
|
if (handshake.ready) {
|
|
1754
1781
|
const name = handshake.agentInfo ? `${handshake.agentInfo.name} ${handshake.agentInfo.version}` : profile.label;
|
|
1755
1782
|
return ok(
|
|
1756
|
-
|
|
1783
|
+
`✓ ACP Peer Test Passed: "${peerId}"\n\n`
|
|
1757
1784
|
+ `Agent: ${name}\n`
|
|
1758
1785
|
+ `Command: ${profile.command} ${profile.args.join(' ')}\n`
|
|
1759
1786
|
+ `Policy: ${profile.policy}\n`
|
|
@@ -1762,7 +1789,7 @@ export const COMMANDS = [
|
|
|
1762
1789
|
);
|
|
1763
1790
|
} else {
|
|
1764
1791
|
return fail(
|
|
1765
|
-
|
|
1792
|
+
`✕ ACP Peer Test Failed: "${peerId}"\n\n`
|
|
1766
1793
|
+ `Error: ${handshake.error || 'Handshake failed'}\n`
|
|
1767
1794
|
+ `Command: ${profile.command} ${profile.args.join(' ')}`
|
|
1768
1795
|
);
|
|
@@ -2234,6 +2261,8 @@ export const COMMANDS = [
|
|
|
2234
2261
|
ctx.loop.setAutonomyMode(target);
|
|
2235
2262
|
}
|
|
2236
2263
|
if (ctx.prompt) {
|
|
2264
|
+
ctx.prompt.renderer?.status?.setSession?.({ autonomyMode: target });
|
|
2265
|
+
ctx.prompt.surface?.setSessionInfo?.({ autonomyMode: target });
|
|
2237
2266
|
ctx.prompt.notice = `Mode ${target} active`;
|
|
2238
2267
|
if (ctx.prompt.scheduleDraw) ctx.prompt.scheduleDraw();
|
|
2239
2268
|
return ok(`Autonomy mode switched to ${target}.`, { effect: 'inline' });
|
|
@@ -2255,8 +2284,8 @@ export const COMMANDS = [
|
|
|
2255
2284
|
|
|
2256
2285
|
const nodeVer = process.version;
|
|
2257
2286
|
const nodeOk = parseInt(nodeVer.slice(1).split('.')[0], 10) >= 24;
|
|
2258
|
-
lines.push(` ${nodeOk ? '
|
|
2259
|
-
lines.push(`
|
|
2287
|
+
lines.push(` ${nodeOk ? '✓' : '△'} Node.js version : ${nodeVer} ${nodeOk ? '(supported)' : '(Node >= 24 required)'}`);
|
|
2288
|
+
lines.push(` • Platform : ${process.platform} (${process.arch})`);
|
|
2260
2289
|
|
|
2261
2290
|
const ws = ctx.loop?.workspaceRoot || process.cwd();
|
|
2262
2291
|
let isGit = false;
|
|
@@ -2264,19 +2293,19 @@ export const COMMANDS = [
|
|
|
2264
2293
|
execSync('git rev-parse --is-inside-work-tree', { cwd: ws, stdio: 'pipe' });
|
|
2265
2294
|
isGit = true;
|
|
2266
2295
|
} catch {}
|
|
2267
|
-
lines.push(`
|
|
2268
|
-
lines.push(` ${isGit ? '
|
|
2296
|
+
lines.push(` ✓ Workspace root : ${ws}`);
|
|
2297
|
+
lines.push(` ${isGit ? '✓' : '•'} Git repository : ${isGit ? 'active' : 'not a git repo'}`);
|
|
2269
2298
|
|
|
2270
2299
|
const provider = config.provider || 'not configured';
|
|
2271
2300
|
const model = config.model || 'default';
|
|
2272
|
-
lines.push(`
|
|
2301
|
+
lines.push(` • Provider / Model : ${provider} / ${model}`);
|
|
2273
2302
|
|
|
2274
2303
|
const servers = serverStatus();
|
|
2275
2304
|
const grantedCount = servers.filter(s => s.granted).length;
|
|
2276
|
-
lines.push(`
|
|
2305
|
+
lines.push(` • MCP Servers : ${servers.length} configured (${grantedCount} granted)`);
|
|
2277
2306
|
|
|
2278
2307
|
const peers = listAllPeers();
|
|
2279
|
-
lines.push(`
|
|
2308
|
+
lines.push(` • ACP Peers : ${peers.length} available`);
|
|
2280
2309
|
|
|
2281
2310
|
lines.push('');
|
|
2282
2311
|
lines.push('All diagnostic invariants passed. Run /peers detect or /model list for component details.');
|
|
@@ -2309,7 +2338,7 @@ export const COMMANDS = [
|
|
|
2309
2338
|
const body = session.messages
|
|
2310
2339
|
.filter(m => m.role !== 'system')
|
|
2311
2340
|
.map(m => {
|
|
2312
|
-
const roleLabel = m.role === 'user' ? '###
|
|
2341
|
+
const roleLabel = m.role === 'user' ? '### User' : '### Causyne Agent';
|
|
2313
2342
|
return `${roleLabel}\n\n${typeof m.content === 'string' ? m.content : JSON.stringify(m.content, null, 2)}\n`;
|
|
2314
2343
|
})
|
|
2315
2344
|
.join('\n---\n\n');
|
package/src/contextManager.js
CHANGED
|
@@ -495,7 +495,7 @@ export function snipOversizedToolOutputs(messages, options = {}) {
|
|
|
495
495
|
const tail = msg.content.slice(-tailChars);
|
|
496
496
|
const pointer = msg.spillPath ? ` Full output preserved at: ${msg.spillPath}.` : '';
|
|
497
497
|
|
|
498
|
-
msg.content = `${head}\n\n[...
|
|
498
|
+
msg.content = `${head}\n\n[... SNIPPED ${removed.toLocaleString()} CHARS (${Math.round(removed / CHARS_PER_TOKEN).toLocaleString()} TOKENS) TO PREVENT CONTEXT OVERFLOW.${pointer} Use targeted file reads to inspect specific sections ...] \n\n${tail}`;
|
|
499
499
|
|
|
500
500
|
snippedCount++;
|
|
501
501
|
reclaimedChars += (len - msg.content.length);
|
|
@@ -110,7 +110,7 @@ export async function openContinuumPreview(sessionId, prompt, scanner) {
|
|
|
110
110
|
''
|
|
111
111
|
];
|
|
112
112
|
for (const msg of detail.messages) {
|
|
113
|
-
const rolePrefix = msg.role === 'user' ? '
|
|
113
|
+
const rolePrefix = msg.role === 'user' ? 'USER' : 'ASSISTANT';
|
|
114
114
|
lines.push(`${rolePrefix}:`);
|
|
115
115
|
for (const textLine of msg.content.split('\n')) {
|
|
116
116
|
lines.push(` ${textLine}`);
|
|
@@ -143,7 +143,7 @@ export async function openContinuumPreview(
|
|
|
143
143
|
];
|
|
144
144
|
|
|
145
145
|
for (const msg of detail.messages) {
|
|
146
|
-
const rolePrefix = msg.role === 'user' ? '
|
|
146
|
+
const rolePrefix = msg.role === 'user' ? 'USER' : 'ASSISTANT';
|
|
147
147
|
lines.push(`${rolePrefix}:`);
|
|
148
148
|
for (const textLine of msg.content.split('\n')) {
|
|
149
149
|
lines.push(` ${textLine}`);
|
package/src/embodimentSession.js
CHANGED
|
@@ -145,7 +145,7 @@ export function describeSession(taskId) {
|
|
|
145
145
|
parts.push('You do NOT know whether they landed — the screen may have changed while you were gone.');
|
|
146
146
|
}
|
|
147
147
|
parts.push('Call ax_snapshot before acting again, and compare what you see to what you expected.');
|
|
148
|
-
return `\n\n
|
|
148
|
+
return `\n\n◆ EMBODIMENT SESSION\n${parts.join(' ')}`;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
/** Drop a task's session, e.g. when the task completes. */
|
package/src/planCache.js
CHANGED
|
@@ -877,7 +877,7 @@ export function renderPlanHint(match) {
|
|
|
877
877
|
.filter(({ step }) => !step.ok);
|
|
878
878
|
if (failureWarnings.length > 0) {
|
|
879
879
|
lines.push('');
|
|
880
|
-
lines.push('
|
|
880
|
+
lines.push('△ FAILURE ROUTE WARNINGS (learned from previous attempts — plan alternatives):');
|
|
881
881
|
failureWarnings.forEach(({ step, idx }) => {
|
|
882
882
|
lines.push(`- Step ${idx} (${step.tool}${step.note ? ' → ' + step.note : ''}) FAILED with reason: ${step.why || 'failed'}. Consider an alternative approach.`);
|
|
883
883
|
});
|
package/src/planCache.ts
CHANGED
|
@@ -1026,7 +1026,7 @@ export function renderPlanHint(match: PlanMatch | null | undefined): string {
|
|
|
1026
1026
|
|
|
1027
1027
|
if (failureWarnings.length > 0) {
|
|
1028
1028
|
lines.push('');
|
|
1029
|
-
lines.push('
|
|
1029
|
+
lines.push('△ FAILURE ROUTE WARNINGS (learned from previous attempts — plan alternatives):');
|
|
1030
1030
|
failureWarnings.forEach(({ step, idx }) => {
|
|
1031
1031
|
lines.push(`- Step ${idx} (${step.tool}${step.note ? ' → ' + step.note : ''}) FAILED with reason: ${step.why || 'failed'}. Consider an alternative approach.`);
|
|
1032
1032
|
});
|
package/src/promptMentions.js
CHANGED
|
@@ -74,10 +74,10 @@ export async function resolveMentionedContext(prompt, options = {}) {
|
|
|
74
74
|
for (const m of mentions) {
|
|
75
75
|
if (m.isMeta) {
|
|
76
76
|
if (m.path === 'workspace' || m.path === 'here') {
|
|
77
|
-
sections.push(
|
|
77
|
+
sections.push(`◆ REFERENCED SCOPE: Whole workspace (${cwd})`);
|
|
78
78
|
}
|
|
79
79
|
else if (m.path === 'rea' || m.path === 'rea-agents') {
|
|
80
|
-
sections.push(
|
|
80
|
+
sections.push(`◆ REFERENCED CAPABILITY: Reverse Engineer Anything (REA) Substrate active.\n` +
|
|
81
81
|
`Use the 'reverse_engineering' tool with action 'inspect', 'unpack', 'decompile', or 'engine_tool' to analyze APKs, binaries, and assemblies.`);
|
|
82
82
|
}
|
|
83
83
|
continue;
|
|
@@ -120,7 +120,7 @@ export async function resolveMentionedContext(prompt, options = {}) {
|
|
|
120
120
|
}
|
|
121
121
|
const relPath = path.relative(cwd, targetPath).split(path.sep).join('/');
|
|
122
122
|
if (!found) {
|
|
123
|
-
sections.push(
|
|
123
|
+
sections.push(`◆ REFERENCED PATH: ${m.path} (Note: path was not found on disk at ${relPath})`);
|
|
124
124
|
continue;
|
|
125
125
|
}
|
|
126
126
|
try {
|
|
@@ -134,7 +134,7 @@ export async function resolveMentionedContext(prompt, options = {}) {
|
|
|
134
134
|
const more = entries.length > MAX_MENTION_DIR_ITEMS
|
|
135
135
|
? `\n ... (${entries.length - MAX_MENTION_DIR_ITEMS} more items)`
|
|
136
136
|
: '';
|
|
137
|
-
sections.push(
|
|
137
|
+
sections.push(`◆ REFERENCED DIRECTORY: ${relPath}/\n` +
|
|
138
138
|
`Directory listing (${summary.length} items):\n` +
|
|
139
139
|
summary.map(s => ` - ${s}`).join('\n') +
|
|
140
140
|
more);
|
|
@@ -144,7 +144,7 @@ export async function resolveMentionedContext(prompt, options = {}) {
|
|
|
144
144
|
const isBinary = /\.(apk|aab|dex|dylib|so|dll|exe|bin|asar|zip|tar|gz|tgz)$/i.test(ext);
|
|
145
145
|
if (isBinary) {
|
|
146
146
|
const sizeMb = (stats.size / (1024 * 1024)).toFixed(2);
|
|
147
|
-
sections.push(
|
|
147
|
+
sections.push(`◆ REFERENCED BINARY PACKAGE: ${relPath} (${stats.size.toLocaleString()} bytes, ~${sizeMb} MB, format: ${ext.toUpperCase().replace('.', '')})\n` +
|
|
148
148
|
`Note: This is a binary/compiled package. Do not read raw bytes. Use the 'reverse_engineering' tool with action 'inspect', 'unpack', or 'decompile' to analyze manifest, classes, resources, and architecture.`);
|
|
149
149
|
}
|
|
150
150
|
else {
|
|
@@ -158,7 +158,7 @@ export async function resolveMentionedContext(prompt, options = {}) {
|
|
|
158
158
|
else {
|
|
159
159
|
body = content;
|
|
160
160
|
}
|
|
161
|
-
sections.push(
|
|
161
|
+
sections.push(`◆ REFERENCED FILE: ${relPath} (${lines.length} lines):\n` +
|
|
162
162
|
'```\n' +
|
|
163
163
|
body + '\n' +
|
|
164
164
|
'```');
|
|
@@ -167,7 +167,7 @@ export async function resolveMentionedContext(prompt, options = {}) {
|
|
|
167
167
|
}
|
|
168
168
|
catch (err) {
|
|
169
169
|
const msg = err instanceof Error ? err.message : String(err);
|
|
170
|
-
sections.push(
|
|
170
|
+
sections.push(`◆ REFERENCED PATH: ${relPath} (Error reading: ${msg})`);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
const referencedContext = sections.length > 0
|
package/src/promptMentions.ts
CHANGED
|
@@ -105,10 +105,10 @@ export async function resolveMentionedContext(
|
|
|
105
105
|
for (const m of mentions) {
|
|
106
106
|
if (m.isMeta) {
|
|
107
107
|
if (m.path === 'workspace' || m.path === 'here') {
|
|
108
|
-
sections.push(
|
|
108
|
+
sections.push(`◆ REFERENCED SCOPE: Whole workspace (${cwd})`);
|
|
109
109
|
} else if (m.path === 'rea' || m.path === 'rea-agents') {
|
|
110
110
|
sections.push(
|
|
111
|
-
|
|
111
|
+
`◆ REFERENCED CAPABILITY: Reverse Engineer Anything (REA) Substrate active.\n` +
|
|
112
112
|
`Use the 'reverse_engineering' tool with action 'inspect', 'unpack', 'decompile', or 'engine_tool' to analyze APKs, binaries, and assemblies.`
|
|
113
113
|
);
|
|
114
114
|
}
|
|
@@ -156,7 +156,7 @@ export async function resolveMentionedContext(
|
|
|
156
156
|
const relPath = path.relative(cwd, targetPath).split(path.sep).join('/');
|
|
157
157
|
|
|
158
158
|
if (!found) {
|
|
159
|
-
sections.push(
|
|
159
|
+
sections.push(`◆ REFERENCED PATH: ${m.path} (Note: path was not found on disk at ${relPath})`);
|
|
160
160
|
continue;
|
|
161
161
|
}
|
|
162
162
|
|
|
@@ -174,7 +174,7 @@ export async function resolveMentionedContext(
|
|
|
174
174
|
: '';
|
|
175
175
|
|
|
176
176
|
sections.push(
|
|
177
|
-
|
|
177
|
+
`◆ REFERENCED DIRECTORY: ${relPath}/\n` +
|
|
178
178
|
`Directory listing (${summary.length} items):\n` +
|
|
179
179
|
summary.map(s => ` - ${s}`).join('\n') +
|
|
180
180
|
more
|
|
@@ -185,7 +185,7 @@ export async function resolveMentionedContext(
|
|
|
185
185
|
if (isBinary) {
|
|
186
186
|
const sizeMb = (stats.size / (1024 * 1024)).toFixed(2);
|
|
187
187
|
sections.push(
|
|
188
|
-
|
|
188
|
+
`◆ REFERENCED BINARY PACKAGE: ${relPath} (${stats.size.toLocaleString()} bytes, ~${sizeMb} MB, format: ${ext.toUpperCase().replace('.', '')})\n` +
|
|
189
189
|
`Note: This is a binary/compiled package. Do not read raw bytes. Use the 'reverse_engineering' tool with action 'inspect', 'unpack', or 'decompile' to analyze manifest, classes, resources, and architecture.`
|
|
190
190
|
);
|
|
191
191
|
} else {
|
|
@@ -200,7 +200,7 @@ export async function resolveMentionedContext(
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
sections.push(
|
|
203
|
-
|
|
203
|
+
`◆ REFERENCED FILE: ${relPath} (${lines.length} lines):\n` +
|
|
204
204
|
'```\n' +
|
|
205
205
|
body + '\n' +
|
|
206
206
|
'```'
|
|
@@ -209,7 +209,7 @@ export async function resolveMentionedContext(
|
|
|
209
209
|
}
|
|
210
210
|
} catch (err: unknown) {
|
|
211
211
|
const msg = err instanceof Error ? err.message : String(err);
|
|
212
|
-
sections.push(
|
|
212
|
+
sections.push(`◆ REFERENCED PATH: ${relPath} (Error reading: ${msg})`);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
|
|
@@ -65,7 +65,7 @@ export class DashscopeByokProvider extends LLMProvider {
|
|
|
65
65
|
// Enterprise Error Handling: Detect Workspace-bound API Key configuration errors
|
|
66
66
|
if (response.status === 401 && this.apiKey && this.apiKey.startsWith('sk-ws-')) {
|
|
67
67
|
if (!this.baseUrl.includes('ws-')) {
|
|
68
|
-
throw new Error(`\n
|
|
68
|
+
throw new Error(`\n[QWEN WORKSPACE CONFIGURATION ERROR]\n\nYou are using a Workspace-bound API Key (starts with sk-ws-), but you haven't configured your Workspace Base URL!\n\nAlibaba requires a specific URL for these keys.\n\nHOW TO FIX THIS:\n1. Open your computer terminal.\n2. Run command: causyne-agent config\n3. When asked for 'Custom Base URL', paste your Workspace URL from Alibaba (e.g. https://{Your-Workspace-ID}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions).\n\nAlternatively, use a Standard API Key (starts with sk-) which does not require a custom URL.`);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -55,7 +55,7 @@ export class QwenByokProvider extends LLMProvider {
|
|
|
55
55
|
// Enterprise Error Handling: Detect Workspace-bound API Key configuration errors
|
|
56
56
|
if (response.status === 401 && this.apiKey && this.apiKey.startsWith('sk-ws-')) {
|
|
57
57
|
if (!this.baseUrl.includes('ws-')) {
|
|
58
|
-
throw new Error(`\n
|
|
58
|
+
throw new Error(`\n[QWEN WORKSPACE CONFIGURATION ERROR]\n\nYou are using a Workspace-bound API Key (starts with sk-ws-), but you haven't configured your Workspace Base URL!\n\nAlibaba requires a specific URL for these keys.\n\nHOW TO FIX THIS:\n1. Open your computer terminal.\n2. Run command: causyne-agent config\n3. When asked for 'Custom Base URL', paste your Workspace URL from Alibaba (e.g. https://{Your-Workspace-ID}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions).\n\nAlternatively, use a Standard API Key (starts with sk-) which does not require a custom URL.`);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
package/src/skillsManager.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export function detectWorkspaceDomains(...args: any[]): any;
|
|
2
2
|
export function ensureSkillRepo(...args: any[]): any;
|
|
3
3
|
export function getSkillDomainHeader(...args: any[]): any;
|
|
4
|
-
export function listCompiledSkills(): Array<{ id: string; name: string; domain: string; description?: string }>;
|
|
4
|
+
export function listCompiledSkills(): Array<{ id: string; name: string; domain: string; description?: string; source?: string }>;
|
|
5
|
+
export function readCompiledSkill(domain: string, skillId: string): string;
|
|
6
|
+
export function invalidateUserSkills(): void;
|
|
7
|
+
export function userSkillProblems(): string[];
|
package/src/tokenTracker.js
CHANGED
|
@@ -222,7 +222,7 @@ export class TokenTracker {
|
|
|
222
222
|
if (alertThreshold && alertThreshold > 0 && daily.totalTokens >= alertThreshold && !daily.alertSent) {
|
|
223
223
|
daily.alertSent = true;
|
|
224
224
|
await this.saveDailyUsage(daily);
|
|
225
|
-
const msg =
|
|
225
|
+
const msg = `△ Token Budget Alert: Your BYOK usage has reached ${daily.totalTokens.toLocaleString()} tokens (Threshold: ${alertThreshold.toLocaleString()}).`;
|
|
226
226
|
if (onWarning) {
|
|
227
227
|
onWarning(msg);
|
|
228
228
|
}
|
package/src/tokenTracker.ts
CHANGED
|
@@ -315,7 +315,7 @@ export class TokenTracker {
|
|
|
315
315
|
daily.alertSent = true;
|
|
316
316
|
await this.saveDailyUsage(daily);
|
|
317
317
|
|
|
318
|
-
const msg =
|
|
318
|
+
const msg = `△ Token Budget Alert: Your BYOK usage has reached ${daily.totalTokens.toLocaleString()} tokens (Threshold: ${alertThreshold.toLocaleString()}).`;
|
|
319
319
|
if (onWarning) {
|
|
320
320
|
onWarning(msg);
|
|
321
321
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
Add-Type -AssemblyName UIAutomationClient,UIAutomationTypes
|
|
2
|
-
$max = [int]$args[0]
|
|
3
|
-
$root = [System.Windows.Automation.AutomationElement]::RootElement
|
|
4
|
-
$cond = [System.Windows.Automation.Condition]::TrueCondition
|
|
5
|
-
$n = 0
|
|
6
|
-
foreach ($e in $root.FindAll([System.Windows.Automation.TreeScope]::Descendants, $cond)) {
|
|
7
|
-
if ($n -ge $max) { break }
|
|
8
|
-
$name = $e.Current.Name
|
|
9
|
-
if ($name) { Write-Output ("" + $e.Current.ControlType.ProgrammaticName + "|" + $name + "|"); $n++ }
|
|
10
|
-
}
|
|
1
|
+
Add-Type -AssemblyName UIAutomationClient,UIAutomationTypes
|
|
2
|
+
$max = [int]$args[0]
|
|
3
|
+
$root = [System.Windows.Automation.AutomationElement]::RootElement
|
|
4
|
+
$cond = [System.Windows.Automation.Condition]::TrueCondition
|
|
5
|
+
$n = 0
|
|
6
|
+
foreach ($e in $root.FindAll([System.Windows.Automation.TreeScope]::Descendants, $cond)) {
|
|
7
|
+
if ($n -ge $max) { break }
|
|
8
|
+
$name = $e.Current.Name
|
|
9
|
+
if ($name) { Write-Output ("" + $e.Current.ControlType.ProgrammaticName + "|" + $name + "|"); $n++ }
|
|
10
|
+
}
|
package/src/tools/fsList.js
CHANGED
|
@@ -67,7 +67,7 @@ export const fsList = {
|
|
|
67
67
|
const maxDepth = args.depth || 2;
|
|
68
68
|
|
|
69
69
|
const tree = await generateTree(target, 1, maxDepth);
|
|
70
|
-
const header =
|
|
70
|
+
const header = `${target}\n`;
|
|
71
71
|
|
|
72
72
|
return { success: true, output: header + (tree || ' (Empty or access denied)') };
|
|
73
73
|
} catch (e) {
|
package/src/tools/memoryWrite.js
CHANGED
|
@@ -71,7 +71,7 @@ export const memoryWrite = {
|
|
|
71
71
|
if (dependencies && typeof dependencies.broadcast === 'function') {
|
|
72
72
|
dependencies.broadcast({
|
|
73
73
|
type: 'agent_message',
|
|
74
|
-
content:
|
|
74
|
+
content: `◆ Persistent memory updated: "${fact}"`
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
const notes = [
|
package/src/tools/memoryWrite.ts
CHANGED
|
@@ -98,7 +98,7 @@ export const memoryWrite = {
|
|
|
98
98
|
if (dependencies && typeof dependencies.broadcast === 'function') {
|
|
99
99
|
dependencies.broadcast({
|
|
100
100
|
type: 'agent_message',
|
|
101
|
-
content:
|
|
101
|
+
content: `◆ Persistent memory updated: "${fact}"`
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
|
package/src/tui/chatRenderer.js
CHANGED
|
@@ -1219,8 +1219,9 @@ export class ChatRenderer {
|
|
|
1219
1219
|
// single write put the continuation lines at column 0, under a marker
|
|
1220
1220
|
// indented five columns, so the whole block read as unrelated fragments.
|
|
1221
1221
|
const label = `${msg.tool || ''}`.trim();
|
|
1222
|
-
const
|
|
1223
|
-
const
|
|
1222
|
+
const rawError = msg.error || (msg.result && (msg.result.error || msg.result.message)) || '';
|
|
1223
|
+
const detail = safeDisplay(`${rawError}`.trim());
|
|
1224
|
+
const head = label && detail ? `${label} ${detail}` : (detail || label || 'failed');
|
|
1224
1225
|
|
|
1225
1226
|
this.frame('error', () => {
|
|
1226
1227
|
const rows = wrapBlock(head, Math.max(20, this.width() - 7), { hang: 0 });
|
|
@@ -35,15 +35,18 @@ export class CodeStreamRenderer extends ChatRenderer {
|
|
|
35
35
|
const transcript = this.transcript;
|
|
36
36
|
if (!transcript || !Array.isArray(transcript.frames))
|
|
37
37
|
return;
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
38
|
+
const activeFrame = transcript.frames.findLast((f) => f?.meta?.reasoning === true && f.meta?.streaming === true);
|
|
39
|
+
if (activeFrame && activeFrame.meta) {
|
|
40
40
|
if (nowMs > 0) {
|
|
41
|
-
|
|
41
|
+
activeFrame.meta.durationText = formatElapsed(nowMs);
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
activeFrame.rows = null;
|
|
44
|
+
activeFrame.renderedWidth = -1;
|
|
45
45
|
transcript.cache = null;
|
|
46
46
|
transcript.revision++;
|
|
47
|
+
if (typeof transcript.changed === 'function') {
|
|
48
|
+
transcript.changed();
|
|
49
|
+
}
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
52
|
renderReasoning(content, options = {}) {
|
|
@@ -61,15 +61,20 @@ export class CodeStreamRenderer extends ChatRenderer {
|
|
|
61
61
|
this.streamingTick = tick;
|
|
62
62
|
const transcript = this.transcript as unknown as CodeTranscript | null;
|
|
63
63
|
if (!transcript || !Array.isArray(transcript.frames)) return;
|
|
64
|
-
const
|
|
65
|
-
|
|
64
|
+
const activeFrame = transcript.frames.findLast(
|
|
65
|
+
(f: CodeFrame) => f?.meta?.reasoning === true && f.meta?.streaming === true
|
|
66
|
+
);
|
|
67
|
+
if (activeFrame && activeFrame.meta) {
|
|
66
68
|
if (nowMs > 0) {
|
|
67
|
-
|
|
69
|
+
activeFrame.meta.durationText = formatElapsed(nowMs);
|
|
68
70
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
activeFrame.rows = null;
|
|
72
|
+
activeFrame.renderedWidth = -1;
|
|
71
73
|
transcript.cache = null;
|
|
72
74
|
transcript.revision++;
|
|
75
|
+
if (typeof transcript.changed === 'function') {
|
|
76
|
+
transcript.changed();
|
|
77
|
+
}
|
|
73
78
|
}
|
|
74
79
|
}
|
|
75
80
|
|
|
@@ -19,6 +19,8 @@ export function openModeControl(prompt, loop) {
|
|
|
19
19
|
config.autonomyMode = item.value;
|
|
20
20
|
saveConfig(config);
|
|
21
21
|
loop.setAutonomyMode(item.value);
|
|
22
|
+
prompt.renderer?.status?.setSession?.({ autonomyMode: item.value });
|
|
23
|
+
prompt.surface?.setSessionInfo?.({ autonomyMode: item.value });
|
|
22
24
|
prompt.notice = `Mode ${item.value} active`;
|
|
23
25
|
prompt.scheduleDraw();
|
|
24
26
|
}
|
|
@@ -31,6 +31,8 @@ export function openModeControl(prompt: ControlPrompt, loop: ControlLoop): void
|
|
|
31
31
|
config.autonomyMode = item.value;
|
|
32
32
|
saveConfig(config);
|
|
33
33
|
loop.setAutonomyMode(item.value);
|
|
34
|
+
(prompt as any).renderer?.status?.setSession?.({ autonomyMode: item.value });
|
|
35
|
+
(prompt as any).surface?.setSessionInfo?.({ autonomyMode: item.value });
|
|
34
36
|
prompt.notice = `Mode ${item.value} active`;
|
|
35
37
|
prompt.scheduleDraw();
|
|
36
38
|
}
|
package/src/tui/dialogs.js
CHANGED
|
@@ -395,11 +395,18 @@ export class ApprovalLayer extends Layer {
|
|
|
395
395
|
|
|
396
396
|
/** The chip row: the selected option is filled, the rest are dimmed. */
|
|
397
397
|
optionRow() {
|
|
398
|
-
|
|
399
|
-
|
|
398
|
+
let col = 0;
|
|
399
|
+
this.optionBounds = [];
|
|
400
|
+
const parts = this.options.map((option, index) => {
|
|
401
|
+
const rendered = index === this.selected
|
|
400
402
|
? badge(option.id === 'reject' ? 'danger' : 'success', option.label)
|
|
401
|
-
: dim(` ${option.label} `)
|
|
402
|
-
|
|
403
|
+
: dim(` ${option.label} `);
|
|
404
|
+
const width = visibleWidth(rendered);
|
|
405
|
+
this.optionBounds.push({ index, option, startCol: col, endCol: col + width - 1 });
|
|
406
|
+
col += width + 1;
|
|
407
|
+
return rendered;
|
|
408
|
+
});
|
|
409
|
+
return parts.join(' ');
|
|
403
410
|
}
|
|
404
411
|
|
|
405
412
|
body(width, fullHeight) {
|
|
@@ -494,6 +501,31 @@ export class ApprovalLayer extends Layer {
|
|
|
494
501
|
return 'close';
|
|
495
502
|
}
|
|
496
503
|
|
|
504
|
+
if (event.name === 'mouse' && event.mouse && event.mouse.pressed && event.mouse.button === 0) {
|
|
505
|
+
if (!Array.isArray(this.optionBounds) || this.optionBounds.length === 0) {
|
|
506
|
+
this.optionRow();
|
|
507
|
+
}
|
|
508
|
+
const geom = this.panelGeometry;
|
|
509
|
+
if (geom && Number.isFinite(event.mouse.row) && Number.isFinite(geom.optionScreenRow)) {
|
|
510
|
+
if (Math.abs(event.mouse.row - geom.optionScreenRow) > 1) return 'handled';
|
|
511
|
+
}
|
|
512
|
+
const rawCol = Number.isFinite(event.mouse.col) ? event.mouse.col : -1;
|
|
513
|
+
const bodyCol = geom ? rawCol - 1 - (geom.inset || 0) - 2 : rawCol;
|
|
514
|
+
const hit = (this.optionBounds || []).find(b => bodyCol >= b.startCol && bodyCol <= b.endCol);
|
|
515
|
+
if (hit) {
|
|
516
|
+
this.selected = hit.index;
|
|
517
|
+
this.answer(Boolean(hit.option.answer), hit.option.id);
|
|
518
|
+
return 'close';
|
|
519
|
+
}
|
|
520
|
+
return 'handled';
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
if (event.name === 'wheel') {
|
|
524
|
+
if (event.wheel?.direction === 'up') this.scroll--;
|
|
525
|
+
else if (event.wheel?.direction === 'down') this.scroll++;
|
|
526
|
+
return 'handled';
|
|
527
|
+
}
|
|
528
|
+
|
|
497
529
|
switch (event.name) {
|
|
498
530
|
case 'up': this.scroll--; return 'handled';
|
|
499
531
|
case 'down': this.scroll++; return 'handled';
|