@astrale-os/sdk 0.6.0-beta.17 → 0.6.0-beta.18
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.
|
@@ -8,6 +8,17 @@ const MAXIMUM_DISCOVERY_BYTES = 256 * 1024;
|
|
|
8
8
|
const MAXIMUM_VERIFICATION_BASES = 64;
|
|
9
9
|
const VERIFICATION_BASIS_TTL_MS = 60_000;
|
|
10
10
|
const UNKNOWN_KEY_REFRESH_COOLDOWN_MS = 60_000;
|
|
11
|
+
const DISCOVERY_RETRY_DELAY_MS = 250;
|
|
12
|
+
// Only typed transport failures are replayable. Browser TypeError, TLS, HTTP and document
|
|
13
|
+
// admission failures carry no evidence that repeating the request can safely recover.
|
|
14
|
+
const TRANSIENT_TRANSPORT_CODES = new Set([
|
|
15
|
+
'ENOTFOUND',
|
|
16
|
+
'EAI_AGAIN',
|
|
17
|
+
'ECONNRESET',
|
|
18
|
+
'ETIMEDOUT',
|
|
19
|
+
'UND_ERR_CONNECT_TIMEOUT',
|
|
20
|
+
'UND_ERR_SOCKET',
|
|
21
|
+
]);
|
|
11
22
|
/**
|
|
12
23
|
* Retain only recently admitted public issuer material for one execution Identity.
|
|
13
24
|
* An unseen key ID may refresh once per cooldown; failures never replace a usable basis.
|
|
@@ -220,21 +231,55 @@ async function discover(issuer, fetch, signal, policy) {
|
|
|
220
231
|
});
|
|
221
232
|
}
|
|
222
233
|
async function request(fetch, url, signal) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
await
|
|
227
|
-
|
|
234
|
+
for (let attempt = 0;; attempt += 1) {
|
|
235
|
+
signal.throwIfAborted();
|
|
236
|
+
try {
|
|
237
|
+
const response = await fetch(url, { method: 'GET', redirect: 'error', signal });
|
|
238
|
+
if (!response.ok) {
|
|
239
|
+
await response.body?.cancel();
|
|
240
|
+
throw new IssuerUnavailable(`Issuer discovery returned HTTP ${response.status}.`);
|
|
241
|
+
}
|
|
242
|
+
return response;
|
|
243
|
+
}
|
|
244
|
+
catch (cause) {
|
|
245
|
+
if (signal.aborted)
|
|
246
|
+
throw signal.reason;
|
|
247
|
+
if (cause instanceof IssuerUnavailable)
|
|
248
|
+
throw cause;
|
|
249
|
+
// One retry belongs to the shared issuer load, never to each observer or business call.
|
|
250
|
+
if (attempt !== 0 || !transientTransport(cause)) {
|
|
251
|
+
throw new IssuerUnavailable('Issuer discovery request failed.', cause);
|
|
252
|
+
}
|
|
253
|
+
await retryDelay(signal);
|
|
228
254
|
}
|
|
229
|
-
return response;
|
|
230
255
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
256
|
+
}
|
|
257
|
+
function transientTransport(cause) {
|
|
258
|
+
// Node fetch wraps its transport Error; Bun may expose the code directly. Bound traversal
|
|
259
|
+
// of an external cause chain, including cycles, and do not look past a classified refusal.
|
|
260
|
+
for (let depth = 0; depth < 4; depth += 1) {
|
|
261
|
+
if (cause === null || typeof cause !== 'object')
|
|
262
|
+
return false;
|
|
263
|
+
const code = Reflect.get(cause, 'code');
|
|
264
|
+
if (typeof code === 'string')
|
|
265
|
+
return TRANSIENT_TRANSPORT_CODES.has(code);
|
|
266
|
+
cause = Reflect.get(cause, 'cause');
|
|
237
267
|
}
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
function retryDelay(signal) {
|
|
271
|
+
signal.throwIfAborted();
|
|
272
|
+
return new Promise((resolve, reject) => {
|
|
273
|
+
const cancel = () => {
|
|
274
|
+
clearTimeout(timer);
|
|
275
|
+
reject(signal.reason);
|
|
276
|
+
};
|
|
277
|
+
const timer = setTimeout(() => {
|
|
278
|
+
signal.removeEventListener('abort', cancel);
|
|
279
|
+
resolve();
|
|
280
|
+
}, DISCOVERY_RETRY_DELAY_MS);
|
|
281
|
+
signal.addEventListener('abort', cancel, { once: true });
|
|
282
|
+
});
|
|
238
283
|
}
|
|
239
284
|
async function json(response, signal) {
|
|
240
285
|
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
@@ -3,6 +3,11 @@ import { type Property as CanonicalProperty, type ValueSchemaInput } from '@astr
|
|
|
3
3
|
export interface PropertyOptions {
|
|
4
4
|
readonly required?: boolean;
|
|
5
5
|
readonly description?: string;
|
|
6
|
+
/**
|
|
7
|
+
* `create` freezes the value when its node or edge is created. `once` admits one write while the
|
|
8
|
+
* value is absent; neither can be changed or unset afterwards, only removed with the element.
|
|
9
|
+
*/
|
|
10
|
+
readonly immutable?: 'create' | 'once';
|
|
6
11
|
}
|
|
7
12
|
/** Keep canonical generic inference: ordinary properties carry no state machine. */
|
|
8
13
|
export type AuthoredProperty<Schema extends ValueSchemaInput, Options extends PropertyOptions = Record<never, never>> = CanonicalProperty<Schema, Options, never>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/sdk",
|
|
3
|
-
"version": "0.6.0-beta.
|
|
3
|
+
"version": "0.6.0-beta.18",
|
|
4
4
|
"description": "Schema-first SDK for defining, composing, and deploying Astrale domains",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astrale",
|
|
@@ -253,11 +253,11 @@
|
|
|
253
253
|
"registry": "https://registry.npmjs.org/"
|
|
254
254
|
},
|
|
255
255
|
"dependencies": {
|
|
256
|
-
"@astrale-os/kernel-client": "0.6.0-beta.
|
|
257
|
-
"@astrale-os/kernel-core": "0.9.0-beta.
|
|
258
|
-
"@astrale-os/kernel-dsl": "0.2.0-beta.
|
|
259
|
-
"@astrale-os/kernel-protocol": "0.5.0-beta.
|
|
260
|
-
"@astrale-os/kernel-server": "0.5.0-beta.
|
|
256
|
+
"@astrale-os/kernel-client": "0.6.0-beta.85",
|
|
257
|
+
"@astrale-os/kernel-core": "0.9.0-beta.64",
|
|
258
|
+
"@astrale-os/kernel-dsl": "0.2.0-beta.46",
|
|
259
|
+
"@astrale-os/kernel-protocol": "0.5.0-beta.70",
|
|
260
|
+
"@astrale-os/kernel-server": "0.5.0-beta.72",
|
|
261
261
|
"@lucide/icons": "1.34.0",
|
|
262
262
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
263
263
|
"cross-spawn": "7.0.6",
|