@company-semantics/contracts 51.1.0 → 51.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.
- package/package.json +1 -1
- package/src/api/generated-spec-hash.ts +2 -2
- package/src/api/generated.ts +87 -3
- package/src/comments/README.md +175 -32
- package/src/comments/__tests__/README.md +60 -1
- package/src/comments/__tests__/anchor-constants.test.ts +161 -0
- package/src/comments/__tests__/create.test.ts +300 -0
- package/src/comments/__tests__/receipt.test.ts +143 -0
- package/src/comments/__tests__/resolve.test.ts +391 -0
- package/src/comments/__tests__/verify.test.ts +262 -0
- package/src/comments/anchor-constants.ts +61 -0
- package/src/comments/anchor.ts +20 -11
- package/src/comments/create.ts +128 -0
- package/src/comments/index.ts +36 -0
- package/src/comments/receipt.ts +146 -0
- package/src/comments/resolve.ts +261 -0
- package/src/comments/verify.ts +128 -0
- package/src/execution/__tests__/registry.test.ts +89 -0
- package/src/execution/kinds.ts +21 -1
- package/src/execution/registry.ts +73 -0
- package/src/generated/openapi-routes.ts +1 -0
- package/src/index.ts +73 -0
- package/src/message-parts/__tests__/confirmation.test.ts +3 -0
- package/src/message-parts/confirmation.ts +3 -0
package/src/index.ts
CHANGED
|
@@ -329,16 +329,89 @@ export type {
|
|
|
329
329
|
// contracts drift on it has NO server-side tripwire and mis-places comments
|
|
330
330
|
// silently. Response vocabulary only — request bodies stay backend-side.
|
|
331
331
|
// See src/comments/README.md.
|
|
332
|
+
//
|
|
333
|
+
// The anchor SIZE BOUNDS are published alongside the shape, because the client
|
|
334
|
+
// that composes an anchor and the schema that accepts it are the two halves of
|
|
335
|
+
// that same driftable agreement: a constructor capturing more context than the
|
|
336
|
+
// boundary accepts loses a comment after it was written. Note ANCHOR_CONTEXT_CHARS
|
|
337
|
+
// (capture) and ANCHOR_AFFIX_MAX_CHARS (accept) differ ON PURPOSE.
|
|
332
338
|
// @see ADR-CONTRACTS-116, ADR-CONT-029
|
|
333
339
|
export {
|
|
340
|
+
ANCHOR_AFFIX_MAX_CHARS,
|
|
341
|
+
ANCHOR_CONTEXT_CHARS,
|
|
334
342
|
COMMENT_ANCHOR_TYPES,
|
|
335
343
|
COMMENT_SUBJECT_TYPES,
|
|
336
344
|
COMMENT_THREAD_KINDS,
|
|
337
345
|
COMMENT_THREAD_STATUSES,
|
|
346
|
+
QUOTE_MAX_CHARS,
|
|
347
|
+
RELATIVE_POSITION_MAX_CHARS,
|
|
338
348
|
SUGGESTION_OPS,
|
|
339
349
|
SUGGESTION_STATUSES,
|
|
340
350
|
} from "./comments/index";
|
|
341
351
|
|
|
352
|
+
// The anchor's INTERPRETATION, published beside its shape (ADR-CONTRACTS-127).
|
|
353
|
+
// The schema said what an anchor looks like; these say what it MEANS. Both
|
|
354
|
+
// halves have to be published for the same reason: the writing client and the
|
|
355
|
+
// resolving client agree with no server-side arbiter between them, so a second
|
|
356
|
+
// description of "where does this anchor land" mis-places comments with nothing
|
|
357
|
+
// anywhere throwing. `resolveAnchorFromText` is total, pure and text-only — the
|
|
358
|
+
// Yjs relative-position rung stays in consumers, which compose it on top.
|
|
359
|
+
export {
|
|
360
|
+
contextAfter,
|
|
361
|
+
contextBefore,
|
|
362
|
+
contextsMatchAt,
|
|
363
|
+
findSoleOccurrence,
|
|
364
|
+
resolveAnchorFromText,
|
|
365
|
+
} from "./comments/index";
|
|
366
|
+
|
|
367
|
+
export type { AnchorResolution, Occurrence } from "./comments/index";
|
|
368
|
+
|
|
369
|
+
// The two questions asked BEFORE the body is written (ADR-CONTRACTS-127).
|
|
370
|
+
// `anchorStillReads` is a SECOND assertion, independent of the ladder — the
|
|
371
|
+
// applier must not trust the finder — and `plannedEdit` derives the mutation
|
|
372
|
+
// from the canonical payload rather than a caller's restatement of it. Both are
|
|
373
|
+
// total functions of their arguments, which is exactly what makes them liftable
|
|
374
|
+
// out of a browser applier: no Y.Text, no clock, no lease.
|
|
375
|
+
export { anchorStillReads, plannedEdit } from "./comments/index";
|
|
376
|
+
|
|
377
|
+
export type { PlannedEdit } from "./comments/index";
|
|
378
|
+
|
|
379
|
+
// The CONSTRUCTION half of the same contract (ADR-CONTRACTS-127). Publishing
|
|
380
|
+
// anchor → text while leaving text → anchor browser-only would be half an
|
|
381
|
+
// extraction: the side that COMPOSES an anchor decides how much context to
|
|
382
|
+
// capture and what counts as a quote, and a second description of that is the
|
|
383
|
+
// same silent-drift hazard the resolver was published to end. Both constructors
|
|
384
|
+
// validate through `CommentAnchorSchema` before returning and refuse — `null` —
|
|
385
|
+
// rather than truncate, because an anchor the route boundary rejects is a
|
|
386
|
+
// comment lost after it was composed. The relative-position pair is NOT
|
|
387
|
+
// produced here; a consumer holding a `Y.Text` merges it onto the result.
|
|
388
|
+
export {
|
|
389
|
+
createTextAnchorFromRange,
|
|
390
|
+
createTextInsertionAnchorAt,
|
|
391
|
+
} from "./comments/index";
|
|
392
|
+
|
|
393
|
+
export type { TextRange } from "./comments/index";
|
|
394
|
+
|
|
395
|
+
// The application receipt — the durable proof that an accepted suggestion's
|
|
396
|
+
// edit ALREADY LANDED IN THE BODY (ADR-CONTRACTS-127). It travels in the same
|
|
397
|
+
// CRDT transaction as the edit, so either both survived or neither did, which
|
|
398
|
+
// is what closes the window between the write and the acknowledgement. The MAP
|
|
399
|
+
// KEY is the load-bearing part: a receipt written under any other name lands in
|
|
400
|
+
// a map nobody reads while the reader watches a map nobody writes, and nothing
|
|
401
|
+
// anywhere throws — the same no-arbiter hazard as the anchor, now that a second
|
|
402
|
+
// implementation is about to write receipts too. Published with a PARSER,
|
|
403
|
+
// because these values arrive from a peer through a CRDT that has no schema of
|
|
404
|
+
// its own: a row that is not three well-typed fields is dropped, never
|
|
405
|
+
// surfaced. The receipt lives BESIDE the body and must never reach the markdown
|
|
406
|
+
// source, an export, or the content hash.
|
|
407
|
+
export {
|
|
408
|
+
SUGGESTION_RECEIPTS_MAP,
|
|
409
|
+
SuggestionReceiptSchema,
|
|
410
|
+
readSuggestionReceipt,
|
|
411
|
+
} from "./comments/index";
|
|
412
|
+
|
|
413
|
+
export type { SuggestionReceipt } from "./comments/index";
|
|
414
|
+
|
|
342
415
|
export {
|
|
343
416
|
CommentAnchorSchema,
|
|
344
417
|
CommentAnchorTypeSchema,
|
|
@@ -121,6 +121,9 @@ describe("CONFIRMATION_LABELS", () => {
|
|
|
121
121
|
"system.cleanup": "Cleanup Connections",
|
|
122
122
|
"member.changeManager": "Change Reporting Manager",
|
|
123
123
|
"companyMd.ingest": "Ingest Company Knowledge",
|
|
124
|
+
"companyMd.commentPass": "Apply Comment Pass",
|
|
125
|
+
"semantic.transform": "Apply Reporting Transformation",
|
|
126
|
+
"companyMd.importContextDoc": "Import Context Document",
|
|
124
127
|
});
|
|
125
128
|
});
|
|
126
129
|
});
|
|
@@ -46,6 +46,9 @@ export const CONFIRMATION_LABELS: Record<ExecutionKind, string> = {
|
|
|
46
46
|
"system.cleanup": "Cleanup Connections",
|
|
47
47
|
"member.changeManager": "Change Reporting Manager",
|
|
48
48
|
"companyMd.ingest": "Ingest Company Knowledge",
|
|
49
|
+
"companyMd.commentPass": "Apply Comment Pass",
|
|
50
|
+
"semantic.transform": "Apply Reporting Transformation",
|
|
51
|
+
"companyMd.importContextDoc": "Import Context Document",
|
|
49
52
|
};
|
|
50
53
|
|
|
51
54
|
/**
|