@sleep2agi/agent-network 2.3.0-preview.62 → 2.3.0-preview.64
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export declare const PAIRED_AGENT_NETWORK_VERSION = "2.3.0-preview.
|
|
2
|
-
export declare const PAIRED_AGENT_NODE_VERSION = "2.5.0-preview.
|
|
3
|
-
export declare const PAIRED_AGENT_NODE_SPEC = "@sleep2agi/agent-node@2.5.0-preview.
|
|
4
|
-
export declare const OPENCODE_AGENT_NETWORK_VERSION = "2.3.0-preview.
|
|
5
|
-
export declare const OPENCODE_AGENT_NODE_VERSION = "2.5.0-preview.
|
|
6
|
-
export declare const OPENCODE_AGENT_NODE_SPEC = "@sleep2agi/agent-node@2.5.0-preview.
|
|
1
|
+
export declare const PAIRED_AGENT_NETWORK_VERSION = "2.3.0-preview.64";
|
|
2
|
+
export declare const PAIRED_AGENT_NODE_VERSION = "2.5.0-preview.49";
|
|
3
|
+
export declare const PAIRED_AGENT_NODE_SPEC = "@sleep2agi/agent-node@2.5.0-preview.49";
|
|
4
|
+
export declare const OPENCODE_AGENT_NETWORK_VERSION = "2.3.0-preview.64";
|
|
5
|
+
export declare const OPENCODE_AGENT_NODE_VERSION = "2.5.0-preview.49";
|
|
6
|
+
export declare const OPENCODE_AGENT_NODE_SPEC = "@sleep2agi/agent-node@2.5.0-preview.49";
|
|
7
7
|
export type PairedAgentNodeResolution = {
|
|
8
8
|
spec: string;
|
|
9
9
|
args: string[];
|
|
@@ -4,19 +4,36 @@ export interface OwnedRoot {
|
|
|
4
4
|
birth: string;
|
|
5
5
|
role: OwnedRootRole;
|
|
6
6
|
}
|
|
7
|
+
/** 🔴 #1438 — 发现阶段(`ps`)与后续 `/proc/<pid>/stat` 读之间,pid 可能被回收。
|
|
8
|
+
* 为让 resolveOwnedRoots 能识别「pid 相同、进程不同」,发现阶段必须在
|
|
9
|
+
* **同一次 `ps` 快照**里同时取 pid 与一个稳定的启动时刻签名(lstart),
|
|
10
|
+
* 并把这个签名一路带进来做比对。同一次 ps 内的 pid 与 lstart 无 TOCTOU。 */
|
|
11
|
+
export interface OwnedRootCandidate {
|
|
12
|
+
pid: number;
|
|
13
|
+
/** 发现时刻的 `ps -o lstart=` 字符串(24 字符定宽),用于识别 pid 回收。 */
|
|
14
|
+
discoveredBirth: string;
|
|
15
|
+
}
|
|
7
16
|
export interface OwnedRootProbes {
|
|
8
|
-
/**
|
|
17
|
+
/** 进程这一代的出生时刻(以「存储格式」返回,通常是 /proc/stat starttime jiffies);
|
|
18
|
+
* 读不到返回 null(可能已退出,也可能无权限)。用于写进 lifecycle 记录。 */
|
|
9
19
|
birth(pid: number): string | null;
|
|
10
|
-
/** 🔴 只有**确证**进程不存在时返回
|
|
20
|
+
/** 🔴 只有**确证**进程不存在时返回 true。无权限等一律视为存在。 */
|
|
11
21
|
vanished(pid: number): boolean;
|
|
22
|
+
/** 🔴 #1438 — 返回**当前**pid 的 lstart 签名,和发现阶段同格式。
|
|
23
|
+
* 用来识别 pid 回收:发现时是 A、现在读回来是 B ⇒ pid 已被复用。
|
|
24
|
+
* 读不到返回 null(进程已退出,或读 ps 失败)。 */
|
|
25
|
+
currentBirthSignature(pid: number): string | null;
|
|
12
26
|
}
|
|
13
|
-
/** 把 `ps` 发现的 pid
|
|
27
|
+
/** 把 `ps` 发现的 (pid, birth) 候选冻结成 owned roots。
|
|
14
28
|
*
|
|
15
|
-
* ·
|
|
16
|
-
* ·
|
|
17
|
-
*
|
|
29
|
+
* · currentBirthSignature 与 discoveredBirth **相等** ⇒ 同一代,收下
|
|
30
|
+
* · currentBirthSignature 与 discoveredBirth **不等** ⇒ 🔴 #1438 pid 已被复用,
|
|
31
|
+
* 现在这个 pid 属于另一个进程 B。**跳过**(而不是收下 B 当我们的节点):
|
|
32
|
+
* stop 的目的是让 A 没了;B 是无关进程,不能因为它恰好占了 A 的 pid 就被杀。
|
|
33
|
+
* · currentBirthSignature 为 null、**确证已消失** ⇒ 跳过(stop 想要的结果)
|
|
34
|
+
* · currentBirthSignature 为 null、进程仍在 ⇒ throw(权限等真问题)
|
|
18
35
|
*/
|
|
19
|
-
export declare function resolveOwnedRoots(
|
|
36
|
+
export declare function resolveOwnedRoots(candidates: OwnedRootCandidate[], probes: OwnedRootProbes): OwnedRoot[];
|
|
20
37
|
/** 🔴 正向判定「进程确实没了」,而不是「读失败就假设没了」。
|
|
21
38
|
*
|
|
22
39
|
* `kill(pid, 0)` 不送信号,只做存在性与权限探测:
|
|
@@ -25,3 +42,17 @@ export declare function resolveOwnedRoots(pids: number[], probes: OwnedRootProbe
|
|
|
25
42
|
* · 其他 ⇒ 保守当作存在(判据只在**确证**时放行)
|
|
26
43
|
*/
|
|
27
44
|
export declare function processVanished(pid: number, kill?: (p: number, s: number) => void): boolean;
|
|
45
|
+
/** 🔴 #1458 — kill 前的 pid 回收保护:发现阶段捕获的 discoveredBirth 与
|
|
46
|
+
* **当前**probeCurrentSignature(pid) 相等 ⇒ 同一代,可以信号。
|
|
47
|
+
*
|
|
48
|
+
* · currentSig === discoveredBirth ⇒ true(同代,可 kill)
|
|
49
|
+
* · currentSig !== discoveredBirth ⇒ false(pid 被回收,现在这个 pid 是另一
|
|
50
|
+
* 个进程 B。**不要 kill** —— B 与我们要 stop 的 agent 无关)
|
|
51
|
+
* · currentSig === null ⇒ false(pid 已消失或读不到;caller 判
|
|
52
|
+
* 是消失就该 skip,权限问题应额外处理但不该 kill 未知对象)
|
|
53
|
+
*
|
|
54
|
+
* 与 resolveOwnedRoots 内嵌的同款比较**在语义上一致**,但在**时间点上不同**:
|
|
55
|
+
* resolveOwnedRoots 用于「冻结」时刻(装进 lifecycle owner)
|
|
56
|
+
* isSameIncarnation 用于「发信号」前那一瞬(rename 的 kill 循环)
|
|
57
|
+
* 两个时刻中间可能又有窗口,所以这个检查要**离 process.kill 越近越好**。 */
|
|
58
|
+
export declare function isSameIncarnation(pid: number, discoveredBirth: string, probeCurrentSignature: (pid: number) => string | null): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.3.0-preview.
|
|
3
|
+
"version": "2.3.0-preview.64",
|
|
4
4
|
"description": "AI Agent Network CLI — Local-first multi-agent orchestration across 6 runtimes (Claude Code CLI / Claude Agent SDK / Codex SDK / Codex app-server / Grok Build ACP / OpenCode CLI) and 8+ LLM providers. Apache 2.0.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|