@namzu/sdk 69.0.0 → 69.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/dist/agents/QueryAgent.d.ts.map +1 -1
- package/dist/agents/QueryAgent.js +2 -0
- package/dist/agents/QueryAgent.js.map +1 -1
- package/dist/authorization/skill-grant.d.ts.map +1 -1
- package/dist/authorization/skill-grant.js +1 -0
- package/dist/authorization/skill-grant.js.map +1 -1
- package/dist/bridge/acp/permission.d.ts +10 -0
- package/dist/bridge/acp/permission.d.ts.map +1 -1
- package/dist/bridge/acp/permission.js.map +1 -1
- package/dist/bridge/acp/server.d.ts.map +1 -1
- package/dist/bridge/acp/server.js +1 -0
- package/dist/bridge/acp/server.js.map +1 -1
- package/dist/connector/index.d.ts +2 -2
- package/dist/connector/index.d.ts.map +1 -1
- package/dist/connector/index.js +1 -1
- package/dist/connector/index.js.map +1 -1
- package/dist/connector/mcp/client.d.ts +29 -0
- package/dist/connector/mcp/client.d.ts.map +1 -1
- package/dist/connector/mcp/client.js +59 -2
- package/dist/connector/mcp/client.js.map +1 -1
- package/dist/connector/mcp/errors.d.ts +7 -0
- package/dist/connector/mcp/errors.d.ts.map +1 -1
- package/dist/connector/mcp/errors.js +14 -0
- package/dist/connector/mcp/errors.js.map +1 -1
- package/dist/connector/mcp/index.d.ts +5 -1
- package/dist/connector/mcp/index.d.ts.map +1 -1
- package/dist/connector/mcp/index.js +3 -1
- package/dist/connector/mcp/index.js.map +1 -1
- package/dist/connector/mcp/skill-source.d.ts +144 -0
- package/dist/connector/mcp/skill-source.d.ts.map +1 -0
- package/dist/connector/mcp/skill-source.js +375 -0
- package/dist/connector/mcp/skill-source.js.map +1 -0
- package/dist/connector/mcp/skills.d.ts +137 -0
- package/dist/connector/mcp/skills.d.ts.map +1 -0
- package/dist/connector/mcp/skills.js +303 -0
- package/dist/connector/mcp/skills.js.map +1 -0
- package/dist/network/audit.d.ts +1 -1
- package/dist/network/audit.d.ts.map +1 -1
- package/dist/network/audit.js +2 -0
- package/dist/network/audit.js.map +1 -1
- package/dist/network/computer.d.ts +107 -0
- package/dist/network/computer.d.ts.map +1 -0
- package/dist/network/computer.js +250 -0
- package/dist/network/computer.js.map +1 -0
- package/dist/network/index.d.ts +2 -0
- package/dist/network/index.d.ts.map +1 -1
- package/dist/network/index.js +1 -0
- package/dist/network/index.js.map +1 -1
- package/dist/network/join.d.ts +3 -1
- package/dist/network/join.d.ts.map +1 -1
- package/dist/network/join.js +6 -3
- package/dist/network/join.js.map +1 -1
- package/dist/network/roster.d.ts +5 -0
- package/dist/network/roster.d.ts.map +1 -1
- package/dist/network/roster.js.map +1 -1
- package/dist/network/service.d.ts +12 -2
- package/dist/network/service.d.ts.map +1 -1
- package/dist/network/service.js +377 -52
- package/dist/network/service.js.map +1 -1
- package/dist/network/store.d.ts +10 -0
- package/dist/network/store.d.ts.map +1 -1
- package/dist/network/store.js +25 -3
- package/dist/network/store.js.map +1 -1
- package/dist/network/wire.d.ts +2 -0
- package/dist/network/wire.d.ts.map +1 -1
- package/dist/network/wire.js +5 -0
- package/dist/network/wire.js.map +1 -1
- package/dist/plugin/shell-hook-tool-names.d.ts.map +1 -1
- package/dist/plugin/shell-hook-tool-names.js +1 -0
- package/dist/plugin/shell-hook-tool-names.js.map +1 -1
- package/dist/plugin/shell-hook.d.ts +8 -3
- package/dist/plugin/shell-hook.d.ts.map +1 -1
- package/dist/plugin/shell-hook.js +132 -7
- package/dist/plugin/shell-hook.js.map +1 -1
- package/dist/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +4 -0
- package/dist/provider/fallback.js.map +1 -1
- package/dist/provider/idle-timeout.d.ts.map +1 -1
- package/dist/provider/idle-timeout.js +3 -0
- package/dist/provider/idle-timeout.js.map +1 -1
- package/dist/provider/model-window-suffix.d.ts.map +1 -1
- package/dist/provider/model-window-suffix.js +1 -0
- package/dist/provider/model-window-suffix.js.map +1 -1
- package/dist/provider/retry.d.ts.map +1 -1
- package/dist/provider/retry.js +3 -0
- package/dist/provider/retry.js.map +1 -1
- package/dist/public-runtime.d.ts +9 -6
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +11 -4
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +5 -4
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +5 -3
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +3 -1
- package/dist/public-types.d.ts.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.d.ts.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.js +10 -1
- package/dist/runtime/query/executor/tool-call-admission.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +12 -0
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +43 -9
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.d.ts +4 -0
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +32 -0
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +2 -2
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +2 -2
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/shell-line-escalation.d.ts +24 -0
- package/dist/runtime/query/shell-line-escalation.d.ts.map +1 -0
- package/dist/runtime/query/shell-line-escalation.js +38 -0
- package/dist/runtime/query/shell-line-escalation.js.map +1 -0
- package/dist/runtime/query/tooling.d.ts +7 -0
- package/dist/runtime/query/tooling.d.ts.map +1 -1
- package/dist/runtime/query/tooling.js +2 -0
- package/dist/runtime/query/tooling.js.map +1 -1
- package/dist/runtime/query/turn/outcome-ledger.d.ts.map +1 -1
- package/dist/runtime/query/turn/outcome-ledger.js +11 -0
- package/dist/runtime/query/turn/outcome-ledger.js.map +1 -1
- package/dist/scheduler/local.d.ts.map +1 -1
- package/dist/scheduler/local.js +3 -1
- package/dist/scheduler/local.js.map +1 -1
- package/dist/skills/index.d.ts +4 -0
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +2 -0
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/inline-shell-host.d.ts +103 -0
- package/dist/skills/inline-shell-host.d.ts.map +1 -0
- package/dist/skills/inline-shell-host.js +238 -0
- package/dist/skills/inline-shell-host.js.map +1 -0
- package/dist/skills/inline-shell.d.ts +176 -0
- package/dist/skills/inline-shell.d.ts.map +1 -0
- package/dist/skills/inline-shell.js +646 -0
- package/dist/skills/inline-shell.js.map +1 -0
- package/dist/store/index.d.ts +2 -0
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +1 -0
- package/dist/store/index.js.map +1 -1
- package/dist/store/task/file.d.ts +124 -0
- package/dist/store/task/file.d.ts.map +1 -0
- package/dist/store/task/file.js +498 -0
- package/dist/store/task/file.js.map +1 -0
- package/dist/teams/backend.d.ts +28 -0
- package/dist/teams/backend.d.ts.map +1 -0
- package/dist/teams/backend.js +2 -0
- package/dist/teams/backend.js.map +1 -0
- package/dist/teams/fs-sync.d.ts +19 -0
- package/dist/teams/fs-sync.d.ts.map +1 -0
- package/dist/teams/fs-sync.js +81 -0
- package/dist/teams/fs-sync.js.map +1 -0
- package/dist/teams/index.d.ts +14 -0
- package/dist/teams/index.d.ts.map +1 -0
- package/dist/teams/index.js +11 -0
- package/dist/teams/index.js.map +1 -0
- package/dist/teams/names.d.ts +15 -0
- package/dist/teams/names.d.ts.map +1 -0
- package/dist/teams/names.js +43 -0
- package/dist/teams/names.js.map +1 -0
- package/dist/teams/store.d.ts +133 -0
- package/dist/teams/store.d.ts.map +1 -0
- package/dist/teams/store.js +536 -0
- package/dist/teams/store.js.map +1 -0
- package/dist/teams/types.d.ts +97 -0
- package/dist/teams/types.d.ts.map +1 -0
- package/dist/teams/types.js +70 -0
- package/dist/teams/types.js.map +1 -0
- package/dist/tools/admit-facts.d.ts.map +1 -1
- package/dist/tools/admit-facts.js +9 -1
- package/dist/tools/admit-facts.js.map +1 -1
- package/dist/tools/builtins/computer-use.d.ts +56 -2
- package/dist/tools/builtins/computer-use.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js +604 -90
- package/dist/tools/builtins/computer-use.js.map +1 -1
- package/dist/tools/builtins/index.d.ts +1 -1
- package/dist/tools/builtins/index.d.ts.map +1 -1
- package/dist/tools/builtins/index.js.map +1 -1
- package/dist/tools/builtins/skill.d.ts +31 -0
- package/dist/tools/builtins/skill.d.ts.map +1 -1
- package/dist/tools/builtins/skill.js +232 -88
- package/dist/tools/builtins/skill.js.map +1 -1
- package/dist/tools/task/create.d.ts.map +1 -1
- package/dist/tools/task/create.js +11 -2
- package/dist/tools/task/create.js.map +1 -1
- package/dist/tools/task/get.d.ts +8 -0
- package/dist/tools/task/get.d.ts.map +1 -0
- package/dist/tools/task/get.js +51 -0
- package/dist/tools/task/get.js.map +1 -0
- package/dist/tools/task/index.d.ts +7 -0
- package/dist/tools/task/index.d.ts.map +1 -1
- package/dist/tools/task/index.js +10 -2
- package/dist/tools/task/index.js.map +1 -1
- package/dist/tools/task/list.d.ts.map +1 -1
- package/dist/tools/task/list.js +10 -2
- package/dist/tools/task/list.js.map +1 -1
- package/dist/tools/task/number.d.ts +13 -0
- package/dist/tools/task/number.d.ts.map +1 -0
- package/dist/tools/task/number.js +30 -0
- package/dist/tools/task/number.js.map +1 -0
- package/dist/tools/task/present.d.ts.map +1 -1
- package/dist/tools/task/present.js +17 -3
- package/dist/tools/task/present.js.map +1 -1
- package/dist/tools/task/update.d.ts +2 -1
- package/dist/tools/task/update.d.ts.map +1 -1
- package/dist/tools/task/update.js +86 -19
- package/dist/tools/task/update.js.map +1 -1
- package/dist/types/acp/index.d.ts +10 -0
- package/dist/types/acp/index.d.ts.map +1 -1
- package/dist/types/agent/base.d.ts +4 -0
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/agent/scheduler.d.ts +9 -0
- package/dist/types/agent/scheduler.d.ts.map +1 -1
- package/dist/types/computer-use/index.d.ts +7 -0
- package/dist/types/computer-use/index.d.ts.map +1 -1
- package/dist/types/computer-use/index.js.map +1 -1
- package/dist/types/connector/mcp.d.ts +10 -0
- package/dist/types/connector/mcp.d.ts.map +1 -1
- package/dist/types/permission/index.d.ts +20 -0
- package/dist/types/permission/index.d.ts.map +1 -1
- package/dist/types/permission/index.js +25 -0
- package/dist/types/permission/index.js.map +1 -1
- package/dist/types/plugin/index.d.ts +47 -3
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/plugin/index.js +4 -0
- package/dist/types/plugin/index.js.map +1 -1
- package/dist/types/provider/interface.d.ts +6 -0
- package/dist/types/provider/interface.d.ts.map +1 -1
- package/dist/types/tool/index.d.ts +28 -2
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/types/tool/presentation.d.ts +4 -0
- package/dist/types/tool/presentation.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/agents/QueryAgent.ts +2 -0
- package/src/authorization/skill-grant.ts +1 -0
- package/src/bridge/acp/permission.ts +11 -1
- package/src/bridge/acp/server.ts +1 -0
- package/src/connector/index.ts +27 -0
- package/src/connector/mcp/client.ts +71 -2
- package/src/connector/mcp/errors.ts +14 -0
- package/src/connector/mcp/index.ts +36 -0
- package/src/connector/mcp/skill-source.ts +499 -0
- package/src/connector/mcp/skills.ts +367 -0
- package/src/network/audit.ts +2 -0
- package/src/network/computer.ts +347 -0
- package/src/network/index.ts +20 -0
- package/src/network/join.ts +4 -2
- package/src/network/roster.ts +5 -0
- package/src/network/service.ts +492 -75
- package/src/network/store.ts +29 -3
- package/src/network/wire.ts +5 -0
- package/src/plugin/shell-hook-tool-names.ts +1 -0
- package/src/plugin/shell-hook.ts +144 -7
- package/src/provider/fallback.ts +4 -0
- package/src/provider/idle-timeout.ts +3 -0
- package/src/provider/model-window-suffix.ts +1 -0
- package/src/provider/retry.ts +3 -0
- package/src/public-runtime.ts +99 -0
- package/src/public-tools.ts +9 -0
- package/src/public-types.ts +28 -0
- package/src/runtime/query/executor/tool-call-admission.ts +10 -1
- package/src/runtime/query/executor.ts +57 -8
- package/src/runtime/query/index.ts +43 -0
- package/src/runtime/query/review-policy.ts +7 -1
- package/src/runtime/query/shell-line-escalation.ts +49 -0
- package/src/runtime/query/tooling.ts +6 -0
- package/src/runtime/query/turn/outcome-ledger.ts +11 -0
- package/src/scheduler/local.ts +3 -1
- package/src/skills/index.ts +43 -0
- package/src/skills/inline-shell-host.ts +303 -0
- package/src/skills/inline-shell.ts +765 -0
- package/src/store/index.ts +8 -0
- package/src/store/task/file.ts +641 -0
- package/src/teams/backend.ts +29 -0
- package/src/teams/fs-sync.ts +91 -0
- package/src/teams/index.ts +47 -0
- package/src/teams/names.ts +49 -0
- package/src/teams/store.ts +607 -0
- package/src/teams/types.ts +102 -0
- package/src/tools/admit-facts.ts +9 -1
- package/src/tools/builtins/computer-use.ts +689 -95
- package/src/tools/builtins/index.ts +1 -0
- package/src/tools/builtins/skill.ts +291 -95
- package/src/tools/task/create.ts +11 -2
- package/src/tools/task/get.ts +53 -0
- package/src/tools/task/index.ts +14 -2
- package/src/tools/task/list.ts +10 -2
- package/src/tools/task/number.ts +32 -0
- package/src/tools/task/present.ts +18 -3
- package/src/tools/task/update.ts +93 -19
- package/src/types/acp/index.ts +11 -1
- package/src/types/agent/base.ts +6 -0
- package/src/types/agent/scheduler.ts +9 -0
- package/src/types/computer-use/index.ts +7 -0
- package/src/types/connector/mcp.ts +10 -0
- package/src/types/permission/index.ts +29 -0
- package/src/types/plugin/index.ts +95 -39
- package/src/types/provider/interface.ts +7 -0
- package/src/types/tool/index.ts +23 -2
- package/src/types/tool/presentation.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@namzu/sdk",
|
|
3
|
-
"version": "69.
|
|
3
|
+
"version": "69.1.0",
|
|
4
4
|
"description": "Open-source AI kernel for TypeScript: runs an agent the way an operating system runs a process, with an identity and a budget, scheduled tool calls and checkpointed turns.",
|
|
5
5
|
"license": "FSL-1.1-MIT",
|
|
6
6
|
"engines": {
|
package/src/agents/QueryAgent.ts
CHANGED
|
@@ -250,6 +250,8 @@ export class QueryAgent extends AbstractAgent<QueryAgentConfig, QueryAgentResult
|
|
|
250
250
|
messages: input.messages,
|
|
251
251
|
signal: input.signal,
|
|
252
252
|
taskStore: input.taskStore,
|
|
253
|
+
...(input.taskMember !== undefined ? { taskMember: input.taskMember } : {}),
|
|
254
|
+
...(input.taskTeam !== undefined ? { taskTeam: input.taskTeam } : {}),
|
|
253
255
|
runtimeToolOverrides: input.runtimeToolOverrides,
|
|
254
256
|
runtimeContext: input.runtimeContext,
|
|
255
257
|
},
|
|
@@ -15,6 +15,11 @@ import type {
|
|
|
15
15
|
*/
|
|
16
16
|
export interface AcpPermissionRequest {
|
|
17
17
|
readonly sessionId: string
|
|
18
|
+
/**
|
|
19
|
+
* Set when a teammate of the session's team is the one asking. The client shows the member's
|
|
20
|
+
* name with the question; the answer goes back to that teammate's call only.
|
|
21
|
+
*/
|
|
22
|
+
readonly teammate?: { readonly name: string; readonly team: string }
|
|
18
23
|
readonly toolCalls: readonly (ToolCallSummary & {
|
|
19
24
|
/** Rides to the client untouched; see {@link AcpFileChangePreview}. */
|
|
20
25
|
readonly preview?: AcpFileChangePreview
|
|
@@ -27,7 +32,12 @@ export interface AcpPermissionRequest {
|
|
|
27
32
|
*/
|
|
28
33
|
readonly alwaysAsk?: boolean
|
|
29
34
|
/** Rides to the client untouched; see `AcpRequestPermissionParams`. */
|
|
30
|
-
readonly computer?: {
|
|
35
|
+
readonly computer?: {
|
|
36
|
+
readonly app?: string
|
|
37
|
+
readonly consequence?: string
|
|
38
|
+
/** Browsers this call acts in that the engine will put its own question about. */
|
|
39
|
+
readonly browserAsk?: readonly string[]
|
|
40
|
+
}
|
|
31
41
|
})[]
|
|
32
42
|
}
|
|
33
43
|
|
package/src/bridge/acp/server.ts
CHANGED
package/src/connector/index.ts
CHANGED
|
@@ -56,6 +56,21 @@ export {
|
|
|
56
56
|
diffTools,
|
|
57
57
|
encodeMcpHeaderValue,
|
|
58
58
|
MCP_TASKS_EXTENSION,
|
|
59
|
+
MCP_SKILLS_EXTENSION,
|
|
60
|
+
MCP_SKILL_FILE,
|
|
61
|
+
MCP_SKILL_LIMITS,
|
|
62
|
+
MCP_SKILL_STRIPPED_KEYS,
|
|
63
|
+
McpSkillLoadError,
|
|
64
|
+
McpSkillSource,
|
|
65
|
+
admitMcpSkillEntries,
|
|
66
|
+
isMethodNotFoundError,
|
|
67
|
+
loadMcpSkillBody,
|
|
68
|
+
mcpSkillMetadata,
|
|
69
|
+
mcpSkillServerNameProblem,
|
|
70
|
+
mcpSkillStrippedKeys,
|
|
71
|
+
nameMcpSkills,
|
|
72
|
+
summarizeMcpSkillRefusals,
|
|
73
|
+
validateMcpSkillEntry,
|
|
59
74
|
hasDrift,
|
|
60
75
|
HttpSseTransport,
|
|
61
76
|
isHeaderMismatchError,
|
|
@@ -92,6 +107,18 @@ export {
|
|
|
92
107
|
zodToMCPJsonSchema,
|
|
93
108
|
} from './mcp/index.js'
|
|
94
109
|
export type {
|
|
110
|
+
McpListedSkill,
|
|
111
|
+
McpNamedSkill,
|
|
112
|
+
McpSkillAdmission,
|
|
113
|
+
McpSkillEntry,
|
|
114
|
+
McpSkillEntryVerdict,
|
|
115
|
+
McpSkillFile,
|
|
116
|
+
McpSkillLoadFailure,
|
|
117
|
+
McpSkillRefusal,
|
|
118
|
+
McpSkillSourceOptions,
|
|
119
|
+
McpSkillsClient,
|
|
120
|
+
McpSkillsRefresh,
|
|
121
|
+
McpSkillsRefreshStatus,
|
|
95
122
|
McpEnvelope,
|
|
96
123
|
McpEnvelopeInput,
|
|
97
124
|
McpEraProbe,
|
|
@@ -58,6 +58,7 @@ import {
|
|
|
58
58
|
protocolErrorFromReply,
|
|
59
59
|
} from './errors.js'
|
|
60
60
|
import { HttpSseTransport } from './http-sse.js'
|
|
61
|
+
import { MCP_SKILLS_EXTENSION } from './skills.js'
|
|
61
62
|
import { StdioTransport } from './stdio.js'
|
|
62
63
|
import { MCPSubscriptionResponseError, StreamableHttpTransport } from './streamable-http.js'
|
|
63
64
|
import {
|
|
@@ -1146,8 +1147,34 @@ export class MCPClient {
|
|
|
1146
1147
|
*/
|
|
1147
1148
|
private clientCapabilities(): MCPClientCapabilities {
|
|
1148
1149
|
const base = this.config.capabilities ?? {}
|
|
1149
|
-
|
|
1150
|
-
|
|
1150
|
+
const tasks = this.declaresTasks()
|
|
1151
|
+
const skills = this.declaresSkills()
|
|
1152
|
+
if (!tasks && !skills) return base
|
|
1153
|
+
return {
|
|
1154
|
+
...base,
|
|
1155
|
+
extensions: {
|
|
1156
|
+
...base.extensions,
|
|
1157
|
+
...(tasks ? { [MCP_TASKS_EXTENSION]: {} } : {}),
|
|
1158
|
+
...(skills ? { [MCP_SKILLS_EXTENSION]: {} } : {}),
|
|
1159
|
+
},
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
/**
|
|
1164
|
+
* Does this connection take part in the skills extension?
|
|
1165
|
+
*
|
|
1166
|
+
* Only when the host asked for it ({@link MCPClientConfig.skills}, off by
|
|
1167
|
+
* default), on a 2026-07-28 connection, and when the server advertised
|
|
1168
|
+
* `io.modelcontextprotocol/skills` in `server/discover`. A legacy
|
|
1169
|
+
* connection never does: the extension is declared per request, and the
|
|
1170
|
+
* older handshake has no place to learn the server's side first.
|
|
1171
|
+
*/
|
|
1172
|
+
declaresSkills(): boolean {
|
|
1173
|
+
return (
|
|
1174
|
+
this.config.skills === true &&
|
|
1175
|
+
this.era?.kind === 'modern' &&
|
|
1176
|
+
this.serverCapabilities?.extensions?.[MCP_SKILLS_EXTENSION] !== undefined
|
|
1177
|
+
)
|
|
1151
1178
|
}
|
|
1152
1179
|
|
|
1153
1180
|
/**
|
|
@@ -1341,6 +1368,48 @@ export class MCPClient {
|
|
|
1341
1368
|
return await this.listAllPages('resources/list', 'resources', options)
|
|
1342
1369
|
}
|
|
1343
1370
|
|
|
1371
|
+
/**
|
|
1372
|
+
* One page of the skills a server offers (`skills/list`).
|
|
1373
|
+
*
|
|
1374
|
+
* Resolves `undefined` without sending anything unless
|
|
1375
|
+
* {@link declaresSkills}. Answers are not cached: a skill listing is
|
|
1376
|
+
* re-read when the host asks, and a stale one would offer a skill the
|
|
1377
|
+
* server withdrew. A server that does not know the method rejects with
|
|
1378
|
+
* `MCPProtocolError` `-32601`; {@link isMethodNotFoundError} says so.
|
|
1379
|
+
* Entries are returned unchecked: `validateMcpSkillEntry` is the gate.
|
|
1380
|
+
*/
|
|
1381
|
+
async listSkillPage(
|
|
1382
|
+
cursor?: string,
|
|
1383
|
+
options?: MCPRequestOptions,
|
|
1384
|
+
): Promise<{ skills: unknown[]; nextCursor?: string } | undefined> {
|
|
1385
|
+
this.requireConnected()
|
|
1386
|
+
if (!this.declaresSkills()) return undefined
|
|
1387
|
+
const result = (await this.requestWithSessionRecovery(
|
|
1388
|
+
'skills/list',
|
|
1389
|
+
cursor === undefined ? {} : { cursor },
|
|
1390
|
+
options,
|
|
1391
|
+
)) as { skills?: unknown; nextCursor?: unknown } | null
|
|
1392
|
+
return {
|
|
1393
|
+
skills: Array.isArray(result?.skills) ? (result.skills as unknown[]) : [],
|
|
1394
|
+
...(typeof result?.nextCursor === 'string' && result.nextCursor.length > 0
|
|
1395
|
+
? { nextCursor: result.nextCursor }
|
|
1396
|
+
: {}),
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
/**
|
|
1401
|
+
* One skill by address (`skills/get`), or `undefined` when the server has
|
|
1402
|
+
* none there or this connection does not take part in the extension.
|
|
1403
|
+
*/
|
|
1404
|
+
async getSkill(uri: string, options?: MCPRequestOptions): Promise<unknown | undefined> {
|
|
1405
|
+
this.requireConnected()
|
|
1406
|
+
if (!this.declaresSkills()) return undefined
|
|
1407
|
+
const result = (await this.requestWithSessionRecovery('skills/get', { uri }, options)) as {
|
|
1408
|
+
skill?: unknown
|
|
1409
|
+
} | null
|
|
1410
|
+
return result?.skill ?? undefined
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1344
1413
|
async readResource(uri: string, options?: MCPRequestOptions): Promise<MCPContentBlock[]> {
|
|
1345
1414
|
this.requireConnected()
|
|
1346
1415
|
const result = (await this.cachedRequest('resources/read', { uri }, options)) as {
|
|
@@ -114,6 +114,20 @@ export function isHeaderMismatchError(error: unknown): error is MCPProtocolError
|
|
|
114
114
|
return error instanceof MCPProtocolError && error.code === HEADER_MISMATCH_CODE
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
/**
|
|
118
|
+
* A server answered that it has no such method (`-32601`), as a JSON-RPC
|
|
119
|
+
* error or as the `404` with a `-32601` body a modern HTTP server uses.
|
|
120
|
+
* For a method an extension adds, this means "the server does not offer
|
|
121
|
+
* it", not a fault.
|
|
122
|
+
*/
|
|
123
|
+
export function isMethodNotFoundError(error: unknown): boolean {
|
|
124
|
+
if (error instanceof MCPProtocolError) return error.code === -32601
|
|
125
|
+
if (error instanceof MCPHttpStatusError) {
|
|
126
|
+
return error.status === 404 && /-32601/.test(error.bodyText)
|
|
127
|
+
}
|
|
128
|
+
return false
|
|
129
|
+
}
|
|
130
|
+
|
|
117
131
|
/**
|
|
118
132
|
* A server answered that the resource, prompt or tool a request named does
|
|
119
133
|
* not exist — the current spec's `-32002`, or the older `-32602` a
|
|
@@ -6,6 +6,7 @@ export { MCPClient } from './client.js'
|
|
|
6
6
|
|
|
7
7
|
export {
|
|
8
8
|
isHeaderMismatchError,
|
|
9
|
+
isMethodNotFoundError,
|
|
9
10
|
isMissingRequiredClientCapabilityError,
|
|
10
11
|
isResourceNotFoundError,
|
|
11
12
|
isUnsupportedProtocolVersionError,
|
|
@@ -36,6 +37,41 @@ export { buildEnvelope, decodeResult, encodeMcpHeaderValue } from './envelope.js
|
|
|
36
37
|
export type { McpEnvelope, McpEnvelopeInput, MCPDecodedResult } from './envelope.js'
|
|
37
38
|
export { MCP_TASKS_EXTENSION } from './tasks.js'
|
|
38
39
|
|
|
40
|
+
export {
|
|
41
|
+
MCP_SKILLS_EXTENSION,
|
|
42
|
+
MCP_SKILL_FILE,
|
|
43
|
+
MCP_SKILL_LIMITS,
|
|
44
|
+
admitMcpSkillEntries,
|
|
45
|
+
mcpSkillServerNameProblem,
|
|
46
|
+
nameMcpSkills,
|
|
47
|
+
summarizeMcpSkillRefusals,
|
|
48
|
+
validateMcpSkillEntry,
|
|
49
|
+
} from './skills.js'
|
|
50
|
+
export type {
|
|
51
|
+
McpNamedSkill,
|
|
52
|
+
McpSkillAdmission,
|
|
53
|
+
McpSkillEntry,
|
|
54
|
+
McpSkillEntryVerdict,
|
|
55
|
+
McpSkillFile,
|
|
56
|
+
McpSkillRefusal,
|
|
57
|
+
} from './skills.js'
|
|
58
|
+
export {
|
|
59
|
+
MCP_SKILL_STRIPPED_KEYS,
|
|
60
|
+
McpSkillLoadError,
|
|
61
|
+
McpSkillSource,
|
|
62
|
+
loadMcpSkillBody,
|
|
63
|
+
mcpSkillMetadata,
|
|
64
|
+
mcpSkillStrippedKeys,
|
|
65
|
+
} from './skill-source.js'
|
|
66
|
+
export type {
|
|
67
|
+
McpListedSkill,
|
|
68
|
+
McpSkillLoadFailure,
|
|
69
|
+
McpSkillSourceOptions,
|
|
70
|
+
McpSkillsClient,
|
|
71
|
+
McpSkillsRefresh,
|
|
72
|
+
McpSkillsRefreshStatus,
|
|
73
|
+
} from './skill-source.js'
|
|
74
|
+
|
|
39
75
|
// The repo's first refusal path: a tool definition namzu declines to expose.
|
|
40
76
|
// Exported so a host can ask the same question of a schema it holds — and
|
|
41
77
|
// because `McpEnvelopeInput.paramHeaders` names the binding type.
|