- MCP
- code on this site's /mcp
- CLI
- none: the JSON below is the answer
- JSON
- /christopher/abso-core/files/src/engine/state-source.ts?version=211&format=json
643 linescodex-capacity-chair 94% · capacity 6%Last change capacity in version 206, 13 versions changed it
You're reading version 211. The newest is 318, and 7 versions since then changed this file.
codex-capacity-policy has unpushed changes at lines 1–25no start notelast edit
1/**
2 * Indexed graph storage. Values must be copied on write and read: a caller
3 * mutating a returned list must not silently change persisted state. Hosts
4 * provide transactions that roll back every write when the callback throws.
5 * The namespace belongs to one graph and must not be shared by concurrent
6 * Graph instances. Opening a graph does not scan its stored collections.
7 */
8export interface GraphStateStorage {
9 read(collection: string, key: string): unknown;
10 write(collection: string, key: string, value: unknown): void;
11 remove(collection: string, key: string): void;
12 entries(collection: string): Iterable<readonly [string, unknown]>;
13 transaction<T>(body: () => T): T;
14}
16/**
17 * Operation-local read cache with fixed payload and entry limits. Private numeric
18 * pages, immutable scalars and serialized objects preserve the copy contract. Discard it after an outer host
19 * rollback or any mutation made through another storage instance.
20 */
21type CachedValue = { bytes: number } & (
22 | { kind: "scalar"; value: string | number | boolean | null | undefined }
23 | { kind: "numbers"; value: readonly number[] }
24 | { kind: "json"; json: string }
25);
27export class CachedStateStorage implements GraphStateStorage {
28 readonly #source: GraphStateStorage;
29 readonly #cache = new Map<string, CachedValue>();
30 readonly #maxBytes: number;
31 readonly #maxEntries: number;
32 #bytes = 0;
33 constructor(source: GraphStateStorage, maxBytes = 1_048_576, maxEntries = 4096) {
34 if (!Number.isSafeInteger(maxBytes) || maxBytes < 0 || !Number.isSafeInteger(maxEntries) || maxEntries < 0)
35 throw new Error("invalid writer cache limits");
36 this.#source = source;
37 this.#maxBytes = maxBytes;
38 this.#maxEntries = maxEntries;
39 }
40 get retainedBytes(): number {
41 return this.#bytes;
42 }
43 get retainedEntries(): number {
44 return this.#cache.size;
45 }
46 clear(): void {
47 this.#cache.clear();
48 this.#bytes = 0;
49 }
50 #drop(key: string): void {
51 const previous = this.#cache.get(key);
52 if (previous) {
53 this.#cache.delete(key);
54 this.#bytes -= previous.bytes;
55 }
56 }
57 read(collection: string, key: string): unknown {
58 const cacheKey = JSON.stringify([collection, key]);
59 const hit = this.#cache.get(cacheKey);
60 if (hit) {
61 this.#cache.delete(cacheKey);
62 this.#cache.set(cacheKey, hit);
63 if (hit.kind === "scalar") return hit.value;
64 if (hit.kind === "numbers") return hit.value.slice();
65 return (JSON.parse(hit.json) as { value?: unknown }).value;
66 }
67 const value = this.#source.read(collection, key);
68 const overhead = 2 * cacheKey.length + 160;
69 let entry: CachedValue;
70 if (
71 value === undefined ||
72 value === null ||
73 typeof value === "string" ||
74 typeof value === "boolean" ||
75 (typeof value === "number" && Number.isFinite(value))
76 ) {
77 entry = { kind: "scalar", value, bytes: overhead + (typeof value === "string" ? 2 * value.length : 16) };
78 } else if (
79 Array.isArray(value) &&
80 value.length <= 256 &&
81 Object.keys(value).length === value.length &&
82 value.every(Number.isSafeInteger)
83 ) {
84 // Store one private, bounded numeric page. Public reads still receive a
85 // fresh copy; neither the source result nor a reader can mutate the cache.
86 entry = { kind: "numbers", value: value.slice(), bytes: overhead + 32 + value.length * 8 };
87 } else {
88 const json = JSON.stringify({ value });
89 entry = { kind: "json", json, bytes: overhead + 2 * json.length };
90 }
91 this.#remember(cacheKey, entry);
92 return value;
93 }
94 #remember(cacheKey: string, entry: CachedValue): void {
95 this.#drop(cacheKey);
96 // Payload accounting is bounded, not a measurement of actual isolate heap.
97 if (entry.bytes <= this.#maxBytes && this.#maxEntries > 0) {
98 while (this.#bytes + entry.bytes > this.#maxBytes || this.#cache.size >= this.#maxEntries)
99 this.#drop(this.#cache.keys().next().value!);
100 this.#cache.set(cacheKey, entry);
101 this.#bytes += entry.bytes;
102 }
103 }
104 write(collection: string, key: string, value: unknown): void {
105 const cacheKey = JSON.stringify([collection, key]);
106 this.#drop(cacheKey);
107 this.#source.write(collection, key, value);
108 // Allocation counters are immutable scalars. Keep successful writes within
109 // the existing cache budget instead of immediately reading them back.
110 if (typeof value === "number" && Number.isSafeInteger(value) && !Object.is(value, -0))
111 this.#remember(cacheKey, { kind: "scalar", value, bytes: 2 * cacheKey.length + 176 });
112 }
113 remove(collection: string, key: string): void {
114 this.#drop(JSON.stringify([collection, key]));
115 this.#source.remove(collection, key);
116 }
117 entries(collection: string): Iterable<readonly [string, unknown]> {
118 return this.#source.entries(collection);
119 }
120 transaction<T>(body: () => T): T {
121 try {
122 return this.#source.transaction(body);
123 } catch (error) {
124 this.clear();
125 throw error;
126 }
127 }
128}
130/**
131 * Sets known to be closed under dependencies (abso Capacity): every atom's deps are in the set. A view or a project
132 * given one skips proving it again, which read every atom and every dependency in the history.
133 */
134const closedSets = new WeakSet<object>();
135export function markClosed<S extends ReadonlySet<unknown>>(set: S): S {
136 closedSets.add(set);
137 return set;
138}
139export function isClosedSet(set: unknown): boolean {
140 return typeof set === "object" && set !== null && closedSets.has(set);
141}
143/** Immutable membership whose implementation does not retain its enumerated keys. */
144export abstract class StableSet<T> implements ReadonlySet<T> {
145 abstract has(value: T): boolean;
146 abstract values(): SetIterator<T>;
147 /** Only resident membership data; external storage is not charged as heap. */
148 abstract readonly retainedBytes: number;
149 get [Symbol.toStringTag](): string {
150 return "Set";
151 }
152 get size(): number {
153 let count = 0;
154 for (const _ of this) count++;
155 return count;
156 }
157 keys(): SetIterator<T> {
158 return this.values();
159 }
160 *entries(): SetIterator<[T, T]> {
161 for (const value of this) yield [value, value];
162 }
163 [Symbol.iterator](): SetIterator<T> {
164 return this.values();
165 }
166 forEach(callback: (value: T, key: T, set: ReadonlySet<T>) => void, thisArg?: unknown): void {
167 for (const value of this) callback.call(thisArg, value, value, this);
168 }
169}
171/** Both operands must be immutable for the lifetime of this union. */
172export class StableUnionSet<T> extends StableSet<T> {
173 readonly #left: StableSet<T>;
174 readonly #right: StableSet<T>;
175 constructor(left: StableSet<T>, right: StableSet<T>) {
176 super();
177 this.#left = left;
178 this.#right = right;
179 }
180 get retainedBytes(): number {
181 return 32 + this.#left.retainedBytes + this.#right.retainedBytes;
182 }
183 get left(): StableSet<T> {
184 return this.#left;
185 }
186 get right(): StableSet<T> {
187 return this.#right;
188 }
189 has(value: T): boolean {
190 return this.#left.has(value) || this.#right.has(value);
191 }
192 *values(): SetIterator<T> {
193 yield* this.#left;
194 for (const value of this.#right) if (!this.#left.has(value)) yield value;
195 }
196}
198/** Immutable indexed subtraction retains neither operand's enumerated values. */
199export class StableDifferenceSet<T> extends StableSet<T> {
200 readonly left: StableSet<T>;
201 readonly right: StableSet<T>;
202 constructor(left: StableSet<T>, right: StableSet<T>) {
203 super();
204 this.left = left;
205 this.right = right;
206 }
207 get retainedBytes(): number {
208 return 32 + this.left.retainedBytes + this.right.retainedBytes;
209 }
210 has(value: T): boolean {
211 return this.left.has(value) && !this.right.has(value);
212 }
213 *values(): SetIterator<T> {
214 for (const value of this.left) if (!this.right.has(value)) yield value;
215 }
216}
218/** Preserve indexed history; only the caller's operation-sized overlay is copied. */
219export function unionOverlay<T>(base: ReadonlySet<T>, overlay: Iterable<T>): ReadonlySet<T> {
220 return base instanceof StableSet
221 ? new StableUnionSet(base, new StableOverlaySet(overlay))
222 : new Set([...base, ...overlay]);
223}
225/** Both indexed operands must be immutable for the lifetime of the result. */
226export function differenceSet<T>(left: ReadonlySet<T>, right: ReadonlySet<T>): ReadonlySet<T> {
227 return left instanceof StableSet && right instanceof StableSet
228 ? new StableDifferenceSet(left, right)
229 : new Set([...left].filter((value) => !right.has(value)));
230}
232/** An immutable snapshot for the operation's small overlay, not its history. */
233export class StableOverlaySet<T> extends StableSet<T> {
234 readonly #values: Set<T>;
235 constructor(values: Iterable<T>) {
236 super();
237 this.#values = new Set(values);
238 }
239 get retainedBytes(): number {
240 return 64 + this.#values.size * 32;
241 }
242 has(value: T): boolean {
243 return this.#values.has(value);
244 }
245 values(): SetIterator<T> {
246 return this.#values.values();
247 }
248}
250const indexKey = (key: PropertyKey): key is string =>
251 typeof key === "string" && /^(0|[1-9][0-9]*)$/.test(key) && Number.isSafeInteger(Number(key));
253/** Fixed-size numeric pages; callers retain no pages outside the bounded storage cache. */
254export function storedNumbers(storage: GraphStateStorage, name: string) {
255 const pageSize = 256;
256 const meta = `${name}:meta`;
257 const length = () => (storage.read(meta, "length") as number | undefined) ?? 0;
258 // Older experimental writer indexes must be rebuilt from their canonical log.
259 // Never interpret per-element rows as pages or silently lose existing history.
260 const page = (index: number): number[] => {
261 if (storage.read(meta, "format") !== 2)
262 throw new Error(`writer numeric index ${name} requires canonical-log adoption`);
263 const values = storage.read(`${name}:pages`, String(Math.floor(index / pageSize))) as number[] | undefined;
264 if (!values) throw new Error(`missing writer numeric page in ${name}`);
265 return values;
266 };
267 return {
268 get length() {
269 return length();
270 },
271 at(index: number): number {
272 if (!Number.isSafeInteger(index) || index < 0 || index >= length())
273 throw new Error(`writer numeric index out of bounds in ${name}`);
274 const value = page(index)[index % pageSize];
275 if (value === undefined) throw new Error(`incomplete writer numeric page in ${name}`);
276 return value;
277 },
278 push(value: number): void {
279 if (!Number.isSafeInteger(value)) throw new Error("writer numeric indexes require safe integers");
280 const index = length();
281 if (index > 0 && storage.read(meta, "format") !== 2)
282 throw new Error(`writer numeric index ${name} requires canonical-log adoption`);
283 const offset = index % pageSize;
284 const values = offset === 0 ? [] : page(index);
285 if (values.length !== offset) throw new Error(`invalid writer numeric page length in ${name}`);
286 values.push(value);
287 storage.write(`${name}:pages`, String(Math.floor(index / pageSize)), values);
288 if (index === 0) storage.write(meta, "format", 2);
289 storage.write(meta, "length", index + 1);
290 },
291 set(index: number, value: number): void {
292 if (!Number.isSafeInteger(value)) throw new Error("writer numeric indexes require safe integers");
293 if (!Number.isSafeInteger(index) || index < 0 || index >= length())
294 throw new Error(`writer numeric index out of bounds in ${name}`);
295 const values = page(index);
296 if (index % pageSize >= values.length) throw new Error(`incomplete writer numeric page in ${name}`);
297 values[index % pageSize] = value;
298 storage.write(`${name}:pages`, String(Math.floor(index / pageSize)), values);
299 },
300 };
301}
303/** Array-shaped access without retaining its historical values in memory. */
304export function storedArray<T>(
305 storage: GraphStateStorage,
306 name: string,
307 decode?: (value: T) => T,
308 encode?: (value: T, key: string) => unknown,
309): T[] {
310 const length = () => (storage.read(`${name}:meta`, "length") as number | undefined) ?? 0;
311 const read = (key: string) => {
312 const value = storage.read(name, key) as T;
313 return value === undefined || !decode ? value : decode(value);
314 };
315 return new Proxy([] as T[], {
316 get(target, key, receiver) {
317 if (key === "length") return length();
318 if (indexKey(key)) return Number(key) < length() ? read(key) : undefined;
319 return Reflect.get(target, key, receiver);
320 },
321 set(_target, key, value) {
322 if (key === "length") {
323 if (value !== length()) throw new Error("stored graph arrays cannot be resized directly");
324 return true;
325 }
326 if (!indexKey(key)) throw new Error("invalid stored graph array property");
327 const index = Number(key);
328 const size = length();
329 if (index > size) throw new Error("stored graph arrays cannot contain gaps");
330 storage.write(name, key, encode ? encode(value, key) : value);
331 if (index === size) storage.write(`${name}:meta`, "length", size + 1);
332 return true;
333 },
334 has(target, key) {
335 return indexKey(key) ? Number(key) < length() : Reflect.has(target, key);
336 },
337 ownKeys() {
338 return [...Array.from({ length: length() }, (_, index) => String(index)), "length"];
339 },
340 getOwnPropertyDescriptor(target, key) {
341 if (indexKey(key) && Number(key) < length())
342 return { configurable: true, enumerable: true, writable: true, value: read(key) };
343 return Reflect.getOwnPropertyDescriptor(target, key);
344 },
345 });
346}
348export interface StateMap<K, V> {
349 keys(): IterableIterator<K>;
350 get(key: K): V | undefined;
351 set(key: K, value: V): StateMap<K, V>;
352 has(key: K): boolean;
353 delete(key: K): boolean;
354 values(): IterableIterator<V>;
355}
357/** Append-only per-key lists, retaining at most one fixed-size page per iterator. */
358export function storedLists<V>(
359 storage: GraphStateStorage,
360 name: string,
361 legacyKey = (key: string) => JSON.stringify(["string", key]),
362) {
363 const pageSize = 256;
364 // The previous experimental layout stored one whole historical list per key.
365 const length = (key: string) => {
366 const stored = storage.read(`${name}:lengths`, key) as number | undefined;
367 if (stored === undefined && storage.read(name, legacyKey(key)) !== undefined)
368 throw new Error(`writer list index ${name} requires canonical-log adoption`);
369 const count = stored ?? 0;
370 if (!Number.isSafeInteger(count) || count < 0) throw new Error(`invalid writer list count in ${name}`);
371 return count;
372 };
373 const pageKey = (key: string, page: number) => JSON.stringify([key, page]);
374 const page = (key: string, index: number): V[] => {
375 const values = storage.read(`${name}:pages`, pageKey(key, index)) as V[] | undefined;
376 if (!Array.isArray(values) || values.length < 1 || values.length > pageSize)
377 throw new Error(`missing or invalid writer list page in ${name}`);
378 return values;
379 };
380 return {
381 length,
382 *keys(): IterableIterator<string> {
383 for (const entry of storage.entries(name)) {
384 void entry;
385 throw new Error(`writer list index ${name} requires canonical-log adoption`);
386 }
387 for (const [key] of storage.entries(`${name}:lengths`)) yield key;
388 },
389 *values(key: string): IterableIterator<V> {
390 const count = length(key);
391 for (let start = 0; start < count; start += pageSize) {
392 const values = page(key, start / pageSize);
393 if (values.length !== Math.min(pageSize, count - start))
394 throw new Error(`incomplete writer list page in ${name}`);
395 yield* values;
396 }
397 },
398 last(key: string): V | undefined {
399 const count = length(key);
400 if (count === 0) return undefined;
401 const values = page(key, Math.floor((count - 1) / pageSize));
402 const expected = ((count - 1) % pageSize) + 1;
403 if (values.length !== expected) throw new Error(`incomplete writer list page in ${name}`);
404 return values[expected - 1];
405 },
406 append(key: string, value: V): void {
407 const count = length(key);
408 const offset = count % pageSize;
409 const index = Math.floor(count / pageSize);
410 const values = offset === 0 ? [] : page(key, index);
411 if (values.length !== offset) throw new Error(`invalid writer list length in ${name}`);
412 values.push(value);
413 storage.write(`${name}:pages`, pageKey(key, index), values);
414 storage.write(`${name}:lengths`, key, count + 1);
415 },
416 /** Append several values, writing each page they touch once. */
417 appendAll(key: string, more: readonly V[]): void {
418 if (more.length === 0) return;
419 const count = length(key);
420 let index = Math.floor(count / pageSize);
421 let values = count % pageSize === 0 ? [] : page(key, index);
422 if (values.length !== count % pageSize) throw new Error(`invalid writer list length in ${name}`);
423 for (const value of more) {
424 if (values.length === pageSize) {
425 storage.write(`${name}:pages`, pageKey(key, index++), values);
426 values = [];
427 }
428 values.push(value);
429 }
430 storage.write(`${name}:pages`, pageKey(key, index), values);
431 storage.write(`${name}:lengths`, key, count + more.length);
432 },
433 };
434}
436/** Keys are tagged so numeric graph codes cannot collide with string keys. */
437export function storedMap<K extends string | number, V>(storage: GraphStateStorage, name: string): StateMap<K, V> {
438 const keyOf = (key: K) => JSON.stringify([typeof key, key]);
439 const map: StateMap<K, V> = {
440 *keys() {
441 for (const [key] of storage.entries(name)) yield (JSON.parse(key) as [string, K])[1];
442 },
443 get: (key) => storage.read(name, keyOf(key)) as V | undefined,
444 has: (key) => storage.read(name, keyOf(key)) !== undefined,
445 set(key, value) {
446 storage.write(name, keyOf(key), value);
447 return map;
448 },
449 delete(key) {
450 const existed = map.has(key);
451 storage.remove(name, keyOf(key));
452 return existed;
453 },
454 *values() {
455 for (const [, value] of storage.entries(name)) yield value as V;
456 },
457 };
458 return map;
459}
461/**
462 * A Map-compatible persistent index. Iteration follows insertion order and
463 * decodes one row at a time. Returned objects are copies, so mutations need
464 * an explicit set. Hosts wrap a logical multi-index mutation in transaction.
465 */
466export class StoredMap<K extends string | number, V> extends Map<K, V> {
467 readonly #storage: GraphStateStorage;
468 readonly #name: string;
469 readonly #encode: (value: V) => unknown;
470 readonly #decode: (value: unknown) => V;
471 constructor(
472 storage: GraphStateStorage,
473 name: string,
474 codec?: { encode(value: V): unknown; decode(value: unknown): V },
475 ) {
476 super();
477 this.#storage = storage;
478 this.#name = name;
479 this.#encode = codec?.encode ?? ((value) => value);
480 this.#decode = codec?.decode ?? ((value) => value as V);
481 }
482 #key(key: K): string {
483 return JSON.stringify([typeof key, key]);
484 }
485 #row(key: K): { slot: number; value: unknown } | undefined {
486 return this.#storage.read(this.#name, this.#key(key)) as { slot: number; value: unknown } | undefined;
487 }
488 override get size(): number {
489 return (this.#storage.read(`${this.#name}:meta`, "size") as number | undefined) ?? 0;
490 }
491 override has(key: K): boolean {
492 return this.#row(key) !== undefined;
493 }
494 override get(key: K): V | undefined {
495 const row = this.#row(key);
496 return row === undefined ? undefined : this.#decode(row.value);
497 }
498 override set(key: K, value: V): this {
499 const row = this.#row(key);
500 let slot = row?.slot;
501 if (slot === undefined) {
502 const keys = storedArray<K>(this.#storage, `${this.#name}:order`);
503 slot = keys.length;
504 keys.push(key);
505 this.#storage.write(`${this.#name}:meta`, "size", this.size + 1);
506 }
507 this.#storage.write(this.#name, this.#key(key), { slot, value: this.#encode(value) });
508 return this;
509 }
510 override delete(key: K): boolean {
511 if (!this.has(key)) return false;
512 this.#storage.remove(this.#name, this.#key(key));
513 this.#storage.write(`${this.#name}:meta`, "size", this.size - 1);
514 return true;
515 }
516 override clear(): void {
517 for (const key of this.keys()) this.delete(key);
518 }
519 override *entries(): MapIterator<[K, V]> {
520 const keys = storedArray<K>(this.#storage, `${this.#name}:order`);
521 for (let slot = 0; slot < keys.length; slot++) {
522 const key = keys[slot]!;
523 const row = this.#row(key);
524 if (row?.slot === slot) yield [key, this.#decode(row.value)];
525 }
526 }
527 override *keys(): MapIterator<K> {
528 const keys = storedArray<K>(this.#storage, `${this.#name}:order`);
529 for (let slot = 0; slot < keys.length; slot++) {
530 const key = keys[slot]!;
531 if (this.#row(key)?.slot === slot) yield key;
532 }
533 }
534 override *values(): MapIterator<V> {
535 for (const [, value] of this.entries()) yield value;
536 }
537 override [Symbol.iterator](): MapIterator<[K, V]> {
538 return this.entries();
539 }
540 override forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: unknown): void {
541 for (const [key, value] of this.entries()) callback.call(thisArg, value, key, this);
542 }
543}
545/** Persistent membership with streaming iteration and no in-memory key cache. */
546export class StoredSet<K extends string | number> extends Set<K> {
547 readonly #map: StoredMap<K, true>;
548 constructor(storage: GraphStateStorage, name: string) {
549 super();
550 this.#map = new StoredMap(storage, name);
551 }
552 override get size(): number {
553 return this.#map.size;
554 }
555 override has(key: K): boolean {
556 return this.#map.has(key);
557 }
558 override add(key: K): this {
559 this.#map.set(key, true);
560 return this;
561 }
562 override delete(key: K): boolean {
563 return this.#map.delete(key);
564 }
565 override clear(): void {
566 this.#map.clear();
567 }
568 override *values(): SetIterator<K> {
569 yield* this.#map.keys();
570 }
571 override keys(): SetIterator<K> {
572 return this.values();
573 }
574 override *entries(): SetIterator<[K, K]> {
575 for (const key of this.values()) yield [key, key];
576 }
577 override [Symbol.iterator](): SetIterator<K> {
578 return this.values();
579 }
580 override forEach(callback: (value: K, key: K, set: Set<K>) => void, thisArg?: unknown): void {
581 for (const key of this.values()) callback.call(thisArg, key, key, this);
582 }
583}
585/** Read-only array access to individually stored values, without copying the list. */
586export function readonlyStoredArray<T>(
587 storage: GraphStateStorage,
588 name: string,
589 decode?: (value: unknown, index: number) => T,
590): readonly T[] {
591 const length = () => {
592 const count = storage.read(`${name}:meta`, "length");
593 if (!Number.isSafeInteger(count) || (count as number) < 0) throw Error("invalid stored list length");
594 return count as number;
595 };
596 length();
597 return new Proxy([] as T[], {
598 get(target, key, receiver) {
599 if (key === "length") return length();
600 if (indexKey(key)) {
601 if (Number(key) >= length()) return undefined;
602 const raw = storage.read(name, key);
603 const value = raw === undefined ? undefined : decode ? decode(raw, Number(key)) : (raw as T);
604 if (value === undefined) throw Error("missing stored list element");
605 return value && typeof value === "object" ? Object.freeze(value) : value;
606 }
607 return Reflect.get(target, key, receiver);
608 },
609 has(target, key) {
610 return indexKey(key) ? Number(key) < length() : Reflect.has(target, key);
611 },
612 ownKeys() {
613 return [...Array.from({ length: length() }, (_, index) => String(index)), "length"];
614 },
615 getOwnPropertyDescriptor(target, key) {
616 if (key === "length") return { ...Reflect.getOwnPropertyDescriptor(target, key)!, value: length() };
617 if (indexKey(key) && Number(key) < length()) {
618 const raw = storage.read(name, key);
619 const value = raw === undefined ? undefined : decode ? decode(raw, Number(key)) : (raw as T);
620 if (value === undefined) throw Error("missing stored list element");
621 return {
622 configurable: true,
623 enumerable: true,
624 writable: false,
625 value: value && typeof value === "object" ? Object.freeze(value) : value,
626 };
627 }
628 return Reflect.getOwnPropertyDescriptor(target, key);
629 },
630 preventExtensions() {
631 throw Error("stored list is read-only");
632 },
633 set() {
634 throw Error("stored list is read-only");
635 },
636 deleteProperty() {
637 throw Error("stored list is read-only");
638 },
639 defineProperty() {
640 throw Error("stored list is read-only");
641 },
642 });
643}