@causyne/agent 1.20.32 → 1.20.34
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 +1 -1
- package/src/agentLoop.js +6 -2
- package/src/agentLoop.ts +8 -2
- package/src/implementationPlan.js +8 -2
- package/src/implementationPlan.ts +9 -2
- package/src/launchIntent.js +3 -1
- package/src/launchIntent.ts +2 -1
- package/src/observer/evidence.js +11 -3
- package/src/observer/evidence.ts +9 -3
- package/src/toolPacks.js +7 -1
- package/src/toolPacks.ts +6 -1
- package/src/verificationPlan.js +19 -4
- package/src/verificationPlan.ts +17 -4
package/package.json
CHANGED
package/src/agentLoop.js
CHANGED
|
@@ -2928,7 +2928,9 @@ You are operating in a text-and-code modality without direct image pixel renderi
|
|
|
2928
2928
|
}
|
|
2929
2929
|
}
|
|
2930
2930
|
// Web Visual Validation Guard (Anti-Slop / Transcendence)
|
|
2931
|
-
const
|
|
2931
|
+
const outcomes = coldObserver.getToolOutcomes(this.taskId);
|
|
2932
|
+
const hasWebOrCodeMutation = this.webArtifacts.size > 0 || outcomes.some((o) => o.success !== false && ['fs_write', 'fs_edit', 'MultiEdit', 'ui_forge', 'write_file', 'write_to_file', 'edit_file', 'replace_file_content', 'multi_replace_file_content'].includes(String(o.tool || '')));
|
|
2933
|
+
const isWebTask = !isLaunchOnlyPrompt(taskPrompt) && !isPlanningOnlyRequest(taskPrompt) && isWebIntent(taskPrompt) && hasWebOrCodeMutation;
|
|
2932
2934
|
let browserReady = false;
|
|
2933
2935
|
let browserDeclined = false;
|
|
2934
2936
|
let browserRuntimeError = '';
|
|
@@ -2988,7 +2990,6 @@ You are operating in a text-and-code modality without direct image pixel renderi
|
|
|
2988
2990
|
// Tool availability and a completed plan are not evidence of visual
|
|
2989
2991
|
// inspection. A failed browser/capture attempt must not become a
|
|
2990
2992
|
// successful task merely because the provider says "verified".
|
|
2991
|
-
const outcomes = coldObserver.getToolOutcomes(this.taskId);
|
|
2992
2993
|
const hasBrowserActOutcome = outcomes.some((o) => o.tool === 'browser_act' && o.success !== false);
|
|
2993
2994
|
const hasPassingTests = outcomes.some((o) => o.success && (isVerificationCommand(o.command || o.tool || '') || /\b(?:test|unittest|vitest|jest|pytest)\b/i.test(o.command || ''))) || (Array.isArray(this._planSteps) && this._planSteps.some(s => s.success && /test/i.test(s.tool)));
|
|
2994
2995
|
let observerVerified = false;
|
|
@@ -3759,6 +3760,9 @@ You are operating in a text-and-code modality without direct image pixel renderi
|
|
|
3759
3760
|
this.emitEvent({ type: result?.success === false || typeof result?.error === 'string' ? 'step_error' : 'step_complete',
|
|
3760
3761
|
tool: functionName, result: eventResult, toolCallId: toolCall.id });
|
|
3761
3762
|
this.stepsCompleted++;
|
|
3763
|
+
if (this._implementationPlanSeeded && result?.success !== false && !result?.error && functionName !== 'update_plan') {
|
|
3764
|
+
this.advanceImplementationPlanProgress('mutation');
|
|
3765
|
+
}
|
|
3762
3766
|
// The procedure, as it actually ran. Tool name plus a whitelisted
|
|
3763
3767
|
// action token only — planCache.toStep() reads no paths, arguments or
|
|
3764
3768
|
// command lines, so what is cached is a route and never a transcript.
|
package/src/agentLoop.ts
CHANGED
|
@@ -3084,7 +3084,11 @@ You are operating in a text-and-code modality without direct image pixel renderi
|
|
|
3084
3084
|
}
|
|
3085
3085
|
|
|
3086
3086
|
// Web Visual Validation Guard (Anti-Slop / Transcendence)
|
|
3087
|
-
const
|
|
3087
|
+
const outcomes = coldObserver.getToolOutcomes(this.taskId);
|
|
3088
|
+
const hasWebOrCodeMutation = this.webArtifacts.size > 0 || outcomes.some((o) =>
|
|
3089
|
+
o.success !== false && ['fs_write', 'fs_edit', 'MultiEdit', 'ui_forge', 'write_file', 'write_to_file', 'edit_file', 'replace_file_content', 'multi_replace_file_content'].includes(String(o.tool || ''))
|
|
3090
|
+
);
|
|
3091
|
+
const isWebTask = !isLaunchOnlyPrompt(taskPrompt) && !isPlanningOnlyRequest(taskPrompt) && isWebIntent(taskPrompt) && hasWebOrCodeMutation;
|
|
3088
3092
|
let browserReady = false;
|
|
3089
3093
|
let browserDeclined = false;
|
|
3090
3094
|
let browserRuntimeError = '';
|
|
@@ -3141,7 +3145,6 @@ You are operating in a text-and-code modality without direct image pixel renderi
|
|
|
3141
3145
|
// Tool availability and a completed plan are not evidence of visual
|
|
3142
3146
|
// inspection. A failed browser/capture attempt must not become a
|
|
3143
3147
|
// successful task merely because the provider says "verified".
|
|
3144
|
-
const outcomes = coldObserver.getToolOutcomes(this.taskId);
|
|
3145
3148
|
const hasBrowserActOutcome = outcomes.some(
|
|
3146
3149
|
(o) => o.tool === 'browser_act' && o.success !== false
|
|
3147
3150
|
);
|
|
@@ -3978,6 +3981,9 @@ You are operating in a text-and-code modality without direct image pixel renderi
|
|
|
3978
3981
|
this.emitEvent({ type: result?.success === false || typeof result?.error === 'string' ? 'step_error' : 'step_complete',
|
|
3979
3982
|
tool: functionName, result: eventResult, toolCallId: toolCall.id });
|
|
3980
3983
|
this.stepsCompleted++;
|
|
3984
|
+
if (this._implementationPlanSeeded && result?.success !== false && !result?.error && functionName !== 'update_plan') {
|
|
3985
|
+
this.advanceImplementationPlanProgress('mutation');
|
|
3986
|
+
}
|
|
3981
3987
|
|
|
3982
3988
|
// The procedure, as it actually ran. Tool name plus a whitelisted
|
|
3983
3989
|
// action token only — planCache.toStep() reads no paths, arguments or
|
|
@@ -119,7 +119,7 @@ export function normalizePeerPlanEntries(value) {
|
|
|
119
119
|
}
|
|
120
120
|
return { explanation, plan: steps };
|
|
121
121
|
}
|
|
122
|
-
export function extractToolCallJsonObjects(text) {
|
|
122
|
+
export function extractToolCallJsonObjects(text, allowUnclosedHealing = true) {
|
|
123
123
|
const results = [];
|
|
124
124
|
if (!text || typeof text !== 'string')
|
|
125
125
|
return results;
|
|
@@ -180,6 +180,8 @@ export function extractToolCallJsonObjects(text) {
|
|
|
180
180
|
// Fall through to suffix healing below
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
+
if (!allowUnclosedHealing)
|
|
184
|
+
continue;
|
|
183
185
|
// Unclosed or truncated JSON after <tool_call>: strip trailing XML/DSML closing tags and heal
|
|
184
186
|
const nextTagIndex = text.indexOf('<tool_call>', braceStart + 1);
|
|
185
187
|
const sliceEnd = nextTagIndex === -1 ? text.length : nextTagIndex;
|
|
@@ -243,6 +245,8 @@ export function extractToolCallJsonObjects(text) {
|
|
|
243
245
|
}
|
|
244
246
|
return results;
|
|
245
247
|
}
|
|
248
|
+
const TRAILING_PARTIAL_TOOL_TAG = /<\/?(?:t(?:o(?:o(?:l(?:_(?:c(?:a(?:l(?:l)?)?)?)?)?)?)?)?|f(?:u(?:n(?:c(?:t(?:i(?:o(?:n(?:_(?:c(?:a(?:l(?:l(?:s)?)?)?)?)?)?)?)?)?)?)?)?)?|i(?:n(?:v(?:o(?:k(?:e)?)?)?)?)?|[||][^\n>]*)$/i;
|
|
249
|
+
const TRAILING_PARTIAL_THINK_TAG = /<\/?(?:t(?:h(?:i(?:n(?:k(?:i(?:n(?:g)?)?)?)?|o(?:u(?:g(?:h(?:t)?)?)?)?)?)?)?|r(?:e(?:a(?:s(?:o(?:n(?:i(?:n(?:g(?:_(?:s(?:c(?:r(?:a(?:t(?:c(?:h(?:p(?:a(?:d)?)?)?)?)?)?)?)?)?)?)?)?)?)?)?)?)?)?)?)$/i;
|
|
246
250
|
export function stripToolCallMarkup(text) {
|
|
247
251
|
if (!text || typeof text !== 'string')
|
|
248
252
|
return '';
|
|
@@ -250,6 +254,7 @@ export function stripToolCallMarkup(text) {
|
|
|
250
254
|
.replace(/<tool_call>[\s\S]*?(?:<\/tool_call>|(?:\s*<\/?[||]DSML[||][^>]*>)+|$)/gi, '')
|
|
251
255
|
.replace(/<[||]DSML[||][\s\S]*?(?:<\/[||]DSML[||]\s*calls>|$)/gi, '')
|
|
252
256
|
.replace(/(?:\s*<\/?[||]DSML[||][^>]*>)+/gi, '')
|
|
257
|
+
.replace(TRAILING_PARTIAL_TOOL_TAG, '')
|
|
253
258
|
.trim();
|
|
254
259
|
}
|
|
255
260
|
export function stripThinkBlocks(text) {
|
|
@@ -257,6 +262,7 @@ export function stripThinkBlocks(text) {
|
|
|
257
262
|
return '';
|
|
258
263
|
return text
|
|
259
264
|
.replace(/<(?:think|thought|reasoning|thinking|REASONING_SCRATCHPAD)>[\s\S]*?(?:<\/(?:think|thought|reasoning|thinking|REASONING_SCRATCHPAD)>|$)/gi, '')
|
|
265
|
+
.replace(TRAILING_PARTIAL_THINK_TAG, '')
|
|
260
266
|
.trim();
|
|
261
267
|
}
|
|
262
268
|
export function extractLivePlanFromText(text, allowTrailing = false) {
|
|
@@ -265,7 +271,7 @@ export function extractLivePlanFromText(text, allowTrailing = false) {
|
|
|
265
271
|
const cleanText = text.replace(/\r\n/g, '\n');
|
|
266
272
|
// 1. Check for inline <tool_call>{"name": "update_plan" | "todowrite", ...}</tool_call> (including DSML-closed blocks)
|
|
267
273
|
let latestToolPlan = null;
|
|
268
|
-
for (const parsed of extractToolCallJsonObjects(cleanText)) {
|
|
274
|
+
for (const parsed of extractToolCallJsonObjects(cleanText, allowTrailing)) {
|
|
269
275
|
try {
|
|
270
276
|
const toolName = String(parsed?.name || parsed?.tool || '').toLowerCase().trim();
|
|
271
277
|
if (toolName === 'update_plan' || toolName === 'todowrite' || toolName === 'todo_write') {
|
|
@@ -127,7 +127,7 @@ export function normalizePeerPlanEntries(value: unknown): PlanUpdate | null {
|
|
|
127
127
|
return { explanation, plan: steps };
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
export function extractToolCallJsonObjects(text: string): Array<Record<string, unknown>> {
|
|
130
|
+
export function extractToolCallJsonObjects(text: string, allowUnclosedHealing = true): Array<Record<string, unknown>> {
|
|
131
131
|
const results: Array<Record<string, unknown>> = [];
|
|
132
132
|
if (!text || typeof text !== 'string') return results;
|
|
133
133
|
|
|
@@ -183,6 +183,8 @@ export function extractToolCallJsonObjects(text: string): Array<Record<string, u
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
if (!allowUnclosedHealing) continue;
|
|
187
|
+
|
|
186
188
|
// Unclosed or truncated JSON after <tool_call>: strip trailing XML/DSML closing tags and heal
|
|
187
189
|
const nextTagIndex = text.indexOf('<tool_call>', braceStart + 1);
|
|
188
190
|
const sliceEnd = nextTagIndex === -1 ? text.length : nextTagIndex;
|
|
@@ -245,12 +247,16 @@ export function extractToolCallJsonObjects(text: string): Array<Record<string, u
|
|
|
245
247
|
return results;
|
|
246
248
|
}
|
|
247
249
|
|
|
250
|
+
const TRAILING_PARTIAL_TOOL_TAG = /<\/?(?:t(?:o(?:o(?:l(?:_(?:c(?:a(?:l(?:l)?)?)?)?)?)?)?)?|f(?:u(?:n(?:c(?:t(?:i(?:o(?:n(?:_(?:c(?:a(?:l(?:l(?:s)?)?)?)?)?)?)?)?)?)?)?)?)?|i(?:n(?:v(?:o(?:k(?:e)?)?)?)?)?|[||][^\n>]*)$/i;
|
|
251
|
+
const TRAILING_PARTIAL_THINK_TAG = /<\/?(?:t(?:h(?:i(?:n(?:k(?:i(?:n(?:g)?)?)?)?|o(?:u(?:g(?:h(?:t)?)?)?)?)?)?)?|r(?:e(?:a(?:s(?:o(?:n(?:i(?:n(?:g(?:_(?:s(?:c(?:r(?:a(?:t(?:c(?:h(?:p(?:a(?:d)?)?)?)?)?)?)?)?)?)?)?)?)?)?)?)?)?)?)?)$/i;
|
|
252
|
+
|
|
248
253
|
export function stripToolCallMarkup(text: string): string {
|
|
249
254
|
if (!text || typeof text !== 'string') return '';
|
|
250
255
|
return text
|
|
251
256
|
.replace(/<tool_call>[\s\S]*?(?:<\/tool_call>|(?:\s*<\/?[||]DSML[||][^>]*>)+|$)/gi, '')
|
|
252
257
|
.replace(/<[||]DSML[||][\s\S]*?(?:<\/[||]DSML[||]\s*calls>|$)/gi, '')
|
|
253
258
|
.replace(/(?:\s*<\/?[||]DSML[||][^>]*>)+/gi, '')
|
|
259
|
+
.replace(TRAILING_PARTIAL_TOOL_TAG, '')
|
|
254
260
|
.trim();
|
|
255
261
|
}
|
|
256
262
|
|
|
@@ -258,6 +264,7 @@ export function stripThinkBlocks(text: string): string {
|
|
|
258
264
|
if (!text || typeof text !== 'string') return '';
|
|
259
265
|
return text
|
|
260
266
|
.replace(/<(?:think|thought|reasoning|thinking|REASONING_SCRATCHPAD)>[\s\S]*?(?:<\/(?:think|thought|reasoning|thinking|REASONING_SCRATCHPAD)>|$)/gi, '')
|
|
267
|
+
.replace(TRAILING_PARTIAL_THINK_TAG, '')
|
|
261
268
|
.trim();
|
|
262
269
|
}
|
|
263
270
|
|
|
@@ -267,7 +274,7 @@ export function extractLivePlanFromText(text: string, allowTrailing = false): Pl
|
|
|
267
274
|
|
|
268
275
|
// 1. Check for inline <tool_call>{"name": "update_plan" | "todowrite", ...}</tool_call> (including DSML-closed blocks)
|
|
269
276
|
let latestToolPlan: PlanUpdate | null = null;
|
|
270
|
-
for (const parsed of extractToolCallJsonObjects(cleanText)) {
|
|
277
|
+
for (const parsed of extractToolCallJsonObjects(cleanText, allowTrailing)) {
|
|
271
278
|
try {
|
|
272
279
|
const toolName = String(parsed?.name || parsed?.tool || '').toLowerCase().trim();
|
|
273
280
|
if (toolName === 'update_plan' || toolName === 'todowrite' || toolName === 'todo_write') {
|
package/src/launchIntent.js
CHANGED
|
@@ -11,7 +11,9 @@ const MUTATION_TOOLS = new Set([
|
|
|
11
11
|
'create_skill', 'manage_local_dependencies'
|
|
12
12
|
]);
|
|
13
13
|
export function isLaunchOnlyPrompt(prompt) {
|
|
14
|
-
if (/\
|
|
14
|
+
if (/\b(?:run|execute)\s+(?:the\s+)?(?:tests?|checks?|lint|benchmarks?|scripts?|commands?|tools?|creative_apps|resolve_act|memory_recall|native_engine|browser_act|fs_read|sysRun)\b/i.test(prompt))
|
|
15
|
+
return false;
|
|
16
|
+
if (/\b(?:verify|verification|verify_bridge|inspectActive|simulate|probe|audit|analyze|diagnose)\b/i.test(prompt))
|
|
15
17
|
return false;
|
|
16
18
|
return LAUNCH_VERBS.test(prompt) && !CHANGE_VERBS.test(prompt);
|
|
17
19
|
}
|
package/src/launchIntent.ts
CHANGED
|
@@ -13,7 +13,8 @@ const MUTATION_TOOLS = new Set([
|
|
|
13
13
|
]);
|
|
14
14
|
|
|
15
15
|
export function isLaunchOnlyPrompt(prompt: string): boolean {
|
|
16
|
-
if (/\
|
|
16
|
+
if (/\b(?:run|execute)\s+(?:the\s+)?(?:tests?|checks?|lint|benchmarks?|scripts?|commands?|tools?|creative_apps|resolve_act|memory_recall|native_engine|browser_act|fs_read|sysRun)\b/i.test(prompt)) return false;
|
|
17
|
+
if (/\b(?:verify|verification|verify_bridge|inspectActive|simulate|probe|audit|analyze|diagnose)\b/i.test(prompt)) return false;
|
|
17
18
|
return LAUNCH_VERBS.test(prompt) && !CHANGE_VERBS.test(prompt);
|
|
18
19
|
}
|
|
19
20
|
|
package/src/observer/evidence.js
CHANGED
|
@@ -397,7 +397,7 @@ export function scanMutation(toolName, args, context) {
|
|
|
397
397
|
}
|
|
398
398
|
export function boundedArgs(args) {
|
|
399
399
|
const result = {};
|
|
400
|
-
for (const key of ['command', 'cmd', 'path', 'file_path', 'source', 'destination', 'action', 'url', 'query', 'pattern']) {
|
|
400
|
+
for (const key of ['command', 'cmd', 'path', 'file_path', 'source', 'destination', 'action', 'operation', 'engine', 'host', 'mode', 'url', 'query', 'pattern']) {
|
|
401
401
|
const value = args[key];
|
|
402
402
|
if (typeof value === 'string')
|
|
403
403
|
result[key] = value.slice(0, 400);
|
|
@@ -406,6 +406,12 @@ export function boundedArgs(args) {
|
|
|
406
406
|
result.recursive = args.recursive;
|
|
407
407
|
if (typeof args.overwrite === 'boolean')
|
|
408
408
|
result.overwrite = args.overwrite;
|
|
409
|
+
if (typeof args.simulate === 'boolean')
|
|
410
|
+
result.simulate = args.simulate;
|
|
411
|
+
if (typeof args.dryRun === 'boolean')
|
|
412
|
+
result.dryRun = args.dryRun;
|
|
413
|
+
if (typeof args.extractTextOnly === 'boolean')
|
|
414
|
+
result.extractTextOnly = args.extractTextOnly;
|
|
409
415
|
if (typeof args.content === 'string')
|
|
410
416
|
result.contentBytes = Buffer.byteLength(args.content, 'utf8');
|
|
411
417
|
if (Array.isArray(args.edits))
|
|
@@ -423,7 +429,8 @@ export function outcomeFromResult(tool, args, result, at) {
|
|
|
423
429
|
? args.command
|
|
424
430
|
: typeof args.cmd === 'string' ? args.cmd : '';
|
|
425
431
|
const browserData = Array.isArray(record.data) ? record.data : [];
|
|
426
|
-
const
|
|
432
|
+
const imageCaptured = success && record._is_image_marker === true;
|
|
433
|
+
const observedImage = imageCaptured && record.visionDelivered !== false;
|
|
427
434
|
const rendered = success && (observedImage || (tool === 'browser_act' && browserData.some((item) => {
|
|
428
435
|
if (!item || typeof item !== 'object')
|
|
429
436
|
return false;
|
|
@@ -442,6 +449,7 @@ export function outcomeFromResult(tool, args, result, at) {
|
|
|
442
449
|
path: pathArgument(args).slice(0, 400),
|
|
443
450
|
at,
|
|
444
451
|
...(rendered ? { rendered: true } : {}),
|
|
445
|
-
...(observedImage ? { observedImage: true } : {})
|
|
452
|
+
...(observedImage ? { observedImage: true } : {}),
|
|
453
|
+
...(imageCaptured ? { imageCaptured: true } : {})
|
|
446
454
|
};
|
|
447
455
|
}
|
package/src/observer/evidence.ts
CHANGED
|
@@ -40,6 +40,7 @@ export interface ToolOutcome {
|
|
|
40
40
|
at: number;
|
|
41
41
|
rendered?: boolean;
|
|
42
42
|
observedImage?: boolean;
|
|
43
|
+
imageCaptured?: boolean;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
const SEVERITY_WEIGHT: Record<RiskSeverity, number> = {
|
|
@@ -467,12 +468,15 @@ export function scanMutation(toolName: string, args: Record<string, unknown>, co
|
|
|
467
468
|
|
|
468
469
|
export function boundedArgs(args: Record<string, unknown>): Record<string, unknown> {
|
|
469
470
|
const result: Record<string, unknown> = {};
|
|
470
|
-
for (const key of ['command', 'cmd', 'path', 'file_path', 'source', 'destination', 'action', 'url', 'query', 'pattern']) {
|
|
471
|
+
for (const key of ['command', 'cmd', 'path', 'file_path', 'source', 'destination', 'action', 'operation', 'engine', 'host', 'mode', 'url', 'query', 'pattern']) {
|
|
471
472
|
const value = args[key];
|
|
472
473
|
if (typeof value === 'string') result[key] = value.slice(0, 400);
|
|
473
474
|
}
|
|
474
475
|
if (typeof args.recursive === 'boolean') result.recursive = args.recursive;
|
|
475
476
|
if (typeof args.overwrite === 'boolean') result.overwrite = args.overwrite;
|
|
477
|
+
if (typeof args.simulate === 'boolean') result.simulate = args.simulate;
|
|
478
|
+
if (typeof args.dryRun === 'boolean') result.dryRun = args.dryRun;
|
|
479
|
+
if (typeof args.extractTextOnly === 'boolean') result.extractTextOnly = args.extractTextOnly;
|
|
476
480
|
if (typeof args.content === 'string') result.contentBytes = Buffer.byteLength(args.content, 'utf8');
|
|
477
481
|
if (Array.isArray(args.edits)) result.editCount = args.edits.length;
|
|
478
482
|
return result;
|
|
@@ -489,7 +493,8 @@ export function outcomeFromResult(tool: string, args: Record<string, unknown>, r
|
|
|
489
493
|
? args.command
|
|
490
494
|
: typeof args.cmd === 'string' ? args.cmd : '';
|
|
491
495
|
const browserData = Array.isArray(record.data) ? record.data : [];
|
|
492
|
-
const
|
|
496
|
+
const imageCaptured = success && record._is_image_marker === true;
|
|
497
|
+
const observedImage = imageCaptured && record.visionDelivered !== false;
|
|
493
498
|
const rendered = success && (observedImage || (tool === 'browser_act' && browserData.some((item: unknown) => {
|
|
494
499
|
if (!item || typeof item !== 'object') return false;
|
|
495
500
|
const action = item as { action?: string; success?: boolean; error?: unknown; data?: { runtimeErrors?: unknown[] } };
|
|
@@ -508,6 +513,7 @@ export function outcomeFromResult(tool: string, args: Record<string, unknown>, r
|
|
|
508
513
|
path: pathArgument(args).slice(0, 400),
|
|
509
514
|
at,
|
|
510
515
|
...(rendered ? { rendered: true } : {}),
|
|
511
|
-
...(observedImage ? { observedImage: true } : {})
|
|
516
|
+
...(observedImage ? { observedImage: true } : {}),
|
|
517
|
+
...(imageCaptured ? { imageCaptured: true } : {})
|
|
512
518
|
};
|
|
513
519
|
}
|
package/src/toolPacks.js
CHANGED
|
@@ -349,7 +349,13 @@ export function isGameIntent(prompt) {
|
|
|
349
349
|
}
|
|
350
350
|
/** True when the prompt genuinely describes web/UI work. */
|
|
351
351
|
export function isWebIntent(prompt) {
|
|
352
|
-
|
|
352
|
+
if (!prompt)
|
|
353
|
+
return false;
|
|
354
|
+
const sanitized = prompt
|
|
355
|
+
.replace(/\b(?:adobe|photoshop|premiere|after\s*effects|illustrator|indesign|extendscript|uxp)\s+dom\b/gi, '')
|
|
356
|
+
.replace(/\bdom\s*\/\s*python\b/gi, '')
|
|
357
|
+
.replace(/\bdom\s+simulat(?:or|ion)\b/gi, '');
|
|
358
|
+
return WEB_INTENT.test(sanitized);
|
|
353
359
|
}
|
|
354
360
|
/**
|
|
355
361
|
* Decide which packs to unlock before the first LLM call, so the common case
|
package/src/toolPacks.ts
CHANGED
|
@@ -397,7 +397,12 @@ export function isGameIntent(prompt?: string | null): boolean {
|
|
|
397
397
|
|
|
398
398
|
/** True when the prompt genuinely describes web/UI work. */
|
|
399
399
|
export function isWebIntent(prompt?: string | null): boolean {
|
|
400
|
-
|
|
400
|
+
if (!prompt) return false;
|
|
401
|
+
const sanitized = prompt
|
|
402
|
+
.replace(/\b(?:adobe|photoshop|premiere|after\s*effects|illustrator|indesign|extendscript|uxp)\s+dom\b/gi, '')
|
|
403
|
+
.replace(/\bdom\s*\/\s*python\b/gi, '')
|
|
404
|
+
.replace(/\bdom\s+simulat(?:or|ion)\b/gi, '');
|
|
405
|
+
return WEB_INTENT.test(sanitized);
|
|
401
406
|
}
|
|
402
407
|
|
|
403
408
|
/**
|
package/src/verificationPlan.js
CHANGED
|
@@ -24,6 +24,10 @@ const CREATIVE_MUTATORS = new Set([
|
|
|
24
24
|
'blender_act', 'creative_apps', 'execute_procedural_media', 'generate_media_via_api',
|
|
25
25
|
'native_engine', 'resolve_act', 'palmier_act', 'game_audio_synth'
|
|
26
26
|
]);
|
|
27
|
+
const READ_ONLY_CREATIVE_ACTIONS = new Set([
|
|
28
|
+
'discover', 'status', 'inspect', 'inspectactive', 'verify', 'verify_bridge',
|
|
29
|
+
'pipeline_plan', 'probe', 'list', 'info', 'check', 'ping', 'health'
|
|
30
|
+
]);
|
|
27
31
|
const WEB_PATH = /\.(?:html?|css|scss|jsx|tsx|vue|svelte)$/i;
|
|
28
32
|
const CODE_PATH = /\.(?:[cm]?[jt]s|py|rb|php|go|rs|java|kt|kts|swift|c|cc|cpp|h|hpp|cs|sh|sql)$/i;
|
|
29
33
|
const DOCUMENT_PATH = /\.(?:pdf|docx?|pptx?|odt|rtf|epub)$/i;
|
|
@@ -32,11 +36,21 @@ const RUN_COMMAND = /^\s*(?:node|python3?|ruby|php|deno|bun|go\s+run|cargo\s+run
|
|
|
32
36
|
const MEDIA_PROBE = /\b(?:ffprobe|afinfo|soxi|identify|mediainfo|exiftool)\b/i;
|
|
33
37
|
const READBACK_TOOLS = new Set(['pdf_read', 'fs_read', 'view_image', 'vision_inspect_ui', 'screenshot']);
|
|
34
38
|
const LOOK_TOOLS = new Set(['view_image', 'vision_inspect_ui', 'screenshot']);
|
|
39
|
+
function isCreativeMutation(outcome) {
|
|
40
|
+
if (!CREATIVE_MUTATORS.has(outcome.tool))
|
|
41
|
+
return false;
|
|
42
|
+
if (outcome.args?.simulate === true || outcome.args?.dryRun === true)
|
|
43
|
+
return false;
|
|
44
|
+
const action = String(outcome.args?.action ?? outcome.args?.operation ?? '').toLowerCase().trim();
|
|
45
|
+
if (action && READ_ONLY_CREATIVE_ACTIONS.has(action))
|
|
46
|
+
return false;
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
35
49
|
function isMutation(outcome) {
|
|
36
50
|
if (!outcome.success)
|
|
37
51
|
return false;
|
|
38
52
|
const tool = outcome.tool;
|
|
39
|
-
if (CODE_MUTATORS.has(tool) ||
|
|
53
|
+
if (CODE_MUTATORS.has(tool) || isCreativeMutation(outcome))
|
|
40
54
|
return true;
|
|
41
55
|
if (tool === 'document_forge')
|
|
42
56
|
return true;
|
|
@@ -47,7 +61,7 @@ function domainsOf(input, mutations) {
|
|
|
47
61
|
for (const outcome of mutations) {
|
|
48
62
|
const tool = outcome.tool;
|
|
49
63
|
const target = outcome.path || '';
|
|
50
|
-
if (
|
|
64
|
+
if (isCreativeMutation(outcome))
|
|
51
65
|
found.add('creative');
|
|
52
66
|
else if (tool === 'document_forge' || DOCUMENT_PATH.test(target))
|
|
53
67
|
found.add('document');
|
|
@@ -68,7 +82,7 @@ function after(outcomes, domain) {
|
|
|
68
82
|
return false;
|
|
69
83
|
const target = outcome.path || '';
|
|
70
84
|
switch (domain) {
|
|
71
|
-
case 'creative': return
|
|
85
|
+
case 'creative': return isCreativeMutation(outcome);
|
|
72
86
|
case 'document': return outcome.tool === 'document_forge' || DOCUMENT_PATH.test(target);
|
|
73
87
|
case 'web': return CODE_MUTATORS.has(outcome.tool) && WEB_PATH.test(target);
|
|
74
88
|
case 'code': return CODE_MUTATORS.has(outcome.tool) && CODE_PATH.test(target);
|
|
@@ -87,7 +101,8 @@ function satisfied(domain, evidence) {
|
|
|
87
101
|
return ok.some((outcome) => outcome.rendered === true);
|
|
88
102
|
case 'creative':
|
|
89
103
|
return ok.some((outcome) => outcome.observedImage === true
|
|
90
|
-
|| MEDIA_PROBE.test(outcome.command)
|
|
104
|
+
|| MEDIA_PROBE.test(outcome.command)
|
|
105
|
+
|| (outcome.tool === 'native_engine' && ['probe', 'inspect', 'verify', 'status'].includes(String(outcome.args?.action ?? '').toLowerCase())));
|
|
91
106
|
case 'document':
|
|
92
107
|
return ok.some((outcome) => outcome.observedImage === true
|
|
93
108
|
|| (['pdf_read', 'fs_read'].includes(outcome.tool) && DOCUMENT_PATH.test(outcome.path)));
|
package/src/verificationPlan.ts
CHANGED
|
@@ -51,6 +51,10 @@ const CREATIVE_MUTATORS = new Set([
|
|
|
51
51
|
'blender_act', 'creative_apps', 'execute_procedural_media', 'generate_media_via_api',
|
|
52
52
|
'native_engine', 'resolve_act', 'palmier_act', 'game_audio_synth'
|
|
53
53
|
]);
|
|
54
|
+
const READ_ONLY_CREATIVE_ACTIONS = new Set([
|
|
55
|
+
'discover', 'status', 'inspect', 'inspectactive', 'verify', 'verify_bridge',
|
|
56
|
+
'pipeline_plan', 'probe', 'list', 'info', 'check', 'ping', 'health'
|
|
57
|
+
]);
|
|
54
58
|
|
|
55
59
|
const WEB_PATH = /\.(?:html?|css|scss|jsx|tsx|vue|svelte)$/i;
|
|
56
60
|
const CODE_PATH = /\.(?:[cm]?[jt]s|py|rb|php|go|rs|java|kt|kts|swift|c|cc|cpp|h|hpp|cs|sh|sql)$/i;
|
|
@@ -63,10 +67,18 @@ const MEDIA_PROBE = /\b(?:ffprobe|afinfo|soxi|identify|mediainfo|exiftool)\b/i;
|
|
|
63
67
|
const READBACK_TOOLS = new Set(['pdf_read', 'fs_read', 'view_image', 'vision_inspect_ui', 'screenshot']);
|
|
64
68
|
const LOOK_TOOLS = new Set(['view_image', 'vision_inspect_ui', 'screenshot']);
|
|
65
69
|
|
|
70
|
+
function isCreativeMutation(outcome: ToolOutcome): boolean {
|
|
71
|
+
if (!CREATIVE_MUTATORS.has(outcome.tool)) return false;
|
|
72
|
+
if (outcome.args?.simulate === true || outcome.args?.dryRun === true) return false;
|
|
73
|
+
const action = String(outcome.args?.action ?? outcome.args?.operation ?? '').toLowerCase().trim();
|
|
74
|
+
if (action && READ_ONLY_CREATIVE_ACTIONS.has(action)) return false;
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
66
78
|
function isMutation(outcome: ToolOutcome): boolean {
|
|
67
79
|
if (!outcome.success) return false;
|
|
68
80
|
const tool = outcome.tool;
|
|
69
|
-
if (CODE_MUTATORS.has(tool) ||
|
|
81
|
+
if (CODE_MUTATORS.has(tool) || isCreativeMutation(outcome)) return true;
|
|
70
82
|
if (tool === 'document_forge') return true;
|
|
71
83
|
return false;
|
|
72
84
|
}
|
|
@@ -76,7 +88,7 @@ function domainsOf(input: VerificationInput, mutations: readonly ToolOutcome[]):
|
|
|
76
88
|
for (const outcome of mutations) {
|
|
77
89
|
const tool = outcome.tool;
|
|
78
90
|
const target = outcome.path || '';
|
|
79
|
-
if (
|
|
91
|
+
if (isCreativeMutation(outcome)) found.add('creative');
|
|
80
92
|
else if (tool === 'document_forge' || DOCUMENT_PATH.test(target)) found.add('document');
|
|
81
93
|
else if (CODE_MUTATORS.has(tool)) {
|
|
82
94
|
if (WEB_PATH.test(target)) found.add('web');
|
|
@@ -92,7 +104,7 @@ function after(outcomes: readonly ToolOutcome[], domain: VerificationDomain): re
|
|
|
92
104
|
if (!isMutation(outcome)) return false;
|
|
93
105
|
const target = outcome.path || '';
|
|
94
106
|
switch (domain) {
|
|
95
|
-
case 'creative': return
|
|
107
|
+
case 'creative': return isCreativeMutation(outcome);
|
|
96
108
|
case 'document': return outcome.tool === 'document_forge' || DOCUMENT_PATH.test(target);
|
|
97
109
|
case 'web': return CODE_MUTATORS.has(outcome.tool) && WEB_PATH.test(target);
|
|
98
110
|
case 'code': return CODE_MUTATORS.has(outcome.tool) && CODE_PATH.test(target);
|
|
@@ -112,7 +124,8 @@ function satisfied(domain: VerificationDomain, evidence: readonly ToolOutcome[])
|
|
|
112
124
|
return ok.some((outcome) => outcome.rendered === true);
|
|
113
125
|
case 'creative':
|
|
114
126
|
return ok.some((outcome) => outcome.observedImage === true
|
|
115
|
-
|| MEDIA_PROBE.test(outcome.command)
|
|
127
|
+
|| MEDIA_PROBE.test(outcome.command)
|
|
128
|
+
|| (outcome.tool === 'native_engine' && ['probe', 'inspect', 'verify', 'status'].includes(String(outcome.args?.action ?? '').toLowerCase())));
|
|
116
129
|
case 'document':
|
|
117
130
|
return ok.some((outcome) => outcome.observedImage === true
|
|
118
131
|
|| (['pdf_read', 'fs_read'].includes(outcome.tool) && DOCUMENT_PATH.test(outcome.path)));
|