@keystrokehq/cli 0.0.157 → 0.0.159

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/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { $ as OrganizationSidebarBrandingPatchSchema, $t as parseErrorResponse, A as ErrorResponseSchema, At as UpdateCredentialInstanceBodySchema, B as InviteProjectMembersRequestSchema, Bt as UploadProjectSourceResponseSchema, C as CreateOrganizationResponseSchema, Ct as StartOAuthConnectionResultSchema, D as CredentialInstanceListResponseSchema, Dt as TriggerRunDetailResponseSchema, E as CreateProjectResponseSchema, Et as TriggerListResponseSchema, F as HistoryRunDetailResponseSchema, Ft as UpdateProjectMemberRequestSchema, G as ListOrganizationInvitationsResponseSchema, Gt as UserPreferencesSchema, H as ListApiKeysResponseSchema, Ht as UserAvatarPatchSchema, I as HistoryRunListQuerySchema, It as UpdateProjectMemberResponseSchema, J as ListProjectDeploymentsResponseSchema, Jt as WorkflowSummaryDetailResponseSchema, K as ListOrganizationMembersResponseSchema, Kt as WorkflowRunDetailResponseSchema, L as HistoryRunListResponseSchema, Lt as UpdateProjectRequestSchema, M as GetCredentialResponseSchema, Mt as UpdateOrganizationMemberRequestSchema, N as HealthResponseSchema, Nt as UpdateOrganizationMemberResponseSchema, O as CredentialInstanceRecordSchema, Ot as TriggerRunListResponseSchema, P as HistoryRunCancelResponseSchema, Pt as UpdateOrganizationRequestSchema, Q as ListProjectsResponseSchema, Qt as originFromPublicUrl, R as InviteOrganizationMembersRequestSchema, Rt as UpdateProjectSettingsRequestSchema, S as CreateOrganizationRequestSchema, St as StartOAuthConnectionInputSchema, T as CreateProjectRequestSchema, Tt as TriggerDetailResponseSchema, U as ListAppsResponseSchema, Ut as UserAvatarSchema, V as InviteProjectMembersResponseSchema, Vt as UpsertGatewayAttachmentBodySchema, W as ListCredentialsResponseSchema, Wt as UserPreferencesPatchSchema, X as ListProjectMembersResponseSchema, Xt as listenPortFromPublicUrl, Y as ListProjectFilesResponseSchema, Yt as WorkflowSummaryListResponseSchema, Z as ListProjectMetricsResponseSchema, _ as CreateApiKeyRequestSchema, _t as ROUTE_MANIFEST_REL_PATH, a as AgentSessionListResponseSchema, at as PresignProjectSourceRequestSchema, b as CreateCredentialsRequestSchema, bt as SkillSummaryListResponseSchema, c as BindChannelBodySchema, ct as PresignUserAvatarResponseSchema, d as ChannelConnectionSchema, dt as ProjectSettingsResponseSchema, et as OrganizationSidebarBrandingSchema, f as ChannelDirectoryListResponseSchema, ft as ProjectSlugAvailabilityResponseSchema, g as ConnectProvidersResponseSchema, gt as QueuedRunResponseSchema, h as ConnectAuthorizeUrlResponseSchema, ht as QueuedAgentPromptResponseSchema, i as AgentSessionDetailResponseSchema, it as PresignOrgLogoResponseSchema, j as GatewayAttachmentRecordSchema, jt as UpdateCredentialRequestSchema, k as DeclineOrganizationInvitationResponseSchema, kt as UpdateChannelBindingBodySchema, l as ChannelAccountListResponseSchema, lt as ProjectReachabilityResponseSchema, m as CompleteProjectArtifactResponseSchema, mt as PromptResponseSchema, n as AcceptOrganizationInvitationResponseSchema, nt as PollRunResponseSchema, o as AgentSummaryDetailResponseSchema, ot as PresignProjectSourceResponseSchema, p as ChannelPlatformSchema, pt as PromptInputSchema, q as ListOrganizationsResponseSchema, qt as WorkflowRunListResponseSchema, r as ActiveOrganizationResponseSchema, rt as PresignOrgLogoRequestSchema, s as AgentSummaryListResponseSchema, st as PresignUserAvatarRequestSchema, t as ACTIVE_ORG_HEADER, tt as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, u as ChannelConnectionListResponseSchema, ut as ProjectResponseSchema, v as CreateApiKeyResponseSchema, vt as RecentResourceListResponseSchema, w as CreateProjectArtifactResponseSchema, wt as SubmitTeamRequestRequestSchema, x as CreateCredentialsResponseSchema, xt as SlugAvailabilityResponseSchema, y as CreateCredentialInstanceBodySchema, yt as SkillSummaryDetailResponseSchema, z as InviteOrganizationMembersResponseSchema, zt as UploadProjectSourceManifestRequestSchema } from "./dist-BQXd3jdL.mjs";
2
+ import { $ as OrganizationSidebarBrandingPatchSchema, $t as parseErrorResponse, A as ErrorResponseSchema, At as UpdateCredentialInstanceBodySchema, B as InviteProjectMembersRequestSchema, Bt as UploadProjectSourceResponseSchema, C as CreateOrganizationResponseSchema, Ct as StartOAuthConnectionResultSchema, D as CredentialInstanceListResponseSchema, Dt as TriggerRunDetailResponseSchema, E as CreateProjectResponseSchema, Et as TriggerListResponseSchema, F as HistoryRunDetailResponseSchema, Ft as UpdateProjectMemberRequestSchema, G as ListOrganizationInvitationsResponseSchema, Gt as UserPreferencesSchema, H as ListApiKeysResponseSchema, Ht as UserAvatarPatchSchema, I as HistoryRunListQuerySchema, It as UpdateProjectMemberResponseSchema, J as ListProjectDeploymentsResponseSchema, Jt as WorkflowSummaryDetailResponseSchema, K as ListOrganizationMembersResponseSchema, Kt as WorkflowRunDetailResponseSchema, L as HistoryRunListResponseSchema, Lt as UpdateProjectRequestSchema, M as GetCredentialResponseSchema, Mt as UpdateOrganizationMemberRequestSchema, N as HealthResponseSchema, Nt as UpdateOrganizationMemberResponseSchema, O as CredentialInstanceRecordSchema, Ot as TriggerRunListResponseSchema, P as HistoryRunCancelResponseSchema, Pt as UpdateOrganizationRequestSchema, Q as ListProjectsResponseSchema, Qt as originFromPublicUrl, R as InviteOrganizationMembersRequestSchema, Rt as UpdateProjectSettingsRequestSchema, S as CreateOrganizationRequestSchema, St as StartOAuthConnectionInputSchema, T as CreateProjectRequestSchema, Tt as TriggerDetailResponseSchema, U as ListAppsResponseSchema, Ut as UserAvatarSchema, V as InviteProjectMembersResponseSchema, Vt as UpsertGatewayAttachmentBodySchema, W as ListCredentialsResponseSchema, Wt as UserPreferencesPatchSchema, X as ListProjectMembersResponseSchema, Xt as listenPortFromPublicUrl, Y as ListProjectFilesResponseSchema, Yt as WorkflowSummaryListResponseSchema, Z as ListProjectMetricsResponseSchema, _ as CreateApiKeyRequestSchema, _t as ROUTE_MANIFEST_REL_PATH, a as AgentSessionListResponseSchema, at as PresignProjectSourceRequestSchema, b as CreateCredentialsRequestSchema, bt as SkillSummaryListResponseSchema, c as BindChannelBodySchema, ct as PresignUserAvatarResponseSchema, d as ChannelConnectionSchema, dt as ProjectSettingsResponseSchema, et as OrganizationSidebarBrandingSchema, f as ChannelDirectoryListResponseSchema, ft as ProjectSlugAvailabilityResponseSchema, g as ConnectProvidersResponseSchema, gt as QueuedRunResponseSchema, h as ConnectAuthorizeUrlResponseSchema, ht as QueuedAgentPromptResponseSchema, i as AgentSessionDetailResponseSchema, it as PresignOrgLogoResponseSchema, j as GatewayAttachmentRecordSchema, jt as UpdateCredentialRequestSchema, k as DeclineOrganizationInvitationResponseSchema, kt as UpdateChannelBindingBodySchema, l as ChannelAccountListResponseSchema, lt as ProjectReachabilityResponseSchema, m as CompleteProjectArtifactResponseSchema, mt as PromptResponseSchema, n as AcceptOrganizationInvitationResponseSchema, nt as PollRunResponseSchema, o as AgentSummaryDetailResponseSchema, ot as PresignProjectSourceResponseSchema, p as ChannelPlatformSchema, pt as PromptInputSchema, q as ListOrganizationsResponseSchema, qt as WorkflowRunListResponseSchema, r as ActiveOrganizationResponseSchema, rt as PresignOrgLogoRequestSchema, s as AgentSummaryListResponseSchema, st as PresignUserAvatarRequestSchema, t as ACTIVE_ORG_HEADER, tt as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, u as ChannelConnectionListResponseSchema, ut as ProjectResponseSchema, v as CreateApiKeyResponseSchema, vt as RecentResourceListResponseSchema, w as CreateProjectArtifactResponseSchema, wt as SubmitTeamRequestRequestSchema, x as CreateCredentialsResponseSchema, xt as SlugAvailabilityResponseSchema, y as CreateCredentialInstanceBodySchema, yt as SkillSummaryDetailResponseSchema, z as InviteOrganizationMembersResponseSchema, zt as UploadProjectSourceManifestRequestSchema } from "./dist-Dk0phE6_.mjs";
3
3
  import { t as walkProject } from "./walk-project-171B4cvO-DJy3qZKd.mjs";
4
4
  import { a as installPlaygroundDependencies, i as installDependencies, n as buildPlaygroundWorkspace, o as resolvePackageManager, s as resolveCliRoot, t as readCliVersion } from "./version-DESgLEkE.mjs";
5
5
  import { createRequire } from "node:module";
@@ -3629,6 +3629,16 @@ function createAgentsResource(http) {
3629
3629
  } catch (error) {
3630
3630
  throw await toPlatformError(error);
3631
3631
  }
3632
+ },
3633
+ async cancelSession(sessionId) {
3634
+ try {
3635
+ const response = await http.post(`api/agents/sessions/${encodeURIComponent(sessionId)}/cancel`);
3636
+ if (response.status === 404) return null;
3637
+ const data = await response.json();
3638
+ return HistoryRunCancelResponseSchema.parse(data);
3639
+ } catch (error) {
3640
+ throw await toPlatformError(error);
3641
+ }
3632
3642
  }
3633
3643
  };
3634
3644
  }
@@ -3722,6 +3732,16 @@ function createWorkflowsResource(http) {
3722
3732
  } catch (error) {
3723
3733
  throw await toPlatformError(error);
3724
3734
  }
3735
+ },
3736
+ async cancelRun(runId) {
3737
+ try {
3738
+ const response = await http.post(`api/workflows/runs/${encodeURIComponent(runId)}/cancel`);
3739
+ if (response.status === 404) return null;
3740
+ const data = await response.json();
3741
+ return HistoryRunCancelResponseSchema.parse(data);
3742
+ } catch (error) {
3743
+ throw await toPlatformError(error);
3744
+ }
3725
3745
  }
3726
3746
  };
3727
3747
  }
@@ -4030,16 +4050,6 @@ function createHistoryResource(http) {
4030
4050
  } catch (error) {
4031
4051
  throw await toPlatformError(error);
4032
4052
  }
4033
- },
4034
- async cancel(runId) {
4035
- try {
4036
- const response = await http.post(`api/history/${encodeURIComponent(runId)}/cancel`);
4037
- if (response.status === 404) return null;
4038
- const data = await response.json();
4039
- return HistoryRunCancelResponseSchema.parse(data);
4040
- } catch (error) {
4041
- throw await toPlatformError(error);
4042
- }
4043
4053
  }
4044
4054
  };
4045
4055
  }
@@ -4722,32 +4732,6 @@ function registerAgentPromptCommand(agent) {
4722
4732
  }));
4723
4733
  }
4724
4734
  //#endregion
4725
- //#region src/commands/agent/sessions.ts
4726
- function registerAgentSessionsCommand(agent) {
4727
- const sessions = agent.command("sessions").description("List and inspect agent sessions");
4728
- sessions.command("list").description("List sessions for an agent").argument("<agentId>", "Agent key / route id").option("--limit <n>", "Page size (1–100)", "20").option("--cursor <cursor>", "Pagination cursor from a previous page").option("--status <status>", "Filter by status (running, completed, failed)").option("--source <source>", "Filter by source (api, gateway)").action((agentId, options) => runProjectCliCommand("List agent sessions failed", async ({ client }) => {
4729
- const result = await client.agents.listSessions(agentId, {
4730
- limit: Number(options.limit),
4731
- ...options.cursor ? { cursor: options.cursor } : {},
4732
- ...options.status ? { status: options.status } : {},
4733
- ...options.source ? { source: options.source } : {}
4734
- });
4735
- process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
4736
- }));
4737
- sessions.command("get").description("Get full details for an agent session").argument("<agentId>", "Agent key / route id").argument("<sessionId>", "Agent session id").option("--include <parts>", "Comma-separated: gateway, messages, events, trace").action((agentId, sessionId, options) => runProjectCliCommand("Get agent session failed", async ({ client }) => {
4738
- const result = await client.agents.getSession(agentId, sessionId, { include: options.include });
4739
- process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
4740
- }));
4741
- }
4742
- //#endregion
4743
- //#region src/commands/agent/index.ts
4744
- function registerAgentCommand(program) {
4745
- const agent = program.command("agent").description("Invoke and inspect agents");
4746
- registerAgentListCommand(agent);
4747
- registerAgentPromptCommand(agent);
4748
- registerAgentSessionsCommand(agent);
4749
- }
4750
- //#endregion
4751
4735
  //#region src/commands/project/run-project.ts
4752
4736
  async function withActivePlatformClient(config, fn) {
4753
4737
  const platform = createCliPlatformClient(config);
@@ -4817,6 +4801,52 @@ async function runProjectDelete(config, projectId) {
4817
4801
  });
4818
4802
  }
4819
4803
  //#endregion
4804
+ //#region src/commands/agent/cancel-session.ts
4805
+ async function runAgentSessionCancel(config, sessionId) {
4806
+ await withActivePlatformClient(config, async (platform) => {
4807
+ const run = await platform.agents.cancelSession(sessionId);
4808
+ process.stdout.write(`${JSON.stringify(run, null, 2)}\n`);
4809
+ });
4810
+ }
4811
+ //#endregion
4812
+ //#region src/commands/agent/sessions.ts
4813
+ function registerAgentSessionsCommand(agent) {
4814
+ const sessions = agent.command("sessions").description("List and inspect agent sessions");
4815
+ sessions.command("list").description("List sessions for an agent").argument("<agentId>", "Agent key / route id").option("--limit <n>", "Page size (1–100)", "20").option("--cursor <cursor>", "Pagination cursor from a previous page").option("--status <status>", "Filter by status (running, completed, failed)").option("--source <source>", "Filter by source (api, gateway)").action((agentId, options) => runProjectCliCommand("List agent sessions failed", async ({ client }) => {
4816
+ const result = await client.agents.listSessions(agentId, {
4817
+ limit: Number(options.limit),
4818
+ ...options.cursor ? { cursor: options.cursor } : {},
4819
+ ...options.status ? { status: options.status } : {},
4820
+ ...options.source ? { source: options.source } : {}
4821
+ });
4822
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
4823
+ }));
4824
+ sessions.command("get").description("Get full details for an agent session").argument("<agentId>", "Agent key / route id").argument("<sessionId>", "Agent session id").option("--include <parts>", "Comma-separated: gateway, messages, events, trace").action((agentId, sessionId, options) => runProjectCliCommand("Get agent session failed", async ({ client }) => {
4825
+ const result = await client.agents.getSession(agentId, sessionId, { include: options.include });
4826
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
4827
+ }));
4828
+ sessions.command("cancel").description("Cancel a running agent session").argument("<sessionId>", "Agent session id").action(async (sessionId) => {
4829
+ const config = createCliConfig();
4830
+ try {
4831
+ await runAgentSessionCancel(config, sessionId);
4832
+ } catch (error) {
4833
+ process.stderr.write(`${formatCliError(error, "Cancel agent session failed", {
4834
+ serverUrl: getPlatformUrl(config),
4835
+ webUrl: getWebUrl(config)
4836
+ })}\n`);
4837
+ process.exitCode = 1;
4838
+ }
4839
+ });
4840
+ }
4841
+ //#endregion
4842
+ //#region src/commands/agent/index.ts
4843
+ function registerAgentCommand(program) {
4844
+ const agent = program.command("agent").description("Invoke and inspect agents");
4845
+ registerAgentListCommand(agent);
4846
+ registerAgentPromptCommand(agent);
4847
+ registerAgentSessionsCommand(agent);
4848
+ }
4849
+ //#endregion
4820
4850
  //#region src/commands/api-key/run-api-key.ts
4821
4851
  async function runApiKeyList(config) {
4822
4852
  await withActivePlatformClient(config, async (platform) => {
@@ -5209,8 +5239,7 @@ function scopeTypeFromCli(scope) {
5209
5239
  case "org": return "organization";
5210
5240
  case "user": return "user";
5211
5241
  case "project": return "project";
5212
- case "global": return "global";
5213
- default: throw new Error(`Unknown scope "${scope}". Expected org, user, project, or global.`);
5242
+ default: throw new Error(`Unknown scope "${scope}". Expected org, user, or project.`);
5214
5243
  }
5215
5244
  }
5216
5245
  //#endregion
@@ -5279,40 +5308,16 @@ async function assertNoSetConflict(client, args) {
5279
5308
  //#endregion
5280
5309
  //#region src/commands/credentials/parse-set-scopes.ts
5281
5310
  function parseCredentialSetScopes(scopes, projectSlugs) {
5282
- if (scopes.includes("global")) {
5283
- if (scopes.length > 1) throw new Error("global scope cannot be combined with org, user, or project");
5284
- if (projectSlugs.length > 0) throw new Error("global scope cannot be combined with --project-slug");
5285
- return { global: true };
5286
- }
5287
5311
  return parseConnectScopes(scopes, projectSlugs);
5288
5312
  }
5289
5313
  //#endregion
5290
5314
  //#region src/commands/credentials/set.ts
5291
5315
  function registerCredentialsSetCommand(credentials) {
5292
- credentials.command("set").description("Create a new api_key credential instance").argument("<key>", "Credential key or app id, e.g. exa").option("--scope <scope>", "org, user, project, or global (repeatable)", collectValues, []).option("--project-slug <slug>", "Project slug when scope includes project (repeatable)", collectValues, []).option("--label <label>", "Human-readable label within the scope").option("--default", "Mark as default for this scope").option("--set <field>", "Credential field as key=value or key=@env:VAR (falls back to project .env when unset in shell)", collectSetValues$1, []).action((key, options) => runCredentialsCommand("Set credential failed", async ({ platform, local }) => {
5316
+ credentials.command("set").description("Create a new api_key credential instance").argument("<key>", "Credential key or app id, e.g. exa").option("--scope <scope>", "org, user, or project (repeatable)", collectValues, []).option("--project-slug <slug>", "Project slug when scope includes project (repeatable)", collectValues, []).option("--label <label>", "Human-readable label within the scope").option("--default", "Mark as default for this scope").option("--set <field>", "Credential field as key=value or key=@env:VAR (falls back to project .env when unset in shell)", collectSetValues$1, []).action((key, options) => runCredentialsCommand("Set credential failed", async ({ platform, local }) => {
5293
5317
  const value = parseCredentialValueFields(options.set);
5294
5318
  const parsedScopes = parseCredentialSetScopes(options.scope, options.projectSlug);
5295
5319
  if (local) {
5296
5320
  const { client } = await createLocalCredentialsClient();
5297
- if ("global" in parsedScopes) {
5298
- const scopeType = scopeTypeFromCli("global");
5299
- await assertNoSetConflict(client, {
5300
- key,
5301
- scope: "global",
5302
- scopeType,
5303
- label: options.label,
5304
- setFields: options.set
5305
- });
5306
- const result = await client.credentials.createInstance({
5307
- key,
5308
- scopeType,
5309
- label: options.label,
5310
- isDefault: options.default,
5311
- value
5312
- });
5313
- process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
5314
- return;
5315
- }
5316
5321
  const targets = expandLocalCredentialTargets(parsedScopes);
5317
5322
  const instances = [];
5318
5323
  for (const target of targets) {
@@ -5340,7 +5345,6 @@ function registerCredentialsSetCommand(credentials) {
5340
5345
  process.stdout.write(`${JSON.stringify({ instances }, null, 2)}\n`);
5341
5346
  return;
5342
5347
  }
5343
- if (options.scope.includes("global") || "global" in parsedScopes) throw new Error("global scope is only supported against a local keystroke server");
5344
5348
  const created = await platform.credentials.create(buildPlatformCreateRequest({
5345
5349
  appId: key,
5346
5350
  value,
@@ -5530,7 +5534,7 @@ function registerBuildCommand(program) {
5530
5534
  program.command("build").description("Build the keystroke project for production").option("--dir <path>", "Project directory", process.cwd()).action(async (options) => {
5531
5535
  try {
5532
5536
  const root = resolveProjectRoot(options.dir);
5533
- const { buildApp } = await import("./dist-BQ0CIkZY.mjs");
5537
+ const { buildApp } = await import("./dist-Bux5mRKJ.mjs");
5534
5538
  await buildApp({ root });
5535
5539
  process.stdout.write(`Built ${root}\n`);
5536
5540
  } catch (error) {
@@ -5627,7 +5631,7 @@ async function runDeploy(options) {
5627
5631
  const client = createCliPlatformClient(config);
5628
5632
  let source;
5629
5633
  if (!options.skipBuild) {
5630
- const { buildApp } = await import("./dist-BQ0CIkZY.mjs");
5634
+ const { buildApp } = await import("./dist-Bux5mRKJ.mjs");
5631
5635
  source = { files: (await buildApp({
5632
5636
  root,
5633
5637
  collectSources: true,
@@ -5727,7 +5731,7 @@ function runtimeChildEnv(parentEnv, overrides) {
5727
5731
  //#region src/project/bootstrap-run.ts
5728
5732
  /** Node args + env for `@keystrokehq/build` bootstrap (shared by start + dev). */
5729
5733
  async function resolveBootstrapRun(options) {
5730
- const { resolveRuntimeBuildArtifact } = await import("./dist-BQ0CIkZY.mjs");
5734
+ const { resolveRuntimeBuildArtifact } = await import("./dist-Bux5mRKJ.mjs");
5731
5735
  const loader = pathToFileURL(resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/runtime-loader.mjs")).href;
5732
5736
  const bootstrap = resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/bootstrap.mjs");
5733
5737
  const args = [`--import=${loader}`];
@@ -5877,7 +5881,7 @@ async function runDev(options) {
5877
5881
  process.on("SIGINT", shutdown);
5878
5882
  process.on("SIGTERM", shutdown);
5879
5883
  try {
5880
- const { watchApp } = await import("./dist-BQ0CIkZY.mjs");
5884
+ const { watchApp } = await import("./dist-Bux5mRKJ.mjs");
5881
5885
  await watchApp({
5882
5886
  root,
5883
5887
  clean: false,
@@ -5919,16 +5923,10 @@ async function runHistoryGet(config, runId) {
5919
5923
  process.stdout.write(`${JSON.stringify(run, null, 2)}\n`);
5920
5924
  });
5921
5925
  }
5922
- async function runHistoryCancel(config, runId) {
5923
- await withActivePlatformClient(config, async (platform) => {
5924
- const run = await platform.history.cancel(runId);
5925
- process.stdout.write(`${JSON.stringify(run, null, 2)}\n`);
5926
- });
5927
- }
5928
5926
  //#endregion
5929
5927
  //#region src/commands/history/index.ts
5930
5928
  function registerHistoryCommand(program) {
5931
- const history = program.command("history").description("List, inspect, and cancel platform run history");
5929
+ const history = program.command("history").description("List and inspect platform run history");
5932
5930
  history.command("list").description("List runs across projects in the active organization").option("--project <id>", "Filter by project id").option("--status <status>", "Filter by status (pending, running, sleeping, waiting_hook, completed, failed, canceled)").option("--kind <kind>", "Filter by kind (workflow or agent)").option("--admin", "List all org resources (org owner or admin only)").action(async (options) => {
5933
5931
  const config = createCliConfig();
5934
5932
  try {
@@ -5958,18 +5956,6 @@ function registerHistoryCommand(program) {
5958
5956
  process.exitCode = 1;
5959
5957
  }
5960
5958
  });
5961
- history.command("cancel").description("Cancel a pending workflow run").argument("<runId>", "Run id").action(async (runId) => {
5962
- const config = createCliConfig();
5963
- try {
5964
- await runHistoryCancel(config, runId);
5965
- } catch (error) {
5966
- process.stderr.write(`${formatCliError(error, "Cancel history run failed", {
5967
- serverUrl: getPlatformUrl(config),
5968
- webUrl: getWebUrl(config)
5969
- })}\n`);
5970
- process.exitCode = 1;
5971
- }
5972
- });
5973
5959
  }
5974
5960
  //#endregion
5975
5961
  //#region src/commands/health.ts
@@ -6723,7 +6709,7 @@ async function runStart(options) {
6723
6709
  const apiPort = Number(new URL(serverUrl).port || 80);
6724
6710
  const runtimeNodeModules = resolveCliRuntimeNodeModules(resolveCliRoot(import.meta.url));
6725
6711
  ensureNativeDeps(runtimeNodeModules);
6726
- const { buildApp } = await import("./dist-BQ0CIkZY.mjs");
6712
+ const { buildApp } = await import("./dist-Bux5mRKJ.mjs");
6727
6713
  await buildApp({
6728
6714
  root,
6729
6715
  clean: false
@@ -6849,6 +6835,14 @@ Examples:
6849
6835
  } }));
6850
6836
  }
6851
6837
  //#endregion
6838
+ //#region src/commands/workflow/cancel-run.ts
6839
+ async function runWorkflowRunCancel(config, runId) {
6840
+ await withActivePlatformClient(config, async (platform) => {
6841
+ const run = await platform.workflows.cancelRun(runId);
6842
+ process.stdout.write(`${JSON.stringify(run, null, 2)}\n`);
6843
+ });
6844
+ }
6845
+ //#endregion
6852
6846
  //#region src/commands/workflow/runs.ts
6853
6847
  function registerWorkflowRunsCommand(workflow) {
6854
6848
  const runs = workflow.command("runs").description("List and inspect workflow runs");
@@ -6865,6 +6859,18 @@ function registerWorkflowRunsCommand(workflow) {
6865
6859
  const result = await client.workflows.getRun(workflowId, runId, { include: options.include });
6866
6860
  process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
6867
6861
  }));
6862
+ runs.command("cancel").description("Cancel a running or queued workflow run").argument("<runId>", "Workflow run id").action(async (runId) => {
6863
+ const config = createCliConfig();
6864
+ try {
6865
+ await runWorkflowRunCancel(config, runId);
6866
+ } catch (error) {
6867
+ process.stderr.write(`${formatCliError(error, "Cancel workflow run failed", {
6868
+ serverUrl: getPlatformUrl(config),
6869
+ webUrl: getWebUrl(config)
6870
+ })}\n`);
6871
+ process.exitCode = 1;
6872
+ }
6873
+ });
6868
6874
  }
6869
6875
  //#endregion
6870
6876
  //#region src/commands/workflow/index.ts