@causyne/agent 1.20.90 → 1.20.91

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@causyne/agent",
3
- "version": "1.20.90",
3
+ "version": "1.20.91",
4
4
  "description": "Agentic AI for software, tools, and computer workflows",
5
5
  "main": "bin/causyne.js",
6
6
  "type": "module",
package/src/agentLoop.js CHANGED
@@ -2594,7 +2594,7 @@ You are operating in a text-and-code modality without direct image pixel renderi
2594
2594
  const recovery = this.timeMachine.observe(action.name, actionArgs, actionOutcome, coldObserver.getToolOutcomes(this.taskId));
2595
2595
  // Pause now, not at the end of a potentially long peer turn.
2596
2596
  // An abort is a yield checkpoint, not a user denial or task success.
2597
- if (recovery.kind === 'consent') {
2597
+ if (recovery.kind === 'consent' && action.name.toLowerCase() !== 'skill') {
2598
2598
  this._pendingConsent ??= { recovery, tool: action.name };
2599
2599
  nativeControl.abort();
2600
2600
  }
@@ -2856,6 +2856,21 @@ You are operating in a text-and-code modality without direct image pixel renderi
2856
2856
  }
2857
2857
  }
2858
2858
  }
2859
+ if (canonical === 'fs_read_skill') {
2860
+ if (!toolParams.skill_id) {
2861
+ toolParams.skill_id = toolParams.id || toolParams.name || toolParams.skill || '';
2862
+ }
2863
+ if (!toolParams.skill_id) {
2864
+ const prompt = (this.currentTaskPrompt || this.userPrompt || '').trim();
2865
+ const match = prompt.match(/(?:skill|read)\s+([a-zA-Z0-9_.-]+(?:\/[a-zA-Z0-9_.-]+)*)/i);
2866
+ if (match && match[1]) {
2867
+ toolParams.skill_id = match[1].trim();
2868
+ }
2869
+ }
2870
+ delete toolParams.id;
2871
+ delete toolParams.name;
2872
+ delete toolParams.skill;
2873
+ }
2859
2874
  if (Object.keys(toolParams).length > 0 && !this.validateToolArgs(canonical, toolParams)) {
2860
2875
  response.toolCalls = [{
2861
2876
  id: `host_auto_${Date.now()}`,
package/src/agentLoop.ts CHANGED
@@ -2688,7 +2688,7 @@ You are operating in a text-and-code modality without direct image pixel renderi
2688
2688
  );
2689
2689
  // Pause now, not at the end of a potentially long peer turn.
2690
2690
  // An abort is a yield checkpoint, not a user denial or task success.
2691
- if (recovery.kind === 'consent') {
2691
+ if (recovery.kind === 'consent' && action.name.toLowerCase() !== 'skill') {
2692
2692
  this._pendingConsent ??= { recovery, tool: action.name };
2693
2693
  nativeControl.abort();
2694
2694
  } else if (!this._pendingConsent && recovery.kind === 'replan') {
@@ -2966,6 +2966,22 @@ You are operating in a text-and-code modality without direct image pixel renderi
2966
2966
  }
2967
2967
  }
2968
2968
 
2969
+ if (canonical === 'fs_read_skill') {
2970
+ if (!toolParams.skill_id) {
2971
+ toolParams.skill_id = toolParams.id || toolParams.name || toolParams.skill || '';
2972
+ }
2973
+ if (!toolParams.skill_id) {
2974
+ const prompt = (this.currentTaskPrompt || this.userPrompt || '').trim();
2975
+ const match = prompt.match(/(?:skill|read)\s+([a-zA-Z0-9_.-]+(?:\/[a-zA-Z0-9_.-]+)*)/i);
2976
+ if (match && match[1]) {
2977
+ toolParams.skill_id = match[1].trim();
2978
+ }
2979
+ }
2980
+ delete toolParams.id;
2981
+ delete toolParams.name;
2982
+ delete toolParams.skill;
2983
+ }
2984
+
2969
2985
  if (Object.keys(toolParams).length > 0 && !this.validateToolArgs(canonical, toolParams)) {
2970
2986
  response.toolCalls = [{
2971
2987
  id: `host_auto_${Date.now()}`,
@@ -10,6 +10,7 @@ import { createHash } from 'node:crypto';
10
10
  import path from 'node:path';
11
11
  import { PEER_COLLABORATION_POLICY } from './collaborationPolicy.js';
12
12
  import { extractToolCallJsonObjects, stripToolCallMarkup, resolveToolCallEnvelopeArguments } from '../implementationPlan.js';
13
+ import { canonicalizeToolName } from '../tools/toolSelfRepair.js';
13
14
  function fingerprint(value) {
14
15
  return createHash('sha256').update(JSON.stringify(value)).digest('hex');
15
16
  }
@@ -93,7 +94,8 @@ export class AcpProvider extends LLMProvider {
93
94
  '\n\n[ACP Tool Routing & Workspace Boundary Rules]\n' +
94
95
  '1. NATIVE FUNCTION CHANNEL vs CAUSYNE HOST XML CHANNEL:\n' +
95
96
  ' - Your native function-calling channel ONLY accepts your own native tools (such as `read`, `write`, `edit`, `bash`, `glob`, `grep`, `todowrite`, and configured MCP tools). Use your native tools directly for workspace file reads/writes, shell commands, and todo checklists (use `todowrite` if available instead of calling `update_plan` as a native function).\n' +
96
- ' - Causyne host tools listed under [Available Tools] / [Current Available Tools] (such as `browser_act`, `screenshot`, `vision_inspect_ui`, `update_plan`, `memory_write`, `ui_forge`, `astryx_oracle`, `tool_search`) are NOT registered in your native function-calling schema. NEVER invoke them as native function calls (`to=browser_act` or `to=update_plan`), NEVER call `tool_call` as a native tool, and NEVER emit dummy `bash` (`echo`) calls while trying to invoke them.\n' +
97
+ ' - Causyne host tools listed under [Available Tools] / [Current Available Tools] (such as `browser_act`, `screenshot`, `vision_inspect_ui`, `update_plan`, `memory_write`, `ui_forge`, `astryx_oracle`, `tool_search`, `fs_read_skill`) are NOT registered in your native function-calling schema. NEVER invoke them as native function calls (`to=browser_act` or `to=update_plan`), NEVER call `tool_call` as a native tool, and NEVER emit dummy `bash` (`echo`) calls while trying to invoke them.\n' +
98
+ ' - Bundled Causyne skills must be read via the host tool `fs_read_skill`. Do NOT call peer-native `skill` or functions for Causyne skills. To read a skill, write `<tool_call>{"name": "fs_read_skill", "arguments": {"skill_id": "domain/name"}}</tool_call>` directly in your assistant text response.\n' +
97
99
  ' - To invoke a Causyne host tool, write `<tool_call>{"name": "tool_name", "arguments": { ... }}</tool_call>` directly in your assistant text response with NO native function call in that step; Causyne will execute the host tool and return the result on the next turn.\n' +
98
100
  '2. WORKSPACE PATH BOUNDARY (NO /tmp):\n' +
99
101
  ' - Keep ALL temporary files, server logs, and headless browser screenshots inside the active workspace directory (for example, `./.shots/preview.png` or `./server.log`). NEVER write to, read from, or `cp`/`mv` paths in `/tmp` or outside the workspace root, as the host sandbox rejects `/tmp` access.\n\n[Language & Communication Directive]\nDynamically reflect and match the exact language used by the user in their prompt. Respond naturally in that same language.');
@@ -160,7 +162,8 @@ export class AcpProvider extends LLMProvider {
160
162
  '\n\n[ACP Tool Routing & Workspace Boundary Rules]\n' +
161
163
  '1. NATIVE FUNCTION CHANNEL vs CAUSYNE HOST XML CHANNEL:\n' +
162
164
  ' - Your native function-calling channel ONLY accepts your own native tools (such as `read`, `write`, `edit`, `bash`, `glob`, `grep`, `todowrite`, and configured MCP tools). Use your native tools directly for workspace file reads/writes, shell commands, and todo checklists (use `todowrite` if available instead of calling `update_plan` as a native function).\n' +
163
- ' - Causyne host tools listed under [Current Available Tools] (such as `browser_act`, `screenshot`, `vision_inspect_ui`, `update_plan`, `memory_write`, `ui_forge`, `astryx_oracle`, `tool_search`) are NOT registered in your native function-calling schema. NEVER invoke them as native function calls (`to=browser_act` or `to=update_plan`), NEVER call `tool_call` as a native tool, and NEVER emit dummy `bash` (`echo`) calls while trying to invoke them.\n' +
165
+ ' - Causyne host tools listed under [Current Available Tools] (such as `browser_act`, `screenshot`, `vision_inspect_ui`, `update_plan`, `memory_write`, `ui_forge`, `astryx_oracle`, `tool_search`, `fs_read_skill`) are NOT registered in your native function-calling schema. NEVER invoke them as native function calls (`to=browser_act` or `to=update_plan`), NEVER call `tool_call` as a native tool, and NEVER emit dummy `bash` (`echo`) calls while trying to invoke them.\n' +
166
+ ' - Bundled Causyne skills must be read via the host tool `fs_read_skill`. Do NOT call peer-native `skill` or functions for Causyne skills. To read a skill, write `<tool_call>{"name": "fs_read_skill", "arguments": {"skill_id": "domain/name"}}</tool_call>` directly in your assistant text response.\n' +
164
167
  ' - To invoke a Causyne host tool, write `<tool_call>{"name": "tool_name", "arguments": { ... }}</tool_call>` directly in your assistant text response with NO native function call in that step; Causyne will execute the host tool and return the result on the next turn.\n' +
165
168
  '2. WORKSPACE PATH BOUNDARY (NO /tmp):\n' +
166
169
  ' - Keep ALL temporary files, server logs, and headless browser screenshots inside the active workspace directory (for example, `./.shots/preview.png` or `./server.log`). NEVER write to, read from, or `cp`/`mv` paths in `/tmp` or outside the workspace root, as the host sandbox rejects `/tmp` access.');
@@ -478,8 +481,12 @@ export class AcpProvider extends LLMProvider {
478
481
  || earlier?.parameters?.__invalidTool === true
479
482
  || (typeof input.error === 'string' && input.error.length > 0 && typeof input.tool === 'string');
480
483
  if (isInvalidPseudoTool) {
481
- const requested = typeof input.tool === 'string' ? input.tool : '';
482
- if (!this.toolRoutingError && requested && normalizeToolContracts(this.peerServices?.tools || []).some(tool => tool.name === requested)) {
484
+ const rawRequested = typeof input.tool === 'string' ? input.tool : '';
485
+ const canonicalRequested = canonicalizeToolName(rawRequested);
486
+ const hasDirectMatch = normalizeToolContracts(this.peerServices?.tools || []).some(tool => tool.name === rawRequested);
487
+ const hasCanonicalMatch = normalizeToolContracts(this.peerServices?.tools || []).some(tool => tool.name === canonicalRequested);
488
+ const requested = hasDirectMatch ? rawRequested : (hasCanonicalMatch ? canonicalRequested : '');
489
+ if (!this.toolRoutingError && requested) {
483
490
  let rawArgs = (input.args && typeof input.args === 'object') ? input.args
484
491
  : (input.parameters && typeof input.parameters === 'object') ? input.parameters
485
492
  : (earlier?.parameters && typeof earlier.parameters === 'object' && !earlier.parameters.__pendingStub) ? earlier.parameters
@@ -501,6 +508,28 @@ export class AcpProvider extends LLMProvider {
501
508
  this.turnActions.delete(id);
502
509
  return;
503
510
  }
511
+ const isPeerNativeSkill = rawTitle.toLowerCase() === 'skill'
512
+ || name.toLowerCase() === 'skill'
513
+ || earlier?.name === 'skill';
514
+ const isFailedSkill = isPeerNativeSkill && (updateObj.status === 'failed'
515
+ || (typeof input.error === 'string' && /Skill\s+.*not found/i.test(input.error))
516
+ || (typeof updateObj.error === 'string' && /Skill\s+.*not found/i.test(updateObj.error))
517
+ || (typeof rawOutputObj?.error === 'string' && /Skill\s+.*not found/i.test(rawOutputObj.error)));
518
+ if (isFailedSkill) {
519
+ if (!this.toolRoutingError) {
520
+ const requestedSkill = String(input.name || input.id || input.skill_id || input.skill || input.path
521
+ || earlier?.parameters?.name || earlier?.parameters?.id || earlier?.parameters?.skill_id || '').trim();
522
+ this.toolRoutingError = {
523
+ tool: 'fs_read_skill',
524
+ message: `Peer-native skill not found in peer catalog; routed to Causyne host tool fs_read_skill`,
525
+ parameters: requestedSkill ? { skill_id: requestedSkill } : undefined
526
+ };
527
+ client.notifyCancel(sessionId);
528
+ }
529
+ this.liveFileActions.delete(id);
530
+ this.turnActions.delete(id);
531
+ return;
532
+ }
504
533
  const locationPath = updateObj.locations?.[0]?.path;
505
534
  const inputPath = typeof input.path === 'string' ? input.path
506
535
  : typeof input.filePath === 'string' ? input.filePath
@@ -11,6 +11,7 @@ import { createHash } from 'node:crypto';
11
11
  import path from 'node:path';
12
12
  import { PEER_COLLABORATION_POLICY } from './collaborationPolicy.js';
13
13
  import { extractToolCallJsonObjects, stripToolCallMarkup, resolveToolCallEnvelopeArguments } from '../implementationPlan.js';
14
+ import { canonicalizeToolName } from '../tools/toolSelfRepair.js';
14
15
 
15
16
  interface AcpTransportSnapshot {
16
17
  conversationId: string;
@@ -109,7 +110,8 @@ export class AcpProvider extends LLMProvider {
109
110
  '\n\n[ACP Tool Routing & Workspace Boundary Rules]\n' +
110
111
  '1. NATIVE FUNCTION CHANNEL vs CAUSYNE HOST XML CHANNEL:\n' +
111
112
  ' - Your native function-calling channel ONLY accepts your own native tools (such as `read`, `write`, `edit`, `bash`, `glob`, `grep`, `todowrite`, and configured MCP tools). Use your native tools directly for workspace file reads/writes, shell commands, and todo checklists (use `todowrite` if available instead of calling `update_plan` as a native function).\n' +
112
- ' - Causyne host tools listed under [Available Tools] / [Current Available Tools] (such as `browser_act`, `screenshot`, `vision_inspect_ui`, `update_plan`, `memory_write`, `ui_forge`, `astryx_oracle`, `tool_search`) are NOT registered in your native function-calling schema. NEVER invoke them as native function calls (`to=browser_act` or `to=update_plan`), NEVER call `tool_call` as a native tool, and NEVER emit dummy `bash` (`echo`) calls while trying to invoke them.\n' +
113
+ ' - Causyne host tools listed under [Available Tools] / [Current Available Tools] (such as `browser_act`, `screenshot`, `vision_inspect_ui`, `update_plan`, `memory_write`, `ui_forge`, `astryx_oracle`, `tool_search`, `fs_read_skill`) are NOT registered in your native function-calling schema. NEVER invoke them as native function calls (`to=browser_act` or `to=update_plan`), NEVER call `tool_call` as a native tool, and NEVER emit dummy `bash` (`echo`) calls while trying to invoke them.\n' +
114
+ ' - Bundled Causyne skills must be read via the host tool `fs_read_skill`. Do NOT call peer-native `skill` or functions for Causyne skills. To read a skill, write `<tool_call>{"name": "fs_read_skill", "arguments": {"skill_id": "domain/name"}}</tool_call>` directly in your assistant text response.\n' +
113
115
  ' - To invoke a Causyne host tool, write `<tool_call>{"name": "tool_name", "arguments": { ... }}</tool_call>` directly in your assistant text response with NO native function call in that step; Causyne will execute the host tool and return the result on the next turn.\n' +
114
116
  '2. WORKSPACE PATH BOUNDARY (NO /tmp):\n' +
115
117
  ' - Keep ALL temporary files, server logs, and headless browser screenshots inside the active workspace directory (for example, `./.shots/preview.png` or `./server.log`). NEVER write to, read from, or `cp`/`mv` paths in `/tmp` or outside the workspace root, as the host sandbox rejects `/tmp` access.\n\n[Language & Communication Directive]\nDynamically reflect and match the exact language used by the user in their prompt. Respond naturally in that same language.'
@@ -183,7 +185,8 @@ export class AcpProvider extends LLMProvider {
183
185
  '\n\n[ACP Tool Routing & Workspace Boundary Rules]\n' +
184
186
  '1. NATIVE FUNCTION CHANNEL vs CAUSYNE HOST XML CHANNEL:\n' +
185
187
  ' - Your native function-calling channel ONLY accepts your own native tools (such as `read`, `write`, `edit`, `bash`, `glob`, `grep`, `todowrite`, and configured MCP tools). Use your native tools directly for workspace file reads/writes, shell commands, and todo checklists (use `todowrite` if available instead of calling `update_plan` as a native function).\n' +
186
- ' - Causyne host tools listed under [Current Available Tools] (such as `browser_act`, `screenshot`, `vision_inspect_ui`, `update_plan`, `memory_write`, `ui_forge`, `astryx_oracle`, `tool_search`) are NOT registered in your native function-calling schema. NEVER invoke them as native function calls (`to=browser_act` or `to=update_plan`), NEVER call `tool_call` as a native tool, and NEVER emit dummy `bash` (`echo`) calls while trying to invoke them.\n' +
188
+ ' - Causyne host tools listed under [Current Available Tools] (such as `browser_act`, `screenshot`, `vision_inspect_ui`, `update_plan`, `memory_write`, `ui_forge`, `astryx_oracle`, `tool_search`, `fs_read_skill`) are NOT registered in your native function-calling schema. NEVER invoke them as native function calls (`to=browser_act` or `to=update_plan`), NEVER call `tool_call` as a native tool, and NEVER emit dummy `bash` (`echo`) calls while trying to invoke them.\n' +
189
+ ' - Bundled Causyne skills must be read via the host tool `fs_read_skill`. Do NOT call peer-native `skill` or functions for Causyne skills. To read a skill, write `<tool_call>{"name": "fs_read_skill", "arguments": {"skill_id": "domain/name"}}</tool_call>` directly in your assistant text response.\n' +
187
190
  ' - To invoke a Causyne host tool, write `<tool_call>{"name": "tool_name", "arguments": { ... }}</tool_call>` directly in your assistant text response with NO native function call in that step; Causyne will execute the host tool and return the result on the next turn.\n' +
188
191
  '2. WORKSPACE PATH BOUNDARY (NO /tmp):\n' +
189
192
  ' - Keep ALL temporary files, server logs, and headless browser screenshots inside the active workspace directory (for example, `./.shots/preview.png` or `./server.log`). NEVER write to, read from, or `cp`/`mv` paths in `/tmp` or outside the workspace root, as the host sandbox rejects `/tmp` access.'
@@ -479,8 +482,12 @@ export class AcpProvider extends LLMProvider {
479
482
  || earlier?.parameters?.__invalidTool === true
480
483
  || (typeof input.error === 'string' && input.error.length > 0 && typeof input.tool === 'string');
481
484
  if (isInvalidPseudoTool) {
482
- const requested = typeof input.tool === 'string' ? input.tool : '';
483
- if (!this.toolRoutingError && requested && normalizeToolContracts(this.peerServices?.tools || []).some(tool => tool.name === requested)) {
485
+ const rawRequested = typeof input.tool === 'string' ? input.tool : '';
486
+ const canonicalRequested = canonicalizeToolName(rawRequested);
487
+ const hasDirectMatch = normalizeToolContracts(this.peerServices?.tools || []).some(tool => tool.name === rawRequested);
488
+ const hasCanonicalMatch = normalizeToolContracts(this.peerServices?.tools || []).some(tool => tool.name === canonicalRequested);
489
+ const requested = hasDirectMatch ? rawRequested : (hasCanonicalMatch ? canonicalRequested : '');
490
+ if (!this.toolRoutingError && requested) {
484
491
  let rawArgs = (input.args && typeof input.args === 'object') ? input.args
485
492
  : (input.parameters && typeof input.parameters === 'object') ? input.parameters
486
493
  : (earlier?.parameters && typeof earlier.parameters === 'object' && !earlier.parameters.__pendingStub) ? earlier.parameters
@@ -502,6 +509,33 @@ export class AcpProvider extends LLMProvider {
502
509
  this.turnActions.delete(id);
503
510
  return;
504
511
  }
512
+
513
+ const isPeerNativeSkill = rawTitle.toLowerCase() === 'skill'
514
+ || name.toLowerCase() === 'skill'
515
+ || earlier?.name === 'skill';
516
+ const isFailedSkill = isPeerNativeSkill && (
517
+ updateObj.status === 'failed'
518
+ || (typeof input.error === 'string' && /Skill\s+.*not found/i.test(input.error))
519
+ || (typeof (updateObj as any).error === 'string' && /Skill\s+.*not found/i.test((updateObj as any).error))
520
+ || (typeof rawOutputObj?.error === 'string' && /Skill\s+.*not found/i.test(rawOutputObj.error))
521
+ );
522
+ if (isFailedSkill) {
523
+ if (!this.toolRoutingError) {
524
+ const requestedSkill = String(
525
+ input.name || input.id || input.skill_id || input.skill || input.path
526
+ || (earlier?.parameters as any)?.name || (earlier?.parameters as any)?.id || (earlier?.parameters as any)?.skill_id || ''
527
+ ).trim();
528
+ this.toolRoutingError = {
529
+ tool: 'fs_read_skill',
530
+ message: `Peer-native skill not found in peer catalog; routed to Causyne host tool fs_read_skill`,
531
+ parameters: requestedSkill ? { skill_id: requestedSkill } : undefined
532
+ };
533
+ client.notifyCancel(sessionId);
534
+ }
535
+ this.liveFileActions.delete(id);
536
+ this.turnActions.delete(id);
537
+ return;
538
+ }
505
539
  const locationPath = updateObj.locations?.[0]?.path;
506
540
  const inputPath = typeof input.path === 'string' ? input.path
507
541
  : typeof input.filePath === 'string' ? input.filePath
@@ -27,14 +27,87 @@ export default {
27
27
  },
28
28
  execute: async (args) => {
29
29
  try {
30
- const parsed = parseSkillId(args?.skill_id);
31
- if ('error' in parsed)
32
- return { success: false, error: parsed.error };
33
- const domain = parsed.domain;
34
- const id = parsed.name;
35
- const info = listCompiledSkills().find(s => s.domain === domain && s.id === id);
36
- if (!info)
37
- return { success: false, error: `Unknown skill ${domain}/${id}. Search the current catalog first.` };
30
+ const rawSkillId = String(args?.skill_id || args?.id || args?.name || args?.skill || '').trim();
31
+ if (!rawSkillId) {
32
+ return { success: false, error: 'skill_id is required' };
33
+ }
34
+ const allSkills = listCompiledSkills();
35
+ let domain;
36
+ let id;
37
+ const parsed = parseSkillId(rawSkillId);
38
+ if (!('error' in parsed) && parsed.domain && parsed.name) {
39
+ domain = parsed.domain;
40
+ id = parsed.name;
41
+ }
42
+ else {
43
+ const cleanName = rawSkillId.includes('/') ? (rawSkillId.split('/').pop() || rawSkillId) : rawSkillId;
44
+ const directMatch = allSkills.find(s => s.id === cleanName || s.name === cleanName);
45
+ if (directMatch) {
46
+ domain = directMatch.domain;
47
+ id = directMatch.id;
48
+ }
49
+ else if ('error' in parsed) {
50
+ const queryTokens = rawSkillId.toLowerCase().split(/[\/_-]/).filter(t => t.length > 2);
51
+ const suggestions = allSkills
52
+ .map(s => {
53
+ let score = 0;
54
+ const d = s.domain.toLowerCase();
55
+ const n = s.id.toLowerCase();
56
+ const desc = (s.description || '').toLowerCase();
57
+ for (const t of queryTokens) {
58
+ if (n.includes(t))
59
+ score += 10;
60
+ if (d.includes(t))
61
+ score += 8;
62
+ if (desc.includes(t))
63
+ score += 2;
64
+ }
65
+ return { skill: s, score };
66
+ })
67
+ .filter(item => item.score > 0)
68
+ .sort((a, b) => b.score - a.score)
69
+ .slice(0, 3)
70
+ .map(item => `${item.skill.domain}/${item.skill.id}`);
71
+ const hint = suggestions.length > 0 ? ` Did you mean: ${suggestions.join(', ')}?` : '';
72
+ return { success: false, error: `Invalid skill id "${rawSkillId}".${hint} Expected "domain/name", for example android/gradle-build-configuration.` };
73
+ }
74
+ }
75
+ let info = allSkills.find(s => s.domain === domain && s.id === id);
76
+ if (!info && id) {
77
+ const alt = allSkills.find(s => s.id === id || s.name === id);
78
+ if (alt) {
79
+ domain = alt.domain;
80
+ id = alt.id;
81
+ info = alt;
82
+ }
83
+ }
84
+ if (!info) {
85
+ const queryTokens = `${domain || ''} ${id || ''} ${rawSkillId}`.toLowerCase().split(/[\/_-]/).filter(t => t.length > 2);
86
+ const suggestions = allSkills
87
+ .map(s => {
88
+ let score = 0;
89
+ const d = s.domain.toLowerCase();
90
+ const n = s.id.toLowerCase();
91
+ const desc = (s.description || '').toLowerCase();
92
+ for (const t of queryTokens) {
93
+ if (n.includes(t))
94
+ score += 10;
95
+ if (d.includes(t))
96
+ score += 8;
97
+ if (desc.includes(t))
98
+ score += 2;
99
+ }
100
+ return { skill: s, score };
101
+ })
102
+ .filter(item => item.score > 0)
103
+ .sort((a, b) => b.score - a.score)
104
+ .slice(0, 3)
105
+ .map(item => `${item.skill.domain}/${item.skill.id}`);
106
+ const hint = suggestions.length > 0 ? ` Did you mean: ${suggestions.join(', ')}?` : '';
107
+ return { success: false, error: `Unknown skill ${domain ? `${domain}/${id}` : rawSkillId}.${hint} Search the current catalog with tool_search first.` };
108
+ }
109
+ domain = info.domain;
110
+ id = info.id;
38
111
  const root = userSkillsRoot();
39
112
  const resource = args.file_path;
40
113
  if (resource !== undefined) {
@@ -10,7 +10,13 @@ import { listCompiledSkills, readCompiledSkill } from '../skillsManager.js';
10
10
  import { parseSkillId, userSkillsRoot } from '../userSkills.js';
11
11
  import { listSkillResourcePaths, readSkillTextResource } from '../skills/skillResourceSafety.js';
12
12
 
13
- interface SkillReadArgs { skill_id: string; file_path?: string; }
13
+ interface SkillReadArgs {
14
+ skill_id?: string;
15
+ id?: string;
16
+ name?: string;
17
+ skill?: string;
18
+ file_path?: string;
19
+ }
14
20
  interface SkillReadResult { success: boolean; result?: string; error?: string; }
15
21
 
16
22
  export default {
@@ -31,12 +37,84 @@ export default {
31
37
  },
32
38
  execute: async (args: SkillReadArgs): Promise<SkillReadResult> => {
33
39
  try {
34
- const parsed = parseSkillId(args?.skill_id);
35
- if ('error' in parsed) return { success: false, error: parsed.error };
36
- const domain = parsed.domain!;
37
- const id = parsed.name!;
38
- const info = listCompiledSkills().find(s => s.domain === domain && s.id === id);
39
- if (!info) return { success: false, error: `Unknown skill ${domain}/${id}. Search the current catalog first.` };
40
+ const rawSkillId = String(args?.skill_id || (args as any)?.id || (args as any)?.name || (args as any)?.skill || '').trim();
41
+ if (!rawSkillId) {
42
+ return { success: false, error: 'skill_id is required' };
43
+ }
44
+
45
+ const allSkills = listCompiledSkills();
46
+ let domain: string | undefined;
47
+ let id: string | undefined;
48
+
49
+ const parsed = parseSkillId(rawSkillId);
50
+ if (!('error' in parsed) && parsed.domain && parsed.name) {
51
+ domain = parsed.domain;
52
+ id = parsed.name;
53
+ } else {
54
+ const cleanName = rawSkillId.includes('/') ? (rawSkillId.split('/').pop() || rawSkillId) : rawSkillId;
55
+ const directMatch = allSkills.find(s => s.id === cleanName || s.name === cleanName);
56
+ if (directMatch) {
57
+ domain = directMatch.domain;
58
+ id = directMatch.id;
59
+ } else if ('error' in parsed) {
60
+ const queryTokens = rawSkillId.toLowerCase().split(/[\/_-]/).filter(t => t.length > 2);
61
+ const suggestions = allSkills
62
+ .map(s => {
63
+ let score = 0;
64
+ const d = s.domain.toLowerCase();
65
+ const n = s.id.toLowerCase();
66
+ const desc = (s.description || '').toLowerCase();
67
+ for (const t of queryTokens) {
68
+ if (n.includes(t)) score += 10;
69
+ if (d.includes(t)) score += 8;
70
+ if (desc.includes(t)) score += 2;
71
+ }
72
+ return { skill: s, score };
73
+ })
74
+ .filter(item => item.score > 0)
75
+ .sort((a, b) => b.score - a.score)
76
+ .slice(0, 3)
77
+ .map(item => `${item.skill.domain}/${item.skill.id}`);
78
+ const hint = suggestions.length > 0 ? ` Did you mean: ${suggestions.join(', ')}?` : '';
79
+ return { success: false, error: `Invalid skill id "${rawSkillId}".${hint} Expected "domain/name", for example android/gradle-build-configuration.` };
80
+ }
81
+ }
82
+
83
+ let info = allSkills.find(s => s.domain === domain && s.id === id);
84
+ if (!info && id) {
85
+ const alt = allSkills.find(s => s.id === id || s.name === id);
86
+ if (alt) {
87
+ domain = alt.domain;
88
+ id = alt.id;
89
+ info = alt;
90
+ }
91
+ }
92
+
93
+ if (!info) {
94
+ const queryTokens = `${domain || ''} ${id || ''} ${rawSkillId}`.toLowerCase().split(/[\/_-]/).filter(t => t.length > 2);
95
+ const suggestions = allSkills
96
+ .map(s => {
97
+ let score = 0;
98
+ const d = s.domain.toLowerCase();
99
+ const n = s.id.toLowerCase();
100
+ const desc = (s.description || '').toLowerCase();
101
+ for (const t of queryTokens) {
102
+ if (n.includes(t)) score += 10;
103
+ if (d.includes(t)) score += 8;
104
+ if (desc.includes(t)) score += 2;
105
+ }
106
+ return { skill: s, score };
107
+ })
108
+ .filter(item => item.score > 0)
109
+ .sort((a, b) => b.score - a.score)
110
+ .slice(0, 3)
111
+ .map(item => `${item.skill.domain}/${item.skill.id}`);
112
+ const hint = suggestions.length > 0 ? ` Did you mean: ${suggestions.join(', ')}?` : '';
113
+ return { success: false, error: `Unknown skill ${domain ? `${domain}/${id}` : rawSkillId}.${hint} Search the current catalog with tool_search first.` };
114
+ }
115
+
116
+ domain = info.domain;
117
+ id = info.id;
40
118
 
41
119
  const root = userSkillsRoot();
42
120
  const resource = args.file_path;
@@ -140,7 +140,15 @@ export const TOOL_NAME_ALIASES = {
140
140
  printer_list: 'printer_list_printers',
141
141
  create_skill: 'skill_create',
142
142
  read_skill: 'fs_read_skill',
143
+ read_skil: 'fs_read_skill',
144
+ fs_read_skil: 'fs_read_skill',
145
+ skill_read: 'fs_read_skill',
146
+ skill_read_native: 'fs_read_skill',
143
147
  readNativeSkill: 'fs_read_skill',
148
+ read_native_skill: 'fs_read_skill',
149
+ load_skill: 'fs_read_skill',
150
+ get_skill: 'fs_read_skill',
151
+ skill: 'fs_read_skill',
144
152
  take_screenshot: 'screenshot',
145
153
  capture_screenshot: 'screenshot',
146
154
  open_file: 'desktop_open',
@@ -169,7 +169,15 @@ export const TOOL_NAME_ALIASES: Record<string, string> = {
169
169
  printer_list: 'printer_list_printers',
170
170
  create_skill: 'skill_create',
171
171
  read_skill: 'fs_read_skill',
172
+ read_skil: 'fs_read_skill',
173
+ fs_read_skil: 'fs_read_skill',
174
+ skill_read: 'fs_read_skill',
175
+ skill_read_native: 'fs_read_skill',
172
176
  readNativeSkill: 'fs_read_skill',
177
+ read_native_skill: 'fs_read_skill',
178
+ load_skill: 'fs_read_skill',
179
+ get_skill: 'fs_read_skill',
180
+ skill: 'fs_read_skill',
173
181
  take_screenshot: 'screenshot',
174
182
  capture_screenshot: 'screenshot',
175
183
  open_file: 'desktop_open',