synomem 0.2.0 → 0.4.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 (89) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +4 -4
  3. package/dist/backend.d.ts.map +1 -1
  4. package/dist/backend.js +8 -2
  5. package/dist/backend.js.map +1 -1
  6. package/dist/cli.d.ts +3 -0
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +379 -16
  9. package/dist/cli.js.map +1 -1
  10. package/dist/client.d.ts +68 -2
  11. package/dist/client.d.ts.map +1 -1
  12. package/dist/client.js +283 -12
  13. package/dist/client.js.map +1 -1
  14. package/dist/cloud.d.ts +16 -0
  15. package/dist/cloud.d.ts.map +1 -0
  16. package/dist/cloud.js +19 -0
  17. package/dist/cloud.js.map +1 -0
  18. package/dist/config.d.ts.map +1 -1
  19. package/dist/config.js +8 -1
  20. package/dist/config.js.map +1 -1
  21. package/dist/configure.d.ts +55 -0
  22. package/dist/configure.d.ts.map +1 -0
  23. package/dist/configure.js +177 -0
  24. package/dist/configure.js.map +1 -0
  25. package/dist/credentials.d.ts +15 -2
  26. package/dist/credentials.d.ts.map +1 -1
  27. package/dist/credentials.js.map +1 -1
  28. package/dist/import.d.ts +202 -38
  29. package/dist/import.d.ts.map +1 -1
  30. package/dist/index.d.ts +2 -1
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +1 -0
  33. package/dist/index.js.map +1 -1
  34. package/dist/mcp/index.d.ts.map +1 -1
  35. package/dist/mcp/index.js +72 -6
  36. package/dist/mcp/index.js.map +1 -1
  37. package/dist/oauth.d.ts.map +1 -1
  38. package/dist/oauth.js +8 -1
  39. package/dist/oauth.js.map +1 -1
  40. package/dist/ports/repository.d.ts +4 -1
  41. package/dist/ports/repository.d.ts.map +1 -1
  42. package/dist/projections.d.ts +9 -1
  43. package/dist/projections.d.ts.map +1 -1
  44. package/dist/projections.js +75 -4
  45. package/dist/projections.js.map +1 -1
  46. package/dist/prompt.d.ts +28 -0
  47. package/dist/prompt.d.ts.map +1 -0
  48. package/dist/prompt.js +72 -0
  49. package/dist/prompt.js.map +1 -0
  50. package/dist/remote.d.ts +30 -1
  51. package/dist/remote.d.ts.map +1 -1
  52. package/dist/remote.js +14 -0
  53. package/dist/remote.js.map +1 -1
  54. package/dist/schemas.d.ts +270 -55
  55. package/dist/schemas.d.ts.map +1 -1
  56. package/dist/schemas.js +120 -6
  57. package/dist/schemas.js.map +1 -1
  58. package/dist/service.d.ts +30 -1
  59. package/dist/service.d.ts.map +1 -1
  60. package/dist/storage.d.ts +25 -2
  61. package/dist/storage.d.ts.map +1 -1
  62. package/dist/storage.js +168 -15
  63. package/dist/storage.js.map +1 -1
  64. package/dist/types.d.ts +123 -4
  65. package/dist/types.d.ts.map +1 -1
  66. package/docs/cli.md +1 -1
  67. package/docs/examples.md +1 -1
  68. package/docs/mcp.md +1 -1
  69. package/docs/skill.md +1 -1
  70. package/docs/storage-format.md +1 -1
  71. package/package.json +8 -8
  72. package/src/backend.ts +8 -2
  73. package/src/cli.ts +543 -19
  74. package/src/client.ts +331 -11
  75. package/src/cloud.ts +19 -0
  76. package/src/config.ts +8 -1
  77. package/src/configure.ts +233 -0
  78. package/src/credentials.ts +17 -2
  79. package/src/index.ts +7 -1
  80. package/src/mcp/index.ts +95 -5
  81. package/src/oauth.ts +8 -1
  82. package/src/ports/repository.ts +5 -0
  83. package/src/projections.ts +74 -4
  84. package/src/prompt.ts +88 -0
  85. package/src/remote.ts +72 -0
  86. package/src/schemas.ts +125 -6
  87. package/src/service.ts +30 -0
  88. package/src/storage.ts +217 -14
  89. package/src/types.ts +129 -3
package/src/types.ts CHANGED
@@ -3,7 +3,7 @@ export type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue
3
3
 
4
4
  export type ActorKind = 'human' | 'agent' | 'system';
5
5
  export type Visibility = 'private' | 'workspace' | 'public';
6
- export type RecordKind = 'kudos' | 'memo' | 'note' | 'task' | 'todo';
6
+ export type RecordKind = 'kudos' | 'memo' | 'note' | 'post' | 'task' | 'todo';
7
7
 
8
8
  export interface ActorIdentity {
9
9
  kind: ActorKind;
@@ -28,10 +28,22 @@ export interface EvidenceReference {
28
28
  }
29
29
 
30
30
  export interface AgentProfile {
31
+ /**
32
+ * Canonical, opaque, immutable. Every event references this, so it can never
33
+ * change — which is exactly why the handle exists separately.
34
+ */
31
35
  id: string;
36
+ /** The human-friendly name, unique in the workspace and safe to rename. */
37
+ handle: string;
32
38
  displayName: string;
33
39
  aliases?: string[];
34
40
  description?: string;
41
+ /**
42
+ * Archived agents keep their history and stop being able to act. Events
43
+ * reference the actor permanently, so deletion would leave history pointing
44
+ * at nothing.
45
+ */
46
+ status: 'active' | 'archived';
35
47
  createdAt: string;
36
48
  metadata?: Record<string, JsonValue>;
37
49
  }
@@ -140,6 +152,54 @@ export interface MemoArchivedEvent extends BaseEvent {
140
152
  recipientAgentId: string;
141
153
  }
142
154
 
155
+ /**
156
+ * A Post is publication: an author says something to the whole workspace rather
157
+ * than to a named recipient.
158
+ *
159
+ * It has no recipient and no assignee, which is what separates it from a memo
160
+ * and a task. Everyone who can read the workspace can read it, and each of them
161
+ * can acknowledge it independently — a memo is read by one person, a post by
162
+ * many, so "who has responded" is the interesting question rather than "was it
163
+ * read".
164
+ */
165
+ export interface PostCreatedEvent extends BaseEvent {
166
+ type: 'post.created';
167
+ title: string;
168
+ body: string;
169
+ tags?: string[];
170
+ /** The post this replies to. A reply inherits its parent's workspace. */
171
+ replyTo?: string;
172
+ }
173
+ export interface PostEditedEvent extends BaseEvent {
174
+ type: 'post.edited';
175
+ postId: string;
176
+ title: string;
177
+ body: string;
178
+ tags?: string[];
179
+ }
180
+ export interface PostArchivedEvent extends BaseEvent {
181
+ type: 'post.archived';
182
+ postId: string;
183
+ reason?: string;
184
+ }
185
+ /**
186
+ * One actor saying "I have seen this", and only ever about themselves.
187
+ *
188
+ * Appended by an explicit call. Reading a post never acknowledges it: a roster
189
+ * built from read receipts would answer "whose client fetched this", which for
190
+ * an agent means "whose runtime happened to poll".
191
+ */
192
+ export interface PostAcknowledgedEvent extends BaseEvent {
193
+ type: 'post.acknowledged';
194
+ postId: string;
195
+ note?: string;
196
+ }
197
+ export interface PostAcknowledgmentWithdrawnEvent extends BaseEvent {
198
+ type: 'post.acknowledgment.withdrawn';
199
+ postId: string;
200
+ reason?: string;
201
+ }
202
+
143
203
  export interface NoteCreatedEvent extends BaseEvent {
144
204
  type: 'note.created';
145
205
  ownerAgentId: string;
@@ -322,6 +382,11 @@ export type SynomemEvent =
322
382
  | MemoSentEvent
323
383
  | MemoReadEvent
324
384
  | MemoArchivedEvent
385
+ | PostCreatedEvent
386
+ | PostEditedEvent
387
+ | PostArchivedEvent
388
+ | PostAcknowledgedEvent
389
+ | PostAcknowledgmentWithdrawnEvent
325
390
  | NoteCreatedEvent
326
391
  | NoteRevisedEvent
327
392
  | NoteArchivedEvent
@@ -356,6 +421,40 @@ export interface MemoRecord {
356
421
  archived?: MemoArchivedEvent;
357
422
  status: 'unread' | 'read' | 'archived';
358
423
  }
424
+ export interface PostAcknowledgment {
425
+ actor: ActorIdentity;
426
+ acknowledgedAt: string;
427
+ note?: string;
428
+ }
429
+ export interface PostRecord {
430
+ event: PostCreatedEvent;
431
+ edits: PostEditedEvent[];
432
+ archived?: PostArchivedEvent;
433
+ /** Everyone who has said they have seen it, in the order they said so. */
434
+ acknowledgments: PostAcknowledgment[];
435
+ status: 'active' | 'archived';
436
+ title: string;
437
+ body: string;
438
+ tags?: string[];
439
+ version: number;
440
+ }
441
+
442
+ /**
443
+ * Who has acknowledged a post, and who has not.
444
+ *
445
+ * `outstanding` is the honest denominator: actors who can read the post now AND
446
+ * could have read it when it was posted. Someone who joined afterwards is
447
+ * neither acknowledged nor outstanding — they were not there — and is reported
448
+ * as a count instead, so a roster never accuses a newcomer of ignoring
449
+ * something written before they arrived.
450
+ */
451
+ export interface PostRoster {
452
+ postId: string;
453
+ acknowledged: PostAcknowledgment[];
454
+ outstanding: Array<{ id: string; displayName: string }>;
455
+ joinedSince: number;
456
+ }
457
+
359
458
  export interface NoteRecord {
360
459
  event: NoteCreatedEvent;
361
460
  revision?: NoteRevisedEvent;
@@ -529,6 +628,23 @@ export interface SendMemoInput extends MutationInput {
529
628
  tags?: string[];
530
629
  visibility?: Visibility;
531
630
  }
631
+ export interface CreatePostInput extends MutationInput {
632
+ title: string;
633
+ body: string;
634
+ tags?: string[];
635
+ /** The post being replied to; a reply inherits its parent's workspace. */
636
+ replyTo?: string;
637
+ }
638
+
639
+ export interface UpdatePostInput {
640
+ postId: string;
641
+ expectedVersion: number;
642
+ title?: string;
643
+ body?: string;
644
+ tags?: string[];
645
+ idempotencyKey?: string;
646
+ }
647
+
532
648
  export interface CreateNoteInput extends MutationInput {
533
649
  ownerAgentId?: string;
534
650
  title: string;
@@ -580,13 +696,15 @@ export interface BindRuntimeInput {
580
696
  }
581
697
 
582
698
  export interface CreateAgentInput {
583
- id: string;
699
+ /** The handle. The canonical ID is generated, never supplied. */
700
+ handle: string;
584
701
  displayName: string;
585
702
  aliases?: string[];
586
703
  description?: string;
587
704
  metadata?: Record<string, JsonValue>;
588
705
  }
589
706
  export interface UpdateAgentInput {
707
+ handle?: string;
590
708
  displayName?: string;
591
709
  aliases?: string[];
592
710
  description?: string;
@@ -602,7 +720,15 @@ export interface KudosStats {
602
720
  byTag: Record<string, number>;
603
721
  }
604
722
  export interface Diagnostic {
605
- level: 'ok' | 'warning' | 'error';
723
+ /**
724
+ * `skipped` is not a failure.
725
+ *
726
+ * A check the caller lacks permission to run says so and leaves the overall
727
+ * result healthy. Failing the whole diagnostic because an ordinary agent
728
+ * cannot read workspace administration would make `doctor` useless to the
729
+ * callers who need it most.
730
+ */
731
+ level: 'ok' | 'warning' | 'error' | 'skipped';
606
732
  code: string;
607
733
  message: string;
608
734
  path?: string;