@orchagent/cli 0.3.71 → 0.3.72

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.
@@ -514,6 +514,70 @@ if __name__ == "__main__":
514
514
  `;
515
515
  const ORCHESTRATOR_REQUIREMENTS = `orchagent-sdk>=0.1.0
516
516
  `;
517
+ const ORCHESTRATOR_MAIN_JS = `/**
518
+ * orchagent orchestrator entrypoint.
519
+ *
520
+ * Reads JSON input from stdin, calls dependency agents via the orchagent SDK,
521
+ * and writes JSON output to stdout.
522
+ *
523
+ * Usage:
524
+ * echo '{"task": "do something"}' | node main.js
525
+ */
526
+
527
+ const fs = require('fs');
528
+ const { AgentClient } = require('orchagent-sdk');
529
+
530
+ async function main() {
531
+ // Read JSON input from stdin
532
+ const raw = fs.readFileSync('/dev/stdin', 'utf-8');
533
+ let data;
534
+ try {
535
+ data = raw.trim() ? JSON.parse(raw) : {};
536
+ } catch {
537
+ console.log(JSON.stringify({ error: 'Invalid JSON input' }));
538
+ process.exit(1);
539
+ }
540
+
541
+ const task = data.task || '';
542
+
543
+ // --- Your orchestration logic here ---
544
+ // The AgentClient reads ORCHAGENT_SERVICE_KEY from the environment automatically.
545
+ // Do NOT add ORCHAGENT_SERVICE_KEY to required_secrets — the gateway injects it.
546
+ const client = new AgentClient();
547
+
548
+ // Call a dependency agent (must be listed in manifest.dependencies)
549
+ const result = await client.call('org/agent-name@v1', { input: task });
550
+
551
+ // You can chain multiple calls, run them in parallel, or add conditional logic:
552
+ //
553
+ // Sequential:
554
+ // const result2 = await client.call('org/another-agent@v1', { input: result });
555
+ //
556
+ // Parallel:
557
+ // const [r1, r2] = await Promise.all([
558
+ // client.call('org/agent-a@v1', { input: task }),
559
+ // client.call('org/agent-b@v1', { input: task }),
560
+ // ]);
561
+ // --- End orchestration logic ---
562
+
563
+ // Write JSON output to stdout
564
+ console.log(JSON.stringify({ result, success: true }));
565
+ }
566
+
567
+ main().catch(err => {
568
+ console.error(err);
569
+ process.exit(1);
570
+ });
571
+ `;
572
+ const ORCHESTRATOR_PACKAGE_JSON = `{
573
+ "name": "orchestrator",
574
+ "private": true,
575
+ "type": "commonjs",
576
+ "dependencies": {
577
+ "orchagent-sdk": "^0.1.0"
578
+ }
579
+ }
580
+ `;
517
581
  const DISCORD_MAIN_PY = `"""
518
582
  Discord bot agent — powered by Claude.
519
583
 
@@ -729,9 +793,7 @@ function registerInitCommand(program) {
729
793
  if (isJavaScript && initMode.flavor === 'managed_loop') {
730
794
  throw new errors_1.CliError('JavaScript agent-type agents are not yet supported. Use --type tool for JavaScript agents.');
731
795
  }
732
- if (isJavaScript && options.orchestrator) {
733
- throw new errors_1.CliError('JavaScript orchestrators are not yet supported. Use Python for orchestrator agents.');
734
- }
796
+ // JS orchestrators are now supported via the orchagent-sdk npm package
735
797
  if (options.template) {
736
798
  const template = options.template.trim().toLowerCase();
737
799
  const validTemplates = ['support-agent', 'discord', 'discord-js', 'github-weekly-summary'];
@@ -869,6 +931,7 @@ function registerInitCommand(program) {
869
931
  process.stdout.write(` ${s + 2}. Copy .env.example to .env and add platform tokens\n`);
870
932
  process.stdout.write(` ${s + 3}. Test locally: pip install -r requirements.txt && python main.py\n`);
871
933
  process.stdout.write(` ${s + 4}. Deploy: orch publish && orch service deploy\n`);
934
+ process.stdout.write(`\n Skill: orch skill install orchagent/agent-builder — gives your AI the full platform builder reference\n`);
872
935
  return;
873
936
  }
874
937
  // Handle github-weekly-summary template separately (own file set + output)
@@ -924,6 +987,7 @@ function registerInitCommand(program) {
924
987
  process.stdout.write(` ${s + 3}. orch run <org>/${agentName} Test it\n`);
925
988
  process.stdout.write(` ${s + 4}. orch schedule create <org>/${agentName} --cron "0 9 * * 1" Schedule weekly\n`);
926
989
  process.stdout.write(`\n See README.md for full setup guide.\n`);
990
+ process.stdout.write(`\n Skill: orch skill install orchagent/agent-builder — gives your AI the full platform builder reference\n`);
927
991
  return;
928
992
  }
929
993
  // Handle discord-js template separately (JS Discord bot)
@@ -973,6 +1037,7 @@ function registerInitCommand(program) {
973
1037
  process.stdout.write(` ${stepNum + 2}. Copy .env.example to .env and fill in your tokens\n`);
974
1038
  process.stdout.write(` ${stepNum + 3}. Test locally: npm install && node main.js\n`);
975
1039
  process.stdout.write(` ${stepNum + 4}. Deploy: orch publish\n`);
1040
+ process.stdout.write(`\n Skill: orch skill install orchagent/agent-builder — gives your AI the full platform builder reference\n`);
976
1041
  return;
977
1042
  }
978
1043
  const manifestPath = path_1.default.join(targetDir, 'orchagent.json');
@@ -998,7 +1063,13 @@ function registerInitCommand(program) {
998
1063
  manifest.run_mode = runMode;
999
1064
  if (initMode.flavor === 'orchestrator') {
1000
1065
  manifest.description = 'An orchestrator agent that coordinates other agents';
1001
- manifest.runtime = { command: 'python main.py' };
1066
+ if (isJavaScript) {
1067
+ manifest.runtime = { command: 'node main.js' };
1068
+ manifest.entrypoint = 'main.js';
1069
+ }
1070
+ else {
1071
+ manifest.runtime = { command: 'python main.py' };
1072
+ }
1002
1073
  manifest.manifest = {
1003
1074
  manifest_version: 1,
1004
1075
  dependencies: [{ id: 'org/agent-name', version: 'v1' }],
@@ -1034,10 +1105,14 @@ function registerInitCommand(program) {
1034
1105
  }
1035
1106
  await promises_1.default.writeFile(manifestPath, JSON.stringify(manifest, null, 2) + '\n');
1036
1107
  if (initMode.flavor === 'orchestrator') {
1037
- const entrypointPath = path_1.default.join(targetDir, 'main.py');
1038
- const requirementsPath = path_1.default.join(targetDir, 'requirements.txt');
1039
- await promises_1.default.writeFile(entrypointPath, ORCHESTRATOR_MAIN_PY);
1040
- await promises_1.default.writeFile(requirementsPath, ORCHESTRATOR_REQUIREMENTS);
1108
+ if (isJavaScript) {
1109
+ await promises_1.default.writeFile(path_1.default.join(targetDir, 'main.js'), ORCHESTRATOR_MAIN_JS);
1110
+ await promises_1.default.writeFile(path_1.default.join(targetDir, 'package.json'), ORCHESTRATOR_PACKAGE_JSON);
1111
+ }
1112
+ else {
1113
+ await promises_1.default.writeFile(path_1.default.join(targetDir, 'main.py'), ORCHESTRATOR_MAIN_PY);
1114
+ await promises_1.default.writeFile(path_1.default.join(targetDir, 'requirements.txt'), ORCHESTRATOR_REQUIREMENTS);
1115
+ }
1041
1116
  await promises_1.default.writeFile(schemaPath, AGENT_SCHEMA_TEMPLATE);
1042
1117
  }
1043
1118
  else if (initMode.flavor === 'discord') {
@@ -1079,8 +1154,14 @@ function registerInitCommand(program) {
1079
1154
  const prefix = name ? name + '/' : '';
1080
1155
  process.stdout.write(` ${prefix}orchagent.json - Agent configuration\n`);
1081
1156
  if (initMode.flavor === 'orchestrator') {
1082
- process.stdout.write(` ${prefix}main.py - Orchestrator entrypoint (SDK calls)\n`);
1083
- process.stdout.write(` ${prefix}requirements.txt - Python dependencies (orchagent-sdk)\n`);
1157
+ if (isJavaScript) {
1158
+ process.stdout.write(` ${prefix}main.js - Orchestrator entrypoint (SDK calls)\n`);
1159
+ process.stdout.write(` ${prefix}package.json - npm dependencies (orchagent-sdk)\n`);
1160
+ }
1161
+ else {
1162
+ process.stdout.write(` ${prefix}main.py - Orchestrator entrypoint (SDK calls)\n`);
1163
+ process.stdout.write(` ${prefix}requirements.txt - Python dependencies (orchagent-sdk)\n`);
1164
+ }
1084
1165
  }
1085
1166
  else if (initMode.flavor === 'discord') {
1086
1167
  process.stdout.write(` ${prefix}main.py - Discord bot (discord.py + Anthropic)\n`);
@@ -1112,7 +1193,12 @@ function registerInitCommand(program) {
1112
1193
  process.stdout.write(` 1. cd ${name}\n`);
1113
1194
  }
1114
1195
  process.stdout.write(` ${stepNum}. Update manifest.dependencies in orchagent.json with your actual agents\n`);
1115
- process.stdout.write(` ${stepNum + 1}. Edit main.py with your orchestration logic\n`);
1196
+ if (isJavaScript) {
1197
+ process.stdout.write(` ${stepNum + 1}. Edit main.js with your orchestration logic\n`);
1198
+ }
1199
+ else {
1200
+ process.stdout.write(` ${stepNum + 1}. Edit main.py with your orchestration logic\n`);
1201
+ }
1116
1202
  process.stdout.write(` ${stepNum + 2}. Publish dependency agents first, then: orchagent publish\n`);
1117
1203
  }
1118
1204
  else if (initMode.flavor === 'discord') {
@@ -1153,5 +1239,6 @@ function registerInitCommand(program) {
1153
1239
  process.stdout.write(` ${stepNum + 1}. Edit schema.json with your input/output schemas\n`);
1154
1240
  process.stdout.write(` ${stepNum + 2}. Run: orchagent publish\n`);
1155
1241
  }
1242
+ process.stdout.write(`\n Skill: orch skill install orchagent/agent-builder — gives your AI the full platform builder reference\n`);
1156
1243
  });
1157
1244
  }
@@ -1040,5 +1040,6 @@ function registerPublishCommand(program) {
1040
1040
  process.stdout.write(`\nNote: Hosted code execution is in beta. Contact support for full deployment.\n`);
1041
1041
  }
1042
1042
  process.stdout.write(`\nView analytics and usage: https://orchagent.io/dashboard\n`);
1043
+ process.stdout.write(`\nSkill: orch skill install orchagent/agent-builder — gives your AI the full platform builder reference\n`);
1043
1044
  });
1044
1045
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchagent/cli",
3
- "version": "0.3.71",
3
+ "version": "0.3.72",
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>",