@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.
Files changed (56) hide show
  1. package/CHANGELOG.md +151 -0
  2. package/LICENSE +21 -0
  3. package/README.md +698 -0
  4. package/SECURITY.md +318 -0
  5. package/dist/agentic-messaging-v1.d.ts +179 -0
  6. package/dist/agentic-messaging-v1.js +52 -0
  7. package/dist/canonical-json.d.ts +3 -0
  8. package/dist/cli-bs3db5jr.js +643 -0
  9. package/dist/cli-d7qv38ab.js +485 -0
  10. package/dist/cli-kw20gkk3.js +5 -0
  11. package/dist/cli-qqafdvz9.js +5 -0
  12. package/dist/cli-ry4128kz.js +584 -0
  13. package/dist/cli-ththzwja.js +20 -0
  14. package/dist/cli-x1qncxm7.js +1078 -0
  15. package/dist/cli.js +9436 -0
  16. package/dist/ensoul-source-v1.d.ts +121 -0
  17. package/dist/ensoul-source-v1.js +24 -0
  18. package/dist/index.d.ts +3 -0
  19. package/dist/index.js +47 -0
  20. package/dist/message-bundle-v1-identity.d.ts +2 -0
  21. package/dist/message-bundle-v1.d.ts +205 -0
  22. package/dist/message-bundle-v1.js +37 -0
  23. package/dist/message-bundle-v2-identity.d.ts +2 -0
  24. package/dist/message-bundle-v2.d.ts +215 -0
  25. package/dist/message-bundle-v2.js +43 -0
  26. package/dist/metrics.d.ts +41 -0
  27. package/dist/types.d.ts +568 -0
  28. package/docs/local-message-bundle-v1.md +245 -0
  29. package/docs/local-message-bundle-v2.md +167 -0
  30. package/docs/methodology.md +322 -0
  31. package/docs/research.md +164 -0
  32. package/package.json +82 -0
  33. package/schema/ensoul-messages-source-v1.schema.json +248 -0
  34. package/schema/local-message-bundle-v1.schema.json +449 -0
  35. package/schema/local-message-bundle-v2.schema.json +462 -0
  36. package/schema/style-profile-v1.schema.json +223 -0
  37. package/schema/style-profile-v2.schema.json +202 -0
  38. package/skills/ensoul/LICENSE +23 -0
  39. package/skills/ensoul/NOTICE.md +7 -0
  40. package/skills/ensoul/SKILL.md +226 -0
  41. package/skills/ensoul/VENDORED_FROM.md +7 -0
  42. package/skills/ensoul/agents/openai.yaml +4 -0
  43. package/skills/ensoul/references/ensoul-source-packet-v1.schema.json +187 -0
  44. package/skills/ensoul/references/evidence-method.md +148 -0
  45. package/skills/ensoul/references/output-blueprint.md +143 -0
  46. package/skills/ensoul/references/source-packets.md +139 -0
  47. package/skills/ensoul/scripts/prepare_x_archive.py +467 -0
  48. package/skills/ensoul/scripts/validate_source_packet.py +477 -0
  49. package/skills/message-like-me/SKILL.md +229 -0
  50. package/skills/message-like-me/agents/openai.yaml +4 -0
  51. package/skills/message-like-me/references/analysis.md +159 -0
  52. package/skills/message-like-me/references/drafting.md +86 -0
  53. package/skills/message-like-me/references/ensoul.md +94 -0
  54. package/skills/message-like-me/references/evaluation.md +81 -0
  55. package/skills/message-like-me/references/privacy.md +106 -0
  56. package/skills/message-like-me/references/profile-schema.md +148 -0
@@ -0,0 +1,121 @@
1
+ import type { ContactMetrics, CorpusMessage, CorpusReactionFact } from "./types.ts";
2
+ export declare const ENSOUL_SOURCE_PACKET_V1_SCHEMA_IDENTITY: "ensoul.source-packet.v1";
3
+ export declare const ENSOUL_MESSAGES_SOURCE_V1_ADAPTER_ID: "ensoul.messages-source.v1";
4
+ export declare const ENSOUL_DIGEST_CANONICALIZATION: "JCS-RFC8785";
5
+ export declare const DEFAULT_ENSOUL_MESSAGES_EXAMPLE_LIMIT = 24;
6
+ export declare const MAX_ENSOUL_MESSAGES_EXAMPLE_LIMIT = 50;
7
+ export type EnsoulMessagesSubjectRole = "owner" | "contact";
8
+ export type EnsoulAuthorRole = "subject" | "counterpart";
9
+ export type EnsoulMessagesSourceRecordV1 = Readonly<{
10
+ id: `message:sha256:${string}`;
11
+ digest: `sha256:${string}`;
12
+ kind: "message";
13
+ occurredAt: string;
14
+ authorRole: EnsoulAuthorRole;
15
+ contentRole: "original";
16
+ authorshipConfidence: "strong";
17
+ sentStatus: "sent" | "received";
18
+ visibility: "private";
19
+ sourceClass: "private_capture";
20
+ content: Readonly<{
21
+ text: string;
22
+ truncated: boolean;
23
+ }>;
24
+ provenance: Readonly<{
25
+ provider: "message-like-me";
26
+ sourceId: string;
27
+ runId: `response:sha256:${string}`;
28
+ operation: "ensoul prepare";
29
+ policyVersion: typeof ENSOUL_MESSAGES_SOURCE_V1_ADAPTER_ID;
30
+ contentSha256: string;
31
+ }>;
32
+ }>;
33
+ export type EnsoulMessagesSourcePacketV1 = Readonly<{
34
+ schemaVersion: typeof ENSOUL_SOURCE_PACKET_V1_SCHEMA_IDENTITY;
35
+ digestCanonicalization: typeof ENSOUL_DIGEST_CANONICALIZATION;
36
+ packetId: `message-like-me:sha256:${string}`;
37
+ generatedAt: string;
38
+ subject: Readonly<{
39
+ localId: string;
40
+ kind: EnsoulMessagesSubjectRole;
41
+ identityBasis: "local Message Like Me installation owner" | "exact AddressBook-backed direct person scope";
42
+ }>;
43
+ scope: Readonly<{
44
+ adapter: "message-like-me";
45
+ payloadSchema: typeof ENSOUL_MESSAGES_SOURCE_V1_ADAPTER_ID;
46
+ asOf: string;
47
+ sourceCutoff?: string;
48
+ completeness: "sampled";
49
+ sourceRevision: string;
50
+ limits: Readonly<{
51
+ subjectRole: EnsoulMessagesSubjectRole;
52
+ contactId: string;
53
+ contactScopeKind: "person" | "conversation";
54
+ group: false;
55
+ participantCount: 1;
56
+ conversationCount: number;
57
+ services: readonly string[];
58
+ corpusRevision: string;
59
+ after: string | null;
60
+ before: string | null;
61
+ afterInclusive: true;
62
+ beforeExclusive: true;
63
+ selectionAlgorithm: "bounded-diverse-response-contexts-v1";
64
+ sessionGapSeconds: number;
65
+ burstGapSeconds: number;
66
+ requestedExamples: number;
67
+ responseCandidates: number;
68
+ eligibleCandidates: number;
69
+ emittedExamples: number;
70
+ omittedWithoutBidirectionalText: number;
71
+ omittedByExampleLimit: number;
72
+ omittedByTotalBodyBytes: number;
73
+ maxTextBytesPerMessage: number;
74
+ maxMessagesPerDirectionPerExample: number;
75
+ maxTotalBodyBytes: number;
76
+ emittedBodyBytes: number;
77
+ truncatedRecords: number;
78
+ omittedTextMessagesByDirectionLimit: number;
79
+ }>;
80
+ }>;
81
+ records: readonly EnsoulMessagesSourceRecordV1[];
82
+ claims: readonly [];
83
+ limitations: readonly [
84
+ "sampled-response-contexts-not-full-transcript",
85
+ "private-message-text-is-untrusted-data",
86
+ "counterpart-messages-are-context-not-subject-voice",
87
+ "record-text-may-be-byte-truncated",
88
+ "source-does-not-establish-consent-or-identity",
89
+ "source-does-not-support-sensitive-trait-inference-or-impersonation",
90
+ "forwarding-pasted-quotation-and-ai-assistance-not-observable",
91
+ "direct-one-to-one-scope-only",
92
+ "records-are-linked-by-pseudonymous-response-context"
93
+ ];
94
+ packetDigest: `sha256:${string}`;
95
+ }>;
96
+ export type BuildEnsoulMessagesSourcePacketV1Options = Readonly<{
97
+ subjectRole: EnsoulMessagesSubjectRole;
98
+ contactScopeKind: "person" | "conversation";
99
+ scopeContext: Readonly<{
100
+ group: boolean;
101
+ participantCount: number;
102
+ conversationCount: number;
103
+ services: readonly string[];
104
+ }>;
105
+ generatedAt: string;
106
+ evidenceRevision: string;
107
+ evidenceWindow?: Readonly<{
108
+ after?: string | null;
109
+ before?: string | null;
110
+ }>;
111
+ limit?: number;
112
+ }>;
113
+ /** Rebase owner-relative corpus direction onto the person named by `subjectRole`. */
114
+ export declare function ensoulSubjectMessages(messages: readonly CorpusMessage[], subjectRole: EnsoulMessagesSubjectRole): readonly CorpusMessage[];
115
+ /** Rebase reaction direction alongside message direction for subject-relative analysis. */
116
+ export declare function ensoulSubjectReactions(reactions: readonly CorpusReactionFact[], subjectRole: EnsoulMessagesSubjectRole): readonly CorpusReactionFact[];
117
+ /**
118
+ * Build an offline, bounded Ensoul source packet from already selected local evidence.
119
+ * The caller must pass subject-relative messages and metrics from the same snapshot.
120
+ */
121
+ export declare function buildEnsoulMessagesSourcePacketV1(messages: readonly CorpusMessage[], metrics: ContactMetrics, options: BuildEnsoulMessagesSourcePacketV1Options): EnsoulMessagesSourcePacketV1;
@@ -0,0 +1,24 @@
1
+ // @bun
2
+ import {
3
+ DEFAULT_ENSOUL_MESSAGES_EXAMPLE_LIMIT,
4
+ ENSOUL_DIGEST_CANONICALIZATION,
5
+ ENSOUL_MESSAGES_SOURCE_V1_ADAPTER_ID,
6
+ ENSOUL_SOURCE_PACKET_V1_SCHEMA_IDENTITY,
7
+ MAX_ENSOUL_MESSAGES_EXAMPLE_LIMIT,
8
+ buildEnsoulMessagesSourcePacketV1,
9
+ ensoulSubjectMessages,
10
+ ensoulSubjectReactions
11
+ } from "./cli-x1qncxm7.js";
12
+ import"./cli-qqafdvz9.js";
13
+ import"./cli-kw20gkk3.js";
14
+ import"./cli-ththzwja.js";
15
+ export {
16
+ ensoulSubjectReactions,
17
+ ensoulSubjectMessages,
18
+ buildEnsoulMessagesSourcePacketV1,
19
+ MAX_ENSOUL_MESSAGES_EXAMPLE_LIMIT,
20
+ ENSOUL_SOURCE_PACKET_V1_SCHEMA_IDENTITY,
21
+ ENSOUL_MESSAGES_SOURCE_V1_ADAPTER_ID,
22
+ ENSOUL_DIGEST_CANONICALIZATION,
23
+ DEFAULT_ENSOUL_MESSAGES_EXAMPLE_LIMIT
24
+ };
@@ -0,0 +1,3 @@
1
+ export * from "./types.js";
2
+ export * from "./ensoul-source-v1.js";
3
+ export { canonicalJson, sha256 } from "./canonical-json.js";
package/dist/index.js ADDED
@@ -0,0 +1,47 @@
1
+ // @bun
2
+ import {
3
+ CONTACTS_SCHEMA_VERSION,
4
+ CORPUS_SCHEMA_VERSION,
5
+ DEFAULT_ENSOUL_MESSAGES_EXAMPLE_LIMIT,
6
+ ENSOUL_DIGEST_CANONICALIZATION,
7
+ ENSOUL_MESSAGES_SOURCE_V1_ADAPTER_ID,
8
+ ENSOUL_SOURCE_PACKET_V1_SCHEMA_IDENTITY,
9
+ EVALUATION_PACKET_SCHEMA_VERSION,
10
+ LEGACY_PROFILE_SCHEMA_VERSION,
11
+ MAX_ENSOUL_MESSAGES_EXAMPLE_LIMIT,
12
+ MESSAGE_BUNDLE_SCHEMA_VERSION,
13
+ MESSAGE_BUNDLE_SCHEMA_VERSIONS,
14
+ METRICS_SCHEMA_VERSION,
15
+ PROFILE_SCHEMA_VERSION,
16
+ STUDY_PACKET_SCHEMA_VERSION,
17
+ buildEnsoulMessagesSourcePacketV1,
18
+ ensoulSubjectMessages,
19
+ ensoulSubjectReactions
20
+ } from "./cli-x1qncxm7.js";
21
+ import"./cli-qqafdvz9.js";
22
+ import"./cli-kw20gkk3.js";
23
+ import {
24
+ canonicalJson,
25
+ sha256
26
+ } from "./cli-ththzwja.js";
27
+ export {
28
+ sha256,
29
+ ensoulSubjectReactions,
30
+ ensoulSubjectMessages,
31
+ canonicalJson,
32
+ buildEnsoulMessagesSourcePacketV1,
33
+ STUDY_PACKET_SCHEMA_VERSION,
34
+ PROFILE_SCHEMA_VERSION,
35
+ METRICS_SCHEMA_VERSION,
36
+ MESSAGE_BUNDLE_SCHEMA_VERSIONS,
37
+ MESSAGE_BUNDLE_SCHEMA_VERSION,
38
+ MAX_ENSOUL_MESSAGES_EXAMPLE_LIMIT,
39
+ LEGACY_PROFILE_SCHEMA_VERSION,
40
+ EVALUATION_PACKET_SCHEMA_VERSION,
41
+ ENSOUL_SOURCE_PACKET_V1_SCHEMA_IDENTITY,
42
+ ENSOUL_MESSAGES_SOURCE_V1_ADAPTER_ID,
43
+ ENSOUL_DIGEST_CANONICALIZATION,
44
+ DEFAULT_ENSOUL_MESSAGES_EXAMPLE_LIMIT,
45
+ CORPUS_SCHEMA_VERSION,
46
+ CONTACTS_SCHEMA_VERSION
47
+ };
@@ -0,0 +1,2 @@
1
+ /** Internal identity shared by the public wire contract and corpus API. */
2
+ export declare const MESSAGE_BUNDLE_V1_SCHEMA_IDENTITY: 1;
@@ -0,0 +1,205 @@
1
+ /** Immutable wire-format identity for the local message bundle contract. */
2
+ export declare const LOCAL_MESSAGE_BUNDLE_V1_SCHEMA_VERSION: 1;
3
+ export declare const LOCAL_MESSAGE_BUNDLE_V1_FORMAT: "message-like-me.local-message-bundle";
4
+ export declare const LOCAL_MESSAGE_BUNDLE_V1_SOURCE_ID: "beeper-local";
5
+ export declare const LOCAL_MESSAGE_BUNDLE_V1_SOURCE_TRANSFORM_VERSION: "1.1.0";
6
+ export declare const LOCAL_MESSAGE_BUNDLE_V1_PROVIDER_ID: "beeper";
7
+ /**
8
+ * Source-transform versions whose semantic output Message Like Me v1 accepts.
9
+ * A producer package version may change without changing this transform version.
10
+ */
11
+ export declare const LOCAL_MESSAGE_BUNDLE_V1_SUPPORTED_SOURCE_TRANSFORM_VERSIONS: readonly ["1.1.0"];
12
+ export declare const LOCAL_MESSAGE_BUNDLE_V1_LIMITS: Readonly<{
13
+ readonly manifestBytes: number;
14
+ readonly records: 500000;
15
+ readonly recordBytes: number;
16
+ readonly totalBytes: number;
17
+ readonly accounts: 128;
18
+ readonly identifierBytes: 1024;
19
+ readonly shortTextBytes: number;
20
+ readonly bodyBytes: number;
21
+ readonly mimeTypeBytes: 256;
22
+ readonly participantsPerConversation: 10000;
23
+ readonly attachmentsPerMessage: 256;
24
+ readonly warnings: 128;
25
+ }>;
26
+ export declare const LOCAL_MESSAGE_BUNDLE_V1_ARTIFACTS: readonly [Readonly<{
27
+ path: "accounts.ndjson";
28
+ kind: "account";
29
+ }>, Readonly<{
30
+ path: "participants.ndjson";
31
+ kind: "participant";
32
+ }>, Readonly<{
33
+ path: "conversations.ndjson";
34
+ kind: "conversation";
35
+ }>, Readonly<{
36
+ path: "messages.ndjson";
37
+ kind: "message";
38
+ }>, Readonly<{
39
+ path: "reactions.ndjson";
40
+ kind: "reaction";
41
+ }>, Readonly<{
42
+ path: "tombstones.ndjson";
43
+ kind: "tombstone";
44
+ }>];
45
+ export type LocalMessageBundleV1RecordKind = typeof LOCAL_MESSAGE_BUNDLE_V1_ARTIFACTS[number]["kind"];
46
+ export type LocalMessageBundleV1ArtifactPath = typeof LOCAL_MESSAGE_BUNDLE_V1_ARTIFACTS[number]["path"];
47
+ export type LocalMessageBundleV1Provenance = Readonly<{
48
+ providerId: string;
49
+ providerRevision: string | null;
50
+ observedAt: string;
51
+ connectedAccountProviderId: string;
52
+ }>;
53
+ export type LocalMessageBundleV1CommonRecord = Readonly<{
54
+ schemaVersion: typeof LOCAL_MESSAGE_BUNDLE_V1_SCHEMA_VERSION;
55
+ kind: LocalMessageBundleV1RecordKind;
56
+ id: string;
57
+ accountId: string;
58
+ network: string;
59
+ provenance: LocalMessageBundleV1Provenance;
60
+ }>;
61
+ export type LocalMessageBundleV1AccountRecord = LocalMessageBundleV1CommonRecord & Readonly<{
62
+ kind: "account";
63
+ displayName: string | null;
64
+ handle: string | null;
65
+ selfParticipantId: string;
66
+ }>;
67
+ export type LocalMessageBundleV1ParticipantRecord = LocalMessageBundleV1CommonRecord & Readonly<{
68
+ kind: "participant";
69
+ displayName: string | null;
70
+ handle: string | null;
71
+ isSelf: boolean;
72
+ }>;
73
+ export type LocalMessageBundleV1ConversationRecord = LocalMessageBundleV1CommonRecord & Readonly<{
74
+ kind: "conversation";
75
+ type: "direct" | "group" | "channel" | "unknown";
76
+ title: string | null;
77
+ participantIds: readonly string[];
78
+ participantsComplete: boolean | null;
79
+ startedAt: string | null;
80
+ lastMessageAt: string | null;
81
+ }>;
82
+ export type LocalMessageBundleV1AttachmentRecord = Readonly<{
83
+ kind: "audio" | "document" | "image" | "link" | "sticker" | "video" | "unknown";
84
+ mimeType: string | null;
85
+ name: string | null;
86
+ sizeBytes: number | null;
87
+ }>;
88
+ export type LocalMessageBundleV1Reply = Readonly<{
89
+ messageId: string | null;
90
+ providerId: string;
91
+ }>;
92
+ export type LocalMessageBundleV1Edit = Readonly<{
93
+ kind: "in-place";
94
+ editedAt: string;
95
+ providerRevision: string;
96
+ }> | Readonly<{
97
+ kind: "replacement";
98
+ replacesMessageId: string | null;
99
+ replacesProviderId: string;
100
+ editedAt: string;
101
+ providerRevision: string;
102
+ }>;
103
+ export type LocalMessageBundleV1Deletion = Readonly<{
104
+ state: "revoked" | "deleted-for-me" | "revoked-and-deleted-for-me";
105
+ observedAt: string;
106
+ providerRevision: string | null;
107
+ }>;
108
+ export type LocalMessageBundleV1MessageRecord = LocalMessageBundleV1CommonRecord & Readonly<{
109
+ kind: "message";
110
+ conversationId: string;
111
+ senderParticipantId: string | null;
112
+ direction: "incoming" | "outgoing" | "unknown";
113
+ sentAt: string;
114
+ sortKey: string;
115
+ body: string | null;
116
+ bodyTruncated: boolean | null;
117
+ replyTo: LocalMessageBundleV1Reply | null;
118
+ edit: LocalMessageBundleV1Edit | null;
119
+ deletion: LocalMessageBundleV1Deletion | null;
120
+ attachments: readonly LocalMessageBundleV1AttachmentRecord[];
121
+ }>;
122
+ export type LocalMessageBundleV1ReactionRecord = LocalMessageBundleV1CommonRecord & Readonly<{
123
+ kind: "reaction";
124
+ messageId: string | null;
125
+ messageProviderId: string;
126
+ participantId: string | null;
127
+ body: string;
128
+ reactedAt: string | null;
129
+ state: "active" | "removed";
130
+ }>;
131
+ export type LocalMessageBundleV1TombstoneRecord = LocalMessageBundleV1CommonRecord & Readonly<{
132
+ kind: "tombstone";
133
+ entityKind: "conversation" | "message" | "reaction";
134
+ entityId: string | null;
135
+ entityProviderId: string;
136
+ deletedAt: string;
137
+ scope: "remote" | "local" | "unknown";
138
+ providerRevision: string | null;
139
+ }>;
140
+ export type LocalMessageBundleV1Record = LocalMessageBundleV1AccountRecord | LocalMessageBundleV1ParticipantRecord | LocalMessageBundleV1ConversationRecord | LocalMessageBundleV1MessageRecord | LocalMessageBundleV1ReactionRecord | LocalMessageBundleV1TombstoneRecord;
141
+ export type LocalMessageBundleV1RecordByKind = Readonly<{
142
+ account: LocalMessageBundleV1AccountRecord;
143
+ participant: LocalMessageBundleV1ParticipantRecord;
144
+ conversation: LocalMessageBundleV1ConversationRecord;
145
+ message: LocalMessageBundleV1MessageRecord;
146
+ reaction: LocalMessageBundleV1ReactionRecord;
147
+ tombstone: LocalMessageBundleV1TombstoneRecord;
148
+ }>;
149
+ export type LocalMessageBundleV1Artifact = Readonly<{
150
+ path: LocalMessageBundleV1ArtifactPath;
151
+ mediaType: "application/x-ndjson";
152
+ recordKind: LocalMessageBundleV1RecordKind;
153
+ records: number;
154
+ bytes: number;
155
+ sha256: string;
156
+ }>;
157
+ export type LocalMessageBundleV1ManifestProjection = Readonly<{
158
+ schemaVersion: typeof LOCAL_MESSAGE_BUNDLE_V1_SCHEMA_VERSION;
159
+ format: typeof LOCAL_MESSAGE_BUNDLE_V1_FORMAT;
160
+ source: Readonly<{
161
+ id: typeof LOCAL_MESSAGE_BUNDLE_V1_SOURCE_ID;
162
+ version: typeof LOCAL_MESSAGE_BUNDLE_V1_SOURCE_TRANSFORM_VERSION;
163
+ }>;
164
+ provider: Readonly<{
165
+ id: typeof LOCAL_MESSAGE_BUNDLE_V1_PROVIDER_ID;
166
+ version: string;
167
+ }>;
168
+ timestamps: Readonly<{
169
+ startedAt: string;
170
+ finishedAt: string;
171
+ createdAt: string;
172
+ }>;
173
+ completeness: Readonly<{
174
+ kind: "bounded-local" | "truncated" | "unknown";
175
+ reason: string | null;
176
+ observedFrom: string | null;
177
+ observedThrough: string | null;
178
+ }>;
179
+ warnings: readonly string[];
180
+ privacy: Readonly<{
181
+ classification: "private-local";
182
+ attachments: "metadata-only";
183
+ providerUrls: "excluded";
184
+ credentials: "excluded";
185
+ }>;
186
+ counts: Readonly<Record<LocalMessageBundleV1RecordKind, number>>;
187
+ artifacts: readonly LocalMessageBundleV1Artifact[];
188
+ }>;
189
+ export type LocalMessageBundleV1Manifest = LocalMessageBundleV1ManifestProjection & Readonly<{
190
+ integrity: Readonly<{
191
+ algorithm: "sha256";
192
+ bundleSha256: string;
193
+ }>;
194
+ }>;
195
+ /** Stable error category for callers that validate untrusted contract values. */
196
+ export declare class MessageBundleV1ContractError extends TypeError {
197
+ readonly code: "message-bundle-v1-contract";
198
+ constructor(message: string, options?: ErrorOptions);
199
+ }
200
+ export declare function isLocalMessageBundleV1SourceTransformVersion(value: unknown): value is typeof LOCAL_MESSAGE_BUNDLE_V1_SOURCE_TRANSFORM_VERSION;
201
+ export declare function assertLocalMessageBundleV1SourceTransformVersion(value: unknown, label?: string): typeof LOCAL_MESSAGE_BUNDLE_V1_SOURCE_TRANSFORM_VERSION;
202
+ export declare function parseLocalMessageBundleV1Record<Kind extends LocalMessageBundleV1RecordKind>(value: unknown, kind: Kind, label?: string): LocalMessageBundleV1RecordByKind[Kind];
203
+ export declare function localMessageBundleV1ManifestProjection(manifest: LocalMessageBundleV1Manifest): LocalMessageBundleV1ManifestProjection;
204
+ export declare function localMessageBundleV1BundleSha256(projection: LocalMessageBundleV1ManifestProjection): string;
205
+ export declare function parseLocalMessageBundleV1Manifest(value: unknown): LocalMessageBundleV1Manifest;
@@ -0,0 +1,37 @@
1
+ // @bun
2
+ import {
3
+ LOCAL_MESSAGE_BUNDLE_V1_ARTIFACTS,
4
+ LOCAL_MESSAGE_BUNDLE_V1_FORMAT,
5
+ LOCAL_MESSAGE_BUNDLE_V1_LIMITS,
6
+ LOCAL_MESSAGE_BUNDLE_V1_PROVIDER_ID,
7
+ LOCAL_MESSAGE_BUNDLE_V1_SCHEMA_VERSION,
8
+ LOCAL_MESSAGE_BUNDLE_V1_SOURCE_ID,
9
+ LOCAL_MESSAGE_BUNDLE_V1_SOURCE_TRANSFORM_VERSION,
10
+ LOCAL_MESSAGE_BUNDLE_V1_SUPPORTED_SOURCE_TRANSFORM_VERSIONS,
11
+ MessageBundleV1ContractError,
12
+ assertLocalMessageBundleV1SourceTransformVersion,
13
+ isLocalMessageBundleV1SourceTransformVersion,
14
+ localMessageBundleV1BundleSha256,
15
+ localMessageBundleV1ManifestProjection,
16
+ parseLocalMessageBundleV1Manifest,
17
+ parseLocalMessageBundleV1Record
18
+ } from "./cli-ry4128kz.js";
19
+ import"./cli-qqafdvz9.js";
20
+ import"./cli-ththzwja.js";
21
+ export {
22
+ parseLocalMessageBundleV1Record,
23
+ parseLocalMessageBundleV1Manifest,
24
+ localMessageBundleV1ManifestProjection,
25
+ localMessageBundleV1BundleSha256,
26
+ isLocalMessageBundleV1SourceTransformVersion,
27
+ assertLocalMessageBundleV1SourceTransformVersion,
28
+ MessageBundleV1ContractError,
29
+ LOCAL_MESSAGE_BUNDLE_V1_SUPPORTED_SOURCE_TRANSFORM_VERSIONS,
30
+ LOCAL_MESSAGE_BUNDLE_V1_SOURCE_TRANSFORM_VERSION,
31
+ LOCAL_MESSAGE_BUNDLE_V1_SOURCE_ID,
32
+ LOCAL_MESSAGE_BUNDLE_V1_SCHEMA_VERSION,
33
+ LOCAL_MESSAGE_BUNDLE_V1_PROVIDER_ID,
34
+ LOCAL_MESSAGE_BUNDLE_V1_LIMITS,
35
+ LOCAL_MESSAGE_BUNDLE_V1_FORMAT,
36
+ LOCAL_MESSAGE_BUNDLE_V1_ARTIFACTS
37
+ };
@@ -0,0 +1,2 @@
1
+ /** Internal identity shared by the public WhatsApp wire contract and corpus API. */
2
+ export declare const MESSAGE_BUNDLE_V2_SCHEMA_IDENTITY: 2;
@@ -0,0 +1,215 @@
1
+ /** Immutable wire-format identity for the local message bundle contract. */
2
+ export declare const LOCAL_MESSAGE_BUNDLE_V2_SCHEMA_VERSION: 2;
3
+ export declare const LOCAL_MESSAGE_BUNDLE_V2_FORMAT: "message-like-me.local-message-bundle";
4
+ export declare const LOCAL_MESSAGE_BUNDLE_V2_SOURCE_ID: "wacli-local";
5
+ export declare const LOCAL_MESSAGE_BUNDLE_V2_SOURCE_TRANSFORM_VERSION: "1.0.0";
6
+ export declare const LOCAL_MESSAGE_BUNDLE_V2_PROVIDER_ID: "whatsapp";
7
+ export declare const LOCAL_MESSAGE_BUNDLE_V2_PROVIDER_VERSION: "0.15.0";
8
+ export declare const LOCAL_MESSAGE_BUNDLE_V2_NETWORK: "whatsapp";
9
+ /**
10
+ * Source-transform versions whose semantic output Message Like Me v2 accepts.
11
+ * A producer package version may change without changing this transform version.
12
+ */
13
+ export declare const LOCAL_MESSAGE_BUNDLE_V2_SUPPORTED_SOURCE_TRANSFORM_VERSIONS: readonly ["1.0.0"];
14
+ export declare const LOCAL_MESSAGE_BUNDLE_V2_LIMITS: Readonly<{
15
+ readonly manifestBytes: number;
16
+ readonly records: 500000;
17
+ readonly recordBytes: number;
18
+ readonly totalBytes: number;
19
+ readonly accounts: 1;
20
+ readonly identifierBytes: 1024;
21
+ readonly shortTextBytes: number;
22
+ readonly bodyBytes: number;
23
+ readonly mimeTypeBytes: 256;
24
+ readonly participantsPerConversation: 10000;
25
+ readonly attachmentsPerMessage: 256;
26
+ readonly warnings: 128;
27
+ }>;
28
+ export declare const LOCAL_MESSAGE_BUNDLE_V2_ARTIFACTS: readonly [Readonly<{
29
+ path: "accounts.ndjson";
30
+ kind: "account";
31
+ }>, Readonly<{
32
+ path: "participants.ndjson";
33
+ kind: "participant";
34
+ }>, Readonly<{
35
+ path: "conversations.ndjson";
36
+ kind: "conversation";
37
+ }>, Readonly<{
38
+ path: "messages.ndjson";
39
+ kind: "message";
40
+ }>, Readonly<{
41
+ path: "reactions.ndjson";
42
+ kind: "reaction";
43
+ }>, Readonly<{
44
+ path: "tombstones.ndjson";
45
+ kind: "tombstone";
46
+ }>];
47
+ export type LocalMessageBundleV2RecordKind = typeof LOCAL_MESSAGE_BUNDLE_V2_ARTIFACTS[number]["kind"];
48
+ export type LocalMessageBundleV2ArtifactPath = typeof LOCAL_MESSAGE_BUNDLE_V2_ARTIFACTS[number]["path"];
49
+ export type LocalMessageBundleV2Provenance = Readonly<{
50
+ providerId: string;
51
+ providerRevision: string | null;
52
+ observedAt: string;
53
+ connectedAccountProviderId: string;
54
+ }>;
55
+ export type LocalMessageBundleV2CommonRecord = Readonly<{
56
+ schemaVersion: typeof LOCAL_MESSAGE_BUNDLE_V2_SCHEMA_VERSION;
57
+ kind: LocalMessageBundleV2RecordKind;
58
+ id: string;
59
+ accountId: string;
60
+ network: typeof LOCAL_MESSAGE_BUNDLE_V2_NETWORK;
61
+ provenance: LocalMessageBundleV2Provenance;
62
+ }>;
63
+ export type LocalMessageBundleV2AccountRecord = LocalMessageBundleV2CommonRecord & Readonly<{
64
+ kind: "account";
65
+ displayName: string | null;
66
+ handle: string | null;
67
+ selfParticipantId: string;
68
+ }>;
69
+ export type LocalMessageBundleV2ParticipantRecord = LocalMessageBundleV2CommonRecord & Readonly<{
70
+ kind: "participant";
71
+ displayName: string | null;
72
+ handle: string | null;
73
+ isSelf: boolean;
74
+ }>;
75
+ export type LocalMessageBundleV2ConversationRecord = LocalMessageBundleV2CommonRecord & Readonly<{
76
+ kind: "conversation";
77
+ type: "direct" | "group";
78
+ title: string | null;
79
+ participantIds: readonly string[];
80
+ participantsComplete: boolean | null;
81
+ startedAt: string | null;
82
+ lastMessageAt: string | null;
83
+ }>;
84
+ export type LocalMessageBundleV2AttachmentRecord = Readonly<{
85
+ kind: "audio" | "document" | "image" | "link" | "sticker" | "video" | "unknown";
86
+ mimeType: string | null;
87
+ name: string | null;
88
+ sizeBytes: number | null;
89
+ }>;
90
+ export type LocalMessageBundleV2Reply = Readonly<{
91
+ messageId: string | null;
92
+ providerId: string;
93
+ }>;
94
+ export type LocalMessageBundleV2Edit = Readonly<{
95
+ kind: "in-place";
96
+ editedAt: string;
97
+ providerRevision: string;
98
+ }> | Readonly<{
99
+ kind: "replacement";
100
+ replacesMessageId: string | null;
101
+ replacesProviderId: string;
102
+ editedAt: string;
103
+ providerRevision: string;
104
+ }>;
105
+ export type LocalMessageBundleV2Deletion = Readonly<{
106
+ state: "revoked" | "deleted-for-me" | "revoked-and-deleted-for-me";
107
+ observedAt: string;
108
+ providerRevision: string | null;
109
+ }>;
110
+ export type LocalMessageBundleV2MessageRecord = LocalMessageBundleV2CommonRecord & Readonly<{
111
+ kind: "message";
112
+ conversationId: string;
113
+ senderParticipantId: string | null;
114
+ direction: "incoming" | "outgoing" | "unknown";
115
+ sentAt: string;
116
+ sortKey: string;
117
+ body: string | null;
118
+ bodyTruncated: boolean | null;
119
+ replyTo: LocalMessageBundleV2Reply | null;
120
+ edit: LocalMessageBundleV2Edit | null;
121
+ deletion: LocalMessageBundleV2Deletion | null;
122
+ attachments: readonly LocalMessageBundleV2AttachmentRecord[];
123
+ }>;
124
+ export type LocalMessageBundleV2ReactionRecord = LocalMessageBundleV2CommonRecord & Readonly<{
125
+ kind: "reaction";
126
+ messageId: string | null;
127
+ messageProviderId: string;
128
+ participantId: string | null;
129
+ body: string;
130
+ reactedAt: string | null;
131
+ state: "active" | "removed";
132
+ }>;
133
+ export type LocalMessageBundleV2TombstoneRecord = LocalMessageBundleV2CommonRecord & Readonly<{
134
+ kind: "tombstone";
135
+ entityKind: "conversation" | "message" | "reaction";
136
+ entityId: string | null;
137
+ entityProviderId: string;
138
+ deletedAt: string;
139
+ scope: "remote" | "local" | "unknown";
140
+ providerRevision: string | null;
141
+ }>;
142
+ export type LocalMessageBundleV2Record = LocalMessageBundleV2AccountRecord | LocalMessageBundleV2ParticipantRecord | LocalMessageBundleV2ConversationRecord | LocalMessageBundleV2MessageRecord | LocalMessageBundleV2ReactionRecord | LocalMessageBundleV2TombstoneRecord;
143
+ export type LocalMessageBundleV2RecordByKind = Readonly<{
144
+ account: LocalMessageBundleV2AccountRecord;
145
+ participant: LocalMessageBundleV2ParticipantRecord;
146
+ conversation: LocalMessageBundleV2ConversationRecord;
147
+ message: LocalMessageBundleV2MessageRecord;
148
+ reaction: LocalMessageBundleV2ReactionRecord;
149
+ tombstone: LocalMessageBundleV2TombstoneRecord;
150
+ }>;
151
+ export type LocalMessageBundleV2WhatsAppJidKind = "user" | "lid" | "group";
152
+ export type LocalMessageBundleV2WhatsAppJid = Readonly<{
153
+ jid: string;
154
+ kind: LocalMessageBundleV2WhatsAppJidKind;
155
+ e164: string | null;
156
+ }>;
157
+ export type LocalMessageBundleV2Artifact = Readonly<{
158
+ path: LocalMessageBundleV2ArtifactPath;
159
+ mediaType: "application/x-ndjson";
160
+ recordKind: LocalMessageBundleV2RecordKind;
161
+ records: number;
162
+ bytes: number;
163
+ sha256: string;
164
+ }>;
165
+ export type LocalMessageBundleV2ManifestProjection = Readonly<{
166
+ schemaVersion: typeof LOCAL_MESSAGE_BUNDLE_V2_SCHEMA_VERSION;
167
+ format: typeof LOCAL_MESSAGE_BUNDLE_V2_FORMAT;
168
+ source: Readonly<{
169
+ id: typeof LOCAL_MESSAGE_BUNDLE_V2_SOURCE_ID;
170
+ version: typeof LOCAL_MESSAGE_BUNDLE_V2_SOURCE_TRANSFORM_VERSION;
171
+ }>;
172
+ provider: Readonly<{
173
+ id: typeof LOCAL_MESSAGE_BUNDLE_V2_PROVIDER_ID;
174
+ version: typeof LOCAL_MESSAGE_BUNDLE_V2_PROVIDER_VERSION;
175
+ }>;
176
+ timestamps: Readonly<{
177
+ startedAt: string;
178
+ finishedAt: string;
179
+ createdAt: string;
180
+ }>;
181
+ completeness: Readonly<{
182
+ kind: "bounded-local" | "truncated" | "unknown";
183
+ reason: string | null;
184
+ observedFrom: string | null;
185
+ observedThrough: string | null;
186
+ }>;
187
+ warnings: readonly string[];
188
+ privacy: Readonly<{
189
+ classification: "private-local";
190
+ attachments: "metadata-only";
191
+ providerUrls: "excluded";
192
+ credentials: "excluded";
193
+ }>;
194
+ counts: Readonly<Record<LocalMessageBundleV2RecordKind, number>>;
195
+ artifacts: readonly LocalMessageBundleV2Artifact[];
196
+ }>;
197
+ export type LocalMessageBundleV2Manifest = LocalMessageBundleV2ManifestProjection & Readonly<{
198
+ integrity: Readonly<{
199
+ algorithm: "sha256";
200
+ bundleSha256: string;
201
+ }>;
202
+ }>;
203
+ /** Stable error category for callers that validate untrusted contract values. */
204
+ export declare class MessageBundleV2ContractError extends TypeError {
205
+ readonly code: "message-bundle-v2-contract";
206
+ constructor(message: string, options?: ErrorOptions);
207
+ }
208
+ /** Parse one exact canonical WhatsApp JID admitted by the native bundle seam. */
209
+ export declare function parseLocalMessageBundleV2WhatsAppJid(value: unknown, label?: string): LocalMessageBundleV2WhatsAppJid;
210
+ export declare function isLocalMessageBundleV2SourceTransformVersion(value: unknown): value is typeof LOCAL_MESSAGE_BUNDLE_V2_SOURCE_TRANSFORM_VERSION;
211
+ export declare function assertLocalMessageBundleV2SourceTransformVersion(value: unknown, label?: string): typeof LOCAL_MESSAGE_BUNDLE_V2_SOURCE_TRANSFORM_VERSION;
212
+ export declare function parseLocalMessageBundleV2Record<Kind extends LocalMessageBundleV2RecordKind>(value: unknown, kind: Kind, label?: string): LocalMessageBundleV2RecordByKind[Kind];
213
+ export declare function localMessageBundleV2ManifestProjection(manifest: LocalMessageBundleV2Manifest): LocalMessageBundleV2ManifestProjection;
214
+ export declare function localMessageBundleV2BundleSha256(projection: LocalMessageBundleV2ManifestProjection): string;
215
+ export declare function parseLocalMessageBundleV2Manifest(value: unknown): LocalMessageBundleV2Manifest;