toolcraft 0.0.351 → 0.0.352

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/composition.json CHANGED
@@ -113,7 +113,7 @@
113
113
  },
114
114
  {
115
115
  "name": "toolcraft",
116
- "version": "0.0.351",
116
+ "version": "0.0.352",
117
117
  "license": "MIT"
118
118
  },
119
119
  {
@@ -123,7 +123,7 @@
123
123
  },
124
124
  {
125
125
  "name": "toolcraft-schema",
126
- "version": "0.0.351",
126
+ "version": "0.0.352",
127
127
  "license": "MIT"
128
128
  },
129
129
  {
@@ -113,7 +113,7 @@
113
113
  },
114
114
  {
115
115
  "name": "toolcraft",
116
- "version": "0.0.351",
116
+ "version": "0.0.352",
117
117
  "license": "MIT"
118
118
  },
119
119
  {
@@ -123,7 +123,7 @@
123
123
  },
124
124
  {
125
125
  "name": "toolcraft-schema",
126
- "version": "0.0.351",
126
+ "version": "0.0.352",
127
127
  "license": "MIT"
128
128
  },
129
129
  {
@@ -123,6 +123,9 @@ A browser callback cannot redirect a later code exchange by changing caller
123
123
  metadata. Metadata loaded from a host session store is copied before clock or
124
124
  fetch callbacks, retaining the original refresh endpoint and persisted extensions. Explicit authentication owns metadata when lazy discovery returns;
125
125
  the selected discovery method retains its original receiver and live host state.
126
+ Browser and standalone loopback snapshots retain declared redirects, deadlines,
127
+ cancellation and selected host hooks regardless of property enumerability.
128
+ Browser callback hooks retain their original receiver and live host state.
126
129
 
127
130
  Provider request inputs accept an optional `signal`. It reaches callback waits,
128
131
  registration, token requests and bounded token-body reads. Cancellation retains
@@ -6,7 +6,7 @@ import { isIP } from "node:net";
6
6
  import { fetchMcpResponse } from "../http-fetch.js";
7
7
  import { URL } from "node:url";
8
8
  import { createAuthStoreClientStore, createAuthStoreSessionStore, assertPersistenceNamespace } from "./auth-store-session-store.js";
9
- import { createLoopbackAuthorizationSession, loopbackTarget } from "./loopback-authorization.js";
9
+ import { createLoopbackAuthorizationSession, loopbackTarget, snapshotLoopbackAuthorizationOptions } from "./loopback-authorization.js";
10
10
  import { createAuthorizationState } from "./authorization-state.js";
11
11
  import { generateCodeChallenge, generateCodeVerifier } from "./pkce.js";
12
12
  import { exchangeAuthorizationCode, OAuthError, refreshAccessToken, isRetryableOAuthError, readOAuthJsonObjectResponse } from "./token-endpoint.js";
@@ -21,8 +21,7 @@ export function createOAuthClientProvider(options) {
21
21
  return createDefaultOAuthClientProvider(options);
22
22
  }
23
23
  export function createDefaultOAuthClientProvider(options) {
24
- const browser = { ...options.browser,
25
- ...(options.browser.landingPage === undefined ? {} : { landingPage: { ...options.browser.landingPage } }) };
24
+ const browser = snapshotLoopbackAuthorizationOptions(options.browser);
26
25
  const clientMode = options.client.mode;
27
26
  const interactiveEnabled = options.allowInteractive !== false;
28
27
  const sessionLockTimeoutMs = options.sessionLockTimeoutMs;
@@ -20,6 +20,8 @@ export interface LoopbackAuthorizationSession {
20
20
  waitForCode(authorizationUrl: string): Promise<string>;
21
21
  close(): void;
22
22
  }
23
+ /** Capture declared configuration regardless of property enumerability. */
24
+ export declare function snapshotLoopbackAuthorizationOptions(options: LoopbackAuthorizationOptions): LoopbackAuthorizationOptions;
23
25
  /** Authorization callback denial, retaining the provider diagnostic for host observers. */
24
26
  export declare class OAuthAuthorizationError extends Error {
25
27
  readonly error: string;
@@ -2,6 +2,12 @@ import http from "node:http";
2
2
  import { parseAuthorizationState } from "./authorization-state.js";
3
3
  const authorizationErrorBrand = Symbol.for("poe-platform.mcp-oauth.OAuthAuthorizationError");
4
4
  const oauthCallbackParameters = ["code", "state", "iss", "error", "error_description", "error_uri"];
5
+ /** Capture declared configuration regardless of property enumerability. */
6
+ export function snapshotLoopbackAuthorizationOptions(options) {
7
+ return { ...options, openBrowser: options.openBrowser?.bind(options), readLine: options.readLine?.bind(options), createServer: options.createServer?.bind(options),
8
+ callbackPath: options.callbackPath, redirectUri: options.redirectUri, signal: options.signal, timeoutMs: options.timeoutMs,
9
+ landingPage: options.landingPage === undefined ? undefined : { ...options.landingPage } };
10
+ }
5
11
  /** Authorization callback denial, retaining the provider diagnostic for host observers. */
6
12
  export class OAuthAuthorizationError extends Error {
7
13
  error;
@@ -19,10 +25,7 @@ export class OAuthAuthorizationError extends Error {
19
25
  }
20
26
  }
21
27
  export async function createLoopbackAuthorizationSession(options = {}) {
22
- const selected = { ...options };
23
- options = { ...selected, createServer: selected.createServer?.bind(options),
24
- openBrowser: selected.openBrowser?.bind(options), readLine: selected.readLine?.bind(options),
25
- landingPage: selected.landingPage === undefined ? undefined : { ...selected.landingPage } };
28
+ options = snapshotLoopbackAuthorizationOptions(options);
26
29
  options.signal?.throwIfAborted();
27
30
  const timeoutMs = options.timeoutMs ?? 120_000;
28
31
  if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 2_147_483_647)
@@ -3518,6 +3518,19 @@ function getOwnEntry(record2, key2) {
3518
3518
  // ../mcp-oauth/dist/client/loopback-authorization.js
3519
3519
  var authorizationErrorBrand = /* @__PURE__ */ Symbol.for("poe-platform.mcp-oauth.OAuthAuthorizationError");
3520
3520
  var oauthCallbackParameters = ["code", "state", "iss", "error", "error_description", "error_uri"];
3521
+ function snapshotLoopbackAuthorizationOptions(options) {
3522
+ return {
3523
+ ...options,
3524
+ openBrowser: options.openBrowser?.bind(options),
3525
+ readLine: options.readLine?.bind(options),
3526
+ createServer: options.createServer?.bind(options),
3527
+ callbackPath: options.callbackPath,
3528
+ redirectUri: options.redirectUri,
3529
+ signal: options.signal,
3530
+ timeoutMs: options.timeoutMs,
3531
+ landingPage: options.landingPage === void 0 ? void 0 : { ...options.landingPage }
3532
+ };
3533
+ }
3521
3534
  var OAuthAuthorizationError = class extends Error {
3522
3535
  error;
3523
3536
  errorDescription;
@@ -3534,14 +3547,7 @@ var OAuthAuthorizationError = class extends Error {
3534
3547
  }
3535
3548
  };
3536
3549
  async function createLoopbackAuthorizationSession(options = {}) {
3537
- const selected = { ...options };
3538
- options = {
3539
- ...selected,
3540
- createServer: selected.createServer?.bind(options),
3541
- openBrowser: selected.openBrowser?.bind(options),
3542
- readLine: selected.readLine?.bind(options),
3543
- landingPage: selected.landingPage === void 0 ? void 0 : { ...selected.landingPage }
3544
- };
3550
+ options = snapshotLoopbackAuthorizationOptions(options);
3545
3551
  options.signal?.throwIfAborted();
3546
3552
  const timeoutMs = options.timeoutMs ?? 12e4;
3547
3553
  if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 2147483647)
@@ -5321,10 +5327,7 @@ function createOAuthClientProvider(options) {
5321
5327
  return createDefaultOAuthClientProvider(options);
5322
5328
  }
5323
5329
  function createDefaultOAuthClientProvider(options) {
5324
- const browser = {
5325
- ...options.browser,
5326
- ...options.browser.landingPage === void 0 ? {} : { landingPage: { ...options.browser.landingPage } }
5327
- };
5330
+ const browser = snapshotLoopbackAuthorizationOptions(options.browser);
5328
5331
  const clientMode = options.client.mode;
5329
5332
  const interactiveEnabled = options.allowInteractive !== false;
5330
5333
  const sessionLockTimeoutMs = options.sessionLockTimeoutMs;
@@ -8,7 +8,7 @@
8
8
  },
9
9
  {
10
10
  "name": "toolcraft-schema",
11
- "version": "0.0.351",
11
+ "version": "0.0.352",
12
12
  "license": "MIT"
13
13
  }
14
14
  ]
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft-schema",
3
- "version": "0.0.351",
3
+ "version": "0.0.352",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft",
3
- "version": "0.0.351",
3
+ "version": "0.0.352",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -158,7 +158,7 @@
158
158
  "yaml"
159
159
  ],
160
160
  "optionalDependencies": {
161
- "toolcraft-schema": "0.0.351",
161
+ "toolcraft-schema": "0.0.352",
162
162
  "toolcraft-design": "*",
163
163
  "@poe-code/frontmatter": "*",
164
164
  "@poe-code/agent-mcp-config": "*",