@cueloop/schema 0.1.0-alpha.9 → 0.1.0-alpha.90
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 +17 -17
- package/src/anchor.test.ts +340 -40
- package/src/anchor.ts +378 -43
- package/src/diff.test.ts +42 -25
- package/src/diff.ts +112 -77
- package/src/feedback.test.ts +318 -41
- package/src/feedback.ts +224 -54
- package/src/fuzzy.test.ts +110 -0
- package/src/fuzzy.ts +132 -0
- package/src/herdr.test.ts +50 -0
- package/src/herdr.ts +54 -0
- package/src/history.test.ts +401 -0
- package/src/history.ts +425 -0
- package/src/index.ts +9 -0
- package/src/inline.test.ts +195 -0
- package/src/inline.ts +240 -0
- package/src/markdown.test.ts +138 -22
- package/src/markdown.ts +333 -84
- package/src/participants.test.ts +105 -0
- package/src/participants.ts +51 -0
- package/src/path-view.test.ts +206 -0
- package/src/path-view.ts +90 -0
- package/src/share-access.test.ts +20 -0
- package/src/share-access.ts +13 -0
- package/src/share-links.test.ts +63 -0
- package/src/share-links.ts +29 -0
- package/src/thread-surface.test.ts +6 -0
- package/src/thread-surface.ts +6 -0
- package/src/types.test.ts +58 -5
- package/src/types.ts +341 -24
- package/src/working-copy.test.ts +209 -24
- package/src/working-copy.ts +148 -12
package/src/types.ts
CHANGED
|
@@ -1,38 +1,140 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* The Thread primitive. Everything in cueloop renders, annotates, or
|
|
3
|
+
* extends this one noun. This module is pure data shapes - no IO, no
|
|
4
|
+
* dependencies beyond the history shapes.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import type { SessionHistory } from "./history";
|
|
8
|
+
|
|
7
9
|
export const SCHEMA_VERSION = "1";
|
|
8
10
|
|
|
9
|
-
/** A workspace is a repo/branch context holding
|
|
11
|
+
/** A workspace is a repo/branch context holding threads. */
|
|
10
12
|
export interface WorkspaceKey {
|
|
11
13
|
repoRoot: string;
|
|
12
14
|
branch: string;
|
|
15
|
+
/** Earliest root commit SHA; the project key that survives moving or re-cloning the repo. Absent for a standalone thread. */
|
|
16
|
+
rootCommit?: string;
|
|
17
|
+
/** Origin remote URL when present; for display and repair only, never the project key. */
|
|
18
|
+
remote?: string;
|
|
13
19
|
}
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
/**
|
|
22
|
+
* What kind of artifact a thread holds. `plan` and `reply` are both
|
|
23
|
+
* markdown documents (see isMarkdownArtifact) - a plan is a proposal written
|
|
24
|
+
* forward, a reply is the agent's previous message pulled back for review.
|
|
25
|
+
* `diff` is a unified-diff patch; `prototype` is a component design doc (API /
|
|
26
|
+
* Composition / Callstack) in markdown, with an opt-in experimental pixel mode.
|
|
27
|
+
*
|
|
28
|
+
* One runtime union: every consumer that names the supported set - daemon
|
|
29
|
+
* wire validation, CLI flag parsing, adapter tool schemas - derives from this
|
|
30
|
+
* constant, so a new primitive extends them all without another hardcoded list.
|
|
31
|
+
*/
|
|
32
|
+
export const ARTIFACT_TYPES = ["plan", "diff", "prototype", "reply"] as const;
|
|
33
|
+
|
|
34
|
+
export type ArtifactType = (typeof ARTIFACT_TYPES)[number];
|
|
35
|
+
|
|
36
|
+
/** Harness workflows; review and refine are compositions, never artifact types. */
|
|
37
|
+
export const WORKFLOW_KINDS = ["plan", "reply", "prototype", "diff", "review", "refine"] as const;
|
|
38
|
+
|
|
39
|
+
export type WorkflowKind = (typeof WORKFLOW_KINDS)[number];
|
|
40
|
+
|
|
41
|
+
/** Trust-boundary guard: is this string one of the artifact primitives? */
|
|
42
|
+
export function isArtifactType(value: string): value is ArtifactType {
|
|
43
|
+
return ARTIFACT_TYPES.some((candidate) => candidate === value);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Markdown artifacts (plan, reply, prototype) are block-parsed and quote-anchored,
|
|
48
|
+
* so they share the plan render path, first-heading title derivation, and revision
|
|
49
|
+
* drift-assist. A prototype is a component design doc (API / Composition / Callstack)
|
|
50
|
+
* by default; its opt-in experimental pixel mode is a client render override, not a
|
|
51
|
+
* different artifact. A diff (a patch) does not - keep this the one place that names
|
|
52
|
+
* the set, so a new markdown primitive joins here once.
|
|
53
|
+
*/
|
|
54
|
+
export function isMarkdownArtifact(type: ArtifactType): boolean {
|
|
55
|
+
return type === "plan" || type === "reply" || type === "prototype";
|
|
56
|
+
}
|
|
16
57
|
|
|
17
58
|
export interface ArtifactMeta {
|
|
59
|
+
/** The workflow that submitted this artifact, distinct from its artifact type. */
|
|
60
|
+
workflow?: WorkflowKind;
|
|
18
61
|
cwd?: string;
|
|
62
|
+
/** Diff source selected when the Thread was created; an older Thread without this field uses Git. */
|
|
63
|
+
vcs?: string;
|
|
64
|
+
/** Logical change identity when the VCS keeps one through rewrites. */
|
|
65
|
+
vcsChangeId?: string;
|
|
66
|
+
/** Exact source revision captured for this diff. */
|
|
67
|
+
vcsRevisionId?: string;
|
|
19
68
|
agent?: string;
|
|
20
69
|
/** Agent-native session id, for resume/fork context. */
|
|
21
70
|
agentSessionId?: string;
|
|
22
|
-
/** Path to the plan file on disk, so feedback can reference it. */
|
|
71
|
+
/** Path to the plan or reply markdown file on disk, so feedback can reference it. */
|
|
23
72
|
planPath?: string;
|
|
24
|
-
/**
|
|
73
|
+
/** Path to the prototype's entry HTML file on disk. */
|
|
74
|
+
prototypePath?: string;
|
|
75
|
+
/** Pull request reference the diff came from, so the message can be posted back. */
|
|
25
76
|
pr?: string;
|
|
77
|
+
/** Markdown shown in the Thread pane beside a pull request diff. */
|
|
78
|
+
prBrief?: string;
|
|
79
|
+
/** Exact pull request commits captured by this review. */
|
|
80
|
+
prBaseSha?: string;
|
|
81
|
+
prHeadSha?: string;
|
|
82
|
+
/** Newer remote commits detected by the poller; the reviewer chooses when to refresh. */
|
|
83
|
+
prRefreshBaseSha?: string;
|
|
84
|
+
prRefreshHeadSha?: string;
|
|
85
|
+
/** Canonical GitHub pull request URL. */
|
|
86
|
+
prUrl?: string;
|
|
26
87
|
/** herdr pane the submitting agent runs in - the review returns focus there. */
|
|
27
88
|
herdrPane?: string;
|
|
28
89
|
title?: string;
|
|
90
|
+
/** A self-initiated per-repo workbench thread (a bare launch's first comment), not an agent submission. */
|
|
91
|
+
workbench?: boolean;
|
|
92
|
+
/** A frozen point-in-time capture of a workbench thread's diff, for a remote reviewer who has no working tree. */
|
|
93
|
+
snapshot?: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** VCS provenance for a submitted diff revision. */
|
|
97
|
+
export interface DiffSource {
|
|
98
|
+
vcs: string;
|
|
99
|
+
changeId?: string;
|
|
100
|
+
revisionId?: string;
|
|
101
|
+
baseRevisionId?: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Full old/new contents of one changed file, keyed by its repo-relative path. */
|
|
105
|
+
/** How a file changed, so curation emits the right create/delete headers. */
|
|
106
|
+
export type DiffFileStatus = "added" | "modified" | "deleted";
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* One reject decision of a diff review: a whole hunk, or one change block of
|
|
110
|
+
* it when `changeIndex` is set. The daemon curates the working copy from the
|
|
111
|
+
* full set, so every client sees the same patch.
|
|
112
|
+
*/
|
|
113
|
+
export interface HunkRejection {
|
|
114
|
+
path: string;
|
|
115
|
+
hunkIndex: number;
|
|
116
|
+
changeIndex?: number;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface DiffFileContents {
|
|
120
|
+
path: string;
|
|
121
|
+
oldContents: string;
|
|
122
|
+
newContents: string;
|
|
123
|
+
/** git's own classification - not inferred from empty contents, so an
|
|
124
|
+
* existing-empty-file edit is a modify, not a create/delete. */
|
|
125
|
+
status: DiffFileStatus;
|
|
29
126
|
}
|
|
30
127
|
|
|
31
128
|
export interface Artifact {
|
|
32
129
|
type: ArtifactType;
|
|
33
|
-
/** Markdown source for plans; unified-diff text for diffs. */
|
|
130
|
+
/** Markdown source for plans and replies; unified-diff text for diffs. */
|
|
34
131
|
content: string;
|
|
35
132
|
meta: ArtifactMeta;
|
|
133
|
+
/**
|
|
134
|
+
* Full file contents for a diff artifact, so hunk curation produces an
|
|
135
|
+
* exactly applyable patch; absent for legacy or partial (PR) diffs.
|
|
136
|
+
*/
|
|
137
|
+
files?: DiffFileContents[];
|
|
36
138
|
}
|
|
37
139
|
|
|
38
140
|
/**
|
|
@@ -44,46 +146,212 @@ export interface Anchor {
|
|
|
44
146
|
quote: string;
|
|
45
147
|
prefix: string;
|
|
46
148
|
suffix: string;
|
|
47
|
-
/** Index of the block the anchor
|
|
149
|
+
/** Index of the block the anchor starts in (hint). */
|
|
48
150
|
blockIndex?: number;
|
|
49
|
-
/**
|
|
151
|
+
/** Last block of a quote that spans blocks (hint); absent for one block. */
|
|
152
|
+
endBlockIndex?: number;
|
|
153
|
+
/** Character offsets: `start` within the first block, `end` within the last (hint). */
|
|
50
154
|
start?: number;
|
|
51
155
|
end?: number;
|
|
156
|
+
/** Prototype anchors: the CSS selector of the annotated element (authority). */
|
|
157
|
+
selector?: string;
|
|
52
158
|
}
|
|
53
159
|
|
|
54
|
-
/** The annotation kind set is open
|
|
55
|
-
export type AnnotationKind = "comment" |
|
|
160
|
+
/** The annotation kind set is open; these are the built-ins. */
|
|
161
|
+
export type AnnotationKind = "comment" | (string & {});
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* The surface an annotation was made on. Name-only: the ref names the surface and the
|
|
165
|
+
* client loads that surface's text to resolve the quote anchor. Absent means the session's
|
|
166
|
+
* reviewed artifact, so every existing annotation keeps its meaning with no data change.
|
|
167
|
+
* A `file` target's `rev` doubles as the diff side: worktree for an added or context row,
|
|
168
|
+
* head for a deletion.
|
|
169
|
+
*/
|
|
170
|
+
export type AnnotationTarget =
|
|
171
|
+
| { kind: "artifact" }
|
|
172
|
+
| { kind: "file"; path: string; rev: "worktree" | "head" }
|
|
173
|
+
| { kind: "welcome" };
|
|
174
|
+
|
|
175
|
+
/** The target an annotation resolves against; absent records mean the reviewed artifact. */
|
|
176
|
+
export function annotationTarget(annotation: Pick<Annotation, "target">): AnnotationTarget {
|
|
177
|
+
return annotation.target ?? { kind: "artifact" };
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Agent-authored context, not reviewer feedback: the guided walk's per-file
|
|
182
|
+
* notes (kind "note", anchored by the file path). Excluded from the feedback
|
|
183
|
+
* document and the reviewer's pending counts - an agent must never receive
|
|
184
|
+
* its own notes back as items to address.
|
|
185
|
+
*/
|
|
186
|
+
export function isAgentNote(annotation: Pick<Annotation, "kind">): boolean {
|
|
187
|
+
return annotation.kind === "note";
|
|
188
|
+
}
|
|
56
189
|
|
|
57
190
|
export interface Annotation {
|
|
58
191
|
id: string;
|
|
59
192
|
kind: AnnotationKind;
|
|
60
193
|
anchor: Anchor;
|
|
61
|
-
/**
|
|
194
|
+
/** The surface this note was made on; absent means the session's reviewed artifact. */
|
|
195
|
+
target?: AnnotationTarget;
|
|
196
|
+
/** Comment body. */
|
|
62
197
|
body: string;
|
|
63
198
|
/** Set by resolution when the quote can no longer be found. */
|
|
64
199
|
orphan?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* SSH key fingerprint of a share collaborator who authored this note. Absent
|
|
202
|
+
* on the planner's own annotations; the sharing gateway stamps it so the
|
|
203
|
+
* planner can tell whose note is whose and never overwrite a collaborator's.
|
|
204
|
+
*/
|
|
205
|
+
author?: string;
|
|
206
|
+
/** GitHub line anchor and presentation fields for an agent-authored PR review comment. */
|
|
207
|
+
reviewComment?: ReviewComment;
|
|
208
|
+
/**
|
|
209
|
+
* The root comment this one replies to. Absent on a root. A reply shares its
|
|
210
|
+
* root's anchor, so a discussion stays one conversation when the text moves.
|
|
211
|
+
*/
|
|
212
|
+
replyTo?: string;
|
|
213
|
+
/**
|
|
214
|
+
* Set when a revision addressed this annotation: the agent reported the id
|
|
215
|
+
* on resubmit ("agent"), or the quoted text disappeared from the revised
|
|
216
|
+
* plan ("drift"). Addressed annotations leave the default rail view and the
|
|
217
|
+
* next feedback document, but are never deleted.
|
|
218
|
+
*/
|
|
219
|
+
resolution?: AnnotationResolution;
|
|
65
220
|
createdAt: string;
|
|
66
221
|
}
|
|
67
222
|
|
|
68
|
-
export
|
|
223
|
+
export const REVIEW_SEVERITIES = ["p0", "p1", "p2"] as const;
|
|
224
|
+
export type ReviewSeverity = (typeof REVIEW_SEVERITIES)[number];
|
|
225
|
+
|
|
226
|
+
/** Data needed to render and publish one agent-authored pull request comment. */
|
|
227
|
+
export interface ReviewComment {
|
|
228
|
+
severity: ReviewSeverity;
|
|
229
|
+
title: string;
|
|
230
|
+
path: string;
|
|
231
|
+
line: number;
|
|
232
|
+
startLine?: number;
|
|
233
|
+
/** Quote-primary anchor for the first line of a multiline finding. */
|
|
234
|
+
startAnchor?: Anchor;
|
|
235
|
+
side: "LEFT" | "RIGHT";
|
|
236
|
+
suggestion?: string;
|
|
237
|
+
prompt?: string;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export interface AnnotationResolution {
|
|
241
|
+
/** The revision number whose submission addressed this annotation. */
|
|
242
|
+
revision: number;
|
|
243
|
+
source: "agent" | "drift";
|
|
244
|
+
}
|
|
69
245
|
|
|
70
|
-
|
|
71
|
-
|
|
246
|
+
/** An annotation a revision has addressed; it leaves the default views. */
|
|
247
|
+
export function isAddressed(annotation: Annotation): boolean {
|
|
248
|
+
return annotation.resolution !== undefined;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** A harness session bound to a Thread. Harness identity stays outside the Thread itself. */
|
|
252
|
+
export interface HarnessBinding {
|
|
253
|
+
id: string;
|
|
254
|
+
threadId: string;
|
|
255
|
+
harness: string;
|
|
256
|
+
harnessSessionId: string;
|
|
257
|
+
createdAt: string;
|
|
258
|
+
/** Approval whose one unchanged plan resubmission this harness has consumed. */
|
|
259
|
+
approvedRetryMessageId?: string;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** Durable routing state for one Message sent to one harness binding. */
|
|
263
|
+
export interface Delivery {
|
|
264
|
+
id: string;
|
|
265
|
+
messageId: string;
|
|
266
|
+
bindingId: string;
|
|
267
|
+
status: "pending" | "acknowledged";
|
|
268
|
+
createdAt: string;
|
|
269
|
+
acknowledgedAt?: string;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** What a harness adapter pulls: routing state plus its immutable Message payload. */
|
|
273
|
+
export interface PendingDelivery {
|
|
274
|
+
delivery: Delivery;
|
|
275
|
+
message: Message;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export const MESSAGE_OUTCOMES = ["comment", "approved", "changes_requested"] as const;
|
|
279
|
+
export type MessageOutcome = (typeof MESSAGE_OUTCOMES)[number];
|
|
280
|
+
|
|
281
|
+
export interface Message {
|
|
282
|
+
/** Stable identity used to deduplicate at-least-once harness delivery. */
|
|
283
|
+
id: string;
|
|
284
|
+
outcome: MessageOutcome;
|
|
72
285
|
summary: string;
|
|
73
|
-
/** The
|
|
74
|
-
|
|
75
|
-
|
|
286
|
+
/** The structured review document sent to the harness. */
|
|
287
|
+
body: string;
|
|
288
|
+
/** Annotation snapshots included in this delivery, for incremental sends. */
|
|
289
|
+
annotations?: Annotation[];
|
|
290
|
+
sentAt: string;
|
|
76
291
|
}
|
|
77
292
|
|
|
78
293
|
export interface Revision {
|
|
79
294
|
revision: number;
|
|
80
295
|
content: string;
|
|
81
296
|
submittedAt: string;
|
|
297
|
+
/** Exact VCS source for this reviewed text, when one was captured. */
|
|
298
|
+
source?: DiffSource;
|
|
299
|
+
/** File contents captured with this diff revision, retained across refreshes. */
|
|
300
|
+
files?: DiffFileContents[];
|
|
82
301
|
}
|
|
83
302
|
|
|
84
303
|
export type SessionStatus = "pending" | "resolved";
|
|
85
304
|
|
|
86
|
-
|
|
305
|
+
/**
|
|
306
|
+
* A person who authored annotations on a session. `id` is the stable key an
|
|
307
|
+
* annotation's `author` points at - the SSH fingerprint today, an OAuth id
|
|
308
|
+
* ("github:…") later. Provider-agnostic so those identities slot in unchanged.
|
|
309
|
+
*/
|
|
310
|
+
export interface Identity {
|
|
311
|
+
/** Stable identity key; equals an annotation's `author`. */
|
|
312
|
+
id: string;
|
|
313
|
+
/** Identity source: the SSH key that authored, or a verified GitHub login. */
|
|
314
|
+
provider: "ssh" | "github";
|
|
315
|
+
/** Display name; absent = the collaborator stayed anonymous. */
|
|
316
|
+
name?: string;
|
|
317
|
+
/** Provider handle: a github login, an email, or a short fingerprint. */
|
|
318
|
+
handle?: string;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** Owner-set access control for a private share: only these GitHub logins may open it. Absent = a public share. */
|
|
322
|
+
export interface ShareAccess {
|
|
323
|
+
githubLogins: string[];
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* One published share link for a thread. A thread can have several, each an
|
|
328
|
+
* independent gateway blob keyed by its own `id`. `name` is a local-only label
|
|
329
|
+
* to tell links apart; `requireAuth` gates the link behind the `allowlist` of
|
|
330
|
+
* GitHub logins (empty + requireAuth is a private link with no one added yet).
|
|
331
|
+
*/
|
|
332
|
+
export interface ShareLink {
|
|
333
|
+
/** The share id (`p_…`), the link's address and gateway blob key. */
|
|
334
|
+
id: string;
|
|
335
|
+
/** A local, cosmetic label for the list; never leaves the planner's machine. */
|
|
336
|
+
name?: string;
|
|
337
|
+
/** True = private (only `allowlist` may open it); false = public. */
|
|
338
|
+
requireAuth: boolean;
|
|
339
|
+
/** GitHub logins allowed when `requireAuth`; ignored when public. */
|
|
340
|
+
allowlist: string[];
|
|
341
|
+
/** SSH fingerprint that created the link; the gateway stamps it to gate pulls/pushes/revokes. */
|
|
342
|
+
owner?: string;
|
|
343
|
+
/** The branch this link follows and shows collaborators; `main` when absent. */
|
|
344
|
+
shareBranch?: string;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/** One exact character range removed from the submitted artifact source. */
|
|
348
|
+
export interface TextCut {
|
|
349
|
+
start: number;
|
|
350
|
+
end: number;
|
|
351
|
+
quote: string;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export interface Thread {
|
|
87
355
|
schemaVersion: string;
|
|
88
356
|
id: string;
|
|
89
357
|
workspace: WorkspaceKey;
|
|
@@ -91,20 +359,68 @@ export interface ReviewSession {
|
|
|
91
359
|
/** Revision history; artifact.content always equals the latest revision. */
|
|
92
360
|
revisions: Revision[];
|
|
93
361
|
annotations: Annotation[];
|
|
362
|
+
/**
|
|
363
|
+
* The session's history as a tree of entries with named branches; the
|
|
364
|
+
* artifact text and the open comments derive from the active path. Absent
|
|
365
|
+
* only on records written before histories existed; the store migrates
|
|
366
|
+
* those on read.
|
|
367
|
+
*/
|
|
368
|
+
history?: SessionHistory;
|
|
369
|
+
/** A diff review's reject decisions; the working copy is the patch they leave. */
|
|
370
|
+
curation?: HunkRejection[];
|
|
94
371
|
/**
|
|
95
372
|
* The reviewer's working copy of the artifact source (plan edits).
|
|
96
373
|
* Serializes as ONE unified diff against the submitted revision.
|
|
97
374
|
* Undefined = no direct edits.
|
|
98
375
|
*/
|
|
99
376
|
workingCopy?: string;
|
|
100
|
-
|
|
377
|
+
/** Exact source ranges behind character Cuts in the current working copy. */
|
|
378
|
+
textCuts?: TextCut[];
|
|
379
|
+
/**
|
|
380
|
+
* File paths the reviewer marked viewed during the guided walk (diff
|
|
381
|
+
* sessions). Persisting with the session means a resumed review keeps its
|
|
382
|
+
* progress. Undefined = the walk never started.
|
|
383
|
+
*/
|
|
384
|
+
viewedPaths?: string[];
|
|
385
|
+
message: Message | null;
|
|
101
386
|
status: SessionStatus;
|
|
102
387
|
createdAt: string;
|
|
388
|
+
/**
|
|
389
|
+
* Comments off the active path - removed, or made on a segment a tip moved
|
|
390
|
+
* away from. Nothing is deleted: a navigate or switch that brings their
|
|
391
|
+
* entries back onto the path shows them again.
|
|
392
|
+
*/
|
|
393
|
+
shelvedAnnotations?: Annotation[];
|
|
394
|
+
/** The session this one was forked from. */
|
|
395
|
+
parentSessionId?: string;
|
|
396
|
+
/** Published share links for this thread; each is an independent gateway blob. Migrated from the legacy scalar fields on read. */
|
|
397
|
+
shares?: ShareLink[];
|
|
398
|
+
/** @deprecated Legacy single-share id; migrated into `shares` on read. */
|
|
399
|
+
shareId?: string;
|
|
400
|
+
/** @deprecated Legacy single-share branch; migrated into `shares` on read. */
|
|
401
|
+
shareBranch?: string;
|
|
402
|
+
/** @deprecated Legacy single-share owner fingerprint; migrated into `shares` on read. */
|
|
403
|
+
owner?: string;
|
|
404
|
+
/** @deprecated Legacy single-share allowlist; migrated into `shares` on read. */
|
|
405
|
+
access?: ShareAccess;
|
|
406
|
+
/**
|
|
407
|
+
* Identities that authored annotations here, keyed by id (union-by-id, like
|
|
408
|
+
* annotations). The gateway records a collaborator's identity and chosen name;
|
|
409
|
+
* the rail resolves an annotation's `author` against this registry.
|
|
410
|
+
*/
|
|
411
|
+
participants?: Identity[];
|
|
103
412
|
}
|
|
104
413
|
|
|
105
|
-
/**
|
|
106
|
-
export function
|
|
107
|
-
return
|
|
414
|
+
/** Whether a Message releases a harness gate. */
|
|
415
|
+
export function messageAllows(outcome: MessageOutcome): boolean {
|
|
416
|
+
return outcome === "approved";
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
let messageSeq = 0;
|
|
420
|
+
|
|
421
|
+
/** A process-unique, time-sortable Message id for delivery deduplication. */
|
|
422
|
+
export function newMessageId(): string {
|
|
423
|
+
return `msg_${Date.now().toString(36)}${(messageSeq++).toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
108
424
|
}
|
|
109
425
|
|
|
110
426
|
/**
|
|
@@ -113,6 +429,7 @@ export function verdictAllows(kind: VerdictKind): boolean {
|
|
|
113
429
|
* annotators in different processes on the same millisecond.
|
|
114
430
|
*/
|
|
115
431
|
let annotationSeq = 0;
|
|
432
|
+
|
|
116
433
|
export function newAnnotationId(): string {
|
|
117
434
|
return `a_${Date.now().toString(36)}${(annotationSeq++).toString(36)}_${Math.random().toString(36).slice(2, 6)}`;
|
|
118
435
|
}
|