Dax Raad 8 месяцев назад
Родитель
Сommit
fed659c582

+ 0 - 8
packages/opencode/opencode.json

@@ -1,8 +0,0 @@
-{
-  "mcp": {
-    "planetscale": {
-      "type": "local",
-      "command": ["pscale", "mcp", "server"]
-    }
-  }
-}

+ 3 - 1
packages/opencode/src/provider/provider.ts

@@ -207,7 +207,9 @@ export namespace Provider {
     const sdk = await getSDK(providerID)
 
     try {
-      const language = sdk.languageModel(modelID)
+      const language =
+        // @ts-expect-error
+        "responses" in sdk ? sdk.responses(modelID) : sdk.languageModel(modelID)
       log.info("found", { providerID, modelID })
       s.models.set(key, {
         info,

+ 1 - 1
packages/opencode/src/session/index.ts

@@ -549,7 +549,7 @@ export namespace Session {
       abortSignal: abort.signal,
       stopWhen: stepCountIs(1000),
       messages: convertToModelMessages(msgs),
-      temperature: 0,
+      temperature: model.info.id === "codex-mini-latest" ? undefined : 0,
       tools: {
         ...(await MCP.tools()),
         ...tools,

+ 1 - 2
packages/opencode/src/tool/bash.ts

@@ -35,8 +35,7 @@ export const BashTool = Tool.define({
       .min(0)
       .max(MAX_TIMEOUT)
       .describe("Optional timeout in milliseconds")
-      .optional()
-      .describe("Optional timeout in milliseconds"),
+      .nullable(),
     description: z
       .string()
       .describe(

+ 1 - 1
packages/opencode/src/tool/edit.ts

@@ -20,7 +20,7 @@ export const EditTool = Tool.define({
       ),
     replaceAll: z
       .boolean()
-      .default(false)
+      .nullable()
       .describe("Replace all occurences of old_string (default false)"),
   }),
   async execute(params, ctx) {

+ 2 - 2
packages/opencode/src/tool/glob.ts

@@ -11,10 +11,10 @@ export const GlobTool = Tool.define({
     pattern: z.string().describe("The glob pattern to match files against"),
     path: z
       .string()
+      .nullable()
       .describe(
         `The directory to search in. If not specified, the current working directory will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter "undefined" or "null" - simply omit it for the default behavior. Must be a valid directory path if provided.`,
-      )
-      .optional(),
+      ),
   }),
   async execute(params) {
     const app = App.info()

+ 5 - 4
packages/opencode/src/tool/grep.ts

@@ -11,19 +11,20 @@ export const GrepTool = Tool.define({
   parameters: z.object({
     pattern: z
       .string()
+      .nullable()
       .describe("The regex pattern to search for in file contents"),
     path: z
       .string()
+      .nullable()
       .describe(
         "The directory to search in. Defaults to the current working directory.",
-      )
-      .optional(),
+      ),
     include: z
       .string()
+      .nullable()
       .describe(
         'File pattern to include in the search (e.g. "*.js", "*.{ts,tsx}")',
-      )
-      .optional(),
+      ),
   }),
   async execute(params) {
     if (!params.pattern) {

+ 10 - 2
packages/opencode/src/tool/ls.ts

@@ -22,8 +22,16 @@ export const ListTool = Tool.define({
   id: "opencode.list",
   description: DESCRIPTION,
   parameters: z.object({
-    path: z.string().describe("The absolute path to the directory to list (must be absolute, not relative)").optional(),
-    ignore: z.array(z.string()).describe("List of glob patterns to ignore").optional(),
+    path: z
+      .string()
+      .describe(
+        "The absolute path to the directory to list (must be absolute, not relative)",
+      )
+      .nullable(),
+    ignore: z
+      .array(z.string())
+      .describe("List of glob patterns to ignore")
+      .nullable(),
   }),
   async execute(params) {
     const app = App.info()

+ 2 - 2
packages/opencode/src/tool/read.ts

@@ -18,11 +18,11 @@ export const ReadTool = Tool.define({
     offset: z
       .number()
       .describe("The line number to start reading from (0-based)")
-      .optional(),
+      .nullable(),
     limit: z
       .number()
       .describe("The number of lines to read (defaults to 2000)")
-      .optional(),
+      .nullable(),
   }),
   async execute(params, ctx) {
     let filePath = params.filePath

+ 1 - 1
packages/opencode/src/tool/webfetch.ts

@@ -22,7 +22,7 @@ export const WebFetchTool = Tool.define({
       .min(0)
       .max(MAX_TIMEOUT / 1000)
       .describe("Optional timeout in seconds (max 120)")
-      .optional(),
+      .nullable(),
   }),
   async execute(params) {
     // Validate URL