effect 4.1.0 → 4.1.1
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/README.md +30 -0
- package/THIRD_PARTY_NOTICES.md +62 -0
- package/dist/BigDecimal.d.ts +139 -7
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +83 -14
- package/dist/BigDecimal.js.map +1 -1
- package/dist/Equal.d.ts +2 -2
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +3 -3
- package/dist/Equal.js.map +1 -1
- package/dist/Hash.d.ts +3 -2
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +5 -4
- package/dist/Hash.js.map +1 -1
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +11 -8
- package/dist/Iterable.js.map +1 -1
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +5 -1
- package/dist/Path.js.map +1 -1
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +2 -1
- package/dist/Pool.js.map +1 -1
- package/dist/Schema.d.ts +2 -1
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2 -1
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +4 -2
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +4 -2
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +2 -2
- package/dist/SchemaTransformation.js +2 -2
- package/dist/ai/McpClient.d.ts +171 -19
- package/dist/ai/McpClient.d.ts.map +1 -1
- package/dist/ai/McpClient.js +277 -66
- package/dist/ai/McpClient.js.map +1 -1
- package/dist/ai/McpSchema.d.ts +108 -0
- package/dist/ai/McpSchema.d.ts.map +1 -1
- package/dist/ai/McpSchema.js +99 -0
- package/dist/ai/McpSchema.js.map +1 -1
- package/dist/ai/McpServer.d.ts +120 -6
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +215 -34
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/Prompt.d.ts.map +1 -1
- package/dist/ai/Prompt.js +20 -11
- package/dist/ai/Prompt.js.map +1 -1
- package/dist/ai/Tool.d.ts.map +1 -1
- package/dist/ai/Tool.js +5 -7
- package/dist/ai/Tool.js.map +1 -1
- package/dist/ai/internal/mcpCore.js +72 -3
- package/dist/ai/internal/mcpCore.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js +42 -7
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
- package/dist/ai/internal/mcpProtocol.js +12 -0
- package/dist/ai/internal/mcpProtocol.js.map +1 -1
- package/dist/ai/internal/mcpRuntime.js +3 -3
- package/dist/ai/internal/mcpRuntime.js.map +1 -1
- package/dist/ai/internal/mcpSkills.d.ts +2 -0
- package/dist/ai/internal/mcpSkills.d.ts.map +1 -0
- package/dist/ai/internal/mcpSkills.js +428 -0
- package/dist/ai/internal/mcpSkills.js.map +1 -0
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +15 -5
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/Reply.d.ts +1 -1
- package/dist/cluster/Reply.d.ts.map +1 -1
- package/dist/cluster/Reply.js.map +1 -1
- package/dist/cluster/Sharding.d.ts.map +1 -1
- package/dist/cluster/Sharding.js +4 -1
- package/dist/cluster/Sharding.js.map +1 -1
- package/dist/cluster/internal/entityManager.js +15 -7
- package/dist/cluster/internal/entityManager.js.map +1 -1
- package/dist/crypto/Aead.d.ts +2 -1
- package/dist/crypto/Aead.d.ts.map +1 -1
- package/dist/crypto/Aead.js +2 -2
- package/dist/crypto/Aead.js.map +1 -1
- package/dist/crypto/Cipher.d.ts +2 -1
- package/dist/crypto/Cipher.d.ts.map +1 -1
- package/dist/crypto/Cipher.js +2 -2
- package/dist/crypto/Cipher.js.map +1 -1
- package/dist/crypto/KeyAgreement.d.ts +3 -2
- package/dist/crypto/KeyAgreement.d.ts.map +1 -1
- package/dist/crypto/KeyAgreement.js +2 -2
- package/dist/crypto/KeyAgreement.js.map +1 -1
- package/dist/crypto/KeyFormat.d.ts +33 -1
- package/dist/crypto/KeyFormat.d.ts.map +1 -1
- package/dist/crypto/KeyFormat.js.map +1 -1
- package/dist/crypto/KeyWrap.d.ts +4 -3
- package/dist/crypto/KeyWrap.d.ts.map +1 -1
- package/dist/crypto/KeyWrap.js +2 -2
- package/dist/crypto/KeyWrap.js.map +1 -1
- package/dist/crypto/Mac.d.ts +2 -1
- package/dist/crypto/Mac.d.ts.map +1 -1
- package/dist/crypto/Mac.js +2 -2
- package/dist/crypto/Mac.js.map +1 -1
- package/dist/crypto/Signature.d.ts +3 -2
- package/dist/crypto/Signature.d.ts.map +1 -1
- package/dist/crypto/Signature.js +2 -2
- package/dist/crypto/Signature.js.map +1 -1
- package/dist/crypto/WebCrypto.d.ts +19 -0
- package/dist/crypto/WebCrypto.d.ts.map +1 -1
- package/dist/crypto/WebCrypto.js.map +1 -1
- package/dist/crypto/internal/asymmetric.js.map +1 -1
- package/dist/crypto/internal/key.js +3 -2
- package/dist/crypto/internal/key.js.map +1 -1
- package/dist/encoding/Base64Url.d.ts.map +1 -1
- package/dist/encoding/Base64Url.js +26 -3
- package/dist/encoding/Base64Url.js.map +1 -1
- package/dist/encoding/Ndjson.d.ts +5 -4
- package/dist/encoding/Ndjson.d.ts.map +1 -1
- package/dist/encoding/Ndjson.js +6 -5
- package/dist/encoding/Ndjson.js.map +1 -1
- package/dist/encoding/Sse.d.ts +3 -1
- package/dist/encoding/Sse.d.ts.map +1 -1
- package/dist/encoding/Sse.js +5 -3
- package/dist/encoding/Sse.js.map +1 -1
- package/dist/eventlog/EventLog.d.ts +7 -0
- package/dist/eventlog/EventLog.d.ts.map +1 -1
- package/dist/eventlog/EventLog.js +7 -0
- package/dist/eventlog/EventLog.js.map +1 -1
- package/dist/eventlog/EventLogServer.d.ts +7 -1
- package/dist/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/eventlog/EventLogServer.js +27 -12
- package/dist/eventlog/EventLogServer.js.map +1 -1
- package/dist/eventlog/EventLogServerEncrypted.d.ts +10 -0
- package/dist/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/eventlog/EventLogServerUnencrypted.d.ts +17 -0
- package/dist/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/eventlog/EventLogServerUnencrypted.js +14 -2
- package/dist/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/eventlog/EventLogSessionAuth.d.ts +21 -0
- package/dist/eventlog/EventLogSessionAuth.d.ts.map +1 -1
- package/dist/eventlog/EventLogSessionAuth.js +22 -0
- package/dist/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/graphql/GraphQLClient.d.ts +3 -1
- package/dist/graphql/GraphQLClient.d.ts.map +1 -1
- package/dist/graphql/GraphQLClient.js.map +1 -1
- package/dist/graphql/GraphQLClientError.d.ts +14 -9
- package/dist/graphql/GraphQLClientError.d.ts.map +1 -1
- package/dist/graphql/GraphQLClientError.js +14 -21
- package/dist/graphql/GraphQLClientError.js.map +1 -1
- package/dist/graphql/GraphQLProtocol.d.ts +12 -3
- package/dist/graphql/GraphQLProtocol.d.ts.map +1 -1
- package/dist/graphql/GraphQLProtocol.js +4 -1
- package/dist/graphql/GraphQLProtocol.js.map +1 -1
- package/dist/http/HttpClient.d.ts +189 -7
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +75 -2
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/http/HttpServerRequest.js +38 -22
- package/dist/http/HttpServerRequest.js.map +1 -1
- package/dist/http/internal/mimeTypes.d.ts +4 -1
- package/dist/http/internal/mimeTypes.d.ts.map +1 -1
- package/dist/http/internal/mimeTypes.js +4 -1
- package/dist/http/internal/mimeTypes.js.map +1 -1
- package/dist/http-api/HttpApiSchema.js +1 -1
- package/dist/http-api/HttpApiSchema.js.map +1 -1
- package/dist/internal/dateTime.js +49 -24
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +10 -0
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/glob.js +234 -56
- package/dist/internal/glob.js.map +1 -1
- package/dist/internal/graphql.js +21 -7
- package/dist/internal/graphql.js.map +1 -1
- package/dist/internal/graphqlHeaders.d.ts +7 -0
- package/dist/internal/graphqlHeaders.d.ts.map +1 -1
- package/dist/internal/graphqlHeaders.js +11 -0
- package/dist/internal/graphqlHeaders.js.map +1 -1
- package/dist/internal/request.js +29 -42
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +7 -8
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/version.js +1 -1
- package/dist/jose/JoseError.d.ts +285 -0
- package/dist/jose/JoseError.d.ts.map +1 -0
- package/dist/jose/JoseError.js +269 -0
- package/dist/jose/JoseError.js.map +1 -0
- package/dist/jose/Jwe.d.ts +128 -0
- package/dist/jose/Jwe.d.ts.map +1 -0
- package/dist/jose/Jwe.js +134 -0
- package/dist/jose/Jwe.js.map +1 -0
- package/dist/jose/Jwk.d.ts +597 -0
- package/dist/jose/Jwk.d.ts.map +1 -0
- package/dist/jose/Jwk.js +503 -0
- package/dist/jose/Jwk.js.map +1 -0
- package/dist/jose/Jwks.d.ts +236 -0
- package/dist/jose/Jwks.d.ts.map +1 -0
- package/dist/jose/Jwks.js +306 -0
- package/dist/jose/Jwks.js.map +1 -0
- package/dist/jose/Jws.d.ts +177 -0
- package/dist/jose/Jws.d.ts.map +1 -0
- package/dist/jose/Jws.js +183 -0
- package/dist/jose/Jws.js.map +1 -0
- package/dist/jose/Jwt.d.ts +270 -0
- package/dist/jose/Jwt.d.ts.map +1 -0
- package/dist/jose/Jwt.js +293 -0
- package/dist/jose/Jwt.js.map +1 -0
- package/dist/jose/index.d.ts +51 -0
- package/dist/jose/index.d.ts.map +1 -0
- package/dist/jose/index.js +52 -0
- package/dist/jose/index.js.map +1 -0
- package/dist/jose/internal/compact.d.ts +2 -0
- package/dist/jose/internal/compact.d.ts.map +1 -0
- package/dist/jose/internal/compact.js +179 -0
- package/dist/jose/internal/compact.js.map +1 -0
- package/dist/net/Host.d.ts.map +1 -1
- package/dist/net/Host.js +5 -10
- package/dist/net/Host.js.map +1 -1
- package/dist/observability/OtlpSerialization.d.ts +1 -1
- package/dist/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/observability/OtlpSerialization.js +10 -4
- package/dist/observability/OtlpSerialization.js.map +1 -1
- package/dist/observability/internal/otlpProtobuf.js +3 -3
- package/dist/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/observability/internal/protobuf.js +6 -0
- package/dist/observability/internal/protobuf.js.map +1 -1
- package/dist/persistence/CircuitBreaker.d.ts +98 -38
- package/dist/persistence/CircuitBreaker.d.ts.map +1 -1
- package/dist/persistence/CircuitBreaker.js +67 -29
- package/dist/persistence/CircuitBreaker.js.map +1 -1
- package/dist/persistence/RateLimiter.d.ts +8 -0
- package/dist/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/persistence/RateLimiter.js +63 -12
- package/dist/persistence/RateLimiter.js.map +1 -1
- package/dist/persistence/index.d.ts +1 -1
- package/dist/persistence/index.js +1 -1
- package/dist/reactivity/AtomRegistry.js +17 -7
- package/dist/reactivity/AtomRegistry.js.map +1 -1
- package/dist/rpc/Rpc.d.ts +1 -1
- package/dist/rpc/Rpc.d.ts.map +1 -1
- package/dist/rpc/Rpc.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts +14 -2
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +38 -21
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcMessage.d.ts +3 -2
- package/dist/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/rpc/RpcMessage.js.map +1 -1
- package/dist/sql/Migrator.d.ts +9 -1
- package/dist/sql/Migrator.d.ts.map +1 -1
- package/dist/sql/Migrator.js +18 -6
- package/dist/sql/Migrator.js.map +1 -1
- package/dist/sql/SqlClient.d.ts +38 -3
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +4 -3
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/sql/Statement.d.ts +41 -3
- package/dist/sql/Statement.d.ts.map +1 -1
- package/dist/sql/Statement.js +24 -20
- package/dist/sql/Statement.js.map +1 -1
- package/dist/workflow/Workflow.d.ts +4 -0
- package/dist/workflow/Workflow.d.ts.map +1 -1
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +5 -0
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +5 -1
- package/src/BigDecimal.ts +170 -16
- package/src/Equal.ts +3 -3
- package/src/Hash.ts +5 -4
- package/src/Iterable.ts +8 -5
- package/src/Path.ts +6 -1
- package/src/Pool.ts +2 -1
- package/src/Schema.ts +3 -2
- package/src/SchemaRepresentation.ts +4 -2
- package/src/SchemaTransformation.ts +2 -2
- package/src/ai/McpClient.ts +488 -91
- package/src/ai/McpSchema.ts +119 -0
- package/src/ai/McpServer.ts +261 -38
- package/src/ai/Prompt.ts +16 -11
- package/src/ai/Tool.ts +5 -10
- package/src/ai/internal/mcpCore.ts +165 -12
- package/src/ai/internal/mcpProtocol/v2024_11_05.ts +3 -1
- package/src/ai/internal/mcpProtocol/v2025_03_26.ts +3 -1
- package/src/ai/internal/mcpProtocol/v2025_06_18.ts +3 -1
- package/src/ai/internal/mcpProtocol/v2025_11_25.ts +3 -1
- package/src/ai/internal/mcpProtocol/v2026_07_28.ts +41 -7
- package/src/ai/internal/mcpProtocol.ts +15 -0
- package/src/ai/internal/mcpRuntime.ts +6 -3
- package/src/ai/internal/mcpSkills.ts +480 -0
- package/src/cluster/ClusterWorkflowEngine.ts +22 -8
- package/src/cluster/Reply.ts +1 -1
- package/src/cluster/Sharding.ts +4 -1
- package/src/cluster/internal/entityManager.ts +24 -10
- package/src/crypto/Aead.ts +3 -3
- package/src/crypto/Cipher.ts +3 -3
- package/src/crypto/KeyAgreement.ts +4 -4
- package/src/crypto/KeyFormat.ts +30 -1
- package/src/crypto/KeyWrap.ts +6 -6
- package/src/crypto/Mac.ts +3 -3
- package/src/crypto/Signature.ts +4 -4
- package/src/crypto/WebCrypto.ts +20 -0
- package/src/crypto/internal/asymmetric.ts +2 -1
- package/src/crypto/internal/key.ts +12 -5
- package/src/encoding/Base64Url.ts +27 -3
- package/src/encoding/Ndjson.ts +6 -5
- package/src/encoding/Sse.ts +5 -3
- package/src/eventlog/EventLog.ts +7 -0
- package/src/eventlog/EventLogServer.ts +31 -12
- package/src/eventlog/EventLogServerEncrypted.ts +5 -0
- package/src/eventlog/EventLogServerUnencrypted.ts +19 -2
- package/src/eventlog/EventLogSessionAuth.ts +26 -0
- package/src/graphql/GraphQLClient.ts +3 -1
- package/src/graphql/GraphQLClientError.ts +15 -22
- package/src/graphql/GraphQLProtocol.ts +12 -3
- package/src/http/HttpClient.ts +210 -11
- package/src/http/HttpServerRequest.ts +61 -23
- package/src/http/internal/mimeTypes.ts +4 -1
- package/src/http-api/HttpApiSchema.ts +1 -1
- package/src/internal/dateTime.ts +54 -24
- package/src/internal/effect.ts +6 -0
- package/src/internal/glob.ts +279 -63
- package/src/internal/graphql.ts +27 -9
- package/src/internal/graphqlHeaders.ts +13 -0
- package/src/internal/request.ts +51 -58
- package/src/internal/schema/fromJsonSchemaDocument.ts +11 -10
- package/src/internal/version.ts +1 -1
- package/src/jose/JoseError.ts +329 -0
- package/src/jose/Jwe.ts +196 -0
- package/src/jose/Jwk.ts +777 -0
- package/src/jose/Jwks.ts +418 -0
- package/src/jose/Jws.ts +312 -0
- package/src/jose/Jwt.ts +493 -0
- package/src/jose/index.ts +58 -0
- package/src/jose/internal/compact.ts +195 -0
- package/src/net/Host.ts +5 -10
- package/src/observability/OtlpSerialization.ts +13 -5
- package/src/observability/internal/otlpProtobuf.ts +6 -6
- package/src/observability/internal/protobuf.ts +10 -0
- package/src/persistence/CircuitBreaker.ts +113 -48
- package/src/persistence/RateLimiter.ts +84 -15
- package/src/persistence/index.ts +1 -1
- package/src/reactivity/AtomRegistry.ts +19 -8
- package/src/rpc/Rpc.ts +3 -1
- package/src/rpc/RpcClient.ts +44 -24
- package/src/rpc/RpcMessage.ts +3 -2
- package/src/sql/Migrator.ts +35 -18
- package/src/sql/SqlClient.ts +43 -8
- package/src/sql/Statement.ts +52 -22
- package/src/workflow/Workflow.ts +4 -0
- package/src/workflow/WorkflowEngine.ts +5 -0
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as Arr from "../../Array.ts"
|
|
8
|
+
import * as Cause from "../../Cause.ts"
|
|
8
9
|
import * as Data from "../../Data.ts"
|
|
9
10
|
import * as Effect from "../../Effect.ts"
|
|
10
11
|
import type * as McpProtocol from "../McpProtocol.ts"
|
|
@@ -247,7 +248,8 @@ export interface ResourceTemplateRegistration {
|
|
|
247
248
|
* @internal
|
|
248
249
|
*/
|
|
249
250
|
export interface Resources {
|
|
250
|
-
|
|
251
|
+
// Synchronous, so a caller can check skill ownership and register in one step.
|
|
252
|
+
readonly register: (registration: ResourceRegistration) => void
|
|
251
253
|
readonly registerTemplate: (registration: ResourceTemplateRegistration) => Effect.Effect<void>
|
|
252
254
|
readonly list: (
|
|
253
255
|
invocation: McpInvocation
|
|
@@ -264,6 +266,91 @@ export interface Resources {
|
|
|
264
266
|
>
|
|
265
267
|
}
|
|
266
268
|
|
|
269
|
+
/**
|
|
270
|
+
* A file of a skill, with the digest and size of the bytes it is served as.
|
|
271
|
+
*
|
|
272
|
+
* @internal
|
|
273
|
+
*/
|
|
274
|
+
export interface SkillResource {
|
|
275
|
+
readonly uri: string
|
|
276
|
+
readonly digest: string
|
|
277
|
+
readonly size: number
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* A `skills/list` and `skills/get` entry. `resources` is `"dynamic"` for a
|
|
282
|
+
* skill whose content cannot carry stable digests.
|
|
283
|
+
*
|
|
284
|
+
* @internal
|
|
285
|
+
*/
|
|
286
|
+
export interface Skill {
|
|
287
|
+
readonly uri: string
|
|
288
|
+
readonly frontmatter: Readonly<Record<string, unknown>>
|
|
289
|
+
readonly resources: ReadonlyArray<SkillResource> | "dynamic"
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* A `resources/directory/read` child: a file, with the metadata
|
|
294
|
+
* `resources/list` gives it, or a subdirectory with the `inode/directory` MIME
|
|
295
|
+
* type.
|
|
296
|
+
*
|
|
297
|
+
* @internal
|
|
298
|
+
*/
|
|
299
|
+
export interface DirectoryChild {
|
|
300
|
+
readonly uri: string
|
|
301
|
+
readonly name: string
|
|
302
|
+
readonly description?: string | undefined
|
|
303
|
+
readonly mimeType: string
|
|
304
|
+
readonly size?: number | undefined
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* @internal
|
|
309
|
+
*/
|
|
310
|
+
export class SkillNotFound extends Data.TaggedError("SkillNotFound")<{
|
|
311
|
+
readonly uri: string
|
|
312
|
+
}> {}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* @internal
|
|
316
|
+
*/
|
|
317
|
+
export class DirectoryNotFound extends Data.TaggedError("DirectoryNotFound")<{
|
|
318
|
+
readonly uri: string
|
|
319
|
+
}> {}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* @internal
|
|
323
|
+
*/
|
|
324
|
+
export interface SkillRegistration {
|
|
325
|
+
readonly entry: Skill
|
|
326
|
+
readonly isVisible: (profile: NegotiatedProtocolProfile<string>) => boolean
|
|
327
|
+
readonly visible?: Visible | undefined
|
|
328
|
+
// Hides the skill's directories on `resources/directory/read`.
|
|
329
|
+
readonly visibleInDirectories?: Visible | undefined
|
|
330
|
+
readonly get: (invocation: McpInvocation) => Effect.Effect<Skill, SkillNotFound | RequestRejected>
|
|
331
|
+
// `undefined` when this skill has no directory at `uri`. Directories shared
|
|
332
|
+
// by several skills, such as a common path prefix, list the union of what
|
|
333
|
+
// each skill returns.
|
|
334
|
+
readonly directory: (uri: string) => ReadonlyArray<DirectoryChild> | undefined
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* @internal
|
|
339
|
+
*/
|
|
340
|
+
export interface Skills {
|
|
341
|
+
// Fails when the skill's directory overlaps another skill's, or one of its
|
|
342
|
+
// files is already registered as a resource.
|
|
343
|
+
readonly register: (registration: SkillRegistration) => Effect.Effect<void, Cause.IllegalArgumentError>
|
|
344
|
+
// Whether `uri` is a file of a registered skill, which only that skill may serve.
|
|
345
|
+
readonly ownsFile: (uri: string) => boolean
|
|
346
|
+
readonly list: (invocation: McpInvocation) => Effect.Effect<ReadonlyArray<Skill>, RequestRejected>
|
|
347
|
+
readonly get: (uri: string, invocation: McpInvocation) => Effect.Effect<Skill, SkillNotFound | RequestRejected>
|
|
348
|
+
readonly readDirectory: (
|
|
349
|
+
uri: string,
|
|
350
|
+
invocation: McpInvocation
|
|
351
|
+
) => Effect.Effect<ReadonlyArray<DirectoryChild>, DirectoryNotFound | RequestRejected>
|
|
352
|
+
}
|
|
353
|
+
|
|
267
354
|
/**
|
|
268
355
|
* @internal
|
|
269
356
|
*/
|
|
@@ -423,10 +510,12 @@ export interface McpCore {
|
|
|
423
510
|
readonly resources: Resources
|
|
424
511
|
readonly prompts: Prompts
|
|
425
512
|
readonly completions: Completions
|
|
513
|
+
readonly skills: Skills
|
|
426
514
|
readonly registrationPresence: Effect.Effect<{
|
|
427
515
|
readonly tools: boolean
|
|
428
516
|
readonly resources: boolean
|
|
429
517
|
readonly prompts: boolean
|
|
518
|
+
readonly skills: boolean
|
|
430
519
|
}>
|
|
431
520
|
}
|
|
432
521
|
|
|
@@ -438,6 +527,13 @@ export interface McpCore {
|
|
|
438
527
|
*/
|
|
439
528
|
export type Visible = (invocation: McpInvocation) => Effect.Effect<boolean, RequestRejected>
|
|
440
529
|
|
|
530
|
+
// Whether one skill directory contains the other, or both are the same.
|
|
531
|
+
const skillsOverlap = (a: string, b: string): boolean => {
|
|
532
|
+
const rootA = a.slice(0, -"/SKILL.md".length)
|
|
533
|
+
const rootB = b.slice(0, -"/SKILL.md".length)
|
|
534
|
+
return rootA === rootB || rootA.startsWith(`${rootB}/`) || rootB.startsWith(`${rootA}/`)
|
|
535
|
+
}
|
|
536
|
+
|
|
441
537
|
/**
|
|
442
538
|
* @internal
|
|
443
539
|
*/
|
|
@@ -446,6 +542,8 @@ export const make: Effect.Effect<McpCore> = Effect.sync(() => {
|
|
|
446
542
|
const resourceRegistrations: Array<ResourceRegistration> = []
|
|
447
543
|
const resourceTemplateRegistrations: Array<ResourceTemplateRegistration> = []
|
|
448
544
|
const promptRegistrations = new Map<string, PromptRegistration>()
|
|
545
|
+
const skillRegistrations = new Map<string, SkillRegistration>()
|
|
546
|
+
const skillFiles = new Set<string>()
|
|
449
547
|
const completionRegistrations = new Map<
|
|
450
548
|
string,
|
|
451
549
|
(
|
|
@@ -494,15 +592,14 @@ export const make: Effect.Effect<McpCore> = Effect.sync(() => {
|
|
|
494
592
|
}
|
|
495
593
|
|
|
496
594
|
const resources: Resources = {
|
|
497
|
-
register: (registration) =>
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
}),
|
|
595
|
+
register: (registration) => {
|
|
596
|
+
const index = resourceRegistrations.findIndex((entry) => entry.descriptor.uri === registration.descriptor.uri)
|
|
597
|
+
if (index === -1) {
|
|
598
|
+
resourceRegistrations.push(registration)
|
|
599
|
+
} else {
|
|
600
|
+
resourceRegistrations[index] = registration
|
|
601
|
+
}
|
|
602
|
+
},
|
|
506
603
|
registerTemplate: (registration) =>
|
|
507
604
|
Effect.sync(() => {
|
|
508
605
|
const index = resourceTemplateRegistrations.findIndex(
|
|
@@ -569,11 +666,67 @@ export const make: Effect.Effect<McpCore> = Effect.sync(() => {
|
|
|
569
666
|
})
|
|
570
667
|
}
|
|
571
668
|
|
|
669
|
+
const skills: Skills = {
|
|
670
|
+
register: (registration) =>
|
|
671
|
+
Effect.suspend(() => {
|
|
672
|
+
const { uri, resources } = registration.entry
|
|
673
|
+
const fail = (reason: string) => Effect.fail(new Cause.IllegalArgumentError(`Skill ${uri}: ${reason}`))
|
|
674
|
+
for (const other of skillRegistrations.keys()) {
|
|
675
|
+
if (skillsOverlap(uri, other)) return fail(`its directory overlaps the skill ${other}`)
|
|
676
|
+
}
|
|
677
|
+
const files = resources === "dynamic" ? [] : resources.map((resource) => resource.uri)
|
|
678
|
+
for (const file of files) {
|
|
679
|
+
if (resourceRegistrations.some((entry) => entry.descriptor.uri === file)) {
|
|
680
|
+
return fail(`${file} is already registered as a resource`)
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
skillRegistrations.set(uri, registration)
|
|
684
|
+
for (const file of files) skillFiles.add(file)
|
|
685
|
+
return Effect.void
|
|
686
|
+
}),
|
|
687
|
+
ownsFile: (uri) => skillFiles.has(uri),
|
|
688
|
+
list: (invocation) =>
|
|
689
|
+
filterList(
|
|
690
|
+
Array.from(skillRegistrations.values(), (registration) => ({
|
|
691
|
+
descriptor: registration.entry,
|
|
692
|
+
isVisible: registration.isVisible,
|
|
693
|
+
visible: registration.visible
|
|
694
|
+
})),
|
|
695
|
+
invocation
|
|
696
|
+
),
|
|
697
|
+
get: (uri, invocation) =>
|
|
698
|
+
Effect.suspend(() => {
|
|
699
|
+
const registration = skillRegistrations.get(uri)
|
|
700
|
+
return registration !== undefined && registration.isVisible(invocation.protocol)
|
|
701
|
+
? registration.get(invocation)
|
|
702
|
+
: Effect.fail(new SkillNotFound({ uri }))
|
|
703
|
+
}),
|
|
704
|
+
readDirectory: Effect.fnUntraced(function*(uri, invocation) {
|
|
705
|
+
const children = new Map<string, DirectoryChild>()
|
|
706
|
+
let found = false
|
|
707
|
+
for (const registration of skillRegistrations.values()) {
|
|
708
|
+
const own = registration.directory(uri)
|
|
709
|
+
if (own === undefined || !registration.isVisible(invocation.protocol)) continue
|
|
710
|
+
if (
|
|
711
|
+
registration.visibleInDirectories !== undefined &&
|
|
712
|
+
!(yield* registration.visibleInDirectories(invocation))
|
|
713
|
+
) continue
|
|
714
|
+
found = true
|
|
715
|
+
for (const child of own) children.set(child.uri, child)
|
|
716
|
+
}
|
|
717
|
+
if (!found) {
|
|
718
|
+
return yield* new DirectoryNotFound({ uri })
|
|
719
|
+
}
|
|
720
|
+
return Array.from(children.values()).sort((a, b) => a.uri < b.uri ? -1 : a.uri > b.uri ? 1 : 0)
|
|
721
|
+
})
|
|
722
|
+
}
|
|
723
|
+
|
|
572
724
|
const registrationPresence = Effect.sync(() => ({
|
|
573
725
|
tools: registrations.size > 0,
|
|
574
726
|
resources: resourceRegistrations.length > 0 || resourceTemplateRegistrations.length > 0,
|
|
575
|
-
prompts: promptRegistrations.size > 0
|
|
727
|
+
prompts: promptRegistrations.size > 0,
|
|
728
|
+
skills: skillRegistrations.size > 0
|
|
576
729
|
}))
|
|
577
730
|
|
|
578
|
-
return { tools, resources, prompts, completions, registrationPresence }
|
|
731
|
+
return { tools, resources, prompts, completions, skills, registrationPresence }
|
|
579
732
|
})
|
|
@@ -10,9 +10,10 @@ import * as McpCore from "../mcpCore.ts"
|
|
|
10
10
|
import * as McpProtocol from "../mcpProtocol.ts"
|
|
11
11
|
import * as McpRuntime from "../mcpRuntime.ts"
|
|
12
12
|
import * as McpSchema from "../mcpSchema/v2024_11_05.ts"
|
|
13
|
+
import * as McpSkills from "../mcpSkills.ts"
|
|
13
14
|
|
|
14
15
|
// Pings can arrive before initialize and do not require a client session.
|
|
15
|
-
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").middleware(
|
|
16
|
+
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").merge(McpSkills.LegacyRpcs).middleware(
|
|
16
17
|
PublicMcpSchema.McpServerClientMiddleware
|
|
17
18
|
).add(McpSchema.Ping)
|
|
18
19
|
|
|
@@ -124,6 +125,7 @@ export const protocol = McpProtocol.make({
|
|
|
124
125
|
handlerRpcs: AdapterRpcs,
|
|
125
126
|
makeHandlers: (core, lifecycle) =>
|
|
126
127
|
AdapterRpcs.of({
|
|
128
|
+
...McpSkills.legacyHandlers(core),
|
|
127
129
|
initialize: (request, { client }) =>
|
|
128
130
|
lifecycle.initialize(McpSchema.protocolVersion, profileFromInitialize(request), client.id).pipe(
|
|
129
131
|
Effect.map((result) =>
|
|
@@ -10,9 +10,10 @@ import * as McpCore from "../mcpCore.ts"
|
|
|
10
10
|
import * as McpProtocol from "../mcpProtocol.ts"
|
|
11
11
|
import * as McpRuntime from "../mcpRuntime.ts"
|
|
12
12
|
import * as McpSchema from "../mcpSchema/v2025_03_26.ts"
|
|
13
|
+
import * as McpSkills from "../mcpSkills.ts"
|
|
13
14
|
|
|
14
15
|
// Pings can arrive before initialize and do not require a client session.
|
|
15
|
-
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").middleware(
|
|
16
|
+
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").merge(McpSkills.LegacyRpcs).middleware(
|
|
16
17
|
PublicMcpSchema.McpServerClientMiddleware
|
|
17
18
|
).add(McpSchema.Ping)
|
|
18
19
|
|
|
@@ -127,6 +128,7 @@ export const protocol = McpProtocol.make({
|
|
|
127
128
|
handlerRpcs: AdapterRpcs,
|
|
128
129
|
makeHandlers: (core, lifecycle) =>
|
|
129
130
|
AdapterRpcs.of({
|
|
131
|
+
...McpSkills.legacyHandlers(core),
|
|
130
132
|
initialize: (request, { client }) =>
|
|
131
133
|
lifecycle.initialize(McpSchema.protocolVersion, profileFromInitialize(request), client.id).pipe(
|
|
132
134
|
Effect.map((result) =>
|
|
@@ -9,9 +9,10 @@ import * as McpCore from "../mcpCore.ts"
|
|
|
9
9
|
import * as McpProtocol from "../mcpProtocol.ts"
|
|
10
10
|
import * as McpRuntime from "../mcpRuntime.ts"
|
|
11
11
|
import * as McpSchema from "../mcpSchema/v2025_06_18.ts"
|
|
12
|
+
import * as McpSkills from "../mcpSkills.ts"
|
|
12
13
|
|
|
13
14
|
// Pings can arrive before initialize and do not require a client session.
|
|
14
|
-
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").middleware(
|
|
15
|
+
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").merge(McpSkills.LegacyRpcs).middleware(
|
|
15
16
|
PublicMcpSchema.McpServerClientMiddleware
|
|
16
17
|
).add(McpSchema.Ping)
|
|
17
18
|
|
|
@@ -143,6 +144,7 @@ export const protocol = McpProtocol.make({
|
|
|
143
144
|
handlerRpcs: AdapterRpcs,
|
|
144
145
|
makeHandlers: (core, lifecycle) =>
|
|
145
146
|
AdapterRpcs.of({
|
|
147
|
+
...McpSkills.legacyHandlers(core),
|
|
146
148
|
initialize: (request, { client }) =>
|
|
147
149
|
lifecycle.initialize(McpSchema.protocolVersion, profileFromInitialize(request), client.id).pipe(
|
|
148
150
|
Effect.map((result) =>
|
|
@@ -8,9 +8,10 @@ import * as McpCore from "../mcpCore.ts"
|
|
|
8
8
|
import * as McpProtocol from "../mcpProtocol.ts"
|
|
9
9
|
import * as McpRuntime from "../mcpRuntime.ts"
|
|
10
10
|
import * as McpSchema from "../mcpSchema/v2025_11_25.ts"
|
|
11
|
+
import * as McpSkills from "../mcpSkills.ts"
|
|
11
12
|
|
|
12
13
|
// Pings can arrive before initialize and do not require a client session.
|
|
13
|
-
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").middleware(
|
|
14
|
+
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").merge(McpSkills.LegacyRpcs).middleware(
|
|
14
15
|
PublicMcpSchema.McpServerClientMiddleware
|
|
15
16
|
).add(McpSchema.Ping)
|
|
16
17
|
|
|
@@ -133,6 +134,7 @@ export const protocol = McpProtocol.make({
|
|
|
133
134
|
handlerRpcs: AdapterRpcs,
|
|
134
135
|
makeHandlers: (core, lifecycle) =>
|
|
135
136
|
AdapterRpcs.of({
|
|
137
|
+
...McpSkills.legacyHandlers(core),
|
|
136
138
|
initialize: (request, { client }) =>
|
|
137
139
|
lifecycle.initialize(McpSchema.protocolVersion, {
|
|
138
140
|
protocolVersion: McpSchema.protocolVersion,
|
|
@@ -25,6 +25,7 @@ import * as PublicMcpSchema from "../../McpSchema.ts"
|
|
|
25
25
|
import * as McpCore from "../mcpCore.ts"
|
|
26
26
|
import * as McpProtocol from "../mcpProtocol.ts"
|
|
27
27
|
import * as McpSchema from "../mcpSchema/v2026_07_28.ts"
|
|
28
|
+
import * as McpSkills from "../mcpSkills.ts"
|
|
28
29
|
|
|
29
30
|
const InputResponses = Schema.Record(Schema.String, Schema.Record(Schema.String, Schema.Unknown))
|
|
30
31
|
const decodeRequestMetadata = Schema.decodeUnknownEffect(McpSchema.RequestMetaObject)
|
|
@@ -202,9 +203,10 @@ const projectContent = Match.type<PublicMcpSchema.ContentBlock>().pipe(
|
|
|
202
203
|
Match.exhaustive
|
|
203
204
|
)
|
|
204
205
|
|
|
205
|
-
const projectResource = (resource: PublicMcpSchema.Resource) =>
|
|
206
|
+
const projectResource = (resource: PublicMcpSchema.Resource) =>
|
|
207
|
+
McpProtocol.transcode(PublicMcpSchema.Resource, McpSchema.Resource, resource)
|
|
206
208
|
const projectResourceTemplate = (resourceTemplate: PublicMcpSchema.ResourceTemplate) =>
|
|
207
|
-
McpSchema.ResourceTemplate
|
|
209
|
+
McpProtocol.transcode(PublicMcpSchema.ResourceTemplate, McpSchema.ResourceTemplate, resourceTemplate)
|
|
208
210
|
|
|
209
211
|
const projectPrompt = (prompt: PublicMcpSchema.Prompt) =>
|
|
210
212
|
McpProtocol.transcode(PublicMcpSchema.Prompt, McpSchema.Prompt, prompt)
|
|
@@ -231,6 +233,8 @@ const projectCompleteResult = Effect.fnUntraced(function*(
|
|
|
231
233
|
type ProtocolError =
|
|
232
234
|
| McpCore.ResourceNotFound
|
|
233
235
|
| McpCore.PromptNotFound
|
|
236
|
+
| McpCore.SkillNotFound
|
|
237
|
+
| McpCore.DirectoryNotFound
|
|
234
238
|
| McpCore.ToolError
|
|
235
239
|
| McpCore.UnsupportedByProtocol
|
|
236
240
|
| McpProtocol.ProtocolError
|
|
@@ -297,7 +301,7 @@ const unsupported = (
|
|
|
297
301
|
/**
|
|
298
302
|
* @internal
|
|
299
303
|
*/
|
|
300
|
-
export const handlerRpcs = McpSchema.ClientRequestRpcs.merge(McpSchema.ClientNotificationRpcs)
|
|
304
|
+
export const handlerRpcs = McpSchema.ClientRequestRpcs.merge(McpSchema.ClientNotificationRpcs, McpSkills.StatelessRpcs)
|
|
301
305
|
|
|
302
306
|
/**
|
|
303
307
|
* @internal
|
|
@@ -320,6 +324,9 @@ export const makeHandlers = (
|
|
|
320
324
|
]))
|
|
321
325
|
const decodeCompleteResult = Schema.decodeUnknownEffect(McpSchema.CompleteResult)
|
|
322
326
|
const decodeListToolsResult = Schema.decodeUnknownEffect(McpSchema.ListToolsResult)
|
|
327
|
+
const decodeListSkillsResult = Schema.decodeUnknownEffect(McpSkills.ListSkillsResult)
|
|
328
|
+
const decodeGetSkillResult = Schema.decodeUnknownEffect(McpSkills.GetSkillResult)
|
|
329
|
+
const decodeReadResourceDirectoryResult = Schema.decodeUnknownEffect(McpSkills.ReadResourceDirectoryResult)
|
|
323
330
|
const sendNotification = context.sendNotification
|
|
324
331
|
const supportsSubscriptions = sendNotification !== undefined
|
|
325
332
|
// Older adapters accept arbitrary JSON; this binding requires extension settings objects.
|
|
@@ -334,7 +341,8 @@ export const makeHandlers = (
|
|
|
334
341
|
}
|
|
335
342
|
const getDiscovery = Effect.map(context.registrationPresence, (presence) => {
|
|
336
343
|
const capabilities: Types.Mutable<typeof McpSchema.ServerCapabilities.Type> = { completions: {}, logging: {} }
|
|
337
|
-
|
|
344
|
+
const declared = McpSkills.declareExtension(extensions, presence.skills)
|
|
345
|
+
if (declared !== undefined) capabilities.extensions = declared
|
|
338
346
|
if (presence.tools) capabilities.tools = { listChanged: supportsSubscriptions }
|
|
339
347
|
if (presence.resources) {
|
|
340
348
|
capabilities.resources = { listChanged: supportsSubscriptions, subscribe: supportsSubscriptions }
|
|
@@ -342,6 +350,10 @@ export const makeHandlers = (
|
|
|
342
350
|
if (presence.prompts) capabilities.prompts = { listChanged: supportsSubscriptions }
|
|
343
351
|
return { supportedVersions: context.supportedVersions, capabilities, serverInfo: context.serverInfo }
|
|
344
352
|
})
|
|
353
|
+
const requireSkills = (method: string) =>
|
|
354
|
+
McpSkills.requireSkills(core, method).pipe(
|
|
355
|
+
Effect.catch((error) => failWithHttpStatus(404, error))
|
|
356
|
+
)
|
|
345
357
|
const getInvocation = PublicMcpSchema.McpRequestContext.useSync(
|
|
346
358
|
McpProtocol.invocationFromRequestContext
|
|
347
359
|
)
|
|
@@ -502,7 +514,7 @@ export const makeHandlers = (
|
|
|
502
514
|
const resources = yield* core.resources.list(invocation)
|
|
503
515
|
const result = yield* projectCompleteResult({
|
|
504
516
|
...cacheHint("resources"),
|
|
505
|
-
resources:
|
|
517
|
+
resources: yield* Effect.forEach(resources, projectResource)
|
|
506
518
|
}, context.serverInfo)
|
|
507
519
|
return yield* decodeListResourcesResult(result)
|
|
508
520
|
}, Effect.mapError(projectError)),
|
|
@@ -513,7 +525,7 @@ export const makeHandlers = (
|
|
|
513
525
|
const resourceTemplates = yield* core.resources.listTemplates(invocation)
|
|
514
526
|
const result = yield* projectCompleteResult({
|
|
515
527
|
...cacheHint("resourceTemplates"),
|
|
516
|
-
resourceTemplates:
|
|
528
|
+
resourceTemplates: yield* Effect.forEach(resourceTemplates, projectResourceTemplate)
|
|
517
529
|
}, context.serverInfo)
|
|
518
530
|
return yield* decodeListResourceTemplatesResult(result)
|
|
519
531
|
}, Effect.mapError(projectError)),
|
|
@@ -673,6 +685,28 @@ export const makeHandlers = (
|
|
|
673
685
|
context.serverInfo
|
|
674
686
|
)
|
|
675
687
|
}, Effect.mapError(projectError)),
|
|
688
|
+
"skills/list": Effect.fnUntraced(function*(request: typeof McpSkills.ListSkills.payloadSchema.Type) {
|
|
689
|
+
yield* requireSkills("skills/list")
|
|
690
|
+
yield* McpSkills.rejectCursor(request.cursor)
|
|
691
|
+
const skills = yield* core.skills.list(yield* getInvocation)
|
|
692
|
+
const result = yield* projectCompleteResult({ ...cacheHint("skills"), skills }, context.serverInfo)
|
|
693
|
+
return yield* decodeListSkillsResult(result)
|
|
694
|
+
}, Effect.mapError(projectError)),
|
|
695
|
+
"skills/get": Effect.fnUntraced(function*(request: typeof McpSkills.GetSkill.payloadSchema.Type) {
|
|
696
|
+
yield* requireSkills("skills/get")
|
|
697
|
+
const skill = yield* core.skills.get(request.uri, yield* getInvocation)
|
|
698
|
+
const result = yield* projectCompleteResult({ ...cacheHint("skills"), skill }, context.serverInfo)
|
|
699
|
+
return yield* decodeGetSkillResult(result)
|
|
700
|
+
}, Effect.mapError(projectError)),
|
|
701
|
+
"resources/directory/read": Effect.fnUntraced(function*(
|
|
702
|
+
request: typeof McpSkills.ReadResourceDirectory.payloadSchema.Type
|
|
703
|
+
) {
|
|
704
|
+
yield* requireSkills("resources/directory/read")
|
|
705
|
+
yield* McpSkills.rejectCursor(request.cursor)
|
|
706
|
+
const resources = yield* core.skills.readDirectory(request.uri, yield* getInvocation)
|
|
707
|
+
const result = yield* projectCompleteResult({ ...cacheHint("skills"), resources }, context.serverInfo)
|
|
708
|
+
return yield* decodeReadResourceDirectoryResult(result)
|
|
709
|
+
}, Effect.mapError(projectError)),
|
|
676
710
|
"notifications/cancelled": Effect.fnUntraced(function*(
|
|
677
711
|
_request: typeof McpSchema.CancelledNotification.payloadSchema.Type
|
|
678
712
|
) {
|
|
@@ -696,7 +730,7 @@ const runtime = {
|
|
|
696
730
|
export const protocol = McpProtocol.make({
|
|
697
731
|
protocolVersion: McpSchema.protocolVersion,
|
|
698
732
|
runtime,
|
|
699
|
-
clientRpcs: McpSchema.ClientRpcs,
|
|
733
|
+
clientRpcs: McpSchema.ClientRpcs.merge(McpSkills.StatelessRpcs),
|
|
700
734
|
clientNotificationRpcs: McpSchema.ClientNotificationRpcs,
|
|
701
735
|
serverRequestRpcs: McpSchema.ServerRequestRpcs,
|
|
702
736
|
serverNotificationRpcs: McpSchema.ServerNotificationRpcs,
|
|
@@ -257,6 +257,20 @@ export class ProtocolError extends Data.TaggedError("ProtocolError")<{
|
|
|
257
257
|
message: `Prompt '${error.name}' not found`
|
|
258
258
|
})
|
|
259
259
|
}
|
|
260
|
+
if (error._tag === "SkillNotFound" && Predicate.hasProperty(error, "uri") && Predicate.isString(error.uri)) {
|
|
261
|
+
return new ProtocolError({
|
|
262
|
+
code: PublicMcpSchema.INVALID_PARAMS_ERROR_CODE,
|
|
263
|
+
message: `Skill '${error.uri}' not found`
|
|
264
|
+
})
|
|
265
|
+
}
|
|
266
|
+
if (
|
|
267
|
+
error._tag === "DirectoryNotFound" && Predicate.hasProperty(error, "uri") && Predicate.isString(error.uri)
|
|
268
|
+
) {
|
|
269
|
+
return new ProtocolError({
|
|
270
|
+
code: PublicMcpSchema.INVALID_PARAMS_ERROR_CODE,
|
|
271
|
+
message: `Directory '${error.uri}' not found`
|
|
272
|
+
})
|
|
273
|
+
}
|
|
260
274
|
if (error._tag === "ResourceNotFound" && Predicate.hasProperty(error, "uri") && Predicate.isString(error.uri)) {
|
|
261
275
|
return new ProtocolError({
|
|
262
276
|
code: LEGACY_RESOURCE_NOT_FOUND_ERROR_CODE,
|
|
@@ -450,6 +464,7 @@ export interface HandlerInstallationContext {
|
|
|
450
464
|
readonly tools: boolean
|
|
451
465
|
readonly resources: boolean
|
|
452
466
|
readonly prompts: boolean
|
|
467
|
+
readonly skills: boolean
|
|
453
468
|
}>
|
|
454
469
|
}
|
|
455
470
|
|
|
@@ -19,11 +19,13 @@ import * as Result from "../../Result.ts"
|
|
|
19
19
|
import * as RpcGroup from "../../rpc/RpcGroup.ts"
|
|
20
20
|
import type * as RpcMessage from "../../rpc/RpcMessage.ts"
|
|
21
21
|
import type * as Scope from "../../Scope.ts"
|
|
22
|
+
import type * as Types from "../../Types.ts"
|
|
22
23
|
import type * as PublicMcpProtocol from "../McpProtocol.ts"
|
|
23
24
|
import * as PublicMcpSchema from "../McpSchema.ts"
|
|
24
25
|
import type * as McpCore from "./mcpCore.ts"
|
|
25
26
|
import * as McpProtocol from "./mcpProtocol.ts"
|
|
26
27
|
import * as McpProtocolRegistry from "./mcpProtocolRegistry.ts"
|
|
28
|
+
import * as McpSkills from "./mcpSkills.ts"
|
|
27
29
|
import * as McpStatefulRuntime from "./mcpStatefulRuntime.ts"
|
|
28
30
|
|
|
29
31
|
const MCP_SESSION_ID_HEADER = "mcp-session-id"
|
|
@@ -542,16 +544,17 @@ export const make = Effect.fnUntraced(function*(
|
|
|
542
544
|
const presence = yield* options.core.registrationPresence
|
|
543
545
|
return yield* Effect.withFiber((fiber) => {
|
|
544
546
|
const httpRequest = Context.getOrUndefined(fiber.context, HttpServerRequest.HttpServerRequest)
|
|
545
|
-
const capabilities: McpCore.CanonicalServerCapabilities = {
|
|
547
|
+
const capabilities: Types.Mutable<McpCore.CanonicalServerCapabilities> = {
|
|
546
548
|
completions: true,
|
|
547
549
|
logging: true,
|
|
548
550
|
...(presence.tools ? { tools: { listChanged: true } } : {}),
|
|
549
551
|
...(presence.resources
|
|
550
552
|
? { resources: { listChanged: true, subscribe: httpRequest === undefined } }
|
|
551
553
|
: {}),
|
|
552
|
-
...(presence.prompts ? { prompts: { listChanged: true } } : {})
|
|
553
|
-
...(options.serverInfo.extensions ? { extensions: options.serverInfo.extensions } : {})
|
|
554
|
+
...(presence.prompts ? { prompts: { listChanged: true } } : {})
|
|
554
555
|
}
|
|
556
|
+
const extensions = McpSkills.declareExtension(options.serverInfo.extensions, presence.skills)
|
|
557
|
+
if (extensions !== undefined) capabilities.extensions = extensions
|
|
555
558
|
const initializePayload = PublicMcpSchema.Initialize.payloadSchema.make({
|
|
556
559
|
protocolVersion,
|
|
557
560
|
capabilities: profile.clientCapabilities,
|