@openclaw/tencent-provider 2026.9.6 → 2026.9.8
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/assets/icon.png +0 -0
- package/dist/config-compat.js +6 -18
- package/dist/stream.js +5 -20
- package/package.json +4 -4
package/assets/icon.png
CHANGED
|
Binary file
|
package/dist/config-compat.js
CHANGED
|
@@ -13,21 +13,6 @@ const TENCENT_TOKENHUB_MODEL_ALIASES = {
|
|
|
13
13
|
[TENCENT_TOKENHUB_HY3_MODEL_REF]: "Hy3 (TokenHub)",
|
|
14
14
|
[TENCENT_TOKENHUB_HY3_PREVIEW_MODEL_REF]: "Hy3 preview (TokenHub)"
|
|
15
15
|
};
|
|
16
|
-
function isTokenHubModelMapConfigured(models) {
|
|
17
|
-
return TENCENT_TOKENHUB_MANAGED_MODEL_REFS.some((ref) => Object.hasOwn(models, ref));
|
|
18
|
-
}
|
|
19
|
-
function withDefaultAlias(entry, alias) {
|
|
20
|
-
return {
|
|
21
|
-
...entry,
|
|
22
|
-
alias: entry?.alias ?? alias
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function needsDefaultAlias(entry) {
|
|
26
|
-
return entry?.alias === void 0;
|
|
27
|
-
}
|
|
28
|
-
function needsModelRepair(models, ref) {
|
|
29
|
-
return !Object.hasOwn(models, ref) || needsDefaultAlias(models[ref]);
|
|
30
|
-
}
|
|
31
16
|
function migrateDefaultModel(model) {
|
|
32
17
|
if (model === TENCENT_TOKENHUB_HY3_PREVIEW_MODEL_REF) return {
|
|
33
18
|
model: { primary: TENCENT_TOKENHUB_MIGRATION_TARGET_MODEL_REF },
|
|
@@ -47,18 +32,21 @@ function migrateDefaultModel(model) {
|
|
|
47
32
|
}
|
|
48
33
|
function migrateTencentTokenHubModelDefaults(cfg) {
|
|
49
34
|
const existingModels = cfg.agents?.defaults?.models;
|
|
50
|
-
if (!existingModels || !
|
|
35
|
+
if (!existingModels || !TENCENT_TOKENHUB_MANAGED_MODEL_REFS.some((ref) => Object.hasOwn(existingModels, ref))) return {
|
|
51
36
|
config: cfg,
|
|
52
37
|
changes: []
|
|
53
38
|
};
|
|
54
|
-
const needsModelMapRepair = TENCENT_TOKENHUB_MANAGED_MODEL_REFS.some((ref) =>
|
|
39
|
+
const needsModelMapRepair = TENCENT_TOKENHUB_MANAGED_MODEL_REFS.some((ref) => !Object.hasOwn(existingModels, ref) || existingModels[ref]?.alias === void 0);
|
|
55
40
|
const migratedModel = migrateDefaultModel(cfg.agents?.defaults?.model);
|
|
56
41
|
if (!needsModelMapRepair && !migratedModel.changed) return {
|
|
57
42
|
config: cfg,
|
|
58
43
|
changes: []
|
|
59
44
|
};
|
|
60
45
|
const nextModels = { ...existingModels };
|
|
61
|
-
for (const ref of TENCENT_TOKENHUB_MANAGED_MODEL_REFS) nextModels[ref] =
|
|
46
|
+
for (const ref of TENCENT_TOKENHUB_MANAGED_MODEL_REFS) nextModels[ref] = {
|
|
47
|
+
...existingModels[ref],
|
|
48
|
+
alias: existingModels[ref]?.alias ?? TENCENT_TOKENHUB_MODEL_ALIASES[ref]
|
|
49
|
+
};
|
|
62
50
|
const nextConfig = {
|
|
63
51
|
...cfg,
|
|
64
52
|
agents: {
|
package/dist/stream.js
CHANGED
|
@@ -11,32 +11,17 @@ const TENCENT_TWO_RUNG_EFFORT_MAP = Object.freeze({
|
|
|
11
11
|
high: "high",
|
|
12
12
|
xhigh: "high"
|
|
13
13
|
});
|
|
14
|
-
const TENCENT_TWO_RUNG_MODEL_IDS = /* @__PURE__ */ new Set(["hy3"]);
|
|
15
14
|
function resolveRequestedEffort(thinkingLevel, options) {
|
|
16
15
|
const withEffort = options ?? {};
|
|
17
16
|
const raw = typeof withEffort.reasoningEffort === "string" && withEffort.reasoningEffort || typeof withEffort.reasoning === "string" && withEffort.reasoning || typeof thinkingLevel === "string" && thinkingLevel || void 0;
|
|
18
17
|
return raw ? raw.trim().toLowerCase() : void 0;
|
|
19
18
|
}
|
|
20
|
-
function mapEffortForTencent(model, effort) {
|
|
21
|
-
if (!effort) return;
|
|
22
|
-
const modelId = model.id;
|
|
23
|
-
if (typeof modelId === "string" && TENCENT_TWO_RUNG_MODEL_IDS.has(modelId)) return TENCENT_TWO_RUNG_EFFORT_MAP[effort];
|
|
24
|
-
}
|
|
25
|
-
function isTencentCompletionsCall(model) {
|
|
26
|
-
const provider = model.provider;
|
|
27
|
-
const api = model.api;
|
|
28
|
-
return typeof provider === "string" && TENCENT_PROVIDER_IDS.has(provider) && api === "openai-completions";
|
|
29
|
-
}
|
|
30
19
|
function wrapTencentProviderStream(ctx) {
|
|
31
|
-
return createPayloadPatchStreamWrapper(ctx.streamFn, ({ payload,
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
if (mapped
|
|
35
|
-
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
payload.reasoning_effort = mapped;
|
|
39
|
-
}, { shouldPatch: ({ model }) => isTencentCompletionsCall(model) });
|
|
20
|
+
return createPayloadPatchStreamWrapper(ctx.streamFn, ({ payload, options }) => {
|
|
21
|
+
const requested = resolveRequestedEffort(ctx.thinkingLevel, options);
|
|
22
|
+
const mapped = requested && Object.hasOwn(TENCENT_TWO_RUNG_EFFORT_MAP, requested) ? TENCENT_TWO_RUNG_EFFORT_MAP[requested] : void 0;
|
|
23
|
+
if (mapped !== void 0) payload.reasoning_effort = mapped;
|
|
24
|
+
}, { shouldPatch: ({ model }) => TENCENT_PROVIDER_IDS.has(model.provider) && model.api === "openai-completions" && model.id === "hy3" });
|
|
40
25
|
}
|
|
41
26
|
//#endregion
|
|
42
27
|
export { wrapTencentProviderStream };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/tencent-provider",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.8",
|
|
4
4
|
"description": "OpenClaw Tencent Cloud provider plugin (TokenHub + Token Plan)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"openclaw": {
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"minHostVersion": ">=2026.6.9"
|
|
16
16
|
},
|
|
17
17
|
"compat": {
|
|
18
|
-
"pluginApi": ">=2026.9.
|
|
18
|
+
"pluginApi": ">=2026.9.8"
|
|
19
19
|
},
|
|
20
20
|
"build": {
|
|
21
|
-
"openclawVersion": "2026.9.
|
|
21
|
+
"openclawVersion": "2026.9.8",
|
|
22
22
|
"bundledDist": false
|
|
23
23
|
},
|
|
24
24
|
"release": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"assets/activity.svg"
|
|
43
43
|
],
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"openclaw": ">=2026.9.
|
|
45
|
+
"openclaw": ">=2026.9.8"
|
|
46
46
|
},
|
|
47
47
|
"peerDependenciesMeta": {
|
|
48
48
|
"openclaw": {
|