@toa.io/extensions.exposition 1.0.0-alpha.283 → 1.0.0-alpha.285
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/CHANGELOG.md +40 -0
- package/components/exposition.octets/types/index.d.ts +1 -1
- package/components/identity.bans/operations/transit.js +1 -1
- package/components/identity.bans/tsconfig.json +1 -1
- package/components/identity.bans/tsconfig.tsbuildinfo +1 -1
- package/components/identity.bans/types/index.d.ts +1 -1
- package/components/identity.basic/operations/add.js +1 -1
- package/components/identity.basic/operations/authenticate.js +1 -1
- package/components/identity.basic/operations/check.js +1 -1
- package/components/identity.basic/operations/delete.js +1 -1
- package/components/identity.basic/operations/incept.js +18 -2
- package/components/identity.basic/operations/info.js +1 -1
- package/components/identity.basic/operations/lib/credentials.js +1 -1
- package/components/identity.basic/operations/transit.js +1 -1
- package/components/identity.basic/source/incept.ts +29 -1
- package/components/identity.basic/tsconfig.json +1 -1
- package/components/identity.basic/tsconfig.tsbuildinfo +1 -1
- package/components/identity.basic/types/index.d.ts +3 -2
- package/components/identity.clients/operations/describe.js +1 -1
- package/components/identity.clients/operations/lib/Context.js +1 -1
- package/components/identity.clients/operations/lib/Entity.js +1 -1
- package/components/identity.clients/operations/lib/canonical.js +1 -1
- package/components/identity.clients/operations/lib/cimd.js +1 -1
- package/components/identity.clients/operations/lib/errors.js +1 -1
- package/components/identity.clients/operations/lib/index.js +1 -1
- package/components/identity.clients/operations/lib/redirect.js +1 -1
- package/components/identity.clients/operations/register.js +1 -1
- package/components/identity.clients/tsconfig.json +1 -1
- package/components/identity.clients/tsconfig.tsbuildinfo +1 -1
- package/components/identity.clients/types/index.d.ts +1 -1
- package/components/identity.credentials/operations/list.js +1 -1
- package/components/identity.credentials/tsconfig.json +4 -2
- package/components/identity.credentials/tsconfig.tsbuildinfo +1 -1
- package/components/identity.credentials/types/index.d.ts +1 -1
- package/components/identity.federation/operations/authenticate.js +7 -3
- package/components/identity.federation/operations/create.js +1 -1
- package/components/identity.federation/operations/decode.js +1 -1
- package/components/identity.federation/operations/delete.js +1 -1
- package/components/identity.federation/operations/incept.js +6 -2
- package/components/identity.federation/operations/lib/Configuration.js +1 -1
- package/components/identity.federation/operations/lib/Ctx.js +1 -1
- package/components/identity.federation/operations/lib/Payload.js +1 -1
- package/components/identity.federation/operations/lib/decode.js +1 -1
- package/components/identity.federation/operations/lib/discovery.js +1 -1
- package/components/identity.federation/operations/lib/errors.js +1 -1
- package/components/identity.federation/operations/lib/exchange.js +1 -1
- package/components/identity.federation/operations/lib/index.js +2 -1
- package/components/identity.federation/operations/lib/jose.js +1 -1
- package/components/identity.federation/operations/lib/principal.js +14 -0
- package/components/identity.federation/operations/lib/resolve.js +1 -1
- package/components/identity.federation/operations/list.js +1 -1
- package/components/identity.federation/operations/types/Scheme.js +1 -1
- package/components/identity.federation/operations/types/configuration.js +1 -1
- package/components/identity.federation/operations/types/context.js +1 -1
- package/components/identity.federation/operations/types/entity.js +1 -1
- package/components/identity.federation/operations/types/index.js +1 -1
- package/components/identity.federation/source/authenticate.ts +8 -2
- package/components/identity.federation/source/incept.ts +7 -1
- package/components/identity.federation/source/lib/index.ts +1 -0
- package/components/identity.federation/source/lib/principal.ts +17 -0
- package/components/identity.federation/source/types/context.ts +3 -0
- package/components/identity.federation/tsconfig.json +4 -2
- package/components/identity.federation/tsconfig.tsbuildinfo +1 -1
- package/components/identity.federation/types/index.d.ts +1 -1
- package/components/identity.grants/operations/authorize.js +1 -1
- package/components/identity.grants/operations/exchange.js +1 -1
- package/components/identity.grants/operations/lib/code.js +1 -1
- package/components/identity.grants/operations/lib/identify.js +1 -1
- package/components/identity.grants/operations/lib/index.js +1 -1
- package/components/identity.grants/operations/list.js +1 -1
- package/components/identity.grants/operations/revoke.js +1 -1
- package/components/identity.grants/tsconfig.json +1 -1
- package/components/identity.grants/tsconfig.tsbuildinfo +1 -1
- package/components/identity.grants/types/index.d.ts +1 -1
- package/components/identity.keys/operations/create.js +1 -1
- package/components/identity.keys/operations/disable.js +1 -1
- package/components/identity.keys/operations/revoke.js +1 -1
- package/components/identity.keys/tsconfig.json +1 -1
- package/components/identity.keys/tsconfig.tsbuildinfo +1 -1
- package/components/identity.keys/types/index.d.ts +1 -1
- package/components/identity.otp/operations/authenticate.js +1 -1
- package/components/identity.otp/operations/issue.js +1 -1
- package/components/identity.otp/operations/lib/Context.js +1 -1
- package/components/identity.otp/operations/lib/Entity.js +1 -1
- package/components/identity.otp/operations/lib/index.js +1 -1
- package/components/identity.otp/tsconfig.json +1 -1
- package/components/identity.otp/tsconfig.tsbuildinfo +1 -1
- package/components/identity.otp/types/index.d.ts +1 -1
- package/components/identity.passkeys/operations/authenticate.js +1 -1
- package/components/identity.passkeys/operations/challenge.js +1 -1
- package/components/identity.passkeys/operations/create.js +1 -1
- package/components/identity.passkeys/operations/delete.js +1 -1
- package/components/identity.passkeys/operations/lib/const.js +1 -1
- package/components/identity.passkeys/operations/list.js +1 -1
- package/components/identity.passkeys/operations/types/Configuration.js +1 -1
- package/components/identity.passkeys/operations/types/Context.js +1 -1
- package/components/identity.passkeys/operations/types/Passkey.js +1 -1
- package/components/identity.passkeys/operations/types/index.js +1 -1
- package/components/identity.passkeys/operations/use.js +1 -1
- package/components/identity.passkeys/tsconfig.json +1 -1
- package/components/identity.passkeys/tsconfig.tsbuildinfo +1 -1
- package/components/identity.passkeys/types/index.d.ts +1 -1
- package/components/identity.roles/operations/grant.js +1 -1
- package/components/identity.roles/operations/lib/Entity.js +1 -1
- package/components/identity.roles/operations/list.js +1 -1
- package/components/identity.roles/operations/principal.js +29 -5
- package/components/identity.roles/source/principal.ts +33 -5
- package/components/identity.roles/tsconfig.json +1 -1
- package/components/identity.roles/tsconfig.tsbuildinfo +1 -1
- package/components/identity.roles/types/index.d.ts +1 -1
- package/components/identity.tokens/operations/authenticate.js +1 -1
- package/components/identity.tokens/operations/decrypt.js +1 -1
- package/components/identity.tokens/operations/encrypt.js +1 -1
- package/components/identity.tokens/operations/issue.js +1 -1
- package/components/identity.tokens/operations/lib/form.js +1 -1
- package/components/identity.tokens/operations/lib/index.js +1 -1
- package/components/identity.tokens/operations/lib/jose.js +1 -1
- package/components/identity.tokens/operations/lib/key.js +1 -1
- package/components/identity.tokens/operations/lib/pad.js +1 -1
- package/components/identity.tokens/operations/revoke.js +1 -1
- package/components/identity.tokens/tsconfig.json +1 -1
- package/components/identity.tokens/tsconfig.tsbuildinfo +1 -1
- package/components/identity.tokens/types/index.d.ts +1 -1
- package/documentation/access.md +13 -0
- package/documentation/components.md +3 -0
- package/documentation/introspection.md +13 -5
- package/documentation/io.md +6 -0
- package/documentation/map.md +8 -0
- package/documentation/mcp.md +186 -0
- package/documentation/oauth.md +8 -7
- package/documentation/rpc.md +144 -0
- package/documentation/tree.md +3 -0
- package/features/identity.basic.feature +44 -0
- package/features/identity.federation.feature +2 -5
- package/features/introspection.feature +333 -0
- package/features/mcp.feature +691 -0
- package/features/oauth.discovery.feature +10 -11
- package/features/oauth.grants.feature +22 -9
- package/features/octets.cloudinary.feature +1 -0
- package/features/rpc.feature +429 -0
- package/features/steps/Cloudinary.ts +13 -0
- package/features/steps/Components.ts +0 -4
- package/features/steps/Gateway.ts +19 -2
- package/features/steps/Parameters.ts +18 -7
- package/features/steps/Realtime.ts +3 -0
- package/features/steps/components/echo/manifest.toa.yaml +1 -0
- package/features/steps/components/pots/manifest.toa.yaml +2 -0
- package/package.json +3 -3
- package/readme.md +3 -0
- package/schemas/annotation.cos.yaml +33 -0
- package/schemas/call.cos.yaml +18 -0
- package/source/Annotation.ts +31 -0
- package/source/Directive.test.ts +15 -15
- package/source/Directive.ts +77 -9
- package/source/Endpoint.test.ts +67 -0
- package/source/Endpoint.ts +31 -11
- package/source/Factory.ts +5 -1
- package/source/Gateway.ts +73 -11
- package/source/HTTP/Context.ts +7 -0
- package/source/HTTP/Server.ts +7 -1
- package/source/HTTP/exceptions.ts +2 -2
- package/source/HTTP/messages.ts +10 -1
- package/source/Introspection.ts +105 -0
- package/source/MCP/Server.ts +275 -0
- package/source/MCP/discover.ts +52 -0
- package/source/MCP/errors.ts +81 -0
- package/source/MCP/index.ts +1 -0
- package/source/MCP/schema.test.ts +85 -0
- package/source/MCP/schema.ts +87 -0
- package/source/MCP/tools.ts +157 -0
- package/source/MCP/types.ts +84 -0
- package/source/Query.ts +48 -8
- package/source/RPC/Context.ts +78 -0
- package/source/RPC/Dispatcher.ts +130 -0
- package/source/RPC/errors.test.ts +52 -0
- package/source/RPC/errors.ts +83 -0
- package/source/RPC/index.ts +1 -0
- package/source/RPC/names.test.ts +122 -0
- package/source/RPC/names.ts +183 -0
- package/source/RPC/types.ts +34 -0
- package/source/RTD/Directives.ts +52 -2
- package/source/RTD/Endpoint.ts +2 -1
- package/source/RTD/Method.ts +14 -11
- package/source/RTD/Node.ts +38 -7
- package/source/RTD/Route.ts +30 -3
- package/source/RTD/Tree.ts +37 -1
- package/source/RTD/expiration.test.ts +1 -1
- package/source/RTD/walk.test.ts +110 -0
- package/source/const.ts +15 -0
- package/source/deployment.ts +8 -1
- package/source/directives/auth/Anonymous.test.ts +38 -0
- package/source/directives/auth/Anonymous.ts +12 -0
- package/source/directives/auth/Anyone.ts +4 -0
- package/source/directives/auth/Authorization.ts +62 -3
- package/source/directives/auth/Delegate.test.ts +36 -0
- package/source/directives/auth/Delegate.ts +14 -0
- package/source/directives/auth/Echo.ts +5 -0
- package/source/directives/auth/Incept.ts +2 -1
- package/source/directives/auth/Role.ts +13 -0
- package/source/directives/auth/Rule.ts +29 -0
- package/source/directives/auth/Scheme.ts +5 -0
- package/source/directives/auth/types.ts +21 -0
- package/source/directives/cache/Cache.ts +1 -1
- package/source/directives/dev/Development.ts +1 -1
- package/source/directives/flow/Flow.ts +1 -1
- package/source/directives/index.ts +3 -1
- package/source/directives/io/Directive.ts +1 -1
- package/source/directives/io/IO.ts +32 -3
- package/source/directives/io/Input.ts +3 -2
- package/source/directives/io/Output.ts +6 -3
- package/source/directives/io/Status.test.ts +2 -2
- package/source/directives/io/Status.ts +1 -1
- package/source/directives/io/Throttle.ts +1 -1
- package/source/directives/io/lib/throttle/Quotas.ts +2 -2
- package/source/directives/map/Headers.ts +11 -0
- package/source/directives/map/Map.ts +10 -1
- package/source/directives/map/Mapping.ts +23 -0
- package/source/directives/map/Segments.ts +12 -0
- package/source/directives/mcp/MCP.ts +40 -0
- package/source/directives/mcp/Tool.test.ts +90 -0
- package/source/directives/mcp/Tool.ts +47 -0
- package/source/directives/mcp/index.ts +6 -0
- package/source/directives/oauth/Discovery.ts +10 -16
- package/source/directives/octets/Octets.ts +1 -1
- package/source/directives/require/Directive.ts +1 -1
- package/source/directives/require/Headers.ts +1 -1
- package/source/directives/require/Require.ts +2 -2
- package/source/schemas.ts +2 -0
- package/transpiled/Annotation.d.ts +24 -0
- package/transpiled/Directive.d.ts +18 -1
- package/transpiled/Directive.js +50 -6
- package/transpiled/Directive.js.map +1 -1
- package/transpiled/Endpoint.d.ts +9 -0
- package/transpiled/Endpoint.js +27 -11
- package/transpiled/Endpoint.js.map +1 -1
- package/transpiled/Factory.js +5 -1
- package/transpiled/Factory.js.map +1 -1
- package/transpiled/Gateway.d.ts +19 -2
- package/transpiled/Gateway.js +51 -9
- package/transpiled/Gateway.js.map +1 -1
- package/transpiled/HTTP/Context.d.ts +6 -0
- package/transpiled/HTTP/Context.js +6 -0
- package/transpiled/HTTP/Context.js.map +1 -1
- package/transpiled/HTTP/Server.d.ts +5 -1
- package/transpiled/HTTP/exceptions.d.ts +1 -1
- package/transpiled/HTTP/exceptions.js +2 -2
- package/transpiled/HTTP/exceptions.js.map +1 -1
- package/transpiled/HTTP/messages.d.ts +6 -0
- package/transpiled/HTTP/messages.js +9 -1
- package/transpiled/HTTP/messages.js.map +1 -1
- package/transpiled/Introspection.d.ts +42 -0
- package/transpiled/Introspection.js +50 -1
- package/transpiled/Introspection.js.map +1 -1
- package/transpiled/MCP/Server.d.ts +41 -0
- package/transpiled/MCP/Server.js +180 -0
- package/transpiled/MCP/Server.js.map +1 -0
- package/transpiled/MCP/discover.d.ts +13 -0
- package/transpiled/MCP/discover.js +29 -0
- package/transpiled/MCP/discover.js.map +1 -0
- package/transpiled/MCP/errors.d.ts +24 -0
- package/transpiled/MCP/errors.js +67 -0
- package/transpiled/MCP/errors.js.map +1 -0
- package/transpiled/MCP/index.d.ts +1 -0
- package/transpiled/MCP/index.js +2 -0
- package/transpiled/MCP/index.js.map +1 -0
- package/transpiled/MCP/schema.d.ts +18 -0
- package/transpiled/MCP/schema.js +64 -0
- package/transpiled/MCP/schema.js.map +1 -0
- package/transpiled/MCP/tools.d.ts +31 -0
- package/transpiled/MCP/tools.js +122 -0
- package/transpiled/MCP/tools.js.map +1 -0
- package/transpiled/MCP/types.d.ts +66 -0
- package/transpiled/MCP/types.js +13 -0
- package/transpiled/MCP/types.js.map +1 -0
- package/transpiled/Query.d.ts +7 -0
- package/transpiled/Query.js +38 -7
- package/transpiled/Query.js.map +1 -1
- package/transpiled/RPC/Context.d.ts +11 -0
- package/transpiled/RPC/Context.js +63 -0
- package/transpiled/RPC/Context.js.map +1 -0
- package/transpiled/RPC/Dispatcher.d.ts +19 -0
- package/transpiled/RPC/Dispatcher.js +100 -0
- package/transpiled/RPC/Dispatcher.js.map +1 -0
- package/transpiled/RPC/errors.d.ts +18 -0
- package/transpiled/RPC/errors.js +67 -0
- package/transpiled/RPC/errors.js.map +1 -0
- package/transpiled/RPC/index.d.ts +1 -0
- package/transpiled/RPC/index.js +2 -0
- package/transpiled/RPC/index.js.map +1 -0
- package/transpiled/RPC/names.d.ts +31 -0
- package/transpiled/RPC/names.js +121 -0
- package/transpiled/RPC/names.js.map +1 -0
- package/transpiled/RPC/types.d.ts +27 -0
- package/transpiled/RPC/types.js +8 -0
- package/transpiled/RPC/types.js.map +1 -0
- package/transpiled/RTD/Directives.d.ts +41 -2
- package/transpiled/RTD/Endpoint.d.ts +2 -1
- package/transpiled/RTD/Method.d.ts +8 -3
- package/transpiled/RTD/Method.js +12 -10
- package/transpiled/RTD/Method.js.map +1 -1
- package/transpiled/RTD/Node.d.ts +20 -2
- package/transpiled/RTD/Node.js +22 -4
- package/transpiled/RTD/Node.js.map +1 -1
- package/transpiled/RTD/Route.d.ts +2 -1
- package/transpiled/RTD/Route.js +27 -2
- package/transpiled/RTD/Route.js.map +1 -1
- package/transpiled/RTD/Tree.d.ts +3 -1
- package/transpiled/RTD/Tree.js +26 -0
- package/transpiled/RTD/Tree.js.map +1 -1
- package/transpiled/const.d.ts +12 -0
- package/transpiled/const.js +12 -0
- package/transpiled/const.js.map +1 -1
- package/transpiled/deployment.js +4 -0
- package/transpiled/deployment.js.map +1 -1
- package/transpiled/directives/auth/Anonymous.d.ts +6 -0
- package/transpiled/directives/auth/Anonymous.js +10 -0
- package/transpiled/directives/auth/Anonymous.js.map +1 -1
- package/transpiled/directives/auth/Anyone.d.ts +1 -0
- package/transpiled/directives/auth/Anyone.js +3 -0
- package/transpiled/directives/auth/Anyone.js.map +1 -1
- package/transpiled/directives/auth/Authorization.d.ts +27 -1
- package/transpiled/directives/auth/Authorization.js +49 -1
- package/transpiled/directives/auth/Authorization.js.map +1 -1
- package/transpiled/directives/auth/Delegate.d.ts +5 -0
- package/transpiled/directives/auth/Delegate.js +10 -0
- package/transpiled/directives/auth/Delegate.js.map +1 -1
- package/transpiled/directives/auth/Echo.d.ts +2 -0
- package/transpiled/directives/auth/Echo.js +4 -0
- package/transpiled/directives/auth/Echo.js.map +1 -1
- package/transpiled/directives/auth/Incept.js +2 -1
- package/transpiled/directives/auth/Incept.js.map +1 -1
- package/transpiled/directives/auth/Role.d.ts +2 -0
- package/transpiled/directives/auth/Role.js +9 -0
- package/transpiled/directives/auth/Role.js.map +1 -1
- package/transpiled/directives/auth/Rule.d.ts +5 -0
- package/transpiled/directives/auth/Rule.js +20 -0
- package/transpiled/directives/auth/Rule.js.map +1 -1
- package/transpiled/directives/auth/Scheme.d.ts +2 -0
- package/transpiled/directives/auth/Scheme.js +4 -0
- package/transpiled/directives/auth/Scheme.js.map +1 -1
- package/transpiled/directives/auth/types.d.ts +16 -0
- package/transpiled/directives/cache/Cache.d.ts +1 -1
- package/transpiled/directives/cache/Cache.js +1 -1
- package/transpiled/directives/cache/Cache.js.map +1 -1
- package/transpiled/directives/dev/Development.d.ts +1 -1
- package/transpiled/directives/dev/Development.js +1 -1
- package/transpiled/directives/dev/Development.js.map +1 -1
- package/transpiled/directives/flow/Flow.d.ts +1 -1
- package/transpiled/directives/flow/Flow.js +1 -1
- package/transpiled/directives/flow/Flow.js.map +1 -1
- package/transpiled/directives/index.js +2 -1
- package/transpiled/directives/index.js.map +1 -1
- package/transpiled/directives/io/Directive.d.ts +1 -1
- package/transpiled/directives/io/IO.d.ts +7 -1
- package/transpiled/directives/io/IO.js +23 -3
- package/transpiled/directives/io/IO.js.map +1 -1
- package/transpiled/directives/io/Input.d.ts +3 -2
- package/transpiled/directives/io/Input.js +2 -1
- package/transpiled/directives/io/Input.js.map +1 -1
- package/transpiled/directives/io/Output.d.ts +5 -3
- package/transpiled/directives/io/Output.js +4 -2
- package/transpiled/directives/io/Output.js.map +1 -1
- package/transpiled/directives/io/Status.d.ts +1 -1
- package/transpiled/directives/io/Status.js +1 -1
- package/transpiled/directives/io/Status.js.map +1 -1
- package/transpiled/directives/io/Throttle.d.ts +1 -1
- package/transpiled/directives/io/Throttle.js +1 -1
- package/transpiled/directives/io/Throttle.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/Quotas.d.ts +1 -1
- package/transpiled/directives/io/lib/throttle/Quotas.js +2 -2
- package/transpiled/directives/io/lib/throttle/Quotas.js.map +1 -1
- package/transpiled/directives/map/Headers.d.ts +2 -0
- package/transpiled/directives/map/Headers.js +8 -0
- package/transpiled/directives/map/Headers.js.map +1 -1
- package/transpiled/directives/map/Map.d.ts +3 -1
- package/transpiled/directives/map/Map.js +7 -1
- package/transpiled/directives/map/Map.js.map +1 -1
- package/transpiled/directives/map/Mapping.d.ts +13 -0
- package/transpiled/directives/map/Mapping.js +20 -0
- package/transpiled/directives/map/Mapping.js.map +1 -1
- package/transpiled/directives/map/Segments.d.ts +3 -0
- package/transpiled/directives/map/Segments.js +9 -0
- package/transpiled/directives/map/Segments.js.map +1 -1
- package/transpiled/directives/mcp/MCP.d.ts +15 -0
- package/transpiled/directives/mcp/MCP.js +29 -0
- package/transpiled/directives/mcp/MCP.js.map +1 -0
- package/transpiled/directives/mcp/Tool.d.ts +18 -0
- package/transpiled/directives/mcp/Tool.js +34 -0
- package/transpiled/directives/mcp/Tool.js.map +1 -0
- package/transpiled/directives/mcp/index.d.ts +4 -0
- package/transpiled/directives/mcp/index.js +4 -0
- package/transpiled/directives/mcp/index.js.map +1 -0
- package/transpiled/directives/oauth/Discovery.js +10 -13
- package/transpiled/directives/oauth/Discovery.js.map +1 -1
- package/transpiled/directives/octets/Octets.d.ts +1 -1
- package/transpiled/directives/octets/Octets.js +1 -1
- package/transpiled/directives/octets/Octets.js.map +1 -1
- package/transpiled/directives/require/Directive.d.ts +1 -1
- package/transpiled/directives/require/Headers.d.ts +1 -1
- package/transpiled/directives/require/Headers.js +1 -1
- package/transpiled/directives/require/Headers.js.map +1 -1
- package/transpiled/directives/require/Require.d.ts +1 -1
- package/transpiled/directives/require/Require.js +2 -2
- package/transpiled/directives/require/Require.js.map +1 -1
- package/transpiled/schemas.d.ts +2 -0
- package/transpiled/schemas.js +1 -0
- package/transpiled/schemas.js.map +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/components/identity.bans/operations/transit.d.ts +0 -14
- package/components/identity.bans/operations/transit.js.map +0 -1
- package/components/identity.basic/operations/add.d.ts +0 -3
- package/components/identity.basic/operations/add.js.map +0 -1
- package/components/identity.basic/operations/authenticate.d.ts +0 -13
- package/components/identity.basic/operations/authenticate.js.map +0 -1
- package/components/identity.basic/operations/check.d.ts +0 -7
- package/components/identity.basic/operations/check.js.map +0 -1
- package/components/identity.basic/operations/delete.d.ts +0 -7
- package/components/identity.basic/operations/delete.js.map +0 -1
- package/components/identity.basic/operations/incept.d.ts +0 -12
- package/components/identity.basic/operations/incept.js.map +0 -1
- package/components/identity.basic/operations/info.d.ts +0 -10
- package/components/identity.basic/operations/info.js.map +0 -1
- package/components/identity.basic/operations/lib/credentials.d.ts +0 -5
- package/components/identity.basic/operations/lib/credentials.js.map +0 -1
- package/components/identity.basic/operations/transit.d.ts +0 -15
- package/components/identity.basic/operations/transit.js.map +0 -1
- package/components/identity.clients/operations/describe.d.ts +0 -27
- package/components/identity.clients/operations/describe.js.map +0 -1
- package/components/identity.clients/operations/lib/Context.d.ts +0 -29
- package/components/identity.clients/operations/lib/Context.js.map +0 -1
- package/components/identity.clients/operations/lib/Entity.d.ts +0 -29
- package/components/identity.clients/operations/lib/Entity.js.map +0 -1
- package/components/identity.clients/operations/lib/canonical.d.ts +0 -11
- package/components/identity.clients/operations/lib/canonical.js.map +0 -1
- package/components/identity.clients/operations/lib/cimd.d.ts +0 -8
- package/components/identity.clients/operations/lib/cimd.js.map +0 -1
- package/components/identity.clients/operations/lib/errors.d.ts +0 -7
- package/components/identity.clients/operations/lib/errors.js.map +0 -1
- package/components/identity.clients/operations/lib/index.d.ts +0 -6
- package/components/identity.clients/operations/lib/index.js.map +0 -1
- package/components/identity.clients/operations/lib/redirect.d.ts +0 -10
- package/components/identity.clients/operations/lib/redirect.js.map +0 -1
- package/components/identity.clients/operations/register.d.ts +0 -37
- package/components/identity.clients/operations/register.js.map +0 -1
- package/components/identity.credentials/operations/list.d.ts +0 -52
- package/components/identity.credentials/operations/list.js.map +0 -1
- package/components/identity.federation/operations/authenticate.d.ts +0 -16
- package/components/identity.federation/operations/authenticate.js.map +0 -1
- package/components/identity.federation/operations/create.d.ts +0 -8
- package/components/identity.federation/operations/create.js.map +0 -1
- package/components/identity.federation/operations/decode.d.ts +0 -3
- package/components/identity.federation/operations/decode.js.map +0 -1
- package/components/identity.federation/operations/delete.d.ts +0 -8
- package/components/identity.federation/operations/delete.js.map +0 -1
- package/components/identity.federation/operations/incept.d.ts +0 -11
- package/components/identity.federation/operations/incept.js.map +0 -1
- package/components/identity.federation/operations/lib/Configuration.d.ts +0 -39
- package/components/identity.federation/operations/lib/Configuration.js.map +0 -1
- package/components/identity.federation/operations/lib/Ctx.d.ts +0 -8
- package/components/identity.federation/operations/lib/Ctx.js.map +0 -1
- package/components/identity.federation/operations/lib/Payload.d.ts +0 -5
- package/components/identity.federation/operations/lib/Payload.js.map +0 -1
- package/components/identity.federation/operations/lib/decode.d.ts +0 -3
- package/components/identity.federation/operations/lib/decode.js.map +0 -1
- package/components/identity.federation/operations/lib/discovery.d.ts +0 -5
- package/components/identity.federation/operations/lib/discovery.js.map +0 -1
- package/components/identity.federation/operations/lib/errors.d.ts +0 -77
- package/components/identity.federation/operations/lib/errors.js.map +0 -1
- package/components/identity.federation/operations/lib/exchange.d.ts +0 -3
- package/components/identity.federation/operations/lib/exchange.js.map +0 -1
- package/components/identity.federation/operations/lib/index.d.ts +0 -4
- package/components/identity.federation/operations/lib/index.js.map +0 -1
- package/components/identity.federation/operations/lib/jose.d.ts +0 -1
- package/components/identity.federation/operations/lib/jose.js.map +0 -1
- package/components/identity.federation/operations/lib/resolve.d.ts +0 -3
- package/components/identity.federation/operations/lib/resolve.js.map +0 -1
- package/components/identity.federation/operations/list.d.ts +0 -7
- package/components/identity.federation/operations/list.js.map +0 -1
- package/components/identity.federation/operations/types/Scheme.d.ts +0 -1
- package/components/identity.federation/operations/types/Scheme.js.map +0 -1
- package/components/identity.federation/operations/types/configuration.d.ts +0 -22
- package/components/identity.federation/operations/types/configuration.js.map +0 -1
- package/components/identity.federation/operations/types/context.d.ts +0 -36
- package/components/identity.federation/operations/types/context.js.map +0 -1
- package/components/identity.federation/operations/types/entity.d.ts +0 -9
- package/components/identity.federation/operations/types/entity.js.map +0 -1
- package/components/identity.federation/operations/types/index.d.ts +0 -4
- package/components/identity.federation/operations/types/index.js.map +0 -1
- package/components/identity.grants/operations/authorize.d.ts +0 -35
- package/components/identity.grants/operations/authorize.js.map +0 -1
- package/components/identity.grants/operations/exchange.d.ts +0 -37
- package/components/identity.grants/operations/exchange.js.map +0 -1
- package/components/identity.grants/operations/lib/code.d.ts +0 -15
- package/components/identity.grants/operations/lib/code.js.map +0 -1
- package/components/identity.grants/operations/lib/identify.d.ts +0 -6
- package/components/identity.grants/operations/lib/identify.js.map +0 -1
- package/components/identity.grants/operations/lib/index.d.ts +0 -3
- package/components/identity.grants/operations/lib/index.js.map +0 -1
- package/components/identity.grants/operations/list.d.ts +0 -13
- package/components/identity.grants/operations/list.js.map +0 -1
- package/components/identity.grants/operations/revoke.d.ts +0 -18
- package/components/identity.grants/operations/revoke.js.map +0 -1
- package/components/identity.keys/operations/create.d.ts +0 -22
- package/components/identity.keys/operations/create.js.map +0 -1
- package/components/identity.keys/operations/disable.d.ts +0 -5
- package/components/identity.keys/operations/disable.js.map +0 -1
- package/components/identity.keys/operations/revoke.d.ts +0 -15
- package/components/identity.keys/operations/revoke.js.map +0 -1
- package/components/identity.otp/operations/authenticate.d.ts +0 -12
- package/components/identity.otp/operations/authenticate.js.map +0 -1
- package/components/identity.otp/operations/issue.d.ts +0 -12
- package/components/identity.otp/operations/issue.js.map +0 -1
- package/components/identity.otp/operations/lib/Context.d.ts +0 -16
- package/components/identity.otp/operations/lib/Context.js.map +0 -1
- package/components/identity.otp/operations/lib/Entity.d.ts +0 -6
- package/components/identity.otp/operations/lib/Entity.js.map +0 -1
- package/components/identity.otp/operations/lib/index.d.ts +0 -1
- package/components/identity.otp/operations/lib/index.js.map +0 -1
- package/components/identity.passkeys/operations/authenticate.d.ts +0 -16
- package/components/identity.passkeys/operations/authenticate.js.map +0 -1
- package/components/identity.passkeys/operations/challenge.d.ts +0 -35
- package/components/identity.passkeys/operations/challenge.js.map +0 -1
- package/components/identity.passkeys/operations/create.d.ts +0 -19
- package/components/identity.passkeys/operations/create.js.map +0 -1
- package/components/identity.passkeys/operations/delete.d.ts +0 -8
- package/components/identity.passkeys/operations/delete.js.map +0 -1
- package/components/identity.passkeys/operations/lib/const.d.ts +0 -1
- package/components/identity.passkeys/operations/lib/const.js.map +0 -1
- package/components/identity.passkeys/operations/list.d.ts +0 -7
- package/components/identity.passkeys/operations/list.js.map +0 -1
- package/components/identity.passkeys/operations/types/Configuration.d.ts +0 -6
- package/components/identity.passkeys/operations/types/Configuration.js.map +0 -1
- package/components/identity.passkeys/operations/types/Context.d.ts +0 -16
- package/components/identity.passkeys/operations/types/Context.js.map +0 -1
- package/components/identity.passkeys/operations/types/Passkey.d.ts +0 -12
- package/components/identity.passkeys/operations/types/Passkey.js.map +0 -1
- package/components/identity.passkeys/operations/types/index.d.ts +0 -2
- package/components/identity.passkeys/operations/types/index.js.map +0 -1
- package/components/identity.passkeys/operations/use.d.ts +0 -16
- package/components/identity.passkeys/operations/use.js.map +0 -1
- package/components/identity.roles/operations/grant.d.ts +0 -10
- package/components/identity.roles/operations/grant.js.map +0 -1
- package/components/identity.roles/operations/lib/Entity.d.ts +0 -5
- package/components/identity.roles/operations/lib/Entity.js.map +0 -1
- package/components/identity.roles/operations/list.d.ts +0 -2
- package/components/identity.roles/operations/list.js.map +0 -1
- package/components/identity.roles/operations/principal.d.ts +0 -13
- package/components/identity.roles/operations/principal.js.map +0 -1
- package/components/identity.tokens/operations/authenticate.d.ts +0 -10
- package/components/identity.tokens/operations/authenticate.js.map +0 -1
- package/components/identity.tokens/operations/decrypt.d.ts +0 -16
- package/components/identity.tokens/operations/decrypt.js.map +0 -1
- package/components/identity.tokens/operations/encrypt.d.ts +0 -9
- package/components/identity.tokens/operations/encrypt.js.map +0 -1
- package/components/identity.tokens/operations/issue.d.ts +0 -25
- package/components/identity.tokens/operations/issue.js.map +0 -1
- package/components/identity.tokens/operations/lib/form.d.ts +0 -8
- package/components/identity.tokens/operations/lib/form.js.map +0 -1
- package/components/identity.tokens/operations/lib/index.d.ts +0 -4
- package/components/identity.tokens/operations/lib/index.js.map +0 -1
- package/components/identity.tokens/operations/lib/jose.d.ts +0 -1
- package/components/identity.tokens/operations/lib/jose.js.map +0 -1
- package/components/identity.tokens/operations/lib/key.d.ts +0 -1
- package/components/identity.tokens/operations/lib/key.js.map +0 -1
- package/components/identity.tokens/operations/lib/pad.d.ts +0 -1
- package/components/identity.tokens/operations/lib/pad.js.map +0 -1
- package/components/identity.tokens/operations/revoke.d.ts +0 -2
- package/components/identity.tokens/operations/revoke.js.map +0 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import assert from 'node:assert'
|
|
2
|
+
import { describe, it } from 'node:test'
|
|
3
|
+
import { Tool } from './Tool.js'
|
|
4
|
+
import { MCP } from './MCP.js'
|
|
5
|
+
|
|
6
|
+
describe('mcp:tool', () => {
|
|
7
|
+
it('should take what the route states the tool is', () => {
|
|
8
|
+
const tool = new Tool('The pots that are hot.', '/pots/hot')
|
|
9
|
+
|
|
10
|
+
assert.strictEqual(tool.description, 'The pots that are hot.')
|
|
11
|
+
assert.strictEqual(tool.title, undefined)
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it('should take a title beside the description', () => {
|
|
15
|
+
const tool = new Tool({ title: 'Hot pots', description: 'The pots that are hot.' }, '/pots')
|
|
16
|
+
|
|
17
|
+
assert.strictEqual(tool.title, 'Hot pots')
|
|
18
|
+
assert.strictEqual(tool.description, 'The pots that are hot.')
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('should not accept a mapping without a description', () => {
|
|
22
|
+
assert.throws(() => new Tool({ title: 'Hot pots' }, '/pots'), /cannot be empty/)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('should not accept an empty title', () => {
|
|
26
|
+
assert.throws(() => new Tool({ title: ' ', description: 'A pot.' }, '/pots'),
|
|
27
|
+
/a title cannot be empty/)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('should not accept what it does not know', () => {
|
|
31
|
+
assert.throws(() => new Tool({ description: 'A pot.', name: 'pots' }, '/pots'),
|
|
32
|
+
/unknown 'name'/)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('should not accept an empty description', () => {
|
|
36
|
+
assert.throws(() => new Tool(' ', '/pots'), /cannot be empty/)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('should not accept a value that is not one', () => {
|
|
40
|
+
// `true` published a tool that stated nothing, back when an operation stated it instead
|
|
41
|
+
assert.throws(() => new Tool(true, '/pots'), /the value is what the tool is/)
|
|
42
|
+
assert.throws(() => new Tool(false, '/pots'), /the value is what the tool is/)
|
|
43
|
+
assert.throws(() => new Tool(1, '/pots'), /the value is what the tool is/)
|
|
44
|
+
assert.throws(() => new Tool(['A pot.'], '/pots'), /the value is what the tool is/)
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('should refuse a route no name can spell', () => {
|
|
48
|
+
assert.throws(() => new Tool('A pot.', '/pots/a.b'), /no tool name can spell/)
|
|
49
|
+
assert.throws(() => new Tool('A pot.', '/pots/:a.b'), /no tool name can spell/)
|
|
50
|
+
|
|
51
|
+
// an underscore is what the convention keeps for itself
|
|
52
|
+
assert.throws(() => new Tool('A pot.', '/pots/a_b'), /no tool name can spell/)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('should name the route it refuses', () => {
|
|
56
|
+
assert.throws(() => new Tool('A pot.', '/pots/a.b'), /'\/pots\/a\.b'/)
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
describe('mcp:tool inheritance', () => {
|
|
61
|
+
const family = new MCP()
|
|
62
|
+
|
|
63
|
+
it('should take the nearest declaration', () => {
|
|
64
|
+
const own = new Tool('Nearest.', '/pots')
|
|
65
|
+
const inherited = new Tool('Furthest.', '/pots')
|
|
66
|
+
|
|
67
|
+
assert.strictEqual(MCP.published([own, inherited])?.description, 'Nearest.')
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it('should publish nothing where nothing is declared', () => {
|
|
71
|
+
assert.strictEqual(MCP.published(undefined), null)
|
|
72
|
+
assert.strictEqual(MCP.published([]), null)
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it('should describe a method with what the route states', () => {
|
|
76
|
+
const described = family.explain([new Tool('What the route is.', '/pots')], null as never,
|
|
77
|
+
{ description: 'What the operation is.' })
|
|
78
|
+
|
|
79
|
+
assert.strictEqual(described.description, 'What the route is.')
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('should state nothing where nothing is declared', () => {
|
|
83
|
+
assert.strictEqual(family.explain([], null as never, {}).description, undefined)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('should refuse a directive it does not know', () => {
|
|
87
|
+
assert.throws(() => family.create('resource', 'A pot.', null, '/pots'),
|
|
88
|
+
/Unknown directive: mcp:resource/)
|
|
89
|
+
})
|
|
90
|
+
})
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import assert from 'node:assert'
|
|
2
|
+
import { refusal } from '../../RPC/names.js'
|
|
3
|
+
import { segment } from '../../RTD/segment.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* What one method is, published to a model. Declaring it is what publishes it, and what it
|
|
7
|
+
* says is what it says it is: a tool a model cannot read the purpose of is one it cannot
|
|
8
|
+
* choose, so there is no way to publish one that states nothing.
|
|
9
|
+
*
|
|
10
|
+
* A `title` is what a person is shown where a client lists what it may call — a name is an
|
|
11
|
+
* address and reads as one. A description alone is written as the value; both are written as
|
|
12
|
+
* a mapping.
|
|
13
|
+
*
|
|
14
|
+
* The operation states what it is too, and that is not this. An operation is written without
|
|
15
|
+
* knowledge of any route, and a tool is an operation and a route together — the same
|
|
16
|
+
* operation mounted twice is two tools, and one sentence is not true of both.
|
|
17
|
+
*/
|
|
18
|
+
export class Tool {
|
|
19
|
+
public readonly description: string
|
|
20
|
+
public readonly title: string | undefined
|
|
21
|
+
|
|
22
|
+
public constructor (value: unknown, route: string) {
|
|
23
|
+
const stated = typeof value === 'string' ? { description: value } : value
|
|
24
|
+
|
|
25
|
+
assert.ok(typeof stated === 'object' && stated !== null && !Array.isArray(stated),
|
|
26
|
+
'Directive mcp:tool: the value is what the tool is, or a `title` and a `description`')
|
|
27
|
+
|
|
28
|
+
const { description, title, ...rest } = stated as Record<string, unknown>
|
|
29
|
+
|
|
30
|
+
assert.ok(Object.keys(rest).length === 0,
|
|
31
|
+
`Directive mcp:tool: unknown ${Object.keys(rest).map((key) => `'${key}'`).join(', ')}`)
|
|
32
|
+
|
|
33
|
+
assert.ok(typeof description === 'string' && description.trim().length > 0,
|
|
34
|
+
'Directive mcp:tool: a description cannot be empty')
|
|
35
|
+
|
|
36
|
+
assert.ok(title === undefined || (typeof title === 'string' && title.trim().length > 0),
|
|
37
|
+
'Directive mcp:tool: a title cannot be empty')
|
|
38
|
+
|
|
39
|
+
// a tool is called by name, so a route that cannot be named cannot be one — said where
|
|
40
|
+
// the mistake is, rather than as a tool that is quietly never listed
|
|
41
|
+
assert.ok(refusal(segment(route)) === null,
|
|
42
|
+
`Directive mcp:tool: '${route}' holds a segment no tool name can spell`)
|
|
43
|
+
|
|
44
|
+
this.description = description
|
|
45
|
+
this.title = title as string | undefined
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -26,8 +26,17 @@ export class Discovery implements Interceptor {
|
|
|
26
26
|
if (options.oauth === undefined)
|
|
27
27
|
return
|
|
28
28
|
|
|
29
|
+
/*
|
|
30
|
+
* `https` always: RFC 8414 has an issuer be one, and OAuth 2.1 has every endpoint of an
|
|
31
|
+
* authorization server be one — the loopback exception is a client's redirect URI, not
|
|
32
|
+
* a server's address. A gateway served without TLS has no authorization server a client
|
|
33
|
+
* may use, and naming it `http` would hide that behind documents none should accept.
|
|
34
|
+
*
|
|
35
|
+
* The host is the configured one, not the request's, which is the client's to write: a
|
|
36
|
+
* forged one would have these documents name someone else's token endpoint.
|
|
37
|
+
*/
|
|
29
38
|
for (const [authority, host] of Object.entries(options.authorities))
|
|
30
|
-
this.authorities.set(authority, documents(
|
|
39
|
+
this.authorities.set(authority, documents(`https://${host}`, options.oauth))
|
|
31
40
|
}
|
|
32
41
|
|
|
33
42
|
public reset (): void {
|
|
@@ -58,19 +67,4 @@ export class Discovery implements Interceptor {
|
|
|
58
67
|
}
|
|
59
68
|
}
|
|
60
69
|
|
|
61
|
-
/**
|
|
62
|
-
* The absolute URL an authority is reached at. Loopback is served over http and everything
|
|
63
|
-
* else over https: the gateway may sit behind a terminating proxy, so the connection does
|
|
64
|
-
* not say which, and the configured host does. Taken from the configuration rather than
|
|
65
|
-
* from the request's `host`, which is the client's to write.
|
|
66
|
-
*/
|
|
67
|
-
function origin (host: string): string {
|
|
68
|
-
const name = host.split(':')[0]
|
|
69
|
-
|
|
70
|
-
const loopback = name === 'localhost' || name === '127.0.0.1' || name === '[::1]' ||
|
|
71
|
-
name.endsWith('.localhost')
|
|
72
|
-
|
|
73
|
-
return `${loopback ? 'http' : 'https'}://${host}`
|
|
74
|
-
}
|
|
75
|
-
|
|
76
70
|
const UNAUTHORIZED = 401
|
|
@@ -28,7 +28,7 @@ export class Octets implements DirectiveFamily<Directive> {
|
|
|
28
28
|
return new Class(value, this.discovery, remotes)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
public async
|
|
31
|
+
public async precall (directives: Directive[], input: Input, parameters: Parameter[]): Promise<Output> {
|
|
32
32
|
let context: Context | null = null
|
|
33
33
|
let action: Directive | null = null
|
|
34
34
|
|
|
@@ -12,7 +12,7 @@ export class Headers implements Directive {
|
|
|
12
12
|
this.headers = headers
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
public
|
|
15
|
+
public precall (context: Input): void {
|
|
16
16
|
for (const header of this.headers)
|
|
17
17
|
if (context.request.headers[header] === undefined)
|
|
18
18
|
throw new BadRequest(`Header required: ${header}`)
|
|
@@ -14,9 +14,9 @@ export class Require implements DirectiveFamily {
|
|
|
14
14
|
return new directives[name](value)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
public
|
|
17
|
+
public precall (instances: Directive[], context: Input): null {
|
|
18
18
|
for (const instance of instances)
|
|
19
|
-
instance.
|
|
19
|
+
instance.precall(context)
|
|
20
20
|
|
|
21
21
|
return null
|
|
22
22
|
}
|
package/source/schemas.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { resolve } from 'node:path'
|
|
|
2
2
|
import * as schemas from '@toa.io/schemas'
|
|
3
3
|
import type { Query } from './HTTP/index.js'
|
|
4
4
|
import type { Node } from './RTD/index.js'
|
|
5
|
+
import type { Call } from './RPC/types.js'
|
|
5
6
|
import type { Schema } from '@toa.io/schemas'
|
|
6
7
|
import type { Annotation } from './Annotation.js'
|
|
7
8
|
|
|
@@ -11,3 +12,4 @@ const namespace = schemas.namespace(path)
|
|
|
11
12
|
export const querystring: Schema<Query> = namespace.schema('querystring')
|
|
12
13
|
export const annotation: Schema<Annotation> = namespace.schema('annotation')
|
|
13
14
|
export const node: Schema<Node> = namespace.schema('node')
|
|
15
|
+
export const call: Schema<Call> = namespace.schema('call')
|
|
@@ -21,6 +21,10 @@ export interface Annotation {
|
|
|
21
21
|
bouncer?: Bouncer;
|
|
22
22
|
/** The authorization server this context exposes; none is exposed without it. */
|
|
23
23
|
oauth?: OAuth;
|
|
24
|
+
/** JSON-RPC at `/.rpc`; none is served without it. See `documentation/rpc.md`. */
|
|
25
|
+
rpc?: RPC;
|
|
26
|
+
/** MCP at `/.mcp`; none is served without it. See `documentation/mcp.md`. */
|
|
27
|
+
mcp?: MCP;
|
|
24
28
|
'/'?: object;
|
|
25
29
|
}
|
|
26
30
|
export interface OAuth {
|
|
@@ -38,6 +42,26 @@ export interface OAuth {
|
|
|
38
42
|
/** Dynamic Client Registration, off unless opened. */
|
|
39
43
|
registration?: 'open' | 'closed';
|
|
40
44
|
}
|
|
45
|
+
export interface RPC {
|
|
46
|
+
/**
|
|
47
|
+
* Calls one request may carry, 32 by default. One request is one authentication and one
|
|
48
|
+
* reply however many calls it makes, so what a caller may ask for at once is bounded.
|
|
49
|
+
*/
|
|
50
|
+
batch?: number;
|
|
51
|
+
}
|
|
52
|
+
export interface MCP {
|
|
53
|
+
/** What the server calls itself, which a client shows a user. */
|
|
54
|
+
name: string;
|
|
55
|
+
/** What a model is told before it calls anything here. */
|
|
56
|
+
instructions?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Browser origins the endpoint answers, which the revision requires against DNS rebinding.
|
|
59
|
+
* None are admitted without it; a request carrying no `Origin` is not a browser's.
|
|
60
|
+
*/
|
|
61
|
+
origins?: string[];
|
|
62
|
+
/** Whether the endpoint answers without a credential. It does not unless it says so. */
|
|
63
|
+
anonymous?: boolean;
|
|
64
|
+
}
|
|
41
65
|
export interface Bouncer {
|
|
42
66
|
/** what an address may fail at once, 20 by default */
|
|
43
67
|
attempts?: number;
|
|
@@ -2,13 +2,21 @@ import type { Context, OutgoingMessage, Options } from './HTTP/index.js';
|
|
|
2
2
|
import type { Remotes } from './Remotes.js';
|
|
3
3
|
import type { Host } from './Factory.js';
|
|
4
4
|
import type { Output } from './io.js';
|
|
5
|
+
import type { Introspection } from './Introspection.js';
|
|
5
6
|
import type * as RTD from './RTD/index.js';
|
|
6
7
|
export declare class Directives implements RTD.Directives {
|
|
7
8
|
private readonly sets;
|
|
8
9
|
/** the span of a stage depends only on the set, so it is built once per route */
|
|
9
10
|
private readonly spans;
|
|
10
11
|
constructor(sets: RTD.DirectiveSet[]);
|
|
11
|
-
|
|
12
|
+
declared<T>(family: string): T[] | undefined;
|
|
13
|
+
precall(context: Context, parameters: RTD.Parameter[]): Promise<Output>;
|
|
14
|
+
/**
|
|
15
|
+
* What the method says about itself, as its directives leave it. Each family is given
|
|
16
|
+
* what the one before it returned, and the first to refuse ends it: a method this caller
|
|
17
|
+
* cannot reach is not described at all.
|
|
18
|
+
*/
|
|
19
|
+
explain(context: Context, introspection: Introspection): Promise<Introspection | null>;
|
|
12
20
|
settle(context: Context, response: OutgoingMessage): Promise<void>;
|
|
13
21
|
dispose(): void;
|
|
14
22
|
}
|
|
@@ -17,7 +25,16 @@ export declare class DirectivesFactory implements RTD.DirectiveFactory {
|
|
|
17
25
|
private readonly families;
|
|
18
26
|
private readonly mandatory;
|
|
19
27
|
private readonly instances;
|
|
28
|
+
/** The request-scoped stages, in registration order, with the spans they run in. */
|
|
29
|
+
private readonly stages;
|
|
20
30
|
constructor(families: RTD.DirectiveFamily[], remotes: Remotes, host: Host, options: Options);
|
|
31
|
+
/**
|
|
32
|
+
* Request-scoped, before anything is routed, so no directives are passed: a family
|
|
33
|
+
* answers here only for what it does on its own behalf.
|
|
34
|
+
*/
|
|
35
|
+
preflight(context: Context): Promise<void>;
|
|
36
|
+
/** Request-scoped, on the message going back. */
|
|
37
|
+
depart(context: Context, response: OutgoingMessage): Promise<void>;
|
|
21
38
|
create(declarations: RTD.syntax.Directive[], route?: string): Directives;
|
|
22
39
|
dispose(): void;
|
|
23
40
|
/** Mandatory families first, in their own order; everything else keeps its own. */
|
package/transpiled/Directive.js
CHANGED
|
@@ -6,26 +6,48 @@ export class Directives {
|
|
|
6
6
|
constructor(sets) {
|
|
7
7
|
this.sets = sets;
|
|
8
8
|
this.spans = sets.map((set) => ({
|
|
9
|
-
|
|
10
|
-
settle: options(set, 'settle')
|
|
9
|
+
precall: options(set, 'precall'),
|
|
10
|
+
settle: options(set, 'settle'),
|
|
11
|
+
explain: options(set, 'explain')
|
|
11
12
|
}));
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
declared(family) {
|
|
15
|
+
return this.sets.find((set) => set.family.name === family)?.directives;
|
|
16
|
+
}
|
|
17
|
+
async precall(context, parameters) {
|
|
14
18
|
let output = null;
|
|
15
19
|
for (let i = 0; i < this.sets.length; i++) {
|
|
16
20
|
const set = this.sets[i];
|
|
17
|
-
if (set.family.
|
|
21
|
+
if (set.family.precall === undefined)
|
|
18
22
|
continue;
|
|
19
|
-
const out = await console.span(this.spans[i].
|
|
23
|
+
const out = await console.span(this.spans[i].precall, async () => await set.family.precall(set.directives, context, parameters));
|
|
20
24
|
if (out === null)
|
|
21
25
|
continue;
|
|
22
26
|
if (output !== null)
|
|
23
|
-
throw new Error('Multiple
|
|
27
|
+
throw new Error('Multiple precall directives responded');
|
|
24
28
|
else
|
|
25
29
|
output = out;
|
|
26
30
|
}
|
|
27
31
|
return output;
|
|
28
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* What the method says about itself, as its directives leave it. Each family is given
|
|
35
|
+
* what the one before it returned, and the first to refuse ends it: a method this caller
|
|
36
|
+
* cannot reach is not described at all.
|
|
37
|
+
*/
|
|
38
|
+
async explain(context, introspection) {
|
|
39
|
+
let described = introspection;
|
|
40
|
+
for (let i = 0; i < this.sets.length; i++) {
|
|
41
|
+
const set = this.sets[i];
|
|
42
|
+
if (set.family.explain === undefined)
|
|
43
|
+
continue;
|
|
44
|
+
const next = await console.span(this.spans[i].explain, async () => await set.family.explain(set.directives, context, described));
|
|
45
|
+
if (next === null)
|
|
46
|
+
return null;
|
|
47
|
+
described = next;
|
|
48
|
+
}
|
|
49
|
+
return described;
|
|
50
|
+
}
|
|
29
51
|
async settle(context, response) {
|
|
30
52
|
for (let i = 0; i < this.sets.length; i++) {
|
|
31
53
|
const set = this.sets[i];
|
|
@@ -43,6 +65,8 @@ export class DirectivesFactory {
|
|
|
43
65
|
families = {};
|
|
44
66
|
mandatory = [];
|
|
45
67
|
instances = [];
|
|
68
|
+
/** The request-scoped stages, in registration order, with the spans they run in. */
|
|
69
|
+
stages = [];
|
|
46
70
|
// eslint-disable-next-line max-params
|
|
47
71
|
constructor(families, remotes, host, options) {
|
|
48
72
|
for (const family of families) {
|
|
@@ -50,9 +74,29 @@ export class DirectivesFactory {
|
|
|
50
74
|
this.families[family.name] = family;
|
|
51
75
|
if (family.mandatory)
|
|
52
76
|
this.mandatory.push(family.name);
|
|
77
|
+
this.stages.push({
|
|
78
|
+
family,
|
|
79
|
+
preflight: { name: `${family.name} preflight` },
|
|
80
|
+
depart: { name: `${family.name} depart` }
|
|
81
|
+
});
|
|
53
82
|
}
|
|
54
83
|
this.remotes = remotes;
|
|
55
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Request-scoped, before anything is routed, so no directives are passed: a family
|
|
87
|
+
* answers here only for what it does on its own behalf.
|
|
88
|
+
*/
|
|
89
|
+
async preflight(context) {
|
|
90
|
+
for (const stage of this.stages)
|
|
91
|
+
if (stage.family.preflight !== undefined)
|
|
92
|
+
await console.span(stage.preflight, async () => { await stage.family.preflight(context); });
|
|
93
|
+
}
|
|
94
|
+
/** Request-scoped, on the message going back. */
|
|
95
|
+
async depart(context, response) {
|
|
96
|
+
for (const stage of this.stages)
|
|
97
|
+
if (stage.family.depart !== undefined)
|
|
98
|
+
await console.span(stage.depart, async () => { await stage.family.depart(context, response); });
|
|
99
|
+
}
|
|
56
100
|
create(declarations, route = '') {
|
|
57
101
|
const groups = {};
|
|
58
102
|
const mandatory = new Set(this.mandatory);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Directive.js","sourceRoot":"","sources":["../source/Directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAoB,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"Directive.js","sourceRoot":"","sources":["../source/Directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAoB,MAAM,UAAU,CAAA;AAQpD,MAAM,OAAO,UAAU;IACJ,IAAI,CAAoB;IAEzC,iFAAiF;IAChE,KAAK,CAAS;IAE/B,YAAoB,IAAwB;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC9B,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC;YAChC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC;YAC9B,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC;SACjC,CAAC,CAAC,CAAA;IACL,CAAC;IAEM,QAAQ,CAAK,MAAc;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,IA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MAAM,CAAC,CAAC,CAAC,KAAK,CAAA;IACrD,CAAC;CACF;AAED,SAAS,OAAO,CAAE,GAAqB,EAAE,KAAuC;IAC9E,MAAM,OAAO,GAAgB,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,KAAK,EAAE,EAAE,CAAA;IAEpE,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;QACjD,OAAO,CAAC,UAAU,GAAG,EAAE,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;IAE/E,OAAO,OAAO,CAAA;AAChB,CAAC;AAcD,MAAM,CAAC,MAAM,SAAS,GAAyB,IAAI,GAAG,CAAC;IACrD,CAAC,WAAW,EAAE,gBAAgB,CAAC;IAC/B,CAAC,QAAQ,EAAE,aAAa,CAAC;IACzB,CAAC,IAAI,EAAE,SAAS,CAAC;IACjB,CAAC,MAAM,EAAE,WAAW,CAAC;IACrB,CAAC,MAAM,EAAE,WAAW,CAAC;IACrB,CAAC,QAAQ,EAAE,aAAa,CAAC;IACzB,CAAC,OAAO,EAAE,UAAU,CAAC;IACrB,CAAC,QAAQ,EAAE,WAAW,CAAC;IACvB,CAAC,WAAW,EAAE,eAAe,CAAC;CAC/B,CAAC,CAAA"}
|
package/transpiled/Endpoint.d.ts
CHANGED
|
@@ -10,9 +10,18 @@ export declare class Endpoint implements RTD.Endpoint {
|
|
|
10
10
|
private readonly mapping;
|
|
11
11
|
private readonly discovery;
|
|
12
12
|
private remote;
|
|
13
|
+
/** What the operation says, with what the route takes already split out of it. */
|
|
14
|
+
private introspection;
|
|
13
15
|
constructor(endpoint: string, mapping: Mapping, discovery: Promise<Remote>);
|
|
14
16
|
call(context: http.Context, parameters: RTD.Parameter[]): Promise<http.OutgoingMessage>;
|
|
15
17
|
explain(parameters: RTD.Parameter[]): Promise<Introspection>;
|
|
18
|
+
/**
|
|
19
|
+
* `Remote.explain` answers the contract's own object, whose `input` is the manifest's by
|
|
20
|
+
* reference. What follows takes properties out of it, and two routes mounting one endpoint
|
|
21
|
+
* share one remote — so the copy is what keeps the second from describing what the first
|
|
22
|
+
* took away.
|
|
23
|
+
*/
|
|
24
|
+
private introspect;
|
|
16
25
|
close(): Promise<void>;
|
|
17
26
|
private conditionalGet;
|
|
18
27
|
private query;
|
package/transpiled/Endpoint.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Readable } from 'node:stream';
|
|
2
2
|
import { console } from 'openspan';
|
|
3
3
|
import { Mapping } from './Mapping.js';
|
|
4
|
+
import { take } from './Introspection.js';
|
|
4
5
|
import { redact } from './redact.js';
|
|
5
6
|
import * as http from './HTTP/index.js';
|
|
6
7
|
export class Endpoint {
|
|
@@ -8,6 +9,8 @@ export class Endpoint {
|
|
|
8
9
|
mapping;
|
|
9
10
|
discovery;
|
|
10
11
|
remote = null;
|
|
12
|
+
/** What the operation says, with what the route takes already split out of it. */
|
|
13
|
+
introspection = null;
|
|
11
14
|
constructor(endpoint, mapping, discovery) {
|
|
12
15
|
this.endpoint = endpoint;
|
|
13
16
|
this.mapping = mapping;
|
|
@@ -42,19 +45,32 @@ export class Endpoint {
|
|
|
42
45
|
return message;
|
|
43
46
|
}
|
|
44
47
|
async explain(parameters) {
|
|
48
|
+
this.introspection ??= await this.introspect(parameters);
|
|
49
|
+
// what a directive narrows is this caller's answer, not the next caller's
|
|
50
|
+
return structuredClone(this.introspection);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* `Remote.explain` answers the contract's own object, whose `input` is the manifest's by
|
|
54
|
+
* reference. What follows takes properties out of it, and two routes mounting one endpoint
|
|
55
|
+
* share one remote — so the copy is what keeps the second from describing what the first
|
|
56
|
+
* took away.
|
|
57
|
+
*/
|
|
58
|
+
async introspect(parameters) {
|
|
45
59
|
this.remote ??= await this.discovery;
|
|
46
|
-
const operation = await this.remote.explain(this.endpoint);
|
|
60
|
+
const operation = structuredClone(await this.remote.explain(this.endpoint));
|
|
61
|
+
// what the operation states it is, is the Introspection's to read and not a resource's:
|
|
62
|
+
// an operation is written without knowledge of any route, and the same one mounted twice
|
|
63
|
+
// is two methods. What a method states is what its route states, which `mcp:tool` gives.
|
|
64
|
+
delete operation.description;
|
|
47
65
|
let route = null;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
}
|
|
66
|
+
// a variable the operation names is taken by the path, so it is not the body's to send
|
|
67
|
+
for (const parameter of parameters) {
|
|
68
|
+
const schema = take(operation, parameter.name);
|
|
69
|
+
if (schema === undefined)
|
|
70
|
+
continue;
|
|
71
|
+
route ??= {};
|
|
72
|
+
route[parameter.name] = schema;
|
|
73
|
+
}
|
|
58
74
|
const query = this.mapping.explain(operation);
|
|
59
75
|
const introspection = {};
|
|
60
76
|
if (route !== null)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Endpoint.js","sourceRoot":"","sources":["../source/Endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AAOvC,MAAM,OAAO,QAAQ;IACF,QAAQ,CAAQ;IAChB,OAAO,CAAS;IAChB,SAAS,CAAiB;IACnC,MAAM,GAAkB,IAAI,CAAA;IAEpC,YAAoB,QAAgB,EAAE,OAAgB,EAAE,SAA0B;QAChF,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,I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;AAE7C,MAAM,SAAS,GAAG,IAAI,CAAA"}
|
package/transpiled/Factory.js
CHANGED
|
@@ -12,6 +12,8 @@ import { Composition } from './Composition.js';
|
|
|
12
12
|
import * as root from './root.js';
|
|
13
13
|
import { ATOM_GROUP } from './const.js';
|
|
14
14
|
import { Interception } from './Interception.js';
|
|
15
|
+
import { Dispatcher } from './RPC/index.js';
|
|
16
|
+
import { Server as Model } from './MCP/index.js';
|
|
15
17
|
import * as http from './HTTP/index.js';
|
|
16
18
|
export class Factory {
|
|
17
19
|
host;
|
|
@@ -44,7 +46,9 @@ export class Factory {
|
|
|
44
46
|
const interception = new Interception(interceptors, options);
|
|
45
47
|
const tree = new Tree(node, methods, directives);
|
|
46
48
|
const composition = new Composition(this.host);
|
|
47
|
-
const
|
|
49
|
+
const dispatcher = options.rpc === undefined ? null : new Dispatcher(options.rpc);
|
|
50
|
+
const mcp = options.mcp === undefined ? null : new Model(options.mcp, tree);
|
|
51
|
+
const gateway = new Gateway(broadcast, tree, interception, directives, dispatcher, mcp);
|
|
48
52
|
gateway.depends(remotes);
|
|
49
53
|
gateway.depends(composition);
|
|
50
54
|
// what the directives meter through; one atom per process, connected once
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Factory.js","sourceRoot":"","sources":["../source/Factory.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAsC,MAAM,UAAU,CAAA;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE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AC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAkB,CAAC,CAAA;AAC1F,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,WAAW;IAClB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,GAAG,CAAA;IAE/E,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;AACpD,CAAC"}
|
package/transpiled/Gateway.d.ts
CHANGED
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
import { type bindings, Connector } from '@toa.io/core';
|
|
2
2
|
import * as http from './HTTP/index.js';
|
|
3
3
|
import type { Interception } from './Interception.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { Dispatcher } from './RPC/index.js';
|
|
5
|
+
import type { Server } from './MCP/index.js';
|
|
6
|
+
import type { DirectiveFactory, Tree } from './RTD/index.js';
|
|
5
7
|
import type { Label } from './discovery.js';
|
|
6
8
|
export declare class Gateway extends Connector {
|
|
7
9
|
private readonly broadcast;
|
|
8
10
|
private readonly tree;
|
|
9
11
|
private readonly interceptor;
|
|
12
|
+
private readonly directives;
|
|
13
|
+
/** JSON-RPC is served only where the annotation asked for it. */
|
|
14
|
+
private readonly dispatcher;
|
|
15
|
+
/** And the same of MCP. */
|
|
16
|
+
private readonly mcp;
|
|
10
17
|
private readonly branches;
|
|
11
18
|
private lastMerge;
|
|
12
19
|
private widestGap;
|
|
13
20
|
private lastPing;
|
|
14
21
|
private stopped;
|
|
15
22
|
private resolveFirstMerge;
|
|
16
|
-
constructor(broadcast: Broadcast, tree: Tree, interception: Interception);
|
|
23
|
+
constructor(broadcast: Broadcast, tree: Tree, interception: Interception, directives: DirectiveFactory, dispatcher: Dispatcher | null, mcp: Server | null);
|
|
17
24
|
process(context: http.Context): Promise<http.OutgoingMessage>;
|
|
25
|
+
/**
|
|
26
|
+
* What answers the request: a pinned endpoint that makes calls of its own, or the route
|
|
27
|
+
* the path names.
|
|
28
|
+
*/
|
|
29
|
+
private endpoint;
|
|
30
|
+
/**
|
|
31
|
+
* One call: everything that needs a node. A request makes one of these, and a request
|
|
32
|
+
* that carries several calls makes one per call.
|
|
33
|
+
*/
|
|
34
|
+
private route;
|
|
18
35
|
protected open(): Promise<void>;
|
|
19
36
|
/**
|
|
20
37
|
* Both of these reach into components, and a dependency is torn down only once this has
|