@cef-ai/cli 0.2.6 → 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/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 0x... Download existing service
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 (0x...)')
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 ROB...`);
44
- const service = await createAgentServiceOnRob(env.robApiUrl, env.authToken, opts.name);
45
- console.log(` ROB registered: id=${service.id}, publicKey=${service.publicKey}`);
46
- console.log(`Creating agent service on orchestrator...`);
47
- await createAgentServiceOnOrchestrator(env.orchestratorUrl, env.authToken, service.publicKey, opts.bucketId, opts.name);
48
- console.log(` Orchestrator registered.`);
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: ${service.publicKey}`);
66
+ console.log(` agentServicePubKey: ${agentServicePubKey}`);
53
67
  }
54
68
  catch (err) {
55
69
  console.error(`Create service failed: ${errorMessage(err)}`);
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, agentServicePubKey: string, bucketId: string, name: string): Promise<ApiResponse>;
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, agentServicePubKey, bucketId, name) {
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({ agentServicePubKey, bucketId, name }),
328
+ body: JSON.stringify({ bucketId, name }),
329
329
  });
330
330
  }
@@ -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 prefixed with 0x');
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];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cef-ai/cli",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "CEF AI command-line interface",
5
5
  "type": "module",
6
6
  "bin": {