@lace-cloud/canvas 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,6 +26,7 @@ __export(engine_exports, {
26
26
  CORE_COMMAND_ACTIONS: () => CORE_COMMAND_ACTIONS,
27
27
  CommandDetachedError: () => CommandDetachedError,
28
28
  CommandExitError: () => CommandExitError,
29
+ CommandUnobservedError: () => CommandUnobservedError,
29
30
  ConnectError: () => ConnectError,
30
31
  EMPTY_REPORT_FOLD: () => EMPTY_REPORT_FOLD,
31
32
  InputMode: () => InputMode,
@@ -3441,6 +3442,11 @@ var Reason = /* @__PURE__ */ ((Reason2) => {
3441
3442
  Reason2[Reason2["REASON_TOOL_MISSING"] = 14] = "REASON_TOOL_MISSING";
3442
3443
  Reason2[Reason2["REASON_CROSS_SCOPE"] = 15] = "REASON_CROSS_SCOPE";
3443
3444
  Reason2[Reason2["REASON_UNAUTHENTICATED"] = 16] = "REASON_UNAUTHENTICATED";
3445
+ Reason2[Reason2["REASON_IMPORT_RESIDUAL"] = 17] = "REASON_IMPORT_RESIDUAL";
3446
+ Reason2[Reason2["REASON_STACK_HAS_STATE"] = 18] = "REASON_STACK_HAS_STATE";
3447
+ Reason2[Reason2["REASON_NO_ORIGIN_REMOTE"] = 19] = "REASON_NO_ORIGIN_REMOTE";
3448
+ Reason2[Reason2["REASON_IMPORT_UNDECLARED"] = 20] = "REASON_IMPORT_UNDECLARED";
3449
+ Reason2[Reason2["REASON_ALREADY_IMPORTED"] = 21] = "REASON_ALREADY_IMPORTED";
3444
3450
  Reason2[Reason2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
3445
3451
  return Reason2;
3446
3452
  })(Reason || {});
@@ -3497,6 +3503,21 @@ function reasonFromJSON(object) {
3497
3503
  case 16:
3498
3504
  case "REASON_UNAUTHENTICATED":
3499
3505
  return 16 /* REASON_UNAUTHENTICATED */;
3506
+ case 17:
3507
+ case "REASON_IMPORT_RESIDUAL":
3508
+ return 17 /* REASON_IMPORT_RESIDUAL */;
3509
+ case 18:
3510
+ case "REASON_STACK_HAS_STATE":
3511
+ return 18 /* REASON_STACK_HAS_STATE */;
3512
+ case 19:
3513
+ case "REASON_NO_ORIGIN_REMOTE":
3514
+ return 19 /* REASON_NO_ORIGIN_REMOTE */;
3515
+ case 20:
3516
+ case "REASON_IMPORT_UNDECLARED":
3517
+ return 20 /* REASON_IMPORT_UNDECLARED */;
3518
+ case 21:
3519
+ case "REASON_ALREADY_IMPORTED":
3520
+ return 21 /* REASON_ALREADY_IMPORTED */;
3500
3521
  case -1:
3501
3522
  case "UNRECOGNIZED":
3502
3523
  default:
@@ -3539,6 +3560,16 @@ function reasonToJSON(object) {
3539
3560
  return "REASON_CROSS_SCOPE";
3540
3561
  case 16 /* REASON_UNAUTHENTICATED */:
3541
3562
  return "REASON_UNAUTHENTICATED";
3563
+ case 17 /* REASON_IMPORT_RESIDUAL */:
3564
+ return "REASON_IMPORT_RESIDUAL";
3565
+ case 18 /* REASON_STACK_HAS_STATE */:
3566
+ return "REASON_STACK_HAS_STATE";
3567
+ case 19 /* REASON_NO_ORIGIN_REMOTE */:
3568
+ return "REASON_NO_ORIGIN_REMOTE";
3569
+ case 20 /* REASON_IMPORT_UNDECLARED */:
3570
+ return "REASON_IMPORT_UNDECLARED";
3571
+ case 21 /* REASON_ALREADY_IMPORTED */:
3572
+ return "REASON_ALREADY_IMPORTED";
3542
3573
  case -1 /* UNRECOGNIZED */:
3543
3574
  default:
3544
3575
  return "UNRECOGNIZED";
@@ -10446,6 +10477,13 @@ var CommandDetachedError = class extends Error {
10446
10477
  super("command detached: the invoking consumer stopped listening");
10447
10478
  }
10448
10479
  };
10480
+ var CommandUnobservedError = class extends Error {
10481
+ constructor() {
10482
+ super(
10483
+ "the engine's stream ended before the command exited: the command ran and may have made changes, but its outcome is unknown"
10484
+ );
10485
+ }
10486
+ };
10449
10487
 
10450
10488
  // src/adapters/engine/connect-frame.ts
10451
10489
  var END_STREAM_FLAG = 2;
@@ -10482,8 +10520,13 @@ async function* readConnectFrames(body, signal) {
10482
10520
  try {
10483
10521
  while (!signal.aborted) {
10484
10522
  const { value, done } = await reader.read();
10485
- if (done) return;
10486
10523
  if (signal.aborted) return;
10524
+ if (done) {
10525
+ throw new ConnectError(
10526
+ "internal",
10527
+ "the engine's stream was cut off before its end-of-stream frame"
10528
+ );
10529
+ }
10487
10530
  if (!value) continue;
10488
10531
  chunks.push(value);
10489
10532
  bufferedLen += value.length;
@@ -12105,6 +12148,31 @@ function completeArgs(path, partial) {
12105
12148
 
12106
12149
  // src/contracts/schemas.ts
12107
12150
  var import_zod = require("zod");
12151
+ var REASON_PREFIX = "REASON_";
12152
+ function reasonWire(reason) {
12153
+ return reasonToJSON(reason).slice(REASON_PREFIX.length).toLowerCase();
12154
+ }
12155
+ var LACE_REASONS = new Set(
12156
+ Object.values(Reason).filter((value) => typeof value === "number" && value !== -1 /* UNRECOGNIZED */).map(reasonWire)
12157
+ );
12158
+ var laceReasonSchema = import_zod.z.custom(
12159
+ (value) => typeof value === "string" && LACE_REASONS.has(value),
12160
+ { message: "not a reason of Lace\u2019s own" }
12161
+ );
12162
+ var importResidualSchema = import_zod.z.object({
12163
+ address: import_zod.z.string(),
12164
+ type: import_zod.z.string(),
12165
+ reason: import_zod.z.string()
12166
+ });
12167
+ var commandFailureSchema = import_zod.z.strictObject({
12168
+ reason: laceReasonSchema,
12169
+ message: import_zod.z.string(),
12170
+ url: import_zod.z.string().optional(),
12171
+ tool: import_zod.z.string().optional(),
12172
+ importResiduals: import_zod.z.array(importResidualSchema).optional(),
12173
+ addresses: import_zod.z.array(import_zod.z.string()).optional(),
12174
+ apiCode: import_zod.z.string().optional()
12175
+ });
12108
12176
  var moduleValidateDeviationSchema = import_zod.z.object({
12109
12177
  notCompositional: import_zod.z.boolean(),
12110
12178
  clusters: import_zod.z.array(import_zod.z.unknown()),
@@ -12156,6 +12224,7 @@ var moduleValidateResultSchema = import_zod.z.object({
12156
12224
  }).optional(),
12157
12225
  modules: import_zod.z.array(import_zod.z.object({ address: import_zod.z.string(), version: import_zod.z.string(), treeHash: import_zod.z.string() })).optional(),
12158
12226
  exitClass: import_zod.z.string(),
12227
+ failure: commandFailureSchema.optional(),
12159
12228
  diagnostics: import_zod.z.array(commandDiagnosticSchema)
12160
12229
  });
12161
12230
  var moduleConvertResultSchema = import_zod.z.object({
@@ -12266,6 +12335,7 @@ var registryDescribeSchema = import_zod.z.object({
12266
12335
  )
12267
12336
  })
12268
12337
  });
12338
+ var stackIdentSchema = import_zod.z.object({ id: import_zod.z.string(), slug: import_zod.z.string() });
12269
12339
  var stackSourceSchema = import_zod.z.object({
12270
12340
  kind: import_zod.z.literal("git"),
12271
12341
  repoUrl: import_zod.z.string(),
@@ -12449,7 +12519,7 @@ var previewEntrySchema = import_zod.z.discriminatedUnion("kind", [
12449
12519
  })
12450
12520
  ]);
12451
12521
  var stackPreviewSchema = import_zod.z.object({
12452
- stack: import_zod.z.object({ id: import_zod.z.string(), slug: import_zod.z.string() }),
12522
+ stack: stackIdentSchema,
12453
12523
  treeHash: import_zod.z.string(),
12454
12524
  plan: import_zod.z.object({ summary: planSummarySchema, human: import_zod.z.string() }),
12455
12525
  policy: import_zod.z.object({
@@ -12496,16 +12566,19 @@ var gateChangeRequestSchema = import_zod.z.object({
12496
12566
  import_zod.z.object({
12497
12567
  id: import_zod.z.string(),
12498
12568
  state: import_zod.z.string(),
12499
- decidedBy: import_zod.z.enum(["lace", "ecm"])
12569
+ decidedBy: import_zod.z.enum(["lace", "ecm"]),
12570
+ recordId: import_zod.z.string().nullable()
12500
12571
  })
12501
12572
  ),
12502
12573
  records: import_zod.z.array(
12503
12574
  import_zod.z.object({
12575
+ id: import_zod.z.string(),
12504
12576
  externalSystemId: import_zod.z.string(),
12505
12577
  kind: import_zod.z.string(),
12506
12578
  externalRef: import_zod.z.string().nullable(),
12507
12579
  externalUrl: import_zod.z.string().nullable(),
12508
- state: import_zod.z.string().nullable()
12580
+ state: import_zod.z.string().nullable(),
12581
+ decision: import_zod.z.enum(["approved", "rejected"]).nullable()
12509
12582
  })
12510
12583
  )
12511
12584
  });
@@ -12529,6 +12602,7 @@ var runEventSchema = import_zod.z.discriminatedUnion("type", [
12529
12602
  })
12530
12603
  ]);
12531
12604
  var stackScanSchema = import_zod.z.object({
12605
+ stack: stackIdentSchema,
12532
12606
  triggered: import_zod.z.boolean(),
12533
12607
  reason: import_zod.z.string().nullable(),
12534
12608
  settled: import_zod.z.object({
@@ -12536,14 +12610,17 @@ var stackScanSchema = import_zod.z.object({
12536
12610
  driftCount: import_zod.z.number(),
12537
12611
  scannedAt: import_zod.z.string(),
12538
12612
  undeterminedReason: import_zod.z.string().nullable(),
12613
+ standingDriftFindings: import_zod.z.number(),
12614
+ footprintDestroyed: import_zod.z.boolean(),
12539
12615
  drift: driftSchema
12540
12616
  }).nullable()
12541
12617
  });
12542
12618
  var stackImportSchema = import_zod.z.object({
12543
- stack: import_zod.z.object({ id: import_zod.z.string(), slug: import_zod.z.string() }),
12619
+ stack: stackIdentSchema,
12544
12620
  written: import_zod.z.array(import_zod.z.string()),
12621
+ removed: import_zod.z.array(import_zod.z.string()),
12545
12622
  importBlocks: import_zod.z.number(),
12546
- importResiduals: import_zod.z.array(import_zod.z.unknown()),
12623
+ importResiduals: import_zod.z.array(importResidualSchema),
12547
12624
  validate: moduleValidateResultSchema
12548
12625
  });
12549
12626
  var artifactRefSchema = import_zod.z.object({ url: import_zod.z.string(), key: import_zod.z.string() });
@@ -12655,24 +12732,6 @@ function isBoundPath(path) {
12655
12732
  function parseBound(path, data) {
12656
12733
  return SCHEMAS[path].parse(data);
12657
12734
  }
12658
- var REASON_PREFIX = "REASON_";
12659
- function reasonWire(reason) {
12660
- return reasonToJSON(reason).slice(REASON_PREFIX.length).toLowerCase();
12661
- }
12662
- var LACE_REASONS = new Set(
12663
- Object.values(Reason).filter((value) => typeof value === "number" && value !== -1 /* UNRECOGNIZED */).map(reasonWire)
12664
- );
12665
- var laceReasonSchema = import_zod.z.custom(
12666
- (value) => typeof value === "string" && LACE_REASONS.has(value),
12667
- { message: "not a reason of Lace\u2019s own" }
12668
- );
12669
- var commandFailureSchema = import_zod.z.strictObject({
12670
- reason: laceReasonSchema,
12671
- message: import_zod.z.string(),
12672
- url: import_zod.z.string().optional(),
12673
- tool: import_zod.z.string().optional(),
12674
- apiCode: import_zod.z.string().optional()
12675
- });
12676
12735
  var failureMarkSchema = import_zod.z.object({ reason: import_zod.z.string(), message: import_zod.z.string() });
12677
12736
  function carriesFailure(data) {
12678
12737
  return failureMarkSchema.safeParse(data).success;
@@ -12680,6 +12739,12 @@ function carriesFailure(data) {
12680
12739
  function parseCommandFailure(data) {
12681
12740
  return commandFailureSchema.parse(data);
12682
12741
  }
12742
+ function resultFailure(path, data) {
12743
+ const result = parseBound(path, data);
12744
+ if ("failure" in result) return result.failure;
12745
+ if ("validate" in result) return result.validate.failure;
12746
+ return void 0;
12747
+ }
12683
12748
 
12684
12749
  // src/utils/is-plain-object.ts
12685
12750
  function isPlainObject(val) {
@@ -12951,13 +13016,14 @@ function commandsPort(caller, commandPaths, ownCwd) {
12951
13016
  throw new CommandExitError(
12952
13017
  event.exit.code,
12953
13018
  event.exit.stderr_tail,
12954
- exitFailure(event.exit.document)
13019
+ exitFailure(path, event.exit.document)
12955
13020
  );
12956
13021
  }
12957
13022
  return;
12958
13023
  }
12959
13024
  }
12960
- throw new CommandDetachedError();
13025
+ if (signal.aborted) throw new CommandDetachedError();
13026
+ throw new CommandUnobservedError();
12961
13027
  }
12962
13028
  return {
12963
13029
  events: run(),
@@ -12968,10 +13034,10 @@ function commandsPort(caller, commandPaths, ownCwd) {
12968
13034
  }
12969
13035
  };
12970
13036
  }
12971
- function exitFailure(document) {
13037
+ function exitFailure(path, document) {
12972
13038
  if (document === "") return void 0;
12973
13039
  const data = JSON.parse(document);
12974
- return carriesFailure(data) ? parseCommandFailure(data) : void 0;
13040
+ return carriesFailure(data) ? parseCommandFailure(data) : resultFailure(path, data);
12975
13041
  }
12976
13042
  async function openSession(caller, target) {
12977
13043
  if ("fixture" in target) {
@@ -13053,7 +13119,7 @@ function defineCommand(binding) {
13053
13119
  if (!binding.confirm) return void 0;
13054
13120
  const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
13055
13121
  if (!merged.ok) return void 0;
13056
- return binding.confirm(ctx, merged.args);
13122
+ return binding.confirm(ctx, merged.args, target);
13057
13123
  },
13058
13124
  async start(rt, ctx, target, formArgs, signal) {
13059
13125
  const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
@@ -13112,6 +13178,21 @@ var destroy = defineCommand({
13112
13178
  invalidates: "start+settle",
13113
13179
  result: slotSink("run")
13114
13180
  });
13181
+ function scanNotice(e) {
13182
+ const { slug } = e.stack;
13183
+ const settled = e.settled;
13184
+ if (!settled) {
13185
+ return e.triggered ? `Drift scan triggered for stack ${slug} (${e.stack.id}).` : `Drift scan already in progress for stack ${slug}.`;
13186
+ }
13187
+ if (settled.undeterminedReason !== null) return void 0;
13188
+ if (settled.footprintDestroyed) {
13189
+ return `Drift scan complete for stack ${slug}: IN_SYNC (0 drifted) \u2014 its resources were destroyed, so there was nothing to compare.`;
13190
+ }
13191
+ if (settled.standingDriftFindings > 0) {
13192
+ return `Drift scan complete for stack ${slug}: the scan observed no drift, but ${settled.standingDriftFindings} drift finding(s) from earlier scans still stand \u2014 the stack remains DRIFTED.`;
13193
+ }
13194
+ return `Drift scan complete for stack ${slug}: ${settled.driftStatus} (${settled.driftCount} drifted).`;
13195
+ }
13115
13196
  var scan = defineCommand({
13116
13197
  kind: "command",
13117
13198
  path: "stack scan",
@@ -13120,14 +13201,8 @@ var scan = defineCommand({
13120
13201
  result: {
13121
13202
  kind: "notify",
13122
13203
  consume: (rt, e) => {
13123
- if (!e.triggered) {
13124
- rt.ports.presenter.notify("info", e.reason ?? "Scan skipped");
13125
- return;
13126
- }
13127
- rt.ports.presenter.notify(
13128
- "info",
13129
- e.settled ? `Scan complete \u2014 ${e.settled.driftStatus}` : "Scan triggered"
13130
- );
13204
+ const notice = scanNotice(e);
13205
+ if (notice !== void 0) rt.ports.presenter.notify("info", notice);
13131
13206
  }
13132
13207
  }
13133
13208
  });
@@ -13141,15 +13216,51 @@ var create = defineCommand({
13141
13216
  consume: (rt, e) => rt.ports.presenter.notify("info", `Created stack ${e.slug}`)
13142
13217
  }
13143
13218
  });
13219
+ function residualAddresses(residuals) {
13220
+ return residuals.map((r) => r.address).join(", ");
13221
+ }
13222
+ function treeChanges(e) {
13223
+ return [
13224
+ ...e.written.length === 0 ? [] : [`rewriting ${e.written.join(", ")} in place`],
13225
+ ...e.removed.length === 0 ? [] : [`removing ${e.removed.join(", ")}`]
13226
+ ];
13227
+ }
13228
+ function importNotice(e) {
13229
+ const { slug } = e.stack;
13230
+ const changes = treeChanges(e);
13231
+ const changed = changes.length > 0;
13232
+ const files = changed ? `, ${changes.join(" and ")}` : "";
13233
+ const imported = `Imported ${e.importBlocks} resource(s) into ${slug}${files}.`;
13234
+ if (e.validate.exitClass !== "ok") {
13235
+ return ["warn", `${imported} The tree did not validate: fix it before you commit it.`];
13236
+ }
13237
+ const adopt = changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
13238
+ if (e.importResiduals.length === 0) return ["info", `${imported}${adopt}`];
13239
+ return [
13240
+ "warn",
13241
+ `${imported}${adopt} Not adopted: ${residualAddresses(e.importResiduals)}; supply their import ids before applying, or the apply creates them anew.`
13242
+ ];
13243
+ }
13244
+ var importResult = {
13245
+ kind: "notify",
13246
+ consume: (rt, e) => rt.ports.presenter.notify(...importNotice(e))
13247
+ };
13144
13248
  var importStack = defineCommand({
13145
13249
  kind: "command",
13146
13250
  path: "stack import",
13147
13251
  args: (ctx) => ({ stack: ctx.stack?.id }),
13148
13252
  invalidates: true,
13149
- result: {
13150
- kind: "notify",
13151
- consume: (rt, e) => rt.ports.presenter.notify("info", `Imported ${e.importBlocks} block(s) into ${e.stack.slug}`)
13152
- }
13253
+ result: importResult
13254
+ });
13255
+ var importPartial = defineCommand({
13256
+ kind: "command",
13257
+ path: "stack import",
13258
+ args: (ctx) => ({ stack: ctx.stack?.id, allowPartial: true }),
13259
+ confirm: (ctx, _args, target) => ({
13260
+ text: `Import into ${ctx.stack?.slug} without adopting ${residualAddresses(target.failure?.importResiduals ?? [])}? Lace writes no import block for them, so the stack's apply creates them anew beside the live ones.`
13261
+ }),
13262
+ invalidates: true,
13263
+ result: importResult
13153
13264
  });
13154
13265
  var validate = defineCommand({
13155
13266
  kind: "command",
@@ -13217,12 +13328,14 @@ var MODULE_COMMAND_ACTIONS = [
13217
13328
  requiredContext: ["root"],
13218
13329
  binding: convert
13219
13330
  },
13220
- // The refused-tf banner's one action while the tree is out of lace shape:
13221
- // the same `module convert` the toolbar runs. The engine re-derives the
13222
- // tree it writes, which accepts it and lifts the lock.
13331
+ // Convert on the source-refused banner while the tree is out of lace
13332
+ // shape: the same `module convert` the toolbar runs, and the choice the
13333
+ // banner says of it. The engine re-derives the tree it writes, which
13334
+ // accepts it and lifts the lock.
13223
13335
  {
13224
13336
  id: "convert-refused",
13225
13337
  label: "Convert",
13338
+ choice: "Convert restructures it in place; a stack's apply creates only what its state does not hold yet.",
13226
13339
  icon: "convert",
13227
13340
  placement: { row: "source-refused" },
13228
13341
  requiredPorts: ["commands"],
@@ -13272,7 +13385,7 @@ var STACK_COMMAND_ACTIONS = [
13272
13385
  },
13273
13386
  {
13274
13387
  id: "import",
13275
- label: "Import state",
13388
+ label: "Import existing resources",
13276
13389
  placement: "toolbar",
13277
13390
  requiredPorts: ["commands"],
13278
13391
  // `stack import` writes the directory it runs in, the same way
@@ -13280,6 +13393,15 @@ var STACK_COMMAND_ACTIONS = [
13280
13393
  requiredContext: ["root", "stack"],
13281
13394
  binding: importStack
13282
13395
  },
13396
+ {
13397
+ id: "import-partial",
13398
+ label: "Import the rest",
13399
+ placement: { row: "failure" },
13400
+ requiredPorts: ["commands"],
13401
+ requiredContext: ["root", "stack"],
13402
+ answers: ["import_residual"],
13403
+ binding: importPartial
13404
+ },
13283
13405
  {
13284
13406
  id: "preview",
13285
13407
  label: "Preview",
@@ -13453,7 +13575,7 @@ function reduceRun(prev, token, event) {
13453
13575
  if (event.type === "gate" && event.changeRequest !== null) {
13454
13576
  return {
13455
13577
  token,
13456
- outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest },
13578
+ outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest, runUrl: null },
13457
13579
  lastLog,
13458
13580
  submitted,
13459
13581
  phases: closePhases(phases)
@@ -13461,7 +13583,13 @@ function reduceRun(prev, token, event) {
13461
13583
  }
13462
13584
  if (event.type === "result") {
13463
13585
  if (carried?.outcome.kind === "awaiting-approval") {
13464
- return { token, outcome: carried.outcome, lastLog, submitted, phases };
13586
+ return {
13587
+ token,
13588
+ outcome: { ...carried.outcome, runUrl: event.run.url ?? null },
13589
+ lastLog,
13590
+ submitted,
13591
+ phases
13592
+ };
13465
13593
  }
13466
13594
  if (event.error)
13467
13595
  return {
@@ -13489,7 +13617,7 @@ function settleRun(prev, token, error) {
13489
13617
  const lastLog = carried?.lastLog ?? null;
13490
13618
  const submitted = carried?.submitted ?? false;
13491
13619
  const phases = closePhases(carried?.phases ?? []);
13492
- if (error instanceof CommandDetachedError)
13620
+ if (error instanceof CommandDetachedError || error instanceof CommandUnobservedError)
13493
13621
  return { token, outcome: { kind: "detached", submitted }, lastLog, submitted, phases };
13494
13622
  if (error instanceof CommandExitError) {
13495
13623
  if (error.code === 130)
@@ -13633,7 +13761,7 @@ var CONTEXT_NEEDS = {
13633
13761
  resolved: "no open Keep or Reload conflict",
13634
13762
  conflict: "an open Keep or Reload conflict",
13635
13763
  sourceRefused: "the source-refused lock",
13636
- needsConversion: "a tree that needs conversion",
13764
+ needsConversion: "a tree out of lace shape",
13637
13765
  "selection.node": "a selected node",
13638
13766
  "selection.edge": "a selected connection",
13639
13767
  diagnostics: "diagnostics to show",
@@ -13648,7 +13776,8 @@ var TARGET_NEEDS = {
13648
13776
  nodeId: "a node",
13649
13777
  groupId: "a group",
13650
13778
  diagnostic: "a diagnostic",
13651
- runId: "a run"
13779
+ runId: "a run",
13780
+ failure: "a failed command"
13652
13781
  };
13653
13782
  var BUSY_REASON = "A run is in progress";
13654
13783
  function keySatisfied(ctx, key) {
@@ -13705,6 +13834,12 @@ function unmetRequirement(action, ports, ctx, target) {
13705
13834
  if (key !== void 0) return `${label} needs ${CONTEXT_NEEDS[key]}`;
13706
13835
  const targetKey = (action.requiredTarget ?? []).find((k) => target[k] === void 0);
13707
13836
  if (targetKey !== void 0) return `${label} needs ${TARGET_NEEDS[targetKey]}`;
13837
+ if (action.answers !== void 0) {
13838
+ if (target.failure === void 0) return `${label} needs ${TARGET_NEEDS.failure}`;
13839
+ if (!action.answers.includes(target.failure.reason)) {
13840
+ return `${label} does not answer this failure`;
13841
+ }
13842
+ }
13708
13843
  if (binding.kind === "command" && !availableCommands(ports).has(binding.path)) {
13709
13844
  return `${label} runs lace ${binding.path}, which this host does not route`;
13710
13845
  }
@@ -14060,6 +14195,7 @@ function autosave(source, save, policy, report) {
14060
14195
  CORE_COMMAND_ACTIONS,
14061
14196
  CommandDetachedError,
14062
14197
  CommandExitError,
14198
+ CommandUnobservedError,
14063
14199
  ConnectError,
14064
14200
  EMPTY_REPORT_FOLD,
14065
14201
  InputMode,