@a1hvdy/cc-openclaw 0.29.0 → 0.31.0

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 (205) hide show
  1. package/dist/src/channels/telegram-mirror/card-renderer.js +9 -5
  2. package/dist/src/channels/telegram-mirror/commands.js +0 -8
  3. package/dist/src/channels/telegram-mirror/status-line.js +32 -2
  4. package/dist/src/constants.js +16 -2
  5. package/dist/src/lib/cache-parity-decide.js +54 -0
  6. package/dist/src/lib/config.js +40 -0
  7. package/dist/src/openai-compat/non-streaming-handler.js +2 -2
  8. package/dist/src/openai-compat/streaming-handler.js +2 -2
  9. package/dist/src/session-bootstrap/cwd-patch.js +61 -1
  10. package/package.json +3 -2
  11. package/dist/src/channels/adapter.d.ts +0 -103
  12. package/dist/src/channels/telegram-mirror/askuser.d.ts +0 -107
  13. package/dist/src/channels/telegram-mirror/burst-accumulator.d.ts +0 -96
  14. package/dist/src/channels/telegram-mirror/callback-mapping.d.ts +0 -61
  15. package/dist/src/channels/telegram-mirror/card-renderer.d.ts +0 -68
  16. package/dist/src/channels/telegram-mirror/card-state.d.ts +0 -83
  17. package/dist/src/channels/telegram-mirror/commands.d.ts +0 -183
  18. package/dist/src/channels/telegram-mirror/compose-buffer.d.ts +0 -71
  19. package/dist/src/channels/telegram-mirror/cost-views.d.ts +0 -58
  20. package/dist/src/channels/telegram-mirror/failure/callback-data-overflow.d.ts +0 -21
  21. package/dist/src/channels/telegram-mirror/failure/gateway-down.d.ts +0 -15
  22. package/dist/src/channels/telegram-mirror/failure/in-flight-conflict.d.ts +0 -15
  23. package/dist/src/channels/telegram-mirror/failure/index.d.ts +0 -23
  24. package/dist/src/channels/telegram-mirror/failure/model-5xx.d.ts +0 -16
  25. package/dist/src/channels/telegram-mirror/failure/network-blip.d.ts +0 -17
  26. package/dist/src/channels/telegram-mirror/failure/pool-exhausted-fallback.d.ts +0 -15
  27. package/dist/src/channels/telegram-mirror/failure/rate-limit.d.ts +0 -16
  28. package/dist/src/channels/telegram-mirror/failure/returning-after-24h.d.ts +0 -14
  29. package/dist/src/channels/telegram-mirror/failure/types.d.ts +0 -30
  30. package/dist/src/channels/telegram-mirror/inbound-handler.d.ts +0 -73
  31. package/dist/src/channels/telegram-mirror/index.d.ts +0 -32
  32. package/dist/src/channels/telegram-mirror/plan-attachment.d.ts +0 -120
  33. package/dist/src/channels/telegram-mirror/quota-reader.d.ts +0 -42
  34. package/dist/src/channels/telegram-mirror/sessions-keyboard.d.ts +0 -84
  35. package/dist/src/channels/telegram-mirror/soak-log.d.ts +0 -99
  36. package/dist/src/channels/telegram-mirror/state-machine.d.ts +0 -113
  37. package/dist/src/channels/telegram-mirror/status-line.d.ts +0 -51
  38. package/dist/src/channels/telegram-mirror/sync-commands.d.ts +0 -100
  39. package/dist/src/channels/telegram-mirror/threshold-watcher.d.ts +0 -54
  40. package/dist/src/channels/telegram-mirror/turn-bridge.d.ts +0 -125
  41. package/dist/src/cli/checks/bridge-wiring.d.ts +0 -14
  42. package/dist/src/cli/checks/config-schema.d.ts +0 -11
  43. package/dist/src/cli/checks/critical-openclaw-json-keys.d.ts +0 -21
  44. package/dist/src/cli/checks/install-path.d.ts +0 -11
  45. package/dist/src/cli/checks/patch-scaffold.d.ts +0 -17
  46. package/dist/src/cli/doctor.d.ts +0 -20
  47. package/dist/src/cli/index.d.ts +0 -8
  48. package/dist/src/cli/migrate.d.ts +0 -29
  49. package/dist/src/command-router/cc-handler.d.ts +0 -67
  50. package/dist/src/command-router/index.d.ts +0 -2
  51. package/dist/src/command-router/launch-policy.d.ts +0 -92
  52. package/dist/src/command-router/resume-policy.d.ts +0 -18
  53. package/dist/src/command-router/turn-formatter.d.ts +0 -19
  54. package/dist/src/config/loader.d.ts +0 -8
  55. package/dist/src/config/schema.d.ts +0 -192
  56. package/dist/src/constants.d.ts +0 -191
  57. package/dist/src/council/build-agent-prompt.d.ts +0 -11
  58. package/dist/src/council/cleanup-worktrees.d.ts +0 -10
  59. package/dist/src/council/consensus.d.ts +0 -20
  60. package/dist/src/council/council.d.ts +0 -67
  61. package/dist/src/council/index.d.ts +0 -2
  62. package/dist/src/council/system-prompt.d.ts +0 -16
  63. package/dist/src/council/write-worktree-claude-md.d.ts +0 -10
  64. package/dist/src/engines/base-oneshot-session.d.ts +0 -87
  65. package/dist/src/engines/heartbeat-guard.d.ts +0 -93
  66. package/dist/src/engines/index.d.ts +0 -8
  67. package/dist/src/engines/persistent-codex-session.d.ts +0 -16
  68. package/dist/src/engines/persistent-cursor-session.d.ts +0 -21
  69. package/dist/src/engines/persistent-custom-session.d.ts +0 -78
  70. package/dist/src/engines/persistent-gemini-session.d.ts +0 -21
  71. package/dist/src/engines/persistent-session.d.ts +0 -95
  72. package/dist/src/engines/resolve-bin.d.ts +0 -14
  73. package/dist/src/engines/subprocess-pool.d.ts +0 -78
  74. package/dist/src/health/handler.d.ts +0 -39
  75. package/dist/src/health/index.d.ts +0 -1
  76. package/dist/src/health/metrics.d.ts +0 -52
  77. package/dist/src/index.d.ts +0 -57
  78. package/dist/src/lib/auto-recovery.d.ts +0 -43
  79. package/dist/src/lib/cache-parity.d.ts +0 -38
  80. package/dist/src/lib/cc-cli-scan.d.ts +0 -52
  81. package/dist/src/lib/circuit-breaker.d.ts +0 -21
  82. package/dist/src/lib/config-service.d.ts +0 -106
  83. package/dist/src/lib/config.d.ts +0 -136
  84. package/dist/src/lib/cost-rollup.d.ts +0 -36
  85. package/dist/src/lib/debounce.d.ts +0 -12
  86. package/dist/src/lib/debug-tap.d.ts +0 -13
  87. package/dist/src/lib/domain-error.d.ts +0 -59
  88. package/dist/src/lib/drift-detector.d.ts +0 -46
  89. package/dist/src/lib/env-overrides.d.ts +0 -47
  90. package/dist/src/lib/error-formatter.d.ts +0 -91
  91. package/dist/src/lib/error-renderer.d.ts +0 -20
  92. package/dist/src/lib/heartbeat-config.d.ts +0 -34
  93. package/dist/src/lib/heartbeat-workaround.d.ts +0 -44
  94. package/dist/src/lib/html-render.d.ts +0 -50
  95. package/dist/src/lib/http-agent.d.ts +0 -47
  96. package/dist/src/lib/json-array.d.ts +0 -10
  97. package/dist/src/lib/markdown-to-mdv2.d.ts +0 -53
  98. package/dist/src/lib/markdown-v2.d.ts +0 -27
  99. package/dist/src/lib/perf/async-compact.d.ts +0 -26
  100. package/dist/src/lib/perf/direct-sdk.d.ts +0 -26
  101. package/dist/src/lib/perf/haiku-route.d.ts +0 -19
  102. package/dist/src/lib/perf/predictive-continuation.d.ts +0 -18
  103. package/dist/src/lib/perf/read-batch.d.ts +0 -33
  104. package/dist/src/lib/perf/skill-list-collapse.d.ts +0 -22
  105. package/dist/src/lib/perf/speculative-bubble.d.ts +0 -27
  106. package/dist/src/lib/perf/typing-prefetch.d.ts +0 -25
  107. package/dist/src/lib/probes.d.ts +0 -50
  108. package/dist/src/lib/register-guard.d.ts +0 -56
  109. package/dist/src/lib/req-shape-log.d.ts +0 -31
  110. package/dist/src/lib/safe-upstream-probes.d.ts +0 -25
  111. package/dist/src/lib/session-registry.d.ts +0 -66
  112. package/dist/src/lib/spawn-async.d.ts +0 -18
  113. package/dist/src/lib/status-tee-reader.d.ts +0 -29
  114. package/dist/src/lib/sysprompt-strip.d.ts +0 -53
  115. package/dist/src/lib/telegram-bot-api.d.ts +0 -146
  116. package/dist/src/lib/telemetry.d.ts +0 -38
  117. package/dist/src/lib/test-mode.d.ts +0 -26
  118. package/dist/src/lib/trajectory.d.ts +0 -44
  119. package/dist/src/lib/vendor-paths.d.ts +0 -12
  120. package/dist/src/lifecycle/boot.d.ts +0 -48
  121. package/dist/src/lifecycle/patch-manifest.d.ts +0 -82
  122. package/dist/src/lifecycle/phase-import-upstream.d.ts +0 -12
  123. package/dist/src/lifecycle/phase-install-patches.d.ts +0 -12
  124. package/dist/src/lifecycle/phase-schedule-jobs.d.ts +0 -12
  125. package/dist/src/lifecycle/phase-start-server.d.ts +0 -11
  126. package/dist/src/lifecycle/phase-validate-config.d.ts +0 -9
  127. package/dist/src/lifecycle/phase-validate-upstream.d.ts +0 -11
  128. package/dist/src/lifecycle/phase-wire-handlers.d.ts +0 -12
  129. package/dist/src/lifecycle/safe-restart.d.ts +0 -99
  130. package/dist/src/logger.d.ts +0 -14
  131. package/dist/src/mcp/bridge.d.ts +0 -21
  132. package/dist/src/mcp/index.d.ts +0 -2
  133. package/dist/src/models.d.ts +0 -68
  134. package/dist/src/observability/event-bus.d.ts +0 -86
  135. package/dist/src/observability/get-event-bus.d.ts +0 -25
  136. package/dist/src/observability/observability-service.d.ts +0 -19
  137. package/dist/src/observability/perf-telemetry.d.ts +0 -65
  138. package/dist/src/observability/subscribers/metrics.d.ts +0 -11
  139. package/dist/src/observability/subscribers/session-capture.d.ts +0 -15
  140. package/dist/src/openai-compat/autonomy-rule.d.ts +0 -26
  141. package/dist/src/openai-compat/bridges/allowlist.d.ts +0 -19
  142. package/dist/src/openai-compat/bridges/factory.d.ts +0 -30
  143. package/dist/src/openai-compat/bridges/media-bridge.d.ts +0 -34
  144. package/dist/src/openai-compat/bridges/openclaw-api-shim.d.ts +0 -54
  145. package/dist/src/openai-compat/bridges/openclaw-native-tools.d.ts +0 -61
  146. package/dist/src/openai-compat/bridges/openclaw-tool-registry.d.ts +0 -26
  147. package/dist/src/openai-compat/bridges/tts-media-bridge.d.ts +0 -19
  148. package/dist/src/openai-compat/chat-cwd.d.ts +0 -22
  149. package/dist/src/openai-compat/cli-stream-parser.d.ts +0 -134
  150. package/dist/src/openai-compat/index.d.ts +0 -1
  151. package/dist/src/openai-compat/message-extractor.d.ts +0 -84
  152. package/dist/src/openai-compat/mode-flags.d.ts +0 -34
  153. package/dist/src/openai-compat/non-streaming-handler.d.ts +0 -29
  154. package/dist/src/openai-compat/openai-chunk-types.d.ts +0 -35
  155. package/dist/src/openai-compat/openai-compat.d.ts +0 -49
  156. package/dist/src/openai-compat/openai-types.d.ts +0 -71
  157. package/dist/src/openai-compat/parse-route-body.d.ts +0 -24
  158. package/dist/src/openai-compat/prompts.d.ts +0 -47
  159. package/dist/src/openai-compat/request-coalescer.d.ts +0 -77
  160. package/dist/src/openai-compat/response-formatter.d.ts +0 -33
  161. package/dist/src/openai-compat/session-key-resolver.d.ts +0 -41
  162. package/dist/src/openai-compat/skill-resolver.d.ts +0 -59
  163. package/dist/src/openai-compat/sse-translator.d.ts +0 -51
  164. package/dist/src/openai-compat/status-reporter.d.ts +0 -30
  165. package/dist/src/openai-compat/streaming-handler.d.ts +0 -52
  166. package/dist/src/openai-compat/tool-calls-parser.d.ts +0 -34
  167. package/dist/src/openai-compat/tool-results-serializer.d.ts +0 -60
  168. package/dist/src/openai-compat/tts-rule.d.ts +0 -20
  169. package/dist/src/openai-compat/voice-recovery.d.ts +0 -56
  170. package/dist/src/patches/cache-parity-registry.d.ts +0 -103
  171. package/dist/src/patches/claude-md-injection.d.ts +0 -10
  172. package/dist/src/patches/cwd-redirect.d.ts +0 -10
  173. package/dist/src/patches/embedded-server-route.d.ts +0 -23
  174. package/dist/src/patches/pricing-overrides.d.ts +0 -10
  175. package/dist/src/patches/resume-registry-restore.d.ts +0 -11
  176. package/dist/src/patches/session-pid-tracking.d.ts +0 -10
  177. package/dist/src/patches/sysprompt-strip.d.ts +0 -46
  178. package/dist/src/patches/tools-restoration.d.ts +0 -12
  179. package/dist/src/persistence/migration-v0.d.ts +0 -24
  180. package/dist/src/persistence/session-registry.d.ts +0 -58
  181. package/dist/src/proxy/anthropic-adapter.d.ts +0 -136
  182. package/dist/src/proxy/handler.d.ts +0 -39
  183. package/dist/src/proxy/index.d.ts +0 -4
  184. package/dist/src/proxy/schema-cleaner.d.ts +0 -11
  185. package/dist/src/proxy/thought-cache.d.ts +0 -19
  186. package/dist/src/session/embedded-server.d.ts +0 -25
  187. package/dist/src/session/inbox-manager.d.ts +0 -38
  188. package/dist/src/session/index.d.ts +0 -3
  189. package/dist/src/session/persisted-sessions.d.ts +0 -50
  190. package/dist/src/session/session-manager.d.ts +0 -247
  191. package/dist/src/session/watchdogs.d.ts +0 -92
  192. package/dist/src/session-bootstrap/boot-self-heal.d.ts +0 -32
  193. package/dist/src/session-bootstrap/cwd-patch.d.ts +0 -50
  194. package/dist/src/session-bootstrap/index.d.ts +0 -3
  195. package/dist/src/session-bootstrap/resume-registry.d.ts +0 -27
  196. package/dist/src/session-bootstrap/session-hygiene.d.ts +0 -23
  197. package/dist/src/session-bootstrap/sysprompt-strip.d.ts +0 -24
  198. package/dist/src/session-bootstrap/think-conflict-resolver.d.ts +0 -32
  199. package/dist/src/types/route.d.ts +0 -11
  200. package/dist/src/types/runtime-config.d.ts +0 -208
  201. package/dist/src/types/sse.d.ts +0 -29
  202. package/dist/src/types/tool-bridge.d.ts +0 -82
  203. package/dist/src/types/upstream.d.ts +0 -580
  204. package/dist/src/types.d.ts +0 -498
  205. package/dist/src/validation.d.ts +0 -31
@@ -1,91 +0,0 @@
1
- /**
2
- * error-formatter — pure ({error, context}) => {jsonlRow, telegramText}
3
- *
4
- * Structured error taxonomy for cc-openclaw. Every catchable error site
5
- * should pass through here so errors are never "Error: undefined" in
6
- * Telegram or jsonl outputs.
7
- *
8
- * Error code taxonomy:
9
- * CC_OPENCLAW_TOOL_FAILURE — tool invocation failed
10
- * CC_OPENCLAW_BUDGET_EXCEEDED — quota/budget limit hit
11
- * CC_OPENCLAW_GATEWAY_CRASH — PM2 process exited unexpectedly
12
- * CC_OPENCLAW_DRIFT_DETECTED — cross-laptop version mismatch
13
- * CC_OPENCLAW_HEALTH_PROBE_FAILED — /health endpoint unreachable
14
- * CC_OPENCLAW_RECOVERY_FAILED — auto-recovery did not succeed
15
- * CC_OPENCLAW_RECOVERY_OK — auto-recovery succeeded (info)
16
- * CC_OPENCLAW_SESSION_ERROR — session-level error
17
- * CC_OPENCLAW_PARSE_ERROR — stream parsing error
18
- * CC_OPENCLAW_CONFIG_ERROR — configuration/env error
19
- * CC_OPENCLAW_NETWORK_ERROR — upstream HTTP/network failure
20
- * CC_OPENCLAW_TIMEOUT — operation exceeded time limit
21
- * CC_OPENCLAW_AUTH_ERROR — authentication/API key failure
22
- * CC_OPENCLAW_UNKNOWN — unclassified error
23
- */
24
- export declare const ERROR_CODES: {
25
- readonly TOOL_FAILURE: "CC_OPENCLAW_TOOL_FAILURE";
26
- readonly BUDGET_EXCEEDED: "CC_OPENCLAW_BUDGET_EXCEEDED";
27
- readonly GATEWAY_CRASH: "CC_OPENCLAW_GATEWAY_CRASH";
28
- readonly DRIFT_DETECTED: "CC_OPENCLAW_DRIFT_DETECTED";
29
- readonly HEALTH_PROBE_FAILED: "CC_OPENCLAW_HEALTH_PROBE_FAILED";
30
- readonly RECOVERY_FAILED: "CC_OPENCLAW_RECOVERY_FAILED";
31
- readonly RECOVERY_OK: "CC_OPENCLAW_RECOVERY_OK";
32
- readonly SESSION_ERROR: "CC_OPENCLAW_SESSION_ERROR";
33
- readonly PARSE_ERROR: "CC_OPENCLAW_PARSE_ERROR";
34
- readonly CONFIG_ERROR: "CC_OPENCLAW_CONFIG_ERROR";
35
- readonly NETWORK_ERROR: "CC_OPENCLAW_NETWORK_ERROR";
36
- readonly TIMEOUT: "CC_OPENCLAW_TIMEOUT";
37
- readonly AUTH_ERROR: "CC_OPENCLAW_AUTH_ERROR";
38
- readonly UNKNOWN: "CC_OPENCLAW_UNKNOWN";
39
- };
40
- export type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
41
- export type Severity = 'critical' | 'error' | 'warning' | 'info';
42
- export interface ErrorContext {
43
- code: ErrorCode;
44
- sessionId?: string;
45
- laptopId?: string;
46
- /** Additional structured key-value details */
47
- details?: Record<string, unknown>;
48
- }
49
- export interface FormattedError {
50
- /** NDJSON-ready row */
51
- jsonlRow: ErrorJsonlRow;
52
- /**
53
- * Telegram message text (HTML parse_mode). v0.27.3 — converted from
54
- * MarkdownV2 to HTML so the entire Telegram surface (live card + error
55
- * alerts) renders through ONE parse mode. error-renderer sends this with
56
- * parse_mode: 'HTML'.
57
- */
58
- telegramText: string;
59
- }
60
- interface ErrorJsonlRow {
61
- ts: string;
62
- code: ErrorCode;
63
- severity: Severity;
64
- message: string;
65
- sessionId?: string;
66
- laptopId?: string;
67
- stack?: string;
68
- details?: Record<string, unknown>;
69
- }
70
- /** Extract a usable message from unknown thrown values. */
71
- export declare function extractMessage(error: unknown): string;
72
- /**
73
- * Escape characters special to Telegram MarkdownV2.
74
- *
75
- * v0.27.3 — RETAINED for back-compat (and its own unit tests) but no longer
76
- * used by formatError, which now emits HTML (see the telegramText block) so the
77
- * whole Telegram surface renders through one parse mode. Kept exported in case a
78
- * caller still needs MarkdownV2 escaping.
79
- */
80
- export declare function escapeMdV2(text: string): string;
81
- /**
82
- * Pure formatter — no side effects on the return value, but DOES emit
83
- * trajectory + metrics events for centralized observability per Pillars A+B.
84
- *
85
- * @param error The thrown value (Error instance, string, or unknown)
86
- * @param context Structured context including mandatory error code
87
- */
88
- export declare function formatError(error: unknown, context: ErrorContext): FormattedError;
89
- /** Shorthand for the common "unknown catch block" pattern. */
90
- export declare function formatUnknownError(error: unknown, sessionId?: string): FormattedError;
91
- export {};
@@ -1,20 +0,0 @@
1
- /**
2
- * src/lib/error-renderer.ts — v0.25.0 M16 migration target.
3
- *
4
- * Migrated from src/channels/telegram/error-renderer.ts. Identical
5
- * behaviour; only the Telegram-API import path changes (legacy live-card
6
- * → new src/lib/telegram-bot-api).
7
- *
8
- * Sends a FormattedError to a configured Telegram chat with per-code 1h
9
- * dedup. Bot token comes from telegram-bot-api initialisation (driven
10
- * by the mirror channel's register() at boot). The drift JSONL writer
11
- * for warning+ severity is unchanged.
12
- */
13
- import type { FormattedError } from './error-formatter.js';
14
- export interface RenderOptions {
15
- chatId?: string;
16
- threadId?: string;
17
- forceSend?: boolean;
18
- writeJsonl?: boolean;
19
- }
20
- export declare function renderError(formatted: FormattedError, opts?: RenderOptions): Promise<boolean>;
@@ -1,34 +0,0 @@
1
- /**
2
- * Heartbeat constants + env-gate — single source of truth shared by both the
3
- * SDK-layer workaround (`src/lib/heartbeat-workaround.ts`) and the engines-
4
- * layer guard (`src/engines/heartbeat-guard.ts`).
5
- *
6
- * v0.21.0 E2 — Reality differed from the plan: the two implementations are NOT
7
- * duplicates. They are layered defenses with different concerns:
8
- * - WORKAROUND = proactive (force the right model at SDK call time)
9
- * - GUARD = reactive (verify upstream honoured the override, refuse if not)
10
- *
11
- * Both layers were tracking the same constants and the same upstream bug, but
12
- * via DIFFERENT env-var names (`CC_OPENCLAW_DISABLE_HEARTBEAT_WORKAROUND` and
13
- * `OPENCLAW_HEARTBEAT_GUARD_DISABLE`) and DIFFERENT copies of `HEARTBEAT_FALL-
14
- * BACK_MODEL` / issue references. This module consolidates them so a single
15
- * change (e.g. when upstream ships a fix) updates BOTH layers atomically.
16
- *
17
- * Upstream issue refs: #9556, #13009, #14279.
18
- */
19
- /** Single canonical fallback model used by BOTH the workaround and the guard. */
20
- export declare const HEARTBEAT_FALLBACK_MODEL = "claude-haiku-4-5";
21
- /** Sentinel strings observed in upstream OpenClaw heartbeat payloads. */
22
- export declare const HEARTBEAT_SENTINELS: readonly ["__heartbeat__", "heartbeat:ping", "__keepalive__"];
23
- /** Upstream OpenClaw issue numbers that motivate both layers. */
24
- export declare const HEARTBEAT_ISSUE_REFS: readonly ["#9556", "#13009", "#14279"];
25
- /**
26
- * Unified env-var gate. Set `CC_OPENCLAW_HEARTBEAT_BYPASS=1` to disable BOTH
27
- * the SDK-layer workaround AND the engines-layer guard at once. This is what
28
- * you set when upstream OpenClaw ships a fix for #9556/#13009/#14279.
29
- *
30
- * Backward-compat: the legacy per-layer flags
31
- * (`CC_OPENCLAW_DISABLE_HEARTBEAT_WORKAROUND`, `OPENCLAW_HEARTBEAT_GUARD_DISABLE`)
32
- * still work but are deprecated. Prefer the unified flag.
33
- */
34
- export declare function isHeartbeatBypassed(): boolean;
@@ -1,44 +0,0 @@
1
- /**
2
- * Heartbeat model workaround — SDK-call-layer override.
3
- *
4
- * Tracks OpenClaw issues #9556, #13009, #14279: heartbeat-triggered runs
5
- * ignore the heartbeat.model field and use the session's primary model
6
- * (typically Opus). This wastes tokens and adds latency on what should be
7
- * a cheap Haiku ping.
8
- *
9
- * applyHeartbeatWorkaround() inspects an SDK request payload, detects
10
- * heartbeat-shaped requests via heuristics (low input tokens + heartbeat
11
- * sentinel in messages), and forces the model field to the heartbeat.model
12
- * value (or HEARTBEAT_FALLBACK_MODEL when missing).
13
- *
14
- * Disable via CC_OPENCLAW_DISABLE_HEARTBEAT_WORKAROUND=1 — set this when
15
- * upstream OpenClaw ships a native fix.
16
- */
17
- export declare const HEARTBEAT_FALLBACK_MODEL = "claude-haiku-4-5";
18
- /** Sentinel strings observed in upstream OpenClaw heartbeat payloads. */
19
- export declare const HEARTBEAT_SENTINELS: readonly ["__heartbeat__", "heartbeat:ping", "__keepalive__"];
20
- export interface SdkRequestPayload {
21
- model: string;
22
- messages?: Array<{
23
- role: string;
24
- content: string | unknown;
25
- }>;
26
- metadata?: Record<string, unknown>;
27
- /** Some payloads carry the intended heartbeat model in metadata or top-level */
28
- heartbeat?: {
29
- model?: string;
30
- };
31
- }
32
- /**
33
- * Heuristic: a request is heartbeat-shaped if:
34
- * - metadata.heartbeat or top-level heartbeat field is set, OR
35
- * - any message content contains a heartbeat sentinel, OR
36
- * - metadata flag `is_heartbeat: true`
37
- */
38
- export declare function isHeartbeatRequest(req: SdkRequestPayload): boolean;
39
- /**
40
- * Apply the workaround: if the request is heartbeat-shaped and the workaround
41
- * is not disabled, override the model to the heartbeat target. Returns a NEW
42
- * payload object (does not mutate input).
43
- */
44
- export declare function applyHeartbeatWorkaround(req: SdkRequestPayload): SdkRequestPayload;
@@ -1,50 +0,0 @@
1
- /**
2
- * html-render — Telegram HTML parse_mode rendering (v0.27.0 M1).
3
- *
4
- * The CLI-fidelity rendering engine. Chosen over MarkdownV2 because Telegram's
5
- * HTML mode only requires escaping `& < >` (no "every . - ! must be backslashed"
6
- * fragility), and it supports `<pre><code class="language-bash">…</code></pre>` —
7
- * labeled, monospaced code blocks that mirror the terminal — plus `<blockquote>`
8
- * and `<tg-spoiler>`.
9
- *
10
- * Companion to markdown-v2.ts / markdown-to-mdv2.ts (the prior engine). This
11
- * module is the HTML path the card-renderer + telegram-bot-api now use.
12
- *
13
- * Telegram-supported tags (Bot API): b/strong, i/em, u, s, a, code, pre,
14
- * pre+code[class=language-X], blockquote, tg-spoiler. Everything else in text
15
- * content must have &, <, > escaped.
16
- */
17
- /** Escape the three HTML-significant chars for Telegram HTML text content. */
18
- export declare function escapeHtml(text: string | null | undefined): string;
19
- /** Inline monospace span: `<code>escaped</code>`. */
20
- export declare function code(s: string): string;
21
- /**
22
- * Strip Telegram HTML markup back to readable plain text (v0.27.3). Used
23
- * by editTg's plain-text fallback: when an HTML edit is rejected, re-sending the
24
- * SAME string without parse_mode would dump literal `<b>`/`<pre>` tags into the
25
- * chat. This removes the tags and decodes the basic entities so the fallback
26
- * stays legible. Not a general sanitizer — scoped to the tags this module emits.
27
- */
28
- export declare function stripHtml(input: string | null | undefined): string;
29
- /**
30
- * v0.27.5 M4 — close any unclosed Telegram-HTML tags this module emits, in LIFO
31
- * order. A hard truncation of a rendered card (renderTurn's 4096-char backstop)
32
- * can slice through an open `<pre>`/`<b>`/… ; left dangling, Telegram rejects the
33
- * edit and editTg falls back to plain text — dumping literal `<pre>`/`**`/`- `
34
- * markup into the chat. Closing the danglers keeps the truncated HTML well-formed
35
- * so the edit is accepted.
36
- *
37
- * Conservative by design: only the tags this module emits (pre, code, blockquote,
38
- * b, i, s, a) are tracked, balanced input passes through byte-identical, and
39
- * stray/mismatched closers are tolerated (pop nearest match, never go negative).
40
- * Attribute values here never contain a literal `>` (escapeHtml runs on class /
41
- * href), so `[^>]*` safely consumes the whole opening tag.
42
- */
43
- export declare function closeDanglingTags(html: string): string;
44
- /**
45
- * Fenced code block: `<pre><code class="language-LANG">escaped</code></pre>`.
46
- * Omits the class when no language is given. Body is HTML-escaped (the only
47
- * escaping Telegram requires inside pre/code).
48
- */
49
- export declare function pre(body: string, lang?: string): string;
50
- export declare function markdownToHtml(input: string | null | undefined): string;
@@ -1,47 +0,0 @@
1
- /**
2
- * M5 (perf overhaul idea #5) — undici keepAlive agent pool.
3
- *
4
- * Sets undici's global dispatcher to a keepAlive Agent so every Node 18+
5
- * `fetch()` call in cc-openclaw reuses TCP+TLS sockets per upstream origin.
6
- * For the Riyadh→US-East corridor (150-200ms RTT), eliminating one TLS 1.3
7
- * handshake saves roughly 1 TCP + 2 TLS round trips = 450-600ms tail latency
8
- * per reuse. Undici's `Agent` already pools per-origin internally; we just
9
- * tune `connections` (concurrent sockets) and `keepAliveTimeout` (idle hold).
10
- *
11
- * Flag: CC_OPENCLAW_PERF_KEEPALIVE (default OFF until M8 baseline confirms
12
- * the win — per plan, "default ON for safe ideas... once measured-good").
13
- *
14
- * Install is idempotent — second invocation in the same process is a no-op
15
- * so importing from multiple bootstrap entry points is safe. The previous
16
- * dispatcher is closed gracefully to avoid socket leaks during reinstall.
17
- *
18
- * Test hook: pass a custom factory to `installPerfKeepaliveAgent({ factory })`
19
- * so the test suite can verify install+settings without binding real sockets.
20
- */
21
- export interface KeepaliveOptions {
22
- /** Max idle time a kept-alive socket stays open. Default 60s. */
23
- keepAliveTimeout?: number;
24
- /** Hard ceiling on idle socket age. Default 120s. */
25
- keepAliveMaxTimeout?: number;
26
- /** Concurrent sockets per origin. Default 8 — enough for cc-openclaw's
27
- * fan-out to Anthropic + OpenAI fallback without saturating either. */
28
- connections?: number;
29
- }
30
- interface InstallSnapshot {
31
- installed: boolean;
32
- options: Required<KeepaliveOptions>;
33
- installedAt: string;
34
- }
35
- /**
36
- * Install the keepAlive agent as undici's global dispatcher. Idempotent —
37
- * subsequent calls in the same process return the existing snapshot without
38
- * reinstalling. Returns null when the flag is off (no-op, no snapshot).
39
- *
40
- * `factory` exists for tests; production code never passes it.
41
- */
42
- export declare function installPerfKeepaliveAgent(opts?: KeepaliveOptions, factory?: (resolved: Required<KeepaliveOptions>) => unknown): InstallSnapshot | null;
43
- /** Inspect current install state — used by /health + diagnostics. */
44
- export declare function getPerfKeepaliveSnapshot(): InstallSnapshot | null;
45
- /** Test hook — clear the install snapshot so the next call reinstalls. */
46
- export declare function _resetPerfKeepaliveForTests(): void;
47
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * Safe JSON-array file reader — used by cwd-patch's resume-registry helpers.
3
- *
4
- * Extracted from `session-bootstrap/cwd-patch.ts` 2026-05-13 as a pure-function
5
- * hot-path decomposition. Bounded I/O (read-only); idempotent for the same
6
- * file contents; never throws.
7
- *
8
- * Returns `null` for missing/malformed/non-array files.
9
- */
10
- export declare function readJSONArraySafe(filePath: string): unknown[] | null;
@@ -1,53 +0,0 @@
1
- /**
2
- * markdown-to-mdv2 — v0.20.2 Slice 6 "rich render" converter.
3
- *
4
- * Converts a subset of CommonMark Markdown to Telegram MarkdownV2 with
5
- * STRUCTURE PRESERVED — `**bold**` becomes `*bold*` (Telegram bold), not
6
- * `\*\*bold\*\*` (literal asterisks). Companion to markdown-v2.ts whose
7
- * escapeMarkdownV2 escapes EVERYTHING including syntax markers.
8
- *
9
- * Why both: markdown-v2.ts is the safe fallback for content where loss of
10
- * formatting is acceptable but loss of punctuation isn't (v0.20.1 fix).
11
- * This module is the rich path — gated by CC_OPENCLAW_RICH_RENDER=1, off
12
- * by default in v0.20.2 so the chat-bubble path can opt in without
13
- * regressing the v0.20.1 guarantee for un-opted callers.
14
- *
15
- * Supported source syntax → Telegram MarkdownV2 output:
16
- * `**bold**` → `*bold*`
17
- * `*italic*` → `_italic_` (single-asterisk italic)
18
- * `_italic_` → `_italic_`
19
- * `` `inline code` `` → `` `inline code` `` (content backslash-escaped)
20
- * ` ```lang\n…\n``` ` → ` ```lang\n…\n``` ` (preserved verbatim)
21
- * `# Header` / `## H2` / `### H3` … `###### H6` → `*Header*`
22
- * `[label](url)` → `[label](url)` (label escaped, url paren-escaped)
23
- * All other content → backslash-escaped per MarkdownV2 spec
24
- *
25
- * Out of scope (intentional v0 limits — keeps the converter <150 LOC and
26
- * easy to reason about; expand in v0.20.3+ if A1 hits the gap):
27
- * - Nested formatting (`**bold _italic_**`) — inner is escaped as plain text
28
- * - Block quotes (`> quote`) — emitted as escaped text
29
- * - Lists (`- item`, `1. item`) — markers escaped, content escaped (no list semantics in Telegram MarkdownV2 anyway)
30
- * - Tables — markdown tables don't render in Telegram regardless
31
- * - HTML tags — content-escaped
32
- *
33
- * Algorithm (placeholder substitution, NUL-sentinel keyed):
34
- * 1. Extract code fences → placeholders (highest priority — content inside is verbatim)
35
- * 2. Extract inline code → placeholders (same priority — content escape rules differ)
36
- * 3. Extract bold (`**…**`) → placeholders with body text-escaped
37
- * 4. Extract italic (`*…*` and `_…_`) → placeholders
38
- * 5. Extract headers (`#…`) at line start → placeholders
39
- * 6. Extract links (`[label](url)`) → placeholders
40
- * 7. Escape remaining body as plain text (every MarkdownV2 special char)
41
- * 8. Restore placeholders verbatim
42
- *
43
- * NUL (0x00) sentinels chosen because:
44
- * - NUL is not in the MarkdownV2 special-char set (won't be escaped in step 7)
45
- * - Digits in the index suffix are also not in the special-char set
46
- * - "CODE"/"BOLD"/etc letters are not in the special-char set
47
- * So placeholders survive the bulk-escape step intact.
48
- */
49
- /**
50
- * Convert standard CommonMark Markdown to Telegram MarkdownV2 with structural
51
- * syntax preserved. Returns '' for null/undefined.
52
- */
53
- export declare function markdownToMdv2(input: string | null | undefined): string;
@@ -1,27 +0,0 @@
1
- /**
2
- * markdown-v2 — Telegram MarkdownV2 escape utility.
3
- *
4
- * Ported from workspace/lib/telegram-ux/telegram-renderer.js (line 97 + the
5
- * MARKDOWNV2_SPECIAL_CHARS regex at line 56) so cc-openclaw's chat-bubble
6
- * path can pre-escape raw assistant text before sending to Telegram.
7
- *
8
- * Why this lives in cc-openclaw's lib (vs reusing the workspace function):
9
- * the workspace path is CommonJS and only available when the telegram-ux
10
- * module is loaded at runtime. Pre-escape must happen on the queue path,
11
- * before the workspace module is necessarily loaded, so we inline it.
12
- *
13
- * History — the prior fallback in card-renderer.ts stripped these same
14
- * chars from CONTENT when MarkdownV2 parse failed, producing the
15
- * "period-touches-cap" symptom (every `.` removed from the assistant
16
- * text). The escape function below makes the first MarkdownV2 send
17
- * succeed for raw text so the fallback is rarely reached at all.
18
- */
19
- /**
20
- * Escape every Telegram MarkdownV2 special char in `text` so the message
21
- * is rendered as plain content. Markdown syntax (bold/italic/code) is
22
- * also escaped — formatting will NOT render, but ALL content punctuation
23
- * is preserved (periods, hyphens, parens, etc.).
24
- *
25
- * Returns '' for null/undefined.
26
- */
27
- export declare function escapeMarkdownV2(text: string | null | undefined): string;
@@ -1,26 +0,0 @@
1
- /**
2
- * M6 (perf overhaul idea #6) — async-lossless-compaction scheduler.
3
- *
4
- * Lossless-claw's DAG summarization currently runs on the hot path (turn N
5
- * blocks while compaction completes). This scheduler defers the work to a
6
- * setImmediate callback so turn N returns immediately; the summary lands
7
- * before turn N+1 reads it (or N+1 skips the stale summary if compaction
8
- * hasn't finished — that branch is the cost of the speedup).
9
- *
10
- * Flag: CC_OPENCLAW_PERF_ASYNC_COMPACT (default OFF, medium risk —
11
- * compaction freshness can drift if N+1 fires before N's compaction lands).
12
- *
13
- * Per-session serialization: only one async compaction in flight per
14
- * sessionKey at a time. Subsequent calls during in-flight work are dropped
15
- * (the in-flight one will pick up the latest state at execution time).
16
- */
17
- export interface AsyncCompactResult {
18
- scheduled: boolean;
19
- reason: 'flag_off' | 'in_flight' | 'scheduled';
20
- }
21
- /**
22
- * Schedule `compactFn` to run after the current turn returns. Returns
23
- * synchronously; the caller never awaits compaction completion.
24
- */
25
- export declare function scheduleAsyncCompaction(sessionKey: string, compactFn: () => Promise<void> | void): AsyncCompactResult;
26
- export declare function _resetAsyncCompactForTests(): void;
@@ -1,26 +0,0 @@
1
- /**
2
- * M12 (perf overhaul idea #12) — direct claude-code SDK in-process.
3
- *
4
- * Bypasses the `claude` CLI subprocess entirely by calling the
5
- * `@anthropic-ai/claude-code` SDK in the cc-openclaw Node process.
6
- * Eliminates all subprocess overhead (Node bootstrap, bundle parse, auth
7
- * handshake) at the cost of losing CLI session/checkpoint features and
8
- * recoupling to upstream SDK API churn.
9
- *
10
- * Flag: CC_OPENCLAW_PERF_DIRECT_SDK (default OFF, HIGH RISK — ships LAST
11
- * with the resident-CLI pool as the fallback).
12
- *
13
- * Probes the SDK availability without bringing it as a hard dependency:
14
- * dynamic require with a swallowed ENOENT. The actual invocation is
15
- * delegated to the registered handler — session-manager owns the call
16
- * details (model, prompt, options) and decides whether the SDK supports
17
- * the requested feature set for this turn.
18
- */
19
- export interface DirectSdkAvailability {
20
- enabled: boolean;
21
- available: boolean;
22
- reason: 'flag_off' | 'sdk_missing' | 'sdk_loaded' | 'probe_error';
23
- version: string | null;
24
- }
25
- export declare function probeDirectSdkAvailability(): DirectSdkAvailability;
26
- export declare function _resetDirectSdkProbeForTests(): void;
@@ -1,19 +0,0 @@
1
- /**
2
- * M10 (perf overhaul idea #10) — Haiku 4.5 cheap-route classifier.
3
- *
4
- * Pattern-matches trivial queries that don't need Opus-level reasoning:
5
- * status checks, simple acks, short factual lookups. When matched, the
6
- * caller routes the request to Haiku via the OpenAI-compat fallback
7
- * pipeline (NOT direct Anthropic API — A1 has no anthropic.com key, only
8
- * Max 20x subscription). Sub-500ms; zero Max quota burn.
9
- *
10
- * Flag: CC_OPENCLAW_PERF_HAIKU_ROUTE (default OFF).
11
- *
12
- * Conservative by design: any uncertainty falls back to Opus. False positives
13
- * are user-visible quality regressions; false negatives just miss a perf win.
14
- */
15
- export interface RouteDecision {
16
- routeToHaiku: boolean;
17
- reason: 'trivial_pattern' | 'too_long' | 'complex_token' | 'flag_off' | 'no_match';
18
- }
19
- export declare function classifyForHaikuRoute(prompt: string): RouteDecision;
@@ -1,18 +0,0 @@
1
- /**
2
- * M11 (perf overhaul idea #11) — predictive continuation detector.
3
- *
4
- * Returns a confident yes/no when a user's incoming message is a pure
5
- * continuation request ("more", "continue", "and?", "go on"). When true,
6
- * the caller can start generation against the previous turn's tail before
7
- * the user finishes typing, giving the perceived-instant feel on common
8
- * follow-ups. False on ambiguous input keeps the regular dispatch path.
9
- *
10
- * Flag: CC_OPENCLAW_PERF_PREDICTIVE_CONTINUE (default OFF).
11
- */
12
- export interface ContinuationDecision {
13
- /** True iff the text is a confident continuation request. */
14
- isContinuation: boolean;
15
- /** Matched pattern source for telemetry; empty when isContinuation=false. */
16
- matched: string;
17
- }
18
- export declare function isPredictiveContinuation(text: string): ContinuationDecision;
@@ -1,33 +0,0 @@
1
- /**
2
- * M7 (perf overhaul idea #7) — Read([paths]) parallel batch reader.
3
- *
4
- * The legacy flow is N serial Read tool calls = N LLM round trips. This
5
- * helper reads an array of paths concurrently in a single Node.js step,
6
- * returning a structured result the tool-router collapses into one
7
- * tool_result delta. Eliminates the per-file LLM round trip cost.
8
- *
9
- * Flag: CC_OPENCLAW_PERF_READ_BATCH (default OFF, medium risk — tool
10
- * schema change requires sub-agent training to use the batched form).
11
- *
12
- * Per-file failures are isolated: an unreadable file produces an error
13
- * entry in the result rather than failing the whole batch. Encoding is
14
- * fixed to utf8 to match the existing Read tool semantics.
15
- */
16
- export interface BatchReadEntry {
17
- path: string;
18
- content: string | null;
19
- error: string | null;
20
- bytes: number;
21
- }
22
- export interface BatchReadResult {
23
- enabled: boolean;
24
- entries: BatchReadEntry[];
25
- totalBytes: number;
26
- errorCount: number;
27
- }
28
- /**
29
- * Read up to MAX_BATCH_SIZE paths in parallel. When the flag is off,
30
- * returns `enabled: false` with an empty entry list — caller falls back
31
- * to the per-file path. Per-file failures populate `.error`, not throw.
32
- */
33
- export declare function batchReadPaths(paths: string[]): Promise<BatchReadResult>;
@@ -1,22 +0,0 @@
1
- /**
2
- * M4 (perf overhaul idea #4) — collapse <available_skills> sysprompt block.
3
- *
4
- * The block is ~3K tokens of skill names + descriptions. Almost every turn
5
- * the user invokes 0 or 1 skill, so the full listing is dead weight in the
6
- * cache-relevant prefix. This collapses it to a one-line hint that points
7
- * the model at an on-demand `openclaw skills list` tool call.
8
- *
9
- * The collapse is text-level so it composes with sysprompt-strip.ts without
10
- * coupling to its pipeline. Caller invokes after the strip pass.
11
- *
12
- * Flag: CC_OPENCLAW_PERF_SKILL_ONDEMAND (default OFF).
13
- *
14
- * Idempotent — replacing an already-collapsed sysprompt is a no-op.
15
- */
16
- export interface CollapseResult {
17
- content: string;
18
- changed: boolean;
19
- bytesRemoved: number;
20
- }
21
- /** Collapse the <available_skills> block; no-op when the flag is off. */
22
- export declare function collapseSkillList(sysprompt: string): CollapseResult;
@@ -1,27 +0,0 @@
1
- /**
2
- * src/lib/perf/speculative-bubble.ts — v0.25.0 M16 migration target.
3
- *
4
- * Migrated from src/channels/telegram/speculative-bubble.ts unchanged
5
- * except for the sendTg import path (legacy card-renderer → new
6
- * src/lib/telegram-bot-api.ts).
7
- *
8
- * M9 (perf overhaul idea #9). Fires a Telegram sendMessage at t≈50ms
9
- * after the user submits, BEFORE the model returns first token. Pure
10
- * perception fix — shortens the user-visible "did the bot get my
11
- * message?" window from ~400-800ms to ~50ms.
12
- *
13
- * Flag: CC_OPENCLAW_PERF_SPEC_BUBBLE (default OFF; opt-in via =1).
14
- */
15
- export interface SpeculativeBubbleOptions {
16
- chatId: string;
17
- threadId?: string | undefined;
18
- /** Text to emit. Defaults to a one-cell braille spinner + "Thinking…". */
19
- text?: string;
20
- /** Reply-to message id (the user's submitted message). Optional. */
21
- replyToMessageId?: number | null;
22
- }
23
- /**
24
- * Emit the speculative bubble. Returns the new message_id on success,
25
- * null if the flag is off / chatId is missing / send failed. Never throws.
26
- */
27
- export declare function emitSpeculativeThinking(opts: SpeculativeBubbleOptions): Promise<number | null>;
@@ -1,25 +0,0 @@
1
- /**
2
- * M2 (perf overhaul idea #2) — typing-prefetch subprocess warmup.
3
- *
4
- * Telegram emits `sendChatAction` upstream events while the user is typing
5
- * (the "typing…" indicator). This module debounces those signals into a
6
- * single "warm the subprocess pool for this chatId" trigger, then invokes
7
- * the registered warmup callback. The actual subprocess.spawn() is owned
8
- * by the session-manager / cli pool — this module is just the signal layer.
9
- *
10
- * Flag: CC_OPENCLAW_PERF_TYPING_PREFETCH (default OFF).
11
- *
12
- * Coalescing: at most one warmup per chatId per WARMUP_COOLDOWN_MS. Prevents
13
- * "typing… typing… typing…" hammer events from spawning N subprocesses.
14
- */
15
- export declare const WARMUP_COOLDOWN_MS = 4000;
16
- /** Register the actual warmup callback (called by session-manager bootstrap). */
17
- export declare function setWarmupHandler(fn: ((chatId: string) => void) | null): void;
18
- /**
19
- * Notify that user is typing in chatId. Triggers warmup at most once per
20
- * cooldown window. No-op when flag off, no handler registered, or in cooldown.
21
- * Returns true iff a warmup was actually triggered.
22
- */
23
- export declare function notifyTyping(chatId: string, now?: number): boolean;
24
- /** Test hook — reset the cooldown map. */
25
- export declare function _resetTypingPrefetchForTests(): void;
@@ -1,50 +0,0 @@
1
- /**
2
- * src/lib/probes.ts — Phase-0 empirical probe instrumentation (planning P0-A/B/C).
3
- *
4
- * OBSERVE-ONLY. Gated by `CC_OPENCLAW_PROBE=1` so it is completely silent — zero
5
- * behavior change, no log output — in normal operation. The operator (A1)
6
- * enables it for a single probe session, exercises the relevant Telegram
7
- * interaction, then greps stderr for the `[cc-openclaw/probe]` markers. The
8
- * runbook (PROBES-RUNBOOK in the planning dir) has the exact steps + how to read
9
- * the results.
10
- *
11
- * These resolve the load-bearing seams that CANNOT be read from source because
12
- * they depend on OpenClaw gateway runtime behavior:
13
- * P0-A: does `enqueueNextTurnInjection` trigger a run, or only stage context
14
- * for the next user message? (decides feature #1 Approve + #3 /send)
15
- * P0-B: does an `ExitPlanMode` tool_use ever fire on the bypassPermissions
16
- * Telegram path? (decides feature #1's trigger)
17
- * P0-C: does a Telegram photo reach the plugin as an image block — at
18
- * before_dispatch and/or in the openai-compat request body (where
19
- * message-extractor strips non-text parts) — or is it gateway-stripped?
20
- * (decides whether feature #2 is plugin-side feasible at all)
21
- */
22
- /**
23
- * P0-A — log each `enqueueNextTurnInjection` call site. The operator correlates
24
- * this with whether a reply arrives in Telegram WITHOUT typing a follow-up
25
- * message: if it does, injection triggers a run; if not, it only stages context.
26
- */
27
- export declare function probeInjectionEnqueued(sessionKey: string, source: string): void;
28
- /**
29
- * P0-B — log when a tool_use is `ExitPlanMode` (and any other tool name, for
30
- * context). Looks across the known event field paths, mirroring
31
- * inbound-handler.extractToolUse so it works whatever shape the gateway uses.
32
- */
33
- export declare function probeToolUse(ev: Record<string, unknown> | undefined): void;
34
- /**
35
- * P0-C (inbound surface) — dump the before_dispatch event, flagging whether it
36
- * carries any media field, so the operator sees whether photo/document surface
37
- * to the plugin at all.
38
- */
39
- export declare function probeInboundShape(event: unknown): void;
40
- /**
41
- * P0-C (openai-compat body) — the PRECISE probe. Does an image block survive to
42
- * the request body, where `message-extractor.ts` strips non-text parts? Logs
43
- * each non-text content-part type. If image parts appear here, feature #2 is
44
- * feasible plugin-side (preserve them through extractUserMessage); if nothing
45
- * non-text ever appears, the image is gateway-stripped upstream → hands-off-blocked.
46
- */
47
- export declare function probeMultimodalContent(messages: Array<{
48
- role?: string;
49
- content?: unknown;
50
- }> | undefined): void;