@causyne/agent 1.20.13 → 1.20.15

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 (71) hide show
  1. package/package.json +1 -1
  2. package/src/SmartTools.js +33 -0
  3. package/src/SmartTools.ts +37 -0
  4. package/src/acp/client.js +157 -4
  5. package/src/acp/client.ts +152 -5
  6. package/src/agentLoop.js +857 -178
  7. package/src/agentLoop.ts +865 -183
  8. package/src/browser/browserRuntime.js +8 -1
  9. package/src/browser/browserRuntime.ts +8 -1
  10. package/src/browser/causyneBrowser.js +20 -4
  11. package/src/browser/causyneBrowser.ts +20 -4
  12. package/src/browser/urlPolicy.js +35 -0
  13. package/src/browser/urlPolicy.ts +34 -0
  14. package/src/cliMode.js +6 -2
  15. package/src/commands.js +14 -0
  16. package/src/contextManager.d.ts +1 -0
  17. package/src/core/contextCompactor.js +277 -0
  18. package/src/core/contextCompactor.ts +353 -0
  19. package/src/decideTools.js +157 -0
  20. package/src/decideTools.ts +195 -0
  21. package/src/decisionPolicy.js +5 -3
  22. package/src/decisionPolicy.ts +5 -3
  23. package/src/implementationPlan.js +284 -0
  24. package/src/implementationPlan.ts +275 -0
  25. package/src/observer/coldObserver.js +10 -4
  26. package/src/observer/coldObserver.ts +15 -7
  27. package/src/observer/evidence.js +11 -5
  28. package/src/observer/evidence.ts +13 -6
  29. package/src/observer.js +196 -0
  30. package/src/observer.ts +287 -0
  31. package/src/providers/acp.js +362 -109
  32. package/src/providers/acp.ts +359 -111
  33. package/src/providers/antigravity.js +133 -105
  34. package/src/providers/antigravity.ts +130 -109
  35. package/src/providers/base.d.ts +3 -0
  36. package/src/providers/budgetEnforcer.js +23 -2
  37. package/src/providers/budgetEnforcer.ts +20 -5
  38. package/src/provisioning/capabilityProvisioner.js +14 -10
  39. package/src/sandbox.js +4 -2
  40. package/src/saveTools.js +146 -0
  41. package/src/saveTools.ts +169 -0
  42. package/src/session/cachePressure.js +77 -0
  43. package/src/session/cachePressure.ts +122 -0
  44. package/src/smartToolsUse.js +96 -15
  45. package/src/smartToolsUse.ts +133 -15
  46. package/src/taskShape.js +7 -7
  47. package/src/taskShape.ts +7 -7
  48. package/src/timeMachine.js +55 -20
  49. package/src/timeMachine.ts +64 -20
  50. package/src/toolPacks.js +217 -310
  51. package/src/toolPacks.ts +505 -0
  52. package/src/tools/deferredMcpSearch.js +21 -13
  53. package/src/tools/deferredMcpSearch.ts +23 -15
  54. package/src/tools/updatePlan.js +2 -2
  55. package/src/tools/updatePlan.ts +2 -2
  56. package/src/toolsList.js +203 -0
  57. package/src/toolsList.ts +224 -0
  58. package/src/tui/chatRenderer.js +49 -14
  59. package/src/tui/codeStreamRenderer.js +16 -5
  60. package/src/tui/codeStreamRenderer.ts +14 -4
  61. package/src/tui/prompt.js +4 -2
  62. package/src/tui/sessionSidebar.js +10 -2
  63. package/src/tui/sessionSidebar.ts +10 -3
  64. package/src/tui/stageSurface.js +27 -1
  65. package/src/tui/text.d.ts +1 -0
  66. package/src/tui/turnRail.js +274 -0
  67. package/src/tui/turnRail.ts +334 -0
  68. package/src/types/contracts.ts +103 -0
  69. package/src/verificationPlan.js +141 -0
  70. package/src/verificationPlan.ts +166 -0
  71. package/src/toolPacks.d.ts +0 -10
@@ -12,7 +12,8 @@ import { isMutatingToolCall } from './decisionPolicy.js';
12
12
  const INSPECTION_TOOLS = new Set([
13
13
  'fs_read', 'fs_list', 'fs_find', 'fs_search', 'grep_search', 'code_searcher',
14
14
  'codebase_search', 'web_search', 'web_fetch', 'browser_snapshot',
15
- 'browser_get_dom', 'view_image', 'pdf_read', 'dir_list'
15
+ 'browser_get_dom', 'view_image', 'pdf_read', 'dir_list',
16
+ 'read', 'read_file', 'view_file', 'viewfile', 'cat', 'glob', 'grep', 'search', 'list_dir', 'ls'
16
17
  ]);
17
18
  const VERIFICATION_TOOLS = new Set([
18
19
  'screenshot', 'vision_inspect_ui', 'browser_console', 'ax_snapshot'
@@ -20,18 +21,23 @@ const VERIFICATION_TOOLS = new Set([
20
21
  function isInspection(toolName, args) {
21
22
  if (INSPECTION_TOOLS.has(toolName))
22
23
  return true;
23
- if (toolName !== 'sysRun')
24
+ if (!['sysRun', 'bash', 'terminal', 'execute', 'sh', 'zsh'].includes(toolName))
24
25
  return false;
25
26
  return /^\s*(?:pwd|ls|find|rg|grep|cat|sed|head|tail|git\s+(?:status|diff|log|show)|npm\s+(?:view|audit))\b/i
26
- .test(String(args.command ?? ''));
27
+ .test(String(args.command ?? args.cmd ?? ''));
27
28
  }
28
29
  function isVerification(toolName, args) {
29
30
  if (VERIFICATION_TOOLS.has(toolName))
30
31
  return true;
31
- if (toolName !== 'sysRun')
32
+ if (toolName === 'browser_act') {
33
+ const actions = Array.isArray(args.actions) ? args.actions : [args];
34
+ return actions.some((item) => item !== null && typeof item === 'object'
35
+ && ['preview', 'screenshot', 'inspect', 'snapshot'].includes(String(item.action ?? item.type ?? '')));
36
+ }
37
+ if (!['sysRun', 'bash', 'terminal', 'execute', 'sh', 'zsh'].includes(toolName))
32
38
  return false;
33
- return /^\s*(?:npm\s+(?:test|run\s+(?:test|typecheck|build))|node\s+--check|pytest|cargo\s+test|go\s+test)\b/i
34
- .test(String(args.command ?? ''));
39
+ return /^\s*(?:npm\s+(?:test|run\s+(?:test|typecheck|build))|node\s+--check|pytest|cargo\s+test|go\s+test|python(?:3)?\s+-m\s+unittest|vitest|jest|playwright|cypress)\b/i
40
+ .test(String(args.command ?? args.cmd ?? ''));
35
41
  }
36
42
  /**
37
43
  * Bound each inspection batch to two calls, then yield to a synthesis step.
@@ -116,14 +122,16 @@ const PURE_WEB_SEARCH_PATTERN = /\b(search(ing)? (the )?web|web search|look up o
116
122
  const WEB_CONSTRUCTION_EXCLUSION = /\b(build|create|make|design|develop|scaffold|code|program|css|html|tailwind|component|frontend|front-end|landing page|website|webpage|dashboard)\b/i;
117
123
  // System admin / process & terminal operations
118
124
  const SYSTEM_ADMIN_PATTERN = /\b(kill process|kill port|check port|port \d+|lsof|ps aux|terminate process|zip folder|unzip file|extract archive|compress folder)\b/i;
119
- // Simple file management operations
120
- const SIMPLE_FILE_OP_PATTERN = /\b(list (the )?files|show files|count files|rename file(s)?|delete file(s)?|move file(s)?|clean (up )?folder)\b/i;
125
+ // Simple file management operations (reading small notes, listing/deleting/moving files)
126
+ const SIMPLE_FILE_OP_PATTERN = /\b(list (the )?files|show files|count files|rename file(s)?|delete file(s)?|move file(s)?|clean (up )?folder|read (the )?(?:note|file)|summarize (?:its )?content)\b/i;
121
127
  // Media generation intent (explicit creation of 3D, video, audio, or synthesized speech)
122
128
  const EXPLICIT_MEDIA_GENERATION_PATTERN = /\b(blender|3d model|render 3d|render frame|render animation|da vinci|resolve|audio synth|synthesizer|text to speech|tts|voiceover|dubbing)\b|\.blend\d*\b/i;
123
129
  // Explicit web engineering intent
124
- const EXPLICIT_WEB_ENGINEERING_PATTERN = /\b(build|create|make|design|develop|implement|redesign|buat\w*)\b[\s\S]*\b(web|website|webpage|webapp|landing page|dashboard|ui|frontend|threejs|three\.js|3js)\b/i;
130
+ const EXPLICIT_WEB_ENGINEERING_PATTERN = /\b(build|create|make|design|develop|implement|redesign|buat\w*)\b[\s\S]*\b(web|website|webpage|webapp|landing page|dashboard|ui|frontend|threejs|three\.js|thre\.?js|3js|webgl|canvas)\b/i;
125
131
  // Explicit game development intent
126
- const EXPLICIT_GAME_DEV_PATTERN = /\b(build.*game|create.*game|develop.*game|godot|unity|unreal|platformer 2d|rpg game|arcade game)\b/i;
132
+ const EXPLICIT_GAME_DEV_PATTERN = /(?:\b(?:build|create|make|design|develop|scaffold|render|animate|code|program|buat\w*|bikin\w*)[\s\S]*(?:game|simulation|simulator|simulasi|interactive|3d|three\.?js|threejs|webgl|canvas3d|babylonjs|godot|unity|unreal|platformer|rpg|arcade)\b|\b(?:game|gamedev|godot|unity|unreal|platformer|rpg|arcade|simulator|simulation|simulasi|interactive)\b|\b3d\s*(?:game|app|simulator|simulation|scene|city|world|view|body|human|anatomy|model|mesh|character|rendering|visualization|experience|space|environment)\b|\bin 3d\b|[-_]3d\b|\b3d[-_]|\b(?:threejs|three\.js|webgl|canvas3d|babylonjs)\b)/i;
133
+ // Explicit software and systems engineering intent (backend, APIs, refactoring, algorithms, testing, architecture, CLI tools)
134
+ const EXPLICIT_SOFTWARE_ENGINEERING_PATTERN = /(?:\b(?:build|create|code|program|develop|refactor|debug|fix|implement|test|optimize|write|add|modify|migrate|architect|engineer|benchmark|profile|audit)\b[\s\S]*\b(?:api|backend|service|microservice|server|database|schema|endpoint|controller|auth|test|spec|algorithm|function|module|class|feature|script|pipeline|codebase|repo|repository|bug|issue|engine|tool|cli|library|sdk|migration|handler|worker|queue|stream)\b|\b(?:python|rust|golang|c\+\+|cpp|java|typescript|javascript|ruby|php|sql|bash|shell|docker|k8s|kubernetes)\b)/i;
127
135
  /**
128
136
  * Select tools to preload based on prompt intent. This is never an allowlist:
129
137
  * tool_search can add capabilities as the task develops.
@@ -190,7 +198,7 @@ export function determineToolScope(prompt, _taskShape) {
190
198
  };
191
199
  }
192
200
  // 4. Simple local file manipulation
193
- if (SIMPLE_FILE_OP_PATTERN.test(text) && !EXPLICIT_WEB_ENGINEERING_PATTERN.test(text) && !EXPLICIT_GAME_DEV_PATTERN.test(text)) {
201
+ if (SIMPLE_FILE_OP_PATTERN.test(text) && !EXPLICIT_WEB_ENGINEERING_PATTERN.test(text) && !EXPLICIT_GAME_DEV_PATTERN.test(text) && !EXPLICIT_SOFTWARE_ENGINEERING_PATTERN.test(text)) {
194
202
  const tools = new Set([
195
203
  'fs_read',
196
204
  'fs_write',
@@ -208,6 +216,7 @@ export function determineToolScope(prompt, _taskShape) {
208
216
  reason: 'Simple filesystem operation; suppresses external domain packs.'
209
217
  };
210
218
  }
219
+ // 5. Web engineering intent (websites, web applications, landing pages, Three.js web scenes)
211
220
  if (EXPLICIT_WEB_ENGINEERING_PATTERN.test(text)) {
212
221
  const tools = new Set([
213
222
  'fs_write',
@@ -228,7 +237,7 @@ export function determineToolScope(prompt, _taskShape) {
228
237
  reason: 'Web engineering intent focuses on filesystem authoring, terminal execution, and browser verification; suppresses unrelated media and game packs.'
229
238
  };
230
239
  }
231
- // 5. Media / 3D generation & creative audio intent
240
+ // 6. Media / 3D generation & creative audio intent
232
241
  if (EXPLICIT_MEDIA_GENERATION_PATTERN.test(text)) {
233
242
  const tools = new Set([
234
243
  'blender_act',
@@ -248,6 +257,49 @@ export function determineToolScope(prompt, _taskShape) {
248
257
  reason: 'Media generation intent prioritizes 3D studio, procedural media, and image inspection; suppresses web and game packs.'
249
258
  };
250
259
  }
260
+ // 7. Game development and interactive simulation intent (simulators, 3D worlds, games)
261
+ if (EXPLICIT_GAME_DEV_PATTERN.test(text)) {
262
+ const tools = new Set([
263
+ 'fs_write',
264
+ 'fs_edit',
265
+ 'fs_read',
266
+ 'fs_list',
267
+ 'sysRun',
268
+ 'browser_act',
269
+ 'screenshot',
270
+ 'vision_inspect_ui',
271
+ 'update_plan',
272
+ 'tool_search'
273
+ ]);
274
+ return {
275
+ toolScope: tools,
276
+ archetype: 'game_development',
277
+ suppressedPacks: ['media', 'advanced', 'system'],
278
+ reason: 'Game development and simulation intent focuses on game code, assets, terminal execution, and browser/screen verification.'
279
+ };
280
+ }
281
+ // 8. Software and systems engineering intent (backend, APIs, refactoring, algorithms, testing, architecture, CLI tools)
282
+ if (EXPLICIT_SOFTWARE_ENGINEERING_PATTERN.test(text)) {
283
+ const tools = new Set([
284
+ 'fs_write',
285
+ 'fs_edit',
286
+ 'fs_read',
287
+ 'fs_list',
288
+ 'fs_search',
289
+ 'sysRun',
290
+ 'browser_act',
291
+ 'screenshot',
292
+ 'vision_inspect_ui',
293
+ 'update_plan',
294
+ 'tool_search'
295
+ ]);
296
+ return {
297
+ toolScope: tools,
298
+ archetype: 'software_engineering',
299
+ suppressedPacks: ['media', 'game'],
300
+ reason: 'Software engineering intent focuses on code authoring, search, terminal execution, and verification; suppresses creative media and game packs.'
301
+ };
302
+ }
251
303
  // Default: unconstrained (standard progressive disclosure and packs apply)
252
304
  return {
253
305
  toolScope: null,
@@ -282,14 +334,14 @@ export function resolveLazyPlaybooks(unlockedPacks, observedTools = [], prompt =
282
334
  const activeDomains = [];
283
335
  let tokenSavings = 0;
284
336
  // 1. Web Domain
285
- if (packs.has('web')) {
337
+ const webExplicitDemand = EXPLICIT_WEB_ENGINEERING_PATTERN.test(text)
338
+ || (isWebIntent(text) && WEB_CONSTRUCTION_EXCLUSION.test(text));
339
+ if (packs.has('web') || webExplicitDemand || tools.has('ui_forge') || tools.has('astryx_oracle')) {
286
340
  const webToolInvoked = tools.has('ui_forge') ||
287
341
  tools.has('browser_act') ||
288
342
  tools.has('vision_inspect_ui') ||
289
343
  tools.has('screenshot') ||
290
344
  tools.has('astryx_oracle');
291
- const webExplicitDemand = EXPLICIT_WEB_ENGINEERING_PATTERN.test(text)
292
- || (isWebIntent(text) && WEB_CONSTRUCTION_EXCLUSION.test(text));
293
345
  if ((webToolInvoked || webExplicitDemand) && PACK_PLAYBOOKS.web) {
294
346
  activePlaybooks.push(PACK_PLAYBOOKS.web);
295
347
  activeDomains.push('web');
@@ -340,3 +392,32 @@ export function resolveLazyPlaybooks(unlockedPacks, observedTools = [], prompt =
340
392
  tokenSavingsEstimate: tokenSavings
341
393
  };
342
394
  }
395
+ /** A mid-task decision may load at most this many schemas at once. */
396
+ export const MAX_ADMIT_PER_STEP = 8;
397
+ /**
398
+ * The smart part: admit only the delta, bound what one step may load, and say
399
+ * what the loop owes before it changes anything. A task the user must decide
400
+ * or plan first keeps the tool for that step reachable, so the checkpoint can
401
+ * never be demanded of a model that was not given the means to meet it.
402
+ */
403
+ export function refineToolDecision(decision, context) {
404
+ const admittedTools = context.admittedTools ?? new Set();
405
+ const admittedPacks = context.admittedPacks ?? new Set();
406
+ const fresh = decision.tools.filter((name) => !admittedTools.has(name));
407
+ const packs = decision.packs.filter((name) => !admittedPacks.has(name));
408
+ const reasons = [...decision.reasons];
409
+ let tools = fresh;
410
+ let deferred = [];
411
+ if (decision.source !== 'intent' && fresh.length > MAX_ADMIT_PER_STEP) {
412
+ tools = fresh.slice(0, MAX_ADMIT_PER_STEP);
413
+ deferred = fresh.slice(MAX_ADMIT_PER_STEP);
414
+ reasons.push(`deferred ${deferred.length} to protect context`);
415
+ }
416
+ const route = context.decisionRequired ? 'decision' : context.planRequired ? 'plan' : 'direct';
417
+ if (decision.source === 'intent') {
418
+ const needed = route === 'decision' ? 'request_decision' : route === 'plan' ? 'update_plan' : '';
419
+ if (needed && !admittedTools.has(needed) && !tools.includes(needed))
420
+ tools = [...tools, needed];
421
+ }
422
+ return { source: decision.source, tools, packs, deferred, route, reasons };
423
+ }
@@ -10,6 +10,7 @@
10
10
 
11
11
  import { PACK_PLAYBOOKS, isWebIntent } from './toolPacks.js';
12
12
  import { isMutatingToolCall } from './decisionPolicy.js';
13
+ import type { ToolDecision } from './decideTools.js';
13
14
 
14
15
  export type ExecutionPhase = 'inspection' | 'synthesis' | 'execution' | 'verification';
15
16
 
@@ -23,7 +24,8 @@ export interface ToolPhaseSnapshot {
23
24
  const INSPECTION_TOOLS = new Set([
24
25
  'fs_read', 'fs_list', 'fs_find', 'fs_search', 'grep_search', 'code_searcher',
25
26
  'codebase_search', 'web_search', 'web_fetch', 'browser_snapshot',
26
- 'browser_get_dom', 'view_image', 'pdf_read', 'dir_list'
27
+ 'browser_get_dom', 'view_image', 'pdf_read', 'dir_list',
28
+ 'read', 'read_file', 'view_file', 'viewfile', 'cat', 'glob', 'grep', 'search', 'list_dir', 'ls'
27
29
  ]);
28
30
  const VERIFICATION_TOOLS = new Set([
29
31
  'screenshot', 'vision_inspect_ui', 'browser_console', 'ax_snapshot'
@@ -31,16 +33,21 @@ const VERIFICATION_TOOLS = new Set([
31
33
 
32
34
  function isInspection(toolName: string, args: Record<string, unknown>): boolean {
33
35
  if (INSPECTION_TOOLS.has(toolName)) return true;
34
- if (toolName !== 'sysRun') return false;
36
+ if (!['sysRun', 'bash', 'terminal', 'execute', 'sh', 'zsh'].includes(toolName)) return false;
35
37
  return /^\s*(?:pwd|ls|find|rg|grep|cat|sed|head|tail|git\s+(?:status|diff|log|show)|npm\s+(?:view|audit))\b/i
36
- .test(String(args.command ?? ''));
38
+ .test(String(args.command ?? args.cmd ?? ''));
37
39
  }
38
40
 
39
41
  function isVerification(toolName: string, args: Record<string, unknown>): boolean {
40
42
  if (VERIFICATION_TOOLS.has(toolName)) return true;
41
- if (toolName !== 'sysRun') return false;
42
- return /^\s*(?:npm\s+(?:test|run\s+(?:test|typecheck|build))|node\s+--check|pytest|cargo\s+test|go\s+test)\b/i
43
- .test(String(args.command ?? ''));
43
+ if (toolName === 'browser_act') {
44
+ const actions = Array.isArray(args.actions) ? args.actions : [args];
45
+ return actions.some((item: unknown) => item !== null && typeof item === 'object'
46
+ && ['preview', 'screenshot', 'inspect', 'snapshot'].includes(String((item as Record<string, unknown>).action ?? (item as Record<string, unknown>).type ?? '')));
47
+ }
48
+ if (!['sysRun', 'bash', 'terminal', 'execute', 'sh', 'zsh'].includes(toolName)) return false;
49
+ return /^\s*(?:npm\s+(?:test|run\s+(?:test|typecheck|build))|node\s+--check|pytest|cargo\s+test|go\s+test|python(?:3)?\s+-m\s+unittest|vitest|jest|playwright|cypress)\b/i
50
+ .test(String(args.command ?? args.cmd ?? ''));
44
51
  }
45
52
 
46
53
  /**
@@ -153,9 +160,9 @@ const WEB_CONSTRUCTION_EXCLUSION =
153
160
  const SYSTEM_ADMIN_PATTERN =
154
161
  /\b(kill process|kill port|check port|port \d+|lsof|ps aux|terminate process|zip folder|unzip file|extract archive|compress folder)\b/i;
155
162
 
156
- // Simple file management operations
163
+ // Simple file management operations (reading small notes, listing/deleting/moving files)
157
164
  const SIMPLE_FILE_OP_PATTERN =
158
- /\b(list (the )?files|show files|count files|rename file(s)?|delete file(s)?|move file(s)?|clean (up )?folder)\b/i;
165
+ /\b(list (the )?files|show files|count files|rename file(s)?|delete file(s)?|move file(s)?|clean (up )?folder|read (the )?(?:note|file)|summarize (?:its )?content)\b/i;
159
166
 
160
167
  // Media generation intent (explicit creation of 3D, video, audio, or synthesized speech)
161
168
  const EXPLICIT_MEDIA_GENERATION_PATTERN =
@@ -163,11 +170,15 @@ const EXPLICIT_MEDIA_GENERATION_PATTERN =
163
170
 
164
171
  // Explicit web engineering intent
165
172
  const EXPLICIT_WEB_ENGINEERING_PATTERN =
166
- /\b(build|create|make|design|develop|implement|redesign|buat\w*)\b[\s\S]*\b(web|website|webpage|webapp|landing page|dashboard|ui|frontend|threejs|three\.js|3js)\b/i;
173
+ /\b(build|create|make|design|develop|implement|redesign|buat\w*)\b[\s\S]*\b(web|website|webpage|webapp|landing page|dashboard|ui|frontend|threejs|three\.js|thre\.?js|3js|webgl|canvas)\b/i;
167
174
 
168
175
  // Explicit game development intent
169
176
  const EXPLICIT_GAME_DEV_PATTERN =
170
- /\b(build.*game|create.*game|develop.*game|godot|unity|unreal|platformer 2d|rpg game|arcade game)\b/i;
177
+ /(?:\b(?:build|create|make|design|develop|scaffold|render|animate|code|program|buat\w*|bikin\w*)[\s\S]*(?:game|simulation|simulator|simulasi|interactive|3d|three\.?js|threejs|webgl|canvas3d|babylonjs|godot|unity|unreal|platformer|rpg|arcade)\b|\b(?:game|gamedev|godot|unity|unreal|platformer|rpg|arcade|simulator|simulation|simulasi|interactive)\b|\b3d\s*(?:game|app|simulator|simulation|scene|city|world|view|body|human|anatomy|model|mesh|character|rendering|visualization|experience|space|environment)\b|\bin 3d\b|[-_]3d\b|\b3d[-_]|\b(?:threejs|three\.js|webgl|canvas3d|babylonjs)\b)/i;
178
+
179
+ // Explicit software and systems engineering intent (backend, APIs, refactoring, algorithms, testing, architecture, CLI tools)
180
+ const EXPLICIT_SOFTWARE_ENGINEERING_PATTERN =
181
+ /(?:\b(?:build|create|code|program|develop|refactor|debug|fix|implement|test|optimize|write|add|modify|migrate|architect|engineer|benchmark|profile|audit)\b[\s\S]*\b(?:api|backend|service|microservice|server|database|schema|endpoint|controller|auth|test|spec|algorithm|function|module|class|feature|script|pipeline|codebase|repo|repository|bug|issue|engine|tool|cli|library|sdk|migration|handler|worker|queue|stream)\b|\b(?:python|rust|golang|c\+\+|cpp|java|typescript|javascript|ruby|php|sql|bash|shell|docker|k8s|kubernetes)\b)/i;
171
182
 
172
183
  /**
173
184
  * Select tools to preload based on prompt intent. This is never an allowlist:
@@ -242,7 +253,7 @@ export function determineToolScope(
242
253
  }
243
254
 
244
255
  // 4. Simple local file manipulation
245
- if (SIMPLE_FILE_OP_PATTERN.test(text) && !EXPLICIT_WEB_ENGINEERING_PATTERN.test(text) && !EXPLICIT_GAME_DEV_PATTERN.test(text)) {
256
+ if (SIMPLE_FILE_OP_PATTERN.test(text) && !EXPLICIT_WEB_ENGINEERING_PATTERN.test(text) && !EXPLICIT_GAME_DEV_PATTERN.test(text) && !EXPLICIT_SOFTWARE_ENGINEERING_PATTERN.test(text)) {
246
257
  const tools = new Set([
247
258
  'fs_read',
248
259
  'fs_write',
@@ -261,6 +272,7 @@ export function determineToolScope(
261
272
  };
262
273
  }
263
274
 
275
+ // 5. Web engineering intent (websites, web applications, landing pages, Three.js web scenes)
264
276
  if (EXPLICIT_WEB_ENGINEERING_PATTERN.test(text)) {
265
277
  const tools = new Set([
266
278
  'fs_write',
@@ -282,7 +294,7 @@ export function determineToolScope(
282
294
  };
283
295
  }
284
296
 
285
- // 5. Media / 3D generation & creative audio intent
297
+ // 6. Media / 3D generation & creative audio intent
286
298
  if (EXPLICIT_MEDIA_GENERATION_PATTERN.test(text)) {
287
299
  const tools = new Set([
288
300
  'blender_act',
@@ -303,6 +315,51 @@ export function determineToolScope(
303
315
  };
304
316
  }
305
317
 
318
+ // 7. Game development and interactive simulation intent (simulators, 3D worlds, games)
319
+ if (EXPLICIT_GAME_DEV_PATTERN.test(text)) {
320
+ const tools = new Set([
321
+ 'fs_write',
322
+ 'fs_edit',
323
+ 'fs_read',
324
+ 'fs_list',
325
+ 'sysRun',
326
+ 'browser_act',
327
+ 'screenshot',
328
+ 'vision_inspect_ui',
329
+ 'update_plan',
330
+ 'tool_search'
331
+ ]);
332
+ return {
333
+ toolScope: tools,
334
+ archetype: 'game_development',
335
+ suppressedPacks: ['media', 'advanced', 'system'],
336
+ reason: 'Game development and simulation intent focuses on game code, assets, terminal execution, and browser/screen verification.'
337
+ };
338
+ }
339
+
340
+ // 8. Software and systems engineering intent (backend, APIs, refactoring, algorithms, testing, architecture, CLI tools)
341
+ if (EXPLICIT_SOFTWARE_ENGINEERING_PATTERN.test(text)) {
342
+ const tools = new Set([
343
+ 'fs_write',
344
+ 'fs_edit',
345
+ 'fs_read',
346
+ 'fs_list',
347
+ 'fs_search',
348
+ 'sysRun',
349
+ 'browser_act',
350
+ 'screenshot',
351
+ 'vision_inspect_ui',
352
+ 'update_plan',
353
+ 'tool_search'
354
+ ]);
355
+ return {
356
+ toolScope: tools,
357
+ archetype: 'software_engineering',
358
+ suppressedPacks: ['media', 'game'],
359
+ reason: 'Software engineering intent focuses on code authoring, search, terminal execution, and verification; suppresses creative media and game packs.'
360
+ };
361
+ }
362
+
306
363
  // Default: unconstrained (standard progressive disclosure and packs apply)
307
364
  return {
308
365
  toolScope: null,
@@ -350,15 +407,15 @@ export function resolveLazyPlaybooks(
350
407
  let tokenSavings = 0;
351
408
 
352
409
  // 1. Web Domain
353
- if (packs.has('web')) {
410
+ const webExplicitDemand = EXPLICIT_WEB_ENGINEERING_PATTERN.test(text)
411
+ || (isWebIntent(text) && WEB_CONSTRUCTION_EXCLUSION.test(text));
412
+ if (packs.has('web') || webExplicitDemand || tools.has('ui_forge') || tools.has('astryx_oracle')) {
354
413
  const webToolInvoked =
355
414
  tools.has('ui_forge') ||
356
415
  tools.has('browser_act') ||
357
416
  tools.has('vision_inspect_ui') ||
358
417
  tools.has('screenshot') ||
359
418
  tools.has('astryx_oracle');
360
- const webExplicitDemand = EXPLICIT_WEB_ENGINEERING_PATTERN.test(text)
361
- || (isWebIntent(text) && WEB_CONSTRUCTION_EXCLUSION.test(text));
362
419
 
363
420
  if ((webToolInvoked || webExplicitDemand) && PACK_PLAYBOOKS.web) {
364
421
  activePlaybooks.push(PACK_PLAYBOOKS.web);
@@ -414,3 +471,64 @@ export function resolveLazyPlaybooks(
414
471
  tokenSavingsEstimate: tokenSavings
415
472
  };
416
473
  }
474
+
475
+ // ---------------------------------------------------------------------------
476
+ // Pipeline stage 3: refine a decideTools decision before it is saved.
477
+ //
478
+ // user intent -> ToolsList -> decideTools -> SmartTools -> saveTools -> AgentLoop
479
+ // ---------------------------------------------------------------------------
480
+
481
+ /** What the loop must do before it may mutate: nothing, plan, or ask the user. */
482
+ export type ToolRoute = 'direct' | 'plan' | 'decision';
483
+
484
+ export interface SmartToolsContext {
485
+ /** True when the task is complex enough to require an implementation plan. */
486
+ readonly planRequired?: boolean | undefined;
487
+ /** True when the task crosses a durable choice the user must make. */
488
+ readonly decisionRequired?: boolean | undefined;
489
+ readonly admittedTools?: ReadonlySet<string> | undefined;
490
+ readonly admittedPacks?: ReadonlySet<string> | undefined;
491
+ }
492
+
493
+ export interface RefinedToolDecision {
494
+ readonly source: ToolDecision['source'];
495
+ readonly tools: string[];
496
+ readonly packs: string[];
497
+ /** Tools held back this step to protect the context window; the next decision sees them again. */
498
+ readonly deferred: string[];
499
+ readonly route: ToolRoute;
500
+ readonly reasons: string[];
501
+ }
502
+
503
+ /** A mid-task decision may load at most this many schemas at once. */
504
+ export const MAX_ADMIT_PER_STEP = 8;
505
+
506
+ /**
507
+ * The smart part: admit only the delta, bound what one step may load, and say
508
+ * what the loop owes before it changes anything. A task the user must decide
509
+ * or plan first keeps the tool for that step reachable, so the checkpoint can
510
+ * never be demanded of a model that was not given the means to meet it.
511
+ */
512
+ export function refineToolDecision(decision: ToolDecision, context: SmartToolsContext): RefinedToolDecision {
513
+ const admittedTools = context.admittedTools ?? new Set<string>();
514
+ const admittedPacks = context.admittedPacks ?? new Set<string>();
515
+ const fresh = decision.tools.filter((name) => !admittedTools.has(name));
516
+ const packs = decision.packs.filter((name) => !admittedPacks.has(name));
517
+ const reasons = [...decision.reasons];
518
+
519
+ let tools = fresh;
520
+ let deferred: string[] = [];
521
+ if (decision.source !== 'intent' && fresh.length > MAX_ADMIT_PER_STEP) {
522
+ tools = fresh.slice(0, MAX_ADMIT_PER_STEP);
523
+ deferred = fresh.slice(MAX_ADMIT_PER_STEP);
524
+ reasons.push(`deferred ${deferred.length} to protect context`);
525
+ }
526
+
527
+ const route: ToolRoute = context.decisionRequired ? 'decision' : context.planRequired ? 'plan' : 'direct';
528
+ if (decision.source === 'intent') {
529
+ const needed = route === 'decision' ? 'request_decision' : route === 'plan' ? 'update_plan' : '';
530
+ if (needed && !admittedTools.has(needed) && !tools.includes(needed)) tools = [...tools, needed];
531
+ }
532
+
533
+ return { source: decision.source, tools, packs, deferred, route, reasons };
534
+ }
package/src/taskShape.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const PACK_SIGNALS = {
2
2
  game: {
3
- strong: ['game', 'gamedev', 'godot', 'unity', 'unreal', 'rpg', 'platformer', 'roguelike', 'arcade', 'voxel', 'minecraft', 'tilemap', 'spritesheet', 'boss fight', 'level design'],
4
- weak: ['sprite', 'player', 'enemy', 'quest', 'npc', 'gameplay', 'multiplayer', 'leaderboard']
3
+ strong: ['game', 'gamedev', 'godot', 'unity', 'unreal', 'rpg', 'platformer', 'roguelike', 'arcade', 'voxel', 'minecraft', 'tilemap', 'spritesheet', 'boss fight', 'level design', 'simulator', 'simulation', 'simulasi', 'tinder-3d', '3d'],
4
+ weak: ['sprite', 'player', 'enemy', 'quest', 'npc', 'gameplay', 'multiplayer', 'leaderboard', 'character']
5
5
  },
6
6
  web: {
7
7
  strong: ['web app', 'webapp', 'website', 'landing page', 'homepage', 'frontend', 'front-end', 'dashboard', 'portfolio', 'react', 'vue', 'svelte', 'angular', 'nextjs', 'next.js', 'nuxt', 'astro', 'tailwind', 'html', 'css'],
@@ -45,8 +45,8 @@ const ARCHETYPES = {
45
45
  build_app: {
46
46
  label: 'Build a new application from scratch',
47
47
  match: {
48
- strong: ['build me', 'create a', 'make me', 'develop a', 'new app', 'from scratch'],
49
- weak: ['app', 'project', 'tool', 'system']
48
+ strong: ['build me', 'create a', 'make me', 'develop a', 'new app', 'from scratch', 'buatkan', 'buat', 'bikin', 'bangun', 'ciptakan'],
49
+ weak: ['app', 'project', 'tool', 'system', 'game', 'simulator', 'aplikasi']
50
50
  },
51
51
  phases: [
52
52
  { name: 'Plan', tools: ['update_plan'], note: 'Create a visible atomic implementation plan before touching the filesystem.' },
@@ -58,8 +58,8 @@ const ARCHETYPES = {
58
58
  debug: {
59
59
  label: 'Diagnose and fix a defect in existing code',
60
60
  match: {
61
- strong: ['bug', 'error', 'crash', 'fix', 'broken', 'not working', 'failing', 'exception', 'stack trace', 'regression'],
62
- weak: ['issue', 'problem', 'wrong', 'debug']
61
+ strong: ['bug', 'error', 'crash', 'fix', 'broken', 'not working', 'failing', 'exception', 'stack trace', 'regression', 'perbaiki', 'betulkan', 'rusak'],
62
+ weak: ['issue', 'problem', 'wrong', 'debug', 'masalah']
63
63
  },
64
64
  phases: [
65
65
  { name: 'Reproduce', tools: ['sysRun', 'fs_read'], note: 'Reproduce the failure and capture the exact error before changing anything.' },
@@ -71,7 +71,7 @@ const ARCHETYPES = {
71
71
  research: {
72
72
  label: 'Investigate and report, without changing the system',
73
73
  match: {
74
- strong: ['explain', 'analyse', 'analyze', 'research', 'compare', 'what is', 'how does', 'review', 'audit'],
74
+ strong: ['explain', 'analyse', 'analyze', 'research', 'compare', 'what is', 'how does', 'review', 'audit', 'analisa', 'jelaskan', 'cek', 'periksa'],
75
75
  weak: ['understand', 'find out', 'summarize']
76
76
  },
77
77
  phases: [
package/src/taskShape.ts CHANGED
@@ -18,8 +18,8 @@ interface ArchetypeDefinition {
18
18
 
19
19
  const PACK_SIGNALS: Record<string, SignalSet> = {
20
20
  game: {
21
- strong: ['game', 'gamedev', 'godot', 'unity', 'unreal', 'rpg', 'platformer', 'roguelike', 'arcade', 'voxel', 'minecraft', 'tilemap', 'spritesheet', 'boss fight', 'level design'],
22
- weak: ['sprite', 'player', 'enemy', 'quest', 'npc', 'gameplay', 'multiplayer', 'leaderboard']
21
+ strong: ['game', 'gamedev', 'godot', 'unity', 'unreal', 'rpg', 'platformer', 'roguelike', 'arcade', 'voxel', 'minecraft', 'tilemap', 'spritesheet', 'boss fight', 'level design', 'simulator', 'simulation', 'simulasi', 'tinder-3d', '3d'],
22
+ weak: ['sprite', 'player', 'enemy', 'quest', 'npc', 'gameplay', 'multiplayer', 'leaderboard', 'character']
23
23
  },
24
24
  web: {
25
25
  strong: ['web app', 'webapp', 'website', 'landing page', 'homepage', 'frontend', 'front-end', 'dashboard', 'portfolio', 'react', 'vue', 'svelte', 'angular', 'nextjs', 'next.js', 'nuxt', 'astro', 'tailwind', 'html', 'css'],
@@ -66,8 +66,8 @@ const ARCHETYPES: Record<string, ArchetypeDefinition> = {
66
66
  build_app: {
67
67
  label: 'Build a new application from scratch',
68
68
  match: {
69
- strong: ['build me', 'create a', 'make me', 'develop a', 'new app', 'from scratch'],
70
- weak: ['app', 'project', 'tool', 'system']
69
+ strong: ['build me', 'create a', 'make me', 'develop a', 'new app', 'from scratch', 'buatkan', 'buat', 'bikin', 'bangun', 'ciptakan'],
70
+ weak: ['app', 'project', 'tool', 'system', 'game', 'simulator', 'aplikasi']
71
71
  },
72
72
  phases: [
73
73
  { name: 'Plan', tools: ['update_plan'], note: 'Create a visible atomic implementation plan before touching the filesystem.' },
@@ -79,8 +79,8 @@ const ARCHETYPES: Record<string, ArchetypeDefinition> = {
79
79
  debug: {
80
80
  label: 'Diagnose and fix a defect in existing code',
81
81
  match: {
82
- strong: ['bug', 'error', 'crash', 'fix', 'broken', 'not working', 'failing', 'exception', 'stack trace', 'regression'],
83
- weak: ['issue', 'problem', 'wrong', 'debug']
82
+ strong: ['bug', 'error', 'crash', 'fix', 'broken', 'not working', 'failing', 'exception', 'stack trace', 'regression', 'perbaiki', 'betulkan', 'rusak'],
83
+ weak: ['issue', 'problem', 'wrong', 'debug', 'masalah']
84
84
  },
85
85
  phases: [
86
86
  { name: 'Reproduce', tools: ['sysRun', 'fs_read'], note: 'Reproduce the failure and capture the exact error before changing anything.' },
@@ -92,7 +92,7 @@ const ARCHETYPES: Record<string, ArchetypeDefinition> = {
92
92
  research: {
93
93
  label: 'Investigate and report, without changing the system',
94
94
  match: {
95
- strong: ['explain', 'analyse', 'analyze', 'research', 'compare', 'what is', 'how does', 'review', 'audit'],
95
+ strong: ['explain', 'analyse', 'analyze', 'research', 'compare', 'what is', 'how does', 'review', 'audit', 'analisa', 'jelaskan', 'cek', 'periksa'],
96
96
  weak: ['understand', 'find out', 'summarize']
97
97
  },
98
98
  phases: [
@@ -2,11 +2,20 @@ import { createHash } from 'node:crypto';
2
2
  import { failureClass } from './planCache.js';
3
3
  import { isVerificationCommand } from './observer/evidence.js';
4
4
  export const TIME_MACHINE_MAX_ATTEMPTS = 6;
5
- export const TIME_MACHINE_REPLAN_AT = 3;
5
+ /**
6
+ * After this many failed attempts at the same issue the agent must stop and ask
7
+ * the user before trying again. Attempts beyond it are three more rounds of
8
+ * similar edits and checks, which cost real time and tokens, so they are the
9
+ * user's call and never the agent's.
10
+ */
11
+ export const TIME_MACHINE_CONSENT_AT = 3;
6
12
  export function recoveryUserMessage(decision, tool) {
7
13
  if (decision.kind === 'human') {
8
14
  return `${tool} needs approval or authentication. Review the last tool error, then provide the needed access or choose another route. No success is claimed.`;
9
15
  }
16
+ if (decision.attempt <= TIME_MACHINE_CONSENT_AT && decision.kind === 'stop') {
17
+ return `${tool} failed ${decision.attempt} times (${decision.failureClass}) and more attempts were not approved. The task stopped without verified success.`;
18
+ }
10
19
  return `${tool} still failed after ${decision.attempt} attempts (${decision.failureClass}). The task stopped without verified success.`;
11
20
  }
12
21
  function record(value) {
@@ -35,9 +44,12 @@ function operationFamily(args) {
35
44
  }
36
45
  return (words[0] || '').replace(/^.*[\\/]/, '').toLowerCase().slice(0, 32);
37
46
  }
38
- function issueKey(tool, args, classification) {
47
+ function issueKey(tool, args) {
39
48
  const family = operationFamily(args);
40
- return createHash('sha256').update(`${tool}\0${family}\0${classification}`).digest('hex');
49
+ const target = String(args.path ?? args.file_path ?? args.filePath ?? '');
50
+ // Changing error text/class does not buy another three attempts at the same
51
+ // operation. Targets are hashed and never included in recovery messages.
52
+ return createHash('sha256').update(`${tool}\0${family}\0${target}`).digest('hex');
41
53
  }
42
54
  function lastGoodTool(outcomes) {
43
55
  for (let index = outcomes.length - 1; index >= 0; index--) {
@@ -62,28 +74,39 @@ function nextDiagnostic(classification) {
62
74
  /** Per-task, deterministic recovery budget. Never replays actions or approvals. */
63
75
  export class TimeMachine {
64
76
  failures = new Map();
77
+ extended = new Set();
65
78
  reset() {
66
79
  this.failures.clear();
80
+ this.extended.clear();
81
+ }
82
+ /** The user approved attempts beyond the consent point for this issue, up to the hard maximum. */
83
+ grantExtension(issueKeyValue) {
84
+ const count = this.failures.get(issueKeyValue) ?? 0;
85
+ if (count >= TIME_MACHINE_CONSENT_AT && count < TIME_MACHINE_MAX_ATTEMPTS)
86
+ this.extended.add(issueKeyValue);
87
+ }
88
+ /** Whether the user already approved further attempts for this issue. */
89
+ isExtended(issueKeyValue) {
90
+ return this.extended.has(issueKeyValue);
67
91
  }
68
92
  observe(tool, args, result, outcomes = []) {
69
93
  const value = record(result);
70
94
  const failed = value.success === false || typeof value.error === 'string';
71
95
  const classification = failed ? failureClass(value) || 'failed' : '';
72
- const key = issueKey(tool, args, classification);
96
+ const key = issueKey(tool, args);
73
97
  const good = lastGoodTool(outcomes);
74
98
  if (!failed) {
75
99
  // A successful check only clears its own failure family. A successful
76
100
  // read/write cannot prove that a failing build or test was repaired.
77
- const possibleKeys = ['failed', 'exit_nonzero', 'syntax', 'invalid_args',
78
- 'not_found', 'timeout', 'network', 'rate_limited', 'permission'];
79
- const hadFailure = possibleKeys.some((item) => this.failures.has(issueKey(tool, args, item)));
101
+ const hadFailure = this.failures.has(key);
80
102
  if (hadFailure) {
81
- for (const item of possibleKeys)
82
- this.failures.delete(issueKey(tool, args, item));
103
+ this.failures.delete(key);
104
+ this.extended.delete(key);
83
105
  }
84
106
  return {
85
107
  kind: hadFailure ? 'resolved' : 'none', attempt: 0,
86
108
  maxAttempts: TIME_MACHINE_MAX_ATTEMPTS, failureClass: '',
109
+ issueKey: '',
87
110
  lastGoodTool: good,
88
111
  guidance: hadFailure
89
112
  ? isVerificationCommand(String(args.command || args.cmd || ''))
@@ -97,27 +120,39 @@ export class TimeMachine {
97
120
  const attempt = (this.failures.get(key) || 0) + 1;
98
121
  this.failures.set(key, attempt);
99
122
  const checkpoint = good ? ` Last successful tool: ${good}.` : '';
100
- if (value.failureKind === 'site_refusal' && attempt < TIME_MACHINE_MAX_ATTEMPTS) {
101
- return { kind: 'replan', attempt, maxAttempts: TIME_MACHINE_MAX_ATTEMPTS,
102
- failureClass: classification, lastGoodTool: good,
103
- guidance: `The site refused this fetch. Do not repeat the same URL or bypass the site's restriction. Search for another public source or use an already available browser capability.${checkpoint}` };
104
- }
105
123
  if (needsHuman) {
106
- return { kind: 'human', attempt, maxAttempts: TIME_MACHINE_MAX_ATTEMPTS,
124
+ return { kind: 'human', attempt, maxAttempts: TIME_MACHINE_MAX_ATTEMPTS, issueKey: key,
107
125
  failureClass: classification, lastGoodTool: good,
108
126
  guidance: `Permission or authentication is required. Stop retrying and explain the exact user action needed.${checkpoint}` };
109
127
  }
110
128
  if (attempt >= TIME_MACHINE_MAX_ATTEMPTS) {
111
- return { kind: 'stop', attempt, maxAttempts: TIME_MACHINE_MAX_ATTEMPTS,
129
+ return { kind: 'stop', attempt, maxAttempts: TIME_MACHINE_MAX_ATTEMPTS, issueKey: key,
112
130
  failureClass: classification, lastGoodTool: good,
113
131
  guidance: `The same failure class persisted through ${TIME_MACHINE_MAX_ATTEMPTS} attempts. Stop this task. Give a brief evidence-based report, state what remains unresolved, and ask for input only if needed. Put a detailed report in a Markdown file only if the user requests one.${checkpoint}` };
114
132
  }
115
- if (attempt >= TIME_MACHINE_REPLAN_AT) {
116
- return { kind: 'replan', attempt, maxAttempts: TIME_MACHINE_MAX_ATTEMPTS,
133
+ // The agent may spend three attempts alone. The fourth through sixth belong
134
+ // to the user: without an explicit grant the budget ends here.
135
+ if (attempt >= TIME_MACHINE_CONSENT_AT && !this.extended.has(key)) {
136
+ if (attempt === TIME_MACHINE_CONSENT_AT) {
137
+ return { kind: 'consent', attempt, maxAttempts: TIME_MACHINE_MAX_ATTEMPTS, issueKey: key,
138
+ failureClass: classification, lastGoodTool: good,
139
+ guidance: `Three attempts failed. Ask the user before trying again. If they allow it, change approach completely: review the last successful step and the failing evidence. ${nextDiagnostic(classification)}${checkpoint}` };
140
+ }
141
+ return { kind: 'stop', attempt, maxAttempts: TIME_MACHINE_MAX_ATTEMPTS, issueKey: key,
142
+ failureClass: classification, lastGoodTool: good,
143
+ guidance: `Further attempts were not approved. Stop this task. Give a brief evidence-based report and state what remains unresolved.${checkpoint}` };
144
+ }
145
+ if (value.failureKind === 'site_refusal' && attempt < TIME_MACHINE_MAX_ATTEMPTS) {
146
+ return { kind: 'replan', attempt, maxAttempts: TIME_MACHINE_MAX_ATTEMPTS, issueKey: key,
147
+ failureClass: classification, lastGoodTool: good,
148
+ guidance: `The site refused this fetch. Do not repeat the same URL or bypass the site's restriction. Search for another public source or use an already available browser capability.${checkpoint}` };
149
+ }
150
+ if (attempt >= TIME_MACHINE_CONSENT_AT) {
151
+ return { kind: 'replan', attempt, maxAttempts: TIME_MACHINE_MAX_ATTEMPTS, issueKey: key,
117
152
  failureClass: classification, lastGoodTool: good,
118
- guidance: `Review the last successful step and the failing evidence. ${nextDiagnostic(classification)} Change approach before another attempt; do not repeat the same command or claim a fix without a passing check.${checkpoint}` };
153
+ guidance: `Review the last successful step and the failing evidence. ${nextDiagnostic(classification)} Change approach before another attempt; do not repeat the same command or claim a fix without a passing check. ${TIME_MACHINE_MAX_ATTEMPTS - attempt} attempt(s) remain.${checkpoint}` };
119
154
  }
120
- return { kind: 'continue', attempt, maxAttempts: TIME_MACHINE_MAX_ATTEMPTS,
155
+ return { kind: 'continue', attempt, maxAttempts: TIME_MACHINE_MAX_ATTEMPTS, issueKey: key,
121
156
  failureClass: classification, lastGoodTool: good,
122
157
  guidance: `Inspect this failure before retrying. Attempt ${attempt}/${TIME_MACHINE_MAX_ATTEMPTS}.${checkpoint}` };
123
158
  }