@a1hvdy/cc-openclaw 0.27.8 → 0.27.10
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/adapter.d.ts +3 -2
- package/dist/src/channels/telegram-mirror/card-renderer.js +8 -2
- package/dist/src/channels/telegram-mirror/quota-reader.d.ts +2 -1
- package/dist/src/channels/telegram-mirror/soak-log.d.ts +4 -3
- package/dist/src/channels/telegram-mirror/state-machine.d.ts +2 -1
- package/dist/src/channels/telegram-mirror/sync-commands.d.ts +3 -2
- package/dist/src/command-router/index.d.ts +1 -1
- package/dist/src/command-router/launch-policy.d.ts +0 -6
- package/dist/src/command-router/launch-policy.js +7 -7
- package/dist/src/config/schema.d.ts +0 -16
- package/dist/src/constants.d.ts +0 -14
- package/dist/src/constants.js +0 -13
- package/dist/src/engines/persistent-session.js +10 -3
- package/dist/src/health/index.d.ts +1 -1
- package/dist/src/lib/auto-recovery.d.ts +0 -1
- package/dist/src/lib/auto-recovery.js +1 -1
- package/dist/src/lib/config.d.ts +0 -8
- package/dist/src/lib/config.js +0 -29
- package/dist/src/lib/debug-tap.d.ts +0 -2
- package/dist/src/lib/debug-tap.js +0 -12
- package/dist/src/lib/env-overrides.d.ts +0 -18
- package/dist/src/lib/env-overrides.js +0 -28
- package/dist/src/lib/error-formatter.d.ts +2 -1
- package/dist/src/lib/error-renderer.d.ts +1 -4
- package/dist/src/lib/error-renderer.js +0 -11
- package/dist/src/lib/html-render.js +13 -0
- package/dist/src/lib/status-tee-reader.d.ts +2 -1
- package/dist/src/lib/vendor-paths.d.ts +0 -4
- package/dist/src/lib/vendor-paths.js +2 -2
- package/dist/src/lifecycle/boot.d.ts +0 -11
- package/dist/src/lifecycle/boot.js +1 -1
- package/dist/src/logger.d.ts +0 -2
- package/dist/src/logger.js +0 -7
- package/dist/src/models.d.ts +2 -3
- package/dist/src/models.js +3 -3
- package/dist/src/observability/event-bus.d.ts +0 -10
- package/dist/src/observability/event-bus.js +0 -11
- package/dist/src/observability/perf-telemetry.d.ts +5 -6
- package/dist/src/observability/perf-telemetry.js +1 -1
- package/dist/src/patches/embedded-server-route.js +1 -1
- package/dist/src/patches/sysprompt-strip.d.ts +2 -2
- package/dist/src/patches/sysprompt-strip.js +2 -2
- package/dist/src/persistence/session-registry.d.ts +2 -1
- package/dist/src/session/persisted-sessions.d.ts +0 -2
- package/dist/src/session/persisted-sessions.js +2 -2
- package/dist/src/session-bootstrap/resume-registry.d.ts +0 -2
- package/dist/src/session-bootstrap/resume-registry.js +2 -2
- package/dist/src/session-bootstrap/sysprompt-strip.d.ts +0 -1
- package/dist/src/types/route.d.ts +0 -30
- package/dist/src/types/runtime-config.d.ts +1 -1
- package/dist/src/types/runtime-config.js +1 -1
- package/dist/src/types/sse.d.ts +0 -9
- package/dist/src/types/upstream.d.ts +0 -72
- package/dist/src/types/upstream.js +1 -22
- package/dist/src/types.d.ts +3 -18
- package/package.json +1 -1
- package/dist/src/lib/index.d.ts +0 -7
- package/dist/src/lib/index.js +0 -10
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
* gateway events MUST use one of these names. Adding a new event name
|
|
37
37
|
* here without a corresponding gateway emitter is dead-code-typing.
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
type ChannelHookEvent = 'before_dispatch' | 'before_prompt_build' | 'before_model_resolve' | 'before_tool_call' | 'after_tool_call' | 'reply_dispatch' | 'message_sending';
|
|
40
40
|
/** Hook handler signature — gateway passes (event, ctx?) positional args. */
|
|
41
|
-
|
|
41
|
+
type ChannelHookHandler = (...args: unknown[]) => unknown | Promise<unknown>;
|
|
42
42
|
export interface PluginApi {
|
|
43
43
|
/**
|
|
44
44
|
* Subscribe to a gateway hook event.
|
|
@@ -100,3 +100,4 @@ export interface ChannelAdapter {
|
|
|
100
100
|
* iterate a list of adapters without coupling to each adapter's internals.
|
|
101
101
|
*/
|
|
102
102
|
export declare function registerChannelAdapter(api: PluginApi, adapter: ChannelAdapter): void;
|
|
103
|
+
export {};
|
|
@@ -346,9 +346,12 @@ export function renderTurn(turn, meta) {
|
|
|
346
346
|
push(`<b>${escapeHtml(status)}</b>`);
|
|
347
347
|
// v0.26.2 M2 — meter row (context % + quota % + reset). Same no-fake-data
|
|
348
348
|
// gating: omitted unless real values are present. HTML-escaped for safety.
|
|
349
|
+
// v0.27.10 — wrap the meter row in <code> so the bars read as one cohesive
|
|
350
|
+
// monospace status widget (ctx ▓▓░ 6% · use …) instead of loose plain text
|
|
351
|
+
// sitting under the bold header — part of the "solid HTML" cleanup.
|
|
349
352
|
const meters = renderMeters(meta);
|
|
350
353
|
if (meters)
|
|
351
|
-
push(escapeHtml(meters));
|
|
354
|
+
push(`<code>${escapeHtml(meters)}</code>`);
|
|
352
355
|
// v0.26.4 styling — divider between the status/telemetry block and the
|
|
353
356
|
// activity block (only when a status block was actually rendered). The
|
|
354
357
|
// heavy-bar glyph is not HTML-significant, so it needs no escaping.
|
|
@@ -362,7 +365,10 @@ export function renderTurn(turn, meta) {
|
|
|
362
365
|
: turn.state === 'done'
|
|
363
366
|
? '✓ Done'
|
|
364
367
|
: '▶ Working';
|
|
365
|
-
|
|
368
|
+
// v0.27.10 — bold the turn-status header so it anchors the activity block as a
|
|
369
|
+
// styled heading rather than a plain line (cohesion pass). failReason is already
|
|
370
|
+
// escapeHtml'd above; ✓ Done / ▶ Working are literal-safe.
|
|
371
|
+
push(`<b>${header}</b>`);
|
|
366
372
|
if (turn.toolCalls.length > 0) {
|
|
367
373
|
// Build tool ENTRIES (tool line + its optional <pre><code> result block)
|
|
368
374
|
// newest-first, keeping what fits under budget; the older overflow collapses
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* the status-tee read path (so M11 can swap implementations without
|
|
12
12
|
* touching commands.ts).
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
interface QuotaPerDay {
|
|
15
15
|
/** YYYY-MM-DD */
|
|
16
16
|
date: string;
|
|
17
17
|
/** 0..100 — percentage of the daily Max 20x window consumed. */
|
|
@@ -39,3 +39,4 @@ export interface QuotaReader {
|
|
|
39
39
|
* directly to the cost command for fixture-based assertions.
|
|
40
40
|
*/
|
|
41
41
|
export declare const stubQuotaReader: QuotaReader;
|
|
42
|
+
export {};
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
* path resolution is the same shape.
|
|
23
23
|
*/
|
|
24
24
|
export type SoakRow = SoakLaptopCheckRow | SoakFailureRow | SoakSlashRow;
|
|
25
|
-
|
|
25
|
+
interface SoakLaptopCheckRow {
|
|
26
26
|
ts: string;
|
|
27
27
|
type: 'laptop-check';
|
|
28
28
|
openedLaptop: boolean;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
interface SoakFailureRow {
|
|
31
31
|
ts: string;
|
|
32
32
|
type: 'failure-incident';
|
|
33
33
|
mode: string;
|
|
34
34
|
chatId: string | number;
|
|
35
35
|
info?: unknown;
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
interface SoakSlashRow {
|
|
38
38
|
ts: string;
|
|
39
39
|
type: 'slash-invocation';
|
|
40
40
|
cmd: string;
|
|
@@ -96,3 +96,4 @@ export declare class SoakLogger {
|
|
|
96
96
|
'slash-invocation': number;
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
+
export {};
|
|
@@ -38,7 +38,7 @@ export interface StreamEvent {
|
|
|
38
38
|
error?: unknown;
|
|
39
39
|
result?: string;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
type TurnState = 'working' | 'done' | 'failed';
|
|
42
42
|
export interface ToolCallRecord {
|
|
43
43
|
/** Tool name (e.g. "Bash", "Read", "Edit"). */
|
|
44
44
|
name: string;
|
|
@@ -110,3 +110,4 @@ export declare class TurnStateMachine {
|
|
|
110
110
|
*/
|
|
111
111
|
clear(chatId: string): void;
|
|
112
112
|
}
|
|
113
|
+
export {};
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* actually uses; full upstream payload supports scope/language_code params
|
|
19
19
|
* that the mirror doesn't need.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
interface SetMyCommandsPayload {
|
|
22
22
|
commands: Array<{
|
|
23
23
|
command: string;
|
|
24
24
|
description: string;
|
|
@@ -28,7 +28,7 @@ export interface SetMyCommandsPayload {
|
|
|
28
28
|
* Minimum logger surface (works with console or api.logger). Made narrow
|
|
29
29
|
* deliberately so callers can pass any structured logger.
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
interface SyncLogger {
|
|
32
32
|
info: (msg: string, ...rest: unknown[]) => void;
|
|
33
33
|
warn: (msg: string, ...rest: unknown[]) => void;
|
|
34
34
|
}
|
|
@@ -97,3 +97,4 @@ export declare function syncMyCommands(opts: SyncOptions): Promise<SyncResult>;
|
|
|
97
97
|
* this; each gateway boot starts a fresh process with synced=false.
|
|
98
98
|
*/
|
|
99
99
|
export declare function _resetSyncedForTests(): void;
|
|
100
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { register, parseCcCommand } from './cc-handler.js';
|
|
2
|
-
export type {
|
|
2
|
+
export type { PluginApi } from './cc-handler.js';
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
* Data layer: types, constants, session index, session store, slug/ID generators.
|
|
6
6
|
* Launch/idle/recovery logic added in Step 3.
|
|
7
7
|
*/
|
|
8
|
-
export declare const SESSIONS_DIR = "/home/a1xai/.openclaw/sessions";
|
|
9
|
-
export declare const SESSIONS_INDEX_PATH: string;
|
|
10
8
|
export declare const DEFAULT_CWD = "/home/a1xai/.openclaw";
|
|
11
9
|
export interface SessionMeta {
|
|
12
10
|
id: string;
|
|
@@ -52,20 +50,16 @@ export type SessionManagerLike = {
|
|
|
52
50
|
compactSession?(name: string, summary?: string): Promise<void>;
|
|
53
51
|
shutdown(): Promise<void>;
|
|
54
52
|
};
|
|
55
|
-
export declare const FILLER_WORDS: Set<string>;
|
|
56
53
|
export declare function makeSlug(instruction: string): string;
|
|
57
54
|
export declare function generateSessionId(): string;
|
|
58
55
|
export declare function sessionMapKey(chatId: string, threadId: string | undefined): string;
|
|
59
|
-
export declare let sessionIndex: Record<string, string>;
|
|
60
56
|
export declare function loadSessionIndex(): void;
|
|
61
|
-
export declare function saveSessionIndex(): void;
|
|
62
57
|
export declare function saveSession(meta: SessionMeta): void;
|
|
63
58
|
export declare function loadSession(slug: string): SessionMeta | null;
|
|
64
59
|
export declare function loadSessionById(id: string): SessionMeta | null;
|
|
65
60
|
export declare function scanAllSessions(): SessionMeta[];
|
|
66
61
|
export declare const IDLE_TIMEOUT_MS: number;
|
|
67
62
|
export declare const ACK_TIMEOUT_MS = 5000;
|
|
68
|
-
export declare const COMPACT_COOLDOWN_MS = 60000;
|
|
69
63
|
export declare const RECOVERY_MAX_AGE_MS: number;
|
|
70
64
|
export interface PolicyDeps {
|
|
71
65
|
sessionManager: SessionManagerLike;
|
|
@@ -9,11 +9,11 @@ import * as fs from 'node:fs';
|
|
|
9
9
|
import * as path from 'node:path';
|
|
10
10
|
import * as crypto from 'node:crypto';
|
|
11
11
|
// ── Shared Constants ──────────────────────────────────────────────────────
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const SESSIONS_DIR = '/home/a1xai/.openclaw/sessions';
|
|
13
|
+
const SESSIONS_INDEX_PATH = path.join(SESSIONS_DIR, 'index.json');
|
|
14
14
|
export const DEFAULT_CWD = '/home/a1xai/.openclaw';
|
|
15
15
|
// ── Slug Generator ────────────────────────────────────────────────────────
|
|
16
|
-
|
|
16
|
+
const FILLER_WORDS = new Set([
|
|
17
17
|
'the', 'a', 'an', 'is', 'are', 'was', 'were', 'be', 'been', 'being',
|
|
18
18
|
'have', 'has', 'had', 'do', 'does', 'did', 'will', 'would', 'could',
|
|
19
19
|
'should', 'may', 'might', 'shall', 'can', 'to', 'of', 'in', 'for',
|
|
@@ -46,7 +46,7 @@ export function sessionMapKey(chatId, threadId) {
|
|
|
46
46
|
return threadId ? `${chatId}:${threadId}` : String(chatId);
|
|
47
47
|
}
|
|
48
48
|
// ── Session Index ─────────────────────────────────────────────────────────
|
|
49
|
-
|
|
49
|
+
let sessionIndex = {};
|
|
50
50
|
export function loadSessionIndex() {
|
|
51
51
|
try {
|
|
52
52
|
if (fs.existsSync(SESSIONS_INDEX_PATH)) {
|
|
@@ -57,7 +57,7 @@ export function loadSessionIndex() {
|
|
|
57
57
|
sessionIndex = {};
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
function saveSessionIndex() {
|
|
61
61
|
try {
|
|
62
62
|
fs.mkdirSync(SESSIONS_DIR, { recursive: true });
|
|
63
63
|
const tmp = SESSIONS_INDEX_PATH + '.tmp';
|
|
@@ -121,14 +121,14 @@ export function scanAllSessions() {
|
|
|
121
121
|
return results;
|
|
122
122
|
}
|
|
123
123
|
// ── Launch/Recovery Policy (Step 3) ───────────────────────────────────────
|
|
124
|
-
// Functions moved from cc-handler.ts
|
|
124
|
+
// Functions moved from cc-handler.ts (phase-5 cc-handler split).
|
|
125
125
|
// Each accepts PolicyDeps explicitly — no module-scope singletons here.
|
|
126
126
|
import { resolveAutoCompactThreshold, resolveHardResetThreshold } from '../lib/env-overrides.js';
|
|
127
127
|
import { sendDirectReply } from './turn-formatter.js';
|
|
128
128
|
const PLUGIN_TAG = '[cc-openclaw/launch-policy]';
|
|
129
129
|
export const IDLE_TIMEOUT_MS = 15 * 60 * 1000;
|
|
130
130
|
export const ACK_TIMEOUT_MS = 5_000;
|
|
131
|
-
|
|
131
|
+
const COMPACT_COOLDOWN_MS = 60_000;
|
|
132
132
|
export const RECOVERY_MAX_AGE_MS = 24 * 60 * 60 * 1000;
|
|
133
133
|
const _lastCompactAt = new Map();
|
|
134
134
|
/**
|
|
@@ -10,20 +10,6 @@
|
|
|
10
10
|
* Q6 resolution: nativeTools.enabled defaults to true (v1.0.0-rc1 flip).
|
|
11
11
|
*/
|
|
12
12
|
import { z } from 'zod';
|
|
13
|
-
declare const NativeToolsSchema: z.ZodObject<{
|
|
14
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
15
|
-
/**
|
|
16
|
-
* Q1 — explicit allowlist, deny-by-default.
|
|
17
|
-
* NativeOpenClawToolsBridge.dispatch() throws DomainError.UnauthorizedTool on miss.
|
|
18
|
-
*/
|
|
19
|
-
allowList: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
20
|
-
}, "strip", z.ZodTypeAny, {
|
|
21
|
-
enabled: boolean;
|
|
22
|
-
allowList: string[];
|
|
23
|
-
}, {
|
|
24
|
-
enabled?: boolean | undefined;
|
|
25
|
-
allowList?: string[] | undefined;
|
|
26
|
-
}>;
|
|
27
13
|
export declare const ConfigSchema: z.ZodObject<{
|
|
28
14
|
/**
|
|
29
15
|
* Master activation flag. Env: OPENCLAW_CC_OPENCLAW_ACTIVE.
|
|
@@ -204,5 +190,3 @@ export declare const ConfigSchema: z.ZodObject<{
|
|
|
204
190
|
openclawCcOpenclawListeners?: boolean | undefined;
|
|
205
191
|
}>;
|
|
206
192
|
export type Config = z.infer<typeof ConfigSchema>;
|
|
207
|
-
export type NativeToolsConfig = z.infer<typeof NativeToolsSchema>;
|
|
208
|
-
export {};
|
package/dist/src/constants.d.ts
CHANGED
|
@@ -157,26 +157,12 @@ export declare const SESSION_EVENT: {
|
|
|
157
157
|
readonly ASSISTANT: "assistant";
|
|
158
158
|
readonly EVENT: "event";
|
|
159
159
|
};
|
|
160
|
-
export type SessionEventName = (typeof SESSION_EVENT)[keyof typeof SESSION_EVENT];
|
|
161
160
|
/** Default model when the OpenAI-compat request omits `model` */
|
|
162
161
|
export declare const OPENAI_COMPAT_DEFAULT_MODEL = "claude-sonnet-4-6";
|
|
163
162
|
/** Context utilization % threshold for auto-compact */
|
|
164
163
|
export declare const OPENAI_COMPAT_AUTO_COMPACT_THRESHOLD = 80;
|
|
165
164
|
/** Session name prefix for OpenAI-compat sessions */
|
|
166
165
|
export declare const OPENAI_COMPAT_SESSION_PREFIX = "openai-";
|
|
167
|
-
/**
|
|
168
|
-
* Default for the legacy new-conversation heuristic gate.
|
|
169
|
-
*
|
|
170
|
-
* When env var `OPENAI_COMPAT_NEW_CONVO_HEURISTIC=1` is set, the old
|
|
171
|
-
* "system + single user ⇒ new conversation" rule is restored for webchat
|
|
172
|
-
* frontends (ChatGPT-Next-Web, Open WebUI, etc) that re-send the full
|
|
173
|
-
* transcript every turn. Default off: assumes upstream clients forward
|
|
174
|
-
* only the latest turn (OpenClaw main agent loop, cron jobs, subagents).
|
|
175
|
-
*
|
|
176
|
-
* The constant exists as a documentation anchor; openai-compat.ts reads
|
|
177
|
-
* the env var directly so the value can be flipped without restart.
|
|
178
|
-
*/
|
|
179
|
-
export declare const OPENAI_COMPAT_NEW_CONVO_HEURISTIC_DEFAULT = false;
|
|
180
166
|
/** Context % at or above which cc-handler triggers in-place /compact post-turn.
|
|
181
167
|
* Telegram/Savvy path was missing this — only the OpenAI-compat HTTP path had
|
|
182
168
|
* AUTO_COMPACT_THRESHOLD. Set lower than 80 to give Savvy more headroom for
|
package/dist/src/constants.js
CHANGED
|
@@ -172,19 +172,6 @@ export const OPENAI_COMPAT_DEFAULT_MODEL = 'claude-sonnet-4-6';
|
|
|
172
172
|
export const OPENAI_COMPAT_AUTO_COMPACT_THRESHOLD = 80;
|
|
173
173
|
/** Session name prefix for OpenAI-compat sessions */
|
|
174
174
|
export const OPENAI_COMPAT_SESSION_PREFIX = 'openai-';
|
|
175
|
-
/**
|
|
176
|
-
* Default for the legacy new-conversation heuristic gate.
|
|
177
|
-
*
|
|
178
|
-
* When env var `OPENAI_COMPAT_NEW_CONVO_HEURISTIC=1` is set, the old
|
|
179
|
-
* "system + single user ⇒ new conversation" rule is restored for webchat
|
|
180
|
-
* frontends (ChatGPT-Next-Web, Open WebUI, etc) that re-send the full
|
|
181
|
-
* transcript every turn. Default off: assumes upstream clients forward
|
|
182
|
-
* only the latest turn (OpenClaw main agent loop, cron jobs, subagents).
|
|
183
|
-
*
|
|
184
|
-
* The constant exists as a documentation anchor; openai-compat.ts reads
|
|
185
|
-
* the env var directly so the value can be flipped without restart.
|
|
186
|
-
*/
|
|
187
|
-
export const OPENAI_COMPAT_NEW_CONVO_HEURISTIC_DEFAULT = false;
|
|
188
175
|
// ─── cc-handler post-turn context management (v0.6.0) ───────────────────────
|
|
189
176
|
/** Context % at or above which cc-handler triggers in-place /compact post-turn.
|
|
190
177
|
* Telegram/Savvy path was missing this — only the OpenAI-compat HTTP path had
|
|
@@ -611,10 +611,17 @@ export class PersistentClaudeSession extends EventEmitter {
|
|
|
611
611
|
this.stats.tokensOut += usage.output_tokens || 0;
|
|
612
612
|
this.stats.cachedTokens += usage.cache_read_input_tokens || 0;
|
|
613
613
|
// v0.6.0: track actual per-turn context occupancy for the contextPercent
|
|
614
|
-
// calc.
|
|
615
|
-
//
|
|
614
|
+
// calc. v0.27.10: include cache_creation_input_tokens. The full prompt
|
|
615
|
+
// sent each turn = input (new uncached) + cache_read (cached prefix
|
|
616
|
+
// re-read) + cache_creation (newly written to cache). Summing ALL THREE
|
|
617
|
+
// yields the true current context-window occupancy, stable across cache
|
|
618
|
+
// hit/miss. Omitting cache_creation made the meter swing wildly (cold
|
|
619
|
+
// cache → everything is creation, uncounted → ~6%; warm cache → big
|
|
620
|
+
// read → 63%+) — the exact 6%→63%→100% jitter A1 flagged 2026-05-22.
|
|
616
621
|
this.stats.lastTurnContextTokens =
|
|
617
|
-
(usage.input_tokens || 0) +
|
|
622
|
+
(usage.input_tokens || 0) +
|
|
623
|
+
(usage.cache_read_input_tokens || 0) +
|
|
624
|
+
(usage.cache_creation_input_tokens || 0);
|
|
618
625
|
this._updateCost();
|
|
619
626
|
}
|
|
620
627
|
this.emit(SESSION_EVENT.RESULT, event);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getHealthInfo, healthRoute, markStart, recordSessionStart, recordSessionEnd, getHealthPort, DEFAULT_HEALTH_PORT, _resetForTests,
|
|
1
|
+
export { getHealthInfo, healthRoute, markStart, recordSessionStart, recordSessionEnd, getHealthPort, DEFAULT_HEALTH_PORT, _resetForTests, } from './handler.js';
|
|
@@ -28,7 +28,6 @@ interface Pm2BusEvent {
|
|
|
28
28
|
/** Test-only reset. */
|
|
29
29
|
export declare function _resetRecoveryStateForTests(): void;
|
|
30
30
|
export declare function _setOnProcessExitForTests(handler: ((event: Pm2BusEvent) => void) | null): void;
|
|
31
|
-
export declare function attemptRecovery(processName: string): Promise<RecoveryResult>;
|
|
32
31
|
/**
|
|
33
32
|
* Connect to PM2 bus and listen for process:exit events.
|
|
34
33
|
* No-ops if OPENCLAW_CC_OPENCLAW_AUTO_RECOVERY=0 or already connected.
|
|
@@ -96,7 +96,7 @@ function runDoctorFix() {
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
// ─── Recovery orchestrator ────────────────────────────────────────────────────
|
|
99
|
-
|
|
99
|
+
async function attemptRecovery(processName) {
|
|
100
100
|
const start = Date.now();
|
|
101
101
|
if (isLogLevelDebug()) {
|
|
102
102
|
process.stderr.write(`[cc-openclaw/auto-recovery] starting recovery for ${processName}\n`);
|
package/dist/src/lib/config.d.ts
CHANGED
|
@@ -111,13 +111,5 @@ export declare function getOpenaiCompatStatusUrl(): string | undefined;
|
|
|
111
111
|
export declare function getAnthropicBaseUrlEnv(): string | undefined;
|
|
112
112
|
export declare function getHomeOrTmp(): string;
|
|
113
113
|
export declare function getHealthPortEnv(): string | undefined;
|
|
114
|
-
export declare function isDriftAlertsEnabled(): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Dedup window for repeated drift Telegram alerts. Default 1h.
|
|
117
|
-
* NOT in RuntimeConfig — niche tunable not surfaced through the activation
|
|
118
|
-
* matrix. Kept as a direct env reader.
|
|
119
|
-
*/
|
|
120
|
-
export declare function getDriftDedupeWindowMs(): number;
|
|
121
114
|
export declare function isAutoRecoveryEnabled(): boolean;
|
|
122
115
|
export declare function getSurfaceThinkingEnabled(): boolean;
|
|
123
|
-
export declare function getThinkingExcerptEnabled(): boolean;
|
package/dist/src/lib/config.js
CHANGED
|
@@ -421,24 +421,6 @@ export function getHealthPortEnv() {
|
|
|
421
421
|
const v = process.env.CC_OPENCLAW_HEALTH_PORT;
|
|
422
422
|
return v === undefined || v === '' ? undefined : v;
|
|
423
423
|
}
|
|
424
|
-
// ── Drift detection (src/lib/drift-detector.ts) ───────────────────────────
|
|
425
|
-
// Default-ON. Opt-out via OPENCLAW_CC_OPENCLAW_DRIFT_ALERTS=0.
|
|
426
|
-
export function isDriftAlertsEnabled() {
|
|
427
|
-
const cfg = getConfigService();
|
|
428
|
-
if (cfg)
|
|
429
|
-
return cfg.config.driftAlertsEnabled;
|
|
430
|
-
return process.env.OPENCLAW_CC_OPENCLAW_DRIFT_ALERTS !== '0';
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* Dedup window for repeated drift Telegram alerts. Default 1h.
|
|
434
|
-
* NOT in RuntimeConfig — niche tunable not surfaced through the activation
|
|
435
|
-
* matrix. Kept as a direct env reader.
|
|
436
|
-
*/
|
|
437
|
-
export function getDriftDedupeWindowMs() {
|
|
438
|
-
const v = process.env.OPENCLAW_CC_OPENCLAW_DRIFT_DEDUPE_WINDOW_MS;
|
|
439
|
-
const n = v !== undefined ? parseInt(v, 10) : NaN;
|
|
440
|
-
return Number.isFinite(n) && n > 0 ? n : 3_600_000;
|
|
441
|
-
}
|
|
442
424
|
// ── Auto-recovery (src/lib/auto-recovery.ts) ─────────────────────────────
|
|
443
425
|
// Default-ON. Opt-out via OPENCLAW_CC_OPENCLAW_AUTO_RECOVERY=0.
|
|
444
426
|
export function isAutoRecoveryEnabled() {
|
|
@@ -461,14 +443,3 @@ export function getSurfaceThinkingEnabled() {
|
|
|
461
443
|
return cfg.config.surfaceThinking;
|
|
462
444
|
return process.env.CC_OPENCLAW_SURFACE_THINKING === '1';
|
|
463
445
|
}
|
|
464
|
-
// ── Thinking excerpt → live-card preview (v0.7.0) ────────────────────────
|
|
465
|
-
// Second-tier opt-in for surfacing thinking text on the Telegram live card.
|
|
466
|
-
// Telegram has additional surface (chat history, screenshots) so opt-in
|
|
467
|
-
// twice for visibility there. Has no effect when CC_OPENCLAW_SURFACE_THINKING
|
|
468
|
-
// is unset.
|
|
469
|
-
export function getThinkingExcerptEnabled() {
|
|
470
|
-
const cfg = getConfigService();
|
|
471
|
-
if (cfg)
|
|
472
|
-
return cfg.config.thinkingExcerpt;
|
|
473
|
-
return process.env.CC_OPENCLAW_THINKING_EXCERPT === '1';
|
|
474
|
-
}
|
|
@@ -11,5 +11,3 @@ import type { PluginApi } from '../index.js';
|
|
|
11
11
|
* there is zero proxy overhead in production.
|
|
12
12
|
*/
|
|
13
13
|
export declare function wrapApiWithDebugTap(api: PluginApi, pluginLabel: string): PluginApi;
|
|
14
|
-
/** Test-only hook to flush + close the stream between tests. */
|
|
15
|
-
export declare function _resetDebugTapForTests(): void;
|
|
@@ -170,15 +170,3 @@ export function wrapApiWithDebugTap(api, pluginLabel) {
|
|
|
170
170
|
},
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
-
/** Test-only hook to flush + close the stream between tests. */
|
|
174
|
-
export function _resetDebugTapForTests() {
|
|
175
|
-
if (writeStream) {
|
|
176
|
-
try {
|
|
177
|
-
writeStream.end();
|
|
178
|
-
}
|
|
179
|
-
catch {
|
|
180
|
-
/* ignore */
|
|
181
|
-
}
|
|
182
|
-
writeStream = null;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
@@ -45,21 +45,3 @@ export declare function resolveAutoCompactThreshold(): number;
|
|
|
45
45
|
* Env: `CC_OPENCLAW_HARD_RESET_THRESHOLD`. Default: 90.
|
|
46
46
|
*/
|
|
47
47
|
export declare function resolveHardResetThreshold(): number;
|
|
48
|
-
/**
|
|
49
|
-
* v0.20.2 — Live-card text-mirror opt-in flag. Default OFF (D7).
|
|
50
|
-
* When enabled, the live-card shows a rolling-tail preview of the full
|
|
51
|
-
* assistant text in addition to the existing metrics + insight body.
|
|
52
|
-
*
|
|
53
|
-
* Env: `CC_OPENCLAW_LIVE_CARD_MIRROR`. Default: false.
|
|
54
|
-
* The telegram-renderer reads this env directly via _mirrorEnabled() — the
|
|
55
|
-
* resolver here exists for downstream consumers that want to inspect the
|
|
56
|
-
* value or override via openclaw.json (see schema field `liveCardMirror`).
|
|
57
|
-
*/
|
|
58
|
-
export declare function resolveLiveCardMirror(): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* v0.20.2 — Live-card text-mirror max-lines override. Default 25 (D5).
|
|
61
|
-
* Clamped to [5, 50]. Out-of-range values fall back to default.
|
|
62
|
-
*
|
|
63
|
-
* Env: `CC_OPENCLAW_LIVE_CARD_MIRROR_LINES`. Default: 25.
|
|
64
|
-
*/
|
|
65
|
-
export declare function resolveLiveCardMirrorLines(): number;
|
|
@@ -101,31 +101,3 @@ export function resolveHardResetThreshold() {
|
|
|
101
101
|
return CC_HARD_RESET_THRESHOLD;
|
|
102
102
|
return v;
|
|
103
103
|
}
|
|
104
|
-
/**
|
|
105
|
-
* v0.20.2 — Live-card text-mirror opt-in flag. Default OFF (D7).
|
|
106
|
-
* When enabled, the live-card shows a rolling-tail preview of the full
|
|
107
|
-
* assistant text in addition to the existing metrics + insight body.
|
|
108
|
-
*
|
|
109
|
-
* Env: `CC_OPENCLAW_LIVE_CARD_MIRROR`. Default: false.
|
|
110
|
-
* The telegram-renderer reads this env directly via _mirrorEnabled() — the
|
|
111
|
-
* resolver here exists for downstream consumers that want to inspect the
|
|
112
|
-
* value or override via openclaw.json (see schema field `liveCardMirror`).
|
|
113
|
-
*/
|
|
114
|
-
export function resolveLiveCardMirror() {
|
|
115
|
-
const raw = process.env.CC_OPENCLAW_LIVE_CARD_MIRROR;
|
|
116
|
-
return raw === '1' || raw === 'true';
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* v0.20.2 — Live-card text-mirror max-lines override. Default 25 (D5).
|
|
120
|
-
* Clamped to [5, 50]. Out-of-range values fall back to default.
|
|
121
|
-
*
|
|
122
|
-
* Env: `CC_OPENCLAW_LIVE_CARD_MIRROR_LINES`. Default: 25.
|
|
123
|
-
*/
|
|
124
|
-
export function resolveLiveCardMirrorLines() {
|
|
125
|
-
const v = parseEnvInt('CC_OPENCLAW_LIVE_CARD_MIRROR_LINES');
|
|
126
|
-
if (v === undefined)
|
|
127
|
-
return 25;
|
|
128
|
-
if (v < 5 || v > 50)
|
|
129
|
-
return 25;
|
|
130
|
-
return v;
|
|
131
|
-
}
|
|
@@ -57,7 +57,7 @@ export interface FormattedError {
|
|
|
57
57
|
*/
|
|
58
58
|
telegramText: string;
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
interface ErrorJsonlRow {
|
|
61
61
|
ts: string;
|
|
62
62
|
code: ErrorCode;
|
|
63
63
|
severity: Severity;
|
|
@@ -88,3 +88,4 @@ export declare function escapeMdV2(text: string): string;
|
|
|
88
88
|
export declare function formatError(error: unknown, context: ErrorContext): FormattedError;
|
|
89
89
|
/** Shorthand for the common "unknown catch block" pattern. */
|
|
90
90
|
export declare function formatUnknownError(error: unknown, sessionId?: string): FormattedError;
|
|
91
|
+
export {};
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
* by the mirror channel's register() at boot). The drift JSONL writer
|
|
11
11
|
* for warning+ severity is unchanged.
|
|
12
12
|
*/
|
|
13
|
-
import type { FormattedError
|
|
14
|
-
export declare function _resetDedupForTests(): void;
|
|
13
|
+
import type { FormattedError } from './error-formatter.js';
|
|
15
14
|
export interface RenderOptions {
|
|
16
15
|
chatId?: string;
|
|
17
16
|
threadId?: string;
|
|
@@ -19,5 +18,3 @@ export interface RenderOptions {
|
|
|
19
18
|
writeJsonl?: boolean;
|
|
20
19
|
}
|
|
21
20
|
export declare function renderError(formatted: FormattedError, opts?: RenderOptions): Promise<boolean>;
|
|
22
|
-
export declare function renderErrorIfSevere(formatted: FormattedError, opts?: RenderOptions): Promise<boolean>;
|
|
23
|
-
export type { Severity };
|
|
@@ -32,9 +32,6 @@ function isDupe(code) {
|
|
|
32
32
|
function markSent(code) {
|
|
33
33
|
_lastSentAt.set(code, Date.now());
|
|
34
34
|
}
|
|
35
|
-
export function _resetDedupForTests() {
|
|
36
|
-
_lastSentAt.clear();
|
|
37
|
-
}
|
|
38
35
|
// ─── Chat ID resolution ───────────────────────────────────────────────────────
|
|
39
36
|
function resolveErrorChatId() {
|
|
40
37
|
const v = process.env.OPENCLAW_ERROR_CHAT_ID || process.env.OPENCLAW_ADMIN_CHAT_ID;
|
|
@@ -97,11 +94,3 @@ export async function renderError(formatted, opts = {}) {
|
|
|
97
94
|
return false;
|
|
98
95
|
}
|
|
99
96
|
}
|
|
100
|
-
export async function renderErrorIfSevere(formatted, opts = {}) {
|
|
101
|
-
const sev = formatted.jsonlRow.severity;
|
|
102
|
-
if (sev === 'info' || sev === 'warning') {
|
|
103
|
-
writeDriftJsonl(formatted);
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
return renderError(formatted, opts);
|
|
107
|
-
}
|
|
@@ -223,6 +223,19 @@ export function markdownToHtml(input) {
|
|
|
223
223
|
// glyph isn't HTML-significant, so it survives the escape below. Uses [ \t]
|
|
224
224
|
// (not \s) so it never consumes the line break.
|
|
225
225
|
text = text.replace(/^([ \t]*)[-*+][ \t]+/gm, (_m, indent) => `${indent}• `);
|
|
226
|
+
// v0.27.10 — strip dangling inline-markdown delimiters left by PARTIAL
|
|
227
|
+
// streaming text. Every CLOSED span (```fence```, `code`, **bold**, ~~strike~~)
|
|
228
|
+
// was already lifted out to a NUL placeholder above; whatever **, ~~ or ` is
|
|
229
|
+
// still here is an UNTERMINATED marker at the live-stream frontier (e.g. the
|
|
230
|
+
// card edited mid-token while the model is still typing "…and the **bold"). Left
|
|
231
|
+
// in place it renders as a raw symbol next to formatted text — the "normal text
|
|
232
|
+
// mixed between HTML" A1 flagged 2026-05-22. Remove the markers, keep the words.
|
|
233
|
+
// Finalized (balanced) text has none left, so this is a no-op there. `*`/`_` are
|
|
234
|
+
// deliberately NOT stripped (too easily literal math / snake_case → false hits).
|
|
235
|
+
text = text
|
|
236
|
+
.replace(/\*\*/g, '')
|
|
237
|
+
.replace(/~~/g, '')
|
|
238
|
+
.replace(/`/g, '');
|
|
226
239
|
text = escapeHtml(text);
|
|
227
240
|
text = text.replace(/\x00CODEBLOCK(\d+)\x00/g, (_m, idx) => codeBlocks[Number(idx)]);
|
|
228
241
|
text = text.replace(/\x00TABLE(\d+)\x00/g, (_m, idx) => tables[Number(idx)]);
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* If no fresh file exists (cold-boot, fetcher offline, >10min stale),
|
|
11
11
|
* returns null. The /cc status panel renders "Plan: ?% (no data)" then.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
interface QuotaWindow {
|
|
14
14
|
usedPercent: number;
|
|
15
15
|
resetsAt: number;
|
|
16
16
|
}
|
|
@@ -26,3 +26,4 @@ export declare function readQuotaSnapshot(dir?: string): QuotaSnapshot | null;
|
|
|
26
26
|
* Color emoji: 🟢 <60%, 🟡 60-85%, 🔴 >85%.
|
|
27
27
|
*/
|
|
28
28
|
export declare function formatQuotaLine(snapshot: QuotaSnapshot | null): string;
|
|
29
|
+
export {};
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/** Package root — `<install>/extensions/cc-openclaw/`. */
|
|
2
|
-
export declare const PACKAGE_ROOT: string;
|
|
3
|
-
/** Engine library directory — points at compiled dist/src post-v0.7.0. */
|
|
4
|
-
export declare const VENDOR_DIR: string;
|
|
5
1
|
/**
|
|
6
2
|
* Engine library file paths. Pre-v0.7.0 these pointed at `vendor/`; v0.7.0
|
|
7
3
|
* consolidation repointed them at the canonical `dist/src/` build output.
|
|
@@ -21,9 +21,9 @@ import { dirname, join } from 'path';
|
|
|
21
21
|
const __filename = fileURLToPath(import.meta.url);
|
|
22
22
|
const __dirname = dirname(__filename);
|
|
23
23
|
/** Package root — `<install>/extensions/cc-openclaw/`. */
|
|
24
|
-
|
|
24
|
+
const PACKAGE_ROOT = join(__dirname, '..', '..', '..');
|
|
25
25
|
/** Engine library directory — points at compiled dist/src post-v0.7.0. */
|
|
26
|
-
|
|
26
|
+
const VENDOR_DIR = join(PACKAGE_ROOT, 'dist', 'src');
|
|
27
27
|
/**
|
|
28
28
|
* Engine library file paths. Pre-v0.7.0 these pointed at `vendor/`; v0.7.0
|
|
29
29
|
* consolidation repointed them at the canonical `dist/src/` build output.
|
|
@@ -46,14 +46,3 @@ export declare class Boot {
|
|
|
46
46
|
run(): Promise<Config>;
|
|
47
47
|
private runPhase;
|
|
48
48
|
}
|
|
49
|
-
export declare class BootPhaseError extends Error {
|
|
50
|
-
readonly phase: BootPhase;
|
|
51
|
-
readonly cause: Error;
|
|
52
|
-
constructor(phase: BootPhase, cause: Error);
|
|
53
|
-
/** True when the underlying error is a DriftError (phase 3 failure). */
|
|
54
|
-
get isDrift(): boolean;
|
|
55
|
-
/** True when the underlying error is a ConfigInvalid (phase 1 failure). */
|
|
56
|
-
get isConfigInvalid(): boolean;
|
|
57
|
-
/** Remediation message suitable for `cc-openclaw doctor` output. */
|
|
58
|
-
remediation(): string;
|
|
59
|
-
}
|
package/dist/src/logger.d.ts
CHANGED
|
@@ -12,5 +12,3 @@ export interface Logger {
|
|
|
12
12
|
}
|
|
13
13
|
/** Create a console-backed logger with optional prefix and env-var level control. */
|
|
14
14
|
export declare function createConsoleLogger(prefix?: string): Logger;
|
|
15
|
-
/** No-op logger — useful in tests to suppress output. */
|
|
16
|
-
export declare const nullLogger: Logger;
|
package/dist/src/logger.js
CHANGED
package/dist/src/models.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface ModelPricing {
|
|
|
11
11
|
output: number;
|
|
12
12
|
cached?: number;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
interface ModelDef {
|
|
15
15
|
/** Canonical model ID, e.g. 'claude-opus-4-6' */
|
|
16
16
|
id: string;
|
|
17
17
|
/** Which CLI engine to use */
|
|
@@ -27,8 +27,6 @@ export interface ModelDef {
|
|
|
27
27
|
/** Context window size in tokens */
|
|
28
28
|
contextWindow?: number;
|
|
29
29
|
}
|
|
30
|
-
/** Resolve a model string (id or alias) to its full definition. Returns undefined for unknown models. */
|
|
31
|
-
export declare function lookupModel(idOrAlias: string): ModelDef | undefined;
|
|
32
30
|
/** Resolve alias → canonical id. Returns the input unchanged if not an alias. */
|
|
33
31
|
export declare function resolveAlias(alias: string): string;
|
|
34
32
|
/** Resolve model string to engine + canonical model. Pattern fallback for unknown models. */
|
|
@@ -67,3 +65,4 @@ export declare function isClaudeModel(model: string): boolean;
|
|
|
67
65
|
export declare function estimateTokens(text: string): number;
|
|
68
66
|
/** Resolve a model string to its full definition. Throws for unknown models. */
|
|
69
67
|
export declare function lookupModelStrict(idOrAlias: string): ModelDef;
|
|
68
|
+
export {};
|
package/dist/src/models.js
CHANGED
|
@@ -164,7 +164,7 @@ for (const m of MODELS) {
|
|
|
164
164
|
}
|
|
165
165
|
// ─── Public API ──────────────────────────────────────────────────────────────
|
|
166
166
|
/** Resolve a model string (id or alias) to its full definition. Returns undefined for unknown models. */
|
|
167
|
-
|
|
167
|
+
function lookupModel(idOrAlias) {
|
|
168
168
|
return _byId.get(idOrAlias) || _byAlias.get(idOrAlias);
|
|
169
169
|
}
|
|
170
170
|
/** Resolve alias → canonical id. Returns the input unchanged if not an alias. */
|
|
@@ -219,7 +219,7 @@ export function resolveProvider(model) {
|
|
|
219
219
|
}
|
|
220
220
|
/** Get context window size for a model. Returns 200k default for unknown models. */
|
|
221
221
|
export function getContextWindow(model) {
|
|
222
|
-
const clean = model.replace(/^(anthropic|openai|openai-codex|google|gemini|cursor)\//g, '');
|
|
222
|
+
const clean = model.replace(/^(anthropic|openai|openai-codex|google|gemini|cursor|cc-openclaw)\//g, '');
|
|
223
223
|
const known = lookupModel(clean);
|
|
224
224
|
return known?.contextWindow ?? 200_000;
|
|
225
225
|
}
|
|
@@ -227,7 +227,7 @@ export function getContextWindow(model) {
|
|
|
227
227
|
export function getModelPricing(model, defaultModel = 'claude-sonnet-4-6') {
|
|
228
228
|
if (!model)
|
|
229
229
|
return lookupModel(defaultModel)?.pricing ?? { input: 0, output: 0 };
|
|
230
|
-
const clean = model.replace(/^(anthropic|openai|openai-codex|google|gemini|cursor)\//g, '');
|
|
230
|
+
const clean = model.replace(/^(anthropic|openai|openai-codex|google|gemini|cursor|cc-openclaw)\//g, '');
|
|
231
231
|
// Check overrides first
|
|
232
232
|
const override = _pricingOverrides.get(clean);
|
|
233
233
|
if (override)
|
|
@@ -10,16 +10,6 @@
|
|
|
10
10
|
* Adding a new event requires only a type entry here — no subclass needed.
|
|
11
11
|
*/
|
|
12
12
|
import type { Config } from '../config/schema.js';
|
|
13
|
-
/**
|
|
14
|
-
* EventBus payload-shape contract version. Bump on any breaking change to a
|
|
15
|
-
* payload (rename, narrow type, remove key). Subscribers may ignore events
|
|
16
|
-
* tagged with a version they don't understand.
|
|
17
|
-
*
|
|
18
|
-
* v0.13.0 introduces this constant. Adding new events to EventMap is NOT a
|
|
19
|
-
* breaking change and does not require a bump; modifying an existing event's
|
|
20
|
-
* payload shape IS breaking and requires a bump + migration plan.
|
|
21
|
-
*/
|
|
22
|
-
export declare const EVENT_BUS_PROTOCOL_VERSION: "1";
|
|
23
13
|
type SessionName = string & {
|
|
24
14
|
readonly __brand: 'SessionName';
|
|
25
15
|
};
|
|
@@ -9,17 +9,6 @@
|
|
|
9
9
|
* EventMap keys use dot-notation: "session.started", "boot.ready", etc.
|
|
10
10
|
* Adding a new event requires only a type entry here — no subclass needed.
|
|
11
11
|
*/
|
|
12
|
-
// ── Protocol version ──────────────────────────────────────────────────────────
|
|
13
|
-
/**
|
|
14
|
-
* EventBus payload-shape contract version. Bump on any breaking change to a
|
|
15
|
-
* payload (rename, narrow type, remove key). Subscribers may ignore events
|
|
16
|
-
* tagged with a version they don't understand.
|
|
17
|
-
*
|
|
18
|
-
* v0.13.0 introduces this constant. Adding new events to EventMap is NOT a
|
|
19
|
-
* breaking change and does not require a bump; modifying an existing event's
|
|
20
|
-
* payload shape IS breaking and requires a bump + migration plan.
|
|
21
|
-
*/
|
|
22
|
-
export const EVENT_BUS_PROTOCOL_VERSION = '1';
|
|
23
12
|
// ── EventBus class ────────────────────────────────────────────────────────────
|
|
24
13
|
export class EventBus {
|
|
25
14
|
listeners = new Map();
|
|
@@ -26,26 +26,25 @@
|
|
|
26
26
|
* directly; splitting would require operators to remember two paths and would
|
|
27
27
|
* break the single `jq` pipeline. The `event` field makes filtering trivial.
|
|
28
28
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export type CacheCheckCause = 'hit' | 'registry_empty' | 'hash_mismatch' | 'session_unknown' | 'disabled';
|
|
29
|
+
type PerfEventName = 'cache_check' | 'first_byte' | 'turn_end';
|
|
30
|
+
type CacheCheckCause = 'hit' | 'registry_empty' | 'hash_mismatch' | 'session_unknown' | 'disabled';
|
|
32
31
|
interface PerfEventBase {
|
|
33
32
|
event: PerfEventName;
|
|
34
33
|
sessionKey?: string;
|
|
35
34
|
}
|
|
36
|
-
|
|
35
|
+
interface CacheCheckEvent extends PerfEventBase {
|
|
37
36
|
event: 'cache_check';
|
|
38
37
|
outcome: 'hit' | 'miss';
|
|
39
38
|
cause: CacheCheckCause;
|
|
40
39
|
sysHash?: string;
|
|
41
40
|
}
|
|
42
|
-
|
|
41
|
+
interface FirstByteEvent extends PerfEventBase {
|
|
43
42
|
event: 'first_byte';
|
|
44
43
|
elapsed_ms: number;
|
|
45
44
|
model?: string;
|
|
46
45
|
tool_stream?: boolean;
|
|
47
46
|
}
|
|
48
|
-
|
|
47
|
+
interface TurnEndEvent extends PerfEventBase {
|
|
49
48
|
event: 'turn_end';
|
|
50
49
|
elapsed_ms: number;
|
|
51
50
|
first_byte_ms?: number;
|
|
@@ -31,7 +31,7 @@ import { dirname, join } from 'node:path';
|
|
|
31
31
|
import { homedir } from 'node:os';
|
|
32
32
|
import { getPerfCacheTelemetryEnabled, isLogLevelDebug } from '../lib/config.js';
|
|
33
33
|
const TELEMETRY_DIR = join(homedir(), '.openclaw', 'workspace', 'memory');
|
|
34
|
-
|
|
34
|
+
const PERF_TELEMETRY_PATH = join(TELEMETRY_DIR, 'sysprompt-cost.jsonl');
|
|
35
35
|
function ensureDir(filePath) {
|
|
36
36
|
const dir = dirname(filePath);
|
|
37
37
|
if (!existsSync(dir))
|
|
@@ -53,7 +53,7 @@ export const embeddedServerRouteSpec = {
|
|
|
53
53
|
install(_target) {
|
|
54
54
|
// Drift-detection-only mode. Phase E#3 extracts the 9-step closure
|
|
55
55
|
// from src/session-bootstrap/cwd-patch.ts:applyPatch and ports it
|
|
56
|
-
// here (file budget: <200 LOC
|
|
56
|
+
// here (file budget: <200 LOC — may require
|
|
57
57
|
// splitting some steps into helper modules).
|
|
58
58
|
},
|
|
59
59
|
uninstall(_target) {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Pattern for Phase E#3:
|
|
9
9
|
* 1. One file per logical patch under `src/patches/<id>.spec.ts`.
|
|
10
|
-
* 2. File <200 LOC
|
|
10
|
+
* 2. File <200 LOC.
|
|
11
11
|
* 3. Exports a single `PatchSpec` instance as a named export.
|
|
12
12
|
* 4. `resolve()` owns its upstream symbol lookup — no global target arg.
|
|
13
13
|
* 5. `expectedShape` is sync, returns boolean; checks signature/props.
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* 8. A companion `tests/patches/<id>.test.ts` proves shape + mutation necessity.
|
|
17
17
|
*
|
|
18
18
|
* Functional source for sysprompt-strip lives at `src/lib/sysprompt-strip.ts`
|
|
19
|
-
* (pure function, reused as-is
|
|
19
|
+
* (pure function, reused as-is). The wrapper that
|
|
20
20
|
* registers it as a Claude Code prototype patch lives at
|
|
21
21
|
* `src/session-bootstrap/sysprompt-strip.ts`. Phase E#3 converts that wrapper
|
|
22
22
|
* into the structured PatchSpec form below.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Pattern for Phase E#3:
|
|
9
9
|
* 1. One file per logical patch under `src/patches/<id>.spec.ts`.
|
|
10
|
-
* 2. File <200 LOC
|
|
10
|
+
* 2. File <200 LOC.
|
|
11
11
|
* 3. Exports a single `PatchSpec` instance as a named export.
|
|
12
12
|
* 4. `resolve()` owns its upstream symbol lookup — no global target arg.
|
|
13
13
|
* 5. `expectedShape` is sync, returns boolean; checks signature/props.
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* 8. A companion `tests/patches/<id>.test.ts` proves shape + mutation necessity.
|
|
17
17
|
*
|
|
18
18
|
* Functional source for sysprompt-strip lives at `src/lib/sysprompt-strip.ts`
|
|
19
|
-
* (pure function, reused as-is
|
|
19
|
+
* (pure function, reused as-is). The wrapper that
|
|
20
20
|
* registers it as a Claude Code prototype patch lives at
|
|
21
21
|
* `src/session-bootstrap/sysprompt-strip.ts`. Phase E#3 converts that wrapper
|
|
22
22
|
* into the structured PatchSpec form below.
|
|
@@ -28,7 +28,7 @@ export declare function asSessionName(s: string): SessionName;
|
|
|
28
28
|
* - "session-only" → persist during session, delete on completion
|
|
29
29
|
* - "never-persist" → never write to disk (e.g. ephemeral test sessions)
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
type SkipPersistence = 'never' | 'session-only' | 'never-persist';
|
|
32
32
|
export interface SessionState {
|
|
33
33
|
name: SessionName;
|
|
34
34
|
pid?: number;
|
|
@@ -55,3 +55,4 @@ export declare class SessionRegistry {
|
|
|
55
55
|
get size(): number;
|
|
56
56
|
values(): IterableIterator<SessionState>;
|
|
57
57
|
}
|
|
58
|
+
export {};
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { EngineType } from '../types.js';
|
|
11
11
|
import { type Logger } from '../logger.js';
|
|
12
|
-
export declare const PERSIST_DIR: string;
|
|
13
|
-
export declare const PERSIST_FILE: string;
|
|
14
12
|
export interface PersistedSession {
|
|
15
13
|
name: string;
|
|
16
14
|
claudeSessionId: string;
|
|
@@ -12,8 +12,8 @@ import * as os from 'node:os';
|
|
|
12
12
|
import * as path from 'node:path';
|
|
13
13
|
import { createConsoleLogger } from '../logger.js';
|
|
14
14
|
import { PERSIST_DISK_TTL_MS } from '../constants.js';
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const PERSIST_DIR = path.join(os.homedir(), '.openclaw');
|
|
16
|
+
const PERSIST_FILE = path.join(PERSIST_DIR, 'claude-sessions.json');
|
|
17
17
|
/**
|
|
18
18
|
* v0.27.4 (M4/M6) — resume-freshness gate. A persisted Claude session is
|
|
19
19
|
* eligible for --resume only if its last activity is within `freshnessMs`.
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
* Logger is passed explicitly so this module is fully self-contained — no
|
|
10
10
|
* implicit module-level globals.
|
|
11
11
|
*/
|
|
12
|
-
export declare const SAVVY_REGISTRY_PATH: string;
|
|
13
|
-
export declare const CLAUDE_SESSIONS_PATH: string;
|
|
14
12
|
interface ResumeLogger {
|
|
15
13
|
info(msg: string): void;
|
|
16
14
|
warn(msg: string): void;
|
|
@@ -15,8 +15,8 @@ import { join } from 'path';
|
|
|
15
15
|
import { readJSONArraySafe } from '../lib/json-array.js';
|
|
16
16
|
const HOME = homedir();
|
|
17
17
|
const TAG = '[cc-openclaw/resume-registry]';
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const SAVVY_REGISTRY_PATH = join(HOME, '.openclaw/savvy-resume-registry.json');
|
|
19
|
+
const CLAUDE_SESSIONS_PATH = join(HOME, '.openclaw/claude-sessions.json');
|
|
20
20
|
/**
|
|
21
21
|
* Seed claude-sessions.json from savvy-resume-registry.json on cold boot
|
|
22
22
|
* (only when claude-sessions.json is empty or missing). One-shot recovery
|
|
@@ -15,7 +15,6 @@ export interface PluginApi {
|
|
|
15
15
|
config?: Record<string, unknown>;
|
|
16
16
|
}
|
|
17
17
|
export { stripSysprompt, isStripEnabled } from '../lib/sysprompt-strip.js';
|
|
18
|
-
export type { StripOptions, StripResult } from '../lib/sysprompt-strip.js';
|
|
19
18
|
/**
|
|
20
19
|
* Register sysprompt-strip's before_prompt_build hook.
|
|
21
20
|
*
|
|
@@ -9,33 +9,3 @@
|
|
|
9
9
|
* NOT consumed yet — Cluster A first commit establishes the vocabulary.
|
|
10
10
|
*/
|
|
11
11
|
export type { OpenAIChatMessage, OpenAIChatCompletionRequest as RouteBody, OpenAIChatCompletionResponse as RouteResponse, OpenAIChatCompletionChunk as RouteStreamChunk, OpenAIToolCall, ParsedToolCalls, ExtractedMessage, AnthropicToolResultBlock, UserMessageBlock, } from '../openai-compat/openai-compat.js';
|
|
12
|
-
/**
|
|
13
|
-
* Headers cc-openclaw inspects on every `/v1/chat/completions` request.
|
|
14
|
-
* `X-Session-Id` overrides the priority chain in `resolveSessionKey`.
|
|
15
|
-
* `X-Session-Reset` forces `isNewConversation=true`.
|
|
16
|
-
*/
|
|
17
|
-
export interface RouteHeaders {
|
|
18
|
-
readonly 'x-session-id'?: string;
|
|
19
|
-
readonly 'x-session-reset'?: string;
|
|
20
|
-
readonly 'content-type'?: string;
|
|
21
|
-
readonly authorization?: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Query-string params consumed by the embedded server. Most endpoints
|
|
25
|
-
* are JSON-body-driven; query is reserved for `/v1/sessions?cwd=…` style
|
|
26
|
-
* filters and per-endpoint flags.
|
|
27
|
-
*/
|
|
28
|
-
export type RouteQuery = Readonly<Record<string, string | undefined>>;
|
|
29
|
-
/**
|
|
30
|
-
* Parsed + validated route input. The shape Cluster B's `OpenAIBridge`
|
|
31
|
-
* receives after the route-patch chain (cwd-patch.ts:582 — 9 transforms)
|
|
32
|
-
* has run.
|
|
33
|
-
*/
|
|
34
|
-
export interface ParsedRoute<TBody = unknown> {
|
|
35
|
-
readonly path: string;
|
|
36
|
-
readonly body: TBody;
|
|
37
|
-
readonly headers: RouteHeaders;
|
|
38
|
-
readonly query: RouteQuery;
|
|
39
|
-
readonly sessionKey: string;
|
|
40
|
-
readonly isNewConversation: boolean;
|
|
41
|
-
}
|
|
@@ -42,7 +42,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
42
42
|
allowBuiltins: z.ZodDefault<z.ZodBoolean>;
|
|
43
43
|
toolsPerMessage: z.ZodDefault<z.ZodBoolean>;
|
|
44
44
|
/**
|
|
45
|
-
* Native-tools allowList
|
|
45
|
+
* Native-tools allowList. Default at
|
|
46
46
|
* v0.11.x matches the previously hardcoded `Set(['message.voice'])` in
|
|
47
47
|
* `src/openai-compat/bridges/allowlist.ts` to preserve behavior. Override
|
|
48
48
|
* via `CC_OPENCLAW_NATIVE_TOOLS_ALLOWLIST=` comma-separated. Expanded
|
|
@@ -59,7 +59,7 @@ export const RuntimeConfigSchema = z.object({
|
|
|
59
59
|
allowBuiltins: z.boolean().default(false),
|
|
60
60
|
toolsPerMessage: z.boolean().default(false),
|
|
61
61
|
/**
|
|
62
|
-
* Native-tools allowList
|
|
62
|
+
* Native-tools allowList. Default at
|
|
63
63
|
* v0.11.x matches the previously hardcoded `Set(['message.voice'])` in
|
|
64
64
|
* `src/openai-compat/bridges/allowlist.ts` to preserve behavior. Override
|
|
65
65
|
* via `CC_OPENCLAW_NATIVE_TOOLS_ALLOWLIST=` comma-separated. Expanded
|
package/dist/src/types/sse.d.ts
CHANGED
|
@@ -10,15 +10,6 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export type { OpenAIChatCompletionChunk as SseChunk, OpenAIToolCall, } from '../openai-compat/openai-compat.js';
|
|
12
12
|
export type { AnthropicEvent, AnthropicMessage, MessageUsage, MessageDeltaBody, ContentBlockStart, ContentBlockDelta, ParsedEvent, CliStreamParser, } from '../openai-compat/cli-stream-parser.js';
|
|
13
|
-
/**
|
|
14
|
-
* OpenAI `finish_reason` values cc-openclaw emits after mapping from
|
|
15
|
-
* Anthropic `stop_reason`:
|
|
16
|
-
* end_turn / stop_sequence → 'stop'
|
|
17
|
-
* tool_use → 'tool_calls'
|
|
18
|
-
* max_tokens → 'length'
|
|
19
|
-
* (cancelled / abort) → null (no finish_reason chunk)
|
|
20
|
-
*/
|
|
21
|
-
export type FinishReason = 'stop' | 'tool_calls' | 'length' | null;
|
|
22
13
|
/**
|
|
23
14
|
* One delta in an OpenAI streaming chunk. Cluster B will tighten this when
|
|
24
15
|
* `sse-translator.ts` is extracted into the typed boundary.
|
|
@@ -556,79 +556,7 @@ export declare const OpenClawConfigSchema: z.ZodObject<{
|
|
|
556
556
|
commands: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
557
557
|
}, z.ZodTypeAny, "passthrough">>;
|
|
558
558
|
export type OpenClawConfig = z.infer<typeof OpenClawConfigSchema>;
|
|
559
|
-
export declare const PluginManifestSchema: z.ZodObject<{
|
|
560
|
-
id: z.ZodLiteral<"cc-openclaw">;
|
|
561
|
-
enabledByDefault: z.ZodOptional<z.ZodBoolean>;
|
|
562
|
-
activation: z.ZodOptional<z.ZodObject<{
|
|
563
|
-
onStartup: z.ZodOptional<z.ZodBoolean>;
|
|
564
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
565
|
-
onStartup: z.ZodOptional<z.ZodBoolean>;
|
|
566
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
567
|
-
onStartup: z.ZodOptional<z.ZodBoolean>;
|
|
568
|
-
}, z.ZodTypeAny, "passthrough">>>;
|
|
569
|
-
configSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
570
|
-
capabilities: z.ZodOptional<z.ZodObject<{
|
|
571
|
-
childProcess: z.ZodOptional<z.ZodBoolean>;
|
|
572
|
-
networkAccess: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
573
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
574
|
-
childProcess: z.ZodOptional<z.ZodBoolean>;
|
|
575
|
-
networkAccess: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
576
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
577
|
-
childProcess: z.ZodOptional<z.ZodBoolean>;
|
|
578
|
-
networkAccess: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
579
|
-
}, z.ZodTypeAny, "passthrough">>>;
|
|
580
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
581
|
-
id: z.ZodLiteral<"cc-openclaw">;
|
|
582
|
-
enabledByDefault: z.ZodOptional<z.ZodBoolean>;
|
|
583
|
-
activation: z.ZodOptional<z.ZodObject<{
|
|
584
|
-
onStartup: z.ZodOptional<z.ZodBoolean>;
|
|
585
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
586
|
-
onStartup: z.ZodOptional<z.ZodBoolean>;
|
|
587
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
588
|
-
onStartup: z.ZodOptional<z.ZodBoolean>;
|
|
589
|
-
}, z.ZodTypeAny, "passthrough">>>;
|
|
590
|
-
configSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
591
|
-
capabilities: z.ZodOptional<z.ZodObject<{
|
|
592
|
-
childProcess: z.ZodOptional<z.ZodBoolean>;
|
|
593
|
-
networkAccess: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
594
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
595
|
-
childProcess: z.ZodOptional<z.ZodBoolean>;
|
|
596
|
-
networkAccess: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
597
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
598
|
-
childProcess: z.ZodOptional<z.ZodBoolean>;
|
|
599
|
-
networkAccess: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
600
|
-
}, z.ZodTypeAny, "passthrough">>>;
|
|
601
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
602
|
-
id: z.ZodLiteral<"cc-openclaw">;
|
|
603
|
-
enabledByDefault: z.ZodOptional<z.ZodBoolean>;
|
|
604
|
-
activation: z.ZodOptional<z.ZodObject<{
|
|
605
|
-
onStartup: z.ZodOptional<z.ZodBoolean>;
|
|
606
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
607
|
-
onStartup: z.ZodOptional<z.ZodBoolean>;
|
|
608
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
609
|
-
onStartup: z.ZodOptional<z.ZodBoolean>;
|
|
610
|
-
}, z.ZodTypeAny, "passthrough">>>;
|
|
611
|
-
configSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
612
|
-
capabilities: z.ZodOptional<z.ZodObject<{
|
|
613
|
-
childProcess: z.ZodOptional<z.ZodBoolean>;
|
|
614
|
-
networkAccess: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
615
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
616
|
-
childProcess: z.ZodOptional<z.ZodBoolean>;
|
|
617
|
-
networkAccess: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
618
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
619
|
-
childProcess: z.ZodOptional<z.ZodBoolean>;
|
|
620
|
-
networkAccess: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
621
|
-
}, z.ZodTypeAny, "passthrough">>>;
|
|
622
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
623
|
-
export type PluginManifest = z.infer<typeof PluginManifestSchema>;
|
|
624
559
|
type AgentEntry = z.infer<typeof AgentEntrySchema>;
|
|
625
|
-
/**
|
|
626
|
-
* Extract the agent list from either of the two `agents` shapes:
|
|
627
|
-
* - direct array (legacy): `agents: [...]`
|
|
628
|
-
* - container (canonical): `agents: { list: [...] }`
|
|
629
|
-
* Returns `[]` when neither shape applies.
|
|
630
|
-
*/
|
|
631
|
-
export declare function getAgentList(cfg: OpenClawConfig): ReadonlyArray<AgentEntry>;
|
|
632
560
|
/**
|
|
633
561
|
* Read the `agents.defaults.model.primary` (or top-level string) from an
|
|
634
562
|
* OpenClaw config, normalizing the same two shapes `model` may take:
|
|
@@ -60,34 +60,13 @@ export const OpenClawConfigSchema = z
|
|
|
60
60
|
commands: z.record(z.unknown()).optional(),
|
|
61
61
|
})
|
|
62
62
|
.passthrough();
|
|
63
|
-
// ── openclaw.plugin.json (this plugin's own manifest) ────────────────────────
|
|
64
|
-
export const PluginManifestSchema = z
|
|
65
|
-
.object({
|
|
66
|
-
id: z.literal('cc-openclaw'),
|
|
67
|
-
enabledByDefault: z.boolean().optional(),
|
|
68
|
-
activation: z
|
|
69
|
-
.object({
|
|
70
|
-
onStartup: z.boolean().optional(),
|
|
71
|
-
})
|
|
72
|
-
.passthrough()
|
|
73
|
-
.optional(),
|
|
74
|
-
configSchema: z.record(z.unknown()).optional(),
|
|
75
|
-
capabilities: z
|
|
76
|
-
.object({
|
|
77
|
-
childProcess: z.boolean().optional(),
|
|
78
|
-
networkAccess: z.array(z.string()).optional(),
|
|
79
|
-
})
|
|
80
|
-
.passthrough()
|
|
81
|
-
.optional(),
|
|
82
|
-
})
|
|
83
|
-
.passthrough();
|
|
84
63
|
/**
|
|
85
64
|
* Extract the agent list from either of the two `agents` shapes:
|
|
86
65
|
* - direct array (legacy): `agents: [...]`
|
|
87
66
|
* - container (canonical): `agents: { list: [...] }`
|
|
88
67
|
* Returns `[]` when neither shape applies.
|
|
89
68
|
*/
|
|
90
|
-
|
|
69
|
+
function getAgentList(cfg) {
|
|
91
70
|
const a = cfg.agents;
|
|
92
71
|
if (!a)
|
|
93
72
|
return [];
|
package/dist/src/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { ModelPricing } from './models.js';
|
|
5
5
|
export { getModelPricing, overrideModelPricing } from './models.js';
|
|
6
|
-
|
|
6
|
+
type PermissionMode = 'acceptEdits' | 'bypassPermissions' | 'default' | 'delegate' | 'dontAsk' | 'plan' | 'auto';
|
|
7
7
|
export type EffortLevel = 'low' | 'medium' | 'high' | 'max' | 'auto';
|
|
8
8
|
export type EngineType = 'claude' | 'codex' | 'gemini' | 'cursor' | 'custom';
|
|
9
9
|
export interface CustomEngineConfig {
|
|
@@ -218,16 +218,6 @@ export interface HookConfig {
|
|
|
218
218
|
onTurnComplete?: string;
|
|
219
219
|
onStopFailure?: string;
|
|
220
220
|
}
|
|
221
|
-
export interface ActiveSession {
|
|
222
|
-
config: SessionConfig;
|
|
223
|
-
claudeSessionId?: string;
|
|
224
|
-
created: string;
|
|
225
|
-
stats: SessionStats;
|
|
226
|
-
hooks: HookConfig;
|
|
227
|
-
paused: boolean;
|
|
228
|
-
busy: boolean;
|
|
229
|
-
currentEffort?: EffortLevel;
|
|
230
|
-
}
|
|
231
221
|
export interface SendOptions {
|
|
232
222
|
effort?: EffortLevel;
|
|
233
223
|
plan?: boolean;
|
|
@@ -273,11 +263,6 @@ export interface SendResult {
|
|
|
273
263
|
error?: string;
|
|
274
264
|
events: StreamEvent[];
|
|
275
265
|
}
|
|
276
|
-
export interface GrepMatch {
|
|
277
|
-
time: string;
|
|
278
|
-
type: string;
|
|
279
|
-
content: string;
|
|
280
|
-
}
|
|
281
266
|
export interface AgentInfo {
|
|
282
267
|
name: string;
|
|
283
268
|
file: string;
|
|
@@ -416,7 +401,7 @@ export interface UltrareviewResult {
|
|
|
416
401
|
endTime?: string;
|
|
417
402
|
error?: string;
|
|
418
403
|
}
|
|
419
|
-
|
|
404
|
+
type CouncilEventType = 'session-start' | 'round-start' | 'agent-start' | 'agent-chunk' | 'agent-tool' | 'agent-complete' | 'round-end' | 'complete' | 'error';
|
|
420
405
|
export interface CouncilEvent {
|
|
421
406
|
type: CouncilEventType;
|
|
422
407
|
sessionId: string;
|
|
@@ -472,7 +457,7 @@ export interface CouncilSession {
|
|
|
472
457
|
finalSummary?: string;
|
|
473
458
|
compactContext?: string;
|
|
474
459
|
}
|
|
475
|
-
|
|
460
|
+
type CouncilFileStatus = 'clean' | 'needs_rework' | 'redundant' | 'missing';
|
|
476
461
|
export interface CouncilChangedFile {
|
|
477
462
|
file: string;
|
|
478
463
|
status: CouncilFileStatus;
|
package/package.json
CHANGED
package/dist/src/lib/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './register-guard.js';
|
|
2
|
-
export { registerOnce } from './register-guard.js';
|
|
3
|
-
export { stripSysprompt, isStripEnabled, type StripOptions, type StripResult } from './sysprompt-strip.js';
|
|
4
|
-
export { isCacheParityEnabled, hashPrompt, recordAttachment, readRegistry, REGISTRY_PATH, type RegistryEntry, } from './cache-parity.js';
|
|
5
|
-
export { selectEngine, isCcOpenclawEnabled, captureSessionRoute, ACTIVE_FLAG_ENV, ROUTE_FLAG_ENV, type Engine, type SessionRoute, } from './config-service.js';
|
|
6
|
-
export { isTestMode, TEST_MODE_ENV, _setTestModeForTests } from './test-mode.js';
|
|
7
|
-
export { getAggressiveStripEnabled, getCacheParityEnabled, getLogLevel, isLogLevelDebug, } from './config.js';
|
package/dist/src/lib/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './register-guard.js';
|
|
2
|
-
export { registerOnce } from './register-guard.js';
|
|
3
|
-
export { stripSysprompt, isStripEnabled } from './sysprompt-strip.js';
|
|
4
|
-
export { isCacheParityEnabled, hashPrompt, recordAttachment, readRegistry, REGISTRY_PATH, } from './cache-parity.js';
|
|
5
|
-
// Engine routing — originally `./route-flag.js`; collapsed into
|
|
6
|
-
// `./config-service.js` at Cluster A step 8. Same API, same semantics,
|
|
7
|
-
// single source of truth.
|
|
8
|
-
export { selectEngine, isCcOpenclawEnabled, captureSessionRoute, ACTIVE_FLAG_ENV, ROUTE_FLAG_ENV, } from './config-service.js';
|
|
9
|
-
export { isTestMode, TEST_MODE_ENV, _setTestModeForTests } from './test-mode.js';
|
|
10
|
-
export { getAggressiveStripEnabled, getCacheParityEnabled, getLogLevel, isLogLevelDebug, } from './config.js';
|