@a1hvdy/cc-openclaw 0.30.0 → 0.32.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 (207) 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/engines/persistent-session.js +11 -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 +121 -9
  9. package/package.json +3 -2
  10. package/dist/src/channels/adapter.d.ts +0 -103
  11. package/dist/src/channels/telegram-mirror/askuser.d.ts +0 -107
  12. package/dist/src/channels/telegram-mirror/burst-accumulator.d.ts +0 -96
  13. package/dist/src/channels/telegram-mirror/callback-mapping.d.ts +0 -61
  14. package/dist/src/channels/telegram-mirror/card-renderer.d.ts +0 -68
  15. package/dist/src/channels/telegram-mirror/card-state.d.ts +0 -83
  16. package/dist/src/channels/telegram-mirror/commands.d.ts +0 -183
  17. package/dist/src/channels/telegram-mirror/compose-buffer.d.ts +0 -71
  18. package/dist/src/channels/telegram-mirror/cost-views.d.ts +0 -58
  19. package/dist/src/channels/telegram-mirror/failure/callback-data-overflow.d.ts +0 -21
  20. package/dist/src/channels/telegram-mirror/failure/gateway-down.d.ts +0 -15
  21. package/dist/src/channels/telegram-mirror/failure/in-flight-conflict.d.ts +0 -15
  22. package/dist/src/channels/telegram-mirror/failure/index.d.ts +0 -23
  23. package/dist/src/channels/telegram-mirror/failure/model-5xx.d.ts +0 -16
  24. package/dist/src/channels/telegram-mirror/failure/network-blip.d.ts +0 -17
  25. package/dist/src/channels/telegram-mirror/failure/pool-exhausted-fallback.d.ts +0 -15
  26. package/dist/src/channels/telegram-mirror/failure/rate-limit.d.ts +0 -16
  27. package/dist/src/channels/telegram-mirror/failure/returning-after-24h.d.ts +0 -14
  28. package/dist/src/channels/telegram-mirror/failure/types.d.ts +0 -30
  29. package/dist/src/channels/telegram-mirror/inbound-handler.d.ts +0 -73
  30. package/dist/src/channels/telegram-mirror/index.d.ts +0 -32
  31. package/dist/src/channels/telegram-mirror/plan-attachment.d.ts +0 -120
  32. package/dist/src/channels/telegram-mirror/quota-reader.d.ts +0 -42
  33. package/dist/src/channels/telegram-mirror/sessions-keyboard.d.ts +0 -84
  34. package/dist/src/channels/telegram-mirror/soak-log.d.ts +0 -99
  35. package/dist/src/channels/telegram-mirror/state-machine.d.ts +0 -113
  36. package/dist/src/channels/telegram-mirror/status-line.d.ts +0 -51
  37. package/dist/src/channels/telegram-mirror/sync-commands.d.ts +0 -100
  38. package/dist/src/channels/telegram-mirror/threshold-watcher.d.ts +0 -54
  39. package/dist/src/channels/telegram-mirror/turn-bridge.d.ts +0 -125
  40. package/dist/src/cli/checks/bridge-wiring.d.ts +0 -14
  41. package/dist/src/cli/checks/config-schema.d.ts +0 -11
  42. package/dist/src/cli/checks/critical-openclaw-json-keys.d.ts +0 -21
  43. package/dist/src/cli/checks/install-path.d.ts +0 -11
  44. package/dist/src/cli/checks/patch-scaffold.d.ts +0 -17
  45. package/dist/src/cli/doctor.d.ts +0 -20
  46. package/dist/src/cli/index.d.ts +0 -8
  47. package/dist/src/cli/migrate.d.ts +0 -29
  48. package/dist/src/command-router/cc-handler.d.ts +0 -67
  49. package/dist/src/command-router/index.d.ts +0 -2
  50. package/dist/src/command-router/launch-policy.d.ts +0 -92
  51. package/dist/src/command-router/resume-policy.d.ts +0 -18
  52. package/dist/src/command-router/turn-formatter.d.ts +0 -19
  53. package/dist/src/config/loader.d.ts +0 -8
  54. package/dist/src/config/schema.d.ts +0 -192
  55. package/dist/src/constants.d.ts +0 -191
  56. package/dist/src/council/build-agent-prompt.d.ts +0 -11
  57. package/dist/src/council/cleanup-worktrees.d.ts +0 -10
  58. package/dist/src/council/consensus.d.ts +0 -20
  59. package/dist/src/council/council.d.ts +0 -67
  60. package/dist/src/council/index.d.ts +0 -2
  61. package/dist/src/council/system-prompt.d.ts +0 -16
  62. package/dist/src/council/write-worktree-claude-md.d.ts +0 -10
  63. package/dist/src/engines/base-oneshot-session.d.ts +0 -87
  64. package/dist/src/engines/heartbeat-guard.d.ts +0 -93
  65. package/dist/src/engines/index.d.ts +0 -8
  66. package/dist/src/engines/persistent-codex-session.d.ts +0 -16
  67. package/dist/src/engines/persistent-cursor-session.d.ts +0 -21
  68. package/dist/src/engines/persistent-custom-session.d.ts +0 -78
  69. package/dist/src/engines/persistent-gemini-session.d.ts +0 -21
  70. package/dist/src/engines/persistent-session.d.ts +0 -95
  71. package/dist/src/engines/resolve-bin.d.ts +0 -14
  72. package/dist/src/engines/subprocess-pool.d.ts +0 -78
  73. package/dist/src/health/handler.d.ts +0 -39
  74. package/dist/src/health/index.d.ts +0 -1
  75. package/dist/src/health/metrics.d.ts +0 -52
  76. package/dist/src/index.d.ts +0 -57
  77. package/dist/src/lib/auto-recovery.d.ts +0 -43
  78. package/dist/src/lib/cache-parity-decide.d.ts +0 -64
  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/index.d.ts +0 -7
  97. package/dist/src/lib/index.js +0 -10
  98. package/dist/src/lib/json-array.d.ts +0 -10
  99. package/dist/src/lib/markdown-to-mdv2.d.ts +0 -53
  100. package/dist/src/lib/markdown-v2.d.ts +0 -27
  101. package/dist/src/lib/perf/async-compact.d.ts +0 -26
  102. package/dist/src/lib/perf/direct-sdk.d.ts +0 -26
  103. package/dist/src/lib/perf/haiku-route.d.ts +0 -19
  104. package/dist/src/lib/perf/predictive-continuation.d.ts +0 -18
  105. package/dist/src/lib/perf/read-batch.d.ts +0 -33
  106. package/dist/src/lib/perf/skill-list-collapse.d.ts +0 -22
  107. package/dist/src/lib/perf/speculative-bubble.d.ts +0 -27
  108. package/dist/src/lib/perf/typing-prefetch.d.ts +0 -25
  109. package/dist/src/lib/probes.d.ts +0 -50
  110. package/dist/src/lib/register-guard.d.ts +0 -56
  111. package/dist/src/lib/req-shape-log.d.ts +0 -31
  112. package/dist/src/lib/safe-upstream-probes.d.ts +0 -25
  113. package/dist/src/lib/session-registry.d.ts +0 -66
  114. package/dist/src/lib/spawn-async.d.ts +0 -18
  115. package/dist/src/lib/status-tee-reader.d.ts +0 -29
  116. package/dist/src/lib/sysprompt-strip.d.ts +0 -53
  117. package/dist/src/lib/telegram-bot-api.d.ts +0 -146
  118. package/dist/src/lib/telemetry.d.ts +0 -38
  119. package/dist/src/lib/test-mode.d.ts +0 -26
  120. package/dist/src/lib/trajectory.d.ts +0 -44
  121. package/dist/src/lib/vendor-paths.d.ts +0 -12
  122. package/dist/src/lifecycle/boot.d.ts +0 -48
  123. package/dist/src/lifecycle/patch-manifest.d.ts +0 -82
  124. package/dist/src/lifecycle/phase-import-upstream.d.ts +0 -12
  125. package/dist/src/lifecycle/phase-install-patches.d.ts +0 -12
  126. package/dist/src/lifecycle/phase-schedule-jobs.d.ts +0 -12
  127. package/dist/src/lifecycle/phase-start-server.d.ts +0 -11
  128. package/dist/src/lifecycle/phase-validate-config.d.ts +0 -9
  129. package/dist/src/lifecycle/phase-validate-upstream.d.ts +0 -11
  130. package/dist/src/lifecycle/phase-wire-handlers.d.ts +0 -12
  131. package/dist/src/lifecycle/safe-restart.d.ts +0 -99
  132. package/dist/src/logger.d.ts +0 -14
  133. package/dist/src/mcp/bridge.d.ts +0 -21
  134. package/dist/src/mcp/index.d.ts +0 -2
  135. package/dist/src/models.d.ts +0 -68
  136. package/dist/src/observability/event-bus.d.ts +0 -86
  137. package/dist/src/observability/get-event-bus.d.ts +0 -25
  138. package/dist/src/observability/observability-service.d.ts +0 -19
  139. package/dist/src/observability/perf-telemetry.d.ts +0 -65
  140. package/dist/src/observability/subscribers/metrics.d.ts +0 -11
  141. package/dist/src/observability/subscribers/session-capture.d.ts +0 -15
  142. package/dist/src/openai-compat/autonomy-rule.d.ts +0 -26
  143. package/dist/src/openai-compat/bridges/allowlist.d.ts +0 -19
  144. package/dist/src/openai-compat/bridges/factory.d.ts +0 -30
  145. package/dist/src/openai-compat/bridges/media-bridge.d.ts +0 -34
  146. package/dist/src/openai-compat/bridges/openclaw-api-shim.d.ts +0 -54
  147. package/dist/src/openai-compat/bridges/openclaw-native-tools.d.ts +0 -61
  148. package/dist/src/openai-compat/bridges/openclaw-tool-registry.d.ts +0 -26
  149. package/dist/src/openai-compat/bridges/tts-media-bridge.d.ts +0 -19
  150. package/dist/src/openai-compat/chat-cwd.d.ts +0 -22
  151. package/dist/src/openai-compat/cli-stream-parser.d.ts +0 -134
  152. package/dist/src/openai-compat/index.d.ts +0 -1
  153. package/dist/src/openai-compat/message-extractor.d.ts +0 -84
  154. package/dist/src/openai-compat/mode-flags.d.ts +0 -34
  155. package/dist/src/openai-compat/non-streaming-handler.d.ts +0 -29
  156. package/dist/src/openai-compat/openai-chunk-types.d.ts +0 -35
  157. package/dist/src/openai-compat/openai-compat.d.ts +0 -49
  158. package/dist/src/openai-compat/openai-types.d.ts +0 -71
  159. package/dist/src/openai-compat/parse-route-body.d.ts +0 -24
  160. package/dist/src/openai-compat/prompts.d.ts +0 -47
  161. package/dist/src/openai-compat/request-coalescer.d.ts +0 -77
  162. package/dist/src/openai-compat/response-formatter.d.ts +0 -33
  163. package/dist/src/openai-compat/session-key-resolver.d.ts +0 -41
  164. package/dist/src/openai-compat/skill-resolver.d.ts +0 -59
  165. package/dist/src/openai-compat/sse-translator.d.ts +0 -51
  166. package/dist/src/openai-compat/status-reporter.d.ts +0 -30
  167. package/dist/src/openai-compat/streaming-handler.d.ts +0 -52
  168. package/dist/src/openai-compat/tool-calls-parser.d.ts +0 -34
  169. package/dist/src/openai-compat/tool-results-serializer.d.ts +0 -60
  170. package/dist/src/openai-compat/tts-rule.d.ts +0 -20
  171. package/dist/src/openai-compat/voice-recovery.d.ts +0 -56
  172. package/dist/src/patches/cache-parity-registry.d.ts +0 -103
  173. package/dist/src/patches/claude-md-injection.d.ts +0 -10
  174. package/dist/src/patches/cwd-redirect.d.ts +0 -10
  175. package/dist/src/patches/embedded-server-route.d.ts +0 -23
  176. package/dist/src/patches/pricing-overrides.d.ts +0 -10
  177. package/dist/src/patches/resume-registry-restore.d.ts +0 -11
  178. package/dist/src/patches/session-pid-tracking.d.ts +0 -10
  179. package/dist/src/patches/sysprompt-strip.d.ts +0 -46
  180. package/dist/src/patches/tools-restoration.d.ts +0 -12
  181. package/dist/src/persistence/migration-v0.d.ts +0 -24
  182. package/dist/src/persistence/session-registry.d.ts +0 -58
  183. package/dist/src/proxy/anthropic-adapter.d.ts +0 -136
  184. package/dist/src/proxy/handler.d.ts +0 -39
  185. package/dist/src/proxy/index.d.ts +0 -4
  186. package/dist/src/proxy/schema-cleaner.d.ts +0 -11
  187. package/dist/src/proxy/thought-cache.d.ts +0 -19
  188. package/dist/src/session/embedded-server.d.ts +0 -25
  189. package/dist/src/session/inbox-manager.d.ts +0 -38
  190. package/dist/src/session/index.d.ts +0 -3
  191. package/dist/src/session/persisted-sessions.d.ts +0 -50
  192. package/dist/src/session/session-manager.d.ts +0 -247
  193. package/dist/src/session/watchdogs.d.ts +0 -92
  194. package/dist/src/session-bootstrap/boot-self-heal.d.ts +0 -32
  195. package/dist/src/session-bootstrap/cwd-patch.d.ts +0 -50
  196. package/dist/src/session-bootstrap/index.d.ts +0 -3
  197. package/dist/src/session-bootstrap/resume-registry.d.ts +0 -27
  198. package/dist/src/session-bootstrap/session-hygiene.d.ts +0 -23
  199. package/dist/src/session-bootstrap/sysprompt-strip.d.ts +0 -24
  200. package/dist/src/session-bootstrap/think-conflict-resolver.d.ts +0 -32
  201. package/dist/src/types/route.d.ts +0 -11
  202. package/dist/src/types/runtime-config.d.ts +0 -208
  203. package/dist/src/types/sse.d.ts +0 -29
  204. package/dist/src/types/tool-bridge.d.ts +0 -82
  205. package/dist/src/types/upstream.d.ts +0 -580
  206. package/dist/src/types.d.ts +0 -498
  207. package/dist/src/validation.d.ts +0 -31
@@ -1,59 +0,0 @@
1
- /**
2
- * DomainError hierarchy for cc-openclaw.
3
- *
4
- * Per Phase 4 §11: use DomainError subclasses (not Result<T,E>) for error model
5
- * in new modules. All seam-crossing errors are typed here.
6
- */
7
- export declare class DomainError extends Error {
8
- constructor(message: string);
9
- }
10
- /**
11
- * Thrown when ConfigSchema.parse() rejects the env + openclaw.json payload.
12
- * Phase 1 of boot (validate-config) re-throws loader errors as this type.
13
- */
14
- export declare class ConfigInvalid extends DomainError {
15
- readonly issues: string[];
16
- constructor(message: string, issues: string[]);
17
- }
18
- /**
19
- * Thrown by PatchManifest.validate() when one or more PatchSpec probes fail,
20
- * indicating the upstream Claude Code shape has drifted from expectations.
21
- * Boot phase 3 catches this and surfaces a drift report; install is refused.
22
- */
23
- export declare class DriftError extends DomainError {
24
- readonly failedSpecs: {
25
- id: string;
26
- reason: string;
27
- }[];
28
- constructor(failedSpecs: {
29
- id: string;
30
- reason: string;
31
- }[]);
32
- }
33
- /**
34
- * Thrown by asSessionName() when a raw string is missing the required
35
- * "openai-" prefix. Closing the v0.6.0 namespace-bug class structurally
36
- * via a compile-time brand + runtime guard.
37
- */
38
- export declare class SessionPrefixMissing extends DomainError {
39
- readonly raw: string;
40
- constructor(raw: string);
41
- }
42
- /**
43
- * Thrown by NativeOpenClawToolsBridge.dispatch() when the requested tool name
44
- * is not present in the configured allowList. Deny-by-default per Q1 resolution.
45
- */
46
- export declare class UnauthorizedTool extends DomainError {
47
- readonly toolName: string;
48
- readonly allowList: readonly string[];
49
- constructor(toolName: string, allowList: readonly string[]);
50
- }
51
- /**
52
- * Thrown by stub implementations that have a defined interface contract but
53
- * whose bodies are deferred to Phase E. Distinct from a missing method —
54
- * the interface is intentional, the body is pending.
55
- */
56
- export declare class NotImplemented extends DomainError {
57
- readonly what: string;
58
- constructor(what: string);
59
- }
@@ -1,46 +0,0 @@
1
- /**
2
- * drift-detector — cross-laptop version mismatch detection.
3
- *
4
- * On register() and every 5 minutes (default), captures:
5
- * { laptopId, ccOpenclawBuildHash, openclawBinaryVersion, claudeCodeVersion, ts }
6
- *
7
- * Writes to ~/.openclaw/state/cc-openclaw-version-state.json (one slot per
8
- * laptopId) per handoff system slot rule. Compares own slot vs other laptop
9
- * slots; on mismatch fires Telegram alert + drift.jsonl row with 1h dedup.
10
- *
11
- * Configurable via:
12
- * OPENCLAW_CC_OPENCLAW_DRIFT_ALERTS=0 — disable Telegram noise
13
- * OPENCLAW_CC_OPENCLAW_DRIFT_DEDUPE_WINDOW_MS — dedup window (default 3600000)
14
- */
15
- export interface VersionSlot {
16
- laptopId: string;
17
- ccOpenclawBuildHash: string;
18
- openclawBinaryVersion: string;
19
- claudeCodeVersion: string;
20
- ts: string;
21
- [key: string]: string;
22
- }
23
- export type VersionStateFile = Record<string, VersionSlot>;
24
- export interface DriftReport {
25
- detected: boolean;
26
- ownSlot: VersionSlot;
27
- conflictingSlots: Array<{
28
- laptopId: string;
29
- slot: VersionSlot;
30
- fields: string[];
31
- }>;
32
- }
33
- export declare function captureVersionSlot(): VersionSlot;
34
- /** Test-only reset. */
35
- export declare function _resetDriftAlertForTests(): void;
36
- /**
37
- * Capture own slot, update state file, compare with other laptops.
38
- * Fires Telegram + jsonl on mismatch (with 1h dedup).
39
- *
40
- * Returns the DriftReport so callers can react programmatically.
41
- */
42
- export declare function checkDrift(): Promise<DriftReport>;
43
- export declare function startDriftPolling(): void;
44
- export declare function stopDriftPolling(): void;
45
- /** Test-only: check if polling is active. */
46
- export declare function _isDriftPollingActive(): boolean;
@@ -1,47 +0,0 @@
1
- /**
2
- * Per-turn send() timeout. `0` disables the timer entirely — `_waitForTurnComplete`
3
- * will then only settle on real events (TURN_COMPLETE / ERROR / CLOSE). Use this
4
- * to match direct CLI behavior on long-running tool turns.
5
- *
6
- * Env: `CC_OPENCLAW_TURN_TIMEOUT_MS`. Default: 900_000 (15 min).
7
- */
8
- export declare function resolveTurnTimeoutMs(): number;
9
- /**
10
- * /compact operation timeout. `0` disables — compact runs until the model
11
- * returns. Useful on 150K-token sessions where compact legitimately takes
12
- * 90s+ and the 60s default kills it mid-run.
13
- *
14
- * Env: `CC_OPENCLAW_COMPACT_TIMEOUT_MS`. Default: 60_000 (60 s).
15
- */
16
- export declare function resolveCompactTimeoutMs(): number;
17
- /**
18
- * Stalled-session SIGTERM threshold. `0` disables the watchdog entirely.
19
- * Default behavior fires every 30 s and aborts sessions whose subprocess
20
- * has emitted no events for this many ms.
21
- *
22
- * Env: `CC_OPENCLAW_STALLED_KILL_MS`. Default: 180_000 (3 min).
23
- */
24
- export declare function resolveStalledKillMs(): number;
25
- /**
26
- * Runaway-loop spawn rate ceiling. `0` disables the refusal logic (any spawn
27
- * is accepted regardless of recent rate). This guard exists for upstream
28
- * OpenClaw `before_model_resolve` re-fire bugs; usually leave on.
29
- *
30
- * Env: `CC_OPENCLAW_LOOP_MAX_SUBPROCS`. Default: 3 per 60s window.
31
- * Clamped to [0, 1000] when explicitly set.
32
- */
33
- export declare function resolveRunawayMaxSubprocs(): number;
34
- /**
35
- * Auto-compact context-percent threshold. `0` disables auto-compact post-turn.
36
- * Clamped to [0, 100].
37
- *
38
- * Env: `CC_OPENCLAW_AUTO_COMPACT_THRESHOLD`. Default: 70.
39
- */
40
- export declare function resolveAutoCompactThreshold(): number;
41
- /**
42
- * Hard-reset context-percent threshold. `0` disables auto-reset.
43
- * Clamped to [0, 100].
44
- *
45
- * Env: `CC_OPENCLAW_HARD_RESET_THRESHOLD`. Default: 90.
46
- */
47
- export declare function resolveHardResetThreshold(): number;
@@ -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,7 +0,0 @@
1
- export * from './register-guard.js';
2
- export { registerOnce } from './register-guard.js';
3
- export { stripSysprompt, isStripEnabled, type StripOptions, type StripResult } from './sysprompt-strip.js';
4
- export { isCacheParityEnabled, hashPrompt, recordAttachment, readRegistry, REGISTRY_PATH, type RegistryEntry, } from './cache-parity.js';
5
- export { selectEngine, isCcOpenclawEnabled, captureSessionRoute, ACTIVE_FLAG_ENV, ROUTE_FLAG_ENV, type Engine, type SessionRoute, } from './config-service.js';
6
- export { isTestMode, TEST_MODE_ENV, _setTestModeForTests } from './test-mode.js';
7
- export { getAggressiveStripEnabled, getCacheParityEnabled, getLogLevel, isLogLevelDebug, } from './config.js';
@@ -1,10 +0,0 @@
1
- export * from './register-guard.js';
2
- export { registerOnce } from './register-guard.js';
3
- export { stripSysprompt, isStripEnabled } from './sysprompt-strip.js';
4
- export { isCacheParityEnabled, hashPrompt, recordAttachment, readRegistry, REGISTRY_PATH, } from './cache-parity.js';
5
- // Engine routing — originally `./route-flag.js`; collapsed into
6
- // `./config-service.js` at Cluster A step 8. Same API, same semantics,
7
- // single source of truth.
8
- export { selectEngine, isCcOpenclawEnabled, captureSessionRoute, ACTIVE_FLAG_ENV, ROUTE_FLAG_ENV, } from './config-service.js';
9
- export { isTestMode, TEST_MODE_ENV, _setTestModeForTests } from './test-mode.js';
10
- export { getAggressiveStripEnabled, getCacheParityEnabled, getLogLevel, isLogLevelDebug, } from './config.js';
@@ -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;