@deepstrike/sdk 0.2.52 → 0.2.61
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/README.md +28 -28
- package/dist/agent-ir.d.ts +103 -0
- package/dist/agent-ir.js +134 -0
- package/dist/agent.d.ts +67 -0
- package/dist/agent.js +36 -0
- package/dist/collaboration/harness.js +1 -1
- package/dist/collaboration/modes/creator-verifier.d.ts +2 -7
- package/dist/collaboration/modes/creator-verifier.js +4 -6
- package/dist/collaboration/pool.d.ts +8 -20
- package/dist/collaboration/pool.js +27 -97
- package/dist/compat/anthropic/mcp.d.ts +15 -0
- package/dist/compat/anthropic/mcp.js +10 -0
- package/dist/compat/openai/agent.d.ts +34 -0
- package/dist/compat/openai/agent.js +24 -0
- package/dist/governance.d.ts +1 -17
- package/dist/governance.js +1 -34
- package/dist/guardrail.d.ts +6 -0
- package/dist/guardrail.js +1 -0
- package/dist/handoff-target.d.ts +12 -0
- package/dist/handoff-target.js +1 -0
- package/dist/harness/manifest.js +0 -4
- package/dist/index.d.ts +19 -7
- package/dist/index.js +8 -5
- package/dist/kernel.d.ts +2 -20
- package/dist/knowledge/public.d.ts +29 -0
- package/dist/knowledge/public.js +1 -0
- package/dist/mcp-server.d.ts +28 -0
- package/dist/mcp-server.js +1 -0
- package/dist/memory/agent.d.ts +2 -2
- package/dist/memory/agent.js +2 -2
- package/dist/memory/durable.d.ts +16 -0
- package/dist/memory/durable.js +46 -0
- package/dist/memory/in-memory-store.d.ts +9 -7
- package/dist/memory/in-memory-store.js +8 -2
- package/dist/memory/protocols.d.ts +22 -4
- package/dist/memory/public.d.ts +4 -3
- package/dist/memory/public.js +3 -2
- package/dist/os/public.d.ts +1 -1
- package/dist/os/public.js +1 -1
- package/dist/providers/anthropic-adapter.d.ts +59 -0
- package/dist/providers/anthropic-adapter.js +530 -0
- package/dist/providers/anthropic-compatible.d.ts +2 -3
- package/dist/providers/anthropic-compatible.js +8 -5
- package/dist/providers/anthropic.d.ts +20 -23
- package/dist/providers/anthropic.js +176 -395
- package/dist/providers/base.d.ts +2 -2
- package/dist/providers/base.js +50 -8
- package/dist/providers/capability-router.d.ts +29 -0
- package/dist/providers/capability-router.js +43 -0
- package/dist/providers/catalog.d.ts +16 -4
- package/dist/providers/catalog.js +112 -36
- package/dist/providers/content-normalization.d.ts +57 -0
- package/dist/providers/content-normalization.js +238 -0
- package/dist/providers/content-policy.d.ts +16 -0
- package/dist/providers/content-policy.js +39 -0
- package/dist/providers/credentials.d.ts +83 -0
- package/dist/providers/credentials.js +190 -0
- package/dist/providers/endpoints.d.ts +137 -0
- package/dist/providers/endpoints.js +128 -0
- package/dist/providers/factories.js +25 -9
- package/dist/providers/gemini-adapter.d.ts +33 -0
- package/dist/providers/gemini-adapter.js +264 -0
- package/dist/providers/gemini.d.ts +16 -3
- package/dist/providers/gemini.js +97 -195
- package/dist/providers/model-catalog.d.ts +37 -0
- package/dist/providers/model-catalog.js +62 -0
- package/dist/providers/model-registry.d.ts +119 -0
- package/dist/providers/model-registry.js +379 -0
- package/dist/providers/ollama-adapter.d.ts +65 -0
- package/dist/providers/ollama-adapter.js +188 -0
- package/dist/providers/ollama.d.ts +9 -4
- package/dist/providers/ollama.js +96 -109
- package/dist/providers/openai-chat-dialects.d.ts +154 -0
- package/dist/providers/openai-chat-dialects.js +179 -0
- package/dist/providers/openai-chat.d.ts +46 -18
- package/dist/providers/openai-chat.js +416 -51
- package/dist/providers/openai-responses-adapter.d.ts +42 -0
- package/dist/providers/openai-responses-adapter.js +343 -0
- package/dist/providers/openai-responses.d.ts +19 -33
- package/dist/providers/openai-responses.js +164 -264
- package/dist/providers/openai.d.ts +29 -76
- package/dist/providers/openai.js +195 -292
- package/dist/providers/protocol-adapter.d.ts +39 -0
- package/dist/providers/protocol-adapter.js +13 -0
- package/dist/providers/protocol-capabilities.d.ts +34 -0
- package/dist/providers/protocol-capabilities.js +44 -0
- package/dist/providers/provider-error.d.ts +31 -0
- package/dist/providers/provider-error.js +153 -0
- package/dist/providers/public.d.ts +26 -3
- package/dist/providers/public.js +13 -1
- package/dist/providers/registry.d.ts +7 -6
- package/dist/providers/registry.js +47 -20
- package/dist/providers/request-plan.d.ts +89 -0
- package/dist/providers/request-plan.js +199 -0
- package/dist/providers/usage-normalizer.d.ts +48 -0
- package/dist/providers/usage-normalizer.js +139 -0
- package/dist/providers/vendor-profiles.d.ts +2 -15
- package/dist/providers/vendor-profiles.js +14 -60
- package/dist/runtime/canonical-kernel-step.d.ts +1 -2
- package/dist/runtime/canonical-kernel-step.js +47 -12
- package/dist/runtime/context-policy.d.ts +10 -12
- package/dist/runtime/context-policy.js +6 -8
- package/dist/runtime/durable-content.d.ts +50 -0
- package/dist/runtime/durable-content.js +159 -0
- package/dist/runtime/execution-plane.d.ts +2 -2
- package/dist/runtime/execution-plane.js +2 -2
- package/dist/runtime/kernel-event-log.js +0 -1
- package/dist/runtime/kernel-step.d.ts +0 -1
- package/dist/runtime/kernel-step.js +4 -2
- package/dist/runtime/mcp-proxy-plane.d.ts +25 -1
- package/dist/runtime/mcp-proxy-plane.js +44 -6
- package/dist/runtime/output-schema.d.ts +1 -2
- package/dist/runtime/provider-replay.d.ts +5 -1
- package/dist/runtime/provider-replay.js +26 -27
- package/dist/runtime/reactive-session.d.ts +1 -1
- package/dist/runtime/reactive-session.js +2 -3
- package/dist/runtime/run-group.d.ts +1 -1
- package/dist/runtime/runner.d.ts +31 -45
- package/dist/runtime/runner.js +178 -63
- package/dist/runtime/session-log.d.ts +8 -1
- package/dist/runtime/session-log.js +42 -2
- package/dist/runtime/session-repair.d.ts +1 -1
- package/dist/runtime/session-repair.js +1 -1
- package/dist/runtime/sub-agent-orchestrator.d.ts +1 -1
- package/dist/runtime/sub-agent-orchestrator.js +8 -11
- package/dist/runtime/workflow-control-flow.d.ts +0 -4
- package/dist/runtime/workflow-control-flow.js +0 -16
- package/dist/session.d.ts +11 -0
- package/dist/session.js +1 -0
- package/dist/skill.d.ts +17 -0
- package/dist/skill.js +16 -0
- package/dist/skills/loader.d.ts +3 -0
- package/dist/tools/errors.d.ts +1 -3
- package/dist/tools/errors.js +1 -3
- package/dist/tools/index.d.ts +3 -0
- package/dist/types/agent.d.ts +21 -9
- package/dist/types/agent.js +30 -4
- package/dist/types.d.ts +135 -17
- package/package.json +4 -4
- package/dist/providers/deepseek.d.ts +0 -46
- package/dist/providers/deepseek.js +0 -97
- package/dist/providers/glm.d.ts +0 -25
- package/dist/providers/glm.js +0 -48
- package/dist/providers/kimi.d.ts +0 -23
- package/dist/providers/kimi.js +0 -30
- package/dist/providers/minimax.d.ts +0 -49
- package/dist/providers/minimax.js +0 -98
- package/dist/providers/profiles.d.ts +0 -1992
- package/dist/providers/profiles.js +0 -796
- package/dist/providers/qwen.d.ts +0 -38
- package/dist/providers/qwen.js +0 -97
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepstrike/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.61",
|
|
4
4
|
"description": "DeepStrike Node.js SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"README.md"
|
|
63
63
|
],
|
|
64
64
|
"scripts": {
|
|
65
|
-
"build": "tsc",
|
|
65
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc",
|
|
66
66
|
"test": "node --experimental-vm-modules node_modules/.bin/jest",
|
|
67
67
|
"test:e2e": "node --experimental-vm-modules node_modules/.bin/jest --testPathPattern e2e/run --testTimeout 300000",
|
|
68
68
|
"test:e2e:k": "node --experimental-vm-modules node_modules/.bin/jest --testPathPattern e2e/run --testTimeout 300000",
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@anthropic-ai/sdk": "^0.99.0",
|
|
75
|
-
"@deepstrike/core": "0.2.
|
|
75
|
+
"@deepstrike/core": "0.2.61",
|
|
76
76
|
"@google/generative-ai": "^0.24.1",
|
|
77
|
-
"openai": "^5.
|
|
77
|
+
"openai": "^7.5.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@types/jest": "^30.0.0",
|
|
@@ -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
|
-
}
|
package/dist/providers/glm.d.ts
DELETED
|
@@ -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
|
-
}
|
package/dist/providers/glm.js
DELETED
|
@@ -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
|
-
}
|
package/dist/providers/kimi.d.ts
DELETED
|
@@ -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
|
-
}
|
package/dist/providers/kimi.js
DELETED
|
@@ -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
|
-
}
|