mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-19 15:04:46 +00:00
Adds owner-level startup trace attribution for gateway auth, plugin loading, lookup counts, and plugin sidecar services.
Verification:
- node scripts/run-vitest.mjs src/plugins/startup-trace-segment.test.ts src/plugins/services.test.ts src/plugins/loader.test.ts src/gateway/server-startup-config.secrets.test.ts
- pnpm build
- pnpm check
CI override:
- Red checks are unrelated baseline noise. The failed CI shard is src/cli/plugins-install-persist.test.ts, which fails on origin/main 336ba2a2b3 with the same missing resolveIsNixMode mock export. PR #81738 touches gateway/plugin startup trace files and CHANGELOG.md, not the failing CLI plugin install test.
Thanks @samzong.
Co-authored-by: samzong <13782141+samzong@users.noreply.github.com>
18 lines
492 B
TypeScript
18 lines
492 B
TypeScript
const SAFE_STARTUP_TRACE_SEGMENT_CHAR = /^[A-Za-z0-9_-]$/u;
|
|
|
|
export function encodeStartupTraceSegment(value: string): string {
|
|
if (!value) {
|
|
return "~";
|
|
}
|
|
let encoded = "";
|
|
for (let index = 0; index < value.length; index += 1) {
|
|
const char = value[index] ?? "";
|
|
if (SAFE_STARTUP_TRACE_SEGMENT_CHAR.test(char)) {
|
|
encoded += char;
|
|
continue;
|
|
}
|
|
encoded += `~${value.charCodeAt(index).toString(16).toUpperCase().padStart(4, "0")}`;
|
|
}
|
|
return encoded;
|
|
}
|