@openclaw/kilocode-provider 2026.10.10 → 2026.11.5-beta.1
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/.setup/{provider-models-CABNDek2.mjs → provider-models-BMrrUkX_.mjs} +41 -53
- package/dist/.source-module-urls/02f78d08466e0e51c8047a20d3d34fa150c883abd60dff7b8a96dbcb6e1c38bf.json +1 -0
- package/dist/api.js +1 -1
- package/dist/index.js +35 -4
- package/dist/onboard.js +1 -1
- package/dist/provider-catalog.js +1 -1
- package/dist/provider-models.js +1 -1
- package/package.json +4 -4
- package/dist/.source-module-urls/aa8e6c6b3120724511951b641428edf02711dda035446f2050f060e7b755d32c.json +0 -1
- package/dist/stream.js +0 -40
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
|
|
2
|
+
import { asPositiveSafeInteger, isRecord, normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
3
|
import { buildLiveModelProviderConfig, readLiveModelCatalogStringField } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
|
|
3
4
|
import { ssrfPolicyFromHttpBaseUrlAllowedHostname } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
4
|
-
import { asPositiveSafeInteger, isRecord, normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
// extensions/kilocode/openclaw.plugin.json
|
|
6
6
|
var openclaw_plugin_default = {
|
|
7
7
|
id: "kilocode",
|
|
@@ -101,33 +101,11 @@ function parseReasoning(entry) {
|
|
|
101
101
|
if (!Array.isArray(params)) return false;
|
|
102
102
|
return params.includes("reasoning") || params.includes("include_reasoning");
|
|
103
103
|
}
|
|
104
|
-
function toModelDefinition(entry) {
|
|
105
|
-
const fallbackCost = entry.id === KILOCODE_DEFAULT_MODEL_ID ? KILOCODE_DEFAULT_COST : void 0;
|
|
106
|
-
return {
|
|
107
|
-
id: entry.id,
|
|
108
|
-
name: entry.name || entry.id,
|
|
109
|
-
reasoning: parseReasoning(entry),
|
|
110
|
-
input: parseModality(entry),
|
|
111
|
-
cost: {
|
|
112
|
-
input: toPricePerMillion(entry.pricing.prompt, fallbackCost?.input),
|
|
113
|
-
output: toPricePerMillion(entry.pricing.completion, fallbackCost?.output),
|
|
114
|
-
cacheRead: toPricePerMillion(entry.pricing.input_cache_read),
|
|
115
|
-
cacheWrite: toPricePerMillion(entry.pricing.input_cache_write)
|
|
116
|
-
},
|
|
117
|
-
contextWindow: asPositiveSafeInteger(entry.top_provider?.context_length) ?? asPositiveSafeInteger(entry.context_length) ?? KILOCODE_DEFAULT_CONTEXT_WINDOW,
|
|
118
|
-
maxTokens: asPositiveSafeInteger(entry.top_provider?.max_completion_tokens) ?? KILOCODE_DEFAULT_MAX_TOKENS
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
104
|
function buildStaticCatalog() {
|
|
122
|
-
return
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
input: model.input,
|
|
127
|
-
cost: KILOCODE_DEFAULT_COST,
|
|
128
|
-
contextWindow: model.contextWindow ?? KILOCODE_DEFAULT_CONTEXT_WINDOW,
|
|
129
|
-
maxTokens: model.maxTokens ?? KILOCODE_DEFAULT_MAX_TOKENS
|
|
130
|
-
}));
|
|
105
|
+
return buildManifestModelProviderConfig({
|
|
106
|
+
providerId: "kilocode",
|
|
107
|
+
catalog: KILOCODE_MANIFEST_CATALOG
|
|
108
|
+
}).models;
|
|
131
109
|
}
|
|
132
110
|
function asGatewayModelEntry(value) {
|
|
133
111
|
if (!isRecord(value)) throw new Error("Kilocode model list: malformed JSON response");
|
|
@@ -135,26 +113,6 @@ function asGatewayModelEntry(value) {
|
|
|
135
113
|
if (typeof entry.id !== "string" || !isRecord(entry.pricing)) throw new Error("Kilocode model list: malformed JSON response");
|
|
136
114
|
return entry;
|
|
137
115
|
}
|
|
138
|
-
function readGatewayModelRows(body) {
|
|
139
|
-
const data = body?.data;
|
|
140
|
-
if (!Array.isArray(data)) throw new Error("Kilocode model list: malformed JSON response");
|
|
141
|
-
return data;
|
|
142
|
-
}
|
|
143
|
-
function projectKilocodeModels(rows) {
|
|
144
|
-
const models = [];
|
|
145
|
-
const discoveredIds = /* @__PURE__ */ new Set();
|
|
146
|
-
for (const rawEntry of rows) {
|
|
147
|
-
const id = readLiveModelCatalogStringField(rawEntry, "id");
|
|
148
|
-
try {
|
|
149
|
-
const entry = asGatewayModelEntry(rawEntry);
|
|
150
|
-
if (!id || discoveredIds.has(id) || entry.architecture?.output_modalities?.includes("image")) continue;
|
|
151
|
-
models.push(toModelDefinition(entry));
|
|
152
|
-
discoveredIds.add(id);
|
|
153
|
-
} catch {}
|
|
154
|
-
}
|
|
155
|
-
for (const staticModel of models.length > 0 ? buildStaticCatalog() : []) if (!discoveredIds.has(staticModel.id)) models.unshift(staticModel);
|
|
156
|
-
return models;
|
|
157
|
-
}
|
|
158
116
|
async function discoverKilocodeModels(options = {}) {
|
|
159
117
|
return (await buildLiveModelProviderConfig({
|
|
160
118
|
...options,
|
|
@@ -167,16 +125,46 @@ async function discoverKilocodeModels(options = {}) {
|
|
|
167
125
|
models: buildStaticCatalog(),
|
|
168
126
|
timeoutMs: DISCOVERY_TIMEOUT_MS,
|
|
169
127
|
ttlMs: 0,
|
|
170
|
-
readRows
|
|
128
|
+
readRows(body) {
|
|
129
|
+
const data = body?.data;
|
|
130
|
+
if (!Array.isArray(data)) throw new Error("Kilocode model list: malformed JSON response");
|
|
131
|
+
return data;
|
|
132
|
+
},
|
|
171
133
|
policy: ssrfPolicyFromHttpBaseUrlAllowedHostname(KILOCODE_BASE_URL),
|
|
172
134
|
auditContext: "kilocode.model_discovery",
|
|
173
|
-
projectRows
|
|
135
|
+
projectRows(rows) {
|
|
136
|
+
const models = [];
|
|
137
|
+
const discoveredIds = /* @__PURE__ */ new Set();
|
|
138
|
+
for (const rawEntry of rows) {
|
|
139
|
+
const id = readLiveModelCatalogStringField(rawEntry, "id");
|
|
140
|
+
try {
|
|
141
|
+
const entry = asGatewayModelEntry(rawEntry);
|
|
142
|
+
if (!id || discoveredIds.has(id) || entry.architecture?.output_modalities?.includes("image")) continue;
|
|
143
|
+
const fallbackCost = entry.id === KILOCODE_DEFAULT_MODEL_ID ? KILOCODE_DEFAULT_COST : void 0;
|
|
144
|
+
models.push({
|
|
145
|
+
id: entry.id,
|
|
146
|
+
name: entry.name || entry.id,
|
|
147
|
+
reasoning: parseReasoning(entry),
|
|
148
|
+
input: parseModality(entry),
|
|
149
|
+
...Array.isArray(entry.supported_parameters) ? { compat: { supportsTools: entry.supported_parameters.includes("tools") } } : {},
|
|
150
|
+
cost: {
|
|
151
|
+
input: toPricePerMillion(entry.pricing.prompt, fallbackCost?.input),
|
|
152
|
+
output: toPricePerMillion(entry.pricing.completion, fallbackCost?.output),
|
|
153
|
+
cacheRead: toPricePerMillion(entry.pricing.input_cache_read),
|
|
154
|
+
cacheWrite: toPricePerMillion(entry.pricing.input_cache_write)
|
|
155
|
+
},
|
|
156
|
+
contextWindow: asPositiveSafeInteger(entry.top_provider?.context_length) ?? asPositiveSafeInteger(entry.context_length) ?? KILOCODE_DEFAULT_CONTEXT_WINDOW,
|
|
157
|
+
maxTokens: asPositiveSafeInteger(entry.top_provider?.max_completion_tokens) ?? KILOCODE_DEFAULT_MAX_TOKENS
|
|
158
|
+
});
|
|
159
|
+
discoveredIds.add(id);
|
|
160
|
+
} catch {}
|
|
161
|
+
}
|
|
162
|
+
for (const staticModel of models.length > 0 ? buildStaticCatalog() : []) if (!discoveredIds.has(staticModel.id)) models.unshift(staticModel);
|
|
163
|
+
return models;
|
|
164
|
+
}
|
|
174
165
|
})).models;
|
|
175
166
|
}
|
|
176
167
|
function buildKilocodeModelDefinition() {
|
|
177
|
-
return
|
|
178
|
-
...KILOCODE_DEFAULT_MODEL,
|
|
179
|
-
input: [...KILOCODE_DEFAULT_MODEL.input]
|
|
180
|
-
};
|
|
168
|
+
return KILOCODE_DEFAULT_MODEL;
|
|
181
169
|
}
|
|
182
170
|
export { KILOCODE_DEFAULT_MODEL_ID as a, KILOCODE_MODELS_URL as c, discoverKilocodeModels as d, openclaw_plugin_default as f, KILOCODE_DEFAULT_MAX_TOKENS as i, KILOCODE_MODEL_CATALOG as l, KILOCODE_DEFAULT_CONTEXT_WINDOW as n, KILOCODE_DEFAULT_MODEL_NAME as o, KILOCODE_DEFAULT_COST as r, KILOCODE_DEFAULT_MODEL_REF as s, KILOCODE_BASE_URL as t, buildKilocodeModelDefinition as u };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"entries":[{"output":"api.js","source":"extensions/kilocode/api.ts"},{"output":"index.js","source":"extensions/kilocode/index.ts"},{"output":"onboard.js","source":"extensions/kilocode/onboard.ts"},{"output":"provider-catalog.js","source":"extensions/kilocode/provider-catalog.ts"},{"output":"provider-models.js","source":"extensions/kilocode/provider-models.ts"}],"chunks":[{"output":".setup/provider-models-BMrrUkX_.mjs","sha256":"a85530959da83172ce9c05018e7480a39a50946da68c8a88c0fdc89da16a4889","facadeSource":null,"sources":["extensions/kilocode/openclaw.plugin.json","extensions/kilocode/provider-models.ts"]},{"output":"api.js","sha256":"7abcaa0013cc84f469cb52fba8351f444b115af20f71b1f58b4910b0ef48b14a","facadeSource":"extensions/kilocode/api.ts","sources":[]},{"output":"index.js","sha256":"3266909aa3ad68c22bfbc41eeb4bde30b1ef58e3da5d215c5f37b9c81d9e0cbe","facadeSource":"extensions/kilocode/index.ts","sources":["extensions/kilocode/index.ts"]},{"output":"onboard.js","sha256":"73f0273db6e8a9d86bb0334262a321c028465cf3bfdc2db7699e2c27c7781d77","facadeSource":"extensions/kilocode/onboard.ts","sources":["extensions/kilocode/onboard.ts"]},{"output":"provider-catalog.js","sha256":"74b1efa50878aa01cbbbbd39581423929cd5af624d649c9e085dddf31f0bd7f4","facadeSource":"extensions/kilocode/provider-catalog.ts","sources":["extensions/kilocode/provider-catalog.ts"]},{"output":"provider-models.js","sha256":"e8f5c14f7155543e21b63fe9ba8b68d763b68e1960bfbed68aea0e81e6d57825","facadeSource":"extensions/kilocode/provider-models.ts","sources":[]}],"unrenderedSources":["extensions/kilocode/api.ts"]}
|
package/dist/api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as KILOCODE_DEFAULT_MODEL_ID, c as KILOCODE_MODELS_URL, d as discoverKilocodeModels, i as KILOCODE_DEFAULT_MAX_TOKENS, l as KILOCODE_MODEL_CATALOG, n as KILOCODE_DEFAULT_CONTEXT_WINDOW, o as KILOCODE_DEFAULT_MODEL_NAME, r as KILOCODE_DEFAULT_COST, s as KILOCODE_DEFAULT_MODEL_REF, t as KILOCODE_BASE_URL, u as buildKilocodeModelDefinition } from "./.setup/provider-models-
|
|
1
|
+
import { a as KILOCODE_DEFAULT_MODEL_ID, c as KILOCODE_MODELS_URL, d as discoverKilocodeModels, i as KILOCODE_DEFAULT_MAX_TOKENS, l as KILOCODE_MODEL_CATALOG, n as KILOCODE_DEFAULT_CONTEXT_WINDOW, o as KILOCODE_DEFAULT_MODEL_NAME, r as KILOCODE_DEFAULT_COST, s as KILOCODE_DEFAULT_MODEL_REF, t as KILOCODE_BASE_URL, u as buildKilocodeModelDefinition } from "./.setup/provider-models-BMrrUkX_.mjs";
|
|
2
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,12 +1,19 @@
|
|
|
1
|
-
import { f as openclaw_plugin_default, s as KILOCODE_DEFAULT_MODEL_REF } from "./.setup/provider-models-
|
|
1
|
+
import { f as openclaw_plugin_default, s as KILOCODE_DEFAULT_MODEL_REF } from "./.setup/provider-models-BMrrUkX_.mjs";
|
|
2
2
|
import { buildKilocodeProvider, buildKilocodeProviderWithDiscovery } from "./provider-catalog.js";
|
|
3
3
|
import { applyKilocodeConfig } from "./onboard.js";
|
|
4
|
-
import { wrapKilocodeProviderStream } from "./stream.js";
|
|
5
4
|
import { readConfiguredProviderCatalogEntries } from "openclaw/plugin-sdk/provider-catalog-shared";
|
|
6
5
|
import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
|
|
7
|
-
import {
|
|
6
|
+
import { resolveProviderRequestHeaders } from "openclaw/plugin-sdk/provider-http";
|
|
7
|
+
import { buildProviderReplayFamilyHooks, isProxyReasoningUnsupportedModelHint } from "openclaw/plugin-sdk/provider-model-shared";
|
|
8
|
+
import { normalizeOpenAICompatibleReasoningPayload, wrapProviderPayloadHook } from "openclaw/plugin-sdk/provider-stream-shared";
|
|
9
|
+
import { asOptionalRecord, normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
10
|
// extensions/kilocode/index.ts
|
|
9
11
|
const PROVIDER_ID = "kilocode";
|
|
12
|
+
function normalizeKilocodeStopAfterCaller(value, fallbackPayload) {
|
|
13
|
+
const payload = asOptionalRecord(value) ?? fallbackPayload;
|
|
14
|
+
if (typeof payload?.stop === "string") payload.stop = [payload.stop];
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
10
17
|
var kilocode_default = defineSingleProviderPluginEntry({
|
|
11
18
|
id: PROVIDER_ID,
|
|
12
19
|
name: "Kilo Gateway Provider",
|
|
@@ -29,7 +36,31 @@ var kilocode_default = defineSingleProviderPluginEntry({
|
|
|
29
36
|
providerId: PROVIDER_ID
|
|
30
37
|
}),
|
|
31
38
|
...buildProviderReplayFamilyHooks({ family: "passthrough-gemini" }),
|
|
32
|
-
wrapStreamFn
|
|
39
|
+
wrapStreamFn(ctx) {
|
|
40
|
+
if (normalizeOptionalLowercaseString(ctx.provider) !== "kilocode" || !ctx.streamFn) return;
|
|
41
|
+
const underlying = ctx.streamFn;
|
|
42
|
+
const thinkingLevel = ctx.modelId === "kilo-auto/balanced" || isProxyReasoningUnsupportedModelHint(ctx.modelId) ? void 0 : ctx.thinkingLevel;
|
|
43
|
+
return (model, context, options) => {
|
|
44
|
+
const headers = resolveProviderRequestHeaders({
|
|
45
|
+
provider: model.provider,
|
|
46
|
+
api: model.api,
|
|
47
|
+
baseUrl: model.baseUrl,
|
|
48
|
+
capability: "llm",
|
|
49
|
+
transport: "stream",
|
|
50
|
+
callerHeaders: options?.headers,
|
|
51
|
+
defaultHeaders: { "X-KILOCODE-FEATURE": process.env.KILOCODE_FEATURE?.trim() || "openclaw" },
|
|
52
|
+
precedence: "defaults-win"
|
|
53
|
+
});
|
|
54
|
+
return underlying(model, context, {
|
|
55
|
+
...options,
|
|
56
|
+
headers,
|
|
57
|
+
onPayload: wrapProviderPayloadHook(options?.onPayload, (payload, result) => normalizeKilocodeStopAfterCaller(result, asOptionalRecord(payload)), (payload) => {
|
|
58
|
+
const payloadObj = asOptionalRecord(payload);
|
|
59
|
+
if (payloadObj) normalizeOpenAICompatibleReasoningPayload(payloadObj, thinkingLevel);
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
},
|
|
33
64
|
isCacheTtlEligible: (ctx) => ctx.modelId.startsWith("anthropic/")
|
|
34
65
|
}
|
|
35
66
|
});
|
package/dist/onboard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as KILOCODE_DEFAULT_MODEL_REF, t as KILOCODE_BASE_URL } from "./.setup/provider-models-
|
|
1
|
+
import { s as KILOCODE_DEFAULT_MODEL_REF, t as KILOCODE_BASE_URL } from "./.setup/provider-models-BMrrUkX_.mjs";
|
|
2
2
|
import { buildKilocodeProvider } from "./provider-catalog.js";
|
|
3
3
|
import { createProviderConnectionPresetAppliers } from "openclaw/plugin-sdk/provider-onboard";
|
|
4
4
|
// extensions/kilocode/onboard.ts
|
package/dist/provider-catalog.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as discoverKilocodeModels, f as openclaw_plugin_default, t as KILOCODE_BASE_URL } from "./.setup/provider-models-
|
|
1
|
+
import { d as discoverKilocodeModels, f as openclaw_plugin_default, t as KILOCODE_BASE_URL } from "./.setup/provider-models-BMrrUkX_.mjs";
|
|
2
2
|
import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
|
|
3
3
|
// extensions/kilocode/provider-catalog.ts
|
|
4
4
|
function buildKilocodeProvider() {
|
package/dist/provider-models.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as KILOCODE_BASE_URL, n as KILOCODE_DEFAULT_CONTEXT_WINDOW, r as KILOCODE_DEFAULT_COST, i as KILOCODE_DEFAULT_MAX_TOKENS, a as KILOCODE_DEFAULT_MODEL_ID, o as KILOCODE_DEFAULT_MODEL_NAME, s as KILOCODE_DEFAULT_MODEL_REF, c as KILOCODE_MODELS_URL, l as KILOCODE_MODEL_CATALOG, u as buildKilocodeModelDefinition, d as discoverKilocodeModels } from "./.setup/provider-models-
|
|
1
|
+
export { t as KILOCODE_BASE_URL, n as KILOCODE_DEFAULT_CONTEXT_WINDOW, r as KILOCODE_DEFAULT_COST, i as KILOCODE_DEFAULT_MAX_TOKENS, a as KILOCODE_DEFAULT_MODEL_ID, o as KILOCODE_DEFAULT_MODEL_NAME, s as KILOCODE_DEFAULT_MODEL_REF, c as KILOCODE_MODELS_URL, l as KILOCODE_MODEL_CATALOG, u as buildKilocodeModelDefinition, d as discoverKilocodeModels } from "./.setup/provider-models-BMrrUkX_.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/kilocode-provider",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.11.5-beta.1",
|
|
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.
|
|
21
|
+
"pluginApi": ">=2026.11.5-beta.1"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.
|
|
24
|
+
"openclawVersion": "2026.11.5-beta.1",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"assets/activity.svg"
|
|
41
41
|
],
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"openclaw": ">=2026.
|
|
43
|
+
"openclaw": ">=2026.11.5-beta.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"openclaw": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"entries":[{"output":"api.js","source":"extensions/kilocode/api.ts"},{"output":"index.js","source":"extensions/kilocode/index.ts"},{"output":"onboard.js","source":"extensions/kilocode/onboard.ts"},{"output":"provider-catalog.js","source":"extensions/kilocode/provider-catalog.ts"},{"output":"provider-models.js","source":"extensions/kilocode/provider-models.ts"},{"output":"stream.js","source":"extensions/kilocode/stream.ts"}],"chunks":[{"output":".setup/provider-models-CABNDek2.mjs","sha256":"79a155700c4150d549049d752f13ecc47d5445e65350bd2cde296359fa66b7ad","facadeSource":null,"sources":["extensions/kilocode/openclaw.plugin.json","extensions/kilocode/provider-models.ts"]},{"output":"api.js","sha256":"265c7590785d3cec0953f27cb15f565f385be0d7bb0e9dcd9e23a788c602603d","facadeSource":"extensions/kilocode/api.ts","sources":[]},{"output":"index.js","sha256":"80dfa1c9333383a7194d983624ada985d272f43f9cd3220805e4baf10318056d","facadeSource":"extensions/kilocode/index.ts","sources":["extensions/kilocode/index.ts"]},{"output":"onboard.js","sha256":"13f419a07ad8a75283f9c406eabadd22563ef2696886ca5fbc1810ca3350e5b6","facadeSource":"extensions/kilocode/onboard.ts","sources":["extensions/kilocode/onboard.ts"]},{"output":"provider-catalog.js","sha256":"a1b2b5cafb199b2caee436779891ef09f6ff34022eb78b0ba09e4ed905a87723","facadeSource":"extensions/kilocode/provider-catalog.ts","sources":["extensions/kilocode/provider-catalog.ts"]},{"output":"provider-models.js","sha256":"08f8cf42b0e8bb528e5255c5b4989095454377ad224857a856f0514f7692b257","facadeSource":"extensions/kilocode/provider-models.ts","sources":[]},{"output":"stream.js","sha256":"cbdd9eba9764eb4d57ab89dd3783fae22827c92ba14e1a358709f338009f97dc","facadeSource":"extensions/kilocode/stream.ts","sources":["extensions/kilocode/stream.ts"]}],"unrenderedSources":["extensions/kilocode/api.ts"]}
|
package/dist/stream.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { isProxyReasoningUnsupportedModelHint } from "openclaw/plugin-sdk/provider-model-shared";
|
|
2
|
-
import { asOptionalRecord, normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
-
import { resolveProviderRequestHeaders } from "openclaw/plugin-sdk/provider-http";
|
|
4
|
-
import { normalizeOpenAICompatibleReasoningPayload } from "openclaw/plugin-sdk/provider-stream-shared";
|
|
5
|
-
// extensions/kilocode/stream.ts
|
|
6
|
-
function normalizeKilocodeStopAfterCaller(value, fallbackPayload) {
|
|
7
|
-
const payload = asOptionalRecord(value) ?? fallbackPayload;
|
|
8
|
-
if (typeof payload?.stop === "string") payload.stop = [payload.stop];
|
|
9
|
-
return value;
|
|
10
|
-
}
|
|
11
|
-
function wrapKilocodeProviderStream(ctx) {
|
|
12
|
-
if (normalizeOptionalLowercaseString(ctx.provider) !== "kilocode" || !ctx.streamFn) return;
|
|
13
|
-
const underlying = ctx.streamFn;
|
|
14
|
-
const thinkingLevel = ctx.modelId === "kilo-auto/balanced" || isProxyReasoningUnsupportedModelHint(ctx.modelId) ? void 0 : ctx.thinkingLevel;
|
|
15
|
-
return (model, context, options) => {
|
|
16
|
-
const originalOnPayload = options?.onPayload;
|
|
17
|
-
const headers = resolveProviderRequestHeaders({
|
|
18
|
-
provider: typeof model.provider === "string" ? model.provider : "kilocode",
|
|
19
|
-
api: model.api,
|
|
20
|
-
baseUrl: typeof model.baseUrl === "string" ? model.baseUrl : void 0,
|
|
21
|
-
capability: "llm",
|
|
22
|
-
transport: "stream",
|
|
23
|
-
callerHeaders: options?.headers,
|
|
24
|
-
defaultHeaders: { "X-KILOCODE-FEATURE": process.env.KILOCODE_FEATURE?.trim() || "openclaw" },
|
|
25
|
-
precedence: "defaults-win"
|
|
26
|
-
});
|
|
27
|
-
return underlying(model, context, {
|
|
28
|
-
...options,
|
|
29
|
-
headers,
|
|
30
|
-
onPayload(payload, payloadModel) {
|
|
31
|
-
const payloadObj = asOptionalRecord(payload);
|
|
32
|
-
if (payloadObj) normalizeOpenAICompatibleReasoningPayload(payloadObj, thinkingLevel);
|
|
33
|
-
const result = originalOnPayload?.(payload, payloadModel);
|
|
34
|
-
if (result && typeof result.then === "function") return Promise.resolve(result).then((resolved) => normalizeKilocodeStopAfterCaller(resolved, payloadObj));
|
|
35
|
-
return normalizeKilocodeStopAfterCaller(result, payloadObj);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
export { wrapKilocodeProviderStream };
|