labgate 0.5.45 → 0.5.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/config.js +1 -1
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/container.d.ts +4 -0
- package/dist/lib/container.js +157 -16
- package/dist/lib/container.js.map +1 -1
- package/dist/lib/init.js +1 -1
- package/dist/lib/ui.html +1 -12
- package/dist/lib/ui.js +3 -0
- package/dist/lib/ui.js.map +1 -1
- package/dist/mcp-bundles/cluster-mcp.bundle.mjs +185 -10
- package/dist/mcp-bundles/dataset-mcp.bundle.mjs +186 -11
- package/dist/mcp-bundles/display-mcp.bundle.mjs +186 -11
- package/dist/mcp-bundles/explorer-mcp.bundle.mjs +419 -11
- package/dist/mcp-bundles/results-mcp.bundle.mjs +186 -11
- package/dist/mcp-bundles/slurm-mcp.bundle.mjs +186 -11
- package/package.json +12 -1
|
@@ -3943,7 +3943,7 @@ var require_core = __commonJS({
|
|
|
3943
3943
|
constructor(opts = {}) {
|
|
3944
3944
|
this.schemas = {};
|
|
3945
3945
|
this.refs = {};
|
|
3946
|
-
this.formats =
|
|
3946
|
+
this.formats = /* @__PURE__ */ Object.create(null);
|
|
3947
3947
|
this._compilations = /* @__PURE__ */ new Set();
|
|
3948
3948
|
this._loading = {};
|
|
3949
3949
|
this._cache = /* @__PURE__ */ new Map();
|
|
@@ -4724,6 +4724,7 @@ var require_pattern = __commonJS({
|
|
|
4724
4724
|
"use strict";
|
|
4725
4725
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4726
4726
|
var code_1 = require_code2();
|
|
4727
|
+
var util_1 = require_util();
|
|
4727
4728
|
var codegen_1 = require_codegen();
|
|
4728
4729
|
var error48 = {
|
|
4729
4730
|
message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
|
|
@@ -4736,10 +4737,18 @@ var require_pattern = __commonJS({
|
|
|
4736
4737
|
$data: true,
|
|
4737
4738
|
error: error48,
|
|
4738
4739
|
code(cxt) {
|
|
4739
|
-
const { data, $data, schema, schemaCode, it } = cxt;
|
|
4740
|
+
const { gen, data, $data, schema, schemaCode, it } = cxt;
|
|
4740
4741
|
const u = it.opts.unicodeRegExp ? "u" : "";
|
|
4741
|
-
|
|
4742
|
-
|
|
4742
|
+
if ($data) {
|
|
4743
|
+
const { regExp } = it.opts.code;
|
|
4744
|
+
const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
|
|
4745
|
+
const valid = gen.let("valid");
|
|
4746
|
+
gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
|
|
4747
|
+
cxt.fail$data((0, codegen_1._)`!${valid}`);
|
|
4748
|
+
} else {
|
|
4749
|
+
const regExp = (0, code_1.usePattern)(cxt, schema);
|
|
4750
|
+
cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
|
|
4751
|
+
}
|
|
4743
4752
|
}
|
|
4744
4753
|
};
|
|
4745
4754
|
exports.default = def;
|
|
@@ -24631,10 +24640,9 @@ var ProgressTokenSchema = union([string2(), number2().int()]);
|
|
|
24631
24640
|
var CursorSchema = string2();
|
|
24632
24641
|
var TaskCreationParamsSchema = looseObject({
|
|
24633
24642
|
/**
|
|
24634
|
-
*
|
|
24635
|
-
* If null, the task has unlimited lifetime until manually cleaned up.
|
|
24643
|
+
* Requested duration in milliseconds to retain task from creation.
|
|
24636
24644
|
*/
|
|
24637
|
-
ttl:
|
|
24645
|
+
ttl: number2().optional(),
|
|
24638
24646
|
/**
|
|
24639
24647
|
* Time in milliseconds to wait between task status requests.
|
|
24640
24648
|
*/
|
|
@@ -24934,7 +24942,11 @@ var ClientCapabilitiesSchema = object2({
|
|
|
24934
24942
|
/**
|
|
24935
24943
|
* Present if the client supports task creation.
|
|
24936
24944
|
*/
|
|
24937
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
24945
|
+
tasks: ClientTasksCapabilitySchema.optional(),
|
|
24946
|
+
/**
|
|
24947
|
+
* Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
|
|
24948
|
+
*/
|
|
24949
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
24938
24950
|
});
|
|
24939
24951
|
var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
24940
24952
|
/**
|
|
@@ -24995,7 +25007,11 @@ var ServerCapabilitiesSchema = object2({
|
|
|
24995
25007
|
/**
|
|
24996
25008
|
* Present if the server supports task creation.
|
|
24997
25009
|
*/
|
|
24998
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
25010
|
+
tasks: ServerTasksCapabilitySchema.optional(),
|
|
25011
|
+
/**
|
|
25012
|
+
* Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
|
|
25013
|
+
*/
|
|
25014
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
24999
25015
|
});
|
|
25000
25016
|
var InitializeResultSchema = ResultSchema.extend({
|
|
25001
25017
|
/**
|
|
@@ -25187,6 +25203,12 @@ var ResourceSchema = object2({
|
|
|
25187
25203
|
* The MIME type of this resource, if known.
|
|
25188
25204
|
*/
|
|
25189
25205
|
mimeType: optional(string2()),
|
|
25206
|
+
/**
|
|
25207
|
+
* The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
|
|
25208
|
+
*
|
|
25209
|
+
* This can be used by Hosts to display file sizes and estimate context window usage.
|
|
25210
|
+
*/
|
|
25211
|
+
size: optional(number2()),
|
|
25190
25212
|
/**
|
|
25191
25213
|
* Optional annotations for the client.
|
|
25192
25214
|
*/
|
|
@@ -27682,6 +27704,10 @@ var Protocol = class {
|
|
|
27682
27704
|
this._progressHandlers.clear();
|
|
27683
27705
|
this._taskProgressTokens.clear();
|
|
27684
27706
|
this._pendingDebouncedNotifications.clear();
|
|
27707
|
+
for (const info of this._timeoutInfo.values()) {
|
|
27708
|
+
clearTimeout(info.timeoutId);
|
|
27709
|
+
}
|
|
27710
|
+
this._timeoutInfo.clear();
|
|
27685
27711
|
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
27686
27712
|
controller.abort();
|
|
27687
27713
|
}
|
|
@@ -27812,7 +27838,9 @@ var Protocol = class {
|
|
|
27812
27838
|
await capturedTransport?.send(errorResponse);
|
|
27813
27839
|
}
|
|
27814
27840
|
}).catch((error48) => this._onerror(new Error(`Failed to send response: ${error48}`))).finally(() => {
|
|
27815
|
-
this._requestHandlerAbortControllers.
|
|
27841
|
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
|
27842
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
27843
|
+
}
|
|
27816
27844
|
});
|
|
27817
27845
|
}
|
|
27818
27846
|
_onprogress(notification) {
|
|
@@ -28508,6 +28536,147 @@ var ExperimentalServerTasks = class {
|
|
|
28508
28536
|
requestStream(request, resultSchema, options) {
|
|
28509
28537
|
return this._server.requestStream(request, resultSchema, options);
|
|
28510
28538
|
}
|
|
28539
|
+
/**
|
|
28540
|
+
* Sends a sampling request and returns an AsyncGenerator that yields response messages.
|
|
28541
|
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
|
28542
|
+
*
|
|
28543
|
+
* For task-augmented requests, yields 'taskCreated' and 'taskStatus' messages
|
|
28544
|
+
* before the final result.
|
|
28545
|
+
*
|
|
28546
|
+
* @example
|
|
28547
|
+
* ```typescript
|
|
28548
|
+
* const stream = server.experimental.tasks.createMessageStream({
|
|
28549
|
+
* messages: [{ role: 'user', content: { type: 'text', text: 'Hello' } }],
|
|
28550
|
+
* maxTokens: 100
|
|
28551
|
+
* }, {
|
|
28552
|
+
* onprogress: (progress) => {
|
|
28553
|
+
* // Handle streaming tokens via progress notifications
|
|
28554
|
+
* console.log('Progress:', progress.message);
|
|
28555
|
+
* }
|
|
28556
|
+
* });
|
|
28557
|
+
*
|
|
28558
|
+
* for await (const message of stream) {
|
|
28559
|
+
* switch (message.type) {
|
|
28560
|
+
* case 'taskCreated':
|
|
28561
|
+
* console.log('Task created:', message.task.taskId);
|
|
28562
|
+
* break;
|
|
28563
|
+
* case 'taskStatus':
|
|
28564
|
+
* console.log('Task status:', message.task.status);
|
|
28565
|
+
* break;
|
|
28566
|
+
* case 'result':
|
|
28567
|
+
* console.log('Final result:', message.result);
|
|
28568
|
+
* break;
|
|
28569
|
+
* case 'error':
|
|
28570
|
+
* console.error('Error:', message.error);
|
|
28571
|
+
* break;
|
|
28572
|
+
* }
|
|
28573
|
+
* }
|
|
28574
|
+
* ```
|
|
28575
|
+
*
|
|
28576
|
+
* @param params - The sampling request parameters
|
|
28577
|
+
* @param options - Optional request options (timeout, signal, task creation params, onprogress, etc.)
|
|
28578
|
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
|
28579
|
+
*
|
|
28580
|
+
* @experimental
|
|
28581
|
+
*/
|
|
28582
|
+
createMessageStream(params, options) {
|
|
28583
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
28584
|
+
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
|
28585
|
+
throw new Error("Client does not support sampling tools capability.");
|
|
28586
|
+
}
|
|
28587
|
+
if (params.messages.length > 0) {
|
|
28588
|
+
const lastMessage = params.messages[params.messages.length - 1];
|
|
28589
|
+
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
28590
|
+
const hasToolResults = lastContent.some((c) => c.type === "tool_result");
|
|
28591
|
+
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : void 0;
|
|
28592
|
+
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
28593
|
+
const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
|
|
28594
|
+
if (hasToolResults) {
|
|
28595
|
+
if (lastContent.some((c) => c.type !== "tool_result")) {
|
|
28596
|
+
throw new Error("The last message must contain only tool_result content if any is present");
|
|
28597
|
+
}
|
|
28598
|
+
if (!hasPreviousToolUse) {
|
|
28599
|
+
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
28600
|
+
}
|
|
28601
|
+
}
|
|
28602
|
+
if (hasPreviousToolUse) {
|
|
28603
|
+
const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
|
|
28604
|
+
const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
|
|
28605
|
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
28606
|
+
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
28607
|
+
}
|
|
28608
|
+
}
|
|
28609
|
+
}
|
|
28610
|
+
return this.requestStream({
|
|
28611
|
+
method: "sampling/createMessage",
|
|
28612
|
+
params
|
|
28613
|
+
}, CreateMessageResultSchema, options);
|
|
28614
|
+
}
|
|
28615
|
+
/**
|
|
28616
|
+
* Sends an elicitation request and returns an AsyncGenerator that yields response messages.
|
|
28617
|
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
|
28618
|
+
*
|
|
28619
|
+
* For task-augmented requests (especially URL-based elicitation), yields 'taskCreated'
|
|
28620
|
+
* and 'taskStatus' messages before the final result.
|
|
28621
|
+
*
|
|
28622
|
+
* @example
|
|
28623
|
+
* ```typescript
|
|
28624
|
+
* const stream = server.experimental.tasks.elicitInputStream({
|
|
28625
|
+
* mode: 'url',
|
|
28626
|
+
* message: 'Please authenticate',
|
|
28627
|
+
* elicitationId: 'auth-123',
|
|
28628
|
+
* url: 'https://example.com/auth'
|
|
28629
|
+
* }, {
|
|
28630
|
+
* task: { ttl: 300000 } // Task-augmented for long-running auth flow
|
|
28631
|
+
* });
|
|
28632
|
+
*
|
|
28633
|
+
* for await (const message of stream) {
|
|
28634
|
+
* switch (message.type) {
|
|
28635
|
+
* case 'taskCreated':
|
|
28636
|
+
* console.log('Task created:', message.task.taskId);
|
|
28637
|
+
* break;
|
|
28638
|
+
* case 'taskStatus':
|
|
28639
|
+
* console.log('Task status:', message.task.status);
|
|
28640
|
+
* break;
|
|
28641
|
+
* case 'result':
|
|
28642
|
+
* console.log('User action:', message.result.action);
|
|
28643
|
+
* break;
|
|
28644
|
+
* case 'error':
|
|
28645
|
+
* console.error('Error:', message.error);
|
|
28646
|
+
* break;
|
|
28647
|
+
* }
|
|
28648
|
+
* }
|
|
28649
|
+
* ```
|
|
28650
|
+
*
|
|
28651
|
+
* @param params - The elicitation request parameters
|
|
28652
|
+
* @param options - Optional request options (timeout, signal, task creation params, etc.)
|
|
28653
|
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
|
28654
|
+
*
|
|
28655
|
+
* @experimental
|
|
28656
|
+
*/
|
|
28657
|
+
elicitInputStream(params, options) {
|
|
28658
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
28659
|
+
const mode = params.mode ?? "form";
|
|
28660
|
+
switch (mode) {
|
|
28661
|
+
case "url": {
|
|
28662
|
+
if (!clientCapabilities?.elicitation?.url) {
|
|
28663
|
+
throw new Error("Client does not support url elicitation.");
|
|
28664
|
+
}
|
|
28665
|
+
break;
|
|
28666
|
+
}
|
|
28667
|
+
case "form": {
|
|
28668
|
+
if (!clientCapabilities?.elicitation?.form) {
|
|
28669
|
+
throw new Error("Client does not support form elicitation.");
|
|
28670
|
+
}
|
|
28671
|
+
break;
|
|
28672
|
+
}
|
|
28673
|
+
}
|
|
28674
|
+
const normalizedParams = mode === "form" && params.mode === void 0 ? { ...params, mode: "form" } : params;
|
|
28675
|
+
return this.requestStream({
|
|
28676
|
+
method: "elicitation/create",
|
|
28677
|
+
params: normalizedParams
|
|
28678
|
+
}, ElicitResultSchema, options);
|
|
28679
|
+
}
|
|
28511
28680
|
/**
|
|
28512
28681
|
* Gets the current status of a task.
|
|
28513
28682
|
*
|
|
@@ -29684,6 +29853,9 @@ var McpServer = class {
|
|
|
29684
29853
|
annotations = rest.shift();
|
|
29685
29854
|
}
|
|
29686
29855
|
} else if (typeof firstArg === "object" && firstArg !== null) {
|
|
29856
|
+
if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
|
|
29857
|
+
throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
|
|
29858
|
+
}
|
|
29687
29859
|
annotations = rest.shift();
|
|
29688
29860
|
}
|
|
29689
29861
|
}
|
|
@@ -29802,6 +29974,9 @@ function getZodSchemaObject(schema) {
|
|
|
29802
29974
|
if (isZodRawShapeCompat(schema)) {
|
|
29803
29975
|
return objectFromShape(schema);
|
|
29804
29976
|
}
|
|
29977
|
+
if (!isZodSchemaInstance(schema)) {
|
|
29978
|
+
throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
|
|
29979
|
+
}
|
|
29805
29980
|
return schema;
|
|
29806
29981
|
}
|
|
29807
29982
|
function promptArgumentsFromSchema(schema) {
|
|
@@ -29957,7 +30132,7 @@ import { homedir } from "os";
|
|
|
29957
30132
|
var DEFAULT_CONFIG = {
|
|
29958
30133
|
runtime: "auto",
|
|
29959
30134
|
images_dir: "",
|
|
29960
|
-
// Default sandbox image
|
|
30135
|
+
// Default sandbox image is expected to include python3 + basic build tools (git/make/g++).
|
|
29961
30136
|
// Note: pip/venv are not included by default in Debian; users may still need a
|
|
29962
30137
|
// custom image for richer Python workflows.
|
|
29963
30138
|
image: "docker.io/library/node:20-bookworm",
|
|
@@ -3949,7 +3949,7 @@ var require_core = __commonJS({
|
|
|
3949
3949
|
constructor(opts = {}) {
|
|
3950
3950
|
this.schemas = {};
|
|
3951
3951
|
this.refs = {};
|
|
3952
|
-
this.formats =
|
|
3952
|
+
this.formats = /* @__PURE__ */ Object.create(null);
|
|
3953
3953
|
this._compilations = /* @__PURE__ */ new Set();
|
|
3954
3954
|
this._loading = {};
|
|
3955
3955
|
this._cache = /* @__PURE__ */ new Map();
|
|
@@ -4730,6 +4730,7 @@ var require_pattern = __commonJS({
|
|
|
4730
4730
|
"use strict";
|
|
4731
4731
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4732
4732
|
var code_1 = require_code2();
|
|
4733
|
+
var util_1 = require_util();
|
|
4733
4734
|
var codegen_1 = require_codegen();
|
|
4734
4735
|
var error48 = {
|
|
4735
4736
|
message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
|
|
@@ -4742,10 +4743,18 @@ var require_pattern = __commonJS({
|
|
|
4742
4743
|
$data: true,
|
|
4743
4744
|
error: error48,
|
|
4744
4745
|
code(cxt) {
|
|
4745
|
-
const { data, $data, schema, schemaCode, it } = cxt;
|
|
4746
|
+
const { gen, data, $data, schema, schemaCode, it } = cxt;
|
|
4746
4747
|
const u = it.opts.unicodeRegExp ? "u" : "";
|
|
4747
|
-
|
|
4748
|
-
|
|
4748
|
+
if ($data) {
|
|
4749
|
+
const { regExp } = it.opts.code;
|
|
4750
|
+
const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
|
|
4751
|
+
const valid = gen.let("valid");
|
|
4752
|
+
gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
|
|
4753
|
+
cxt.fail$data((0, codegen_1._)`!${valid}`);
|
|
4754
|
+
} else {
|
|
4755
|
+
const regExp = (0, code_1.usePattern)(cxt, schema);
|
|
4756
|
+
cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
|
|
4757
|
+
}
|
|
4749
4758
|
}
|
|
4750
4759
|
};
|
|
4751
4760
|
exports.default = def;
|
|
@@ -24637,10 +24646,9 @@ var ProgressTokenSchema = union([string2(), number2().int()]);
|
|
|
24637
24646
|
var CursorSchema = string2();
|
|
24638
24647
|
var TaskCreationParamsSchema = looseObject({
|
|
24639
24648
|
/**
|
|
24640
|
-
*
|
|
24641
|
-
* If null, the task has unlimited lifetime until manually cleaned up.
|
|
24649
|
+
* Requested duration in milliseconds to retain task from creation.
|
|
24642
24650
|
*/
|
|
24643
|
-
ttl:
|
|
24651
|
+
ttl: number2().optional(),
|
|
24644
24652
|
/**
|
|
24645
24653
|
* Time in milliseconds to wait between task status requests.
|
|
24646
24654
|
*/
|
|
@@ -24940,7 +24948,11 @@ var ClientCapabilitiesSchema = object2({
|
|
|
24940
24948
|
/**
|
|
24941
24949
|
* Present if the client supports task creation.
|
|
24942
24950
|
*/
|
|
24943
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
24951
|
+
tasks: ClientTasksCapabilitySchema.optional(),
|
|
24952
|
+
/**
|
|
24953
|
+
* Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
|
|
24954
|
+
*/
|
|
24955
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
24944
24956
|
});
|
|
24945
24957
|
var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
24946
24958
|
/**
|
|
@@ -25001,7 +25013,11 @@ var ServerCapabilitiesSchema = object2({
|
|
|
25001
25013
|
/**
|
|
25002
25014
|
* Present if the server supports task creation.
|
|
25003
25015
|
*/
|
|
25004
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
25016
|
+
tasks: ServerTasksCapabilitySchema.optional(),
|
|
25017
|
+
/**
|
|
25018
|
+
* Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
|
|
25019
|
+
*/
|
|
25020
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
25005
25021
|
});
|
|
25006
25022
|
var InitializeResultSchema = ResultSchema.extend({
|
|
25007
25023
|
/**
|
|
@@ -25193,6 +25209,12 @@ var ResourceSchema = object2({
|
|
|
25193
25209
|
* The MIME type of this resource, if known.
|
|
25194
25210
|
*/
|
|
25195
25211
|
mimeType: optional(string2()),
|
|
25212
|
+
/**
|
|
25213
|
+
* The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
|
|
25214
|
+
*
|
|
25215
|
+
* This can be used by Hosts to display file sizes and estimate context window usage.
|
|
25216
|
+
*/
|
|
25217
|
+
size: optional(number2()),
|
|
25196
25218
|
/**
|
|
25197
25219
|
* Optional annotations for the client.
|
|
25198
25220
|
*/
|
|
@@ -27688,6 +27710,10 @@ var Protocol = class {
|
|
|
27688
27710
|
this._progressHandlers.clear();
|
|
27689
27711
|
this._taskProgressTokens.clear();
|
|
27690
27712
|
this._pendingDebouncedNotifications.clear();
|
|
27713
|
+
for (const info of this._timeoutInfo.values()) {
|
|
27714
|
+
clearTimeout(info.timeoutId);
|
|
27715
|
+
}
|
|
27716
|
+
this._timeoutInfo.clear();
|
|
27691
27717
|
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
27692
27718
|
controller.abort();
|
|
27693
27719
|
}
|
|
@@ -27818,7 +27844,9 @@ var Protocol = class {
|
|
|
27818
27844
|
await capturedTransport?.send(errorResponse);
|
|
27819
27845
|
}
|
|
27820
27846
|
}).catch((error48) => this._onerror(new Error(`Failed to send response: ${error48}`))).finally(() => {
|
|
27821
|
-
this._requestHandlerAbortControllers.
|
|
27847
|
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
|
27848
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
27849
|
+
}
|
|
27822
27850
|
});
|
|
27823
27851
|
}
|
|
27824
27852
|
_onprogress(notification) {
|
|
@@ -28514,6 +28542,147 @@ var ExperimentalServerTasks = class {
|
|
|
28514
28542
|
requestStream(request, resultSchema, options) {
|
|
28515
28543
|
return this._server.requestStream(request, resultSchema, options);
|
|
28516
28544
|
}
|
|
28545
|
+
/**
|
|
28546
|
+
* Sends a sampling request and returns an AsyncGenerator that yields response messages.
|
|
28547
|
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
|
28548
|
+
*
|
|
28549
|
+
* For task-augmented requests, yields 'taskCreated' and 'taskStatus' messages
|
|
28550
|
+
* before the final result.
|
|
28551
|
+
*
|
|
28552
|
+
* @example
|
|
28553
|
+
* ```typescript
|
|
28554
|
+
* const stream = server.experimental.tasks.createMessageStream({
|
|
28555
|
+
* messages: [{ role: 'user', content: { type: 'text', text: 'Hello' } }],
|
|
28556
|
+
* maxTokens: 100
|
|
28557
|
+
* }, {
|
|
28558
|
+
* onprogress: (progress) => {
|
|
28559
|
+
* // Handle streaming tokens via progress notifications
|
|
28560
|
+
* console.log('Progress:', progress.message);
|
|
28561
|
+
* }
|
|
28562
|
+
* });
|
|
28563
|
+
*
|
|
28564
|
+
* for await (const message of stream) {
|
|
28565
|
+
* switch (message.type) {
|
|
28566
|
+
* case 'taskCreated':
|
|
28567
|
+
* console.log('Task created:', message.task.taskId);
|
|
28568
|
+
* break;
|
|
28569
|
+
* case 'taskStatus':
|
|
28570
|
+
* console.log('Task status:', message.task.status);
|
|
28571
|
+
* break;
|
|
28572
|
+
* case 'result':
|
|
28573
|
+
* console.log('Final result:', message.result);
|
|
28574
|
+
* break;
|
|
28575
|
+
* case 'error':
|
|
28576
|
+
* console.error('Error:', message.error);
|
|
28577
|
+
* break;
|
|
28578
|
+
* }
|
|
28579
|
+
* }
|
|
28580
|
+
* ```
|
|
28581
|
+
*
|
|
28582
|
+
* @param params - The sampling request parameters
|
|
28583
|
+
* @param options - Optional request options (timeout, signal, task creation params, onprogress, etc.)
|
|
28584
|
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
|
28585
|
+
*
|
|
28586
|
+
* @experimental
|
|
28587
|
+
*/
|
|
28588
|
+
createMessageStream(params, options) {
|
|
28589
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
28590
|
+
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
|
28591
|
+
throw new Error("Client does not support sampling tools capability.");
|
|
28592
|
+
}
|
|
28593
|
+
if (params.messages.length > 0) {
|
|
28594
|
+
const lastMessage = params.messages[params.messages.length - 1];
|
|
28595
|
+
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
28596
|
+
const hasToolResults = lastContent.some((c) => c.type === "tool_result");
|
|
28597
|
+
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : void 0;
|
|
28598
|
+
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
28599
|
+
const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
|
|
28600
|
+
if (hasToolResults) {
|
|
28601
|
+
if (lastContent.some((c) => c.type !== "tool_result")) {
|
|
28602
|
+
throw new Error("The last message must contain only tool_result content if any is present");
|
|
28603
|
+
}
|
|
28604
|
+
if (!hasPreviousToolUse) {
|
|
28605
|
+
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
28606
|
+
}
|
|
28607
|
+
}
|
|
28608
|
+
if (hasPreviousToolUse) {
|
|
28609
|
+
const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
|
|
28610
|
+
const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
|
|
28611
|
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
28612
|
+
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
28613
|
+
}
|
|
28614
|
+
}
|
|
28615
|
+
}
|
|
28616
|
+
return this.requestStream({
|
|
28617
|
+
method: "sampling/createMessage",
|
|
28618
|
+
params
|
|
28619
|
+
}, CreateMessageResultSchema, options);
|
|
28620
|
+
}
|
|
28621
|
+
/**
|
|
28622
|
+
* Sends an elicitation request and returns an AsyncGenerator that yields response messages.
|
|
28623
|
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
|
28624
|
+
*
|
|
28625
|
+
* For task-augmented requests (especially URL-based elicitation), yields 'taskCreated'
|
|
28626
|
+
* and 'taskStatus' messages before the final result.
|
|
28627
|
+
*
|
|
28628
|
+
* @example
|
|
28629
|
+
* ```typescript
|
|
28630
|
+
* const stream = server.experimental.tasks.elicitInputStream({
|
|
28631
|
+
* mode: 'url',
|
|
28632
|
+
* message: 'Please authenticate',
|
|
28633
|
+
* elicitationId: 'auth-123',
|
|
28634
|
+
* url: 'https://example.com/auth'
|
|
28635
|
+
* }, {
|
|
28636
|
+
* task: { ttl: 300000 } // Task-augmented for long-running auth flow
|
|
28637
|
+
* });
|
|
28638
|
+
*
|
|
28639
|
+
* for await (const message of stream) {
|
|
28640
|
+
* switch (message.type) {
|
|
28641
|
+
* case 'taskCreated':
|
|
28642
|
+
* console.log('Task created:', message.task.taskId);
|
|
28643
|
+
* break;
|
|
28644
|
+
* case 'taskStatus':
|
|
28645
|
+
* console.log('Task status:', message.task.status);
|
|
28646
|
+
* break;
|
|
28647
|
+
* case 'result':
|
|
28648
|
+
* console.log('User action:', message.result.action);
|
|
28649
|
+
* break;
|
|
28650
|
+
* case 'error':
|
|
28651
|
+
* console.error('Error:', message.error);
|
|
28652
|
+
* break;
|
|
28653
|
+
* }
|
|
28654
|
+
* }
|
|
28655
|
+
* ```
|
|
28656
|
+
*
|
|
28657
|
+
* @param params - The elicitation request parameters
|
|
28658
|
+
* @param options - Optional request options (timeout, signal, task creation params, etc.)
|
|
28659
|
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
|
28660
|
+
*
|
|
28661
|
+
* @experimental
|
|
28662
|
+
*/
|
|
28663
|
+
elicitInputStream(params, options) {
|
|
28664
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
28665
|
+
const mode = params.mode ?? "form";
|
|
28666
|
+
switch (mode) {
|
|
28667
|
+
case "url": {
|
|
28668
|
+
if (!clientCapabilities?.elicitation?.url) {
|
|
28669
|
+
throw new Error("Client does not support url elicitation.");
|
|
28670
|
+
}
|
|
28671
|
+
break;
|
|
28672
|
+
}
|
|
28673
|
+
case "form": {
|
|
28674
|
+
if (!clientCapabilities?.elicitation?.form) {
|
|
28675
|
+
throw new Error("Client does not support form elicitation.");
|
|
28676
|
+
}
|
|
28677
|
+
break;
|
|
28678
|
+
}
|
|
28679
|
+
}
|
|
28680
|
+
const normalizedParams = mode === "form" && params.mode === void 0 ? { ...params, mode: "form" } : params;
|
|
28681
|
+
return this.requestStream({
|
|
28682
|
+
method: "elicitation/create",
|
|
28683
|
+
params: normalizedParams
|
|
28684
|
+
}, ElicitResultSchema, options);
|
|
28685
|
+
}
|
|
28517
28686
|
/**
|
|
28518
28687
|
* Gets the current status of a task.
|
|
28519
28688
|
*
|
|
@@ -29690,6 +29859,9 @@ var McpServer = class {
|
|
|
29690
29859
|
annotations = rest.shift();
|
|
29691
29860
|
}
|
|
29692
29861
|
} else if (typeof firstArg === "object" && firstArg !== null) {
|
|
29862
|
+
if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
|
|
29863
|
+
throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
|
|
29864
|
+
}
|
|
29693
29865
|
annotations = rest.shift();
|
|
29694
29866
|
}
|
|
29695
29867
|
}
|
|
@@ -29808,6 +29980,9 @@ function getZodSchemaObject(schema) {
|
|
|
29808
29980
|
if (isZodRawShapeCompat(schema)) {
|
|
29809
29981
|
return objectFromShape(schema);
|
|
29810
29982
|
}
|
|
29983
|
+
if (!isZodSchemaInstance(schema)) {
|
|
29984
|
+
throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
|
|
29985
|
+
}
|
|
29811
29986
|
return schema;
|
|
29812
29987
|
}
|
|
29813
29988
|
function promptArgumentsFromSchema(schema) {
|
|
@@ -30317,7 +30492,7 @@ import { homedir } from "os";
|
|
|
30317
30492
|
var DEFAULT_CONFIG = {
|
|
30318
30493
|
runtime: "auto",
|
|
30319
30494
|
images_dir: "",
|
|
30320
|
-
// Default sandbox image
|
|
30495
|
+
// Default sandbox image is expected to include python3 + basic build tools (git/make/g++).
|
|
30321
30496
|
// Note: pip/venv are not included by default in Debian; users may still need a
|
|
30322
30497
|
// custom image for richer Python workflows.
|
|
30323
30498
|
image: "docker.io/library/node:20-bookworm",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "labgate",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.47",
|
|
4
4
|
"description": "Policy-controlled sandboxes for AI coding agents on HPC (Claude-first, Apptainer, SLURM).",
|
|
5
5
|
"homepage": "https://labgate.dev",
|
|
6
6
|
"keywords": [
|
|
@@ -56,6 +56,17 @@
|
|
|
56
56
|
"better-sqlite3": "^12.6.2",
|
|
57
57
|
"node-pty": "^1.1.0"
|
|
58
58
|
},
|
|
59
|
+
"overrides": {
|
|
60
|
+
"@hono/node-server": "^1.19.14",
|
|
61
|
+
"ajv": "^8.20.0",
|
|
62
|
+
"express-rate-limit": "^8.4.1",
|
|
63
|
+
"hono": "^4.12.16",
|
|
64
|
+
"micromatch": {
|
|
65
|
+
"picomatch": "^2.3.2"
|
|
66
|
+
},
|
|
67
|
+
"path-to-regexp": "^8.4.2",
|
|
68
|
+
"qs": "^6.15.1"
|
|
69
|
+
},
|
|
59
70
|
"devDependencies": {
|
|
60
71
|
"@types/better-sqlite3": "^7.6.13",
|
|
61
72
|
"@types/node": "^22.0.0",
|