@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.
- 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/engines/persistent-session.js +11 -0
- 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 +121 -9
- 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,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `cc-openclaw migrate` — legacy-persistence migration command (Q5 resolution).
|
|
3
|
-
*
|
|
4
|
-
* Default mode (no flag): READ-ONLY. Loads the four legacy JSON files into
|
|
5
|
-
* the new SessionRegistry's in-memory map, reports counts, exits 0. Legacy
|
|
6
|
-
* files remain untouched. Idempotent — safe to run repeatedly.
|
|
7
|
-
*
|
|
8
|
-
* `--commit`: DESTRUCTIVE. After successful read, deletes the four legacy
|
|
9
|
-
* files. The v1.0.0 release blocks on A1 running `--commit` on both laptops.
|
|
10
|
-
*
|
|
11
|
-
* `--dry-run`: synonym for default (no-flag) — emitted for parity with
|
|
12
|
-
* `openclaw doctor --fix` UX expectations. No deletion, no writes, only counts.
|
|
13
|
-
*/
|
|
14
|
-
import { Command } from 'commander';
|
|
15
|
-
export interface MigrateOptions {
|
|
16
|
-
commit?: boolean;
|
|
17
|
-
dryRun?: boolean;
|
|
18
|
-
}
|
|
19
|
-
export interface MigrateResult {
|
|
20
|
-
readonly migratedCount: number;
|
|
21
|
-
readonly committed: boolean;
|
|
22
|
-
readonly deletedFiles: ReadonlyArray<string>;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Pure function — runs the migration, returns counts. Splits the side-effects
|
|
26
|
-
* (file deletion + console output) from the read so the test surface stays clean.
|
|
27
|
-
*/
|
|
28
|
-
export declare function runMigrate(opts?: MigrateOptions): Promise<MigrateResult>;
|
|
29
|
-
export declare function createMigrateCommand(): Command;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* cc-handler — OpenClaw plugin (TypeScript port of savvy-claude-code/cc-handler.js)
|
|
3
|
-
*
|
|
4
|
-
* Intercepts /cc <prompt> messages from Telegram via the before_dispatch hook,
|
|
5
|
-
* launches a Claude Code session through SessionManager, and lets the existing
|
|
6
|
-
* telegram-ux-bridge handle live card delivery.
|
|
7
|
-
*
|
|
8
|
-
* Supports per-session chat targeting and continuation:
|
|
9
|
-
* /cc <prompt> — start a new Claude Code session
|
|
10
|
-
* /cc+ <prompt> — continue the last session in this chat
|
|
11
|
-
* /cc continue <prompt> — alternative continuation syntax
|
|
12
|
-
* /cc status — check active session for this chat
|
|
13
|
-
* /cc stop — stop the active session for this chat
|
|
14
|
-
* /cc resume [id|slug] — resume by session ID (8-char hex) or slug
|
|
15
|
-
* /cc list — show resumable sessions for this chat
|
|
16
|
-
*/
|
|
17
|
-
export interface PluginApi {
|
|
18
|
-
on(event: string, handler: (...args: unknown[]) => unknown | Promise<unknown>): void;
|
|
19
|
-
logger?: Console;
|
|
20
|
-
config?: {
|
|
21
|
-
plugins?: {
|
|
22
|
-
configs?: Record<string, Record<string, unknown>>;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
registerService(service: {
|
|
26
|
-
id: string;
|
|
27
|
-
start: () => Promise<void>;
|
|
28
|
-
stop: () => void;
|
|
29
|
-
}): void;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Parsed representation of a /cc command.
|
|
33
|
-
* subcommand: 'new' | 'continue' | 'stop' | 'resume' | 'status' | 'list'
|
|
34
|
-
* prompt: the user-supplied text (undefined for subcommands that take no prompt)
|
|
35
|
-
* target: optional id/slug for 'resume'
|
|
36
|
-
*/
|
|
37
|
-
export interface CcCommand {
|
|
38
|
-
subcommand: 'new' | 'continue' | 'stop' | 'resume' | 'status' | 'list';
|
|
39
|
-
prompt?: string;
|
|
40
|
-
target?: string;
|
|
41
|
-
}
|
|
42
|
-
export type ResumeBridge = (chatId: string, threadId: string | undefined, uuid: string) => string;
|
|
43
|
-
/**
|
|
44
|
-
* Parse a raw input string into a CcCommand.
|
|
45
|
-
* Returns null if the input is not a /cc or /cc+ command.
|
|
46
|
-
*
|
|
47
|
-
* Recognised forms:
|
|
48
|
-
* /cc+ <prompt> → { subcommand: 'continue', prompt }
|
|
49
|
-
* /cc <prompt> → { subcommand: 'new', prompt }
|
|
50
|
-
* /cc continue <prompt> → { subcommand: 'continue', prompt }
|
|
51
|
-
* /cc stop → { subcommand: 'stop' }
|
|
52
|
-
* /cc resume [id|slug] → { subcommand: 'resume', target? }
|
|
53
|
-
* /cc status → { subcommand: 'status' }
|
|
54
|
-
* /cc list → { subcommand: 'list' }
|
|
55
|
-
*/
|
|
56
|
-
export declare function parseCcCommand(input: string): CcCommand | null;
|
|
57
|
-
/**
|
|
58
|
-
* Register the cc-handler plugin with the OpenClaw API.
|
|
59
|
-
* Idempotent: subsequent calls are no-ops (prevents listener stacking).
|
|
60
|
-
*/
|
|
61
|
-
export declare function register(api: PluginApi): void;
|
|
62
|
-
declare const _default: {
|
|
63
|
-
id: string;
|
|
64
|
-
name: string;
|
|
65
|
-
register: typeof register;
|
|
66
|
-
};
|
|
67
|
-
export default _default;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* launch-policy — session persistence, slug helpers, and session map key.
|
|
3
|
-
*
|
|
4
|
-
* Extracted from cc-handler.ts (Step 2 of Phase 5 v0.11.0 decomposition).
|
|
5
|
-
* Data layer: types, constants, session index, session store, slug/ID generators.
|
|
6
|
-
* Launch/idle/recovery logic added in Step 3.
|
|
7
|
-
*/
|
|
8
|
-
export declare const DEFAULT_CWD = "/home/a1xai/.openclaw";
|
|
9
|
-
export interface SessionMeta {
|
|
10
|
-
id: string;
|
|
11
|
-
slug: string;
|
|
12
|
-
sessionName: string;
|
|
13
|
-
chatId: string;
|
|
14
|
-
threadId: string | undefined;
|
|
15
|
-
senderId: string;
|
|
16
|
-
state: 'starting' | 'running' | 'idle' | 'stopped' | 'failed' | 'interrupted' | 'timed_out';
|
|
17
|
-
instruction: string;
|
|
18
|
-
turns: number;
|
|
19
|
-
startedAt: string;
|
|
20
|
-
completedAt: string | null;
|
|
21
|
-
lastContinuedAt: string | null;
|
|
22
|
-
claudeSessionId: string | null;
|
|
23
|
-
cwd?: string;
|
|
24
|
-
output: string | null;
|
|
25
|
-
error: string | null;
|
|
26
|
-
}
|
|
27
|
-
export interface ActiveSession {
|
|
28
|
-
sessionName: string;
|
|
29
|
-
slug: string;
|
|
30
|
-
meta: SessionMeta;
|
|
31
|
-
idleTimer: ReturnType<typeof setTimeout> | null;
|
|
32
|
-
needsRehydration?: boolean;
|
|
33
|
-
}
|
|
34
|
-
export interface CcConfig {
|
|
35
|
-
claudeBin: string;
|
|
36
|
-
defaultPermissionMode: string;
|
|
37
|
-
defaultEffort: string;
|
|
38
|
-
maxConcurrentSessions: number;
|
|
39
|
-
sessionTtlMinutes: number;
|
|
40
|
-
}
|
|
41
|
-
export type SessionManagerLike = {
|
|
42
|
-
startSession(opts: Record<string, unknown>): Promise<void>;
|
|
43
|
-
stopSession(name: string): Promise<void>;
|
|
44
|
-
sendMessage(name: string, prompt: string, opts: Record<string, unknown>): Promise<{
|
|
45
|
-
output?: string;
|
|
46
|
-
sessionId?: string;
|
|
47
|
-
} | null>;
|
|
48
|
-
getStatus(name: string): unknown;
|
|
49
|
-
/** v0.6.0: in-place compaction via /compact slash command over stdin. */
|
|
50
|
-
compactSession?(name: string, summary?: string): Promise<void>;
|
|
51
|
-
shutdown(): Promise<void>;
|
|
52
|
-
};
|
|
53
|
-
export declare function makeSlug(instruction: string): string;
|
|
54
|
-
export declare function generateSessionId(): string;
|
|
55
|
-
export declare function sessionMapKey(chatId: string, threadId: string | undefined): string;
|
|
56
|
-
export declare function loadSessionIndex(): void;
|
|
57
|
-
export declare function saveSession(meta: SessionMeta): void;
|
|
58
|
-
export declare function loadSession(slug: string): SessionMeta | null;
|
|
59
|
-
export declare function loadSessionById(id: string): SessionMeta | null;
|
|
60
|
-
export declare function scanAllSessions(): SessionMeta[];
|
|
61
|
-
export declare const IDLE_TIMEOUT_MS: number;
|
|
62
|
-
export declare const ACK_TIMEOUT_MS = 5000;
|
|
63
|
-
export declare const RECOVERY_MAX_AGE_MS: number;
|
|
64
|
-
export interface PolicyDeps {
|
|
65
|
-
sessionManager: SessionManagerLike;
|
|
66
|
-
activeSessions: Map<string, ActiveSession>;
|
|
67
|
-
logger: Console;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Shared DispatchResult shape returned by every /cc subcommand handler.
|
|
71
|
-
* Defined here (not cc-handler.ts) so resume-policy.ts can import it without
|
|
72
|
-
* creating a cycle back into cc-handler.ts.
|
|
73
|
-
*/
|
|
74
|
-
export interface DispatchResult {
|
|
75
|
-
handled: boolean;
|
|
76
|
-
text: string;
|
|
77
|
-
_resolveAckId?: (id: number | null) => void;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Post-turn context-pressure check. See cc-handler.ts history for rationale.
|
|
81
|
-
* - At ≥ hard-reset threshold: stop session (recreated next turn).
|
|
82
|
-
* - At ≥ auto-compact threshold: fire-and-forget /compact with 60s cooldown.
|
|
83
|
-
*
|
|
84
|
-
* v0.20.0: both thresholds are env-overridable via
|
|
85
|
-
* `CC_OPENCLAW_HARD_RESET_THRESHOLD` and `CC_OPENCLAW_AUTO_COMPACT_THRESHOLD`.
|
|
86
|
-
* Setting either to `0` disables that behavior — matches direct CLI which
|
|
87
|
-
* never auto-compacts or auto-resets sessions.
|
|
88
|
-
*/
|
|
89
|
-
export declare function _postTurnContextCheck(deps: PolicyDeps, sessionName: string, chatId: string | null, threadId: string | undefined): Promise<void>;
|
|
90
|
-
export declare function launchSession(deps: PolicyDeps, sessionName: string, prompt: string, slug: string, meta: SessionMeta, chatId: string, threadId: string | undefined, ackIdPromise: Promise<number | null>): Promise<void>;
|
|
91
|
-
export declare function scheduleIdle(deps: PolicyDeps, key: string, active: ActiveSession): void;
|
|
92
|
-
export declare function recoverSessions(deps: PolicyDeps): void;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* resume-policy — /cc+ continuation, /cc resume, rehydrate, and turn-extension logic.
|
|
3
|
-
*
|
|
4
|
-
* Extracted from cc-handler.ts (Step 4 of Phase 5 v0.11.0 decomposition).
|
|
5
|
-
* Each public function takes PolicyDeps as its first argument per PRP §7 Q3.
|
|
6
|
-
* cc-handler.ts retains ownership of the sessionManager/activeSessions/logger
|
|
7
|
-
* singletons and threads them in via `_deps()` on every call.
|
|
8
|
-
*
|
|
9
|
-
* Callers MUST verify `sessionManager !== null` before constructing deps:
|
|
10
|
-
* PolicyDeps.sessionManager is typed non-null and these handlers assume it.
|
|
11
|
-
* The "Claude Code handler not ready — try again in a few seconds." response
|
|
12
|
-
* is now produced at the dispatcher in cc-handler.ts.
|
|
13
|
-
*/
|
|
14
|
-
import { type SessionMeta, type ActiveSession, type PolicyDeps, type DispatchResult } from './launch-policy.js';
|
|
15
|
-
export declare function handleContinuation(deps: PolicyDeps, prompt: string, chatId: string, threadId: string | undefined): DispatchResult;
|
|
16
|
-
export declare function handleResume(deps: PolicyDeps, chatId: string, threadId: string | undefined, targetSlug: string | null): DispatchResult;
|
|
17
|
-
export declare function rehydrateSession(deps: PolicyDeps, meta: SessionMeta, chatId: string, threadId: string | undefined): Promise<void>;
|
|
18
|
-
export declare function continueTurn(deps: PolicyDeps, active: ActiveSession, prompt: string, chatId: string, threadId: string | undefined, ackIdPromise: Promise<number | null>): Promise<void>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* turn-formatter — Telegram direct-send + observability formatting helpers.
|
|
3
|
-
*
|
|
4
|
-
* Extracted from cc-handler.ts (Step 1 of Phase 5 v0.11.0 decomposition).
|
|
5
|
-
* Contains: loadBotToken, telegramApiDirect, sendDirectReply,
|
|
6
|
-
* buildPhase2FlagsLine, buildObservabilityLines.
|
|
7
|
-
*/
|
|
8
|
-
export declare function loadBotToken(logger?: Console): void;
|
|
9
|
-
export declare function sendDirectReply(chatId: string, threadId: string | undefined, text: string, logger?: Console): Promise<number | null>;
|
|
10
|
-
/** Returns the current BOT_TOKEN (for callers that need to check if it's set). */
|
|
11
|
-
export declare function hasBotToken(): boolean;
|
|
12
|
-
export declare function buildPhase2FlagsLine(): string;
|
|
13
|
-
/**
|
|
14
|
-
* Pillar C v0.4.0 — compose observability lines for /cc status panel.
|
|
15
|
-
* Reads from Pillar A metrics, Pillar B trajectory tail, and status-tee
|
|
16
|
-
* quota snapshot. Each source is independently fault-tolerant: if one
|
|
17
|
-
* fails, the line shows "?" rather than crashing the panel.
|
|
18
|
-
*/
|
|
19
|
-
export declare function buildObservabilityLines(): string;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* loadConfigSources — reads env vars + ~/.openclaw/openclaw.json, returns a
|
|
3
|
-
* raw object for ConfigSchema.parse().
|
|
4
|
-
*
|
|
5
|
-
* Does NOT throw on missing files — caller receives defaults via zod.
|
|
6
|
-
* Throws ConfigInvalid only when ConfigSchema.parse() rejects (via boot phase 1).
|
|
7
|
-
*/
|
|
8
|
-
export declare function loadConfigSources(): Record<string, unknown>;
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ConfigSchema — zod-validated configuration for cc-openclaw.
|
|
3
|
-
*
|
|
4
|
-
* Mirrors PRP §3.2 G2 verbatim. Covers:
|
|
5
|
-
* - Top-level env-driven booleans (OPENCLAW_CC_OPENCLAW_ACTIVE, LISTENERS)
|
|
6
|
-
* - ccOpenclaw.* runtime knobs (native tools, watchdog timers, cache, TTS)
|
|
7
|
-
* - openclawJson.* fields cc-openclaw consumes from openclaw.json
|
|
8
|
-
*
|
|
9
|
-
* Q1 resolution: nativeTools.allowList defaults to the 5 approved tools.
|
|
10
|
-
* Q6 resolution: nativeTools.enabled defaults to true (v1.0.0-rc1 flip).
|
|
11
|
-
*/
|
|
12
|
-
import { z } from 'zod';
|
|
13
|
-
export declare const ConfigSchema: z.ZodObject<{
|
|
14
|
-
/**
|
|
15
|
-
* Master activation flag. Env: OPENCLAW_CC_OPENCLAW_ACTIVE.
|
|
16
|
-
* Missing on fresh laptops → silent gpt-5.4 fallback (BG7).
|
|
17
|
-
*/
|
|
18
|
-
openclawCcOpenclawActive: z.ZodDefault<z.ZodBoolean>;
|
|
19
|
-
/**
|
|
20
|
-
* Enables event-listener registration path. Env: OPENCLAW_CC_OPENCLAW_LISTENERS.
|
|
21
|
-
*/
|
|
22
|
-
openclawCcOpenclawListeners: z.ZodDefault<z.ZodBoolean>;
|
|
23
|
-
ccOpenclaw: z.ZodObject<{
|
|
24
|
-
nativeTools: z.ZodObject<{
|
|
25
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
26
|
-
/**
|
|
27
|
-
* Q1 — explicit allowlist, deny-by-default.
|
|
28
|
-
* NativeOpenClawToolsBridge.dispatch() throws DomainError.UnauthorizedTool on miss.
|
|
29
|
-
*/
|
|
30
|
-
allowList: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
31
|
-
}, "strip", z.ZodTypeAny, {
|
|
32
|
-
enabled: boolean;
|
|
33
|
-
allowList: string[];
|
|
34
|
-
}, {
|
|
35
|
-
enabled?: boolean | undefined;
|
|
36
|
-
allowList?: string[] | undefined;
|
|
37
|
-
}>;
|
|
38
|
-
/**
|
|
39
|
-
* Milliseconds before a stalled session subprocess is SIGTERMed.
|
|
40
|
-
* Env: CC_OPENCLAW_STALLED_KILL_MS. Default 180s per v0.10.0 watchdog.
|
|
41
|
-
* v0.20.0: `0` disables the watchdog entirely (matches direct CLI behavior).
|
|
42
|
-
*/
|
|
43
|
-
stalledKillMs: z.ZodDefault<z.ZodNumber>;
|
|
44
|
-
/**
|
|
45
|
-
* Maximum spawned subprocesses per 60s window before runaway-loop guard fires.
|
|
46
|
-
* Env: CC_OPENCLAW_LOOP_MAX_SUBPROCS. Default 3 per v0.10.1 watchdog.
|
|
47
|
-
* v0.20.0: `0` disables the refusal logic entirely. Upper bound relaxed to 1000.
|
|
48
|
-
*/
|
|
49
|
-
loopMaxSubprocs: z.ZodDefault<z.ZodNumber>;
|
|
50
|
-
/**
|
|
51
|
-
* Whether cache-parity Track B appendSystemPrompt + disk registry is active.
|
|
52
|
-
* Env: OPENCLAW_CACHE_PARITY.
|
|
53
|
-
*/
|
|
54
|
-
cacheParity: z.ZodDefault<z.ZodBoolean>;
|
|
55
|
-
/**
|
|
56
|
-
* TTS auto-injection mode. "tagged" = inject [[tts:text]] syntax rule only.
|
|
57
|
-
* Env: OPENCLAW_TTS_AUTO_MODE.
|
|
58
|
-
*/
|
|
59
|
-
ttsAutoMode: z.ZodDefault<z.ZodEnum<["off", "tagged", "always"]>>;
|
|
60
|
-
/**
|
|
61
|
-
* v0.20.2 — Live-card text-mirror opt-in (D7). Default OFF.
|
|
62
|
-
* Env: CC_OPENCLAW_LIVE_CARD_MIRROR.
|
|
63
|
-
*/
|
|
64
|
-
liveCardMirror: z.ZodDefault<z.ZodBoolean>;
|
|
65
|
-
/**
|
|
66
|
-
* v0.20.2 — Live-card text-mirror max-lines (D5). Clamped [5, 50].
|
|
67
|
-
* Env: CC_OPENCLAW_LIVE_CARD_MIRROR_LINES.
|
|
68
|
-
*/
|
|
69
|
-
liveCardMirrorLines: z.ZodDefault<z.ZodNumber>;
|
|
70
|
-
}, "strip", z.ZodTypeAny, {
|
|
71
|
-
nativeTools: {
|
|
72
|
-
enabled: boolean;
|
|
73
|
-
allowList: string[];
|
|
74
|
-
};
|
|
75
|
-
stalledKillMs: number;
|
|
76
|
-
loopMaxSubprocs: number;
|
|
77
|
-
cacheParity: boolean;
|
|
78
|
-
ttsAutoMode: "off" | "always" | "tagged";
|
|
79
|
-
liveCardMirror: boolean;
|
|
80
|
-
liveCardMirrorLines: number;
|
|
81
|
-
}, {
|
|
82
|
-
nativeTools: {
|
|
83
|
-
enabled?: boolean | undefined;
|
|
84
|
-
allowList?: string[] | undefined;
|
|
85
|
-
};
|
|
86
|
-
stalledKillMs?: number | undefined;
|
|
87
|
-
loopMaxSubprocs?: number | undefined;
|
|
88
|
-
cacheParity?: boolean | undefined;
|
|
89
|
-
ttsAutoMode?: "off" | "always" | "tagged" | undefined;
|
|
90
|
-
liveCardMirror?: boolean | undefined;
|
|
91
|
-
liveCardMirrorLines?: number | undefined;
|
|
92
|
-
}>;
|
|
93
|
-
openclawJson: z.ZodObject<{
|
|
94
|
-
/**
|
|
95
|
-
* fetchWithSsrFGuard timeout. Must be 900+ to survive multi-tool Telegram turns.
|
|
96
|
-
* Fix: feedback_cc_openclaw_provider_timeout.md
|
|
97
|
-
*/
|
|
98
|
-
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
99
|
-
messagesTts: z.ZodObject<{
|
|
100
|
-
/**
|
|
101
|
-
* Max ms before OpenClaw kills a TTS request. Schema cap 120 000 ms.
|
|
102
|
-
* Fix: feedback_openclaw_tts_timeout_chatterbox.md
|
|
103
|
-
*/
|
|
104
|
-
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
105
|
-
/**
|
|
106
|
-
* Max characters sent to Chatterbox per synthesis call.
|
|
107
|
-
*/
|
|
108
|
-
maxTextLength: z.ZodDefault<z.ZodNumber>;
|
|
109
|
-
}, "strip", z.ZodTypeAny, {
|
|
110
|
-
timeoutMs: number;
|
|
111
|
-
maxTextLength: number;
|
|
112
|
-
}, {
|
|
113
|
-
timeoutMs?: number | undefined;
|
|
114
|
-
maxTextLength?: number | undefined;
|
|
115
|
-
}>;
|
|
116
|
-
/**
|
|
117
|
-
* Ordered fallback chain. Last element must be "openai-codex/gpt-5.4" per
|
|
118
|
-
* feedback_cc_openclaw_cross_engine_fallback.md.
|
|
119
|
-
*/
|
|
120
|
-
fallbackChain: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
121
|
-
/**
|
|
122
|
-
* OpenClaw plugins.allow list. Must include "cc-openclaw".
|
|
123
|
-
* feedback_openclaw_plugins_allow_trumps.md.
|
|
124
|
-
*/
|
|
125
|
-
pluginsAllow: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
126
|
-
}, "strip", z.ZodTypeAny, {
|
|
127
|
-
timeoutSeconds: number;
|
|
128
|
-
messagesTts: {
|
|
129
|
-
timeoutMs: number;
|
|
130
|
-
maxTextLength: number;
|
|
131
|
-
};
|
|
132
|
-
fallbackChain: string[];
|
|
133
|
-
pluginsAllow: string[];
|
|
134
|
-
}, {
|
|
135
|
-
messagesTts: {
|
|
136
|
-
timeoutMs?: number | undefined;
|
|
137
|
-
maxTextLength?: number | undefined;
|
|
138
|
-
};
|
|
139
|
-
timeoutSeconds?: number | undefined;
|
|
140
|
-
fallbackChain?: string[] | undefined;
|
|
141
|
-
pluginsAllow?: string[] | undefined;
|
|
142
|
-
}>;
|
|
143
|
-
}, "strip", z.ZodTypeAny, {
|
|
144
|
-
openclawCcOpenclawActive: boolean;
|
|
145
|
-
openclawCcOpenclawListeners: boolean;
|
|
146
|
-
ccOpenclaw: {
|
|
147
|
-
nativeTools: {
|
|
148
|
-
enabled: boolean;
|
|
149
|
-
allowList: string[];
|
|
150
|
-
};
|
|
151
|
-
stalledKillMs: number;
|
|
152
|
-
loopMaxSubprocs: number;
|
|
153
|
-
cacheParity: boolean;
|
|
154
|
-
ttsAutoMode: "off" | "always" | "tagged";
|
|
155
|
-
liveCardMirror: boolean;
|
|
156
|
-
liveCardMirrorLines: number;
|
|
157
|
-
};
|
|
158
|
-
openclawJson: {
|
|
159
|
-
timeoutSeconds: number;
|
|
160
|
-
messagesTts: {
|
|
161
|
-
timeoutMs: number;
|
|
162
|
-
maxTextLength: number;
|
|
163
|
-
};
|
|
164
|
-
fallbackChain: string[];
|
|
165
|
-
pluginsAllow: string[];
|
|
166
|
-
};
|
|
167
|
-
}, {
|
|
168
|
-
ccOpenclaw: {
|
|
169
|
-
nativeTools: {
|
|
170
|
-
enabled?: boolean | undefined;
|
|
171
|
-
allowList?: string[] | undefined;
|
|
172
|
-
};
|
|
173
|
-
stalledKillMs?: number | undefined;
|
|
174
|
-
loopMaxSubprocs?: number | undefined;
|
|
175
|
-
cacheParity?: boolean | undefined;
|
|
176
|
-
ttsAutoMode?: "off" | "always" | "tagged" | undefined;
|
|
177
|
-
liveCardMirror?: boolean | undefined;
|
|
178
|
-
liveCardMirrorLines?: number | undefined;
|
|
179
|
-
};
|
|
180
|
-
openclawJson: {
|
|
181
|
-
messagesTts: {
|
|
182
|
-
timeoutMs?: number | undefined;
|
|
183
|
-
maxTextLength?: number | undefined;
|
|
184
|
-
};
|
|
185
|
-
timeoutSeconds?: number | undefined;
|
|
186
|
-
fallbackChain?: string[] | undefined;
|
|
187
|
-
pluginsAllow?: string[] | undefined;
|
|
188
|
-
};
|
|
189
|
-
openclawCcOpenclawActive?: boolean | undefined;
|
|
190
|
-
openclawCcOpenclawListeners?: boolean | undefined;
|
|
191
|
-
}>;
|
|
192
|
-
export type Config = z.infer<typeof ConfigSchema>;
|
package/dist/src/constants.d.ts
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared constants — consolidates magic numbers scattered across the codebase.
|
|
3
|
-
*
|
|
4
|
-
* Grouped by domain. Import what you need rather than using inline numbers.
|
|
5
|
-
*/
|
|
6
|
-
/** Token threshold that triggers the onContextHigh hook */
|
|
7
|
-
export declare const CONTEXT_HIGH_THRESHOLD = 140000;
|
|
8
|
-
/** Max history entries kept in memory per session (oldest evicted via shift) */
|
|
9
|
-
export declare const MAX_HISTORY_ITEMS = 100;
|
|
10
|
-
/** Default number of history entries returned by getHistory() */
|
|
11
|
-
export declare const DEFAULT_HISTORY_LIMIT = 50;
|
|
12
|
-
/** Number of history entries fetched for grep operations */
|
|
13
|
-
export declare const GREP_HISTORY_FETCH = 500;
|
|
14
|
-
/** Wait for session init/ready event after spawn */
|
|
15
|
-
export declare const SESSION_READY_TIMEOUT_MS = 30000;
|
|
16
|
-
/** Fallback delay before checking if proc is alive (resume path) */
|
|
17
|
-
export declare const SESSION_READY_FALLBACK_MS = 2000;
|
|
18
|
-
/** Default timeout for a send() / turn completion.
|
|
19
|
-
* v0.10.0: bumped 300_000 → 900_000 to align with the
|
|
20
|
-
* `models.providers.cc-openclaw.timeoutSeconds` outer envelope. The
|
|
21
|
-
* runtime stalled-session watchdog (STALLED_SESSION_KILL_MS) is the real
|
|
22
|
-
* ceiling for stuck subprocesses; this constant just prevents an internal
|
|
23
|
-
* per-turn timeout from firing before the outer wall and silently masking
|
|
24
|
-
* the stall as a "timeout" rather than a watchdog kill.
|
|
25
|
-
*
|
|
26
|
-
* v0.20.0: env-overridable via `CC_OPENCLAW_TURN_TIMEOUT_MS` (see
|
|
27
|
-
* src/lib/env-overrides.ts). Setting `=0` disables the per-turn timer
|
|
28
|
-
* entirely, matching direct-CLI behavior on long tool turns. */
|
|
29
|
-
export declare const TURN_TIMEOUT_MS = 900000;
|
|
30
|
-
/** Runtime watchdog threshold for "stuck" sessions. If a session is
|
|
31
|
-
* `isBusy === true` AND its stats.lastActivity hasn't moved in this many
|
|
32
|
-
* ms, the SessionManager watchdog aborts + disposes the session. Mirrors
|
|
33
|
-
* the boot-time orphan reaper in gateway-pm2-wrapper.sh:53-60, but runs
|
|
34
|
-
* continuously on a setInterval. Env-overridable via
|
|
35
|
-
* CC_OPENCLAW_STALLED_KILL_MS. v0.10.0. */
|
|
36
|
-
export declare const STALLED_SESSION_KILL_MS = 180000;
|
|
37
|
-
/** How often the stalled-session watchdog scans the sessions Map. */
|
|
38
|
-
export declare const STALLED_WATCH_INTERVAL_MS = 30000;
|
|
39
|
-
/** v0.27.4 (M4/M6) — resume-freshness window for openai-compat sessions.
|
|
40
|
-
* After a gateway restart OR a stalled-session watchdog SIGTERM, the in-process
|
|
41
|
-
* session object is gone; without this, the next turn for the same chat spawns
|
|
42
|
-
* a FRESH Claude conversation (no --resume) and the user loses all context.
|
|
43
|
-
* When an openai-compat session opts in (config.resumeFreshnessMs), the next
|
|
44
|
-
* turn resumes the prior Claude session ONLY if it was active within this
|
|
45
|
-
* window — older sessions start fresh, preserving the anti-stale intent that
|
|
46
|
-
* motivated skipPersistence. Default 30 min; env-overridable at the use site
|
|
47
|
-
* via CC_OPENCLAW_RESUME_FRESHNESS_MS. */
|
|
48
|
-
export declare const RESUME_FRESHNESS_MS = 1800000;
|
|
49
|
-
/** Runaway-loop watchdog: max new cc-openclaw subprocess spawns within
|
|
50
|
-
* RUNAWAY_LOOP_WINDOW_MS before the next spawn is refused.
|
|
51
|
-
*
|
|
52
|
-
* Rationale: when OpenClaw's agent-runner re-fires `before_model_resolve`
|
|
53
|
-
* multiple times for one user turn (the 2026-05-11 17:42 incident
|
|
54
|
-
* spawned 4 subprocesses in 60s on session 7be69d1b), the cc-openclaw
|
|
55
|
-
* side has no signal that it's the same conversation — each request
|
|
56
|
-
* carries a fresh runId in the X-Session-Id header, so the existing
|
|
57
|
-
* stalled-session watchdog never fires. This second-dimension
|
|
58
|
-
* watchdog catches runaway loops by spawn rate across the SessionManager.
|
|
59
|
-
*
|
|
60
|
-
* Env override: CC_OPENCLAW_LOOP_MAX_SUBPROCS. Min 2, max 20.
|
|
61
|
-
* v0.10.1. */
|
|
62
|
-
export declare const RUNAWAY_LOOP_MAX_SUBPROCS = 3;
|
|
63
|
-
/** Sliding window for the runaway-loop spawn-rate counter. */
|
|
64
|
-
export declare const RUNAWAY_LOOP_WINDOW_MS = 60000;
|
|
65
|
-
/** Timeout for compact / context summary operations.
|
|
66
|
-
* v0.20.0: env-overridable via `CC_OPENCLAW_COMPACT_TIMEOUT_MS`. `=0` disables
|
|
67
|
-
* the timer — useful for 150K-token sessions where /compact legitimately
|
|
68
|
-
* takes >60s. */
|
|
69
|
-
export declare const COMPACT_TIMEOUT_MS = 60000;
|
|
70
|
-
/** Delay before SIGKILL after initial SIGTERM on stop() */
|
|
71
|
-
export declare const STOP_SIGKILL_DELAY_MS = 3000;
|
|
72
|
-
/** Timeout for most git CLI operations (branch, checkout, log, diff) */
|
|
73
|
-
export declare const GIT_CMD_TIMEOUT_MS = 5000;
|
|
74
|
-
/** Timeout for git worktree add/remove (heavier operations) */
|
|
75
|
-
export declare const WORKTREE_CMD_TIMEOUT_MS = 10000;
|
|
76
|
-
/** Default per-agent timeout in council */
|
|
77
|
-
export declare const DEFAULT_AGENT_TIMEOUT_MS = 1800000;
|
|
78
|
-
/** Delay between council rounds */
|
|
79
|
-
export declare const INTER_ROUND_DELAY_MS = 3000;
|
|
80
|
-
/** Delay before retrying on empty agent response */
|
|
81
|
-
export declare const EMPTY_RESPONSE_RETRY_DELAY_MS = 5000;
|
|
82
|
-
/** Timeout for council follow-up prompts */
|
|
83
|
-
export declare const FOLLOWUP_TIMEOUT_MS = 60000;
|
|
84
|
-
/** Timeout for team list operations */
|
|
85
|
-
export declare const TEAM_LIST_TIMEOUT_MS = 30000;
|
|
86
|
-
/** Timeout for team send operations */
|
|
87
|
-
export declare const TEAM_SEND_TIMEOUT_MS = 120000;
|
|
88
|
-
/** Timeout for ultraplan sessions */
|
|
89
|
-
export declare const ULTRAPLAN_TIMEOUT_MS = 1800000;
|
|
90
|
-
/** How long completed results remain queryable */
|
|
91
|
-
export declare const RESULT_TTL_MS = 1800000;
|
|
92
|
-
/** Session TTL cleanup check interval */
|
|
93
|
-
export declare const CLEANUP_INTERVAL_MS = 60000;
|
|
94
|
-
/** Debounce delay for persisted session writes */
|
|
95
|
-
export declare const DEBOUNCED_SAVE_MS = 5000;
|
|
96
|
-
/** Persisted sessions disk TTL (7 days) */
|
|
97
|
-
export declare const PERSIST_DISK_TTL_MS: number;
|
|
98
|
-
/** Fetch timeout for proxy forward requests */
|
|
99
|
-
export declare const FETCH_TIMEOUT_MS = 600000;
|
|
100
|
-
/** Ultrareview polling interval */
|
|
101
|
-
export declare const ULTRAREVIEW_POLL_INTERVAL_MS = 5000;
|
|
102
|
-
/** Default port for the embedded HTTP server */
|
|
103
|
-
export declare const DEFAULT_SERVER_PORT = 18796;
|
|
104
|
-
/** Maximum request body size (5 MB) */
|
|
105
|
-
export declare const MAX_BODY_SIZE = 5242880;
|
|
106
|
-
/** Rate limit: max requests per window per IP */
|
|
107
|
-
export declare const RATE_LIMIT_MAX_REQUESTS = 300;
|
|
108
|
-
/** Rate limit: sliding window duration */
|
|
109
|
-
export declare const RATE_LIMIT_WINDOW_MS = 60000;
|
|
110
|
-
/** Minimum task description length */
|
|
111
|
-
export declare const MIN_TASK_LENGTH = 5;
|
|
112
|
-
/** Max retries for empty agent responses */
|
|
113
|
-
export declare const EMPTY_RESPONSE_MAX_RETRIES = 2;
|
|
114
|
-
/** Minimum response length to consider complete */
|
|
115
|
-
export declare const MIN_COMPLETE_RESPONSE_LENGTH = 100;
|
|
116
|
-
/** Max follow-up retries per agent */
|
|
117
|
-
export declare const FOLLOWUP_MAX_RETRIES = 2;
|
|
118
|
-
/** Character limit for history preview in council prompts */
|
|
119
|
-
export declare const HISTORY_PREVIEW_CHARS = 1500;
|
|
120
|
-
/** Character limit for agent summary in review */
|
|
121
|
-
export declare const SUMMARY_PREVIEW_CHARS = 500;
|
|
122
|
-
/** Character limit for short summary in transcript */
|
|
123
|
-
export declare const SUMMARY_SHORT_CHARS = 400;
|
|
124
|
-
/** Character limit for compact context */
|
|
125
|
-
export declare const COMPACT_CONTEXT_CHARS = 300;
|
|
126
|
-
/** Default max rounds in council collaboration */
|
|
127
|
-
export declare const DEFAULT_MAX_ROUNDS = 15;
|
|
128
|
-
/** Default max turns per agent */
|
|
129
|
-
export declare const DEFAULT_MAX_TURNS_PER_AGENT = 50;
|
|
130
|
-
/** Git log depth for council review */
|
|
131
|
-
export declare const GIT_LOG_DEPTH = 50;
|
|
132
|
-
/** Max messages per session inbox */
|
|
133
|
-
export declare const MAX_INBOX_SIZE = 200;
|
|
134
|
-
/** Consecutive failures before circuit opens */
|
|
135
|
-
export declare const CIRCUIT_BREAKER_THRESHOLD = 3;
|
|
136
|
-
/** Base backoff delay (doubles each failure) */
|
|
137
|
-
export declare const CIRCUIT_BREAKER_BACKOFF_BASE_MS = 1000;
|
|
138
|
-
/** Maximum backoff duration cap */
|
|
139
|
-
export declare const CIRCUIT_BREAKER_MAX_BACKOFF_MS = 300000;
|
|
140
|
-
export declare const SESSION_EVENT: {
|
|
141
|
-
readonly READY: "ready";
|
|
142
|
-
readonly INIT: "init";
|
|
143
|
-
readonly TEXT: "text";
|
|
144
|
-
readonly TOOL_USE: "tool_use";
|
|
145
|
-
readonly TOOL_RESULT: "tool_result";
|
|
146
|
-
readonly RESULT: "result";
|
|
147
|
-
readonly TURN_COMPLETE: "turn_complete";
|
|
148
|
-
readonly ERROR: "error";
|
|
149
|
-
readonly LOG: "log";
|
|
150
|
-
readonly CLOSE: "close";
|
|
151
|
-
readonly PAUSED: "paused";
|
|
152
|
-
readonly RESUMED: "resumed";
|
|
153
|
-
readonly SYSTEM: "system";
|
|
154
|
-
readonly API_RETRY: "api_retry";
|
|
155
|
-
readonly STREAM_EVENT: "stream_event";
|
|
156
|
-
readonly USER_ECHO: "user_echo";
|
|
157
|
-
readonly ASSISTANT: "assistant";
|
|
158
|
-
readonly EVENT: "event";
|
|
159
|
-
};
|
|
160
|
-
/** Default model when the OpenAI-compat request omits `model` */
|
|
161
|
-
export declare const OPENAI_COMPAT_DEFAULT_MODEL = "claude-sonnet-4-6";
|
|
162
|
-
/** Context utilization % threshold for auto-compact */
|
|
163
|
-
export declare const OPENAI_COMPAT_AUTO_COMPACT_THRESHOLD = 80;
|
|
164
|
-
/** Session name prefix for OpenAI-compat sessions */
|
|
165
|
-
export declare const OPENAI_COMPAT_SESSION_PREFIX = "openai-";
|
|
166
|
-
/** Context % at or above which cc-handler triggers in-place /compact post-turn.
|
|
167
|
-
* Telegram/Savvy path was missing this — only the OpenAI-compat HTTP path had
|
|
168
|
-
* AUTO_COMPACT_THRESHOLD. Set lower than 80 to give Savvy more headroom for
|
|
169
|
-
* reasoning + tool turns before context starts pressuring API latency. */
|
|
170
|
-
export declare const CC_AUTO_COMPACT_THRESHOLD = 70;
|
|
171
|
-
/** Context % at or above which cc-handler hard-resets the session (stop +
|
|
172
|
-
* recreate) instead of compacting. Used when /compact itself would leave
|
|
173
|
-
* the session too close to the model's window cap to do useful work. */
|
|
174
|
-
export declare const CC_HARD_RESET_THRESHOLD = 90;
|
|
175
|
-
/** Single-flight window for the openai-compat streaming path. When two
|
|
176
|
-
* requests with a byte-identical (sessionName + input) signature arrive
|
|
177
|
-
* within this window, the second is treated as a duplicate (an OpenClaw
|
|
178
|
-
* retry of a stream it perceived as dead) and JOINS the in-flight turn
|
|
179
|
-
* instead of spawning a SECOND full model run. The leader's result is
|
|
180
|
-
* replayed to the follower; the model executes exactly once.
|
|
181
|
-
*
|
|
182
|
-
* Born from the 2026-05-22 incident: an OOM SIGKILL (exit 137) made
|
|
183
|
-
* OpenClaw retry, and session-manager's per-session send-chain SERIALIZES
|
|
184
|
-
* (rather than coalesces) the retry — so the turn ran twice and delivered
|
|
185
|
-
* two identical Telegram messages. This guards the duplicate at its source.
|
|
186
|
-
*
|
|
187
|
-
* Set CC_OPENCLAW_DEDUP_WINDOW_MS=0 to disable (pure fail-open to the prior
|
|
188
|
-
* serialize-and-rerun behavior). Default 45s comfortably exceeds a typical
|
|
189
|
-
* OpenClaw read-timeout-then-retry gap without risking a real, distinct
|
|
190
|
-
* follow-up message colliding with a just-finished identical one. */
|
|
191
|
-
export declare const DEDUP_WINDOW_MS = 45000;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `buildAgentPrompt` — constructs the per-round, per-agent collaboration
|
|
3
|
-
* prompt for council session turns. Round 1 is planning-only; rounds 2+ are
|
|
4
|
-
* execution rounds with previous-round history prepended.
|
|
5
|
-
*
|
|
6
|
-
* Extracted from `council.ts` 2026-05-13 — pure string transformation,
|
|
7
|
-
* no I/O, no module state. Behavior preservation verified by existing
|
|
8
|
-
* council tests + replay-100-turns parity (when corpus grows).
|
|
9
|
-
*/
|
|
10
|
-
import type { AgentPersona, AgentResponse } from '../types.js';
|
|
11
|
-
export declare function buildAgentPrompt(agent: AgentPersona, task: string, round: number, previousResponses: AgentResponse[], allAgents: AgentPersona[]): string;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Best-effort cleanup of already-created git worktrees when a batch
|
|
3
|
-
* creation fails.
|
|
4
|
-
*
|
|
5
|
-
* Extracted from `council.ts` 2026-05-13 as a bounded hot-path utility.
|
|
6
|
-
* Iterates the partial worktree map, force-removes each one via git, logs
|
|
7
|
-
* failures but never throws. Used in error paths only.
|
|
8
|
-
*/
|
|
9
|
-
import { type Logger } from '../logger.js';
|
|
10
|
-
export declare function cleanupCreatedWorktrees(worktreeMap: Map<string, string>, projectDir: string, logger?: Logger): Promise<void>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Consensus vote parsing utilities
|
|
3
|
-
*
|
|
4
|
-
* Ported from three-minds — detects [CONSENSUS: YES/NO] tags in agent
|
|
5
|
-
* responses with multiple fallback patterns for variant formats.
|
|
6
|
-
*/
|
|
7
|
-
/** Remove all [CONSENSUS: YES/NO] tags from text */
|
|
8
|
-
export declare function stripConsensusTags(text: string): string;
|
|
9
|
-
/** Check whether text contains any consensus vote marker */
|
|
10
|
-
export declare function hasConsensusMarker(text: string): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Parse a consensus vote from agent response text.
|
|
13
|
-
*
|
|
14
|
-
* Priority chain:
|
|
15
|
-
* 1. Strict format: [CONSENSUS: YES] / [CONSENSUS: NO]
|
|
16
|
-
* 2. Common variants: consensus: yes, **consensus**: no, CONSENSUS=YES, etc.
|
|
17
|
-
* 3. Tail fallback: analyse last 8 lines for positive/negative signals
|
|
18
|
-
* 4. Default: false (no consensus)
|
|
19
|
-
*/
|
|
20
|
-
export declare function parseConsensus(content: string): boolean;
|