@substrat-run/contracts 0.136.0 → 0.138.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/control-plane.d.ts +7 -0
- package/dist/control-plane.d.ts.map +1 -1
- package/dist/control-plane.js +11 -0
- package/dist/control-plane.js.map +1 -1
- package/dist/errors.d.ts +41 -6
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +41 -6
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/invocation-record.d.ts +27 -11
- package/dist/invocation-record.d.ts.map +1 -1
- package/dist/invocation-record.js +27 -11
- package/dist/invocation-record.js.map +1 -1
- package/dist/lifecycle-flow.d.ts +2 -0
- package/dist/lifecycle-flow.d.ts.map +1 -1
- package/dist/lifecycle-flow.js +4 -4
- package/dist/lifecycle-flow.js.map +1 -1
- package/dist/lifecycle.d.ts +9 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +9 -1
- package/dist/lifecycle.js.map +1 -1
- package/dist/manifest.d.ts +4 -5
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +4 -5
- package/dist/manifest.js.map +1 -1
- package/dist/openapi.d.ts.map +1 -1
- package/dist/openapi.js +24 -0
- package/dist/openapi.js.map +1 -1
- package/dist/operation-series.d.ts +88 -0
- package/dist/operation-series.d.ts.map +1 -0
- package/dist/operation-series.js +95 -0
- package/dist/operation-series.js.map +1 -0
- package/dist/peer.d.ts +2 -0
- package/dist/peer.d.ts.map +1 -1
- package/dist/peer.js +4 -0
- package/dist/peer.js.map +1 -1
- package/dist/permission.d.ts +19 -5
- package/dist/permission.d.ts.map +1 -1
- package/dist/permission.js +25 -4
- package/dist/permission.js.map +1 -1
- package/dist/rate-limit.d.ts +147 -0
- package/dist/rate-limit.d.ts.map +1 -0
- package/dist/rate-limit.js +248 -0
- package/dist/rate-limit.js.map +1 -0
- package/dist/refusal.d.ts +49 -6
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +82 -13
- package/dist/refusal.js.map +1 -1
- package/dist/registry.d.ts +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +11 -0
- package/dist/registry.js.map +1 -1
- package/dist/script-names.d.ts +33 -0
- package/dist/script-names.d.ts.map +1 -0
- package/dist/script-names.js +59 -0
- package/dist/script-names.js.map +1 -0
- package/dist/tenancy.d.ts +1 -0
- package/dist/tenancy.d.ts.map +1 -1
- package/dist/tenancy.js +6 -0
- package/dist/tenancy.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request rate limiting on the request path (#130).
|
|
3
|
+
*
|
|
4
|
+
* A tenant must be protected from another tenant, and from its own AI-built frontend with
|
|
5
|
+
* a polling bug. The limit is enforced where a request first meets the platform: the router
|
|
6
|
+
* on the hosted path, `@substrat-run/vertical-host`'s `rateLimit()` middleware on a node
|
|
7
|
+
* host with no router in front. Never in a scope host and never in the kernel: a limiter in
|
|
8
|
+
* a scope DO serialises behind that scope's write queue, and cannot see one token's
|
|
9
|
+
* traffic across scopes.
|
|
10
|
+
*
|
|
11
|
+
* ## Why the policy lives here
|
|
12
|
+
*
|
|
13
|
+
* Both of those choke points derive the same keys, speak the same headers and refuse with
|
|
14
|
+
* the same problem — through one call, {@link evaluateRateLimits}. This file is that grammar
|
|
15
|
+
* and nothing else: which counter remembers a key is the caller's ({@link RateLimiter}), so
|
|
16
|
+
* the router binds Cloudflare's native rate-limit binding and a node host binds
|
|
17
|
+
* vertical-host's `memoryRateLimiter`, and the two cannot disagree about what a key or a 429
|
|
18
|
+
* looks like.
|
|
19
|
+
*
|
|
20
|
+
* ## The keys
|
|
21
|
+
*
|
|
22
|
+
* Every key begins `<tenant>:<scope>:<bucket>:`, so one tenant's traffic can never spend
|
|
23
|
+
* another tenant's budget. That is a property of the key, not of a configuration.
|
|
24
|
+
*
|
|
25
|
+
* - **credential**: one budget per caller. A bearer token when the request carries one, else
|
|
26
|
+
* the session cookie a signed-in browser carries, else the client address. A credential is
|
|
27
|
+
* only ever represented by a truncated SHA-256 digest: the raw token or cookie is never
|
|
28
|
+
* part of a key, so it reaches no counter and no log line.
|
|
29
|
+
* - **ip**: one budget per client address, set well above the credential budget. The router
|
|
30
|
+
* cannot verify a bearer, so without it a caller minting a fresh fake token per request
|
|
31
|
+
* would get a fresh credential budget per request too.
|
|
32
|
+
*
|
|
33
|
+
* ## The fail mode
|
|
34
|
+
*
|
|
35
|
+
* Open. A limiter that throws lets the request through, and the caller logs it. The limiter
|
|
36
|
+
* protects capacity; it is not an authorization boundary — every request still meets the
|
|
37
|
+
* vertical's authentication and permission checks — and failing closed would turn an outage
|
|
38
|
+
* of the counter into an outage of every tenant behind it.
|
|
39
|
+
*/
|
|
40
|
+
import { substratError, toProblem, PROBLEM_CONTENT_TYPE } from './errors.js';
|
|
41
|
+
/** RFC 9110 §10.2.3: seconds a client should wait before trying again. */
|
|
42
|
+
export const RETRY_AFTER_HEADER = 'Retry-After';
|
|
43
|
+
/** The policies a response was judged against (draft-ietf-httpapi-ratelimit-headers). */
|
|
44
|
+
export const RATE_LIMIT_POLICY_HEADER = 'RateLimit-Policy';
|
|
45
|
+
/** The state of the policy that refused (same draft): nothing remaining, and when it resets. */
|
|
46
|
+
export const RATE_LIMIT_HEADER = 'RateLimit';
|
|
47
|
+
/**
|
|
48
|
+
* Exposed to a cross-origin browser client — the same trap `IDEMPOTENCY_EXPOSED_HEADERS`
|
|
49
|
+
* documents. An unexposed `Retry-After` is the one that matters: a frontend that cannot
|
|
50
|
+
* read it cannot back off by it.
|
|
51
|
+
*/
|
|
52
|
+
export const RATE_LIMIT_EXPOSED_HEADERS = [RETRY_AFTER_HEADER, RATE_LIMIT_HEADER, RATE_LIMIT_POLICY_HEADER];
|
|
53
|
+
/** The two buckets every request is counted in. */
|
|
54
|
+
export const RATE_LIMIT_BUCKETS = ['credential', 'ip'];
|
|
55
|
+
/**
|
|
56
|
+
* The defaults: conservative, so a normal client never meets them. 1200 a minute per
|
|
57
|
+
* credential is twenty requests a second sustained; the address budget is five times that,
|
|
58
|
+
* so an office behind one NAT, every person on their own session, stays well clear of it.
|
|
59
|
+
* A deployment sets its own (the router's `wrangler.jsonc`, a node host's options).
|
|
60
|
+
*/
|
|
61
|
+
export const DEFAULT_RATE_LIMITS = {
|
|
62
|
+
credential: { limit: 1200, period: 60 },
|
|
63
|
+
ip: { limit: 6000, period: 60 },
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Read a deployment's configured limits, or `undefined` when they are not a complete,
|
|
67
|
+
* well-formed set. Strict on purpose: a typo in a limit must be loud (the caller logs and
|
|
68
|
+
* fails open), never a silently different budget.
|
|
69
|
+
*/
|
|
70
|
+
export function parseRateLimits(value) {
|
|
71
|
+
if (typeof value !== 'object' || value === null)
|
|
72
|
+
return undefined;
|
|
73
|
+
const out = {};
|
|
74
|
+
for (const bucket of RATE_LIMIT_BUCKETS) {
|
|
75
|
+
const policy = value[bucket];
|
|
76
|
+
if (!isPositiveInt(policy?.limit) || !isPositiveInt(policy?.period))
|
|
77
|
+
return undefined;
|
|
78
|
+
out[bucket] = { limit: policy.limit, period: policy.period };
|
|
79
|
+
}
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
const isPositiveInt = (n) => Number.isInteger(n) && n > 0;
|
|
83
|
+
/**
|
|
84
|
+
* The cookies that ARE a signed-in browser's credential: the platform session (oidc-rp's
|
|
85
|
+
* `sb_session`), a capability session (`sb_capability`, one cookie per link since #1686), and
|
|
86
|
+
* Better Auth's session token on an instance using that provider. Any other cookie — a
|
|
87
|
+
* preference, an analytics id — says nothing about who is calling and is ignored.
|
|
88
|
+
*/
|
|
89
|
+
export function isSessionCookie(name) {
|
|
90
|
+
return (name === 'sb_session' ||
|
|
91
|
+
name.startsWith('sb_capability') ||
|
|
92
|
+
name === 'better-auth.session_token' ||
|
|
93
|
+
name === '__Secure-better-auth.session_token');
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The key one request is counted under in one bucket. Async because a credential is hashed
|
|
97
|
+
* (Web Crypto) before it goes anywhere — and only when the credential bucket is counted.
|
|
98
|
+
*/
|
|
99
|
+
export async function rateLimitKey(bucket, subject) {
|
|
100
|
+
const address = subject.clientIp ? `ip:${subject.clientIp}` : 'anon';
|
|
101
|
+
const caller = bucket === 'credential' ? ((await credentialOf(subject.headers)) ?? address) : address;
|
|
102
|
+
return `${subject.tenantId}:${subject.scopeId}:${bucket}:${caller}`;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The caller's credential as a digest: `b:` for a bearer, `s:` for a session cookie set.
|
|
106
|
+
* Every session cookie the request carries is hashed together, sorted, so a browser holding
|
|
107
|
+
* a stale host-only `sb_session` beside its domain one is still one caller.
|
|
108
|
+
*/
|
|
109
|
+
async function credentialOf(headers) {
|
|
110
|
+
const authorization = headers.get('authorization');
|
|
111
|
+
if (authorization)
|
|
112
|
+
return `b:${await digest(authorization)}`;
|
|
113
|
+
const session = sessionCookiesOf(headers.get('cookie'));
|
|
114
|
+
if (session.length > 0)
|
|
115
|
+
return `s:${await digest(session.join('\n'))}`;
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
function sessionCookiesOf(header) {
|
|
119
|
+
if (!header)
|
|
120
|
+
return [];
|
|
121
|
+
const out = [];
|
|
122
|
+
for (const part of header.split(';')) {
|
|
123
|
+
const eq = part.indexOf('=');
|
|
124
|
+
if (eq === -1)
|
|
125
|
+
continue;
|
|
126
|
+
const name = part.slice(0, eq).trim();
|
|
127
|
+
if (isSessionCookie(name))
|
|
128
|
+
out.push(`${name}=${part.slice(eq + 1).trim()}`);
|
|
129
|
+
}
|
|
130
|
+
return out.sort();
|
|
131
|
+
}
|
|
132
|
+
/** 128 bits of SHA-256, hex: unguessable, and short enough to be a counter key. */
|
|
133
|
+
async function digest(text) {
|
|
134
|
+
const bytes = new Uint8Array(await globalThis.crypto.subtle.digest('SHA-256', new TextEncoder().encode(text)));
|
|
135
|
+
let hex = '';
|
|
136
|
+
for (const b of bytes.subarray(0, 16))
|
|
137
|
+
hex += b.toString(16).padStart(2, '0');
|
|
138
|
+
return hex;
|
|
139
|
+
}
|
|
140
|
+
/** The order buckets are counted in: the address first (see {@link evaluateRateLimits}). */
|
|
141
|
+
const COUNTING_ORDER = ['ip', 'credential'];
|
|
142
|
+
/**
|
|
143
|
+
* Count one request in the buckets that have a counter — the whole decision both hosts make.
|
|
144
|
+
*
|
|
145
|
+
* The ADDRESS is counted first, and a request it refuses is never counted against a
|
|
146
|
+
* credential. A credential key is minted from whatever the request sends, so a caller
|
|
147
|
+
* rotating made-up tokens from one address would otherwise create a fresh credential counter
|
|
148
|
+
* with every request it was already refused for — unbounded state in a counter that keeps
|
|
149
|
+
* its keys (the node host's), and spent budget on keys nobody holds. Once the address is
|
|
150
|
+
* over, the credential bucket is not asked.
|
|
151
|
+
*/
|
|
152
|
+
export async function evaluateRateLimits(input) {
|
|
153
|
+
// A CORS preflight is never counted, so never refused: a refused preflight is opaque to the
|
|
154
|
+
// page whatever headers it carries, so the page could not read the 429 its real request
|
|
155
|
+
// would have met. It reaches the vertical's own preflight handler instead.
|
|
156
|
+
if (input.subject.method === 'OPTIONS')
|
|
157
|
+
return { policyHeader: null };
|
|
158
|
+
const buckets = RATE_LIMIT_BUCKETS.filter((bucket) => input.limiters[bucket]);
|
|
159
|
+
if (buckets.length === 0)
|
|
160
|
+
return { policyHeader: null };
|
|
161
|
+
const results = [];
|
|
162
|
+
for (const bucket of COUNTING_ORDER) {
|
|
163
|
+
const limiter = input.limiters[bucket];
|
|
164
|
+
if (!limiter)
|
|
165
|
+
continue;
|
|
166
|
+
try {
|
|
167
|
+
const key = await rateLimitKey(bucket, input.subject);
|
|
168
|
+
results.push({ bucket, success: (await limiter.limit({ key })).success });
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
results.push({ bucket, success: true, error: error instanceof Error ? error.message : String(error) });
|
|
172
|
+
}
|
|
173
|
+
if (!results.at(-1).success)
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
const policyHeader = buckets
|
|
177
|
+
.map((bucket) => `"${bucket}";q=${input.policies[bucket].limit};w=${input.policies[bucket].period}`)
|
|
178
|
+
.join(', ');
|
|
179
|
+
const failed = results.filter((r) => r.error !== undefined);
|
|
180
|
+
const unavailable = failed.length > 0
|
|
181
|
+
? {
|
|
182
|
+
reason: 'the rate limiter threw; the request was let through',
|
|
183
|
+
buckets: failed.map((r) => r.bucket),
|
|
184
|
+
error: failed.map((r) => r.error),
|
|
185
|
+
}
|
|
186
|
+
: undefined;
|
|
187
|
+
const refused = results.find((r) => !r.success)?.bucket;
|
|
188
|
+
return {
|
|
189
|
+
policyHeader,
|
|
190
|
+
...(unavailable ? { unavailable } : {}),
|
|
191
|
+
...(refused
|
|
192
|
+
? {
|
|
193
|
+
refusal: refusalFor(refused, input.policies[refused], policyHeader, {
|
|
194
|
+
instance: input.instance,
|
|
195
|
+
origin: input.subject.headers.get('origin'),
|
|
196
|
+
}),
|
|
197
|
+
}
|
|
198
|
+
: {}),
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The refusal: 429 `application/problem+json` with code `rate_limited`, and the headers a
|
|
203
|
+
* client backs off by. Parts rather than a `Response`, as the rest of this package hands out
|
|
204
|
+
* data: each host builds its own.
|
|
205
|
+
*
|
|
206
|
+
* `Retry-After` is the bucket's whole period. A counter that cannot say where in its window
|
|
207
|
+
* a key sits (Cloudflare's binding cannot) makes the period the only bound that is never
|
|
208
|
+
* too short, and a retry that is too early is just another 429.
|
|
209
|
+
*/
|
|
210
|
+
function refusalFor(bucket, policy, policyHeader, { instance, origin }) {
|
|
211
|
+
const retryAfter = policy.period;
|
|
212
|
+
const body = toProblem(substratError('rate_limited', `Too many requests for this ${bucket === 'ip' ? 'client address' : 'credential'}: ` +
|
|
213
|
+
`at most ${policy.limit} every ${policy.period} seconds. Retry after ${retryAfter} seconds.`, { retryAfter }), instance);
|
|
214
|
+
return {
|
|
215
|
+
status: 429,
|
|
216
|
+
headers: {
|
|
217
|
+
'content-type': PROBLEM_CONTENT_TYPE,
|
|
218
|
+
[RETRY_AFTER_HEADER]: String(retryAfter),
|
|
219
|
+
[RATE_LIMIT_POLICY_HEADER]: policyHeader,
|
|
220
|
+
[RATE_LIMIT_HEADER]: `"${bucket}";r=0;t=${retryAfter}`,
|
|
221
|
+
...(origin ? refusalCors(origin) : {}),
|
|
222
|
+
},
|
|
223
|
+
body,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* CORS for the refusal, and only for it.
|
|
228
|
+
*
|
|
229
|
+
* A refusal is answered before the vertical runs, so the vertical's own CORS policy never
|
|
230
|
+
* sees it. Without these headers a cross-origin page reads a network error rather than a
|
|
231
|
+
* 429, and cannot back off by `Retry-After` — the polling loop this exists to stop keeps
|
|
232
|
+
* polling. The route names no origin allowlist to follow, so the refusal reflects whichever
|
|
233
|
+
* origin asked, credentials included.
|
|
234
|
+
*
|
|
235
|
+
* That is safe for THIS response and would not be for any other: the body and headers are
|
|
236
|
+
* the requester's own rate state — the budget that refused and when to retry — and no vertical
|
|
237
|
+
* data, which is why the policy is built here and never applied to a response the vertical
|
|
238
|
+
* gave.
|
|
239
|
+
*/
|
|
240
|
+
function refusalCors(origin) {
|
|
241
|
+
return {
|
|
242
|
+
'access-control-allow-origin': origin,
|
|
243
|
+
'access-control-allow-credentials': 'true',
|
|
244
|
+
'access-control-expose-headers': RATE_LIMIT_EXPOSED_HEADERS.join(', '),
|
|
245
|
+
vary: 'Origin',
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=rate-limit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limit.js","sourceRoot":"","sources":["../src/rate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z } from 'zod';
|
|
2
2
|
/**
|
|
3
3
|
* The read side of the refusal log (#1745) — a scope-local record of every lifecycle move
|
|
4
|
-
* `assertTransition` refused and
|
|
5
|
-
*
|
|
4
|
+
* `assertTransition` refused, and every manifest-declared guard (K-38) that refused the
|
|
5
|
+
* operation it stands before, where the operation failed with it. Written on the failure
|
|
6
|
+
* path as a write of its own AFTER the rollback it is evidence of.
|
|
6
7
|
*
|
|
7
8
|
* The denial log's sibling, and read the same way (`permissionDenial` / `denialFilter`):
|
|
8
9
|
* a denial is the permission model disagreeing with an actor, a refusal is the lifecycle
|
|
@@ -14,6 +15,8 @@ import { z } from 'zod';
|
|
|
14
15
|
* retrying an illegal move mints a row per attempt), and the window is a storage bound,
|
|
15
16
|
* not a retention promise — rows drain rather than expire.
|
|
16
17
|
*/
|
|
18
|
+
/** What a refusal row stores for a reason outside the `problemReason` grammar. */
|
|
19
|
+
export declare const UNRECOGNIZED_REFUSAL_REASON = "unrecognized";
|
|
17
20
|
/** How many refusal rows an unbounded read returns — a screenful, newest-first. */
|
|
18
21
|
export declare const DEFAULT_REFUSAL_LIMIT = 50;
|
|
19
22
|
/** The hard ceiling on one page of refusal rows. */
|
|
@@ -21,14 +24,15 @@ export declare const REFUSAL_LIMIT_MAX = 200;
|
|
|
21
24
|
/**
|
|
22
25
|
* One recorded refusal.
|
|
23
26
|
*
|
|
24
|
-
* `kind` is `'transition'` for
|
|
25
|
-
*
|
|
26
|
-
* built now does not reject
|
|
27
|
+
* `kind` is `'transition'` for a move the lifecycle refused and `'guard'` for an operation a
|
|
28
|
+
* manifest-declared guard refused (K-38). It is read as text rather than a closed enum so a
|
|
29
|
+
* reader built now does not reject a kind a later kernel writes.
|
|
27
30
|
*/
|
|
28
31
|
export declare const refusalRecord: z.ZodObject<{
|
|
29
32
|
id: z.ZodString;
|
|
30
33
|
kind: z.ZodString;
|
|
31
34
|
reason: z.ZodNullable<z.ZodString>;
|
|
35
|
+
guard: z.ZodNullable<z.ZodString>;
|
|
32
36
|
actor: z.ZodUnion<readonly [z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">, z.ZodObject<{
|
|
33
37
|
system: z.core.$ZodBranded<z.ZodString, "ModuleId", "out">;
|
|
34
38
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -51,7 +55,7 @@ export declare const refusalRecord: z.ZodObject<{
|
|
|
51
55
|
scopeId: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "ScopeId", "out">>;
|
|
52
56
|
entityType: z.ZodNullable<z.ZodString>;
|
|
53
57
|
entityId: z.ZodNullable<z.ZodString>;
|
|
54
|
-
fromState: z.ZodString
|
|
58
|
+
fromState: z.ZodNullable<z.ZodString>;
|
|
55
59
|
attemptedState: z.ZodNullable<z.ZodString>;
|
|
56
60
|
operation: z.ZodString;
|
|
57
61
|
invokedOperation: z.ZodNullable<z.ZodString>;
|
|
@@ -74,6 +78,7 @@ export type RefusalRecord = z.infer<typeof refusalRecord>;
|
|
|
74
78
|
* the object form for any other kind. The stored encoding is the reader's problem.
|
|
75
79
|
*/
|
|
76
80
|
export declare const refusalFilter: z.ZodObject<{
|
|
81
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
77
82
|
entityType: z.ZodOptional<z.ZodString>;
|
|
78
83
|
entityId: z.ZodOptional<z.ZodString>;
|
|
79
84
|
actor: z.ZodOptional<z.ZodString>;
|
|
@@ -84,4 +89,42 @@ export declare const refusalFilter: z.ZodObject<{
|
|
|
84
89
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
85
90
|
}, z.core.$strip>;
|
|
86
91
|
export type RefusalFilter = z.infer<typeof refusalFilter>;
|
|
92
|
+
/**
|
|
93
|
+
* Name the record a refusal is about, on the error that carries it (#1745).
|
|
94
|
+
*
|
|
95
|
+
* For a guard predicate (K-38): the kernel records a guard's refusal, but only the predicate
|
|
96
|
+
* knows which record it judged — its config says where the id is, and the kernel does not
|
|
97
|
+
* read a predicate's config. A predicate that names it lets the process map count the
|
|
98
|
+
* refusal against that record; one that does not is still recorded, with the record unknown.
|
|
99
|
+
*
|
|
100
|
+
* Carried under a registered symbol for the reason `RefusedTransition` is: the record's id
|
|
101
|
+
* is the scope's to keep, never part of the problem document the caller is handed. Returns
|
|
102
|
+
* the error, so a throw site reads `throw nameRefusedRecord(conflict(…), ref)`.
|
|
103
|
+
*/
|
|
104
|
+
export declare function nameRefusedRecord<E>(err: E, ref: {
|
|
105
|
+
entityType: string;
|
|
106
|
+
entityId: string;
|
|
107
|
+
}): E;
|
|
108
|
+
/** The record `nameRefusedRecord` put on an error, or null. */
|
|
109
|
+
export declare function refusedRecordOf(err: unknown): {
|
|
110
|
+
entityType: string;
|
|
111
|
+
entityId: string;
|
|
112
|
+
} | null;
|
|
113
|
+
/** What a refusal row stores as its entity type when the one it was handed is not one. */
|
|
114
|
+
export declare const UNDECLARED_ENTITY_TYPE = "undeclared";
|
|
115
|
+
/** The longest entity type a refusal row keeps. */
|
|
116
|
+
export declare const REFUSAL_ENTITY_TYPE_MAX = 64;
|
|
117
|
+
/**
|
|
118
|
+
* The entity type a refusal row keeps (#1745): the one it was handed when that is spelled as
|
|
119
|
+
* an entity type — the tuple namespace grammar (`OBJECT_NAMESPACE`, which `ctx.link` and every
|
|
120
|
+
* entity-narrowed grant are held to), not a kernel namespace, at most
|
|
121
|
+
* `REFUSAL_ENTITY_TYPE_MAX` — and `UNDECLARED_ENTITY_TYPE` otherwise. Null stays null: the
|
|
122
|
+
* record was not named.
|
|
123
|
+
*
|
|
124
|
+
* Needed because the type reaches a row from code that is handed request data — a guard
|
|
125
|
+
* predicate naming its record with `nameRefusedRecord` — and the ref takes any string. The
|
|
126
|
+
* grammar refuses an address, a sentence, anything with a space; it cannot tell a bare word
|
|
127
|
+
* from a type, which no runtime registry of a scope's entity types exists to do.
|
|
128
|
+
*/
|
|
129
|
+
export declare function refusalEntityType(entityType: string | null): string | null;
|
|
87
130
|
//# sourceMappingURL=refusal.d.ts.map
|
package/dist/refusal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refusal.d.ts","sourceRoot":"","sources":["../src/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"refusal.d.ts","sourceRoot":"","sources":["../src/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;;;;;;;;;;;;;GAeG;AAEH,kFAAkF;AAClF,eAAO,MAAM,2BAA2B,iBAAiB,CAAC;AAE1D,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,KAAK,CAAC;AACxC,oDAAoD;AACpD,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoDxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;iBAaxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,CAAC,CAK7F;AAID,+DAA+D;AAC/D,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAI7F;AAED,0FAA0F;AAC1F,eAAO,MAAM,sBAAsB,eAAe,CAAC;AACnD,mDAAmD;AACnD,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAO1E"}
|
package/dist/refusal.js
CHANGED
|
@@ -3,10 +3,12 @@ import { actor } from './events.js';
|
|
|
3
3
|
import { impersonationStamp } from './impersonation.js';
|
|
4
4
|
import { scopeId, tenantId } from './ids.js';
|
|
5
5
|
import { lifecycleActorKind } from './lifecycle-flow.js';
|
|
6
|
+
import { OBJECT_NAMESPACE, isKernelNamespace } from './object-ref.js';
|
|
6
7
|
/**
|
|
7
8
|
* The read side of the refusal log (#1745) — a scope-local record of every lifecycle move
|
|
8
|
-
* `assertTransition` refused and
|
|
9
|
-
*
|
|
9
|
+
* `assertTransition` refused, and every manifest-declared guard (K-38) that refused the
|
|
10
|
+
* operation it stands before, where the operation failed with it. Written on the failure
|
|
11
|
+
* path as a write of its own AFTER the rollback it is evidence of.
|
|
10
12
|
*
|
|
11
13
|
* The denial log's sibling, and read the same way (`permissionDenial` / `denialFilter`):
|
|
12
14
|
* a denial is the permission model disagreeing with an actor, a refusal is the lifecycle
|
|
@@ -18,6 +20,8 @@ import { lifecycleActorKind } from './lifecycle-flow.js';
|
|
|
18
20
|
* retrying an illegal move mints a row per attempt), and the window is a storage bound,
|
|
19
21
|
* not a retention promise — rows drain rather than expire.
|
|
20
22
|
*/
|
|
23
|
+
/** What a refusal row stores for a reason outside the `problemReason` grammar. */
|
|
24
|
+
export const UNRECOGNIZED_REFUSAL_REASON = 'unrecognized';
|
|
21
25
|
/** How many refusal rows an unbounded read returns — a screenful, newest-first. */
|
|
22
26
|
export const DEFAULT_REFUSAL_LIMIT = 50;
|
|
23
27
|
/** The hard ceiling on one page of refusal rows. */
|
|
@@ -25,34 +29,46 @@ export const REFUSAL_LIMIT_MAX = 200;
|
|
|
25
29
|
/**
|
|
26
30
|
* One recorded refusal.
|
|
27
31
|
*
|
|
28
|
-
* `kind` is `'transition'` for
|
|
29
|
-
*
|
|
30
|
-
* built now does not reject
|
|
32
|
+
* `kind` is `'transition'` for a move the lifecycle refused and `'guard'` for an operation a
|
|
33
|
+
* manifest-declared guard refused (K-38). It is read as text rather than a closed enum so a
|
|
34
|
+
* reader built now does not reject a kind a later kernel writes.
|
|
31
35
|
*/
|
|
32
36
|
export const refusalRecord = z.object({
|
|
33
37
|
/** ULID — chronological, so it is also the sort key. */
|
|
34
38
|
id: z.string().min(1),
|
|
35
39
|
kind: z.string().min(1),
|
|
36
40
|
/**
|
|
37
|
-
* The problem code the operation failed with — `
|
|
38
|
-
*
|
|
39
|
-
*
|
|
41
|
+
* The problem code the operation failed with — the `reason` on the 409 the caller received:
|
|
42
|
+
* `invalid_transition` for a transition refusal, the predicate's own (`protocol_required`)
|
|
43
|
+
* for a guard. Null when the refusal carried none and the kind implies none, and
|
|
44
|
+
* `UNRECOGNIZED_REFUSAL_REASON` when it carried one outside the `problemReason` grammar —
|
|
45
|
+
* kept as a code, never as whatever text the thrower put there.
|
|
40
46
|
*/
|
|
41
47
|
reason: z.string().nullable(),
|
|
48
|
+
/** The guard's named predicate (`protocol/all-signed`) on a `'guard'` row; null otherwise. */
|
|
49
|
+
guard: z.string().nullable(),
|
|
42
50
|
/** WHO attempted the move: a principal, a `{ system }` module, a `{ connection }`, … */
|
|
43
51
|
actor,
|
|
44
52
|
/** The actor's kind, read off its stored shape — what the process map counts by. */
|
|
45
53
|
actorKind: lifecycleActorKind,
|
|
46
54
|
tenantId,
|
|
47
55
|
scopeId: scopeId.nullable(),
|
|
48
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* The record the refusal was about. Null when the refusing code did not name it — the
|
|
58
|
+
* caller of `assertTransition`, or a guard predicate that did not `nameRefusedRecord`.
|
|
59
|
+
* The type is `UNDECLARED_ENTITY_TYPE` when what it was handed is not spelled as one
|
|
60
|
+
* (`refusalEntityType`).
|
|
61
|
+
*/
|
|
49
62
|
entityType: z.string().nullable(),
|
|
50
63
|
entityId: z.string().nullable(),
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
/**
|
|
65
|
+
* The state the record was in. Null on a `'guard'` row: a guard stands before an operation,
|
|
66
|
+
* and the kernel that ran it does not know the state of the record behind it.
|
|
67
|
+
*/
|
|
68
|
+
fromState: z.string().nullable(),
|
|
69
|
+
/** Where the operation leads where it IS legal; null when that is not one state, and on a guard. */
|
|
54
70
|
attemptedState: z.string().nullable(),
|
|
55
|
-
/** The lifecycle's operation — what the edge is keyed by. */
|
|
71
|
+
/** The lifecycle's operation — what the edge is keyed by — or the operation the guard stands before. */
|
|
56
72
|
operation: z.string(),
|
|
57
73
|
/** The `invoke()` string the call ran as. The same as `operation` for every caller today. */
|
|
58
74
|
invokedOperation: z.string().nullable(),
|
|
@@ -79,6 +95,8 @@ export const refusalRecord = z.object({
|
|
|
79
95
|
* the object form for any other kind. The stored encoding is the reader's problem.
|
|
80
96
|
*/
|
|
81
97
|
export const refusalFilter = z.object({
|
|
98
|
+
/** `'transition'` or `'guard'`; every kind when absent. */
|
|
99
|
+
kind: z.string().min(1).optional(),
|
|
82
100
|
entityType: z.string().min(1).optional(),
|
|
83
101
|
entityId: z.string().min(1).optional(),
|
|
84
102
|
actor: z.string().min(1).optional(),
|
|
@@ -90,4 +108,55 @@ export const refusalFilter = z.object({
|
|
|
90
108
|
until: z.string().min(1).optional(),
|
|
91
109
|
limit: z.number().int().min(1).max(REFUSAL_LIMIT_MAX).optional(),
|
|
92
110
|
});
|
|
111
|
+
/**
|
|
112
|
+
* Name the record a refusal is about, on the error that carries it (#1745).
|
|
113
|
+
*
|
|
114
|
+
* For a guard predicate (K-38): the kernel records a guard's refusal, but only the predicate
|
|
115
|
+
* knows which record it judged — its config says where the id is, and the kernel does not
|
|
116
|
+
* read a predicate's config. A predicate that names it lets the process map count the
|
|
117
|
+
* refusal against that record; one that does not is still recorded, with the record unknown.
|
|
118
|
+
*
|
|
119
|
+
* Carried under a registered symbol for the reason `RefusedTransition` is: the record's id
|
|
120
|
+
* is the scope's to keep, never part of the problem document the caller is handed. Returns
|
|
121
|
+
* the error, so a throw site reads `throw nameRefusedRecord(conflict(…), ref)`.
|
|
122
|
+
*/
|
|
123
|
+
export function nameRefusedRecord(err, ref) {
|
|
124
|
+
if (err !== null && typeof err === 'object') {
|
|
125
|
+
err[REFUSED_RECORD] = { entityType: ref.entityType, entityId: ref.entityId };
|
|
126
|
+
}
|
|
127
|
+
return err;
|
|
128
|
+
}
|
|
129
|
+
const REFUSED_RECORD = Symbol.for('substrat.refused-record');
|
|
130
|
+
/** The record `nameRefusedRecord` put on an error, or null. */
|
|
131
|
+
export function refusedRecordOf(err) {
|
|
132
|
+
if (err === null || typeof err !== 'object')
|
|
133
|
+
return null;
|
|
134
|
+
const r = err[REFUSED_RECORD];
|
|
135
|
+
return r !== null && typeof r === 'object' ? r : null;
|
|
136
|
+
}
|
|
137
|
+
/** What a refusal row stores as its entity type when the one it was handed is not one. */
|
|
138
|
+
export const UNDECLARED_ENTITY_TYPE = 'undeclared';
|
|
139
|
+
/** The longest entity type a refusal row keeps. */
|
|
140
|
+
export const REFUSAL_ENTITY_TYPE_MAX = 64;
|
|
141
|
+
/**
|
|
142
|
+
* The entity type a refusal row keeps (#1745): the one it was handed when that is spelled as
|
|
143
|
+
* an entity type — the tuple namespace grammar (`OBJECT_NAMESPACE`, which `ctx.link` and every
|
|
144
|
+
* entity-narrowed grant are held to), not a kernel namespace, at most
|
|
145
|
+
* `REFUSAL_ENTITY_TYPE_MAX` — and `UNDECLARED_ENTITY_TYPE` otherwise. Null stays null: the
|
|
146
|
+
* record was not named.
|
|
147
|
+
*
|
|
148
|
+
* Needed because the type reaches a row from code that is handed request data — a guard
|
|
149
|
+
* predicate naming its record with `nameRefusedRecord` — and the ref takes any string. The
|
|
150
|
+
* grammar refuses an address, a sentence, anything with a space; it cannot tell a bare word
|
|
151
|
+
* from a type, which no runtime registry of a scope's entity types exists to do.
|
|
152
|
+
*/
|
|
153
|
+
export function refusalEntityType(entityType) {
|
|
154
|
+
if (entityType === null)
|
|
155
|
+
return null;
|
|
156
|
+
return entityType.length <= REFUSAL_ENTITY_TYPE_MAX &&
|
|
157
|
+
OBJECT_NAMESPACE.test(entityType) &&
|
|
158
|
+
!isKernelNamespace(entityType)
|
|
159
|
+
? entityType
|
|
160
|
+
: UNDECLARED_ENTITY_TYPE;
|
|
161
|
+
}
|
|
93
162
|
//# sourceMappingURL=refusal.js.map
|
package/dist/refusal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refusal.js","sourceRoot":"","sources":["../src/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"refusal.js","sourceRoot":"","sources":["../src/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEtE;;;;;;;;;;;;;;;GAeG;AAEH,kFAAkF;AAClF,MAAM,CAAC,MAAM,2BAA2B,GAAG,cAAc,CAAC;AAE1D,mFAAmF;AACnF,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACxC,oDAAoD;AACp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export type VerticalServingState = z.infer<typeof verticalServingState>;
|
|
73
73
|
export declare const registerVerticalInput: z.ZodObject<{
|
|
74
|
-
slug: z.ZodString;
|
|
75
74
|
name: z.ZodString;
|
|
76
75
|
source: z.ZodEnum<{
|
|
77
76
|
builtin: "builtin";
|
|
@@ -99,6 +98,7 @@ export declare const registerVerticalInput: z.ZodObject<{
|
|
|
99
98
|
listed: z.ZodDefault<z.ZodBoolean>;
|
|
100
99
|
provisions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
101
100
|
sendsEmail: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
slug: z.ZodString;
|
|
102
102
|
ownerTenant: z.ZodDefault<z.ZodNullable<z.core.$ZodBranded<z.ZodString, "TenantId", "out">>>;
|
|
103
103
|
}, z.core.$strip>;
|
|
104
104
|
export type RegisterVerticalInput = z.input<typeof registerVerticalInput>;
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;;;;;;;;GAUG;AAEH,yFAAyF;AACzF,eAAO,MAAM,cAAc;;;;EAAoC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuHnB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;iBAK/B,CAAC;AACH,MA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BAS9B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB;;;;iBAUnC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEhF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;kBAAgE,CAAC;AACjG,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
package/dist/registry.js
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { instant, permissionKey, tenantId, verticalSlug } from './ids.js';
|
|
3
3
|
import { envVarSpec, capability } from './manifest.js';
|
|
4
4
|
import { declaredSurface } from './routing.js';
|
|
5
|
+
import { platformScriptCollision, platformScriptRefusal } from './script-names.js';
|
|
5
6
|
/**
|
|
6
7
|
* The vertical + version registry (#31 step 1; D-33's milestone one).
|
|
7
8
|
*
|
|
@@ -151,6 +152,16 @@ export const verticalServingState = z.object({
|
|
|
151
152
|
export const registerVerticalInput = vertical
|
|
152
153
|
.pick({ slug: true, name: true, source: true, envSpec: true, entitlements: true, ownerGrants: true, provides: true, requires: true, provisions: true, sendsEmail: true, surfaces: true, listed: true })
|
|
153
154
|
.extend({
|
|
155
|
+
/**
|
|
156
|
+
* #1923: a slug that would deploy under one of the platform's own script names is refused
|
|
157
|
+
* here, at the claim, because its logs would be indistinguishable from that worker's.
|
|
158
|
+
* Refused on the INPUT only: a stored record is read back with the plain `vertical` schema.
|
|
159
|
+
*/
|
|
160
|
+
slug: verticalSlug.superRefine((slug, ctx) => {
|
|
161
|
+
const collision = platformScriptCollision(slug);
|
|
162
|
+
if (collision)
|
|
163
|
+
ctx.addIssue({ code: 'custom', message: platformScriptRefusal(slug, collision) });
|
|
164
|
+
}),
|
|
154
165
|
// Optional on input — a staff/platform push omits it (⇒ platform-owned).
|
|
155
166
|
ownerTenant: tenantId.nullable().default(null),
|
|
156
167
|
});
|
package/dist/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEnF;;;;;;;;;;GAUG;AAEH,yFAAyF;AACzF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAGhE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,YAAY,EAAE,iFAAiF;IACrG,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,MAAM,EAAE,cAAc;IACtB;;;;;OAKG;IACH,WAAW,EAAE,QAAQ,CAAC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