synomem 0.9.6 → 0.10.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 (118) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +5 -3
  3. package/dist/actor-directory.d.ts +34 -0
  4. package/dist/actor-directory.d.ts.map +1 -0
  5. package/dist/actor-directory.js +52 -0
  6. package/dist/actor-directory.js.map +1 -0
  7. package/dist/backend.d.ts +3 -0
  8. package/dist/backend.d.ts.map +1 -1
  9. package/dist/backend.js +26 -3
  10. package/dist/backend.js.map +1 -1
  11. package/dist/bookmarks.d.ts +30 -0
  12. package/dist/bookmarks.d.ts.map +1 -0
  13. package/dist/bookmarks.js +87 -0
  14. package/dist/bookmarks.js.map +1 -0
  15. package/dist/cli.d.ts.map +1 -1
  16. package/dist/cli.js +291 -61
  17. package/dist/cli.js.map +1 -1
  18. package/dist/client.d.ts +115 -4
  19. package/dist/client.d.ts.map +1 -1
  20. package/dist/client.js +854 -138
  21. package/dist/client.js.map +1 -1
  22. package/dist/cursors.d.ts +30 -0
  23. package/dist/cursors.d.ts.map +1 -0
  24. package/dist/cursors.js +101 -0
  25. package/dist/cursors.js.map +1 -0
  26. package/dist/errors.d.ts +1 -1
  27. package/dist/errors.d.ts.map +1 -1
  28. package/dist/errors.js +2 -0
  29. package/dist/errors.js.map +1 -1
  30. package/dist/import.d.ts +605 -39
  31. package/dist/import.d.ts.map +1 -1
  32. package/dist/index.d.ts +19 -1
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +11 -1
  35. package/dist/index.js.map +1 -1
  36. package/dist/mcp/index.d.ts +1 -1
  37. package/dist/mcp/index.d.ts.map +1 -1
  38. package/dist/mcp/index.js +329 -22
  39. package/dist/mcp/index.js.map +1 -1
  40. package/dist/mutation-receipts.d.ts +8 -0
  41. package/dist/mutation-receipts.d.ts.map +1 -0
  42. package/dist/mutation-receipts.js +2 -0
  43. package/dist/mutation-receipts.js.map +1 -0
  44. package/dist/notifications.d.ts +73 -0
  45. package/dist/notifications.d.ts.map +1 -0
  46. package/dist/notifications.js +309 -0
  47. package/dist/notifications.js.map +1 -0
  48. package/dist/participation-repository.d.ts +46 -0
  49. package/dist/participation-repository.d.ts.map +1 -0
  50. package/dist/participation-repository.js +296 -0
  51. package/dist/participation-repository.js.map +1 -0
  52. package/dist/participation.d.ts +97 -0
  53. package/dist/participation.d.ts.map +1 -0
  54. package/dist/participation.js +10 -0
  55. package/dist/participation.js.map +1 -0
  56. package/dist/policy.d.ts +31 -0
  57. package/dist/policy.d.ts.map +1 -0
  58. package/dist/policy.js +71 -0
  59. package/dist/policy.js.map +1 -0
  60. package/dist/ports/repository.d.ts +23 -0
  61. package/dist/ports/repository.d.ts.map +1 -1
  62. package/dist/profiles.d.ts +12 -0
  63. package/dist/profiles.d.ts.map +1 -1
  64. package/dist/profiles.js +2 -1
  65. package/dist/profiles.js.map +1 -1
  66. package/dist/projections.d.ts.map +1 -1
  67. package/dist/projections.js +29 -11
  68. package/dist/projections.js.map +1 -1
  69. package/dist/remote.d.ts +79 -0
  70. package/dist/remote.d.ts.map +1 -1
  71. package/dist/remote.js +65 -6
  72. package/dist/remote.js.map +1 -1
  73. package/dist/schemas.d.ts +746 -58
  74. package/dist/schemas.d.ts.map +1 -1
  75. package/dist/schemas.js +114 -16
  76. package/dist/schemas.js.map +1 -1
  77. package/dist/search.d.ts +25 -0
  78. package/dist/search.d.ts.map +1 -0
  79. package/dist/search.js +2 -0
  80. package/dist/search.js.map +1 -0
  81. package/dist/service.d.ts +89 -0
  82. package/dist/service.d.ts.map +1 -1
  83. package/dist/storage.d.ts +38 -3
  84. package/dist/storage.d.ts.map +1 -1
  85. package/dist/storage.js +494 -365
  86. package/dist/storage.js.map +1 -1
  87. package/dist/types.d.ts +65 -34
  88. package/dist/types.d.ts.map +1 -1
  89. package/docs/cli.md +6 -0
  90. package/docs/human-participation.md +20 -0
  91. package/docs/mcp.md +2 -0
  92. package/docs/storage-format.md +4 -15
  93. package/openapi/synomem-v1.yaml +187 -10
  94. package/package.json +2 -1
  95. package/skills/synomem/SKILL.md +2 -0
  96. package/src/actor-directory.ts +87 -0
  97. package/src/backend.ts +29 -3
  98. package/src/bookmarks.ts +127 -0
  99. package/src/cli.ts +941 -546
  100. package/src/client.ts +1143 -279
  101. package/src/cursors.ts +132 -0
  102. package/src/errors.ts +2 -0
  103. package/src/index.ts +50 -0
  104. package/src/mcp/index.ts +412 -96
  105. package/src/mutation-receipts.ts +7 -0
  106. package/src/notifications.ts +483 -0
  107. package/src/participation-repository.ts +406 -0
  108. package/src/participation.ts +103 -0
  109. package/src/policy.ts +109 -0
  110. package/src/ports/repository.ts +33 -0
  111. package/src/profiles.ts +2 -1
  112. package/src/projections.ts +49 -48
  113. package/src/remote.ts +227 -37
  114. package/src/schemas.ts +116 -16
  115. package/src/search.ts +24 -0
  116. package/src/service.ts +122 -8
  117. package/src/storage.ts +1039 -697
  118. package/src/types.ts +67 -32
package/src/types.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { ParticipationEvent } from './participation.js';
2
+ import type { ActorRef, RecordAuthority } from './policy.js';
1
3
  export type JsonPrimitive = string | number | boolean | null;
2
4
  export type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };
3
5
 
@@ -96,7 +98,7 @@ export interface AgentResolution {
96
98
  }
97
99
 
98
100
  export interface BaseEvent {
99
- schemaVersion: 1;
101
+ schemaVersion: 2;
100
102
  id: string;
101
103
  type: string;
102
104
  workspaceId: string;
@@ -107,11 +109,15 @@ export interface BaseEvent {
107
109
  idempotencyKey?: string;
108
110
  source?: EventSource;
109
111
  metadata?: Record<string, JsonValue>;
112
+ intervention?: {
113
+ basis: 'operator' | 'workspace_admin' | 'organization_admin' | 'local_owner';
114
+ reason?: string;
115
+ };
110
116
  }
111
117
 
112
118
  export interface KudosGivenEvent extends BaseEvent {
113
119
  type: 'kudos.given';
114
- recipientAgentId: string;
120
+ recipient: ActorRef;
115
121
  recipientDisplayName: string;
116
122
  title: string;
117
123
  reason: string;
@@ -123,7 +129,7 @@ export interface KudosGivenEvent extends BaseEvent {
123
129
  export interface KudosAcknowledgedEvent extends BaseEvent {
124
130
  type: 'kudos.acknowledged';
125
131
  kudosId: string;
126
- recipientAgentId: string;
132
+ recipient: ActorRef;
127
133
  note?: string;
128
134
  }
129
135
  export interface KudosRevokedEvent extends BaseEvent {
@@ -135,7 +141,7 @@ export interface KudosRevokedEvent extends BaseEvent {
135
141
 
136
142
  export interface MemoSentEvent extends BaseEvent {
137
143
  type: 'memo.sent';
138
- recipientAgentId: string;
144
+ recipient: ActorRef;
139
145
  recipientDisplayName: string;
140
146
  subject: string;
141
147
  body: string;
@@ -146,12 +152,12 @@ export interface MemoSentEvent extends BaseEvent {
146
152
  export interface MemoReadEvent extends BaseEvent {
147
153
  type: 'memo.read';
148
154
  memoId: string;
149
- recipientAgentId: string;
155
+ recipient: ActorRef;
150
156
  }
151
157
  export interface MemoArchivedEvent extends BaseEvent {
152
158
  type: 'memo.archived';
153
159
  memoId: string;
154
- recipientAgentId: string;
160
+ recipient: ActorRef;
155
161
  }
156
162
 
157
163
  /**
@@ -165,15 +171,15 @@ export interface MemoArchivedEvent extends BaseEvent {
165
171
  * read".
166
172
  */
167
173
  export interface PostCreatedEvent extends BaseEvent {
174
+ mentions?: ActorRef[];
168
175
  type: 'post.created';
169
176
  title: string;
170
177
  body: string;
171
178
  tags?: string[];
172
179
  topicIds?: string[];
173
- /** The post this replies to. A reply inherits its parent's workspace. */
174
- replyTo?: string;
175
180
  }
176
181
  export interface PostEditedEvent extends BaseEvent {
182
+ mentions?: ActorRef[];
177
183
  type: 'post.edited';
178
184
  postId: string;
179
185
  title: string;
@@ -206,7 +212,7 @@ export interface PostAcknowledgmentWithdrawnEvent extends BaseEvent {
206
212
 
207
213
  export interface NoteCreatedEvent extends BaseEvent {
208
214
  type: 'note.created';
209
- ownerAgentId: string;
215
+ owner: ActorRef;
210
216
  ownerDisplayName: string;
211
217
  title: string;
212
218
  body: string;
@@ -233,7 +239,7 @@ export type TaskDue =
233
239
  { kind: 'date'; date: string } | { kind: 'datetime'; datetime: string; timeZone: string };
234
240
  export interface TaskCreatedEvent extends BaseEvent {
235
241
  type: 'task.created';
236
- assigneeAgentId: string;
242
+ assignee: ActorRef;
237
243
  assigneeDisplayName: string;
238
244
  title: string;
239
245
  description?: string;
@@ -284,6 +290,19 @@ export interface TaskRejectedEvent extends BaseEvent {
284
290
  */
285
291
  response: string;
286
292
  }
293
+ export interface TaskDecisionOverriddenEvent extends BaseEvent {
294
+ type: 'task.decision_overridden';
295
+ taskId: string;
296
+ previousStatus: 'open' | 'rejected';
297
+ nextStatus: 'open' | 'rejected';
298
+ reason: string;
299
+ }
300
+ export interface OverrideTaskDecisionInput extends MutationInput {
301
+ taskId: string;
302
+ expectedVersion: number;
303
+ nextStatus: 'open' | 'rejected';
304
+ reason: string;
305
+ }
287
306
  export interface TaskCanceledEvent extends BaseEvent {
288
307
  type: 'task.canceled';
289
308
  taskId: string;
@@ -304,6 +323,7 @@ export interface TaskCanceledEvent extends BaseEvent {
304
323
  */
305
324
  export interface TodoCreatedEvent extends BaseEvent {
306
325
  type: 'todo.created';
326
+ owner: ActorRef;
307
327
  title: string;
308
328
  /** Private working detail. Never surfaced to another actor. */
309
329
  details?: string;
@@ -342,6 +362,8 @@ export interface TodoArchivedEvent extends BaseEvent {
342
362
  }
343
363
 
344
364
  export interface TodoRecord {
365
+ lifecycleVersion?: number;
366
+ allowedActions?: Record<string, boolean>;
345
367
  event: TodoCreatedEvent;
346
368
  update?: TodoUpdatedEvent;
347
369
  terminal?: TodoCompletedEvent | TodoCanceledEvent | TodoArchivedEvent;
@@ -359,6 +381,7 @@ export interface TodoRecord {
359
381
  }
360
382
 
361
383
  export interface CreateTodoInput extends MutationInput {
384
+ owner?: ActorRef;
362
385
  title: string;
363
386
  details?: string;
364
387
  priority?: TaskPriority;
@@ -422,6 +445,7 @@ export interface TopicResolution {
422
445
  }
423
446
 
424
447
  export type SynomemEvent =
448
+ | ParticipationEvent
425
449
  | KudosGivenEvent
426
450
  | KudosAcknowledgedEvent
427
451
  | KudosRevokedEvent
@@ -443,6 +467,7 @@ export type SynomemEvent =
443
467
  | TaskAcceptedEvent
444
468
  | TaskRejectedEvent
445
469
  | TaskCanceledEvent
470
+ | TaskDecisionOverriddenEvent
446
471
  | TodoCreatedEvent
447
472
  | TodoUpdatedEvent
448
473
  | TodoCompletedEvent
@@ -457,6 +482,8 @@ export type SynomemEvent =
457
482
  export type AcknowledgmentStatus = 'acknowledged' | 'unacknowledged';
458
483
  export type RevocationStatus = 'revoked' | 'active';
459
484
  export interface KudosRecord {
485
+ lifecycleVersion?: number;
486
+ allowedActions?: Record<string, boolean>;
460
487
  event: KudosGivenEvent;
461
488
  acknowledgment?: KudosAcknowledgedEvent;
462
489
  revocation?: KudosRevokedEvent;
@@ -464,6 +491,8 @@ export interface KudosRecord {
464
491
  revocationStatus: RevocationStatus;
465
492
  }
466
493
  export interface MemoRecord {
494
+ lifecycleVersion?: number;
495
+ allowedActions?: Record<string, boolean>;
467
496
  event: MemoSentEvent;
468
497
  read?: MemoReadEvent;
469
498
  archived?: MemoArchivedEvent;
@@ -475,6 +504,9 @@ export interface PostAcknowledgment {
475
504
  note?: string;
476
505
  }
477
506
  export interface PostRecord {
507
+ mentions?: ActorRef[];
508
+ lifecycleVersion?: number;
509
+ allowedActions?: Record<string, boolean>;
478
510
  event: PostCreatedEvent;
479
511
  edits: PostEditedEvent[];
480
512
  archived?: PostArchivedEvent;
@@ -505,6 +537,8 @@ export interface PostRoster {
505
537
  }
506
538
 
507
539
  export interface NoteRecord {
540
+ lifecycleVersion?: number;
541
+ allowedActions?: Record<string, boolean>;
508
542
  event: NoteCreatedEvent;
509
543
  revision?: NoteRevisedEvent;
510
544
  archived?: NoteArchivedEvent;
@@ -535,12 +569,15 @@ export interface TaskResponse {
535
569
  }
536
570
 
537
571
  export interface TaskRecord {
572
+ lifecycleVersion?: number;
573
+ allowedActions?: Record<string, boolean>;
538
574
  event: TaskCreatedEvent;
539
575
  update?: TaskUpdatedEvent;
540
576
  terminal?: TaskCompletedEvent | TaskRejectedEvent | TaskCanceledEvent;
541
577
  reopened?: TaskReopenedEvent;
542
578
  /** Every accept/reject answer, oldest first. */
543
579
  responses: TaskResponse[];
580
+ overrides?: TaskDecisionOverriddenEvent[];
544
581
  current: {
545
582
  title: string;
546
583
  description?: string;
@@ -567,16 +604,16 @@ export interface ItemSummary {
567
604
  topicIds: string[];
568
605
  visibility: Visibility;
569
606
  status: string;
570
- recipientAgentId?: string;
571
- ownerAgentId?: string;
572
- assigneeAgentId?: string;
607
+ recipient?: ActorRef;
608
+ owner?: ActorRef;
609
+ assignee?: ActorRef;
573
610
  recipientDisplayName?: string;
574
611
  ownerDisplayName?: string;
575
612
  assigneeDisplayName?: string;
576
613
  }
577
614
  export interface KudosSummary extends ItemSummary {
578
615
  kind: 'kudos';
579
- recipientAgentId: string;
616
+ recipient: ActorRef;
580
617
  recipientDisplayName: string;
581
618
  status: AcknowledgmentStatus;
582
619
  revocationStatus: RevocationStatus;
@@ -589,7 +626,7 @@ export interface PaginationInput {
589
626
  }
590
627
  export interface ItemListInput extends PaginationInput {
591
628
  kinds?: RecordKind[];
592
- participantAgentId?: string;
629
+ participant?: ActorRef;
593
630
  actorId?: string;
594
631
  actorKind?: ActorKind;
595
632
  tag?: string;
@@ -619,7 +656,7 @@ export interface ItemListInput extends PaginationInput {
619
656
  overdueAsOf?: string;
620
657
  }
621
658
  export interface KudosListInput extends PaginationInput {
622
- recipientAgentId?: string;
659
+ recipient?: ActorRef;
623
660
  actorId?: string;
624
661
  actorKind?: ActorKind;
625
662
  tag?: string;
@@ -642,7 +679,7 @@ export interface Page<T> {
642
679
  }
643
680
  export interface ItemChange {
644
681
  cursor: string;
645
- sequence: number;
682
+ sequence: string;
646
683
  eventId: string;
647
684
  type: SynomemEvent['type'];
648
685
  createdAt: string;
@@ -651,17 +688,17 @@ export interface ItemChange {
651
688
  kind?: RecordKind;
652
689
  summary?: ItemSummary;
653
690
  /** Present for kudos changes. */ kudosId?: string;
654
- /** Present for direct-recipient changes. */ recipientAgentId?: string;
691
+ /** Present for direct-recipient changes. */ recipient?: ActorRef;
655
692
  }
656
693
  export interface KudosChange extends ItemChange {
657
694
  kudosId?: string;
658
- recipientAgentId?: string;
695
+ recipient?: ActorRef;
659
696
  summary?: KudosSummary;
660
697
  }
661
698
  export interface ChangesInput {
699
+ kinds?: RecordKind[];
662
700
  after?: string;
663
701
  limit?: number;
664
- kinds?: RecordKind[];
665
702
  }
666
703
  export type KudosChangesInput = ChangesInput;
667
704
  export interface ChangePage {
@@ -679,7 +716,7 @@ interface MutationInput {
679
716
  metadata?: Record<string, JsonValue>;
680
717
  }
681
718
  export interface GiveKudosInput extends MutationInput {
682
- recipientAgentId: string;
719
+ recipient: ActorRef;
683
720
  title: string;
684
721
  reason: string;
685
722
  evidence?: EvidenceReference[];
@@ -688,7 +725,7 @@ export interface GiveKudosInput extends MutationInput {
688
725
  visibility?: Visibility;
689
726
  }
690
727
  export interface SendMemoInput extends MutationInput {
691
- recipientAgentId: string;
728
+ recipient: ActorRef;
692
729
  subject: string;
693
730
  body: string;
694
731
  tags?: string[];
@@ -696,15 +733,15 @@ export interface SendMemoInput extends MutationInput {
696
733
  visibility?: Visibility;
697
734
  }
698
735
  export interface CreatePostInput extends MutationInput {
736
+ mentions?: ActorRef[];
699
737
  title: string;
700
738
  body: string;
701
739
  tags?: string[];
702
740
  topicIds?: string[];
703
- /** The post being replied to; a reply inherits its parent's workspace. */
704
- replyTo?: string;
705
741
  }
706
742
 
707
743
  export interface UpdatePostInput {
744
+ mentions?: ActorRef[];
708
745
  postId: string;
709
746
  expectedVersion: number;
710
747
  title?: string;
@@ -715,7 +752,7 @@ export interface UpdatePostInput {
715
752
  }
716
753
 
717
754
  export interface CreateNoteInput extends MutationInput {
718
- ownerAgentId?: string;
755
+ owner?: ActorRef;
719
756
  title: string;
720
757
  body: string;
721
758
  tags?: string[];
@@ -730,7 +767,7 @@ export interface ReviseNoteInput extends MutationInput {
730
767
  topicIds?: string[];
731
768
  }
732
769
  export interface CreateTaskInput extends MutationInput {
733
- assigneeAgentId?: string;
770
+ assignee?: ActorRef;
734
771
  title: string;
735
772
  description?: string;
736
773
  priority?: TaskPriority;
@@ -917,12 +954,8 @@ export type SynomemConfigOverrides = Omit<Partial<SynomemConfig>, 'projection' |
917
954
  export interface SynomemClientOptions {
918
955
  home?: string;
919
956
  actor?: ActorIdentity;
920
- /**
921
- * Overrides the default administrative inference (any human actor, since a
922
- * local home has exactly one operator). A hosted deployment passes the
923
- * actor's real org role here instead — see `SynomemCoreOptions`.
924
- */
925
- administrative?: boolean;
957
+ /** Explicit verified adapter authority. Missing authority never grants administration. */
958
+ authority?: RecordAuthority;
926
959
  /**
927
960
  * False when `actor` is only a historical fallback guess, not an identity
928
961
  * the caller actually asserted. A local `SynomemClient` ignores this (a
@@ -937,3 +970,5 @@ export interface SynomemClientOptions {
937
970
  config?: SynomemConfigOverrides;
938
971
  signal?: AbortSignal;
939
972
  }
973
+
974
+ export type { ActorRef, AddressableActor, RecordAuthority } from './policy.js';