@jsb188/mday 1.1.8 → 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 -35
- 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 +48 -0
- package/src/constants/dataTableFieldTypes.generated.ts +63 -0
- package/src/constants/docAccess.ts +32 -0
- package/src/constants/email.ts +44 -0
- package/src/constants/fieldDoc.ts +34 -0
- package/src/constants/graphqlReactivity.ts +113 -0
- package/src/constants/inboundContact.ts +8 -0
- package/src/constants/integration.ts +13 -0
- package/src/constants/log.ts +7 -366
- 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 +18 -11
- 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 +168 -0
- package/src/constants/sheetRegionSources.generated.ts +578 -0
- package/src/constants/square.ts +16 -0
- package/src/constants/storage.ts +61 -0
- package/src/constants/usage.ts +79 -0
- package/src/schemas/editLogEntry.ts +1017 -738
- package/src/schemas/fieldDocsQuery.ts +12 -0
- package/src/schemas/inboundContact.ts +77 -0
- package/src/schemas/logsQuery.ts +57 -316
- package/src/schemas/organization.ts +53 -213
- package/src/types/account.d.ts +81 -0
- 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 +366 -0
- package/src/types/docAccess.d.ts +96 -0
- package/src/types/email.d.ts +142 -0
- package/src/types/fieldDoc.d.ts +273 -0
- package/src/types/inboundContact.d.ts +57 -0
- package/src/types/integration.d.ts +42 -0
- package/src/types/log.d.ts +169 -190
- package/src/types/noteDoc.d.ts +86 -0
- package/src/types/organization.d.ts +175 -76
- package/src/types/pageRoute.d.ts +48 -0
- package/src/types/schedule.d.ts +391 -0
- package/src/types/sheet.d.ts +1130 -0
- package/src/types/storage.d.ts +242 -0
- package/src/types/usage.d.ts +106 -0
- package/src/types/workflow.d.ts +305 -0
- 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 +849 -0
- 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 +172 -0
- package/src/utils/fieldDoc.ts +113 -0
- package/src/utils/log.ts +173 -778
- 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 +683 -81
- 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 +4973 -0
- 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 +32 -0
- package/src/utils/storage.ts +152 -0
- package/src/utils/table-route.ts +262 -0
- package/src/utils/workflow.ts +380 -0
- 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 +12 -0
- package/vitest.config.ts +8 -0
- package/src/constants/log-activityTexts.ts +0 -209
- package/src/constants/product.ts +0 -66
- package/src/constants/report.ts +0 -25
- package/src/schemas/childOrganizationsQuery.ts +0 -44
- package/src/schemas/productsQuery.ts +0 -145
- package/src/schemas/reportsQuery.ts +0 -107
- package/src/types/action.d.ts +0 -42
- package/src/types/product.d.ts +0 -173
- package/src/types/report.d.ts +0 -203
- package/src/utils/product-calEvent.ts +0 -508
- package/src/utils/route-helpers.ts +0 -583
|
@@ -1,228 +1,68 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import type { OrganizationGQL } from '../types/organization.d';
|
|
4
|
-
import type { OpenModalPopUpFn } from '@jsb188/react/states';
|
|
1
|
+
import i18n from '@jsb188/app/i18n/index.ts';
|
|
2
|
+
import { makeAddressSchema } from '@jsb188/auth-web/schemas/address';
|
|
3
|
+
import type { OrganizationGQL } from '../types/organization.d.ts';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Length values for validation
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
9
|
const MIN_LEN_VALUES = {
|
|
11
|
-
|
|
12
|
-
address_city: 100,
|
|
13
|
-
address_state: 32,
|
|
14
|
-
address_postalCode: 20,
|
|
10
|
+
name: 40,
|
|
15
11
|
};
|
|
16
12
|
|
|
17
|
-
/**
|
|
18
|
-
* Rules for each field
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const RULES = function() {
|
|
23
|
-
|
|
24
|
-
const addressRule = (_value: string, fv: any, k: string) => {
|
|
25
|
-
const addr = fv.address;
|
|
26
|
-
const hasAddressFV = Object.values(addr).some((v: any) => v?.trim()?.length > 0);
|
|
27
|
-
|
|
28
|
-
if (hasAddressFV) {
|
|
29
|
-
return !!addr?.[k]?.trim().length;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
'address.line1': {
|
|
37
|
-
for: 'address.line1',
|
|
38
|
-
rule: (v: any, fv: any) => addressRule(v, fv, 'line1'),
|
|
39
|
-
error: () => ({
|
|
40
|
-
message: i18n.t('error.msg_value_required', { value: i18n.t('form.line1') }),
|
|
41
|
-
}),
|
|
42
|
-
},
|
|
43
|
-
'address.postalCode': {
|
|
44
|
-
for: 'address.postalCode',
|
|
45
|
-
rule: (v: any, fv: any) => addressRule(v, fv, 'postalCode'),
|
|
46
|
-
error: () => ({
|
|
47
|
-
message: i18n.t('error.msg_value_required', { value: i18n.t('form.postalCode') }),
|
|
48
|
-
}),
|
|
49
|
-
},
|
|
50
|
-
'address.city': {
|
|
51
|
-
for: 'address.city',
|
|
52
|
-
rule: (v: any, fv: any) => addressRule(v, fv, 'city'),
|
|
53
|
-
error: () => ({
|
|
54
|
-
message: i18n.t('error.msg_value_required', { value: i18n.t('form.city') }),
|
|
55
|
-
}),
|
|
56
|
-
},
|
|
57
|
-
'address.state': {
|
|
58
|
-
for: 'address.state',
|
|
59
|
-
rule: (v: any, fv: any) => addressRule(v, fv, 'state'),
|
|
60
|
-
error: () => ({
|
|
61
|
-
message: i18n.t('error.msg_value_required', { value: i18n.t('form.state') }),
|
|
62
|
-
}),
|
|
63
|
-
},
|
|
64
|
-
'address.country': {
|
|
65
|
-
for: 'address.country',
|
|
66
|
-
rule: (v: any, fv: any) => addressRule(v, fv, 'country'),
|
|
67
|
-
error: () => ({
|
|
68
|
-
message: i18n.t('error.msg_value_required', { value: i18n.t('form.country') }),
|
|
69
|
-
}),
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
}();
|
|
73
|
-
|
|
74
13
|
/**
|
|
75
14
|
* Schema; Edit account
|
|
76
15
|
*/
|
|
77
16
|
|
|
78
17
|
export function makeEditOrganizationSchema(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
openModalPopUp: OpenModalPopUpFn
|
|
18
|
+
formId: string,
|
|
19
|
+
focusedName: string,
|
|
20
|
+
formValues: OrganizationGQL, // always append with "|| nodeData"
|
|
83
21
|
) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
placeholder: i18n.t('form.line1_ph'),
|
|
131
|
-
// autoComplete: 'off',
|
|
132
|
-
}
|
|
133
|
-
}, {
|
|
134
|
-
__type: 'input',
|
|
135
|
-
item: {
|
|
136
|
-
name: 'address.line2',
|
|
137
|
-
label: i18n.t('form.line2_optional'),
|
|
138
|
-
placeholder: i18n.t('form.line2_ph'),
|
|
139
|
-
// autoComplete: 'off',
|
|
140
|
-
}
|
|
141
|
-
}, {
|
|
142
|
-
__type: 'input',
|
|
143
|
-
item: {
|
|
144
|
-
name: 'address.postalCode',
|
|
145
|
-
label: i18n.t('form.postalCode'),
|
|
146
|
-
placeholder: formValues?.address?.postalCode || i18n.t('form.postalCode_ph'),
|
|
147
|
-
// autoComplete: 'off',
|
|
148
|
-
}
|
|
149
|
-
}, {
|
|
150
|
-
__type: 'group',
|
|
151
|
-
item: {
|
|
152
|
-
items: [{
|
|
153
|
-
__type: 'input',
|
|
154
|
-
item: {
|
|
155
|
-
name: 'address.city',
|
|
156
|
-
maxLength: MIN_LEN_VALUES.address_city,
|
|
157
|
-
label: i18n.t('form.city'),
|
|
158
|
-
placeholder: formValues?.address?.city || i18n.t('form.city_ph'),
|
|
159
|
-
},
|
|
160
|
-
}, {
|
|
161
|
-
__type: 'input',
|
|
162
|
-
item: {
|
|
163
|
-
name: 'address.state',
|
|
164
|
-
maxLength: MIN_LEN_VALUES.address_state,
|
|
165
|
-
label: i18n.t('form.state'),
|
|
166
|
-
placeholder: formValues?.address?.state,
|
|
167
|
-
},
|
|
168
|
-
}],
|
|
169
|
-
}
|
|
170
|
-
}, {
|
|
171
|
-
__type: 'input_click',
|
|
172
|
-
forceClickId: 'input_click_address.country',
|
|
173
|
-
label: i18n.t('form.country'),
|
|
174
|
-
item: {
|
|
175
|
-
label: i18n.t('form.country'),
|
|
176
|
-
locked: true,
|
|
177
|
-
focused: focusedName === (formId + '_address.country'),
|
|
178
|
-
name: 'address.country',
|
|
179
|
-
getter: (value: string) => value ? i18n.t(`country.from_code.${value}`) : '',
|
|
180
|
-
placeholder: formValues?.address?.country || i18n.t('form.country_ph'),
|
|
181
|
-
|
|
182
|
-
popOverProps: {
|
|
183
|
-
...poProps,
|
|
184
|
-
|
|
185
|
-
id: formId + '_address.country',
|
|
186
|
-
doNotFixToBottom: true,
|
|
187
|
-
iface: {
|
|
188
|
-
name: 'PO_LIST',
|
|
189
|
-
|
|
190
|
-
variables: {
|
|
191
|
-
designClassName: 'w_400',
|
|
192
|
-
className: 'max_h_50vh',
|
|
193
|
-
initialState: {
|
|
194
|
-
'address.country': formValues?.address?.country,
|
|
195
|
-
},
|
|
196
|
-
options: ['US','MX','CA'].map(cCode => ({
|
|
197
|
-
__type: 'LIST_ITEM' as const,
|
|
198
|
-
text: i18n.t(`country.from_code.${cCode}`),
|
|
199
|
-
// textClassName: 'ft_xs',
|
|
200
|
-
// rightIconClassName: 'ft_xs mb_2',
|
|
201
|
-
name: 'address.country',
|
|
202
|
-
value: cCode,
|
|
203
|
-
selected: formValues?.address?.country === cCode,
|
|
204
|
-
})).concat({
|
|
205
|
-
__type: 'BREAK' as const
|
|
206
|
-
}).concat(SUPPORTED_COUNTRIES.map(countryCode => ({
|
|
207
|
-
__type: 'LIST_ITEM' as const,
|
|
208
|
-
text: i18n.t(`country.from_code.${countryCode}`),
|
|
209
|
-
// textClassName: 'ft_xs',
|
|
210
|
-
// rightIconClassName: 'ft_xs mb_2',
|
|
211
|
-
name: 'address.country',
|
|
212
|
-
value: countryCode,
|
|
213
|
-
selected: formValues?.address?.country === countryCode,
|
|
214
|
-
})))
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
}],
|
|
220
|
-
rules: [
|
|
221
|
-
RULES['address.line1'],
|
|
222
|
-
RULES['address.postalCode'],
|
|
223
|
-
RULES['address.city'],
|
|
224
|
-
RULES['address.state'],
|
|
225
|
-
RULES['address.country'],
|
|
226
|
-
],
|
|
227
|
-
};
|
|
22
|
+
const addressSchema = makeAddressSchema(
|
|
23
|
+
formId,
|
|
24
|
+
focusedName,
|
|
25
|
+
formValues?.address,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
listData: [
|
|
30
|
+
{
|
|
31
|
+
// __type: 'subtitle',
|
|
32
|
+
// item: {
|
|
33
|
+
// text: i18n.t('account.profile'),
|
|
34
|
+
// },
|
|
35
|
+
// }, {
|
|
36
|
+
__type: 'input',
|
|
37
|
+
item: {
|
|
38
|
+
name: 'name',
|
|
39
|
+
maxLength: MIN_LEN_VALUES.name,
|
|
40
|
+
label: i18n.t('org.name_of'),
|
|
41
|
+
placeholder: formValues.name,
|
|
42
|
+
autoComplete: 'off',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
__type: 'input',
|
|
47
|
+
locked: true,
|
|
48
|
+
item: {
|
|
49
|
+
name: 'operation',
|
|
50
|
+
label: i18n.t('org.type_of'),
|
|
51
|
+
placeholder: i18n.t(`org.type.${formValues.operation}`),
|
|
52
|
+
getter: (value: string) => i18n.t(`org.type.${value}`),
|
|
53
|
+
autoComplete: 'off',
|
|
54
|
+
info: i18n.t('org.contact_to_change'),
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
__type: 'section_title',
|
|
59
|
+
item: {
|
|
60
|
+
title: i18n.t('form.address'),
|
|
61
|
+
description: i18n.t('org.address_notice_msg'),
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
...addressSchema.listData,
|
|
65
|
+
],
|
|
66
|
+
rules: [...addressSchema.rules],
|
|
67
|
+
};
|
|
228
68
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
OrganizationACL,
|
|
3
|
+
OrganizationRoleEnum,
|
|
4
|
+
} from './organization.d.ts';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Account; phone
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export interface AccountPhoneObj {
|
|
11
|
+
id: number;
|
|
12
|
+
number: string;
|
|
13
|
+
verified: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Account
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export interface AccountObj {
|
|
21
|
+
id: number | bigint;
|
|
22
|
+
readableId?: string | null;
|
|
23
|
+
settings: Record<string, any>;
|
|
24
|
+
profile: Partial<{
|
|
25
|
+
firstName: string;
|
|
26
|
+
lastName: string;
|
|
27
|
+
storageId: number | null;
|
|
28
|
+
// phone: AccountPhoneObj | null; // ?? This is a coding mistake, I think
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface AccountData {
|
|
33
|
+
__table: 'accounts';
|
|
34
|
+
|
|
35
|
+
id: number | bigint;
|
|
36
|
+
readableId?: string | null;
|
|
37
|
+
settings: Record<string, any>;
|
|
38
|
+
|
|
39
|
+
profile: {
|
|
40
|
+
__table: 'account_profiles';
|
|
41
|
+
id: number | bigint;
|
|
42
|
+
firstName: string;
|
|
43
|
+
lastName: string;
|
|
44
|
+
storageId: number | bigint | null;
|
|
45
|
+
};
|
|
46
|
+
phone: {
|
|
47
|
+
__table: 'account_phones';
|
|
48
|
+
id: number;
|
|
49
|
+
number: string;
|
|
50
|
+
verified: boolean;
|
|
51
|
+
banned: boolean;
|
|
52
|
+
editAt: Date;
|
|
53
|
+
};
|
|
54
|
+
email: {
|
|
55
|
+
__table: 'account_emails';
|
|
56
|
+
id: number;
|
|
57
|
+
address: string;
|
|
58
|
+
verified: boolean;
|
|
59
|
+
banned: boolean;
|
|
60
|
+
editAt: Date;
|
|
61
|
+
};
|
|
62
|
+
createdAt: Date;
|
|
63
|
+
updatedAt: Date;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Account with membership
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
export interface AccountMembershipData {
|
|
71
|
+
id: number;
|
|
72
|
+
accountId: number;
|
|
73
|
+
organizationId: number;
|
|
74
|
+
role: OrganizationRoleEnum;
|
|
75
|
+
acl: OrganizationACL;
|
|
76
|
+
notes?: string;
|
|
77
|
+
primary: boolean;
|
|
78
|
+
createdAt: Date;
|
|
79
|
+
updatedAt: Date;
|
|
80
|
+
account: AccountData;
|
|
81
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { AGENT_DOC_SURFACE_ENUMS } from '../constants/agentDoc.ts';
|
|
2
|
+
import type { DocAccessBaseObj } from './docAccess.d.ts';
|
|
3
|
+
|
|
4
|
+
export type AgentDocSurfaceEnum = (typeof AGENT_DOC_SURFACE_ENUMS)[number];
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Per-document AI settings stored in the agent_docs "settings" JSONB.
|
|
8
|
+
* Closed vocabulary sanitized by sanitizeAgentDocSettings on every write;
|
|
9
|
+
* every key is optional and absence means the default (fully visible and
|
|
10
|
+
* editable by agents, retrieval-only, never stale).
|
|
11
|
+
* - aiCannotEdit: agents may read the document but never modify it
|
|
12
|
+
* - aiCannotRead: the document is invisible to agents entirely (implies
|
|
13
|
+
* aiCannotEdit)
|
|
14
|
+
* - pinned: always inject the full document into the agent system prompt
|
|
15
|
+
* (ordered by the document "position"); unpinned documents are
|
|
16
|
+
* retrieval-only via the list/search/read tools
|
|
17
|
+
* - hiddenSurfaces: deny-list of agent surfaces the document is hidden from
|
|
18
|
+
* - reviewBy: ISO date; past it the document stays readable but agent tools
|
|
19
|
+
* flag it as stale ("verify with a human")
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export interface AgentDocSettingsObj {
|
|
23
|
+
aiCannotEdit?: boolean;
|
|
24
|
+
aiCannotRead?: boolean;
|
|
25
|
+
pinned?: boolean;
|
|
26
|
+
hiddenSurfaces?: AgentDocSurfaceEnum[];
|
|
27
|
+
reviewBy?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* One agent doc row as selected by the client GraphQL documents. The list
|
|
32
|
+
* query selects a content-free subset, so content/access are optional.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
export interface AgentDocGQL {
|
|
36
|
+
__deleted?: boolean;
|
|
37
|
+
|
|
38
|
+
id?: string | null;
|
|
39
|
+
cursor?: string | null;
|
|
40
|
+
organizationId?: string | null;
|
|
41
|
+
folderId?: string | null;
|
|
42
|
+
title?: string | null;
|
|
43
|
+
content?: string | null;
|
|
44
|
+
access?: DocAccessBaseObj | null;
|
|
45
|
+
settings?: AgentDocSettingsObj | null;
|
|
46
|
+
position?: number | null;
|
|
47
|
+
deletedAt?: string | null;
|
|
48
|
+
createdAt?: string | null;
|
|
49
|
+
updatedAt?: string | null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* One agent doc folder row (single-level folders; hard-deleted, so no
|
|
54
|
+
* deletedAt field).
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
export interface AgentDocFolderGQL {
|
|
58
|
+
id?: string | null;
|
|
59
|
+
organizationId?: string | null;
|
|
60
|
+
name?: string | null;
|
|
61
|
+
position?: number | null;
|
|
62
|
+
createdAt?: string | null;
|
|
63
|
+
updatedAt?: string | null;
|
|
64
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AGENT_MEMORY_CATEGORY_ENUMS,
|
|
3
|
+
AGENT_MEMORY_CREATED_VIA_ENUMS,
|
|
4
|
+
AGENT_MEMORY_SCOPE_ENUMS,
|
|
5
|
+
AGENT_MEMORY_STATUS_ENUMS,
|
|
6
|
+
AGENT_MEMORY_SURFACE_ENUMS,
|
|
7
|
+
} from '../constants/agentMemory.ts';
|
|
8
|
+
|
|
9
|
+
export type AgentMemoryScopeEnum = (typeof AGENT_MEMORY_SCOPE_ENUMS)[number];
|
|
10
|
+
export type AgentMemoryCategoryEnum =
|
|
11
|
+
(typeof AGENT_MEMORY_CATEGORY_ENUMS)[number];
|
|
12
|
+
export type AgentMemoryStatusEnum = (typeof AGENT_MEMORY_STATUS_ENUMS)[number];
|
|
13
|
+
export type AgentMemoryCreatedViaEnum =
|
|
14
|
+
(typeof AGENT_MEMORY_CREATED_VIA_ENUMS)[number];
|
|
15
|
+
export type AgentMemorySurfaceEnum =
|
|
16
|
+
(typeof AGENT_MEMORY_SURFACE_ENUMS)[number];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* One remembered fact.
|
|
20
|
+
*
|
|
21
|
+
* Exactly one subject column is set per scope: "accountId" for ACCOUNT,
|
|
22
|
+
* "counterpartyId" for COUNTERPARTY, neither for ORGANIZATION.
|
|
23
|
+
*
|
|
24
|
+
* "createdByCounterpartyId" marks an externally-authored row (an inbound email
|
|
25
|
+
* sender); the database constrains such a row to be COUNTERPARTY-scoped about
|
|
26
|
+
* that same counterparty.
|
|
27
|
+
*/
|
|
28
|
+
export interface AgentMemoryData {
|
|
29
|
+
__table: 'agent_memories';
|
|
30
|
+
id: bigint;
|
|
31
|
+
organizationId: bigint;
|
|
32
|
+
scope: AgentMemoryScopeEnum;
|
|
33
|
+
accountId: bigint | null;
|
|
34
|
+
counterpartyId: bigint | null;
|
|
35
|
+
category: AgentMemoryCategoryEnum;
|
|
36
|
+
surface: AgentMemorySurfaceEnum[] | null;
|
|
37
|
+
surfaceKey: string | null;
|
|
38
|
+
key: string;
|
|
39
|
+
content: string;
|
|
40
|
+
status: AgentMemoryStatusEnum;
|
|
41
|
+
permanent: boolean;
|
|
42
|
+
observedCount: number;
|
|
43
|
+
createdByAccountId: bigint | null;
|
|
44
|
+
createdByCounterpartyId: bigint | null;
|
|
45
|
+
createdVia: AgentMemoryCreatedViaEnum;
|
|
46
|
+
sourceMessageId: string | null;
|
|
47
|
+
updatedByAccountId: bigint | null;
|
|
48
|
+
expiresAt: Date | null;
|
|
49
|
+
createdAt: Date;
|
|
50
|
+
updatedAt: Date;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Immutable per-log provenance snapshot stored on logs."appliedMemories".
|
|
55
|
+
*
|
|
56
|
+
* "content" is a verbatim copy of what the rule said at write time, resolved
|
|
57
|
+
* by the server from the block it actually injected - never from
|
|
58
|
+
* model-supplied text. "reasoning" is model-generated and can be confabulated;
|
|
59
|
+
* it is a debugging aid, not evidence.
|
|
60
|
+
*/
|
|
61
|
+
export interface AppliedMemorySnapshotItem {
|
|
62
|
+
id: number;
|
|
63
|
+
// Verbatim copy of what the rule said at write time, parsed from the block
|
|
64
|
+
// the server actually injected. Scope is deliberately absent: it is not
|
|
65
|
+
// rendered into the prompt, and re-querying for it would let the snapshot
|
|
66
|
+
// drift from what the model actually saw.
|
|
67
|
+
content: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface AppliedMemoriesSnapshot {
|
|
71
|
+
v: 1;
|
|
72
|
+
reasoning?: string | null;
|
|
73
|
+
memories: AppliedMemorySnapshotItem[];
|
|
74
|
+
}
|