@orchagent/cli 0.3.59 → 0.3.61

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.
@@ -165,30 +165,27 @@ license: MIT
165
165
  Instructions and guidance for AI agents...
166
166
  `;
167
167
  function resolveInitFlavor(typeOption) {
168
- const normalized = (typeOption || 'agent').trim().toLowerCase();
168
+ const normalized = (typeOption || 'prompt').trim().toLowerCase();
169
169
  if (normalized === 'skill') {
170
170
  return { type: 'skill' };
171
171
  }
172
- if (normalized === 'agent') {
173
- return { type: 'agent', flavor: 'direct_llm' };
174
- }
175
172
  if (normalized === 'prompt') {
176
- return { type: 'agent', flavor: 'direct_llm' };
173
+ return { type: 'prompt', flavor: 'direct_llm' };
177
174
  }
178
- if (normalized === 'agentic') {
175
+ if (normalized === 'agent' || normalized === 'agentic') {
179
176
  return { type: 'agent', flavor: 'managed_loop' };
180
177
  }
181
178
  if (normalized === 'tool' || normalized === 'code') {
182
- return { type: 'agent', flavor: 'code_runtime' };
179
+ return { type: 'tool', flavor: 'code_runtime' };
183
180
  }
184
- throw new errors_1.CliError(`Unknown --type '${typeOption}'. Use 'agent' or 'skill' (legacy: prompt, tool, agentic, code).`);
181
+ throw new errors_1.CliError(`Unknown --type '${typeOption}'. Use 'prompt', 'tool', 'agent', or 'skill' (legacy aliases: agentic, code).`);
185
182
  }
186
183
  function registerInitCommand(program) {
187
184
  program
188
185
  .command('init')
189
186
  .description('Initialize a new agent project')
190
187
  .argument('[name]', 'Agent name (default: current directory name)')
191
- .option('--type <type>', 'Type: agent or skill (legacy: prompt, tool, agentic, code)', 'agent')
188
+ .option('--type <type>', 'Type: prompt, tool, agent, or skill (legacy aliases: agentic, code)', 'prompt')
192
189
  .option('--run-mode <mode>', 'Run mode for agents: on_demand or always_on', 'on_demand')
193
190
  .action(async (name, options) => {
194
191
  const cwd = process.cwd();
@@ -247,13 +244,13 @@ function registerInitCommand(program) {
247
244
  throw err;
248
245
  }
249
246
  }
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.");
247
+ if (initMode.flavor !== 'code_runtime' && runMode === 'always_on') {
248
+ throw new errors_1.CliError("run_mode=always_on requires runtime.command in orchagent.json (e.g. \"runtime\": { \"command\": \"python main.py\" }). Use --type tool for code-runtime agents.");
252
249
  }
253
250
  // Create manifest and type-specific files
254
251
  const manifest = JSON.parse(MANIFEST_TEMPLATE);
255
252
  manifest.name = agentName;
256
- manifest.type = 'agent';
253
+ manifest.type = initMode.type;
257
254
  manifest.run_mode = runMode;
258
255
  if (initMode.flavor === 'managed_loop') {
259
256
  manifest.description = 'An AI agent with tool use';
@@ -163,13 +163,17 @@ async function collectSkillFiles(skillDir, maxFiles = 20, maxTotalSize = 500_000
163
163
  }
164
164
  function canonicalizeManifestType(typeValue) {
165
165
  const rawType = (typeValue || 'agent').trim().toLowerCase();
166
- if (rawType === 'skill') {
167
- return { canonicalType: 'skill', rawType };
166
+ if (['prompt', 'tool', 'agent', 'skill'].includes(rawType)) {
167
+ return { canonicalType: rawType, rawType };
168
168
  }
169
- if (['agent', 'prompt', 'tool', 'agentic', 'code'].includes(rawType)) {
169
+ // Legacy aliases
170
+ if (rawType === 'agentic') {
170
171
  return { canonicalType: 'agent', rawType };
171
172
  }
172
- throw new errors_1.CliError(`Invalid type '${typeValue}'. Use 'agent' or 'skill' (legacy values accepted: prompt, tool, agentic, code).`);
173
+ if (rawType === 'code') {
174
+ return { canonicalType: 'tool', rawType };
175
+ }
176
+ throw new errors_1.CliError(`Invalid type '${typeValue}'. Use 'prompt', 'tool', 'agent', or 'skill' (legacy aliases: agentic, code).`);
173
177
  }
174
178
  function normalizeRunMode(runMode) {
175
179
  const normalized = (runMode || 'on_demand').trim().toLowerCase();
@@ -726,6 +730,10 @@ function registerPublishCommand(program) {
726
730
  process.stdout.write(` ${chalk_1.default.cyan('Using workspace default environment')}\n`);
727
731
  }
728
732
  }
733
+ // Show service auto-update info
734
+ if (uploadResult.services_updated && uploadResult.services_updated > 0) {
735
+ process.stdout.write(` ${chalk_1.default.green(`Updated ${uploadResult.services_updated} service(s) to ${assignedVersion}`)}\n`);
736
+ }
729
737
  }
730
738
  finally {
731
739
  // Clean up temp files
@@ -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.61",
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>",