openfox 2.0.0-beta.10 → 2.0.0-beta.13
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-6COBLIDR.js → chat-handler-DKX2XFHA.js} +9 -9
- package/dist/{chunk-LR5R7EEE.js → chunk-5RP2ZU2G.js} +22 -18
- package/dist/{chunk-G4SACK4E.js → chunk-BNFQMAH6.js} +166 -46
- package/dist/{chunk-C75I2KZM.js → chunk-DBDMMSCM.js} +29 -35
- package/dist/{chunk-NPHYEUYE.js → chunk-DHAKJSE7.js} +54 -3
- package/dist/{chunk-EZUR7OEP.js → chunk-HZODNSSV.js} +15 -9
- package/dist/{chunk-XJEOP6XU.js → chunk-ITWVFGFV.js} +1 -30
- package/dist/{chunk-BE2S4NJX.js → chunk-LDHRZRCP.js} +6 -6
- package/dist/{chunk-VIIRNJDT.js → chunk-LXX2CPM5.js} +203 -236
- package/dist/{chunk-CDDMHSZF.js → chunk-OKLV3ZNN.js} +10 -6
- package/dist/{chunk-UKTPL5ZG.js → chunk-SW7MQGY3.js} +123 -214
- package/dist/{chunk-DMH6JVPF.js → chunk-YLQGD5SE.js} +28 -8
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{config-TDVA7MQN.js → config-FAT5XRFB.js} +5 -5
- package/dist/{events-PQ3KTI5H.js → events-R7FRQEBE.js} +3 -3
- package/dist/{folding-CXORTBAU.js → folding-YOCGTZYH.js} +2 -2
- package/dist/{orchestrator-ZNGTMZ7W.js → orchestrator-NNYZC7AY.js} +8 -8
- package/dist/package.json +1 -1
- package/dist/{processor-WMAU4C2N.js → processor-5T3CXD5I.js} +11 -6
- package/dist/{protocol-CDOV1pyc.d.ts → protocol-zn90yuIr.d.ts} +12 -3
- package/dist/{provider-BGH4MBLH.js → provider-2JYU6KGH.js} +9 -9
- package/dist/provider-manager-IP3HOGNB.js +16 -0
- package/dist/{serve-7VMTNIXT.js → serve-NSTNUQ2K.js} +14 -14
- package/dist/server/index.d.ts +21 -15
- package/dist/server/index.js +10 -10
- package/dist/shared/index.d.ts +2 -2
- package/dist/{tools-CQGEU3JK.js → tools-TJGSHOAR.js} +7 -7
- package/dist/web/assets/index-DIY3E8K9.js +299 -0
- package/dist/web/assets/{index-CSOB8dwI.css → index-Sdax8ayU.css} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-BF6jgTAb.js +0 -299
|
@@ -5,18 +5,19 @@ import {
|
|
|
5
5
|
generateSessionName,
|
|
6
6
|
getSessionMessageCount,
|
|
7
7
|
needsNameGenerationCheck
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OKLV3ZNN.js";
|
|
9
9
|
import {
|
|
10
10
|
runChatTurn
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-DBDMMSCM.js";
|
|
12
|
+
import "./chunk-5RP2ZU2G.js";
|
|
13
13
|
import "./chunk-DL6ZILAF.js";
|
|
14
14
|
import "./chunk-PBGOZMVY.js";
|
|
15
15
|
import "./chunk-VRGRAQDG.js";
|
|
16
|
+
import "./chunk-XAMAYRDA.js";
|
|
16
17
|
import {
|
|
17
18
|
getEventStore
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-DHAKJSE7.js";
|
|
20
|
+
import "./chunk-ITWVFGFV.js";
|
|
20
21
|
import {
|
|
21
22
|
createChatMessageMessage,
|
|
22
23
|
createPhaseChangedMessage,
|
|
@@ -24,14 +25,13 @@ import {
|
|
|
24
25
|
} from "./chunk-7TTEGAO6.js";
|
|
25
26
|
import "./chunk-BJYPTN5S.js";
|
|
26
27
|
import "./chunk-RFNEDBVO.js";
|
|
27
|
-
import "./chunk-XAMAYRDA.js";
|
|
28
28
|
import "./chunk-FBGWG4N6.js";
|
|
29
29
|
import "./chunk-BVHFMAVN.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-CQGTEGKL.js";
|
|
31
|
+
import "./chunk-LXX2CPM5.js";
|
|
31
32
|
import {
|
|
32
33
|
logger
|
|
33
34
|
} from "./chunk-K44MW7JJ.js";
|
|
34
|
-
import "./chunk-CQGTEGKL.js";
|
|
35
35
|
|
|
36
36
|
// src/server/session/chat-handler.ts
|
|
37
37
|
var activeAgents = /* @__PURE__ */ new Map();
|
|
@@ -161,4 +161,4 @@ export {
|
|
|
161
161
|
startChatSession,
|
|
162
162
|
stopSessionExecution
|
|
163
163
|
};
|
|
164
|
-
//# sourceMappingURL=chat-handler-
|
|
164
|
+
//# sourceMappingURL=chat-handler-DKX2XFHA.js.map
|
|
@@ -14,12 +14,15 @@ import {
|
|
|
14
14
|
getMaxPerSession,
|
|
15
15
|
getSessionProcessCount
|
|
16
16
|
} from "./chunk-VRGRAQDG.js";
|
|
17
|
+
import {
|
|
18
|
+
getProject
|
|
19
|
+
} from "./chunk-XAMAYRDA.js";
|
|
17
20
|
import {
|
|
18
21
|
getCurrentContextWindowId,
|
|
19
22
|
getCurrentWindowMessageOptions,
|
|
20
23
|
getEventStore,
|
|
21
24
|
getRuntimeConfig
|
|
22
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-DHAKJSE7.js";
|
|
23
26
|
import {
|
|
24
27
|
buildContextMessagesFromEventHistory,
|
|
25
28
|
foldContextState,
|
|
@@ -28,7 +31,7 @@ import {
|
|
|
28
31
|
handleToolCall,
|
|
29
32
|
handleToolResult,
|
|
30
33
|
stripOrphanedToolCalls
|
|
31
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-ITWVFGFV.js";
|
|
32
35
|
import {
|
|
33
36
|
createChatDoneMessage,
|
|
34
37
|
createChatMessageMessage,
|
|
@@ -46,21 +49,18 @@ import {
|
|
|
46
49
|
getSetting
|
|
47
50
|
} from "./chunk-RFNEDBVO.js";
|
|
48
51
|
import {
|
|
49
|
-
|
|
50
|
-
} from "./chunk-
|
|
52
|
+
getGlobalConfigDir
|
|
53
|
+
} from "./chunk-CQGTEGKL.js";
|
|
51
54
|
import {
|
|
52
55
|
buildModelParams,
|
|
53
56
|
getBackendCapabilities,
|
|
54
57
|
getModelProfile,
|
|
55
58
|
modelSupportsVision,
|
|
56
59
|
streamWithSegments
|
|
57
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-LXX2CPM5.js";
|
|
58
61
|
import {
|
|
59
62
|
logger
|
|
60
63
|
} from "./chunk-K44MW7JJ.js";
|
|
61
|
-
import {
|
|
62
|
-
getGlobalConfigDir
|
|
63
|
-
} from "./chunk-CQGTEGKL.js";
|
|
64
64
|
|
|
65
65
|
// src/server/tools/read.ts
|
|
66
66
|
import { readFile as readFile2, stat, readdir } from "fs/promises";
|
|
@@ -1955,6 +1955,11 @@ function buildAgentReminder(agentDef) {
|
|
|
1955
1955
|
${agentDef.prompt}${toolPermissions}
|
|
1956
1956
|
</system-reminder>`;
|
|
1957
1957
|
}
|
|
1958
|
+
function buildAgentSmallReminder(name) {
|
|
1959
|
+
return `<system-reminder>
|
|
1960
|
+
Reminder: you are in '${name}' mode.
|
|
1961
|
+
</system-reminder>`;
|
|
1962
|
+
}
|
|
1958
1963
|
var WORKFLOW_KICKOFF_PROMPT = (criteriaCount) => `Implement the task and make sure you fulfil the ${criteriaCount} criteria.`;
|
|
1959
1964
|
var COMPACTION_PROMPT = `You are a helpful AI assistant tasked with summarizing conversations for continuation.
|
|
1960
1965
|
|
|
@@ -1996,12 +2001,12 @@ function matchRetryPatterns(content, thinking, patterns) {
|
|
|
1996
2001
|
|
|
1997
2002
|
// src/server/chat/stream-utils.ts
|
|
1998
2003
|
function buildStreamRequestObject(params) {
|
|
1999
|
-
const { messages, tools, toolChoice,
|
|
2004
|
+
const { messages, tools, toolChoice, reasoningEffort, signal, modelSettings } = params;
|
|
2000
2005
|
return {
|
|
2001
2006
|
messages,
|
|
2002
2007
|
...tools && { tools },
|
|
2003
2008
|
...toolChoice && { toolChoice },
|
|
2004
|
-
|
|
2009
|
+
...reasoningEffort && { reasoningEffort },
|
|
2005
2010
|
...signal && { signal },
|
|
2006
2011
|
...modelSettings && { modelSettings }
|
|
2007
2012
|
};
|
|
@@ -2055,7 +2060,7 @@ function createEmptyStreamResult(aborted, modelParams, patternMatch) {
|
|
|
2055
2060
|
};
|
|
2056
2061
|
}
|
|
2057
2062
|
async function* streamLLMPure(options) {
|
|
2058
|
-
const { messageId, systemPrompt, llmClient, messages, tools, toolChoice, signal,
|
|
2063
|
+
const { messageId, systemPrompt, llmClient, messages, tools, toolChoice, signal, reasoningEffort, retryPatterns } = options;
|
|
2059
2064
|
const llmMessages = [{ role: "system", content: systemPrompt }, ...messages];
|
|
2060
2065
|
const profile = getModelProfile(llmClient.getModel());
|
|
2061
2066
|
const backend = getBackendCapabilities(llmClient.getBackend());
|
|
@@ -2088,7 +2093,7 @@ async function* streamLLMPure(options) {
|
|
|
2088
2093
|
messages: llmMessages,
|
|
2089
2094
|
tools,
|
|
2090
2095
|
toolChoice,
|
|
2091
|
-
|
|
2096
|
+
reasoningEffort,
|
|
2092
2097
|
signal: combinedSignal,
|
|
2093
2098
|
modelSettings: options.modelSettings
|
|
2094
2099
|
});
|
|
@@ -3100,7 +3105,7 @@ ${COMPACTION_PROMPT}`,
|
|
|
3100
3105
|
});
|
|
3101
3106
|
append(createMessageDoneEvent(assistantMsgId, { stats: turnMetrics.buildStats(statsIdentity, mode) }));
|
|
3102
3107
|
append(createChatDoneEvent(assistantMsgId, "complete"));
|
|
3103
|
-
config.
|
|
3108
|
+
config.injectAgentReminder?.();
|
|
3104
3109
|
compacting = false;
|
|
3105
3110
|
continue;
|
|
3106
3111
|
}
|
|
@@ -3184,7 +3189,6 @@ function buildAssemblyInput(systemPrompt, baseInput) {
|
|
|
3184
3189
|
injectedFiles: baseInput.injectedFiles,
|
|
3185
3190
|
requestTools: baseInput.requestTools ?? baseInput.promptTools,
|
|
3186
3191
|
toolChoice: baseInput.toolChoice ?? "auto",
|
|
3187
|
-
disableThinking: baseInput.disableThinking ?? false,
|
|
3188
3192
|
...baseInput.customInstructions ? { customInstructions: baseInput.customInstructions } : {},
|
|
3189
3193
|
...baseInput.skills && baseInput.skills.length > 0 ? { skills: baseInput.skills } : {}
|
|
3190
3194
|
});
|
|
@@ -3276,7 +3280,7 @@ async function describeImageFromDataUrl(dataUrl, visionModel, options) {
|
|
|
3276
3280
|
import { createHash as createHash2 } from "crypto";
|
|
3277
3281
|
async function loadVisionModelFromGlobalConfig() {
|
|
3278
3282
|
try {
|
|
3279
|
-
const { loadGlobalConfig, getVisionFallback } = await import("./config-
|
|
3283
|
+
const { loadGlobalConfig, getVisionFallback } = await import("./config-FAT5XRFB.js");
|
|
3280
3284
|
const runtimeConfig = getRuntimeConfig();
|
|
3281
3285
|
const mode = runtimeConfig.mode ?? "production";
|
|
3282
3286
|
const globalConfig = await loadGlobalConfig(mode);
|
|
@@ -3639,7 +3643,6 @@ async function executeSubAgent(options) {
|
|
|
3639
3643
|
injectedFiles: input.injectedFiles,
|
|
3640
3644
|
requestTools: input.promptTools,
|
|
3641
3645
|
toolChoice: input.toolChoice,
|
|
3642
|
-
disableThinking: true,
|
|
3643
3646
|
...instructionContent ? { customInstructions: instructionContent } : {},
|
|
3644
3647
|
...skills.length > 0 ? { skills } : {}
|
|
3645
3648
|
}),
|
|
@@ -3730,7 +3733,7 @@ var callSubAgentTool = {
|
|
|
3730
3733
|
};
|
|
3731
3734
|
}
|
|
3732
3735
|
try {
|
|
3733
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
3736
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-TJGSHOAR.js");
|
|
3734
3737
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
3735
3738
|
const turnMetrics = new TurnMetrics();
|
|
3736
3739
|
const result = await executeSubAgent({
|
|
@@ -4738,6 +4741,7 @@ export {
|
|
|
4738
4741
|
buildBasePrompt,
|
|
4739
4742
|
buildTopLevelSystemPrompt,
|
|
4740
4743
|
buildAgentReminder,
|
|
4744
|
+
buildAgentSmallReminder,
|
|
4741
4745
|
WORKFLOW_KICKOFF_PROMPT,
|
|
4742
4746
|
COMPACTION_PROMPT,
|
|
4743
4747
|
streamLLMPure,
|
|
@@ -4781,4 +4785,4 @@ export {
|
|
|
4781
4785
|
getToolRegistryForAgent,
|
|
4782
4786
|
createToolRegistry
|
|
4783
4787
|
};
|
|
4784
|
-
//# sourceMappingURL=chunk-
|
|
4788
|
+
//# sourceMappingURL=chunk-5RP2ZU2G.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
injectWorkflowKickoffIfNeeded,
|
|
4
4
|
runAgentTurn,
|
|
5
5
|
runChatTurn
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DBDMMSCM.js";
|
|
7
7
|
import {
|
|
8
8
|
COMPACTION_PROMPT,
|
|
9
9
|
TurnMetrics,
|
|
@@ -59,13 +59,16 @@ import {
|
|
|
59
59
|
skillExists,
|
|
60
60
|
spawnShellProcess,
|
|
61
61
|
streamLLMPure
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-5RP2ZU2G.js";
|
|
63
63
|
import {
|
|
64
64
|
getPathSeparator,
|
|
65
65
|
getPlatformShell,
|
|
66
66
|
isAbsolutePath,
|
|
67
67
|
onProcessEvent
|
|
68
68
|
} from "./chunk-PBGOZMVY.js";
|
|
69
|
+
import {
|
|
70
|
+
getProject
|
|
71
|
+
} from "./chunk-XAMAYRDA.js";
|
|
69
72
|
import {
|
|
70
73
|
createSession,
|
|
71
74
|
deleteSession,
|
|
@@ -94,11 +97,11 @@ import {
|
|
|
94
97
|
updateSessionMetadata,
|
|
95
98
|
updateSessionProvider,
|
|
96
99
|
updateSessionRunning
|
|
97
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-DHAKJSE7.js";
|
|
98
101
|
import {
|
|
99
102
|
buildMessagesFromStoredEvents,
|
|
100
103
|
foldPendingConfirmations
|
|
101
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-ITWVFGFV.js";
|
|
102
105
|
import {
|
|
103
106
|
createChatErrorMessage,
|
|
104
107
|
createChatMessageMessage,
|
|
@@ -118,9 +121,6 @@ import {
|
|
|
118
121
|
EventEmitter,
|
|
119
122
|
provideAnswer
|
|
120
123
|
} from "./chunk-BJYPTN5S.js";
|
|
121
|
-
import {
|
|
122
|
-
getProject
|
|
123
|
-
} from "./chunk-XAMAYRDA.js";
|
|
124
124
|
import {
|
|
125
125
|
initDatabase
|
|
126
126
|
} from "./chunk-FBGWG4N6.js";
|
|
@@ -130,30 +130,30 @@ import {
|
|
|
130
130
|
import {
|
|
131
131
|
createServerMessage
|
|
132
132
|
} from "./chunk-BVHFMAVN.js";
|
|
133
|
+
import {
|
|
134
|
+
getGlobalConfigDir
|
|
135
|
+
} from "./chunk-CQGTEGKL.js";
|
|
133
136
|
import {
|
|
134
137
|
createProviderManager,
|
|
135
138
|
parseDefaultModelSelection
|
|
136
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-YLQGD5SE.js";
|
|
137
140
|
import {
|
|
138
141
|
SessionNotFoundError,
|
|
139
142
|
createLLMClient,
|
|
140
143
|
detectModel,
|
|
141
144
|
getLlmStatus
|
|
142
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-SW7MQGY3.js";
|
|
143
146
|
import {
|
|
144
147
|
detectBackend,
|
|
145
148
|
ensureVersionPrefix,
|
|
146
149
|
getBackendDisplayName,
|
|
147
150
|
getModelProfile,
|
|
148
151
|
modelSupportsVision
|
|
149
|
-
} from "./chunk-
|
|
152
|
+
} from "./chunk-LXX2CPM5.js";
|
|
150
153
|
import {
|
|
151
154
|
logger,
|
|
152
155
|
setLogLevel
|
|
153
156
|
} from "./chunk-K44MW7JJ.js";
|
|
154
|
-
import {
|
|
155
|
-
getGlobalConfigDir
|
|
156
|
-
} from "./chunk-CQGTEGKL.js";
|
|
157
157
|
|
|
158
158
|
// src/server/index.ts
|
|
159
159
|
import express from "express";
|
|
@@ -2851,7 +2851,8 @@ function createWebSocketServer(httpServer, config4, getLLMClient, getActiveProvi
|
|
|
2851
2851
|
...config4.llm,
|
|
2852
2852
|
baseUrl,
|
|
2853
2853
|
model: session.providerModel,
|
|
2854
|
-
...provider.apiKey && { apiKey: provider.apiKey }
|
|
2854
|
+
...provider.apiKey && { apiKey: provider.apiKey },
|
|
2855
|
+
...provider.thinkingField && { thinkingField: provider.thinkingField }
|
|
2855
2856
|
}
|
|
2856
2857
|
};
|
|
2857
2858
|
const client = createLLMClient(sessionConfig);
|
|
@@ -5282,8 +5283,7 @@ ${summary}`,
|
|
|
5282
5283
|
metadataEntries: eventState.metadataEntries,
|
|
5283
5284
|
contextWindows: [],
|
|
5284
5285
|
// Derived from events, not stored separately
|
|
5285
|
-
executionState: eventState.
|
|
5286
|
-
lastModeWithReminder: eventState.lastModeWithReminder,
|
|
5286
|
+
executionState: eventState.cachedSystemPrompt || hasCachedPrompt ? {
|
|
5287
5287
|
cachedSystemPrompt: cachedData?.systemPrompt ?? eventState.cachedSystemPrompt,
|
|
5288
5288
|
dynamicContextHash: cachedData?.hash ?? eventState.dynamicContextHash
|
|
5289
5289
|
} : null
|
|
@@ -5831,7 +5831,7 @@ import { Router as Router6 } from "express";
|
|
|
5831
5831
|
import { spawn as spawn5 } from "child_process";
|
|
5832
5832
|
|
|
5833
5833
|
// src/constants.ts
|
|
5834
|
-
var VERSION = "2.0.0-beta.
|
|
5834
|
+
var VERSION = "2.0.0-beta.13";
|
|
5835
5835
|
|
|
5836
5836
|
// src/server/routes/auto-update.ts
|
|
5837
5837
|
var updateInProgress = false;
|
|
@@ -6134,7 +6134,7 @@ async function createServerHandle(config4) {
|
|
|
6134
6134
|
res.json({ project });
|
|
6135
6135
|
});
|
|
6136
6136
|
app.get("/api/sessions", async (req, res) => {
|
|
6137
|
-
const { getRecentUserPromptsForSession } = await import("./events-
|
|
6137
|
+
const { getRecentUserPromptsForSession } = await import("./events-R7FRQEBE.js");
|
|
6138
6138
|
const projectId = req.query["projectId"];
|
|
6139
6139
|
const limit = Math.min(parseInt(req.query["limit"]) || 20, 100);
|
|
6140
6140
|
const offset = parseInt(req.query["offset"]) || 0;
|
|
@@ -6167,8 +6167,8 @@ async function createServerHandle(config4) {
|
|
|
6167
6167
|
res.status(201).json({ session });
|
|
6168
6168
|
});
|
|
6169
6169
|
app.get("/api/sessions/:id", async (req, res) => {
|
|
6170
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
6171
|
-
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-
|
|
6170
|
+
const { getEventStore: getEventStore2 } = await import("./events-R7FRQEBE.js");
|
|
6171
|
+
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-YOCGTZYH.js");
|
|
6172
6172
|
const session = sessionManager.getSession(req.params.id);
|
|
6173
6173
|
if (!session) {
|
|
6174
6174
|
return res.status(404).json({ error: "Session not found" });
|
|
@@ -6198,8 +6198,8 @@ async function createServerHandle(config4) {
|
|
|
6198
6198
|
res.json({ success: true });
|
|
6199
6199
|
});
|
|
6200
6200
|
app.post("/api/sessions/:id/provider", async (req, res) => {
|
|
6201
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
6202
|
-
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-
|
|
6201
|
+
const { getEventStore: getEventStore2 } = await import("./events-R7FRQEBE.js");
|
|
6202
|
+
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-YOCGTZYH.js");
|
|
6203
6203
|
const sessionId = req.params.id;
|
|
6204
6204
|
const session = sessionManager.getSession(sessionId);
|
|
6205
6205
|
if (!session) {
|
|
@@ -6210,7 +6210,7 @@ async function createServerHandle(config4) {
|
|
|
6210
6210
|
return res.status(400).json({ error: "providerId is required" });
|
|
6211
6211
|
}
|
|
6212
6212
|
sessionManager.setSessionProvider(sessionId, providerId, model ?? "auto");
|
|
6213
|
-
const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-
|
|
6213
|
+
const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-FAT5XRFB.js");
|
|
6214
6214
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
6215
6215
|
const updatedConfig = setDefaultModelSelection(globalConfig, providerId, model ?? "auto");
|
|
6216
6216
|
await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
|
|
@@ -6241,8 +6241,8 @@ async function createServerHandle(config4) {
|
|
|
6241
6241
|
res.json({ success: true });
|
|
6242
6242
|
});
|
|
6243
6243
|
app.put("/api/sessions/:id/mode", async (req, res) => {
|
|
6244
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
6245
|
-
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-
|
|
6244
|
+
const { getEventStore: getEventStore2 } = await import("./events-R7FRQEBE.js");
|
|
6245
|
+
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-YOCGTZYH.js");
|
|
6246
6246
|
const sessionId = req.params.id;
|
|
6247
6247
|
const session = sessionManager.getSession(sessionId);
|
|
6248
6248
|
if (!session) {
|
|
@@ -6298,13 +6298,13 @@ async function createServerHandle(config4) {
|
|
|
6298
6298
|
if (!callId || approved === void 0) {
|
|
6299
6299
|
return res.status(400).json({ error: "callId and approved are required" });
|
|
6300
6300
|
}
|
|
6301
|
-
const { providePathConfirmation } = await import("./tools-
|
|
6301
|
+
const { providePathConfirmation } = await import("./tools-TJGSHOAR.js");
|
|
6302
6302
|
const result = providePathConfirmation(callId, approved, alwaysAllow);
|
|
6303
6303
|
if (!result.found) {
|
|
6304
6304
|
return res.status(404).json({ error: "No pending path confirmation with that ID" });
|
|
6305
6305
|
}
|
|
6306
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
6307
|
-
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2, foldPendingConfirmations: foldPendingConfirmations2 } = await import("./folding-
|
|
6306
|
+
const { getEventStore: getEventStore2 } = await import("./events-R7FRQEBE.js");
|
|
6307
|
+
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2, foldPendingConfirmations: foldPendingConfirmations2 } = await import("./folding-YOCGTZYH.js");
|
|
6308
6308
|
const { createSessionStateMessage: createSessionStateMessage2 } = await import("./protocol-CN24IKQN.js");
|
|
6309
6309
|
const eventStore = getEventStore2();
|
|
6310
6310
|
const events = eventStore.getEvents(sessionId);
|
|
@@ -6322,7 +6322,7 @@ async function createServerHandle(config4) {
|
|
|
6322
6322
|
if (!callId || !answer) {
|
|
6323
6323
|
return res.status(400).json({ error: "callId and answer are required" });
|
|
6324
6324
|
}
|
|
6325
|
-
const { provideAnswer: provideAnswer2 } = await import("./tools-
|
|
6325
|
+
const { provideAnswer: provideAnswer2 } = await import("./tools-TJGSHOAR.js");
|
|
6326
6326
|
const found = provideAnswer2(callId, answer);
|
|
6327
6327
|
if (!found) {
|
|
6328
6328
|
return res.status(404).json({ error: "No pending question with that ID" });
|
|
@@ -6358,14 +6358,14 @@ async function createServerHandle(config4) {
|
|
|
6358
6358
|
if (!session) {
|
|
6359
6359
|
return res.status(404).json({ error: "Session not found" });
|
|
6360
6360
|
}
|
|
6361
|
-
const { stopSessionExecution } = await import("./chat-handler-
|
|
6362
|
-
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-
|
|
6361
|
+
const { stopSessionExecution } = await import("./chat-handler-DKX2XFHA.js");
|
|
6362
|
+
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-TJGSHOAR.js");
|
|
6363
6363
|
stopSessionExecution(sessionId, sessionManager);
|
|
6364
6364
|
abortSession(sessionId);
|
|
6365
6365
|
cancelQuestionsForSession(sessionId, "Session stopped by user");
|
|
6366
6366
|
cancelPathConfirmationsForSession(sessionId, "Session stopped by user");
|
|
6367
6367
|
sessionManager.clearMessageQueue(sessionId);
|
|
6368
|
-
const eventStore = (await import("./events-
|
|
6368
|
+
const eventStore = (await import("./events-R7FRQEBE.js")).getEventStore();
|
|
6369
6369
|
eventStore.append(sessionId, { type: "running.changed", data: { isRunning: false } });
|
|
6370
6370
|
res.json({ success: true });
|
|
6371
6371
|
});
|
|
@@ -6379,7 +6379,7 @@ async function createServerHandle(config4) {
|
|
|
6379
6379
|
if (typeof messageIndex !== "number" || messageIndex < 0) {
|
|
6380
6380
|
return res.status(400).json({ error: "messageIndex must be a non-negative number" });
|
|
6381
6381
|
}
|
|
6382
|
-
const { truncateSessionMessages } = await import("./events-
|
|
6382
|
+
const { truncateSessionMessages } = await import("./events-R7FRQEBE.js");
|
|
6383
6383
|
truncateSessionMessages(sessionId, messageIndex);
|
|
6384
6384
|
res.json({ success: true });
|
|
6385
6385
|
});
|
|
@@ -6397,7 +6397,7 @@ async function createServerHandle(config4) {
|
|
|
6397
6397
|
if (!msg) {
|
|
6398
6398
|
return res.status(400).json({ error: "Message not found at this index" });
|
|
6399
6399
|
}
|
|
6400
|
-
const { truncateSessionMessages } = await import("./events-
|
|
6400
|
+
const { truncateSessionMessages } = await import("./events-R7FRQEBE.js");
|
|
6401
6401
|
truncateSessionMessages(sessionId, messageIndex - 1);
|
|
6402
6402
|
sessionManager.queueMessage(sessionId, "asap", msg.content, msg.attachments, msg.messageKind);
|
|
6403
6403
|
res.json({ success: true });
|
|
@@ -6469,7 +6469,7 @@ async function createServerHandle(config4) {
|
|
|
6469
6469
|
let visionFallback;
|
|
6470
6470
|
let globalWorkdir;
|
|
6471
6471
|
try {
|
|
6472
|
-
const { loadGlobalConfig, getVisionFallback } = await import("./config-
|
|
6472
|
+
const { loadGlobalConfig, getVisionFallback } = await import("./config-FAT5XRFB.js");
|
|
6473
6473
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
6474
6474
|
const fallback = getVisionFallback(globalConfig);
|
|
6475
6475
|
if (fallback) {
|
|
@@ -6542,13 +6542,78 @@ async function createServerHandle(config4) {
|
|
|
6542
6542
|
});
|
|
6543
6543
|
}
|
|
6544
6544
|
});
|
|
6545
|
+
app.get("/api/providers/models", async (req, res) => {
|
|
6546
|
+
const url = req.query["url"];
|
|
6547
|
+
if (!url) return res.status(400).json({ error: "url is required" });
|
|
6548
|
+
try {
|
|
6549
|
+
const { fetchModelsWithContext } = await import("./provider-manager-IP3HOGNB.js");
|
|
6550
|
+
const models = await fetchModelsWithContext(url);
|
|
6551
|
+
if (models.length === 0) {
|
|
6552
|
+
return res.status(404).json({ error: `No models found at ${url}/v1/models`, url });
|
|
6553
|
+
}
|
|
6554
|
+
res.json({
|
|
6555
|
+
models: models.map((m) => ({
|
|
6556
|
+
id: m.id,
|
|
6557
|
+
contextWindow: m.contextWindow,
|
|
6558
|
+
defaultTemperature: m.defaultTemperature,
|
|
6559
|
+
defaultTopP: m.defaultTopP,
|
|
6560
|
+
defaultTopK: m.defaultTopK,
|
|
6561
|
+
defaultMaxTokens: m.defaultMaxTokens
|
|
6562
|
+
})),
|
|
6563
|
+
url
|
|
6564
|
+
});
|
|
6565
|
+
} catch (error) {
|
|
6566
|
+
res.status(400).json({
|
|
6567
|
+
error: `Failed to fetch models from ${url}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
6568
|
+
url
|
|
6569
|
+
});
|
|
6570
|
+
}
|
|
6571
|
+
});
|
|
6572
|
+
app.post("/api/providers/test-params", async (req, res) => {
|
|
6573
|
+
const { url, params, apiKey } = req.body;
|
|
6574
|
+
if (!url) return res.status(400).json({ error: "url is required" });
|
|
6575
|
+
try {
|
|
6576
|
+
const headers = { "Content-Type": "application/json" };
|
|
6577
|
+
if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
|
|
6578
|
+
const body = {
|
|
6579
|
+
model: "deepseek-v4-flash",
|
|
6580
|
+
messages: [{ role: "user", content: "say hi in one word" }],
|
|
6581
|
+
max_tokens: 8e3,
|
|
6582
|
+
...params
|
|
6583
|
+
};
|
|
6584
|
+
const response = await fetch(`${url}/v1/chat/completions`, {
|
|
6585
|
+
method: "POST",
|
|
6586
|
+
headers,
|
|
6587
|
+
body: JSON.stringify(body),
|
|
6588
|
+
signal: AbortSignal.timeout(15e3)
|
|
6589
|
+
});
|
|
6590
|
+
if (!response.ok) {
|
|
6591
|
+
const errorBody = await response.text();
|
|
6592
|
+
return res.status(400).json({ error: `API error (${response.status}): ${errorBody.slice(0, 200)}` });
|
|
6593
|
+
}
|
|
6594
|
+
const data = await response.json();
|
|
6595
|
+
const message = data.choices?.[0]?.message ?? {};
|
|
6596
|
+
res.json({ success: true, message, raw: JSON.stringify(data, null, 2).slice(0, 2e3) });
|
|
6597
|
+
} catch (error) {
|
|
6598
|
+
res.status(400).json({ error: error instanceof Error ? error.message : "Request failed" });
|
|
6599
|
+
}
|
|
6600
|
+
});
|
|
6545
6601
|
app.post("/api/providers", async (req, res) => {
|
|
6546
|
-
const {
|
|
6602
|
+
const {
|
|
6603
|
+
name,
|
|
6604
|
+
url,
|
|
6605
|
+
backend,
|
|
6606
|
+
apiKey,
|
|
6607
|
+
model,
|
|
6608
|
+
isLocal,
|
|
6609
|
+
thinkingField,
|
|
6610
|
+
models: modelConfigs
|
|
6611
|
+
} = req.body;
|
|
6547
6612
|
if (!name || !url || !backend) {
|
|
6548
6613
|
return res.status(400).json({ error: "name, url, and backend are required" });
|
|
6549
6614
|
}
|
|
6550
6615
|
try {
|
|
6551
|
-
const { loadGlobalConfig, saveGlobalConfig, addProvider, setDefaultModelSelection } = await import("./config-
|
|
6616
|
+
const { loadGlobalConfig, saveGlobalConfig, addProvider, setDefaultModelSelection } = await import("./config-FAT5XRFB.js");
|
|
6552
6617
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
6553
6618
|
const providerBackend = backend;
|
|
6554
6619
|
const configWithProvider = addProvider(globalConfig, {
|
|
@@ -6557,7 +6622,16 @@ async function createServerHandle(config4) {
|
|
|
6557
6622
|
backend: providerBackend,
|
|
6558
6623
|
apiKey,
|
|
6559
6624
|
...isLocal !== void 0 ? { isLocal } : {},
|
|
6560
|
-
|
|
6625
|
+
...thinkingField ? { thinkingField } : {},
|
|
6626
|
+
models: modelConfigs?.length ? modelConfigs.map((m) => ({
|
|
6627
|
+
id: m.id,
|
|
6628
|
+
contextWindow: m.contextWindow,
|
|
6629
|
+
source: "user",
|
|
6630
|
+
...m.supportsVision !== void 0 ? { supportsVision: m.supportsVision } : {},
|
|
6631
|
+
...m.thinkingEnabled !== void 0 ? { thinkingEnabled: m.thinkingEnabled } : {},
|
|
6632
|
+
...m.thinkingLevel ? { thinkingLevel: m.thinkingLevel } : {},
|
|
6633
|
+
...m.nonThinkingEnabled !== void 0 ? { nonThinkingEnabled: m.nonThinkingEnabled } : {}
|
|
6634
|
+
})) : model ? [{ id: model, contextWindow: 2e5, source: "user" }] : [],
|
|
6561
6635
|
isActive: true
|
|
6562
6636
|
});
|
|
6563
6637
|
const finalConfig = setDefaultModelSelection(
|
|
@@ -6582,7 +6656,7 @@ async function createServerHandle(config4) {
|
|
|
6582
6656
|
app.post("/api/init/config", async (req, res) => {
|
|
6583
6657
|
const { workdir, visionFallback } = req.body;
|
|
6584
6658
|
try {
|
|
6585
|
-
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-
|
|
6659
|
+
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-FAT5XRFB.js");
|
|
6586
6660
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
6587
6661
|
const updatedConfig = {
|
|
6588
6662
|
...globalConfig,
|
|
@@ -6610,7 +6684,7 @@ async function createServerHandle(config4) {
|
|
|
6610
6684
|
});
|
|
6611
6685
|
app.delete("/api/providers/:id", async (req, res) => {
|
|
6612
6686
|
const { id } = req.params;
|
|
6613
|
-
const { loadGlobalConfig, saveGlobalConfig, removeProvider } = await import("./config-
|
|
6687
|
+
const { loadGlobalConfig, saveGlobalConfig, removeProvider } = await import("./config-FAT5XRFB.js");
|
|
6614
6688
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
6615
6689
|
const updatedConfig = removeProvider(globalConfig, id);
|
|
6616
6690
|
await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
|
|
@@ -6621,7 +6695,7 @@ async function createServerHandle(config4) {
|
|
|
6621
6695
|
const { id } = req.params;
|
|
6622
6696
|
const { isLocal } = req.body;
|
|
6623
6697
|
try {
|
|
6624
|
-
const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-
|
|
6698
|
+
const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-FAT5XRFB.js");
|
|
6625
6699
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
6626
6700
|
const provider = globalConfig.providers.find((p) => p.id === id);
|
|
6627
6701
|
if (!provider) {
|
|
@@ -6637,6 +6711,52 @@ async function createServerHandle(config4) {
|
|
|
6637
6711
|
res.status(500).json({ error: error instanceof Error ? error.message : "Failed to update provider" });
|
|
6638
6712
|
}
|
|
6639
6713
|
});
|
|
6714
|
+
app.put("/api/providers/:id", async (req, res) => {
|
|
6715
|
+
const { id } = req.params;
|
|
6716
|
+
const {
|
|
6717
|
+
name,
|
|
6718
|
+
url,
|
|
6719
|
+
backend,
|
|
6720
|
+
apiKey,
|
|
6721
|
+
isLocal,
|
|
6722
|
+
thinkingField,
|
|
6723
|
+
models: modelConfigs
|
|
6724
|
+
} = req.body;
|
|
6725
|
+
try {
|
|
6726
|
+
const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-FAT5XRFB.js");
|
|
6727
|
+
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
6728
|
+
const provider = globalConfig.providers.find((p) => p.id === id);
|
|
6729
|
+
if (!provider) {
|
|
6730
|
+
return res.status(404).json({ error: "Provider not found" });
|
|
6731
|
+
}
|
|
6732
|
+
const updates = {};
|
|
6733
|
+
if (name !== void 0) updates["name"] = name;
|
|
6734
|
+
if (url !== void 0) updates["url"] = url;
|
|
6735
|
+
if (backend !== void 0) updates["backend"] = backend;
|
|
6736
|
+
if (apiKey !== void 0) updates["apiKey"] = apiKey || void 0;
|
|
6737
|
+
if (isLocal !== void 0) updates["isLocal"] = isLocal;
|
|
6738
|
+
if (thinkingField !== void 0) updates["thinkingField"] = thinkingField || void 0;
|
|
6739
|
+
if (modelConfigs !== void 0) {
|
|
6740
|
+
updates["models"] = modelConfigs.map((m) => ({
|
|
6741
|
+
id: m.id,
|
|
6742
|
+
contextWindow: m.contextWindow,
|
|
6743
|
+
source: "user",
|
|
6744
|
+
...m.supportsVision !== void 0 ? { supportsVision: m.supportsVision } : {},
|
|
6745
|
+
...m.thinkingEnabled !== void 0 ? { thinkingEnabled: m.thinkingEnabled } : {},
|
|
6746
|
+
...m.thinkingLevel ? { thinkingLevel: m.thinkingLevel } : {},
|
|
6747
|
+
...m.nonThinkingEnabled !== void 0 ? { nonThinkingEnabled: m.nonThinkingEnabled } : {},
|
|
6748
|
+
...m.thinkingExtraKwargs ? { thinkingExtraKwargs: m.thinkingExtraKwargs } : {},
|
|
6749
|
+
...m.nonThinkingExtraKwargs ? { nonThinkingExtraKwargs: m.nonThinkingExtraKwargs } : {}
|
|
6750
|
+
}));
|
|
6751
|
+
}
|
|
6752
|
+
const updatedConfig = updateProvider(globalConfig, id, updates);
|
|
6753
|
+
await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
|
|
6754
|
+
providerManager.setProviders(updatedConfig.providers, updatedConfig.defaultModelSelection ?? void 0);
|
|
6755
|
+
res.json({ success: true, provider: updatedConfig.providers.find((p) => p.id === id) });
|
|
6756
|
+
} catch (error) {
|
|
6757
|
+
res.status(500).json({ error: error instanceof Error ? error.message : "Failed to update provider" });
|
|
6758
|
+
}
|
|
6759
|
+
});
|
|
6640
6760
|
app.get("/api/providers/:id/models", async (req, res) => {
|
|
6641
6761
|
const { id } = req.params;
|
|
6642
6762
|
const models = await providerManager.getProviderModels(id);
|
|
@@ -6650,7 +6770,7 @@ async function createServerHandle(config4) {
|
|
|
6650
6770
|
return res.status(400).json({ error: result.error });
|
|
6651
6771
|
}
|
|
6652
6772
|
const llmClient = getLLMClient();
|
|
6653
|
-
const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-
|
|
6773
|
+
const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-FAT5XRFB.js");
|
|
6654
6774
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
6655
6775
|
const updatedConfig = setDefaultModelSelection(globalConfig, id, llmClient.getModel());
|
|
6656
6776
|
await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
|
|
@@ -6669,7 +6789,7 @@ async function createServerHandle(config4) {
|
|
|
6669
6789
|
modelId,
|
|
6670
6790
|
body
|
|
6671
6791
|
});
|
|
6672
|
-
const hasFullSettings = body.temperature !== void 0 || body.topP !== void 0 || body.topK !== void 0 || body.maxTokens !== void 0;
|
|
6792
|
+
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;
|
|
6673
6793
|
let result;
|
|
6674
6794
|
if (hasFullSettings) {
|
|
6675
6795
|
result = await providerManager.updateModelSettings(id, modelId, body);
|
|
@@ -6681,7 +6801,7 @@ async function createServerHandle(config4) {
|
|
|
6681
6801
|
if (!result.success) {
|
|
6682
6802
|
return res.status(400).json({ error: result.error });
|
|
6683
6803
|
}
|
|
6684
|
-
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-
|
|
6804
|
+
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-FAT5XRFB.js");
|
|
6685
6805
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
6686
6806
|
const updatedProviders = providerManager.getProviders();
|
|
6687
6807
|
const updatedConfig = {
|
|
@@ -6895,7 +7015,7 @@ async function createServerHandle(config4) {
|
|
|
6895
7015
|
providerManager
|
|
6896
7016
|
);
|
|
6897
7017
|
const wss = wssExports.wss;
|
|
6898
|
-
const { QueueProcessor } = await import("./processor-
|
|
7018
|
+
const { QueueProcessor } = await import("./processor-5T3CXD5I.js");
|
|
6899
7019
|
const queueProcessor = new QueueProcessor({
|
|
6900
7020
|
sessionManager,
|
|
6901
7021
|
providerManager,
|
|
@@ -6967,4 +7087,4 @@ export {
|
|
|
6967
7087
|
createServerHandle,
|
|
6968
7088
|
createServer
|
|
6969
7089
|
};
|
|
6970
|
-
//# sourceMappingURL=chunk-
|
|
7090
|
+
//# sourceMappingURL=chunk-BNFQMAH6.js.map
|