@causyne/agent 1.20.7 → 1.20.9
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/acp/agentCatalog.js +9 -3
- package/src/acp/agentCatalog.ts +20 -4
- package/src/agentLoop.js +167 -34
- package/src/agentLoop.ts +188 -37
- package/src/commands.js +25 -10
- package/src/compiledSkills.js +7330 -319
- package/src/computerUse/types.js +8 -0
- package/src/computerUse/types.ts +121 -0
- package/src/computerUse/visionGrounding.js +87 -29
- package/src/computerUse/visionGrounding.ts +108 -36
- package/src/decisionPolicy.js +7 -9
- package/src/decisionPolicy.ts +7 -9
- package/src/documentEngine/antiSlopAuditor.js +13 -43
- package/src/documentEngine/antiSlopAuditor.ts +15 -47
- package/src/documentEngine/documentForge.js +3 -3
- package/src/documentEngine/documentForge.ts +3 -3
- package/src/dynamicCatalogue.js +568 -77
- package/src/dynamicCatalogue.ts +608 -79
- package/src/launchIntent.js +3 -3
- package/src/launchIntent.ts +3 -3
- package/src/planCache.js +4 -14
- package/src/planCache.ts +4 -14
- package/src/providers/acp.js +39 -4
- package/src/providers/acp.ts +42 -4
- package/src/providers/antigravity.d.ts +7 -1
- package/src/providers/antigravity.js +222 -34
- package/src/providers/antigravity.ts +220 -33
- package/src/providers/base.d.ts +2 -0
- package/src/providers/pi.js +3 -1
- package/src/providers/pi.ts +4 -2
- package/src/sandbox.js +7 -10
- package/src/smartToolsUse.js +203 -0
- package/src/smartToolsUse.ts +263 -0
- package/src/taskShape.js +7 -7
- package/src/taskShape.ts +7 -7
- package/src/toolPacks.js +5 -5
- package/src/tools/blenderAutomator.js +198 -11
- package/src/tools/documentForge.js +1 -1
- package/src/tools/documentForge.ts +1 -1
- package/src/tui/modelPicker.js +288 -69
- package/src/tui/modelPicker.ts +333 -72
|
@@ -234,37 +234,166 @@ export const blenderAct = {
|
|
|
234
234
|
}
|
|
235
235
|
else if (action.type === 'autoFrameCamera') {
|
|
236
236
|
{
|
|
237
|
-
const camCode = `import bpy, math
|
|
237
|
+
const camCode = `import bpy, math
|
|
238
|
+
cam = bpy.context.scene.camera
|
|
239
|
+
if not cam:
|
|
240
|
+
cd = bpy.data.cameras.new('Cam')
|
|
241
|
+
cam = bpy.data.objects.new('Cam', cd)
|
|
242
|
+
bpy.context.scene.collection.objects.link(cam)
|
|
243
|
+
bpy.context.scene.camera = cam
|
|
244
|
+
cam.location = (10, -10, 8)
|
|
245
|
+
cam.rotation_euler = (math.radians(50), 0, math.radians(45))
|
|
246
|
+
if hasattr(cam.data, "lens"):
|
|
247
|
+
cam.data.lens = ${action.focal_length || 65.0}
|
|
248
|
+
print('Headless 65mm camera framed at studio angle')`;
|
|
238
249
|
await runHeadlessCli(null, camCode, results);
|
|
239
250
|
}
|
|
240
251
|
}
|
|
241
252
|
else if (action.type === 'smartGeometry') {
|
|
242
253
|
{
|
|
243
|
-
const geomCode = `import bpy, math
|
|
254
|
+
const geomCode = `import bpy, math
|
|
255
|
+
target_name = ${JSON.stringify(action.name || "")}
|
|
256
|
+
targets = [bpy.data.objects.get(target_name)] if target_name else [o for o in bpy.context.scene.objects if o.type == 'MESH' and o.visible_get() and not any(k in o.name.lower() for k in ['floor', 'plane', 'backdrop', 'studio', 'ground', 'cove'])]
|
|
257
|
+
targets = [t for t in targets if t]
|
|
258
|
+
for o in targets:
|
|
259
|
+
if hasattr(o.data, "use_auto_smooth"):
|
|
260
|
+
o.data.use_auto_smooth = True
|
|
261
|
+
for p in o.data.polygons:
|
|
262
|
+
p.use_smooth = True
|
|
263
|
+
if not any(m.type == 'BEVEL' for m in o.modifiers):
|
|
264
|
+
bev = o.modifiers.new(name="StudioBevel", type='BEVEL')
|
|
265
|
+
bev.width = ${action.bevel_width || 0.015}
|
|
266
|
+
bev.segments = 3
|
|
267
|
+
bev.limit_method = 'ANGLE'
|
|
268
|
+
bev.angle_limit = math.radians(35)
|
|
269
|
+
if ${action.subsurf !== false} and not any(m.type == 'SUBSURF' for m in o.modifiers):
|
|
270
|
+
sub = o.modifiers.new(name="StudioSubsurf", type='SUBSURF')
|
|
271
|
+
sub.levels = 2
|
|
272
|
+
sub.render_levels = 2
|
|
273
|
+
print("Headless applied Studio Bevel and Subsurf")`;
|
|
244
274
|
await runHeadlessCli(null, geomCode, results);
|
|
245
275
|
}
|
|
246
276
|
}
|
|
247
277
|
else if (action.type === 'smartMaterial') {
|
|
248
278
|
{
|
|
249
|
-
const matCode = `import bpy, time
|
|
279
|
+
const matCode = `import bpy, time
|
|
280
|
+
preset = ${JSON.stringify(action.preset || "custom")}.lower()
|
|
281
|
+
target_name = ${JSON.stringify(action.name || "")}
|
|
282
|
+
targets = [bpy.data.objects.get(target_name)] if target_name else [o for o in bpy.context.scene.objects if o.type == 'MESH' and o.visible_get() and not any(k in o.name.lower() for k in ['floor', 'plane', 'backdrop', 'studio', 'ground', 'cove'])]
|
|
283
|
+
targets = [t for t in targets if t]
|
|
284
|
+
mat = bpy.data.materials.new(name=f"CausynePBR_{preset.capitalize()}_{int(time.time()*1000)%10000}")
|
|
285
|
+
mat.use_nodes = True
|
|
286
|
+
nodes = mat.node_tree.nodes
|
|
287
|
+
links = mat.node_tree.links
|
|
288
|
+
nodes.clear()
|
|
289
|
+
bsdf = nodes.new(type="ShaderNodeBsdfPrincipled")
|
|
290
|
+
bsdf.location = (0, 0)
|
|
291
|
+
out = nodes.new(type="ShaderNodeOutputMaterial")
|
|
292
|
+
out.location = (300, 0)
|
|
293
|
+
links.new(bsdf.outputs["BSDF"], out.inputs["Surface"])
|
|
294
|
+
if preset in ["gold", "gold_brushed", "aztec_gold"]:
|
|
295
|
+
bsdf.inputs["Base Color"].default_value = (1.0, 0.766, 0.336, 1.0)
|
|
296
|
+
bsdf.inputs["Metallic"].default_value = 1.0
|
|
297
|
+
bsdf.inputs["Roughness"].default_value = 0.18
|
|
298
|
+
elif preset in ["sandstone", "ancient_stone", "pyramid_stone"]:
|
|
299
|
+
bsdf.inputs["Base Color"].default_value = (0.68, 0.55, 0.40, 1.0)
|
|
300
|
+
bsdf.inputs["Roughness"].default_value = 0.85
|
|
301
|
+
elif preset in ["velvet", "cushion_velvet", "watch_cushion"]:
|
|
302
|
+
bsdf.inputs["Base Color"].default_value = (0.05, 0.06, 0.08, 1.0)
|
|
303
|
+
bsdf.inputs["Roughness"].default_value = 0.9
|
|
304
|
+
elif preset in ["chrome", "steel", "watch_case"]:
|
|
305
|
+
bsdf.inputs["Base Color"].default_value = (0.88, 0.89, 0.90, 1.0)
|
|
306
|
+
bsdf.inputs["Metallic"].default_value = 1.0
|
|
307
|
+
bsdf.inputs["Roughness"].default_value = 0.08
|
|
308
|
+
for o in targets:
|
|
309
|
+
if len(o.data.materials) == 0:
|
|
310
|
+
o.data.materials.append(mat)
|
|
311
|
+
else:
|
|
312
|
+
o.data.materials[0] = mat
|
|
313
|
+
print(f"Headless applied Smart PBR Material ({preset})")`;
|
|
250
314
|
await runHeadlessCli(null, matCode, results);
|
|
251
315
|
}
|
|
252
316
|
}
|
|
253
317
|
else if (action.type === 'cinematicAtmosphere') {
|
|
254
318
|
{
|
|
255
|
-
const atmoCode = `import bpy, math
|
|
319
|
+
const atmoCode = `import bpy, math
|
|
320
|
+
w = bpy.context.scene.world or bpy.data.worlds.new("CausyneWorld")
|
|
321
|
+
bpy.context.scene.world = w
|
|
322
|
+
w.use_nodes = True
|
|
323
|
+
nodes = w.node_tree.nodes
|
|
324
|
+
links = w.node_tree.links
|
|
325
|
+
nodes.clear()
|
|
326
|
+
bg = nodes.new("ShaderNodeBackground")
|
|
327
|
+
out = nodes.new("ShaderNodeOutputWorld")
|
|
328
|
+
sky = nodes.new("ShaderNodeTexSky")
|
|
329
|
+
sky.sky_type = 'MULTIPLE_SCATTERING' if hasattr(sky, 'sky_type') else 'HOSEK_WILKIE'
|
|
330
|
+
if hasattr(sky, 'sun_elevation'):
|
|
331
|
+
sky.sun_elevation = math.radians(${action.sun_elevation || 12.0})
|
|
332
|
+
sky.sun_rotation = math.radians(-45.0)
|
|
333
|
+
links.new(sky.outputs["Color"], bg.inputs["Color"])
|
|
334
|
+
links.new(bg.outputs["Background"], out.inputs["Surface"])
|
|
335
|
+
if ${action.volumetric_fog !== false}:
|
|
336
|
+
fm = bpy.data.materials.new("CausyneFog")
|
|
337
|
+
fm.use_nodes = True
|
|
338
|
+
fn = fm.node_tree.nodes
|
|
339
|
+
fl = fm.node_tree.links
|
|
340
|
+
fn.clear()
|
|
341
|
+
vol = fn.new("ShaderNodeVolumeScatter")
|
|
342
|
+
vol.inputs["Density"].default_value = ${action.fog_density || 0.015}
|
|
343
|
+
fo = fn.new("ShaderNodeOutputMaterial")
|
|
344
|
+
fl.new(vol.outputs["Volume"], fo.inputs["Volume"])
|
|
345
|
+
bpy.ops.mesh.primitive_cube_add(size=40.0, location=(0,0,10))
|
|
346
|
+
fb = bpy.context.active_object
|
|
347
|
+
fb.name = "CausyneAtmosphereVolume"
|
|
348
|
+
fb.display_type = 'WIRE'
|
|
349
|
+
fb.data.materials.append(fm)
|
|
350
|
+
print("Headless applied Cinematic Atmosphere (Nishita Sky + Volumetric Fog)")`;
|
|
256
351
|
await runHeadlessCli(null, atmoCode, results);
|
|
257
352
|
}
|
|
258
353
|
}
|
|
259
354
|
else if (action.type === 'smartGeoNodes') {
|
|
260
355
|
{
|
|
261
|
-
const gnCode = `import bpy
|
|
356
|
+
const gnCode = `import bpy
|
|
357
|
+
gen = ${JSON.stringify(action.generator || "masonry_brick_wall")}
|
|
358
|
+
targets = [o for o in bpy.context.scene.objects if o.type == 'MESH' and "Volume" not in o.name and "Floor" not in o.name]
|
|
359
|
+
for o in targets:
|
|
360
|
+
mod = o.modifiers.new(name=f"GeoNode_{gen}", type='NODES')
|
|
361
|
+
ng = bpy.data.node_groups.get(f"GN_{gen}")
|
|
362
|
+
if not ng:
|
|
363
|
+
ng = bpy.data.node_groups.new(f"GN_{gen}", 'GeometryNodeTree')
|
|
364
|
+
ng.interface.new_socket("Geometry", in_out='INPUT', socket_type='NodeSocketGeometry')
|
|
365
|
+
ng.interface.new_socket("Geometry", in_out='OUTPUT', socket_type='NodeSocketGeometry')
|
|
366
|
+
gi = ng.nodes.new('NodeGroupInput')
|
|
367
|
+
gi.location = (-400,0)
|
|
368
|
+
go = ng.nodes.new('NodeGroupOutput')
|
|
369
|
+
go.location = (400,0)
|
|
370
|
+
if gen == "masonry_brick_wall":
|
|
371
|
+
s = ng.nodes.new('GeometryNodeSubdivideMesh')
|
|
372
|
+
s.location = (-150,0)
|
|
373
|
+
s.inputs["Level"].default_value = ${action.subdivisions || 3}
|
|
374
|
+
ng.links.new(gi.outputs["Geometry"], s.inputs["Mesh"])
|
|
375
|
+
ng.links.new(s.outputs["Mesh"], go.inputs["Geometry"])
|
|
376
|
+
else:
|
|
377
|
+
ng.links.new(gi.outputs["Geometry"], go.inputs["Geometry"])
|
|
378
|
+
mod.node_group = ng
|
|
379
|
+
print(f"Headless attached Geometry Nodes ({gen})")`;
|
|
262
380
|
await runHeadlessCli(null, gnCode, results);
|
|
263
381
|
}
|
|
264
382
|
}
|
|
265
383
|
else if (action.type === 'setupStudioLighting') {
|
|
266
384
|
{
|
|
267
|
-
const lightCode = `import bpy, math
|
|
385
|
+
const lightCode = `import bpy, math
|
|
386
|
+
for o in list(bpy.context.scene.objects):
|
|
387
|
+
if o.type == 'LIGHT':
|
|
388
|
+
bpy.data.objects.remove(o, do_unlink=True)
|
|
389
|
+
kd = bpy.data.lights.new('Key', 'AREA')
|
|
390
|
+
kd.energy = ${action.key_energy || 800}
|
|
391
|
+
kd.size = 5.0
|
|
392
|
+
ko = bpy.data.objects.new('Key', kd)
|
|
393
|
+
ko.location = (6, -6, 8)
|
|
394
|
+
ko.rotation_euler = (math.radians(45), 0, math.radians(45))
|
|
395
|
+
bpy.context.scene.collection.objects.link(ko)
|
|
396
|
+
print('Headless studio lighting built')`;
|
|
268
397
|
await runHeadlessCli(null, lightCode, results);
|
|
269
398
|
}
|
|
270
399
|
}
|
|
@@ -274,14 +403,31 @@ export const blenderAct = {
|
|
|
274
403
|
const fmts = action.formats || ['blend', 'glb'];
|
|
275
404
|
|
|
276
405
|
{
|
|
277
|
-
const exportCode = `import bpy, os
|
|
406
|
+
const exportCode = `import bpy, os
|
|
407
|
+
d = "${destDir}"
|
|
408
|
+
os.makedirs(d, exist_ok=True)
|
|
409
|
+
if "blend" in ${JSON.stringify(fmts)}:
|
|
410
|
+
bpy.ops.wm.save_as_mainfile(filepath=os.path.join(d, "${prefix}.blend"))
|
|
411
|
+
if "glb" in ${JSON.stringify(fmts)}:
|
|
412
|
+
bpy.ops.export_scene.gltf(filepath=os.path.join(d, "${prefix}.glb"), export_format="GLB")
|
|
413
|
+
if "obj" in ${JSON.stringify(fmts)}:
|
|
414
|
+
if hasattr(bpy.ops.wm, "obj_export"):
|
|
415
|
+
bpy.ops.wm.obj_export(filepath=os.path.join(d, "${prefix}.obj"))
|
|
416
|
+
else:
|
|
417
|
+
bpy.ops.export_scene.obj(filepath=os.path.join(d, "${prefix}.obj"))
|
|
418
|
+
print(f"Headless exported formats to {d}")`;
|
|
278
419
|
await runHeadlessCli(null, exportCode, results);
|
|
279
420
|
}
|
|
280
421
|
}
|
|
281
422
|
else if (action.type === 'clearScene') {
|
|
282
423
|
const keep = action.keep_lights_camera !== false;
|
|
283
424
|
{
|
|
284
|
-
const clearCode = `import bpy
|
|
425
|
+
const clearCode = `import bpy
|
|
426
|
+
for o in list(bpy.context.scene.objects):
|
|
427
|
+
if ${keep} and o.type in ['CAMERA', 'LIGHT']:
|
|
428
|
+
continue
|
|
429
|
+
bpy.data.objects.remove(o, do_unlink=True)
|
|
430
|
+
print("Headless cleared scene meshes")`;
|
|
285
431
|
await runHeadlessCli(null, clearCode, results);
|
|
286
432
|
}
|
|
287
433
|
}
|
|
@@ -306,7 +452,10 @@ export const blenderAct = {
|
|
|
306
452
|
else if (action.type === 'captureViewport') {
|
|
307
453
|
const targetPath = action.filepath || path.join(getWorkspaceTempDir(), `causyne_3d_preview_${Date.now()}.png`);
|
|
308
454
|
{
|
|
309
|
-
const captureCode = `import bpy, os
|
|
455
|
+
const captureCode = `import bpy, os
|
|
456
|
+
os.makedirs(os.path.dirname("${targetPath}"), exist_ok=True)
|
|
457
|
+
bpy.ops.render.opengl(write_still=True, filepath="${targetPath}")
|
|
458
|
+
print("Captured headless viewport to ${targetPath}")`;
|
|
310
459
|
try {
|
|
311
460
|
await runHeadlessCli(null, captureCode, results);
|
|
312
461
|
} catch (cliErr) {
|
|
@@ -322,8 +471,46 @@ export const blenderAct = {
|
|
|
322
471
|
|
|
323
472
|
{
|
|
324
473
|
const renderCode = isAnimation ?
|
|
325
|
-
`import bpy, os, time
|
|
326
|
-
|
|
474
|
+
`import bpy, os, time
|
|
475
|
+
os.makedirs(os.path.dirname("${targetPath}"), exist_ok=True)
|
|
476
|
+
bpy.context.scene.frame_start = ${startFrame}
|
|
477
|
+
bpy.context.scene.frame_end = ${endFrame}
|
|
478
|
+
if "${action.engine || ''}":
|
|
479
|
+
bpy.context.scene.render.engine = "${action.engine || ''}"
|
|
480
|
+
try:
|
|
481
|
+
bpy.context.scene.render.filepath = "${targetPath}"
|
|
482
|
+
bpy.context.scene.render.image_settings.file_format = 'FFMPEG'
|
|
483
|
+
if hasattr(bpy.context.scene.render, 'ffmpeg'):
|
|
484
|
+
bpy.context.scene.render.ffmpeg.format = 'MPEG4' if "${targetPath}".lower().endsWith('.mp4') else 'MKV'
|
|
485
|
+
bpy.context.scene.render.ffmpeg.codec = 'H264'
|
|
486
|
+
bpy.ops.render.render(animation=True)
|
|
487
|
+
print(f"Rendered MP4 animation directly to ${targetPath}")
|
|
488
|
+
except Exception:
|
|
489
|
+
import subprocess, shutil as sh_util
|
|
490
|
+
td = os.path.join(os.path.dirname("${targetPath}"), ".causyne_temp_frames_" + str(int(time.time())))
|
|
491
|
+
os.makedirs(td, exist_ok=True)
|
|
492
|
+
bpy.context.scene.render.image_settings.file_format = 'PNG'
|
|
493
|
+
bpy.context.scene.render.filepath = os.path.join(td, "frame_")
|
|
494
|
+
bpy.ops.render.render(animation=True)
|
|
495
|
+
fps = getattr(bpy.context.scene.render, "fps", 30)
|
|
496
|
+
fb = sh_util.which("ffmpeg")
|
|
497
|
+
if not fb:
|
|
498
|
+
for cand in ["/opt/homebrew/bin/ffmpeg", "/usr/local/bin/ffmpeg", "C:\\\\Program Files\\\\ffmpeg\\\\bin\\\\ffmpeg.exe"]:
|
|
499
|
+
if os.path.exists(cand):
|
|
500
|
+
fb = cand
|
|
501
|
+
break
|
|
502
|
+
if not fb:
|
|
503
|
+
fb = "ffmpeg"
|
|
504
|
+
subprocess.run([fb, "-y", "-framerate", str(fps), "-i", os.path.join(td, "frame_%04d.png"), "-c:v", "libx264", "-pix_fmt", "yuv420p", "${targetPath}"], check=True)
|
|
505
|
+
sh_util.rmtree(td, ignore_errors=True)
|
|
506
|
+
print(f"Rendered MP4 animation via sequence to ${targetPath}")` :
|
|
507
|
+
`import bpy, os
|
|
508
|
+
os.makedirs(os.path.dirname("${targetPath}"), exist_ok=True)
|
|
509
|
+
bpy.context.scene.render.filepath = "${targetPath}"
|
|
510
|
+
if "${action.engine || ''}":
|
|
511
|
+
bpy.context.scene.render.engine = "${action.engine || ''}"
|
|
512
|
+
bpy.ops.render.render(write_still=True)
|
|
513
|
+
print(f"Rendered still frame to ${targetPath}")`;
|
|
327
514
|
try {
|
|
328
515
|
await runHeadlessCli(null, renderCode, results);
|
|
329
516
|
} catch (cliErr) {
|
|
@@ -15,7 +15,7 @@ import { resolveUserPath } from '../utils/paths.js';
|
|
|
15
15
|
export const documentForgeTool = {
|
|
16
16
|
schema: {
|
|
17
17
|
name: 'document_forge',
|
|
18
|
-
description: 'Causyne Document Forge: Professional document & media production harness. Generates pixel-perfect A4/Letter publications via HTML/CSS-First Paged Media and Headless Chrome, renders vector PDFs (<2MB compliant), extracts page images for visual QA ("
|
|
18
|
+
description: 'Causyne Document Forge: Professional document & media production harness. Generates pixel-perfect A4/Letter publications via HTML/CSS-First Paged Media and Headless Chrome, renders vector PDFs (<2MB compliant), extracts page images for visual QA ("Inspect Results"), audits anti-slop and math integrity, formats Hollywood Courier 12pt screenplays, creates production shot lists, and times VO narration.',
|
|
19
19
|
parameters: {
|
|
20
20
|
type: 'object',
|
|
21
21
|
properties: {
|
|
@@ -55,7 +55,7 @@ export interface DocumentForgeArgs {
|
|
|
55
55
|
export const documentForgeTool = {
|
|
56
56
|
schema: {
|
|
57
57
|
name: 'document_forge',
|
|
58
|
-
description: 'Causyne Document Forge: Professional document & media production harness. Generates pixel-perfect A4/Letter publications via HTML/CSS-First Paged Media and Headless Chrome, renders vector PDFs (<2MB compliant), extracts page images for visual QA ("
|
|
58
|
+
description: 'Causyne Document Forge: Professional document & media production harness. Generates pixel-perfect A4/Letter publications via HTML/CSS-First Paged Media and Headless Chrome, renders vector PDFs (<2MB compliant), extracts page images for visual QA ("Inspect Results"), audits anti-slop and math integrity, formats Hollywood Courier 12pt screenplays, creates production shot lists, and times VO narration.',
|
|
59
59
|
parameters: {
|
|
60
60
|
type: 'object',
|
|
61
61
|
properties: {
|