openfox 2.0.2 → 2.0.4
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/{chat-handler-LJMW4OK3.js → chat-handler-WHE75FCD.js} +9 -9
- package/dist/{chunk-ITWVFGFV.js → chunk-4HBWSC6K.js} +1 -1
- package/dist/{chunk-7ZMMDZU7.js → chunk-A52FXWJX.js} +8 -4
- package/dist/{chunk-7TTEGAO6.js → chunk-DTJJZZOC.js} +2 -2
- package/dist/{chunk-XEK3KII6.js → chunk-FRJQC77Y.js} +2 -29
- package/dist/{chunk-CK6LGE7G.js → chunk-KXJWTSOS.js} +4 -4
- package/dist/{chunk-BVHFMAVN.js → chunk-LVS5YGTX.js} +1 -1
- package/dist/{chunk-32GQUDLN.js → chunk-N374WCXC.js} +53 -27
- package/dist/{chunk-RI6GAMNP.js → chunk-NZCKCJH5.js} +1 -1
- package/dist/{chunk-72GTKFVG.js → chunk-O2MR653P.js} +67 -155
- package/dist/{chunk-MWHH6UZB.js → chunk-RVXAYREQ.js} +6 -6
- package/dist/{chunk-LEDG5WAN.js → chunk-STJJDIXV.js} +4 -4
- package/dist/{chunk-FFEAEPJB.js → chunk-Z4SWOUWC.js} +8 -3
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{compactor-TDNRM3A7.js → compactor-5VQNEYQX.js} +2 -2
- package/dist/{events-ZKWAKWI7.js → events-5SWEG62X.js} +3 -5
- package/dist/{folding-YOCGTZYH.js → folding-NUBDA4HS.js} +2 -2
- package/dist/{orchestrator-LX6FKB6L.js → orchestrator-X2ECL42Y.js} +8 -8
- package/dist/package.json +1 -1
- package/dist/{processor-NMYSEBC7.js → processor-7TYZNS4I.js} +7 -7
- package/dist/{protocol-D59sCy9L.d.ts → protocol-BljtHZrx.d.ts} +4 -2
- package/dist/{protocol-CN24IKQN.js → protocol-X53W2J73.js} +3 -3
- package/dist/{provider-DTNQYCMV.js → provider-QPECLUZ7.js} +3 -3
- package/dist/{provider-manager-LMHAHLIF.js → provider-manager-YA2WALTF.js} +3 -3
- package/dist/{serve-DMWEPTU5.js → serve-XPCJSKXX.js} +11 -11
- package/dist/server/index.d.ts +4 -9
- package/dist/server/index.js +10 -10
- package/dist/{service-GB7AIOG5.js → service-FJ4TW5L7.js} +14 -9
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +1 -1
- package/dist/{tools-BOE5T3KC.js → tools-22OPY2O7.js} +7 -7
- package/dist/web/assets/{index-C7IF2YAa.js → index-Di3909TT.js} +68 -68
- package/dist/web/index.html +1 -1
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
injectWorkflowKickoffIfNeeded,
|
|
4
4
|
runAgentTurn,
|
|
5
5
|
runChatTurn
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-STJJDIXV.js";
|
|
7
7
|
import {
|
|
8
8
|
COMPACTION_PROMPT,
|
|
9
9
|
TurnMetrics,
|
|
@@ -48,9 +48,8 @@ import {
|
|
|
48
48
|
loadProjectSkills,
|
|
49
49
|
loadUserAgents,
|
|
50
50
|
loadUserSkills,
|
|
51
|
-
loadVisionModelFromGlobalConfig,
|
|
52
51
|
pathExists,
|
|
53
|
-
|
|
52
|
+
processEventsForConversation,
|
|
54
53
|
saveAgent,
|
|
55
54
|
saveAgentToProject,
|
|
56
55
|
saveItemToDir,
|
|
@@ -59,7 +58,7 @@ import {
|
|
|
59
58
|
skillExists,
|
|
60
59
|
spawnShellProcess,
|
|
61
60
|
streamLLMPure
|
|
62
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-N374WCXC.js";
|
|
63
62
|
import {
|
|
64
63
|
getPathSeparator,
|
|
65
64
|
getPlatformShell,
|
|
@@ -73,7 +72,6 @@ import {
|
|
|
73
72
|
createSession,
|
|
74
73
|
deleteSession,
|
|
75
74
|
emitAssistantMessageStart,
|
|
76
|
-
emitContextCompacted,
|
|
77
75
|
emitContextState,
|
|
78
76
|
emitCriteriaSet,
|
|
79
77
|
emitCriterionUpdated,
|
|
@@ -97,11 +95,11 @@ import {
|
|
|
97
95
|
updateSessionMetadata,
|
|
98
96
|
updateSessionProvider,
|
|
99
97
|
updateSessionRunning
|
|
100
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-FRJQC77Y.js";
|
|
101
99
|
import {
|
|
102
100
|
buildMessagesFromStoredEvents,
|
|
103
101
|
foldPendingConfirmations
|
|
104
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-4HBWSC6K.js";
|
|
105
103
|
import {
|
|
106
104
|
createChatErrorMessage,
|
|
107
105
|
createChatMessageMessage,
|
|
@@ -116,7 +114,7 @@ import {
|
|
|
116
114
|
parseClientMessage,
|
|
117
115
|
serializeServerMessage,
|
|
118
116
|
storedEventToServerMessage
|
|
119
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-DTJJZZOC.js";
|
|
120
118
|
import {
|
|
121
119
|
EventEmitter,
|
|
122
120
|
provideAnswer
|
|
@@ -129,7 +127,7 @@ import {
|
|
|
129
127
|
} from "./chunk-VUQCQXXJ.js";
|
|
130
128
|
import {
|
|
131
129
|
createServerMessage
|
|
132
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-LVS5YGTX.js";
|
|
133
131
|
import {
|
|
134
132
|
getGlobalConfigDir
|
|
135
133
|
} from "./chunk-CQGTEGKL.js";
|
|
@@ -142,12 +140,11 @@ import {
|
|
|
142
140
|
ensureVersionPrefix,
|
|
143
141
|
getLlmStatus,
|
|
144
142
|
parseDefaultModelSelection
|
|
145
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-A52FXWJX.js";
|
|
146
144
|
import {
|
|
147
145
|
getBackendDisplayName,
|
|
148
|
-
getModelProfile
|
|
149
|
-
|
|
150
|
-
} from "./chunk-FFEAEPJB.js";
|
|
146
|
+
getModelProfile
|
|
147
|
+
} from "./chunk-Z4SWOUWC.js";
|
|
151
148
|
import {
|
|
152
149
|
logger,
|
|
153
150
|
setLogLevel
|
|
@@ -2449,18 +2446,19 @@ async function compactContext(options) {
|
|
|
2449
2446
|
})
|
|
2450
2447
|
);
|
|
2451
2448
|
eventStore.append(sessionId, { type: "message.done", data: { messageId: compactPromptMsgId } });
|
|
2452
|
-
const
|
|
2453
|
-
|
|
2454
|
-
const runtimeConfig = getRuntimeConfig();
|
|
2455
|
-
const visionModel = runtimeConfig.llm.visionModel ? { baseUrl: runtimeConfig.llm.baseUrl, model: runtimeConfig.llm.visionModel, timeout: runtimeConfig.llm.timeout } : await loadVisionModelFromGlobalConfig();
|
|
2456
|
-
const { events: processedEvents } = await processContextImages(rawEvents, {
|
|
2457
|
-
modelSupportsVision: modelVision,
|
|
2458
|
-
...visionModel ? { visionModel } : {},
|
|
2459
|
-
onEvent: (event) => eventStore.append(sessionId, event)
|
|
2449
|
+
const processedEvents = await processEventsForConversation(sessionId, llmClient, (event) => {
|
|
2450
|
+
eventStore.append(sessionId, event);
|
|
2460
2451
|
});
|
|
2461
2452
|
const messages = getConversationMessages({ type: "toplevel", sessionId }, { events: processedEvents });
|
|
2462
|
-
const
|
|
2453
|
+
const cached = sessionManager.getCachedPrompt(sessionId);
|
|
2454
|
+
const systemPrompt = cached?.systemPrompt ?? buildBasePrompt(session.workdir);
|
|
2463
2455
|
const assistantMsgId = crypto.randomUUID();
|
|
2456
|
+
eventStore.append(
|
|
2457
|
+
sessionId,
|
|
2458
|
+
createMessageStartEvent(assistantMsgId, "assistant", void 0, {
|
|
2459
|
+
...getCurrentWindowMessageOptions(sessionId) ?? {}
|
|
2460
|
+
})
|
|
2461
|
+
);
|
|
2464
2462
|
const streamGen = streamLLMPure({
|
|
2465
2463
|
messageId: assistantMsgId,
|
|
2466
2464
|
systemPrompt,
|
|
@@ -4846,26 +4844,6 @@ var SessionManager = class {
|
|
|
4846
4844
|
return msg;
|
|
4847
4845
|
});
|
|
4848
4846
|
}
|
|
4849
|
-
/**
|
|
4850
|
-
* Compact context. Delegates to EventStore.
|
|
4851
|
-
*/
|
|
4852
|
-
compactContext(sessionId, summary, tokenCountAtClose) {
|
|
4853
|
-
const state = getSessionState(sessionId);
|
|
4854
|
-
if (!state) {
|
|
4855
|
-
throw new Error("Session not found");
|
|
4856
|
-
}
|
|
4857
|
-
const closedWindowId = state.currentContextWindowId;
|
|
4858
|
-
const newWindowId = crypto.randomUUID();
|
|
4859
|
-
emitContextCompacted(sessionId, closedWindowId, newWindowId, tokenCountAtClose, 0, summary);
|
|
4860
|
-
emitUserMessage(sessionId, `Previous context summary:
|
|
4861
|
-
${summary}`, {
|
|
4862
|
-
contextWindowId: newWindowId,
|
|
4863
|
-
isSystemGenerated: true,
|
|
4864
|
-
messageKind: "auto-prompt",
|
|
4865
|
-
isCompactionSummary: true,
|
|
4866
|
-
metadata: { type: "compaction", name: "Compaction", color: "#64748b" }
|
|
4867
|
-
});
|
|
4868
|
-
}
|
|
4869
4847
|
/**
|
|
4870
4848
|
* Set current context size (for token tracking).
|
|
4871
4849
|
* Emits a context.state event with the real promptTokens from the LLM.
|
|
@@ -5117,23 +5095,6 @@ ${summary}`, {
|
|
|
5117
5095
|
getDynamicContextChanged(sessionId) {
|
|
5118
5096
|
return this.dynamicContextChangedStore.get(sessionId) ?? false;
|
|
5119
5097
|
}
|
|
5120
|
-
/**
|
|
5121
|
-
* @deprecated Use addMessage + compactContext instead
|
|
5122
|
-
*/
|
|
5123
|
-
compactMessages(sessionId, _messageIds, summary) {
|
|
5124
|
-
const messageId = emitUserMessage(sessionId, `[COMPACTED HISTORY]
|
|
5125
|
-
${summary}`, {
|
|
5126
|
-
isSystemGenerated: true
|
|
5127
|
-
});
|
|
5128
|
-
return {
|
|
5129
|
-
id: messageId,
|
|
5130
|
-
role: "system",
|
|
5131
|
-
content: `[COMPACTED HISTORY]
|
|
5132
|
-
${summary}`,
|
|
5133
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5134
|
-
isCompacted: true
|
|
5135
|
-
};
|
|
5136
|
-
}
|
|
5137
5098
|
/**
|
|
5138
5099
|
* @deprecated Use addTokensUsed instead
|
|
5139
5100
|
*/
|
|
@@ -5832,7 +5793,7 @@ import { Router as Router6 } from "express";
|
|
|
5832
5793
|
import { spawn as spawn5 } from "child_process";
|
|
5833
5794
|
|
|
5834
5795
|
// src/constants.ts
|
|
5835
|
-
var VERSION = "2.0.
|
|
5796
|
+
var VERSION = "2.0.4";
|
|
5836
5797
|
|
|
5837
5798
|
// src/server/routes/auto-update.ts
|
|
5838
5799
|
var updateInProgress = false;
|
|
@@ -6125,7 +6086,7 @@ async function createServerHandle(config4) {
|
|
|
6125
6086
|
res.json({ project });
|
|
6126
6087
|
});
|
|
6127
6088
|
app.get("/api/sessions", async (req, res) => {
|
|
6128
|
-
const { getRecentUserPromptsForSession } = await import("./events-
|
|
6089
|
+
const { getRecentUserPromptsForSession } = await import("./events-5SWEG62X.js");
|
|
6129
6090
|
const projectId = req.query["projectId"];
|
|
6130
6091
|
const limit = Math.min(parseInt(req.query["limit"]) || 20, 100);
|
|
6131
6092
|
const offset = parseInt(req.query["offset"]) || 0;
|
|
@@ -6158,8 +6119,8 @@ async function createServerHandle(config4) {
|
|
|
6158
6119
|
res.status(201).json({ session });
|
|
6159
6120
|
});
|
|
6160
6121
|
app.get("/api/sessions/:id", async (req, res) => {
|
|
6161
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
6162
|
-
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-
|
|
6122
|
+
const { getEventStore: getEventStore2 } = await import("./events-5SWEG62X.js");
|
|
6123
|
+
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-NUBDA4HS.js");
|
|
6163
6124
|
const session = sessionManager.getSession(req.params.id);
|
|
6164
6125
|
if (!session) {
|
|
6165
6126
|
return res.status(404).json({ error: "Session not found" });
|
|
@@ -6189,8 +6150,8 @@ async function createServerHandle(config4) {
|
|
|
6189
6150
|
res.json({ success: true });
|
|
6190
6151
|
});
|
|
6191
6152
|
app.post("/api/sessions/:id/provider", async (req, res) => {
|
|
6192
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
6193
|
-
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-
|
|
6153
|
+
const { getEventStore: getEventStore2 } = await import("./events-5SWEG62X.js");
|
|
6154
|
+
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-NUBDA4HS.js");
|
|
6194
6155
|
const sessionId = req.params.id;
|
|
6195
6156
|
const session = sessionManager.getSession(sessionId);
|
|
6196
6157
|
if (!session) {
|
|
@@ -6232,8 +6193,8 @@ async function createServerHandle(config4) {
|
|
|
6232
6193
|
res.json({ success: true });
|
|
6233
6194
|
});
|
|
6234
6195
|
app.put("/api/sessions/:id/mode", async (req, res) => {
|
|
6235
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
6236
|
-
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-
|
|
6196
|
+
const { getEventStore: getEventStore2 } = await import("./events-5SWEG62X.js");
|
|
6197
|
+
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-NUBDA4HS.js");
|
|
6237
6198
|
const sessionId = req.params.id;
|
|
6238
6199
|
const session = sessionManager.getSession(sessionId);
|
|
6239
6200
|
if (!session) {
|
|
@@ -6289,14 +6250,14 @@ async function createServerHandle(config4) {
|
|
|
6289
6250
|
if (!callId || approved === void 0) {
|
|
6290
6251
|
return res.status(400).json({ error: "callId and approved are required" });
|
|
6291
6252
|
}
|
|
6292
|
-
const { providePathConfirmation } = await import("./tools-
|
|
6253
|
+
const { providePathConfirmation } = await import("./tools-22OPY2O7.js");
|
|
6293
6254
|
const result = providePathConfirmation(callId, approved, alwaysAllow);
|
|
6294
6255
|
if (!result.found) {
|
|
6295
6256
|
return res.status(404).json({ error: "No pending path confirmation with that ID" });
|
|
6296
6257
|
}
|
|
6297
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
6298
|
-
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2, foldPendingConfirmations: foldPendingConfirmations2 } = await import("./folding-
|
|
6299
|
-
const { createSessionStateMessage: createSessionStateMessage2 } = await import("./protocol-
|
|
6258
|
+
const { getEventStore: getEventStore2 } = await import("./events-5SWEG62X.js");
|
|
6259
|
+
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2, foldPendingConfirmations: foldPendingConfirmations2 } = await import("./folding-NUBDA4HS.js");
|
|
6260
|
+
const { createSessionStateMessage: createSessionStateMessage2 } = await import("./protocol-X53W2J73.js");
|
|
6300
6261
|
const eventStore = getEventStore2();
|
|
6301
6262
|
const events = eventStore.getEvents(sessionId);
|
|
6302
6263
|
const messages = buildMessagesFromStoredEvents2(events);
|
|
@@ -6313,7 +6274,7 @@ async function createServerHandle(config4) {
|
|
|
6313
6274
|
if (!callId || !answer) {
|
|
6314
6275
|
return res.status(400).json({ error: "callId and answer are required" });
|
|
6315
6276
|
}
|
|
6316
|
-
const { provideAnswer: provideAnswer2 } = await import("./tools-
|
|
6277
|
+
const { provideAnswer: provideAnswer2 } = await import("./tools-22OPY2O7.js");
|
|
6317
6278
|
const found = provideAnswer2(callId, answer);
|
|
6318
6279
|
if (!found) {
|
|
6319
6280
|
return res.status(404).json({ error: "No pending question with that ID" });
|
|
@@ -6349,15 +6310,15 @@ async function createServerHandle(config4) {
|
|
|
6349
6310
|
if (!session) {
|
|
6350
6311
|
return res.status(404).json({ error: "Session not found" });
|
|
6351
6312
|
}
|
|
6352
|
-
const { stopSessionExecution } = await import("./chat-handler-
|
|
6353
|
-
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-
|
|
6313
|
+
const { stopSessionExecution } = await import("./chat-handler-WHE75FCD.js");
|
|
6314
|
+
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-22OPY2O7.js");
|
|
6354
6315
|
const queuedMessages = sessionManager.getQueueState(sessionId);
|
|
6355
6316
|
sessionManager.clearMessageQueue(sessionId);
|
|
6356
6317
|
stopSessionExecution(sessionId, sessionManager);
|
|
6357
6318
|
abortSession(sessionId);
|
|
6358
6319
|
cancelQuestionsForSession(sessionId, "Session stopped by user");
|
|
6359
6320
|
cancelPathConfirmationsForSession(sessionId, "Session stopped by user");
|
|
6360
|
-
const eventStore = (await import("./events-
|
|
6321
|
+
const eventStore = (await import("./events-5SWEG62X.js")).getEventStore();
|
|
6361
6322
|
eventStore.append(sessionId, { type: "running.changed", data: { isRunning: false } });
|
|
6362
6323
|
res.json({ success: true, queuedMessages });
|
|
6363
6324
|
});
|
|
@@ -6371,7 +6332,7 @@ async function createServerHandle(config4) {
|
|
|
6371
6332
|
if (typeof messageIndex !== "number" || messageIndex < 0) {
|
|
6372
6333
|
return res.status(400).json({ error: "messageIndex must be a non-negative number" });
|
|
6373
6334
|
}
|
|
6374
|
-
const { truncateSessionMessages } = await import("./events-
|
|
6335
|
+
const { truncateSessionMessages } = await import("./events-5SWEG62X.js");
|
|
6375
6336
|
truncateSessionMessages(sessionId, messageIndex);
|
|
6376
6337
|
res.json({ success: true });
|
|
6377
6338
|
});
|
|
@@ -6389,7 +6350,7 @@ async function createServerHandle(config4) {
|
|
|
6389
6350
|
if (!msg) {
|
|
6390
6351
|
return res.status(400).json({ error: "Message not found at this index" });
|
|
6391
6352
|
}
|
|
6392
|
-
const { truncateSessionMessages } = await import("./events-
|
|
6353
|
+
const { truncateSessionMessages } = await import("./events-5SWEG62X.js");
|
|
6393
6354
|
truncateSessionMessages(sessionId, messageIndex - 1);
|
|
6394
6355
|
sessionManager.queueMessage(sessionId, "asap", msg.content, msg.attachments, msg.messageKind);
|
|
6395
6356
|
res.json({ success: true });
|
|
@@ -6513,6 +6474,25 @@ async function createServerHandle(config4) {
|
|
|
6513
6474
|
backend: llmClient.getBackend()
|
|
6514
6475
|
});
|
|
6515
6476
|
});
|
|
6477
|
+
function buildModelConfigs(models) {
|
|
6478
|
+
return models.map((m) => ({
|
|
6479
|
+
id: m.id,
|
|
6480
|
+
contextWindow: m.contextWindow ?? 2e5,
|
|
6481
|
+
source: "user",
|
|
6482
|
+
...m.supportsVision !== void 0 && { supportsVision: m.supportsVision },
|
|
6483
|
+
...m.thinkingEnabled !== void 0 && { thinkingEnabled: m.thinkingEnabled },
|
|
6484
|
+
...m.thinkingLevel !== void 0 && { thinkingLevel: m.thinkingLevel },
|
|
6485
|
+
...m.nonThinkingEnabled !== void 0 && { nonThinkingEnabled: m.nonThinkingEnabled },
|
|
6486
|
+
...m.thinkingExtraKwargs !== void 0 && { thinkingExtraKwargs: m.thinkingExtraKwargs },
|
|
6487
|
+
...m.nonThinkingExtraKwargs !== void 0 && { nonThinkingExtraKwargs: m.nonThinkingExtraKwargs },
|
|
6488
|
+
...m.thinkingQueryParams !== void 0 && { thinkingQueryParams: m.thinkingQueryParams },
|
|
6489
|
+
...m.nonThinkingQueryParams !== void 0 && { nonThinkingQueryParams: m.nonThinkingQueryParams },
|
|
6490
|
+
...m.temperature !== void 0 && { temperature: m.temperature },
|
|
6491
|
+
...m.topP !== void 0 && { topP: m.topP },
|
|
6492
|
+
...m.topK !== void 0 && { topK: m.topK },
|
|
6493
|
+
...m.maxTokens !== void 0 && { maxTokens: m.maxTokens }
|
|
6494
|
+
}));
|
|
6495
|
+
}
|
|
6516
6496
|
app.post("/api/providers/test", async (req, res) => {
|
|
6517
6497
|
const { url, backend: reqBackend } = req.body;
|
|
6518
6498
|
if (!url) {
|
|
@@ -6537,7 +6517,7 @@ async function createServerHandle(config4) {
|
|
|
6537
6517
|
const url = req.query["url"];
|
|
6538
6518
|
if (!url) return res.status(400).json({ error: "url is required" });
|
|
6539
6519
|
try {
|
|
6540
|
-
const { fetchModelsWithContext } = await import("./provider-manager-
|
|
6520
|
+
const { fetchModelsWithContext } = await import("./provider-manager-YA2WALTF.js");
|
|
6541
6521
|
const models = await fetchModelsWithContext(url);
|
|
6542
6522
|
if (models.length === 0) {
|
|
6543
6523
|
return res.status(404).json({ error: `No models found at ${buildModelsUrl(url)}`, url });
|
|
@@ -6561,17 +6541,19 @@ async function createServerHandle(config4) {
|
|
|
6561
6541
|
}
|
|
6562
6542
|
});
|
|
6563
6543
|
app.post("/api/providers/test-params", async (req, res) => {
|
|
6564
|
-
const { url, model, params, apiKey } = req.body;
|
|
6544
|
+
const { url, model, params, apiKey, queryParams } = req.body;
|
|
6565
6545
|
if (!url) return res.status(400).json({ error: "url is required" });
|
|
6566
6546
|
if (!model) return res.status(400).json({ error: "model is required" });
|
|
6567
6547
|
try {
|
|
6568
6548
|
const headers = { "Content-Type": "application/json" };
|
|
6569
6549
|
if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
|
|
6550
|
+
const hasQueryParams = queryParams && Object.keys(queryParams).length > 0;
|
|
6570
6551
|
const body = {
|
|
6571
6552
|
model,
|
|
6572
6553
|
messages: [{ role: "user", content: "say hi in one word" }],
|
|
6573
6554
|
max_tokens: 8e3,
|
|
6574
|
-
...params
|
|
6555
|
+
...hasQueryParams ? {} : params,
|
|
6556
|
+
...hasQueryParams ? queryParams : {}
|
|
6575
6557
|
};
|
|
6576
6558
|
const response = await fetch(`${ensureVersionPrefix(url)}/chat/completions`, {
|
|
6577
6559
|
method: "POST",
|
|
@@ -6581,7 +6563,7 @@ async function createServerHandle(config4) {
|
|
|
6581
6563
|
});
|
|
6582
6564
|
if (!response.ok) {
|
|
6583
6565
|
const errorBody = await response.text();
|
|
6584
|
-
return res.status(400).json({ error: `API error (${response.status}): ${errorBody.slice(0,
|
|
6566
|
+
return res.status(400).json({ error: `API error (${response.status}): ${errorBody.slice(0, 2e3)}` });
|
|
6585
6567
|
}
|
|
6586
6568
|
const data = await response.json();
|
|
6587
6569
|
const message = data.choices?.[0]?.message ?? {};
|
|
@@ -6615,17 +6597,7 @@ async function createServerHandle(config4) {
|
|
|
6615
6597
|
apiKey,
|
|
6616
6598
|
...isLocal !== void 0 ? { isLocal } : {},
|
|
6617
6599
|
...thinkingField ? { thinkingField } : {},
|
|
6618
|
-
models: modelConfigs?.length ? modelConfigs
|
|
6619
|
-
id: m.id,
|
|
6620
|
-
contextWindow: m.contextWindow,
|
|
6621
|
-
source: "user",
|
|
6622
|
-
...m.supportsVision !== void 0 ? { supportsVision: m.supportsVision } : {},
|
|
6623
|
-
...m.thinkingEnabled !== void 0 ? { thinkingEnabled: m.thinkingEnabled } : {},
|
|
6624
|
-
...m.thinkingLevel ? { thinkingLevel: m.thinkingLevel } : {},
|
|
6625
|
-
...m.nonThinkingEnabled !== void 0 ? { nonThinkingEnabled: m.nonThinkingEnabled } : {},
|
|
6626
|
-
...m.thinkingExtraKwargs ? { thinkingExtraKwargs: m.thinkingExtraKwargs } : {},
|
|
6627
|
-
...m.nonThinkingExtraKwargs ? { nonThinkingExtraKwargs: m.nonThinkingExtraKwargs } : {}
|
|
6628
|
-
})) : model ? [{ id: model, contextWindow: 2e5, source: "user" }] : [],
|
|
6600
|
+
models: modelConfigs?.length ? buildModelConfigs(modelConfigs) : model ? [{ id: model, contextWindow: 2e5, source: "user" }] : [],
|
|
6629
6601
|
isActive: true
|
|
6630
6602
|
});
|
|
6631
6603
|
const finalConfig = setDefaultModelSelection(
|
|
@@ -6731,17 +6703,7 @@ async function createServerHandle(config4) {
|
|
|
6731
6703
|
if (isLocal !== void 0) updates["isLocal"] = isLocal;
|
|
6732
6704
|
if (thinkingField !== void 0) updates["thinkingField"] = thinkingField || void 0;
|
|
6733
6705
|
if (modelConfigs !== void 0) {
|
|
6734
|
-
updates["models"] = modelConfigs
|
|
6735
|
-
id: m.id,
|
|
6736
|
-
contextWindow: m.contextWindow,
|
|
6737
|
-
source: "user",
|
|
6738
|
-
...m.supportsVision !== void 0 ? { supportsVision: m.supportsVision } : {},
|
|
6739
|
-
...m.thinkingEnabled !== void 0 ? { thinkingEnabled: m.thinkingEnabled } : {},
|
|
6740
|
-
...m.thinkingLevel ? { thinkingLevel: m.thinkingLevel } : {},
|
|
6741
|
-
...m.nonThinkingEnabled !== void 0 ? { nonThinkingEnabled: m.nonThinkingEnabled } : {},
|
|
6742
|
-
...m.thinkingExtraKwargs ? { thinkingExtraKwargs: m.thinkingExtraKwargs } : {},
|
|
6743
|
-
...m.nonThinkingExtraKwargs ? { nonThinkingExtraKwargs: m.nonThinkingExtraKwargs } : {}
|
|
6744
|
-
}));
|
|
6706
|
+
updates["models"] = buildModelConfigs(modelConfigs);
|
|
6745
6707
|
}
|
|
6746
6708
|
const updatedConfig = updateProvider(globalConfig, id, updates);
|
|
6747
6709
|
await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
|
|
@@ -6775,56 +6737,6 @@ async function createServerHandle(config4) {
|
|
|
6775
6737
|
backend: llmClient.getBackend()
|
|
6776
6738
|
});
|
|
6777
6739
|
});
|
|
6778
|
-
app.post("/api/providers/:id/models/:modelId", async (req, res) => {
|
|
6779
|
-
const { id, modelId } = req.params;
|
|
6780
|
-
const body = req.body;
|
|
6781
|
-
logger.info("API: POST /api/providers/:id/models/:modelId", {
|
|
6782
|
-
providerId: id,
|
|
6783
|
-
modelId,
|
|
6784
|
-
body
|
|
6785
|
-
});
|
|
6786
|
-
const hasFullSettings = body.temperature !== void 0 || body.topP !== void 0 || body.topK !== void 0 || body.maxTokens !== void 0 || body.thinkingEnabled !== void 0 || body.thinkingLevel !== void 0 || body.nonThinkingEnabled !== void 0 || body.thinkingExtraKwargs !== void 0 || body.nonThinkingExtraKwargs !== void 0;
|
|
6787
|
-
let result;
|
|
6788
|
-
if (hasFullSettings) {
|
|
6789
|
-
result = await providerManager.updateModelSettings(id, modelId, body);
|
|
6790
|
-
} else if (body.contextWindow) {
|
|
6791
|
-
result = await providerManager.updateModelContext(id, modelId, body.contextWindow);
|
|
6792
|
-
} else {
|
|
6793
|
-
return res.status(400).json({ error: "contextWindow or full settings required" });
|
|
6794
|
-
}
|
|
6795
|
-
if (!result.success) {
|
|
6796
|
-
return res.status(400).json({ error: result.error });
|
|
6797
|
-
}
|
|
6798
|
-
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-BU66P4KX.js");
|
|
6799
|
-
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
6800
|
-
const updatedProviders = providerManager.getProviders();
|
|
6801
|
-
const updatedConfig = {
|
|
6802
|
-
...globalConfig,
|
|
6803
|
-
providers: updatedProviders,
|
|
6804
|
-
activeProviderId: providerManager.getActiveProviderId(),
|
|
6805
|
-
defaultModelSelection: providerManager.getActiveProviderId() ? `${providerManager.getActiveProviderId()}/${providerManager.getCurrentModel()}` : void 0
|
|
6806
|
-
};
|
|
6807
|
-
await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
|
|
6808
|
-
let contextState = null;
|
|
6809
|
-
const sessions = sessionManager.listSessions();
|
|
6810
|
-
if (sessions.length > 0) {
|
|
6811
|
-
for (const session of sessions) {
|
|
6812
|
-
const sessionProviderId = session.providerId || providerManager.getActiveProviderId();
|
|
6813
|
-
if (sessionProviderId === id) {
|
|
6814
|
-
contextState = sessionManager.getContextState(session.id);
|
|
6815
|
-
break;
|
|
6816
|
-
}
|
|
6817
|
-
}
|
|
6818
|
-
}
|
|
6819
|
-
res.json({
|
|
6820
|
-
success: true,
|
|
6821
|
-
providerId: id,
|
|
6822
|
-
modelId,
|
|
6823
|
-
contextWindow: body.contextWindow,
|
|
6824
|
-
model: result.model,
|
|
6825
|
-
contextState
|
|
6826
|
-
});
|
|
6827
|
-
});
|
|
6828
6740
|
app.post("/api/providers/:id/refresh", async (req, res) => {
|
|
6829
6741
|
const { id } = req.params;
|
|
6830
6742
|
const result = await providerManager.refreshProviderModels(id);
|
|
@@ -7009,7 +6921,7 @@ async function createServerHandle(config4) {
|
|
|
7009
6921
|
providerManager
|
|
7010
6922
|
);
|
|
7011
6923
|
const wss = wssExports.wss;
|
|
7012
|
-
const { QueueProcessor } = await import("./processor-
|
|
6924
|
+
const { QueueProcessor } = await import("./processor-7TYZNS4I.js");
|
|
7013
6925
|
const queueProcessor = new QueueProcessor({
|
|
7014
6926
|
sessionManager,
|
|
7015
6927
|
providerManager,
|
|
@@ -7083,4 +6995,4 @@ export {
|
|
|
7083
6995
|
createServerHandle,
|
|
7084
6996
|
createServer
|
|
7085
6997
|
};
|
|
7086
|
-
//# sourceMappingURL=chunk-
|
|
6998
|
+
//# sourceMappingURL=chunk-O2MR653P.js.map
|
|
@@ -151,18 +151,18 @@ async function runCli(options) {
|
|
|
151
151
|
break;
|
|
152
152
|
}
|
|
153
153
|
case "provider": {
|
|
154
|
-
const { runProviderCommand } = await import("./provider-
|
|
154
|
+
const { runProviderCommand } = await import("./provider-QPECLUZ7.js");
|
|
155
155
|
const [, subcommand] = positionals;
|
|
156
156
|
await runProviderCommand(mode, subcommand);
|
|
157
157
|
break;
|
|
158
158
|
}
|
|
159
159
|
case "service": {
|
|
160
|
-
const { runServiceCommand } = await import("./service-
|
|
161
|
-
const [, subcommand] = positionals;
|
|
160
|
+
const { runServiceCommand } = await import("./service-FJ4TW5L7.js");
|
|
161
|
+
const [, subcommand, ...serviceArgs] = positionals;
|
|
162
162
|
if (subcommand === "--help" || subcommand === "-h" || values.help) {
|
|
163
163
|
runServiceCommand(mode, void 0);
|
|
164
164
|
} else {
|
|
165
|
-
await runServiceCommand(mode, subcommand);
|
|
165
|
+
await runServiceCommand(mode, subcommand, ...serviceArgs);
|
|
166
166
|
}
|
|
167
167
|
break;
|
|
168
168
|
}
|
|
@@ -193,7 +193,7 @@ async function runCli(options) {
|
|
|
193
193
|
if (!configExists) {
|
|
194
194
|
await runNetworkSetup(mode);
|
|
195
195
|
}
|
|
196
|
-
const { runServe } = await import("./serve-
|
|
196
|
+
const { runServe } = await import("./serve-XPCJSKXX.js");
|
|
197
197
|
const serveOptions = { mode };
|
|
198
198
|
if (values.port) serveOptions.port = parseInt(values.port);
|
|
199
199
|
if (values["no-browser"] === true) serveOptions.openBrowser = false;
|
|
@@ -205,4 +205,4 @@ async function runCli(options) {
|
|
|
205
205
|
export {
|
|
206
206
|
runCli
|
|
207
207
|
};
|
|
208
|
-
//# sourceMappingURL=chunk-
|
|
208
|
+
//# sourceMappingURL=chunk-RVXAYREQ.js.map
|
|
@@ -17,16 +17,16 @@ import {
|
|
|
17
17
|
loadAllAgentsDefault,
|
|
18
18
|
processEventsForConversation,
|
|
19
19
|
runTopLevelAgentLoop
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-N374WCXC.js";
|
|
21
21
|
import {
|
|
22
22
|
getCurrentContextWindowId,
|
|
23
23
|
getCurrentWindowMessageOptions,
|
|
24
24
|
getEventStore,
|
|
25
25
|
getRuntimeConfig
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-FRJQC77Y.js";
|
|
27
27
|
import {
|
|
28
28
|
buildSnapshotFromSessionState
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-4HBWSC6K.js";
|
|
30
30
|
import {
|
|
31
31
|
getGlobalConfigDir
|
|
32
32
|
} from "./chunk-CQGTEGKL.js";
|
|
@@ -311,4 +311,4 @@ export {
|
|
|
311
311
|
runAgentTurn,
|
|
312
312
|
injectWorkflowKickoffIfNeeded
|
|
313
313
|
};
|
|
314
|
-
//# sourceMappingURL=chunk-
|
|
314
|
+
//# sourceMappingURL=chunk-STJJDIXV.js.map
|
|
@@ -211,7 +211,7 @@ function getBackendDisplayName(backend) {
|
|
|
211
211
|
case "opencode-go":
|
|
212
212
|
return "OpenCode Go";
|
|
213
213
|
case "unknown":
|
|
214
|
-
return "
|
|
214
|
+
return "Other";
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
|
|
@@ -346,7 +346,9 @@ async function buildChatCompletionCreateParams(model, request, profile, capabili
|
|
|
346
346
|
params["top_k"] = topK;
|
|
347
347
|
}
|
|
348
348
|
const resolvedEffort = reasoningEffort ?? request.reasoningEffort;
|
|
349
|
-
|
|
349
|
+
const queryParams = request.modelSettings?.queryParams;
|
|
350
|
+
const hasQueryParams = queryParams && Object.keys(queryParams).length > 0;
|
|
351
|
+
if (resolvedEffort && !hasQueryParams) {
|
|
350
352
|
;
|
|
351
353
|
params["reasoning_effort"] = resolvedEffort;
|
|
352
354
|
const chatTemplateKwargs = request.modelSettings?.chatTemplateKwargs;
|
|
@@ -360,6 +362,9 @@ async function buildChatCompletionCreateParams(model, request, profile, capabili
|
|
|
360
362
|
};
|
|
361
363
|
}
|
|
362
364
|
}
|
|
365
|
+
if (hasQueryParams) {
|
|
366
|
+
Object.assign(params, queryParams);
|
|
367
|
+
}
|
|
363
368
|
const modelParams = buildModelParams({ temperature, topP, topK, maxTokens });
|
|
364
369
|
return { params, modelParams };
|
|
365
370
|
}
|
|
@@ -497,4 +502,4 @@ export {
|
|
|
497
502
|
mapFinishReason,
|
|
498
503
|
streamWithSegments
|
|
499
504
|
};
|
|
500
|
-
//# sourceMappingURL=chunk-
|
|
505
|
+
//# sourceMappingURL=chunk-Z4SWOUWC.js.map
|
package/dist/cli/dev.js
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCompactionTarget,
|
|
3
3
|
shouldCompact
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NZCKCJH5.js";
|
|
5
5
|
export {
|
|
6
6
|
getCompactionTarget,
|
|
7
7
|
shouldCompact
|
|
8
8
|
};
|
|
9
|
-
//# sourceMappingURL=compactor-
|
|
9
|
+
//# sourceMappingURL=compactor-5VQNEYQX.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EventStore,
|
|
3
|
-
compactContext,
|
|
4
3
|
createEvent,
|
|
5
4
|
emitAssistantMessageStart,
|
|
6
5
|
emitChatDone,
|
|
@@ -39,7 +38,7 @@ import {
|
|
|
39
38
|
isStoredEvent,
|
|
40
39
|
isTurnEvent,
|
|
41
40
|
truncateSessionMessages
|
|
42
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-FRJQC77Y.js";
|
|
43
42
|
import {
|
|
44
43
|
buildContextMessagesFromEventHistory,
|
|
45
44
|
buildContextMessagesFromMessages,
|
|
@@ -56,7 +55,7 @@ import {
|
|
|
56
55
|
foldTodos,
|
|
57
56
|
foldTurnEventsToSnapshotMessages,
|
|
58
57
|
getMessagesForWindow
|
|
59
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-4HBWSC6K.js";
|
|
60
59
|
import "./chunk-FBGWG4N6.js";
|
|
61
60
|
import "./chunk-K44MW7JJ.js";
|
|
62
61
|
export {
|
|
@@ -67,7 +66,6 @@ export {
|
|
|
67
66
|
buildMessagesFromStoredEvents,
|
|
68
67
|
buildSnapshot,
|
|
69
68
|
buildSnapshotFromSessionState,
|
|
70
|
-
compactContext,
|
|
71
69
|
createEvent,
|
|
72
70
|
emitAssistantMessageStart,
|
|
73
71
|
emitChatDone,
|
|
@@ -116,4 +114,4 @@ export {
|
|
|
116
114
|
isTurnEvent,
|
|
117
115
|
truncateSessionMessages
|
|
118
116
|
};
|
|
119
|
-
//# sourceMappingURL=events-
|
|
117
|
+
//# sourceMappingURL=events-5SWEG62X.js.map
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
handleToolResult,
|
|
24
24
|
spreadOptionalMessageFields,
|
|
25
25
|
stripOrphanedToolCalls
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-4HBWSC6K.js";
|
|
27
27
|
export {
|
|
28
28
|
buildContextMessagesFromEventHistory,
|
|
29
29
|
buildContextMessagesFromMessages,
|
|
@@ -50,4 +50,4 @@ export {
|
|
|
50
50
|
spreadOptionalMessageFields,
|
|
51
51
|
stripOrphanedToolCalls
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=folding-
|
|
53
|
+
//# sourceMappingURL=folding-NUBDA4HS.js.map
|