@agent-proxy/zcode 0.0.0-stage → 0.11.1

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.
@@ -0,0 +1,27 @@
1
+ import { type ZcodeToolMap } from "./wire.ts";
2
+ import { type ZcodeGatewayCall } from "./vision.ts";
3
+ /** 网关代执行工具(analyze_image)的驱动层钩子:执行调用并按需发起上游续跑。 */
4
+ export interface ZcodeGatewayToolsHook {
5
+ /** 执行一次被吸收的调用;返回作为 tool_result 呈给上游的文本。抛错时降级为错误说明文本。 */
6
+ execute: (call: ZcodeGatewayCall) => Promise<string>;
7
+ /** 追加 tool_use/tool_result 消息后发起下一次上游请求;失败应抛错(整条响应转 failed)。 */
8
+ nextUpstream: (calls: Array<{
9
+ call: ZcodeGatewayCall;
10
+ result: string;
11
+ }>) => Promise<Response>;
12
+ /** 续跑上限(防止模型循环调用)。 */
13
+ maxContinuations: number;
14
+ }
15
+ export interface ZcodeResponseOptions {
16
+ model: string;
17
+ tools: ZcodeToolMap;
18
+ stream: boolean;
19
+ signal?: AbortSignal;
20
+ abort?: () => void;
21
+ onComplete?: (response: Record<string, unknown>) => void;
22
+ onChunk?: (chunk: string) => void;
23
+ sanitizeError?: (error: Record<string, unknown>) => Record<string, unknown>;
24
+ /** 声明了网关代执行工具时必须提供;否则吸收到相关调用会让响应失败。 */
25
+ gatewayTools?: ZcodeGatewayToolsHook;
26
+ }
27
+ export declare function createZcodeResponse(upstream: Response, options: ZcodeResponseOptions): Promise<Response>;