toolcraft 0.0.335 → 0.0.337
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 +3 -3
- package/dist/composition.json +3 -3
- package/node_modules/auth-store/README.md +4 -0
- package/node_modules/auth-store/dist/create-secret-store.d.ts +3 -1
- package/node_modules/auth-store/dist/create-secret-store.js +3 -2
- package/node_modules/auth-store/dist/index.d.ts +1 -1
- package/node_modules/auth-store/dist/index.js +1 -1
- package/node_modules/tiny-http-mcp-server/dist/composition.json +1 -1
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/README.md +10 -0
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/auth-store-session-store.js +11 -1
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.js +14 -14
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/types.d.ts +1 -0
- package/node_modules/tiny-http-mcp-server/package.json +1 -1
- package/node_modules/tiny-mcp-client/dist/index.d.ts +1 -0
- package/node_modules/tiny-mcp-client/dist/index.js +31 -16
- package/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
- package/node_modules/toolcraft-schema/package.json +1 -1
- package/package.json +2 -2
package/composition.json
CHANGED
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"name": "tiny-http-mcp-server",
|
|
101
|
-
"version": "0.1.
|
|
101
|
+
"version": "0.1.60",
|
|
102
102
|
"license": "MIT"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "toolcraft",
|
|
116
|
-
"version": "0.0.
|
|
116
|
+
"version": "0.0.337",
|
|
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.
|
|
126
|
+
"version": "0.0.337",
|
|
127
127
|
"license": "MIT"
|
|
128
128
|
},
|
|
129
129
|
{
|
package/dist/composition.json
CHANGED
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"name": "tiny-http-mcp-server",
|
|
101
|
-
"version": "0.1.
|
|
101
|
+
"version": "0.1.60",
|
|
102
102
|
"license": "MIT"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "toolcraft",
|
|
116
|
-
"version": "0.0.
|
|
116
|
+
"version": "0.0.337",
|
|
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.
|
|
126
|
+
"version": "0.0.337",
|
|
127
127
|
"license": "MIT"
|
|
128
128
|
},
|
|
129
129
|
{
|
|
@@ -25,6 +25,10 @@ const value = await store.get(); // "secret-value"
|
|
|
25
25
|
await store.delete();
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
Use `resolveSecretStoreBackend(options)` to select and validate the backend
|
|
29
|
+
without constructing a store or reading credentials. Pass the returned backend
|
|
30
|
+
explicitly when deferred operations must keep the same environment selection.
|
|
31
|
+
|
|
28
32
|
Both built-in backends expose `store.withLock(operation, { signal, timeoutMs })`
|
|
29
33
|
for transactions spanning a read, external operation and write. Independent
|
|
30
34
|
instances and processes serialize the same encrypted file or Keychain
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import type { CreateSecretStoreInput, CreateSecretStoreResult } from "./types.js";
|
|
1
|
+
import type { CreateSecretStoreInput, CreateSecretStoreResult, StoreBackend } from "./types.js";
|
|
2
2
|
export declare function createSecretStore(input: CreateSecretStoreInput): CreateSecretStoreResult;
|
|
3
|
+
/** Select and validate a backend without constructing a store or accessing credentials. */
|
|
4
|
+
export declare function resolveSecretStoreBackend(input: CreateSecretStoreInput): StoreBackend;
|
|
@@ -17,7 +17,7 @@ const storeFactories = {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
export function createSecretStore(input) {
|
|
20
|
-
const backend =
|
|
20
|
+
const backend = resolveSecretStoreBackend(input);
|
|
21
21
|
const platform = input.platform ?? process.platform;
|
|
22
22
|
if (backend === "keychain" && platform !== MACOS_PLATFORM) {
|
|
23
23
|
throw new Error(`Keychain backend is only supported on macOS. Current platform: ${platform}`);
|
|
@@ -25,7 +25,8 @@ export function createSecretStore(input) {
|
|
|
25
25
|
const store = storeFactories[backend](input);
|
|
26
26
|
return { backend, store };
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
/** Select and validate a backend without constructing a store or accessing credentials. */
|
|
29
|
+
export function resolveSecretStoreBackend(input) {
|
|
29
30
|
const envVar = input.backendEnvVar ?? DEFAULT_BACKEND_ENV_VAR;
|
|
30
31
|
const configuredBackend = input.backend ?? getOwnEnvValue(input.env, envVar) ?? getOwnEnvValue(process.env, envVar);
|
|
31
32
|
const backend = configuredBackend?.trim();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createSecretStore } from "./create-secret-store.js";
|
|
1
|
+
export { createSecretStore, resolveSecretStoreBackend } from "./create-secret-store.js";
|
|
2
2
|
export { EncryptedFileStore } from "./encrypted-file-store.js";
|
|
3
3
|
export { KeychainStore } from "./keychain-store.js";
|
|
4
4
|
export type { SecretStoreLockOptions, SecretStoreLockFileSystem } from "./transaction-lock.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createSecretStore } from "./create-secret-store.js";
|
|
1
|
+
export { createSecretStore, resolveSecretStoreBackend } from "./create-secret-store.js";
|
|
2
2
|
export { EncryptedFileStore } from "./encrypted-file-store.js";
|
|
3
3
|
export { KeychainStore } from "./keychain-store.js";
|
|
4
4
|
export { key, MigratingSecretStore } from "./provider-store.js";
|
|
@@ -57,6 +57,16 @@ const verifier = createJwksTokenVerifier({
|
|
|
57
57
|
- `authStore` optional `auth-store` backend config for the default session store
|
|
58
58
|
- `now()` optional clock override
|
|
59
59
|
|
|
60
|
+
The default provider captures client, interaction, callback, landing-page and
|
|
61
|
+
lock policies when created. Create a new provider to change those settings.
|
|
62
|
+
Selected callbacks, stores, clocks and AbortSignals remain live host dependencies;
|
|
63
|
+
aborting the original signal still cancels authorization.
|
|
64
|
+
Native session and client persistence factories also capture file paths, salts,
|
|
65
|
+
Keychain identities, lock locations and selected filesystem/command handles.
|
|
66
|
+
Mutating these settings cannot redirect a later read or write.
|
|
67
|
+
The factories resolve the selected backend environment variable once at creation;
|
|
68
|
+
later environment changes cannot move a transaction between file and Keychain.
|
|
69
|
+
|
|
60
70
|
`createJwksTokenVerifier(options)` accepts:
|
|
61
71
|
|
|
62
72
|
| Option | Type | Default | Description |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizeStoredOAuthClient } from "./client-registration.js";
|
|
2
2
|
import crypto from "node:crypto";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { createSecretStore } from "auth-store";
|
|
4
|
+
import { createSecretStore, resolveSecretStoreBackend } from "auth-store";
|
|
5
5
|
import { canonicalizeResourceIndicator } from "../resource-indicator.js";
|
|
6
6
|
const DEFAULT_FILE_SALT = "poe-code:mcp-oauth:v1";
|
|
7
7
|
const DEFAULT_FILE_DIRECTORY = ".poe-code/mcp-oauth";
|
|
@@ -12,6 +12,7 @@ const DEFAULT_CLIENT_KEYCHAIN_SERVICE = "poe-code-mcp-oauth-clients";
|
|
|
12
12
|
const MAX_JS_DATE_MS = 8_640_000_000_000_000;
|
|
13
13
|
export function createAuthStoreSessionStore(options = {}, namespace) {
|
|
14
14
|
assertPersistenceNamespace(namespace);
|
|
15
|
+
options = snapshotPersistenceOptions(options);
|
|
15
16
|
return {
|
|
16
17
|
async withLock(resource, operation, lockOptions) {
|
|
17
18
|
const store = createResourceSecretStore(resource, options, namespace);
|
|
@@ -49,6 +50,7 @@ export function createAuthStoreSessionStore(options = {}, namespace) {
|
|
|
49
50
|
}
|
|
50
51
|
export function createAuthStoreClientStore(options, namespace) {
|
|
51
52
|
assertPersistenceNamespace(namespace);
|
|
53
|
+
options = snapshotPersistenceOptions(options);
|
|
52
54
|
return {
|
|
53
55
|
async load(issuer) {
|
|
54
56
|
const store = createIssuerSecretStore(issuer, options, namespace);
|
|
@@ -79,6 +81,14 @@ export function createAuthStoreClientStore(options, namespace) {
|
|
|
79
81
|
}
|
|
80
82
|
};
|
|
81
83
|
}
|
|
84
|
+
function snapshotPersistenceOptions(options) {
|
|
85
|
+
return {
|
|
86
|
+
...options, backend: resolveSecretStoreBackend(options),
|
|
87
|
+
...(options.fileStore === undefined ? {} : { fileStore: { ...options.fileStore } }),
|
|
88
|
+
...(options.keychainStore === undefined ? {} : { keychainStore: { ...options.keychainStore,
|
|
89
|
+
...(options.keychainStore.lock === undefined ? {} : { lock: { ...options.keychainStore.lock } }) } })
|
|
90
|
+
};
|
|
91
|
+
}
|
|
82
92
|
export function createNamedSecretStore(key, options, defaults, namespace) {
|
|
83
93
|
const hash = crypto.createHash("sha256").update(namespace === undefined ? key : JSON.stringify([namespace, key])).digest("hex");
|
|
84
94
|
const configuredFilePath = options.fileStore?.filePath;
|
|
@@ -20,7 +20,12 @@ export function createOAuthClientProvider(options) {
|
|
|
20
20
|
return createDefaultOAuthClientProvider(options);
|
|
21
21
|
}
|
|
22
22
|
export function createDefaultOAuthClientProvider(options) {
|
|
23
|
-
|
|
23
|
+
const browser = { ...options.browser,
|
|
24
|
+
...(options.browser.landingPage === undefined ? {} : { landingPage: { ...options.browser.landingPage } }) };
|
|
25
|
+
const clientMode = options.client.mode;
|
|
26
|
+
const interactiveEnabled = options.allowInteractive !== false;
|
|
27
|
+
const sessionLockTimeoutMs = options.sessionLockTimeoutMs;
|
|
28
|
+
loopbackTarget(browser);
|
|
24
29
|
assertPersistenceNamespace(options.persistenceNamespace);
|
|
25
30
|
const clientMetadata = getClientMetadata(options.client);
|
|
26
31
|
const requestedScope = clientMetadata?.scope;
|
|
@@ -187,7 +192,7 @@ export function createDefaultOAuthClientProvider(options) {
|
|
|
187
192
|
if (forceRefresh && rejectedTokens !== undefined && (rejectedTokens === null || session?.tokens === undefined || !sameTokenGrant(session.tokens, rejectedTokens)))
|
|
188
193
|
forceRefresh = false;
|
|
189
194
|
const sessionDiscovery = resolveDiscovery(discovery, session);
|
|
190
|
-
if ((
|
|
195
|
+
if ((clientMode === "static" || configuredClient !== null || initialGrant !== undefined) && session !== null && (session.tokens !== undefined || session.refreshState === "pending")) {
|
|
191
196
|
const configured = configuredClient;
|
|
192
197
|
if (configured === null || configured.clientId !== session.client.clientId || configured.clientSecret !== session.client.clientSecret)
|
|
193
198
|
throw new Error("Stored session belongs to a different OAuth client; use separate persistence or explicitly reset it");
|
|
@@ -198,7 +203,7 @@ export function createDefaultOAuthClientProvider(options) {
|
|
|
198
203
|
(session.client.tokenEndpointAuthMethod ?? (session.client.clientSecret === undefined ? "none" : "client_secret_post")) !== configuredTokenMethod)
|
|
199
204
|
throw new Error("Stored session does not match the requested OAuth token endpoint authentication; select separate persistence or reset it");
|
|
200
205
|
if (session?.refreshState === "pending") {
|
|
201
|
-
if (!allowInteractive ||
|
|
206
|
+
if (!allowInteractive || !interactiveEnabled || sessionDiscovery === undefined)
|
|
202
207
|
throw new Error("OAuth refresh outcome is unknown; authorize again before using this resource");
|
|
203
208
|
return authorizeSession(canonicalResource, clearSessionTokens(session), sessionDiscovery, fetch, signal);
|
|
204
209
|
}
|
|
@@ -209,7 +214,7 @@ export function createDefaultOAuthClientProvider(options) {
|
|
|
209
214
|
sessionDiscovery !== undefined &&
|
|
210
215
|
(forceRefresh || isExpired(session.tokens, now))) {
|
|
211
216
|
if (hasExpiredClientSecret(session.client, now)) {
|
|
212
|
-
if (!allowInteractive ||
|
|
217
|
+
if (!allowInteractive || !interactiveEnabled || clientMode === "static" || configuredClient?.registration !== undefined)
|
|
213
218
|
throw new Error("OAuth client secret has expired; authorize again or update the imported registration");
|
|
214
219
|
return authorizeSession(canonicalResource, clearSessionTokens(session), sessionDiscovery, fetch, signal);
|
|
215
220
|
}
|
|
@@ -225,10 +230,10 @@ export function createDefaultOAuthClientProvider(options) {
|
|
|
225
230
|
if (!allowInteractive || sessionDiscovery === undefined) {
|
|
226
231
|
return session;
|
|
227
232
|
}
|
|
228
|
-
if (
|
|
233
|
+
if (!interactiveEnabled)
|
|
229
234
|
throw new Error("OAuth interactive authorization is disabled");
|
|
230
235
|
return authorizeSession(canonicalResource, session, sessionDiscovery, fetch, signal);
|
|
231
|
-
}, { signal, timeoutMs:
|
|
236
|
+
}, { signal, timeoutMs: sessionLockTimeoutMs });
|
|
232
237
|
}
|
|
233
238
|
async function refreshSession(resource, session, discovery, fetch, signal) {
|
|
234
239
|
signal?.throwIfAborted();
|
|
@@ -303,13 +308,8 @@ export function createDefaultOAuthClientProvider(options) {
|
|
|
303
308
|
let reRegistrationAttempted = false;
|
|
304
309
|
while (true) {
|
|
305
310
|
const loopback = await createLoopbackAuthorizationSession({
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
createServer: options.browser.createServer,
|
|
309
|
-
landingPage: options.browser.landingPage,
|
|
310
|
-
redirectUri: options.browser.redirectUri,
|
|
311
|
-
signal: options.browser.signal === undefined ? signal : signal === undefined ? options.browser.signal : AbortSignal.any([signal, options.browser.signal]),
|
|
312
|
-
timeoutMs: options.browser.timeoutMs
|
|
311
|
+
...browser,
|
|
312
|
+
signal: browser.signal === undefined ? signal : signal === undefined ? browser.signal : AbortSignal.any([signal, browser.signal])
|
|
313
313
|
});
|
|
314
314
|
let resolvedClient = null;
|
|
315
315
|
try {
|
|
@@ -379,7 +379,7 @@ export function createDefaultOAuthClientProvider(options) {
|
|
|
379
379
|
}
|
|
380
380
|
async function resolveClient(existingSession, discovery, redirectUri, fetch, parentSignal) {
|
|
381
381
|
parentSignal?.throwIfAborted();
|
|
382
|
-
if (
|
|
382
|
+
if (clientMode === "static" || configuredClient?.registration !== undefined) {
|
|
383
383
|
if (configuredClient === null) {
|
|
384
384
|
throw new Error("OAuth client_id must not be blank");
|
|
385
385
|
}
|
|
@@ -134,6 +134,7 @@ export interface OAuthSessionStore {
|
|
|
134
134
|
timeoutMs: number;
|
|
135
135
|
}): Promise<T>;
|
|
136
136
|
}
|
|
137
|
+
/** Configuration values are captured at creation; selected host dependencies remain live. */
|
|
137
138
|
export interface DefaultOAuthClientProviderOptions {
|
|
138
139
|
client: {
|
|
139
140
|
mode: "dynamic";
|
|
@@ -237,6 +237,7 @@ interface OAuthSessionStore {
|
|
|
237
237
|
timeoutMs: number;
|
|
238
238
|
}): Promise<T>;
|
|
239
239
|
}
|
|
240
|
+
/** Configuration values are captured at creation; selected host dependencies remain live. */
|
|
240
241
|
interface DefaultOAuthClientProviderOptions {
|
|
241
242
|
client: {
|
|
242
243
|
mode: "dynamic";
|
|
@@ -4526,7 +4526,7 @@ var storeFactories = {
|
|
|
4526
4526
|
}
|
|
4527
4527
|
};
|
|
4528
4528
|
function createSecretStore(input) {
|
|
4529
|
-
const backend =
|
|
4529
|
+
const backend = resolveSecretStoreBackend(input);
|
|
4530
4530
|
const platform = input.platform ?? process.platform;
|
|
4531
4531
|
if (backend === "keychain" && platform !== MACOS_PLATFORM) {
|
|
4532
4532
|
throw new Error(`Keychain backend is only supported on macOS. Current platform: ${platform}`);
|
|
@@ -4534,7 +4534,7 @@ function createSecretStore(input) {
|
|
|
4534
4534
|
const store = storeFactories[backend](input);
|
|
4535
4535
|
return { backend, store };
|
|
4536
4536
|
}
|
|
4537
|
-
function
|
|
4537
|
+
function resolveSecretStoreBackend(input) {
|
|
4538
4538
|
const envVar = input.backendEnvVar ?? DEFAULT_BACKEND_ENV_VAR;
|
|
4539
4539
|
const configuredBackend = input.backend ?? getOwnEnvValue(input.env, envVar) ?? getOwnEnvValue(process.env, envVar);
|
|
4540
4540
|
const backend = configuredBackend?.trim();
|
|
@@ -4572,6 +4572,7 @@ var DEFAULT_CLIENT_KEYCHAIN_SERVICE = "poe-code-mcp-oauth-clients";
|
|
|
4572
4572
|
var MAX_JS_DATE_MS = 864e13;
|
|
4573
4573
|
function createAuthStoreSessionStore(options = {}, namespace) {
|
|
4574
4574
|
assertPersistenceNamespace(namespace);
|
|
4575
|
+
options = snapshotPersistenceOptions(options);
|
|
4575
4576
|
return {
|
|
4576
4577
|
async withLock(resource, operation, lockOptions) {
|
|
4577
4578
|
const store = createResourceSecretStore(resource, options, namespace);
|
|
@@ -4608,6 +4609,7 @@ function createAuthStoreSessionStore(options = {}, namespace) {
|
|
|
4608
4609
|
}
|
|
4609
4610
|
function createAuthStoreClientStore(options, namespace) {
|
|
4610
4611
|
assertPersistenceNamespace(namespace);
|
|
4612
|
+
options = snapshotPersistenceOptions(options);
|
|
4611
4613
|
return {
|
|
4612
4614
|
async load(issuer) {
|
|
4613
4615
|
const store = createIssuerSecretStore(issuer, options, namespace);
|
|
@@ -4635,6 +4637,17 @@ function createAuthStoreClientStore(options, namespace) {
|
|
|
4635
4637
|
}
|
|
4636
4638
|
};
|
|
4637
4639
|
}
|
|
4640
|
+
function snapshotPersistenceOptions(options) {
|
|
4641
|
+
return {
|
|
4642
|
+
...options,
|
|
4643
|
+
backend: resolveSecretStoreBackend(options),
|
|
4644
|
+
...options.fileStore === void 0 ? {} : { fileStore: { ...options.fileStore } },
|
|
4645
|
+
...options.keychainStore === void 0 ? {} : { keychainStore: {
|
|
4646
|
+
...options.keychainStore,
|
|
4647
|
+
...options.keychainStore.lock === void 0 ? {} : { lock: { ...options.keychainStore.lock } }
|
|
4648
|
+
} }
|
|
4649
|
+
};
|
|
4650
|
+
}
|
|
4638
4651
|
function createNamedSecretStore(key2, options, defaults, namespace) {
|
|
4639
4652
|
const hash = crypto2.createHash("sha256").update(namespace === void 0 ? key2 : JSON.stringify([namespace, key2])).digest("hex");
|
|
4640
4653
|
const configuredFilePath = options.fileStore?.filePath;
|
|
@@ -5239,7 +5252,14 @@ function createOAuthClientProvider(options) {
|
|
|
5239
5252
|
return createDefaultOAuthClientProvider(options);
|
|
5240
5253
|
}
|
|
5241
5254
|
function createDefaultOAuthClientProvider(options) {
|
|
5242
|
-
|
|
5255
|
+
const browser = {
|
|
5256
|
+
...options.browser,
|
|
5257
|
+
...options.browser.landingPage === void 0 ? {} : { landingPage: { ...options.browser.landingPage } }
|
|
5258
|
+
};
|
|
5259
|
+
const clientMode = options.client.mode;
|
|
5260
|
+
const interactiveEnabled = options.allowInteractive !== false;
|
|
5261
|
+
const sessionLockTimeoutMs = options.sessionLockTimeoutMs;
|
|
5262
|
+
loopbackTarget(browser);
|
|
5243
5263
|
assertPersistenceNamespace(options.persistenceNamespace);
|
|
5244
5264
|
const clientMetadata = getClientMetadata(options.client);
|
|
5245
5265
|
const requestedScope = clientMetadata?.scope;
|
|
@@ -5398,7 +5418,7 @@ function createDefaultOAuthClientProvider(options) {
|
|
|
5398
5418
|
if (forceRefresh && rejectedTokens !== void 0 && (rejectedTokens === null || session?.tokens === void 0 || !sameTokenGrant(session.tokens, rejectedTokens)))
|
|
5399
5419
|
forceRefresh = false;
|
|
5400
5420
|
const sessionDiscovery = resolveDiscovery(discovery, session);
|
|
5401
|
-
if ((
|
|
5421
|
+
if ((clientMode === "static" || configuredClient !== null || initialGrant !== void 0) && session !== null && (session.tokens !== void 0 || session.refreshState === "pending")) {
|
|
5402
5422
|
const configured = configuredClient;
|
|
5403
5423
|
if (configured === null || configured.clientId !== session.client.clientId || configured.clientSecret !== session.client.clientSecret)
|
|
5404
5424
|
throw new Error("Stored session belongs to a different OAuth client; use separate persistence or explicitly reset it");
|
|
@@ -5408,7 +5428,7 @@ function createDefaultOAuthClientProvider(options) {
|
|
|
5408
5428
|
if (configuredTokenMethod !== void 0 && session !== null && (session.tokens !== void 0 || session.refreshState === "pending") && (session.client.tokenEndpointAuthMethod ?? (session.client.clientSecret === void 0 ? "none" : "client_secret_post")) !== configuredTokenMethod)
|
|
5409
5429
|
throw new Error("Stored session does not match the requested OAuth token endpoint authentication; select separate persistence or reset it");
|
|
5410
5430
|
if (session?.refreshState === "pending") {
|
|
5411
|
-
if (!allowInteractive ||
|
|
5431
|
+
if (!allowInteractive || !interactiveEnabled || sessionDiscovery === void 0)
|
|
5412
5432
|
throw new Error("OAuth refresh outcome is unknown; authorize again before using this resource");
|
|
5413
5433
|
return authorizeSession(canonicalResource, clearSessionTokens(session), sessionDiscovery, fetch2, signal);
|
|
5414
5434
|
}
|
|
@@ -5417,7 +5437,7 @@ function createDefaultOAuthClientProvider(options) {
|
|
|
5417
5437
|
}
|
|
5418
5438
|
if (session?.tokens?.refreshToken !== void 0 && sessionDiscovery !== void 0 && (forceRefresh || isExpired(session.tokens, now))) {
|
|
5419
5439
|
if (hasExpiredClientSecret(session.client, now)) {
|
|
5420
|
-
if (!allowInteractive ||
|
|
5440
|
+
if (!allowInteractive || !interactiveEnabled || clientMode === "static" || configuredClient?.registration !== void 0)
|
|
5421
5441
|
throw new Error("OAuth client secret has expired; authorize again or update the imported registration");
|
|
5422
5442
|
return authorizeSession(canonicalResource, clearSessionTokens(session), sessionDiscovery, fetch2, signal);
|
|
5423
5443
|
}
|
|
@@ -5433,10 +5453,10 @@ function createDefaultOAuthClientProvider(options) {
|
|
|
5433
5453
|
if (!allowInteractive || sessionDiscovery === void 0) {
|
|
5434
5454
|
return session;
|
|
5435
5455
|
}
|
|
5436
|
-
if (
|
|
5456
|
+
if (!interactiveEnabled)
|
|
5437
5457
|
throw new Error("OAuth interactive authorization is disabled");
|
|
5438
5458
|
return authorizeSession(canonicalResource, session, sessionDiscovery, fetch2, signal);
|
|
5439
|
-
}, { signal, timeoutMs:
|
|
5459
|
+
}, { signal, timeoutMs: sessionLockTimeoutMs });
|
|
5440
5460
|
}
|
|
5441
5461
|
async function refreshSession(resource, session, discovery, fetch2, signal) {
|
|
5442
5462
|
signal?.throwIfAborted();
|
|
@@ -5509,13 +5529,8 @@ function createDefaultOAuthClientProvider(options) {
|
|
|
5509
5529
|
let reRegistrationAttempted = false;
|
|
5510
5530
|
while (true) {
|
|
5511
5531
|
const loopback = await createLoopbackAuthorizationSession({
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
createServer: options.browser.createServer,
|
|
5515
|
-
landingPage: options.browser.landingPage,
|
|
5516
|
-
redirectUri: options.browser.redirectUri,
|
|
5517
|
-
signal: options.browser.signal === void 0 ? signal : signal === void 0 ? options.browser.signal : AbortSignal.any([signal, options.browser.signal]),
|
|
5518
|
-
timeoutMs: options.browser.timeoutMs
|
|
5532
|
+
...browser,
|
|
5533
|
+
signal: browser.signal === void 0 ? signal : signal === void 0 ? browser.signal : AbortSignal.any([signal, browser.signal])
|
|
5519
5534
|
});
|
|
5520
5535
|
let resolvedClient = null;
|
|
5521
5536
|
try {
|
|
@@ -5584,7 +5599,7 @@ function createDefaultOAuthClientProvider(options) {
|
|
|
5584
5599
|
}
|
|
5585
5600
|
async function resolveClient(existingSession, discovery, redirectUri, fetch2, parentSignal) {
|
|
5586
5601
|
parentSignal?.throwIfAborted();
|
|
5587
|
-
if (
|
|
5602
|
+
if (clientMode === "static" || configuredClient?.registration !== void 0) {
|
|
5588
5603
|
if (configuredClient === null) {
|
|
5589
5604
|
throw new Error("OAuth client_id must not be blank");
|
|
5590
5605
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolcraft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.337",
|
|
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.
|
|
161
|
+
"toolcraft-schema": "0.0.337",
|
|
162
162
|
"toolcraft-design": "*",
|
|
163
163
|
"@poe-code/frontmatter": "*",
|
|
164
164
|
"@poe-code/agent-mcp-config": "*",
|