@ghostpaw/affinity 0.5.0 → 0.6.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/dist/index.d.cts CHANGED
@@ -17,6 +17,7 @@ declare abstract class AffinityError extends Error {
17
17
 
18
18
  /** Uniqueness, routing, or ownership collision. */
19
19
  declare class AffinityConflictError extends AffinityError {
20
+ existingContactId?: number;
20
21
  readonly code: "CONFLICT";
21
22
  }
22
23
 
@@ -137,6 +138,7 @@ interface AttributeEntry {
137
138
 
138
139
  /** Attribute row for mutation receipts — stable id + target + payload. */
139
140
  interface AttributeRecord {
141
+ eventId?: number;
140
142
  id: number;
141
143
  contactId: number | null;
142
144
  linkId: number | null;
@@ -145,7 +147,7 @@ interface AttributeRecord {
145
147
  }
146
148
 
147
149
  /**
148
- * Write target for attributes — exactly one of contact or link (CONCEPT.md).
150
+ * Write target for attributes — exactly one of contact, link or event (CONCEPT.md).
149
151
  */
150
152
  type AttributeTarget = {
151
153
  kind: "contact";
@@ -153,6 +155,9 @@ type AttributeTarget = {
153
155
  } | {
154
156
  kind: "link";
155
157
  id: number;
158
+ } | {
159
+ kind: "event";
160
+ eventId: number;
156
161
  };
157
162
 
158
163
  /** Open commitment lifecycle on reads — CONCEPT.md CommitmentRecord. */
@@ -174,6 +179,7 @@ interface CommitmentRecord {
174
179
  summary: string;
175
180
  participants: readonly EventParticipantView[];
176
181
  dueAt?: number | null;
182
+ dueOn?: string | null;
177
183
  resolutionState: CommitmentResolutionState;
178
184
  }
179
185
 
@@ -209,6 +215,8 @@ interface AffinityListReadOptions {
209
215
 
210
216
  /** Options for `read.getContactJournal` / `read.getLinkTimeline`. */
211
217
  type ContactJournalReadOptions = AffinityListReadOptions & {
218
+ includeContent?: boolean;
219
+ channel?: string;
212
220
  eventTypes?: readonly EventType[];
213
221
  };
214
222
 
@@ -232,11 +240,52 @@ interface ContactListItem {
232
240
  lastMeaningfulEventAt?: number | null;
233
241
  }
234
242
 
243
+ /** Shared participant row for evidence writes — CONCEPT.md SocialEventInput. */
244
+ interface SocialEventParticipantInput {
245
+ contactId: number;
246
+ role: EventParticipantRole;
247
+ directionality?: undefined | "owner_initiated" | "other_initiated" | "mutual" | "observed";
248
+ }
249
+ /** Evidence intake shape shared by interaction-style writes — CONCEPT.md. */
250
+ interface SocialEventInput {
251
+ occurredAt: number;
252
+ occurredOn?: string;
253
+ summary?: string;
254
+ content?: string;
255
+ affectsBond?: boolean;
256
+ externalRef?: ExternalRef;
257
+ channel?: string;
258
+ parentRef?: ExternalRef;
259
+ parentEventId?: number;
260
+ threadRef?: ExternalRef;
261
+ momentKind?: EventMomentKind;
262
+ /** Significance 1..10 — enforced at write layer. */
263
+ significance: number;
264
+ participants: readonly SocialEventParticipantInput[];
265
+ provenance?: unknown;
266
+ }
267
+ /** Stable external event identity. */
268
+ interface ExternalRef {
269
+ source: string;
270
+ id: string;
271
+ }
272
+
235
273
  /** Journal entry with explicit participants — CONCEPT.md EventRecord. */
236
274
  interface EventRecord {
275
+ content?: string;
276
+ externalRef?: ExternalRef;
277
+ channel?: string;
278
+ parentRef?: ExternalRef;
279
+ parentEventId?: number;
280
+ threadRef?: ExternalRef;
281
+ attributes?: AttributeRecord[];
237
282
  id: number;
283
+ affectsBond?: boolean;
238
284
  type: EventType;
239
285
  occurredAt: number;
286
+ occurredOn?: string;
287
+ dueAt?: number | null;
288
+ dueOn?: string | null;
240
289
  summary: string;
241
290
  significance: number;
242
291
  momentKind: EventMomentKind | null;
@@ -263,6 +312,7 @@ interface IdentityRecord {
263
312
  /** Compact link row for lists — CONCEPT.md LinkListItem. */
264
313
  interface LinkListItem {
265
314
  id: number;
315
+ counterpartyName?: string;
266
316
  fromContactId: number;
267
317
  toContactId: number;
268
318
  kind: LinkKind;
@@ -311,6 +361,8 @@ interface UpcomingDateRecord {
311
361
  recurrenceKind: EventRecurrenceKind;
312
362
  /** Epoch milliseconds for the materialized next occurrence (sorting key). */
313
363
  occursOn: number;
364
+ /** Calendar date; occursOn retains its existing numeric sorting key. */
365
+ occursOnDate?: string;
314
366
  summary: string;
315
367
  significance: number;
316
368
  }
@@ -376,6 +428,7 @@ interface AddDateAnchorInput {
376
428
 
377
429
  /** Arguments for `write.addIdentity`. */
378
430
  interface AddIdentityInput {
431
+ ifExists?: "error" | "return";
379
432
  type: string;
380
433
  value: string;
381
434
  label?: string | null;
@@ -389,6 +442,8 @@ interface CreateContactInput {
389
442
  name: string;
390
443
  kind: ContactKind;
391
444
  now?: number;
445
+ identities?: AddIdentityInput[];
446
+ ifExists?: "error" | "return";
392
447
  /**
393
448
  * When true, marks this row as the sole owner contact.
394
449
  * Allowed only while no other live owner exists.
@@ -438,26 +493,11 @@ interface SetStructuralTieInput {
438
493
  now?: number;
439
494
  }
440
495
 
441
- /** Shared participant row for evidence writes — CONCEPT.md SocialEventInput. */
442
- interface SocialEventParticipantInput {
443
- contactId: number;
444
- role: EventParticipantRole;
445
- directionality?: "owner_initiated" | "other_initiated" | "mutual" | "observed";
446
- }
447
- /** Evidence intake shape shared by interaction-style writes — CONCEPT.md. */
448
- interface SocialEventInput {
449
- occurredAt: number;
450
- summary: string;
451
- /** Significance 1..10 — enforced at write layer. */
452
- significance: number;
453
- participants: readonly SocialEventParticipantInput[];
454
- provenance?: unknown;
455
- }
456
-
457
496
  /** Arguments for `write.recordCommitment`. */
458
497
  interface RecordCommitmentInput extends SocialEventInput {
459
498
  commitmentType: "promise" | "agreement";
460
499
  dueAt?: number | null;
500
+ dueOn?: string | null;
461
501
  now?: number;
462
502
  }
463
503
 
@@ -487,6 +527,7 @@ interface RecordTransactionInput extends SocialEventInput {
487
527
  interface ResolveCommitmentEventInput {
488
528
  type?: Exclude<EventType, "date_anchor">;
489
529
  occurredAt?: number;
530
+ occurredOn?: string;
490
531
  summary?: string;
491
532
  significance?: number;
492
533
  participants?: readonly SocialEventParticipantInput[];
@@ -516,6 +557,7 @@ interface ReviseDateAnchorOptions {
516
557
 
517
558
  /** Arguments for `write.seedSocialLink`. */
518
559
  interface SeedSocialLinkInput {
560
+ ifExists?: "error" | "return";
519
561
  fromContactId: number;
520
562
  toContactId: number;
521
563
  kind: RelationalLinkKind;
@@ -589,9 +631,22 @@ interface DismissedDuplicateRecord {
589
631
 
590
632
  /** Raw `events` row from SQLite (snake_case columns). */
591
633
  interface EventRow {
634
+ content?: string | null;
635
+ external_source?: string | null;
636
+ external_id?: string | null;
637
+ channel?: string | null;
638
+ parent_source?: string | null;
639
+ parent_ref_id?: string | null;
640
+ parent_event_id?: number | null;
641
+ thread_source?: string | null;
642
+ thread_id?: string | null;
643
+ provenance_json?: string | null;
592
644
  id: number;
593
645
  type: string;
594
646
  occurred_at: number;
647
+ occurred_on?: string | null;
648
+ due_at?: number | null;
649
+ due_on?: string | null;
595
650
  summary: string;
596
651
  significance: number;
597
652
  moment_kind: string | null;
@@ -611,6 +666,7 @@ interface MomentRecord {
611
666
  linkId: number;
612
667
  momentKind: EventMomentKind;
613
668
  occurredAt: number;
669
+ occurredOn?: string;
614
670
  summary: string;
615
671
  impactScore: number;
616
672
  }
@@ -633,6 +689,7 @@ interface LinkDetailReadOptions {
633
689
 
634
690
  /** Common filters for link list reads — CONCEPT.md. */
635
691
  interface LinkListReadFilters {
692
+ includeLost?: boolean;
636
693
  kind?: LinkKind;
637
694
  state?: LinkState;
638
695
  }
@@ -724,6 +781,10 @@ interface MergePrimary {
724
781
  */
725
782
  interface MutationReceipt<TPrimary> {
726
783
  primary: TPrimary;
784
+ warnings?: {
785
+ code: "future_event";
786
+ message: string;
787
+ }[];
727
788
  created: EntityRef[];
728
789
  updated: EntityRef[];
729
790
  archived: EntityRef[];
@@ -731,10 +792,15 @@ interface MutationReceipt<TPrimary> {
731
792
  affectedLinks: number[];
732
793
  derivedEffects: DerivedLinkEffect[];
733
794
  }
734
- type ContactMutationReceipt = MutationReceipt<ContactListItem>;
795
+ type ContactMutationReceipt = MutationReceipt<ContactListItem> & {
796
+ outcome?: "success" | "no_op";
797
+ matchedIdentities?: AddIdentityInput[];
798
+ };
735
799
  type IdentityMutationReceipt = MutationReceipt<IdentityRecord>;
736
800
  type LinkMutationReceipt = MutationReceipt<LinkListItem>;
737
- type EventMutationReceipt = MutationReceipt<EventRecord>;
801
+ type EventMutationReceipt = MutationReceipt<EventRecord> & {
802
+ outcome?: "success" | "no_op";
803
+ };
738
804
  type AttributeMutationReceipt = MutationReceipt<AttributeRecord>;
739
805
  type MergeReceipt = MutationReceipt<MergePrimary>;
740
806
  type DismissalMutationReceipt = MutationReceipt<DismissedPairRef>;
@@ -765,6 +831,67 @@ interface MergeHistoryRecord {
765
831
  manual: boolean;
766
832
  }
767
833
 
834
+ interface EventSearchItem {
835
+ [key: string]: unknown;
836
+ kind: "event";
837
+ id: number;
838
+ occurredOn: string;
839
+ type: string;
840
+ title: string;
841
+ matchedOn: string[];
842
+ externalRef?: ExternalRef;
843
+ }
844
+ declare function searchEvents(db: AffinityDb, query: string, options?: {
845
+ limit?: number;
846
+ offset?: number;
847
+ }): EventSearchItem[];
848
+ declare function getEventThread(db: AffinityDb, source: string, id: string, options?: {
849
+ includeContent?: boolean;
850
+ channel?: string;
851
+ limit?: number;
852
+ offset?: number;
853
+ }): EventRecord[];
854
+
855
+ declare function getContactJournal(db: AffinityDb, contactId: number, options?: ContactJournalReadOptions): EventRecord[];
856
+
857
+ declare function listMoments(db: AffinityDb, filters?: ListMomentsFilters, options?: AffinityListReadOptions & {
858
+ channel?: string;
859
+ }): MomentRecord[];
860
+
861
+ declare function listOpenCommitments(db: AffinityDb, filters?: ListOpenCommitmentsFilters, options?: AffinityListReadOptions & {
862
+ channel?: string;
863
+ }): CommitmentRecord[];
864
+
865
+ declare function recordCommitment(db: AffinityDb, input: RecordCommitmentInput): EventMutationReceipt;
866
+
867
+ declare function recordInteraction(db: AffinityDb, input: RecordInteractionInput): EventMutationReceipt;
868
+
869
+ declare function recordMilestone(db: AffinityDb, input: RecordMilestoneInput): EventMutationReceipt;
870
+
871
+ declare function recordObservation(db: AffinityDb, input: RecordObservationInput): EventMutationReceipt;
872
+
873
+ declare function recordTransaction(db: AffinityDb, input: RecordTransactionInput): EventMutationReceipt;
874
+
875
+ declare function resolveCommitment(db: AffinityDb, commitmentEventId: number, resolution: CommitmentResolutionKind, options?: ResolveCommitmentOptions): EventMutationReceipt;
876
+
877
+ type EventTarget = number | {
878
+ eventId?: number;
879
+ ref?: ExternalRef;
880
+ };
881
+ interface ReviseEventPatch {
882
+ summary?: string;
883
+ content?: string;
884
+ occurredAt?: number;
885
+ significance?: number;
886
+ channel?: string;
887
+ type?: EventType;
888
+ externalRef?: ExternalRef;
889
+ }
890
+ declare function reviseEvent(db: AffinityDb, target: EventTarget, patch: ReviseEventPatch): EventMutationReceipt;
891
+ declare function deleteEvent(db: AffinityDb, target: EventTarget, options: {
892
+ confirm: boolean;
893
+ }): EventMutationReceipt;
894
+
768
895
  declare const types_AFFINITY_DEFAULT_LIST_LIMIT: typeof AFFINITY_DEFAULT_LIST_LIMIT;
769
896
  declare const types_AFFINITY_MAX_LIST_LIMIT: typeof AFFINITY_MAX_LIST_LIMIT;
770
897
  type types_AddDateAnchorInput = AddDateAnchorInput;
@@ -806,7 +933,10 @@ type types_EventParticipantView = EventParticipantView;
806
933
  type types_EventRecord = EventRecord;
807
934
  type types_EventRecurrenceKind = EventRecurrenceKind;
808
935
  type types_EventRow = EventRow;
936
+ type types_EventSearchItem = EventSearchItem;
937
+ type types_EventTarget = EventTarget;
809
938
  type types_EventType = EventType;
939
+ type types_ExternalRef = ExternalRef;
810
940
  type types_IdentityMutationReceipt = IdentityMutationReceipt;
811
941
  type types_IdentityRecord = IdentityRecord;
812
942
  type types_IdentityRow = IdentityRow;
@@ -845,6 +975,7 @@ type types_ResolveCommitmentOptions = ResolveCommitmentOptions;
845
975
  type types_ReviseContactPatch = ReviseContactPatch;
846
976
  type types_ReviseDateAnchorOptions = ReviseDateAnchorOptions;
847
977
  type types_ReviseDateAnchorPatch = ReviseDateAnchorPatch;
978
+ type types_ReviseEventPatch = ReviseEventPatch;
848
979
  type types_ReviseIdentityPatch = ReviseIdentityPatch;
849
980
  type types_SeedSocialLinkInput = SeedSocialLinkInput;
850
981
  type types_SetContactLifecycleOptions = SetContactLifecycleOptions;
@@ -856,7 +987,7 @@ type types_UpcomingDateRecord = UpcomingDateRecord;
856
987
  type types_UpcomingDateTargetRef = UpcomingDateTargetRef;
857
988
  declare const types_resolveAffinityListLimit: typeof resolveAffinityListLimit;
858
989
  declare namespace types {
859
- export { types_AFFINITY_DEFAULT_LIST_LIMIT as AFFINITY_DEFAULT_LIST_LIMIT, types_AFFINITY_MAX_LIST_LIMIT as AFFINITY_MAX_LIST_LIMIT, type types_AddDateAnchorInput as AddDateAnchorInput, type types_AddIdentityInput as AddIdentityInput, type types_AffinityChartEdge as AffinityChartEdge, type types_AffinityChartNode as AffinityChartNode, type types_AffinityChartReadOptions as AffinityChartReadOptions, type types_AffinityChartRecord as AffinityChartRecord, type types_AffinityListReadOptions as AffinityListReadOptions, type types_AttributeEntry as AttributeEntry, type types_AttributeMutationReceipt as AttributeMutationReceipt, type types_AttributeName as AttributeName, type types_AttributeRecord as AttributeRecord, type types_AttributeTarget as AttributeTarget, type types_CommitmentRecord as CommitmentRecord, type types_CommitmentResolutionKind as CommitmentResolutionKind, type types_CommitmentResolutionState as CommitmentResolutionState, type types_ContactCore as ContactCore, type types_ContactJournalReadOptions as ContactJournalReadOptions, type types_ContactKind as ContactKind, type types_ContactLifecycleState as ContactLifecycleState, type types_ContactListItem as ContactListItem, type types_ContactMutationReceipt as ContactMutationReceipt, type types_ContactProfileReadOptions as ContactProfileReadOptions, type types_ContactProfileRecord as ContactProfileRecord, type types_ContactRow as ContactRow, type types_CreateContactInput as CreateContactInput, type types_DateAnchorTarget as DateAnchorTarget, type types_DerivedLinkEffect as DerivedLinkEffect, type types_DismissalMutationReceipt as DismissalMutationReceipt, type types_DismissedDuplicateRecord as DismissedDuplicateRecord, type types_DismissedPairRef as DismissedPairRef, type types_DuplicateCandidateRecord as DuplicateCandidateRecord, type types_EntityRef as EntityRef, type types_EventMomentKind as EventMomentKind, type types_EventMutationReceipt as EventMutationReceipt, type types_EventParticipantRole as EventParticipantRole, type types_EventParticipantView as EventParticipantView, type types_EventRecord as EventRecord, type types_EventRecurrenceKind as EventRecurrenceKind, type types_EventRow as EventRow, type types_EventType as EventType, type types_IdentityMutationReceipt as IdentityMutationReceipt, type types_IdentityRecord as IdentityRecord, type types_IdentityRow as IdentityRow, type types_IdentityType as IdentityType, type types_InteractionEventType as InteractionEventType, type types_LinkDetailReadOptions as LinkDetailReadOptions, type types_LinkDetailRecord as LinkDetailRecord, type types_LinkKind as LinkKind, type types_LinkListItem as LinkListItem, type types_LinkListReadFilters as LinkListReadFilters, type types_LinkMutationOptions as LinkMutationOptions, type types_LinkMutationReceipt as LinkMutationReceipt, type types_LinkRow as LinkRow, type types_LinkState as LinkState, type types_ListContactsFilters as ListContactsFilters, type types_ListDuplicateCandidatesFilters as ListDuplicateCandidatesFilters, type types_ListMomentsFilters as ListMomentsFilters, type types_ListOpenCommitmentsFilters as ListOpenCommitmentsFilters, type types_ListUpcomingDatesFilters as ListUpcomingDatesFilters, type types_MergeContactsInput as MergeContactsInput, type types_MergeHistoryRecord as MergeHistoryRecord, type types_MergePrimary as MergePrimary, type types_MergeReceipt as MergeReceipt, type types_MomentRecord as MomentRecord, type types_MutationReceipt as MutationReceipt, type types_OpaqueDerivation as OpaqueDerivation, type types_OpaqueRollup as OpaqueRollup, type types_RadarRecord as RadarRecord, type types_RecordCommitmentInput as RecordCommitmentInput, type types_RecordInteractionInput as RecordInteractionInput, type types_RecordMilestoneInput as RecordMilestoneInput, type types_RecordObservationInput as RecordObservationInput, type types_RecordTransactionInput as RecordTransactionInput, type types_RelationalLinkKind as RelationalLinkKind, type types_ResolveCommitmentOptions as ResolveCommitmentOptions, type types_ReviseContactPatch as ReviseContactPatch, type types_ReviseDateAnchorOptions as ReviseDateAnchorOptions, type types_ReviseDateAnchorPatch as ReviseDateAnchorPatch, type types_ReviseIdentityPatch as ReviseIdentityPatch, type types_SeedSocialLinkInput as SeedSocialLinkInput, type types_SetContactLifecycleOptions as SetContactLifecycleOptions, type types_SetStructuralTieInput as SetStructuralTieInput, type types_SocialEventInput as SocialEventInput, type types_SocialEventParticipantInput as SocialEventParticipantInput, type types_StructuralLinkKind as StructuralLinkKind, type types_UpcomingDateRecord as UpcomingDateRecord, type types_UpcomingDateTargetRef as UpcomingDateTargetRef, types_resolveAffinityListLimit as resolveAffinityListLimit };
990
+ export { types_AFFINITY_DEFAULT_LIST_LIMIT as AFFINITY_DEFAULT_LIST_LIMIT, types_AFFINITY_MAX_LIST_LIMIT as AFFINITY_MAX_LIST_LIMIT, type types_AddDateAnchorInput as AddDateAnchorInput, type types_AddIdentityInput as AddIdentityInput, type types_AffinityChartEdge as AffinityChartEdge, type types_AffinityChartNode as AffinityChartNode, type types_AffinityChartReadOptions as AffinityChartReadOptions, type types_AffinityChartRecord as AffinityChartRecord, type types_AffinityListReadOptions as AffinityListReadOptions, type types_AttributeEntry as AttributeEntry, type types_AttributeMutationReceipt as AttributeMutationReceipt, type types_AttributeName as AttributeName, type types_AttributeRecord as AttributeRecord, type types_AttributeTarget as AttributeTarget, type types_CommitmentRecord as CommitmentRecord, type types_CommitmentResolutionKind as CommitmentResolutionKind, type types_CommitmentResolutionState as CommitmentResolutionState, type types_ContactCore as ContactCore, type types_ContactJournalReadOptions as ContactJournalReadOptions, type types_ContactKind as ContactKind, type types_ContactLifecycleState as ContactLifecycleState, type types_ContactListItem as ContactListItem, type types_ContactMutationReceipt as ContactMutationReceipt, type types_ContactProfileReadOptions as ContactProfileReadOptions, type types_ContactProfileRecord as ContactProfileRecord, type types_ContactRow as ContactRow, type types_CreateContactInput as CreateContactInput, type types_DateAnchorTarget as DateAnchorTarget, type types_DerivedLinkEffect as DerivedLinkEffect, type types_DismissalMutationReceipt as DismissalMutationReceipt, type types_DismissedDuplicateRecord as DismissedDuplicateRecord, type types_DismissedPairRef as DismissedPairRef, type types_DuplicateCandidateRecord as DuplicateCandidateRecord, type types_EntityRef as EntityRef, type types_EventMomentKind as EventMomentKind, type types_EventMutationReceipt as EventMutationReceipt, type types_EventParticipantRole as EventParticipantRole, type types_EventParticipantView as EventParticipantView, type types_EventRecord as EventRecord, type types_EventRecurrenceKind as EventRecurrenceKind, type types_EventRow as EventRow, type types_EventSearchItem as EventSearchItem, type types_EventTarget as EventTarget, type types_EventType as EventType, type types_ExternalRef as ExternalRef, type types_IdentityMutationReceipt as IdentityMutationReceipt, type types_IdentityRecord as IdentityRecord, type types_IdentityRow as IdentityRow, type types_IdentityType as IdentityType, type types_InteractionEventType as InteractionEventType, type types_LinkDetailReadOptions as LinkDetailReadOptions, type types_LinkDetailRecord as LinkDetailRecord, type types_LinkKind as LinkKind, type types_LinkListItem as LinkListItem, type types_LinkListReadFilters as LinkListReadFilters, type types_LinkMutationOptions as LinkMutationOptions, type types_LinkMutationReceipt as LinkMutationReceipt, type types_LinkRow as LinkRow, type types_LinkState as LinkState, type types_ListContactsFilters as ListContactsFilters, type types_ListDuplicateCandidatesFilters as ListDuplicateCandidatesFilters, type types_ListMomentsFilters as ListMomentsFilters, type types_ListOpenCommitmentsFilters as ListOpenCommitmentsFilters, type types_ListUpcomingDatesFilters as ListUpcomingDatesFilters, type types_MergeContactsInput as MergeContactsInput, type types_MergeHistoryRecord as MergeHistoryRecord, type types_MergePrimary as MergePrimary, type types_MergeReceipt as MergeReceipt, type types_MomentRecord as MomentRecord, type types_MutationReceipt as MutationReceipt, type types_OpaqueDerivation as OpaqueDerivation, type types_OpaqueRollup as OpaqueRollup, type types_RadarRecord as RadarRecord, type types_RecordCommitmentInput as RecordCommitmentInput, type types_RecordInteractionInput as RecordInteractionInput, type types_RecordMilestoneInput as RecordMilestoneInput, type types_RecordObservationInput as RecordObservationInput, type types_RecordTransactionInput as RecordTransactionInput, type types_RelationalLinkKind as RelationalLinkKind, type types_ResolveCommitmentOptions as ResolveCommitmentOptions, type types_ReviseContactPatch as ReviseContactPatch, type types_ReviseDateAnchorOptions as ReviseDateAnchorOptions, type types_ReviseDateAnchorPatch as ReviseDateAnchorPatch, type types_ReviseEventPatch as ReviseEventPatch, type types_ReviseIdentityPatch as ReviseIdentityPatch, type types_SeedSocialLinkInput as SeedSocialLinkInput, type types_SetContactLifecycleOptions as SetContactLifecycleOptions, type types_SetStructuralTieInput as SetStructuralTieInput, type types_SocialEventInput as SocialEventInput, type types_SocialEventParticipantInput as SocialEventParticipantInput, type types_StructuralLinkKind as StructuralLinkKind, type types_UpcomingDateRecord as UpcomingDateRecord, type types_UpcomingDateTargetRef as UpcomingDateTargetRef, types_resolveAffinityListLimit as resolveAffinityListLimit };
860
991
  }
861
992
 
862
993
  declare function createContact(db: AffinityDb, input: CreateContactInput): ContactMutationReceipt;
@@ -925,24 +1056,6 @@ declare function undismissDuplicate(db: AffinityDb, leftContactId: number, right
925
1056
 
926
1057
  declare function listDismissedDuplicates(db: AffinityDb, options?: AffinityListReadOptions): DismissedDuplicateRecord[];
927
1058
 
928
- declare function getContactJournal(db: AffinityDb, contactId: number, options?: ContactJournalReadOptions): EventRecord[];
929
-
930
- declare function listMoments(db: AffinityDb, filters?: ListMomentsFilters, options?: AffinityListReadOptions): MomentRecord[];
931
-
932
- declare function listOpenCommitments(db: AffinityDb, filters?: ListOpenCommitmentsFilters, options?: AffinityListReadOptions): CommitmentRecord[];
933
-
934
- declare function recordCommitment(db: AffinityDb, input: RecordCommitmentInput): EventMutationReceipt;
935
-
936
- declare function recordInteraction(db: AffinityDb, input: RecordInteractionInput): EventMutationReceipt;
937
-
938
- declare function recordMilestone(db: AffinityDb, input: RecordMilestoneInput): EventMutationReceipt;
939
-
940
- declare function recordObservation(db: AffinityDb, input: RecordObservationInput): EventMutationReceipt;
941
-
942
- declare function recordTransaction(db: AffinityDb, input: RecordTransactionInput): EventMutationReceipt;
943
-
944
- declare function resolveCommitment(db: AffinityDb, commitmentEventId: number, resolution: CommitmentResolutionKind, options?: ResolveCommitmentOptions): EventMutationReceipt;
945
-
946
1059
  /** Export all stored records belonging to a contact, including archived history. */
947
1060
  declare function exportContact(db: AffinityDb, id: number): {
948
1061
  contact: Record<string, unknown>;
@@ -962,25 +1075,32 @@ declare function exportAffinity(db: AffinityDb): {
962
1075
  version: number;
963
1076
  exportedAt: number;
964
1077
  exportedAtIso: string;
1078
+ events: (Record<string, unknown> & {
1079
+ participants: Record<string, unknown>[];
1080
+ })[];
965
1081
  contacts: {
1082
+ eventIds: unknown[];
1083
+ dateIds: unknown[];
966
1084
  contact: Record<string, unknown>;
967
1085
  identities: Record<string, unknown>[];
968
1086
  attributes: Record<string, unknown>[];
969
1087
  links: Record<string, unknown>[];
970
- events: (Record<string, unknown> & {
971
- participants: Record<string, unknown>[];
972
- })[];
973
1088
  commitments: Record<string, unknown>[];
974
- dates: Record<string, unknown>[];
975
1089
  mergeHistory: Record<string, unknown>[];
976
1090
  }[];
977
1091
  };
978
1092
 
1093
+ declare function getEventById(db: AffinityDb, eventId: number): EventRecord | null;
1094
+ declare function getEventByExternalRef(db: AffinityDb, source: string, id: string): EventRecord | null;
1095
+
979
1096
  declare const read_exportAffinity: typeof exportAffinity;
980
1097
  declare const read_exportContact: typeof exportContact;
981
1098
  declare const read_getAffinityChart: typeof getAffinityChart;
982
1099
  declare const read_getContactJournal: typeof getContactJournal;
983
1100
  declare const read_getContactProfile: typeof getContactProfile;
1101
+ declare const read_getEventByExternalRef: typeof getEventByExternalRef;
1102
+ declare const read_getEventById: typeof getEventById;
1103
+ declare const read_getEventThread: typeof getEventThread;
984
1104
  declare const read_getLinkDetail: typeof getLinkDetail;
985
1105
  declare const read_getLinkTimeline: typeof getLinkTimeline;
986
1106
  declare const read_getLinksBetween: typeof getLinksBetween;
@@ -997,8 +1117,9 @@ declare const read_listProgressionReadiness: typeof listProgressionReadiness;
997
1117
  declare const read_listRadar: typeof listRadar;
998
1118
  declare const read_listUpcomingDates: typeof listUpcomingDates;
999
1119
  declare const read_searchContacts: typeof searchContacts;
1120
+ declare const read_searchEvents: typeof searchEvents;
1000
1121
  declare namespace read {
1001
- export { read_exportAffinity as exportAffinity, read_exportContact as exportContact, read_getAffinityChart as getAffinityChart, read_getContactJournal as getContactJournal, read_getContactProfile as getContactProfile, read_getLinkDetail as getLinkDetail, read_getLinkTimeline as getLinkTimeline, read_getLinksBetween as getLinksBetween, read_getMergeHistory as getMergeHistory, read_getOwnerProfile as getOwnerProfile, read_listContacts as listContacts, read_listDismissedDuplicates as listDismissedDuplicates, read_listDuplicateCandidates as listDuplicateCandidates, read_listMoments as listMoments, read_listObservedLinks as listObservedLinks, read_listOpenCommitments as listOpenCommitments, read_listOwnerSocialLinks as listOwnerSocialLinks, read_listProgressionReadiness as listProgressionReadiness, read_listRadar as listRadar, read_listUpcomingDates as listUpcomingDates, read_searchContacts as searchContacts };
1122
+ export { read_exportAffinity as exportAffinity, read_exportContact as exportContact, read_getAffinityChart as getAffinityChart, read_getContactJournal as getContactJournal, read_getContactProfile as getContactProfile, read_getEventByExternalRef as getEventByExternalRef, read_getEventById as getEventById, read_getEventThread as getEventThread, read_getLinkDetail as getLinkDetail, read_getLinkTimeline as getLinkTimeline, read_getLinksBetween as getLinksBetween, read_getMergeHistory as getMergeHistory, read_getOwnerProfile as getOwnerProfile, read_listContacts as listContacts, read_listDismissedDuplicates as listDismissedDuplicates, read_listDuplicateCandidates as listDuplicateCandidates, read_listMoments as listMoments, read_listObservedLinks as listObservedLinks, read_listOpenCommitments as listOpenCommitments, read_listOwnerSocialLinks as listOwnerSocialLinks, read_listProgressionReadiness as listProgressionReadiness, read_listRadar as listRadar, read_listUpcomingDates as listUpcomingDates, read_searchContacts as searchContacts, read_searchEvents as searchEvents };
1002
1123
  }
1003
1124
 
1004
1125
  interface AffinitySoulTrait {
@@ -1141,7 +1262,7 @@ type ToolEntityKind = "contact" | "identity" | "link" | "event" | "attribute";
1141
1262
  type ToolOutcomeKind = "success" | "no_op" | "needs_clarification" | "error";
1142
1263
  type ToolErrorCode = "clarification_needed" | "conflict" | "constraint_violation" | "invalid_input" | "invalid_state" | "not_found" | "system_error" | "unsupported_target";
1143
1264
  type ToolErrorKind = "domain" | "protocol" | "system";
1144
- type ToolWarningCode = "already_in_state" | "derived_value_used" | "empty_result" | "possible_duplicate" | "partial_match" | "unchanged";
1265
+ type ToolWarningCode = "already_in_state" | "derived_value_used" | "empty_result" | "future_event" | "possible_duplicate" | "partial_match" | "unchanged";
1145
1266
  type ToolClarificationCode = "ambiguous_target" | "missing_required_choice" | "multiple_plausible_matches";
1146
1267
  type ToolNextStepHintKind = "ask_user" | "inspect_item" | "review_view" | "retry_with" | "use_tool";
1147
1268
  interface ToolEntityRef {
@@ -1194,6 +1315,9 @@ interface ToolNeedsClarification extends ToolBaseResult {
1194
1315
  };
1195
1316
  }
1196
1317
  interface ToolFailure extends ToolBaseResult {
1318
+ data?: {
1319
+ existingContactId: number;
1320
+ };
1197
1321
  ok: false;
1198
1322
  outcome: "error";
1199
1323
  error: {
@@ -1272,7 +1396,6 @@ declare function oneOfSchema(schemas: ReadonlyArray<JsonSchema>, description?: s
1272
1396
  type TimeInputs<T> = T extends readonly (infer U)[] ? readonly TimeInputs<U>[] : T extends object ? {
1273
1397
  [K in keyof T]: K extends `${string}At` | "now" | "asOf" | "since" | "until" ? T[K] | string : TimeInputs<T[K]>;
1274
1398
  } : T;
1275
- /** Parse human time inputs using UTC days. Library mutations still accept numbers. */
1276
1399
  declare function parseTimeInput(value: number | string, field?: string, now?: number): number;
1277
1400
 
1278
1401
  type ContactLocator = {
@@ -1307,6 +1430,10 @@ declare function mapErrorToToolFailure(error: unknown, summary?: string): ToolFa
1307
1430
  declare function withToolHandling<TData>(operation: () => ToolResult<TData>, summary?: string): ToolResult<TData>;
1308
1431
 
1309
1432
  type InspectAffinityItemToolInput = {
1433
+ kind: "event";
1434
+ eventId?: number;
1435
+ ref?: ExternalRef;
1436
+ } | {
1310
1437
  kind: "owner_profile";
1311
1438
  topLinksLimit?: number;
1312
1439
  } | {
@@ -1320,6 +1447,9 @@ type InspectAffinityItemToolInput = {
1320
1447
  recentEventsLimit?: number;
1321
1448
  };
1322
1449
  type InspectAffinityItemToolData = {
1450
+ kind: "event";
1451
+ detail: EventRecord;
1452
+ } | {
1323
1453
  kind: "owner_profile";
1324
1454
  detail: ContactProfileRecord;
1325
1455
  } | {
@@ -1342,6 +1472,7 @@ interface MutationToolData<TPrimary> {
1342
1472
  }[];
1343
1473
  action: string;
1344
1474
  primary: TPrimary;
1475
+ matchedIdentities?: AddIdentityInput[];
1345
1476
  created: MutationReceipt<TPrimary>["created"];
1346
1477
  updated: MutationReceipt<TPrimary>["updated"];
1347
1478
  archived: MutationReceipt<TPrimary>["archived"];
@@ -1357,6 +1488,9 @@ type AttributeTargetInput = {
1357
1488
  } | {
1358
1489
  kind: "link";
1359
1490
  link: LinkLocator;
1491
+ } | {
1492
+ kind: "event";
1493
+ eventId: number;
1360
1494
  };
1361
1495
  type ManageAttributeToolInput = {
1362
1496
  action: "set";
@@ -1589,25 +1723,37 @@ declare const mergeContactsTool: AffinityToolDefinition<{
1589
1723
  now?: string | number;
1590
1724
  }, MergeContactsToolResult>;
1591
1725
 
1726
+ type ToolEvidence<T extends {
1727
+ participants: readonly SocialEventParticipantInput[];
1728
+ }> = Omit<T, "participants"> & {
1729
+ participants: readonly (SocialEventParticipantInput | {
1730
+ contact: ContactLocator;
1731
+ role: SocialEventParticipantInput["role"];
1732
+ directionality?: SocialEventParticipantInput["directionality"];
1733
+ })[];
1734
+ };
1592
1735
  type RecordEventToolInput = {
1593
1736
  kind: "interaction";
1594
- input: RecordInteractionInput;
1737
+ input: ToolEvidence<RecordInteractionInput>;
1595
1738
  } | {
1596
1739
  kind: "observation";
1597
- input: RecordObservationInput;
1740
+ input: ToolEvidence<RecordObservationInput>;
1598
1741
  } | {
1599
1742
  kind: "milestone";
1600
- input: RecordMilestoneInput;
1743
+ input: ToolEvidence<RecordMilestoneInput>;
1601
1744
  } | {
1602
1745
  kind: "transaction";
1603
- input: RecordTransactionInput;
1746
+ input: ToolEvidence<RecordTransactionInput>;
1604
1747
  };
1605
1748
  type RecordEventToolResult = ToolResult<MutationToolData<EventRecord>>;
1606
1749
  declare function recordEventToolHandler(db: AffinityDb, rawInput: TimeInputs<RecordEventToolInput>): RecordEventToolResult;
1607
1750
  declare const recordEventTool: AffinityToolDefinition<TimeInputs<RecordEventToolInput>, RecordEventToolResult>;
1608
1751
 
1609
- type ReviewAffinityToolView = "contacts.list" | "contacts.duplicates" | "events.contact_journal" | "events.link_timeline" | "events.moments" | "commitments.open" | "links.owner" | "links.observed" | "links.progression_readiness" | "links.radar" | "dates.upcoming" | "graph.chart" | "merges.history" | "merges.dismissed";
1752
+ type ReviewAffinityToolView = "contacts.list" | "contacts.duplicates" | "events.thread" | "events.contact_journal" | "events.link_timeline" | "events.moments" | "commitments.open" | "links.owner" | "links.observed" | "links.progression_readiness" | "links.radar" | "dates.upcoming" | "graph.chart" | "merges.history" | "merges.dismissed";
1610
1753
  interface ReviewAffinityToolInput {
1754
+ ref?: ExternalRef;
1755
+ includeContent?: boolean;
1756
+ channel?: string;
1611
1757
  view: ReviewAffinityToolView;
1612
1758
  now?: number;
1613
1759
  contact?: ContactLocator;
@@ -1640,12 +1786,20 @@ interface ReviewAffinityToolData {
1640
1786
  view: ReviewAffinityToolView;
1641
1787
  items: ToolListItem[];
1642
1788
  count: number;
1789
+ total?: number;
1790
+ hasMore?: boolean;
1643
1791
  appliedFilters: Record<string, unknown>;
1644
1792
  chart?: AffinityChartRecord | undefined;
1645
1793
  }
1646
1794
  type ReviewAffinityToolResult = ToolResult<ReviewAffinityToolData>;
1647
1795
  declare function reviewAffinityToolHandler(db: AffinityDb, rawInput: TimeInputs<ReviewAffinityToolInput>): ReviewAffinityToolResult;
1648
1796
  declare const reviewAffinityTool: AffinityToolDefinition<{
1797
+ ref?: {
1798
+ source: string;
1799
+ id: string;
1800
+ };
1801
+ includeContent?: boolean;
1802
+ channel?: string;
1649
1803
  view: ReviewAffinityToolView;
1650
1804
  now?: string | number;
1651
1805
  contact?: {
@@ -1706,6 +1860,7 @@ declare function toMutationRefEntity(ref: EntityRef): ToolEntityRef;
1706
1860
  declare function toReceiptEntityRefs<TPrimary>(receipt: MutationReceipt<TPrimary>): ToolEntityRef[];
1707
1861
 
1708
1862
  interface SearchAffinityToolInput {
1863
+ scope?: "contacts" | "events" | "all";
1709
1864
  query: string;
1710
1865
  kind?: ContactKind;
1711
1866
  lifecycleState?: ContactLifecycleState;
@@ -1721,10 +1876,13 @@ interface SearchAffinityToolData {
1721
1876
  query: string;
1722
1877
  items: ReturnType<typeof toContactListToolItem>[];
1723
1878
  count: number;
1879
+ total?: number;
1880
+ hasMore?: boolean;
1724
1881
  }
1725
1882
  type SearchAffinityToolResult = ToolResult<SearchAffinityToolData>;
1726
1883
  declare function searchAffinityToolHandler(db: AffinityDb, rawInput: TimeInputs<SearchAffinityToolInput>): SearchAffinityToolResult;
1727
1884
  declare const searchAffinityTool: AffinityToolDefinition<{
1885
+ scope?: "contacts" | "events" | "all";
1728
1886
  query: string;
1729
1887
  kind?: ContactKind;
1730
1888
  lifecycleState?: ContactLifecycleState;
@@ -1737,6 +1895,37 @@ declare const searchAffinityTool: AffinityToolDefinition<{
1737
1895
  offset?: number;
1738
1896
  }, SearchAffinityToolResult>;
1739
1897
 
1898
+ interface ManageEventToolInput {
1899
+ action: "revise" | "delete";
1900
+ eventId?: number;
1901
+ ref?: ExternalRef;
1902
+ patch?: ReviseEventPatch;
1903
+ confirm?: boolean;
1904
+ }
1905
+ type ManageEventToolResult = ToolResult<MutationToolData<EventRecord>>;
1906
+ declare function manageEventToolHandler(db: AffinityDb, raw: TimeInputs<ManageEventToolInput>): ManageEventToolResult;
1907
+ declare const manageEventTool: AffinityToolDefinition<{
1908
+ action: "revise" | "delete";
1909
+ eventId?: number;
1910
+ ref?: {
1911
+ source: string;
1912
+ id: string;
1913
+ };
1914
+ patch?: {
1915
+ summary?: string;
1916
+ content?: string;
1917
+ occurredAt?: string | number;
1918
+ significance?: number;
1919
+ channel?: string;
1920
+ type?: EventType;
1921
+ externalRef?: {
1922
+ source: string;
1923
+ id: string;
1924
+ };
1925
+ };
1926
+ confirm?: boolean;
1927
+ }, ManageEventToolResult>;
1928
+
1740
1929
  declare const affinityTools: (AffinityToolDefinition<TimeInputs<InspectAffinityItemToolInput>, InspectAffinityItemToolResult> | AffinityToolDefinition<TimeInputs<ManageAttributeToolInput>, ManageAttributeToolResult> | AffinityToolDefinition<TimeInputs<ManageCommitmentToolInput>, ManageCommitmentToolResult> | AffinityToolDefinition<TimeInputs<ManageContactToolInput>, ManageContactToolResult> | AffinityToolDefinition<{
1741
1930
  action: "dismiss" | "undismiss";
1742
1931
  left: {
@@ -1776,6 +1965,12 @@ declare const affinityTools: (AffinityToolDefinition<TimeInputs<InspectAffinityI
1776
1965
  reasonSummary?: string | null;
1777
1966
  now?: string | number;
1778
1967
  }, MergeContactsToolResult> | AffinityToolDefinition<TimeInputs<RecordEventToolInput>, RecordEventToolResult> | AffinityToolDefinition<{
1968
+ ref?: {
1969
+ source: string;
1970
+ id: string;
1971
+ };
1972
+ includeContent?: boolean;
1973
+ channel?: string;
1779
1974
  view: ReviewAffinityToolView;
1780
1975
  now?: string | number;
1781
1976
  contact?: {
@@ -1821,6 +2016,7 @@ declare const affinityTools: (AffinityToolDefinition<TimeInputs<InspectAffinityI
1821
2016
  limit?: number;
1822
2017
  offset?: number;
1823
2018
  }, ReviewAffinityToolResult> | AffinityToolDefinition<{
2019
+ scope?: "contacts" | "events" | "all";
1824
2020
  query: string;
1825
2021
  kind?: ContactKind;
1826
2022
  lifecycleState?: ContactLifecycleState;
@@ -1831,7 +2027,27 @@ declare const affinityTools: (AffinityToolDefinition<TimeInputs<InspectAffinityI
1831
2027
  includeDormant?: boolean;
1832
2028
  limit?: number;
1833
2029
  offset?: number;
1834
- }, SearchAffinityToolResult>)[];
2030
+ }, SearchAffinityToolResult> | AffinityToolDefinition<{
2031
+ action: "revise" | "delete";
2032
+ eventId?: number;
2033
+ ref?: {
2034
+ source: string;
2035
+ id: string;
2036
+ };
2037
+ patch?: {
2038
+ summary?: string;
2039
+ content?: string;
2040
+ occurredAt?: string | number;
2041
+ significance?: number;
2042
+ channel?: string;
2043
+ type?: EventType;
2044
+ externalRef?: {
2045
+ source: string;
2046
+ id: string;
2047
+ };
2048
+ };
2049
+ confirm?: boolean;
2050
+ }, ManageEventToolResult>)[];
1835
2051
  declare function listAffinityToolDefinitions(): (AffinityToolDefinition<TimeInputs<InspectAffinityItemToolInput>, InspectAffinityItemToolResult> | AffinityToolDefinition<TimeInputs<ManageAttributeToolInput>, ManageAttributeToolResult> | AffinityToolDefinition<TimeInputs<ManageCommitmentToolInput>, ManageCommitmentToolResult> | AffinityToolDefinition<TimeInputs<ManageContactToolInput>, ManageContactToolResult> | AffinityToolDefinition<{
1836
2052
  action: "dismiss" | "undismiss";
1837
2053
  left: {
@@ -1871,6 +2087,12 @@ declare function listAffinityToolDefinitions(): (AffinityToolDefinition<TimeInpu
1871
2087
  reasonSummary?: string | null;
1872
2088
  now?: string | number;
1873
2089
  }, MergeContactsToolResult> | AffinityToolDefinition<TimeInputs<RecordEventToolInput>, RecordEventToolResult> | AffinityToolDefinition<{
2090
+ ref?: {
2091
+ source: string;
2092
+ id: string;
2093
+ };
2094
+ includeContent?: boolean;
2095
+ channel?: string;
1874
2096
  view: ReviewAffinityToolView;
1875
2097
  now?: string | number;
1876
2098
  contact?: {
@@ -1916,6 +2138,7 @@ declare function listAffinityToolDefinitions(): (AffinityToolDefinition<TimeInpu
1916
2138
  limit?: number;
1917
2139
  offset?: number;
1918
2140
  }, ReviewAffinityToolResult> | AffinityToolDefinition<{
2141
+ scope?: "contacts" | "events" | "all";
1919
2142
  query: string;
1920
2143
  kind?: ContactKind;
1921
2144
  lifecycleState?: ContactLifecycleState;
@@ -1926,7 +2149,27 @@ declare function listAffinityToolDefinitions(): (AffinityToolDefinition<TimeInpu
1926
2149
  includeDormant?: boolean;
1927
2150
  limit?: number;
1928
2151
  offset?: number;
1929
- }, SearchAffinityToolResult>)[];
2152
+ }, SearchAffinityToolResult> | AffinityToolDefinition<{
2153
+ action: "revise" | "delete";
2154
+ eventId?: number;
2155
+ ref?: {
2156
+ source: string;
2157
+ id: string;
2158
+ };
2159
+ patch?: {
2160
+ summary?: string;
2161
+ content?: string;
2162
+ occurredAt?: string | number;
2163
+ significance?: number;
2164
+ channel?: string;
2165
+ type?: EventType;
2166
+ externalRef?: {
2167
+ source: string;
2168
+ id: string;
2169
+ };
2170
+ };
2171
+ confirm?: boolean;
2172
+ }, ManageEventToolResult>)[];
1930
2173
  declare function getAffinityToolByName(name: string): AffinityToolDefinition<TimeInputs<InspectAffinityItemToolInput>, InspectAffinityItemToolResult> | AffinityToolDefinition<TimeInputs<ManageAttributeToolInput>, ManageAttributeToolResult> | AffinityToolDefinition<TimeInputs<ManageCommitmentToolInput>, ManageCommitmentToolResult> | AffinityToolDefinition<TimeInputs<ManageContactToolInput>, ManageContactToolResult> | AffinityToolDefinition<{
1931
2174
  action: "dismiss" | "undismiss";
1932
2175
  left: {
@@ -1966,6 +2209,12 @@ declare function getAffinityToolByName(name: string): AffinityToolDefinition<Tim
1966
2209
  reasonSummary?: string | null;
1967
2210
  now?: string | number;
1968
2211
  }, MergeContactsToolResult> | AffinityToolDefinition<TimeInputs<RecordEventToolInput>, RecordEventToolResult> | AffinityToolDefinition<{
2212
+ ref?: {
2213
+ source: string;
2214
+ id: string;
2215
+ };
2216
+ includeContent?: boolean;
2217
+ channel?: string;
1969
2218
  view: ReviewAffinityToolView;
1970
2219
  now?: string | number;
1971
2220
  contact?: {
@@ -2011,6 +2260,7 @@ declare function getAffinityToolByName(name: string): AffinityToolDefinition<Tim
2011
2260
  limit?: number;
2012
2261
  offset?: number;
2013
2262
  }, ReviewAffinityToolResult> | AffinityToolDefinition<{
2263
+ scope?: "contacts" | "events" | "all";
2014
2264
  query: string;
2015
2265
  kind?: ContactKind;
2016
2266
  lifecycleState?: ContactLifecycleState;
@@ -2021,7 +2271,27 @@ declare function getAffinityToolByName(name: string): AffinityToolDefinition<Tim
2021
2271
  includeDormant?: boolean;
2022
2272
  limit?: number;
2023
2273
  offset?: number;
2024
- }, SearchAffinityToolResult> | null;
2274
+ }, SearchAffinityToolResult> | AffinityToolDefinition<{
2275
+ action: "revise" | "delete";
2276
+ eventId?: number;
2277
+ ref?: {
2278
+ source: string;
2279
+ id: string;
2280
+ };
2281
+ patch?: {
2282
+ summary?: string;
2283
+ content?: string;
2284
+ occurredAt?: string | number;
2285
+ significance?: number;
2286
+ channel?: string;
2287
+ type?: EventType;
2288
+ externalRef?: {
2289
+ source: string;
2290
+ id: string;
2291
+ };
2292
+ };
2293
+ confirm?: boolean;
2294
+ }, ManageEventToolResult> | null;
2025
2295
 
2026
2296
  interface AffinityToolMapping {
2027
2297
  source: string;
@@ -2044,6 +2314,7 @@ declare const recordEventToolName = "record_event";
2044
2314
  declare const manageCommitmentToolName = "manage_commitment";
2045
2315
  declare const manageDateAnchorToolName = "manage_date_anchor";
2046
2316
  declare const manageAttributeToolName = "manage_attribute";
2317
+ declare const manageEventToolName = "manage_event";
2047
2318
 
2048
2319
  declare function summarizeCount(count: number, singular: string): string;
2049
2320
 
@@ -2053,6 +2324,8 @@ type index_ContactLocator = ContactLocator;
2053
2324
  type index_JsonSchema = JsonSchema;
2054
2325
  type index_JsonSchemaType = JsonSchemaType;
2055
2326
  type index_LinkLocator = LinkLocator;
2327
+ type index_ManageEventToolInput = ManageEventToolInput;
2328
+ type index_ManageEventToolResult = ManageEventToolResult;
2056
2329
  type index_MutationToolData<TPrimary> = MutationToolData<TPrimary>;
2057
2330
  type index_ResolvedTarget<T> = ResolvedTarget<T>;
2058
2331
  type index_ToolBaseResult = ToolBaseResult;
@@ -2098,6 +2371,9 @@ declare const index_manageDateAnchorToolName: typeof manageDateAnchorToolName;
2098
2371
  declare const index_manageDuplicateDismissalTool: typeof manageDuplicateDismissalTool;
2099
2372
  declare const index_manageDuplicateDismissalToolHandler: typeof manageDuplicateDismissalToolHandler;
2100
2373
  declare const index_manageDuplicateDismissalToolName: typeof manageDuplicateDismissalToolName;
2374
+ declare const index_manageEventTool: typeof manageEventTool;
2375
+ declare const index_manageEventToolHandler: typeof manageEventToolHandler;
2376
+ declare const index_manageEventToolName: typeof manageEventToolName;
2101
2377
  declare const index_manageIdentityTool: typeof manageIdentityTool;
2102
2378
  declare const index_manageIdentityToolHandler: typeof manageIdentityToolHandler;
2103
2379
  declare const index_manageIdentityToolName: typeof manageIdentityToolName;
@@ -2146,7 +2422,7 @@ declare const index_toolSuccess: typeof toolSuccess;
2146
2422
  declare const index_toolWarning: typeof toolWarning;
2147
2423
  declare const index_withToolHandling: typeof withToolHandling;
2148
2424
  declare namespace index {
2149
- export { type index_AffinityToolDefinition as AffinityToolDefinition, type index_AffinityToolMapping as AffinityToolMapping, type index_ContactLocator as ContactLocator, type index_JsonSchema as JsonSchema, type index_JsonSchemaType as JsonSchemaType, type index_LinkLocator as LinkLocator, type index_MutationToolData as MutationToolData, type index_ResolvedTarget as ResolvedTarget, type index_ToolBaseResult as ToolBaseResult, type index_ToolDefinitionRegistry as ToolDefinitionRegistry, type index_ToolEntityKind as ToolEntityKind, type index_ToolEntityRef as ToolEntityRef, type index_ToolFailure as ToolFailure, type index_ToolInputDescriptions as ToolInputDescriptions, type index_ToolListItem as ToolListItem, type index_ToolNeedsClarification as ToolNeedsClarification, type index_ToolNextStepHint as ToolNextStepHint, type index_ToolOutcomeKind as ToolOutcomeKind, type index_ToolOutputDescription as ToolOutputDescription, type index_ToolResult as ToolResult, type index_ToolSideEffects as ToolSideEffects, type index_ToolSuccess as ToolSuccess, type index_ToolWarning as ToolWarning, index_affinityToolMappings as affinityToolMappings, index_affinityTools as affinityTools, index_arraySchema as arraySchema, index_booleanSchema as booleanSchema, index_defineAffinityTool as defineAffinityTool, index_enumSchema as enumSchema, index_getAffinityToolByName as getAffinityToolByName, index_inspectAffinityItemTool as inspectAffinityItemTool, index_inspectAffinityItemToolHandler as inspectAffinityItemToolHandler, index_inspectAffinityItemToolName as inspectAffinityItemToolName, index_integerSchema as integerSchema, index_listAffinityToolDefinitions as listAffinityToolDefinitions, index_literalSchema as literalSchema, index_manageAttributeTool as manageAttributeTool, index_manageAttributeToolHandler as manageAttributeToolHandler, index_manageAttributeToolName as manageAttributeToolName, index_manageCommitmentTool as manageCommitmentTool, index_manageCommitmentToolHandler as manageCommitmentToolHandler, index_manageCommitmentToolName as manageCommitmentToolName, index_manageContactTool as manageContactTool, index_manageContactToolHandler as manageContactToolHandler, index_manageContactToolName as manageContactToolName, index_manageDateAnchorTool as manageDateAnchorTool, index_manageDateAnchorToolHandler as manageDateAnchorToolHandler, index_manageDateAnchorToolName as manageDateAnchorToolName, index_manageDuplicateDismissalTool as manageDuplicateDismissalTool, index_manageDuplicateDismissalToolHandler as manageDuplicateDismissalToolHandler, index_manageDuplicateDismissalToolName as manageDuplicateDismissalToolName, index_manageIdentityTool as manageIdentityTool, index_manageIdentityToolHandler as manageIdentityToolHandler, index_manageIdentityToolName as manageIdentityToolName, index_manageRelationshipTool as manageRelationshipTool, index_manageRelationshipToolHandler as manageRelationshipToolHandler, index_manageRelationshipToolName as manageRelationshipToolName, index_mapErrorToToolFailure as mapErrorToToolFailure, index_mergeContactsTool as mergeContactsTool, index_mergeContactsToolHandler as mergeContactsToolHandler, index_mergeContactsToolName as mergeContactsToolName, index_mutationToolResult as mutationToolResult, index_nullableStringSchema as nullableStringSchema, index_numberSchema as numberSchema, index_objectSchema as objectSchema, index_oneOfSchema as oneOfSchema, index_parseTimeInput as parseTimeInput, index_recordEventTool as recordEventTool, index_recordEventToolHandler as recordEventToolHandler, index_recordEventToolName as recordEventToolName, index_resolveContactLocator as resolveContactLocator, index_resolveLinkLocator as resolveLinkLocator, index_reviewAffinityTool as reviewAffinityTool, index_reviewAffinityToolHandler as reviewAffinityToolHandler, index_reviewAffinityToolName as reviewAffinityToolName, index_searchAffinityTool as searchAffinityTool, index_searchAffinityToolHandler as searchAffinityToolHandler, index_searchAffinityToolName as searchAffinityToolName, index_stringSchema as stringSchema, index_summarizeCount as summarizeCount, index_toAttributeEntityRef as toAttributeEntityRef, index_toAttributeListToolItem as toAttributeListToolItem, index_toContactEntityRef as toContactEntityRef, index_toContactListToolItem as toContactListToolItem, index_toEventEntityRef as toEventEntityRef, index_toEventListToolItem as toEventListToolItem, index_toIdentityEntityRef as toIdentityEntityRef, index_toIdentityListToolItem as toIdentityListToolItem, index_toLinkEntityRef as toLinkEntityRef, index_toLinkListToolItem as toLinkListToolItem, index_toMutationRefEntity as toMutationRefEntity, index_toReceiptEntityRefs as toReceiptEntityRefs, index_toolFailure as toolFailure, index_toolNeedsClarification as toolNeedsClarification, index_toolNoOp as toolNoOp, index_toolSuccess as toolSuccess, index_toolWarning as toolWarning, index_withToolHandling as withToolHandling };
2425
+ export { type index_AffinityToolDefinition as AffinityToolDefinition, type index_AffinityToolMapping as AffinityToolMapping, type index_ContactLocator as ContactLocator, type index_JsonSchema as JsonSchema, type index_JsonSchemaType as JsonSchemaType, type index_LinkLocator as LinkLocator, type index_ManageEventToolInput as ManageEventToolInput, type index_ManageEventToolResult as ManageEventToolResult, type index_MutationToolData as MutationToolData, type index_ResolvedTarget as ResolvedTarget, type index_ToolBaseResult as ToolBaseResult, type index_ToolDefinitionRegistry as ToolDefinitionRegistry, type index_ToolEntityKind as ToolEntityKind, type index_ToolEntityRef as ToolEntityRef, type index_ToolFailure as ToolFailure, type index_ToolInputDescriptions as ToolInputDescriptions, type index_ToolListItem as ToolListItem, type index_ToolNeedsClarification as ToolNeedsClarification, type index_ToolNextStepHint as ToolNextStepHint, type index_ToolOutcomeKind as ToolOutcomeKind, type index_ToolOutputDescription as ToolOutputDescription, type index_ToolResult as ToolResult, type index_ToolSideEffects as ToolSideEffects, type index_ToolSuccess as ToolSuccess, type index_ToolWarning as ToolWarning, index_affinityToolMappings as affinityToolMappings, index_affinityTools as affinityTools, index_arraySchema as arraySchema, index_booleanSchema as booleanSchema, index_defineAffinityTool as defineAffinityTool, index_enumSchema as enumSchema, index_getAffinityToolByName as getAffinityToolByName, index_inspectAffinityItemTool as inspectAffinityItemTool, index_inspectAffinityItemToolHandler as inspectAffinityItemToolHandler, index_inspectAffinityItemToolName as inspectAffinityItemToolName, index_integerSchema as integerSchema, index_listAffinityToolDefinitions as listAffinityToolDefinitions, index_literalSchema as literalSchema, index_manageAttributeTool as manageAttributeTool, index_manageAttributeToolHandler as manageAttributeToolHandler, index_manageAttributeToolName as manageAttributeToolName, index_manageCommitmentTool as manageCommitmentTool, index_manageCommitmentToolHandler as manageCommitmentToolHandler, index_manageCommitmentToolName as manageCommitmentToolName, index_manageContactTool as manageContactTool, index_manageContactToolHandler as manageContactToolHandler, index_manageContactToolName as manageContactToolName, index_manageDateAnchorTool as manageDateAnchorTool, index_manageDateAnchorToolHandler as manageDateAnchorToolHandler, index_manageDateAnchorToolName as manageDateAnchorToolName, index_manageDuplicateDismissalTool as manageDuplicateDismissalTool, index_manageDuplicateDismissalToolHandler as manageDuplicateDismissalToolHandler, index_manageDuplicateDismissalToolName as manageDuplicateDismissalToolName, index_manageEventTool as manageEventTool, index_manageEventToolHandler as manageEventToolHandler, index_manageEventToolName as manageEventToolName, index_manageIdentityTool as manageIdentityTool, index_manageIdentityToolHandler as manageIdentityToolHandler, index_manageIdentityToolName as manageIdentityToolName, index_manageRelationshipTool as manageRelationshipTool, index_manageRelationshipToolHandler as manageRelationshipToolHandler, index_manageRelationshipToolName as manageRelationshipToolName, index_mapErrorToToolFailure as mapErrorToToolFailure, index_mergeContactsTool as mergeContactsTool, index_mergeContactsToolHandler as mergeContactsToolHandler, index_mergeContactsToolName as mergeContactsToolName, index_mutationToolResult as mutationToolResult, index_nullableStringSchema as nullableStringSchema, index_numberSchema as numberSchema, index_objectSchema as objectSchema, index_oneOfSchema as oneOfSchema, index_parseTimeInput as parseTimeInput, index_recordEventTool as recordEventTool, index_recordEventToolHandler as recordEventToolHandler, index_recordEventToolName as recordEventToolName, index_resolveContactLocator as resolveContactLocator, index_resolveLinkLocator as resolveLinkLocator, index_reviewAffinityTool as reviewAffinityTool, index_reviewAffinityToolHandler as reviewAffinityToolHandler, index_reviewAffinityToolName as reviewAffinityToolName, index_searchAffinityTool as searchAffinityTool, index_searchAffinityToolHandler as searchAffinityToolHandler, index_searchAffinityToolName as searchAffinityToolName, index_stringSchema as stringSchema, index_summarizeCount as summarizeCount, index_toAttributeEntityRef as toAttributeEntityRef, index_toAttributeListToolItem as toAttributeListToolItem, index_toContactEntityRef as toContactEntityRef, index_toContactListToolItem as toContactListToolItem, index_toEventEntityRef as toEventEntityRef, index_toEventListToolItem as toEventListToolItem, index_toIdentityEntityRef as toIdentityEntityRef, index_toIdentityListToolItem as toIdentityListToolItem, index_toLinkEntityRef as toLinkEntityRef, index_toLinkListToolItem as toLinkListToolItem, index_toMutationRefEntity as toMutationRefEntity, index_toReceiptEntityRefs as toReceiptEntityRefs, index_toolFailure as toolFailure, index_toolNeedsClarification as toolNeedsClarification, index_toolNoOp as toolNoOp, index_toolSuccess as toolSuccess, index_toolWarning as toolWarning, index_withToolHandling as withToolHandling };
2150
2426
  }
2151
2427
 
2152
2428
  declare function addIdentity(db: AffinityDb, contactId: number, input: AddIdentityInput): IdentityMutationReceipt;
@@ -2167,6 +2443,7 @@ declare const write_addDateAnchor: typeof addDateAnchor;
2167
2443
  declare const write_addIdentity: typeof addIdentity;
2168
2444
  declare const write_createContact: typeof createContact;
2169
2445
  declare const write_deleteContact: typeof deleteContact;
2446
+ declare const write_deleteEvent: typeof deleteEvent;
2170
2447
  declare const write_dismissDuplicate: typeof dismissDuplicate;
2171
2448
  declare const write_mergeContacts: typeof mergeContacts;
2172
2449
  declare const write_overrideLinkState: typeof overrideLinkState;
@@ -2183,6 +2460,7 @@ declare const write_resolveCommitment: typeof resolveCommitment;
2183
2460
  declare const write_reviseBond: typeof reviseBond;
2184
2461
  declare const write_reviseContact: typeof reviseContact;
2185
2462
  declare const write_reviseDateAnchor: typeof reviseDateAnchor;
2463
+ declare const write_reviseEvent: typeof reviseEvent;
2186
2464
  declare const write_reviseIdentity: typeof reviseIdentity;
2187
2465
  declare const write_seedSocialLink: typeof seedSocialLink;
2188
2466
  declare const write_setAttribute: typeof setAttribute;
@@ -2192,7 +2470,7 @@ declare const write_undismissDuplicate: typeof undismissDuplicate;
2192
2470
  declare const write_unsetAttribute: typeof unsetAttribute;
2193
2471
  declare const write_verifyIdentity: typeof verifyIdentity;
2194
2472
  declare namespace write {
2195
- export { write_addDateAnchor as addDateAnchor, write_addIdentity as addIdentity, write_createContact as createContact, write_deleteContact as deleteContact, write_dismissDuplicate as dismissDuplicate, write_mergeContacts as mergeContacts, write_overrideLinkState as overrideLinkState, write_recordCommitment as recordCommitment, write_recordInteraction as recordInteraction, write_recordMilestone as recordMilestone, write_recordObservation as recordObservation, write_recordTransaction as recordTransaction, write_removeDateAnchor as removeDateAnchor, write_removeIdentity as removeIdentity, write_removeStructuralTie as removeStructuralTie, write_replaceAttributes as replaceAttributes, write_resolveCommitment as resolveCommitment, write_reviseBond as reviseBond, write_reviseContact as reviseContact, write_reviseDateAnchor as reviseDateAnchor, write_reviseIdentity as reviseIdentity, write_seedSocialLink as seedSocialLink, write_setAttribute as setAttribute, write_setContactLifecycle as setContactLifecycle, write_setStructuralTie as setStructuralTie, write_undismissDuplicate as undismissDuplicate, write_unsetAttribute as unsetAttribute, write_verifyIdentity as verifyIdentity };
2473
+ export { write_addDateAnchor as addDateAnchor, write_addIdentity as addIdentity, write_createContact as createContact, write_deleteContact as deleteContact, write_deleteEvent as deleteEvent, write_dismissDuplicate as dismissDuplicate, write_mergeContacts as mergeContacts, write_overrideLinkState as overrideLinkState, write_recordCommitment as recordCommitment, write_recordInteraction as recordInteraction, write_recordMilestone as recordMilestone, write_recordObservation as recordObservation, write_recordTransaction as recordTransaction, write_removeDateAnchor as removeDateAnchor, write_removeIdentity as removeIdentity, write_removeStructuralTie as removeStructuralTie, write_replaceAttributes as replaceAttributes, write_resolveCommitment as resolveCommitment, write_reviseBond as reviseBond, write_reviseContact as reviseContact, write_reviseDateAnchor as reviseDateAnchor, write_reviseEvent as reviseEvent, write_reviseIdentity as reviseIdentity, write_seedSocialLink as seedSocialLink, write_setAttribute as setAttribute, write_setContactLifecycle as setContactLifecycle, write_setStructuralTie as setStructuralTie, write_undismissDuplicate as undismissDuplicate, write_unsetAttribute as unsetAttribute, write_verifyIdentity as verifyIdentity };
2196
2474
  }
2197
2475
 
2198
2476
  export { AffinityConflictError, AffinityError, type AffinityErrorCode, AffinityInvariantError, AffinityMergeError, AffinityNotFoundError, type AffinitySkill, type AffinitySkillRegistry, type AffinitySoul, type AffinitySoulTrait, AffinityStateError, AffinityValidationError, affinitySkills, affinitySoul, affinitySoulEssence, affinitySoulTraits, bootstrapAndColdStartSkill, captureTransactionsAndCommercialEventsSkill, defineAffinitySkill, errors, getAffinitySkillByName, identifyAndLocateContactsSkill, importHistoryWithoutFakingEvidenceSkill, initAffinityTables, isAffinityError, listAffinitySkills, managePromisesAndAgreementsSkill, manageRecurringDatesAndRemindersSkill, modelStructureOrgsAndHouseholdsSkill, read, reconcileDuplicatesAndMergeSafelySkill, recordDirectEvidenceWellSkill, recordObservationsAndReferralsSkill, renderAffinitySoulPromptFoundation, reviewRadarProgressionAndGraphSkill, index$1 as skills, soul, index as tools, types, write };