@tinycloud/node-sdk 2.11.0-beta.3 → 2.11.0-beta.5
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/{core-DfcWH9i4.d.cts → core-ool1expK.d.cts} +27 -6
- package/dist/{core-DfcWH9i4.d.ts → core-ool1expK.d.ts} +27 -6
- package/dist/core.cjs +30 -9
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +30 -9
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +30 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +30 -9
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -195,9 +195,9 @@ interface NodeUserAuthorizationConfig {
|
|
|
195
195
|
tinycloudRegistryUrl?: string | null;
|
|
196
196
|
/** Fallback TinyCloud hosts. Default: hosted TinyCloud node. */
|
|
197
197
|
tinycloudFallbackHosts?: string[] | null;
|
|
198
|
-
/** Probe
|
|
198
|
+
/** Probe configured/registered local nodes before registry/fallback resolution. Default: true. */
|
|
199
199
|
autoDiscoverLocalNode?: boolean;
|
|
200
|
-
/** Local loopback node URL to probe.
|
|
200
|
+
/** Local loopback node URL to probe. Omit to avoid probing loopback. */
|
|
201
201
|
localNodeUrl?: string;
|
|
202
202
|
/** Known `*.local.tinycloud.link` subdomain name, probed directly. */
|
|
203
203
|
localLinkName?: string;
|
|
@@ -900,9 +900,9 @@ interface TinyCloudNodeConfig {
|
|
|
900
900
|
tinycloudRegistryUrl?: string | null;
|
|
901
901
|
/** Fallback TinyCloud hosts. Default: hosted TinyCloud node. */
|
|
902
902
|
tinycloudFallbackHosts?: string[] | null;
|
|
903
|
-
/** Probe
|
|
903
|
+
/** Probe configured/registered local nodes before registry/fallback resolution. Default: true. */
|
|
904
904
|
autoDiscoverLocalNode?: boolean;
|
|
905
|
-
/** Local loopback node URL to probe.
|
|
905
|
+
/** Local loopback node URL to probe. Omit to avoid probing loopback. */
|
|
906
906
|
localNodeUrl?: string;
|
|
907
907
|
/** Known `*.local.tinycloud.link` subdomain name, probed directly. */
|
|
908
908
|
localLinkName?: string;
|
|
@@ -1026,6 +1026,23 @@ interface NodeDefaults {
|
|
|
1026
1026
|
createWasmBindings: () => IWasmBindings;
|
|
1027
1027
|
createSigner: (privateKey: string, chainId?: number) => ISigner;
|
|
1028
1028
|
}
|
|
1029
|
+
/**
|
|
1030
|
+
* A bootstrap step that COMPLETED but did so in a degraded way — e.g. a KV
|
|
1031
|
+
* batch write that failed ambiguously and was recovered by per-space
|
|
1032
|
+
* reconciliation. Structured (not prose) so callers can branch on `kind` and
|
|
1033
|
+
* `code` without parsing messages (TC-361).
|
|
1034
|
+
*/
|
|
1035
|
+
interface BootstrapWarning {
|
|
1036
|
+
/** The BootstrapStep.id that degraded, e.g. "account:seed-spaces"
|
|
1037
|
+
* (BootstrapStepBase.id — packages/bootstrap/src/index.ts:642-645). */
|
|
1038
|
+
stepId: string;
|
|
1039
|
+
/** What kind of degradation. Additive union; one member today. */
|
|
1040
|
+
kind: "batch-write-reconciled";
|
|
1041
|
+
/** ServiceError.code of the underlying failure that was recovered from. */
|
|
1042
|
+
code: string;
|
|
1043
|
+
/** Human-readable detail. Diagnostics only — never parse this. */
|
|
1044
|
+
message: string;
|
|
1045
|
+
}
|
|
1029
1046
|
declare class TinyCloudNode {
|
|
1030
1047
|
/** @internal Registered by importing @tinycloud/node-sdk (not /core) */
|
|
1031
1048
|
private static nodeDefaults?;
|
|
@@ -1095,7 +1112,10 @@ declare class TinyCloudNode {
|
|
|
1095
1112
|
* Outcome of the last signIn()'s account-bootstrap attempt. `skipped` is
|
|
1096
1113
|
* true when bootstrap did not complete (interactive signer, auto-sign
|
|
1097
1114
|
* denied, or a bootstrap step failed); `reason` carries the cause so apps
|
|
1098
|
-
* can surface a "finish account setup" call-to-action.
|
|
1115
|
+
* can surface a "finish account setup" call-to-action. `warnings` is
|
|
1116
|
+
* present when bootstrap completed, but one or more steps recovered from
|
|
1117
|
+
* an ambiguous failure (e.g. a KV batch write reconciled via per-space
|
|
1118
|
+
* fallback) — clean vs. recovered runs are otherwise byte-identical.
|
|
1099
1119
|
*/
|
|
1100
1120
|
private _bootstrapStatus;
|
|
1101
1121
|
/** Whether the last signIn() skipped client-side bootstrap because the
|
|
@@ -1105,6 +1125,7 @@ declare class TinyCloudNode {
|
|
|
1105
1125
|
get bootstrapStatus(): {
|
|
1106
1126
|
skipped: boolean;
|
|
1107
1127
|
reason?: string;
|
|
1128
|
+
warnings?: BootstrapWarning[];
|
|
1108
1129
|
};
|
|
1109
1130
|
private get nodeFeatures();
|
|
1110
1131
|
/** SIWE domain — uses config override or defaults to app.tinycloud.xyz */
|
|
@@ -2232,4 +2253,4 @@ declare class WasmKeyProvider implements KeyProvider {
|
|
|
2232
2253
|
*/
|
|
2233
2254
|
declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
|
|
2234
2255
|
|
|
2235
|
-
export { type AuthDelegationArtifact as A, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SecretPermissionHint as S, TinyCloudNode as T, UnsupportedSessionRestoreError as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, type AuthRequestArtifact as a, type DelegateToResult as b, DelegatedAccess as c, type DelegationAuthority as d, NodeUserAuthorization as e, type NodeUserAuthorizationConfig as f, type RuntimeDelegationActivator as g, type RuntimePermissionGrantOptions as h, type SecretReadInput as i, type SecretReadResult as j, type SignStrategy as k, type TinyCloudNodeConfig as l, type WasmKeyProviderConfig as m, activateValidatedRuntimeDelegation as n, createWasmKeyProvider as o, defaultSignStrategy as p, deserializeDelegation as q, grantAuthRequest as r, serializeDelegation as s };
|
|
2256
|
+
export { type AuthDelegationArtifact as A, type BootstrapWarning as B, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SecretPermissionHint as S, TinyCloudNode as T, UnsupportedSessionRestoreError as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, type AuthRequestArtifact as a, type DelegateToResult as b, DelegatedAccess as c, type DelegationAuthority as d, NodeUserAuthorization as e, type NodeUserAuthorizationConfig as f, type RuntimeDelegationActivator as g, type RuntimePermissionGrantOptions as h, type SecretReadInput as i, type SecretReadResult as j, type SignStrategy as k, type TinyCloudNodeConfig as l, type WasmKeyProviderConfig as m, activateValidatedRuntimeDelegation as n, createWasmKeyProvider as o, defaultSignStrategy as p, deserializeDelegation as q, grantAuthRequest as r, serializeDelegation as s };
|
|
@@ -195,9 +195,9 @@ interface NodeUserAuthorizationConfig {
|
|
|
195
195
|
tinycloudRegistryUrl?: string | null;
|
|
196
196
|
/** Fallback TinyCloud hosts. Default: hosted TinyCloud node. */
|
|
197
197
|
tinycloudFallbackHosts?: string[] | null;
|
|
198
|
-
/** Probe
|
|
198
|
+
/** Probe configured/registered local nodes before registry/fallback resolution. Default: true. */
|
|
199
199
|
autoDiscoverLocalNode?: boolean;
|
|
200
|
-
/** Local loopback node URL to probe.
|
|
200
|
+
/** Local loopback node URL to probe. Omit to avoid probing loopback. */
|
|
201
201
|
localNodeUrl?: string;
|
|
202
202
|
/** Known `*.local.tinycloud.link` subdomain name, probed directly. */
|
|
203
203
|
localLinkName?: string;
|
|
@@ -900,9 +900,9 @@ interface TinyCloudNodeConfig {
|
|
|
900
900
|
tinycloudRegistryUrl?: string | null;
|
|
901
901
|
/** Fallback TinyCloud hosts. Default: hosted TinyCloud node. */
|
|
902
902
|
tinycloudFallbackHosts?: string[] | null;
|
|
903
|
-
/** Probe
|
|
903
|
+
/** Probe configured/registered local nodes before registry/fallback resolution. Default: true. */
|
|
904
904
|
autoDiscoverLocalNode?: boolean;
|
|
905
|
-
/** Local loopback node URL to probe.
|
|
905
|
+
/** Local loopback node URL to probe. Omit to avoid probing loopback. */
|
|
906
906
|
localNodeUrl?: string;
|
|
907
907
|
/** Known `*.local.tinycloud.link` subdomain name, probed directly. */
|
|
908
908
|
localLinkName?: string;
|
|
@@ -1026,6 +1026,23 @@ interface NodeDefaults {
|
|
|
1026
1026
|
createWasmBindings: () => IWasmBindings;
|
|
1027
1027
|
createSigner: (privateKey: string, chainId?: number) => ISigner;
|
|
1028
1028
|
}
|
|
1029
|
+
/**
|
|
1030
|
+
* A bootstrap step that COMPLETED but did so in a degraded way — e.g. a KV
|
|
1031
|
+
* batch write that failed ambiguously and was recovered by per-space
|
|
1032
|
+
* reconciliation. Structured (not prose) so callers can branch on `kind` and
|
|
1033
|
+
* `code` without parsing messages (TC-361).
|
|
1034
|
+
*/
|
|
1035
|
+
interface BootstrapWarning {
|
|
1036
|
+
/** The BootstrapStep.id that degraded, e.g. "account:seed-spaces"
|
|
1037
|
+
* (BootstrapStepBase.id — packages/bootstrap/src/index.ts:642-645). */
|
|
1038
|
+
stepId: string;
|
|
1039
|
+
/** What kind of degradation. Additive union; one member today. */
|
|
1040
|
+
kind: "batch-write-reconciled";
|
|
1041
|
+
/** ServiceError.code of the underlying failure that was recovered from. */
|
|
1042
|
+
code: string;
|
|
1043
|
+
/** Human-readable detail. Diagnostics only — never parse this. */
|
|
1044
|
+
message: string;
|
|
1045
|
+
}
|
|
1029
1046
|
declare class TinyCloudNode {
|
|
1030
1047
|
/** @internal Registered by importing @tinycloud/node-sdk (not /core) */
|
|
1031
1048
|
private static nodeDefaults?;
|
|
@@ -1095,7 +1112,10 @@ declare class TinyCloudNode {
|
|
|
1095
1112
|
* Outcome of the last signIn()'s account-bootstrap attempt. `skipped` is
|
|
1096
1113
|
* true when bootstrap did not complete (interactive signer, auto-sign
|
|
1097
1114
|
* denied, or a bootstrap step failed); `reason` carries the cause so apps
|
|
1098
|
-
* can surface a "finish account setup" call-to-action.
|
|
1115
|
+
* can surface a "finish account setup" call-to-action. `warnings` is
|
|
1116
|
+
* present when bootstrap completed, but one or more steps recovered from
|
|
1117
|
+
* an ambiguous failure (e.g. a KV batch write reconciled via per-space
|
|
1118
|
+
* fallback) — clean vs. recovered runs are otherwise byte-identical.
|
|
1099
1119
|
*/
|
|
1100
1120
|
private _bootstrapStatus;
|
|
1101
1121
|
/** Whether the last signIn() skipped client-side bootstrap because the
|
|
@@ -1105,6 +1125,7 @@ declare class TinyCloudNode {
|
|
|
1105
1125
|
get bootstrapStatus(): {
|
|
1106
1126
|
skipped: boolean;
|
|
1107
1127
|
reason?: string;
|
|
1128
|
+
warnings?: BootstrapWarning[];
|
|
1108
1129
|
};
|
|
1109
1130
|
private get nodeFeatures();
|
|
1110
1131
|
/** SIWE domain — uses config override or defaults to app.tinycloud.xyz */
|
|
@@ -2232,4 +2253,4 @@ declare class WasmKeyProvider implements KeyProvider {
|
|
|
2232
2253
|
*/
|
|
2233
2254
|
declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
|
|
2234
2255
|
|
|
2235
|
-
export { type AuthDelegationArtifact as A, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SecretPermissionHint as S, TinyCloudNode as T, UnsupportedSessionRestoreError as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, type AuthRequestArtifact as a, type DelegateToResult as b, DelegatedAccess as c, type DelegationAuthority as d, NodeUserAuthorization as e, type NodeUserAuthorizationConfig as f, type RuntimeDelegationActivator as g, type RuntimePermissionGrantOptions as h, type SecretReadInput as i, type SecretReadResult as j, type SignStrategy as k, type TinyCloudNodeConfig as l, type WasmKeyProviderConfig as m, activateValidatedRuntimeDelegation as n, createWasmKeyProvider as o, defaultSignStrategy as p, deserializeDelegation as q, grantAuthRequest as r, serializeDelegation as s };
|
|
2256
|
+
export { type AuthDelegationArtifact as A, type BootstrapWarning as B, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SecretPermissionHint as S, TinyCloudNode as T, UnsupportedSessionRestoreError as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, type AuthRequestArtifact as a, type DelegateToResult as b, DelegatedAccess as c, type DelegationAuthority as d, NodeUserAuthorization as e, type NodeUserAuthorizationConfig as f, type RuntimeDelegationActivator as g, type RuntimePermissionGrantOptions as h, type SecretReadInput as i, type SecretReadResult as j, type SignStrategy as k, type TinyCloudNodeConfig as l, type WasmKeyProviderConfig as m, activateValidatedRuntimeDelegation as n, createWasmKeyProvider as o, defaultSignStrategy as p, deserializeDelegation as q, grantAuthRequest as r, serializeDelegation as s };
|
package/dist/core.cjs
CHANGED
|
@@ -2117,7 +2117,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2117
2117
|
* Outcome of the last signIn()'s account-bootstrap attempt. `skipped` is
|
|
2118
2118
|
* true when bootstrap did not complete (interactive signer, auto-sign
|
|
2119
2119
|
* denied, or a bootstrap step failed); `reason` carries the cause so apps
|
|
2120
|
-
* can surface a "finish account setup" call-to-action.
|
|
2120
|
+
* can surface a "finish account setup" call-to-action. `warnings` is
|
|
2121
|
+
* present when bootstrap completed, but one or more steps recovered from
|
|
2122
|
+
* an ambiguous failure (e.g. a KV batch write reconciled via per-space
|
|
2123
|
+
* fallback) — clean vs. recovered runs are otherwise byte-identical.
|
|
2121
2124
|
*/
|
|
2122
2125
|
this._bootstrapStatus = {
|
|
2123
2126
|
skipped: false
|
|
@@ -2558,7 +2561,13 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2558
2561
|
return false;
|
|
2559
2562
|
}
|
|
2560
2563
|
try {
|
|
2561
|
-
await this.runAccountBootstrap(steps);
|
|
2564
|
+
const warnings = await this.runAccountBootstrap(steps);
|
|
2565
|
+
if (warnings.length > 0) {
|
|
2566
|
+
this._bootstrapStatus = { skipped: false, warnings };
|
|
2567
|
+
this.notificationHandler.warning(
|
|
2568
|
+
`Account bootstrap completed with warnings: ${warnings.map((w) => `${w.stepId} (${w.kind}: ${w.code})`).join("; ")}`
|
|
2569
|
+
);
|
|
2570
|
+
}
|
|
2562
2571
|
} catch (err) {
|
|
2563
2572
|
const reason = err instanceof Error ? err.message : String(err);
|
|
2564
2573
|
this._bootstrapSkipped = true;
|
|
@@ -2607,6 +2616,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2607
2616
|
const auth = this.auth;
|
|
2608
2617
|
const sessions = /* @__PURE__ */ new Map();
|
|
2609
2618
|
const rawAbilitiesBySpace = /* @__PURE__ */ new Map();
|
|
2619
|
+
const warnings = [];
|
|
2610
2620
|
const primarySession = auth.tinyCloudSession;
|
|
2611
2621
|
const defaultSpaceId = this.ownedSpaceId("default");
|
|
2612
2622
|
const canReusePrimaryBootstrapSession = primarySession?.spaceId === defaultSpaceId && auth.capabilityRequest === import_sdk_core8.BOOTSTRAP_SESSION_REQUESTS.default;
|
|
@@ -2668,20 +2678,29 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2668
2678
|
}
|
|
2669
2679
|
}
|
|
2670
2680
|
if (step.kind === "seed-spaces") {
|
|
2671
|
-
|
|
2672
|
-
|
|
2681
|
+
const registered = await this.account.spaces.registerBatch(
|
|
2682
|
+
step.spaces.map((space) => ({
|
|
2673
2683
|
spaceId: space.spaceId,
|
|
2674
2684
|
name: space.name,
|
|
2675
2685
|
ownerDid: this.did,
|
|
2676
2686
|
type: "owned",
|
|
2677
2687
|
permissions: ["*"],
|
|
2678
2688
|
status: "active"
|
|
2689
|
+
}))
|
|
2690
|
+
);
|
|
2691
|
+
if (!registered.ok) {
|
|
2692
|
+
throw new Error(
|
|
2693
|
+
`Failed to seed account spaces: ${registered.error.message}`
|
|
2694
|
+
);
|
|
2695
|
+
}
|
|
2696
|
+
const batchError = registered.data.recoveredFromBatchError;
|
|
2697
|
+
if (batchError) {
|
|
2698
|
+
warnings.push({
|
|
2699
|
+
stepId: step.id,
|
|
2700
|
+
kind: "batch-write-reconciled",
|
|
2701
|
+
code: batchError.code,
|
|
2702
|
+
message: batchError.message
|
|
2679
2703
|
});
|
|
2680
|
-
if (!registered.ok) {
|
|
2681
|
-
throw new Error(
|
|
2682
|
-
`Failed to seed account space ${space.spaceId}: ${registered.error.message}`
|
|
2683
|
-
);
|
|
2684
|
-
}
|
|
2685
2704
|
}
|
|
2686
2705
|
}
|
|
2687
2706
|
if (step.kind === "seed-applications") {
|
|
@@ -2717,6 +2736,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2717
2736
|
}
|
|
2718
2737
|
}
|
|
2719
2738
|
}
|
|
2739
|
+
return warnings;
|
|
2720
2740
|
}
|
|
2721
2741
|
registerBootstrapRuntimeGrant(session, request, rawAbilities) {
|
|
2722
2742
|
const operations = [];
|
|
@@ -3842,6 +3862,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3842
3862
|
if (this._serviceContext) {
|
|
3843
3863
|
const spaceScopedContext = this._serviceGraph.track(new import_sdk_core8.ServiceContext({
|
|
3844
3864
|
invoke: this._serviceContext.invoke,
|
|
3865
|
+
invokeAny: this._serviceContext.invokeAny,
|
|
3845
3866
|
fetch: this._serviceContext.fetch,
|
|
3846
3867
|
hosts: this._serviceContext.hosts,
|
|
3847
3868
|
telemetry: this.config.telemetry
|