@oxy.so/services 15.1.4 → 15.1.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.
@@ -2,47 +2,14 @@
2
2
 
3
3
  import { resolveApplicationSessionLane } from "../oauth/applicationSessionLane.js";
4
4
  import { logger as loggerUtil } from '@oxy.so/core';
5
- import { runSessionColdBoot } from '@oxy.so/core/session';
6
- import { loadPersistedDeviceCredential } from "../utils/deviceCredential.js";
5
+ import { runSessionColdBoot, runWebSessionColdBoot } from '@oxy.so/core/session';
7
6
  import { createPlatformSharedDeviceCredentialStore } from "../session/sharedDeviceCredentialStore.js";
8
7
  import { tryCompleteOAuthReturn } from "../utils/oauthReturn.js";
9
8
  import { isWebBrowser } from "../utils/isWebBrowser.js";
10
9
  import { isNetConnectivityOnline } from "../utils/netConnectivity.js";
11
10
  /**
12
- * Whether the URL carries an OAuth return (`?code=` or `?error=`) for
13
- * `tryCompleteOAuthReturn` to consume. Reads the address bar only.
14
- */
15
- function hasOAuthReturnOnUrl() {
16
- const search = globalThis.location?.search;
17
- if (!search) return false;
18
- const params = new URLSearchParams(search);
19
- return params.has('code') || params.has('error');
20
- }
21
-
22
- /**
23
- * Whether this origin's own store holds anything a web boot could restore from:
24
- * a warm access token to plant or a device secret to mint with. A presence
25
- * check only — nothing read here is used, sent or synced before the
26
- * classification allows it.
27
- */
28
- async function hasRestorableState(store) {
29
- const persisted = await store.load();
30
- return Boolean(persisted?.accessToken || persisted?.deviceSecret);
31
- }
32
-
33
- /** How long the cold boot waits for the post-boot SessionClient handoff (ms). */
34
- export const SESSION_HANDOFF_DEADLINE_MS = 6000;
35
-
36
- /**
37
- * HARD overall deadline (ms) for the whole `runSessionColdBoot` step chain.
38
- *
39
- * Bounds time-to-route: routing gates on `isAuthResolved`, which resolves when
40
- * the cold boot finishes, so a network step that never settles (a black-hole
41
- * network that neither connects nor rejects) would otherwise hang routing
42
- * indefinitely. 12s comfortably exceeds the healthy worst case of the
43
- * sequential, single-attempt (`retry:false`), 5s-capped network steps, so it is
44
- * INERT on healthy loads and only trips on a pathological network. Offline
45
- * devices short-circuit far sooner via the connectivity hint below.
11
+ * HARD overall deadline (ms) for the whole `runSessionColdBoot` step chain; see
12
+ * `runWebSessionColdBoot` in `@oxy.so/core/session`, which owns the boot.
46
13
  */
47
14
  export const COLD_BOOT_OVERALL_DEADLINE_MS = 12_000;
48
15
 
@@ -54,308 +21,57 @@ export const COLD_BOOT_OVERALL_DEADLINE_MS = 12_000;
54
21
  const OFFLINE_PROBE_TIMEOUT_MS = 500;
55
22
 
56
23
  /**
57
- * Best-effort, FAST connectivity probe run once before the cold boot.
58
- *
59
- * Returns `true` ONLY on an EXPLICIT disconnected verdict; every ambiguous
60
- * outcome (probe timeout, unknown/`null` state, NetInfo unavailable, a thrown
61
- * error) resolves to `false` (assume online) so a flaky probe can never falsely
62
- * skip a real sign-in. Never rejects. On web it reads `navigator.onLine`; on
63
- * native it races `NetInfo.fetch()` against {@link OFFLINE_PROBE_TIMEOUT_MS},
64
- * mirroring the existing NetInfo dynamic-import pattern in `OxyProvider`.
24
+ * The native half of the boot's connectivity probe: races `NetInfo.fetch()`
25
+ * against {@link OFFLINE_PROBE_TIMEOUT_MS}. `true` ONLY on an EXPLICIT
26
+ * disconnected verdict; a timeout or an unknown state is "online". A missing
27
+ * NetInfo rejects, which the boot also reads as "online".
65
28
  */
66
- async function detectOfflineHint() {
67
- try {
68
- if (isWebBrowser()) {
69
- const online = globalThis.navigator?.onLine;
70
- // Only an explicit `false` is an offline verdict; `undefined` ⇒ assume online.
71
- return online === false;
72
- }
73
- const NetInfo = await import('@react-native-community/netinfo');
74
- const state = await Promise.race([NetInfo.default.fetch(), new Promise(resolve => {
75
- setTimeout(() => resolve(null), OFFLINE_PROBE_TIMEOUT_MS);
76
- })]);
77
- // `null` ⇒ the probe timed out (unknown → assume online). Only an explicit
78
- // disconnected verdict disables the network steps (the same rule as the
79
- // online signal: `isConnected`, never the reachability probe).
80
- return state !== null && !isNetConnectivityOnline(state);
81
- } catch {
82
- // NetInfo missing / probe threw — never block sign-in on a probe failure.
83
- return false;
84
- }
29
+ async function probeNetInfoOffline() {
30
+ const NetInfo = await import('@react-native-community/netinfo');
31
+ const state = await Promise.race([NetInfo.default.fetch(), new Promise(resolve => {
32
+ setTimeout(() => resolve(null), OFFLINE_PROBE_TIMEOUT_MS);
33
+ })]);
34
+ // `null` ⇒ the probe timed out (unknown → assume online). Only an explicit
35
+ // disconnected verdict disables the network steps (the same rule as the
36
+ // online signal: `isConnected`, never the reachability probe).
37
+ return state !== null && !isNetConnectivityOnline(state);
85
38
  }
86
- /** Starts the provider's fresh classification; a rejection is observed, not swallowed. */
87
- function startClassification(opts) {
88
- const classification = (async () => opts.resolveSessionLane?.() ?? resolveApplicationSessionLane(opts.oxyServices, opts.clientId))();
89
- // Observed so a rejection that lands before it is awaited is not reported as
90
- // unhandled; every caller still awaits it and sees the rejection.
91
- classification.catch(() => undefined);
92
- return classification;
93
- }
94
-
95
- /** What the device lanes made of this holder: a session, a verdict against it, or no answer. */
96
-
97
39
  /**
98
- * The device lanes of the boot (`runSessionColdBoot`), for a first boot or for
99
- * the background check of a painted one.
40
+ * Device-first cold boot for `@oxy.so/services` providers: core's
41
+ * `runWebSessionColdBoot` (the order, the deadlines, the verdicts) with this
42
+ * package's platform parts — the registry classifier, the native connectivity
43
+ * probe, the shared device credential slot and the OAuth return leg.
100
44
  *
101
- * A first boot (`painted: false`) is on the critical path: its committed
102
- * session resolves auth, bounded by {@link SESSION_HANDOFF_DEADLINE_MS}. A
103
- * painted boot already resolved auth from the cache, so nothing waits on the
104
- * handoff and the pure-local warm token is skipped: the check needs the mint's
105
- * verdict, which a still-valid token cannot give.
45
+ * The boot NEVER navigates the top-level window; the OAuth return leg only
46
+ * consumes a code that is already in the address bar (#691 phase 7b).
106
47
  */
107
- async function restoreDeviceSession(opts, painted) {
48
+ export function runProviderColdBoot(opts) {
108
49
  const {
109
50
  oxyServices,
110
- authStore,
111
- sessionMode = 'account',
112
- identity,
113
- sessionClient,
114
- syncDeviceCredentialToHost,
115
- commitSession,
116
- markAuthResolved
117
- } = opts;
118
- await opts.beforeDeviceBoot?.();
119
-
120
- // Best-effort connectivity probe up front: an EXPLICIT offline verdict skips
121
- // the two doomed network steps so routing settles immediately instead of
122
- // burning the overall deadline on a mint that cannot succeed. Any ambiguity
123
- // resolves to "online" — the network steps still run.
124
- const offline = await detectOfflineHint();
125
- let outcome = 'unreachable';
126
- let holderRejected = false;
127
- await runSessionColdBoot({
128
- oxy: oxyServices,
129
- store: authStore,
130
- platform: {
131
- isWeb: isWebBrowser(),
132
- isNative: !isWebBrowser()
133
- },
134
- sessionMode,
135
- identity,
136
- // The device-wide shared credential slot, enabling the `shared-device-adopt`
137
- // lane: a newly installed official app joins this device's existing session
138
- // instead of falling back to signing a challenge with the Commons identity
139
- // key. `null` on web, where each origin is its own device by design; the
140
- // core lane is also skipped outright in `sessionMode: 'identity'`.
141
- // Off when the provider was given a platform's own store: the credential
142
- // then lives there and nowhere else.
143
- sharedDeviceCredential: opts.useSharedDeviceCredential === false ? undefined : createPlatformSharedDeviceCredentialStore() ?? undefined,
144
- overallDeadlineMs: COLD_BOOT_OVERALL_DEADLINE_MS,
145
- isOffline: () => offline,
146
- requireServerVerdict: painted,
147
- onHolderRejected: () => {
148
- holderRejected = true;
149
- },
150
- onStepDeadline: stepId => {
151
- loggerUtil.warn(`Cold-boot step "${stepId}" exceeded the ${COLD_BOOT_OVERALL_DEADLINE_MS}ms overall deadline — abandoned; routing proceeds signed-out`, {
152
- component: 'runProviderColdBoot',
153
- method: 'onStepDeadline'
154
- });
155
- },
156
- onSession: async session => {
157
- outcome = 'session';
158
- // Mint already persisted `{deviceId, deviceSecret}` to the store; sync the
159
- // in-memory SessionClient host so sockets + tab-focus re-mint can use it.
160
- await syncDeviceCredentialToHost();
161
- const handoff = commitSession({
162
- sessionId: session.sessionId,
163
- accessToken: session.accessToken,
164
- userId: session.userId,
165
- deviceState: session.state
166
- }, {
167
- activate: false
168
- });
169
- if (painted) {
170
- // The account is already on screen; the commit refreshes its profile.
171
- await handoff;
172
- return;
173
- }
174
- let handoffDeadlineId;
175
- await Promise.race([handoff, new Promise(resolve => {
176
- handoffDeadlineId = setTimeout(resolve, SESSION_HANDOFF_DEADLINE_MS);
177
- })]).finally(() => {
178
- if (handoffDeadlineId !== undefined) {
179
- clearTimeout(handoffDeadlineId);
180
- }
181
- });
182
- markAuthResolved();
183
- },
184
- onSignedOut: async () => {
185
- outcome = holderRejected ? 'rejected' : 'unreachable';
186
- await syncDeviceCredentialToHost();
187
- // A painted session is the caller's to end or keep (see verifyCachedSession).
188
- if (painted) return;
189
- const cred = await loadPersistedDeviceCredential(authStore);
190
- if (cred) {
191
- try {
192
- await sessionClient.start();
193
- } catch (socketError) {
194
- if (__DEV__) {
195
- loggerUtil.debug('Device socket start failed (non-fatal)', {
196
- component: 'runProviderColdBoot'
197
- }, socketError);
198
- }
199
- }
200
- }
201
- markAuthResolved();
202
- },
203
- onStepError: (id, error) => {
204
- if (__DEV__) {
205
- loggerUtil.debug(`Cold-boot step "${id}" errored (non-fatal, falling through)`, {
206
- component: 'runProviderColdBoot'
207
- }, error);
208
- }
209
- }
210
- });
211
- await opts.afterDeviceBoot?.();
212
- return outcome;
213
- }
214
-
215
- /**
216
- * The background check of a painted session: the registry's classification and
217
- * a mint with this holder's own credential (whose commit refreshes the profile).
218
- * Each is asked until the server answers it. A verdict against the session
219
- * signs out at that moment; no answer keeps the cached session on screen and
220
- * hands the caller a retry.
221
- */
222
- async function verifyCachedSession(opts, verified, classification) {
223
- if (!verified.lane) {
224
- let lane = null;
225
- try {
226
- lane = await classification;
227
- } catch {
228
- // The registry could not be asked (offline, timeout, 5xx). That is no
229
- // verdict on this app: the cached `device` classification stands until it
230
- // answers.
231
- }
232
- if (lane === 'oauth') {
233
- await opts.onCachedSessionRejected?.();
234
- return;
235
- }
236
- verified.lane = lane === 'device';
237
- }
238
- if (!verified.session) {
239
- const outcome = await restoreDeviceSession(opts, true);
240
- if (outcome === 'rejected') {
241
- await opts.onCachedSessionRejected?.();
242
- return;
243
- }
244
- verified.session = outcome === 'session';
245
- }
246
- if (!verified.lane || !verified.session) {
247
- opts.onCachedSessionUnconfirmed?.(() => verifyCachedSession(opts, verified, verified.lane ? Promise.resolve('device') : startClassification(opts)));
248
- }
249
- }
250
-
251
- /**
252
- * Device-first cold boot for `@oxy.so/services` providers.
253
- *
254
- * A returning session saved on this device (account mode, the app last
255
- * classified `device`, its profile cached) paints first, with no network, and
256
- * is then checked in the background — see `paintCachedSession`. Otherwise, a
257
- * first boot:
258
- *
259
- * Ordered pipeline:
260
- * 1. Complete an OAuth authorization-code return already on the URL (web)
261
- * 2. `runSessionColdBoot` — device-secret mint (+ the native Commons-proof lane,
262
- * or the primary-identity-key lane in `sessionMode: 'identity'`)
263
- *
264
- * Step 1 is ACCOUNT-MODE ONLY: it commits whichever account the IdP resolves,
265
- * which for an identity-bound client is somebody else's account by construction.
266
- * In `'identity'` mode the boot is exactly step 2.
267
- *
268
- * The boot NEVER navigates the top-level window. There is no automatic
269
- * `prompt=none` bounce to the IdP: a web origin with no local device credential
270
- * resolves SIGNED OUT and waits for the user's next explicit "Continue with
271
- * Oxy", which opens a popup from a real gesture (#691 phase 7b). Step 1 is not a
272
- * navigation — it only consumes a code that is already in the address bar.
273
- */
274
- export async function runProviderColdBoot(opts) {
275
- const {
276
- oxyServices,
277
- authStore,
278
51
  clientId,
279
52
  authRedirectUri,
280
- sessionMode = 'account',
281
- commitSession,
282
- markAuthResolved,
283
- setTokenReady
53
+ commitSession
284
54
  } = opts;
285
- const identityBound = sessionMode === 'identity';
286
- setTokenReady(false);
287
- try {
288
- // Classification precedes every USE of a local secret, the shared credential
289
- // and the identity key. Unavailable registry metadata fails closed on a first
290
- // boot, including offline. It starts now, before anything else, so its round
291
- // trip overlaps the local work below.
292
- const classification = startClassification(opts);
293
-
294
- // A returning session saved on this device paints at once from the cache:
295
- // the account, its cached content, auth resolved, no network on the way.
296
- // The classification and the session are then checked in the background,
297
- // and a verdict against either signs out at that moment. Identity-bound
298
- // clients and OAuth returns keep the path below.
299
- const freshLaunch = !identityBound && !hasOAuthReturnOnUrl();
300
- if (freshLaunch && (await opts.paintCachedSession?.())) {
301
- await verifyCachedSession(opts, {
302
- lane: false,
303
- session: false
304
- }, classification);
305
- return;
306
- }
307
-
308
- // The verdict decides HOW a session is restored, never WHETHER there is one.
309
- // A web origin with nothing to restore and no OAuth return on the URL ends
310
- // signed out on either lane, so routing need not wait a network round trip
311
- // for an answer that cannot change the outcome. The classification still
312
- // completes below and still gates every later sign-in
313
- // (`ensureDeviceSessionLane` shares this same in-flight lookup).
314
- if (freshLaunch && isWebBrowser()) {
315
- if (!(await hasRestorableState(authStore))) {
316
- markAuthResolved();
317
- const lane = await classification;
318
- await opts.onClassified?.(lane);
319
- if (lane === 'oauth') setTokenReady(true);
320
- return;
321
- }
322
- }
323
- const lane = await classification;
324
- await opts.onClassified?.(lane);
325
- if (identityBound && lane !== 'device') return;
326
- // The redirect transport's RETURN leg. An app reaches it whenever the browser
327
- // BLOCKED the sign-in popup and `startWebOAuthSignIn` fell back to a
328
- // full-page redirect (`popup-blocked` / `popup-navigation-failed`), so it is
329
- // load-bearing even though nothing here ever starts a redirect. It consumes a
330
- // code (or a stale OAuth `error`) already in the address bar and rewrites the
331
- // URL via `history.replaceState`; it never begins a navigation.
332
- const oauthCompleted = identityBound ? false : await tryCompleteOAuthReturn({
333
- oxyServices,
334
- clientId,
335
- authRedirectUri,
336
- commitSession: input => commitSession(input, {
337
- activate: true,
338
- oauth: true
339
- })
340
- });
341
- if (oauthCompleted) {
342
- setTokenReady(true);
343
- markAuthResolved();
344
- return;
345
- }
346
- if (lane === 'oauth') {
347
- setTokenReady(true);
348
- return;
349
- }
350
- await restoreDeviceSession(opts, false);
351
- } catch (error) {
352
- if (__DEV__) {
353
- loggerUtil.error('Cold boot error', error instanceof Error ? error : new Error(String(error)), {
354
- component: 'runProviderColdBoot'
355
- });
55
+ return runWebSessionColdBoot({
56
+ ...opts,
57
+ resolveSessionLane: () => opts.resolveSessionLane?.() ?? resolveApplicationSessionLane(oxyServices, clientId),
58
+ overallDeadlineMs: COLD_BOOT_OVERALL_DEADLINE_MS,
59
+ platform: {
60
+ isWeb: isWebBrowser,
61
+ probeNativeOffline: probeNetInfoOffline,
62
+ completeOAuthReturn: () => tryCompleteOAuthReturn({
63
+ oxyServices,
64
+ clientId,
65
+ authRedirectUri,
66
+ commitSession: input => commitSession(input, {
67
+ activate: true,
68
+ oauth: true
69
+ })
70
+ }),
71
+ sharedDeviceCredential: createPlatformSharedDeviceCredentialStore,
72
+ runSessionColdBoot,
73
+ logger: loggerUtil
356
74
  }
357
- } finally {
358
- markAuthResolved();
359
- }
75
+ });
360
76
  }
361
77
  //# sourceMappingURL=runProviderColdBoot.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["resolveApplicationSessionLane","logger","loggerUtil","runSessionColdBoot","loadPersistedDeviceCredential","createPlatformSharedDeviceCredentialStore","tryCompleteOAuthReturn","isWebBrowser","isNetConnectivityOnline","hasOAuthReturnOnUrl","search","globalThis","location","params","URLSearchParams","has","hasRestorableState","store","persisted","load","Boolean","accessToken","deviceSecret","SESSION_HANDOFF_DEADLINE_MS","COLD_BOOT_OVERALL_DEADLINE_MS","OFFLINE_PROBE_TIMEOUT_MS","detectOfflineHint","online","navigator","onLine","NetInfo","state","Promise","race","default","fetch","resolve","setTimeout","startClassification","opts","classification","resolveSessionLane","oxyServices","clientId","catch","undefined","restoreDeviceSession","painted","authStore","sessionMode","identity","sessionClient","syncDeviceCredentialToHost","commitSession","markAuthResolved","beforeDeviceBoot","offline","outcome","holderRejected","oxy","platform","isWeb","isNative","sharedDeviceCredential","useSharedDeviceCredential","overallDeadlineMs","isOffline","requireServerVerdict","onHolderRejected","onStepDeadline","stepId","warn","component","method","onSession","session","handoff","sessionId","userId","deviceState","activate","handoffDeadlineId","finally","clearTimeout","onSignedOut","cred","start","socketError","__DEV__","debug","onStepError","id","error","afterDeviceBoot","verifyCachedSession","verified","lane","onCachedSessionRejected","onCachedSessionUnconfirmed","runProviderColdBoot","authRedirectUri","setTokenReady","identityBound","freshLaunch","paintCachedSession","onClassified","oauthCompleted","input","oauth","Error","String"],"sourceRoot":"../../../../src","sources":["ui/boot/runProviderColdBoot.ts"],"mappings":";;AAAA,SAASA,6BAA6B,QAAQ,oCAAiC;AAC/E,SAASC,MAAM,IAAIC,UAAU,QAA0B,cAAc;AACrE,SACEC,kBAAkB,QAIb,sBAAsB;AAE7B,SAASC,6BAA6B,QAAQ,8BAA2B;AACzE,SAASC,yCAAyC,QAAQ,2CAAwC;AAClG,SAASC,sBAAsB,QAAQ,yBAAsB;AAC7D,SAASC,YAAY,QAAQ,0BAAuB;AACpD,SAASC,uBAAuB,QAAQ,6BAA0B;AAGlE;AACA;AACA;AACA;AACA,SAASC,mBAAmBA,CAAA,EAAY;EACtC,MAAMC,MAAM,GAAIC,UAAU,CAAwCC,QAAQ,EAAEF,MAAM;EAClF,IAAI,CAACA,MAAM,EAAE,OAAO,KAAK;EACzB,MAAMG,MAAM,GAAG,IAAIC,eAAe,CAACJ,MAAM,CAAC;EAC1C,OAAOG,MAAM,CAACE,GAAG,CAAC,MAAM,CAAC,IAAIF,MAAM,CAACE,GAAG,CAAC,OAAO,CAAC;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeC,kBAAkBA,CAACC,KAAqB,EAAoB;EACzE,MAAMC,SAAS,GAAG,MAAMD,KAAK,CAACE,IAAI,CAAC,CAAC;EACpC,OAAOC,OAAO,CAACF,SAAS,EAAEG,WAAW,IAAIH,SAAS,EAAEI,YAAY,CAAC;AACnE;;AAEA;AACA,OAAO,MAAMC,2BAA2B,GAAG,IAAI;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,6BAA6B,GAAG,MAAM;;AAEnD;AACA;AAC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J,aAAa,GAChC,KAAK,GACL,MAAMhG,sBAAsB,CAAC;MAC3BoC,WAAW;MACXC,QAAQ;MACRyD,eAAe;MACf/C,aAAa,EAAGsD,KAAK,IAAKtD,aAAa,CAACsD,KAAK,EAAE;QAAE3B,QAAQ,EAAE,IAAI;QAAE4B,KAAK,EAAE;MAAK,CAAC;IAChF,CAAC,CAAC;IACN,IAAIF,cAAc,EAAE;MAClBL,aAAa,CAAC,IAAI,CAAC;MACnB/C,gBAAgB,CAAC,CAAC;MAClB;IACF;IAEA,IAAI0C,IAAI,KAAK,OAAO,EAAE;MACpBK,aAAa,CAAC,IAAI,CAAC;MACnB;IACF;IAEA,MAAMvD,oBAAoB,CAACP,IAAI,EAAE,KAAK,CAAC;EACzC,CAAC,CAAC,OAAOqD,KAAK,EAAE;IACd,IAAIJ,OAAO,EAAE;MACXtF,UAAU,CAAC0F,KAAK,CACd,iBAAiB,EACjBA,KAAK,YAAYiB,KAAK,GAAGjB,KAAK,GAAG,IAAIiB,KAAK,CAACC,MAAM,CAAClB,KAAK,CAAC,CAAC,EACzD;QAAEpB,SAAS,EAAE;MAAsB,CACrC,CAAC;IACH;EACF,CAAC,SAAS;IACRlB,gBAAgB,CAAC,CAAC;EACpB;AACF","ignoreList":[]}
1
+ {"version":3,"names":["resolveApplicationSessionLane","logger","loggerUtil","runSessionColdBoot","runWebSessionColdBoot","createPlatformSharedDeviceCredentialStore","tryCompleteOAuthReturn","isWebBrowser","isNetConnectivityOnline","COLD_BOOT_OVERALL_DEADLINE_MS","OFFLINE_PROBE_TIMEOUT_MS","probeNetInfoOffline","NetInfo","state","Promise","race","default","fetch","resolve","setTimeout","runProviderColdBoot","opts","oxyServices","clientId","authRedirectUri","commitSession","resolveSessionLane","overallDeadlineMs","platform","isWeb","probeNativeOffline","completeOAuthReturn","input","activate","oauth","sharedDeviceCredential"],"sourceRoot":"../../../../src","sources":["ui/boot/runProviderColdBoot.ts"],"mappings":";;AAAA,SAASA,6BAA6B,QAAQ,o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E;MACRC,KAAK,EAAEtB,YAAY;MACnBuB,kBAAkB,EAAEnB,mBAAmB;MACvCoB,mBAAmB,EAAEA,CAAA,KACnBzB,sBAAsB,CAAC;QACrBgB,WAAW;QACXC,QAAQ;QACRC,eAAe;QACfC,aAAa,EAAGO,KAAK,IAAKP,aAAa,CAACO,KAAK,EAAE;UAAEC,QAAQ,EAAE,IAAI;UAAEC,KAAK,EAAE;QAAK,CAAC;MAChF,CAAC,CAAC;MACJC,sBAAsB,EAAE9B,yCAAyC;MACjEF,kBAAkB;MAClBF,MAAM,EAAEC;IACV;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -1,71 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import { logger } from '@oxy.so/core';
4
- /**
5
- * Platform `TokenTransport` for `SessionClient` (device-first model).
6
- *
7
- * `ensureActiveToken` is the fallback the client uses when a `session_state`
8
- * push arrived WITHOUT an embedded `activeToken` and the planted bearer does not
9
- * already belong to the state's active account. It mints one through the ONE
10
- * unified single-flight the scheduler, the request-time preflight, and the 401
11
- * retry all use — `oxyServices.http.refreshAccessToken(...)` — which runs
12
- * the installed refresh handler (present the persisted zero-cookie `deviceId` +
13
- * `deviceSecret` at `POST /session/device/token`, which mints for the device's
14
- * CURRENT active account). Routing through the SAME entry point means this lane
15
- * can never double-rotate the device secret against the others: it has NO
16
- * private single-flight of its own.
17
- *
18
- * The short-circuit compares the planted bearer's ACCOUNT against
19
- * `state.activeAccountId`, not mere token presence: a bearer for the PREVIOUS
20
- * account (an account switch) must still mint the new account's token — skipping
21
- * on presence alone would leave a subscriber observing the new active account
22
- * under the old account's bearer (the account-switch 404 race).
23
- *
24
- * A failure is logged and swallowed: this method must never throw out (it runs
25
- * inside the socket state handler).
26
- *
27
- * `getPinnedAccountId` is the identity-bound escape hatch. Converging the bearer
28
- * on `state.activeAccountId` is precisely what an identity-bound client must
29
- * never do — its token is minted for the PINNED account by the cold boot /
30
- * re-mint lane. `SessionClient` already bypasses the transport entirely while
31
- * pinned; this guard is the services-side half of that contract, so no future
32
- * wiring can reintroduce the convergence from this end.
33
- */
34
- export function createTokenTransport(oxyServices, getPinnedAccountId) {
35
- return {
36
- async ensureActiveToken(state) {
37
- if ((getPinnedAccountId?.() ?? null) !== null) {
38
- return;
39
- }
40
- try {
41
- // Skip the mint ONLY when the planted bearer already identifies the
42
- // active account. `getCurrentUserId()` decodes the bearer's `userId`/`id`
43
- // (null when absent/opaque), directly comparable to the account id.
44
- const activeAccountId = state.activeAccountId;
45
- if (activeAccountId !== null && oxyServices.session.userId === activeAccountId) {
46
- return;
47
- }
48
- } catch (error) {
49
- logger.warn('ensureActiveToken: bearer-account check threw', {
50
- component: 'TokenTransport'
51
- }, error);
52
- }
53
- try {
54
- // The shared HttpService single-flight coalesces concurrent callers onto
55
- // one in-flight mint; no local `inFlightMint` guard is needed.
56
- const token = await oxyServices.http.refreshAccessToken('preflight');
57
- if (!token) {
58
- logger.debug('ensureActiveToken: refresh produced no session', {
59
- component: 'TokenTransport',
60
- deviceId: state.deviceId
61
- });
62
- }
63
- } catch (error) {
64
- logger.warn('ensureActiveToken: refresh failed', {
65
- component: 'TokenTransport'
66
- }, error);
67
- }
68
- }
69
- };
70
- }
3
+ // The transport moved to `@oxy.so/core/session` (core 7.66.0) so the React-free
4
+ // web session shares it; this module keeps the package's import site.
5
+ export { createTokenTransport } from '@oxy.so/core/session';
71
6
  //# sourceMappingURL=tokenTransport.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["logger","createTokenTransport","oxyServices","getPinnedAccountId","ensureActiveToken","state","activeAccountId","session","userId","error","warn","component","token","http","refreshAccessToken","debug","deviceId"],"sourceRoot":"../../../../src","sources":["ui/session/tokenTransport.ts"],"mappings":";;AAAA,SAASA,MAAM,QAA0B,cAAc;AAIvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAClCC,WAAwB,EACxBC,kBAAwC,EACxB;EAChB,OAAO;IACL,MAAMC,iBAAiBA,CAACC,KAAyB,EAAiB;MAChE,IAAI,CAACF,kBAAkB,GAAG,CAAC,IAAI,IAAI,MAAM,IAAI,EAAE;QAC7C;MACF;MACA,IAAI;QACF;QACA;QACA;QACA,MAAMG,eAAe,GAAGD,KAAK,CAACC,eAAe;QAC7C,IAAIA,eAAe,KAAK,IAAI,IAAIJ,WAAW,CAACK,OAAO,CAACC,MAAM,KAAKF,eAAe,EAAE;UAC9E;QACF;MACF,CAAC,CAAC,OAAOG,KAAK,EAAE;QACdT,MAAM,CAACU,IAAI,CACT,+CAA+C,EAC/C;UAAEC,SAAS,EAAE;QAAiB,CAAC,EAC/BF,KACF,CAAC;MACH;MAEA,IAAI;QACF;QACA;QACA,MAAMG,KAAK,GAAG,MAAMV,WAAW,CAACW,IAAI,CAACC,kBAAkB,CAAC,WAAW,CAAC;QACpE,IAAI,CAACF,KAAK,EAAE;UACVZ,MAAM,CAACe,KAAK,CAAC,gDAAgD,EAAE;YAC7DJ,SAAS,EAAE,gBAAgB;YAC3BK,QAAQ,EAAEX,KAAK,CAACW;UAClB,CAAC,CAAC;QACJ;MACF,CAAC,CAAC,OAAOP,KAAK,EAAE;QACdT,MAAM,CAACU,IAAI,CAAC,mCAAmC,EAAE;UAAEC,SAAS,EAAE;QAAiB,CAAC,EAAEF,KAAK,CAAC;MAC1F;IACF;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["createTokenTransport"],"sourceRoot":"../../../../src","sources":["ui/session/tokenTransport.ts"],"mappings":";;AAAA;AACA;AACA,SAASA,oBAAoB,QAAQ,sBAAsB","ignoreList":[]}
@@ -2,18 +2,9 @@ import { type OxyServices } from '@oxy.so/core';
2
2
  import { type AuthStateStore, type IdentityBinding, type SessionMode } from '@oxy.so/core/session';
3
3
  import type { SessionClient } from '@oxy.so/core/session';
4
4
  import type { CommitInput } from '../context/oxyContextTypes';
5
- /** How long the cold boot waits for the post-boot SessionClient handoff (ms). */
6
- export declare const SESSION_HANDOFF_DEADLINE_MS = 6000;
7
5
  /**
8
- * HARD overall deadline (ms) for the whole `runSessionColdBoot` step chain.
9
- *
10
- * Bounds time-to-route: routing gates on `isAuthResolved`, which resolves when
11
- * the cold boot finishes, so a network step that never settles (a black-hole
12
- * network that neither connects nor rejects) would otherwise hang routing
13
- * indefinitely. 12s comfortably exceeds the healthy worst case of the
14
- * sequential, single-attempt (`retry:false`), 5s-capped network steps, so it is
15
- * INERT on healthy loads and only trips on a pathological network. Offline
16
- * devices short-circuit far sooner via the connectivity hint below.
6
+ * HARD overall deadline (ms) for the whole `runSessionColdBoot` step chain; see
7
+ * `runWebSessionColdBoot` in `@oxy.so/core/session`, which owns the boot.
17
8
  */
18
9
  export declare const COLD_BOOT_OVERALL_DEADLINE_MS = 12000;
19
10
  export interface RunProviderColdBootOptions {
@@ -72,27 +63,13 @@ export interface RunProviderColdBootOptions {
72
63
  onCachedSessionUnconfirmed?: (retry: () => Promise<void>) => void;
73
64
  }
74
65
  /**
75
- * Device-first cold boot for `@oxy.so/services` providers.
76
- *
77
- * A returning session saved on this device (account mode, the app last
78
- * classified `device`, its profile cached) paints first, with no network, and
79
- * is then checked in the background — see `paintCachedSession`. Otherwise, a
80
- * first boot:
81
- *
82
- * Ordered pipeline:
83
- * 1. Complete an OAuth authorization-code return already on the URL (web)
84
- * 2. `runSessionColdBoot` — device-secret mint (+ the native Commons-proof lane,
85
- * or the primary-identity-key lane in `sessionMode: 'identity'`)
86
- *
87
- * Step 1 is ACCOUNT-MODE ONLY: it commits whichever account the IdP resolves,
88
- * which for an identity-bound client is somebody else's account by construction.
89
- * In `'identity'` mode the boot is exactly step 2.
66
+ * Device-first cold boot for `@oxy.so/services` providers: core's
67
+ * `runWebSessionColdBoot` (the order, the deadlines, the verdicts) with this
68
+ * package's platform parts — the registry classifier, the native connectivity
69
+ * probe, the shared device credential slot and the OAuth return leg.
90
70
  *
91
- * The boot NEVER navigates the top-level window. There is no automatic
92
- * `prompt=none` bounce to the IdP: a web origin with no local device credential
93
- * resolves SIGNED OUT and waits for the user's next explicit "Continue with
94
- * Oxy", which opens a popup from a real gesture (#691 phase 7b). Step 1 is not a
95
- * navigation — it only consumes a code that is already in the address bar.
71
+ * The boot NEVER navigates the top-level window; the OAuth return leg only
72
+ * consumes a code that is already in the address bar (#691 phase 7b).
96
73
  */
97
74
  export declare function runProviderColdBoot(opts: RunProviderColdBootOptions): Promise<void>;
98
75
  //# sourceMappingURL=runProviderColdBoot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runProviderColdBoot.d.ts","sourceRoot":"","sources":["../../../../../src/ui/boot/runProviderColdBoot.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAM1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAwB9D,iFAAiF;AACjF,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B,QAAS,CAAC;AA2CpD,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,cAAc,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,kEAAkE;IAClE,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,aAAa,EAAE,aAAa,CAAC;IAC7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AAE,OAAO,KAAK,IAAI,CAAC;IACxC;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C;;;OAGG;IACH,0BAA0B,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;CACnE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBnF"}
@@ -1,34 +1,2 @@
1
- import { type OxyServices } from '@oxy.so/core';
2
- import type { TokenTransport } from '@oxy.so/core/session';
3
- /**
4
- * Platform `TokenTransport` for `SessionClient` (device-first model).
5
- *
6
- * `ensureActiveToken` is the fallback the client uses when a `session_state`
7
- * push arrived WITHOUT an embedded `activeToken` and the planted bearer does not
8
- * already belong to the state's active account. It mints one through the ONE
9
- * unified single-flight the scheduler, the request-time preflight, and the 401
10
- * retry all use — `oxyServices.http.refreshAccessToken(...)` — which runs
11
- * the installed refresh handler (present the persisted zero-cookie `deviceId` +
12
- * `deviceSecret` at `POST /session/device/token`, which mints for the device's
13
- * CURRENT active account). Routing through the SAME entry point means this lane
14
- * can never double-rotate the device secret against the others: it has NO
15
- * private single-flight of its own.
16
- *
17
- * The short-circuit compares the planted bearer's ACCOUNT against
18
- * `state.activeAccountId`, not mere token presence: a bearer for the PREVIOUS
19
- * account (an account switch) must still mint the new account's token — skipping
20
- * on presence alone would leave a subscriber observing the new active account
21
- * under the old account's bearer (the account-switch 404 race).
22
- *
23
- * A failure is logged and swallowed: this method must never throw out (it runs
24
- * inside the socket state handler).
25
- *
26
- * `getPinnedAccountId` is the identity-bound escape hatch. Converging the bearer
27
- * on `state.activeAccountId` is precisely what an identity-bound client must
28
- * never do — its token is minted for the PINNED account by the cold boot /
29
- * re-mint lane. `SessionClient` already bypasses the transport entirely while
30
- * pinned; this guard is the services-side half of that contract, so no future
31
- * wiring can reintroduce the convergence from this end.
32
- */
33
- export declare function createTokenTransport(oxyServices: OxyServices, getPinnedAccountId?: () => string | null): TokenTransport;
1
+ export { createTokenTransport } from '@oxy.so/core/session';
34
2
  //# sourceMappingURL=tokenTransport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokenTransport.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/tokenTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,EACxB,kBAAkB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,GACvC,cAAc,CAqChB"}
1
+ {"version":3,"file":"tokenTransport.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/tokenTransport.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC"}