@causyne/agent 1.20.65 → 1.20.69

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.
Files changed (48) hide show
  1. package/package.json +1 -1
  2. package/src/agentLoop.js +49 -26
  3. package/src/agentLoop.ts +49 -26
  4. package/src/browser/causyneBrowser.js +1 -1
  5. package/src/browser/causyneBrowser.ts +1 -1
  6. package/src/cliMode.js +68 -11
  7. package/src/commands.js +46 -19
  8. package/src/contextManager.js +1 -1
  9. package/src/continuum/ui/continuumPicker.js +1 -1
  10. package/src/continuum/ui/continuumPicker.ts +1 -1
  11. package/src/embodimentSession.js +1 -1
  12. package/src/planCache.js +1 -1
  13. package/src/planCache.ts +1 -1
  14. package/src/promptMentions.js +7 -7
  15. package/src/promptMentions.ts +7 -7
  16. package/src/providers/antigravity.js +52 -12
  17. package/src/providers/antigravity.ts +47 -16
  18. package/src/providers/dashscope-byok.js +1 -1
  19. package/src/providers/qwen-byok.js +1 -1
  20. package/src/skillsManager.d.ts +4 -1
  21. package/src/tokenTracker.js +1 -1
  22. package/src/tokenTracker.ts +1 -1
  23. package/src/tool-scripts/ax_snapshot.ps1 +10 -10
  24. package/src/tools/fsList.js +1 -1
  25. package/src/tools/memoryWrite.js +1 -1
  26. package/src/tools/memoryWrite.ts +1 -1
  27. package/src/tui/chatRenderer.js +3 -2
  28. package/src/tui/codeStreamRenderer.js +8 -5
  29. package/src/tui/codeStreamRenderer.ts +10 -5
  30. package/src/tui/consoleGuard.js +15 -0
  31. package/src/tui/consoleGuard.ts +15 -0
  32. package/src/tui/lineEditor.js +14 -21
  33. package/src/tui/modelPicker.js +1 -1
  34. package/src/tui/modelPicker.ts +1 -1
  35. package/src/tui/prompt.js +41 -13
  36. package/src/tui/sessionPicker.js +1 -1
  37. package/src/tui/sessionPicker.ts +1 -1
  38. package/src/tui/sessionSidebar.js +13 -0
  39. package/src/tui/sessionSidebar.ts +15 -0
  40. package/src/tui/skillAuthoring.js +147 -0
  41. package/src/tui/skillAuthoring.ts +172 -0
  42. package/src/tui/stage.js +4 -2
  43. package/src/tui/stageSurface.js +43 -11
  44. package/src/tui/text.js +25 -2
  45. package/src/tui/text.ts +24 -2
  46. package/src/tui/theme.js +3 -0
  47. package/src/vfeTracker.js +1 -1
  48. 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 (!action || action === 'mine') {
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
- return domains.concat(skills.map((skill) => ({
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
- return { ok: true, output: summary.join('\n'), effect: 'pick-skill', items: catalogue };
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
- `✅ API Call Test Succeeded: "${targetProvider}" / "${providerInstance.model || targetModel || 'default'}"`,
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
- `❌ API Call Test Failed for "${targetProvider}" / "${targetModel || config.model || 'default'}":\n\n`
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' ? '✅' : (item.status === 'needs_auth' ? '⚠️ ' : '❌');
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
- `✅ Agent Peer Test Passed: "antigravity"\n\n`
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
- `✅ ACP Peer Test Passed: "${peerId}"\n\n`
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
- `❌ ACP Peer Test Failed: "${peerId}"\n\n`
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
  );
@@ -2257,8 +2284,8 @@ export const COMMANDS = [
2257
2284
 
2258
2285
  const nodeVer = process.version;
2259
2286
  const nodeOk = parseInt(nodeVer.slice(1).split('.')[0], 10) >= 24;
2260
- lines.push(` ${nodeOk ? '✅' : '⚠️'} Node.js version : ${nodeVer} ${nodeOk ? '(supported)' : '(Node >= 24 required)'}`);
2261
- lines.push(` ℹ️ Platform : ${process.platform} (${process.arch})`);
2287
+ lines.push(` ${nodeOk ? '✓' : '△'} Node.js version : ${nodeVer} ${nodeOk ? '(supported)' : '(Node >= 24 required)'}`);
2288
+ lines.push(` • Platform : ${process.platform} (${process.arch})`);
2262
2289
 
2263
2290
  const ws = ctx.loop?.workspaceRoot || process.cwd();
2264
2291
  let isGit = false;
@@ -2266,19 +2293,19 @@ export const COMMANDS = [
2266
2293
  execSync('git rev-parse --is-inside-work-tree', { cwd: ws, stdio: 'pipe' });
2267
2294
  isGit = true;
2268
2295
  } catch {}
2269
- lines.push(` ✅ Workspace root : ${ws}`);
2270
- lines.push(` ${isGit ? '✅' : 'ℹ️'} Git repository : ${isGit ? 'active' : 'not a git repo'}`);
2296
+ lines.push(` ✓ Workspace root : ${ws}`);
2297
+ lines.push(` ${isGit ? '✓' : '•'} Git repository : ${isGit ? 'active' : 'not a git repo'}`);
2271
2298
 
2272
2299
  const provider = config.provider || 'not configured';
2273
2300
  const model = config.model || 'default';
2274
- lines.push(` ℹ️ Provider / Model : ${provider} / ${model}`);
2301
+ lines.push(` • Provider / Model : ${provider} / ${model}`);
2275
2302
 
2276
2303
  const servers = serverStatus();
2277
2304
  const grantedCount = servers.filter(s => s.granted).length;
2278
- lines.push(` ℹ️ MCP Servers : ${servers.length} configured (${grantedCount} granted)`);
2305
+ lines.push(` • MCP Servers : ${servers.length} configured (${grantedCount} granted)`);
2279
2306
 
2280
2307
  const peers = listAllPeers();
2281
- lines.push(` ℹ️ ACP Peers : ${peers.length} available`);
2308
+ lines.push(` • ACP Peers : ${peers.length} available`);
2282
2309
 
2283
2310
  lines.push('');
2284
2311
  lines.push('All diagnostic invariants passed. Run /peers detect or /model list for component details.');
@@ -2311,7 +2338,7 @@ export const COMMANDS = [
2311
2338
  const body = session.messages
2312
2339
  .filter(m => m.role !== 'system')
2313
2340
  .map(m => {
2314
- const roleLabel = m.role === 'user' ? '### 👤 User' : '### 🤖 Causyne Agent';
2341
+ const roleLabel = m.role === 'user' ? '### User' : '### Causyne Agent';
2315
2342
  return `${roleLabel}\n\n${typeof m.content === 'string' ? m.content : JSON.stringify(m.content, null, 2)}\n`;
2316
2343
  })
2317
2344
  .join('\n---\n\n');
@@ -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[... ✂️ 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}`;
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' ? '👤 USER' : '🤖 ASSISTANT';
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' ? '👤 USER' : '🤖 ASSISTANT';
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}`);
@@ -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🖥️ EMBODIMENT SESSION\n${parts.join(' ')}`;
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('⚠️ FAILURE ROUTE WARNINGS (learned from previous attempts — plan alternatives):');
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('⚠️ FAILURE ROUTE WARNINGS (learned from previous attempts — plan alternatives):');
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
  });
@@ -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(`📁 REFERENCED SCOPE: Whole workspace (${cwd})`);
77
+ sections.push(`◆ REFERENCED SCOPE: Whole workspace (${cwd})`);
78
78
  }
79
79
  else if (m.path === 'rea' || m.path === 'rea-agents') {
80
- sections.push(`🔬 REFERENCED CAPABILITY: Reverse Engineer Anything (REA) Substrate active.\n` +
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(`📂 REFERENCED PATH: ${m.path} (Note: path was not found on disk at ${relPath})`);
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(`📁 REFERENCED DIRECTORY: ${relPath}/\n` +
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(`📦 REFERENCED BINARY PACKAGE: ${relPath} (${stats.size.toLocaleString()} bytes, ~${sizeMb} MB, format: ${ext.toUpperCase().replace('.', '')})\n` +
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(`📄 REFERENCED FILE: ${relPath} (${lines.length} lines):\n` +
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(`📂 REFERENCED PATH: ${relPath} (Error reading: ${msg})`);
170
+ sections.push(`◆ REFERENCED PATH: ${relPath} (Error reading: ${msg})`);
171
171
  }
172
172
  }
173
173
  const referencedContext = sections.length > 0
@@ -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(`📁 REFERENCED SCOPE: Whole workspace (${cwd})`);
108
+ sections.push(`◆ REFERENCED SCOPE: Whole workspace (${cwd})`);
109
109
  } else if (m.path === 'rea' || m.path === 'rea-agents') {
110
110
  sections.push(
111
- `🔬 REFERENCED CAPABILITY: Reverse Engineer Anything (REA) Substrate active.\n` +
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(`📂 REFERENCED PATH: ${m.path} (Note: path was not found on disk at ${relPath})`);
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
- `📁 REFERENCED DIRECTORY: ${relPath}/\n` +
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
- `📦 REFERENCED BINARY PACKAGE: ${relPath} (${stats.size.toLocaleString()} bytes, ~${sizeMb} MB, format: ${ext.toUpperCase().replace('.', '')})\n` +
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
- `📄 REFERENCED FILE: ${relPath} (${lines.length} lines):\n` +
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(`📂 REFERENCED PATH: ${relPath} (Error reading: ${msg})`);
212
+ sections.push(`◆ REFERENCED PATH: ${relPath} (Error reading: ${msg})`);
213
213
  }
214
214
  }
215
215
 
@@ -353,9 +353,13 @@ function nativeInspectionTarget(name, parameters) {
353
353
  const normName = name.toLowerCase().replace(/[_\s-]/g, '');
354
354
  if (!/^(runcommand|command|sysrun|terminal|bash|shell)$/.test(normName)) {
355
355
  if (/^(readfile|viewfile)$/.test(normName)) {
356
- const p = String(parameters.AbsolutePath ?? parameters.filePath ?? parameters.path ?? parameters.file ?? '');
357
- if (p)
358
- return p.trim().toLowerCase();
356
+ const p = String(parameters.AbsolutePath ?? parameters.Path ?? parameters.filePath ?? parameters.path ?? parameters.file ?? '').trim().toLowerCase();
357
+ if (!p)
358
+ return null;
359
+ const start = parameters.StartLine ?? parameters.startLine ?? parameters.offset ?? parameters.line ?? '';
360
+ const end = parameters.EndLine ?? parameters.endLine ?? parameters.limit ?? '';
361
+ const byteOffset = parameters.ByteOffset ?? parameters.byteOffset ?? '';
362
+ return `${p}:${start}-${end}:${byteOffset}`;
359
363
  }
360
364
  return null;
361
365
  }
@@ -390,6 +394,23 @@ function nativeInspectionTarget(name, parameters) {
390
394
  }
391
395
  return null;
392
396
  }
397
+ export function isRepeatableNativeTool(name, parameters = {}) {
398
+ if (!name || typeof name !== 'string')
399
+ return false;
400
+ const action = name.toLowerCase().replace(/[_\s-]/g, '');
401
+ if (/^(?:managetask|managesubagents|sendmessage|invokesubagent|definesubagent|schedule|tasksummary|todowrite|updateplan|askquestion|processlist|sysrunpoll|procterm|waitfortask|checkstatus)$/.test(action)) {
402
+ return true;
403
+ }
404
+ if (/(?:poll|status|getresult|wait)$/.test(action)) {
405
+ return true;
406
+ }
407
+ if (/^(runcommand|command|sysrun|terminal|bash|shell)$/.test(action)) {
408
+ const command = cleanCommandString(parameters.CommandLine ?? parameters.command ?? parameters.cmd ?? '');
409
+ if (/^(?:ps\s+aux|pgrep|lsof|netstat|ss\s+-)\b/i.test(command))
410
+ return true;
411
+ }
412
+ return false;
413
+ }
393
414
  export function isNativeMutation(name, parameters = {}) {
394
415
  if (!name || typeof name !== 'string')
395
416
  return false;
@@ -405,7 +426,7 @@ export function isNativeMutation(name, parameters = {}) {
405
426
  return /\b(?:save_as_mainfile|save_mainfile|write_text|write_bytes|tee)\b/.test(command)
406
427
  || /(?:^|[;&|]\s*)(?:cp|mv|rm|install|patch|touch|mkdir|chmod|sed)\s/.test(command)
407
428
  || /(?:>|>>)/.test(command)
408
- || /\b(?:npm|yarn|pnpm|cargo|gradle|gradlew|mvn|dotnet|pip|pip3|pytest|vitest|jest|tsc|make|docker|git\s+(?:add|commit|checkout|merge|rebase|stash|pull|push))\b/i.test(command);
429
+ || /\b(?:npm|npx|yarn|pnpm|bun|deno|cargo|gradle|gradlew|mvn|dotnet|pip|pip3|pytest|vitest|jest|tsc|make|cmake|ninja|docker|apktool|jadx|jarsigner|apksigner|zipalign|keytool|adb|kotlinc|javac|go|rustc|swift|xcodebuild|codesign|unzip|tar|brew|git\s+(?:add|commit|checkout|merge|rebase|stash|pull|push|restore|reset|clean|rm|mv|apply|cherry-pick|revert|tag|branch|init|clone))\b/i.test(command);
409
430
  }
410
431
  export function nativeToolSignature(name, parameters = {}) {
411
432
  const normName = name.toLowerCase().replace(/[_\s-]/g, '');
@@ -1007,6 +1028,7 @@ export class AntigravityProvider extends LLMProvider {
1007
1028
  let lastToolSignature = '';
1008
1029
  const recentSignatures = [];
1009
1030
  const seenNativeActionSteps = new Set();
1031
+ const seenLoopCheckSteps = new Set();
1010
1032
  const mediaInspectionCounts = new Map();
1011
1033
  const pendingMediaMutations = new Set();
1012
1034
  // Antigravity's result usage is cumulative across the conversation, but
@@ -1187,14 +1209,39 @@ export class AntigravityProvider extends LLMProvider {
1187
1209
  (stepUpdate && typeof stepUpdate === 'object' && stepUpdate.parameters) ||
1188
1210
  (toolInfo && typeof toolInfo === 'object' && toolInfo.input) ||
1189
1211
  {};
1190
- if (name && newNativeAction) {
1212
+ const hasParams = Boolean(rawParams && typeof rawParams === 'object' && Object.keys(rawParams).length > 0);
1213
+ const readyForLoopCheck = state === 'DONE'
1214
+ || (state === 'ACTIVE' && (hasParams || isNativeMutation(name || '', rawParams) || isRepeatableNativeTool(name || '', rawParams)));
1215
+ const shouldCheckLoop = Boolean(name) && readyForLoopCheck
1216
+ && (!Number.isFinite(stepIndex) || !seenLoopCheckSteps.has(stepIndex));
1217
+ if (name && state === 'DONE' && !toolInfo?.error && isNativeMutation(name, rawParams)) {
1218
+ if (Number.isFinite(stepIndex))
1219
+ seenLoopCheckSteps.add(stepIndex);
1220
+ lastMutationActionIndex = nativeActionStarts + 1;
1221
+ progressiveActionsCount++;
1222
+ consecutiveIdenticalCount = 0;
1223
+ consecutiveInspections = 0;
1224
+ lastToolSignature = '';
1225
+ recentSignatures.length = 0;
1226
+ }
1227
+ else if (name && shouldCheckLoop) {
1228
+ if (Number.isFinite(stepIndex))
1229
+ seenLoopCheckSteps.add(stepIndex);
1191
1230
  const mutating = isNativeMutation(name, rawParams);
1231
+ const repeatable = isRepeatableNativeTool(name, rawParams);
1192
1232
  if (mutating) {
1193
1233
  lastMutationActionIndex = nativeActionStarts + 1;
1194
1234
  progressiveActionsCount++;
1195
1235
  consecutiveIdenticalCount = 0;
1196
1236
  consecutiveInspections = 0;
1197
1237
  lastToolSignature = '';
1238
+ recentSignatures.length = 0;
1239
+ }
1240
+ else if (repeatable) {
1241
+ // Task/subagent polling, plan updates, and user questions are legitimate
1242
+ // coordination steps and must not count as aimless read-only loops.
1243
+ consecutiveIdenticalCount = 0;
1244
+ lastToolSignature = '';
1198
1245
  }
1199
1246
  else if (!desktopTask && options.taskArchetype !== 'media_3d_generation') {
1200
1247
  consecutiveInspections++;
@@ -1224,13 +1271,6 @@ export class AntigravityProvider extends LLMProvider {
1224
1271
  terminateChild();
1225
1272
  return;
1226
1273
  }
1227
- // 3. Stagnant read-only inspection runaway without mutations on an editing task
1228
- if (consecutiveInspections >= 30 && options.taskArchetype !== 'web_research_only') {
1229
- const error = Object.assign(new Error(`Antigravity performed ${consecutiveInspections} consecutive read-only inspections without writing or modifying code. Halting exploration loop.`), { code: 'AGY_EXPLORATION_LOOP', inspectionCount: consecutiveInspections });
1230
- safeReject(error);
1231
- terminateChild();
1232
- return;
1233
- }
1234
1274
  }
1235
1275
  }
1236
1276
  if (newNativeAction) {
@@ -357,8 +357,12 @@ function nativeInspectionTarget(name: string, parameters: Record<string, unknown
357
357
  const normName = name.toLowerCase().replace(/[_\s-]/g, '');
358
358
  if (!/^(runcommand|command|sysrun|terminal|bash|shell)$/.test(normName)) {
359
359
  if (/^(readfile|viewfile)$/.test(normName)) {
360
- const p = String(parameters.AbsolutePath ?? parameters.filePath ?? parameters.path ?? parameters.file ?? '');
361
- if (p) return p.trim().toLowerCase();
360
+ const p = String(parameters.AbsolutePath ?? parameters.Path ?? parameters.filePath ?? parameters.path ?? parameters.file ?? '').trim().toLowerCase();
361
+ if (!p) return null;
362
+ const start = parameters.StartLine ?? parameters.startLine ?? parameters.offset ?? parameters.line ?? '';
363
+ const end = parameters.EndLine ?? parameters.endLine ?? parameters.limit ?? '';
364
+ const byteOffset = parameters.ByteOffset ?? parameters.byteOffset ?? '';
365
+ return `${p}:${start}-${end}:${byteOffset}`;
362
366
  }
363
367
  return null;
364
368
  }
@@ -396,6 +400,22 @@ function nativeInspectionTarget(name: string, parameters: Record<string, unknown
396
400
  return null;
397
401
  }
398
402
 
403
+ export function isRepeatableNativeTool(name: string, parameters: Record<string, unknown> = {}): boolean {
404
+ if (!name || typeof name !== 'string') return false;
405
+ const action = name.toLowerCase().replace(/[_\s-]/g, '');
406
+ if (/^(?:managetask|managesubagents|sendmessage|invokesubagent|definesubagent|schedule|tasksummary|todowrite|updateplan|askquestion|processlist|sysrunpoll|procterm|waitfortask|checkstatus)$/.test(action)) {
407
+ return true;
408
+ }
409
+ if (/(?:poll|status|getresult|wait)$/.test(action)) {
410
+ return true;
411
+ }
412
+ if (/^(runcommand|command|sysrun|terminal|bash|shell)$/.test(action)) {
413
+ const command = cleanCommandString(parameters.CommandLine ?? parameters.command ?? parameters.cmd ?? '');
414
+ if (/^(?:ps\s+aux|pgrep|lsof|netstat|ss\s+-)\b/i.test(command)) return true;
415
+ }
416
+ return false;
417
+ }
418
+
399
419
  export function isNativeMutation(name: string, parameters: Record<string, unknown> = {}): boolean {
400
420
  if (!name || typeof name !== 'string') return false;
401
421
  const action = name.toLowerCase().replace(/[_\s-]/g, '');
@@ -408,7 +428,7 @@ export function isNativeMutation(name: string, parameters: Record<string, unknow
408
428
  return /\b(?:save_as_mainfile|save_mainfile|write_text|write_bytes|tee)\b/.test(command)
409
429
  || /(?:^|[;&|]\s*)(?:cp|mv|rm|install|patch|touch|mkdir|chmod|sed)\s/.test(command)
410
430
  || /(?:>|>>)/.test(command)
411
- || /\b(?:npm|yarn|pnpm|cargo|gradle|gradlew|mvn|dotnet|pip|pip3|pytest|vitest|jest|tsc|make|docker|git\s+(?:add|commit|checkout|merge|rebase|stash|pull|push))\b/i.test(command);
431
+ || /\b(?:npm|npx|yarn|pnpm|bun|deno|cargo|gradle|gradlew|mvn|dotnet|pip|pip3|pytest|vitest|jest|tsc|make|cmake|ninja|docker|apktool|jadx|jarsigner|apksigner|zipalign|keytool|adb|kotlinc|javac|go|rustc|swift|xcodebuild|codesign|unzip|tar|brew|git\s+(?:add|commit|checkout|merge|rebase|stash|pull|push|restore|reset|clean|rm|mv|apply|cherry-pick|revert|tag|branch|init|clone))\b/i.test(command);
412
432
  }
413
433
 
414
434
  export function nativeToolSignature(name: string, parameters: Record<string, unknown> = {}): string {
@@ -1049,6 +1069,7 @@ export class AntigravityProvider extends LLMProvider {
1049
1069
  let lastToolSignature = '';
1050
1070
  const recentSignatures: string[] = [];
1051
1071
  const seenNativeActionSteps = new Set<number>();
1072
+ const seenLoopCheckSteps = new Set<number>();
1052
1073
  const mediaInspectionCounts = new Map<string, number>();
1053
1074
  const pendingMediaMutations = new Set<number>();
1054
1075
  // Antigravity's result usage is cumulative across the conversation, but
@@ -1231,15 +1252,36 @@ export class AntigravityProvider extends LLMProvider {
1231
1252
  (stepUpdate && typeof stepUpdate === 'object' && stepUpdate.parameters) ||
1232
1253
  (toolInfo && typeof toolInfo === 'object' && toolInfo.input) ||
1233
1254
  {};
1234
-
1235
- if (name && newNativeAction) {
1255
+ const hasParams = Boolean(rawParams && typeof rawParams === 'object' && Object.keys(rawParams).length > 0);
1256
+ const readyForLoopCheck = state === 'DONE'
1257
+ || (state === 'ACTIVE' && (hasParams || isNativeMutation(name || '', rawParams) || isRepeatableNativeTool(name || '', rawParams)));
1258
+ const shouldCheckLoop = Boolean(name) && readyForLoopCheck
1259
+ && (!Number.isFinite(stepIndex) || !seenLoopCheckSteps.has(stepIndex));
1260
+
1261
+ if (name && state === 'DONE' && !toolInfo?.error && isNativeMutation(name, rawParams)) {
1262
+ if (Number.isFinite(stepIndex)) seenLoopCheckSteps.add(stepIndex);
1263
+ lastMutationActionIndex = nativeActionStarts + 1;
1264
+ progressiveActionsCount++;
1265
+ consecutiveIdenticalCount = 0;
1266
+ consecutiveInspections = 0;
1267
+ lastToolSignature = '';
1268
+ recentSignatures.length = 0;
1269
+ } else if (name && shouldCheckLoop) {
1270
+ if (Number.isFinite(stepIndex)) seenLoopCheckSteps.add(stepIndex);
1236
1271
  const mutating = isNativeMutation(name, rawParams);
1272
+ const repeatable = isRepeatableNativeTool(name, rawParams);
1237
1273
  if (mutating) {
1238
1274
  lastMutationActionIndex = nativeActionStarts + 1;
1239
1275
  progressiveActionsCount++;
1240
1276
  consecutiveIdenticalCount = 0;
1241
1277
  consecutiveInspections = 0;
1242
1278
  lastToolSignature = '';
1279
+ recentSignatures.length = 0;
1280
+ } else if (repeatable) {
1281
+ // Task/subagent polling, plan updates, and user questions are legitimate
1282
+ // coordination steps and must not count as aimless read-only loops.
1283
+ consecutiveIdenticalCount = 0;
1284
+ lastToolSignature = '';
1243
1285
  } else if (!desktopTask && (options as any).taskArchetype !== 'media_3d_generation') {
1244
1286
  consecutiveInspections++;
1245
1287
  const sig = nativeToolSignature(name, rawParams);
@@ -1274,17 +1316,6 @@ export class AntigravityProvider extends LLMProvider {
1274
1316
  terminateChild();
1275
1317
  return;
1276
1318
  }
1277
-
1278
- // 3. Stagnant read-only inspection runaway without mutations on an editing task
1279
- if (consecutiveInspections >= 30 && (options as any).taskArchetype !== 'web_research_only') {
1280
- const error = Object.assign(
1281
- new Error(`Antigravity performed ${consecutiveInspections} consecutive read-only inspections without writing or modifying code. Halting exploration loop.`),
1282
- { code: 'AGY_EXPLORATION_LOOP', inspectionCount: consecutiveInspections }
1283
- );
1284
- safeReject(error);
1285
- terminateChild();
1286
- return;
1287
- }
1288
1319
  }
1289
1320
  }
1290
1321
 
@@ -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❌ 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\n🛠️ HOW 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.`);
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❌ 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\n🛠️ HOW 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.`);
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
 
@@ -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[];
@@ -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 = `⚠️ Token Budget Alert: Your BYOK usage has reached ${daily.totalTokens.toLocaleString()} tokens (Threshold: ${alertThreshold.toLocaleString()}).`;
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
  }
@@ -315,7 +315,7 @@ export class TokenTracker {
315
315
  daily.alertSent = true;
316
316
  await this.saveDailyUsage(daily);
317
317
 
318
- const msg = `⚠️ Token Budget Alert: Your BYOK usage has reached ${daily.totalTokens.toLocaleString()} tokens (Threshold: ${alertThreshold.toLocaleString()}).`;
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
  }