export type BridgeAuth = { accessToken: string; accountId?: string; }; export type BridgeContext = { sessionId?: string; agent?: string; modelId?: string; }; export declare function abortBridgeStreamsForSession(sessionId: string, reason?: Error): void; export declare function abortAllBridgeStreams(reason?: Error): void; export declare function bridgeConversationToResponsesSSE(opts: { auth: BridgeAuth; body: Record; signal?: AbortSignal; context?: BridgeContext; }): Promise; /** * Extract an `__opencode_tool__` payload from a native tool call. * Models cannot see declared OpenCode tools (the ChatGPT web backend does not * pass local_function_names to the model), so the guard prompt instructs the * model to carry tool invocations as JSON payloads inside native python / * container.exec calls. This function extracts that payload. * * Pattern in python code or shell command: * print(json.dumps({"__opencode_tool__": "task", "arguments": {...}})) * print('{"__opencode_tool__":"task","arguments":{...}}') */ export declare function extractOpenCodeToolPayload(name: string, args: string): { toolName: string; arguments: string; } | undefined; /** * Translate simple ChatGPT-native python bodies into declared OpenCode client * tools (read/write/edit/bash) instead of wrapping every body in a python3 * heredoc. Returns undefined when the body is multi-step Python that should * stay on the python3 channel. */ export declare function salvagePythonToClientTool(code: string, declared: string[]): { name: string; arguments: string; } | undefined; /** * Salvage workspace code from a disabled connector call's arguments. * Models sometimes route real python source or a shell command through a * connector (api_tool.call_tool, hash-namespaced plugin, etc.). Rather than * bounce with a disabled-note, extract the code/command and return a bash * command string the caller remaps onto local bash. Returns undefined when the * args contain nothing that looks like executable workspace code. */ export declare function salvageConnectorArgs(args: string, pythonHeredoc: (source: string) => string): string | undefined; /** * ChatGPT web harnesses emit native tool calls (python, container.exec, …) * that do not exist client-side. Primary path: remap python → local python3 * via bash; remap container.exec/shell command payloads → local bash. * Opaque connector/plugin calls remain upstream instead of becoming local * no-op calls that the model can repeat forever. * * Before remapping, check for __opencode_tool__ payloads — the model uses * native channels to invoke declared OpenCode tools it cannot see directly. */ export declare function remapNativeToolCall(name: string, args: string, declared: string[]): { name: string; arguments: string; remapped: boolean; }; //# sourceMappingURL=bridge.d.ts.map