@jsb188/mday 1.1.10 → 1.1.11
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.
- package/package.json +105 -54
- package/src/constants/agentDoc.ts +12 -0
- package/src/constants/agentMemory.ts +154 -0
- package/src/constants/aiChat.ts +5 -0
- package/src/constants/campaign.ts +127 -0
- package/src/constants/dataTable.ts +35 -9
- package/src/constants/dataTableFieldTypes.generated.ts +63 -0
- package/src/constants/docAccess.ts +32 -0
- package/src/constants/email.ts +20 -4
- package/src/constants/fieldDoc.ts +34 -0
- package/src/constants/graphqlReactivity.ts +113 -0
- package/src/constants/integration.ts +8 -9
- package/src/constants/log.ts +7 -410
- package/src/constants/logActivityGroupColors.generated.ts +19 -0
- package/src/constants/logTaxonomy.generated.ts +1103 -0
- package/src/constants/noteDoc.ts +77 -0
- package/src/constants/organization.ts +13 -15
- package/src/constants/pageRoute.ts +23 -0
- package/src/constants/schedule.ts +220 -0
- package/src/constants/scheduleRuleTemplateSeed.ts +138 -0
- package/src/constants/scheduleRuleTemplates.generated.ts +145 -0
- package/src/constants/sheet.ts +154 -6
- package/src/constants/sheetRegionSources.generated.ts +578 -0
- package/src/constants/square.ts +6 -6
- package/src/constants/storage.ts +56 -7
- package/src/constants/usage.ts +79 -0
- package/src/schemas/editLogEntry.ts +1010 -777
- package/src/schemas/fieldDocsQuery.ts +12 -0
- package/src/schemas/inboundContact.ts +60 -55
- package/src/schemas/logsQuery.ts +55 -49
- package/src/schemas/organization.ts +49 -46
- package/src/types/account.d.ts +4 -1
- package/src/types/agentDoc.d.ts +64 -0
- package/src/types/agentMemory.d.ts +74 -0
- package/src/types/campaign.d.ts +683 -0
- package/src/types/dataTable.d.ts +175 -256
- package/src/types/docAccess.d.ts +96 -0
- package/src/types/email.d.ts +83 -12
- package/src/types/fieldDoc.d.ts +273 -0
- package/src/types/inboundContact.d.ts +2 -1
- package/src/types/log.d.ts +209 -341
- package/src/types/noteDoc.d.ts +86 -0
- package/src/types/organization.d.ts +83 -40
- package/src/types/pageRoute.d.ts +48 -0
- package/src/types/schedule.d.ts +391 -0
- package/src/types/sheet.d.ts +862 -30
- package/src/types/storage.d.ts +206 -125
- package/src/types/usage.d.ts +106 -0
- package/src/types/workflow.d.ts +149 -18
- package/src/utils/agentDoc.ts +109 -0
- package/src/utils/aiChat.ts +26 -0
- package/src/utils/campaign.ts +741 -0
- package/src/utils/campaignFormEditor.ts +871 -0
- package/src/utils/dataTable.ts +425 -410
- package/src/utils/dataTableFieldTypeRegistry.ts +105 -0
- package/src/utils/dataTableRealtimeAuthority.ts +209 -0
- package/src/utils/dataTableRealtimeSelection.ts +134 -0
- package/src/utils/dataTableRowDocument.ts +508 -0
- package/src/utils/dataTableSource.ts +230 -0
- package/src/utils/docAccess.ts +383 -0
- package/src/utils/documentName.ts +53 -0
- package/src/utils/email.ts +112 -53
- package/src/utils/fieldDoc.ts +113 -0
- package/src/utils/log.ts +169 -176
- package/src/utils/logRegistryValue.ts +90 -0
- package/src/utils/logStoreRead.ts +266 -0
- package/src/utils/logTaxonomy.ts +76 -0
- package/src/utils/logTaxonomyDisplay.ts +439 -0
- package/src/utils/noteDoc.ts +827 -0
- package/src/utils/organization.ts +510 -91
- package/src/utils/pageRoute.ts +71 -0
- package/src/utils/schedule.ts +799 -0
- package/src/utils/scheduleEvaluation.ts +1994 -0
- package/src/utils/scheduleICS.ts +246 -0
- package/src/utils/scheduleRuleTemplates.ts +188 -0
- package/src/utils/sheet.ts +4842 -39
- package/src/utils/sheetAxisMove.ts +830 -0
- package/src/utils/sheetBootstrap.ts +1769 -0
- package/src/utils/sheetCommand.ts +423 -0
- package/src/utils/sheetExport.ts +238 -0
- package/src/utils/sheetFormulaEvaluation.ts +914 -0
- package/src/utils/sheetFormulaEvaluator.ts +852 -0
- package/src/utils/sheetJournal.ts +78 -0
- package/src/utils/sheetNumberFormat.ts +1211 -0
- package/src/utils/sheetRegion.ts +374 -0
- package/src/utils/sheetRegionFilter.ts +1259 -0
- package/src/utils/sheetRegionSourceRegistry.ts +594 -0
- package/src/utils/sheetSequence.ts +148 -0
- package/src/utils/sheetSnapshot.ts +992 -0
- package/src/utils/sheetStructureEdit.ts +1284 -0
- package/src/utils/square.ts +22 -12
- package/src/utils/storage.ts +152 -0
- package/src/utils/table-route.ts +127 -11
- package/src/utils/workflow.ts +191 -23
- package/tests/dataTableFieldTypeRegistry.test.ts +110 -0
- package/tests/docAccess.test.ts +525 -0
- package/tests/editLogEntry.test.ts +112 -0
- package/tests/noteDoc.test.ts +669 -0
- package/tests/schedule.test.ts +693 -0
- package/tests/scheduleEvaluation.test.ts +1970 -0
- package/tests/scheduleICS.test.ts +208 -0
- package/tests/scheduleRuleTemplates.test.ts +176 -0
- package/tests/scheduleSweepInvariants.test.ts +428 -0
- package/tests/sheetAxisMove.test.ts +343 -0
- package/tests/sheetFormulaEvaluator.test.ts +575 -0
- package/tests/sheetRegionFilter.test.ts +1135 -0
- package/tests/sheetSequence.test.ts +41 -0
- package/tests/sheetStructureEdit.test.ts +82 -0
- package/tsconfig.json +10 -10
- package/vitest.config.ts +8 -0
- package/src/constants/log-activityTexts.ts +0 -235
- package/src/constants/product.ts +0 -42
- package/src/constants/report.ts +0 -44
- package/src/schemas/productsQuery.ts +0 -53
- package/src/schemas/reportsQuery.ts +0 -20
- package/src/types/product.d.ts +0 -84
- package/src/types/report.d.ts +0 -290
- package/src/utils/product-calEvent.ts +0 -455
- package/src/utils/report.ts +0 -158
package/package.json
CHANGED
|
@@ -1,56 +1,107 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
2
|
+
"name": "@jsb188/mday",
|
|
3
|
+
"version": "1.1.11",
|
|
4
|
+
"description": "Functions and constants for Marketday app only.",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"author": "jsb188",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./constants/agentDoc.ts": "./src/constants/agentDoc.ts",
|
|
10
|
+
"./constants/aiChat.ts": "./src/constants/aiChat.ts",
|
|
11
|
+
"./constants/agentMemory.ts": "./src/constants/agentMemory.ts",
|
|
12
|
+
"./constants/log.ts": "./src/constants/log.ts",
|
|
13
|
+
"./constants/logTaxonomy.generated.ts": "./src/constants/logTaxonomy.generated.ts",
|
|
14
|
+
"./constants/email.ts": "./src/constants/email.ts",
|
|
15
|
+
"./constants/organization.ts": "./src/constants/organization.ts",
|
|
16
|
+
"./constants/pageRoute.ts": "./src/constants/pageRoute.ts",
|
|
17
|
+
"./constants/dataTable.ts": "./src/constants/dataTable.ts",
|
|
18
|
+
"./constants/docAccess.ts": "./src/constants/docAccess.ts",
|
|
19
|
+
"./constants/graphqlReactivity.ts": "./src/constants/graphqlReactivity.ts",
|
|
20
|
+
"./constants/sheet.ts": "./src/constants/sheet.ts",
|
|
21
|
+
"./constants/storage.ts": "./src/constants/storage.ts",
|
|
22
|
+
"./constants/usage.ts": "./src/constants/usage.ts",
|
|
23
|
+
"./constants/campaign.ts": "./src/constants/campaign.ts",
|
|
24
|
+
"./types/campaign.d.ts": "./src/types/campaign.d.ts",
|
|
25
|
+
"./utils/aiChat.ts": "./src/utils/aiChat.ts",
|
|
26
|
+
"./utils/campaign.ts": "./src/utils/campaign.ts",
|
|
27
|
+
"./constants/fieldDoc.ts": "./src/constants/fieldDoc.ts",
|
|
28
|
+
"./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",
|
|
33
|
+
"./types/email.d.ts": "./src/types/email.d.ts",
|
|
34
|
+
"./types/agentMemory.d.ts": "./src/types/agentMemory.d.ts",
|
|
35
|
+
"./types/inboundContact.d.ts": "./src/types/inboundContact.d.ts",
|
|
36
|
+
"./types/storage.d.ts": "./src/types/storage.d.ts",
|
|
37
|
+
"./types/usage.d.ts": "./src/types/usage.d.ts",
|
|
38
|
+
"./schemas/editLogEntry.ts": "./src/schemas/editLogEntry.ts",
|
|
39
|
+
"./schemas/inboundContact.ts": "./src/schemas/inboundContact.ts",
|
|
40
|
+
"./schemas/logsQuery.ts": "./src/schemas/logsQuery.ts",
|
|
41
|
+
"./schemas/organization.ts": "./src/schemas/organization.ts",
|
|
42
|
+
"./schemas/childOrganizationsQuery.ts": "./src/schemas/childOrganizationsQuery.ts",
|
|
43
|
+
"./schemas/fieldDocsQuery.ts": "./src/schemas/fieldDocsQuery.ts",
|
|
44
|
+
"./types/account.d.ts": "./src/types/account.d.ts",
|
|
45
|
+
"./types/integration.d.ts": "./src/types/integration.d.ts",
|
|
46
|
+
"./types/log.d.ts": "./src/types/log.d.ts",
|
|
47
|
+
"./types/organization.d.ts": "./src/types/organization.d.ts",
|
|
48
|
+
"./types/pageRoute.d.ts": "./src/types/pageRoute.d.ts",
|
|
49
|
+
"./types/fieldDoc.d.ts": "./src/types/fieldDoc.d.ts",
|
|
50
|
+
"./types/dataTable.d.ts": "./src/types/dataTable.d.ts",
|
|
51
|
+
"./types/docAccess.d.ts": "./src/types/docAccess.d.ts",
|
|
52
|
+
"./types/noteDoc.d.ts": "./src/types/noteDoc.d.ts",
|
|
53
|
+
"./types/sheet.d.ts": "./src/types/sheet.d.ts",
|
|
54
|
+
"./types/schedule.d.ts": "./src/types/schedule.d.ts",
|
|
55
|
+
"./types/workflow.d.ts": "./src/types/workflow.d.ts",
|
|
56
|
+
"./utils/agentDoc.ts": "./src/utils/agentDoc.ts",
|
|
57
|
+
"./utils/email.ts": "./src/utils/email.ts",
|
|
58
|
+
"./utils/log.ts": "./src/utils/log.ts",
|
|
59
|
+
"./utils/logTaxonomyDisplay.ts": "./src/utils/logTaxonomyDisplay.ts",
|
|
60
|
+
"./utils/logRegistryValue.ts": "./src/utils/logRegistryValue.ts",
|
|
61
|
+
"./utils/organization.ts": "./src/utils/organization.ts",
|
|
62
|
+
"./utils/pageRoute.ts": "./src/utils/pageRoute.ts",
|
|
63
|
+
"./utils/fieldDoc.ts": "./src/utils/fieldDoc.ts",
|
|
64
|
+
"./utils/storage.ts": "./src/utils/storage.ts",
|
|
65
|
+
"./utils/dataTable.ts": "./src/utils/dataTable.ts",
|
|
66
|
+
"./utils/dataTableSource.ts": "./src/utils/dataTableSource.ts",
|
|
67
|
+
"./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",
|
|
71
|
+
"./utils/docAccess.ts": "./src/utils/docAccess.ts",
|
|
72
|
+
"./utils/documentName.ts": "./src/utils/documentName.ts",
|
|
73
|
+
"./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",
|
|
78
|
+
"./utils/sheet.ts": "./src/utils/sheet.ts",
|
|
79
|
+
"./utils/sheetAxisMove.ts": "./src/utils/sheetAxisMove.ts",
|
|
80
|
+
"./utils/sheetRegion.ts": "./src/utils/sheetRegion.ts",
|
|
81
|
+
"./utils/sheetRegionFilter.ts": "./src/utils/sheetRegionFilter.ts",
|
|
82
|
+
"./utils/sheetCommand.ts": "./src/utils/sheetCommand.ts",
|
|
83
|
+
"./utils/sheetBootstrap.ts": "./src/utils/sheetBootstrap.ts",
|
|
84
|
+
"./utils/sheetJournal.ts": "./src/utils/sheetJournal.ts",
|
|
85
|
+
"./utils/sheetSequence.ts": "./src/utils/sheetSequence.ts",
|
|
86
|
+
"./utils/sheetSnapshot.ts": "./src/utils/sheetSnapshot.ts",
|
|
87
|
+
"./utils/sheetStructureEdit.ts": "./src/utils/sheetStructureEdit.ts",
|
|
88
|
+
"./utils/sheetExport.ts": "./src/utils/sheetExport.ts",
|
|
89
|
+
"./utils/sheetNumberFormat.ts": "./src/utils/sheetNumberFormat.ts",
|
|
90
|
+
"./utils/sheetFormulaEvaluation.ts": "./src/utils/sheetFormulaEvaluation.ts",
|
|
91
|
+
"./utils/sheetFormulaEvaluator.ts": "./src/utils/sheetFormulaEvaluator.ts",
|
|
92
|
+
"./utils/table-route.ts": "./src/utils/table-route.ts",
|
|
93
|
+
"./utils/square.ts": "./src/utils/square.ts",
|
|
94
|
+
"./utils/workflow.ts": "./src/utils/workflow.ts",
|
|
95
|
+
"./utils/campaignFormEditor.ts": "./src/utils/campaignFormEditor.ts"
|
|
96
|
+
},
|
|
97
|
+
"dependencies": {
|
|
98
|
+
"luxon": "^3.7.2",
|
|
99
|
+
"zod": "^3.25.76"
|
|
100
|
+
},
|
|
101
|
+
"peerDependencies": {
|
|
102
|
+
"@jsb188/app": "1.1.11"
|
|
103
|
+
},
|
|
104
|
+
"scripts": {
|
|
105
|
+
"test": "vitest run --config ./vitest.config.ts --passWithNoTests"
|
|
106
|
+
}
|
|
56
107
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Agent surfaces that can read agent docs. Maps from the server AI
|
|
3
|
+
* controller __type; per-document "settings.hiddenSurfaces" is a deny-list
|
|
4
|
+
* of these values, so a future surface added here is visible by default and
|
|
5
|
+
* stored settings never need a migration.
|
|
6
|
+
*/
|
|
7
|
+
export const AGENT_DOC_SURFACE_ENUMS = [
|
|
8
|
+
'CHAT',
|
|
9
|
+
'RUNNER',
|
|
10
|
+
'POSTMASTER',
|
|
11
|
+
'ANALYST',
|
|
12
|
+
] as const;
|
|
@@ -0,0 +1,154 @@
|
|
|
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 = [
|
|
10
|
+
'ORGANIZATION',
|
|
11
|
+
'ACCOUNT',
|
|
12
|
+
'COUNTERPARTY',
|
|
13
|
+
] as const;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Agent memory; what kind of fact this is. Used for grouping in the UI and for
|
|
17
|
+
* ordering the injected block. Deliberately not rendered into the prompt.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export const AGENT_MEMORY_CATEGORY_ENUMS = [
|
|
21
|
+
'UNIT',
|
|
22
|
+
'PRODUCT',
|
|
23
|
+
'PROCEDURE',
|
|
24
|
+
'PREFERENCE',
|
|
25
|
+
'OTHER',
|
|
26
|
+
] as const;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Agent memory; injection gate. This is an inference gate, NOT an approval:
|
|
30
|
+
* memories inferred by the extractor land PROPOSED and are not injected until
|
|
31
|
+
* they are observed a second time. Explicit tool/UI writes go straight ACTIVE.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
export const AGENT_MEMORY_STATUS_ENUMS = ['PROPOSED', 'ACTIVE'] as const;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Agent memory; how the row came to exist.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
export const AGENT_MEMORY_CREATED_VIA_ENUMS = [
|
|
41
|
+
'USER_EDIT',
|
|
42
|
+
'AGENT_TOOL',
|
|
43
|
+
'AGENT_EXTRACTOR',
|
|
44
|
+
] as const;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Agent memory; which agent surface a memory applies to. NULL/empty means
|
|
48
|
+
* every surface. Deliberately excludes the Analyst: CSV export requests are
|
|
49
|
+
* explicit and already carry everything they need.
|
|
50
|
+
*/
|
|
51
|
+
|
|
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;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Agent memory; hard limits.
|
|
75
|
+
*
|
|
76
|
+
* Content is capped short on purpose - one fact, one sentence. Over-long
|
|
77
|
+
* content fails validation rather than truncating, so a memory is never
|
|
78
|
+
* silently cut in half.
|
|
79
|
+
*
|
|
80
|
+
* Injection caps are enforced in the query, never in the renderer, so a
|
|
81
|
+
* silently truncated memory set is impossible. "permanent" rows are ordered
|
|
82
|
+
* first and bypass the soft cap: dropping a memory someone explicitly
|
|
83
|
+
* protected is the worst available outcome.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
export const AGENT_MEMORY_LIMITS = {
|
|
87
|
+
contentMaxLength: 255,
|
|
88
|
+
keyMaxLength: 80,
|
|
89
|
+
organizationCap: 20,
|
|
90
|
+
accountCap: 10,
|
|
91
|
+
counterpartyCap: 10,
|
|
92
|
+
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.
|
|
95
|
+
permanentHardCeiling: 60,
|
|
96
|
+
// A fact seen twice is a pattern, not a one-off.
|
|
97
|
+
promoteAtObservedCount: 2,
|
|
98
|
+
// A pass proposing more than this is a bug or a bad prompt, not a
|
|
99
|
+
// conversation that genuinely taught the agent many standing rules.
|
|
100
|
+
maxExtractionOpsPerRun: 3,
|
|
101
|
+
// Recent turns the extractor reads. Enough to see a fact stated and
|
|
102
|
+
// confirmed, short enough that the model is not re-reading old chat.
|
|
103
|
+
extractionMessageWindow: 12,
|
|
104
|
+
// Temporary (expiring) ACCOUNT rows injected per viewer. Working state is a
|
|
105
|
+
// handful of "doing right now" facts; more than this is stale accumulation
|
|
106
|
+
// the maintenance pass should have cleaned.
|
|
107
|
+
temporaryCap: 5,
|
|
108
|
+
// A maintenance pass proposing more ops than this is a bug or a bad prompt,
|
|
109
|
+
// not an organization that genuinely churned that much working state.
|
|
110
|
+
maxMaintenanceOpsPerRun: 6,
|
|
111
|
+
// The furthest into the future any temporary memory may expire. Also caps
|
|
112
|
+
// EXTEND ops from the maintenance pass, so working state can never be
|
|
113
|
+
// promoted into de-facto durable memory by repeated extension.
|
|
114
|
+
temporaryMaxTTLMS: 7 * 24 * 60 * 60 * 1000,
|
|
115
|
+
} as const;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Agent memory; the expiry choices the remember_temporary tool exposes.
|
|
119
|
+
* A closed set on purpose - arbitrary dates would let one bad call park a
|
|
120
|
+
* "current activity" pointer weeks into the future.
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
export const AGENT_MEMORY_TEMPORARY_EXPIRY_ENUMS = [
|
|
124
|
+
'END_OF_DAY',
|
|
125
|
+
'1_DAY',
|
|
126
|
+
'3_DAYS',
|
|
127
|
+
'7_DAYS',
|
|
128
|
+
] as const;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Agent memory; how long to wait before extracting memories from a settled
|
|
132
|
+
* conversation. Long enough that a burst of messages coalesces into one pass,
|
|
133
|
+
* short enough that a fact taught now is usable in the next session.
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
export const AGENT_MEMORY_EXTRACTION_DELAY_MS = 90_000;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Agent memory; how long after the first write in a burst to run a duplicate
|
|
140
|
+
* merge. Long enough that a teaching session lands as one pass; short enough
|
|
141
|
+
* that duplicates do not sit in the prompt for a working day.
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
export const AGENT_MEMORY_COMPACTION_DELAY_MS = 4 * 60 * 60 * 1000;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Agent memory; how long after the first temporary-memory write in a burst to
|
|
148
|
+
* run the maintenance pass (expired-row sweep + stale/duplicate cleanup of
|
|
149
|
+
* working state). Much shorter than compaction because temporary rows go stale
|
|
150
|
+
* in hours, not days - but long enough that one field session lands as one
|
|
151
|
+
* pass, not one per log.
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
export const AGENT_MEMORY_MAINTENANCE_DELAY_MS = 20 * 60 * 1000;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Campaigns; all types
|
|
3
|
+
*
|
|
4
|
+
* A campaign template is a reusable definition; a campaign is one immutable
|
|
5
|
+
* publication or send created from it. This domain is independent of
|
|
6
|
+
* fieldDocs: it owns its own element definitions, and a response is complete
|
|
7
|
+
* in campaign_responses without writing anything to logs.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const CAMPAIGN_KIND_ENUMS = ['PUBLIC_FORM', 'EMAIL'];
|
|
11
|
+
|
|
12
|
+
export const CAMPAIGN_AUDIENCE_ENUMS = [
|
|
13
|
+
'ANYONE',
|
|
14
|
+
'CHILD_ORGS',
|
|
15
|
+
'INBOUND_CONTACTS',
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
// A template is created in GENERATING and settles to ACTIVE or ERROR when the
|
|
19
|
+
// durable generation job finishes; ARCHIVED retires it without deleting the
|
|
20
|
+
// campaigns already published from it
|
|
21
|
+
export const CAMPAIGN_TEMPLATE_STATUS_ENUMS = [
|
|
22
|
+
'GENERATING',
|
|
23
|
+
'ACTIVE',
|
|
24
|
+
'ARCHIVED',
|
|
25
|
+
'ERROR',
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
export const CAMPAIGN_STATUS_ENUMS = [
|
|
29
|
+
'SCHEDULED',
|
|
30
|
+
'ACTIVE',
|
|
31
|
+
'SENDING',
|
|
32
|
+
'COMPLETED',
|
|
33
|
+
'CLOSED',
|
|
34
|
+
'CANCELLED',
|
|
35
|
+
'FAILED',
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
export const CAMPAIGN_RESPONSE_STATUS_ENUMS = ['DRAFT', 'SUBMITTED'];
|
|
39
|
+
|
|
40
|
+
// The structural role of one element; "type" below is how a QUESTION is
|
|
41
|
+
// answered
|
|
42
|
+
export const CAMPAIGN_ELEMENT_KINDS = [
|
|
43
|
+
'SECTION', // Top-level container; every other kind is a child of one
|
|
44
|
+
'CONTENT', // Static title/paragraph/image; renders, never answered
|
|
45
|
+
'QUESTION', // Collects exactly one answer
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
export const CAMPAIGN_ELEMENT_TYPES = [
|
|
49
|
+
'SHORT_TEXT',
|
|
50
|
+
'LONG_TEXT',
|
|
51
|
+
'SINGLE_CHOICE',
|
|
52
|
+
'MULTI_CHOICE',
|
|
53
|
+
'NUMBER',
|
|
54
|
+
'DATE',
|
|
55
|
+
'EMAIL',
|
|
56
|
+
'PHONE',
|
|
57
|
+
'FILE',
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
// Element types whose answer must be one of the element's options
|
|
61
|
+
export const CAMPAIGN_CHOICE_ELEMENT_TYPES = ['SINGLE_CHOICE', 'MULTI_CHOICE'];
|
|
62
|
+
|
|
63
|
+
export const CAMPAIGN_ELEMENT_VISIBLE_WHEN_OPERATORS = [
|
|
64
|
+
'EQUALS',
|
|
65
|
+
'NOT_EQUALS',
|
|
66
|
+
'INCLUDES',
|
|
67
|
+
'IS_ANSWERED',
|
|
68
|
+
] as const;
|
|
69
|
+
|
|
70
|
+
export const CAMPAIGN_SORT_ENUMS = [
|
|
71
|
+
'CREATED_AT_DESC',
|
|
72
|
+
'CREATED_AT_ASC',
|
|
73
|
+
] as const;
|
|
74
|
+
|
|
75
|
+
export const CAMPAIGN_TEMPLATE_TYPES = ['forms', 'emails'] as const;
|
|
76
|
+
|
|
77
|
+
// Upper bound for the AI generation instructions typed into the create-template
|
|
78
|
+
// modal; also caps what one locally persisted draft may hold
|
|
79
|
+
export const CAMPAIGN_INSTRUCTIONS_MAX_LENGTH = 10000;
|
|
80
|
+
|
|
81
|
+
// A template stuck in GENERATING past this age is treated as a dead job and
|
|
82
|
+
// swept to ERROR
|
|
83
|
+
export const CAMPAIGN_GENERATION_TIMEOUT_MS = 10 * 60 * 1000;
|
|
84
|
+
|
|
85
|
+
// Bounded by the server's 12-hour sweep of "UNUSED" uploads: a resumed draft
|
|
86
|
+
// must never outlive the storage objects its file references point at
|
|
87
|
+
export const CAMPAIGN_DRAFT_TTL_HOURS = 6;
|
|
88
|
+
|
|
89
|
+
// Bump the version segment when the persisted shape changes meaning in a way
|
|
90
|
+
// the schema cannot catch; old drafts then miss and are swept
|
|
91
|
+
export const CAMPAIGN_DRAFT_KEY_PREFIX = 'createCampaignTemplate:v1';
|
|
92
|
+
|
|
93
|
+
// Public web form color presets; values must match generated bg_* color
|
|
94
|
+
// utility palette names in @jsb188/css.
|
|
95
|
+
export const CAMPAIGN_FORM_COLORS = [
|
|
96
|
+
'red',
|
|
97
|
+
'orange',
|
|
98
|
+
'brown',
|
|
99
|
+
'amber',
|
|
100
|
+
'yellow',
|
|
101
|
+
'lime',
|
|
102
|
+
'green',
|
|
103
|
+
'emerald',
|
|
104
|
+
'teal',
|
|
105
|
+
'cyan',
|
|
106
|
+
'sky',
|
|
107
|
+
'blue',
|
|
108
|
+
'indigo',
|
|
109
|
+
'violet',
|
|
110
|
+
'purple',
|
|
111
|
+
'fuchsia',
|
|
112
|
+
'pink',
|
|
113
|
+
'rose',
|
|
114
|
+
'slate',
|
|
115
|
+
'zinc',
|
|
116
|
+
'stone',
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
export const CAMPAIGN_FORM_BACKGROUND_FILL_STYLES = [
|
|
120
|
+
'FADED',
|
|
121
|
+
'LIGHT',
|
|
122
|
+
'MEDIUM',
|
|
123
|
+
'GRAYSCALE',
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
export const CAMPAIGN_FORM_DEFAULT_BACKGROUND_FILL_STYLE = 'FADED';
|
|
127
|
+
export const CAMPAIGN_FORM_NEUTRAL_COLOR = 'zinc';
|
|
@@ -1,22 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
// Registry-generated (dataTable field-type registry): the column type keys
|
|
2
|
+
// come from data_table_field_types rows; regenerate with (cwd: server/)
|
|
3
|
+
// `deno task generate:datatable-field-types`. Re-exported here so every
|
|
4
|
+
// existing import site keeps compiling unchanged.
|
|
5
|
+
export { DATA_TABLE_FIELD_TYPE_ENUMS } from './dataTableFieldTypes.generated.ts';
|
|
6
|
+
|
|
7
|
+
export const DATA_TABLE_RECORD_VALUE_KIND_ENUMS = [
|
|
8
|
+
'NULL',
|
|
2
9
|
'TEXT',
|
|
3
|
-
'ID',
|
|
4
|
-
'ID_OR_TEXT',
|
|
5
10
|
'NUMBER',
|
|
6
|
-
'PRICE',
|
|
7
11
|
'BOOLEAN',
|
|
8
12
|
'DATE',
|
|
9
|
-
'WEEK_OF_MON',
|
|
10
|
-
'WEEK_OF_SUN',
|
|
11
13
|
'DATETIME',
|
|
12
|
-
'SELECT',
|
|
13
|
-
'SELECT_OR_TEXT',
|
|
14
|
-
'MULTI_SELECT',
|
|
15
14
|
'JSON',
|
|
15
|
+
'RELATED',
|
|
16
|
+
'REFERENCE',
|
|
17
|
+
] as const;
|
|
18
|
+
|
|
19
|
+
export const DATA_TABLE_RECORD_RESOLVED_VALUE_KIND_ENUMS = [
|
|
20
|
+
'TEXT',
|
|
21
|
+
'NUMBER',
|
|
22
|
+
'BOOLEAN',
|
|
23
|
+
'DATE',
|
|
24
|
+
'DATETIME',
|
|
25
|
+
] as const;
|
|
26
|
+
|
|
27
|
+
export const DATA_TABLE_CHANGE_KIND_ENUMS = [
|
|
28
|
+
'RECORDS',
|
|
29
|
+
'ROWS',
|
|
30
|
+
'STRUCTURE',
|
|
31
|
+
'DESIGN',
|
|
32
|
+
'DELETE',
|
|
16
33
|
] as const;
|
|
17
34
|
|
|
35
|
+
export const DATA_TABLE_ROW_DOCUMENT_VERSION = 1 as const;
|
|
36
|
+
export const DATA_TABLE_ORDER_KEY_STRIDE = 1_048_576;
|
|
37
|
+
|
|
18
38
|
export const DATA_TABLE_COLUMN_WIDTH = 160;
|
|
19
39
|
export const DATA_TABLE_COLUMN_MIN_WIDTH = 72;
|
|
20
40
|
export const DATA_TABLE_COLUMN_MAX_WIDTH = 640;
|
|
21
41
|
export const DATA_TABLE_HUMAN_LABEL_MAX_LENGTH = 70;
|
|
22
42
|
export const DATA_TABLE_ROWS_MAX_LIMIT = 400;
|
|
43
|
+
|
|
44
|
+
// Keep realtime DataTable envelopes below the server's 750 KB websocket cap,
|
|
45
|
+
// including Socket.IO framing and server-added actor/order metadata.
|
|
46
|
+
export const DATA_TABLE_REALTIME_MAX_PAYLOAD_BYTES = 64 * 1_024;
|
|
47
|
+
export const DATA_TABLE_REALTIME_MAX_LOGICAL_OPERATIONS = 1_000;
|
|
48
|
+
export const DATA_TABLE_REALTIME_MAX_OPERATIONS_PER_RELAY = 200;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// GENERATED FILE — DO NOT EDIT BY HAND.
|
|
2
|
+
// Regenerate with (cwd: server/): deno task generate:datatable-field-types (reads the data_table_field_types registry).
|
|
3
|
+
// Contract-checked by: deno task check:datatable-field-types
|
|
4
|
+
//
|
|
5
|
+
// KNOWN REMAINING PER-TYPE SITES (intentionally NOT registry-driven):
|
|
6
|
+
// - Only the NUMBER / DATE / WEEK semantics families route through the
|
|
7
|
+
// @jsb188/mday utils/dataTable.ts helpers; TEXT / ID / ID_OR_TEXT /
|
|
8
|
+
// BOOLEAN / DATETIME / SELECT / SELECT_OR_TEXT / MULTI_SELECT / JSON
|
|
9
|
+
// sites still compare fieldType literals directly (e.g. server
|
|
10
|
+
// sheet/sheetOps-regionSourceSQL.ts operator/typed-value routing and the client
|
|
11
|
+
// @jsb188:sheet dataTable-cell-editing.tsx editors). A NEW type key
|
|
12
|
+
// therefore only inherits behavior automatically when it binds to the
|
|
13
|
+
// NUMBER, DATE, or WEEK family; anything else is a code change.
|
|
14
|
+
// - Per-type UI editors/formatters and storage-column routing ARE the
|
|
15
|
+
// semantics and remain code behind the semantics keys.
|
|
16
|
+
// - Sheet region reconciliation keeps one hardcoded per-kind SQL site
|
|
17
|
+
// (sheet/sheetOps-regionProjection.ts enqueue… NOT IN ('LOGS',
|
|
18
|
+
// 'CHILD_ORGANIZATIONS')); new region source kinds fall back to the
|
|
19
|
+
// conservative rebuild path — documented in
|
|
20
|
+
// server/src/libs/sheet/sheetOps-regionSourceRegistry.generated.ts.
|
|
21
|
+
|
|
22
|
+
import type { DataTableFieldTypeSemanticsKey } from '../utils/dataTableFieldTypeRegistry.ts';
|
|
23
|
+
|
|
24
|
+
export const DATA_TABLE_FIELD_TYPE_ENUMS = [
|
|
25
|
+
'TEXT',
|
|
26
|
+
'ID',
|
|
27
|
+
'ID_OR_TEXT',
|
|
28
|
+
'NUMBER',
|
|
29
|
+
'PRICE',
|
|
30
|
+
'BOOLEAN',
|
|
31
|
+
'DATE',
|
|
32
|
+
'WEEK_OF_MON',
|
|
33
|
+
'WEEK_OF_SUN',
|
|
34
|
+
'DATETIME',
|
|
35
|
+
'SELECT',
|
|
36
|
+
'SELECT_OR_TEXT',
|
|
37
|
+
'MULTI_SELECT',
|
|
38
|
+
'JSON',
|
|
39
|
+
] as const;
|
|
40
|
+
|
|
41
|
+
// Column-type key → code-owned semantics family (registry rows; the
|
|
42
|
+
// utils/dataTable.ts helpers look types up here instead of hardcoding
|
|
43
|
+
// per-key literals). Const-asserted so the helper type predicates can
|
|
44
|
+
// derive their narrowed key unions from the registry snapshot.
|
|
45
|
+
export const DATA_TABLE_FIELD_TYPE_SEMANTICS = {
|
|
46
|
+
TEXT: 'TEXT',
|
|
47
|
+
ID: 'ID',
|
|
48
|
+
ID_OR_TEXT: 'ID_OR_TEXT',
|
|
49
|
+
NUMBER: 'NUMBER',
|
|
50
|
+
PRICE: 'NUMBER',
|
|
51
|
+
BOOLEAN: 'BOOLEAN',
|
|
52
|
+
DATE: 'DATE',
|
|
53
|
+
WEEK_OF_MON: 'WEEK',
|
|
54
|
+
WEEK_OF_SUN: 'WEEK',
|
|
55
|
+
DATETIME: 'DATETIME',
|
|
56
|
+
SELECT: 'SELECT',
|
|
57
|
+
SELECT_OR_TEXT: 'SELECT_OR_TEXT',
|
|
58
|
+
MULTI_SELECT: 'MULTI_SELECT',
|
|
59
|
+
JSON: 'JSON',
|
|
60
|
+
} as const satisfies Record<
|
|
61
|
+
(typeof DATA_TABLE_FIELD_TYPE_ENUMS)[number],
|
|
62
|
+
DataTableFieldTypeSemanticsKey
|
|
63
|
+
>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Document access constants, shared by every access-controlled document type
|
|
3
|
+
* (Sheets today; Field Docs, Logs, and future document tables can reuse them).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Effective permission ranking for one viewer on one document
|
|
7
|
+
export const DOC_PERMISSION_ENUMS = ['NONE', 'VIEW', 'EDIT'] as const;
|
|
8
|
+
|
|
9
|
+
// Permissions one grant can carry; a grant overrides the base team/network
|
|
10
|
+
// policy for its grantee, so "NONE" is an explicit block below the base rule
|
|
11
|
+
export const DOC_GRANT_PERMISSION_ENUMS = ['NONE', 'VIEW', 'EDIT'] as const;
|
|
12
|
+
|
|
13
|
+
// Who one access grant targets
|
|
14
|
+
export const DOC_ACCESS_GRANTEE_TYPE_ENUMS = [
|
|
15
|
+
'ACCOUNT',
|
|
16
|
+
'ORGANIZATION',
|
|
17
|
+
] as const;
|
|
18
|
+
|
|
19
|
+
// Document tables that store access grants in access_grants
|
|
20
|
+
export const DOC_ACCESS_ENTITY_TYPE_ENUMS = [
|
|
21
|
+
'SHEET',
|
|
22
|
+
'AGENT_DOC',
|
|
23
|
+
'SCHEDULE_CALENDAR',
|
|
24
|
+
] as const;
|
|
25
|
+
|
|
26
|
+
// UI presentation of one document's general access policy beyond the owner
|
|
27
|
+
// team: network (child) organizations, invite-only, or anyone with the link
|
|
28
|
+
export const DOC_ACCESS_SCOPE_ENUMS = [
|
|
29
|
+
'NETWORK',
|
|
30
|
+
'RESTRICTED',
|
|
31
|
+
'PUBLIC',
|
|
32
|
+
] as const;
|
package/src/constants/email.ts
CHANGED
|
@@ -20,9 +20,25 @@ export const INBOUND_EMAIL_SORT_ENUMS = [
|
|
|
20
20
|
] as const;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Outbound email delivery statuses.
|
|
24
|
+
*/
|
|
25
|
+
export const OUTBOUND_EMAIL_STATUS_ENUMS = [
|
|
26
|
+
'QUEUED',
|
|
27
|
+
'PROCESSING',
|
|
28
|
+
'SENT',
|
|
29
|
+
'ERRORED',
|
|
30
|
+
'BOUNCED',
|
|
31
|
+
] as const;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Outbound email list sort options.
|
|
24
35
|
*/
|
|
25
|
-
export const
|
|
26
|
-
'
|
|
27
|
-
'
|
|
36
|
+
export const OUTBOUND_EMAIL_SORT_ENUMS = [
|
|
37
|
+
'CREATED_AT_DESC',
|
|
38
|
+
'CREATED_AT_ASC',
|
|
28
39
|
] as const;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Inbound email body display source options.
|
|
43
|
+
*/
|
|
44
|
+
export const INBOUND_EMAIL_BODY_FORMAT_ENUMS = ['TEXT'] as const;
|