@sleep2agi/agent-network 2.3.0-preview.11 → 2.3.0-preview.111
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/dist/bin/anet.cjs +101 -0
- package/dist/bin/cli.d.ts +1 -0
- package/dist/bin/cli.js +20 -1
- package/dist/bin/goal-wake-log-render.d.ts +31 -0
- 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/channel-attachments.d.ts +29 -0
- package/dist/src/channel-meta.d.ts +10 -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-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-auth-fingerprint.d.ts +211 -0
- package/dist/src/codex-copresence-preflight.d.ts +65 -0
- package/dist/src/codex-copresence-profile.d.ts +125 -0
- package/dist/src/codex-copresence-recovery.d.ts +43 -0
- package/dist/src/codex-copresence-thread.d.ts +13 -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 +77 -0
- package/dist/src/codex-lifecycle-receipt.d.ts +44 -0
- package/dist/src/codex-lifecycle-restart.d.ts +86 -0
- package/dist/src/codex-model-default.d.ts +6 -0
- package/dist/src/codex-tui-client-health.d.ts +17 -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 +353 -0
- package/dist/src/copresence-startup-diagnosis.d.ts +17 -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-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/environ-alias.d.ts +14 -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/host-telemetry.d.ts +14 -0
- package/dist/src/hub-health-timeout.d.ts +4 -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 +80 -0
- package/dist/src/im/feishu/bridge.d.ts +78 -14
- package/dist/src/im/feishu/config.d.ts +31 -0
- package/dist/src/im/feishu/hub-upload.d.ts +88 -0
- package/dist/src/im/feishu/outbound-route.d.ts +62 -0
- package/dist/src/im/feishu/worker-lifecycle.d.ts +13 -0
- package/dist/src/im/feishu/worker.js +187 -144
- package/dist/src/im/types.d.ts +30 -1
- 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/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-not-found.d.ts +1 -0
- package/dist/src/node-running-guard.d.ts +9 -0
- package/dist/src/node-server-payload.d.ts +66 -0
- package/dist/src/node-server-rules-file.d.ts +12 -0
- package/dist/src/node-server.js +7 -1
- package/dist/src/normalize-runtime.d.ts +29 -2
- 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 +25 -0
- package/dist/src/opencode-auth-login.d.ts +43 -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 +26 -0
- package/dist/src/opencode-pin.d.ts +44 -0
- package/dist/src/opencode-preset.d.ts +73 -0
- package/dist/src/opencode-runtime-binding.d.ts +30 -0
- package/dist/src/opencode-safe-root.d.ts +36 -0
- package/dist/src/opencode-smoke-env.d.ts +1 -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 +8 -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 +10 -0
- package/dist/src/process-telemetry.d.ts +12 -0
- package/dist/src/profile-serialize.d.ts +1 -0
- package/dist/src/project-key.d.ts +1 -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 +40 -0
- package/dist/src/secret-shell-guidance.d.ts +3 -0
- package/dist/src/session-status-class.d.ts +48 -0
- package/dist/src/sibling-agent-node.d.ts +23 -0
- package/dist/src/stale-socket.d.ts +118 -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 +8 -0
- package/dist/src/tmux-capability.d.ts +58 -0
- package/dist/src/tmux-exact-target.d.ts +34 -0
- package/dist/src/tmux-pane-prompt.d.ts +22 -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 +17 -0
- package/dist/src/win-launcher.d.ts +20 -0
- package/dist/src/windows-codex-copresence.d.ts +60 -0
- package/package.json +10 -5
package/dist/src/im/types.d.ts
CHANGED
|
@@ -72,13 +72,42 @@ export interface NormalizedIMEvent {
|
|
|
72
72
|
mentioned: boolean;
|
|
73
73
|
content: {
|
|
74
74
|
text?: string;
|
|
75
|
-
/** Local filesystem paths to already-downloaded images.
|
|
75
|
+
/** Local filesystem paths to already-downloaded images.
|
|
76
|
+
*
|
|
77
|
+
* RFC-020 §17 backward-compat shim: the new richer
|
|
78
|
+
* `attachments[]` field below is the canonical source going
|
|
79
|
+
* forward. `images` stays a `string[]` of paths so an older
|
|
80
|
+
* agent-node worker reading this envelope across a rolling
|
|
81
|
+
* upgrade doesn't crash. New workers prefer `attachments`,
|
|
82
|
+
* old workers ignore it and keep using `images`. */
|
|
76
83
|
images?: string[];
|
|
77
84
|
files?: {
|
|
78
85
|
name: string;
|
|
79
86
|
path?: string;
|
|
80
87
|
url?: string;
|
|
81
88
|
}[];
|
|
89
|
+
/** RFC-020 §17 cross-machine attachment descriptors.
|
|
90
|
+
*
|
|
91
|
+
* Each entry mirrors `meta.attachments[]` on commhub tasks
|
|
92
|
+
* (`{ type, file_id?, path?, mime?, name?, size? }`). The
|
|
93
|
+
* feishu bridge populates `file_id` by uploading inbound
|
|
94
|
+
* files to `/api/upload` so cross-host agents delegated via
|
|
95
|
+
* `commhub_send_task(meta.attachments=...)` can fetch via
|
|
96
|
+
* `/api/files/<id>`. When upload fails, `file_id` is absent
|
|
97
|
+
* and the descriptor degrades to path-only (single-host
|
|
98
|
+
* still works via local Read; no regression vs pre-fix
|
|
99
|
+
* baseline).
|
|
100
|
+
*
|
|
101
|
+
* Always populated alongside `images` for the same files —
|
|
102
|
+
* duplication is intentional for rolling-upgrade safety. */
|
|
103
|
+
attachments?: Array<{
|
|
104
|
+
type: "image" | "file";
|
|
105
|
+
path?: string;
|
|
106
|
+
file_id?: string;
|
|
107
|
+
mime?: string;
|
|
108
|
+
name?: string;
|
|
109
|
+
size?: number;
|
|
110
|
+
}>;
|
|
82
111
|
};
|
|
83
112
|
/**
|
|
84
113
|
* Original platform payload. Default: held in memory only and dropped after
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface InboxPage<T> {
|
|
2
|
+
ok?: boolean;
|
|
3
|
+
messages?: T[];
|
|
4
|
+
}
|
|
5
|
+
export interface DrainOptions<T extends {
|
|
6
|
+
id: string;
|
|
7
|
+
}> {
|
|
8
|
+
fetchPage: (limit: number) => Promise<InboxPage<T> | undefined | null>;
|
|
9
|
+
handle: (msg: T) => Promise<void>;
|
|
10
|
+
pageSize?: number;
|
|
11
|
+
maxPages?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface DrainResult {
|
|
14
|
+
delivered: number;
|
|
15
|
+
pages: number;
|
|
16
|
+
stoppedBy: "empty" | "short-page" | "max-pages" | "no-progress" | "fetch-error";
|
|
17
|
+
}
|
|
18
|
+
export declare function drainInbox<T extends {
|
|
19
|
+
id: string;
|
|
20
|
+
}>(opts: DrainOptions<T>): Promise<DrainResult>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type LocalProcessState = {
|
|
2
|
+
kind: "alive";
|
|
3
|
+
pid: number;
|
|
4
|
+
} | {
|
|
5
|
+
kind: "stale";
|
|
6
|
+
pid: number;
|
|
7
|
+
} | {
|
|
8
|
+
kind: "none";
|
|
9
|
+
};
|
|
10
|
+
export declare function describeLocalProcess(state: LocalProcessState): string;
|
|
11
|
+
/** doctor 印完节点清单后的那一句:说清这一列量的是本机,不是 hub。 */
|
|
12
|
+
export declare const LOCAL_VS_HUB_NOTE: string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface LocaleDiagnostic {
|
|
2
|
+
effectiveVariable: "LC_ALL" | "LC_CTYPE" | "LANG" | null;
|
|
3
|
+
effectiveValue: string | null;
|
|
4
|
+
shouldWarn: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the locale with the same precedence used by POSIX libc. Windows
|
|
8
|
+
* does not use these variables as its process Unicode boundary, so prescribing
|
|
9
|
+
* a POSIX locale there would be misleading.
|
|
10
|
+
*/
|
|
11
|
+
export declare function diagnoseLocale(env: Readonly<Record<string, string | undefined>>, platform: string): LocaleDiagnostic;
|
|
12
|
+
export declare function formatLocaleSource(diagnostic: LocaleDiagnostic): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 一列该多宽:装得下表头,也装得下这一列里最长的那个值。
|
|
3
|
+
*
|
|
4
|
+
* 🔴 两处用它的地方来源不同,但问题一样:
|
|
5
|
+
* - `anet node ls` 的 RUNTIME 列:值域来自 `SUPPORTED_RUNTIME_NAMES`(唯一真源);
|
|
6
|
+
* - `anet status` / `anet tasks` 的 STATUS 列:值域散在 server/ 里(另一个包),
|
|
7
|
+
* CLI 没法 import —— 但**要打印的那些行就在手上**,直接从数据算。
|
|
8
|
+
*
|
|
9
|
+
* 两种情况都不该写死一个数:写死的那个,下一次加 runtime / 加状态时就漂了。
|
|
10
|
+
*/
|
|
11
|
+
export declare function columnWidth(values: readonly unknown[], header: string): number;
|
|
12
|
+
/** RUNTIME 列的专用入口 —— 保留原名,调用点不用改。 */
|
|
13
|
+
export declare function runtimeColumnWidth(names: readonly string[], header?: string): number;
|
|
14
|
+
export declare function lsHeaderRow(runtimeWidth: number): string;
|
|
15
|
+
export declare function lsSeparatorRow(runtimeWidth: number): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const MOCK_LLM_FALLBACK = "(mock LLM: no rule matched)";
|
|
2
|
+
export type MockLlmRule = Readonly<{
|
|
3
|
+
in_substring: string;
|
|
4
|
+
out: string;
|
|
5
|
+
}>;
|
|
6
|
+
export type MockLlmResolution = Readonly<{
|
|
7
|
+
reply: string;
|
|
8
|
+
matched: boolean;
|
|
9
|
+
ruleIndex: number | null;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function loadMockLlmRules(path: string): readonly MockLlmRule[];
|
|
12
|
+
export declare function resolveMockLlmReply(rules: readonly MockLlmRule[], prompt: string, warn?: (message: string) => void): MockLlmResolution;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function nodeNotFoundMessage(ref: string, knownNames: string[], suggestion: string | null): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const isAgentNodeCommand: (cmdline: string) => boolean;
|
|
2
|
+
export interface RunningNodeProbe {
|
|
3
|
+
pidFileContent: string | null;
|
|
4
|
+
isAlive: (pid: number) => boolean;
|
|
5
|
+
commandOf: (pid: number) => string | null;
|
|
6
|
+
}
|
|
7
|
+
/** 返回还活着且确实是 agent-node 的 pid;否则 null(不存在 / 死了 / pid 被别的进程复用)。 */
|
|
8
|
+
export declare const runningNodePid: (probe: RunningNodeProbe) => number | null;
|
|
9
|
+
export declare const alreadyRunningMessage: (displayName: string, pid: number) => string[];
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What gets written to `<project>/.anet/node-server.js` (issue #1216).
|
|
3
|
+
*
|
|
4
|
+
* The target name is not negotiable: `agent-node`'s grok co-presence spawn
|
|
5
|
+
* gate pins the CommHub MCP payload to exactly that path, so whatever the
|
|
6
|
+
* source is, the file that lands there is called `.js`.
|
|
7
|
+
*
|
|
8
|
+
* 🔴 The bug this module exists to remove: the old code copied the source
|
|
9
|
+
* verbatim and justified it with a comment claiming
|
|
10
|
+
*
|
|
11
|
+
* "bun runs .ts content under a .js extension fine"
|
|
12
|
+
*
|
|
13
|
+
* which is false — bun selects its parser from the extension:
|
|
14
|
+
*
|
|
15
|
+
* $ printf 'function f(x: string): void {}\nf("hi");\n' > probe.ts
|
|
16
|
+
* $ cp probe.ts probe.js
|
|
17
|
+
* $ bun probe.ts → runs
|
|
18
|
+
* $ bun probe.js → error: Expected ")" but found ":"
|
|
19
|
+
*
|
|
20
|
+
* An installed npm package never hit it, because its first resolver candidate
|
|
21
|
+
* (`dist/src/node-server.js`) is compiled. Only a source checkout fell through
|
|
22
|
+
* to `src/node-server.ts` — i.e. every local run and every hand-verified PR.
|
|
23
|
+
*
|
|
24
|
+
* And the symptom was three layers from the cause: the node died on
|
|
25
|
+
* `grok copresence CommHub MCP readiness preflight failed (1)`, which names
|
|
26
|
+
* neither a file nor a parse error.
|
|
27
|
+
*/
|
|
28
|
+
/** Injected so the decision is testable without spawning anything. */
|
|
29
|
+
export interface TypeScriptBundler {
|
|
30
|
+
/** Returns the self-contained JavaScript for `entryPath`, or throws. */
|
|
31
|
+
bundleSync(entryPath: string): string;
|
|
32
|
+
}
|
|
33
|
+
export declare class NodeServerPayloadError extends Error {
|
|
34
|
+
constructor(message: string);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Decide what bytes belong at the `.js` target for a given source path.
|
|
38
|
+
*
|
|
39
|
+
* A `.js` source is passed through untouched — the published package ships a
|
|
40
|
+
* compiled bundle there, and re-processing it risks changing bytes for no gain.
|
|
41
|
+
*
|
|
42
|
+
* 🔴 A `.ts` source must be **bundled, not merely transpiled**. Stripping types
|
|
43
|
+
* fixes the parse error but leaves the file's relative imports pointing at
|
|
44
|
+
* siblings that do not exist beside the destination:
|
|
45
|
+
*
|
|
46
|
+
* import { inboundChannelMeta } from "./channel-meta.js";
|
|
47
|
+
* → Cannot find module './channel-meta.js' from '<project>/.anet/node-server.js'
|
|
48
|
+
*
|
|
49
|
+
* That second failure is why transpiling alone still ended at
|
|
50
|
+
* "CommHub MCP readiness preflight failed (1)". The published
|
|
51
|
+
* `dist/src/node-server.js` works precisely because it is a self-contained
|
|
52
|
+
* bundle, so a source checkout has to produce the same shape.
|
|
53
|
+
*/
|
|
54
|
+
export declare function nodeServerPayloadFor(source: string, sourcePath: string, bundler: TypeScriptBundler | null): string;
|
|
55
|
+
/**
|
|
56
|
+
* The bundler available on this runtime, or null.
|
|
57
|
+
*
|
|
58
|
+
* bun can bundle; the published CLI runs under node and cannot — but it also
|
|
59
|
+
* never resolves a `.ts` candidate (its `dist/` copy wins), so null there is
|
|
60
|
+
* correct rather than a gap.
|
|
61
|
+
*
|
|
62
|
+
* `spawnSync` rather than `Bun.build()` because both call sites are
|
|
63
|
+
* synchronous, and making them async would change the ordering of the file
|
|
64
|
+
* writes around them.
|
|
65
|
+
*/
|
|
66
|
+
export declare function ambientTypeScriptTranspiler(): TypeScriptBundler | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const CLAUDE_CODE_RULES_RUNTIME = "claude";
|
|
2
|
+
export interface RulesDoorbellDeps {
|
|
3
|
+
callCommHub: (method: string, params: Record<string, unknown>) => Promise<any>;
|
|
4
|
+
workDir: string;
|
|
5
|
+
log: (msg: string) => void;
|
|
6
|
+
}
|
|
7
|
+
/** SSE 事件分派:是 rules_file 门铃就处理并返回 true;其它事件原样返回 false。 */
|
|
8
|
+
export declare function handleRulesFileEvent(event: {
|
|
9
|
+
type?: unknown;
|
|
10
|
+
} | null | undefined, deps: RulesDoorbellDeps): Promise<boolean>;
|
|
11
|
+
/** 连上 / 重连后补拉一次:断线期间桌面端可能已发起请求(hub 侧 60s 内仍 pending)。 */
|
|
12
|
+
export declare function drainRulesFileRequests(deps: RulesDoorbellDeps, why: string): Promise<number>;
|