@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.
- package/README.md +8 -2
- package/dist/{chunk-HZWABSPP.mjs → chunk-YLJWYH7B.mjs} +34 -26
- package/dist/{chunk-HZWABSPP.mjs.map → chunk-YLJWYH7B.mjs.map} +1 -1
- package/dist/engine/index.cjs +33 -22
- package/dist/engine/index.cjs.map +1 -1
- package/dist/engine/index.d.mts +2 -2
- package/dist/engine/index.d.ts +2 -2
- package/dist/engine/index.mjs +3 -1
- package/dist/index.cjs +34 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +3 -9
- package/dist/index.d.ts +3 -9
- package/dist/index.mjs +3 -1
- package/dist/index.mjs.map +1 -1
- package/dist/{mapping-Z-STJQRP.d.mts → registry-CdHLt_qh.d.mts} +34 -11
- package/dist/{mapping-Z-STJQRP.d.ts → registry-CdHLt_qh.d.ts} +34 -11
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -75,6 +75,11 @@ if (apply) await runner.run(apply, { root, stack }, {});
|
|
|
75
75
|
// results.getSnapshot().run is the run's phases, last log line and outcome.
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
+
A command that failed says why as data (`CommandExitError.failure`), and
|
|
79
|
+
`answering(CORE_COMMAND_ACTIONS, failure)` is what a host offers on it:
|
|
80
|
+
the actions that answer that failure's reason (Import the rest answers
|
|
81
|
+
`import_residual`), each run the same way with `{ failure }` as its target.
|
|
82
|
+
|
|
78
83
|
A host that mounts the canvas can own its result store too: pass it as
|
|
79
84
|
`<App ports={ports} results={results} />` and call `results.bumpTick()`
|
|
80
85
|
when something outside the canvas changed what `stack describe` reports
|
|
@@ -122,8 +127,9 @@ const { ports, close } = await openEngineSession(caller, { root: '/path/to/autho
|
|
|
122
127
|
iterable throws it). Every `source` frame names the
|
|
123
128
|
tree the session last observed (`treeHash`), and a subscriber that
|
|
124
129
|
passes `onCommandResult` receives the result of every command that ran
|
|
125
|
-
in the session's root, the last per command path replayed
|
|
126
|
-
late — the input of `foldReport`,
|
|
130
|
+
in the session's root, the last per command path replayed in the order
|
|
131
|
+
they were published when it joins late — the input of `foldReport`,
|
|
132
|
+
whose `currentReport` keeps the
|
|
127
133
|
entries about that tree. The stream's end reaches every
|
|
128
134
|
`source` subscriber as `{ kind: 'closed' }` — the session is gone — or
|
|
129
135
|
`{ kind: 'failed', error }` — the stream is gone and the session
|
|
@@ -12571,13 +12571,10 @@ var stackScanSchema = z.object({
|
|
|
12571
12571
|
drift: driftSchema
|
|
12572
12572
|
}).nullable()
|
|
12573
12573
|
});
|
|
12574
|
-
var stackImportSchema =
|
|
12574
|
+
var stackImportSchema = moduleConvertResultSchema.extend({
|
|
12575
12575
|
stack: stackIdentSchema,
|
|
12576
|
-
written: z.array(z.string()),
|
|
12577
|
-
removed: z.array(z.string()),
|
|
12578
12576
|
importBlocks: z.number(),
|
|
12579
|
-
importResiduals: z.array(importResidualSchema)
|
|
12580
|
-
validate: moduleValidateResultSchema
|
|
12577
|
+
importResiduals: z.array(importResidualSchema)
|
|
12581
12578
|
});
|
|
12582
12579
|
var artifactRefSchema = z.object({ url: z.string(), key: z.string() });
|
|
12583
12580
|
var runPlanSchema = z.object({
|
|
@@ -12814,6 +12811,7 @@ async function openEngineSession(caller, target, options = {}) {
|
|
|
12814
12811
|
revisionWaiters.clear();
|
|
12815
12812
|
}
|
|
12816
12813
|
function publishCommandResult(result) {
|
|
12814
|
+
commandResults.delete(result.path);
|
|
12817
12815
|
commandResults.set(result.path, result);
|
|
12818
12816
|
for (const listener of commandResultListeners) deliver(listener, result);
|
|
12819
12817
|
}
|
|
@@ -13184,13 +13182,12 @@ function treeChanges(e) {
|
|
|
13184
13182
|
function importNotice(e) {
|
|
13185
13183
|
const { slug } = e.stack;
|
|
13186
13184
|
const changes = treeChanges(e);
|
|
13187
|
-
const
|
|
13188
|
-
const files = changed ? `, ${changes.join(" and ")}` : "";
|
|
13185
|
+
const files = changes.length > 0 ? `, ${changes.join(" and ")}` : "";
|
|
13189
13186
|
const imported = `Imported ${e.importBlocks} resource(s) into ${slug}${files}.`;
|
|
13190
13187
|
if (e.validate.exitClass !== "ok") {
|
|
13191
13188
|
return ["warn", `${imported} The tree did not validate: fix it before you commit it.`];
|
|
13192
13189
|
}
|
|
13193
|
-
const adopt = changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
|
|
13190
|
+
const adopt = e.changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
|
|
13194
13191
|
if (e.importResiduals.length === 0) return ["info", `${imported}${adopt}`];
|
|
13195
13192
|
return [
|
|
13196
13193
|
"warn",
|
|
@@ -13421,10 +13418,10 @@ function diagnosticsOf(sourceDiagnostics, reportFindings) {
|
|
|
13421
13418
|
|
|
13422
13419
|
// src/core/report-fold.ts
|
|
13423
13420
|
var REPORT_PATHS = ["module validate", "module convert", "module scan"];
|
|
13424
|
-
var
|
|
13425
|
-
|
|
13426
|
-
|
|
13427
|
-
|
|
13421
|
+
var FOLDS_AS = new Map([
|
|
13422
|
+
...REPORT_PATHS.map((path) => [path, path]),
|
|
13423
|
+
["stack import", "module convert"]
|
|
13424
|
+
]);
|
|
13428
13425
|
var EMPTY_REPORT_FOLD = /* @__PURE__ */ new Map();
|
|
13429
13426
|
function readEntry(path, exitCode, data) {
|
|
13430
13427
|
if (carriesFailure(data)) {
|
|
@@ -13440,10 +13437,11 @@ function readEntry(path, exitCode, data) {
|
|
|
13440
13437
|
}
|
|
13441
13438
|
}
|
|
13442
13439
|
function foldReport(prev, result) {
|
|
13443
|
-
|
|
13440
|
+
const path = FOLDS_AS.get(result.path);
|
|
13441
|
+
if (path === void 0) return prev;
|
|
13444
13442
|
const next = new Map(prev);
|
|
13445
|
-
if (result.document === "") next.delete(
|
|
13446
|
-
else next.set(
|
|
13443
|
+
if (result.document === "") next.delete(path);
|
|
13444
|
+
else next.set(path, readEntry(path, result.exitCode, JSON.parse(result.document)));
|
|
13447
13445
|
return next;
|
|
13448
13446
|
}
|
|
13449
13447
|
function treeHashOf(entry) {
|
|
@@ -13797,6 +13795,16 @@ function asksConfirm(binding) {
|
|
|
13797
13795
|
return binding.confirm !== void 0;
|
|
13798
13796
|
}
|
|
13799
13797
|
}
|
|
13798
|
+
var FAILURE_ROW = "failure";
|
|
13799
|
+
function placedOn(action, row) {
|
|
13800
|
+
return typeof action.placement === "object" && action.placement.row === row;
|
|
13801
|
+
}
|
|
13802
|
+
function answersFailure(action, failure) {
|
|
13803
|
+
return action.answers?.includes(failure.reason) === true;
|
|
13804
|
+
}
|
|
13805
|
+
function answering(actions, failure) {
|
|
13806
|
+
return actions.filter((a) => placedOn(a, FAILURE_ROW) && answersFailure(a, failure));
|
|
13807
|
+
}
|
|
13800
13808
|
function unmetRequirement(action, ports, ctx, target) {
|
|
13801
13809
|
const { label, binding } = action;
|
|
13802
13810
|
const port = missingPort(ports, action.requiredPorts);
|
|
@@ -13808,11 +13816,9 @@ function unmetRequirement(action, ports, ctx, target) {
|
|
|
13808
13816
|
if (key !== void 0) return `${label} needs ${CONTEXT_NEEDS[key]}`;
|
|
13809
13817
|
const targetKey = (action.requiredTarget ?? []).find((k) => target[k] === void 0);
|
|
13810
13818
|
if (targetKey !== void 0) return `${label} needs ${TARGET_NEEDS[targetKey]}`;
|
|
13811
|
-
if (action.answers !== void 0) {
|
|
13819
|
+
if (placedOn(action, FAILURE_ROW) || action.answers !== void 0) {
|
|
13812
13820
|
if (target.failure === void 0) return `${label} needs ${TARGET_NEEDS.failure}`;
|
|
13813
|
-
if (!action
|
|
13814
|
-
return `${label} does not answer this failure`;
|
|
13815
|
-
}
|
|
13821
|
+
if (!answersFailure(action, target.failure)) return `${label} does not answer this failure`;
|
|
13816
13822
|
}
|
|
13817
13823
|
if (binding.kind === "command" && !availableCommands(ports).has(binding.path)) {
|
|
13818
13824
|
return `${label} runs lace ${binding.path}, which this host does not route`;
|
|
@@ -13831,9 +13837,7 @@ function resolveContributions(all, ports, ctx, target = NO_TARGET) {
|
|
|
13831
13837
|
};
|
|
13832
13838
|
}
|
|
13833
13839
|
function rowActions(resolved, panelId) {
|
|
13834
|
-
return resolved.actions.filter(
|
|
13835
|
-
(a) => typeof a.placement === "object" && a.placement.row === panelId
|
|
13836
|
-
);
|
|
13840
|
+
return resolved.actions.filter((a) => placedOn(a, panelId));
|
|
13837
13841
|
}
|
|
13838
13842
|
|
|
13839
13843
|
// src/core/run-binding.ts
|
|
@@ -13939,6 +13943,10 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
13939
13943
|
handles.delete(kind);
|
|
13940
13944
|
tokens.delete(kind);
|
|
13941
13945
|
}
|
|
13946
|
+
function tellFailure(error) {
|
|
13947
|
+
if (error instanceof CommandDetachedError) return;
|
|
13948
|
+
ports.presenter.notify("error", error instanceof Error ? error.message : String(error));
|
|
13949
|
+
}
|
|
13942
13950
|
async function startCommand(action, ctx, target, formArgs) {
|
|
13943
13951
|
const binding = action.binding;
|
|
13944
13952
|
if (binding.kind !== "command") return;
|
|
@@ -13993,7 +14001,7 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
13993
14001
|
missing: completion.missing,
|
|
13994
14002
|
submit: (values) => {
|
|
13995
14003
|
options.onPendingFormChange?.(null);
|
|
13996
|
-
void startCommand(action, ctx, target, values);
|
|
14004
|
+
void startCommand(action, ctx, target, values).catch(tellFailure);
|
|
13997
14005
|
},
|
|
13998
14006
|
cancel: () => options.onPendingFormChange?.(null)
|
|
13999
14007
|
});
|
|
@@ -14067,8 +14075,7 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
14067
14075
|
return;
|
|
14068
14076
|
}
|
|
14069
14077
|
} catch (error) {
|
|
14070
|
-
|
|
14071
|
-
ports.presenter.notify("error", error instanceof Error ? error.message : String(error));
|
|
14078
|
+
tellFailure(error);
|
|
14072
14079
|
}
|
|
14073
14080
|
},
|
|
14074
14081
|
apply(actions) {
|
|
@@ -14183,6 +14190,7 @@ export {
|
|
|
14183
14190
|
diagnosticsOf,
|
|
14184
14191
|
keySatisfied,
|
|
14185
14192
|
disabledReason,
|
|
14193
|
+
answering,
|
|
14186
14194
|
resolveContributions,
|
|
14187
14195
|
rowActions,
|
|
14188
14196
|
Bundle,
|
|
@@ -14226,4 +14234,4 @@ export {
|
|
|
14226
14234
|
AutosaveEndedError,
|
|
14227
14235
|
autosave
|
|
14228
14236
|
};
|
|
14229
|
-
//# sourceMappingURL=chunk-
|
|
14237
|
+
//# sourceMappingURL=chunk-YLJWYH7B.mjs.map
|