@kafca/agentdock 0.1.51 → 0.1.53

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 (71) hide show
  1. package/README.md +4 -0
  2. package/dist/renderer/assets/{Badge-DpYXv6XT.js → Badge-pBiMqECO.js} +1 -1
  3. package/dist/renderer/assets/{Chat-C_aNxLPf.js → Chat-pQVBr82B.js} +1 -1
  4. package/dist/renderer/assets/{ChatMarkdown-DZgHg5zH.js → ChatMarkdown-SCxRo6-e.js} +1 -1
  5. package/dist/renderer/assets/Config-DRtyF20X.js +21 -0
  6. package/dist/renderer/assets/{CronList-BuvMxOmF.js → CronList-BA5hVrYp.js} +1 -1
  7. package/dist/renderer/assets/{Dashboard-3nbUcH91.js → Dashboard-p3yI0Fck.js} +2 -2
  8. package/dist/renderer/assets/{EmptyState-LMG_D0FN.js → EmptyState-Dgh25c2x.js} +1 -1
  9. package/dist/renderer/assets/{KnowledgeDetail-DPuV1KoJ.js → KnowledgeDetail-CuC3Cjg1.js} +2 -2
  10. package/dist/renderer/assets/{KnowledgeHome-VFIxwTp4.js → KnowledgeHome-CH4GqtEZ.js} +2 -2
  11. package/dist/renderer/assets/{Logs-BymclbsW.js → Logs-BQrm2cq-.js} +1 -1
  12. package/dist/renderer/assets/{Modal-Dn_4NhR5.js → Modal-DfZsUS3Q.js} +3 -3
  13. package/dist/renderer/assets/{MonitorList-B1rSH7zN.js → MonitorList-CDWGIf1Q.js} +1 -1
  14. package/dist/renderer/assets/{Page-6cEj45pt.js → Page-CpmZ134Z.js} +1 -1
  15. package/dist/renderer/assets/ProjectDetail-B-Kwqodz.js +11 -0
  16. package/dist/renderer/assets/{ProjectList-CZbAGDMS.js → ProjectList-DtNT6dv-.js} +1 -1
  17. package/dist/renderer/assets/{Select-DE1pzt5p.js → Select--_s_a1uj.js} +1 -1
  18. package/dist/renderer/assets/{SessionChat-DyBDEXW9.js → SessionChat-BHfKpufe.js} +1 -1
  19. package/dist/renderer/assets/{SessionList-C8sTJnX6.js → SessionList-B0kQz-Ms.js} +1 -1
  20. package/dist/renderer/assets/{ThreadChat-CpAia9qR.js → ThreadChat-CRb6Z42k.js} +1 -1
  21. package/dist/renderer/assets/{Workspace-CKpVbGne.js → Workspace-j-O-14yC.js} +2 -2
  22. package/dist/renderer/assets/{arrow-left-455KUtQh.js → arrow-left-DnhnG-Tj.js} +1 -1
  23. package/dist/renderer/assets/{book-open-C_s_nHj6.js → book-open-Dgp3xcUz.js} +1 -1
  24. package/dist/renderer/assets/{bot-D0cidv6D.js → bot-BollztzX.js} +1 -1
  25. package/dist/renderer/assets/{check-DS7qvqek.js → check-BHj-iSsR.js} +1 -1
  26. package/dist/renderer/assets/{chevron-down-C43oRpZM.js → chevron-down-CeXCREMg.js} +1 -1
  27. package/dist/renderer/assets/{circle-aYyg1o0e.js → circle-B3eGQ-H3.js} +1 -1
  28. package/dist/renderer/assets/desktop-B5cYIqJH.js +1 -0
  29. package/dist/renderer/assets/{funnel-COrEnKiW.js → funnel-BkgiQrZC.js} +1 -1
  30. package/dist/renderer/assets/{heart-BO4CV3kx.js → heart-C-H_BPOT.js} +1 -1
  31. package/dist/renderer/assets/{index-CbvYBkud.js → index-C97cND_H.js} +2 -2
  32. package/dist/renderer/assets/{index-C4ZGOKQv.js → index-CYaol0bB.js} +9 -9
  33. package/dist/renderer/assets/{pencil-DR14wZjZ.js → pencil-DBHjVmSd.js} +1 -1
  34. package/dist/renderer/assets/{play-CRTtErO_.js → play-Cu9TIeSO.js} +1 -1
  35. package/dist/renderer/assets/{plus-Bswb_LiK.js → plus-PaUGBkMK.js} +1 -1
  36. package/dist/renderer/assets/projects-BmW4zbEE.js +1 -0
  37. package/dist/renderer/assets/{save-CKgtUije.js → save-dm5NifZE.js} +1 -1
  38. package/dist/renderer/assets/{search-RCAjElg9.js → search-Cq8cwrp6.js} +1 -1
  39. package/dist/renderer/assets/{server-DlKngwyt.js → server-DwiMsKFq.js} +1 -1
  40. package/dist/renderer/assets/{session-utils-CZHYpZpR.js → session-utils-CD2tqK35.js} +1 -1
  41. package/dist/renderer/assets/{sessions-ChGwwlqi.js → sessions-quZ-oFVW.js} +1 -1
  42. package/dist/renderer/assets/{shield-check-BRY90_8q.js → shield-check-B9UsjycW.js} +1 -1
  43. package/dist/renderer/assets/{trash-2-CwTS-NZu.js → trash-2-CitZGPQS.js} +1 -1
  44. package/dist/renderer/assets/{user-mhOSrZ1d.js → user-BgVotGiF.js} +1 -1
  45. package/dist/renderer/assets/{wifi-off-5-ojceU3.js → wifi-off-CMgxdgfX.js} +1 -1
  46. package/dist/renderer/index.html +1 -1
  47. package/dist-electron/packages/core-sdk/src/index.js +6 -10
  48. package/dist-electron/services/local-ai-core/src/acp/store/local-core-acp-store.js +29 -0
  49. package/dist-electron/services/local-ai-core/src/acp/store/runtime-config-store.js +164 -0
  50. package/dist-electron/services/local-ai-core/src/acp/store/schema.js +8 -0
  51. package/dist-electron/services/local-ai-core/src/agents/shared/launch-utils.js +1 -2
  52. package/dist-electron/services/local-ai-core/src/kernel/bootstrap.js +2 -2
  53. package/dist-electron/services/local-ai-core/src/router/workspace-route-config.js +1 -1
  54. package/dist-electron/services/local-ai-core/src/router/workspace-router.js +8 -7
  55. package/dist-electron/services/local-ai-core/src/runtime/external-service.js +6 -9
  56. package/dist-electron/services/local-ai-core/src/runtime/handlers/runtime-handler.js +4 -8
  57. package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +32 -35
  58. package/dist-electron/services/local-ai-core/src/runtime/local-core-runtime-state.js +0 -89
  59. package/dist-electron/services/local-ai-core/src/runtime/server-routes.js +4 -7
  60. package/dist-electron/services/local-ai-core/src/sandbox/sandbox-config.js +4 -4
  61. package/dist-electron/services/local-ai-core/src/scheduler/channel-execution-policy.js +11 -2
  62. package/dist-electron/tests/electron/plugin-kernel.test.js +72 -34
  63. package/dist-electron/tests/electron/runtime-config-store.test.js +176 -0
  64. package/dist-electron/tests/electron/sandbox-config.test.js +5 -5
  65. package/dist-electron/tests/electron/workspace-task-store.test.js +5 -5
  66. package/dist-electron/tests/integration/local-core-refactor.test.js +79 -0
  67. package/package.json +1 -1
  68. package/dist/renderer/assets/Config-DQAgYmCU.js +0 -21
  69. package/dist/renderer/assets/ProjectDetail-BcoxhPqE.js +0 -11
  70. package/dist/renderer/assets/desktop-CqHMtdOi.js +0 -1
  71. package/dist/renderer/assets/projects-BSilkED5.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-C4ZGOKQv.js";/**
1
+ import{c as a}from"./index-CYaol0bB.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-C4ZGOKQv.js";/**
1
+ import{c as o}from"./index-CYaol0bB.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-C4ZGOKQv.js";/**
1
+ import{c as e}from"./index-CYaol0bB.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ import{D as t}from"./index-CYaol0bB.js";const e=()=>t.get("/projects"),r=o=>t.get(`/projects/${o}`);export{r as g,e as l};
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-C4ZGOKQv.js";/**
1
+ import{c as a}from"./index-CYaol0bB.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-C4ZGOKQv.js";/**
1
+ import{c}from"./index-CYaol0bB.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-C4ZGOKQv.js";/**
1
+ import{c as e}from"./index-CYaol0bB.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-C4ZGOKQv.js";/**
1
+ import{c as o}from"./index-CYaol0bB.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{D as o}from"./index-C4ZGOKQv.js";const i=s=>o.get(`/projects/${s}/sessions`),c=(s,e,t)=>o.get(`/projects/${s}/sessions/${e}`,{history_limit:String(t)}),r=(s,e,t)=>o.patch(`/projects/${s}/sessions/${e}`,t),a=(s,e)=>o.delete(`/projects/${s}/sessions/${e}`),p=(s,e)=>o.post(`/projects/${s}/sessions/switch`,e),$=(s,e)=>o.post(`/projects/${s}/send`,e);export{$ as a,a as d,c as g,i as l,r,p as s};
1
+ import{D as o}from"./index-CYaol0bB.js";const i=s=>o.get(`/projects/${s}/sessions`),c=(s,e,t)=>o.get(`/projects/${s}/sessions/${e}`,{history_limit:String(t)}),r=(s,e,t)=>o.patch(`/projects/${s}/sessions/${e}`,t),a=(s,e)=>o.delete(`/projects/${s}/sessions/${e}`),p=(s,e)=>o.post(`/projects/${s}/sessions/switch`,e),$=(s,e)=>o.post(`/projects/${s}/send`,e);export{$ as a,a as d,c as g,i as l,r,p as s};
@@ -1,4 +1,4 @@
1
- import{c}from"./index-C4ZGOKQv.js";/**
1
+ import{c}from"./index-CYaol0bB.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-C4ZGOKQv.js";/**
1
+ import{c as e}from"./index-CYaol0bB.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-C4ZGOKQv.js";/**
1
+ import{c}from"./index-CYaol0bB.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-C4ZGOKQv.js";/**
1
+ import{c as a}from"./index-CYaol0bB.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="./favicon.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>AgentDock</title>
8
- <script type="module" crossorigin src="./assets/index-C4ZGOKQv.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-CYaol0bB.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="./assets/index-CjCuR6DI.css">
10
10
  </head>
11
11
  <body class="bg-[#f5f5f7] dark:bg-[#151516]">
@@ -16,9 +16,8 @@ exports.refreshRuntimeDetection = refreshRuntimeDetection;
16
16
  exports.listDiagnosticErrors = listDiagnosticErrors;
17
17
  exports.runDiagnosticsDoctor = runDiagnosticsDoctor;
18
18
  exports.runDeploymentDiagnostics = runDeploymentDiagnostics;
19
- exports.readCoreConfigFile = readCoreConfigFile;
20
- exports.saveCoreRawConfigFile = saveCoreRawConfigFile;
21
- exports.saveCoreStructuredConfigFile = saveCoreStructuredConfigFile;
19
+ exports.readCoreRuntimeConfig = readCoreRuntimeConfig;
20
+ exports.saveCoreRuntimeConfig = saveCoreRuntimeConfig;
22
21
  exports.saveCoreSettings = saveCoreSettings;
23
22
  exports.listModelProviders = listModelProviders;
24
23
  exports.createModelProvider = createModelProvider;
@@ -252,14 +251,11 @@ async function runDiagnosticsDoctor() {
252
251
  async function runDeploymentDiagnostics() {
253
252
  return coreRequest('POST', '/diagnostics/deployment');
254
253
  }
255
- async function readCoreConfigFile() {
256
- return coreRequest('GET', '/runtime/config');
254
+ async function readCoreRuntimeConfig() {
255
+ return coreRequest('GET', '/runtime/runtime-config');
257
256
  }
258
- async function saveCoreRawConfigFile(raw) {
259
- return coreRequest('POST', '/runtime/config/raw', { raw });
260
- }
261
- async function saveCoreStructuredConfigFile(config) {
262
- return coreRequest('POST', '/runtime/config/structured', { config });
257
+ async function saveCoreRuntimeConfig(config) {
258
+ return coreRequest('POST', '/runtime/runtime-config', { config });
263
259
  }
264
260
  async function saveCoreSettings(input) {
265
261
  return coreRequest('POST', '/runtime/settings', input);
@@ -15,6 +15,7 @@ const thread_store_js_1 = require("./thread-store.js");
15
15
  const workspace_registry_store_js_1 = require("./workspace-registry-store.js");
16
16
  const model_provider_store_js_1 = require("./model-provider-store.js");
17
17
  const external_store_js_1 = require("./external-store.js");
18
+ const runtime_config_store_js_1 = require("./runtime-config-store.js");
18
19
  class LocalCoreAcpStore {
19
20
  db;
20
21
  threads;
@@ -26,8 +27,10 @@ class LocalCoreAcpStore {
26
27
  platform;
27
28
  modelProviders;
28
29
  external;
30
+ runtimeConfig;
29
31
  constructor(userDataPath) {
30
32
  const dbPath = (0, node_path_1.join)(userDataPath, 'runtime', 'local-core.db');
33
+ const runtimeDir = (0, node_path_1.dirname)(dbPath);
31
34
  (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(dbPath), { recursive: true });
32
35
  this.db = new node_sqlite_1.DatabaseSync(dbPath);
33
36
  this.threads = new thread_store_js_1.LocalThreadStore(this.db);
@@ -44,6 +47,7 @@ class LocalCoreAcpStore {
44
47
  this.modelProviders = new model_provider_store_js_1.LocalModelProviderStore(this.db);
45
48
  this.external = new external_store_js_1.LocalExternalStore(this.db);
46
49
  (0, schema_js_1.ensureLocalCoreAcpSchema)(this.db);
50
+ this.runtimeConfig = new runtime_config_store_js_1.LocalRuntimeConfigStore(this.db, dbPath, runtimeDir, resolveLegacyConfigPaths(runtimeDir));
47
51
  }
48
52
  close() {
49
53
  this.db.close();
@@ -113,6 +117,12 @@ class LocalCoreAcpStore {
113
117
  deleteModelProvider(providerId) {
114
118
  return this.modelProviders.delete(providerId);
115
119
  }
120
+ readRuntimeConfig() {
121
+ return this.runtimeConfig.read();
122
+ }
123
+ saveRuntimeConfig(config) {
124
+ return this.runtimeConfig.save(config);
125
+ }
116
126
  getExternalProject(userId, externalProjectId) {
117
127
  return this.external.getProject(userId, externalProjectId);
118
128
  }
@@ -295,5 +305,24 @@ class LocalCoreAcpStore {
295
305
  }
296
306
  }
297
307
  exports.LocalCoreAcpStore = LocalCoreAcpStore;
308
+ function resolveLegacyConfigPaths(runtimeDir) {
309
+ const defaultPath = (0, node_path_1.join)(runtimeDir, 'config.toml');
310
+ const settingsPath = (0, node_path_1.join)(runtimeDir, 'local-core-settings.json');
311
+ const paths = [];
312
+ if ((0, node_fs_1.existsSync)(settingsPath)) {
313
+ try {
314
+ const settings = JSON.parse((0, node_fs_1.readFileSync)(settingsPath, 'utf8'));
315
+ const configuredPath = String(settings.configPath || '').trim();
316
+ if (configuredPath) {
317
+ paths.push((0, node_path_1.isAbsolute)(configuredPath) ? configuredPath : (0, node_path_1.resolve)(runtimeDir, configuredPath));
318
+ }
319
+ }
320
+ catch {
321
+ // Ignore malformed legacy settings and fall back to the default legacy path.
322
+ }
323
+ }
324
+ paths.push(defaultPath);
325
+ return [...new Set(paths)];
326
+ }
298
327
  var utils_js_1 = require("./utils.js");
299
328
  Object.defineProperty(exports, "redactSecrets", { enumerable: true, get: function () { return utils_js_1.redactSecrets; } });
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.LocalRuntimeConfigStore = void 0;
37
+ const node_fs_1 = require("node:fs");
38
+ const TOML = __importStar(require("@iarna/toml"));
39
+ const config_migration_js_1 = require("../../runtime/config-migration.js");
40
+ const utils_js_1 = require("./utils.js");
41
+ const RUNTIME_CONFIG_ID = 'desktop';
42
+ class LocalRuntimeConfigStore {
43
+ db;
44
+ databasePath;
45
+ baseDir;
46
+ legacyConfigPaths;
47
+ constructor(db, databasePath, baseDir, legacyConfigPaths) {
48
+ this.db = db;
49
+ this.databasePath = databasePath;
50
+ this.baseDir = baseDir;
51
+ this.legacyConfigPaths = legacyConfigPaths;
52
+ }
53
+ read() {
54
+ const row = this.getRow();
55
+ if (row) {
56
+ const config = (0, utils_js_1.parseJson)(row.config_json, {});
57
+ const migrated = (0, config_migration_js_1.migrateDesktopConnectConfig)(config);
58
+ if (migrated.changed) {
59
+ return this.save(migrated.config, {
60
+ migratedFromPath: row.migrated_from_path || undefined,
61
+ warnings: migrated.warnings,
62
+ });
63
+ }
64
+ return this.toState(row, config, migrated.warnings);
65
+ }
66
+ const legacy = this.readLegacyConfig();
67
+ if (legacy) {
68
+ if ('error' in legacy) {
69
+ return this.errorState(legacy.path, legacy.error);
70
+ }
71
+ return this.save(legacy.config, {
72
+ migratedFromPath: legacy.path,
73
+ warnings: legacy.warnings,
74
+ });
75
+ }
76
+ return this.save({ projects: [] });
77
+ }
78
+ save(config, options = {}) {
79
+ const migrated = (0, config_migration_js_1.migrateDesktopConnectConfig)(config);
80
+ const row = this.getRow();
81
+ const now = new Date().toISOString();
82
+ const migratedFromPath = options.migratedFromPath ?? row?.migrated_from_path ?? null;
83
+ if (row) {
84
+ this.db.prepare(`
85
+ UPDATE runtime_config
86
+ SET config_json = ?, base_dir = ?, migrated_from_path = ?, updated_at = ?
87
+ WHERE id = ?
88
+ `).run(JSON.stringify(migrated.config), this.baseDir, migratedFromPath, now, RUNTIME_CONFIG_ID);
89
+ }
90
+ else {
91
+ this.db.prepare(`
92
+ INSERT INTO runtime_config (id, config_json, base_dir, migrated_from_path, created_at, updated_at)
93
+ VALUES (?, ?, ?, ?, ?, ?)
94
+ `).run(RUNTIME_CONFIG_ID, JSON.stringify(migrated.config), this.baseDir, migratedFromPath, now, now);
95
+ }
96
+ return {
97
+ storage: 'sqlite',
98
+ databasePath: this.databasePath,
99
+ baseDir: this.baseDir,
100
+ config: migrated.config,
101
+ ...(migratedFromPath ? { migratedFromPath } : {}),
102
+ updatedAt: now,
103
+ warnings: [
104
+ ...(options.warnings || []),
105
+ ...migrated.warnings,
106
+ ].filter(Boolean),
107
+ };
108
+ }
109
+ getRow() {
110
+ return this.db.prepare(`
111
+ SELECT config_json, base_dir, migrated_from_path, updated_at
112
+ FROM runtime_config
113
+ WHERE id = ?
114
+ `).get(RUNTIME_CONFIG_ID);
115
+ }
116
+ toState(row, config, warnings) {
117
+ return {
118
+ storage: 'sqlite',
119
+ databasePath: this.databasePath,
120
+ baseDir: row.base_dir || this.baseDir,
121
+ config,
122
+ ...(row.migrated_from_path ? { migratedFromPath: row.migrated_from_path } : {}),
123
+ updatedAt: row.updated_at,
124
+ ...(warnings.length > 0 ? { warnings } : {}),
125
+ };
126
+ }
127
+ errorState(path, error) {
128
+ const migrated = (0, config_migration_js_1.migrateDesktopConnectConfig)({ projects: [] });
129
+ return {
130
+ storage: 'sqlite',
131
+ databasePath: this.databasePath,
132
+ baseDir: this.baseDir,
133
+ config: migrated.config,
134
+ migratedFromPath: path,
135
+ error,
136
+ warnings: [`Failed to import legacy runtime config "${path}": ${error}`],
137
+ };
138
+ }
139
+ readLegacyConfig() {
140
+ for (const legacyConfigPath of this.legacyConfigPaths) {
141
+ if (!(0, node_fs_1.existsSync)(legacyConfigPath)) {
142
+ continue;
143
+ }
144
+ try {
145
+ const raw = (0, node_fs_1.readFileSync)(legacyConfigPath, 'utf8');
146
+ const parsed = TOML.parse(raw);
147
+ const migrated = (0, config_migration_js_1.migrateDesktopConnectConfig)(parsed);
148
+ return {
149
+ path: legacyConfigPath,
150
+ config: migrated.config,
151
+ warnings: migrated.warnings,
152
+ };
153
+ }
154
+ catch (error) {
155
+ return {
156
+ path: legacyConfigPath,
157
+ error: error instanceof Error ? error.message : String(error),
158
+ };
159
+ }
160
+ }
161
+ return null;
162
+ }
163
+ }
164
+ exports.LocalRuntimeConfigStore = LocalRuntimeConfigStore;
@@ -297,6 +297,14 @@ function ensureLocalCoreAcpSchema(db) {
297
297
  CREATE INDEX IF NOT EXISTS idx_audit_events_workspace_created ON audit_events (workspace_id, created_at DESC);
298
298
  CREATE INDEX IF NOT EXISTS idx_audit_events_task_created ON audit_events (task_id, created_at DESC);
299
299
  CREATE INDEX IF NOT EXISTS idx_audit_events_type_created ON audit_events (type, created_at DESC);
300
+ CREATE TABLE IF NOT EXISTS runtime_config (
301
+ id TEXT PRIMARY KEY,
302
+ config_json TEXT NOT NULL,
303
+ base_dir TEXT NOT NULL,
304
+ migrated_from_path TEXT,
305
+ created_at TEXT NOT NULL,
306
+ updated_at TEXT NOT NULL
307
+ );
300
308
  `);
301
309
  ensureColumn(db, 'messages', 'tool_call_json', 'TEXT');
302
310
  ensureColumn(db, 'messages', 'bridge_kind', 'TEXT');
@@ -72,12 +72,11 @@ function writeJsonFile(path, value, mode = 0o600) {
72
72
  (0, node_fs_1.chmodSync)(path, mode);
73
73
  }
74
74
  function projectLocalStateDir(configState, folderName, projectName) {
75
- const configDir = (0, node_path_1.dirname)(configState.path);
76
75
  const safeProjectName = String(projectName || 'workspace')
77
76
  .trim()
78
77
  .replace(/[^a-zA-Z0-9._-]+/g, '-')
79
78
  .replace(/^-+|-+$/g, '') || 'workspace';
80
- return (0, node_path_1.resolve)(configDir, folderName, safeProjectName);
79
+ return (0, node_path_1.resolve)(configState.baseDir, folderName, safeProjectName);
81
80
  }
82
81
  function resolveBundledAcpCommand(packageName, binName) {
83
82
  const require = (0, node_module_1.createRequire)(__filename);
@@ -175,7 +175,7 @@ function bootstrapLocalCoreRuntime(options) {
175
175
  let weixinChannelRuntime;
176
176
  const channelPlugins = (0, catalog_js_1.createRuntimeChannelPlugins)({
177
177
  store,
178
- readConfig: async () => (await state.readConfigFile()).parsed,
178
+ readConfig: async () => (await store.readRuntimeConfig()).config,
179
179
  getWorkspaceRouter: () => workspaceRouter,
180
180
  log: options.log,
181
181
  });
@@ -240,7 +240,7 @@ function bootstrapLocalCoreRuntime(options) {
240
240
  store,
241
241
  cliBinDir: state.cliBinDir,
242
242
  localCoreBase: options.localCoreBase,
243
- readConfigState: () => state.readConfigFile(),
243
+ readRuntimeConfig: async () => store.readRuntimeConfig(),
244
244
  getCapabilities: () => kernel.getCapabilitySnapshot(),
245
245
  getAgentRuntimes: () => agentRuntimes,
246
246
  eventBus: kernel.context.bus,
@@ -32,7 +32,7 @@ function resolveAgentModel(project, providers, definition) {
32
32
  }
33
33
  function toLocalCoreProjectConfig(configState, project) {
34
34
  const rawWorkDir = String(project.agent?.options?.work_dir || '.').trim() || '.';
35
- const configDir = (0, node_path_1.dirname)(configState.path);
35
+ const configDir = configState.baseDir;
36
36
  const workDir = (0, node_path_1.isAbsolute)(rawWorkDir) ? rawWorkDir : (0, node_path_1.resolve)(configDir, rawWorkDir);
37
37
  const rawArgs = project.agent?.options?.args;
38
38
  const args = Array.isArray(rawArgs)
@@ -68,8 +68,9 @@ class WorkspaceRouter {
68
68
  async listWorkspaces() {
69
69
  const localProjects = await this.listLocalCoreProjects();
70
70
  const workspaceMap = new Map();
71
+ const configState = await this.options.readRuntimeConfig();
71
72
  for (const project of localProjects) {
72
- const route = this.resolveProjectRoute(await this.options.readConfigState(), project);
73
+ const route = this.resolveProjectRoute(configState, project);
73
74
  if (!route) {
74
75
  continue;
75
76
  }
@@ -463,8 +464,8 @@ class WorkspaceRouter {
463
464
  : route;
464
465
  }
465
466
  async getWorkspaceRoute(workspaceId, agentTypeOverride = '') {
466
- const configState = await this.options.readConfigState();
467
- const projects = Array.isArray(configState.parsed?.projects) ? configState.parsed.projects : [];
467
+ const configState = await this.options.readRuntimeConfig();
468
+ const projects = Array.isArray(configState.config?.projects) ? configState.config.projects : [];
468
469
  const matched = projects.find((project) => String(project?.name || '').trim() === workspaceId);
469
470
  const project = matched && agentTypeOverride ? withAgentTypeOverride(matched, agentTypeOverride) : matched;
470
471
  const route = project ? this.resolveProjectRoute(configState, project) : null;
@@ -474,13 +475,13 @@ class WorkspaceRouter {
474
475
  return route;
475
476
  }
476
477
  async listLocalCoreProjects() {
477
- const configState = await this.options.readConfigState();
478
- const projects = Array.isArray(configState.parsed?.projects) ? configState.parsed.projects : [];
478
+ const configState = await this.options.readRuntimeConfig();
479
+ const projects = Array.isArray(configState.config?.projects) ? configState.config.projects : [];
479
480
  return projects.filter((project) => this.resolveProjectRoute(configState, project));
480
481
  }
481
482
  async syncConfiguredWorkspaces() {
482
- const config = await this.options.readConfigState();
483
- const projects = Array.isArray(config.parsed?.projects) ? config.parsed.projects : [];
483
+ const config = await this.options.readRuntimeConfig();
484
+ const projects = Array.isArray(config.config?.projects) ? config.config.projects : [];
484
485
  for (const project of projects) {
485
486
  const route = this.resolveProjectRoute(config, project);
486
487
  if (!route) {
@@ -107,8 +107,8 @@ class ExternalService {
107
107
  async ensureWorkspaceConfig(project, model) {
108
108
  const current = await this.readAndMigrateConfigFile();
109
109
  const config = {
110
- ...(current.parsed || {}),
111
- projects: Array.isArray(current.parsed?.projects) ? [...current.parsed.projects] : [],
110
+ ...(current.config || {}),
111
+ projects: Array.isArray(current.config?.projects) ? [...current.config.projects] : [],
112
112
  };
113
113
  const existingIndex = config.projects.findIndex((item) => item?.name === project.workspaceId);
114
114
  const existing = existingIndex >= 0 ? config.projects[existingIndex] : undefined;
@@ -146,7 +146,7 @@ class ExternalService {
146
146
  else {
147
147
  config.projects.push(nextProject);
148
148
  }
149
- await this.deps.saveStructuredConfig(config);
149
+ await this.deps.saveRuntimeConfig(config);
150
150
  }
151
151
  async ensureThread(project, input) {
152
152
  const externalThreadId = normalizeExternalId(input.external_thread_id || `thread-${(0, node_crypto_1.randomUUID)()}`, 'external_thread_id');
@@ -175,15 +175,12 @@ class ExternalService {
175
175
  });
176
176
  }
177
177
  async readAndMigrateConfigFile() {
178
- const current = await this.deps.readConfigState();
179
- if (!current.parsed) {
180
- return current;
181
- }
182
- const migrated = (0, provider_config_migration_js_1.migrateLegacyProjectProvidersToStore)(current.parsed, this.store);
178
+ const current = await this.deps.readRuntimeConfig();
179
+ const migrated = (0, provider_config_migration_js_1.migrateLegacyProjectProvidersToStore)(current.config, this.store);
183
180
  if (!migrated.changed) {
184
181
  return current;
185
182
  }
186
- const saved = await this.deps.saveStructuredConfig(migrated.config);
183
+ const saved = await this.deps.saveRuntimeConfig(migrated.config);
187
184
  return {
188
185
  ...saved,
189
186
  warnings: [
@@ -38,16 +38,12 @@ function registerRuntimeHandlers(map, controller, errorReporter, attachSseClient
38
38
  map.set('diagnostics.errors', async (_route, _req, res) => {
39
39
  (0, server_helpers_js_1.json)(res, 200, { errors: await errorReporter.list() });
40
40
  });
41
- map.set('runtime.config.read', async (_route, _req, res) => {
42
- (0, server_helpers_js_1.json)(res, 200, await controller.readConfigFile());
41
+ map.set('runtime.runtime-config.read', async (_route, _req, res) => {
42
+ (0, server_helpers_js_1.json)(res, 200, await controller.readRuntimeConfig());
43
43
  });
44
- map.set('runtime.config.save-raw', async (_route, req, res) => {
44
+ map.set('runtime.runtime-config.save', async (_route, req, res) => {
45
45
  const body = await (0, server_helpers_js_1.readJsonBody)(req);
46
- (0, server_helpers_js_1.json)(res, 200, await controller.saveRawConfigFile(String(body.raw || '')));
47
- });
48
- map.set('runtime.config.save-structured', async (_route, req, res) => {
49
- const body = await (0, server_helpers_js_1.readJsonBody)(req);
50
- (0, server_helpers_js_1.json)(res, 200, await controller.saveStructuredConfigFile((body.config || {})));
46
+ (0, server_helpers_js_1.json)(res, 200, await controller.saveRuntimeConfig((body.config || {})));
51
47
  });
52
48
  map.set('runtime.settings.save', async (_route, req, res) => {
53
49
  const body = await (0, server_helpers_js_1.readJsonBody)(req);