@sleep2agi/agent-network 2.3.0-preview.6 → 2.3.0-preview.61

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 (77) 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/batch-workdir.d.ts +9 -0
  7. package/dist/src/bootstrap-password-db.d.ts +13 -0
  8. package/dist/src/channel-attachments.d.ts +29 -0
  9. package/dist/src/channel-meta.d.ts +10 -0
  10. package/dist/src/channel-task-trace.d.ts +10 -0
  11. package/dist/src/claude-vendor-env.d.ts +28 -0
  12. package/dist/src/cli-args.d.ts +8 -0
  13. package/dist/src/client-task-trace.d.ts +9 -0
  14. package/dist/src/client.js +1 -1
  15. package/dist/src/codex-copresence-preflight.d.ts +65 -0
  16. package/dist/src/codex-copresence-profile.d.ts +68 -0
  17. package/dist/src/codex-copresence-recovery.d.ts +43 -0
  18. package/dist/src/codex-copresence-thread.d.ts +13 -0
  19. package/dist/src/codex-model-default.d.ts +6 -0
  20. package/dist/src/codex-tui-client-health.d.ts +17 -0
  21. package/dist/src/commhub-response.d.ts +1 -0
  22. package/dist/src/controlled-upload.d.ts +83 -0
  23. package/dist/src/copresence-deps.d.ts +22 -0
  24. package/dist/src/copresence-identity.d.ts +339 -0
  25. package/dist/src/dashboard-managed-process.d.ts +35 -0
  26. package/dist/src/environ-alias.d.ts +14 -0
  27. package/dist/src/grok-attach-client.d.ts +129 -0
  28. package/dist/src/grok-copresence-disclosure.d.ts +11 -0
  29. package/dist/src/grok-copresence-orchestration.d.ts +70 -0
  30. package/dist/src/grok-copresence-profile.d.ts +65 -0
  31. package/dist/src/im/correlation-store.d.ts +34 -0
  32. package/dist/src/im/feishu/adapter.d.ts +149 -1
  33. package/dist/src/im/feishu/bridge.d.ts +85 -14
  34. package/dist/src/im/feishu/config.d.ts +31 -0
  35. package/dist/src/im/feishu/hub-upload.d.ts +88 -0
  36. package/dist/src/im/feishu/markdown-image-renderer.d.ts +61 -0
  37. package/dist/src/im/feishu/outbound-marker.d.ts +140 -0
  38. package/dist/src/im/feishu/outbound-paths.d.ts +50 -0
  39. package/dist/src/im/feishu/outbound-route.d.ts +62 -0
  40. package/dist/src/im/feishu/worker-lifecycle.d.ts +13 -0
  41. package/dist/src/im/feishu/worker.js +403 -28
  42. package/dist/src/im/types.d.ts +38 -1
  43. package/dist/src/locale-diagnostic.d.ts +12 -0
  44. package/dist/src/mock-llm.d.ts +12 -0
  45. package/dist/src/node-activity-log.d.ts +4 -0
  46. package/dist/src/node-server-payload.d.ts +66 -0
  47. package/dist/src/node-server.js +7 -1
  48. package/dist/src/normalize-runtime.d.ts +29 -2
  49. package/dist/src/opencode-agent-node-pair.d.ts +25 -0
  50. package/dist/src/opencode-auth-login.d.ts +43 -0
  51. package/dist/src/opencode-launch-env.d.ts +13 -0
  52. package/dist/src/opencode-owner-mode.d.ts +6 -0
  53. package/dist/src/opencode-package-binary.d.ts +21 -0
  54. package/dist/src/opencode-pin.d.ts +44 -0
  55. package/dist/src/opencode-preset.d.ts +73 -0
  56. package/dist/src/opencode-runtime-binding.d.ts +30 -0
  57. package/dist/src/opencode-safe-root.d.ts +27 -0
  58. package/dist/src/opencode-smoke-env.d.ts +1 -0
  59. package/dist/src/outbound-tool-names.d.ts +1 -0
  60. package/dist/src/owner-env-file.d.ts +2 -0
  61. package/dist/src/package-mode-preflight.d.ts +31 -0
  62. package/dist/src/posix-codex-copresence.d.ts +8 -0
  63. package/dist/src/primary-network.d.ts +23 -0
  64. package/dist/src/private-state.d.ts +10 -0
  65. package/dist/src/project-key.d.ts +1 -0
  66. package/dist/src/reply-originator.d.ts +20 -0
  67. package/dist/src/resume-runtime-infer.d.ts +18 -0
  68. package/dist/src/secret-shell-guidance.d.ts +3 -0
  69. package/dist/src/task-trace.d.ts +33 -0
  70. package/dist/src/tmux-attach.d.ts +8 -0
  71. package/dist/src/tmux-capability.d.ts +58 -0
  72. package/dist/src/tmux-exact-target.d.ts +34 -0
  73. package/dist/src/tmux-pane-prompt.d.ts +22 -0
  74. package/dist/src/token-cli.d.ts +13 -0
  75. package/dist/src/unsafe-package-path-reason.d.ts +17 -0
  76. package/dist/src/windows-codex-copresence.d.ts +41 -0
  77. package/package.json +10 -6
@@ -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
@@ -115,6 +144,14 @@ export interface NormalizedIMMessage {
115
144
  replyToMessageId?: string;
116
145
  /** Ephemeral / visible-to-sender-only. Slack only; others ignore. */
117
146
  ephemeral?: boolean;
147
+ /** Caption-mode hint (RFC-020 §15.2): bypass markdown-card / markdown→PNG
148
+ * rendering and send as plain text. Set by the bridge when the same
149
+ * dispatch loop is also sending one or more attachment files — the text
150
+ * is a caption ("here's the report"), not the deliverable. Without this
151
+ * hint, Vincent's "make me a PDF" UAT had the bot's accompanying
152
+ * description heading + bullet list rendered to PNG via #329, which
153
+ * read as "you sent another image" instead of "you sent my file". */
154
+ forceTextOnly?: boolean;
118
155
  /** Tie back to the commhub task that produced this message. */
119
156
  correlation: {
120
157
  taskId: 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,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,4 @@
1
+ export interface ActivityLogSink {
2
+ append(line: string): void;
3
+ }
4
+ export declare function createActivityLogSink(baseDir: string, alias: string, now?: () => Date): ActivityLogSink;
@@ -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;