@causyne/agent 1.20.62 → 1.20.65

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 (65) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/src/acp/client.js +48 -0
  4. package/src/acp/client.ts +44 -0
  5. package/src/agentLoop.js +181 -11
  6. package/src/agentLoop.ts +184 -11
  7. package/src/approvalPolicy.js +19 -0
  8. package/src/approvalPolicy.ts +18 -0
  9. package/src/browser/causyneBrowser.js +34 -4
  10. package/src/browser/causyneBrowser.ts +32 -4
  11. package/src/cliMode.js +12 -28
  12. package/src/commands.js +33 -0
  13. package/src/decisionPolicy.js +18 -1
  14. package/src/decisionPolicy.ts +18 -1
  15. package/src/implementationPlan.js +26 -0
  16. package/src/implementationPlan.ts +25 -0
  17. package/src/observer/coldObserver.js +6 -1
  18. package/src/observer/coldObserver.ts +6 -1
  19. package/src/observer.js +24 -2
  20. package/src/observer.ts +24 -2
  21. package/src/providers/acp.js +2 -8
  22. package/src/providers/acp.ts +2 -8
  23. package/src/providers/antigravity.js +7 -10
  24. package/src/providers/antigravity.ts +7 -10
  25. package/src/smartToolsUse.js +1 -1
  26. package/src/smartToolsUse.ts +1 -1
  27. package/src/toolPacks.js +1 -1
  28. package/src/toolPacks.ts +1 -1
  29. package/src/tools/toolSelfRepair.js +51 -8
  30. package/src/tools/toolSelfRepair.ts +42 -9
  31. package/src/tui/CausyneRotor.js +234 -0
  32. package/src/tui/CausyneRotor.ts +280 -0
  33. package/src/tui/activityLayout.js +1 -1
  34. package/src/tui/activityLayout.ts +1 -1
  35. package/src/tui/chatRenderer.js +56 -7
  36. package/src/tui/chatboxClipboard.js +96 -10
  37. package/src/tui/chatboxClipboard.ts +121 -11
  38. package/src/tui/clipboardImage.js +308 -0
  39. package/src/tui/clipboardImage.ts +320 -0
  40. package/src/tui/codeStreamRenderer.js +89 -1
  41. package/src/tui/codeStreamRenderer.ts +109 -1
  42. package/src/tui/composerControls.js +2 -0
  43. package/src/tui/composerControls.ts +2 -0
  44. package/src/tui/dialogs.js +41 -6
  45. package/src/tui/engineSpinner.js +20 -0
  46. package/src/tui/engineSpinner.ts +46 -0
  47. package/src/tui/lineEditor.js +44 -12
  48. package/src/tui/messageInteraction.js +16 -5
  49. package/src/tui/messageInteraction.ts +14 -5
  50. package/src/tui/observerPicker.js +4 -8
  51. package/src/tui/observerPicker.ts +4 -8
  52. package/src/tui/prompt.js +80 -43
  53. package/src/tui/runningLight.js +213 -0
  54. package/src/tui/runningLight.ts +271 -0
  55. package/src/tui/sessionSidebar.js +7 -1
  56. package/src/tui/sessionSidebar.ts +7 -1
  57. package/src/tui/stage.js +4 -4
  58. package/src/tui/stageSurface.js +21 -14
  59. package/src/tui/statusLine.js +27 -4
  60. package/src/tui/statusLine.ts +27 -4
  61. package/src/tui/theme.js +5 -2
  62. package/src/tui/thinkingBox.js +41 -10
  63. package/src/tui/thinkingBox.ts +43 -10
  64. package/src/tui/turnRail.js +155 -24
  65. package/src/tui/turnRail.ts +170 -22
@@ -76,7 +76,24 @@ function splitCommandSegments(command) {
76
76
  segments.push(current.trim());
77
77
  return segments;
78
78
  }
79
- const READ_ONLY_CMD_REGEX = /^\s*(?:(?:pwd|ls|find|rg|grep|cat|sed|awk|head|tail|wc|diff|file|stat|which|whereis|type|du|df|pdfinfo|pdftotext|identify|mediainfo|ffprobe|otool|readelf|nm|ps|lsof|top|uptime|whoami|id|uname|env|printenv|echo|printf|pytest)\b|git\s+(?:status|diff|log|show|branch|tag|remote|rev-parse|describe)\b|npm\s+(?:view|audit|test|ls|list|explain|run\s+(?:test|check|lint|typecheck|verify))\b|pnpm\s+(?:test|view|audit|ls|list|run\s+(?:test|check|lint|typecheck|verify))\b|yarn\s+(?:test|audit|list|run\s+(?:test|check|lint|typecheck|verify))\b|bun\s+(?:test|pm)\b|npx\s+(?:jest|vitest|mocha|ava|playwright\s+test|cypress\s+run|tsc\s+--noEmit)\b|tsc\s+--noEmit\b|node\s+(?:--check|--test|-e\b|--eval\b|-p\b|--print\b|.*?(?:test|spec|verify|check))|(?:python3?|py)\s+(?:-m\s+(?:unittest|pytest|doctest|py_compile)|-c\b|.*?(?:test|spec|verify))|cargo\s+(?:test|check)\b|go\s+test\b|curl\s+(?:-I|-sI|-s\b|--head)\b)/i;
79
+ const READ_ONLY_CMD_PATTERNS = [
80
+ String.raw `^\s*(?:pwd|ls|find|rg|grep|cat|sed|awk|head|tail|wc|diff|file|stat|which|whereis|type|du|df|pdfinfo|pdftotext|identify|mediainfo|ffprobe|otool|readelf|nm|ps|lsof|top|uptime|whoami|id|uname|env|printenv|echo|printf|pytest)\b`,
81
+ String.raw `(?:\.\/)?gradlew?\s+(?:test\S*|check\S*|lint\S*)\b`,
82
+ String.raw `mvn\s+(?:test\S*|verify\S*)\b`,
83
+ String.raw `git\s+(?:status|diff|log|show|branch|tag|remote|rev-parse|describe)\b`,
84
+ String.raw `npm\s+(?:view|audit|test|ls|list|explain|run\s+(?:test|check|lint|typecheck|verify))\b`,
85
+ String.raw `pnpm\s+(?:test|view|audit|ls|list|run\s+(?:test|check|lint|typecheck|verify))\b`,
86
+ String.raw `yarn\s+(?:test|audit|list|run\s+(?:test|check|lint|typecheck|verify))\b`,
87
+ String.raw `bun\s+(?:test|pm)\b`,
88
+ String.raw `npx\s+(?:jest|vitest|mocha|ava|playwright\s+test|cypress\s+run|tsc\s+--noEmit)\b`,
89
+ String.raw `tsc\s+--noEmit\b`,
90
+ String.raw `node\s+(?:--check|--test|-e\b|--eval\b|-p\b|--print\b|.*?(?:test|spec|verify|check))`,
91
+ String.raw `(?:python3?|py)\s+(?:-m\s+(?:unittest|pytest|doctest|py_compile)|-c\b|.*?(?:test|spec|verify))`,
92
+ String.raw `cargo\s+(?:test|check)\b`,
93
+ String.raw `go\s+test\b`,
94
+ String.raw `curl\s+(?:-I|-sI|-s\b|--head)\b`
95
+ ];
96
+ const READ_ONLY_CMD_REGEX = new RegExp(READ_ONLY_CMD_PATTERNS.join('|'), 'i');
80
97
  export function isReadOnlyShellCommand(command) {
81
98
  const trimmed = command.trim();
82
99
  if (!trimmed)
@@ -109,7 +109,24 @@ function splitCommandSegments(command: string): string[] {
109
109
  return segments;
110
110
  }
111
111
 
112
- const READ_ONLY_CMD_REGEX = /^\s*(?:(?:pwd|ls|find|rg|grep|cat|sed|awk|head|tail|wc|diff|file|stat|which|whereis|type|du|df|pdfinfo|pdftotext|identify|mediainfo|ffprobe|otool|readelf|nm|ps|lsof|top|uptime|whoami|id|uname|env|printenv|echo|printf|pytest)\b|git\s+(?:status|diff|log|show|branch|tag|remote|rev-parse|describe)\b|npm\s+(?:view|audit|test|ls|list|explain|run\s+(?:test|check|lint|typecheck|verify))\b|pnpm\s+(?:test|view|audit|ls|list|run\s+(?:test|check|lint|typecheck|verify))\b|yarn\s+(?:test|audit|list|run\s+(?:test|check|lint|typecheck|verify))\b|bun\s+(?:test|pm)\b|npx\s+(?:jest|vitest|mocha|ava|playwright\s+test|cypress\s+run|tsc\s+--noEmit)\b|tsc\s+--noEmit\b|node\s+(?:--check|--test|-e\b|--eval\b|-p\b|--print\b|.*?(?:test|spec|verify|check))|(?:python3?|py)\s+(?:-m\s+(?:unittest|pytest|doctest|py_compile)|-c\b|.*?(?:test|spec|verify))|cargo\s+(?:test|check)\b|go\s+test\b|curl\s+(?:-I|-sI|-s\b|--head)\b)/i;
112
+ const READ_ONLY_CMD_PATTERNS = [
113
+ String.raw`^\s*(?:pwd|ls|find|rg|grep|cat|sed|awk|head|tail|wc|diff|file|stat|which|whereis|type|du|df|pdfinfo|pdftotext|identify|mediainfo|ffprobe|otool|readelf|nm|ps|lsof|top|uptime|whoami|id|uname|env|printenv|echo|printf|pytest)\b`,
114
+ String.raw`(?:\.\/)?gradlew?\s+(?:test\S*|check\S*|lint\S*)\b`,
115
+ String.raw`mvn\s+(?:test\S*|verify\S*)\b`,
116
+ String.raw`git\s+(?:status|diff|log|show|branch|tag|remote|rev-parse|describe)\b`,
117
+ String.raw`npm\s+(?:view|audit|test|ls|list|explain|run\s+(?:test|check|lint|typecheck|verify))\b`,
118
+ String.raw`pnpm\s+(?:test|view|audit|ls|list|run\s+(?:test|check|lint|typecheck|verify))\b`,
119
+ String.raw`yarn\s+(?:test|audit|list|run\s+(?:test|check|lint|typecheck|verify))\b`,
120
+ String.raw`bun\s+(?:test|pm)\b`,
121
+ String.raw`npx\s+(?:jest|vitest|mocha|ava|playwright\s+test|cypress\s+run|tsc\s+--noEmit)\b`,
122
+ String.raw`tsc\s+--noEmit\b`,
123
+ String.raw`node\s+(?:--check|--test|-e\b|--eval\b|-p\b|--print\b|.*?(?:test|spec|verify|check))`,
124
+ String.raw`(?:python3?|py)\s+(?:-m\s+(?:unittest|pytest|doctest|py_compile)|-c\b|.*?(?:test|spec|verify))`,
125
+ String.raw`cargo\s+(?:test|check)\b`,
126
+ String.raw`go\s+test\b`,
127
+ String.raw`curl\s+(?:-I|-sI|-s\b|--head)\b`
128
+ ];
129
+ const READ_ONLY_CMD_REGEX = new RegExp(READ_ONLY_CMD_PATTERNS.join('|'), 'i');
113
130
 
114
131
  export function isReadOnlyShellCommand(command: string): boolean {
115
132
  const trimmed = command.trim();
@@ -119,6 +119,32 @@ export function normalizePeerPlanEntries(value) {
119
119
  }
120
120
  return { explanation, plan: steps };
121
121
  }
122
+ const TOOL_CALL_ENVELOPE_KEYS = new Set(['name', 'tool', 'function', 'type', 'id', 'call_id', 'tool_call_id']);
123
+ /**
124
+ * Resolve the argument payload of a text-delimited tool call envelope.
125
+ *
126
+ * Accepts `arguments`, `parameters`, `input`, `args`, nested `function.arguments`,
127
+ * and the flat form some peers emit, where arguments sit beside `name`
128
+ * (`{"name":"update_plan","plan":[...]}`). Falling back to `{}` for the flat form
129
+ * discarded every argument and produced false "is required" validation errors.
130
+ */
131
+ export function resolveToolCallEnvelopeArguments(parsed) {
132
+ const fnObj = parsed.function && typeof parsed.function === 'object' && !Array.isArray(parsed.function)
133
+ ? parsed.function
134
+ : null;
135
+ for (const key of ['arguments', 'parameters', 'input', 'args']) {
136
+ if (parsed[key] !== undefined && parsed[key] !== null)
137
+ return parsed[key];
138
+ }
139
+ if (fnObj && fnObj.arguments !== undefined && fnObj.arguments !== null)
140
+ return fnObj.arguments;
141
+ const flat = {};
142
+ for (const [key, value] of Object.entries(parsed)) {
143
+ if (!TOOL_CALL_ENVELOPE_KEYS.has(key))
144
+ flat[key] = value;
145
+ }
146
+ return flat;
147
+ }
122
148
  export function extractToolCallJsonObjects(text, allowUnclosedHealing = true) {
123
149
  const results = [];
124
150
  if (!text || typeof text !== 'string')
@@ -127,6 +127,31 @@ export function normalizePeerPlanEntries(value: unknown): PlanUpdate | null {
127
127
  return { explanation, plan: steps };
128
128
  }
129
129
 
130
+ const TOOL_CALL_ENVELOPE_KEYS = new Set(['name', 'tool', 'function', 'type', 'id', 'call_id', 'tool_call_id']);
131
+
132
+ /**
133
+ * Resolve the argument payload of a text-delimited tool call envelope.
134
+ *
135
+ * Accepts `arguments`, `parameters`, `input`, `args`, nested `function.arguments`,
136
+ * and the flat form some peers emit, where arguments sit beside `name`
137
+ * (`{"name":"update_plan","plan":[...]}`). Falling back to `{}` for the flat form
138
+ * discarded every argument and produced false "is required" validation errors.
139
+ */
140
+ export function resolveToolCallEnvelopeArguments(parsed: Record<string, unknown>): unknown {
141
+ const fnObj = parsed.function && typeof parsed.function === 'object' && !Array.isArray(parsed.function)
142
+ ? (parsed.function as Record<string, unknown>)
143
+ : null;
144
+ for (const key of ['arguments', 'parameters', 'input', 'args'] as const) {
145
+ if (parsed[key] !== undefined && parsed[key] !== null) return parsed[key];
146
+ }
147
+ if (fnObj && fnObj.arguments !== undefined && fnObj.arguments !== null) return fnObj.arguments;
148
+ const flat: Record<string, unknown> = {};
149
+ for (const [key, value] of Object.entries(parsed)) {
150
+ if (!TOOL_CALL_ENVELOPE_KEYS.has(key)) flat[key] = value;
151
+ }
152
+ return flat;
153
+ }
154
+
130
155
  export function extractToolCallJsonObjects(text: string, allowUnclosedHealing = true): Array<Record<string, unknown>> {
131
156
  const results: Array<Record<string, unknown>> = [];
132
157
  if (!text || typeof text !== 'string') return results;
@@ -1,4 +1,5 @@
1
1
  import fs from 'node:fs';
2
+ import os from 'node:os';
2
3
  import path from 'node:path';
3
4
  import { auditLog } from '../auditLog.js';
4
5
  import { isLaunchOnlyPrompt } from '../launchIntent.js';
@@ -22,7 +23,8 @@ const DEFAULT_CONFIG = {
22
23
  const COMPLETION_CLAIMS = [
23
24
  /\b(?:done|finished|complete(?:d)?|implemented|resolved|fixed|ready)\b/i,
24
25
  /\b(?:all|everything)\b[^.\n]{0,60}\b(?:works?|pass(?:es|ed|ing)?|fixed|done|clean)\b/i,
25
- /\b(?:no|zero)\s+(?:errors?|issues?|failures?|bugs?)\b/i
26
+ /\b(?:no|zero)\s+(?:errors?|issues?|failures?|bugs?)\b/i,
27
+ /\b(?:is\s+(?:running|live|available|listening|served)\s+(?:at|on)|application\s+is\s+running)\b/i
26
28
  ];
27
29
  const HONEST_CAVEATS = [
28
30
  /\b(?:not|never)\s+(?:run|ran|tested|verified|checked|completed?)\b/i,
@@ -62,6 +64,9 @@ function boundedTimeout(value) {
62
64
  return Math.max(200, Math.min(5000, Math.round(value)));
63
65
  }
64
66
  function safeConfigPath() {
67
+ if (process.env.NODE_TEST_CONTEXT) {
68
+ return path.join(os.tmpdir(), `causyne-test-observer-${process.pid}.json`);
69
+ }
65
70
  return CONFIG_FILE;
66
71
  }
67
72
  function readStoredConfig() {
@@ -1,4 +1,5 @@
1
1
  import fs from 'node:fs';
2
+ import os from 'node:os';
2
3
  import path from 'node:path';
3
4
  import { auditLog } from '../auditLog.js';
4
5
  import { isLaunchOnlyPrompt } from '../launchIntent.js';
@@ -81,7 +82,8 @@ const DEFAULT_CONFIG: ObserverConfig = {
81
82
  const COMPLETION_CLAIMS = [
82
83
  /\b(?:done|finished|complete(?:d)?|implemented|resolved|fixed|ready)\b/i,
83
84
  /\b(?:all|everything)\b[^.\n]{0,60}\b(?:works?|pass(?:es|ed|ing)?|fixed|done|clean)\b/i,
84
- /\b(?:no|zero)\s+(?:errors?|issues?|failures?|bugs?)\b/i
85
+ /\b(?:no|zero)\s+(?:errors?|issues?|failures?|bugs?)\b/i,
86
+ /\b(?:is\s+(?:running|live|available|listening|served)\s+(?:at|on)|application\s+is\s+running)\b/i
85
87
  ];
86
88
 
87
89
  const HONEST_CAVEATS = [
@@ -122,6 +124,9 @@ function boundedTimeout(value: unknown): number | null {
122
124
  }
123
125
 
124
126
  function safeConfigPath(): string {
127
+ if (process.env.NODE_TEST_CONTEXT) {
128
+ return path.join(os.tmpdir(), `causyne-test-observer-${process.pid}.json`);
129
+ }
125
130
  return CONFIG_FILE;
126
131
  }
127
132
 
package/src/observer.js CHANGED
@@ -3,6 +3,22 @@ import path from 'node:path';
3
3
  import http from 'node:http';
4
4
  import { createHash } from 'node:crypto';
5
5
  import { coldObserver } from './observer/coldObserver.js';
6
+ export function extractClaimedLocalUrls(text) {
7
+ if (!text)
8
+ return [];
9
+ const matches = text.match(/https?:\/\/(?:localhost|127\.0\.0\.1|\[::1\]):\d+(?:\/[^\s)>'"`\]]*)?/gi) || [];
10
+ const unique = new Set();
11
+ for (const raw of matches) {
12
+ let end = raw.length;
13
+ while (end > 0 && '.,;:!?'.includes(raw[end - 1])) {
14
+ end--;
15
+ }
16
+ const cleaned = raw.slice(0, end);
17
+ if (cleaned)
18
+ unique.add(cleaned);
19
+ }
20
+ return [...unique];
21
+ }
6
22
  export class CausyneObserver {
7
23
  /**
8
24
  * Evaluates the current state of a task after a tool outcome or at a step boundary.
@@ -64,11 +80,14 @@ export class CausyneObserver {
64
80
  // Check if the agent claims completion
65
81
  if (context.agentClaim && context.agentClaim.trim()) {
66
82
  const claim = context.agentClaim.toLowerCase();
67
- const claimsCompletion = /\b(?:done|complete|completed|finished|implemented|fixed|verified)\b/i.test(claim);
83
+ const claimsCompletion = /\b(?:done|complete|completed|finished|implemented|fixed|verified)\b|\b(?:is\s+(?:running|live|available|listening|served)\s+(?:at|on)|application\s+is\s+running)\b/i.test(claim);
68
84
  if (claimsCompletion) {
69
85
  // Run deterministic verification checks based on domain
70
86
  const hasMutations = outcomes.some(o => ['fs_write', 'fs_edit', 'MultiEdit', 'write_file', 'edit_file'].includes(o.tool));
71
- const hasPassingVerification = outcomes.some(o => o.success && o.command && /\b(?:test|build|check|typecheck|vitest|jest|pytest)\b/i.test(o.command));
87
+ const hasPassingVerification = outcomes.some(o => o.success && (o.rendered === true ||
88
+ o.tool === 'browser_act' ||
89
+ o.tool === 'verify_local_web' ||
90
+ (o.command && /\b(?:test|build|check|typecheck|vitest|jest|pytest)\b/i.test(o.command))));
72
91
  if (hasMutations && !hasPassingVerification) {
73
92
  return {
74
93
  status: 'ready-to-verify',
@@ -166,11 +185,14 @@ export class CausyneObserver {
166
185
  return;
167
186
  }
168
187
  const clientReq = http.get(req.endpoint, { timeout: req.timeoutMs ?? 3000 }, (res) => {
188
+ res.resume();
169
189
  const expected = req.expectedStatus ?? 200;
170
190
  const ok = res.statusCode === expected || (res.statusCode !== undefined && res.statusCode >= 200 && res.statusCode < 400);
171
191
  const result = { verified: Boolean(ok) };
172
192
  if (typeof res.statusCode === 'number')
173
193
  result.statusCode = res.statusCode;
194
+ if (!ok)
195
+ result.error = `HTTP ${res.statusCode ?? 'unknown'}`;
174
196
  resolve(result);
175
197
  });
176
198
  clientReq.on('error', (err) => {
package/src/observer.ts CHANGED
@@ -61,6 +61,21 @@ export interface TaskObservationContext {
61
61
  toolHistory: readonly ToolOutcome[];
62
62
  }
63
63
 
64
+ export function extractClaimedLocalUrls(text: string): string[] {
65
+ if (!text) return [];
66
+ const matches = text.match(/https?:\/\/(?:localhost|127\.0\.0\.1|\[::1\]):\d+(?:\/[^\s)>'"`\]]*)?/gi) || [];
67
+ const unique = new Set<string>();
68
+ for (const raw of matches) {
69
+ let end = raw.length;
70
+ while (end > 0 && '.,;:!?'.includes(raw[end - 1]!)) {
71
+ end--;
72
+ }
73
+ const cleaned = raw.slice(0, end);
74
+ if (cleaned) unique.add(cleaned);
75
+ }
76
+ return [...unique];
77
+ }
78
+
64
79
  export class CausyneObserver {
65
80
  /**
66
81
  * Evaluates the current state of a task after a tool outcome or at a step boundary.
@@ -127,7 +142,7 @@ export class CausyneObserver {
127
142
  // Check if the agent claims completion
128
143
  if (context.agentClaim && context.agentClaim.trim()) {
129
144
  const claim = context.agentClaim.toLowerCase();
130
- const claimsCompletion = /\b(?:done|complete|completed|finished|implemented|fixed|verified)\b/i.test(claim);
145
+ const claimsCompletion = /\b(?:done|complete|completed|finished|implemented|fixed|verified)\b|\b(?:is\s+(?:running|live|available|listening|served)\s+(?:at|on)|application\s+is\s+running)\b/i.test(claim);
131
146
 
132
147
  if (claimsCompletion) {
133
148
  // Run deterministic verification checks based on domain
@@ -135,7 +150,12 @@ export class CausyneObserver {
135
150
  ['fs_write', 'fs_edit', 'MultiEdit', 'write_file', 'edit_file'].includes(o.tool)
136
151
  );
137
152
  const hasPassingVerification = outcomes.some(o =>
138
- o.success && o.command && /\b(?:test|build|check|typecheck|vitest|jest|pytest)\b/i.test(o.command)
153
+ o.success && (
154
+ o.rendered === true ||
155
+ o.tool === 'browser_act' ||
156
+ o.tool === 'verify_local_web' ||
157
+ (o.command && /\b(?:test|build|check|typecheck|vitest|jest|pytest)\b/i.test(o.command))
158
+ )
139
159
  );
140
160
 
141
161
  if (hasMutations && !hasPassingVerification) {
@@ -248,10 +268,12 @@ export class CausyneObserver {
248
268
  }
249
269
 
250
270
  const clientReq = http.get(req.endpoint, { timeout: req.timeoutMs ?? 3000 }, (res) => {
271
+ res.resume();
251
272
  const expected = req.expectedStatus ?? 200;
252
273
  const ok = res.statusCode === expected || (res.statusCode !== undefined && res.statusCode >= 200 && res.statusCode < 400);
253
274
  const result: { verified: boolean; statusCode?: number; error?: string } = { verified: Boolean(ok) };
254
275
  if (typeof res.statusCode === 'number') result.statusCode = res.statusCode;
276
+ if (!ok) result.error = `HTTP ${res.statusCode ?? 'unknown'}`;
255
277
  resolve(result);
256
278
  });
257
279
 
@@ -9,7 +9,7 @@ import { BUILTIN_PEER_PRESETS } from '../acp/agentCatalog.js';
9
9
  import { createHash } from 'node:crypto';
10
10
  import path from 'node:path';
11
11
  import { PEER_COLLABORATION_POLICY } from './collaborationPolicy.js';
12
- import { extractToolCallJsonObjects, stripToolCallMarkup } from '../implementationPlan.js';
12
+ import { extractToolCallJsonObjects, stripToolCallMarkup, resolveToolCallEnvelopeArguments } from '../implementationPlan.js';
13
13
  function fingerprint(value) {
14
14
  return createHash('sha256').update(JSON.stringify(value)).digest('hex');
15
15
  }
@@ -250,13 +250,7 @@ export class AcpProvider extends LLMProvider {
250
250
  const name = String(parsed.name || parsed.tool || fnObj?.name || '').trim();
251
251
  if (!name)
252
252
  continue;
253
- const rawArgs = parsed.arguments !== undefined
254
- ? parsed.arguments
255
- : parsed.parameters !== undefined
256
- ? parsed.parameters
257
- : parsed.input !== undefined
258
- ? parsed.input
259
- : (fnObj?.arguments ?? {});
253
+ const rawArgs = resolveToolCallEnvelopeArguments(parsed);
260
254
  calls.push({
261
255
  id: `acp_call_${Date.now()}_${index++}`,
262
256
  type: 'function',
@@ -10,7 +10,7 @@ import type { RequestPermissionRequest, SessionUpdate, ToolKind } from '../acp/p
10
10
  import { createHash } from 'node:crypto';
11
11
  import path from 'node:path';
12
12
  import { PEER_COLLABORATION_POLICY } from './collaborationPolicy.js';
13
- import { extractToolCallJsonObjects, stripToolCallMarkup } from '../implementationPlan.js';
13
+ import { extractToolCallJsonObjects, stripToolCallMarkup, resolveToolCallEnvelopeArguments } from '../implementationPlan.js';
14
14
 
15
15
  interface AcpTransportSnapshot {
16
16
  conversationId: string;
@@ -271,13 +271,7 @@ export class AcpProvider extends LLMProvider {
271
271
  : null;
272
272
  const name = String(parsed.name || parsed.tool || fnObj?.name || '').trim();
273
273
  if (!name) continue;
274
- const rawArgs = parsed.arguments !== undefined
275
- ? parsed.arguments
276
- : parsed.parameters !== undefined
277
- ? parsed.parameters
278
- : parsed.input !== undefined
279
- ? parsed.input
280
- : (fnObj?.arguments ?? {});
274
+ const rawArgs = resolveToolCallEnvelopeArguments(parsed);
281
275
  calls.push({
282
276
  id: `acp_call_${Date.now()}_${index++}`,
283
277
  type: 'function',
@@ -17,7 +17,7 @@ import fs from 'node:fs';
17
17
  import path from 'node:path';
18
18
  import { isLaunchOnlyPrompt } from '../launchIntent.js';
19
19
  import { LLMProvider } from './base.js';
20
- import { extractToolCallJsonObjects, stripToolCallMarkup, stripThinkBlocks } from '../implementationPlan.js';
20
+ import { extractToolCallJsonObjects, stripToolCallMarkup, stripThinkBlocks, resolveToolCallEnvelopeArguments } from '../implementationPlan.js';
21
21
  /**
22
22
  * Baseline fallback models for instant offline availability.
23
23
  * Live models are autodetected dynamically from `agy models`
@@ -848,13 +848,7 @@ export class AntigravityProvider extends LLMProvider {
848
848
  const name = String(parsed.name || parsed.tool || fnObj?.name || '').trim();
849
849
  if (!name)
850
850
  continue;
851
- const rawArgs = parsed.arguments !== undefined
852
- ? parsed.arguments
853
- : parsed.parameters !== undefined
854
- ? parsed.parameters
855
- : parsed.input !== undefined
856
- ? parsed.input
857
- : (fnObj?.arguments ?? {});
851
+ const rawArgs = resolveToolCallEnvelopeArguments(parsed);
858
852
  calls.push({
859
853
  id: `agy_call_${Date.now()}_${index++}`,
860
854
  type: 'function',
@@ -944,7 +938,8 @@ export class AntigravityProvider extends LLMProvider {
944
938
  'Causyne provides native host tools for browser verification: `browser_act` (preview and snapshot) and `screenshot`/`vision_inspect_ui`. ' +
945
939
  'DO NOT write custom Node.js/Python headless Chrome or CDP WebSocket scripts to inspect console logs or take screenshots. ' +
946
940
  'Causyne automatically captures browser console errors and renders WebGL/Canvas with hardware acceleration. ' +
947
- 'Use <tool_call>{"name": "browser_act", "arguments": {"action": "preview", "filePath": "index.html"}}</tool_call> to verify rendered output directly.\n\n' + promptText;
941
+ 'Use <tool_call>{"name": "browser_act", "arguments": {"actions": [{"type": "preview", "filePath": "index.html"}, {"type": "snapshot"}]}}</tool_call> to verify rendered output directly. ' +
942
+ 'If you start a persistent local HTTP server, use `sysRunBg` or redirect stdio (`nohup ... </dev/null >/dev/null 2>&1 &`) so the server does not break with EIO when the turn pseudo-terminal closes.\n\n' + promptText;
948
943
  }
949
944
  const modelSlug = resolveAgyModelId(this.model);
950
945
  const effort = resolveAgyEffort(this.model);
@@ -1306,7 +1301,9 @@ export class AntigravityProvider extends LLMProvider {
1306
1301
  ...(detail ? { detail } : {})
1307
1302
  };
1308
1303
  if (status !== 'running') {
1309
- const existing = nativeActions.find(a => a.name === action.name && a.detail === action.detail);
1304
+ const existing = nativeActions.find(a => action.id
1305
+ ? a.id === action.id
1306
+ : a.name === action.name && a.detail === action.detail);
1310
1307
  if (existing)
1311
1308
  existing.status = status;
1312
1309
  else
@@ -16,7 +16,7 @@ import fs from 'node:fs';
16
16
  import path from 'node:path';
17
17
  import { isLaunchOnlyPrompt } from '../launchIntent.js';
18
18
  import { LLMProvider, type ProviderConfig, type ChatOptions, type ChatResponse, type ChatResponseAction, type ChatResponseToolCall, type ChatResponseUsage } from './base.js';
19
- import { extractToolCallJsonObjects, stripToolCallMarkup, stripThinkBlocks } from '../implementationPlan.js';
19
+ import { extractToolCallJsonObjects, stripToolCallMarkup, stripThinkBlocks, resolveToolCallEnvelopeArguments } from '../implementationPlan.js';
20
20
 
21
21
  /**
22
22
  * Baseline fallback models for instant offline availability.
@@ -875,13 +875,7 @@ export class AntigravityProvider extends LLMProvider {
875
875
  : null;
876
876
  const name = String(parsed.name || parsed.tool || fnObj?.name || '').trim();
877
877
  if (!name) continue;
878
- const rawArgs = parsed.arguments !== undefined
879
- ? parsed.arguments
880
- : parsed.parameters !== undefined
881
- ? parsed.parameters
882
- : parsed.input !== undefined
883
- ? parsed.input
884
- : (fnObj?.arguments ?? {});
878
+ const rawArgs = resolveToolCallEnvelopeArguments(parsed);
885
879
  calls.push({
886
880
  id: `agy_call_${Date.now()}_${index++}`,
887
881
  type: 'function',
@@ -975,7 +969,8 @@ export class AntigravityProvider extends LLMProvider {
975
969
  'Causyne provides native host tools for browser verification: `browser_act` (preview and snapshot) and `screenshot`/`vision_inspect_ui`. ' +
976
970
  'DO NOT write custom Node.js/Python headless Chrome or CDP WebSocket scripts to inspect console logs or take screenshots. ' +
977
971
  'Causyne automatically captures browser console errors and renders WebGL/Canvas with hardware acceleration. ' +
978
- 'Use <tool_call>{"name": "browser_act", "arguments": {"action": "preview", "filePath": "index.html"}}</tool_call> to verify rendered output directly.\n\n' + promptText;
972
+ 'Use <tool_call>{"name": "browser_act", "arguments": {"actions": [{"type": "preview", "filePath": "index.html"}, {"type": "snapshot"}]}}</tool_call> to verify rendered output directly. ' +
973
+ 'If you start a persistent local HTTP server, use `sysRunBg` or redirect stdio (`nohup ... </dev/null >/dev/null 2>&1 &`) so the server does not break with EIO when the turn pseudo-terminal closes.\n\n' + promptText;
979
974
  }
980
975
 
981
976
  const modelSlug = resolveAgyModelId(this.model);
@@ -1363,7 +1358,9 @@ export class AntigravityProvider extends LLMProvider {
1363
1358
  ...(detail ? { detail } : {})
1364
1359
  };
1365
1360
  if (status !== 'running') {
1366
- const existing = nativeActions.find(a => a.name === action.name && a.detail === action.detail);
1361
+ const existing = nativeActions.find(a => action.id
1362
+ ? a.id === action.id
1363
+ : a.name === action.name && a.detail === action.detail);
1367
1364
  if (existing) existing.status = status;
1368
1365
  else nativeActions.push(action);
1369
1366
  }
@@ -131,7 +131,7 @@ const SIMPLE_FILE_OP_PATTERN = /\b(list (the )?files|show files|count files|rena
131
131
  // Media generation intent (explicit creation of 3D, video, audio, or synthesized speech)
132
132
  const EXPLICIT_MEDIA_GENERATION_PATTERN = /\b(blender|3d model|render 3d|render frame|render animation|da vinci|resolve|photoshop|premiere|after\s*effects|illustrator|indesign|media\s*encoder|uxp|audio synth|synthesizer|text to speech|tts|voiceover|dubbing)\b|\.(blend\d*|psd|prproj|aep|ai|indd|ccx)\b/i;
133
133
  // Explicit web engineering intent
134
- 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;
134
+ 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|webgl|canvas|cad view|cad viewer|cad style view|3d view|3d viewer|3d configurator|3d visualizer)\b|(?:threejs|three\.js|thre\.?js|3js|babylon\.?js|pixi\.js|d3\.js|p5\.js|chart\.js)\b)/i;
135
135
  // Explicit game development intent
136
136
  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;
137
137
  // Explicit reverse engineering and binary analysis intent
@@ -175,7 +175,7 @@ const EXPLICIT_MEDIA_GENERATION_PATTERN =
175
175
 
176
176
  // Explicit web engineering intent
177
177
  const EXPLICIT_WEB_ENGINEERING_PATTERN =
178
- /\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;
178
+ /\b(build|create|make|design|develop|implement|redesign|buat\w*)\b[\s\S]*(?:\b(web|website|webpage|webapp|landing page|dashboard|ui|frontend|webgl|canvas|cad view|cad viewer|cad style view|3d view|3d viewer|3d configurator|3d visualizer)\b|(?:threejs|three\.js|thre\.?js|3js|babylon\.?js|pixi\.js|d3\.js|p5\.js|chart\.js)\b)/i;
179
179
 
180
180
  // Explicit game development intent
181
181
  const EXPLICIT_GAME_DEV_PATTERN =
package/src/toolPacks.js CHANGED
@@ -331,7 +331,7 @@ When the user asks you to build, create, test, expand, or develop a game, follow
331
331
  // raw prompt only.
332
332
  // ---------------------------------------------------------------------------
333
333
  const GAME_INTENT = /\b(game|games|gamedev|godot|unity|unreal|ue5|rpg|platformer|roguelike|arcade|sprite|spritesheet|tilemap|voxel|minecraft|aetheria|voxellia|nes|snes|gameplay|player character|level design|boss fight|simulator|simulation|simulasi)\b|\.(tscn|gd|uproject|umap)\b|[-_]3d\b|\b3d[-_]/i;
334
- const WEB_INTENT = /\b(web|webpage|website|frontend|front-end|landing page|homepage|dashboard|portfolio|html|css|scss|tailwind|bootstrap|react|vue|svelte|angular|next\.?js|nuxt|astro|ui|ux|user interface|web app|webapp|spa|dom|responsive|ui forge|component forge|component generation|ui component|three?\.?js|three?js|webgl|canvas|babylon)\b/i;
334
+ const WEB_INTENT = /\b(web|webpage|website|frontend|front-end|landing page|homepage|dashboard|portfolio|html|html5|css|scss|tailwind|bootstrap|react|vue|svelte|angular|next\.?js|nuxt|astro|ui|ux|user interface|web app|webapp|spa|dom|responsive|ui forge|component forge|component generation|ui component|webgl|canvas|babylon|cad view|cad viewer|cad style view|3d view|3d viewer|3d configurator|3d visualizer)\b|(?:three\.js|threejs|thre\.js|3js|webgl|babylon\.js|babylonjs|pixi\.js|d3\.js|p5\.js|chart\.js)\b/i;
335
335
  const MEDIA_INTENT = /\b(image|images|picture|photo|photoshop|premiere|after\s*effects|illustrator|indesign|media\s*encoder|uxp|render|3d model|blender|animation|animate|video|movie|film|audio|sound|sfx|music|song|voice|tts|text.to.speech|narration|podcast|thumbnail|poster|illustration|logo)\b|\.(psd|prproj|aep|ai|indd|ccx)\b/i;
336
336
  const SYSTEM_INTENT = /\b(process|processes|pid|kill|port|zip|unzip|tar|archive|compress|extract|clipboard|copy to clipboard|print|printer|open in browser|launch app|computer use|vision grounding|desktop vision|gui agent|coordinate click|desktop control)\b/i;
337
337
  const ADVANCED_INTENT = /\b(pdf|document|proposal|screenplay|shotlist|shot list|voiceover|dubbing|forge a tool|custom tool|new tool|plugin|plugins|custom plugin|plugins? factory|python bridge|mcp|mcp server|subagent|sub-agent|parallel agent|swarm|ast|symbols|refactor across)\b/i;
package/src/toolPacks.ts CHANGED
@@ -372,7 +372,7 @@ When the user asks you to build, create, test, expand, or develop a game, follow
372
372
 
373
373
  const GAME_INTENT = /\b(game|games|gamedev|godot|unity|unreal|ue5|rpg|platformer|roguelike|arcade|sprite|spritesheet|tilemap|voxel|minecraft|aetheria|voxellia|nes|snes|gameplay|player character|level design|boss fight|simulator|simulation|simulasi)\b|\.(tscn|gd|uproject|umap)\b|[-_]3d\b|\b3d[-_]/i;
374
374
 
375
- const WEB_INTENT = /\b(web|webpage|website|frontend|front-end|landing page|homepage|dashboard|portfolio|html|css|scss|tailwind|bootstrap|react|vue|svelte|angular|next\.?js|nuxt|astro|ui|ux|user interface|web app|webapp|spa|dom|responsive|ui forge|component forge|component generation|ui component|three?\.?js|three?js|webgl|canvas|babylon)\b/i;
375
+ const WEB_INTENT = /\b(web|webpage|website|frontend|front-end|landing page|homepage|dashboard|portfolio|html|html5|css|scss|tailwind|bootstrap|react|vue|svelte|angular|next\.?js|nuxt|astro|ui|ux|user interface|web app|webapp|spa|dom|responsive|ui forge|component forge|component generation|ui component|webgl|canvas|babylon|cad view|cad viewer|cad style view|3d view|3d viewer|3d configurator|3d visualizer)\b|(?:three\.js|threejs|thre\.js|3js|webgl|babylon\.js|babylonjs|pixi\.js|d3\.js|p5\.js|chart\.js)\b/i;
376
376
 
377
377
  const MEDIA_INTENT = /\b(image|images|picture|photo|photoshop|premiere|after\s*effects|illustrator|indesign|media\s*encoder|uxp|render|3d model|blender|animation|animate|video|movie|film|audio|sound|sfx|music|song|voice|tts|text.to.speech|narration|podcast|thumbnail|poster|illustration|logo)\b|\.(psd|prproj|aep|ai|indd|ccx)\b/i;
378
378
 
@@ -634,19 +634,62 @@ export function resolveParameterAliases(toolName, args, schema) {
634
634
  }
635
635
  }
636
636
  else if (canonicalName === 'update_plan') {
637
- if (!modified.plan && (modified.steps || modified.items || modified.tasks)) {
638
- modified.plan = modified.steps || modified.items || modified.tasks;
639
- delete modified.steps;
640
- delete modified.items;
641
- delete modified.tasks;
642
- repairs.push("Mapped 'steps' to 'plan' parameter for 'update_plan'");
637
+ // Peer checklist tools (TodoWrite / todowrite) are aliased to update_plan by
638
+ // name, so their argument shapes must be mapped here as well.
639
+ const planAliases = ['steps', 'items', 'tasks', 'todos', 'entries', 'checklist'];
640
+ if (modified.plan === undefined || modified.plan === null || modified.plan === '') {
641
+ const source = planAliases.find((key) => modified[key] !== undefined && modified[key] !== null);
642
+ if (source) {
643
+ modified.plan = modified[source];
644
+ repairs.push(`Mapped '${source}' to 'plan' parameter for 'update_plan'`);
645
+ }
646
+ }
647
+ for (const key of planAliases)
648
+ delete modified[key];
649
+ if (typeof modified.plan === 'string') {
650
+ const text = modified.plan.trim();
651
+ let parsed;
652
+ if (text.startsWith('[') || text.startsWith('{')) {
653
+ try {
654
+ parsed = JSON.parse(text);
655
+ }
656
+ catch {
657
+ parsed = undefined;
658
+ }
659
+ }
660
+ if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
661
+ const inner = parsed;
662
+ parsed = inner.plan ?? inner.todos ?? inner.steps ?? inner.items ?? parsed;
663
+ }
664
+ if (Array.isArray(parsed)) {
665
+ modified.plan = parsed;
666
+ repairs.push("Parsed JSON-encoded 'plan' for 'update_plan'");
667
+ }
668
+ else if (text) {
669
+ const lines = text.split(/\r?\n/)
670
+ .map((line) => line.replace(/^\s*(?:[-*+]|\d+[.)])?\s*(?:\[[ xX]\])?\s*/, '').trim())
671
+ .filter(Boolean);
672
+ if (lines.length > 0) {
673
+ modified.plan = lines;
674
+ repairs.push("Split plain-text 'plan' into steps for 'update_plan'");
675
+ }
676
+ }
643
677
  }
644
678
  if (Array.isArray(modified.plan)) {
645
679
  let activeCount = 0;
646
- modified.plan = modified.plan.map((raw, idx) => {
647
- if (!raw || typeof raw !== 'object')
680
+ modified.plan = modified.plan.map((entry, idx) => {
681
+ const raw = typeof entry === 'string' && entry.trim()
682
+ ? { step: entry.trim(), status: 'pending' }
683
+ : entry;
684
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw))
648
685
  return raw;
649
686
  const item = { ...raw };
687
+ if (item.activeForm !== undefined)
688
+ delete item.activeForm;
689
+ if (item.priority !== undefined)
690
+ delete item.priority;
691
+ if (item.id !== undefined && typeof item.id !== 'string')
692
+ item.id = String(item.id);
650
693
  if (!item.id)
651
694
  item.id = `step-${idx + 1}`;
652
695
  if (!item.step && (item.content || item.title || item.name || item.description)) {
@@ -680,18 +680,51 @@ export function resolveParameterAliases(
680
680
  });
681
681
  }
682
682
  } else if (canonicalName === 'update_plan') {
683
- if (!modified.plan && (modified.steps || modified.items || modified.tasks)) {
684
- modified.plan = modified.steps || modified.items || modified.tasks;
685
- delete modified.steps;
686
- delete modified.items;
687
- delete modified.tasks;
688
- repairs.push("Mapped 'steps' to 'plan' parameter for 'update_plan'");
683
+ // Peer checklist tools (TodoWrite / todowrite) are aliased to update_plan by
684
+ // name, so their argument shapes must be mapped here as well.
685
+ const planAliases = ['steps', 'items', 'tasks', 'todos', 'entries', 'checklist'] as const;
686
+ if (modified.plan === undefined || modified.plan === null || modified.plan === '') {
687
+ const source = planAliases.find((key) => modified[key] !== undefined && modified[key] !== null);
688
+ if (source) {
689
+ modified.plan = modified[source];
690
+ repairs.push(`Mapped '${source}' to 'plan' parameter for 'update_plan'`);
691
+ }
692
+ }
693
+ for (const key of planAliases) delete modified[key];
694
+ if (typeof modified.plan === 'string') {
695
+ const text = modified.plan.trim();
696
+ let parsed: unknown;
697
+ if (text.startsWith('[') || text.startsWith('{')) {
698
+ try { parsed = JSON.parse(text); } catch { parsed = undefined; }
699
+ }
700
+ if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
701
+ const inner = parsed as Record<string, unknown>;
702
+ parsed = inner.plan ?? inner.todos ?? inner.steps ?? inner.items ?? parsed;
703
+ }
704
+ if (Array.isArray(parsed)) {
705
+ modified.plan = parsed;
706
+ repairs.push("Parsed JSON-encoded 'plan' for 'update_plan'");
707
+ } else if (text) {
708
+ const lines = text.split(/\r?\n/)
709
+ .map((line) => line.replace(/^\s*(?:[-*+]|\d+[.)])?\s*(?:\[[ xX]\])?\s*/, '').trim())
710
+ .filter(Boolean);
711
+ if (lines.length > 0) {
712
+ modified.plan = lines;
713
+ repairs.push("Split plain-text 'plan' into steps for 'update_plan'");
714
+ }
715
+ }
689
716
  }
690
717
  if (Array.isArray(modified.plan)) {
691
718
  let activeCount = 0;
692
- modified.plan = (modified.plan as Record<string, unknown>[]).map((raw, idx) => {
693
- if (!raw || typeof raw !== 'object') return raw;
694
- const item = { ...raw };
719
+ modified.plan = (modified.plan as unknown[]).map((entry, idx) => {
720
+ const raw: unknown = typeof entry === 'string' && entry.trim()
721
+ ? { step: entry.trim(), status: 'pending' }
722
+ : entry;
723
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return raw;
724
+ const item: Record<string, unknown> = { ...(raw as Record<string, unknown>) };
725
+ if (item.activeForm !== undefined) delete item.activeForm;
726
+ if (item.priority !== undefined) delete item.priority;
727
+ if (item.id !== undefined && typeof item.id !== 'string') item.id = String(item.id);
695
728
  if (!item.id) item.id = `step-${idx + 1}`;
696
729
  if (!item.step && (item.content || item.title || item.name || item.description)) {
697
730
  item.step = item.content || item.title || item.name || item.description;