@bolt-foundry/gambit 0.8.6 → 1.0.0-rc.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.
- package/CHANGELOG.md +25 -2
- package/README.md +22 -10
- package/esm/mod.d.ts +11 -3
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +7 -1
- package/esm/src/codex_app_server_debug.d.ts +3 -2
- package/esm/src/codex_app_server_debug.d.ts.map +1 -1
- package/esm/src/codex_app_server_debug.js +5 -3
- package/esm/src/codex_auth.d.ts +2 -1
- package/esm/src/codex_auth.d.ts.map +1 -1
- package/esm/src/codex_auth.js +4 -2
- package/esm/src/default_runtime.d.ts +5 -1
- package/esm/src/default_runtime.d.ts.map +1 -1
- package/esm/src/default_runtime.js +48 -29
- package/esm/src/openai_compat.d.ts.map +1 -1
- package/esm/src/openai_compat.js +111 -11
- package/esm/src/providers/claude_code.d.ts.map +1 -1
- package/esm/src/providers/claude_code.js +3 -3
- package/esm/src/providers/codex.d.ts +2 -1
- package/esm/src/providers/codex.d.ts.map +1 -1
- package/esm/src/providers/codex.js +50 -22
- package/esm/src/providers/google.d.ts.map +1 -1
- package/esm/src/providers/google.js +7 -114
- package/esm/src/providers/manifest.d.ts +2 -2
- package/esm/src/providers/manifest.d.ts.map +1 -1
- package/esm/src/providers/manifest.js +5 -5
- package/esm/src/providers/ollama.d.ts.map +1 -1
- package/esm/src/providers/ollama.js +0 -112
- package/esm/src/providers/openrouter.d.ts.map +1 -1
- package/esm/src/providers/openrouter.js +0 -264
- package/esm/src/providers/requirements.js +1 -1
- package/package.json +1 -1
- package/script/mod.d.ts +11 -3
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +15 -6
- package/script/src/codex_app_server_debug.d.ts +3 -2
- package/script/src/codex_app_server_debug.d.ts.map +1 -1
- package/script/src/codex_app_server_debug.js +6 -3
- package/script/src/codex_auth.d.ts +2 -1
- package/script/src/codex_auth.d.ts.map +1 -1
- package/script/src/codex_auth.js +5 -3
- package/script/src/default_runtime.d.ts +5 -1
- package/script/src/default_runtime.d.ts.map +1 -1
- package/script/src/default_runtime.js +48 -28
- package/script/src/openai_compat.d.ts.map +1 -1
- package/script/src/openai_compat.js +110 -10
- package/script/src/providers/claude_code.d.ts.map +1 -1
- package/script/src/providers/claude_code.js +3 -3
- package/script/src/providers/codex.d.ts +2 -1
- package/script/src/providers/codex.d.ts.map +1 -1
- package/script/src/providers/codex.js +49 -21
- package/script/src/providers/google.d.ts.map +1 -1
- package/script/src/providers/google.js +7 -114
- package/script/src/providers/manifest.d.ts +2 -2
- package/script/src/providers/manifest.d.ts.map +1 -1
- package/script/src/providers/manifest.js +5 -5
- package/script/src/providers/ollama.d.ts.map +1 -1
- package/script/src/providers/ollama.js +0 -112
- package/script/src/providers/openrouter.d.ts.map +1 -1
- package/script/src/providers/openrouter.js +0 -264
- package/script/src/providers/requirements.js +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
import { joinTextParts } from "@bolt-foundry/gambit-core";
|
|
2
3
|
export const CLAUDE_CODE_PREFIX = "claude-code-cli/";
|
|
3
4
|
export const CLAUDE_CODE_ALIAS = "claude-code-cli";
|
|
4
5
|
const CLAUDE_CODE_BIN_ENV = "GAMBIT_CLAUDE_CODE_BIN";
|
|
@@ -100,7 +101,7 @@ function extractAssistantTextFromClaudeMessage(message) {
|
|
|
100
101
|
parts.push(text);
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
|
-
return parts
|
|
104
|
+
return joinTextParts(parts).trim();
|
|
104
105
|
}
|
|
105
106
|
function extractBestText(input) {
|
|
106
107
|
if (typeof input === "string" && input.trim())
|
|
@@ -428,7 +429,7 @@ function responseItemsToChatMessages(items, instructions) {
|
|
|
428
429
|
}
|
|
429
430
|
for (const item of items) {
|
|
430
431
|
if (item.type === "message") {
|
|
431
|
-
const content = item.content.map((part) => part.text)
|
|
432
|
+
const content = joinTextParts(item.content.map((part) => part.text));
|
|
432
433
|
messages.push({ role: item.role, content });
|
|
433
434
|
continue;
|
|
434
435
|
}
|
|
@@ -660,7 +661,6 @@ export function createClaudeCodeProvider(opts) {
|
|
|
660
661
|
}
|
|
661
662
|
return response;
|
|
662
663
|
},
|
|
663
|
-
chat: runChat,
|
|
664
664
|
};
|
|
665
665
|
}
|
|
666
666
|
export function parseClaudeCodeArgsForTest(input) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { JSONValue, ModelMessage, ModelProvider, ResponseItem, SavedState } from "@bolt-foundry/gambit-core";
|
|
1
|
+
import type { JSONValue, ModelMessage, ModelProvider, ResponseItem, SavedState, ToolDefinition } from "@bolt-foundry/gambit-core";
|
|
2
2
|
import type { CodexChatgptAuthTokens } from "../codex_auth.js";
|
|
3
3
|
export declare const CODEX_PREFIX = "codex-cli/";
|
|
4
4
|
type CodexAssistantMessage = {
|
|
@@ -8,6 +8,7 @@ type CodexAssistantMessage = {
|
|
|
8
8
|
type AppServerTurnRunnerInput = {
|
|
9
9
|
model: string;
|
|
10
10
|
messages: Array<ModelMessage>;
|
|
11
|
+
tools?: Array<ToolDefinition>;
|
|
11
12
|
state?: SavedState;
|
|
12
13
|
params?: Record<string, unknown>;
|
|
13
14
|
deckPath?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/src/providers/codex.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,SAAS,EACT,YAAY,EACZ,aAAa,EAGb,YAAY,
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/src/providers/codex.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,SAAS,EACT,YAAY,EACZ,aAAa,EAGb,YAAY,EAGZ,UAAU,EACV,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAI/D,e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AC7C,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EACnB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,GACd,KAAK,CAAC,MAAM,CAAC,CAEf"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as dntShim from "../../_dnt.shims.js";
|
|
2
2
|
import * as path from "../../deps/jsr.io/@std/path/1.1.4/mod.js";
|
|
3
|
-
import { loadDeck } from "@bolt-foundry/gambit-core";
|
|
3
|
+
import { joinTextParts, loadDeck } from "@bolt-foundry/gambit-core";
|
|
4
4
|
import { logCodexAppServerDebug } from "../codex_app_server_debug.js";
|
|
5
5
|
import { ensureTempMcpDenoConfigSync } from "../mcp_deno_config.js";
|
|
6
6
|
export const CODEX_PREFIX = "codex-cli/";
|
|
@@ -19,7 +19,8 @@ const MCP_ROOT_DECK_PATH_ENV = "GAMBIT_MCP_ROOT_DECK_PATH";
|
|
|
19
19
|
const EXTERNAL_TOOL_BRIDGE_ENV = "GAMBIT_EXTERNAL_TOOL_BRIDGE";
|
|
20
20
|
const MCP_DEBUG_LOG_PATH_ENV = "GAMBIT_MCP_DEBUG_LOG_PATH";
|
|
21
21
|
const DENO_DIR_ENV = "DENO_DIR";
|
|
22
|
-
const DEBUG_MCP_ENV = "
|
|
22
|
+
const DEBUG_MCP_ENV = "WORKLOOP_CHIEF_RUNTIME_DEBUG_MCP";
|
|
23
|
+
const LEGACY_DEBUG_MCP_ENV = "BOLT_FOUNDRY_DESKTOP_CHIEF_RUNTIME_DEBUG_MCP";
|
|
23
24
|
const MCP_SERVER_PATH = (() => {
|
|
24
25
|
try {
|
|
25
26
|
const moduleUrl = new URL(globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).url);
|
|
@@ -110,8 +111,21 @@ function shouldEnableMcpBridge() {
|
|
|
110
111
|
return normalized === "1" || normalized === "true" || normalized === "yes";
|
|
111
112
|
}
|
|
112
113
|
function shouldDebugMcpBridge() {
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
return [DEBUG_MCP_ENV, LEGACY_DEBUG_MCP_ENV].some((envName) => {
|
|
115
|
+
const raw = dntShim.Deno.env.get(envName)?.trim().toLowerCase();
|
|
116
|
+
return raw === "1" || raw === "true" || raw === "yes";
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function isCodexNativeOrGambitBuiltinTool(name) {
|
|
120
|
+
return new Set([
|
|
121
|
+
"apply_patch",
|
|
122
|
+
"exec",
|
|
123
|
+
"gambit_consume_async_action",
|
|
124
|
+
"gambit_emit_output_item",
|
|
125
|
+
"grep_files",
|
|
126
|
+
"list_dir",
|
|
127
|
+
"read_file",
|
|
128
|
+
]).has(name);
|
|
115
129
|
}
|
|
116
130
|
function logCodexMcpDebug(event, details) {
|
|
117
131
|
if (!shouldDebugMcpBridge())
|
|
@@ -352,7 +366,15 @@ async function prepareCodexMcpRootDeck(input) {
|
|
|
352
366
|
return {};
|
|
353
367
|
}
|
|
354
368
|
const deck = await loadDeck(rootDeckPath);
|
|
355
|
-
|
|
369
|
+
const deckActionNames = new Set(deck.actionDecks.map((action) => action.name));
|
|
370
|
+
const deckToolNames = new Set(deck.tools.map((tool) => tool.name));
|
|
371
|
+
const extraExternalTools = (input.tools ?? [])
|
|
372
|
+
.map((tool) => tool.function)
|
|
373
|
+
.filter((tool) => tool &&
|
|
374
|
+
!isCodexNativeOrGambitBuiltinTool(tool.name) &&
|
|
375
|
+
!deckActionNames.has(tool.name) &&
|
|
376
|
+
!deckToolNames.has(tool.name));
|
|
377
|
+
if (deck.actionDecks.length === 0 && extraExternalTools.length === 0) {
|
|
356
378
|
logCodexMcpDebug("prepareRootDeck:reuseOriginal", {
|
|
357
379
|
actionCount: 0,
|
|
358
380
|
deckPath: rootDeckPath,
|
|
@@ -386,15 +408,28 @@ async function prepareCodexMcpRootDeck(input) {
|
|
|
386
408
|
}
|
|
387
409
|
frontmatter.push("");
|
|
388
410
|
}
|
|
411
|
+
for (const externalTool of extraExternalTools) {
|
|
412
|
+
frontmatter.push("[[tools]]");
|
|
413
|
+
frontmatter.push(`name = ${tomlString(externalTool.name)}`);
|
|
414
|
+
if (typeof externalTool.description === "string" &&
|
|
415
|
+
externalTool.description.trim()) {
|
|
416
|
+
frontmatter.push(`description = ${tomlString(externalTool.description.trim())}`);
|
|
417
|
+
}
|
|
418
|
+
frontmatter.push("");
|
|
419
|
+
}
|
|
389
420
|
frontmatter.push("+++", "", "Codex MCP tool surface.");
|
|
390
421
|
await dntShim.Deno.writeTextFile(tempDeckPath, frontmatter.join("\n"));
|
|
391
422
|
logCodexMcpDebug("prepareRootDeck:synthesized", {
|
|
392
423
|
actionCount: deck.actionDecks.length,
|
|
393
424
|
actionNames: deck.actionDecks.map((action) => action.name),
|
|
425
|
+
extraToolNames: extraExternalTools.map((tool) => tool.name),
|
|
394
426
|
rootDeckPath,
|
|
395
427
|
synthesizedDeckPath: tempDeckPath,
|
|
396
|
-
toolCount: deck.tools.length,
|
|
397
|
-
toolNames:
|
|
428
|
+
toolCount: deck.tools.length + extraExternalTools.length,
|
|
429
|
+
toolNames: [
|
|
430
|
+
...deck.tools.map((tool) => tool.name),
|
|
431
|
+
...extraExternalTools.map((tool) => tool.name),
|
|
432
|
+
],
|
|
398
433
|
});
|
|
399
434
|
return {
|
|
400
435
|
deckPath: tempDeckPath,
|
|
@@ -1350,7 +1385,7 @@ function extractTextParts(value) {
|
|
|
1350
1385
|
function extractCodexItemText(record) {
|
|
1351
1386
|
return typeof record.text === "string"
|
|
1352
1387
|
? record.text
|
|
1353
|
-
: extractTextParts(record.content)
|
|
1388
|
+
: joinTextParts(extractTextParts(record.content));
|
|
1354
1389
|
}
|
|
1355
1390
|
function requireCodexAssistantItemId(input) {
|
|
1356
1391
|
const itemId = typeof input.record.id === "string"
|
|
@@ -1459,7 +1494,7 @@ function emitCodexReasoningEvents(input) {
|
|
|
1459
1494
|
if (payloadType === "item.delta") {
|
|
1460
1495
|
const deltaText = typeof record.text === "string"
|
|
1461
1496
|
? record.text
|
|
1462
|
-
: extractTextParts(record.content)
|
|
1497
|
+
: joinTextParts(extractTextParts(record.content));
|
|
1463
1498
|
if (deltaText) {
|
|
1464
1499
|
input.emit({
|
|
1465
1500
|
type: "response.reasoning.delta",
|
|
@@ -1473,7 +1508,7 @@ function emitCodexReasoningEvents(input) {
|
|
|
1473
1508
|
if (payloadType === "item.completed" || payloadType === "item.done") {
|
|
1474
1509
|
const doneText = typeof record.text === "string"
|
|
1475
1510
|
? record.text
|
|
1476
|
-
: extractTextParts(record.content)
|
|
1511
|
+
: joinTextParts(extractTextParts(record.content));
|
|
1477
1512
|
input.emit({
|
|
1478
1513
|
type: "response.reasoning.done",
|
|
1479
1514
|
output_index: outputIndex,
|
|
@@ -1567,7 +1602,7 @@ function responseItemsToChatMessages(items, instructions) {
|
|
|
1567
1602
|
}
|
|
1568
1603
|
for (const item of items) {
|
|
1569
1604
|
if (item.type === "message") {
|
|
1570
|
-
const content = item.content.map((part) => part.text)
|
|
1605
|
+
const content = joinTextParts(item.content.map((part) => part.text));
|
|
1571
1606
|
messages.push({ role: item.role, content });
|
|
1572
1607
|
continue;
|
|
1573
1608
|
}
|
|
@@ -1855,11 +1890,13 @@ export function createCodexProvider(opts) {
|
|
|
1855
1890
|
const cwd = codexRunCwd({ deckPath: input.deckPath });
|
|
1856
1891
|
const preparedMcpRoot = await prepareCodexMcpRootDeck({
|
|
1857
1892
|
deckPath: input.deckPath,
|
|
1893
|
+
tools: input.tools,
|
|
1858
1894
|
});
|
|
1859
1895
|
try {
|
|
1860
1896
|
const result = await runAppServerTurn({
|
|
1861
1897
|
model: input.model,
|
|
1862
1898
|
messages: input.messages,
|
|
1899
|
+
tools: input.tools,
|
|
1863
1900
|
state: input.state,
|
|
1864
1901
|
params: input.params,
|
|
1865
1902
|
deckPath: preparedMcpRoot.deckPath ?? input.deckPath,
|
|
@@ -1871,7 +1908,7 @@ export function createCodexProvider(opts) {
|
|
|
1871
1908
|
cwd,
|
|
1872
1909
|
priorThreadId,
|
|
1873
1910
|
});
|
|
1874
|
-
const assistantText = result.assistantMessages.map((message) => message.text)
|
|
1911
|
+
const assistantText = joinTextParts(result.assistantMessages.map((message) => message.text));
|
|
1875
1912
|
if (input.stream && input.onStreamText && assistantText &&
|
|
1876
1913
|
!assistantState.sawAssistantTextStream) {
|
|
1877
1914
|
input.onStreamText(assistantText);
|
|
@@ -1896,15 +1933,6 @@ export function createCodexProvider(opts) {
|
|
|
1896
1933
|
await preparedMcpRoot.cleanup?.();
|
|
1897
1934
|
}
|
|
1898
1935
|
};
|
|
1899
|
-
const runChat = async (input) => {
|
|
1900
|
-
const result = await runCodexTurn(input);
|
|
1901
|
-
return {
|
|
1902
|
-
message: result.message,
|
|
1903
|
-
finishReason: result.finishReason,
|
|
1904
|
-
updatedState: result.updatedState,
|
|
1905
|
-
usage: result.usage,
|
|
1906
|
-
};
|
|
1907
|
-
};
|
|
1908
1936
|
return {
|
|
1909
1937
|
async responses(input) {
|
|
1910
1938
|
const streamHandler = input.onStreamEvent
|
|
@@ -1937,6 +1965,7 @@ export function createCodexProvider(opts) {
|
|
|
1937
1965
|
const result = await runCodexTurn({
|
|
1938
1966
|
model: input.request.model,
|
|
1939
1967
|
messages: responseItemsToChatMessages(input.request.input, input.request.instructions),
|
|
1968
|
+
tools: input.request.tools,
|
|
1940
1969
|
stream: input.request.stream,
|
|
1941
1970
|
params: input.request.params,
|
|
1942
1971
|
state: input.state,
|
|
@@ -2052,7 +2081,6 @@ export function createCodexProvider(opts) {
|
|
|
2052
2081
|
}
|
|
2053
2082
|
return response;
|
|
2054
2083
|
},
|
|
2055
|
-
chat: runChat,
|
|
2056
2084
|
};
|
|
2057
2085
|
}
|
|
2058
2086
|
export function normalizeCodexModelForTest(model) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/src/providers/google.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,aAAa,EAId,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/src/providers/google.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,aAAa,EAId,MAAM,2BAA2B,CAAC;AAGnC,eAAO,MAAM,aAAa,YAAY,CAAC;AAIvC,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE;QACJ,WAAW,EAAE;YACX,MAAM,EAAE,CACN,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE;gBAAE,MAAM,CAAC,EAAE,WAAW,CAAA;aAAE,KAC/B,OAAO,CAAC,OAAO,CAAC,CAAC;SACvB,CAAC;KACH,CAAC;CACH,CAAC;AA8IF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,GAAG,aAAa,CA+OhB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import OpenAI from "openai";
|
|
2
|
+
import { joinTextParts } from "@bolt-foundry/gambit-core";
|
|
2
3
|
export const GOOGLE_PREFIX = "google/";
|
|
3
4
|
const DEFAULT_GOOGLE_BASE_URL = "https://generativelanguage.googleapis.com/v1beta/openai/";
|
|
4
5
|
function safeJson(input) {
|
|
@@ -17,9 +18,9 @@ function extractContent(content) {
|
|
|
17
18
|
if (typeof content === "string")
|
|
18
19
|
return content;
|
|
19
20
|
if (Array.isArray(content)) {
|
|
20
|
-
return content
|
|
21
|
+
return joinTextParts(content
|
|
21
22
|
.map((part) => (typeof part === "string" ? part : part.text ?? ""))
|
|
22
|
-
.
|
|
23
|
+
.filter(Boolean));
|
|
23
24
|
}
|
|
24
25
|
return "";
|
|
25
26
|
}
|
|
@@ -53,9 +54,7 @@ function responseItemsToChatMessages(items, instructions) {
|
|
|
53
54
|
}
|
|
54
55
|
for (const item of items) {
|
|
55
56
|
if (item.type === "message") {
|
|
56
|
-
const content = item.content
|
|
57
|
-
.map((part) => part.text)
|
|
58
|
-
.join("");
|
|
57
|
+
const content = joinTextParts(item.content.map((part) => part.text));
|
|
59
58
|
messages.push({ role: item.role, content });
|
|
60
59
|
continue;
|
|
61
60
|
}
|
|
@@ -198,9 +197,9 @@ export function createGoogleProvider(opts) {
|
|
|
198
197
|
});
|
|
199
198
|
}
|
|
200
199
|
else if (Array.isArray(delta.content)) {
|
|
201
|
-
const text = delta.content
|
|
200
|
+
const text = joinTextParts(delta.content
|
|
202
201
|
.map((part) => (typeof part === "string" ? part : part.text ?? ""))
|
|
203
|
-
.
|
|
202
|
+
.filter(Boolean));
|
|
204
203
|
if (text) {
|
|
205
204
|
contentParts.push(text);
|
|
206
205
|
input.onStreamEvent?.({
|
|
@@ -238,7 +237,7 @@ export function createGoogleProvider(opts) {
|
|
|
238
237
|
}));
|
|
239
238
|
const message = normalizeMessage({
|
|
240
239
|
role: "assistant",
|
|
241
|
-
content: contentParts.length ? contentParts
|
|
240
|
+
content: contentParts.length ? joinTextParts(contentParts) : null,
|
|
242
241
|
tool_calls,
|
|
243
242
|
});
|
|
244
243
|
const toolCalls = tool_calls.length > 0
|
|
@@ -321,111 +320,5 @@ export function createGoogleProvider(opts) {
|
|
|
321
320
|
usage: mapChatUsage(response.usage),
|
|
322
321
|
};
|
|
323
322
|
},
|
|
324
|
-
async chat(input) {
|
|
325
|
-
const params = input.params ?? {};
|
|
326
|
-
if (input.stream) {
|
|
327
|
-
const stream = await client.chat.completions.create({
|
|
328
|
-
model: input.model,
|
|
329
|
-
messages: input.messages,
|
|
330
|
-
tools: input
|
|
331
|
-
// this predates the lint rule
|
|
332
|
-
.tools,
|
|
333
|
-
tool_choice: "auto",
|
|
334
|
-
stream: true,
|
|
335
|
-
...params,
|
|
336
|
-
}, input.signal ? { signal: input.signal } : undefined);
|
|
337
|
-
let finishReason = null;
|
|
338
|
-
const contentParts = [];
|
|
339
|
-
const toolCallMap = new Map();
|
|
340
|
-
for await (const chunk of stream) {
|
|
341
|
-
const choice = chunk.choices[0];
|
|
342
|
-
const fr = choice.finish_reason;
|
|
343
|
-
if (fr === "stop" || fr === "tool_calls" || fr === "length" ||
|
|
344
|
-
fr === null) {
|
|
345
|
-
finishReason = fr ?? finishReason;
|
|
346
|
-
}
|
|
347
|
-
const delta = choice.delta;
|
|
348
|
-
if (typeof delta.content === "string") {
|
|
349
|
-
contentParts.push(delta.content);
|
|
350
|
-
input.onStreamText?.(delta.content);
|
|
351
|
-
}
|
|
352
|
-
else if (Array.isArray(delta.content)) {
|
|
353
|
-
const chunkStr = delta.content
|
|
354
|
-
.map((c) => (typeof c === "string" ? c : c.text ?? ""))
|
|
355
|
-
.join("");
|
|
356
|
-
if (chunkStr) {
|
|
357
|
-
contentParts.push(chunkStr);
|
|
358
|
-
input.onStreamText?.(chunkStr);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
for (const tc of delta.tool_calls ?? []) {
|
|
362
|
-
const idx = tc.index ?? 0;
|
|
363
|
-
const existing = toolCallMap.get(idx) ??
|
|
364
|
-
{
|
|
365
|
-
id: tc.id,
|
|
366
|
-
function: { name: tc.function?.name, arguments: "" },
|
|
367
|
-
};
|
|
368
|
-
if (tc.id)
|
|
369
|
-
existing.id = tc.id;
|
|
370
|
-
if (tc.function?.name)
|
|
371
|
-
existing.function.name = tc.function.name;
|
|
372
|
-
if (tc.function?.arguments) {
|
|
373
|
-
existing.function.arguments += tc.function.arguments;
|
|
374
|
-
}
|
|
375
|
-
toolCallMap.set(idx, existing);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
const tool_calls = Array.from(toolCallMap.values()).map((tc) => ({
|
|
379
|
-
id: tc.id ?? crypto.randomUUID().replace(/-/g, "").slice(0, 24),
|
|
380
|
-
type: "function",
|
|
381
|
-
function: {
|
|
382
|
-
name: tc.function.name ?? "",
|
|
383
|
-
arguments: tc.function.arguments,
|
|
384
|
-
},
|
|
385
|
-
}));
|
|
386
|
-
const message = normalizeMessage({
|
|
387
|
-
role: "assistant",
|
|
388
|
-
content: contentParts.length ? contentParts.join("") : null,
|
|
389
|
-
tool_calls,
|
|
390
|
-
});
|
|
391
|
-
const toolCalls = tool_calls.length > 0
|
|
392
|
-
? tool_calls.map((tc) => ({
|
|
393
|
-
id: tc.id,
|
|
394
|
-
name: tc.function.name,
|
|
395
|
-
args: safeJson(tc.function.arguments),
|
|
396
|
-
}))
|
|
397
|
-
: undefined;
|
|
398
|
-
return {
|
|
399
|
-
message,
|
|
400
|
-
finishReason: finishReason ?? "stop",
|
|
401
|
-
toolCalls,
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
const response = await client.chat.completions.create({
|
|
405
|
-
model: input.model,
|
|
406
|
-
messages: input
|
|
407
|
-
// this predates the lint rule
|
|
408
|
-
.messages,
|
|
409
|
-
tools: input
|
|
410
|
-
// this predates the lint rule
|
|
411
|
-
.tools,
|
|
412
|
-
tool_choice: "auto",
|
|
413
|
-
stream: false,
|
|
414
|
-
...params,
|
|
415
|
-
}, input.signal ? { signal: input.signal } : undefined);
|
|
416
|
-
const choice = response.choices[0];
|
|
417
|
-
const message = normalizeMessage(choice.message);
|
|
418
|
-
const toolCalls = choice.message.tool_calls?.map((tc) => ({
|
|
419
|
-
id: tc.id,
|
|
420
|
-
name: tc.function.name,
|
|
421
|
-
args: safeJson(tc.function.arguments),
|
|
422
|
-
}));
|
|
423
|
-
return {
|
|
424
|
-
message,
|
|
425
|
-
finishReason: (choice.finish_reason ?? "stop"),
|
|
426
|
-
toolCalls,
|
|
427
|
-
usage: mapChatUsage(response.usage),
|
|
428
|
-
};
|
|
429
|
-
},
|
|
430
323
|
};
|
|
431
324
|
}
|
|
@@ -18,8 +18,8 @@ export type ProviderRuntimeAuthStateSource = {
|
|
|
18
18
|
kind: "json-file";
|
|
19
19
|
path: string;
|
|
20
20
|
};
|
|
21
|
-
export type ProviderStorageAuthority = "
|
|
22
|
-
export type ProviderAttachmentAuthority = "
|
|
21
|
+
export type ProviderStorageAuthority = "workloop";
|
|
22
|
+
export type ProviderAttachmentAuthority = "workloop-mitm" | "runtime-env-placeholder";
|
|
23
23
|
export type ProviderDestinationScope = "declared-destinations";
|
|
24
24
|
type BaseProviderAuthRequirements = {
|
|
25
25
|
attachmentAuthority: ProviderAttachmentAuthority;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/src/providers/manifest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/src/providers/manifest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;AAEF,MAAM,MA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,8BAA8B,CAAC,CAAC;CACrD,CAAC;AAgRF,wBAAgB,oBAAoB,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAE9D;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,WAAW,GACpB,gBAAgB,GAAG,IAAI,CAEzB;AAED,wBAAgB,0BAA0B,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAEzE"}
|
|
@@ -18,8 +18,8 @@ bareAlias = "codex-cli"
|
|
|
18
18
|
|
|
19
19
|
[auth]
|
|
20
20
|
mode = "chatgpt-auth-tokens"
|
|
21
|
-
storageAuthority = "
|
|
22
|
-
attachmentAuthority = "
|
|
21
|
+
storageAuthority = "workloop"
|
|
22
|
+
attachmentAuthority = "workloop-mitm"
|
|
23
23
|
destinationScope = "declared-destinations"
|
|
24
24
|
|
|
25
25
|
[[destinations]]
|
|
@@ -54,7 +54,7 @@ routingPrefix = "openrouter/"
|
|
|
54
54
|
|
|
55
55
|
[auth]
|
|
56
56
|
mode = "secret"
|
|
57
|
-
storageAuthority = "
|
|
57
|
+
storageAuthority = "workloop"
|
|
58
58
|
attachmentAuthority = "runtime-env-placeholder"
|
|
59
59
|
destinationScope = "declared-destinations"
|
|
60
60
|
|
|
@@ -71,10 +71,10 @@ function isSupportedProviderKey(value) {
|
|
|
71
71
|
value === "codex-cli" || value === "claude-code-cli";
|
|
72
72
|
}
|
|
73
73
|
function isSupportedStorageAuthority(value) {
|
|
74
|
-
return value === "
|
|
74
|
+
return value === "workloop";
|
|
75
75
|
}
|
|
76
76
|
function isSupportedAttachmentAuthority(value) {
|
|
77
|
-
return value === "
|
|
77
|
+
return value === "workloop-mitm" || value === "runtime-env-placeholder";
|
|
78
78
|
}
|
|
79
79
|
function isSupportedDestinationScope(value) {
|
|
80
80
|
return value === "declared-destinations";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../../src/src/providers/ollama.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../../src/src/providers/ollama.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAIV,aAAa,EAOd,MAAM,2BAA2B,CAAC;AAOnC,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,uBAAuB,8BAA8B,CAAC;AAEnE,KAAK,YAAY,GAAG;IAClB,SAAS,EAAE;QACT,MAAM,EAAE,CACN,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE,KAC/B,OAAO,CAAC,OAAO,CAAC,CAAC;KACvB,CAAC;CACH,CAAC;AAeF,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAgBtB;AAED,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,OAAO,CAAC,IAAI,CAAC,CA8Cf;AA+pBD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,GAAG,aAAa,CAiBhB"}
|
|
@@ -69,18 +69,6 @@ export async function ensureOllamaModel(model, baseURL) {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
function safeJson(input) {
|
|
73
|
-
try {
|
|
74
|
-
const parsed = JSON.parse(input);
|
|
75
|
-
if (parsed && typeof parsed === "object") {
|
|
76
|
-
return parsed;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
catch {
|
|
80
|
-
// fall through
|
|
81
|
-
}
|
|
82
|
-
return {};
|
|
83
|
-
}
|
|
84
72
|
function toJsonValue(value) {
|
|
85
73
|
if (value === null || typeof value === "string" || typeof value === "boolean") {
|
|
86
74
|
return value;
|
|
@@ -446,86 +434,6 @@ function toOpenAIInputItems(items) {
|
|
|
446
434
|
}
|
|
447
435
|
return mapped;
|
|
448
436
|
}
|
|
449
|
-
function chatMessagesToResponseItems(messages) {
|
|
450
|
-
const items = [];
|
|
451
|
-
for (const message of messages) {
|
|
452
|
-
if (message.role === "tool") {
|
|
453
|
-
if (message.tool_call_id &&
|
|
454
|
-
typeof message.content === "string") {
|
|
455
|
-
items.push({
|
|
456
|
-
type: "function_call_output",
|
|
457
|
-
call_id: message.tool_call_id,
|
|
458
|
-
output: message.content,
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
continue;
|
|
462
|
-
}
|
|
463
|
-
if (message.role === "system" || message.role === "user" ||
|
|
464
|
-
message.role === "assistant") {
|
|
465
|
-
const content = [];
|
|
466
|
-
if (typeof message.content === "string" && message.content.length > 0) {
|
|
467
|
-
content.push({
|
|
468
|
-
type: message.role === "assistant" ? "output_text" : "input_text",
|
|
469
|
-
text: message.content,
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
if (content.length > 0) {
|
|
473
|
-
items.push({
|
|
474
|
-
type: "message",
|
|
475
|
-
role: message.role,
|
|
476
|
-
content,
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
if (message.role === "assistant" && message.tool_calls) {
|
|
481
|
-
for (const call of message.tool_calls) {
|
|
482
|
-
items.push({
|
|
483
|
-
type: "function_call",
|
|
484
|
-
call_id: call.id,
|
|
485
|
-
name: call.function.name,
|
|
486
|
-
arguments: call.function.arguments,
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
return items;
|
|
492
|
-
}
|
|
493
|
-
function responseItemsToChat(items) {
|
|
494
|
-
const textParts = [];
|
|
495
|
-
const toolCalls = [];
|
|
496
|
-
const messageToolCalls = [];
|
|
497
|
-
for (const item of items) {
|
|
498
|
-
if (item.type === "message" && item.role === "assistant") {
|
|
499
|
-
for (const part of item.content) {
|
|
500
|
-
if (part.type === "output_text") {
|
|
501
|
-
textParts.push(part.text);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
if (item.type === "function_call") {
|
|
506
|
-
toolCalls.push({
|
|
507
|
-
id: item.call_id,
|
|
508
|
-
name: item.name,
|
|
509
|
-
args: safeJson(item.arguments),
|
|
510
|
-
});
|
|
511
|
-
messageToolCalls.push({
|
|
512
|
-
id: item.call_id,
|
|
513
|
-
type: "function",
|
|
514
|
-
function: { name: item.name, arguments: item.arguments },
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
const content = textParts.length > 0 ? textParts.join("") : null;
|
|
519
|
-
const message = {
|
|
520
|
-
role: "assistant",
|
|
521
|
-
content,
|
|
522
|
-
tool_calls: messageToolCalls.length > 0 ? messageToolCalls : undefined,
|
|
523
|
-
};
|
|
524
|
-
return {
|
|
525
|
-
message,
|
|
526
|
-
toolCalls: toolCalls.length > 0 ? toolCalls : undefined,
|
|
527
|
-
};
|
|
528
|
-
}
|
|
529
437
|
async function createResponse(client, request, signal, onStreamEvent) {
|
|
530
438
|
const baseParams = {
|
|
531
439
|
model: request.model,
|
|
@@ -769,25 +677,5 @@ export function createOllamaProvider(opts) {
|
|
|
769
677
|
async responses(input) {
|
|
770
678
|
return await createResponse(client, input.request, input.signal, input.onStreamEvent);
|
|
771
679
|
},
|
|
772
|
-
async chat(input) {
|
|
773
|
-
const response = await createResponse(client, {
|
|
774
|
-
model: input.model,
|
|
775
|
-
input: chatMessagesToResponseItems(input.messages),
|
|
776
|
-
tools: input.tools,
|
|
777
|
-
stream: input.stream,
|
|
778
|
-
params: input.params ?? {},
|
|
779
|
-
}, input.signal, (event) => {
|
|
780
|
-
if (event.type === "response.output_text.delta") {
|
|
781
|
-
input.onStreamText?.(event.delta);
|
|
782
|
-
}
|
|
783
|
-
});
|
|
784
|
-
const mapped = responseItemsToChat(response.output);
|
|
785
|
-
return {
|
|
786
|
-
message: mapped.message,
|
|
787
|
-
finishReason: mapped.toolCalls ? "tool_calls" : "stop",
|
|
788
|
-
toolCalls: mapped.toolCalls,
|
|
789
|
-
usage: response.usage,
|
|
790
|
-
};
|
|
791
|
-
},
|
|
792
680
|
};
|
|
793
681
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openrouter.d.ts","sourceRoot":"","sources":["../../../src/src/providers/openrouter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"openrouter.d.ts","sourceRoot":"","sources":["../../../src/src/providers/openrouter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAIV,aAAa,EAOd,MAAM,2BAA2B,CAAC;AAOnC,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAE/C,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE;QACJ,WAAW,EAAE;YACX,MAAM,EAAE,CACN,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE;gBAAE,MAAM,CAAC,EAAE,WAAW,CAAA;aAAE,KAC/B,OAAO,CAAC,OAAO,CAAC,CAAC;SACvB,CAAC;KACH,CAAC;IACF,SAAS,EAAE;QACT,MAAM,EAAE,CACN,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE,KAC/B,OAAO,CAAC,OAAO,CAAC,CAAC;KACvB,CAAC;CACH,CAAC;AA8rBF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,GAAG,aAAa,CAqBhB"}
|