@mostra/runtime 0.11.0 → 0.12.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/dist/bin.js +152 -32
- package/dist/bin.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{instance-DCiUHvgZ.js → instance-CBUlOmzG.js} +1215 -43
- package/dist/instance-CBUlOmzG.js.map +1 -0
- package/dist/reference/cli.md +112 -2
- package/dist/reference/diagnostics.json +27 -0
- package/dist/reference/errors/MOSTRA_TEAM_PRESENCE_RATE_LIMITED.md +23 -0
- package/dist/reference/errors/MOSTRA_TEAM_ROSTER_POLICY.md +23 -0
- package/dist/reference/errors/MOSTRA_TEAM_ROSTER_TOO_LARGE.md +23 -0
- package/dist/skill/SKILL.md +5 -3
- package/dist/skill/references/answers.md +3 -1
- package/dist/skill/references/mcp.md +2 -2
- package/dist/skill/references/teams.md +78 -0
- package/package.json +6 -6
- package/src/gateway/browser.ts +84 -1
- package/src/gateway/index.ts +40 -1
- package/src/gateway/team.ts +181 -0
- package/src/instance/index.ts +2 -1
- package/src/interaction/ephemeral.ts +21 -0
- package/src/interaction/events.ts +17 -0
- package/src/interaction/index.ts +265 -20
- package/src/interaction/roster.ts +585 -0
- package/src/interaction/team.ts +426 -0
- package/src/interaction/wait.ts +150 -0
- package/src/ledger/migrations.ts +35 -0
- package/src/link/hosted.ts +14 -3
- package/src/link/manager.ts +31 -1
- package/src/server/directory.ts +22 -0
- package/src/server/feed.ts +89 -3
- package/src/server/hosted.ts +54 -22
- package/src/server/index.ts +10 -0
- package/src/server/operator.ts +87 -28
- package/src/share/index.ts +50 -2
- package/src/verify/index.ts +7 -0
- package/src/verify/runner.ts +5 -1
- package/dist/instance-DCiUHvgZ.js.map +0 -1
package/src/gateway/index.ts
CHANGED
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
import type { Actions } from "../actions/index.ts";
|
|
64
64
|
import { type Addressing, type FrameMode, hostOf } from "../addressing/index.ts";
|
|
65
65
|
import { runtimeRoot } from "../deps/index.ts";
|
|
66
|
-
import type
|
|
66
|
+
import { createTeamTraffic, type EphemeralBus, type Interaction } from "../interaction/index.ts";
|
|
67
67
|
import {
|
|
68
68
|
type Ledger,
|
|
69
69
|
type LedgerDb,
|
|
@@ -103,6 +103,7 @@ export { resetOnClose } from "./listener.ts";
|
|
|
103
103
|
|
|
104
104
|
import { type ListenerChecks, mount, type RouteContext, type RouteSpec, refuse } from "./routes.ts";
|
|
105
105
|
import { fileResponse, findFile } from "./serve.ts";
|
|
106
|
+
import { rosterMethods } from "./team.ts";
|
|
106
107
|
import { BOOTSTRAP_PAGE, SERVICE_WORKER_PATH, SERVICE_WORKER_SOURCE } from "./worker.ts";
|
|
107
108
|
|
|
108
109
|
export { Capabilities, capabilityKey } from "./capabilities.ts";
|
|
@@ -227,6 +228,12 @@ export interface GatewayOptions {
|
|
|
227
228
|
readonly live?: Pick<Live, "read">;
|
|
228
229
|
/** Run and live updates for page streams and polls (WP-08). */
|
|
229
230
|
readonly bus?: EphemeralBus;
|
|
231
|
+
/**
|
|
232
|
+
* Asks whether `count` new links may be minted for an artifact, throwing to refuse: a remote
|
|
233
|
+
* server's operator `limits` (`link`, D165 item 9). `roster/add` asks it for exactly the
|
|
234
|
+
* personal links it will mint (Opus review 10).
|
|
235
|
+
*/
|
|
236
|
+
readonly linkLimit?: (artifactId: string, count: number) => Promise<void>;
|
|
230
237
|
/** Whether a version's worker is parked (WP-08): its frame ticket tells the shell. */
|
|
231
238
|
readonly parked?: (versionId: string) => boolean;
|
|
232
239
|
/**
|
|
@@ -495,6 +502,21 @@ function laterArtifactRoutes(
|
|
|
495
502
|
auth: "session",
|
|
496
503
|
...(acting ? { handler: acting.live } : {}),
|
|
497
504
|
},
|
|
505
|
+
// WP-31: the roster as the page may see it, and presence; every link may (`view`, D168).
|
|
506
|
+
{
|
|
507
|
+
method: "POST",
|
|
508
|
+
path: "/_mostra/v/:rev/respondents",
|
|
509
|
+
intent: "mutation",
|
|
510
|
+
auth: "session",
|
|
511
|
+
handler: served.respondents,
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
method: "POST",
|
|
515
|
+
path: "/_mostra/v/:rev/presence",
|
|
516
|
+
intent: "mutation",
|
|
517
|
+
auth: "session",
|
|
518
|
+
handler: served.presence,
|
|
519
|
+
},
|
|
498
520
|
// WP-13: single-use tickets for streams, polls and WebSockets that bypass the worker (D70).
|
|
499
521
|
{
|
|
500
522
|
method: "POST",
|
|
@@ -533,7 +555,12 @@ interface FaceEntry {
|
|
|
533
555
|
/** Creates the gateway; nothing is bound until {@link Gateway.start}. */
|
|
534
556
|
export function createGateway(options: GatewayOptions): Gateway {
|
|
535
557
|
const { addressing, capabilities, artifacts, log, interaction } = options;
|
|
558
|
+
// Respondents and presence for pages (D168): in memory, over the pages' ephemeral bus.
|
|
559
|
+
const team = options.bus
|
|
560
|
+
? createTeamTraffic({ bus: options.bus, source: interaction, log })
|
|
561
|
+
: undefined;
|
|
536
562
|
const served = browserRoutes({
|
|
563
|
+
...(team ? { team } : {}),
|
|
537
564
|
interaction,
|
|
538
565
|
capabilities,
|
|
539
566
|
log,
|
|
@@ -2180,6 +2207,17 @@ export function createGateway(options: GatewayOptions): Gateway {
|
|
|
2180
2207
|
by: entry.spec.by,
|
|
2181
2208
|
})),
|
|
2182
2209
|
methods: () => [
|
|
2210
|
+
...rosterMethods({
|
|
2211
|
+
ledger: options.ledger,
|
|
2212
|
+
interaction,
|
|
2213
|
+
capabilities,
|
|
2214
|
+
artifacts,
|
|
2215
|
+
versionOf,
|
|
2216
|
+
linkBase,
|
|
2217
|
+
link,
|
|
2218
|
+
collected: (number) => new RpcError(collectedDiagnostic(number)),
|
|
2219
|
+
...(options.linkLimit ? { linkLimit: options.linkLimit } : {}),
|
|
2220
|
+
}),
|
|
2183
2221
|
handler(viewUrlMethod, async (params) => {
|
|
2184
2222
|
const detail = artifacts.get(params.artifact);
|
|
2185
2223
|
const version = versionOf(detail, params.version);
|
|
@@ -2286,6 +2324,7 @@ export function createGateway(options: GatewayOptions): Gateway {
|
|
|
2286
2324
|
]),
|
|
2287
2325
|
),
|
|
2288
2326
|
async close() {
|
|
2327
|
+
team?.close();
|
|
2289
2328
|
await Promise.allSettled([...opening.values(), ...openingFaces.values()]);
|
|
2290
2329
|
await Promise.all([
|
|
2291
2330
|
shellListener?.close(),
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The roster's host methods (D121, D168; CO-01, CO-03, CO-07): `roster/add` names expected
|
|
3
|
+
* respondents and gives each a personal link, `roster/remove` stops expecting them, `roster/get`
|
|
4
|
+
* reads everyone's status. They live with the gateway because a personal link is a capability
|
|
5
|
+
* link (D97): minted here, with the respondent's viewer (D104), in the same transaction as the
|
|
6
|
+
* roster's change. The roster itself, its rounds and its completion are the interaction core's.
|
|
7
|
+
*/
|
|
8
|
+
import {
|
|
9
|
+
type Actor,
|
|
10
|
+
ALL_SCOPES,
|
|
11
|
+
type ArtifactDetail,
|
|
12
|
+
type ArtifactRef,
|
|
13
|
+
type CapabilityLink,
|
|
14
|
+
createDiagnostic,
|
|
15
|
+
durationMs,
|
|
16
|
+
normalizeScopes,
|
|
17
|
+
type Roster,
|
|
18
|
+
RpcError,
|
|
19
|
+
rosterAddMethod,
|
|
20
|
+
rosterGetMethod,
|
|
21
|
+
rosterRemoveMethod,
|
|
22
|
+
} from "@mostra/protocol";
|
|
23
|
+
import type { Interaction } from "../interaction/index.ts";
|
|
24
|
+
import { type Ledger, recordedResult, recordResult, requestKey } from "../ledger/index.ts";
|
|
25
|
+
import { handler, type MethodHandler, type Session } from "../protocol-server/index.ts";
|
|
26
|
+
import type { Capabilities, MintedToken } from "./capabilities.ts";
|
|
27
|
+
|
|
28
|
+
/** What the roster methods need of the gateway. */
|
|
29
|
+
export interface RosterMethodsOptions {
|
|
30
|
+
readonly ledger: Ledger;
|
|
31
|
+
readonly interaction: Interaction;
|
|
32
|
+
readonly capabilities: Capabilities;
|
|
33
|
+
readonly artifacts: { get(ref: ArtifactRef): ArtifactDetail };
|
|
34
|
+
/** The version a request names, or the latest. */
|
|
35
|
+
readonly versionOf: (
|
|
36
|
+
detail: ArtifactDetail,
|
|
37
|
+
wanted: number | string | undefined,
|
|
38
|
+
) => { readonly id: string; readonly number: number; readonly collected?: string } | undefined;
|
|
39
|
+
/** Where the artifact's links point now (D97 item 10). */
|
|
40
|
+
readonly linkBase: (artifactId: string) => Promise<string>;
|
|
41
|
+
/** A minted token as a capability link. */
|
|
42
|
+
readonly link: (token: MintedToken) => CapabilityLink;
|
|
43
|
+
/** What a link refused for its collected version says. */
|
|
44
|
+
readonly collected: (number: number) => RpcError;
|
|
45
|
+
/** Asks whether `count` new links may be minted, throwing to refuse (an operator's `limits`). */
|
|
46
|
+
readonly linkLimit?: (artifactId: string, count: number) => Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Who changed the roster: the client that called. */
|
|
50
|
+
function actorOf(session: Session): Actor {
|
|
51
|
+
return { kind: "agent", ...(session.client ? { id: session.client.name } : {}) };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** The roster's host methods. */
|
|
55
|
+
export function rosterMethods(options: RosterMethodsOptions): MethodHandler[] {
|
|
56
|
+
const { ledger, interaction, capabilities } = options;
|
|
57
|
+
|
|
58
|
+
const live = (tokenId: string): boolean => capabilities.grant(tokenId)?.live === true;
|
|
59
|
+
const roster = (artifactId: string): Roster => interaction.roster(artifactId, live);
|
|
60
|
+
|
|
61
|
+
return [
|
|
62
|
+
handler(rosterAddMethod, async (params, session) => {
|
|
63
|
+
const detail = options.artifacts.get(params.artifact);
|
|
64
|
+
const version = options.versionOf(detail, params.version);
|
|
65
|
+
if (!version) {
|
|
66
|
+
throw new RpcError(
|
|
67
|
+
createDiagnostic("MOSTRA_ARTIFACT_VERSION_NOT_FOUND", {
|
|
68
|
+
message:
|
|
69
|
+
params.version === undefined
|
|
70
|
+
? `The artifact ${detail.id} has no published version.`
|
|
71
|
+
: `The artifact ${detail.id} has no version ${params.version}.`,
|
|
72
|
+
}),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
if (version.collected !== undefined) throw options.collected(version.number);
|
|
76
|
+
const base = await options.linkBase(detail.id);
|
|
77
|
+
const scopes = normalizeScopes(params.scopes ?? ALL_SCOPES).join(" ");
|
|
78
|
+
const pinned = params.version === undefined ? undefined : version.number;
|
|
79
|
+
/**
|
|
80
|
+
* Whether a respondent's link is the one this request would mint: it works here (D97 items
|
|
81
|
+
* 5, 10) with the same scopes, the same pinned version, and an expiry exactly when a `ttl` is
|
|
82
|
+
* asked for (Opus review 6). Otherwise the respondent gets a new link; the old one isn't
|
|
83
|
+
* revoked, since they may hold it already.
|
|
84
|
+
*/
|
|
85
|
+
const reusable = (tokenId: string): boolean => {
|
|
86
|
+
const grant = capabilities.grant(tokenId);
|
|
87
|
+
return (
|
|
88
|
+
grant?.live === true &&
|
|
89
|
+
grant.shellOrigin === base &&
|
|
90
|
+
normalizeScopes(grant.scopes).join(" ") === scopes &&
|
|
91
|
+
grant.pinnedVersion === pinned &&
|
|
92
|
+
(grant.expiresAt !== undefined) === (params.ttl !== undefined)
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
const key = requestKey("roster/add", params);
|
|
96
|
+
// An operator's limit counts the links this call will mint: respondents whose link is kept
|
|
97
|
+
// mint none, and a replay of a recorded call mints nothing (Opus review 10).
|
|
98
|
+
if (options.linkLimit) {
|
|
99
|
+
const replay =
|
|
100
|
+
key !== undefined && ledger.read((db) => recordedResult(db, key)) !== undefined;
|
|
101
|
+
if (!replay) {
|
|
102
|
+
const current = new Map(
|
|
103
|
+
interaction.roster(detail.id, live).respondents.map((one) => [one.ref, one.tokenId]),
|
|
104
|
+
);
|
|
105
|
+
let fresh = 0;
|
|
106
|
+
for (const ref of new Set(params.respondents.map((one) => one.ref))) {
|
|
107
|
+
const tokenId = current.get(ref);
|
|
108
|
+
if (tokenId === undefined || !reusable(tokenId)) fresh += 1;
|
|
109
|
+
}
|
|
110
|
+
if (fresh > 0) await options.linkLimit(detail.id, fresh);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const minted = new Map<string, MintedToken>();
|
|
114
|
+
const tokens = ledger.write((db) => {
|
|
115
|
+
if (key !== undefined) {
|
|
116
|
+
const row = recordedResult<{ tokens: { ref: string; tokenId: string }[] }>(db, key);
|
|
117
|
+
if (row) return row.tokens;
|
|
118
|
+
}
|
|
119
|
+
const added = interaction.addRespondents(db, {
|
|
120
|
+
artifactId: detail.id,
|
|
121
|
+
respondents: params.respondents,
|
|
122
|
+
actor: actorOf(session),
|
|
123
|
+
// A respondent keeps the personal link they have while it is the one this request would
|
|
124
|
+
// mint; a revoked, expired or moved one, or one of other scopes, version or expiry, is
|
|
125
|
+
// replaced by a new one for the same viewer.
|
|
126
|
+
link: (viewerId, current) => {
|
|
127
|
+
if (current !== undefined && reusable(current)) return current;
|
|
128
|
+
const token = capabilities.mint(
|
|
129
|
+
{
|
|
130
|
+
artifactId: detail.id,
|
|
131
|
+
scopes: params.scopes,
|
|
132
|
+
ttlMs: params.ttl === undefined ? undefined : durationMs(params.ttl),
|
|
133
|
+
pinnedVersion: pinned,
|
|
134
|
+
viewerId,
|
|
135
|
+
shellOrigin: base,
|
|
136
|
+
},
|
|
137
|
+
db,
|
|
138
|
+
);
|
|
139
|
+
minted.set(token.tokenId, token);
|
|
140
|
+
return token.tokenId;
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
const recorded = added.tokens.map((token) => ({ ref: token.ref, tokenId: token.tokenId }));
|
|
144
|
+
// Only token IDs are recorded: the ledger never holds a link's secret (D97 item 2).
|
|
145
|
+
if (key !== undefined) recordResult(db, key, { tokens: recorded });
|
|
146
|
+
return recorded;
|
|
147
|
+
});
|
|
148
|
+
const links = tokens.map(({ ref, tokenId }) => {
|
|
149
|
+
const token = minted.get(tokenId) ?? capabilities.reveal(tokenId);
|
|
150
|
+
if (!token) {
|
|
151
|
+
throw new RpcError(
|
|
152
|
+
createDiagnostic("MOSTRA_HYGIENE_TOKEN_REVOKED", {
|
|
153
|
+
message: `The personal link of ${ref} can't be shown again: the home's capability key changed. Add them again to give them a new one.`,
|
|
154
|
+
}),
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
return { ref, link: options.link(token) };
|
|
158
|
+
});
|
|
159
|
+
return { roster: roster(detail.id), links };
|
|
160
|
+
}),
|
|
161
|
+
handler(rosterRemoveMethod, (params, session) => {
|
|
162
|
+
const detail = options.artifacts.get(params.artifact);
|
|
163
|
+
const key = requestKey("roster/remove", params);
|
|
164
|
+
const removed = ledger.write((db) => {
|
|
165
|
+
if (key !== undefined) {
|
|
166
|
+
const row = recordedResult<{ removed: string[] }>(db, key);
|
|
167
|
+
if (row) return row.removed;
|
|
168
|
+
}
|
|
169
|
+
const outcome = interaction.removeRespondents(db, {
|
|
170
|
+
artifactId: detail.id,
|
|
171
|
+
refs: params.refs,
|
|
172
|
+
actor: actorOf(session),
|
|
173
|
+
});
|
|
174
|
+
if (key !== undefined) recordResult(db, key, { removed: outcome.removed });
|
|
175
|
+
return [...outcome.removed];
|
|
176
|
+
});
|
|
177
|
+
return { roster: roster(detail.id), removed };
|
|
178
|
+
}),
|
|
179
|
+
handler(rosterGetMethod, (params) => roster(options.artifacts.get(params.artifact).id)),
|
|
180
|
+
];
|
|
181
|
+
}
|
package/src/instance/index.ts
CHANGED
|
@@ -893,7 +893,8 @@ async function assemble(home: OwnedHome, options: StartInstanceOptions): Promise
|
|
|
893
893
|
dependenciesAdded: (artifact) => dev.dependenciesChanged(artifact),
|
|
894
894
|
}),
|
|
895
895
|
...dev.methods(),
|
|
896
|
-
|
|
896
|
+
// A hosted artifact's roster is its hosted home's, like its state (D165 item 1, D168).
|
|
897
|
+
...forwardHosted(link, (ref) => registry.get(canonicalRef(ref)).id, gateway.methods()),
|
|
897
898
|
...shares.methods(),
|
|
898
899
|
...link.methods(),
|
|
899
900
|
// A hosted artifact's state and live values act on its hosted home (D165 item 1).
|
|
@@ -46,6 +46,14 @@ function coalesceInto(
|
|
|
46
46
|
queue: EphemeralMessage[],
|
|
47
47
|
message: EphemeralMessage,
|
|
48
48
|
): void {
|
|
49
|
+
if (message.kind === "respondents" || message.kind === "presence") {
|
|
50
|
+
// A page's roster and presence are whole states: the newest replaces any still queued.
|
|
51
|
+
for (let index = queue.length - 1; index >= 0; index--) {
|
|
52
|
+
if ((queue[index] as EphemeralMessage).kind === message.kind) queue.splice(index, 1);
|
|
53
|
+
}
|
|
54
|
+
queue.push(message);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
49
57
|
if (message.kind === "live") {
|
|
50
58
|
const latestMode = view.live.get(message.live.key)?.window === undefined;
|
|
51
59
|
if (latestMode && message.live.value !== undefined) {
|
|
@@ -124,6 +132,15 @@ export interface EphemeralBus {
|
|
|
124
132
|
publishRun(artifactId: string, message: Extract<EphemeralMessage, { kind: "run" }>): void;
|
|
125
133
|
/** Sends a live update to every view reading the source. */
|
|
126
134
|
publishLive(artifactId: string, message: Extract<EphemeralMessage, { kind: "live" }>): void;
|
|
135
|
+
/**
|
|
136
|
+
* Sends one view its own roster or presence (D168), when it listens or polls now: each view's
|
|
137
|
+
* is its own, under the visibility policy.
|
|
138
|
+
*/
|
|
139
|
+
send(
|
|
140
|
+
artifactId: string,
|
|
141
|
+
viewId: string,
|
|
142
|
+
message: Extract<EphemeralMessage, { kind: "respondents" | "presence" }>,
|
|
143
|
+
): void;
|
|
127
144
|
/** Hears the view's messages as they come (an open event stream); returns the stop. */
|
|
128
145
|
listen(
|
|
129
146
|
artifactId: string,
|
|
@@ -256,6 +273,10 @@ export function createEphemeralBus(
|
|
|
256
273
|
if ((view.live.get(message.live.key)?.until ?? 0) > at) deliver(view, message);
|
|
257
274
|
}
|
|
258
275
|
},
|
|
276
|
+
send(artifactId, viewId, message) {
|
|
277
|
+
const view = views.get(viewId);
|
|
278
|
+
if (view && view.artifactId === artifactId) deliver(view, message);
|
|
279
|
+
},
|
|
259
280
|
listen(artifactId, viewId, listener) {
|
|
260
281
|
const view = viewOf(artifactId, viewId);
|
|
261
282
|
view.listeners.add(listener);
|
|
@@ -308,6 +308,11 @@ export interface CompactionSummary {
|
|
|
308
308
|
readonly number: unknown;
|
|
309
309
|
readonly cursor: number;
|
|
310
310
|
};
|
|
311
|
+
/**
|
|
312
|
+
* Where the roster stood at the range's end (D168): whether it was complete, and its latest
|
|
313
|
+
* completion, so `submitted:all` still reads it once its events are replaced.
|
|
314
|
+
*/
|
|
315
|
+
readonly roster?: { readonly complete: boolean; readonly completed?: EventRecord };
|
|
311
316
|
}
|
|
312
317
|
|
|
313
318
|
/**
|
|
@@ -335,6 +340,7 @@ export function compactEvents(
|
|
|
335
340
|
let removed = 0;
|
|
336
341
|
let from = first.cursor;
|
|
337
342
|
let latestVersion: CompactionSummary["latestVersion"];
|
|
343
|
+
let roster: CompactionSummary["roster"];
|
|
338
344
|
for (const row of rows) {
|
|
339
345
|
if (row.type === COMPACTED) {
|
|
340
346
|
// An earlier summary folds into this one, with everything it covered.
|
|
@@ -344,10 +350,20 @@ export function compactEvents(
|
|
|
344
350
|
for (const [type, count] of Object.entries(earlier.types))
|
|
345
351
|
types[type] = (types[type] ?? 0) + count;
|
|
346
352
|
if (earlier.latestVersion) latestVersion = earlier.latestVersion;
|
|
353
|
+
if (earlier.roster) roster = earlier.roster;
|
|
347
354
|
continue;
|
|
348
355
|
}
|
|
349
356
|
removed += 1;
|
|
350
357
|
types[row.type] = (types[row.type] ?? 0) + 1;
|
|
358
|
+
if (row.type === "roster.completed") {
|
|
359
|
+
roster = { complete: true, completed: eventRecord(row) };
|
|
360
|
+
} else if (row.type === "roster.changed") {
|
|
361
|
+
const complete = (JSON.parse(row.payload_json) as { complete?: unknown }).complete === true;
|
|
362
|
+
roster = {
|
|
363
|
+
complete,
|
|
364
|
+
...(complete && roster?.completed ? { completed: roster.completed } : {}),
|
|
365
|
+
};
|
|
366
|
+
}
|
|
351
367
|
if (row.type === "version.published") {
|
|
352
368
|
const payload = JSON.parse(row.payload_json) as { versionId?: unknown; number?: unknown };
|
|
353
369
|
latestVersion = { versionId: payload.versionId, number: payload.number, cursor: row.cursor };
|
|
@@ -359,6 +375,7 @@ export function compactEvents(
|
|
|
359
375
|
removed,
|
|
360
376
|
types,
|
|
361
377
|
...(latestVersion ? { latestVersion } : {}),
|
|
378
|
+
...(roster ? { roster } : {}),
|
|
362
379
|
};
|
|
363
380
|
db.run("DELETE FROM event WHERE artifact_id = ? AND cursor < ?", artifactId, before);
|
|
364
381
|
db.run(
|