@causyne/agent 1.20.91 → 1.20.94

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 (46) hide show
  1. package/package.json +1 -1
  2. package/src/agentLoop.js +116 -26
  3. package/src/agentLoop.ts +121 -26
  4. package/src/contextManager.js +2 -0
  5. package/src/decideTools.js +9 -0
  6. package/src/decideTools.ts +9 -0
  7. package/src/decisionPolicy.js +119 -1
  8. package/src/decisionPolicy.ts +129 -1
  9. package/src/historyPruner.js +16 -1
  10. package/src/historyPruner.ts +13 -1
  11. package/src/sandbox.js +33 -7
  12. package/src/skills/skillResourceSafety.js +70 -0
  13. package/src/skills/skillResourceSafety.ts +77 -0
  14. package/src/smartToolsUse.js +28 -11
  15. package/src/smartToolsUse.ts +34 -11
  16. package/src/taskShape.js +28 -13
  17. package/src/taskShape.ts +31 -12
  18. package/src/tools/codeSearcher.js +349 -210
  19. package/src/tools/codeSearcher.ts +408 -0
  20. package/src/tools/codebaseSearch.js +182 -68
  21. package/src/tools/codebaseSearch.ts +221 -0
  22. package/src/tools/deferredMcpSearch.js +94 -40
  23. package/src/tools/deferredMcpSearch.ts +89 -30
  24. package/src/tools/fsFind.js +180 -115
  25. package/src/tools/fsFind.ts +228 -0
  26. package/src/tools/fsList.js +149 -69
  27. package/src/tools/fsList.ts +224 -0
  28. package/src/tools/fsSearch.js +192 -189
  29. package/src/tools/fsSearch.ts +241 -0
  30. package/src/tools/readNativeSkill.js +34 -42
  31. package/src/tools/readNativeSkill.ts +38 -36
  32. package/src/tools/searchRelevance.js +70 -0
  33. package/src/tools/searchRelevance.ts +72 -0
  34. package/src/tools/toolSelfRepair.js +56 -20
  35. package/src/tools/toolSelfRepair.ts +58 -19
  36. package/src/tools/walkerSafety.js +445 -0
  37. package/src/tools/walkerSafety.ts +516 -0
  38. package/src/tui/composerGeometry.js +45 -0
  39. package/src/tui/composerGeometry.ts +80 -0
  40. package/src/tui/homeView.js +10 -6
  41. package/src/tui/homeView.ts +10 -6
  42. package/src/tui/lineEditor.js +8 -0
  43. package/src/tui/prompt.js +9 -4
  44. package/src/userSkills.js +183 -203
  45. package/src/userSkills.ts +301 -0
  46. package/src/userSkills.d.ts +0 -26
package/src/taskShape.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { isPureSkillOrCapabilityLookup, redactSkillAndQueryLiterals } from './decisionPolicy.js';
1
2
  const PACK_SIGNALS = {
2
3
  game: {
3
4
  strong: ['game', 'gamedev', 'godot', 'unity', 'unreal', 'rpg', 'platformer', 'roguelike', 'arcade', 'voxel', 'minecraft', 'tilemap', 'spritesheet', 'boss fight', 'level design', 'simulator', 'simulation', 'simulasi', 'tinder-3d', '3d'],
@@ -71,11 +72,16 @@ const ARCHETYPES = {
71
72
  research: {
72
73
  label: 'Investigate and report, without changing the system',
73
74
  match: {
74
- strong: ['explain', 'analyse', 'analyze', 'research', 'compare', 'what is', 'how does', 'review', 'audit', 'analisa', 'jelaskan', 'cek', 'periksa'],
75
- weak: ['understand', 'find out', 'summarize']
75
+ strong: [
76
+ 'explain', 'analyse', 'analyze', 'research', 'compare', 'what is', 'what skills',
77
+ 'which skills', 'list skills', 'available skills', 'read the skill',
78
+ 'using fs_read_skill', 'use tool_search', 'capabilities matching',
79
+ 'how does', 'review', 'audit', 'analisa', 'jelaskan', 'cek', 'periksa'
80
+ ],
81
+ weak: ['understand', 'find out', 'summarize', 'skill', 'skills', 'tool_search']
76
82
  },
77
83
  phases: [
78
- { name: 'Gather', tools: ['code_search_ripgrep', 'fs_read', 'web_search', 'web_fetch'], note: 'Search broadly with several phrasings in parallel before concluding.' },
84
+ { name: 'Gather', tools: ['fs_read_skill', 'tool_search', 'code_search_ripgrep', 'fs_read', 'web_search', 'web_fetch'], note: 'Search broadly with several phrasings in parallel before concluding.' },
79
85
  { name: 'Report', tools: [], note: 'Answer concisely and cite exact file paths or URLs. Do not modify anything unless asked.' }
80
86
  ]
81
87
  },
@@ -122,21 +128,26 @@ function scoreSignals(text, signals) {
122
128
  *
123
129
  */
124
130
  export function analyzeTask(prompt, workspaceContext = null) {
125
- const text = String(prompt || '').toLowerCase();
131
+ const rawPrompt = String(prompt || '');
132
+ const pureSkillLookup = isPureSkillOrCapabilityLookup(rawPrompt);
133
+ const text = (pureSkillLookup ? redactSkillAndQueryLiterals(rawPrompt) : rawPrompt).toLowerCase();
126
134
  // Which capability packs are worth their token cost for this request.
127
135
  const packScores = [];
128
- for (const packName of Object.keys(PACK_SIGNALS)) {
129
- const signals = PACK_SIGNALS[packName];
130
- if (!signals)
131
- continue;
132
- const { score } = scoreSignals(text, signals);
133
- if (score >= PACK_THRESHOLD) {
134
- packScores.push({ name: packName, score });
136
+ if (!pureSkillLookup) {
137
+ for (const packName of Object.keys(PACK_SIGNALS)) {
138
+ const signals = PACK_SIGNALS[packName];
139
+ if (!signals)
140
+ continue;
141
+ const { score } = scoreSignals(text, signals);
142
+ if (score >= PACK_THRESHOLD) {
143
+ packScores.push({ name: packName, score });
144
+ }
135
145
  }
136
146
  }
137
147
  // Workspace evidence outranks keywords: a Godot project on disk is far more
138
- // reliable than any phrasing in the prompt.
139
- if (workspaceContext) {
148
+ // reliable than any phrasing in the prompt. Pure skill/capability lookups
149
+ // stay lightweight and never preload workspace app packs.
150
+ if (workspaceContext && !pureSkillLookup) {
140
151
  const signals = [
141
152
  workspaceContext.framework,
142
153
  workspaceContext.projectType,
@@ -180,6 +191,10 @@ export function analyzeTask(prompt, workspaceContext = null) {
180
191
  bestArchetype = 'integrate';
181
192
  bestScore = integrationScore;
182
193
  }
194
+ if (pureSkillLookup) {
195
+ bestArchetype = 'research';
196
+ bestScore = Math.max(bestScore, STRONG_WEIGHT);
197
+ }
183
198
  const archetype = bestArchetype || 'build_app';
184
199
  const confidence = bestScore >= 6 ? 'high' : (bestScore >= 3 ? 'medium' : 'low');
185
200
  const definition = ARCHETYPES[archetype];
package/src/taskShape.ts CHANGED
@@ -1,3 +1,7 @@
1
+ import {
2
+ isPureSkillOrCapabilityLookup,
3
+ redactSkillAndQueryLiterals
4
+ } from './decisionPolicy.js';
1
5
  import type {
2
6
  TaskPackScore,
3
7
  TaskPhase,
@@ -92,11 +96,16 @@ const ARCHETYPES: Record<string, ArchetypeDefinition> = {
92
96
  research: {
93
97
  label: 'Investigate and report, without changing the system',
94
98
  match: {
95
- strong: ['explain', 'analyse', 'analyze', 'research', 'compare', 'what is', 'how does', 'review', 'audit', 'analisa', 'jelaskan', 'cek', 'periksa'],
96
- weak: ['understand', 'find out', 'summarize']
99
+ strong: [
100
+ 'explain', 'analyse', 'analyze', 'research', 'compare', 'what is', 'what skills',
101
+ 'which skills', 'list skills', 'available skills', 'read the skill',
102
+ 'using fs_read_skill', 'use tool_search', 'capabilities matching',
103
+ 'how does', 'review', 'audit', 'analisa', 'jelaskan', 'cek', 'periksa'
104
+ ],
105
+ weak: ['understand', 'find out', 'summarize', 'skill', 'skills', 'tool_search']
97
106
  },
98
107
  phases: [
99
- { name: 'Gather', tools: ['code_search_ripgrep', 'fs_read', 'web_search', 'web_fetch'], note: 'Search broadly with several phrasings in parallel before concluding.' },
108
+ { name: 'Gather', tools: ['fs_read_skill', 'tool_search', 'code_search_ripgrep', 'fs_read', 'web_search', 'web_fetch'], note: 'Search broadly with several phrasings in parallel before concluding.' },
100
109
  { name: 'Report', tools: [], note: 'Answer concisely and cite exact file paths or URLs. Do not modify anything unless asked.' }
101
110
  ]
102
111
  },
@@ -149,22 +158,27 @@ function scoreSignals(text: string, signals: SignalSet): { score: number; hits:
149
158
  *
150
159
  */
151
160
  export function analyzeTask(prompt: string, workspaceContext: WorkspaceContext | null = null): TaskShape {
152
- const text = String(prompt || '').toLowerCase();
161
+ const rawPrompt = String(prompt || '');
162
+ const pureSkillLookup = isPureSkillOrCapabilityLookup(rawPrompt);
163
+ const text = (pureSkillLookup ? redactSkillAndQueryLiterals(rawPrompt) : rawPrompt).toLowerCase();
153
164
 
154
165
  // Which capability packs are worth their token cost for this request.
155
166
  const packScores: TaskPackScore[] = [];
156
- for (const packName of Object.keys(PACK_SIGNALS)) {
157
- const signals = PACK_SIGNALS[packName];
158
- if (!signals) continue;
159
- const { score } = scoreSignals(text, signals);
160
- if (score >= PACK_THRESHOLD) {
161
- packScores.push({ name: packName, score });
167
+ if (!pureSkillLookup) {
168
+ for (const packName of Object.keys(PACK_SIGNALS)) {
169
+ const signals = PACK_SIGNALS[packName];
170
+ if (!signals) continue;
171
+ const { score } = scoreSignals(text, signals);
172
+ if (score >= PACK_THRESHOLD) {
173
+ packScores.push({ name: packName, score });
174
+ }
162
175
  }
163
176
  }
164
177
 
165
178
  // Workspace evidence outranks keywords: a Godot project on disk is far more
166
- // reliable than any phrasing in the prompt.
167
- if (workspaceContext) {
179
+ // reliable than any phrasing in the prompt. Pure skill/capability lookups
180
+ // stay lightweight and never preload workspace app packs.
181
+ if (workspaceContext && !pureSkillLookup) {
168
182
  const signals = [
169
183
  workspaceContext.framework,
170
184
  workspaceContext.projectType,
@@ -208,6 +222,11 @@ export function analyzeTask(prompt: string, workspaceContext: WorkspaceContext |
208
222
  bestScore = integrationScore;
209
223
  }
210
224
 
225
+ if (pureSkillLookup) {
226
+ bestArchetype = 'research';
227
+ bestScore = Math.max(bestScore, STRONG_WEIGHT);
228
+ }
229
+
211
230
  const archetype = bestArchetype || 'build_app';
212
231
  const confidence = bestScore >= 6 ? 'high' : (bestScore >= 3 ? 'medium' : 'low');
213
232