@jingyi0605/codingns 0.3.0 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/public/assets/{TerminalPage-Dfw1QUqW.js → TerminalPage-CgrfstRm.js} +19 -19
- package/dist/public/assets/index-Cek6u0b9.css +1 -0
- package/dist/public/assets/index-THHY79si.js +122 -0
- package/dist/public/index.html +2 -2
- package/dist/server/config/env.d.ts +2 -0
- package/dist/server/config/env.js +35 -0
- package/dist/server/config/env.js.map +1 -1
- package/dist/server/modules/auth/auth-service.d.ts +18 -1
- package/dist/server/modules/auth/auth-service.js +168 -7
- package/dist/server/modules/auth/auth-service.js.map +1 -1
- package/dist/server/modules/butler/butler-codex-model-policy.d.ts +1 -0
- package/dist/server/modules/butler/butler-codex-model-policy.js +36 -0
- package/dist/server/modules/butler/butler-codex-model-policy.js.map +1 -0
- package/dist/server/modules/butler/butler-control-session-service.d.ts +13 -1
- package/dist/server/modules/butler/butler-control-session-service.js +55 -231
- package/dist/server/modules/butler/butler-control-session-service.js.map +1 -1
- package/dist/server/modules/butler/butler-controller.d.ts +17 -0
- package/dist/server/modules/butler/butler-controller.js +20 -1
- package/dist/server/modules/butler/butler-controller.js.map +1 -1
- package/dist/server/modules/butler/butler-follow-up-service.js +7 -3
- package/dist/server/modules/butler/butler-follow-up-service.js.map +1 -1
- package/dist/server/modules/butler/butler-inbox-analysis-service.d.ts +36 -0
- package/dist/server/modules/butler/butler-inbox-analysis-service.js +375 -0
- package/dist/server/modules/butler/butler-inbox-analysis-service.js.map +1 -0
- package/dist/server/modules/butler/butler-inbox-instruction-adapter.d.ts +23 -0
- package/dist/server/modules/butler/butler-inbox-instruction-adapter.js +96 -0
- package/dist/server/modules/butler/butler-inbox-instruction-adapter.js.map +1 -0
- package/dist/server/modules/butler/butler-inbox-service.d.ts +39 -2
- package/dist/server/modules/butler/butler-inbox-service.js +392 -2
- package/dist/server/modules/butler/butler-inbox-service.js.map +1 -1
- package/dist/server/modules/butler/butler-session-service.d.ts +8 -0
- package/dist/server/modules/butler/butler-session-service.js +205 -53
- package/dist/server/modules/butler/butler-session-service.js.map +1 -1
- package/dist/server/modules/butler/butler-session-summary-service.d.ts +1 -0
- package/dist/server/modules/butler/butler-session-summary-service.js +48 -23
- package/dist/server/modules/butler/butler-session-summary-service.js.map +1 -1
- package/dist/server/modules/butler/butler-workspace-context.d.ts +13 -0
- package/dist/server/modules/butler/butler-workspace-context.js +223 -0
- package/dist/server/modules/butler/butler-workspace-context.js.map +1 -0
- package/dist/server/modules/client/client-controller.d.ts +6 -0
- package/dist/server/modules/client/client-controller.js +30 -8
- package/dist/server/modules/client/client-controller.js.map +1 -1
- package/dist/server/modules/client/client-service.d.ts +22 -10
- package/dist/server/modules/client/client-service.js +77 -100
- package/dist/server/modules/client/client-service.js.map +1 -1
- package/dist/server/modules/client/npm-global-package-service.d.ts +21 -0
- package/dist/server/modules/client/npm-global-package-service.js +210 -0
- package/dist/server/modules/client/npm-global-package-service.js.map +1 -0
- package/dist/server/modules/client/service-update-task-service.d.ts +15 -0
- package/dist/server/modules/client/service-update-task-service.js +147 -0
- package/dist/server/modules/client/service-update-task-service.js.map +1 -0
- package/dist/server/modules/client/service-update-types.d.ts +30 -0
- package/dist/server/modules/client/service-update-types.js +2 -0
- package/dist/server/modules/client/service-update-types.js.map +1 -0
- package/dist/server/modules/model-switch/cc-switch-adapter.d.ts +36 -0
- package/dist/server/modules/model-switch/cc-switch-adapter.js +317 -0
- package/dist/server/modules/model-switch/cc-switch-adapter.js.map +1 -0
- package/dist/server/modules/model-switch/model-switch-controller.d.ts +11 -0
- package/dist/server/modules/model-switch/model-switch-controller.js +30 -0
- package/dist/server/modules/model-switch/model-switch-controller.js.map +1 -0
- package/dist/server/modules/model-switch/model-switch-service.d.ts +16 -0
- package/dist/server/modules/model-switch/model-switch-service.js +29 -0
- package/dist/server/modules/model-switch/model-switch-service.js.map +1 -0
- package/dist/server/modules/preferences/profile-service.d.ts +1 -0
- package/dist/server/modules/preferences/profile-service.js +9 -0
- package/dist/server/modules/preferences/profile-service.js.map +1 -1
- package/dist/server/modules/sessions/codex-app-server-helper-process.js +3 -0
- package/dist/server/modules/sessions/codex-app-server-helper-process.js.map +1 -1
- package/dist/server/modules/sessions/session-activity-authority-service.d.ts +3 -1
- package/dist/server/modules/sessions/session-activity-authority-service.js +3 -0
- package/dist/server/modules/sessions/session-activity-authority-service.js.map +1 -1
- package/dist/server/modules/sessions/session-activity-inspector.d.ts +1 -1
- package/dist/server/modules/sessions/session-activity-inspector.js +43 -16
- package/dist/server/modules/sessions/session-activity-inspector.js.map +1 -1
- package/dist/server/modules/sessions/session-controller.d.ts +3 -3
- package/dist/server/modules/sessions/session-controller.js +3 -3
- package/dist/server/modules/sessions/session-controller.js.map +1 -1
- package/dist/server/modules/sessions/session-history-service.d.ts +3 -0
- package/dist/server/modules/sessions/session-history-service.js +259 -39
- package/dist/server/modules/sessions/session-history-service.js.map +1 -1
- package/dist/server/modules/sessions/session-live-runtime-service.d.ts +7 -3
- package/dist/server/modules/sessions/session-live-runtime-service.js +47 -11
- package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
- package/dist/server/modules/sessions/session-message-attachment-service.d.ts +8 -8
- package/dist/server/modules/sessions/session-message-attachment-service.js +25 -34
- package/dist/server/modules/sessions/session-message-attachment-service.js.map +1 -1
- package/dist/server/modules/sessions/session-provider-error-mapper.js +7 -0
- package/dist/server/modules/sessions/session-provider-error-mapper.js.map +1 -1
- package/dist/server/modules/tailscale/tailscale-manager.js +5 -1
- package/dist/server/modules/tailscale/tailscale-manager.js.map +1 -1
- package/dist/server/modules/tasks/task-lane-executors.js +3 -0
- package/dist/server/modules/tasks/task-lane-executors.js.map +1 -1
- package/dist/server/modules/tasks/task-types.d.ts +2 -0
- package/dist/server/modules/tasks/task-types.js +3 -1
- package/dist/server/modules/tasks/task-types.js.map +1 -1
- package/dist/server/modules/terminal/command-template-service.js +10 -1
- package/dist/server/modules/terminal/command-template-service.js.map +1 -1
- package/dist/server/modules/terminal/template-port-runtime.d.ts +12 -1
- package/dist/server/modules/terminal/template-port-runtime.js +189 -17
- package/dist/server/modules/terminal/template-port-runtime.js.map +1 -1
- package/dist/server/modules/terminal/terminal-service.js +30 -3
- package/dist/server/modules/terminal/terminal-service.js.map +1 -1
- package/dist/server/modules/workspace/workspace-code-composition.js +95 -2
- package/dist/server/modules/workspace/workspace-code-composition.js.map +1 -1
- package/dist/server/routes/butler.js +4 -0
- package/dist/server/routes/butler.js.map +1 -1
- package/dist/server/routes/client.js +2 -0
- package/dist/server/routes/client.js.map +1 -1
- package/dist/server/routes/sessions.js +1 -1
- package/dist/server/routes/sessions.js.map +1 -1
- package/dist/server/routes/system.d.ts +2 -1
- package/dist/server/routes/system.js +3 -1
- package/dist/server/routes/system.js.map +1 -1
- package/dist/server/server/create-server.d.ts +4 -0
- package/dist/server/server/create-server.js +51 -7
- package/dist/server/server/create-server.js.map +1 -1
- package/dist/server/shared/errors/app-error.d.ts +2 -0
- package/dist/server/shared/errors/app-error.js +2 -0
- package/dist/server/shared/errors/app-error.js.map +1 -1
- package/dist/server/shared/http/error-handler.d.ts +2 -1
- package/dist/server/shared/http/error-handler.js +3 -2
- package/dist/server/shared/http/error-handler.js.map +1 -1
- package/dist/server/storage/repositories/auth-login-attempt-repository.d.ts +9 -0
- package/dist/server/storage/repositories/auth-login-attempt-repository.js +59 -0
- package/dist/server/storage/repositories/auth-login-attempt-repository.js.map +1 -0
- package/dist/server/storage/repositories/butler-control-session-repository.d.ts +3 -0
- package/dist/server/storage/repositories/butler-control-session-repository.js +80 -4
- package/dist/server/storage/repositories/butler-control-session-repository.js.map +1 -1
- package/dist/server/storage/repositories/butler-inbox-item-repository.js +54 -3
- package/dist/server/storage/repositories/butler-inbox-item-repository.js.map +1 -1
- package/dist/server/storage/repositories/terminal-instance-repository.js +1 -1
- package/dist/server/storage/repositories/terminal-instance-repository.js.map +1 -1
- package/dist/server/storage/repositories/user-preference-profile-repository.js +6 -3
- package/dist/server/storage/repositories/user-preference-profile-repository.js.map +1 -1
- package/dist/server/storage/sqlite/client.js +127 -0
- package/dist/server/storage/sqlite/client.js.map +1 -1
- package/dist/server/storage/sqlite/schema.sql +19 -1
- package/dist/server/types/domain.d.ts +37 -1
- package/node_modules/@codingns/session-sync-core/dist/patch-builder.d.ts +23 -0
- package/node_modules/@codingns/session-sync-core/dist/patch-builder.js +162 -0
- package/node_modules/@codingns/session-sync-core/dist/patch-builder.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +89 -33
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js +18 -2
- package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +3 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +238 -53
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js +1 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/types.d.ts +6 -2
- package/node_modules/@codingns/session-sync-core/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/public/assets/index-DR2rPNi7.css +0 -1
- package/dist/public/assets/index-DTOruahn.js +0 -114
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
1
2
|
import fs from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
const WORKSPACE_CODE_SCAN_LIMIT = 20_000;
|
|
5
|
+
const GIT_CODE_SCAN_TIMEOUT_MS = 15_000;
|
|
4
6
|
const IGNORED_COMPOSITION_DIRECTORIES = new Set([
|
|
5
7
|
".git",
|
|
6
8
|
".idea",
|
|
@@ -83,8 +85,38 @@ export function readWorkspaceCodeComposition(workspacePath) {
|
|
|
83
85
|
error: "工作区路径不存在,无法统计代码类型"
|
|
84
86
|
};
|
|
85
87
|
}
|
|
88
|
+
const normalizedWorkspacePath = resolveWorkspaceRealPath(resolvedPath);
|
|
89
|
+
const trackedComposition = readGitTrackedWorkspaceCodeComposition(normalizedWorkspacePath);
|
|
90
|
+
if (trackedComposition) {
|
|
91
|
+
return trackedComposition;
|
|
92
|
+
}
|
|
93
|
+
return readDirectoryWorkspaceCodeComposition(normalizedWorkspacePath);
|
|
94
|
+
}
|
|
95
|
+
function readGitTrackedWorkspaceCodeComposition(workspacePath) {
|
|
96
|
+
const repoRootResult = runGitCommand(workspacePath, ["rev-parse", "--show-toplevel"]);
|
|
97
|
+
if (repoRootResult.status !== 0) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
const repoRoot = repoRootResult.stdout.trim();
|
|
101
|
+
if (!repoRoot) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
const normalizedRepoRoot = path.resolve(workspacePath, repoRoot);
|
|
105
|
+
const workspaceRelativePath = normalizeGitPath(path.relative(normalizedRepoRoot, workspacePath));
|
|
106
|
+
const trackedFileResult = runGitCommand(workspacePath, ["ls-files", "-z", "--full-name"]);
|
|
107
|
+
if (trackedFileResult.status !== 0) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
const trackedFiles = trackedFileResult.stdout
|
|
111
|
+
.split("\u0000")
|
|
112
|
+
.filter(Boolean)
|
|
113
|
+
.filter((relativePath) => isTrackedFileInWorkspace(relativePath, workspaceRelativePath))
|
|
114
|
+
.filter((relativePath) => isRegularWorkspaceFile(normalizedRepoRoot, relativePath));
|
|
115
|
+
return summarizeWorkspaceComposition(trackedFiles);
|
|
116
|
+
}
|
|
117
|
+
function readDirectoryWorkspaceCodeComposition(workspacePath) {
|
|
86
118
|
const typeCounts = new Map();
|
|
87
|
-
const directories = [
|
|
119
|
+
const directories = [workspacePath];
|
|
88
120
|
let scannedFileCount = 0;
|
|
89
121
|
let truncated = false;
|
|
90
122
|
while (directories.length > 0 && !truncated) {
|
|
@@ -94,7 +126,9 @@ export function readWorkspaceCodeComposition(workspacePath) {
|
|
|
94
126
|
}
|
|
95
127
|
let entries;
|
|
96
128
|
try {
|
|
97
|
-
entries = fs.readdirSync(currentDirectory, {
|
|
129
|
+
entries = fs.readdirSync(currentDirectory, {
|
|
130
|
+
withFileTypes: true
|
|
131
|
+
});
|
|
98
132
|
}
|
|
99
133
|
catch {
|
|
100
134
|
continue;
|
|
@@ -125,6 +159,27 @@ export function readWorkspaceCodeComposition(workspacePath) {
|
|
|
125
159
|
}
|
|
126
160
|
}
|
|
127
161
|
}
|
|
162
|
+
return buildWorkspaceCompositionSummary(typeCounts, scannedFileCount, truncated);
|
|
163
|
+
}
|
|
164
|
+
function summarizeWorkspaceComposition(filePaths) {
|
|
165
|
+
const typeCounts = new Map();
|
|
166
|
+
let scannedFileCount = 0;
|
|
167
|
+
let truncated = false;
|
|
168
|
+
for (const filePath of filePaths) {
|
|
169
|
+
const detectedType = detectWorkspaceFileType(path.basename(filePath));
|
|
170
|
+
if (!detectedType) {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
scannedFileCount += 1;
|
|
174
|
+
typeCounts.set(detectedType, (typeCounts.get(detectedType) ?? 0) + 1);
|
|
175
|
+
if (scannedFileCount >= WORKSPACE_CODE_SCAN_LIMIT) {
|
|
176
|
+
truncated = true;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return buildWorkspaceCompositionSummary(typeCounts, scannedFileCount, truncated);
|
|
181
|
+
}
|
|
182
|
+
function buildWorkspaceCompositionSummary(typeCounts, scannedFileCount, truncated) {
|
|
128
183
|
const items = [...typeCounts.entries()]
|
|
129
184
|
.sort((left, right) => right[1] - left[1] || left[0].localeCompare(right[0]))
|
|
130
185
|
.slice(0, 10)
|
|
@@ -140,6 +195,44 @@ export function readWorkspaceCodeComposition(workspacePath) {
|
|
|
140
195
|
error: null
|
|
141
196
|
};
|
|
142
197
|
}
|
|
198
|
+
function runGitCommand(workspacePath, args) {
|
|
199
|
+
const result = spawnSync("git", ["-c", "core.quotepath=false", ...args], {
|
|
200
|
+
cwd: workspacePath,
|
|
201
|
+
encoding: "utf8",
|
|
202
|
+
timeout: GIT_CODE_SCAN_TIMEOUT_MS
|
|
203
|
+
});
|
|
204
|
+
return {
|
|
205
|
+
status: result.status ?? 1,
|
|
206
|
+
stdout: result.stdout ?? ""
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function resolveWorkspaceRealPath(workspacePath) {
|
|
210
|
+
try {
|
|
211
|
+
return fs.realpathSync(workspacePath);
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
return workspacePath;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function normalizeGitPath(filePath) {
|
|
218
|
+
return filePath.split(path.sep).join("/");
|
|
219
|
+
}
|
|
220
|
+
function isTrackedFileInWorkspace(relativePath, workspaceRelativePath) {
|
|
221
|
+
if (!workspaceRelativePath || workspaceRelativePath === ".") {
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
return relativePath === workspaceRelativePath || relativePath.startsWith(`${workspaceRelativePath}/`);
|
|
225
|
+
}
|
|
226
|
+
function isRegularWorkspaceFile(repoRoot, relativePath) {
|
|
227
|
+
const absolutePath = path.join(repoRoot, relativePath);
|
|
228
|
+
try {
|
|
229
|
+
const stats = fs.lstatSync(absolutePath);
|
|
230
|
+
return stats.isFile() && !stats.isSymbolicLink();
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
143
236
|
function detectWorkspaceFileType(fileName) {
|
|
144
237
|
const normalizedName = fileName.trim().toLowerCase();
|
|
145
238
|
if (!normalizedName) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-code-composition.js","sourceRoot":"","sources":["../../../../src/modules/workspace/workspace-code-composition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,MAAM,yBAAyB,GAAG,MAAM,CAAC;AACzC,MAAM,+BAA+B,GAAG,IAAI,GAAG,CAAC;IAC9C,MAAM;IACN,OAAO;IACP,SAAS;IACT,OAAO;IACP,aAAa;IACb,QAAQ;IACR,cAAc;IACd,MAAM;IACN,OAAO;IACP,UAAU;IACV,OAAO;IACP,OAAO;IACP,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,KAAK;IACL,KAAK;CACN,CAAC,CAAC;AAEH,MAAM,wBAAwB,GAA2B;IACvD,UAAU,EAAE,YAAY;IACxB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF,MAAM,6BAA6B,GAA2B;IAC5D,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,QAAQ;IACnB,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,OAAO;IACf,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,OAAO;IACjB,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,MAAM,UAAU,4BAA4B,CAAC,aAAqB;IAChE,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAEjD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;QAC7E,OAAO;YACL,gBAAgB,EAAE,CAAC;YACnB,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,mBAAmB;SAC3B,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC7C,MAAM,WAAW,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"workspace-code-composition.js","sourceRoot":"","sources":["../../../../src/modules/workspace/workspace-code-composition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,MAAM,yBAAyB,GAAG,MAAM,CAAC;AACzC,MAAM,wBAAwB,GAAG,MAA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,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QACzC,OAAO,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAS,uBAAuB,CAAC,QAAgB;IAC/C,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAErD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,wBAAwB,CAAC,cAAc,CAAC,CAAC;IAExD,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,6BAA6B,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,IAAI,IAAI,CAAC;AAC7E,CAAC"}
|
|
@@ -3,6 +3,8 @@ export async function registerButlerRoutes(app, butlerController) {
|
|
|
3
3
|
app.post("/api/butler/profile/init", butlerController.initProfile);
|
|
4
4
|
app.patch("/api/butler/profile", butlerController.updateProfile);
|
|
5
5
|
app.get("/api/butler/control-session", butlerController.getCurrentControlSession);
|
|
6
|
+
app.get("/api/butler/control-sessions", butlerController.listControlSessions);
|
|
7
|
+
app.get("/api/butler/control-sessions/:controlSessionId", butlerController.getControlSession);
|
|
6
8
|
app.get("/api/butler/control-session/events", butlerController.listControlSessionEvents);
|
|
7
9
|
app.post("/api/butler/control-session/reset", butlerController.resetControlSession);
|
|
8
10
|
app.post("/api/butler/control-session/start", butlerController.startControlSession);
|
|
@@ -16,6 +18,8 @@ export async function registerButlerRoutes(app, butlerController) {
|
|
|
16
18
|
app.get("/api/butler/inbox", butlerController.listInboxItems);
|
|
17
19
|
app.post("/api/butler/inbox", butlerController.createInboxItem);
|
|
18
20
|
app.patch("/api/butler/inbox/:itemId", butlerController.updateInboxItem);
|
|
21
|
+
app.post("/api/butler/inbox/:itemId/analyze", butlerController.analyzeInboxItem);
|
|
22
|
+
app.post("/api/butler/inbox/:itemId/start-session", butlerController.startInboxItemSession);
|
|
19
23
|
app.delete("/api/butler/inbox/:itemId", butlerController.deleteInboxItem);
|
|
20
24
|
app.get("/api/butler/notifications/archives", butlerController.listNotificationArchives);
|
|
21
25
|
app.patch("/api/butler/notifications/archives/:notificationId", butlerController.updateNotificationArchive);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"butler.js","sourceRoot":"","sources":["../../../src/routes/butler.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,GAAoB,EACpB,gBAAkC;IAElC,GAAG,CAAC,GAAG,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAC5D,GAAG,CAAC,IAAI,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACnE,GAAG,CAAC,KAAK,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IACjE,GAAG,CAAC,GAAG,CAAC,6BAA6B,EAAE,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;IAClF,GAAG,CAAC,GAAG,CAAC,oCAAoC,EAAE,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;IACzF,GAAG,CAAC,IAAI,CAAC,mCAAmC,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IACpF,GAAG,CAAC,IAAI,CAAC,mCAAmC,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IACpF,GAAG,CAAC,IAAI,CAAC,oCAAoC,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;IACtF,GAAG,CAAC,IAAI,CAAC,sCAAsC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IACtF,GAAG,CAAC,GAAG,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC9D,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AAgB,CAAC,cAAc,CAAC,CAAC;IAC/F,GAAG,CAAC,GAAG,CAAC,oDAAoD,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC7F,GAAG,CAAC,GAAG,CAAC,+CAA+C,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;IAChG,GAAG,CAAC,IAAI,CAAC,+CAA+C,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;IACjG,GAAG,CAAC,GAAG,CACL,+DAA+D,EAC/D,gBAAgB,CAAC,kBAAkB,CACpC,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export async function registerClientRoutes(app, clientController) {
|
|
2
2
|
app.get("/api/client/runtime-config", clientController.getRuntimeConfig);
|
|
3
3
|
app.get("/api/client/service-update", clientController.getServiceUpdate);
|
|
4
|
+
app.post("/api/client/service-update/install", clientController.installServiceUpdate);
|
|
5
|
+
app.get("/api/client/service-update/tasks/:taskId", clientController.getServiceUpdateTask);
|
|
4
6
|
app.get("/api/client/release-manifest", clientController.getReleaseManifest);
|
|
5
7
|
}
|
|
6
8
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/routes/client.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,GAAoB,EACpB,gBAAkC;IAElC,GAAG,CAAC,GAAG,CAAC,4BAA4B,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACzE,GAAG,CAAC,GAAG,CAAC,4BAA4B,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACzE,GAAG,CAAC,GAAG,CAAC,8BAA8B,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;AAC/E,CAAC"}
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/routes/client.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,GAAoB,EACpB,gBAAkC;IAElC,GAAG,CAAC,GAAG,CAAC,4BAA4B,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACzE,GAAG,CAAC,GAAG,CAAC,4BAA4B,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACzE,GAAG,CAAC,IAAI,CAAC,oCAAoC,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;IACtF,GAAG,CAAC,GAAG,CAAC,0CAA0C,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;IAC3F,GAAG,CAAC,GAAG,CAAC,8BAA8B,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// 会话附件当前通过 JSON + base64 直接提交,Fastify 默认 1MB bodyLimit
|
|
2
2
|
// 对首条/追加/排队消息都过小,合法图片会在进入 controller 前就被 413 拦掉。
|
|
3
3
|
export const SESSION_MESSAGE_BODY_LIMIT_BYTES = 64 * 1024 * 1024;
|
|
4
4
|
export async function registerSessionRoutes(app, sessionController) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../../src/routes/sessions.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../../src/routes/sessions.ts"],"names":[],"mappings":"AAIA,uDAAuD;AACvD,iDAAiD;AACjD,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjE,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,GAAoB,EACpB,iBAAoC;IAEpC,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACjD,GAAG,CAAC,GAAG,CAAC,0BAA0B,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;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rC,CAAC;IACF,GAAG,CAAC,IAAI,CAAC,mDAAmD,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;IACpG,GAAG,CAAC,IAAI,CAAC,oCAAoC,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC5E,GAAG,CAAC,IAAI,CAAC,+BAA+B,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACtE,GAAG,CAAC,IAAI,CAAC,iCAAiC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACtE,GAAG,CAAC,IAAI,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACzD,GAAG,CAAC,IAAI,CACN,0BAA0B,EAC1B;QACE,SAAS,EAAE,gCAAgC;KAC5C,EACD,iBAAiB,CAAC,SAAS,CAC5B,CAAC;IACF,GAAG,CAAC,MAAM,CAAC,6CAA6C,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;AACnG,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FastifyInstance } from "fastify";
|
|
2
|
+
import type { ModelSwitchController } from "../modules/model-switch/model-switch-controller.js";
|
|
2
3
|
import type { TailscaleController } from "../modules/tailscale/tailscale-controller.js";
|
|
3
|
-
export declare function registerSystemRoutes(app: FastifyInstance, tailscaleController: TailscaleController): Promise<void>;
|
|
4
|
+
export declare function registerSystemRoutes(app: FastifyInstance, tailscaleController: TailscaleController, modelSwitchController: ModelSwitchController): Promise<void>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export async function registerSystemRoutes(app, tailscaleController) {
|
|
1
|
+
export async function registerSystemRoutes(app, tailscaleController, modelSwitchController) {
|
|
2
2
|
app.get("/api/system/tailscale/status", tailscaleController.getStatus);
|
|
3
3
|
app.put("/api/system/tailscale/config", tailscaleController.updateConfig);
|
|
4
4
|
app.post("/api/system/tailscale/enable", tailscaleController.enable);
|
|
5
5
|
app.post("/api/system/tailscale/disable", tailscaleController.disable);
|
|
6
6
|
app.post("/api/system/tailscale/login", tailscaleController.login);
|
|
7
7
|
app.post("/api/system/tailscale/logout", tailscaleController.logout);
|
|
8
|
+
app.get("/api/system/model-switch", modelSwitchController.getSnapshot);
|
|
9
|
+
app.post("/api/system/model-switch", modelSwitchController.switchPreset);
|
|
8
10
|
}
|
|
9
11
|
//# sourceMappingURL=system.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../src/routes/system.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../src/routes/system.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,GAAoB,EACpB,mBAAwC,EACxC,qBAA4C;IAE5C,GAAG,CAAC,GAAG,CAAC,8BAA8B,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACvE,GAAG,CAAC,GAAG,CAAC,8BAA8B,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAC1E,GAAG,CAAC,IAAI,CAAC,8BAA8B,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACrE,GAAG,CAAC,IAAI,CAAC,+BAA+B,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACvE,GAAG,CAAC,IAAI,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACnE,GAAG,CAAC,IAAI,CAAC,8BAA8B,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACrE,GAAG,CAAC,GAAG,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC;IACvE,GAAG,CAAC,IAAI,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,YAAY,CAAC,CAAC;AAC3E,CAAC"}
|
|
@@ -32,6 +32,7 @@ import { GitReadService } from "../modules/git/git-read-service.js";
|
|
|
32
32
|
import { GitWriteService } from "../modules/git/git-write-service.js";
|
|
33
33
|
import { PreferenceProfileService } from "../modules/preferences/profile-service.js";
|
|
34
34
|
import { QuickPhraseService } from "../modules/preferences/quick-phrase-service.js";
|
|
35
|
+
import { ModelSwitchService } from "../modules/model-switch/model-switch-service.js";
|
|
35
36
|
import { SkillManagerService } from "../modules/skills/skill-manager-service.js";
|
|
36
37
|
import { TailscaleManager } from "../modules/tailscale/tailscale-manager.js";
|
|
37
38
|
import { TailscaleService } from "../modules/tailscale/tailscale-service.js";
|
|
@@ -50,6 +51,7 @@ import { WorktreeManager } from "../modules/worktree/worktree-manager.js";
|
|
|
50
51
|
import { WorktreeSyncService } from "../modules/worktree/worktree-sync-service.js";
|
|
51
52
|
import { WorkspaceService } from "../modules/workspace/workspace-service.js";
|
|
52
53
|
import { AuthTokenRepository } from "../storage/repositories/auth-token-repository.js";
|
|
54
|
+
import { AuthLoginAttemptRepository } from "../storage/repositories/auth-login-attempt-repository.js";
|
|
53
55
|
import { AuthUserRepository } from "../storage/repositories/auth-user-repository.js";
|
|
54
56
|
import { AiFallbackEditRepository } from "../storage/repositories/ai-fallback-edit-repository.js";
|
|
55
57
|
import { BootstrapStateRepository } from "../storage/repositories/bootstrap-state-repository.js";
|
|
@@ -110,6 +112,7 @@ export declare function createServer(config: HostConfig): {
|
|
|
110
112
|
bootstrapStateRepository: BootstrapStateRepository;
|
|
111
113
|
authUserRepository: AuthUserRepository;
|
|
112
114
|
authTokenRepository: AuthTokenRepository;
|
|
115
|
+
authLoginAttemptRepository: AuthLoginAttemptRepository;
|
|
113
116
|
workspaceRepository: WorkspaceRepository;
|
|
114
117
|
workspaceWorktreeRepository: WorkspaceWorktreeRepository;
|
|
115
118
|
workspaceNavigationStateRepository: WorkspaceNavigationStateRepository;
|
|
@@ -202,6 +205,7 @@ export declare function createServer(config: HostConfig): {
|
|
|
202
205
|
skillManagerService: SkillManagerService;
|
|
203
206
|
tailscaleManager: TailscaleManager;
|
|
204
207
|
tailscaleService: TailscaleService;
|
|
208
|
+
modelSwitchService: ModelSwitchService;
|
|
205
209
|
runtimeObservabilityService: RuntimeObservabilityService;
|
|
206
210
|
sessionHistoryService: SessionHistoryService;
|
|
207
211
|
sessionChangedFileService: SessionChangedFileService;
|
|
@@ -16,6 +16,7 @@ import { ButlerAuthService } from "../modules/butler/butler-auth-service.js";
|
|
|
16
16
|
import { ButlerFollowUpEvaluationInstructionAdapter } from "../modules/butler/butler-follow-up-evaluation-instruction-adapter.js";
|
|
17
17
|
import { ButlerFollowUpScheduler } from "../modules/butler/butler-follow-up-scheduler.js";
|
|
18
18
|
import { ButlerFollowUpService } from "../modules/butler/butler-follow-up-service.js";
|
|
19
|
+
import { ButlerInboxAnalysisService } from "../modules/butler/butler-inbox-analysis-service.js";
|
|
19
20
|
import { ButlerInboxService } from "../modules/butler/butler-inbox-service.js";
|
|
20
21
|
import { ButlerNotificationService } from "../modules/butler/butler-notification-service.js";
|
|
21
22
|
import { ButlerProfileService } from "../modules/butler/butler-profile-service.js";
|
|
@@ -34,6 +35,8 @@ import { SessionSummaryScheduler } from "../modules/butler/session-summary-sched
|
|
|
34
35
|
import { VerificationRunService } from "../modules/butler/verification-run-service.js";
|
|
35
36
|
import { ClientController } from "../modules/client/client-controller.js";
|
|
36
37
|
import { ClientService } from "../modules/client/client-service.js";
|
|
38
|
+
import { NpmGlobalPackageService } from "../modules/client/npm-global-package-service.js";
|
|
39
|
+
import { ServiceUpdateTaskService } from "../modules/client/service-update-task-service.js";
|
|
37
40
|
import { DebugTargetController } from "../modules/debug-target/debug-target-controller.js";
|
|
38
41
|
import { DebugRuntimeReconciliationScheduler } from "../modules/debug-target/debug-runtime-reconciliation-scheduler.js";
|
|
39
42
|
import { DebugTargetService } from "../modules/debug-target/debug-target-service.js";
|
|
@@ -62,6 +65,9 @@ import { ProfileController } from "../modules/preferences/profile-controller.js"
|
|
|
62
65
|
import { PreferenceProfileService } from "../modules/preferences/profile-service.js";
|
|
63
66
|
import { QuickPhraseController } from "../modules/preferences/quick-phrase-controller.js";
|
|
64
67
|
import { QuickPhraseService } from "../modules/preferences/quick-phrase-service.js";
|
|
68
|
+
import { CcSwitchAdapter } from "../modules/model-switch/cc-switch-adapter.js";
|
|
69
|
+
import { ModelSwitchController } from "../modules/model-switch/model-switch-controller.js";
|
|
70
|
+
import { ModelSwitchService } from "../modules/model-switch/model-switch-service.js";
|
|
65
71
|
import { ProviderController } from "../modules/provider/provider-controller.js";
|
|
66
72
|
import { SkillController } from "../modules/skills/skill-controller.js";
|
|
67
73
|
import { SkillManagerService } from "../modules/skills/skill-manager-service.js";
|
|
@@ -122,6 +128,7 @@ import { DemoCleanupService, DemoOnlineTracker } from "../modules/demo/demo-clea
|
|
|
122
128
|
import { setErrorHandler } from "../shared/http/error-handler.js";
|
|
123
129
|
import { startTerminalDebugEventLoopLagMonitor } from "../shared/utils/terminal-debug-log.js";
|
|
124
130
|
import { AuthTokenRepository } from "../storage/repositories/auth-token-repository.js";
|
|
131
|
+
import { AuthLoginAttemptRepository } from "../storage/repositories/auth-login-attempt-repository.js";
|
|
125
132
|
import { AuthUserRepository } from "../storage/repositories/auth-user-repository.js";
|
|
126
133
|
import { AiFallbackEditRepository } from "../storage/repositories/ai-fallback-edit-repository.js";
|
|
127
134
|
import { BootstrapStateRepository } from "../storage/repositories/bootstrap-state-repository.js";
|
|
@@ -185,12 +192,14 @@ export function createServer(config) {
|
|
|
185
192
|
const app = Fastify({
|
|
186
193
|
logger: false
|
|
187
194
|
});
|
|
195
|
+
let shuttingDown = false;
|
|
188
196
|
const stopTerminalDebugEventLoopLagMonitor = startTerminalDebugEventLoopLagMonitor();
|
|
189
197
|
const database = createDatabaseClient(config.databasePath);
|
|
190
198
|
const repositories = {
|
|
191
199
|
bootstrapStateRepository: new BootstrapStateRepository(database.db),
|
|
192
200
|
authUserRepository: new AuthUserRepository(database.db),
|
|
193
201
|
authTokenRepository: new AuthTokenRepository(database.db),
|
|
202
|
+
authLoginAttemptRepository: new AuthLoginAttemptRepository(database.db),
|
|
194
203
|
workspaceRepository: new WorkspaceRepository(database.db),
|
|
195
204
|
workspaceWorktreeRepository: new WorkspaceWorktreeRepository(database.db),
|
|
196
205
|
workspaceNavigationStateRepository: new WorkspaceNavigationStateRepository(database.db),
|
|
@@ -240,7 +249,6 @@ export function createServer(config) {
|
|
|
240
249
|
terminalCommandTemplateRepository: new TerminalCommandTemplateRepository(database.db)
|
|
241
250
|
};
|
|
242
251
|
const bootstrapService = new BootstrapService(database.db, repositories.bootstrapStateRepository, repositories.authUserRepository, config.demoMode);
|
|
243
|
-
const clientService = new ClientService(config);
|
|
244
252
|
// Demo 模式服务
|
|
245
253
|
const demoCleanupService = config.demoMode
|
|
246
254
|
? new DemoCleanupService(database.db, config.databasePath)
|
|
@@ -251,7 +259,7 @@ export function createServer(config) {
|
|
|
251
259
|
const demoServices = (demoCleanupService && demoOnlineTracker)
|
|
252
260
|
? { cleanupService: demoCleanupService, onlineTracker: demoOnlineTracker }
|
|
253
261
|
: undefined;
|
|
254
|
-
const authService = new AuthService(repositories.bootstrapStateRepository, repositories.authUserRepository, repositories.authTokenRepository, effectiveConfig, demoServices);
|
|
262
|
+
const authService = new AuthService(repositories.bootstrapStateRepository, repositories.authUserRepository, repositories.authTokenRepository, repositories.authLoginAttemptRepository, effectiveConfig, demoServices);
|
|
255
263
|
const butlerProfileService = new ButlerProfileService(repositories.butlerProfileRepository, repositories.butlerProjectRepository, path.dirname(config.databasePath));
|
|
256
264
|
const gitCommandRunner = new GitCommandRunner({
|
|
257
265
|
preferHelperProcess: !process.env.VITEST
|
|
@@ -261,6 +269,9 @@ export function createServer(config) {
|
|
|
261
269
|
let runtimeObservabilityService;
|
|
262
270
|
const taskActivityLog = new TaskActivityLog(() => runtimeObservabilityService.hasActiveSession());
|
|
263
271
|
const taskManager = createTaskManager(taskActivityLog, createHostTaskLaneExecutors());
|
|
272
|
+
const npmGlobalPackageService = new NpmGlobalPackageService(config);
|
|
273
|
+
const serviceUpdateTaskService = new ServiceUpdateTaskService(taskManager, npmGlobalPackageService);
|
|
274
|
+
const clientService = new ClientService(config, npmGlobalPackageService, serviceUpdateTaskService);
|
|
264
275
|
const workspaceService = new WorkspaceService(repositories.workspaceRepository, gitCommandRunner, repositories.workspaceNavigationStateRepository, butlerProfileService, repositories.workspaceWorktreeRepository, taskManager);
|
|
265
276
|
const fileAccessGuard = new FileAccessGuard(workspaceService, app.log);
|
|
266
277
|
const recentFileService = new RecentFileService(repositories.recentFileRepository);
|
|
@@ -285,6 +296,10 @@ export function createServer(config) {
|
|
|
285
296
|
const tailscaleService = new TailscaleService(database.db, repositories.instanceTailscaleRepository, tailscaleManager, {
|
|
286
297
|
databasePath: config.databasePath
|
|
287
298
|
});
|
|
299
|
+
const modelSwitchService = new ModelSwitchService(new CcSwitchAdapter({
|
|
300
|
+
commandPath: config.ccSwitchCliPath,
|
|
301
|
+
dbPath: config.ccSwitchDbPath
|
|
302
|
+
}));
|
|
288
303
|
const skillManagerService = new SkillManagerService(repositories.managedSkillRepository, repositories.skillTargetBindingRepository, createDefaultSkillTargetAdapters(config), {
|
|
289
304
|
ssotRootDir: path.join(path.dirname(config.databasePath), "skills")
|
|
290
305
|
});
|
|
@@ -326,7 +341,7 @@ export function createServer(config) {
|
|
|
326
341
|
const worktreeCleanupService = new WorktreeCleanupService(workspaceService, repositories.workspaceWorktreeRepository, repositories.sessionIndexRepository, repositories.terminalInstanceRepository, gitReadService, gitCommandRunner, worktreeSyncService);
|
|
327
342
|
const workbenchService = new WorkbenchService(repositories.workspaceRepository, repositories.workspaceNavigationStateRepository, sessionHistoryService, butlerProfileService, repositories.butlerControlSessionRepository, repositories.workspaceWorktreeRepository, taskManager);
|
|
328
343
|
const butlerProjectService = new ButlerProjectService(repositories.butlerProjectRepository, repositories.butlerSessionRepository, repositories.workspaceRepository, butlerProfileService);
|
|
329
|
-
const butlerInboxService = new ButlerInboxService(repositories.butlerProjectRepository, repositories.butlerInboxItemRepository);
|
|
344
|
+
const butlerInboxService = new ButlerInboxService(repositories.butlerProjectRepository, repositories.butlerInboxItemRepository, taskManager);
|
|
330
345
|
const butlerNotificationService = new ButlerNotificationService(repositories.butlerNotificationArchiveRepository);
|
|
331
346
|
const butlerSessionService = new ButlerSessionService(repositories.butlerProjectRepository, repositories.butlerSessionRepository, repositories.sessionCheckpointRepository, repositories.sessionBindingRepository, repositories.sessionIndexRepository, repositories.sessionStateRepository, sessionLiveRuntimeService, sessionHistoryService);
|
|
332
347
|
const projectMemoryService = new ProjectMemoryService(repositories.butlerProjectRepository, repositories.projectMemoryRepository);
|
|
@@ -345,6 +360,10 @@ export function createServer(config) {
|
|
|
345
360
|
new RuntimePatrolProviderAdapter("codex", butlerFollowUpSessionLiveRuntimeService, sessionHistoryService),
|
|
346
361
|
new RuntimePatrolProviderAdapter("claude-code", butlerFollowUpSessionLiveRuntimeService, sessionHistoryService)
|
|
347
362
|
]);
|
|
363
|
+
const butlerAnalysisProviderAdapterRegistry = new ProviderAdapterRegistry([
|
|
364
|
+
new RuntimePatrolProviderAdapter("codex", butlerSessionLiveRuntimeService, sessionHistoryService),
|
|
365
|
+
new RuntimePatrolProviderAdapter("claude-code", butlerSessionLiveRuntimeService, sessionHistoryService)
|
|
366
|
+
]);
|
|
348
367
|
const patrolExecutionService = new PatrolExecutionService(repositories.butlerProjectRepository, repositories.butlerSessionRepository, repositories.sessionCheckpointRepository, repositories.patrolPlanRepository, patrolRunService, repositories.projectMemoryRepository, repositories.sessionChangedFileRepository, repositories.authUserRepository, providerAdapterRegistry, instructionAdapter);
|
|
349
368
|
const patrolScheduler = new PatrolScheduler(patrolPlanService, patrolRunService, patrolExecutionService, {
|
|
350
369
|
schedulerMetrics
|
|
@@ -354,6 +373,7 @@ export function createServer(config) {
|
|
|
354
373
|
const verificationRunService = new VerificationRunService(repositories.butlerProjectRepository, repositories.butlerSessionRepository, repositories.sessionCheckpointRepository, repositories.verificationRunRepository);
|
|
355
374
|
const butlerContextAggregator = new ButlerContextAggregator(butlerProfileService, butlerProjectService, butlerSessionService, butlerInboxService, projectMemoryService, patrolRunService, verificationRunService, repositories.sessionCheckpointRepository);
|
|
356
375
|
const butlerAuthService = new ButlerAuthService(repositories.authTokenRepository, config);
|
|
376
|
+
const butlerInboxAnalysisService = new ButlerInboxAnalysisService(butlerProfileService, workspaceService, butlerContextAggregator, butlerAuthService, skillManagerService, sessionHistoryService, butlerSessionLiveRuntimeService, butlerAnalysisProviderAdapterRegistry, butlerRuntimeConfig.codexHomeDir, config.codexHomeDir);
|
|
357
377
|
const butlerSessionSummaryService = new ButlerSessionSummaryService(butlerProfileService, butlerProjectService, butlerSessionService, repositories.butlerSessionRepository, repositories.butlerSessionSummaryStateRepository, repositories.sessionCheckpointRepository, repositories.sessionIndexRepository, repositories.authUserRepository, workspaceService, sessionHistoryService, summaryProviderAdapterRegistry, sessionSummaryInstructionAdapter, {
|
|
358
378
|
summaryCodexHomeDir: butlerSummaryRuntimeConfig.codexHomeDir,
|
|
359
379
|
sourceCodexHomeDir: config.codexHomeDir
|
|
@@ -370,6 +390,12 @@ export function createServer(config) {
|
|
|
370
390
|
await butlerFollowUpService.handleSessionTerminal(event.sessionId, event.timestamp);
|
|
371
391
|
});
|
|
372
392
|
const butlerControlSessionService = new ButlerControlSessionService(butlerProfileService, repositories.butlerControlSessionRepository, workspaceService, sessionHistoryService, butlerSessionLiveRuntimeService, butlerContextAggregator, butlerAuthService, skillManagerService, butlerRuntimeConfig.codexHomeDir, config.codexHomeDir);
|
|
393
|
+
butlerInboxService.configureLifecycleServices({
|
|
394
|
+
butlerInboxAnalysisService,
|
|
395
|
+
butlerControlSessionService,
|
|
396
|
+
butlerSessionService,
|
|
397
|
+
butlerFollowUpService
|
|
398
|
+
});
|
|
373
399
|
const butlerControlActionService = new ButlerControlActionService(butlerProfileService, repositories.butlerControlSessionRepository, repositories.butlerControlEventRepository, butlerProjectService, butlerSessionService, patrolRunService, patrolExecutionService, verificationRunService, butlerContextAggregator);
|
|
374
400
|
const fileContextService = new FileContextService(sessionHistoryService, repositories.fileContextBindingRepository);
|
|
375
401
|
const terminalService = new TerminalService(database.db, repositories.terminalInstanceRepository, repositories.terminalRuntimeSessionRepository, workspaceService, config.terminalIdleTimeoutSeconds, {
|
|
@@ -403,6 +429,7 @@ export function createServer(config) {
|
|
|
403
429
|
const providerController = new ProviderController(sessionHistoryService, sessionLiveRuntimeService, config);
|
|
404
430
|
const skillController = new SkillController(skillManagerService);
|
|
405
431
|
const tailscaleController = new TailscaleController(tailscaleService);
|
|
432
|
+
const modelSwitchController = new ModelSwitchController(modelSwitchService);
|
|
406
433
|
const quickPhraseController = new QuickPhraseController(quickPhraseService);
|
|
407
434
|
const profileController = new ProfileController(preferenceProfileService);
|
|
408
435
|
const fileController = new FileController(fileTreeService, fileContentService, fileSearchService, recentFileService, filePreviewService, filePreviewLinkService);
|
|
@@ -423,9 +450,24 @@ export function createServer(config) {
|
|
|
423
450
|
});
|
|
424
451
|
app.addHook("onRequest", createAuthGuard(authService));
|
|
425
452
|
app.setErrorHandler(setErrorHandler);
|
|
426
|
-
app.addHook("onReady",
|
|
427
|
-
|
|
428
|
-
|
|
453
|
+
app.addHook("onReady", () => {
|
|
454
|
+
// 启动恢复属于后台补偿流程,不能把 Host ready 绑死在外部命令或慢任务上。
|
|
455
|
+
void debugTargetService.runBackgroundRuntimeReconciliation("debug_target.startup_runtime_recovery").catch((error) => {
|
|
456
|
+
if (shuttingDown) {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
console.error("[startup-recovery] 调试运行时恢复失败", {
|
|
460
|
+
error: error instanceof Error ? error.message : String(error)
|
|
461
|
+
});
|
|
462
|
+
});
|
|
463
|
+
void tailscaleService.restoreOnStartup().catch((error) => {
|
|
464
|
+
if (shuttingDown) {
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
console.error("[startup-recovery] Tailscale 启动恢复失败", {
|
|
468
|
+
error: error instanceof Error ? error.message : String(error)
|
|
469
|
+
});
|
|
470
|
+
});
|
|
429
471
|
});
|
|
430
472
|
// Demo 模式:自动创建演示用户
|
|
431
473
|
if (config.demoMode) {
|
|
@@ -448,7 +490,7 @@ export function createServer(config) {
|
|
|
448
490
|
void registerSessionRoutes(app, sessionController);
|
|
449
491
|
void registerPreferenceRoutes(app, quickPhraseController, profileController);
|
|
450
492
|
void registerSkillRoutes(app, skillController);
|
|
451
|
-
void registerSystemRoutes(app, tailscaleController);
|
|
493
|
+
void registerSystemRoutes(app, tailscaleController, modelSwitchController);
|
|
452
494
|
void registerFileRoutes(app, fileController);
|
|
453
495
|
void registerSessionContextRoutes(app, fileContextController);
|
|
454
496
|
void registerTerminalRoutes(app, terminalController);
|
|
@@ -462,6 +504,7 @@ export function createServer(config) {
|
|
|
462
504
|
registerStaticWebRoutes(app, config.webUiDir);
|
|
463
505
|
}
|
|
464
506
|
app.addHook("onClose", async () => {
|
|
507
|
+
shuttingDown = true;
|
|
465
508
|
stopTerminalDebugEventLoopLagMonitor();
|
|
466
509
|
eventLoopMonitor.dispose();
|
|
467
510
|
butlerFollowUpTerminalSubscription.close();
|
|
@@ -530,6 +573,7 @@ export function createServer(config) {
|
|
|
530
573
|
skillManagerService,
|
|
531
574
|
tailscaleManager,
|
|
532
575
|
tailscaleService,
|
|
576
|
+
modelSwitchService,
|
|
533
577
|
runtimeObservabilityService,
|
|
534
578
|
sessionHistoryService,
|
|
535
579
|
sessionChangedFileService,
|