@mjasnikovs/pi-task 0.40.39 → 0.40.40

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.
@@ -318,12 +318,18 @@ export function judgeDeepSession(f) {
318
318
  && lastHopJudgesTheClient(r)
319
319
  && (r.mimeType ?? '').startsWith('text/html'));
320
320
  if (swallowed) {
321
+ const landed = swallowed.finalPath ?? swallowed.path;
322
+ const hop = landed === swallowed.path ? '' : ` → \`${landed}\``;
323
+ const cause = swallowed.redirected ?
324
+ 'The call was bounced to a page, so the session the client carried is not one this '
325
+ + 'server accepts and the answer is the SPA shell.'
326
+ : 'The route is not mounted and the catch-all answered instead, so the client sees a '
327
+ + '200 it cannot parse.';
321
328
  return {
322
329
  outcome: 'fail',
323
- detail: `\`${swallowed.method} ${swallowed.path}\` → ${String(swallowed.status)} `
330
+ detail: `\`${swallowed.method} ${swallowed.path}\`${hop} → ${String(swallowed.status)} `
324
331
  + `${swallowed.mimeType ?? ''}: an XHR asked this server for data and got the SPA `
325
- + 'shell. The route is not mounted and the catch-all answered instead, so the client '
326
- + 'sees a 200 it cannot parse. No status check can see this.'
332
+ + `shell. ${cause} No status check can see this.`
327
333
  };
328
334
  }
329
335
  const { method, path: p, status, failed, redirected: authRedirected } = f.authRequest;
@@ -695,6 +701,7 @@ export async function driveSession(cdp, { url, credentials, judge, quietMs }) {
695
701
  const existing = requests.get(id);
696
702
  if (p.redirectResponse !== undefined && existing) {
697
703
  existing.finalUrl = String(req?.url ?? existing.finalUrl);
704
+ existing.redirected = true;
698
705
  }
699
706
  else {
700
707
  requests.set(id, {
@@ -705,6 +712,7 @@ export async function driveSession(cdp, { url, credentials, judge, quietMs }) {
705
712
  status: null,
706
713
  mimeType: null,
707
714
  failed: false,
715
+ redirected: false,
708
716
  seq: nextSeq++
709
717
  });
710
718
  }
@@ -779,7 +787,7 @@ export async function driveSession(cdp, { url, credentials, judge, quietMs }) {
779
787
  mimeType: r.mimeType,
780
788
  failed: r.failed,
781
789
  initiator: initiatorOf(r),
782
- redirected: r.finalUrl !== r.url,
790
+ redirected: r.redirected,
783
791
  phase: id === authId ? 'auth'
784
792
  : r.seq >= postSeq ? 'post'
785
793
  : 'pre'
@@ -840,12 +848,11 @@ export async function driveSession(cdp, { url, credentials, judge, quietMs }) {
840
848
  ?? firstRequest(r => r.seq >= fillSeq && sameOrigin(r) && r.method !== 'GET' && r.type === 'Document');
841
849
  // An SSO sign-in addresses this app and ends on the provider, so it is absent
842
850
  // from the same-origin log above and "no request to our own origin" would
843
- // misname it. Document-only for the same reason the authId fallback is: a
844
- // telemetry beacon the fill races that happens to end off-origin would otherwise
845
- // name a bogus identity provider.
846
- const offsiteSignIn = authId !== null ? null : (firstRequest(r => r.seq >= fillSeq
851
+ // misname it. The two windows are authId's, for the same reasons: anything the
852
+ // submit issued counts, and only a NAVIGATION counts back to the fill, where the
853
+ // background traffic it races would otherwise name a bogus identity provider.
854
+ const offsiteSignIn = authId !== null ? null : (firstRequest(r => (r.seq >= submitSeq || (r.seq >= fillSeq && r.type === 'Document'))
847
855
  && r.method !== 'GET'
848
- && r.type === 'Document'
849
856
  && addressedOrigin(r)
850
857
  && !sameOrigin(r)
851
858
  && r.finalUrl.startsWith('http')));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjasnikovs/pi-task",
3
- "version": "0.40.39",
3
+ "version": "0.40.40",
4
4
  "description": "Deterministic task planning and spec-orchestration for local models — crash-safe /task pipelines with verify/enforce gates, a real-time remote web view, and web/docs/fetch/worker subagent tools.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",