openfox 2.0.113 → 2.0.115

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.
Files changed (99) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/CHANGELOG.md +43 -0
  3. package/dist/agent-defaults/builder.agent.md +1 -0
  4. package/dist/agent-defaults/planner.agent.md +1 -0
  5. package/dist/{backend-P3GHHLHJ.js → backend-LVYHLGQJ.js} +2 -2
  6. package/dist/{chat-handler-PEK5JDHO.js → chat-handler-5SP265CR.js} +32 -26
  7. package/dist/{chunk-HKD4IMOE.js → chunk-27NABDXB.js} +2 -2
  8. package/dist/{chunk-FF2EKUQO.js → chunk-2FCLCUVR.js} +6 -6
  9. package/dist/{chunk-ONONXV3N.js → chunk-37QLXLML.js} +4 -4
  10. package/dist/{chunk-YB6WYVNY.js → chunk-3KBRMBTP.js} +2 -2
  11. package/dist/{chunk-YGPPFVLJ.js → chunk-3NPLERPQ.js} +17 -17
  12. package/dist/{chunk-XQR76MQ5.js → chunk-3PG65AXG.js} +18 -3
  13. package/dist/chunk-3QQAIUZI.js +957 -0
  14. package/dist/{chunk-PWXBIUEY.js → chunk-5PT4UMRR.js} +89 -1
  15. package/dist/chunk-5V3BF67X.js +7 -0
  16. package/dist/{chunk-6UPBZ2ZR.js → chunk-6KPJLELC.js} +4 -4
  17. package/dist/chunk-6RGACY4E.js +1081 -0
  18. package/dist/{chunk-BNFGDTEU.js → chunk-AESOGRFK.js} +2 -2
  19. package/dist/{chunk-YHEQTVFV.js → chunk-AZHWLLPP.js} +1 -1
  20. package/dist/{chunk-TCGWZBTS.js → chunk-BVVCRIVM.js} +4 -4
  21. package/dist/{chunk-EMI3YYLP.js → chunk-BWVO5WFK.js} +4 -4
  22. package/dist/{chunk-CP44U7BT.js → chunk-ERNWAKUB.js} +7 -7
  23. package/dist/{chunk-WWTYWLDM.js → chunk-HD6Y77RO.js} +2 -2
  24. package/dist/{chunk-4NMGX5F2.js → chunk-I7FY2LTR.js} +2 -2
  25. package/dist/{chunk-5VYSKVZT.js → chunk-JFK4GKQD.js} +321 -54
  26. package/dist/{chunk-43M7QZMX.js → chunk-JGWHRYWG.js} +4 -4
  27. package/dist/{chunk-Y64PEWKP.js → chunk-JLAR2CMV.js} +2 -2
  28. package/dist/{chunk-BYSUSSSC.js → chunk-LNNBLB6G.js} +48 -151
  29. package/dist/{chunk-V4664YKR.js → chunk-LTYL6ZGH.js} +2 -2
  30. package/dist/{chunk-R2MTWC7C.js → chunk-M6X6AIEG.js} +6 -4
  31. package/dist/{chunk-VGRVPYZ5.js → chunk-O6DU226D.js} +2 -2
  32. package/dist/{chunk-TEQEDOWI.js → chunk-OCBBAEMT.js} +288 -316
  33. package/dist/{chunk-SNLLOXCM.js → chunk-OCSTEGK7.js} +3 -3
  34. package/dist/{chunk-HGOTZWON.js → chunk-OKVHMKE2.js} +60 -1064
  35. package/dist/chunk-OSXPQSLW.js +128 -0
  36. package/dist/{chunk-O2YSYW2F.js → chunk-TFF5T3K3.js} +10 -10
  37. package/dist/{chunk-3R43CMLS.js → chunk-TGLVWAFC.js} +11 -11
  38. package/dist/{chunk-L737Y63F.js → chunk-TOKQ2UVG.js} +2 -2
  39. package/dist/{chunk-AZFZE36I.js → chunk-VWEATA7R.js} +18 -8
  40. package/dist/{chunk-BKCW3JLL.js → chunk-X25Q6RAV.js} +1 -1
  41. package/dist/{chunk-JR54MDZI.js → chunk-YX3OQBNX.js} +3 -3
  42. package/dist/{chunk-EC5T5A6O.js → chunk-ZTOG6LJD.js} +3 -3
  43. package/dist/cli/dev.js +1 -1
  44. package/dist/cli/index.js +1 -1
  45. package/dist/client-KE7EDI2D.js +16 -0
  46. package/dist/{client-pure-VFZIIK4S.js → client-pure-66Z6FWS6.js} +2 -2
  47. package/dist/command-defaults/mark-done.command.md +14 -0
  48. package/dist/compactor-SKVC2VNL.js +32 -0
  49. package/dist/{dynamic-context-F2XTQJR5.js → dynamic-context-QNB4ELLP.js} +10 -9
  50. package/dist/{events-224IO5NJ.js → events-5PLO4QJU.js} +9 -7
  51. package/dist/{folding-YTTTVS56.js → folding-CJWYFUKD.js} +7 -5
  52. package/dist/http-client-KLODRQC2.js +11 -0
  53. package/dist/{inspect-proxy-B7LGGTM7.js → inspect-proxy-K6QKEYDT.js} +4 -4
  54. package/dist/launch-EOXVWLOP.js +52 -0
  55. package/dist/{manager-4QGXI6WZ.js → manager-LZ3JQ443.js} +5 -5
  56. package/dist/{model-overrides-OY2YKUNV.js → model-overrides-5UVW3KTE.js} +4 -4
  57. package/dist/orchestrator-ED3KFPXO.js +63 -0
  58. package/dist/package.json +3 -3
  59. package/dist/{path-security-PFMZY7IA.js → path-security-B6EZC63L.js} +13 -11
  60. package/dist/{platform-QNGCKX4L.js → platform-6RPPBHKH.js} +4 -4
  61. package/dist/{processor-NYPJ5PFA.js → processor-226ZOTRI.js} +31 -25
  62. package/dist/{project-creator-AWP2JUFS.js → project-creator-VBFE35NI.js} +3 -3
  63. package/dist/{projects-C4353IQK.js → projects-AXHZOBR2.js} +5 -3
  64. package/dist/{protocol-CBT1d98i.d.ts → protocol-JdxRpPxM.d.ts} +21 -3
  65. package/dist/{protocol-LZZ7C4VQ.js → protocol-RKSWKNXI.js} +3 -3
  66. package/dist/provider/index.d.ts +4 -4
  67. package/dist/{provider-PIRPN2CC.js → provider-DL4ZWQY7.js} +8 -8
  68. package/dist/{provider-manager-GNEPR6UN.js → provider-manager-6CLRMGDE.js} +8 -8
  69. package/dist/{registry-VCKDSVKA.js → registry-5XI5NDBF.js} +6 -4
  70. package/dist/{serve-6DRHQLCG.js → serve-DARV4NJG.js} +36 -33
  71. package/dist/server/index.d.ts +13 -6
  72. package/dist/server/index.js +35 -32
  73. package/dist/server-LQJ7MBDS.js +55 -0
  74. package/dist/service-4JKTGPRG.js +25 -0
  75. package/dist/{session-overrides-RNKV35MU.js → session-overrides-AZKV6BRD.js} +8 -6
  76. package/dist/{sessions-D5CEPQGU.js → sessions-752IZIIK.js} +7 -5
  77. package/dist/{settings-BNRNX6IW.js → settings-2AHDKCD7.js} +3 -3
  78. package/dist/shared/index.d.ts +3 -3
  79. package/dist/shared/index.js +1 -1
  80. package/dist/skill-defaults/workflows/SKILL.md +24 -6
  81. package/dist/tasks-XJXHU623.js +217 -0
  82. package/dist/{tools-2B363F7L.js → tools-QYYNFMGU.js} +31 -23
  83. package/dist/{types-cVfqOj6M.d.ts → types-CIVhQMvD.d.ts} +1 -1
  84. package/dist/{types-BAxh20ZL.d.ts → types-Df7NM9b5.d.ts} +76 -1
  85. package/dist/{update-IQMRYN7J.js → update-2REP2WB6.js} +2 -2
  86. package/dist/web/assets/{index-CjWC6EQ4.css → index-BmILAZrT.css} +1 -1
  87. package/dist/web/assets/index-M7ToECa4.js +324 -0
  88. package/dist/web/index.html +2 -2
  89. package/dist/web/sw.js +1 -1
  90. package/dist/workflow-defaults/default.workflow.json +5 -3
  91. package/dist/{workspace-YUNHV4WS.js → workspace-RMZVTFJD.js} +4 -4
  92. package/package.json +3 -3
  93. package/dist/chunk-B2PHPBFU.js +0 -7
  94. package/dist/client-3LJGD6KY.js +0 -16
  95. package/dist/compactor-ZBNKANHV.js +0 -30
  96. package/dist/http-client-YC3UA5OZ.js +0 -11
  97. package/dist/orchestrator-JKBY7B3P.js +0 -57
  98. package/dist/server-HUHFJW7U.js +0 -48
  99. package/dist/web/assets/index-DBUtUSHK.js +0 -323
@@ -7,33 +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
- normalizeWorkflowScope,
26
15
  requiresAuth,
27
- saveWorkflow,
28
- saveWorkflowToProject,
29
16
  terminalManager,
30
17
  tokenFromPassword,
31
- verifyPassword,
32
- workflowExists
33
- } from "./chunk-HGOTZWON.js";
18
+ verifyPassword
19
+ } from "./chunk-OKVHMKE2.js";
34
20
  import {
35
- openFolder
36
- } from "./chunk-WLJJRX22.js";
21
+ TEMPLATE_VARIABLES
22
+ } from "./chunk-3QQAIUZI.js";
37
23
  import {
38
24
  createToolRegistry,
39
25
  devServerManager,
@@ -43,7 +29,7 @@ import {
43
29
  setMcpManagerForTools,
44
30
  setMcpTools,
45
31
  setNotifyMcpServersChanged
46
- } from "./chunk-5VYSKVZT.js";
32
+ } from "./chunk-JFK4GKQD.js";
47
33
  import {
48
34
  deleteOwnedSkill,
49
35
  deleteProjectSkill,
@@ -62,12 +48,15 @@ import {
62
48
  setSkillEnabled,
63
49
  skillExists,
64
50
  updateOwnedSkill
65
- } from "./chunk-FF2EKUQO.js";
51
+ } from "./chunk-2FCLCUVR.js";
52
+ import {
53
+ openFolder
54
+ } from "./chunk-WLJJRX22.js";
66
55
  import {
67
56
  ALWAYS_ALLOWED,
68
57
  ALWAYS_ALLOWED_FOR_SUBAGENTS,
69
58
  TOP_LEVEL_ONLY_TOOLS
70
- } from "./chunk-HKD4IMOE.js";
59
+ } from "./chunk-27NABDXB.js";
71
60
  import {
72
61
  createMcpTools
73
62
  } from "./chunk-JE7LW7Y6.js";
@@ -86,11 +75,38 @@ import {
86
75
  validateRef,
87
76
  validateWorkspaceName,
88
77
  workspaceExists
89
- } from "./chunk-VGRVPYZ5.js";
78
+ } from "./chunk-O6DU226D.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-6RGACY4E.js";
90
106
  import {
91
107
  getSessionDisabledServers,
92
108
  setSessionDisabledServers
93
- } from "./chunk-SNLLOXCM.js";
109
+ } from "./chunk-OCSTEGK7.js";
94
110
  import {
95
111
  emitAssistantMessageStart,
96
112
  emitContextState,
@@ -107,32 +123,7 @@ import {
107
123
  getEventStore,
108
124
  getSessionState,
109
125
  initEventStore
110
- } from "./chunk-CP44U7BT.js";
111
- import {
112
- createContextStateMessage,
113
- toClientSession
114
- } from "./chunk-4NMGX5F2.js";
115
- import {
116
- getPathSeparator,
117
- isAbsolutePath
118
- } from "./chunk-BNFGDTEU.js";
119
- import {
120
- EventEmitter
121
- } from "./chunk-JURM3RPZ.js";
122
- import {
123
- getAgentModelOverride,
124
- getAgentModelOverrides,
125
- resolveLLMClientForAgent,
126
- setAgentModelOverride
127
- } from "./chunk-Y64PEWKP.js";
128
- import {
129
- getProject,
130
- getProjectByWorkdir,
131
- updateProject
132
- } from "./chunk-XQR76MQ5.js";
133
- import {
134
- VERSION
135
- } from "./chunk-B2PHPBFU.js";
126
+ } from "./chunk-ERNWAKUB.js";
136
127
  import {
137
128
  clearWorkflowExecution,
138
129
  createSession,
@@ -155,64 +146,87 @@ import {
155
146
  updateSessionRunning,
156
147
  updateSessionWorkdir,
157
148
  updateWorkflowExecutionStatus
158
- } from "./chunk-AZFZE36I.js";
149
+ } from "./chunk-VWEATA7R.js";
150
+ import {
151
+ createContextStateMessage,
152
+ toClientSession
153
+ } from "./chunk-I7FY2LTR.js";
154
+ import {
155
+ getPathSeparator,
156
+ isAbsolutePath
157
+ } from "./chunk-AESOGRFK.js";
158
+ import {
159
+ EventEmitter
160
+ } from "./chunk-JURM3RPZ.js";
161
+ import {
162
+ getAgentModelOverride,
163
+ getAgentModelOverrides,
164
+ resolveLLMClientForAgent,
165
+ setAgentModelOverride
166
+ } from "./chunk-JLAR2CMV.js";
167
+ import {
168
+ VERSION
169
+ } from "./chunk-5V3BF67X.js";
159
170
  import {
160
171
  agentExists,
161
172
  deleteAgent,
162
- deleteItemFromDir,
163
173
  deleteProjectAgent,
164
174
  findAgentById,
165
- findFileByInternalId,
166
175
  getDefaultAgentIds,
167
- getDefaultIds,
168
176
  getTopLevelAgents,
169
177
  isDefaultAgent,
170
178
  loadAllAgents,
171
179
  loadAllAgentsDefault,
172
180
  loadDefaultAgents,
173
- loadItemsFromDir,
174
181
  loadProjectAgents,
175
182
  loadUserAgents,
176
- pathExists,
177
183
  saveAgent,
178
184
  saveAgentToProject,
179
- saveItemToDir,
180
185
  setRuntimeConfig
181
- } from "./chunk-BYSUSSSC.js";
186
+ } from "./chunk-LNNBLB6G.js";
187
+ import {
188
+ findFileByInternalId,
189
+ pathExists
190
+ } from "./chunk-OSXPQSLW.js";
191
+ import {
192
+ getProject,
193
+ getProjectByWorkdir,
194
+ updateProject
195
+ } from "./chunk-3PG65AXG.js";
182
196
  import {
183
197
  createProviderManager,
184
198
  detectModel,
185
199
  getLlmStatus,
186
200
  parseDefaultModelSelection
187
- } from "./chunk-TCGWZBTS.js";
201
+ } from "./chunk-BVVCRIVM.js";
188
202
  import {
189
203
  getModelProfile
190
204
  } from "./chunk-V4IE7HJY.js";
191
205
  import {
192
206
  getBackendDisplayName
193
- } from "./chunk-YHEQTVFV.js";
207
+ } from "./chunk-AZHWLLPP.js";
194
208
  import {
195
209
  buildModelsUrl
196
210
  } from "./chunk-HNCM3D7Y.js";
197
211
  import {
198
212
  SessionNotFoundError,
199
213
  WorkspaceInUseError
200
- } from "./chunk-V4664YKR.js";
214
+ } from "./chunk-LTYL6ZGH.js";
201
215
  import {
202
216
  deleteSetting,
203
217
  getSetting,
204
218
  setSetting
205
- } from "./chunk-WWTYWLDM.js";
219
+ } from "./chunk-HD6Y77RO.js";
206
220
  import {
207
221
  initDatabase
208
- } from "./chunk-PWXBIUEY.js";
222
+ } from "./chunk-5PT4UMRR.js";
209
223
  import {
210
224
  logger,
211
225
  setLogLevel
212
226
  } from "./chunk-K44MW7JJ.js";
213
227
  import {
214
228
  createServerMessage
215
- } from "./chunk-BKCW3JLL.js";
229
+ } from "./chunk-X25Q6RAV.js";
216
230
  import {
217
231
  getGlobalConfigDir
218
232
  } from "./chunk-CQGTEGKL.js";
@@ -221,8 +235,8 @@ import {
221
235
  import express from "express";
222
236
  import cors from "cors";
223
237
  import { createServer as createHttpServer } from "http";
224
- import { fileURLToPath as fileURLToPath7 } from "url";
225
- import { dirname as dirname8, resolve as resolve8, join as join10 } from "path";
238
+ import { fileURLToPath as fileURLToPath6 } from "url";
239
+ import { dirname as dirname7, resolve as resolve8, join as join9 } from "path";
226
240
  import { readFile as readFile4 } from "fs/promises";
227
241
  import { createServer as createViteServer } from "vite";
228
242
 
@@ -2802,6 +2816,16 @@ var SessionManager = class {
2802
2816
  const session = this.requireSession(sessionId);
2803
2817
  return session.workspace ?? session.workdir;
2804
2818
  }
2819
+ /**
2820
+ * Get the project root working directory for a session.
2821
+ * Ignores any active workspace — session.workdir is always the project root,
2822
+ * which is where project-scoped .openfox/ content (agents, skills, commands,
2823
+ * workflows) lives and is managed from.
2824
+ */
2825
+ getProjectWorkdir(sessionId) {
2826
+ const session = this.requireSession(sessionId);
2827
+ return session.workdir;
2828
+ }
2805
2829
  // ============================================================================
2806
2830
  // Session Lifecycle
2807
2831
  // ============================================================================
@@ -3095,12 +3119,12 @@ var SessionManager = class {
3095
3119
  * Start a new workflow execution. Cancels any existing active execution first,
3096
3120
  * then inserts a new row and emits events.
3097
3121
  */
3098
- startWorkflow(sessionId, executionId, workflowId, workflowName, workflowColor, params) {
3122
+ startWorkflow(sessionId, executionId, workflowId, workflowName, workflowColor, params, subGroup) {
3099
3123
  const existing = this.getActiveWorkflowExecution(sessionId);
3100
3124
  if (existing) {
3101
3125
  this.cancelWorkflow(sessionId, existing.id, existing.workflowId, existing.workflowName, existing.workflowColor);
3102
3126
  }
3103
- createWorkflowExecution(executionId, sessionId, workflowId, workflowName, workflowColor, params);
3127
+ createWorkflowExecution(executionId, sessionId, workflowId, workflowName, workflowColor, params, subGroup);
3104
3128
  emitWorkflowExecutionChanged(sessionId, executionId, workflowId, workflowName, workflowColor, "running");
3105
3129
  const updatedSession = this.requireSession(sessionId);
3106
3130
  this.emit({ type: "session_updated", session: updatedSession });
@@ -3248,6 +3272,7 @@ var SessionManager = class {
3248
3272
  ...row.current_step_name ? { currentStepName: row.current_step_name } : {},
3249
3273
  stepOutput: JSON.parse(row.step_output ?? "{}"),
3250
3274
  params: JSON.parse(row.params ?? "{}"),
3275
+ ...row.sub_group ? { subGroup: row.sub_group } : {},
3251
3276
  ...row.pending_choices ? { pendingChoices: JSON.parse(row.pending_choices) } : {},
3252
3277
  createdAt: row.created_at,
3253
3278
  updatedAt: row.updated_at
@@ -3572,9 +3597,13 @@ var SessionManager = class {
3572
3597
  /**
3573
3598
  * Record that a file was read.
3574
3599
  */
3575
- recordFileRead(sessionId, filePath, contentHash) {
3600
+ recordFileRead(sessionId, filePath, contentHash, relPath) {
3576
3601
  const cache = this.readFilesCache.get(sessionId) ?? {};
3577
- cache[filePath] = { hash: contentHash, readAt: (/* @__PURE__ */ new Date()).toISOString() };
3602
+ cache[filePath] = {
3603
+ hash: contentHash,
3604
+ readAt: (/* @__PURE__ */ new Date()).toISOString(),
3605
+ ...relPath ? { relPath } : {}
3606
+ };
3578
3607
  this.readFilesCache.set(sessionId, cache);
3579
3608
  }
3580
3609
  /**
@@ -3586,12 +3615,13 @@ var SessionManager = class {
3586
3615
  /**
3587
3616
  * Update file hash after write.
3588
3617
  */
3589
- updateFileHash(sessionId, filePath, contentHash) {
3618
+ updateFileHash(sessionId, filePath, contentHash, relPath) {
3590
3619
  const cache = this.readFilesCache.get(sessionId) ?? {};
3591
3620
  const existingEntry = cache[filePath];
3592
3621
  cache[filePath] = {
3593
3622
  hash: contentHash,
3594
- readAt: existingEntry?.readAt ?? (/* @__PURE__ */ new Date()).toISOString()
3623
+ readAt: existingEntry?.readAt ?? (/* @__PURE__ */ new Date()).toISOString(),
3624
+ ...relPath ? { relPath } : {}
3595
3625
  };
3596
3626
  this.readFilesCache.set(sessionId, cache);
3597
3627
  }
@@ -4420,117 +4450,6 @@ function createSkillRoutes(configDir, projectDir) {
4420
4450
  return router;
4421
4451
  }
4422
4452
 
4423
- // src/server/commands/registry.ts
4424
- import { writeFile as writeFile2, mkdir as mkdir3, unlink } from "fs/promises";
4425
- import { join as join5, dirname as dirname4 } from "path";
4426
- import { fileURLToPath as fileURLToPath4 } from "url";
4427
- import matter2 from "gray-matter";
4428
- var __bundleDir = dirname4(fileURLToPath4(import.meta.url));
4429
- var DEFAULTS_DIR = join5(__bundleDir, "defaults");
4430
- var DEFAULTS_DIR_ALT = join5(__bundleDir, "command-defaults");
4431
- var COMMAND_EXTENSION = ".command.md";
4432
- function getCommandsDir(configDir) {
4433
- return join5(configDir, "commands");
4434
- }
4435
- function getProjectCommandsDir(projectDir) {
4436
- return join5(projectDir, ".openfox", "commands");
4437
- }
4438
- async function loadDefaultCommands() {
4439
- let defaults = await loadItemsFromDir(DEFAULTS_DIR, {
4440
- extension: COMMAND_EXTENSION,
4441
- logName: "command"
4442
- });
4443
- if (!defaults.length) {
4444
- defaults = await loadItemsFromDir(DEFAULTS_DIR_ALT, {
4445
- extension: COMMAND_EXTENSION,
4446
- logName: "command"
4447
- });
4448
- }
4449
- return defaults;
4450
- }
4451
- async function loadUserCommands(configDir) {
4452
- return loadItemsFromDir(getCommandsDir(configDir), {
4453
- extension: COMMAND_EXTENSION,
4454
- logName: "command"
4455
- });
4456
- }
4457
- async function loadProjectCommands(projectDir) {
4458
- return loadItemsFromDir(getProjectCommandsDir(projectDir), {
4459
- extension: COMMAND_EXTENSION,
4460
- logName: "command"
4461
- });
4462
- }
4463
- async function loadAllCommands(configDir, projectDir) {
4464
- const [defaultCommands, userCommands] = await Promise.all([loadDefaultCommands(), loadUserCommands(configDir)]);
4465
- const commandMap = /* @__PURE__ */ new Map();
4466
- for (const cmd of defaultCommands) {
4467
- commandMap.set(cmd.metadata.id, cmd);
4468
- }
4469
- for (const cmd of userCommands) {
4470
- commandMap.set(cmd.metadata.id, cmd);
4471
- }
4472
- if (projectDir) {
4473
- const projectCommands = await loadProjectCommands(projectDir);
4474
- for (const cmd of projectCommands) {
4475
- commandMap.set(cmd.metadata.id, cmd);
4476
- }
4477
- }
4478
- return Array.from(commandMap.values());
4479
- }
4480
- async function getDefaultCommandIds() {
4481
- const ids = await getDefaultIds(DEFAULTS_DIR, COMMAND_EXTENSION);
4482
- if (ids.length) return ids;
4483
- return getDefaultIds(DEFAULTS_DIR_ALT, COMMAND_EXTENSION);
4484
- }
4485
- async function isDefaultCommand(commandId) {
4486
- const defaultIds = await getDefaultCommandIds();
4487
- return defaultIds.includes(commandId);
4488
- }
4489
- function findCommandById(commandId, commands) {
4490
- return commands.find((c) => c.metadata.id === commandId);
4491
- }
4492
- async function commandExists(configDir, commandId, projectDir) {
4493
- if (await pathExists(join5(getCommandsDir(configDir), `${commandId}${COMMAND_EXTENSION}`))) return true;
4494
- if (projectDir && await pathExists(join5(getProjectCommandsDir(projectDir), `${commandId}${COMMAND_EXTENSION}`)))
4495
- return true;
4496
- return false;
4497
- }
4498
- async function saveCommand(configDir, command) {
4499
- const commandsDir = getCommandsDir(configDir);
4500
- if (!await pathExists(commandsDir)) {
4501
- await mkdir3(commandsDir, { recursive: true });
4502
- }
4503
- const filePath = join5(commandsDir, `${command.metadata.id}${COMMAND_EXTENSION}`);
4504
- const content = matter2.stringify(command.prompt, command.metadata);
4505
- await writeFile2(filePath, content, "utf-8");
4506
- }
4507
- async function saveCommandToProject(projectDir, command) {
4508
- await saveItemToDir(
4509
- getProjectCommandsDir(projectDir),
4510
- command,
4511
- COMMAND_EXTENSION,
4512
- (c) => matter2.stringify(c.prompt, c.metadata)
4513
- );
4514
- }
4515
- async function deleteProjectCommand(projectDir, commandId) {
4516
- return deleteItemFromDir(getProjectCommandsDir(projectDir), commandId, COMMAND_EXTENSION);
4517
- }
4518
- async function deleteCommand(configDir, commandId) {
4519
- const filePath = join5(getCommandsDir(configDir), `${commandId}${COMMAND_EXTENSION}`);
4520
- if (!await pathExists(filePath)) {
4521
- if (await isDefaultCommand(commandId)) {
4522
- return { success: false, reason: "Cannot delete built-in defaults" };
4523
- }
4524
- return { success: false };
4525
- }
4526
- try {
4527
- await unlink(filePath);
4528
- return { success: true };
4529
- } catch {
4530
- return { success: false, reason: "Failed to delete command" };
4531
- }
4532
- }
4533
-
4534
4453
  // src/server/routes/commands.ts
4535
4454
  var config = {
4536
4455
  dirName: "commands",
@@ -4768,9 +4687,9 @@ function createDevServerRoutes() {
4768
4687
 
4769
4688
  // src/server/routes/workspace-config.ts
4770
4689
  import { Router as Router5 } from "express";
4771
- import { stat as stat2, mkdir as mkdir4, readdir, access as access3 } from "fs/promises";
4690
+ import { stat as stat2, mkdir as mkdir3, readdir, access as access3 } from "fs/promises";
4772
4691
  import { constants as constants3 } from "fs";
4773
- import { resolve as resolve4, isAbsolute as isAbsolute3, join as join6, win32 } from "path";
4692
+ import { resolve as resolve4, isAbsolute as isAbsolute3, join as join5, win32 } from "path";
4774
4693
 
4775
4694
  // src/shared/workspace.ts
4776
4695
  var BLOCKED_EXACT_PATHS = [
@@ -4848,7 +4767,7 @@ async function findOrphanedWorkspaces(dir) {
4848
4767
  for (const entry of entries) {
4849
4768
  if (entry.isDirectory()) {
4850
4769
  try {
4851
- const gitStat = await stat2(join6(dir, entry.name, ".git"));
4770
+ const gitStat = await stat2(join5(dir, entry.name, ".git"));
4852
4771
  if (gitStat.isDirectory()) {
4853
4772
  results.push({ name: entry.name });
4854
4773
  }
@@ -4972,7 +4891,7 @@ function createWorkspaceConfigRoutes(sessionManager) {
4972
4891
  }
4973
4892
  let created = false;
4974
4893
  if (!dirExists && createIfMissing) {
4975
- await mkdir4(resolvedPath, { recursive: true });
4894
+ await mkdir3(resolvedPath, { recursive: true });
4976
4895
  dirExists = true;
4977
4896
  created = true;
4978
4897
  }
@@ -4984,7 +4903,7 @@ function createWorkspaceConfigRoutes(sessionManager) {
4984
4903
  const orphans = await findOrphanedWorkspaces(previousRootDir);
4985
4904
  workspaces.push(...orphans);
4986
4905
  } else if (!previousRootDir && projectName && typeof projectName === "string") {
4987
- const defaultDir = join6(getGlobalDataDir(), "workspaces", projectName);
4906
+ const defaultDir = join5(getGlobalDataDir(), "workspaces", projectName);
4988
4907
  if (!isSameDir(defaultDir, resolvedPath)) {
4989
4908
  const orphans = await findOrphanedWorkspaces(defaultDir);
4990
4909
  workspaces.push(...orphans);
@@ -5041,7 +4960,7 @@ function createTerminalRoutes() {
5041
4960
  // src/server/routes/directories.ts
5042
4961
  import { Router as Router7 } from "express";
5043
4962
  import { readdir as readdir2 } from "fs/promises";
5044
- import { resolve as resolve5, join as join7, dirname as dirname5, basename as basename2 } from "path";
4963
+ import { resolve as resolve5, join as join6, dirname as dirname4, basename as basename2 } from "path";
5045
4964
  function createDirectoryRoutes() {
5046
4965
  const router = Router7();
5047
4966
  const DEFAULT_BASE_PATH = process.cwd();
@@ -5052,9 +4971,9 @@ function createDirectoryRoutes() {
5052
4971
  const entries = await readdir2(resolvedPath, { withFileTypes: true });
5053
4972
  const directories = entries.filter((entry) => entry.isDirectory()).map((entry) => ({
5054
4973
  name: entry.name,
5055
- path: join7(resolvedPath, entry.name)
4974
+ path: join6(resolvedPath, entry.name)
5056
4975
  })).sort((a, b) => a.name.localeCompare(b.name));
5057
- const parent = dirname5(resolvedPath);
4976
+ const parent = dirname4(resolvedPath);
5058
4977
  const hasParent = parent !== resolvedPath;
5059
4978
  res.json({
5060
4979
  current: resolvedPath,
@@ -5533,8 +5452,8 @@ var ProviderRegistry = class {
5533
5452
 
5534
5453
  // src/server/providers/plugins/loader.ts
5535
5454
  import { readdir as readdir3, readFile as readFile2, stat as stat3 } from "fs/promises";
5536
- import { dirname as dirname6, join as join8, resolve as resolve6 } from "path";
5537
- import { fileURLToPath as fileURLToPath5, pathToFileURL } from "url";
5455
+ import { dirname as dirname5, join as join7, resolve as resolve6 } from "path";
5456
+ import { fileURLToPath as fileURLToPath4, pathToFileURL } from "url";
5538
5457
  async function packageDirectories(root) {
5539
5458
  let entries;
5540
5459
  try {
@@ -5544,13 +5463,13 @@ async function packageDirectories(root) {
5544
5463
  }
5545
5464
  const directories = [];
5546
5465
  for (const entry of entries) {
5547
- const entryPath = join8(root, entry.name);
5466
+ const entryPath = join7(root, entry.name);
5548
5467
  const isDirectory = entry.isDirectory() || entry.isSymbolicLink() && (await stat3(entryPath).catch(() => void 0))?.isDirectory();
5549
5468
  if (!isDirectory) continue;
5550
5469
  if (entry.name.startsWith("@")) {
5551
5470
  const scoped = await readdir3(entryPath, { withFileTypes: true }).catch(() => []);
5552
5471
  for (const child of scoped) {
5553
- const childPath = join8(entryPath, child.name);
5472
+ const childPath = join7(entryPath, child.name);
5554
5473
  const childIsDirectory = child.isDirectory() || child.isSymbolicLink() && (await stat3(childPath).catch(() => void 0))?.isDirectory();
5555
5474
  if (childIsDirectory) directories.push(childPath);
5556
5475
  }
@@ -5561,10 +5480,10 @@ async function packageDirectories(root) {
5561
5480
  return directories;
5562
5481
  }
5563
5482
  async function loadProviderPlugins(options) {
5564
- const moduleDirectory = dirname6(fileURLToPath5(import.meta.url));
5483
+ const moduleDirectory = dirname5(fileURLToPath4(import.meta.url));
5565
5484
  const roots = [
5566
- join8(options.configDirectory, "plugins"),
5567
- join8(options.cwd ?? process.cwd(), "node_modules"),
5485
+ join7(options.configDirectory, "plugins"),
5486
+ join7(options.cwd ?? process.cwd(), "node_modules"),
5568
5487
  resolve6(moduleDirectory, "node_modules"),
5569
5488
  resolve6(moduleDirectory, "../../../../node_modules")
5570
5489
  ];
@@ -5572,7 +5491,7 @@ async function loadProviderPlugins(options) {
5572
5491
  const diagnostics = [];
5573
5492
  for (const root of roots) {
5574
5493
  for (const packageDir of await packageDirectories(root)) {
5575
- const manifestPath = join8(packageDir, "package.json");
5494
+ const manifestPath = join7(packageDir, "package.json");
5576
5495
  let manifest;
5577
5496
  try {
5578
5497
  manifest = JSON.parse(await readFile2(manifestPath, "utf8"));
@@ -5613,7 +5532,7 @@ async function loadProviderPlugins(options) {
5613
5532
  }
5614
5533
  };
5615
5534
  try {
5616
- const module = await import(pathToFileURL(join8(packageDir, plugin)).href);
5535
+ const module = await import(pathToFileURL(join7(packageDir, plugin)).href);
5617
5536
  if (typeof module.register !== "function") throw new Error("Plugin does not export register(registry)");
5618
5537
  await module.register(trackingRegistry);
5619
5538
  diagnostic.loaded = true;
@@ -5627,8 +5546,8 @@ async function loadProviderPlugins(options) {
5627
5546
 
5628
5547
  // src/server/routes/plugins.ts
5629
5548
  import { Router as Router11 } from "express";
5630
- import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL2 } from "url";
5631
- import { dirname as dirname7, resolve as resolve7, join as join9 } from "path";
5549
+ import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL2 } from "url";
5550
+ import { dirname as dirname6, resolve as resolve7, join as join8 } from "path";
5632
5551
  import { existsSync } from "fs";
5633
5552
  import { readFile as readFile3, readdir as readdir4, rm as rm2, rename as rename2 } from "fs/promises";
5634
5553
  import { execFile } from "child_process";
@@ -5652,7 +5571,7 @@ function createPluginRoutes(options) {
5652
5571
  if (registryCache && now - registryCache.ts < 3e5) {
5653
5572
  return res.json({ plugins: registryCache.data });
5654
5573
  }
5655
- const moduleDir = dirname7(fileURLToPath6(import.meta.url));
5574
+ const moduleDir = dirname6(fileURLToPath5(import.meta.url));
5656
5575
  let registryPath = resolve7(moduleDir, "../plugins-registry.json");
5657
5576
  if (!existsSync(registryPath)) {
5658
5577
  registryPath = resolve7(moduleDir, "../../../plugins-registry.json");
@@ -5678,9 +5597,9 @@ function createPluginRoutes(options) {
5678
5597
  if (!/^[a-zA-Z0-9_-]+$/.test(repoName)) {
5679
5598
  return res.status(400).json({ error: "Invalid repository name" });
5680
5599
  }
5681
- const pluginsDir = join9(getGlobalConfigDir(config3.mode ?? "production"), "plugins");
5682
- const targetDir = join9(pluginsDir, repoName);
5683
- const tmpDir = join9(pluginsDir, `.${repoName}-tmp-${Date.now()}`);
5600
+ const pluginsDir = join8(getGlobalConfigDir(config3.mode ?? "production"), "plugins");
5601
+ const targetDir = join8(pluginsDir, repoName);
5602
+ const tmpDir = join8(pluginsDir, `.${repoName}-tmp-${Date.now()}`);
5684
5603
  try {
5685
5604
  await execFileP("mkdir", ["-p", pluginsDir], { timeout: 5e3 });
5686
5605
  } catch {
@@ -5711,7 +5630,7 @@ function createPluginRoutes(options) {
5711
5630
  }
5712
5631
  if (!loadError) {
5713
5632
  try {
5714
- const manifest = JSON.parse(await readFile3(join9(targetDir, "package.json"), "utf8"));
5633
+ const manifest = JSON.parse(await readFile3(join8(targetDir, "package.json"), "utf8"));
5715
5634
  const pluginEntry = manifest.openfox?.plugin;
5716
5635
  const apiVersion = manifest.openfox?.apiVersion;
5717
5636
  if (!pluginEntry || !manifest.name) {
@@ -5719,7 +5638,7 @@ function createPluginRoutes(options) {
5719
5638
  } else if (apiVersion !== 1) {
5720
5639
  loadError = `Unsupported plugin API version: ${String(apiVersion)}`;
5721
5640
  } else {
5722
- const mod = await import(pathToFileURL2(join9(targetDir, pluginEntry)).href);
5641
+ const mod = await import(pathToFileURL2(join8(targetDir, pluginEntry)).href);
5723
5642
  if (typeof mod.register !== "function") {
5724
5643
  loadError = "Plugin does not export register(registry)";
5725
5644
  } else {
@@ -5768,13 +5687,13 @@ function createPluginRoutes(options) {
5768
5687
  }
5769
5688
  });
5770
5689
  router.get("/installed", async (_req, res) => {
5771
- const pluginsDir = join9(getGlobalConfigDir(config3.mode ?? "production"), "plugins");
5690
+ const pluginsDir = join8(getGlobalConfigDir(config3.mode ?? "production"), "plugins");
5772
5691
  try {
5773
5692
  const entries = await readdir4(pluginsDir, { withFileTypes: true });
5774
5693
  const installed = [];
5775
5694
  for (const entry of entries) {
5776
5695
  if (!entry.isDirectory()) continue;
5777
- const pkgPath = join9(pluginsDir, entry.name, "package.json");
5696
+ const pkgPath = join8(pluginsDir, entry.name, "package.json");
5778
5697
  let version = null;
5779
5698
  try {
5780
5699
  const pkg = JSON.parse(await readFile3(pkgPath, "utf8"));
@@ -5789,13 +5708,13 @@ function createPluginRoutes(options) {
5789
5708
  }
5790
5709
  });
5791
5710
  router.get("/open-folder", async (_req, res) => {
5792
- const pluginsDir = join9(getGlobalConfigDir(config3.mode ?? "production"), "plugins");
5711
+ const pluginsDir = join8(getGlobalConfigDir(config3.mode ?? "production"), "plugins");
5793
5712
  await openFolderRoute(pluginsDir, res);
5794
5713
  });
5795
5714
  router.get("/:name/open-folder", async (req, res) => {
5796
5715
  const name = req.params.name;
5797
5716
  if (!/^[a-zA-Z0-9_-]+$/.test(name)) return res.status(400).json({ error: "Invalid plugin name" });
5798
- const targetDir = join9(getGlobalConfigDir(config3.mode ?? "production"), "plugins", name);
5717
+ const targetDir = join8(getGlobalConfigDir(config3.mode ?? "production"), "plugins", name);
5799
5718
  await openFolderRoute(targetDir, res);
5800
5719
  });
5801
5720
  router.delete("/:name", async (req, res) => {
@@ -5803,7 +5722,7 @@ function createPluginRoutes(options) {
5803
5722
  if (!/^[a-zA-Z0-9_-]+$/.test(name)) {
5804
5723
  return res.status(400).json({ error: "Invalid plugin name" });
5805
5724
  }
5806
- const targetDir = join9(getGlobalConfigDir(config3.mode ?? "production"), "plugins", name);
5725
+ const targetDir = join8(getGlobalConfigDir(config3.mode ?? "production"), "plugins", name);
5807
5726
  try {
5808
5727
  await rm2(targetDir, { recursive: true, force: true });
5809
5728
  for (let i = pluginDiagnostics.length - 1; i >= 0; i--) {
@@ -5883,13 +5802,17 @@ function detectWsl() {
5883
5802
  }
5884
5803
 
5885
5804
  // src/server/index.ts
5886
- var __dirname3 = dirname8(fileURLToPath7(import.meta.url));
5805
+ var __dirname3 = dirname7(fileURLToPath6(import.meta.url));
5887
5806
  async function createServerHandle(config3) {
5888
5807
  setRuntimeConfig(config3);
5889
5808
  setLogLevel(config3.logging?.level ?? void 0, config3.mode);
5890
5809
  await loadServerAuthConfig();
5891
5810
  const db = initDatabase(config3);
5892
5811
  initEventStore(db);
5812
+ let deferTasksBroadcast = () => {
5813
+ };
5814
+ let deferTasksLaunchWorkflow = () => {
5815
+ };
5893
5816
  const configDir = getGlobalConfigDir(config3.mode ?? "production");
5894
5817
  const providerAdapters = new ProviderRegistry({
5895
5818
  mode: config3.mode === "development" ? "development" : "production",
@@ -5969,7 +5892,7 @@ async function createServerHandle(config3) {
5969
5892
  setMcpConfigMode(config3.mode ?? "production");
5970
5893
  setMcpConfigPath(config3.globalConfigPath);
5971
5894
  setMcpOAuthStoreMode(config3.mode ?? "production");
5972
- setMcpOAuthStorePath(config3.globalConfigPath ? join10(dirname8(config3.globalConfigPath), "mcp-auth.json") : void 0);
5895
+ setMcpOAuthStorePath(config3.globalConfigPath ? join9(dirname7(config3.globalConfigPath), "mcp-auth.json") : void 0);
5973
5896
  const mcpServers = config3.mcpServers ?? {};
5974
5897
  Promise.all(
5975
5898
  Object.entries(mcpServers).map(
@@ -5984,7 +5907,7 @@ async function createServerHandle(config3) {
5984
5907
  toolRegistry = createToolRegistry();
5985
5908
  logger.info("MCP tools registered", { count: mcpTools.length });
5986
5909
  }
5987
- const { signalMcpReady } = await import("./server-HUHFJW7U.js");
5910
+ const { signalMcpReady } = await import("./server-LQJ7MBDS.js");
5988
5911
  signalMcpReady();
5989
5912
  });
5990
5913
  const app = express();
@@ -6014,11 +5937,11 @@ async function createServerHandle(config3) {
6014
5937
  try {
6015
5938
  const fs = await import("fs");
6016
5939
  const path = await import("path");
6017
- const { fileURLToPath: fileURLToPath8 } = await import("url");
6018
- const dirname9 = path.dirname(fileURLToPath8(import.meta.url));
6019
- let changelogPath = path.resolve(dirname9, "../CHANGELOG.md");
5940
+ const { fileURLToPath: fileURLToPath7 } = await import("url");
5941
+ const dirname8 = path.dirname(fileURLToPath7(import.meta.url));
5942
+ let changelogPath = path.resolve(dirname8, "../CHANGELOG.md");
6020
5943
  if (!fs.existsSync(changelogPath)) {
6021
- changelogPath = path.resolve(dirname9, "../../CHANGELOG.md");
5944
+ changelogPath = path.resolve(dirname8, "../../CHANGELOG.md");
6022
5945
  }
6023
5946
  const content = fs.readFileSync(changelogPath, "utf-8");
6024
5947
  res.json({ content });
@@ -6065,7 +5988,7 @@ async function createServerHandle(config3) {
6065
5988
  res.json({ tools });
6066
5989
  });
6067
5990
  app.get("/api/projects", async (_req, res) => {
6068
- const { listProjects: listProjects2 } = await import("./projects-C4353IQK.js");
5991
+ const { listProjects: listProjects2 } = await import("./projects-AXHZOBR2.js");
6069
5992
  const projects = listProjects2();
6070
5993
  res.json({ projects });
6071
5994
  });
@@ -6074,7 +5997,7 @@ async function createServerHandle(config3) {
6074
5997
  if (!name || !workdir) {
6075
5998
  return res.status(400).json({ error: "name and workdir are required" });
6076
5999
  }
6077
- const { createDirectoryWithGit } = await import("./project-creator-AWP2JUFS.js");
6000
+ const { createDirectoryWithGit } = await import("./project-creator-VBFE35NI.js");
6078
6001
  try {
6079
6002
  const project = await createDirectoryWithGit(name, workdir);
6080
6003
  res.status(201).json({ project });
@@ -6119,7 +6042,7 @@ async function createServerHandle(config3) {
6119
6042
  }
6120
6043
  });
6121
6044
  app.get("/api/projects/:id", async (req, res) => {
6122
- const { getProject: getProject2 } = await import("./projects-C4353IQK.js");
6045
+ const { getProject: getProject2 } = await import("./projects-AXHZOBR2.js");
6123
6046
  const project = getProject2(req.params.id);
6124
6047
  if (!project) {
6125
6048
  return res.status(404).json({ error: "Project not found" });
@@ -6127,7 +6050,7 @@ async function createServerHandle(config3) {
6127
6050
  res.json({ project });
6128
6051
  });
6129
6052
  app.get("/api/projects/:id/open-folder", async (req, res) => {
6130
- const { getProject: getProject2 } = await import("./projects-C4353IQK.js");
6053
+ const { getProject: getProject2 } = await import("./projects-AXHZOBR2.js");
6131
6054
  const project = getProject2(req.params.id);
6132
6055
  if (!project) {
6133
6056
  return res.status(404).json({ error: "Project not found" });
@@ -6141,12 +6064,13 @@ async function createServerHandle(config3) {
6141
6064
  }
6142
6065
  });
6143
6066
  app.put("/api/projects/:id", async (req, res) => {
6144
- const { updateProject: updateProject2 } = await import("./projects-C4353IQK.js");
6145
- const { name, customInstructions, dangerLevel } = req.body;
6067
+ const { updateProject: updateProject2 } = await import("./projects-AXHZOBR2.js");
6068
+ const { name, customInstructions, dangerLevel, defaultAgent } = req.body;
6146
6069
  const updates = {};
6147
6070
  if (name !== void 0) updates.name = name;
6148
6071
  if (customInstructions !== void 0) updates.customInstructions = customInstructions;
6149
6072
  if (dangerLevel !== void 0) updates.dangerLevel = dangerLevel;
6073
+ if (defaultAgent !== void 0) updates.defaultAgent = defaultAgent;
6150
6074
  const updated = updateProject2(req.params.id, updates);
6151
6075
  if (!updated) {
6152
6076
  return res.status(404).json({ error: "Project not found" });
@@ -6154,7 +6078,7 @@ async function createServerHandle(config3) {
6154
6078
  res.json({ project: updated });
6155
6079
  });
6156
6080
  app.delete("/api/projects/:id", async (req, res) => {
6157
- const { getProject: getProject2, deleteProject } = await import("./projects-C4353IQK.js");
6081
+ const { getProject: getProject2, deleteProject } = await import("./projects-AXHZOBR2.js");
6158
6082
  const project = getProject2(req.params.id);
6159
6083
  if (!project) {
6160
6084
  return res.status(404).json({ error: "Project not found" });
@@ -6163,7 +6087,7 @@ async function createServerHandle(config3) {
6163
6087
  res.json({ success: true });
6164
6088
  });
6165
6089
  app.put("/api/projects/:id/star", async (req, res) => {
6166
- const { toggleStar } = await import("./projects-C4353IQK.js");
6090
+ const { toggleStar } = await import("./projects-AXHZOBR2.js");
6167
6091
  const { isStarred } = req.body;
6168
6092
  if (typeof isStarred !== "boolean") {
6169
6093
  return res.status(400).json({ error: "isStarred is required and must be a boolean" });
@@ -6177,27 +6101,41 @@ async function createServerHandle(config3) {
6177
6101
  const sessionFavoriteRouter = express.Router();
6178
6102
  registerSessionFavoriteRoute(sessionFavoriteRouter, sessionManager);
6179
6103
  app.use("/api", sessionFavoriteRouter);
6104
+ const { createTasksService } = await import("./service-4JKTGPRG.js");
6105
+ const { registerTaskRoutes } = await import("./tasks-XJXHU623.js");
6106
+ const { setTasksService } = await import("./tools-QYYNFMGU.js");
6107
+ const tasksService = createTasksService({
6108
+ sessionManager,
6109
+ config: config3,
6110
+ broadcast: (projectId, payload) => deferTasksBroadcast(projectId, payload),
6111
+ configDir,
6112
+ launchWorkflow: (sessionId, launch) => deferTasksLaunchWorkflow(sessionId, launch)
6113
+ });
6114
+ setTasksService(tasksService);
6115
+ const tasksRouter = express.Router();
6116
+ registerTaskRoutes(tasksRouter, tasksService);
6117
+ app.use("/api", tasksRouter);
6180
6118
  app.get("/api/projects/:id/branches", async (req, res) => {
6181
- const { getProject: getProject2 } = await import("./projects-C4353IQK.js");
6119
+ const { getProject: getProject2 } = await import("./projects-AXHZOBR2.js");
6182
6120
  const project = getProject2(req.params.id);
6183
6121
  if (!project) return res.status(404).json({ error: "Project not found" });
6184
- const { listBranches } = await import("./workspace-YUNHV4WS.js");
6122
+ const { listBranches } = await import("./workspace-RMZVTFJD.js");
6185
6123
  const branches = await listBranches(project.workdir);
6186
6124
  res.json({ branches });
6187
6125
  });
6188
6126
  app.post("/api/projects/:id/checkout", async (req, res) => {
6189
- const { getProject: getProject2 } = await import("./projects-C4353IQK.js");
6127
+ const { getProject: getProject2 } = await import("./projects-AXHZOBR2.js");
6190
6128
  const project = getProject2(req.params.id);
6191
6129
  if (!project) return res.status(404).json({ error: "Project not found" });
6192
6130
  const { branch } = req.body;
6193
6131
  if (!branch || typeof branch !== "string") return res.status(400).json({ error: "branch is required" });
6194
- const { checkoutBranch, isGitRepository } = await import("./workspace-YUNHV4WS.js");
6132
+ const { checkoutBranch, isGitRepository } = await import("./workspace-RMZVTFJD.js");
6195
6133
  if (!await isGitRepository(project.workdir)) {
6196
6134
  return res.status(400).json({ error: "Project is not a git repository" });
6197
6135
  }
6198
6136
  try {
6199
6137
  await checkoutBranch(project.workdir, branch);
6200
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-D5CEPQGU.js");
6138
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-752IZIIK.js");
6201
6139
  const allSessions = sessionManager.listSessions();
6202
6140
  for (const s of allSessions) {
6203
6141
  if (sessionManager.getEffectiveWorkdir(s.id) === project.workdir) {
@@ -6211,12 +6149,12 @@ async function createServerHandle(config3) {
6211
6149
  }
6212
6150
  });
6213
6151
  app.post("/api/projects/:id/checkout-new", async (req, res) => {
6214
- const { getProject: getProject2 } = await import("./projects-C4353IQK.js");
6152
+ const { getProject: getProject2 } = await import("./projects-AXHZOBR2.js");
6215
6153
  const project = getProject2(req.params.id);
6216
6154
  if (!project) return res.status(404).json({ error: "Project not found" });
6217
6155
  const { name, sourceBranch } = req.body;
6218
6156
  if (!name || typeof name !== "string") return res.status(400).json({ error: "name is required" });
6219
- const { createBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, validateRef: validateRef2, getDefaultBranch, isGitRepository } = await import("./workspace-YUNHV4WS.js");
6157
+ const { createBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, validateRef: validateRef2, getDefaultBranch, isGitRepository } = await import("./workspace-RMZVTFJD.js");
6220
6158
  if (!await isGitRepository(project.workdir)) {
6221
6159
  return res.status(400).json({ error: "Project is not a git repository" });
6222
6160
  }
@@ -6233,7 +6171,7 @@ async function createServerHandle(config3) {
6233
6171
  );
6234
6172
  }
6235
6173
  await createBranch(project.workdir, name, sb);
6236
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-D5CEPQGU.js");
6174
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-752IZIIK.js");
6237
6175
  const allSessions = sessionManager.listSessions();
6238
6176
  for (const s of allSessions) {
6239
6177
  if (sessionManager.getEffectiveWorkdir(s.id) === project.workdir) {
@@ -6250,7 +6188,7 @@ async function createServerHandle(config3) {
6250
6188
  const session = sessionManager.getSession(req.params.id);
6251
6189
  if (!session) return res.status(404).json({ error: "Session not found" });
6252
6190
  const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
6253
- const { listBranches, getDefaultBranch } = await import("./workspace-YUNHV4WS.js");
6191
+ const { listBranches, getDefaultBranch } = await import("./workspace-RMZVTFJD.js");
6254
6192
  const [branches, defaultBranch] = await Promise.all([
6255
6193
  listBranches(effectiveWorkdir),
6256
6194
  getDefaultBranch(session.workdir)
@@ -6264,8 +6202,8 @@ async function createServerHandle(config3) {
6264
6202
  const { branch } = req.body;
6265
6203
  if (!branch || typeof branch !== "string") return res.status(400).json({ error: "branch is required" });
6266
6204
  const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
6267
- const { checkoutBranch, validateRef: validateRef2 } = await import("./workspace-YUNHV4WS.js");
6268
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-D5CEPQGU.js");
6205
+ const { checkoutBranch, validateRef: validateRef2 } = await import("./workspace-RMZVTFJD.js");
6206
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-752IZIIK.js");
6269
6207
  try {
6270
6208
  await validateRef2(effectiveWorkdir, branch);
6271
6209
  await checkoutBranch(effectiveWorkdir, branch);
@@ -6307,16 +6245,16 @@ All file and git operations should use this branch.
6307
6245
  const { name, sourceBranch } = req.body;
6308
6246
  if (!name || typeof name !== "string") return res.status(400).json({ error: "name is required" });
6309
6247
  const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
6310
- const { validateRef: validateRef2 } = await import("./workspace-YUNHV4WS.js");
6311
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-D5CEPQGU.js");
6248
+ const { validateRef: validateRef2 } = await import("./workspace-RMZVTFJD.js");
6249
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-752IZIIK.js");
6312
6250
  try {
6313
6251
  await validateRef2(effectiveWorkdir, name);
6314
6252
  if (sourceBranch) {
6315
- const { resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, createBranch } = await import("./workspace-YUNHV4WS.js");
6253
+ const { resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, createBranch } = await import("./workspace-RMZVTFJD.js");
6316
6254
  const sb = await resolveAndValidateSourceBranch2(effectiveWorkdir, sourceBranch, session.workdir);
6317
6255
  await createBranch(effectiveWorkdir, name, sb);
6318
6256
  } else {
6319
- const { createBranch, getDefaultBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2 } = await import("./workspace-YUNHV4WS.js");
6257
+ const { createBranch, getDefaultBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2 } = await import("./workspace-RMZVTFJD.js");
6320
6258
  const defaultBranch = await getDefaultBranch(session.workdir);
6321
6259
  const sb = await resolveAndValidateSourceBranch2(effectiveWorkdir, defaultBranch, session.workdir);
6322
6260
  await createBranch(effectiveWorkdir, name, sb);
@@ -6354,17 +6292,17 @@ All file and git operations should use this branch.
6354
6292
  }
6355
6293
  });
6356
6294
  app.get("/api/projects/:id/workspaces", async (req, res) => {
6357
- const { getProject: getProject2 } = await import("./projects-C4353IQK.js");
6295
+ const { getProject: getProject2 } = await import("./projects-AXHZOBR2.js");
6358
6296
  const project = getProject2(req.params.id);
6359
6297
  if (!project) return res.status(404).json({ error: "Project not found" });
6360
- const { listWorkspaces } = await import("./workspace-YUNHV4WS.js");
6298
+ const { listWorkspaces } = await import("./workspace-RMZVTFJD.js");
6361
6299
  const all = await listWorkspaces(project.name, project.workdir);
6362
6300
  const workspacesList = all.filter((ws) => ws.path !== project.workdir);
6363
6301
  res.json({ workspaces: workspacesList });
6364
6302
  });
6365
6303
  app.get("/api/sessions", async (req, res) => {
6366
- const { getRecentUserPromptsForSession } = await import("./events-224IO5NJ.js");
6367
- const { getPendingConfirmationsBySession } = await import("./path-security-PFMZY7IA.js");
6304
+ const { getRecentUserPromptsForSession } = await import("./events-5PLO4QJU.js");
6305
+ const { getPendingConfirmationsBySession } = await import("./path-security-B6EZC63L.js");
6368
6306
  const projectId = req.query["projectId"];
6369
6307
  const rawLimit = req.query["limit"];
6370
6308
  const offset = parseInt(req.query["offset"]) || 0;
@@ -6419,7 +6357,7 @@ All file and git operations should use this branch.
6419
6357
  disabledServers = mcpManager.getAllServers().filter((s) => s.config.disabled).map((s) => s.name);
6420
6358
  }
6421
6359
  if (disabledServers.length > 0) {
6422
- const { setSessionDisabledServers: setSessionDisabledServers2 } = await import("./session-overrides-RNKV35MU.js");
6360
+ const { setSessionDisabledServers: setSessionDisabledServers2 } = await import("./session-overrides-AZKV6BRD.js");
6423
6361
  setSessionDisabledServers2(session.id, disabledServers);
6424
6362
  }
6425
6363
  } catch {
@@ -6456,7 +6394,7 @@ All file and git operations should use this branch.
6456
6394
  if (!target || typeof target !== "string") return res.status(400).json({ error: "target is required" });
6457
6395
  const project = sessionManager.getProject(session.projectId);
6458
6396
  if (!project) return res.status(404).json({ error: "Project not found" });
6459
- const { isGitRepository } = await import("./workspace-YUNHV4WS.js");
6397
+ const { isGitRepository } = await import("./workspace-RMZVTFJD.js");
6460
6398
  if (!await isGitRepository(project.workdir)) {
6461
6399
  return res.status(400).json({ error: "Project is not a git repository" });
6462
6400
  }
@@ -6474,7 +6412,7 @@ All file and git operations should use this branch.
6474
6412
  if (!target || typeof target !== "string") return res.status(400).json({ error: "target is required" });
6475
6413
  const project = sessionManager.getProject(session.projectId);
6476
6414
  if (!project) return res.status(404).json({ error: "Project not found" });
6477
- const { isGitRepository } = await import("./workspace-YUNHV4WS.js");
6415
+ const { isGitRepository } = await import("./workspace-RMZVTFJD.js");
6478
6416
  if (!await isGitRepository(project.workdir)) {
6479
6417
  return res.status(400).json({ error: "Project is not a git repository" });
6480
6418
  }
@@ -6492,12 +6430,12 @@ All file and git operations should use this branch.
6492
6430
  }
6493
6431
  });
6494
6432
  app.get("/api/sessions/:id", async (req, res) => {
6495
- const { getEventStore: getEventStore2, combineEventsWithSnapshot } = await import("./events-224IO5NJ.js");
6496
- const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-YTTTVS56.js");
6497
- const { getPendingQuestionsForSession } = await import("./tools-2B363F7L.js");
6498
- const { getMaxVisibleItems } = await import("./settings-BNRNX6IW.js");
6499
- const { getAgentModelOverride: getAgentModelOverride2 } = await import("./model-overrides-OY2YKUNV.js");
6500
- const { updateSessionProvider: updateSessionProvider2 } = await import("./sessions-D5CEPQGU.js");
6433
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot } = await import("./events-5PLO4QJU.js");
6434
+ const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-CJWYFUKD.js");
6435
+ const { getPendingQuestionsForSession } = await import("./tools-QYYNFMGU.js");
6436
+ const { getMaxVisibleItems } = await import("./settings-2AHDKCD7.js");
6437
+ const { getAgentModelOverride: getAgentModelOverride2 } = await import("./model-overrides-5UVW3KTE.js");
6438
+ const { updateSessionProvider: updateSessionProvider2 } = await import("./sessions-752IZIIK.js");
6501
6439
  let session = sessionManager.getSession(req.params.id);
6502
6440
  if (!session) {
6503
6441
  return res.status(404).json({ error: "Session not found" });
@@ -6536,8 +6474,8 @@ All file and git operations should use this branch.
6536
6474
  if (!session) {
6537
6475
  return res.status(404).json({ error: "Session not found" });
6538
6476
  }
6539
- const { stopSessionExecution } = await import("./chat-handler-PEK5JDHO.js");
6540
- const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-2B363F7L.js");
6477
+ const { stopSessionExecution } = await import("./chat-handler-5SP265CR.js");
6478
+ const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-QYYNFMGU.js");
6541
6479
  sessionManager.clearMessageQueue(sessionId);
6542
6480
  stopSessionExecution(sessionId, sessionManager);
6543
6481
  abortSession(sessionId);
@@ -6566,9 +6504,9 @@ All file and git operations should use this branch.
6566
6504
  res.json({ success: true });
6567
6505
  });
6568
6506
  app.post("/api/sessions/:id/provider", async (req, res) => {
6569
- const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-224IO5NJ.js");
6570
- const { buildMessagesFromStoredEvents } = await import("./folding-YTTTVS56.js");
6571
- const { getMaxVisibleItems } = await import("./settings-BNRNX6IW.js");
6507
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-5PLO4QJU.js");
6508
+ const { buildMessagesFromStoredEvents } = await import("./folding-CJWYFUKD.js");
6509
+ const { getMaxVisibleItems } = await import("./settings-2AHDKCD7.js");
6572
6510
  const sessionId = req.params.id;
6573
6511
  const session = sessionManager.getSession(sessionId);
6574
6512
  if (!session) {
@@ -6681,11 +6619,11 @@ All file and git operations should use this branch.
6681
6619
  res.json({ success: true });
6682
6620
  });
6683
6621
  app.put("/api/sessions/:id/mode", async (req, res) => {
6684
- const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-224IO5NJ.js");
6685
- const { buildMessagesFromStoredEvents } = await import("./folding-YTTTVS56.js");
6686
- const { getMaxVisibleItems } = await import("./settings-BNRNX6IW.js");
6687
- const { getAgentModelOverride: getAgentModelOverride2 } = await import("./model-overrides-OY2YKUNV.js");
6688
- const { updateSessionProvider: updateSessionProvider2 } = await import("./sessions-D5CEPQGU.js");
6622
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-5PLO4QJU.js");
6623
+ const { buildMessagesFromStoredEvents } = await import("./folding-CJWYFUKD.js");
6624
+ const { getMaxVisibleItems } = await import("./settings-2AHDKCD7.js");
6625
+ const { getAgentModelOverride: getAgentModelOverride2 } = await import("./model-overrides-5UVW3KTE.js");
6626
+ const { updateSessionProvider: updateSessionProvider2 } = await import("./sessions-752IZIIK.js");
6689
6627
  const sessionId = req.params.id;
6690
6628
  const session = sessionManager.getSession(sessionId);
6691
6629
  if (!session) {
@@ -6695,7 +6633,7 @@ All file and git operations should use this branch.
6695
6633
  if (!mode) {
6696
6634
  return res.status(400).json({ error: "mode is required" });
6697
6635
  }
6698
- const allAgents = await loadAllAgentsDefault();
6636
+ const allAgents = await loadAllAgentsDefault(sessionManager.getProjectWorkdir(sessionId));
6699
6637
  const topLevelIds = getTopLevelAgents(allAgents).map((a) => a.metadata.id);
6700
6638
  if (!topLevelIds.includes(mode)) {
6701
6639
  return res.status(400).json({ error: `Invalid mode. Must be one of: ${topLevelIds.join(", ")}` });
@@ -6787,7 +6725,7 @@ All file and git operations should use this branch.
6787
6725
  if (alwaysAllow !== void 0 && typeof alwaysAllow !== "boolean") {
6788
6726
  return res.status(400).json({ error: "alwaysAllow must be a boolean if provided" });
6789
6727
  }
6790
- const { providePathConfirmation, getConfirmationSessionId } = await import("./tools-2B363F7L.js");
6728
+ const { providePathConfirmation, getConfirmationSessionId } = await import("./tools-QYYNFMGU.js");
6791
6729
  const pendingSessionId = getConfirmationSessionId(callId);
6792
6730
  if (!pendingSessionId) {
6793
6731
  return res.status(404).json({ error: "No pending path confirmation with that ID" });
@@ -6799,11 +6737,11 @@ All file and git operations should use this branch.
6799
6737
  if (!result.found) {
6800
6738
  return res.status(404).json({ error: "No pending path confirmation with that ID" });
6801
6739
  }
6802
- const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEvents } = await import("./events-224IO5NJ.js");
6803
- const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-YTTTVS56.js");
6804
- const { createSessionStateMessage } = await import("./protocol-LZZ7C4VQ.js");
6805
- const { getPendingQuestionsForSession } = await import("./tools-2B363F7L.js");
6806
- const { getMaxVisibleItems } = await import("./settings-BNRNX6IW.js");
6740
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEvents } = await import("./events-5PLO4QJU.js");
6741
+ const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-CJWYFUKD.js");
6742
+ const { createSessionStateMessage } = await import("./protocol-RKSWKNXI.js");
6743
+ const { getPendingQuestionsForSession } = await import("./tools-QYYNFMGU.js");
6744
+ const { getMaxVisibleItems } = await import("./settings-2AHDKCD7.js");
6807
6745
  const eventStore = getEventStore2();
6808
6746
  const { snapshot, events: eventsSinceSnapshot } = eventStore.getEventsSinceSnapshot(sessionId);
6809
6747
  const events = combineEvents(sessionId, snapshot, eventsSinceSnapshot);
@@ -6839,7 +6777,7 @@ All file and git operations should use this branch.
6839
6777
  if (!skip && typeof answer !== "string") {
6840
6778
  return res.status(400).json({ error: "answer is required when not skipping" });
6841
6779
  }
6842
- const { provideAnswer } = await import("./tools-2B363F7L.js");
6780
+ const { provideAnswer } = await import("./tools-QYYNFMGU.js");
6843
6781
  const found = provideAnswer(callId, answer ?? "", skip ?? false);
6844
6782
  if (!found) {
6845
6783
  return res.status(404).json({ error: "No pending question with that ID" });
@@ -6872,7 +6810,7 @@ All file and git operations should use this branch.
6872
6810
  if (!session) {
6873
6811
  return res.status(404).json({ error: "Session not found" });
6874
6812
  }
6875
- const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-BNRNX6IW.js");
6813
+ const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-2AHDKCD7.js");
6876
6814
  if (getSetting2(SETTINGS_KEYS.CACHE_WARMING) !== "true") {
6877
6815
  return res.json({ success: false, reason: "disabled" });
6878
6816
  }
@@ -6904,7 +6842,7 @@ All file and git operations should use this branch.
6904
6842
  backend: activeProvider?.backend ?? llmClient.getBackend(),
6905
6843
  model: llmClient.getModel()
6906
6844
  };
6907
- const { runAgentTurn, TurnMetrics } = await import("./orchestrator-JKBY7B3P.js");
6845
+ const { runAgentTurn, TurnMetrics } = await import("./orchestrator-ED3KFPXO.js");
6908
6846
  runAgentTurn(
6909
6847
  {
6910
6848
  sessionManager,
@@ -6942,15 +6880,15 @@ All file and git operations should use this branch.
6942
6880
  if (!session) {
6943
6881
  return res.status(404).json({ error: "Session not found" });
6944
6882
  }
6945
- const { stopSessionExecution } = await import("./chat-handler-PEK5JDHO.js");
6946
- const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-2B363F7L.js");
6883
+ const { stopSessionExecution } = await import("./chat-handler-5SP265CR.js");
6884
+ const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-QYYNFMGU.js");
6947
6885
  const queuedMessages = sessionManager.getQueueState(sessionId);
6948
6886
  sessionManager.clearMessageQueue(sessionId);
6949
6887
  stopSessionExecution(sessionId, sessionManager);
6950
6888
  abortSession(sessionId);
6951
6889
  cancelQuestionsForSession(sessionId, "Session stopped by user");
6952
6890
  cancelPathConfirmationsForSession(sessionId, "Session stopped by user");
6953
- const eventStore = (await import("./events-224IO5NJ.js")).getEventStore();
6891
+ const eventStore = (await import("./events-5PLO4QJU.js")).getEventStore();
6954
6892
  eventStore.append(sessionId, { type: "running.changed", data: { isRunning: false } });
6955
6893
  res.json({ success: true, queuedMessages });
6956
6894
  });
@@ -6964,7 +6902,7 @@ All file and git operations should use this branch.
6964
6902
  if (typeof messageIndex !== "number" || messageIndex < 0) {
6965
6903
  return res.status(400).json({ error: "messageIndex must be a non-negative number" });
6966
6904
  }
6967
- const { truncateSessionMessages } = await import("./events-224IO5NJ.js");
6905
+ const { truncateSessionMessages } = await import("./events-5PLO4QJU.js");
6968
6906
  truncateSessionMessages(sessionId, messageIndex);
6969
6907
  res.json({ success: true });
6970
6908
  });
@@ -6984,8 +6922,8 @@ All file and git operations should use this branch.
6984
6922
  if (attachments !== void 0 && !Array.isArray(attachments)) {
6985
6923
  return res.status(400).json({ error: "attachments must be an array if provided" });
6986
6924
  }
6987
- const { getEventStore: getEventStore2 } = await import("./events-224IO5NJ.js");
6988
- const { buildMessagesFromStoredEvents } = await import("./folding-YTTTVS56.js");
6925
+ const { getEventStore: getEventStore2 } = await import("./events-5PLO4QJU.js");
6926
+ const { buildMessagesFromStoredEvents } = await import("./folding-CJWYFUKD.js");
6989
6927
  const eventStore = getEventStore2();
6990
6928
  const events = eventStore.getEvents(sessionId);
6991
6929
  const { messages } = buildMessagesFromStoredEvents(events);
@@ -6997,7 +6935,7 @@ All file and git operations should use this branch.
6997
6935
  if (msg.role !== "user" || msg.isSystemGenerated) {
6998
6936
  return res.status(400).json({ error: "Can only replay user messages" });
6999
6937
  }
7000
- const { truncateSessionMessages } = await import("./events-224IO5NJ.js");
6938
+ const { truncateSessionMessages } = await import("./events-5PLO4QJU.js");
7001
6939
  truncateSessionMessages(sessionId, msgIndex - 1);
7002
6940
  sessionManager.queueMessage(
7003
6941
  sessionId,
@@ -7059,7 +6997,7 @@ All file and git operations should use this branch.
7059
6997
  res.json({ accepted: true });
7060
6998
  });
7061
6999
  app.get("/api/settings", async (req, res) => {
7062
- const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-BNRNX6IW.js");
7000
+ const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-2AHDKCD7.js");
7063
7001
  const keysParam = req.query["keys"];
7064
7002
  if (!keysParam) {
7065
7003
  return res.status(400).json({ error: "keys query parameter is required" });
@@ -7072,19 +7010,19 @@ All file and git operations should use this branch.
7072
7010
  res.json(result);
7073
7011
  });
7074
7012
  app.get("/api/settings/:key", async (req, res) => {
7075
- const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-BNRNX6IW.js");
7013
+ const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-2AHDKCD7.js");
7076
7014
  const key = req.params.key;
7077
7015
  const value = getSetting2(key) ?? SETTINGS_DEFAULTS[key] ?? null;
7078
7016
  res.json({ key, value });
7079
7017
  });
7080
7018
  app.get("/api/settings/:key", async (req, res) => {
7081
- const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-BNRNX6IW.js");
7019
+ const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-2AHDKCD7.js");
7082
7020
  const key = req.params.key;
7083
7021
  const value = getSetting2(key) ?? SETTINGS_DEFAULTS[key] ?? null;
7084
7022
  res.json({ key, value });
7085
7023
  });
7086
7024
  app.put("/api/settings/:key", async (req, res) => {
7087
- const { setSetting: setSetting2 } = await import("./settings-BNRNX6IW.js");
7025
+ const { setSetting: setSetting2 } = await import("./settings-2AHDKCD7.js");
7088
7026
  const key = req.params.key;
7089
7027
  const { value } = req.body;
7090
7028
  if (value === void 0) {
@@ -7111,7 +7049,7 @@ All file and git operations should use this branch.
7111
7049
  }
7112
7050
  });
7113
7051
  app.get("/api/tools/shells", async (_req, res) => {
7114
- const { listAvailableShells } = await import("./platform-QNGCKX4L.js");
7052
+ const { listAvailableShells } = await import("./platform-6RPPBHKH.js");
7115
7053
  res.json({ shells: listAvailableShells() });
7116
7054
  });
7117
7055
  app.get("/api/config", async (_req, res) => {
@@ -7201,7 +7139,7 @@ All file and git operations should use this branch.
7201
7139
  }));
7202
7140
  }
7203
7141
  app.post("/api/proxy/test", async (_req, res) => {
7204
- const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-BNRNX6IW.js");
7142
+ const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-2AHDKCD7.js");
7205
7143
  const proxyUrl = getSetting2(SETTINGS_KEYS.PROXY_URL);
7206
7144
  if (!proxyUrl) {
7207
7145
  return res.status(400).json({ success: false, error: "No proxy URL configured" });
@@ -7293,7 +7231,7 @@ All file and git operations should use this branch.
7293
7231
  }
7294
7232
  });
7295
7233
  app.post("/api/proxy/test", async (_req, res) => {
7296
- const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-BNRNX6IW.js");
7234
+ const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-2AHDKCD7.js");
7297
7235
  const proxyUrl = getSetting2(SETTINGS_KEYS.PROXY_URL);
7298
7236
  if (!proxyUrl) {
7299
7237
  return res.status(400).json({ success: false, error: "No proxy URL configured" });
@@ -7320,7 +7258,7 @@ All file and git operations should use this branch.
7320
7258
  const backend = req.query["backend"];
7321
7259
  if (!url) return res.status(400).json({ error: "url is required" });
7322
7260
  try {
7323
- const { fetchModelsWithContext } = await import("./provider-manager-GNEPR6UN.js");
7261
+ const { fetchModelsWithContext } = await import("./provider-manager-6CLRMGDE.js");
7324
7262
  const { getModelProfile: getModelProfile2 } = await import("./profiles-5J7F4BML.js");
7325
7263
  const models = await fetchModelsWithContext(
7326
7264
  url,
@@ -7389,9 +7327,9 @@ All file and git operations should use this branch.
7389
7327
  return res.json({ success: true, message: { content: response2.content }, raw: response2 });
7390
7328
  }
7391
7329
  const { getModelProfile: getModelProfile2 } = await import("./profiles-5J7F4BML.js");
7392
- const { getBackendCapabilities } = await import("./backend-P3GHHLHJ.js");
7393
- const { buildNonStreamingCreateParams } = await import("./client-pure-VFZIIK4S.js");
7394
- const { OpenAIHttpClient } = await import("./http-client-YC3UA5OZ.js");
7330
+ const { getBackendCapabilities } = await import("./backend-LVYHLGQJ.js");
7331
+ const { buildNonStreamingCreateParams } = await import("./client-pure-66Z6FWS6.js");
7332
+ const { OpenAIHttpClient } = await import("./http-client-KLODRQC2.js");
7395
7333
  const { ensureVersionPrefix } = await import("./url-utils-SAJP7AEX.js");
7396
7334
  const profile = getModelProfile2(model);
7397
7335
  const capabilities = getBackendCapabilities(backend || "unknown");
@@ -7743,7 +7681,7 @@ All file and git operations should use this branch.
7743
7681
  });
7744
7682
  async function rebuildMcpTools() {
7745
7683
  const { createMcpTools: createMcpTools2 } = await import("./tool-adapter-FEAHWU5C.js");
7746
- const { setMcpTools: setMcpTools2 } = await import("./tools-2B363F7L.js");
7684
+ const { setMcpTools: setMcpTools2 } = await import("./tools-QYYNFMGU.js");
7747
7685
  const mcpTools = createMcpTools2(mcpManager);
7748
7686
  setMcpTools2(mcpTools);
7749
7687
  toolRegistry = createToolRegistry();
@@ -8124,7 +8062,7 @@ All file and git operations should use this branch.
8124
8062
  res.status(400).json({ error: error instanceof Error ? error.message : String(error) });
8125
8063
  }
8126
8064
  });
8127
- const { listProjects } = await import("./projects-C4353IQK.js");
8065
+ const { listProjects } = await import("./projects-AXHZOBR2.js");
8128
8066
  const allProjects = listProjects();
8129
8067
  const projectDir = allProjects.find(
8130
8068
  (p) => p.workdir === config3.workdir || config3.workdir && p.workdir.startsWith(config3.workdir + "/")
@@ -8151,13 +8089,13 @@ All file and git operations should use this branch.
8151
8089
  })
8152
8090
  );
8153
8091
  app.get("/api/sessions/:id/background-processes", async (req, res) => {
8154
- const { getSessionProcesses } = await import("./manager-4QGXI6WZ.js");
8092
+ const { getSessionProcesses } = await import("./manager-LZ3JQ443.js");
8155
8093
  const sessionId = req.params.id;
8156
8094
  const processes = getSessionProcesses(sessionId);
8157
8095
  res.json({ processes });
8158
8096
  });
8159
8097
  app.post("/api/sessions/:id/background-process/:processId/stop", async (req, res) => {
8160
- const { stopProcess } = await import("./manager-4QGXI6WZ.js");
8098
+ const { stopProcess } = await import("./manager-LZ3JQ443.js");
8161
8099
  const sessionId = req.params.id;
8162
8100
  const processId = req.params.processId;
8163
8101
  const session = sessionManager.getSession(sessionId);
@@ -8204,7 +8142,7 @@ All file and git operations should use this branch.
8204
8142
  }
8205
8143
  });
8206
8144
  app.get("/fox.svg", (_req, res) => {
8207
- readFile4(join10(webDir, "fox.svg")).then((content) => {
8145
+ readFile4(join9(webDir, "fox.svg")).then((content) => {
8208
8146
  res.set("Content-Type", "image/svg+xml");
8209
8147
  res.send(content);
8210
8148
  }).catch(() => {
@@ -8213,7 +8151,7 @@ All file and git operations should use this branch.
8213
8151
  });
8214
8152
  app.use(
8215
8153
  "/sounds",
8216
- express.static(join10(webDir, "public", "sounds"), {
8154
+ express.static(join9(webDir, "public", "sounds"), {
8217
8155
  setHeaders: (res) => {
8218
8156
  res.set("Content-Type", "audio/mpeg");
8219
8157
  }
@@ -8222,13 +8160,13 @@ All file and git operations should use this branch.
8222
8160
  app.use("/__inspect__.js", (_req, res) => {
8223
8161
  res.set("Access-Control-Allow-Origin", "*");
8224
8162
  res.set("Content-Type", "application/javascript");
8225
- readFile4(join10(webDir, "public", "__inspect__.js")).then((content) => res.send(content)).catch(() => res.status(404).send("Not found"));
8163
+ readFile4(join9(webDir, "public", "__inspect__.js")).then((content) => res.send(content)).catch(() => res.status(404).send("Not found"));
8226
8164
  });
8227
8165
  app.get("/*path", (req, res) => {
8228
8166
  if (req.path.startsWith("/api/")) {
8229
8167
  return;
8230
8168
  }
8231
- readFile4(join10(webDir, "index.html"), "utf-8").then((indexHtml) => viteServer.transformIndexHtml(req.originalUrl, indexHtml)).then((transformed) => res.send(transformed)).catch((err) => {
8169
+ readFile4(join9(webDir, "index.html"), "utf-8").then((indexHtml) => viteServer.transformIndexHtml(req.originalUrl, indexHtml)).then((transformed) => res.send(transformed)).catch((err) => {
8232
8170
  logger.error("Error serving index.html", { error: err });
8233
8171
  res.status(500).send("Server error");
8234
8172
  });
@@ -8239,7 +8177,7 @@ All file and git operations should use this branch.
8239
8177
  const distWebDir = resolve8(__dirname3, "web");
8240
8178
  app.use(
8241
8179
  "/assets",
8242
- express.static(join10(distWebDir, "assets"), {
8180
+ express.static(join9(distWebDir, "assets"), {
8243
8181
  setHeaders: (res, filepath) => {
8244
8182
  if (filepath.endsWith(".css")) {
8245
8183
  res.set("Content-Type", "text/css");
@@ -8247,11 +8185,11 @@ All file and git operations should use this branch.
8247
8185
  }
8248
8186
  })
8249
8187
  );
8250
- app.use("/manifest.webmanifest", express.static(join10(distWebDir, "manifest.webmanifest")));
8251
- app.use("/registerSW.js", express.static(join10(distWebDir, "registerSW.js")));
8252
- app.use("/sw.js", express.static(join10(distWebDir, "sw.js")));
8188
+ app.use("/manifest.webmanifest", express.static(join9(distWebDir, "manifest.webmanifest")));
8189
+ app.use("/registerSW.js", express.static(join9(distWebDir, "registerSW.js")));
8190
+ app.use("/sw.js", express.static(join9(distWebDir, "sw.js")));
8253
8191
  app.get("/fox.svg", (_req, res) => {
8254
- readFile4(join10(distWebDir, "fox.svg")).then((content) => {
8192
+ readFile4(join9(distWebDir, "fox.svg")).then((content) => {
8255
8193
  res.set("Content-Type", "image/svg+xml");
8256
8194
  res.send(content);
8257
8195
  }).catch(() => {
@@ -8260,7 +8198,7 @@ All file and git operations should use this branch.
8260
8198
  });
8261
8199
  app.use(
8262
8200
  "/sounds",
8263
- express.static(join10(distWebDir, "sounds"), {
8201
+ express.static(join9(distWebDir, "sounds"), {
8264
8202
  setHeaders: (res) => {
8265
8203
  res.set("Content-Type", "audio/mpeg");
8266
8204
  }
@@ -8269,10 +8207,10 @@ All file and git operations should use this branch.
8269
8207
  app.use("/__inspect__.js", (_req, res) => {
8270
8208
  res.set("Access-Control-Allow-Origin", "*");
8271
8209
  res.set("Content-Type", "application/javascript");
8272
- readFile4(join10(distWebDir, "__inspect__.js")).then((content) => res.send(content)).catch(() => res.status(404).send("Not found"));
8210
+ readFile4(join9(distWebDir, "__inspect__.js")).then((content) => res.send(content)).catch(() => res.status(404).send("Not found"));
8273
8211
  });
8274
8212
  app.get("/", (_req, res) => {
8275
- readFile4(join10(distWebDir, "index.html"), "utf-8").then((content) => res.send(content)).catch(() => {
8213
+ readFile4(join9(distWebDir, "index.html"), "utf-8").then((content) => res.send(content)).catch(() => {
8276
8214
  res.status(404).send("Web UI not built. Run `npm run build:web`");
8277
8215
  });
8278
8216
  });
@@ -8280,7 +8218,7 @@ All file and git operations should use this branch.
8280
8218
  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") {
8281
8219
  return;
8282
8220
  }
8283
- readFile4(join10(distWebDir, "index.html"), "utf-8").then((content) => res.send(content)).catch(() => {
8221
+ readFile4(join9(distWebDir, "index.html"), "utf-8").then((content) => res.send(content)).catch(() => {
8284
8222
  res.status(404).send("Web UI not built");
8285
8223
  });
8286
8224
  });
@@ -8296,13 +8234,46 @@ All file and git operations should use this branch.
8296
8234
  () => mcpManager.getAllServers()
8297
8235
  );
8298
8236
  const wss = wssExports.wss;
8237
+ deferTasksBroadcast = (projectId, payload) => wssExports.broadcastForProject(projectId, "", { type: "tasks.update", payload });
8238
+ const { launchWorkflowRun, abortRunnerRun } = await import("./launch-EOXVWLOP.js");
8239
+ deferTasksLaunchWorkflow = (sessionId, launch) => {
8240
+ const session = sessionManager.getSession(sessionId);
8241
+ let llmClient = getLLMClient();
8242
+ if (session?.providerId && session.providerModel) {
8243
+ const resolvedModel = providerManager.resolveModel(session.providerId, session.providerModel);
8244
+ llmClient = getLLMClientForProvider(session.providerId, resolvedModel ?? session.providerModel) ?? getLLMClient();
8245
+ }
8246
+ const provider = providerManager.getActiveProvider();
8247
+ const controller = new AbortController();
8248
+ launchWorkflowRun(
8249
+ {
8250
+ sessionManager,
8251
+ sessionId,
8252
+ controller,
8253
+ llmClient,
8254
+ statsIdentity: {
8255
+ providerId: provider?.id ?? `provider:${llmClient.getModel()}`,
8256
+ providerName: provider?.name ?? "Unknown Provider",
8257
+ backend: provider?.backend ?? llmClient.getBackend(),
8258
+ model: llmClient.getModel()
8259
+ },
8260
+ broadcastForSession: wssExports.broadcastForSession
8261
+ },
8262
+ {
8263
+ workflowId: launch.workflowId,
8264
+ ...launch.params && Object.keys(launch.params).length > 0 ? { params: launch.params } : {},
8265
+ ...launch.scope ? { scope: launch.scope } : {},
8266
+ ...launch.attachments && launch.attachments.length > 0 ? { attachments: launch.attachments } : {}
8267
+ }
8268
+ );
8269
+ };
8299
8270
  setNotifyMcpServersChanged((sessionId) => {
8300
8271
  const servers = mcpManager.getAllServers();
8301
8272
  wssExports.broadcastAll(createServerMessage("mcp.servers.changed", { servers }));
8302
8273
  const state = sessionManager.getContextState(sessionId);
8303
8274
  wssExports.broadcastForSession(sessionId, createContextStateMessage(state));
8304
8275
  });
8305
- const { QueueProcessor } = await import("./processor-NYPJ5PFA.js");
8276
+ const { QueueProcessor } = await import("./processor-226ZOTRI.js");
8306
8277
  const queueProcessor = new QueueProcessor({
8307
8278
  sessionManager,
8308
8279
  providerManager,
@@ -8315,7 +8286,8 @@ All file and git operations should use this branch.
8315
8286
  const abortSession = (sessionId) => {
8316
8287
  const wsAborted = wssExports.abortSession(sessionId);
8317
8288
  const qpAborted = queueProcessor.abortSession(sessionId);
8318
- const aborted = wsAborted || qpAborted;
8289
+ const taskAborted = abortRunnerRun(sessionId);
8290
+ const aborted = wsAborted || qpAborted || taskAborted;
8319
8291
  if (aborted) {
8320
8292
  sessionManager.setRunning(sessionId, false);
8321
8293
  wssExports.broadcastForSession(sessionId, { type: "session.running", payload: { isRunning: false } });
@@ -8345,14 +8317,14 @@ All file and git operations should use this branch.
8345
8317
  void (async () => {
8346
8318
  await devServerManager.stopAll();
8347
8319
  await mcpManager.disconnectAll();
8348
- const { stopAllInspectProxies } = await import("./inspect-proxy-B7LGGTM7.js");
8320
+ const { stopAllInspectProxies } = await import("./inspect-proxy-K6QKEYDT.js");
8349
8321
  stopAllInspectProxies();
8350
8322
  const { cleanupAllProcesses } = await import("./store-SARB6V2N.js");
8351
8323
  cleanupAllProcesses();
8352
8324
  viteServer?.close();
8353
8325
  if (config3.globalConfigPath) {
8354
- const { unlink: unlink2 } = await import("fs/promises");
8355
- unlink2(config3.globalConfigPath).catch(() => {
8326
+ const { unlink } = await import("fs/promises");
8327
+ unlink(config3.globalConfigPath).catch(() => {
8356
8328
  });
8357
8329
  }
8358
8330
  for (const client of wss.clients) {
@@ -8387,4 +8359,4 @@ export {
8387
8359
  createServerHandle,
8388
8360
  createServer
8389
8361
  };
8390
- //# sourceMappingURL=chunk-TEQEDOWI.js.map
8362
+ //# sourceMappingURL=chunk-OCBBAEMT.js.map