@deepstrike/sdk 0.2.51 → 0.2.60

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.
Files changed (148) hide show
  1. package/README.md +28 -28
  2. package/dist/agent-ir.d.ts +103 -0
  3. package/dist/agent-ir.js +134 -0
  4. package/dist/agent.d.ts +67 -0
  5. package/dist/agent.js +36 -0
  6. package/dist/collaboration/harness.js +1 -1
  7. package/dist/collaboration/modes/creator-verifier.d.ts +2 -7
  8. package/dist/collaboration/modes/creator-verifier.js +4 -6
  9. package/dist/collaboration/pool.d.ts +8 -20
  10. package/dist/collaboration/pool.js +27 -97
  11. package/dist/compat/anthropic/mcp.d.ts +15 -0
  12. package/dist/compat/anthropic/mcp.js +10 -0
  13. package/dist/compat/openai/agent.d.ts +34 -0
  14. package/dist/compat/openai/agent.js +24 -0
  15. package/dist/governance.d.ts +1 -17
  16. package/dist/governance.js +1 -34
  17. package/dist/guardrail.d.ts +6 -0
  18. package/dist/guardrail.js +1 -0
  19. package/dist/handoff-target.d.ts +12 -0
  20. package/dist/handoff-target.js +1 -0
  21. package/dist/harness/manifest.js +0 -4
  22. package/dist/index.d.ts +19 -7
  23. package/dist/index.js +8 -5
  24. package/dist/kernel.d.ts +2 -20
  25. package/dist/knowledge/public.d.ts +29 -0
  26. package/dist/knowledge/public.js +1 -0
  27. package/dist/mcp-server.d.ts +28 -0
  28. package/dist/mcp-server.js +1 -0
  29. package/dist/memory/agent.d.ts +2 -2
  30. package/dist/memory/agent.js +2 -2
  31. package/dist/memory/durable.d.ts +16 -0
  32. package/dist/memory/durable.js +46 -0
  33. package/dist/memory/in-memory-store.d.ts +9 -7
  34. package/dist/memory/in-memory-store.js +8 -2
  35. package/dist/memory/protocols.d.ts +22 -4
  36. package/dist/memory/public.d.ts +4 -3
  37. package/dist/memory/public.js +3 -2
  38. package/dist/providers/anthropic-adapter.d.ts +47 -0
  39. package/dist/providers/anthropic-adapter.js +444 -0
  40. package/dist/providers/anthropic-compatible.d.ts +2 -3
  41. package/dist/providers/anthropic-compatible.js +8 -5
  42. package/dist/providers/anthropic.d.ts +19 -23
  43. package/dist/providers/anthropic.js +169 -395
  44. package/dist/providers/base.js +43 -3
  45. package/dist/providers/capability-router.d.ts +29 -0
  46. package/dist/providers/capability-router.js +43 -0
  47. package/dist/providers/catalog.d.ts +16 -4
  48. package/dist/providers/catalog.js +112 -21
  49. package/dist/providers/content-normalization.d.ts +57 -0
  50. package/dist/providers/content-normalization.js +238 -0
  51. package/dist/providers/content-policy.d.ts +16 -0
  52. package/dist/providers/content-policy.js +39 -0
  53. package/dist/providers/credentials.d.ts +83 -0
  54. package/dist/providers/credentials.js +190 -0
  55. package/dist/providers/endpoints.d.ts +137 -0
  56. package/dist/providers/endpoints.js +128 -0
  57. package/dist/providers/factories.js +9 -3
  58. package/dist/providers/gemini-adapter.d.ts +33 -0
  59. package/dist/providers/gemini-adapter.js +272 -0
  60. package/dist/providers/gemini.d.ts +16 -3
  61. package/dist/providers/gemini.js +97 -195
  62. package/dist/providers/model-catalog.d.ts +37 -0
  63. package/dist/providers/model-catalog.js +62 -0
  64. package/dist/providers/model-registry.d.ts +98 -0
  65. package/dist/providers/model-registry.js +315 -0
  66. package/dist/providers/ollama-adapter.d.ts +65 -0
  67. package/dist/providers/ollama-adapter.js +188 -0
  68. package/dist/providers/ollama.d.ts +9 -4
  69. package/dist/providers/ollama.js +96 -109
  70. package/dist/providers/openai-chat-dialects.d.ts +154 -0
  71. package/dist/providers/openai-chat-dialects.js +179 -0
  72. package/dist/providers/openai-chat.d.ts +46 -18
  73. package/dist/providers/openai-chat.js +418 -51
  74. package/dist/providers/openai-responses-adapter.d.ts +42 -0
  75. package/dist/providers/openai-responses-adapter.js +341 -0
  76. package/dist/providers/openai-responses.d.ts +14 -33
  77. package/dist/providers/openai-responses.js +131 -264
  78. package/dist/providers/openai.d.ts +29 -76
  79. package/dist/providers/openai.js +195 -292
  80. package/dist/providers/protocol-adapter.d.ts +34 -0
  81. package/dist/providers/protocol-adapter.js +9 -0
  82. package/dist/providers/protocol-capabilities.d.ts +34 -0
  83. package/dist/providers/protocol-capabilities.js +44 -0
  84. package/dist/providers/provider-error.d.ts +31 -0
  85. package/dist/providers/provider-error.js +149 -0
  86. package/dist/providers/public.d.ts +26 -3
  87. package/dist/providers/public.js +13 -1
  88. package/dist/providers/registry.d.ts +7 -6
  89. package/dist/providers/registry.js +47 -20
  90. package/dist/providers/request-plan.d.ts +86 -0
  91. package/dist/providers/request-plan.js +175 -0
  92. package/dist/providers/usage-normalizer.d.ts +48 -0
  93. package/dist/providers/usage-normalizer.js +96 -0
  94. package/dist/providers/vendor-profiles.d.ts +2 -15
  95. package/dist/providers/vendor-profiles.js +14 -60
  96. package/dist/runtime/canonical-kernel-step.d.ts +10 -2
  97. package/dist/runtime/canonical-kernel-step.js +106 -32
  98. package/dist/runtime/context-policy.d.ts +10 -12
  99. package/dist/runtime/context-policy.js +6 -8
  100. package/dist/runtime/durable-content.d.ts +50 -0
  101. package/dist/runtime/durable-content.js +159 -0
  102. package/dist/runtime/execution-plane.d.ts +2 -2
  103. package/dist/runtime/execution-plane.js +2 -2
  104. package/dist/runtime/kernel-event-log.js +0 -1
  105. package/dist/runtime/kernel-step.d.ts +0 -1
  106. package/dist/runtime/kernel-step.js +4 -2
  107. package/dist/runtime/mcp-proxy-plane.d.ts +25 -1
  108. package/dist/runtime/mcp-proxy-plane.js +44 -6
  109. package/dist/runtime/output-schema.d.ts +1 -2
  110. package/dist/runtime/provider-replay.d.ts +1 -1
  111. package/dist/runtime/provider-replay.js +12 -27
  112. package/dist/runtime/reactive-session.d.ts +1 -1
  113. package/dist/runtime/reactive-session.js +2 -3
  114. package/dist/runtime/run-group.d.ts +1 -1
  115. package/dist/runtime/runner.d.ts +26 -40
  116. package/dist/runtime/runner.js +145 -63
  117. package/dist/runtime/session-log.d.ts +8 -1
  118. package/dist/runtime/session-log.js +42 -2
  119. package/dist/runtime/session-repair.d.ts +1 -1
  120. package/dist/runtime/session-repair.js +1 -1
  121. package/dist/runtime/sub-agent-orchestrator.d.ts +1 -1
  122. package/dist/runtime/sub-agent-orchestrator.js +8 -11
  123. package/dist/runtime/workflow-control-flow.d.ts +0 -4
  124. package/dist/runtime/workflow-control-flow.js +0 -16
  125. package/dist/session.d.ts +11 -0
  126. package/dist/session.js +1 -0
  127. package/dist/skill.d.ts +17 -0
  128. package/dist/skill.js +16 -0
  129. package/dist/skills/loader.d.ts +3 -0
  130. package/dist/tools/errors.d.ts +1 -3
  131. package/dist/tools/errors.js +1 -3
  132. package/dist/tools/index.d.ts +3 -0
  133. package/dist/types/agent.d.ts +21 -9
  134. package/dist/types/agent.js +30 -4
  135. package/dist/types.d.ts +128 -13
  136. package/package.json +3 -3
  137. package/dist/providers/deepseek.d.ts +0 -46
  138. package/dist/providers/deepseek.js +0 -97
  139. package/dist/providers/glm.d.ts +0 -25
  140. package/dist/providers/glm.js +0 -48
  141. package/dist/providers/kimi.d.ts +0 -23
  142. package/dist/providers/kimi.js +0 -30
  143. package/dist/providers/minimax.d.ts +0 -49
  144. package/dist/providers/minimax.js +0 -98
  145. package/dist/providers/profiles.d.ts +0 -1992
  146. package/dist/providers/profiles.js +0 -796
  147. package/dist/providers/qwen.d.ts +0 -38
  148. package/dist/providers/qwen.js +0 -97
@@ -1,46 +0,0 @@
1
- import type { ProviderDescriptor, RuntimePolicy } from "../types.js";
2
- import { OpenAIChatProvider, type OpenAIChatTurnReasoning } from "./openai.js";
3
- import { AnthropicCompatibleProvider } from "./anthropic-compatible.js";
4
- /**
5
- * DeepSeek over its Anthropic-compatible endpoint.
6
- * @deprecated Prefer `deepseek({ protocol: "anthropic" })`. Behavior is now fully
7
- * data-driven via `anthropicVendorProfiles.deepseek`; this thin shim is kept for
8
- * backward compatibility and `instanceof` checks.
9
- */
10
- export declare class DeepSeekAnthropicProvider extends AnthropicCompatibleProvider {
11
- constructor(apiKey: string, model?: string, retry?: {
12
- maxRetries: number;
13
- baseDelay: number;
14
- }, baseURL?: string);
15
- }
16
- /**
17
- * DeepSeek over its OpenAI-compatible endpoint. Reasoning is carried out-of-band as
18
- * `reasoning_content`; replay persists DeepSeek's schema_version-2 envelope (with the
19
- * native `tool_calls` blocks). Request shaping (`reasoning_effort` + `extra_body.thinking`)
20
- * and replay are supplied via the OpenAIChatProvider Template-Method hooks; the streaming /
21
- * tool-call machinery is inherited from the base class.
22
- */
23
- export declare class DeepSeekProvider extends OpenAIChatProvider {
24
- constructor(apiKey: string, model?: string, retry?: {
25
- maxRetries: number;
26
- baseDelay: number;
27
- }, baseURL?: string);
28
- runtimePolicy(): RuntimePolicy;
29
- descriptor(): ProviderDescriptor;
30
- protected requireNonEmptyReasoningReplayForToolTurns(extensions?: Record<string, unknown>): boolean;
31
- protected cacheKeyParams(): Record<string, unknown>;
32
- protected usesInlineThinkingTags(): boolean;
33
- protected exposeReasoningDelta(extensions?: Record<string, unknown>): boolean;
34
- protected prepareExtensions(extensions?: Record<string, unknown>): Record<string, unknown>;
35
- protected rememberCompleteReplay(content: string, toolCalls: Array<{
36
- id: string;
37
- name: string;
38
- arguments: string;
39
- }>, r: OpenAIChatTurnReasoning): void;
40
- protected rememberStreamReplay(content: string, toolCalls: Array<{
41
- id: string;
42
- name: string;
43
- arguments: string;
44
- }>, r: OpenAIChatTurnReasoning): void;
45
- private rememberDeepSeekReplay;
46
- }
@@ -1,97 +0,0 @@
1
- import { OpenAIChatProvider } from "./openai.js";
2
- import { AnthropicCompatibleProvider } from "./anthropic-compatible.js";
3
- import { endpointProfiles } from "./profiles.js";
4
- import { omitExtensionKeys } from "./base.js";
5
- import { DEEPSEEK_POLICIES, anthropicVendorProfiles } from "./vendor-profiles.js";
6
- /**
7
- * DeepSeek over its Anthropic-compatible endpoint.
8
- * @deprecated Prefer `deepseek({ protocol: "anthropic" })`. Behavior is now fully
9
- * data-driven via `anthropicVendorProfiles.deepseek`; this thin shim is kept for
10
- * backward compatibility and `instanceof` checks.
11
- */
12
- export class DeepSeekAnthropicProvider extends AnthropicCompatibleProvider {
13
- constructor(apiKey, model, retry, baseURL) {
14
- super(anthropicVendorProfiles.deepseek, apiKey, model, retry, baseURL);
15
- }
16
- }
17
- /**
18
- * DeepSeek over its OpenAI-compatible endpoint. Reasoning is carried out-of-band as
19
- * `reasoning_content`; replay persists DeepSeek's schema_version-2 envelope (with the
20
- * native `tool_calls` blocks). Request shaping (`reasoning_effort` + `extra_body.thinking`)
21
- * and replay are supplied via the OpenAIChatProvider Template-Method hooks; the streaming /
22
- * tool-call machinery is inherited from the base class.
23
- */
24
- export class DeepSeekProvider extends OpenAIChatProvider {
25
- constructor(apiKey, model = "deepseek-v4-flash", retry, baseURL = endpointProfiles["deepseek.openai"].baseURL) {
26
- super(apiKey, model, retry, baseURL);
27
- }
28
- runtimePolicy() {
29
- return DEEPSEEK_POLICIES[this.model] ?? {};
30
- }
31
- descriptor() {
32
- return {
33
- provider: "deepseek",
34
- protocol: "openai-chat",
35
- model: this.model,
36
- reasoning: {
37
- supported: true,
38
- preserveAcrossToolTurns: true,
39
- requiresReplayForToolTurns: true,
40
- },
41
- toolCalls: {
42
- supported: true,
43
- requiresStrictPairing: true,
44
- },
45
- };
46
- }
47
- requireNonEmptyReasoningReplayForToolTurns(extensions) {
48
- if (extensions?.__deepstrikeThinkingEnabled === false)
49
- return false;
50
- return extensions?.thinking !== false;
51
- }
52
- // DeepSeek strictly validates the request body and 400s on unknown params, so never send
53
- // OpenAI's `prompt_cache_key` (DeepSeek auto prefix-caches anyway).
54
- // Ref: https://api-docs.deepseek.com/quick_start/error_codes
55
- cacheKeyParams() {
56
- return {};
57
- }
58
- // Reasoning arrives out-of-band as `reasoning_content`, never as inline <thinking> tags.
59
- usesInlineThinkingTags() {
60
- return false;
61
- }
62
- exposeReasoningDelta(extensions) {
63
- return (extensions?.exposeReasoning ?? false);
64
- }
65
- prepareExtensions(extensions) {
66
- const thinking = extensions?.thinking === false ? "disabled" : "enabled";
67
- const thinkingEnabled = thinking !== "disabled";
68
- const reasoningEffort = extensions?.reasoningEffort === "max" ? "max" : "high";
69
- return {
70
- ...omitExtensionKeys(extensions, ["thinking", "reasoningEffort", "exposeReasoning", "extra_body", "reasoning_effort"]),
71
- __deepstrikeThinkingEnabled: thinkingEnabled,
72
- // Re-thread the degrade control flag (omitExtensionKeys strips internal keys) so
73
- // buildChatMessages can honor it; the base requestExtensions omit keeps it off nothing.
74
- ...(extensions?.degradeMissingReasoningReplay === true ? { degradeMissingReasoningReplay: true } : {}),
75
- reasoning_effort: reasoningEffort,
76
- extra_body: { thinking: { type: thinking } },
77
- };
78
- }
79
- rememberCompleteReplay(content, toolCalls, r) {
80
- this.rememberDeepSeekReplay(content, toolCalls, r.reasoningContent, r.nativeToolCalls);
81
- }
82
- rememberStreamReplay(content, toolCalls, r) {
83
- this.rememberDeepSeekReplay(content, toolCalls, r.reasoningContent, r.nativeToolCalls);
84
- }
85
- rememberDeepSeekReplay(content, toolCalls, reasoningContent, nativeToolCalls) {
86
- if (typeof reasoningContent !== "string" || !reasoningContent.trim())
87
- return;
88
- this.chat.rememberReplayFields({ content, toolCalls }, {
89
- schema_version: 2,
90
- provider: "deepseek",
91
- protocol: "openai-chat",
92
- model: this.model,
93
- reasoning_content: reasoningContent,
94
- ...(nativeToolCalls.length ? { tool_calls: nativeToolCalls } : {}),
95
- });
96
- }
97
- }
@@ -1,25 +0,0 @@
1
- import type { ProviderDescriptor, RuntimePolicy } from "../types.js";
2
- import { OpenAIChatProvider } from "./openai.js";
3
- import { AnthropicCompatibleProvider } from "./anthropic-compatible.js";
4
- /**
5
- * GLM over its Anthropic-compatible endpoint.
6
- * @deprecated Prefer `glm({ protocol: "anthropic" })`. Behavior is now fully
7
- * data-driven via `anthropicVendorProfiles.glm`; this thin shim is kept for
8
- * backward compatibility and `instanceof` checks.
9
- */
10
- export declare class GLMAnthropicProvider extends AnthropicCompatibleProvider {
11
- constructor(apiKey: string, model?: string, retry?: {
12
- maxRetries: number;
13
- baseDelay: number;
14
- }, baseURL?: string);
15
- }
16
- export declare class GLMProvider extends OpenAIChatProvider {
17
- constructor(apiKey: string, model?: string, retry?: {
18
- maxRetries: number;
19
- baseDelay: number;
20
- }, baseURL?: string);
21
- runtimePolicy(): RuntimePolicy;
22
- descriptor(): ProviderDescriptor;
23
- protected serverTools(extensions?: Record<string, unknown>): unknown[];
24
- protected prepareExtensions(extensions?: Record<string, unknown>): Record<string, unknown> | undefined;
25
- }
@@ -1,48 +0,0 @@
1
- import { OpenAIChatProvider } from "./openai.js";
2
- import { AnthropicCompatibleProvider } from "./anthropic-compatible.js";
3
- import { endpointProfiles } from "./profiles.js";
4
- import { GLM_POLICIES, anthropicVendorProfiles } from "./vendor-profiles.js";
5
- /**
6
- * GLM over its Anthropic-compatible endpoint.
7
- * @deprecated Prefer `glm({ protocol: "anthropic" })`. Behavior is now fully
8
- * data-driven via `anthropicVendorProfiles.glm`; this thin shim is kept for
9
- * backward compatibility and `instanceof` checks.
10
- */
11
- export class GLMAnthropicProvider extends AnthropicCompatibleProvider {
12
- constructor(apiKey, model, retry, baseURL) {
13
- super(anthropicVendorProfiles.glm, apiKey, model, retry, baseURL);
14
- }
15
- }
16
- export class GLMProvider extends OpenAIChatProvider {
17
- constructor(apiKey, model = "glm-5.2", retry, baseURL = endpointProfiles["glm.openai"].baseURL) {
18
- super(apiKey, model, retry, baseURL);
19
- }
20
- runtimePolicy() {
21
- return GLM_POLICIES[this.model] ?? {};
22
- }
23
- descriptor() {
24
- return {
25
- ...super.descriptor(),
26
- provider: "glm",
27
- model: this.model,
28
- };
29
- }
30
- // ── GLM web_search (Zhipu vendor server tool; OpenAI-wire only) ──────────────
31
- // Enable with `extensions={ web_search: true }` (default config) or `{ web_search: {...} }`
32
- // (passthrough: search_engine, search_recency_filter, search_domain_filter, count, …). Injected as a
33
- // `{ type: "web_search", web_search: {...} }` entry in tools[]; the model searches server-side and
34
- // the results come back inline (no client tool-loop). Mirrors the Python GLM provider.
35
- serverTools(extensions) {
36
- const ws = extensions?.web_search;
37
- if (!ws)
38
- return [];
39
- return [{ type: "web_search", web_search: typeof ws === "object" ? ws : {} }];
40
- }
41
- // Strip `web_search` from the passthrough so it shapes tools[] only, never leaks as a body field.
42
- prepareExtensions(extensions) {
43
- if (!extensions || !("web_search" in extensions))
44
- return extensions;
45
- const { web_search: _omit, ...rest } = extensions;
46
- return rest;
47
- }
48
- }
@@ -1,23 +0,0 @@
1
- import type { ProviderDescriptor, RuntimePolicy } from "../types.js";
2
- import { OpenAIChatProvider } from "./openai.js";
3
- import { AnthropicCompatibleProvider } from "./anthropic-compatible.js";
4
- /**
5
- * Kimi over its Anthropic-compatible endpoint.
6
- * @deprecated Prefer `kimi({ protocol: "anthropic" })`. Behavior is now fully
7
- * data-driven via `anthropicVendorProfiles.kimi`; this thin shim is kept for
8
- * backward compatibility and `instanceof` checks.
9
- */
10
- export declare class KimiAnthropicProvider extends AnthropicCompatibleProvider {
11
- constructor(apiKey: string, model?: string, retry?: {
12
- maxRetries: number;
13
- baseDelay: number;
14
- }, baseURL?: string);
15
- }
16
- export declare class KimiProvider extends OpenAIChatProvider {
17
- constructor(apiKey: string, model?: string, retry?: {
18
- maxRetries: number;
19
- baseDelay: number;
20
- }, baseURL?: string);
21
- runtimePolicy(): RuntimePolicy;
22
- descriptor(): ProviderDescriptor;
23
- }
@@ -1,30 +0,0 @@
1
- import { OpenAIChatProvider } from "./openai.js";
2
- import { AnthropicCompatibleProvider } from "./anthropic-compatible.js";
3
- import { endpointProfiles } from "./profiles.js";
4
- import { KIMI_POLICIES, anthropicVendorProfiles } from "./vendor-profiles.js";
5
- /**
6
- * Kimi over its Anthropic-compatible endpoint.
7
- * @deprecated Prefer `kimi({ protocol: "anthropic" })`. Behavior is now fully
8
- * data-driven via `anthropicVendorProfiles.kimi`; this thin shim is kept for
9
- * backward compatibility and `instanceof` checks.
10
- */
11
- export class KimiAnthropicProvider extends AnthropicCompatibleProvider {
12
- constructor(apiKey, model, retry, baseURL) {
13
- super(anthropicVendorProfiles.kimi, apiKey, model, retry, baseURL);
14
- }
15
- }
16
- export class KimiProvider extends OpenAIChatProvider {
17
- constructor(apiKey, model = "kimi-k2.6", retry, baseURL = endpointProfiles["kimi.openai"].baseURL) {
18
- super(apiKey, model, retry, baseURL);
19
- }
20
- runtimePolicy() {
21
- return KIMI_POLICIES[this.model] ?? {};
22
- }
23
- descriptor() {
24
- return {
25
- ...super.descriptor(),
26
- provider: "kimi",
27
- model: this.model,
28
- };
29
- }
30
- }
@@ -1,49 +0,0 @@
1
- import type { ProviderDescriptor, RuntimePolicy } from "../types.js";
2
- import { OpenAIChatProvider, type OpenAIChatTurnReasoning } from "./openai.js";
3
- import { AnthropicCompatibleProvider } from "./anthropic-compatible.js";
4
- /**
5
- * MiniMax over its Anthropic-compatible endpoint. Replay is carried as Anthropic
6
- * `native_blocks` (thinking/text/tool_use), identical to the first-party
7
- * Anthropic provider.
8
- * @deprecated Prefer `minimax({ protocol: "anthropic" })`. Behavior is now fully
9
- * data-driven via `anthropicVendorProfiles.minimax`; this thin shim is kept for
10
- * backward compatibility and `instanceof` checks.
11
- */
12
- export declare class MiniMaxAnthropicProvider extends AnthropicCompatibleProvider {
13
- constructor(apiKey: string, model?: string, retry?: {
14
- maxRetries: number;
15
- baseDelay: number;
16
- }, baseURL?: string);
17
- }
18
- /**
19
- * MiniMax over its OpenAI-compatible endpoint. Replay is carried as
20
- * `reasoning_content` / `reasoning_details` (split reasoning) in a schema_version-2
21
- * envelope; requests default to `reasoning_split: true` so reasoning is returned
22
- * out-of-band rather than embedded in the message content. Request shaping and replay
23
- * are supplied via the OpenAIChatProvider Template-Method hooks; the streaming /
24
- * tool-call machinery is inherited from the base class.
25
- */
26
- export declare class MiniMaxOpenAIProvider extends OpenAIChatProvider {
27
- constructor(apiKey: string, model?: string, retry?: {
28
- maxRetries: number;
29
- baseDelay: number;
30
- }, baseURL?: string);
31
- runtimePolicy(): RuntimePolicy;
32
- descriptor(): ProviderDescriptor;
33
- protected requireNonEmptyReasoningReplayForToolTurns(extensions?: Record<string, unknown>): boolean;
34
- protected cacheKeyParams(): Record<string, unknown>;
35
- protected usesInlineThinkingTags(): boolean;
36
- protected exposeReasoningDelta(extensions?: Record<string, unknown>): boolean;
37
- protected prepareExtensions(extensions?: Record<string, unknown>): Record<string, unknown>;
38
- protected rememberCompleteReplay(content: string, toolCalls: Array<{
39
- id: string;
40
- name: string;
41
- arguments: string;
42
- }>, r: OpenAIChatTurnReasoning): void;
43
- protected rememberStreamReplay(content: string, toolCalls: Array<{
44
- id: string;
45
- name: string;
46
- arguments: string;
47
- }>, r: OpenAIChatTurnReasoning): void;
48
- private rememberMiniMaxReplay;
49
- }
@@ -1,98 +0,0 @@
1
- import { OpenAIChatProvider } from "./openai.js";
2
- import { AnthropicCompatibleProvider } from "./anthropic-compatible.js";
3
- import { endpointProfiles } from "./profiles.js";
4
- import { omitExtensionKeys } from "./base.js";
5
- import { MINIMAX_POLICIES, anthropicVendorProfiles } from "./vendor-profiles.js";
6
- /**
7
- * MiniMax over its Anthropic-compatible endpoint. Replay is carried as Anthropic
8
- * `native_blocks` (thinking/text/tool_use), identical to the first-party
9
- * Anthropic provider.
10
- * @deprecated Prefer `minimax({ protocol: "anthropic" })`. Behavior is now fully
11
- * data-driven via `anthropicVendorProfiles.minimax`; this thin shim is kept for
12
- * backward compatibility and `instanceof` checks.
13
- */
14
- export class MiniMaxAnthropicProvider extends AnthropicCompatibleProvider {
15
- constructor(apiKey, model, retry, baseURL) {
16
- super(anthropicVendorProfiles.minimax, apiKey, model, retry, baseURL);
17
- }
18
- }
19
- /**
20
- * MiniMax over its OpenAI-compatible endpoint. Replay is carried as
21
- * `reasoning_content` / `reasoning_details` (split reasoning) in a schema_version-2
22
- * envelope; requests default to `reasoning_split: true` so reasoning is returned
23
- * out-of-band rather than embedded in the message content. Request shaping and replay
24
- * are supplied via the OpenAIChatProvider Template-Method hooks; the streaming /
25
- * tool-call machinery is inherited from the base class.
26
- */
27
- export class MiniMaxOpenAIProvider extends OpenAIChatProvider {
28
- constructor(apiKey, model = "MiniMax-M3", retry, baseURL = endpointProfiles["minimax.openai"].baseURL) {
29
- super(apiKey, model, retry, baseURL);
30
- }
31
- runtimePolicy() {
32
- return MINIMAX_POLICIES[this.model] ?? {};
33
- }
34
- descriptor() {
35
- return {
36
- provider: "minimax",
37
- protocol: "openai-chat",
38
- model: this.model,
39
- reasoning: {
40
- supported: true,
41
- preserveAcrossToolTurns: true,
42
- requiresReplayForToolTurns: true,
43
- },
44
- toolCalls: {
45
- supported: true,
46
- requiresStrictPairing: true,
47
- },
48
- };
49
- }
50
- requireNonEmptyReasoningReplayForToolTurns(extensions) {
51
- if (extensions?.__deepstrikeThinkingEnabled === false)
52
- return false;
53
- return extensions?.reasoning_split !== false;
54
- }
55
- // MiniMax auto prefix-caches and does not accept OpenAI's `prompt_cache_key`; omit it.
56
- cacheKeyParams() {
57
- return {};
58
- }
59
- // Reasoning arrives out-of-band (reasoning_content / reasoning_details), never inline tags.
60
- usesInlineThinkingTags() {
61
- return false;
62
- }
63
- exposeReasoningDelta(extensions) {
64
- return (extensions?.exposeReasoning ?? false);
65
- }
66
- prepareExtensions(extensions) {
67
- const reasoningSplit = extensions?.reasoning_split !== false;
68
- return {
69
- ...omitExtensionKeys(extensions, ["reasoning_split", "exposeReasoning"]),
70
- __deepstrikeThinkingEnabled: reasoningSplit,
71
- // Re-thread the degrade control flag (omitExtensionKeys strips internal keys) so
72
- // buildChatMessages can honor it; the wire-request omit drops it.
73
- ...(extensions?.degradeMissingReasoningReplay === true ? { degradeMissingReasoningReplay: true } : {}),
74
- reasoning_split: reasoningSplit,
75
- };
76
- }
77
- rememberCompleteReplay(content, toolCalls, r) {
78
- this.rememberMiniMaxReplay(content, toolCalls, r.reasoningContent, r.reasoningDetails, r.nativeToolCalls);
79
- }
80
- rememberStreamReplay(content, toolCalls, r) {
81
- this.rememberMiniMaxReplay(content, toolCalls, r.reasoningContent, r.reasoningDetails, r.nativeToolCalls);
82
- }
83
- rememberMiniMaxReplay(content, toolCalls, reasoningContent, reasoningDetails, nativeToolCalls) {
84
- const hasReasoning = typeof reasoningContent === "string" && reasoningContent.trim().length > 0;
85
- const hasDetails = reasoningDetails !== undefined && reasoningDetails !== null;
86
- if (!hasReasoning && !hasDetails)
87
- return;
88
- this.chat.rememberReplayFields({ content, toolCalls }, {
89
- schema_version: 2,
90
- provider: "minimax",
91
- protocol: "openai-chat",
92
- model: this.model,
93
- ...(hasReasoning ? { reasoning_content: reasoningContent } : {}),
94
- ...(hasDetails ? { reasoning_details: reasoningDetails } : {}),
95
- ...(nativeToolCalls.length ? { tool_calls: nativeToolCalls } : {}),
96
- });
97
- }
98
- }