openfox 2.0.112 → 2.0.114
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 +49 -0
- package/README.md +1 -0
- package/dist/CHANGELOG.md +49 -0
- package/dist/agent-defaults/builder.agent.md +1 -0
- package/dist/agent-defaults/planner.agent.md +1 -0
- package/dist/{backend-P3GHHLHJ.js → backend-LVYHLGQJ.js} +2 -2
- package/dist/{chat-handler-BYXZIIV3.js → chat-handler-KWXRSWXZ.js} +32 -26
- package/dist/{chunk-XWNCKIPO.js → chunk-2XD65L7M.js} +2 -2
- package/dist/{chunk-C5NQF2K4.js → chunk-3O77NT4T.js} +29 -10
- package/dist/{chunk-XCK5IBO4.js → chunk-7GWARYQC.js} +60 -1042
- package/dist/{chunk-YHEQTVFV.js → chunk-AZHWLLPP.js} +1 -1
- package/dist/{chunk-FFPCVN5M.js → chunk-BZVW77PI.js} +4 -4
- package/dist/{chunk-SDGNV45R.js → chunk-FW4NDUBL.js} +15 -15
- package/dist/{chunk-Z56SEG4Z.js → chunk-GUHHUDNL.js} +6 -6
- package/dist/{chunk-RT2A2RRL.js → chunk-HP5CIB66.js} +2 -2
- package/dist/{chunk-UAF2FOI5.js → chunk-HV6IALXF.js} +7 -7
- package/dist/{chunk-SYJMUIRC.js → chunk-I7FY2LTR.js} +2 -2
- package/dist/{chunk-RISQXU32.js → chunk-JP7NM545.js} +2 -2
- package/dist/{chunk-NB2D6I64.js → chunk-JXLRL5JR.js} +5 -5
- package/dist/{chunk-RAKPI4OE.js → chunk-K733B5T2.js} +264 -27
- package/dist/{chunk-C372UH7N.js → chunk-KSXCOHHW.js} +18 -20
- package/dist/{chunk-JDT63SSP.js → chunk-L63Q4JQJ.js} +3 -3
- package/dist/{chunk-ERYUSG5C.js → chunk-LXYPMFTH.js} +3 -3
- package/dist/{chunk-FSYRANYR.js → chunk-MUSPWEBB.js} +4 -5
- package/dist/chunk-NCZRWCJN.js +7 -0
- package/dist/{chunk-JR54MDZI.js → chunk-NLO64UE3.js} +2 -2
- package/dist/{chunk-3UILDGOO.js → chunk-NWJLWLKF.js} +8 -8
- package/dist/chunk-OSXPQSLW.js +128 -0
- package/dist/chunk-OTYAEEX3.js +1081 -0
- package/dist/{chunk-PCC4DBPF.js → chunk-OXSTNSCF.js} +2 -2
- package/dist/{chunk-33Q7LCVD.js → chunk-P5UANBBX.js} +6 -4
- package/dist/{chunk-LCQ5AN6Y.js → chunk-PBW3YC3G.js} +89 -1
- package/dist/{chunk-IYTDCPEQ.js → chunk-QD7MRMCH.js} +352 -333
- package/dist/{chunk-N4RTAGFY.js → chunk-SA34STZ6.js} +2 -2
- package/dist/{chunk-FR5LUTLQ.js → chunk-SBSUDHL4.js} +10 -6
- package/dist/{chunk-6FPGJR7O.js → chunk-SFZGMB2G.js} +2 -2
- package/dist/{chunk-SVJFMZ2Q.js → chunk-TKKP56QK.js} +11 -4
- package/dist/{chunk-JNHKKUGJ.js → chunk-UPBWEHIL.js} +30 -148
- package/dist/{chunk-QGXLZZBS.js → chunk-UTIQ7OO5.js} +2 -2
- package/dist/{chunk-RKMP74BB.js → chunk-VPVLO436.js} +4 -4
- package/dist/chunk-W77NBJAZ.js +957 -0
- package/dist/{chunk-P45RJGOT.js → chunk-X25Q6RAV.js} +1 -1
- package/dist/{chunk-BOSKQI62.js → chunk-YGJIK3CG.js} +4 -4
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{client-QNQTX5EA.js → client-EM7ISGUP.js} +6 -6
- package/dist/{compactor-X2KZ3XFU.js → compactor-V3LR7APW.js} +13 -12
- package/dist/{config-TW5FHQEM.js → config-EAB3V4QK.js} +2 -2
- package/dist/{dynamic-context-ZRQO2FJN.js → dynamic-context-MVGOF5V2.js} +10 -9
- package/dist/{events-Y6XXQYFG.js → events-PI7IMPHT.js} +8 -7
- package/dist/{folding-Z4GNWRC3.js → folding-FO57K4JM.js} +6 -5
- package/dist/http-client-33EZ3BLR.js +11 -0
- package/dist/{inspect-proxy-N42Z5TOG.js → inspect-proxy-NHKQQ2CD.js} +4 -4
- package/dist/launch-L5ROVNI3.js +52 -0
- package/dist/{manager-HCMDFEQH.js → manager-66YAEO7K.js} +5 -5
- package/dist/{model-overrides-O3ZYKFP7.js → model-overrides-L53PZNZA.js} +4 -4
- package/dist/orchestrator-XK5K3RPL.js +63 -0
- package/dist/package.json +7 -6
- package/dist/{path-security-525YLND3.js → path-security-RSEI3YKB.js} +12 -11
- package/dist/{platform-MEQUWG6U.js → platform-WA4GK5BO.js} +4 -4
- package/dist/{processor-UN4H4V7F.js → processor-WDZSFBVO.js} +31 -25
- package/dist/{project-creator-BVA55HY6.js → project-creator-676WQXVI.js} +3 -3
- package/dist/{projects-PQXME5S4.js → projects-SSBWIYL4.js} +3 -3
- package/dist/{protocol-D6MISQyz.d.ts → protocol-BzHs024-.d.ts} +23 -3
- package/dist/{protocol-FTHAR2YL.js → protocol-RKSWKNXI.js} +3 -3
- package/dist/provider/index.d.ts +4 -4
- package/dist/{provider-3R4X62LW.js → provider-PLIWRBCF.js} +9 -9
- package/dist/{provider-manager-W5N4XRE5.js → provider-manager-2QSJTPWS.js} +7 -7
- package/dist/{registry-74KPZ5NV.js → registry-ZP4TN2IN.js} +5 -4
- package/dist/{serve-WHFUNQ6Z.js → serve-MZ3BCCWC.js} +36 -33
- package/dist/server/index.d.ts +8 -5
- package/dist/server/index.js +35 -32
- package/dist/server-EPXODFMB.js +55 -0
- package/dist/service-54PGIPDQ.js +25 -0
- package/dist/{session-overrides-XH6I3COP.js → session-overrides-LXN6W7SA.js} +7 -6
- package/dist/{sessions-D772YTWL.js → sessions-CHPVUG6H.js} +8 -5
- package/dist/{settings-KO6DSJLD.js → settings-NEBM3GQX.js} +3 -3
- package/dist/shared/index.d.ts +3 -3
- package/dist/shared/index.js +1 -1
- package/dist/skill-defaults/workflows/SKILL.md +517 -0
- package/dist/tasks-TJXG2V3U.js +217 -0
- package/dist/{tools-HTUTYMKI.js → tools-CIM26IFB.js} +31 -23
- package/dist/{types-BMEOlLT0.d.ts → types-CMtHpDWT.d.ts} +81 -1
- package/dist/{types-D0TgGL3t.d.ts → types-CbggXFvR.d.ts} +1 -1
- package/dist/{update-BRUFGGTW.js → update-UZBBO42X.js} +2 -2
- package/dist/web/assets/{index-nS1p0g8O.css → index-BmILAZrT.css} +1 -1
- package/dist/web/assets/index-rZHXkfMq.js +324 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/dist/workflow-defaults/default.workflow.json +45 -5
- package/dist/{workspace-YDUQZ3HC.js → workspace-2XODU4YJ.js} +4 -4
- package/package.json +7 -6
- package/dist/chunk-P5AA7OYJ.js +0 -7
- package/dist/http-client-2GDKHZIG.js +0 -11
- package/dist/orchestrator-P5EUMC7E.js +0 -57
- package/dist/server-7MOOJR2N.js +0 -48
- package/dist/web/assets/index-Dukvfqm-.js +0 -323
|
@@ -7,32 +7,19 @@ import {
|
|
|
7
7
|
setMcpOAuthStorePath
|
|
8
8
|
} from "./chunk-IJ53Y77N.js";
|
|
9
9
|
import {
|
|
10
|
-
TEMPLATE_VARIABLES,
|
|
11
10
|
createWebSocketServer,
|
|
12
|
-
deleteProjectWorkflow,
|
|
13
|
-
deleteWorkflow,
|
|
14
|
-
findWorkflowById,
|
|
15
11
|
getAuthConfig,
|
|
16
|
-
getDefaultWorkflowIds,
|
|
17
12
|
hasPassword,
|
|
18
|
-
isDefaultWorkflow,
|
|
19
13
|
isValidToken,
|
|
20
|
-
loadAllWorkflows,
|
|
21
|
-
loadDefaultWorkflows,
|
|
22
|
-
loadProjectWorkflows,
|
|
23
14
|
loadServerAuthConfig,
|
|
24
|
-
loadUserWorkflows,
|
|
25
15
|
requiresAuth,
|
|
26
|
-
saveWorkflow,
|
|
27
|
-
saveWorkflowToProject,
|
|
28
16
|
terminalManager,
|
|
29
17
|
tokenFromPassword,
|
|
30
|
-
verifyPassword
|
|
31
|
-
|
|
32
|
-
} from "./chunk-XCK5IBO4.js";
|
|
18
|
+
verifyPassword
|
|
19
|
+
} from "./chunk-7GWARYQC.js";
|
|
33
20
|
import {
|
|
34
|
-
|
|
35
|
-
} from "./chunk-
|
|
21
|
+
TEMPLATE_VARIABLES
|
|
22
|
+
} from "./chunk-W77NBJAZ.js";
|
|
36
23
|
import {
|
|
37
24
|
createToolRegistry,
|
|
38
25
|
devServerManager,
|
|
@@ -42,7 +29,7 @@ import {
|
|
|
42
29
|
setMcpManagerForTools,
|
|
43
30
|
setMcpTools,
|
|
44
31
|
setNotifyMcpServersChanged
|
|
45
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-K733B5T2.js";
|
|
46
33
|
import {
|
|
47
34
|
deleteOwnedSkill,
|
|
48
35
|
deleteProjectSkill,
|
|
@@ -61,12 +48,15 @@ import {
|
|
|
61
48
|
setSkillEnabled,
|
|
62
49
|
skillExists,
|
|
63
50
|
updateOwnedSkill
|
|
64
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-YGJIK3CG.js";
|
|
52
|
+
import {
|
|
53
|
+
openFolder
|
|
54
|
+
} from "./chunk-WLJJRX22.js";
|
|
65
55
|
import {
|
|
66
56
|
ALWAYS_ALLOWED,
|
|
67
57
|
ALWAYS_ALLOWED_FOR_SUBAGENTS,
|
|
68
58
|
TOP_LEVEL_ONLY_TOOLS
|
|
69
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-2XD65L7M.js";
|
|
70
60
|
import {
|
|
71
61
|
createMcpTools
|
|
72
62
|
} from "./chunk-JE7LW7Y6.js";
|
|
@@ -85,11 +75,38 @@ import {
|
|
|
85
75
|
validateRef,
|
|
86
76
|
validateWorkspaceName,
|
|
87
77
|
workspaceExists
|
|
88
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-SBSUDHL4.js";
|
|
79
|
+
import {
|
|
80
|
+
commandExists,
|
|
81
|
+
deleteCommand,
|
|
82
|
+
deleteProjectCommand,
|
|
83
|
+
deleteProjectWorkflow,
|
|
84
|
+
deleteWorkflow,
|
|
85
|
+
findCommandById,
|
|
86
|
+
findWorkflowById,
|
|
87
|
+
getDefaultCommandIds,
|
|
88
|
+
getDefaultWorkflowIds,
|
|
89
|
+
isDefaultCommand,
|
|
90
|
+
isDefaultWorkflow,
|
|
91
|
+
loadAllCommands,
|
|
92
|
+
loadAllWorkflows,
|
|
93
|
+
loadDefaultCommands,
|
|
94
|
+
loadDefaultWorkflows,
|
|
95
|
+
loadProjectCommands,
|
|
96
|
+
loadProjectWorkflows,
|
|
97
|
+
loadUserCommands,
|
|
98
|
+
loadUserWorkflows,
|
|
99
|
+
normalizeWorkflowScope,
|
|
100
|
+
saveCommand,
|
|
101
|
+
saveCommandToProject,
|
|
102
|
+
saveWorkflow,
|
|
103
|
+
saveWorkflowToProject,
|
|
104
|
+
workflowExists
|
|
105
|
+
} from "./chunk-OTYAEEX3.js";
|
|
89
106
|
import {
|
|
90
107
|
getSessionDisabledServers,
|
|
91
108
|
setSessionDisabledServers
|
|
92
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-L63Q4JQJ.js";
|
|
93
110
|
import {
|
|
94
111
|
emitAssistantMessageStart,
|
|
95
112
|
emitContextState,
|
|
@@ -106,15 +123,15 @@ import {
|
|
|
106
123
|
getEventStore,
|
|
107
124
|
getSessionState,
|
|
108
125
|
initEventStore
|
|
109
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-JXLRL5JR.js";
|
|
110
127
|
import {
|
|
111
128
|
createContextStateMessage,
|
|
112
129
|
toClientSession
|
|
113
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-I7FY2LTR.js";
|
|
114
131
|
import {
|
|
115
132
|
getPathSeparator,
|
|
116
133
|
isAbsolutePath
|
|
117
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-SA34STZ6.js";
|
|
118
135
|
import {
|
|
119
136
|
EventEmitter
|
|
120
137
|
} from "./chunk-JURM3RPZ.js";
|
|
@@ -123,15 +140,15 @@ import {
|
|
|
123
140
|
getAgentModelOverrides,
|
|
124
141
|
resolveLLMClientForAgent,
|
|
125
142
|
setAgentModelOverride
|
|
126
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-JP7NM545.js";
|
|
127
144
|
import {
|
|
128
145
|
getProject,
|
|
129
146
|
getProjectByWorkdir,
|
|
130
147
|
updateProject
|
|
131
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-SFZGMB2G.js";
|
|
132
149
|
import {
|
|
133
150
|
VERSION
|
|
134
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-NCZRWCJN.js";
|
|
135
152
|
import {
|
|
136
153
|
clearWorkflowExecution,
|
|
137
154
|
createSession,
|
|
@@ -144,6 +161,7 @@ import {
|
|
|
144
161
|
listSessions,
|
|
145
162
|
listSessionsByProject,
|
|
146
163
|
listSessionsLimited,
|
|
164
|
+
toggleFavorite,
|
|
147
165
|
updateSessionBranch,
|
|
148
166
|
updateSessionCachedPrompt,
|
|
149
167
|
updateSessionDangerLevel,
|
|
@@ -153,64 +171,62 @@ import {
|
|
|
153
171
|
updateSessionRunning,
|
|
154
172
|
updateSessionWorkdir,
|
|
155
173
|
updateWorkflowExecutionStatus
|
|
156
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-3O77NT4T.js";
|
|
157
175
|
import {
|
|
158
176
|
agentExists,
|
|
159
177
|
deleteAgent,
|
|
160
|
-
deleteItemFromDir,
|
|
161
178
|
deleteProjectAgent,
|
|
162
179
|
findAgentById,
|
|
163
|
-
findFileByInternalId,
|
|
164
180
|
getDefaultAgentIds,
|
|
165
|
-
getDefaultIds,
|
|
166
181
|
getTopLevelAgents,
|
|
167
182
|
isDefaultAgent,
|
|
168
183
|
loadAllAgents,
|
|
169
184
|
loadAllAgentsDefault,
|
|
170
185
|
loadDefaultAgents,
|
|
171
|
-
loadItemsFromDir,
|
|
172
186
|
loadProjectAgents,
|
|
173
187
|
loadUserAgents,
|
|
174
|
-
pathExists,
|
|
175
188
|
saveAgent,
|
|
176
189
|
saveAgentToProject,
|
|
177
|
-
saveItemToDir,
|
|
178
190
|
setRuntimeConfig
|
|
179
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-UPBWEHIL.js";
|
|
192
|
+
import {
|
|
193
|
+
findFileByInternalId,
|
|
194
|
+
pathExists
|
|
195
|
+
} from "./chunk-OSXPQSLW.js";
|
|
180
196
|
import {
|
|
181
197
|
createProviderManager,
|
|
182
198
|
detectModel,
|
|
183
199
|
getLlmStatus,
|
|
184
200
|
parseDefaultModelSelection
|
|
185
|
-
} from "./chunk-
|
|
201
|
+
} from "./chunk-MUSPWEBB.js";
|
|
186
202
|
import {
|
|
187
203
|
getModelProfile
|
|
188
204
|
} from "./chunk-V4IE7HJY.js";
|
|
189
205
|
import {
|
|
190
206
|
getBackendDisplayName
|
|
191
|
-
} from "./chunk-
|
|
207
|
+
} from "./chunk-AZHWLLPP.js";
|
|
192
208
|
import {
|
|
193
209
|
buildModelsUrl
|
|
194
210
|
} from "./chunk-HNCM3D7Y.js";
|
|
195
211
|
import {
|
|
196
212
|
SessionNotFoundError,
|
|
197
213
|
WorkspaceInUseError
|
|
198
|
-
} from "./chunk-
|
|
214
|
+
} from "./chunk-OXSTNSCF.js";
|
|
199
215
|
import {
|
|
200
216
|
deleteSetting,
|
|
201
217
|
getSetting,
|
|
202
218
|
setSetting
|
|
203
|
-
} from "./chunk-
|
|
219
|
+
} from "./chunk-HP5CIB66.js";
|
|
204
220
|
import {
|
|
205
221
|
initDatabase
|
|
206
|
-
} from "./chunk-
|
|
222
|
+
} from "./chunk-PBW3YC3G.js";
|
|
207
223
|
import {
|
|
208
224
|
logger,
|
|
209
225
|
setLogLevel
|
|
210
226
|
} from "./chunk-K44MW7JJ.js";
|
|
211
227
|
import {
|
|
212
228
|
createServerMessage
|
|
213
|
-
} from "./chunk-
|
|
229
|
+
} from "./chunk-X25Q6RAV.js";
|
|
214
230
|
import {
|
|
215
231
|
getGlobalConfigDir
|
|
216
232
|
} from "./chunk-CQGTEGKL.js";
|
|
@@ -219,8 +235,8 @@ import {
|
|
|
219
235
|
import express from "express";
|
|
220
236
|
import cors from "cors";
|
|
221
237
|
import { createServer as createHttpServer } from "http";
|
|
222
|
-
import { fileURLToPath as
|
|
223
|
-
import { dirname as
|
|
238
|
+
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
239
|
+
import { dirname as dirname7, resolve as resolve8, join as join9 } from "path";
|
|
224
240
|
import { readFile as readFile4 } from "fs/promises";
|
|
225
241
|
import { createServer as createViteServer } from "vite";
|
|
226
242
|
|
|
@@ -3093,12 +3109,12 @@ var SessionManager = class {
|
|
|
3093
3109
|
* Start a new workflow execution. Cancels any existing active execution first,
|
|
3094
3110
|
* then inserts a new row and emits events.
|
|
3095
3111
|
*/
|
|
3096
|
-
startWorkflow(sessionId, executionId, workflowId, workflowName, workflowColor, params) {
|
|
3112
|
+
startWorkflow(sessionId, executionId, workflowId, workflowName, workflowColor, params, subGroup) {
|
|
3097
3113
|
const existing = this.getActiveWorkflowExecution(sessionId);
|
|
3098
3114
|
if (existing) {
|
|
3099
3115
|
this.cancelWorkflow(sessionId, existing.id, existing.workflowId, existing.workflowName, existing.workflowColor);
|
|
3100
3116
|
}
|
|
3101
|
-
createWorkflowExecution(executionId, sessionId, workflowId, workflowName, workflowColor, params);
|
|
3117
|
+
createWorkflowExecution(executionId, sessionId, workflowId, workflowName, workflowColor, params, subGroup);
|
|
3102
3118
|
emitWorkflowExecutionChanged(sessionId, executionId, workflowId, workflowName, workflowColor, "running");
|
|
3103
3119
|
const updatedSession = this.requireSession(sessionId);
|
|
3104
3120
|
this.emit({ type: "session_updated", session: updatedSession });
|
|
@@ -3246,6 +3262,7 @@ var SessionManager = class {
|
|
|
3246
3262
|
...row.current_step_name ? { currentStepName: row.current_step_name } : {},
|
|
3247
3263
|
stepOutput: JSON.parse(row.step_output ?? "{}"),
|
|
3248
3264
|
params: JSON.parse(row.params ?? "{}"),
|
|
3265
|
+
...row.sub_group ? { subGroup: row.sub_group } : {},
|
|
3249
3266
|
...row.pending_choices ? { pendingChoices: JSON.parse(row.pending_choices) } : {},
|
|
3250
3267
|
createdAt: row.created_at,
|
|
3251
3268
|
updatedAt: row.updated_at
|
|
@@ -3377,20 +3394,24 @@ var SessionManager = class {
|
|
|
3377
3394
|
/**
|
|
3378
3395
|
* Set current context size (for token tracking).
|
|
3379
3396
|
* Emits a context.state event with the real promptTokens from the LLM.
|
|
3397
|
+
* Stores promptTokens + completionTokens so the tracked size reflects the
|
|
3398
|
+
* true context occupancy — the last call's output is re-fed into the next
|
|
3399
|
+
* request as an assistant message, so it must count toward the budget.
|
|
3380
3400
|
* maxTokens comes from providerManager.getCurrentModelContext() - the currently selected model's limit.
|
|
3381
3401
|
*/
|
|
3382
|
-
setCurrentContextSize(sessionId, promptTokens, subAgentId) {
|
|
3402
|
+
setCurrentContextSize(sessionId, promptTokens, completionTokens = 0, subAgentId) {
|
|
3383
3403
|
const state = getSessionState(sessionId, this.providerManager.getCurrentModelContext());
|
|
3384
3404
|
const maxTokens = this.providerManager.getCurrentModelContext();
|
|
3405
|
+
const currentTokens = promptTokens + completionTokens;
|
|
3385
3406
|
const compactionCount = state?.contextState.compactionCount ?? 0;
|
|
3386
3407
|
const dynamicContextChanged = this.getDynamicContextChanged(sessionId);
|
|
3387
3408
|
emitContextState(
|
|
3388
3409
|
sessionId,
|
|
3389
|
-
|
|
3410
|
+
currentTokens,
|
|
3390
3411
|
maxTokens,
|
|
3391
3412
|
compactionCount,
|
|
3392
|
-
isInDangerZone(
|
|
3393
|
-
canCompact(
|
|
3413
|
+
isInDangerZone(currentTokens, maxTokens),
|
|
3414
|
+
canCompact(currentTokens, maxTokens),
|
|
3394
3415
|
subAgentId,
|
|
3395
3416
|
dynamicContextChanged
|
|
3396
3417
|
);
|
|
@@ -4086,6 +4107,16 @@ function resolveProjectDir(req, fallback) {
|
|
|
4086
4107
|
const trimmed = workdir.trim();
|
|
4087
4108
|
return trimmed ? trimmed : fallback;
|
|
4088
4109
|
}
|
|
4110
|
+
function resolveScope(req) {
|
|
4111
|
+
const scope = req.query["scope"];
|
|
4112
|
+
return normalizeWorkflowScope(typeof scope === "string" ? scope : void 0);
|
|
4113
|
+
}
|
|
4114
|
+
async function loadItemsForScope(config3, configDir, projectDir, scope) {
|
|
4115
|
+
if (scope === "builtin") return config3.loadDefaults();
|
|
4116
|
+
if (scope === "user") return config3.loadUser(configDir);
|
|
4117
|
+
if (scope === "project") return projectDir ? config3.loadProject(projectDir) : [];
|
|
4118
|
+
return config3.loadAll(configDir, projectDir);
|
|
4119
|
+
}
|
|
4089
4120
|
var ID_REGEX = /^[a-z0-9-]+$/;
|
|
4090
4121
|
function validateNameIdPrompt(body) {
|
|
4091
4122
|
const meta = body["metadata"];
|
|
@@ -4115,10 +4146,12 @@ function createCrudRoutes(config3, configDir, projectDir) {
|
|
|
4115
4146
|
const userOverrideIds = computeOverrideIds(defaults, userItems);
|
|
4116
4147
|
const projectOverrideIds = computeOverrideIds(defaults, projectItems);
|
|
4117
4148
|
const extra = config3.extraGetData ? await config3.extraGetData(effectiveProjectDir) : {};
|
|
4149
|
+
const annotate = (item, scope) => ({ ...item, scope });
|
|
4150
|
+
const mapWithScope = (items, scope) => config3.annotateScope ? items.map((i) => annotate(config3.mapToResponse(i), scope)) : items.map(config3.mapToResponse);
|
|
4118
4151
|
res.json({
|
|
4119
|
-
defaults: defaults
|
|
4120
|
-
userItems: userItems
|
|
4121
|
-
projectItems: projectItems
|
|
4152
|
+
defaults: mapWithScope(defaults, "builtin"),
|
|
4153
|
+
userItems: mapWithScope(userItems, "user"),
|
|
4154
|
+
projectItems: mapWithScope(projectItems, "project"),
|
|
4122
4155
|
overrideIds: [...userOverrideIds, ...projectOverrideIds],
|
|
4123
4156
|
...extra
|
|
4124
4157
|
});
|
|
@@ -4139,7 +4172,8 @@ function createCrudRoutes(config3, configDir, projectDir) {
|
|
|
4139
4172
|
router.get("/:id", async (req, res) => {
|
|
4140
4173
|
const { id } = req.params;
|
|
4141
4174
|
const effectiveProjectDir = resolveProjectDir(req, projectDir);
|
|
4142
|
-
const
|
|
4175
|
+
const scope = config3.annotateScope ? resolveScope(req) : "auto";
|
|
4176
|
+
const items = await loadItemsForScope(config3, configDir, effectiveProjectDir, scope);
|
|
4143
4177
|
const item = config3.findById(id, items);
|
|
4144
4178
|
if (!item) {
|
|
4145
4179
|
return res.status(404).json({ error: "Not found" });
|
|
@@ -4185,7 +4219,8 @@ function createCrudRoutes(config3, configDir, projectDir) {
|
|
|
4185
4219
|
...body,
|
|
4186
4220
|
metadata: { ...existing.metadata, ...meta, id }
|
|
4187
4221
|
};
|
|
4188
|
-
const
|
|
4222
|
+
const scope = config3.annotateScope ? resolveScope(req) : "auto";
|
|
4223
|
+
const isProject = scope === "project" ? true : scope === "user" ? false : await isProjectItem(effectiveProjectDir, config3.dirName, id, config3.ext);
|
|
4189
4224
|
if (isProject) {
|
|
4190
4225
|
await config3.saveToProject(effectiveProjectDir, updated);
|
|
4191
4226
|
} else {
|
|
@@ -4196,17 +4231,13 @@ function createCrudRoutes(config3, configDir, projectDir) {
|
|
|
4196
4231
|
router.delete("/:id", async (req, res) => {
|
|
4197
4232
|
const { id } = req.params;
|
|
4198
4233
|
const effectiveProjectDir = resolveProjectDir(req, projectDir);
|
|
4199
|
-
const
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
if (!result2.success) {
|
|
4203
|
-
return res.status(500).json({ error: "Failed to delete project item" });
|
|
4204
|
-
}
|
|
4205
|
-
return res.json({ success: true });
|
|
4206
|
-
}
|
|
4207
|
-
const result = await config3.delete(configDir, id);
|
|
4234
|
+
const scope = config3.annotateScope ? resolveScope(req) : "auto";
|
|
4235
|
+
const target = scope === "project" || scope === "user" ? scope : await isProjectItem(effectiveProjectDir, config3.dirName, id, config3.ext) ? "project" : "user";
|
|
4236
|
+
const result = target === "project" ? await config3.deleteProject(effectiveProjectDir, id) : await config3.delete(configDir, id);
|
|
4208
4237
|
if (!result.success) {
|
|
4209
|
-
return res.status(
|
|
4238
|
+
return res.status(target === "project" ? 500 : 403).json({
|
|
4239
|
+
error: target === "project" ? "Failed to delete project item" : result.reason ?? "Cannot delete this item"
|
|
4240
|
+
});
|
|
4210
4241
|
}
|
|
4211
4242
|
res.json({ success: true });
|
|
4212
4243
|
});
|
|
@@ -4404,117 +4435,6 @@ function createSkillRoutes(configDir, projectDir) {
|
|
|
4404
4435
|
return router;
|
|
4405
4436
|
}
|
|
4406
4437
|
|
|
4407
|
-
// src/server/commands/registry.ts
|
|
4408
|
-
import { writeFile as writeFile2, mkdir as mkdir3, unlink } from "fs/promises";
|
|
4409
|
-
import { join as join5, dirname as dirname4 } from "path";
|
|
4410
|
-
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
4411
|
-
import matter2 from "gray-matter";
|
|
4412
|
-
var __bundleDir = dirname4(fileURLToPath4(import.meta.url));
|
|
4413
|
-
var DEFAULTS_DIR = join5(__bundleDir, "defaults");
|
|
4414
|
-
var DEFAULTS_DIR_ALT = join5(__bundleDir, "command-defaults");
|
|
4415
|
-
var COMMAND_EXTENSION = ".command.md";
|
|
4416
|
-
function getCommandsDir(configDir) {
|
|
4417
|
-
return join5(configDir, "commands");
|
|
4418
|
-
}
|
|
4419
|
-
function getProjectCommandsDir(projectDir) {
|
|
4420
|
-
return join5(projectDir, ".openfox", "commands");
|
|
4421
|
-
}
|
|
4422
|
-
async function loadDefaultCommands() {
|
|
4423
|
-
let defaults = await loadItemsFromDir(DEFAULTS_DIR, {
|
|
4424
|
-
extension: COMMAND_EXTENSION,
|
|
4425
|
-
logName: "command"
|
|
4426
|
-
});
|
|
4427
|
-
if (!defaults.length) {
|
|
4428
|
-
defaults = await loadItemsFromDir(DEFAULTS_DIR_ALT, {
|
|
4429
|
-
extension: COMMAND_EXTENSION,
|
|
4430
|
-
logName: "command"
|
|
4431
|
-
});
|
|
4432
|
-
}
|
|
4433
|
-
return defaults;
|
|
4434
|
-
}
|
|
4435
|
-
async function loadUserCommands(configDir) {
|
|
4436
|
-
return loadItemsFromDir(getCommandsDir(configDir), {
|
|
4437
|
-
extension: COMMAND_EXTENSION,
|
|
4438
|
-
logName: "command"
|
|
4439
|
-
});
|
|
4440
|
-
}
|
|
4441
|
-
async function loadProjectCommands(projectDir) {
|
|
4442
|
-
return loadItemsFromDir(getProjectCommandsDir(projectDir), {
|
|
4443
|
-
extension: COMMAND_EXTENSION,
|
|
4444
|
-
logName: "command"
|
|
4445
|
-
});
|
|
4446
|
-
}
|
|
4447
|
-
async function loadAllCommands(configDir, projectDir) {
|
|
4448
|
-
const [defaultCommands, userCommands] = await Promise.all([loadDefaultCommands(), loadUserCommands(configDir)]);
|
|
4449
|
-
const commandMap = /* @__PURE__ */ new Map();
|
|
4450
|
-
for (const cmd of defaultCommands) {
|
|
4451
|
-
commandMap.set(cmd.metadata.id, cmd);
|
|
4452
|
-
}
|
|
4453
|
-
for (const cmd of userCommands) {
|
|
4454
|
-
commandMap.set(cmd.metadata.id, cmd);
|
|
4455
|
-
}
|
|
4456
|
-
if (projectDir) {
|
|
4457
|
-
const projectCommands = await loadProjectCommands(projectDir);
|
|
4458
|
-
for (const cmd of projectCommands) {
|
|
4459
|
-
commandMap.set(cmd.metadata.id, cmd);
|
|
4460
|
-
}
|
|
4461
|
-
}
|
|
4462
|
-
return Array.from(commandMap.values());
|
|
4463
|
-
}
|
|
4464
|
-
async function getDefaultCommandIds() {
|
|
4465
|
-
const ids = await getDefaultIds(DEFAULTS_DIR, COMMAND_EXTENSION);
|
|
4466
|
-
if (ids.length) return ids;
|
|
4467
|
-
return getDefaultIds(DEFAULTS_DIR_ALT, COMMAND_EXTENSION);
|
|
4468
|
-
}
|
|
4469
|
-
async function isDefaultCommand(commandId) {
|
|
4470
|
-
const defaultIds = await getDefaultCommandIds();
|
|
4471
|
-
return defaultIds.includes(commandId);
|
|
4472
|
-
}
|
|
4473
|
-
function findCommandById(commandId, commands) {
|
|
4474
|
-
return commands.find((c) => c.metadata.id === commandId);
|
|
4475
|
-
}
|
|
4476
|
-
async function commandExists(configDir, commandId, projectDir) {
|
|
4477
|
-
if (await pathExists(join5(getCommandsDir(configDir), `${commandId}${COMMAND_EXTENSION}`))) return true;
|
|
4478
|
-
if (projectDir && await pathExists(join5(getProjectCommandsDir(projectDir), `${commandId}${COMMAND_EXTENSION}`)))
|
|
4479
|
-
return true;
|
|
4480
|
-
return false;
|
|
4481
|
-
}
|
|
4482
|
-
async function saveCommand(configDir, command) {
|
|
4483
|
-
const commandsDir = getCommandsDir(configDir);
|
|
4484
|
-
if (!await pathExists(commandsDir)) {
|
|
4485
|
-
await mkdir3(commandsDir, { recursive: true });
|
|
4486
|
-
}
|
|
4487
|
-
const filePath = join5(commandsDir, `${command.metadata.id}${COMMAND_EXTENSION}`);
|
|
4488
|
-
const content = matter2.stringify(command.prompt, command.metadata);
|
|
4489
|
-
await writeFile2(filePath, content, "utf-8");
|
|
4490
|
-
}
|
|
4491
|
-
async function saveCommandToProject(projectDir, command) {
|
|
4492
|
-
await saveItemToDir(
|
|
4493
|
-
getProjectCommandsDir(projectDir),
|
|
4494
|
-
command,
|
|
4495
|
-
COMMAND_EXTENSION,
|
|
4496
|
-
(c) => matter2.stringify(c.prompt, c.metadata)
|
|
4497
|
-
);
|
|
4498
|
-
}
|
|
4499
|
-
async function deleteProjectCommand(projectDir, commandId) {
|
|
4500
|
-
return deleteItemFromDir(getProjectCommandsDir(projectDir), commandId, COMMAND_EXTENSION);
|
|
4501
|
-
}
|
|
4502
|
-
async function deleteCommand(configDir, commandId) {
|
|
4503
|
-
const filePath = join5(getCommandsDir(configDir), `${commandId}${COMMAND_EXTENSION}`);
|
|
4504
|
-
if (!await pathExists(filePath)) {
|
|
4505
|
-
if (await isDefaultCommand(commandId)) {
|
|
4506
|
-
return { success: false, reason: "Cannot delete built-in defaults" };
|
|
4507
|
-
}
|
|
4508
|
-
return { success: false };
|
|
4509
|
-
}
|
|
4510
|
-
try {
|
|
4511
|
-
await unlink(filePath);
|
|
4512
|
-
return { success: true };
|
|
4513
|
-
} catch {
|
|
4514
|
-
return { success: false, reason: "Failed to delete command" };
|
|
4515
|
-
}
|
|
4516
|
-
}
|
|
4517
|
-
|
|
4518
4438
|
// src/server/routes/commands.ts
|
|
4519
4439
|
var config = {
|
|
4520
4440
|
dirName: "commands",
|
|
@@ -4626,6 +4546,7 @@ function createWorkflowRoutes(configDir, config3, projectDir) {
|
|
|
4626
4546
|
exists: workflowExists,
|
|
4627
4547
|
isDefault: isDefaultWorkflow,
|
|
4628
4548
|
getDefaultIds: getDefaultWorkflowIds,
|
|
4549
|
+
annotateScope: true,
|
|
4629
4550
|
validateCreate: (body) => {
|
|
4630
4551
|
const steps = body["steps"];
|
|
4631
4552
|
if (!Array.isArray(steps) || steps.length === 0) return "Missing required fields: metadata.id, steps";
|
|
@@ -4751,9 +4672,9 @@ function createDevServerRoutes() {
|
|
|
4751
4672
|
|
|
4752
4673
|
// src/server/routes/workspace-config.ts
|
|
4753
4674
|
import { Router as Router5 } from "express";
|
|
4754
|
-
import { stat as stat2, mkdir as
|
|
4675
|
+
import { stat as stat2, mkdir as mkdir3, readdir, access as access3 } from "fs/promises";
|
|
4755
4676
|
import { constants as constants3 } from "fs";
|
|
4756
|
-
import { resolve as resolve4, isAbsolute as isAbsolute3, join as
|
|
4677
|
+
import { resolve as resolve4, isAbsolute as isAbsolute3, join as join5, win32 } from "path";
|
|
4757
4678
|
|
|
4758
4679
|
// src/shared/workspace.ts
|
|
4759
4680
|
var BLOCKED_EXACT_PATHS = [
|
|
@@ -4774,15 +4695,26 @@ var BLOCKED_EXACT_PATHS = [
|
|
|
4774
4695
|
"/media"
|
|
4775
4696
|
];
|
|
4776
4697
|
var BLOCKED_VIRTUAL_FS_PREFIXES = ["/proc/", "/sys/", "/dev/", "/boot/", "/etc/", "/lost+found/"];
|
|
4698
|
+
var WINDOWS_DRIVE_ROOT = /^[a-zA-Z]:$/;
|
|
4777
4699
|
function getRootDirBlockReason(path, exactPaths = BLOCKED_EXACT_PATHS, virtualFsPrefixes = BLOCKED_VIRTUAL_FS_PREFIXES) {
|
|
4778
4700
|
if (!path) return null;
|
|
4779
|
-
const normalized = path.replace(
|
|
4701
|
+
const normalized = path.replace(/[\\/]+$/, "") || "/";
|
|
4702
|
+
if (WINDOWS_DRIVE_ROOT.test(normalized)) return "exact";
|
|
4780
4703
|
if (exactPaths.includes(normalized)) return "exact";
|
|
4781
4704
|
for (const prefix of virtualFsPrefixes) {
|
|
4782
4705
|
if (normalized.startsWith(prefix)) return "virtual_fs";
|
|
4783
4706
|
}
|
|
4784
4707
|
return null;
|
|
4785
4708
|
}
|
|
4709
|
+
function formatRootDir(path) {
|
|
4710
|
+
const trimmed = path.replace(/[\\/]+$/, "");
|
|
4711
|
+
if (!trimmed) return "/";
|
|
4712
|
+
return WINDOWS_DRIVE_ROOT.test(trimmed) ? `${trimmed}\\` : trimmed;
|
|
4713
|
+
}
|
|
4714
|
+
function suggestRootDirChild(path, child) {
|
|
4715
|
+
const base = formatRootDir(path);
|
|
4716
|
+
return /[\\/]$/.test(base) ? `${base}${child}` : `${base}/${child}`;
|
|
4717
|
+
}
|
|
4786
4718
|
|
|
4787
4719
|
// src/server/routes/workspace-config.ts
|
|
4788
4720
|
async function isWritable(path) {
|
|
@@ -4796,6 +4728,11 @@ async function isWritable(path) {
|
|
|
4796
4728
|
function resolveRootDir(rootDir, workdir) {
|
|
4797
4729
|
return isAbsolute3(rootDir) ? rootDir : resolve4(workdir, rootDir);
|
|
4798
4730
|
}
|
|
4731
|
+
function isSameDir(a, b) {
|
|
4732
|
+
if (process.platform !== "win32") return a.replace(/\/+$/, "") === b.replace(/\/+$/, "");
|
|
4733
|
+
const normalize = (p) => win32.normalize(p).replace(/\\+$/, "").toLowerCase();
|
|
4734
|
+
return normalize(a) === normalize(b);
|
|
4735
|
+
}
|
|
4799
4736
|
async function checkDirExists(path) {
|
|
4800
4737
|
try {
|
|
4801
4738
|
const st = await stat2(path);
|
|
@@ -4815,7 +4752,7 @@ async function findOrphanedWorkspaces(dir) {
|
|
|
4815
4752
|
for (const entry of entries) {
|
|
4816
4753
|
if (entry.isDirectory()) {
|
|
4817
4754
|
try {
|
|
4818
|
-
const gitStat = await stat2(
|
|
4755
|
+
const gitStat = await stat2(join5(dir, entry.name, ".git"));
|
|
4819
4756
|
if (gitStat.isDirectory()) {
|
|
4820
4757
|
results.push({ name: entry.name });
|
|
4821
4758
|
}
|
|
@@ -4865,7 +4802,7 @@ function createWorkspaceConfigRoutes(sessionManager) {
|
|
|
4865
4802
|
const trimmed = rootDir.trim();
|
|
4866
4803
|
if (trimmed) {
|
|
4867
4804
|
const resolvedPath = resolveRootDir(trimmed, workdir);
|
|
4868
|
-
const displayPath = resolvedPath
|
|
4805
|
+
const displayPath = formatRootDir(resolvedPath);
|
|
4869
4806
|
const blockReason = getRootDirBlockReason(resolvedPath);
|
|
4870
4807
|
if (blockReason === "exact") {
|
|
4871
4808
|
return res.status(400).json({ error: `Cannot use "${displayPath}" directly as workspace root. Use a subdirectory instead.` });
|
|
@@ -4921,10 +4858,10 @@ function createWorkspaceConfigRoutes(sessionManager) {
|
|
|
4921
4858
|
return res.status(400).json({ error: "workdir is required" });
|
|
4922
4859
|
}
|
|
4923
4860
|
const resolvedPath = resolveRootDir(rootDir, workdir);
|
|
4924
|
-
const displayPath = resolvedPath
|
|
4861
|
+
const displayPath = formatRootDir(resolvedPath);
|
|
4925
4862
|
const blockReason = getRootDirBlockReason(resolvedPath);
|
|
4926
4863
|
if (blockReason === "exact") {
|
|
4927
|
-
const suggestion = typeof projectName === "string" ?
|
|
4864
|
+
const suggestion = typeof projectName === "string" ? suggestRootDirChild(resolvedPath, projectName) : void 0;
|
|
4928
4865
|
return res.status(400).json({
|
|
4929
4866
|
error: suggestion ? `Cannot use "${displayPath}" directly as workspace root. Use a subdirectory like "${suggestion}" instead.` : `Cannot use "${displayPath}" directly as workspace root. Use a subdirectory instead.`
|
|
4930
4867
|
});
|
|
@@ -4939,7 +4876,7 @@ function createWorkspaceConfigRoutes(sessionManager) {
|
|
|
4939
4876
|
}
|
|
4940
4877
|
let created = false;
|
|
4941
4878
|
if (!dirExists && createIfMissing) {
|
|
4942
|
-
await
|
|
4879
|
+
await mkdir3(resolvedPath, { recursive: true });
|
|
4943
4880
|
dirExists = true;
|
|
4944
4881
|
created = true;
|
|
4945
4882
|
}
|
|
@@ -4947,12 +4884,12 @@ function createWorkspaceConfigRoutes(sessionManager) {
|
|
|
4947
4884
|
try {
|
|
4948
4885
|
const project = getProjectByWorkdir(workdir);
|
|
4949
4886
|
const previousRootDir = project?.workspaceRootDir ? resolveRootDir(project.workspaceRootDir, workdir) : null;
|
|
4950
|
-
if (previousRootDir && previousRootDir
|
|
4887
|
+
if (previousRootDir && !isSameDir(previousRootDir, resolvedPath)) {
|
|
4951
4888
|
const orphans = await findOrphanedWorkspaces(previousRootDir);
|
|
4952
4889
|
workspaces.push(...orphans);
|
|
4953
4890
|
} else if (!previousRootDir && projectName && typeof projectName === "string") {
|
|
4954
|
-
const defaultDir =
|
|
4955
|
-
if (defaultDir
|
|
4891
|
+
const defaultDir = join5(getGlobalDataDir(), "workspaces", projectName);
|
|
4892
|
+
if (!isSameDir(defaultDir, resolvedPath)) {
|
|
4956
4893
|
const orphans = await findOrphanedWorkspaces(defaultDir);
|
|
4957
4894
|
workspaces.push(...orphans);
|
|
4958
4895
|
}
|
|
@@ -5008,7 +4945,7 @@ function createTerminalRoutes() {
|
|
|
5008
4945
|
// src/server/routes/directories.ts
|
|
5009
4946
|
import { Router as Router7 } from "express";
|
|
5010
4947
|
import { readdir as readdir2 } from "fs/promises";
|
|
5011
|
-
import { resolve as resolve5, join as
|
|
4948
|
+
import { resolve as resolve5, join as join6, dirname as dirname4, basename as basename2 } from "path";
|
|
5012
4949
|
function createDirectoryRoutes() {
|
|
5013
4950
|
const router = Router7();
|
|
5014
4951
|
const DEFAULT_BASE_PATH = process.cwd();
|
|
@@ -5019,9 +4956,9 @@ function createDirectoryRoutes() {
|
|
|
5019
4956
|
const entries = await readdir2(resolvedPath, { withFileTypes: true });
|
|
5020
4957
|
const directories = entries.filter((entry) => entry.isDirectory()).map((entry) => ({
|
|
5021
4958
|
name: entry.name,
|
|
5022
|
-
path:
|
|
4959
|
+
path: join6(resolvedPath, entry.name)
|
|
5023
4960
|
})).sort((a, b) => a.name.localeCompare(b.name));
|
|
5024
|
-
const parent =
|
|
4961
|
+
const parent = dirname4(resolvedPath);
|
|
5025
4962
|
const hasParent = parent !== resolvedPath;
|
|
5026
4963
|
res.json({
|
|
5027
4964
|
current: resolvedPath,
|
|
@@ -5384,7 +5321,7 @@ function createProviderAuthRoutes(config3, providerManager, registry) {
|
|
|
5384
5321
|
try {
|
|
5385
5322
|
const { challenge, completion } = await adapter.beginLogin({ providerId: provider.id });
|
|
5386
5323
|
void completion.then(async ({ credentialRef }) => {
|
|
5387
|
-
const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-
|
|
5324
|
+
const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-EAB3V4QK.js");
|
|
5388
5325
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
5389
5326
|
const updatedConfig = updateProvider(globalConfig, provider.id, { credentialRef, authAdapter: adapter.id });
|
|
5390
5327
|
await saveGlobalConfig(config3.mode ?? "production", updatedConfig, config3.globalConfigPath);
|
|
@@ -5421,7 +5358,7 @@ function createProviderAuthRoutes(config3, providerManager, registry) {
|
|
|
5421
5358
|
const ref = provider.credentialRef ?? provider.id;
|
|
5422
5359
|
await adapter.logout(ref);
|
|
5423
5360
|
}
|
|
5424
|
-
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-
|
|
5361
|
+
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-EAB3V4QK.js");
|
|
5425
5362
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
5426
5363
|
const updatedConfig = {
|
|
5427
5364
|
...globalConfig,
|
|
@@ -5500,8 +5437,8 @@ var ProviderRegistry = class {
|
|
|
5500
5437
|
|
|
5501
5438
|
// src/server/providers/plugins/loader.ts
|
|
5502
5439
|
import { readdir as readdir3, readFile as readFile2, stat as stat3 } from "fs/promises";
|
|
5503
|
-
import { dirname as
|
|
5504
|
-
import { fileURLToPath as
|
|
5440
|
+
import { dirname as dirname5, join as join7, resolve as resolve6 } from "path";
|
|
5441
|
+
import { fileURLToPath as fileURLToPath4, pathToFileURL } from "url";
|
|
5505
5442
|
async function packageDirectories(root) {
|
|
5506
5443
|
let entries;
|
|
5507
5444
|
try {
|
|
@@ -5511,13 +5448,13 @@ async function packageDirectories(root) {
|
|
|
5511
5448
|
}
|
|
5512
5449
|
const directories = [];
|
|
5513
5450
|
for (const entry of entries) {
|
|
5514
|
-
const entryPath =
|
|
5451
|
+
const entryPath = join7(root, entry.name);
|
|
5515
5452
|
const isDirectory = entry.isDirectory() || entry.isSymbolicLink() && (await stat3(entryPath).catch(() => void 0))?.isDirectory();
|
|
5516
5453
|
if (!isDirectory) continue;
|
|
5517
5454
|
if (entry.name.startsWith("@")) {
|
|
5518
5455
|
const scoped = await readdir3(entryPath, { withFileTypes: true }).catch(() => []);
|
|
5519
5456
|
for (const child of scoped) {
|
|
5520
|
-
const childPath =
|
|
5457
|
+
const childPath = join7(entryPath, child.name);
|
|
5521
5458
|
const childIsDirectory = child.isDirectory() || child.isSymbolicLink() && (await stat3(childPath).catch(() => void 0))?.isDirectory();
|
|
5522
5459
|
if (childIsDirectory) directories.push(childPath);
|
|
5523
5460
|
}
|
|
@@ -5528,10 +5465,10 @@ async function packageDirectories(root) {
|
|
|
5528
5465
|
return directories;
|
|
5529
5466
|
}
|
|
5530
5467
|
async function loadProviderPlugins(options) {
|
|
5531
|
-
const moduleDirectory =
|
|
5468
|
+
const moduleDirectory = dirname5(fileURLToPath4(import.meta.url));
|
|
5532
5469
|
const roots = [
|
|
5533
|
-
|
|
5534
|
-
|
|
5470
|
+
join7(options.configDirectory, "plugins"),
|
|
5471
|
+
join7(options.cwd ?? process.cwd(), "node_modules"),
|
|
5535
5472
|
resolve6(moduleDirectory, "node_modules"),
|
|
5536
5473
|
resolve6(moduleDirectory, "../../../../node_modules")
|
|
5537
5474
|
];
|
|
@@ -5539,7 +5476,7 @@ async function loadProviderPlugins(options) {
|
|
|
5539
5476
|
const diagnostics = [];
|
|
5540
5477
|
for (const root of roots) {
|
|
5541
5478
|
for (const packageDir of await packageDirectories(root)) {
|
|
5542
|
-
const manifestPath =
|
|
5479
|
+
const manifestPath = join7(packageDir, "package.json");
|
|
5543
5480
|
let manifest;
|
|
5544
5481
|
try {
|
|
5545
5482
|
manifest = JSON.parse(await readFile2(manifestPath, "utf8"));
|
|
@@ -5580,7 +5517,7 @@ async function loadProviderPlugins(options) {
|
|
|
5580
5517
|
}
|
|
5581
5518
|
};
|
|
5582
5519
|
try {
|
|
5583
|
-
const module = await import(pathToFileURL(
|
|
5520
|
+
const module = await import(pathToFileURL(join7(packageDir, plugin)).href);
|
|
5584
5521
|
if (typeof module.register !== "function") throw new Error("Plugin does not export register(registry)");
|
|
5585
5522
|
await module.register(trackingRegistry);
|
|
5586
5523
|
diagnostic.loaded = true;
|
|
@@ -5594,8 +5531,8 @@ async function loadProviderPlugins(options) {
|
|
|
5594
5531
|
|
|
5595
5532
|
// src/server/routes/plugins.ts
|
|
5596
5533
|
import { Router as Router11 } from "express";
|
|
5597
|
-
import { fileURLToPath as
|
|
5598
|
-
import { dirname as
|
|
5534
|
+
import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL2 } from "url";
|
|
5535
|
+
import { dirname as dirname6, resolve as resolve7, join as join8 } from "path";
|
|
5599
5536
|
import { existsSync } from "fs";
|
|
5600
5537
|
import { readFile as readFile3, readdir as readdir4, rm as rm2, rename as rename2 } from "fs/promises";
|
|
5601
5538
|
import { execFile } from "child_process";
|
|
@@ -5619,7 +5556,7 @@ function createPluginRoutes(options) {
|
|
|
5619
5556
|
if (registryCache && now - registryCache.ts < 3e5) {
|
|
5620
5557
|
return res.json({ plugins: registryCache.data });
|
|
5621
5558
|
}
|
|
5622
|
-
const moduleDir =
|
|
5559
|
+
const moduleDir = dirname6(fileURLToPath5(import.meta.url));
|
|
5623
5560
|
let registryPath = resolve7(moduleDir, "../plugins-registry.json");
|
|
5624
5561
|
if (!existsSync(registryPath)) {
|
|
5625
5562
|
registryPath = resolve7(moduleDir, "../../../plugins-registry.json");
|
|
@@ -5645,9 +5582,9 @@ function createPluginRoutes(options) {
|
|
|
5645
5582
|
if (!/^[a-zA-Z0-9_-]+$/.test(repoName)) {
|
|
5646
5583
|
return res.status(400).json({ error: "Invalid repository name" });
|
|
5647
5584
|
}
|
|
5648
|
-
const pluginsDir =
|
|
5649
|
-
const targetDir =
|
|
5650
|
-
const tmpDir =
|
|
5585
|
+
const pluginsDir = join8(getGlobalConfigDir(config3.mode ?? "production"), "plugins");
|
|
5586
|
+
const targetDir = join8(pluginsDir, repoName);
|
|
5587
|
+
const tmpDir = join8(pluginsDir, `.${repoName}-tmp-${Date.now()}`);
|
|
5651
5588
|
try {
|
|
5652
5589
|
await execFileP("mkdir", ["-p", pluginsDir], { timeout: 5e3 });
|
|
5653
5590
|
} catch {
|
|
@@ -5678,7 +5615,7 @@ function createPluginRoutes(options) {
|
|
|
5678
5615
|
}
|
|
5679
5616
|
if (!loadError) {
|
|
5680
5617
|
try {
|
|
5681
|
-
const manifest = JSON.parse(await readFile3(
|
|
5618
|
+
const manifest = JSON.parse(await readFile3(join8(targetDir, "package.json"), "utf8"));
|
|
5682
5619
|
const pluginEntry = manifest.openfox?.plugin;
|
|
5683
5620
|
const apiVersion = manifest.openfox?.apiVersion;
|
|
5684
5621
|
if (!pluginEntry || !manifest.name) {
|
|
@@ -5686,7 +5623,7 @@ function createPluginRoutes(options) {
|
|
|
5686
5623
|
} else if (apiVersion !== 1) {
|
|
5687
5624
|
loadError = `Unsupported plugin API version: ${String(apiVersion)}`;
|
|
5688
5625
|
} else {
|
|
5689
|
-
const mod = await import(pathToFileURL2(
|
|
5626
|
+
const mod = await import(pathToFileURL2(join8(targetDir, pluginEntry)).href);
|
|
5690
5627
|
if (typeof mod.register !== "function") {
|
|
5691
5628
|
loadError = "Plugin does not export register(registry)";
|
|
5692
5629
|
} else {
|
|
@@ -5735,13 +5672,13 @@ function createPluginRoutes(options) {
|
|
|
5735
5672
|
}
|
|
5736
5673
|
});
|
|
5737
5674
|
router.get("/installed", async (_req, res) => {
|
|
5738
|
-
const pluginsDir =
|
|
5675
|
+
const pluginsDir = join8(getGlobalConfigDir(config3.mode ?? "production"), "plugins");
|
|
5739
5676
|
try {
|
|
5740
5677
|
const entries = await readdir4(pluginsDir, { withFileTypes: true });
|
|
5741
5678
|
const installed = [];
|
|
5742
5679
|
for (const entry of entries) {
|
|
5743
5680
|
if (!entry.isDirectory()) continue;
|
|
5744
|
-
const pkgPath =
|
|
5681
|
+
const pkgPath = join8(pluginsDir, entry.name, "package.json");
|
|
5745
5682
|
let version = null;
|
|
5746
5683
|
try {
|
|
5747
5684
|
const pkg = JSON.parse(await readFile3(pkgPath, "utf8"));
|
|
@@ -5756,13 +5693,13 @@ function createPluginRoutes(options) {
|
|
|
5756
5693
|
}
|
|
5757
5694
|
});
|
|
5758
5695
|
router.get("/open-folder", async (_req, res) => {
|
|
5759
|
-
const pluginsDir =
|
|
5696
|
+
const pluginsDir = join8(getGlobalConfigDir(config3.mode ?? "production"), "plugins");
|
|
5760
5697
|
await openFolderRoute(pluginsDir, res);
|
|
5761
5698
|
});
|
|
5762
5699
|
router.get("/:name/open-folder", async (req, res) => {
|
|
5763
5700
|
const name = req.params.name;
|
|
5764
5701
|
if (!/^[a-zA-Z0-9_-]+$/.test(name)) return res.status(400).json({ error: "Invalid plugin name" });
|
|
5765
|
-
const targetDir =
|
|
5702
|
+
const targetDir = join8(getGlobalConfigDir(config3.mode ?? "production"), "plugins", name);
|
|
5766
5703
|
await openFolderRoute(targetDir, res);
|
|
5767
5704
|
});
|
|
5768
5705
|
router.delete("/:name", async (req, res) => {
|
|
@@ -5770,7 +5707,7 @@ function createPluginRoutes(options) {
|
|
|
5770
5707
|
if (!/^[a-zA-Z0-9_-]+$/.test(name)) {
|
|
5771
5708
|
return res.status(400).json({ error: "Invalid plugin name" });
|
|
5772
5709
|
}
|
|
5773
|
-
const targetDir =
|
|
5710
|
+
const targetDir = join8(getGlobalConfigDir(config3.mode ?? "production"), "plugins", name);
|
|
5774
5711
|
try {
|
|
5775
5712
|
await rm2(targetDir, { recursive: true, force: true });
|
|
5776
5713
|
for (let i = pluginDiagnostics.length - 1; i >= 0; i--) {
|
|
@@ -5784,6 +5721,24 @@ function createPluginRoutes(options) {
|
|
|
5784
5721
|
return router;
|
|
5785
5722
|
}
|
|
5786
5723
|
|
|
5724
|
+
// src/server/routes/session-favorite.ts
|
|
5725
|
+
import "express";
|
|
5726
|
+
function registerSessionFavoriteRoute(router, sessionManager) {
|
|
5727
|
+
router.put("/sessions/:id/favorite", (req, res) => {
|
|
5728
|
+
const id = req.params["id"];
|
|
5729
|
+
const { isFavorite } = req.body;
|
|
5730
|
+
if (typeof isFavorite !== "boolean") {
|
|
5731
|
+
return res.status(400).json({ error: "isFavorite is required and must be a boolean" });
|
|
5732
|
+
}
|
|
5733
|
+
const session = sessionManager.getSession(id);
|
|
5734
|
+
if (!session) {
|
|
5735
|
+
return res.status(404).json({ error: "Session not found" });
|
|
5736
|
+
}
|
|
5737
|
+
toggleFavorite(id, isFavorite);
|
|
5738
|
+
res.json({ success: true });
|
|
5739
|
+
});
|
|
5740
|
+
}
|
|
5741
|
+
|
|
5787
5742
|
// src/server/utils/wsl.ts
|
|
5788
5743
|
import { readFileSync as readFileSync3 } from "fs";
|
|
5789
5744
|
var cached = null;
|
|
@@ -5832,13 +5787,17 @@ function detectWsl() {
|
|
|
5832
5787
|
}
|
|
5833
5788
|
|
|
5834
5789
|
// src/server/index.ts
|
|
5835
|
-
var __dirname3 =
|
|
5790
|
+
var __dirname3 = dirname7(fileURLToPath6(import.meta.url));
|
|
5836
5791
|
async function createServerHandle(config3) {
|
|
5837
5792
|
setRuntimeConfig(config3);
|
|
5838
5793
|
setLogLevel(config3.logging?.level ?? void 0, config3.mode);
|
|
5839
5794
|
await loadServerAuthConfig();
|
|
5840
5795
|
const db = initDatabase(config3);
|
|
5841
5796
|
initEventStore(db);
|
|
5797
|
+
let deferTasksBroadcast = () => {
|
|
5798
|
+
};
|
|
5799
|
+
let deferTasksLaunchWorkflow = () => {
|
|
5800
|
+
};
|
|
5842
5801
|
const configDir = getGlobalConfigDir(config3.mode ?? "production");
|
|
5843
5802
|
const providerAdapters = new ProviderRegistry({
|
|
5844
5803
|
mode: config3.mode === "development" ? "development" : "production",
|
|
@@ -5899,7 +5858,7 @@ async function createServerHandle(config3) {
|
|
|
5899
5858
|
const mcpManager = new McpManager({
|
|
5900
5859
|
onToolsDiscovered: async (name, tools) => {
|
|
5901
5860
|
try {
|
|
5902
|
-
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-
|
|
5861
|
+
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-EAB3V4QK.js");
|
|
5903
5862
|
const mode = config3.mode ?? "production";
|
|
5904
5863
|
const globalConfig = await loadGlobalConfig(mode, config3.globalConfigPath);
|
|
5905
5864
|
const mcpServers2 = {
|
|
@@ -5918,7 +5877,7 @@ async function createServerHandle(config3) {
|
|
|
5918
5877
|
setMcpConfigMode(config3.mode ?? "production");
|
|
5919
5878
|
setMcpConfigPath(config3.globalConfigPath);
|
|
5920
5879
|
setMcpOAuthStoreMode(config3.mode ?? "production");
|
|
5921
|
-
setMcpOAuthStorePath(config3.globalConfigPath ?
|
|
5880
|
+
setMcpOAuthStorePath(config3.globalConfigPath ? join9(dirname7(config3.globalConfigPath), "mcp-auth.json") : void 0);
|
|
5922
5881
|
const mcpServers = config3.mcpServers ?? {};
|
|
5923
5882
|
Promise.all(
|
|
5924
5883
|
Object.entries(mcpServers).map(
|
|
@@ -5933,7 +5892,7 @@ async function createServerHandle(config3) {
|
|
|
5933
5892
|
toolRegistry = createToolRegistry();
|
|
5934
5893
|
logger.info("MCP tools registered", { count: mcpTools.length });
|
|
5935
5894
|
}
|
|
5936
|
-
const { signalMcpReady } = await import("./server-
|
|
5895
|
+
const { signalMcpReady } = await import("./server-EPXODFMB.js");
|
|
5937
5896
|
signalMcpReady();
|
|
5938
5897
|
});
|
|
5939
5898
|
const app = express();
|
|
@@ -5963,11 +5922,11 @@ async function createServerHandle(config3) {
|
|
|
5963
5922
|
try {
|
|
5964
5923
|
const fs = await import("fs");
|
|
5965
5924
|
const path = await import("path");
|
|
5966
|
-
const { fileURLToPath:
|
|
5967
|
-
const
|
|
5968
|
-
let changelogPath = path.resolve(
|
|
5925
|
+
const { fileURLToPath: fileURLToPath7 } = await import("url");
|
|
5926
|
+
const dirname8 = path.dirname(fileURLToPath7(import.meta.url));
|
|
5927
|
+
let changelogPath = path.resolve(dirname8, "../CHANGELOG.md");
|
|
5969
5928
|
if (!fs.existsSync(changelogPath)) {
|
|
5970
|
-
changelogPath = path.resolve(
|
|
5929
|
+
changelogPath = path.resolve(dirname8, "../../CHANGELOG.md");
|
|
5971
5930
|
}
|
|
5972
5931
|
const content = fs.readFileSync(changelogPath, "utf-8");
|
|
5973
5932
|
res.json({ content });
|
|
@@ -6014,7 +5973,7 @@ async function createServerHandle(config3) {
|
|
|
6014
5973
|
res.json({ tools });
|
|
6015
5974
|
});
|
|
6016
5975
|
app.get("/api/projects", async (_req, res) => {
|
|
6017
|
-
const { listProjects: listProjects2 } = await import("./projects-
|
|
5976
|
+
const { listProjects: listProjects2 } = await import("./projects-SSBWIYL4.js");
|
|
6018
5977
|
const projects = listProjects2();
|
|
6019
5978
|
res.json({ projects });
|
|
6020
5979
|
});
|
|
@@ -6023,7 +5982,7 @@ async function createServerHandle(config3) {
|
|
|
6023
5982
|
if (!name || !workdir) {
|
|
6024
5983
|
return res.status(400).json({ error: "name and workdir are required" });
|
|
6025
5984
|
}
|
|
6026
|
-
const { createDirectoryWithGit } = await import("./project-creator-
|
|
5985
|
+
const { createDirectoryWithGit } = await import("./project-creator-676WQXVI.js");
|
|
6027
5986
|
try {
|
|
6028
5987
|
const project = await createDirectoryWithGit(name, workdir);
|
|
6029
5988
|
res.status(201).json({ project });
|
|
@@ -6068,7 +6027,7 @@ async function createServerHandle(config3) {
|
|
|
6068
6027
|
}
|
|
6069
6028
|
});
|
|
6070
6029
|
app.get("/api/projects/:id", async (req, res) => {
|
|
6071
|
-
const { getProject: getProject2 } = await import("./projects-
|
|
6030
|
+
const { getProject: getProject2 } = await import("./projects-SSBWIYL4.js");
|
|
6072
6031
|
const project = getProject2(req.params.id);
|
|
6073
6032
|
if (!project) {
|
|
6074
6033
|
return res.status(404).json({ error: "Project not found" });
|
|
@@ -6076,7 +6035,7 @@ async function createServerHandle(config3) {
|
|
|
6076
6035
|
res.json({ project });
|
|
6077
6036
|
});
|
|
6078
6037
|
app.get("/api/projects/:id/open-folder", async (req, res) => {
|
|
6079
|
-
const { getProject: getProject2 } = await import("./projects-
|
|
6038
|
+
const { getProject: getProject2 } = await import("./projects-SSBWIYL4.js");
|
|
6080
6039
|
const project = getProject2(req.params.id);
|
|
6081
6040
|
if (!project) {
|
|
6082
6041
|
return res.status(404).json({ error: "Project not found" });
|
|
@@ -6090,7 +6049,7 @@ async function createServerHandle(config3) {
|
|
|
6090
6049
|
}
|
|
6091
6050
|
});
|
|
6092
6051
|
app.put("/api/projects/:id", async (req, res) => {
|
|
6093
|
-
const { updateProject: updateProject2 } = await import("./projects-
|
|
6052
|
+
const { updateProject: updateProject2 } = await import("./projects-SSBWIYL4.js");
|
|
6094
6053
|
const { name, customInstructions, dangerLevel } = req.body;
|
|
6095
6054
|
const updates = {};
|
|
6096
6055
|
if (name !== void 0) updates.name = name;
|
|
@@ -6103,7 +6062,7 @@ async function createServerHandle(config3) {
|
|
|
6103
6062
|
res.json({ project: updated });
|
|
6104
6063
|
});
|
|
6105
6064
|
app.delete("/api/projects/:id", async (req, res) => {
|
|
6106
|
-
const { getProject: getProject2, deleteProject } = await import("./projects-
|
|
6065
|
+
const { getProject: getProject2, deleteProject } = await import("./projects-SSBWIYL4.js");
|
|
6107
6066
|
const project = getProject2(req.params.id);
|
|
6108
6067
|
if (!project) {
|
|
6109
6068
|
return res.status(404).json({ error: "Project not found" });
|
|
@@ -6112,7 +6071,7 @@ async function createServerHandle(config3) {
|
|
|
6112
6071
|
res.json({ success: true });
|
|
6113
6072
|
});
|
|
6114
6073
|
app.put("/api/projects/:id/star", async (req, res) => {
|
|
6115
|
-
const { toggleStar } = await import("./projects-
|
|
6074
|
+
const { toggleStar } = await import("./projects-SSBWIYL4.js");
|
|
6116
6075
|
const { isStarred } = req.body;
|
|
6117
6076
|
if (typeof isStarred !== "boolean") {
|
|
6118
6077
|
return res.status(400).json({ error: "isStarred is required and must be a boolean" });
|
|
@@ -6123,27 +6082,44 @@ async function createServerHandle(config3) {
|
|
|
6123
6082
|
}
|
|
6124
6083
|
res.json({ project });
|
|
6125
6084
|
});
|
|
6085
|
+
const sessionFavoriteRouter = express.Router();
|
|
6086
|
+
registerSessionFavoriteRoute(sessionFavoriteRouter, sessionManager);
|
|
6087
|
+
app.use("/api", sessionFavoriteRouter);
|
|
6088
|
+
const { createTasksService } = await import("./service-54PGIPDQ.js");
|
|
6089
|
+
const { registerTaskRoutes } = await import("./tasks-TJXG2V3U.js");
|
|
6090
|
+
const { setTasksService } = await import("./tools-CIM26IFB.js");
|
|
6091
|
+
const tasksService = createTasksService({
|
|
6092
|
+
sessionManager,
|
|
6093
|
+
config: config3,
|
|
6094
|
+
broadcast: (projectId, payload) => deferTasksBroadcast(projectId, payload),
|
|
6095
|
+
configDir,
|
|
6096
|
+
launchWorkflow: (sessionId, launch) => deferTasksLaunchWorkflow(sessionId, launch)
|
|
6097
|
+
});
|
|
6098
|
+
setTasksService(tasksService);
|
|
6099
|
+
const tasksRouter = express.Router();
|
|
6100
|
+
registerTaskRoutes(tasksRouter, tasksService);
|
|
6101
|
+
app.use("/api", tasksRouter);
|
|
6126
6102
|
app.get("/api/projects/:id/branches", async (req, res) => {
|
|
6127
|
-
const { getProject: getProject2 } = await import("./projects-
|
|
6103
|
+
const { getProject: getProject2 } = await import("./projects-SSBWIYL4.js");
|
|
6128
6104
|
const project = getProject2(req.params.id);
|
|
6129
6105
|
if (!project) return res.status(404).json({ error: "Project not found" });
|
|
6130
|
-
const { listBranches } = await import("./workspace-
|
|
6106
|
+
const { listBranches } = await import("./workspace-2XODU4YJ.js");
|
|
6131
6107
|
const branches = await listBranches(project.workdir);
|
|
6132
6108
|
res.json({ branches });
|
|
6133
6109
|
});
|
|
6134
6110
|
app.post("/api/projects/:id/checkout", async (req, res) => {
|
|
6135
|
-
const { getProject: getProject2 } = await import("./projects-
|
|
6111
|
+
const { getProject: getProject2 } = await import("./projects-SSBWIYL4.js");
|
|
6136
6112
|
const project = getProject2(req.params.id);
|
|
6137
6113
|
if (!project) return res.status(404).json({ error: "Project not found" });
|
|
6138
6114
|
const { branch } = req.body;
|
|
6139
6115
|
if (!branch || typeof branch !== "string") return res.status(400).json({ error: "branch is required" });
|
|
6140
|
-
const { checkoutBranch, isGitRepository } = await import("./workspace-
|
|
6116
|
+
const { checkoutBranch, isGitRepository } = await import("./workspace-2XODU4YJ.js");
|
|
6141
6117
|
if (!await isGitRepository(project.workdir)) {
|
|
6142
6118
|
return res.status(400).json({ error: "Project is not a git repository" });
|
|
6143
6119
|
}
|
|
6144
6120
|
try {
|
|
6145
6121
|
await checkoutBranch(project.workdir, branch);
|
|
6146
|
-
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-
|
|
6122
|
+
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-CHPVUG6H.js");
|
|
6147
6123
|
const allSessions = sessionManager.listSessions();
|
|
6148
6124
|
for (const s of allSessions) {
|
|
6149
6125
|
if (sessionManager.getEffectiveWorkdir(s.id) === project.workdir) {
|
|
@@ -6157,12 +6133,12 @@ async function createServerHandle(config3) {
|
|
|
6157
6133
|
}
|
|
6158
6134
|
});
|
|
6159
6135
|
app.post("/api/projects/:id/checkout-new", async (req, res) => {
|
|
6160
|
-
const { getProject: getProject2 } = await import("./projects-
|
|
6136
|
+
const { getProject: getProject2 } = await import("./projects-SSBWIYL4.js");
|
|
6161
6137
|
const project = getProject2(req.params.id);
|
|
6162
6138
|
if (!project) return res.status(404).json({ error: "Project not found" });
|
|
6163
6139
|
const { name, sourceBranch } = req.body;
|
|
6164
6140
|
if (!name || typeof name !== "string") return res.status(400).json({ error: "name is required" });
|
|
6165
|
-
const { createBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, validateRef: validateRef2, getDefaultBranch, isGitRepository } = await import("./workspace-
|
|
6141
|
+
const { createBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, validateRef: validateRef2, getDefaultBranch, isGitRepository } = await import("./workspace-2XODU4YJ.js");
|
|
6166
6142
|
if (!await isGitRepository(project.workdir)) {
|
|
6167
6143
|
return res.status(400).json({ error: "Project is not a git repository" });
|
|
6168
6144
|
}
|
|
@@ -6179,7 +6155,7 @@ async function createServerHandle(config3) {
|
|
|
6179
6155
|
);
|
|
6180
6156
|
}
|
|
6181
6157
|
await createBranch(project.workdir, name, sb);
|
|
6182
|
-
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-
|
|
6158
|
+
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-CHPVUG6H.js");
|
|
6183
6159
|
const allSessions = sessionManager.listSessions();
|
|
6184
6160
|
for (const s of allSessions) {
|
|
6185
6161
|
if (sessionManager.getEffectiveWorkdir(s.id) === project.workdir) {
|
|
@@ -6196,7 +6172,7 @@ async function createServerHandle(config3) {
|
|
|
6196
6172
|
const session = sessionManager.getSession(req.params.id);
|
|
6197
6173
|
if (!session) return res.status(404).json({ error: "Session not found" });
|
|
6198
6174
|
const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
|
|
6199
|
-
const { listBranches, getDefaultBranch } = await import("./workspace-
|
|
6175
|
+
const { listBranches, getDefaultBranch } = await import("./workspace-2XODU4YJ.js");
|
|
6200
6176
|
const [branches, defaultBranch] = await Promise.all([
|
|
6201
6177
|
listBranches(effectiveWorkdir),
|
|
6202
6178
|
getDefaultBranch(session.workdir)
|
|
@@ -6210,8 +6186,8 @@ async function createServerHandle(config3) {
|
|
|
6210
6186
|
const { branch } = req.body;
|
|
6211
6187
|
if (!branch || typeof branch !== "string") return res.status(400).json({ error: "branch is required" });
|
|
6212
6188
|
const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
|
|
6213
|
-
const { checkoutBranch, validateRef: validateRef2 } = await import("./workspace-
|
|
6214
|
-
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-
|
|
6189
|
+
const { checkoutBranch, validateRef: validateRef2 } = await import("./workspace-2XODU4YJ.js");
|
|
6190
|
+
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-CHPVUG6H.js");
|
|
6215
6191
|
try {
|
|
6216
6192
|
await validateRef2(effectiveWorkdir, branch);
|
|
6217
6193
|
await checkoutBranch(effectiveWorkdir, branch);
|
|
@@ -6253,16 +6229,16 @@ All file and git operations should use this branch.
|
|
|
6253
6229
|
const { name, sourceBranch } = req.body;
|
|
6254
6230
|
if (!name || typeof name !== "string") return res.status(400).json({ error: "name is required" });
|
|
6255
6231
|
const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
|
|
6256
|
-
const { validateRef: validateRef2 } = await import("./workspace-
|
|
6257
|
-
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-
|
|
6232
|
+
const { validateRef: validateRef2 } = await import("./workspace-2XODU4YJ.js");
|
|
6233
|
+
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-CHPVUG6H.js");
|
|
6258
6234
|
try {
|
|
6259
6235
|
await validateRef2(effectiveWorkdir, name);
|
|
6260
6236
|
if (sourceBranch) {
|
|
6261
|
-
const { resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, createBranch } = await import("./workspace-
|
|
6237
|
+
const { resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, createBranch } = await import("./workspace-2XODU4YJ.js");
|
|
6262
6238
|
const sb = await resolveAndValidateSourceBranch2(effectiveWorkdir, sourceBranch, session.workdir);
|
|
6263
6239
|
await createBranch(effectiveWorkdir, name, sb);
|
|
6264
6240
|
} else {
|
|
6265
|
-
const { createBranch, getDefaultBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2 } = await import("./workspace-
|
|
6241
|
+
const { createBranch, getDefaultBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2 } = await import("./workspace-2XODU4YJ.js");
|
|
6266
6242
|
const defaultBranch = await getDefaultBranch(session.workdir);
|
|
6267
6243
|
const sb = await resolveAndValidateSourceBranch2(effectiveWorkdir, defaultBranch, session.workdir);
|
|
6268
6244
|
await createBranch(effectiveWorkdir, name, sb);
|
|
@@ -6300,17 +6276,17 @@ All file and git operations should use this branch.
|
|
|
6300
6276
|
}
|
|
6301
6277
|
});
|
|
6302
6278
|
app.get("/api/projects/:id/workspaces", async (req, res) => {
|
|
6303
|
-
const { getProject: getProject2 } = await import("./projects-
|
|
6279
|
+
const { getProject: getProject2 } = await import("./projects-SSBWIYL4.js");
|
|
6304
6280
|
const project = getProject2(req.params.id);
|
|
6305
6281
|
if (!project) return res.status(404).json({ error: "Project not found" });
|
|
6306
|
-
const { listWorkspaces } = await import("./workspace-
|
|
6282
|
+
const { listWorkspaces } = await import("./workspace-2XODU4YJ.js");
|
|
6307
6283
|
const all = await listWorkspaces(project.name, project.workdir);
|
|
6308
6284
|
const workspacesList = all.filter((ws) => ws.path !== project.workdir);
|
|
6309
6285
|
res.json({ workspaces: workspacesList });
|
|
6310
6286
|
});
|
|
6311
6287
|
app.get("/api/sessions", async (req, res) => {
|
|
6312
|
-
const { getRecentUserPromptsForSession } = await import("./events-
|
|
6313
|
-
const { getPendingConfirmationsBySession } = await import("./path-security-
|
|
6288
|
+
const { getRecentUserPromptsForSession } = await import("./events-PI7IMPHT.js");
|
|
6289
|
+
const { getPendingConfirmationsBySession } = await import("./path-security-RSEI3YKB.js");
|
|
6314
6290
|
const projectId = req.query["projectId"];
|
|
6315
6291
|
const rawLimit = req.query["limit"];
|
|
6316
6292
|
const offset = parseInt(req.query["offset"]) || 0;
|
|
@@ -6365,7 +6341,7 @@ All file and git operations should use this branch.
|
|
|
6365
6341
|
disabledServers = mcpManager.getAllServers().filter((s) => s.config.disabled).map((s) => s.name);
|
|
6366
6342
|
}
|
|
6367
6343
|
if (disabledServers.length > 0) {
|
|
6368
|
-
const { setSessionDisabledServers: setSessionDisabledServers2 } = await import("./session-overrides-
|
|
6344
|
+
const { setSessionDisabledServers: setSessionDisabledServers2 } = await import("./session-overrides-LXN6W7SA.js");
|
|
6369
6345
|
setSessionDisabledServers2(session.id, disabledServers);
|
|
6370
6346
|
}
|
|
6371
6347
|
} catch {
|
|
@@ -6402,7 +6378,7 @@ All file and git operations should use this branch.
|
|
|
6402
6378
|
if (!target || typeof target !== "string") return res.status(400).json({ error: "target is required" });
|
|
6403
6379
|
const project = sessionManager.getProject(session.projectId);
|
|
6404
6380
|
if (!project) return res.status(404).json({ error: "Project not found" });
|
|
6405
|
-
const { isGitRepository } = await import("./workspace-
|
|
6381
|
+
const { isGitRepository } = await import("./workspace-2XODU4YJ.js");
|
|
6406
6382
|
if (!await isGitRepository(project.workdir)) {
|
|
6407
6383
|
return res.status(400).json({ error: "Project is not a git repository" });
|
|
6408
6384
|
}
|
|
@@ -6420,7 +6396,7 @@ All file and git operations should use this branch.
|
|
|
6420
6396
|
if (!target || typeof target !== "string") return res.status(400).json({ error: "target is required" });
|
|
6421
6397
|
const project = sessionManager.getProject(session.projectId);
|
|
6422
6398
|
if (!project) return res.status(404).json({ error: "Project not found" });
|
|
6423
|
-
const { isGitRepository } = await import("./workspace-
|
|
6399
|
+
const { isGitRepository } = await import("./workspace-2XODU4YJ.js");
|
|
6424
6400
|
if (!await isGitRepository(project.workdir)) {
|
|
6425
6401
|
return res.status(400).json({ error: "Project is not a git repository" });
|
|
6426
6402
|
}
|
|
@@ -6438,12 +6414,12 @@ All file and git operations should use this branch.
|
|
|
6438
6414
|
}
|
|
6439
6415
|
});
|
|
6440
6416
|
app.get("/api/sessions/:id", async (req, res) => {
|
|
6441
|
-
const { getEventStore: getEventStore2, combineEventsWithSnapshot } = await import("./events-
|
|
6442
|
-
const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-
|
|
6443
|
-
const { getPendingQuestionsForSession } = await import("./tools-
|
|
6444
|
-
const { getMaxVisibleItems } = await import("./settings-
|
|
6445
|
-
const { getAgentModelOverride: getAgentModelOverride2 } = await import("./model-overrides-
|
|
6446
|
-
const { updateSessionProvider: updateSessionProvider2 } = await import("./sessions-
|
|
6417
|
+
const { getEventStore: getEventStore2, combineEventsWithSnapshot } = await import("./events-PI7IMPHT.js");
|
|
6418
|
+
const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-FO57K4JM.js");
|
|
6419
|
+
const { getPendingQuestionsForSession } = await import("./tools-CIM26IFB.js");
|
|
6420
|
+
const { getMaxVisibleItems } = await import("./settings-NEBM3GQX.js");
|
|
6421
|
+
const { getAgentModelOverride: getAgentModelOverride2 } = await import("./model-overrides-L53PZNZA.js");
|
|
6422
|
+
const { updateSessionProvider: updateSessionProvider2 } = await import("./sessions-CHPVUG6H.js");
|
|
6447
6423
|
let session = sessionManager.getSession(req.params.id);
|
|
6448
6424
|
if (!session) {
|
|
6449
6425
|
return res.status(404).json({ error: "Session not found" });
|
|
@@ -6482,8 +6458,8 @@ All file and git operations should use this branch.
|
|
|
6482
6458
|
if (!session) {
|
|
6483
6459
|
return res.status(404).json({ error: "Session not found" });
|
|
6484
6460
|
}
|
|
6485
|
-
const { stopSessionExecution } = await import("./chat-handler-
|
|
6486
|
-
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-
|
|
6461
|
+
const { stopSessionExecution } = await import("./chat-handler-KWXRSWXZ.js");
|
|
6462
|
+
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-CIM26IFB.js");
|
|
6487
6463
|
sessionManager.clearMessageQueue(sessionId);
|
|
6488
6464
|
stopSessionExecution(sessionId, sessionManager);
|
|
6489
6465
|
abortSession(sessionId);
|
|
@@ -6512,9 +6488,9 @@ All file and git operations should use this branch.
|
|
|
6512
6488
|
res.json({ success: true });
|
|
6513
6489
|
});
|
|
6514
6490
|
app.post("/api/sessions/:id/provider", async (req, res) => {
|
|
6515
|
-
const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-
|
|
6516
|
-
const { buildMessagesFromStoredEvents } = await import("./folding-
|
|
6517
|
-
const { getMaxVisibleItems } = await import("./settings-
|
|
6491
|
+
const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-PI7IMPHT.js");
|
|
6492
|
+
const { buildMessagesFromStoredEvents } = await import("./folding-FO57K4JM.js");
|
|
6493
|
+
const { getMaxVisibleItems } = await import("./settings-NEBM3GQX.js");
|
|
6518
6494
|
const sessionId = req.params.id;
|
|
6519
6495
|
const session = sessionManager.getSession(sessionId);
|
|
6520
6496
|
if (!session) {
|
|
@@ -6549,7 +6525,7 @@ All file and git operations should use this branch.
|
|
|
6549
6525
|
if (!result.success) {
|
|
6550
6526
|
return res.status(500).json({ error: result.error ?? "Failed to set default model" });
|
|
6551
6527
|
}
|
|
6552
|
-
const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-
|
|
6528
|
+
const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-EAB3V4QK.js");
|
|
6553
6529
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
6554
6530
|
const updatedConfig = setDefaultModelSelection(globalConfig, providerId, model);
|
|
6555
6531
|
await saveGlobalConfig(config3.mode ?? "production", updatedConfig, config3.globalConfigPath);
|
|
@@ -6627,11 +6603,11 @@ All file and git operations should use this branch.
|
|
|
6627
6603
|
res.json({ success: true });
|
|
6628
6604
|
});
|
|
6629
6605
|
app.put("/api/sessions/:id/mode", async (req, res) => {
|
|
6630
|
-
const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-
|
|
6631
|
-
const { buildMessagesFromStoredEvents } = await import("./folding-
|
|
6632
|
-
const { getMaxVisibleItems } = await import("./settings-
|
|
6633
|
-
const { getAgentModelOverride: getAgentModelOverride2 } = await import("./model-overrides-
|
|
6634
|
-
const { updateSessionProvider: updateSessionProvider2 } = await import("./sessions-
|
|
6606
|
+
const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-PI7IMPHT.js");
|
|
6607
|
+
const { buildMessagesFromStoredEvents } = await import("./folding-FO57K4JM.js");
|
|
6608
|
+
const { getMaxVisibleItems } = await import("./settings-NEBM3GQX.js");
|
|
6609
|
+
const { getAgentModelOverride: getAgentModelOverride2 } = await import("./model-overrides-L53PZNZA.js");
|
|
6610
|
+
const { updateSessionProvider: updateSessionProvider2 } = await import("./sessions-CHPVUG6H.js");
|
|
6635
6611
|
const sessionId = req.params.id;
|
|
6636
6612
|
const session = sessionManager.getSession(sessionId);
|
|
6637
6613
|
if (!session) {
|
|
@@ -6733,7 +6709,7 @@ All file and git operations should use this branch.
|
|
|
6733
6709
|
if (alwaysAllow !== void 0 && typeof alwaysAllow !== "boolean") {
|
|
6734
6710
|
return res.status(400).json({ error: "alwaysAllow must be a boolean if provided" });
|
|
6735
6711
|
}
|
|
6736
|
-
const { providePathConfirmation, getConfirmationSessionId } = await import("./tools-
|
|
6712
|
+
const { providePathConfirmation, getConfirmationSessionId } = await import("./tools-CIM26IFB.js");
|
|
6737
6713
|
const pendingSessionId = getConfirmationSessionId(callId);
|
|
6738
6714
|
if (!pendingSessionId) {
|
|
6739
6715
|
return res.status(404).json({ error: "No pending path confirmation with that ID" });
|
|
@@ -6745,11 +6721,11 @@ All file and git operations should use this branch.
|
|
|
6745
6721
|
if (!result.found) {
|
|
6746
6722
|
return res.status(404).json({ error: "No pending path confirmation with that ID" });
|
|
6747
6723
|
}
|
|
6748
|
-
const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEvents } = await import("./events-
|
|
6749
|
-
const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-
|
|
6750
|
-
const { createSessionStateMessage } = await import("./protocol-
|
|
6751
|
-
const { getPendingQuestionsForSession } = await import("./tools-
|
|
6752
|
-
const { getMaxVisibleItems } = await import("./settings-
|
|
6724
|
+
const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEvents } = await import("./events-PI7IMPHT.js");
|
|
6725
|
+
const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-FO57K4JM.js");
|
|
6726
|
+
const { createSessionStateMessage } = await import("./protocol-RKSWKNXI.js");
|
|
6727
|
+
const { getPendingQuestionsForSession } = await import("./tools-CIM26IFB.js");
|
|
6728
|
+
const { getMaxVisibleItems } = await import("./settings-NEBM3GQX.js");
|
|
6753
6729
|
const eventStore = getEventStore2();
|
|
6754
6730
|
const { snapshot, events: eventsSinceSnapshot } = eventStore.getEventsSinceSnapshot(sessionId);
|
|
6755
6731
|
const events = combineEvents(sessionId, snapshot, eventsSinceSnapshot);
|
|
@@ -6785,7 +6761,7 @@ All file and git operations should use this branch.
|
|
|
6785
6761
|
if (!skip && typeof answer !== "string") {
|
|
6786
6762
|
return res.status(400).json({ error: "answer is required when not skipping" });
|
|
6787
6763
|
}
|
|
6788
|
-
const { provideAnswer } = await import("./tools-
|
|
6764
|
+
const { provideAnswer } = await import("./tools-CIM26IFB.js");
|
|
6789
6765
|
const found = provideAnswer(callId, answer ?? "", skip ?? false);
|
|
6790
6766
|
if (!found) {
|
|
6791
6767
|
return res.status(404).json({ error: "No pending question with that ID" });
|
|
@@ -6818,7 +6794,7 @@ All file and git operations should use this branch.
|
|
|
6818
6794
|
if (!session) {
|
|
6819
6795
|
return res.status(404).json({ error: "Session not found" });
|
|
6820
6796
|
}
|
|
6821
|
-
const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-
|
|
6797
|
+
const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-NEBM3GQX.js");
|
|
6822
6798
|
if (getSetting2(SETTINGS_KEYS.CACHE_WARMING) !== "true") {
|
|
6823
6799
|
return res.json({ success: false, reason: "disabled" });
|
|
6824
6800
|
}
|
|
@@ -6850,7 +6826,7 @@ All file and git operations should use this branch.
|
|
|
6850
6826
|
backend: activeProvider?.backend ?? llmClient.getBackend(),
|
|
6851
6827
|
model: llmClient.getModel()
|
|
6852
6828
|
};
|
|
6853
|
-
const { runAgentTurn, TurnMetrics } = await import("./orchestrator-
|
|
6829
|
+
const { runAgentTurn, TurnMetrics } = await import("./orchestrator-XK5K3RPL.js");
|
|
6854
6830
|
runAgentTurn(
|
|
6855
6831
|
{
|
|
6856
6832
|
sessionManager,
|
|
@@ -6888,15 +6864,15 @@ All file and git operations should use this branch.
|
|
|
6888
6864
|
if (!session) {
|
|
6889
6865
|
return res.status(404).json({ error: "Session not found" });
|
|
6890
6866
|
}
|
|
6891
|
-
const { stopSessionExecution } = await import("./chat-handler-
|
|
6892
|
-
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-
|
|
6867
|
+
const { stopSessionExecution } = await import("./chat-handler-KWXRSWXZ.js");
|
|
6868
|
+
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-CIM26IFB.js");
|
|
6893
6869
|
const queuedMessages = sessionManager.getQueueState(sessionId);
|
|
6894
6870
|
sessionManager.clearMessageQueue(sessionId);
|
|
6895
6871
|
stopSessionExecution(sessionId, sessionManager);
|
|
6896
6872
|
abortSession(sessionId);
|
|
6897
6873
|
cancelQuestionsForSession(sessionId, "Session stopped by user");
|
|
6898
6874
|
cancelPathConfirmationsForSession(sessionId, "Session stopped by user");
|
|
6899
|
-
const eventStore = (await import("./events-
|
|
6875
|
+
const eventStore = (await import("./events-PI7IMPHT.js")).getEventStore();
|
|
6900
6876
|
eventStore.append(sessionId, { type: "running.changed", data: { isRunning: false } });
|
|
6901
6877
|
res.json({ success: true, queuedMessages });
|
|
6902
6878
|
});
|
|
@@ -6910,7 +6886,7 @@ All file and git operations should use this branch.
|
|
|
6910
6886
|
if (typeof messageIndex !== "number" || messageIndex < 0) {
|
|
6911
6887
|
return res.status(400).json({ error: "messageIndex must be a non-negative number" });
|
|
6912
6888
|
}
|
|
6913
|
-
const { truncateSessionMessages } = await import("./events-
|
|
6889
|
+
const { truncateSessionMessages } = await import("./events-PI7IMPHT.js");
|
|
6914
6890
|
truncateSessionMessages(sessionId, messageIndex);
|
|
6915
6891
|
res.json({ success: true });
|
|
6916
6892
|
});
|
|
@@ -6920,15 +6896,18 @@ All file and git operations should use this branch.
|
|
|
6920
6896
|
if (!session) {
|
|
6921
6897
|
return res.status(404).json({ error: "Session not found" });
|
|
6922
6898
|
}
|
|
6923
|
-
const { messageId, content } = req.body;
|
|
6899
|
+
const { messageId, content, attachments } = req.body;
|
|
6924
6900
|
if (typeof messageId !== "string" || !messageId) {
|
|
6925
6901
|
return res.status(400).json({ error: "messageId is required" });
|
|
6926
6902
|
}
|
|
6927
6903
|
if (content !== void 0 && (typeof content !== "string" || !content.trim())) {
|
|
6928
6904
|
return res.status(400).json({ error: "content must be a non-empty string if provided" });
|
|
6929
6905
|
}
|
|
6930
|
-
|
|
6931
|
-
|
|
6906
|
+
if (attachments !== void 0 && !Array.isArray(attachments)) {
|
|
6907
|
+
return res.status(400).json({ error: "attachments must be an array if provided" });
|
|
6908
|
+
}
|
|
6909
|
+
const { getEventStore: getEventStore2 } = await import("./events-PI7IMPHT.js");
|
|
6910
|
+
const { buildMessagesFromStoredEvents } = await import("./folding-FO57K4JM.js");
|
|
6932
6911
|
const eventStore = getEventStore2();
|
|
6933
6912
|
const events = eventStore.getEvents(sessionId);
|
|
6934
6913
|
const { messages } = buildMessagesFromStoredEvents(events);
|
|
@@ -6940,9 +6919,15 @@ All file and git operations should use this branch.
|
|
|
6940
6919
|
if (msg.role !== "user" || msg.isSystemGenerated) {
|
|
6941
6920
|
return res.status(400).json({ error: "Can only replay user messages" });
|
|
6942
6921
|
}
|
|
6943
|
-
const { truncateSessionMessages } = await import("./events-
|
|
6922
|
+
const { truncateSessionMessages } = await import("./events-PI7IMPHT.js");
|
|
6944
6923
|
truncateSessionMessages(sessionId, msgIndex - 1);
|
|
6945
|
-
sessionManager.queueMessage(
|
|
6924
|
+
sessionManager.queueMessage(
|
|
6925
|
+
sessionId,
|
|
6926
|
+
"asap",
|
|
6927
|
+
content ?? msg.content,
|
|
6928
|
+
attachments ?? msg.attachments,
|
|
6929
|
+
msg.messageKind
|
|
6930
|
+
);
|
|
6946
6931
|
res.json({ success: true });
|
|
6947
6932
|
});
|
|
6948
6933
|
app.post("/api/sessions/:id/fork", async (req, res) => {
|
|
@@ -6996,7 +6981,7 @@ All file and git operations should use this branch.
|
|
|
6996
6981
|
res.json({ accepted: true });
|
|
6997
6982
|
});
|
|
6998
6983
|
app.get("/api/settings", async (req, res) => {
|
|
6999
|
-
const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-
|
|
6984
|
+
const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-NEBM3GQX.js");
|
|
7000
6985
|
const keysParam = req.query["keys"];
|
|
7001
6986
|
if (!keysParam) {
|
|
7002
6987
|
return res.status(400).json({ error: "keys query parameter is required" });
|
|
@@ -7009,19 +6994,19 @@ All file and git operations should use this branch.
|
|
|
7009
6994
|
res.json(result);
|
|
7010
6995
|
});
|
|
7011
6996
|
app.get("/api/settings/:key", async (req, res) => {
|
|
7012
|
-
const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-
|
|
6997
|
+
const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-NEBM3GQX.js");
|
|
7013
6998
|
const key = req.params.key;
|
|
7014
6999
|
const value = getSetting2(key) ?? SETTINGS_DEFAULTS[key] ?? null;
|
|
7015
7000
|
res.json({ key, value });
|
|
7016
7001
|
});
|
|
7017
7002
|
app.get("/api/settings/:key", async (req, res) => {
|
|
7018
|
-
const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-
|
|
7003
|
+
const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-NEBM3GQX.js");
|
|
7019
7004
|
const key = req.params.key;
|
|
7020
7005
|
const value = getSetting2(key) ?? SETTINGS_DEFAULTS[key] ?? null;
|
|
7021
7006
|
res.json({ key, value });
|
|
7022
7007
|
});
|
|
7023
7008
|
app.put("/api/settings/:key", async (req, res) => {
|
|
7024
|
-
const { setSetting: setSetting2 } = await import("./settings-
|
|
7009
|
+
const { setSetting: setSetting2 } = await import("./settings-NEBM3GQX.js");
|
|
7025
7010
|
const key = req.params.key;
|
|
7026
7011
|
const { value } = req.body;
|
|
7027
7012
|
if (value === void 0) {
|
|
@@ -7048,7 +7033,7 @@ All file and git operations should use this branch.
|
|
|
7048
7033
|
}
|
|
7049
7034
|
});
|
|
7050
7035
|
app.get("/api/tools/shells", async (_req, res) => {
|
|
7051
|
-
const { listAvailableShells } = await import("./platform-
|
|
7036
|
+
const { listAvailableShells } = await import("./platform-WA4GK5BO.js");
|
|
7052
7037
|
res.json({ shells: listAvailableShells() });
|
|
7053
7038
|
});
|
|
7054
7039
|
app.get("/api/config", async (_req, res) => {
|
|
@@ -7057,7 +7042,7 @@ All file and git operations should use this branch.
|
|
|
7057
7042
|
let visionFallback;
|
|
7058
7043
|
let globalWorkdir;
|
|
7059
7044
|
try {
|
|
7060
|
-
const { loadGlobalConfig, getVisionFallback } = await import("./config-
|
|
7045
|
+
const { loadGlobalConfig, getVisionFallback } = await import("./config-EAB3V4QK.js");
|
|
7061
7046
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
7062
7047
|
const fallback = getVisionFallback(globalConfig);
|
|
7063
7048
|
if (fallback) {
|
|
@@ -7138,7 +7123,7 @@ All file and git operations should use this branch.
|
|
|
7138
7123
|
}));
|
|
7139
7124
|
}
|
|
7140
7125
|
app.post("/api/proxy/test", async (_req, res) => {
|
|
7141
|
-
const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-
|
|
7126
|
+
const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-NEBM3GQX.js");
|
|
7142
7127
|
const proxyUrl = getSetting2(SETTINGS_KEYS.PROXY_URL);
|
|
7143
7128
|
if (!proxyUrl) {
|
|
7144
7129
|
return res.status(400).json({ success: false, error: "No proxy URL configured" });
|
|
@@ -7230,7 +7215,7 @@ All file and git operations should use this branch.
|
|
|
7230
7215
|
}
|
|
7231
7216
|
});
|
|
7232
7217
|
app.post("/api/proxy/test", async (_req, res) => {
|
|
7233
|
-
const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-
|
|
7218
|
+
const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-NEBM3GQX.js");
|
|
7234
7219
|
const proxyUrl = getSetting2(SETTINGS_KEYS.PROXY_URL);
|
|
7235
7220
|
if (!proxyUrl) {
|
|
7236
7221
|
return res.status(400).json({ success: false, error: "No proxy URL configured" });
|
|
@@ -7257,7 +7242,7 @@ All file and git operations should use this branch.
|
|
|
7257
7242
|
const backend = req.query["backend"];
|
|
7258
7243
|
if (!url) return res.status(400).json({ error: "url is required" });
|
|
7259
7244
|
try {
|
|
7260
|
-
const { fetchModelsWithContext } = await import("./provider-manager-
|
|
7245
|
+
const { fetchModelsWithContext } = await import("./provider-manager-2QSJTPWS.js");
|
|
7261
7246
|
const { getModelProfile: getModelProfile2 } = await import("./profiles-5J7F4BML.js");
|
|
7262
7247
|
const models = await fetchModelsWithContext(
|
|
7263
7248
|
url,
|
|
@@ -7326,9 +7311,9 @@ All file and git operations should use this branch.
|
|
|
7326
7311
|
return res.json({ success: true, message: { content: response2.content }, raw: response2 });
|
|
7327
7312
|
}
|
|
7328
7313
|
const { getModelProfile: getModelProfile2 } = await import("./profiles-5J7F4BML.js");
|
|
7329
|
-
const { getBackendCapabilities } = await import("./backend-
|
|
7314
|
+
const { getBackendCapabilities } = await import("./backend-LVYHLGQJ.js");
|
|
7330
7315
|
const { buildNonStreamingCreateParams } = await import("./client-pure-VFZIIK4S.js");
|
|
7331
|
-
const { OpenAIHttpClient } = await import("./http-client-
|
|
7316
|
+
const { OpenAIHttpClient } = await import("./http-client-33EZ3BLR.js");
|
|
7332
7317
|
const { ensureVersionPrefix } = await import("./url-utils-SAJP7AEX.js");
|
|
7333
7318
|
const profile = getModelProfile2(model);
|
|
7334
7319
|
const capabilities = getBackendCapabilities(backend || "unknown");
|
|
@@ -7398,7 +7383,7 @@ All file and git operations should use this branch.
|
|
|
7398
7383
|
return res.status(400).json({ error: "name, url, and backend are required" });
|
|
7399
7384
|
}
|
|
7400
7385
|
try {
|
|
7401
|
-
const { loadGlobalConfig, saveGlobalConfig, addProvider, setDefaultModelSelection } = await import("./config-
|
|
7386
|
+
const { loadGlobalConfig, saveGlobalConfig, addProvider, setDefaultModelSelection } = await import("./config-EAB3V4QK.js");
|
|
7402
7387
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
7403
7388
|
const providerBackend = backend;
|
|
7404
7389
|
const providerModels = modelConfigs?.length ? buildModelConfigs(modelConfigs) : model ? [{ id: model, contextWindow: 2e5, source: "user" }] : [];
|
|
@@ -7439,7 +7424,7 @@ All file and git operations should use this branch.
|
|
|
7439
7424
|
app.post("/api/init/config", async (req, res) => {
|
|
7440
7425
|
const { workdir, visionFallback } = req.body;
|
|
7441
7426
|
try {
|
|
7442
|
-
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-
|
|
7427
|
+
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-EAB3V4QK.js");
|
|
7443
7428
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
7444
7429
|
const updatedVf = visionFallback ? { ...globalConfig.visionFallback, ...visionFallback } : globalConfig.visionFallback;
|
|
7445
7430
|
const updatedConfig = {
|
|
@@ -7474,7 +7459,7 @@ All file and git operations should use this branch.
|
|
|
7474
7459
|
}
|
|
7475
7460
|
const updates = parsed.data;
|
|
7476
7461
|
try {
|
|
7477
|
-
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-
|
|
7462
|
+
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-EAB3V4QK.js");
|
|
7478
7463
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
7479
7464
|
const filteredUpdates = Object.fromEntries(Object.entries(updates).filter(([, v]) => v !== void 0));
|
|
7480
7465
|
const updatedConfig = {
|
|
@@ -7516,8 +7501,8 @@ All file and git operations should use this branch.
|
|
|
7516
7501
|
}
|
|
7517
7502
|
const testConfig = parsed.data;
|
|
7518
7503
|
try {
|
|
7519
|
-
const { resolveVisionFallback } = await import("./config-
|
|
7520
|
-
const { loadGlobalConfig } = await import("./config-
|
|
7504
|
+
const { resolveVisionFallback } = await import("./config-EAB3V4QK.js");
|
|
7505
|
+
const { loadGlobalConfig } = await import("./config-EAB3V4QK.js");
|
|
7521
7506
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
7522
7507
|
const filteredTestConfig = Object.fromEntries(Object.entries(testConfig).filter(([, v]) => v !== void 0));
|
|
7523
7508
|
const testVisionFallback = {
|
|
@@ -7568,7 +7553,7 @@ All file and git operations should use this branch.
|
|
|
7568
7553
|
});
|
|
7569
7554
|
app.delete("/api/providers/:id", async (req, res) => {
|
|
7570
7555
|
const { id } = req.params;
|
|
7571
|
-
const { loadGlobalConfig, saveGlobalConfig, removeProvider } = await import("./config-
|
|
7556
|
+
const { loadGlobalConfig, saveGlobalConfig, removeProvider } = await import("./config-EAB3V4QK.js");
|
|
7572
7557
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
7573
7558
|
const updatedConfig = removeProvider(globalConfig, id);
|
|
7574
7559
|
await saveGlobalConfig(config3.mode ?? "production", updatedConfig, config3.globalConfigPath);
|
|
@@ -7580,7 +7565,7 @@ All file and git operations should use this branch.
|
|
|
7580
7565
|
const { id } = req.params;
|
|
7581
7566
|
const { isLocal } = req.body;
|
|
7582
7567
|
try {
|
|
7583
|
-
const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-
|
|
7568
|
+
const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-EAB3V4QK.js");
|
|
7584
7569
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
7585
7570
|
const provider = globalConfig.providers.find((p) => p.id === id);
|
|
7586
7571
|
if (!provider) {
|
|
@@ -7612,7 +7597,7 @@ All file and git operations should use this branch.
|
|
|
7612
7597
|
transportAdapter
|
|
7613
7598
|
} = req.body;
|
|
7614
7599
|
try {
|
|
7615
|
-
const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-
|
|
7600
|
+
const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-EAB3V4QK.js");
|
|
7616
7601
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
7617
7602
|
const provider = globalConfig.providers.find((p) => p.id === id);
|
|
7618
7603
|
if (!provider) {
|
|
@@ -7653,7 +7638,7 @@ All file and git operations should use this branch.
|
|
|
7653
7638
|
return res.status(400).json({ error: result.error });
|
|
7654
7639
|
}
|
|
7655
7640
|
const llmClient = getLLMClient();
|
|
7656
|
-
const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-
|
|
7641
|
+
const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-EAB3V4QK.js");
|
|
7657
7642
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
7658
7643
|
const updatedConfig = setDefaultModelSelection(globalConfig, id, llmClient.getModel());
|
|
7659
7644
|
await saveGlobalConfig(config3.mode ?? "production", updatedConfig, config3.globalConfigPath);
|
|
@@ -7680,7 +7665,7 @@ All file and git operations should use this branch.
|
|
|
7680
7665
|
});
|
|
7681
7666
|
async function rebuildMcpTools() {
|
|
7682
7667
|
const { createMcpTools: createMcpTools2 } = await import("./tool-adapter-FEAHWU5C.js");
|
|
7683
|
-
const { setMcpTools: setMcpTools2 } = await import("./tools-
|
|
7668
|
+
const { setMcpTools: setMcpTools2 } = await import("./tools-CIM26IFB.js");
|
|
7684
7669
|
const mcpTools = createMcpTools2(mcpManager);
|
|
7685
7670
|
setMcpTools2(mcpTools);
|
|
7686
7671
|
toolRegistry = createToolRegistry();
|
|
@@ -7755,7 +7740,7 @@ All file and git operations should use this branch.
|
|
|
7755
7740
|
};
|
|
7756
7741
|
await mcpManager.addServer(name, serverCfg);
|
|
7757
7742
|
const server = mcpManager.getServer(name);
|
|
7758
|
-
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-
|
|
7743
|
+
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-EAB3V4QK.js");
|
|
7759
7744
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
7760
7745
|
const updatedMcpServers = { ...globalConfig.mcpServers ?? {}, [name]: serverCfg };
|
|
7761
7746
|
await saveGlobalConfig(
|
|
@@ -7816,7 +7801,7 @@ All file and git operations should use this branch.
|
|
|
7816
7801
|
return res.status(400).json({ error: "oauth must be a boolean" });
|
|
7817
7802
|
}
|
|
7818
7803
|
try {
|
|
7819
|
-
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-
|
|
7804
|
+
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-EAB3V4QK.js");
|
|
7820
7805
|
const { applyMcpServerUpdate } = await import("./update-server-LOOXIXDW.js");
|
|
7821
7806
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
7822
7807
|
const mcpServers2 = { ...globalConfig.mcpServers ?? {} };
|
|
@@ -7865,7 +7850,7 @@ All file and git operations should use this branch.
|
|
|
7865
7850
|
mcpManager.removeServer(name);
|
|
7866
7851
|
const { clearMcpOAuthEntry } = await import("./oauth-store-XCFXV2VM.js");
|
|
7867
7852
|
await clearMcpOAuthEntry(name);
|
|
7868
|
-
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-
|
|
7853
|
+
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-EAB3V4QK.js");
|
|
7869
7854
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
7870
7855
|
const updatedMcpServers = { ...globalConfig.mcpServers ?? {} };
|
|
7871
7856
|
delete updatedMcpServers[name];
|
|
@@ -8032,7 +8017,7 @@ All file and git operations should use this branch.
|
|
|
8032
8017
|
await mcpManager.setToolEnabled(name, toolName, enabled);
|
|
8033
8018
|
const server = mcpManager.getServer(name);
|
|
8034
8019
|
if (server) {
|
|
8035
|
-
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-
|
|
8020
|
+
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-EAB3V4QK.js");
|
|
8036
8021
|
const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
|
|
8037
8022
|
const mcpServers2 = { ...globalConfig.mcpServers ?? {} };
|
|
8038
8023
|
const serverCfg = mcpServers2[name];
|
|
@@ -8061,7 +8046,7 @@ All file and git operations should use this branch.
|
|
|
8061
8046
|
res.status(400).json({ error: error instanceof Error ? error.message : String(error) });
|
|
8062
8047
|
}
|
|
8063
8048
|
});
|
|
8064
|
-
const { listProjects } = await import("./projects-
|
|
8049
|
+
const { listProjects } = await import("./projects-SSBWIYL4.js");
|
|
8065
8050
|
const allProjects = listProjects();
|
|
8066
8051
|
const projectDir = allProjects.find(
|
|
8067
8052
|
(p) => p.workdir === config3.workdir || config3.workdir && p.workdir.startsWith(config3.workdir + "/")
|
|
@@ -8088,13 +8073,13 @@ All file and git operations should use this branch.
|
|
|
8088
8073
|
})
|
|
8089
8074
|
);
|
|
8090
8075
|
app.get("/api/sessions/:id/background-processes", async (req, res) => {
|
|
8091
|
-
const { getSessionProcesses } = await import("./manager-
|
|
8076
|
+
const { getSessionProcesses } = await import("./manager-66YAEO7K.js");
|
|
8092
8077
|
const sessionId = req.params.id;
|
|
8093
8078
|
const processes = getSessionProcesses(sessionId);
|
|
8094
8079
|
res.json({ processes });
|
|
8095
8080
|
});
|
|
8096
8081
|
app.post("/api/sessions/:id/background-process/:processId/stop", async (req, res) => {
|
|
8097
|
-
const { stopProcess } = await import("./manager-
|
|
8082
|
+
const { stopProcess } = await import("./manager-66YAEO7K.js");
|
|
8098
8083
|
const sessionId = req.params.id;
|
|
8099
8084
|
const processId = req.params.processId;
|
|
8100
8085
|
const session = sessionManager.getSession(sessionId);
|
|
@@ -8141,7 +8126,7 @@ All file and git operations should use this branch.
|
|
|
8141
8126
|
}
|
|
8142
8127
|
});
|
|
8143
8128
|
app.get("/fox.svg", (_req, res) => {
|
|
8144
|
-
readFile4(
|
|
8129
|
+
readFile4(join9(webDir, "fox.svg")).then((content) => {
|
|
8145
8130
|
res.set("Content-Type", "image/svg+xml");
|
|
8146
8131
|
res.send(content);
|
|
8147
8132
|
}).catch(() => {
|
|
@@ -8150,7 +8135,7 @@ All file and git operations should use this branch.
|
|
|
8150
8135
|
});
|
|
8151
8136
|
app.use(
|
|
8152
8137
|
"/sounds",
|
|
8153
|
-
express.static(
|
|
8138
|
+
express.static(join9(webDir, "public", "sounds"), {
|
|
8154
8139
|
setHeaders: (res) => {
|
|
8155
8140
|
res.set("Content-Type", "audio/mpeg");
|
|
8156
8141
|
}
|
|
@@ -8159,13 +8144,13 @@ All file and git operations should use this branch.
|
|
|
8159
8144
|
app.use("/__inspect__.js", (_req, res) => {
|
|
8160
8145
|
res.set("Access-Control-Allow-Origin", "*");
|
|
8161
8146
|
res.set("Content-Type", "application/javascript");
|
|
8162
|
-
readFile4(
|
|
8147
|
+
readFile4(join9(webDir, "public", "__inspect__.js")).then((content) => res.send(content)).catch(() => res.status(404).send("Not found"));
|
|
8163
8148
|
});
|
|
8164
8149
|
app.get("/*path", (req, res) => {
|
|
8165
8150
|
if (req.path.startsWith("/api/")) {
|
|
8166
8151
|
return;
|
|
8167
8152
|
}
|
|
8168
|
-
readFile4(
|
|
8153
|
+
readFile4(join9(webDir, "index.html"), "utf-8").then((indexHtml) => viteServer.transformIndexHtml(req.originalUrl, indexHtml)).then((transformed) => res.send(transformed)).catch((err) => {
|
|
8169
8154
|
logger.error("Error serving index.html", { error: err });
|
|
8170
8155
|
res.status(500).send("Server error");
|
|
8171
8156
|
});
|
|
@@ -8176,7 +8161,7 @@ All file and git operations should use this branch.
|
|
|
8176
8161
|
const distWebDir = resolve8(__dirname3, "web");
|
|
8177
8162
|
app.use(
|
|
8178
8163
|
"/assets",
|
|
8179
|
-
express.static(
|
|
8164
|
+
express.static(join9(distWebDir, "assets"), {
|
|
8180
8165
|
setHeaders: (res, filepath) => {
|
|
8181
8166
|
if (filepath.endsWith(".css")) {
|
|
8182
8167
|
res.set("Content-Type", "text/css");
|
|
@@ -8184,11 +8169,11 @@ All file and git operations should use this branch.
|
|
|
8184
8169
|
}
|
|
8185
8170
|
})
|
|
8186
8171
|
);
|
|
8187
|
-
app.use("/manifest.webmanifest", express.static(
|
|
8188
|
-
app.use("/registerSW.js", express.static(
|
|
8189
|
-
app.use("/sw.js", express.static(
|
|
8172
|
+
app.use("/manifest.webmanifest", express.static(join9(distWebDir, "manifest.webmanifest")));
|
|
8173
|
+
app.use("/registerSW.js", express.static(join9(distWebDir, "registerSW.js")));
|
|
8174
|
+
app.use("/sw.js", express.static(join9(distWebDir, "sw.js")));
|
|
8190
8175
|
app.get("/fox.svg", (_req, res) => {
|
|
8191
|
-
readFile4(
|
|
8176
|
+
readFile4(join9(distWebDir, "fox.svg")).then((content) => {
|
|
8192
8177
|
res.set("Content-Type", "image/svg+xml");
|
|
8193
8178
|
res.send(content);
|
|
8194
8179
|
}).catch(() => {
|
|
@@ -8197,7 +8182,7 @@ All file and git operations should use this branch.
|
|
|
8197
8182
|
});
|
|
8198
8183
|
app.use(
|
|
8199
8184
|
"/sounds",
|
|
8200
|
-
express.static(
|
|
8185
|
+
express.static(join9(distWebDir, "sounds"), {
|
|
8201
8186
|
setHeaders: (res) => {
|
|
8202
8187
|
res.set("Content-Type", "audio/mpeg");
|
|
8203
8188
|
}
|
|
@@ -8206,10 +8191,10 @@ All file and git operations should use this branch.
|
|
|
8206
8191
|
app.use("/__inspect__.js", (_req, res) => {
|
|
8207
8192
|
res.set("Access-Control-Allow-Origin", "*");
|
|
8208
8193
|
res.set("Content-Type", "application/javascript");
|
|
8209
|
-
readFile4(
|
|
8194
|
+
readFile4(join9(distWebDir, "__inspect__.js")).then((content) => res.send(content)).catch(() => res.status(404).send("Not found"));
|
|
8210
8195
|
});
|
|
8211
8196
|
app.get("/", (_req, res) => {
|
|
8212
|
-
readFile4(
|
|
8197
|
+
readFile4(join9(distWebDir, "index.html"), "utf-8").then((content) => res.send(content)).catch(() => {
|
|
8213
8198
|
res.status(404).send("Web UI not built. Run `npm run build:web`");
|
|
8214
8199
|
});
|
|
8215
8200
|
});
|
|
@@ -8217,7 +8202,7 @@ All file and git operations should use this branch.
|
|
|
8217
8202
|
if (req.path.startsWith("/api/") || req.path.startsWith("/assets/") || req.path.startsWith("/sounds/") || req.path.startsWith("/manifest.webmanifest") || req.path.startsWith("/registerSW.js") || req.path.startsWith("/sw.js") || req.path === "/fox.svg") {
|
|
8218
8203
|
return;
|
|
8219
8204
|
}
|
|
8220
|
-
readFile4(
|
|
8205
|
+
readFile4(join9(distWebDir, "index.html"), "utf-8").then((content) => res.send(content)).catch(() => {
|
|
8221
8206
|
res.status(404).send("Web UI not built");
|
|
8222
8207
|
});
|
|
8223
8208
|
});
|
|
@@ -8233,13 +8218,46 @@ All file and git operations should use this branch.
|
|
|
8233
8218
|
() => mcpManager.getAllServers()
|
|
8234
8219
|
);
|
|
8235
8220
|
const wss = wssExports.wss;
|
|
8221
|
+
deferTasksBroadcast = (projectId, payload) => wssExports.broadcastForProject(projectId, "", { type: "tasks.update", payload });
|
|
8222
|
+
const { launchWorkflowRun, abortRunnerRun } = await import("./launch-L5ROVNI3.js");
|
|
8223
|
+
deferTasksLaunchWorkflow = (sessionId, launch) => {
|
|
8224
|
+
const session = sessionManager.getSession(sessionId);
|
|
8225
|
+
let llmClient = getLLMClient();
|
|
8226
|
+
if (session?.providerId && session.providerModel) {
|
|
8227
|
+
const resolvedModel = providerManager.resolveModel(session.providerId, session.providerModel);
|
|
8228
|
+
llmClient = getLLMClientForProvider(session.providerId, resolvedModel ?? session.providerModel) ?? getLLMClient();
|
|
8229
|
+
}
|
|
8230
|
+
const provider = providerManager.getActiveProvider();
|
|
8231
|
+
const controller = new AbortController();
|
|
8232
|
+
launchWorkflowRun(
|
|
8233
|
+
{
|
|
8234
|
+
sessionManager,
|
|
8235
|
+
sessionId,
|
|
8236
|
+
controller,
|
|
8237
|
+
llmClient,
|
|
8238
|
+
statsIdentity: {
|
|
8239
|
+
providerId: provider?.id ?? `provider:${llmClient.getModel()}`,
|
|
8240
|
+
providerName: provider?.name ?? "Unknown Provider",
|
|
8241
|
+
backend: provider?.backend ?? llmClient.getBackend(),
|
|
8242
|
+
model: llmClient.getModel()
|
|
8243
|
+
},
|
|
8244
|
+
broadcastForSession: wssExports.broadcastForSession
|
|
8245
|
+
},
|
|
8246
|
+
{
|
|
8247
|
+
workflowId: launch.workflowId,
|
|
8248
|
+
...launch.params && Object.keys(launch.params).length > 0 ? { params: launch.params } : {},
|
|
8249
|
+
...launch.scope ? { scope: launch.scope } : {},
|
|
8250
|
+
...launch.attachments && launch.attachments.length > 0 ? { attachments: launch.attachments } : {}
|
|
8251
|
+
}
|
|
8252
|
+
);
|
|
8253
|
+
};
|
|
8236
8254
|
setNotifyMcpServersChanged((sessionId) => {
|
|
8237
8255
|
const servers = mcpManager.getAllServers();
|
|
8238
8256
|
wssExports.broadcastAll(createServerMessage("mcp.servers.changed", { servers }));
|
|
8239
8257
|
const state = sessionManager.getContextState(sessionId);
|
|
8240
8258
|
wssExports.broadcastForSession(sessionId, createContextStateMessage(state));
|
|
8241
8259
|
});
|
|
8242
|
-
const { QueueProcessor } = await import("./processor-
|
|
8260
|
+
const { QueueProcessor } = await import("./processor-WDZSFBVO.js");
|
|
8243
8261
|
const queueProcessor = new QueueProcessor({
|
|
8244
8262
|
sessionManager,
|
|
8245
8263
|
providerManager,
|
|
@@ -8252,7 +8270,8 @@ All file and git operations should use this branch.
|
|
|
8252
8270
|
const abortSession = (sessionId) => {
|
|
8253
8271
|
const wsAborted = wssExports.abortSession(sessionId);
|
|
8254
8272
|
const qpAborted = queueProcessor.abortSession(sessionId);
|
|
8255
|
-
const
|
|
8273
|
+
const taskAborted = abortRunnerRun(sessionId);
|
|
8274
|
+
const aborted = wsAborted || qpAborted || taskAborted;
|
|
8256
8275
|
if (aborted) {
|
|
8257
8276
|
sessionManager.setRunning(sessionId, false);
|
|
8258
8277
|
wssExports.broadcastForSession(sessionId, { type: "session.running", payload: { isRunning: false } });
|
|
@@ -8282,14 +8301,14 @@ All file and git operations should use this branch.
|
|
|
8282
8301
|
void (async () => {
|
|
8283
8302
|
await devServerManager.stopAll();
|
|
8284
8303
|
await mcpManager.disconnectAll();
|
|
8285
|
-
const { stopAllInspectProxies } = await import("./inspect-proxy-
|
|
8304
|
+
const { stopAllInspectProxies } = await import("./inspect-proxy-NHKQQ2CD.js");
|
|
8286
8305
|
stopAllInspectProxies();
|
|
8287
8306
|
const { cleanupAllProcesses } = await import("./store-SARB6V2N.js");
|
|
8288
8307
|
cleanupAllProcesses();
|
|
8289
8308
|
viteServer?.close();
|
|
8290
8309
|
if (config3.globalConfigPath) {
|
|
8291
|
-
const { unlink
|
|
8292
|
-
|
|
8310
|
+
const { unlink } = await import("fs/promises");
|
|
8311
|
+
unlink(config3.globalConfigPath).catch(() => {
|
|
8293
8312
|
});
|
|
8294
8313
|
}
|
|
8295
8314
|
for (const client of wss.clients) {
|
|
@@ -8324,4 +8343,4 @@ export {
|
|
|
8324
8343
|
createServerHandle,
|
|
8325
8344
|
createServer
|
|
8326
8345
|
};
|
|
8327
|
-
//# sourceMappingURL=chunk-
|
|
8346
|
+
//# sourceMappingURL=chunk-QD7MRMCH.js.map
|