@poe-platform/safe-js 0.1.772 → 0.1.773

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.
@@ -5592,7 +5592,12 @@ function createDefaultOAuthClientProvider(options) {
5592
5592
  };
5593
5593
  assertNoAccessTokenInUrl(input.requestUrl, "Protected resource request URL");
5594
5594
  const requestUrl = canonicalizeResourceIndicator(input.requestUrl);
5595
- const resource = canonicalizeResourceIndicator(input.discovery.resource);
5595
+ const discovery = input.discovery ?? structuredClone(await waitForOAuthOperation(
5596
+ input.discover?.() ?? Promise.reject(new Error("OAuth recovery requires metadata discovery")),
5597
+ input.signal
5598
+ ));
5599
+ if (discovery === void 0) throw new Error("OAuth recovery requires metadata discovery");
5600
+ const resource = canonicalizeResourceIndicator(discovery.resource);
5596
5601
  assertRequestMatchesResource(requestUrl, resource);
5597
5602
  const cached = await waitForOAuthOperation(loadSession(resource), input.signal);
5598
5603
  const currentTokens = cached?.tokens ?? (!initialGrantConsumed && initialGrant?.resource === resource ? initialGrant.tokens : void 0);
@@ -5614,7 +5619,7 @@ function createDefaultOAuthClientProvider(options) {
5614
5619
  const session = await ensureAuthorizedSession(
5615
5620
  resource,
5616
5621
  {
5617
- ...input.discovery,
5622
+ ...discovery,
5618
5623
  resource
5619
5624
  },
5620
5625
  input.fetch,
@@ -8255,7 +8260,8 @@ var HttpTransport = class {
8255
8260
  try {
8256
8261
  const challenge = parseBearerWwwAuthenticateHeader(response.headers.get("WWW-Authenticate"));
8257
8262
  const resourceMetadataUrl = challenge?.params.resource_metadata;
8258
- const discovery = await discoveryClient.discover(this.url, { resourceMetadataUrl, signal });
8263
+ let discovery;
8264
+ const discover = () => discovery ??= discoveryClient.discover(this.url, { resourceMetadataUrl, signal });
8259
8265
  const providerResponse = response.clone();
8260
8266
  let result;
8261
8267
  try {
@@ -8263,7 +8269,7 @@ var HttpTransport = class {
8263
8269
  requestUrl: new URL(this.url),
8264
8270
  response: providerResponse,
8265
8271
  challenge,
8266
- discovery,
8272
+ discover,
8267
8273
  signal,
8268
8274
  requestHeaders: new Headers(requestHeaders),
8269
8275
  presentedTokens,
@@ -2,7 +2,7 @@ import {
2
2
  McpError,
3
3
  connectMcpTransport,
4
4
  normalizeMcpOptions
5
- } from "./chunk-L3MIVH3T.js";
5
+ } from "./chunk-DYUX6CBF.js";
6
6
  import {
7
7
  declareHostOperation,
8
8
  runResources
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-KULEMOAE.js";
16
16
  import {
17
17
  parseMcpConfig
18
- } from "./chunk-L3MIVH3T.js";
18
+ } from "./chunk-DYUX6CBF.js";
19
19
  import {
20
20
  lint
21
21
  } from "./chunk-OPYN6N5M.js";
@@ -296,7 +296,7 @@ async function runScriptFile(filepath, parsed, options) {
296
296
  import("./dump-XDJEF2LG.js"),
297
297
  import("./runtime-modules-SL5D6LAJ.js"),
298
298
  import("../modules/fs.js"),
299
- import("./mcp-D3XHUZV7.js")
299
+ import("./mcp-R3VLCRHJ.js")
300
300
  ]);
301
301
  const loaded = loadExecutableSource(filepath, await options.readFile(filepath, "utf8"));
302
302
  const meta = {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  makeMcpModule
3
- } from "./chunk-5NPVS5EY.js";
4
- import "./chunk-L3MIVH3T.js";
3
+ } from "./chunk-VVUKH2DQ.js";
4
+ import "./chunk-DYUX6CBF.js";
5
5
  import "./chunk-ULPZIHB5.js";
6
6
  import "./chunk-A3LXCGMJ.js";
7
7
  import "./chunk-JCHJGIQA.js";
@@ -13,7 +13,7 @@ import path from "node:path";
13
13
  import { fileURLToPath } from "node:url";
14
14
  async function runCli(argv, options = {}) {
15
15
  if (!argv.includes("--help") && !argv.includes("-h")) {
16
- const runtime = await import("./chunks/cli-runtime-477PXAC5.js");
16
+ const runtime = await import("./chunks/cli-runtime-S5WKJ7FW.js");
17
17
  return runtime.runCli(argv, options, createUsage());
18
18
  }
19
19
  const brokenPipe = createBrokenPipeState();
@@ -32,7 +32,7 @@ async function runCli(argv, options = {}) {
32
32
  stderr.write(`${error instanceof Error ? error.message : String(error)}
33
33
  `);
34
34
  if (brokenPipe.closed) return 0;
35
- const { exitCodeForError } = await import("./chunks/cli-runtime-477PXAC5.js");
35
+ const { exitCodeForError } = await import("./chunks/cli-runtime-S5WKJ7FW.js");
36
36
  return exitCodeForError(error);
37
37
  }
38
38
  }
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunks/chunk-UU4T2KIT.js";
12
12
  import {
13
13
  makeMcpModule
14
- } from "./chunks/chunk-5NPVS5EY.js";
14
+ } from "./chunks/chunk-VVUKH2DQ.js";
15
15
  import {
16
16
  AgentSpawnError,
17
17
  EnvAccessError,
@@ -35,7 +35,7 @@ import {
35
35
  } from "./chunks/chunk-KULEMOAE.js";
36
36
  import {
37
37
  parseMcpConfig
38
- } from "./chunks/chunk-L3MIVH3T.js";
38
+ } from "./chunks/chunk-DYUX6CBF.js";
39
39
  import {
40
40
  lint
41
41
  } from "./chunks/chunk-OPYN6N5M.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-js",
3
- "version": "0.1.772",
3
+ "version": "0.1.773",
4
4
  "description": "Budgeted JavaScript interpreter with explicit host capabilities and resumable execution",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -58,7 +58,7 @@
58
58
  "access": "public"
59
59
  },
60
60
  "dependencies": {
61
- "@poe-platform/safe-fs": "0.1.772",
61
+ "@poe-platform/safe-fs": "0.1.773",
62
62
  "@petamoriken/float16": "^3.9.3",
63
63
  "@noble/hashes": "2.4.0",
64
64
  "@formatjs/intl-localematcher": "0.8.13",