@lace-cloud/canvas 0.37.0 → 0.37.1

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.
@@ -66,7 +66,7 @@ declare enum Reason {
66
66
  /** REASON_CONFLICT - Generate: the tree moved under the session's base; Keep or Reload first. */
67
67
  REASON_CONFLICT = 6,
68
68
  /**
69
- * REASON_SOURCE_REFUSED - Every mutation, save and generate: the session's source tf is refused
69
+ * REASON_SOURCE_REFUSED - Every mutation, save, discard and generate: the session's source tf is refused
70
70
  * (`BundleState.source_refused`).
71
71
  * module convert and module import: the tree's tf does not parse, has a
72
72
  * non-empty residual report, or its Bundle fails its own validation.
@@ -159,6 +159,14 @@ declare enum Reason {
159
159
  REASON_NO_LOCKFILE = 22,
160
160
  /** REASON_NO_COMMIT - stack create --source: the directory's repository has no commit yet. */
161
161
  REASON_NO_COMMIT = 23,
162
+ /**
163
+ * REASON_STALE_WORKING_STATE - Discard and Restore: the session's working IR is no longer the one the
164
+ * caller showed the developer (`BundleState.working_digest`) -- another
165
+ * holder edited, undid or redid since. Restore also: the saved IR or source
166
+ * tree is no longer the one the backup was captured against. Nothing was
167
+ * discarded or restored; re-read the state and ask again.
168
+ */
169
+ REASON_STALE_WORKING_STATE = 24,
162
170
  UNRECOGNIZED = -1
163
171
  }
164
172
 
@@ -826,6 +834,44 @@ declare const UndoAction: MessageFns<UndoAction>;
826
834
  interface RedoAction {
827
835
  }
828
836
  declare const RedoAction: MessageFns<RedoAction>;
837
+ /**
838
+ * DiscardAction returns the session's working IR to its saved IR (the
839
+ * record `state.lace` holds), a working-IR action: it never saves, writes
840
+ * `state.lace` or the tf, and leaves an open conflict open. The old working
841
+ * IR becomes an undo entry (an Undo brings the discarded edits back) and the
842
+ * redo history is cleared. `expected_working_digest` is required: the
843
+ * `BundleState.working_digest` of the state the caller showed the developer.
844
+ * The engine refuses (FailedPrecondition, `REASON_STALE_WORKING_STATE`) when
845
+ * the working IR's digest differs, so an edit another holder made since is
846
+ * never discarded unseen. A session with nothing unsaved changes nothing:
847
+ * no frame and no undo entry. Refused while the session is source-refused
848
+ * (`REASON_SOURCE_REFUSED`) and for an ephemeral session, which has no saved
849
+ * IR. Like Undo and Redo it is the only action of its batch.
850
+ */
851
+ interface DiscardAction {
852
+ expected_working_digest: string;
853
+ }
854
+ declare const DiscardAction: MessageFns<DiscardAction>;
855
+ /**
856
+ * RestoreAction restores a host's captured working IR into a root session.
857
+ * The bundle, its working digest, saved digest and tree hash must come from
858
+ * the same BundleState frame; every field is required. The engine verifies
859
+ * the bundle's digest and refuses if the current session is not clean, is
860
+ * source-refused, or its saved IR or tree differs from the capture. An open
861
+ * conflict blocks only generate, so it does not refuse a restore. It also compares expected_working_digest with the current frame,
862
+ * so another holder's edits are never overwritten unseen. A refusal changes
863
+ * nothing; the host retains the capture for the developer to choose what to
864
+ * do with it. A successful restore is undoable and writes neither state.lace
865
+ * nor source tf. Like Discard it must be the only action in its batch.
866
+ */
867
+ interface RestoreAction {
868
+ bundle: Bundle | undefined;
869
+ captured_working_digest: string;
870
+ captured_saved_digest: string;
871
+ captured_tree_hash: string;
872
+ expected_working_digest: string;
873
+ }
874
+ declare const RestoreAction: MessageFns<RestoreAction>;
829
875
  /**
830
876
  * PlaceModuleAction drops a registry module onto the canvas. Distinct from
831
877
  * Connect/UpdateInput/etc. in that it names a *source* module (registry
@@ -866,6 +912,8 @@ interface Action {
866
912
  set_directives?: SetDirectivesAction | undefined;
867
913
  set_meta_arguments?: SetMetaArgumentsAction | undefined;
868
914
  add_resource?: AddResourceAction | undefined;
915
+ discard?: DiscardAction | undefined;
916
+ restore?: RestoreAction | undefined;
869
917
  }
870
918
  declare const Action: MessageFns<Action>;
871
919
  interface ApplyActionRequest {
@@ -1090,7 +1138,12 @@ interface BundleState {
1090
1138
  bundle: Bundle | undefined;
1091
1139
  can_undo: boolean;
1092
1140
  can_redo: boolean;
1093
- /** True when the working IR differs from the saved IR in `state.lace`. */
1141
+ /**
1142
+ * True when the working IR differs from the saved IR in `state.lace`. A host
1143
+ * that mirrors a document's dirty state marks it clean only from a frame
1144
+ * whose `unsaved` is false, never from the promise of a save or discard it
1145
+ * requested: edits, saves, undo and Generate from any holder move this flag.
1146
+ */
1094
1147
  unsaved: boolean;
1095
1148
  /**
1096
1149
  * The engine validator's findings for this state, in the validator's
@@ -1144,6 +1197,17 @@ interface BundleState {
1144
1197
  * window is refused (FailedPrecondition).
1145
1198
  */
1146
1199
  generating: boolean;
1200
+ /**
1201
+ * The content identity of the working IR (`encoding.Digest`): the
1202
+ * value a DiscardAction's `expected_working_digest` names. Empty while
1203
+ * there is no working IR.
1204
+ */
1205
+ working_digest: string;
1206
+ /**
1207
+ * The content identity of the saved IR (`encoding.Digest`), captured with
1208
+ * this frame's working IR for RestoreAction. Empty if unavailable.
1209
+ */
1210
+ saved_digest: string;
1147
1211
  }
1148
1212
  declare const BundleState: MessageFns<BundleState>;
1149
1213
  /**
@@ -1707,6 +1771,44 @@ declare const COMMANDS: {
1707
1771
  readonly hidden: false;
1708
1772
  readonly yes: false;
1709
1773
  };
1774
+ readonly "events list": {
1775
+ readonly path: "events list";
1776
+ readonly positionals: readonly [];
1777
+ readonly flags: {
1778
+ readonly cursor: {
1779
+ readonly type: "string";
1780
+ };
1781
+ readonly limit: {
1782
+ readonly type: "int";
1783
+ };
1784
+ readonly org: {
1785
+ readonly type: "string";
1786
+ };
1787
+ readonly output: {
1788
+ readonly type: "string";
1789
+ readonly values: readonly ["table", "json"];
1790
+ readonly short: "o";
1791
+ };
1792
+ readonly since: {
1793
+ readonly type: "string";
1794
+ };
1795
+ readonly subjectId: {
1796
+ readonly type: "string";
1797
+ };
1798
+ readonly subjectKind: {
1799
+ readonly type: "string";
1800
+ };
1801
+ readonly type: {
1802
+ readonly type: "string";
1803
+ };
1804
+ readonly until: {
1805
+ readonly type: "string";
1806
+ };
1807
+ };
1808
+ readonly effect: "read";
1809
+ readonly hidden: false;
1810
+ readonly yes: false;
1811
+ };
1710
1812
  readonly "hooks install": {
1711
1813
  readonly path: "hooks install";
1712
1814
  readonly positionals: readonly [];
@@ -3435,6 +3537,18 @@ declare const SCHEMAS: {
3435
3537
  }, z.core.$strip>;
3436
3538
  advisories: z.ZodArray<z.ZodObject<{
3437
3539
  id: z.ZodString;
3540
+ orgId: z.ZodString;
3541
+ contextRunId: z.ZodNullable<z.ZodString>;
3542
+ contextInstallId: z.ZodNullable<z.ZodString>;
3543
+ contextStackId: z.ZodNullable<z.ZodString>;
3544
+ contextTreeHash: z.ZodNullable<z.ZodString>;
3545
+ actedOn: z.ZodNullable<z.ZodString>;
3546
+ actedAt: z.ZodNullable<z.ZodString>;
3547
+ actedByUserId: z.ZodNullable<z.ZodString>;
3548
+ feedbackThumbs: z.ZodNullable<z.ZodString>;
3549
+ feedbackText: z.ZodNullable<z.ZodString>;
3550
+ emitterKind: z.ZodString;
3551
+ emitterHeededRate: z.ZodNumber;
3438
3552
  manifestation: z.ZodString;
3439
3553
  emittedByInstallId: z.ZodString;
3440
3554
  emittedByDisplayName: z.ZodString;
@@ -3454,6 +3568,18 @@ declare const SCHEMAS: {
3454
3568
  remediationFingerprint: z.ZodString;
3455
3569
  advisories: z.ZodArray<z.ZodObject<{
3456
3570
  id: z.ZodString;
3571
+ orgId: z.ZodString;
3572
+ contextRunId: z.ZodNullable<z.ZodString>;
3573
+ contextInstallId: z.ZodNullable<z.ZodString>;
3574
+ contextStackId: z.ZodNullable<z.ZodString>;
3575
+ contextTreeHash: z.ZodNullable<z.ZodString>;
3576
+ actedOn: z.ZodNullable<z.ZodString>;
3577
+ actedAt: z.ZodNullable<z.ZodString>;
3578
+ actedByUserId: z.ZodNullable<z.ZodString>;
3579
+ feedbackThumbs: z.ZodNullable<z.ZodString>;
3580
+ feedbackText: z.ZodNullable<z.ZodString>;
3581
+ emitterKind: z.ZodString;
3582
+ emitterHeededRate: z.ZodNumber;
3457
3583
  manifestation: z.ZodString;
3458
3584
  emittedByInstallId: z.ZodString;
3459
3585
  emittedByDisplayName: z.ZodString;
@@ -4128,6 +4254,8 @@ type CanvasSource = {
4128
4254
  canUndo: boolean;
4129
4255
  canRedo: boolean;
4130
4256
  unsaved: boolean;
4257
+ workingDigest: string;
4258
+ savedDigest: string;
4131
4259
  ungenerated: boolean;
4132
4260
  conflict: SourceConflict | null;
4133
4261
  sourceRefused: boolean;
@@ -66,7 +66,7 @@ declare enum Reason {
66
66
  /** REASON_CONFLICT - Generate: the tree moved under the session's base; Keep or Reload first. */
67
67
  REASON_CONFLICT = 6,
68
68
  /**
69
- * REASON_SOURCE_REFUSED - Every mutation, save and generate: the session's source tf is refused
69
+ * REASON_SOURCE_REFUSED - Every mutation, save, discard and generate: the session's source tf is refused
70
70
  * (`BundleState.source_refused`).
71
71
  * module convert and module import: the tree's tf does not parse, has a
72
72
  * non-empty residual report, or its Bundle fails its own validation.
@@ -159,6 +159,14 @@ declare enum Reason {
159
159
  REASON_NO_LOCKFILE = 22,
160
160
  /** REASON_NO_COMMIT - stack create --source: the directory's repository has no commit yet. */
161
161
  REASON_NO_COMMIT = 23,
162
+ /**
163
+ * REASON_STALE_WORKING_STATE - Discard and Restore: the session's working IR is no longer the one the
164
+ * caller showed the developer (`BundleState.working_digest`) -- another
165
+ * holder edited, undid or redid since. Restore also: the saved IR or source
166
+ * tree is no longer the one the backup was captured against. Nothing was
167
+ * discarded or restored; re-read the state and ask again.
168
+ */
169
+ REASON_STALE_WORKING_STATE = 24,
162
170
  UNRECOGNIZED = -1
163
171
  }
164
172
 
@@ -826,6 +834,44 @@ declare const UndoAction: MessageFns<UndoAction>;
826
834
  interface RedoAction {
827
835
  }
828
836
  declare const RedoAction: MessageFns<RedoAction>;
837
+ /**
838
+ * DiscardAction returns the session's working IR to its saved IR (the
839
+ * record `state.lace` holds), a working-IR action: it never saves, writes
840
+ * `state.lace` or the tf, and leaves an open conflict open. The old working
841
+ * IR becomes an undo entry (an Undo brings the discarded edits back) and the
842
+ * redo history is cleared. `expected_working_digest` is required: the
843
+ * `BundleState.working_digest` of the state the caller showed the developer.
844
+ * The engine refuses (FailedPrecondition, `REASON_STALE_WORKING_STATE`) when
845
+ * the working IR's digest differs, so an edit another holder made since is
846
+ * never discarded unseen. A session with nothing unsaved changes nothing:
847
+ * no frame and no undo entry. Refused while the session is source-refused
848
+ * (`REASON_SOURCE_REFUSED`) and for an ephemeral session, which has no saved
849
+ * IR. Like Undo and Redo it is the only action of its batch.
850
+ */
851
+ interface DiscardAction {
852
+ expected_working_digest: string;
853
+ }
854
+ declare const DiscardAction: MessageFns<DiscardAction>;
855
+ /**
856
+ * RestoreAction restores a host's captured working IR into a root session.
857
+ * The bundle, its working digest, saved digest and tree hash must come from
858
+ * the same BundleState frame; every field is required. The engine verifies
859
+ * the bundle's digest and refuses if the current session is not clean, is
860
+ * source-refused, or its saved IR or tree differs from the capture. An open
861
+ * conflict blocks only generate, so it does not refuse a restore. It also compares expected_working_digest with the current frame,
862
+ * so another holder's edits are never overwritten unseen. A refusal changes
863
+ * nothing; the host retains the capture for the developer to choose what to
864
+ * do with it. A successful restore is undoable and writes neither state.lace
865
+ * nor source tf. Like Discard it must be the only action in its batch.
866
+ */
867
+ interface RestoreAction {
868
+ bundle: Bundle | undefined;
869
+ captured_working_digest: string;
870
+ captured_saved_digest: string;
871
+ captured_tree_hash: string;
872
+ expected_working_digest: string;
873
+ }
874
+ declare const RestoreAction: MessageFns<RestoreAction>;
829
875
  /**
830
876
  * PlaceModuleAction drops a registry module onto the canvas. Distinct from
831
877
  * Connect/UpdateInput/etc. in that it names a *source* module (registry
@@ -866,6 +912,8 @@ interface Action {
866
912
  set_directives?: SetDirectivesAction | undefined;
867
913
  set_meta_arguments?: SetMetaArgumentsAction | undefined;
868
914
  add_resource?: AddResourceAction | undefined;
915
+ discard?: DiscardAction | undefined;
916
+ restore?: RestoreAction | undefined;
869
917
  }
870
918
  declare const Action: MessageFns<Action>;
871
919
  interface ApplyActionRequest {
@@ -1090,7 +1138,12 @@ interface BundleState {
1090
1138
  bundle: Bundle | undefined;
1091
1139
  can_undo: boolean;
1092
1140
  can_redo: boolean;
1093
- /** True when the working IR differs from the saved IR in `state.lace`. */
1141
+ /**
1142
+ * True when the working IR differs from the saved IR in `state.lace`. A host
1143
+ * that mirrors a document's dirty state marks it clean only from a frame
1144
+ * whose `unsaved` is false, never from the promise of a save or discard it
1145
+ * requested: edits, saves, undo and Generate from any holder move this flag.
1146
+ */
1094
1147
  unsaved: boolean;
1095
1148
  /**
1096
1149
  * The engine validator's findings for this state, in the validator's
@@ -1144,6 +1197,17 @@ interface BundleState {
1144
1197
  * window is refused (FailedPrecondition).
1145
1198
  */
1146
1199
  generating: boolean;
1200
+ /**
1201
+ * The content identity of the working IR (`encoding.Digest`): the
1202
+ * value a DiscardAction's `expected_working_digest` names. Empty while
1203
+ * there is no working IR.
1204
+ */
1205
+ working_digest: string;
1206
+ /**
1207
+ * The content identity of the saved IR (`encoding.Digest`), captured with
1208
+ * this frame's working IR for RestoreAction. Empty if unavailable.
1209
+ */
1210
+ saved_digest: string;
1147
1211
  }
1148
1212
  declare const BundleState: MessageFns<BundleState>;
1149
1213
  /**
@@ -1707,6 +1771,44 @@ declare const COMMANDS: {
1707
1771
  readonly hidden: false;
1708
1772
  readonly yes: false;
1709
1773
  };
1774
+ readonly "events list": {
1775
+ readonly path: "events list";
1776
+ readonly positionals: readonly [];
1777
+ readonly flags: {
1778
+ readonly cursor: {
1779
+ readonly type: "string";
1780
+ };
1781
+ readonly limit: {
1782
+ readonly type: "int";
1783
+ };
1784
+ readonly org: {
1785
+ readonly type: "string";
1786
+ };
1787
+ readonly output: {
1788
+ readonly type: "string";
1789
+ readonly values: readonly ["table", "json"];
1790
+ readonly short: "o";
1791
+ };
1792
+ readonly since: {
1793
+ readonly type: "string";
1794
+ };
1795
+ readonly subjectId: {
1796
+ readonly type: "string";
1797
+ };
1798
+ readonly subjectKind: {
1799
+ readonly type: "string";
1800
+ };
1801
+ readonly type: {
1802
+ readonly type: "string";
1803
+ };
1804
+ readonly until: {
1805
+ readonly type: "string";
1806
+ };
1807
+ };
1808
+ readonly effect: "read";
1809
+ readonly hidden: false;
1810
+ readonly yes: false;
1811
+ };
1710
1812
  readonly "hooks install": {
1711
1813
  readonly path: "hooks install";
1712
1814
  readonly positionals: readonly [];
@@ -3435,6 +3537,18 @@ declare const SCHEMAS: {
3435
3537
  }, z.core.$strip>;
3436
3538
  advisories: z.ZodArray<z.ZodObject<{
3437
3539
  id: z.ZodString;
3540
+ orgId: z.ZodString;
3541
+ contextRunId: z.ZodNullable<z.ZodString>;
3542
+ contextInstallId: z.ZodNullable<z.ZodString>;
3543
+ contextStackId: z.ZodNullable<z.ZodString>;
3544
+ contextTreeHash: z.ZodNullable<z.ZodString>;
3545
+ actedOn: z.ZodNullable<z.ZodString>;
3546
+ actedAt: z.ZodNullable<z.ZodString>;
3547
+ actedByUserId: z.ZodNullable<z.ZodString>;
3548
+ feedbackThumbs: z.ZodNullable<z.ZodString>;
3549
+ feedbackText: z.ZodNullable<z.ZodString>;
3550
+ emitterKind: z.ZodString;
3551
+ emitterHeededRate: z.ZodNumber;
3438
3552
  manifestation: z.ZodString;
3439
3553
  emittedByInstallId: z.ZodString;
3440
3554
  emittedByDisplayName: z.ZodString;
@@ -3454,6 +3568,18 @@ declare const SCHEMAS: {
3454
3568
  remediationFingerprint: z.ZodString;
3455
3569
  advisories: z.ZodArray<z.ZodObject<{
3456
3570
  id: z.ZodString;
3571
+ orgId: z.ZodString;
3572
+ contextRunId: z.ZodNullable<z.ZodString>;
3573
+ contextInstallId: z.ZodNullable<z.ZodString>;
3574
+ contextStackId: z.ZodNullable<z.ZodString>;
3575
+ contextTreeHash: z.ZodNullable<z.ZodString>;
3576
+ actedOn: z.ZodNullable<z.ZodString>;
3577
+ actedAt: z.ZodNullable<z.ZodString>;
3578
+ actedByUserId: z.ZodNullable<z.ZodString>;
3579
+ feedbackThumbs: z.ZodNullable<z.ZodString>;
3580
+ feedbackText: z.ZodNullable<z.ZodString>;
3581
+ emitterKind: z.ZodString;
3582
+ emitterHeededRate: z.ZodNumber;
3457
3583
  manifestation: z.ZodString;
3458
3584
  emittedByInstallId: z.ZodString;
3459
3585
  emittedByDisplayName: z.ZodString;
@@ -4128,6 +4254,8 @@ type CanvasSource = {
4128
4254
  canUndo: boolean;
4129
4255
  canRedo: boolean;
4130
4256
  unsaved: boolean;
4257
+ workingDigest: string;
4258
+ savedDigest: string;
4131
4259
  ungenerated: boolean;
4132
4260
  conflict: SourceConflict | null;
4133
4261
  sourceRefused: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lace-cloud/canvas",
3
- "version": "0.37.0",
3
+ "version": "0.37.1",
4
4
  "lace": {
5
5
  "owner": "authoring"
6
6
  },
@@ -26,8 +26,8 @@
26
26
  "react": "^18.3.1",
27
27
  "react-dom": "^18.3.1",
28
28
  "zod": "^4.1.11",
29
- "@lace-cloud/proto": "0.37.0",
30
- "@lace-cloud/ui": "0.37.0"
29
+ "@lace-cloud/proto": "0.37.1",
30
+ "@lace-cloud/ui": "0.37.1"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@size-limit/file": "12.1.0",
@@ -39,8 +39,8 @@
39
39
  "typescript": "^6.0.2",
40
40
  "vitest": "^4.1.0",
41
41
  "@lace-cloud/api-types": "0.0.0",
42
- "@lace-cloud/import-graph": "0.0.0",
43
- "@lace-cloud/cast-ban-scanner": "0.0.0"
42
+ "@lace-cloud/cast-ban-scanner": "0.0.0",
43
+ "@lace-cloud/import-graph": "0.0.0"
44
44
  },
45
45
  "publishConfig": {
46
46
  "registry": "https://registry.npmjs.org",