@lace-cloud/canvas 0.26.0 → 0.27.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.
@@ -1,5 +1,5 @@
1
- import { A as ActionContribution, S as SourcePort } from '../registry-BhFAgvlq.mjs';
2
- export { aY as Action, k as ActionRunner, m as ActionRunnerOptions, f as ActionTarget, n as ApplyResult, o as ApplyUnobservedError, p as ArgsOf, q as BindingRuntime, d as BoundPath, r as BridgeEngineCaller, s as Busy, t as COMMANDS, b as CanvasPorts, h as CanvasSource, v as CommandBinding, w as CommandDetachedError, x as CommandExitError, y as CommandFailure, z 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, aZ as FailedCommand, a5 as FollowSlot, a6 as GateChangeRequest, a7 as GenerateEvent, a8 as GraphError, a9 as HostBinding, a_ as InputMode, aa as Invocation, J as JsonOf, a$ as LaceReason, b0 as LiveSlots, b1 as OnScreen, c as PendingForm, ad as PortName, ae as PresenterPort, af as PreviewSlot, ag as Reason, ah as ReportEntry, ai as ReportFold, aj as ReportPath, ak as ReportSlot, al as ResultKind, am as ResultSlots, R as ResultStore, an as RunCtx, ao as RunOutcome, b2 as RunPhase, b3 as RunPhaseStatus, ap as RunSlot, aq as RunnerPorts, ar as RunningMark, as as SCHEMAS, at as Sink, au as SinkInput, av as SlotContext, aw as SlotKind, ax as SourceConflict, i as SourceEnd, ay as StackRef, az as Started, aA as ViewStatePort, aB as WiringCandidate, aC as WiringQuery, aD as answering, aE as bridgeCaller, aF as carriesFailure, aG as connectCaller, aH as createActionRunner, aI as createResultStore, aJ as currentReport, aK as defineCommand, aL as diagnosticsOf, b4 as diagnosticsOfDocument, b5 as failureSays, aN as foldReport, aO as isBoundPath, b6 as liveSlots, aP as openEngineCommands, aQ as openEngineSession, aR as parseBound, aS as parseCommandFailure, b7 as reasonWire, b8 as reduceFollow, b9 as reducePreview, ba as reduceReport, bb as reduceRun, aT as reportDiagnostics, bc as settleRun, aW as toArgv, aX as uniqueDiagnostics } from '../registry-BhFAgvlq.mjs';
1
+ import { A as ActionContribution, S as SourcePort } from '../registry-D7G7pqU4.mjs';
2
+ export { aZ as Action, k as ActionRunner, m as ActionRunnerOptions, f as ActionTarget, n as ApplyResult, o as ApplyUnobservedError, p as ArgsOf, q as BindingRuntime, d as BoundPath, r as BridgeEngineCaller, s as Busy, t as COMMANDS, b as CanvasPorts, h as CanvasSource, v as CommandBinding, w as CommandDetachedError, x as CommandExitError, y as CommandFailure, z 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, a_ as FailedCommand, a5 as FollowSlot, a6 as GateChangeRequest, a7 as GenerateEvent, a8 as GraphError, a9 as HostBinding, a$ as InputMode, aa as Invocation, J as JsonOf, b0 as LaceReason, b1 as LiveSlots, b2 as OnScreen, c as PendingForm, ad as PortName, ae as PresenterPort, af as PreviewOutcome, ag as PreviewSlot, ah as Reason, ai as ReportEntry, aj as ReportFold, ak as ReportPath, al as ReportSlot, am as ResultKind, an as ResultSlots, R as ResultStore, ao as RunCtx, ap as RunOutcome, b3 as RunPhase, b4 as RunPhaseStatus, aq as RunSlot, ar as RunnerPorts, as as RunningMark, at as SCHEMAS, au as Sink, av as SinkInput, aw as SlotContext, ax as SlotKind, ay as SourceConflict, i as SourceEnd, az as StackRef, aA as Started, aB as ViewStatePort, aC as WiringCandidate, aD as WiringQuery, aE as answering, aF as bridgeCaller, aG as carriesFailure, aH as connectCaller, aI as createActionRunner, aJ as createResultStore, aK as currentReport, aL as defineCommand, aM as diagnosticsOf, b5 as diagnosticsOfDocument, b6 as failureSays, aO as foldReport, aP as isBoundPath, b7 as liveSlots, aQ as openEngineCommands, aR as openEngineSession, aS as parseBound, aT as parseCommandFailure, b8 as reasonWire, b9 as reduceFollow, ba as reducePreview, bb as reduceReport, bc as reduceRun, aU as reportDiagnostics, bd as settleRun, aX as toArgv, aY as uniqueDiagnostics } from '../registry-D7G7pqU4.mjs';
3
3
  import '@lace-cloud/proto';
4
4
  import 'zod';
5
5
  import '@bufbuild/protobuf/wire';
@@ -1,5 +1,5 @@
1
- import { A as ActionContribution, S as SourcePort } from '../registry-BhFAgvlq.js';
2
- export { aY as Action, k as ActionRunner, m as ActionRunnerOptions, f as ActionTarget, n as ApplyResult, o as ApplyUnobservedError, p as ArgsOf, q as BindingRuntime, d as BoundPath, r as BridgeEngineCaller, s as Busy, t as COMMANDS, b as CanvasPorts, h as CanvasSource, v as CommandBinding, w as CommandDetachedError, x as CommandExitError, y as CommandFailure, z 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, aZ as FailedCommand, a5 as FollowSlot, a6 as GateChangeRequest, a7 as GenerateEvent, a8 as GraphError, a9 as HostBinding, a_ as InputMode, aa as Invocation, J as JsonOf, a$ as LaceReason, b0 as LiveSlots, b1 as OnScreen, c as PendingForm, ad as PortName, ae as PresenterPort, af as PreviewSlot, ag as Reason, ah as ReportEntry, ai as ReportFold, aj as ReportPath, ak as ReportSlot, al as ResultKind, am as ResultSlots, R as ResultStore, an as RunCtx, ao as RunOutcome, b2 as RunPhase, b3 as RunPhaseStatus, ap as RunSlot, aq as RunnerPorts, ar as RunningMark, as as SCHEMAS, at as Sink, au as SinkInput, av as SlotContext, aw as SlotKind, ax as SourceConflict, i as SourceEnd, ay as StackRef, az as Started, aA as ViewStatePort, aB as WiringCandidate, aC as WiringQuery, aD as answering, aE as bridgeCaller, aF as carriesFailure, aG as connectCaller, aH as createActionRunner, aI as createResultStore, aJ as currentReport, aK as defineCommand, aL as diagnosticsOf, b4 as diagnosticsOfDocument, b5 as failureSays, aN as foldReport, aO as isBoundPath, b6 as liveSlots, aP as openEngineCommands, aQ as openEngineSession, aR as parseBound, aS as parseCommandFailure, b7 as reasonWire, b8 as reduceFollow, b9 as reducePreview, ba as reduceReport, bb as reduceRun, aT as reportDiagnostics, bc as settleRun, aW as toArgv, aX as uniqueDiagnostics } from '../registry-BhFAgvlq.js';
1
+ import { A as ActionContribution, S as SourcePort } from '../registry-D7G7pqU4.js';
2
+ export { aZ as Action, k as ActionRunner, m as ActionRunnerOptions, f as ActionTarget, n as ApplyResult, o as ApplyUnobservedError, p as ArgsOf, q as BindingRuntime, d as BoundPath, r as BridgeEngineCaller, s as Busy, t as COMMANDS, b as CanvasPorts, h as CanvasSource, v as CommandBinding, w as CommandDetachedError, x as CommandExitError, y as CommandFailure, z 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, a_ as FailedCommand, a5 as FollowSlot, a6 as GateChangeRequest, a7 as GenerateEvent, a8 as GraphError, a9 as HostBinding, a$ as InputMode, aa as Invocation, J as JsonOf, b0 as LaceReason, b1 as LiveSlots, b2 as OnScreen, c as PendingForm, ad as PortName, ae as PresenterPort, af as PreviewOutcome, ag as PreviewSlot, ah as Reason, ai as ReportEntry, aj as ReportFold, ak as ReportPath, al as ReportSlot, am as ResultKind, an as ResultSlots, R as ResultStore, ao as RunCtx, ap as RunOutcome, b3 as RunPhase, b4 as RunPhaseStatus, aq as RunSlot, ar as RunnerPorts, as as RunningMark, at as SCHEMAS, au as Sink, av as SinkInput, aw as SlotContext, ax as SlotKind, ay as SourceConflict, i as SourceEnd, az as StackRef, aA as Started, aB as ViewStatePort, aC as WiringCandidate, aD as WiringQuery, aE as answering, aF as bridgeCaller, aG as carriesFailure, aH as connectCaller, aI as createActionRunner, aJ as createResultStore, aK as currentReport, aL as defineCommand, aM as diagnosticsOf, b5 as diagnosticsOfDocument, b6 as failureSays, aO as foldReport, aP as isBoundPath, b7 as liveSlots, aQ as openEngineCommands, aR as openEngineSession, aS as parseBound, aT as parseCommandFailure, b8 as reasonWire, b9 as reduceFollow, ba as reducePreview, bb as reduceReport, bc as reduceRun, aU as reportDiagnostics, bd as settleRun, aX as toArgv, aY as uniqueDiagnostics } from '../registry-D7G7pqU4.js';
3
3
  import '@lace-cloud/proto';
4
4
  import 'zod';
5
5
  import '@bufbuild/protobuf/wire';
@@ -39,7 +39,7 @@ import {
39
39
  settleRun,
40
40
  toArgv,
41
41
  uniqueDiagnostics
42
- } from "../chunk-ID563WHD.mjs";
42
+ } from "../chunk-F3X6TTZ6.mjs";
43
43
  export {
44
44
  ApplyUnobservedError,
45
45
  AutosaveEndedError,
package/dist/index.cjs CHANGED
@@ -15764,27 +15764,26 @@ function reduceRun(prev, token, event) {
15764
15764
  phases
15765
15765
  };
15766
15766
  }
15767
- if (event.error)
15767
+ if (!event.error)
15768
15768
  return {
15769
15769
  token,
15770
- outcome: { kind: "failed", message: event.error },
15770
+ outcome: { kind: "succeeded" },
15771
15771
  lastLog,
15772
15772
  submitted,
15773
15773
  phases: closePhases(phases)
15774
15774
  };
15775
- return {
15776
- token,
15777
- outcome: { kind: "succeeded" },
15778
- lastLog,
15779
- submitted,
15780
- phases: closePhases(phases)
15781
- };
15782
15775
  }
15783
15776
  return { token, outcome: { kind: "running" }, lastLog, submitted, phases };
15784
15777
  }
15778
+ function runningFor(slot, token) {
15779
+ if (slot?.token !== token) return false;
15780
+ return "done" in slot ? !slot.done : slot.outcome.kind === "running";
15781
+ }
15785
15782
  function failureSays(error, command) {
15786
15783
  if (error instanceof CommandExitError) {
15787
- return error.failure ? { message: error.failure.message, failure: error.failure } : { message: error.stderrTail };
15784
+ if (error.failure) return { message: error.failure.message, failure: error.failure };
15785
+ const stderr = error.stderrTail.trim();
15786
+ return { message: stderr || `the command exited with code ${error.code} and wrote nothing` };
15788
15787
  }
15789
15788
  if (error instanceof CommandUnobservedError && command.kind === "read") {
15790
15789
  return { message: `the stream ended before \`lace ${command.path}\` finished; run it again` };
@@ -15822,7 +15821,7 @@ function settleRun(prev, token, error) {
15822
15821
  };
15823
15822
  }
15824
15823
  function reducePreview(_prev, token, event) {
15825
- return { token, data: event };
15824
+ return { token, outcome: { kind: "succeeded", data: event } };
15826
15825
  }
15827
15826
  function reduceReport(prev, session, result) {
15828
15827
  const fold = foldReport(prev?.sessions.get(session) ?? EMPTY_REPORT_FOLD, result);
@@ -15835,6 +15834,15 @@ function reduceFollow(prev, token, event) {
15835
15834
  if (event.type === "log") return { token, runId, lines: [...lines, event.text], done: false };
15836
15835
  return { token, runId, lines, done: true };
15837
15836
  }
15837
+ function endStream(current, kind, token, error) {
15838
+ const { run, preview: preview2, follow } = current;
15839
+ if (kind === "run" && runningFor(run, token))
15840
+ return { ...current, run: stamp(settleRun(run, token, error), run.readOver) };
15841
+ if (kind === "preview" && runningFor(preview2, token)) return { ...current, preview: null };
15842
+ if (kind === "follow" && runningFor(follow, token))
15843
+ return { ...current, follow: { ...follow, done: true } };
15844
+ return current;
15845
+ }
15838
15846
  function createResultStore() {
15839
15847
  let slots = {
15840
15848
  run: null,
@@ -15866,11 +15874,14 @@ function createResultStore() {
15866
15874
  notify();
15867
15875
  },
15868
15876
  fail(kind, token, error) {
15869
- if (kind !== "run") return false;
15870
- if (retiredTokens.has(token) || !slots.run) return true;
15871
- slots = { ...slots, run: stamp(settleRun(slots.run, token, error), slots.run.readOver) };
15872
- notify();
15873
- return true;
15877
+ const rendered = kind === "run";
15878
+ if (retiredTokens.has(token)) return rendered;
15879
+ const next = endStream(slots, kind, token, error);
15880
+ if (next !== slots) {
15881
+ slots = next;
15882
+ notify();
15883
+ }
15884
+ return rendered;
15874
15885
  },
15875
15886
  begin(kind, token, readOver, started) {
15876
15887
  if (kind === "run") {
@@ -15885,6 +15896,8 @@ function createResultStore() {
15885
15896
  readOver
15886
15897
  }
15887
15898
  };
15899
+ } else if (kind === "preview") {
15900
+ slots = { ...slots, preview: { token, outcome: { kind: "running" }, readOver } };
15888
15901
  } else if (kind === "follow") {
15889
15902
  slots = {
15890
15903
  ...slots,
@@ -15899,27 +15912,23 @@ function createResultStore() {
15899
15912
  notify();
15900
15913
  },
15901
15914
  detach(kind, token) {
15902
- if (kind === "follow" && slots.follow?.token === token) {
15903
- slots = { ...slots, follow: null };
15904
- notify();
15905
- } else if (kind === "report" && slots.report?.sessions.has(token)) {
15906
- const sessions = new Map(slots.report.sessions);
15915
+ let next = endStream(slots, kind, token, new CommandDetachedError());
15916
+ if (kind === "follow" && next.follow?.token === token) {
15917
+ next = { ...next, follow: null };
15918
+ } else if (kind === "report" && next.report?.sessions.has(token)) {
15919
+ const sessions = new Map(next.report.sessions);
15907
15920
  sessions.delete(token);
15908
- slots = {
15909
- ...slots,
15910
- report: sessions.size > 0 ? { sessions, readOver: slots.report.readOver } : null
15921
+ next = {
15922
+ ...next,
15923
+ report: sessions.size > 0 ? { sessions, readOver: next.report.readOver } : null
15911
15924
  };
15912
- notify();
15913
- } else if (kind === "run" && slots.run?.token === token) {
15914
- const settled = settleRun(slots.run, token, new CommandDetachedError());
15915
- slots = { ...slots, run: stamp(settled, slots.run.readOver) };
15916
- notify();
15917
15925
  } else if (kind === "notify") {
15918
- const running = new Map([...slots.running].filter(([, mark]) => mark.token !== token));
15919
- if (running.size !== slots.running.size) {
15920
- slots = { ...slots, running };
15921
- notify();
15922
- }
15926
+ const running = new Map([...next.running].filter(([, mark]) => mark.token !== token));
15927
+ if (running.size !== next.running.size) next = { ...next, running };
15928
+ }
15929
+ if (next !== slots) {
15930
+ slots = next;
15931
+ notify();
15923
15932
  }
15924
15933
  retiredTokens.add(token);
15925
15934
  },