feat: add SchemaAdapter system for typemap integration (Zod/Valibot), fix scanner pathToFileURL

- Add from_typemap.ts with SchemaAdapter interface, defaultAdapter, zodAdapter(), valibotAdapter()
- OperationRegistry now accepts optional { schemaAdapter } config; default is TypeBox passthrough
- Adapters use @alkdev/typemap (optional peer dep) with lazy init; detect schemas via ~standard vendor protocol
- Fix scanner pathToFileURL to encode URI components and normalize Windows backslashes
- Add from-typemap sub-path export in package.json and tsup config
- Add test suite covering defaultAdapter, zodAdapter, valibotAdapter, and registry integration
This commit is contained in:
2026-05-16 09:24:34 +00:00
parent 92936f4232
commit 3e1884cd23
8 changed files with 390 additions and 19 deletions

44
package-lock.json generated
View File

@@ -14,20 +14,26 @@
"@logtape/logtape": "^2.0.0"
},
"devDependencies": {
"@alkdev/typemap": "^0.10.1",
"@modelcontextprotocol/sdk": "^1.12.1",
"@types/node": "^22.0.0",
"@vitest/coverage-v8": "^3.2.4",
"tsup": "^8.5.1",
"typescript": "^5.7.0",
"valibot": "^1.4.0",
"vitest": "^3.1.0"
},
"engines": {
"node": ">=18.0.0"
},
"peerDependencies": {
"@alkdev/typemap": "^0.10.0",
"@modelcontextprotocol/sdk": "^1.0.0"
},
"peerDependenciesMeta": {
"@alkdev/typemap": {
"optional": true
},
"@modelcontextprotocol/sdk": {
"optional": true
}
@@ -36,9 +42,6 @@
"../pubsub": {
"version": "0.1.0",
"license": "MIT OR Apache-2.0",
"dependencies": {
"@repeaterjs/repeater": "^3.0.0"
},
"devDependencies": {
"@types/node": "^22.0.0",
"@vitest/coverage-v8": "^3.2.4",
@@ -205,10 +208,6 @@
"node": ">=14"
}
},
"../pubsub/node_modules/@repeaterjs/repeater": {
"version": "3.0.6",
"license": "MIT"
},
"../pubsub/node_modules/@rollup/rollup-linux-x64-gnu": {
"version": "4.60.2",
"cpu": [
@@ -1928,6 +1927,18 @@
"version": "0.34.49",
"license": "MIT"
},
"node_modules/@alkdev/typemap": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/@alkdev/typemap/-/typemap-0.10.1.tgz",
"integrity": "sha512-nCrZrrxgyWr3xBXjCWhUj56rH/Yb64l96Yl8gr3fYF5JS+nfiTgLcJ0shRvSAA8nznsiPfMJgmNrTGsdyHYs2g==",
"dev": true,
"license": "MIT",
"peerDependencies": {
"@alkdev/typebox": "^0.34.49",
"valibot": "^1.0.0",
"zod": "^3.24.1"
}
},
"node_modules/@ampproject/remapping": {
"version": "2.3.0",
"dev": true,
@@ -5163,6 +5174,21 @@
"node": ">= 0.8"
}
},
"node_modules/valibot": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/valibot/-/valibot-1.4.0.tgz",
"integrity": "sha512-iC/x7fVcSyOwlm/VSt7RlHnzNGLGvR9GnxdifUeWoCJo0q4ZZvrVkIHC6faTlkxG47I2Y4UrFquPuVHCrOnrLg==",
"dev": true,
"license": "MIT",
"peerDependencies": {
"typescript": ">=5"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/vary": {
"version": "1.1.2",
"dev": true,
@@ -5455,7 +5481,9 @@
"license": "ISC"
},
"node_modules/zod": {
"version": "4.4.1",
"version": "3.25.76",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
"dev": true,
"license": "MIT",
"funding": {