@yansirplus/cli 0.5.18 → 0.5.20

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.
@@ -302,10 +302,12 @@ const renderScheduleRegistry = (schedules, modules) => {
302
302
  .map((schedule, index) => ` { scheduleId: ${jsString(schedule.scheduleId)}, path: ${jsString(schedule.path)}, cron: ${jsString(schedule.cron)}, schedule: schedule_${index} as DefinedSchedule },`)
303
303
  .join("\n")}\n]`;
304
304
  return `${scheduleImports}
305
- ${renderNamedImport(["dispatchScheduleFire"], modules.runtimeSchedule)}
305
+ ${renderNamedImport(["dispatchScheduleFire", "dispatchScheduleFireDelivery"], modules.runtimeSchedule)}
306
306
  ${renderTypeImport([
307
307
  "DefinedSchedule",
308
308
  "ScheduleDefinitionProjection",
309
+ "ScheduleFireDeliveryDispatchInput",
310
+ "ScheduleFireDeliveryDispatchResult",
309
311
  "ScheduleFireDispatchResult",
310
312
  "SchedulePrincipal",
311
313
  "ScheduleRuntime",
@@ -330,6 +332,10 @@ export type GeneratedScheduleDispatchInput = GeneratedScheduleTriggerInput & {
330
332
  readonly identity: LedgerTruthIdentity;
331
333
  };
332
334
 
335
+ export type GeneratedScheduleDeliveryDispatchInput = GeneratedScheduleDispatchInput & {
336
+ readonly history: ScheduleFireDeliveryDispatchInput["history"];
337
+ };
338
+
333
339
  export const generatedSchedules = ${entries} as const satisfies ReadonlyArray<GeneratedScheduleDefinition>;
334
340
  export const generatedScheduleDefinitions = generatedSchedules.map(
335
341
  ({ scheduleId, path, cron }) => ({ scheduleId, path, cron }),
@@ -356,6 +362,25 @@ export const dispatchGeneratedSchedule = async (
356
362
  effectAuthorityRef: input.identity.effectAuthorityRef,
357
363
  });
358
364
  };
365
+
366
+ export const dispatchGeneratedScheduleDelivery = async (
367
+ input: GeneratedScheduleDeliveryDispatchInput,
368
+ ): Promise<ScheduleFireDeliveryDispatchResult> => {
369
+ const entry = generatedScheduleRegistry.get(input.scheduleId);
370
+ if (entry === undefined) {
371
+ throw new Error(\`unknown generated schedule: \${input.scheduleId}\`);
372
+ }
373
+ return dispatchScheduleFireDelivery({
374
+ history: input.history,
375
+ runtime: input.runtime,
376
+ schedule: entry.schedule,
377
+ scheduleId: entry.scheduleId,
378
+ appPrincipal: input.appPrincipal,
379
+ scheduledAt: input.scheduledAt,
380
+ scopeRef: input.identity.scopeRef,
381
+ effectAuthorityRef: input.identity.effectAuthorityRef,
382
+ });
383
+ };
359
384
  `;
360
385
  };
361
386
  const renderSkillCatalog = (skills) => {
@@ -439,11 +464,13 @@ const generatedDynamicCapabilityTurnEvent = (
439
464
 
440
465
  const generatedDynamicSubmitBindingsFor = async (
441
466
  event: DynamicCapabilityEventRef,
467
+ input: DynamicCapabilityRunInput | undefined = undefined,
442
468
  ): Promise<GeneratedTargetResult<Pick<AgentSubmitBindings, "dynamicCapabilityProjection" | "instructionFragments">>> => {
443
469
  const projection = await runDynamicCapabilityResolvers({
444
470
  event,
445
471
  catalog: generatedDynamicCapabilityCatalog,
446
472
  resolvers: generatedDynamicCapabilityResolvers,
473
+ input,
447
474
  materials: semanticManifest.materials ?? {},
448
475
  });
449
476
  if (!projection.ok) {
@@ -602,6 +629,7 @@ const renderSubmitSpecFromRunInput = (hasSkills) => `const submitSpecFromRunInpu
602
629
  ...(input.budget === undefined ? {} : { budget: input.budget }),
603
630
  ...(input.outputSchema === undefined ? {} : { outputSchema: input.outputSchema }),
604
631
  ...(input.traceContext === undefined ? {} : { traceContext: input.traceContext }),
632
+ ...(input.dynamicCapability === undefined ? {} : { dynamicCapability: input.dynamicCapability }),
605
633
  ...(input.materials === undefined ? {} : { materials: input.materials }),
606
634
  ...(input.toolContext === undefined ? {} : { toolContext: input.toolContext }),
607
635
  ...(input.toolPolicy === undefined ? {} : { toolPolicy: input.toolPolicy }),
@@ -633,6 +661,7 @@ const submitRunInputFields = (input: SubmitRunInput): SubmitRunInput => ({
633
661
  ...(input.budget === undefined ? {} : { budget: input.budget }),
634
662
  ...(input.outputSchema === undefined ? {} : { outputSchema: input.outputSchema }),
635
663
  ...(input.traceContext === undefined ? {} : { traceContext: input.traceContext }),
664
+ ...(input.dynamicCapability === undefined ? {} : { dynamicCapability: input.dynamicCapability }),
636
665
  ...(input.materials === undefined ? {} : { materials: input.materials }),
637
666
  ...(input.toolContext === undefined ? {} : { toolContext: input.toolContext }),
638
667
  ...(input.toolPolicy === undefined ? {} : { toolPolicy: input.toolPolicy }),
@@ -655,6 +684,7 @@ const renderProductApiDurableObjectMethods = () => `
655
684
  sessionRef: input.sessionRef,
656
685
  turnRef: input.turnRef,
657
686
  }),
687
+ input.dynamicCapability,
658
688
  ).then((bindings) =>
659
689
  bindings.ok
660
690
  ? this.submitWithBindingsAndProductLink(
@@ -685,7 +715,11 @@ const renderProductApiDurableObjectMethods = () => `
685
715
  }
686
716
 
687
717
  runWorkflow(input: AgentWorkflowRunInput): Promise<SubmitResult> {
688
- return generatedSubmitBindingsFor(this.targetEnv).then((bindings) =>
718
+ return generatedSubmitBindingsFor(
719
+ this.targetEnv,
720
+ generatedDynamicCapabilityTurnEvent(),
721
+ input.dynamicCapability,
722
+ ).then((bindings) =>
689
723
  bindings.ok
690
724
  ? this.submitWithBindingsAndProductLink(
691
725
  submitSpecFromRunInput(
@@ -731,11 +765,14 @@ const generatedScheduleRuntimeFor = (target: {
731
765
  });`;
732
766
  const renderScheduleDurableObjectMethod = () => `
733
767
  dispatchSchedule(input: GeneratedScheduleTriggerInput): Promise<unknown> {
734
- return dispatchGeneratedSchedule({
735
- ...input,
736
- identity: semanticTruthIdentity,
737
- runtime: generatedScheduleRuntimeFor(this),
738
- }).then((result) => this.commitScheduleFireDispatchFull(result));
768
+ return this.events(semanticTruthIdentity).then((history) =>
769
+ dispatchGeneratedScheduleDelivery({
770
+ ...input,
771
+ history,
772
+ identity: semanticTruthIdentity,
773
+ runtime: generatedScheduleRuntimeFor(this),
774
+ }).then((result) => this.commitScheduleFireDispatchFullWithDelivery(result)),
775
+ );
739
776
  }
740
777
  `;
741
778
  const renderGeneratedWorkspaceOperations = (workspaceToolArray, usesMutationTools, usesShellTools) => `const generatedWorkspaceToolNames = ${workspaceToolArray};
@@ -787,7 +824,9 @@ const renderWorkspaceStaticTarget = (normalized, toolNames, modules) => {
787
824
  const imports = [
788
825
  `import semanticDeclarations from "./manifest.json";`,
789
826
  `import deploymentProvenance from "./deployment.json";`,
790
- ...(hasSchedules ? [renderNamedImport(["dispatchGeneratedSchedule"], "./schedules")] : []),
827
+ ...(hasSchedules
828
+ ? [renderNamedImport(["dispatchGeneratedScheduleDelivery"], "./schedules")]
829
+ : []),
791
830
  renderNamedImport(["createAgentDurableObject"], modules.cloudflareDoRuntime),
792
831
  renderNamedImport([
793
832
  "WORKSPACE_OPERATION_HOST_FACT",
@@ -815,6 +854,7 @@ const renderWorkspaceStaticTarget = (normalized, toolNames, modules) => {
815
854
  "DynamicCapabilityCompiledCatalog",
816
855
  "DynamicCapabilityEventRef",
817
856
  "DynamicCapabilityProjection",
857
+ "DynamicCapabilityRunInput",
818
858
  "SubmitInstructionFragment",
819
859
  ], modules.runtimeProtocol),
820
860
  renderTypeImport(["DynamicCapabilityResolverDefinition"], modules.runtimeCapability),
@@ -1020,6 +1060,7 @@ ${renderGeneratedLlmRoutesFor(normalized.llmRoutes)}
1020
1060
  const generatedSubmitBindingsFor = async (
1021
1061
  env: AgentOSTargetEnv,
1022
1062
  event: DynamicCapabilityEventRef = generatedDynamicCapabilityTurnEvent(),
1063
+ dynamicCapability: DynamicCapabilityRunInput | undefined = undefined,
1023
1064
  ): Promise<GeneratedTargetResult<AgentSubmitBindings>> => {
1024
1065
  const preflightDiagnostics = generatedProviderPreflightDiagnosticsFor(env);
1025
1066
  if (preflightDiagnostics.length > 0) {
@@ -1031,7 +1072,7 @@ const generatedSubmitBindingsFor = async (
1031
1072
  const capabilityGraph = generatedCapabilityInstallGraphFor(env);
1032
1073
  const routes = generatedLlmRoutesFor(env);
1033
1074
  if (!routes.ok) return routes;
1034
- const dynamicBindings = await generatedDynamicSubmitBindingsFor(event);
1075
+ const dynamicBindings = await generatedDynamicSubmitBindingsFor(event, dynamicCapability);
1035
1076
  if (!dynamicBindings.ok) return dynamicBindings;
1036
1077
  const dynamicCapabilityProjection = dynamicBindings.value.dynamicCapabilityProjection;
1037
1078
  return {
@@ -1091,13 +1132,21 @@ export class ${target.durableObject.className} extends Base${target.durableObjec
1091
1132
  }
1092
1133
 
1093
1134
  override submit(spec: AgentSubmitSpec): Promise<SubmitResult> {
1094
- return generatedSubmitBindingsFor(this.targetEnv).then((bindings) =>
1135
+ return generatedSubmitBindingsFor(
1136
+ this.targetEnv,
1137
+ generatedDynamicCapabilityTurnEvent(),
1138
+ spec.dynamicCapability,
1139
+ ).then((bindings) =>
1095
1140
  bindings.ok ? this.submitWithBindings(spec, bindings.value) : rejectTargetFailure(bindings),
1096
1141
  );
1097
1142
  }
1098
1143
 
1099
1144
  submitRunInput(input: SubmitRunInput): Promise<SubmitResult> {
1100
- return generatedSubmitBindingsFor(this.targetEnv).then((bindings) =>
1145
+ return generatedSubmitBindingsFor(
1146
+ this.targetEnv,
1147
+ generatedDynamicCapabilityTurnEvent(),
1148
+ input.dynamicCapability,
1149
+ ).then((bindings) =>
1101
1150
  bindings.ok
1102
1151
  ? this.submitWithBindings(
1103
1152
  submitSpecFromRunInput(input, bindings.value.dynamicCapabilityProjection),
@@ -1215,7 +1264,9 @@ const renderChatStaticTarget = (normalized, toolNames, modules) => {
1215
1264
  const imports = [
1216
1265
  `import semanticDeclarations from "./manifest.json";`,
1217
1266
  `import deploymentProvenance from "./deployment.json";`,
1218
- ...(hasSchedules ? [renderNamedImport(["dispatchGeneratedSchedule"], "./schedules")] : []),
1267
+ ...(hasSchedules
1268
+ ? [renderNamedImport(["dispatchGeneratedScheduleDelivery"], "./schedules")]
1269
+ : []),
1219
1270
  renderNamedImport(["createAgentDurableObject"], modules.cloudflareDoRuntime),
1220
1271
  renderNamedImport(["runDynamicCapabilityResolvers"], modules.runtimeCapability),
1221
1272
  renderNamedImport(["OpenAiCompatibleLlmTransportLive", "preflightOpenAiCompatibleProviderMaterial"], modules.openAiCompatibleTransport),
@@ -1234,6 +1285,7 @@ const renderChatStaticTarget = (normalized, toolNames, modules) => {
1234
1285
  "DynamicCapabilityCompiledCatalog",
1235
1286
  "DynamicCapabilityEventRef",
1236
1287
  "DynamicCapabilityProjection",
1288
+ "DynamicCapabilityRunInput",
1237
1289
  "SubmitInstructionFragment",
1238
1290
  ], modules.runtimeProtocol),
1239
1291
  renderTypeImport(["DynamicCapabilityResolverDefinition"], modules.runtimeCapability),
@@ -1322,6 +1374,7 @@ ${renderGeneratedLlmRoutesFor(normalized.llmRoutes)}
1322
1374
  const generatedSubmitBindingsFor = async (
1323
1375
  env: AgentOSTargetEnv,
1324
1376
  event: DynamicCapabilityEventRef = generatedDynamicCapabilityTurnEvent(),
1377
+ dynamicCapability: DynamicCapabilityRunInput | undefined = undefined,
1325
1378
  ): Promise<GeneratedTargetResult<AgentSubmitBindings>> => {
1326
1379
  const preflightDiagnostics = generatedProviderPreflightDiagnosticsFor(env);
1327
1380
  if (preflightDiagnostics.length > 0) {
@@ -1332,7 +1385,7 @@ const generatedSubmitBindingsFor = async (
1332
1385
  }
1333
1386
  const routes = generatedLlmRoutesFor(env);
1334
1387
  if (!routes.ok) return routes;
1335
- const dynamicBindings = await generatedDynamicSubmitBindingsFor(event);
1388
+ const dynamicBindings = await generatedDynamicSubmitBindingsFor(event, dynamicCapability);
1336
1389
  if (!dynamicBindings.ok) return dynamicBindings;
1337
1390
  const dynamicCapabilityProjection = dynamicBindings.value.dynamicCapabilityProjection;
1338
1391
  return {
@@ -1375,13 +1428,21 @@ export class ${target.durableObject.className} extends Base${target.durableObjec
1375
1428
  }
1376
1429
 
1377
1430
  override submit(spec: AgentSubmitSpec): Promise<SubmitResult> {
1378
- return generatedSubmitBindingsFor(this.targetEnv).then((bindings) =>
1431
+ return generatedSubmitBindingsFor(
1432
+ this.targetEnv,
1433
+ generatedDynamicCapabilityTurnEvent(),
1434
+ spec.dynamicCapability,
1435
+ ).then((bindings) =>
1379
1436
  bindings.ok ? this.submitWithBindings(spec, bindings.value) : rejectTargetFailure(bindings),
1380
1437
  );
1381
1438
  }
1382
1439
 
1383
1440
  submitRunInput(input: SubmitRunInput): Promise<SubmitResult> {
1384
- return generatedSubmitBindingsFor(this.targetEnv).then((bindings) =>
1441
+ return generatedSubmitBindingsFor(
1442
+ this.targetEnv,
1443
+ generatedDynamicCapabilityTurnEvent(),
1444
+ input.dynamicCapability,
1445
+ ).then((bindings) =>
1385
1446
  bindings.ok
1386
1447
  ? this.submitWithBindings(
1387
1448
  submitSpecFromRunInput(input, bindings.value.dynamicCapabilityProjection),
@@ -1449,7 +1510,11 @@ const renderLocalAgentApp = (normalized, toolNames, modules) => {
1449
1510
  ...(hasChannels ? [renderTypeImport(["ChannelRuntime"], modules.runtimeChannel)] : []),
1450
1511
  ...(hasSchedules
1451
1512
  ? [
1452
- renderNamedImport(["dispatchGeneratedSchedule", "generatedScheduleDefinitions", "generatedScheduleIds"], "./schedules"),
1513
+ renderNamedImport([
1514
+ "dispatchGeneratedScheduleDelivery",
1515
+ "generatedScheduleDefinitions",
1516
+ "generatedScheduleIds",
1517
+ ], "./schedules"),
1453
1518
  ]
1454
1519
  : []),
1455
1520
  ...(hasSchedules ? [renderTypeImport(["GeneratedScheduleTriggerInput"], "./schedules")] : []),
@@ -1460,13 +1525,20 @@ const renderLocalAgentApp = (normalized, toolNames, modules) => {
1460
1525
  : []),
1461
1526
  renderNamedImport(["DYNAMIC_CAPABILITY_EVENT", "manifestTruthIdentity"], modules.runtimeProtocol),
1462
1527
  renderNamedImport(["OpenAiCompatibleLlmTransportLive", "preflightOpenAiCompatibleProviderMaterial"], modules.openAiCompatibleTransport),
1463
- renderNamedImport(["projectAgentSession", "projectAgentSessions", "projectWorkflowRun", "projectWorkflowRuns"], modules.runtimeRunProjector),
1528
+ renderNamedImport([
1529
+ "projectAgentSession",
1530
+ "projectAgentSessions",
1531
+ "projectRunInspection",
1532
+ "projectWorkflowRun",
1533
+ "projectWorkflowRuns",
1534
+ ], modules.runtimeRunProjector),
1464
1535
  renderTypeImport(["AgentManifest", "SubmitResult", "SubmitRunInput"], modules.runtimeProtocol),
1465
1536
  renderTypeImport([
1466
1537
  "AgentSubmitBindings",
1467
1538
  "DynamicCapabilityCompiledCatalog",
1468
1539
  "DynamicCapabilityEventRef",
1469
1540
  "DynamicCapabilityProjection",
1541
+ "DynamicCapabilityRunInput",
1470
1542
  "SubmitInstructionFragment",
1471
1543
  ], modules.runtimeProtocol),
1472
1544
  renderTypeImport(["DynamicCapabilityResolverDefinition"], modules.runtimeCapability),
@@ -1482,6 +1554,7 @@ const renderLocalAgentApp = (normalized, toolNames, modules) => {
1482
1554
  renderTypeImport([
1483
1555
  "AgentSessionListProjection",
1484
1556
  "AgentSessionProjection",
1557
+ "RunInspection",
1485
1558
  "WorkflowRunListProjection",
1486
1559
  "WorkflowRunProjection",
1487
1560
  ], modules.runtimeRunProjector),
@@ -1587,7 +1660,7 @@ const generatedLocalSubmitInputFromRunInput = async (
1587
1660
  input: SubmitRunInput,
1588
1661
  event: DynamicCapabilityEventRef = generatedDynamicCapabilityTurnEvent(),
1589
1662
  ): Promise<LocalAgentSubmitInput> => {
1590
- const dynamicBindings = await generatedDynamicSubmitBindingsFor(event);
1663
+ const dynamicBindings = await generatedDynamicSubmitBindingsFor(event, input.dynamicCapability);
1591
1664
  if (!dynamicBindings.ok) return rejectTargetFailure(dynamicBindings);
1592
1665
  const dynamicCapabilityProjection = dynamicBindings.value.dynamicCapabilityProjection;
1593
1666
  return {
@@ -1607,8 +1680,12 @@ const generatedLocalSubmitInputFromRunInput = async (
1607
1680
  };
1608
1681
  };
1609
1682
 
1683
+ export interface LocalAgentAppRuntime extends LocalAgentRuntime {
1684
+ readonly inspectRun: (runId: number | string) => RunInspection;
1685
+ }
1686
+
1610
1687
  export interface LocalAgentApp {
1611
- readonly runtime: LocalAgentRuntime;
1688
+ readonly runtime: LocalAgentAppRuntime;
1612
1689
  readonly sessions: {
1613
1690
  readonly submitTurn: (input: AgentSessionSubmitTurnInput) => Promise<SubmitResult>;
1614
1691
  readonly inspect: (sessionRef: string) => AgentSessionProjection;
@@ -1701,6 +1778,11 @@ export const createLocalAgentApp = async (
1701
1778
  projectWorkflowRun(lowered.runtime.events(), workflowId, workflowRunId),
1702
1779
  listRuns: (workflowId: string) => projectWorkflowRuns(lowered.runtime.events(), workflowId),
1703
1780
  };
1781
+ const runtime: LocalAgentAppRuntime = {
1782
+ ...lowered.runtime,
1783
+ inspectRun: (runId) =>
1784
+ projectRunInspection(lowered.runtime.events(), runId, lowered.runtime.diagnostics()),
1785
+ };
1704
1786
  ${hasChannels
1705
1787
  ? `const channelRuntime: ChannelRuntime = {
1706
1788
  submit: (input) => lowered.runtime.submit(input),
@@ -1726,12 +1808,15 @@ export const createLocalAgentApp = async (
1726
1808
  const triggerSchedule = async (
1727
1809
  input: GeneratedScheduleTriggerInput,
1728
1810
  ): Promise<ScheduleFireProjection> => {
1729
- const result = await dispatchGeneratedSchedule({
1811
+ const result = await dispatchGeneratedScheduleDelivery({
1730
1812
  ...input,
1813
+ history: lowered.runtime.events(),
1731
1814
  identity: semanticTruthIdentity,
1732
1815
  runtime: { sessions, workflows },
1733
1816
  });
1734
- await lowered.commitScheduleFireDispatch(result);
1817
+ if (result.kind === "attempt") {
1818
+ await lowered.commitScheduleFireDispatchWithDelivery(result);
1819
+ }
1735
1820
  const projected = scheduleHistory({ scheduleId: input.scheduleId }).fires.find(
1736
1821
  (fire) => fire.fireId === result.fireId,
1737
1822
  );
@@ -1742,7 +1827,7 @@ export const createLocalAgentApp = async (
1742
1827
  };`
1743
1828
  : ""}
1744
1829
  return {
1745
- runtime: lowered.runtime,
1830
+ runtime,
1746
1831
  sessions,
1747
1832
  workflows,
1748
1833
  ${hasChannels ? "channels,\n " : ""}customCommand,
@@ -3083,6 +3168,17 @@ export const linkWorkspaceStaticTarget = (normalized, options = {}) => {
3083
3168
  source: modules.workspaceAgentHost,
3084
3169
  imports: ["WorkspaceAgentCustomCommandInput"],
3085
3170
  },
3171
+ {
3172
+ kind: "target-runtime",
3173
+ source: modules.runtimeRunProjector,
3174
+ imports: [
3175
+ "projectAgentSession",
3176
+ "projectAgentSessions",
3177
+ "projectRunInspection",
3178
+ "projectWorkflowRun",
3179
+ "projectWorkflowRuns",
3180
+ ],
3181
+ },
3086
3182
  ...generatedToolImports(authoredManifestToolNames),
3087
3183
  ...generatedDynamicResolverImports(normalized.dynamicResolvers),
3088
3184
  ...(hasChannels
@@ -3113,6 +3209,7 @@ export const linkWorkspaceStaticTarget = (normalized, options = {}) => {
3113
3209
  source: "./schedules",
3114
3210
  imports: [
3115
3211
  "dispatchGeneratedSchedule",
3212
+ "dispatchGeneratedScheduleDelivery",
3116
3213
  "generatedScheduleDefinitions",
3117
3214
  "generatedSchedules",
3118
3215
  ],
@@ -3230,6 +3327,7 @@ export const linkWorkspaceStaticTarget = (normalized, options = {}) => {
3230
3327
  source: "./schedules",
3231
3328
  imports: [
3232
3329
  "dispatchGeneratedSchedule",
3330
+ "dispatchGeneratedScheduleDelivery",
3233
3331
  "generatedScheduleDefinitions",
3234
3332
  "generatedSchedules",
3235
3333
  ],
@@ -926,6 +926,9 @@ const PRODUCT_COMMAND = {
926
926
  INSPECT_WORKFLOW_RUN: "inspectWorkflowRun",
927
927
  LIST_WORKFLOW_RUNS: "listWorkflowRuns",
928
928
  };
929
+ const RUNTIME_COMMAND = {
930
+ INSPECT_RUN: "inspectRuntimeRun",
931
+ };
929
932
  class HttpFailure extends Error {
930
933
  status;
931
934
  constructor(status, message) {
@@ -1047,6 +1050,18 @@ const invokeLocalAgentCommand = async (app, request) => {
1047
1050
  const record = commandInputRecord(input, "submit");
1048
1051
  return app.runtime.submit(assertSubmitRunInput(record.input, "submit"));
1049
1052
  }
1053
+ if (name === RUNTIME_COMMAND.INSPECT_RUN) {
1054
+ if (app.runtime.inspectRun === undefined) {
1055
+ throw new HttpFailure(501, "runtime run inspection is unavailable");
1056
+ }
1057
+ const record = commandInputRecord(input, "inspectRuntimeRun");
1058
+ const rawRunId = record.runId;
1059
+ if (!((typeof rawRunId === "number" && Number.isInteger(rawRunId) && rawRunId >= 1) ||
1060
+ (typeof rawRunId === "string" && rawRunId.length > 0))) {
1061
+ throw new HttpFailure(400, "invalid runtime run identity");
1062
+ }
1063
+ return app.runtime.inspectRun(rawRunId);
1064
+ }
1050
1065
  if (name === PRODUCT_COMMAND.SUBMIT_SESSION_TURN) {
1051
1066
  if (app.sessions === undefined)
1052
1067
  throw new HttpFailure(501, "sessions are unavailable");