@codehz/ai 0.4.5 → 0.4.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codehz/ai",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "type": "module",
5
5
  "module": "dist/index.mjs",
6
6
  "exports": {
@@ -63,7 +63,7 @@ type OllamaChatRequest = {
63
63
  messages: OllamaMessage[];
64
64
  stream: true;
65
65
  tools?: OllamaTool[];
66
- /** Portable reasoningLevel → think;minimal/xhigh 不支持 */
66
+ /** Portable reasoningLevel → think;minimal/xhigh/max 不支持 */
67
67
  think?: boolean | "low" | "medium" | "high";
68
68
  options?: {
69
69
  temperature?: number;
@@ -18,7 +18,7 @@ const MESSAGE_ROLES = new Set(["user", "assistant"]);
18
18
  const REASONING_VISIBILITIES = new Set(["full", "summary", "redacted", "opaque"]);
19
19
  const TOOL_RESULT_OUTCOMES = new Set(["success", "error", "rejected"]);
20
20
  const INCLUDE_MODES = new Set(["off", "best_effort"]);
21
- const REASONING_LEVELS = new Set(["none", "minimal", "low", "medium", "high", "xhigh"]);
21
+ const REASONING_LEVELS = new Set(["none", "minimal", "low", "medium", "high", "xhigh", "max"]);
22
22
 
23
23
  function isRecord(value: unknown): value is Record<string, unknown> {
24
24
  return typeof value === "object" && value !== null;
@@ -341,7 +341,7 @@ export function validateRequest(request: AIRequest): ValidationIssue[] {
341
341
  issues,
342
342
  "reasoningLevel",
343
343
  "REASONING_LEVEL_INVALID",
344
- 'reasoningLevel must be one of: none, minimal, low, medium, high, xhigh',
344
+ "reasoningLevel must be one of: none, minimal, low, medium, high, xhigh, max",
345
345
  );
346
346
  }
347
347
  }
@@ -8,7 +8,7 @@
8
8
  import { AIRequestError } from "../core/errors.js";
9
9
  import type { ReasoningLevel } from "../types/request.js";
10
10
 
11
- export const REASONING_LEVELS = ["none", "minimal", "low", "medium", "high", "xhigh"] as const satisfies readonly ReasoningLevel[];
11
+ export const REASONING_LEVELS = ["none", "minimal", "low", "medium", "high", "xhigh", "max"] as const satisfies readonly ReasoningLevel[];
12
12
 
13
13
  export const REASONING_LEVEL_SET: ReadonlySet<string> = new Set(REASONING_LEVELS);
14
14
 
@@ -18,6 +18,7 @@ const MESSAGES_BUDGET_RATIOS: Record<Exclude<ReasoningLevel, "none">, number> =
18
18
  medium: 0.3,
19
19
  high: 0.6,
20
20
  xhigh: 0.9,
21
+ max: 0.95,
21
22
  };
22
23
 
23
24
  const OLLAMA_SUPPORTED = new Set<ReasoningLevel>(["none", "low", "medium", "high"]);
@@ -76,7 +77,7 @@ export function mapMessagesThinking(level: ReasoningLevel, maxTokens: number): M
76
77
  };
77
78
  }
78
79
 
79
- /** Ollama:`think` 字段;minimal/xhigh 不支持 */
80
+ /** Ollama:`think` 字段;minimal/xhigh/max 不支持 */
80
81
  export function mapOllamaThink(level: ReasoningLevel): OllamaThinkValue {
81
82
  assertSupportedReasoningLevel(level, OLLAMA_SUPPORTED, "ollama");
82
83
  if (level === "none") return false;
@@ -28,7 +28,7 @@ export type IncludeSettings = {
28
28
  // ── reasoning level ───────────────────────────────────────────
29
29
 
30
30
  /** Portable reasoning / thinking effort. Mapped per-adapter to provider wire fields. */
31
- export type ReasoningLevel = "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
31
+ export type ReasoningLevel = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
32
32
 
33
33
  // ── 统一请求 ──────────────────────────────────────────────────
34
34