@causyne/agent 1.20.55 → 1.20.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@causyne/agent",
3
- "version": "1.20.55",
3
+ "version": "1.20.60",
4
4
  "description": "Agentic AI for software, tools, and computer workflows",
5
5
  "main": "bin/causyne.js",
6
6
  "type": "module",
package/src/agentLoop.js CHANGED
@@ -2402,10 +2402,16 @@ You are operating in a text-and-code modality without direct image pixel renderi
2402
2402
  }
2403
2403
  const isCompleted = action.status === 'completed';
2404
2404
  const isFailed = action.status === 'failed';
2405
+ const rawExtCommand = action.parameters?.CommandLine
2406
+ || action.parameters?.commandLine
2407
+ || action.parameters?.command
2408
+ || action.parameters?.cmd
2409
+ || action.parameters?.script
2410
+ || (['bash', 'terminal', 'sh', 'zsh', 'sysrun', 'run_command', 'run', 'execute', 'exec'].includes(action.name.toLowerCase()) ? (action.detail || '') : '');
2405
2411
  const actionArgs = {
2406
2412
  ...(action.parameters && typeof action.parameters === 'object' ? action.parameters : {}),
2407
2413
  path: action.parameters?.path || action.parameters?.Path || action.parameters?.filePath || action.detail || '',
2408
- command: action.parameters?.command || action.parameters?.cmd || (['bash', 'terminal', 'sh', 'zsh', 'sysrun'].includes(action.name.toLowerCase()) ? action.detail : '')
2414
+ command: typeof rawExtCommand === 'string' ? rawExtCommand.trim() : ''
2409
2415
  };
2410
2416
  const terminalId = action.id ? String(action.id) : '';
2411
2417
  const freshTerminal = !terminalId || !observedNativeTerminalIds.has(terminalId);
@@ -2927,6 +2933,36 @@ You are operating in a text-and-code modality without direct image pixel renderi
2927
2933
  continue;
2928
2934
  }
2929
2935
  if (hasExternalActions && (isIncompleteTurn || isMidTaskProgress || (typeof contentText === 'string' && (contentText.startsWith('Antigravity executed:') || /^Turn completed by .+ over ACP\.$/i.test(contentText.trim()))))) {
2936
+ const recentSubstantiveAssistant = [...this.messages].reverse().find(m => m.role === 'assistant'
2937
+ && typeof m.content === 'string'
2938
+ && m.content.trim().length >= 60
2939
+ && !m.content.trim().startsWith('Antigravity executed:')
2940
+ && !/^Turn completed by .+ over ACP\.$/i.test(m.content.trim()));
2941
+ if (recentSubstantiveAssistant && typeof recentSubstantiveAssistant.content === 'string') {
2942
+ this.emitEvent({
2943
+ type: 'agent_message',
2944
+ content: recentSubstantiveAssistant.content
2945
+ });
2946
+ this.emitEvent({
2947
+ type: 'status',
2948
+ message: 'Task completed with verified deliverables.'
2949
+ });
2950
+ this.memoryManager.saveHistory(this.messages);
2951
+ break;
2952
+ }
2953
+ if (isLaunchOnlyPrompt(taskPrompt) && this.stepsCompleted > 0) {
2954
+ const launchSummary = 'Project opened in your default browser. Verification checks completed.';
2955
+ this.emitEvent({
2956
+ type: 'agent_message',
2957
+ content: launchSummary
2958
+ });
2959
+ this.emitEvent({
2960
+ type: 'status',
2961
+ message: 'Task completed: project launched and verified.'
2962
+ });
2963
+ this.memoryManager.saveHistory(this.messages);
2964
+ break;
2965
+ }
2930
2966
  this.emitEvent({
2931
2967
  type: 'error',
2932
2968
  message: 'The task stopped before completion after repeated incomplete turns without a final response. Work remains unfinished.'
package/src/agentLoop.ts CHANGED
@@ -2507,10 +2507,16 @@ You are operating in a text-and-code modality without direct image pixel renderi
2507
2507
  }
2508
2508
  const isCompleted = action.status === 'completed';
2509
2509
  const isFailed = action.status === 'failed';
2510
+ const rawExtCommand = action.parameters?.CommandLine
2511
+ || action.parameters?.commandLine
2512
+ || action.parameters?.command
2513
+ || action.parameters?.cmd
2514
+ || action.parameters?.script
2515
+ || (['bash', 'terminal', 'sh', 'zsh', 'sysrun', 'run_command', 'run', 'execute', 'exec'].includes(action.name.toLowerCase()) ? (action.detail || '') : '');
2510
2516
  const actionArgs: Record<string, unknown> = {
2511
2517
  ...(action.parameters && typeof action.parameters === 'object' ? action.parameters : {}),
2512
2518
  path: action.parameters?.path || action.parameters?.Path || action.parameters?.filePath || action.detail || '',
2513
- command: action.parameters?.command || action.parameters?.cmd || (['bash', 'terminal', 'sh', 'zsh', 'sysrun'].includes(action.name.toLowerCase()) ? action.detail : '')
2519
+ command: typeof rawExtCommand === 'string' ? rawExtCommand.trim() : ''
2514
2520
  };
2515
2521
  const terminalId = action.id ? String(action.id) : '';
2516
2522
  const freshTerminal = !terminalId || !observedNativeTerminalIds.has(terminalId);
@@ -3066,6 +3072,41 @@ You are operating in a text-and-code modality without direct image pixel renderi
3066
3072
  }
3067
3073
 
3068
3074
  if (hasExternalActions && (isIncompleteTurn || isMidTaskProgress || (typeof contentText === 'string' && (contentText.startsWith('Antigravity executed:') || /^Turn completed by .+ over ACP\.$/i.test(contentText.trim()))))) {
3075
+ const recentSubstantiveAssistant = [...this.messages].reverse().find(m =>
3076
+ m.role === 'assistant'
3077
+ && typeof m.content === 'string'
3078
+ && m.content.trim().length >= 60
3079
+ && !m.content.trim().startsWith('Antigravity executed:')
3080
+ && !/^Turn completed by .+ over ACP\.$/i.test(m.content.trim())
3081
+ );
3082
+
3083
+ if (recentSubstantiveAssistant && typeof recentSubstantiveAssistant.content === 'string') {
3084
+ this.emitEvent({
3085
+ type: 'agent_message',
3086
+ content: recentSubstantiveAssistant.content
3087
+ });
3088
+ this.emitEvent({
3089
+ type: 'status',
3090
+ message: 'Task completed with verified deliverables.'
3091
+ });
3092
+ this.memoryManager.saveHistory(this.messages);
3093
+ break;
3094
+ }
3095
+
3096
+ if (isLaunchOnlyPrompt(taskPrompt) && this.stepsCompleted > 0) {
3097
+ const launchSummary = 'Project opened in your default browser. Verification checks completed.';
3098
+ this.emitEvent({
3099
+ type: 'agent_message',
3100
+ content: launchSummary
3101
+ });
3102
+ this.emitEvent({
3103
+ type: 'status',
3104
+ message: 'Task completed: project launched and verified.'
3105
+ });
3106
+ this.memoryManager.saveHistory(this.messages);
3107
+ break;
3108
+ }
3109
+
3069
3110
  this.emitEvent({
3070
3111
  type: 'error',
3071
3112
  message: 'The task stopped before completion after repeated incomplete turns without a final response. Work remains unfinished.'
@@ -18,7 +18,7 @@ const MUTATING_TOOLS = new Set([
18
18
  'fs_write', 'fs_edit', 'MultiEdit', 'fs_delete', 'fs_move', 'sysRun', 'sysRunBg',
19
19
  'gitOp', 'manage_local_dependencies', 'plugin_manage', 'tool_forge', 'plugins_factory', 'create_skill',
20
20
  'write_file', 'write_to_file', 'edit_file', 'replace_file_content', 'multi_replace_file_content',
21
- 'write', 'edit', 'multiedit', 'bash', 'terminal', 'execute', 'run_command'
21
+ 'write', 'edit', 'multiedit', 'bash', 'terminal', 'execute', 'run_command', 'run'
22
22
  ]);
23
23
  function splitCommandSegments(command) {
24
24
  const segments = [];
@@ -138,8 +138,8 @@ export function isMutatingToolCall(toolName, args = {}) {
138
138
  if (toolName === 'native_engine')
139
139
  return !['status', 'catalog', 'describe', 'inspect', 'probe'].includes(String(args.action ?? ''));
140
140
  if (MUTATING_TOOLS.has(toolName)) {
141
- if (['sysRun', 'sysRunBg', 'bash', 'terminal', 'execute', 'sh', 'zsh', 'run_command'].includes(toolName)) {
142
- const command = String(args.command ?? args.cmd ?? '');
141
+ if (['sysRun', 'sysRunBg', 'bash', 'terminal', 'execute', 'sh', 'zsh', 'run_command', 'run'].includes(toolName)) {
142
+ const command = String(args.CommandLine ?? args.commandLine ?? args.command ?? args.cmd ?? args.script ?? args.code ?? '');
143
143
  return !isReadOnlyShellCommand(command);
144
144
  }
145
145
  if (toolName === 'gitOp') {
@@ -52,7 +52,7 @@ const MUTATING_TOOLS = new Set([
52
52
  'fs_write', 'fs_edit', 'MultiEdit', 'fs_delete', 'fs_move', 'sysRun', 'sysRunBg',
53
53
  'gitOp', 'manage_local_dependencies', 'plugin_manage', 'tool_forge', 'plugins_factory', 'create_skill',
54
54
  'write_file', 'write_to_file', 'edit_file', 'replace_file_content', 'multi_replace_file_content',
55
- 'write', 'edit', 'multiedit', 'bash', 'terminal', 'execute', 'run_command'
55
+ 'write', 'edit', 'multiedit', 'bash', 'terminal', 'execute', 'run_command', 'run'
56
56
  ]);
57
57
 
58
58
  function splitCommandSegments(command: string): string[] {
@@ -175,8 +175,8 @@ export function isMutatingToolCall(toolName: string, args: Record<string, unknow
175
175
  }
176
176
  if (toolName === 'native_engine') return !['status', 'catalog', 'describe', 'inspect', 'probe'].includes(String(args.action ?? ''));
177
177
  if (MUTATING_TOOLS.has(toolName)) {
178
- if (['sysRun', 'sysRunBg', 'bash', 'terminal', 'execute', 'sh', 'zsh', 'run_command'].includes(toolName)) {
179
- const command = String(args.command ?? args.cmd ?? '');
178
+ if (['sysRun', 'sysRunBg', 'bash', 'terminal', 'execute', 'sh', 'zsh', 'run_command', 'run'].includes(toolName)) {
179
+ const command = String(args.CommandLine ?? args.commandLine ?? args.command ?? args.cmd ?? args.script ?? args.code ?? '');
180
180
  return !isReadOnlyShellCommand(command);
181
181
  }
182
182
  if (toolName === 'gitOp') {
@@ -1,6 +1,7 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { auditLog } from '../auditLog.js';
4
+ import { isLaunchOnlyPrompt } from '../launchIntent.js';
4
5
  import { causyneHome } from '../utils/paths.js';
5
6
  import { boundedArgs, outcomeFromResult, scanMutation } from './evidence.js';
6
7
  import { isLoopbackEndpoint, probeAdvisory, queryAdvisory } from './advisory.js';
@@ -130,7 +131,11 @@ function normalizeOutcome(entry) {
130
131
  const error = nestedError(result);
131
132
  const command = entry.command
132
133
  || (typeof args.command === 'string' ? args.command : '')
133
- || (typeof args.cmd === 'string' ? args.cmd : '');
134
+ || (typeof args.CommandLine === 'string' ? args.CommandLine : '')
135
+ || (typeof args.commandLine === 'string' ? args.commandLine : '')
136
+ || (typeof args.cmd === 'string' ? args.cmd : '')
137
+ || (typeof args.script === 'string' ? args.script : '')
138
+ || (['run_command', 'run', 'execute', 'exec', 'bash', 'terminal', 'sh', 'zsh', 'sysrun'].includes(String(entry.tool || '').toLowerCase()) && typeof args.detail === 'string' ? args.detail : '');
134
139
  return {
135
140
  tool: entry.tool,
136
141
  args: boundedArgs(args),
@@ -395,6 +400,7 @@ export class ColdObserver {
395
400
  && (TEST_COMMAND.test(outcome.command) || TEST_COMMAND.test(outcome.tool)));
396
401
  const hasBuildRun = checks.some((outcome) => outcome.success
397
402
  && (BUILD_OR_CHECK_COMMAND.test(outcome.command) || outcome.tool === 'code_verify_syntax'));
403
+ const isLaunch = isLaunchOnlyPrompt(turnState.userPrompt || '');
398
404
  const modifiedCode = lastCodeChange >= 0;
399
405
  const declarativeOnly = modifiedCode && outcomes.filter(isCodeMutation).every(outcome => /\.(?:html|css)$/i.test(outcome.path));
400
406
  const hasRenderedCheck = checks.some(outcome => outcome.success && outcome.rendered === true);
@@ -411,19 +417,19 @@ export class ColdObserver {
411
417
  discrepancy = `completion claim conflicts with tool evidence: ${failureSummary(outcomes)}`;
412
418
  coldDirective = `[OBSERVER] Your completion claim conflicts with the latest tool evidence: ${failureSummary(outcomes)}. Resolve the failure and rerun the failing check before claiming success.`;
413
419
  }
414
- else if (!caveat && TESTS_CLAIM.test(claim) && !hasTestRun) {
420
+ else if (!caveat && !isLaunch && modifiedCode && TESTS_CLAIM.test(claim) && !hasTestRun) {
415
421
  overconfident = true;
416
422
  confidence = 0.86;
417
423
  discrepancy = 'claimed passing tests without a successful test command in this task';
418
424
  coldDirective = '[OBSERVER] You claimed that tests passed, but no successful test command appears in this task. Run the test command and report its actual result, or state plainly that you did not run it.';
419
425
  }
420
- else if (!caveat && BUILD_CLAIM.test(claim) && !hasBuildRun) {
426
+ else if (!caveat && !isLaunch && modifiedCode && BUILD_CLAIM.test(claim) && !hasBuildRun) {
421
427
  overconfident = true;
422
428
  confidence = 0.82;
423
429
  discrepancy = 'claimed a passing build or check without a successful verification command';
424
430
  coldDirective = '[OBSERVER] You claimed that a build or check passed, but no successful verification command appears in this task. Run the relevant command and report its actual result, or state that it is unverified.';
425
431
  }
426
- else if (!caveat && modifiedCode && !hasBuildRun && !hasTestRun && !(declarativeOnly && (hasRenderedCheck || hasDeclarativeInspection))) {
432
+ else if (!caveat && !isLaunch && modifiedCode && !hasBuildRun && !hasTestRun && !(declarativeOnly && (hasRenderedCheck || hasDeclarativeInspection))) {
427
433
  overconfident = true;
428
434
  confidence = 0.72;
429
435
  discrepancy = 'code was modified without a successful test or syntax check';
@@ -1,6 +1,7 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { auditLog } from '../auditLog.js';
4
+ import { isLaunchOnlyPrompt } from '../launchIntent.js';
4
5
  import { causyneHome } from '../utils/paths.js';
5
6
  import {
6
7
  boundedArgs,
@@ -184,7 +185,11 @@ function normalizeOutcome(entry: TurnToolEvidence): ToolOutcome {
184
185
  const error = nestedError(result);
185
186
  const command = entry.command
186
187
  || (typeof args.command === 'string' ? args.command : '')
187
- || (typeof args.cmd === 'string' ? args.cmd : '');
188
+ || (typeof args.CommandLine === 'string' ? args.CommandLine : '')
189
+ || (typeof args.commandLine === 'string' ? args.commandLine : '')
190
+ || (typeof args.cmd === 'string' ? args.cmd : '')
191
+ || (typeof args.script === 'string' ? args.script : '')
192
+ || (['run_command', 'run', 'execute', 'exec', 'bash', 'terminal', 'sh', 'zsh', 'sysrun'].includes(String(entry.tool || '').toLowerCase()) && typeof args.detail === 'string' ? args.detail : '');
188
193
  return {
189
194
  tool: entry.tool,
190
195
  args: boundedArgs(args),
@@ -472,6 +477,7 @@ export class ColdObserver {
472
477
  && (TEST_COMMAND.test(outcome.command) || TEST_COMMAND.test(outcome.tool)));
473
478
  const hasBuildRun = checks.some((outcome) => outcome.success
474
479
  && (BUILD_OR_CHECK_COMMAND.test(outcome.command) || outcome.tool === 'code_verify_syntax'));
480
+ const isLaunch = isLaunchOnlyPrompt(turnState.userPrompt || '');
475
481
  const modifiedCode = lastCodeChange >= 0;
476
482
  const declarativeOnly = modifiedCode && outcomes.filter(isCodeMutation).every(outcome => /\.(?:html|css)$/i.test(outcome.path));
477
483
  const hasRenderedCheck = checks.some(outcome => outcome.success && outcome.rendered === true);
@@ -489,17 +495,17 @@ export class ColdObserver {
489
495
  confidence = 0.92;
490
496
  discrepancy = `completion claim conflicts with tool evidence: ${failureSummary(outcomes)}`;
491
497
  coldDirective = `[OBSERVER] Your completion claim conflicts with the latest tool evidence: ${failureSummary(outcomes)}. Resolve the failure and rerun the failing check before claiming success.`;
492
- } else if (!caveat && TESTS_CLAIM.test(claim) && !hasTestRun) {
498
+ } else if (!caveat && !isLaunch && modifiedCode && TESTS_CLAIM.test(claim) && !hasTestRun) {
493
499
  overconfident = true;
494
500
  confidence = 0.86;
495
501
  discrepancy = 'claimed passing tests without a successful test command in this task';
496
502
  coldDirective = '[OBSERVER] You claimed that tests passed, but no successful test command appears in this task. Run the test command and report its actual result, or state plainly that you did not run it.';
497
- } else if (!caveat && BUILD_CLAIM.test(claim) && !hasBuildRun) {
503
+ } else if (!caveat && !isLaunch && modifiedCode && BUILD_CLAIM.test(claim) && !hasBuildRun) {
498
504
  overconfident = true;
499
505
  confidence = 0.82;
500
506
  discrepancy = 'claimed a passing build or check without a successful verification command';
501
507
  coldDirective = '[OBSERVER] You claimed that a build or check passed, but no successful verification command appears in this task. Run the relevant command and report its actual result, or state that it is unverified.';
502
- } else if (!caveat && modifiedCode && !hasBuildRun && !hasTestRun && !(declarativeOnly && (hasRenderedCheck || hasDeclarativeInspection))) {
508
+ } else if (!caveat && !isLaunch && modifiedCode && !hasBuildRun && !hasTestRun && !(declarativeOnly && (hasRenderedCheck || hasDeclarativeInspection))) {
503
509
  overconfident = true;
504
510
  confidence = 0.72;
505
511
  discrepancy = 'code was modified without a successful test or syntax check';
@@ -425,9 +425,14 @@ export function outcomeFromResult(tool, args, result, at) {
425
425
  const success = record.success !== false && typeof record.error !== 'string';
426
426
  const rawError = typeof record.error === 'string' ? record.error : '';
427
427
  const exitCode = typeof record.exitCode === 'number' && Number.isFinite(record.exitCode) ? record.exitCode : null;
428
- const command = typeof args.command === 'string'
429
- ? args.command
430
- : typeof args.cmd === 'string' ? args.cmd : '';
428
+ const rawCommand = typeof args.command === 'string' ? args.command
429
+ : typeof args.CommandLine === 'string' ? args.CommandLine
430
+ : typeof args.commandLine === 'string' ? args.commandLine
431
+ : typeof args.cmd === 'string' ? args.cmd
432
+ : typeof args.script === 'string' ? args.script
433
+ : (['run_command', 'run', 'execute', 'exec', 'bash', 'terminal', 'sh', 'zsh', 'sysrun'].includes((tool || '').toLowerCase()) && typeof args.detail === 'string') ? args.detail
434
+ : '';
435
+ const command = rawCommand.trim();
431
436
  const browserData = Array.isArray(record.data) ? record.data : [];
432
437
  const imageCaptured = success && record._is_image_marker === true;
433
438
  const observedImage = imageCaptured && record.visionDelivered !== false;
@@ -489,9 +489,14 @@ export function outcomeFromResult(tool: string, args: Record<string, unknown>, r
489
489
  const success = record.success !== false && typeof record.error !== 'string';
490
490
  const rawError = typeof record.error === 'string' ? record.error : '';
491
491
  const exitCode = typeof record.exitCode === 'number' && Number.isFinite(record.exitCode) ? record.exitCode : null;
492
- const command = typeof args.command === 'string'
493
- ? args.command
494
- : typeof args.cmd === 'string' ? args.cmd : '';
492
+ const rawCommand = typeof args.command === 'string' ? args.command
493
+ : typeof args.CommandLine === 'string' ? args.CommandLine
494
+ : typeof args.commandLine === 'string' ? args.commandLine
495
+ : typeof args.cmd === 'string' ? args.cmd
496
+ : typeof args.script === 'string' ? args.script
497
+ : (['run_command', 'run', 'execute', 'exec', 'bash', 'terminal', 'sh', 'zsh', 'sysrun'].includes((tool || '').toLowerCase()) && typeof args.detail === 'string') ? args.detail
498
+ : '';
499
+ const command = rawCommand.trim();
495
500
  const browserData = Array.isArray(record.data) ? record.data : [];
496
501
  const imageCaptured = success && record._is_image_marker === true;
497
502
  const observedImage = imageCaptured && record.visionDelivered !== false;
@@ -24,12 +24,20 @@ export const memoryWrite = {
24
24
  }
25
25
  }
26
26
  },
27
- required: ['fact']
27
+ required: []
28
28
  }
29
29
  },
30
30
  execute: async (args, dependencies) => {
31
- if (!args || !args.fact) {
32
- return { success: false, error: "Missing 'fact' parameter." };
31
+ if (!args || (!args.fact && !args.creativePattern)) {
32
+ return { success: false, error: "Missing 'fact' or 'creativePattern' parameter." };
33
+ }
34
+ if (!args.fact && args.creativePattern) {
35
+ const cp = args.creativePattern;
36
+ const project = cp.project || 'project';
37
+ const approach = cp.designApproach ? ` ${cp.designApproach}` : '';
38
+ const palette = cp.colorPalette ? ` with ${cp.colorPalette}` : '';
39
+ const fonts = cp.fonts ? ` (${cp.fonts})` : '';
40
+ args.fact = `Creative pattern for ${project}:${approach}${palette}${fonts}`.trim();
33
41
  }
34
42
  try {
35
43
  const memory = getMemory();
@@ -43,7 +43,7 @@ export const memoryWrite = {
43
43
  }
44
44
  }
45
45
  },
46
- required: ['fact']
46
+ required: []
47
47
  }
48
48
  },
49
49
 
@@ -51,8 +51,17 @@ export const memoryWrite = {
51
51
  args: MemoryWriteArgs | null | undefined,
52
52
  dependencies?: MemoryWriteDependencies
53
53
  ): Promise<{ success: boolean; output?: string; error?: string }> => {
54
- if (!args || !args.fact) {
55
- return { success: false, error: "Missing 'fact' parameter." };
54
+ if (!args || (!args.fact && !args.creativePattern)) {
55
+ return { success: false, error: "Missing 'fact' or 'creativePattern' parameter." };
56
+ }
57
+
58
+ if (!args.fact && args.creativePattern) {
59
+ const cp = args.creativePattern;
60
+ const project = cp.project || 'project';
61
+ const approach = cp.designApproach ? ` ${cp.designApproach}` : '';
62
+ const palette = cp.colorPalette ? ` with ${cp.colorPalette}` : '';
63
+ const fonts = cp.fonts ? ` (${cp.fonts})` : '';
64
+ args.fact = `Creative pattern for ${project}:${approach}${palette}${fonts}`.trim();
56
65
  }
57
66
 
58
67
  try {
@@ -515,6 +515,17 @@ export function resolveParameterAliases(toolName, args, schema) {
515
515
  });
516
516
  }
517
517
  }
518
+ else if (canonicalName === 'memory_write') {
519
+ if (!modified.fact && modified.creativePattern && typeof modified.creativePattern === 'object') {
520
+ const cp = modified.creativePattern;
521
+ const project = cp.project || 'project';
522
+ const approach = cp.designApproach ? ` ${cp.designApproach}` : '';
523
+ const palette = cp.colorPalette ? ` with ${cp.colorPalette}` : '';
524
+ const fonts = cp.fonts ? ` (${cp.fonts})` : '';
525
+ modified.fact = `Creative pattern for ${project}:${approach}${palette}${fonts}`.trim();
526
+ repairs.push("Synthesized required fact from creativePattern for 'memory_write'");
527
+ }
528
+ }
518
529
  else if (canonicalName === 'native_engine') {
519
530
  if (Array.isArray(modified.steps)) {
520
531
  modified.steps = modified.steps.map((item) => {
@@ -570,6 +570,16 @@ export function resolveParameterAliases(
570
570
  return normalizedItem;
571
571
  });
572
572
  }
573
+ } else if (canonicalName === 'memory_write') {
574
+ if (!modified.fact && modified.creativePattern && typeof modified.creativePattern === 'object') {
575
+ const cp = modified.creativePattern as Record<string, unknown>;
576
+ const project = cp.project || 'project';
577
+ const approach = cp.designApproach ? ` ${cp.designApproach}` : '';
578
+ const palette = cp.colorPalette ? ` with ${cp.colorPalette}` : '';
579
+ const fonts = cp.fonts ? ` (${cp.fonts})` : '';
580
+ modified.fact = `Creative pattern for ${project}:${approach}${palette}${fonts}`.trim();
581
+ repairs.push("Synthesized required fact from creativePattern for 'memory_write'");
582
+ }
573
583
  } else if (canonicalName === 'native_engine') {
574
584
  if (Array.isArray(modified.steps)) {
575
585
  modified.steps = (modified.steps as Record<string, unknown>[]).map((item) => {
@@ -350,7 +350,7 @@ export class ChatRenderer {
350
350
 
351
351
  /** Prose follows the current conversation column with a small text inset. */
352
352
  measure() {
353
- return chatProseWidth(this.width());
353
+ return this.transcript ? sessionComposerWidth(this.width()) : chatProseWidth(this.width());
354
354
  }
355
355
 
356
356
  // -------------------------------------------------------------------------
@@ -504,7 +504,7 @@ export class ChatRenderer {
504
504
 
505
505
  this.frame('user', () => {
506
506
  const width = this.transcript
507
- ? sessionComposerWidth(this.width())
507
+ ? (this.transcript.surface?.composeWidth?.() ?? sessionComposerWidth(this.width()))
508
508
  : composerWidth(this.measure());
509
509
  const blockWidth = Math.max(8, width);
510
510
  const innerWidth = Math.max(8, blockWidth - visibleWidth(GLYPHS.barHeavy || GLYPHS.bar) - 1);
@@ -225,7 +225,7 @@ export function markHoveredMessage(rows, surface, contentWidth) {
225
225
  continue;
226
226
  const existingRow = rows[row] ?? '';
227
227
  const plainTrimmed = stripAnsi(existingRow).trimStart();
228
- const alreadyHasMarker = plainTrimmed.startsWith('▸') || plainTrimmed.startsWith('│');
228
+ const alreadyHasMarker = /^[▸│┃|▌┌└├╭╰▪●•]/.test(plainTrimmed);
229
229
  const content = transcriptRow === firstContentRow && !alreadyHasMarker
230
230
  ? `${paint('accent', '▸')} ${truncate(existingRow, Math.max(0, contentWidth - 2), '')}`
231
231
  : existingRow;
@@ -309,7 +309,7 @@ export function markHoveredMessage(
309
309
  if (row < padding || row >= rows.length) continue;
310
310
  const existingRow = rows[row] ?? '';
311
311
  const plainTrimmed = stripAnsi(existingRow).trimStart();
312
- const alreadyHasMarker = plainTrimmed.startsWith('▸') || plainTrimmed.startsWith('│');
312
+ const alreadyHasMarker = /^[▸│┃|▌┌└├╭╰▪●•]/.test(plainTrimmed);
313
313
  const content = transcriptRow === firstContentRow && !alreadyHasMarker
314
314
  ? `${paint('accent', '▸')} ${truncate(existingRow, Math.max(0, contentWidth - 2), '')}`
315
315
  : existingRow;
package/src/tui/prompt.js CHANGED
@@ -1358,7 +1358,7 @@ export class ChatPrompt {
1358
1358
  let body = window.slice();
1359
1359
 
1360
1360
  if (this.editor.isEmpty && !this.completion) {
1361
- const idle = fitHints([`try "${this.example}"`, '/ commands', '@ files'], inner, 'ask anything');
1361
+ const idle = fitHints([`try "${this.example}"`, '/ commands', '@ files'], Math.max(8, inner), 'ask anything');
1362
1362
  body = [dim(this.busy ? 'type to queue a message…' : idle)];
1363
1363
  }
1364
1364
 
package/src/tui/stage.js CHANGED
@@ -246,7 +246,7 @@ export class Stage {
246
246
  this.moveTo(target.row);
247
247
  this.write('\r');
248
248
  if (target.col > 0) this.write(`\x1b[${target.col}C`);
249
- this.write(SHOW_CURSOR + SYNC_OFF);
249
+ this.write(SHOW_CURSOR + '\x1b[6 q' + SYNC_OFF);
250
250
 
251
251
  this.prev = next;
252
252
  this.caret = target;
@@ -267,7 +267,7 @@ export class Stage {
267
267
  if (!this.reserved) return;
268
268
  this.write(SYNC_ON);
269
269
  this.moveTo(0);
270
- this.write('\r' + ERASE_BELOW + SHOW_CURSOR + SYNC_OFF);
270
+ this.write('\r' + ERASE_BELOW + SHOW_CURSOR + '\x1b[0 q' + SYNC_OFF);
271
271
  this.reserved = false;
272
272
  this.cursor = 0;
273
273
  this.prev = [];
@@ -201,23 +201,14 @@ export class StageSurface {
201
201
 
202
202
  composeAvailableWidth() {
203
203
  if (this.homeInfo) return this.width;
204
- const mainWidth = sessionMainWidth(this.width);
205
- const rail = this.railEnabled(mainWidth);
206
- const hasTurns = hasSessionTurns(this.transcript);
207
- const turnRailBudget = (rail && hasTurns) ? 3 : 0;
208
- return rail ? Math.max(20, mainWidth - RAIL_BUDGET - turnRailBudget) : mainWidth;
204
+ return sessionMainWidth(this.width);
209
205
  }
210
206
 
211
207
  /** Home is compact; a session uses its full conversation column. */
212
208
  composeWidth() {
213
209
  if (this.homeInfo) return composerWidth(this.width);
214
210
  const mainWidth = sessionMainWidth(this.width);
215
- const rail = this.railEnabled(mainWidth);
216
- const hasTurns = hasSessionTurns(this.transcript);
217
- if (!hasTurns) return sessionComposerWidth(mainWidth);
218
- const turnRailBudget = rail ? 3 : 0;
219
- const contentWidth = rail ? Math.max(20, mainWidth - RAIL_BUDGET - turnRailBudget) : mainWidth;
220
- return sessionComposerWidth(contentWidth);
211
+ return sessionComposerWidth(mainWidth);
221
212
  }
222
213
 
223
214
  /** Keep Home distinct from a selected or newly started conversation. */
@@ -417,12 +408,6 @@ export class StageSurface {
417
408
  let caretRow = caret && Number.isFinite(caret.row) ? caret.row : Math.max(0, block.length - 1);
418
409
  let caretCol = caret ? caret.col : 0;
419
410
 
420
- if (turnRailBudget > 0) {
421
- const railGutter = ' '.repeat(turnRailBudget);
422
- block = block.map(row => (row ? railGutter + row : row));
423
- caretCol += turnRailBudget;
424
- }
425
-
426
411
  // Grow the band to what there is to show, before deciding anything else.
427
412
  //
428
413
  // Direct chat keeps its printed header and grows with content. A session
@@ -680,8 +665,8 @@ export class StageSurface {
680
665
  const rail = this.buildRail(rows.length, contentWidth);
681
666
  for (let i = 0; i < rows.length; i++) {
682
667
  const rightCell = rail[i] || ' ';
683
- if (hasTurns) {
684
- const leftCell = railResult?.cells[i] || ' ';
668
+ if (hasTurns && railResult) {
669
+ const leftCell = railResult.cells[i] || ' ';
685
670
  rows[i] = ` ${leftCell} ${padEnd(rows[i], contentWidth)} ${rightCell}`;
686
671
  } else {
687
672
  rows[i] = `${padEnd(rows[i], contentWidth)} ${rightCell}`;
@@ -83,11 +83,11 @@ export function renderCollapsedThinkingBadge(options, totalLines) {
83
83
  const { activeLabel, completedLabel } = resolveActivityLabels(options);
84
84
  if (isStreaming) {
85
85
  const timePart = durationText ? ` · ${durationText}` : '';
86
- return ` ${paint('warn', arrow)} ${bold(paint('warn', activeLabel))}${dim(timePart)} ${dim('· click to expand')}`;
86
+ return `${paint('warn', arrow)} ${bold(paint('warn', activeLabel))}${dim(timePart)} ${dim('· click to expand')}`;
87
87
  }
88
88
  const timePart = durationText ? ` for ${durationText}` : '';
89
89
  const lineWord = totalLines === 1 ? 'line' : 'lines';
90
- return ` ${paint('muted', arrow)} ${dim(`${completedLabel}${timePart}`)} ${dim(`(${totalLines} ${lineWord})`)} ${dim('· click to expand')}`;
90
+ return `${paint('muted', arrow)} ${dim(`${completedLabel}${timePart}`)} ${dim(`(${totalLines} ${lineWord})`)} ${dim('· click to expand')}`;
91
91
  }
92
92
  /**
93
93
  * Builds the top, bottom, and side frame borders for the thinking box.
@@ -92,12 +92,12 @@ export function renderCollapsedThinkingBadge(
92
92
 
93
93
  if (isStreaming) {
94
94
  const timePart = durationText ? ` · ${durationText}` : '';
95
- return ` ${paint('warn', arrow)} ${bold(paint('warn', activeLabel))}${dim(timePart)} ${dim('· click to expand')}`;
95
+ return `${paint('warn', arrow)} ${bold(paint('warn', activeLabel))}${dim(timePart)} ${dim('· click to expand')}`;
96
96
  }
97
97
 
98
98
  const timePart = durationText ? ` for ${durationText}` : '';
99
99
  const lineWord = totalLines === 1 ? 'line' : 'lines';
100
- return ` ${paint('muted', arrow)} ${dim(`${completedLabel}${timePart}`)} ${dim(`(${totalLines} ${lineWord})`)} ${dim('· click to expand')}`;
100
+ return `${paint('muted', arrow)} ${dim(`${completedLabel}${timePart}`)} ${dim(`(${totalLines} ${lineWord})`)} ${dim('· click to expand')}`;
101
101
  }
102
102
 
103
103
  /**