@keystrokehq/cli 0.1.95 → 0.1.97

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
@@ -5397,6 +5397,80 @@ function registerAgentPromptCommand(agent) {
5397
5397
  }));
5398
5398
  }
5399
5399
  //#endregion
5400
+ //#region src/commands/inspect-detail.ts
5401
+ const WORKFLOW_RUN_FIELDS = [
5402
+ "id",
5403
+ "status",
5404
+ "input",
5405
+ "output",
5406
+ "error"
5407
+ ];
5408
+ const AGENT_SESSION_FIELDS = [
5409
+ "id",
5410
+ "status",
5411
+ "title",
5412
+ "error",
5413
+ "activeRunId",
5414
+ "messageCount"
5415
+ ];
5416
+ function parseInspectDetailOptions(options) {
5417
+ const summary = Boolean(options.summary);
5418
+ const field = options.field?.trim() || void 0;
5419
+ const include = options.include;
5420
+ if (summary && field) throw new Error("Use --summary or --field, not both");
5421
+ if ((summary || field) && include !== void 0) throw new Error("Do not combine --include with --summary or --field");
5422
+ if (summary) return { kind: "summary" };
5423
+ if (field) return {
5424
+ kind: "field",
5425
+ field
5426
+ };
5427
+ return {
5428
+ kind: "raw",
5429
+ include
5430
+ };
5431
+ }
5432
+ function includeForInspectMode(mode) {
5433
+ if (mode.kind === "raw") return mode.include;
5434
+ return "none";
5435
+ }
5436
+ function writeInspectJson(value) {
5437
+ process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
5438
+ }
5439
+ function projectWorkflowRunSummary(detail) {
5440
+ return {
5441
+ id: detail.run.id,
5442
+ status: detail.run.status,
5443
+ input: detail.run.input,
5444
+ output: detail.run.output,
5445
+ error: detail.run.error
5446
+ };
5447
+ }
5448
+ function projectWorkflowRunField(detail, field) {
5449
+ if (!isWorkflowRunField(field)) throw new Error(`Unknown --field ${field}. Allowed: ${WORKFLOW_RUN_FIELDS.join(", ")}`);
5450
+ return detail.run[field];
5451
+ }
5452
+ function projectAgentSessionSummary(detail) {
5453
+ return {
5454
+ id: detail.session.id,
5455
+ status: detail.session.status,
5456
+ title: detail.session.title,
5457
+ error: detail.session.error,
5458
+ activeRunId: detail.activeRunId,
5459
+ messageCount: detail.session.messageCount
5460
+ };
5461
+ }
5462
+ function projectAgentSessionField(detail, field) {
5463
+ if (!isAgentSessionField(field)) throw new Error(`Unknown --field ${field}. Allowed: ${AGENT_SESSION_FIELDS.join(", ")}`);
5464
+ if (field === "activeRunId") return detail.activeRunId;
5465
+ return detail.session[field];
5466
+ }
5467
+ function isWorkflowRunField(field) {
5468
+ return WORKFLOW_RUN_FIELDS.includes(field);
5469
+ }
5470
+ function isAgentSessionField(field) {
5471
+ return AGENT_SESSION_FIELDS.includes(field);
5472
+ }
5473
+ //#endregion
5400
5474
  //#region src/commands/projects/run-project.ts
5401
5475
  async function withActivePlatformClient(config, fn, fromDir = process.cwd()) {
5402
5476
  await resolveActiveOrganization(config, fromDir);
@@ -5483,9 +5557,18 @@ function registerAgentSessionsCommand(agent) {
5483
5557
  });
5484
5558
  process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
5485
5559
  }));
5486
- 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 }) => {
5487
- const result = await client.agents.getSession(agentId, sessionId, { include: options.include });
5488
- process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
5560
+ 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, or none").option("--summary", "Print a concise JSON summary (status, title, error, activeRunId, messageCount)").option("--field <field>", "Print one field: id, status, title, error, activeRunId, messageCount").action((agentId, sessionId, options) => runProjectCliCommand("Get agent session failed", async ({ client }) => {
5561
+ const mode = parseInspectDetailOptions(options);
5562
+ const result = await client.agents.getSession(agentId, sessionId, { include: includeForInspectMode(mode) });
5563
+ if (mode.kind === "summary") {
5564
+ writeInspectJson(projectAgentSessionSummary(result));
5565
+ return;
5566
+ }
5567
+ if (mode.kind === "field") {
5568
+ writeInspectJson(projectAgentSessionField(result, mode.field));
5569
+ return;
5570
+ }
5571
+ writeInspectJson(result);
5489
5572
  }));
5490
5573
  sessions.command("cancel").description("Cancel a running agent session").argument("<agentId>", "Agent key / route id").argument("<sessionId>", "Agent session id").action(async (agentId, sessionId) => {
5491
5574
  const config = createCliConfig();
@@ -6770,7 +6853,7 @@ function registerBuildCommand(program) {
6770
6853
  try {
6771
6854
  const root = resolveProjectRoot(options.dir);
6772
6855
  await ensureSdkCurrent(root);
6773
- const { buildApp } = await import("./dist-BbKeSmsJ.mjs");
6856
+ const { buildApp } = await import("./dist-CaiTZ-ZO.mjs");
6774
6857
  await buildApp({ root });
6775
6858
  process.stdout.write(`Built ${root}\n`);
6776
6859
  } catch (error) {
@@ -6895,7 +6978,7 @@ async function sleep(ms) {
6895
6978
  }
6896
6979
  async function buildDeployArchive(client, root, projectId, filter) {
6897
6980
  if (filter?.length) {
6898
- const { buildFilteredApp } = await import("./dist-BbKeSmsJ.mjs");
6981
+ const { buildFilteredApp } = await import("./dist-CaiTZ-ZO.mjs");
6899
6982
  const filtered = await buildFilteredApp({
6900
6983
  root,
6901
6984
  filter,
@@ -6917,7 +7000,7 @@ async function buildDeployArchive(client, root, projectId, filter) {
6917
7000
  sourceFiles: filtered.sourceFiles
6918
7001
  };
6919
7002
  }
6920
- const { buildApp } = await import("./dist-BbKeSmsJ.mjs");
7003
+ const { buildApp } = await import("./dist-CaiTZ-ZO.mjs");
6921
7004
  const { sourceFiles } = await buildApp({
6922
7005
  root,
6923
7006
  collectSources: true,
@@ -7039,7 +7122,7 @@ function runtimeChildEnv(parentEnv, overrides) {
7039
7122
  //#region src/project/bootstrap-run.ts
7040
7123
  /** Node args + env for `@keystrokehq/build` bootstrap (shared by start + dev). */
7041
7124
  async function resolveBootstrapRun(options) {
7042
- const { resolveRuntimeBuildArtifact } = await import("./dist-BbKeSmsJ.mjs");
7125
+ const { resolveRuntimeBuildArtifact } = await import("./dist-CaiTZ-ZO.mjs");
7043
7126
  const loader = pathToFileURL(resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/runtime-loader.mjs")).href;
7044
7127
  const bootstrap = resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/standalone-bootstrap.mjs");
7045
7128
  const args = [`--import=${loader}`];
@@ -7188,7 +7271,7 @@ async function runDev(options) {
7188
7271
  process.on("SIGINT", shutdown);
7189
7272
  process.on("SIGTERM", shutdown);
7190
7273
  try {
7191
- const { watchApp } = await import("./dist-BbKeSmsJ.mjs");
7274
+ const { watchApp } = await import("./dist-CaiTZ-ZO.mjs");
7192
7275
  await watchApp({
7193
7276
  root,
7194
7277
  clean: false,
@@ -8230,7 +8313,7 @@ async function runStart(options) {
8230
8313
  const apiPort = Number(new URL(serverUrl).port || 80);
8231
8314
  const runtimeNodeModules = resolveCliRuntimeNodeModules(resolveCliRoot(import.meta.url));
8232
8315
  ensureNativeDeps(runtimeNodeModules);
8233
- const { buildApp } = await import("./dist-BbKeSmsJ.mjs");
8316
+ const { buildApp } = await import("./dist-CaiTZ-ZO.mjs");
8234
8317
  await buildApp({
8235
8318
  root,
8236
8319
  clean: false
@@ -8692,7 +8775,7 @@ Examples:
8692
8775
  const input = parseJsonOption(options.input, "--input");
8693
8776
  const result = await client.workflows.run(workflowId, input);
8694
8777
  process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
8695
- if (isQueuedRunResponse(result)) process.stderr.write(`Run queued. Track progress:\n ${cliBinaryName()} workflows runs get ${workflowId} ${result.runId} --include steps,trace\n`);
8778
+ if (isQueuedRunResponse(result)) process.stderr.write(`Run queued. Track progress:\n ${cliBinaryName()} workflows runs get ${workflowId} ${result.runId} --summary\n`);
8696
8779
  }, { usage: {
8697
8780
  command: `${cliBinaryName()} workflows run ${workflowId}`,
8698
8781
  flag: "--input"
@@ -8719,9 +8802,18 @@ function registerWorkflowRunsCommand(workflow) {
8719
8802
  });
8720
8803
  process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
8721
8804
  }));
8722
- runs.command("get").description("Get full details for a workflow run").argument("<workflowId>", "Workflow key / route id").argument("<runId>", "Workflow run id").option("--include <parts>", "Comma-separated: trigger, steps, trace").action((workflowId, runId, options) => runProjectCliCommand("Get workflow run failed", async ({ client }) => {
8723
- const result = await client.workflows.getRun(workflowId, runId, { include: options.include });
8724
- process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
8805
+ runs.command("get").description("Get full details for a workflow run").argument("<workflowId>", "Workflow key / route id").argument("<runId>", "Workflow run id").option("--include <parts>", "Comma-separated: trigger, steps, trace, or none").option("--summary", "Print a concise JSON summary (status, input, output, error)").option("--field <field>", "Print one field: id, status, input, output, error").action((workflowId, runId, options) => runProjectCliCommand("Get workflow run failed", async ({ client }) => {
8806
+ const mode = parseInspectDetailOptions(options);
8807
+ const result = await client.workflows.getRun(workflowId, runId, { include: includeForInspectMode(mode) });
8808
+ if (mode.kind === "summary") {
8809
+ writeInspectJson(projectWorkflowRunSummary(result));
8810
+ return;
8811
+ }
8812
+ if (mode.kind === "field") {
8813
+ writeInspectJson(projectWorkflowRunField(result, mode.field));
8814
+ return;
8815
+ }
8816
+ writeInspectJson(result);
8725
8817
  }));
8726
8818
  runs.command("hooks").description("List hook tokens and resume URLs for a workflow run").argument("<workflowId>", "Workflow key / route id").argument("<runId>", "Workflow run id").action((workflowId, runId) => runProjectCliCommand("List workflow run hooks failed", async ({ client }) => {
8727
8819
  const result = await client.workflows.listHooks(workflowId, runId);