@opendatalabs/personal-server-ts-core 1.26.0 → 1.28.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/api/index.d.ts.map +1 -1
- package/dist/api/index.js +62 -1
- package/dist/api/index.js.map +1 -1
- package/dist/contracts/data.d.ts +5 -0
- package/dist/contracts/data.d.ts.map +1 -1
- package/dist/contracts/data.js +3 -1
- package/dist/contracts/data.js.map +1 -1
- package/dist/derivatives/scheduler.d.ts.map +1 -1
- package/dist/derivatives/scheduler.js +18 -1
- package/dist/derivatives/scheduler.js.map +1 -1
- package/dist/ports/index.d.ts +6 -0
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.js.map +1 -1
- package/dist/storage/blocks/cursor.d.ts +5 -1
- package/dist/storage/blocks/cursor.d.ts.map +1 -1
- package/dist/storage/blocks/cursor.js +13 -1
- package/dist/storage/blocks/cursor.js.map +1 -1
- package/dist/storage/blocks/page.d.ts +18 -0
- package/dist/storage/blocks/page.d.ts.map +1 -0
- package/dist/storage/blocks/page.js +113 -0
- package/dist/storage/blocks/page.js.map +1 -0
- package/dist/storage/legacy-projection.d.ts +85 -0
- package/dist/storage/legacy-projection.d.ts.map +1 -0
- package/dist/storage/legacy-projection.js +552 -0
- package/dist/storage/legacy-projection.js.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serve legacy scope bodies from stored PDPP records.
|
|
3
|
+
*
|
|
4
|
+
* PDPP connectors store one envelope per stream, body `{records: [row, …]}`,
|
|
5
|
+
* under `<source>.<stream>`. Apps that predate PDPP read legacy bodies such
|
|
6
|
+
* as `chatgpt.conversations` = `{conversations, total}`. `withLegacyProjection`
|
|
7
|
+
* wraps the raw storage port: when the latest stored body of a projected
|
|
8
|
+
* scope is `{records}`, reads return the legacy body projected from that
|
|
9
|
+
* stream and its sibling streams. Every other body is served exactly as
|
|
10
|
+
* stored. Writes, listings and the sync-facing methods pass through.
|
|
11
|
+
*
|
|
12
|
+
* Give the wrapped ("served") port to every reader of data: the HTTP data
|
|
13
|
+
* route, MCP, derivatives and the job worker. Give the raw port to sync
|
|
14
|
+
* upload/download, so canonical bytes (and their hashes) never change.
|
|
15
|
+
*/
|
|
16
|
+
import { LEGACY_SCOPE_BINDINGS, projectPdppRecordsToLegacyPayload, } from "../legacy-projection/index.js";
|
|
17
|
+
import { isBinaryEnvelope } from "../contracts/binary.js";
|
|
18
|
+
import { buildDataBlocksAsync } from "./blocks/build.js";
|
|
19
|
+
import { readBuiltScopeBlocks } from "./blocks/page.js";
|
|
20
|
+
import { previewEnvelopeValue } from "./preview.js";
|
|
21
|
+
/**
|
|
22
|
+
* Sources whose `{records}` bodies are projected. Other sources either emit
|
|
23
|
+
* legacy wrappers themselves (GitHub, Strava) or have no real-shape parity
|
|
24
|
+
* evidence yet (Oura), so their stored bodies are served as stored.
|
|
25
|
+
*/
|
|
26
|
+
const PROJECTED_SOURCES = new Set(["chatgpt", "claude"]);
|
|
27
|
+
/** Keys the server stamps into `data`; they are not part of the body. */
|
|
28
|
+
const SERVER_STAMP_KEYS = new Set([
|
|
29
|
+
"$writtenBy",
|
|
30
|
+
"$lineage",
|
|
31
|
+
]);
|
|
32
|
+
export function classifyStoredBody(scope, data) {
|
|
33
|
+
if (!isRecordsBody(data))
|
|
34
|
+
return "legacy";
|
|
35
|
+
return isProjectedScope(scope) && !data.records.some(isTaggedRecord)
|
|
36
|
+
? "pdpp-projected"
|
|
37
|
+
: "pdpp-unprojected";
|
|
38
|
+
}
|
|
39
|
+
const SERVED = Symbol.for("personal-server-ts.legacy-projection.served");
|
|
40
|
+
/** A served port's own projected view of one stored version, for supersede. */
|
|
41
|
+
const PROJECTED_VIEW = Symbol.for("personal-server-ts.legacy-projection.projected-view");
|
|
42
|
+
const textEncoder = new TextEncoder();
|
|
43
|
+
/** How many stored versions' body forms one served port remembers. */
|
|
44
|
+
const FORM_CACHE_SIZE = 64;
|
|
45
|
+
/**
|
|
46
|
+
* Wrap a raw storage port so reads of projected scopes return legacy bodies.
|
|
47
|
+
* Wrapping an already wrapped port returns it unchanged.
|
|
48
|
+
*/
|
|
49
|
+
export function withLegacyProjection(raw, options = {}) {
|
|
50
|
+
if (raw[SERVED])
|
|
51
|
+
return raw;
|
|
52
|
+
// One entry, keyed by the versions of every input. It saves re-projecting
|
|
53
|
+
// on repeated reads of the same data; it is not a persistent cache.
|
|
54
|
+
let memo = null;
|
|
55
|
+
// The body form of each stored version read so far, so a version that is
|
|
56
|
+
// not projected (most often a legacy body) is parsed to classify it once,
|
|
57
|
+
// not on every read. Bounded; the oldest entry goes first.
|
|
58
|
+
const forms = new Map();
|
|
59
|
+
const rememberForm = (version, form) => {
|
|
60
|
+
forms.set(version, form);
|
|
61
|
+
if (forms.size > FORM_CACHE_SIZE) {
|
|
62
|
+
forms.delete(forms.keys().next().value);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The projected view of a stored version, or null when it is served as
|
|
67
|
+
* stored. `own` is the stored envelope when it had to be read to decide.
|
|
68
|
+
*/
|
|
69
|
+
async function resolve(scope, collectedAt) {
|
|
70
|
+
if (!isProjectedScope(scope))
|
|
71
|
+
return { view: null };
|
|
72
|
+
const binding = LEGACY_SCOPE_BINDINGS.get(scope);
|
|
73
|
+
const source = scope.slice(0, scope.indexOf("."));
|
|
74
|
+
// The latest version joins the latest siblings, whatever order one run
|
|
75
|
+
// wrote its streams in. A historical version joins, of the sibling
|
|
76
|
+
// versions written before the next version of `scope`, the one nearest
|
|
77
|
+
// in time: the one its own run wrote, before or after it.
|
|
78
|
+
const supersededAt = nextVersionTime(raw, scope, collectedAt);
|
|
79
|
+
const inputs = binding.pdppStreams.map((stream) => {
|
|
80
|
+
const storedScope = `${source}.${stream}`;
|
|
81
|
+
const entry = storedScope === scope
|
|
82
|
+
? raw.findEntry({ scope, at: collectedAt })
|
|
83
|
+
: supersededAt === undefined
|
|
84
|
+
? raw.findEntry({ scope: storedScope })
|
|
85
|
+
: nearestBefore(raw, storedScope, collectedAt, supersededAt);
|
|
86
|
+
return {
|
|
87
|
+
stream,
|
|
88
|
+
storedScope,
|
|
89
|
+
collectedAt: storedScope === scope ? collectedAt : entry?.collectedAt,
|
|
90
|
+
// The index row id changes when a version is deleted and written
|
|
91
|
+
// again under the same collectedAt, so it identifies the content.
|
|
92
|
+
version: entry ? `${entry.id}@${entry.collectedAt}` : null,
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
const ownVersion = inputs.find((input) => input.storedScope === scope)?.version;
|
|
96
|
+
if (ownVersion) {
|
|
97
|
+
const form = forms.get(ownVersion);
|
|
98
|
+
if (form !== undefined && form !== "pdpp-projected") {
|
|
99
|
+
return { view: null };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const key = JSON.stringify([scope, inputs.map((input) => input.version)]);
|
|
103
|
+
if (memo?.key === key)
|
|
104
|
+
return { view: memo.value };
|
|
105
|
+
const own = await raw.readEnvelope(scope, collectedAt);
|
|
106
|
+
const form = classifyStoredBody(scope, own.data);
|
|
107
|
+
if (ownVersion)
|
|
108
|
+
rememberForm(ownVersion, form);
|
|
109
|
+
let value = null;
|
|
110
|
+
if (form === "pdpp-projected") {
|
|
111
|
+
value = await project(scope, collectedAt, own, inputs);
|
|
112
|
+
if (value)
|
|
113
|
+
value.view = key;
|
|
114
|
+
}
|
|
115
|
+
memo = { key, value };
|
|
116
|
+
return { view: value, own };
|
|
117
|
+
}
|
|
118
|
+
async function projected(scope, collectedAt) {
|
|
119
|
+
return (await resolve(scope, collectedAt)).view;
|
|
120
|
+
}
|
|
121
|
+
async function project(scope, collectedAt, own, inputs) {
|
|
122
|
+
const records = [];
|
|
123
|
+
const fetchedStreams = [];
|
|
124
|
+
// The projection time is the newest input version, so the same stored
|
|
125
|
+
// data always projects to the same bytes.
|
|
126
|
+
let now = collectedAt;
|
|
127
|
+
for (const input of inputs) {
|
|
128
|
+
if (!input.collectedAt)
|
|
129
|
+
continue;
|
|
130
|
+
const envelope = input.storedScope === scope
|
|
131
|
+
? own
|
|
132
|
+
: await raw.readEnvelope(input.storedScope, input.collectedAt);
|
|
133
|
+
if (classifyStoredBody(input.storedScope, envelope.data) === "legacy") {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
const rows = envelope.data
|
|
137
|
+
.records;
|
|
138
|
+
if (rows.some(isTaggedRecord))
|
|
139
|
+
continue;
|
|
140
|
+
fetchedStreams.push(input.stream);
|
|
141
|
+
if (input.collectedAt > now)
|
|
142
|
+
now = input.collectedAt;
|
|
143
|
+
for (const row of rows) {
|
|
144
|
+
records.push({ stream: input.stream, data: row });
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const result = projectPdppRecordsToLegacyPayload(scope, records, {
|
|
148
|
+
fetchedStreams,
|
|
149
|
+
now,
|
|
150
|
+
orderByPrimaryKey: true,
|
|
151
|
+
allowMissingJoinStreams: true,
|
|
152
|
+
});
|
|
153
|
+
if (!result.ok) {
|
|
154
|
+
options.onIssue?.({
|
|
155
|
+
kind: "projection_failed",
|
|
156
|
+
scope,
|
|
157
|
+
collectedAt,
|
|
158
|
+
error: result.error,
|
|
159
|
+
});
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
if (result.diagnostics?.length) {
|
|
163
|
+
options.onIssue?.({
|
|
164
|
+
kind: "projection_diagnostics",
|
|
165
|
+
scope,
|
|
166
|
+
collectedAt,
|
|
167
|
+
diagnostics: result.diagnostics,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
// Server stamps signed the stored records, not this view, so they are
|
|
171
|
+
// not carried over. `?view=stored` returns them with the stored body.
|
|
172
|
+
const envelope = { ...own, data: result.payload };
|
|
173
|
+
return {
|
|
174
|
+
envelope,
|
|
175
|
+
bytes: textEncoder.encode(JSON.stringify(envelope)),
|
|
176
|
+
...(result.diagnostics?.length
|
|
177
|
+
? { diagnostics: result.diagnostics }
|
|
178
|
+
: {}),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
async function builtBlocks(scope, view) {
|
|
182
|
+
view.built ??= await buildDataBlocksAsync({
|
|
183
|
+
scope,
|
|
184
|
+
collectedAt: view.envelope.collectedAt,
|
|
185
|
+
...(typeof view.envelope.schemaId === "string"
|
|
186
|
+
? { schemaId: view.envelope.schemaId }
|
|
187
|
+
: {}),
|
|
188
|
+
content: view.envelope,
|
|
189
|
+
});
|
|
190
|
+
return view.built;
|
|
191
|
+
}
|
|
192
|
+
const overrides = {
|
|
193
|
+
[SERVED]: true,
|
|
194
|
+
[PROJECTED_VIEW]: projected,
|
|
195
|
+
async readEnvelope(scope, collectedAt) {
|
|
196
|
+
const { view, own } = await resolve(scope, collectedAt);
|
|
197
|
+
return view?.envelope ?? own ?? raw.readEnvelope(scope, collectedAt);
|
|
198
|
+
},
|
|
199
|
+
readStoredEnvelope(scope, collectedAt) {
|
|
200
|
+
return raw.readEnvelope(scope, collectedAt);
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
if (raw.readEnvelopeBytes) {
|
|
204
|
+
const rawBytes = raw.readEnvelopeBytes.bind(raw);
|
|
205
|
+
overrides.readEnvelopeBytes = async (scope, collectedAt) => (await projected(scope, collectedAt))?.bytes ??
|
|
206
|
+
rawBytes(scope, collectedAt);
|
|
207
|
+
}
|
|
208
|
+
if (raw.readEnvelopeStream) {
|
|
209
|
+
const rawStream = raw.readEnvelopeStream.bind(raw);
|
|
210
|
+
overrides.readEnvelopeStream = async (scope, collectedAt) => {
|
|
211
|
+
const view = await projected(scope, collectedAt);
|
|
212
|
+
if (!view)
|
|
213
|
+
return rawStream(scope, collectedAt);
|
|
214
|
+
const bytes = view.bytes;
|
|
215
|
+
return new ReadableStream({
|
|
216
|
+
start(controller) {
|
|
217
|
+
controller.enqueue(bytes);
|
|
218
|
+
controller.close();
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
if (raw.readEnvelopePreview) {
|
|
224
|
+
const rawPreview = raw.readEnvelopePreview.bind(raw);
|
|
225
|
+
overrides.readEnvelopePreview = async (scope, collectedAt, previewOpts) => {
|
|
226
|
+
const view = await projected(scope, collectedAt);
|
|
227
|
+
return view
|
|
228
|
+
? previewEnvelopeValue(view.envelope, previewOpts.maxBytes)
|
|
229
|
+
: rawPreview(scope, collectedAt, previewOpts);
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
if (raw.readScopeBlocks) {
|
|
233
|
+
const rawBlocks = raw.readScopeBlocks.bind(raw);
|
|
234
|
+
overrides.readScopeBlocks = async (scope, collectedAt, blockOpts) => {
|
|
235
|
+
const view = await projected(scope, collectedAt);
|
|
236
|
+
return view
|
|
237
|
+
? readBuiltScopeBlocks(await builtBlocks(scope, view), {
|
|
238
|
+
...blockOpts,
|
|
239
|
+
cursorView: view.view,
|
|
240
|
+
})
|
|
241
|
+
: rawBlocks(scope, collectedAt, blockOpts);
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
if (raw.readBlockManifest) {
|
|
245
|
+
const rawManifest = raw.readBlockManifest.bind(raw);
|
|
246
|
+
overrides.readBlockManifest = async (scope, collectedAt) => {
|
|
247
|
+
const view = await projected(scope, collectedAt);
|
|
248
|
+
return view
|
|
249
|
+
? (await builtBlocks(scope, view)).manifest
|
|
250
|
+
: rawManifest(scope, collectedAt);
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
// A stored sidecar answers "yes" for either form (a projected view can
|
|
254
|
+
// always be split into blocks), so the stored body is only read when the
|
|
255
|
+
// raw port has no sidecar yet.
|
|
256
|
+
if (raw.hasScopeBlocks) {
|
|
257
|
+
const rawHas = raw.hasScopeBlocks.bind(raw);
|
|
258
|
+
overrides.hasScopeBlocks = async (scope, collectedAt) => (await rawHas(scope, collectedAt)) ||
|
|
259
|
+
(await projected(scope, collectedAt)) !== null;
|
|
260
|
+
}
|
|
261
|
+
if (raw.canReadScopeBlocks) {
|
|
262
|
+
const rawCan = raw.canReadScopeBlocks.bind(raw);
|
|
263
|
+
overrides.canReadScopeBlocks = async (scope, collectedAt) => (await rawCan(scope, collectedAt)) ||
|
|
264
|
+
(await projected(scope, collectedAt)) !== null;
|
|
265
|
+
}
|
|
266
|
+
return new Proxy(raw, {
|
|
267
|
+
get(target, property) {
|
|
268
|
+
if (Object.prototype.hasOwnProperty.call(overrides, property)) {
|
|
269
|
+
return overrides[property];
|
|
270
|
+
}
|
|
271
|
+
const value = Reflect.get(target, property, target);
|
|
272
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
273
|
+
},
|
|
274
|
+
has(target, property) {
|
|
275
|
+
return (Object.prototype.hasOwnProperty.call(overrides, property) ||
|
|
276
|
+
Reflect.has(target, property));
|
|
277
|
+
},
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* The projected legacy scopes whose served body is built from `scope`'s
|
|
282
|
+
* stored stream, other than `scope` itself: `chatgpt.messages` →
|
|
283
|
+
* `["chatgpt.conversations"]`. Anything that caches a read of a projected
|
|
284
|
+
* scope must treat a change to these streams as a change to it.
|
|
285
|
+
*/
|
|
286
|
+
export function legacyScopesProjectedFrom(scope) {
|
|
287
|
+
const dot = scope.indexOf(".");
|
|
288
|
+
if (dot <= 0)
|
|
289
|
+
return [];
|
|
290
|
+
const source = scope.slice(0, dot);
|
|
291
|
+
const stream = scope.slice(dot + 1);
|
|
292
|
+
return [...LEGACY_SCOPE_BINDINGS.values()]
|
|
293
|
+
.filter((binding) => binding.scope !== scope &&
|
|
294
|
+
binding.scope.startsWith(`${source}.`) &&
|
|
295
|
+
isProjectedScope(binding.scope) &&
|
|
296
|
+
binding.pdppStreams.includes(stream))
|
|
297
|
+
.map((binding) => binding.scope);
|
|
298
|
+
}
|
|
299
|
+
function isProjectedScope(scope) {
|
|
300
|
+
const dot = scope.indexOf(".");
|
|
301
|
+
return (dot > 0 &&
|
|
302
|
+
PROJECTED_SOURCES.has(scope.slice(0, dot)) &&
|
|
303
|
+
LEGACY_SCOPE_BINDINGS.has(scope));
|
|
304
|
+
}
|
|
305
|
+
const VERSION_PAGE_SIZE = 100;
|
|
306
|
+
/** Versions of `scope`, newest first, until `stop` returns true. */
|
|
307
|
+
function walkVersions(raw, scope, stop) {
|
|
308
|
+
for (let offset = 0;; offset += VERSION_PAGE_SIZE) {
|
|
309
|
+
const page = raw.listVersions(scope, { limit: VERSION_PAGE_SIZE, offset });
|
|
310
|
+
const found = page.find(stop);
|
|
311
|
+
if (found || page.length < VERSION_PAGE_SIZE)
|
|
312
|
+
return found;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* When the version of `scope` after the one at `collectedAt` was collected,
|
|
317
|
+
* or undefined when that version is the latest (or not indexed).
|
|
318
|
+
*/
|
|
319
|
+
function nextVersionTime(raw, scope, collectedAt) {
|
|
320
|
+
const at = Date.parse(collectedAt);
|
|
321
|
+
const latest = raw.findEntry({ scope });
|
|
322
|
+
if (!latest || !(Date.parse(latest.collectedAt) > at))
|
|
323
|
+
return undefined;
|
|
324
|
+
let next = Date.parse(latest.collectedAt);
|
|
325
|
+
walkVersions(raw, scope, (entry) => {
|
|
326
|
+
const time = Date.parse(entry.collectedAt);
|
|
327
|
+
if (time > at)
|
|
328
|
+
next = time;
|
|
329
|
+
return !(time > at);
|
|
330
|
+
});
|
|
331
|
+
return next;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* The version of `scope` collected nearest to `collectedAt`, among those
|
|
335
|
+
* collected before `bound` (epoch ms).
|
|
336
|
+
*/
|
|
337
|
+
function nearestBefore(raw, scope, collectedAt, bound) {
|
|
338
|
+
const at = Date.parse(collectedAt);
|
|
339
|
+
// Newest first: remember the last version after `at`, stop at the first
|
|
340
|
+
// one at or before it, and take whichever of the two is nearer.
|
|
341
|
+
let after;
|
|
342
|
+
const notAfter = walkVersions(raw, scope, (entry) => {
|
|
343
|
+
const time = Date.parse(entry.collectedAt);
|
|
344
|
+
if (time > at) {
|
|
345
|
+
if (time < bound)
|
|
346
|
+
after = entry;
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
return true;
|
|
350
|
+
});
|
|
351
|
+
if (!after || !notAfter)
|
|
352
|
+
return after ?? notAfter;
|
|
353
|
+
return Date.parse(after.collectedAt) - at <
|
|
354
|
+
at - Date.parse(notAfter.collectedAt)
|
|
355
|
+
? after
|
|
356
|
+
: notAfter;
|
|
357
|
+
}
|
|
358
|
+
/** A `{stream, data}` row: a record tagged with its stream, not a stream row. */
|
|
359
|
+
function isTaggedRecord(row) {
|
|
360
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) {
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
const { stream, data } = row;
|
|
364
|
+
return (typeof stream === "string" &&
|
|
365
|
+
data !== null &&
|
|
366
|
+
typeof data === "object" &&
|
|
367
|
+
!Array.isArray(data));
|
|
368
|
+
}
|
|
369
|
+
function isRecordsBody(data) {
|
|
370
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
371
|
+
return false;
|
|
372
|
+
}
|
|
373
|
+
const keys = Object.keys(data).filter((key) => !SERVER_STAMP_KEYS.has(key));
|
|
374
|
+
return (keys.length === 1 &&
|
|
375
|
+
keys[0] === "records" &&
|
|
376
|
+
Array.isArray(data.records));
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* After a `{records}` version of a projected scope is committed, delete the
|
|
380
|
+
* scope's older owner-written legacy versions: the new version serves the
|
|
381
|
+
* same legacy view, so they are a second copy.
|
|
382
|
+
*
|
|
383
|
+
* It deletes nothing unless `storage` is a served port (see
|
|
384
|
+
* `withLegacyProjection`) whose projection of the new version is complete:
|
|
385
|
+
* no join stream missing and no row left out. It also deletes nothing when
|
|
386
|
+
* the projection holds fewer items than the newest legacy version, or lacks
|
|
387
|
+
* any item id that version holds, so an empty or time-windowed run cannot
|
|
388
|
+
* replace a full history. For Claude scopes it also deletes nothing when an
|
|
389
|
+
* item holds fewer nested messages or documents than the legacy item. A legacy version must carry the scope's legacy
|
|
390
|
+
* collection key (`conversations` for `chatgpt.conversations`); PDPP
|
|
391
|
+
* versions, other bodies, binary uploads, versions a builder wrote
|
|
392
|
+
* (`$writtenBy`) and newer versions are kept.
|
|
393
|
+
*
|
|
394
|
+
* Local only: the deletes are not sent to the gateway. Copies that sync
|
|
395
|
+
* already uploaded, and copies other replicas already downloaded, remain.
|
|
396
|
+
*/
|
|
397
|
+
export async function supersedeLegacyVersions(storage, scope, committedAt) {
|
|
398
|
+
const refuse = (refused) => ({
|
|
399
|
+
superseded: [],
|
|
400
|
+
refused,
|
|
401
|
+
});
|
|
402
|
+
const readStored = (storage.readStoredEnvelope ?? storage.readEnvelope).bind(storage);
|
|
403
|
+
const committed = await readStored(scope, committedAt);
|
|
404
|
+
if (classifyStoredBody(scope, committed.data) !== "pdpp-projected") {
|
|
405
|
+
return refuse("the new version is not PDPP records of a projected scope");
|
|
406
|
+
}
|
|
407
|
+
const projectedView = storage[PROJECTED_VIEW];
|
|
408
|
+
const view = projectedView ? await projectedView(scope, committedAt) : null;
|
|
409
|
+
if (!view)
|
|
410
|
+
return refuse("the new version cannot be projected");
|
|
411
|
+
if (view.diagnostics?.length) {
|
|
412
|
+
const kinds = [...new Set(view.diagnostics.map((d) => d.kind))];
|
|
413
|
+
return refuse(`the projection is partial (${kinds.join(", ")})`);
|
|
414
|
+
}
|
|
415
|
+
const collection = legacyCollectionKey(scope);
|
|
416
|
+
const projectedItems = view.envelope.data[collection];
|
|
417
|
+
const projectedCount = projectedItems.length;
|
|
418
|
+
const committedMs = Date.parse(committedAt);
|
|
419
|
+
const older = [];
|
|
420
|
+
const pageSize = 100;
|
|
421
|
+
for (let offset = 0;; offset += pageSize) {
|
|
422
|
+
const page = storage.listVersions(scope, { limit: pageSize, offset });
|
|
423
|
+
for (const entry of page) {
|
|
424
|
+
// Compare instants, not strings: "…00.500Z" sorts before "…00Z".
|
|
425
|
+
if (Date.parse(entry.collectedAt) < committedMs) {
|
|
426
|
+
older.push(entry.collectedAt);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
if (page.length < pageSize)
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
const legacy = [];
|
|
433
|
+
for (const collectedAt of older) {
|
|
434
|
+
const envelope = await readStored(scope, collectedAt);
|
|
435
|
+
// A binary upload under the scope is not a legacy body.
|
|
436
|
+
if (isBinaryEnvelope(envelope))
|
|
437
|
+
continue;
|
|
438
|
+
const items = legacyCollection(scope, envelope.data);
|
|
439
|
+
if (items === null)
|
|
440
|
+
continue;
|
|
441
|
+
legacy.push({
|
|
442
|
+
collectedAt,
|
|
443
|
+
count: items.length,
|
|
444
|
+
ids: items.map(itemId).filter((id) => id !== undefined),
|
|
445
|
+
items,
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
const newest = legacy.reduce((best, version) => !best || Date.parse(version.collectedAt) > Date.parse(best.collectedAt)
|
|
449
|
+
? version
|
|
450
|
+
: best, undefined);
|
|
451
|
+
if (newest && projectedCount < newest.count) {
|
|
452
|
+
return refuse(`the projection has ${projectedCount} ${collection}; the newest legacy version has ${newest.count}`);
|
|
453
|
+
}
|
|
454
|
+
if (newest) {
|
|
455
|
+
const projectedIds = new Set(projectedItems.map(itemId).filter((id) => id !== undefined));
|
|
456
|
+
const missing = newest.ids.filter((id) => !projectedIds.has(id));
|
|
457
|
+
if (missing.length > 0) {
|
|
458
|
+
return refuse(`the projection lacks ${missing.length} of the ${collection} in the newest legacy version`);
|
|
459
|
+
}
|
|
460
|
+
const shortfall = nestedShortfall(scope, newest.items, projectedItems);
|
|
461
|
+
if (shortfall)
|
|
462
|
+
return refuse(shortfall);
|
|
463
|
+
}
|
|
464
|
+
const superseded = [];
|
|
465
|
+
for (const { collectedAt } of legacy) {
|
|
466
|
+
if (await storage.deleteVersion(scope, collectedAt)) {
|
|
467
|
+
superseded.push(collectedAt);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
return { superseded };
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Nested rows a Claude item holds, per scope. The PDPP rows carry no source
|
|
474
|
+
* count the binding can check them against (a conversation's `message_count`
|
|
475
|
+
* is optional; a project has none), so the projection cannot vouch for them.
|
|
476
|
+
* Compare them with the legacy item instead. ChatGPT is not listed: its
|
|
477
|
+
* binding checks the source count itself, and a shorter current branch there
|
|
478
|
+
* is a reviewed difference.
|
|
479
|
+
*
|
|
480
|
+
* A project also keeps its source `raw_docs`. A raw doc with a uuid must be
|
|
481
|
+
* a projected doc; one without a uuid survives only in `raw_docs`, so it
|
|
482
|
+
* counts as a projected doc too.
|
|
483
|
+
*/
|
|
484
|
+
const NESTED_ITEMS = {
|
|
485
|
+
"claude.conversations": (item) => ({
|
|
486
|
+
held: arrayLength(field(item, "messages")),
|
|
487
|
+
selfShort: false,
|
|
488
|
+
}),
|
|
489
|
+
"claude.projects": (item) => {
|
|
490
|
+
const detail = field(item, "detail");
|
|
491
|
+
const rawDocs = field(detail, "raw_docs");
|
|
492
|
+
const raw = Array.isArray(rawDocs) ? rawDocs : [];
|
|
493
|
+
const withId = raw.filter((doc) => typeof field(doc, "uuid") === "string");
|
|
494
|
+
const docs = arrayLength(field(detail, "docs"));
|
|
495
|
+
return {
|
|
496
|
+
held: docs + raw.length - withId.length,
|
|
497
|
+
selfShort: docs < withId.length,
|
|
498
|
+
};
|
|
499
|
+
},
|
|
500
|
+
};
|
|
501
|
+
function field(value, key) {
|
|
502
|
+
return value !== null && typeof value === "object"
|
|
503
|
+
? value[key]
|
|
504
|
+
: undefined;
|
|
505
|
+
}
|
|
506
|
+
function arrayLength(value) {
|
|
507
|
+
return Array.isArray(value) ? value.length : 0;
|
|
508
|
+
}
|
|
509
|
+
/** Why the projection holds fewer nested rows than it should, if so. */
|
|
510
|
+
function nestedShortfall(scope, legacyItems, projectedItems) {
|
|
511
|
+
const nested = NESTED_ITEMS[scope];
|
|
512
|
+
if (!nested)
|
|
513
|
+
return undefined;
|
|
514
|
+
const projectedById = new Map(projectedItems.map((item) => [itemId(item), nested(item).held]));
|
|
515
|
+
const short = legacyItems.filter((item) => (projectedById.get(itemId(item)) ?? 0) < nested(item).held);
|
|
516
|
+
// A project whose own source lists docs the projection lacks.
|
|
517
|
+
const incomplete = projectedItems.filter((item) => nested(item).selfShort);
|
|
518
|
+
const count = short.length + incomplete.length;
|
|
519
|
+
return count > 0
|
|
520
|
+
? `the projection holds fewer nested rows than the source or the newest legacy version for ${count} of the ${legacyCollectionKey(scope)}`
|
|
521
|
+
: undefined;
|
|
522
|
+
}
|
|
523
|
+
/** `chatgpt.conversations` → `conversations`: the array a legacy body holds. */
|
|
524
|
+
function legacyCollectionKey(scope) {
|
|
525
|
+
return scope.slice(scope.indexOf(".") + 1);
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* The items of an owner-written legacy body of `scope`, or null when the
|
|
529
|
+
* body is not one: it must hold the scope's collection array, must not be
|
|
530
|
+
* PDPP records, and must not carry a builder's `$writtenBy` stamp.
|
|
531
|
+
*/
|
|
532
|
+
function legacyCollection(scope, data) {
|
|
533
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
534
|
+
return null;
|
|
535
|
+
}
|
|
536
|
+
if (isRecordsBody(data) || "$writtenBy" in data)
|
|
537
|
+
return null;
|
|
538
|
+
const items = data[legacyCollectionKey(scope)];
|
|
539
|
+
return Array.isArray(items) ? items : null;
|
|
540
|
+
}
|
|
541
|
+
/** A legacy item's `id` (or `uuid`), when it has a string one. */
|
|
542
|
+
function itemId(item) {
|
|
543
|
+
if (item === null || typeof item !== "object")
|
|
544
|
+
return undefined;
|
|
545
|
+
const { id, uuid } = item;
|
|
546
|
+
return typeof id === "string"
|
|
547
|
+
? id
|
|
548
|
+
: typeof uuid === "string"
|
|
549
|
+
? uuid
|
|
550
|
+
: undefined;
|
|
551
|
+
}
|
|
552
|
+
//# sourceMappingURL=legacy-projection.js.map
|
|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,CAAC;IAC9D,OAAO,OAAO,EAAE,KAAK,QAAQ;QAC3B,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ;YACxB,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,SAAS,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendatalabs/personal-server-ts-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.0",
|
|
4
4
|
"description": "Protocol logic for the Vana Personal Server — auth, grants, scopes, storage, keys",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -68,6 +68,10 @@
|
|
|
68
68
|
"types": "./dist/storage/preview.d.ts",
|
|
69
69
|
"import": "./dist/storage/preview.js"
|
|
70
70
|
},
|
|
71
|
+
"./storage/legacy-projection": {
|
|
72
|
+
"types": "./dist/storage/legacy-projection.d.ts",
|
|
73
|
+
"import": "./dist/storage/legacy-projection.js"
|
|
74
|
+
},
|
|
71
75
|
"./storage/blocks/build": {
|
|
72
76
|
"types": "./dist/storage/blocks/build.d.ts",
|
|
73
77
|
"import": "./dist/storage/blocks/build.js"
|