@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,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;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Council — Multi-agent collaboration engine
|
|
3
|
-
*
|
|
4
|
-
* Ported from three-minds and adapted to use SessionManager + ISession
|
|
5
|
-
* directly (no HTTP/SSE to external services).
|
|
6
|
-
*
|
|
7
|
-
* Key patterns:
|
|
8
|
-
* - Git worktree isolation per agent
|
|
9
|
-
* - Two-phase protocol: planning round → execution rounds
|
|
10
|
-
* - Consensus voting: all agents vote YES to complete
|
|
11
|
-
* - Parallel execution via Promise.allSettled
|
|
12
|
-
* - Engine-agnostic: agents can use Claude, Codex, or any ISession engine
|
|
13
|
-
*/
|
|
14
|
-
import { EventEmitter } from 'node:events';
|
|
15
|
-
import { type CouncilConfig, type CouncilSession, type CouncilReviewResult, type CouncilAcceptResult, type CouncilRejectResult, type SessionConfig, type SessionInfo, type SendOptions, type SendResult } from '../types.js';
|
|
16
|
-
import { type Logger } from '../logger.js';
|
|
17
|
-
interface SessionManagerLike {
|
|
18
|
-
startSession(config: Partial<SessionConfig> & {
|
|
19
|
-
name?: string;
|
|
20
|
-
}): Promise<SessionInfo>;
|
|
21
|
-
sendMessage(name: string, message: string, options?: Partial<SendOptions>): Promise<SendResult>;
|
|
22
|
-
stopSession(name: string): Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
export declare class Council extends EventEmitter {
|
|
25
|
-
private config;
|
|
26
|
-
private manager;
|
|
27
|
-
private agentTimeoutMs;
|
|
28
|
-
private _aborted;
|
|
29
|
-
private _activeSessions;
|
|
30
|
-
private _session;
|
|
31
|
-
private _pendingInjection;
|
|
32
|
-
private logger;
|
|
33
|
-
constructor(config: CouncilConfig, manager: SessionManagerLike, logger?: Logger);
|
|
34
|
-
getSession(): CouncilSession | undefined;
|
|
35
|
-
injectMessage(message: string): void;
|
|
36
|
-
abort(): void;
|
|
37
|
-
private emitEvent;
|
|
38
|
-
private runSingleAgent;
|
|
39
|
-
init(task: string): CouncilSession;
|
|
40
|
-
run(task?: string): Promise<CouncilSession>;
|
|
41
|
-
private generateSummary;
|
|
42
|
-
private generateCompactContext;
|
|
43
|
-
private saveTranscript;
|
|
44
|
-
/**
|
|
45
|
-
* Produce a structured review of the council's output.
|
|
46
|
-
* Lists all changed files, branches, worktrees, plan.md status, and agent summaries.
|
|
47
|
-
* Does NOT modify any state — purely informational.
|
|
48
|
-
*/
|
|
49
|
-
review(): Promise<CouncilReviewResult>;
|
|
50
|
-
/**
|
|
51
|
-
* Internal cleanup helper — removes worktrees, branches, plan.md, and reviews/.
|
|
52
|
-
* Each cleanup step is independently gated by the `options` flags.
|
|
53
|
-
*/
|
|
54
|
-
private _cleanup;
|
|
55
|
-
/**
|
|
56
|
-
* Accept the council's work: clean up worktrees, branches, plan.md, and reviews/.
|
|
57
|
-
* Should only be called after reviewing via `review()`.
|
|
58
|
-
*/
|
|
59
|
-
accept(): Promise<CouncilAcceptResult>;
|
|
60
|
-
/**
|
|
61
|
-
* Reject the council's work: rewrite plan.md with feedback.
|
|
62
|
-
* Does NOT delete any worktrees or branches — the council can retry.
|
|
63
|
-
*/
|
|
64
|
-
reject(feedback: string): Promise<CouncilRejectResult>;
|
|
65
|
-
}
|
|
66
|
-
export declare function getDefaultCouncilConfig(projectDir: string): CouncilConfig;
|
|
67
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Council per-agent system prompt builder + config-path resolver.
|
|
3
|
-
*
|
|
4
|
-
* Extracted from `council.ts` 2026-05-13 as a pair (they're tightly coupled —
|
|
5
|
-
* buildSystemPrompt always calls resolveConfigPath). Both are bounded I/O:
|
|
6
|
-
* filesystem reads + string transformation, no module state.
|
|
7
|
-
*
|
|
8
|
-
* Note on path resolution: `import.meta.url` here points to
|
|
9
|
-
* `src/council/system-prompt.ts` (same directory as `council.ts` was),
|
|
10
|
-
* so the `../../configs` relative lookup resolves identically. Behavior
|
|
11
|
-
* preservation verified.
|
|
12
|
-
*/
|
|
13
|
-
import type { AgentPersona } from '../types.js';
|
|
14
|
-
/** Resolve the path to configs/ relative to this module (works from both src/ and dist/) */
|
|
15
|
-
export declare function resolveConfigPath(filename: string): string;
|
|
16
|
-
export declare function buildSystemPrompt(agent: AgentPersona, allAgents: AgentPersona[], worktreePath: string): string;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Writes a per-agent `.claude/CLAUDE.md` into the worktree directory, scoping
|
|
3
|
-
* the agent's identity, working branch, workspace boundary, and efficiency
|
|
4
|
-
* rules for council collaboration.
|
|
5
|
-
*
|
|
6
|
-
* Extracted from `council.ts` 2026-05-13 as a bounded-I/O hot-path
|
|
7
|
-
* decomposition. Deterministic for the same inputs; only writes one file
|
|
8
|
-
* under the given `wtDir`.
|
|
9
|
-
*/
|
|
10
|
-
export declare function writeWorktreeClaudeMd(wtDir: string, agentName: string, emoji: string, projectDir: string): void;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base class for one-shot (process-per-send) session engines.
|
|
3
|
-
*
|
|
4
|
-
* Shared by Codex, Gemini, and Cursor — eliminates ~200 LOC of duplication
|
|
5
|
-
* per engine. Subclasses only implement _run() (engine-specific CLI invocation)
|
|
6
|
-
* and optionally override _cleanupProc() for extra cleanup (readline, streams).
|
|
7
|
-
*/
|
|
8
|
-
import { ChildProcess } from 'node:child_process';
|
|
9
|
-
import { EventEmitter } from 'node:events';
|
|
10
|
-
import { type SessionConfig, type SessionStats, type EffortLevel, type ISession, type SessionSendOptions, type TurnResult, type CostBreakdown } from '../types.js';
|
|
11
|
-
/**
|
|
12
|
-
* Parameterizes engine-specific behavior without requiring method overrides.
|
|
13
|
-
* Passed to the BaseOneShotSession constructor by each subclass.
|
|
14
|
-
*/
|
|
15
|
-
export interface OneShotEngineConfig {
|
|
16
|
-
/** Prefix for session ID generation, e.g. 'codex', 'gemini', 'cursor' */
|
|
17
|
-
enginePrefix: string;
|
|
18
|
-
/** Fallback model for pricing lookups when session has no explicit model */
|
|
19
|
-
defaultModel: string;
|
|
20
|
-
/** Model name shown in getCost() output; defaults to defaultModel if omitted */
|
|
21
|
-
defaultModelDisplay?: string;
|
|
22
|
-
/** Whether this engine tracks cached token pricing (Codex=false, Gemini/Cursor=true) */
|
|
23
|
-
supportsCachedTokens: boolean;
|
|
24
|
-
/** Human-readable engine name for compact() no-op message */
|
|
25
|
-
engineDisplayName: string;
|
|
26
|
-
}
|
|
27
|
-
export declare abstract class BaseOneShotSession extends EventEmitter implements ISession {
|
|
28
|
-
protected options: SessionConfig;
|
|
29
|
-
protected engineBin: string;
|
|
30
|
-
protected engineCfg: OneShotEngineConfig;
|
|
31
|
-
private _isReady;
|
|
32
|
-
private _isPaused;
|
|
33
|
-
private _isBusy;
|
|
34
|
-
protected currentProc: ChildProcess | null;
|
|
35
|
-
private currentRequestId;
|
|
36
|
-
private _startTime;
|
|
37
|
-
private _history;
|
|
38
|
-
sessionId?: string;
|
|
39
|
-
protected _stats: {
|
|
40
|
-
turns: number;
|
|
41
|
-
toolCalls: number;
|
|
42
|
-
toolErrors: number;
|
|
43
|
-
tokensIn: number;
|
|
44
|
-
tokensOut: number;
|
|
45
|
-
cachedTokens: number;
|
|
46
|
-
costUsd: number;
|
|
47
|
-
lastActivity: string | null;
|
|
48
|
-
};
|
|
49
|
-
constructor(config: SessionConfig, bin: string, engineCfg: OneShotEngineConfig);
|
|
50
|
-
get pid(): number | undefined;
|
|
51
|
-
get isReady(): boolean;
|
|
52
|
-
get isPaused(): boolean;
|
|
53
|
-
get isBusy(): boolean;
|
|
54
|
-
start(): Promise<this>;
|
|
55
|
-
send(message: string | unknown[], options?: SessionSendOptions): Promise<TurnResult | {
|
|
56
|
-
requestId: number;
|
|
57
|
-
sent: boolean;
|
|
58
|
-
}>;
|
|
59
|
-
/** Engine-specific: spawn the CLI and return a TurnResult. */
|
|
60
|
-
protected abstract _run(message: string, options: SessionSendOptions): Promise<TurnResult>;
|
|
61
|
-
getStats(): SessionStats & {
|
|
62
|
-
sessionId?: string;
|
|
63
|
-
uptime: number;
|
|
64
|
-
};
|
|
65
|
-
getHistory(limit?: number): Array<{
|
|
66
|
-
time: string;
|
|
67
|
-
type: string;
|
|
68
|
-
event: unknown;
|
|
69
|
-
}>;
|
|
70
|
-
compact(_summary?: string): Promise<TurnResult>;
|
|
71
|
-
getEffort(): EffortLevel;
|
|
72
|
-
setEffort(level: EffortLevel): void;
|
|
73
|
-
getCost(): CostBreakdown;
|
|
74
|
-
resolveModel(alias: string): string;
|
|
75
|
-
pause(): void;
|
|
76
|
-
resume(): void;
|
|
77
|
-
stop(): void;
|
|
78
|
-
/** Override in subclasses that need extra cleanup (readline, stream destroy). */
|
|
79
|
-
protected _cleanupProc(): void;
|
|
80
|
-
protected _getModelPricing(): import("../models.js").ModelPricing;
|
|
81
|
-
protected _recordTurnComplete(): void;
|
|
82
|
-
protected _addHistory(event: {
|
|
83
|
-
text: string;
|
|
84
|
-
code: number | null;
|
|
85
|
-
}): void;
|
|
86
|
-
protected _updateCost(): void;
|
|
87
|
-
}
|