@lace-cloud/canvas 0.31.0 → 0.31.2

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.
@@ -1,9 +1,16 @@
1
- import { A as ActionContribution, S as SourcePort } from '../registry-B56alajR.mjs';
2
- export { b3 as Action, l as ActionRunner, n as ActionRunnerOptions, f as ActionTarget, o as ApplyResult, p as ApplyUnobservedError, q as ArgsOf, r as BindingRuntime, d as BoundPath, s as BridgeEngineCaller, t as Busy, u as COMMANDS, b as CanvasPorts, h as CanvasSource, w as CommandBinding, x as CommandDetachedError, y as CommandExitError, z as CommandFailure, E as CommandPath, g as CommandResult, F as CommandRun, G as CommandUnobservedError, H as CommandsPort, I as ConfirmSpec, K as ConnectCallerOptions, M as ConnectError, T as ContextPort, U as CreatedRef, V as DirectEngineCaller, W as EMPTY_REPORT_FOLD, _ as EditorPort, $ as EngineCaller, a0 as EngineMethodResponse, a1 as EngineSession, a2 as EngineSessionOptions, a3 as EngineTarget, a4 as ErasedCommand, a5 as FollowSlot, a6 as GENERATE_STAGES, a7 as GateChangeRequest, a8 as GenerateEvent, a9 as GenerateStage, aa as GeneratedTree, ab as GraphError, ac as HostBinding, b4 as InputMode, ad as Invocation, J as JsonOf, b5 as LaceReason, b6 as LiveSlots, b7 as OnScreen, c as PendingForm, ag as PortName, ah as PresenterPort, ai as PreviewOutcome, aj as PreviewSlot, ak as Reason, al as ReportEntry, am as ReportFold, an as ReportPath, ao as ReportSlot, ap as ResultKind, aq as ResultSlots, R as ResultStore, ar as RunCtx, as as RunOutcome, at as RunSlot, b8 as RunStage, b9 as RunStageStatus, au as RunnerPorts, av as RunningMark, aw as SCHEMAS, ax as Sink, ay as SinkInput, az as SlotContext, aA as SlotKind, aB as SourceConflict, i as SourceEnd, aC as StackRef, aD as Started, aE as ViewStatePort, aF as WiringCandidate, aG as WiringQuery, aH as answering, aI as bridgeCaller, aJ as carriesFailure, aK as commandPathOf, aL as commandUnderWay, aM as connectCaller, aN as createActionRunner, aO as createResultStore, aP as currentReport, aQ as defineCommand, aR as diagnosticsOf, ba as diagnosticsOfDocument, bb as failureSays, aT as foldReport, aU as generatedTree, aV as isBoundPath, bc as liveSlots, aW as openEngineCommands, aX as openEngineSession, aY as parseBound, aZ as parseCommandFailure, bd as reasonWire, be as reduceFollow, bf as reducePreview, bg as reduceReport, bh as reduceRun, a_ as reportDiagnostics, bi as settleRun, b1 as toArgv, b2 as uniqueDiagnostics } from '../registry-B56alajR.mjs';
1
+ import { A as ActionContribution, J as JsonOf, S as SourcePort } from '../registry-CCqHplDe.mjs';
2
+ export { b3 as Action, l as ActionRunner, n as ActionRunnerOptions, f as ActionTarget, o as ApplyResult, p as ApplyUnobservedError, q as ArgsOf, r as BindingRuntime, d as BoundPath, s as BridgeEngineCaller, t as Busy, u as COMMANDS, b as CanvasPorts, h as CanvasSource, w as CommandBinding, x as CommandDetachedError, y as CommandExitError, z as CommandFailure, E as CommandPath, g as CommandResult, F as CommandRun, G as CommandUnobservedError, H as CommandsPort, I as ConfirmSpec, K as ConnectCallerOptions, M as ConnectError, T as ContextPort, U as CreatedRef, V as DirectEngineCaller, W as EMPTY_REPORT_FOLD, _ as EditorPort, $ as EngineCaller, a0 as EngineMethodResponse, a1 as EngineSession, a2 as EngineSessionOptions, a3 as EngineTarget, a4 as ErasedCommand, a5 as FollowSlot, a6 as GENERATE_STAGES, a7 as GateChangeRequest, a8 as GenerateEvent, a9 as GenerateStage, aa as GeneratedTree, ab as GraphError, ac as HostBinding, b4 as InputMode, ad as Invocation, b5 as LaceReason, b6 as LiveSlots, b7 as OnScreen, c as PendingForm, ag as PortName, ah as PresenterPort, ai as PreviewOutcome, aj as PreviewSlot, ak as Reason, al as ReportEntry, am as ReportFold, an as ReportPath, ao as ReportSlot, ap as ResultKind, aq as ResultSlots, R as ResultStore, ar as RunCtx, as as RunOutcome, at as RunSlot, b8 as RunStage, b9 as RunStageStatus, au as RunnerPorts, av as RunningMark, aw as SCHEMAS, ax as Sink, ay as SinkInput, az as SlotContext, aA as SlotKind, aB as SourceConflict, i as SourceEnd, aC as StackRef, aD as Started, aE as ViewStatePort, aF as WiringCandidate, aG as WiringQuery, aH as answering, aI as bridgeCaller, aJ as carriesFailure, aK as commandPathOf, aL as commandUnderWay, aM as connectCaller, aN as createActionRunner, aO as createResultStore, aP as currentReport, aQ as defineCommand, aR as diagnosticsOf, ba as diagnosticsOfDocument, bb as failureSays, aT as foldReport, aU as generatedTree, aV as isBoundPath, bc as liveSlots, aW as openEngineCommands, aX as openEngineSession, aY as parseBound, aZ as parseCommandFailure, bd as reasonWire, be as reduceFollow, bf as reducePreview, bg as reduceReport, bh as reduceRun, a_ as reportDiagnostics, bi as settleRun, b1 as toArgv, b2 as uniqueDiagnostics } from '../registry-CCqHplDe.mjs';
3
3
  import '@lace-cloud/proto';
4
4
  import 'zod';
5
5
  import '@bufbuild/protobuf/wire';
6
6
 
7
+ type LockResult = JsonOf<'module lock'>;
8
+ declare function lockFailed(e: Pick<JsonOf<'module convert'>, 'changed' | 'lock'>): boolean;
9
+ declare const DID_NOT_LOCK = "The tree's providers did not lock: run `lace module lock` once the cause is fixed, before you commit it.";
10
+ declare function lockfileOf(lock: LockResult): string;
11
+ declare function lockedIn(lock: LockResult): string;
12
+ declare function lockNotice(lock: LockResult): string;
13
+ declare const LOCK_LABEL = "Lock providers";
7
14
  declare const CORE_COMMAND_ACTIONS: readonly ActionContribution[];
8
15
 
9
16
  type AutosavePolicy = {
@@ -21,4 +28,4 @@ declare class AutosaveEndedError extends Error {
21
28
  }
22
29
  declare function autosave(source: SourcePort, save: () => Promise<void>, policy: AutosavePolicy, report: (error: unknown) => void): Autosave;
23
30
 
24
- export { ActionContribution, type Autosave, AutosaveEndedError, type AutosavePolicy, CORE_COMMAND_ACTIONS, SourcePort, autosave };
31
+ export { ActionContribution, type Autosave, AutosaveEndedError, type AutosavePolicy, CORE_COMMAND_ACTIONS, DID_NOT_LOCK, JsonOf, LOCK_LABEL, SourcePort, autosave, lockFailed, lockNotice, lockedIn, lockfileOf };
@@ -1,9 +1,16 @@
1
- import { A as ActionContribution, S as SourcePort } from '../registry-B56alajR.js';
2
- export { b3 as Action, l as ActionRunner, n as ActionRunnerOptions, f as ActionTarget, o as ApplyResult, p as ApplyUnobservedError, q as ArgsOf, r as BindingRuntime, d as BoundPath, s as BridgeEngineCaller, t as Busy, u as COMMANDS, b as CanvasPorts, h as CanvasSource, w as CommandBinding, x as CommandDetachedError, y as CommandExitError, z as CommandFailure, E as CommandPath, g as CommandResult, F as CommandRun, G as CommandUnobservedError, H as CommandsPort, I as ConfirmSpec, K as ConnectCallerOptions, M as ConnectError, T as ContextPort, U as CreatedRef, V as DirectEngineCaller, W as EMPTY_REPORT_FOLD, _ as EditorPort, $ as EngineCaller, a0 as EngineMethodResponse, a1 as EngineSession, a2 as EngineSessionOptions, a3 as EngineTarget, a4 as ErasedCommand, a5 as FollowSlot, a6 as GENERATE_STAGES, a7 as GateChangeRequest, a8 as GenerateEvent, a9 as GenerateStage, aa as GeneratedTree, ab as GraphError, ac as HostBinding, b4 as InputMode, ad as Invocation, J as JsonOf, b5 as LaceReason, b6 as LiveSlots, b7 as OnScreen, c as PendingForm, ag as PortName, ah as PresenterPort, ai as PreviewOutcome, aj as PreviewSlot, ak as Reason, al as ReportEntry, am as ReportFold, an as ReportPath, ao as ReportSlot, ap as ResultKind, aq as ResultSlots, R as ResultStore, ar as RunCtx, as as RunOutcome, at as RunSlot, b8 as RunStage, b9 as RunStageStatus, au as RunnerPorts, av as RunningMark, aw as SCHEMAS, ax as Sink, ay as SinkInput, az as SlotContext, aA as SlotKind, aB as SourceConflict, i as SourceEnd, aC as StackRef, aD as Started, aE as ViewStatePort, aF as WiringCandidate, aG as WiringQuery, aH as answering, aI as bridgeCaller, aJ as carriesFailure, aK as commandPathOf, aL as commandUnderWay, aM as connectCaller, aN as createActionRunner, aO as createResultStore, aP as currentReport, aQ as defineCommand, aR as diagnosticsOf, ba as diagnosticsOfDocument, bb as failureSays, aT as foldReport, aU as generatedTree, aV as isBoundPath, bc as liveSlots, aW as openEngineCommands, aX as openEngineSession, aY as parseBound, aZ as parseCommandFailure, bd as reasonWire, be as reduceFollow, bf as reducePreview, bg as reduceReport, bh as reduceRun, a_ as reportDiagnostics, bi as settleRun, b1 as toArgv, b2 as uniqueDiagnostics } from '../registry-B56alajR.js';
1
+ import { A as ActionContribution, J as JsonOf, S as SourcePort } from '../registry-CCqHplDe.js';
2
+ export { b3 as Action, l as ActionRunner, n as ActionRunnerOptions, f as ActionTarget, o as ApplyResult, p as ApplyUnobservedError, q as ArgsOf, r as BindingRuntime, d as BoundPath, s as BridgeEngineCaller, t as Busy, u as COMMANDS, b as CanvasPorts, h as CanvasSource, w as CommandBinding, x as CommandDetachedError, y as CommandExitError, z as CommandFailure, E as CommandPath, g as CommandResult, F as CommandRun, G as CommandUnobservedError, H as CommandsPort, I as ConfirmSpec, K as ConnectCallerOptions, M as ConnectError, T as ContextPort, U as CreatedRef, V as DirectEngineCaller, W as EMPTY_REPORT_FOLD, _ as EditorPort, $ as EngineCaller, a0 as EngineMethodResponse, a1 as EngineSession, a2 as EngineSessionOptions, a3 as EngineTarget, a4 as ErasedCommand, a5 as FollowSlot, a6 as GENERATE_STAGES, a7 as GateChangeRequest, a8 as GenerateEvent, a9 as GenerateStage, aa as GeneratedTree, ab as GraphError, ac as HostBinding, b4 as InputMode, ad as Invocation, b5 as LaceReason, b6 as LiveSlots, b7 as OnScreen, c as PendingForm, ag as PortName, ah as PresenterPort, ai as PreviewOutcome, aj as PreviewSlot, ak as Reason, al as ReportEntry, am as ReportFold, an as ReportPath, ao as ReportSlot, ap as ResultKind, aq as ResultSlots, R as ResultStore, ar as RunCtx, as as RunOutcome, at as RunSlot, b8 as RunStage, b9 as RunStageStatus, au as RunnerPorts, av as RunningMark, aw as SCHEMAS, ax as Sink, ay as SinkInput, az as SlotContext, aA as SlotKind, aB as SourceConflict, i as SourceEnd, aC as StackRef, aD as Started, aE as ViewStatePort, aF as WiringCandidate, aG as WiringQuery, aH as answering, aI as bridgeCaller, aJ as carriesFailure, aK as commandPathOf, aL as commandUnderWay, aM as connectCaller, aN as createActionRunner, aO as createResultStore, aP as currentReport, aQ as defineCommand, aR as diagnosticsOf, ba as diagnosticsOfDocument, bb as failureSays, aT as foldReport, aU as generatedTree, aV as isBoundPath, bc as liveSlots, aW as openEngineCommands, aX as openEngineSession, aY as parseBound, aZ as parseCommandFailure, bd as reasonWire, be as reduceFollow, bf as reducePreview, bg as reduceReport, bh as reduceRun, a_ as reportDiagnostics, bi as settleRun, b1 as toArgv, b2 as uniqueDiagnostics } from '../registry-CCqHplDe.js';
3
3
  import '@lace-cloud/proto';
4
4
  import 'zod';
5
5
  import '@bufbuild/protobuf/wire';
6
6
 
7
+ type LockResult = JsonOf<'module lock'>;
8
+ declare function lockFailed(e: Pick<JsonOf<'module convert'>, 'changed' | 'lock'>): boolean;
9
+ declare const DID_NOT_LOCK = "The tree's providers did not lock: run `lace module lock` once the cause is fixed, before you commit it.";
10
+ declare function lockfileOf(lock: LockResult): string;
11
+ declare function lockedIn(lock: LockResult): string;
12
+ declare function lockNotice(lock: LockResult): string;
13
+ declare const LOCK_LABEL = "Lock providers";
7
14
  declare const CORE_COMMAND_ACTIONS: readonly ActionContribution[];
8
15
 
9
16
  type AutosavePolicy = {
@@ -21,4 +28,4 @@ declare class AutosaveEndedError extends Error {
21
28
  }
22
29
  declare function autosave(source: SourcePort, save: () => Promise<void>, policy: AutosavePolicy, report: (error: unknown) => void): Autosave;
23
30
 
24
- export { ActionContribution, type Autosave, AutosaveEndedError, type AutosavePolicy, CORE_COMMAND_ACTIONS, SourcePort, autosave };
31
+ export { ActionContribution, type Autosave, AutosaveEndedError, type AutosavePolicy, CORE_COMMAND_ACTIONS, DID_NOT_LOCK, JsonOf, LOCK_LABEL, SourcePort, autosave, lockFailed, lockNotice, lockedIn, lockfileOf };
@@ -7,9 +7,11 @@ import {
7
7
  CommandExitError,
8
8
  CommandUnobservedError,
9
9
  ConnectError,
10
+ DID_NOT_LOCK,
10
11
  EMPTY_REPORT_FOLD,
11
12
  GENERATE_STAGES,
12
13
  InputMode,
14
+ LOCK_LABEL,
13
15
  Reason,
14
16
  SCHEMAS,
15
17
  answering,
@@ -30,6 +32,10 @@ import {
30
32
  generatedTree,
31
33
  isBoundPath,
32
34
  liveSlots,
35
+ lockFailed,
36
+ lockNotice,
37
+ lockedIn,
38
+ lockfileOf,
33
39
  openEngineCommands,
34
40
  openEngineSession,
35
41
  parseBound,
@@ -43,7 +49,7 @@ import {
43
49
  settleRun,
44
50
  toArgv,
45
51
  uniqueDiagnostics
46
- } from "../chunk-MVOO7T3B.mjs";
52
+ } from "../chunk-PABP6EXP.mjs";
47
53
  export {
48
54
  ApplyUnobservedError,
49
55
  AutosaveEndedError,
@@ -53,9 +59,11 @@ export {
53
59
  CommandExitError,
54
60
  CommandUnobservedError,
55
61
  ConnectError,
62
+ DID_NOT_LOCK,
56
63
  EMPTY_REPORT_FOLD,
57
64
  GENERATE_STAGES,
58
65
  InputMode,
66
+ LOCK_LABEL,
59
67
  Reason,
60
68
  SCHEMAS,
61
69
  answering,
@@ -76,6 +84,10 @@ export {
76
84
  generatedTree,
77
85
  isBoundPath,
78
86
  liveSlots,
87
+ lockFailed,
88
+ lockNotice,
89
+ lockedIn,
90
+ lockfileOf,
79
91
  openEngineCommands,
80
92
  openEngineSession,
81
93
  parseBound,
package/dist/index.cjs CHANGED
@@ -16246,6 +16246,36 @@ function withStage(stages, name) {
16246
16246
  function closeStages(stages) {
16247
16247
  return stages.map((s) => s.status === "done" ? s : { ...s, status: "done" });
16248
16248
  }
16249
+ var RECORDED_ENDS = /* @__PURE__ */ new Map([
16250
+ ["apply_succeeded", "succeeded"],
16251
+ ["apply_failed", "failed"],
16252
+ ["policy_blocked", "blocked"],
16253
+ ["cancelled", "cancelled"]
16254
+ ]);
16255
+ function runKind(run, ending) {
16256
+ const recorded = run ? RECORDED_ENDS.get(run.status) : void 0;
16257
+ if (recorded) return recorded;
16258
+ if ("result" in ending) return ending.result.error ? "running" : "succeeded";
16259
+ const { error } = ending;
16260
+ if (error instanceof CommandDetachedError || error instanceof CommandUnobservedError)
16261
+ return "detached";
16262
+ if (error instanceof CommandExitError) {
16263
+ if (error.code === 130) return run ? "detached" : "cancelled";
16264
+ if (error.code === 143) return "detached";
16265
+ if (error.code === 7) return "blocked";
16266
+ }
16267
+ return "failed";
16268
+ }
16269
+ function endSays(ending) {
16270
+ if ("error" in ending) return failureSays(ending.error);
16271
+ const { run, error } = ending.result;
16272
+ return { message: run.errorMessage ?? error ?? run.status };
16273
+ }
16274
+ function outcomeOf(end, ending, submitted) {
16275
+ if (end === "blocked" || end === "failed") return { kind: end, ...endSays(ending) };
16276
+ if (end === "detached") return { kind: end, submitted };
16277
+ return { kind: end };
16278
+ }
16249
16279
  function reduceRun(prev, token, event) {
16250
16280
  const carried = prev && prev.token === token ? prev : null;
16251
16281
  const run = event.type === "result" ? event.run : carried?.run ?? null;
@@ -16273,10 +16303,12 @@ function reduceRun(prev, token, event) {
16273
16303
  stages
16274
16304
  };
16275
16305
  }
16276
- if (!event.error)
16306
+ const ending = { result: event };
16307
+ const kind = runKind(run, ending);
16308
+ if (kind !== "running")
16277
16309
  return {
16278
16310
  token,
16279
- outcome: { kind: "succeeded" },
16311
+ outcome: outcomeOf(kind, ending, submitted),
16280
16312
  run,
16281
16313
  lastLog,
16282
16314
  submitted,
@@ -16308,31 +16340,9 @@ function settleRun(prev, token, error) {
16308
16340
  const lastLog = carried?.lastLog ?? null;
16309
16341
  const submitted = carried?.submitted ?? false;
16310
16342
  const stages = closeStages(carried?.stages ?? []);
16311
- if (error instanceof CommandDetachedError || error instanceof CommandUnobservedError)
16312
- return { token, outcome: { kind: "detached", submitted }, run, lastLog, submitted, stages };
16313
- if (error instanceof CommandExitError) {
16314
- if (error.code === 130)
16315
- return { token, outcome: { kind: "cancelled" }, run, lastLog, submitted, stages };
16316
- if (error.code === 143)
16317
- return { token, outcome: { kind: "detached", submitted }, run, lastLog, submitted, stages };
16318
- if (error.code === 7)
16319
- return {
16320
- token,
16321
- outcome: { kind: "blocked", ...failureSays(error) },
16322
- run,
16323
- lastLog,
16324
- submitted,
16325
- stages
16326
- };
16327
- }
16328
- return {
16329
- token,
16330
- outcome: { kind: "failed", ...failureSays(error) },
16331
- run,
16332
- lastLog,
16333
- submitted,
16334
- stages
16335
- };
16343
+ const ending = { error };
16344
+ const outcome = outcomeOf(runKind(run, ending), ending, submitted);
16345
+ return { token, outcome, run, lastLog, submitted, stages };
16336
16346
  }
16337
16347
  function reducePreview(_prev, token, event) {
16338
16348
  return { token, outcome: { kind: "succeeded", data: event } };
@@ -16533,6 +16543,10 @@ function lockfileOf(lock2) {
16533
16543
  function lockedIn(lock2) {
16534
16544
  return `${counted(lock2.providers.length, "provider")} in ${lockfileOf(lock2)}`;
16535
16545
  }
16546
+ function lockNotice(lock2) {
16547
+ return `Locked ${lockedIn(lock2)}. Commit it beside the tree.`;
16548
+ }
16549
+ var LOCK_LABEL = "Lock providers";
16536
16550
  function listed(parts) {
16537
16551
  return parts.length < 2 ? parts.join("") : `${parts.slice(0, -1).join(", ")} and ${parts.at(-1)}`;
16538
16552
  }
@@ -16697,10 +16711,7 @@ var lock = defineCommand({
16697
16711
  args: () => ({}),
16698
16712
  result: {
16699
16713
  kind: "notify",
16700
- consume: (rt, e) => rt.ports.presenter.notify(
16701
- "info",
16702
- `Locked ${lockedIn(e)}. Commit it beside the tree, then run the command again.`
16703
- )
16714
+ consume: (rt, e) => rt.ports.presenter.notify("info", `${lockNotice(e)} Then run the refused command again.`)
16704
16715
  }
16705
16716
  });
16706
16717
  var preview = defineCommand({
@@ -16825,7 +16836,7 @@ var STACK_COMMAND_ACTIONS = [
16825
16836
  // writes it.
16826
16837
  {
16827
16838
  id: "lock-missing",
16828
- label: "Lock providers",
16839
+ label: LOCK_LABEL,
16829
16840
  placement: { row: "failure" },
16830
16841
  requiredPorts: ["commands"],
16831
16842
  requiredContext: ["root"],