diff --git a/open-sse/services/systemTransforms.ts b/open-sse/services/systemTransforms.ts index 5e06dfdd12..ebdaaae0d3 100644 --- a/open-sse/services/systemTransforms.ts +++ b/open-sse/services/systemTransforms.ts @@ -326,7 +326,12 @@ export function applyTransformPipeline( const flushBaseRun = () => { if (baseRun.length === 0) return; const config: CcBridgeTransformsConfig = { enabled: true, pipeline: baseRun }; - const result = applyCcBridgeTransformPipeline(body, config); + // Local `RequestBody` interface is intentionally looser than the strict one + // exported by ccBridgeTransforms — system transforms accept any shape. + const result = applyCcBridgeTransformPipeline( + body as Parameters[0], + config + ); appliedOpKinds.push(...result.appliedOpKinds); baseRun = []; }; diff --git a/src/app/(dashboard)/dashboard/settings/components/RoutingTab.tsx b/src/app/(dashboard)/dashboard/settings/components/RoutingTab.tsx index 63d64a6873..1b30faa61d 100644 --- a/src/app/(dashboard)/dashboard/settings/components/RoutingTab.tsx +++ b/src/app/(dashboard)/dashboard/settings/components/RoutingTab.tsx @@ -1,7 +1,7 @@ "use client"; import { useEffect, useMemo, useState } from "react"; -import { Button, Card } from "@/shared/components"; +import { Button, Card, Input, Select, Toggle } from "@/shared/components"; import { useTranslations } from "next-intl"; import FallbackChainsEditor from "./FallbackChainsEditor"; import { @@ -189,246 +189,254 @@ function makeDefaultOp(kind: TransformOpKind): any { } } -function OpEditor({ op, onChange }: { op: any; onChange: (next: any) => void }) { - const inputCls = - "w-full rounded border border-border/50 bg-background/40 px-2 py-1 text-xs font-mono text-text"; - const labelCls = "block text-[11px] text-text-muted mb-0.5"; - - const updateField = (field: string, value: any) => onChange({ ...op, [field]: value }); - - const updateListItem = (field: string, idx: number, value: string) => { - const arr = [...(op[field] || [])]; - arr[idx] = value; - onChange({ ...op, [field]: arr }); - }; - - const addListItem = (field: string) => onChange({ ...op, [field]: [...(op[field] || []), ""] }); - - const removeListItem = (field: string, idx: number) => { - const arr = [...(op[field] || [])]; - arr.splice(idx, 1); - onChange({ ...op, [field]: arr }); - }; - - const renderList = (field: string) => ( -
- {(op[field] || []).map((item: string, idx: number) => ( -
- void; + disabled?: boolean; +}) { + return ( +
+ {label} + {items.map((item, idx) => ( +
+ updateListItem(field, idx, e.target.value)} + disabled={disabled} + onChange={(e) => { + const next = [...items]; + next[idx] = e.target.value; + onChange(next); + }} + /> +
))} - + Add entry +
); +} + +function OpEditor({ + op, + onChange, + disabled, +}: { + op: any; + onChange: (next: any) => void; + disabled?: boolean; +}) { + const updateField = (field: string, value: any) => onChange({ ...op, [field]: value }); switch (op?.kind) { case "drop_paragraph_if_contains": return ( -
- - {renderList("needles")} - +
+ updateField("needles", next)} + disabled={disabled} + /> + updateField("caseSensitive", c)} + size="sm" + disabled={disabled} + />
); case "drop_paragraph_if_starts_with": return ( -
- - {renderList("prefixes")} - +
+ updateField("prefixes", next)} + disabled={disabled} + /> + updateField("caseSensitive", c)} + size="sm" + disabled={disabled} + />
); case "replace_text": return ( -
-
- - updateField("match", e.target.value)} - /> -
-
- - updateField("replacement", e.target.value)} - /> -
- +
+ updateField("match", e.target.value)} + /> + updateField("replacement", e.target.value)} + /> + updateField("allOccurrences", c)} + size="sm" + disabled={disabled} + />
); case "replace_regex": return ( -
-
- - updateField("pattern", e.target.value)} - /> -
-
- - updateField("flags", e.target.value)} - /> -
-
- - updateField("replacement", e.target.value)} - /> -
+
+ updateField("pattern", e.target.value)} + /> + updateField("flags", e.target.value)} + /> + updateField("replacement", e.target.value)} + />
); case "drop_block_if_contains": return ( -
- - {renderList("needles")} -
+ updateField("needles", next)} + disabled={disabled} + /> ); case "prepend_system_block": case "append_system_block": return ( -
-
- +
+
+