@integrity-labs/agt-cli 0.28.1137 → 0.28.1139

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.
Files changed (30) hide show
  1. package/dist/bin/agt.js +5 -5
  2. package/dist/{chunk-LQCWKNFX.js → chunk-7U4VSBOE.js} +2 -2
  3. package/dist/{chunk-WIU4HUHD.js → chunk-DYFE224A.js} +33 -1
  4. package/dist/{chunk-WIU4HUHD.js.map → chunk-DYFE224A.js.map} +1 -1
  5. package/dist/{chunk-HZFUOGUV.js → chunk-PI2WUKWD.js} +4 -4
  6. package/dist/{claude-pair-runtime-OZLZFJZR.js → claude-pair-runtime-BOTE3DRW.js} +2 -2
  7. package/dist/lib/manager-worker.js +261 -16
  8. package/dist/lib/manager-worker.js.map +1 -1
  9. package/dist/mcp/augmented-admin.js +164 -54
  10. package/dist/mcp/augmented-help-kb.js +164 -54
  11. package/dist/mcp/augmented-support.js +164 -54
  12. package/dist/mcp/direct-chat-channel.js +121 -41
  13. package/dist/mcp/index.js +243 -59
  14. package/dist/mcp/origami.js +121 -41
  15. package/dist/mcp/slack-channel.js +121 -41
  16. package/dist/mcp/teams-channel.js +89 -41
  17. package/dist/mcp/telegram-channel.js +121 -41
  18. package/dist/mcp/whatsapp-channel.js +5447 -4340
  19. package/dist/mcp/whatsapp-link.js +5442 -4383
  20. package/dist/mcp/xero.js +6048 -2067
  21. package/dist/{persistent-session-2X3BCGV5.js → persistent-session-6O66QEI4.js} +3 -3
  22. package/dist/{responsiveness-probe-QFLFS5QX.js → responsiveness-probe-WGD3NDWG.js} +3 -3
  23. package/dist/{session-auth-dead-QE7GT5Y5.js → session-auth-dead-6N2AEFKX.js} +2 -2
  24. package/package.json +2 -2
  25. /package/dist/{chunk-LQCWKNFX.js.map → chunk-7U4VSBOE.js.map} +0 -0
  26. /package/dist/{chunk-HZFUOGUV.js.map → chunk-PI2WUKWD.js.map} +0 -0
  27. /package/dist/{claude-pair-runtime-OZLZFJZR.js.map → claude-pair-runtime-BOTE3DRW.js.map} +0 -0
  28. /package/dist/{persistent-session-2X3BCGV5.js.map → persistent-session-6O66QEI4.js.map} +0 -0
  29. /package/dist/{responsiveness-probe-QFLFS5QX.js.map → responsiveness-probe-WGD3NDWG.js.map} +0 -0
  30. /package/dist/{session-auth-dead-QE7GT5Y5.js.map → session-auth-dead-6N2AEFKX.js.map} +0 -0
@@ -14688,7 +14688,7 @@ function object(shape, params) {
14688
14688
  return new ZodMiniObject(def);
14689
14689
  }
14690
14690
 
14691
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
14691
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
14692
14692
  function isZ4Schema(s) {
14693
14693
  const schema = s;
14694
14694
  return !!schema._zod;
@@ -14772,17 +14772,33 @@ function normalizeObjectSchema(schema) {
14772
14772
  }
14773
14773
  return void 0;
14774
14774
  }
14775
+ function getDotPath(path) {
14776
+ if (path.length === 0) {
14777
+ return "object root";
14778
+ }
14779
+ return path.reduce((acc, seg, index) => {
14780
+ if (index === 0) {
14781
+ return String(seg);
14782
+ }
14783
+ if (typeof seg === "number") {
14784
+ return `${acc}[${seg}]`;
14785
+ }
14786
+ return `${acc}.${seg}`;
14787
+ }, "");
14788
+ }
14775
14789
  function getParseErrorMessage(error2) {
14776
14790
  if (error2 && typeof error2 === "object") {
14791
+ if ("issues" in error2 && Array.isArray(error2.issues) && error2.issues.length > 0) {
14792
+ return error2.issues.map((i) => {
14793
+ if (!i.path?.length) {
14794
+ return i.message;
14795
+ }
14796
+ return `${i.message} at ${getDotPath(i.path)}`;
14797
+ }).join("\n");
14798
+ }
14777
14799
  if ("message" in error2 && typeof error2.message === "string") {
14778
14800
  return error2.message;
14779
14801
  }
14780
- if ("issues" in error2 && Array.isArray(error2.issues) && error2.issues.length > 0) {
14781
- const firstIssue = error2.issues[0];
14782
- if (firstIssue && typeof firstIssue === "object" && "message" in firstIssue) {
14783
- return String(firstIssue.message);
14784
- }
14785
- }
14786
14802
  try {
14787
14803
  return JSON.stringify(error2);
14788
14804
  } catch {
@@ -15527,7 +15543,7 @@ function preprocess(fn, schema) {
15527
15543
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/external.js
15528
15544
  config(en_default2());
15529
15545
 
15530
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
15546
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
15531
15547
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
15532
15548
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
15533
15549
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
@@ -15537,10 +15553,9 @@ var ProgressTokenSchema = union([string2(), number2().int()]);
15537
15553
  var CursorSchema = string2();
15538
15554
  var TaskCreationParamsSchema = looseObject({
15539
15555
  /**
15540
- * Time in milliseconds to keep task results available after completion.
15541
- * If null, the task has unlimited lifetime until manually cleaned up.
15556
+ * Requested duration in milliseconds to retain task from creation.
15542
15557
  */
15543
- ttl: union([number2(), _null3()]).optional(),
15558
+ ttl: number2().optional(),
15544
15559
  /**
15545
15560
  * Time in milliseconds to wait between task status requests.
15546
15561
  */
@@ -15840,7 +15855,11 @@ var ClientCapabilitiesSchema = object2({
15840
15855
  /**
15841
15856
  * Present if the client supports task creation.
15842
15857
  */
15843
- tasks: ClientTasksCapabilitySchema.optional()
15858
+ tasks: ClientTasksCapabilitySchema.optional(),
15859
+ /**
15860
+ * Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
15861
+ */
15862
+ extensions: record(string2(), AssertObjectSchema).optional()
15844
15863
  });
15845
15864
  var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
15846
15865
  /**
@@ -15901,7 +15920,11 @@ var ServerCapabilitiesSchema = object2({
15901
15920
  /**
15902
15921
  * Present if the server supports task creation.
15903
15922
  */
15904
- tasks: ServerTasksCapabilitySchema.optional()
15923
+ tasks: ServerTasksCapabilitySchema.optional(),
15924
+ /**
15925
+ * Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
15926
+ */
15927
+ extensions: record(string2(), AssertObjectSchema).optional()
15905
15928
  });
15906
15929
  var InitializeResultSchema = ResultSchema.extend({
15907
15930
  /**
@@ -16093,6 +16116,12 @@ var ResourceSchema = object2({
16093
16116
  * The MIME type of this resource, if known.
16094
16117
  */
16095
16118
  mimeType: optional(string2()),
16119
+ /**
16120
+ * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
16121
+ *
16122
+ * This can be used by Hosts to display file sizes and estimate context window usage.
16123
+ */
16124
+ size: optional(number2()),
16096
16125
  /**
16097
16126
  * Optional annotations for the client.
16098
16127
  */
@@ -17045,7 +17074,7 @@ var UrlElicitationRequiredError = class extends McpError {
17045
17074
  }
17046
17075
  };
17047
17076
 
17048
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
17077
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
17049
17078
  function isTerminal(status) {
17050
17079
  return status === "completed" || status === "failed" || status === "cancelled";
17051
17080
  }
@@ -18334,7 +18363,7 @@ var zodToJsonSchema = (schema, options) => {
18334
18363
  return combined;
18335
18364
  };
18336
18365
 
18337
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
18366
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
18338
18367
  function mapMiniTarget(t) {
18339
18368
  if (!t)
18340
18369
  return "draft-7";
@@ -18376,7 +18405,7 @@ function parseWithCompat(schema, data) {
18376
18405
  return result.data;
18377
18406
  }
18378
18407
 
18379
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
18408
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
18380
18409
  var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
18381
18410
  var Protocol = class {
18382
18411
  constructor(_options) {
@@ -18417,6 +18446,9 @@ var Protocol = class {
18417
18446
  this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
18418
18447
  const handleTaskResult = async () => {
18419
18448
  const taskId = request.params.taskId;
18449
+ if (!await this._taskStore.getTask(taskId, extra.sessionId)) {
18450
+ throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
18451
+ }
18420
18452
  if (this._taskMessageQueue) {
18421
18453
  let queuedMessage;
18422
18454
  while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
@@ -18447,12 +18479,12 @@ var Protocol = class {
18447
18479
  throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
18448
18480
  }
18449
18481
  if (!isTerminal(task.status)) {
18450
- await this._waitForTaskUpdate(taskId, extra.signal);
18482
+ await this._waitForTaskUpdate(taskId, extra.signal, extra.sessionId);
18451
18483
  return await handleTaskResult();
18452
18484
  }
18453
18485
  if (isTerminal(task.status)) {
18454
18486
  const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
18455
- this._clearTaskQueue(taskId);
18487
+ this._clearTaskQueue(taskId, extra.sessionId);
18456
18488
  return {
18457
18489
  ...result,
18458
18490
  _meta: {
@@ -18489,7 +18521,7 @@ var Protocol = class {
18489
18521
  throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
18490
18522
  }
18491
18523
  await this._taskStore.updateTaskStatus(request.params.taskId, "cancelled", "Client cancelled task execution.", extra.sessionId);
18492
- this._clearTaskQueue(request.params.taskId);
18524
+ this._clearTaskQueue(request.params.taskId, extra.sessionId);
18493
18525
  const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
18494
18526
  if (!cancelledTask) {
18495
18527
  throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
@@ -18588,6 +18620,10 @@ var Protocol = class {
18588
18620
  this._progressHandlers.clear();
18589
18621
  this._taskProgressTokens.clear();
18590
18622
  this._pendingDebouncedNotifications.clear();
18623
+ for (const info of this._timeoutInfo.values()) {
18624
+ clearTimeout(info.timeoutId);
18625
+ }
18626
+ this._timeoutInfo.clear();
18591
18627
  for (const controller of this._requestHandlerAbortControllers.values()) {
18592
18628
  controller.abort();
18593
18629
  }
@@ -18613,6 +18649,19 @@ var Protocol = class {
18613
18649
  const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
18614
18650
  const capturedTransport = this._transport;
18615
18651
  const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
18652
+ const sessionId = capturedTransport?.sessionId;
18653
+ const store = this._taskStore;
18654
+ let relatedTaskFound = true;
18655
+ let relatedTaskLookup;
18656
+ if (relatedTaskId && store && this._taskMessageQueue && sessionId !== void 0) {
18657
+ relatedTaskFound = false;
18658
+ relatedTaskLookup = (async () => {
18659
+ if (!await store.getTask(relatedTaskId, sessionId)) {
18660
+ throw new McpError(ErrorCode.InvalidParams, `Task not found: ${relatedTaskId}`);
18661
+ }
18662
+ relatedTaskFound = true;
18663
+ })();
18664
+ }
18616
18665
  if (handler === void 0) {
18617
18666
  const errorResponse = {
18618
18667
  jsonrpc: "2.0",
@@ -18622,7 +18671,10 @@ var Protocol = class {
18622
18671
  message: "Method not found"
18623
18672
  }
18624
18673
  };
18625
- if (relatedTaskId && this._taskMessageQueue) {
18674
+ if (relatedTaskId && relatedTaskLookup) {
18675
+ const queuedError = { type: "error", message: errorResponse, timestamp: Date.now() };
18676
+ relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId), () => capturedTransport?.send(errorResponse)).catch((error2) => this._onerror(new Error(`Failed to send an error response: ${error2}`)));
18677
+ } else if (relatedTaskId && this._taskMessageQueue) {
18626
18678
  this._enqueueTaskMessage(relatedTaskId, {
18627
18679
  type: "error",
18628
18680
  message: errorResponse,
@@ -18673,7 +18725,10 @@ var Protocol = class {
18673
18725
  closeSSEStream: extra?.closeSSEStream,
18674
18726
  closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
18675
18727
  };
18676
- Promise.resolve().then(() => {
18728
+ (relatedTaskLookup ?? Promise.resolve()).then(() => {
18729
+ if (relatedTaskLookup && abortController.signal.aborted) {
18730
+ throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
18731
+ }
18677
18732
  if (taskCreationParams) {
18678
18733
  this.assertTaskHandlerCapability(request.method);
18679
18734
  }
@@ -18708,7 +18763,7 @@ var Protocol = class {
18708
18763
  ...error2["data"] !== void 0 && { data: error2["data"] }
18709
18764
  }
18710
18765
  };
18711
- if (relatedTaskId && this._taskMessageQueue) {
18766
+ if (relatedTaskId && this._taskMessageQueue && relatedTaskFound) {
18712
18767
  await this._enqueueTaskMessage(relatedTaskId, {
18713
18768
  type: "error",
18714
18769
  message: errorResponse,
@@ -18718,7 +18773,9 @@ var Protocol = class {
18718
18773
  await capturedTransport?.send(errorResponse);
18719
18774
  }
18720
18775
  }).catch((error2) => this._onerror(new Error(`Failed to send response: ${error2}`))).finally(() => {
18721
- this._requestHandlerAbortControllers.delete(request.id);
18776
+ if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
18777
+ this._requestHandlerAbortControllers.delete(request.id);
18778
+ }
18722
18779
  });
18723
18780
  }
18724
18781
  _onprogress(notification) {
@@ -19186,7 +19243,7 @@ var Protocol = class {
19186
19243
  throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
19187
19244
  }
19188
19245
  const maxQueueSize = this._options?.maxTaskQueueSize;
19189
- await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
19246
+ await this._taskMessageQueue.enqueue(taskId, message, sessionId ?? this._transport?.sessionId, maxQueueSize);
19190
19247
  }
19191
19248
  /**
19192
19249
  * Clears the message queue for a task and rejects any pending request resolvers.
@@ -19215,12 +19272,13 @@ var Protocol = class {
19215
19272
  * Uses polling to check for updates at the task's configured poll interval.
19216
19273
  * @param taskId The task ID to wait for
19217
19274
  * @param signal Abort signal to cancel the wait
19275
+ * @param sessionId Session of the request that waits, passed to the task store
19218
19276
  * @returns Promise that resolves when an update occurs or rejects if aborted
19219
19277
  */
19220
- async _waitForTaskUpdate(taskId, signal) {
19278
+ async _waitForTaskUpdate(taskId, signal, sessionId) {
19221
19279
  let interval = this._options?.defaultTaskPollInterval ?? 1e3;
19222
19280
  try {
19223
- const task = await this._taskStore?.getTask(taskId);
19281
+ const task = await this._taskStore?.getTask(taskId, sessionId);
19224
19282
  if (task?.pollInterval) {
19225
19283
  interval = task.pollInterval;
19226
19284
  }
@@ -19324,7 +19382,7 @@ function mergeCapabilities(base, additional) {
19324
19382
  return result;
19325
19383
  }
19326
19384
 
19327
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
19385
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
19328
19386
  var import_ajv = __toESM(require_ajv(), 1);
19329
19387
  var import_ajv_formats = __toESM(require_dist(), 1);
19330
19388
  function createDefaultAjvInstance() {
@@ -19392,7 +19450,7 @@ var AjvJsonSchemaValidator = class {
19392
19450
  }
19393
19451
  };
19394
19452
 
19395
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
19453
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
19396
19454
  var ExperimentalServerTasks = class {
19397
19455
  constructor(_server) {
19398
19456
  this._server = _server;
@@ -19605,7 +19663,7 @@ var ExperimentalServerTasks = class {
19605
19663
  }
19606
19664
  };
19607
19665
 
19608
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
19666
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
19609
19667
  function assertToolsCallTaskCapability(requests, method, entityName) {
19610
19668
  if (!requests) {
19611
19669
  throw new Error(`${entityName} does not support task creation (required for ${method})`);
@@ -19640,7 +19698,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
19640
19698
  }
19641
19699
  }
19642
19700
 
19643
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
19701
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
19644
19702
  var Server = class extends Protocol {
19645
19703
  /**
19646
19704
  * Initializes this server with the given name and version information.
@@ -19706,16 +19764,7 @@ var Server = class extends Protocol {
19706
19764
  if (!methodSchema) {
19707
19765
  throw new Error("Schema is missing a method literal");
19708
19766
  }
19709
- let methodValue;
19710
- if (isZ4Schema(methodSchema)) {
19711
- const v4Schema = methodSchema;
19712
- const v4Def = v4Schema._zod?.def;
19713
- methodValue = v4Def?.value ?? v4Schema.value;
19714
- } else {
19715
- const v3Schema = methodSchema;
19716
- const legacyDef = v3Schema._def;
19717
- methodValue = legacyDef?.value ?? v3Schema.value;
19718
- }
19767
+ const methodValue = getLiteralValue(methodSchema);
19719
19768
  if (typeof methodValue !== "string") {
19720
19769
  throw new Error("Schema method literal must be a string");
19721
19770
  }
@@ -20020,7 +20069,7 @@ var Server = class extends Protocol {
20020
20069
  }
20021
20070
  };
20022
20071
 
20023
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
20072
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
20024
20073
  var COMPLETABLE_SYMBOL = /* @__PURE__ */ Symbol.for("mcp.completable");
20025
20074
  function isCompletable(schema) {
20026
20075
  return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
@@ -20034,7 +20083,7 @@ var McpZodTypeKind;
20034
20083
  McpZodTypeKind2["Completable"] = "McpCompletable";
20035
20084
  })(McpZodTypeKind || (McpZodTypeKind = {}));
20036
20085
 
20037
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
20086
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
20038
20087
  var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
20039
20088
  function validateToolName(name) {
20040
20089
  const warnings = [];
@@ -20092,7 +20141,7 @@ function validateAndWarnToolName(name) {
20092
20141
  return result.isValid;
20093
20142
  }
20094
20143
 
20095
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
20144
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
20096
20145
  var ExperimentalMcpServerTasks = class {
20097
20146
  constructor(_mcpServer) {
20098
20147
  this._mcpServer = _mcpServer;
@@ -20107,7 +20156,43 @@ var ExperimentalMcpServerTasks = class {
20107
20156
  }
20108
20157
  };
20109
20158
 
20110
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
20159
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
20160
+ function toolInputElementCount(value, max) {
20161
+ let count = 0;
20162
+ const stack = [value];
20163
+ while (stack.length > 0) {
20164
+ const node = stack.pop();
20165
+ if (node === null || typeof node !== "object")
20166
+ continue;
20167
+ if (Array.isArray(node)) {
20168
+ for (const child of node) {
20169
+ if (++count > max)
20170
+ return count;
20171
+ if (child !== null && typeof child === "object")
20172
+ stack.push(child);
20173
+ }
20174
+ } else {
20175
+ for (const key in node) {
20176
+ if (!Object.prototype.hasOwnProperty.call(node, key))
20177
+ continue;
20178
+ if (++count > max)
20179
+ return count;
20180
+ const child = node[key];
20181
+ if (child !== null && typeof child === "object")
20182
+ stack.push(child);
20183
+ }
20184
+ }
20185
+ }
20186
+ return count;
20187
+ }
20188
+ function resolveMaxToolInputElements(value) {
20189
+ if (value === void 0 || value === Infinity)
20190
+ return void 0;
20191
+ if (typeof value !== "number" || Number.isNaN(value) || value < 1) {
20192
+ throw new RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(value)}`);
20193
+ }
20194
+ return value;
20195
+ }
20111
20196
  var McpServer = class {
20112
20197
  constructor(serverInfo, options) {
20113
20198
  this._registeredResources = {};
@@ -20119,6 +20204,7 @@ var McpServer = class {
20119
20204
  this._resourceHandlersInitialized = false;
20120
20205
  this._promptHandlersInitialized = false;
20121
20206
  this.server = new Server(serverInfo, options);
20207
+ this._maxToolInputElements = resolveMaxToolInputElements(options?.maxToolInputElements);
20122
20208
  }
20123
20209
  /**
20124
20210
  * Access experimental features.
@@ -20249,12 +20335,15 @@ var McpServer = class {
20249
20335
  * Validates tool input arguments against the tool's input schema.
20250
20336
  */
20251
20337
  async validateToolInput(tool, args, toolName) {
20338
+ if (this._maxToolInputElements !== void 0 && toolInputElementCount(args, this._maxToolInputElements) > this._maxToolInputElements) {
20339
+ throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for tool ${toolName}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);
20340
+ }
20252
20341
  if (!tool.inputSchema) {
20253
20342
  return void 0;
20254
20343
  }
20255
20344
  const inputObj = normalizeObjectSchema(tool.inputSchema);
20256
20345
  const schemaToParse = inputObj ?? tool.inputSchema;
20257
- const parseResult = await safeParseAsync2(schemaToParse, args);
20346
+ const parseResult = await safeParseAsync2(schemaToParse, args ?? {});
20258
20347
  if (!parseResult.success) {
20259
20348
  const error2 = "error" in parseResult ? parseResult.error : "Unknown error";
20260
20349
  const errorMessage = getParseErrorMessage(error2);
@@ -20492,7 +20581,7 @@ var McpServer = class {
20492
20581
  }
20493
20582
  if (prompt.argsSchema) {
20494
20583
  const argsObj = normalizeObjectSchema(prompt.argsSchema);
20495
- const parseResult = await safeParseAsync2(argsObj, request.params.arguments);
20584
+ const parseResult = await safeParseAsync2(argsObj, request.params.arguments ?? {});
20496
20585
  if (!parseResult.success) {
20497
20586
  const error2 = "error" in parseResult ? parseResult.error : "Unknown error";
20498
20587
  const errorMessage = getParseErrorMessage(error2);
@@ -20731,6 +20820,9 @@ var McpServer = class {
20731
20820
  annotations = rest.shift();
20732
20821
  }
20733
20822
  } else if (typeof firstArg === "object" && firstArg !== null) {
20823
+ if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
20824
+ throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
20825
+ }
20734
20826
  annotations = rest.shift();
20735
20827
  }
20736
20828
  }
@@ -20849,6 +20941,9 @@ function getZodSchemaObject(schema) {
20849
20941
  if (isZodRawShapeCompat(schema)) {
20850
20942
  return objectFromShape(schema);
20851
20943
  }
20944
+ if (!isZodSchemaInstance(schema)) {
20945
+ throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
20946
+ }
20852
20947
  return schema;
20853
20948
  }
20854
20949
  function promptArgumentsFromSchema(schema) {
@@ -20893,12 +20988,21 @@ var EMPTY_COMPLETION_RESULT = {
20893
20988
  }
20894
20989
  };
20895
20990
 
20896
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
20991
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
20897
20992
  import process2 from "process";
20898
20993
 
20899
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
20994
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
20995
+ var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
20900
20996
  var ReadBuffer = class {
20997
+ constructor(options) {
20998
+ this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
20999
+ }
20901
21000
  append(chunk) {
21001
+ const newSize = (this._buffer?.length ?? 0) + chunk.length;
21002
+ if (newSize > this._maxBufferSize) {
21003
+ this.clear();
21004
+ throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
21005
+ }
20902
21006
  this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
20903
21007
  }
20904
21008
  readMessage() {
@@ -20924,20 +21028,26 @@ function serializeMessage(message) {
20924
21028
  return JSON.stringify(message) + "\n";
20925
21029
  }
20926
21030
 
20927
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
21031
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
20928
21032
  var StdioServerTransport = class {
20929
- constructor(_stdin = process2.stdin, _stdout = process2.stdout) {
21033
+ constructor(_stdin = process2.stdin, _stdout = process2.stdout, options) {
20930
21034
  this._stdin = _stdin;
20931
21035
  this._stdout = _stdout;
20932
- this._readBuffer = new ReadBuffer();
20933
21036
  this._started = false;
20934
21037
  this._ondata = (chunk) => {
20935
- this._readBuffer.append(chunk);
20936
- this.processReadBuffer();
21038
+ try {
21039
+ this._readBuffer.append(chunk);
21040
+ this.processReadBuffer();
21041
+ } catch (error2) {
21042
+ this.onerror?.(error2);
21043
+ this.close().catch(() => {
21044
+ });
21045
+ }
20937
21046
  };
20938
21047
  this._onerror = (error2) => {
20939
21048
  this.onerror?.(error2);
20940
21049
  };
21050
+ this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize });
20941
21051
  }
20942
21052
  /**
20943
21053
  * Starts listening for messages on stdin.
@@ -21257,7 +21367,7 @@ var package_default = {
21257
21367
  clean: "rm -rf dist"
21258
21368
  },
21259
21369
  dependencies: {
21260
- "@modelcontextprotocol/sdk": "1.27.1",
21370
+ "@modelcontextprotocol/sdk": "1.32.1",
21261
21371
  zod: "3.25.76"
21262
21372
  },
21263
21373
  devDependencies: {