@openagentpack/cli 0.1.0 → 0.2.0-beta.0

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.
@@ -3,7 +3,7 @@ import {
3
3
  configureLogger,
4
4
  log,
5
5
  program
6
- } from "../chunk-XRJ6J5YM.js";
6
+ } from "../chunk-W5APGQN3.js";
7
7
 
8
8
  // bin/agents.ts
9
9
  import { UserError } from "@openagentpack/sdk";
@@ -519,7 +519,9 @@ function stopResourceSpinner(spinner4, result) {
519
519
  return;
520
520
  }
521
521
  if (result.status === "success") {
522
- if (result.reason === "already_gone") {
522
+ if (result.reason === "reference_removed") {
523
+ spinner4.stop(chalk6.green(`\u2713 ${label} \u2014 local reference removed (remote left intact)`));
524
+ } else if (result.reason === "already_gone") {
523
525
  spinner4.stop(chalk6.yellow(`\u2298 ${label} \u2014 already deleted remotely, cleaned up state`));
524
526
  } else if (result.cascaded) {
525
527
  spinner4.stop(chalk6.green(`\u2713 ${label} \u2014 destroyed (cascaded)`));
@@ -724,7 +726,12 @@ async function modelsListCommand(options) {
724
726
  for (const listing of listings) {
725
727
  const name = listing.provider;
726
728
  if (!listing.supportsDynamicListing) {
727
- if (!options.json) {
729
+ if (options.json) {
730
+ process.stdout.write(
731
+ `${JSON.stringify({ provider: name, supportsDynamicListing: false, models: [] }, null, 2)}
732
+ `
733
+ );
734
+ } else {
728
735
  console.log(chalk7.yellow(`
729
736
  Provider '${name}' does not support dynamic model listing.`));
730
737
  if (name === "claude") {
@@ -1177,8 +1184,12 @@ async function sessionCreateCommand(agentNameOrOptions, maybeOptions) {
1177
1184
  const ctx = await buildCliRuntime(options.file);
1178
1185
  const run = await createSessionForAgent(ctx, {
1179
1186
  agent: positionalAgent ?? options.agent,
1187
+ identityId: options.identityId,
1180
1188
  provider: options.provider,
1181
1189
  environment: options.environment,
1190
+ environmentId: options.environmentId,
1191
+ tunnel: options.tunnel,
1192
+ tunnelId: options.tunnelId,
1182
1193
  vault: options.vault,
1183
1194
  memoryStores: parseMemoryStores(options.memoryStores),
1184
1195
  title: options.title
@@ -1187,6 +1198,7 @@ async function sessionCreateCommand(agentNameOrOptions, maybeOptions) {
1187
1198
  log.success(`Session created: ${chalk9.bold(session.id)}`);
1188
1199
  console.log(` Agent: ${agentName}`);
1189
1200
  console.log(` Environment: ${session.environment_id}`);
1201
+ if (session.tunnel_id) console.log(` Tunnel: ${session.tunnel_id}`);
1190
1202
  console.log(` Status: ${session.status}`);
1191
1203
  if (session.vault_ids.length) console.log(` Vaults: ${session.vault_ids.join(", ")}`);
1192
1204
  if (session.memory_store_ids.length) console.log(` Memory: ${session.memory_store_ids.join(", ")}`);
@@ -1246,6 +1258,7 @@ async function sessionGetCommand(sessionId, options) {
1246
1258
  console.log(` ID: ${chalk9.bold(session.id)}`);
1247
1259
  console.log(` Agent: ${session.agent_id}`);
1248
1260
  console.log(` Environment: ${session.environment_id}`);
1261
+ if (session.tunnel_id) console.log(` Tunnel: ${session.tunnel_id}`);
1249
1262
  console.log(` Status: ${session.status}`);
1250
1263
  if (session.title) console.log(` Title: ${session.title}`);
1251
1264
  if (session.vault_ids.length) console.log(` Vaults: ${session.vault_ids.join(", ")}`);
@@ -1324,8 +1337,12 @@ async function sessionRunCommand(promptOrAgent, promptOrOptions, maybeOptions) {
1324
1337
  }
1325
1338
  const runOptions = {
1326
1339
  agent: positionalAgent ?? options.agent,
1340
+ identityId: options.identityId,
1327
1341
  provider: options.provider,
1328
1342
  environment: options.environment,
1343
+ environmentId: options.environmentId,
1344
+ tunnel: options.tunnel,
1345
+ tunnelId: options.tunnelId,
1329
1346
  vault: options.vault,
1330
1347
  memoryStores: parseMemoryStores(options.memoryStores),
1331
1348
  title: options.title
@@ -1471,7 +1488,7 @@ async function syncCommand(options) {
1471
1488
  const configPath = resolve3(options.file);
1472
1489
  const { provider, result } = fileExistsSync(configPath) ? await syncFromConfig(configPath, options.provider) : await syncFromEnv(options.provider);
1473
1490
  const baseDir = dirname3(outPath);
1474
- const removedFiles = await promptFileAssociation(result.config, baseDir);
1491
+ const removedFiles = options.skipMissingFiles ? removeMissingFileAssociations(result.config, baseDir) : await promptFileAssociation(result.config, baseDir);
1475
1492
  if (removedFiles.length > 0) {
1476
1493
  const files = result.config.files ?? {};
1477
1494
  for (const key of removedFiles) {
@@ -1506,6 +1523,14 @@ async function syncCommand(options) {
1506
1523
  await promptSecretValues(result.secretPlaceholders);
1507
1524
  }
1508
1525
  }
1526
+ function removeMissingFileAssociations(config, baseDir) {
1527
+ const files = config.files ?? {};
1528
+ const removed = Object.entries(files).filter(([, decl]) => !fileExistsSync(join(baseDir, decl.source))).map(([key]) => key);
1529
+ if (removed.length > 0) {
1530
+ log.info(`${removed.length} file(s) removed (skipped).`);
1531
+ }
1532
+ return removed;
1533
+ }
1509
1534
  async function syncFromConfig(configPath, explicitProvider) {
1510
1535
  const ctx = await buildCliRuntime(configPath);
1511
1536
  const provider = resolveSyncProvider(ctx.config, explicitProvider);
@@ -1728,6 +1753,7 @@ async function serializeConfig(config) {
1728
1753
  import { resolve as resolve4 } from "path";
1729
1754
  import { resolveProjectConfig as resolveProjectConfig2, UserError as UserError10, validateProjectConfig } from "@openagentpack/sdk";
1730
1755
  async function validateCommand(options) {
1756
+ ensureCredentials();
1731
1757
  const configPath = resolve4(options.file);
1732
1758
  log.info(`Validating ${configPath}...`);
1733
1759
  const { config } = await resolveProjectConfig2(options.file);
@@ -1805,7 +1831,7 @@ program.command("apply").description("Apply the planned changes to create/update
1805
1831
  parsePositiveInteger
1806
1832
  ).addOption(providerOption("Target provider", { allowAll: true, defaultValue: "all" })).action(withResolvedConfigFile(applyCommand));
1807
1833
  program.command("destroy").description("Destroy all managed resources").addOption(configFileOption()).option("-y, --yes", "Skip confirmation prompt").option("--cascade", "Auto-delete dependent resources (e.g., sessions referencing an environment)").action(withResolvedConfigFile(destroyCommand));
1808
- program.command("sync").description("Export a provider's remote configuration into a local agents.yaml").addOption(configFileOption()).addOption(providerOption("Source provider to sync from (defaults from config when -f is set)")).option("-o, --out <path>", "Output file path", "agents.synced.yaml").option("--force", "Overwrite the output file if it already exists").action(withResolvedConfigFile(syncCommand));
1834
+ program.command("sync").description("Export a provider's remote configuration into a local agents.yaml").addOption(configFileOption()).addOption(providerOption("Source provider to sync from (defaults from config when -f is set)")).option("-o, --out <path>", "Output file path", "agents.synced.yaml").option("--force", "Overwrite the output file if it already exists").option("--skip-missing-files", "Do not prompt for remote files that cannot be downloaded; omit them from output").action(withResolvedConfigFile(syncCommand));
1809
1835
  program.command("migrate").description("Merge synced resources into the project agents.yaml (incremental, skip existing)").option("--from <path>", "Source synced file", "agents.synced.yaml").option("--to <path>", "Target agents.yaml file", "agents.yaml").action(migrateCommand);
1810
1836
  var stateCmd = program.command("state").description("Manage state file");
1811
1837
  stateCmd.command("list").description("List all resources in state").addOption(configFileOption()).action(withResolvedConfigFile(stateListCommand));
@@ -1817,11 +1843,11 @@ stateCmd.command("import <address> <remote-id>").description("Import an existing
1817
1843
  )
1818
1844
  ).action(withResolvedConfigFile(stateImportCommand));
1819
1845
  var sessionCmd = program.command("session").description("Manage agent sessions (runtime)");
1820
- sessionCmd.command("create [agent-name]").description("Create a new session for an agent").addOption(configFileOption()).option("--agent <name>", "Agent name (auto-detected when only one agent is configured)").option("--environment <name>", "Override agent's declared environment").option("--vault <name>", "Override agent's declared vault").option("--memory-stores <names>", "Override agent's declared memory stores (comma-separated)").option("--title <title>", "Session title").addOption(providerOption("Target provider (required for multi-provider agents)")).action(withResolvedConfigFile(sessionCreateCommand));
1846
+ sessionCmd.command("create [agent-name]").description("Create a new session for an agent").addOption(configFileOption()).option("--agent <name>", "Agent name (auto-detected when only one agent is configured)").option("--identity-id <id>", "Override the configured Qoder Forward Identity").option("--environment <name>", "Override agent's declared environment").option("--environment-id <id>", "Use an explicit remote environment id instead of the configured one").option("--tunnel <name>", "Override agent's declared tunnel").option("--tunnel-id <id>", "Use an explicit remote tunnel id instead of the configured one").option("--vault <name>", "Override agent's declared vault").option("--memory-stores <names>", "Override agent's declared memory stores (comma-separated)").option("--title <title>", "Session title").addOption(providerOption("Target provider (required for multi-provider agents)")).action(withResolvedConfigFile(sessionCreateCommand));
1821
1847
  sessionCmd.command("list").description("List sessions from the provider").addOption(configFileOption()).option("--agent <name>", "Filter by agent name").option("--all", "Fetch all pages by following the cursor").addOption(providerOption("Target provider")).action(withResolvedConfigFile(sessionListCommand));
1822
1848
  sessionCmd.command("get <session-id>").description("Get details of a session").addOption(configFileOption()).addOption(providerOption("Target provider")).action(withResolvedConfigFile(sessionGetCommand));
1823
1849
  sessionCmd.command("delete <session-id>").description("Delete a session").addOption(configFileOption()).addOption(providerOption("Target provider")).action(withResolvedConfigFile(sessionDeleteCommand));
1824
- sessionCmd.command("run <prompt-or-agent> [prompt]").description("Create a session, send a message, and stream the response").addOption(configFileOption()).option("--agent <name>", "Agent name (auto-detected when only one agent is configured)").option("--environment <name>", "Override agent's declared environment").option("--vault <name>", "Override agent's declared vault").option("--memory-stores <names>", "Override agent's declared memory stores (comma-separated)").option("--title <title>", "Session title").addOption(providerOption("Target provider")).option("--json", "Output events as JSONL").option("--no-stream", "Use polling instead of SSE streaming").action(withResolvedConfigFile(sessionRunCommand));
1850
+ sessionCmd.command("run <prompt-or-agent> [prompt]").description("Create a session, send a message, and stream the response").addOption(configFileOption()).option("--agent <name>", "Agent name (auto-detected when only one agent is configured)").option("--identity-id <id>", "Override the configured Qoder Forward Identity").option("--environment <name>", "Override agent's declared environment").option("--environment-id <id>", "Use an explicit remote environment id instead of the configured one").option("--tunnel <name>", "Override agent's declared tunnel").option("--tunnel-id <id>", "Use an explicit remote tunnel id instead of the configured one").option("--vault <name>", "Override agent's declared vault").option("--memory-stores <names>", "Override agent's declared memory stores (comma-separated)").option("--title <title>", "Session title").addOption(providerOption("Target provider")).option("--json", "Output events as JSONL").option("--no-stream", "Use polling instead of SSE streaming").action(withResolvedConfigFile(sessionRunCommand));
1825
1851
  sessionCmd.command("send <session-id> <message>").description("Send a message to an existing session and stream the response").addOption(configFileOption()).addOption(providerOption("Target provider")).option("--json", "Output events as JSONL").option("--no-stream", "Use polling instead of SSE streaming").action(withResolvedConfigFile(sessionSendCommand));
1826
1852
  sessionCmd.command("events <session-id>").description("List event history for a session").addOption(configFileOption()).addOption(providerOption("Target provider")).addOption(new Option2("--limit <count>", "Maximum number of events to fetch").argParser(parsePositiveInteger)).option("--all", "Fetch all pages by following the cursor").option("--json", "Output as JSON").action(withResolvedConfigFile(sessionEventsCommand));
1827
1853
  var deploymentCmd = program.command("deployment").description("Manage agent deployments (scheduled / triggered runs)");
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  program
3
- } from "../chunk-XRJ6J5YM.js";
3
+ } from "../chunk-W5APGQN3.js";
4
4
  export {
5
5
  program
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openagentpack/cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0-beta.0",
4
4
  "description": "Open Agent Pack — Declaratively manage AI agent infrastructure",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -49,12 +49,12 @@
49
49
  "typecheck": "tsc --noEmit"
50
50
  },
51
51
  "devDependencies": {
52
- "@openagentpack/playground": "0.1.0",
52
+ "@openagentpack/playground": "0.2.0-beta.0",
53
53
  "@types/bun": "^1.3.14",
54
54
  "typescript": "^6.0.3"
55
55
  },
56
56
  "dependencies": {
57
- "@openagentpack/sdk": "0.1.0",
57
+ "@openagentpack/sdk": "0.2.0-beta.0",
58
58
  "@clack/prompts": "^1.5.1",
59
59
  "chalk": "^5.6.2",
60
60
  "commander": "^14.0.3",