@openclaw/kilocode-provider 2026.7.2-beta.7 → 2026.8.1-beta.2

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.
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
+ import { n as buildKilocodeProviderWithDiscovery, t as buildKilocodeProvider } from "./provider-catalog-DI9cBci2.js";
1
2
  import { KILOCODE_BASE_URL, KILOCODE_DEFAULT_CONTEXT_WINDOW, KILOCODE_DEFAULT_COST, KILOCODE_DEFAULT_MAX_TOKENS, KILOCODE_DEFAULT_MODEL_ID, KILOCODE_DEFAULT_MODEL_NAME, KILOCODE_DEFAULT_MODEL_REF, KILOCODE_MODELS_URL, KILOCODE_MODEL_CATALOG, buildKilocodeModelDefinition, discoverKilocodeModels } from "./provider-models.js";
2
- import { buildKilocodeProvider, buildKilocodeProviderWithDiscovery } from "./provider-catalog.js";
3
3
  export { KILOCODE_BASE_URL, KILOCODE_DEFAULT_CONTEXT_WINDOW, KILOCODE_DEFAULT_COST, KILOCODE_DEFAULT_MAX_TOKENS, KILOCODE_DEFAULT_MODEL_ID, KILOCODE_DEFAULT_MODEL_NAME, KILOCODE_DEFAULT_MODEL_REF, KILOCODE_MODELS_URL, KILOCODE_MODEL_CATALOG, buildKilocodeModelDefinition, buildKilocodeProvider, buildKilocodeProviderWithDiscovery, discoverKilocodeModels };
package/dist/index.js CHANGED
@@ -1,67 +1,10 @@
1
+ import { n as buildKilocodeProviderWithDiscovery, r as openclaw_plugin_default, t as buildKilocodeProvider } from "./provider-catalog-DI9cBci2.js";
1
2
  import { KILOCODE_DEFAULT_MODEL_REF } from "./provider-models.js";
2
- import { buildKilocodeProvider, buildKilocodeProviderWithDiscovery } from "./provider-catalog.js";
3
3
  import { applyKilocodeConfig } from "./onboard.js";
4
4
  import { wrapKilocodeProviderStream } from "./stream.js";
5
5
  import { readConfiguredProviderCatalogEntries } from "openclaw/plugin-sdk/provider-catalog-shared";
6
6
  import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
7
7
  import { buildProviderReplayFamilyHooks } from "openclaw/plugin-sdk/provider-model-shared";
8
- //#region extensions/kilocode/openclaw.plugin.json
9
- var openclaw_plugin_default = {
10
- id: "kilocode",
11
- activation: { "onStartup": false },
12
- enabledByDefault: true,
13
- providers: ["kilocode"],
14
- modelPricing: { "providers": { "kilocode": {
15
- "openRouter": { "passthroughProviderModel": true },
16
- "liteLLM": { "passthroughProviderModel": true }
17
- } } },
18
- setup: { "providers": [{
19
- "id": "kilocode",
20
- "envVars": ["KILOCODE_API_KEY"]
21
- }] },
22
- providerAuthChoices: [{
23
- "provider": "kilocode",
24
- "method": "api-key",
25
- "choiceId": "kilocode-api-key",
26
- "appGuidedSecret": true,
27
- "choiceLabel": "Kilo Gateway API key",
28
- "choiceHint": "API key (OpenRouter-compatible)",
29
- "groupId": "kilocode",
30
- "groupLabel": "Kilo Gateway",
31
- "groupHint": "API key (OpenRouter-compatible)",
32
- "optionKey": "kilocodeApiKey",
33
- "cliFlag": "--kilocode-api-key",
34
- "cliOption": "--kilocode-api-key <key>",
35
- "cliDescription": "Kilo Gateway API key"
36
- }],
37
- configSchema: {
38
- "type": "object",
39
- "additionalProperties": false,
40
- "properties": {}
41
- },
42
- modelCatalog: {
43
- "providers": { "kilocode": {
44
- "baseUrl": "https://api.kilo.ai/api/gateway/",
45
- "api": "openai-completions",
46
- "models": [{
47
- "id": "kilo-auto/balanced",
48
- "name": "Auto Balanced",
49
- "reasoning": true,
50
- "input": ["text", "image"],
51
- "cost": {
52
- "input": .325,
53
- "output": 1.95,
54
- "cacheRead": .0325,
55
- "cacheWrite": .40625
56
- },
57
- "contextWindow": 1e6,
58
- "maxTokens": 65536
59
- }]
60
- } },
61
- "discovery": { "kilocode": "refreshable" }
62
- }
63
- };
64
- //#endregion
65
8
  //#region extensions/kilocode/index.ts
66
9
  const PROVIDER_ID = "kilocode";
67
10
  var kilocode_default = defineSingleProviderPluginEntry({
package/dist/onboard.js CHANGED
@@ -1,5 +1,5 @@
1
+ import { t as buildKilocodeProvider } from "./provider-catalog-DI9cBci2.js";
1
2
  import { KILOCODE_BASE_URL, KILOCODE_DEFAULT_MODEL_REF } from "./provider-models.js";
2
- import { buildKilocodeProvider } from "./provider-catalog.js";
3
3
  import { createModelCatalogPresetAppliers } from "openclaw/plugin-sdk/provider-onboard";
4
4
  //#region extensions/kilocode/onboard.ts
5
5
  const { applyConfig: applyKilocodeConfig } = createModelCatalogPresetAppliers({
@@ -0,0 +1,75 @@
1
+ import { KILOCODE_BASE_URL, discoverKilocodeModels } from "./provider-models.js";
2
+ import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
3
+ //#region extensions/kilocode/openclaw.plugin.json
4
+ var openclaw_plugin_default = {
5
+ id: "kilocode",
6
+ activation: { "onStartup": false },
7
+ enabledByDefault: true,
8
+ providers: ["kilocode"],
9
+ modelPricing: { "providers": { "kilocode": {
10
+ "openRouter": { "passthroughProviderModel": true },
11
+ "liteLLM": { "passthroughProviderModel": true }
12
+ } } },
13
+ setup: { "providers": [{
14
+ "id": "kilocode",
15
+ "envVars": ["KILOCODE_API_KEY"]
16
+ }] },
17
+ providerAuthChoices: [{
18
+ "provider": "kilocode",
19
+ "method": "api-key",
20
+ "choiceId": "kilocode-api-key",
21
+ "appGuidedSecret": true,
22
+ "choiceLabel": "Kilo Gateway API key",
23
+ "choiceHint": "API key (OpenRouter-compatible)",
24
+ "groupId": "kilocode",
25
+ "groupLabel": "Kilo Gateway",
26
+ "groupHint": "API key (OpenRouter-compatible)",
27
+ "optionKey": "kilocodeApiKey",
28
+ "cliFlag": "--kilocode-api-key",
29
+ "cliOption": "--kilocode-api-key <key>",
30
+ "cliDescription": "Kilo Gateway API key"
31
+ }],
32
+ configSchema: {
33
+ "type": "object",
34
+ "additionalProperties": false,
35
+ "properties": {}
36
+ },
37
+ modelCatalog: {
38
+ "providers": { "kilocode": {
39
+ "baseUrl": "https://api.kilo.ai/api/gateway/",
40
+ "api": "openai-completions",
41
+ "models": [{
42
+ "id": "kilo-auto/balanced",
43
+ "name": "Auto Balanced",
44
+ "reasoning": true,
45
+ "input": ["text", "image"],
46
+ "cost": {
47
+ "input": .325,
48
+ "output": 1.95,
49
+ "cacheRead": .0325,
50
+ "cacheWrite": .40625
51
+ },
52
+ "contextWindow": 1e6,
53
+ "maxTokens": 65536
54
+ }]
55
+ } },
56
+ "discovery": { "kilocode": "refreshable" }
57
+ }
58
+ };
59
+ //#endregion
60
+ //#region extensions/kilocode/provider-catalog.ts
61
+ function buildKilocodeProvider() {
62
+ return buildManifestModelProviderConfig({
63
+ providerId: "kilocode",
64
+ catalog: openclaw_plugin_default.modelCatalog.providers.kilocode
65
+ });
66
+ }
67
+ async function buildKilocodeProviderWithDiscovery() {
68
+ return {
69
+ baseUrl: KILOCODE_BASE_URL,
70
+ api: "openai-completions",
71
+ models: await discoverKilocodeModels()
72
+ };
73
+ }
74
+ //#endregion
75
+ export { buildKilocodeProviderWithDiscovery as n, openclaw_plugin_default as r, buildKilocodeProvider as t };
@@ -1,26 +1,2 @@
1
- import { KILOCODE_BASE_URL, KILOCODE_DEFAULT_COST, KILOCODE_MODEL_CATALOG, discoverKilocodeModels } from "./provider-models.js";
2
- //#region extensions/kilocode/provider-catalog.ts
3
- function buildKilocodeProvider() {
4
- return {
5
- baseUrl: KILOCODE_BASE_URL,
6
- api: "openai-completions",
7
- models: KILOCODE_MODEL_CATALOG.map((model) => ({
8
- id: model.id,
9
- name: model.name,
10
- reasoning: model.reasoning,
11
- input: model.input,
12
- cost: KILOCODE_DEFAULT_COST,
13
- contextWindow: model.contextWindow ?? 1e6,
14
- maxTokens: model.maxTokens ?? 65536
15
- }))
16
- };
17
- }
18
- async function buildKilocodeProviderWithDiscovery() {
19
- return {
20
- baseUrl: KILOCODE_BASE_URL,
21
- api: "openai-completions",
22
- models: await discoverKilocodeModels()
23
- };
24
- }
25
- //#endregion
1
+ import { n as buildKilocodeProviderWithDiscovery, t as buildKilocodeProvider } from "./provider-catalog-DI9cBci2.js";
26
2
  export { buildKilocodeProvider, buildKilocodeProviderWithDiscovery };
@@ -1,9 +1,7 @@
1
- import { readProviderJsonArrayFieldResponse } from "openclaw/plugin-sdk/provider-http";
2
- import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
3
- import { fetchWithSsrFGuard, ssrfPolicyFromHttpBaseUrlAllowedHostname } from "openclaw/plugin-sdk/ssrf-runtime";
1
+ import { buildLiveModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
2
+ import { ssrfPolicyFromHttpBaseUrlAllowedHostname } from "openclaw/plugin-sdk/ssrf-runtime";
4
3
  import { asPositiveSafeInteger, normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
5
4
  //#region extensions/kilocode/provider-models.ts
6
- const log = createSubsystemLogger("kilocode-models");
7
5
  const KILOCODE_BASE_URL = "https://api.kilo.ai/api/gateway/";
8
6
  const KILOCODE_DEFAULT_MODEL_ID = "kilo-auto/balanced";
9
7
  const KILOCODE_DEFAULT_MODEL_REF = `kilocode/${KILOCODE_DEFAULT_MODEL_ID}`;
@@ -52,7 +50,7 @@ function toModelDefinition(entry) {
52
50
  cacheRead: toPricePerMillion(entry.pricing.input_cache_read),
53
51
  cacheWrite: toPricePerMillion(entry.pricing.input_cache_write)
54
52
  },
55
- contextWindow: asPositiveSafeInteger(entry.context_length) ?? 1e6,
53
+ contextWindow: asPositiveSafeInteger(entry.top_provider?.context_length) ?? asPositiveSafeInteger(entry.context_length) ?? 1e6,
56
54
  maxTokens: asPositiveSafeInteger(entry.top_provider?.max_completion_tokens) ?? 65536
57
55
  };
58
56
  }
@@ -78,50 +76,43 @@ function readGatewayModelId(value) {
78
76
  const id = value.id;
79
77
  return typeof id === "string" ? id.trim() : "";
80
78
  }
81
- async function discoverKilocodeModels() {
82
- if (process.env.VITEST) return buildStaticCatalog();
83
- try {
84
- const { response, release } = await fetchWithSsrFGuard({
85
- url: KILOCODE_MODELS_URL,
86
- init: { headers: { Accept: "application/json" } },
87
- timeoutMs: DISCOVERY_TIMEOUT_MS,
88
- policy: ssrfPolicyFromHttpBaseUrlAllowedHostname(KILOCODE_BASE_URL),
89
- auditContext: "kilocode.model_discovery"
90
- });
79
+ function readGatewayModelRows(body) {
80
+ const data = body?.data;
81
+ if (!Array.isArray(data)) throw new Error("Kilocode model list: malformed JSON response");
82
+ return data;
83
+ }
84
+ function projectKilocodeModels(rows) {
85
+ const models = [];
86
+ const discoveredIds = /* @__PURE__ */ new Set();
87
+ for (const rawEntry of rows) {
88
+ const id = readGatewayModelId(rawEntry);
91
89
  try {
92
- if (!response.ok) {
93
- await response.body?.cancel().catch(() => void 0);
94
- log.warn(`Failed to discover models: HTTP ${response.status}, using static catalog`);
95
- return buildStaticCatalog();
96
- }
97
- const data = await readProviderJsonArrayFieldResponse(response, "Kilocode model list", "data");
98
- if (data.length === 0) {
99
- log.warn("No models found from gateway API, using static catalog");
100
- return buildStaticCatalog();
101
- }
102
- const models = [];
103
- const discoveredIds = /* @__PURE__ */ new Set();
104
- for (const rawEntry of data) {
105
- const id = readGatewayModelId(rawEntry);
106
- try {
107
- const entry = asGatewayModelEntry(rawEntry);
108
- if (!id || discoveredIds.has(id) || entry.architecture?.output_modalities?.includes("image")) continue;
109
- models.push(toModelDefinition(entry));
110
- discoveredIds.add(id);
111
- } catch (e) {
112
- log.warn(`Skipping malformed model entry "${id}": ${String(e)}`);
113
- }
114
- }
115
- const staticModels = buildStaticCatalog();
116
- for (const staticModel of staticModels) if (!discoveredIds.has(staticModel.id)) models.unshift(staticModel);
117
- return models.length > 0 ? models : buildStaticCatalog();
118
- } finally {
119
- await release();
120
- }
121
- } catch (error) {
122
- log.warn(`Discovery failed: ${String(error)}, using static catalog`);
123
- return buildStaticCatalog();
90
+ const entry = asGatewayModelEntry(rawEntry);
91
+ if (!id || discoveredIds.has(id) || entry.architecture?.output_modalities?.includes("image")) continue;
92
+ models.push(toModelDefinition(entry));
93
+ discoveredIds.add(id);
94
+ } catch {}
124
95
  }
96
+ for (const staticModel of buildStaticCatalog()) if (!discoveredIds.has(staticModel.id)) models.unshift(staticModel);
97
+ return models;
98
+ }
99
+ async function discoverKilocodeModels() {
100
+ return (await buildLiveModelProviderConfig({
101
+ providerId: "kilocode",
102
+ endpoint: KILOCODE_MODELS_URL,
103
+ providerConfig: {
104
+ baseUrl: KILOCODE_BASE_URL,
105
+ api: "openai-completions"
106
+ },
107
+ models: buildStaticCatalog(),
108
+ timeoutMs: DISCOVERY_TIMEOUT_MS,
109
+ ttlMs: 0,
110
+ readRows: readGatewayModelRows,
111
+ buildRequestHeaders: () => ({ Accept: "application/json" }),
112
+ policy: ssrfPolicyFromHttpBaseUrlAllowedHostname(KILOCODE_BASE_URL),
113
+ auditContext: "kilocode.model_discovery",
114
+ projectRows: projectKilocodeModels
115
+ })).models;
125
116
  }
126
117
  function buildKilocodeModelDefinition() {
127
118
  return {
package/dist/stream.js CHANGED
@@ -1,5 +1,5 @@
1
+ import { asOptionalRecord, normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
1
2
  import { resolveProviderRequestHeaders } from "openclaw/plugin-sdk/provider-http";
2
- import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { normalizeOpenAICompatibleReasoningPayload } from "openclaw/plugin-sdk/provider-stream-shared";
4
4
  //#region extensions/kilocode/stream.ts
5
5
  const KILOCODE_FEATURE_HEADER = "X-KILOCODE-FEATURE";
@@ -12,11 +12,8 @@ function resolveKilocodeAppHeaders() {
12
12
  function normalizeKilocodeStopPayload(payloadObj) {
13
13
  if (typeof payloadObj.stop === "string") payloadObj.stop = [payloadObj.stop];
14
14
  }
15
- function asRecord(value) {
16
- return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
17
- }
18
15
  function normalizeKilocodeStopAfterCaller(value, fallbackPayload) {
19
- const replacementPayload = asRecord(value);
16
+ const replacementPayload = asOptionalRecord(value);
20
17
  if (replacementPayload) {
21
18
  normalizeKilocodeStopPayload(replacementPayload);
22
19
  return value;
@@ -52,7 +49,7 @@ function createKilocodeStreamWrapper(baseStreamFn, thinkingLevel) {
52
49
  ...options,
53
50
  headers,
54
51
  onPayload(payload, payloadModel) {
55
- const payloadObj = asRecord(payload);
52
+ const payloadObj = asOptionalRecord(payload);
56
53
  if (payloadObj) normalizeOpenAICompatibleReasoningPayload(payloadObj, thinkingLevel);
57
54
  const result = originalOnPayload?.(payload, payloadModel);
58
55
  if (result && typeof result.then === "function") return Promise.resolve(result).then((resolved) => normalizeKilocodeStopAfterCaller(resolved, payloadObj));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/kilocode-provider",
3
- "version": "2026.7.2-beta.7",
3
+ "version": "2026.8.1-beta.2",
4
4
  "description": "OpenClaw Kilo Gateway provider plugin.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,10 +18,10 @@
18
18
  "minHostVersion": ">=2026.6.8"
19
19
  },
20
20
  "compat": {
21
- "pluginApi": ">=2026.7.2-beta.7"
21
+ "pluginApi": ">=2026.8.1-beta.2"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.7.2-beta.7",
24
+ "openclawVersion": "2026.8.1-beta.2",
25
25
  "bundledDist": false
26
26
  },
27
27
  "release": {
@@ -38,7 +38,7 @@
38
38
  "README.md"
39
39
  ],
40
40
  "peerDependencies": {
41
- "openclaw": ">=2026.7.2-beta.7"
41
+ "openclaw": ">=2026.8.1-beta.2"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "openclaw": {