@orchagent/cli 0.3.59 → 0.3.60

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.
@@ -248,7 +248,7 @@ function registerInitCommand(program) {
248
248
  }
249
249
  }
250
250
  if (initMode.flavor === 'direct_llm' && runMode === 'always_on') {
251
- throw new errors_1.CliError("run_mode=always_on requires a non-direct runtime. Use legacy '--type tool' or add runtime.command in orchagent.json.");
251
+ throw new errors_1.CliError("run_mode=always_on requires runtime.command in orchagent.json (e.g. \"runtime\": { \"command\": \"python main.py\" }).");
252
252
  }
253
253
  // Create manifest and type-specific files
254
254
  const manifest = JSON.parse(MANIFEST_TEMPLATE);
@@ -36,6 +36,11 @@ function resolveEngine(data) {
36
36
  if (ee === 'direct_llm' || ee === 'managed_loop' || ee === 'code_runtime') {
37
37
  return ee;
38
38
  }
39
+ const runtimeCommand = data.runtime?.command;
40
+ if (typeof runtimeCommand === 'string' && runtimeCommand.trim())
41
+ return 'code_runtime';
42
+ if (data.loop && Object.keys(data.loop).length > 0)
43
+ return 'managed_loop';
39
44
  const normalized = (data.type || '').toLowerCase();
40
45
  if (normalized === 'tool' || normalized === 'code')
41
46
  return 'code_runtime';
@@ -43,6 +48,15 @@ function resolveEngine(data) {
43
48
  return 'managed_loop';
44
49
  return 'direct_llm';
45
50
  }
51
+ function commandForEntrypoint(entrypoint) {
52
+ if (entrypoint.endsWith('.js')
53
+ || entrypoint.endsWith('.mjs')
54
+ || entrypoint.endsWith('.cjs')
55
+ || entrypoint.endsWith('.ts')) {
56
+ return `node ${entrypoint}`;
57
+ }
58
+ return `python ${entrypoint}`;
59
+ }
46
60
  // ─── Agent Resolution ───────────────────────────────────────────────────────
47
61
  async function resolveAgent(config, org, agent, version) {
48
62
  // 1. Try public download endpoint
@@ -55,10 +69,13 @@ async function resolveAgent(config, org, agent, version) {
55
69
  type: data.type || 'agent',
56
70
  run_mode: data.run_mode,
57
71
  execution_engine: data.execution_engine,
72
+ runtime: data.runtime,
73
+ loop: data.loop,
58
74
  callable: data.callable,
59
75
  prompt: data.prompt,
60
76
  input_schema: data.input_schema,
61
77
  output_schema: data.output_schema,
78
+ dependencies: data.dependencies,
62
79
  supported_providers: data.supported_providers,
63
80
  default_models: data.default_models,
64
81
  default_skills: data.default_skills,
@@ -133,7 +150,7 @@ async function tryOwnerFallback(config, org, agent, version) {
133
150
  }
134
151
  async function resolveFromMyAgents(config, agent, version, org) {
135
152
  const agents = await (0, api_1.listMyAgents)(config);
136
- const matching = agents.filter(a => a.name === agent);
153
+ const matching = agents.filter(a => a.name === agent && a.org_slug === org);
137
154
  if (matching.length === 0)
138
155
  return null;
139
156
  let target;
@@ -157,10 +174,13 @@ function mapAgentToPullData(agent) {
157
174
  type: agent.type,
158
175
  run_mode: agent.run_mode ?? null,
159
176
  execution_engine: agent.execution_engine ?? null,
177
+ runtime: agent.runtime ?? null,
178
+ loop: agent.loop ?? null,
160
179
  callable: agent.callable,
161
180
  prompt: agent.prompt,
162
181
  input_schema: agent.input_schema,
163
182
  output_schema: agent.output_schema,
183
+ dependencies: agent.manifest?.dependencies,
164
184
  supported_providers: agent.supported_providers,
165
185
  default_models: agent.default_models,
166
186
  tags: agent.tags,
@@ -207,6 +227,16 @@ function buildManifest(data) {
207
227
  // Engine-specific fields
208
228
  const engine = resolveEngine(data);
209
229
  if (engine === 'code_runtime') {
230
+ const runtime = (data.runtime && typeof data.runtime === 'object' && Object.keys(data.runtime).length > 0)
231
+ ? { ...data.runtime }
232
+ : undefined;
233
+ const runtimeCommand = (typeof runtime?.command === 'string' && runtime.command.trim())
234
+ ? runtime.command
235
+ : (data.run_command?.trim()
236
+ || (data.entrypoint ? commandForEntrypoint(data.entrypoint) : undefined));
237
+ if (runtimeCommand) {
238
+ manifest.runtime = { ...(runtime || {}), command: runtimeCommand };
239
+ }
210
240
  if (data.entrypoint && data.entrypoint !== 'sandbox_main.py') {
211
241
  manifest.entrypoint = data.entrypoint;
212
242
  }
@@ -217,9 +247,32 @@ function buildManifest(data) {
217
247
  if (data.run_command)
218
248
  manifest.run_command = data.run_command;
219
249
  }
250
+ if (engine === 'managed_loop') {
251
+ const loop = (data.loop && typeof data.loop === 'object' && Object.keys(data.loop).length > 0)
252
+ ? { ...data.loop }
253
+ : undefined;
254
+ if (loop) {
255
+ manifest.loop = loop;
256
+ const loopCustomTools = loop.custom_tools;
257
+ if (Array.isArray(loopCustomTools) && loopCustomTools.length > 0) {
258
+ manifest.custom_tools = loopCustomTools;
259
+ }
260
+ const loopMaxTurns = loop.max_turns;
261
+ if (typeof loopMaxTurns === 'number') {
262
+ manifest.max_turns = loopMaxTurns;
263
+ }
264
+ }
265
+ }
220
266
  // Include orchestration manifest if present (for dependencies, etc.)
221
267
  if (data.manifest && typeof data.manifest === 'object') {
222
268
  const m = { ...data.manifest };
269
+ if (data.dependencies
270
+ && data.dependencies.length > 0
271
+ && (!Array.isArray(m.dependencies)
272
+ || m.dependencies?.length === 0)) {
273
+ ;
274
+ m.dependencies = data.dependencies;
275
+ }
223
276
  // Clean up fields that are already top-level
224
277
  delete m.runtime;
225
278
  delete m.loop;
@@ -227,6 +280,9 @@ function buildManifest(data) {
227
280
  manifest.manifest = m;
228
281
  }
229
282
  }
283
+ else if (data.dependencies && data.dependencies.length > 0) {
284
+ manifest.manifest = { dependencies: data.dependencies };
285
+ }
230
286
  return manifest;
231
287
  }
232
288
  // ─── Bundle Download + Extraction ───────────────────────────────────────────
@@ -235,8 +291,11 @@ async function downloadBundle(config, org, agent, version, agentId) {
235
291
  return await (0, api_1.downloadCodeBundle)(config, org, agent, version);
236
292
  }
237
293
  catch (err) {
238
- if (!(err instanceof api_1.ApiError) || err.status !== 404)
294
+ if (!(err instanceof api_1.ApiError))
295
+ throw err;
296
+ if (err.status !== 404 && !(err.status === 403 && config.apiKey && agentId)) {
239
297
  throw err;
298
+ }
240
299
  }
241
300
  if (config.apiKey && agentId) {
242
301
  try {
@@ -174,7 +174,7 @@ function registerServiceCommand(program) {
174
174
  process.stdout.write(` ${chalk_1.default.bold('Name:')} ${svc.service_name}\n`);
175
175
  process.stdout.write(` ${chalk_1.default.bold('Agent:')} ${svc.agent_name}@${svc.agent_version}\n`);
176
176
  process.stdout.write(` ${chalk_1.default.bold('State:')} ${stateColor(svc.current_state)}\n`);
177
- process.stdout.write(` ${chalk_1.default.bold('URL:')} ${svc.cloud_run_url || '-'}\n`);
177
+ process.stdout.write(` ${chalk_1.default.bold('URL:')} ${svc.provider_url || svc.cloud_run_url || '-'}\n`);
178
178
  process.stdout.write(`\n`);
179
179
  process.stdout.write(chalk_1.default.gray(`View logs: orch service logs ${svc.id}\n`));
180
180
  }
@@ -334,8 +334,8 @@ function registerServiceCommand(program) {
334
334
  process.stdout.write(` Fail Streak: ${chalk_1.default.red(String(svc.consecutive_restart_failures))} / ${svc.max_restart_failures}\n`);
335
335
  }
336
336
  process.stdout.write(` Instances: ${svc.min_instances}-${svc.max_instances}\n`);
337
- process.stdout.write(` Cloud Run: ${svc.cloud_run_service || '-'}\n`);
338
- process.stdout.write(` URL: ${svc.cloud_run_url || '-'}\n`);
337
+ process.stdout.write(` Service ID: ${svc.provider_service_id || svc.cloud_run_service || '-'}\n`);
338
+ process.stdout.write(` URL: ${svc.provider_url || svc.cloud_run_url || '-'}\n`);
339
339
  process.stdout.write(` Deployed: ${formatDate(svc.last_deployed_at)}\n`);
340
340
  process.stdout.write(` Last Restart: ${formatDate(svc.last_restart_at)}\n`);
341
341
  if (svc.last_error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchagent/cli",
3
- "version": "0.3.59",
3
+ "version": "0.3.60",
4
4
  "description": "Command-line interface for orchagent — deploy and run AI agents for your team",
5
5
  "license": "MIT",
6
6
  "author": "orchagent <hello@orchagent.io>",