@cef-ai/cli 0.2.5 → 0.2.7
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 +2 -2
- package/dist/cli.js +1 -1
- package/dist/commands/deploy/index.js +1 -1
- package/dist/commands/service/index.js +22 -8
- package/dist/lib/api.d.ts +2 -2
- package/dist/lib/api.js +4 -4
- package/dist/lib/config.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -510,7 +510,7 @@ cef service create --name my-agent --bucket-id 1505
|
|
|
510
510
|
|-|-|-|-|
|
|
511
511
|
| `--name <name>` | - | Yes | Name of the new agent service |
|
|
512
512
|
| `--config <path>` | `./cef.config.yaml` | No | Path to config file |
|
|
513
|
-
| `--bucket-id <id>` | `
|
|
513
|
+
| `--bucket-id <id>` | `1` | No | DDC bucket ID |
|
|
514
514
|
|
|
515
515
|
Requires `CEF_ROB_API_URL` (defaults to stage URL if not set).
|
|
516
516
|
|
|
@@ -1042,7 +1042,7 @@ To override URLs, set them as environment variables or in a `.env` file next to
|
|
|
1042
1042
|
| `--output-dir <dir>` | clone | (config dir) | Directory to write cloned files into |
|
|
1043
1043
|
| `--force` | clone, delete | `false` | Skip confirmation / overwrite existing files |
|
|
1044
1044
|
| `--name <name>` | service create | - | Name of the new agent service (required) |
|
|
1045
|
-
| `--bucket-id <id>` | service create | `
|
|
1045
|
+
| `--bucket-id <id>` | service create | `1` | DDC bucket ID |
|
|
1046
1046
|
| `--port <port>` | dev | `8787` | Server port |
|
|
1047
1047
|
| `--host <host>` | dev | `localhost` | Server host |
|
|
1048
1048
|
| `--persist` | dev | `false` | Keep `.cef-dev/` data after shutdown |
|
package/dist/cli.js
CHANGED
|
@@ -34,7 +34,7 @@ function showWelcome(version) {
|
|
|
34
34
|
|
|
35
35
|
\x1b[33m$\x1b[0m cef service list List agent services
|
|
36
36
|
\x1b[33m$\x1b[0m cef service create Create a new agent service
|
|
37
|
-
\x1b[33m$\x1b[0m cef clone --pubkey
|
|
37
|
+
\x1b[33m$\x1b[0m cef clone --pubkey <key> Download existing service
|
|
38
38
|
\x1b[33m$\x1b[0m cef delete Delete deployed entities
|
|
39
39
|
\x1b[33m$\x1b[0m cef --help Show all options
|
|
40
40
|
|
|
@@ -202,7 +202,7 @@ export function registerDeployCommands(program) {
|
|
|
202
202
|
.command('clone')
|
|
203
203
|
.description('Download an existing agent service')
|
|
204
204
|
.option('--config <path>', 'Config file path', './cef.config.yaml')
|
|
205
|
-
.option('--pubkey <key>', 'Agent service public key (
|
|
205
|
+
.option('--pubkey <key>', 'Agent service public key (64-char hex)')
|
|
206
206
|
.option('--output-dir <dir>', 'Directory to write files into')
|
|
207
207
|
.option('--force', 'Overwrite existing files')
|
|
208
208
|
.action(handleClone);
|
|
@@ -40,16 +40,30 @@ async function handleCreate(opts) {
|
|
|
40
40
|
process.exit(1);
|
|
41
41
|
}
|
|
42
42
|
try {
|
|
43
|
-
console.log(`Creating agent service "${opts.name}" on
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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}`);
|
|
49
63
|
console.log(`\nAgent service created:`);
|
|
50
64
|
console.log(` name: ${service.name}`);
|
|
51
65
|
console.log(` agentServiceId: ${service.id}`);
|
|
52
|
-
console.log(` agentServicePubKey: ${
|
|
66
|
+
console.log(` agentServicePubKey: ${agentServicePubKey}`);
|
|
53
67
|
}
|
|
54
68
|
catch (err) {
|
|
55
69
|
console.error(`Create service failed: ${errorMessage(err)}`);
|
|
@@ -70,6 +84,6 @@ export function registerServiceCommands(program) {
|
|
|
70
84
|
.description('Create a new agent service')
|
|
71
85
|
.requiredOption('--name <name>', 'Name of the new agent service')
|
|
72
86
|
.option('--config <path>', 'Config file path', './cef.config.yaml')
|
|
73
|
-
.option('--bucket-id <id>', 'DDC bucket ID', '
|
|
87
|
+
.option('--bucket-id <id>', 'DDC bucket ID', '1')
|
|
74
88
|
.action(handleCreate);
|
|
75
89
|
}
|
package/dist/lib/api.d.ts
CHANGED
|
@@ -141,6 +141,6 @@ export interface AgentService {
|
|
|
141
141
|
createdAt: string;
|
|
142
142
|
}
|
|
143
143
|
export declare function listAgentServices(robApiUrl: string, authToken: string): Promise<AgentService[]>;
|
|
144
|
-
export declare function createAgentServiceOnRob(robApiUrl: string, authToken: string, name: string): Promise<AgentService>;
|
|
145
|
-
export declare function createAgentServiceOnOrchestrator(orchestratorUrl: string, authToken: string,
|
|
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
146
|
export {};
|
package/dist/lib/api.js
CHANGED
|
@@ -300,14 +300,14 @@ export async function listAgentServices(robApiUrl, authToken) {
|
|
|
300
300
|
});
|
|
301
301
|
return (res.data ?? []);
|
|
302
302
|
}
|
|
303
|
-
export async function createAgentServiceOnRob(robApiUrl, authToken, name) {
|
|
303
|
+
export async function createAgentServiceOnRob(robApiUrl, authToken, name, publicKey) {
|
|
304
304
|
const res = await request(robApiUrl + '/data-services', {
|
|
305
305
|
method: 'POST',
|
|
306
306
|
headers: {
|
|
307
307
|
'Content-Type': 'application/json',
|
|
308
308
|
Authorization: `Bearer ${authToken}`,
|
|
309
309
|
},
|
|
310
|
-
body: JSON.stringify({ name }),
|
|
310
|
+
body: JSON.stringify({ name, publicKey }),
|
|
311
311
|
});
|
|
312
312
|
const data = (res.data ?? res);
|
|
313
313
|
return {
|
|
@@ -318,13 +318,13 @@ export async function createAgentServiceOnRob(robApiUrl, authToken, name) {
|
|
|
318
318
|
createdAt: String(data.createdAt ?? ''),
|
|
319
319
|
};
|
|
320
320
|
}
|
|
321
|
-
export async function createAgentServiceOnOrchestrator(orchestratorUrl, authToken,
|
|
321
|
+
export async function createAgentServiceOnOrchestrator(orchestratorUrl, authToken, bucketId, name) {
|
|
322
322
|
return request(`${orchestratorUrl}/api/v1/agent-services`, {
|
|
323
323
|
method: 'POST',
|
|
324
324
|
headers: {
|
|
325
325
|
'Content-Type': 'application/json',
|
|
326
326
|
Authorization: `Bearer ${authToken}`,
|
|
327
327
|
},
|
|
328
|
-
body: JSON.stringify({
|
|
328
|
+
body: JSON.stringify({ bucketId, name }),
|
|
329
329
|
});
|
|
330
330
|
}
|
package/dist/lib/config.js
CHANGED
|
@@ -12,8 +12,8 @@ export function validateConfig(config) {
|
|
|
12
12
|
if (!config.agentServicePubKey || typeof config.agentServicePubKey !== 'string') {
|
|
13
13
|
throw new Error('Config missing required field: agentServicePubKey (string)');
|
|
14
14
|
}
|
|
15
|
-
if (!/^0x[0-9a-fA-F]{64}$/.test(config.agentServicePubKey)) {
|
|
16
|
-
throw new Error('Config field agentServicePubKey must be a 64-character hex string
|
|
15
|
+
if (!/^(0x)?[0-9a-fA-F]{64}$/.test(config.agentServicePubKey)) {
|
|
16
|
+
throw new Error('Config field agentServicePubKey must be a 64-character hex string (with or without 0x prefix)');
|
|
17
17
|
}
|
|
18
18
|
for (const section of ['engagements', 'agents', 'cubbies', 'workspaces']) {
|
|
19
19
|
const value = config[section];
|