{"record":{"id":"1c528b11ed0348a5","repo":"can1357/oh-my-pi","slug":"legacy-edittooloptions-operations-is-not-supported","errorCode":null,"errorMessage":"Legacy EditToolOptions.operations is not supported: OMP's built-in edit tool writes the local filesystem natively and exposes no pluggable operations seam. Register a custom edit tool via defineTool() instead of passing operations to createEditTool()/createEditToolDefinition().","messagePattern":"Legacy EditToolOptions\\.operations is not supported: OMP's built-in edit tool writes the local filesystem natively and exposes no pluggable operations seam\\. Register a custom edit tool via defineTool\\(\\) instead of passing operations to createEditTool\\(\\)/createEditToolDefinition\\(\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/extensibility/legacy-pi-coding-agent-shim.ts","lineNumber":714,"sourceCode":"\t\t\tconst sorted = [...entries].sort((a, b) => a.localeCompare(b));\n\t\t\tconst limited = sorted.slice(0, limit);\n\t\t\tconst output = limited.join(\"\\n\");\n\t\t\tconst details = sorted.length > limited.length ? { entryLimitReached: limit } : undefined;\n\t\t\tconst suffix = details ? `\\n\\n[${limit} entries limit reached]` : \"\";\n\t\t\treturn { content: [{ type: \"text\", text: `${output}${suffix}` }], details };\n\t\t},\n\t});\n}\n\n/** Create the legacy ls tool. */\nexport function createLsTool(cwd: string, options?: LsToolOptions): ToolDefinition {\n\treturn createLsToolDefinition(cwd, options);\n}\n\n/** Create the legacy edit tool definition. */\nexport function createEditToolDefinition(cwd: string, options?: EditToolOptions): ToolDefinition {\n\tif (options?.operations) {\n\t\tthrow new Error(\n\t\t\t\"Legacy EditToolOptions.operations is not supported: OMP's built-in edit tool writes the local \" +\n\t\t\t\t\"filesystem natively and exposes no pluggable operations seam. Register a custom edit tool via \" +\n\t\t\t\t\"defineTool() instead of passing operations to createEditTool()/createEditToolDefinition().\",\n\t\t);\n\t}\n\treturn legacyBuiltinTool(cwd, \"edit\");\n}\n\n/** Create the legacy edit tool. */\nexport function createEditTool(cwd: string, options?: EditToolOptions): ToolDefinition {\n\treturn createEditToolDefinition(cwd, options);\n}\n\n/** Create the legacy write tool definition. */\nexport function createWriteToolDefinition(cwd: string, options?: WriteToolOptions): ToolDefinition {\n\tif (options?.operations) {\n\t\tthrow new Error(\n\t\t\t\"Legacy WriteToolOptions.operations is not supported: OMP's built-in write tool writes the local \" +","sourceCodeStart":696,"sourceCodeEnd":732,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/extensibility/legacy-pi-coding-agent-shim.ts#L696-L732","documentation":"The legacy edit tool shim does not support the `operations` option from pi's EditToolOptions. OMP's built-in edit tool writes the local filesystem natively with no pluggable operations seam, so passing operations throws immediately at tool-definition time.","triggerScenarios":"Calling createEditTool(cwd, { operations }) or createEditToolDefinition(cwd, { operations }) with a non-undefined `operations` field.","commonSituations":"Migrating code from the legacy pi coding-agent that injected a virtual/sandboxed filesystem adapter into built-in tools; copy-pasted options from read/ls tool creation where operations is still supported.","solutions":["Remove the `operations` field from the options object.","Register a custom edit tool via defineTool() that uses your operations adapter.","If you only needed sandboxing, run the agent with a working directory inside the sandbox instead."],"exampleFix":"// before\ncreateEditToolDefinition(cwd, { operations: myOps })\n// after\ncreateEditToolDefinition(cwd)\n// or register a custom tool:\ndefineTool({ name: \"edit\", ..., execute: (args) => myOps.write(...) })","handlingStrategy":"validation","validationCode":"if (options && \"operations\" in options && options.operations) {\n  // route to a custom defineTool()-based edit tool instead\n  registerCustomEditTool(operations);\n} else {\n  createEditToolDefinition(cwd, options);\n}","typeGuard":"function hasOperations(o: EditToolOptions | undefined): o is EditToolOptions & { operations: NonNullable<EditToolOptions[\"operations\"]> } {\n  return !!o && !!o.operations;\n}","tryCatchPattern":"let tool;\ntry {\n  tool = createEditToolDefinition(cwd, options);\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"EditToolOptions.operations is not supported\")) {\n    tool = defineCustomEditTool(cwd, options.operations);\n  } else throw err;\n}","preventionTips":["Don't pass `operations` to edit/write tool factories in the OMP shim","Migrate custom-FS edit flows to defineTool()","Keep shared tool-options objects per tool kind so edit/write options don't inherit read/ls fields"],"tags":["legacy-shim","api-migration","tools","unsupported-option"],"backgroundTag":"unsupported-option-legacy-shim","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}