@riddledc/riddle-proof 0.7.189 → 0.7.191
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/{chunk-Z42O55GB.js → chunk-BG5GVTGM.js} +109 -0
- package/dist/cli.cjs +183 -0
- package/dist/cli.js +75 -1
- package/dist/index.cjs +109 -0
- package/dist/index.js +1 -1
- package/dist/profile.cjs +109 -0
- package/dist/profile.js +1 -1
- package/dist/proof-run-engine.d.cts +3 -3
- package/dist/proof-run-engine.d.ts +3 -3
- package/package.json +1 -1
|
@@ -5754,7 +5754,114 @@ function setupJsonValue(value) {
|
|
|
5754
5754
|
function setupValuesEqual(left, right) {
|
|
5755
5755
|
return JSON.stringify(setupJsonValue(left)) === JSON.stringify(setupJsonValue(right));
|
|
5756
5756
|
}
|
|
5757
|
+
async function ensureProfilePageHelpers(context) {
|
|
5758
|
+
try {
|
|
5759
|
+
await context.evaluate(({ targetUrl }) => {
|
|
5760
|
+
const asPathname = (path) => {
|
|
5761
|
+
const value = String(path || "/");
|
|
5762
|
+
return value.startsWith("/") ? value : "/" + value;
|
|
5763
|
+
};
|
|
5764
|
+
const normalizePathname = (path) => {
|
|
5765
|
+
const value = asPathname(path);
|
|
5766
|
+
return value === "/" ? "/" : value.replace(/\/+$/, "") || "/";
|
|
5767
|
+
};
|
|
5768
|
+
const previewMountPrefix = (pathname) => {
|
|
5769
|
+
const value = normalizePathname(pathname);
|
|
5770
|
+
const apiPreview = value.match(/^(\/s\/[^/]+)(?:\/|$)/);
|
|
5771
|
+
if (apiPreview) return apiPreview[1];
|
|
5772
|
+
const internalPreview = value.match(/^(\/preview\/[^/]+\/[^/]+)(?:\/|$)/);
|
|
5773
|
+
return internalPreview ? internalPreview[1] : "";
|
|
5774
|
+
};
|
|
5775
|
+
const targetMountPrefix = () => {
|
|
5776
|
+
try {
|
|
5777
|
+
return previewMountPrefix(new URL(String(targetUrl || ""), window.location.href).pathname);
|
|
5778
|
+
} catch {
|
|
5779
|
+
return "";
|
|
5780
|
+
}
|
|
5781
|
+
};
|
|
5782
|
+
const currentRoute = () => {
|
|
5783
|
+
const pathname = asPathname(window.location.pathname);
|
|
5784
|
+
const normalizedPathname = normalizePathname(pathname);
|
|
5785
|
+
const currentBasePath = previewMountPrefix(normalizedPathname);
|
|
5786
|
+
const basePath = currentBasePath || targetMountPrefix();
|
|
5787
|
+
const suffix = String(window.location.search || "") + String(window.location.hash || "");
|
|
5788
|
+
const appPath = currentBasePath && (normalizedPathname === currentBasePath || normalizedPathname.startsWith(currentBasePath + "/"))
|
|
5789
|
+
? normalizePathname(normalizedPathname.slice(currentBasePath.length) || "/")
|
|
5790
|
+
: normalizedPathname;
|
|
5791
|
+
return {
|
|
5792
|
+
url: window.location.href,
|
|
5793
|
+
origin: window.location.origin,
|
|
5794
|
+
pathname,
|
|
5795
|
+
search: window.location.search,
|
|
5796
|
+
hash: window.location.hash,
|
|
5797
|
+
basePath,
|
|
5798
|
+
previewMountPrefix: basePath,
|
|
5799
|
+
currentBasePath,
|
|
5800
|
+
appPath,
|
|
5801
|
+
appRoute: appPath + suffix,
|
|
5802
|
+
mountedPath: normalizedPathname,
|
|
5803
|
+
mountedRoute: normalizedPathname + suffix,
|
|
5804
|
+
isPreviewMounted: Boolean(currentBasePath),
|
|
5805
|
+
};
|
|
5806
|
+
};
|
|
5807
|
+
const parseRoute = (route) => {
|
|
5808
|
+
const raw = String(route || "/").trim() || "/";
|
|
5809
|
+
if (/^https?:\/\//i.test(raw)) {
|
|
5810
|
+
try {
|
|
5811
|
+
const url = new URL(raw);
|
|
5812
|
+
if (url.origin !== window.location.origin) return { external: true, value: raw };
|
|
5813
|
+
return { external: false, pathname: normalizePathname(url.pathname), suffix: url.search + url.hash };
|
|
5814
|
+
} catch {
|
|
5815
|
+
return { external: false, pathname: normalizePathname(raw), suffix: "" };
|
|
5816
|
+
}
|
|
5817
|
+
}
|
|
5818
|
+
try {
|
|
5819
|
+
const url = new URL(raw, window.location.origin);
|
|
5820
|
+
return { external: false, pathname: normalizePathname(url.pathname), suffix: url.search + url.hash };
|
|
5821
|
+
} catch {
|
|
5822
|
+
const hashIndex = raw.indexOf("#");
|
|
5823
|
+
const beforeHash = hashIndex >= 0 ? raw.slice(0, hashIndex) : raw;
|
|
5824
|
+
const hash = hashIndex >= 0 ? raw.slice(hashIndex) : "";
|
|
5825
|
+
const searchIndex = beforeHash.indexOf("?");
|
|
5826
|
+
const pathname = searchIndex >= 0 ? beforeHash.slice(0, searchIndex) : beforeHash;
|
|
5827
|
+
const search = searchIndex >= 0 ? beforeHash.slice(searchIndex) : "";
|
|
5828
|
+
return { external: false, pathname: normalizePathname(pathname), suffix: search + hash };
|
|
5829
|
+
}
|
|
5830
|
+
};
|
|
5831
|
+
const joinRoute = (route) => {
|
|
5832
|
+
const parsed = parseRoute(route);
|
|
5833
|
+
if (parsed.external) return parsed.value;
|
|
5834
|
+
const current = currentRoute();
|
|
5835
|
+
const basePath = current.basePath || "";
|
|
5836
|
+
const routePath = parsed.pathname || "/";
|
|
5837
|
+
if (!basePath) return routePath + (parsed.suffix || "");
|
|
5838
|
+
if (routePath === basePath || routePath.startsWith(basePath + "/")) return routePath + (parsed.suffix || "");
|
|
5839
|
+
return (routePath === "/" ? basePath + "/" : basePath + routePath) + (parsed.suffix || "");
|
|
5840
|
+
};
|
|
5841
|
+
const existing = window.__riddleProofProfile && typeof window.__riddleProofProfile === "object"
|
|
5842
|
+
? window.__riddleProofProfile
|
|
5843
|
+
: {};
|
|
5844
|
+
Object.defineProperties(existing, {
|
|
5845
|
+
current: { configurable: true, get: currentRoute },
|
|
5846
|
+
appPath: { configurable: true, get: () => currentRoute().appPath },
|
|
5847
|
+
appRoute: { configurable: true, get: () => currentRoute().appRoute },
|
|
5848
|
+
basePath: { configurable: true, get: () => currentRoute().basePath },
|
|
5849
|
+
previewMountPrefix: { configurable: true, get: () => currentRoute().previewMountPrefix },
|
|
5850
|
+
mountedPath: { configurable: true, get: () => currentRoute().mountedPath },
|
|
5851
|
+
mountedRoute: { configurable: true, get: () => currentRoute().mountedRoute },
|
|
5852
|
+
});
|
|
5853
|
+
existing.version = "riddle-proof.profile-helper.v1";
|
|
5854
|
+
existing.route = currentRoute;
|
|
5855
|
+
existing.getRoute = currentRoute;
|
|
5856
|
+
existing.joinRoute = joinRoute;
|
|
5857
|
+
window.__riddleProofProfile = existing;
|
|
5858
|
+
}, { targetUrl });
|
|
5859
|
+
} catch {
|
|
5860
|
+
// Profile helper injection is best-effort so existing window actions keep their old behavior.
|
|
5861
|
+
}
|
|
5862
|
+
}
|
|
5757
5863
|
async function setupReadWindowValue(context, path) {
|
|
5864
|
+
await ensureProfilePageHelpers(context);
|
|
5758
5865
|
return await context.evaluate(({ path }) => {
|
|
5759
5866
|
const toJsonValue = (value) => {
|
|
5760
5867
|
if (value === null || value === undefined) return null;
|
|
@@ -5778,6 +5885,7 @@ async function setupReadWindowValue(context, path) {
|
|
|
5778
5885
|
}, { path });
|
|
5779
5886
|
}
|
|
5780
5887
|
async function setupCallWindowFunction(context, path, args, storeReturnTo, captureReturn) {
|
|
5888
|
+
await ensureProfilePageHelpers(context);
|
|
5781
5889
|
return await context.evaluate(async ({ path, args, storeReturnTo, captureReturn }) => {
|
|
5782
5890
|
const toJsonValue = (value) => {
|
|
5783
5891
|
if (value === null || value === undefined) return null;
|
|
@@ -5826,6 +5934,7 @@ async function setupCallWindowFunction(context, path, args, storeReturnTo, captu
|
|
|
5826
5934
|
}, { path, args, storeReturnTo, captureReturn });
|
|
5827
5935
|
}
|
|
5828
5936
|
async function setupEvaluateWindowScript(context, script, args, storeReturnTo, captureReturn) {
|
|
5937
|
+
await ensureProfilePageHelpers(context);
|
|
5829
5938
|
return await context.evaluate(async ({ script, args, storeReturnTo, captureReturn }) => {
|
|
5830
5939
|
const toJsonValue = (value) => {
|
|
5831
5940
|
if (value === null || value === undefined) return null;
|
package/dist/cli.cjs
CHANGED
|
@@ -12695,7 +12695,114 @@ function setupJsonValue(value) {
|
|
|
12695
12695
|
function setupValuesEqual(left, right) {
|
|
12696
12696
|
return JSON.stringify(setupJsonValue(left)) === JSON.stringify(setupJsonValue(right));
|
|
12697
12697
|
}
|
|
12698
|
+
async function ensureProfilePageHelpers(context) {
|
|
12699
|
+
try {
|
|
12700
|
+
await context.evaluate(({ targetUrl }) => {
|
|
12701
|
+
const asPathname = (path) => {
|
|
12702
|
+
const value = String(path || "/");
|
|
12703
|
+
return value.startsWith("/") ? value : "/" + value;
|
|
12704
|
+
};
|
|
12705
|
+
const normalizePathname = (path) => {
|
|
12706
|
+
const value = asPathname(path);
|
|
12707
|
+
return value === "/" ? "/" : value.replace(/\/+$/, "") || "/";
|
|
12708
|
+
};
|
|
12709
|
+
const previewMountPrefix = (pathname) => {
|
|
12710
|
+
const value = normalizePathname(pathname);
|
|
12711
|
+
const apiPreview = value.match(/^(\/s\/[^/]+)(?:\/|$)/);
|
|
12712
|
+
if (apiPreview) return apiPreview[1];
|
|
12713
|
+
const internalPreview = value.match(/^(\/preview\/[^/]+\/[^/]+)(?:\/|$)/);
|
|
12714
|
+
return internalPreview ? internalPreview[1] : "";
|
|
12715
|
+
};
|
|
12716
|
+
const targetMountPrefix = () => {
|
|
12717
|
+
try {
|
|
12718
|
+
return previewMountPrefix(new URL(String(targetUrl || ""), window.location.href).pathname);
|
|
12719
|
+
} catch {
|
|
12720
|
+
return "";
|
|
12721
|
+
}
|
|
12722
|
+
};
|
|
12723
|
+
const currentRoute = () => {
|
|
12724
|
+
const pathname = asPathname(window.location.pathname);
|
|
12725
|
+
const normalizedPathname = normalizePathname(pathname);
|
|
12726
|
+
const currentBasePath = previewMountPrefix(normalizedPathname);
|
|
12727
|
+
const basePath = currentBasePath || targetMountPrefix();
|
|
12728
|
+
const suffix = String(window.location.search || "") + String(window.location.hash || "");
|
|
12729
|
+
const appPath = currentBasePath && (normalizedPathname === currentBasePath || normalizedPathname.startsWith(currentBasePath + "/"))
|
|
12730
|
+
? normalizePathname(normalizedPathname.slice(currentBasePath.length) || "/")
|
|
12731
|
+
: normalizedPathname;
|
|
12732
|
+
return {
|
|
12733
|
+
url: window.location.href,
|
|
12734
|
+
origin: window.location.origin,
|
|
12735
|
+
pathname,
|
|
12736
|
+
search: window.location.search,
|
|
12737
|
+
hash: window.location.hash,
|
|
12738
|
+
basePath,
|
|
12739
|
+
previewMountPrefix: basePath,
|
|
12740
|
+
currentBasePath,
|
|
12741
|
+
appPath,
|
|
12742
|
+
appRoute: appPath + suffix,
|
|
12743
|
+
mountedPath: normalizedPathname,
|
|
12744
|
+
mountedRoute: normalizedPathname + suffix,
|
|
12745
|
+
isPreviewMounted: Boolean(currentBasePath),
|
|
12746
|
+
};
|
|
12747
|
+
};
|
|
12748
|
+
const parseRoute = (route) => {
|
|
12749
|
+
const raw = String(route || "/").trim() || "/";
|
|
12750
|
+
if (/^https?:\/\//i.test(raw)) {
|
|
12751
|
+
try {
|
|
12752
|
+
const url = new URL(raw);
|
|
12753
|
+
if (url.origin !== window.location.origin) return { external: true, value: raw };
|
|
12754
|
+
return { external: false, pathname: normalizePathname(url.pathname), suffix: url.search + url.hash };
|
|
12755
|
+
} catch {
|
|
12756
|
+
return { external: false, pathname: normalizePathname(raw), suffix: "" };
|
|
12757
|
+
}
|
|
12758
|
+
}
|
|
12759
|
+
try {
|
|
12760
|
+
const url = new URL(raw, window.location.origin);
|
|
12761
|
+
return { external: false, pathname: normalizePathname(url.pathname), suffix: url.search + url.hash };
|
|
12762
|
+
} catch {
|
|
12763
|
+
const hashIndex = raw.indexOf("#");
|
|
12764
|
+
const beforeHash = hashIndex >= 0 ? raw.slice(0, hashIndex) : raw;
|
|
12765
|
+
const hash = hashIndex >= 0 ? raw.slice(hashIndex) : "";
|
|
12766
|
+
const searchIndex = beforeHash.indexOf("?");
|
|
12767
|
+
const pathname = searchIndex >= 0 ? beforeHash.slice(0, searchIndex) : beforeHash;
|
|
12768
|
+
const search = searchIndex >= 0 ? beforeHash.slice(searchIndex) : "";
|
|
12769
|
+
return { external: false, pathname: normalizePathname(pathname), suffix: search + hash };
|
|
12770
|
+
}
|
|
12771
|
+
};
|
|
12772
|
+
const joinRoute = (route) => {
|
|
12773
|
+
const parsed = parseRoute(route);
|
|
12774
|
+
if (parsed.external) return parsed.value;
|
|
12775
|
+
const current = currentRoute();
|
|
12776
|
+
const basePath = current.basePath || "";
|
|
12777
|
+
const routePath = parsed.pathname || "/";
|
|
12778
|
+
if (!basePath) return routePath + (parsed.suffix || "");
|
|
12779
|
+
if (routePath === basePath || routePath.startsWith(basePath + "/")) return routePath + (parsed.suffix || "");
|
|
12780
|
+
return (routePath === "/" ? basePath + "/" : basePath + routePath) + (parsed.suffix || "");
|
|
12781
|
+
};
|
|
12782
|
+
const existing = window.__riddleProofProfile && typeof window.__riddleProofProfile === "object"
|
|
12783
|
+
? window.__riddleProofProfile
|
|
12784
|
+
: {};
|
|
12785
|
+
Object.defineProperties(existing, {
|
|
12786
|
+
current: { configurable: true, get: currentRoute },
|
|
12787
|
+
appPath: { configurable: true, get: () => currentRoute().appPath },
|
|
12788
|
+
appRoute: { configurable: true, get: () => currentRoute().appRoute },
|
|
12789
|
+
basePath: { configurable: true, get: () => currentRoute().basePath },
|
|
12790
|
+
previewMountPrefix: { configurable: true, get: () => currentRoute().previewMountPrefix },
|
|
12791
|
+
mountedPath: { configurable: true, get: () => currentRoute().mountedPath },
|
|
12792
|
+
mountedRoute: { configurable: true, get: () => currentRoute().mountedRoute },
|
|
12793
|
+
});
|
|
12794
|
+
existing.version = "riddle-proof.profile-helper.v1";
|
|
12795
|
+
existing.route = currentRoute;
|
|
12796
|
+
existing.getRoute = currentRoute;
|
|
12797
|
+
existing.joinRoute = joinRoute;
|
|
12798
|
+
window.__riddleProofProfile = existing;
|
|
12799
|
+
}, { targetUrl });
|
|
12800
|
+
} catch {
|
|
12801
|
+
// Profile helper injection is best-effort so existing window actions keep their old behavior.
|
|
12802
|
+
}
|
|
12803
|
+
}
|
|
12698
12804
|
async function setupReadWindowValue(context, path) {
|
|
12805
|
+
await ensureProfilePageHelpers(context);
|
|
12699
12806
|
return await context.evaluate(({ path }) => {
|
|
12700
12807
|
const toJsonValue = (value) => {
|
|
12701
12808
|
if (value === null || value === undefined) return null;
|
|
@@ -12719,6 +12826,7 @@ async function setupReadWindowValue(context, path) {
|
|
|
12719
12826
|
}, { path });
|
|
12720
12827
|
}
|
|
12721
12828
|
async function setupCallWindowFunction(context, path, args, storeReturnTo, captureReturn) {
|
|
12829
|
+
await ensureProfilePageHelpers(context);
|
|
12722
12830
|
return await context.evaluate(async ({ path, args, storeReturnTo, captureReturn }) => {
|
|
12723
12831
|
const toJsonValue = (value) => {
|
|
12724
12832
|
if (value === null || value === undefined) return null;
|
|
@@ -12767,6 +12875,7 @@ async function setupCallWindowFunction(context, path, args, storeReturnTo, captu
|
|
|
12767
12875
|
}, { path, args, storeReturnTo, captureReturn });
|
|
12768
12876
|
}
|
|
12769
12877
|
async function setupEvaluateWindowScript(context, script, args, storeReturnTo, captureReturn) {
|
|
12878
|
+
await ensureProfilePageHelpers(context);
|
|
12770
12879
|
return await context.evaluate(async ({ script, args, storeReturnTo, captureReturn }) => {
|
|
12771
12880
|
const toJsonValue = (value) => {
|
|
12772
12881
|
if (value === null || value === undefined) return null;
|
|
@@ -16457,6 +16566,24 @@ function profileHasTerminalLossReceipt(receipts) {
|
|
|
16457
16566
|
return lastFlightLost || outOfBounds || ["over", "lost", "loss", "failed", "failure", "game_over", "gameover"].includes(status) || ["lost", "loss", "failed", "failure", "game_over", "gameover"].includes(outcome);
|
|
16458
16567
|
});
|
|
16459
16568
|
}
|
|
16569
|
+
function profileHasTerminalSuccessReceipt(receipts) {
|
|
16570
|
+
return receipts.some((receipt) => {
|
|
16571
|
+
const status = profileLowerSummaryValue(receipt, ["status", "state", "phase"]);
|
|
16572
|
+
const outcome = profileLowerSummaryValue(receipt, ["lastOutcome", "outcome", "terminalOutcome", "terminal", "result"]);
|
|
16573
|
+
const storedTo = cliString(receipt.return_stored_to) || "";
|
|
16574
|
+
const label = cliString(receipt.label) || "";
|
|
16575
|
+
const path7 = cliString(receipt.path) || cliString(receipt.function_name) || "";
|
|
16576
|
+
const haystack = `${storedTo} ${label} ${path7}`.toLowerCase();
|
|
16577
|
+
if (haystack.includes("shot")) return false;
|
|
16578
|
+
const labelsSuccess = haystack.includes("success") || haystack.includes("terminal") || haystack.includes("completed") || haystack.includes("complete");
|
|
16579
|
+
const success = setupReturnSummaryValue(receipt, ["success", "passed", "completed"]) === true;
|
|
16580
|
+
const targetHit = setupReturnSummaryValue(receipt, ["lastFlightTargetHit", "targetHit"]) === true;
|
|
16581
|
+
const gateHit = setupReturnSummaryValue(receipt, ["lastFlight.passedThroughGate", "passedThroughGate", "gate"]) === true;
|
|
16582
|
+
const bucketHit = setupReturnSummaryValue(receipt, ["lastFlight.bucketHit", "bucketHit", "bucket"]) === true;
|
|
16583
|
+
if (!labelsSuccess && !success && !targetHit && !gateHit && !bucketHit) return false;
|
|
16584
|
+
return success || targetHit || gateHit || bucketHit || ["success", "won", "complete", "completed", "passed"].includes(status) || ["success", "won", "complete", "completed", "passed"].includes(outcome);
|
|
16585
|
+
});
|
|
16586
|
+
}
|
|
16460
16587
|
function profileHasControlledLaunchReceipt(receipts, expected) {
|
|
16461
16588
|
return receipts.some((receipt) => {
|
|
16462
16589
|
const shotKind = profileLowerSummaryValue(receipt, ["lastShotKind", "shotKind", "kind"]);
|
|
@@ -16468,6 +16595,38 @@ function profileHasControlledLaunchReceipt(receipts, expected) {
|
|
|
16468
16595
|
return ["failure", "failed", "miss", "lost", "loss"].includes(shotKind) || ["failure", "failed", "miss", "lost", "loss"].includes(shotStatus) || ["failure", "failed", "miss", "lost", "loss"].includes(outcome);
|
|
16469
16596
|
});
|
|
16470
16597
|
}
|
|
16598
|
+
function profileHasRouteContinuationReceipt(receipts) {
|
|
16599
|
+
return receipts.some((receipt) => {
|
|
16600
|
+
const fromRoute = cliString(setupReturnSummaryValue(receipt, ["fromRoute", "from", "previousRoute", "sourceRoute"]));
|
|
16601
|
+
const target = cliString(setupReturnSummaryValue(receipt, ["target", "nextHref", "toRoute", "nextRoute", "href"]));
|
|
16602
|
+
const afterRoute = cliString(setupReturnSummaryValue(receipt, ["routeAfterPush", "afterRoute", "route", "observedRoute"]));
|
|
16603
|
+
if (!fromRoute || !target && !afterRoute) return false;
|
|
16604
|
+
const storedTo = cliString(receipt.return_stored_to) || "";
|
|
16605
|
+
const label = cliString(receipt.label) || "";
|
|
16606
|
+
const path7 = cliString(receipt.path) || cliString(receipt.function_name) || "";
|
|
16607
|
+
const summary = cliReturnSummaryLabel(receipt.return_summary) || "";
|
|
16608
|
+
const haystack = `${storedTo} ${label} ${path7} ${summary}`.toLowerCase();
|
|
16609
|
+
return haystack.includes("navigation") || haystack.includes("continuation") || haystack.includes("route") || haystack.includes("next") || haystack.includes("target");
|
|
16610
|
+
});
|
|
16611
|
+
}
|
|
16612
|
+
function profileHasRecoveredStateReceipt(receipts) {
|
|
16613
|
+
return receipts.some((receipt) => {
|
|
16614
|
+
const storedTo = cliString(receipt.return_stored_to) || "";
|
|
16615
|
+
const label = cliString(receipt.label) || "";
|
|
16616
|
+
const path7 = cliString(receipt.path) || cliString(receipt.function_name) || "";
|
|
16617
|
+
const summary = cliReturnSummaryLabel(receipt.return_summary) || "";
|
|
16618
|
+
const haystack = `${storedTo} ${label} ${path7} ${summary}`.toLowerCase();
|
|
16619
|
+
const labelsRecovery = haystack.includes("recover") || haystack.includes("repaired") || haystack.includes("repair") || haystack.includes("try fix") || haystack.includes("tryfix") || haystack.includes("after-fix") || haystack.includes("fixed");
|
|
16620
|
+
if (!labelsRecovery) return false;
|
|
16621
|
+
const status = profileLowerSummaryValue(receipt, ["status", "state", "phase"]);
|
|
16622
|
+
const outcome = profileLowerSummaryValue(receipt, ["lastOutcome", "outcome", "result"]);
|
|
16623
|
+
const hasRecoveredState = ["valid", "success", "recovered", "fixed", "ready"].includes(status) || ["valid", "success", "recovered", "fixed", "ready"].includes(outcome);
|
|
16624
|
+
const hasValid = setupReturnSummaryValue(receipt, ["hasValid", "valid", "isValid"]) === true;
|
|
16625
|
+
const hasInvalid = setupReturnSummaryValue(receipt, ["hasInvalid", "invalid", "isInvalid"]);
|
|
16626
|
+
const success = setupReturnSummaryValue(receipt, ["success", "recovered", "fixed"]) === true;
|
|
16627
|
+
return hasRecoveredState || success || hasValid && hasInvalid === false;
|
|
16628
|
+
});
|
|
16629
|
+
}
|
|
16471
16630
|
function profilePackReceiptStatus(result, metadata, receipt) {
|
|
16472
16631
|
const text = receipt.toLowerCase();
|
|
16473
16632
|
const setupSummary = profileSetupSummaryRecord(result);
|
|
@@ -16521,8 +16680,11 @@ function profilePackReceiptStatus(result, metadata, receipt) {
|
|
|
16521
16680
|
const hasOfflineAudioMetricsReceipt = profileHasOfflineAudioMetricsReceipt(valueReceipts);
|
|
16522
16681
|
const hasActiveRouteLocalProofReceipt = profileHasActiveRouteLocalProofReceipt(valueReceipts);
|
|
16523
16682
|
const hasTerminalLossReceipt = profileHasTerminalLossReceipt(valueReceipts);
|
|
16683
|
+
const hasTerminalSuccessReceipt = profileHasTerminalSuccessReceipt(valueReceipts);
|
|
16524
16684
|
const hasControlledFailureLaunchReceipt = profileHasControlledLaunchReceipt(valueReceipts, "failure");
|
|
16525
16685
|
const hasControlledSuccessLaunchReceipt = profileHasControlledLaunchReceipt(valueReceipts, "success");
|
|
16686
|
+
const hasRouteContinuationReceipt = profileHasRouteContinuationReceipt(valueReceipts);
|
|
16687
|
+
const hasRecoveredStateReceipt = profileHasRecoveredStateReceipt(valueReceipts);
|
|
16526
16688
|
const failedCleanupInventoryReason = profileFailedCleanupInventoryReason(setupViewports);
|
|
16527
16689
|
if (text.includes("artifact link") || text.includes("artifact path")) {
|
|
16528
16690
|
return profileReceiptSignalStatus(profileResultHasArtifact(result), "artifact references listed", "no artifact references found");
|
|
@@ -16575,6 +16737,13 @@ function profilePackReceiptStatus(result, metadata, receipt) {
|
|
|
16575
16737
|
"terminal loss receipt missing"
|
|
16576
16738
|
);
|
|
16577
16739
|
}
|
|
16740
|
+
if (text.includes("success") && text.includes("terminal")) {
|
|
16741
|
+
return profileReceiptSignalStatus(
|
|
16742
|
+
hasTerminalSuccessReceipt,
|
|
16743
|
+
"terminal success receipt present",
|
|
16744
|
+
"terminal success receipt missing"
|
|
16745
|
+
);
|
|
16746
|
+
}
|
|
16578
16747
|
if (text.includes("controlled") && text.includes("launch") && (text.includes("failure") || text.includes("failed") || text.includes("miss"))) {
|
|
16579
16748
|
return profileReceiptSignalStatus(
|
|
16580
16749
|
hasControlledFailureLaunchReceipt,
|
|
@@ -16589,6 +16758,20 @@ function profilePackReceiptStatus(result, metadata, receipt) {
|
|
|
16589
16758
|
"controlled success launch receipt missing"
|
|
16590
16759
|
);
|
|
16591
16760
|
}
|
|
16761
|
+
if (text.includes("recovery action") || text.includes("recover action") || text.includes("try fix") || (text.includes("retry") || text.includes("repair")) && text.includes("action")) {
|
|
16762
|
+
return profileReceiptSignalStatus(
|
|
16763
|
+
visibleUiActionCount > 0 && hasRecoveredStateReceipt,
|
|
16764
|
+
"visible recovery-action receipt present",
|
|
16765
|
+
"visible recovery-action receipt missing"
|
|
16766
|
+
);
|
|
16767
|
+
}
|
|
16768
|
+
if (text.includes("route continuation") || text.includes("route-transition") || text.includes("route transition")) {
|
|
16769
|
+
return profileReceiptSignalStatus(
|
|
16770
|
+
hasRouteContinuationReceipt,
|
|
16771
|
+
"route continuation receipt present",
|
|
16772
|
+
"route continuation receipt missing"
|
|
16773
|
+
);
|
|
16774
|
+
}
|
|
16592
16775
|
if (text.includes("through visible ui") || text.includes("visible ui action") || text.includes("ui-routed") || text.includes("ui routed") || text.includes("visible") && text.includes("route") && text.includes("exit") && text.includes("action") || text.includes("visible") && text.includes("mode") && text.includes("exit") && text.includes("action")) {
|
|
16593
16776
|
return profileReceiptSignalStatus(
|
|
16594
16777
|
visibleUiActionCount > 0,
|
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
profileStatusExitCode,
|
|
14
14
|
resolveRiddleProofProfileTargetUrl,
|
|
15
15
|
resolveRiddleProofProfileTimeoutSec
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-BG5GVTGM.js";
|
|
17
17
|
import {
|
|
18
18
|
createRiddleApiClient,
|
|
19
19
|
isTerminalRiddleJobStatus,
|
|
@@ -662,6 +662,24 @@ function profileHasTerminalLossReceipt(receipts) {
|
|
|
662
662
|
return lastFlightLost || outOfBounds || ["over", "lost", "loss", "failed", "failure", "game_over", "gameover"].includes(status) || ["lost", "loss", "failed", "failure", "game_over", "gameover"].includes(outcome);
|
|
663
663
|
});
|
|
664
664
|
}
|
|
665
|
+
function profileHasTerminalSuccessReceipt(receipts) {
|
|
666
|
+
return receipts.some((receipt) => {
|
|
667
|
+
const status = profileLowerSummaryValue(receipt, ["status", "state", "phase"]);
|
|
668
|
+
const outcome = profileLowerSummaryValue(receipt, ["lastOutcome", "outcome", "terminalOutcome", "terminal", "result"]);
|
|
669
|
+
const storedTo = cliString(receipt.return_stored_to) || "";
|
|
670
|
+
const label = cliString(receipt.label) || "";
|
|
671
|
+
const path2 = cliString(receipt.path) || cliString(receipt.function_name) || "";
|
|
672
|
+
const haystack = `${storedTo} ${label} ${path2}`.toLowerCase();
|
|
673
|
+
if (haystack.includes("shot")) return false;
|
|
674
|
+
const labelsSuccess = haystack.includes("success") || haystack.includes("terminal") || haystack.includes("completed") || haystack.includes("complete");
|
|
675
|
+
const success = setupReturnSummaryValue(receipt, ["success", "passed", "completed"]) === true;
|
|
676
|
+
const targetHit = setupReturnSummaryValue(receipt, ["lastFlightTargetHit", "targetHit"]) === true;
|
|
677
|
+
const gateHit = setupReturnSummaryValue(receipt, ["lastFlight.passedThroughGate", "passedThroughGate", "gate"]) === true;
|
|
678
|
+
const bucketHit = setupReturnSummaryValue(receipt, ["lastFlight.bucketHit", "bucketHit", "bucket"]) === true;
|
|
679
|
+
if (!labelsSuccess && !success && !targetHit && !gateHit && !bucketHit) return false;
|
|
680
|
+
return success || targetHit || gateHit || bucketHit || ["success", "won", "complete", "completed", "passed"].includes(status) || ["success", "won", "complete", "completed", "passed"].includes(outcome);
|
|
681
|
+
});
|
|
682
|
+
}
|
|
665
683
|
function profileHasControlledLaunchReceipt(receipts, expected) {
|
|
666
684
|
return receipts.some((receipt) => {
|
|
667
685
|
const shotKind = profileLowerSummaryValue(receipt, ["lastShotKind", "shotKind", "kind"]);
|
|
@@ -673,6 +691,38 @@ function profileHasControlledLaunchReceipt(receipts, expected) {
|
|
|
673
691
|
return ["failure", "failed", "miss", "lost", "loss"].includes(shotKind) || ["failure", "failed", "miss", "lost", "loss"].includes(shotStatus) || ["failure", "failed", "miss", "lost", "loss"].includes(outcome);
|
|
674
692
|
});
|
|
675
693
|
}
|
|
694
|
+
function profileHasRouteContinuationReceipt(receipts) {
|
|
695
|
+
return receipts.some((receipt) => {
|
|
696
|
+
const fromRoute = cliString(setupReturnSummaryValue(receipt, ["fromRoute", "from", "previousRoute", "sourceRoute"]));
|
|
697
|
+
const target = cliString(setupReturnSummaryValue(receipt, ["target", "nextHref", "toRoute", "nextRoute", "href"]));
|
|
698
|
+
const afterRoute = cliString(setupReturnSummaryValue(receipt, ["routeAfterPush", "afterRoute", "route", "observedRoute"]));
|
|
699
|
+
if (!fromRoute || !target && !afterRoute) return false;
|
|
700
|
+
const storedTo = cliString(receipt.return_stored_to) || "";
|
|
701
|
+
const label = cliString(receipt.label) || "";
|
|
702
|
+
const path2 = cliString(receipt.path) || cliString(receipt.function_name) || "";
|
|
703
|
+
const summary = cliReturnSummaryLabel(receipt.return_summary) || "";
|
|
704
|
+
const haystack = `${storedTo} ${label} ${path2} ${summary}`.toLowerCase();
|
|
705
|
+
return haystack.includes("navigation") || haystack.includes("continuation") || haystack.includes("route") || haystack.includes("next") || haystack.includes("target");
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
function profileHasRecoveredStateReceipt(receipts) {
|
|
709
|
+
return receipts.some((receipt) => {
|
|
710
|
+
const storedTo = cliString(receipt.return_stored_to) || "";
|
|
711
|
+
const label = cliString(receipt.label) || "";
|
|
712
|
+
const path2 = cliString(receipt.path) || cliString(receipt.function_name) || "";
|
|
713
|
+
const summary = cliReturnSummaryLabel(receipt.return_summary) || "";
|
|
714
|
+
const haystack = `${storedTo} ${label} ${path2} ${summary}`.toLowerCase();
|
|
715
|
+
const labelsRecovery = haystack.includes("recover") || haystack.includes("repaired") || haystack.includes("repair") || haystack.includes("try fix") || haystack.includes("tryfix") || haystack.includes("after-fix") || haystack.includes("fixed");
|
|
716
|
+
if (!labelsRecovery) return false;
|
|
717
|
+
const status = profileLowerSummaryValue(receipt, ["status", "state", "phase"]);
|
|
718
|
+
const outcome = profileLowerSummaryValue(receipt, ["lastOutcome", "outcome", "result"]);
|
|
719
|
+
const hasRecoveredState = ["valid", "success", "recovered", "fixed", "ready"].includes(status) || ["valid", "success", "recovered", "fixed", "ready"].includes(outcome);
|
|
720
|
+
const hasValid = setupReturnSummaryValue(receipt, ["hasValid", "valid", "isValid"]) === true;
|
|
721
|
+
const hasInvalid = setupReturnSummaryValue(receipt, ["hasInvalid", "invalid", "isInvalid"]);
|
|
722
|
+
const success = setupReturnSummaryValue(receipt, ["success", "recovered", "fixed"]) === true;
|
|
723
|
+
return hasRecoveredState || success || hasValid && hasInvalid === false;
|
|
724
|
+
});
|
|
725
|
+
}
|
|
676
726
|
function profilePackReceiptStatus(result, metadata, receipt) {
|
|
677
727
|
const text = receipt.toLowerCase();
|
|
678
728
|
const setupSummary = profileSetupSummaryRecord(result);
|
|
@@ -726,8 +776,11 @@ function profilePackReceiptStatus(result, metadata, receipt) {
|
|
|
726
776
|
const hasOfflineAudioMetricsReceipt = profileHasOfflineAudioMetricsReceipt(valueReceipts);
|
|
727
777
|
const hasActiveRouteLocalProofReceipt = profileHasActiveRouteLocalProofReceipt(valueReceipts);
|
|
728
778
|
const hasTerminalLossReceipt = profileHasTerminalLossReceipt(valueReceipts);
|
|
779
|
+
const hasTerminalSuccessReceipt = profileHasTerminalSuccessReceipt(valueReceipts);
|
|
729
780
|
const hasControlledFailureLaunchReceipt = profileHasControlledLaunchReceipt(valueReceipts, "failure");
|
|
730
781
|
const hasControlledSuccessLaunchReceipt = profileHasControlledLaunchReceipt(valueReceipts, "success");
|
|
782
|
+
const hasRouteContinuationReceipt = profileHasRouteContinuationReceipt(valueReceipts);
|
|
783
|
+
const hasRecoveredStateReceipt = profileHasRecoveredStateReceipt(valueReceipts);
|
|
731
784
|
const failedCleanupInventoryReason = profileFailedCleanupInventoryReason(setupViewports);
|
|
732
785
|
if (text.includes("artifact link") || text.includes("artifact path")) {
|
|
733
786
|
return profileReceiptSignalStatus(profileResultHasArtifact(result), "artifact references listed", "no artifact references found");
|
|
@@ -780,6 +833,13 @@ function profilePackReceiptStatus(result, metadata, receipt) {
|
|
|
780
833
|
"terminal loss receipt missing"
|
|
781
834
|
);
|
|
782
835
|
}
|
|
836
|
+
if (text.includes("success") && text.includes("terminal")) {
|
|
837
|
+
return profileReceiptSignalStatus(
|
|
838
|
+
hasTerminalSuccessReceipt,
|
|
839
|
+
"terminal success receipt present",
|
|
840
|
+
"terminal success receipt missing"
|
|
841
|
+
);
|
|
842
|
+
}
|
|
783
843
|
if (text.includes("controlled") && text.includes("launch") && (text.includes("failure") || text.includes("failed") || text.includes("miss"))) {
|
|
784
844
|
return profileReceiptSignalStatus(
|
|
785
845
|
hasControlledFailureLaunchReceipt,
|
|
@@ -794,6 +854,20 @@ function profilePackReceiptStatus(result, metadata, receipt) {
|
|
|
794
854
|
"controlled success launch receipt missing"
|
|
795
855
|
);
|
|
796
856
|
}
|
|
857
|
+
if (text.includes("recovery action") || text.includes("recover action") || text.includes("try fix") || (text.includes("retry") || text.includes("repair")) && text.includes("action")) {
|
|
858
|
+
return profileReceiptSignalStatus(
|
|
859
|
+
visibleUiActionCount > 0 && hasRecoveredStateReceipt,
|
|
860
|
+
"visible recovery-action receipt present",
|
|
861
|
+
"visible recovery-action receipt missing"
|
|
862
|
+
);
|
|
863
|
+
}
|
|
864
|
+
if (text.includes("route continuation") || text.includes("route-transition") || text.includes("route transition")) {
|
|
865
|
+
return profileReceiptSignalStatus(
|
|
866
|
+
hasRouteContinuationReceipt,
|
|
867
|
+
"route continuation receipt present",
|
|
868
|
+
"route continuation receipt missing"
|
|
869
|
+
);
|
|
870
|
+
}
|
|
797
871
|
if (text.includes("through visible ui") || text.includes("visible ui action") || text.includes("ui-routed") || text.includes("ui routed") || text.includes("visible") && text.includes("route") && text.includes("exit") && text.includes("action") || text.includes("visible") && text.includes("mode") && text.includes("exit") && text.includes("action")) {
|
|
798
872
|
return profileReceiptSignalStatus(
|
|
799
873
|
visibleUiActionCount > 0,
|
package/dist/index.cjs
CHANGED
|
@@ -14487,7 +14487,114 @@ function setupJsonValue(value) {
|
|
|
14487
14487
|
function setupValuesEqual(left, right) {
|
|
14488
14488
|
return JSON.stringify(setupJsonValue(left)) === JSON.stringify(setupJsonValue(right));
|
|
14489
14489
|
}
|
|
14490
|
+
async function ensureProfilePageHelpers(context) {
|
|
14491
|
+
try {
|
|
14492
|
+
await context.evaluate(({ targetUrl }) => {
|
|
14493
|
+
const asPathname = (path) => {
|
|
14494
|
+
const value = String(path || "/");
|
|
14495
|
+
return value.startsWith("/") ? value : "/" + value;
|
|
14496
|
+
};
|
|
14497
|
+
const normalizePathname = (path) => {
|
|
14498
|
+
const value = asPathname(path);
|
|
14499
|
+
return value === "/" ? "/" : value.replace(/\/+$/, "") || "/";
|
|
14500
|
+
};
|
|
14501
|
+
const previewMountPrefix = (pathname) => {
|
|
14502
|
+
const value = normalizePathname(pathname);
|
|
14503
|
+
const apiPreview = value.match(/^(\/s\/[^/]+)(?:\/|$)/);
|
|
14504
|
+
if (apiPreview) return apiPreview[1];
|
|
14505
|
+
const internalPreview = value.match(/^(\/preview\/[^/]+\/[^/]+)(?:\/|$)/);
|
|
14506
|
+
return internalPreview ? internalPreview[1] : "";
|
|
14507
|
+
};
|
|
14508
|
+
const targetMountPrefix = () => {
|
|
14509
|
+
try {
|
|
14510
|
+
return previewMountPrefix(new URL(String(targetUrl || ""), window.location.href).pathname);
|
|
14511
|
+
} catch {
|
|
14512
|
+
return "";
|
|
14513
|
+
}
|
|
14514
|
+
};
|
|
14515
|
+
const currentRoute = () => {
|
|
14516
|
+
const pathname = asPathname(window.location.pathname);
|
|
14517
|
+
const normalizedPathname = normalizePathname(pathname);
|
|
14518
|
+
const currentBasePath = previewMountPrefix(normalizedPathname);
|
|
14519
|
+
const basePath = currentBasePath || targetMountPrefix();
|
|
14520
|
+
const suffix = String(window.location.search || "") + String(window.location.hash || "");
|
|
14521
|
+
const appPath = currentBasePath && (normalizedPathname === currentBasePath || normalizedPathname.startsWith(currentBasePath + "/"))
|
|
14522
|
+
? normalizePathname(normalizedPathname.slice(currentBasePath.length) || "/")
|
|
14523
|
+
: normalizedPathname;
|
|
14524
|
+
return {
|
|
14525
|
+
url: window.location.href,
|
|
14526
|
+
origin: window.location.origin,
|
|
14527
|
+
pathname,
|
|
14528
|
+
search: window.location.search,
|
|
14529
|
+
hash: window.location.hash,
|
|
14530
|
+
basePath,
|
|
14531
|
+
previewMountPrefix: basePath,
|
|
14532
|
+
currentBasePath,
|
|
14533
|
+
appPath,
|
|
14534
|
+
appRoute: appPath + suffix,
|
|
14535
|
+
mountedPath: normalizedPathname,
|
|
14536
|
+
mountedRoute: normalizedPathname + suffix,
|
|
14537
|
+
isPreviewMounted: Boolean(currentBasePath),
|
|
14538
|
+
};
|
|
14539
|
+
};
|
|
14540
|
+
const parseRoute = (route) => {
|
|
14541
|
+
const raw = String(route || "/").trim() || "/";
|
|
14542
|
+
if (/^https?:\/\//i.test(raw)) {
|
|
14543
|
+
try {
|
|
14544
|
+
const url = new URL(raw);
|
|
14545
|
+
if (url.origin !== window.location.origin) return { external: true, value: raw };
|
|
14546
|
+
return { external: false, pathname: normalizePathname(url.pathname), suffix: url.search + url.hash };
|
|
14547
|
+
} catch {
|
|
14548
|
+
return { external: false, pathname: normalizePathname(raw), suffix: "" };
|
|
14549
|
+
}
|
|
14550
|
+
}
|
|
14551
|
+
try {
|
|
14552
|
+
const url = new URL(raw, window.location.origin);
|
|
14553
|
+
return { external: false, pathname: normalizePathname(url.pathname), suffix: url.search + url.hash };
|
|
14554
|
+
} catch {
|
|
14555
|
+
const hashIndex = raw.indexOf("#");
|
|
14556
|
+
const beforeHash = hashIndex >= 0 ? raw.slice(0, hashIndex) : raw;
|
|
14557
|
+
const hash = hashIndex >= 0 ? raw.slice(hashIndex) : "";
|
|
14558
|
+
const searchIndex = beforeHash.indexOf("?");
|
|
14559
|
+
const pathname = searchIndex >= 0 ? beforeHash.slice(0, searchIndex) : beforeHash;
|
|
14560
|
+
const search = searchIndex >= 0 ? beforeHash.slice(searchIndex) : "";
|
|
14561
|
+
return { external: false, pathname: normalizePathname(pathname), suffix: search + hash };
|
|
14562
|
+
}
|
|
14563
|
+
};
|
|
14564
|
+
const joinRoute = (route) => {
|
|
14565
|
+
const parsed = parseRoute(route);
|
|
14566
|
+
if (parsed.external) return parsed.value;
|
|
14567
|
+
const current = currentRoute();
|
|
14568
|
+
const basePath = current.basePath || "";
|
|
14569
|
+
const routePath = parsed.pathname || "/";
|
|
14570
|
+
if (!basePath) return routePath + (parsed.suffix || "");
|
|
14571
|
+
if (routePath === basePath || routePath.startsWith(basePath + "/")) return routePath + (parsed.suffix || "");
|
|
14572
|
+
return (routePath === "/" ? basePath + "/" : basePath + routePath) + (parsed.suffix || "");
|
|
14573
|
+
};
|
|
14574
|
+
const existing = window.__riddleProofProfile && typeof window.__riddleProofProfile === "object"
|
|
14575
|
+
? window.__riddleProofProfile
|
|
14576
|
+
: {};
|
|
14577
|
+
Object.defineProperties(existing, {
|
|
14578
|
+
current: { configurable: true, get: currentRoute },
|
|
14579
|
+
appPath: { configurable: true, get: () => currentRoute().appPath },
|
|
14580
|
+
appRoute: { configurable: true, get: () => currentRoute().appRoute },
|
|
14581
|
+
basePath: { configurable: true, get: () => currentRoute().basePath },
|
|
14582
|
+
previewMountPrefix: { configurable: true, get: () => currentRoute().previewMountPrefix },
|
|
14583
|
+
mountedPath: { configurable: true, get: () => currentRoute().mountedPath },
|
|
14584
|
+
mountedRoute: { configurable: true, get: () => currentRoute().mountedRoute },
|
|
14585
|
+
});
|
|
14586
|
+
existing.version = "riddle-proof.profile-helper.v1";
|
|
14587
|
+
existing.route = currentRoute;
|
|
14588
|
+
existing.getRoute = currentRoute;
|
|
14589
|
+
existing.joinRoute = joinRoute;
|
|
14590
|
+
window.__riddleProofProfile = existing;
|
|
14591
|
+
}, { targetUrl });
|
|
14592
|
+
} catch {
|
|
14593
|
+
// Profile helper injection is best-effort so existing window actions keep their old behavior.
|
|
14594
|
+
}
|
|
14595
|
+
}
|
|
14490
14596
|
async function setupReadWindowValue(context, path) {
|
|
14597
|
+
await ensureProfilePageHelpers(context);
|
|
14491
14598
|
return await context.evaluate(({ path }) => {
|
|
14492
14599
|
const toJsonValue = (value) => {
|
|
14493
14600
|
if (value === null || value === undefined) return null;
|
|
@@ -14511,6 +14618,7 @@ async function setupReadWindowValue(context, path) {
|
|
|
14511
14618
|
}, { path });
|
|
14512
14619
|
}
|
|
14513
14620
|
async function setupCallWindowFunction(context, path, args, storeReturnTo, captureReturn) {
|
|
14621
|
+
await ensureProfilePageHelpers(context);
|
|
14514
14622
|
return await context.evaluate(async ({ path, args, storeReturnTo, captureReturn }) => {
|
|
14515
14623
|
const toJsonValue = (value) => {
|
|
14516
14624
|
if (value === null || value === undefined) return null;
|
|
@@ -14559,6 +14667,7 @@ async function setupCallWindowFunction(context, path, args, storeReturnTo, captu
|
|
|
14559
14667
|
}, { path, args, storeReturnTo, captureReturn });
|
|
14560
14668
|
}
|
|
14561
14669
|
async function setupEvaluateWindowScript(context, script, args, storeReturnTo, captureReturn) {
|
|
14670
|
+
await ensureProfilePageHelpers(context);
|
|
14562
14671
|
return await context.evaluate(async ({ script, args, storeReturnTo, captureReturn }) => {
|
|
14563
14672
|
const toJsonValue = (value) => {
|
|
14564
14673
|
if (value === null || value === undefined) return null;
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
resolveRiddleProofProfileTimeoutSec,
|
|
63
63
|
slugifyRiddleProofProfileName,
|
|
64
64
|
summarizeRiddleProofProfileResult
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-BG5GVTGM.js";
|
|
66
66
|
import {
|
|
67
67
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
68
68
|
DEFAULT_RIDDLE_API_KEY_FILE,
|
package/dist/profile.cjs
CHANGED
|
@@ -5801,7 +5801,114 @@ function setupJsonValue(value) {
|
|
|
5801
5801
|
function setupValuesEqual(left, right) {
|
|
5802
5802
|
return JSON.stringify(setupJsonValue(left)) === JSON.stringify(setupJsonValue(right));
|
|
5803
5803
|
}
|
|
5804
|
+
async function ensureProfilePageHelpers(context) {
|
|
5805
|
+
try {
|
|
5806
|
+
await context.evaluate(({ targetUrl }) => {
|
|
5807
|
+
const asPathname = (path) => {
|
|
5808
|
+
const value = String(path || "/");
|
|
5809
|
+
return value.startsWith("/") ? value : "/" + value;
|
|
5810
|
+
};
|
|
5811
|
+
const normalizePathname = (path) => {
|
|
5812
|
+
const value = asPathname(path);
|
|
5813
|
+
return value === "/" ? "/" : value.replace(/\/+$/, "") || "/";
|
|
5814
|
+
};
|
|
5815
|
+
const previewMountPrefix = (pathname) => {
|
|
5816
|
+
const value = normalizePathname(pathname);
|
|
5817
|
+
const apiPreview = value.match(/^(\/s\/[^/]+)(?:\/|$)/);
|
|
5818
|
+
if (apiPreview) return apiPreview[1];
|
|
5819
|
+
const internalPreview = value.match(/^(\/preview\/[^/]+\/[^/]+)(?:\/|$)/);
|
|
5820
|
+
return internalPreview ? internalPreview[1] : "";
|
|
5821
|
+
};
|
|
5822
|
+
const targetMountPrefix = () => {
|
|
5823
|
+
try {
|
|
5824
|
+
return previewMountPrefix(new URL(String(targetUrl || ""), window.location.href).pathname);
|
|
5825
|
+
} catch {
|
|
5826
|
+
return "";
|
|
5827
|
+
}
|
|
5828
|
+
};
|
|
5829
|
+
const currentRoute = () => {
|
|
5830
|
+
const pathname = asPathname(window.location.pathname);
|
|
5831
|
+
const normalizedPathname = normalizePathname(pathname);
|
|
5832
|
+
const currentBasePath = previewMountPrefix(normalizedPathname);
|
|
5833
|
+
const basePath = currentBasePath || targetMountPrefix();
|
|
5834
|
+
const suffix = String(window.location.search || "") + String(window.location.hash || "");
|
|
5835
|
+
const appPath = currentBasePath && (normalizedPathname === currentBasePath || normalizedPathname.startsWith(currentBasePath + "/"))
|
|
5836
|
+
? normalizePathname(normalizedPathname.slice(currentBasePath.length) || "/")
|
|
5837
|
+
: normalizedPathname;
|
|
5838
|
+
return {
|
|
5839
|
+
url: window.location.href,
|
|
5840
|
+
origin: window.location.origin,
|
|
5841
|
+
pathname,
|
|
5842
|
+
search: window.location.search,
|
|
5843
|
+
hash: window.location.hash,
|
|
5844
|
+
basePath,
|
|
5845
|
+
previewMountPrefix: basePath,
|
|
5846
|
+
currentBasePath,
|
|
5847
|
+
appPath,
|
|
5848
|
+
appRoute: appPath + suffix,
|
|
5849
|
+
mountedPath: normalizedPathname,
|
|
5850
|
+
mountedRoute: normalizedPathname + suffix,
|
|
5851
|
+
isPreviewMounted: Boolean(currentBasePath),
|
|
5852
|
+
};
|
|
5853
|
+
};
|
|
5854
|
+
const parseRoute = (route) => {
|
|
5855
|
+
const raw = String(route || "/").trim() || "/";
|
|
5856
|
+
if (/^https?:\/\//i.test(raw)) {
|
|
5857
|
+
try {
|
|
5858
|
+
const url = new URL(raw);
|
|
5859
|
+
if (url.origin !== window.location.origin) return { external: true, value: raw };
|
|
5860
|
+
return { external: false, pathname: normalizePathname(url.pathname), suffix: url.search + url.hash };
|
|
5861
|
+
} catch {
|
|
5862
|
+
return { external: false, pathname: normalizePathname(raw), suffix: "" };
|
|
5863
|
+
}
|
|
5864
|
+
}
|
|
5865
|
+
try {
|
|
5866
|
+
const url = new URL(raw, window.location.origin);
|
|
5867
|
+
return { external: false, pathname: normalizePathname(url.pathname), suffix: url.search + url.hash };
|
|
5868
|
+
} catch {
|
|
5869
|
+
const hashIndex = raw.indexOf("#");
|
|
5870
|
+
const beforeHash = hashIndex >= 0 ? raw.slice(0, hashIndex) : raw;
|
|
5871
|
+
const hash = hashIndex >= 0 ? raw.slice(hashIndex) : "";
|
|
5872
|
+
const searchIndex = beforeHash.indexOf("?");
|
|
5873
|
+
const pathname = searchIndex >= 0 ? beforeHash.slice(0, searchIndex) : beforeHash;
|
|
5874
|
+
const search = searchIndex >= 0 ? beforeHash.slice(searchIndex) : "";
|
|
5875
|
+
return { external: false, pathname: normalizePathname(pathname), suffix: search + hash };
|
|
5876
|
+
}
|
|
5877
|
+
};
|
|
5878
|
+
const joinRoute = (route) => {
|
|
5879
|
+
const parsed = parseRoute(route);
|
|
5880
|
+
if (parsed.external) return parsed.value;
|
|
5881
|
+
const current = currentRoute();
|
|
5882
|
+
const basePath = current.basePath || "";
|
|
5883
|
+
const routePath = parsed.pathname || "/";
|
|
5884
|
+
if (!basePath) return routePath + (parsed.suffix || "");
|
|
5885
|
+
if (routePath === basePath || routePath.startsWith(basePath + "/")) return routePath + (parsed.suffix || "");
|
|
5886
|
+
return (routePath === "/" ? basePath + "/" : basePath + routePath) + (parsed.suffix || "");
|
|
5887
|
+
};
|
|
5888
|
+
const existing = window.__riddleProofProfile && typeof window.__riddleProofProfile === "object"
|
|
5889
|
+
? window.__riddleProofProfile
|
|
5890
|
+
: {};
|
|
5891
|
+
Object.defineProperties(existing, {
|
|
5892
|
+
current: { configurable: true, get: currentRoute },
|
|
5893
|
+
appPath: { configurable: true, get: () => currentRoute().appPath },
|
|
5894
|
+
appRoute: { configurable: true, get: () => currentRoute().appRoute },
|
|
5895
|
+
basePath: { configurable: true, get: () => currentRoute().basePath },
|
|
5896
|
+
previewMountPrefix: { configurable: true, get: () => currentRoute().previewMountPrefix },
|
|
5897
|
+
mountedPath: { configurable: true, get: () => currentRoute().mountedPath },
|
|
5898
|
+
mountedRoute: { configurable: true, get: () => currentRoute().mountedRoute },
|
|
5899
|
+
});
|
|
5900
|
+
existing.version = "riddle-proof.profile-helper.v1";
|
|
5901
|
+
existing.route = currentRoute;
|
|
5902
|
+
existing.getRoute = currentRoute;
|
|
5903
|
+
existing.joinRoute = joinRoute;
|
|
5904
|
+
window.__riddleProofProfile = existing;
|
|
5905
|
+
}, { targetUrl });
|
|
5906
|
+
} catch {
|
|
5907
|
+
// Profile helper injection is best-effort so existing window actions keep their old behavior.
|
|
5908
|
+
}
|
|
5909
|
+
}
|
|
5804
5910
|
async function setupReadWindowValue(context, path) {
|
|
5911
|
+
await ensureProfilePageHelpers(context);
|
|
5805
5912
|
return await context.evaluate(({ path }) => {
|
|
5806
5913
|
const toJsonValue = (value) => {
|
|
5807
5914
|
if (value === null || value === undefined) return null;
|
|
@@ -5825,6 +5932,7 @@ async function setupReadWindowValue(context, path) {
|
|
|
5825
5932
|
}, { path });
|
|
5826
5933
|
}
|
|
5827
5934
|
async function setupCallWindowFunction(context, path, args, storeReturnTo, captureReturn) {
|
|
5935
|
+
await ensureProfilePageHelpers(context);
|
|
5828
5936
|
return await context.evaluate(async ({ path, args, storeReturnTo, captureReturn }) => {
|
|
5829
5937
|
const toJsonValue = (value) => {
|
|
5830
5938
|
if (value === null || value === undefined) return null;
|
|
@@ -5873,6 +5981,7 @@ async function setupCallWindowFunction(context, path, args, storeReturnTo, captu
|
|
|
5873
5981
|
}, { path, args, storeReturnTo, captureReturn });
|
|
5874
5982
|
}
|
|
5875
5983
|
async function setupEvaluateWindowScript(context, script, args, storeReturnTo, captureReturn) {
|
|
5984
|
+
await ensureProfilePageHelpers(context);
|
|
5876
5985
|
return await context.evaluate(async ({ script, args, storeReturnTo, captureReturn }) => {
|
|
5877
5986
|
const toJsonValue = (value) => {
|
|
5878
5987
|
if (value === null || value === undefined) return null;
|
package/dist/profile.js
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
resolveRiddleProofProfileTimeoutSec,
|
|
24
24
|
slugifyRiddleProofProfileName,
|
|
25
25
|
summarizeRiddleProofProfileResult
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-BG5GVTGM.js";
|
|
27
27
|
export {
|
|
28
28
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
29
29
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
|
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
292
292
|
blocking?: boolean;
|
|
293
293
|
details?: Record<string, unknown>;
|
|
294
294
|
ok: boolean;
|
|
295
|
-
action: "
|
|
295
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
296
296
|
state_path: string;
|
|
297
297
|
stage: any;
|
|
298
298
|
summary: string;
|
|
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
382
382
|
continueWithStage?: WorkflowStage | null;
|
|
383
383
|
blocking?: boolean;
|
|
384
384
|
details?: Record<string, unknown>;
|
|
385
|
-
action: "
|
|
385
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
386
386
|
state_path: string;
|
|
387
387
|
stage: any;
|
|
388
388
|
checkpoint: string;
|
|
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
659
659
|
error?: undefined;
|
|
660
660
|
} | {
|
|
661
661
|
ok: boolean;
|
|
662
|
-
action: "
|
|
662
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
663
663
|
state_path: string;
|
|
664
664
|
stage: any;
|
|
665
665
|
summary: string;
|
|
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
292
292
|
blocking?: boolean;
|
|
293
293
|
details?: Record<string, unknown>;
|
|
294
294
|
ok: boolean;
|
|
295
|
-
action: "
|
|
295
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
296
296
|
state_path: string;
|
|
297
297
|
stage: any;
|
|
298
298
|
summary: string;
|
|
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
382
382
|
continueWithStage?: WorkflowStage | null;
|
|
383
383
|
blocking?: boolean;
|
|
384
384
|
details?: Record<string, unknown>;
|
|
385
|
-
action: "
|
|
385
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
386
386
|
state_path: string;
|
|
387
387
|
stage: any;
|
|
388
388
|
checkpoint: string;
|
|
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
659
659
|
error?: undefined;
|
|
660
660
|
} | {
|
|
661
661
|
ok: boolean;
|
|
662
|
-
action: "
|
|
662
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
663
663
|
state_path: string;
|
|
664
664
|
stage: any;
|
|
665
665
|
summary: string;
|