@sleep2agi/agent-network 2.3.0-preview.1 → 2.3.0-preview.100

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 (120) hide show
  1. package/README.md +35 -324
  2. package/dist/bin/anet.cjs +101 -0
  3. package/dist/bin/cli.d.ts +3 -1
  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-meta.d.ts +10 -0
  11. package/dist/src/channel-task-trace.d.ts +14 -0
  12. package/dist/src/claude-vendor-env.d.ts +28 -0
  13. package/dist/src/cli-args.d.ts +8 -0
  14. package/dist/src/cli-version-display.d.ts +16 -0
  15. package/dist/src/client-task-trace.d.ts +9 -0
  16. package/dist/src/client.js +1 -1
  17. package/dist/src/codex-auth-fingerprint.d.ts +211 -0
  18. package/dist/src/codex-copresence-preflight.d.ts +65 -0
  19. package/dist/src/codex-copresence-profile.d.ts +125 -0
  20. package/dist/src/codex-copresence-recovery.d.ts +43 -0
  21. package/dist/src/codex-copresence-thread.d.ts +13 -0
  22. package/dist/src/codex-lifecycle-account.d.ts +104 -0
  23. package/dist/src/codex-lifecycle-canary.d.ts +20 -0
  24. package/dist/src/codex-lifecycle-facts.d.ts +53 -0
  25. package/dist/src/codex-lifecycle-fork.d.ts +53 -0
  26. package/dist/src/codex-lifecycle-preflight.d.ts +77 -0
  27. package/dist/src/codex-lifecycle-receipt.d.ts +44 -0
  28. package/dist/src/codex-lifecycle-restart.d.ts +86 -0
  29. package/dist/src/codex-model-default.d.ts +6 -0
  30. package/dist/src/codex-tui-client-health.d.ts +17 -0
  31. package/dist/src/commhub-response.d.ts +1 -0
  32. package/dist/src/controlled-upload.d.ts +83 -0
  33. package/dist/src/copresence-deps.d.ts +22 -0
  34. package/dist/src/copresence-identity.d.ts +353 -0
  35. package/dist/src/copresence-startup-diagnosis.d.ts +17 -0
  36. package/dist/src/daemon-capability-display.d.ts +110 -0
  37. package/dist/src/daemon-capability-display.js +21 -0
  38. package/dist/src/daemon-runtime-path-preflight.d.ts +22 -0
  39. package/dist/src/daemon-runtime-staleness.d.ts +13 -0
  40. package/dist/src/dashboard-managed-process.d.ts +35 -0
  41. package/dist/src/display-width.d.ts +27 -0
  42. package/dist/src/doctor-node-count.d.ts +28 -0
  43. package/dist/src/environ-alias.d.ts +14 -0
  44. package/dist/src/grok-attach-client.d.ts +129 -0
  45. package/dist/src/grok-build-drift.d.ts +15 -0
  46. package/dist/src/grok-copresence-disclosure.d.ts +11 -0
  47. package/dist/src/grok-copresence-orchestration.d.ts +75 -0
  48. package/dist/src/grok-copresence-profile.d.ts +65 -0
  49. package/dist/src/host-telemetry.d.ts +14 -0
  50. package/dist/src/hub-health-timeout.d.ts +4 -0
  51. package/dist/src/hub-time-display.d.ts +20 -0
  52. package/dist/src/hub-version-skew.d.ts +19 -0
  53. package/dist/src/im/access-resolve.d.ts +103 -0
  54. package/dist/src/im/correlation-store.d.ts +34 -0
  55. package/dist/src/im/feishu/adapter.d.ts +149 -1
  56. package/dist/src/im/feishu/bridge.d.ts +85 -14
  57. package/dist/src/im/feishu/config.d.ts +31 -0
  58. package/dist/src/im/feishu/hub-upload.d.ts +88 -0
  59. package/dist/src/im/feishu/markdown-image-renderer.d.ts +61 -0
  60. package/dist/src/im/feishu/outbound-marker.d.ts +140 -0
  61. package/dist/src/im/feishu/outbound-paths.d.ts +50 -0
  62. package/dist/src/im/feishu/outbound-route.d.ts +62 -0
  63. package/dist/src/im/feishu/worker-lifecycle.d.ts +13 -0
  64. package/dist/src/im/feishu/worker.js +403 -16
  65. package/dist/src/im/types.d.ts +38 -1
  66. package/dist/src/inbox-drain.d.ts +20 -0
  67. package/dist/src/local-process-state.d.ts +12 -0
  68. package/dist/src/locale-diagnostic.d.ts +12 -0
  69. package/dist/src/ls-columns.d.ts +15 -0
  70. package/dist/src/mock-llm.d.ts +12 -0
  71. package/dist/src/node-activity-log.d.ts +4 -0
  72. package/dist/src/node-not-found.d.ts +1 -0
  73. package/dist/src/node-running-guard.d.ts +9 -0
  74. package/dist/src/node-server-payload.d.ts +66 -0
  75. package/dist/src/node-server.js +7 -1
  76. package/dist/src/normalize-runtime.d.ts +36 -0
  77. package/dist/src/offline-age.d.ts +29 -0
  78. package/dist/src/one-line-cell.d.ts +20 -0
  79. package/dist/src/opencode-agent-node-pair.d.ts +25 -0
  80. package/dist/src/opencode-auth-login.d.ts +43 -0
  81. package/dist/src/opencode-launch-env.d.ts +13 -0
  82. package/dist/src/opencode-owner-mode.d.ts +6 -0
  83. package/dist/src/opencode-package-binary.d.ts +26 -0
  84. package/dist/src/opencode-pin.d.ts +44 -0
  85. package/dist/src/opencode-preset.d.ts +73 -0
  86. package/dist/src/opencode-runtime-binding.d.ts +30 -0
  87. package/dist/src/opencode-safe-root.d.ts +36 -0
  88. package/dist/src/opencode-smoke-env.d.ts +1 -0
  89. package/dist/src/outbound-attachments.d.ts +60 -0
  90. package/dist/src/outbound-tool-names.d.ts +1 -0
  91. package/dist/src/owned-roots.d.ts +58 -0
  92. package/dist/src/owner-env-file.d.ts +2 -0
  93. package/dist/src/package-mode-preflight.d.ts +41 -0
  94. package/dist/src/posix-codex-copresence.d.ts +8 -0
  95. package/dist/src/posix-modes.d.ts +36 -0
  96. package/dist/src/primary-network.d.ts +23 -0
  97. package/dist/src/private-state.d.ts +10 -0
  98. package/dist/src/process-telemetry.d.ts +12 -0
  99. package/dist/src/profile-serialize.d.ts +1 -0
  100. package/dist/src/project-key.d.ts +1 -0
  101. package/dist/src/reply-local-links.d.ts +47 -0
  102. package/dist/src/reply-originator.d.ts +20 -0
  103. package/dist/src/resume-runtime-infer.d.ts +18 -0
  104. package/dist/src/secret-shell-guidance.d.ts +3 -0
  105. package/dist/src/session-status-class.d.ts +48 -0
  106. package/dist/src/sibling-agent-node.d.ts +23 -0
  107. package/dist/src/stale-socket.d.ts +118 -0
  108. package/dist/src/subcommand-redirect.d.ts +26 -0
  109. package/dist/src/supervise-child.d.ts +69 -0
  110. package/dist/src/task-trace.d.ts +33 -0
  111. package/dist/src/tmux-attach.d.ts +8 -0
  112. package/dist/src/tmux-capability.d.ts +58 -0
  113. package/dist/src/tmux-exact-target.d.ts +34 -0
  114. package/dist/src/tmux-pane-prompt.d.ts +22 -0
  115. package/dist/src/token-cli.d.ts +13 -0
  116. package/dist/src/tool-allowlist.d.ts +28 -0
  117. package/dist/src/unsafe-package-path-reason.d.ts +17 -0
  118. package/dist/src/win-launcher.d.ts +20 -0
  119. package/dist/src/windows-codex-copresence.d.ts +60 -0
  120. package/package.json +14 -6
@@ -0,0 +1,50 @@
1
+ /**
2
+ * RFC-020 §15.1 — feishu outbound/attachment path helpers (SHARED).
3
+ *
4
+ * Single source of truth for `/work/feishu-attachments/<conn>/<convKey>/`
5
+ * naming. Used by:
6
+ *
7
+ * - `adapter.ts` inbound `downloadImage` (subdir for received images),
8
+ * - `bridge.ts` outbound marker whitelist (where the agent may write),
9
+ * - `worker.ts` outbound envelope (the concrete path injected into the
10
+ * agent's prompt, so what we tell the agent matches what we accept).
11
+ *
12
+ * 2026-06-29 Vincent UAT: prior to this module, the inbound downloader
13
+ * used `conversationId.replace(/[^a-zA-Z0-9_-]/g, "_")` and the outbound
14
+ * bridge whitelist used `sender.id` for DMs / `chatId` for groups. The
15
+ * two algorithms diverged — agent learned the inbound oc_<chat>/ layout
16
+ * from incoming attachments, then wrote outbound files to the same
17
+ * oc_<chat>/ subdir, but the bridge required ou_<userid>/. Every PDF
18
+ * generated by the bot was rejected. This module unifies on
19
+ * `conversationId` (the open_chat_id assigned by Feishu — present for
20
+ * DMs and groups equally).
21
+ */
22
+ /**
23
+ * Sanitize a raw Feishu conversation id (`oc_<hex>` / occasionally
24
+ * `om_<id>` for DMs) into a filesystem-safe segment. Identical to the
25
+ * adapter.ts inbound download path policy — DO NOT CHANGE without also
26
+ * migrating any on-disk attachments under the old key.
27
+ *
28
+ * The regex strips anything outside `[A-Za-z0-9_-]`, replacing with `_`.
29
+ * Falsy / non-string input returns the empty string; caller is
30
+ * responsible for substituting a fallback (the empty key would resolve
31
+ * to `/work/feishu-attachments/<conn>//` which the path-prefix
32
+ * whitelist rejects cleanly).
33
+ */
34
+ export declare function feishuConvKey(rawId: string | undefined | null): string;
35
+ /**
36
+ * Compute the canonical per-conversation directory for outbound file
37
+ * dispatch + inbound attachment downloads. Trailing slash included so
38
+ * `.startsWith(...)` whitelist checks are unambiguous about the
39
+ * conversation boundary (no `oc_abc` matching `oc_abc_x`).
40
+ *
41
+ * Example:
42
+ * feishuOutboundDir("feishu-local", "oc_9a7eedbba275a87999f7ee2cfb10f4cb")
43
+ * → "/work/feishu-attachments/feishu-local/oc_9a7eedbba275a87999f7ee2cfb10f4cb/"
44
+ */
45
+ export declare function feishuOutboundDir(connectionName: string, rawConvId: string | undefined | null): string;
46
+ /**
47
+ * The fixed prefix root used as a sanity check by the marker validator.
48
+ * Useful for tests + for `validateOutboundPath` defense-in-depth.
49
+ */
50
+ export declare const OUTBOUND_ROOT = "/work/feishu-attachments";
@@ -0,0 +1,62 @@
1
+ /**
2
+ * RFC-020 §16.1 — feishu outbound route decision (pure helper).
3
+ *
4
+ * Single source of truth for the `adapter.send` decision tree that
5
+ * picks among text / interactive card / image (rendered PNG) / file /
6
+ * imagePath outputs. Extracted into a pure module so the production
7
+ * call site AND the unit tests can bind the same function — previously
8
+ * the test mirrored the decision tree in a sibling `pickRoute` helper,
9
+ * which would drift silently if the production tree changed.
10
+ *
11
+ * Inputs are the minimal data the decision needs:
12
+ *
13
+ * - `text` / `imagePath` / `files` — payload from `NormalizedIMMessage`
14
+ * - `forceTextOnly` — caption-mode hint (RFC-020 §15.2)
15
+ * - `mode` — channel-config `outboundRender` (`"plain"` / `"card"` /
16
+ * `"auto"`, RFC-020 §16)
17
+ *
18
+ * Outputs the chosen `route` plus a short `reason` string for log /
19
+ * debug. The CALLER (adapter.send) actually performs the upload /
20
+ * render side-effects keyed on the route — this function does no I/O.
21
+ *
22
+ * Behavior contract (mirrors adapter.send line-for-line, locked by
23
+ * `feishu-outbound-render-mode.test.ts`):
24
+ *
25
+ * 1. `imagePath` set → `image_upload`
26
+ * 2. `files[0].path` set → `file_upload`
27
+ * 3. `forceTextOnly` true → `text`
28
+ * 4. mode "plain" → `text` (always)
29
+ * 5. mode "card" → `card_short_md` iff `looksLikeMarkdown(text)` AND
30
+ * NOT `shouldRenderAsImage(text)`; else `text`
31
+ * 6. mode "auto" → `image_render` iff `shouldRenderAsImage(text)`;
32
+ * else `card_short_md` iff `looksLikeMarkdown(text)`; else `text`
33
+ * 7. unknown mode (defensive default-default) → `text`
34
+ *
35
+ * The production switch in adapter.send may add the actual upload /
36
+ * render / lark API calls keyed on the route, but the route itself
37
+ * is decided HERE. To change the decision, change this file.
38
+ */
39
+ export type OutboundRoute = "image_upload" | "file_upload" | "text" | "card_short_md" | "image_render";
40
+ export interface RouteInput {
41
+ text?: string;
42
+ imagePath?: string;
43
+ files?: {
44
+ name: string;
45
+ path?: string;
46
+ }[];
47
+ forceTextOnly?: boolean;
48
+ /** `outboundRender` from the channel config. Defaults to "plain" when
49
+ * absent so a caller that doesn't read the config still gets the
50
+ * "Vincent default" behavior. */
51
+ mode?: "plain" | "card" | "auto";
52
+ }
53
+ export interface RouteDecision {
54
+ route: OutboundRoute;
55
+ reason: string;
56
+ }
57
+ /**
58
+ * Decide the outbound route for a `NormalizedIMMessage` (or a subset
59
+ * of its fields). Pure — no I/O, no SDK calls; safe to call from tests
60
+ * directly.
61
+ */
62
+ export declare function resolveOutboundRoute(input: RouteInput): RouteDecision;
@@ -0,0 +1,13 @@
1
+ interface WorkerProcessBoundary {
2
+ stderr: {
3
+ write(message: string): unknown;
4
+ };
5
+ exit(code: number): unknown;
6
+ }
7
+ /**
8
+ * A terminal WS error means this worker no longer owns a live ingress path.
9
+ * Exit non-zero so the parent/supervisor cannot continue advertising it as
10
+ * healthy. Kept separate from worker.ts so the real exit contract is testable.
11
+ */
12
+ export declare function exitFeishuWorker(error: Error, boundary?: WorkerProcessBoundary): void;
13
+ export {};