@sleep2agi/agent-network 2.3.0-preview.26 → 2.3.0-preview.260
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/README.md +35 -324
- package/build-info.json +7 -0
- package/dist/bin/anet.cjs +104 -0
- package/dist/bin/cli.d.ts +1 -1
- package/dist/bin/cli.js +20 -1
- package/dist/src/active-network-task.d.ts +28 -0
- package/dist/src/batch-workdir.d.ts +9 -0
- package/dist/src/bootstrap-password-db.d.ts +13 -0
- package/dist/src/build-info.d.ts +26 -0
- package/dist/src/channel-attachments.d.ts +29 -0
- package/dist/src/channel-inbox-wake.d.ts +21 -0
- package/dist/src/channel-meta.d.ts +10 -0
- package/dist/src/channel-peer-reply.d.ts +41 -0
- package/dist/src/channel-task-trace.d.ts +14 -0
- package/dist/src/claude-vendor-env.d.ts +28 -0
- package/dist/src/cli-args.d.ts +8 -0
- package/dist/src/cli-auth-session.d.ts +47 -0
- package/dist/src/cli-errors.d.ts +41 -0
- package/dist/src/cli-exit.d.ts +11 -0
- package/dist/src/cli-help.d.ts +10 -0
- package/dist/src/cli-version-display.d.ts +16 -0
- package/dist/src/client-task-trace.d.ts +9 -0
- package/dist/src/client.js +1 -1
- package/dist/src/codex-adopt.d.ts +46 -0
- package/dist/src/codex-auth-fingerprint.d.ts +211 -0
- package/dist/src/codex-bin-pin.d.ts +23 -0
- package/dist/src/codex-commhub-mcp.d.ts +22 -0
- package/dist/src/codex-copresence-bridge-log.d.ts +44 -0
- package/dist/src/codex-copresence-env.d.ts +5 -0
- package/dist/src/codex-copresence-login-gate.d.ts +18 -0
- package/dist/src/codex-copresence-model.d.ts +23 -0
- package/dist/src/codex-copresence-preflight.d.ts +78 -0
- package/dist/src/codex-copresence-profile.d.ts +126 -0
- package/dist/src/codex-copresence-recovery.d.ts +70 -0
- package/dist/src/codex-copresence-resume-timeout.d.ts +28 -0
- package/dist/src/codex-copresence-rollout-guard.d.ts +36 -0
- package/dist/src/codex-copresence-rpc.d.ts +17 -0
- package/dist/src/codex-copresence-thread.d.ts +13 -0
- package/dist/src/codex-copresence-yolo.d.ts +16 -0
- package/dist/src/codex-external-appserver.d.ts +130 -0
- package/dist/src/codex-fork-recovery.d.ts +52 -0
- package/dist/src/codex-home-enforce.d.ts +88 -0
- package/dist/src/codex-lifecycle-account.d.ts +104 -0
- package/dist/src/codex-lifecycle-canary.d.ts +20 -0
- package/dist/src/codex-lifecycle-facts.d.ts +53 -0
- package/dist/src/codex-lifecycle-fork.d.ts +91 -0
- package/dist/src/codex-lifecycle-preflight.d.ts +79 -0
- package/dist/src/codex-lifecycle-receipt.d.ts +53 -0
- package/dist/src/codex-lifecycle-restart.d.ts +88 -0
- package/dist/src/codex-login-share-guard.d.ts +146 -0
- package/dist/src/codex-menu.d.ts +99 -0
- package/dist/src/codex-model-default.d.ts +6 -0
- package/dist/src/codex-node-login.d.ts +98 -0
- package/dist/src/codex-pending-thread-restart.d.ts +69 -0
- package/dist/src/codex-reasoning-effort.d.ts +17 -0
- package/dist/src/codex-recovery-lease.d.ts +39 -0
- package/dist/src/codex-recovery-resource-gate.d.ts +15 -0
- package/dist/src/codex-resume.d.ts +89 -0
- package/dist/src/codex-rollout-history-guard.d.ts +84 -0
- package/dist/src/codex-tui-client-health.d.ts +30 -0
- package/dist/src/commhub-response.d.ts +1 -0
- package/dist/src/controlled-upload.d.ts +83 -0
- package/dist/src/copresence-deps.d.ts +22 -0
- package/dist/src/copresence-identity.d.ts +363 -0
- package/dist/src/copresence-startup-diagnosis.d.ts +17 -0
- package/dist/src/daemon-adopt.d.ts +14 -0
- package/dist/src/daemon-anet-bin.d.ts +32 -0
- package/dist/src/daemon-capability-display.d.ts +110 -0
- package/dist/src/daemon-capability-display.js +21 -0
- package/dist/src/daemon-codex-inventory.d.ts +65 -0
- package/dist/src/daemon-inherited-env.d.ts +9 -0
- package/dist/src/daemon-provider-account-custody.d.ts +28 -0
- package/dist/src/daemon-provider-account-readback.d.ts +3 -0
- package/dist/src/daemon-provider-application.d.ts +36 -0
- package/dist/src/daemon-provider-apply-command.d.ts +9 -0
- package/dist/src/daemon-provider-collect.d.ts +29 -0
- package/dist/src/daemon-provider-command.d.ts +7 -0
- package/dist/src/daemon-provider-initialize.d.ts +27 -0
- package/dist/src/daemon-provider-lifecycle.d.ts +4 -0
- package/dist/src/daemon-provider-store.d.ts +104 -0
- package/dist/src/daemon-runtime-path-preflight.d.ts +22 -0
- package/dist/src/daemon-runtime-staleness.d.ts +13 -0
- package/dist/src/dashboard-managed-process.d.ts +35 -0
- package/dist/src/display-width.d.ts +27 -0
- package/dist/src/doctor-node-count.d.ts +28 -0
- package/dist/src/grok-attach-client.d.ts +129 -0
- package/dist/src/grok-build-drift.d.ts +15 -0
- package/dist/src/grok-copresence-disclosure.d.ts +11 -0
- package/dist/src/grok-copresence-orchestration.d.ts +75 -0
- package/dist/src/grok-copresence-profile.d.ts +65 -0
- package/dist/src/grok-create-mode.d.ts +19 -0
- package/dist/src/host-telemetry.d.ts +14 -0
- package/dist/src/hub-health-timeout.d.ts +4 -0
- package/dist/src/hub-server-version.d.ts +64 -0
- package/dist/src/hub-stop.d.ts +74 -0
- package/dist/src/hub-time-display.d.ts +20 -0
- package/dist/src/hub-version-skew.d.ts +19 -0
- package/dist/src/im/correlation-store.d.ts +34 -0
- package/dist/src/im/feishu/adapter.d.ts +47 -0
- package/dist/src/im/feishu/bridge.d.ts +72 -14
- package/dist/src/im/feishu/chat-context.d.ts +44 -0
- package/dist/src/im/feishu/config.d.ts +15 -1
- package/dist/src/im/feishu/hub-upload.d.ts +1 -1
- package/dist/src/im/feishu/queue-notice.d.ts +2 -0
- package/dist/src/im/feishu/worker-lifecycle.d.ts +13 -0
- package/dist/src/im/feishu/worker.js +171 -154
- package/dist/src/inbox-drain.d.ts +20 -0
- package/dist/src/local-process-state.d.ts +12 -0
- package/dist/src/locale-diagnostic.d.ts +12 -0
- package/dist/src/login-client-label.d.ts +6 -0
- package/dist/src/ls-columns.d.ts +15 -0
- package/dist/src/mock-llm.d.ts +12 -0
- package/dist/src/node-activity-log.d.ts +4 -0
- package/dist/src/node-clone.d.ts +134 -0
- package/dist/src/node-delete-hub.d.ts +42 -0
- package/dist/src/node-files.d.ts +62 -0
- package/dist/src/node-locate.d.ts +60 -0
- package/dist/src/node-ls-all.d.ts +80 -0
- package/dist/src/node-menu.d.ts +40 -0
- package/dist/src/node-not-found.d.ts +1 -0
- package/dist/src/node-perm.d.ts +74 -0
- package/dist/src/node-remote.d.ts +180 -0
- package/dist/src/node-running-guard.d.ts +9 -0
- package/dist/src/node-secret-file.d.ts +32 -0
- package/dist/src/node-server-identity.d.ts +35 -0
- package/dist/src/node-server-payload.d.ts +66 -0
- package/dist/src/node-server-rules-file.d.ts +14 -0
- package/dist/src/node-server-secrets.d.ts +60 -0
- package/dist/src/node-server-version.d.ts +39 -0
- package/dist/src/node-server.d.ts +0 -12
- package/dist/src/node-server.js +8 -1
- package/dist/src/node-skills.d.ts +57 -0
- package/dist/src/normalize-runtime.d.ts +28 -9
- package/dist/src/offline-age.d.ts +29 -0
- package/dist/src/one-line-cell.d.ts +20 -0
- package/dist/src/opencode-agent-node-pair.d.ts +52 -0
- package/dist/src/opencode-auth-login.d.ts +43 -0
- package/dist/src/opencode-free-tier.d.ts +27 -0
- package/dist/src/opencode-generation-create.d.ts +27 -0
- package/dist/src/opencode-generation-record.d.ts +24 -0
- package/dist/src/opencode-launch-env.d.ts +13 -0
- package/dist/src/opencode-owner-mode.d.ts +6 -0
- package/dist/src/opencode-package-binary.d.ts +44 -0
- package/dist/src/opencode-pin.d.ts +28 -8
- package/dist/src/opencode-preset.d.ts +42 -8
- package/dist/src/opencode-runtime-binding.d.ts +30 -0
- package/dist/src/opencode-safe-root.d.ts +36 -0
- package/dist/src/opencode-shared-server-create.d.ts +5 -0
- package/dist/src/opencode-smoke-env.d.ts +1 -0
- package/dist/src/opencode-start-mode.d.ts +8 -0
- package/dist/src/opencode-v2-configured-model.d.ts +34 -0
- package/dist/src/opencode-v2-create-align.d.ts +18 -0
- package/dist/src/opencode-versions.d.ts +44 -0
- package/dist/src/os-user.d.ts +4 -0
- package/dist/src/outbound-attachments.d.ts +60 -0
- package/dist/src/outbound-tool-names.d.ts +1 -0
- package/dist/src/owned-roots.d.ts +58 -0
- package/dist/src/owner-env-file.d.ts +2 -0
- package/dist/src/package-mode-preflight.d.ts +41 -0
- package/dist/src/posix-codex-copresence.d.ts +33 -0
- package/dist/src/posix-modes.d.ts +36 -0
- package/dist/src/primary-network.d.ts +23 -0
- package/dist/src/private-state.d.ts +18 -0
- package/dist/src/process-telemetry.d.ts +12 -0
- package/dist/src/profile-merge.d.ts +12 -0
- package/dist/src/profile-serialize.d.ts +1 -0
- package/dist/src/provider-application-contract.d.ts +11 -0
- package/dist/src/provider-apply.d.ts +28 -0
- package/dist/src/provider-presets.d.ts +76 -0
- package/dist/src/reply-local-links.d.ts +47 -0
- package/dist/src/reply-originator.d.ts +20 -0
- package/dist/src/resume-runtime-infer.d.ts +18 -0
- package/dist/src/rules-file.d.ts +76 -0
- package/dist/src/scoped-secrets.d.ts +56 -0
- package/dist/src/secret-shell-guidance.d.ts +4 -0
- package/dist/src/session-status-class.d.ts +48 -0
- package/dist/src/shared/opencode-borrowed-launch-health.d.ts +29 -0
- package/dist/src/shared/private-file.d.ts +65 -0
- package/dist/src/shared/provider-collection.d.ts +9 -0
- package/dist/src/shared/provider-initialization.d.ts +7 -0
- package/dist/src/shared/reserved-env.d.ts +3 -0
- package/dist/src/shared/scoped-secret-contract.d.ts +1 -0
- package/dist/src/shared/scoped-secret-env.d.ts +3 -0
- package/dist/src/sibling-agent-node.d.ts +23 -0
- package/dist/src/stale-socket.d.ts +118 -0
- package/dist/src/standalone-bin.d.ts +101 -0
- package/dist/src/standalone-build-stamp.d.ts +33 -0
- package/dist/src/start-resource-gate.d.ts +146 -0
- package/dist/src/stopped-receipt.d.ts +8 -0
- package/dist/src/subcommand-redirect.d.ts +26 -0
- package/dist/src/task-trace.d.ts +33 -0
- package/dist/src/tmux-attach.d.ts +11 -0
- package/dist/src/tmux-capability.d.ts +58 -0
- package/dist/src/tmux-exact-target.d.ts +36 -0
- package/dist/src/tmux-format.d.ts +20 -0
- package/dist/src/tmux-pane-prompt.d.ts +22 -0
- package/dist/src/tmux.d.ts +44 -0
- package/dist/src/token-cli.d.ts +13 -0
- package/dist/src/tool-allowlist.d.ts +28 -0
- package/dist/src/unsafe-package-path-reason.d.ts +31 -0
- package/dist/src/upgrade-channel.d.ts +31 -0
- package/dist/src/win-launcher.d.ts +20 -0
- package/dist/src/windows-codex-copresence.d.ts +254 -0
- package/dist/src/windows-rename-retry.d.ts +13 -0
- package/dist/src/windows-runtime.d.ts +63 -0
- package/dist/src/windows-sdk-stop-evidence.d.ts +24 -0
- package/package.json +19 -9
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export declare const RULES_FILE_MAX_BYTES: number;
|
|
2
|
+
export type RulesFileName = "CLAUDE.md" | "AGENTS.md";
|
|
3
|
+
/** claude 节点读 CLAUDE.md,其余运行时(codex / grok / opencode / codex-app-server)读 AGENTS.md。 */
|
|
4
|
+
export declare function rulesFileNameForRuntime(runtime: string | null | undefined): RulesFileName;
|
|
5
|
+
/**
|
|
6
|
+
* 唯一的路径来源。输入里没有任何调用方可控的路径成分;结果再用 dirname
|
|
7
|
+
* 反查一遍,防止将来有人给 workDir 传进带 `..` 的东西。
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveRulesFilePath(workDir: string, runtime: string | null | undefined): string;
|
|
10
|
+
export interface RulesFileReadResult {
|
|
11
|
+
file_name: RulesFileName;
|
|
12
|
+
exists: boolean;
|
|
13
|
+
content: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function readRulesFile(workDir: string, runtime: string | null | undefined): Promise<RulesFileReadResult>;
|
|
16
|
+
export interface RulesFileWriteResult {
|
|
17
|
+
file_name: RulesFileName;
|
|
18
|
+
bytes: number;
|
|
19
|
+
}
|
|
20
|
+
/** 临时文件 + rename,写一半掉电不会留下半个规则文件。 */
|
|
21
|
+
export declare function writeRulesFile(workDir: string, runtime: string | null | undefined, content: unknown): Promise<RulesFileWriteResult>;
|
|
22
|
+
export interface RulesFileRequest {
|
|
23
|
+
request_id: string;
|
|
24
|
+
/** read/write = 规则文件;skills_list/skill_read = 只读技能(node-skills.ts),content 是技能名;
|
|
25
|
+
* files_list/file_read = 只读项目文件夹(node-files.ts),content 是相对工作目录的路径;
|
|
26
|
+
* logs_tail = 只读本节点运行日志(node-logs.ts),content 是过滤参数 JSON(没有路径)。 */
|
|
27
|
+
op: "read" | "write" | "skills_list" | "skill_read" | "files_list" | "file_read" | "logs_tail"
|
|
28
|
+
/** 2026-11-20 — agy 登录(handoff/agy-login-channel-design.md)。start 的 content 为空;
|
|
29
|
+
* submit 的 content 是 hub 转来的 {login_id, code}(授权码只进子进程 stdin,不写日志)。 */
|
|
30
|
+
| "agy_login_start" | "agy_login_submit";
|
|
31
|
+
content?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ProcessRulesFileDeps {
|
|
34
|
+
callCommHub: (method: string, params: Record<string, unknown>) => Promise<any>;
|
|
35
|
+
runtime: string | null | undefined;
|
|
36
|
+
workDir: string;
|
|
37
|
+
log: (msg: string) => void;
|
|
38
|
+
warn: (msg: string) => void;
|
|
39
|
+
/** 技能根目录用;缺省取 os.homedir() / process.env.CODEX_HOME。 */
|
|
40
|
+
home?: string;
|
|
41
|
+
codexHome?: string;
|
|
42
|
+
/** logs_tail 用:读本进程自己的日志并脱敏(agent-node 的 runtime/node-logs.ts,由 cli.ts 注入)。
|
|
43
|
+
* 参数是 hub 转来的过滤 JSON;没有路径。缺省(例如 claude-code 通道进程)时 logs_tail 回 failed。 */
|
|
44
|
+
logsTail?: (rawParams: string | undefined) => Promise<{
|
|
45
|
+
files: string[];
|
|
46
|
+
lines: unknown[];
|
|
47
|
+
matched: number;
|
|
48
|
+
}>;
|
|
49
|
+
/** agy 登录会话管理器(agy-login.ts 的 createAgyLoginManager());非 antigravity 节点不注入。 */
|
|
50
|
+
agyLogin?: {
|
|
51
|
+
start(): Promise<{
|
|
52
|
+
ok: true;
|
|
53
|
+
session: {
|
|
54
|
+
loginId: string;
|
|
55
|
+
url: string;
|
|
56
|
+
expiresAt: number;
|
|
57
|
+
};
|
|
58
|
+
} | {
|
|
59
|
+
ok: false;
|
|
60
|
+
reason: string;
|
|
61
|
+
}>;
|
|
62
|
+
submit(loginId: string, code: string): Promise<{
|
|
63
|
+
ok: true;
|
|
64
|
+
} | {
|
|
65
|
+
ok: false;
|
|
66
|
+
reason: string;
|
|
67
|
+
}>;
|
|
68
|
+
cancel(loginId?: string): boolean;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** 一次门铃最多处理这么多条,防止 hub 侧异常堆积把节点拖进死循环。 */
|
|
72
|
+
export declare const RULES_FILE_MAX_PER_DOORBELL = 8;
|
|
73
|
+
/** Doorbells, reconnects and polling share one drain per authenticated client. */
|
|
74
|
+
export declare function processRulesFileRequests(deps: ProcessRulesFileDeps): Promise<number>;
|
|
75
|
+
export declare const RULES_FILE_POLL_MS = 15000;
|
|
76
|
+
export declare function startRulesFilePolling(deps: ProcessRulesFileDeps, intervalMs?: number): () => void;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const validSecretKey: (key: unknown) => key is string;
|
|
2
|
+
export declare const validSecretValue: (v: unknown) => v is string;
|
|
3
|
+
type Target = {
|
|
4
|
+
node_id: string;
|
|
5
|
+
alias: string;
|
|
6
|
+
};
|
|
7
|
+
type State = {
|
|
8
|
+
schema: 1;
|
|
9
|
+
network_id: string;
|
|
10
|
+
daemon_node_id: string;
|
|
11
|
+
revision: number;
|
|
12
|
+
defaults: Record<string, string>;
|
|
13
|
+
nodes: Record<string, Record<string, string>>;
|
|
14
|
+
last?: {
|
|
15
|
+
request_id: string;
|
|
16
|
+
digest: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare function readScopedState(path: string): State;
|
|
20
|
+
export declare function bindScopedNodeSecrets(daemonDir: string, nodeDir: string): void;
|
|
21
|
+
export declare function operateScopedSecrets(nodesDir: string, daemonAlias: string, input: any): {
|
|
22
|
+
network_id: string;
|
|
23
|
+
daemon_node_id: string;
|
|
24
|
+
node_id: string | null;
|
|
25
|
+
revision: number;
|
|
26
|
+
activation: string;
|
|
27
|
+
keys: {
|
|
28
|
+
key: string;
|
|
29
|
+
source: string;
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
export declare function runDaemonSecret(args: string[], deps: {
|
|
33
|
+
nodesDir: string;
|
|
34
|
+
readInput: () => string;
|
|
35
|
+
print: (text: string) => void;
|
|
36
|
+
}): number;
|
|
37
|
+
export declare const DAEMON_SECRET_USAGE = "Usage: anet daemon secret list <daemon> [--node <alias>] [--json]\n anet daemon secret set <daemon> <KEY> --from-env <VAR> (--node <alias> | --all)\n anet daemon secret unset <daemon> <KEY> (--node <alias> | --all)\n\nManage <daemon>/scoped-secrets.json \u2014 the env secrets this daemon hands to its\nchild nodes on their next start (0600). Values only come from an env var\n(--from-env) or stdin; they never appear in argv, in the receipt, or in GET.\n\n anet daemon secret list daemon-dev\n anet daemon secret set daemon-dev DEEPSEEK_API_KEY --from-env MY_KEY --all\n anet daemon secret set daemon-dev DEEPSEEK_API_KEY --from-env MY_KEY --node \u901A\u4FE1\u6B27\n printf '%s' \"$KEY\" | anet daemon secret set daemon-dev DEEPSEEK_API_KEY --node \u901A\u4FE1\u6B27\n anet daemon secret unset daemon-dev DEEPSEEK_API_KEY --node \u901A\u4FE1\u6B27\n\n--node <alias> writes that child only; --all writes the daemon-wide default.\nA set/unset without one of the two is refused: silently writing a default that\nreaches every child is a permission decision, never an accident.\nlist without --node shows the defaults; list --node also marks node overrides.\nNo secrets file is a normal state (exit 0).";
|
|
38
|
+
/** Every managed child of this daemon, in this .anet root. Local identities only. */
|
|
39
|
+
export declare function scopedSecretTargets(nodesDir: string, daemonAlias: string): {
|
|
40
|
+
network_id: string;
|
|
41
|
+
daemon_node_id: string;
|
|
42
|
+
targets: Target[];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* #1509 — the friendlier `anet daemon secret list/set/unset` over the same
|
|
46
|
+
* scoped lane (operateScopedSecrets). It only builds the request object: the
|
|
47
|
+
* read/write, CAS, binding and atomic write stay in one place.
|
|
48
|
+
* Values come from --from-env or stdin, never argv.
|
|
49
|
+
*/
|
|
50
|
+
export declare function runDaemonSecretCli(argv: string[], deps: {
|
|
51
|
+
nodesDir: string;
|
|
52
|
+
readInput: () => string;
|
|
53
|
+
print: (text: string) => void;
|
|
54
|
+
env?: NodeJS.ProcessEnv;
|
|
55
|
+
}): number;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function formatSecretAssignment(platform: string, name: string, value: string): string;
|
|
2
|
+
export declare function secretPersistenceHeading(platform: string): string;
|
|
3
|
+
export declare function secretShellAction(platform: string): "set" | "export";
|
|
4
|
+
export declare function formatSecretLoadCommand(platform: string, name: string, dotenvPath: string): string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `anet status` 的会话状态分类。
|
|
3
|
+
*
|
|
4
|
+
* 🔴 为什么单独成文件:原先它是 statusCommand 里的一个闭包,没有任何测试碰得到它 ——
|
|
5
|
+
* 而它决定了运维看到的那三个数字。一个把「卡住」算成「在干活」的分类器,
|
|
6
|
+
* 和一个正确的分类器,在输出上长得一模一样(都是一个数)。
|
|
7
|
+
*
|
|
8
|
+
* 🔴 改了什么:`blocked` / `error` 原先被折进 `working`。
|
|
9
|
+
* 它们的含义是**需要人看一眼**,不是**正在推进**。
|
|
10
|
+
* 运维看到「5 working」会认为一切正常,而其中可能有几个卡了很久 ——
|
|
11
|
+
* #1548 已经证明 `blocked` 是一个**没有出口**的状态:
|
|
12
|
+
* 只有 report_completion 能把它拉回 idle,所以一个 agent 可以永远停在那里。
|
|
13
|
+
*
|
|
14
|
+
* `waiting_input` 保留在 working 里:它是一个**进行中的回合**在等人,
|
|
15
|
+
* 与 blocked/error 不同 —— 那是回合本身出了问题。
|
|
16
|
+
*/
|
|
17
|
+
export type SessionClass = "idle" | "working" | "attention" | "offline";
|
|
18
|
+
export declare function classifySessionStatus(raw: unknown): SessionClass;
|
|
19
|
+
/**
|
|
20
|
+
* `anet status` 顶部那三/四个数字。
|
|
21
|
+
*
|
|
22
|
+
* 🔴 为什么它必须和上面的分类器用同一套判据(#1625):
|
|
23
|
+
* 原先 `cli.ts` 是 `statusRes.summary || sessions.reduce(…)`,而
|
|
24
|
+
* `/api/status` **总是**返回 summary ⇒ 右边那支从不执行,屏幕上的数字
|
|
25
|
+
* 来自**服务端**一份还停在 #1548 之前的分类(它把 `blocked`/`error`
|
|
26
|
+
* 折进 `working`)。于是一个 blocked 节点同时出现在 `working` 和
|
|
27
|
+
* `needs attention` 两格里,四个数加起来比总数多一个。
|
|
28
|
+
*
|
|
29
|
+
* 🔴 为什么本地算是安全的:`/api/status` 只加 `addNetworkScope`,没有任何
|
|
30
|
+
* 状态/别名过滤,而它的 summary 就是从**同一个 sessions 数组** reduce 出来的
|
|
31
|
+
* —— 两者范围逐字相同。(这一点对 MCP 的 `get_all_status` **不成立**:
|
|
32
|
+
* 那边 summary 走独立的 `GROUP BY status` 查询、无视 filter,所以别照搬。)
|
|
33
|
+
*
|
|
34
|
+
* 🔴 `attention` 必须显式初始化为 0。原来的累加器只有
|
|
35
|
+
* `{idle, working, offline, total}`,`acc["attention"]++` 会得到 **NaN**,
|
|
36
|
+
* 而 `summary.attention ?? attention.length` 里的 `??` **不接 NaN**,
|
|
37
|
+
* 屏幕会印 `NaN needs attention`。那一支从不执行,所以从没人见过。
|
|
38
|
+
*/
|
|
39
|
+
export type SessionSummary = {
|
|
40
|
+
idle: number;
|
|
41
|
+
working: number;
|
|
42
|
+
attention: number;
|
|
43
|
+
offline: number;
|
|
44
|
+
total: number;
|
|
45
|
+
};
|
|
46
|
+
export declare function summarizeSessions(sessions: Array<{
|
|
47
|
+
status?: unknown;
|
|
48
|
+
}>): SessionSummary;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const BORROWED_LAUNCH_HEALTH = "opencode-borrowed-v1-launch.json";
|
|
2
|
+
export declare function hasBorrowedV1Intent(dir: string, config: any): boolean;
|
|
3
|
+
/** Read-only preflight. Runtime admission still validates the independent Host,
|
|
4
|
+
* binary, original credentials, native directory/session and cooperative lease. */
|
|
5
|
+
export declare function readBorrowedLaunchConfig(configPath: string, cwd?: string): {
|
|
6
|
+
selection: any;
|
|
7
|
+
alias: any;
|
|
8
|
+
model: any;
|
|
9
|
+
stamp: number[];
|
|
10
|
+
};
|
|
11
|
+
export declare function publishBorrowedLaunchHealth(configPath: string, nonce: string): () => void;
|
|
12
|
+
export declare function inspectBorrowedLaunchHealth(configPath: string, launchedAt: number, nonce?: string): {
|
|
13
|
+
ok: true;
|
|
14
|
+
bridgePid: number;
|
|
15
|
+
reason?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
ok: false;
|
|
18
|
+
reason: string;
|
|
19
|
+
bridgePid?: undefined;
|
|
20
|
+
};
|
|
21
|
+
export declare function waitForBorrowedLaunchHealth(configPath: string, launchedAt: number, deadline: number, nonce?: string): Promise<{
|
|
22
|
+
ok: true;
|
|
23
|
+
bridgePid: number;
|
|
24
|
+
reason?: undefined;
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
reason: string;
|
|
28
|
+
bridgePid?: undefined;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export type PrivateFileVerdict = {
|
|
2
|
+
ok: true;
|
|
3
|
+
} | {
|
|
4
|
+
ok: false;
|
|
5
|
+
reason: "not_a_file" | "group_or_other_access" | "acl_unreadable" | "acl_open_to_others" | "reparse_point" | "unsupported_volume" | "owner_untrusted";
|
|
6
|
+
detail: string;
|
|
7
|
+
/** Set when the Windows probe identified the caller; lets the fix command be shell-neutral. */
|
|
8
|
+
currentUserSid?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const WINDOWS_SYSTEM_SID = "S-1-5-18";
|
|
11
|
+
export declare const WINDOWS_ADMINISTRATORS_SID = "S-1-5-32-544";
|
|
12
|
+
/** The probe. The path arrives in an environment variable and is only ever used as a literal. */
|
|
13
|
+
export declare const WINDOWS_ACL_PROBE: string;
|
|
14
|
+
export type WindowsAclEntry = {
|
|
15
|
+
sid: string;
|
|
16
|
+
type: string;
|
|
17
|
+
rights: string;
|
|
18
|
+
inherited: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type WindowsAclSnapshot = {
|
|
21
|
+
currentUserSid: string;
|
|
22
|
+
ownerSid: string;
|
|
23
|
+
isReparsePoint: boolean;
|
|
24
|
+
isDirectory: boolean;
|
|
25
|
+
protected: boolean;
|
|
26
|
+
driveFormat: string;
|
|
27
|
+
access: WindowsAclEntry[];
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Parses the probe's JSON exactly as Windows PowerShell 5.1 / PowerShell 7 print it: an optional
|
|
31
|
+
* UTF-8 BOM, CRLF, and `access` as a single object when the list has one entry.
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseWindowsAclProbe(raw: string): {
|
|
34
|
+
snapshot: WindowsAclSnapshot;
|
|
35
|
+
} | {
|
|
36
|
+
error: string;
|
|
37
|
+
};
|
|
38
|
+
/** Pure verdict from a probe snapshot. */
|
|
39
|
+
export declare function judgeWindowsAcl(s: WindowsAclSnapshot): PrivateFileVerdict;
|
|
40
|
+
export type WindowsAclReader = (path: string) => {
|
|
41
|
+
raw: string;
|
|
42
|
+
} | {
|
|
43
|
+
error: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Runs the probe. The script is passed base64-encoded and the path in an environment variable,
|
|
47
|
+
* never on the command line: paths with spaces, CJK characters, quotes or `[` `]` need no
|
|
48
|
+
* escaping, and nothing about the file shows up in a process listing.
|
|
49
|
+
*/
|
|
50
|
+
export declare const readWindowsAcl: WindowsAclReader;
|
|
51
|
+
export declare function isPrivateFile(path: string, deps?: {
|
|
52
|
+
platform?: NodeJS.Platform;
|
|
53
|
+
readAcl?: WindowsAclReader;
|
|
54
|
+
}): PrivateFileVerdict;
|
|
55
|
+
/**
|
|
56
|
+
* One sentence a person can act on. Names the file and the command that fixes it; never the
|
|
57
|
+
* file's contents. With the caller's SID the Windows command works unchanged in cmd.exe and in
|
|
58
|
+
* PowerShell, and in any system language; without it, it is a PowerShell line that looks the SID up.
|
|
59
|
+
*/
|
|
60
|
+
export declare function privateFileFix(path: string, platform?: NodeJS.Platform, currentUserSid?: string): string;
|
|
61
|
+
/** Throws `<code>: <what is wrong>. <how to fix>` unless the file is private. */
|
|
62
|
+
export declare function assertPrivateFile(path: string, code: string, deps?: {
|
|
63
|
+
platform?: NodeJS.Platform;
|
|
64
|
+
readAcl?: WindowsAclReader;
|
|
65
|
+
}): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const validScopedSecretKey: (key: unknown) => key is string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface SiblingAgentNode {
|
|
2
|
+
/** 直接可 `node <entrypoint>` 的文件。 */
|
|
3
|
+
entrypoint: string;
|
|
4
|
+
packageDir: string;
|
|
5
|
+
version: string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface SiblingFs {
|
|
8
|
+
exists(path: string): boolean;
|
|
9
|
+
readJson(path: string): unknown;
|
|
10
|
+
/**
|
|
11
|
+
* #1832 —— npm -g / --prefix 布局下 process.argv[1] 是 `<prefix>/bin/anet` 符号链接,真实文件在
|
|
12
|
+
* `<prefix>/lib/node_modules/@sleep2agi/agent-network/…`;不解析就从 `<prefix>/bin` 往上找不到
|
|
13
|
+
* node_modules,旁边的 agent-node 永远命不中。可选:不提供或抛错时按传入路径原样找。
|
|
14
|
+
*/
|
|
15
|
+
realpath?(path: string): string;
|
|
16
|
+
}
|
|
17
|
+
/** 入口路径先走 realpath(符号链接 → 真实文件);失败(不存在 / 无权限)退回原路径。 */
|
|
18
|
+
export declare function resolveCliEntry(cliEntry: string, fs: SiblingFs): string;
|
|
19
|
+
/** 从 anet 入口文件路径往上,返回最近的 `…/node_modules` 目录;找不到返回 null。 */
|
|
20
|
+
export declare function nearestNodeModules(cliEntry: string): string | null;
|
|
21
|
+
/** package.json 的 bin 可以是字符串或 { name: path };只认名为 agent-node 的那条。 */
|
|
22
|
+
export declare function binEntryFromPackageJson(pkg: unknown): string | null;
|
|
23
|
+
export declare function siblingAgentNodeEntrypoint(cliEntry: string, fs: SiblingFs): SiblingAgentNode | null;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export interface StaleSocketProbes {
|
|
2
|
+
/** 读 /proc/net/unix 全文;读不到就 throw(调用方按 fail-closed 处理)。 */
|
|
3
|
+
procNetUnix(): string;
|
|
4
|
+
/** 路径不存在返回 null。 */
|
|
5
|
+
lstat(path: string): {
|
|
6
|
+
dev: number;
|
|
7
|
+
ino: number;
|
|
8
|
+
uid: number;
|
|
9
|
+
isSocket: boolean;
|
|
10
|
+
} | null;
|
|
11
|
+
unlink(path: string): void;
|
|
12
|
+
/** 当前进程 uid —— 只回收自己拥有的 socket。 */
|
|
13
|
+
currentUid(): number;
|
|
14
|
+
}
|
|
15
|
+
export interface ReapScope {
|
|
16
|
+
/**
|
|
17
|
+
* 只允许回收这个目录**之下**的路径。
|
|
18
|
+
* 🔴 这一格防的不是文件系统竞态,是**被污染的 identity**:socket 路径来自
|
|
19
|
+
* profile,如果 profile 被写坏成 `/run/systemd/private` 之类,前面所有
|
|
20
|
+
* "无监听者"检查都会照常通过,然后 unlink 掉一个不属于这个节点的东西。
|
|
21
|
+
* 删除不可逆,所以范围校验必须在**所有**其它检查之前。
|
|
22
|
+
*/
|
|
23
|
+
allowedRoot: string;
|
|
24
|
+
}
|
|
25
|
+
export type ReapOutcome =
|
|
26
|
+
/** 路径已经不在了 —— 正常的成功拆卸,无事可做。 */
|
|
27
|
+
{
|
|
28
|
+
kind: "absent";
|
|
29
|
+
}
|
|
30
|
+
/** 确认无人引用,已删除。 */
|
|
31
|
+
| {
|
|
32
|
+
kind: "removed";
|
|
33
|
+
}
|
|
34
|
+
/** /proc/net/unix 里仍能找到这个路径 ⇒ 有人在用,**不删**,调用方应判红。 */
|
|
35
|
+
| {
|
|
36
|
+
kind: "in-use";
|
|
37
|
+
}
|
|
38
|
+
/** /proc/net/unix 读不到 ⇒ fail-closed,不删。 */
|
|
39
|
+
| {
|
|
40
|
+
kind: "unreadable";
|
|
41
|
+
detail: string;
|
|
42
|
+
}
|
|
43
|
+
/** 检查与删除之间文件身份变了(dev/ino/uid),或已不是 socket ⇒ 不删。 */
|
|
44
|
+
| {
|
|
45
|
+
kind: "changed";
|
|
46
|
+
}
|
|
47
|
+
/** 路径不在该节点自己的 runtime 目录之下 ⇒ 一律不删。 */
|
|
48
|
+
| {
|
|
49
|
+
kind: "out-of-scope";
|
|
50
|
+
detail: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* `/proc/net/unix` 的每一行以路径结尾(没有绑定路径的行就没有这一列)。
|
|
54
|
+
* 这里只问「这个路径出现过没有」,不解释 flags/type/state。
|
|
55
|
+
*/
|
|
56
|
+
export declare function unixSocketPathInUse(procNetUnix: string, path: string): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* 属主进程**已被证明消失之后**,回收一个陈旧的 socket 路径名。
|
|
59
|
+
* 任何一种不确定都不删 —— 删文件不可逆,而留下一个 socket 只是让 stop 判红,
|
|
60
|
+
* 那正是本函数之前的行为。
|
|
61
|
+
*/
|
|
62
|
+
export declare function reapStaleSocket(path: string, probes: StaleSocketProbes, scope: ReapScope): ReapOutcome;
|
|
63
|
+
/**
|
|
64
|
+
* 从「本次 stop 看到的残留路径」里挑出**允许回收**的那些。
|
|
65
|
+
*
|
|
66
|
+
* 🔴 判据是「与重新算出来的规范路径**完全相等**」,不是前缀、不是包含。
|
|
67
|
+
* profile 里存的 socket 路径是**被写坏就会跟着坏**的数据;
|
|
68
|
+
* grokCopresenceSocketPaths 是纯函数,同样的 nodeId + home 永远算出同一个值。
|
|
69
|
+
* 所以这里不问「这条路径看起来对不对」,只问「它是不是我自己算出来的那两个之一」。
|
|
70
|
+
* ——一个被污染的 profile 因此一条都带不进来。
|
|
71
|
+
*/
|
|
72
|
+
export declare function planReapableSockets(canonical: {
|
|
73
|
+
leaderSocket: string;
|
|
74
|
+
attachSocket: string;
|
|
75
|
+
}, residualPaths: readonly (string | undefined)[]): string[];
|
|
76
|
+
export interface CanonicalSocketProfile {
|
|
77
|
+
node_id?: string;
|
|
78
|
+
grokLeaderSocket?: string;
|
|
79
|
+
grokAttachSocket?: string;
|
|
80
|
+
}
|
|
81
|
+
export type CanonicalSocketsOutcome = {
|
|
82
|
+
kind: "ok";
|
|
83
|
+
leaderSocket: string;
|
|
84
|
+
attachSocket: string;
|
|
85
|
+
}
|
|
86
|
+
/** profile 里没有 node_id —— 算不出来,不动手。 */
|
|
87
|
+
| {
|
|
88
|
+
kind: "no-node-id";
|
|
89
|
+
}
|
|
90
|
+
/** 重新算出来的与 profile 存的不一致 —— profile 被写坏、HOME 变了、或**调用方喂错了 id**。 */
|
|
91
|
+
| {
|
|
92
|
+
kind: "mismatch";
|
|
93
|
+
recomputedLeader: string;
|
|
94
|
+
storedLeader: string;
|
|
95
|
+
}
|
|
96
|
+
/** 路径算不出来(grokCopresenceSocketPaths 抛错)—— 不动手,但也不该把 stop 整个弄失败。 */
|
|
97
|
+
| {
|
|
98
|
+
kind: "uncomputable";
|
|
99
|
+
detail: string;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* 从 profile 推出规范 socket 路径,并**与 profile 里存的那份交叉校验**。
|
|
103
|
+
*
|
|
104
|
+
* 🔴 这个交叉校验是一次真实缺陷催生的,不是补全性写的:
|
|
105
|
+
* 我第一版在 cli.ts 里写的是 `grokCopresenceSocketPaths(resolved.id)`,而
|
|
106
|
+
* `resolveNodeRef` 返回的 `id` 是**目录名(别名)**,socket 路径却是
|
|
107
|
+
* `anet node create` 用 **node_id** 算的。两者哈希不同 ⇒ 算出的路径永远对不上 ⇒
|
|
108
|
+
* 可回收集合恒为空 ⇒ **一条都回收不了,而且完全静默**(循环体一次都不进)。
|
|
109
|
+
* 12 轮验收里 4 次红、0 次回收,红话与修复前逐字相同 —— 从外面看,
|
|
110
|
+
* 「守卫拒绝了一切」和「这个修复不存在」是同一个样子。
|
|
111
|
+
*
|
|
112
|
+
* 所以判据不能只是「算一个路径出来」,必须是「算出来的和存着的对得上」。
|
|
113
|
+
* 对不上就说出来,别静默跳过。
|
|
114
|
+
*/
|
|
115
|
+
export declare function canonicalSocketsForProfile(profile: CanonicalSocketProfile, compute: (nodeId: string) => {
|
|
116
|
+
leaderSocket: string;
|
|
117
|
+
attachSocket: string;
|
|
118
|
+
}): CanonicalSocketsOutcome;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers for the standalone `anet` executable (`bun build --compile`).
|
|
3
|
+
*
|
|
4
|
+
* npm/node keeps today's behavior: these functions are identity transforms
|
|
5
|
+
* when `stamp.standalone` is false. The compiled binary sets the stamp at
|
|
6
|
+
* build time (`scripts/build-anet-bin.mjs`) and routes Hub / agent-node
|
|
7
|
+
* through internal argv (`__hub` / `__node`) because `process.execPath` is
|
|
8
|
+
* the `anet` binary itself, not bun or node.
|
|
9
|
+
*/
|
|
10
|
+
import { STANDALONE_BUILD_STAMP, type StandaloneBuildStamp, type StandalonePackageVersions } from "./standalone-build-stamp";
|
|
11
|
+
export type { StandaloneBuildStamp, StandalonePackageVersions };
|
|
12
|
+
export { STANDALONE_BUILD_STAMP };
|
|
13
|
+
/** Internal argv. Not user-facing commands; the unified entry strips them. */
|
|
14
|
+
export declare const STANDALONE_HUB_ARG = "__hub";
|
|
15
|
+
export declare const STANDALONE_NODE_ARG = "__node";
|
|
16
|
+
export declare const STANDALONE_PRINT_CONFIG_TOKEN_ARG = "__print-config-token";
|
|
17
|
+
export type StandaloneDispatchKind = "cli" | "hub" | "node" | "print-config-token";
|
|
18
|
+
export interface StandaloneDispatch {
|
|
19
|
+
kind: StandaloneDispatchKind;
|
|
20
|
+
/** Args after the internal selector. CLI kind keeps the full user argv. */
|
|
21
|
+
argv: string[];
|
|
22
|
+
}
|
|
23
|
+
export interface DetectedPackageLike {
|
|
24
|
+
name: string;
|
|
25
|
+
displayName: string;
|
|
26
|
+
version: string | null;
|
|
27
|
+
state: "ok" | "unknown" | "not-installed";
|
|
28
|
+
source?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* True when `arg` is the script slot bun/node inserts at argv[1]
|
|
32
|
+
* (`bun bin/anet-bin.ts`, or a compiled binary's `/$bunfs/...` path).
|
|
33
|
+
* A user argument that merely ends in `.ts` is not a script slot.
|
|
34
|
+
*/
|
|
35
|
+
export declare function isBundlerScriptSlot(arg: string): boolean;
|
|
36
|
+
/** User args, whether argv is Node-shaped (script at [1]) or a raw executable. */
|
|
37
|
+
export declare function standaloneUserArgs(argv: readonly string[]): string[];
|
|
38
|
+
export declare function dispatchStandalone(userArgs: readonly string[]): StandaloneDispatch;
|
|
39
|
+
/**
|
|
40
|
+
* `cli.ts`, `commhub.ts`, and `agent-node`'s CLI all read `process.argv.slice(2)`.
|
|
41
|
+
* Force that shape so the same entries work under bun, node, and `bun build --compile`
|
|
42
|
+
* (compiled argv may or may not keep a virtual script path at [1]).
|
|
43
|
+
*/
|
|
44
|
+
export declare function nodeStyleArgv(execPath: string, userArgs: readonly string[]): string[];
|
|
45
|
+
export declare function isStandaloneBuild(stamp: StandaloneBuildStamp): boolean;
|
|
46
|
+
export declare function anetVersionFromStamp(stamp: StandaloneBuildStamp): string | null;
|
|
47
|
+
export declare function standaloneBundleVersion(stamp: StandaloneBuildStamp): string | null;
|
|
48
|
+
/** Bytes of the `anet --version` header. No bundle line unless the stamp has one. */
|
|
49
|
+
export declare function formatAnetVersionBanner(anetVersion: string, bundle: string | null): string;
|
|
50
|
+
export declare function standaloneNodeServerJs(stamp: StandaloneBuildStamp): string | null;
|
|
51
|
+
export declare function applyStandaloneDetectedVersions<T extends {
|
|
52
|
+
anet: {
|
|
53
|
+
version: string;
|
|
54
|
+
};
|
|
55
|
+
agentNode: DetectedPackageLike;
|
|
56
|
+
commhubServer: DetectedPackageLike;
|
|
57
|
+
bun?: DetectedPackageLike;
|
|
58
|
+
}>(versions: T, stamp: StandaloneBuildStamp): T;
|
|
59
|
+
export interface CliReinvokeInput {
|
|
60
|
+
standalone: boolean;
|
|
61
|
+
execArgv: readonly string[];
|
|
62
|
+
/** `process.argv[1]` for npm/node. Ignored when `standalone` is true. */
|
|
63
|
+
scriptPath: string;
|
|
64
|
+
cliArgs: readonly string[];
|
|
65
|
+
/** Match call sites that already forward `process.execArgv` (tsx loaders). */
|
|
66
|
+
includeExecArgv: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Argv after `process.execPath` when re-invoking this CLI.
|
|
70
|
+
* npm/node: `[script, ...cliArgs]` or `[...execArgv, script, ...cliArgs]`.
|
|
71
|
+
* standalone: just `cliArgs` — the binary is already `anet`.
|
|
72
|
+
*/
|
|
73
|
+
export declare function cliReinvokeArgs(input: CliReinvokeInput): string[];
|
|
74
|
+
export declare function cliReinvokeShell(input: CliReinvokeInput & {
|
|
75
|
+
execPath: string;
|
|
76
|
+
quote: (value: string) => string;
|
|
77
|
+
}): string;
|
|
78
|
+
export interface StandaloneHubLaunchInput {
|
|
79
|
+
/** `--version` / `--hub-version` value, or null when the user did not pass one. */
|
|
80
|
+
explicitVersion: string | null;
|
|
81
|
+
port: string;
|
|
82
|
+
host: string;
|
|
83
|
+
devOpen: boolean;
|
|
84
|
+
}
|
|
85
|
+
export type StandaloneHubLaunch = {
|
|
86
|
+
ok: true;
|
|
87
|
+
version: string;
|
|
88
|
+
origin: string;
|
|
89
|
+
warnings: string[];
|
|
90
|
+
args: string[];
|
|
91
|
+
} | {
|
|
92
|
+
ok: false;
|
|
93
|
+
message: string;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Argv for the embedded Hub. The standalone binary cannot `bunx` a registry
|
|
97
|
+
* package; a requested version other than the embedded one is refused.
|
|
98
|
+
*/
|
|
99
|
+
export declare function standaloneHubLaunch(stamp: StandaloneBuildStamp, input: StandaloneHubLaunchInput): StandaloneHubLaunch;
|
|
100
|
+
/** Argv after `process.execPath` when launching the embedded agent-node. */
|
|
101
|
+
export declare function standaloneNodeArgs(agentArgs: readonly string[]): string[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build stamp for the standalone `anet` executable.
|
|
3
|
+
*
|
|
4
|
+
* The committed value is inactive. `scripts/build-anet-bin.mjs` rewrites this
|
|
5
|
+
* file only for the duration of `bun build --compile`, then restores it.
|
|
6
|
+
* npm/node runs of `bin/cli.ts` must keep seeing `standalone: false`.
|
|
7
|
+
*
|
|
8
|
+
* Versions are read from each package's package.json at binary-build time.
|
|
9
|
+
* Do not hard-code release versions here — those constants belong to the
|
|
10
|
+
* packages (and to the in-flight release that owns them).
|
|
11
|
+
*/
|
|
12
|
+
export interface StandalonePackageVersions {
|
|
13
|
+
/** `@sleep2agi/agent-network` package.json version. */
|
|
14
|
+
anet: string;
|
|
15
|
+
/** `@sleep2agi/agent-node` package.json version. */
|
|
16
|
+
agentNode: string;
|
|
17
|
+
/** `@sleep2agi/commhub-server` package.json version. */
|
|
18
|
+
commhubServer: string;
|
|
19
|
+
/** Release label of this executable (`cli-bin-v<bundle>`). */
|
|
20
|
+
bundle: string;
|
|
21
|
+
}
|
|
22
|
+
export interface StandaloneBuildStamp {
|
|
23
|
+
standalone: boolean;
|
|
24
|
+
versions: StandalonePackageVersions | null;
|
|
25
|
+
/**
|
|
26
|
+
* Prebundled `.anet/node-server.js` payload (target node, version marker
|
|
27
|
+
* already stamped). Null outside the standalone binary. The compiled
|
|
28
|
+
* executable has no real package layout, so the CLI cannot find
|
|
29
|
+
* `node-server.js` via `import.meta.url`.
|
|
30
|
+
*/
|
|
31
|
+
nodeServerJs: string | null;
|
|
32
|
+
}
|
|
33
|
+
export declare const STANDALONE_BUILD_STAMP: StandaloneBuildStamp;
|