@causyne/agent 1.12.0 → 1.13.0
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/docs/THIRD_PARTY_NOTICES.md +1 -1
- package/package.json +2 -2
- package/src/engines/deck.js +105 -0
- package/src/engines/deck.ts +109 -0
- package/src/engines/design.js +123 -0
- package/src/engines/design.ts +141 -0
- package/src/engines/effect.js +128 -0
- package/src/engines/effect.ts +142 -0
- package/src/engines/grid.js +106 -0
- package/src/engines/grid.ts +121 -0
- package/src/engines/light.js +107 -0
- package/src/engines/light.ts +122 -0
- package/src/engines/pdf.js +108 -0
- package/src/engines/pdf.ts +124 -0
- package/src/engines/registry.js +15 -1
- package/src/engines/registry.ts +15 -1
- package/src/engines/word.js +112 -0
- package/src/engines/word.ts +127 -0
|
@@ -105,7 +105,7 @@ contain adaptations from upstream open-source work:
|
|
|
105
105
|
> SOFTWARE.
|
|
106
106
|
|
|
107
107
|
The native creative engines operated via `src/tools/nativeEngine.ts` and `src/engines/`
|
|
108
|
-
power **Causyne Native Engines** (including **Causyne Film Engine**, **Causyne Photo Engine**, **Causyne Sound Engine**, and **Causyne
|
|
108
|
+
power **Causyne Native Engines** (including **Causyne Film Engine**, **Causyne Photo Engine**, **Causyne Sound Engine**, **Causyne CAD Engine**, **Causyne Deck Engine**, **Causyne Design Engine**, **Causyne Word Engine**, **Causyne Grid Engine**, **Causyne Light Engine**, **Causyne PDF Engine**, and **Causyne Effect Engine**).
|
|
109
109
|
They execute as external headless engine binaries installed into the user's sovereign
|
|
110
110
|
`~/.causyne/engines/` directory with explicit user consent and are not bundled into
|
|
111
111
|
Causyne Agent's npm package.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@causyne/agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Agentic AI for software, tools, and computer workflows",
|
|
5
5
|
"main": "bin/causyne.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"start": "node ./bin/causyne.js",
|
|
25
|
-
"test": "node --test --import ./tests/helpers/isolateState.js \"tests/**/*.test.js\"",
|
|
25
|
+
"test": "node --test --import ./tests/helpers/isolateState.js \"tests/**/*.test.{js,ts}\"",
|
|
26
26
|
"build": "node scripts/compile_skills.js && tsc -p tsconfig.runtime.json",
|
|
27
27
|
"benchmark:plan-cache": "node src/benchmarks/planCache.js",
|
|
28
28
|
"check:release": "node scripts/check_release.js",
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
const TIMEOUTS = {
|
|
3
|
+
status: 10_000,
|
|
4
|
+
catalog: 30_000,
|
|
5
|
+
describe: 20_000,
|
|
6
|
+
inspect: 60_000,
|
|
7
|
+
execute: 180_000,
|
|
8
|
+
batch: 600_000,
|
|
9
|
+
export: 300_000,
|
|
10
|
+
render: 120_000,
|
|
11
|
+
probe: 60_000,
|
|
12
|
+
install: 600_000
|
|
13
|
+
};
|
|
14
|
+
function positional(value) {
|
|
15
|
+
return value.startsWith('-') ? `.${path.sep}${value}` : value;
|
|
16
|
+
}
|
|
17
|
+
function sourceArgs(context) {
|
|
18
|
+
if (context.demo)
|
|
19
|
+
return ['--sample'];
|
|
20
|
+
if (context.project)
|
|
21
|
+
return ['--in', positional(context.project)];
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
function saveArgs(context) {
|
|
25
|
+
if (context.saveAs)
|
|
26
|
+
return { args: ['--save', positional(context.saveAs)], artifact: context.saveAs };
|
|
27
|
+
if (context.save && context.project)
|
|
28
|
+
return { args: ['--save', positional(context.project)], artifact: context.project };
|
|
29
|
+
return { args: [] };
|
|
30
|
+
}
|
|
31
|
+
function commandArgs(steps) {
|
|
32
|
+
const args = [];
|
|
33
|
+
for (const step of steps) {
|
|
34
|
+
args.push('--cmd', step.params && Object.keys(step.params).length > 0 ? `${step.id}=${JSON.stringify(step.params)}` : step.id);
|
|
35
|
+
}
|
|
36
|
+
return args;
|
|
37
|
+
}
|
|
38
|
+
export const deckEngine = {
|
|
39
|
+
id: 'deck',
|
|
40
|
+
label: 'Causyne Deck Engine',
|
|
41
|
+
envVar: 'CAUSYNE_ENGINE_DECK',
|
|
42
|
+
binaryName: 'causyne-engine-deck',
|
|
43
|
+
actions: ['catalog', 'describe', 'inspect', 'execute', 'batch', 'export', 'render', 'probe'],
|
|
44
|
+
invoke(request, context) {
|
|
45
|
+
let args;
|
|
46
|
+
let artifacts = [];
|
|
47
|
+
switch (request.action) {
|
|
48
|
+
case 'status':
|
|
49
|
+
args = ['--version'];
|
|
50
|
+
break;
|
|
51
|
+
case 'catalog':
|
|
52
|
+
args = ['commands', ...(request.query ? [request.query] : [])];
|
|
53
|
+
break;
|
|
54
|
+
case 'describe':
|
|
55
|
+
args = ['describe', '--json', request.command ?? ''];
|
|
56
|
+
break;
|
|
57
|
+
case 'inspect': {
|
|
58
|
+
if (context.project) {
|
|
59
|
+
args = ['info', positional(context.project)];
|
|
60
|
+
}
|
|
61
|
+
else if (context.demo) {
|
|
62
|
+
args = ['exec', '--sample', 'document.inspect'];
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
throw new Error('inspect requires project or demo');
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
case 'probe':
|
|
70
|
+
args = ['info', positional(request.query ?? '')];
|
|
71
|
+
break;
|
|
72
|
+
case 'execute': {
|
|
73
|
+
const out = saveArgs(context);
|
|
74
|
+
args = ['exec', ...sourceArgs(context), ...out.args, request.command ?? '', JSON.stringify(request.params ?? {})];
|
|
75
|
+
if (context.keepGoing)
|
|
76
|
+
throw new Error('The deck engine stops at the first failed command; keepGoing is not supported');
|
|
77
|
+
if (out.artifact)
|
|
78
|
+
artifacts = [out.artifact];
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
case 'batch': {
|
|
82
|
+
const out = saveArgs(context);
|
|
83
|
+
args = ['run', ...sourceArgs(context), ...commandArgs(request.steps ?? []), ...out.args, '--json'];
|
|
84
|
+
if (context.keepGoing)
|
|
85
|
+
throw new Error('The deck engine stops at the first failed command; keepGoing is not supported');
|
|
86
|
+
if (out.artifact)
|
|
87
|
+
artifacts = [out.artifact];
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
case 'export':
|
|
91
|
+
args = ['convert', positional(context.project ?? ''), positional(request.output ?? '')];
|
|
92
|
+
artifacts = [request.output ?? ''];
|
|
93
|
+
break;
|
|
94
|
+
case 'render': {
|
|
95
|
+
const slide = Math.max(0, Math.trunc(request.seconds ?? 0));
|
|
96
|
+
args = ['render', ...sourceArgs(context), '--slide', String(slide), ...(request.scale !== undefined ? ['--scale', String(request.scale)] : []), positional(request.output ?? '')];
|
|
97
|
+
artifacts = [request.output ?? ''];
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
default:
|
|
101
|
+
throw new Error(`Unsupported deck engine action: ${request.action}`);
|
|
102
|
+
}
|
|
103
|
+
return { args, artifacts: artifacts.filter(Boolean), timeoutMs: TIMEOUTS[request.action] };
|
|
104
|
+
}
|
|
105
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import type {
|
|
3
|
+
NativeEngineAction,
|
|
4
|
+
NativeEngineAdapter,
|
|
5
|
+
NativeEngineContext,
|
|
6
|
+
NativeEngineInvocation,
|
|
7
|
+
NativeEngineRequest,
|
|
8
|
+
NativeEngineStep
|
|
9
|
+
} from './types.js';
|
|
10
|
+
|
|
11
|
+
const TIMEOUTS: Record<NativeEngineAction, number> = {
|
|
12
|
+
status: 10_000,
|
|
13
|
+
catalog: 30_000,
|
|
14
|
+
describe: 20_000,
|
|
15
|
+
inspect: 60_000,
|
|
16
|
+
execute: 180_000,
|
|
17
|
+
batch: 600_000,
|
|
18
|
+
export: 300_000,
|
|
19
|
+
render: 120_000,
|
|
20
|
+
probe: 60_000,
|
|
21
|
+
install: 600_000
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function positional(value: string): string {
|
|
25
|
+
return value.startsWith('-') ? `.${path.sep}${value}` : value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function sourceArgs(context: NativeEngineContext): string[] {
|
|
29
|
+
if (context.demo) return ['--sample'];
|
|
30
|
+
if (context.project) return ['--in', positional(context.project)];
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function saveArgs(context: NativeEngineContext): { args: string[]; artifact?: string } {
|
|
35
|
+
if (context.saveAs) return { args: ['--save', positional(context.saveAs)], artifact: context.saveAs };
|
|
36
|
+
if (context.save && context.project) return { args: ['--save', positional(context.project)], artifact: context.project };
|
|
37
|
+
return { args: [] };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function commandArgs(steps: NativeEngineStep[]): string[] {
|
|
41
|
+
const args: string[] = [];
|
|
42
|
+
for (const step of steps) {
|
|
43
|
+
args.push('--cmd', step.params && Object.keys(step.params).length > 0 ? `${step.id}=${JSON.stringify(step.params)}` : step.id);
|
|
44
|
+
}
|
|
45
|
+
return args;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const deckEngine: NativeEngineAdapter = {
|
|
49
|
+
id: 'deck',
|
|
50
|
+
label: 'Causyne Deck Engine',
|
|
51
|
+
envVar: 'CAUSYNE_ENGINE_DECK',
|
|
52
|
+
binaryName: 'causyne-engine-deck',
|
|
53
|
+
actions: ['catalog', 'describe', 'inspect', 'execute', 'batch', 'export', 'render', 'probe'],
|
|
54
|
+
invoke(request: NativeEngineRequest, context: NativeEngineContext): NativeEngineInvocation {
|
|
55
|
+
let args: string[];
|
|
56
|
+
let artifacts: string[] = [];
|
|
57
|
+
switch (request.action) {
|
|
58
|
+
case 'status':
|
|
59
|
+
args = ['--version'];
|
|
60
|
+
break;
|
|
61
|
+
case 'catalog':
|
|
62
|
+
args = ['commands', ...(request.query ? [request.query] : [])];
|
|
63
|
+
break;
|
|
64
|
+
case 'describe':
|
|
65
|
+
args = ['describe', '--json', request.command ?? ''];
|
|
66
|
+
break;
|
|
67
|
+
case 'inspect': {
|
|
68
|
+
if (context.project) {
|
|
69
|
+
args = ['info', positional(context.project)];
|
|
70
|
+
} else if (context.demo) {
|
|
71
|
+
args = ['exec', '--sample', 'document.inspect'];
|
|
72
|
+
} else {
|
|
73
|
+
throw new Error('inspect requires project or demo');
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case 'probe':
|
|
78
|
+
args = ['info', positional(request.query ?? '')];
|
|
79
|
+
break;
|
|
80
|
+
case 'execute': {
|
|
81
|
+
const out = saveArgs(context);
|
|
82
|
+
args = ['exec', ...sourceArgs(context), ...out.args, request.command ?? '', JSON.stringify(request.params ?? {})];
|
|
83
|
+
if (context.keepGoing) throw new Error('The deck engine stops at the first failed command; keepGoing is not supported');
|
|
84
|
+
if (out.artifact) artifacts = [out.artifact];
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
case 'batch': {
|
|
88
|
+
const out = saveArgs(context);
|
|
89
|
+
args = ['run', ...sourceArgs(context), ...commandArgs(request.steps ?? []), ...out.args, '--json'];
|
|
90
|
+
if (context.keepGoing) throw new Error('The deck engine stops at the first failed command; keepGoing is not supported');
|
|
91
|
+
if (out.artifact) artifacts = [out.artifact];
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
case 'export':
|
|
95
|
+
args = ['convert', positional(context.project ?? ''), positional(request.output ?? '')];
|
|
96
|
+
artifacts = [request.output ?? ''];
|
|
97
|
+
break;
|
|
98
|
+
case 'render': {
|
|
99
|
+
const slide = Math.max(0, Math.trunc(request.seconds ?? 0));
|
|
100
|
+
args = ['render', ...sourceArgs(context), '--slide', String(slide), ...(request.scale !== undefined ? ['--scale', String(request.scale)] : []), positional(request.output ?? '')];
|
|
101
|
+
artifacts = [request.output ?? ''];
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
default:
|
|
105
|
+
throw new Error(`Unsupported deck engine action: ${request.action}`);
|
|
106
|
+
}
|
|
107
|
+
return { args, artifacts: artifacts.filter(Boolean), timeoutMs: TIMEOUTS[request.action] };
|
|
108
|
+
}
|
|
109
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
// Multi-page layout, vector illustration, and publication engine for Causyne Agent.
|
|
3
|
+
// Headless document composer, IDML/ePub/PDF/SVG/PNG renderer, and batch pipeline.
|
|
4
|
+
// Operates deterministically via clean CLI subcommands.
|
|
5
|
+
const TIMEOUTS = {
|
|
6
|
+
status: 10_000,
|
|
7
|
+
catalog: 30_000,
|
|
8
|
+
describe: 30_000,
|
|
9
|
+
inspect: 60_000,
|
|
10
|
+
execute: 180_000,
|
|
11
|
+
batch: 600_000,
|
|
12
|
+
export: 300_000,
|
|
13
|
+
render: 300_000,
|
|
14
|
+
probe: 60_000,
|
|
15
|
+
install: 600_000
|
|
16
|
+
};
|
|
17
|
+
function positional(value) {
|
|
18
|
+
return value.startsWith('-') ? `.${path.sep}${value}` : value;
|
|
19
|
+
}
|
|
20
|
+
function requireProject(context, action) {
|
|
21
|
+
if (!context.project)
|
|
22
|
+
throw new Error(`${action} requires project`);
|
|
23
|
+
return positional(context.project);
|
|
24
|
+
}
|
|
25
|
+
function commandArgs(steps) {
|
|
26
|
+
const args = [];
|
|
27
|
+
for (const step of steps) {
|
|
28
|
+
if (step.params && Object.keys(step.params).length > 0) {
|
|
29
|
+
args.push('--cmd', `${step.id}=${JSON.stringify(step.params)}`);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
args.push('--cmd', step.id);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return args;
|
|
36
|
+
}
|
|
37
|
+
export const designEngine = {
|
|
38
|
+
id: 'design',
|
|
39
|
+
label: 'Causyne Design Engine',
|
|
40
|
+
envVar: 'CAUSYNE_ENGINE_DESIGN',
|
|
41
|
+
binaryName: 'causyne-engine-design',
|
|
42
|
+
actions: ['catalog', 'describe', 'inspect', 'execute', 'batch', 'export', 'render', 'probe'],
|
|
43
|
+
invoke(request, context) {
|
|
44
|
+
let args;
|
|
45
|
+
let artifacts = [];
|
|
46
|
+
switch (request.action) {
|
|
47
|
+
case 'status':
|
|
48
|
+
args = ['--version'];
|
|
49
|
+
break;
|
|
50
|
+
case 'catalog':
|
|
51
|
+
args = ['commands', ...(request.query ? [request.query] : [])];
|
|
52
|
+
break;
|
|
53
|
+
case 'describe':
|
|
54
|
+
args = ['describe', request.command ?? ''];
|
|
55
|
+
break;
|
|
56
|
+
case 'inspect':
|
|
57
|
+
case 'probe': {
|
|
58
|
+
const file = request.action === 'inspect' ? requireProject(context, 'inspect') : positional(request.query ?? '');
|
|
59
|
+
args = ['run', '--in', file, '--export', '/dev/null'];
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
case 'execute':
|
|
63
|
+
case 'batch': {
|
|
64
|
+
const steps = request.action === 'execute'
|
|
65
|
+
? [{ id: request.command ?? '', ...(request.params ? { params: request.params } : {}) }]
|
|
66
|
+
: (request.steps ?? []);
|
|
67
|
+
args = ['run'];
|
|
68
|
+
if (context.project) {
|
|
69
|
+
args.push('--in', positional(context.project));
|
|
70
|
+
}
|
|
71
|
+
else if (context.demo) {
|
|
72
|
+
args.push('--sample');
|
|
73
|
+
}
|
|
74
|
+
args.push(...commandArgs(steps));
|
|
75
|
+
if (context.saveAs) {
|
|
76
|
+
args.push('--export', context.saveAs);
|
|
77
|
+
artifacts.push(context.saveAs);
|
|
78
|
+
}
|
|
79
|
+
else if (context.save && context.project) {
|
|
80
|
+
args.push('--export', context.project);
|
|
81
|
+
artifacts.push(context.project);
|
|
82
|
+
}
|
|
83
|
+
if (request.output) {
|
|
84
|
+
args.push('--export', request.output);
|
|
85
|
+
artifacts.push(request.output);
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
case 'export': {
|
|
90
|
+
const output = request.output ?? '';
|
|
91
|
+
args = ['run', '--in', requireProject(context, 'export'), '--export', positional(output)];
|
|
92
|
+
artifacts = [output];
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
case 'render': {
|
|
96
|
+
const output = request.output ?? '';
|
|
97
|
+
args = ['run'];
|
|
98
|
+
if (context.project) {
|
|
99
|
+
args.push('--in', positional(context.project));
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
args.push('--sample');
|
|
103
|
+
}
|
|
104
|
+
if (request.range) {
|
|
105
|
+
args.push('--page', request.range);
|
|
106
|
+
}
|
|
107
|
+
if (request.scale !== undefined) {
|
|
108
|
+
args.push('--scale', String(request.scale));
|
|
109
|
+
}
|
|
110
|
+
args.push('--export', positional(output));
|
|
111
|
+
artifacts = [output];
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
default:
|
|
115
|
+
throw new Error(`Unsupported design engine action: ${request.action}`);
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
args,
|
|
119
|
+
artifacts,
|
|
120
|
+
timeoutMs: TIMEOUTS[request.action] ?? 60_000
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import type {
|
|
3
|
+
NativeEngineAction,
|
|
4
|
+
NativeEngineAdapter,
|
|
5
|
+
NativeEngineContext,
|
|
6
|
+
NativeEngineInvocation,
|
|
7
|
+
NativeEngineRequest,
|
|
8
|
+
NativeEngineStep
|
|
9
|
+
} from './types.js';
|
|
10
|
+
|
|
11
|
+
// Multi-page layout, vector illustration, and publication engine for Causyne Agent.
|
|
12
|
+
// Headless document composer, IDML/ePub/PDF/SVG/PNG renderer, and batch pipeline.
|
|
13
|
+
// Operates deterministically via clean CLI subcommands.
|
|
14
|
+
|
|
15
|
+
const TIMEOUTS: Record<NativeEngineAction, number> = {
|
|
16
|
+
status: 10_000,
|
|
17
|
+
catalog: 30_000,
|
|
18
|
+
describe: 30_000,
|
|
19
|
+
inspect: 60_000,
|
|
20
|
+
execute: 180_000,
|
|
21
|
+
batch: 600_000,
|
|
22
|
+
export: 300_000,
|
|
23
|
+
render: 300_000,
|
|
24
|
+
probe: 60_000,
|
|
25
|
+
install: 600_000
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function positional(value: string): string {
|
|
29
|
+
return value.startsWith('-') ? `.${path.sep}${value}` : value;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function requireProject(context: NativeEngineContext, action: string): string {
|
|
33
|
+
if (!context.project) throw new Error(`${action} requires project`);
|
|
34
|
+
return positional(context.project);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function commandArgs(steps: NativeEngineStep[]): string[] {
|
|
38
|
+
const args: string[] = [];
|
|
39
|
+
for (const step of steps) {
|
|
40
|
+
if (step.params && Object.keys(step.params).length > 0) {
|
|
41
|
+
args.push('--cmd', `${step.id}=${JSON.stringify(step.params)}`);
|
|
42
|
+
} else {
|
|
43
|
+
args.push('--cmd', step.id);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return args;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const designEngine: NativeEngineAdapter = {
|
|
50
|
+
id: 'design',
|
|
51
|
+
label: 'Causyne Design Engine',
|
|
52
|
+
envVar: 'CAUSYNE_ENGINE_DESIGN',
|
|
53
|
+
binaryName: 'causyne-engine-design',
|
|
54
|
+
actions: ['catalog', 'describe', 'inspect', 'execute', 'batch', 'export', 'render', 'probe'],
|
|
55
|
+
invoke(request: NativeEngineRequest, context: NativeEngineContext): NativeEngineInvocation {
|
|
56
|
+
let args: string[];
|
|
57
|
+
let artifacts: string[] = [];
|
|
58
|
+
|
|
59
|
+
switch (request.action) {
|
|
60
|
+
case 'status':
|
|
61
|
+
args = ['--version'];
|
|
62
|
+
break;
|
|
63
|
+
case 'catalog':
|
|
64
|
+
args = ['commands', ...(request.query ? [request.query] : [])];
|
|
65
|
+
break;
|
|
66
|
+
case 'describe':
|
|
67
|
+
args = ['describe', request.command ?? ''];
|
|
68
|
+
break;
|
|
69
|
+
case 'inspect':
|
|
70
|
+
case 'probe': {
|
|
71
|
+
const file = request.action === 'inspect' ? requireProject(context, 'inspect') : positional(request.query ?? '');
|
|
72
|
+
args = ['run', '--in', file, '--export', '/dev/null'];
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
case 'execute':
|
|
76
|
+
case 'batch': {
|
|
77
|
+
const steps: NativeEngineStep[] = request.action === 'execute'
|
|
78
|
+
? [{ id: request.command ?? '', ...(request.params ? { params: request.params } : {}) }]
|
|
79
|
+
: (request.steps ?? []);
|
|
80
|
+
|
|
81
|
+
args = ['run'];
|
|
82
|
+
if (context.project) {
|
|
83
|
+
args.push('--in', positional(context.project));
|
|
84
|
+
} else if (context.demo) {
|
|
85
|
+
args.push('--sample');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
args.push(...commandArgs(steps));
|
|
89
|
+
|
|
90
|
+
if (context.saveAs) {
|
|
91
|
+
args.push('--export', context.saveAs);
|
|
92
|
+
artifacts.push(context.saveAs);
|
|
93
|
+
} else if (context.save && context.project) {
|
|
94
|
+
args.push('--export', context.project);
|
|
95
|
+
artifacts.push(context.project);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (request.output) {
|
|
99
|
+
args.push('--export', request.output);
|
|
100
|
+
artifacts.push(request.output);
|
|
101
|
+
}
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
case 'export': {
|
|
105
|
+
const output = request.output ?? '';
|
|
106
|
+
args = ['run', '--in', requireProject(context, 'export'), '--export', positional(output)];
|
|
107
|
+
artifacts = [output];
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
case 'render': {
|
|
111
|
+
const output = request.output ?? '';
|
|
112
|
+
args = ['run'];
|
|
113
|
+
if (context.project) {
|
|
114
|
+
args.push('--in', positional(context.project));
|
|
115
|
+
} else {
|
|
116
|
+
args.push('--sample');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (request.range) {
|
|
120
|
+
args.push('--page', request.range);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (request.scale !== undefined) {
|
|
124
|
+
args.push('--scale', String(request.scale));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
args.push('--export', positional(output));
|
|
128
|
+
artifacts = [output];
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
default:
|
|
132
|
+
throw new Error(`Unsupported design engine action: ${request.action}`);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
args,
|
|
137
|
+
artifacts,
|
|
138
|
+
timeoutMs: TIMEOUTS[request.action] ?? 60_000
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
// Visual effects, motion graphics, compositing, and layer animation engine for Causyne Agent.
|
|
3
|
+
// Headless After Effects-class compositor, frame renderer, sequence exporter, and property evaluator.
|
|
4
|
+
// Operates deterministically via clean CLI subcommands.
|
|
5
|
+
const TIMEOUTS = {
|
|
6
|
+
status: 10_000,
|
|
7
|
+
catalog: 30_000,
|
|
8
|
+
describe: 30_000,
|
|
9
|
+
inspect: 60_000,
|
|
10
|
+
execute: 180_000,
|
|
11
|
+
batch: 600_000,
|
|
12
|
+
export: 300_000,
|
|
13
|
+
render: 300_000,
|
|
14
|
+
probe: 60_000,
|
|
15
|
+
install: 600_000
|
|
16
|
+
};
|
|
17
|
+
function positional(value) {
|
|
18
|
+
return value.startsWith('-') ? `.${path.sep}${value}` : value;
|
|
19
|
+
}
|
|
20
|
+
function requireProject(context, action) {
|
|
21
|
+
if (!context.project)
|
|
22
|
+
throw new Error(`${action} requires project`);
|
|
23
|
+
return positional(context.project);
|
|
24
|
+
}
|
|
25
|
+
function commandArgs(steps) {
|
|
26
|
+
const args = [];
|
|
27
|
+
for (const step of steps) {
|
|
28
|
+
args.push(step.id);
|
|
29
|
+
args.push(step.params && Object.keys(step.params).length > 0 ? JSON.stringify(step.params) : '{}');
|
|
30
|
+
}
|
|
31
|
+
return args;
|
|
32
|
+
}
|
|
33
|
+
export const effectEngine = {
|
|
34
|
+
id: 'effect',
|
|
35
|
+
label: 'Causyne Effect Engine',
|
|
36
|
+
envVar: 'CAUSYNE_ENGINE_EFFECT',
|
|
37
|
+
binaryName: 'causyne-engine-effect',
|
|
38
|
+
actions: ['catalog', 'describe', 'inspect', 'execute', 'batch', 'export', 'render', 'probe'],
|
|
39
|
+
invoke(request, context) {
|
|
40
|
+
let args;
|
|
41
|
+
let artifacts = [];
|
|
42
|
+
switch (request.action) {
|
|
43
|
+
case 'status':
|
|
44
|
+
args = ['info', '--json'];
|
|
45
|
+
break;
|
|
46
|
+
case 'catalog':
|
|
47
|
+
args = ['commands', '--json'];
|
|
48
|
+
break;
|
|
49
|
+
case 'describe':
|
|
50
|
+
args = ['commands', '--json', ...(request.command ? ['--filter', request.command] : [])];
|
|
51
|
+
break;
|
|
52
|
+
case 'inspect': {
|
|
53
|
+
args = ['info', '--json'];
|
|
54
|
+
if (context.project) {
|
|
55
|
+
args.push('--project', requireProject(context, 'inspect'));
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
case 'probe': {
|
|
60
|
+
args = ['info', '--project', positional(request.query ?? ''), '--json'];
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
case 'execute':
|
|
64
|
+
case 'batch': {
|
|
65
|
+
const steps = request.action === 'execute'
|
|
66
|
+
? [{ id: request.command ?? '', ...(request.params ? { params: request.params } : {}) }]
|
|
67
|
+
: (request.steps ?? []);
|
|
68
|
+
args = ['run', ...commandArgs(steps)];
|
|
69
|
+
if (context.project) {
|
|
70
|
+
args.push('--project', positional(context.project));
|
|
71
|
+
}
|
|
72
|
+
else if (context.demo) {
|
|
73
|
+
args.push('--demo');
|
|
74
|
+
}
|
|
75
|
+
if (context.saveAs) {
|
|
76
|
+
args.push('--save-as', context.saveAs);
|
|
77
|
+
artifacts.push(context.saveAs);
|
|
78
|
+
}
|
|
79
|
+
else if (context.save && context.project) {
|
|
80
|
+
args.push('--save');
|
|
81
|
+
artifacts.push(context.project);
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
case 'render': {
|
|
86
|
+
const output = request.output ?? '';
|
|
87
|
+
args = ['render-frame', '--out', positional(output)];
|
|
88
|
+
if (context.project) {
|
|
89
|
+
args.push('--project', requireProject(context, 'render'));
|
|
90
|
+
}
|
|
91
|
+
else if (context.demo) {
|
|
92
|
+
args.push('--demo');
|
|
93
|
+
}
|
|
94
|
+
if (request.seconds !== undefined) {
|
|
95
|
+
args.push('--time', String(request.seconds));
|
|
96
|
+
}
|
|
97
|
+
if (request.scale) {
|
|
98
|
+
args.push('--scale', String(request.scale));
|
|
99
|
+
}
|
|
100
|
+
artifacts = [output];
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
case 'export': {
|
|
104
|
+
const output = request.output ?? '';
|
|
105
|
+
args = ['render', '--out', positional(output)];
|
|
106
|
+
if (context.project) {
|
|
107
|
+
args.push('--project', requireProject(context, 'export'));
|
|
108
|
+
}
|
|
109
|
+
else if (context.demo) {
|
|
110
|
+
args.push('--demo');
|
|
111
|
+
}
|
|
112
|
+
const fps = request.quality ?? (typeof request.params?.fps === 'number' ? request.params.fps : undefined);
|
|
113
|
+
if (fps) {
|
|
114
|
+
args.push('--fps', String(fps));
|
|
115
|
+
}
|
|
116
|
+
artifacts = [output];
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
default:
|
|
120
|
+
throw new Error(`Unsupported effect engine action: ${request.action}`);
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
args,
|
|
124
|
+
artifacts,
|
|
125
|
+
timeoutMs: TIMEOUTS[request.action] ?? 60_000
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
};
|