@openagentpack/cli 0.2.0-beta.0 → 0.3.0-beta-e537ab3-20260722

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-W5APGQN3.js";
6
+ } from "../chunk-YXWT5OMX.js";
7
7
 
8
8
  // bin/agents.ts
9
9
  import { UserError } from "@openagentpack/sdk";
@@ -360,6 +360,8 @@ import {
360
360
  getDeploymentDetailsForContext,
361
361
  getDeploymentRuntimeProviderForContext,
362
362
  listDeploymentsForContext,
363
+ listRemoteDeploymentsForContext,
364
+ pauseDeploymentForContext,
363
365
  runDeploymentForContext,
364
366
  UserError as UserError3
365
367
  } from "@openagentpack/sdk";
@@ -388,9 +390,56 @@ function printTableFooter() {
388
390
  console.log();
389
391
  }
390
392
 
393
+ // src/utils/pagination.ts
394
+ async function fetchAllPages(fetchPage, all) {
395
+ const first = await fetchPage();
396
+ const items = [...first.items];
397
+ let hasMore = first.hasMore;
398
+ let nextPage = first.nextPage;
399
+ while (all && nextPage) {
400
+ const next = await fetchPage(nextPage);
401
+ items.push(...next.items);
402
+ hasMore = next.hasMore;
403
+ nextPage = next.nextPage;
404
+ }
405
+ return { items, hasMore, nextPage };
406
+ }
407
+
391
408
  // src/commands/deployment.ts
392
409
  async function deploymentListCommand(options) {
393
410
  const ctx = await buildCliRuntime(options.file);
411
+ if (options.remote) {
412
+ if (!options.provider) throw new UserError3("Remote deployment listing requires --provider.");
413
+ if (options.provider === "claude" && options.status && options.includeArchived) {
414
+ throw new UserError3("Claude remote deployment listing cannot combine --status with --include-archived.");
415
+ }
416
+ const { items, hasMore } = await fetchAllPages(async (page) => {
417
+ const result = await listRemoteDeploymentsForContext(ctx, options.provider, {
418
+ status: options.status,
419
+ include_archived: options.includeArchived,
420
+ agent_id: options.agentId,
421
+ limit: options.limit,
422
+ page
423
+ });
424
+ return { items: result.deployments, hasMore: result.has_more, nextPage: result.next_page };
425
+ }, options.all);
426
+ if (items.length === 0) {
427
+ log.info("No remote deployments found.");
428
+ return;
429
+ }
430
+ printTableTitle("Remote Deployments", items.length);
431
+ printTableHeader(["Name".padEnd(24), "ID".padEnd(28), "Status".padEnd(10), "Schedule"], 82);
432
+ for (const item of items) {
433
+ const raw = item.attributes ?? {};
434
+ const name = String(raw.name ?? "").slice(0, 22).padEnd(24);
435
+ const id = String(item.id ?? "").slice(0, 26).padEnd(28);
436
+ const schedule = item.schedule?.expression ?? "manual";
437
+ printTableRow([chalk5.bold(name), id, item.status.padEnd(10), schedule]);
438
+ }
439
+ printTableFooter();
440
+ if (hasMore) log.info("More deployments available. Use --all to fetch all.");
441
+ return;
442
+ }
394
443
  const rows = listDeploymentsForContext(ctx, options.provider);
395
444
  if (rows.length === 0) {
396
445
  log.info("No deployments in state. Run `agents apply` first.");
@@ -411,6 +460,12 @@ async function deploymentListCommand(options) {
411
460
  }
412
461
  printTableFooter();
413
462
  }
463
+ async function deploymentPauseCommand(name, options, paused = true) {
464
+ const ctx = await buildCliRuntime(options.file);
465
+ const info = await pauseDeploymentForContext(ctx, name, paused, options.provider);
466
+ log.success(`Deployment '${name}' ${paused ? "paused" : "unpaused"}.`);
467
+ console.log(` Status: ${info.status}`);
468
+ }
414
469
  async function deploymentGetCommand(name, options) {
415
470
  const ctx = await buildCliRuntime(options.file);
416
471
  const { bindings, provider, info } = await getDeploymentDetailsForContext(ctx, name, void 0, options.provider);
@@ -670,9 +725,9 @@ async function initCommand() {
670
725
  p4.log.success(`Created ${configPath}`, { output: process.stderr });
671
726
  const gitignorePath = ".gitignore";
672
727
  if (await fileExists(gitignorePath)) {
673
- const content = await readFile(gitignorePath, "utf8");
674
- if (!content.includes("agents.state.json")) {
675
- await writeFile(gitignorePath, content + GITIGNORE_ADDITIONS, "utf8");
728
+ const content2 = await readFile(gitignorePath, "utf8");
729
+ if (!content2.includes("agents.state.json")) {
730
+ await writeFile(gitignorePath, content2 + GITIGNORE_ADDITIONS, "utf8");
676
731
  p4.log.success("Updated .gitignore", { output: process.stderr });
677
732
  }
678
733
  } else {
@@ -685,15 +740,244 @@ async function initCommand() {
685
740
  });
686
741
  }
687
742
 
743
+ // src/commands/memory.ts
744
+ import { readFile as readFile2 } from "fs/promises";
745
+ import {
746
+ archiveMemoryStore,
747
+ batchCreateMemories,
748
+ createMemory,
749
+ createMemoryStore,
750
+ deleteMemory,
751
+ deleteMemoryStore,
752
+ getMemory,
753
+ getMemoryStore,
754
+ getMemoryVersion,
755
+ listMemories,
756
+ listMemoryStores,
757
+ listMemoryVersions,
758
+ redactMemoryVersion,
759
+ UserError as UserError5,
760
+ updateMemory,
761
+ updateMemoryStore
762
+ } from "@openagentpack/sdk";
763
+
764
+ // src/runtime.ts
765
+ import { listProviderNames, UserError as UserError4 } from "@openagentpack/sdk";
766
+ import { Command, InvalidArgumentError, Option } from "commander";
767
+ var DEFAULT_CONFIG_FILE = "agents.yaml";
768
+ function isExplicitSource(source) {
769
+ return source !== void 0 && source !== "default";
770
+ }
771
+ function rootCommand(command) {
772
+ let current = command;
773
+ while (current.parent) current = current.parent;
774
+ return current;
775
+ }
776
+ function configFileArgs(args = process.argv.slice(2)) {
777
+ const values = [];
778
+ for (let i = 0; i < args.length; i += 1) {
779
+ const arg = args[i];
780
+ if (!arg) continue;
781
+ if (arg === "--") break;
782
+ if (arg === "-f" || arg === "--file") {
783
+ const value = args[i + 1];
784
+ if (value) {
785
+ values.push(value);
786
+ i += 1;
787
+ continue;
788
+ }
789
+ }
790
+ if (arg.startsWith("--file=")) {
791
+ values.push(arg.slice("--file=".length));
792
+ continue;
793
+ }
794
+ if (arg.startsWith("-f") && arg.length > 2) {
795
+ values.push(arg.slice(2));
796
+ }
797
+ }
798
+ return values;
799
+ }
800
+ function configFileOption() {
801
+ return new Option("-f, --file <path>", "Config file path");
802
+ }
803
+ function resolveConfigFile(command) {
804
+ const explicitFiles = [...new Set(configFileArgs())];
805
+ if (explicitFiles.length > 1) {
806
+ throw new UserError4(
807
+ `Conflicting config files supplied: ${explicitFiles.join(" and ")}. Use only one --file value.`
808
+ );
809
+ }
810
+ const root = rootCommand(command);
811
+ const rootFile = root.getOptionValue("file");
812
+ const rootSource = root.getOptionValueSource("file");
813
+ const localFile = command.getOptionValue("file");
814
+ const localSource = command.getOptionValueSource("file");
815
+ if (isExplicitSource(rootSource) && isExplicitSource(localSource) && rootFile && localFile && rootFile !== localFile) {
816
+ throw new UserError4(`Conflicting config files supplied: ${rootFile} and ${localFile}. Use only one --file value.`);
817
+ }
818
+ if (isExplicitSource(localSource) && localFile) return localFile;
819
+ if (rootFile) return rootFile;
820
+ return DEFAULT_CONFIG_FILE;
821
+ }
822
+ function withResolvedConfigFile(handler) {
823
+ return async (...args) => {
824
+ const command = args[args.length - 1];
825
+ if (!(command instanceof Command)) {
826
+ await handler(...args);
827
+ return;
828
+ }
829
+ const handlerArgs = args.slice(0, -1);
830
+ const options = handlerArgs[handlerArgs.length - 1];
831
+ if (options && typeof options === "object") {
832
+ options.file = resolveConfigFile(command);
833
+ }
834
+ await handler(...handlerArgs);
835
+ };
836
+ }
837
+ function registeredProviderNames() {
838
+ return listProviderNames();
839
+ }
840
+ function providerOption(description, opts = {}) {
841
+ const choices = opts.allowAll ? ["all", ...registeredProviderNames()] : registeredProviderNames();
842
+ const option = new Option("--provider <name>", description).choices(choices);
843
+ if (opts.defaultValue !== void 0) option.default(opts.defaultValue);
844
+ return option;
845
+ }
846
+ function parsePositiveInteger(value) {
847
+ if (!/^\d+$/.test(value)) {
848
+ throw new InvalidArgumentError("must be a positive integer");
849
+ }
850
+ const parsed = Number(value);
851
+ if (!Number.isSafeInteger(parsed) || parsed <= 0) {
852
+ throw new InvalidArgumentError("must be a positive integer");
853
+ }
854
+ return parsed;
855
+ }
856
+ function parseBooleanOption(value) {
857
+ if (value === "true") return true;
858
+ if (value === "false") return false;
859
+ throw new InvalidArgumentError("must be true or false");
860
+ }
861
+ function writeJson(value) {
862
+ process.stdout.write(`${JSON.stringify(value, null, 2)}
863
+ `);
864
+ }
865
+ function writeJsonLine(value) {
866
+ process.stdout.write(`${JSON.stringify(value)}
867
+ `);
868
+ }
869
+
870
+ // src/commands/memory.ts
871
+ async function runtime(options) {
872
+ const ctx = await buildCliRuntime(options.file);
873
+ const provider = options.provider ?? (ctx.providers.size === 1 ? ctx.providers.keys().next().value : void 0);
874
+ if (!provider) throw new UserError5("Select a provider with --provider when multiple providers are configured.");
875
+ return { ctx, provider };
876
+ }
877
+ async function content(options) {
878
+ if (options.content !== void 0 && options.contentFile)
879
+ throw new UserError5("Use either --content or --content-file, not both.");
880
+ if (options.contentFile) return readFile2(options.contentFile, "utf8");
881
+ if (options.content !== void 0) return options.content;
882
+ throw new UserError5("Memory content is required; use --content or --content-file.");
883
+ }
884
+ async function memoryStoreListCommand(options) {
885
+ const { ctx, provider } = await runtime(options);
886
+ writeJson(await listMemoryStores(ctx.providers, provider, options));
887
+ }
888
+ async function memoryStoreCreateCommand(name, options) {
889
+ const { ctx, provider } = await runtime(options);
890
+ writeJson(await createMemoryStore(ctx.providers, provider, { name, description: options.description }));
891
+ }
892
+ async function memoryStoreDeleteCommand(id, options) {
893
+ const { ctx, provider } = await runtime(options);
894
+ await deleteMemoryStore(ctx.providers, provider, id);
895
+ writeJson({ id, type: "memory_store_deleted" });
896
+ }
897
+ async function memoryStoreGetCommand(id, options) {
898
+ const { ctx, provider } = await runtime(options);
899
+ writeJson(await getMemoryStore(ctx.providers, provider, id));
900
+ }
901
+ async function memoryStoreUpdateCommand(id, options) {
902
+ const { ctx, provider } = await runtime(options);
903
+ writeJson(
904
+ await updateMemoryStore(ctx.providers, provider, id, { name: options.name, description: options.description })
905
+ );
906
+ }
907
+ async function memoryStoreArchiveCommand(id, options) {
908
+ const { ctx, provider } = await runtime(options);
909
+ writeJson(await archiveMemoryStore(ctx.providers, provider, id));
910
+ }
911
+ async function memoryCreateCommand(storeId, path, options) {
912
+ const { ctx, provider } = await runtime(options);
913
+ writeJson(await createMemory(ctx.providers, provider, storeId, { path, content: await content(options) }));
914
+ }
915
+ async function memoryBatchCreateCommand(storeId, inputFile, options) {
916
+ const { ctx, provider } = await runtime(options);
917
+ const parsed = JSON.parse(await readFile2(inputFile, "utf8"));
918
+ if (!Array.isArray(parsed)) throw new UserError5("Batch input must be a JSON array of {path, content} objects.");
919
+ const items = parsed.map((item) => {
920
+ if (!item || typeof item !== "object" || typeof item.path !== "string" || typeof item.content !== "string") {
921
+ throw new UserError5("Every batch item must contain string path and content fields.");
922
+ }
923
+ return item;
924
+ });
925
+ writeJson(await batchCreateMemories(ctx.providers, provider, storeId, { items, on_conflict: options.onConflict }));
926
+ }
927
+ async function memoryListCommand(storeId, options) {
928
+ const { ctx, provider } = await runtime(options);
929
+ writeJson(
930
+ await listMemories(ctx.providers, provider, storeId, { ...options, view: options.full ? "full" : "basic" })
931
+ );
932
+ }
933
+ async function memoryGetCommand(storeId, memoryId, options) {
934
+ const { ctx, provider } = await runtime(options);
935
+ writeJson(await getMemory(ctx.providers, provider, storeId, memoryId));
936
+ }
937
+ async function memoryUpdateCommand(storeId, memoryId, options) {
938
+ const { ctx, provider } = await runtime(options);
939
+ const nextContent = options.content !== void 0 || options.contentFile ? await content(options) : void 0;
940
+ writeJson(
941
+ await updateMemory(ctx.providers, provider, storeId, memoryId, {
942
+ path: options.path,
943
+ content: nextContent,
944
+ expected_content_sha256: options.expectedSha256
945
+ })
946
+ );
947
+ }
948
+ async function memoryDeleteCommand(storeId, memoryId, options) {
949
+ const { ctx, provider } = await runtime(options);
950
+ await deleteMemory(ctx.providers, provider, storeId, memoryId, options.expectedSha256);
951
+ writeJson({ id: memoryId, type: "memory_deleted" });
952
+ }
953
+ async function memoryVersionListCommand(storeId, options) {
954
+ const { ctx, provider } = await runtime(options);
955
+ writeJson(
956
+ await listMemoryVersions(ctx.providers, provider, storeId, {
957
+ ...options,
958
+ memory_id: options.memoryId,
959
+ view: options.full ? "full" : "basic"
960
+ })
961
+ );
962
+ }
963
+ async function memoryVersionGetCommand(storeId, versionId, options) {
964
+ const { ctx, provider } = await runtime(options);
965
+ writeJson(await getMemoryVersion(ctx.providers, provider, storeId, versionId));
966
+ }
967
+ async function memoryVersionRedactCommand(storeId, versionId, options) {
968
+ const { ctx, provider } = await runtime(options);
969
+ writeJson(await redactMemoryVersion(ctx.providers, provider, storeId, versionId));
970
+ }
971
+
688
972
  // src/commands/migrate.ts
689
973
  import { writeFile as writeFile2 } from "fs/promises";
690
- import { migrateConfig, UserError as UserError4 } from "@openagentpack/sdk";
974
+ import { migrateConfig, UserError as UserError6 } from "@openagentpack/sdk";
691
975
  async function migrateCommand(options) {
692
976
  const fromPath = options.from ?? "agents.synced.yaml";
693
977
  const toPath = options.to ?? "agents.yaml";
694
978
  const toExists = await fileExists(toPath);
695
979
  if (!toExists) {
696
- throw new UserError4(
980
+ throw new UserError6(
697
981
  `Target file '${toPath}' not found. Create a agents.yaml first (e.g. \`agents init\`), then run migrate.`
698
982
  );
699
983
  }
@@ -806,116 +1090,8 @@ function formatPrice(factor) {
806
1090
  }
807
1091
 
808
1092
  // src/commands/plan.ts
809
- import { UserError as UserError6 } from "@openagentpack/sdk";
1093
+ import { UserError as UserError7 } from "@openagentpack/sdk";
810
1094
  import chalk8 from "chalk";
811
-
812
- // src/runtime.ts
813
- import { listProviderNames, UserError as UserError5 } from "@openagentpack/sdk";
814
- import { Command, InvalidArgumentError, Option } from "commander";
815
- var DEFAULT_CONFIG_FILE = "agents.yaml";
816
- function isExplicitSource(source) {
817
- return source !== void 0 && source !== "default";
818
- }
819
- function rootCommand(command) {
820
- let current = command;
821
- while (current.parent) current = current.parent;
822
- return current;
823
- }
824
- function configFileArgs(args = process.argv.slice(2)) {
825
- const values = [];
826
- for (let i = 0; i < args.length; i += 1) {
827
- const arg = args[i];
828
- if (!arg) continue;
829
- if (arg === "--") break;
830
- if (arg === "-f" || arg === "--file") {
831
- const value = args[i + 1];
832
- if (value) {
833
- values.push(value);
834
- i += 1;
835
- continue;
836
- }
837
- }
838
- if (arg.startsWith("--file=")) {
839
- values.push(arg.slice("--file=".length));
840
- continue;
841
- }
842
- if (arg.startsWith("-f") && arg.length > 2) {
843
- values.push(arg.slice(2));
844
- }
845
- }
846
- return values;
847
- }
848
- function configFileOption() {
849
- return new Option("-f, --file <path>", "Config file path");
850
- }
851
- function resolveConfigFile(command) {
852
- const explicitFiles = [...new Set(configFileArgs())];
853
- if (explicitFiles.length > 1) {
854
- throw new UserError5(
855
- `Conflicting config files supplied: ${explicitFiles.join(" and ")}. Use only one --file value.`
856
- );
857
- }
858
- const root = rootCommand(command);
859
- const rootFile = root.getOptionValue("file");
860
- const rootSource = root.getOptionValueSource("file");
861
- const localFile = command.getOptionValue("file");
862
- const localSource = command.getOptionValueSource("file");
863
- if (isExplicitSource(rootSource) && isExplicitSource(localSource) && rootFile && localFile && rootFile !== localFile) {
864
- throw new UserError5(`Conflicting config files supplied: ${rootFile} and ${localFile}. Use only one --file value.`);
865
- }
866
- if (isExplicitSource(localSource) && localFile) return localFile;
867
- if (rootFile) return rootFile;
868
- return DEFAULT_CONFIG_FILE;
869
- }
870
- function withResolvedConfigFile(handler) {
871
- return async (...args) => {
872
- const command = args[args.length - 1];
873
- if (!(command instanceof Command)) {
874
- await handler(...args);
875
- return;
876
- }
877
- const handlerArgs = args.slice(0, -1);
878
- const options = handlerArgs[handlerArgs.length - 1];
879
- if (options && typeof options === "object") {
880
- options.file = resolveConfigFile(command);
881
- }
882
- await handler(...handlerArgs);
883
- };
884
- }
885
- function registeredProviderNames() {
886
- return listProviderNames();
887
- }
888
- function providerOption(description, opts = {}) {
889
- const choices = opts.allowAll ? ["all", ...registeredProviderNames()] : registeredProviderNames();
890
- const option = new Option("--provider <name>", description).choices(choices);
891
- if (opts.defaultValue !== void 0) option.default(opts.defaultValue);
892
- return option;
893
- }
894
- function parsePositiveInteger(value) {
895
- if (!/^\d+$/.test(value)) {
896
- throw new InvalidArgumentError("must be a positive integer");
897
- }
898
- const parsed = Number(value);
899
- if (!Number.isSafeInteger(parsed) || parsed <= 0) {
900
- throw new InvalidArgumentError("must be a positive integer");
901
- }
902
- return parsed;
903
- }
904
- function parseBooleanOption(value) {
905
- if (value === "true") return true;
906
- if (value === "false") return false;
907
- throw new InvalidArgumentError("must be true or false");
908
- }
909
- function writeJson(value) {
910
- process.stdout.write(`${JSON.stringify(value, null, 2)}
911
- `);
912
- }
913
- function writeJsonLine(value) {
914
- process.stdout.write(`${JSON.stringify(value)}
915
- `);
916
- }
917
-
918
- // src/commands/plan.ts
919
1095
  async function planCommand(options) {
920
1096
  const ctx = await buildCliRuntime(options.file);
921
1097
  assertProviderConfigured(ctx, options.provider);
@@ -927,13 +1103,13 @@ async function planCommand(options) {
927
1103
  if (options.json) {
928
1104
  writeJson(plan);
929
1105
  if (plan.diagnostics.some((d) => d.severity === "error")) {
930
- throw new UserError6("Plan contains errors.");
1106
+ throw new UserError7("Plan contains errors.");
931
1107
  }
932
1108
  return;
933
1109
  }
934
1110
  renderDiagnostics(plan.diagnostics);
935
1111
  if (diagnosticsHaveErrors(plan.diagnostics)) {
936
- throw new UserError6("Plan contains errors.");
1112
+ throw new UserError7("Plan contains errors.");
937
1113
  }
938
1114
  const creates = plan.actions.filter((a) => a.action === "create");
939
1115
  const updates = plan.actions.filter((a) => a.action === "update");
@@ -1137,27 +1313,10 @@ import {
1137
1313
  sendSessionMessageStreaming,
1138
1314
  startSessionRun,
1139
1315
  startSessionRunPolling,
1140
- UserError as UserError7
1316
+ UserError as UserError8
1141
1317
  } from "@openagentpack/sdk";
1142
1318
  import { sanitizeSessionEvent, sanitizeSessionEvents } from "@openagentpack/sdk/session-events";
1143
1319
  import chalk9 from "chalk";
1144
-
1145
- // src/utils/pagination.ts
1146
- async function fetchAllPages(fetchPage, all) {
1147
- const first = await fetchPage();
1148
- const items = [...first.items];
1149
- let hasMore = first.hasMore;
1150
- let nextPage = first.nextPage;
1151
- while (all && nextPage) {
1152
- const next = await fetchPage(nextPage);
1153
- items.push(...next.items);
1154
- hasMore = next.hasMore;
1155
- nextPage = next.nextPage;
1156
- }
1157
- return { items, hasMore, nextPage };
1158
- }
1159
-
1160
- // src/commands/session.ts
1161
1320
  function formatTimestamp(iso) {
1162
1321
  const d = new Date(iso);
1163
1322
  if (Number.isNaN(d.getTime())) return iso;
@@ -1179,7 +1338,7 @@ async function sessionCreateCommand(agentNameOrOptions, maybeOptions) {
1179
1338
  const options = maybeOptions ?? agentNameOrOptions;
1180
1339
  const positionalAgent = typeof agentNameOrOptions === "string" ? agentNameOrOptions : void 0;
1181
1340
  if (positionalAgent && options.agent && positionalAgent !== options.agent) {
1182
- throw new UserError7("Specify agent either positionally or with --agent, not both.");
1341
+ throw new UserError8("Specify agent either positionally or with --agent, not both.");
1183
1342
  }
1184
1343
  const ctx = await buildCliRuntime(options.file);
1185
1344
  const run = await createSessionForAgent(ctx, {
@@ -1327,13 +1486,16 @@ function renderCollectedEvents(result, json) {
1327
1486
  renderTerminalStatus(result.terminalStatus, json);
1328
1487
  }
1329
1488
  }
1489
+ function shouldStreamSession(options) {
1490
+ return options.stream === true && options.noStream !== true;
1491
+ }
1330
1492
  async function sessionRunCommand(promptOrAgent, promptOrOptions, maybeOptions) {
1331
1493
  const hasPositionalAgent = typeof promptOrOptions === "string";
1332
1494
  const positionalAgent = hasPositionalAgent ? promptOrAgent : void 0;
1333
1495
  const prompt = hasPositionalAgent ? promptOrOptions : promptOrAgent;
1334
1496
  const options = hasPositionalAgent ? maybeOptions : promptOrOptions ?? maybeOptions;
1335
1497
  if (positionalAgent && options.agent && positionalAgent !== options.agent) {
1336
- throw new UserError7("Specify agent either positionally or with --agent, not both.");
1498
+ throw new UserError8("Specify agent either positionally or with --agent, not both.");
1337
1499
  }
1338
1500
  const runOptions = {
1339
1501
  agent: positionalAgent ?? options.agent,
@@ -1348,25 +1510,26 @@ async function sessionRunCommand(promptOrAgent, promptOrOptions, maybeOptions) {
1348
1510
  title: options.title
1349
1511
  };
1350
1512
  const ctx = await buildCliRuntime(options.file);
1351
- const run = options.noStream ? await startSessionRunPolling(ctx, prompt, runOptions) : await startSessionRun(ctx, prompt, runOptions);
1513
+ const stream = shouldStreamSession(options);
1514
+ const run = stream ? await startSessionRun(ctx, prompt, runOptions) : await startSessionRunPolling(ctx, prompt, runOptions);
1352
1515
  const session = run.session;
1353
1516
  if (!options.json) {
1354
1517
  log.success(`Session created: ${chalk9.bold(session.id)}`);
1355
1518
  }
1356
- if (options.noStream) {
1357
- renderCollectedEvents(run, !!options.json);
1358
- } else {
1519
+ if (stream) {
1359
1520
  await streamAndRender(run.events, !!options.json);
1521
+ } else {
1522
+ renderCollectedEvents(run, !!options.json);
1360
1523
  }
1361
1524
  }
1362
1525
  async function sessionSendCommand(sessionId, message, options) {
1363
1526
  const ctx = await buildCliRuntime(options.file);
1364
- if (options.noStream) {
1365
- const result = await sendSessionMessagePolling(ctx, sessionId, message, { provider: options.provider });
1366
- renderCollectedEvents(result, !!options.json);
1367
- } else {
1527
+ if (shouldStreamSession(options)) {
1368
1528
  const events = await sendSessionMessageStreaming(ctx, sessionId, message, { provider: options.provider });
1369
1529
  await streamAndRender(events, !!options.json);
1530
+ } else {
1531
+ const result = await sendSessionMessagePolling(ctx, sessionId, message, { provider: options.provider });
1532
+ renderCollectedEvents(result, !!options.json);
1370
1533
  }
1371
1534
  }
1372
1535
  async function sessionEventsCommand(sessionId, options) {
@@ -1418,7 +1581,7 @@ function parseMemoryStores(value) {
1418
1581
  }
1419
1582
 
1420
1583
  // src/commands/state.ts
1421
- import { importResource, parseStateAddress, UserError as UserError8 } from "@openagentpack/sdk";
1584
+ import { importResource, parseStateAddress, UserError as UserError9 } from "@openagentpack/sdk";
1422
1585
  import chalk10 from "chalk";
1423
1586
  async function stateListCommand(options) {
1424
1587
  const ctx = await buildCliRuntime(options.file);
@@ -1442,14 +1605,14 @@ async function stateShowCommand(address, options) {
1442
1605
  const ctx = await buildCliRuntime(options.file);
1443
1606
  const parsed = parseStateAddress(address, { requireProvider: false });
1444
1607
  const found = ctx.state.findResource(parsed);
1445
- if (!found) throw new UserError8(`Resource not found: ${address}`);
1608
+ if (!found) throw new UserError9(`Resource not found: ${address}`);
1446
1609
  console.log(JSON.stringify(found, null, 2));
1447
1610
  }
1448
1611
  async function stateRemoveCommand(address, options) {
1449
1612
  const ctx = await buildCliRuntime(options.file);
1450
1613
  const parsed = parseStateAddress(address, { requireProvider: false });
1451
1614
  const found = ctx.state.findResource(parsed);
1452
- if (!found) throw new UserError8(`Resource not found: ${address}`);
1615
+ if (!found) throw new UserError9(`Resource not found: ${address}`);
1453
1616
  ctx.state.removeResource(found.address);
1454
1617
  await ctx.state.save();
1455
1618
  log.success(`Removed ${address} from state (remote resource not deleted).`);
@@ -1470,14 +1633,14 @@ import {
1470
1633
  resolveSyncProvider,
1471
1634
  syncProviderResourcesFromContext,
1472
1635
  syncProviderResourcesFromEnv,
1473
- UserError as UserError9
1636
+ UserError as UserError10
1474
1637
  } from "@openagentpack/sdk";
1475
1638
  import { stringify as stringifyYaml } from "yaml";
1476
1639
  var DEFAULT_SYNC_OUTPUT = "agents.synced.yaml";
1477
1640
  function ensureSyncOutputWritable(outPath, force) {
1478
1641
  if (force) return;
1479
1642
  if (fileExistsSync(outPath)) {
1480
- throw new UserError9(
1643
+ throw new UserError10(
1481
1644
  `Output file '${outPath}' already exists. Use --force to overwrite, or -o/--out to write elsewhere.`
1482
1645
  );
1483
1646
  }
@@ -1539,7 +1702,7 @@ async function syncFromConfig(configPath, explicitProvider) {
1539
1702
  }
1540
1703
  async function syncFromEnv(explicitProvider) {
1541
1704
  if (!explicitProvider) {
1542
- throw new UserError9(
1705
+ throw new UserError10(
1543
1706
  "agents sync requires --provider when no config file exists, e.g. `agents sync --provider claude`."
1544
1707
  );
1545
1708
  }
@@ -1586,8 +1749,8 @@ async function promptSecretValues(placeholders) {
1586
1749
  function loadExistingEnv(path) {
1587
1750
  const keys = /* @__PURE__ */ new Set();
1588
1751
  if (!fileExistsSync(path)) return keys;
1589
- const content = readFileSync2(path, "utf8");
1590
- for (const line of content.split("\n")) {
1752
+ const content2 = readFileSync2(path, "utf8");
1753
+ for (const line of content2.split("\n")) {
1591
1754
  const trimmed = line.trim();
1592
1755
  if (!trimmed || trimmed.startsWith("#")) continue;
1593
1756
  const eqIdx = trimmed.indexOf("=");
@@ -1598,16 +1761,16 @@ function loadExistingEnv(path) {
1598
1761
  return keys;
1599
1762
  }
1600
1763
  function appendEnvLine(path, key, value) {
1601
- let content = "";
1764
+ let content2 = "";
1602
1765
  if (fileExistsSync(path)) {
1603
- content = readFileSync2(path, "utf8");
1604
- if (content.length > 0 && !content.endsWith("\n")) {
1605
- content += "\n";
1766
+ content2 = readFileSync2(path, "utf8");
1767
+ if (content2.length > 0 && !content2.endsWith("\n")) {
1768
+ content2 += "\n";
1606
1769
  }
1607
1770
  }
1608
- content += `${key}=${value}
1771
+ content2 += `${key}=${value}
1609
1772
  `;
1610
- writeFileSync(path, content);
1773
+ writeFileSync(path, content2);
1611
1774
  }
1612
1775
  async function promptCustomSkillFiles(config, baseDir) {
1613
1776
  const skills = config.skills ?? {};
@@ -1751,7 +1914,7 @@ async function serializeConfig(config) {
1751
1914
 
1752
1915
  // src/commands/validate.ts
1753
1916
  import { resolve as resolve4 } from "path";
1754
- import { resolveProjectConfig as resolveProjectConfig2, UserError as UserError10, validateProjectConfig } from "@openagentpack/sdk";
1917
+ import { resolveProjectConfig as resolveProjectConfig2, UserError as UserError11, validateProjectConfig } from "@openagentpack/sdk";
1755
1918
  async function validateCommand(options) {
1756
1919
  ensureCredentials();
1757
1920
  const configPath = resolve4(options.file);
@@ -1766,7 +1929,7 @@ async function validateCommand(options) {
1766
1929
  }
1767
1930
  const errorCount = diagnostics.filter((d) => d.severity === "error").length;
1768
1931
  if (errorCount > 0) {
1769
- throw new UserError10(`Validation failed with ${errorCount} error(s).`);
1932
+ throw new UserError11(`Validation failed with ${errorCount} error(s).`);
1770
1933
  }
1771
1934
  log.success("Configuration is valid.");
1772
1935
  }
@@ -1847,13 +2010,33 @@ sessionCmd.command("create [agent-name]").description("Create a new session for
1847
2010
  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));
1848
2011
  sessionCmd.command("get <session-id>").description("Get details of a session").addOption(configFileOption()).addOption(providerOption("Target provider")).action(withResolvedConfigFile(sessionGetCommand));
1849
2012
  sessionCmd.command("delete <session-id>").description("Delete a session").addOption(configFileOption()).addOption(providerOption("Target provider")).action(withResolvedConfigFile(sessionDeleteCommand));
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));
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));
2013
+ sessionCmd.command("run <prompt-or-agent> [prompt]").description("Create a session, send a message, and wait for 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").addOption(new Option2("--stream", "Stream events over SSE instead of polling").conflicts("noStream")).addOption(new Option2("--no-stream", "Use polling (deprecated; polling is now the default)").hideHelp()).action(withResolvedConfigFile(sessionRunCommand));
2014
+ sessionCmd.command("send <session-id> <message>").description("Send a message to an existing session and wait for the response").addOption(configFileOption()).addOption(providerOption("Target provider")).option("--json", "Output events as JSONL").addOption(new Option2("--stream", "Stream events over SSE instead of polling").conflicts("noStream")).addOption(new Option2("--no-stream", "Use polling (deprecated; polling is now the default)").hideHelp()).action(withResolvedConfigFile(sessionSendCommand));
1852
2015
  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));
1853
2016
  var deploymentCmd = program.command("deployment").description("Manage agent deployments (scheduled / triggered runs)");
1854
- deploymentCmd.command("list").description("List deployments tracked in state").addOption(configFileOption()).addOption(providerOption("Filter by provider")).action(withResolvedConfigFile(deploymentListCommand));
2017
+ deploymentCmd.command("list").description("List deployments tracked in state").addOption(configFileOption()).addOption(providerOption("Filter by provider")).option("--remote", "List deployments from the provider API").addOption(new Option2("--status <status>", "Filter remote deployments by status").choices(["active", "paused"])).option("--include-archived", "Include archived remote deployments").option("--agent-id <id>", "Filter remote deployments by agent ID").option("--limit <count>", "Maximum remote deployments per page", parsePositiveInteger).option("--all", "Fetch all remote pages").action(withResolvedConfigFile(deploymentListCommand));
1855
2018
  deploymentCmd.command("get <name>").description("Show a deployment's status and resolved bindings").addOption(configFileOption()).addOption(providerOption("Target provider")).action(withResolvedConfigFile(deploymentGetCommand));
1856
- deploymentCmd.command("run <name>").description("Trigger a deployment run (native on Claude, emulated as a session on Qoder)").addOption(configFileOption()).addOption(providerOption("Target provider")).action(withResolvedConfigFile(deploymentRunCommand));
2019
+ deploymentCmd.command("pause <name>").description("Pause a native deployment's scheduled runs").addOption(configFileOption()).addOption(providerOption("Target provider")).action(withResolvedConfigFile((name, options) => deploymentPauseCommand(name, options, true)));
2020
+ deploymentCmd.command("unpause <name>").description("Resume a paused native deployment").addOption(configFileOption()).addOption(providerOption("Target provider")).action(withResolvedConfigFile((name, options) => deploymentPauseCommand(name, options, false)));
2021
+ deploymentCmd.command("run <name>").description("Trigger a deployment run (native on Qoder/Claude, emulated on Bailian/Ark)").addOption(configFileOption()).addOption(providerOption("Target provider")).action(withResolvedConfigFile(deploymentRunCommand));
2022
+ var memoryStoreCmd = program.command("memory-store").description("Manage persistent memory stores");
2023
+ memoryStoreCmd.command("create <name>").addOption(configFileOption()).addOption(providerOption("Target provider")).option("--description <description>").action(withResolvedConfigFile(memoryStoreCreateCommand));
2024
+ memoryStoreCmd.command("list").addOption(configFileOption()).addOption(providerOption("Target provider")).option("--limit <n>", "Page size", parsePositiveInteger).option("--cursor <cursor>").option("--include-archived").action(withResolvedConfigFile(memoryStoreListCommand));
2025
+ memoryStoreCmd.command("get <store-id>").addOption(configFileOption()).addOption(providerOption("Target provider")).action(withResolvedConfigFile(memoryStoreGetCommand));
2026
+ memoryStoreCmd.command("update <store-id>").addOption(configFileOption()).addOption(providerOption("Target provider")).option("--name <name>").option("--description <description>").action(withResolvedConfigFile(memoryStoreUpdateCommand));
2027
+ memoryStoreCmd.command("archive <store-id>").addOption(configFileOption()).addOption(providerOption("Target provider")).action(withResolvedConfigFile(memoryStoreArchiveCommand));
2028
+ memoryStoreCmd.command("delete <store-id>").addOption(configFileOption()).addOption(providerOption("Target provider")).action(withResolvedConfigFile(memoryStoreDeleteCommand));
2029
+ var memoryCmd = program.command("memory").description("Manage memories inside a store");
2030
+ memoryCmd.command("create <store-id> <path>").addOption(configFileOption()).addOption(providerOption("Target provider")).option("--content <text>").option("--content-file <path>").action(withResolvedConfigFile(memoryCreateCommand));
2031
+ memoryCmd.command("batch-create <store-id> <json-file>").addOption(configFileOption()).addOption(providerOption("Target provider")).addOption(new Option2("--on-conflict <mode>", "Conflict handling (Ark)").choices(["overwrite", "fail"])).action(withResolvedConfigFile(memoryBatchCreateCommand));
2032
+ memoryCmd.command("list <store-id>").addOption(configFileOption()).addOption(providerOption("Target provider")).option("--limit <n>", "Page size", parsePositiveInteger).option("--cursor <cursor>").option("--prefix <path>").option("--depth <n>", "Hierarchy depth", parsePositiveInteger).option("--full", "Include content").action(withResolvedConfigFile(memoryListCommand));
2033
+ memoryCmd.command("get <store-id> <memory-id>").addOption(configFileOption()).addOption(providerOption("Target provider")).action(withResolvedConfigFile(memoryGetCommand));
2034
+ memoryCmd.command("update <store-id> <memory-id>").addOption(configFileOption()).addOption(providerOption("Target provider")).option("--path <path>").option("--content <text>").option("--content-file <path>").option("--expected-sha256 <sha256>", "Optimistic concurrency precondition").action(withResolvedConfigFile(memoryUpdateCommand));
2035
+ memoryCmd.command("delete <store-id> <memory-id>").addOption(configFileOption()).addOption(providerOption("Target provider")).option("--expected-sha256 <sha256>", "Optimistic concurrency precondition").action(withResolvedConfigFile(memoryDeleteCommand));
2036
+ var memoryVersionCmd = memoryCmd.command("version").description("Inspect immutable memory history");
2037
+ memoryVersionCmd.command("list <store-id>").addOption(configFileOption()).addOption(providerOption("Target provider")).option("--limit <n>", "Page size", parsePositiveInteger).option("--cursor <cursor>").option("--memory-id <id>").option("--full", "Include version content").action(withResolvedConfigFile(memoryVersionListCommand));
2038
+ memoryVersionCmd.command("get <store-id> <version-id>").addOption(configFileOption()).addOption(providerOption("Target provider")).action(withResolvedConfigFile(memoryVersionGetCommand));
2039
+ memoryVersionCmd.command("redact <store-id> <version-id>").addOption(configFileOption()).addOption(providerOption("Target provider")).action(withResolvedConfigFile(memoryVersionRedactCommand));
1857
2040
  var modelsCmd = program.command("models").description("Discover available models from providers");
1858
2041
  modelsCmd.command("list").description("List models available on the configured provider(s)").addOption(configFileOption()).addOption(providerOption("Target provider")).option("--json", "Output as JSON").action(withResolvedConfigFile(modelsListCommand));
1859
2042
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  program
3
- } from "../chunk-W5APGQN3.js";
3
+ } from "../chunk-YXWT5OMX.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.2.0-beta.0",
3
+ "version": "0.3.0-beta-e537ab3-20260722",
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.2.0-beta.0",
52
+ "@openagentpack/playground": "0.3.0-beta-e537ab3-20260722",
53
53
  "@types/bun": "^1.3.14",
54
54
  "typescript": "^6.0.3"
55
55
  },
56
56
  "dependencies": {
57
- "@openagentpack/sdk": "0.2.0-beta.0",
57
+ "@openagentpack/sdk": "0.3.0-beta-e537ab3-20260722",
58
58
  "@clack/prompts": "^1.5.1",
59
59
  "chalk": "^5.6.2",
60
60
  "commander": "^14.0.3",