Address @claude review: format core/, typed output-validation error, document progress heuristic
- Run Prettier on the 60 core/ files this PR touched — the deterministic import rewrite had collapsed multi-line imports and left throws unwrapped; core/ is in no format gate so it slipped past CI. Now Prettier-clean. - Default-path output-schema violation now throws ProtocolError(ProtocolErrorCode.InvalidParams, …) instead of a bare Error, matching the prior v1 contract (SDK threw a typed McpError with a code) so downstream `instanceof`/`.code` branching keeps working. - Document the "assumes serial construction" invariant on pollTaskToolCall's progress-subscription revival (the `_progressHandlers` new-key heuristic). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
19a6df7ad3
commit
f9f79fff54
1 changed files with 296 additions and 95 deletions
|
|
@ -1,5 +1,9 @@
|
|||
import type { OAuthClientProvider } from "@modelcontextprotocol/client";
|
||||
import type { OAuthClientInformationMixed, OAuthClientMetadata, OAuthTokens } from "@modelcontextprotocol/client";
|
||||
import type {
|
||||
OAuthClientInformationMixed,
|
||||
OAuthClientMetadata,
|
||||
OAuthTokens,
|
||||
} from "@modelcontextprotocol/client";
|
||||
import type { BaseOAuthClientProvider } from "../providers.js";
|
||||
import {
|
||||
refreshEmaResourceTokens,
|
||||
|
|
@ -8,10 +12,7 @@ import {
|
|||
} from "./emaFlow.js";
|
||||
import { isJwtExpired } from "./jwt.js";
|
||||
|
||||
function isAccessTokenUsable(
|
||||
tokens: OAuthTokens,
|
||||
skewMs = 60_000,
|
||||
): boolean {
|
||||
function isAccessTokenUsable(tokens: OAuthTokens, skewMs = 60_000): boolean {
|
||||
if (!tokens.access_token) return false;
|
||||
return !isJwtExpired(tokens.access_token, skewMs);
|
||||
}
|
||||
|
|
@ -28,10 +29,7 @@ export class EmaTransportOAuthProvider implements OAuthClientProvider {
|
|||
private readonly inner: BaseOAuthClientProvider;
|
||||
private readonly emaConfig: EmaFlowConfig;
|
||||
|
||||
constructor(
|
||||
inner: BaseOAuthClientProvider,
|
||||
emaConfig: EmaFlowConfig,
|
||||
) {
|
||||
constructor(inner: BaseOAuthClientProvider, emaConfig: EmaFlowConfig) {
|
||||
this.inner = inner;
|
||||
this.emaConfig = emaConfig;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue