@sleep2agi/agent-network 2.3.0-preview.26 → 2.3.0-preview.261

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 (207) hide show
  1. package/README.md +35 -324
  2. package/build-info.json +7 -0
  3. package/dist/bin/anet.cjs +104 -0
  4. package/dist/bin/cli.d.ts +1 -1
  5. package/dist/bin/cli.js +20 -1
  6. package/dist/src/active-network-task.d.ts +28 -0
  7. package/dist/src/batch-workdir.d.ts +9 -0
  8. package/dist/src/bootstrap-password-db.d.ts +13 -0
  9. package/dist/src/build-info.d.ts +26 -0
  10. package/dist/src/channel-attachments.d.ts +29 -0
  11. package/dist/src/channel-inbox-wake.d.ts +21 -0
  12. package/dist/src/channel-meta.d.ts +10 -0
  13. package/dist/src/channel-peer-reply.d.ts +41 -0
  14. package/dist/src/channel-task-trace.d.ts +14 -0
  15. package/dist/src/claude-vendor-env.d.ts +28 -0
  16. package/dist/src/cli-args.d.ts +8 -0
  17. package/dist/src/cli-auth-session.d.ts +47 -0
  18. package/dist/src/cli-errors.d.ts +41 -0
  19. package/dist/src/cli-exit.d.ts +11 -0
  20. package/dist/src/cli-help.d.ts +10 -0
  21. package/dist/src/cli-version-display.d.ts +16 -0
  22. package/dist/src/client-task-trace.d.ts +9 -0
  23. package/dist/src/client.js +1 -1
  24. package/dist/src/codex-adopt.d.ts +46 -0
  25. package/dist/src/codex-auth-fingerprint.d.ts +211 -0
  26. package/dist/src/codex-bin-pin.d.ts +23 -0
  27. package/dist/src/codex-commhub-mcp.d.ts +22 -0
  28. package/dist/src/codex-copresence-bridge-log.d.ts +44 -0
  29. package/dist/src/codex-copresence-env.d.ts +5 -0
  30. package/dist/src/codex-copresence-login-gate.d.ts +18 -0
  31. package/dist/src/codex-copresence-model.d.ts +23 -0
  32. package/dist/src/codex-copresence-preflight.d.ts +78 -0
  33. package/dist/src/codex-copresence-profile.d.ts +126 -0
  34. package/dist/src/codex-copresence-recovery.d.ts +70 -0
  35. package/dist/src/codex-copresence-resume-timeout.d.ts +28 -0
  36. package/dist/src/codex-copresence-rollout-guard.d.ts +36 -0
  37. package/dist/src/codex-copresence-rpc.d.ts +17 -0
  38. package/dist/src/codex-copresence-thread.d.ts +13 -0
  39. package/dist/src/codex-copresence-yolo.d.ts +16 -0
  40. package/dist/src/codex-external-appserver.d.ts +130 -0
  41. package/dist/src/codex-fork-recovery.d.ts +52 -0
  42. package/dist/src/codex-home-enforce.d.ts +88 -0
  43. package/dist/src/codex-lifecycle-account.d.ts +104 -0
  44. package/dist/src/codex-lifecycle-canary.d.ts +20 -0
  45. package/dist/src/codex-lifecycle-facts.d.ts +53 -0
  46. package/dist/src/codex-lifecycle-fork.d.ts +91 -0
  47. package/dist/src/codex-lifecycle-preflight.d.ts +79 -0
  48. package/dist/src/codex-lifecycle-receipt.d.ts +53 -0
  49. package/dist/src/codex-lifecycle-restart.d.ts +88 -0
  50. package/dist/src/codex-login-share-guard.d.ts +146 -0
  51. package/dist/src/codex-menu.d.ts +99 -0
  52. package/dist/src/codex-model-default.d.ts +6 -0
  53. package/dist/src/codex-node-login.d.ts +98 -0
  54. package/dist/src/codex-pending-thread-restart.d.ts +69 -0
  55. package/dist/src/codex-reasoning-effort.d.ts +17 -0
  56. package/dist/src/codex-recovery-lease.d.ts +39 -0
  57. package/dist/src/codex-recovery-resource-gate.d.ts +15 -0
  58. package/dist/src/codex-resume.d.ts +89 -0
  59. package/dist/src/codex-rollout-history-guard.d.ts +84 -0
  60. package/dist/src/codex-tui-client-health.d.ts +30 -0
  61. package/dist/src/commhub-response.d.ts +1 -0
  62. package/dist/src/controlled-upload.d.ts +83 -0
  63. package/dist/src/copresence-deps.d.ts +22 -0
  64. package/dist/src/copresence-identity.d.ts +363 -0
  65. package/dist/src/copresence-startup-diagnosis.d.ts +17 -0
  66. package/dist/src/daemon-adopt.d.ts +14 -0
  67. package/dist/src/daemon-anet-bin.d.ts +32 -0
  68. package/dist/src/daemon-capability-display.d.ts +110 -0
  69. package/dist/src/daemon-capability-display.js +21 -0
  70. package/dist/src/daemon-codex-inventory.d.ts +65 -0
  71. package/dist/src/daemon-inherited-env.d.ts +9 -0
  72. package/dist/src/daemon-provider-account-custody.d.ts +28 -0
  73. package/dist/src/daemon-provider-account-readback.d.ts +3 -0
  74. package/dist/src/daemon-provider-application.d.ts +36 -0
  75. package/dist/src/daemon-provider-apply-command.d.ts +9 -0
  76. package/dist/src/daemon-provider-collect.d.ts +29 -0
  77. package/dist/src/daemon-provider-command.d.ts +7 -0
  78. package/dist/src/daemon-provider-initialize.d.ts +27 -0
  79. package/dist/src/daemon-provider-lifecycle.d.ts +4 -0
  80. package/dist/src/daemon-provider-store.d.ts +104 -0
  81. package/dist/src/daemon-runtime-path-preflight.d.ts +22 -0
  82. package/dist/src/daemon-runtime-staleness.d.ts +13 -0
  83. package/dist/src/dashboard-managed-process.d.ts +35 -0
  84. package/dist/src/display-width.d.ts +27 -0
  85. package/dist/src/doctor-node-count.d.ts +28 -0
  86. package/dist/src/grok-attach-client.d.ts +129 -0
  87. package/dist/src/grok-build-drift.d.ts +15 -0
  88. package/dist/src/grok-copresence-disclosure.d.ts +11 -0
  89. package/dist/src/grok-copresence-orchestration.d.ts +75 -0
  90. package/dist/src/grok-copresence-profile.d.ts +65 -0
  91. package/dist/src/grok-create-mode.d.ts +19 -0
  92. package/dist/src/host-telemetry.d.ts +14 -0
  93. package/dist/src/hub-health-timeout.d.ts +4 -0
  94. package/dist/src/hub-server-version.d.ts +64 -0
  95. package/dist/src/hub-stop.d.ts +74 -0
  96. package/dist/src/hub-time-display.d.ts +20 -0
  97. package/dist/src/hub-version-skew.d.ts +19 -0
  98. package/dist/src/im/correlation-store.d.ts +34 -0
  99. package/dist/src/im/feishu/adapter.d.ts +47 -0
  100. package/dist/src/im/feishu/bridge.d.ts +72 -14
  101. package/dist/src/im/feishu/chat-context.d.ts +44 -0
  102. package/dist/src/im/feishu/config.d.ts +15 -1
  103. package/dist/src/im/feishu/hub-upload.d.ts +1 -1
  104. package/dist/src/im/feishu/queue-notice.d.ts +2 -0
  105. package/dist/src/im/feishu/worker-lifecycle.d.ts +13 -0
  106. package/dist/src/im/feishu/worker.js +171 -154
  107. package/dist/src/inbox-drain.d.ts +20 -0
  108. package/dist/src/local-process-state.d.ts +12 -0
  109. package/dist/src/locale-diagnostic.d.ts +12 -0
  110. package/dist/src/login-client-label.d.ts +6 -0
  111. package/dist/src/ls-columns.d.ts +15 -0
  112. package/dist/src/mock-llm.d.ts +12 -0
  113. package/dist/src/node-activity-log.d.ts +4 -0
  114. package/dist/src/node-clone.d.ts +134 -0
  115. package/dist/src/node-delete-hub.d.ts +42 -0
  116. package/dist/src/node-files.d.ts +62 -0
  117. package/dist/src/node-locate.d.ts +60 -0
  118. package/dist/src/node-ls-all.d.ts +80 -0
  119. package/dist/src/node-menu.d.ts +40 -0
  120. package/dist/src/node-not-found.d.ts +1 -0
  121. package/dist/src/node-perm.d.ts +74 -0
  122. package/dist/src/node-remote.d.ts +180 -0
  123. package/dist/src/node-running-guard.d.ts +9 -0
  124. package/dist/src/node-secret-file.d.ts +32 -0
  125. package/dist/src/node-server-identity.d.ts +35 -0
  126. package/dist/src/node-server-payload.d.ts +66 -0
  127. package/dist/src/node-server-rules-file.d.ts +14 -0
  128. package/dist/src/node-server-secrets.d.ts +60 -0
  129. package/dist/src/node-server-version.d.ts +39 -0
  130. package/dist/src/node-server.d.ts +0 -12
  131. package/dist/src/node-server.js +8 -1
  132. package/dist/src/node-skills.d.ts +57 -0
  133. package/dist/src/normalize-runtime.d.ts +28 -9
  134. package/dist/src/offline-age.d.ts +29 -0
  135. package/dist/src/one-line-cell.d.ts +20 -0
  136. package/dist/src/opencode-agent-node-pair.d.ts +52 -0
  137. package/dist/src/opencode-auth-login.d.ts +43 -0
  138. package/dist/src/opencode-free-tier.d.ts +27 -0
  139. package/dist/src/opencode-generation-create.d.ts +27 -0
  140. package/dist/src/opencode-generation-record.d.ts +24 -0
  141. package/dist/src/opencode-launch-env.d.ts +13 -0
  142. package/dist/src/opencode-owner-mode.d.ts +6 -0
  143. package/dist/src/opencode-package-binary.d.ts +44 -0
  144. package/dist/src/opencode-pin.d.ts +28 -8
  145. package/dist/src/opencode-preset.d.ts +42 -8
  146. package/dist/src/opencode-runtime-binding.d.ts +30 -0
  147. package/dist/src/opencode-safe-root.d.ts +36 -0
  148. package/dist/src/opencode-shared-server-create.d.ts +5 -0
  149. package/dist/src/opencode-smoke-env.d.ts +1 -0
  150. package/dist/src/opencode-start-mode.d.ts +8 -0
  151. package/dist/src/opencode-v2-configured-model.d.ts +34 -0
  152. package/dist/src/opencode-v2-create-align.d.ts +18 -0
  153. package/dist/src/opencode-versions.d.ts +44 -0
  154. package/dist/src/os-user.d.ts +4 -0
  155. package/dist/src/outbound-attachments.d.ts +60 -0
  156. package/dist/src/outbound-tool-names.d.ts +1 -0
  157. package/dist/src/owned-roots.d.ts +58 -0
  158. package/dist/src/owner-env-file.d.ts +2 -0
  159. package/dist/src/package-mode-preflight.d.ts +41 -0
  160. package/dist/src/posix-codex-copresence.d.ts +33 -0
  161. package/dist/src/posix-modes.d.ts +36 -0
  162. package/dist/src/primary-network.d.ts +23 -0
  163. package/dist/src/private-state.d.ts +18 -0
  164. package/dist/src/process-telemetry.d.ts +12 -0
  165. package/dist/src/profile-merge.d.ts +12 -0
  166. package/dist/src/profile-serialize.d.ts +1 -0
  167. package/dist/src/provider-application-contract.d.ts +11 -0
  168. package/dist/src/provider-apply.d.ts +28 -0
  169. package/dist/src/provider-presets.d.ts +76 -0
  170. package/dist/src/reply-local-links.d.ts +47 -0
  171. package/dist/src/reply-originator.d.ts +20 -0
  172. package/dist/src/resume-runtime-infer.d.ts +18 -0
  173. package/dist/src/rules-file.d.ts +76 -0
  174. package/dist/src/scoped-secrets.d.ts +56 -0
  175. package/dist/src/secret-shell-guidance.d.ts +4 -0
  176. package/dist/src/session-status-class.d.ts +48 -0
  177. package/dist/src/shared/opencode-borrowed-launch-health.d.ts +29 -0
  178. package/dist/src/shared/private-file.d.ts +65 -0
  179. package/dist/src/shared/provider-collection.d.ts +9 -0
  180. package/dist/src/shared/provider-initialization.d.ts +7 -0
  181. package/dist/src/shared/reserved-env.d.ts +3 -0
  182. package/dist/src/shared/scoped-secret-contract.d.ts +1 -0
  183. package/dist/src/shared/scoped-secret-env.d.ts +3 -0
  184. package/dist/src/sibling-agent-node.d.ts +23 -0
  185. package/dist/src/stale-socket.d.ts +118 -0
  186. package/dist/src/standalone-bin.d.ts +101 -0
  187. package/dist/src/standalone-build-stamp.d.ts +33 -0
  188. package/dist/src/start-resource-gate.d.ts +146 -0
  189. package/dist/src/stopped-receipt.d.ts +8 -0
  190. package/dist/src/subcommand-redirect.d.ts +26 -0
  191. package/dist/src/task-trace.d.ts +33 -0
  192. package/dist/src/tmux-attach.d.ts +11 -0
  193. package/dist/src/tmux-capability.d.ts +58 -0
  194. package/dist/src/tmux-exact-target.d.ts +36 -0
  195. package/dist/src/tmux-format.d.ts +20 -0
  196. package/dist/src/tmux-pane-prompt.d.ts +22 -0
  197. package/dist/src/tmux.d.ts +44 -0
  198. package/dist/src/token-cli.d.ts +13 -0
  199. package/dist/src/tool-allowlist.d.ts +28 -0
  200. package/dist/src/unsafe-package-path-reason.d.ts +31 -0
  201. package/dist/src/upgrade-channel.d.ts +31 -0
  202. package/dist/src/win-launcher.d.ts +20 -0
  203. package/dist/src/windows-codex-copresence.d.ts +254 -0
  204. package/dist/src/windows-rename-retry.d.ts +13 -0
  205. package/dist/src/windows-runtime.d.ts +63 -0
  206. package/dist/src/windows-sdk-stop-evidence.d.ts +24 -0
  207. package/package.json +19 -9
@@ -0,0 +1,254 @@
1
+ export type WindowsCopresenceRole = "appsrv" | "bridge";
2
+ export interface WindowsManagedProcess {
3
+ role: WindowsCopresenceRole;
4
+ pid: number;
5
+ creationDate: string;
6
+ logPath: string;
7
+ }
8
+ export interface WindowsCopresenceRecord {
9
+ version: 1 | 2;
10
+ nodeId: string;
11
+ createdAt: string;
12
+ marker?: string;
13
+ processes: WindowsManagedProcess[];
14
+ }
15
+ export declare function windowsCopresenceRecordPath(nodesDir: string, nodeId: string): string;
16
+ export declare function windowsCopresenceLogPath(nodesDir: string, nodeId: string, role: WindowsCopresenceRole): string;
17
+ export declare function openPrivateAppendLog(path: string): number;
18
+ /** Protect credential-bearing state with native Windows ACLs. */
19
+ export declare function ensureWindowsPrivateDirectory(path: string): void;
20
+ export declare function closeLog(fd: number): void;
21
+ export type CreationDateProbe = (pid: number) => string | null;
22
+ /** Uses CIM instead of locale-dependent tasklist output. */
23
+ export declare function probeWindowsCreationDate(pid: number): string | null;
24
+ /**
25
+ * Attribute an ESTABLISHED loopback connection to the launched TUI process
26
+ * tree. This is deliberately stronger than counting listeners/connections:
27
+ * an unrelated local client cannot satisfy it.
28
+ */
29
+ export declare function probeWindowsOwnedLoopbackConnection(rootPid: number, expectedCreationDate: string, port: number, runPowerShell?: (script: string) => string): boolean;
30
+ /**
31
+ * #1342 —— 只在健康检查**即将失败**时跑一次,用来回答一个此前没人量过的问题:
32
+ * 那 10.5 秒到底花在 **PowerShell 启动**上,还是花在 `Get-CimInstance Win32_Process`
33
+ * 这个全表查询上?
34
+ *
35
+ * 实测背景(由 #1628/#1637 加的 probeMs 量到,2026-08-31):
36
+ * probes=1 waited=10897ms probeMsLast=10490 ← 单次探测吃掉 96% 的预算
37
+ * 而 #1636 把全表枚举提到循环外之后这个数**没有变小**(9963 → 10490),
38
+ * 说明成本不在"重复枚举",而在那一次调用本身。但"那一次调用"包含两段:
39
+ * 起一个 powershell 进程,和在里面跑 CIM 查询。**这两段要查的东西完全不同** ——
40
+ * 前者是 runner/镜像的问题,后者是查询写法的问题。
41
+ *
42
+ * 🔴 这里跑的是一个**什么都不做**的脚本(`'x'`),所以它测到的就是启动那一段的下界。
43
+ * 只在失败路径调用一次,不进探测循环 —— 不给正常路径增加任何成本,
44
+ * 也**不可能**改变探测的返回值。
45
+ *
46
+ * 拿不到就返回 null(未知),不返回 0 —— 0 会被读成「启动不花时间」。
47
+ */
48
+ export declare function measurePowerShellStartupMs(): number | null;
49
+ export declare function writeWindowsCopresenceRecord(nodesDir: string, nodeId: string, processes: WindowsManagedProcess[], marker?: string): void;
50
+ export declare function readWindowsCopresenceRecord(nodesDir: string, nodeId: string): WindowsCopresenceRecord | null;
51
+ export interface WindowsStopDecision {
52
+ safe: WindowsManagedProcess[];
53
+ refused: Array<{
54
+ process: WindowsManagedProcess;
55
+ reason: "missing" | "pid-reused";
56
+ }>;
57
+ }
58
+ /** PID alone is never authority: Windows reuses PIDs, so CreationDate must match. */
59
+ export declare function decideWindowsManagedStop(record: WindowsCopresenceRecord, probe: CreationDateProbe): WindowsStopDecision;
60
+ export declare function taskkillWindowsProcessTree(pid: number): void;
61
+ export interface TaskkillOutcome {
62
+ status: number | null;
63
+ signal: string | null;
64
+ /** 受控摘要:仅保留 taskkill 自身固定形状的行,≤4 行 / 400 字符。 */
65
+ stderrSummary: string;
66
+ /** 被丢弃的 stderr 字节数——保留「有输出但形状不识别」这一事实,不泄露文本。 */
67
+ stderrDroppedBytes: number;
68
+ }
69
+ /** 受控诊断:只放行已知形状(`ERROR:` / `Reason:` …),其余只记字节数。 */
70
+ export declare function summarizeTaskkillStderr(raw: string): {
71
+ summary: string;
72
+ droppedBytes: number;
73
+ };
74
+ /** 非零**不再**丢弃诊断:拿回 status/signal 与受控 stderr,交给身份裁决。 */
75
+ export declare function runTaskkillWindowsProcessTree(pid: number): TaskkillOutcome;
76
+ export type WindowsIdentityState = "alive" | "gone" | "pid-reused" | "unknown";
77
+ /** 结构化协议:判定只读这个协议,**不**读本地化的错误文案。 */
78
+ export declare const WINDOWS_IDENTITY_PROTOCOL = "IDSTATE:";
79
+ /** gone 用 .NET 的 `ArgumentException`(进程不存在)辨认——**异常类型**不随语言变化。 */
80
+ export declare function windowsIdentityProbeScript(pid: number): string;
81
+ export type WindowsIdentityRead = {
82
+ kind: "ticks";
83
+ ticks: string;
84
+ } | {
85
+ kind: "absent";
86
+ } | {
87
+ kind: "unknown";
88
+ };
89
+ /** 空输出 / 多行 / 非法形状 / 异常 ⇒ unknown(**不能**折成 gone)。 */
90
+ export declare function readWindowsIdentity(pid: number, runPowerShell?: (script: string) => string): WindowsIdentityRead;
91
+ /** 三向:alive(出生身份仍在) / gone(该身份已不存在) / pid-reused(同 PID 已被无关进程占用) / unknown。 */
92
+ export declare function probeWindowsIdentity(pid: number, expectedCreationDate: string, runPowerShell?: (script: string) => string, kind?: WindowsIdentityKind): WindowsIdentityState;
93
+ export type WindowsIdentityKind = "ticks" | "creation";
94
+ export interface WindowsManagedIdentity {
95
+ role: string;
96
+ pid: number;
97
+ creationDate: string;
98
+ /** `ticks`(根,`[Diagnostics.Process]::StartTime` 的 .NET ticks)或
99
+ * `creation`(后代,**同一份 CIM 枚举快照**里的 `CreationDate`)。两者**不混用**、各自精确相等比较。 */
100
+ kind?: WindowsIdentityKind;
101
+ }
102
+ export declare const WINDOWS_CAPTURE_PROTOCOL = "CAP:";
103
+ /**
104
+ * 一次 PowerShell 里完成**绑定根身份**的取证:先核根出生身份 == 期望,再枚举后代并在
105
+ * **同一次枚举**中读它们的出生身份,最后**再核一次**根身份。根代际漂移 ⇒ 整次取证作废。
106
+ * 只用于取证,**不**用于杀进程。
107
+ */
108
+ export declare function windowsCaptureScript(rootPid: number, expectedCreationDate: string): string;
109
+ export interface WindowsDescendantCapture {
110
+ identities: WindowsManagedIdentity[];
111
+ rootBefore?: string;
112
+ rootAfter?: string;
113
+ /** 非空 ⇒ 取证不完整/根代际漂移,调用方**必须**按 unknown 处理,不得当成功。 */
114
+ unknownReason?: string;
115
+ }
116
+ export declare function parseWindowsCapture(raw: string): {
117
+ rootBefore: string;
118
+ rootAfter: string;
119
+ descendants: Array<{
120
+ pid: number;
121
+ ticks: string;
122
+ }>;
123
+ gaps: number[];
124
+ } | null;
125
+ /**
126
+ * 绑定**期望根身份**的取证:根在取证前/后都必须仍是期望代际;后代出生身份取自**同一次枚举**。
127
+ * 任何漂移/缺口 ⇒ unknownReason(不猜)。只用于**验证**;杀进程仍走根 PID 的既存出生身份。
128
+ */
129
+ export declare function captureWindowsDescendantIdentities(root: WindowsManagedIdentity, opts?: {
130
+ cap?: number;
131
+ runPowerShell?: (script: string) => string;
132
+ }): WindowsDescendantCapture;
133
+ export declare const WINDOWS_CIM_PROTOCOL = "CIMSTATE:";
134
+ /** 后代身份协议:**同一份快照**里的 CIM `CreationDate`(`ToString('o')`),精确相等比较。 */
135
+ export declare function cimIdentityProbeScript(pid: number): string;
136
+ /** Validate the complete text without rounding the identity's fractional digits. */
137
+ export declare function isCompleteCimCreationDate(value: string): boolean;
138
+ /**
139
+ * 🔴 只有**期望值与读回值均为合法完整** `CreationDate`,且二者**精确不等**时才是 `pid-reused`;
140
+ * 任何一侧非法(格式/日期/多行/空白畸形)⇒ **unknown** —— 不得因"读不懂"而放宽成"已退出/被复用"。
141
+ * 比较保留全部精度:不做 `Date.parse`、不截断、不近似。
142
+ */
143
+ export declare function parseCimIdentityState(raw: string, expectedCreationDate: string): WindowsIdentityState;
144
+ export declare function probeWindowsCimIdentity(pid: number, expectedCreationDate: string, runPowerShell?: (script: string) => string): WindowsIdentityState;
145
+ export interface WindowsStopOrchestrationDeps {
146
+ runPowerShell?: (script: string) => string;
147
+ runTaskkill?: (pid: number) => TaskkillOutcome;
148
+ onProgress?: (stage: string) => void;
149
+ captureRoots?: (roots: WindowsManagedIdentity[]) => WindowsDescendantCapture[];
150
+ readFinalEvidence?: (identities: WindowsManagedIdentity[]) => {
151
+ snapshot: Array<{
152
+ pid: number;
153
+ ppid: number;
154
+ }> | null;
155
+ probe: (identity: WindowsManagedIdentity) => WindowsIdentityState;
156
+ };
157
+ }
158
+ export interface WindowsStopOrchestration {
159
+ verdict: WindowsStopVerdict;
160
+ /** 实际发出 taskkill 的根 PID —— 负控可断言为 **0**。 */
161
+ killedPids: number[];
162
+ identities: WindowsManagedIdentity[];
163
+ /** 非 `stopped` 时调用方**必须**保留记录、**不得**通知 Hub 离线。 */
164
+ mustKeepRecord: boolean;
165
+ }
166
+ /**
167
+ * 停止编排(CLI 实际使用的那一份,注入 runner/executor 以便见证):
168
+ * ① 对每个受管根做**绑定根身份**的取证(含后代出生身份与前后根代际核对);
169
+ * ② 每个根在**终止紧前**重验 PID+CreationDate —— `gone`/`pid-reused`/`unknown` 一律**不发**终止命令;
170
+ * ③ 按精确身份裁决 gone/alive/unknown。过期 `safe` **不**构成终止授权。
171
+ */
172
+ export declare function orchestrateWindowsManagedStop(roots: WindowsManagedIdentity[], deps?: WindowsStopOrchestrationDeps): WindowsStopOrchestration;
173
+ export type AsyncWindowsStopDeps = Omit<WindowsStopOrchestrationDeps, "captureRoots" | "readFinalEvidence"> & {
174
+ captureRoots?: (roots: WindowsManagedIdentity[]) => WindowsDescendantCapture[] | Promise<WindowsDescendantCapture[]>;
175
+ readFinalEvidence?: (identities: WindowsManagedIdentity[]) => ReturnType<NonNullable<WindowsStopOrchestrationDeps["readFinalEvidence"]>> | Promise<ReturnType<NonNullable<WindowsStopOrchestrationDeps["readFinalEvidence"]>>>;
176
+ probeRoot?: (root: WindowsManagedIdentity) => WindowsIdentityState | Promise<WindowsIdentityState>;
177
+ };
178
+ /** Same decision flow as the synchronous CLI, with async evidence transport. */
179
+ export declare function orchestrateWindowsManagedStopAsync(roots: WindowsManagedIdentity[], deps: AsyncWindowsStopDeps): Promise<WindowsStopOrchestration>;
180
+ export declare const WINDOWS_SNAPSHOT_PROTOCOL = "SNAP:";
181
+ /**
182
+ * 终止**之后**的进程快照:**只**返回现存进程的 (pid, ppid) 对,不在脚本里做遍历、不下结论。
183
+ * 🔴 遍历刻意放在 JS 侧:这样「祖先链上的存活后代」这条判据**本身**可被单测见证,
184
+ * 而不是只往编排里注入一个已经算好的结果。
185
+ */
186
+ export declare function windowsProcessSnapshotScript(): string;
187
+ export declare function parseWindowsProcessSnapshot(raw: string): Array<{
188
+ pid: number;
189
+ ppid: number;
190
+ }> | null;
191
+ /**
192
+ * 🔴 **完整性判据(不看根是否可达)**:以**全部已捕获身份**(根 + 后代)为种子,
193
+ * 在终止后快照里沿 `ParentProcessId` 向下闭包;任何**可达且不属于已捕获身份**的现存进程,
194
+ * 都是「未被记账的存活后代」。
195
+ *
196
+ * 这修掉的是这个反例:捕获 8100→8744 后,8744 又生出 9999;非零 kill 使 8100/8744 退出而
197
+ * 9999 存活(快照里 `9999=8744`)。旧实现只从 8100 出发 BFS ⇒ 根已不可达 ⇒ 得空 ⇒ 误判 stopped。
198
+ * 现在 8744 也在种子里 ⇒ 9999 可达 ⇒ 必须 `unknown`。
199
+ *
200
+ * ⚠️ **保证范围(有界)**:这是**单次有限快照**上的可达性判据,**不是**"历史后代完整性证明"。
201
+ * 若某个中间节点**从未被捕获**且已退出,有限 pid/ppid 快照里**没有那条历史边**,本条判据
202
+ * 看不到它;因此本片**不承诺**全时段/任意树零残留。超出该范围需要启动屏障/Job Object 一类
203
+ * 机制,**不在本片引入**。
204
+ */
205
+ export declare function findUnaccountedDescendants(snapshot: Array<{
206
+ pid: number;
207
+ ppid: number;
208
+ }>, capturedPids: number[]): number[];
209
+ export interface WindowsStopContinuation<TStopResult> {
210
+ /** 删除 Windows 归属记录(`rmSync(windowsCopresenceRecordPath(…))`)。 */
211
+ removeRecord: () => void;
212
+ /** CLI 的 `stopNode(resolved.id)` —— **只是停止节点并返回其结果**。 */
213
+ stopNode: () => Promise<TStopResult>;
214
+ }
215
+ /**
216
+ * 🔴 停止收尾的**唯一门控**(CLI 与见证共用):只有 `stopped` 才删记录、才调用 `stopNode`;
217
+ * `survived`/`unverifiable` 两者都不做;nodeStopInvoked 只表示回调被调用,停止成功与否仍由 stopResult 裁决。
218
+ * 便于用 spy 观测**实际发生了什么调用**(而不是只看一个布尔)。
219
+ *
220
+ * ⚠️ **不含 Hub 离线通知**:真正的 `notifyServerOffline` 在 `stopNode` 之后、由 CLI 自行调用,
221
+ * **不在**本门控内;因此「Hub 未收到离线通知」在本片**仍是欠项(未验)**。
222
+ */
223
+ export declare function settleWindowsManagedStop<TStopResult>(outcome: WindowsStopOrchestration, continuation: WindowsStopContinuation<TStopResult>): Promise<{
224
+ kept: boolean;
225
+ nodeStopInvoked: boolean;
226
+ stopResult?: TStopResult;
227
+ }>;
228
+ export type WindowsStopVerdict = {
229
+ kind: "stopped";
230
+ retainedDiagnostics: string[];
231
+ } | {
232
+ kind: "survived";
233
+ alive: string[];
234
+ retainedDiagnostics: string[];
235
+ } | {
236
+ kind: "unverifiable";
237
+ unknown: string[];
238
+ retainedDiagnostics: string[];
239
+ };
240
+ /**
241
+ * 成败只由**精确身份**裁决(不解析 taskkill 文案):任一 `alive` ⇒ survived;否则任一
242
+ * `unknown`(含取证缺口)⇒ unverifiable(两者**都不得绿**);全部 gone 或 pid-reused
243
+ * ⇒ stopped,并把非零 taskkill 的 status/signal/受控 stderr 作为**保留诊断**带出。
244
+ */
245
+ export declare function decideWindowsStopVerdict(opts: {
246
+ identities: WindowsManagedIdentity[];
247
+ kills: Array<{
248
+ label: string;
249
+ outcome: TaskkillOutcome;
250
+ }>;
251
+ probe: (identity: WindowsManagedIdentity) => WindowsIdentityState;
252
+ captureUnknown?: string[];
253
+ notes?: string[];
254
+ }): WindowsStopVerdict;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Windows: 覆盖一个**正被别的句柄打开**的目标会失败(EPERM/EBUSY/EACCES),而 POSIX 的 rename 会成功 ——
3
+ * 所以同一个"写临时文件再 rename"的原子写在 Linux 上永远绿、在 Windows 上偶发红(#2222 实测在
4
+ * windows-copresence.json 上红过一次,CI 上看起来像随机红)。
5
+ *
6
+ * 这里只做**有界重试**:仅 win32、仅这三种"别人暂时开着"的错误码,退避 10/25/50/100/200ms
7
+ * (最多 5 次,总上限约 385ms);其它错误与重试耗尽一律照原样抛 —— 不吞错,也不把原子写降级成
8
+ * "原地覆盖"(那会让读者读到半个文件)。
9
+ *
10
+ * 为什么不复用 @sleep2agi/agent-network 里那份:agent-node 与 agent-network 是**分别发布**的两个包,
11
+ * 彼此没有依赖;跨包相对路径 import 在发布后会断。语义必须一致,两边的单测都要钉住同一组数字。
12
+ */
13
+ export declare function renameOverExistingSync(temp: string, path: string, rename?: (from: string, to: string) => void, sleep?: (ms: number) => void, platform?: string): void;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Native Windows runtime policy.
3
+ *
4
+ * RFC-044 slice 2 deliberately limited native Windows to the SDK path: the
5
+ * terminal / tmux / co-presence runtimes need a POSIX-ish PTY multiplexer that
6
+ * had not been validated there. That boundary is about **PTY**, not about every
7
+ * non-SDK runtime — the allowlist shape over-blocked the ACP runtimes, which
8
+ * speak JSON-RPC over a plain stdio child process (`acp-runner/client.ts` uses
9
+ * `spawn` + pipes, no PTY, no tmux).
10
+ *
11
+ * 2026-11-22 — 闻星 brought native Windows evidence for antigravity-acp
12
+ * (ConPTY + `ssh -tt` login works, `agy -p` headless works). That proves the
13
+ * CLI works, not that OUR stdio path works on Windows (`.cmd` shim resolution,
14
+ * child env policy, stop/tree-kill are still unverified there).
15
+ *
16
+ * So antigravity-acp is admitted **only behind an explicit opt-in**
17
+ * (`ANET_ALLOW_ACP_WINDOWS=1`) until a Windows-native first-reply + stop smoke
18
+ * exists. Default behaviour on win32 is unchanged (SDK only).
19
+ */
20
+ export declare const WINDOWS_DEFAULT_RUNTIMES: readonly string[];
21
+ /** ACP stdio runtimes that do not need PTY/tmux; gated by ANET_ALLOW_ACP_WINDOWS=1. */
22
+ export declare const WINDOWS_ACP_OPT_IN_RUNTIMES: readonly string[];
23
+ export declare function windowsRuntimeSupported(runtime: string, platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): boolean;
24
+ /**
25
+ * #3812 — native Windows runs an OpenCode node in exactly one shape: OpenCode V2, as a client of
26
+ * an OpenCode Server that is already running on the machine. A node that owns its server, and
27
+ * OpenCode V1, launch `opencode` themselves through a POSIX-only path and stay refused.
28
+ */
29
+ export declare function windowsOpencodeSharedNode(profile: {
30
+ runtime?: unknown;
31
+ opencodeGeneration?: unknown;
32
+ opencodeSharedServerUrl?: unknown;
33
+ opencodeSharedServerPasswordFile?: unknown;
34
+ } | null | undefined): boolean;
35
+ /**
36
+ * Native Windows has had its own Codex co-presence path since 2026-08 (`startWindowsCodexCopresence`:
37
+ * app-server + bridge as managed processes, no tmux), and the interactive picker offers it there.
38
+ * The SDK-only start gate added on 2026-11-17 refused it together with the tmux shapes, so a node
39
+ * the picker had just created could not be started. This names the one Codex shape that is let
40
+ * through; `--tmux`, dev channels and grok co-presence stay refused.
41
+ */
42
+ export declare function windowsCodexCopresenceNode(profile: {
43
+ runtime?: unknown;
44
+ codexCopresence?: unknown;
45
+ } | null | undefined, copresenceFlag?: boolean): boolean;
46
+ /**
47
+ * Why `anet node start` refuses this node on native Windows, or null when it may start.
48
+ * One sentence the user can act on: what is wrong and what to do instead.
49
+ */
50
+ export declare function windowsStartRefusal(input: {
51
+ profile: {
52
+ runtime?: unknown;
53
+ opencodeGeneration?: unknown;
54
+ opencodeSharedServerUrl?: unknown;
55
+ opencodeSharedServerPasswordFile?: unknown;
56
+ codexCopresence?: unknown;
57
+ grokCopresence?: unknown;
58
+ };
59
+ copresenceFlag: boolean;
60
+ tmuxFlag: boolean;
61
+ devChannelsFlag: boolean;
62
+ env?: NodeJS.ProcessEnv;
63
+ }): string | null;
@@ -0,0 +1,24 @@
1
+ import { type WindowsManagedIdentity, type WindowsStopOrchestrationDeps, type AsyncWindowsStopDeps } from "./windows-codex-copresence.js";
2
+ export declare function windowsSdkHelperLaunch(): {
3
+ command: string;
4
+ args: string[];
5
+ };
6
+ export declare function windowsSdkEvidenceScript(identities: WindowsManagedIdentity[], capture: boolean, includePrelude?: boolean): string;
7
+ export declare function windowsSdkBatchEvidence(run: (script: string) => string): Pick<WindowsStopOrchestrationDeps, "captureRoots" | "readFinalEvidence">;
8
+ /** Deliberately never return upstream text, paths or environment values. */
9
+ export declare function sdkEvidenceReason(raw: string): string;
10
+ /** A private pipe, not a disk DLL cache. Compile once per stop, reuse for every
11
+ * capture, immediate pre-kill birth check and final query; dispose on all paths.
12
+ * Startup/compilation has its own bound, queries retain their 5s bound. */
13
+ export declare function openWindowsSdkEvidenceSession(options?: {
14
+ onProgress?: (message: string) => void;
15
+ startupTimeoutMs?: number;
16
+ queryTimeoutMs?: number;
17
+ launch?: {
18
+ command: string;
19
+ args: string[];
20
+ };
21
+ }): Promise<{
22
+ deps: AsyncWindowsStopDeps;
23
+ close: () => void;
24
+ }>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.3.0-preview.26",
4
- "description": "AI Agent Network CLI — Local-first multi-agent orchestration across 4 runtimes (Claude Code CLI / Claude Agent SDK / Codex SDK / Grok Build ACP) and 8+ LLM providers (Anthropic / OpenAI / xAI Grok / MiniMax / DeepSeek / GLM / Kimi / InternLM / Xiaomi MiMo / OpenRouter). Apache 2.0.",
3
+ "version": "2.3.0-preview.261",
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",
7
7
  "types": "dist/client.d.ts",
@@ -9,19 +9,25 @@
9
9
  ".": {
10
10
  "import": "./dist/src/client.js",
11
11
  "types": "./dist/client.d.ts"
12
+ },
13
+ "./daemon-capability-display": {
14
+ "import": "./dist/src/daemon-capability-display.js",
15
+ "types": "./dist/src/daemon-capability-display.d.ts"
12
16
  }
13
17
  },
14
18
  "bin": {
15
- "anet": "dist/bin/cli.js"
19
+ "anet": "dist/bin/anet.cjs"
16
20
  },
17
21
  "files": [
18
- "dist"
22
+ "dist",
23
+ "build-info.json"
19
24
  ],
20
25
  "scripts": {
21
26
  "typecheck": "tsc --noEmit",
22
27
  "test:feishu-bridge": "bun tests/feishu-bridge-ackplaceholder.test.ts",
23
- "build": "bun build src/client.ts --outdir dist/src --target node --minify && bun build bin/cli.ts --outdir dist/bin --target node --minify --external @sleep2agi/commhub-server --external bun:sqlite --external '../../server/*' && bun build src/node-server.ts --outdir dist/src --target node --minify --external @modelcontextprotocol/sdk && bun build src/im/feishu/worker.ts --outdir dist/src/im/feishu --target node --minify --external @larksuiteoapi/node-sdk && tsc --emitDeclarationOnly --declaration --outDir dist && npx javascript-obfuscator dist/bin/cli.js --output dist/bin/cli.js --compact true --string-array true --string-array-encoding base64 && npx javascript-obfuscator dist/src/client.js --output dist/src/client.js --compact true --string-array true && npx javascript-obfuscator dist/src/node-server.js --output dist/src/node-server.js --compact true --string-array true",
24
- "prepublishOnly": "npm run build"
28
+ "build": "bun build src/client.ts --outdir dist/src --target node --minify && bun build src/daemon-capability-display.ts --outdir dist/src --target browser --minify && bun build bin/cli.ts --outdir dist/bin --target node --minify --external @sleep2agi/commhub-server --external bun:sqlite --external '../../server/*' && bun build src/node-server.ts --outdir dist/src --target node --minify && bun build src/im/feishu/worker.ts --outdir dist/src/im/feishu --target node --minify --external @larksuiteoapi/node-sdk && tsc --emitDeclarationOnly --declaration --outDir dist && npx javascript-obfuscator dist/bin/cli.js --output dist/bin/cli.js --compact true --string-array true --string-array-encoding base64 && npx javascript-obfuscator dist/src/client.js --output dist/src/client.js --compact true --string-array true && npx javascript-obfuscator dist/src/node-server.js --output dist/src/node-server.js --compact true --string-array true && node scripts/stamp-node-server-version.mjs && cp bin/anet.cjs dist/bin/anet.cjs",
29
+ "prepublishOnly": "npm run build",
30
+ "prepack": "node scripts/write-build-info.mjs"
25
31
  },
26
32
  "keywords": [
27
33
  "agent",
@@ -54,7 +60,8 @@
54
60
  "directory": "agent-network"
55
61
  },
56
62
  "publishConfig": {
57
- "access": "public"
63
+ "access": "public",
64
+ "tag": "preview"
58
65
  },
59
66
  "bugs": {
60
67
  "url": "https://github.com/sleep2agi/agent-network/issues"
@@ -64,15 +71,18 @@
64
71
  "node": ">=22.13.0"
65
72
  },
66
73
  "dependencies": {
74
+ "smol-toml": "1.9.1",
67
75
  "@inquirer/prompts": "^8.4.3",
68
76
  "@larksuiteoapi/node-sdk": "^1.42.0",
69
77
  "markdown-it": "^14.1.0",
70
- "puppeteer-core": "^24.10.2"
78
+ "puppeteer-core": "^24.10.2",
79
+ "ws": "^8.22.0"
71
80
  },
72
81
  "devDependencies": {
73
- "@modelcontextprotocol/sdk": "^1.12.0",
82
+ "@modelcontextprotocol/sdk": "1.32.0",
74
83
  "@types/markdown-it": "^14.1.2",
75
84
  "@types/node": "^25.0.0",
85
+ "@types/ws": "^8.18.2",
76
86
  "javascript-obfuscator": "^5.4.1",
77
87
  "node-pty": "^1.1.0",
78
88
  "typescript": "^5.0.0"