@lace-cloud/canvas 0.24.0 → 0.25.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.
@@ -32,6 +32,7 @@ __export(engine_exports, {
32
32
  InputMode: () => InputMode,
33
33
  Reason: () => Reason,
34
34
  SCHEMAS: () => SCHEMAS,
35
+ answering: () => answering,
35
36
  autosave: () => autosave,
36
37
  bridgeCaller: () => bridgeCaller,
37
38
  carriesFailure: () => carriesFailure,
@@ -12615,13 +12616,10 @@ var stackScanSchema = import_zod.z.object({
12615
12616
  drift: driftSchema
12616
12617
  }).nullable()
12617
12618
  });
12618
- var stackImportSchema = import_zod.z.object({
12619
+ var stackImportSchema = moduleConvertResultSchema.extend({
12619
12620
  stack: stackIdentSchema,
12620
- written: import_zod.z.array(import_zod.z.string()),
12621
- removed: import_zod.z.array(import_zod.z.string()),
12622
12621
  importBlocks: import_zod.z.number(),
12623
- importResiduals: import_zod.z.array(importResidualSchema),
12624
- validate: moduleValidateResultSchema
12622
+ importResiduals: import_zod.z.array(importResidualSchema)
12625
12623
  });
12626
12624
  var artifactRefSchema = import_zod.z.object({ url: import_zod.z.string(), key: import_zod.z.string() });
12627
12625
  var runPlanSchema = import_zod.z.object({
@@ -12858,6 +12856,7 @@ async function openEngineSession(caller, target, options = {}) {
12858
12856
  revisionWaiters.clear();
12859
12857
  }
12860
12858
  function publishCommandResult(result) {
12859
+ commandResults.delete(result.path);
12861
12860
  commandResults.set(result.path, result);
12862
12861
  for (const listener of commandResultListeners) deliver(listener, result);
12863
12862
  }
@@ -13228,13 +13227,12 @@ function treeChanges(e) {
13228
13227
  function importNotice(e) {
13229
13228
  const { slug } = e.stack;
13230
13229
  const changes = treeChanges(e);
13231
- const changed = changes.length > 0;
13232
- const files = changed ? `, ${changes.join(" and ")}` : "";
13230
+ const files = changes.length > 0 ? `, ${changes.join(" and ")}` : "";
13233
13231
  const imported = `Imported ${e.importBlocks} resource(s) into ${slug}${files}.`;
13234
13232
  if (e.validate.exitClass !== "ok") {
13235
13233
  return ["warn", `${imported} The tree did not validate: fix it before you commit it.`];
13236
13234
  }
13237
- const adopt = changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
13235
+ const adopt = e.changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
13238
13236
  if (e.importResiduals.length === 0) return ["info", `${imported}${adopt}`];
13239
13237
  return [
13240
13238
  "warn",
@@ -13465,10 +13463,10 @@ function diagnosticsOf(sourceDiagnostics, reportFindings) {
13465
13463
 
13466
13464
  // src/core/report-fold.ts
13467
13465
  var REPORT_PATHS = ["module validate", "module convert", "module scan"];
13468
- var REPORT_PATH_SET = new Set(REPORT_PATHS);
13469
- function isReportPath(path) {
13470
- return REPORT_PATH_SET.has(path);
13471
- }
13466
+ var FOLDS_AS = new Map([
13467
+ ...REPORT_PATHS.map((path) => [path, path]),
13468
+ ["stack import", "module convert"]
13469
+ ]);
13472
13470
  var EMPTY_REPORT_FOLD = /* @__PURE__ */ new Map();
13473
13471
  function readEntry(path, exitCode, data) {
13474
13472
  if (carriesFailure(data)) {
@@ -13484,10 +13482,11 @@ function readEntry(path, exitCode, data) {
13484
13482
  }
13485
13483
  }
13486
13484
  function foldReport(prev, result) {
13487
- if (!isReportPath(result.path)) return prev;
13485
+ const path = FOLDS_AS.get(result.path);
13486
+ if (path === void 0) return prev;
13488
13487
  const next = new Map(prev);
13489
- if (result.document === "") next.delete(result.path);
13490
- else next.set(result.path, readEntry(result.path, result.exitCode, JSON.parse(result.document)));
13488
+ if (result.document === "") next.delete(path);
13489
+ else next.set(path, readEntry(path, result.exitCode, JSON.parse(result.document)));
13491
13490
  return next;
13492
13491
  }
13493
13492
  function treeHashOf(entry) {
@@ -13823,6 +13822,16 @@ function asksConfirm(binding) {
13823
13822
  return binding.confirm !== void 0;
13824
13823
  }
13825
13824
  }
13825
+ var FAILURE_ROW = "failure";
13826
+ function placedOn(action, row) {
13827
+ return typeof action.placement === "object" && action.placement.row === row;
13828
+ }
13829
+ function answersFailure(action, failure) {
13830
+ return action.answers?.includes(failure.reason) === true;
13831
+ }
13832
+ function answering(actions, failure) {
13833
+ return actions.filter((a) => placedOn(a, FAILURE_ROW) && answersFailure(a, failure));
13834
+ }
13826
13835
  function unmetRequirement(action, ports, ctx, target) {
13827
13836
  const { label, binding } = action;
13828
13837
  const port = missingPort(ports, action.requiredPorts);
@@ -13834,11 +13843,9 @@ function unmetRequirement(action, ports, ctx, target) {
13834
13843
  if (key !== void 0) return `${label} needs ${CONTEXT_NEEDS[key]}`;
13835
13844
  const targetKey = (action.requiredTarget ?? []).find((k) => target[k] === void 0);
13836
13845
  if (targetKey !== void 0) return `${label} needs ${TARGET_NEEDS[targetKey]}`;
13837
- if (action.answers !== void 0) {
13846
+ if (placedOn(action, FAILURE_ROW) || action.answers !== void 0) {
13838
13847
  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
- }
13848
+ if (!answersFailure(action, target.failure)) return `${label} does not answer this failure`;
13842
13849
  }
13843
13850
  if (binding.kind === "command" && !availableCommands(ports).has(binding.path)) {
13844
13851
  return `${label} runs lace ${binding.path}, which this host does not route`;
@@ -13949,6 +13956,10 @@ function createActionRunner(ports, store, options = {}) {
13949
13956
  handles.delete(kind);
13950
13957
  tokens.delete(kind);
13951
13958
  }
13959
+ function tellFailure(error) {
13960
+ if (error instanceof CommandDetachedError) return;
13961
+ ports.presenter.notify("error", error instanceof Error ? error.message : String(error));
13962
+ }
13952
13963
  async function startCommand(action, ctx, target, formArgs) {
13953
13964
  const binding = action.binding;
13954
13965
  if (binding.kind !== "command") return;
@@ -14003,7 +14014,7 @@ function createActionRunner(ports, store, options = {}) {
14003
14014
  missing: completion.missing,
14004
14015
  submit: (values) => {
14005
14016
  options.onPendingFormChange?.(null);
14006
- void startCommand(action, ctx, target, values);
14017
+ void startCommand(action, ctx, target, values).catch(tellFailure);
14007
14018
  },
14008
14019
  cancel: () => options.onPendingFormChange?.(null)
14009
14020
  });
@@ -14077,8 +14088,7 @@ function createActionRunner(ports, store, options = {}) {
14077
14088
  return;
14078
14089
  }
14079
14090
  } catch (error) {
14080
- if (error instanceof CommandDetachedError) return;
14081
- ports.presenter.notify("error", error instanceof Error ? error.message : String(error));
14091
+ tellFailure(error);
14082
14092
  }
14083
14093
  },
14084
14094
  apply(actions) {
@@ -14201,6 +14211,7 @@ function autosave(source, save, policy, report) {
14201
14211
  InputMode,
14202
14212
  Reason,
14203
14213
  SCHEMAS,
14214
+ answering,
14204
14215
  autosave,
14205
14216
  bridgeCaller,
14206
14217
  carriesFailure,