downcity 1.1.259 → 1.1.265
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/bin/city/process/registry/CityPaths.d.ts +10 -10
- package/bin/city/process/registry/CityPaths.d.ts.map +1 -1
- package/bin/city/process/registry/CityPaths.js +12 -12
- package/bin/city/process/registry/CityPaths.js.map +1 -1
- package/bin/city/process/registry/CityRegistry.d.ts +18 -19
- package/bin/city/process/registry/CityRegistry.d.ts.map +1 -1
- package/bin/city/process/registry/CityRegistry.js +179 -141
- package/bin/city/process/registry/CityRegistry.js.map +1 -1
- package/bin/city/runtime/store/index.d.ts +8 -0
- package/bin/city/runtime/store/index.d.ts.map +1 -1
- package/bin/city/runtime/store/index.js +13 -1
- package/bin/city/runtime/store/index.js.map +1 -1
- package/bin/city/shared/CityAgentRuntime.d.ts +3 -1
- package/bin/city/shared/CityAgentRuntime.d.ts.map +1 -1
- package/bin/city/shared/CityAgentRuntime.js +3 -7
- package/bin/city/shared/CityAgentRuntime.js.map +1 -1
- package/bin/city/shared/CityBalance.d.ts +3 -3
- package/bin/city/shared/CityBalance.d.ts.map +1 -1
- package/bin/city/shared/CityBalance.js +15 -11
- package/bin/city/shared/CityBalance.js.map +1 -1
- package/bin/city/shared/CityStateStore.d.ts.map +1 -1
- package/bin/city/shared/CityStateStore.js +20 -5
- package/bin/city/shared/CityStateStore.js.map +1 -1
- package/bin/city/shared/PluginTargetSupport.d.ts +0 -3
- package/bin/city/shared/PluginTargetSupport.d.ts.map +1 -1
- package/bin/city/shared/PluginTargetSupport.js +1 -6
- package/bin/city/shared/PluginTargetSupport.js.map +1 -1
- package/bin/city/tui/FederationManagerFormat.d.ts.map +1 -1
- package/bin/city/tui/FederationManagerFormat.js +7 -4
- package/bin/city/tui/FederationManagerFormat.js.map +1 -1
- package/bin/city/tui/FederationManagerPrompts.d.ts +1 -1
- package/bin/city/tui/FederationManagerPrompts.d.ts.map +1 -1
- package/bin/city/tui/FederationManagerPrompts.js +5 -5
- package/bin/city/tui/FederationManagerPrompts.js.map +1 -1
- package/bin/city/tui/FederationManagerState.js +3 -3
- package/bin/city/tui/FederationManagerState.js.map +1 -1
- package/bin/city/types/CityBalance.d.ts +20 -8
- package/bin/city/types/CityBalance.d.ts.map +1 -1
- package/bin/city/types/CityBalance.js +2 -2
- package/bin/city/types/CityState.d.ts +4 -0
- package/bin/city/types/CityState.d.ts.map +1 -1
- package/bin/federation/admin/commands/balance.js +26 -26
- package/bin/federation/admin/commands/balance.js.map +1 -1
- package/bin/federation/admin/commands/payment.js +3 -3
- package/bin/federation/admin/commands/payment.js.map +1 -1
- package/bin/federation/core/session.d.ts +5 -5
- package/bin/federation/core/session.d.ts.map +1 -1
- package/bin/federation/core/session.js +37 -14
- package/bin/federation/core/session.js.map +1 -1
- package/bin/federation/create/commands/create.js +15 -6
- package/bin/federation/create/commands/create.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CityPaths
|
|
2
|
+
* CityPaths:用户级平台路径规则。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - Downcity
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
5
|
+
* - Downcity 的用户级根目录固定在 `~/.downcity/`,测试可用 `DC_PLATFORM_ROOT` 覆盖。
|
|
6
|
+
* - `downcity.db` 保存 City 本地加密状态。
|
|
7
|
+
* - `federation.db` 保存 downfed / Federation 管理端加密状态。
|
|
8
|
+
* - Agent 项目列表等全局索引进入数据库,不再写 `main/agents.json`。
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
11
11
|
* 全局根目录(用户级)。
|
|
@@ -19,7 +19,11 @@ export declare function getPlatformRootDirPath(): string;
|
|
|
19
19
|
*/
|
|
20
20
|
export declare function getPlatformStoreDbPath(): string;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Federation 管理端 SQLite 数据库路径(用户级)。
|
|
23
|
+
*/
|
|
24
|
+
export declare function getFederationStoreDbPath(): string;
|
|
25
|
+
/**
|
|
26
|
+
* City 全局运行目录(平台密钥 / 旧运行态文件)。
|
|
23
27
|
*/
|
|
24
28
|
export declare function getCityRuntimeDirPath(): string;
|
|
25
29
|
/**
|
|
@@ -46,8 +50,4 @@ export declare function getGatewayPidPath(): string;
|
|
|
46
50
|
* 关键点(中文):仅保留路径约定,便于后续迁移或清理旧安装状态文件。
|
|
47
51
|
*/
|
|
48
52
|
export declare function getGatewayMetaPath(): string;
|
|
49
|
-
/**
|
|
50
|
-
* 受管 agent registry 文件路径(City 维护的 agent 清单)。
|
|
51
|
-
*/
|
|
52
|
-
export declare function getManagedAgentRegistryPath(): string;
|
|
53
53
|
//# sourceMappingURL=CityPaths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CityPaths.d.ts","sourceRoot":"","sources":["../../../../src/city/process/registry/CityPaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAI/C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C
|
|
1
|
+
{"version":3,"file":"CityPaths.d.ts","sourceRoot":"","sources":["../../../../src/city/process/registry/CityPaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAI/C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CityPaths
|
|
2
|
+
* CityPaths:用户级平台路径规则。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - Downcity
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
5
|
+
* - Downcity 的用户级根目录固定在 `~/.downcity/`,测试可用 `DC_PLATFORM_ROOT` 覆盖。
|
|
6
|
+
* - `downcity.db` 保存 City 本地加密状态。
|
|
7
|
+
* - `federation.db` 保存 downfed / Federation 管理端加密状态。
|
|
8
|
+
* - Agent 项目列表等全局索引进入数据库,不再写 `main/agents.json`。
|
|
9
9
|
*/
|
|
10
10
|
import os from "node:os";
|
|
11
11
|
import path from "node:path";
|
|
@@ -28,7 +28,13 @@ export function getPlatformStoreDbPath() {
|
|
|
28
28
|
return path.join(getPlatformRootDirPath(), "downcity.db");
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Federation 管理端 SQLite 数据库路径(用户级)。
|
|
32
|
+
*/
|
|
33
|
+
export function getFederationStoreDbPath() {
|
|
34
|
+
return path.join(getPlatformRootDirPath(), "federation.db");
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* City 全局运行目录(平台密钥 / 旧运行态文件)。
|
|
32
38
|
*/
|
|
33
39
|
export function getCityRuntimeDirPath() {
|
|
34
40
|
return path.join(getPlatformRootDirPath(), "main");
|
|
@@ -67,10 +73,4 @@ export function getGatewayPidPath() {
|
|
|
67
73
|
export function getGatewayMetaPath() {
|
|
68
74
|
return path.join(getCityRuntimeDirPath(), "gateway.json");
|
|
69
75
|
}
|
|
70
|
-
/**
|
|
71
|
-
* 受管 agent registry 文件路径(City 维护的 agent 清单)。
|
|
72
|
-
*/
|
|
73
|
-
export function getManagedAgentRegistryPath() {
|
|
74
|
-
return path.join(getCityRuntimeDirPath(), "agents.json");
|
|
75
|
-
}
|
|
76
76
|
//# sourceMappingURL=CityPaths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CityPaths.js","sourceRoot":"","sources":["../../../../src/city/process/registry/CityPaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB;IACpC,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACvE,IAAI,YAAY;QAAE,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACpD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,aAAa,CAAC,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"CityPaths.js","sourceRoot":"","sources":["../../../../src/city/process/registry/CityPaths.ts"],"names":[],"mappings":"AAAA;;;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AAqB,EAAE,EAAE,aAAa,CAAC,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,cAAc,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -1,51 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* CityAgentProjectStore:City 维护的 agent 项目索引。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
5
|
+
* - 全局 agent 列表进入 `downcity.db` 的加密 secure setting,不再写 `agents.json`。
|
|
6
|
+
* - 这里只保存 projectRoot 列表;运行状态统一由项目 daemon pid/meta 推导。
|
|
7
|
+
* - 保留旧导出函数名,降低上层命令改造面积。
|
|
8
8
|
*/
|
|
9
9
|
import type { ManagedAgentRegistryEntry, ManagedAgentRegistryV1 } from "@downcity/agent";
|
|
10
10
|
/**
|
|
11
|
-
* 确保
|
|
12
|
-
*
|
|
13
|
-
* 关键点(中文)
|
|
14
|
-
* - 空 City 运行态也应拥有显式的空 registry,避免管理侧将“尚未启动任何 agent”误判为异常。
|
|
15
|
-
* - 若文件已存在则不覆盖,保持历史记录不丢失。
|
|
11
|
+
* 确保 agent 项目索引已初始化。
|
|
16
12
|
*/
|
|
17
13
|
export declare function ensureManagedAgentRegistry(): Promise<void>;
|
|
18
14
|
/**
|
|
19
|
-
*
|
|
15
|
+
* 获取旧 registry 文件路径。
|
|
16
|
+
*
|
|
17
|
+
* 关键点(中文)
|
|
18
|
+
* - 仅用于诊断或迁移提示;当前版本不会再写这个文件。
|
|
20
19
|
*/
|
|
21
20
|
export declare function getManagedAgentsRegistryPath(): string;
|
|
22
21
|
/**
|
|
23
|
-
* 读取
|
|
24
|
-
*
|
|
25
|
-
* 关键点(中文)
|
|
26
|
-
* - 文件不存在或损坏时返回空 registry,避免影响主流程。
|
|
22
|
+
* 读取 agent 项目索引的兼容视图。
|
|
27
23
|
*/
|
|
28
24
|
export declare function readManagedAgentRegistry(): Promise<ManagedAgentRegistryV1>;
|
|
29
25
|
/**
|
|
30
|
-
* 列出 City
|
|
26
|
+
* 列出 City 已登记 agent。
|
|
31
27
|
*/
|
|
32
28
|
export declare function listManagedAgentEntries(): Promise<ManagedAgentRegistryEntry[]>;
|
|
33
29
|
/**
|
|
34
|
-
*
|
|
30
|
+
* 登记或刷新 agent 项目。
|
|
35
31
|
*/
|
|
36
32
|
export declare function upsertManagedAgentEntry(input: {
|
|
37
33
|
projectRoot: string;
|
|
38
|
-
pid
|
|
34
|
+
pid?: number;
|
|
39
35
|
startedAt?: string;
|
|
40
36
|
status?: "running" | "stopped";
|
|
41
37
|
stoppedAt?: string;
|
|
42
38
|
}): Promise<void>;
|
|
43
39
|
/**
|
|
44
|
-
* 标记 agent
|
|
40
|
+
* 标记 agent 停止。
|
|
41
|
+
*
|
|
42
|
+
* 关键点(中文)
|
|
43
|
+
* - 当前状态只由 daemon pid/meta 推导,所以这里不写 stopped 状态,只保证项目仍在索引中。
|
|
45
44
|
*/
|
|
46
45
|
export declare function markManagedAgentStopped(projectRoot: string): Promise<void>;
|
|
47
46
|
/**
|
|
48
|
-
*
|
|
47
|
+
* 从 agent 项目索引中移除项目。
|
|
49
48
|
*/
|
|
50
49
|
export declare function removeManagedAgentEntry(projectRoot: string): Promise<void>;
|
|
51
50
|
//# sourceMappingURL=CityRegistry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CityRegistry.d.ts","sourceRoot":"","sources":["../../../../src/city/process/registry/CityRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"CityRegistry.d.ts","sourceRoot":"","sources":["../../../../src/city/process/registry/CityRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAwLzF;;GAEG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAEhE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,CAErD;AAED;;GAEG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAWhF;AAED;;GAEG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAGpF;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,KAAK,EAAE;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhB;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhF;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAShF"}
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* CityAgentProjectStore:City 维护的 agent 项目索引。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
5
|
+
* - 全局 agent 列表进入 `downcity.db` 的加密 secure setting,不再写 `agents.json`。
|
|
6
|
+
* - 这里只保存 projectRoot 列表;运行状态统一由项目 daemon pid/meta 推导。
|
|
7
|
+
* - 保留旧导出函数名,降低上层命令改造面积。
|
|
8
8
|
*/
|
|
9
9
|
import fs from "fs-extra";
|
|
10
10
|
import path from "node:path";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
import { createCityPlatformStore } from "../../runtime/store/index.js";
|
|
12
|
+
import { getCityRuntimeDirPath } from "./CityPaths.js";
|
|
13
|
+
import { DAEMON_META_FILENAME, DAEMON_PID_FILENAME, } from "../daemon/Types.js";
|
|
14
|
+
import { getDowncityDebugDirPath } from "../../config/Paths.js";
|
|
15
|
+
const CITY_AGENT_PROJECTS_KEY = "city.agent.projects";
|
|
16
|
+
const LEGACY_MANAGED_AGENTS_FILE = path.join(getCityRuntimeDirPath(), "agents.json");
|
|
17
|
+
function nowIso() {
|
|
18
|
+
return new Date().toISOString();
|
|
19
|
+
}
|
|
20
|
+
function buildEmptyState() {
|
|
15
21
|
return {
|
|
16
22
|
v: 1,
|
|
17
|
-
updatedAt:
|
|
18
|
-
|
|
23
|
+
updatedAt: nowIso(),
|
|
24
|
+
projectRoots: [],
|
|
19
25
|
};
|
|
20
26
|
}
|
|
21
27
|
function normalizeProjectRoot(projectRoot) {
|
|
@@ -24,189 +30,221 @@ function normalizeProjectRoot(projectRoot) {
|
|
|
24
30
|
throw new Error("projectRoot is required");
|
|
25
31
|
return resolved;
|
|
26
32
|
}
|
|
27
|
-
function normalizePid(pid) {
|
|
28
|
-
if (!Number.isFinite(pid) || Number.isNaN(pid) || !Number.isInteger(pid) || pid < 1) {
|
|
29
|
-
throw new Error(`Invalid pid: ${pid}`);
|
|
30
|
-
}
|
|
31
|
-
return pid;
|
|
32
|
-
}
|
|
33
33
|
function normalizeIsoTime(input) {
|
|
34
34
|
const value = String(input || "").trim();
|
|
35
35
|
if (!value)
|
|
36
|
-
return
|
|
36
|
+
return nowIso();
|
|
37
37
|
const ms = Date.parse(value);
|
|
38
38
|
if (!Number.isFinite(ms))
|
|
39
|
-
return
|
|
39
|
+
return nowIso();
|
|
40
40
|
return new Date(ms).toISOString();
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function getDaemonPidPath(projectRoot) {
|
|
43
|
+
return path.join(getDowncityDebugDirPath(projectRoot), DAEMON_PID_FILENAME);
|
|
44
|
+
}
|
|
45
|
+
function getDaemonMetaPath(projectRoot) {
|
|
46
|
+
return path.join(getDowncityDebugDirPath(projectRoot), DAEMON_META_FILENAME);
|
|
47
|
+
}
|
|
48
|
+
async function readDaemonPid(projectRoot) {
|
|
43
49
|
try {
|
|
44
|
-
const
|
|
45
|
-
const pid =
|
|
46
|
-
|
|
47
|
-
const updatedAt = normalizeIsoTime(typeof entry.updatedAt === "string" ? entry.updatedAt : undefined);
|
|
48
|
-
return {
|
|
49
|
-
projectRoot,
|
|
50
|
-
pid,
|
|
51
|
-
startedAt,
|
|
52
|
-
updatedAt,
|
|
53
|
-
status: entry.status === "stopped"
|
|
54
|
-
? "stopped"
|
|
55
|
-
: "running",
|
|
56
|
-
stoppedAt: entry.status === "stopped"
|
|
57
|
-
? normalizeIsoTime(typeof entry.stoppedAt === "string"
|
|
58
|
-
? entry.stoppedAt
|
|
59
|
-
: undefined)
|
|
60
|
-
: undefined,
|
|
61
|
-
};
|
|
50
|
+
const raw = await fs.readFile(getDaemonPidPath(projectRoot), "utf-8");
|
|
51
|
+
const pid = Number.parseInt(String(raw).trim(), 10);
|
|
52
|
+
return Number.isFinite(pid) && pid > 0 ? pid : null;
|
|
62
53
|
}
|
|
63
54
|
catch {
|
|
64
55
|
return null;
|
|
65
56
|
}
|
|
66
57
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
58
|
+
function isProcessAlive(pid) {
|
|
59
|
+
try {
|
|
60
|
+
process.kill(pid, 0);
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async function readDaemonMeta(projectRoot) {
|
|
68
|
+
try {
|
|
69
|
+
const value = await fs.readJson(getDaemonMetaPath(projectRoot));
|
|
70
|
+
const pid = Number(value?.pid);
|
|
71
|
+
if (!Number.isFinite(pid) || pid <= 0)
|
|
72
|
+
return null;
|
|
73
|
+
const startedAt = String(value?.startedAt || "").trim();
|
|
74
|
+
if (!startedAt)
|
|
75
|
+
return null;
|
|
76
|
+
const command = String(value?.command || "").trim();
|
|
77
|
+
const project = String(value?.projectRoot || "").trim();
|
|
78
|
+
if (!command || !project)
|
|
79
|
+
return null;
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return null;
|
|
84
84
|
}
|
|
85
|
+
}
|
|
86
|
+
function normalizeState(value) {
|
|
87
|
+
if (!value || typeof value !== "object")
|
|
88
|
+
return buildEmptyState();
|
|
89
|
+
const projectRoots = Array.isArray(value.projectRoots)
|
|
90
|
+
? value.projectRoots
|
|
91
|
+
.map((item) => {
|
|
92
|
+
try {
|
|
93
|
+
return normalizeProjectRoot(String(item || ""));
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return "";
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
.filter(Boolean)
|
|
100
|
+
: [];
|
|
85
101
|
return {
|
|
86
102
|
v: 1,
|
|
87
|
-
updatedAt: normalizeIsoTime(
|
|
88
|
-
|
|
103
|
+
updatedAt: normalizeIsoTime(value.updatedAt),
|
|
104
|
+
projectRoots: [...new Set(projectRoots)].sort((a, b) => a.localeCompare(b)),
|
|
89
105
|
};
|
|
90
106
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
107
|
+
function readDbState() {
|
|
108
|
+
const store = createCityPlatformStore();
|
|
109
|
+
try {
|
|
110
|
+
return store.getSecureSettingJsonSync(CITY_AGENT_PROJECTS_KEY);
|
|
111
|
+
}
|
|
112
|
+
finally {
|
|
113
|
+
store.close();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function writeDbState(state) {
|
|
117
|
+
const store = createCityPlatformStore();
|
|
118
|
+
try {
|
|
119
|
+
store.setSecureSettingJsonSync(CITY_AGENT_PROJECTS_KEY, normalizeState(state));
|
|
120
|
+
}
|
|
121
|
+
finally {
|
|
122
|
+
store.close();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
async function readLegacyProjectRoots() {
|
|
126
|
+
try {
|
|
127
|
+
if (!(await fs.pathExists(LEGACY_MANAGED_AGENTS_FILE)))
|
|
128
|
+
return [];
|
|
129
|
+
const raw = (await fs.readJson(LEGACY_MANAGED_AGENTS_FILE));
|
|
130
|
+
const agents = Array.isArray(raw.agents) ? raw.agents : [];
|
|
131
|
+
return agents
|
|
132
|
+
.map((entry) => {
|
|
133
|
+
try {
|
|
134
|
+
return normalizeProjectRoot(String(entry?.projectRoot || ""));
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return "";
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
.filter(Boolean);
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async function readProjectState() {
|
|
147
|
+
const stored = readDbState();
|
|
148
|
+
if (stored)
|
|
149
|
+
return normalizeState(stored);
|
|
150
|
+
const legacyProjectRoots = await readLegacyProjectRoots();
|
|
151
|
+
const migrated = normalizeState({
|
|
152
|
+
v: 1,
|
|
153
|
+
updatedAt: nowIso(),
|
|
154
|
+
projectRoots: legacyProjectRoots,
|
|
155
|
+
});
|
|
156
|
+
writeDbState(migrated);
|
|
157
|
+
return migrated;
|
|
158
|
+
}
|
|
159
|
+
async function writeProjectState(state) {
|
|
160
|
+
writeDbState({
|
|
161
|
+
...normalizeState(state),
|
|
162
|
+
updatedAt: nowIso(),
|
|
95
163
|
});
|
|
96
164
|
}
|
|
165
|
+
async function buildEntry(projectRoot) {
|
|
166
|
+
const project_root = normalizeProjectRoot(projectRoot);
|
|
167
|
+
const daemon_pid = await readDaemonPid(project_root);
|
|
168
|
+
const meta = await readDaemonMeta(project_root);
|
|
169
|
+
const running = Boolean(daemon_pid && isProcessAlive(daemon_pid));
|
|
170
|
+
return {
|
|
171
|
+
projectRoot: project_root,
|
|
172
|
+
pid: daemon_pid ?? meta?.pid ?? 0,
|
|
173
|
+
startedAt: normalizeIsoTime(meta?.startedAt),
|
|
174
|
+
updatedAt: normalizeIsoTime(meta?.startedAt),
|
|
175
|
+
status: running ? "running" : "stopped",
|
|
176
|
+
stoppedAt: running ? undefined : nowIso(),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
97
179
|
/**
|
|
98
|
-
* 确保
|
|
99
|
-
*
|
|
100
|
-
* 关键点(中文)
|
|
101
|
-
* - 空 City 运行态也应拥有显式的空 registry,避免管理侧将“尚未启动任何 agent”误判为异常。
|
|
102
|
-
* - 若文件已存在则不覆盖,保持历史记录不丢失。
|
|
180
|
+
* 确保 agent 项目索引已初始化。
|
|
103
181
|
*/
|
|
104
182
|
export async function ensureManagedAgentRegistry() {
|
|
105
|
-
await
|
|
106
|
-
if (await fs.pathExists(MANAGED_AGENTS_FILE)) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
await writeManagedAgentRegistry(buildEmptyRegistry());
|
|
183
|
+
await readProjectState();
|
|
110
184
|
}
|
|
111
185
|
/**
|
|
112
|
-
*
|
|
186
|
+
* 获取旧 registry 文件路径。
|
|
187
|
+
*
|
|
188
|
+
* 关键点(中文)
|
|
189
|
+
* - 仅用于诊断或迁移提示;当前版本不会再写这个文件。
|
|
113
190
|
*/
|
|
114
191
|
export function getManagedAgentsRegistryPath() {
|
|
115
|
-
return
|
|
192
|
+
return LEGACY_MANAGED_AGENTS_FILE;
|
|
116
193
|
}
|
|
117
194
|
/**
|
|
118
|
-
* 读取
|
|
119
|
-
*
|
|
120
|
-
* 关键点(中文)
|
|
121
|
-
* - 文件不存在或损坏时返回空 registry,避免影响主流程。
|
|
195
|
+
* 读取 agent 项目索引的兼容视图。
|
|
122
196
|
*/
|
|
123
197
|
export async function readManagedAgentRegistry() {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const raw = (await fs.readJson(MANAGED_AGENTS_FILE));
|
|
129
|
-
return normalizeRegistry(raw);
|
|
130
|
-
}
|
|
131
|
-
catch {
|
|
132
|
-
return buildEmptyRegistry();
|
|
198
|
+
const state = await readProjectState();
|
|
199
|
+
const agents = [];
|
|
200
|
+
for (const projectRoot of state.projectRoots) {
|
|
201
|
+
agents.push(await buildEntry(projectRoot));
|
|
133
202
|
}
|
|
203
|
+
return {
|
|
204
|
+
v: 1,
|
|
205
|
+
updatedAt: state.updatedAt,
|
|
206
|
+
agents,
|
|
207
|
+
};
|
|
134
208
|
}
|
|
135
209
|
/**
|
|
136
|
-
* 列出 City
|
|
210
|
+
* 列出 City 已登记 agent。
|
|
137
211
|
*/
|
|
138
212
|
export async function listManagedAgentEntries() {
|
|
139
213
|
const registry = await readManagedAgentRegistry();
|
|
140
|
-
return
|
|
214
|
+
return registry.agents.sort((a, b) => a.projectRoot.localeCompare(b.projectRoot));
|
|
141
215
|
}
|
|
142
216
|
/**
|
|
143
|
-
*
|
|
217
|
+
* 登记或刷新 agent 项目。
|
|
144
218
|
*/
|
|
145
219
|
export async function upsertManagedAgentEntry(input) {
|
|
146
220
|
const projectRoot = normalizeProjectRoot(input.projectRoot);
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const index = registry.agents.findIndex((entry) => entry.projectRoot === projectRoot);
|
|
151
|
-
if (index >= 0) {
|
|
152
|
-
const existing = registry.agents[index];
|
|
153
|
-
registry.agents[index] = {
|
|
154
|
-
projectRoot,
|
|
155
|
-
pid,
|
|
156
|
-
startedAt: normalizeIsoTime(existing.startedAt || input.startedAt),
|
|
157
|
-
updatedAt: nowIso,
|
|
158
|
-
status: input.status === "stopped" ? "stopped" : "running",
|
|
159
|
-
stoppedAt: input.status === "stopped"
|
|
160
|
-
? normalizeIsoTime(input.stoppedAt || nowIso)
|
|
161
|
-
: undefined,
|
|
162
|
-
};
|
|
221
|
+
const state = await readProjectState();
|
|
222
|
+
if (!state.projectRoots.includes(projectRoot)) {
|
|
223
|
+
state.projectRoots.push(projectRoot);
|
|
163
224
|
}
|
|
164
|
-
|
|
165
|
-
registry.agents.push({
|
|
166
|
-
projectRoot,
|
|
167
|
-
pid,
|
|
168
|
-
startedAt: normalizeIsoTime(input.startedAt),
|
|
169
|
-
updatedAt: nowIso,
|
|
170
|
-
status: input.status === "stopped" ? "stopped" : "running",
|
|
171
|
-
stoppedAt: input.status === "stopped"
|
|
172
|
-
? normalizeIsoTime(input.stoppedAt || nowIso)
|
|
173
|
-
: undefined,
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
registry.updatedAt = nowIso;
|
|
177
|
-
await writeManagedAgentRegistry(registry);
|
|
225
|
+
await writeProjectState(state);
|
|
178
226
|
}
|
|
179
227
|
/**
|
|
180
|
-
* 标记 agent
|
|
228
|
+
* 标记 agent 停止。
|
|
229
|
+
*
|
|
230
|
+
* 关键点(中文)
|
|
231
|
+
* - 当前状态只由 daemon pid/meta 推导,所以这里不写 stopped 状态,只保证项目仍在索引中。
|
|
181
232
|
*/
|
|
182
233
|
export async function markManagedAgentStopped(projectRoot) {
|
|
183
|
-
|
|
184
|
-
const registry = await readManagedAgentRegistry();
|
|
185
|
-
const index = registry.agents.findIndex((entry) => entry.projectRoot === key);
|
|
186
|
-
if (index < 0)
|
|
187
|
-
return;
|
|
188
|
-
const nowIso = new Date().toISOString();
|
|
189
|
-
const current = registry.agents[index];
|
|
190
|
-
registry.agents[index] = {
|
|
191
|
-
...current,
|
|
192
|
-
status: "stopped",
|
|
193
|
-
stoppedAt: nowIso,
|
|
194
|
-
updatedAt: nowIso,
|
|
195
|
-
};
|
|
196
|
-
registry.updatedAt = nowIso;
|
|
197
|
-
await writeManagedAgentRegistry(registry);
|
|
234
|
+
await upsertManagedAgentEntry({ projectRoot, status: "stopped" });
|
|
198
235
|
}
|
|
199
236
|
/**
|
|
200
|
-
*
|
|
237
|
+
* 从 agent 项目索引中移除项目。
|
|
201
238
|
*/
|
|
202
239
|
export async function removeManagedAgentEntry(projectRoot) {
|
|
203
240
|
const key = normalizeProjectRoot(projectRoot);
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
if (
|
|
241
|
+
const state = await readProjectState();
|
|
242
|
+
const nextProjectRoots = state.projectRoots.filter((item) => item !== key);
|
|
243
|
+
if (nextProjectRoots.length === state.projectRoots.length)
|
|
207
244
|
return;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
245
|
+
await writeProjectState({
|
|
246
|
+
...state,
|
|
247
|
+
projectRoots: nextProjectRoots,
|
|
248
|
+
});
|
|
211
249
|
}
|
|
212
250
|
//# sourceMappingURL=CityRegistry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CityRegistry.js","sourceRoot":"","sources":["../../../../src/city/process/registry/CityRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"CityRegistry.js","sourceRoot":"","sources":["../../../../src/city/process/registry/CityRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GAEpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,MAAM,uBAAuB,GAAG,qBAAq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ACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,WAAmB;IAC/D,MAAM,GAAG,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,MAAM,gBAAgB,EAAE,CAAC;IACvC,MAAM,gBAAgB,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;IAC3E,IAAI,gBAAgB,CAAC,MAAM,KAAK,KAAK,CAAC,YAAY,CAAC,MAAM;QAAE,OAAO;IAClE,MAAM,iBAAiB,CAAC;QACtB,GAAG,KAAK;QACR,YAAY,EAAE,gBAAgB;KAC/B,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -135,6 +135,14 @@ export declare class PlatformStore {
|
|
|
135
135
|
*/
|
|
136
136
|
removeChannelAccount(accountIdInput: string): void;
|
|
137
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* 创建 City 本地状态存储。
|
|
140
|
+
*/
|
|
141
|
+
export declare function createCityPlatformStore(): PlatformStore;
|
|
142
|
+
/**
|
|
143
|
+
* 创建 Federation 管理端状态存储。
|
|
144
|
+
*/
|
|
145
|
+
export declare function createFederationPlatformStore(): PlatformStore;
|
|
138
146
|
/**
|
|
139
147
|
* 在 PlatformStore 上下文中执行操作。
|
|
140
148
|
*
|