@jsb188/mday 1.1.11 → 1.1.12

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.
Files changed (210) hide show
  1. package/package.json +58 -23
  2. package/src/constants/agentMemory.ts +14 -45
  3. package/src/constants/agentNote.ts +212 -0
  4. package/src/constants/aiChat.ts +5 -0
  5. package/src/constants/billing.ts +126 -0
  6. package/src/constants/campaign.ts +156 -47
  7. package/src/constants/contact.ts +72 -0
  8. package/src/constants/csvExport.ts +133 -0
  9. package/src/constants/dataTable.ts +12 -38
  10. package/src/constants/dataTableFieldTypes.generated.ts +3 -7
  11. package/src/constants/docAccess.ts +3 -2
  12. package/src/constants/dt.ts +234 -0
  13. package/src/constants/email.ts +114 -12
  14. package/src/constants/fieldDoc.ts +74 -4
  15. package/src/constants/graphqlReactivity.ts +108 -25
  16. package/src/constants/log.ts +9 -0
  17. package/src/constants/logDisplay/README.md +88 -0
  18. package/src/constants/logDisplay/defaults.ts +39 -0
  19. package/src/constants/logDisplay/index.ts +27 -0
  20. package/src/constants/logDisplay/operations/arable.ts +16 -0
  21. package/src/constants/logDisplay/operations/farmersMarket.ts +10 -0
  22. package/src/constants/logDisplay/operations/foodManufacturing.ts +13 -0
  23. package/src/constants/logDisplay/shared/accounting.ts +13 -0
  24. package/src/constants/logDisplay/shared/interactions.ts +13 -0
  25. package/src/constants/logDisplay/shared/rackTemperatures.ts +42 -0
  26. package/src/constants/logTaxonomy.generated.ts +1834 -730
  27. package/src/constants/organization.ts +13 -14
  28. package/src/constants/qrCode.ts +30 -0
  29. package/src/constants/sheet.ts +65 -101
  30. package/src/constants/sms.ts +18 -0
  31. package/src/constants/storage.ts +33 -9
  32. package/src/constants/usage.ts +3 -0
  33. package/src/constants/workflowSteps.ts +60 -0
  34. package/src/schemas/editLogEntry.ts +106 -283
  35. package/src/schemas/inboundContact.ts +5 -5
  36. package/src/types/agentMemory.d.ts +38 -14
  37. package/src/types/agentNote.d.ts +443 -0
  38. package/src/types/billing.d.ts +537 -0
  39. package/src/types/campaign.d.ts +1043 -193
  40. package/src/types/contact.d.ts +15 -0
  41. package/src/types/csvExport.d.ts +213 -0
  42. package/src/types/dataAnalysis.d.ts +44 -0
  43. package/src/types/dataTable.d.ts +102 -309
  44. package/src/types/definitionElement.d.ts +35 -0
  45. package/src/types/dt.d.ts +257 -0
  46. package/src/types/email.d.ts +144 -55
  47. package/src/types/emailReplyReport.d.ts +76 -0
  48. package/src/types/fieldDoc.d.ts +579 -150
  49. package/src/types/fieldDocContract.d.ts +90 -0
  50. package/src/types/inboundContact.d.ts +8 -0
  51. package/src/types/log.d.ts +94 -3
  52. package/src/types/logDisplay.types.ts +85 -0
  53. package/src/types/organization.d.ts +8 -3
  54. package/src/types/qrCode.d.ts +96 -0
  55. package/src/types/richText.d.ts +81 -0
  56. package/src/types/sheet.d.ts +180 -463
  57. package/src/types/sms.d.ts +38 -0
  58. package/src/types/storage.d.ts +266 -27
  59. package/src/types/workflow.d.ts +196 -66
  60. package/src/utils/agentMemory.ts +15 -0
  61. package/src/utils/agentNote.ts +850 -0
  62. package/src/utils/aiChat.ts +31 -14
  63. package/src/utils/aiChatWork.ts +64 -0
  64. package/src/utils/billing.ts +37 -0
  65. package/src/utils/campaign.ts +642 -209
  66. package/src/utils/campaignAI.ts +72 -0
  67. package/src/utils/campaignAccess.ts +239 -0
  68. package/src/utils/campaignEmail.ts +601 -0
  69. package/src/utils/campaignEmailCompiler.ts +372 -0
  70. package/src/utils/campaignEmailImages.ts +60 -0
  71. package/src/utils/campaignEmailStyles.ts +544 -0
  72. package/src/utils/campaignLifecycle.ts +104 -0
  73. package/src/utils/campaignPreview.ts +285 -0
  74. package/src/utils/contact.ts +50 -0
  75. package/src/utils/csvExport.ts +19 -0
  76. package/src/utils/dataTable.ts +18 -556
  77. package/src/utils/dataTableFieldTypeRegistry.ts +1 -0
  78. package/src/utils/dataTableRelativeDate.ts +447 -0
  79. package/src/utils/definitionElement.ts +84 -0
  80. package/src/utils/email.ts +208 -1
  81. package/src/utils/emailReplyReport.test.ts +187 -0
  82. package/src/utils/emailReplyReport.ts +143 -0
  83. package/src/utils/fieldDoc.ts +81 -37
  84. package/src/utils/fieldDocAnswers.ts +128 -0
  85. package/src/utils/fieldDocDefaults.ts +36 -0
  86. package/src/utils/fieldDocProgram.ts +36 -0
  87. package/src/utils/fieldDocSummary.ts +30 -0
  88. package/src/utils/log.ts +232 -141
  89. package/src/utils/logDisplay.helpers.ts +177 -0
  90. package/src/utils/logDisplay.ts +87 -0
  91. package/src/utils/logStoreRead.ts +9 -13
  92. package/src/utils/logTaxonomy.helpers.ts +17 -0
  93. package/src/utils/logTaxonomyDisplay.ts +80 -124
  94. package/src/utils/noteDoc.ts +66 -284
  95. package/src/utils/organization.ts +117 -283
  96. package/src/utils/qrCode.helpers.ts +189 -0
  97. package/src/utils/qrCode.test.ts +519 -0
  98. package/src/utils/qrCode.ts +273 -0
  99. package/src/utils/richTextHTML.ts +385 -0
  100. package/src/utils/sheet.ts +123 -4834
  101. package/src/utils/sheetAxisMove.ts +77 -291
  102. package/src/utils/sheetBootstrap.ts +771 -1138
  103. package/src/utils/sheetCellLiteral.ts +101 -0
  104. package/src/utils/sheetCommand.ts +23 -88
  105. package/src/utils/sheetDesign.ts +705 -0
  106. package/src/utils/sheetExport.ts +17 -69
  107. package/src/utils/sheetFeatureReference.ts +183 -0
  108. package/src/utils/sheetFormulaArgs.ts +168 -0
  109. package/src/utils/sheetFormulaCompile.ts +475 -0
  110. package/src/utils/sheetFormulaConditionalAggregate.ts +254 -0
  111. package/src/utils/sheetFormulaCriteria.ts +656 -0
  112. package/src/utils/sheetFormulaDate.ts +444 -0
  113. package/src/utils/sheetFormulaEvaluation.ts +388 -403
  114. package/src/utils/sheetFormulaEvaluator.ts +589 -444
  115. package/src/utils/sheetFormulaFunctionHandlers.ts +403 -0
  116. package/src/utils/sheetFormulaLogical.ts +116 -0
  117. package/src/utils/sheetFormulaLookup.ts +488 -0
  118. package/src/utils/sheetFormulaMath.ts +48 -0
  119. package/src/utils/sheetFormulaParser.ts +729 -0
  120. package/src/utils/sheetFormulaRange.ts +330 -0
  121. package/src/utils/sheetFormulaReference.ts +703 -0
  122. package/src/utils/sheetFormulaReferenceAggregates.ts +313 -0
  123. package/src/utils/sheetFormulaReferenceDates.ts +237 -0
  124. package/src/utils/sheetFormulaReferenceLogical.ts +330 -0
  125. package/src/utils/sheetFormulaReferenceLookup.ts +341 -0
  126. package/src/utils/sheetFormulaReferenceMath.ts +95 -0
  127. package/src/utils/sheetFormulaReferenceRewrite.ts +220 -0
  128. package/src/utils/sheetFormulaReferenceText.ts +462 -0
  129. package/src/utils/sheetFormulaSyntax.ts +1027 -0
  130. package/src/utils/sheetFormulaText.ts +430 -0
  131. package/src/utils/sheetJournal.ts +140 -18
  132. package/src/utils/sheetNumberFormat.ts +68 -267
  133. package/src/utils/sheetPreview.ts +68 -0
  134. package/src/utils/sheetSequence.ts +13 -43
  135. package/src/utils/sheetSnapshot.ts +176 -429
  136. package/src/utils/sheetStructureEdit.ts +537 -907
  137. package/src/utils/sheetStructureReferences.ts +389 -0
  138. package/src/utils/storage.ts +49 -3
  139. package/src/utils/time.ts +12 -0
  140. package/src/utils/workflow.ts +199 -73
  141. package/src/utils/workflowLogFingerprint.ts +302 -0
  142. package/src/utils/workflowLogRevisionSnapshot.ts +424 -0
  143. package/src/utils/workflowProgress.ts +280 -0
  144. package/src/utils/workflowTriggers.ts +61 -0
  145. package/tests/agentNote.test.ts +395 -0
  146. package/tests/campaignAI.test.ts +119 -0
  147. package/tests/campaignAccess.test.ts +239 -0
  148. package/tests/campaignEmail.test.ts +441 -0
  149. package/tests/campaignLifecycle.test.ts +134 -0
  150. package/tests/campaignPublication.test.ts +309 -0
  151. package/tests/dataTableFieldTypeRegistry.test.ts +2 -1
  152. package/tests/dataTableRelativeDate.test.ts +412 -0
  153. package/tests/email.test.ts +39 -0
  154. package/tests/fieldDocProgram.test.ts +114 -0
  155. package/tests/logDisplay.fixtures.ts +67 -0
  156. package/tests/logDisplay.test.ts +227 -0
  157. package/tests/noteDoc.test.ts +37 -192
  158. package/tests/richTextHTML.test.ts +185 -0
  159. package/tests/sheetAxisMove.test.ts +49 -40
  160. package/tests/sheetBootstrap.test.ts +1967 -0
  161. package/tests/sheetFeatureReference.test.ts +22 -0
  162. package/tests/sheetFormulaCriteria.test.ts +269 -0
  163. package/tests/sheetFormulaEvaluator.test.ts +93 -200
  164. package/tests/sheetFormulaFunctions.test.ts +538 -0
  165. package/tests/sheetFormulaLanguage.test.ts +361 -0
  166. package/tests/sheetFormulaParity.fixtures.ts +872 -0
  167. package/tests/sheetFormulaParity.test.ts +188 -0
  168. package/tests/sheetFormulaRange.test.ts +167 -0
  169. package/tests/sheetFormulaReference.test.ts +78 -0
  170. package/tests/sheetFormulaReferenceRewrite.test.ts +117 -0
  171. package/tests/sheetFormulaTextDate.test.ts +512 -0
  172. package/tests/sheetSequence.test.ts +4 -23
  173. package/tests/sheetSnapshot.test.ts +134 -0
  174. package/tests/sheetStructureEdit.test.ts +492 -37
  175. package/tests/sheetStructureReferences.test.ts +589 -0
  176. package/tests/workflowLifecycleStatus.test.ts +60 -0
  177. package/tests/workflowLogFingerprint.test.ts +203 -0
  178. package/tests/workflowLogRevisionSnapshot.test.ts +96 -0
  179. package/tests/workflowProgress.test.ts +180 -0
  180. package/tests/workflowTriggers.test.ts +29 -0
  181. package/src/constants/agentDoc.ts +0 -12
  182. package/src/constants/logActivityGroupColors.generated.ts +0 -19
  183. package/src/constants/schedule.ts +0 -220
  184. package/src/constants/scheduleRuleTemplateSeed.ts +0 -138
  185. package/src/constants/scheduleRuleTemplates.generated.ts +0 -145
  186. package/src/constants/sheetRegionSources.generated.ts +0 -578
  187. package/src/schemas/fieldDocsQuery.ts +0 -12
  188. package/src/schemas/organization.ts +0 -68
  189. package/src/types/agentDoc.d.ts +0 -64
  190. package/src/types/noteDoc.d.ts +0 -86
  191. package/src/types/schedule.d.ts +0 -391
  192. package/src/utils/agentDoc.ts +0 -109
  193. package/src/utils/campaignFormEditor.ts +0 -871
  194. package/src/utils/dataTableRealtimeAuthority.ts +0 -209
  195. package/src/utils/dataTableRealtimeSelection.ts +0 -134
  196. package/src/utils/dataTableRowDocument.ts +0 -508
  197. package/src/utils/dataTableSource.ts +0 -230
  198. package/src/utils/schedule.ts +0 -799
  199. package/src/utils/scheduleEvaluation.ts +0 -1994
  200. package/src/utils/scheduleICS.ts +0 -246
  201. package/src/utils/scheduleRuleTemplates.ts +0 -188
  202. package/src/utils/sheetRegion.ts +0 -374
  203. package/src/utils/sheetRegionFilter.ts +0 -1259
  204. package/src/utils/sheetRegionSourceRegistry.ts +0 -594
  205. package/tests/schedule.test.ts +0 -693
  206. package/tests/scheduleEvaluation.test.ts +0 -1970
  207. package/tests/scheduleICS.test.ts +0 -208
  208. package/tests/scheduleRuleTemplates.test.ts +0 -176
  209. package/tests/scheduleSweepInvariants.test.ts +0 -428
  210. package/tests/sheetRegionFilter.test.ts +0 -1135
@@ -1,80 +1,37 @@
1
1
  import type {
2
2
  GRID_ITEM_SORT_ENUMS,
3
3
  SHEET_CELL_NUMBER_FORMAT_TYPE_ENUMS,
4
- SHEET_CELL_SOURCE_TYPE_ENUMS,
5
4
  SHEET_CELL_TEXT_ALIGN_ENUMS,
6
5
  SHEET_CELL_TEXT_WRAP_ENUMS,
7
6
  SHEET_CELL_VALUE_TYPE_ENUMS,
8
7
  SHEET_CELL_VERTICAL_ALIGN_ENUMS,
9
- SHEET_CUSTOM_REGION_SOURCE_COLUMN_FORMULA_VALUE_SOURCE_ENUMS,
10
8
  SHEET_EXPORT_FORMAT_ENUMS,
11
- SHEET_REGION_CONFLICT_POLICY_ENUMS,
12
- SHEET_REGION_PROJECTION_STATUS_ENUMS,
13
- SHEET_REGION_SOURCE_FILTER_COMBINATOR_ENUMS,
14
- SHEET_REGION_SOURCE_FILTER_OPERATOR_ENUMS,
15
- SHEET_REGION_SOURCE_SORT_DIRECTION_ENUMS,
16
- SHEET_REGION_SOURCE_TYPE_ENUMS,
17
- SHEET_REGION_TYPE_ENUMS,
18
9
  SHEET_STRUCTURE_OPERATION_ENUMS,
19
10
  } from '../constants/sheet.ts';
20
- import type { SheetFormulaASTNode } from '../utils/sheet.ts';
21
- import type {
22
- DataTableDesignGQL,
23
- DataTableFieldTypeEnum,
24
- } from './dataTable.d.ts';
11
+ import type { SheetFormulaASTNode } from '../utils/sheetFormulaSyntax.ts';
12
+ import type { SheetComputedCellPayload } from '../utils/sheetJournal.ts';
25
13
  import type { DocAccessBaseObj } from './docAccess.d.ts';
26
14
 
27
- export type SheetCellSourceTypeEnum =
28
- (typeof SHEET_CELL_SOURCE_TYPE_ENUMS)[number];
29
- export type SheetCellTextAlignEnum =
30
- (typeof SHEET_CELL_TEXT_ALIGN_ENUMS)[number];
15
+ /* Explicit authored scalar interpretation; null retains ordinary automatic input parsing. */
16
+ export type SheetCellLiteralType = 'TEXT' | 'NUMBER' | 'BOOLEAN' | 'DATE' | 'DATETIME';
17
+
18
+ export type SheetCellTextAlignEnum = (typeof SHEET_CELL_TEXT_ALIGN_ENUMS)[number];
31
19
  export type SheetCellTextWrapEnum = (typeof SHEET_CELL_TEXT_WRAP_ENUMS)[number];
32
- export type SheetCellVerticalAlignEnum =
33
- (typeof SHEET_CELL_VERTICAL_ALIGN_ENUMS)[number];
34
- export type SheetRegionTypeEnum = (typeof SHEET_REGION_TYPE_ENUMS)[number];
35
- export type SheetRegionProjectionStatusEnum =
36
- (typeof SHEET_REGION_PROJECTION_STATUS_ENUMS)[number];
37
- export type SheetRegionSourceTypeEnum =
38
- (typeof SHEET_REGION_SOURCE_TYPE_ENUMS)[number];
39
- export type SheetRegionConflictPolicyEnum =
40
- (typeof SHEET_REGION_CONFLICT_POLICY_ENUMS)[number];
41
- export type SheetRegionSourceFilterCombinatorEnum =
42
- (typeof SHEET_REGION_SOURCE_FILTER_COMBINATOR_ENUMS)[number];
43
- export type SheetRegionSourceFilterOperatorEnum =
44
- (typeof SHEET_REGION_SOURCE_FILTER_OPERATOR_ENUMS)[number];
45
- export type SheetRegionSourceSortDirectionEnum =
46
- (typeof SHEET_REGION_SOURCE_SORT_DIRECTION_ENUMS)[number];
47
- export type SheetStructureOperationEnum =
48
- (typeof SHEET_STRUCTURE_OPERATION_ENUMS)[number];
49
- export type SheetCellValueTypeEnum =
50
- (typeof SHEET_CELL_VALUE_TYPE_ENUMS)[number];
51
- export type SheetCellNumberFormatTypeEnum =
52
- (typeof SHEET_CELL_NUMBER_FORMAT_TYPE_ENUMS)[number];
20
+ export type SheetCellVerticalAlignEnum = (typeof SHEET_CELL_VERTICAL_ALIGN_ENUMS)[number];
21
+
22
+ export type SheetStructureOperationEnum = (typeof SHEET_STRUCTURE_OPERATION_ENUMS)[number];
23
+ export type SheetCellValueTypeEnum = (typeof SHEET_CELL_VALUE_TYPE_ENUMS)[number];
24
+ export type SheetCellNumberFormatTypeEnum = (typeof SHEET_CELL_NUMBER_FORMAT_TYPE_ENUMS)[number];
53
25
  export type GridItemSortEnum = (typeof GRID_ITEM_SORT_ENUMS)[number];
54
26
  export type SheetExportFormatEnum = (typeof SHEET_EXPORT_FORMAT_ENUMS)[number];
55
- export type SheetFormulaReferenceKind =
56
- | 'SHEET_CELL'
57
- | 'SHEET_RANGE'
58
- | 'DATA_TABLE_CELL'
59
- | 'DATA_TABLE_QUERY_CELL';
60
- export type SheetFormulaReferenceStatusEnum =
61
- | 'READY'
62
- | 'LOADING'
63
- | 'ERROR'
64
- | 'NOT_FOUND';
65
- export type SheetRegionColumnKind = 'DATA_TABLE_CELL' | 'FORMULA';
66
- export type SheetCustomRegionSourceColumnFormulaValueSourceEnum =
67
- (typeof SHEET_CUSTOM_REGION_SOURCE_COLUMN_FORMULA_VALUE_SOURCE_ENUMS)[number];
27
+ export type SheetFormulaReferenceKind = 'SHEET_CELL' | 'SHEET_RANGE';
28
+ export type SheetFormulaReferenceStatusEnum = 'READY' | 'LOADING' | 'ERROR' | 'NOT_FOUND';
68
29
 
69
30
  /* Durable Sheet command lifecycle returned by mutations and acknowledgements. */
70
31
  export type SheetCommandStatusEnum = 'COMMITTED' | 'REPLAYED' | 'CONFLICTED';
71
32
 
72
33
  /* Client-side lifecycle while a durable command is waiting for authority. */
73
- export type SheetClientCommandStatusEnum =
74
- | 'PENDING'
75
- | 'IN_FLIGHT'
76
- | SheetCommandStatusEnum
77
- | 'FAILED';
34
+ export type SheetClientCommandStatusEnum = 'PENDING' | 'IN_FLIGHT' | SheetCommandStatusEnum | 'FAILED';
78
35
 
79
36
  /* Design entity addressed by one property-level design command intent. */
80
37
  export type SheetDesignOperationTargetType =
@@ -88,11 +45,7 @@ export type SheetDesignOperationTargetType =
88
45
  | 'METADATA';
89
46
 
90
47
  /* Mutation requested for one canonical design target/property. */
91
- export type SheetDesignOperationType =
92
- | 'SET_PROPERTY'
93
- | 'DELETE_PROPERTY'
94
- | 'UPSERT_ENTITY'
95
- | 'DELETE_ENTITY';
48
+ export type SheetDesignOperationType = 'SET_PROPERTY' | 'DELETE_PROPERTY' | 'UPSERT_ENTITY' | 'DELETE_ENTITY';
96
49
 
97
50
  /* Client intent deliberately excludes `before`; the server captures authority. */
98
51
  export interface SheetDesignCommandIntent {
@@ -114,18 +67,8 @@ export interface SheetDesignPatchInput {
114
67
  rows?: string | null;
115
68
  }
116
69
 
117
- /* One durable Sheet range mutation intent. */
118
- export type SheetRangeCommandOperationEnum = 'UPSERT' | 'DELETE';
119
-
120
- /* One durable Sheet region definition mutation intent. */
121
- export type SheetRegionCommandOperationEnum = 'UPSERT' | 'DELETE';
122
-
123
70
  /* Ordered mutation family accepted by one atomic compound Sheet command. */
124
- export type SheetCompoundCommandFamily =
125
- | 'CELLS'
126
- | 'DESIGN'
127
- | 'DATA_TABLE_CELLS'
128
- | 'REGION';
71
+ export type SheetCompoundCommandFamily = 'CELLS' | 'DESIGN';
129
72
 
130
73
  /* Cell intent embedded in an atomic compound Sheet command. */
131
74
  export interface SheetCompoundCellEditInput {
@@ -135,72 +78,25 @@ export interface SheetCompoundCellEditInput {
135
78
  format?: string | null;
136
79
  note?: string | null;
137
80
  rawInput?: string | null;
138
- regionId?: string | number | bigint | null;
81
+ literalType?: SheetCellLiteralType | null;
82
+
139
83
  style?: SheetCellStyleObj | null;
140
84
  value?: string | null;
141
85
  };
142
86
  clear?: boolean | null;
143
87
  }
144
88
 
145
- /* DataTable source-cell intent embedded in an atomic compound command. */
146
- export interface SheetCompoundDataTableCellInput {
147
- cellKey: string;
148
- dataTableRowId: string | number | bigint;
149
- regionId: string | number | bigint;
150
- value?: string | null;
151
- }
152
-
153
- /* Filter condition accepted by the SheetRegionSourceFilterConditionInput contract. */
154
- export interface SheetRegionSourceFilterConditionInput {
155
- booleanValue?: boolean | null;
156
- cellKey: string;
157
- dateValue?: string | null;
158
- datetimeValue?: string | Date | null;
159
- numberValue?: number | null;
160
- operator: SheetRegionSourceFilterOperatorEnum;
161
- textValue?: string | null;
162
- textValues?: string[] | null;
163
- }
164
-
165
- /* Recursive filter group accepted by the SheetRegionSourceFilterInput contract. */
166
- export interface SheetRegionSourceFilterInput {
167
- combinator: SheetRegionSourceFilterCombinatorEnum;
168
- conditions?: SheetRegionSourceFilterConditionInput[] | null;
169
- groups?: SheetRegionSourceFilterInput[] | null;
170
- }
171
-
172
- /* Sort entry accepted by the SheetRegionSourceSortInput contract. */
173
- export interface SheetRegionSourceSortInput {
174
- cellKey: string;
175
- direction: SheetRegionSourceSortDirectionEnum;
176
- }
177
-
178
- /* Source definition accepted by the SheetRegionSourceInput contract. */
179
- export interface SheetRegionSourceInput {
180
- dataTableId?: number | bigint | string | null;
181
- filter?: SheetRegionSourceFilterInput | null;
182
- includeRowIds?: Array<number | bigint | string> | null;
183
- sort?: SheetRegionSourceSortInput[] | null;
184
- type: SheetRegionSourceTypeEnum;
185
- }
186
-
187
- /* Column definition accepted by the SheetRegionColumnInput contract. */
188
- export interface SheetRegionColumnInput {
189
- formulaText?: string | null;
190
- kind: SheetRegionColumnKind;
191
- sourceCellKey?: string | null;
192
- }
89
+ /*
90
+ * One reusable, serialized authority condition evaluated before a Sheet
91
+ * command mutates any target. More condition kinds can extend this union.
92
+ */
93
+ export type SheetCommandPrecondition = {
94
+ baseDesignRevision: SheetJournalSeq;
95
+ baseRevision: SheetJournalSeq;
193
96
 
194
- /* Region definition accepted by the SheetRegionInput contract. */
195
- export interface SheetCompoundRegionInput {
196
- active?: boolean | null;
197
- columns: SheetRegionColumnInput[];
198
- options?: SheetRegionOptionsObj | null;
199
- source: SheetRegionSourceInput;
200
- startColumnIndex: number;
201
- startRowIndex: number;
202
- type: SheetRegionTypeEnum;
203
- }
97
+ kind: 'CELL_TARGETS_UNCHANGED';
98
+ sheetCells: SheetCompoundCellEditInput[];
99
+ };
204
100
 
205
101
  /*
206
102
  * One ordered compound component. Optional GraphQL fields are intentionally
@@ -214,29 +110,10 @@ export type SheetCompoundCommandOperationInput =
214
110
  | {
215
111
  family: 'DESIGN';
216
112
  designOperations: SheetDesignCommandIntent[];
217
- }
218
- | {
219
- family: 'DATA_TABLE_CELLS';
220
- dataTableCells: SheetCompoundDataTableCellInput[];
221
- dataTableId: string | number | bigint;
222
- }
223
- | {
224
- family: 'REGION';
225
- regionOperation: SheetRegionCommandOperationEnum;
226
- region?: SheetCompoundRegionInput | null;
227
- regionId?: string | number | bigint | null;
228
113
  };
229
114
 
230
- /* Durable command family accepted by one ordered Sheet command batch item. */
231
- export type SheetCommandBatchItemTypeEnum =
232
- | 'EDIT_CELLS'
233
- | 'EDIT_DESIGN'
234
- | 'EDIT_DATA_TABLE_CELLS'
235
- | 'EDIT_COMPOUND'
236
- | 'EDIT_RANGE'
237
- | 'MOVE_AXIS'
238
- | 'UNDO'
239
- | 'REDO';
115
+ /* Durable command family of one Sheet command (GraphQL enum SheetCommandType). */
116
+ export type SheetCommandTypeEnum = 'EDIT_CELLS' | 'EDIT_DESIGN' | 'EDIT_COMPOUND' | 'EDIT_STRUCTURE' | 'MOVE_AXIS' | 'UNDO' | 'REDO';
240
117
 
241
118
  /* Compact semantic row/column permutation accepted by MOVE_AXIS commands. */
242
119
  export interface SheetAxisMoveCommandInput {
@@ -247,49 +124,46 @@ export interface SheetAxisMoveCommandInput {
247
124
  }
248
125
 
249
126
  /*
250
- * Pragmatic shared shape of one GraphQL Sheet command batch item. The server
251
- * validates which optional payload belongs to the selected command family.
127
+ * One command of a sealed Sheet command envelope (wire contract v4, DESIGN
128
+ * §1.1). Base revisions are the client's applied cursors of the tab at seal
129
+ * time; `recordUndo: false` marks a command the server keeps no undo record
130
+ * for. The server validates which optional payload belongs to the family.
252
131
  */
253
- export interface SheetCommandBatchItemInput {
132
+ export interface SheetCommandInput {
254
133
  axisMove?: SheetAxisMoveCommandInput | null;
255
134
  baseDesignRevision: SheetJournalSeqInput;
256
135
  baseRevision: SheetJournalSeqInput;
257
136
  cells?: SheetCompoundCellEditInput[] | null;
258
137
  commandId: string;
259
- commandType: SheetCommandBatchItemTypeEnum;
138
+ commandType: SheetCommandTypeEnum;
139
+ confirmDestructive?: boolean | null;
260
140
  compoundOperations?: SheetCompoundCommandOperationInput[] | null;
261
- dataTableCells?: SheetCompoundDataTableCellInput[] | null;
262
- dataTableId?: string | number | bigint | null;
141
+
263
142
  designOperations?: SheetDesignCommandIntent[] | null;
264
- includeInOperationalHistory?: boolean | null;
265
- operation?: SheetRangeCommandOperationEnum | null;
266
- predecessorCommandIds?: string[] | null;
267
- previewClientId?: string | null;
268
- previewEnvelopeId?: string | null;
269
- previewSeq?: number | null;
270
- previewTargetKeys?: string[] | null;
271
- range?: SheetRangeInput | null;
272
- rangeId?: string | number | bigint | null;
273
- sessionId: string;
143
+ precondition?: SheetCommandPrecondition | null;
144
+ recordUndo?: boolean | null;
274
145
  sheetTabId: string | number | bigint;
146
+ structureIndex?: number | null;
147
+ structureOperation?: SheetStructureOperationEnum | null;
275
148
  targetCommandId?: string | null;
276
149
  }
277
150
 
278
- /* Canonical input shared by Sheet range command operations. */
279
- export interface SheetRangeInput {
280
- endColumnIndex: number;
281
- endRowIndex: number;
282
- format?: string | null;
283
- metadata?: string | null;
284
- position?: number | null;
285
- startColumnIndex: number;
286
- startRowIndex: number;
287
- style?: SheetCellStyleObj | null;
151
+ /*
152
+ * One sealed command envelope: a random idempotency key, the per-document
153
+ * client id and its strictly increasing sequence, and the sessionStorage
154
+ * session that scopes undo (DESIGN §0 D2).
155
+ */
156
+ export interface SheetCommandEnvelopeInput {
157
+ contractVersion: 4;
158
+ clientId: string;
159
+ clientSeq: number;
160
+ commands: SheetCommandInput[];
161
+ envelopeId: string;
162
+ sessionId: string;
288
163
  }
289
164
 
290
165
  /* Authoritative operation persisted after the server captures before/after state. */
291
- export interface SheetStoredDesignOperation
292
- extends Omit<SheetDesignCommandIntent, 'value'> {
166
+ export interface SheetStoredDesignOperation extends Omit<SheetDesignCommandIntent, 'value'> {
293
167
  after?: unknown;
294
168
  before?: unknown;
295
169
  commandId: string;
@@ -297,28 +171,9 @@ export interface SheetStoredDesignOperation
297
171
  operationIndex: number;
298
172
  }
299
173
 
300
- export interface SheetCustomRegionSourceColumnObj {
301
- key: string;
302
- labelKey: string;
303
- fieldType?: DataTableFieldTypeEnum | null;
304
- formulaValueSource?: SheetCustomRegionSourceColumnFormulaValueSourceEnum | null;
305
- relatedTable?: string | null;
306
- width: number;
307
- }
308
-
309
- export type SheetCellValue =
310
- | string
311
- | number
312
- | boolean
313
- | null
314
- | Record<string, any>
315
- | any[];
174
+ export type SheetCellValue = string | number | boolean | null | Record<string, any> | any[];
316
175
 
317
- export type SheetCellBorderStyleValue =
318
- | 'solid'
319
- | 'dashed'
320
- | 'dotted'
321
- | 'double';
176
+ export type SheetCellBorderStyleValue = 'solid' | 'dashed' | 'dotted' | 'double';
322
177
 
323
178
  export interface SheetCellStyleObj {
324
179
  fontSize?: number | null;
@@ -419,9 +274,7 @@ export interface SheetFormulaReferenceObj {
419
274
  startColumnIndex?: number | null;
420
275
  endRowIndex?: number | null;
421
276
  endColumnIndex?: number | null;
422
- dataTableName?: string | null;
423
- rowIdentifier?: string | null;
424
- cellKey?: string | null;
277
+
425
278
  value?: SheetCellValue;
426
279
  textValue?: string | null;
427
280
  numberValue?: number | null;
@@ -475,24 +328,7 @@ export interface SheetCompiledFormulaObj {
475
328
  volatile: boolean;
476
329
  cells: SheetCompiledFormulaCellReferenceObj[];
477
330
  ranges: SheetCompiledFormulaRangeReferenceObj[];
478
- dataTableCells: Array<{
479
- dataTableName: string;
480
- cellKey: string;
481
- rowIdentifier: string | null;
482
- text: string;
483
- }>;
484
- dataTableQueries: Array<{
485
- dataTableName: string;
486
- cellKey: string;
487
- conditions: Array<{
488
- cellKey: string;
489
- operator: string;
490
- isStatic: boolean;
491
- staticValue: string | number | boolean | null;
492
- text: string;
493
- }>;
494
- text: string;
495
- }>;
331
+
496
332
  diagnostics: SheetCompiledFormulaDiagnosticObj[];
497
333
  /* Stored parse tree for current compile-cache evaluation. It is null on a
498
334
  * parse failure; consumers reparse canonical formula text on a cache miss. */
@@ -513,6 +349,7 @@ export interface SheetData {
513
349
  deletedAt?: Date | string | null;
514
350
  hiddenByJobId?: number | bigint | null;
515
351
  accessEpoch?: number | bigint;
352
+ manifestRevision?: SheetJournalSeq | bigint;
516
353
  createdAt: Date;
517
354
  updatedAt: Date;
518
355
  }
@@ -525,6 +362,7 @@ export interface SheetTabData {
525
362
  sheetId: number | bigint;
526
363
  name: string;
527
364
  position: number;
365
+ hidden: boolean;
528
366
  design: SheetDesignObj;
529
367
  cellsRevision: SheetJournalSeq | bigint;
530
368
  designRevision: SheetJournalSeq | bigint;
@@ -533,13 +371,6 @@ export interface SheetTabData {
533
371
  updatedAt: Date;
534
372
  }
535
373
 
536
- export interface SheetCellSourceMetaObj {
537
- relatedTable?: string | null;
538
- relatedId?: string | null;
539
- referenceStatus?: 'ACTIVE' | 'DELETED' | null;
540
- iconName?: string | null;
541
- }
542
-
543
374
  export interface SheetCellData {
544
375
  __table: 'sheet_cells';
545
376
 
@@ -550,6 +381,8 @@ export interface SheetCellData {
550
381
  rowIndex: number;
551
382
  columnIndex: number;
552
383
  rawInput?: string | null;
384
+ literalType?: SheetCellLiteralType | null;
385
+
553
386
  formulaText?: string | null;
554
387
  compiledFormula?: SheetCompiledFormulaObj | null;
555
388
  value?: SheetCellValue;
@@ -568,113 +401,10 @@ export interface SheetCellData {
568
401
  style?: SheetCellStyleObj | null;
569
402
  format?: Record<string, any> | null;
570
403
  note?: string | null;
571
- sourceType: SheetCellSourceTypeEnum;
572
- regionId?: number | bigint | null;
573
- sourceDataTableRowId?: number | bigint | null;
574
- sourceRowKey?: string | null;
575
- sourceCellKey?: string | null;
576
- /* Stable DATA_TABLE provenance; sourceCellKey remains the display-field key. */
577
- sourceColumnId?: number | bigint | string | null;
578
- sourceMeta?: SheetCellSourceMetaObj | null;
404
+
579
405
  deletedAt?: Date | string | null;
580
406
  deletionJobId?: number | bigint | null;
581
- region?: SheetCellRegionSourceObj | null;
582
- createdAt: Date;
583
- updatedAt: Date;
584
- }
585
-
586
- export interface SheetRangeData {
587
- __table: 'sheet_ranges';
588
-
589
- id: number | bigint;
590
- organizationId: number | bigint;
591
- sheetId: number | bigint;
592
- sheetTabId: number | bigint;
593
- startRowIndex: number;
594
- startColumnIndex: number;
595
- endRowIndex: number;
596
- endColumnIndex: number;
597
- position: number;
598
- style?: SheetCellStyleObj | null;
599
- format?: Record<string, any> | null;
600
- metadata?: Record<string, any> | null;
601
- createdAt: Date;
602
- updatedAt: Date;
603
- }
604
-
605
- export interface SheetRegionSourceObj {
606
- type: SheetRegionSourceTypeEnum;
607
- /* Stable-column JSON contract version. Present only for physical DATA_TABLE sources. */
608
- identityVersion?: 1 | null;
609
- dataTableId?: number | bigint | string | null;
610
- filter?: SheetRegionSourceFilterGroupObj | null;
611
- sort?: SheetRegionSourceSortObj[] | null;
612
- /* Included source row ids for built-in (generated) sources; null/absent inserts every row */
613
- includeRowIds?: Array<number | bigint | string> | null;
614
- }
615
-
616
- export interface SheetRegionSourceFilterGroupObj {
617
- combinator: SheetRegionSourceFilterCombinatorEnum;
618
- conditions?: SheetRegionSourceFilterConditionObj[] | null;
619
- groups?: SheetRegionSourceFilterGroupObj[] | null;
620
- }
621
-
622
- export interface SheetRegionSourceFilterConditionObj {
623
- cellKey: string;
624
- /* Stable physical column identity paired with the authored/public cellKey. */
625
- columnId?: number | bigint | string | null;
626
- operator: SheetRegionSourceFilterOperatorEnum;
627
- textValue?: string | null;
628
- textValues?: string[] | null;
629
- numberValue?: number | null;
630
- booleanValue?: boolean | null;
631
- dateValue?: string | null;
632
- datetimeValue?: string | Date | null;
633
- }
634
-
635
- export interface SheetRegionSourceSortObj {
636
- cellKey: string;
637
- /* Stable physical column identity paired with the authored/public cellKey. */
638
- columnId?: number | bigint | string | null;
639
- direction: SheetRegionSourceSortDirectionEnum;
640
- }
641
-
642
- export interface SheetRegionColumnObj {
643
- kind: SheetRegionColumnKind;
644
- sourceCellKey?: string | null;
645
- /* Stable identity for DATA_TABLE_CELL columns. */
646
- sourceColumnId?: number | bigint | string | null;
647
- /* Stable identities referenced by self(...) in a FORMULA column. */
648
- sourceColumnIds?: Array<number | bigint | string> | null;
649
- formulaText?: string | null;
650
- }
651
-
652
- export interface SheetRegionOptionsObj {
653
- conflictPolicy?: SheetRegionConflictPolicyEnum | null;
654
- endRowIndex?: number | null;
655
- includeHeaderRow?: boolean | null;
656
- }
657
407
 
658
- export interface SheetRegionData {
659
- __table: 'sheet_regions';
660
-
661
- id: number | bigint;
662
- organizationId: number | bigint;
663
- sheetId: number | bigint;
664
- sheetTabId: number | bigint;
665
- type: SheetRegionTypeEnum;
666
- startRowIndex: number;
667
- startColumnIndex: number;
668
- sourceDataTableId?: number | bigint | null;
669
- source: SheetRegionSourceObj;
670
- columns: SheetRegionColumnObj[];
671
- options: SheetRegionOptionsObj;
672
- active: boolean;
673
- definitionRevision: number | bigint;
674
- lastSyncedAt?: Date | string | null;
675
- projectionRevision?: number | bigint | null;
676
- projectionStatus: SheetRegionProjectionStatusEnum;
677
- syncRevision?: number | bigint;
678
408
  createdAt: Date;
679
409
  updatedAt: Date;
680
410
  }
@@ -686,13 +416,6 @@ export interface SheetGridViewportObj {
686
416
  columnCount: number;
687
417
  }
688
418
 
689
- export interface SheetCellRegionSourceObj {
690
- regionId?: number | bigint | string | null;
691
- sourceRowId?: number | bigint | string | null;
692
- sourceCellKey?: string | null;
693
- sourceColumnId?: number | bigint | string | null;
694
- }
695
-
696
419
  export interface SheetGridRowObj {
697
420
  rowIndex: number;
698
421
  }
@@ -707,8 +430,7 @@ export interface SheetGridObj {
707
430
  viewport: SheetGridViewportObj;
708
431
  rows: SheetGridRowObj[];
709
432
  cells: SheetCellData[];
710
- ranges: SheetRangeData[];
711
- regions: SheetRegionData[];
433
+
712
434
  pageInfo: SheetGridPageInfoObj;
713
435
  }
714
436
 
@@ -752,16 +474,37 @@ export interface SheetAccessInfoGQL {
752
474
 
753
475
  export type SheetBootstrapMode = 'SNAPSHOT' | 'DELTA';
754
476
  export type SheetBootstrapStatus = 'DENIED' | 'READY' | 'RETRY' | 'UNAVAILABLE';
477
+ export type SheetReplicaSyncReason =
478
+ | 'FORMULA_DEPENDENCY'
479
+ | 'INITIAL'
480
+ | 'MANIFEST_REFRESH'
481
+ | 'PERSISTED_RESTORE'
482
+ | 'REALTIME_GAP'
483
+ | 'SELECTION';
484
+
485
+ export interface SheetReplicaSyncRequirement {
486
+ minimumCellsRevision?: SheetJournalSeqInput;
487
+ minimumDesignRevision?: SheetJournalSeqInput;
488
+ requireSnapshot?: boolean;
489
+ }
755
490
 
756
491
  export interface SheetTabSummaryGQL {
757
492
  id?: string | null;
758
493
  name?: string | null;
759
494
  position?: number | null;
495
+ hidden?: boolean | null;
760
496
  currentSeq?: SheetJournalSeq | null;
761
497
  referencedTabIds?: string[] | null;
762
498
  updatedAt?: string | null;
763
499
  }
764
500
 
501
+ /* Versioned workbook/tab catalog delivered by bootstrap and realtime. */
502
+ export interface SheetManifestGQL {
503
+ id: string;
504
+ manifestRevision: SheetJournalSeq;
505
+ tabs: SheetTabSummaryGQL[];
506
+ }
507
+
765
508
  export interface SheetBootstrapSnapshotGQL {
766
509
  seq?: SheetJournalSeq | null;
767
510
  encodingVersion?: number | null;
@@ -785,13 +528,15 @@ export interface SheetTabChangeGQL {
785
528
  createdAt?: string | null;
786
529
  }
787
530
 
788
- export interface SheetReferencedDataTableSchemaGQL {
789
- id?: string | null;
790
- realtimeToken?: string | null;
791
- name?: string | null;
792
- title?: string | null;
793
- design?: DataTableDesignGQL | null;
794
- updatedAt?: string | null;
531
+ export interface SheetRealtimeTabWatermark {
532
+ currentSeq: SheetJournalSeq;
533
+ designRevision: SheetJournalSeq;
534
+ sheetTabId: string;
535
+ }
536
+
537
+ export interface SheetRealtimeWatermarks {
538
+ manifestRevision: SheetJournalSeq;
539
+ tabs: SheetRealtimeTabWatermark[];
795
540
  }
796
541
 
797
542
  export interface SheetGQL {
@@ -807,6 +552,8 @@ export interface SheetGQL {
807
552
  editor?: SheetEditorGQL | null;
808
553
  access?: DocAccessBaseObj | null;
809
554
  deletedAt?: string | null;
555
+ /* Monotonic workbook/tab catalog revision serialized as BigInt text. */
556
+ manifestRevision?: SheetJournalSeq;
810
557
  tabs?: SheetTabGQL[];
811
558
  /* Mutation-only acknowledgement for an already-committed structure opId. */
812
559
  structureCommandReplayed?: boolean | null;
@@ -814,6 +561,16 @@ export interface SheetGQL {
814
561
  updatedAt?: string | null;
815
562
  }
816
563
 
564
+ export interface SheetTabMutationResultGQL {
565
+ changed: boolean;
566
+ commandId: string;
567
+ deletedSheetTabId?: string | null;
568
+ manifestRevision: SheetJournalSeq;
569
+ replayed: boolean;
570
+ tab?: SheetTabGQL | null;
571
+ tabs: SheetTabGQL[];
572
+ }
573
+
817
574
  export interface SheetTabGQL {
818
575
  __deleted?: boolean;
819
576
 
@@ -822,6 +579,7 @@ export interface SheetTabGQL {
822
579
  sheetId?: string | null;
823
580
  name?: string | null;
824
581
  position?: number | null;
582
+ hidden?: boolean | null;
825
583
  design?: SheetDesignGQL | null;
826
584
  /* BigInt is serialized as a canonical base-10 string. */
827
585
  cellsRevision?: SheetJournalSeq;
@@ -831,6 +589,19 @@ export interface SheetTabGQL {
831
589
  updatedAt?: string | null;
832
590
  }
833
591
 
592
+ /*
593
+ * Internal, token-authorized first-tab payload for a browser screenshot.
594
+ */
595
+ export interface OverallSheetPreviewCaptureObj {
596
+ sheetId: string;
597
+ sheetTabId: string;
598
+ revision: string;
599
+ timeZone: string | null;
600
+ sheetTab: SheetTabGQL;
601
+ cells: SheetCellGQL[];
602
+ viewport: SheetGridViewportObj;
603
+ }
604
+
834
605
  export interface SheetBootstrapGQL {
835
606
  access: SheetAccessInfoGQL;
836
607
  contractVersion: number;
@@ -845,7 +616,13 @@ export interface SheetBootstrapGQL {
845
616
  servedViewport?: SheetGridViewportObj | null;
846
617
  snapshot?: SheetBootstrapSnapshotGQL | null;
847
618
  changes?: SheetTabChangeGQL[] | null;
848
- referencedDataTables?: SheetReferencedDataTableSchemaGQL[] | null;
619
+ /*
620
+ * SNAPSHOT answers to a request with sinceSeq: the STRUCTURE rows (their op
621
+ * only) in (sinceSeq, snapshot.seq] the image absorbed; every such row when
622
+ * topologyComplete is true, none when false; both null otherwise.
623
+ */
624
+ topologyChanges?: SheetTabChangeGQL[] | null;
625
+ topologyComplete?: boolean | null;
849
626
  }
850
627
 
851
628
  export type SheetTabBootstrapGQL = Omit<SheetBootstrapGQL, 'sheet' | 'tabs'> & {
@@ -853,6 +630,14 @@ export type SheetTabBootstrapGQL = Omit<SheetBootstrapGQL, 'sheet' | 'tabs'> & {
853
630
  tabs?: never;
854
631
  };
855
632
 
633
+ /* Freshly signed capabilities from openSheet's authorization, without workbook data. */
634
+ export interface SheetRealtimeCapabilityGQL {
635
+ access: SheetAccessInfoGQL;
636
+ status: SheetBootstrapStatus;
637
+ unavailableReason?: string | null;
638
+ realtimeToken?: string | null;
639
+ }
640
+
856
641
  export interface SheetCellGQL {
857
642
  id?: string | null;
858
643
  organizationId?: string | null;
@@ -861,6 +646,8 @@ export interface SheetCellGQL {
861
646
  rowIndex?: number | null;
862
647
  columnIndex?: number | null;
863
648
  rawInput?: string | null;
649
+ literalType?: SheetCellLiteralType | null;
650
+
864
651
  formulaText?: string | null;
865
652
  compiledFormula?: SheetCompiledFormulaObj | null;
866
653
  value?: string | null;
@@ -879,12 +666,7 @@ export interface SheetCellGQL {
879
666
  style?: SheetCellStyleObj | null;
880
667
  format?: string | null;
881
668
  note?: string | null;
882
- sourceType?: SheetCellSourceTypeEnum | null;
883
- regionId?: string | null;
884
- sourceDataTableRowId?: string | null;
885
- sourceCellKey?: string | null;
886
- sourceMeta?: SheetCellSourceMetaObj | null;
887
- region?: SheetCellRegionSourceObj | null;
669
+
888
670
  createdAt?: string | null;
889
671
  updatedAt?: string | null;
890
672
  }
@@ -898,12 +680,16 @@ export type SheetAuthoritativeCellGQL = SheetCellGQL & {
898
680
  sheetTabId: string;
899
681
  };
900
682
 
683
+ /* Derived write-back item (computed fields only) delivered by cellsComputedDelta. */
684
+ export type SheetComputedCellGQL = SheetComputedCellPayload;
685
+
901
686
  export interface SheetGridRowGQL {
902
687
  rowIndex: number;
903
688
  }
904
689
 
905
690
  export interface SheetViewStructureOpGQL {
906
691
  at?: number | null;
692
+
907
693
  index: number;
908
694
  opId?: string | null;
909
695
  operation: string;
@@ -938,22 +724,23 @@ export interface SheetViewGQL {
938
724
  /* One-shot journal range on realtime patches. */
939
725
  fromSeq?: SheetJournalSeq | null;
940
726
  toSeq?: SheetJournalSeq | null;
727
+ /* Chunk metadata: every chunk of one packet shares fromSeq/toSeq (v3). */
728
+ chunkIndex?: number | null;
729
+ chunkCount?: number | null;
941
730
  originActorAccountId?: string | null;
731
+ /* The origin envelope's per-document clientId (v3); null for agents. */
942
732
  originClientId?: string | null;
943
- purgedRegionIds?: string[] | null;
944
- /* One-shot authoritative region membership patches delivered with command ACKs. */
945
- regionUpserts?: SheetAuthoritativeRegionGQL[] | null;
733
+
946
734
  requiresSnapshot?: boolean | null;
947
- /* One-shot authoritative settlement for a durable Sheet command. */
948
- commandAck?: SheetCommandAckGQL | null;
949
735
  /* One-shot authoritative settlement for a durable command envelope. */
950
736
  commandBatchAck?: SheetCommandBatchAckGQL | null;
951
737
  sheetTab?: SheetTabGQL | null;
952
738
  cells?: SheetAuthoritativeCellGQL[];
953
739
  cellsDelta?: SheetAuthoritativeCellGQL[] | null;
740
+ /* Derived cells converged by the server; apply after cellsDelta by coordinate + id. */
741
+ cellsComputedDelta?: SheetComputedCellGQL[] | null;
954
742
  deletedCellCoords?: SheetDeletedCellCoordGQL[] | null;
955
- ranges?: SheetRangeGQL[];
956
- regions?: SheetAuthoritativeRegionGQL[];
743
+
957
744
  structureOps?: SheetViewStructureOpGQL[] | null;
958
745
  pageInfo?: SheetGridPageInfoGQL | null;
959
746
  }
@@ -995,11 +782,13 @@ export interface SheetCommandResultGQL {
995
782
  axisMoveOps?: SheetAxisMoveDeltaGQL[] | null;
996
783
  tabRevisions: SheetCommandTabRevisionGQL[];
997
784
  affectedCells?: SheetAuthoritativeCellGQL[] | null;
998
- affectedRegions?: SheetAuthoritativeRegionGQL[] | null;
785
+
999
786
  affectedTabs?: SheetTabGQL[] | null;
1000
787
  deletedCellCoords?: SheetDeletedCellCoordGQL[] | null;
1001
788
  conflict?: SheetCommandConflictGQL | null;
1002
789
  requiresSnapshot?: boolean | null;
790
+ /* Whether the server kept an undo record for this command (contract v4). */
791
+ undoRecorded?: boolean | null;
1003
792
  }
1004
793
 
1005
794
  /* One authoritative item settlement returned by a Sheet command batch. */
@@ -1009,122 +798,50 @@ export interface SheetCommandBatchSettlementGQL {
1009
798
  result: SheetCommandResultGQL | null;
1010
799
  }
1011
800
 
1012
- /* Durable settlement for one command-owned realtime preview. */
1013
- export interface SheetCommandPreviewAuthorityGQL {
1014
- clientId: string;
1015
- envelopeId: string;
1016
- previewSeq: SheetJournalSeq;
1017
- serverSeq: SheetJournalSeq;
1018
- sheetTabId: string;
1019
- targetKeys: string[];
1020
- }
1021
-
1022
- /* Preview watermark committed by one durable Sheet command envelope. */
801
+ /*
802
+ * One command envelope's settlement carried by realtime and HTTP patches
803
+ * (wire contract v4). Peers retire outbox items and drafts whose ids appear
804
+ * in committedCommandIds or noWriteCommandIds.
805
+ */
1023
806
  export interface SheetCommandBatchAckGQL {
1024
807
  actorAccountId: string;
1025
808
  envelopeId: string;
1026
- previewAuthorities: SheetCommandPreviewAuthorityGQL[];
1027
- sourceClientId: string;
1028
- committedPreviewSeq: SheetJournalSeq;
809
+ /* The envelope's per-document client id; null for agent and script envelopes */
810
+ clientId: string | null;
811
+ /* Items the envelope committed or replayed (never CONFLICTED) */
812
+ committedCommandIds: string[];
813
+ /* Committed items whose every tab revision wrote no journal row (no-op writes) */
814
+ noWriteCommandIds: string[];
1029
815
  }
1030
816
 
1031
- /* Ordered settlements and final authority returned by one Sheet command batch. */
1032
- export interface SheetCommandBatchResultGQL extends SheetCommandBatchAckGQL {
817
+ /*
818
+ * Ordered settlements and final authority returned by one Sheet command
819
+ * envelope (wire contract v4). `replayed` marks the stored receipt of an
820
+ * envelope that had already committed.
821
+ */
822
+ export interface SheetCommandBatchResultGQL {
823
+ actorAccountId: string;
824
+ envelopeId: string;
825
+ clientId: string;
826
+ clientSeq: number;
827
+ replayed: boolean;
828
+ committedCommandIds: string[];
829
+ noWriteCommandIds: string[];
830
+ /* One settlement per command, in envelope order */
1033
831
  settlements: SheetCommandBatchSettlementGQL[];
1034
832
  authoritativePatches: SheetViewGQL[];
1035
833
  }
1036
834
 
1037
- /* Realtime settlement includes source session identity for exact reconciliation. */
1038
- export interface SheetCommandAckGQL
1039
- extends Omit<
1040
- SheetCommandResultGQL,
1041
- 'affectedCells' | 'affectedRegions' | 'affectedTabs' | 'deletedCellCoords'
1042
- > {
1043
- actorAccountId: string;
1044
- commandType: string;
1045
- sessionId: string;
1046
- }
1047
-
1048
- export interface SheetOperationalHistoryCommandGQL {
1049
- axisMove?: SheetAxisMoveCommandInput | null;
1050
- commandId: string;
1051
- commandType: string;
1052
- committedAt: string;
1053
- resultRevision: SheetJournalSeq;
1054
- resultDesignRevision: SheetJournalSeq;
1055
- }
1056
-
1057
- export interface SheetOperationalHistoryGQL {
1058
- incompleteBeforeBoundary: boolean;
1059
- redo: SheetOperationalHistoryCommandGQL[];
1060
- sessionId: string;
1061
- sheetId: string;
1062
- sheetTabId: string;
1063
- truncated: boolean;
1064
- undo: SheetOperationalHistoryCommandGQL[];
1065
- }
1066
-
1067
835
  export interface SheetGridPageInfoGQL {
1068
836
  hasMoreRows?: boolean | null;
1069
837
  lastContentRowIndex?: number | null;
1070
838
  }
1071
839
 
1072
- export interface SheetRangeGQL {
1073
- id?: string | null;
1074
- organizationId?: string | null;
1075
- sheetId?: string | null;
1076
- sheetTabId?: string | null;
1077
- startRowIndex?: number | null;
1078
- startColumnIndex?: number | null;
1079
- endRowIndex?: number | null;
1080
- endColumnIndex?: number | null;
1081
- position?: number | null;
1082
- style?: SheetCellStyleObj | null;
1083
- format?: string | null;
1084
- metadata?: string | null;
1085
- createdAt?: string | null;
1086
- updatedAt?: string | null;
1087
- }
1088
-
1089
- export interface SheetRegionBoundsGQL {
1090
- startRowIndex?: number | null;
1091
- startColumnIndex?: number | null;
1092
- endRowIndex?: number | null;
1093
- endColumnIndex?: number | null;
1094
- }
1095
-
1096
- export interface SheetRegionGQL {
1097
- id?: string | null;
1098
- organizationId?: string | null;
1099
- sheetId?: string | null;
1100
- sheetTabId?: string | null;
1101
- type?: SheetRegionTypeEnum | null;
1102
- startRowIndex?: number | null;
1103
- startColumnIndex?: number | null;
1104
- source?: SheetRegionSourceObj | null;
1105
- columns?: SheetRegionColumnObj[];
1106
- options?: SheetRegionOptionsObj | null;
1107
- effectiveBounds?: SheetRegionBoundsGQL | null;
1108
- active: boolean;
1109
- definitionRevision: string;
1110
- projectionRevision: string | null;
1111
- projectionStatus: SheetRegionProjectionStatusEnum;
1112
- syncRevision?: string | null;
1113
- createdAt?: string | null;
1114
- updatedAt?: string | null;
1115
- }
1116
-
1117
- /* Server-authored Sheet region payload with mandatory tab ownership. */
1118
- export type SheetAuthoritativeRegionGQL = SheetRegionGQL & {
1119
- sheetTabId: string;
1120
- };
1121
-
1122
840
  export interface SheetGridGQL {
1123
841
  id?: string | null;
1124
842
  viewport?: SheetGridViewportObj | null;
1125
843
  rows?: SheetGridRowGQL[];
1126
844
  cells?: SheetCellGQL[];
1127
- ranges?: SheetRangeGQL[];
1128
- regions?: SheetRegionGQL[];
845
+
1129
846
  pageInfo?: SheetGridPageInfoGQL | null;
1130
847
  }