@ccx-agent/opencode-ccx 0.3.2 → 0.3.3
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/hooks/chat-params.d.ts +30 -5
- package/dist/index.js +25 -12374
- package/dist/plugin/tool-registry.d.ts +20 -3
- package/package.json +1 -1
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
type ModelCapabilities = {
|
|
2
|
+
temperature?: boolean;
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
};
|
|
5
|
+
type ModelInfo = {
|
|
6
|
+
modelID?: string;
|
|
7
|
+
capabilities?: ModelCapabilities;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
};
|
|
1
10
|
type ChatParamsInput = {
|
|
2
11
|
sessionID: string;
|
|
3
12
|
agent: string;
|
|
4
|
-
model:
|
|
5
|
-
modelID?: string;
|
|
6
|
-
[key: string]: unknown;
|
|
7
|
-
};
|
|
13
|
+
model: ModelInfo;
|
|
8
14
|
provider: unknown;
|
|
9
15
|
message: unknown;
|
|
10
16
|
};
|
|
@@ -13,7 +19,26 @@ type ChatParamsOutput = {
|
|
|
13
19
|
topP: number;
|
|
14
20
|
top_p?: number;
|
|
15
21
|
topK: number;
|
|
22
|
+
maxOutputTokens: number | undefined;
|
|
16
23
|
options: Record<string, unknown>;
|
|
17
24
|
};
|
|
18
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Sanitize LLM sampling parameters to avoid API rejections.
|
|
27
|
+
*
|
|
28
|
+
* Two classes of problems are addressed:
|
|
29
|
+
*
|
|
30
|
+
* 1. **Model does not support temperature** — Reasoning models (o1/o3/o4-mini,
|
|
31
|
+
* Claude thinking, etc.) report `capabilities.temperature === false`.
|
|
32
|
+
* For these models we strip both `temperature` and `topP`/`top_p` because
|
|
33
|
+
* the provider will reject the request if either is present.
|
|
34
|
+
*
|
|
35
|
+
* 2. **temperature and top_p both present** — Some providers (e.g. certain
|
|
36
|
+
* OpenAI endpoints) refuse requests that set both simultaneously.
|
|
37
|
+
* We keep `temperature` (the more commonly configured knob) and drop `topP`.
|
|
38
|
+
*
|
|
39
|
+
* This hook runs for every LLM call — main agent and subagents alike — so it
|
|
40
|
+
* covers the child-session path that previously caused
|
|
41
|
+
* "`temperature` and `top_p` cannot both be specified" errors.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createChatParamsHook(): (input: ChatParamsInput, output: ChatParamsOutput) => Promise<void>;
|
|
19
44
|
export {};
|