u-foo 3.1.6 → 4.0.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/README.md +172 -13
- package/README.zh-CN.md +108 -13
- package/SKILLS/ufoo/SKILL.md +15 -3
- package/SKILLS/ufoo-bus/SKILL.md +21 -1
- package/bin/uclaude.js +4 -0
- package/bin/ucodex.js +4 -0
- package/bin/ufoo.js +3 -1
- package/dist/tui/darwin-arm64/ufoo-tui +0 -0
- package/dist/tui/darwin-x64/ufoo-tui +0 -0
- package/dist/tui/linux-arm64/ufoo-tui +0 -0
- package/dist/tui/linux-x64/ufoo-tui +0 -0
- package/package.json +10 -3
- package/scripts/postinstall-skills.js +53 -0
- package/scripts/postinstall.js +11 -16
- package/scripts/smoke-native-messages.js +214 -0
- package/src/agents/activity/activityStateWriter.js +37 -38
- package/src/agents/capabilities/agentManagement/index.js +4 -0
- package/src/agents/capabilities/agentManagement/service.js +113 -0
- package/src/agents/capabilities/agentRouting/index.js +4 -0
- package/src/agents/capabilities/coding/index.js +32 -0
- package/src/agents/capabilities/coordination/index.js +37 -0
- package/src/agents/capabilities/globalRouting/index.js +5 -0
- package/src/agents/capabilities/groups/index.js +3 -0
- package/src/agents/capabilities/index.js +25 -0
- package/src/agents/capabilities/planning/index.js +123 -0
- package/src/agents/capabilities/planning/main.js +28 -0
- package/src/agents/capabilities/projectDiscovery/index.js +3 -0
- package/src/agents/capabilities/scheduling/index.js +3 -0
- package/src/agents/capabilities/sharedMemory/index.js +4 -0
- package/src/agents/capabilities/skills/index.js +12 -0
- package/src/agents/capabilities/taskExecution/index.js +3 -0
- package/src/agents/capabilities/taskReports/index.js +6 -0
- package/src/agents/controller/controllerToolExecutor.js +6 -4
- package/src/agents/controller/loopRuntime.js +85 -221
- package/src/agents/controller/ufooAgent.js +1 -0
- package/src/agents/internal/internalRunner.js +103 -32
- package/src/agents/launch/launcher.js +88 -6
- package/src/agents/launch/nativeCapabilities.js +40 -0
- package/src/agents/launch/nativeMessages.js +362 -0
- package/src/agents/launch/notifier.js +13 -18
- package/src/agents/launch/readyDetector.js +26 -12
- package/src/agents/profiles/coding.js +6 -0
- package/src/agents/profiles/globalRouter.js +2 -0
- package/src/agents/profiles/main.js +5 -0
- package/src/agents/prompts/groupBootstrap.js +10 -0
- package/src/agents/prompts/mainAgent.js +39 -0
- package/src/agents/prompts/native/tasks.js +2 -2
- package/src/agents/prompts/native/ufoo.js +3 -0
- package/src/agents/providers/claudeEventTranslator.js +6 -1
- package/src/agents/providers/claudeThreadProvider.js +44 -2
- package/src/agents/providers/codexEventTranslator.js +47 -7
- package/src/agents/providers/codexThreadProvider.js +3 -2
- package/src/agents/providers/controllerJsonTransport.js +28 -0
- package/src/agents/providers/credentials/claude.js +10 -3
- package/src/agents/providers/nativeTransport.js +1135 -0
- package/src/agents/providers/runtimeConfig.js +186 -0
- package/src/agents/providers/thinkingLevels.js +132 -0
- package/src/agents/providers/transports/anthropicMessagesTransport.js +121 -0
- package/src/agents/providers/transports/index.js +10 -0
- package/src/agents/providers/transports/openaiChatTransport.js +117 -0
- package/src/agents/providers/transports/openaiResponsesTransport.js +120 -0
- package/src/agents/providers/transports/responsesProtocol.js +499 -0
- package/src/agents/providers/transports/systemBlocks.js +16 -0
- package/src/agents/providers/transports/transportContract.js +50 -0
- package/src/agents/providers/transports/visionBlocks.js +151 -0
- package/src/agents/providers/upstreamTransport.js +13 -4
- package/src/agents/runtime/composeCapabilities.js +89 -0
- package/src/agents/runtime/context/commandStore.js +43 -0
- package/src/agents/runtime/context/contextWindow.js +119 -0
- package/src/agents/runtime/context/fileLock.js +36 -0
- package/src/agents/runtime/context/runtimeStore.js +126 -0
- package/src/agents/runtime/context/sessionJournal.js +360 -0
- package/src/agents/runtime/context/sessionStore.js +57 -0
- package/src/agents/runtime/core/agentLoop.js +270 -0
- package/src/agents/runtime/core/stableJson.js +29 -0
- package/src/agents/runtime/core/toolLoopGuard.js +55 -0
- package/src/agents/runtime/createAgentRuntime.js +247 -0
- package/src/agents/runtime/index.js +14 -0
- package/src/agents/runtime/protocol/faultHarness.js +90 -0
- package/src/agents/runtime/protocol/materialize.js +107 -0
- package/src/agents/runtime/protocol/toolCallLedger.js +221 -0
- package/src/agents/runtime/tasks/resourceLease.js +66 -0
- package/src/agents/runtime/tasks/scheduler.js +73 -0
- package/src/agents/runtime/tools/registry.js +57 -0
- package/src/app/chat/ChatController.js +14 -3
- package/src/app/chat/agentDirectory.js +8 -2
- package/src/app/chat/commandExecutor.js +36 -46
- package/src/app/chat/commands.js +14 -7
- package/src/app/chat/daemonConnection.js +58 -5
- package/src/app/chat/daemonMessageRouter.js +61 -3
- package/src/app/chat/inputSubmitHandler.js +14 -2
- package/src/app/chat/launchRequestContext.js +42 -0
- package/src/app/chat/multiWindow/paneManager.js +85 -165
- package/src/app/chat/streamState.js +3 -3
- package/src/app/chat/transport.js +1 -1
- package/src/app/cli/busCoreCommands.js +9 -0
- package/src/app/cli/features/doctor.js +33 -0
- package/src/app/cli/features/skills.js +16 -4
- package/src/app/cli/reportCoreCommands.js +37 -0
- package/src/app/cli/run.js +40 -39
- package/src/code/agent.js +16 -4
- package/src/code/context/artifacts.js +12 -11
- package/src/code/context/assembler.js +2 -1
- package/src/code/context/promptLayers.js +1 -13
- package/src/code/context/stableJson.js +2 -27
- package/src/code/contextWindow.js +2 -117
- package/src/code/conversation/sessionJournal.js +3 -349
- package/src/code/internalThread.js +100 -0
- package/src/code/nativeRunner.js +36 -2668
- package/src/code/protocol/faultHarness.js +2 -88
- package/src/code/protocol/materialize.js +2 -105
- package/src/code/protocol/toolCallLedger.js +5 -215
- package/src/code/providers/anthropicMessagesTransport.js +2 -118
- package/src/code/providers/openaiChatTransport.js +2 -114
- package/src/code/providers/openaiResponsesTransport.js +2 -117
- package/src/code/providers/responsesProtocol.js +2 -497
- package/src/code/providers/transportContract.js +2 -48
- package/src/code/providers/visionBlocks.js +2 -149
- package/src/code/sessionStore.js +24 -96
- package/src/code/thinkingLevels.js +1 -130
- package/src/code/toolLoopGuard.js +3 -49
- package/src/code/tools/artifactRead.js +1 -1
- package/src/code/tools/executor.js +373 -0
- package/src/code/tools/specs.js +312 -0
- package/src/config.js +81 -67
- package/src/coordination/bus/deliveryQueue.js +16 -2
- package/src/coordination/bus/index.js +2 -6
- package/src/coordination/bus/inject.js +13 -5
- package/src/coordination/bus/nativeReceipts.js +100 -0
- package/src/coordination/bus/queue.js +1 -3
- package/src/coordination/bus/utils.js +7 -3
- package/src/coordination/history/agentSurface.js +142 -0
- package/src/coordination/history/controllerSummary.js +23 -0
- package/src/coordination/memory/index.js +5 -21
- package/src/coordination/report/store.js +103 -83
- package/src/coordination/state/agentsStore.js +57 -3
- package/src/coordination/state/fileLock.js +2 -0
- package/src/coordination/state/workspaceAccess.js +36 -0
- package/src/runtime/contracts/agentMode.js +17 -0
- package/src/runtime/contracts/eventContract.js +3 -0
- package/src/runtime/contracts/uiProtocol.js +4 -0
- package/src/runtime/daemon/agentHost.js +375 -0
- package/src/runtime/daemon/busBridge.js +396 -0
- package/src/runtime/daemon/claudeChannel.js +159 -0
- package/src/runtime/daemon/controlPlaneService.js +27 -17
- package/src/runtime/daemon/cronOps.js +25 -17
- package/src/runtime/daemon/deliveryScheduler.js +32 -5
- package/src/runtime/daemon/executionPaths.js +30 -0
- package/src/runtime/daemon/globalDaemon.js +28 -1
- package/src/runtime/daemon/groupOrchestrator.js +1 -0
- package/src/runtime/daemon/index.js +114 -344
- package/src/runtime/daemon/ipcServer.js +32 -10
- package/src/runtime/daemon/mcpConfigure.js +113 -20
- package/src/runtime/daemon/mcpHttpServer.js +27 -5
- package/src/runtime/daemon/mcpServer.js +7 -4
- package/src/runtime/daemon/mcpStdioProxy.js +127 -10
- package/src/runtime/daemon/ops.js +22 -17
- package/src/runtime/daemon/promptRequest.js +23 -4
- package/src/runtime/daemon/providerSessions.js +67 -33
- package/src/runtime/daemon/reportControlBus.js +59 -25
- package/src/runtime/daemon/status.js +4 -0
- package/src/runtime/privacy/redactor.js +2 -2
- package/src/runtime/projects/identity.js +2 -1
- package/src/runtime/projects/registry.js +98 -38
- package/src/tools/controllerSchemas.js +24 -0
- package/src/tools/handlers/dispatchMessage.js +5 -2
- package/src/tools/handlers/listAgents.js +3 -1
- package/src/tools/handlers/readBusSummary.js +3 -1
- package/src/tools/handlers/readProjectRegistry.js +29 -2
- package/src/tools/handlers/routeAgent.js +35 -0
- package/src/tools/index.js +1 -0
- package/src/tools/registry.js +2 -0
- package/src/tools/schemaFixtures.js +16 -3
- package/src/tools/tier1/routeAgent.js +2 -2
- package/src/tools/tier2/runtimeCoordination.js +38 -0
- package/src/tools/types.js +2 -0
- package/src/ui/agentPresentation.js +109 -0
- package/src/ui/agentSurface.js +270 -0
- package/src/ui/format/banner.js +8 -11
- package/src/ui/format/startupBanner.js +50 -0
- package/src/ui/multiPaneBusMirror.js +29 -3
- package/src/ui/rustChatHost.js +170 -438
- package/src/ui/rustMultiSession.js +225 -51
- package/src/ui/rustUcodeHost.js +20 -87
- package/src/ui/settingsBridge.js +7 -4
- package/src/app/chat/agentEnter.js +0 -70
- package/src/app/chat/multiWindow/index.js +0 -310
- package/src/app/chat/multiWindow/paneLayout.js +0 -84
- package/src/app/chat/multiWindow/renderer.js +0 -420
- package/src/app/chat/multiWindow/virtualTerminal.js +0 -327
- package/src/app/chat/multiWindow/vtFrame.js +0 -93
- package/src/ui/multiWindowHandoff.js +0 -232
- package/src/ui/ptyHandoff.js +0 -23
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { loadConfig, defaultAgentModelForProvider, sameModelProvider } = require("../../config");
|
|
4
|
+
const { readKimiAccessToken } = require("./credentials/kimi");
|
|
5
|
+
|
|
6
|
+
const DEFAULT_OPENAI_BASE_URL = "https://api.openai.com/v1";
|
|
7
|
+
const DEFAULT_ANTHROPIC_BASE_URL = "https://api.anthropic.com/v1";
|
|
8
|
+
const DEFAULT_KIMI_BASE_URL = "https://api.kimi.com/coding/v1";
|
|
9
|
+
const DEFAULT_CODEX_BASE_URL = "https://chatgpt.com/backend-api/codex";
|
|
10
|
+
const DEFAULT_XAI_BASE_URL = "https://api.x.ai/v1";
|
|
11
|
+
const DEFAULT_GROK_BUILD_BASE_URL = DEFAULT_XAI_BASE_URL;
|
|
12
|
+
const DEFAULT_GROK_BUILD_MODEL = "grok-4.6";
|
|
13
|
+
const DEFAULT_KIMI_MODEL = "k3";
|
|
14
|
+
|
|
15
|
+
function normalizeProvider(value = "") {
|
|
16
|
+
const text = String(value || "").trim().toLowerCase();
|
|
17
|
+
if (!text) return "";
|
|
18
|
+
if (text === "codex" || text === "codex-cli" || text === "codex-code") return "codex";
|
|
19
|
+
if (text === "claude" || text === "claude-cli" || text === "claude-code") return "anthropic";
|
|
20
|
+
if (text === "kimi" || text === "kimi-code" || text === "moonshot") return "kimi";
|
|
21
|
+
if (text === "grok" || text === "grok-build" || text === "grok-shell" || text === "grok-api") return "grok-build";
|
|
22
|
+
if (text === "xai") return "xai";
|
|
23
|
+
if (text === "openai" || text === "anthropic") return text;
|
|
24
|
+
return text;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function normalizeKimiModel(value = "") {
|
|
28
|
+
const raw = String(value || "").trim();
|
|
29
|
+
if (!raw) return "";
|
|
30
|
+
const suffix = raw.match(/^(.*?)(\([^)]*\))$/);
|
|
31
|
+
const base = String(suffix ? suffix[1] : raw).trim().replace(/\[1m\]$/i, "");
|
|
32
|
+
const lower = base.toLowerCase();
|
|
33
|
+
let normalized = lower;
|
|
34
|
+
if (["kimi-k2.7-code", "k2.7-code", "kimi-for-coding", "for-coding"].includes(lower)) {
|
|
35
|
+
normalized = "kimi-for-coding";
|
|
36
|
+
} else if (["kimi-k2.7-code-highspeed", "k2.7-code-highspeed", "kimi-for-coding-highspeed", "for-coding-highspeed"].includes(lower)) {
|
|
37
|
+
normalized = "kimi-for-coding-highspeed";
|
|
38
|
+
} else if (normalized.startsWith("kimi-")) {
|
|
39
|
+
normalized = normalized.slice("kimi-".length);
|
|
40
|
+
}
|
|
41
|
+
return `${normalized}${suffix ? suffix[2] : ""}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function resolveTransport({ provider = "", baseUrl = "" } = {}) {
|
|
45
|
+
const normalizedProvider = normalizeProvider(provider);
|
|
46
|
+
const url = String(baseUrl || "").trim().toLowerCase();
|
|
47
|
+
|
|
48
|
+
if (normalizedProvider === "codex" || normalizedProvider === "grok-build" || normalizedProvider === "xai") {
|
|
49
|
+
return "openai-responses";
|
|
50
|
+
}
|
|
51
|
+
if (normalizedProvider === "anthropic") return "anthropic-messages";
|
|
52
|
+
if (normalizedProvider === "kimi") return "openai-chat";
|
|
53
|
+
if (/\/responses(?:$|[/?#])/.test(url)) return "openai-responses";
|
|
54
|
+
if (url.includes("anthropic.com")) return "anthropic-messages";
|
|
55
|
+
if (/\/messages(?:$|[/?#])/.test(url) && !/\/chat\/completions(?:$|[/?#])/.test(url)) {
|
|
56
|
+
return "anthropic-messages";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return "openai-chat";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function resolveRuntimeConfig({ workspaceRoot = process.cwd(), provider = "", model = "", useCodingConfig = true } = {}) {
|
|
63
|
+
const config = loadConfig(workspaceRoot);
|
|
64
|
+
const configuredProvider = normalizeProvider((useCodingConfig ? config.ucodeProvider : "") || config.agentProvider || "");
|
|
65
|
+
const selectedProvider = normalizeProvider(
|
|
66
|
+
provider
|
|
67
|
+
|| (useCodingConfig ? process.env.UFOO_UCODE_PROVIDER : "")
|
|
68
|
+
|| configuredProvider
|
|
69
|
+
|| "openai"
|
|
70
|
+
) || "openai";
|
|
71
|
+
const configuredModel = sameModelProvider((useCodingConfig ? config.ucodeProvider : "") || config.agentProvider, selectedProvider)
|
|
72
|
+
? ((useCodingConfig ? config.ucodeModel : "") || config.agentModel)
|
|
73
|
+
: "";
|
|
74
|
+
|
|
75
|
+
const selectedModel = String(
|
|
76
|
+
model
|
|
77
|
+
|| (useCodingConfig ? process.env.UFOO_UCODE_MODEL : "")
|
|
78
|
+
|| configuredModel
|
|
79
|
+
|| (selectedProvider === "kimi"
|
|
80
|
+
? DEFAULT_KIMI_MODEL
|
|
81
|
+
: (selectedProvider === "grok-build" ? DEFAULT_GROK_BUILD_MODEL : defaultAgentModelForProvider(selectedProvider)))
|
|
82
|
+
).trim();
|
|
83
|
+
|
|
84
|
+
const defaultBaseUrl = selectedProvider === "anthropic"
|
|
85
|
+
? String(process.env.ANTHROPIC_BASE_URL || DEFAULT_ANTHROPIC_BASE_URL)
|
|
86
|
+
: selectedProvider === "kimi"
|
|
87
|
+
? String(process.env.KIMI_BASE_URL || DEFAULT_KIMI_BASE_URL)
|
|
88
|
+
: selectedProvider === "codex"
|
|
89
|
+
? String(process.env.UFOO_CODEX_BASE_URL || DEFAULT_CODEX_BASE_URL)
|
|
90
|
+
: selectedProvider === "grok-build"
|
|
91
|
+
? String(
|
|
92
|
+
process.env.UFOO_GROK_BUILD_BASE_URL
|
|
93
|
+
|| process.env.GROK_BUILD_BASE_URL
|
|
94
|
+
|| DEFAULT_GROK_BUILD_BASE_URL
|
|
95
|
+
)
|
|
96
|
+
: selectedProvider === "xai"
|
|
97
|
+
? String(process.env.XAI_BASE_URL || DEFAULT_XAI_BASE_URL)
|
|
98
|
+
: String(process.env.OPENAI_BASE_URL || DEFAULT_OPENAI_BASE_URL);
|
|
99
|
+
|
|
100
|
+
let baseUrl = String(
|
|
101
|
+
(useCodingConfig ? process.env.UFOO_UCODE_BASE_URL : "")
|
|
102
|
+
|| (useCodingConfig ? config.ucodeBaseUrl : "")
|
|
103
|
+
|| defaultBaseUrl
|
|
104
|
+
).trim();
|
|
105
|
+
|
|
106
|
+
const explicitApiKey = String(
|
|
107
|
+
(useCodingConfig ? process.env.UFOO_UCODE_API_KEY : "")
|
|
108
|
+
|| (useCodingConfig ? config.ucodeApiKey : "")
|
|
109
|
+
|| ""
|
|
110
|
+
).trim();
|
|
111
|
+
let apiKey = explicitApiKey;
|
|
112
|
+
let apiKeySource = explicitApiKey ? "explicit" : "";
|
|
113
|
+
let kimiCredentialState = "";
|
|
114
|
+
if (!apiKey && selectedProvider === "kimi") {
|
|
115
|
+
const credential = readKimiAccessToken({ env: process.env });
|
|
116
|
+
if (credential && credential.accessToken) {
|
|
117
|
+
apiKey = String(credential.accessToken).trim();
|
|
118
|
+
apiKeySource = "kimi-credential";
|
|
119
|
+
kimiCredentialState = String(credential.state || "");
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (!apiKey) {
|
|
123
|
+
apiKey = String(
|
|
124
|
+
(selectedProvider === "openai" ? process.env.OPENAI_API_KEY : "")
|
|
125
|
+
|| (selectedProvider === "anthropic" ? process.env.ANTHROPIC_API_KEY : "")
|
|
126
|
+
|| (selectedProvider === "codex" ? process.env.OPENAI_API_KEY : "")
|
|
127
|
+
|| (selectedProvider === "grok-build" ? (process.env.GROK_BUILD_API_KEY || process.env.XAI_API_KEY) : "")
|
|
128
|
+
|| (selectedProvider === "xai" ? process.env.XAI_API_KEY : "")
|
|
129
|
+
|| ""
|
|
130
|
+
).trim();
|
|
131
|
+
if (apiKey) apiKeySource = "env";
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// ChatGPT's Codex backend accepts Codex OAuth credentials, while standard
|
|
135
|
+
// OpenAI API keys belong on the public OpenAI API. Generic ucode base URL
|
|
136
|
+
// overrides remain authoritative for an explicitly configured gateway.
|
|
137
|
+
if (
|
|
138
|
+
selectedProvider === "codex"
|
|
139
|
+
&& apiKey
|
|
140
|
+
&& !String(useCodingConfig ? process.env.UFOO_UCODE_BASE_URL || "" : "").trim()
|
|
141
|
+
&& !String(useCodingConfig ? config.ucodeBaseUrl || "" : "").trim()
|
|
142
|
+
) {
|
|
143
|
+
baseUrl = String(process.env.OPENAI_BASE_URL || DEFAULT_OPENAI_BASE_URL).trim();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return {
|
|
147
|
+
provider: selectedProvider,
|
|
148
|
+
model: selectedModel,
|
|
149
|
+
baseUrl,
|
|
150
|
+
apiKey,
|
|
151
|
+
apiKeySource,
|
|
152
|
+
kimiCredentialState,
|
|
153
|
+
transport: resolveTransport({ provider: selectedProvider, baseUrl }),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function resolveCompletionUrl(baseUrl = "") {
|
|
158
|
+
const raw = String(baseUrl || "").trim();
|
|
159
|
+
if (!raw) return "";
|
|
160
|
+
const normalized = raw.replace(/\/+$/, "");
|
|
161
|
+
if (/\/chat\/completions$/i.test(normalized)) return normalized;
|
|
162
|
+
if (/\/v1$/i.test(normalized)) return `${normalized}/chat/completions`;
|
|
163
|
+
if (/\/api$/i.test(normalized)) return `${normalized}/v1/chat/completions`;
|
|
164
|
+
return `${normalized}/chat/completions`;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function resolveResponsesUrl(baseUrl = "") {
|
|
168
|
+
const raw = String(baseUrl || "").trim();
|
|
169
|
+
if (!raw) return "";
|
|
170
|
+
const normalized = raw.replace(/\/+$/, "");
|
|
171
|
+
if (/\/responses$/i.test(normalized)) return normalized;
|
|
172
|
+
if (/\/v1$/i.test(normalized)) return `${normalized}/responses`;
|
|
173
|
+
if (/\/api$/i.test(normalized)) return `${normalized}/v1/responses`;
|
|
174
|
+
return `${normalized}/responses`;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function resolveAnthropicMessagesUrl(baseUrl = "") {
|
|
178
|
+
const raw = String(baseUrl || "").trim() || DEFAULT_ANTHROPIC_BASE_URL;
|
|
179
|
+
const normalized = raw.replace(/\/+$/, "");
|
|
180
|
+
if (/\/messages$/i.test(normalized)) return normalized;
|
|
181
|
+
if (/\/v1$/i.test(normalized)) return `${normalized}/messages`;
|
|
182
|
+
if (/\/api$/i.test(normalized)) return `${normalized}/v1/messages`;
|
|
183
|
+
return `${normalized}/messages`;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
module.exports = { normalizeProvider, normalizeKimiModel, resolveTransport, resolveRuntimeConfig, resolveCompletionUrl, resolveResponsesUrl, resolveAnthropicMessagesUrl, DEFAULT_OPENAI_BASE_URL };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Ucode thinking-intensity levels.
|
|
5
|
+
*
|
|
6
|
+
* Used as the secondary `/model <id> <level>` menu after picking a model.
|
|
7
|
+
* Maps to Anthropic extended-thinking budget_tokens and OpenAI-compatible
|
|
8
|
+
* reasoning_effort where the transport supports it.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const THINKING_LEVELS = Object.freeze([
|
|
12
|
+
{
|
|
13
|
+
id: "off",
|
|
14
|
+
desc: "disable extended thinking",
|
|
15
|
+
budgetTokens: 0,
|
|
16
|
+
reasoningEffort: "",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: "low",
|
|
20
|
+
desc: "light thinking",
|
|
21
|
+
budgetTokens: 2048,
|
|
22
|
+
reasoningEffort: "low",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "medium",
|
|
26
|
+
desc: "default thinking",
|
|
27
|
+
budgetTokens: 10000,
|
|
28
|
+
reasoningEffort: "medium",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "high",
|
|
32
|
+
desc: "deeper thinking",
|
|
33
|
+
budgetTokens: 32000,
|
|
34
|
+
reasoningEffort: "high",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "max",
|
|
38
|
+
desc: "maximum thinking budget",
|
|
39
|
+
budgetTokens: 48000,
|
|
40
|
+
reasoningEffort: "high",
|
|
41
|
+
},
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
const DEFAULT_THINKING_LEVEL = "medium";
|
|
45
|
+
const THINKING_LEVEL_IDS = new Set(THINKING_LEVELS.map((item) => item.id));
|
|
46
|
+
|
|
47
|
+
function normalizeThinkingLevel(value = "") {
|
|
48
|
+
const raw = String(value || "").trim().toLowerCase();
|
|
49
|
+
if (!raw) return "";
|
|
50
|
+
if (raw === "none" || raw === "disable" || raw === "disabled" || raw === "0") return "off";
|
|
51
|
+
if (raw === "med" || raw === "default") return "medium";
|
|
52
|
+
if (raw === "maximum" || raw === "xhigh" || raw === "ultra") return "max";
|
|
53
|
+
if (THINKING_LEVEL_IDS.has(raw)) return raw;
|
|
54
|
+
return "";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function getThinkingLevel(id = "") {
|
|
58
|
+
const normalized = normalizeThinkingLevel(id) || DEFAULT_THINKING_LEVEL;
|
|
59
|
+
return THINKING_LEVELS.find((item) => item.id === normalized) || THINKING_LEVELS[2];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function suggestThinkingLevels(options = {}) {
|
|
63
|
+
const current = normalizeThinkingLevel(options.current || "") || DEFAULT_THINKING_LEVEL;
|
|
64
|
+
return THINKING_LEVELS.map((item) => ({
|
|
65
|
+
id: item.id,
|
|
66
|
+
desc: item.id === current ? `${item.desc} · current` : item.desc,
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function resolveThinkingFromEnvAndConfig({
|
|
71
|
+
env = process.env,
|
|
72
|
+
configLevel = "",
|
|
73
|
+
} = {}) {
|
|
74
|
+
// Explicit numeric budget still wins (advanced override).
|
|
75
|
+
const rawBudget = env && env.UFOO_UCODE_THINKING_BUDGET_TOKENS;
|
|
76
|
+
if (rawBudget !== undefined && rawBudget !== null && String(rawBudget).trim() !== "") {
|
|
77
|
+
const parsed = Number.parseInt(String(rawBudget), 10);
|
|
78
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
79
|
+
return {
|
|
80
|
+
level: "off",
|
|
81
|
+
budgetTokens: 0,
|
|
82
|
+
reasoningEffort: "",
|
|
83
|
+
source: "env-budget",
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
level: "",
|
|
88
|
+
budgetTokens: Math.floor(parsed),
|
|
89
|
+
reasoningEffort: "",
|
|
90
|
+
source: "env-budget",
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const fromEnv = normalizeThinkingLevel(env && env.UFOO_UCODE_THINKING);
|
|
95
|
+
const fromConfig = normalizeThinkingLevel(configLevel);
|
|
96
|
+
const level = fromEnv || fromConfig || DEFAULT_THINKING_LEVEL;
|
|
97
|
+
const spec = getThinkingLevel(level);
|
|
98
|
+
return {
|
|
99
|
+
level: spec.id,
|
|
100
|
+
budgetTokens: spec.budgetTokens,
|
|
101
|
+
reasoningEffort: spec.reasoningEffort,
|
|
102
|
+
source: fromEnv ? "env" : (fromConfig ? "config" : "default"),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function applyThinkingLevelToEnv(level = "", env = process.env) {
|
|
107
|
+
const normalized = normalizeThinkingLevel(level);
|
|
108
|
+
if (!normalized) return "";
|
|
109
|
+
const spec = getThinkingLevel(normalized);
|
|
110
|
+
try {
|
|
111
|
+
env.UFOO_UCODE_THINKING = spec.id;
|
|
112
|
+
if (spec.budgetTokens > 0) {
|
|
113
|
+
env.UFOO_UCODE_THINKING_BUDGET_TOKENS = String(spec.budgetTokens);
|
|
114
|
+
} else {
|
|
115
|
+
env.UFOO_UCODE_THINKING_BUDGET_TOKENS = "0";
|
|
116
|
+
}
|
|
117
|
+
} catch {
|
|
118
|
+
// ignore env write failures
|
|
119
|
+
}
|
|
120
|
+
return spec.id;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
module.exports = {
|
|
124
|
+
THINKING_LEVELS,
|
|
125
|
+
THINKING_LEVEL_IDS,
|
|
126
|
+
DEFAULT_THINKING_LEVEL,
|
|
127
|
+
normalizeThinkingLevel,
|
|
128
|
+
getThinkingLevel,
|
|
129
|
+
suggestThinkingLevels,
|
|
130
|
+
resolveThinkingFromEnvAndConfig,
|
|
131
|
+
applyThinkingLevelToEnv,
|
|
132
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { assertTransport } = require("./transportContract");
|
|
4
|
+
const {
|
|
5
|
+
extractVisionPayload,
|
|
6
|
+
stripVisionBase64,
|
|
7
|
+
visionSummaryText,
|
|
8
|
+
toAnthropicImageBlock,
|
|
9
|
+
} = require("./visionBlocks");
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Anthropic Messages API transport adapter.
|
|
13
|
+
* @param {{
|
|
14
|
+
* resolveUrl: Function,
|
|
15
|
+
* runTurn: Function,
|
|
16
|
+
* toJsonString: Function,
|
|
17
|
+
* clipText: Function,
|
|
18
|
+
* }} deps
|
|
19
|
+
*/
|
|
20
|
+
function createAnthropicMessagesTransport(deps = {}) {
|
|
21
|
+
const {
|
|
22
|
+
resolveUrl,
|
|
23
|
+
runTurn,
|
|
24
|
+
toJsonString,
|
|
25
|
+
clipText,
|
|
26
|
+
} = deps;
|
|
27
|
+
|
|
28
|
+
const transport = {
|
|
29
|
+
name: "anthropic-messages",
|
|
30
|
+
features: Object.freeze(["tool_calls", "streaming", "vision", "deferred_tools"]),
|
|
31
|
+
resolveUrl,
|
|
32
|
+
prepareMessages({ messages, prompt }) {
|
|
33
|
+
messages.push({
|
|
34
|
+
role: "user",
|
|
35
|
+
content: String(prompt || ""),
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
runTurn,
|
|
39
|
+
getToolCalls(turnResult) {
|
|
40
|
+
return Array.isArray(turnResult.toolCalls) ? turnResult.toolCalls : [];
|
|
41
|
+
},
|
|
42
|
+
appendFinalAssistantMessage({ messages, turnResult }) {
|
|
43
|
+
const assistantContent = Array.isArray(turnResult.assistantContent)
|
|
44
|
+
? turnResult.assistantContent
|
|
45
|
+
: [];
|
|
46
|
+
if (assistantContent.length > 0) {
|
|
47
|
+
messages.push({
|
|
48
|
+
role: "assistant",
|
|
49
|
+
content: assistantContent,
|
|
50
|
+
});
|
|
51
|
+
} else if (String(turnResult.text || "").trim()) {
|
|
52
|
+
messages.push({
|
|
53
|
+
role: "assistant",
|
|
54
|
+
content: [
|
|
55
|
+
{
|
|
56
|
+
type: "text",
|
|
57
|
+
text: String(turnResult.text || ""),
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
prepareToolCalls({ messages, turnResult, toolCalls }) {
|
|
64
|
+
const assistantContent = Array.isArray(turnResult.assistantContent)
|
|
65
|
+
? turnResult.assistantContent
|
|
66
|
+
: [];
|
|
67
|
+
|
|
68
|
+
messages.push({
|
|
69
|
+
role: "assistant",
|
|
70
|
+
content: assistantContent,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return toolCalls.map((call) => ({
|
|
74
|
+
name: call.name,
|
|
75
|
+
args: call.args,
|
|
76
|
+
source: call,
|
|
77
|
+
}));
|
|
78
|
+
},
|
|
79
|
+
appendToolResult({ collected, call, toolResult }) {
|
|
80
|
+
const vision = extractVisionPayload(toolResult);
|
|
81
|
+
const isError = Boolean(!toolResult || toolResult.ok === false);
|
|
82
|
+
if (vision) {
|
|
83
|
+
const textPayload = stripVisionBase64(toolResult);
|
|
84
|
+
collected.push({
|
|
85
|
+
type: "tool_result",
|
|
86
|
+
tool_use_id: String(call.source.id || ""),
|
|
87
|
+
content: [
|
|
88
|
+
{
|
|
89
|
+
type: "text",
|
|
90
|
+
text: clipText(
|
|
91
|
+
`${visionSummaryText(vision, toolResult)}\n${toJsonString(textPayload)}`,
|
|
92
|
+
12000,
|
|
93
|
+
),
|
|
94
|
+
},
|
|
95
|
+
toAnthropicImageBlock(vision),
|
|
96
|
+
],
|
|
97
|
+
is_error: isError,
|
|
98
|
+
});
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
collected.push({
|
|
102
|
+
type: "tool_result",
|
|
103
|
+
tool_use_id: String(call.source.id || ""),
|
|
104
|
+
content: clipText(toJsonString(toolResult), 12000),
|
|
105
|
+
is_error: isError,
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
flushToolResults({ messages, collected }) {
|
|
109
|
+
messages.push({
|
|
110
|
+
role: "user",
|
|
111
|
+
content: collected,
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
return assertTransport(transport, "anthropic-messages");
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
module.exports = {
|
|
120
|
+
createAnthropicMessagesTransport,
|
|
121
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
...require("./transportContract"),
|
|
5
|
+
...require("./openaiChatTransport"),
|
|
6
|
+
...require("./openaiResponsesTransport"),
|
|
7
|
+
...require("./anthropicMessagesTransport"),
|
|
8
|
+
...require("./responsesProtocol"),
|
|
9
|
+
...require("./visionBlocks"),
|
|
10
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { randomUUID } = require("crypto");
|
|
4
|
+
const { assertTransport } = require("./transportContract");
|
|
5
|
+
const {
|
|
6
|
+
extractVisionPayload,
|
|
7
|
+
stripVisionBase64,
|
|
8
|
+
visionSummaryText,
|
|
9
|
+
toOpenAiImagePart,
|
|
10
|
+
} = require("./visionBlocks");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* OpenAI-compatible chat-completions transport adapter.
|
|
14
|
+
* @param {{
|
|
15
|
+
* resolveUrl: Function,
|
|
16
|
+
* runTurn: Function,
|
|
17
|
+
* normalizeToolName: Function,
|
|
18
|
+
* normalizeToolCallArgs: Function,
|
|
19
|
+
* toJsonString: Function,
|
|
20
|
+
* clipText: Function,
|
|
21
|
+
* }} deps
|
|
22
|
+
*/
|
|
23
|
+
function createOpenAiChatTransport(deps = {}) {
|
|
24
|
+
const {
|
|
25
|
+
resolveUrl,
|
|
26
|
+
runTurn,
|
|
27
|
+
normalizeToolName,
|
|
28
|
+
normalizeToolCallArgs,
|
|
29
|
+
toJsonString,
|
|
30
|
+
clipText,
|
|
31
|
+
} = deps;
|
|
32
|
+
|
|
33
|
+
const transport = {
|
|
34
|
+
name: "openai-chat",
|
|
35
|
+
features: Object.freeze(["tool_calls", "streaming", "vision", "deferred_tools"]),
|
|
36
|
+
resolveUrl,
|
|
37
|
+
prepareMessages({ messages, systemPrompt, prompt }) {
|
|
38
|
+
const systemText = String(systemPrompt || "").trim();
|
|
39
|
+
const hasSystem = messages.some((entry) => String(entry.role || "").trim() === "system");
|
|
40
|
+
if (systemText && !hasSystem) {
|
|
41
|
+
messages.unshift({ role: "system", content: systemText });
|
|
42
|
+
}
|
|
43
|
+
messages.push({ role: "user", content: String(prompt || "") });
|
|
44
|
+
},
|
|
45
|
+
runTurn,
|
|
46
|
+
getToolCalls(turnResult) {
|
|
47
|
+
return Array.isArray(turnResult.toolCalls)
|
|
48
|
+
? turnResult.toolCalls.filter((call) => call && call.function && typeof call.function === "object")
|
|
49
|
+
: [];
|
|
50
|
+
},
|
|
51
|
+
appendFinalAssistantMessage({ messages, turnResult }) {
|
|
52
|
+
const text = String(turnResult.text || "").trim();
|
|
53
|
+
if (text) {
|
|
54
|
+
messages.push({
|
|
55
|
+
role: "assistant",
|
|
56
|
+
content: text,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
prepareToolCalls({ messages, toolCalls }) {
|
|
61
|
+
const assistantToolCalls = [];
|
|
62
|
+
for (const call of toolCalls) {
|
|
63
|
+
const callId = String(call.id || `call_${randomUUID()}`);
|
|
64
|
+
const name = normalizeToolName(call.function.name || "");
|
|
65
|
+
const args = normalizeToolCallArgs(call.function.arguments || "");
|
|
66
|
+
|
|
67
|
+
assistantToolCalls.push({
|
|
68
|
+
id: callId,
|
|
69
|
+
type: "function",
|
|
70
|
+
function: {
|
|
71
|
+
name: name || String(call.function.name || ""),
|
|
72
|
+
arguments: toJsonString(args),
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (assistantToolCalls.length === 0) return null;
|
|
78
|
+
|
|
79
|
+
messages.push({
|
|
80
|
+
role: "assistant",
|
|
81
|
+
content: null,
|
|
82
|
+
tool_calls: assistantToolCalls,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
return assistantToolCalls.map((toolCall) => ({
|
|
86
|
+
name: toolCall.function.name,
|
|
87
|
+
args: normalizeToolCallArgs(toolCall.function.arguments),
|
|
88
|
+
source: toolCall,
|
|
89
|
+
}));
|
|
90
|
+
},
|
|
91
|
+
appendToolResult({ messages, call, toolResult }) {
|
|
92
|
+
const vision = extractVisionPayload(toolResult);
|
|
93
|
+
const payload = vision ? stripVisionBase64(toolResult) : toolResult;
|
|
94
|
+
messages.push({
|
|
95
|
+
role: "tool",
|
|
96
|
+
tool_call_id: call.source.id,
|
|
97
|
+
content: clipText(toJsonString(payload), 12000),
|
|
98
|
+
});
|
|
99
|
+
if (vision) {
|
|
100
|
+
const imagePart = toOpenAiImagePart(vision);
|
|
101
|
+
messages.push({
|
|
102
|
+
role: "user",
|
|
103
|
+
content: [
|
|
104
|
+
{ type: "text", text: visionSummaryText(vision, toolResult) },
|
|
105
|
+
imagePart,
|
|
106
|
+
],
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
return assertTransport(transport, "openai-chat");
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
module.exports = {
|
|
116
|
+
createOpenAiChatTransport,
|
|
117
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { randomUUID } = require("crypto");
|
|
4
|
+
const { assertTransport } = require("./transportContract");
|
|
5
|
+
const {
|
|
6
|
+
extractVisionPayload,
|
|
7
|
+
stripVisionBase64,
|
|
8
|
+
visionSummaryText,
|
|
9
|
+
toOpenAiImagePart,
|
|
10
|
+
} = require("./visionBlocks");
|
|
11
|
+
const { attachResponsesReasoningItems } = require("./responsesProtocol");
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* OpenAI Responses transport adapter.
|
|
15
|
+
*
|
|
16
|
+
* The loop keeps the public, provider-neutral message projection in the same
|
|
17
|
+
* shape as the Chat transport. The Responses wire conversion is owned by the
|
|
18
|
+
* request builder, so response-only metadata never gets persisted into the
|
|
19
|
+
* Session Journal.
|
|
20
|
+
*/
|
|
21
|
+
function createOpenAiResponsesTransport(deps = {}) {
|
|
22
|
+
const {
|
|
23
|
+
resolveUrl,
|
|
24
|
+
runTurn,
|
|
25
|
+
normalizeToolName,
|
|
26
|
+
normalizeToolCallArgs,
|
|
27
|
+
toJsonString,
|
|
28
|
+
clipText,
|
|
29
|
+
} = deps;
|
|
30
|
+
|
|
31
|
+
const transport = {
|
|
32
|
+
name: "openai-responses",
|
|
33
|
+
features: Object.freeze(["tool_calls", "streaming", "vision", "deferred_tools"]),
|
|
34
|
+
resolveUrl,
|
|
35
|
+
prepareMessages({ messages, prompt }) {
|
|
36
|
+
messages.push({
|
|
37
|
+
role: "user",
|
|
38
|
+
content: String(prompt || ""),
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
runTurn,
|
|
42
|
+
getToolCalls(turnResult) {
|
|
43
|
+
return Array.isArray(turnResult.toolCalls)
|
|
44
|
+
? turnResult.toolCalls.filter((call) => call && call.function && typeof call.function === "object")
|
|
45
|
+
: [];
|
|
46
|
+
},
|
|
47
|
+
appendFinalAssistantMessage({ messages, turnResult }) {
|
|
48
|
+
const text = String(turnResult.text || "").trim();
|
|
49
|
+
if (text) {
|
|
50
|
+
messages.push({
|
|
51
|
+
role: "assistant",
|
|
52
|
+
content: text,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
prepareToolCalls({ messages, turnResult, toolCalls }) {
|
|
57
|
+
const assistantToolCalls = [];
|
|
58
|
+
for (const call of toolCalls) {
|
|
59
|
+
const source = call && call.function && typeof call.function === "object"
|
|
60
|
+
? call.function
|
|
61
|
+
: {};
|
|
62
|
+
const callId = String(call.id || `call_${randomUUID()}`);
|
|
63
|
+
const name = normalizeToolName(source.name || "");
|
|
64
|
+
const args = normalizeToolCallArgs(source.arguments || "");
|
|
65
|
+
assistantToolCalls.push({
|
|
66
|
+
id: callId,
|
|
67
|
+
type: "function",
|
|
68
|
+
function: {
|
|
69
|
+
name: name || String(source.name || ""),
|
|
70
|
+
arguments: toJsonString(args),
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (assistantToolCalls.length === 0) return null;
|
|
76
|
+
const assistantMessage = {
|
|
77
|
+
role: "assistant",
|
|
78
|
+
content: null,
|
|
79
|
+
tool_calls: assistantToolCalls,
|
|
80
|
+
};
|
|
81
|
+
attachResponsesReasoningItems(
|
|
82
|
+
assistantMessage,
|
|
83
|
+
turnResult && Array.isArray(turnResult.outputItems)
|
|
84
|
+
? { output: turnResult.outputItems }
|
|
85
|
+
: (turnResult && turnResult.response),
|
|
86
|
+
);
|
|
87
|
+
messages.push(assistantMessage);
|
|
88
|
+
|
|
89
|
+
return assistantToolCalls.map((toolCall) => ({
|
|
90
|
+
name: toolCall.function.name,
|
|
91
|
+
args: normalizeToolCallArgs(toolCall.function.arguments),
|
|
92
|
+
source: toolCall,
|
|
93
|
+
}));
|
|
94
|
+
},
|
|
95
|
+
appendToolResult({ messages, call, toolResult }) {
|
|
96
|
+
const vision = extractVisionPayload(toolResult);
|
|
97
|
+
const payload = vision ? stripVisionBase64(toolResult) : toolResult;
|
|
98
|
+
messages.push({
|
|
99
|
+
role: "tool",
|
|
100
|
+
tool_call_id: call.source.id,
|
|
101
|
+
content: clipText(toJsonString(payload), 12000),
|
|
102
|
+
});
|
|
103
|
+
if (vision) {
|
|
104
|
+
messages.push({
|
|
105
|
+
role: "user",
|
|
106
|
+
content: [
|
|
107
|
+
{ type: "text", text: visionSummaryText(vision, toolResult) },
|
|
108
|
+
toOpenAiImagePart(vision),
|
|
109
|
+
],
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
return assertTransport(transport, "openai-responses");
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
module.exports = {
|
|
119
|
+
createOpenAiResponsesTransport,
|
|
120
|
+
};
|