@jsb188/mday 1.1.10 → 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 +140 -54
  2. package/src/constants/agentMemory.ts +123 -0
  3. package/src/constants/agentNote.ts +212 -0
  4. package/src/constants/aiChat.ts +10 -0
  5. package/src/constants/billing.ts +126 -0
  6. package/src/constants/campaign.ts +236 -0
  7. package/src/constants/contact.ts +72 -0
  8. package/src/constants/csvExport.ts +133 -0
  9. package/src/constants/dataTable.ts +21 -21
  10. package/src/constants/dataTableFieldTypes.generated.ts +59 -0
  11. package/src/constants/docAccess.ts +33 -0
  12. package/src/constants/dt.ts +234 -0
  13. package/src/constants/email.ts +125 -7
  14. package/src/constants/fieldDoc.ts +104 -0
  15. package/src/constants/graphqlReactivity.ts +196 -0
  16. package/src/constants/integration.ts +8 -9
  17. package/src/constants/log.ts +14 -408
  18. package/src/constants/logDisplay/README.md +88 -0
  19. package/src/constants/logDisplay/defaults.ts +39 -0
  20. package/src/constants/logDisplay/index.ts +27 -0
  21. package/src/constants/logDisplay/operations/arable.ts +16 -0
  22. package/src/constants/logDisplay/operations/farmersMarket.ts +10 -0
  23. package/src/constants/logDisplay/operations/foodManufacturing.ts +13 -0
  24. package/src/constants/logDisplay/shared/accounting.ts +13 -0
  25. package/src/constants/logDisplay/shared/interactions.ts +13 -0
  26. package/src/constants/logDisplay/shared/rackTemperatures.ts +42 -0
  27. package/src/constants/logTaxonomy.generated.ts +2207 -0
  28. package/src/constants/noteDoc.ts +77 -0
  29. package/src/constants/organization.ts +18 -21
  30. package/src/constants/pageRoute.ts +23 -0
  31. package/src/constants/qrCode.ts +30 -0
  32. package/src/constants/sheet.ts +126 -14
  33. package/src/constants/sms.ts +18 -0
  34. package/src/constants/square.ts +6 -6
  35. package/src/constants/storage.ts +80 -7
  36. package/src/constants/usage.ts +82 -0
  37. package/src/constants/workflowSteps.ts +60 -0
  38. package/src/schemas/editLogEntry.ts +836 -780
  39. package/src/schemas/inboundContact.ts +60 -55
  40. package/src/schemas/logsQuery.ts +55 -49
  41. package/src/types/account.d.ts +4 -1
  42. package/src/types/agentMemory.d.ts +98 -0
  43. package/src/types/agentNote.d.ts +443 -0
  44. package/src/types/billing.d.ts +537 -0
  45. package/src/types/campaign.d.ts +1533 -0
  46. package/src/types/contact.d.ts +15 -0
  47. package/src/types/csvExport.d.ts +213 -0
  48. package/src/types/dataAnalysis.d.ts +44 -0
  49. package/src/types/dataTable.d.ts +115 -403
  50. package/src/types/definitionElement.d.ts +35 -0
  51. package/src/types/docAccess.d.ts +96 -0
  52. package/src/types/dt.d.ts +257 -0
  53. package/src/types/email.d.ts +184 -24
  54. package/src/types/emailReplyReport.d.ts +76 -0
  55. package/src/types/fieldDoc.d.ts +702 -0
  56. package/src/types/fieldDocContract.d.ts +90 -0
  57. package/src/types/inboundContact.d.ts +10 -1
  58. package/src/types/log.d.ts +254 -295
  59. package/src/types/logDisplay.types.ts +85 -0
  60. package/src/types/organization.d.ts +91 -43
  61. package/src/types/pageRoute.d.ts +48 -0
  62. package/src/types/qrCode.d.ts +96 -0
  63. package/src/types/richText.d.ts +81 -0
  64. package/src/types/sheet.d.ts +678 -129
  65. package/src/types/sms.d.ts +38 -0
  66. package/src/types/storage.d.ts +449 -129
  67. package/src/types/usage.d.ts +106 -0
  68. package/src/types/workflow.d.ts +315 -54
  69. package/src/utils/agentMemory.ts +15 -0
  70. package/src/utils/agentNote.ts +850 -0
  71. package/src/utils/aiChat.ts +43 -0
  72. package/src/utils/aiChatWork.ts +64 -0
  73. package/src/utils/billing.ts +37 -0
  74. package/src/utils/campaign.ts +1174 -0
  75. package/src/utils/campaignAI.ts +72 -0
  76. package/src/utils/campaignAccess.ts +239 -0
  77. package/src/utils/campaignEmail.ts +601 -0
  78. package/src/utils/campaignEmailCompiler.ts +372 -0
  79. package/src/utils/campaignEmailImages.ts +60 -0
  80. package/src/utils/campaignEmailStyles.ts +544 -0
  81. package/src/utils/campaignLifecycle.ts +104 -0
  82. package/src/utils/campaignPreview.ts +285 -0
  83. package/src/utils/contact.ts +50 -0
  84. package/src/utils/csvExport.ts +19 -0
  85. package/src/utils/dataTable.ts +95 -618
  86. package/src/utils/dataTableFieldTypeRegistry.ts +106 -0
  87. package/src/utils/dataTableRelativeDate.ts +447 -0
  88. package/src/utils/definitionElement.ts +84 -0
  89. package/src/utils/docAccess.ts +383 -0
  90. package/src/utils/documentName.ts +53 -0
  91. package/src/utils/email.ts +317 -51
  92. package/src/utils/emailReplyReport.test.ts +187 -0
  93. package/src/utils/emailReplyReport.ts +143 -0
  94. package/src/utils/fieldDoc.ts +157 -0
  95. package/src/utils/fieldDocAnswers.ts +128 -0
  96. package/src/utils/fieldDocDefaults.ts +36 -0
  97. package/src/utils/fieldDocProgram.ts +36 -0
  98. package/src/utils/fieldDocSummary.ts +30 -0
  99. package/src/utils/log.ts +276 -192
  100. package/src/utils/logDisplay.helpers.ts +177 -0
  101. package/src/utils/logDisplay.ts +87 -0
  102. package/src/utils/logRegistryValue.ts +90 -0
  103. package/src/utils/logStoreRead.ts +262 -0
  104. package/src/utils/logTaxonomy.helpers.ts +17 -0
  105. package/src/utils/logTaxonomy.ts +76 -0
  106. package/src/utils/logTaxonomyDisplay.ts +395 -0
  107. package/src/utils/noteDoc.ts +609 -0
  108. package/src/utils/organization.ts +337 -84
  109. package/src/utils/pageRoute.ts +71 -0
  110. package/src/utils/qrCode.helpers.ts +189 -0
  111. package/src/utils/qrCode.test.ts +519 -0
  112. package/src/utils/qrCode.ts +273 -0
  113. package/src/utils/richTextHTML.ts +385 -0
  114. package/src/utils/sheet.ts +199 -107
  115. package/src/utils/sheetAxisMove.ts +616 -0
  116. package/src/utils/sheetBootstrap.ts +1402 -0
  117. package/src/utils/sheetCellLiteral.ts +101 -0
  118. package/src/utils/sheetCommand.ts +358 -0
  119. package/src/utils/sheetDesign.ts +705 -0
  120. package/src/utils/sheetExport.ts +186 -0
  121. package/src/utils/sheetFeatureReference.ts +183 -0
  122. package/src/utils/sheetFormulaArgs.ts +168 -0
  123. package/src/utils/sheetFormulaCompile.ts +475 -0
  124. package/src/utils/sheetFormulaConditionalAggregate.ts +254 -0
  125. package/src/utils/sheetFormulaCriteria.ts +656 -0
  126. package/src/utils/sheetFormulaDate.ts +444 -0
  127. package/src/utils/sheetFormulaEvaluation.ts +899 -0
  128. package/src/utils/sheetFormulaEvaluator.ts +997 -0
  129. package/src/utils/sheetFormulaFunctionHandlers.ts +403 -0
  130. package/src/utils/sheetFormulaLogical.ts +116 -0
  131. package/src/utils/sheetFormulaLookup.ts +488 -0
  132. package/src/utils/sheetFormulaMath.ts +48 -0
  133. package/src/utils/sheetFormulaParser.ts +729 -0
  134. package/src/utils/sheetFormulaRange.ts +330 -0
  135. package/src/utils/sheetFormulaReference.ts +703 -0
  136. package/src/utils/sheetFormulaReferenceAggregates.ts +313 -0
  137. package/src/utils/sheetFormulaReferenceDates.ts +237 -0
  138. package/src/utils/sheetFormulaReferenceLogical.ts +330 -0
  139. package/src/utils/sheetFormulaReferenceLookup.ts +341 -0
  140. package/src/utils/sheetFormulaReferenceMath.ts +95 -0
  141. package/src/utils/sheetFormulaReferenceRewrite.ts +220 -0
  142. package/src/utils/sheetFormulaReferenceText.ts +462 -0
  143. package/src/utils/sheetFormulaSyntax.ts +1027 -0
  144. package/src/utils/sheetFormulaText.ts +430 -0
  145. package/src/utils/sheetJournal.ts +200 -0
  146. package/src/utils/sheetNumberFormat.ts +1012 -0
  147. package/src/utils/sheetPreview.ts +68 -0
  148. package/src/utils/sheetSequence.ts +118 -0
  149. package/src/utils/sheetSnapshot.ts +739 -0
  150. package/src/utils/sheetStructureEdit.ts +914 -0
  151. package/src/utils/sheetStructureReferences.ts +389 -0
  152. package/src/utils/square.ts +22 -12
  153. package/src/utils/storage.ts +198 -0
  154. package/src/utils/table-route.ts +127 -11
  155. package/src/utils/time.ts +12 -0
  156. package/src/utils/workflow.ts +334 -40
  157. package/src/utils/workflowLogFingerprint.ts +302 -0
  158. package/src/utils/workflowLogRevisionSnapshot.ts +424 -0
  159. package/src/utils/workflowProgress.ts +280 -0
  160. package/src/utils/workflowTriggers.ts +61 -0
  161. package/tests/agentNote.test.ts +395 -0
  162. package/tests/campaignAI.test.ts +119 -0
  163. package/tests/campaignAccess.test.ts +239 -0
  164. package/tests/campaignEmail.test.ts +441 -0
  165. package/tests/campaignLifecycle.test.ts +134 -0
  166. package/tests/campaignPublication.test.ts +309 -0
  167. package/tests/dataTableFieldTypeRegistry.test.ts +111 -0
  168. package/tests/dataTableRelativeDate.test.ts +412 -0
  169. package/tests/docAccess.test.ts +525 -0
  170. package/tests/editLogEntry.test.ts +112 -0
  171. package/tests/email.test.ts +39 -0
  172. package/tests/fieldDocProgram.test.ts +114 -0
  173. package/tests/logDisplay.fixtures.ts +67 -0
  174. package/tests/logDisplay.test.ts +227 -0
  175. package/tests/noteDoc.test.ts +514 -0
  176. package/tests/richTextHTML.test.ts +185 -0
  177. package/tests/sheetAxisMove.test.ts +352 -0
  178. package/tests/sheetBootstrap.test.ts +1967 -0
  179. package/tests/sheetFeatureReference.test.ts +22 -0
  180. package/tests/sheetFormulaCriteria.test.ts +269 -0
  181. package/tests/sheetFormulaEvaluator.test.ts +468 -0
  182. package/tests/sheetFormulaFunctions.test.ts +538 -0
  183. package/tests/sheetFormulaLanguage.test.ts +361 -0
  184. package/tests/sheetFormulaParity.fixtures.ts +872 -0
  185. package/tests/sheetFormulaParity.test.ts +188 -0
  186. package/tests/sheetFormulaRange.test.ts +167 -0
  187. package/tests/sheetFormulaReference.test.ts +78 -0
  188. package/tests/sheetFormulaReferenceRewrite.test.ts +117 -0
  189. package/tests/sheetFormulaTextDate.test.ts +512 -0
  190. package/tests/sheetSequence.test.ts +22 -0
  191. package/tests/sheetSnapshot.test.ts +134 -0
  192. package/tests/sheetStructureEdit.test.ts +537 -0
  193. package/tests/sheetStructureReferences.test.ts +589 -0
  194. package/tests/workflowLifecycleStatus.test.ts +60 -0
  195. package/tests/workflowLogFingerprint.test.ts +203 -0
  196. package/tests/workflowLogRevisionSnapshot.test.ts +96 -0
  197. package/tests/workflowProgress.test.ts +180 -0
  198. package/tests/workflowTriggers.test.ts +29 -0
  199. package/tsconfig.json +10 -10
  200. package/vitest.config.ts +8 -0
  201. package/src/constants/log-activityTexts.ts +0 -235
  202. package/src/constants/product.ts +0 -42
  203. package/src/constants/report.ts +0 -44
  204. package/src/schemas/organization.ts +0 -65
  205. package/src/schemas/productsQuery.ts +0 -53
  206. package/src/schemas/reportsQuery.ts +0 -20
  207. package/src/types/product.d.ts +0 -84
  208. package/src/types/report.d.ts +0 -290
  209. package/src/utils/product-calEvent.ts +0 -455
  210. package/src/utils/report.ts +0 -158
package/package.json CHANGED
@@ -1,56 +1,142 @@
1
1
  {
2
- "name": "@jsb188/mday",
3
- "version": "1.1.10",
4
- "description": "Functions and constants for Marketday app only.",
5
- "license": "ISC",
6
- "author": "jsb188",
7
- "type": "module",
8
- "exports": {
9
- "./constants/log.ts": "./src/constants/log.ts",
10
- "./constants/log-activityTexts.ts": "./src/constants/log-activityTexts.ts",
11
- "./constants/email.ts": "./src/constants/email.ts",
12
- "./constants/organization.ts": "./src/constants/organization.ts",
13
- "./constants/product.ts": "./src/constants/product.ts",
14
- "./constants/dataTable.ts": "./src/constants/dataTable.ts",
15
- "./constants/sheet.ts": "./src/constants/sheet.ts",
16
- "./constants/storage.ts": "./src/constants/storage.ts",
17
- "./types/email.d.ts": "./src/types/email.d.ts",
18
- "./types/inboundContact.d.ts": "./src/types/inboundContact.d.ts",
19
- "./types/storage.d.ts": "./src/types/storage.d.ts",
20
- "./schemas/editLogEntry.ts": "./src/schemas/editLogEntry.ts",
21
- "./schemas/inboundContact.ts": "./src/schemas/inboundContact.ts",
22
- "./schemas/logsQuery.ts": "./src/schemas/logsQuery.ts",
23
- "./schemas/organization.ts": "./src/schemas/organization.ts",
24
- "./schemas/childOrganizationsQuery.ts": "./src/schemas/childOrganizationsQuery.ts",
25
- "./schemas/productsQuery.ts": "./src/schemas/productsQuery.ts",
26
- "./schemas/reportsQuery.ts": "./src/schemas/reportsQuery.ts",
27
- "./types/account.d.ts": "./src/types/account.d.ts",
28
- "./types/integration.d.ts": "./src/types/integration.d.ts",
29
- "./types/log.d.ts": "./src/types/log.d.ts",
30
- "./types/organization.d.ts": "./src/types/organization.d.ts",
31
- "./types/product.d.ts": "./src/types/product.d.ts",
32
- "./types/report.d.ts": "./src/types/report.d.ts",
33
- "./types/dataTable.d.ts": "./src/types/dataTable.d.ts",
34
- "./types/sheet.d.ts": "./src/types/sheet.d.ts",
35
- "./types/workflow.d.ts": "./src/types/workflow.d.ts",
36
- "./utils/email.ts": "./src/utils/email.ts",
37
- "./utils/log.ts": "./src/utils/log.ts",
38
- "./utils/organization.ts": "./src/utils/organization.ts",
39
- "./utils/product-calEvent.ts": "./src/utils/product-calEvent.ts",
40
- "./utils/report.ts": "./src/utils/report.ts",
41
- "./utils/dataTable.ts": "./src/utils/dataTable.ts",
42
- "./utils/sheet.ts": "./src/utils/sheet.ts",
43
- "./utils/table-route.ts": "./src/utils/table-route.ts",
44
- "./utils/square.ts": "./src/utils/square.ts",
45
- "./utils/workflow.ts": "./src/utils/workflow.ts"
46
- },
47
- "dependencies": {
48
- "zod": "^3.25.67"
49
- },
50
- "peerDependencies": {
51
- "@jsb188/app": "1.1.10"
52
- },
53
- "scripts": {
54
- "test": "echo \"Error: no test specified\" && exit 1"
55
- }
2
+ "name": "@jsb188/mday",
3
+ "version": "1.1.12",
4
+ "description": "Functions and constants for Marketday app only.",
5
+ "license": "ISC",
6
+ "author": "jsb188",
7
+ "type": "module",
8
+ "exports": {
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",
12
+ "./constants/aiChat.ts": "./src/constants/aiChat.ts",
13
+ "./constants/agentMemory.ts": "./src/constants/agentMemory.ts",
14
+ "./constants/agentNote.ts": "./src/constants/agentNote.ts",
15
+ "./constants/log.ts": "./src/constants/log.ts",
16
+ "./constants/logTaxonomy.generated.ts": "./src/constants/logTaxonomy.generated.ts",
17
+ "./constants/email.ts": "./src/constants/email.ts",
18
+ "./constants/organization.ts": "./src/constants/organization.ts",
19
+ "./constants/pageRoute.ts": "./src/constants/pageRoute.ts",
20
+ "./constants/dataTable.ts": "./src/constants/dataTable.ts",
21
+ "./constants/dt.ts": "./src/constants/dt.ts",
22
+ "./constants/docAccess.ts": "./src/constants/docAccess.ts",
23
+ "./constants/graphqlReactivity.ts": "./src/constants/graphqlReactivity.ts",
24
+ "./constants/sheet.ts": "./src/constants/sheet.ts",
25
+ "./constants/storage.ts": "./src/constants/storage.ts",
26
+ "./constants/usage.ts": "./src/constants/usage.ts",
27
+ "./constants/billing.ts": "./src/constants/billing.ts",
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",
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",
36
+ "./utils/aiChat.ts": "./src/utils/aiChat.ts",
37
+ "./utils/aiChatWork.ts": "./src/utils/aiChatWork.ts",
38
+ "./utils/billing.ts": "./src/utils/billing.ts",
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",
49
+ "./constants/fieldDoc.ts": "./src/constants/fieldDoc.ts",
50
+ "./constants/noteDoc.ts": "./src/constants/noteDoc.ts",
51
+ "./constants/sms.ts": "./src/constants/sms.ts",
52
+ "./types/email.d.ts": "./src/types/email.d.ts",
53
+ "./types/agentMemory.d.ts": "./src/types/agentMemory.d.ts",
54
+ "./types/agentNote.d.ts": "./src/types/agentNote.d.ts",
55
+ "./types/inboundContact.d.ts": "./src/types/inboundContact.d.ts",
56
+ "./types/storage.d.ts": "./src/types/storage.d.ts",
57
+ "./types/usage.d.ts": "./src/types/usage.d.ts",
58
+ "./types/billing.d.ts": "./src/types/billing.d.ts",
59
+ "./schemas/editLogEntry.ts": "./src/schemas/editLogEntry.ts",
60
+ "./schemas/inboundContact.ts": "./src/schemas/inboundContact.ts",
61
+ "./schemas/logsQuery.ts": "./src/schemas/logsQuery.ts",
62
+ "./schemas/childOrganizationsQuery.ts": "./src/schemas/childOrganizationsQuery.ts",
63
+ "./types/account.d.ts": "./src/types/account.d.ts",
64
+ "./types/integration.d.ts": "./src/types/integration.d.ts",
65
+ "./types/log.d.ts": "./src/types/log.d.ts",
66
+ "./types/organization.d.ts": "./src/types/organization.d.ts",
67
+ "./types/pageRoute.d.ts": "./src/types/pageRoute.d.ts",
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",
71
+ "./types/dataTable.d.ts": "./src/types/dataTable.d.ts",
72
+ "./types/dt.d.ts": "./src/types/dt.d.ts",
73
+ "./types/docAccess.d.ts": "./src/types/docAccess.d.ts",
74
+ "./types/sheet.d.ts": "./src/types/sheet.d.ts",
75
+ "./types/sms.d.ts": "./src/types/sms.d.ts",
76
+ "./types/workflow.d.ts": "./src/types/workflow.d.ts",
77
+ "./utils/agentNote.ts": "./src/utils/agentNote.ts",
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",
81
+ "./utils/log.ts": "./src/utils/log.ts",
82
+ "./utils/logTaxonomyDisplay.ts": "./src/utils/logTaxonomyDisplay.ts",
83
+ "./utils/logRegistryValue.ts": "./src/utils/logRegistryValue.ts",
84
+ "./utils/organization.ts": "./src/utils/organization.ts",
85
+ "./utils/pageRoute.ts": "./src/utils/pageRoute.ts",
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",
91
+ "./utils/storage.ts": "./src/utils/storage.ts",
92
+ "./utils/dataTable.ts": "./src/utils/dataTable.ts",
93
+ "./utils/dataTableFieldTypeRegistry.ts": "./src/utils/dataTableFieldTypeRegistry.ts",
94
+ "./utils/dataTableRelativeDate.ts": "./src/utils/dataTableRelativeDate.ts",
95
+ "./utils/docAccess.ts": "./src/utils/docAccess.ts",
96
+ "./utils/documentName.ts": "./src/utils/documentName.ts",
97
+ "./utils/noteDoc.ts": "./src/utils/noteDoc.ts",
98
+ "./utils/richTextHTML.ts": "./src/utils/richTextHTML.ts",
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",
104
+ "./utils/sheetAxisMove.ts": "./src/utils/sheetAxisMove.ts",
105
+ "./utils/sheetCommand.ts": "./src/utils/sheetCommand.ts",
106
+ "./utils/sheetBootstrap.ts": "./src/utils/sheetBootstrap.ts",
107
+ "./utils/sheetJournal.ts": "./src/utils/sheetJournal.ts",
108
+ "./utils/sheetSequence.ts": "./src/utils/sheetSequence.ts",
109
+ "./utils/sheetSnapshot.ts": "./src/utils/sheetSnapshot.ts",
110
+ "./utils/sheetStructureEdit.ts": "./src/utils/sheetStructureEdit.ts",
111
+ "./utils/sheetStructureReferences.ts": "./src/utils/sheetStructureReferences.ts",
112
+ "./utils/sheetExport.ts": "./src/utils/sheetExport.ts",
113
+ "./utils/sheetNumberFormat.ts": "./src/utils/sheetNumberFormat.ts",
114
+ "./utils/sheetFormulaEvaluation.ts": "./src/utils/sheetFormulaEvaluation.ts",
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",
120
+ "./utils/table-route.ts": "./src/utils/table-route.ts",
121
+ "./utils/time.ts": "./src/utils/time.ts",
122
+ "./utils/square.ts": "./src/utils/square.ts",
123
+ "./utils/workflow.ts": "./src/utils/workflow.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"
130
+ },
131
+ "dependencies": {
132
+ "luxon": "^3.7.2",
133
+ "parse5": "^8.0.1",
134
+ "zod": "^3.25.76"
135
+ },
136
+ "peerDependencies": {
137
+ "@jsb188/app": "1.1.12"
138
+ },
139
+ "scripts": {
140
+ "test": "vitest run --config ./vitest.config.ts --passWithNoTests"
141
+ }
56
142
  }
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Agent memory; scope of a single remembered fact.
3
+ *
4
+ * ORGANIZATION - org-wide conventions; affects every user on every turn
5
+ * ACCOUNT - first-person memory BELONGING TO one user, never about them
6
+ * COUNTERPARTY - one customer, anchored on counterparties.id
7
+ */
8
+
9
+ export const AGENT_MEMORY_SCOPE_ENUMS = ['ORGANIZATION', 'ACCOUNT', 'COUNTERPARTY'] as const;
10
+
11
+ /**
12
+ * Agent memory; what kind of fact this is. Used for grouping in the UI and for
13
+ * ordering the injected block. Deliberately not rendered into the prompt.
14
+ */
15
+
16
+ export const AGENT_MEMORY_CATEGORY_ENUMS = ['UNIT', 'PRODUCT', 'PROCEDURE', 'PREFERENCE', 'OTHER'] as const;
17
+
18
+ /**
19
+ * Agent memory; injection gate. This is an inference gate, NOT an approval:
20
+ * memories inferred by the extractor land PROPOSED and are not injected until
21
+ * they are observed a second time. Explicit tool/UI writes go straight ACTIVE.
22
+ */
23
+
24
+ export const AGENT_MEMORY_STATUS_ENUMS = ['PROPOSED', 'ACTIVE'] as const;
25
+
26
+ /**
27
+ * Agent memory; how the row came to exist.
28
+ */
29
+
30
+ export const AGENT_MEMORY_CREATED_VIA_ENUMS = ['USER_EDIT', 'AGENT_TOOL', 'AGENT_EXTRACTOR'] as const;
31
+
32
+ /**
33
+ * Agent memory; which agent surface a memory applies to. NULL/empty means
34
+ * every surface. Deliberately excludes the Analyst: CSV export requests are
35
+ * explicit and already carry everything they need.
36
+ */
37
+
38
+ export const AGENT_MEMORY_SURFACE_ENUMS = ['CHAT', 'EMAIL', 'WORKFLOW'] as const;
39
+
40
+ /**
41
+ * Agent memory; hard limits.
42
+ *
43
+ * Content is capped short on purpose - one fact, one sentence. Over-long
44
+ * content fails validation rather than truncating, so a memory is never
45
+ * silently cut in half.
46
+ *
47
+ * Injection caps are enforced in the query, never in the renderer, so a
48
+ * silently truncated memory set is impossible. "permanent" rows are ordered
49
+ * first and bypass the soft cap: dropping a memory someone explicitly
50
+ * protected is the worst available outcome.
51
+ */
52
+
53
+ export const AGENT_MEMORY_LIMITS = {
54
+ contentMaxLength: 255,
55
+ keyMaxLength: 80,
56
+ organizationCap: 20,
57
+ accountCap: 10,
58
+ counterpartyCap: 10,
59
+ maxCounterpartiesPerTurn: 3,
60
+ // Permanent rows bypass per-scope soft caps; this is the shared absolute
61
+ // ceiling across every applicable subject in one prompt.
62
+ permanentHardCeiling: 60,
63
+ // A fact seen twice is a pattern, not a one-off.
64
+ promoteAtObservedCount: 2,
65
+ // A pass proposing more than this is a bug or a bad prompt, not a
66
+ // conversation that genuinely taught the agent many standing rules.
67
+ maxExtractionOpsPerRun: 3,
68
+ // Recent turns the extractor reads. Enough to see a fact stated and
69
+ // confirmed, short enough that the model is not re-reading old chat.
70
+ extractionMessageWindow: 12,
71
+ // Temporary (expiring) ACCOUNT rows injected per viewer. Working state is a
72
+ // handful of "doing right now" facts; more than this is stale accumulation
73
+ // the maintenance pass should have cleaned.
74
+ temporaryCap: 5,
75
+ // A maintenance pass proposing more ops than this is a bug or a bad prompt,
76
+ // not an organization that genuinely churned that much working state.
77
+ maxMaintenanceOpsPerRun: 6,
78
+ // The furthest into the future any temporary memory may expire. Also caps
79
+ // EXTEND ops from the maintenance pass, so working state can never be
80
+ // promoted into de-facto durable memory by repeated extension.
81
+ temporaryMaxTTLMS: 7 * 24 * 60 * 60 * 1000,
82
+ } as const;
83
+
84
+ /**
85
+ * Agent memory; the expiry choices the remember_temporary tool exposes.
86
+ * A closed set on purpose - arbitrary dates would let one bad call park a
87
+ * "current activity" pointer weeks into the future.
88
+ */
89
+
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;
98
+
99
+ /**
100
+ * Agent memory; how long to wait before extracting memories from a settled
101
+ * conversation. Long enough that a burst of messages coalesces into one pass,
102
+ * short enough that a fact taught now is usable in the next session.
103
+ */
104
+
105
+ export const AGENT_MEMORY_EXTRACTION_DELAY_MS = 90_000;
106
+
107
+ /**
108
+ * Agent memory; how long after the first write in a burst to run a duplicate
109
+ * merge. Long enough that a teaching session lands as one pass; short enough
110
+ * that duplicates do not sit in the prompt for a working day.
111
+ */
112
+
113
+ export const AGENT_MEMORY_COMPACTION_DELAY_MS = 4 * 60 * 60 * 1000;
114
+
115
+ /**
116
+ * Agent memory; how long after the first temporary-memory write in a burst to
117
+ * run the maintenance pass (expired-row sweep + stale/duplicate cleanup of
118
+ * working state). Much shorter than compaction because temporary rows go stale
119
+ * in hours, not days - but long enough that one field session lands as one
120
+ * pass, not one per log.
121
+ */
122
+
123
+ export const AGENT_MEMORY_MAINTENANCE_DELAY_MS = 20 * 60 * 1000;
@@ -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;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Maximum length of an automatic or user-managed AI chat summary.
3
+ */
4
+
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;