@jsb188/mday 1.1.2
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 +142 -0
- package/src/constants/agentMemory.ts +166 -0
- package/src/constants/agentNote.ts +212 -0
- package/src/constants/aiChat.ts +10 -0
- package/src/constants/billing.ts +126 -0
- package/src/constants/campaign.ts +236 -0
- package/src/constants/contact.ts +72 -0
- package/src/constants/csvExport.ts +133 -0
- package/src/constants/dataTable.ts +22 -0
- package/src/constants/dataTableFieldTypes.generated.ts +59 -0
- package/src/constants/docAccess.ts +33 -0
- package/src/constants/dt.ts +234 -0
- package/src/constants/email.ts +146 -0
- package/src/constants/fieldDoc.ts +104 -0
- package/src/constants/graphqlReactivity.ts +196 -0
- package/src/constants/inboundContact.ts +8 -0
- package/src/constants/integration.ts +13 -0
- package/src/constants/log.ts +21 -0
- package/src/constants/logDisplay/README.md +88 -0
- package/src/constants/logDisplay/defaults.ts +39 -0
- package/src/constants/logDisplay/index.ts +27 -0
- package/src/constants/logDisplay/operations/arable.ts +16 -0
- package/src/constants/logDisplay/operations/farmersMarket.ts +10 -0
- package/src/constants/logDisplay/operations/foodManufacturing.ts +13 -0
- package/src/constants/logDisplay/shared/accounting.ts +13 -0
- package/src/constants/logDisplay/shared/interactions.ts +13 -0
- package/src/constants/logDisplay/shared/rackTemperatures.ts +42 -0
- package/src/constants/logTaxonomy.generated.ts +2199 -0
- package/src/constants/noteDoc.ts +77 -0
- package/src/constants/organization.ts +60 -0
- package/src/constants/pageRoute.ts +23 -0
- package/src/constants/qrCode.ts +30 -0
- package/src/constants/sheet.ts +132 -0
- package/src/constants/sms.ts +18 -0
- package/src/constants/square.ts +16 -0
- package/src/constants/storage.ts +85 -0
- package/src/constants/usage.ts +82 -0
- package/src/constants/workflowSteps.ts +60 -0
- package/src/schemas/editLogEntry.ts +879 -0
- package/src/schemas/inboundContact.ts +77 -0
- package/src/schemas/logsQuery.ts +93 -0
- package/src/types/account.d.ts +81 -0
- package/src/types/agentMemory.d.ts +100 -0
- package/src/types/agentNote.d.ts +441 -0
- package/src/types/billing.d.ts +537 -0
- package/src/types/campaign.d.ts +1533 -0
- package/src/types/contact.d.ts +15 -0
- package/src/types/csvExport.d.ts +213 -0
- package/src/types/dataAnalysis.d.ts +44 -0
- package/src/types/dataTable.d.ts +159 -0
- package/src/types/definitionElement.d.ts +35 -0
- package/src/types/docAccess.d.ts +96 -0
- package/src/types/dt.d.ts +257 -0
- package/src/types/email.d.ts +231 -0
- package/src/types/emailReplyReport.d.ts +76 -0
- package/src/types/fieldDoc.d.ts +702 -0
- package/src/types/fieldDocContract.d.ts +90 -0
- package/src/types/inboundContact.d.ts +65 -0
- package/src/types/integration.d.ts +42 -0
- package/src/types/log.d.ts +338 -0
- package/src/types/logDisplay.types.ts +85 -0
- package/src/types/organization.d.ts +350 -0
- package/src/types/pageRoute.d.ts +48 -0
- package/src/types/qrCode.d.ts +96 -0
- package/src/types/richText.d.ts +81 -0
- package/src/types/sheet.d.ts +847 -0
- package/src/types/sms.d.ts +38 -0
- package/src/types/storage.d.ts +481 -0
- package/src/types/usage.d.ts +106 -0
- package/src/types/workflow.d.ts +435 -0
- package/src/utils/agentMemory.ts +15 -0
- package/src/utils/agentNote.ts +850 -0
- package/src/utils/aiChat.ts +43 -0
- package/src/utils/aiChatWork.ts +64 -0
- package/src/utils/billing.ts +37 -0
- package/src/utils/campaign.ts +1173 -0
- package/src/utils/campaignAI.ts +72 -0
- package/src/utils/campaignAccess.ts +239 -0
- package/src/utils/campaignEmail.ts +601 -0
- package/src/utils/campaignEmailCompiler.ts +372 -0
- package/src/utils/campaignEmailImages.ts +60 -0
- package/src/utils/campaignEmailStyles.ts +544 -0
- package/src/utils/campaignLifecycle.ts +104 -0
- package/src/utils/campaignPreview.ts +285 -0
- package/src/utils/contact.ts +50 -0
- package/src/utils/csvExport.ts +19 -0
- package/src/utils/dataTable.ts +311 -0
- package/src/utils/dataTableFieldTypeRegistry.ts +106 -0
- package/src/utils/dataTableRelativeDate.ts +447 -0
- package/src/utils/definitionElement.ts +84 -0
- package/src/utils/docAccess.ts +383 -0
- package/src/utils/documentName.ts +53 -0
- package/src/utils/email.ts +379 -0
- package/src/utils/emailReplyReport.test.ts +187 -0
- package/src/utils/emailReplyReport.ts +143 -0
- package/src/utils/fieldDoc.ts +157 -0
- package/src/utils/fieldDocAnswers.ts +128 -0
- package/src/utils/fieldDocDefaults.ts +36 -0
- package/src/utils/fieldDocProgram.ts +36 -0
- package/src/utils/fieldDocSummary.ts +30 -0
- package/src/utils/log.ts +357 -0
- package/src/utils/logDisplay.helpers.ts +177 -0
- package/src/utils/logDisplay.ts +87 -0
- package/src/utils/logRegistryValue.ts +90 -0
- package/src/utils/logStoreRead.ts +262 -0
- package/src/utils/logTaxonomy.helpers.ts +17 -0
- package/src/utils/logTaxonomy.ts +76 -0
- package/src/utils/logTaxonomyDisplay.ts +395 -0
- package/src/utils/noteDoc.ts +609 -0
- package/src/utils/organization.ts +669 -0
- package/src/utils/pageRoute.ts +71 -0
- package/src/utils/qrCode.helpers.ts +189 -0
- package/src/utils/qrCode.test.ts +519 -0
- package/src/utils/qrCode.ts +273 -0
- package/src/utils/richTextHTML.ts +385 -0
- package/src/utils/sheet.ts +262 -0
- package/src/utils/sheetAxisMove.ts +616 -0
- package/src/utils/sheetBootstrap.ts +1402 -0
- package/src/utils/sheetCellLiteral.ts +101 -0
- package/src/utils/sheetCommand.ts +358 -0
- package/src/utils/sheetDesign.ts +705 -0
- package/src/utils/sheetExport.ts +186 -0
- package/src/utils/sheetFeatureReference.ts +183 -0
- package/src/utils/sheetFormulaArgs.ts +168 -0
- package/src/utils/sheetFormulaCompile.ts +475 -0
- package/src/utils/sheetFormulaConditionalAggregate.ts +254 -0
- package/src/utils/sheetFormulaCriteria.ts +656 -0
- package/src/utils/sheetFormulaDate.ts +444 -0
- package/src/utils/sheetFormulaEvaluation.ts +899 -0
- package/src/utils/sheetFormulaEvaluator.ts +997 -0
- package/src/utils/sheetFormulaFunctionHandlers.ts +403 -0
- package/src/utils/sheetFormulaLogical.ts +116 -0
- package/src/utils/sheetFormulaLookup.ts +488 -0
- package/src/utils/sheetFormulaMath.ts +48 -0
- package/src/utils/sheetFormulaParser.ts +729 -0
- package/src/utils/sheetFormulaRange.ts +330 -0
- package/src/utils/sheetFormulaReference.ts +703 -0
- package/src/utils/sheetFormulaReferenceAggregates.ts +313 -0
- package/src/utils/sheetFormulaReferenceDates.ts +237 -0
- package/src/utils/sheetFormulaReferenceLogical.ts +330 -0
- package/src/utils/sheetFormulaReferenceLookup.ts +341 -0
- package/src/utils/sheetFormulaReferenceMath.ts +95 -0
- package/src/utils/sheetFormulaReferenceRewrite.ts +220 -0
- package/src/utils/sheetFormulaReferenceText.ts +462 -0
- package/src/utils/sheetFormulaSyntax.ts +1027 -0
- package/src/utils/sheetFormulaText.ts +430 -0
- package/src/utils/sheetJournal.ts +200 -0
- package/src/utils/sheetNumberFormat.ts +1012 -0
- package/src/utils/sheetPreview.ts +68 -0
- package/src/utils/sheetSequence.ts +118 -0
- package/src/utils/sheetSnapshot.ts +739 -0
- package/src/utils/sheetStructureEdit.ts +914 -0
- package/src/utils/sheetStructureReferences.ts +389 -0
- package/src/utils/square.ts +32 -0
- package/src/utils/storage.ts +198 -0
- package/src/utils/table-route.ts +262 -0
- package/src/utils/time.ts +12 -0
- package/src/utils/workflow.ts +506 -0
- package/src/utils/workflowLogFingerprint.ts +302 -0
- package/src/utils/workflowLogRevisionSnapshot.ts +424 -0
- package/src/utils/workflowProgress.ts +280 -0
- package/src/utils/workflowTriggers.ts +61 -0
- package/tests/agentNote.test.ts +395 -0
- package/tests/campaignAI.test.ts +119 -0
- package/tests/campaignAccess.test.ts +239 -0
- package/tests/campaignEmail.test.ts +441 -0
- package/tests/campaignLifecycle.test.ts +134 -0
- package/tests/campaignPublication.test.ts +309 -0
- package/tests/dataTableFieldTypeRegistry.test.ts +111 -0
- package/tests/dataTableRelativeDate.test.ts +412 -0
- package/tests/docAccess.test.ts +525 -0
- package/tests/editLogEntry.test.ts +112 -0
- package/tests/email.test.ts +39 -0
- package/tests/fieldDocProgram.test.ts +114 -0
- package/tests/logDisplay.fixtures.ts +67 -0
- package/tests/logDisplay.test.ts +227 -0
- package/tests/noteDoc.test.ts +514 -0
- package/tests/richTextHTML.test.ts +185 -0
- package/tests/sheetAxisMove.test.ts +352 -0
- package/tests/sheetBootstrap.test.ts +1967 -0
- package/tests/sheetFeatureReference.test.ts +22 -0
- package/tests/sheetFormulaCriteria.test.ts +269 -0
- package/tests/sheetFormulaEvaluator.test.ts +468 -0
- package/tests/sheetFormulaFunctions.test.ts +538 -0
- package/tests/sheetFormulaLanguage.test.ts +361 -0
- package/tests/sheetFormulaParity.fixtures.ts +872 -0
- package/tests/sheetFormulaParity.test.ts +188 -0
- package/tests/sheetFormulaRange.test.ts +167 -0
- package/tests/sheetFormulaReference.test.ts +78 -0
- package/tests/sheetFormulaReferenceRewrite.test.ts +117 -0
- package/tests/sheetFormulaTextDate.test.ts +512 -0
- package/tests/sheetSequence.test.ts +22 -0
- package/tests/sheetSnapshot.test.ts +134 -0
- package/tests/sheetStructureEdit.test.ts +537 -0
- package/tests/sheetStructureReferences.test.ts +589 -0
- package/tests/workflowLifecycleStatus.test.ts +60 -0
- package/tests/workflowLogFingerprint.test.ts +203 -0
- package/tests/workflowLogRevisionSnapshot.test.ts +96 -0
- package/tests/workflowProgress.test.ts +180 -0
- package/tests/workflowTriggers.test.ts +29 -0
- package/tsconfig.json +12 -0
- package/vitest.config.ts +8 -0
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AGENT_NOTE_ARCHIVE_SOURCE_ENUMS,
|
|
3
|
+
AGENT_NOTE_ATTENTION_SET_BY_ENUMS,
|
|
4
|
+
AGENT_NOTE_DEPENDENCY_SCOPE_TYPE_ENUMS,
|
|
5
|
+
AGENT_NOTE_EVENT_ACTOR_TYPE_ENUMS,
|
|
6
|
+
AGENT_NOTE_EVENT_TYPE_ENUMS,
|
|
7
|
+
AGENT_NOTE_KIND_ENUMS,
|
|
8
|
+
AGENT_NOTE_LINK_ENTITY_TYPE_ENUMS,
|
|
9
|
+
AGENT_NOTE_MARKDOWN_ISSUE_ENUMS,
|
|
10
|
+
AGENT_NOTE_PUBLISH_STATE_ENUMS,
|
|
11
|
+
} from '../constants/agentNote.ts';
|
|
12
|
+
import type { ACLPermissionCheck, PermissionCheckFor } from '../utils/organization.ts';
|
|
13
|
+
import type { DtQueryDisplayEnum } from './dt.d.ts';
|
|
14
|
+
|
|
15
|
+
export type AgentNoteKindEnum = (typeof AGENT_NOTE_KIND_ENUMS)[number];
|
|
16
|
+
export type AgentNoteLinkEntityTypeEnum = (typeof AGENT_NOTE_LINK_ENTITY_TYPE_ENUMS)[number];
|
|
17
|
+
export type AgentNoteMarkdownIssueEnum = (typeof AGENT_NOTE_MARKDOWN_ISSUE_ENUMS)[number];
|
|
18
|
+
export type AgentNoteArchiveSourceEnum = (typeof AGENT_NOTE_ARCHIVE_SOURCE_ENUMS)[number];
|
|
19
|
+
export type AgentNoteAttentionSetByEnum = (typeof AGENT_NOTE_ATTENTION_SET_BY_ENUMS)[number];
|
|
20
|
+
export type AgentNoteEventTypeEnum = (typeof AGENT_NOTE_EVENT_TYPE_ENUMS)[number];
|
|
21
|
+
export type AgentNoteEventActorTypeEnum = (typeof AGENT_NOTE_EVENT_ACTOR_TYPE_ENUMS)[number];
|
|
22
|
+
export type AgentNotePublishStateEnum = (typeof AGENT_NOTE_PUBLISH_STATE_ENUMS)[number];
|
|
23
|
+
export type AgentNoteDependencyScopeTypeEnum = (typeof AGENT_NOTE_DEPENDENCY_SCOPE_TYPE_ENUMS)[number];
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* Safe initial-discovery status, without internal reports or evidence details.
|
|
27
|
+
*/
|
|
28
|
+
export interface AgentNoteBootstrapProgressGQL {
|
|
29
|
+
outcome: 'CREATED' | 'NO_USEFUL_BRIEF' | 'BUDGET_REACHED' | 'NO_AUTHORIZED_MEMBER' | 'NO_ELIGIBLE_LOG_CONTEXT' | 'ERROR';
|
|
30
|
+
lastReviewedAt: string;
|
|
31
|
+
nextReviewAt: string | null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/*
|
|
35
|
+
* Explicitly supplied reference data, kept separate from live query results.
|
|
36
|
+
* The source and caveat describe provenance, not independently verified facts.
|
|
37
|
+
*/
|
|
38
|
+
export interface AgentNoteReferenceTable {
|
|
39
|
+
title: string;
|
|
40
|
+
source: string;
|
|
41
|
+
caveat: string | null;
|
|
42
|
+
columns: string[];
|
|
43
|
+
rows: Array<Array<string | number | null>>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Exact organization-memory facts retained with a note; unavailable sources are never used as current evidence. */
|
|
47
|
+
export interface AgentNoteContextMemory {
|
|
48
|
+
id: string;
|
|
49
|
+
key: string;
|
|
50
|
+
content: string;
|
|
51
|
+
version: string;
|
|
52
|
+
available: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* A rate must occur in the identified memory or reference row, together with every supported subject name. */
|
|
56
|
+
export interface AgentNoteRateSource {
|
|
57
|
+
memoryId: string | null;
|
|
58
|
+
tableIndex: number | null;
|
|
59
|
+
rowIndex: number | null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* A seller-specific instruction to sum every named component in a current answer. */
|
|
63
|
+
export interface AgentNoteComponentSum {
|
|
64
|
+
names: string[];
|
|
65
|
+
labels: string[];
|
|
66
|
+
source: AgentNoteRateSource;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* A narrow, auditable calculation contract; percentages and aliases are checked against their sources. */
|
|
70
|
+
export interface AgentNotePercentageCalculation {
|
|
71
|
+
subjectQuestion: string;
|
|
72
|
+
valueQuestions: string[];
|
|
73
|
+
rates: Array<{ names: string[]; percent: string; source: AgentNoteRateSource }>;
|
|
74
|
+
thousandsSource: AgentNoteRateSource | null;
|
|
75
|
+
// Older saved contexts have no component rules; new research output always supplies an array.
|
|
76
|
+
componentSums?: AgentNoteComponentSum[];
|
|
77
|
+
// Optional for saved contexts predating configurable presentation; null uses a wide, alphabetical table.
|
|
78
|
+
presentation?: { layout: 'WIDE' | 'SEPARATE'; sort: 'SUBJECT' | 'SOURCE' } | null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* Supporting facts and calculation inputs, maintained by refresh research without rewriting member instructions. */
|
|
82
|
+
export interface AgentNoteRefreshContext {
|
|
83
|
+
version: 1;
|
|
84
|
+
// Hash of member focus and reference tables at selection time.
|
|
85
|
+
inputHash?: string;
|
|
86
|
+
memorySearchTerms: string[];
|
|
87
|
+
memories: AgentNoteContextMemory[];
|
|
88
|
+
calculation: AgentNotePercentageCalculation | null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Internal refresh gate state: the evidence hash the current body was written
|
|
93
|
+
* against (a refresh whose evidence hashes the same is skipped unless it is
|
|
94
|
+
* forced), the conversation revisions it read, the archive's activity marker
|
|
95
|
+
* and paused workflows, and the merge review state.
|
|
96
|
+
*/
|
|
97
|
+
export type AgentNoteWatermarkObj = Record<string, unknown>;
|
|
98
|
+
|
|
99
|
+
/*
|
|
100
|
+
* One deterministic query failure retained with the published note.
|
|
101
|
+
*/
|
|
102
|
+
export interface AgentNoteRefreshQueryErrorObj {
|
|
103
|
+
name: string;
|
|
104
|
+
code: string;
|
|
105
|
+
message: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/*
|
|
109
|
+
* Query completeness computed from execution results rather than the writer's judgment.
|
|
110
|
+
*/
|
|
111
|
+
export interface AgentNoteRefreshQueriesObj {
|
|
112
|
+
total: number;
|
|
113
|
+
succeeded: number;
|
|
114
|
+
failed: number;
|
|
115
|
+
errors: AgentNoteRefreshQueryErrorObj[];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/*
|
|
119
|
+
* The latest completed attempt, which may fail without replacing the published note.
|
|
120
|
+
* UNSUPPORTED means the note's evidence could not be read for the reason in "error".
|
|
121
|
+
*/
|
|
122
|
+
export interface AgentNoteRefreshAttemptObj {
|
|
123
|
+
status: 'SUCCESS' | 'PARTIAL' | 'FAILED' | 'UNSUPPORTED';
|
|
124
|
+
completedAt: string;
|
|
125
|
+
error: string | null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* An unresolved calculation tied to the response and question in the published evidence. */
|
|
129
|
+
export interface AgentNoteCalculationIssue {
|
|
130
|
+
code: 'UNSUPPORTED_AMOUNT_FORMAT' | 'MISSING_RATE' | 'CONFLICTING_RATE';
|
|
131
|
+
responseRef: string;
|
|
132
|
+
subject: string;
|
|
133
|
+
questionKey: string | null;
|
|
134
|
+
questionLabel: string | null;
|
|
135
|
+
raw: string | null;
|
|
136
|
+
rawTruncated?: boolean;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Bounded diagnostics for the exact calculated body being published. */
|
|
140
|
+
export interface AgentNoteRefreshCalculationObj {
|
|
141
|
+
total: number;
|
|
142
|
+
truncated: boolean;
|
|
143
|
+
issues: AgentNoteCalculationIssue[];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/*
|
|
147
|
+
* Completeness of the currently published body, preserved when a later attempt fails.
|
|
148
|
+
* "truncated" means its evidence was incomplete or the draft was cut to fit the caps.
|
|
149
|
+
*/
|
|
150
|
+
export interface AgentNoteRefreshPublishedObj {
|
|
151
|
+
status: 'SUCCESS' | 'PARTIAL';
|
|
152
|
+
completedAt: string;
|
|
153
|
+
truncated: boolean;
|
|
154
|
+
queries: AgentNoteRefreshQueriesObj;
|
|
155
|
+
// Absent on legacy publications or reports without a server calculation, never inferred as zero issues.
|
|
156
|
+
calculation?: AgentNoteRefreshCalculationObj;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/*
|
|
160
|
+
* Refresh execution and publication state. An empty object means neither outcome is known yet.
|
|
161
|
+
*/
|
|
162
|
+
export interface AgentNoteRefreshOutcomeObj {
|
|
163
|
+
lastAttempt?: AgentNoteRefreshAttemptObj | null;
|
|
164
|
+
published?: AgentNoteRefreshPublishedObj | null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* One agent note row.
|
|
169
|
+
*
|
|
170
|
+
* Exactly the anchor column of the note's kind is set: "campaignId" for
|
|
171
|
+
* CAMPAIGN_FORM (one note per web form campaign) and CAMPAIGN_EMAIL,
|
|
172
|
+
* "fieldDocId" for FIELD_DOC, "reminderWorkflowId" for REMINDER, and none for INSIGHT. Only the AI writes
|
|
173
|
+
* "headline" and "body"; "focus" is written only by an organization member
|
|
174
|
+
* (or copied from the member-set template focus when a form campaign's note
|
|
175
|
+
* is created) and is trusted. "pinned" is set only by a member and is never
|
|
176
|
+
* changed by an automatic refresh.
|
|
177
|
+
*/
|
|
178
|
+
export interface AgentNoteData {
|
|
179
|
+
__table: 'agent_notes';
|
|
180
|
+
id: bigint;
|
|
181
|
+
organizationId: bigint;
|
|
182
|
+
kind: AgentNoteKindEnum;
|
|
183
|
+
campaignId: bigint | null;
|
|
184
|
+
fieldDocId: bigint | null;
|
|
185
|
+
reminderWorkflowId: bigint | null;
|
|
186
|
+
emoji: string;
|
|
187
|
+
headline: string | null;
|
|
188
|
+
body: string | null;
|
|
189
|
+
focus: string | null;
|
|
190
|
+
focusUpdatedByAccountId: bigint | null;
|
|
191
|
+
focusUpdatedAt: Date | null;
|
|
192
|
+
// Optional only for older captured rows; persisted notes default to [].
|
|
193
|
+
referenceTables?: AgentNoteReferenceTable[];
|
|
194
|
+
refreshContext?: AgentNoteRefreshContext | null;
|
|
195
|
+
needsAttention: boolean;
|
|
196
|
+
pinned: boolean;
|
|
197
|
+
archivedAt: Date | null;
|
|
198
|
+
archiveReason: string | null;
|
|
199
|
+
lastReadAt: Date | null;
|
|
200
|
+
retainedAt: Date | null;
|
|
201
|
+
dataChangedAt: Date;
|
|
202
|
+
refreshedAt: Date | null;
|
|
203
|
+
refreshOutcome: AgentNoteRefreshOutcomeObj;
|
|
204
|
+
refreshFailures: number;
|
|
205
|
+
watermark: AgentNoteWatermarkObj;
|
|
206
|
+
createdByAccountId: bigint | null;
|
|
207
|
+
// When the current body was published; null until the first publish
|
|
208
|
+
publishedAt: Date | null;
|
|
209
|
+
// When the latest refresh attempt finished, published or not
|
|
210
|
+
lastAttemptAt: Date | null;
|
|
211
|
+
// Why the note is archived; null while active
|
|
212
|
+
archiveSource: AgentNoteArchiveSourceEnum | null;
|
|
213
|
+
// The note a merge folded this one into
|
|
214
|
+
mergedIntoId: bigint | null;
|
|
215
|
+
// The next time a clock-only change (period rollover, deadline, lookback) can change the evidence
|
|
216
|
+
nextBoundaryAt: Date | null;
|
|
217
|
+
// Who set "needsAttention" last; null until either sets it
|
|
218
|
+
attentionSetBy: AgentNoteAttentionSetByEnum | null;
|
|
219
|
+
// The refresh model's 0-100 importance, the base of the effective priority
|
|
220
|
+
importance: number;
|
|
221
|
+
// Ledger-backed INSIGHT trackers collect from creation; log-query insights can read earlier history
|
|
222
|
+
createdAt: Date;
|
|
223
|
+
updatedAt: Date;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Who caused a progress history event. "accountId" is the person, "model" the
|
|
228
|
+
* model that wrote the change, and the run ids trace an assistant chat run or
|
|
229
|
+
* a workflow run.
|
|
230
|
+
*/
|
|
231
|
+
export interface AgentNoteEventActor {
|
|
232
|
+
type: AgentNoteEventActorTypeEnum;
|
|
233
|
+
accountId?: string | null;
|
|
234
|
+
aiChatRunId?: string | null;
|
|
235
|
+
workflowRunId?: string | null;
|
|
236
|
+
model?: string | null;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* One progress history event of a note (agent_note_events), newest kept per
|
|
241
|
+
* note. "summary" is the model's change summary for PUBLISHED, otherwise the
|
|
242
|
+
* reason or error.
|
|
243
|
+
*/
|
|
244
|
+
export interface AgentNoteEventData {
|
|
245
|
+
id: string;
|
|
246
|
+
agentNoteId: string;
|
|
247
|
+
at: Date;
|
|
248
|
+
event: AgentNoteEventTypeEnum;
|
|
249
|
+
actor: AgentNoteEventActorTypeEnum;
|
|
250
|
+
actorAccountId: string | null;
|
|
251
|
+
summary: string;
|
|
252
|
+
headline: string | null;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* One source scope a note reads beyond its anchor (agent_note_dependencies).
|
|
257
|
+
*/
|
|
258
|
+
export interface AgentNoteDependencyRef {
|
|
259
|
+
scopeType: AgentNoteDependencyScopeTypeEnum;
|
|
260
|
+
scopeId: string;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* New-activity marker of a default note's source: how many activity items
|
|
265
|
+
* (responses, replies, submissions or settled runs) exist and when the newest
|
|
266
|
+
* happened (ISO timestamp). An archived note restores only after it advances.
|
|
267
|
+
*/
|
|
268
|
+
export interface AgentNoteActivityMarker {
|
|
269
|
+
count: number;
|
|
270
|
+
lastAt: string | null;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* The focus an organization set on a web form template
|
|
275
|
+
* (agent_note_template_focuses). A CAMPAIGN_FORM note of a campaign created
|
|
276
|
+
* at or after "updatedAt" starts with this focus; earlier campaigns keep
|
|
277
|
+
* their own. Clearing the focus deletes the row.
|
|
278
|
+
*/
|
|
279
|
+
export interface AgentNoteTemplateFocusData {
|
|
280
|
+
__table: 'agent_note_template_focuses';
|
|
281
|
+
organizationId: bigint;
|
|
282
|
+
campaignTemplateId: bigint;
|
|
283
|
+
focus: string;
|
|
284
|
+
updatedByAccountId: bigint | null;
|
|
285
|
+
createdAt: Date;
|
|
286
|
+
updatedAt: Date;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Display data stored on a link so a note can show what it links to without
|
|
291
|
+
* joining every entity table.
|
|
292
|
+
*/
|
|
293
|
+
export interface AgentNoteLinkSnapshotObj {
|
|
294
|
+
title?: string | null;
|
|
295
|
+
[key: string]: unknown;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* One entity a note links to. "watch" makes a change to the entity refresh the
|
|
300
|
+
* note; "owned" marks an entity created for the note.
|
|
301
|
+
*/
|
|
302
|
+
export interface AgentNoteLinkData {
|
|
303
|
+
__table: 'agent_note_links';
|
|
304
|
+
agentNoteId: bigint;
|
|
305
|
+
organizationId: bigint;
|
|
306
|
+
entityType: AgentNoteLinkEntityTypeEnum;
|
|
307
|
+
entityId: bigint;
|
|
308
|
+
watch: boolean;
|
|
309
|
+
owned: boolean;
|
|
310
|
+
snapshot: AgentNoteLinkSnapshotObj;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Sanitized note body plus every kind of change the sanitizer made, in the
|
|
315
|
+
* fixed AGENT_NOTE_MARKDOWN_ISSUE_ENUMS order.
|
|
316
|
+
*/
|
|
317
|
+
export interface AgentNoteMarkdownSanitizeResult {
|
|
318
|
+
body: string;
|
|
319
|
+
issues: AgentNoteMarkdownIssueEnum[];
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* One answer read leniently as a number. "decoration" keeps the currency,
|
|
324
|
+
* percent sign or unit the number was written with ("$", "USD", "%", "kg"),
|
|
325
|
+
* so callers can avoid summing values written in different units.
|
|
326
|
+
*/
|
|
327
|
+
export type AgentNoteAnswerNumber =
|
|
328
|
+
| { numeric: true; value: number; decoration: string | null }
|
|
329
|
+
| { numeric: false; value: null; decoration: null };
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* The timestamps that count as note activity. Any of them may be missing.
|
|
333
|
+
*/
|
|
334
|
+
export interface AgentNoteActivitySource {
|
|
335
|
+
dataChangedAt?: Date | string | number | null;
|
|
336
|
+
lastReadAt?: Date | string | number | null;
|
|
337
|
+
retainedAt?: Date | string | number | null;
|
|
338
|
+
focusUpdatedAt?: Date | string | number | null;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Answer whether the viewer's ACL grants one permission level, for example
|
|
343
|
+
* `(check, required) => checkACLPermission(viewerOrg, check, required)`.
|
|
344
|
+
*/
|
|
345
|
+
export type AgentNoteACLChecker = (check: PermissionCheckFor, requiredPermission: ACLPermissionCheck) => boolean | null | undefined;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* One entity link of an agent note as GraphQL returns it. "title" comes from
|
|
349
|
+
* the snapshot stored with the link, so it may lag behind a later rename.
|
|
350
|
+
*/
|
|
351
|
+
export interface AgentNoteLinkGQL {
|
|
352
|
+
entityType: AgentNoteLinkEntityTypeEnum;
|
|
353
|
+
entityId: string;
|
|
354
|
+
watch: boolean;
|
|
355
|
+
owned: boolean;
|
|
356
|
+
title: string | null;
|
|
357
|
+
fieldDocProgramId?: string | null; // FIELD_DOC links only: the program whose page lists the form
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* One saved query result of a note as GraphQL returns it: markdown rendered
|
|
362
|
+
* on the server (units, currency, "(AI)" headers and readable ids), shown below the note body. "dataTableId" is set only for a live
|
|
363
|
+
* listed table; "markdown" is empty and "computedAt" null until the result is
|
|
364
|
+
* first computed.
|
|
365
|
+
*/
|
|
366
|
+
export interface AgentNoteResultBlockGQL {
|
|
367
|
+
name: string;
|
|
368
|
+
title: string | null;
|
|
369
|
+
display: DtQueryDisplayEnum;
|
|
370
|
+
markdown: string;
|
|
371
|
+
computedAt: string | null;
|
|
372
|
+
timeZone: string;
|
|
373
|
+
shownCount: number | null;
|
|
374
|
+
matchedCount: number | null;
|
|
375
|
+
dataTableId: string | null;
|
|
376
|
+
truncated: boolean;
|
|
377
|
+
error: string | null;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* One agent note as GraphQL returns it. List queries select the summary
|
|
382
|
+
* fields only (no body or links). Realtime fragments update shared content;
|
|
383
|
+
* viewer-specific management permissions come from authorized GraphQL reads.
|
|
384
|
+
*/
|
|
385
|
+
export interface AgentNoteGQL {
|
|
386
|
+
id: string;
|
|
387
|
+
organizationId: string;
|
|
388
|
+
kind: AgentNoteKindEnum;
|
|
389
|
+
canManage?: boolean;
|
|
390
|
+
canRefreshWithoutCooldown?: boolean;
|
|
391
|
+
canPin?: boolean;
|
|
392
|
+
canDelete?: boolean;
|
|
393
|
+
// The default note's source record (one set, matching the kind: the campaign for CAMPAIGN_FORM and CAMPAIGN_EMAIL); all null for INSIGHT
|
|
394
|
+
campaignId?: string | null;
|
|
395
|
+
fieldDocId?: string | null;
|
|
396
|
+
fieldDocProgramId?: string | null; // FIELD_DOC notes: the program whose page lists the form
|
|
397
|
+
reminderWorkflowId?: string | null;
|
|
398
|
+
emoji: string;
|
|
399
|
+
headline?: string | null;
|
|
400
|
+
body?: string | null;
|
|
401
|
+
focus?: string | null;
|
|
402
|
+
focusUpdatedAt?: string | null;
|
|
403
|
+
needsAttention: boolean;
|
|
404
|
+
pinned: boolean;
|
|
405
|
+
archivedAt: string | null;
|
|
406
|
+
archiveReason?: string | null;
|
|
407
|
+
lastReadAt?: string | null;
|
|
408
|
+
retainedAt?: string | null;
|
|
409
|
+
dataChangedAt: string;
|
|
410
|
+
refreshing?: boolean;
|
|
411
|
+
refreshAvailableAt?: string | null;
|
|
412
|
+
refreshedAt: string | null;
|
|
413
|
+
// When the current body was published (null before the first rewrite)
|
|
414
|
+
publishedAt?: string | null;
|
|
415
|
+
// The refresh model's 0-100 importance, and the read-time effective priority the homepage orders by
|
|
416
|
+
importance?: number;
|
|
417
|
+
priority?: number;
|
|
418
|
+
refreshOutcome?: AgentNoteRefreshOutcomeObj;
|
|
419
|
+
// The saved query results shown below the body (empty without saved queries)
|
|
420
|
+
resultBlocks?: AgentNoteResultBlockGQL[];
|
|
421
|
+
// The live listed data table the note owns (an INSIGHT note's source link)
|
|
422
|
+
ownedDataTableId?: string | null;
|
|
423
|
+
createdAt?: string;
|
|
424
|
+
updatedAt: string;
|
|
425
|
+
links?: AgentNoteLinkGQL[];
|
|
426
|
+
cursor?: string;
|
|
427
|
+
__deleted?: boolean;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* The organization's focus for a web form template as GraphQL returns it:
|
|
432
|
+
* the starting focus of the CAMPAIGN_FORM note of every campaign created
|
|
433
|
+
* from the template after "updatedAt". "focus" and "updatedAt" are null when
|
|
434
|
+
* no focus is set (new campaigns start with the default focus).
|
|
435
|
+
*/
|
|
436
|
+
export interface CampaignTemplateAgentNoteFocusGQL {
|
|
437
|
+
organizationId: string;
|
|
438
|
+
campaignTemplateId: string;
|
|
439
|
+
focus: string | null;
|
|
440
|
+
updatedAt: string | null;
|
|
441
|
+
}
|