@cef-ai/cli 0.2.7 → 0.3.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/README.md +75 -1247
- package/dist/build/duration.d.ts +22 -0
- package/dist/build/duration.d.ts.map +1 -0
- package/dist/build/duration.js +44 -0
- package/dist/build/duration.js.map +1 -0
- package/dist/build/esbuild-plugin.d.ts +32 -0
- package/dist/build/esbuild-plugin.d.ts.map +1 -0
- package/dist/build/esbuild-plugin.js +53 -0
- package/dist/build/esbuild-plugin.js.map +1 -0
- package/dist/build/lints.d.ts +55 -0
- package/dist/build/lints.d.ts.map +1 -0
- package/dist/build/lints.js +214 -0
- package/dist/build/lints.js.map +1 -0
- package/dist/build/load-config.d.ts +114 -0
- package/dist/build/load-config.d.ts.map +1 -0
- package/dist/build/load-config.js +150 -0
- package/dist/build/load-config.js.map +1 -0
- package/dist/build/manifest.d.ts +156 -0
- package/dist/build/manifest.d.ts.map +1 -0
- package/dist/build/manifest.js +111 -0
- package/dist/build/manifest.js.map +1 -0
- package/dist/build/targeting.d.ts +15 -0
- package/dist/build/targeting.d.ts.map +1 -0
- package/dist/build/targeting.js +69 -0
- package/dist/build/targeting.js.map +1 -0
- package/dist/cli.d.ts +2 -2
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +107 -62
- package/dist/cli.js.map +1 -0
- package/dist/commands/build.d.ts +41 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +252 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/inspect.d.ts +49 -0
- package/dist/commands/inspect.d.ts.map +1 -0
- package/dist/commands/inspect.js +135 -0
- package/dist/commands/inspect.js.map +1 -0
- package/dist/commands/typegen.d.ts +36 -0
- package/dist/commands/typegen.d.ts.map +1 -0
- package/dist/commands/typegen.js +210 -0
- package/dist/commands/typegen.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/lib.d.ts +12 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +9 -0
- package/dist/lib.js.map +1 -0
- package/dist/typegen/augment.d.ts +57 -0
- package/dist/typegen/augment.d.ts.map +1 -0
- package/dist/typegen/augment.js +87 -0
- package/dist/typegen/augment.js.map +1 -0
- package/dist/typegen/fetch.d.ts +30 -0
- package/dist/typegen/fetch.d.ts.map +1 -0
- package/dist/typegen/fetch.js +38 -0
- package/dist/typegen/fetch.js.map +1 -0
- package/dist/typegen/lockfile.d.ts +42 -0
- package/dist/typegen/lockfile.d.ts.map +1 -0
- package/dist/typegen/lockfile.js +58 -0
- package/dist/typegen/lockfile.js.map +1 -0
- package/dist/typegen/schema-to-ts.d.ts +21 -0
- package/dist/typegen/schema-to-ts.d.ts.map +1 -0
- package/dist/typegen/schema-to-ts.js +29 -0
- package/dist/typegen/schema-to-ts.js.map +1 -0
- package/package.json +20 -58
- package/dist/commands/auth/index.d.ts +0 -2
- package/dist/commands/auth/index.js +0 -162
- package/dist/commands/deploy/clone.d.ts +0 -13
- package/dist/commands/deploy/clone.js +0 -143
- package/dist/commands/deploy/delete.d.ts +0 -14
- package/dist/commands/deploy/delete.js +0 -134
- package/dist/commands/deploy/deploy.d.ts +0 -24
- package/dist/commands/deploy/deploy.js +0 -654
- package/dist/commands/deploy/index.d.ts +0 -2
- package/dist/commands/deploy/index.js +0 -216
- package/dist/commands/deploy/status.d.ts +0 -14
- package/dist/commands/deploy/status.js +0 -61
- package/dist/commands/dev/index.d.ts +0 -2
- package/dist/commands/dev/index.js +0 -134
- package/dist/commands/dev/server.d.ts +0 -14
- package/dist/commands/dev/server.js +0 -195
- package/dist/commands/dev/static/app.js +0 -633
- package/dist/commands/dev/static/index.html +0 -205
- package/dist/commands/dev/static/static/app.js +0 -633
- package/dist/commands/dev/static/static/index.html +0 -205
- package/dist/commands/dev/static/static/style.css +0 -184
- package/dist/commands/dev/static/style.css +0 -184
- package/dist/commands/playground/index.d.ts +0 -2
- package/dist/commands/playground/index.js +0 -75
- package/dist/commands/playground/test.d.ts +0 -15
- package/dist/commands/playground/test.js +0 -166
- package/dist/commands/service/index.d.ts +0 -2
- package/dist/commands/service/index.js +0 -89
- package/dist/lib/api.d.ts +0 -146
- package/dist/lib/api.js +0 -330
- package/dist/lib/config.d.ts +0 -12
- package/dist/lib/config.js +0 -145
- package/dist/lib/credentials.d.ts +0 -19
- package/dist/lib/credentials.js +0 -68
- package/dist/lib/runtime/agent-router.d.ts +0 -12
- package/dist/lib/runtime/agent-router.js +0 -67
- package/dist/lib/runtime/context-builder.d.ts +0 -27
- package/dist/lib/runtime/context-builder.js +0 -166
- package/dist/lib/runtime/cubby-manager.d.ts +0 -20
- package/dist/lib/runtime/cubby-manager.js +0 -162
- package/dist/lib/runtime/index.d.ts +0 -51
- package/dist/lib/runtime/index.js +0 -181
- package/dist/lib/runtime/log-collector.d.ts +0 -17
- package/dist/lib/runtime/log-collector.js +0 -61
- package/dist/lib/runtime/stream-manager.d.ts +0 -10
- package/dist/lib/runtime/stream-manager.js +0 -77
- package/dist/lib/runtime/types.d.ts +0 -76
- package/dist/lib/runtime/types.js +0 -2
- package/dist/lib/transpile.d.ts +0 -1
- package/dist/lib/transpile.js +0 -9
- package/dist/lib/typecheck.d.ts +0 -31
- package/dist/lib/typecheck.js +0 -175
- package/dist/lib/types.d.ts +0 -246
- package/dist/lib/types.js +0 -2
- package/dist/lib/utils.d.ts +0 -4
- package/dist/lib/utils.js +0 -33
- package/example/.env.example +0 -6
- package/example/agents/object-detection/tasks/yolo.ts +0 -28
- package/example/agents/parking-violation-detector/tasks/detect.ts +0 -326
- package/example/cef.config.yaml +0 -91
- package/example/engagements/engagement.ts +0 -902
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { loadConfig } from '../../lib/config.js';
|
|
2
|
-
import { createApiClient } from '../../lib/api.js';
|
|
3
|
-
import { errorMessage } from '../../lib/utils.js';
|
|
4
|
-
import { resolveAgentId, runPlaygroundTest } from './test.js';
|
|
5
|
-
function printResults(results) {
|
|
6
|
-
const passed = results.filter(r => r.status === 'pass').length;
|
|
7
|
-
const failed = results.filter(r => r.status === 'fail').length;
|
|
8
|
-
const errors = results.filter(r => r.status === 'error').length;
|
|
9
|
-
console.log('');
|
|
10
|
-
for (const r of results) {
|
|
11
|
-
const tag = r.status === 'pass' ? '[PASS]' :
|
|
12
|
-
r.status === 'fail' ? '[FAIL]' :
|
|
13
|
-
'[ERROR]';
|
|
14
|
-
console.log(` ${tag} ${r.agent} > ${r.tool} (${r.durationMs}ms)`);
|
|
15
|
-
if (r.status === 'pass' && r.response?.result) {
|
|
16
|
-
console.log(` ${JSON.stringify(r.response.result.data)}`);
|
|
17
|
-
}
|
|
18
|
-
if (r.status === 'fail' && r.expectationFailures) {
|
|
19
|
-
for (const f of r.expectationFailures) {
|
|
20
|
-
console.log(` - ${f}`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
if (r.status === 'fail' && r.error) {
|
|
24
|
-
console.log(` Error: ${r.error}`);
|
|
25
|
-
}
|
|
26
|
-
if (r.status === 'error') {
|
|
27
|
-
console.log(` ${r.error}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
console.log(`\nResults: ${passed} passed, ${failed} failed, ${errors} errors`);
|
|
31
|
-
}
|
|
32
|
-
export function registerPlaygroundCommands(program) {
|
|
33
|
-
const playground = program
|
|
34
|
-
.command('playground')
|
|
35
|
-
.description('Test and interact with agents');
|
|
36
|
-
playground
|
|
37
|
-
.command('test')
|
|
38
|
-
.description('Run playground tests against agent tools via MCP')
|
|
39
|
-
.option('--config <path>', 'Config file path', './cef.config.yaml')
|
|
40
|
-
.option('--agent <name>', 'Agent name, alias, or agentId')
|
|
41
|
-
.option('--tool <alias>', 'Task alias (tool name) to call')
|
|
42
|
-
.option('--args <json>', 'JSON arguments to pass to the tool')
|
|
43
|
-
.option('--test-file <path>', 'Path to cef.tests.yaml for batch testing')
|
|
44
|
-
.option('--list-tools', 'List available tools on an agent')
|
|
45
|
-
.action(async (opts) => {
|
|
46
|
-
try {
|
|
47
|
-
const resolved = loadConfig(opts.config);
|
|
48
|
-
if (opts.listTools) {
|
|
49
|
-
if (!opts.agent) {
|
|
50
|
-
console.error('--agent is required with --list-tools');
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
const { agentId } = resolveAgentId(resolved.config, opts.agent);
|
|
54
|
-
const api = createApiClient(resolved.env, resolved.config.agentServicePubKey);
|
|
55
|
-
const result = await api.listTools(agentId);
|
|
56
|
-
console.log(JSON.stringify(result, null, 2));
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
const results = await runPlaygroundTest(resolved, {
|
|
60
|
-
agent: opts.agent,
|
|
61
|
-
tool: opts.tool,
|
|
62
|
-
arguments: opts.args,
|
|
63
|
-
testFile: opts.testFile,
|
|
64
|
-
});
|
|
65
|
-
printResults(results);
|
|
66
|
-
const hasFailures = results.some(r => r.status !== 'pass');
|
|
67
|
-
if (hasFailures)
|
|
68
|
-
process.exit(1);
|
|
69
|
-
}
|
|
70
|
-
catch (err) {
|
|
71
|
-
console.error(`Playground test failed: ${errorMessage(err)}`);
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CefConfig, AgentConfig, ResolvedConfig, PlaygroundTestCase, PlaygroundTestResult } from '../../lib/types.js';
|
|
2
|
-
export interface PlaygroundOptions {
|
|
3
|
-
agent?: string;
|
|
4
|
-
tool?: string;
|
|
5
|
-
arguments?: string;
|
|
6
|
-
testFile?: string;
|
|
7
|
-
listTools?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare function resolveAgentId(config: CefConfig, nameOrId: string): {
|
|
10
|
-
agentId: string;
|
|
11
|
-
agent: AgentConfig;
|
|
12
|
-
};
|
|
13
|
-
export declare function deepPartialMatch(actual: unknown, expected: unknown, path?: string): string[];
|
|
14
|
-
export declare function loadTestFile(filePath: string): PlaygroundTestCase[];
|
|
15
|
-
export declare function runPlaygroundTest(resolved: ResolvedConfig, options: PlaygroundOptions): Promise<PlaygroundTestResult[]>;
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import { parse } from 'yaml';
|
|
3
|
-
import { createApiClient } from '../../lib/api.js';
|
|
4
|
-
export function resolveAgentId(config, nameOrId) {
|
|
5
|
-
const agents = config.agents;
|
|
6
|
-
if (!agents || agents.length === 0) {
|
|
7
|
-
throw new Error('No agents defined in cef.config.yaml');
|
|
8
|
-
}
|
|
9
|
-
const match = agents.find(a => a.name === nameOrId ||
|
|
10
|
-
a.alias === nameOrId ||
|
|
11
|
-
a.agentId === nameOrId);
|
|
12
|
-
if (!match) {
|
|
13
|
-
const available = agents.map(a => a.name).join(', ');
|
|
14
|
-
throw new Error(`Agent "${nameOrId}" not found. Available: ${available}`);
|
|
15
|
-
}
|
|
16
|
-
if (!match.agentId) {
|
|
17
|
-
throw new Error(`Agent "${match.name}" has no agentId. Run \`cef deploy\` first to deploy it.`);
|
|
18
|
-
}
|
|
19
|
-
return { agentId: match.agentId, agent: match };
|
|
20
|
-
}
|
|
21
|
-
export function deepPartialMatch(actual, expected, path = '') {
|
|
22
|
-
if (expected === null || expected === undefined) {
|
|
23
|
-
if (actual === expected)
|
|
24
|
-
return [];
|
|
25
|
-
return [`${path || 'root'}: expected ${String(expected)}, got ${String(actual)}`];
|
|
26
|
-
}
|
|
27
|
-
if (Array.isArray(expected)) {
|
|
28
|
-
if (!Array.isArray(actual)) {
|
|
29
|
-
return [`${path || 'root'}: expected array, got ${typeof actual}`];
|
|
30
|
-
}
|
|
31
|
-
const failures = [];
|
|
32
|
-
for (let i = 0; i < expected.length; i++) {
|
|
33
|
-
const p = path ? `${path}[${i}]` : `[${i}]`;
|
|
34
|
-
if (i >= actual.length) {
|
|
35
|
-
failures.push(`${p}: missing (expected ${JSON.stringify(expected[i])})`);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
failures.push(...deepPartialMatch(actual[i], expected[i], p));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return failures;
|
|
42
|
-
}
|
|
43
|
-
if (typeof expected === 'object') {
|
|
44
|
-
if (typeof actual !== 'object' || actual === null) {
|
|
45
|
-
return [`${path || 'root'}: expected object, got ${String(actual)}`];
|
|
46
|
-
}
|
|
47
|
-
const failures = [];
|
|
48
|
-
for (const key of Object.keys(expected)) {
|
|
49
|
-
const p = path ? `${path}.${key}` : key;
|
|
50
|
-
const actualObj = actual;
|
|
51
|
-
const expectedObj = expected;
|
|
52
|
-
if (!(key in actualObj)) {
|
|
53
|
-
failures.push(`${p}: missing (expected ${JSON.stringify(expectedObj[key])})`);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
failures.push(...deepPartialMatch(actualObj[key], expectedObj[key], p));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return failures;
|
|
60
|
-
}
|
|
61
|
-
if (actual !== expected) {
|
|
62
|
-
return [`${path || 'root'}: expected ${JSON.stringify(expected)}, got ${JSON.stringify(actual)}`];
|
|
63
|
-
}
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
export function loadTestFile(filePath) {
|
|
67
|
-
if (!fs.existsSync(filePath)) {
|
|
68
|
-
throw new Error(`Test file not found: ${filePath}`);
|
|
69
|
-
}
|
|
70
|
-
const raw = fs.readFileSync(filePath, 'utf8');
|
|
71
|
-
const parsed = parse(raw);
|
|
72
|
-
if (!parsed || !Array.isArray(parsed.tests)) {
|
|
73
|
-
throw new Error(`Invalid test file: expected a "tests" array at top level`);
|
|
74
|
-
}
|
|
75
|
-
return parsed.tests;
|
|
76
|
-
}
|
|
77
|
-
async function runSingleTest(api, agentId, testCase) {
|
|
78
|
-
const start = Date.now();
|
|
79
|
-
try {
|
|
80
|
-
const response = await api.callTool(agentId, testCase.tool, testCase.arguments);
|
|
81
|
-
const durationMs = Date.now() - start;
|
|
82
|
-
const hasError = !!response.error;
|
|
83
|
-
if (hasError && !testCase.expect) {
|
|
84
|
-
return {
|
|
85
|
-
agent: testCase.agent,
|
|
86
|
-
tool: testCase.tool,
|
|
87
|
-
status: 'fail',
|
|
88
|
-
durationMs,
|
|
89
|
-
response,
|
|
90
|
-
error: response.error.message,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
if (testCase.expect) {
|
|
94
|
-
const failures = [];
|
|
95
|
-
if (testCase.expect.success === true && hasError) {
|
|
96
|
-
failures.push(`Expected success but got error: "${response.error.message}"`);
|
|
97
|
-
}
|
|
98
|
-
if (testCase.expect.success === false && !hasError) {
|
|
99
|
-
failures.push('Expected error but got success');
|
|
100
|
-
}
|
|
101
|
-
if (testCase.expect.result && response.result) {
|
|
102
|
-
failures.push(...deepPartialMatch(response.result.data, testCase.expect.result));
|
|
103
|
-
}
|
|
104
|
-
if (failures.length > 0) {
|
|
105
|
-
return {
|
|
106
|
-
agent: testCase.agent,
|
|
107
|
-
tool: testCase.tool,
|
|
108
|
-
status: 'fail',
|
|
109
|
-
durationMs,
|
|
110
|
-
response,
|
|
111
|
-
expectationFailures: failures,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return {
|
|
116
|
-
agent: testCase.agent,
|
|
117
|
-
tool: testCase.tool,
|
|
118
|
-
status: 'pass',
|
|
119
|
-
durationMs,
|
|
120
|
-
response,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
catch (err) {
|
|
124
|
-
return {
|
|
125
|
-
agent: testCase.agent,
|
|
126
|
-
tool: testCase.tool,
|
|
127
|
-
status: 'error',
|
|
128
|
-
durationMs: Date.now() - start,
|
|
129
|
-
error: err instanceof Error ? err.message : String(err),
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
export async function runPlaygroundTest(resolved, options) {
|
|
134
|
-
const api = createApiClient(resolved.env, resolved.config.agentServicePubKey);
|
|
135
|
-
if (options.testFile) {
|
|
136
|
-
const testCases = loadTestFile(options.testFile);
|
|
137
|
-
const results = [];
|
|
138
|
-
for (const tc of testCases) {
|
|
139
|
-
const { agentId } = resolveAgentId(resolved.config, tc.agent);
|
|
140
|
-
results.push(await runSingleTest(api, agentId, tc));
|
|
141
|
-
}
|
|
142
|
-
return results;
|
|
143
|
-
}
|
|
144
|
-
if (!options.agent) {
|
|
145
|
-
throw new Error('Provide --agent and --tool for single test, or --test-file for batch testing');
|
|
146
|
-
}
|
|
147
|
-
if (!options.tool) {
|
|
148
|
-
throw new Error('--tool is required when running a single test');
|
|
149
|
-
}
|
|
150
|
-
let args = {};
|
|
151
|
-
if (options.arguments) {
|
|
152
|
-
try {
|
|
153
|
-
args = JSON.parse(options.arguments);
|
|
154
|
-
}
|
|
155
|
-
catch {
|
|
156
|
-
throw new Error(`Invalid JSON in --args: ${options.arguments}`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
const { agentId } = resolveAgentId(resolved.config, options.agent);
|
|
160
|
-
const testCase = {
|
|
161
|
-
agent: options.agent,
|
|
162
|
-
tool: options.tool,
|
|
163
|
-
arguments: args,
|
|
164
|
-
};
|
|
165
|
-
return [await runSingleTest(api, agentId, testCase)];
|
|
166
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import dotenv from 'dotenv';
|
|
3
|
-
import { loadEnv } from '../../lib/config.js';
|
|
4
|
-
import { listAgentServices, createAgentServiceOnRob, createAgentServiceOnOrchestrator } from '../../lib/api.js';
|
|
5
|
-
import { errorMessage } from '../../lib/utils.js';
|
|
6
|
-
function loadEnvFromDir(dir) {
|
|
7
|
-
const resolved = path.resolve(dir);
|
|
8
|
-
dotenv.config({ path: path.join(resolved, '.env') });
|
|
9
|
-
return loadEnv();
|
|
10
|
-
}
|
|
11
|
-
async function handleList(opts) {
|
|
12
|
-
const configDir = path.dirname(path.resolve(opts.config));
|
|
13
|
-
try {
|
|
14
|
-
const env = loadEnvFromDir(configDir);
|
|
15
|
-
if (!env.robApiUrl) {
|
|
16
|
-
console.error('CEF_ROB_API_URL is required to list agent services');
|
|
17
|
-
process.exit(1);
|
|
18
|
-
}
|
|
19
|
-
const services = await listAgentServices(env.robApiUrl, env.authToken);
|
|
20
|
-
const active = services.filter(s => !s.archived);
|
|
21
|
-
console.log(`\nAgent Services (${active.length}):\n`);
|
|
22
|
-
for (const s of active) {
|
|
23
|
-
console.log(` ${s.name}`);
|
|
24
|
-
console.log(` agentServiceId: ${s.id}`);
|
|
25
|
-
console.log(` agentServicePubKey: ${s.publicKey}`);
|
|
26
|
-
console.log(` created: ${s.createdAt}`);
|
|
27
|
-
console.log('');
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
catch (err) {
|
|
31
|
-
console.error(`Failed to list services: ${errorMessage(err)}`);
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
async function handleCreate(opts) {
|
|
36
|
-
const configDir = path.dirname(path.resolve(opts.config));
|
|
37
|
-
const env = loadEnvFromDir(configDir);
|
|
38
|
-
if (!env.robApiUrl) {
|
|
39
|
-
console.error('CEF_ROB_API_URL is required to create an agent service');
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
try {
|
|
43
|
-
console.log(`Creating agent service "${opts.name}" on orchestrator...`);
|
|
44
|
-
const orchRes = await createAgentServiceOnOrchestrator(env.orchestratorUrl, env.authToken, opts.bucketId, opts.name);
|
|
45
|
-
const orchData = orchRes.data;
|
|
46
|
-
const agentServicePubKey = String(orchData?.agentServicePubKey ?? orchRes.agentServicePubKey ?? '');
|
|
47
|
-
if (!agentServicePubKey) {
|
|
48
|
-
throw new Error('Orchestrator did not return agentServicePubKey');
|
|
49
|
-
}
|
|
50
|
-
console.log(` Orchestrator registered: agentServicePubKey=${agentServicePubKey}`);
|
|
51
|
-
console.log(`Registering agent service on ROB...`);
|
|
52
|
-
let service;
|
|
53
|
-
try {
|
|
54
|
-
service = await createAgentServiceOnRob(env.robApiUrl, env.authToken, opts.name, agentServicePubKey);
|
|
55
|
-
}
|
|
56
|
-
catch (robErr) {
|
|
57
|
-
console.error(`ROB registration failed: ${errorMessage(robErr)}`);
|
|
58
|
-
console.error(`Orchestrator service was created with pubkey: ${agentServicePubKey}`);
|
|
59
|
-
console.error(`Re-run or manually register this key on ROB to complete setup.`);
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
console.log(` ROB registered: id=${service.id}`);
|
|
63
|
-
console.log(`\nAgent service created:`);
|
|
64
|
-
console.log(` name: ${service.name}`);
|
|
65
|
-
console.log(` agentServiceId: ${service.id}`);
|
|
66
|
-
console.log(` agentServicePubKey: ${agentServicePubKey}`);
|
|
67
|
-
}
|
|
68
|
-
catch (err) {
|
|
69
|
-
console.error(`Create service failed: ${errorMessage(err)}`);
|
|
70
|
-
process.exit(1);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
export function registerServiceCommands(program) {
|
|
74
|
-
const service = program
|
|
75
|
-
.command('service')
|
|
76
|
-
.description('Manage agent services');
|
|
77
|
-
service
|
|
78
|
-
.command('list')
|
|
79
|
-
.description('List agent services from ROB')
|
|
80
|
-
.option('--config <path>', 'Config file path', './cef.config.yaml')
|
|
81
|
-
.action(handleList);
|
|
82
|
-
service
|
|
83
|
-
.command('create')
|
|
84
|
-
.description('Create a new agent service')
|
|
85
|
-
.requiredOption('--name <name>', 'Name of the new agent service')
|
|
86
|
-
.option('--config <path>', 'Config file path', './cef.config.yaml')
|
|
87
|
-
.option('--bucket-id <id>', 'DDC bucket ID', '1')
|
|
88
|
-
.action(handleCreate);
|
|
89
|
-
}
|
package/dist/lib/api.d.ts
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import type { EnvConfig, WorkspacePayload, StreamPayload, EngagementPayload, JsonRpcResponse, AgentPayload, AgentUpdatePayload, DeploymentPayload, CubbyCreatePayload, CubbyMigration, CubbyInstance, CubbyStats, RaftOrchestratorPayload } from './types.js';
|
|
2
|
-
/** Payload for registering or updating a raft on ROB (RMS). */
|
|
3
|
-
export interface RaftRobPayload {
|
|
4
|
-
raftId: string;
|
|
5
|
-
streamId: string;
|
|
6
|
-
name: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
tsCode: string;
|
|
9
|
-
dataSourcesIds?: string[];
|
|
10
|
-
queryOperations?: unknown[];
|
|
11
|
-
}
|
|
12
|
-
export interface RemoteTask {
|
|
13
|
-
id: string;
|
|
14
|
-
name: string;
|
|
15
|
-
alias: string;
|
|
16
|
-
tsCode: string;
|
|
17
|
-
parameters: Record<string, unknown>;
|
|
18
|
-
returns: Record<string, unknown>;
|
|
19
|
-
}
|
|
20
|
-
export interface RemoteAgent {
|
|
21
|
-
agentId: string;
|
|
22
|
-
name: string;
|
|
23
|
-
alias: string;
|
|
24
|
-
description: string;
|
|
25
|
-
isConcierge: boolean;
|
|
26
|
-
version: string;
|
|
27
|
-
tasks: RemoteTask[];
|
|
28
|
-
}
|
|
29
|
-
export interface RemoteEngagement {
|
|
30
|
-
engagementId: string;
|
|
31
|
-
name: string;
|
|
32
|
-
description: string;
|
|
33
|
-
conciergeAgentId: string;
|
|
34
|
-
version: string;
|
|
35
|
-
}
|
|
36
|
-
export interface OntologyDeployment {
|
|
37
|
-
deploymentId: string;
|
|
38
|
-
name: string;
|
|
39
|
-
description: string;
|
|
40
|
-
isActive: boolean;
|
|
41
|
-
triggers: Array<{
|
|
42
|
-
name: string;
|
|
43
|
-
conditions: string[];
|
|
44
|
-
}>;
|
|
45
|
-
engagements: Array<{
|
|
46
|
-
id: string;
|
|
47
|
-
name: string;
|
|
48
|
-
}>;
|
|
49
|
-
}
|
|
50
|
-
export interface OntologyStream {
|
|
51
|
-
streamId: string;
|
|
52
|
-
name: string;
|
|
53
|
-
description: string;
|
|
54
|
-
selectors: Array<{
|
|
55
|
-
name: string;
|
|
56
|
-
conditions: string[];
|
|
57
|
-
}>;
|
|
58
|
-
deployments: OntologyDeployment[];
|
|
59
|
-
}
|
|
60
|
-
export interface OntologyWorkspace {
|
|
61
|
-
workspaceId: string;
|
|
62
|
-
name: string;
|
|
63
|
-
description: string;
|
|
64
|
-
streams: OntologyStream[];
|
|
65
|
-
}
|
|
66
|
-
export interface OntologyResponse {
|
|
67
|
-
agentService: {
|
|
68
|
-
agentServicePubKey: string;
|
|
69
|
-
name: string;
|
|
70
|
-
description: string;
|
|
71
|
-
};
|
|
72
|
-
workspaces: OntologyWorkspace[];
|
|
73
|
-
}
|
|
74
|
-
export interface RemoteCubby {
|
|
75
|
-
cubbyId: string;
|
|
76
|
-
agentServicePubKey?: string;
|
|
77
|
-
alias: string;
|
|
78
|
-
name: string;
|
|
79
|
-
description?: string;
|
|
80
|
-
migrations?: CubbyMigration[];
|
|
81
|
-
maxSizeBytes?: number;
|
|
82
|
-
idleTimeout?: string;
|
|
83
|
-
createdAt?: string;
|
|
84
|
-
updatedAt?: string;
|
|
85
|
-
}
|
|
86
|
-
interface ApiResponse {
|
|
87
|
-
id?: string;
|
|
88
|
-
[key: string]: unknown;
|
|
89
|
-
}
|
|
90
|
-
interface ApiListResponse<T> {
|
|
91
|
-
data: T[];
|
|
92
|
-
}
|
|
93
|
-
export interface RemoteWorkspace {
|
|
94
|
-
workspaceId: string;
|
|
95
|
-
agentServicePubKey: string;
|
|
96
|
-
name: string;
|
|
97
|
-
description: string;
|
|
98
|
-
}
|
|
99
|
-
export declare function createApiClient(env: EnvConfig, asPubKey: string, agentServiceId?: string): {
|
|
100
|
-
getResolvedAgentServiceId(): string | undefined;
|
|
101
|
-
createEngagement(payload: EngagementPayload): Promise<ApiResponse>;
|
|
102
|
-
updateEngagement(engagementId: string, payload: EngagementPayload): Promise<ApiResponse>;
|
|
103
|
-
createAgent(payload: AgentPayload): Promise<ApiResponse>;
|
|
104
|
-
updateAgent(agentId: string, payload: AgentUpdatePayload): Promise<ApiResponse>;
|
|
105
|
-
createWorkspaceOnRob(name: string): Promise<string>;
|
|
106
|
-
createWorkspace(payload: WorkspacePayload): Promise<ApiResponse>;
|
|
107
|
-
updateWorkspace(workspaceId: string, payload: WorkspacePayload): Promise<ApiResponse>;
|
|
108
|
-
getWorkspaces(): Promise<ApiListResponse<RemoteWorkspace>>;
|
|
109
|
-
createStream(workspaceId: string, payload: StreamPayload): Promise<ApiResponse>;
|
|
110
|
-
updateStream(streamId: string, payload: StreamPayload): Promise<ApiResponse>;
|
|
111
|
-
createDeployment(streamId: string, payload: DeploymentPayload): Promise<ApiResponse>;
|
|
112
|
-
updateDeployment(deploymentId: string, payload: DeploymentPayload): Promise<ApiResponse>;
|
|
113
|
-
createCubby(payload: CubbyCreatePayload): Promise<ApiResponse>;
|
|
114
|
-
updateCubby(cubbyId: string, payload: CubbyCreatePayload): Promise<ApiResponse>;
|
|
115
|
-
getAgents(): Promise<ApiListResponse<RemoteAgent>>;
|
|
116
|
-
getEngagements(): Promise<ApiListResponse<RemoteEngagement>>;
|
|
117
|
-
getOntology(): Promise<OntologyResponse>;
|
|
118
|
-
getCubbies(): Promise<RemoteCubby[]>;
|
|
119
|
-
getCubbyInstances(cubbyId: string): Promise<CubbyInstance[]>;
|
|
120
|
-
getCubbyStats(cubbyId: string): Promise<CubbyStats>;
|
|
121
|
-
deleteEngagement(engagementId: string): Promise<ApiResponse>;
|
|
122
|
-
deleteAgent(agentId: string): Promise<ApiResponse>;
|
|
123
|
-
deleteWorkspace(workspaceId: string): Promise<ApiResponse>;
|
|
124
|
-
deleteStream(streamId: string): Promise<ApiResponse>;
|
|
125
|
-
deleteDeployment(deploymentId: string): Promise<ApiResponse>;
|
|
126
|
-
createRaft(streamId: string, payload: RaftOrchestratorPayload): Promise<ApiResponse>;
|
|
127
|
-
updateRaft(raftId: string, payload: RaftOrchestratorPayload): Promise<ApiResponse>;
|
|
128
|
-
deleteRaft(raftId: string): Promise<ApiResponse>;
|
|
129
|
-
syncRaftToRob(payload: RaftRobPayload, method: "POST" | "PUT"): Promise<void>;
|
|
130
|
-
registerRaftOnRob(payload: RaftRobPayload): Promise<void>;
|
|
131
|
-
updateRaftOnRob(payload: RaftRobPayload): Promise<void>;
|
|
132
|
-
callTool(agentId: string, toolName: string, args: Record<string, unknown>): Promise<JsonRpcResponse>;
|
|
133
|
-
listTools(agentId: string): Promise<unknown>;
|
|
134
|
-
};
|
|
135
|
-
export type ApiClient = ReturnType<typeof createApiClient>;
|
|
136
|
-
export interface AgentService {
|
|
137
|
-
id: string;
|
|
138
|
-
name: string;
|
|
139
|
-
publicKey: string;
|
|
140
|
-
archived: boolean;
|
|
141
|
-
createdAt: string;
|
|
142
|
-
}
|
|
143
|
-
export declare function listAgentServices(robApiUrl: string, authToken: string): Promise<AgentService[]>;
|
|
144
|
-
export declare function createAgentServiceOnRob(robApiUrl: string, authToken: string, name: string, publicKey: string): Promise<AgentService>;
|
|
145
|
-
export declare function createAgentServiceOnOrchestrator(orchestratorUrl: string, authToken: string, bucketId: string, name: string): Promise<ApiResponse>;
|
|
146
|
-
export {};
|