@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.
package/README.md CHANGED
@@ -138,7 +138,11 @@ const { ports, close } = await openEngineSession(caller, { root: '/path/to/autho
138
138
  `Invocation.cancel()` sends `CancelInvoke`
139
139
  only and leaves `events` running until the command's own exit — a
140
140
  `signal` abort or `close()` detaches the stream instead, without
141
- cancelling the command's remote effects.
141
+ cancelling the command's remote effects. An `Invoke` stream that ends
142
+ before the command's exit rejects `events` with `CommandDetachedError`
143
+ when the consumer's `signal` aborted, and with `CommandUnobservedError`
144
+ when the consumer was still listening: the command ran in the engine
145
+ and its outcome never arrived.
142
146
  - `openEngineCommands(caller, { cwd })` is the commands mapping:
143
147
  `Initialize` once, `Invoke` per command, no session and no Subscribe.
144
148
  - Both mappings name the protocol version this package speaks
@@ -0,0 +1,19 @@
1
+ /* The canvas's paper (PaperGrid.tsx): a layer filling the flow pane behind
2
+ * the graph, painted by the tokens' `.lace-paper-layers` recipe at the shell
3
+ * paper's pitch and threads, and still while the graph moves over it. */
4
+ .lace-canvas-paper {
5
+ position: absolute;
6
+ inset: 0;
7
+ z-index: -1;
8
+ pointer-events: none;
9
+ }
10
+
11
+ /* On a screen with two or more device pixels to the CSS pixel, its threads
12
+ * are drawn one device pixel thick, half the shell's, so the paper stays
13
+ * under the graph drawn on it. A 1x screen has no line finer than 1px, so
14
+ * there the threads keep the shell's width. */
15
+ @media (min-resolution: 2dppx) {
16
+ .lace-canvas-paper {
17
+ --lace-paper-thread-width: 0.5px;
18
+ }
19
+ }
@@ -3379,6 +3379,11 @@ var Reason = /* @__PURE__ */ ((Reason2) => {
3379
3379
  Reason2[Reason2["REASON_TOOL_MISSING"] = 14] = "REASON_TOOL_MISSING";
3380
3380
  Reason2[Reason2["REASON_CROSS_SCOPE"] = 15] = "REASON_CROSS_SCOPE";
3381
3381
  Reason2[Reason2["REASON_UNAUTHENTICATED"] = 16] = "REASON_UNAUTHENTICATED";
3382
+ Reason2[Reason2["REASON_IMPORT_RESIDUAL"] = 17] = "REASON_IMPORT_RESIDUAL";
3383
+ Reason2[Reason2["REASON_STACK_HAS_STATE"] = 18] = "REASON_STACK_HAS_STATE";
3384
+ Reason2[Reason2["REASON_NO_ORIGIN_REMOTE"] = 19] = "REASON_NO_ORIGIN_REMOTE";
3385
+ Reason2[Reason2["REASON_IMPORT_UNDECLARED"] = 20] = "REASON_IMPORT_UNDECLARED";
3386
+ Reason2[Reason2["REASON_ALREADY_IMPORTED"] = 21] = "REASON_ALREADY_IMPORTED";
3382
3387
  Reason2[Reason2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
3383
3388
  return Reason2;
3384
3389
  })(Reason || {});
@@ -3435,6 +3440,21 @@ function reasonFromJSON(object) {
3435
3440
  case 16:
3436
3441
  case "REASON_UNAUTHENTICATED":
3437
3442
  return 16 /* REASON_UNAUTHENTICATED */;
3443
+ case 17:
3444
+ case "REASON_IMPORT_RESIDUAL":
3445
+ return 17 /* REASON_IMPORT_RESIDUAL */;
3446
+ case 18:
3447
+ case "REASON_STACK_HAS_STATE":
3448
+ return 18 /* REASON_STACK_HAS_STATE */;
3449
+ case 19:
3450
+ case "REASON_NO_ORIGIN_REMOTE":
3451
+ return 19 /* REASON_NO_ORIGIN_REMOTE */;
3452
+ case 20:
3453
+ case "REASON_IMPORT_UNDECLARED":
3454
+ return 20 /* REASON_IMPORT_UNDECLARED */;
3455
+ case 21:
3456
+ case "REASON_ALREADY_IMPORTED":
3457
+ return 21 /* REASON_ALREADY_IMPORTED */;
3438
3458
  case -1:
3439
3459
  case "UNRECOGNIZED":
3440
3460
  default:
@@ -3477,6 +3497,16 @@ function reasonToJSON(object) {
3477
3497
  return "REASON_CROSS_SCOPE";
3478
3498
  case 16 /* REASON_UNAUTHENTICATED */:
3479
3499
  return "REASON_UNAUTHENTICATED";
3500
+ case 17 /* REASON_IMPORT_RESIDUAL */:
3501
+ return "REASON_IMPORT_RESIDUAL";
3502
+ case 18 /* REASON_STACK_HAS_STATE */:
3503
+ return "REASON_STACK_HAS_STATE";
3504
+ case 19 /* REASON_NO_ORIGIN_REMOTE */:
3505
+ return "REASON_NO_ORIGIN_REMOTE";
3506
+ case 20 /* REASON_IMPORT_UNDECLARED */:
3507
+ return "REASON_IMPORT_UNDECLARED";
3508
+ case 21 /* REASON_ALREADY_IMPORTED */:
3509
+ return "REASON_ALREADY_IMPORTED";
3480
3510
  case -1 /* UNRECOGNIZED */:
3481
3511
  default:
3482
3512
  return "UNRECOGNIZED";
@@ -10398,6 +10428,13 @@ var CommandDetachedError = class extends Error {
10398
10428
  super("command detached: the invoking consumer stopped listening");
10399
10429
  }
10400
10430
  };
10431
+ var CommandUnobservedError = class extends Error {
10432
+ constructor() {
10433
+ super(
10434
+ "the engine's stream ended before the command exited: the command ran and may have made changes, but its outcome is unknown"
10435
+ );
10436
+ }
10437
+ };
10401
10438
 
10402
10439
  // src/adapters/engine/connect-frame.ts
10403
10440
  var END_STREAM_FLAG = 2;
@@ -10434,8 +10471,13 @@ async function* readConnectFrames(body, signal) {
10434
10471
  try {
10435
10472
  while (!signal.aborted) {
10436
10473
  const { value, done } = await reader.read();
10437
- if (done) return;
10438
10474
  if (signal.aborted) return;
10475
+ if (done) {
10476
+ throw new ConnectError(
10477
+ "internal",
10478
+ "the engine's stream was cut off before its end-of-stream frame"
10479
+ );
10480
+ }
10439
10481
  if (!value) continue;
10440
10482
  chunks.push(value);
10441
10483
  bufferedLen += value.length;
@@ -12062,6 +12104,31 @@ function completeArgs(path, partial) {
12062
12104
 
12063
12105
  // src/contracts/schemas.ts
12064
12106
  import { z } from "zod";
12107
+ var REASON_PREFIX = "REASON_";
12108
+ function reasonWire(reason) {
12109
+ return reasonToJSON(reason).slice(REASON_PREFIX.length).toLowerCase();
12110
+ }
12111
+ var LACE_REASONS = new Set(
12112
+ Object.values(Reason).filter((value) => typeof value === "number" && value !== -1 /* UNRECOGNIZED */).map(reasonWire)
12113
+ );
12114
+ var laceReasonSchema = z.custom(
12115
+ (value) => typeof value === "string" && LACE_REASONS.has(value),
12116
+ { message: "not a reason of Lace\u2019s own" }
12117
+ );
12118
+ var importResidualSchema = z.object({
12119
+ address: z.string(),
12120
+ type: z.string(),
12121
+ reason: z.string()
12122
+ });
12123
+ var commandFailureSchema = z.strictObject({
12124
+ reason: laceReasonSchema,
12125
+ message: z.string(),
12126
+ url: z.string().optional(),
12127
+ tool: z.string().optional(),
12128
+ importResiduals: z.array(importResidualSchema).optional(),
12129
+ addresses: z.array(z.string()).optional(),
12130
+ apiCode: z.string().optional()
12131
+ });
12065
12132
  var moduleValidateDeviationSchema = z.object({
12066
12133
  notCompositional: z.boolean(),
12067
12134
  clusters: z.array(z.unknown()),
@@ -12113,6 +12180,7 @@ var moduleValidateResultSchema = z.object({
12113
12180
  }).optional(),
12114
12181
  modules: z.array(z.object({ address: z.string(), version: z.string(), treeHash: z.string() })).optional(),
12115
12182
  exitClass: z.string(),
12183
+ failure: commandFailureSchema.optional(),
12116
12184
  diagnostics: z.array(commandDiagnosticSchema)
12117
12185
  });
12118
12186
  var moduleConvertResultSchema = z.object({
@@ -12223,6 +12291,7 @@ var registryDescribeSchema = z.object({
12223
12291
  )
12224
12292
  })
12225
12293
  });
12294
+ var stackIdentSchema = z.object({ id: z.string(), slug: z.string() });
12226
12295
  var stackSourceSchema = z.object({
12227
12296
  kind: z.literal("git"),
12228
12297
  repoUrl: z.string(),
@@ -12406,7 +12475,7 @@ var previewEntrySchema = z.discriminatedUnion("kind", [
12406
12475
  })
12407
12476
  ]);
12408
12477
  var stackPreviewSchema = z.object({
12409
- stack: z.object({ id: z.string(), slug: z.string() }),
12478
+ stack: stackIdentSchema,
12410
12479
  treeHash: z.string(),
12411
12480
  plan: z.object({ summary: planSummarySchema, human: z.string() }),
12412
12481
  policy: z.object({
@@ -12453,16 +12522,19 @@ var gateChangeRequestSchema = z.object({
12453
12522
  z.object({
12454
12523
  id: z.string(),
12455
12524
  state: z.string(),
12456
- decidedBy: z.enum(["lace", "ecm"])
12525
+ decidedBy: z.enum(["lace", "ecm"]),
12526
+ recordId: z.string().nullable()
12457
12527
  })
12458
12528
  ),
12459
12529
  records: z.array(
12460
12530
  z.object({
12531
+ id: z.string(),
12461
12532
  externalSystemId: z.string(),
12462
12533
  kind: z.string(),
12463
12534
  externalRef: z.string().nullable(),
12464
12535
  externalUrl: z.string().nullable(),
12465
- state: z.string().nullable()
12536
+ state: z.string().nullable(),
12537
+ decision: z.enum(["approved", "rejected"]).nullable()
12466
12538
  })
12467
12539
  )
12468
12540
  });
@@ -12486,6 +12558,7 @@ var runEventSchema = z.discriminatedUnion("type", [
12486
12558
  })
12487
12559
  ]);
12488
12560
  var stackScanSchema = z.object({
12561
+ stack: stackIdentSchema,
12489
12562
  triggered: z.boolean(),
12490
12563
  reason: z.string().nullable(),
12491
12564
  settled: z.object({
@@ -12493,14 +12566,17 @@ var stackScanSchema = z.object({
12493
12566
  driftCount: z.number(),
12494
12567
  scannedAt: z.string(),
12495
12568
  undeterminedReason: z.string().nullable(),
12569
+ standingDriftFindings: z.number(),
12570
+ footprintDestroyed: z.boolean(),
12496
12571
  drift: driftSchema
12497
12572
  }).nullable()
12498
12573
  });
12499
12574
  var stackImportSchema = z.object({
12500
- stack: z.object({ id: z.string(), slug: z.string() }),
12575
+ stack: stackIdentSchema,
12501
12576
  written: z.array(z.string()),
12577
+ removed: z.array(z.string()),
12502
12578
  importBlocks: z.number(),
12503
- importResiduals: z.array(z.unknown()),
12579
+ importResiduals: z.array(importResidualSchema),
12504
12580
  validate: moduleValidateResultSchema
12505
12581
  });
12506
12582
  var artifactRefSchema = z.object({ url: z.string(), key: z.string() });
@@ -12612,24 +12688,6 @@ function isBoundPath(path) {
12612
12688
  function parseBound(path, data) {
12613
12689
  return SCHEMAS[path].parse(data);
12614
12690
  }
12615
- var REASON_PREFIX = "REASON_";
12616
- function reasonWire(reason) {
12617
- return reasonToJSON(reason).slice(REASON_PREFIX.length).toLowerCase();
12618
- }
12619
- var LACE_REASONS = new Set(
12620
- Object.values(Reason).filter((value) => typeof value === "number" && value !== -1 /* UNRECOGNIZED */).map(reasonWire)
12621
- );
12622
- var laceReasonSchema = z.custom(
12623
- (value) => typeof value === "string" && LACE_REASONS.has(value),
12624
- { message: "not a reason of Lace\u2019s own" }
12625
- );
12626
- var commandFailureSchema = z.strictObject({
12627
- reason: laceReasonSchema,
12628
- message: z.string(),
12629
- url: z.string().optional(),
12630
- tool: z.string().optional(),
12631
- apiCode: z.string().optional()
12632
- });
12633
12691
  var failureMarkSchema = z.object({ reason: z.string(), message: z.string() });
12634
12692
  function carriesFailure(data) {
12635
12693
  return failureMarkSchema.safeParse(data).success;
@@ -12637,6 +12695,12 @@ function carriesFailure(data) {
12637
12695
  function parseCommandFailure(data) {
12638
12696
  return commandFailureSchema.parse(data);
12639
12697
  }
12698
+ function resultFailure(path, data) {
12699
+ const result = parseBound(path, data);
12700
+ if ("failure" in result) return result.failure;
12701
+ if ("validate" in result) return result.validate.failure;
12702
+ return void 0;
12703
+ }
12640
12704
 
12641
12705
  // src/utils/is-plain-object.ts
12642
12706
  function isPlainObject(val) {
@@ -12908,13 +12972,14 @@ function commandsPort(caller, commandPaths, ownCwd) {
12908
12972
  throw new CommandExitError(
12909
12973
  event.exit.code,
12910
12974
  event.exit.stderr_tail,
12911
- exitFailure(event.exit.document)
12975
+ exitFailure(path, event.exit.document)
12912
12976
  );
12913
12977
  }
12914
12978
  return;
12915
12979
  }
12916
12980
  }
12917
- throw new CommandDetachedError();
12981
+ if (signal.aborted) throw new CommandDetachedError();
12982
+ throw new CommandUnobservedError();
12918
12983
  }
12919
12984
  return {
12920
12985
  events: run(),
@@ -12925,10 +12990,10 @@ function commandsPort(caller, commandPaths, ownCwd) {
12925
12990
  }
12926
12991
  };
12927
12992
  }
12928
- function exitFailure(document) {
12993
+ function exitFailure(path, document) {
12929
12994
  if (document === "") return void 0;
12930
12995
  const data = JSON.parse(document);
12931
- return carriesFailure(data) ? parseCommandFailure(data) : void 0;
12996
+ return carriesFailure(data) ? parseCommandFailure(data) : resultFailure(path, data);
12932
12997
  }
12933
12998
  async function openSession(caller, target) {
12934
12999
  if ("fixture" in target) {
@@ -13010,7 +13075,7 @@ function defineCommand(binding) {
13010
13075
  if (!binding.confirm) return void 0;
13011
13076
  const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
13012
13077
  if (!merged.ok) return void 0;
13013
- return binding.confirm(ctx, merged.args);
13078
+ return binding.confirm(ctx, merged.args, target);
13014
13079
  },
13015
13080
  async start(rt, ctx, target, formArgs, signal) {
13016
13081
  const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
@@ -13069,6 +13134,21 @@ var destroy = defineCommand({
13069
13134
  invalidates: "start+settle",
13070
13135
  result: slotSink("run")
13071
13136
  });
13137
+ function scanNotice(e) {
13138
+ const { slug } = e.stack;
13139
+ const settled = e.settled;
13140
+ if (!settled) {
13141
+ return e.triggered ? `Drift scan triggered for stack ${slug} (${e.stack.id}).` : `Drift scan already in progress for stack ${slug}.`;
13142
+ }
13143
+ if (settled.undeterminedReason !== null) return void 0;
13144
+ if (settled.footprintDestroyed) {
13145
+ return `Drift scan complete for stack ${slug}: IN_SYNC (0 drifted) \u2014 its resources were destroyed, so there was nothing to compare.`;
13146
+ }
13147
+ if (settled.standingDriftFindings > 0) {
13148
+ 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.`;
13149
+ }
13150
+ return `Drift scan complete for stack ${slug}: ${settled.driftStatus} (${settled.driftCount} drifted).`;
13151
+ }
13072
13152
  var scan = defineCommand({
13073
13153
  kind: "command",
13074
13154
  path: "stack scan",
@@ -13077,14 +13157,8 @@ var scan = defineCommand({
13077
13157
  result: {
13078
13158
  kind: "notify",
13079
13159
  consume: (rt, e) => {
13080
- if (!e.triggered) {
13081
- rt.ports.presenter.notify("info", e.reason ?? "Scan skipped");
13082
- return;
13083
- }
13084
- rt.ports.presenter.notify(
13085
- "info",
13086
- e.settled ? `Scan complete \u2014 ${e.settled.driftStatus}` : "Scan triggered"
13087
- );
13160
+ const notice = scanNotice(e);
13161
+ if (notice !== void 0) rt.ports.presenter.notify("info", notice);
13088
13162
  }
13089
13163
  }
13090
13164
  });
@@ -13098,15 +13172,51 @@ var create = defineCommand({
13098
13172
  consume: (rt, e) => rt.ports.presenter.notify("info", `Created stack ${e.slug}`)
13099
13173
  }
13100
13174
  });
13175
+ function residualAddresses(residuals) {
13176
+ return residuals.map((r) => r.address).join(", ");
13177
+ }
13178
+ function treeChanges(e) {
13179
+ return [
13180
+ ...e.written.length === 0 ? [] : [`rewriting ${e.written.join(", ")} in place`],
13181
+ ...e.removed.length === 0 ? [] : [`removing ${e.removed.join(", ")}`]
13182
+ ];
13183
+ }
13184
+ function importNotice(e) {
13185
+ const { slug } = e.stack;
13186
+ const changes = treeChanges(e);
13187
+ const changed = changes.length > 0;
13188
+ const files = changed ? `, ${changes.join(" and ")}` : "";
13189
+ const imported = `Imported ${e.importBlocks} resource(s) into ${slug}${files}.`;
13190
+ if (e.validate.exitClass !== "ok") {
13191
+ return ["warn", `${imported} The tree did not validate: fix it before you commit it.`];
13192
+ }
13193
+ const adopt = changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
13194
+ if (e.importResiduals.length === 0) return ["info", `${imported}${adopt}`];
13195
+ return [
13196
+ "warn",
13197
+ `${imported}${adopt} Not adopted: ${residualAddresses(e.importResiduals)}; supply their import ids before applying, or the apply creates them anew.`
13198
+ ];
13199
+ }
13200
+ var importResult = {
13201
+ kind: "notify",
13202
+ consume: (rt, e) => rt.ports.presenter.notify(...importNotice(e))
13203
+ };
13101
13204
  var importStack = defineCommand({
13102
13205
  kind: "command",
13103
13206
  path: "stack import",
13104
13207
  args: (ctx) => ({ stack: ctx.stack?.id }),
13105
13208
  invalidates: true,
13106
- result: {
13107
- kind: "notify",
13108
- consume: (rt, e) => rt.ports.presenter.notify("info", `Imported ${e.importBlocks} block(s) into ${e.stack.slug}`)
13109
- }
13209
+ result: importResult
13210
+ });
13211
+ var importPartial = defineCommand({
13212
+ kind: "command",
13213
+ path: "stack import",
13214
+ args: (ctx) => ({ stack: ctx.stack?.id, allowPartial: true }),
13215
+ confirm: (ctx, _args, target) => ({
13216
+ 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.`
13217
+ }),
13218
+ invalidates: true,
13219
+ result: importResult
13110
13220
  });
13111
13221
  var validate = defineCommand({
13112
13222
  kind: "command",
@@ -13174,12 +13284,14 @@ var MODULE_COMMAND_ACTIONS = [
13174
13284
  requiredContext: ["root"],
13175
13285
  binding: convert
13176
13286
  },
13177
- // The refused-tf banner's one action while the tree is out of lace shape:
13178
- // the same `module convert` the toolbar runs. The engine re-derives the
13179
- // tree it writes, which accepts it and lifts the lock.
13287
+ // Convert on the source-refused banner while the tree is out of lace
13288
+ // shape: the same `module convert` the toolbar runs, and the choice the
13289
+ // banner says of it. The engine re-derives the tree it writes, which
13290
+ // accepts it and lifts the lock.
13180
13291
  {
13181
13292
  id: "convert-refused",
13182
13293
  label: "Convert",
13294
+ choice: "Convert restructures it in place; a stack's apply creates only what its state does not hold yet.",
13183
13295
  icon: "convert",
13184
13296
  placement: { row: "source-refused" },
13185
13297
  requiredPorts: ["commands"],
@@ -13229,7 +13341,7 @@ var STACK_COMMAND_ACTIONS = [
13229
13341
  },
13230
13342
  {
13231
13343
  id: "import",
13232
- label: "Import state",
13344
+ label: "Import existing resources",
13233
13345
  placement: "toolbar",
13234
13346
  requiredPorts: ["commands"],
13235
13347
  // `stack import` writes the directory it runs in, the same way
@@ -13237,6 +13349,15 @@ var STACK_COMMAND_ACTIONS = [
13237
13349
  requiredContext: ["root", "stack"],
13238
13350
  binding: importStack
13239
13351
  },
13352
+ {
13353
+ id: "import-partial",
13354
+ label: "Import the rest",
13355
+ placement: { row: "failure" },
13356
+ requiredPorts: ["commands"],
13357
+ requiredContext: ["root", "stack"],
13358
+ answers: ["import_residual"],
13359
+ binding: importPartial
13360
+ },
13240
13361
  {
13241
13362
  id: "preview",
13242
13363
  label: "Preview",
@@ -13410,7 +13531,7 @@ function reduceRun(prev, token, event) {
13410
13531
  if (event.type === "gate" && event.changeRequest !== null) {
13411
13532
  return {
13412
13533
  token,
13413
- outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest },
13534
+ outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest, runUrl: null },
13414
13535
  lastLog,
13415
13536
  submitted,
13416
13537
  phases: closePhases(phases)
@@ -13418,7 +13539,13 @@ function reduceRun(prev, token, event) {
13418
13539
  }
13419
13540
  if (event.type === "result") {
13420
13541
  if (carried?.outcome.kind === "awaiting-approval") {
13421
- return { token, outcome: carried.outcome, lastLog, submitted, phases };
13542
+ return {
13543
+ token,
13544
+ outcome: { ...carried.outcome, runUrl: event.run.url ?? null },
13545
+ lastLog,
13546
+ submitted,
13547
+ phases
13548
+ };
13422
13549
  }
13423
13550
  if (event.error)
13424
13551
  return {
@@ -13446,7 +13573,7 @@ function settleRun(prev, token, error) {
13446
13573
  const lastLog = carried?.lastLog ?? null;
13447
13574
  const submitted = carried?.submitted ?? false;
13448
13575
  const phases = closePhases(carried?.phases ?? []);
13449
- if (error instanceof CommandDetachedError)
13576
+ if (error instanceof CommandDetachedError || error instanceof CommandUnobservedError)
13450
13577
  return { token, outcome: { kind: "detached", submitted }, lastLog, submitted, phases };
13451
13578
  if (error instanceof CommandExitError) {
13452
13579
  if (error.code === 130)
@@ -13590,7 +13717,7 @@ var CONTEXT_NEEDS = {
13590
13717
  resolved: "no open Keep or Reload conflict",
13591
13718
  conflict: "an open Keep or Reload conflict",
13592
13719
  sourceRefused: "the source-refused lock",
13593
- needsConversion: "a tree that needs conversion",
13720
+ needsConversion: "a tree out of lace shape",
13594
13721
  "selection.node": "a selected node",
13595
13722
  "selection.edge": "a selected connection",
13596
13723
  diagnostics: "diagnostics to show",
@@ -13605,7 +13732,8 @@ var TARGET_NEEDS = {
13605
13732
  nodeId: "a node",
13606
13733
  groupId: "a group",
13607
13734
  diagnostic: "a diagnostic",
13608
- runId: "a run"
13735
+ runId: "a run",
13736
+ failure: "a failed command"
13609
13737
  };
13610
13738
  var BUSY_REASON = "A run is in progress";
13611
13739
  function keySatisfied(ctx, key) {
@@ -13680,6 +13808,12 @@ function unmetRequirement(action, ports, ctx, target) {
13680
13808
  if (key !== void 0) return `${label} needs ${CONTEXT_NEEDS[key]}`;
13681
13809
  const targetKey = (action.requiredTarget ?? []).find((k) => target[k] === void 0);
13682
13810
  if (targetKey !== void 0) return `${label} needs ${TARGET_NEEDS[targetKey]}`;
13811
+ if (action.answers !== void 0) {
13812
+ if (target.failure === void 0) return `${label} needs ${TARGET_NEEDS.failure}`;
13813
+ if (!action.answers.includes(target.failure.reason)) {
13814
+ return `${label} does not answer this failure`;
13815
+ }
13816
+ }
13683
13817
  if (binding.kind === "command" && !availableCommands(ports).has(binding.path)) {
13684
13818
  return `${label} runs lace ${binding.path}, which this host does not route`;
13685
13819
  }
@@ -14059,12 +14193,13 @@ export {
14059
14193
  CommandExitError,
14060
14194
  ConnectError,
14061
14195
  CommandDetachedError,
14196
+ CommandUnobservedError,
14062
14197
  COMMANDS,
14063
14198
  toArgv,
14199
+ reasonWire,
14064
14200
  SCHEMAS,
14065
14201
  isBoundPath,
14066
14202
  parseBound,
14067
- reasonWire,
14068
14203
  carriesFailure,
14069
14204
  parseCommandFailure,
14070
14205
  defineCommand,
@@ -14091,4 +14226,4 @@ export {
14091
14226
  AutosaveEndedError,
14092
14227
  autosave
14093
14228
  };
14094
- //# sourceMappingURL=chunk-GV2FO3E2.mjs.map
14229
+ //# sourceMappingURL=chunk-HZWABSPP.mjs.map