@orchagent/cli 0.3.73 → 0.3.75
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/commands/pull.js +26 -21
- package/dist/commands/run.js +1 -1
- package/dist/commands/schedule.js +19 -2
- package/package.json +1 -1
package/dist/commands/pull.js
CHANGED
|
@@ -310,7 +310,7 @@ async function downloadBundle(config, org, agent, version, agentId) {
|
|
|
310
310
|
}
|
|
311
311
|
async function unzipBundle(zipPath, destDir) {
|
|
312
312
|
return new Promise((resolve, reject) => {
|
|
313
|
-
const proc = (0, child_process_1.spawn)('unzip', ['-q', zipPath, '-d', destDir], {
|
|
313
|
+
const proc = (0, child_process_1.spawn)('unzip', ['-o', '-q', zipPath, '-d', destDir], {
|
|
314
314
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
315
315
|
});
|
|
316
316
|
let stderr = '';
|
|
@@ -397,26 +397,12 @@ Examples:
|
|
|
397
397
|
const filesWritten = [];
|
|
398
398
|
const warnings = [];
|
|
399
399
|
let bundleExtracted = false;
|
|
400
|
-
//
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
//
|
|
405
|
-
|
|
406
|
-
await promises_1.default.writeFile(path_1.default.join(outputDir, 'prompt.md'), data.prompt);
|
|
407
|
-
filesWritten.push('prompt.md');
|
|
408
|
-
}
|
|
409
|
-
// Write schema.json (if schemas exist)
|
|
410
|
-
if (data.input_schema || data.output_schema) {
|
|
411
|
-
const schema = {};
|
|
412
|
-
if (data.input_schema)
|
|
413
|
-
schema.input = data.input_schema;
|
|
414
|
-
if (data.output_schema)
|
|
415
|
-
schema.output = data.output_schema;
|
|
416
|
-
await promises_1.default.writeFile(path_1.default.join(outputDir, 'schema.json'), JSON.stringify(schema, null, 2) + '\n');
|
|
417
|
-
filesWritten.push('schema.json');
|
|
418
|
-
}
|
|
419
|
-
// Bundle download for code_runtime agents
|
|
400
|
+
// Extract bundle FIRST for code_runtime agents.
|
|
401
|
+
// Metadata files (orchagent.json, schema.json) are written AFTER so they
|
|
402
|
+
// always take precedence over anything the bundle may contain. This also
|
|
403
|
+
// avoids the interactive overwrite prompt that `unzip` issues when a file
|
|
404
|
+
// already exists on disk — in non-interactive shells the prompt causes EOF
|
|
405
|
+
// and exit-code 1.
|
|
420
406
|
if (engine === 'code_runtime' && data.has_bundle) {
|
|
421
407
|
write('Downloading code bundle...\n');
|
|
422
408
|
const bundle = await downloadBundle(config, org, data.name, data.version, data.agentId);
|
|
@@ -441,6 +427,25 @@ Examples:
|
|
|
441
427
|
else if (engine === 'code_runtime' && !data.has_bundle) {
|
|
442
428
|
warnings.push('No downloadable bundle available for this version.');
|
|
443
429
|
}
|
|
430
|
+
// Write orchagent.json (after bundle extraction so it always wins)
|
|
431
|
+
const manifest = buildManifest(data);
|
|
432
|
+
await promises_1.default.writeFile(path_1.default.join(outputDir, 'orchagent.json'), JSON.stringify(manifest, null, 2) + '\n');
|
|
433
|
+
filesWritten.push('orchagent.json');
|
|
434
|
+
// Write prompt.md (for prompt-driven engines)
|
|
435
|
+
if (data.prompt && (engine === 'direct_llm' || engine === 'managed_loop')) {
|
|
436
|
+
await promises_1.default.writeFile(path_1.default.join(outputDir, 'prompt.md'), data.prompt);
|
|
437
|
+
filesWritten.push('prompt.md');
|
|
438
|
+
}
|
|
439
|
+
// Write schema.json (if schemas exist)
|
|
440
|
+
if (data.input_schema || data.output_schema) {
|
|
441
|
+
const schema = {};
|
|
442
|
+
if (data.input_schema)
|
|
443
|
+
schema.input = data.input_schema;
|
|
444
|
+
if (data.output_schema)
|
|
445
|
+
schema.output = data.output_schema;
|
|
446
|
+
await promises_1.default.writeFile(path_1.default.join(outputDir, 'schema.json'), JSON.stringify(schema, null, 2) + '\n');
|
|
447
|
+
filesWritten.push('schema.json');
|
|
448
|
+
}
|
|
444
449
|
// Track analytics
|
|
445
450
|
await (0, analytics_1.track)('cli_pull', {
|
|
446
451
|
org,
|
package/dist/commands/run.js
CHANGED
|
@@ -1002,7 +1002,7 @@ async function executeTool(agentData, args) {
|
|
|
1002
1002
|
}
|
|
1003
1003
|
async function unzipBundle(zipPath, destDir) {
|
|
1004
1004
|
return new Promise((resolve, reject) => {
|
|
1005
|
-
const proc = (0, child_process_1.spawn)('unzip', ['-q', zipPath, '-d', destDir], {
|
|
1005
|
+
const proc = (0, child_process_1.spawn)('unzip', ['-o', '-q', zipPath, '-d', destDir], {
|
|
1006
1006
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
1007
1007
|
});
|
|
1008
1008
|
let stderr = '';
|
|
@@ -43,6 +43,21 @@ function statusColor(status) {
|
|
|
43
43
|
default: return status;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
+
async function resolveScheduleId(config, partialId, workspaceId) {
|
|
47
|
+
// If it looks like a full UUID already, return as-is
|
|
48
|
+
if (partialId.length >= 32)
|
|
49
|
+
return partialId;
|
|
50
|
+
// Fetch schedules and match by prefix
|
|
51
|
+
const response = await (0, api_1.request)(config, 'GET', `/workspaces/${workspaceId}/schedules?limit=200`);
|
|
52
|
+
const matches = response.schedules.filter((s) => s.id.startsWith(partialId));
|
|
53
|
+
if (matches.length === 0) {
|
|
54
|
+
throw new errors_1.CliError(`No schedule found matching '${partialId}'`);
|
|
55
|
+
}
|
|
56
|
+
if (matches.length > 1) {
|
|
57
|
+
throw new errors_1.CliError(`Ambiguous schedule ID '${partialId}' matches ${matches.length} schedules. Use a longer prefix.`);
|
|
58
|
+
}
|
|
59
|
+
return matches[0].id;
|
|
60
|
+
}
|
|
46
61
|
// ============================================
|
|
47
62
|
// COMMAND REGISTRATION
|
|
48
63
|
// ============================================
|
|
@@ -283,12 +298,13 @@ function registerScheduleCommand(program) {
|
|
|
283
298
|
.description('Manually trigger a schedule execution')
|
|
284
299
|
.option('--input <json>', 'Override input data as JSON')
|
|
285
300
|
.option('--workspace <slug>', 'Workspace slug (default: current workspace)')
|
|
286
|
-
.action(async (
|
|
301
|
+
.action(async (partialScheduleId, options) => {
|
|
287
302
|
const config = await (0, config_1.getResolvedConfig)();
|
|
288
303
|
if (!config.apiKey) {
|
|
289
304
|
throw new errors_1.CliError('Missing API key. Run `orch login` first.');
|
|
290
305
|
}
|
|
291
306
|
const workspaceId = await resolveWorkspaceId(config, options.workspace);
|
|
307
|
+
const scheduleId = await resolveScheduleId(config, partialScheduleId, workspaceId);
|
|
292
308
|
let body;
|
|
293
309
|
if (options.input) {
|
|
294
310
|
try {
|
|
@@ -323,12 +339,13 @@ function registerScheduleCommand(program) {
|
|
|
323
339
|
.description('Show detailed schedule information with recent runs and events')
|
|
324
340
|
.option('--workspace <slug>', 'Workspace slug (default: current workspace)')
|
|
325
341
|
.option('--json', 'Output as JSON')
|
|
326
|
-
.action(async (
|
|
342
|
+
.action(async (partialScheduleId, options) => {
|
|
327
343
|
const config = await (0, config_1.getResolvedConfig)();
|
|
328
344
|
if (!config.apiKey) {
|
|
329
345
|
throw new errors_1.CliError('Missing API key. Run `orch login` first.');
|
|
330
346
|
}
|
|
331
347
|
const workspaceId = await resolveWorkspaceId(config, options.workspace);
|
|
348
|
+
const scheduleId = await resolveScheduleId(config, partialScheduleId, workspaceId);
|
|
332
349
|
const [scheduleRes, runsRes, eventsRes] = await Promise.all([
|
|
333
350
|
(0, api_1.request)(config, 'GET', `/workspaces/${workspaceId}/schedules/${scheduleId}`),
|
|
334
351
|
(0, api_1.request)(config, 'GET', `/workspaces/${workspaceId}/schedules/${scheduleId}/runs?limit=5`),
|
package/package.json
CHANGED