@a1hvdy/cc-openclaw 0.30.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.
- package/dist/src/channels/telegram-mirror/card-renderer.js +9 -5
- package/dist/src/channels/telegram-mirror/commands.js +0 -8
- package/dist/src/channels/telegram-mirror/status-line.js +32 -2
- package/dist/src/constants.js +16 -2
- package/dist/src/lib/config.js +40 -0
- package/dist/src/openai-compat/non-streaming-handler.js +2 -2
- package/dist/src/openai-compat/streaming-handler.js +2 -2
- package/package.json +3 -2
- package/dist/src/channels/adapter.d.ts +0 -103
- package/dist/src/channels/telegram-mirror/askuser.d.ts +0 -107
- package/dist/src/channels/telegram-mirror/burst-accumulator.d.ts +0 -96
- package/dist/src/channels/telegram-mirror/callback-mapping.d.ts +0 -61
- package/dist/src/channels/telegram-mirror/card-renderer.d.ts +0 -68
- package/dist/src/channels/telegram-mirror/card-state.d.ts +0 -83
- package/dist/src/channels/telegram-mirror/commands.d.ts +0 -183
- package/dist/src/channels/telegram-mirror/compose-buffer.d.ts +0 -71
- package/dist/src/channels/telegram-mirror/cost-views.d.ts +0 -58
- package/dist/src/channels/telegram-mirror/failure/callback-data-overflow.d.ts +0 -21
- package/dist/src/channels/telegram-mirror/failure/gateway-down.d.ts +0 -15
- package/dist/src/channels/telegram-mirror/failure/in-flight-conflict.d.ts +0 -15
- package/dist/src/channels/telegram-mirror/failure/index.d.ts +0 -23
- package/dist/src/channels/telegram-mirror/failure/model-5xx.d.ts +0 -16
- package/dist/src/channels/telegram-mirror/failure/network-blip.d.ts +0 -17
- package/dist/src/channels/telegram-mirror/failure/pool-exhausted-fallback.d.ts +0 -15
- package/dist/src/channels/telegram-mirror/failure/rate-limit.d.ts +0 -16
- package/dist/src/channels/telegram-mirror/failure/returning-after-24h.d.ts +0 -14
- package/dist/src/channels/telegram-mirror/failure/types.d.ts +0 -30
- package/dist/src/channels/telegram-mirror/inbound-handler.d.ts +0 -73
- package/dist/src/channels/telegram-mirror/index.d.ts +0 -32
- package/dist/src/channels/telegram-mirror/plan-attachment.d.ts +0 -120
- package/dist/src/channels/telegram-mirror/quota-reader.d.ts +0 -42
- package/dist/src/channels/telegram-mirror/sessions-keyboard.d.ts +0 -84
- package/dist/src/channels/telegram-mirror/soak-log.d.ts +0 -99
- package/dist/src/channels/telegram-mirror/state-machine.d.ts +0 -113
- package/dist/src/channels/telegram-mirror/status-line.d.ts +0 -51
- package/dist/src/channels/telegram-mirror/sync-commands.d.ts +0 -100
- package/dist/src/channels/telegram-mirror/threshold-watcher.d.ts +0 -54
- package/dist/src/channels/telegram-mirror/turn-bridge.d.ts +0 -125
- package/dist/src/cli/checks/bridge-wiring.d.ts +0 -14
- package/dist/src/cli/checks/config-schema.d.ts +0 -11
- package/dist/src/cli/checks/critical-openclaw-json-keys.d.ts +0 -21
- package/dist/src/cli/checks/install-path.d.ts +0 -11
- package/dist/src/cli/checks/patch-scaffold.d.ts +0 -17
- package/dist/src/cli/doctor.d.ts +0 -20
- package/dist/src/cli/index.d.ts +0 -8
- package/dist/src/cli/migrate.d.ts +0 -29
- package/dist/src/command-router/cc-handler.d.ts +0 -67
- package/dist/src/command-router/index.d.ts +0 -2
- package/dist/src/command-router/launch-policy.d.ts +0 -92
- package/dist/src/command-router/resume-policy.d.ts +0 -18
- package/dist/src/command-router/turn-formatter.d.ts +0 -19
- package/dist/src/config/loader.d.ts +0 -8
- package/dist/src/config/schema.d.ts +0 -192
- package/dist/src/constants.d.ts +0 -191
- package/dist/src/council/build-agent-prompt.d.ts +0 -11
- package/dist/src/council/cleanup-worktrees.d.ts +0 -10
- package/dist/src/council/consensus.d.ts +0 -20
- package/dist/src/council/council.d.ts +0 -67
- package/dist/src/council/index.d.ts +0 -2
- package/dist/src/council/system-prompt.d.ts +0 -16
- package/dist/src/council/write-worktree-claude-md.d.ts +0 -10
- package/dist/src/engines/base-oneshot-session.d.ts +0 -87
- package/dist/src/engines/heartbeat-guard.d.ts +0 -93
- package/dist/src/engines/index.d.ts +0 -8
- package/dist/src/engines/persistent-codex-session.d.ts +0 -16
- package/dist/src/engines/persistent-cursor-session.d.ts +0 -21
- package/dist/src/engines/persistent-custom-session.d.ts +0 -78
- package/dist/src/engines/persistent-gemini-session.d.ts +0 -21
- package/dist/src/engines/persistent-session.d.ts +0 -95
- package/dist/src/engines/resolve-bin.d.ts +0 -14
- package/dist/src/engines/subprocess-pool.d.ts +0 -78
- package/dist/src/health/handler.d.ts +0 -39
- package/dist/src/health/index.d.ts +0 -1
- package/dist/src/health/metrics.d.ts +0 -52
- package/dist/src/index.d.ts +0 -57
- package/dist/src/lib/auto-recovery.d.ts +0 -43
- package/dist/src/lib/cache-parity-decide.d.ts +0 -64
- package/dist/src/lib/cache-parity.d.ts +0 -38
- package/dist/src/lib/cc-cli-scan.d.ts +0 -52
- package/dist/src/lib/circuit-breaker.d.ts +0 -21
- package/dist/src/lib/config-service.d.ts +0 -106
- package/dist/src/lib/config.d.ts +0 -136
- package/dist/src/lib/cost-rollup.d.ts +0 -36
- package/dist/src/lib/debounce.d.ts +0 -12
- package/dist/src/lib/debug-tap.d.ts +0 -13
- package/dist/src/lib/domain-error.d.ts +0 -59
- package/dist/src/lib/drift-detector.d.ts +0 -46
- package/dist/src/lib/env-overrides.d.ts +0 -47
- package/dist/src/lib/error-formatter.d.ts +0 -91
- package/dist/src/lib/error-renderer.d.ts +0 -20
- package/dist/src/lib/heartbeat-config.d.ts +0 -34
- package/dist/src/lib/heartbeat-workaround.d.ts +0 -44
- package/dist/src/lib/html-render.d.ts +0 -50
- package/dist/src/lib/http-agent.d.ts +0 -47
- package/dist/src/lib/index.d.ts +0 -7
- package/dist/src/lib/index.js +0 -10
- package/dist/src/lib/json-array.d.ts +0 -10
- package/dist/src/lib/markdown-to-mdv2.d.ts +0 -53
- package/dist/src/lib/markdown-v2.d.ts +0 -27
- package/dist/src/lib/perf/async-compact.d.ts +0 -26
- package/dist/src/lib/perf/direct-sdk.d.ts +0 -26
- package/dist/src/lib/perf/haiku-route.d.ts +0 -19
- package/dist/src/lib/perf/predictive-continuation.d.ts +0 -18
- package/dist/src/lib/perf/read-batch.d.ts +0 -33
- package/dist/src/lib/perf/skill-list-collapse.d.ts +0 -22
- package/dist/src/lib/perf/speculative-bubble.d.ts +0 -27
- package/dist/src/lib/perf/typing-prefetch.d.ts +0 -25
- package/dist/src/lib/probes.d.ts +0 -50
- package/dist/src/lib/register-guard.d.ts +0 -56
- package/dist/src/lib/req-shape-log.d.ts +0 -31
- package/dist/src/lib/safe-upstream-probes.d.ts +0 -25
- package/dist/src/lib/session-registry.d.ts +0 -66
- package/dist/src/lib/spawn-async.d.ts +0 -18
- package/dist/src/lib/status-tee-reader.d.ts +0 -29
- package/dist/src/lib/sysprompt-strip.d.ts +0 -53
- package/dist/src/lib/telegram-bot-api.d.ts +0 -146
- package/dist/src/lib/telemetry.d.ts +0 -38
- package/dist/src/lib/test-mode.d.ts +0 -26
- package/dist/src/lib/trajectory.d.ts +0 -44
- package/dist/src/lib/vendor-paths.d.ts +0 -12
- package/dist/src/lifecycle/boot.d.ts +0 -48
- package/dist/src/lifecycle/patch-manifest.d.ts +0 -82
- package/dist/src/lifecycle/phase-import-upstream.d.ts +0 -12
- package/dist/src/lifecycle/phase-install-patches.d.ts +0 -12
- package/dist/src/lifecycle/phase-schedule-jobs.d.ts +0 -12
- package/dist/src/lifecycle/phase-start-server.d.ts +0 -11
- package/dist/src/lifecycle/phase-validate-config.d.ts +0 -9
- package/dist/src/lifecycle/phase-validate-upstream.d.ts +0 -11
- package/dist/src/lifecycle/phase-wire-handlers.d.ts +0 -12
- package/dist/src/lifecycle/safe-restart.d.ts +0 -99
- package/dist/src/logger.d.ts +0 -14
- package/dist/src/mcp/bridge.d.ts +0 -21
- package/dist/src/mcp/index.d.ts +0 -2
- package/dist/src/models.d.ts +0 -68
- package/dist/src/observability/event-bus.d.ts +0 -86
- package/dist/src/observability/get-event-bus.d.ts +0 -25
- package/dist/src/observability/observability-service.d.ts +0 -19
- package/dist/src/observability/perf-telemetry.d.ts +0 -65
- package/dist/src/observability/subscribers/metrics.d.ts +0 -11
- package/dist/src/observability/subscribers/session-capture.d.ts +0 -15
- package/dist/src/openai-compat/autonomy-rule.d.ts +0 -26
- package/dist/src/openai-compat/bridges/allowlist.d.ts +0 -19
- package/dist/src/openai-compat/bridges/factory.d.ts +0 -30
- package/dist/src/openai-compat/bridges/media-bridge.d.ts +0 -34
- package/dist/src/openai-compat/bridges/openclaw-api-shim.d.ts +0 -54
- package/dist/src/openai-compat/bridges/openclaw-native-tools.d.ts +0 -61
- package/dist/src/openai-compat/bridges/openclaw-tool-registry.d.ts +0 -26
- package/dist/src/openai-compat/bridges/tts-media-bridge.d.ts +0 -19
- package/dist/src/openai-compat/chat-cwd.d.ts +0 -22
- package/dist/src/openai-compat/cli-stream-parser.d.ts +0 -134
- package/dist/src/openai-compat/index.d.ts +0 -1
- package/dist/src/openai-compat/message-extractor.d.ts +0 -84
- package/dist/src/openai-compat/mode-flags.d.ts +0 -34
- package/dist/src/openai-compat/non-streaming-handler.d.ts +0 -29
- package/dist/src/openai-compat/openai-chunk-types.d.ts +0 -35
- package/dist/src/openai-compat/openai-compat.d.ts +0 -49
- package/dist/src/openai-compat/openai-types.d.ts +0 -71
- package/dist/src/openai-compat/parse-route-body.d.ts +0 -24
- package/dist/src/openai-compat/prompts.d.ts +0 -47
- package/dist/src/openai-compat/request-coalescer.d.ts +0 -77
- package/dist/src/openai-compat/response-formatter.d.ts +0 -33
- package/dist/src/openai-compat/session-key-resolver.d.ts +0 -41
- package/dist/src/openai-compat/skill-resolver.d.ts +0 -59
- package/dist/src/openai-compat/sse-translator.d.ts +0 -51
- package/dist/src/openai-compat/status-reporter.d.ts +0 -30
- package/dist/src/openai-compat/streaming-handler.d.ts +0 -52
- package/dist/src/openai-compat/tool-calls-parser.d.ts +0 -34
- package/dist/src/openai-compat/tool-results-serializer.d.ts +0 -60
- package/dist/src/openai-compat/tts-rule.d.ts +0 -20
- package/dist/src/openai-compat/voice-recovery.d.ts +0 -56
- package/dist/src/patches/cache-parity-registry.d.ts +0 -103
- package/dist/src/patches/claude-md-injection.d.ts +0 -10
- package/dist/src/patches/cwd-redirect.d.ts +0 -10
- package/dist/src/patches/embedded-server-route.d.ts +0 -23
- package/dist/src/patches/pricing-overrides.d.ts +0 -10
- package/dist/src/patches/resume-registry-restore.d.ts +0 -11
- package/dist/src/patches/session-pid-tracking.d.ts +0 -10
- package/dist/src/patches/sysprompt-strip.d.ts +0 -46
- package/dist/src/patches/tools-restoration.d.ts +0 -12
- package/dist/src/persistence/migration-v0.d.ts +0 -24
- package/dist/src/persistence/session-registry.d.ts +0 -58
- package/dist/src/proxy/anthropic-adapter.d.ts +0 -136
- package/dist/src/proxy/handler.d.ts +0 -39
- package/dist/src/proxy/index.d.ts +0 -4
- package/dist/src/proxy/schema-cleaner.d.ts +0 -11
- package/dist/src/proxy/thought-cache.d.ts +0 -19
- package/dist/src/session/embedded-server.d.ts +0 -25
- package/dist/src/session/inbox-manager.d.ts +0 -38
- package/dist/src/session/index.d.ts +0 -3
- package/dist/src/session/persisted-sessions.d.ts +0 -50
- package/dist/src/session/session-manager.d.ts +0 -247
- package/dist/src/session/watchdogs.d.ts +0 -92
- package/dist/src/session-bootstrap/boot-self-heal.d.ts +0 -32
- package/dist/src/session-bootstrap/cwd-patch.d.ts +0 -50
- package/dist/src/session-bootstrap/index.d.ts +0 -3
- package/dist/src/session-bootstrap/resume-registry.d.ts +0 -27
- package/dist/src/session-bootstrap/session-hygiene.d.ts +0 -23
- package/dist/src/session-bootstrap/sysprompt-strip.d.ts +0 -24
- package/dist/src/session-bootstrap/think-conflict-resolver.d.ts +0 -32
- package/dist/src/types/route.d.ts +0 -11
- package/dist/src/types/runtime-config.d.ts +0 -208
- package/dist/src/types/sse.d.ts +0 -29
- package/dist/src/types/tool-bridge.d.ts +0 -82
- package/dist/src/types/upstream.d.ts +0 -580
- package/dist/src/types.d.ts +0 -498
- package/dist/src/validation.d.ts +0 -31
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PatchManifest — declarative registry for prototype-patch specs.
|
|
3
|
-
*
|
|
4
|
-
* Each PatchSpec declares:
|
|
5
|
-
* - expectedShape: synchronous probe (signature / property existence)
|
|
6
|
-
* - expectedBehavior: async runtime probe (tiny smoke test)
|
|
7
|
-
* - install / uninstall: the actual mutation
|
|
8
|
-
*
|
|
9
|
-
* Boot phase 3 calls validate() — runs ALL probes.
|
|
10
|
-
* If ANY fail, throws DriftError listing every failing spec.
|
|
11
|
-
* Boot is refused; nothing is installed. No silent no-ops.
|
|
12
|
-
*
|
|
13
|
-
* Boot phase 4 calls install() — installs ALL specs atomically
|
|
14
|
-
* (i.e. only after validate() has passed).
|
|
15
|
-
*/
|
|
16
|
-
export interface PatchSpec<T = unknown> {
|
|
17
|
-
/** Stable identifier used in drift reports and mutation tests. */
|
|
18
|
-
id: string;
|
|
19
|
-
/** e.g. "claude-code/dist/session/SessionManager" — informational */
|
|
20
|
-
targetModule: string;
|
|
21
|
-
/** e.g. "SessionManager.prototype.startSession" — informational */
|
|
22
|
-
targetSymbol: string;
|
|
23
|
-
/**
|
|
24
|
-
* Resolve the live target. Called once per probe + install operation.
|
|
25
|
-
* Each spec resolves its own target — different specs target different
|
|
26
|
-
* upstream symbols, so a single global target is the wrong abstraction.
|
|
27
|
-
*
|
|
28
|
-
* **Async-compatible** (since Phase E#3 architectural finding 2026-05-13):
|
|
29
|
-
* may return `T` directly OR a `Promise<T>`. ESM upstream packages with
|
|
30
|
-
* top-level await (e.g. `openclaw`) cannot be loaded via sync `require()`;
|
|
31
|
-
* they require `await import()`. PatchManifest awaits the return value
|
|
32
|
-
* uniformly. Per PRP §3.2 G1.
|
|
33
|
-
*/
|
|
34
|
-
resolve: () => T | Promise<T>;
|
|
35
|
-
/**
|
|
36
|
-
* Synchronous shape probe. Returns true when the symbol exists with the
|
|
37
|
-
* expected signature (property count, method name, etc.).
|
|
38
|
-
* Must NOT mutate the target.
|
|
39
|
-
*/
|
|
40
|
-
expectedShape: (target: T) => boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Async behavior probe. Returns true when a minimal smoke invocation
|
|
43
|
-
* demonstrates the expected behavior contract.
|
|
44
|
-
* Must NOT mutate the target; must be fast (<100ms).
|
|
45
|
-
*/
|
|
46
|
-
expectedBehavior: (target: T) => Promise<boolean>;
|
|
47
|
-
/**
|
|
48
|
-
* Apply the patch. Called only after validate() passes for all specs.
|
|
49
|
-
*/
|
|
50
|
-
install: (target: T) => void;
|
|
51
|
-
/**
|
|
52
|
-
* Revert the patch. Called on emergency rollback or unload.
|
|
53
|
-
*/
|
|
54
|
-
uninstall: (target: T) => void;
|
|
55
|
-
}
|
|
56
|
-
export declare class PatchManifest {
|
|
57
|
-
private readonly specs;
|
|
58
|
-
private installed;
|
|
59
|
-
/**
|
|
60
|
-
* Register a PatchSpec. Order of registration determines install order.
|
|
61
|
-
* Idempotent on same id — re-registering the same id is a no-op.
|
|
62
|
-
*/
|
|
63
|
-
register<T = unknown>(spec: PatchSpec<T>): void;
|
|
64
|
-
/**
|
|
65
|
-
* Boot phase 3: run ALL expectedShape + expectedBehavior probes.
|
|
66
|
-
* If any fail, throws DriftError listing ALL failures.
|
|
67
|
-
* Never installs on probe failure.
|
|
68
|
-
*/
|
|
69
|
-
validate(): Promise<void>;
|
|
70
|
-
/**
|
|
71
|
-
* Boot phase 4: install ALL specs.
|
|
72
|
-
* Must only be called after validate() passes (enforced by Boot orchestrator).
|
|
73
|
-
*/
|
|
74
|
-
install(): Promise<void>;
|
|
75
|
-
/**
|
|
76
|
-
* Emergency rollback — uninstalls in reverse registration order.
|
|
77
|
-
*/
|
|
78
|
-
uninstall(): Promise<void>;
|
|
79
|
-
get isInstalled(): boolean;
|
|
80
|
-
get size(): number;
|
|
81
|
-
ids(): string[];
|
|
82
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 2 — import-upstream
|
|
3
|
-
*
|
|
4
|
-
* Dynamically imports the "openclaw" package and returns its namespace as
|
|
5
|
-
* `unknown`. Zero `any`. The caller (boot.ts / phase 3) is responsible for
|
|
6
|
-
* narrowing the shape via PatchManifest.validate().
|
|
7
|
-
*
|
|
8
|
-
* Using a variable-held specifier prevents tsc from attempting static
|
|
9
|
-
* resolution of the peer-dependency at build time (same pattern as doctor.ts
|
|
10
|
-
* check_bridge_wiring).
|
|
11
|
-
*/
|
|
12
|
-
export declare function importUpstream(): Promise<unknown>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 4 — install-patches
|
|
3
|
-
*
|
|
4
|
-
* Calls manifest.install() atomically — only reached after phase 3
|
|
5
|
-
* (validate-upstream) passes. All probes have already confirmed the
|
|
6
|
-
* expected shape; install proceeds without further checks.
|
|
7
|
-
*
|
|
8
|
-
* On any install error, attempts manifest.uninstall() as best-effort rollback
|
|
9
|
-
* before re-throwing so boot fails loud.
|
|
10
|
-
*/
|
|
11
|
-
import type { PatchManifest } from './patch-manifest.js';
|
|
12
|
-
export declare function installPatches(manifest: PatchManifest, _upstreamNs: unknown): Promise<void>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 7 — schedule-jobs
|
|
3
|
-
*
|
|
4
|
-
* Sets up recurring background tasks (stub):
|
|
5
|
-
* - SessionRegistry.snapshot() on a configurable interval (default 5 min)
|
|
6
|
-
* - Stalled-session watchdog timer
|
|
7
|
-
* - Runaway-loop watchdog
|
|
8
|
-
*
|
|
9
|
-
* Phase E wires real timers here.
|
|
10
|
-
*/
|
|
11
|
-
import type { SessionRegistry } from '../persistence/session-registry.js';
|
|
12
|
-
export declare function scheduleJobs(_registry: SessionRegistry): void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 6 — start-server
|
|
3
|
-
*
|
|
4
|
-
* Starts the openai-compat HTTP server (stub).
|
|
5
|
-
* Phase E wires the real server instantiation here.
|
|
6
|
-
*/
|
|
7
|
-
export interface StartServerOptions {
|
|
8
|
-
/** Port the openai-compat HTTP server listens on. Default: 18796. */
|
|
9
|
-
port?: number;
|
|
10
|
-
}
|
|
11
|
-
export declare function startServer(_opts?: StartServerOptions): Promise<void>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 1 — validate-config
|
|
3
|
-
*
|
|
4
|
-
* Calls ConfigSchema.parse(loadConfigSources()).
|
|
5
|
-
* Throws ConfigInvalid (wrapping zod issues) on failure.
|
|
6
|
-
* Boot refuses with a phase-keyed message.
|
|
7
|
-
*/
|
|
8
|
-
import { type Config } from '../config/schema.js';
|
|
9
|
-
export declare function validateConfig(): Config;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 3 — validate-upstream
|
|
3
|
-
*
|
|
4
|
-
* Runs PatchManifest.validate() against the imported upstream namespace.
|
|
5
|
-
* Re-throws validation failures as DriftError (already typed by PatchManifest).
|
|
6
|
-
*
|
|
7
|
-
* Boot refuses and surfaces a drift report if ANY probe fails.
|
|
8
|
-
* install() is NEVER called from this phase — that is phase 4.
|
|
9
|
-
*/
|
|
10
|
-
import type { PatchManifest } from './patch-manifest.js';
|
|
11
|
-
export declare function validateUpstream(manifest: PatchManifest, _upstreamNs: unknown): Promise<void>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 5 — wire-handlers
|
|
3
|
-
*
|
|
4
|
-
* Registers EventBus subscribers BEFORE the server starts accepting traffic
|
|
5
|
-
* (phase 6). This ordering closes the v0.6.0 subscription-vs-traffic race
|
|
6
|
-
* where SessionCaptureSubscriber missed early session events.
|
|
7
|
-
*
|
|
8
|
-
* Phase E wires the real subscribers (SessionCaptureSubscriber, MetricsSubscriber).
|
|
9
|
-
* This scaffold calls ObservabilityService.init(bus) which registers stubs.
|
|
10
|
-
*/
|
|
11
|
-
import type { EventBus } from '../observability/event-bus.js';
|
|
12
|
-
export declare function wireHandlers(bus: EventBus): void;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* safe-restart — in-process gateway restart that preserves the current
|
|
3
|
-
* Telegram session.
|
|
4
|
-
*
|
|
5
|
-
* Pre-Execution Decision (PRP_v2 §Pre-Execution Decisions, locked):
|
|
6
|
-
* Path: --safe-current-session flag (in-process).
|
|
7
|
-
* Rationale: avoids tmux zombie risk (Risk Register row 3); cleaner state
|
|
8
|
-
* model; tmux-detach remains available as a secondary path (v0.17 deferred).
|
|
9
|
-
*
|
|
10
|
-
* Usage (programmatic):
|
|
11
|
-
* const restart = new SafeRestart({ sessionId: 'my-session' });
|
|
12
|
-
* const result = await restart.run();
|
|
13
|
-
*
|
|
14
|
-
* Usage (CLI flag):
|
|
15
|
-
* cc-openclaw --safe-current-session [--session-id <id>]
|
|
16
|
-
* Parsed in src/cli/index.ts and forwarded here.
|
|
17
|
-
*
|
|
18
|
-
* Self-survival contract:
|
|
19
|
-
* When OpenClaw triggers a gateway restart while a Telegram session is
|
|
20
|
-
* active, the session must NOT fire a sub-agent "self-survival" turn. This
|
|
21
|
-
* module registers a SIGTERM handler that:
|
|
22
|
-
* 1. Flushes in-flight state (EventBus drain-wait up to FLUSH_TIMEOUT_MS).
|
|
23
|
-
* 2. Marks the named session as restart-pending in the session registry.
|
|
24
|
-
* 3. Emits a 'safe-restart.initiated' telemetry event.
|
|
25
|
-
* 4. Returns "in-process" — the gateway respawner picks this signal up and
|
|
26
|
-
* skips the self-survival sub-agent path.
|
|
27
|
-
*
|
|
28
|
-
* SecondaryPath — tmux-detach:
|
|
29
|
-
* See scripts/gateway-detach.sh. NOT the default per locked decision above.
|
|
30
|
-
* SafeRestart.run() returns { mode: 'not-implemented' } when forced into
|
|
31
|
-
* tmux-detach mode so callers handle it cleanly without crashing.
|
|
32
|
-
*/
|
|
33
|
-
import { EventBus } from '../observability/event-bus.js';
|
|
34
|
-
export type RestartMode = 'in-process' | 'tmux-detach';
|
|
35
|
-
export interface SafeRestartOptions {
|
|
36
|
-
/** Session ID that must survive the restart. */
|
|
37
|
-
sessionId: string;
|
|
38
|
-
/**
|
|
39
|
-
* Restart mode. Defaults to 'in-process' per locked PRP_v2 decision.
|
|
40
|
-
* 'tmux-detach' is a stub that returns { mode: 'not-implemented' }.
|
|
41
|
-
*/
|
|
42
|
-
mode?: RestartMode;
|
|
43
|
-
/** EventBus to emit telemetry events. If omitted, a private bus is used. */
|
|
44
|
-
bus?: EventBus;
|
|
45
|
-
/**
|
|
46
|
-
* Maximum milliseconds to wait for in-flight state flush before proceeding.
|
|
47
|
-
* Default: 2000.
|
|
48
|
-
*/
|
|
49
|
-
flushTimeoutMs?: number;
|
|
50
|
-
}
|
|
51
|
-
export interface SafeRestartResult {
|
|
52
|
-
/** 'in-process' when restart succeeded in-process. */
|
|
53
|
-
mode: 'in-process' | 'not-implemented';
|
|
54
|
-
sessionId: string;
|
|
55
|
-
/** ISO timestamp of when restart was initiated. */
|
|
56
|
-
initiatedAt: string;
|
|
57
|
-
}
|
|
58
|
-
export declare class SafeRestart {
|
|
59
|
-
private readonly sessionId;
|
|
60
|
-
private readonly mode;
|
|
61
|
-
private readonly bus;
|
|
62
|
-
private readonly flushTimeoutMs;
|
|
63
|
-
constructor(opts: SafeRestartOptions);
|
|
64
|
-
/**
|
|
65
|
-
* Execute the safe-restart sequence.
|
|
66
|
-
*
|
|
67
|
-
* In-process path:
|
|
68
|
-
* 1. Wait up to flushTimeoutMs for in-flight state to drain.
|
|
69
|
-
* 2. Emit 'safe-restart.initiated' telemetry.
|
|
70
|
-
* 3. Return { mode: 'in-process', ... }.
|
|
71
|
-
*
|
|
72
|
-
* Tmux-detach path:
|
|
73
|
-
* Returns { mode: 'not-implemented', ... } — deferred to v0.17.
|
|
74
|
-
* See scripts/gateway-detach.sh for the secondary path stub.
|
|
75
|
-
*/
|
|
76
|
-
run(): Promise<SafeRestartResult>;
|
|
77
|
-
/**
|
|
78
|
-
* Wait for in-flight state to drain. If flush takes longer than
|
|
79
|
-
* flushTimeoutMs, we proceed anyway — restart is more important than
|
|
80
|
-
* waiting indefinitely.
|
|
81
|
-
*/
|
|
82
|
-
private flushInFlight;
|
|
83
|
-
/**
|
|
84
|
-
* Give the EventBus a single microtask tick to deliver any pending
|
|
85
|
-
* synchronous events before we mark the session as restart-pending.
|
|
86
|
-
*/
|
|
87
|
-
private drainEventBus;
|
|
88
|
-
private emitTelemetry;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Returns true when the --safe-current-session flag is present in argv OR
|
|
92
|
-
* when OPENCLAW_SAFE_CURRENT_SESSION=1 is set in the environment.
|
|
93
|
-
* Used by src/cli/index.ts to decide whether to run the safe-restart path.
|
|
94
|
-
*/
|
|
95
|
-
export declare function isSafeCurrentSessionRequested(argv?: string[]): boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Parse --session-id <value> from argv. Returns undefined when not present.
|
|
98
|
-
*/
|
|
99
|
-
export declare function parseSessionIdFromArgv(argv?: string[]): string | undefined;
|
package/dist/src/logger.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Structured logging interface with level control.
|
|
3
|
-
*
|
|
4
|
-
* Default implementation logs to console, filtered by OPENCLAW_LOG_LEVEL env var.
|
|
5
|
-
* Valid levels: debug, info, warn, error. Default: info.
|
|
6
|
-
*/
|
|
7
|
-
export interface Logger {
|
|
8
|
-
debug(msg: string, ...args: unknown[]): void;
|
|
9
|
-
info(msg: string, ...args: unknown[]): void;
|
|
10
|
-
warn(msg: string, ...args: unknown[]): void;
|
|
11
|
-
error(msg: string, ...args: unknown[]): void;
|
|
12
|
-
}
|
|
13
|
-
/** Create a console-backed logger with optional prefix and env-var level control. */
|
|
14
|
-
export declare function createConsoleLogger(prefix?: string): Logger;
|
package/dist/src/mcp/bridge.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface PluginApi {
|
|
2
|
-
on(event: string, handler: (...args: unknown[]) => unknown): void;
|
|
3
|
-
logger?: Console;
|
|
4
|
-
}
|
|
5
|
-
export declare class McpBridge {
|
|
6
|
-
private child;
|
|
7
|
-
start(): void;
|
|
8
|
-
stop(): Promise<void>;
|
|
9
|
-
isRunning(): boolean;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Passive registration: validate the sidecar binary is present at the
|
|
13
|
-
* expected bundled path. No event hooks. No process spawning.
|
|
14
|
-
*
|
|
15
|
-
* Returns the resolved sidecar path so callers (or tests) can probe it.
|
|
16
|
-
*/
|
|
17
|
-
export declare function register(api: PluginApi): {
|
|
18
|
-
sidecarPath: string;
|
|
19
|
-
sidecarExists: boolean;
|
|
20
|
-
};
|
|
21
|
-
export declare function _resetRegisteredForTests(): void;
|
package/dist/src/mcp/index.d.ts
DELETED
package/dist/src/models.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centralized Model Registry — single source of truth for all model metadata.
|
|
3
|
-
*
|
|
4
|
-
* Every model definition lives here. All other files derive from this registry.
|
|
5
|
-
* To add a model: add one entry to MODELS[]. Everything else auto-generates.
|
|
6
|
-
*/
|
|
7
|
-
import type { EngineType } from './types.js';
|
|
8
|
-
export type ProviderName = 'anthropic' | 'openai' | 'google' | 'cursor' | 'custom';
|
|
9
|
-
export interface ModelPricing {
|
|
10
|
-
input: number;
|
|
11
|
-
output: number;
|
|
12
|
-
cached?: number;
|
|
13
|
-
}
|
|
14
|
-
interface ModelDef {
|
|
15
|
-
/** Canonical model ID, e.g. 'claude-opus-4-6' */
|
|
16
|
-
id: string;
|
|
17
|
-
/** Which CLI engine to use */
|
|
18
|
-
engine: EngineType;
|
|
19
|
-
/** Upstream provider for API routing */
|
|
20
|
-
provider: ProviderName;
|
|
21
|
-
/** Token pricing */
|
|
22
|
-
pricing: ModelPricing;
|
|
23
|
-
/** Short aliases that resolve to this model */
|
|
24
|
-
aliases?: string[];
|
|
25
|
-
/** Whether to expose in /v1/models (default: true) */
|
|
26
|
-
listed?: boolean;
|
|
27
|
-
/** Context window size in tokens */
|
|
28
|
-
contextWindow?: number;
|
|
29
|
-
}
|
|
30
|
-
/** Resolve alias → canonical id. Returns the input unchanged if not an alias. */
|
|
31
|
-
export declare function resolveAlias(alias: string): string;
|
|
32
|
-
/** Resolve model string to engine + canonical model. Pattern fallback for unknown models. */
|
|
33
|
-
export declare function resolveEngineAndModel(model: string): {
|
|
34
|
-
engine: EngineType;
|
|
35
|
-
model: string;
|
|
36
|
-
};
|
|
37
|
-
/** Resolve model string to provider + API model name. Used by proxy handler. */
|
|
38
|
-
export declare function resolveProvider(model: string): {
|
|
39
|
-
provider: ProviderName;
|
|
40
|
-
apiModel: string;
|
|
41
|
-
};
|
|
42
|
-
/** Get context window size for a model. Returns 200k default for unknown models. */
|
|
43
|
-
export declare function getContextWindow(model: string): number;
|
|
44
|
-
/** Get pricing for a model. Falls back to sonnet pricing for unknown models. */
|
|
45
|
-
export declare function getModelPricing(model?: string, defaultModel?: string): ModelPricing;
|
|
46
|
-
export declare function overrideModelPricing(overrides: Record<string, Partial<ModelPricing>>): void;
|
|
47
|
-
/** Reset all pricing overrides (for testing). */
|
|
48
|
-
export declare function _resetPricingOverrides(): void;
|
|
49
|
-
/** Get /v1/models list — auto-generated from registry. */
|
|
50
|
-
export declare function getModelList(): {
|
|
51
|
-
object: string;
|
|
52
|
-
data: Array<{
|
|
53
|
-
id: string;
|
|
54
|
-
object: string;
|
|
55
|
-
owned_by: string;
|
|
56
|
-
}>;
|
|
57
|
-
};
|
|
58
|
-
/** Get all model aliases as a Record (backward compat). */
|
|
59
|
-
export declare function getAliases(): Record<string, string>;
|
|
60
|
-
/** Check if a model string is a Gemini model. */
|
|
61
|
-
export declare function isGeminiModel(model: string): boolean;
|
|
62
|
-
/** Check if a model string is a Claude model. */
|
|
63
|
-
export declare function isClaudeModel(model: string): boolean;
|
|
64
|
-
/** Rough token estimate: ~4 chars per token. */
|
|
65
|
-
export declare function estimateTokens(text: string): number;
|
|
66
|
-
/** Resolve a model string to its full definition. Throws for unknown models. */
|
|
67
|
-
export declare function lookupModelStrict(idOrAlias: string): ModelDef;
|
|
68
|
-
export {};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EventBus — typed event emitter replacing all globalThis.__openclaw_* Maps.
|
|
3
|
-
*
|
|
4
|
-
* Contract (PRP §3.2 G4):
|
|
5
|
-
* - on<K>(event, listener) returns an unsubscribe function (no EventEmitter leak)
|
|
6
|
-
* - emit<K>(event, payload) is synchronous; delivery <1ms target
|
|
7
|
-
* - Subscribers wired in boot phase 5 BEFORE traffic (phase 6 start-server)
|
|
8
|
-
*
|
|
9
|
-
* EventMap keys use dot-notation: "session.started", "boot.ready", etc.
|
|
10
|
-
* Adding a new event requires only a type entry here — no subclass needed.
|
|
11
|
-
*/
|
|
12
|
-
import type { Config } from '../config/schema.js';
|
|
13
|
-
type SessionName = string & {
|
|
14
|
-
readonly __brand: 'SessionName';
|
|
15
|
-
};
|
|
16
|
-
export type EventMap = {
|
|
17
|
-
/** Emitted when a Claude CLI session subprocess starts. `pid` is `null`
|
|
18
|
-
* when the underlying ISession adapter doesn't expose a process id yet. */
|
|
19
|
-
'session.started': {
|
|
20
|
-
name: SessionName;
|
|
21
|
-
pid: number | null;
|
|
22
|
-
};
|
|
23
|
-
/** Emitted when a session subprocess exits cleanly. */
|
|
24
|
-
'session.completed': {
|
|
25
|
-
name: SessionName;
|
|
26
|
-
tokens: number;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Emitted when a session subprocess closes outside an explicit stop() —
|
|
30
|
-
* v0.14.1 root-cause observability for the stale-session class of bugs.
|
|
31
|
-
* `code` is the OS exit code (null when killed by signal). The reaper in
|
|
32
|
-
* SessionManager.sendMessage restarts the subprocess on the next turn.
|
|
33
|
-
*/
|
|
34
|
-
'session.died': {
|
|
35
|
-
name: SessionName;
|
|
36
|
-
code: number | null;
|
|
37
|
-
};
|
|
38
|
-
/** Emitted on every tool_use event within a session turn. */
|
|
39
|
-
'session.tool-use': {
|
|
40
|
-
name: SessionName;
|
|
41
|
-
tool: string;
|
|
42
|
-
input: unknown;
|
|
43
|
-
};
|
|
44
|
-
/** Emitted after PatchManifest.install() succeeds for a single spec. */
|
|
45
|
-
'patch.installed': {
|
|
46
|
-
id: string;
|
|
47
|
-
};
|
|
48
|
-
/** Emitted when a PatchSpec probe fails during validate-upstream. */
|
|
49
|
-
'patch.drift': {
|
|
50
|
-
id: string;
|
|
51
|
-
expected: string;
|
|
52
|
-
actual: string;
|
|
53
|
-
};
|
|
54
|
-
/** Emitted at the end of a successful 7-phase boot. */
|
|
55
|
-
'boot.ready': {
|
|
56
|
-
config: Config;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Emitted by cache-parity-registry when a namespace mismatch is detected
|
|
60
|
-
* and automatically self-recovered (task-005, v0.16).
|
|
61
|
-
* `namespace` is the mismatched key; `clearedBytes` is the size of the
|
|
62
|
-
* wiped local cache entry.
|
|
63
|
-
*/
|
|
64
|
-
'cache-parity.namespace-mismatch-recovered': {
|
|
65
|
-
namespace: string;
|
|
66
|
-
clearedBytes: number;
|
|
67
|
-
restartCycle: number;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
type Listener<K extends keyof EventMap> = (payload: EventMap[K]) => void;
|
|
71
|
-
export declare class EventBus {
|
|
72
|
-
private readonly listeners;
|
|
73
|
-
/**
|
|
74
|
-
* Subscribe to an event. Returns an unsubscribe function.
|
|
75
|
-
* Calling the returned function is idempotent.
|
|
76
|
-
*/
|
|
77
|
-
on<K extends keyof EventMap>(event: K, listener: Listener<K>): () => void;
|
|
78
|
-
/**
|
|
79
|
-
* Emit an event synchronously. All listeners receive the payload in
|
|
80
|
-
* registration order. Errors in listeners propagate to the caller.
|
|
81
|
-
*/
|
|
82
|
-
emit<K extends keyof EventMap>(event: K, payload: EventMap[K]): void;
|
|
83
|
-
/** Number of active listeners across all event keys. */
|
|
84
|
-
get listenerCount(): number;
|
|
85
|
-
}
|
|
86
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `getEventBus()` — process-wide singleton accessor for the EventBus.
|
|
3
|
-
*
|
|
4
|
-
* Phase E#5 (v0.12.0): the EventBus moves from scaffold to hot path. This
|
|
5
|
-
* module is the bootstrap seam: every hot-path callsite that emits a typed
|
|
6
|
-
* event imports this accessor instead of constructing its own EventBus.
|
|
7
|
-
*
|
|
8
|
-
* The singleton replaces the long-deprecated `globalThis.__openclaw_*` Map
|
|
9
|
-
* pattern. Listeners must be registered before traffic starts (boot phase 5
|
|
10
|
-
* per PRP §3.4); subscribers added later still work but may miss events
|
|
11
|
-
* fired during a race window.
|
|
12
|
-
*
|
|
13
|
-
* Test isolation: vitest unit tests can call `__resetEventBusForTests()` to
|
|
14
|
-
* drop all listeners between cases. Production code never calls it.
|
|
15
|
-
*/
|
|
16
|
-
import { EventBus } from './event-bus.js';
|
|
17
|
-
/**
|
|
18
|
-
* Returns the singleton EventBus. Lazy-initializes on first call.
|
|
19
|
-
*/
|
|
20
|
-
export declare function getEventBus(): EventBus;
|
|
21
|
-
/**
|
|
22
|
-
* Test-only helper. Drops the singleton so each test starts with zero
|
|
23
|
-
* listeners. Never call from production code.
|
|
24
|
-
*/
|
|
25
|
-
export declare function __resetEventBusForTests(): void;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ObservabilityService — composes EventBus + all subscribers.
|
|
3
|
-
*
|
|
4
|
-
* init(bus) is called in boot phase 5 (wire-handlers) before the server
|
|
5
|
-
* starts accepting traffic. This ordering closes the subscription-vs-traffic
|
|
6
|
-
* race that existed prior to v0.6.0.
|
|
7
|
-
*
|
|
8
|
-
* Phase E wires real subscriber logic; stubs here keep build green.
|
|
9
|
-
*/
|
|
10
|
-
import type { EventBus } from './event-bus.js';
|
|
11
|
-
export declare class ObservabilityService {
|
|
12
|
-
private readonly sessionCapture;
|
|
13
|
-
private readonly metrics;
|
|
14
|
-
/**
|
|
15
|
-
* Register all subscribers against the provided bus.
|
|
16
|
-
* Must be called before traffic is accepted (boot phase 5).
|
|
17
|
-
*/
|
|
18
|
-
init(bus: EventBus): void;
|
|
19
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Perf-baseline telemetry (M8 — cache-miss-telemetry).
|
|
3
|
-
*
|
|
4
|
-
* Appends structured perf events to `~/.openclaw/workspace/memory/sysprompt-cost.jsonl`
|
|
5
|
-
* alongside the existing token-cost records. Every record carries an `event`
|
|
6
|
-
* field so consumers can filter:
|
|
7
|
-
*
|
|
8
|
-
* - "token_cost" → legacy per-request sysprompt+user char/token estimate
|
|
9
|
-
* (emitted by cwd-patch.ts; tagged by this module on read).
|
|
10
|
-
* - "cache_check" → outcome of the Track-B cache parity decision: hit/miss
|
|
11
|
-
* with a structured `cause` (registry_empty | hash_mismatch
|
|
12
|
-
* | session_unknown | disabled). Drives idea #8.
|
|
13
|
-
* - "first_byte" → first user-visible content delta sent to the SSE client.
|
|
14
|
-
* `elapsed_ms` is measured from request receive (turnStartMs
|
|
15
|
-
* in streaming-handler.ts). This is the baseline for the
|
|
16
|
-
* plan's ≥50% p50 latency drop exit criterion.
|
|
17
|
-
* - "turn_end" → final SSE stop chunk written. `elapsed_ms` is total turn
|
|
18
|
-
* wall-clock. Pair with first_byte to derive generation-vs-
|
|
19
|
-
* latency split per turn.
|
|
20
|
-
*
|
|
21
|
-
* Flag: CC_OPENCLAW_PERF_CACHE_TELEMETRY (default ON; opt-out with 0/false/off).
|
|
22
|
-
* Goes through the same shim pattern as the legacy telemetry getters
|
|
23
|
-
* (ConfigService when present, env fallback for tests).
|
|
24
|
-
*
|
|
25
|
-
* Why same file as token_cost: the plan's verify query targets sysprompt-cost.jsonl
|
|
26
|
-
* directly; splitting would require operators to remember two paths and would
|
|
27
|
-
* break the single `jq` pipeline. The `event` field makes filtering trivial.
|
|
28
|
-
*/
|
|
29
|
-
type PerfEventName = 'cache_check' | 'first_byte' | 'turn_end';
|
|
30
|
-
type CacheCheckCause = 'hit' | 'warm_hash' | 'registry_empty' | 'hash_mismatch' | 'session_unknown' | 'disabled';
|
|
31
|
-
interface PerfEventBase {
|
|
32
|
-
event: PerfEventName;
|
|
33
|
-
sessionKey?: string;
|
|
34
|
-
}
|
|
35
|
-
interface CacheCheckEvent extends PerfEventBase {
|
|
36
|
-
event: 'cache_check';
|
|
37
|
-
outcome: 'hit' | 'miss';
|
|
38
|
-
cause: CacheCheckCause;
|
|
39
|
-
sysHash?: string;
|
|
40
|
-
}
|
|
41
|
-
interface FirstByteEvent extends PerfEventBase {
|
|
42
|
-
event: 'first_byte';
|
|
43
|
-
elapsed_ms: number;
|
|
44
|
-
model?: string;
|
|
45
|
-
tool_stream?: boolean;
|
|
46
|
-
}
|
|
47
|
-
interface TurnEndEvent extends PerfEventBase {
|
|
48
|
-
event: 'turn_end';
|
|
49
|
-
elapsed_ms: number;
|
|
50
|
-
first_byte_ms?: number;
|
|
51
|
-
finish_reason?: 'stop' | 'tool_calls' | 'length' | string;
|
|
52
|
-
tool_calls?: number;
|
|
53
|
-
bytes_out?: number;
|
|
54
|
-
}
|
|
55
|
-
export type PerfEvent = CacheCheckEvent | FirstByteEvent | TurnEndEvent;
|
|
56
|
-
/**
|
|
57
|
-
* Append a perf event to sysprompt-cost.jsonl. No-op when the flag is off
|
|
58
|
-
* or when an I/O error occurs — telemetry must never break a live turn.
|
|
59
|
-
*/
|
|
60
|
-
export declare function writePerfEvent(event: PerfEvent): void;
|
|
61
|
-
/** Test hook — replace the file-writing sink with an in-memory collector. */
|
|
62
|
-
export declare function _setPerfWriterForTests(w: (line: string) => void): void;
|
|
63
|
-
/** Test hook — restore the default file-writing sink. */
|
|
64
|
-
export declare function _restorePerfWriterForTests(): void;
|
|
65
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MetricsSubscriber — collects per-session token and timing metrics.
|
|
3
|
-
*
|
|
4
|
-
* Replaces globalThis.__openclaw_perfMap (AS2).
|
|
5
|
-
* Phase E wires real aggregation and exposes metrics via /enhancer/metrics.
|
|
6
|
-
* Stub body here.
|
|
7
|
-
*/
|
|
8
|
-
import type { EventBus } from '../event-bus.js';
|
|
9
|
-
export declare class MetricsSubscriber {
|
|
10
|
-
register(bus: EventBus): void;
|
|
11
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SessionCaptureSubscriber — replaces the 5s ultrareview poller (LP2).
|
|
3
|
-
*
|
|
4
|
-
* Wired in boot phase 5 (wire-handlers) BEFORE traffic starts.
|
|
5
|
-
* Phase E implements the real capture logic (writing to SessionRegistry WAL,
|
|
6
|
-
* updating live-card state, etc.). Stub body here.
|
|
7
|
-
*/
|
|
8
|
-
import type { EventBus } from '../event-bus.js';
|
|
9
|
-
export declare class SessionCaptureSubscriber {
|
|
10
|
-
/**
|
|
11
|
-
* Register listeners on the bus. Returns nothing; unsubscribe handles
|
|
12
|
-
* are held internally (Phase E: stored for clean shutdown).
|
|
13
|
-
*/
|
|
14
|
-
register(bus: EventBus): void;
|
|
15
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AUTONOMY_RULE — "act, don't ask" posture injected into the Savvy chat path.
|
|
3
|
-
*
|
|
4
|
-
* Why: the openai-compat (Telegram) path does not reliably load the owner's
|
|
5
|
-
* CLAUDE.md "Execute, don't discuss" rules (tmpdir CWD), so the model reverts to
|
|
6
|
-
* Claude's base posture of asking on ambiguous forks. Combined with a Telegram
|
|
7
|
-
* AskUserQuestion round-trip that silently drops answers, this made Savvy stall
|
|
8
|
-
* and require many prods to finish one task. This rule restores the terminal-CLI
|
|
9
|
-
* posture: decide and execute, complete the whole task in one turn.
|
|
10
|
-
*
|
|
11
|
-
* Gated by CC_OPENCLAW_AUTONOMY_RULE (default on; set '0' to disable). Prepended
|
|
12
|
-
* at the same injection points as TTS_RULE in openai-compat.ts so it lands in
|
|
13
|
-
* both the REPLACE (--system-prompt) and APPEND (--append-system-prompt) paths.
|
|
14
|
-
*
|
|
15
|
-
* Pure-string constant — no I/O, no module state.
|
|
16
|
-
*/
|
|
17
|
-
export declare const AUTONOMY_RULE: string;
|
|
18
|
-
/**
|
|
19
|
-
* Merge AskUserQuestion into a session's disallowedTools when suppression is on.
|
|
20
|
-
* The Telegram answer round-trip silently drops taps, so a question there stalls
|
|
21
|
-
* the turn — suppressing the tool is the hard guarantee behind AUTONOMY_RULE's
|
|
22
|
-
* "decide, do not ask" posture. Returns `prior` unchanged when suppression is
|
|
23
|
-
* off (so callers only set disallowedTools when there's something to set). Pure
|
|
24
|
-
* + dedup so it's unit-testable and idempotent across repeated session creates.
|
|
25
|
-
*/
|
|
26
|
-
export declare function withAskUserSuppressed(prior: string[] | undefined, suppress: boolean): string[] | undefined;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenClaw native tool allowList — typed-config-driven (Phase E #1, Q1 resolution).
|
|
3
|
-
*
|
|
4
|
-
* Reads from `ConfigService.config.nativeToolsAllowList` when available;
|
|
5
|
-
* falls back to the v0.11.x hardcoded default when `ConfigService` is unset
|
|
6
|
-
* (tests, scripts run without a boot path). The hardcoded fallback is
|
|
7
|
-
* intentionally identical to what shipped at v0.11.0 so existing tests that
|
|
8
|
-
* import `OPENCLAW_TOOL_ALLOWLIST` keep passing without rewrite.
|
|
9
|
-
*
|
|
10
|
-
* Env override: `CC_OPENCLAW_NATIVE_TOOLS_ALLOWLIST="message.voice,message.image,..."`.
|
|
11
|
-
* Q1 expanded default ships at v1.0.0-rc1 alongside the `CC_OPENCLAW_NATIVE_TOOLS=1` flip.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* v0.11.x default — kept exported for legacy callers and for the
|
|
15
|
-
* `ConfigService`-unset fallback path. New code should call `isAllowedTool`.
|
|
16
|
-
*/
|
|
17
|
-
export declare const OPENCLAW_TOOL_ALLOWLIST: ReadonlySet<string>;
|
|
18
|
-
/** Return true when `toolName` is in the active allowList. */
|
|
19
|
-
export declare function isAllowedTool(toolName: string): boolean;
|