@webskill/sdk 0.5.0 → 0.7.0

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.
Files changed (36) hide show
  1. package/dist/agent.d.ts +2 -2
  2. package/dist/agent.js +274 -42
  3. package/dist/browser.d.ts +127 -5
  4. package/dist/browser.js +611 -17
  5. package/dist/{catalogComponents-DV7cPpUm-C77AEEx9.js → catalogComponents-Dr5dFMAb-DKH_7VPI.js} +848 -974
  6. package/dist/{dist-6C03DShK.js → dist-D0qW6e40.js} +1213 -210
  7. package/dist/{dist-bewtXYlO.js → dist-DnYG2-eY.js} +53 -14
  8. package/dist/{env--jJB-TSX-04klhTYi.js → env-8cY40DXB-CGnEVZby.js} +7 -6
  9. package/dist/{env-BPUBZCwJ-4jat_SVG.d.ts → env-AK3cSMEA-Dli6QU5E.d.ts} +4 -3
  10. package/dist/eventTypes-DjIQpt8Y-Bj3vghj4.js +32 -0
  11. package/dist/governance.d.ts +78 -11
  12. package/dist/governance.js +173 -50
  13. package/dist/{index-D_7ZZjkl.d.ts → index-Ba3xFtfz.d.ts} +222 -8
  14. package/dist/{index-Bsqg4ftU.d.ts → index-BwsK9lGk.d.ts} +13 -7
  15. package/dist/{index-vBz_FC9w.d.ts → index-DkbABR43.d.ts} +336 -52
  16. package/dist/index.d.ts +3 -3
  17. package/dist/index.js +3 -3
  18. package/dist/mcp.d.ts +159 -11
  19. package/dist/mcp.js +276 -45
  20. package/dist/{memoryArtifactStore-BtOeB_hm-tj3fC5ip.js → memoryArtifactStore-52Zn9npI-BMPYwvoy.js} +10 -2
  21. package/dist/node.d.ts +4 -4
  22. package/dist/node.js +11 -3
  23. package/dist/{openUiLibrary-W3Ce896k-ClFTRZFs.js → openUiLibrary-Bdrji9qK-D2LxmM-a.js} +3 -3
  24. package/dist/{skillVersionStore-BzLbzFOL-CxwIewHJ.d.ts → skillVersionStore-Bl-ElD45-CWPvGvoq.d.ts} +8 -2
  25. package/dist/{testing-DDCJWvgA.js → testing-CYTFqkDm.js} +1 -1
  26. package/dist/testing.d.ts +2 -2
  27. package/dist/testing.js +3 -3
  28. package/dist/{types-D_hoCri8-BnNPiZCi.d.ts → types-CcxRLdJG-DCXyw1US.d.ts} +62 -10
  29. package/dist/ui-react.d.ts +5 -3
  30. package/dist/ui-react.js +72 -47
  31. package/dist/ui-vue.d.ts +1 -1
  32. package/dist/ui-vue.js +13 -8
  33. package/dist/ui.d.ts +3 -3
  34. package/dist/ui.js +2 -2
  35. package/dist/{webskillLitCatalog-_mugzRHx-DiuJpCuf.js → webskillLitCatalog-_mugzRHx-B_54vxum.js} +1 -1
  36. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as SkillDiscovery, A as CryptoKeyLike, At as isValidSkillName, B as PageQuery, Bt as renderCatalogJson, C as UiSpecEvent, Ct as buildCatalog, D as UiSurfaceActionResponse, Dt as computeDigest, E as UiSurfaceActionRequest, Et as checkSkillRules, F as FsTrustedKeyStore, Ft as parseSkillMarkdown, G as SKILL_NAME_MAX_LENGTH, Gt as unzipWithLimits, H as SIGNATURE_SCHEMA_VERSION, Ht as resolveInsideRoot, I as JsonSchema, It as parseSkillPackManifest, J as SKILL_SIGNATURE_FILE, Jt as verifySkillSignature, K as SKILL_NAME_PATTERN, Kt as validateSkills, L as MANIFEST_EXCLUDED_FILES, Lt as readResponseWithLimit, M as DiscoveryResult, Mt as keyIdOf, N as FileStat, Nt as messageOf, O as ArchiveLimits, Ot as escapeXml, P as FileSystemProvider, Pt as normalizePath, Q as SkillCatalogEntry, R as MemoryFS, Rt as readSkillSignature, S as UiSpecDrafts, St as atomicWriteText, T as UiSpecSnapshot, Tt as checkDependencyCycles, U as SKILLS_LOCKFILE, Ut as signSkill, V as RemoteUrlPolicy, Vt as resolveArchiveLimits, W as SKILL_MANIFEST_FILE, Wt as signaturePayloadBytes, X as SignatureVerdict, Y as SignatureAuditSink, Yt as xmlRenderer, Z as SkillCatalog, _ as MemoryStore, _t as VerifyResult, a as InteractionOrigin, at as SkillManifest, b as UiBridge, bt as assertRemoteUrlAllowed, c as InteractionResponse, ct as SkillReader, d as LlmContentPart, dt as SkillsLockfile, et as SkillDocument, f as LlmMessage, ft as TrustedKey, g as LlmToolSpec, gt as ValidationReport, h as LlmToolCall, ht as UnsignedPolicy, i as FormField, it as SkillManagerPort, j as DEFAULT_ARCHIVE_LIMITS, jt as jsonRenderer, k as CatalogRenderer, kt as exportSkills, l as LlmClient, lt as SkillSignature, m as LlmStreamEvent, mt as UiSpecNode, n as ArtifactStore, nt as SkillIssue, o as InteractionPolicy, ot as SkillMetadata, p as LlmResponse, pt as TrustedKeyStore, q as SKILL_PACK_FILE, qt as verifyManifest, r as ChartSpec, rt as SkillLocation, s as InteractionRequest, st as SkillPackManifest, t as Artifact, tt as SkillInstallSource, u as LlmCompleteInput, ut as SkillSource, v as RenderBlock, vt as WebSkillError, w as UiSpecPatch, wt as buildManifest, x as UiSpecActionCapability, xt as assertSafePathSegment, y as RenderResultRequest, yt as WebSkillErrorCode, z as Page, zt as renderAvailableSkillsXml } from "./types-D_hoCri8-BnNPiZCi.js";
2
- import { $ as RouteLifecycleData, $t as fromVercelResult, A as FsSessionStore, At as TodoTraceEvent, B as LifecycleEventInit, Bt as WebSkillApi, C as FS_SESSION_PAGE_SIZE, Ct as SessionStore, D as FsMemoryStore, Dt as SkillRouter, E as FsArtifactStore, Et as SkillOutcomeReporter, F as HookRunnerOptions, Ft as TraceEvent, G as OpenAiCompatibleClient, Gt as clearFormValues, H as LifecycleHookContext, Ht as WebSkillRuntimeDeps, I as InstalledSkillManifest, It as TraceEventType, J as READ_SKILL_FILE_INPUT_SCHEMA, Jt as createWebSkillApi, K as OpenAiCompatibleClientConfig, Kt as clearStoredFormValues, L as IntegrityVerdict, Lt as TraceRecorder, M as GoogleGenAiClient, Mt as ToolResolution, N as GoogleGenAiClientConfig, Nt as ToolResult, O as FsRunSnapshotStore, Ot as SkillStateGuard, P as HookRunner, Pt as TraceClock, Q as RUN_TRACE_SCHEMA_VERSION, Qt as formFieldKey, R as InteractLifecycleData, Rt as UnsupportedRunSnapshot, S as FORM_VALUES_KEY, St as SessionRecord, T as FormValueRecord, Tt as SkillIntegrityGuard, U as LifecycleListener, Ut as bridgeError, V as LifecycleHook, Vt as WebSkillRuntime, W as NetworkPolicy, Wt as buildRenderResult, X as READ_SKILL_FILE_TOOL_NAME, Xt as extractTodoTraceEvents, Y as READ_SKILL_FILE_TOOL, Yt as extractChartSpec, Z as RUN_SNAPSHOT_SCHEMA_VERSION, Zt as extractUiSpecEvents, _ as CapabilityMode, _n as toLlmToolSpec, _t as SchemaInferer, a as AgentLoop, an as networkUrlHost, at as RunTerminationReason, b as ExternalSkillProvider, bn as validateUiSpecNode, bt as SerializingMemoryStore, c as AnthropicClient, cn as normalizeToolError, ct as RunTraceFilter, d as ApprovalScope, dn as putFormValues, dt as RunTraceSummary, en as fromVercelStreamPart, et as RouteResult, f as BridgeCapabilities, fn as readFormValues, ft as RuntimePhase, g as CapabilityApproval, gn as textParts, gt as SESSION_SCHEMA_VERSION, h as BridgeResponse, hn as summarizeToolCalls, ht as RuntimeSessionHandle, i as ActivateLifecycleData, in as networkPolicyLibSource, it as RunSnapshotStore, j as FullDisclosureRouter, jt as ToolDefinition, k as FsRunTraceStore, kt as TerminalLifecycleData, l as AnthropicClientConfig, ln as parseBridgeRequest, lt as RunTraceMetrics, m as BridgeRequest, mn as schemaToForm, mt as RuntimeSession, n as ASK_USER_TOOL, nn as isUnsupportedRunSnapshot, nt as RunSnapshot, o as AgentLoopConfig, on as normalizeErrorCode, ot as RunToolCall, p as BridgeCapability, pn as resolveToolName, pt as RuntimeRun, q as ProgressiveRouter, qt as createScriptContext, r as ASK_USER_TOOL_NAME, rn as mergeCatalogEntries, rt as RunSnapshotListEntry, s as AgentLoopDeps, sn as normalizeToolContent, st as RunTraceFile, t as ASK_USER_INPUT_SCHEMA, tn as isNetworkAllowed, tt as RunResult, u as ApprovalDecision, un as partsToText, ut as RunTraceStore, v as EventBus, vn as toVercelToolSpecs, vt as ScriptExecutionContext, w as FormValueMap, wt as SkillFailureReport, x as ExternalToolSource, xt as SessionMeta, y as ExecuteLifecycleData, yn as validateUiSpecEvent, yt as ScriptExecutor, z as LifecycleEvent, zt as VercelToolSpec } from "./index-vBz_FC9w.js";
3
- export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, type ActivateLifecycleData, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, AnthropicClient, type AnthropicClientConfig, type ApprovalDecision, type ApprovalScope, type ArchiveLimits, type Artifact, type ArtifactStore, type BridgeCapabilities, type BridgeCapability, type BridgeRequest, type BridgeResponse, CapabilityApproval, type CapabilityMode, type CatalogRenderer, type ChartSpec, type CryptoKeyLike, DEFAULT_ARCHIVE_LIMITS, type DiscoveryResult, EventBus, type ExecuteLifecycleData, type ExternalSkillProvider, type ExternalToolSource, FORM_VALUES_KEY, FS_SESSION_PAGE_SIZE, type FileStat, type FileSystemProvider, type FormField, type FormValueMap, type FormValueRecord, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FsRunTraceStore, FsSessionStore, FsTrustedKeyStore, FullDisclosureRouter, GoogleGenAiClient, type GoogleGenAiClientConfig, HookRunner, type HookRunnerOptions, type InstalledSkillManifest, type IntegrityVerdict, type InteractLifecycleData, type InteractionOrigin, type InteractionPolicy, type InteractionRequest, type InteractionResponse, type JsonSchema, type LifecycleEvent, type LifecycleEventInit, type LifecycleHook, type LifecycleHookContext, type LifecycleListener, type LlmClient, type LlmCompleteInput, type LlmContentPart, type LlmMessage, type LlmResponse, type LlmStreamEvent, type LlmToolCall, type LlmToolSpec, MANIFEST_EXCLUDED_FILES, MemoryFS, type MemoryStore, type NetworkPolicy, OpenAiCompatibleClient, type OpenAiCompatibleClientConfig, type Page, type PageQuery, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, RUN_TRACE_SCHEMA_VERSION, type RemoteUrlPolicy, type RenderBlock, type RenderResultRequest, type RouteLifecycleData, type RouteResult, type RunResult, type RunSnapshot, type RunSnapshotListEntry, type RunSnapshotStore, type RunTerminationReason, type RunToolCall, type RunTraceFile, type RunTraceFilter, type RunTraceMetrics, type RunTraceStore, type RunTraceSummary, type RuntimePhase, type RuntimeRun, type RuntimeSession, type RuntimeSessionHandle, SESSION_SCHEMA_VERSION, SIGNATURE_SCHEMA_VERSION, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, SKILL_SIGNATURE_FILE, type SchemaInferer, type ScriptExecutionContext, type ScriptExecutor, SerializingMemoryStore, type SessionMeta, type SessionRecord, type SessionStore, type SignatureAuditSink, type SignatureVerdict, type SkillCatalog, type SkillCatalogEntry, SkillDiscovery, type SkillDocument, type SkillFailureReport, type SkillInstallSource, type SkillIntegrityGuard, type SkillIssue, type SkillLocation, type SkillManagerPort, type SkillManifest, type SkillMetadata, type SkillOutcomeReporter, type SkillPackManifest, SkillReader, type SkillRouter, type SkillSignature, type SkillSource, type SkillStateGuard, type SkillsLockfile, type TerminalLifecycleData, type TodoTraceEvent, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type TrustedKey, type TrustedKeyStore, type UiBridge, type UiSpecActionCapability, type UiSpecDrafts, type UiSpecEvent, type UiSpecNode, type UiSpecPatch, type UiSpecSnapshot, type UiSurfaceActionRequest, type UiSurfaceActionResponse, type UnsignedPolicy, type UnsupportedRunSnapshot, type ValidationReport, type VercelToolSpec, type VerifyResult, type WebSkillApi, WebSkillError, type WebSkillErrorCode, WebSkillRuntime, type WebSkillRuntimeDeps, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, clearFormValues, clearStoredFormValues, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, extractTodoTraceEvents, extractUiSpecEvents, formFieldKey, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isUnsupportedRunSnapshot, isValidSkillName, jsonRenderer, keyIdOf, mergeCatalogEntries, messageOf, networkPolicyLibSource, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, partsToText, putFormValues, readFormValues, readResponseWithLimit, readSkillSignature, renderAvailableSkillsXml, renderCatalogJson, resolveArchiveLimits, resolveInsideRoot, resolveToolName, schemaToForm, signSkill, signaturePayloadBytes, summarizeToolCalls, textParts, toLlmToolSpec, toVercelToolSpecs, unzipWithLimits, validateSkills, validateUiSpecEvent, validateUiSpecNode, verifyManifest, verifySkillSignature, xmlRenderer };
1
+ import { $ as SkillCatalog, A as ArchiveLimits, At as escapeXml, B as MemoryFS, Bt as readSkillSignature, C as UiSpecDrafts, Ct as assertSafePathSegment, D as UiSurfaceActionRequest, Dt as checkDependencyCycles, E as UiSpecSnapshot, Et as buildManifest, F as FileStat, Ft as messageOf, G as SKILLS_LOCKFILE, Gt as signSkill, H as PageQuery, Ht as renderCatalogJson, I as FileSystemProvider, It as normalizePath, J as SKILL_NAME_PATTERN, Jt as validateSkills, K as SKILL_MANIFEST_FILE, Kt as signaturePayloadBytes, L as FsTrustedKeyStore, Lt as parseSkillMarkdown, M as CryptoKeyLike, Mt as isValidSkillName, N as DEFAULT_ARCHIVE_LIMITS, Nt as jsonRenderer, O as UiSurfaceActionResponse, Ot as checkSkillRules, P as DiscoveryResult, Pt as keyIdOf, Q as SignatureVerdict, R as JsonSchema, Rt as parseSkillPackManifest, S as UiSpecActionCapability, St as assertRemoteUrlAllowed, T as UiSpecPatch, Tt as buildCatalog, U as RemoteUrlPolicy, Ut as resolveArchiveLimits, V as Page, Vt as renderAvailableSkillsXml, W as SIGNATURE_SCHEMA_VERSION, Wt as resolveInsideRoot, X as SKILL_SIGNATURE_FILE, Xt as verifySkillSignature, Y as SKILL_PACK_FILE, Yt as verifyManifest, Z as SignatureAuditSink, Zt as xmlRenderer, _ as MemoryStore, _t as UnsignedPolicy, a as InteractionOrigin, at as SkillLocation, b as SkillCandidateMarker, bt as WebSkillError, c as InteractionResponse, ct as SkillMetadata, d as LlmContentPart, dt as SkillSignature, et as SkillCatalogEntry, f as LlmMessage, ft as SkillSource, g as LlmToolSpec, gt as UiSpecNode, h as LlmToolCall, ht as TrustedKeyStore, i as FormField, it as SkillIssue, j as CatalogRenderer, jt as exportSkills, k as extractSkillCandidate, kt as computeDigest, l as LlmClient, lt as SkillPackManifest, m as LlmStreamEvent, mt as TrustedKey, n as ArtifactStore, nt as SkillDocument, o as InteractionPolicy, ot as SkillManagerPort, p as LlmResponse, pt as SkillsLockfile, q as SKILL_NAME_MAX_LENGTH, qt as unzipWithLimits, r as ChartSpec, rt as SkillInstallSource, s as InteractionRequest, st as SkillManifest, t as Artifact, tt as SkillDiscovery, u as LlmCompleteInput, ut as SkillReader, v as RenderBlock, vt as ValidationReport, w as UiSpecEvent, wt as atomicWriteText, x as UiBridge, xt as WebSkillErrorCode, y as RenderResultRequest, yt as VerifyResult, z as MANIFEST_EXCLUDED_FILES, zt as readResponseWithLimit } from "./types-CcxRLdJG-DCXyw1US.js";
2
+ import { $ as READ_SKILL_FILE_INPUT_SCHEMA, $n as validateUiSpecEvent, $t as USER_PROFILE_NO_INVENTION_RULE, A as FS_SESSION_PAGE_SIZE, An as networkPolicyLibSource, At as SessionRecord, B as HookRunnerOptions, Bn as readUserProfile, Bt as TerminalLifecycleData, C as DEFAULT_LOOP_LIMITS, Cn as fromVercelResult, Ct as SESSION_SCHEMA_VERSION, D as ExecuteLifecycleData, Dn as listSkillScripts, Dt as SerializingMemoryStore, E as EventBus, En as isUnsupportedRunSnapshot, Et as ScriptExecutor, F as FsSessionStore, Fn as parseBridgeRequest, Ft as SkillRouter, G as LifecycleEventInit, Gn as schemaSourceLabel, Gt as ToolResolution, H as IntegrityVerdict, Hn as renderUserProfileContext, Ht as TodoTraceEvent, I as FullDisclosureRouter, In as parseUserProfileExport, It as SkillScriptDescriptor, J as LifecycleListener, Jn as summarizeToolCalls, Jt as TraceEvent, K as LifecycleHook, Kn as schemaToForm, Kt as ToolResult, L as GoogleGenAiClient, Ln as partsToText, Lt as SkillScriptSchemaSource, M as FsMemoryStore, Mn as normalizeErrorCode, Mt as SkillFailureReport, N as FsRunSnapshotStore, Nn as normalizeToolContent, Nt as SkillIntegrityGuard, O as ExternalSkillProvider, On as mergeCatalogEntries, Ot as SessionListPage, P as FsRunTraceStore, Pn as normalizeToolError, Pt as SkillOutcomeReporter, Q as ProgressiveRouter, Qn as toVercelToolSpecs, Qt as USER_PROFILE_KEY, R as GoogleGenAiClientConfig, Rn as readBehaviorRecords, Rt as SkillStateGuard, S as CapabilityMode, Sn as formatSkillScriptManifest, St as RuntimeSessionHandle, T as EMPTY_USER_PROFILE, Tn as isNetworkAllowed, Tt as ScriptExecutionContext, U as InteractLifecycleData, Un as resolveToolName, Ut as ToolContent, V as InstalledSkillManifest, Vn as refineUserProfile, Vt as TextualToolContent, W as LifecycleEvent, Wn as sampleBehaviorRecords, Wt as ToolDefinition, X as OpenAiCompatibleClient, Xn as toLlmToolSpec, Xt as TraceRecorder, Y as NetworkPolicy, Yn as textParts, Yt as TraceEventType, Z as OpenAiCompatibleClientConfig, Zn as toRecordDigests, Zt as USER_PROFILE_EXPORT_VERSION, _ as BridgeCapabilities, _n as diffUserProfile, _t as RunTraceStore, a as ActivateLifecycleData, an as UserProfileExport, at as RouteLifecycleData, b as BridgeResponse, bn as extractTodoTraceEvents, bt as RuntimeRun, c as AgentLoopDeps, cn as WebSkillApi, ct as RunResult, d as ApprovalDecision, dn as appendBehaviorRecords, dt as RunSnapshotStore, en as USER_PROFILE_PROMPT_HEADER, er as validateUiSpecNode, et as READ_SKILL_FILE_TOOL, f as ApprovalScope, fn as applyUserProfileImport, ft as RunTerminationReason, g as BehaviorScene, gn as createWebSkillApi, gt as RunTraceMetrics, h as BehaviorRecordKind, hn as createScriptContext, ht as RunTraceFilter, i as ASK_USER_TOOL_NAME, in as UserProfileEntry, it as RefineUserProfileInput, j as FsArtifactStore, jn as networkUrlHost, jt as SessionStore, k as ExternalToolSource, kn as mergeProfileEntries, kt as SessionMeta, l as AnthropicClient, ln as WebSkillRuntime, lt as RunSnapshot, m as BehaviorRecord, mn as buildRenderResult, mt as RunTraceFile, n as ASK_USER_INPUT_SCHEMA, nn as UnsupportedRunSnapshot, nt as RUN_SNAPSHOT_SCHEMA_VERSION, o as AgentLoop, on as UserProfileLimits, ot as RouteResult, p as BEHAVIOR_RECORDS_KEY, pn as bridgeError, pt as RunToolCall, q as LifecycleHookContext, qn as scriptToolName, qt as TraceClock, r as ASK_USER_TOOL, rn as UserProfile, rt as RUN_TRACE_SCHEMA_VERSION, s as AgentLoopConfig, sn as VercelToolSpec, st as RunLimitErrorDetails, t as ALLOWED_TOOLS_EXCLUSION_REASON, tn as USER_PROFILE_REFINE_PROMPT, tt as READ_SKILL_FILE_TOOL_NAME, u as AnthropicClientConfig, un as WebSkillRuntimeDeps, ut as RunSnapshotListEntry, v as BridgeCapability, vn as exportUserProfile, vt as RunTraceSummary, w as DEFAULT_USER_PROFILE_LIMITS, wn as fromVercelStreamPart, wt as SchemaInferer, x as CapabilityApproval, xn as extractUiSpecEvents, xt as RuntimeSession, y as BridgeRequest, yn as extractChartSpec, yt as RuntimePhase, z as HookRunner, zn as readProfileEntries, zt as SkillSuccessReport } from "./index-DkbABR43.js";
3
+ export { ALLOWED_TOOLS_EXCLUSION_REASON, ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, type ActivateLifecycleData, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, AnthropicClient, type AnthropicClientConfig, type ApprovalDecision, type ApprovalScope, type ArchiveLimits, type Artifact, type ArtifactStore, BEHAVIOR_RECORDS_KEY, type BehaviorRecord, type BehaviorRecordKind, type BehaviorScene, type BridgeCapabilities, type BridgeCapability, type BridgeRequest, type BridgeResponse, CapabilityApproval, type CapabilityMode, type CatalogRenderer, type ChartSpec, type CryptoKeyLike, DEFAULT_ARCHIVE_LIMITS, DEFAULT_LOOP_LIMITS, DEFAULT_USER_PROFILE_LIMITS, type DiscoveryResult, EMPTY_USER_PROFILE, EventBus, type ExecuteLifecycleData, type ExternalSkillProvider, type ExternalToolSource, FS_SESSION_PAGE_SIZE, type FileStat, type FileSystemProvider, type FormField, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FsRunTraceStore, FsSessionStore, FsTrustedKeyStore, FullDisclosureRouter, GoogleGenAiClient, type GoogleGenAiClientConfig, HookRunner, type HookRunnerOptions, type InstalledSkillManifest, type IntegrityVerdict, type InteractLifecycleData, type InteractionOrigin, type InteractionPolicy, type InteractionRequest, type InteractionResponse, type JsonSchema, type LifecycleEvent, type LifecycleEventInit, type LifecycleHook, type LifecycleHookContext, type LifecycleListener, type LlmClient, type LlmCompleteInput, type LlmContentPart, type LlmMessage, type LlmResponse, type LlmStreamEvent, type LlmToolCall, type LlmToolSpec, MANIFEST_EXCLUDED_FILES, MemoryFS, type MemoryStore, type NetworkPolicy, OpenAiCompatibleClient, type OpenAiCompatibleClientConfig, type Page, type PageQuery, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, RUN_TRACE_SCHEMA_VERSION, type RefineUserProfileInput, type RemoteUrlPolicy, type RenderBlock, type RenderResultRequest, type RouteLifecycleData, type RouteResult, type RunLimitErrorDetails, type RunResult, type RunSnapshot, type RunSnapshotListEntry, type RunSnapshotStore, type RunTerminationReason, type RunToolCall, type RunTraceFile, type RunTraceFilter, type RunTraceMetrics, type RunTraceStore, type RunTraceSummary, type RuntimePhase, type RuntimeRun, type RuntimeSession, type RuntimeSessionHandle, SESSION_SCHEMA_VERSION, SIGNATURE_SCHEMA_VERSION, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, SKILL_SIGNATURE_FILE, type SchemaInferer, type ScriptExecutionContext, type ScriptExecutor, SerializingMemoryStore, type SessionListPage, type SessionMeta, type SessionRecord, type SessionStore, type SignatureAuditSink, type SignatureVerdict, type SkillCandidateMarker, type SkillCatalog, type SkillCatalogEntry, SkillDiscovery, type SkillDocument, type SkillFailureReport, type SkillInstallSource, type SkillIntegrityGuard, type SkillIssue, type SkillLocation, type SkillManagerPort, type SkillManifest, type SkillMetadata, type SkillOutcomeReporter, type SkillPackManifest, SkillReader, type SkillRouter, type SkillScriptDescriptor, type SkillScriptSchemaSource, type SkillSignature, type SkillSource, type SkillStateGuard, type SkillSuccessReport, type SkillsLockfile, type TerminalLifecycleData, type TextualToolContent, type TodoTraceEvent, type ToolContent, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type TrustedKey, type TrustedKeyStore, USER_PROFILE_EXPORT_VERSION, USER_PROFILE_KEY, USER_PROFILE_NO_INVENTION_RULE, USER_PROFILE_PROMPT_HEADER, USER_PROFILE_REFINE_PROMPT, type UiBridge, type UiSpecActionCapability, type UiSpecDrafts, type UiSpecEvent, type UiSpecNode, type UiSpecPatch, type UiSpecSnapshot, type UiSurfaceActionRequest, type UiSurfaceActionResponse, type UnsignedPolicy, type UnsupportedRunSnapshot, type UserProfile, type UserProfileEntry, type UserProfileExport, type UserProfileLimits, type ValidationReport, type VercelToolSpec, type VerifyResult, type WebSkillApi, WebSkillError, type WebSkillErrorCode, WebSkillRuntime, type WebSkillRuntimeDeps, appendBehaviorRecords, applyUserProfileImport, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, diffUserProfile, escapeXml, exportSkills, exportUserProfile, extractChartSpec, extractSkillCandidate, extractTodoTraceEvents, extractUiSpecEvents, formatSkillScriptManifest, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isUnsupportedRunSnapshot, isValidSkillName, jsonRenderer, keyIdOf, listSkillScripts, mergeCatalogEntries, mergeProfileEntries, messageOf, networkPolicyLibSource, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, parseUserProfileExport, partsToText, readBehaviorRecords, readProfileEntries, readResponseWithLimit, readSkillSignature, readUserProfile, refineUserProfile, renderAvailableSkillsXml, renderCatalogJson, renderUserProfileContext, resolveArchiveLimits, resolveInsideRoot, resolveToolName, sampleBehaviorRecords, schemaSourceLabel, schemaToForm, scriptToolName, signSkill, signaturePayloadBytes, summarizeToolCalls, textParts, toLlmToolSpec, toRecordDigests, toVercelToolSpecs, unzipWithLimits, validateSkills, validateUiSpecEvent, validateUiSpecNode, verifyManifest, verifySkillSignature, xmlRenderer };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { A as parseSkillMarkdown, B as unzipWithLimits, C as escapeXml, D as keyIdOf, E as jsonRenderer, F as renderCatalogJson, H as verifyManifest, I as resolveArchiveLimits, L as resolveInsideRoot, M as readResponseWithLimit, N as readSkillSignature, O as messageOf, P as renderAvailableSkillsXml, R as signSkill, S as computeDigest, T as isValidSkillName, U as verifySkillSignature, V as validateSkills, W as xmlRenderer, _ as atomicWriteText, a as SIGNATURE_SCHEMA_VERSION, b as checkDependencyCycles, c as SKILL_NAME_MAX_LENGTH, d as SKILL_SIGNATURE_FILE, f as SkillDiscovery, g as assertSafePathSegment, h as assertRemoteUrlAllowed, i as MemoryFS, j as parseSkillPackManifest, k as normalizePath, l as SKILL_NAME_PATTERN, m as WebSkillError, n as FsTrustedKeyStore, o as SKILLS_LOCKFILE, p as SkillReader, r as MANIFEST_EXCLUDED_FILES, s as SKILL_MANIFEST_FILE, t as DEFAULT_ARCHIVE_LIMITS, u as SKILL_PACK_FILE, v as buildCatalog, w as exportSkills, x as checkSkillRules, y as buildManifest, z as signaturePayloadBytes } from "./dist-8oQRa8Xz.js";
2
- import { i as textParts, n as partsToText } from "./memoryArtifactStore-BtOeB_hm-tj3fC5ip.js";
3
- import { $ as schemaToForm, A as buildRenderResult, B as fromVercelStreamPart, C as RUN_SNAPSHOT_SCHEMA_VERSION, D as TraceRecorder, E as SerializingMemoryStore, F as extractChartSpec, G as networkUrlHost, H as isUnsupportedRunSnapshot, I as extractTodoTraceEvents, J as normalizeToolError, K as normalizeErrorCode, L as extractUiSpecEvents, M as clearStoredFormValues, N as createScriptContext, O as WebSkillRuntime, P as createWebSkillApi, Q as resolveToolName, R as formFieldKey, S as READ_SKILL_FILE_TOOL_NAME, T as SESSION_SCHEMA_VERSION, U as mergeCatalogEntries, V as isNetworkAllowed, W as networkPolicyLibSource, X as putFormValues, Y as parseBridgeRequest, Z as readFormValues, _ as HookRunner, a as AnthropicClient, b as READ_SKILL_FILE_INPUT_SCHEMA, c as FORM_VALUES_KEY, d as FsMemoryStore, et as summarizeToolCalls, f as FsRunSnapshotStore, g as GoogleGenAiClient, h as FullDisclosureRouter, i as AgentLoop, it as validateUiSpecNode, j as clearFormValues, k as bridgeError, l as FS_SESSION_PAGE_SIZE, m as FsSessionStore, n as ASK_USER_TOOL, nt as toVercelToolSpecs, o as CapabilityApproval, p as FsRunTraceStore, q as normalizeToolContent, r as ASK_USER_TOOL_NAME, rt as validateUiSpecEvent, s as EventBus, t as ASK_USER_INPUT_SCHEMA, tt as toLlmToolSpec, u as FsArtifactStore, v as OpenAiCompatibleClient, w as RUN_TRACE_SCHEMA_VERSION, x as READ_SKILL_FILE_TOOL, y as ProgressiveRouter, z as fromVercelResult } from "./dist-6C03DShK.js";
2
+ import { a as textParts, n as partsToText } from "./memoryArtifactStore-52Zn9npI-BMPYwvoy.js";
3
+ import { $ as isNetworkAllowed, A as SerializingMemoryStore, B as bridgeError, C as ProgressiveRouter, Ct as toRecordDigests, D as RUN_SNAPSHOT_SCHEMA_VERSION, E as READ_SKILL_FILE_TOOL_NAME, Et as validateUiSpecNode, F as USER_PROFILE_PROMPT_HEADER, G as exportUserProfile, H as createScriptContext, I as USER_PROFILE_REFINE_PROMPT, J as extractTodoTraceEvents, K as extractChartSpec, L as WebSkillRuntime, M as USER_PROFILE_EXPORT_VERSION, N as USER_PROFILE_KEY, O as RUN_TRACE_SCHEMA_VERSION, P as USER_PROFILE_NO_INVENTION_RULE, Q as fromVercelStreamPart, R as appendBehaviorRecords, S as OpenAiCompatibleClient, St as toLlmToolSpec, T as READ_SKILL_FILE_TOOL, Tt as validateUiSpecEvent, U as createWebSkillApi, V as buildRenderResult, W as diffUserProfile, X as formatSkillScriptManifest, Y as extractUiSpecEvents, Z as fromVercelResult, _ as FsRunTraceStore, _t as sampleBehaviorRecords, a as AgentLoop, at as networkUrlHost, b as GoogleGenAiClient, bt as scriptToolName, c as CapabilityApproval, ct as normalizeToolError, d as EMPTY_USER_PROFILE, dt as readBehaviorRecords, et as isUnsupportedRunSnapshot, f as EventBus, ft as readProfileEntries, g as FsRunSnapshotStore, gt as resolveToolName, h as FsMemoryStore, ht as renderUserProfileContext, i as ASK_USER_TOOL_NAME, it as networkPolicyLibSource, j as TraceRecorder, k as SESSION_SCHEMA_VERSION, l as DEFAULT_LOOP_LIMITS, lt as parseBridgeRequest, m as FsArtifactStore, mt as refineUserProfile, n as ASK_USER_INPUT_SCHEMA, nt as mergeCatalogEntries, o as AnthropicClient, ot as normalizeErrorCode, p as FS_SESSION_PAGE_SIZE, pt as readUserProfile, q as extractSkillCandidate, r as ASK_USER_TOOL, rt as mergeProfileEntries, s as BEHAVIOR_RECORDS_KEY, st as normalizeToolContent, t as ALLOWED_TOOLS_EXCLUSION_REASON, tt as listSkillScripts, u as DEFAULT_USER_PROFILE_LIMITS, ut as parseUserProfileExport, v as FsSessionStore, vt as schemaSourceLabel, w as READ_SKILL_FILE_INPUT_SCHEMA, wt as toVercelToolSpecs, x as HookRunner, xt as summarizeToolCalls, y as FullDisclosureRouter, yt as schemaToForm, z as applyUserProfileImport } from "./dist-D0qW6e40.js";
4
4
 
5
- export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, AnthropicClient, CapabilityApproval, DEFAULT_ARCHIVE_LIMITS, EventBus, FORM_VALUES_KEY, FS_SESSION_PAGE_SIZE, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FsRunTraceStore, FsSessionStore, FsTrustedKeyStore, FullDisclosureRouter, GoogleGenAiClient, HookRunner, MANIFEST_EXCLUDED_FILES, MemoryFS, OpenAiCompatibleClient, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, RUN_TRACE_SCHEMA_VERSION, SESSION_SCHEMA_VERSION, SIGNATURE_SCHEMA_VERSION, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, SKILL_SIGNATURE_FILE, SerializingMemoryStore, SkillDiscovery, SkillReader, TraceRecorder, WebSkillError, WebSkillRuntime, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, clearFormValues, clearStoredFormValues, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, extractTodoTraceEvents, extractUiSpecEvents, formFieldKey, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isUnsupportedRunSnapshot, isValidSkillName, jsonRenderer, keyIdOf, mergeCatalogEntries, messageOf, networkPolicyLibSource, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, partsToText, putFormValues, readFormValues, readResponseWithLimit, readSkillSignature, renderAvailableSkillsXml, renderCatalogJson, resolveArchiveLimits, resolveInsideRoot, resolveToolName, schemaToForm, signSkill, signaturePayloadBytes, summarizeToolCalls, textParts, toLlmToolSpec, toVercelToolSpecs, unzipWithLimits, validateSkills, validateUiSpecEvent, validateUiSpecNode, verifyManifest, verifySkillSignature, xmlRenderer };
5
+ export { ALLOWED_TOOLS_EXCLUSION_REASON, ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, AnthropicClient, BEHAVIOR_RECORDS_KEY, CapabilityApproval, DEFAULT_ARCHIVE_LIMITS, DEFAULT_LOOP_LIMITS, DEFAULT_USER_PROFILE_LIMITS, EMPTY_USER_PROFILE, EventBus, FS_SESSION_PAGE_SIZE, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FsRunTraceStore, FsSessionStore, FsTrustedKeyStore, FullDisclosureRouter, GoogleGenAiClient, HookRunner, MANIFEST_EXCLUDED_FILES, MemoryFS, OpenAiCompatibleClient, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, RUN_TRACE_SCHEMA_VERSION, SESSION_SCHEMA_VERSION, SIGNATURE_SCHEMA_VERSION, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, SKILL_SIGNATURE_FILE, SerializingMemoryStore, SkillDiscovery, SkillReader, TraceRecorder, USER_PROFILE_EXPORT_VERSION, USER_PROFILE_KEY, USER_PROFILE_NO_INVENTION_RULE, USER_PROFILE_PROMPT_HEADER, USER_PROFILE_REFINE_PROMPT, WebSkillError, WebSkillRuntime, appendBehaviorRecords, applyUserProfileImport, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, diffUserProfile, escapeXml, exportSkills, exportUserProfile, extractChartSpec, extractSkillCandidate, extractTodoTraceEvents, extractUiSpecEvents, formatSkillScriptManifest, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isUnsupportedRunSnapshot, isValidSkillName, jsonRenderer, keyIdOf, listSkillScripts, mergeCatalogEntries, mergeProfileEntries, messageOf, networkPolicyLibSource, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, parseUserProfileExport, partsToText, readBehaviorRecords, readProfileEntries, readResponseWithLimit, readSkillSignature, readUserProfile, refineUserProfile, renderAvailableSkillsXml, renderCatalogJson, renderUserProfileContext, resolveArchiveLimits, resolveInsideRoot, resolveToolName, sampleBehaviorRecords, schemaSourceLabel, schemaToForm, scriptToolName, signSkill, signaturePayloadBytes, summarizeToolCalls, textParts, toLlmToolSpec, toRecordDigests, toVercelToolSpecs, unzipWithLimits, validateSkills, validateUiSpecEvent, validateUiSpecNode, verifyManifest, verifySkillSignature, xmlRenderer };
package/dist/mcp.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as JsonSchema, Q as SkillCatalogEntry, et as SkillDocument, g as LlmToolSpec } from "./types-D_hoCri8-BnNPiZCi.js";
2
- import { Nt as ToolResult, b as ExternalSkillProvider, rn as mergeCatalogEntries, x as ExternalToolSource } from "./index-vBz_FC9w.js";
1
+ import { R as JsonSchema, et as SkillCatalogEntry, g as LlmToolSpec, nt as SkillDocument } from "./types-CcxRLdJG-DCXyw1US.js";
2
+ import { Kt as ToolResult, O as ExternalSkillProvider, On as mergeCatalogEntries, k as ExternalToolSource } from "./index-DkbABR43.js";
3
3
  import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
4
4
  import { JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js";
5
5
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -192,15 +192,46 @@ declare function serveSkillAsMcp(server: McpServer, skill: ServedSkill): Promise
192
192
  declare const catalogMerge: typeof mergeCatalogEntries;
193
193
  //#endregion
194
194
  //#region src/webmcp/experimentalWebMcpAdapter.d.ts
195
- /** navigator.modelContext 鸭子类型(对齐浏览器 WebMCP API 草案) */
195
+ /**
196
+ * WebMCP 命令式 API 的工具形状(Chrome 150+)。
197
+ * `getTools()` 返回的工具含 `inputSchema`(JSON 字符串)、`origin`、`window`、`annotations`。
198
+ * 参考 https://developer.chrome.com/docs/ai/webmcp/imperative-api
199
+ */
200
+ interface WebMcpToolLike {
201
+ name: string;
202
+ description?: string;
203
+ /** getTools() 返回的 inputSchema 是 JSON 字符串(非对象) */
204
+ inputSchema?: string;
205
+ origin?: string;
206
+ window?: unknown;
207
+ annotations?: {
208
+ readOnlyHint?: boolean;
209
+ untrustedContentHint?: boolean;
210
+ };
211
+ }
212
+ /**
213
+ * document.modelContext 鸭子类型(对齐 Chrome 150+ 的 WebMCP 命令式 API)。
214
+ * - 旧版(Chrome <150):navigator.modelContext.listTools() / executeTool(name, argsJson)
215
+ * - 新版(Chrome 150+):document.modelContext.getTools() / executeTool(tool, argsJson, { signal? })
216
+ * executeTool 的第一参在两种版本都能接受:新版传 tool 对象,旧版传 name 字符串。
217
+ */
196
218
  interface BrowserModelContextLike {
197
- listTools?: () => Promise<unknown>;
198
- executeTool?: (name: string, argsJson: string) => Promise<unknown>;
219
+ getTools?: () => Promise<unknown>;
220
+ executeTool?: (tool: WebMcpToolLike | string, argsJson: string, options?: {
221
+ signal?: AbortSignal;
222
+ }) => Promise<unknown>;
199
223
  }
200
224
  interface WebMcpToolDescriptor {
201
225
  name: string;
202
226
  description?: string;
203
227
  inputSchema?: unknown;
228
+ origin?: string;
229
+ annotations?: {
230
+ readOnlyHint?: boolean;
231
+ untrustedContentHint?: boolean;
232
+ };
233
+ /** getTools() 返回的原始 tool 对象:executeTool 第一参须透传原对象(含 inputSchema JSON 字符串、window 等) */
234
+ raw?: unknown;
204
235
  }
205
236
  /**
206
237
  * Experimental WebMCP Adapter(mcp# 分支):默认关闭显式启用;
@@ -214,9 +245,9 @@ declare class ExperimentalWebMcpAdapter {
214
245
  enabled?: boolean;
215
246
  });
216
247
  isAvailable(): boolean;
217
- /** 工具清单(listTools 缺失时返回 undefined;调用失败时告警后返回 undefined) */
248
+ /** 工具清单(getTools 缺失时返回 undefined;调用失败时告警后返回 undefined) */
218
249
  listTools(): Promise<WebMcpToolDescriptor[] | undefined>;
219
- /** 工具名清单(listTools 缺失/失败时返回 undefined) */
250
+ /** 工具名清单(getTools 缺失/失败时返回 undefined) */
220
251
  listToolNames(): Promise<string[] | undefined>;
221
252
  call(toolName: string, args: Record<string, unknown>): Promise<ToolResult>;
222
253
  }
@@ -243,6 +274,108 @@ declare class McpRuntimePlugin implements ExternalToolSource {
243
274
  call(llmToolName: string, args: Record<string, unknown>): Promise<ToolResult>;
244
275
  }
245
276
  //#endregion
277
+ //#region src/remote/oauth.d.ts
278
+ /**
279
+ * S9 · MCP 授权注入协议(0.7.0 FR-22.1 ~ FR-22.3)。
280
+ *
281
+ * 本文件**不实现 OAuth**:发现、PKCE、`code` 交换、刷新全部由 `@modelcontextprotocol/sdk` 承担。
282
+ * 这里只提供 SDK 替我们决定不了的三样:宿主的 client 信息、令牌存储、把用户送到授权页。
283
+ */
284
+ /** 宿主预注册的 OAuth 客户端信息。不做动态注册(RFC 7591),因此此项必填。 @experimental */
285
+ interface McpOAuthClient {
286
+ clientId: string;
287
+ /** 机密客户端才有;浏览器端应留空 */
288
+ clientSecret?: string;
289
+ /** 授权服务器回跳地址,必须与预注册值一致 */
290
+ redirectUri: string;
291
+ scopes?: string[];
292
+ }
293
+ /** 令牌集合。access 与 refresh 分开传递,宿主可对二者采用不同存储策略。 @experimental */
294
+ interface McpOAuthTokens {
295
+ accessToken: string;
296
+ /** epoch ms;缺省表示不过期 */
297
+ expiresAt?: number;
298
+ refreshToken?: string;
299
+ tokenType?: string;
300
+ scope?: string;
301
+ }
302
+ /**
303
+ * 令牌存储。SDK 不提供默认实现(AC-22.7)——写不写盘、写到哪里由宿主决定。
304
+ * key 为端点名(`RemoteEndpointConfig.endpoint`),宿主据此隔离多端点。
305
+ * @experimental
306
+ */
307
+ interface McpOAuthTokenStore {
308
+ load(endpoint: string): Promise<McpOAuthTokens | undefined>;
309
+ save(endpoint: string, tokens: McpOAuthTokens): Promise<void>;
310
+ clear(endpoint: string): Promise<void>;
311
+ }
312
+ /** 一次授权握手的暂存内容:PKCE verifier 与 state 需要跨页面重定向存活。 @experimental */
313
+ interface McpOAuthHandshake {
314
+ codeVerifier: string;
315
+ state: string;
316
+ }
317
+ /** 握手暂存端口。与长期令牌的存储策略不同,因此独立成一个端口。 @experimental */
318
+ interface McpOAuthHandshakeStore {
319
+ save(endpoint: string, handshake: McpOAuthHandshake): Promise<void>;
320
+ load(endpoint: string): Promise<McpOAuthHandshake | undefined>;
321
+ clear(endpoint: string): Promise<void>;
322
+ }
323
+ /** 授权流程所处的阶段;进错误 `details`,不含任何凭据。 @experimental */
324
+ type McpOAuthStage = 'discover' | 'authorize' | 'exchange' | 'refresh';
325
+ /** @experimental */
326
+ interface McpOAuthConfig {
327
+ client: McpOAuthClient;
328
+ tokens: McpOAuthTokenStore;
329
+ handshake: McpOAuthHandshakeStore;
330
+ /**
331
+ * 把用户送到授权页。宿主决定形态(新窗口 / 系统浏览器)。
332
+ * 返回后流程挂起,等待宿主拿到 `code` 再调 `finishAuthorization`。
333
+ */
334
+ openAuthorization(url: URL): Promise<void> | void;
335
+ }
336
+ /** 显式的内存存储,供 examples 与测试使用。**不是缺省行为**——是宿主主动选的(AC-22.7)。 @experimental */
337
+ declare function createMemoryOAuthStores(): {
338
+ tokens: McpOAuthTokenStore;
339
+ handshake: McpOAuthHandshakeStore;
340
+ };
341
+ /** SDK 的 `OAuthTokens` 形状(结构化引用,避免在模块顶层 import 可选 peer 的类型) */
342
+ interface SdkTokens {
343
+ access_token: string;
344
+ token_type: string;
345
+ expires_in?: number;
346
+ refresh_token?: string;
347
+ scope?: string;
348
+ }
349
+ /**
350
+ * SDK `OAuthClientProvider` 的结构化对应物。
351
+ * 刻意不 implements SDK 接口:适配层只提供我们认可的成员,
352
+ * 尤其**不提供** `saveClientInformation`——那是动态客户端注册的入口(需求 §5)。
353
+ * @experimental
354
+ */
355
+ interface McpOAuthProvider {
356
+ readonly redirectUrl: string;
357
+ readonly clientMetadata: Record<string, unknown>;
358
+ state(): Promise<string>;
359
+ clientInformation(): Promise<{
360
+ client_id: string;
361
+ client_secret?: string;
362
+ }>;
363
+ tokens(): Promise<SdkTokens | undefined>;
364
+ saveTokens(tokens: SdkTokens): Promise<void>;
365
+ redirectToAuthorization(url: URL): Promise<void>;
366
+ saveCodeVerifier(codeVerifier: string): Promise<void>;
367
+ codeVerifier(): Promise<string>;
368
+ invalidateCredentials(scope: 'all' | 'client' | 'tokens' | 'verifier' | 'discovery'): Promise<void>;
369
+ }
370
+ /**
371
+ * `McpOAuthConfig` → SDK `OAuthClientProvider` 适配器。
372
+ *
373
+ * `state()` 与 `saveCodeVerifier()` 由 SDK 分两次调用(顺序上前者在先),
374
+ * 两者合成一条握手记录:谁先到都把当前已知部分写进去,回程时两项都在。
375
+ * @experimental
376
+ */
377
+ declare function createOAuthProvider(endpoint: string, config: McpOAuthConfig): McpOAuthProvider;
378
+ //#endregion
246
379
  //#region src/remote/connectRemoteEndpoint.d.ts
247
380
  interface RemoteEndpointConfig {
248
381
  /** registry 中的名字(endpoint:tool 引用) */
@@ -258,6 +391,23 @@ interface RemoteEndpointConfig {
258
391
  allowHttp?: boolean;
259
392
  /** 显式允许私有/环回/链路本地地址(SSRF 防护默认拒绝) */
260
393
  allowPrivateHosts?: boolean;
394
+ /**
395
+ * 使用 OAuth 2.1 授权码 + PKCE(0.7.0 FR-22.1)。
396
+ * 与 `headers` 可共存,但**不要**在 `headers` 里再手填 `Authorization`,会被覆盖。
397
+ * @experimental
398
+ */
399
+ oauth?: McpOAuthConfig;
400
+ }
401
+ /** 远程 endpoint 句柄 @experimental */
402
+ interface RemoteEndpointHandle {
403
+ close(): Promise<void>;
404
+ /**
405
+ * OAuth 回程:宿主拿到 authorization code 后调用,成功后 endpoint 才被注册。
406
+ * 未配置 `oauth` 时不挂载。
407
+ */
408
+ finishAuthorization?(code: string, state: string): Promise<void>;
409
+ /** 建连因需要用户授权而未完成:endpoint 未注册,等 `finishAuthorization` */
410
+ authorizationRequired?: true;
261
411
  }
262
412
  /**
263
413
  * 远程 MCP endpoint 装配:SDK 官方 StreamableHTTPClientTransport(默认)/
@@ -265,8 +415,6 @@ interface RemoteEndpointConfig {
265
415
  * endpoint:tool 解析、TTL+版本缓存、临时技能消费自动生效。
266
416
  * 返回 close 句柄:断开后 unregister(临时技能随既有生命周期自然消失)。
267
417
  */
268
- declare function connectRemoteEndpoint(registry: EndpointRegistry<McpClientLike>, config: RemoteEndpointConfig): Promise<{
269
- close(): Promise<void>;
270
- }>;
418
+ declare function connectRemoteEndpoint(registry: EndpointRegistry<McpClientLike>, config: RemoteEndpointConfig): Promise<RemoteEndpointHandle>;
271
419
  //#endregion
272
- export { type BrowserModelContextLike, EndpointRegistry, ExperimentalWebMcpAdapter, type McpClientLike, McpRuntimePlugin, McpToolResolver, MessageChannelTransport, type MessageChannelTransportOptions, type MessagePortLike, type RemoteEndpointConfig, type ServedSkill, TemporarySkillProvider, type TransportState, type WebMcpToolDescriptor, catalogMerge, connectRemoteEndpoint, endpointToolLlmName, parseEndpointToolLlmName, parseWebMcpToolLlmName, serveSkillAsMcp, validateJsonRpcMessage, webMcpToolLlmName };
420
+ export { type BrowserModelContextLike, EndpointRegistry, ExperimentalWebMcpAdapter, type McpClientLike, type McpOAuthClient, type McpOAuthConfig, type McpOAuthHandshake, type McpOAuthHandshakeStore, type McpOAuthProvider, type McpOAuthStage, type McpOAuthTokenStore, type McpOAuthTokens, McpRuntimePlugin, McpToolResolver, MessageChannelTransport, type MessageChannelTransportOptions, type MessagePortLike, type RemoteEndpointConfig, type RemoteEndpointHandle, type ServedSkill, TemporarySkillProvider, type TransportState, type WebMcpToolDescriptor, type WebMcpToolLike, catalogMerge, connectRemoteEndpoint, createMemoryOAuthStores, createOAuthProvider, endpointToolLlmName, parseEndpointToolLlmName, parseWebMcpToolLlmName, serveSkillAsMcp, validateJsonRpcMessage, webMcpToolLlmName };