@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
package/package.json CHANGED
@@ -1,105 +1,140 @@
1
1
  {
2
2
  "name": "@jsb188/mday",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "description": "Functions and constants for Marketday app only.",
5
5
  "license": "ISC",
6
6
  "author": "jsb188",
7
7
  "type": "module",
8
8
  "exports": {
9
- "./constants/agentDoc.ts": "./src/constants/agentDoc.ts",
9
+ "./constants/qrCode.ts": "./src/constants/qrCode.ts",
10
+ "./types/qrCode.d.ts": "./src/types/qrCode.d.ts",
11
+ "./utils/qrCode.ts": "./src/utils/qrCode.ts",
10
12
  "./constants/aiChat.ts": "./src/constants/aiChat.ts",
11
13
  "./constants/agentMemory.ts": "./src/constants/agentMemory.ts",
14
+ "./constants/agentNote.ts": "./src/constants/agentNote.ts",
12
15
  "./constants/log.ts": "./src/constants/log.ts",
13
16
  "./constants/logTaxonomy.generated.ts": "./src/constants/logTaxonomy.generated.ts",
14
17
  "./constants/email.ts": "./src/constants/email.ts",
15
18
  "./constants/organization.ts": "./src/constants/organization.ts",
16
19
  "./constants/pageRoute.ts": "./src/constants/pageRoute.ts",
17
20
  "./constants/dataTable.ts": "./src/constants/dataTable.ts",
21
+ "./constants/dt.ts": "./src/constants/dt.ts",
18
22
  "./constants/docAccess.ts": "./src/constants/docAccess.ts",
19
23
  "./constants/graphqlReactivity.ts": "./src/constants/graphqlReactivity.ts",
20
24
  "./constants/sheet.ts": "./src/constants/sheet.ts",
21
25
  "./constants/storage.ts": "./src/constants/storage.ts",
22
26
  "./constants/usage.ts": "./src/constants/usage.ts",
27
+ "./constants/billing.ts": "./src/constants/billing.ts",
23
28
  "./constants/campaign.ts": "./src/constants/campaign.ts",
29
+ "./constants/contact.ts": "./src/constants/contact.ts",
30
+ "./constants/csvExport.ts": "./src/constants/csvExport.ts",
31
+ "./types/emailReplyReport.d.ts": "./src/types/emailReplyReport.d.ts",
32
+ "./utils/emailReplyReport.ts": "./src/utils/emailReplyReport.ts",
24
33
  "./types/campaign.d.ts": "./src/types/campaign.d.ts",
34
+ "./types/contact.d.ts": "./src/types/contact.d.ts",
35
+ "./types/csvExport.d.ts": "./src/types/csvExport.d.ts",
25
36
  "./utils/aiChat.ts": "./src/utils/aiChat.ts",
37
+ "./utils/aiChatWork.ts": "./src/utils/aiChatWork.ts",
38
+ "./utils/billing.ts": "./src/utils/billing.ts",
26
39
  "./utils/campaign.ts": "./src/utils/campaign.ts",
40
+ "./utils/campaignAI.ts": "./src/utils/campaignAI.ts",
41
+ "./utils/campaignLifecycle.ts": "./src/utils/campaignLifecycle.ts",
42
+ "./utils/campaignEmail.ts": "./src/utils/campaignEmail.ts",
43
+ "./utils/campaignEmailCompiler.ts": "./src/utils/campaignEmailCompiler.ts",
44
+ "./utils/campaignEmailImages.ts": "./src/utils/campaignEmailImages.ts",
45
+ "./utils/campaignEmailStyles.ts": "./src/utils/campaignEmailStyles.ts",
46
+ "./utils/campaignPreview.ts": "./src/utils/campaignPreview.ts",
47
+ "./utils/campaignAccess.ts": "./src/utils/campaignAccess.ts",
48
+ "./utils/contact.ts": "./src/utils/contact.ts",
27
49
  "./constants/fieldDoc.ts": "./src/constants/fieldDoc.ts",
28
50
  "./constants/noteDoc.ts": "./src/constants/noteDoc.ts",
29
- "./constants/schedule.ts": "./src/constants/schedule.ts",
30
- "./constants/scheduleRuleTemplateSeed.ts": "./src/constants/scheduleRuleTemplateSeed.ts",
31
- "./constants/scheduleRuleTemplates.generated.ts": "./src/constants/scheduleRuleTemplates.generated.ts",
32
- "./types/agentDoc.d.ts": "./src/types/agentDoc.d.ts",
51
+ "./constants/sms.ts": "./src/constants/sms.ts",
33
52
  "./types/email.d.ts": "./src/types/email.d.ts",
34
53
  "./types/agentMemory.d.ts": "./src/types/agentMemory.d.ts",
54
+ "./types/agentNote.d.ts": "./src/types/agentNote.d.ts",
35
55
  "./types/inboundContact.d.ts": "./src/types/inboundContact.d.ts",
36
56
  "./types/storage.d.ts": "./src/types/storage.d.ts",
37
57
  "./types/usage.d.ts": "./src/types/usage.d.ts",
58
+ "./types/billing.d.ts": "./src/types/billing.d.ts",
38
59
  "./schemas/editLogEntry.ts": "./src/schemas/editLogEntry.ts",
39
60
  "./schemas/inboundContact.ts": "./src/schemas/inboundContact.ts",
40
61
  "./schemas/logsQuery.ts": "./src/schemas/logsQuery.ts",
41
- "./schemas/organization.ts": "./src/schemas/organization.ts",
42
62
  "./schemas/childOrganizationsQuery.ts": "./src/schemas/childOrganizationsQuery.ts",
43
- "./schemas/fieldDocsQuery.ts": "./src/schemas/fieldDocsQuery.ts",
44
63
  "./types/account.d.ts": "./src/types/account.d.ts",
45
64
  "./types/integration.d.ts": "./src/types/integration.d.ts",
46
65
  "./types/log.d.ts": "./src/types/log.d.ts",
47
66
  "./types/organization.d.ts": "./src/types/organization.d.ts",
48
67
  "./types/pageRoute.d.ts": "./src/types/pageRoute.d.ts",
49
68
  "./types/fieldDoc.d.ts": "./src/types/fieldDoc.d.ts",
69
+ "./types/fieldDocContract.d.ts": "./src/types/fieldDocContract.d.ts",
70
+ "./types/definitionElement.d.ts": "./src/types/definitionElement.d.ts",
50
71
  "./types/dataTable.d.ts": "./src/types/dataTable.d.ts",
72
+ "./types/dt.d.ts": "./src/types/dt.d.ts",
51
73
  "./types/docAccess.d.ts": "./src/types/docAccess.d.ts",
52
- "./types/noteDoc.d.ts": "./src/types/noteDoc.d.ts",
53
74
  "./types/sheet.d.ts": "./src/types/sheet.d.ts",
54
- "./types/schedule.d.ts": "./src/types/schedule.d.ts",
75
+ "./types/sms.d.ts": "./src/types/sms.d.ts",
55
76
  "./types/workflow.d.ts": "./src/types/workflow.d.ts",
56
- "./utils/agentDoc.ts": "./src/utils/agentDoc.ts",
77
+ "./utils/agentNote.ts": "./src/utils/agentNote.ts",
57
78
  "./utils/email.ts": "./src/utils/email.ts",
79
+ "./utils/logDisplay.ts": "./src/utils/logDisplay.ts",
80
+ "./types/logDisplay.types.ts": "./src/types/logDisplay.types.ts",
58
81
  "./utils/log.ts": "./src/utils/log.ts",
59
82
  "./utils/logTaxonomyDisplay.ts": "./src/utils/logTaxonomyDisplay.ts",
60
83
  "./utils/logRegistryValue.ts": "./src/utils/logRegistryValue.ts",
61
84
  "./utils/organization.ts": "./src/utils/organization.ts",
62
85
  "./utils/pageRoute.ts": "./src/utils/pageRoute.ts",
63
86
  "./utils/fieldDoc.ts": "./src/utils/fieldDoc.ts",
87
+ "./utils/fieldDocAnswers.ts": "./src/utils/fieldDocAnswers.ts",
88
+ "./utils/fieldDocSummary.ts": "./src/utils/fieldDocSummary.ts",
89
+ "./utils/fieldDocProgram.ts": "./src/utils/fieldDocProgram.ts",
90
+ "./utils/definitionElement.ts": "./src/utils/definitionElement.ts",
64
91
  "./utils/storage.ts": "./src/utils/storage.ts",
65
92
  "./utils/dataTable.ts": "./src/utils/dataTable.ts",
66
- "./utils/dataTableSource.ts": "./src/utils/dataTableSource.ts",
67
93
  "./utils/dataTableFieldTypeRegistry.ts": "./src/utils/dataTableFieldTypeRegistry.ts",
68
- "./utils/dataTableRealtimeSelection.ts": "./src/utils/dataTableRealtimeSelection.ts",
69
- "./utils/dataTableRealtimeAuthority.ts": "./src/utils/dataTableRealtimeAuthority.ts",
70
- "./utils/dataTableRowDocument.ts": "./src/utils/dataTableRowDocument.ts",
94
+ "./utils/dataTableRelativeDate.ts": "./src/utils/dataTableRelativeDate.ts",
71
95
  "./utils/docAccess.ts": "./src/utils/docAccess.ts",
72
96
  "./utils/documentName.ts": "./src/utils/documentName.ts",
73
97
  "./utils/noteDoc.ts": "./src/utils/noteDoc.ts",
74
- "./utils/schedule.ts": "./src/utils/schedule.ts",
75
- "./utils/scheduleEvaluation.ts": "./src/utils/scheduleEvaluation.ts",
76
- "./utils/scheduleICS.ts": "./src/utils/scheduleICS.ts",
77
- "./utils/scheduleRuleTemplates.ts": "./src/utils/scheduleRuleTemplates.ts",
98
+ "./utils/richTextHTML.ts": "./src/utils/richTextHTML.ts",
78
99
  "./utils/sheet.ts": "./src/utils/sheet.ts",
100
+ "./utils/sheetDesign.ts": "./src/utils/sheetDesign.ts",
101
+ "./utils/sheetFormulaCompile.ts": "./src/utils/sheetFormulaCompile.ts",
102
+ "./utils/sheetFormulaParser.ts": "./src/utils/sheetFormulaParser.ts",
103
+ "./utils/sheetFormulaSyntax.ts": "./src/utils/sheetFormulaSyntax.ts",
79
104
  "./utils/sheetAxisMove.ts": "./src/utils/sheetAxisMove.ts",
80
- "./utils/sheetRegion.ts": "./src/utils/sheetRegion.ts",
81
- "./utils/sheetRegionFilter.ts": "./src/utils/sheetRegionFilter.ts",
82
105
  "./utils/sheetCommand.ts": "./src/utils/sheetCommand.ts",
83
106
  "./utils/sheetBootstrap.ts": "./src/utils/sheetBootstrap.ts",
84
107
  "./utils/sheetJournal.ts": "./src/utils/sheetJournal.ts",
85
108
  "./utils/sheetSequence.ts": "./src/utils/sheetSequence.ts",
86
109
  "./utils/sheetSnapshot.ts": "./src/utils/sheetSnapshot.ts",
87
110
  "./utils/sheetStructureEdit.ts": "./src/utils/sheetStructureEdit.ts",
111
+ "./utils/sheetStructureReferences.ts": "./src/utils/sheetStructureReferences.ts",
88
112
  "./utils/sheetExport.ts": "./src/utils/sheetExport.ts",
89
113
  "./utils/sheetNumberFormat.ts": "./src/utils/sheetNumberFormat.ts",
90
114
  "./utils/sheetFormulaEvaluation.ts": "./src/utils/sheetFormulaEvaluation.ts",
91
115
  "./utils/sheetFormulaEvaluator.ts": "./src/utils/sheetFormulaEvaluator.ts",
116
+ "./utils/sheetFormulaRange.ts": "./src/utils/sheetFormulaRange.ts",
117
+ "./utils/sheetFormulaReference.ts": "./src/utils/sheetFormulaReference.ts",
118
+ "./utils/sheetFormulaReferenceRewrite.ts": "./src/utils/sheetFormulaReferenceRewrite.ts",
119
+ "./utils/sheetFeatureReference.ts": "./src/utils/sheetFeatureReference.ts",
92
120
  "./utils/table-route.ts": "./src/utils/table-route.ts",
121
+ "./utils/time.ts": "./src/utils/time.ts",
93
122
  "./utils/square.ts": "./src/utils/square.ts",
94
123
  "./utils/workflow.ts": "./src/utils/workflow.ts",
95
- "./utils/campaignFormEditor.ts": "./src/utils/campaignFormEditor.ts"
124
+ "./utils/workflowTriggers.ts": "./src/utils/workflowTriggers.ts",
125
+ "./utils/workflowLogFingerprint.ts": "./src/utils/workflowLogFingerprint.ts",
126
+ "./utils/workflowLogRevisionSnapshot.ts": "./src/utils/workflowLogRevisionSnapshot.ts",
127
+ "./utils/workflowProgress.ts": "./src/utils/workflowProgress.ts",
128
+ "./types/richText.d.ts": "./src/types/richText.d.ts",
129
+ "./utils/sheetCellLiteral.ts": "./src/utils/sheetCellLiteral.ts"
96
130
  },
97
131
  "dependencies": {
98
132
  "luxon": "^3.7.2",
133
+ "parse5": "^8.0.1",
99
134
  "zod": "^3.25.76"
100
135
  },
101
136
  "peerDependencies": {
102
- "@jsb188/app": "1.1.11"
137
+ "@jsb188/app": "1.1.12"
103
138
  },
104
139
  "scripts": {
105
140
  "test": "vitest run --config ./vitest.config.ts --passWithNoTests"
@@ -6,24 +6,14 @@
6
6
  * COUNTERPARTY - one customer, anchored on counterparties.id
7
7
  */
8
8
 
9
- export const AGENT_MEMORY_SCOPE_ENUMS = [
10
- 'ORGANIZATION',
11
- 'ACCOUNT',
12
- 'COUNTERPARTY',
13
- ] as const;
9
+ export const AGENT_MEMORY_SCOPE_ENUMS = ['ORGANIZATION', 'ACCOUNT', 'COUNTERPARTY'] as const;
14
10
 
15
11
  /**
16
12
  * Agent memory; what kind of fact this is. Used for grouping in the UI and for
17
13
  * ordering the injected block. Deliberately not rendered into the prompt.
18
14
  */
19
15
 
20
- export const AGENT_MEMORY_CATEGORY_ENUMS = [
21
- 'UNIT',
22
- 'PRODUCT',
23
- 'PROCEDURE',
24
- 'PREFERENCE',
25
- 'OTHER',
26
- ] as const;
16
+ export const AGENT_MEMORY_CATEGORY_ENUMS = ['UNIT', 'PRODUCT', 'PROCEDURE', 'PREFERENCE', 'OTHER'] as const;
27
17
 
28
18
  /**
29
19
  * Agent memory; injection gate. This is an inference gate, NOT an approval:
@@ -37,11 +27,7 @@ export const AGENT_MEMORY_STATUS_ENUMS = ['PROPOSED', 'ACTIVE'] as const;
37
27
  * Agent memory; how the row came to exist.
38
28
  */
39
29
 
40
- export const AGENT_MEMORY_CREATED_VIA_ENUMS = [
41
- 'USER_EDIT',
42
- 'AGENT_TOOL',
43
- 'AGENT_EXTRACTOR',
44
- ] as const;
30
+ export const AGENT_MEMORY_CREATED_VIA_ENUMS = ['USER_EDIT', 'AGENT_TOOL', 'AGENT_EXTRACTOR'] as const;
45
31
 
46
32
  /**
47
33
  * Agent memory; which agent surface a memory applies to. NULL/empty means
@@ -49,26 +35,7 @@ export const AGENT_MEMORY_CREATED_VIA_ENUMS = [
49
35
  * explicit and already carry everything they need.
50
36
  */
51
37
 
52
- export const AGENT_MEMORY_SURFACE_ENUMS = [
53
- 'CHAT',
54
- 'EMAIL',
55
- 'WORKFLOW',
56
- ] as const;
57
-
58
- /**
59
- * Agent memory; valid "surfaceKey" values for the EMAIL surface.
60
- *
61
- * These are inbox KINDS, not subdomains. Several domains map to one inbox
62
- * (general/info/inquiry all resolve to GENERAL_INQUIRY in DOMAIN_TO_INBOX), so
63
- * keying memory on the raw subdomain would split one inbox's memory across its
64
- * aliases. NULL "surfaceKey" applies to every inbox.
65
- */
66
-
67
- export const AGENT_MEMORY_EMAIL_SURFACE_KEYS = [
68
- 'ASSISTANT',
69
- 'GENERAL_INQUIRY',
70
- 'ORDERS',
71
- ] as const;
38
+ export const AGENT_MEMORY_SURFACE_ENUMS = ['CHAT', 'EMAIL', 'WORKFLOW'] as const;
72
39
 
73
40
  /**
74
41
  * Agent memory; hard limits.
@@ -90,8 +57,8 @@ export const AGENT_MEMORY_LIMITS = {
90
57
  accountCap: 10,
91
58
  counterpartyCap: 10,
92
59
  maxCounterpartiesPerTurn: 3,
93
- // Permanent rows bypass organizationCap; this is the absolute ceiling that
94
- // still applies, so a runaway org cannot flood every prompt unbounded.
60
+ // Permanent rows bypass per-scope soft caps; this is the shared absolute
61
+ // ceiling across every applicable subject in one prompt.
95
62
  permanentHardCeiling: 60,
96
63
  // A fact seen twice is a pattern, not a one-off.
97
64
  promoteAtObservedCount: 2,
@@ -120,12 +87,14 @@ export const AGENT_MEMORY_LIMITS = {
120
87
  * "current activity" pointer weeks into the future.
121
88
  */
122
89
 
123
- export const AGENT_MEMORY_TEMPORARY_EXPIRY_ENUMS = [
124
- 'END_OF_DAY',
125
- '1_DAY',
126
- '3_DAYS',
127
- '7_DAYS',
128
- ] as const;
90
+ export const AGENT_MEMORY_TEMPORARY_EXPIRY_ENUMS = ['END_OF_DAY', '1_DAY', '3_DAYS', '7_DAYS'] as const;
91
+
92
+ /**
93
+ * Agent memory; canonical working-state slots shared by foreground tools,
94
+ * background extraction, and post-log session updates.
95
+ */
96
+
97
+ export const AGENT_MEMORY_TEMPORARY_TOPIC_ENUMS = ['CURRENT_SITE', 'CURRENT_FIELD_DOC', 'CURRENT_CUSTOMER', 'CURRENT_TASK'] as const;
129
98
 
130
99
  /**
131
100
  * Agent memory; how long to wait before extracting memories from a settled
@@ -0,0 +1,212 @@
1
+ /**
2
+ * Agent note; what one note summarizes. The three default kinds each have
3
+ * exactly one anchor (a web form campaign, an email campaign or a field
4
+ * doc). INSIGHT notes are trackers created only when a person asks for one,
5
+ * and have no anchor.
6
+ */
7
+
8
+ export const AGENT_NOTE_KIND_ENUMS = ['CAMPAIGN_FORM', 'CAMPAIGN_EMAIL', 'FIELD_DOC', 'INSIGHT', 'REMINDER'] as const;
9
+
10
+ /**
11
+ * Agent note; entity types a note can link to. A "watch" link makes a change
12
+ * to that entity refresh the note; an "owned" link marks an entity created for
13
+ * the note (a tracker ledger table or its managed workflow).
14
+ */
15
+
16
+ export const AGENT_NOTE_LINK_ENTITY_TYPE_ENUMS = [
17
+ 'CAMPAIGN',
18
+ 'FIELD_DOC',
19
+ 'DATA_TABLE',
20
+ 'SHEET',
21
+ 'WORKFLOW',
22
+ 'CHILD_ORG',
23
+ 'LOG_ACTIVITY',
24
+ 'LOG_ACTIVITY_GROUP',
25
+ ] as const;
26
+
27
+ /**
28
+ * Agent note; why the markdown sanitizer changed a body. Listed in the fixed
29
+ * order the sanitizer reports them, so the same input always yields the same
30
+ * issue list.
31
+ */
32
+
33
+ export const AGENT_NOTE_MARKDOWN_ISSUE_ENUMS = [
34
+ 'HTML_REMOVED',
35
+ 'LINK_REMOVED',
36
+ 'IMAGE_REMOVED',
37
+ 'CODE_REMOVED',
38
+ 'HEADING_FLATTENED',
39
+ 'BLOCK_FLATTENED',
40
+ 'STYLE_REMOVED',
41
+ 'TABLE_REMOVED',
42
+ 'TABLE_COLUMNS_TRUNCATED',
43
+ 'TABLE_ROWS_TRUNCATED',
44
+ 'TABLE_ROW_WIDTH_FIXED',
45
+ 'TABLE_CELL_TRUNCATED',
46
+ 'BODY_TRUNCATED',
47
+ ] as const;
48
+
49
+ /**
50
+ * Agent note; hard limits. Lengths are in characters.
51
+ *
52
+ * The body is a short summary (1-3 sentences) plus optional markdown tables,
53
+ * so table caps keep a note readable as a card. Table rows exclude the header.
54
+ * "indexCap" is how many active notes the prompt index lists.
55
+ * "researchMaxCharacters" is the refresh's conversation-research budget: what
56
+ * the research may read and keep, separate from the evidence pack's own budget.
57
+ */
58
+
59
+ export const AGENT_NOTE_LIMITS = {
60
+ emojiMaxLength: 8,
61
+ titleMaxLength: 255,
62
+ headlineMaxLength: 120,
63
+ headlineStorageMaxLength: 160,
64
+ bodyMaxLength: 6000,
65
+ focusMaxLength: 1000,
66
+ archiveReasonMaxLength: 255,
67
+ refreshErrorMaxLength: 1000,
68
+ tableMaxCount: 3,
69
+ tableMaxRows: 25,
70
+ tableMaxColumns: 14,
71
+ tableCellMaxLength: 120,
72
+ indexCap: 10,
73
+ researchMaxCharacters: 10000,
74
+ } as const;
75
+
76
+ /* Server-calculated reports retain complete rows and columns independently of the AI summary's card limits. */
77
+ export const AGENT_NOTE_CALCULATION_LIMITS = {
78
+ questions: 31,
79
+ rows: 500,
80
+ cellLength: 1000,
81
+ bodyLength: 100000,
82
+ } as const;
83
+
84
+ /**
85
+ * Agent note; lifecycle thresholds.
86
+ *
87
+ * A note is archived once its newest activity (data change, read, retention
88
+ * or focus change) is "cleanupDays" old ("insightCleanupDays" for INSIGHT
89
+ * notes), or "attentionCleanupDays" if that is longer while the note needs
90
+ * attention. An INSIGHT note whose managed workflow is active and can still
91
+ * fire is never archived for inactivity. The daily retention review asks
92
+ * about notes within "retentionLeadDays" of that cutoff and keeps a note
93
+ * visible when the predicate probability reaches "retentionProbability". A
94
+ * default note archived for inactivity (or for never publishing) returns
95
+ * when its source shows new activity; an INSIGHT (tracker) note stays
96
+ * archived, with its workflows, refreshes and model calls paused, until a
97
+ * person or the assistant unarchives it.
98
+ */
99
+
100
+ export const AGENT_NOTE_LIFECYCLE = {
101
+ cleanupDays: 14,
102
+ insightCleanupDays: 60,
103
+ attentionCleanupDays: 30,
104
+ retentionLeadDays: 7,
105
+ retentionProbability: 0.7,
106
+ retentionMaxQuestionsPerRequest: 25,
107
+ // Consecutive failed refreshes after which only the daily retry tries the note again
108
+ refreshFailureBudget: 5,
109
+ } as const;
110
+
111
+ /**
112
+ * Agent note; refresh timing. A change schedules a refresh "debounceMS" after
113
+ * the latest change, but never later than "maxWaitMS" after the first unserved
114
+ * change. The hourly sweep re-queues notes whose data changed more than
115
+ * "sweepStaleAfterMS" ago without a refresh.
116
+ */
117
+
118
+ export const AGENT_NOTE_REFRESH_TIMING = {
119
+ manualCooldownMS: 15 * 60 * 1000,
120
+ debounceMS: 12 * 60 * 1000,
121
+ maxWaitMS: 25 * 60 * 1000,
122
+ sweepStaleAfterMS: 30 * 60 * 1000,
123
+ // A never-published note waiting for a backfilling table or pending AI columns is checked again after this
124
+ preparingRecheckMS: 2 * 60 * 1000,
125
+ } as const;
126
+
127
+ /**
128
+ * Agent note; why an archived note was archived ("archiveSource"). Only
129
+ * INACTIVE and UNPUBLISHED archives of default kinds may restore themselves
130
+ * when their source shows new activity; a person, an agent, a merge, the
131
+ * anchor or a campaign delete keeps the note archived until someone restores it.
132
+ */
133
+
134
+ export const AGENT_NOTE_ARCHIVE_SOURCE_ENUMS = [
135
+ 'PERSON',
136
+ 'AGENT',
137
+ 'INACTIVE',
138
+ 'ANCHOR',
139
+ 'MERGED',
140
+ 'UNPUBLISHED',
141
+ 'CAMPAIGN_DELETED',
142
+ ] as const;
143
+
144
+ /**
145
+ * Agent note; who last set "needsAttention". The refresh model owns the flag
146
+ * unless a person set it.
147
+ */
148
+
149
+ export const AGENT_NOTE_ATTENTION_SET_BY_ENUMS = ['MODEL', 'PERSON'] as const;
150
+
151
+ /**
152
+ * Agent note; progress history event types (agent_note_events) and who caused
153
+ * each event.
154
+ */
155
+
156
+ export const AGENT_NOTE_EVENT_TYPE_ENUMS = ['PUBLISHED', 'FAILED', 'ARCHIVED', 'RESTORED', 'MERGED', 'FOCUS_CHANGED'] as const;
157
+
158
+ export const AGENT_NOTE_EVENT_ACTOR_TYPE_ENUMS = ['SYSTEM', 'MODEL', 'PERSON', 'AGENT'] as const;
159
+
160
+ /**
161
+ * Agent note; whether a note has a published body to show: READY (it has
162
+ * one), PREPARING (no body yet, still trying), FAILED (no body after the
163
+ * failure budget) or UNSUPPORTED (its evidence cannot be read).
164
+ */
165
+
166
+ export const AGENT_NOTE_PUBLISH_STATE_ENUMS = ['READY', 'PREPARING', 'FAILED', 'UNSUPPORTED'] as const;
167
+
168
+ /**
169
+ * Agent note; source scopes a note reads beyond its own anchor
170
+ * (agent_note_dependencies), so a change in any of them refreshes the note.
171
+ */
172
+
173
+ export const AGENT_NOTE_DEPENDENCY_SCOPE_TYPE_ENUMS = [
174
+ 'CAMPAIGN',
175
+ 'CAMPAIGN_TEMPLATE',
176
+ 'FIELD_DOC',
177
+ 'WORKFLOW',
178
+ 'CONVERSATION',
179
+ 'ORGANIZATION_MEMORY',
180
+ ] as const;
181
+
182
+ /**
183
+ * Agent note; effective priority, computed at read time:
184
+ * pinned × "pinnedBoost" + needsAttention × "attentionBoost" + importance
185
+ * (the refresh model's 0-100 value, "defaultImportance" when unset), minus
186
+ * "decayPerDay" for each day since the note was last published or its data
187
+ * changed, at most "maxDecay". About "attentionSoftTarget" notes per
188
+ * organization should need attention at a time; the daily pass demotes the
189
+ * lowest-priority model-set flags above "attentionDemoteAbove".
190
+ */
191
+
192
+ export const AGENT_NOTE_PRIORITY = {
193
+ pinnedBoost: 1000,
194
+ attentionBoost: 40,
195
+ defaultImportance: 50,
196
+ decayPerDay: 4,
197
+ maxDecay: 60,
198
+ attentionSoftTarget: 5,
199
+ attentionDemoteAbove: 8,
200
+ } as const;
201
+
202
+ /**
203
+ * Agent note; progress history sizes. Each note keeps its newest
204
+ * "keepPerNote" events; the refresh prompt sees "promptHistory" and the
205
+ * assistant's note read "toolHistory".
206
+ */
207
+
208
+ export const AGENT_NOTE_EVENT_LIMITS = {
209
+ keepPerNote: 30,
210
+ promptHistory: 5,
211
+ toolHistory: 10,
212
+ } as const;
@@ -3,3 +3,8 @@
3
3
  */
4
4
 
5
5
  export const AI_CHAT_SUMMARY_MAX_LENGTH = 80;
6
+
7
+ /*
8
+ * Optional chat categories; null identifies an ordinary AI chat.
9
+ */
10
+ export const AI_CHAT_TYPE_ENUMS = ['ORCHESTRATOR'] as const;
@@ -0,0 +1,126 @@
1
+ /*
2
+ * Subscription plans. Plan identity always comes from the Stripe Product
3
+ * (metadata.nebulaPlanKey), never from a price id.
4
+ */
5
+ export const BILLING_PLAN_KEYS = ['BASIC', 'BUSINESS', 'ENTERPRISE'] as const;
6
+
7
+ /*
8
+ * Plans that can be purchased self-serve; Enterprise is always "contact us".
9
+ */
10
+ export const BILLING_SELF_SERVE_PLAN_KEYS = ['BASIC', 'BUSINESS'] as const;
11
+
12
+ /*
13
+ * Billing intervals offered for self-serve plan prices.
14
+ */
15
+ export const BILLING_INTERVALS = ['MONTH', 'YEAR'] as const;
16
+
17
+ /*
18
+ * Every Stripe recurring interval, uppercased, as stored on billing mirrors.
19
+ */
20
+ export const BILLING_STRIPE_INTERVALS = [
21
+ 'DAY',
22
+ 'WEEK',
23
+ 'MONTH',
24
+ 'YEAR',
25
+ ] as const;
26
+
27
+ /*
28
+ * Whether an organization's access is locked when its paid period lapses.
29
+ */
30
+ export const BILLING_ENFORCEMENT_ENUMS = ['ENFORCED', 'EXEMPT'] as const;
31
+
32
+ /*
33
+ * How a staff-recorded renewal outside Stripe was paid.
34
+ */
35
+ export const BILLING_MANUAL_GRANT_METHODS = [
36
+ 'CHECK',
37
+ 'WIRE',
38
+ 'ACH_TRANSFER',
39
+ 'CASH',
40
+ 'COMPED',
41
+ 'OTHER',
42
+ ] as const;
43
+
44
+ /*
45
+ * Processing states of a recorded Stripe webhook event.
46
+ */
47
+ export const BILLING_STRIPE_EVENT_STATUSES = [
48
+ 'RECEIVED',
49
+ 'PROCESSED',
50
+ 'IGNORED',
51
+ 'FAILED',
52
+ ] as const;
53
+
54
+ /*
55
+ * States of one self-serve purchase attempt.
56
+ */
57
+ export const BILLING_PURCHASE_ATTEMPT_STATUSES = [
58
+ 'PENDING',
59
+ 'SUBSCRIPTION_CREATED',
60
+ 'FAILED',
61
+ ] as const;
62
+
63
+ /*
64
+ * Channels that can receive a throttled "subscription expired" notice.
65
+ */
66
+ export const BILLING_ACCESS_NOTICE_CHANNELS = ['SMS'] as const;
67
+
68
+ /*
69
+ * Stripe intent the client confirms after starting a subscription.
70
+ */
71
+ export const BILLING_INTENT_TYPES = ['PAYMENT', 'SETUP'] as const;
72
+
73
+ /*
74
+ * Days of access kept after the paid-through date before the lock applies.
75
+ */
76
+ export const BILLING_GRACE_DAYS_DEFAULT = 14;
77
+
78
+ /*
79
+ * Minimum minutes between two lapse notices to one organization + recipient.
80
+ */
81
+ export const BILLING_ACCESS_NOTICE_INTERVAL_MINUTES = 10;
82
+
83
+ /*
84
+ * Stripe payment method types accepted for subscriptions (ACH uses instant
85
+ * verification only).
86
+ */
87
+ export const BILLING_PAYMENT_METHOD_TYPES = [
88
+ 'card',
89
+ 'us_bank_account',
90
+ ] as const;
91
+
92
+ /*
93
+ * Stripe subscription statuses that mean "the org has a live subscription".
94
+ */
95
+ export const BILLING_LIVE_SUBSCRIPTION_STATUSES = [
96
+ 'active',
97
+ 'trialing',
98
+ 'past_due',
99
+ 'unpaid',
100
+ ] as const;
101
+
102
+ /*
103
+ * Price lookup keys for the public (self-serve) prices.
104
+ */
105
+ export const BILLING_PRICE_LOOKUP_KEYS = {
106
+ BASIC: { MONTH: 'basic_monthly', YEAR: 'basic_yearly' },
107
+ BUSINESS: { MONTH: 'business_monthly', YEAR: 'business_yearly' },
108
+ } as const;
109
+
110
+ /*
111
+ * Stripe metadata keys written on our Stripe objects (and set by staff in the
112
+ * Dashboard).
113
+ */
114
+ export const BILLING_STRIPE_METADATA_KEYS = {
115
+ // DB organizations.id as a decimal string
116
+ organizationId: 'nebulaOrganizationId',
117
+ // On Products: BASIC | BUSINESS | ENTERPRISE
118
+ planKey: 'nebulaPlanKey',
119
+ // Always BILLING_STRIPE_METADATA_APP
120
+ app: 'nebulaApp',
121
+ } as const;
122
+
123
+ /*
124
+ * Value of the nebulaApp metadata key on every Stripe object we create.
125
+ */
126
+ export const BILLING_STRIPE_METADATA_APP = 'nebula';