@a1hvdy/cc-openclaw 0.3.3 → 0.4.6
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 +0 -1
- package/dist/src/channels/telegram/completion-summary.d.ts +0 -1
- package/dist/src/channels/telegram/error-renderer.d.ts +0 -1
- package/dist/src/channels/telegram/event-reducer.d.ts +0 -1
- package/dist/src/channels/telegram/event-reducer.js +17 -3
- package/dist/src/channels/telegram/event-reducer.js.map +1 -1
- package/dist/src/channels/telegram/index.d.ts +0 -1
- package/dist/src/channels/telegram/injector.d.ts +0 -1
- package/dist/src/channels/telegram/live-card.d.ts +0 -1
- package/dist/src/channels/telegram/live-card.js +9 -2
- package/dist/src/channels/telegram/live-card.js.map +1 -1
- package/dist/src/channels/telegram/state-machine.d.ts +0 -1
- package/dist/src/channels/telegram/tool-tracker.d.ts +0 -1
- package/dist/src/command-router/cc-handler.d.ts +0 -1
- package/dist/src/command-router/cc-handler.js +52 -3
- package/dist/src/command-router/cc-handler.js.map +1 -1
- package/dist/src/command-router/index.d.ts +0 -1
- package/dist/src/constants.d.ts +0 -1
- package/dist/src/council/consensus.d.ts +0 -1
- package/dist/src/council/council.d.ts +0 -1
- package/dist/src/council/index.d.ts +0 -1
- package/dist/src/engines/base-oneshot-session.d.ts +0 -1
- package/dist/src/engines/index.d.ts +0 -1
- package/dist/src/engines/persistent-codex-session.d.ts +0 -1
- package/dist/src/engines/persistent-cursor-session.d.ts +0 -1
- package/dist/src/engines/persistent-custom-session.d.ts +0 -1
- package/dist/src/engines/persistent-gemini-session.d.ts +0 -1
- package/dist/src/engines/persistent-session.d.ts +0 -1
- package/dist/src/health/handler.d.ts +0 -1
- package/dist/src/health/index.d.ts +0 -1
- package/dist/src/health/metrics.d.ts +52 -0
- package/dist/src/health/metrics.js +116 -0
- package/dist/src/health/metrics.js.map +1 -0
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.js +15 -11
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib/auto-recovery.d.ts +0 -1
- package/dist/src/lib/cache-parity.d.ts +0 -1
- package/dist/src/lib/circuit-breaker.d.ts +0 -1
- package/dist/src/lib/config.d.ts +0 -1
- package/dist/src/lib/debug-tap.d.ts +15 -0
- package/dist/src/lib/debug-tap.d.ts.map +1 -0
- package/dist/src/lib/debug-tap.js +185 -0
- package/dist/src/lib/debug-tap.js.map +1 -0
- package/dist/src/lib/drift-detector.d.ts +0 -1
- package/dist/src/lib/error-formatter.d.ts +2 -2
- package/dist/src/lib/error-formatter.js +16 -1
- package/dist/src/lib/error-formatter.js.map +1 -1
- package/dist/src/lib/heartbeat-workaround.d.ts +0 -1
- package/dist/src/lib/index.d.ts +0 -1
- package/dist/src/lib/register-guard.d.ts +25 -18
- package/dist/src/lib/register-guard.js +43 -22
- package/dist/src/lib/register-guard.js.map +1 -1
- package/dist/src/lib/route-flag.d.ts +0 -1
- package/dist/src/lib/status-tee-reader.d.ts +28 -0
- package/dist/src/lib/status-tee-reader.js +82 -0
- package/dist/src/lib/status-tee-reader.js.map +1 -0
- package/dist/src/lib/sysprompt-strip.d.ts +0 -1
- package/dist/src/lib/telemetry.d.ts +0 -1
- package/dist/src/lib/test-mode.d.ts +0 -1
- package/dist/src/lib/trajectory.d.ts +35 -0
- package/dist/src/lib/trajectory.js +84 -0
- package/dist/src/lib/trajectory.js.map +1 -0
- package/dist/src/lib/vendor-paths.d.ts +0 -1
- package/dist/src/logger.d.ts +0 -1
- package/dist/src/mcp/bridge.d.ts +0 -1
- package/dist/src/mcp/index.d.ts +0 -1
- package/dist/src/models.d.ts +0 -1
- package/dist/src/openai-compat/cli-stream-parser.d.ts +0 -1
- package/dist/src/openai-compat/index.d.ts +0 -1
- package/dist/src/openai-compat/openai-compat.d.ts +0 -1
- package/dist/src/openai-compat/openai-compat.js +73 -4
- package/dist/src/openai-compat/openai-compat.js.map +1 -1
- package/dist/src/openai-compat/skill-resolver.d.ts +0 -1
- package/dist/src/openai-compat/sse-translator.d.ts +0 -1
- package/dist/src/proxy/anthropic-adapter.d.ts +0 -1
- package/dist/src/proxy/handler.d.ts +0 -1
- package/dist/src/proxy/index.d.ts +0 -1
- package/dist/src/proxy/schema-cleaner.d.ts +0 -1
- package/dist/src/proxy/thought-cache.d.ts +0 -1
- package/dist/src/session/embedded-server.d.ts +0 -1
- package/dist/src/session/embedded-server.js +25 -1
- package/dist/src/session/embedded-server.js.map +1 -1
- package/dist/src/session/inbox-manager.d.ts +0 -1
- package/dist/src/session/index.d.ts +0 -1
- package/dist/src/session/session-manager.d.ts +0 -1
- package/dist/src/session/session-manager.js +25 -0
- package/dist/src/session/session-manager.js.map +1 -1
- package/dist/src/session-bootstrap/cwd-patch.d.ts +0 -1
- package/dist/src/session-bootstrap/index.d.ts +0 -1
- package/dist/src/session-bootstrap/sysprompt-strip.d.ts +0 -1
- package/dist/src/session-bootstrap/think-conflict-resolver.d.ts +0 -1
- package/dist/src/types.d.ts +0 -1
- package/dist/src/validation.d.ts +0 -1
- package/mcp-tools.json +1 -1
- package/package.json +31 -9
- package/vendor/embedded-server.js +13 -0
- package/dist/src/circuit-breaker.d.ts +0 -22
- package/dist/src/circuit-breaker.d.ts.map +0 -1
- package/dist/src/circuit-breaker.js +0 -47
- package/dist/src/circuit-breaker.js.map +0 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* debug-tap — observability layer for cc-openclaw plugin event handlers.
|
|
3
|
+
*
|
|
4
|
+
* Wraps a PluginApi so every `api.on(event, handler)` call gets a tracing
|
|
5
|
+
* shim that writes JSONL entry/exit/error records to
|
|
6
|
+
* ~/.openclaw/workspace/memory/cc-openclaw-debug.jsonl when CC_OPENCLAW_DEBUG=1.
|
|
7
|
+
*
|
|
8
|
+
* Why: cc-handler / injector / event-reducer / tool-tracker / etc. each
|
|
9
|
+
* register their own listeners on `before_dispatch` and friends, and each
|
|
10
|
+
* does its own filtering with no entry log. When something silently fails
|
|
11
|
+
* to dispatch (e.g. forum-topic events not reaching cc-handler), we have no
|
|
12
|
+
* visibility into which subsystem saw the event, what its raw shape was,
|
|
13
|
+
* or whether a filter ate it. This tap captures the raw event BEFORE any
|
|
14
|
+
* filter so absence-of-log uniquely means "listener never invoked".
|
|
15
|
+
*
|
|
16
|
+
* Cost when off: a single env-var check per register, then no-op passthrough.
|
|
17
|
+
* Cost when on: ~one fs.write per event per subsystem (8 subsystems × event-rate).
|
|
18
|
+
*/
|
|
19
|
+
import * as fs from 'node:fs';
|
|
20
|
+
import * as path from 'node:path';
|
|
21
|
+
import * as os from 'node:os';
|
|
22
|
+
const DEBUG_FLAG = 'CC_OPENCLAW_DEBUG';
|
|
23
|
+
const DEFAULT_LOG_DIR = path.join(os.homedir(), '.openclaw', 'workspace', 'memory');
|
|
24
|
+
const DEFAULT_LOG_PATH = path.join(DEFAULT_LOG_DIR, 'cc-openclaw-debug.jsonl');
|
|
25
|
+
function debugEnabled() {
|
|
26
|
+
const v = process.env[DEBUG_FLAG];
|
|
27
|
+
if (!v)
|
|
28
|
+
return false;
|
|
29
|
+
const norm = v.toLowerCase();
|
|
30
|
+
return norm === '1' || norm === 'true' || norm === 'on';
|
|
31
|
+
}
|
|
32
|
+
let writeStream = null;
|
|
33
|
+
function getStream() {
|
|
34
|
+
if (!debugEnabled())
|
|
35
|
+
return null;
|
|
36
|
+
if (writeStream)
|
|
37
|
+
return writeStream;
|
|
38
|
+
try {
|
|
39
|
+
fs.mkdirSync(DEFAULT_LOG_DIR, { recursive: true });
|
|
40
|
+
writeStream = fs.createWriteStream(DEFAULT_LOG_PATH, { flags: 'a' });
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return writeStream;
|
|
46
|
+
}
|
|
47
|
+
function safeStringify(v) {
|
|
48
|
+
try {
|
|
49
|
+
return JSON.stringify(v);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return '"[unserializable]"';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Pull the fields we actually want to see for routing diagnosis without
|
|
57
|
+
* dumping potentially huge nested structures. Anything not in the allowlist
|
|
58
|
+
* is summarized via `_keys` so we still know what was on the object.
|
|
59
|
+
*/
|
|
60
|
+
function summarizeArg(arg) {
|
|
61
|
+
if (arg === null || arg === undefined)
|
|
62
|
+
return String(arg);
|
|
63
|
+
if (typeof arg !== 'object') {
|
|
64
|
+
return { type: typeof arg, value: String(arg).slice(0, 120) };
|
|
65
|
+
}
|
|
66
|
+
const a = arg;
|
|
67
|
+
const out = {};
|
|
68
|
+
const interesting = [
|
|
69
|
+
'channel',
|
|
70
|
+
'isGroup',
|
|
71
|
+
'senderId',
|
|
72
|
+
'conversationId',
|
|
73
|
+
'sessionId',
|
|
74
|
+
'chatId',
|
|
75
|
+
'threadId',
|
|
76
|
+
'topicId',
|
|
77
|
+
'messageId',
|
|
78
|
+
'event',
|
|
79
|
+
'kind',
|
|
80
|
+
'type',
|
|
81
|
+
'name',
|
|
82
|
+
'origin',
|
|
83
|
+
'source',
|
|
84
|
+
];
|
|
85
|
+
for (const k of interesting) {
|
|
86
|
+
if (k in a)
|
|
87
|
+
out[k] = a[k];
|
|
88
|
+
}
|
|
89
|
+
if ('content' in a && typeof a.content === 'string') {
|
|
90
|
+
out.contentPreview = a.content.slice(0, 160);
|
|
91
|
+
}
|
|
92
|
+
out._keys = Object.keys(a).slice(0, 32);
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
function writeEntry(entry) {
|
|
96
|
+
const stream = getStream();
|
|
97
|
+
if (!stream)
|
|
98
|
+
return;
|
|
99
|
+
try {
|
|
100
|
+
stream.write(safeStringify(entry) + '\n');
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
/* swallow — debug must never crash the plugin */
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Wrap a PluginApi so each `api.on(event, handler)` registration is traced.
|
|
108
|
+
*
|
|
109
|
+
* @param api — the upstream PluginApi from openclaw
|
|
110
|
+
* @param pluginLabel — short tag identifying which cc-openclaw subsystem
|
|
111
|
+
* is registering (e.g. 'cc-handler', 'injector', 'tool-tracker'). Shows
|
|
112
|
+
* up in the debug log as `plugin` so we can filter by subsystem.
|
|
113
|
+
*
|
|
114
|
+
* When CC_OPENCLAW_DEBUG is unset/false, returns the api unchanged so
|
|
115
|
+
* there is zero proxy overhead in production.
|
|
116
|
+
*/
|
|
117
|
+
export function wrapApiWithDebugTap(api, pluginLabel) {
|
|
118
|
+
if (!debugEnabled())
|
|
119
|
+
return api;
|
|
120
|
+
const originalOn = api.on.bind(api);
|
|
121
|
+
return new Proxy(api, {
|
|
122
|
+
get(target, prop, receiver) {
|
|
123
|
+
if (prop === 'on') {
|
|
124
|
+
return (event, handler) => {
|
|
125
|
+
const wrappedHandler = async (...args) => {
|
|
126
|
+
const startTs = Date.now();
|
|
127
|
+
writeEntry({
|
|
128
|
+
ts: new Date(startTs).toISOString(),
|
|
129
|
+
plugin: pluginLabel,
|
|
130
|
+
event,
|
|
131
|
+
phase: 'enter',
|
|
132
|
+
arg0: summarizeArg(args[0]),
|
|
133
|
+
arg1: summarizeArg(args[1]),
|
|
134
|
+
});
|
|
135
|
+
try {
|
|
136
|
+
const result = await handler(...args);
|
|
137
|
+
writeEntry({
|
|
138
|
+
ts: new Date().toISOString(),
|
|
139
|
+
plugin: pluginLabel,
|
|
140
|
+
event,
|
|
141
|
+
phase: 'exit',
|
|
142
|
+
durationMs: Date.now() - startTs,
|
|
143
|
+
result: result === undefined
|
|
144
|
+
? 'undefined'
|
|
145
|
+
: typeof result === 'object'
|
|
146
|
+
? summarizeArg(result)
|
|
147
|
+
: String(result).slice(0, 120),
|
|
148
|
+
});
|
|
149
|
+
return result;
|
|
150
|
+
}
|
|
151
|
+
catch (err) {
|
|
152
|
+
writeEntry({
|
|
153
|
+
ts: new Date().toISOString(),
|
|
154
|
+
plugin: pluginLabel,
|
|
155
|
+
event,
|
|
156
|
+
phase: 'error',
|
|
157
|
+
durationMs: Date.now() - startTs,
|
|
158
|
+
error: err instanceof Error ? err.message : String(err),
|
|
159
|
+
stack: err instanceof Error
|
|
160
|
+
? err.stack?.split('\n').slice(0, 6).join('\n')
|
|
161
|
+
: undefined,
|
|
162
|
+
});
|
|
163
|
+
throw err;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
return originalOn(event, wrappedHandler);
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
return Reflect.get(target, prop, receiver);
|
|
170
|
+
},
|
|
171
|
+
});
|
|
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
|
+
}
|
|
185
|
+
//# sourceMappingURL=debug-tap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-tap.js","sourceRoot":"","sources":["../../../src/lib/debug-tap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAG9B,MAAM,UAAU,GAAG,mBAAmB,CAAC;AACvC,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;AACpF,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,yBAAyB,CAAC,CAAC;AAE/E,SAAS,YAAY;IACnB,MAAM,CAAC,G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EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gCAC5B,MAAM,EAAE,WAAW;gCACnB,KAAK;gCACL,KAAK,EAAE,OAAO;gCACd,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO;gCAChC,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;gCACvD,KAAK,EACH,GAAG,YAAY,KAAK;oCAClB,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;oCAC/C,CAAC,CAAC,SAAS;6BAChB,CAAC,CAAC;4BACH,MAAM,GAAG,CAAC;wBACZ,CAAC;oBACH,CAAC,CAAC;oBACF,OAAO,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;gBAC3C,CAAC,CAAC;YACJ,CAAC;YACD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,sBAAsB;IACpC,IAAI,WAAW,EAAE,CAAC;QAChB,IAAI,CAAC;YACH,WAAW,CAAC,GAAG,EAAE,CAAC;QACpB,CAAC;QAAC,MAAM,CAAC;YACP,YAAY;QACd,CAAC;QACD,WAAW,GAAG,IAAI,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -67,7 +67,8 @@ export declare function extractMessage(error: unknown): string;
|
|
|
67
67
|
/** Escape characters special to Telegram MarkdownV2. */
|
|
68
68
|
export declare function escapeMdV2(text: string): string;
|
|
69
69
|
/**
|
|
70
|
-
* Pure formatter — no side effects,
|
|
70
|
+
* Pure formatter — no side effects on the return value, but DOES emit
|
|
71
|
+
* trajectory + metrics events for centralized observability per Pillars A+B.
|
|
71
72
|
*
|
|
72
73
|
* @param error The thrown value (Error instance, string, or unknown)
|
|
73
74
|
* @param context Structured context including mandatory error code
|
|
@@ -75,4 +76,3 @@ export declare function escapeMdV2(text: string): string;
|
|
|
75
76
|
export declare function formatError(error: unknown, context: ErrorContext): FormattedError;
|
|
76
77
|
/** Shorthand for the common "unknown catch block" pattern. */
|
|
77
78
|
export declare function formatUnknownError(error: unknown, sessionId?: string): FormattedError;
|
|
78
|
-
//# sourceMappingURL=error-formatter.d.ts.map
|
|
@@ -92,8 +92,14 @@ const SEVERITY_EMOJI = {
|
|
|
92
92
|
info: '✅',
|
|
93
93
|
};
|
|
94
94
|
// ─── Core formatter ───────────────────────────────────────────────────────────
|
|
95
|
+
// Trajectory + metrics emitters loaded lazily to keep formatError pure-fn-able
|
|
96
|
+
// and test-friendly. Both modules are no-op when their respective env flags
|
|
97
|
+
// are unset, so the import itself has zero runtime cost.
|
|
98
|
+
import { emit as emitTrajectory } from './trajectory.js';
|
|
99
|
+
import { metricsRegistry } from '../health/metrics.js';
|
|
95
100
|
/**
|
|
96
|
-
* Pure formatter — no side effects,
|
|
101
|
+
* Pure formatter — no side effects on the return value, but DOES emit
|
|
102
|
+
* trajectory + metrics events for centralized observability per Pillars A+B.
|
|
97
103
|
*
|
|
98
104
|
* @param error The thrown value (Error instance, string, or unknown)
|
|
99
105
|
* @param context Structured context including mandatory error code
|
|
@@ -103,6 +109,15 @@ export function formatError(error, context) {
|
|
|
103
109
|
const stack = extractStack(error);
|
|
104
110
|
const severity = SEVERITY_BY_CODE[context.code] ?? 'error';
|
|
105
111
|
const ts = new Date().toISOString();
|
|
112
|
+
// Pillar A v0.4.0: bump errors_total + last_error_seconds for /metrics
|
|
113
|
+
metricsRegistry.recordError(context.code);
|
|
114
|
+
// Pillar B v0.4.0: emit trajectory event (no-op if CC_OPENCLAW_TRAJECTORY unset)
|
|
115
|
+
emitTrajectory('error', {
|
|
116
|
+
code: context.code,
|
|
117
|
+
severity,
|
|
118
|
+
message: message.slice(0, 500),
|
|
119
|
+
...(context.details !== undefined ? { details: context.details } : {}),
|
|
120
|
+
}, context.sessionId);
|
|
106
121
|
const jsonlRow = {
|
|
107
122
|
ts,
|
|
108
123
|
code: context.code,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-formatter.js","sourceRoot":"","sources":["../../../src/lib/error-formatter.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,gFAAgF;AAEhF,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,YAAY,EAAE,0BAA0B;IACxC,eAAe,EAAE,6BAA6B;IAC9C,aAAa,EAAE,2BAA2B;IAC1C,cAAc,EAAE,4BAA4B;IAC5C,mBAAmB,EAAE,iCAAiC;IACtD,eAAe,EAAE,6BAA6B;IAC9C,WAAW,EAAE,yBAAyB;IACtC,aAAa,EAAE,2BAA2B;IAC1C,WAAW,EAAE,yBAAyB;IACtC,YAAY,EAAE,0BAA0B;IACxC,aAAa,EAAE,2BAA2B;IAC1C,OAAO,EAAE,qBAAqB;IAC9B,UAAU,EAAE,wBAAwB;IACpC,OAAO,EAAE,qBAAqB;CACtB,CAAC;AAMX,MAAM,gBAAgB,GAAgC;IACpD,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE,OAAO;IACnC,CAAC,WAAW,CAAC,eAAe,CAAC,EAAE,SAAS;IACxC,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,UAAU;IACvC,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE,SAAS;IACvC,CAAC,WAAW,CAAC,mBAAmB,CAAC,EAAE,OAAO;IAC1C,CAAC,WAAW,CAAC,eAAe,CAAC,EAAE,UAAU;IACzC,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,MAAM;IACjC,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,OAAO;IACpC,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,OAAO;IAClC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,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -42,4 +42,3 @@ export declare function isHeartbeatRequest(req: SdkRequestPayload): boolean;
|
|
|
42
42
|
* payload object (does not mutate input).
|
|
43
43
|
*/
|
|
44
44
|
export declare function applyHeartbeatWorkaround(req: SdkRequestPayload): SdkRequestPayload;
|
|
45
|
-
//# sourceMappingURL=heartbeat-workaround.d.ts.map
|
package/dist/src/lib/index.d.ts
CHANGED
|
@@ -5,4 +5,3 @@ export { isCacheParityEnabled, hashPrompt, recordAttachment, readRegistry, REGIS
|
|
|
5
5
|
export { selectEngine, isCcOpenclawEnabled, captureSessionRoute, ACTIVE_FLAG_ENV, ROUTE_FLAG_ENV, type Engine, type SessionRoute, } from './route-flag.js';
|
|
6
6
|
export { isTestMode, TEST_MODE_ENV, _setTestModeForTests } from './test-mode.js';
|
|
7
7
|
export { getAggressiveStripEnabled, getCacheParityEnabled, getLogLevel, isLogLevelDebug, } from './config.js';
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,34 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Centralized register-guard — eliminates listener stacking systemwide.
|
|
3
3
|
* Each plugin module gets its own guard instance via createRegisterGuard().
|
|
4
|
-
* Multiple register() calls with same id → no-op
|
|
4
|
+
* Multiple register() calls with same (api, id) → no-op; new api → re-fire.
|
|
5
5
|
*
|
|
6
|
-
* Rationale (revised 2026-
|
|
7
|
-
* The openclaw gateway
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
6
|
+
* Rationale (revised 2026-05-06 after observed dispatch-registry blackout):
|
|
7
|
+
* The openclaw gateway 2026.4.29+ creates MULTIPLE plugin registries per
|
|
8
|
+
* process when running in `gateway-bindable` runtime mode (origin=bundled
|
|
9
|
+
* plugins activate it; the loader at loader-CLyHx60E.js:3690-3697 attempts
|
|
10
|
+
* to merge subsequent default-mode loads into the gateway-bindable
|
|
11
|
+
* registry, but this only succeeds when cache keys match). When cache keys
|
|
12
|
+
* differ, the boot-time register() lands in registry A, and the dispatch
|
|
13
|
+
* path reads from registry B — hooks register fine but never invoke.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Process-wide id-only keying (the 2026-04-29 approach) blocked re-wiring
|
|
16
|
+
* into registry B because the second register() call hits the guard and
|
|
17
|
+
* skips its api.on() calls — leaving no listeners in the dispatch registry
|
|
18
|
+
* even though they DID register in the boot registry.
|
|
18
19
|
*
|
|
19
|
-
* Current behavior: track
|
|
20
|
-
*
|
|
20
|
+
* Current behavior: track per-(api, id) via WeakMap<api, Set<id>>. Same
|
|
21
|
+
* api object passed twice → idempotent skip. New api object → fresh
|
|
22
|
+
* Set, body re-fires, api.on() lands in the new registry. The 2026-04-29
|
|
23
|
+
* stacking concern (multiple api instances wrapping ONE shared bus →
|
|
24
|
+
* listener duplication) is resolved at the wrapApiWithDebugTap layer and
|
|
25
|
+
* by api.on's own dedup; per-bus idempotency is the wrong layer here.
|
|
26
|
+
*
|
|
27
|
+
* Fallback: if api is null/undefined/primitive, use a process-wide Set
|
|
28
|
+
* (no WeakMap key available). Preserves safety for synthetic test calls.
|
|
21
29
|
*
|
|
22
30
|
* Telemetry: when OPENCLAW_REGISTER_DEBUG=1, emits a structured event per
|
|
23
31
|
* register call (id, registered_before, timestamp). Sibling agent
|
|
24
32
|
* cco-hardening-B implements telemetry.ts which consumes these events.
|
|
25
33
|
*/
|
|
26
34
|
export interface RegisterGuard {
|
|
27
|
-
/** Wraps the actual register body —
|
|
35
|
+
/** Wraps the actual register body — runs once per (api, id) pair. */
|
|
28
36
|
guard(id: string, api: unknown, body: () => void): void;
|
|
29
|
-
/** Test-only reset. */
|
|
37
|
+
/** Test-only reset (clears fallback only; WeakMap GCs naturally). */
|
|
30
38
|
_resetForTests(): void;
|
|
31
|
-
/** Inspector for tests / telemetry. */
|
|
39
|
+
/** Inspector for tests / telemetry (fallback Set only). */
|
|
32
40
|
isRegistered(id: string): boolean;
|
|
33
41
|
}
|
|
34
42
|
export declare function createRegisterGuard(): RegisterGuard;
|
|
@@ -46,4 +54,3 @@ export declare const defaultRegisterGuard: RegisterGuard;
|
|
|
46
54
|
* (no idempotency wrapper) fail.
|
|
47
55
|
*/
|
|
48
56
|
export declare function registerOnce(id: string, api: unknown, body: () => void): void;
|
|
49
|
-
//# sourceMappingURL=register-guard.d.ts.map
|
|
@@ -1,23 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Centralized register-guard — eliminates listener stacking systemwide.
|
|
3
3
|
* Each plugin module gets its own guard instance via createRegisterGuard().
|
|
4
|
-
* Multiple register() calls with same id → no-op
|
|
4
|
+
* Multiple register() calls with same (api, id) → no-op; new api → re-fire.
|
|
5
5
|
*
|
|
6
|
-
* Rationale (revised 2026-
|
|
7
|
-
* The openclaw gateway
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
6
|
+
* Rationale (revised 2026-05-06 after observed dispatch-registry blackout):
|
|
7
|
+
* The openclaw gateway 2026.4.29+ creates MULTIPLE plugin registries per
|
|
8
|
+
* process when running in `gateway-bindable` runtime mode (origin=bundled
|
|
9
|
+
* plugins activate it; the loader at loader-CLyHx60E.js:3690-3697 attempts
|
|
10
|
+
* to merge subsequent default-mode loads into the gateway-bindable
|
|
11
|
+
* registry, but this only succeeds when cache keys match). When cache keys
|
|
12
|
+
* differ, the boot-time register() lands in registry A, and the dispatch
|
|
13
|
+
* path reads from registry B — hooks register fine but never invoke.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Process-wide id-only keying (the 2026-04-29 approach) blocked re-wiring
|
|
16
|
+
* into registry B because the second register() call hits the guard and
|
|
17
|
+
* skips its api.on() calls — leaving no listeners in the dispatch registry
|
|
18
|
+
* even though they DID register in the boot registry.
|
|
18
19
|
*
|
|
19
|
-
* Current behavior: track
|
|
20
|
-
*
|
|
20
|
+
* Current behavior: track per-(api, id) via WeakMap<api, Set<id>>. Same
|
|
21
|
+
* api object passed twice → idempotent skip. New api object → fresh
|
|
22
|
+
* Set, body re-fires, api.on() lands in the new registry. The 2026-04-29
|
|
23
|
+
* stacking concern (multiple api instances wrapping ONE shared bus →
|
|
24
|
+
* listener duplication) is resolved at the wrapApiWithDebugTap layer and
|
|
25
|
+
* by api.on's own dedup; per-bus idempotency is the wrong layer here.
|
|
26
|
+
*
|
|
27
|
+
* Fallback: if api is null/undefined/primitive, use a process-wide Set
|
|
28
|
+
* (no WeakMap key available). Preserves safety for synthetic test calls.
|
|
21
29
|
*
|
|
22
30
|
* Telemetry: when OPENCLAW_REGISTER_DEBUG=1, emits a structured event per
|
|
23
31
|
* register call (id, registered_before, timestamp). Sibling agent
|
|
@@ -25,22 +33,35 @@
|
|
|
25
33
|
*/
|
|
26
34
|
import { isRegisterDebugEnabled } from './config.js';
|
|
27
35
|
export function createRegisterGuard() {
|
|
28
|
-
const
|
|
36
|
+
const perApi = new WeakMap();
|
|
37
|
+
const fallbackState = new Set();
|
|
38
|
+
function idsFor(api) {
|
|
39
|
+
if (api && (typeof api === 'object' || typeof api === 'function')) {
|
|
40
|
+
const key = api;
|
|
41
|
+
let ids = perApi.get(key);
|
|
42
|
+
if (!ids) {
|
|
43
|
+
ids = new Set();
|
|
44
|
+
perApi.set(key, ids);
|
|
45
|
+
}
|
|
46
|
+
return ids;
|
|
47
|
+
}
|
|
48
|
+
return fallbackState;
|
|
49
|
+
}
|
|
29
50
|
return {
|
|
30
|
-
guard(id,
|
|
31
|
-
|
|
32
|
-
|
|
51
|
+
guard(id, api, body) {
|
|
52
|
+
const ids = idsFor(api);
|
|
53
|
+
if (ids.has(id)) {
|
|
33
54
|
if (isRegisterDebugEnabled()) {
|
|
34
55
|
process.stderr.write(JSON.stringify({
|
|
35
56
|
ts: new Date().toISOString(),
|
|
36
57
|
type: 'register-guard.skip',
|
|
37
58
|
id,
|
|
38
|
-
reason: 'already-registered',
|
|
59
|
+
reason: 'already-registered-on-this-api',
|
|
39
60
|
}) + '\n');
|
|
40
61
|
}
|
|
41
62
|
return;
|
|
42
63
|
}
|
|
43
|
-
|
|
64
|
+
ids.add(id);
|
|
44
65
|
if (isRegisterDebugEnabled()) {
|
|
45
66
|
process.stderr.write(JSON.stringify({
|
|
46
67
|
ts: new Date().toISOString(),
|
|
@@ -50,8 +71,8 @@ export function createRegisterGuard() {
|
|
|
50
71
|
}
|
|
51
72
|
body();
|
|
52
73
|
},
|
|
53
|
-
_resetForTests() {
|
|
54
|
-
isRegistered(id) { return
|
|
74
|
+
_resetForTests() { fallbackState.clear(); /* WeakMap GCs naturally */ },
|
|
75
|
+
isRegistered(id) { return fallbackState.has(id); },
|
|
55
76
|
};
|
|
56
77
|
}
|
|
57
78
|
/** Default singleton — most modules import this directly for simplicity. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-guard.js","sourceRoot":"","sources":["../../../src/lib/register-guard.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"register-guard.js","sourceRoot":"","sources":["../../../src/lib/register-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAWrD,MAAM,UAAU,mBAAmB;IACjC,MAAM,MAAM,GAAG,IAAI,OAAO,EAAuB,CAAC;IAClD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IAExC,SAAS,MAAM,CAAC,GAAY;QAC1B,IAAI,GAAG,IAAI,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,UAAU,CAAC,EAAE,CAAC;YAClE,MAAM,GAAG,GAAG,GAAa,CAAC;YAC1B,IAAI,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CA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ED,4EAA4E;AAC5E,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,EAAE,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,EAAU,EAAE,GAAY,EAAE,IAAgB;IACrE,oBAAoB,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* status-tee-reader — reads quota status files written by the existing
|
|
3
|
+
* telegram-ux/quota-fetcher.js process at /tmp/openclaw-ux-status/.
|
|
4
|
+
*
|
|
5
|
+
* The fetcher (in a different process, CJS) periodically polls Anthropic's
|
|
6
|
+
* /api/oauth/usage and writes JSON snapshots to /tmp/openclaw-ux-status/.
|
|
7
|
+
* cc-openclaw consumes them via this reader rather than importing the
|
|
8
|
+
* fetcher directly (cross-process + CJS/ESM mismatch).
|
|
9
|
+
*
|
|
10
|
+
* If no fresh file exists (cold-boot, fetcher offline, >10min stale),
|
|
11
|
+
* returns null. The /cc status panel renders "Plan: ?% (no data)" then.
|
|
12
|
+
*/
|
|
13
|
+
export interface QuotaWindow {
|
|
14
|
+
usedPercent: number;
|
|
15
|
+
resetsAt: number;
|
|
16
|
+
}
|
|
17
|
+
export interface QuotaSnapshot {
|
|
18
|
+
fiveHour: QuotaWindow | null;
|
|
19
|
+
sevenDay: QuotaWindow | null;
|
|
20
|
+
ageMs: number;
|
|
21
|
+
}
|
|
22
|
+
/** Read most recent status-tee file. Returns null if missing/stale/invalid. */
|
|
23
|
+
export declare function readQuotaSnapshot(dir?: string): QuotaSnapshot | null;
|
|
24
|
+
/**
|
|
25
|
+
* Convert quota snapshot to a single-line panel summary.
|
|
26
|
+
* Color emoji: 🟢 <60%, 🟡 60-85%, 🔴 >85%.
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatQuotaLine(snapshot: QuotaSnapshot | null): string;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// phase: 4 | pillar: C v0.4.0 | agent: Primary
|
|
2
|
+
/**
|
|
3
|
+
* status-tee-reader — reads quota status files written by the existing
|
|
4
|
+
* telegram-ux/quota-fetcher.js process at /tmp/openclaw-ux-status/.
|
|
5
|
+
*
|
|
6
|
+
* The fetcher (in a different process, CJS) periodically polls Anthropic's
|
|
7
|
+
* /api/oauth/usage and writes JSON snapshots to /tmp/openclaw-ux-status/.
|
|
8
|
+
* cc-openclaw consumes them via this reader rather than importing the
|
|
9
|
+
* fetcher directly (cross-process + CJS/ESM mismatch).
|
|
10
|
+
*
|
|
11
|
+
* If no fresh file exists (cold-boot, fetcher offline, >10min stale),
|
|
12
|
+
* returns null. The /cc status panel renders "Plan: ?% (no data)" then.
|
|
13
|
+
*/
|
|
14
|
+
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
15
|
+
import { join } from 'node:path';
|
|
16
|
+
const STATUS_TEE_DIR = '/tmp/openclaw-ux-status';
|
|
17
|
+
const STALE_MS = 10 * 60 * 1000;
|
|
18
|
+
/** Read most recent status-tee file. Returns null if missing/stale/invalid. */
|
|
19
|
+
export function readQuotaSnapshot(dir = STATUS_TEE_DIR) {
|
|
20
|
+
let entries;
|
|
21
|
+
try {
|
|
22
|
+
entries = readdirSync(dir);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
let newest = null;
|
|
28
|
+
for (const name of entries) {
|
|
29
|
+
if (!name.endsWith('.json'))
|
|
30
|
+
continue;
|
|
31
|
+
const p = join(dir, name);
|
|
32
|
+
try {
|
|
33
|
+
const st = statSync(p);
|
|
34
|
+
if (!newest || st.mtimeMs > newest.mtime)
|
|
35
|
+
newest = { path: p, mtime: st.mtimeMs };
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
/* skip unreadable */
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (!newest)
|
|
42
|
+
return null;
|
|
43
|
+
const ageMs = Date.now() - newest.mtime;
|
|
44
|
+
if (ageMs > STALE_MS)
|
|
45
|
+
return null;
|
|
46
|
+
let parsed;
|
|
47
|
+
try {
|
|
48
|
+
parsed = JSON.parse(readFileSync(newest.path, 'utf8'));
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
fiveHour: parseWindow(parsed.fiveHour),
|
|
55
|
+
sevenDay: parseWindow(parsed.sevenDay),
|
|
56
|
+
ageMs,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function parseWindow(v) {
|
|
60
|
+
if (!v || typeof v !== 'object')
|
|
61
|
+
return null;
|
|
62
|
+
const o = v;
|
|
63
|
+
if (typeof o.usedPercent !== 'number' || typeof o.resetsAt !== 'number')
|
|
64
|
+
return null;
|
|
65
|
+
return { usedPercent: o.usedPercent, resetsAt: o.resetsAt };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Convert quota snapshot to a single-line panel summary.
|
|
69
|
+
* Color emoji: 🟢 <60%, 🟡 60-85%, 🔴 >85%.
|
|
70
|
+
*/
|
|
71
|
+
export function formatQuotaLine(snapshot) {
|
|
72
|
+
if (!snapshot)
|
|
73
|
+
return 'Plan: ?% (no data)';
|
|
74
|
+
const w = snapshot.sevenDay ?? snapshot.fiveHour;
|
|
75
|
+
if (!w)
|
|
76
|
+
return 'Plan: ?% (window data missing)';
|
|
77
|
+
const pct = Math.round(w.usedPercent);
|
|
78
|
+
const emoji = pct < 60 ? '🟢' : pct <= 85 ? '🟡' : '🔴';
|
|
79
|
+
const resetIn = Math.max(0, Math.floor((w.resetsAt * 1000 - Date.now()) / 86_400_000));
|
|
80
|
+
return `Plan: ${pct}% ${emoji} (resets in ${resetIn}d)`;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=status-tee-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-tee-reader.js","sourceRoot":"","s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I,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IACvF,OAAO,SAAS,GAAG,KAAK,KAAK,eAAe,OAAO,IAAI,CAAC;AAC1D,CAAC"}
|
|
@@ -51,4 +51,3 @@ export declare function isStripEnabled(opts?: StripOptions): boolean;
|
|
|
51
51
|
* Source: cwd-enhancer.js lines 800–856; P1 port: session-bootstrap/sysprompt-strip.ts
|
|
52
52
|
*/
|
|
53
53
|
export declare function stripSysprompt(content: string, opts?: StripOptions): StripResult;
|
|
54
|
-
//# sourceMappingURL=sysprompt-strip.d.ts.map
|
|
@@ -36,4 +36,3 @@ export declare function recordRegister(event: Omit<RegisterEvent, 'ts'>): void;
|
|
|
36
36
|
export declare function _setCostWriterForTests(writer: (event: CostEvent) => void): void;
|
|
37
37
|
export declare function _setRegisterWriterForTests(writer: (event: RegisterEvent) => void): void;
|
|
38
38
|
export declare function _restoreDefaultsForTests(): void;
|
|
39
|
-
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -24,4 +24,3 @@ export declare const TEST_MODE_ENV = "OPENCLAW_PLUGIN_TEST_MODE";
|
|
|
24
24
|
export declare function isTestMode(): boolean;
|
|
25
25
|
/** For tests — explicit set/unset (operates on process.env). */
|
|
26
26
|
export declare function _setTestModeForTests(on: boolean): void;
|
|
27
|
-
//# sourceMappingURL=test-mode.d.ts.map
|