qlogicagent 2.7.0 → 2.9.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.
- package/dist/agent.js +18 -18
- package/dist/cli.js +353 -413
- package/dist/index.js +373 -433
- package/dist/orchestration.js +6 -6
- package/dist/protocol.js +1 -1
- package/dist/types/agent/agent.d.ts +1 -1
- package/dist/types/agent/tool-loop.d.ts +1 -1
- package/dist/types/agent/tunable-defaults.d.ts +4 -0
- package/dist/types/agent/types.d.ts +7 -18
- package/dist/types/cli/handlers/agents-handler.d.ts +19 -0
- package/dist/types/cli/handlers/config-handler.d.ts +17 -0
- package/dist/types/cli/handlers/dream-handler.d.ts +5 -0
- package/dist/types/cli/handlers/files-handler.d.ts +15 -0
- package/dist/types/cli/handlers/media-handler.d.ts +13 -0
- package/dist/types/cli/handlers/memory-handler.d.ts +11 -0
- package/dist/types/cli/handlers/pet-handler.d.ts +21 -0
- package/dist/types/cli/handlers/product-handler.d.ts +32 -0
- package/dist/types/cli/handlers/project-handler.d.ts +19 -0
- package/dist/types/cli/handlers/session-handler.d.ts +38 -0
- package/dist/types/cli/handlers/settings-handler.d.ts +24 -0
- package/dist/types/cli/handlers/skills-handler.d.ts +20 -0
- package/dist/types/cli/handlers/solo-handler.d.ts +15 -0
- package/dist/types/cli/handlers/turn-handler.d.ts +17 -0
- package/dist/types/cli/main.d.ts +2 -2
- package/dist/types/cli/stdio-server.d.ts +64 -106
- package/dist/types/cli/tool-bootstrap.d.ts +4 -3
- package/dist/types/config/config.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/llm/index.d.ts +1 -31
- package/dist/types/orchestration/tool-cascade.d.ts +2 -2
- package/dist/types/protocol/methods.d.ts +153 -5
- package/dist/types/protocol/wire/agent-events.d.ts +2 -2
- package/dist/types/protocol/wire/agent-methods.d.ts +5 -3
- package/dist/types/protocol/wire/gateway-rpc.d.ts +77 -4
- package/dist/types/protocol/wire/index.d.ts +1 -1
- package/dist/types/protocol/wire/notification-payloads.d.ts +72 -1
- package/dist/types/runtime/execution/dream-agent.d.ts +1 -1
- package/dist/types/runtime/execution/forked-agent.d.ts +1 -1
- package/dist/types/runtime/hooks/context-compression.d.ts +1 -1
- package/dist/types/runtime/hooks/memory-hooks.d.ts +1 -1
- package/dist/types/runtime/infra/acp-types.d.ts +4 -0
- package/dist/types/runtime/infra/agent-paths.d.ts +22 -25
- package/dist/types/runtime/infra/agent-process.d.ts +1 -1
- package/dist/types/runtime/infra/builtin-providers.d.ts +36 -0
- package/dist/types/runtime/infra/checkpoint-backend.d.ts +1 -1
- package/dist/types/runtime/infra/index.d.ts +1 -2
- package/dist/types/runtime/infra/key-pool.d.ts +120 -0
- package/dist/types/runtime/infra/media-persistence.d.ts +26 -15
- package/dist/types/runtime/infra/model-registry.d.ts +187 -0
- package/dist/types/runtime/infra/project-instructions-store.d.ts +3 -3
- package/dist/types/runtime/infra/project-store.d.ts +3 -0
- package/dist/types/runtime/infra/token-budget.d.ts +2 -2
- package/dist/types/runtime/infra/worktree-backend.d.ts +1 -1
- package/dist/types/runtime/pet/index.d.ts +8 -0
- package/dist/types/runtime/pet/pet-context-injection.d.ts +8 -0
- package/dist/types/runtime/pet/pet-file-loader.d.ts +62 -0
- package/dist/types/runtime/pet/pet-growth-engine.d.ts +60 -0
- package/dist/types/runtime/pet/pet-reaction-service.d.ts +33 -0
- package/dist/types/runtime/pet/pet-soul-service.d.ts +71 -0
- package/dist/types/runtime/session/group-session-split.d.ts +38 -0
- package/dist/types/runtime/session/index.d.ts +4 -2
- package/dist/types/runtime/session/session-locator.d.ts +24 -0
- package/dist/types/runtime/session/session-memory.d.ts +4 -4
- package/dist/types/runtime/session/session-persistence.d.ts +47 -46
- package/dist/types/runtime/session/session-state.d.ts +3 -5
- package/dist/types/skills/memory/local-memory-provider.d.ts +1 -1
- package/dist/types/skills/memory/local-store.d.ts +3 -2
- package/dist/types/skills/memory/memdir.d.ts +7 -4
- package/dist/types/skills/memory/memory-provider-factory.d.ts +2 -8
- package/dist/types/skills/permissions/denial-audit-log.d.ts +1 -1
- package/dist/types/skills/permissions/permission-classifier.d.ts +1 -1
- package/dist/types/skills/tools/search-tool.d.ts +1 -1
- package/dist/types/skills/tools.d.ts +3 -3
- package/dist/types/transport/acp-event-emitter.d.ts +1 -1
- package/dist/types/transport/acp-server.d.ts +2 -2
- package/package.json +2 -1
- package/dist/types/llm/adapters/aliyun-oss-file-upload-adapter.d.ts +0 -44
- package/dist/types/llm/adapters/gemini-file-upload-adapter.d.ts +0 -26
- package/dist/types/llm/adapters/hub-oss-file-upload-adapter.d.ts +0 -29
- package/dist/types/llm/adapters/index.d.ts +0 -10
- package/dist/types/llm/adapters/openai-file-upload-adapter.d.ts +0 -38
- package/dist/types/llm/adapters/volcengine-file-upload-adapter.d.ts +0 -24
- package/dist/types/llm/builtin-providers.d.ts +0 -10
- package/dist/types/llm/debug-transport.d.ts +0 -12
- package/dist/types/llm/file-upload-service.d.ts +0 -68
- package/dist/types/llm/gemini-schema-utils.d.ts +0 -17
- package/dist/types/llm/llm-client.d.ts +0 -43
- package/dist/types/llm/media-client.d.ts +0 -42
- package/dist/types/llm/media-transport.d.ts +0 -176
- package/dist/types/llm/model-catalog.d.ts +0 -82
- package/dist/types/llm/model-detection.d.ts +0 -22
- package/dist/types/llm/provider-def.d.ts +0 -203
- package/dist/types/llm/provider-registry.d.ts +0 -59
- package/dist/types/llm/provider-tool-api.d.ts +0 -44
- package/dist/types/llm/retry.d.ts +0 -37
- package/dist/types/llm/transport.d.ts +0 -281
- package/dist/types/llm/transports/anthropic-messages.d.ts +0 -65
- package/dist/types/llm/transports/gemini-cache-api.d.ts +0 -86
- package/dist/types/llm/transports/gemini-file-api.d.ts +0 -90
- package/dist/types/llm/transports/gemini-generatecontent.d.ts +0 -56
- package/dist/types/llm/transports/gemini-lyria-realtime.d.ts +0 -117
- package/dist/types/llm/transports/gemini-media.d.ts +0 -53
- package/dist/types/llm/transports/media-resolve.d.ts +0 -50
- package/dist/types/llm/transports/minimax-media.d.ts +0 -55
- package/dist/types/llm/transports/openai-chat.d.ts +0 -81
- package/dist/types/llm/transports/openai-media.d.ts +0 -24
- package/dist/types/llm/transports/openai-responses.d.ts +0 -63
- package/dist/types/llm/transports/qwen-media.d.ts +0 -50
- package/dist/types/llm/transports/realtime-transport.d.ts +0 -183
- package/dist/types/llm/transports/volcengine-grounding.d.ts +0 -58
- package/dist/types/llm/transports/volcengine-media.d.ts +0 -93
- package/dist/types/llm/transports/volcengine-responses.d.ts +0 -64
- package/dist/types/llm/transports/zhipu-media.d.ts +0 -82
- package/dist/types/llm/transports/zhipu-tool-api.d.ts +0 -35
- package/dist/types/runtime/infra/project-plan-store.d.ts +0 -27
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tool
|
|
2
|
+
* Tool RegistryCC-aligned getAllBaseTools() pattern.
|
|
3
3
|
*
|
|
4
4
|
* CC reference: claude-code-haha/src/tools.ts
|
|
5
5
|
*
|
|
@@ -52,7 +52,7 @@ export declare function getToolCount(): number;
|
|
|
52
52
|
*/
|
|
53
53
|
export declare function executeTool(name: string, toolCallId: string, args: Record<string, unknown>, signal?: AbortSignal): Promise<import("./portable-tool.js").PortableToolResult>;
|
|
54
54
|
/**
|
|
55
|
-
* CC: getTools()
|
|
55
|
+
* CC: getTools()return all enabled tools.
|
|
56
56
|
* Filters the pool by isEnabled() gate; disabled tools are invisible to callers.
|
|
57
57
|
* CC reference: claude-code-haha/src/tools.ts getTools()
|
|
58
58
|
*/
|
|
@@ -73,7 +73,7 @@ export declare function isToolActivated(name: string): boolean;
|
|
|
73
73
|
export declare function clearActivatedTools(): void;
|
|
74
74
|
/**
|
|
75
75
|
* Generate ToolDefinition[] manifest for LLM tool_use.
|
|
76
|
-
* Filters by isEnabled()
|
|
76
|
+
* Filters by isEnabled()disabled tools never reach the model.
|
|
77
77
|
* Deferred tools are excluded UNLESS they have been activated via tool_search.
|
|
78
78
|
* CC: getTools() + manifest generation combined.
|
|
79
79
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ACP Event
|
|
2
|
+
* ACP Event Emittertranslates internal qlogicagent notifications to ACP
|
|
3
3
|
* session/update notifications.
|
|
4
4
|
*
|
|
5
5
|
* Maps the 47+ internal notification methods (turn.delta, turn.tool_call, etc.)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ACP
|
|
2
|
+
* ACP ServerAgent-Client Protocol server layer for qlogicagent.
|
|
3
3
|
*
|
|
4
4
|
* This module implements qlogicagent as an ACP Server, allowing any ACP-compliant
|
|
5
5
|
* host (AionUI, Cursor, openclaw, etc.) to connect and interact with the agent.
|
|
@@ -78,7 +78,7 @@ export interface AcpServerConfig {
|
|
|
78
78
|
verbose?: boolean;
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* AcpServermanages the ACP protocol state machine.
|
|
82
82
|
*
|
|
83
83
|
* Lifecycle:
|
|
84
84
|
* 1. Host connects (stdio)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qlogicagent",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "XiaozhiClaw Agent CLI — subprocess architecture (JSON-RPC over stdio)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"node": ">=22.0.0"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
+
"@qlogic/provider-core": "workspace:*",
|
|
65
66
|
"better-sqlite3": "^12.10.0",
|
|
66
67
|
"dotenv": "^17.3.1",
|
|
67
68
|
"nanoid": "^5.1.5",
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Aliyun OSS File Upload Adapter — direct upload to Alibaba Cloud OSS.
|
|
3
|
-
*
|
|
4
|
-
* Uploads files directly to OSS bucket using V1 signature (HMAC-SHA1).
|
|
5
|
-
* No external dependencies — uses Node.js crypto + fetch.
|
|
6
|
-
*
|
|
7
|
-
* This is the **universal fallback adapter** for providers without a native
|
|
8
|
-
* File Upload API (e.g. Anthropic). Ensures ALL file handling goes through
|
|
9
|
-
* upload — never base64 inline.
|
|
10
|
-
*
|
|
11
|
-
* Environment variables:
|
|
12
|
-
* OSS_ACCESS_KEY_ID — Aliyun AccessKey ID
|
|
13
|
-
* OSS_ACCESS_KEY_SECRET — Aliyun AccessKey Secret
|
|
14
|
-
* OSS_BUCKET — Bucket name (default: "qlogicagent")
|
|
15
|
-
* OSS_REGION — Region (default: "cn-beijing")
|
|
16
|
-
* OSS_ENDPOINT — Custom endpoint (default: derived from region)
|
|
17
|
-
*/
|
|
18
|
-
import type { FileUploadAdapter, FileUploadResult } from "../file-upload-service.js";
|
|
19
|
-
export interface AliyunOSSFileUploadConfig {
|
|
20
|
-
/** Aliyun AccessKey ID. Required. */
|
|
21
|
-
accessKeyId: string;
|
|
22
|
-
/** Aliyun AccessKey Secret. Required. */
|
|
23
|
-
accessKeySecret: string;
|
|
24
|
-
/** OSS Bucket name. Default: "qlogicagent". */
|
|
25
|
-
bucket?: string;
|
|
26
|
-
/** OSS Region. Default: "cn-beijing". */
|
|
27
|
-
region?: string;
|
|
28
|
-
/** Custom OSS endpoint. Default: "{bucket}.oss-{region}.aliyuncs.com". */
|
|
29
|
-
endpoint?: string;
|
|
30
|
-
/** Upload path prefix. Default: "media". */
|
|
31
|
-
pathPrefix?: string;
|
|
32
|
-
/** Timeout ms. Default: 120_000. */
|
|
33
|
-
timeoutMs?: number;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Create an AliyunOSSFileUploadAdapter from environment variables.
|
|
37
|
-
* Returns undefined if required env vars (OSS_ACCESS_KEY_ID, OSS_ACCESS_KEY_SECRET) are missing.
|
|
38
|
-
*/
|
|
39
|
-
export declare function createAliyunOSSAdapterFromEnv(): AliyunOSSFileUploadAdapter | undefined;
|
|
40
|
-
export declare class AliyunOSSFileUploadAdapter implements FileUploadAdapter {
|
|
41
|
-
private readonly config;
|
|
42
|
-
constructor(config: AliyunOSSFileUploadConfig);
|
|
43
|
-
uploadFile(buffer: Buffer, filename: string, mimeType: string, _apiKey: string, signal?: AbortSignal): Promise<FileUploadResult>;
|
|
44
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gemini File Upload Adapter.
|
|
3
|
-
*
|
|
4
|
-
* Implements the Google Gemini 2-step resumable upload protocol
|
|
5
|
-
* into the unified FileUploadAdapter interface.
|
|
6
|
-
*
|
|
7
|
-
* Protocol:
|
|
8
|
-
* 1. POST /upload/v1beta/files — initiate, get upload URL
|
|
9
|
-
* 2. PUT {uploadUrl} — send bytes, finalize
|
|
10
|
-
*
|
|
11
|
-
* Returns a file URI (e.g. "files/abc123") that can be used in
|
|
12
|
-
* generateContent requests as a file reference.
|
|
13
|
-
*/
|
|
14
|
-
import type { FileUploadAdapter, FileUploadResult } from "../file-upload-service.js";
|
|
15
|
-
export interface GeminiFileUploadConfig {
|
|
16
|
-
/** Base URL (e.g. "https://generativelanguage.googleapis.com/v1beta") */
|
|
17
|
-
baseUrl: string;
|
|
18
|
-
/** Timeout ms. Default: 180_000. */
|
|
19
|
-
timeoutMs?: number;
|
|
20
|
-
}
|
|
21
|
-
export declare class GeminiFileUploadAdapter implements FileUploadAdapter {
|
|
22
|
-
private readonly config;
|
|
23
|
-
constructor(config: GeminiFileUploadConfig);
|
|
24
|
-
uploadFile(buffer: Buffer, filename: string, mimeType: string, apiKey: string, signal?: AbortSignal): Promise<FileUploadResult>;
|
|
25
|
-
private waitForProcessing;
|
|
26
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hub OSS File Upload Adapter — for providers without native File API (e.g. Anthropic).
|
|
3
|
-
*
|
|
4
|
-
* Uploads local files to the Hub's OSS relay endpoint, which stores them in
|
|
5
|
-
* cloud object storage (Aliyun OSS / Tencent COS) and returns a public URL.
|
|
6
|
-
* The LLM provider can then access the file via this public URL.
|
|
7
|
-
*
|
|
8
|
-
* This enables Anthropic (which only supports base64 inline or public URL)
|
|
9
|
-
* to handle large files that exceed the base64 size limit (20MB).
|
|
10
|
-
*
|
|
11
|
-
* Endpoint: POST {hubBaseUrl}/api/v1/files/upload
|
|
12
|
-
* Returns: { url: "https://oss-bucket.oss-cn-xxx.aliyuncs.com/..." }
|
|
13
|
-
*/
|
|
14
|
-
import type { FileUploadAdapter, FileUploadResult } from "../file-upload-service.js";
|
|
15
|
-
export interface HubOSSFileUploadConfig {
|
|
16
|
-
/** Hub API base URL (e.g. "https://hub.xiaozhiclaw.com" or from env). */
|
|
17
|
-
hubBaseUrl: string;
|
|
18
|
-
/** Hub API key for authentication. */
|
|
19
|
-
hubApiKey?: string;
|
|
20
|
-
/** Timeout ms. Default: 120_000. */
|
|
21
|
-
timeoutMs?: number;
|
|
22
|
-
/** Provider name for result metadata. Default: "hub-oss". */
|
|
23
|
-
provider?: string;
|
|
24
|
-
}
|
|
25
|
-
export declare class HubOSSFileUploadAdapter implements FileUploadAdapter {
|
|
26
|
-
private readonly config;
|
|
27
|
-
constructor(config: HubOSSFileUploadConfig);
|
|
28
|
-
uploadFile(buffer: Buffer, filename: string, mimeType: string, _apiKey: string, signal?: AbortSignal): Promise<FileUploadResult>;
|
|
29
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File Upload Adapters — barrel export.
|
|
3
|
-
*
|
|
4
|
-
* Provider-specific implementations of the FileUploadAdapter interface.
|
|
5
|
-
*/
|
|
6
|
-
export { OpenAIFileUploadAdapter, type OpenAIFileUploadConfig } from "./openai-file-upload-adapter.js";
|
|
7
|
-
export { VolcengineFileUploadAdapter, type VolcengineFileUploadConfig } from "./volcengine-file-upload-adapter.js";
|
|
8
|
-
export { GeminiFileUploadAdapter, type GeminiFileUploadConfig } from "./gemini-file-upload-adapter.js";
|
|
9
|
-
export { HubOSSFileUploadAdapter, type HubOSSFileUploadConfig } from "./hub-oss-file-upload-adapter.js";
|
|
10
|
-
export { AliyunOSSFileUploadAdapter, type AliyunOSSFileUploadConfig, createAliyunOSSAdapterFromEnv } from "./aliyun-oss-file-upload-adapter.js";
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenAI-compatible File Upload Adapter.
|
|
3
|
-
*
|
|
4
|
-
* Implements FileUploadAdapter for providers using the standard
|
|
5
|
-
* POST /v1/files multipart upload endpoint:
|
|
6
|
-
* - OpenAI
|
|
7
|
-
* - Kimi (Moonshot)
|
|
8
|
-
* - Minimax
|
|
9
|
-
* - Qwen (via DashScope compatible endpoint)
|
|
10
|
-
* - GLM (Zhipu)
|
|
11
|
-
* - Any OpenAI-API-compatible provider
|
|
12
|
-
*
|
|
13
|
-
* The uploaded file gets a file_id which can be referenced in messages.
|
|
14
|
-
* Some providers also return a direct download URL.
|
|
15
|
-
*/
|
|
16
|
-
import type { FileUploadAdapter, FileUploadResult } from "../file-upload-service.js";
|
|
17
|
-
export interface OpenAIFileUploadConfig {
|
|
18
|
-
/** Base URL (e.g. "https://api.openai.com/v1" or "https://api.moonshot.cn/v1") */
|
|
19
|
-
baseUrl: string;
|
|
20
|
-
/** Provider name for result metadata. */
|
|
21
|
-
provider: string;
|
|
22
|
-
/** Extra headers to include (e.g. for Minimax group_id). */
|
|
23
|
-
extraHeaders?: Record<string, string>;
|
|
24
|
-
/** Upload purpose (default: "file-extract" for document understanding). */
|
|
25
|
-
defaultPurpose?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Whether the provider returns a download URL in the upload response.
|
|
28
|
-
* If false, constructs URL from file_id (provider-specific).
|
|
29
|
-
*/
|
|
30
|
-
returnsUrl?: boolean;
|
|
31
|
-
/** Timeout for upload request (ms). Default: 120_000. */
|
|
32
|
-
timeoutMs?: number;
|
|
33
|
-
}
|
|
34
|
-
export declare class OpenAIFileUploadAdapter implements FileUploadAdapter {
|
|
35
|
-
private readonly config;
|
|
36
|
-
constructor(config: OpenAIFileUploadConfig);
|
|
37
|
-
uploadFile(buffer: Buffer, filename: string, mimeType: string, apiKey: string, signal?: AbortSignal): Promise<FileUploadResult>;
|
|
38
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Volcengine File Upload Adapter.
|
|
3
|
-
*
|
|
4
|
-
* Wraps the Volcengine /v3/files endpoint into the unified
|
|
5
|
-
* FileUploadAdapter interface.
|
|
6
|
-
*
|
|
7
|
-
* Volcengine returns a file_id that can be used in API messages
|
|
8
|
-
* as a file reference. Files uploaded this way can be referenced in
|
|
9
|
-
* multimodal inputs via the file_id field.
|
|
10
|
-
*/
|
|
11
|
-
import type { FileUploadAdapter, FileUploadResult } from "../file-upload-service.js";
|
|
12
|
-
export interface VolcengineFileUploadConfig {
|
|
13
|
-
/** Base URL (e.g. "https://ark.cn-beijing.volces.com/api") */
|
|
14
|
-
baseUrl: string;
|
|
15
|
-
/** Upload purpose. Default: "user_data". */
|
|
16
|
-
defaultPurpose?: string;
|
|
17
|
-
/** Timeout ms. Default: 120_000. */
|
|
18
|
-
timeoutMs?: number;
|
|
19
|
-
}
|
|
20
|
-
export declare class VolcengineFileUploadAdapter implements FileUploadAdapter {
|
|
21
|
-
private readonly config;
|
|
22
|
-
constructor(config: VolcengineFileUploadConfig);
|
|
23
|
-
uploadFile(buffer: Buffer, filename: string, mimeType: string, apiKey: string, signal?: AbortSignal): Promise<FileUploadResult>;
|
|
24
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Builtin provider definitions — hardcoded fallback list (~30 providers).
|
|
3
|
-
*
|
|
4
|
-
* This is Layer 1 (lowest priority) of the three-layer merge strategy.
|
|
5
|
-
* Used when remote model catalog is unavailable.
|
|
6
|
-
*
|
|
7
|
-
* Aligned with Hermes hermes_cli/models.py hardcoded fallback.
|
|
8
|
-
*/
|
|
9
|
-
import type { ProviderDef } from "./provider-def.js";
|
|
10
|
-
export declare const BUILTIN_PROVIDERS: ProviderDef[];
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { LLMTransport } from "./transport.js";
|
|
2
|
-
/**
|
|
3
|
-
* Check whether debug transport should be enabled.
|
|
4
|
-
*/
|
|
5
|
-
export declare function isDebugTransportEnabled(): boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Create a DebugTransport decorator that wraps a base LLMTransport,
|
|
8
|
-
* logging request metadata + timing + usage to JSONL.
|
|
9
|
-
*
|
|
10
|
-
* CC parity: createDumpPromptsFetch — but vendor-agnostic via transport abstraction.
|
|
11
|
-
*/
|
|
12
|
-
export declare function createDebugTransport(base: LLMTransport, sessionId: string): LLMTransport;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FileUploadService — Unified file upload abstraction for all LLM providers.
|
|
3
|
-
*
|
|
4
|
-
* Replaces the base64 approach in media-resolve.ts. When a local URL is
|
|
5
|
-
* encountered, this service uploads the file to the current provider's
|
|
6
|
-
* File API and returns a public URL or file_id.
|
|
7
|
-
*
|
|
8
|
-
* Supported providers:
|
|
9
|
-
* - OpenAI-compatible (OpenAI, Kimi, Minimax, Qwen, GLM) — POST /v1/files
|
|
10
|
-
* - Volcengine — POST /v3/files
|
|
11
|
-
* - Google Gemini — Resumable upload protocol
|
|
12
|
-
*
|
|
13
|
-
* Architecture:
|
|
14
|
-
* Transport layer calls resolveLocalMedia() before sending messages.
|
|
15
|
-
* resolveLocalMedia() fetches local content and uploads to provider,
|
|
16
|
-
* returning a public URL the LLM can access.
|
|
17
|
-
*/
|
|
18
|
-
export interface FileUploadResult {
|
|
19
|
-
/** Public URL accessible by the LLM provider. */
|
|
20
|
-
url: string;
|
|
21
|
-
/** Provider-specific file identifier (for reference/deletion). */
|
|
22
|
-
fileId: string;
|
|
23
|
-
/** Original filename. */
|
|
24
|
-
filename: string;
|
|
25
|
-
/** File size in bytes. */
|
|
26
|
-
bytes: number;
|
|
27
|
-
/** MIME type of the uploaded file. */
|
|
28
|
-
mimeType: string;
|
|
29
|
-
/** Provider that stored the file. */
|
|
30
|
-
provider: string;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Provider-specific upload adapter.
|
|
34
|
-
* Each transport implements this to upload files to its own File API.
|
|
35
|
-
*/
|
|
36
|
-
export interface FileUploadAdapter {
|
|
37
|
-
/**
|
|
38
|
-
* Upload a file buffer and return a publicly accessible URL.
|
|
39
|
-
* @param buffer - File content
|
|
40
|
-
* @param filename - Original filename (used for MIME detection)
|
|
41
|
-
* @param mimeType - MIME type of the file
|
|
42
|
-
* @param apiKey - Provider API key
|
|
43
|
-
* @param signal - Abort signal
|
|
44
|
-
*/
|
|
45
|
-
uploadFile(buffer: Buffer, filename: string, mimeType: string, apiKey: string, signal?: AbortSignal): Promise<FileUploadResult>;
|
|
46
|
-
}
|
|
47
|
-
/** Guess MIME type from filename extension. */
|
|
48
|
-
export declare function guessMimeType(filename: string): string;
|
|
49
|
-
/** Check if a URL points to a local/private address that cloud APIs cannot reach. */
|
|
50
|
-
export declare function isLocalUrl(url: string): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Resolve a local URL by uploading its content to the provider's File API.
|
|
53
|
-
* Public URLs are returned as-is (the LLM API can fetch them directly).
|
|
54
|
-
*
|
|
55
|
-
* @param url - The URL to resolve (may be local or public)
|
|
56
|
-
* @param adapter - Provider-specific upload adapter
|
|
57
|
-
* @param apiKey - API key for the upload
|
|
58
|
-
* @param signal - Optional abort signal
|
|
59
|
-
* @returns Public URL accessible by the LLM
|
|
60
|
-
*/
|
|
61
|
-
export declare function resolveLocalMedia(url: string, adapter: FileUploadAdapter, apiKey: string, signal?: AbortSignal): Promise<string>;
|
|
62
|
-
/**
|
|
63
|
-
* Batch-resolve multiple URLs concurrently. Returns array in same order.
|
|
64
|
-
* Local URLs are uploaded; public URLs pass through unchanged.
|
|
65
|
-
* Supports concurrent uploads (up to `concurrency` limit, default 3).
|
|
66
|
-
* Failures throw (caller should handle).
|
|
67
|
-
*/
|
|
68
|
-
export declare function resolveLocalMediaBatch(urls: string[], adapter: FileUploadAdapter, apiKey: string, signal?: AbortSignal, concurrency?: number): Promise<string[]>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gemini JSON Schema cleaning utilities.
|
|
3
|
-
*
|
|
4
|
-
* Gemini's generateContent API rejects several standard JSON Schema keywords.
|
|
5
|
-
* This module provides a shared recursive cleaner used by:
|
|
6
|
-
* - GeminiGenerateContentTransport (tool declarations in request body)
|
|
7
|
-
* - tool-schema.ts (provider-aware schema normalization at orchestration level)
|
|
8
|
-
*
|
|
9
|
-
* Keeping a single source of truth avoids drift between the two consumers.
|
|
10
|
-
*/
|
|
11
|
-
/** Keywords that Gemini's generateContent API does not accept in tool schemas. */
|
|
12
|
-
export declare const GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS: Set<string>;
|
|
13
|
-
/**
|
|
14
|
-
* Recursively strip unsupported JSON Schema keywords from a schema object.
|
|
15
|
-
* Safe to call multiple times (idempotent).
|
|
16
|
-
*/
|
|
17
|
-
export declare function cleanSchemaForGemini(schema: unknown): unknown;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LLM Client factory — resolves ProviderDef → creates LLMTransport instance.
|
|
3
|
-
*
|
|
4
|
-
* Replaces the old createAdminInferProxyClient() call chain.
|
|
5
|
-
* User API key + ProviderDef → direct provider connection.
|
|
6
|
-
*/
|
|
7
|
-
import type { ProviderDef } from "./provider-def.js";
|
|
8
|
-
import type { LLMTransport } from "./transport.js";
|
|
9
|
-
import { ProviderRegistry } from "./provider-registry.js";
|
|
10
|
-
export interface LLMClientConfig {
|
|
11
|
-
/** Provider id, e.g. "deepseek" */
|
|
12
|
-
provider: string;
|
|
13
|
-
/** Model id, e.g. "deepseek-v4-flash" */
|
|
14
|
-
model: string;
|
|
15
|
-
/** User API key */
|
|
16
|
-
apiKey: string;
|
|
17
|
-
/** Optional base URL override */
|
|
18
|
-
baseUrl?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface LLMClient {
|
|
21
|
-
transport: LLMTransport;
|
|
22
|
-
apiKey: string;
|
|
23
|
-
resolvedModel: string;
|
|
24
|
-
providerDef: ProviderDef;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Create an LLM client from config + registry.
|
|
28
|
-
*
|
|
29
|
-
* 1. Look up provider in registry
|
|
30
|
-
* 2. Apply baseUrl override if provided
|
|
31
|
-
* 3. Instantiate the correct transport
|
|
32
|
-
*/
|
|
33
|
-
export declare function createLLMClient(config: LLMClientConfig, registry: ProviderRegistry): LLMClient;
|
|
34
|
-
/**
|
|
35
|
-
* Auto-detect provider from API key environment variables.
|
|
36
|
-
* Scans registry for providers whose env vars are set.
|
|
37
|
-
* Returns the first match.
|
|
38
|
-
*/
|
|
39
|
-
export declare function autoDetectProvider(registry: ProviderRegistry): {
|
|
40
|
-
providerId: string;
|
|
41
|
-
apiKey: string;
|
|
42
|
-
defaultModel: string;
|
|
43
|
-
} | undefined;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Media Client factory — resolves ProviderDef → creates MediaTransport instances.
|
|
3
|
-
*
|
|
4
|
-
* Parallel to createLLMClient() but for generation models (image/video/music/3D).
|
|
5
|
-
* Uses the same ProviderRegistry to look up provider config, then instantiates
|
|
6
|
-
* the correct media transport adapter.
|
|
7
|
-
*
|
|
8
|
-
* The MediaClient holds a provider-keyed transport cache so that repeated
|
|
9
|
-
* generation calls reuse the same adapter instance.
|
|
10
|
-
*/
|
|
11
|
-
import type { MediaTransport } from "./media-transport.js";
|
|
12
|
-
import type { ProviderDef, MediaCapability, ModelInfo } from "./provider-def.js";
|
|
13
|
-
import type { ProviderRegistry } from "./provider-registry.js";
|
|
14
|
-
export interface MediaClientConfig {
|
|
15
|
-
registry: ProviderRegistry;
|
|
16
|
-
}
|
|
17
|
-
export interface ResolvedMediaModel {
|
|
18
|
-
providerId: string;
|
|
19
|
-
providerDef: ProviderDef;
|
|
20
|
-
modelInfo: ModelInfo;
|
|
21
|
-
mediaType: MediaCapability;
|
|
22
|
-
}
|
|
23
|
-
export declare class MediaClient {
|
|
24
|
-
private registry;
|
|
25
|
-
private transports;
|
|
26
|
-
constructor(config: MediaClientConfig);
|
|
27
|
-
/**
|
|
28
|
-
* Find a specific model by provider + model id for a given media type.
|
|
29
|
-
* Used by the user-designated model routing (no failover).
|
|
30
|
-
*/
|
|
31
|
-
resolveModelById(providerId: string, modelId: string, mediaType: MediaCapability): ResolvedMediaModel | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Get a MediaTransport for a specific provider.
|
|
34
|
-
* Creates and caches the adapter on first access.
|
|
35
|
-
*/
|
|
36
|
-
getTransport(providerId: string): MediaTransport | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* List all available generation models across all providers.
|
|
39
|
-
*/
|
|
40
|
-
listMediaModels(mediaType?: MediaCapability): ResolvedMediaModel[];
|
|
41
|
-
private findModelInProvider;
|
|
42
|
-
}
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MediaTransport — transport interface for generation APIs (image, video, music, 3D).
|
|
3
|
-
*
|
|
4
|
-
* Parallel to LLMTransport (chat/reasoning), MediaTransport handles
|
|
5
|
-
* non-chat generation endpoints that each vendor exposes differently:
|
|
6
|
-
* - Sync (OpenAI images, Volcengine Seedream, Gemini generateContent)
|
|
7
|
-
* - Async job (Volcengine Seedance/3D, MiniMax music) — submit → poll → result
|
|
8
|
-
*
|
|
9
|
-
* Each provider adapter implements this interface and hides vendor-specific
|
|
10
|
-
* auth, endpoint paths, request shapes, and polling logic.
|
|
11
|
-
*/
|
|
12
|
-
export type MediaType = "image" | "video" | "music" | "music_realtime" | "tts" | "3d" | "stt" | "embedding" | "video_understanding" | "image_understanding" | "voice_clone" | "rerank" | "document_parsing" | "realtime_audio";
|
|
13
|
-
export interface MediaRequest {
|
|
14
|
-
/** Generation model id, e.g. "doubao-seedream-5-0-260128", "gpt-image-2" */
|
|
15
|
-
model: string;
|
|
16
|
-
/** What kind of media to generate */
|
|
17
|
-
mediaType: MediaType;
|
|
18
|
-
/** Text prompt for generation */
|
|
19
|
-
prompt: string;
|
|
20
|
-
/** Optional reference image URL (img2img, i2v, img-to-3d) */
|
|
21
|
-
imageUrl?: string;
|
|
22
|
-
/** Desired dimensions, e.g. "1024x1024" */
|
|
23
|
-
size?: string;
|
|
24
|
-
/** Aspect ratio for video, e.g. "16:9" */
|
|
25
|
-
aspectRatio?: string;
|
|
26
|
-
/** Duration in seconds (video, music) */
|
|
27
|
-
duration?: number;
|
|
28
|
-
/** Number of outputs (image) */
|
|
29
|
-
n?: number;
|
|
30
|
-
/** Visual/musical style */
|
|
31
|
-
style?: string;
|
|
32
|
-
/** Intended use / purpose */
|
|
33
|
-
purpose?: string;
|
|
34
|
-
/** Lyrics for music generation */
|
|
35
|
-
lyrics?: string;
|
|
36
|
-
/** Text for TTS */
|
|
37
|
-
text?: string;
|
|
38
|
-
/** TTS channel hint */
|
|
39
|
-
channel?: string;
|
|
40
|
-
/** Source video URLs for edit/merge operations */
|
|
41
|
-
sourceVideos?: string[];
|
|
42
|
-
/** Reference images (no role / first_frame / last_frame) */
|
|
43
|
-
referenceImages?: string[];
|
|
44
|
-
/** Reference image roles — parallel array with referenceImages. */
|
|
45
|
-
imageRoles?: Array<"first_frame" | "last_frame" | "reference_image">;
|
|
46
|
-
/** Reference video URLs for multimodal reference generation (Seedance 2.0) */
|
|
47
|
-
referenceVideos?: string[];
|
|
48
|
-
/** Reference audio URLs for multimodal reference generation (Seedance 2.0) */
|
|
49
|
-
referenceAudios?: string[];
|
|
50
|
-
/** Generate synchronized audio track (Seedance 2.0 / 1.5 pro) */
|
|
51
|
-
generateAudio?: boolean;
|
|
52
|
-
/** Output resolution for upscale, e.g. "1080p" */
|
|
53
|
-
resolution?: string;
|
|
54
|
-
/** Operation variant: generate (default), edit, merge, upscale, multimodal_reference, extend */
|
|
55
|
-
operation?: "generate" | "edit" | "merge" | "upscale" | "multimodal_reference" | "extend";
|
|
56
|
-
/** Image/video quality, e.g. "auto", "high", "low", "hd" */
|
|
57
|
-
quality?: string;
|
|
58
|
-
/** Seed for reproducible generation */
|
|
59
|
-
seed?: number;
|
|
60
|
-
/** TTS voice, e.g. "alloy", "nova", "shimmer" */
|
|
61
|
-
voice?: string;
|
|
62
|
-
/** TTS speech speed multiplier */
|
|
63
|
-
speed?: number;
|
|
64
|
-
/** Pure instrumental mode (MiniMax music) */
|
|
65
|
-
isInstrumental?: boolean;
|
|
66
|
-
/** Source audio URL for cover/remix (MiniMax music) */
|
|
67
|
-
audioUrl?: string;
|
|
68
|
-
/** Output audio format, e.g. "mp3", "wav", "flac" */
|
|
69
|
-
audioFormat?: string;
|
|
70
|
-
/** Video frames per second */
|
|
71
|
-
fps?: number;
|
|
72
|
-
/** Whether to add AI watermark */
|
|
73
|
-
watermark?: boolean;
|
|
74
|
-
/** img2img guidance/control strength (0-1), e.g. Volcengine */
|
|
75
|
-
guidanceScale?: number;
|
|
76
|
-
/** Auto-generate lyrics when none provided (MiniMax) */
|
|
77
|
-
lyricsOptimizer?: boolean;
|
|
78
|
-
/** 3D output format, e.g. "glb", "obj", "usd", "usdz" */
|
|
79
|
-
outputFormat?: string;
|
|
80
|
-
/** Image background mode (OpenAI gpt-image-2): "transparent", "opaque", "auto" */
|
|
81
|
-
background?: string;
|
|
82
|
-
/** Provider-specific request metadata (e.g. rerank documents, parsing options) */
|
|
83
|
-
metadata?: Record<string, unknown>;
|
|
84
|
-
/** Ask the provider to optimize/enhance the prompt before generation */
|
|
85
|
-
enhancePrompt?: boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Progress callback for async polling operations (video gen, 3D gen, etc.).
|
|
88
|
-
* Called periodically with estimated progress percentage, status text, and
|
|
89
|
-
* the provider-specific task ID (available once the task is submitted).
|
|
90
|
-
*/
|
|
91
|
-
onProgress?: (percent: number, status: string, taskId?: string) => void;
|
|
92
|
-
/** Enable progressive/streaming image generation (Volcengine Seedream stream:true) */
|
|
93
|
-
streamImage?: boolean;
|
|
94
|
-
/** Lock camera position (Seedance 1.0/1.5, not Seedance 2.0) */
|
|
95
|
-
cameraFixed?: boolean;
|
|
96
|
-
/** Return last frame URL for chaining continuous video segments */
|
|
97
|
-
returnLastFrame?: boolean;
|
|
98
|
-
/** Service tier: 'default' (online) or 'flex' (offline, ~50% cost) — not all models support flex */
|
|
99
|
-
serviceTier?: "default" | "flex";
|
|
100
|
-
/** Task expiration in seconds (for flex/offline scheduling) */
|
|
101
|
-
executionExpiresAfterSeconds?: number;
|
|
102
|
-
/** Draft mode — low-cost preview (Seedance 1.5 pro only) */
|
|
103
|
-
draft?: boolean;
|
|
104
|
-
/** Draft task ID to promote to final video */
|
|
105
|
-
draftTaskId?: string;
|
|
106
|
-
/** Video-level builtin tools, e.g. ["web_search"] (Seedance 2.0) */
|
|
107
|
-
videoTools?: string[];
|
|
108
|
-
/** End-user safety identifier for content moderation */
|
|
109
|
-
safetyIdentifier?: string;
|
|
110
|
-
/** Callback URL for async task status push notifications */
|
|
111
|
-
callbackUrl?: string;
|
|
112
|
-
/** Image detail level control: 'auto' | 'low' | 'high' */
|
|
113
|
-
detail?: "auto" | "low" | "high";
|
|
114
|
-
/** Max image pixels budget (Volcengine image_pixel_limit) */
|
|
115
|
-
imagePixelLimit?: number;
|
|
116
|
-
}
|
|
117
|
-
export interface MediaResult {
|
|
118
|
-
/** URLs of generated media files */
|
|
119
|
-
mediaUrls: string[];
|
|
120
|
-
/** Model actually used */
|
|
121
|
-
model?: string;
|
|
122
|
-
/** Output dimensions / format info */
|
|
123
|
-
size?: string;
|
|
124
|
-
/** Total generation time in ms */
|
|
125
|
-
durationMs?: number;
|
|
126
|
-
/** Billing unit type for non-token models */
|
|
127
|
-
billingUnit?: "per_call" | "per_second" | "per_character" | "per_pixel" | "per_token";
|
|
128
|
-
/** Quantity consumed (seconds, characters, pixels, etc.) */
|
|
129
|
-
billingQuantity?: number;
|
|
130
|
-
/** Provider-specific metadata */
|
|
131
|
-
metadata?: Record<string, unknown>;
|
|
132
|
-
/** Last frame image URL for chaining continuous video generation */
|
|
133
|
-
lastFrameUrl?: string;
|
|
134
|
-
/** Task ID (for continuing draft→final or querying) */
|
|
135
|
-
taskId?: string;
|
|
136
|
-
}
|
|
137
|
-
export interface MediaTransport {
|
|
138
|
-
/**
|
|
139
|
-
* Generate media content.
|
|
140
|
-
* Handles sync APIs directly and async job APIs (submit + poll) internally.
|
|
141
|
-
*
|
|
142
|
-
* @param request - Generation parameters
|
|
143
|
-
* @param apiKey - User API key (passed explicitly, not from env)
|
|
144
|
-
* @param signal - Optional abort signal
|
|
145
|
-
*/
|
|
146
|
-
generate(request: MediaRequest, apiKey: string, signal?: AbortSignal): Promise<MediaResult>;
|
|
147
|
-
/**
|
|
148
|
-
* Which media types this transport supports.
|
|
149
|
-
* Used by the media client factory to route requests.
|
|
150
|
-
*/
|
|
151
|
-
readonly supportedTypes: readonly MediaType[];
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Extended transport for providers that support async task management
|
|
155
|
-
* (submit → poll → cancel/query). Volcengine Seedance, MiniMax async, etc.
|
|
156
|
-
*/
|
|
157
|
-
export interface AsyncMediaTransport extends MediaTransport {
|
|
158
|
-
/** Cancel / delete an async task. */
|
|
159
|
-
deleteVideoTask(taskId: string, apiKey: string, signal?: AbortSignal): Promise<void>;
|
|
160
|
-
/** List recent tasks for status queries. */
|
|
161
|
-
listVideoTasks(apiKey: string, options?: {
|
|
162
|
-
after?: string;
|
|
163
|
-
limit?: number;
|
|
164
|
-
status?: string;
|
|
165
|
-
}, signal?: AbortSignal): Promise<Record<string, unknown>>;
|
|
166
|
-
/**
|
|
167
|
-
* Query a single task by ID — preferred over listVideoTasks for direct lookups.
|
|
168
|
-
* Not all providers support listing; all async providers support single-task queries.
|
|
169
|
-
*/
|
|
170
|
-
getTaskStatus?(taskId: string, apiKey: string, signal?: AbortSignal): Promise<{
|
|
171
|
-
status: string;
|
|
172
|
-
task: Record<string, unknown>;
|
|
173
|
-
}>;
|
|
174
|
-
}
|
|
175
|
-
/** Type guard for transports that support async task management. */
|
|
176
|
-
export declare function isAsyncMediaTransport(t: MediaTransport): t is AsyncMediaTransport;
|