@opendatalabs/personal-server-ts-core 1.5.0 → 1.7.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 +41 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +298 -87
- package/dist/api/index.js.map +1 -1
- package/dist/contracts/binary.d.ts +12 -0
- package/dist/contracts/binary.d.ts.map +1 -1
- package/dist/contracts/binary.js +31 -0
- package/dist/contracts/binary.js.map +1 -1
- package/dist/contracts/data.d.ts +35 -0
- package/dist/contracts/data.d.ts.map +1 -1
- package/dist/contracts/data.js +96 -14
- package/dist/contracts/data.js.map +1 -1
- package/dist/contracts/index.d.ts +1 -1
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +1 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/errors/catalog.d.ts +34 -0
- package/dist/errors/catalog.d.ts.map +1 -1
- package/dist/errors/catalog.js +41 -0
- package/dist/errors/catalog.js.map +1 -1
- package/dist/lineage/attestation.d.ts +42 -0
- package/dist/lineage/attestation.d.ts.map +1 -0
- package/dist/lineage/attestation.js +25 -0
- package/dist/lineage/attestation.js.map +1 -0
- package/dist/lineage/gateway.d.ts +105 -0
- package/dist/lineage/gateway.d.ts.map +1 -0
- package/dist/lineage/gateway.js +242 -0
- package/dist/lineage/gateway.js.map +1 -0
- package/dist/lineage/index.d.ts +5 -0
- package/dist/lineage/index.d.ts.map +1 -0
- package/dist/lineage/index.js +5 -0
- package/dist/lineage/index.js.map +1 -0
- package/dist/lineage/lineage.d.ts +141 -0
- package/dist/lineage/lineage.d.ts.map +1 -0
- package/dist/lineage/lineage.js +255 -0
- package/dist/lineage/lineage.js.map +1 -0
- package/dist/logging/access-log.d.ts +1 -1
- package/dist/logging/access-log.d.ts.map +1 -1
- package/dist/policy/data-read.d.ts +8 -0
- package/dist/policy/data-read.d.ts.map +1 -1
- package/dist/policy/data-read.js +9 -2
- package/dist/policy/data-read.js.map +1 -1
- package/dist/policy/data-write.d.ts +69 -0
- package/dist/policy/data-write.d.ts.map +1 -0
- package/dist/policy/data-write.js +131 -0
- package/dist/policy/data-write.js.map +1 -0
- package/dist/policy/index.d.ts +2 -1
- package/dist/policy/index.d.ts.map +1 -1
- package/dist/policy/index.js +2 -1
- package/dist/policy/index.js.map +1 -1
- package/dist/signing/request-signer.d.ts +2 -0
- package/dist/signing/request-signer.d.ts.map +1 -1
- package/dist/signing/request-signer.js +1 -0
- package/dist/signing/request-signer.js.map +1 -1
- package/dist/signing/signer.d.ts +8 -0
- package/dist/signing/signer.d.ts.map +1 -1
- package/dist/signing/signer.js +9 -0
- package/dist/signing/signer.js.map +1 -1
- package/dist/sync/data-point-id.d.ts +7 -0
- package/dist/sync/data-point-id.d.ts.map +1 -0
- package/dist/sync/data-point-id.js +16 -0
- package/dist/sync/data-point-id.js.map +1 -0
- package/dist/sync/workers/upload.d.ts +10 -6
- package/dist/sync/workers/upload.d.ts.map +1 -1
- package/dist/sync/workers/upload.js +39 -17
- package/dist/sync/workers/upload.js.map +1 -1
- package/dist/write/attribution.d.ts +167 -0
- package/dist/write/attribution.d.ts.map +1 -0
- package/dist/write/attribution.js +325 -0
- package/dist/write/attribution.js.map +1 -0
- package/dist/write/index.d.ts +3 -0
- package/dist/write/index.d.ts.map +1 -0
- package/dist/write/index.js +3 -0
- package/dist/write/index.js.map +1 -0
- package/dist/write/session.d.ts +96 -0
- package/dist/write/session.d.ts.map +1 -0
- package/dist/write/session.js +136 -0
- package/dist/write/session.js.map +1 -0
- package/package.json +9 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derivative data: lineage on the write path.
|
|
3
|
+
*
|
|
4
|
+
* A derivative is an ordinary write whose body names the data points it was
|
|
5
|
+
* computed from. The caller's `lineage` field (top level of a JSON body, or
|
|
6
|
+
* inside the `X-Vana-Metadata` object of a binary write) is a list of data
|
|
7
|
+
* point ids, `keccak256(abi.encode(owner, scope))`. The Personal Server
|
|
8
|
+
* validates it against the owner's own data points and mirrors it into the
|
|
9
|
+
* envelope `data` under the reserved `$lineage` key, the same in-`data`
|
|
10
|
+
* marker idiom as `$writtenBy` and `$binary`, so lineage rides the unchanged
|
|
11
|
+
* encrypt / upload / register path and `metadataHash` commits to it.
|
|
12
|
+
*
|
|
13
|
+
* The caller's `lineage` field is left in the record untouched: for session
|
|
14
|
+
* writes it is inside the bytes the builder signed, so the lineage claim is
|
|
15
|
+
* builder-signed and `$lineage` is the server-validated mirror of it.
|
|
16
|
+
*
|
|
17
|
+
* See docs/derivative-data-api.md for the wire contract.
|
|
18
|
+
*/
|
|
19
|
+
import type { DataStoragePort } from "../ports/index.js";
|
|
20
|
+
/** Reserved key inside the envelope `data` record for validated lineage. */
|
|
21
|
+
export declare const LINEAGE_KEY: "$lineage";
|
|
22
|
+
/** The caller-facing field name (JSON body top level / binary metadata). */
|
|
23
|
+
export declare const LINEAGE_FIELD: "lineage";
|
|
24
|
+
/** Upper bound on sources per record; keeps validation and hashing bounded. */
|
|
25
|
+
export declare const MAX_LINEAGE_SOURCES = 256;
|
|
26
|
+
/** Page size of the local index scan the source resolver runs. */
|
|
27
|
+
export declare const LOCAL_SCOPE_SCAN_PAGE = 1000;
|
|
28
|
+
export interface StoredLineage {
|
|
29
|
+
/** Validated, lowercased source data point ids in the order given. */
|
|
30
|
+
sources: `0x${string}`[];
|
|
31
|
+
/** ISO timestamp the Personal Server validated and stamped the lineage. */
|
|
32
|
+
writtenAt: string;
|
|
33
|
+
}
|
|
34
|
+
/** A source as the resolver saw it (local index or gateway). */
|
|
35
|
+
export interface ResolvedLineageSource {
|
|
36
|
+
dataPointId: `0x${string}`;
|
|
37
|
+
scope: string;
|
|
38
|
+
/** Null while the source is only known locally (not registered yet). */
|
|
39
|
+
version: string | null;
|
|
40
|
+
deletedAt: string | null;
|
|
41
|
+
}
|
|
42
|
+
/** The subset of a gateway data-point record the resolver needs. */
|
|
43
|
+
export interface LineageDataPointRecord {
|
|
44
|
+
dataPointId: string;
|
|
45
|
+
ownerAddress: string;
|
|
46
|
+
scope: string;
|
|
47
|
+
version: string;
|
|
48
|
+
deletedAt: string | null;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Gateway lookup for a source that is not in the local index. Must include
|
|
52
|
+
* deleted (tombstoned) data points: a deleted source is still a valid
|
|
53
|
+
* lineage target, it is only reported as deleted when the lineage is walked.
|
|
54
|
+
*/
|
|
55
|
+
export interface LineageSourceLookup {
|
|
56
|
+
getDataPoint(dataPointId: string): Promise<LineageDataPointRecord | null>;
|
|
57
|
+
}
|
|
58
|
+
export declare function hasReservedLineageKey(data: Record<string, unknown>): boolean;
|
|
59
|
+
/** Stamp validated lineage into an envelope `data` record. */
|
|
60
|
+
export declare function stampLineage(data: Record<string, unknown>, lineage: StoredLineage): Record<string, unknown>;
|
|
61
|
+
/**
|
|
62
|
+
* The stored `$lineage` of a record, or null for a root record. Tolerates
|
|
63
|
+
* hand-crafted envelopes: anything that is not the exact stamped shape is
|
|
64
|
+
* treated as no lineage rather than thrown on.
|
|
65
|
+
*/
|
|
66
|
+
export declare class StoredLineageMalformedError extends Error {
|
|
67
|
+
constructor(detail: string);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Absent `$lineage` (or a data object that is not a record) is `null`: no
|
|
71
|
+
* statement. A PRESENT but malformed `$lineage` throws: a corrupted or
|
|
72
|
+
* hand-crafted derivative must fail closed, never fall through the root
|
|
73
|
+
* path and get registered as if it made no lineage statement.
|
|
74
|
+
*/
|
|
75
|
+
export declare function readStoredLineage(data: Record<string, unknown> | undefined): StoredLineage | null;
|
|
76
|
+
/**
|
|
77
|
+
* The caller's `lineage` field from a JSON body or a binary write's parsed
|
|
78
|
+
* metadata. `undefined` when the container is not an object or carries no
|
|
79
|
+
* such field, so a bare-string metadata header or a lineage-less body is a
|
|
80
|
+
* root record.
|
|
81
|
+
*/
|
|
82
|
+
export declare function extractLineageField(container: unknown): unknown;
|
|
83
|
+
/**
|
|
84
|
+
* Parse the caller's `lineage` value: an array of distinct 0x-prefixed
|
|
85
|
+
* 32-byte hex strings, at most MAX_LINEAGE_SOURCES long. Ids are lowercased
|
|
86
|
+
* so equal ids compare equal wherever they are stored. Throws
|
|
87
|
+
* LineageInvalidError (400).
|
|
88
|
+
*/
|
|
89
|
+
export declare function parseLineageSources(value: unknown): `0x${string}`[];
|
|
90
|
+
/** First dot-segment of a scope (`chatgpt` for `chatgpt.conversations`). */
|
|
91
|
+
export declare function scopeNamespace(scope: string): string;
|
|
92
|
+
/**
|
|
93
|
+
* The naming rule. Grant patterns are exact, `prefix.*` or `*`; `prefix.*`
|
|
94
|
+
* covers every scope that starts with `prefix.`. A derived scope and a
|
|
95
|
+
* source scope are both covered by the same non-universal pattern exactly
|
|
96
|
+
* when they share their first segment, and that is the one way the current
|
|
97
|
+
* grammar can leak across a lineage edge (a grant on `chatgpt.*` would read
|
|
98
|
+
* both `chatgpt.conversations` and a derivative named `chatgpt.summary`).
|
|
99
|
+
* `*` reads everything by definition and is not a lineage leak.
|
|
100
|
+
*/
|
|
101
|
+
export declare function derivedScopeViolatesNaming(derivedScope: string, sourceScope: string): boolean;
|
|
102
|
+
export declare function assertDerivedScopeNaming(derivedScope: string, sourceScopes: readonly string[]): void;
|
|
103
|
+
export interface ResolveLineageSourcesInput {
|
|
104
|
+
/** The derived record's scope. */
|
|
105
|
+
scope: string;
|
|
106
|
+
sources: readonly `0x${string}`[];
|
|
107
|
+
serverOwner: `0x${string}`;
|
|
108
|
+
storage: Pick<DataStoragePort, "listScopes">;
|
|
109
|
+
/** Absent = sources must be in the local index. */
|
|
110
|
+
gateway?: LineageSourceLookup;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Resolve every source id to a data point of this owner. The local index is
|
|
114
|
+
* consulted first (`keccak256(owner, scope)` over the server's own scopes,
|
|
115
|
+
* so an unsynced local scope is a valid source), then the gateway with
|
|
116
|
+
* deleted points included. An id that resolves to nothing, or to another
|
|
117
|
+
* owner's data point, fails the whole write with 422
|
|
118
|
+
* LINEAGE_SOURCE_UNKNOWN listing every offending id; a gateway that cannot
|
|
119
|
+
* be reached fails with 502 so the builder retries instead of being told
|
|
120
|
+
* its source does not exist.
|
|
121
|
+
*/
|
|
122
|
+
export declare function resolveLineageSources(input: ResolveLineageSourcesInput): Promise<ResolvedLineageSource[]>;
|
|
123
|
+
export interface PrepareLineageInput {
|
|
124
|
+
scope: string;
|
|
125
|
+
/** The raw caller value (`body.lineage` / `metadata.lineage`). */
|
|
126
|
+
field: unknown;
|
|
127
|
+
serverOwner: `0x${string}` | undefined;
|
|
128
|
+
storage: Pick<DataStoragePort, "listScopes">;
|
|
129
|
+
gateway?: LineageSourceLookup;
|
|
130
|
+
now: () => Date;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Validate a write's lineage end to end (shape, sources, naming rule) and
|
|
134
|
+
* produce the `$lineage` record to stamp. An empty list is an EXPLICIT root
|
|
135
|
+
* statement: it is stamped (`sources: []`) and registered as an attested
|
|
136
|
+
* root, distinct from an absent field, which makes no lineage statement.
|
|
137
|
+
* Throws ProtocolErrors; callers on the write path let them propagate
|
|
138
|
+
* before anything is stored.
|
|
139
|
+
*/
|
|
140
|
+
export declare function prepareLineage(input: PrepareLineageInput): Promise<StoredLineage>;
|
|
141
|
+
//# sourceMappingURL=lineage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lineage.d.ts","sourceRoot":"","sources":["../../src/lineage/lineage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AASH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD,4EAA4E;AAC5E,eAAO,MAAM,WAAW,EAAG,UAAmB,CAAC;AAE/C,4EAA4E;AAC5E,eAAO,MAAM,aAAa,EAAG,SAAkB,CAAC;AAEhD,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,MAA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AmB,GACzB,OAAO,CAAC,aAAa,CAAC,CAmBxB"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derivative data: lineage on the write path.
|
|
3
|
+
*
|
|
4
|
+
* A derivative is an ordinary write whose body names the data points it was
|
|
5
|
+
* computed from. The caller's `lineage` field (top level of a JSON body, or
|
|
6
|
+
* inside the `X-Vana-Metadata` object of a binary write) is a list of data
|
|
7
|
+
* point ids, `keccak256(abi.encode(owner, scope))`. The Personal Server
|
|
8
|
+
* validates it against the owner's own data points and mirrors it into the
|
|
9
|
+
* envelope `data` under the reserved `$lineage` key, the same in-`data`
|
|
10
|
+
* marker idiom as `$writtenBy` and `$binary`, so lineage rides the unchanged
|
|
11
|
+
* encrypt / upload / register path and `metadataHash` commits to it.
|
|
12
|
+
*
|
|
13
|
+
* The caller's `lineage` field is left in the record untouched: for session
|
|
14
|
+
* writes it is inside the bytes the builder signed, so the lineage claim is
|
|
15
|
+
* builder-signed and `$lineage` is the server-validated mirror of it.
|
|
16
|
+
*
|
|
17
|
+
* See docs/derivative-data-api.md for the wire contract.
|
|
18
|
+
*/
|
|
19
|
+
import { LineageInvalidError, LineageScopeUnderSourcePrefixError, LineageSourceLookupFailedError, LineageSourceUnknownError, ServerNotConfiguredError, } from "../errors/catalog.js";
|
|
20
|
+
import { computeDataPointId } from "../sync/data-point-id.js";
|
|
21
|
+
/** Reserved key inside the envelope `data` record for validated lineage. */
|
|
22
|
+
export const LINEAGE_KEY = "$lineage";
|
|
23
|
+
/** The caller-facing field name (JSON body top level / binary metadata). */
|
|
24
|
+
export const LINEAGE_FIELD = "lineage";
|
|
25
|
+
/** Upper bound on sources per record; keeps validation and hashing bounded. */
|
|
26
|
+
export const MAX_LINEAGE_SOURCES = 256;
|
|
27
|
+
/** Page size of the local index scan the source resolver runs. */
|
|
28
|
+
export const LOCAL_SCOPE_SCAN_PAGE = 1000;
|
|
29
|
+
const BYTES32_HEX = /^0x[0-9a-fA-F]{64}$/;
|
|
30
|
+
function isRecord(value) {
|
|
31
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
32
|
+
}
|
|
33
|
+
export function hasReservedLineageKey(data) {
|
|
34
|
+
return Object.prototype.hasOwnProperty.call(data, LINEAGE_KEY);
|
|
35
|
+
}
|
|
36
|
+
/** Stamp validated lineage into an envelope `data` record. */
|
|
37
|
+
export function stampLineage(data, lineage) {
|
|
38
|
+
return { ...data, [LINEAGE_KEY]: lineage };
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The stored `$lineage` of a record, or null for a root record. Tolerates
|
|
42
|
+
* hand-crafted envelopes: anything that is not the exact stamped shape is
|
|
43
|
+
* treated as no lineage rather than thrown on.
|
|
44
|
+
*/
|
|
45
|
+
export class StoredLineageMalformedError extends Error {
|
|
46
|
+
constructor(detail) {
|
|
47
|
+
super(`Stored $lineage is malformed: ${detail}`);
|
|
48
|
+
this.name = "StoredLineageMalformedError";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Absent `$lineage` (or a data object that is not a record) is `null`: no
|
|
53
|
+
* statement. A PRESENT but malformed `$lineage` throws: a corrupted or
|
|
54
|
+
* hand-crafted derivative must fail closed, never fall through the root
|
|
55
|
+
* path and get registered as if it made no lineage statement.
|
|
56
|
+
*/
|
|
57
|
+
export function readStoredLineage(data) {
|
|
58
|
+
if (!isRecord(data) || !(LINEAGE_KEY in data))
|
|
59
|
+
return null;
|
|
60
|
+
const value = data[LINEAGE_KEY];
|
|
61
|
+
if (!isRecord(value)) {
|
|
62
|
+
throw new StoredLineageMalformedError("not an object");
|
|
63
|
+
}
|
|
64
|
+
const sources = value.sources;
|
|
65
|
+
if (!Array.isArray(sources) ||
|
|
66
|
+
!sources.every((id) => typeof id === "string" && BYTES32_HEX.test(id))) {
|
|
67
|
+
throw new StoredLineageMalformedError("sources is not a list of bytes32 ids");
|
|
68
|
+
}
|
|
69
|
+
if (typeof value.writtenAt !== "string") {
|
|
70
|
+
throw new StoredLineageMalformedError("writtenAt is not a string");
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
sources: sources.map((id) => id.toLowerCase()),
|
|
74
|
+
writtenAt: value.writtenAt,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The caller's `lineage` field from a JSON body or a binary write's parsed
|
|
79
|
+
* metadata. `undefined` when the container is not an object or carries no
|
|
80
|
+
* such field, so a bare-string metadata header or a lineage-less body is a
|
|
81
|
+
* root record.
|
|
82
|
+
*/
|
|
83
|
+
export function extractLineageField(container) {
|
|
84
|
+
if (!isRecord(container))
|
|
85
|
+
return undefined;
|
|
86
|
+
return container[LINEAGE_FIELD];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Parse the caller's `lineage` value: an array of distinct 0x-prefixed
|
|
90
|
+
* 32-byte hex strings, at most MAX_LINEAGE_SOURCES long. Ids are lowercased
|
|
91
|
+
* so equal ids compare equal wherever they are stored. Throws
|
|
92
|
+
* LineageInvalidError (400).
|
|
93
|
+
*/
|
|
94
|
+
export function parseLineageSources(value) {
|
|
95
|
+
if (!Array.isArray(value)) {
|
|
96
|
+
throw new LineageInvalidError(`${LINEAGE_FIELD} must be an array of data point ids (0x-prefixed 32-byte hex)`);
|
|
97
|
+
}
|
|
98
|
+
if (value.length > MAX_LINEAGE_SOURCES) {
|
|
99
|
+
throw new LineageInvalidError(`${LINEAGE_FIELD} lists ${value.length} sources; the maximum is ${MAX_LINEAGE_SOURCES}`, { max: MAX_LINEAGE_SOURCES, count: value.length });
|
|
100
|
+
}
|
|
101
|
+
const seen = new Set();
|
|
102
|
+
const sources = [];
|
|
103
|
+
for (const entry of value) {
|
|
104
|
+
if (typeof entry !== "string" || !BYTES32_HEX.test(entry)) {
|
|
105
|
+
throw new LineageInvalidError(`${LINEAGE_FIELD} entries must be 0x-prefixed 32-byte hex data point ids`, { entry: typeof entry === "string" ? entry : typeof entry });
|
|
106
|
+
}
|
|
107
|
+
const id = entry.toLowerCase();
|
|
108
|
+
if (seen.has(id)) {
|
|
109
|
+
throw new LineageInvalidError(`${LINEAGE_FIELD} lists the same source twice`, { duplicate: id });
|
|
110
|
+
}
|
|
111
|
+
seen.add(id);
|
|
112
|
+
sources.push(id);
|
|
113
|
+
}
|
|
114
|
+
return sources;
|
|
115
|
+
}
|
|
116
|
+
/** First dot-segment of a scope (`chatgpt` for `chatgpt.conversations`). */
|
|
117
|
+
export function scopeNamespace(scope) {
|
|
118
|
+
const dot = scope.indexOf(".");
|
|
119
|
+
return dot === -1 ? scope : scope.slice(0, dot);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The naming rule. Grant patterns are exact, `prefix.*` or `*`; `prefix.*`
|
|
123
|
+
* covers every scope that starts with `prefix.`. A derived scope and a
|
|
124
|
+
* source scope are both covered by the same non-universal pattern exactly
|
|
125
|
+
* when they share their first segment, and that is the one way the current
|
|
126
|
+
* grammar can leak across a lineage edge (a grant on `chatgpt.*` would read
|
|
127
|
+
* both `chatgpt.conversations` and a derivative named `chatgpt.summary`).
|
|
128
|
+
* `*` reads everything by definition and is not a lineage leak.
|
|
129
|
+
*/
|
|
130
|
+
export function derivedScopeViolatesNaming(derivedScope, sourceScope) {
|
|
131
|
+
return scopeNamespace(derivedScope) === scopeNamespace(sourceScope);
|
|
132
|
+
}
|
|
133
|
+
export function assertDerivedScopeNaming(derivedScope, sourceScopes) {
|
|
134
|
+
for (const sourceScope of sourceScopes) {
|
|
135
|
+
if (derivedScopeViolatesNaming(derivedScope, sourceScope)) {
|
|
136
|
+
throw new LineageScopeUnderSourcePrefixError({
|
|
137
|
+
scope: derivedScope,
|
|
138
|
+
sourceScope,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Resolve every source id to a data point of this owner. The local index is
|
|
145
|
+
* consulted first (`keccak256(owner, scope)` over the server's own scopes,
|
|
146
|
+
* so an unsynced local scope is a valid source), then the gateway with
|
|
147
|
+
* deleted points included. An id that resolves to nothing, or to another
|
|
148
|
+
* owner's data point, fails the whole write with 422
|
|
149
|
+
* LINEAGE_SOURCE_UNKNOWN listing every offending id; a gateway that cannot
|
|
150
|
+
* be reached fails with 502 so the builder retries instead of being told
|
|
151
|
+
* its source does not exist.
|
|
152
|
+
*/
|
|
153
|
+
export async function resolveLineageSources(input) {
|
|
154
|
+
const ownId = computeDataPointId(input.serverOwner, input.scope);
|
|
155
|
+
const self = input.sources.find((id) => id === ownId);
|
|
156
|
+
if (self) {
|
|
157
|
+
throw new LineageInvalidError("A record cannot list its own data point as a lineage source", { dataPointId: self });
|
|
158
|
+
}
|
|
159
|
+
const local = localScopesById(input.storage, input.serverOwner, new Set(input.sources));
|
|
160
|
+
const resolved = [];
|
|
161
|
+
const unknown = [];
|
|
162
|
+
for (const dataPointId of input.sources) {
|
|
163
|
+
const localScope = local.get(dataPointId);
|
|
164
|
+
if (localScope !== undefined) {
|
|
165
|
+
resolved.push({
|
|
166
|
+
dataPointId,
|
|
167
|
+
scope: localScope,
|
|
168
|
+
version: null,
|
|
169
|
+
deletedAt: null,
|
|
170
|
+
});
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (!input.gateway) {
|
|
174
|
+
unknown.push(dataPointId);
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
let record;
|
|
178
|
+
try {
|
|
179
|
+
record = await input.gateway.getDataPoint(dataPointId);
|
|
180
|
+
}
|
|
181
|
+
catch (err) {
|
|
182
|
+
throw new LineageSourceLookupFailedError({
|
|
183
|
+
dataPointId,
|
|
184
|
+
error: err instanceof Error ? err.message : String(err),
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
if (!record ||
|
|
188
|
+
record.ownerAddress.toLowerCase() !== input.serverOwner.toLowerCase()) {
|
|
189
|
+
unknown.push(dataPointId);
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
resolved.push({
|
|
193
|
+
dataPointId,
|
|
194
|
+
scope: record.scope,
|
|
195
|
+
version: record.version,
|
|
196
|
+
deletedAt: record.deletedAt,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
if (unknown.length > 0) {
|
|
200
|
+
throw new LineageSourceUnknownError({ unknown });
|
|
201
|
+
}
|
|
202
|
+
return resolved;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* `dataPointId -> scope` for the server's own scopes that appear in
|
|
206
|
+
* `wanted`. Pages through the whole local index (an unsynced scope is a
|
|
207
|
+
* valid source wherever it sorts), stopping early once every wanted id has
|
|
208
|
+
* been found.
|
|
209
|
+
*/
|
|
210
|
+
function localScopesById(storage, serverOwner, wanted) {
|
|
211
|
+
const byId = new Map();
|
|
212
|
+
for (let offset = 0;; offset += LOCAL_SCOPE_SCAN_PAGE) {
|
|
213
|
+
const { scopes, total } = storage.listScopes({
|
|
214
|
+
limit: LOCAL_SCOPE_SCAN_PAGE,
|
|
215
|
+
offset,
|
|
216
|
+
});
|
|
217
|
+
for (const summary of scopes) {
|
|
218
|
+
const id = computeDataPointId(serverOwner, summary.scope);
|
|
219
|
+
if (wanted.has(id))
|
|
220
|
+
byId.set(id, summary.scope);
|
|
221
|
+
}
|
|
222
|
+
if (byId.size === wanted.size ||
|
|
223
|
+
scopes.length === 0 ||
|
|
224
|
+
offset + scopes.length >= total) {
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return byId;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Validate a write's lineage end to end (shape, sources, naming rule) and
|
|
232
|
+
* produce the `$lineage` record to stamp. An empty list is an EXPLICIT root
|
|
233
|
+
* statement: it is stamped (`sources: []`) and registered as an attested
|
|
234
|
+
* root, distinct from an absent field, which makes no lineage statement.
|
|
235
|
+
* Throws ProtocolErrors; callers on the write path let them propagate
|
|
236
|
+
* before anything is stored.
|
|
237
|
+
*/
|
|
238
|
+
export async function prepareLineage(input) {
|
|
239
|
+
const sources = parseLineageSources(input.field);
|
|
240
|
+
if (!input.serverOwner) {
|
|
241
|
+
throw new ServerNotConfiguredError({
|
|
242
|
+
reason: "serverOwner is required to validate lineage sources",
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
const resolved = await resolveLineageSources({
|
|
246
|
+
scope: input.scope,
|
|
247
|
+
sources,
|
|
248
|
+
serverOwner: input.serverOwner,
|
|
249
|
+
storage: input.storage,
|
|
250
|
+
gateway: input.gateway,
|
|
251
|
+
});
|
|
252
|
+
assertDerivedScopeNaming(input.scope, resolved.map((source) => source.scope));
|
|
253
|
+
return { sources, writtenAt: input.now().toISOString() };
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=lineage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lineage.js","sourceRoot":"","sources":["../../src/lineage/lineage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,mBAAmB,EACnB,kCAAkC,EAClC,8BAA8B,EAC9B,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,4EAA4E;AAC5E,MAAM,CAAC,MAAM,WAAW,GAAG,UAAmB,CAAC;AAE/C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,aAAa,GAAG,SAAkB,CAAC;AAEhD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEvC,kEAAkE;AAClE,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAE1C,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAoC1C,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CA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AAC,IAAI;YACzB,MAAM,CAAC,MAAM,KAAK,CAAC;YACnB,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,KAAK,EAC/B,CAAC;YACD,MAAM;QACR,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAYD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,KAA0B;IAE1B,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;QACvB,MAAM,IAAI,wBAAwB,CAAC;YACjC,MAAM,EAAE,qDAAqD;SAC9D,CAAC,CAAC;IACL,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC;QAC3C,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,OAAO;QACP,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC,CAAC;IACH,wBAAwB,CACtB,KAAK,CAAC,KAAK,EACX,QAAQ,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CACvC,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-log.d.ts","sourceRoot":"","sources":["../../src/logging/access-log.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"access-log.d.ts","sourceRoot":"","sources":["../../src/logging/access-log.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C"}
|
|
@@ -18,5 +18,13 @@ export interface DataReadPolicyPorts {
|
|
|
18
18
|
grantVerifier: GrantVerifierPort;
|
|
19
19
|
runtimeAvailability?: RuntimeAvailabilityPort;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Parse a grant's `expiresAt` into unix seconds. Accepts the legacy
|
|
23
|
+
* uint256-seconds string, a numeric value, or the current gateway ISO
|
|
24
|
+
* timestamp. Returns 0 for "perpetual" encodings (null/undefined/"0") and
|
|
25
|
+
* null for unparseable input. Shared by the read and write policies so both
|
|
26
|
+
* stay aligned with the gateway response shape.
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseGrantExpiresAtSeconds(value: unknown): number | null;
|
|
21
29
|
export declare function verifyDataReadPolicy(input: DataReadPolicyInput, ports: DataReadPolicyPorts): Promise<GatewayGrantResponse>;
|
|
22
30
|
//# sourceMappingURL=data-read.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-read.d.ts","sourceRoot":"","sources":["../../src/policy/data-read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAa3E,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC7B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,KAAK,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IAGvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,aAAa,EAAE,iBAAiB,CAAC;IAKjC,mBAAmB,CAAC,EAAE,uBAAuB,CAAC;CAC/C;
|
|
1
|
+
{"version":3,"file":"data-read.d.ts","sourceRoot":"","sources":["../../src/policy/data-read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAa3E,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC7B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,KAAK,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IAGvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,aAAa,EAAE,iBAAiB,CAAC;IAKjC,mBAAmB,CAAC,EAAE,uBAAuB,CAAC;CAC/C;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAUxE;AAED,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,mBAAmB,EAC1B,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,oBAAoB,CAAC,CAmG/B"}
|
package/dist/policy/data-read.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { scopeCoveredByGrant } from "@opendatalabs/vana-sdk/browser";
|
|
2
2
|
import { GrantExpiredError, GrantOwnerMismatchError, GrantRequiredError, GrantRevokedError, InvalidSignatureError, PsUnavailableError, ScopeMismatchError, ServerNotConfiguredError, UnregisteredBuilderError, } from "../errors/catalog.js";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Parse a grant's `expiresAt` into unix seconds. Accepts the legacy
|
|
5
|
+
* uint256-seconds string, a numeric value, or the current gateway ISO
|
|
6
|
+
* timestamp. Returns 0 for "perpetual" encodings (null/undefined/"0") and
|
|
7
|
+
* null for unparseable input. Shared by the read and write policies so both
|
|
8
|
+
* stay aligned with the gateway response shape.
|
|
9
|
+
*/
|
|
10
|
+
export function parseGrantExpiresAtSeconds(value) {
|
|
4
11
|
if (value === null || value === undefined || value === "0")
|
|
5
12
|
return 0;
|
|
6
13
|
if (typeof value === "number")
|
|
@@ -50,7 +57,7 @@ export async function verifyDataReadPolicy(input, ports) {
|
|
|
50
57
|
// DPv2 may surface either the legacy uint256-seconds string or the
|
|
51
58
|
// current gateway ISO timestamp. Parse both so the policy stays aligned
|
|
52
59
|
// with the gateway response shape.
|
|
53
|
-
const expiresAtSec =
|
|
60
|
+
const expiresAtSec = parseGrantExpiresAtSeconds(grant.expiresAt);
|
|
54
61
|
if (expiresAtSec === null) {
|
|
55
62
|
throw new ScopeMismatchError({
|
|
56
63
|
requestedScope: input.requestedScope,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-read.js","sourceRoot":"","sources":["../../src/policy/data-read.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM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,cAAc;QACrB,KAAK,CAAC,cAAc,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,EACtE,CAAC;QACD,MAAM,IAAI,uBAAuB,CAAC;YAChC,OAAO,EAAE,KAAK,CAAC,EAAE;YACjB,QAAQ,EAAE,KAAK,CAAC,WAAW;YAC3B,MAAM,EAAE,KAAK,CAAC,cAAc,IAAI,IAAI;SACrC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { GatewayGrantResponse } from "@opendatalabs/vana-sdk/browser";
|
|
2
|
+
import { type AuthSessionVerifierPort, type GrantVerifierPort, type RuntimeAvailabilityPort } from "../ports/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Write-grant encoding: a grant scope entry prefixed with `write:` authorizes
|
|
5
|
+
* the grantee to WRITE into the scope it names (e.g. `write:notes.entries`,
|
|
6
|
+
* `write:notes.*`). The suffix uses the same pattern grammar as read scopes
|
|
7
|
+
* (`*` / `{prefix}.*` / exact), evaluated with the SDK's scopeMatchesPattern.
|
|
8
|
+
*
|
|
9
|
+
* Why a scope-entry prefix and not a new grant field: the gateway's grant
|
|
10
|
+
* shape (GatewayGrantResponse) has no permission axis — `scopes` is its only
|
|
11
|
+
* capability carrier — and the gateway validates scope entries as opaque
|
|
12
|
+
* non-empty strings, so `write:`-prefixed entries flow through createGrant /
|
|
13
|
+
* getGrant / the EIP-712 GrantRegistration signature unchanged. The Personal
|
|
14
|
+
* Server is the sole interpreter.
|
|
15
|
+
*
|
|
16
|
+
* Separation of powers falls out of the encoding:
|
|
17
|
+
* - read policy matches the REQUESTED scope against grant entries verbatim
|
|
18
|
+
* (scopeCoveredByGrant), and a requested scope never carries the prefix,
|
|
19
|
+
* so `write:x` entries can never satisfy a read;
|
|
20
|
+
* - write policy (below) only honors `write:`-prefixed entries, so plain
|
|
21
|
+
* read entries can never satisfy a write.
|
|
22
|
+
*/
|
|
23
|
+
export declare const WRITE_SCOPE_PREFIX = "write:";
|
|
24
|
+
export declare function isWriteScopeEntry(entry: string): boolean;
|
|
25
|
+
/** The scope patterns a grant authorizes for writing (prefix stripped). */
|
|
26
|
+
export declare function writeScopePatterns(grantScopes: readonly string[]): string[];
|
|
27
|
+
export declare function scopeCoveredByWriteGrant(requestedScope: string, grantScopes: readonly string[]): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Fee seam for builder writes. Write fee mechanics are undecided — the
|
|
30
|
+
* default (no port wired) is FREE. When a fee model lands (x402-style like
|
|
31
|
+
* reads, or something else), implement this port and wire it into
|
|
32
|
+
* DataWritePolicyPorts; the policy calls it after all authorization
|
|
33
|
+
* invariants pass, so a fee rejection never masks an auth failure.
|
|
34
|
+
*/
|
|
35
|
+
export interface WriteFeeVerifierPort {
|
|
36
|
+
assertWriteAllowed(input: {
|
|
37
|
+
builder: `0x${string}`;
|
|
38
|
+
grant: GatewayGrantResponse;
|
|
39
|
+
scope: string;
|
|
40
|
+
}): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export interface DataWritePolicyInput {
|
|
43
|
+
signer: `0x${string}`;
|
|
44
|
+
grantId?: string;
|
|
45
|
+
requestedScope: string;
|
|
46
|
+
/**
|
|
47
|
+
* This server's owner address. The grant's grantor MUST equal it — a grant
|
|
48
|
+
* issued by a different owner is rejected. Required (not optional) so that
|
|
49
|
+
* TypeScript flags any caller that fails to bind the write to the server
|
|
50
|
+
* owner; the check also fails closed at runtime for untyped/JS callers.
|
|
51
|
+
*/
|
|
52
|
+
serverOwner: `0x${string}`;
|
|
53
|
+
}
|
|
54
|
+
export interface DataWritePolicyPorts {
|
|
55
|
+
authSessionVerifier: AuthSessionVerifierPort;
|
|
56
|
+
grantVerifier: GrantVerifierPort;
|
|
57
|
+
runtimeAvailability?: RuntimeAvailabilityPort;
|
|
58
|
+
/** Absent = writes are free (see WriteFeeVerifierPort). */
|
|
59
|
+
writeFeeVerifier?: WriteFeeVerifierPort;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Authorize one builder write against a write-grant. Mirrors
|
|
63
|
+
* verifyDataReadPolicy invariant-for-invariant (builder registered, grant
|
|
64
|
+
* present / not revoked / not expired, scope coverage, grantee binding,
|
|
65
|
+
* owner binding) — but scope coverage only honors `write:`-prefixed grant
|
|
66
|
+
* entries, so a read-grant never confers write access.
|
|
67
|
+
*/
|
|
68
|
+
export declare function verifyDataWritePolicy(input: DataWritePolicyInput, ports: DataWritePolicyPorts): Promise<GatewayGrantResponse>;
|
|
69
|
+
//# sourceMappingURL=data-write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-write.d.ts","sourceRoot":"","sources":["../../src/policy/data-write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAa3E,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC7B,MAAM,mBAAmB,CAAC;AAG3B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAE3C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAK3E;AAED,wBAAgB,wBAAwB,CACtC,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,SAAS,MAAM,EAAE,GAC7B,OAAO,CAIT;AAED;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,kBAAkB,CAAC,KAAK,EAAE;QACxB,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;QACvB,KAAK,EAAE,oBAAoB,CAAC;QAC5B,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnB;AAED,MAAM,W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