@hraness/message-like-me 0.8.0
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/CHANGELOG.md +151 -0
- package/LICENSE +21 -0
- package/README.md +698 -0
- package/SECURITY.md +318 -0
- package/dist/agentic-messaging-v1.d.ts +179 -0
- package/dist/agentic-messaging-v1.js +52 -0
- package/dist/canonical-json.d.ts +3 -0
- package/dist/cli-bs3db5jr.js +643 -0
- package/dist/cli-d7qv38ab.js +485 -0
- package/dist/cli-kw20gkk3.js +5 -0
- package/dist/cli-qqafdvz9.js +5 -0
- package/dist/cli-ry4128kz.js +584 -0
- package/dist/cli-ththzwja.js +20 -0
- package/dist/cli-x1qncxm7.js +1078 -0
- package/dist/cli.js +9436 -0
- package/dist/ensoul-source-v1.d.ts +121 -0
- package/dist/ensoul-source-v1.js +24 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +47 -0
- package/dist/message-bundle-v1-identity.d.ts +2 -0
- package/dist/message-bundle-v1.d.ts +205 -0
- package/dist/message-bundle-v1.js +37 -0
- package/dist/message-bundle-v2-identity.d.ts +2 -0
- package/dist/message-bundle-v2.d.ts +215 -0
- package/dist/message-bundle-v2.js +43 -0
- package/dist/metrics.d.ts +41 -0
- package/dist/types.d.ts +568 -0
- package/docs/local-message-bundle-v1.md +245 -0
- package/docs/local-message-bundle-v2.md +167 -0
- package/docs/methodology.md +322 -0
- package/docs/research.md +164 -0
- package/package.json +82 -0
- package/schema/ensoul-messages-source-v1.schema.json +248 -0
- package/schema/local-message-bundle-v1.schema.json +449 -0
- package/schema/local-message-bundle-v2.schema.json +462 -0
- package/schema/style-profile-v1.schema.json +223 -0
- package/schema/style-profile-v2.schema.json +202 -0
- package/skills/ensoul/LICENSE +23 -0
- package/skills/ensoul/NOTICE.md +7 -0
- package/skills/ensoul/SKILL.md +226 -0
- package/skills/ensoul/VENDORED_FROM.md +7 -0
- package/skills/ensoul/agents/openai.yaml +4 -0
- package/skills/ensoul/references/ensoul-source-packet-v1.schema.json +187 -0
- package/skills/ensoul/references/evidence-method.md +148 -0
- package/skills/ensoul/references/output-blueprint.md +143 -0
- package/skills/ensoul/references/source-packets.md +139 -0
- package/skills/ensoul/scripts/prepare_x_archive.py +467 -0
- package/skills/ensoul/scripts/validate_source_packet.py +477 -0
- package/skills/message-like-me/SKILL.md +229 -0
- package/skills/message-like-me/agents/openai.yaml +4 -0
- package/skills/message-like-me/references/analysis.md +159 -0
- package/skills/message-like-me/references/drafting.md +86 -0
- package/skills/message-like-me/references/ensoul.md +94 -0
- package/skills/message-like-me/references/evaluation.md +81 -0
- package/skills/message-like-me/references/privacy.md +106 -0
- package/skills/message-like-me/references/profile-schema.md +148 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
LOCAL_MESSAGE_BUNDLE_V2_ARTIFACTS,
|
|
4
|
+
LOCAL_MESSAGE_BUNDLE_V2_FORMAT,
|
|
5
|
+
LOCAL_MESSAGE_BUNDLE_V2_LIMITS,
|
|
6
|
+
LOCAL_MESSAGE_BUNDLE_V2_NETWORK,
|
|
7
|
+
LOCAL_MESSAGE_BUNDLE_V2_PROVIDER_ID,
|
|
8
|
+
LOCAL_MESSAGE_BUNDLE_V2_PROVIDER_VERSION,
|
|
9
|
+
LOCAL_MESSAGE_BUNDLE_V2_SCHEMA_VERSION,
|
|
10
|
+
LOCAL_MESSAGE_BUNDLE_V2_SOURCE_ID,
|
|
11
|
+
LOCAL_MESSAGE_BUNDLE_V2_SOURCE_TRANSFORM_VERSION,
|
|
12
|
+
LOCAL_MESSAGE_BUNDLE_V2_SUPPORTED_SOURCE_TRANSFORM_VERSIONS,
|
|
13
|
+
MessageBundleV2ContractError,
|
|
14
|
+
assertLocalMessageBundleV2SourceTransformVersion,
|
|
15
|
+
isLocalMessageBundleV2SourceTransformVersion,
|
|
16
|
+
localMessageBundleV2BundleSha256,
|
|
17
|
+
localMessageBundleV2ManifestProjection,
|
|
18
|
+
parseLocalMessageBundleV2Manifest,
|
|
19
|
+
parseLocalMessageBundleV2Record,
|
|
20
|
+
parseLocalMessageBundleV2WhatsAppJid
|
|
21
|
+
} from "./cli-bs3db5jr.js";
|
|
22
|
+
import"./cli-kw20gkk3.js";
|
|
23
|
+
import"./cli-ththzwja.js";
|
|
24
|
+
export {
|
|
25
|
+
parseLocalMessageBundleV2WhatsAppJid,
|
|
26
|
+
parseLocalMessageBundleV2Record,
|
|
27
|
+
parseLocalMessageBundleV2Manifest,
|
|
28
|
+
localMessageBundleV2ManifestProjection,
|
|
29
|
+
localMessageBundleV2BundleSha256,
|
|
30
|
+
isLocalMessageBundleV2SourceTransformVersion,
|
|
31
|
+
assertLocalMessageBundleV2SourceTransformVersion,
|
|
32
|
+
MessageBundleV2ContractError,
|
|
33
|
+
LOCAL_MESSAGE_BUNDLE_V2_SUPPORTED_SOURCE_TRANSFORM_VERSIONS,
|
|
34
|
+
LOCAL_MESSAGE_BUNDLE_V2_SOURCE_TRANSFORM_VERSION,
|
|
35
|
+
LOCAL_MESSAGE_BUNDLE_V2_SOURCE_ID,
|
|
36
|
+
LOCAL_MESSAGE_BUNDLE_V2_SCHEMA_VERSION,
|
|
37
|
+
LOCAL_MESSAGE_BUNDLE_V2_PROVIDER_VERSION,
|
|
38
|
+
LOCAL_MESSAGE_BUNDLE_V2_PROVIDER_ID,
|
|
39
|
+
LOCAL_MESSAGE_BUNDLE_V2_NETWORK,
|
|
40
|
+
LOCAL_MESSAGE_BUNDLE_V2_LIMITS,
|
|
41
|
+
LOCAL_MESSAGE_BUNDLE_V2_FORMAT,
|
|
42
|
+
LOCAL_MESSAGE_BUNDLE_V2_ARTIFACTS
|
|
43
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ContactMetrics, type CorpusMessage, type CorpusReactionFact, type EvaluationPromptPacket, type EvaluationReferencePacket, type StudyPacket } from "./types.ts";
|
|
2
|
+
export type AnalyzeContactOptions = Readonly<{
|
|
3
|
+
sessionGapSeconds?: number;
|
|
4
|
+
burstGapSeconds?: number;
|
|
5
|
+
reactionFacts?: readonly CorpusReactionFact[];
|
|
6
|
+
}>;
|
|
7
|
+
export type BuildStudyPacketOptions = Readonly<{
|
|
8
|
+
limit?: number;
|
|
9
|
+
generatedAt?: string;
|
|
10
|
+
evidenceRevision?: string;
|
|
11
|
+
evidenceWindow?: Readonly<{
|
|
12
|
+
after?: string | null;
|
|
13
|
+
before?: string | null;
|
|
14
|
+
}>;
|
|
15
|
+
maxTextBytesPerMessage?: number;
|
|
16
|
+
maxMessagesPerDirectionPerExample?: number;
|
|
17
|
+
maxTotalBodyBytes?: number;
|
|
18
|
+
}>;
|
|
19
|
+
export type BuildEvaluationPacketsOptions = Readonly<{
|
|
20
|
+
limit?: number;
|
|
21
|
+
generatedAt?: string;
|
|
22
|
+
evidenceRevision?: string;
|
|
23
|
+
after: string;
|
|
24
|
+
before?: string | null;
|
|
25
|
+
maxTextBytesPerMessage?: number;
|
|
26
|
+
maxMessagesPerDirectionPerCase?: number;
|
|
27
|
+
maxTotalBodyBytes?: number;
|
|
28
|
+
}>;
|
|
29
|
+
export declare function messagesInTimeWindow(messages: readonly CorpusMessage[], window: Readonly<{
|
|
30
|
+
after?: string | null;
|
|
31
|
+
before?: string | null;
|
|
32
|
+
}>): readonly CorpusMessage[];
|
|
33
|
+
/** Analyze one already-selected contact or conversation corpus. */
|
|
34
|
+
export declare function analyzeContact(messages: readonly CorpusMessage[], corpusRevision: string, contactId: string, options?: AnalyzeContactOptions): ContactMetrics;
|
|
35
|
+
/** Build a bounded, deterministic set of diverse response-context examples. */
|
|
36
|
+
export declare function buildStudyPacket(messages: readonly CorpusMessage[], metrics: ContactMetrics, options?: BuildStudyPacketOptions): StudyPacket;
|
|
37
|
+
/** Build temporally held-out prompt and reference packets without model calls. */
|
|
38
|
+
export declare function buildEvaluationPackets(messages: readonly CorpusMessage[], metrics: ContactMetrics, options: BuildEvaluationPacketsOptions): Readonly<{
|
|
39
|
+
prompt: EvaluationPromptPacket;
|
|
40
|
+
reference: EvaluationReferencePacket;
|
|
41
|
+
}>;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
export declare const CORPUS_SCHEMA_VERSION: 2;
|
|
2
|
+
export declare const METRICS_SCHEMA_VERSION: 3;
|
|
3
|
+
export declare const PROFILE_SCHEMA_VERSION: 2;
|
|
4
|
+
export declare const LEGACY_PROFILE_SCHEMA_VERSION: 1;
|
|
5
|
+
export declare const STUDY_PACKET_SCHEMA_VERSION: 3;
|
|
6
|
+
export declare const EVALUATION_PACKET_SCHEMA_VERSION: 2;
|
|
7
|
+
export declare const CONTACTS_SCHEMA_VERSION: 1;
|
|
8
|
+
export declare const MESSAGE_BUNDLE_SCHEMA_VERSION: 1;
|
|
9
|
+
export declare const MESSAGE_BUNDLE_SCHEMA_VERSIONS: readonly [1, 2];
|
|
10
|
+
export type Direction = "incoming" | "outgoing";
|
|
11
|
+
export type BodySource = "text" | "attributed-body" | "unavailable";
|
|
12
|
+
export type ReplyState = "explicit" | "none" | "unavailable";
|
|
13
|
+
export type MessageKind = "text" | "attachment" | "reaction" | "system" | "unknown";
|
|
14
|
+
export type SourceIdentity = Readonly<{
|
|
15
|
+
physicalPath: string;
|
|
16
|
+
device: string;
|
|
17
|
+
inode: string;
|
|
18
|
+
bytes: number;
|
|
19
|
+
modifiedAt: string;
|
|
20
|
+
schemaSha256: string;
|
|
21
|
+
snapshotSha256: string;
|
|
22
|
+
}>;
|
|
23
|
+
export type CorpusConversation = Readonly<{
|
|
24
|
+
id: string;
|
|
25
|
+
sourceKey: string;
|
|
26
|
+
privateLabel: string | null;
|
|
27
|
+
service: string | null;
|
|
28
|
+
participantCount: number;
|
|
29
|
+
participantIds: readonly string[];
|
|
30
|
+
privateParticipants: readonly string[];
|
|
31
|
+
group: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
export type CorpusMessage = Readonly<{
|
|
34
|
+
id: string;
|
|
35
|
+
sourceRowId: number;
|
|
36
|
+
sourceGuid: string;
|
|
37
|
+
conversationId: string;
|
|
38
|
+
sentAt: string;
|
|
39
|
+
direction: Direction;
|
|
40
|
+
body: string | null;
|
|
41
|
+
bodySource: BodySource;
|
|
42
|
+
kind: MessageKind;
|
|
43
|
+
replyToSourceGuid: string | null;
|
|
44
|
+
/** Whether this source observed an explicit reply, observed no reply, or cannot report reply links. */
|
|
45
|
+
replyState: ReplyState;
|
|
46
|
+
editedAt: string | null;
|
|
47
|
+
retractedAt: string | null;
|
|
48
|
+
service: string | null;
|
|
49
|
+
attachmentCount: number;
|
|
50
|
+
}>;
|
|
51
|
+
export type CorpusSnapshot = Readonly<{
|
|
52
|
+
schemaVersion: typeof CORPUS_SCHEMA_VERSION;
|
|
53
|
+
source: SourceIdentity;
|
|
54
|
+
conversations: readonly CorpusConversation[];
|
|
55
|
+
messages: readonly CorpusMessage[];
|
|
56
|
+
warnings: readonly string[];
|
|
57
|
+
}>;
|
|
58
|
+
export type CorpusSourceKind = "imessage" | "bundle" | "x-archive";
|
|
59
|
+
export type CorpusSourceCoverage = Readonly<{
|
|
60
|
+
history: "complete-current-local" | "bounded" | "unknown";
|
|
61
|
+
observedFrom: string | null;
|
|
62
|
+
observedTo: string | null;
|
|
63
|
+
/** Producer-specific completeness classification, when the import format has one. */
|
|
64
|
+
kind?: string;
|
|
65
|
+
/** Producer-supplied categorical reason for incomplete coverage. */
|
|
66
|
+
reason?: string | null;
|
|
67
|
+
}>;
|
|
68
|
+
export type CorpusSourceDescriptor = Readonly<{
|
|
69
|
+
/** Per-install source pseudonym used by the local store and CLI. */
|
|
70
|
+
id: string;
|
|
71
|
+
kind: CorpusSourceKind;
|
|
72
|
+
provider: string;
|
|
73
|
+
network: string | null;
|
|
74
|
+
/** Private provider account identifier. Ordinary source views omit it. */
|
|
75
|
+
accountId: string | null;
|
|
76
|
+
/** Private producer-local source identifier. Ordinary source views omit it. */
|
|
77
|
+
externalId: string;
|
|
78
|
+
revision: string;
|
|
79
|
+
generatedAt: string | null;
|
|
80
|
+
producer: Readonly<{
|
|
81
|
+
id: string;
|
|
82
|
+
version: string;
|
|
83
|
+
}>;
|
|
84
|
+
coverage: CorpusSourceCoverage;
|
|
85
|
+
manifestSha256: string | null;
|
|
86
|
+
identity: unknown;
|
|
87
|
+
warnings: readonly string[];
|
|
88
|
+
}>;
|
|
89
|
+
export type CorpusConversationProvenance = Readonly<{
|
|
90
|
+
conversationId: string;
|
|
91
|
+
externalId: string;
|
|
92
|
+
metadata?: unknown;
|
|
93
|
+
}>;
|
|
94
|
+
export type CorpusAttachmentProvenance = Readonly<{
|
|
95
|
+
id: string;
|
|
96
|
+
kind: string | null;
|
|
97
|
+
mimeType: string | null;
|
|
98
|
+
fileName: string | null;
|
|
99
|
+
bytes: number | null;
|
|
100
|
+
}>;
|
|
101
|
+
export type CorpusMessageProvenance = Readonly<{
|
|
102
|
+
messageId: string;
|
|
103
|
+
externalId: string;
|
|
104
|
+
/** Provider ordering coordinate. Null when this record has no such coordinate. */
|
|
105
|
+
providerSortKey: string | null;
|
|
106
|
+
replyToExternalId: string | null;
|
|
107
|
+
attachments: readonly CorpusAttachmentProvenance[];
|
|
108
|
+
metadata?: unknown;
|
|
109
|
+
}>;
|
|
110
|
+
export type CorpusReactionFact = Readonly<{
|
|
111
|
+
id: string;
|
|
112
|
+
externalId: string;
|
|
113
|
+
targetExternalId: string;
|
|
114
|
+
conversationId: string | null;
|
|
115
|
+
direction: Direction | null;
|
|
116
|
+
body: string;
|
|
117
|
+
reactedAt: string | null;
|
|
118
|
+
state: "active" | "removed";
|
|
119
|
+
}>;
|
|
120
|
+
export type CorpusSourceRecord = Readonly<{
|
|
121
|
+
kind: "account" | "participant" | "reaction" | "tombstone" | "excluded-message";
|
|
122
|
+
id: string;
|
|
123
|
+
record: unknown;
|
|
124
|
+
}>;
|
|
125
|
+
export type CorpusSourceDeletion = Readonly<{
|
|
126
|
+
entityKind: "account" | "participant" | "conversation" | "message" | "reaction" | "reaction-timeline";
|
|
127
|
+
localEntityId: string | null;
|
|
128
|
+
externalId: string;
|
|
129
|
+
deletedAt: string;
|
|
130
|
+
expectedConversationId?: string;
|
|
131
|
+
reason?: "tombstone" | "explicit-exclusion" | "replacement";
|
|
132
|
+
}>;
|
|
133
|
+
export type SourceCorpusSnapshot = Readonly<{
|
|
134
|
+
source: CorpusSourceDescriptor;
|
|
135
|
+
conversations: readonly CorpusConversation[];
|
|
136
|
+
conversationProvenance: readonly CorpusConversationProvenance[];
|
|
137
|
+
messages: readonly CorpusMessage[];
|
|
138
|
+
messageProvenance: readonly CorpusMessageProvenance[];
|
|
139
|
+
reactionFacts?: readonly CorpusReactionFact[];
|
|
140
|
+
auxiliaryRecords?: readonly CorpusSourceRecord[];
|
|
141
|
+
deletions?: readonly CorpusSourceDeletion[];
|
|
142
|
+
}>;
|
|
143
|
+
export type MessageBundleSnapshot = Readonly<{
|
|
144
|
+
schemaVersion: typeof MESSAGE_BUNDLE_SCHEMA_VERSIONS[number];
|
|
145
|
+
manifestSha256: string;
|
|
146
|
+
sources: readonly SourceCorpusSnapshot[];
|
|
147
|
+
}>;
|
|
148
|
+
export type ContactHandle = Readonly<{
|
|
149
|
+
kind: "email" | "phone";
|
|
150
|
+
normalizedValue: string;
|
|
151
|
+
/** Per-install HMAC used by the local store instead of persisting the value. */
|
|
152
|
+
matchId: string;
|
|
153
|
+
}>;
|
|
154
|
+
export type AddressBookContact = Readonly<{
|
|
155
|
+
/** Per-install pseudonym for the source AddressBook record. */
|
|
156
|
+
id: string;
|
|
157
|
+
/** Sensitive local label. Ordinary aggregate commands never emit it. */
|
|
158
|
+
privateLabel: string | null;
|
|
159
|
+
privateLabelBasis: "display-name" | "name-parts" | "organization" | null;
|
|
160
|
+
handles: readonly ContactHandle[];
|
|
161
|
+
}>;
|
|
162
|
+
export type AddressBookSourceIdentity = Readonly<{
|
|
163
|
+
physicalPath: string;
|
|
164
|
+
device: string;
|
|
165
|
+
inode: string;
|
|
166
|
+
bytes: number;
|
|
167
|
+
modifiedAt: string;
|
|
168
|
+
schemaSha256: string;
|
|
169
|
+
}>;
|
|
170
|
+
export type ContactsSnapshot = Readonly<{
|
|
171
|
+
schemaVersion: typeof CONTACTS_SCHEMA_VERSION;
|
|
172
|
+
snapshotSha256: string;
|
|
173
|
+
sources: readonly AddressBookSourceIdentity[];
|
|
174
|
+
contacts: readonly AddressBookContact[];
|
|
175
|
+
warnings: readonly string[];
|
|
176
|
+
}>;
|
|
177
|
+
export type SessionMetric = Readonly<{
|
|
178
|
+
id: string;
|
|
179
|
+
startedAt: string;
|
|
180
|
+
endedAt: string;
|
|
181
|
+
durationSeconds: number;
|
|
182
|
+
messageCount: number;
|
|
183
|
+
incomingCount: number;
|
|
184
|
+
outgoingCount: number;
|
|
185
|
+
startedBy: Direction;
|
|
186
|
+
endedBy: Direction;
|
|
187
|
+
}>;
|
|
188
|
+
export type BurstMetric = Readonly<{
|
|
189
|
+
id: string;
|
|
190
|
+
sessionId: string;
|
|
191
|
+
startedAt: string;
|
|
192
|
+
endedAt: string;
|
|
193
|
+
durationSeconds: number;
|
|
194
|
+
direction: Direction;
|
|
195
|
+
messageIds: readonly string[];
|
|
196
|
+
messageCount: number;
|
|
197
|
+
textMessageCount: number;
|
|
198
|
+
characters: number;
|
|
199
|
+
}>;
|
|
200
|
+
export type ResponseEpisode = Readonly<{
|
|
201
|
+
id: string;
|
|
202
|
+
startedAt: string;
|
|
203
|
+
incomingMessageIds: readonly string[];
|
|
204
|
+
outgoingMessageIds: readonly string[];
|
|
205
|
+
incomingCount: number;
|
|
206
|
+
outgoingCount: number;
|
|
207
|
+
incomingCharacters: number;
|
|
208
|
+
outgoingCharacters: number;
|
|
209
|
+
incomingQuestions: number;
|
|
210
|
+
latencySeconds: number;
|
|
211
|
+
explicitReplyCount: number;
|
|
212
|
+
replyEligibleCount: number;
|
|
213
|
+
replyUnavailableCount: number;
|
|
214
|
+
tags: readonly string[];
|
|
215
|
+
}>;
|
|
216
|
+
export type SurfaceStyleMetrics = Readonly<{
|
|
217
|
+
outgoingTextMessages: number;
|
|
218
|
+
characters: Readonly<{
|
|
219
|
+
total: number;
|
|
220
|
+
mean: number;
|
|
221
|
+
median: number;
|
|
222
|
+
p90: number;
|
|
223
|
+
}>;
|
|
224
|
+
words: Readonly<{
|
|
225
|
+
total: number;
|
|
226
|
+
mean: number;
|
|
227
|
+
median: number;
|
|
228
|
+
p90: number;
|
|
229
|
+
}>;
|
|
230
|
+
lowercaseStartsRatio: number;
|
|
231
|
+
terminalPunctuationRatio: number;
|
|
232
|
+
questionRatio: number;
|
|
233
|
+
exclamationRatio: number;
|
|
234
|
+
emojiMessageRatio: number;
|
|
235
|
+
multilineRatio: number;
|
|
236
|
+
}>;
|
|
237
|
+
export type TempoMetrics = Readonly<{
|
|
238
|
+
responseEpisodes: number;
|
|
239
|
+
responseLatencySeconds: Readonly<{
|
|
240
|
+
median: number | null;
|
|
241
|
+
p25: number | null;
|
|
242
|
+
p75: number | null;
|
|
243
|
+
p90: number | null;
|
|
244
|
+
}>;
|
|
245
|
+
outgoingMessagesPerResponse: Readonly<{
|
|
246
|
+
mean: number;
|
|
247
|
+
median: number;
|
|
248
|
+
p90: number;
|
|
249
|
+
singleRatio: number;
|
|
250
|
+
multiRatio: number;
|
|
251
|
+
}>;
|
|
252
|
+
explicitReplyMessages: number;
|
|
253
|
+
explicitReplyEligibleMessages: number;
|
|
254
|
+
explicitReplyUnavailableMessages: number;
|
|
255
|
+
explicitReplyRatio: number | null;
|
|
256
|
+
multiIncomingEpisodes: number;
|
|
257
|
+
multiQuestionEpisodes: number;
|
|
258
|
+
}>;
|
|
259
|
+
export type ReactionMetrics = Readonly<{
|
|
260
|
+
total: number;
|
|
261
|
+
incoming: number;
|
|
262
|
+
outgoing: number;
|
|
263
|
+
unknownDirection: number;
|
|
264
|
+
dated: number;
|
|
265
|
+
undated: number;
|
|
266
|
+
outgoingReactionRatio: number;
|
|
267
|
+
}>;
|
|
268
|
+
export type ContactMetrics = Readonly<{
|
|
269
|
+
schemaVersion: typeof METRICS_SCHEMA_VERSION;
|
|
270
|
+
corpusRevision: string;
|
|
271
|
+
contactId: string;
|
|
272
|
+
firstMessageAt: string | null;
|
|
273
|
+
lastMessageAt: string | null;
|
|
274
|
+
messageCount: number;
|
|
275
|
+
incomingCount: number;
|
|
276
|
+
outgoingCount: number;
|
|
277
|
+
textMessageCount: number;
|
|
278
|
+
sessionGapSeconds: number;
|
|
279
|
+
burstGapSeconds: number;
|
|
280
|
+
sessions: readonly SessionMetric[];
|
|
281
|
+
bursts: readonly BurstMetric[];
|
|
282
|
+
responses: readonly ResponseEpisode[];
|
|
283
|
+
tempo: TempoMetrics;
|
|
284
|
+
reactions: ReactionMetrics;
|
|
285
|
+
surface: SurfaceStyleMetrics;
|
|
286
|
+
}>;
|
|
287
|
+
export type StudyMessage = Readonly<{
|
|
288
|
+
id: string;
|
|
289
|
+
offsetSeconds: number;
|
|
290
|
+
direction: Direction;
|
|
291
|
+
body: string;
|
|
292
|
+
sourceBodyBytes: number;
|
|
293
|
+
emittedBodyBytes: number;
|
|
294
|
+
bodyTruncated: boolean;
|
|
295
|
+
/** Null means the source cannot report whether this message used an explicit reply link. */
|
|
296
|
+
explicitReply: boolean | null;
|
|
297
|
+
}>;
|
|
298
|
+
export type StudyAggregateMetrics = Readonly<{
|
|
299
|
+
schemaVersion: typeof METRICS_SCHEMA_VERSION;
|
|
300
|
+
firstMessageAt: string | null;
|
|
301
|
+
lastMessageAt: string | null;
|
|
302
|
+
messageCount: number;
|
|
303
|
+
incomingCount: number;
|
|
304
|
+
outgoingCount: number;
|
|
305
|
+
textMessageCount: number;
|
|
306
|
+
sessionGapSeconds: number;
|
|
307
|
+
burstGapSeconds: number;
|
|
308
|
+
sessionCount: number;
|
|
309
|
+
burstCount: number;
|
|
310
|
+
responseCount: number;
|
|
311
|
+
tempo: TempoMetrics;
|
|
312
|
+
reactions: ReactionMetrics;
|
|
313
|
+
surface: SurfaceStyleMetrics;
|
|
314
|
+
}>;
|
|
315
|
+
export type StudyExampleCoverage = Readonly<{
|
|
316
|
+
source: Readonly<{
|
|
317
|
+
responseIncomingMessages: number;
|
|
318
|
+
responseOutgoingMessages: number;
|
|
319
|
+
eligibleIncomingTextMessages: number;
|
|
320
|
+
eligibleOutgoingTextMessages: number;
|
|
321
|
+
bodyBytes: number;
|
|
322
|
+
}>;
|
|
323
|
+
emitted: Readonly<{
|
|
324
|
+
incomingTextMessages: number;
|
|
325
|
+
outgoingTextMessages: number;
|
|
326
|
+
bodyBytes: number;
|
|
327
|
+
truncatedMessages: number;
|
|
328
|
+
}>;
|
|
329
|
+
omitted: Readonly<{
|
|
330
|
+
missingMessages: number;
|
|
331
|
+
nonTextOrBodylessMessages: number;
|
|
332
|
+
incomingTextMessagesByDirectionLimit: number;
|
|
333
|
+
outgoingTextMessagesByDirectionLimit: number;
|
|
334
|
+
}>;
|
|
335
|
+
}>;
|
|
336
|
+
export type StudyExample = Readonly<{
|
|
337
|
+
id: string;
|
|
338
|
+
tags: readonly string[];
|
|
339
|
+
startedAt: string;
|
|
340
|
+
messages: readonly StudyMessage[];
|
|
341
|
+
coverage: StudyExampleCoverage;
|
|
342
|
+
}>;
|
|
343
|
+
export type StudyPacket = Readonly<{
|
|
344
|
+
schemaVersion: typeof STUDY_PACKET_SCHEMA_VERSION;
|
|
345
|
+
generatedAt: string;
|
|
346
|
+
corpusRevision: string;
|
|
347
|
+
evidenceRevision: string;
|
|
348
|
+
contactId: string;
|
|
349
|
+
evidenceWindow: Readonly<{
|
|
350
|
+
after: string | null;
|
|
351
|
+
before: string | null;
|
|
352
|
+
}>;
|
|
353
|
+
metrics: StudyAggregateMetrics;
|
|
354
|
+
examples: readonly StudyExample[];
|
|
355
|
+
selection: Readonly<{
|
|
356
|
+
algorithm: "bounded-diverse-response-contexts-v1";
|
|
357
|
+
requestedLimit: number;
|
|
358
|
+
responseCandidates: number;
|
|
359
|
+
eligibleCandidates: number;
|
|
360
|
+
emitted: number;
|
|
361
|
+
omittedWithoutBidirectionalText: number;
|
|
362
|
+
omittedByExampleLimit: number;
|
|
363
|
+
omittedByTotalBodyBytes: number;
|
|
364
|
+
}>;
|
|
365
|
+
budget: Readonly<{
|
|
366
|
+
maxTextBytesPerMessage: number;
|
|
367
|
+
maxMessagesPerDirectionPerExample: number;
|
|
368
|
+
maxTotalBodyBytes: number;
|
|
369
|
+
emittedBodyBytes: number;
|
|
370
|
+
sourceBodyBytesInEmittedExamples: number;
|
|
371
|
+
truncatedMessages: number;
|
|
372
|
+
omittedTextMessagesByDirectionLimit: number;
|
|
373
|
+
omittedExamplesByTotalBodyBytes: number;
|
|
374
|
+
omittedExampleBodyBytes: number;
|
|
375
|
+
}>;
|
|
376
|
+
}>;
|
|
377
|
+
export type EvaluationPromptCase = Readonly<{
|
|
378
|
+
id: string;
|
|
379
|
+
startedAt: string;
|
|
380
|
+
incoming: readonly StudyMessage[];
|
|
381
|
+
}>;
|
|
382
|
+
export type EvaluationReferenceCase = Readonly<{
|
|
383
|
+
id: string;
|
|
384
|
+
startedAt: string;
|
|
385
|
+
outgoing: readonly StudyMessage[];
|
|
386
|
+
shape: Readonly<{
|
|
387
|
+
bubbles: number;
|
|
388
|
+
characters: number;
|
|
389
|
+
words: number;
|
|
390
|
+
explicitReplyMessages: number;
|
|
391
|
+
explicitReplyEligibleMessages: number;
|
|
392
|
+
explicitReplyUnavailableMessages: number;
|
|
393
|
+
}>;
|
|
394
|
+
}>;
|
|
395
|
+
export type EvaluationPromptPacket = Readonly<{
|
|
396
|
+
schemaVersion: typeof EVALUATION_PACKET_SCHEMA_VERSION;
|
|
397
|
+
evaluationId: string;
|
|
398
|
+
generatedAt: string;
|
|
399
|
+
corpusRevision: string;
|
|
400
|
+
evidenceRevision: string;
|
|
401
|
+
contactId: string;
|
|
402
|
+
evidenceWindow: Readonly<{
|
|
403
|
+
after: string;
|
|
404
|
+
before: string | null;
|
|
405
|
+
}>;
|
|
406
|
+
cases: readonly EvaluationPromptCase[];
|
|
407
|
+
selection: Readonly<{
|
|
408
|
+
algorithm: "temporal-held-out-responses-v1";
|
|
409
|
+
requestedLimit: number;
|
|
410
|
+
eligibleCandidates: number;
|
|
411
|
+
emitted: number;
|
|
412
|
+
}>;
|
|
413
|
+
budget: Readonly<{
|
|
414
|
+
maxTextBytesPerMessage: number;
|
|
415
|
+
maxMessagesPerDirectionPerCase: number;
|
|
416
|
+
maxTotalBodyBytes: number;
|
|
417
|
+
emittedBodyBytes: number;
|
|
418
|
+
truncatedMessages: number;
|
|
419
|
+
}>;
|
|
420
|
+
}>;
|
|
421
|
+
export type EvaluationReferencePacket = Readonly<{
|
|
422
|
+
schemaVersion: typeof EVALUATION_PACKET_SCHEMA_VERSION;
|
|
423
|
+
evaluationId: string;
|
|
424
|
+
generatedAt: string;
|
|
425
|
+
corpusRevision: string;
|
|
426
|
+
evidenceRevision: string;
|
|
427
|
+
contactId: string;
|
|
428
|
+
evidenceWindow: Readonly<{
|
|
429
|
+
after: string;
|
|
430
|
+
before: string | null;
|
|
431
|
+
}>;
|
|
432
|
+
cases: readonly EvaluationReferenceCase[];
|
|
433
|
+
notice: "Open only after the candidate drafts for every case are fixed.";
|
|
434
|
+
}>;
|
|
435
|
+
export type StyleProfileV1 = Readonly<{
|
|
436
|
+
schemaVersion: typeof LEGACY_PROFILE_SCHEMA_VERSION;
|
|
437
|
+
contactId: string;
|
|
438
|
+
corpusRevision: string;
|
|
439
|
+
packetSha256: string;
|
|
440
|
+
analyzedAt: string;
|
|
441
|
+
overview: string;
|
|
442
|
+
prose: Readonly<{
|
|
443
|
+
register: string;
|
|
444
|
+
capitalization: string;
|
|
445
|
+
punctuation: string;
|
|
446
|
+
vocabulary: string;
|
|
447
|
+
warmth: string;
|
|
448
|
+
humor: string;
|
|
449
|
+
openings: readonly string[];
|
|
450
|
+
closings: readonly string[];
|
|
451
|
+
notablePatterns: readonly string[];
|
|
452
|
+
}>;
|
|
453
|
+
tempo: Readonly<{
|
|
454
|
+
defaultBundle: string;
|
|
455
|
+
singleLongMessage: string;
|
|
456
|
+
multipleMessages: string;
|
|
457
|
+
responseTiming: string;
|
|
458
|
+
followUps: string;
|
|
459
|
+
}>;
|
|
460
|
+
replies: Readonly<{
|
|
461
|
+
usage: string;
|
|
462
|
+
useWhen: readonly string[];
|
|
463
|
+
avoidWhen: readonly string[];
|
|
464
|
+
}>;
|
|
465
|
+
contexts: readonly Readonly<{
|
|
466
|
+
when: string;
|
|
467
|
+
incomingPattern: string;
|
|
468
|
+
responseStrategy: string;
|
|
469
|
+
prosePattern: string;
|
|
470
|
+
tempoPattern: string;
|
|
471
|
+
evidenceExampleIds: readonly string[];
|
|
472
|
+
}>[];
|
|
473
|
+
invariants: readonly string[];
|
|
474
|
+
avoid: readonly string[];
|
|
475
|
+
confidence: Readonly<{
|
|
476
|
+
overall: "low" | "medium" | "high";
|
|
477
|
+
limitations: readonly string[];
|
|
478
|
+
}>;
|
|
479
|
+
}>;
|
|
480
|
+
export type ProfileEvidenceV2 = Readonly<{
|
|
481
|
+
evidenceRevision: string;
|
|
482
|
+
firstMessageAt: string | null;
|
|
483
|
+
lastMessageAt: string | null;
|
|
484
|
+
messageCount: number;
|
|
485
|
+
outgoingTextMessages: number;
|
|
486
|
+
responseEpisodes: number;
|
|
487
|
+
studyExamples: number;
|
|
488
|
+
selectionAlgorithm: "bounded-diverse-response-contexts-v1";
|
|
489
|
+
after: string | null;
|
|
490
|
+
before: string | null;
|
|
491
|
+
}>;
|
|
492
|
+
export type ProfileClaimV2 = Readonly<{
|
|
493
|
+
dimension: "prose" | "tempo" | "reply" | "context";
|
|
494
|
+
statement: string;
|
|
495
|
+
basis: "measured" | "inferred";
|
|
496
|
+
appliesWhen: string;
|
|
497
|
+
supportExampleIds: readonly string[];
|
|
498
|
+
counterexampleIds: readonly string[];
|
|
499
|
+
supportCount: number;
|
|
500
|
+
confidence: "low" | "medium" | "high";
|
|
501
|
+
draftingConsequence: string;
|
|
502
|
+
}>;
|
|
503
|
+
export type StyleProfileV2 = Readonly<{
|
|
504
|
+
schemaVersion: typeof PROFILE_SCHEMA_VERSION;
|
|
505
|
+
contactId: string;
|
|
506
|
+
corpusRevision: string;
|
|
507
|
+
packetSha256: string;
|
|
508
|
+
analyzedAt: string;
|
|
509
|
+
evidence: ProfileEvidenceV2;
|
|
510
|
+
overview: string;
|
|
511
|
+
prose: Readonly<{
|
|
512
|
+
register: string;
|
|
513
|
+
capitalization: string;
|
|
514
|
+
punctuation: string;
|
|
515
|
+
vocabulary: string;
|
|
516
|
+
warmth: string;
|
|
517
|
+
humor: string;
|
|
518
|
+
openingPatterns: readonly string[];
|
|
519
|
+
closingPatterns: readonly string[];
|
|
520
|
+
notablePatterns: readonly string[];
|
|
521
|
+
}>;
|
|
522
|
+
tempo: Readonly<{
|
|
523
|
+
defaultBundle: string;
|
|
524
|
+
singleLongMessage: string;
|
|
525
|
+
multipleMessages: string;
|
|
526
|
+
responseTiming: string;
|
|
527
|
+
followUps: string;
|
|
528
|
+
}>;
|
|
529
|
+
replies: Readonly<{
|
|
530
|
+
usage: string;
|
|
531
|
+
useWhen: readonly string[];
|
|
532
|
+
avoidWhen: readonly string[];
|
|
533
|
+
}>;
|
|
534
|
+
contexts: readonly Readonly<{
|
|
535
|
+
when: string;
|
|
536
|
+
incomingPattern: string;
|
|
537
|
+
responseStrategy: string;
|
|
538
|
+
prosePattern: string;
|
|
539
|
+
tempoPattern: string;
|
|
540
|
+
evidenceExampleIds: readonly string[];
|
|
541
|
+
}>[];
|
|
542
|
+
claims: readonly ProfileClaimV2[];
|
|
543
|
+
invariants: readonly string[];
|
|
544
|
+
avoid: readonly string[];
|
|
545
|
+
confidence: Readonly<{
|
|
546
|
+
overall: "low" | "medium" | "high";
|
|
547
|
+
prose: "low" | "medium" | "high";
|
|
548
|
+
tempo: "low" | "medium" | "high";
|
|
549
|
+
replies: "low" | "medium" | "high";
|
|
550
|
+
contexts: "low" | "medium" | "high";
|
|
551
|
+
limitations: readonly string[];
|
|
552
|
+
}>;
|
|
553
|
+
}>;
|
|
554
|
+
export type StyleProfile = StyleProfileV1 | StyleProfileV2;
|
|
555
|
+
export type ContactSummary = Readonly<{
|
|
556
|
+
id: string;
|
|
557
|
+
privateLabel?: string | null;
|
|
558
|
+
scopeKind: "person" | "conversation";
|
|
559
|
+
conversationCount: number;
|
|
560
|
+
group: boolean;
|
|
561
|
+
participantCount: number;
|
|
562
|
+
firstMessageAt: string | null;
|
|
563
|
+
lastMessageAt: string | null;
|
|
564
|
+
messageCount: number;
|
|
565
|
+
incomingCount: number;
|
|
566
|
+
outgoingCount: number;
|
|
567
|
+
profileState: "missing" | "current" | "stale";
|
|
568
|
+
}>;
|