@sleep2agi/agent-network 2.3.0-preview.16 → 2.3.0-preview.160

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 (169) hide show
  1. package/README.md +35 -324
  2. package/dist/bin/anet.cjs +101 -0
  3. package/dist/bin/cli.d.ts +1 -0
  4. package/dist/bin/cli.js +20 -1
  5. package/dist/bin/goal-wake-log-render.d.ts +31 -0
  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/channel-attachments.d.ts +29 -0
  10. package/dist/src/channel-inbox-wake.d.ts +21 -0
  11. package/dist/src/channel-meta.d.ts +10 -0
  12. package/dist/src/channel-peer-reply.d.ts +41 -0
  13. package/dist/src/channel-task-trace.d.ts +14 -0
  14. package/dist/src/claude-vendor-env.d.ts +28 -0
  15. package/dist/src/cli-args.d.ts +8 -0
  16. package/dist/src/cli-auth-session.d.ts +47 -0
  17. package/dist/src/cli-errors.d.ts +41 -0
  18. package/dist/src/cli-exit.d.ts +11 -0
  19. package/dist/src/cli-help.d.ts +10 -0
  20. package/dist/src/cli-version-display.d.ts +16 -0
  21. package/dist/src/client-task-trace.d.ts +9 -0
  22. package/dist/src/client.js +1 -1
  23. package/dist/src/codex-adopt.d.ts +46 -0
  24. package/dist/src/codex-auth-fingerprint.d.ts +211 -0
  25. package/dist/src/codex-bin-pin.d.ts +23 -0
  26. package/dist/src/codex-commhub-mcp.d.ts +22 -0
  27. package/dist/src/codex-copresence-bridge-log.d.ts +44 -0
  28. package/dist/src/codex-copresence-env.d.ts +5 -0
  29. package/dist/src/codex-copresence-login-gate.d.ts +16 -0
  30. package/dist/src/codex-copresence-model.d.ts +23 -0
  31. package/dist/src/codex-copresence-preflight.d.ts +78 -0
  32. package/dist/src/codex-copresence-profile.d.ts +125 -0
  33. package/dist/src/codex-copresence-recovery.d.ts +67 -0
  34. package/dist/src/codex-copresence-resume-timeout.d.ts +28 -0
  35. package/dist/src/codex-copresence-rollout-guard.d.ts +36 -0
  36. package/dist/src/codex-copresence-rpc.d.ts +15 -0
  37. package/dist/src/codex-copresence-thread.d.ts +13 -0
  38. package/dist/src/codex-external-appserver.d.ts +128 -0
  39. package/dist/src/codex-fork-recovery.d.ts +47 -0
  40. package/dist/src/codex-home-enforce.d.ts +88 -0
  41. package/dist/src/codex-lifecycle-account.d.ts +104 -0
  42. package/dist/src/codex-lifecycle-canary.d.ts +20 -0
  43. package/dist/src/codex-lifecycle-facts.d.ts +53 -0
  44. package/dist/src/codex-lifecycle-fork.d.ts +91 -0
  45. package/dist/src/codex-lifecycle-preflight.d.ts +77 -0
  46. package/dist/src/codex-lifecycle-receipt.d.ts +53 -0
  47. package/dist/src/codex-lifecycle-restart.d.ts +88 -0
  48. package/dist/src/codex-login-share-guard.d.ts +146 -0
  49. package/dist/src/codex-menu.d.ts +99 -0
  50. package/dist/src/codex-model-default.d.ts +6 -0
  51. package/dist/src/codex-node-login.d.ts +98 -0
  52. package/dist/src/codex-pending-thread-restart.d.ts +69 -0
  53. package/dist/src/codex-recovery-lease.d.ts +39 -0
  54. package/dist/src/codex-recovery-resource-gate.d.ts +15 -0
  55. package/dist/src/codex-resume.d.ts +89 -0
  56. package/dist/src/codex-rollout-history-guard.d.ts +84 -0
  57. package/dist/src/codex-tui-client-health.d.ts +30 -0
  58. package/dist/src/commhub-response.d.ts +1 -0
  59. package/dist/src/controlled-upload.d.ts +83 -0
  60. package/dist/src/copresence-deps.d.ts +22 -0
  61. package/dist/src/copresence-identity.d.ts +363 -0
  62. package/dist/src/copresence-startup-diagnosis.d.ts +17 -0
  63. package/dist/src/daemon-adopt.d.ts +14 -0
  64. package/dist/src/daemon-anet-bin.d.ts +32 -0
  65. package/dist/src/daemon-capability-display.d.ts +110 -0
  66. package/dist/src/daemon-capability-display.js +21 -0
  67. package/dist/src/daemon-inherited-env.d.ts +9 -0
  68. package/dist/src/daemon-runtime-path-preflight.d.ts +22 -0
  69. package/dist/src/daemon-runtime-staleness.d.ts +13 -0
  70. package/dist/src/dashboard-managed-process.d.ts +35 -0
  71. package/dist/src/display-width.d.ts +27 -0
  72. package/dist/src/doctor-node-count.d.ts +28 -0
  73. package/dist/src/environ-alias.d.ts +14 -0
  74. package/dist/src/grok-attach-client.d.ts +129 -0
  75. package/dist/src/grok-build-drift.d.ts +15 -0
  76. package/dist/src/grok-copresence-disclosure.d.ts +11 -0
  77. package/dist/src/grok-copresence-orchestration.d.ts +75 -0
  78. package/dist/src/grok-copresence-profile.d.ts +65 -0
  79. package/dist/src/grok-create-mode.d.ts +19 -0
  80. package/dist/src/host-telemetry.d.ts +14 -0
  81. package/dist/src/hub-health-timeout.d.ts +4 -0
  82. package/dist/src/hub-server-version.d.ts +64 -0
  83. package/dist/src/hub-stop.d.ts +74 -0
  84. package/dist/src/hub-time-display.d.ts +20 -0
  85. package/dist/src/hub-version-skew.d.ts +19 -0
  86. package/dist/src/im/correlation-store.d.ts +34 -0
  87. package/dist/src/im/feishu/adapter.d.ts +54 -0
  88. package/dist/src/im/feishu/bridge.d.ts +78 -14
  89. package/dist/src/im/feishu/hub-upload.d.ts +1 -1
  90. package/dist/src/im/feishu/outbound-route.d.ts +62 -0
  91. package/dist/src/im/feishu/worker-lifecycle.d.ts +13 -0
  92. package/dist/src/im/feishu/worker.js +180 -153
  93. package/dist/src/inbox-drain.d.ts +20 -0
  94. package/dist/src/local-process-state.d.ts +12 -0
  95. package/dist/src/locale-diagnostic.d.ts +12 -0
  96. package/dist/src/login-client-label.d.ts +6 -0
  97. package/dist/src/ls-columns.d.ts +15 -0
  98. package/dist/src/mock-llm.d.ts +12 -0
  99. package/dist/src/node-activity-log.d.ts +4 -0
  100. package/dist/src/node-clone.d.ts +134 -0
  101. package/dist/src/node-delete-hub.d.ts +42 -0
  102. package/dist/src/node-files.d.ts +62 -0
  103. package/dist/src/node-locate.d.ts +60 -0
  104. package/dist/src/node-ls-all.d.ts +80 -0
  105. package/dist/src/node-menu.d.ts +40 -0
  106. package/dist/src/node-not-found.d.ts +1 -0
  107. package/dist/src/node-remote.d.ts +180 -0
  108. package/dist/src/node-running-guard.d.ts +9 -0
  109. package/dist/src/node-server-identity.d.ts +35 -0
  110. package/dist/src/node-server-payload.d.ts +66 -0
  111. package/dist/src/node-server-rules-file.d.ts +14 -0
  112. package/dist/src/node-server-version.d.ts +39 -0
  113. package/dist/src/node-server.js +8 -1
  114. package/dist/src/node-skills.d.ts +57 -0
  115. package/dist/src/normalize-runtime.d.ts +29 -2
  116. package/dist/src/offline-age.d.ts +29 -0
  117. package/dist/src/one-line-cell.d.ts +20 -0
  118. package/dist/src/opencode-agent-node-pair.d.ts +28 -0
  119. package/dist/src/opencode-auth-login.d.ts +43 -0
  120. package/dist/src/opencode-free-tier.d.ts +27 -0
  121. package/dist/src/opencode-generation-create.d.ts +27 -0
  122. package/dist/src/opencode-generation-record.d.ts +24 -0
  123. package/dist/src/opencode-launch-env.d.ts +13 -0
  124. package/dist/src/opencode-owner-mode.d.ts +6 -0
  125. package/dist/src/opencode-package-binary.d.ts +44 -0
  126. package/dist/src/opencode-pin.d.ts +61 -0
  127. package/dist/src/opencode-preset.d.ts +73 -0
  128. package/dist/src/opencode-runtime-binding.d.ts +30 -0
  129. package/dist/src/opencode-safe-root.d.ts +36 -0
  130. package/dist/src/opencode-smoke-env.d.ts +1 -0
  131. package/dist/src/opencode-versions.d.ts +44 -0
  132. package/dist/src/outbound-attachments.d.ts +60 -0
  133. package/dist/src/outbound-tool-names.d.ts +1 -0
  134. package/dist/src/owned-roots.d.ts +58 -0
  135. package/dist/src/owner-env-file.d.ts +2 -0
  136. package/dist/src/package-mode-preflight.d.ts +41 -0
  137. package/dist/src/posix-codex-copresence.d.ts +33 -0
  138. package/dist/src/posix-modes.d.ts +36 -0
  139. package/dist/src/primary-network.d.ts +23 -0
  140. package/dist/src/private-state.d.ts +10 -0
  141. package/dist/src/process-telemetry.d.ts +12 -0
  142. package/dist/src/profile-serialize.d.ts +1 -0
  143. package/dist/src/project-key.d.ts +1 -0
  144. package/dist/src/reply-local-links.d.ts +47 -0
  145. package/dist/src/reply-originator.d.ts +20 -0
  146. package/dist/src/resume-runtime-infer.d.ts +18 -0
  147. package/dist/src/rules-file.d.ts +53 -0
  148. package/dist/src/secret-shell-guidance.d.ts +4 -0
  149. package/dist/src/session-status-class.d.ts +48 -0
  150. package/dist/src/shared/reserved-env.d.ts +3 -0
  151. package/dist/src/sibling-agent-node.d.ts +23 -0
  152. package/dist/src/stale-socket.d.ts +118 -0
  153. package/dist/src/start-resource-gate.d.ts +146 -0
  154. package/dist/src/stopped-receipt.d.ts +8 -0
  155. package/dist/src/subcommand-redirect.d.ts +26 -0
  156. package/dist/src/task-trace.d.ts +33 -0
  157. package/dist/src/tmux-attach.d.ts +11 -0
  158. package/dist/src/tmux-capability.d.ts +58 -0
  159. package/dist/src/tmux-exact-target.d.ts +36 -0
  160. package/dist/src/tmux-format.d.ts +20 -0
  161. package/dist/src/tmux-pane-prompt.d.ts +22 -0
  162. package/dist/src/tmux.d.ts +44 -0
  163. package/dist/src/token-cli.d.ts +13 -0
  164. package/dist/src/tool-allowlist.d.ts +28 -0
  165. package/dist/src/unsafe-package-path-reason.d.ts +31 -0
  166. package/dist/src/upgrade-channel.d.ts +31 -0
  167. package/dist/src/win-launcher.d.ts +20 -0
  168. package/dist/src/windows-codex-copresence.d.ts +60 -0
  169. package/package.json +14 -7
@@ -0,0 +1,57 @@
1
+ export declare const SKILL_FILE_MAX_BYTES: number;
2
+ export declare const SKILLS_LIST_MAX = 300;
3
+ export declare const SKILL_DESCRIPTION_MAX = 300;
4
+ export type SkillScope = "project" | "user" | "system";
5
+ export interface SkillRoot {
6
+ /** 绝对目录(只在节点本机使用,不外传)。 */
7
+ dir: string;
8
+ /** 外传的显示前缀,例如 `.claude/skills`、`~/.claude/skills`、`$CODEX_HOME/skills`。 */
9
+ label: string;
10
+ scope: SkillScope;
11
+ }
12
+ export interface SkillContext {
13
+ workDir: string;
14
+ home?: string;
15
+ codexHome?: string;
16
+ }
17
+ export interface SkillSummary {
18
+ name: string;
19
+ scope: SkillScope;
20
+ path_rel: string;
21
+ description: string;
22
+ /** 只有团队技能才带。不写进 scope:旧客户端会把不认识的 scope 当成「项目」。 */
23
+ origin?: "team";
24
+ }
25
+ export declare function isValidSkillName(name: unknown): name is string;
26
+ /** 按优先级(高 → 低)列出某运行时会加载技能的根目录。同名技能以先出现的为准。 */
27
+ export declare function skillRootsForRuntime(runtime: string | null | undefined, ctx: SkillContext): SkillRoot[];
28
+ /** 从 SKILL.md 开头的 YAML frontmatter 取 description(单行 / 引号 / `|` `>` 块)。 */
29
+ export declare function parseSkillDescription(text: string): string;
30
+ export declare const TEAM_COPY_MARKER = ".anet-team-copy";
31
+ export declare function teamSkillsDir(ctx: SkillContext): string;
32
+ /** 每个运行时只链进这一个用户级目录。codex 用本节点的 CODEX_HOME,没有专属目录才用 ~/.codex。 */
33
+ export declare function teamSkillDest(runtime: string | null | undefined, ctx: SkillContext): {
34
+ dir: string;
35
+ label: string;
36
+ machineWide: boolean;
37
+ } | null;
38
+ /** 是不是我们建的:链接目标在团队目录下,或者复制标记里记的 source 解析后在团队目录下。不看名字。
39
+ * 只有标记、source 却指向别处的(比如用户把复制件拷出去自己改了),不算我们的,不删。 */
40
+ export declare function isOurTeamEntry(dest: string, teamDir: string): Promise<boolean>;
41
+ export declare function listSkills(runtime: string | null | undefined, ctx: SkillContext): Promise<SkillSummary[]>;
42
+ export interface SkillReadResult extends SkillSummary {
43
+ content: string;
44
+ }
45
+ export declare function readSkill(runtime: string | null | undefined, ctx: SkillContext, name: unknown): Promise<SkillReadResult>;
46
+ export interface TeamSkillSay {
47
+ log: (message: string) => void;
48
+ warn: (message: string) => void;
49
+ }
50
+ /** 启动时把 ~/.anet/skills/<name> 链进该运行时的用户级目录。同名且不是我们建的,不覆盖。 */
51
+ export declare function installTeamSkills(runtime: string | null | undefined, ctx: SkillContext, say?: TeamSkillSay): Promise<void>;
52
+ export declare function teamSkillWarnings(runtime: string | null | undefined, ctx: SkillContext): Promise<string[]>;
53
+ export declare function skillView(runtime: string | null | undefined, ctx: SkillContext): Promise<{
54
+ skills: SkillSummary[];
55
+ roots: string[];
56
+ warnings: string[];
57
+ }>;
@@ -1,9 +1,36 @@
1
- export type RuntimeName = "claude-code-cli" | "codex-sdk" | "claude-agent-sdk" | "grok-build-acp";
2
- /** Operator-facing default for any runtime slot that comes in empty / missing / unrecognized. */
1
+ export type RuntimeName = "claude-code-cli" | "codex-sdk" | "claude-agent-sdk" | "grok-build-acp" | "grok-build-cli" | "opencode-cli" | "codex-app-server";
2
+ /** 一个 runtime 复用的是哪种**外部登录态**,而不是 API key。 */
3
+ export type ReusedLogin = "claude" | "codex" | "grok";
4
+ /**
5
+ * runtime → 它复用的外部登录。**只有一处定义**,VENDORS 的 `requiresAuth`
6
+ * 与登录态探测都引用这里。
7
+ *
8
+ * 不在表里 = 该 runtime 走 API key,不复用任何登录:
9
+ * · `claude-agent-sdk` —— 走 ANTHROPIC_AUTH_TOKEN / ANTHROPIC_API_KEY
10
+ * · `opencode-cli` —— 走 ANTHROPIC_API_KEY / OPENAI_API_KEY(vendor preset 从 env 读,不 prompt)
11
+ * 这条区分是有意写下来的:Vincent 那句「复用会员登录状态、不用自己输 key 和 url」
12
+ * 点名的是 Claude Code / Codex / Grok 三家,opencode 不在其中,别顺手加进来。
13
+ */
14
+ export declare const RUNTIME_REUSED_LOGIN: Readonly<Partial<Record<RuntimeName, ReusedLogin>>>;
15
+ /** 该 runtime 复用哪种登录;返回 undefined 表示它用 API key。 */
16
+ export declare function reusedLoginFor(runtime: RuntimeName): ReusedLogin | undefined;
17
+ /** Operator-facing default for a runtime slot that is empty or missing. */
3
18
  export declare const DEFAULT_RUNTIME: RuntimeName;
19
+ export declare const SUPPORTED_RUNTIME_NAMES: readonly RuntimeName[];
4
20
  type ProfileLike = {
5
21
  runtime?: string;
6
22
  codexRuntime?: string;
7
23
  };
24
+ /**
25
+ * Legacy normalization used by display and migration code. Missing, empty,
26
+ * and unknown values all use the safe default for backward compatibility.
27
+ * Security-sensitive create/start paths must call `normalizeRuntimeStrict`.
28
+ */
8
29
  export declare function normalizeRuntime(profileOrRuntime?: ProfileLike | string): RuntimeName;
30
+ /**
31
+ * Canonicalize a runtime at an execution boundary. Missing/empty still means
32
+ * the documented default, but any non-empty unknown value is rejected so a
33
+ * typo or future runtime cannot silently execute as Claude.
34
+ */
35
+ export declare function normalizeRuntimeStrict(profileOrRuntime?: ProfileLike | string): RuntimeName;
9
36
  export {};
@@ -0,0 +1,29 @@
1
+ /**
2
+ * #1648 — 名册上「刚停的节点」和「掉了三天没人发现的节点」渲染成同一个数字。
3
+ *
4
+ * `anet status` 原先只印 `N offline`。实测(2026-08-31,84 台 外部团队相关节点):
5
+ * 45 台 offline 里 27 台 >3 天、18 台 1–3 天、**近 6 小时内 0 台** ——
6
+ * 「当前没有活故障」和「有 45 台掉了」是完全不同的两个结论,而屏幕上只有后者。
7
+ */
8
+ /**
9
+ * 🔴 hub 存的 `last_seen_at` 是 **UTC**,但字符串里**没有时区标记**
10
+ * (形如 `2026-08-30 21:11:24`)。直接 `new Date(raw)` 会被当成**本地时间**:
11
+ * 在 UTC+8 上就是整整 8 小时的偏差,而且它**不会报错** —— 只会把「4 分钟前」
12
+ * 读成「8 小时前」。这个错本人在 2026-08-31 亲自犯过一次,差点把
13
+ * 「舰队心跳陈旧」报出去。
14
+ */
15
+ export declare function parseHubTimestamp(raw: unknown): number | null;
16
+ export type OfflineAges = {
17
+ under1h: number;
18
+ h1to24: number;
19
+ d1to3: number;
20
+ over3d: number;
21
+ /** 🔴 没有可用时间戳的那些必须单独一格,不能并进任何一档 —— 见下 */
22
+ unknown: number;
23
+ total: number;
24
+ };
25
+ export declare function summarizeOfflineAges(offline: ReadonlyArray<{
26
+ last_seen_at?: unknown;
27
+ }>, nowMs: number): OfflineAges;
28
+ /** 返回空串表示「没有值得多说一句的东西」,调用方据此决定印不印。 */
29
+ export declare function formatOfflineAges(a: OfflineAges): string;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * CLI 里那几张对齐表(`anet status` 的 needs-attention / working,以及 Recent Tasks
3
+ * 和 `anet tasks`)把**用户提供的文本**直接 `slice(0, N)` 塞进一行。
4
+ *
5
+ * 🔴 任务正文里有换行时,截出来的那段会**把整张表打断**。实测(2026-08-31,
6
+ * 真跑 `anet status` 才看见,读代码看不出来):
7
+ *
8
+ * grok-v1 blocked 【把你自己的名册状态修正过来 —— 两步,别做别的】
9
+ *
10
+ * 你今天两次在 22 秒内答了我的探测(G
11
+ *
12
+ * 第二行完全脱离了对齐,而且读起来像另一个节点的输出。
13
+ *
14
+ * 这里把所有空白(含 \n \r \t 和连续空格)折成单个空格再截。
15
+ *
16
+ * 🔴 **有意不加省略号**:加了会改变列宽,而列宽是这几张表现有的对齐依据。
17
+ * 「截断了却看不出来」是另一个问题(先存在于这里,本次不动),
18
+ * 不要顺手在一个修显示错位的改动里改掉它。
19
+ */
20
+ export declare function oneLineCell(text: unknown, max: number): string;
@@ -0,0 +1,28 @@
1
+ export declare const PAIRED_AGENT_NETWORK_VERSION = "2.3.0-preview.160";
2
+ export declare const PAIRED_AGENT_NODE_VERSION = "2.5.0-preview.126";
3
+ export declare const PAIRED_AGENT_NODE_SPEC = "@sleep2agi/agent-node@2.5.0-preview.126";
4
+ export declare const OPENCODE_AGENT_NETWORK_VERSION = "2.3.0-preview.160";
5
+ export declare const OPENCODE_AGENT_NODE_VERSION = "2.5.0-preview.126";
6
+ export declare const OPENCODE_AGENT_NODE_SPEC = "@sleep2agi/agent-node@2.5.0-preview.126";
7
+ export type PairedAgentNodeResolution = {
8
+ spec: string;
9
+ args: string[];
10
+ allowPathGlobal: false;
11
+ };
12
+ /** The codex bridge must resolve the immutable release pair, independent of PATH. */
13
+ export declare function pairedAgentNodeResolution(): PairedAgentNodeResolution;
14
+ /** Cold npm downloads get their own budget, separate from bridge attachment. */
15
+ export declare function pairedAgentNodeResolveTimeoutMs(env?: NodeJS.ProcessEnv): number;
16
+ export declare function pairedAgentNodeResolveError(error: any, timeoutMs: number): string;
17
+ export declare function agentNodeHelpSupportsCodexAppServer(help: string): boolean;
18
+ export declare function opencodeExactPairInstallCommand(): string;
19
+ /** Runtime capability advertised by agent-node's operator-facing help. */
20
+ export declare function agentNodeHelpSupportsOpencode(help: string): boolean;
21
+ /**
22
+ * Resolve a package-owned agent-node entrypoint and verify its immutable
23
+ * release identity before it can receive `opencode-cli`. Capability text is
24
+ * not a security boundary: an older preview already advertised the runtime.
25
+ */
26
+ export declare function validateAgentNodePackageEntrypoint(rawEntrypoint: string, packageSpec: string, expectedVersion?: string, forbiddenRoots?: readonly string[]): string;
27
+ /** Skip invalid/local PATH shims and return the first exact trusted package. */
28
+ export declare function resolveAgentNodePackageEntrypointFromPath(searchPath: string, packageSpec: string, expectedVersion: string, forbiddenRoots?: readonly string[]): string;
@@ -0,0 +1,43 @@
1
+ import type { OpencodePresetId } from "./opencode-preset";
2
+ export declare const OPENCODE_AUTH_LOGIN_ROOT_PREFIX = "opencode-auth-login-";
3
+ export declare const OPENCODE_AUTH_LOGIN_OWNER_FILE = ".owner.json";
4
+ export declare const OPENCODE_AUTH_LOGIN_CLEANUP_PREFIX = ".anet-opencode-auth-cleanup-";
5
+ export interface OpencodeAuthLoginSandbox {
6
+ readonly nodeWorkDir: string;
7
+ readonly provider: OpencodePresetId;
8
+ readonly root: string;
9
+ readonly cwd: string;
10
+ readonly authPath: string;
11
+ readonly env: Readonly<NodeJS.ProcessEnv>;
12
+ }
13
+ export interface CreateOpencodeAuthLoginSandboxOptions {
14
+ nodeWorkDir: string;
15
+ provider: OpencodePresetId | string;
16
+ parentEnv?: NodeJS.ProcessEnv;
17
+ /** Internal/test-only trusted external base override. */
18
+ launchBase?: string;
19
+ }
20
+ export interface OpencodeAuthLoginCredential {
21
+ provider: OpencodePresetId;
22
+ type: "api";
23
+ key: string;
24
+ }
25
+ /** Deterministic exact-1.18.1 login argv for the selected API-key flow. */
26
+ export declare function buildOpencodeAuthLoginArgs(provider: OpencodePresetId | string): string[];
27
+ /** Prepare a fresh, node-scoped environment for one interactive login. */
28
+ export declare function createOpencodeAuthLoginSandbox(options: CreateOpencodeAuthLoginSandboxOptions): OpencodeAuthLoginSandbox;
29
+ /** Repeat external-root ancestor and inode validation immediately before the
30
+ * vetted upstream binary is spawned. */
31
+ export declare function revalidateOpencodeAuthLoginSandbox(sandbox: OpencodeAuthLoginSandbox): void;
32
+ /**
33
+ * Read only the selected provider's exact API-key shape from the fresh root.
34
+ * OAuth/browser-login records and mixed/multi-provider documents are refused.
35
+ */
36
+ export declare function readOpencodeAuthLoginCredential(sandbox: OpencodeAuthLoginSandbox): OpencodeAuthLoginCredential;
37
+ /** Safely remove a sandbox created by this process. Idempotent after removal. */
38
+ export declare function cleanupOpencodeAuthLoginSandbox(sandbox: OpencodeAuthLoginSandbox): void;
39
+ /**
40
+ * Lifecycle helper for CLI integration. Spawn/wait/read the credential inside
41
+ * `action`; the fresh tree is cleaned on success, child failure, or throw.
42
+ */
43
+ export declare function withOpencodeAuthLoginSandbox<T>(options: CreateOpencodeAuthLoginSandboxOptions, action: (sandbox: OpencodeAuthLoginSandbox) => T | Promise<T>): Promise<T>;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * #540 — OpenCode Zen's free tier rejects any request in which a tool is
3
+ * disabled or a permission is denied, answering
4
+ * "OpenCode's free tier can only be used from within OpenCode" (measured on
5
+ * opencode-ai 1.18.1 and 1.18.34 with `{"tools":{"bash":false}}`). Our default
6
+ * safe preset disables every built-in tool, so a free Zen model on a default
7
+ * node fails every task. `anet node create` must say so instead of promising
8
+ * that free models "can still start".
9
+ *
10
+ * The default preset itself is intentionally NOT changed here.
11
+ */
12
+ /** OpenCode Zen free models are `opencode/<id>-free`. */
13
+ export declare function isOpencodeZenFreeModel(model: string | undefined | null): boolean;
14
+ /** Replaces the old "Keyless/free models can still start without a credential." */
15
+ export declare const OPENCODE_KEYLESS_FREE_MODEL_NOTE: string;
16
+ /** The exact command that sets flags.opencodeUnsafeTools=true in a node config. */
17
+ export declare function opencodeUnsafeToolsCommand(configFile: string): string;
18
+ /**
19
+ * Warning lines for a node whose model is a Zen free model while the safe
20
+ * preset is active. Empty when the combination is not the failing one.
21
+ */
22
+ export declare function opencodeFreeTierSafePresetWarning(opts: {
23
+ nodeId: string;
24
+ model: string | undefined | null;
25
+ unsafeTools: boolean;
26
+ configFile: string;
27
+ }): string[];
@@ -0,0 +1,27 @@
1
+ export type OpencodeGenerationCreateResult<P> = {
2
+ ok: true;
3
+ profile: P;
4
+ } | {
5
+ ok: false;
6
+ refusal: string;
7
+ };
8
+ export declare function applyOpencodeGenerationCreateOption<P extends {
9
+ opencodeGeneration?: unknown;
10
+ opencodeMode?: string;
11
+ flags?: Record<string, any>;
12
+ }>(profile: P, opts: Record<string, unknown> & {
13
+ "opencode-generation"?: string;
14
+ "opencode-unsafe-tools"?: string;
15
+ }): OpencodeGenerationCreateResult<P>;
16
+ /** Start-time gate for a stored profile: one line when it must not start,
17
+ * else null. V1 (and a config without the field) is never refused. */
18
+ export declare function opencodeStartGenerationRefusal(profile: {
19
+ opencodeGeneration?: unknown;
20
+ opencodeMode?: string;
21
+ flags?: Record<string, any>;
22
+ }, opts: {
23
+ copresence: boolean;
24
+ configFile?: string;
25
+ }): string | null;
26
+ /** Exact install command for a generation's pin. */
27
+ export declare function opencodeGenerationInstallCommand(generation: "v1" | "v2"): string;
@@ -0,0 +1,24 @@
1
+ import { type OpencodeGeneration } from "./opencode-versions";
2
+ export declare const OPENCODE_GENERATION_FIELD = "opencodeGeneration";
3
+ /** Profile about to be serialised by saveProfile: add the generation when it
4
+ * is missing, otherwise return the very same object. */
5
+ export declare function stampOpencodeGeneration<T extends Record<string, any>>(profile: T, generation?: OpencodeGeneration): T;
6
+ /**
7
+ * Raw `config.json` text → the same text with `opencodeGeneration` appended,
8
+ * or null when nothing should be written:
9
+ * – the field is already present (whatever its value), or
10
+ * – the file is not valid JSON / not an object, or
11
+ * – the file is not in the canonical `JSON.stringify(_, null, 2) + "\n"`
12
+ * form saveProfile writes (hand-edited). Re-serialising such a file could
13
+ * touch bytes of other fields, and an absent field already means V1.
14
+ * In the canonical case the result differs from the input only by the one
15
+ * appended key, so every other field keeps its exact bytes.
16
+ */
17
+ export declare function recordOpencodeGenerationInConfigText(raw: string, generation?: OpencodeGeneration): string | null;
18
+ /** Start-time backfill for a node created before #542. IO is injected so the
19
+ * caller keeps its own symlink-safe private-file reader/writer. Never throws:
20
+ * the record is advisory and an absent field already reads as V1. */
21
+ export declare function backfillOpencodeGeneration(io: {
22
+ read: () => string | undefined;
23
+ write: (body: string) => void;
24
+ }): boolean;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Process-loader hooks that must never cross the opencode-cli launcher
3
+ * boundary. The exact agent-node package/entrypoint check happens before the
4
+ * node profile env is merged; allowing that profile to supply one of these
5
+ * variables would let code run before the verified entrypoint's first line.
6
+ */
7
+ export declare const OPENCODE_AGENT_NODE_LOADER_ENV_KEYS: readonly ["NODE_OPTIONS", "NODE_PATH", "NODE_V8_COVERAGE", "NODE_REDIRECT_WARNINGS", "NODE_COMPILE_CACHE", "BUN_OPTIONS", "BUN_PRELOAD", "LD_PRELOAD", "LD_LIBRARY_PATH", "LD_AUDIT", "LD_DEBUG_OUTPUT", "DYLD_INSERT_LIBRARIES", "DYLD_LIBRARY_PATH", "DYLD_FRAMEWORK_PATH", "DYLD_FALLBACK_LIBRARY_PATH", "OPENSSL_CONF", "OPENSSL_ENGINES", "OPENSSL_MODULES"];
8
+ /**
9
+ * Return a child env that preserves the launcher's original executable search
10
+ * path and removes pre-entrypoint loader/write hooks. Other operator settings
11
+ * (locale, proxy, custom CA, channel integration) remain backward-compatible.
12
+ */
13
+ export declare function hardenOpencodeAgentNodeEnv(source: NodeJS.ProcessEnv, launcherPath: string | undefined): NodeJS.ProcessEnv;
@@ -0,0 +1,6 @@
1
+ /** Linux user-private-group compatibility for ordinary umask 0002 installs. */
2
+ export declare function opencodeOwnedPathModeIsSafe(stat: {
3
+ uid: number;
4
+ gid: number;
5
+ mode: number | bigint;
6
+ }, runtimeUid?: number | undefined, runtimeGid?: number | undefined): boolean;
@@ -0,0 +1,44 @@
1
+ export interface ValidateOpencodePackageBinaryOptions {
2
+ expectedVersion: string;
3
+ /** A package payload may not be inside, or contain, the current project or
4
+ * node state tree. This rejects project-local same-version impersonators. */
5
+ forbiddenRoots?: readonly string[];
6
+ /** #543 — npm package that must own the entrypoint. Absent = V1
7
+ * `opencode-ai`, exactly the pre-#543 gate; V2 passes `@opencode/cli`. */
8
+ packageName?: string;
9
+ }
10
+ /** Current cwd plus every enclosing source-workspace boundary. This catches a
11
+ * monorepo root's node_modules when anet is invoked from packages/app. */
12
+ export declare function discoverOpencodeForbiddenRoots(cwd?: string): string[];
13
+ /**
14
+ * Bind an executable to the exact npm `opencode-ai` payload identity.
15
+ *
16
+ * `--version` output alone is not an identity boundary: a checkout can put a
17
+ * same-version credential-stealing shim first on PATH. Only the canonical
18
+ * package entrypoint with matching package metadata and trusted path modes is
19
+ * admitted. The returned path is the one callers must spawn verbatim.
20
+ */
21
+ export declare function validateOpencodePackageBinary(rawBinary: string, options: ValidateOpencodePackageBinaryOptions): string;
22
+ /** Resolve the first *valid package-owned* OpenCode entry on PATH. Invalid
23
+ * project-local shims are skipped so a later trusted global install can win. */
24
+ /** #1845 层① —— 包身份校验只依赖 POSIX 的 lstat/uid/mode 语义,darwin 与 linux 等价
25
+ * (2026-09-07 Mac mini 真跑:home 前缀 npm 安装 → VALIDATE_OK;/tmp 下祖先 1777 仍被拒)。
26
+ * win32 没有 uid、也没有 0o111 可执行位,继续拦。平台可注入,便于在 Linux CI 上测三种分支。 */
27
+ export declare const OPENCODE_VERIFIER_PLATFORMS: ReadonlySet<NodeJS.Platform>;
28
+ export declare function opencodeVerifierSupportsPlatform(platform?: NodeJS.Platform): boolean;
29
+ export declare function resolveOpencodePackageBinaryFromPath(searchPath: string, options: ValidateOpencodePackageBinaryOptions, platform?: NodeJS.Platform): string;
30
+ /**
31
+ * Board #541 — resolve the first trusted package entrypoint matching any of
32
+ * `acceptedVersions`, trying each version across the whole PATH in order (the
33
+ * release pin first), and report which exact version was admitted. Every
34
+ * candidate still goes through the full `validateOpencodePackageBinary`
35
+ * identity gate; only the accepted version set is wider. When nothing matches,
36
+ * the error from the first (release-pin) attempt is rethrown so diagnostics
37
+ * keep naming the pin the operator should install.
38
+ */
39
+ export declare function resolveAcceptedOpencodePackageBinaryFromPath(searchPath: string, options: Omit<ValidateOpencodePackageBinaryOptions, "expectedVersion"> & {
40
+ acceptedVersions: readonly string[];
41
+ }, platform?: NodeJS.Platform): {
42
+ binary: string;
43
+ version: string;
44
+ };
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Version this branch was validated against by the maintainers.
3
+ * Bumped when a new opencode-ai release passes the full Docker/E2E gate —
4
+ * in the shared supported-versions table (`opencode-versions.ts`, #542),
5
+ * which agent-node's package gate reads from its byte-identical copy.
6
+ */
7
+ export declare const OPENCODE_BUILTIN_PIN = "1.18.34";
8
+ /**
9
+ * Earlier release pins that remain accepted for one transition window so a
10
+ * host still holding the previous exact install keeps starting after an anet
11
+ * upgrade (board #541). Each entry passed the full Docker/E2E gate when it was
12
+ * the pin; start prints `opencodeLegacyPinNote()` so the operator upgrades.
13
+ * Derived from the shared supported-versions table (#542: v1 accepted
14
+ * versions minus the pin) — agent-node's gate reads the same table.
15
+ */
16
+ export declare const OPENCODE_TRANSITION_VERSIONS: readonly string[];
17
+ /** Versions a start may accept, preferred first: the release pin, then the
18
+ * transition versions. The order matters — a PATH holding both resolves to
19
+ * the release pin. */
20
+ export declare function acceptedOpencodeVersions(pin?: string): string[];
21
+ /** One-line upgrade note when a start accepted a transition version, else null. */
22
+ export declare function opencodeLegacyPinNote(found: string, pin?: string): string | null;
23
+ /** Exact upstream remediation shared by every CLI failure path. */
24
+ export declare function opencodeExactInstallCommand(version?: string): string;
25
+ /** Preserve package-identity diagnostics while always leaving a missing or
26
+ * untrusted install with an actionable exact-pin command. */
27
+ export declare function formatOpencodePackageIdentityFailure(expectedVersion: string, detail: string): string;
28
+ /** Where the per-machine override lives. Kept under `~/.anet/` so
29
+ * it sits next to the other anet-local state. */
30
+ export declare function opencodePinFilePath(homeDirOverride?: string): string;
31
+ /** Shape of the override file written by `upgrade-pin`. */
32
+ export interface OpencodePinOverride {
33
+ version: string;
34
+ /** ISO timestamp when the smoke test passed. Presence of this
35
+ * field is REQUIRED for `readEffectivePin()` to trust the file —
36
+ * a hand-edited version without a smoke marker is refused. */
37
+ smokePassedAt: string;
38
+ /** Free-form note about what the smoke checked (initialize +
39
+ * session/new by default). Kept so a future review can tell what
40
+ * bar the pin actually cleared. */
41
+ smokeNote?: string;
42
+ }
43
+ export interface EffectivePin {
44
+ version: string;
45
+ source: "override-file" | "builtin";
46
+ smokePassedAt?: string;
47
+ }
48
+ /**
49
+ * Recognize a validated override only when it records the exact built-in
50
+ * release pin. A different locally-smoked version is deliberately ignored:
51
+ * the lightweight ACP smoke does not replace the maintainer's full security
52
+ * and reply-path gate. Malformed/stale files also fall back to the built-in.
53
+ */
54
+ export declare function readEffectivePin(homeDirOverride?: string): EffectivePin;
55
+ /**
56
+ * Write the override — SHOULD ONLY be called after the smoke test
57
+ * has actually passed. The command layer in `bin/cli.ts` is
58
+ * responsible for gating this; this function does no
59
+ * verification of its own beyond shape.
60
+ */
61
+ export declare function writePinOverride(version: string, smokePassedAt: string, smokeNote?: string, homeDirOverride?: string): void;
@@ -0,0 +1,73 @@
1
+ export type OpencodePresetId = "anthropic" | "openai";
2
+ export interface OpencodePreset {
3
+ id: OpencodePresetId;
4
+ displayName: string;
5
+ envKey: string;
6
+ signupUrl: string;
7
+ /** How opencode's provider config identifies this vendor in the
8
+ * `provider.<id>.options.baseUrl` config. Left null when we don't
9
+ * need to override the built-in default. */
10
+ configProviderId: "anthropic" | "openai";
11
+ }
12
+ export declare const OPENCODE_PRESETS: OpencodePreset[];
13
+ /**
14
+ * OpenCode tools disabled for the default `opencode-cli` profile.
15
+ *
16
+ * This policy reduces the model's ambient filesystem/shell surface. It is
17
+ * deliberately represented in the generated opencode.json so operators can
18
+ * inspect the default, but it is not an OS security boundary: a same-uid
19
+ * OpenCode process can still read files allowed by normal filesystem ACLs.
20
+ */
21
+ export declare const OPENCODE_DEFAULT_DISABLED_TOOLS: readonly ["bash", "read", "glob", "grep", "edit", "write", "list", "task", "skill", "webfetch", "websearch", "question"];
22
+ export declare function buildOpencodeDefaultToolsPolicy(): Record<string, false>;
23
+ export declare function buildOpencodeDefaultPermissionPolicy(): Record<string, "deny">;
24
+ export declare function findOpencodePreset(id: string): OpencodePreset | null;
25
+ /**
26
+ * Look up the API key for a preset from the current process env.
27
+ * Callers MUST handle the `null` case (per RFC v0.3 D3 + 通信龙 PR③
28
+ * flag: "从 env 读, 别 prompt"). Returns null so the wizard can
29
+ * emit a clear message telling the operator to export the env var
30
+ * and re-run — rather than silently continuing without a key.
31
+ */
32
+ export declare function readPresetKeyFromEnv(preset: OpencodePreset, env?: NodeJS.ProcessEnv): string | null;
33
+ /**
34
+ * opencode.ai's auth.json shape:
35
+ * { "<providerId>": { "type": "api", "key": "..." } }
36
+ * Same shape verified against the release pin opencode-ai@1.18.1.
37
+ */
38
+ export declare function buildAuthJsonBody(preset: OpencodePreset, apiKey: string): string;
39
+ export type OpencodePrivateProfileFilename = "config.json" | ".env";
40
+ /**
41
+ * Establish the boundary before saveProfile/rewritePlainSecrets writes the
42
+ * node token or dotenv key. The expected shape is exactly
43
+ * `<project>/.anet/nodes/<node>`. Every existing path is inspected with
44
+ * lstat + O_NOFOLLOW and inode checks; absent private directories are created
45
+ * one component at a time. A pre-planted node-root/config/.env symlink is a
46
+ * hard error before any secret-bearing write.
47
+ */
48
+ export declare function prepareOpencodeNodeForProfileWrite(nodeWorkDir: string): string;
49
+ export declare function readOpencodePrivateProfileFile(nodeWorkDir: string, filename: OpencodePrivateProfileFilename): string | undefined;
50
+ export declare function writeOpencodePrivateProfileFile(nodeWorkDir: string, filename: OpencodePrivateProfileFilename, body: string): string;
51
+ /**
52
+ * Write auth.json into the opencode config root that lives under
53
+ * `nodeWorkDir` (the per-node OpenCode data root). mode 0o600 limits
54
+ * filesystem access to the owning OS account; it does not prevent a
55
+ * same-uid OpenCode child from opening the file directly. Directory is
56
+ * created if missing.
57
+ *
58
+ * Returns the absolute path we wrote for logging.
59
+ */
60
+ export declare function writeOpencodeAuthJson(nodeWorkDir: string, preset: OpencodePreset, apiKey: string): string;
61
+ /**
62
+ * New keyless nodes must not inherit a private-but-preplanted credential.
63
+ * Keep the file present as an explicit empty object so the creation log's
64
+ * "auth not configured" statement matches the state OpenCode will consume.
65
+ */
66
+ export declare function clearOpencodeAuthJson(nodeWorkDir: string): string;
67
+ /**
68
+ * Companion opencode.json: records only the selected blessed provider
69
+ * identity and safe-by-default tool policy. Pre-existing model routing and
70
+ * arbitrary OpenCode integrations are stripped; operators may explicitly set
71
+ * a model after creation, which the runtime's separate safe renderer retains.
72
+ */
73
+ export declare function writeOpencodeConfigJson(nodeWorkDir: string, preset: OpencodePreset): string;
@@ -0,0 +1,30 @@
1
+ export declare const OPENCODE_RUNTIME_BINDING_SCHEMA_VERSION: 1;
2
+ export declare const OPENCODE_RUNTIME_BINDING_RUNTIME: "opencode-cli";
3
+ export declare const OPENCODE_RUNTIME_BINDINGS_DIRECTORY = "opencode-runtime-bindings";
4
+ export interface OpencodeRuntimeBinding {
5
+ schemaVersion: typeof OPENCODE_RUNTIME_BINDING_SCHEMA_VERSION;
6
+ runtime: typeof OPENCODE_RUNTIME_BINDING_RUNTIME;
7
+ projectRoot: string;
8
+ nodeId: string;
9
+ }
10
+ /** Windows reports synthetic POSIX permission bits; retain all other checks there. */
11
+ export declare function isOpencodeRuntimeBindingModeSecure(mode: number, exactMode?: number, platform?: NodeJS.Platform): boolean;
12
+ /** Resolve the deterministic binding path without creating HOME state. */
13
+ export declare function opencodeRuntimeBindingPath(nodeWorkDir: string, homeDirectory?: string): string;
14
+ /** Persist an external, immutable-by-config record that this node was created as OpenCode. */
15
+ export declare function writeOpencodeRuntimeBinding(nodeWorkDir: string, homeDirectory?: string): string;
16
+ /** Read and validate a binding. Missing bindings return undefined; unsafe or tampered state throws. */
17
+ export declare function readOpencodeRuntimeBinding(nodeWorkDir: string, homeDirectory?: string): OpencodeRuntimeBinding | undefined;
18
+ /**
19
+ * Remove only the exact, validated binding for this node. Missing exact state is
20
+ * idempotent; malformed, replaced, or unsafe state always fails closed.
21
+ */
22
+ export declare function removeOpencodeRuntimeBinding(nodeWorkDir: string, homeDirectory?: string): boolean;
23
+ /** Assert that the external record exists and exactly identifies this node as opencode-cli. */
24
+ export declare function assertExactOpencodeRuntimeBinding(nodeWorkDir: string, homeDirectory?: string): OpencodeRuntimeBinding;
25
+ /**
26
+ * Refuse OpenCode node state committed to a surrounding Git index. A normal
27
+ * non-Git project is allowed. Git is always invoked directly with argv and a
28
+ * literal pathspec; no shell or command interpolation is used.
29
+ */
30
+ export declare function assertOpencodeNodeStateUntracked(nodeWorkDir: string): void;
@@ -0,0 +1,36 @@
1
+ /** Exact 1.18.1 project/instruction discovery surface plus project-root
2
+ * redirects. Any existing entry, including a broken symlink, is a refusal. */
3
+ export declare const OPENCODE_SAFE_ANCESTOR_CANDIDATES: readonly ["opencode.jsonc", "opencode.json", ".opencode", "AGENTS.md", "CLAUDE.md", "CONTEXT.md", ".claude", ".agents", ".git"];
4
+ interface PathIdentity {
5
+ path: string;
6
+ dev: number | bigint;
7
+ ino: number | bigint;
8
+ }
9
+ export interface OpencodeSafeExternalRoot {
10
+ readonly base: string;
11
+ readonly root: string;
12
+ readonly cwd: string;
13
+ readonly dev: number | bigint;
14
+ readonly ino: number | bigint;
15
+ readonly baseDev: number | bigint;
16
+ readonly baseIno: number | bigint;
17
+ readonly ancestors: readonly PathIdentity[];
18
+ }
19
+ /** #1845 层② —— 运行时隔离 base 的平台策略。规则(祖先不可符号链接、非 root 只能是本 uid、无 0o022 写位、
20
+ * base 本身 uid-owned 0700)三平台一样;不同的只有**默认 base 在哪**:
21
+ * linux → /run/user/<uid>(systemd 的每用户 0700 运行目录;缺失时仅 root 可建)
22
+ * darwin → realpath($TMPDIR)(macOS 每用户 0700 的 /private/var/folders/xx/<hash>/T;2026-09-07 Mac mini 量过
23
+ * 全链:T 700 uid、<hash> 755 uid、其余 755 root,满足同一套祖先规则)
24
+ * 其它 → 拦(win32 没有 uid 语义)
25
+ * 显式 base(参数或 ANET_OPENCODE_SAFE_BASE)三平台通用。platform / env 可注入,便于在 Linux CI 上测 darwin 分支。 */
26
+ export declare const OPENCODE_SAFE_ROOT_PLATFORMS: ReadonlySet<NodeJS.Platform>;
27
+ export declare function defaultOpencodeRuntimeBase(uid: number, platform: NodeJS.Platform, env: NodeJS.ProcessEnv): string;
28
+ export declare function resolveOpencodeTrustedRuntimeBase(explicit?: string, platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): PathIdentity;
29
+ export declare function createOpencodeSafeExternalRoot(options: {
30
+ prefix: string;
31
+ boundaries?: readonly string[];
32
+ base?: string;
33
+ }): OpencodeSafeExternalRoot;
34
+ export declare function revalidateOpencodeSafeExternalRoot(context: OpencodeSafeExternalRoot): void;
35
+ export declare function cleanupOpencodeSafeExternalRoot(context: OpencodeSafeExternalRoot): void;
36
+ export {};
@@ -0,0 +1 @@
1
+ export declare function buildOpencodeSmokeEnv(parentEnv: NodeJS.ProcessEnv, smokeRoot: string, cwd?: string): NodeJS.ProcessEnv;
@@ -0,0 +1,44 @@
1
+ export type OpencodeGeneration = "v1" | "v2";
2
+ export type OpencodeSupportStatus = "supported" | "preview" | "unsupported";
3
+ export interface OpencodeGenerationSupport {
4
+ readonly generation: OpencodeGeneration;
5
+ /** npm package that provides the `opencode` executable. */
6
+ readonly packageName: string;
7
+ /** Release pin: the exact version a fresh install is told to use.
8
+ * null when no version of this generation is vetted. */
9
+ readonly pin: string | null;
10
+ /** Every exact version a start may accept, preferred first (pin first).
11
+ * Empty when the generation is unsupported. */
12
+ readonly acceptedVersions: readonly string[];
13
+ readonly status: OpencodeSupportStatus;
14
+ }
15
+ /** The V1 release pin. Kept as its own literal line so shell suites can
16
+ * read it with a single anchored sed (tests/test1225…/run.sh). */
17
+ export declare const OPENCODE_V1_PIN = "1.18.34";
18
+ /** The V2 preview pin (#543). Vetted by tests/test543-… against a stub model. */
19
+ export declare const OPENCODE_V2_PIN = "2.0.22";
20
+ export declare const OPENCODE_SUPPORTED_VERSIONS: readonly OpencodeGenerationSupport[];
21
+ /** Generation assumed for every node record that does not name one. */
22
+ export declare const OPENCODE_DEFAULT_GENERATION: OpencodeGeneration;
23
+ export declare function isOpencodeGeneration(value: unknown): value is OpencodeGeneration;
24
+ export declare function opencodeGenerationSupport(generation: OpencodeGeneration): OpencodeGenerationSupport;
25
+ /** Exact versions a start may accept for `generation`, preferred first.
26
+ * Always empty for an unsupported generation. */
27
+ export declare function acceptedOpencodeVersionsFor(generation: OpencodeGeneration): readonly string[];
28
+ export declare function isAcceptedOpencodeVersionFor(generation: OpencodeGeneration, version: string): boolean;
29
+ /** Generation recorded on a node config; a config without one (every node
30
+ * created before #542) is V1. An unrecognised value is returned as
31
+ * undefined so callers can refuse it instead of guessing. */
32
+ export declare function opencodeGenerationOfConfig(config: {
33
+ opencodeGeneration?: unknown;
34
+ } | null | undefined): OpencodeGeneration | undefined;
35
+ /** Why `generation` may not run on a node with these settings, as ONE
36
+ * actionable line — or null when it may. V1 is never refused here. V2
37
+ * (#543 preview) runs only in co-presence mode and only with
38
+ * flags.opencodeUnsafeTools=true: it ignores the V1 safety env, so under the
39
+ * default safe preset it would run with every local tool enabled. */
40
+ export declare function opencodeGenerationRefusal(generation: OpencodeGeneration, opts: {
41
+ unsafeTools: boolean;
42
+ mode?: "headless" | "copresence" | string;
43
+ configFile?: string;
44
+ }): string | null;