@company-semantics/contracts 39.2.0 → 39.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.
@@ -1457,6 +1457,77 @@ export interface paths {
1457
1457
  patch?: never;
1458
1458
  trace?: never;
1459
1459
  };
1460
+ "/api/company-md/docs/{id}/collab/sync": {
1461
+ parameters: {
1462
+ query?: never;
1463
+ header?: never;
1464
+ path?: never;
1465
+ cookie?: never;
1466
+ };
1467
+ /** Get merged collaboration state for a company.md document body */
1468
+ get: operations["getCompanyMdDocCollabSync"];
1469
+ put?: never;
1470
+ post?: never;
1471
+ delete?: never;
1472
+ options?: never;
1473
+ head?: never;
1474
+ patch?: never;
1475
+ trace?: never;
1476
+ };
1477
+ "/api/company-md/docs/{id}/collab/updates": {
1478
+ parameters: {
1479
+ query?: never;
1480
+ header?: never;
1481
+ path?: never;
1482
+ cookie?: never;
1483
+ };
1484
+ get?: never;
1485
+ put?: never;
1486
+ /** Append one Yjs update to a company.md document’s collaboration log */
1487
+ post: operations["appendCompanyMdDocCollabUpdate"];
1488
+ delete?: never;
1489
+ options?: never;
1490
+ head?: never;
1491
+ patch?: never;
1492
+ trace?: never;
1493
+ };
1494
+ "/api/company-md/docs/{id}/collab/presence": {
1495
+ parameters: {
1496
+ query?: never;
1497
+ header?: never;
1498
+ path?: never;
1499
+ cookie?: never;
1500
+ };
1501
+ get?: never;
1502
+ put?: never;
1503
+ /** Signal presence (cursor position, status, departure) on a company.md document */
1504
+ post: operations["postCompanyMdDocCollabPresence"];
1505
+ delete?: never;
1506
+ options?: never;
1507
+ head?: never;
1508
+ patch?: never;
1509
+ trace?: never;
1510
+ };
1511
+ "/api/company-md/docs/{id}/collab/stream": {
1512
+ parameters: {
1513
+ query?: never;
1514
+ header?: never;
1515
+ path?: never;
1516
+ cookie?: never;
1517
+ };
1518
+ /**
1519
+ * Stream company.md collaboration updates via SSE
1520
+ * @description Server-Sent Events stream of collaboration updates for a company.md document body. x-streaming: true. Durable frames are `event: collab-update` with `id: <seq>` (decimal string); resume via `?after=<seq>&epoch=<n>` from /collab/sync, or the Last-Event-ID header on reconnect. An unusable cursor gets `event: collab-reset` and the client refetches /collab/sync. See ADR-BE-439.
1521
+ */
1522
+ get: operations["streamCompanyMdDocCollab"];
1523
+ put?: never;
1524
+ post?: never;
1525
+ delete?: never;
1526
+ options?: never;
1527
+ head?: never;
1528
+ patch?: never;
1529
+ trace?: never;
1530
+ };
1460
1531
  "/api/company-md/extract": {
1461
1532
  parameters: {
1462
1533
  query?: never;
@@ -4578,6 +4649,48 @@ export interface components {
4578
4649
  UpdateCompanyMdTitleRequest: {
4579
4650
  title: string;
4580
4651
  };
4652
+ /** @description Merged collaboration state plus the cursor the stream resumes from. */
4653
+ CollabSyncResponse: {
4654
+ epoch: number;
4655
+ seq: string;
4656
+ update: string;
4657
+ reset: boolean;
4658
+ editable: boolean;
4659
+ limits: components["schemas"]["CollabSyncLimits"];
4660
+ };
4661
+ /** @description The position the update was assigned, and whether it was a replayed retry. */
4662
+ CollabAppendUpdateResponse: {
4663
+ seq: string;
4664
+ duplicate: boolean;
4665
+ };
4666
+ /** @description One Yjs update plus the generation and idempotency pair it belongs to. */
4667
+ CollabAppendUpdateRequest: {
4668
+ epoch: number;
4669
+ /** Format: uuid */
4670
+ clientKey: string;
4671
+ /** Format: uuid */
4672
+ clientUpdateId: string;
4673
+ update: string;
4674
+ };
4675
+ /** @description One presence signal: position blobs and a status for the caller’s own editor instance. Identity is stamped server-side. */
4676
+ CollabPresenceRequest: {
4677
+ /** Format: uuid */
4678
+ clientKey: string;
4679
+ /** @enum {string} */
4680
+ status: "editing" | "viewing";
4681
+ anchor?: string;
4682
+ head?: string;
4683
+ /** @constant */
4684
+ gone?: true;
4685
+ };
4686
+ /** @description One durable collaboration update, as streamed over SSE. */
4687
+ CollabStreamUpdateFrame: {
4688
+ /** @constant */
4689
+ v: 1;
4690
+ epoch: number;
4691
+ seq: string;
4692
+ update: string;
4693
+ };
4581
4694
  CompanyMdContextBankResponse: {
4582
4695
  items: {
4583
4696
  id: string;
@@ -5882,6 +5995,11 @@ export interface components {
5882
5995
  userAgent: string;
5883
5996
  } | null;
5884
5997
  };
5998
+ /** @description Server-enforced collaboration size limits, published so clients can pre-check. */
5999
+ CollabSyncLimits: {
6000
+ maxUpdateBytes: number;
6001
+ maxDocTextBytes: number;
6002
+ };
5885
6003
  /** @description An ACL-admitted context-doc discovery hit. */
5886
6004
  ContextDocDiscoveryHit: {
5887
6005
  id: string;
@@ -8117,6 +8235,183 @@ export interface operations {
8117
8235
  };
8118
8236
  };
8119
8237
  };
8238
+ getCompanyMdDocCollabSync: {
8239
+ parameters: {
8240
+ query?: {
8241
+ since?: string;
8242
+ epoch?: number;
8243
+ };
8244
+ header?: never;
8245
+ path: {
8246
+ id: string;
8247
+ };
8248
+ cookie?: never;
8249
+ };
8250
+ requestBody?: never;
8251
+ responses: {
8252
+ /** @description Merged collaboration state plus the cursor the stream resumes from */
8253
+ 200: {
8254
+ headers: {
8255
+ [name: string]: unknown;
8256
+ };
8257
+ content: {
8258
+ "application/json": components["schemas"]["CollabSyncResponse"];
8259
+ };
8260
+ };
8261
+ /** @description Document not found, or the caller may not read its body */
8262
+ 404: {
8263
+ headers: {
8264
+ [name: string]: unknown;
8265
+ };
8266
+ content?: never;
8267
+ };
8268
+ /** @description The supplied cursor is ahead of this document’s log; resync */
8269
+ 409: {
8270
+ headers: {
8271
+ [name: string]: unknown;
8272
+ };
8273
+ content?: never;
8274
+ };
8275
+ };
8276
+ };
8277
+ appendCompanyMdDocCollabUpdate: {
8278
+ parameters: {
8279
+ query?: never;
8280
+ header?: never;
8281
+ path: {
8282
+ id: string;
8283
+ };
8284
+ cookie?: never;
8285
+ };
8286
+ requestBody: {
8287
+ content: {
8288
+ "application/json": components["schemas"]["CollabAppendUpdateRequest"];
8289
+ };
8290
+ };
8291
+ responses: {
8292
+ /** @description The position the update was assigned, and whether it was a replayed retry */
8293
+ 200: {
8294
+ headers: {
8295
+ [name: string]: unknown;
8296
+ };
8297
+ content: {
8298
+ "application/json": components["schemas"]["CollabAppendUpdateResponse"];
8299
+ };
8300
+ };
8301
+ /** @description Malformed body, or a payload that does not decode as a Yjs update */
8302
+ 400: {
8303
+ headers: {
8304
+ [name: string]: unknown;
8305
+ };
8306
+ content?: never;
8307
+ };
8308
+ /** @description Document not found, or the caller may not edit it */
8309
+ 404: {
8310
+ headers: {
8311
+ [name: string]: unknown;
8312
+ };
8313
+ content?: never;
8314
+ };
8315
+ /** @description Epoch mismatch, or the document was never activated for collaboration */
8316
+ 409: {
8317
+ headers: {
8318
+ [name: string]: unknown;
8319
+ };
8320
+ content?: never;
8321
+ };
8322
+ /** @description Applying the update would exceed the document text cap; not logged */
8323
+ 413: {
8324
+ headers: {
8325
+ [name: string]: unknown;
8326
+ };
8327
+ content?: never;
8328
+ };
8329
+ /** @description Too many uncompacted updates pending; retry after backoff */
8330
+ 429: {
8331
+ headers: {
8332
+ [name: string]: unknown;
8333
+ };
8334
+ content?: never;
8335
+ };
8336
+ };
8337
+ };
8338
+ postCompanyMdDocCollabPresence: {
8339
+ parameters: {
8340
+ query?: never;
8341
+ header?: never;
8342
+ path: {
8343
+ id: string;
8344
+ };
8345
+ cookie?: never;
8346
+ };
8347
+ requestBody: {
8348
+ content: {
8349
+ "application/json": components["schemas"]["CollabPresenceRequest"];
8350
+ };
8351
+ };
8352
+ responses: {
8353
+ /** @description Presence signal accepted (ephemeral; nothing durable written) */
8354
+ 204: {
8355
+ headers: {
8356
+ [name: string]: unknown;
8357
+ };
8358
+ content?: never;
8359
+ };
8360
+ /** @description Malformed body (bad clientKey, status, or oversized position blob) */
8361
+ 400: {
8362
+ headers: {
8363
+ [name: string]: unknown;
8364
+ };
8365
+ content?: never;
8366
+ };
8367
+ /** @description The clientKey is bound to a different user on this document */
8368
+ 403: {
8369
+ headers: {
8370
+ [name: string]: unknown;
8371
+ };
8372
+ content?: never;
8373
+ };
8374
+ /** @description Document not found, or the caller may not read its body */
8375
+ 404: {
8376
+ headers: {
8377
+ [name: string]: unknown;
8378
+ };
8379
+ content?: never;
8380
+ };
8381
+ };
8382
+ };
8383
+ streamCompanyMdDocCollab: {
8384
+ parameters: {
8385
+ query?: {
8386
+ after?: string;
8387
+ epoch?: number;
8388
+ };
8389
+ header?: never;
8390
+ path: {
8391
+ id: string;
8392
+ };
8393
+ cookie?: never;
8394
+ };
8395
+ requestBody?: never;
8396
+ responses: {
8397
+ /** @description SSE event stream (text/event-stream). Durable frame payload: CollabStreamUpdateFrame. */
8398
+ 200: {
8399
+ headers: {
8400
+ [name: string]: unknown;
8401
+ };
8402
+ content: {
8403
+ "text/event-stream": components["schemas"]["CollabStreamUpdateFrame"];
8404
+ };
8405
+ };
8406
+ /** @description Document not found, or the caller may not read its body */
8407
+ 404: {
8408
+ headers: {
8409
+ [name: string]: unknown;
8410
+ };
8411
+ content?: never;
8412
+ };
8413
+ };
8414
+ };
8120
8415
  extractCompanyMd: {
8121
8416
  parameters: {
8122
8417
  query?: never;
@@ -30,6 +30,10 @@ export const openApiRoutes = {
30
30
  '/api/company-md/docs/:id/context-bank/suggestions': ['GET'],
31
31
  '/api/company-md/docs/{id}': ['GET'],
32
32
  '/api/company-md/docs/{id}/access-requests': ['GET', 'POST'],
33
+ '/api/company-md/docs/{id}/collab/presence': ['POST'],
34
+ '/api/company-md/docs/{id}/collab/stream': ['GET'],
35
+ '/api/company-md/docs/{id}/collab/sync': ['GET'],
36
+ '/api/company-md/docs/{id}/collab/updates': ['POST'],
33
37
  '/api/company-md/docs/{id}/content': ['PUT'],
34
38
  '/api/company-md/docs/{id}/context-bank': ['GET'],
35
39
  '/api/company-md/docs/{id}/context-bank/associate': ['POST'],
package/src/index.ts CHANGED
@@ -240,6 +240,32 @@ export {
240
240
  isValidNotificationKind,
241
241
  } from "./notifications/index";
242
242
 
243
+ // Action-item domain types — things awaiting a user's DECISION, derived from
244
+ // each domain's own pending rows rather than stored. Deliberately a separate
245
+ // vocabulary from NotificationKind above: that one names events that get SENT,
246
+ // this one names standing state. See src/action-items/README.md.
247
+ // @see ADR-CONT-104
248
+ export {
249
+ ACTION_ITEM_KINDS,
250
+ ACTION_ITEM_TARGET_TYPES,
251
+ } from "./action-items/index";
252
+
253
+ export {
254
+ ActionItemKindSchema,
255
+ ActionItemListResponseSchema,
256
+ ActionItemSchema,
257
+ ActionItemTargetSchema,
258
+ ActionItemTargetTypeSchema,
259
+ } from "./action-items/index";
260
+
261
+ export type {
262
+ ActionItem,
263
+ ActionItemKind,
264
+ ActionItemListResponse,
265
+ ActionItemTarget,
266
+ ActionItemTargetType,
267
+ } from "./action-items/index";
268
+
243
269
  // Chat domain types
244
270
  // @see PRD-00142 for share chat design rationale
245
271
  export type {
@@ -418,6 +444,38 @@ export type {
418
444
  export { SourceAuthoritySchema } from "./org/index";
419
445
  export type { SourceAuthority } from "./org/index";
420
446
 
447
+ // Company.md real-time collaboration wire contract: sync/update-accepted
448
+ // responses, the SSE frame union, the Y.Doc shape constant, and the published
449
+ // size limits. Sequences are ALWAYS decimal strings. (ADR-CONT-102)
450
+ export {
451
+ COMPANY_MD_COLLAB_TEXT_KEY,
452
+ COMPANY_MD_COLLAB_MAX_UPDATE_B64_CHARS,
453
+ COMPANY_MD_COLLAB_MAX_DOC_TEXT_BYTES,
454
+ COMPANY_MD_COLLAB_MAX_PRESENCE_POSITION_CHARS,
455
+ CompanyMdCollabSyncLimitsSchema,
456
+ CompanyMdCollabSyncResponseSchema,
457
+ CompanyMdCollabUpdateAcceptedSchema,
458
+ CompanyMdCollabUpdateEventSchema,
459
+ CompanyMdCollabPresenceEventSchema,
460
+ CompanyMdCollabResetEventSchema,
461
+ CompanyMdCollabAccessRevokedEventSchema,
462
+ CompanyMdCollabConnectedEventSchema,
463
+ CompanyMdCollabServerDrainEventSchema,
464
+ CompanyMdCollabSseEventSchema,
465
+ } from "./org/index";
466
+ export type {
467
+ CompanyMdCollabSyncLimits,
468
+ CompanyMdCollabSyncResponse,
469
+ CompanyMdCollabUpdateAccepted,
470
+ CompanyMdCollabUpdateEvent,
471
+ CompanyMdCollabPresenceEvent,
472
+ CompanyMdCollabResetEvent,
473
+ CompanyMdCollabAccessRevokedEvent,
474
+ CompanyMdCollabConnectedEvent,
475
+ CompanyMdCollabServerDrainEvent,
476
+ CompanyMdCollabSseEvent,
477
+ } from "./org/index";
478
+
421
479
  // Sync run summary: the outcome record of one adapter sync run (counts +
422
480
  // cursor watermark). A flat report shape, not a structure fact. (ADR-CONT-085)
423
481
  export { SyncRunSummarySchema } from "./org/index";
package/src/org/README.md CHANGED
@@ -37,6 +37,10 @@ Shared type vocabulary for organization ownership, type classification, and tran
37
37
  - `AuthoritySource` _(type)_
38
38
  - `AuthoritySourceSchema` — Engine-internal authority source.
39
39
  - `AuthorizableView` _(type)_ — Type for views that can be checked against VIEWSCOPEMAP.
40
+ - `COMPANY_MD_COLLAB_MAX_DOC_TEXT_BYTES` — Cap on the MATERIALIZED document text, in UTF-8 bytes of the expanded result.
41
+ - `COMPANY_MD_COLLAB_MAX_PRESENCE_POSITION_CHARS` — Cap on ONE presence position blob (`anchor` or `head`), in base64 chars.
42
+ - `COMPANY_MD_COLLAB_MAX_UPDATE_B64_CHARS` — Cap on ONE encoded update, measured on the base64 payload as it is sent.
43
+ - `COMPANY_MD_COLLAB_TEXT_KEY` — The Y.Doc root key holding the document body — a CONTRACT, not a detail.
40
44
  - `CanonicalFacts` _(type)_
41
45
  - `CanonicalFactsSchema` — The full normalized batch an external-source adapter emits in one pass: every person, org unit, position…
42
46
  - `CanonicalOccupancy` _(type)_
@@ -55,6 +59,26 @@ Shared type vocabulary for organization ownership, type classification, and tran
55
59
  - `ChangeMemberRoleResponse` _(type)_
56
60
  - `ChangeMemberRoleResponseSchema`
57
61
  - `CompanyMdClassification` _(type)_ — Information classification for a Company.md node — what the document is, for governance, NOT permissions.
62
+ - `CompanyMdCollabAccessRevokedEvent` _(type)_
63
+ - `CompanyMdCollabAccessRevokedEventSchema` — `event: access-revoked` — the actor's read grant went away mid-stream.
64
+ - `CompanyMdCollabConnectedEvent` _(type)_
65
+ - `CompanyMdCollabConnectedEventSchema` — `event: connected` — the stream is open.
66
+ - `CompanyMdCollabPresenceEvent` _(type)_
67
+ - `CompanyMdCollabPresenceEventSchema` — `event: collab-presence` — one participant's presence signal, either live or replayed from the roster right…
68
+ - `CompanyMdCollabResetEvent` _(type)_
69
+ - `CompanyMdCollabResetEventSchema` — `event: collab-reset` — the client's cursor was unusable (a superseded generation, older than what compaction…
70
+ - `CompanyMdCollabServerDrainEvent` _(type)_
71
+ - `CompanyMdCollabServerDrainEventSchema` — `event: server_drain` — the server is shutting the stream down deliberately (a rolling restart, not a…
72
+ - `CompanyMdCollabSseEvent` _(type)_
73
+ - `CompanyMdCollabSseEventSchema` — Every frame the collaboration stream emits, discriminated on the `type` the client stamps from the SSE…
74
+ - `CompanyMdCollabSyncLimits` _(type)_
75
+ - `CompanyMdCollabSyncLimitsSchema` — Protocol limits the client needs BEFORE it sends anything.
76
+ - `CompanyMdCollabSyncResponse` _(type)_
77
+ - `CompanyMdCollabSyncResponseSchema` — `GET /collab/sync` response body — merged collaboration state plus the cursor the stream resumes from.
78
+ - `CompanyMdCollabUpdateAccepted` _(type)_
79
+ - `CompanyMdCollabUpdateAcceptedSchema` — `POST /collab/updates` response body.
80
+ - `CompanyMdCollabUpdateEvent` _(type)_
81
+ - `CompanyMdCollabUpdateEventSchema` — `event: collab-update` — one durable collaboration update.
58
82
  - `CompanyMdContextBankItem` _(type)_ — A context bank item — a company.md doc associated with one or more parent nodes.
59
83
  - `CompanyMdDependency` _(type)_
60
84
  - `CompanyMdDiscoverabilityPolicy` _(type)_ — Discoverability policy for a Company.md node — who knows it exists, orthogonal to who may read it (authority…