@causyne/agent 1.12.0 → 1.14.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/acp/agentCatalog.js +389 -0
- package/src/acp/agentCatalog.ts +455 -0
- package/src/acp/client.js +127 -4
- package/src/acp/client.ts +145 -5
- package/src/acp/peerProfiles.js +81 -3
- package/src/acp/peerProfiles.ts +85 -4
- package/src/acp/protocol.js +2 -0
- package/src/acp/protocol.ts +19 -0
- package/src/agentLoop.js +33 -12
- package/src/commands.js +108 -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/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
- package/src/entrypoint.js +11 -0
- package/src/providers/anthropic.js +5 -13
- package/src/providers/dashscope-byok.js +3 -4
- package/src/providers/deepseek.js +3 -4
- package/src/providers/gemini.js +17 -101
- package/src/providers/moonshot.js +3 -4
- package/src/providers/ollama.js +3 -4
- package/src/providers/openai-compatible.js +3 -4
- package/src/providers/qwen-byok.js +3 -4
- package/src/providers/xai.js +3 -4
- package/src/tools/peerAgent.js +115 -31
- package/src/tools/peerAgent.ts +143 -32
- package/src/tools/registry.js +144 -16
- package/src/tools/toolScanner.js +349 -0
- package/src/tools/toolScanner.ts +451 -0
- package/src/tools/toolSelfRepair.js +759 -0
- package/src/tools/toolSelfRepair.ts +846 -0
|
@@ -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,106 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
// Spreadsheet, workbook calculation, and tabular data engine for Causyne Agent.
|
|
3
|
+
// Headless spreadsheet evaluator, XLSX/CSV/TSV/HTML converter, and calculation oracle.
|
|
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 gridEngine = {
|
|
38
|
+
id: 'grid',
|
|
39
|
+
label: 'Causyne Grid Engine',
|
|
40
|
+
envVar: 'CAUSYNE_ENGINE_GRID',
|
|
41
|
+
binaryName: 'causyne-engine-grid',
|
|
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', '--json', ...(request.query ? ['--search', request.query] : [])];
|
|
52
|
+
break;
|
|
53
|
+
case 'describe':
|
|
54
|
+
args = ['commands', '--json', ...(request.command ? ['--search', request.command] : [])];
|
|
55
|
+
break;
|
|
56
|
+
case 'inspect':
|
|
57
|
+
args = ['info', requireProject(context, 'inspect'), '--json'];
|
|
58
|
+
break;
|
|
59
|
+
case 'probe':
|
|
60
|
+
args = ['info', positional(request.query ?? ''), '--json'];
|
|
61
|
+
break;
|
|
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', 'financial');
|
|
73
|
+
}
|
|
74
|
+
args.push(...commandArgs(steps));
|
|
75
|
+
if (context.saveAs) {
|
|
76
|
+
args.push('--out', context.saveAs);
|
|
77
|
+
artifacts.push(context.saveAs);
|
|
78
|
+
}
|
|
79
|
+
else if (context.save && context.project) {
|
|
80
|
+
args.push('--out', context.project);
|
|
81
|
+
artifacts.push(context.project);
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
case 'export': {
|
|
86
|
+
const output = request.output ?? '';
|
|
87
|
+
args = ['convert', requireProject(context, 'export'), positional(output)];
|
|
88
|
+
artifacts = [output];
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
case 'render': {
|
|
92
|
+
const output = request.output ?? '';
|
|
93
|
+
args = ['convert', requireProject(context, 'render'), positional(output)];
|
|
94
|
+
artifacts = [output];
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
default:
|
|
98
|
+
throw new Error(`Unsupported grid engine action: ${request.action}`);
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
args,
|
|
102
|
+
artifacts,
|
|
103
|
+
timeoutMs: TIMEOUTS[request.action] ?? 60_000
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
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
|
+
// Spreadsheet, workbook calculation, and tabular data engine for Causyne Agent.
|
|
12
|
+
// Headless spreadsheet evaluator, XLSX/CSV/TSV/HTML converter, and calculation oracle.
|
|
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 gridEngine: NativeEngineAdapter = {
|
|
50
|
+
id: 'grid',
|
|
51
|
+
label: 'Causyne Grid Engine',
|
|
52
|
+
envVar: 'CAUSYNE_ENGINE_GRID',
|
|
53
|
+
binaryName: 'causyne-engine-grid',
|
|
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', '--json', ...(request.query ? ['--search', request.query] : [])];
|
|
65
|
+
break;
|
|
66
|
+
case 'describe':
|
|
67
|
+
args = ['commands', '--json', ...(request.command ? ['--search', request.command] : [])];
|
|
68
|
+
break;
|
|
69
|
+
case 'inspect':
|
|
70
|
+
args = ['info', requireProject(context, 'inspect'), '--json'];
|
|
71
|
+
break;
|
|
72
|
+
case 'probe':
|
|
73
|
+
args = ['info', positional(request.query ?? ''), '--json'];
|
|
74
|
+
break;
|
|
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', 'financial');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
args.push(...commandArgs(steps));
|
|
89
|
+
|
|
90
|
+
if (context.saveAs) {
|
|
91
|
+
args.push('--out', context.saveAs);
|
|
92
|
+
artifacts.push(context.saveAs);
|
|
93
|
+
} else if (context.save && context.project) {
|
|
94
|
+
args.push('--out', context.project);
|
|
95
|
+
artifacts.push(context.project);
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
case 'export': {
|
|
100
|
+
const output = request.output ?? '';
|
|
101
|
+
args = ['convert', requireProject(context, 'export'), positional(output)];
|
|
102
|
+
artifacts = [output];
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
case 'render': {
|
|
106
|
+
const output = request.output ?? '';
|
|
107
|
+
args = ['convert', requireProject(context, 'render'), positional(output)];
|
|
108
|
+
artifacts = [output];
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
default:
|
|
112
|
+
throw new Error(`Unsupported grid engine action: ${request.action}`);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
args,
|
|
117
|
+
artifacts,
|
|
118
|
+
timeoutMs: TIMEOUTS[request.action] ?? 60_000
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
// RAW photo development, color grading, HDR merge, and tone-mapping engine for Causyne Agent.
|
|
3
|
+
// Headless RAW pipeline, non-destructive develop adjustments, and photo library automation.
|
|
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(step.id, JSON.stringify(step.params));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
args.push(step.id);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return args;
|
|
36
|
+
}
|
|
37
|
+
export const lightEngine = {
|
|
38
|
+
id: 'light',
|
|
39
|
+
label: 'Causyne Light Engine',
|
|
40
|
+
envVar: 'CAUSYNE_ENGINE_LIGHT',
|
|
41
|
+
binaryName: 'causyne-engine-light',
|
|
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 = ['controls', '--json'];
|
|
52
|
+
break;
|
|
53
|
+
case 'describe':
|
|
54
|
+
args = ['controls', '--json'];
|
|
55
|
+
break;
|
|
56
|
+
case 'inspect':
|
|
57
|
+
case 'probe': {
|
|
58
|
+
const file = request.action === 'inspect' ? requireProject(context, 'inspect') : positional(request.query ?? '');
|
|
59
|
+
args = ['render', file, '-o', '/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('--import', positional(context.project));
|
|
70
|
+
}
|
|
71
|
+
else if (context.demo) {
|
|
72
|
+
args.push('--demo');
|
|
73
|
+
}
|
|
74
|
+
args.push(...commandArgs(steps));
|
|
75
|
+
if (context.saveAs) {
|
|
76
|
+
args.push('--library', context.saveAs);
|
|
77
|
+
artifacts.push(context.saveAs);
|
|
78
|
+
}
|
|
79
|
+
else if (context.save && context.project) {
|
|
80
|
+
args.push('--library', context.project);
|
|
81
|
+
artifacts.push(context.project);
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
case 'export':
|
|
86
|
+
case 'render': {
|
|
87
|
+
const output = request.output ?? '';
|
|
88
|
+
args = ['render', requireProject(context, request.action), '-o', positional(output)];
|
|
89
|
+
if (request.scale) {
|
|
90
|
+
args.push('--size', String(Math.round(1920 * request.scale)));
|
|
91
|
+
}
|
|
92
|
+
if (request.quality) {
|
|
93
|
+
args.push('--quality', String(request.quality));
|
|
94
|
+
}
|
|
95
|
+
artifacts = [output];
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
default:
|
|
99
|
+
throw new Error(`Unsupported light engine action: ${request.action}`);
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
args,
|
|
103
|
+
artifacts,
|
|
104
|
+
timeoutMs: TIMEOUTS[request.action] ?? 60_000
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
};
|