@causyne/agent 1.11.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 +12 -0
- package/package.json +2 -2
- package/src/acp/protocol.js +1 -0
- package/src/acp/protocol.ts +22 -0
- package/src/acp/server.js +158 -21
- package/src/acp/server.ts +167 -21
- package/src/agentLoop.d.ts +22 -1
- package/src/agentLoop.js +15 -5
- package/src/approvalGrants.js +33 -0
- package/src/approvalGrants.ts +50 -0
- package/src/decisionPolicy.js +2 -0
- package/src/decisionPolicy.ts +1 -0
- package/src/engines/cad.js +113 -0
- package/src/engines/cad.ts +128 -0
- 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/film.js +108 -0
- package/src/engines/film.ts +104 -0
- package/src/engines/grid.js +106 -0
- package/src/engines/grid.ts +121 -0
- package/src/engines/installer.js +226 -0
- package/src/engines/installer.ts +248 -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/photo.js +126 -0
- package/src/engines/photo.ts +137 -0
- package/src/engines/registry.js +200 -0
- package/src/engines/registry.ts +199 -0
- package/src/engines/sound.js +117 -0
- package/src/engines/sound.ts +130 -0
- package/src/engines/types.js +1 -0
- package/src/engines/types.ts +73 -0
- package/src/engines/word.js +112 -0
- package/src/engines/word.ts +127 -0
- package/src/memoryManager.js +9 -3
- package/src/promptMentions.js +1 -1
- package/src/promptMentions.ts +1 -1
- package/src/sandbox.js +8 -0
- package/src/sessionJournal.js +12 -2
- package/src/sessionJournal.ts +12 -2
- package/src/toolPacks.js +15 -7
- package/src/tools/generateMediaViaApi.js +1 -1
- package/src/tools/nativeEngine.js +464 -0
- package/src/tools/nativeEngine.ts +433 -0
- package/src/tools/openSourceToolProvisioner.js +510 -0
- package/src/tools/openSourceToolProvisioner.ts +590 -0
- package/src/tools/registry.js +4 -1
- package/src/tui/completion.js +2 -2
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
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
|
+
// Visual effects, motion graphics, compositing, and layer animation engine for Causyne Agent.
|
|
12
|
+
// Headless After Effects-class compositor, frame renderer, sequence exporter, and property evaluator.
|
|
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
|
+
args.push(step.id);
|
|
41
|
+
args.push(step.params && Object.keys(step.params).length > 0 ? JSON.stringify(step.params) : '{}');
|
|
42
|
+
}
|
|
43
|
+
return args;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const effectEngine: NativeEngineAdapter = {
|
|
47
|
+
id: 'effect',
|
|
48
|
+
label: 'Causyne Effect Engine',
|
|
49
|
+
envVar: 'CAUSYNE_ENGINE_EFFECT',
|
|
50
|
+
binaryName: 'causyne-engine-effect',
|
|
51
|
+
actions: ['catalog', 'describe', 'inspect', 'execute', 'batch', 'export', 'render', 'probe'],
|
|
52
|
+
invoke(request: NativeEngineRequest, context: NativeEngineContext): NativeEngineInvocation {
|
|
53
|
+
let args: string[];
|
|
54
|
+
let artifacts: string[] = [];
|
|
55
|
+
|
|
56
|
+
switch (request.action) {
|
|
57
|
+
case 'status':
|
|
58
|
+
args = ['info', '--json'];
|
|
59
|
+
break;
|
|
60
|
+
case 'catalog':
|
|
61
|
+
args = ['commands', '--json'];
|
|
62
|
+
break;
|
|
63
|
+
case 'describe':
|
|
64
|
+
args = ['commands', '--json', ...(request.command ? ['--filter', request.command] : [])];
|
|
65
|
+
break;
|
|
66
|
+
case 'inspect': {
|
|
67
|
+
args = ['info', '--json'];
|
|
68
|
+
if (context.project) {
|
|
69
|
+
args.push('--project', requireProject(context, 'inspect'));
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
case 'probe': {
|
|
74
|
+
args = ['info', '--project', positional(request.query ?? ''), '--json'];
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case 'execute':
|
|
78
|
+
case 'batch': {
|
|
79
|
+
const steps: NativeEngineStep[] = request.action === 'execute'
|
|
80
|
+
? [{ id: request.command ?? '', ...(request.params ? { params: request.params } : {}) }]
|
|
81
|
+
: (request.steps ?? []);
|
|
82
|
+
|
|
83
|
+
args = ['run', ...commandArgs(steps)];
|
|
84
|
+
|
|
85
|
+
if (context.project) {
|
|
86
|
+
args.push('--project', positional(context.project));
|
|
87
|
+
} else if (context.demo) {
|
|
88
|
+
args.push('--demo');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (context.saveAs) {
|
|
92
|
+
args.push('--save-as', context.saveAs);
|
|
93
|
+
artifacts.push(context.saveAs);
|
|
94
|
+
} else if (context.save && context.project) {
|
|
95
|
+
args.push('--save');
|
|
96
|
+
artifacts.push(context.project);
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
case 'render': {
|
|
101
|
+
const output = request.output ?? '';
|
|
102
|
+
args = ['render-frame', '--out', positional(output)];
|
|
103
|
+
if (context.project) {
|
|
104
|
+
args.push('--project', requireProject(context, 'render'));
|
|
105
|
+
} else if (context.demo) {
|
|
106
|
+
args.push('--demo');
|
|
107
|
+
}
|
|
108
|
+
if (request.seconds !== undefined) {
|
|
109
|
+
args.push('--time', String(request.seconds));
|
|
110
|
+
}
|
|
111
|
+
if (request.scale) {
|
|
112
|
+
args.push('--scale', String(request.scale));
|
|
113
|
+
}
|
|
114
|
+
artifacts = [output];
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
case 'export': {
|
|
118
|
+
const output = request.output ?? '';
|
|
119
|
+
args = ['render', '--out', positional(output)];
|
|
120
|
+
if (context.project) {
|
|
121
|
+
args.push('--project', requireProject(context, 'export'));
|
|
122
|
+
} else if (context.demo) {
|
|
123
|
+
args.push('--demo');
|
|
124
|
+
}
|
|
125
|
+
const fps = request.quality ?? (typeof request.params?.fps === 'number' ? request.params.fps : undefined);
|
|
126
|
+
if (fps) {
|
|
127
|
+
args.push('--fps', String(fps));
|
|
128
|
+
}
|
|
129
|
+
artifacts = [output];
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
default:
|
|
133
|
+
throw new Error(`Unsupported effect engine action: ${request.action}`);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
args,
|
|
138
|
+
artifacts,
|
|
139
|
+
timeoutMs: TIMEOUTS[request.action] ?? 60_000
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
const TIMEOUTS = {
|
|
2
|
+
status: 10_000,
|
|
3
|
+
catalog: 30_000,
|
|
4
|
+
describe: 20_000,
|
|
5
|
+
inspect: 60_000,
|
|
6
|
+
execute: 120_000,
|
|
7
|
+
batch: 300_000,
|
|
8
|
+
export: 900_000,
|
|
9
|
+
render: 300_000,
|
|
10
|
+
probe: 120_000,
|
|
11
|
+
install: 600_000
|
|
12
|
+
};
|
|
13
|
+
function baseArgs(request, context) {
|
|
14
|
+
const args = [];
|
|
15
|
+
if (context.demo)
|
|
16
|
+
args.push('--demo');
|
|
17
|
+
if (context.project)
|
|
18
|
+
args.push('--project', context.project);
|
|
19
|
+
if (context.saveAs)
|
|
20
|
+
args.push('--save-as', context.saveAs);
|
|
21
|
+
else if (context.save)
|
|
22
|
+
args.push('--save');
|
|
23
|
+
return args;
|
|
24
|
+
}
|
|
25
|
+
function outputArgs(request) {
|
|
26
|
+
const args = [];
|
|
27
|
+
if (request.preset)
|
|
28
|
+
args.push('--preset', request.preset);
|
|
29
|
+
if (request.format)
|
|
30
|
+
args.push('--format', request.format);
|
|
31
|
+
if (request.range)
|
|
32
|
+
args.push('--range', request.range);
|
|
33
|
+
if (request.start !== undefined)
|
|
34
|
+
args.push('--start', String(request.start));
|
|
35
|
+
if (request.end !== undefined)
|
|
36
|
+
args.push('--end', String(request.end));
|
|
37
|
+
if (request.scale !== undefined)
|
|
38
|
+
args.push('--scale', String(request.scale));
|
|
39
|
+
if (request.quality !== undefined)
|
|
40
|
+
args.push('--quality', String(request.quality));
|
|
41
|
+
if (request.allowOffline)
|
|
42
|
+
args.push('--allow-offline');
|
|
43
|
+
return args;
|
|
44
|
+
}
|
|
45
|
+
export const filmEngine = {
|
|
46
|
+
id: 'film',
|
|
47
|
+
label: 'Causyne Film Engine',
|
|
48
|
+
envVar: 'CAUSYNE_ENGINE_FILM',
|
|
49
|
+
binaryName: 'causyne-engine-film',
|
|
50
|
+
actions: ['catalog', 'describe', 'inspect', 'execute', 'batch', 'export', 'render', 'probe'],
|
|
51
|
+
invoke(request, context) {
|
|
52
|
+
const args = baseArgs(request, context);
|
|
53
|
+
let stdin;
|
|
54
|
+
let artifacts = [];
|
|
55
|
+
switch (request.action) {
|
|
56
|
+
case 'catalog':
|
|
57
|
+
args.push('commands');
|
|
58
|
+
if (request.query)
|
|
59
|
+
args.push(request.query);
|
|
60
|
+
args.push('--json');
|
|
61
|
+
break;
|
|
62
|
+
case 'describe':
|
|
63
|
+
args.push('describe', request.command ?? '');
|
|
64
|
+
break;
|
|
65
|
+
case 'inspect':
|
|
66
|
+
args.push('inspect', request.query || 'all');
|
|
67
|
+
break;
|
|
68
|
+
case 'execute':
|
|
69
|
+
args.push('exec', request.command ?? '', JSON.stringify(request.params ?? {}));
|
|
70
|
+
break;
|
|
71
|
+
case 'batch':
|
|
72
|
+
args.push('run', '-');
|
|
73
|
+
if (context.keepGoing)
|
|
74
|
+
args.push('--keep-going');
|
|
75
|
+
stdin = (request.steps ?? []).map(step => JSON.stringify(step)).join('\n') + '\n';
|
|
76
|
+
break;
|
|
77
|
+
case 'export':
|
|
78
|
+
args.push('export', request.output ?? '', ...outputArgs(request));
|
|
79
|
+
artifacts = [request.output ?? ''];
|
|
80
|
+
break;
|
|
81
|
+
case 'render':
|
|
82
|
+
args.push('render', '--seconds', String(request.seconds ?? 0), '--out', request.output ?? '');
|
|
83
|
+
if (request.scale !== undefined)
|
|
84
|
+
args.push('--scale', String(request.scale));
|
|
85
|
+
if (request.allowOffline)
|
|
86
|
+
args.push('--allow-offline');
|
|
87
|
+
artifacts = [request.output ?? ''];
|
|
88
|
+
break;
|
|
89
|
+
case 'probe':
|
|
90
|
+
args.push('probe', request.query ?? '');
|
|
91
|
+
break;
|
|
92
|
+
case 'status':
|
|
93
|
+
args.push('--version');
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
args.push('--compact');
|
|
97
|
+
if (request.saveAs)
|
|
98
|
+
artifacts = [request.saveAs];
|
|
99
|
+
else if (request.save && context.project)
|
|
100
|
+
artifacts = [context.project];
|
|
101
|
+
return {
|
|
102
|
+
args,
|
|
103
|
+
...(stdin === undefined ? {} : { stdin }),
|
|
104
|
+
artifacts: artifacts.filter(Boolean),
|
|
105
|
+
timeoutMs: TIMEOUTS[request.action]
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
};
|