@hmharness/kernel 0.2.0 → 0.3.0

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.
@@ -21,6 +21,9 @@ export interface ChatOptions {
21
21
  onDelta?(kind: DeltaKind, chunk: string): void;
22
22
  }
23
23
  export declare function chat(cfg: ProviderConfig, messages: ChatMessage[], tools?: unknown[], opts?: ChatOptions): Promise<ChatResponse>;
24
+ /** Accept bases with any /vN suffix (v1 OpenAI convention, v4 zhipu coding
25
+ * plan: open.bigmodel.cn/api/coding/paas/v4) or none at all. */
26
+ export declare function endpoint(baseUrl: string): string;
24
27
  /**
25
28
  * Single multimodal call: text prompt + one image (data URL). Used by the
26
29
  * see_image tool; deliberately separate from chat() so the streaming path
package/dist/provider.js CHANGED
@@ -162,10 +162,11 @@ async function consumeStream(res, onDelta) {
162
162
  usage,
163
163
  };
164
164
  }
165
- /** Accept bases both with and without the /v1 suffix. */
166
- function endpoint(baseUrl) {
165
+ /** Accept bases with any /vN suffix (v1 OpenAI convention, v4 zhipu coding
166
+ * plan: open.bigmodel.cn/api/coding/paas/v4) or none at all. */
167
+ export function endpoint(baseUrl) {
167
168
  const b = baseUrl.replace(/\/+$/, '');
168
- return b.endsWith('/v1') ? `${b}/chat/completions` : `${b}/v1/chat/completions`;
169
+ return /\/v\d+$/.test(b) ? `${b}/chat/completions` : `${b}/v1/chat/completions`;
169
170
  }
170
171
  /**
171
172
  * Single multimodal call: text prompt + one image (data URL). Used by the
package/dist/types.js CHANGED
@@ -30,7 +30,7 @@ export function listProviders(cfg) {
30
30
  export const PROVIDER_PRESETS = [
31
31
  { name: 'deepseek', baseUrl: 'https://api.deepseek.com/v1', envVar: 'DEEPSEEK_API_KEY', model: 'deepseek-chat' },
32
32
  { name: 'kimi', baseUrl: 'https://api.moonshot.cn/v1', envVar: 'MOONSHOT_API_KEY', model: 'kimi-latest' },
33
- { name: 'glm', baseUrl: 'https://open.bigmodel.cn/api/paas/v4', envVar: 'ZHIPU_API_KEY', model: 'glm-4.7' },
33
+ { name: 'glm', baseUrl: 'https://open.bigmodel.cn/api/coding/paas/v4', envVar: 'ZHIPU_API_KEY', model: 'glm-5.3' },
34
34
  { name: 'qwen', baseUrl: 'https://dashscope.aliyuncs.com/compatible-mode/v1', envVar: 'DASHSCOPE_API_KEY', model: 'qwen3-max' },
35
35
  { name: 'openai', baseUrl: 'https://api.openai.com/v1', envVar: 'OPENAI_API_KEY', model: 'gpt-5' },
36
36
  { name: 'siliconflow', baseUrl: 'https://api.siliconflow.cn/v1', envVar: 'SILICONFLOW_API_KEY', model: 'deepseek-ai/DeepSeek-V3.2-Exp' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/kernel",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "hmharness kernel: tool registry, provider adapters, the agent loop, session log, config. Zero runtime dependencies (Node >=22 native fetch).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",