opencode-kilocode-auth 1.0.6 → 1.0.7

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/plugin.ts +8 -11
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencode-kilocode-auth",
3
3
  "module": "index.ts",
4
- "version": "1.0.6",
4
+ "version": "1.0.7",
5
5
  "author": "ported from Kilo Code",
6
6
  "description": "OpenCode plugin for Kilo Code authentication with support for various models including Giga Potato",
7
7
  "files": [
package/src/plugin.ts CHANGED
@@ -103,18 +103,22 @@ export async function KilocodeAuthPlugin(input: PluginInput): Promise<Hooks> {
103
103
  }
104
104
  }
105
105
 
106
- // Set Kilo Code authorization and required headers
106
+ // EXACT headers from Kilo Code VSCode extension (DEFAULT_HEADERS + customRequestOptions)
107
+ // Authorization is set by OpenAI SDK internally
107
108
  headers.set("Authorization", `Bearer ${currentToken}`)
108
- headers.set("x-api-key", currentToken) // Kilo Code uses both
109
+
110
+ // DEFAULT_HEADERS from kilocode/src/api/providers/constants.ts
109
111
  headers.set("HTTP-Referer", "https://kilocode.ai")
110
112
  headers.set("X-Title", "Kilo Code")
111
113
  headers.set("X-KiloCode-Version", "4.151.0")
112
114
  headers.set("User-Agent", "Kilo-Code/4.151.0")
115
+
116
+ // customRequestOptions from KilocodeOpenrouterHandler
113
117
  headers.set("X-KiloCode-EditorName", "Visual Studio Code 1.96.0")
114
118
 
115
- // Add organization header if present
119
+ // Organization header (exact casing from headers.ts)
116
120
  if (currentKilocodeAuth.organizationId) {
117
- headers.set("X-KILOCODE-ORGANIZATIONID", currentKilocodeAuth.organizationId)
121
+ headers.set("X-KiloCode-OrganizationId", currentKilocodeAuth.organizationId)
118
122
  }
119
123
 
120
124
  // Rewrite URL to Kilo Code endpoint
@@ -216,13 +220,6 @@ export async function KilocodeAuthPlugin(input: PluginInput): Promise<Hooks> {
216
220
  ],
217
221
  },
218
222
 
219
- // Add custom headers for Kilo Code requests
220
- "chat.headers": async (input, output) => {
221
- if (input.model.providerID !== KILOCODE_PROVIDER_ID) return
222
-
223
- output.headers["X-KILOCODE-EDITORNAME"] = "opencode"
224
- output.headers["X-KILOCODE-SESSIONID"] = input.sessionID
225
- },
226
223
  }
227
224
  }
228
225