Upload folder using huggingface_hub (part 20)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +10 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/shared/inMemoryEventStore.js +65 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/shared/inMemoryEventStore.js.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.d.ts +13 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.d.ts.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.js +13 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.js.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.d.ts +121 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.d.ts.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js +184 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.d.ts +47 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.d.ts.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js +64 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.d.ts +16 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.d.ts.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.js +20 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.js.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts +232 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js +16 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.d.ts +77 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.d.ts.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js +32 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.d.ts +170 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.d.ts.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js +246 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts +94 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js +246 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.d.ts +10 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.d.ts.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.js +10 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.js.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.d.ts +31 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.d.ts.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js +47 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/package.json +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.d.ts +19 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.d.ts.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.js +2 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.js.map +1 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.d.ts +148 -0
- tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.d.ts.map +1 -0
.gitattributes
CHANGED
|
@@ -91,3 +91,13 @@ tools/ui/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.18.3 fil
|
|
| 91 |
tools/ui/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.8.18.3 filter=lfs diff=lfs merge=lfs -text
|
| 92 |
tools/ui/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64-0.35.3.node filter=lfs diff=lfs merge=lfs -text
|
| 93 |
tools/ui/node_modules/@img/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64-0.35.3.node filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
tools/ui/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.8.18.3 filter=lfs diff=lfs merge=lfs -text
|
| 92 |
tools/ui/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64-0.35.3.node filter=lfs diff=lfs merge=lfs -text
|
| 93 |
tools/ui/node_modules/@img/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64-0.35.3.node filter=lfs diff=lfs merge=lfs -text
|
| 94 |
+
tools/ui/node_modules/@napi-rs/canvas-linux-x64-gnu/skia.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text
|
| 95 |
+
tools/ui/node_modules/@napi-rs/canvas-linux-x64-musl/skia.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text
|
| 96 |
+
tools/ui/node_modules/@oxc-parser/binding-linux-x64-gnu/parser.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text
|
| 97 |
+
tools/ui/node_modules/@oxc-parser/binding-linux-x64-musl/parser.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text
|
| 98 |
+
tools/ui/node_modules/@oxc-resolver/binding-linux-x64-gnu/resolver.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text
|
| 99 |
+
tools/ui/node_modules/@oxc-resolver/binding-linux-x64-musl/resolver.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text
|
| 100 |
+
tools/ui/node_modules/@parcel/watcher-linux-x64-glibc/watcher.node filter=lfs diff=lfs merge=lfs -text
|
| 101 |
+
tools/ui/node_modules/@parcel/watcher-linux-x64-musl/watcher.node filter=lfs diff=lfs merge=lfs -text
|
| 102 |
+
tools/ui/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text
|
| 103 |
+
tools/ui/node_modules/@rollup/rollup-linux-x64-musl/rollup.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/shared/inMemoryEventStore.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Simple in-memory implementation of the EventStore interface for resumability
|
| 3 |
+
* This is primarily intended for examples and testing, not for production use
|
| 4 |
+
* where a persistent storage solution would be more appropriate.
|
| 5 |
+
*/
|
| 6 |
+
export class InMemoryEventStore {
|
| 7 |
+
constructor() {
|
| 8 |
+
this.events = new Map();
|
| 9 |
+
}
|
| 10 |
+
/**
|
| 11 |
+
* Generates a unique event ID for a given stream ID
|
| 12 |
+
*/
|
| 13 |
+
generateEventId(streamId) {
|
| 14 |
+
return `${streamId}_${Date.now()}_${Math.random().toString(36).substring(2, 10)}`;
|
| 15 |
+
}
|
| 16 |
+
/**
|
| 17 |
+
* Extracts the stream ID from an event ID
|
| 18 |
+
*/
|
| 19 |
+
getStreamIdFromEventId(eventId) {
|
| 20 |
+
const parts = eventId.split('_');
|
| 21 |
+
return parts.length > 0 ? parts[0] : '';
|
| 22 |
+
}
|
| 23 |
+
/**
|
| 24 |
+
* Stores an event with a generated event ID
|
| 25 |
+
* Implements EventStore.storeEvent
|
| 26 |
+
*/
|
| 27 |
+
async storeEvent(streamId, message) {
|
| 28 |
+
const eventId = this.generateEventId(streamId);
|
| 29 |
+
this.events.set(eventId, { streamId, message });
|
| 30 |
+
return eventId;
|
| 31 |
+
}
|
| 32 |
+
/**
|
| 33 |
+
* Replays events that occurred after a specific event ID
|
| 34 |
+
* Implements EventStore.replayEventsAfter
|
| 35 |
+
*/
|
| 36 |
+
async replayEventsAfter(lastEventId, { send }) {
|
| 37 |
+
if (!lastEventId || !this.events.has(lastEventId)) {
|
| 38 |
+
return '';
|
| 39 |
+
}
|
| 40 |
+
// Extract the stream ID from the event ID
|
| 41 |
+
const streamId = this.getStreamIdFromEventId(lastEventId);
|
| 42 |
+
if (!streamId) {
|
| 43 |
+
return '';
|
| 44 |
+
}
|
| 45 |
+
let foundLastEvent = false;
|
| 46 |
+
// Sort events by eventId for chronological ordering
|
| 47 |
+
const sortedEvents = [...this.events.entries()].sort((a, b) => a[0].localeCompare(b[0]));
|
| 48 |
+
for (const [eventId, { streamId: eventStreamId, message }] of sortedEvents) {
|
| 49 |
+
// Only include events from the same stream
|
| 50 |
+
if (eventStreamId !== streamId) {
|
| 51 |
+
continue;
|
| 52 |
+
}
|
| 53 |
+
// Start sending events after we find the lastEventId
|
| 54 |
+
if (eventId === lastEventId) {
|
| 55 |
+
foundLastEvent = true;
|
| 56 |
+
continue;
|
| 57 |
+
}
|
| 58 |
+
if (foundLastEvent) {
|
| 59 |
+
await send(eventId, message);
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
return streamId;
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
//# sourceMappingURL=inMemoryEventStore.js.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/shared/inMemoryEventStore.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"inMemoryEventStore.js","sourceRoot":"","sources":["../../../../src/examples/shared/inMemoryEventStore.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IAA/B;QACY,WAAM,GAA+D,IAAI,GAAG,EAAE,CAAC;IAoE3F,CAAC;IAlEG;;OAEG;IACK,eAAe,C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AE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEzF,KAAK,MAAM,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC;YACzE,2CAA2C;YAC3C,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;gBAC7B,SAAS;YACb,CAAC;YAED,qDAAqD;YACrD,IAAI,OAAO,KAAK,WAAW,EAAE,CAAC;gBAC1B,cAAc,GAAG,IAAI,CAAC;gBACtB,SAAS;YACb,CAAC;YAED,IAAI,cAAc,EAAE,CAAC;gBACjB,MAAM,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACjC,CAAC;QACL,CAAC;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ"}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Experimental MCP SDK features.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* Import experimental features from this module:
|
| 6 |
+
* ```typescript
|
| 7 |
+
* import { TaskStore, InMemoryTaskStore } from '@modelcontextprotocol/sdk/experimental';
|
| 8 |
+
* ```
|
| 9 |
+
*
|
| 10 |
+
* @experimental
|
| 11 |
+
*/
|
| 12 |
+
export * from './tasks/index.js';
|
| 13 |
+
//# sourceMappingURL=index.d.ts.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/experimental/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,kBAAkB,CAAC"}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Experimental MCP SDK features.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* Import experimental features from this module:
|
| 6 |
+
* ```typescript
|
| 7 |
+
* import { TaskStore, InMemoryTaskStore } from '@modelcontextprotocol/sdk/experimental';
|
| 8 |
+
* ```
|
| 9 |
+
*
|
| 10 |
+
* @experimental
|
| 11 |
+
*/
|
| 12 |
+
export * from './tasks/index.js';
|
| 13 |
+
//# sourceMappingURL=index.js.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/experimental/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,kBAAkB,CAAC"}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.d.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Experimental client task features for MCP SDK.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* @experimental
|
| 6 |
+
*/
|
| 7 |
+
import type { Client } from '../../client/index.js';
|
| 8 |
+
import type { RequestOptions } from '../../shared/protocol.js';
|
| 9 |
+
import type { ResponseMessage } from '../../shared/responseMessage.js';
|
| 10 |
+
import type { AnyObjectSchema, SchemaOutput } from '../../server/zod-compat.js';
|
| 11 |
+
import type { CallToolRequest, ClientRequest, Notification, Request, Result } from '../../types.js';
|
| 12 |
+
import { CallToolResultSchema, type CompatibilityCallToolResultSchema } from '../../types.js';
|
| 13 |
+
import type { GetTaskResult, ListTasksResult, CancelTaskResult } from './types.js';
|
| 14 |
+
/**
|
| 15 |
+
* Experimental task features for MCP clients.
|
| 16 |
+
*
|
| 17 |
+
* Access via `client.experimental.tasks`:
|
| 18 |
+
* ```typescript
|
| 19 |
+
* const stream = client.experimental.tasks.callToolStream({ name: 'tool', arguments: {} });
|
| 20 |
+
* const task = await client.experimental.tasks.getTask(taskId);
|
| 21 |
+
* ```
|
| 22 |
+
*
|
| 23 |
+
* @experimental
|
| 24 |
+
*/
|
| 25 |
+
export declare class ExperimentalClientTasks<RequestT extends Request = Request, NotificationT extends Notification = Notification, ResultT extends Result = Result> {
|
| 26 |
+
private readonly _client;
|
| 27 |
+
constructor(_client: Client<RequestT, NotificationT, ResultT>);
|
| 28 |
+
/**
|
| 29 |
+
* Calls a tool and returns an AsyncGenerator that yields response messages.
|
| 30 |
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
| 31 |
+
*
|
| 32 |
+
* This method provides streaming access to tool execution, allowing you to
|
| 33 |
+
* observe intermediate task status updates for long-running tool calls.
|
| 34 |
+
* Automatically validates structured output if the tool has an outputSchema.
|
| 35 |
+
*
|
| 36 |
+
* @example
|
| 37 |
+
* ```typescript
|
| 38 |
+
* const stream = client.experimental.tasks.callToolStream({ name: 'myTool', arguments: {} });
|
| 39 |
+
* for await (const message of stream) {
|
| 40 |
+
* switch (message.type) {
|
| 41 |
+
* case 'taskCreated':
|
| 42 |
+
* console.log('Tool execution started:', message.task.taskId);
|
| 43 |
+
* break;
|
| 44 |
+
* case 'taskStatus':
|
| 45 |
+
* console.log('Tool status:', message.task.status);
|
| 46 |
+
* break;
|
| 47 |
+
* case 'result':
|
| 48 |
+
* console.log('Tool result:', message.result);
|
| 49 |
+
* break;
|
| 50 |
+
* case 'error':
|
| 51 |
+
* console.error('Tool error:', message.error);
|
| 52 |
+
* break;
|
| 53 |
+
* }
|
| 54 |
+
* }
|
| 55 |
+
* ```
|
| 56 |
+
*
|
| 57 |
+
* @param params - Tool call parameters (name and arguments)
|
| 58 |
+
* @param resultSchema - Zod schema for validating the result (defaults to CallToolResultSchema)
|
| 59 |
+
* @param options - Optional request options (timeout, signal, task creation params, etc.)
|
| 60 |
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
| 61 |
+
*
|
| 62 |
+
* @experimental
|
| 63 |
+
*/
|
| 64 |
+
callToolStream<T extends typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema>(params: CallToolRequest['params'], resultSchema?: T, options?: RequestOptions): AsyncGenerator<ResponseMessage<SchemaOutput<T>>, void, void>;
|
| 65 |
+
/**
|
| 66 |
+
* Gets the current status of a task.
|
| 67 |
+
*
|
| 68 |
+
* @param taskId - The task identifier
|
| 69 |
+
* @param options - Optional request options
|
| 70 |
+
* @returns The task status
|
| 71 |
+
*
|
| 72 |
+
* @experimental
|
| 73 |
+
*/
|
| 74 |
+
getTask(taskId: string, options?: RequestOptions): Promise<GetTaskResult>;
|
| 75 |
+
/**
|
| 76 |
+
* Retrieves the result of a completed task.
|
| 77 |
+
*
|
| 78 |
+
* @param taskId - The task identifier
|
| 79 |
+
* @param resultSchema - Zod schema for validating the result
|
| 80 |
+
* @param options - Optional request options
|
| 81 |
+
* @returns The task result
|
| 82 |
+
*
|
| 83 |
+
* @experimental
|
| 84 |
+
*/
|
| 85 |
+
getTaskResult<T extends AnyObjectSchema>(taskId: string, resultSchema?: T, options?: RequestOptions): Promise<SchemaOutput<T>>;
|
| 86 |
+
/**
|
| 87 |
+
* Lists tasks with optional pagination.
|
| 88 |
+
*
|
| 89 |
+
* @param cursor - Optional pagination cursor
|
| 90 |
+
* @param options - Optional request options
|
| 91 |
+
* @returns List of tasks with optional next cursor
|
| 92 |
+
*
|
| 93 |
+
* @experimental
|
| 94 |
+
*/
|
| 95 |
+
listTasks(cursor?: string, options?: RequestOptions): Promise<ListTasksResult>;
|
| 96 |
+
/**
|
| 97 |
+
* Cancels a running task.
|
| 98 |
+
*
|
| 99 |
+
* @param taskId - The task identifier
|
| 100 |
+
* @param options - Optional request options
|
| 101 |
+
*
|
| 102 |
+
* @experimental
|
| 103 |
+
*/
|
| 104 |
+
cancelTask(taskId: string, options?: RequestOptions): Promise<CancelTaskResult>;
|
| 105 |
+
/**
|
| 106 |
+
* Sends a request and returns an AsyncGenerator that yields response messages.
|
| 107 |
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
| 108 |
+
*
|
| 109 |
+
* This method provides streaming access to request processing, allowing you to
|
| 110 |
+
* observe intermediate task status updates for task-augmented requests.
|
| 111 |
+
*
|
| 112 |
+
* @param request - The request to send
|
| 113 |
+
* @param resultSchema - Zod schema for validating the result
|
| 114 |
+
* @param options - Optional request options (timeout, signal, task creation params, etc.)
|
| 115 |
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
| 116 |
+
*
|
| 117 |
+
* @experimental
|
| 118 |
+
*/
|
| 119 |
+
requestStream<T extends AnyObjectSchema>(request: ClientRequest | RequestT, resultSchema: T, options?: RequestOptions): AsyncGenerator<ResponseMessage<SchemaOutput<T>>, void, void>;
|
| 120 |
+
}
|
| 121 |
+
//# sourceMappingURL=client.d.ts.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACpG,OAAO,EAAE,oBAAoB,EAAE,KAAK,iCAAiC,EAAuB,MAAM,gBAAgB,CAAC;AAEnH,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAgBnF;;;;;;;;;;GAUG;AACH,qBAAa,uBAAuB,CAChC,QAAQ,SAAS,OAAO,GAAG,OAAO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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Experimental client task features for MCP SDK.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* @experimental
|
| 6 |
+
*/
|
| 7 |
+
import { CallToolResultSchema, McpError, ErrorCode } from '../../types.js';
|
| 8 |
+
/**
|
| 9 |
+
* Experimental task features for MCP clients.
|
| 10 |
+
*
|
| 11 |
+
* Access via `client.experimental.tasks`:
|
| 12 |
+
* ```typescript
|
| 13 |
+
* const stream = client.experimental.tasks.callToolStream({ name: 'tool', arguments: {} });
|
| 14 |
+
* const task = await client.experimental.tasks.getTask(taskId);
|
| 15 |
+
* ```
|
| 16 |
+
*
|
| 17 |
+
* @experimental
|
| 18 |
+
*/
|
| 19 |
+
export class ExperimentalClientTasks {
|
| 20 |
+
constructor(_client) {
|
| 21 |
+
this._client = _client;
|
| 22 |
+
}
|
| 23 |
+
/**
|
| 24 |
+
* Calls a tool and returns an AsyncGenerator that yields response messages.
|
| 25 |
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
| 26 |
+
*
|
| 27 |
+
* This method provides streaming access to tool execution, allowing you to
|
| 28 |
+
* observe intermediate task status updates for long-running tool calls.
|
| 29 |
+
* Automatically validates structured output if the tool has an outputSchema.
|
| 30 |
+
*
|
| 31 |
+
* @example
|
| 32 |
+
* ```typescript
|
| 33 |
+
* const stream = client.experimental.tasks.callToolStream({ name: 'myTool', arguments: {} });
|
| 34 |
+
* for await (const message of stream) {
|
| 35 |
+
* switch (message.type) {
|
| 36 |
+
* case 'taskCreated':
|
| 37 |
+
* console.log('Tool execution started:', message.task.taskId);
|
| 38 |
+
* break;
|
| 39 |
+
* case 'taskStatus':
|
| 40 |
+
* console.log('Tool status:', message.task.status);
|
| 41 |
+
* break;
|
| 42 |
+
* case 'result':
|
| 43 |
+
* console.log('Tool result:', message.result);
|
| 44 |
+
* break;
|
| 45 |
+
* case 'error':
|
| 46 |
+
* console.error('Tool error:', message.error);
|
| 47 |
+
* break;
|
| 48 |
+
* }
|
| 49 |
+
* }
|
| 50 |
+
* ```
|
| 51 |
+
*
|
| 52 |
+
* @param params - Tool call parameters (name and arguments)
|
| 53 |
+
* @param resultSchema - Zod schema for validating the result (defaults to CallToolResultSchema)
|
| 54 |
+
* @param options - Optional request options (timeout, signal, task creation params, etc.)
|
| 55 |
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
| 56 |
+
*
|
| 57 |
+
* @experimental
|
| 58 |
+
*/
|
| 59 |
+
async *callToolStream(params, resultSchema = CallToolResultSchema, options) {
|
| 60 |
+
// Access Client's internal methods
|
| 61 |
+
const clientInternal = this._client;
|
| 62 |
+
// Add task creation parameters if server supports it and not explicitly provided
|
| 63 |
+
const optionsWithTask = {
|
| 64 |
+
...options,
|
| 65 |
+
// We check if the tool is known to be a task during auto-configuration, but assume
|
| 66 |
+
// the caller knows what they're doing if they pass this explicitly
|
| 67 |
+
task: options?.task ?? (clientInternal.isToolTask(params.name) ? {} : undefined)
|
| 68 |
+
};
|
| 69 |
+
const stream = clientInternal.requestStream({ method: 'tools/call', params }, resultSchema, optionsWithTask);
|
| 70 |
+
// Get the validator for this tool (if it has an output schema)
|
| 71 |
+
const validator = clientInternal.getToolOutputValidator(params.name);
|
| 72 |
+
// Iterate through the stream and validate the final result if needed
|
| 73 |
+
for await (const message of stream) {
|
| 74 |
+
// If this is a result message and the tool has an output schema, validate it
|
| 75 |
+
if (message.type === 'result' && validator) {
|
| 76 |
+
const result = message.result;
|
| 77 |
+
// If tool has outputSchema, it MUST return structuredContent (unless it's an error)
|
| 78 |
+
if (!result.structuredContent && !result.isError) {
|
| 79 |
+
yield {
|
| 80 |
+
type: 'error',
|
| 81 |
+
error: new McpError(ErrorCode.InvalidRequest, `Tool ${params.name} has an output schema but did not return structured content`)
|
| 82 |
+
};
|
| 83 |
+
return;
|
| 84 |
+
}
|
| 85 |
+
// Only validate structured content if present (not when there's an error)
|
| 86 |
+
if (result.structuredContent) {
|
| 87 |
+
try {
|
| 88 |
+
// Validate the structured content against the schema
|
| 89 |
+
const validationResult = validator(result.structuredContent);
|
| 90 |
+
if (!validationResult.valid) {
|
| 91 |
+
yield {
|
| 92 |
+
type: 'error',
|
| 93 |
+
error: new McpError(ErrorCode.InvalidParams, `Structured content does not match the tool's output schema: ${validationResult.errorMessage}`)
|
| 94 |
+
};
|
| 95 |
+
return;
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
catch (error) {
|
| 99 |
+
if (error instanceof McpError) {
|
| 100 |
+
yield { type: 'error', error };
|
| 101 |
+
return;
|
| 102 |
+
}
|
| 103 |
+
yield {
|
| 104 |
+
type: 'error',
|
| 105 |
+
error: new McpError(ErrorCode.InvalidParams, `Failed to validate structured content: ${error instanceof Error ? error.message : String(error)}`)
|
| 106 |
+
};
|
| 107 |
+
return;
|
| 108 |
+
}
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
// Yield the message (either validated result or any other message type)
|
| 112 |
+
yield message;
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
+
/**
|
| 116 |
+
* Gets the current status of a task.
|
| 117 |
+
*
|
| 118 |
+
* @param taskId - The task identifier
|
| 119 |
+
* @param options - Optional request options
|
| 120 |
+
* @returns The task status
|
| 121 |
+
*
|
| 122 |
+
* @experimental
|
| 123 |
+
*/
|
| 124 |
+
async getTask(taskId, options) {
|
| 125 |
+
return this._client.getTask({ taskId }, options);
|
| 126 |
+
}
|
| 127 |
+
/**
|
| 128 |
+
* Retrieves the result of a completed task.
|
| 129 |
+
*
|
| 130 |
+
* @param taskId - The task identifier
|
| 131 |
+
* @param resultSchema - Zod schema for validating the result
|
| 132 |
+
* @param options - Optional request options
|
| 133 |
+
* @returns The task result
|
| 134 |
+
*
|
| 135 |
+
* @experimental
|
| 136 |
+
*/
|
| 137 |
+
async getTaskResult(taskId, resultSchema, options) {
|
| 138 |
+
// Delegate to the client's underlying Protocol method
|
| 139 |
+
return this._client.getTaskResult({ taskId }, resultSchema, options);
|
| 140 |
+
}
|
| 141 |
+
/**
|
| 142 |
+
* Lists tasks with optional pagination.
|
| 143 |
+
*
|
| 144 |
+
* @param cursor - Optional pagination cursor
|
| 145 |
+
* @param options - Optional request options
|
| 146 |
+
* @returns List of tasks with optional next cursor
|
| 147 |
+
*
|
| 148 |
+
* @experimental
|
| 149 |
+
*/
|
| 150 |
+
async listTasks(cursor, options) {
|
| 151 |
+
// Delegate to the client's underlying Protocol method
|
| 152 |
+
return this._client.listTasks(cursor ? { cursor } : undefined, options);
|
| 153 |
+
}
|
| 154 |
+
/**
|
| 155 |
+
* Cancels a running task.
|
| 156 |
+
*
|
| 157 |
+
* @param taskId - The task identifier
|
| 158 |
+
* @param options - Optional request options
|
| 159 |
+
*
|
| 160 |
+
* @experimental
|
| 161 |
+
*/
|
| 162 |
+
async cancelTask(taskId, options) {
|
| 163 |
+
// Delegate to the client's underlying Protocol method
|
| 164 |
+
return this._client.cancelTask({ taskId }, options);
|
| 165 |
+
}
|
| 166 |
+
/**
|
| 167 |
+
* Sends a request and returns an AsyncGenerator that yields response messages.
|
| 168 |
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
| 169 |
+
*
|
| 170 |
+
* This method provides streaming access to request processing, allowing you to
|
| 171 |
+
* observe intermediate task status updates for task-augmented requests.
|
| 172 |
+
*
|
| 173 |
+
* @param request - The request to send
|
| 174 |
+
* @param resultSchema - Zod schema for validating the result
|
| 175 |
+
* @param options - Optional request options (timeout, signal, task creation params, etc.)
|
| 176 |
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
| 177 |
+
*
|
| 178 |
+
* @experimental
|
| 179 |
+
*/
|
| 180 |
+
requestStream(request, resultSchema, options) {
|
| 181 |
+
return this._client.requestStream(request, resultSchema, options);
|
| 182 |
+
}
|
| 183 |
+
}
|
| 184 |
+
//# sourceMappingURL=client.js.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,EAAE,oBAAoB,EAA0C,QAAQ,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAkBnH;;;;;;;;;;GAUG;AACH,MAAM,OAAO,uBAAuB;IAKhC,YAA6B,OAAiD;QAAjD,YAAO,GAAP,OAAO,CAA0C;IAAG,CAAC;IAElF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,KAAK,CAAC,CAAC,cAAc,CACjB,MAAiC,EACjC,eAAkB,oBAAyB,EAC3C,OAAwB;QAExB,mCAAmC;QACnC,MAAM,cAAc,GAAG,IAAI,CAAC,OAA8C,CAAC;QAE3E,iFAAiF;QACjF,MAAM,eAAe,GAAG;YACpB,GAAG,OAAO;YACV,mFAAmF;YACnF,mEAAmE;YACnE,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SACnF,CAAC;QAEF,MAAM,MAAM,GAAG,cAAc,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;QAE7G,+DAA+D;QAC/D,MAAM,SAAS,GAAG,cAAc,CAAC,sBAAsB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAErE,qEAAqE;QACrE,IAAI,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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Experimental task capability assertion helpers.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* @experimental
|
| 6 |
+
*/
|
| 7 |
+
/**
|
| 8 |
+
* Type representing the task requests capability structure.
|
| 9 |
+
* This is derived from ClientTasksCapability.requests and ServerTasksCapability.requests.
|
| 10 |
+
*/
|
| 11 |
+
interface TaskRequestsCapability {
|
| 12 |
+
tools?: {
|
| 13 |
+
call?: object;
|
| 14 |
+
};
|
| 15 |
+
sampling?: {
|
| 16 |
+
createMessage?: object;
|
| 17 |
+
};
|
| 18 |
+
elicitation?: {
|
| 19 |
+
create?: object;
|
| 20 |
+
};
|
| 21 |
+
}
|
| 22 |
+
/**
|
| 23 |
+
* Asserts that task creation is supported for tools/call.
|
| 24 |
+
* Used by Client.assertTaskCapability and Server.assertTaskHandlerCapability.
|
| 25 |
+
*
|
| 26 |
+
* @param requests - The task requests capability object
|
| 27 |
+
* @param method - The method being checked
|
| 28 |
+
* @param entityName - 'Server' or 'Client' for error messages
|
| 29 |
+
* @throws Error if the capability is not supported
|
| 30 |
+
*
|
| 31 |
+
* @experimental
|
| 32 |
+
*/
|
| 33 |
+
export declare function assertToolsCallTaskCapability(requests: TaskRequestsCapability | undefined, method: string, entityName: 'Server' | 'Client'): void;
|
| 34 |
+
/**
|
| 35 |
+
* Asserts that task creation is supported for sampling/createMessage or elicitation/create.
|
| 36 |
+
* Used by Server.assertTaskCapability and Client.assertTaskHandlerCapability.
|
| 37 |
+
*
|
| 38 |
+
* @param requests - The task requests capability object
|
| 39 |
+
* @param method - The method being checked
|
| 40 |
+
* @param entityName - 'Server' or 'Client' for error messages
|
| 41 |
+
* @throws Error if the capability is not supported
|
| 42 |
+
*
|
| 43 |
+
* @experimental
|
| 44 |
+
*/
|
| 45 |
+
export declare function assertClientRequestTaskCapability(requests: TaskRequestsCapability | undefined, method: string, entityName: 'Server' | 'Client'): void;
|
| 46 |
+
export {};
|
| 47 |
+
//# sourceMappingURL=helpers.d.ts.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,UAAU,sBAAsB;IAC5B,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,WAAW,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACrC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CACzC,QAAQ,EAAE,sBAAsB,GAAG,SAAS,EAC5C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,QAAQ,GAAG,QAAQ,GAChC,IAAI,CAgBN;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iCAAiC,CAC7C,QAAQ,EAAE,sBAAsB,GAAG,SAAS,EAC5C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,QAAQ,GAAG,QAAQ,GAChC,IAAI,CAsBN"}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Experimental task capability assertion helpers.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* @experimental
|
| 6 |
+
*/
|
| 7 |
+
/**
|
| 8 |
+
* Asserts that task creation is supported for tools/call.
|
| 9 |
+
* Used by Client.assertTaskCapability and Server.assertTaskHandlerCapability.
|
| 10 |
+
*
|
| 11 |
+
* @param requests - The task requests capability object
|
| 12 |
+
* @param method - The method being checked
|
| 13 |
+
* @param entityName - 'Server' or 'Client' for error messages
|
| 14 |
+
* @throws Error if the capability is not supported
|
| 15 |
+
*
|
| 16 |
+
* @experimental
|
| 17 |
+
*/
|
| 18 |
+
export function assertToolsCallTaskCapability(requests, method, entityName) {
|
| 19 |
+
if (!requests) {
|
| 20 |
+
throw new Error(`${entityName} does not support task creation (required for ${method})`);
|
| 21 |
+
}
|
| 22 |
+
switch (method) {
|
| 23 |
+
case 'tools/call':
|
| 24 |
+
if (!requests.tools?.call) {
|
| 25 |
+
throw new Error(`${entityName} does not support task creation for tools/call (required for ${method})`);
|
| 26 |
+
}
|
| 27 |
+
break;
|
| 28 |
+
default:
|
| 29 |
+
// Method doesn't support tasks, which is fine - no error
|
| 30 |
+
break;
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
/**
|
| 34 |
+
* Asserts that task creation is supported for sampling/createMessage or elicitation/create.
|
| 35 |
+
* Used by Server.assertTaskCapability and Client.assertTaskHandlerCapability.
|
| 36 |
+
*
|
| 37 |
+
* @param requests - The task requests capability object
|
| 38 |
+
* @param method - The method being checked
|
| 39 |
+
* @param entityName - 'Server' or 'Client' for error messages
|
| 40 |
+
* @throws Error if the capability is not supported
|
| 41 |
+
*
|
| 42 |
+
* @experimental
|
| 43 |
+
*/
|
| 44 |
+
export function assertClientRequestTaskCapability(requests, method, entityName) {
|
| 45 |
+
if (!requests) {
|
| 46 |
+
throw new Error(`${entityName} does not support task creation (required for ${method})`);
|
| 47 |
+
}
|
| 48 |
+
switch (method) {
|
| 49 |
+
case 'sampling/createMessage':
|
| 50 |
+
if (!requests.sampling?.createMessage) {
|
| 51 |
+
throw new Error(`${entityName} does not support task creation for sampling/createMessage (required for ${method})`);
|
| 52 |
+
}
|
| 53 |
+
break;
|
| 54 |
+
case 'elicitation/create':
|
| 55 |
+
if (!requests.elicitation?.create) {
|
| 56 |
+
throw new Error(`${entityName} does not support task creation for elicitation/create (required for ${method})`);
|
| 57 |
+
}
|
| 58 |
+
break;
|
| 59 |
+
default:
|
| 60 |
+
// Method doesn't support tasks, which is fine - no error
|
| 61 |
+
break;
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
//# sourceMappingURL=helpers.js.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,6BAA6B,CACzC,QAA4C,EAC5C,MAAc,EACd,UAA+B;IAE/B,IAAI,CAAC,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
|
|
| 1 |
+
/**
|
| 2 |
+
* Experimental task features for MCP SDK.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* @experimental
|
| 6 |
+
*/
|
| 7 |
+
export * from './types.js';
|
| 8 |
+
export * from './interfaces.js';
|
| 9 |
+
export * from './helpers.js';
|
| 10 |
+
export * from './client.js';
|
| 11 |
+
export * from './server.js';
|
| 12 |
+
export * from './mcp-server.js';
|
| 13 |
+
export * from './stores/in-memory.js';
|
| 14 |
+
export type { ResponseMessage, TaskStatusMessage, TaskCreatedMessage, ResultMessage, ErrorMessage, BaseResponseMessage } from '../../shared/responseMessage.js';
|
| 15 |
+
export { takeResult, toArrayAsync } from '../../shared/responseMessage.js';
|
| 16 |
+
//# sourceMappingURL=index.d.ts.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,cAAc,CAAC;AAG7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,uBAAuB,CAAC;AAGtC,YAAY,EACR,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,mBAAmB,EACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC"}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Experimental task features for MCP SDK.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* @experimental
|
| 6 |
+
*/
|
| 7 |
+
// Re-export spec types for convenience
|
| 8 |
+
export * from './types.js';
|
| 9 |
+
// SDK implementation interfaces
|
| 10 |
+
export * from './interfaces.js';
|
| 11 |
+
// Assertion helpers
|
| 12 |
+
export * from './helpers.js';
|
| 13 |
+
// Wrapper classes
|
| 14 |
+
export * from './client.js';
|
| 15 |
+
export * from './server.js';
|
| 16 |
+
export * from './mcp-server.js';
|
| 17 |
+
// Store implementations
|
| 18 |
+
export * from './stores/in-memory.js';
|
| 19 |
+
export { takeResult, toArrayAsync } from '../../shared/responseMessage.js';
|
| 20 |
+
//# sourceMappingURL=index.js.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uCAAuC;AACvC,cAAc,YAAY,CAAC;AAE3B,gCAAgC;AAChC,cAAc,iBAAiB,CAAC;AAEhC,oBAAoB;AACpB,cAAc,cAAc,CAAC;AAE7B,kBAAkB;AAClB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAEhC,wBAAwB;AACxB,cAAc,uBAAuB,CAAC;AAWtC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC"}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Experimental task interfaces for MCP SDK.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*/
|
| 5 |
+
import { Task, RequestId, Result, JSONRPCRequest, JSONRPCNotification, JSONRPCResultResponse, JSONRPCErrorResponse, ServerRequest, ServerNotification, CallToolResult, GetTaskResult, ToolExecution, Request } from '../../types.js';
|
| 6 |
+
import { CreateTaskResult } from './types.js';
|
| 7 |
+
import type { RequestHandlerExtra, RequestTaskStore } from '../../shared/protocol.js';
|
| 8 |
+
import type { ZodRawShapeCompat, AnySchema, ShapeOutput } from '../../server/zod-compat.js';
|
| 9 |
+
/**
|
| 10 |
+
* Extended handler extra with task store for task creation.
|
| 11 |
+
* @experimental
|
| 12 |
+
*/
|
| 13 |
+
export interface CreateTaskRequestHandlerExtra extends RequestHandlerExtra<ServerRequest, ServerNotification> {
|
| 14 |
+
taskStore: RequestTaskStore;
|
| 15 |
+
}
|
| 16 |
+
/**
|
| 17 |
+
* Extended handler extra with task ID and store for task operations.
|
| 18 |
+
* @experimental
|
| 19 |
+
*/
|
| 20 |
+
export interface TaskRequestHandlerExtra extends RequestHandlerExtra<ServerRequest, ServerNotification> {
|
| 21 |
+
taskId: string;
|
| 22 |
+
taskStore: RequestTaskStore;
|
| 23 |
+
}
|
| 24 |
+
/**
|
| 25 |
+
* Base callback type for tool handlers.
|
| 26 |
+
* @experimental
|
| 27 |
+
*/
|
| 28 |
+
export type BaseToolCallback<SendResultT extends Result, ExtraT extends RequestHandlerExtra<ServerRequest, ServerNotification>, Args extends undefined | ZodRawShapeCompat | AnySchema = undefined> = Args extends ZodRawShapeCompat ? (args: ShapeOutput<Args>, extra: ExtraT) => SendResultT | Promise<SendResultT> : Args extends AnySchema ? (args: unknown, extra: ExtraT) => SendResultT | Promise<SendResultT> : (extra: ExtraT) => SendResultT | Promise<SendResultT>;
|
| 29 |
+
/**
|
| 30 |
+
* Handler for creating a task.
|
| 31 |
+
* @experimental
|
| 32 |
+
*/
|
| 33 |
+
export type CreateTaskRequestHandler<SendResultT extends Result, Args extends undefined | ZodRawShapeCompat | AnySchema = undefined> = BaseToolCallback<SendResultT, CreateTaskRequestHandlerExtra, Args>;
|
| 34 |
+
/**
|
| 35 |
+
* Handler for task operations (get, getResult).
|
| 36 |
+
* @experimental
|
| 37 |
+
*/
|
| 38 |
+
export type TaskRequestHandler<SendResultT extends Result, Args extends undefined | ZodRawShapeCompat | AnySchema = undefined> = BaseToolCallback<SendResultT, TaskRequestHandlerExtra, Args>;
|
| 39 |
+
/**
|
| 40 |
+
* Interface for task-based tool handlers.
|
| 41 |
+
* @experimental
|
| 42 |
+
*/
|
| 43 |
+
export interface ToolTaskHandler<Args extends undefined | ZodRawShapeCompat | AnySchema = undefined> {
|
| 44 |
+
createTask: CreateTaskRequestHandler<CreateTaskResult, Args>;
|
| 45 |
+
getTask: TaskRequestHandler<GetTaskResult, Args>;
|
| 46 |
+
getTaskResult: TaskRequestHandler<CallToolResult, Args>;
|
| 47 |
+
}
|
| 48 |
+
/**
|
| 49 |
+
* Task-specific execution configuration.
|
| 50 |
+
* taskSupport cannot be 'forbidden' for task-based tools.
|
| 51 |
+
* @experimental
|
| 52 |
+
*/
|
| 53 |
+
export type TaskToolExecution<TaskSupport = ToolExecution['taskSupport']> = Omit<ToolExecution, 'taskSupport'> & {
|
| 54 |
+
taskSupport: TaskSupport extends 'forbidden' | undefined ? never : TaskSupport;
|
| 55 |
+
};
|
| 56 |
+
/**
|
| 57 |
+
* Represents a message queued for side-channel delivery via tasks/result.
|
| 58 |
+
*
|
| 59 |
+
* This is a serializable data structure that can be stored in external systems.
|
| 60 |
+
* All fields are JSON-serializable.
|
| 61 |
+
*/
|
| 62 |
+
export type QueuedMessage = QueuedRequest | QueuedNotification | QueuedResponse | QueuedError;
|
| 63 |
+
export interface BaseQueuedMessage {
|
| 64 |
+
/** Type of message */
|
| 65 |
+
type: string;
|
| 66 |
+
/** When the message was queued (milliseconds since epoch) */
|
| 67 |
+
timestamp: number;
|
| 68 |
+
}
|
| 69 |
+
export interface QueuedRequest extends BaseQueuedMessage {
|
| 70 |
+
type: 'request';
|
| 71 |
+
/** The actual JSONRPC request */
|
| 72 |
+
message: JSONRPCRequest;
|
| 73 |
+
}
|
| 74 |
+
export interface QueuedNotification extends BaseQueuedMessage {
|
| 75 |
+
type: 'notification';
|
| 76 |
+
/** The actual JSONRPC notification */
|
| 77 |
+
message: JSONRPCNotification;
|
| 78 |
+
}
|
| 79 |
+
export interface QueuedResponse extends BaseQueuedMessage {
|
| 80 |
+
type: 'response';
|
| 81 |
+
/** The actual JSONRPC response */
|
| 82 |
+
message: JSONRPCResultResponse;
|
| 83 |
+
}
|
| 84 |
+
export interface QueuedError extends BaseQueuedMessage {
|
| 85 |
+
type: 'error';
|
| 86 |
+
/** The actual JSONRPC error */
|
| 87 |
+
message: JSONRPCErrorResponse;
|
| 88 |
+
}
|
| 89 |
+
/**
|
| 90 |
+
* Interface for managing per-task FIFO message queues.
|
| 91 |
+
*
|
| 92 |
+
* Similar to TaskStore, this allows pluggable queue implementations
|
| 93 |
+
* (in-memory, Redis, other distributed queues, etc.).
|
| 94 |
+
*
|
| 95 |
+
* Each method accepts taskId and optional sessionId parameters to enable
|
| 96 |
+
* a single queue instance to manage messages for multiple tasks, with
|
| 97 |
+
* isolation based on task ID and session ID.
|
| 98 |
+
*
|
| 99 |
+
* All methods are async to support external storage implementations.
|
| 100 |
+
* All data in QueuedMessage must be JSON-serializable.
|
| 101 |
+
*
|
| 102 |
+
* @experimental
|
| 103 |
+
*/
|
| 104 |
+
export interface TaskMessageQueue {
|
| 105 |
+
/**
|
| 106 |
+
* Adds a message to the end of the queue for a specific task.
|
| 107 |
+
* Atomically checks queue size and throws if maxSize would be exceeded.
|
| 108 |
+
* @param taskId The task identifier
|
| 109 |
+
* @param message The message to enqueue
|
| 110 |
+
* @param sessionId Optional session ID for binding the operation to a specific session
|
| 111 |
+
* @param maxSize Optional maximum queue size - if specified and queue is full, throws an error
|
| 112 |
+
* @throws Error if maxSize is specified and would be exceeded
|
| 113 |
+
*/
|
| 114 |
+
enqueue(taskId: string, message: QueuedMessage, sessionId?: string, maxSize?: number): Promise<void>;
|
| 115 |
+
/**
|
| 116 |
+
* Removes and returns the first message from the queue for a specific task.
|
| 117 |
+
* @param taskId The task identifier
|
| 118 |
+
* @param sessionId Optional session ID for binding the query to a specific session
|
| 119 |
+
* @returns The first message, or undefined if the queue is empty
|
| 120 |
+
*/
|
| 121 |
+
dequeue(taskId: string, sessionId?: string): Promise<QueuedMessage | undefined>;
|
| 122 |
+
/**
|
| 123 |
+
* Removes and returns all messages from the queue for a specific task.
|
| 124 |
+
* Used when tasks are cancelled or failed to clean up pending messages.
|
| 125 |
+
* @param taskId The task identifier
|
| 126 |
+
* @param sessionId Optional session ID for binding the query to a specific session
|
| 127 |
+
* @returns Array of all messages that were in the queue
|
| 128 |
+
*/
|
| 129 |
+
dequeueAll(taskId: string, sessionId?: string): Promise<QueuedMessage[]>;
|
| 130 |
+
}
|
| 131 |
+
/**
|
| 132 |
+
* Task creation options.
|
| 133 |
+
* @experimental
|
| 134 |
+
*/
|
| 135 |
+
export interface CreateTaskOptions {
|
| 136 |
+
/**
|
| 137 |
+
* Time in milliseconds to keep task results available after completion.
|
| 138 |
+
* If null, the task has unlimited lifetime until manually cleaned up.
|
| 139 |
+
*/
|
| 140 |
+
ttl?: number | null;
|
| 141 |
+
/**
|
| 142 |
+
* Time in milliseconds to wait between task status requests.
|
| 143 |
+
*/
|
| 144 |
+
pollInterval?: number;
|
| 145 |
+
/**
|
| 146 |
+
* Additional context to pass to the task store.
|
| 147 |
+
*/
|
| 148 |
+
context?: Record<string, unknown>;
|
| 149 |
+
}
|
| 150 |
+
/**
|
| 151 |
+
* Interface for storing and retrieving task state and results.
|
| 152 |
+
*
|
| 153 |
+
* Similar to Transport, this allows pluggable task storage implementations
|
| 154 |
+
* (in-memory, database, distributed cache, etc.).
|
| 155 |
+
*
|
| 156 |
+
* @experimental
|
| 157 |
+
*/
|
| 158 |
+
export interface TaskStore {
|
| 159 |
+
/**
|
| 160 |
+
* Creates a new task with the given creation parameters and original request.
|
| 161 |
+
* The implementation must generate a unique taskId and createdAt timestamp.
|
| 162 |
+
*
|
| 163 |
+
* TTL Management:
|
| 164 |
+
* - The implementation receives the TTL suggested by the requestor via taskParams.ttl
|
| 165 |
+
* - The implementation MAY override the requested TTL (e.g., to enforce limits)
|
| 166 |
+
* - The actual TTL used MUST be returned in the Task object
|
| 167 |
+
* - Null TTL indicates unlimited task lifetime (no automatic cleanup)
|
| 168 |
+
* - Cleanup SHOULD occur automatically after TTL expires, regardless of task status
|
| 169 |
+
*
|
| 170 |
+
* @param taskParams - The task creation parameters from the request (ttl, pollInterval)
|
| 171 |
+
* @param requestId - The JSON-RPC request ID
|
| 172 |
+
* @param request - The original request that triggered task creation
|
| 173 |
+
* @param sessionId - Optional session ID for binding the task to a specific session
|
| 174 |
+
* @returns The created task object
|
| 175 |
+
*/
|
| 176 |
+
createTask(taskParams: CreateTaskOptions, requestId: RequestId, request: Request, sessionId?: string): Promise<Task>;
|
| 177 |
+
/**
|
| 178 |
+
* Gets the current status of a task.
|
| 179 |
+
*
|
| 180 |
+
* @param taskId - The task identifier
|
| 181 |
+
* @param sessionId - Optional session ID for binding the query to a specific session
|
| 182 |
+
* @returns The task object, or null if it does not exist
|
| 183 |
+
*/
|
| 184 |
+
getTask(taskId: string, sessionId?: string): Promise<Task | null>;
|
| 185 |
+
/**
|
| 186 |
+
* Stores the result of a task and sets its final status.
|
| 187 |
+
*
|
| 188 |
+
* @param taskId - The task identifier
|
| 189 |
+
* @param status - The final status: 'completed' for success, 'failed' for errors
|
| 190 |
+
* @param result - The result to store
|
| 191 |
+
* @param sessionId - Optional session ID for binding the operation to a specific session
|
| 192 |
+
*/
|
| 193 |
+
storeTaskResult(taskId: string, status: 'completed' | 'failed', result: Result, sessionId?: string): Promise<void>;
|
| 194 |
+
/**
|
| 195 |
+
* Retrieves the stored result of a task.
|
| 196 |
+
*
|
| 197 |
+
* @param taskId - The task identifier
|
| 198 |
+
* @param sessionId - Optional session ID for binding the query to a specific session
|
| 199 |
+
* @returns The stored result
|
| 200 |
+
*/
|
| 201 |
+
getTaskResult(taskId: string, sessionId?: string): Promise<Result>;
|
| 202 |
+
/**
|
| 203 |
+
* Updates a task's status (e.g., to 'cancelled', 'failed', 'completed').
|
| 204 |
+
*
|
| 205 |
+
* @param taskId - The task identifier
|
| 206 |
+
* @param status - The new status
|
| 207 |
+
* @param statusMessage - Optional diagnostic message for failed tasks or other status information
|
| 208 |
+
* @param sessionId - Optional session ID for binding the operation to a specific session
|
| 209 |
+
*/
|
| 210 |
+
updateTaskStatus(taskId: string, status: Task['status'], statusMessage?: string, sessionId?: string): Promise<void>;
|
| 211 |
+
/**
|
| 212 |
+
* Lists tasks, optionally starting from a pagination cursor.
|
| 213 |
+
*
|
| 214 |
+
* @param cursor - Optional cursor for pagination
|
| 215 |
+
* @param sessionId - Optional session ID for binding the query to a specific session
|
| 216 |
+
* @returns An object containing the tasks array and an optional nextCursor
|
| 217 |
+
*/
|
| 218 |
+
listTasks(cursor?: string, sessionId?: string): Promise<{
|
| 219 |
+
tasks: Task[];
|
| 220 |
+
nextCursor?: string;
|
| 221 |
+
}>;
|
| 222 |
+
}
|
| 223 |
+
/**
|
| 224 |
+
* Checks if a task status represents a terminal state.
|
| 225 |
+
* Terminal states are those where the task has finished and will not change.
|
| 226 |
+
*
|
| 227 |
+
* @param status - The task status to check
|
| 228 |
+
* @returns True if the status is terminal (completed, failed, or cancelled)
|
| 229 |
+
* @experimental
|
| 230 |
+
*/
|
| 231 |
+
export declare function isTerminal(status: Task['status']): boolean;
|
| 232 |
+
//# sourceMappingURL=interfaces.d.ts.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,IAAI,EACJ,SAAS,EACT,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,aAAa,EACb,OAAO,EACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAM5F;;;GAGG;AACH,MAAM,WAAW,6BAA8B,SAAQ,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC;IACzG,SAAS,EAAE,gBAAgB,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC;IACnG,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,gBAAgB,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CACxB,WAAW,SAAS,MAAM,E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AC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnG;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,OAAO,CAE1D"}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Experimental task interfaces for MCP SDK.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*/
|
| 5 |
+
/**
|
| 6 |
+
* Checks if a task status represents a terminal state.
|
| 7 |
+
* Terminal states are those where the task has finished and will not change.
|
| 8 |
+
*
|
| 9 |
+
* @param status - The task status to check
|
| 10 |
+
* @returns True if the status is terminal (completed, failed, or cancelled)
|
| 11 |
+
* @experimental
|
| 12 |
+
*/
|
| 13 |
+
export function isTerminal(status) {
|
| 14 |
+
return status === 'completed' || status === 'failed' || status === 'cancelled';
|
| 15 |
+
}
|
| 16 |
+
//# sourceMappingURL=interfaces.js.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmRH;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,MAAsB;IAC7C,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,WAAW,CAAC;AACnF,CAAC"}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Experimental McpServer task features for MCP SDK.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* @experimental
|
| 6 |
+
*/
|
| 7 |
+
import type { McpServer, RegisteredTool } from '../../server/mcp.js';
|
| 8 |
+
import type { ZodRawShapeCompat, AnySchema } from '../../server/zod-compat.js';
|
| 9 |
+
import type { ToolAnnotations } from '../../types.js';
|
| 10 |
+
import type { ToolTaskHandler, TaskToolExecution } from './interfaces.js';
|
| 11 |
+
/**
|
| 12 |
+
* Experimental task features for McpServer.
|
| 13 |
+
*
|
| 14 |
+
* Access via `server.experimental.tasks`:
|
| 15 |
+
* ```typescript
|
| 16 |
+
* server.experimental.tasks.registerToolTask('long-running', config, handler);
|
| 17 |
+
* ```
|
| 18 |
+
*
|
| 19 |
+
* @experimental
|
| 20 |
+
*/
|
| 21 |
+
export declare class ExperimentalMcpServerTasks {
|
| 22 |
+
private readonly _mcpServer;
|
| 23 |
+
constructor(_mcpServer: McpServer);
|
| 24 |
+
/**
|
| 25 |
+
* Registers a task-based tool with a config object and handler.
|
| 26 |
+
*
|
| 27 |
+
* Task-based tools support long-running operations that can be polled for status
|
| 28 |
+
* and results. The handler must implement `createTask`, `getTask`, and `getTaskResult`
|
| 29 |
+
* methods.
|
| 30 |
+
*
|
| 31 |
+
* @example
|
| 32 |
+
* ```typescript
|
| 33 |
+
* server.experimental.tasks.registerToolTask('long-computation', {
|
| 34 |
+
* description: 'Performs a long computation',
|
| 35 |
+
* inputSchema: { input: z.string() },
|
| 36 |
+
* execution: { taskSupport: 'required' }
|
| 37 |
+
* }, {
|
| 38 |
+
* createTask: async (args, extra) => {
|
| 39 |
+
* const task = await extra.taskStore.createTask({ ttl: 300000 });
|
| 40 |
+
* startBackgroundWork(task.taskId, args);
|
| 41 |
+
* return { task };
|
| 42 |
+
* },
|
| 43 |
+
* getTask: async (args, extra) => {
|
| 44 |
+
* return extra.taskStore.getTask(extra.taskId);
|
| 45 |
+
* },
|
| 46 |
+
* getTaskResult: async (args, extra) => {
|
| 47 |
+
* return extra.taskStore.getTaskResult(extra.taskId);
|
| 48 |
+
* }
|
| 49 |
+
* });
|
| 50 |
+
* ```
|
| 51 |
+
*
|
| 52 |
+
* @param name - The tool name
|
| 53 |
+
* @param config - Tool configuration (description, schemas, etc.)
|
| 54 |
+
* @param handler - Task handler with createTask, getTask, getTaskResult methods
|
| 55 |
+
* @returns RegisteredTool for managing the tool's lifecycle
|
| 56 |
+
*
|
| 57 |
+
* @experimental
|
| 58 |
+
*/
|
| 59 |
+
registerToolTask<OutputArgs extends undefined | ZodRawShapeCompat | AnySchema>(name: string, config: {
|
| 60 |
+
title?: string;
|
| 61 |
+
description?: string;
|
| 62 |
+
outputSchema?: OutputArgs;
|
| 63 |
+
annotations?: ToolAnnotations;
|
| 64 |
+
execution?: TaskToolExecution;
|
| 65 |
+
_meta?: Record<string, unknown>;
|
| 66 |
+
}, handler: ToolTaskHandler<undefined>): RegisteredTool;
|
| 67 |
+
registerToolTask<InputArgs extends ZodRawShapeCompat | AnySchema, OutputArgs extends undefined | ZodRawShapeCompat | AnySchema>(name: string, config: {
|
| 68 |
+
title?: string;
|
| 69 |
+
description?: string;
|
| 70 |
+
inputSchema: InputArgs;
|
| 71 |
+
outputSchema?: OutputArgs;
|
| 72 |
+
annotations?: ToolAnnotations;
|
| 73 |
+
execution?: TaskToolExecution;
|
| 74 |
+
_meta?: Record<string, unknown>;
|
| 75 |
+
}, handler: ToolTaskHandler<InputArgs>): RegisteredTool;
|
| 76 |
+
}
|
| 77 |
+
//# sourceMappingURL=mcp-server.d.ts.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAkB,MAAM,qBAAqB,CAAC;AACrF,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAoB1E;;;;;;;;;GASG;AACH,qBAAa,0BAA0B;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,SAAS;IAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,gBAAgB,CAAC,UAAU,SAAS,SAAS,GAAG,iBAAiB,GAAG,SAAS,EACzE,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,UAAU,CAAC;QAC1B,WAAW,CAAC,EAAE,eAAe,CAAC;QAC9B,SAAS,CAAC,EAAE,iBAAiB,CAAC;QAC9B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,EACD,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,GACpC,cAAc;IAEjB,gBAAgB,CAAC,SAAS,SAAS,iBAAiB,GAAG,SAAS,EAAE,UAAU,SAAS,SAAS,GAAG,iBAAiB,GAAG,SAAS,EAC1H,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,SAAS,CAAC;QACvB,YAAY,CAAC,EAAE,UAAU,CAAC;QAC1B,WAAW,CAAC,EAAE,eAAe,CAAC;QAC9B,SAAS,CAAC,EAAE,iBAAiB,CAAC;QAC9B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,EACD,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,GACpC,cAAc;CAsCpB"}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Experimental McpServer task features for MCP SDK.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* @experimental
|
| 6 |
+
*/
|
| 7 |
+
/**
|
| 8 |
+
* Experimental task features for McpServer.
|
| 9 |
+
*
|
| 10 |
+
* Access via `server.experimental.tasks`:
|
| 11 |
+
* ```typescript
|
| 12 |
+
* server.experimental.tasks.registerToolTask('long-running', config, handler);
|
| 13 |
+
* ```
|
| 14 |
+
*
|
| 15 |
+
* @experimental
|
| 16 |
+
*/
|
| 17 |
+
export class ExperimentalMcpServerTasks {
|
| 18 |
+
constructor(_mcpServer) {
|
| 19 |
+
this._mcpServer = _mcpServer;
|
| 20 |
+
}
|
| 21 |
+
registerToolTask(name, config, handler) {
|
| 22 |
+
// Validate that taskSupport is not 'forbidden' for task-based tools
|
| 23 |
+
const execution = { taskSupport: 'required', ...config.execution };
|
| 24 |
+
if (execution.taskSupport === 'forbidden') {
|
| 25 |
+
throw new Error(`Cannot register task-based tool '${name}' with taskSupport 'forbidden'. Use registerTool() instead.`);
|
| 26 |
+
}
|
| 27 |
+
// Access McpServer's internal _createRegisteredTool method
|
| 28 |
+
const mcpServerInternal = this._mcpServer;
|
| 29 |
+
return mcpServerInternal._createRegisteredTool(name, config.title, config.description, config.inputSchema, config.outputSchema, config.annotations, execution, config._meta, handler);
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
//# sourceMappingURL=mcp-server.js.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyBH;;;;;;;;;GASG;AACH,MAAM,OAAO,0BAA0B;IACnC,YAA6B,UAAqB;QAArB,eAAU,GAAV,UAAU,CAAW;IAAG,CAAC;IAgEtD,gBAAgB,CAIZ,IAAY,EACZ,MAQC,EACD,OAAmC;QAEnC,oEAAoE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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Experimental server task features for MCP SDK.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* @experimental
|
| 6 |
+
*/
|
| 7 |
+
import type { Server } from '../../server/index.js';
|
| 8 |
+
import type { RequestOptions } from '../../shared/protocol.js';
|
| 9 |
+
import type { ResponseMessage } from '../../shared/responseMessage.js';
|
| 10 |
+
import type { AnySchema, SchemaOutput } from '../../server/zod-compat.js';
|
| 11 |
+
import type { ServerRequest, Notification, Request, Result, GetTaskResult, ListTasksResult, CancelTaskResult, CreateMessageRequestParams, CreateMessageResult, ElicitRequestFormParams, ElicitRequestURLParams, ElicitResult } from '../../types.js';
|
| 12 |
+
/**
|
| 13 |
+
* Experimental task features for low-level MCP servers.
|
| 14 |
+
*
|
| 15 |
+
* Access via `server.experimental.tasks`:
|
| 16 |
+
* ```typescript
|
| 17 |
+
* const stream = server.experimental.tasks.requestStream(request, schema, options);
|
| 18 |
+
* ```
|
| 19 |
+
*
|
| 20 |
+
* For high-level server usage with task-based tools, use `McpServer.experimental.tasks` instead.
|
| 21 |
+
*
|
| 22 |
+
* @experimental
|
| 23 |
+
*/
|
| 24 |
+
export declare class ExperimentalServerTasks<RequestT extends Request = Request, NotificationT extends Notification = Notification, ResultT extends Result = Result> {
|
| 25 |
+
private readonly _server;
|
| 26 |
+
constructor(_server: Server<RequestT, NotificationT, ResultT>);
|
| 27 |
+
/**
|
| 28 |
+
* Sends a request and returns an AsyncGenerator that yields response messages.
|
| 29 |
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
| 30 |
+
*
|
| 31 |
+
* This method provides streaming access to request processing, allowing you to
|
| 32 |
+
* observe intermediate task status updates for task-augmented requests.
|
| 33 |
+
*
|
| 34 |
+
* @param request - The request to send
|
| 35 |
+
* @param resultSchema - Zod schema for validating the result
|
| 36 |
+
* @param options - Optional request options (timeout, signal, task creation params, etc.)
|
| 37 |
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
| 38 |
+
*
|
| 39 |
+
* @experimental
|
| 40 |
+
*/
|
| 41 |
+
requestStream<T extends AnySchema>(request: ServerRequest | RequestT, resultSchema: T, options?: RequestOptions): AsyncGenerator<ResponseMessage<SchemaOutput<T>>, void, void>;
|
| 42 |
+
/**
|
| 43 |
+
* Sends a sampling request and returns an AsyncGenerator that yields response messages.
|
| 44 |
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
| 45 |
+
*
|
| 46 |
+
* For task-augmented requests, yields 'taskCreated' and 'taskStatus' messages
|
| 47 |
+
* before the final result.
|
| 48 |
+
*
|
| 49 |
+
* @example
|
| 50 |
+
* ```typescript
|
| 51 |
+
* const stream = server.experimental.tasks.createMessageStream({
|
| 52 |
+
* messages: [{ role: 'user', content: { type: 'text', text: 'Hello' } }],
|
| 53 |
+
* maxTokens: 100
|
| 54 |
+
* }, {
|
| 55 |
+
* onprogress: (progress) => {
|
| 56 |
+
* // Handle streaming tokens via progress notifications
|
| 57 |
+
* console.log('Progress:', progress.message);
|
| 58 |
+
* }
|
| 59 |
+
* });
|
| 60 |
+
*
|
| 61 |
+
* for await (const message of stream) {
|
| 62 |
+
* switch (message.type) {
|
| 63 |
+
* case 'taskCreated':
|
| 64 |
+
* console.log('Task created:', message.task.taskId);
|
| 65 |
+
* break;
|
| 66 |
+
* case 'taskStatus':
|
| 67 |
+
* console.log('Task status:', message.task.status);
|
| 68 |
+
* break;
|
| 69 |
+
* case 'result':
|
| 70 |
+
* console.log('Final result:', message.result);
|
| 71 |
+
* break;
|
| 72 |
+
* case 'error':
|
| 73 |
+
* console.error('Error:', message.error);
|
| 74 |
+
* break;
|
| 75 |
+
* }
|
| 76 |
+
* }
|
| 77 |
+
* ```
|
| 78 |
+
*
|
| 79 |
+
* @param params - The sampling request parameters
|
| 80 |
+
* @param options - Optional request options (timeout, signal, task creation params, onprogress, etc.)
|
| 81 |
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
| 82 |
+
*
|
| 83 |
+
* @experimental
|
| 84 |
+
*/
|
| 85 |
+
createMessageStream(params: CreateMessageRequestParams, options?: RequestOptions): AsyncGenerator<ResponseMessage<CreateMessageResult>, void, void>;
|
| 86 |
+
/**
|
| 87 |
+
* Sends an elicitation request and returns an AsyncGenerator that yields response messages.
|
| 88 |
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
| 89 |
+
*
|
| 90 |
+
* For task-augmented requests (especially URL-based elicitation), yields 'taskCreated'
|
| 91 |
+
* and 'taskStatus' messages before the final result.
|
| 92 |
+
*
|
| 93 |
+
* @example
|
| 94 |
+
* ```typescript
|
| 95 |
+
* const stream = server.experimental.tasks.elicitInputStream({
|
| 96 |
+
* mode: 'url',
|
| 97 |
+
* message: 'Please authenticate',
|
| 98 |
+
* elicitationId: 'auth-123',
|
| 99 |
+
* url: 'https://example.com/auth'
|
| 100 |
+
* }, {
|
| 101 |
+
* task: { ttl: 300000 } // Task-augmented for long-running auth flow
|
| 102 |
+
* });
|
| 103 |
+
*
|
| 104 |
+
* for await (const message of stream) {
|
| 105 |
+
* switch (message.type) {
|
| 106 |
+
* case 'taskCreated':
|
| 107 |
+
* console.log('Task created:', message.task.taskId);
|
| 108 |
+
* break;
|
| 109 |
+
* case 'taskStatus':
|
| 110 |
+
* console.log('Task status:', message.task.status);
|
| 111 |
+
* break;
|
| 112 |
+
* case 'result':
|
| 113 |
+
* console.log('User action:', message.result.action);
|
| 114 |
+
* break;
|
| 115 |
+
* case 'error':
|
| 116 |
+
* console.error('Error:', message.error);
|
| 117 |
+
* break;
|
| 118 |
+
* }
|
| 119 |
+
* }
|
| 120 |
+
* ```
|
| 121 |
+
*
|
| 122 |
+
* @param params - The elicitation request parameters
|
| 123 |
+
* @param options - Optional request options (timeout, signal, task creation params, etc.)
|
| 124 |
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
| 125 |
+
*
|
| 126 |
+
* @experimental
|
| 127 |
+
*/
|
| 128 |
+
elicitInputStream(params: ElicitRequestFormParams | ElicitRequestURLParams, options?: RequestOptions): AsyncGenerator<ResponseMessage<ElicitResult>, void, void>;
|
| 129 |
+
/**
|
| 130 |
+
* Gets the current status of a task.
|
| 131 |
+
*
|
| 132 |
+
* @param taskId - The task identifier
|
| 133 |
+
* @param options - Optional request options
|
| 134 |
+
* @returns The task status
|
| 135 |
+
*
|
| 136 |
+
* @experimental
|
| 137 |
+
*/
|
| 138 |
+
getTask(taskId: string, options?: RequestOptions): Promise<GetTaskResult>;
|
| 139 |
+
/**
|
| 140 |
+
* Retrieves the result of a completed task.
|
| 141 |
+
*
|
| 142 |
+
* @param taskId - The task identifier
|
| 143 |
+
* @param resultSchema - Zod schema for validating the result
|
| 144 |
+
* @param options - Optional request options
|
| 145 |
+
* @returns The task result
|
| 146 |
+
*
|
| 147 |
+
* @experimental
|
| 148 |
+
*/
|
| 149 |
+
getTaskResult<T extends AnySchema>(taskId: string, resultSchema?: T, options?: RequestOptions): Promise<SchemaOutput<T>>;
|
| 150 |
+
/**
|
| 151 |
+
* Lists tasks with optional pagination.
|
| 152 |
+
*
|
| 153 |
+
* @param cursor - Optional pagination cursor
|
| 154 |
+
* @param options - Optional request options
|
| 155 |
+
* @returns List of tasks with optional next cursor
|
| 156 |
+
*
|
| 157 |
+
* @experimental
|
| 158 |
+
*/
|
| 159 |
+
listTasks(cursor?: string, options?: RequestOptions): Promise<ListTasksResult>;
|
| 160 |
+
/**
|
| 161 |
+
* Cancels a running task.
|
| 162 |
+
*
|
| 163 |
+
* @param taskId - The task identifier
|
| 164 |
+
* @param options - Optional request options
|
| 165 |
+
*
|
| 166 |
+
* @experimental
|
| 167 |
+
*/
|
| 168 |
+
cancelTask(taskId: string, options?: RequestOptions): Promise<CancelTaskResult>;
|
| 169 |
+
}
|
| 170 |
+
//# sourceMappingURL=server.d.ts.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK,EACR,aAAa,EACb,YAAY,EACZ,OAAO,EACP,MAAM,EACN,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,0BAA0B,EAC1B,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,YAAY,EACf,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;;;;;GAWG;AACH,qBAAa,uBAAuB,CAChC,QAAQ,SAAS,OAAO,GAAG,OAAO,E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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Experimental server task features for MCP SDK.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* @experimental
|
| 6 |
+
*/
|
| 7 |
+
import { CreateMessageResultSchema, ElicitResultSchema } from '../../types.js';
|
| 8 |
+
/**
|
| 9 |
+
* Experimental task features for low-level MCP servers.
|
| 10 |
+
*
|
| 11 |
+
* Access via `server.experimental.tasks`:
|
| 12 |
+
* ```typescript
|
| 13 |
+
* const stream = server.experimental.tasks.requestStream(request, schema, options);
|
| 14 |
+
* ```
|
| 15 |
+
*
|
| 16 |
+
* For high-level server usage with task-based tools, use `McpServer.experimental.tasks` instead.
|
| 17 |
+
*
|
| 18 |
+
* @experimental
|
| 19 |
+
*/
|
| 20 |
+
export class ExperimentalServerTasks {
|
| 21 |
+
constructor(_server) {
|
| 22 |
+
this._server = _server;
|
| 23 |
+
}
|
| 24 |
+
/**
|
| 25 |
+
* Sends a request and returns an AsyncGenerator that yields response messages.
|
| 26 |
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
| 27 |
+
*
|
| 28 |
+
* This method provides streaming access to request processing, allowing you to
|
| 29 |
+
* observe intermediate task status updates for task-augmented requests.
|
| 30 |
+
*
|
| 31 |
+
* @param request - The request to send
|
| 32 |
+
* @param resultSchema - Zod schema for validating the result
|
| 33 |
+
* @param options - Optional request options (timeout, signal, task creation params, etc.)
|
| 34 |
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
| 35 |
+
*
|
| 36 |
+
* @experimental
|
| 37 |
+
*/
|
| 38 |
+
requestStream(request, resultSchema, options) {
|
| 39 |
+
return this._server.requestStream(request, resultSchema, options);
|
| 40 |
+
}
|
| 41 |
+
/**
|
| 42 |
+
* Sends a sampling request and returns an AsyncGenerator that yields response messages.
|
| 43 |
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
| 44 |
+
*
|
| 45 |
+
* For task-augmented requests, yields 'taskCreated' and 'taskStatus' messages
|
| 46 |
+
* before the final result.
|
| 47 |
+
*
|
| 48 |
+
* @example
|
| 49 |
+
* ```typescript
|
| 50 |
+
* const stream = server.experimental.tasks.createMessageStream({
|
| 51 |
+
* messages: [{ role: 'user', content: { type: 'text', text: 'Hello' } }],
|
| 52 |
+
* maxTokens: 100
|
| 53 |
+
* }, {
|
| 54 |
+
* onprogress: (progress) => {
|
| 55 |
+
* // Handle streaming tokens via progress notifications
|
| 56 |
+
* console.log('Progress:', progress.message);
|
| 57 |
+
* }
|
| 58 |
+
* });
|
| 59 |
+
*
|
| 60 |
+
* for await (const message of stream) {
|
| 61 |
+
* switch (message.type) {
|
| 62 |
+
* case 'taskCreated':
|
| 63 |
+
* console.log('Task created:', message.task.taskId);
|
| 64 |
+
* break;
|
| 65 |
+
* case 'taskStatus':
|
| 66 |
+
* console.log('Task status:', message.task.status);
|
| 67 |
+
* break;
|
| 68 |
+
* case 'result':
|
| 69 |
+
* console.log('Final result:', message.result);
|
| 70 |
+
* break;
|
| 71 |
+
* case 'error':
|
| 72 |
+
* console.error('Error:', message.error);
|
| 73 |
+
* break;
|
| 74 |
+
* }
|
| 75 |
+
* }
|
| 76 |
+
* ```
|
| 77 |
+
*
|
| 78 |
+
* @param params - The sampling request parameters
|
| 79 |
+
* @param options - Optional request options (timeout, signal, task creation params, onprogress, etc.)
|
| 80 |
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
| 81 |
+
*
|
| 82 |
+
* @experimental
|
| 83 |
+
*/
|
| 84 |
+
createMessageStream(params, options) {
|
| 85 |
+
// Access client capabilities via the server
|
| 86 |
+
const clientCapabilities = this._server.getClientCapabilities();
|
| 87 |
+
// Capability check - only required when tools/toolChoice are provided
|
| 88 |
+
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
| 89 |
+
throw new Error('Client does not support sampling tools capability.');
|
| 90 |
+
}
|
| 91 |
+
// Message structure validation - always validate tool_use/tool_result pairs.
|
| 92 |
+
// These may appear even without tools/toolChoice in the current request when
|
| 93 |
+
// a previous sampling request returned tool_use and this is a follow-up with results.
|
| 94 |
+
if (params.messages.length > 0) {
|
| 95 |
+
const lastMessage = params.messages[params.messages.length - 1];
|
| 96 |
+
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
| 97 |
+
const hasToolResults = lastContent.some(c => c.type === 'tool_result');
|
| 98 |
+
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;
|
| 99 |
+
const previousContent = previousMessage
|
| 100 |
+
? Array.isArray(previousMessage.content)
|
| 101 |
+
? previousMessage.content
|
| 102 |
+
: [previousMessage.content]
|
| 103 |
+
: [];
|
| 104 |
+
const hasPreviousToolUse = previousContent.some(c => c.type === 'tool_use');
|
| 105 |
+
if (hasToolResults) {
|
| 106 |
+
if (lastContent.some(c => c.type !== 'tool_result')) {
|
| 107 |
+
throw new Error('The last message must contain only tool_result content if any is present');
|
| 108 |
+
}
|
| 109 |
+
if (!hasPreviousToolUse) {
|
| 110 |
+
throw new Error('tool_result blocks are not matching any tool_use from the previous message');
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
if (hasPreviousToolUse) {
|
| 114 |
+
// Extract tool_use IDs from previous message and tool_result IDs from current message
|
| 115 |
+
const toolUseIds = new Set(previousContent.filter(c => c.type === 'tool_use').map(c => c.id));
|
| 116 |
+
const toolResultIds = new Set(lastContent.filter(c => c.type === 'tool_result').map(c => c.toolUseId));
|
| 117 |
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every(id => toolResultIds.has(id))) {
|
| 118 |
+
throw new Error('ids of tool_result blocks and tool_use blocks from previous message do not match');
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
return this.requestStream({
|
| 123 |
+
method: 'sampling/createMessage',
|
| 124 |
+
params
|
| 125 |
+
}, CreateMessageResultSchema, options);
|
| 126 |
+
}
|
| 127 |
+
/**
|
| 128 |
+
* Sends an elicitation request and returns an AsyncGenerator that yields response messages.
|
| 129 |
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
| 130 |
+
*
|
| 131 |
+
* For task-augmented requests (especially URL-based elicitation), yields 'taskCreated'
|
| 132 |
+
* and 'taskStatus' messages before the final result.
|
| 133 |
+
*
|
| 134 |
+
* @example
|
| 135 |
+
* ```typescript
|
| 136 |
+
* const stream = server.experimental.tasks.elicitInputStream({
|
| 137 |
+
* mode: 'url',
|
| 138 |
+
* message: 'Please authenticate',
|
| 139 |
+
* elicitationId: 'auth-123',
|
| 140 |
+
* url: 'https://example.com/auth'
|
| 141 |
+
* }, {
|
| 142 |
+
* task: { ttl: 300000 } // Task-augmented for long-running auth flow
|
| 143 |
+
* });
|
| 144 |
+
*
|
| 145 |
+
* for await (const message of stream) {
|
| 146 |
+
* switch (message.type) {
|
| 147 |
+
* case 'taskCreated':
|
| 148 |
+
* console.log('Task created:', message.task.taskId);
|
| 149 |
+
* break;
|
| 150 |
+
* case 'taskStatus':
|
| 151 |
+
* console.log('Task status:', message.task.status);
|
| 152 |
+
* break;
|
| 153 |
+
* case 'result':
|
| 154 |
+
* console.log('User action:', message.result.action);
|
| 155 |
+
* break;
|
| 156 |
+
* case 'error':
|
| 157 |
+
* console.error('Error:', message.error);
|
| 158 |
+
* break;
|
| 159 |
+
* }
|
| 160 |
+
* }
|
| 161 |
+
* ```
|
| 162 |
+
*
|
| 163 |
+
* @param params - The elicitation request parameters
|
| 164 |
+
* @param options - Optional request options (timeout, signal, task creation params, etc.)
|
| 165 |
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
| 166 |
+
*
|
| 167 |
+
* @experimental
|
| 168 |
+
*/
|
| 169 |
+
elicitInputStream(params, options) {
|
| 170 |
+
// Access client capabilities via the server
|
| 171 |
+
const clientCapabilities = this._server.getClientCapabilities();
|
| 172 |
+
const mode = params.mode ?? 'form';
|
| 173 |
+
// Capability check based on mode
|
| 174 |
+
switch (mode) {
|
| 175 |
+
case 'url': {
|
| 176 |
+
if (!clientCapabilities?.elicitation?.url) {
|
| 177 |
+
throw new Error('Client does not support url elicitation.');
|
| 178 |
+
}
|
| 179 |
+
break;
|
| 180 |
+
}
|
| 181 |
+
case 'form': {
|
| 182 |
+
if (!clientCapabilities?.elicitation?.form) {
|
| 183 |
+
throw new Error('Client does not support form elicitation.');
|
| 184 |
+
}
|
| 185 |
+
break;
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
// Normalize params to ensure mode is set for form mode (defaults to 'form' per spec)
|
| 189 |
+
const normalizedParams = mode === 'form' && params.mode === undefined ? { ...params, mode: 'form' } : params;
|
| 190 |
+
// Cast to ServerRequest needed because TypeScript can't narrow the union type
|
| 191 |
+
// based on the discriminated 'method' field when constructing the object literal
|
| 192 |
+
return this.requestStream({
|
| 193 |
+
method: 'elicitation/create',
|
| 194 |
+
params: normalizedParams
|
| 195 |
+
}, ElicitResultSchema, options);
|
| 196 |
+
}
|
| 197 |
+
/**
|
| 198 |
+
* Gets the current status of a task.
|
| 199 |
+
*
|
| 200 |
+
* @param taskId - The task identifier
|
| 201 |
+
* @param options - Optional request options
|
| 202 |
+
* @returns The task status
|
| 203 |
+
*
|
| 204 |
+
* @experimental
|
| 205 |
+
*/
|
| 206 |
+
async getTask(taskId, options) {
|
| 207 |
+
return this._server.getTask({ taskId }, options);
|
| 208 |
+
}
|
| 209 |
+
/**
|
| 210 |
+
* Retrieves the result of a completed task.
|
| 211 |
+
*
|
| 212 |
+
* @param taskId - The task identifier
|
| 213 |
+
* @param resultSchema - Zod schema for validating the result
|
| 214 |
+
* @param options - Optional request options
|
| 215 |
+
* @returns The task result
|
| 216 |
+
*
|
| 217 |
+
* @experimental
|
| 218 |
+
*/
|
| 219 |
+
async getTaskResult(taskId, resultSchema, options) {
|
| 220 |
+
return this._server.getTaskResult({ taskId }, resultSchema, options);
|
| 221 |
+
}
|
| 222 |
+
/**
|
| 223 |
+
* Lists tasks with optional pagination.
|
| 224 |
+
*
|
| 225 |
+
* @param cursor - Optional pagination cursor
|
| 226 |
+
* @param options - Optional request options
|
| 227 |
+
* @returns List of tasks with optional next cursor
|
| 228 |
+
*
|
| 229 |
+
* @experimental
|
| 230 |
+
*/
|
| 231 |
+
async listTasks(cursor, options) {
|
| 232 |
+
return this._server.listTasks(cursor ? { cursor } : undefined, options);
|
| 233 |
+
}
|
| 234 |
+
/**
|
| 235 |
+
* Cancels a running task.
|
| 236 |
+
*
|
| 237 |
+
* @param taskId - The task identifier
|
| 238 |
+
* @param options - Optional request options
|
| 239 |
+
*
|
| 240 |
+
* @experimental
|
| 241 |
+
*/
|
| 242 |
+
async cancelTask(taskId, options) {
|
| 243 |
+
return this._server.cancelTask({ taskId }, options);
|
| 244 |
+
}
|
| 245 |
+
}
|
| 246 |
+
//# sourceMappingURL=server.js.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoBH,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE/E;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,uBAAuB;IAKhC,YAA6B,OAAiD;QAAjD,YAAO,GAAP,OAAO,CAA0C;IAAG,CAAC;IAElF;;;;;;;;;;;;;OAaG;IACH,aAAa,CACT,OAAiC,EACjC,YAAe,EACf,OAAwB;QAUxB,OAAQ,IAAI,CAAC,OAA8C,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IAC9G,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACH,mBAAmB,CACf,MAAkC,EAClC,OAAwB;QAExB,4CAA4C;QAC5C,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;QAEhE,sEAAsE;QACtE,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,kBAAkB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;YAC9E,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QAC1E,CAAC;QAED,6EAA6E;QAC7E,6EAA6E;QAC7E,sFAAsF;QACtF,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAChE,MAAM,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,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;CACJ"}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* In-memory implementations of TaskStore and TaskMessageQueue.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* @experimental
|
| 6 |
+
*/
|
| 7 |
+
import { Task, RequestId, Result, Request } from '../../../types.js';
|
| 8 |
+
import { TaskStore, TaskMessageQueue, QueuedMessage, CreateTaskOptions } from '../interfaces.js';
|
| 9 |
+
/**
|
| 10 |
+
* A simple in-memory implementation of TaskStore for demonstration purposes.
|
| 11 |
+
*
|
| 12 |
+
* This implementation stores all tasks in memory and provides automatic cleanup
|
| 13 |
+
* based on the ttl duration specified in the task creation parameters.
|
| 14 |
+
*
|
| 15 |
+
* Note: This is not suitable for production use as all data is lost on restart.
|
| 16 |
+
* For production, consider implementing TaskStore with a database or distributed cache.
|
| 17 |
+
*
|
| 18 |
+
* @experimental
|
| 19 |
+
*/
|
| 20 |
+
export declare class InMemoryTaskStore implements TaskStore {
|
| 21 |
+
private tasks;
|
| 22 |
+
private cleanupTimers;
|
| 23 |
+
/**
|
| 24 |
+
* Generates a unique task ID.
|
| 25 |
+
* Uses 16 bytes of random data encoded as hex (32 characters).
|
| 26 |
+
*/
|
| 27 |
+
private generateTaskId;
|
| 28 |
+
createTask(taskParams: CreateTaskOptions, requestId: RequestId, request: Request, _sessionId?: string): Promise<Task>;
|
| 29 |
+
getTask(taskId: string, _sessionId?: string): Promise<Task | null>;
|
| 30 |
+
storeTaskResult(taskId: string, status: 'completed' | 'failed', result: Result, _sessionId?: string): Promise<void>;
|
| 31 |
+
getTaskResult(taskId: string, _sessionId?: string): Promise<Result>;
|
| 32 |
+
updateTaskStatus(taskId: string, status: Task['status'], statusMessage?: string, _sessionId?: string): Promise<void>;
|
| 33 |
+
listTasks(cursor?: string, _sessionId?: string): Promise<{
|
| 34 |
+
tasks: Task[];
|
| 35 |
+
nextCursor?: string;
|
| 36 |
+
}>;
|
| 37 |
+
/**
|
| 38 |
+
* Cleanup all timers (useful for testing or graceful shutdown)
|
| 39 |
+
*/
|
| 40 |
+
cleanup(): void;
|
| 41 |
+
/**
|
| 42 |
+
* Get all tasks (useful for debugging)
|
| 43 |
+
*/
|
| 44 |
+
getAllTasks(): Task[];
|
| 45 |
+
}
|
| 46 |
+
/**
|
| 47 |
+
* A simple in-memory implementation of TaskMessageQueue for demonstration purposes.
|
| 48 |
+
*
|
| 49 |
+
* This implementation stores messages in memory, organized by task ID and optional session ID.
|
| 50 |
+
* Messages are stored in FIFO queues per task.
|
| 51 |
+
*
|
| 52 |
+
* Note: This is not suitable for production use in distributed systems.
|
| 53 |
+
* For production, consider implementing TaskMessageQueue with Redis or other distributed queues.
|
| 54 |
+
*
|
| 55 |
+
* @experimental
|
| 56 |
+
*/
|
| 57 |
+
export declare class InMemoryTaskMessageQueue implements TaskMessageQueue {
|
| 58 |
+
private queues;
|
| 59 |
+
/**
|
| 60 |
+
* Generates a queue key from taskId.
|
| 61 |
+
* SessionId is intentionally ignored because taskIds are globally unique
|
| 62 |
+
* and tasks need to be accessible across HTTP requests/sessions.
|
| 63 |
+
*/
|
| 64 |
+
private getQueueKey;
|
| 65 |
+
/**
|
| 66 |
+
* Gets or creates a queue for the given task and session.
|
| 67 |
+
*/
|
| 68 |
+
private getQueue;
|
| 69 |
+
/**
|
| 70 |
+
* Adds a message to the end of the queue for a specific task.
|
| 71 |
+
* Atomically checks queue size and throws if maxSize would be exceeded.
|
| 72 |
+
* @param taskId The task identifier
|
| 73 |
+
* @param message The message to enqueue
|
| 74 |
+
* @param sessionId Optional session ID for binding the operation to a specific session
|
| 75 |
+
* @param maxSize Optional maximum queue size - if specified and queue is full, throws an error
|
| 76 |
+
* @throws Error if maxSize is specified and would be exceeded
|
| 77 |
+
*/
|
| 78 |
+
enqueue(taskId: string, message: QueuedMessage, sessionId?: string, maxSize?: number): Promise<void>;
|
| 79 |
+
/**
|
| 80 |
+
* Removes and returns the first message from the queue for a specific task.
|
| 81 |
+
* @param taskId The task identifier
|
| 82 |
+
* @param sessionId Optional session ID for binding the query to a specific session
|
| 83 |
+
* @returns The first message, or undefined if the queue is empty
|
| 84 |
+
*/
|
| 85 |
+
dequeue(taskId: string, sessionId?: string): Promise<QueuedMessage | undefined>;
|
| 86 |
+
/**
|
| 87 |
+
* Removes and returns all messages from the queue for a specific task.
|
| 88 |
+
* @param taskId The task identifier
|
| 89 |
+
* @param sessionId Optional session ID for binding the query to a specific session
|
| 90 |
+
* @returns Array of all messages that were in the queue
|
| 91 |
+
*/
|
| 92 |
+
dequeueAll(taskId: string, sessionId?: string): Promise<QueuedMessage[]>;
|
| 93 |
+
}
|
| 94 |
+
//# sourceMappingURL=in-memory.d.ts.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"in-memory.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/tasks/stores/in-memory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAc,gBAAgB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAU7G;;;;;;;;;;GAUG;AACH,qBAAa,iBAAkB,YAAW,SAAS;IAC/C,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,aAAa,CAAoD;IAEzE;;;OAGG;IACH,OAAO,CAAC,cAAc;IAIhB,UAAU,CAAC,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0CrH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAKlE,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiCnH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAanE,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,UA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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* In-memory implementations of TaskStore and TaskMessageQueue.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* @experimental
|
| 6 |
+
*/
|
| 7 |
+
import { isTerminal } from '../interfaces.js';
|
| 8 |
+
import { randomBytes } from 'node:crypto';
|
| 9 |
+
/**
|
| 10 |
+
* A simple in-memory implementation of TaskStore for demonstration purposes.
|
| 11 |
+
*
|
| 12 |
+
* This implementation stores all tasks in memory and provides automatic cleanup
|
| 13 |
+
* based on the ttl duration specified in the task creation parameters.
|
| 14 |
+
*
|
| 15 |
+
* Note: This is not suitable for production use as all data is lost on restart.
|
| 16 |
+
* For production, consider implementing TaskStore with a database or distributed cache.
|
| 17 |
+
*
|
| 18 |
+
* @experimental
|
| 19 |
+
*/
|
| 20 |
+
export class InMemoryTaskStore {
|
| 21 |
+
constructor() {
|
| 22 |
+
this.tasks = new Map();
|
| 23 |
+
this.cleanupTimers = new Map();
|
| 24 |
+
}
|
| 25 |
+
/**
|
| 26 |
+
* Generates a unique task ID.
|
| 27 |
+
* Uses 16 bytes of random data encoded as hex (32 characters).
|
| 28 |
+
*/
|
| 29 |
+
generateTaskId() {
|
| 30 |
+
return randomBytes(16).toString('hex');
|
| 31 |
+
}
|
| 32 |
+
async createTask(taskParams, requestId, request, _sessionId) {
|
| 33 |
+
// Generate a unique task ID
|
| 34 |
+
const taskId = this.generateTaskId();
|
| 35 |
+
// Ensure uniqueness
|
| 36 |
+
if (this.tasks.has(taskId)) {
|
| 37 |
+
throw new Error(`Task with ID ${taskId} already exists`);
|
| 38 |
+
}
|
| 39 |
+
const actualTtl = taskParams.ttl ?? null;
|
| 40 |
+
// Create task with generated ID and timestamps
|
| 41 |
+
const createdAt = new Date().toISOString();
|
| 42 |
+
const task = {
|
| 43 |
+
taskId,
|
| 44 |
+
status: 'working',
|
| 45 |
+
ttl: actualTtl,
|
| 46 |
+
createdAt,
|
| 47 |
+
lastUpdatedAt: createdAt,
|
| 48 |
+
pollInterval: taskParams.pollInterval ?? 1000
|
| 49 |
+
};
|
| 50 |
+
this.tasks.set(taskId, {
|
| 51 |
+
task,
|
| 52 |
+
request,
|
| 53 |
+
requestId
|
| 54 |
+
});
|
| 55 |
+
// Schedule cleanup if ttl is specified
|
| 56 |
+
// Cleanup occurs regardless of task status
|
| 57 |
+
if (actualTtl) {
|
| 58 |
+
const timer = setTimeout(() => {
|
| 59 |
+
this.tasks.delete(taskId);
|
| 60 |
+
this.cleanupTimers.delete(taskId);
|
| 61 |
+
}, actualTtl);
|
| 62 |
+
this.cleanupTimers.set(taskId, timer);
|
| 63 |
+
}
|
| 64 |
+
return task;
|
| 65 |
+
}
|
| 66 |
+
async getTask(taskId, _sessionId) {
|
| 67 |
+
const stored = this.tasks.get(taskId);
|
| 68 |
+
return stored ? { ...stored.task } : null;
|
| 69 |
+
}
|
| 70 |
+
async storeTaskResult(taskId, status, result, _sessionId) {
|
| 71 |
+
const stored = this.tasks.get(taskId);
|
| 72 |
+
if (!stored) {
|
| 73 |
+
throw new Error(`Task with ID ${taskId} not found`);
|
| 74 |
+
}
|
| 75 |
+
// Don't allow storing results for tasks already in terminal state
|
| 76 |
+
if (isTerminal(stored.task.status)) {
|
| 77 |
+
throw new Error(`Cannot store result for task ${taskId} in terminal status '${stored.task.status}'. Task results can only be stored once.`);
|
| 78 |
+
}
|
| 79 |
+
stored.result = result;
|
| 80 |
+
stored.task.status = status;
|
| 81 |
+
stored.task.lastUpdatedAt = new Date().toISOString();
|
| 82 |
+
// Reset cleanup timer to start from now (if ttl is set)
|
| 83 |
+
if (stored.task.ttl) {
|
| 84 |
+
const existingTimer = this.cleanupTimers.get(taskId);
|
| 85 |
+
if (existingTimer) {
|
| 86 |
+
clearTimeout(existingTimer);
|
| 87 |
+
}
|
| 88 |
+
const timer = setTimeout(() => {
|
| 89 |
+
this.tasks.delete(taskId);
|
| 90 |
+
this.cleanupTimers.delete(taskId);
|
| 91 |
+
}, stored.task.ttl);
|
| 92 |
+
this.cleanupTimers.set(taskId, timer);
|
| 93 |
+
}
|
| 94 |
+
}
|
| 95 |
+
async getTaskResult(taskId, _sessionId) {
|
| 96 |
+
const stored = this.tasks.get(taskId);
|
| 97 |
+
if (!stored) {
|
| 98 |
+
throw new Error(`Task with ID ${taskId} not found`);
|
| 99 |
+
}
|
| 100 |
+
if (!stored.result) {
|
| 101 |
+
throw new Error(`Task ${taskId} has no result stored`);
|
| 102 |
+
}
|
| 103 |
+
return stored.result;
|
| 104 |
+
}
|
| 105 |
+
async updateTaskStatus(taskId, status, statusMessage, _sessionId) {
|
| 106 |
+
const stored = this.tasks.get(taskId);
|
| 107 |
+
if (!stored) {
|
| 108 |
+
throw new Error(`Task with ID ${taskId} not found`);
|
| 109 |
+
}
|
| 110 |
+
// Don't allow transitions from terminal states
|
| 111 |
+
if (isTerminal(stored.task.status)) {
|
| 112 |
+
throw new Error(`Cannot update task ${taskId} from terminal status '${stored.task.status}' to '${status}'. Terminal states (completed, failed, cancelled) cannot transition to other states.`);
|
| 113 |
+
}
|
| 114 |
+
stored.task.status = status;
|
| 115 |
+
if (statusMessage) {
|
| 116 |
+
stored.task.statusMessage = statusMessage;
|
| 117 |
+
}
|
| 118 |
+
stored.task.lastUpdatedAt = new Date().toISOString();
|
| 119 |
+
// If task is in a terminal state and has ttl, start cleanup timer
|
| 120 |
+
if (isTerminal(status) && stored.task.ttl) {
|
| 121 |
+
const existingTimer = this.cleanupTimers.get(taskId);
|
| 122 |
+
if (existingTimer) {
|
| 123 |
+
clearTimeout(existingTimer);
|
| 124 |
+
}
|
| 125 |
+
const timer = setTimeout(() => {
|
| 126 |
+
this.tasks.delete(taskId);
|
| 127 |
+
this.cleanupTimers.delete(taskId);
|
| 128 |
+
}, stored.task.ttl);
|
| 129 |
+
this.cleanupTimers.set(taskId, timer);
|
| 130 |
+
}
|
| 131 |
+
}
|
| 132 |
+
async listTasks(cursor, _sessionId) {
|
| 133 |
+
const PAGE_SIZE = 10;
|
| 134 |
+
const allTaskIds = Array.from(this.tasks.keys());
|
| 135 |
+
let startIndex = 0;
|
| 136 |
+
if (cursor) {
|
| 137 |
+
const cursorIndex = allTaskIds.indexOf(cursor);
|
| 138 |
+
if (cursorIndex >= 0) {
|
| 139 |
+
startIndex = cursorIndex + 1;
|
| 140 |
+
}
|
| 141 |
+
else {
|
| 142 |
+
// Invalid cursor - throw error
|
| 143 |
+
throw new Error(`Invalid cursor: ${cursor}`);
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
const pageTaskIds = allTaskIds.slice(startIndex, startIndex + PAGE_SIZE);
|
| 147 |
+
const tasks = pageTaskIds.map(taskId => {
|
| 148 |
+
const stored = this.tasks.get(taskId);
|
| 149 |
+
return { ...stored.task };
|
| 150 |
+
});
|
| 151 |
+
const nextCursor = startIndex + PAGE_SIZE < allTaskIds.length ? pageTaskIds[pageTaskIds.length - 1] : undefined;
|
| 152 |
+
return { tasks, nextCursor };
|
| 153 |
+
}
|
| 154 |
+
/**
|
| 155 |
+
* Cleanup all timers (useful for testing or graceful shutdown)
|
| 156 |
+
*/
|
| 157 |
+
cleanup() {
|
| 158 |
+
for (const timer of this.cleanupTimers.values()) {
|
| 159 |
+
clearTimeout(timer);
|
| 160 |
+
}
|
| 161 |
+
this.cleanupTimers.clear();
|
| 162 |
+
this.tasks.clear();
|
| 163 |
+
}
|
| 164 |
+
/**
|
| 165 |
+
* Get all tasks (useful for debugging)
|
| 166 |
+
*/
|
| 167 |
+
getAllTasks() {
|
| 168 |
+
return Array.from(this.tasks.values()).map(stored => ({ ...stored.task }));
|
| 169 |
+
}
|
| 170 |
+
}
|
| 171 |
+
/**
|
| 172 |
+
* A simple in-memory implementation of TaskMessageQueue for demonstration purposes.
|
| 173 |
+
*
|
| 174 |
+
* This implementation stores messages in memory, organized by task ID and optional session ID.
|
| 175 |
+
* Messages are stored in FIFO queues per task.
|
| 176 |
+
*
|
| 177 |
+
* Note: This is not suitable for production use in distributed systems.
|
| 178 |
+
* For production, consider implementing TaskMessageQueue with Redis or other distributed queues.
|
| 179 |
+
*
|
| 180 |
+
* @experimental
|
| 181 |
+
*/
|
| 182 |
+
export class InMemoryTaskMessageQueue {
|
| 183 |
+
constructor() {
|
| 184 |
+
this.queues = new Map();
|
| 185 |
+
}
|
| 186 |
+
/**
|
| 187 |
+
* Generates a queue key from taskId.
|
| 188 |
+
* SessionId is intentionally ignored because taskIds are globally unique
|
| 189 |
+
* and tasks need to be accessible across HTTP requests/sessions.
|
| 190 |
+
*/
|
| 191 |
+
getQueueKey(taskId, _sessionId) {
|
| 192 |
+
return taskId;
|
| 193 |
+
}
|
| 194 |
+
/**
|
| 195 |
+
* Gets or creates a queue for the given task and session.
|
| 196 |
+
*/
|
| 197 |
+
getQueue(taskId, sessionId) {
|
| 198 |
+
const key = this.getQueueKey(taskId, sessionId);
|
| 199 |
+
let queue = this.queues.get(key);
|
| 200 |
+
if (!queue) {
|
| 201 |
+
queue = [];
|
| 202 |
+
this.queues.set(key, queue);
|
| 203 |
+
}
|
| 204 |
+
return queue;
|
| 205 |
+
}
|
| 206 |
+
/**
|
| 207 |
+
* Adds a message to the end of the queue for a specific task.
|
| 208 |
+
* Atomically checks queue size and throws if maxSize would be exceeded.
|
| 209 |
+
* @param taskId The task identifier
|
| 210 |
+
* @param message The message to enqueue
|
| 211 |
+
* @param sessionId Optional session ID for binding the operation to a specific session
|
| 212 |
+
* @param maxSize Optional maximum queue size - if specified and queue is full, throws an error
|
| 213 |
+
* @throws Error if maxSize is specified and would be exceeded
|
| 214 |
+
*/
|
| 215 |
+
async enqueue(taskId, message, sessionId, maxSize) {
|
| 216 |
+
const queue = this.getQueue(taskId, sessionId);
|
| 217 |
+
// Atomically check size and enqueue
|
| 218 |
+
if (maxSize !== undefined && queue.length >= maxSize) {
|
| 219 |
+
throw new Error(`Task message queue overflow: queue size (${queue.length}) exceeds maximum (${maxSize})`);
|
| 220 |
+
}
|
| 221 |
+
queue.push(message);
|
| 222 |
+
}
|
| 223 |
+
/**
|
| 224 |
+
* Removes and returns the first message from the queue for a specific task.
|
| 225 |
+
* @param taskId The task identifier
|
| 226 |
+
* @param sessionId Optional session ID for binding the query to a specific session
|
| 227 |
+
* @returns The first message, or undefined if the queue is empty
|
| 228 |
+
*/
|
| 229 |
+
async dequeue(taskId, sessionId) {
|
| 230 |
+
const queue = this.getQueue(taskId, sessionId);
|
| 231 |
+
return queue.shift();
|
| 232 |
+
}
|
| 233 |
+
/**
|
| 234 |
+
* Removes and returns all messages from the queue for a specific task.
|
| 235 |
+
* @param taskId The task identifier
|
| 236 |
+
* @param sessionId Optional session ID for binding the query to a specific session
|
| 237 |
+
* @returns Array of all messages that were in the queue
|
| 238 |
+
*/
|
| 239 |
+
async dequeueAll(taskId, sessionId) {
|
| 240 |
+
const key = this.getQueueKey(taskId, sessionId);
|
| 241 |
+
const queue = this.queues.get(key) ?? [];
|
| 242 |
+
this.queues.delete(key);
|
| 243 |
+
return queue;
|
| 244 |
+
}
|
| 245 |
+
}
|
| 246 |
+
//# sourceMappingURL=in-memory.js.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"in-memory.js","sourceRoot":"","sources":["../../../../../src/experimental/tasks/stores/in-memory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAa,UAAU,EAAsD,MAAM,k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,UAAU,CAAC,MAAc,EAAE,SAAkB;QAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAChD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QACzC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACxB,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ"}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Re-exports of task-related types from the MCP protocol spec.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* These types are defined in types.ts (matching the protocol spec) and
|
| 6 |
+
* re-exported here for convenience when working with experimental task features.
|
| 7 |
+
*/
|
| 8 |
+
export { TaskCreationParamsSchema, RelatedTaskMetadataSchema, TaskSchema, CreateTaskResultSchema, TaskStatusNotificationParamsSchema, TaskStatusNotificationSchema, GetTaskRequestSchema, GetTaskResultSchema, GetTaskPayloadRequestSchema, ListTasksRequestSchema, ListTasksResultSchema, CancelTaskRequestSchema, CancelTaskResultSchema, ClientTasksCapabilitySchema, ServerTasksCapabilitySchema } from '../../types.js';
|
| 9 |
+
export type { Task, TaskCreationParams, RelatedTaskMetadata, CreateTaskResult, TaskStatusNotificationParams, TaskStatusNotification, GetTaskRequest, GetTaskResult, GetTaskPayloadRequest, ListTasksRequest, ListTasksResult, CancelTaskRequest, CancelTaskResult } from '../../types.js';
|
| 10 |
+
//# sourceMappingURL=types.d.ts.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACH,wBAAwB,EACxB,yBAAyB,EACzB,UAAU,EACV,sBAAsB,EACtB,kCAAkC,EAClC,4BAA4B,EAC5B,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC9B,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACR,IAAI,EACJ,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,4BAA4B,EAC5B,sBAAsB,EACtB,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EACnB,MAAM,gBAAgB,CAAC"}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Re-exports of task-related types from the MCP protocol spec.
|
| 3 |
+
* WARNING: These APIs are experimental and may change without notice.
|
| 4 |
+
*
|
| 5 |
+
* These types are defined in types.ts (matching the protocol spec) and
|
| 6 |
+
* re-exported here for convenience when working with experimental task features.
|
| 7 |
+
*/
|
| 8 |
+
// Task schemas (Zod)
|
| 9 |
+
export { TaskCreationParamsSchema, RelatedTaskMetadataSchema, TaskSchema, CreateTaskResultSchema, TaskStatusNotificationParamsSchema, TaskStatusNotificationSchema, GetTaskRequestSchema, GetTaskResultSchema, GetTaskPayloadRequestSchema, ListTasksRequestSchema, ListTasksResultSchema, CancelTaskRequestSchema, CancelTaskResultSchema, ClientTasksCapabilitySchema, ServerTasksCapabilitySchema } from '../../types.js';
|
| 10 |
+
//# sourceMappingURL=types.js.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,qBAAqB;AACrB,OAAO,EACH,wBAAwB,EACxB,yBAAyB,EACzB,UAAU,EACV,sBAAsB,EACtB,kCAAkC,EAClC,4BAA4B,EAC5B,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC9B,MAAM,gBAAgB,CAAC"}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Transport } from './shared/transport.js';
|
| 2 |
+
import { JSONRPCMessage, RequestId } from './types.js';
|
| 3 |
+
import { AuthInfo } from './server/auth/types.js';
|
| 4 |
+
/**
|
| 5 |
+
* In-memory transport for creating clients and servers that talk to each other within the same process.
|
| 6 |
+
*/
|
| 7 |
+
export declare class InMemoryTransport implements Transport {
|
| 8 |
+
private _otherTransport?;
|
| 9 |
+
private _messageQueue;
|
| 10 |
+
onclose?: () => void;
|
| 11 |
+
onerror?: (error: Error) => void;
|
| 12 |
+
onmessage?: (message: JSONRPCMessage, extra?: {
|
| 13 |
+
authInfo?: AuthInfo;
|
| 14 |
+
}) => void;
|
| 15 |
+
sessionId?: string;
|
| 16 |
+
/**
|
| 17 |
+
* Creates a pair of linked in-memory transports that can communicate with each other. One should be passed to a Client and one to a Server.
|
| 18 |
+
*/
|
| 19 |
+
static createLinkedPair(): [InMemoryTransport, InMemoryTransport];
|
| 20 |
+
start(): Promise<void>;
|
| 21 |
+
close(): Promise<void>;
|
| 22 |
+
/**
|
| 23 |
+
* Sends a message with optional auth info.
|
| 24 |
+
* This is useful for testing authentication scenarios.
|
| 25 |
+
*/
|
| 26 |
+
send(message: JSONRPCMessage, options?: {
|
| 27 |
+
relatedRequestId?: RequestId;
|
| 28 |
+
authInfo?: AuthInfo;
|
| 29 |
+
}): Promise<void>;
|
| 30 |
+
}
|
| 31 |
+
//# sourceMappingURL=inMemory.d.ts.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"inMemory.d.ts","sourceRoot":"","sources":["../../src/inMemory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAOlD;;GAEG;AACH,qBAAa,iBAAkB,YAAW,SAAS;IAC/C,OAAO,CAAC,eAAe,CAAC,CAAoB;IAC5C,OAAO,CAAC,aAAa,CAAuB;IAE5C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;KAAE,KAAK,IAAI,CAAC;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,gBAAgB,IAAI,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAQ3D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAO5B;;;OAGG;IACG,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,SAAS,CAAC;QAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAWtH"}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* In-memory transport for creating clients and servers that talk to each other within the same process.
|
| 3 |
+
*/
|
| 4 |
+
export class InMemoryTransport {
|
| 5 |
+
constructor() {
|
| 6 |
+
this._messageQueue = [];
|
| 7 |
+
}
|
| 8 |
+
/**
|
| 9 |
+
* Creates a pair of linked in-memory transports that can communicate with each other. One should be passed to a Client and one to a Server.
|
| 10 |
+
*/
|
| 11 |
+
static createLinkedPair() {
|
| 12 |
+
const clientTransport = new InMemoryTransport();
|
| 13 |
+
const serverTransport = new InMemoryTransport();
|
| 14 |
+
clientTransport._otherTransport = serverTransport;
|
| 15 |
+
serverTransport._otherTransport = clientTransport;
|
| 16 |
+
return [clientTransport, serverTransport];
|
| 17 |
+
}
|
| 18 |
+
async start() {
|
| 19 |
+
// Process any messages that were queued before start was called
|
| 20 |
+
while (this._messageQueue.length > 0) {
|
| 21 |
+
const queuedMessage = this._messageQueue.shift();
|
| 22 |
+
this.onmessage?.(queuedMessage.message, queuedMessage.extra);
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
async close() {
|
| 26 |
+
const other = this._otherTransport;
|
| 27 |
+
this._otherTransport = undefined;
|
| 28 |
+
await other?.close();
|
| 29 |
+
this.onclose?.();
|
| 30 |
+
}
|
| 31 |
+
/**
|
| 32 |
+
* Sends a message with optional auth info.
|
| 33 |
+
* This is useful for testing authentication scenarios.
|
| 34 |
+
*/
|
| 35 |
+
async send(message, options) {
|
| 36 |
+
if (!this._otherTransport) {
|
| 37 |
+
throw new Error('Not connected');
|
| 38 |
+
}
|
| 39 |
+
if (this._otherTransport.onmessage) {
|
| 40 |
+
this._otherTransport.onmessage(message, { authInfo: options?.authInfo });
|
| 41 |
+
}
|
| 42 |
+
else {
|
| 43 |
+
this._otherTransport._messageQueue.push({ message, extra: { authInfo: options?.authInfo } });
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
//# sourceMappingURL=inMemory.js.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"inMemory.js","sourceRoot":"","sources":["../../src/inMemory.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAA9B;QAEY,kBAAa,GAAoB,EAAE,CAAC;IAgDhD,CAAC;IAzCG;;OAEG;IACH,MAAM,CAAC,gBAAgB;QACnB,MAAM,eAAe,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAChD,MAAM,eAAe,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAChD,eAAe,CAAC,eAAe,GAAG,eAAe,CAAC;QAClD,eAAe,CAAC,eAAe,GAAG,eAA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ocol/sdk/dist/esm/server/auth/clients.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { OAuthClientInformationFull } from '../../shared/auth.js';
|
| 2 |
+
/**
|
| 3 |
+
* Stores information about registered OAuth clients for this server.
|
| 4 |
+
*/
|
| 5 |
+
export interface OAuthRegisteredClientsStore {
|
| 6 |
+
/**
|
| 7 |
+
* Returns information about a registered client, based on its ID.
|
| 8 |
+
*/
|
| 9 |
+
getClient(clientId: string): OAuthClientInformationFull | undefined | Promise<OAuthClientInformationFull | undefined>;
|
| 10 |
+
/**
|
| 11 |
+
* Registers a new client with the server. The client ID and secret will be automatically generated by the library. A modified version of the client information can be returned to reflect specific values enforced by the server.
|
| 12 |
+
*
|
| 13 |
+
* NOTE: Implementations should NOT delete expired client secrets in-place. Auth middleware provided by this library will automatically check the `client_secret_expires_at` field and reject requests with expired secrets. Any custom logic for authenticating clients should check the `client_secret_expires_at` field as well.
|
| 14 |
+
*
|
| 15 |
+
* If unimplemented, dynamic client registration is unsupported.
|
| 16 |
+
*/
|
| 17 |
+
registerClient?(client: Omit<OAuthClientInformationFull, 'client_id' | 'client_id_issued_at'>): OAuthClientInformationFull | Promise<OAuthClientInformationFull>;
|
| 18 |
+
}
|
| 19 |
+
//# sourceMappingURL=clients.d.ts.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../../../../src/server/auth/clients.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,0BAA0B,GAAG,SAAS,GAAG,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAAC;IAEtH;;;;;;OAMG;IACH,cAAc,CAAC,CACX,MAAM,EAAE,IAAI,CAAC,0BAA0B,EAAE,WAAW,GAAG,qBAAqB,CAAC,GAC9E,0BAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;CACvE"}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export {};
|
| 2 |
+
//# sourceMappingURL=clients.js.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"clients.js","sourceRoot":"","sources":["../../../../src/server/auth/clients.ts"],"names":[],"mappings":""}
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.d.ts
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { OAuthErrorResponse } from '../../shared/auth.js';
|
| 2 |
+
/**
|
| 3 |
+
* Base class for all OAuth errors
|
| 4 |
+
*/
|
| 5 |
+
export declare class OAuthError extends Error {
|
| 6 |
+
readonly errorUri?: string | undefined;
|
| 7 |
+
static errorCode: string;
|
| 8 |
+
constructor(message: string, errorUri?: string | undefined);
|
| 9 |
+
/**
|
| 10 |
+
* Converts the error to a standard OAuth error response object
|
| 11 |
+
*/
|
| 12 |
+
toResponseObject(): OAuthErrorResponse;
|
| 13 |
+
get errorCode(): string;
|
| 14 |
+
}
|
| 15 |
+
/**
|
| 16 |
+
* Invalid request error - The request is missing a required parameter,
|
| 17 |
+
* includes an invalid parameter value, includes a parameter more than once,
|
| 18 |
+
* or is otherwise malformed.
|
| 19 |
+
*/
|
| 20 |
+
export declare class InvalidRequestError extends OAuthError {
|
| 21 |
+
static errorCode: string;
|
| 22 |
+
}
|
| 23 |
+
/**
|
| 24 |
+
* Invalid client error - Client authentication failed (e.g., unknown client, no client
|
| 25 |
+
* authentication included, or unsupported authentication method).
|
| 26 |
+
*/
|
| 27 |
+
export declare class InvalidClientError extends OAuthError {
|
| 28 |
+
static errorCode: string;
|
| 29 |
+
}
|
| 30 |
+
/**
|
| 31 |
+
* Invalid grant error - The provided authorization grant or refresh token is
|
| 32 |
+
* invalid, expired, revoked, does not match the redirection URI used in the
|
| 33 |
+
* authorization request, or was issued to another client.
|
| 34 |
+
*/
|
| 35 |
+
export declare class InvalidGrantError extends OAuthError {
|
| 36 |
+
static errorCode: string;
|
| 37 |
+
}
|
| 38 |
+
/**
|
| 39 |
+
* Unauthorized client error - The authenticated client is not authorized to use
|
| 40 |
+
* this authorization grant type.
|
| 41 |
+
*/
|
| 42 |
+
export declare class UnauthorizedClientError extends OAuthError {
|
| 43 |
+
static errorCode: string;
|
| 44 |
+
}
|
| 45 |
+
/**
|
| 46 |
+
* Unsupported grant type error - The authorization grant type is not supported
|
| 47 |
+
* by the authorization server.
|
| 48 |
+
*/
|
| 49 |
+
export declare class UnsupportedGrantTypeError extends OAuthError {
|
| 50 |
+
static errorCode: string;
|
| 51 |
+
}
|
| 52 |
+
/**
|
| 53 |
+
* Invalid scope error - The requested scope is invalid, unknown, malformed, or
|
| 54 |
+
* exceeds the scope granted by the resource owner.
|
| 55 |
+
*/
|
| 56 |
+
export declare class InvalidScopeError extends OAuthError {
|
| 57 |
+
static errorCode: string;
|
| 58 |
+
}
|
| 59 |
+
/**
|
| 60 |
+
* Access denied error - The resource owner or authorization server denied the request.
|
| 61 |
+
*/
|
| 62 |
+
export declare class AccessDeniedError extends OAuthError {
|
| 63 |
+
static errorCode: string;
|
| 64 |
+
}
|
| 65 |
+
/**
|
| 66 |
+
* Server error - The authorization server encountered an unexpected condition
|
| 67 |
+
* that prevented it from fulfilling the request.
|
| 68 |
+
*/
|
| 69 |
+
export declare class ServerError extends OAuthError {
|
| 70 |
+
static errorCode: string;
|
| 71 |
+
}
|
| 72 |
+
/**
|
| 73 |
+
* Temporarily unavailable error - The authorization server is currently unable to
|
| 74 |
+
* handle the request due to a temporary overloading or maintenance of the server.
|
| 75 |
+
*/
|
| 76 |
+
export declare class TemporarilyUnavailableError extends OAuthError {
|
| 77 |
+
static errorCode: string;
|
| 78 |
+
}
|
| 79 |
+
/**
|
| 80 |
+
* Unsupported response type error - The authorization server does not support
|
| 81 |
+
* obtaining an authorization code using this method.
|
| 82 |
+
*/
|
| 83 |
+
export declare class UnsupportedResponseTypeError extends OAuthError {
|
| 84 |
+
static errorCode: string;
|
| 85 |
+
}
|
| 86 |
+
/**
|
| 87 |
+
* Unsupported token type error - The authorization server does not support
|
| 88 |
+
* the requested token type.
|
| 89 |
+
*/
|
| 90 |
+
export declare class UnsupportedTokenTypeError extends OAuthError {
|
| 91 |
+
static errorCode: string;
|
| 92 |
+
}
|
| 93 |
+
/**
|
| 94 |
+
* Invalid token error - The access token provided is expired, revoked, malformed,
|
| 95 |
+
* or invalid for other reasons.
|
| 96 |
+
*/
|
| 97 |
+
export declare class InvalidTokenError extends OAuthError {
|
| 98 |
+
static errorCode: string;
|
| 99 |
+
}
|
| 100 |
+
/**
|
| 101 |
+
* Method not allowed error - The HTTP method used is not allowed for this endpoint.
|
| 102 |
+
* (Custom, non-standard error)
|
| 103 |
+
*/
|
| 104 |
+
export declare class MethodNotAllowedError extends OAuthError {
|
| 105 |
+
static errorCode: string;
|
| 106 |
+
}
|
| 107 |
+
/**
|
| 108 |
+
* Too many requests error - Rate limit exceeded.
|
| 109 |
+
* (Custom, non-standard error based on RFC 6585)
|
| 110 |
+
*/
|
| 111 |
+
export declare class TooManyRequestsError extends OAuthError {
|
| 112 |
+
static errorCode: string;
|
| 113 |
+
}
|
| 114 |
+
/**
|
| 115 |
+
* Invalid client metadata error - The client metadata is invalid.
|
| 116 |
+
* (Custom error for dynamic client registration - RFC 7591)
|
| 117 |
+
*/
|
| 118 |
+
export declare class InvalidClientMetadataError extends OAuthError {
|
| 119 |
+
static errorCode: string;
|
| 120 |
+
}
|
| 121 |
+
/**
|
| 122 |
+
* Insufficient scope error - The request requires higher privileges than provided by the access token.
|
| 123 |
+
*/
|
| 124 |
+
export declare class InsufficientScopeError extends OAuthError {
|
| 125 |
+
static errorCode: string;
|
| 126 |
+
}
|
| 127 |
+
/**
|
| 128 |
+
* Invalid target error - The requested resource is invalid, missing, unknown, or malformed.
|
| 129 |
+
* (Custom error for resource indicators - RFC 8707)
|
| 130 |
+
*/
|
| 131 |
+
export declare class InvalidTargetError extends OAuthError {
|
| 132 |
+
static errorCode: string;
|
| 133 |
+
}
|
| 134 |
+
/**
|
| 135 |
+
* A utility class for defining one-off error codes
|
| 136 |
+
*/
|
| 137 |
+
export declare class CustomOAuthError extends OAuthError {
|
| 138 |
+
private readonly customErrorCode;
|
| 139 |
+
constructor(customErrorCode: string, message: string, errorUri?: string);
|
| 140 |
+
get errorCode(): string;
|
| 141 |
+
}
|
| 142 |
+
/**
|
| 143 |
+
* A full list of all OAuthErrors, enabling parsing from error responses
|
| 144 |
+
*/
|
| 145 |
+
export declare const OAUTH_ERRORS: {
|
| 146 |
+
readonly [x: string]: typeof InvalidRequestError;
|
| 147 |
+
};
|
| 148 |
+
//# sourceMappingURL=errors.d.ts.map
|
tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/server/auth/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;aAKb,QAAQ,CAAC,EAAE,MAAM;IAJrC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC;gBAGrB,OAAO,EAAE,MAAM,EACC,QAAQ,CAAC,EAAE,MAAM,YAAA;IAMrC;;OAEG;IACH,gBAAgB,IAAI,kBAAkB;IAatC,IAAI,SAAS,IAAI,MAAM,CAEtB;CACJ;AAED;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,UAAU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