sphica 0.6.64 → 0.6.66

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://anthropic.com/claude-code/plugin.schema.json",
3
3
  "name": "sphica",
4
- "version": "0.6.64",
4
+ "version": "0.6.66",
5
5
  "description": "Records Claude Code and Codex sessions on your machine and keeps past implementation and decisions, with their sources, for your agent to find.",
6
6
  "author": {
7
7
  "name": "iroha924",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sphica",
3
- "version": "0.6.64",
3
+ "version": "0.6.66",
4
4
  "description": "Records Claude Code and Codex sessions on your machine and keeps past implementation and decisions, with their sources, for your agent to find.",
5
5
  "author": {
6
6
  "name": "iroha924",
package/README.md CHANGED
@@ -83,6 +83,20 @@ codex plugin add sphica@sphica
83
83
 
84
84
  In Codex, open `/hooks` and mark Sphica's hooks as trusted. Automatic recording does not start until you do. If a plugin update changes the hooks, trust them again. The "Codex hooks" line of `sphica doctor` shows how many are trusted (for Codex 0.160.0).
85
85
 
86
+ Optional, Claude Code only: a pane that lists what Sphica handed the agent in this session.
87
+
88
+ ```bash
89
+ claude plugin install sphica-pane@sphica
90
+ ```
91
+
92
+ Run `/sphica-pane` to open it, and press ctrl+x then x to close it. Newest first, it shows the current work and constraints given at session start, the records given before a read, an edit, or a prompt, and the reason when Sphica stopped a shell call.
93
+
94
+ - It needs Claude Code 2.1.300 or later, the version its checks run on. Older Claude Code fails to load it, and Sphica itself keeps working.
95
+ - It is a Claude Code mod, so it runs with Claude Code's permissions. It only reads what the hooks returned and passes that on unchanged. It writes nothing, reads no files, and sends nothing anywhere.
96
+ - It recognizes Sphica's text by its wording, so text another plugin writes in the same words shows too. Treat it as a view, not a record.
97
+ - Where an organization manages Claude Code, the hooks it reads run only for plugins the organization lists, so the pane stays empty.
98
+ - Codex has no mods. `codex plugin list` shows sphica-pane too, but do not install it there: Codex warns about its hooks file in every session.
99
+
86
100
  **3. Set up in your repository**
87
101
 
88
102
  ```bash
@@ -193,6 +207,8 @@ claude plugin marketplace update sphica
193
207
  claude plugin update sphica@sphica
194
208
  ```
195
209
 
210
+ If you installed the pane, update it too with `claude plugin update sphica-pane@sphica`. A fix to it comes with the next Sphica release.
211
+
196
212
  Codex:
197
213
 
198
214
  ```bash
@@ -216,6 +232,8 @@ codex plugin remove sphica@sphica && codex plugin marketplace remove sphica
216
232
  npm uninstall -g sphica
217
233
  ```
218
234
 
235
+ If you installed the pane, remove it first with `claude plugin uninstall sphica-pane@sphica`. Removing the pane alone leaves Sphica working.
236
+
219
237
  ## Troubleshooting
220
238
 
221
239
  Run `sphica doctor` first. It shows which part is out of date or not working. Common cases:
@@ -10,7 +10,7 @@ This file is generated by `node scripts/third-party-notices.mjs`. Do not edit it
10
10
  | @clack/core | 1.5.1 | MIT |
11
11
  | @clack/prompts | 1.8.1 | MIT |
12
12
  | @hono/node-server | 2.1.1 | MIT |
13
- | @modelcontextprotocol/sdk | 1.31.0 | MIT |
13
+ | @modelcontextprotocol/sdk | 1.32.1 | MIT |
14
14
  | @stricli/core | 1.3.0 | Apache-2.0 |
15
15
  | accepts | 2.0.0 | MIT |
16
16
  | ajv | 8.20.0 | MIT |
@@ -56,7 +56,7 @@ This file is generated by `node scripts/third-party-notices.mjs`. Do not edit it
56
56
  | gopd | 1.2.0 | MIT |
57
57
  | has-symbols | 1.1.0 | MIT |
58
58
  | hasown | 2.0.4 | MIT |
59
- | hono | 4.13.8 | MIT |
59
+ | hono | 4.13.13 | MIT |
60
60
  | http-errors | 2.0.1 | MIT |
61
61
  | iconv-lite | 0.7.3 | MIT |
62
62
  | inherits | 2.0.4 | ISC |
@@ -174,7 +174,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
174
174
  SOFTWARE.
175
175
  ```
176
176
 
177
- ## @modelcontextprotocol/sdk 1.31.0
177
+ ## @modelcontextprotocol/sdk 1.32.1
178
178
 
179
179
  SPDX: MIT
180
180
  Source: https://github.com/modelcontextprotocol/typescript-sdk
@@ -1726,7 +1726,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1726
1726
  SOFTWARE.
1727
1727
  ```
1728
1728
 
1729
- ## hono 4.13.8
1729
+ ## hono 4.13.13
1730
1730
 
1731
1731
  SPDX: MIT
1732
1732
  Source: https://github.com/honojs/hono
@@ -32522,6 +32522,9 @@ class Protocol {
32522
32522
  this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
32523
32523
  const handleTaskResult = async () => {
32524
32524
  const taskId = request.params.taskId;
32525
+ if (!await this._taskStore.getTask(taskId, extra.sessionId)) {
32526
+ throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
32527
+ }
32525
32528
  if (this._taskMessageQueue) {
32526
32529
  let queuedMessage;
32527
32530
  while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
@@ -32552,12 +32555,12 @@ class Protocol {
32552
32555
  throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
32553
32556
  }
32554
32557
  if (!isTerminal(task.status)) {
32555
- await this._waitForTaskUpdate(taskId, extra.signal);
32558
+ await this._waitForTaskUpdate(taskId, extra.signal, extra.sessionId);
32556
32559
  return await handleTaskResult();
32557
32560
  }
32558
32561
  if (isTerminal(task.status)) {
32559
32562
  const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
32560
- this._clearTaskQueue(taskId);
32563
+ this._clearTaskQueue(taskId, extra.sessionId);
32561
32564
  return {
32562
32565
  ...result,
32563
32566
  _meta: {
@@ -32594,7 +32597,7 @@ class Protocol {
32594
32597
  throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
32595
32598
  }
32596
32599
  await this._taskStore.updateTaskStatus(request.params.taskId, "cancelled", "Client cancelled task execution.", extra.sessionId);
32597
- this._clearTaskQueue(request.params.taskId);
32600
+ this._clearTaskQueue(request.params.taskId, extra.sessionId);
32598
32601
  const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
32599
32602
  if (!cancelledTask) {
32600
32603
  throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
@@ -32717,6 +32720,19 @@ class Protocol {
32717
32720
  const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
32718
32721
  const capturedTransport = this._transport;
32719
32722
  const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
32723
+ const sessionId = capturedTransport?.sessionId;
32724
+ const store = this._taskStore;
32725
+ let relatedTaskFound = true;
32726
+ let relatedTaskLookup;
32727
+ if (relatedTaskId && store && this._taskMessageQueue && sessionId !== undefined) {
32728
+ relatedTaskFound = false;
32729
+ relatedTaskLookup = (async () => {
32730
+ if (!await store.getTask(relatedTaskId, sessionId)) {
32731
+ throw new McpError(ErrorCode.InvalidParams, `Task not found: ${relatedTaskId}`);
32732
+ }
32733
+ relatedTaskFound = true;
32734
+ })();
32735
+ }
32720
32736
  if (handler === undefined) {
32721
32737
  const errorResponse = {
32722
32738
  jsonrpc: "2.0",
@@ -32726,7 +32742,10 @@ class Protocol {
32726
32742
  message: "Method not found"
32727
32743
  }
32728
32744
  };
32729
- if (relatedTaskId && this._taskMessageQueue) {
32745
+ if (relatedTaskId && relatedTaskLookup) {
32746
+ const queuedError = { type: "error", message: errorResponse, timestamp: Date.now() };
32747
+ relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId), () => capturedTransport?.send(errorResponse)).catch((error62) => this._onerror(new Error(`Failed to send an error response: ${error62}`)));
32748
+ } else if (relatedTaskId && this._taskMessageQueue) {
32730
32749
  this._enqueueTaskMessage(relatedTaskId, {
32731
32750
  type: "error",
32732
32751
  message: errorResponse,
@@ -32777,7 +32796,10 @@ class Protocol {
32777
32796
  closeSSEStream: extra?.closeSSEStream,
32778
32797
  closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
32779
32798
  };
32780
- Promise.resolve().then(() => {
32799
+ (relatedTaskLookup ?? Promise.resolve()).then(() => {
32800
+ if (relatedTaskLookup && abortController.signal.aborted) {
32801
+ throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
32802
+ }
32781
32803
  if (taskCreationParams) {
32782
32804
  this.assertTaskHandlerCapability(request.method);
32783
32805
  }
@@ -32812,7 +32834,7 @@ class Protocol {
32812
32834
  ...error62["data"] !== undefined && { data: error62["data"] }
32813
32835
  }
32814
32836
  };
32815
- if (relatedTaskId && this._taskMessageQueue) {
32837
+ if (relatedTaskId && this._taskMessageQueue && relatedTaskFound) {
32816
32838
  await this._enqueueTaskMessage(relatedTaskId, {
32817
32839
  type: "error",
32818
32840
  message: errorResponse,
@@ -33200,7 +33222,7 @@ class Protocol {
33200
33222
  throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
33201
33223
  }
33202
33224
  const maxQueueSize = this._options?.maxTaskQueueSize;
33203
- await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
33225
+ await this._taskMessageQueue.enqueue(taskId, message, sessionId ?? this._transport?.sessionId, maxQueueSize);
33204
33226
  }
33205
33227
  async _clearTaskQueue(taskId, sessionId) {
33206
33228
  if (this._taskMessageQueue) {
@@ -33219,10 +33241,10 @@ class Protocol {
33219
33241
  }
33220
33242
  }
33221
33243
  }
33222
- async _waitForTaskUpdate(taskId, signal) {
33244
+ async _waitForTaskUpdate(taskId, signal, sessionId) {
33223
33245
  let interval = this._options?.defaultTaskPollInterval ?? 1000;
33224
33246
  try {
33225
- const task = await this._taskStore?.getTask(taskId);
33247
+ const task = await this._taskStore?.getTask(taskId, sessionId);
33226
33248
  if (task?.pollInterval) {
33227
33249
  interval = task.pollInterval;
33228
33250
  }
@@ -33889,6 +33911,43 @@ class ExperimentalMcpServerTasks {
33889
33911
  }
33890
33912
  }
33891
33913
  // server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
33914
+ function toolInputElementCount(value, max) {
33915
+ let count = 0;
33916
+ const stack = [value];
33917
+ while (stack.length > 0) {
33918
+ const node2 = stack.pop();
33919
+ if (node2 === null || typeof node2 !== "object")
33920
+ continue;
33921
+ if (Array.isArray(node2)) {
33922
+ for (const child of node2) {
33923
+ if (++count > max)
33924
+ return count;
33925
+ if (child !== null && typeof child === "object")
33926
+ stack.push(child);
33927
+ }
33928
+ } else {
33929
+ for (const key in node2) {
33930
+ if (!Object.prototype.hasOwnProperty.call(node2, key))
33931
+ continue;
33932
+ if (++count > max)
33933
+ return count;
33934
+ const child = node2[key];
33935
+ if (child !== null && typeof child === "object")
33936
+ stack.push(child);
33937
+ }
33938
+ }
33939
+ }
33940
+ return count;
33941
+ }
33942
+ function resolveMaxToolInputElements(value) {
33943
+ if (value === undefined || value === Infinity)
33944
+ return;
33945
+ if (typeof value !== "number" || Number.isNaN(value) || value < 1) {
33946
+ throw new RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(value)}`);
33947
+ }
33948
+ return value;
33949
+ }
33950
+
33892
33951
  class McpServer {
33893
33952
  constructor(serverInfo, options) {
33894
33953
  this._registeredResources = {};
@@ -33900,6 +33959,7 @@ class McpServer {
33900
33959
  this._resourceHandlersInitialized = false;
33901
33960
  this._promptHandlersInitialized = false;
33902
33961
  this.server = new Server(serverInfo, options);
33962
+ this._maxToolInputElements = resolveMaxToolInputElements(options?.maxToolInputElements);
33903
33963
  }
33904
33964
  get experimental() {
33905
33965
  if (!this._experimental) {
@@ -34006,12 +34066,15 @@ class McpServer {
34006
34066
  };
34007
34067
  }
34008
34068
  async validateToolInput(tool, args, toolName) {
34069
+ if (this._maxToolInputElements !== undefined && toolInputElementCount(args, this._maxToolInputElements) > this._maxToolInputElements) {
34070
+ throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for tool ${toolName}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);
34071
+ }
34009
34072
  if (!tool.inputSchema) {
34010
34073
  return;
34011
34074
  }
34012
34075
  const inputObj = normalizeObjectSchema(tool.inputSchema);
34013
34076
  const schemaToParse = inputObj ?? tool.inputSchema;
34014
- const parseResult = await safeParseAsync2(schemaToParse, args);
34077
+ const parseResult = await safeParseAsync2(schemaToParse, args ?? {});
34015
34078
  if (!parseResult.success) {
34016
34079
  const error62 = "error" in parseResult ? parseResult.error : "Unknown error";
34017
34080
  const errorMessage = getParseErrorMessage(error62);
@@ -34236,7 +34299,7 @@ class McpServer {
34236
34299
  }
34237
34300
  if (prompt.argsSchema) {
34238
34301
  const argsObj = normalizeObjectSchema(prompt.argsSchema);
34239
- const parseResult = await safeParseAsync2(argsObj, request.params.arguments);
34302
+ const parseResult = await safeParseAsync2(argsObj, request.params.arguments ?? {});
34240
34303
  if (!parseResult.success) {
34241
34304
  const error62 = "error" in parseResult ? parseResult.error : "Unknown error";
34242
34305
  const errorMessage = getParseErrorMessage(error62);
package/dist/mcp.js CHANGED
@@ -32522,6 +32522,9 @@ class Protocol {
32522
32522
  this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
32523
32523
  const handleTaskResult = async () => {
32524
32524
  const taskId = request.params.taskId;
32525
+ if (!await this._taskStore.getTask(taskId, extra.sessionId)) {
32526
+ throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
32527
+ }
32525
32528
  if (this._taskMessageQueue) {
32526
32529
  let queuedMessage;
32527
32530
  while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
@@ -32552,12 +32555,12 @@ class Protocol {
32552
32555
  throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
32553
32556
  }
32554
32557
  if (!isTerminal(task.status)) {
32555
- await this._waitForTaskUpdate(taskId, extra.signal);
32558
+ await this._waitForTaskUpdate(taskId, extra.signal, extra.sessionId);
32556
32559
  return await handleTaskResult();
32557
32560
  }
32558
32561
  if (isTerminal(task.status)) {
32559
32562
  const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
32560
- this._clearTaskQueue(taskId);
32563
+ this._clearTaskQueue(taskId, extra.sessionId);
32561
32564
  return {
32562
32565
  ...result,
32563
32566
  _meta: {
@@ -32594,7 +32597,7 @@ class Protocol {
32594
32597
  throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
32595
32598
  }
32596
32599
  await this._taskStore.updateTaskStatus(request.params.taskId, "cancelled", "Client cancelled task execution.", extra.sessionId);
32597
- this._clearTaskQueue(request.params.taskId);
32600
+ this._clearTaskQueue(request.params.taskId, extra.sessionId);
32598
32601
  const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
32599
32602
  if (!cancelledTask) {
32600
32603
  throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
@@ -32717,6 +32720,19 @@ class Protocol {
32717
32720
  const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
32718
32721
  const capturedTransport = this._transport;
32719
32722
  const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
32723
+ const sessionId = capturedTransport?.sessionId;
32724
+ const store = this._taskStore;
32725
+ let relatedTaskFound = true;
32726
+ let relatedTaskLookup;
32727
+ if (relatedTaskId && store && this._taskMessageQueue && sessionId !== undefined) {
32728
+ relatedTaskFound = false;
32729
+ relatedTaskLookup = (async () => {
32730
+ if (!await store.getTask(relatedTaskId, sessionId)) {
32731
+ throw new McpError(ErrorCode.InvalidParams, `Task not found: ${relatedTaskId}`);
32732
+ }
32733
+ relatedTaskFound = true;
32734
+ })();
32735
+ }
32720
32736
  if (handler === undefined) {
32721
32737
  const errorResponse = {
32722
32738
  jsonrpc: "2.0",
@@ -32726,7 +32742,10 @@ class Protocol {
32726
32742
  message: "Method not found"
32727
32743
  }
32728
32744
  };
32729
- if (relatedTaskId && this._taskMessageQueue) {
32745
+ if (relatedTaskId && relatedTaskLookup) {
32746
+ const queuedError = { type: "error", message: errorResponse, timestamp: Date.now() };
32747
+ relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId), () => capturedTransport?.send(errorResponse)).catch((error62) => this._onerror(new Error(`Failed to send an error response: ${error62}`)));
32748
+ } else if (relatedTaskId && this._taskMessageQueue) {
32730
32749
  this._enqueueTaskMessage(relatedTaskId, {
32731
32750
  type: "error",
32732
32751
  message: errorResponse,
@@ -32777,7 +32796,10 @@ class Protocol {
32777
32796
  closeSSEStream: extra?.closeSSEStream,
32778
32797
  closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
32779
32798
  };
32780
- Promise.resolve().then(() => {
32799
+ (relatedTaskLookup ?? Promise.resolve()).then(() => {
32800
+ if (relatedTaskLookup && abortController.signal.aborted) {
32801
+ throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
32802
+ }
32781
32803
  if (taskCreationParams) {
32782
32804
  this.assertTaskHandlerCapability(request.method);
32783
32805
  }
@@ -32812,7 +32834,7 @@ class Protocol {
32812
32834
  ...error62["data"] !== undefined && { data: error62["data"] }
32813
32835
  }
32814
32836
  };
32815
- if (relatedTaskId && this._taskMessageQueue) {
32837
+ if (relatedTaskId && this._taskMessageQueue && relatedTaskFound) {
32816
32838
  await this._enqueueTaskMessage(relatedTaskId, {
32817
32839
  type: "error",
32818
32840
  message: errorResponse,
@@ -33200,7 +33222,7 @@ class Protocol {
33200
33222
  throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
33201
33223
  }
33202
33224
  const maxQueueSize = this._options?.maxTaskQueueSize;
33203
- await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
33225
+ await this._taskMessageQueue.enqueue(taskId, message, sessionId ?? this._transport?.sessionId, maxQueueSize);
33204
33226
  }
33205
33227
  async _clearTaskQueue(taskId, sessionId) {
33206
33228
  if (this._taskMessageQueue) {
@@ -33219,10 +33241,10 @@ class Protocol {
33219
33241
  }
33220
33242
  }
33221
33243
  }
33222
- async _waitForTaskUpdate(taskId, signal) {
33244
+ async _waitForTaskUpdate(taskId, signal, sessionId) {
33223
33245
  let interval = this._options?.defaultTaskPollInterval ?? 1000;
33224
33246
  try {
33225
- const task = await this._taskStore?.getTask(taskId);
33247
+ const task = await this._taskStore?.getTask(taskId, sessionId);
33226
33248
  if (task?.pollInterval) {
33227
33249
  interval = task.pollInterval;
33228
33250
  }
@@ -33889,6 +33911,43 @@ class ExperimentalMcpServerTasks {
33889
33911
  }
33890
33912
  }
33891
33913
  // server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
33914
+ function toolInputElementCount(value, max) {
33915
+ let count = 0;
33916
+ const stack = [value];
33917
+ while (stack.length > 0) {
33918
+ const node2 = stack.pop();
33919
+ if (node2 === null || typeof node2 !== "object")
33920
+ continue;
33921
+ if (Array.isArray(node2)) {
33922
+ for (const child of node2) {
33923
+ if (++count > max)
33924
+ return count;
33925
+ if (child !== null && typeof child === "object")
33926
+ stack.push(child);
33927
+ }
33928
+ } else {
33929
+ for (const key in node2) {
33930
+ if (!Object.prototype.hasOwnProperty.call(node2, key))
33931
+ continue;
33932
+ if (++count > max)
33933
+ return count;
33934
+ const child = node2[key];
33935
+ if (child !== null && typeof child === "object")
33936
+ stack.push(child);
33937
+ }
33938
+ }
33939
+ }
33940
+ return count;
33941
+ }
33942
+ function resolveMaxToolInputElements(value) {
33943
+ if (value === undefined || value === Infinity)
33944
+ return;
33945
+ if (typeof value !== "number" || Number.isNaN(value) || value < 1) {
33946
+ throw new RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(value)}`);
33947
+ }
33948
+ return value;
33949
+ }
33950
+
33892
33951
  class McpServer {
33893
33952
  constructor(serverInfo, options) {
33894
33953
  this._registeredResources = {};
@@ -33900,6 +33959,7 @@ class McpServer {
33900
33959
  this._resourceHandlersInitialized = false;
33901
33960
  this._promptHandlersInitialized = false;
33902
33961
  this.server = new Server(serverInfo, options);
33962
+ this._maxToolInputElements = resolveMaxToolInputElements(options?.maxToolInputElements);
33903
33963
  }
33904
33964
  get experimental() {
33905
33965
  if (!this._experimental) {
@@ -34006,12 +34066,15 @@ class McpServer {
34006
34066
  };
34007
34067
  }
34008
34068
  async validateToolInput(tool, args, toolName) {
34069
+ if (this._maxToolInputElements !== undefined && toolInputElementCount(args, this._maxToolInputElements) > this._maxToolInputElements) {
34070
+ throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for tool ${toolName}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);
34071
+ }
34009
34072
  if (!tool.inputSchema) {
34010
34073
  return;
34011
34074
  }
34012
34075
  const inputObj = normalizeObjectSchema(tool.inputSchema);
34013
34076
  const schemaToParse = inputObj ?? tool.inputSchema;
34014
- const parseResult = await safeParseAsync2(schemaToParse, args);
34077
+ const parseResult = await safeParseAsync2(schemaToParse, args ?? {});
34015
34078
  if (!parseResult.success) {
34016
34079
  const error62 = "error" in parseResult ? parseResult.error : "Unknown error";
34017
34080
  const errorMessage = getParseErrorMessage(error62);
@@ -34236,7 +34299,7 @@ class McpServer {
34236
34299
  }
34237
34300
  if (prompt.argsSchema) {
34238
34301
  const argsObj = normalizeObjectSchema(prompt.argsSchema);
34239
- const parseResult = await safeParseAsync2(argsObj, request.params.arguments);
34302
+ const parseResult = await safeParseAsync2(argsObj, request.params.arguments ?? {});
34240
34303
  if (!parseResult.success) {
34241
34304
  const error62 = "error" in parseResult ? parseResult.error : "Unknown error";
34242
34305
  const errorMessage = getParseErrorMessage(error62);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sphica",
3
- "version": "0.6.64",
3
+ "version": "0.6.66",
4
4
  "description": "Records Claude Code and Codex sessions on your machine and keeps past implementation and decisions, with their sources, for your agent to find.",
5
5
  "license": "MIT",
6
6
  "type": "module",