mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-05 23:02:10 +03:00
refactor(system-transforms): caveman-review cleanup + logging
- Remove dead setWordsForOp function (unused, acknowledged in comment) - Remove unused obfuscateSensitiveWords import and re-export from systemTransforms - Increase textarea rows cap from 20→40 for long CC-bridge pipelines (~100 lines JSON) - Add [SystemTransforms] console.log at both call sites (cc-bridge step 5b + claude native path) Tests: 58/58 green
This commit is contained in:
@@ -789,7 +789,14 @@ export class BaseExecutor {
|
||||
// sensitive words). It deliberately does NOT include
|
||||
// `inject_billing_header` — billing + sentinel are already
|
||||
// prepended above. Users can extend the pipeline via Settings UI.
|
||||
applySystemTransformPipeline(PROVIDER_CLAUDE, tb);
|
||||
{
|
||||
const transformResult = applySystemTransformPipeline(PROVIDER_CLAUDE, tb);
|
||||
if (transformResult.appliedOpKinds.length > 0) {
|
||||
console.log(
|
||||
`[SystemTransforms] claude-native: ${transformResult.appliedOpKinds.join(", ")}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!tb.metadata || typeof tb.metadata !== "object") tb.metadata = {};
|
||||
(tb.metadata as Record<string, unknown>).user_id = buildUserIdJson({
|
||||
|
||||
@@ -339,10 +339,15 @@ export async function buildAndSignClaudeCodeRequest(
|
||||
// Routed via the generic per-provider DSL so the same pipeline shape covers
|
||||
// the CC bridge, the native `claude` path, and any other configured
|
||||
// provider. Idempotent on re-run.
|
||||
applySystemTransformPipeline(
|
||||
PROVIDER_CC_BRIDGE,
|
||||
body as Parameters<typeof applySystemTransformPipeline>[1]
|
||||
);
|
||||
{
|
||||
const transformResult = applySystemTransformPipeline(
|
||||
PROVIDER_CC_BRIDGE,
|
||||
body as Parameters<typeof applySystemTransformPipeline>[1]
|
||||
);
|
||||
if (transformResult.appliedOpKinds.length > 0) {
|
||||
console.log(`[SystemTransforms] cc-bridge: ${transformResult.appliedOpKinds.join(", ")}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Step 6: Obfuscation (optional, per-provider setting)
|
||||
if (enableObfuscation) {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*
|
||||
* Reference: OmniRoute issue #2260 + comment 4459544580 (Open WebUI bypass).
|
||||
*/
|
||||
import { obfuscateSensitiveWords } from "./claudeCodeObfuscation.ts";
|
||||
|
||||
import {
|
||||
applyCcBridgeTransformPipeline,
|
||||
CLAUDE_AGENT_SDK_IDENTITY,
|
||||
@@ -213,18 +213,6 @@ interface RequestBody {
|
||||
// Op: obfuscate_words (the only op kind beyond the base set).
|
||||
// ────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
function setWordsForOp(words: string[]): void {
|
||||
// Reuse the existing obfuscation engine — but it reads from its own module
|
||||
// singleton. We swap the words for this op invocation; obfuscateSensitiveWords
|
||||
// uses the module-level `sensitiveWords` array via setSensitiveWords.
|
||||
// To keep this stateless across concurrent requests, we instead call
|
||||
// obfuscateSensitiveWordsCustom (defined below) which takes the words list
|
||||
// explicitly.
|
||||
// — unused (intentional, see obfuscateWithList below).
|
||||
void words;
|
||||
}
|
||||
void setWordsForOp;
|
||||
|
||||
function escapeRegex(str: string): string {
|
||||
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
}
|
||||
@@ -298,10 +286,6 @@ function applyObfuscateWords(body: RequestBody, op: ObfuscateWordsOp): void {
|
||||
}
|
||||
}
|
||||
|
||||
// Silence unused-import warning on obfuscateSensitiveWords — re-export for
|
||||
// callers that want the global-singleton variant.
|
||||
export { obfuscateSensitiveWords };
|
||||
|
||||
// ────────────────────────────────────────────────────────────────────────────
|
||||
// Pipeline executor (delegates base ops to applyCcBridgeTransformPipeline).
|
||||
// ────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -708,7 +708,7 @@ export default function RoutingTab() {
|
||||
onChange={(e) =>
|
||||
setJsonDrafts((prev) => ({ ...prev, [providerId]: e.target.value }))
|
||||
}
|
||||
rows={Math.min(20, Math.max(8, draft.split("\n").length))}
|
||||
rows={Math.min(40, Math.max(8, draft.split("\n").length))}
|
||||
disabled={loading}
|
||||
spellCheck={false}
|
||||
className="w-full rounded border border-border/50 bg-background/40 p-2 font-mono text-[11px] text-text resize-y"
|
||||
|
||||
Reference in New Issue
Block a user