@company-semantics/contracts 45.1.0 → 45.3.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 (32) hide show
  1. package/package.json +10 -3
  2. package/src/__tests__/resource-keys.test.ts +59 -0
  3. package/src/api/generated-spec-hash.ts +2 -2
  4. package/src/api/generated.ts +540 -1
  5. package/src/comments/README.md +115 -0
  6. package/src/comments/__tests__/README.md +49 -0
  7. package/src/comments/__tests__/anchor-corpus.test.ts +202 -0
  8. package/src/comments/__tests__/fixtures/README.md +58 -0
  9. package/src/comments/__tests__/fixtures/comment-anchors.json +94 -0
  10. package/src/comments/__tests__/fixtures/comment-anchors.provenance.json +9 -0
  11. package/src/comments/__tests__/schemas.test.ts +274 -0
  12. package/src/comments/anchor.ts +120 -0
  13. package/src/comments/index.ts +43 -0
  14. package/src/comments/schemas.ts +227 -0
  15. package/src/generated/openapi-routes.ts +7 -0
  16. package/src/index.ts +42 -0
  17. package/src/notifications/__tests__/__snapshots__/registry.test.ts.snap +4 -0
  18. package/src/notifications/__tests__/__snapshots__/render-snapshot.test.ts.snap +741 -0
  19. package/src/notifications/__tests__/definition.test.ts +4 -3
  20. package/src/notifications/__tests__/fixtures.ts +34 -0
  21. package/src/notifications/__tests__/kinds.test.ts +11 -4
  22. package/src/notifications/__tests__/registry.test.ts +7 -5
  23. package/src/notifications/__tests__/render-snapshot.test.ts +36 -0
  24. package/src/notifications/kinds/comment-mention.ts +82 -0
  25. package/src/notifications/kinds/comment-reply.ts +79 -0
  26. package/src/notifications/kinds/index.ts +2 -0
  27. package/src/notifications/kinds.ts +12 -3
  28. package/src/notifications/payloads.ts +49 -0
  29. package/src/notifications/registry.ts +6 -2
  30. package/src/org/schemas.ts +23 -0
  31. package/src/resource-keys.ts +68 -0
  32. package/src/user-notifications/kinds.ts +13 -1
@@ -1531,6 +1531,23 @@ export interface paths {
1531
1531
  patch?: never;
1532
1532
  trace?: never;
1533
1533
  };
1534
+ "/api/company-md/docs/{id}/mentionable": {
1535
+ parameters: {
1536
+ query?: never;
1537
+ header?: never;
1538
+ path?: never;
1539
+ cookie?: never;
1540
+ };
1541
+ /** List the document readers the caller may mention */
1542
+ get: operations["listCompanyMdMentionableUsers"];
1543
+ put?: never;
1544
+ post?: never;
1545
+ delete?: never;
1546
+ options?: never;
1547
+ head?: never;
1548
+ patch?: never;
1549
+ trace?: never;
1550
+ };
1534
1551
  "/api/company-md/extract": {
1535
1552
  parameters: {
1536
1553
  query?: never;
@@ -3394,6 +3411,109 @@ export interface paths {
3394
3411
  patch?: never;
3395
3412
  trace?: never;
3396
3413
  };
3414
+ "/api/comments": {
3415
+ parameters: {
3416
+ query?: never;
3417
+ header?: never;
3418
+ path?: never;
3419
+ cookie?: never;
3420
+ };
3421
+ /** List a subject's comment threads */
3422
+ get: operations["listCommentThreads"];
3423
+ put?: never;
3424
+ post?: never;
3425
+ delete?: never;
3426
+ options?: never;
3427
+ head?: never;
3428
+ patch?: never;
3429
+ trace?: never;
3430
+ };
3431
+ "/api/comments/threads": {
3432
+ parameters: {
3433
+ query?: never;
3434
+ header?: never;
3435
+ path?: never;
3436
+ cookie?: never;
3437
+ };
3438
+ get?: never;
3439
+ put?: never;
3440
+ /** Open a comment thread on a subject */
3441
+ post: operations["createCommentThread"];
3442
+ delete?: never;
3443
+ options?: never;
3444
+ head?: never;
3445
+ patch?: never;
3446
+ trace?: never;
3447
+ };
3448
+ "/api/comments/threads/{threadId}/comments": {
3449
+ parameters: {
3450
+ query?: never;
3451
+ header?: never;
3452
+ path?: never;
3453
+ cookie?: never;
3454
+ };
3455
+ get?: never;
3456
+ put?: never;
3457
+ /** Reply into a comment thread */
3458
+ post: operations["replyToCommentThread"];
3459
+ delete?: never;
3460
+ options?: never;
3461
+ head?: never;
3462
+ patch?: never;
3463
+ trace?: never;
3464
+ };
3465
+ "/api/comments/{commentId}": {
3466
+ parameters: {
3467
+ query?: never;
3468
+ header?: never;
3469
+ path?: never;
3470
+ cookie?: never;
3471
+ };
3472
+ get?: never;
3473
+ put?: never;
3474
+ post?: never;
3475
+ /** Soft-delete a comment (author or subject owner) */
3476
+ delete: operations["deleteComment"];
3477
+ options?: never;
3478
+ head?: never;
3479
+ /** Edit a comment's body (author-only) */
3480
+ patch: operations["editComment"];
3481
+ trace?: never;
3482
+ };
3483
+ "/api/comments/threads/{threadId}/resolve": {
3484
+ parameters: {
3485
+ query?: never;
3486
+ header?: never;
3487
+ path?: never;
3488
+ cookie?: never;
3489
+ };
3490
+ get?: never;
3491
+ put?: never;
3492
+ /** Resolve a comment thread */
3493
+ post: operations["resolveCommentThread"];
3494
+ delete?: never;
3495
+ options?: never;
3496
+ head?: never;
3497
+ patch?: never;
3498
+ trace?: never;
3499
+ };
3500
+ "/api/comments/threads/{threadId}/reopen": {
3501
+ parameters: {
3502
+ query?: never;
3503
+ header?: never;
3504
+ path?: never;
3505
+ cookie?: never;
3506
+ };
3507
+ get?: never;
3508
+ put?: never;
3509
+ /** Reopen a resolved comment thread */
3510
+ post: operations["reopenCommentThread"];
3511
+ delete?: never;
3512
+ options?: never;
3513
+ head?: never;
3514
+ patch?: never;
3515
+ trace?: never;
3516
+ };
3397
3517
  }
3398
3518
  export type webhooks = Record<string, never>;
3399
3519
  export interface components {
@@ -4036,6 +4156,10 @@ export interface components {
4036
4156
  unitMembershipsTruncated: boolean;
4037
4157
  inviteStatus: ("active" | "pending" | "expired") | null;
4038
4158
  effectiveScopes: string[];
4159
+ scopeProvenance?: {
4160
+ scope: string;
4161
+ bands: string[];
4162
+ }[];
4039
4163
  recentActions: {
4040
4164
  id: string;
4041
4165
  timestamp: string;
@@ -4784,6 +4908,10 @@ export interface components {
4784
4908
  seq: string;
4785
4909
  update: string;
4786
4910
  };
4911
+ /** @description The document readers the caller may mention, ordered and bounded. */
4912
+ CompanyMdMentionableResponse: {
4913
+ items: components["schemas"]["CompanyMdMentionableCandidate"][];
4914
+ };
4787
4915
  CompanyMdContextBankResponse: {
4788
4916
  items: {
4789
4917
  id: string;
@@ -5630,7 +5758,7 @@ export interface components {
5630
5758
  notification: {
5631
5759
  id: string;
5632
5760
  /** @enum {string} */
5633
- kind: "companyMd.access_requested" | "companyMd.access_request_approved" | "companyMd.access_request_denied";
5761
+ kind: "companyMd.access_requested" | "companyMd.access_request_approved" | "companyMd.access_request_denied" | "comment.mention" | "comment.reply";
5634
5762
  target: {
5635
5763
  /** @enum {string} */
5636
5764
  type: "company_md" | "org_unit" | "org" | "execution";
@@ -6156,11 +6284,70 @@ export interface components {
6156
6284
  userAgent: string;
6157
6285
  } | null;
6158
6286
  };
6287
+ /** @description Every thread on the subject the caller may see. */
6288
+ CommentThreadListResponse: {
6289
+ threads: components["schemas"]["CommentThread"][];
6290
+ };
6291
+ /** @description The created thread with its opening comment. */
6292
+ CommentThreadResponse: {
6293
+ thread: components["schemas"]["CommentThread"];
6294
+ };
6295
+ CreateCommentThreadRequest: {
6296
+ /** @enum {string} */
6297
+ subjectType: "company_md" | "strategy_doc" | "work_item" | "meeting_recording";
6298
+ /** Format: uuid */
6299
+ subjectId: string;
6300
+ anchor: components["schemas"]["CommentAnchor"];
6301
+ body: string;
6302
+ mentions?: {
6303
+ /** Format: uuid */
6304
+ userId: string;
6305
+ startOffset: number;
6306
+ endOffset: number;
6307
+ }[];
6308
+ };
6309
+ /** @description The written reply, and whether it auto-reopened a resolved thread. */
6310
+ CommentReplyResponse: {
6311
+ comment: components["schemas"]["Comment"];
6312
+ reopened: boolean;
6313
+ };
6314
+ CommentReplyRequest: {
6315
+ body: string;
6316
+ mentions?: {
6317
+ /** Format: uuid */
6318
+ userId: string;
6319
+ startOffset: number;
6320
+ endOffset: number;
6321
+ }[];
6322
+ };
6323
+ /** @description The comment after the mutation (redacted projection after delete). */
6324
+ CommentResponse: {
6325
+ comment: components["schemas"]["Comment"];
6326
+ };
6327
+ EditCommentRequest: {
6328
+ body: string;
6329
+ mentions?: {
6330
+ /** Format: uuid */
6331
+ userId: string;
6332
+ startOffset: number;
6333
+ endOffset: number;
6334
+ }[];
6335
+ };
6336
+ /** @description The thread after a resolve/reopen transition. */
6337
+ CommentThreadSummaryResponse: {
6338
+ thread: components["schemas"]["CommentThreadSummary"];
6339
+ };
6159
6340
  /** @description Server-enforced collaboration size limits, published so clients can pre-check. */
6160
6341
  CollabSyncLimits: {
6161
6342
  maxUpdateBytes: number;
6162
6343
  maxDocTextBytes: number;
6163
6344
  };
6345
+ /** @description A principal who can read the document and may therefore be mentioned. */
6346
+ CompanyMdMentionableCandidate: {
6347
+ userId: string;
6348
+ displayName: string;
6349
+ avatarUrl: string | null;
6350
+ };
6164
6351
  /** @description An ACL-admitted context-doc discovery hit. */
6165
6352
  ContextDocDiscoveryHit: {
6166
6353
  id: string;
@@ -6174,6 +6361,76 @@ export interface components {
6174
6361
  /** @enum {string} */
6175
6362
  matchedVia: "fts" | "vector";
6176
6363
  };
6364
+ /** @description A comment thread with all its comments oldest-first; soft-deleted comments appear redacted, never filtered out. */
6365
+ CommentThread: {
6366
+ id: string;
6367
+ /** @enum {string} */
6368
+ subjectType: "company_md" | "strategy_doc" | "work_item" | "meeting_recording";
6369
+ subjectId: string;
6370
+ /** @enum {string} */
6371
+ anchorType: "document" | "text";
6372
+ anchor: components["schemas"]["CommentAnchor"];
6373
+ /** @enum {string} */
6374
+ status: "open" | "resolved";
6375
+ createdByUserId: string | null;
6376
+ resolvedByUserId: string | null;
6377
+ resolvedAt: string | null;
6378
+ createdAt: string;
6379
+ updatedAt: string;
6380
+ comments: components["schemas"]["Comment"][];
6381
+ };
6382
+ /** @description Opaque, versioned comment anchor: document-level, or a text anchor with a required quote and optional relative positions. */
6383
+ CommentAnchor: {
6384
+ /** @constant */
6385
+ type: "document";
6386
+ /** @constant */
6387
+ v: 1;
6388
+ } | {
6389
+ /** @constant */
6390
+ type: "text";
6391
+ /** @constant */
6392
+ v: 1;
6393
+ relStart?: string;
6394
+ relEnd?: string;
6395
+ quote: string;
6396
+ prefix: string;
6397
+ suffix: string;
6398
+ };
6399
+ /** @description One comment; body is null iff soft-deleted (redacted projection with empty mentions). */
6400
+ Comment: {
6401
+ id: string;
6402
+ threadId: string;
6403
+ authorUserId: string | null;
6404
+ body: string | null;
6405
+ editedAt: string | null;
6406
+ deletedAt: string | null;
6407
+ createdAt: string;
6408
+ mentions: components["schemas"]["CommentMention"][];
6409
+ };
6410
+ /** @description One mention on a comment: the mentioned user id, its zero-based exclusive-end UTF-16 range (null until the offset columns exist), and the display name resolved at read time. */
6411
+ CommentMention: {
6412
+ userId: string;
6413
+ startOffset: number | null;
6414
+ endOffset: number | null;
6415
+ displayName: string;
6416
+ };
6417
+ /** @description A comment thread without its comments. */
6418
+ CommentThreadSummary: {
6419
+ id: string;
6420
+ /** @enum {string} */
6421
+ subjectType: "company_md" | "strategy_doc" | "work_item" | "meeting_recording";
6422
+ subjectId: string;
6423
+ /** @enum {string} */
6424
+ anchorType: "document" | "text";
6425
+ anchor: components["schemas"]["CommentAnchor"];
6426
+ /** @enum {string} */
6427
+ status: "open" | "resolved";
6428
+ createdByUserId: string | null;
6429
+ resolvedByUserId: string | null;
6430
+ resolvedAt: string | null;
6431
+ createdAt: string;
6432
+ updatedAt: string;
6433
+ };
6177
6434
  };
6178
6435
  responses: never;
6179
6436
  parameters: never;
@@ -8569,6 +8826,45 @@ export interface operations {
8569
8826
  };
8570
8827
  };
8571
8828
  };
8829
+ listCompanyMdMentionableUsers: {
8830
+ parameters: {
8831
+ query?: {
8832
+ q?: string;
8833
+ limit?: number;
8834
+ };
8835
+ header?: never;
8836
+ path: {
8837
+ id: string;
8838
+ };
8839
+ cookie?: never;
8840
+ };
8841
+ requestBody?: never;
8842
+ responses: {
8843
+ /** @description Document readers the caller may mention, ordered and bounded */
8844
+ 200: {
8845
+ headers: {
8846
+ [name: string]: unknown;
8847
+ };
8848
+ content: {
8849
+ "application/json": components["schemas"]["CompanyMdMentionableResponse"];
8850
+ };
8851
+ };
8852
+ /** @description Invalid query parameters */
8853
+ 400: {
8854
+ headers: {
8855
+ [name: string]: unknown;
8856
+ };
8857
+ content?: never;
8858
+ };
8859
+ /** @description Document not found, or the caller may not comment on it */
8860
+ 404: {
8861
+ headers: {
8862
+ [name: string]: unknown;
8863
+ };
8864
+ content?: never;
8865
+ };
8866
+ };
8867
+ };
8572
8868
  extractCompanyMd: {
8573
8869
  parameters: {
8574
8870
  query?: never;
@@ -11905,4 +12201,247 @@ export interface operations {
11905
12201
  };
11906
12202
  };
11907
12203
  };
12204
+ listCommentThreads: {
12205
+ parameters: {
12206
+ query: {
12207
+ subjectType: "company_md" | "strategy_doc" | "work_item" | "meeting_recording";
12208
+ subjectId: string;
12209
+ status?: "open" | "resolved";
12210
+ };
12211
+ header?: never;
12212
+ path?: never;
12213
+ cookie?: never;
12214
+ };
12215
+ requestBody?: never;
12216
+ responses: {
12217
+ /** @description Every thread on the subject with its comments oldest-first */
12218
+ 200: {
12219
+ headers: {
12220
+ [name: string]: unknown;
12221
+ };
12222
+ content: {
12223
+ "application/json": components["schemas"]["CommentThreadListResponse"];
12224
+ };
12225
+ };
12226
+ /** @description Invalid query parameters */
12227
+ 400: {
12228
+ headers: {
12229
+ [name: string]: unknown;
12230
+ };
12231
+ content?: never;
12232
+ };
12233
+ /** @description Subject not found, or the caller may not read it */
12234
+ 404: {
12235
+ headers: {
12236
+ [name: string]: unknown;
12237
+ };
12238
+ content?: never;
12239
+ };
12240
+ };
12241
+ };
12242
+ createCommentThread: {
12243
+ parameters: {
12244
+ query?: never;
12245
+ header?: never;
12246
+ path?: never;
12247
+ cookie?: never;
12248
+ };
12249
+ requestBody: {
12250
+ content: {
12251
+ "application/json": components["schemas"]["CreateCommentThreadRequest"];
12252
+ };
12253
+ };
12254
+ responses: {
12255
+ /** @description Thread created with its opening comment (one transaction) */
12256
+ 201: {
12257
+ headers: {
12258
+ [name: string]: unknown;
12259
+ };
12260
+ content: {
12261
+ "application/json": components["schemas"]["CommentThreadResponse"];
12262
+ };
12263
+ };
12264
+ /** @description Invalid body (including every anchor-corpus reject case) */
12265
+ 400: {
12266
+ headers: {
12267
+ [name: string]: unknown;
12268
+ };
12269
+ content?: never;
12270
+ };
12271
+ /** @description Subject not found, or the caller may not comment on it */
12272
+ 404: {
12273
+ headers: {
12274
+ [name: string]: unknown;
12275
+ };
12276
+ content?: never;
12277
+ };
12278
+ };
12279
+ };
12280
+ replyToCommentThread: {
12281
+ parameters: {
12282
+ query?: never;
12283
+ header?: never;
12284
+ path: {
12285
+ threadId: string;
12286
+ };
12287
+ cookie?: never;
12288
+ };
12289
+ requestBody: {
12290
+ content: {
12291
+ "application/json": components["schemas"]["CommentReplyRequest"];
12292
+ };
12293
+ };
12294
+ responses: {
12295
+ /** @description Reply written; reopened=true when it auto-reopened a resolved thread */
12296
+ 201: {
12297
+ headers: {
12298
+ [name: string]: unknown;
12299
+ };
12300
+ content: {
12301
+ "application/json": components["schemas"]["CommentReplyResponse"];
12302
+ };
12303
+ };
12304
+ /** @description Invalid body */
12305
+ 400: {
12306
+ headers: {
12307
+ [name: string]: unknown;
12308
+ };
12309
+ content?: never;
12310
+ };
12311
+ /** @description Thread not found, or the caller may not comment on its subject */
12312
+ 404: {
12313
+ headers: {
12314
+ [name: string]: unknown;
12315
+ };
12316
+ content?: never;
12317
+ };
12318
+ };
12319
+ };
12320
+ deleteComment: {
12321
+ parameters: {
12322
+ query?: never;
12323
+ header?: never;
12324
+ path: {
12325
+ commentId: string;
12326
+ };
12327
+ cookie?: never;
12328
+ };
12329
+ requestBody?: never;
12330
+ responses: {
12331
+ /** @description Comment soft-deleted; response carries the redacted projection */
12332
+ 200: {
12333
+ headers: {
12334
+ [name: string]: unknown;
12335
+ };
12336
+ content: {
12337
+ "application/json": components["schemas"]["CommentResponse"];
12338
+ };
12339
+ };
12340
+ /** @description Comment not found, already deleted, or the caller may not delete it */
12341
+ 404: {
12342
+ headers: {
12343
+ [name: string]: unknown;
12344
+ };
12345
+ content?: never;
12346
+ };
12347
+ };
12348
+ };
12349
+ editComment: {
12350
+ parameters: {
12351
+ query?: never;
12352
+ header?: never;
12353
+ path: {
12354
+ commentId: string;
12355
+ };
12356
+ cookie?: never;
12357
+ };
12358
+ requestBody: {
12359
+ content: {
12360
+ "application/json": components["schemas"]["EditCommentRequest"];
12361
+ };
12362
+ };
12363
+ responses: {
12364
+ /** @description Comment updated with edited_at stamped */
12365
+ 200: {
12366
+ headers: {
12367
+ [name: string]: unknown;
12368
+ };
12369
+ content: {
12370
+ "application/json": components["schemas"]["CommentResponse"];
12371
+ };
12372
+ };
12373
+ /** @description Invalid body */
12374
+ 400: {
12375
+ headers: {
12376
+ [name: string]: unknown;
12377
+ };
12378
+ content?: never;
12379
+ };
12380
+ /** @description Comment not found, deleted, or the caller is not its author */
12381
+ 404: {
12382
+ headers: {
12383
+ [name: string]: unknown;
12384
+ };
12385
+ content?: never;
12386
+ };
12387
+ };
12388
+ };
12389
+ resolveCommentThread: {
12390
+ parameters: {
12391
+ query?: never;
12392
+ header?: never;
12393
+ path: {
12394
+ threadId: string;
12395
+ };
12396
+ cookie?: never;
12397
+ };
12398
+ requestBody?: never;
12399
+ responses: {
12400
+ /** @description Thread resolved with resolved_at + resolved_by stamped */
12401
+ 200: {
12402
+ headers: {
12403
+ [name: string]: unknown;
12404
+ };
12405
+ content: {
12406
+ "application/json": components["schemas"]["CommentThreadSummaryResponse"];
12407
+ };
12408
+ };
12409
+ /** @description Thread not found, or the caller may not comment on its subject */
12410
+ 404: {
12411
+ headers: {
12412
+ [name: string]: unknown;
12413
+ };
12414
+ content?: never;
12415
+ };
12416
+ };
12417
+ };
12418
+ reopenCommentThread: {
12419
+ parameters: {
12420
+ query?: never;
12421
+ header?: never;
12422
+ path: {
12423
+ threadId: string;
12424
+ };
12425
+ cookie?: never;
12426
+ };
12427
+ requestBody?: never;
12428
+ responses: {
12429
+ /** @description Thread reopened with the resolution stamp cleared */
12430
+ 200: {
12431
+ headers: {
12432
+ [name: string]: unknown;
12433
+ };
12434
+ content: {
12435
+ "application/json": components["schemas"]["CommentThreadSummaryResponse"];
12436
+ };
12437
+ };
12438
+ /** @description Thread not found, or the caller may not comment on its subject */
12439
+ 404: {
12440
+ headers: {
12441
+ [name: string]: unknown;
12442
+ };
12443
+ content?: never;
12444
+ };
12445
+ };
12446
+ };
11908
12447
  }