diff --git a/AGENTS.md b/AGENTS.md
index 482a094..68d7089 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -26,7 +26,7 @@ Core pipeline: GitHub Webhook → Worker (verify + filter + format) → Discord
- Per-group forge branding: optional `Group.forgeSources` (a list of `{ host, type: "github" | "gitea", name? }` the group defines itself) labels each message's footer with the first entry whose type matches the event's provider and whose host matches the repository URL's hostname (GitHub matches `github.com`, so two Gitea instances can be `git1.example.com`/`git2.example.com`); the label is the entry's optional `name` (fallback: host); links are derived from the repo URL and footer icons use raster PNGs Discord renders (GitHub's `fluidicon.png`, Gitea's `/assets/img/favicon.png` — `.ico` favicons are silently ignored); Discord shows the footer icon + name, Telegram a linked name
- Delivery queue: when the `QUEUE` binding is present, webhook ingress enqueues one message per event (not per target) to a Cloudflare Queue (`webhooker-delivery`); a Nitro `cloudflare:queue` plugin consumes batches, dispatches, and retries retryable failures (5xx/network/429-exhaustion) with exponential backoff (5s/30s/2m/10m) up to the queue `max_retries`, after which the DLQ (`webhooker-delivery-dlq`) marks the delivery dead. Oversized payloads (>~100 KB) are parked in R2 (`webhooks/YYYY/MM/DD/*.json`, falling back to KV `queue:payload:*` without the R2 binding) and resolved by the consumer; delivery state is tracked as the D1 `delivery_state` table (KV `delivery-state:*` fallback). Without the `QUEUE` binding, dispatch stays inline (existing behavior)
- Storage quotas: the design avoids KV write pressure (Workers Free KV allows ~1,000 writes/day) by keeping high-frequency ephemeral writes in D1 instead — webhook dedup (`dedup_keys`, atomic `ON CONFLICT` UPSERT), delivery state and message tracking all use D1 rows via `canUseD1` (prepare+batch probe) with automatic KV fallback when D1 is unavailable or unmigrated. D1 Free allows 100,000 rows written/day, so the per-event KV write cost drops to ~0; config stays cached in memory + KV with D1 authoritative
-- Filter DSL: a route's flat `filters` can be replaced by a nested `ast` (`all`/`any`/`not` nodes, `server/lib/events/filter-ast.ts`) that takes precedence when present; the `field` filter type reads any payload value by JSONPath (`path`, arrays expand so any element matches) and 12 comparison operators (`op`: `eq`/`ne`/`contains`/`startsWith`/`endsWith`/`regex`/`gt`/`gte`/`lt`/`lte`/`in`/`exists`) extend the legacy glob/regex/case-insensitive-exact semantics; named filter fragments (D1 `d1_fragments` via `server/lib/fragments.ts`, per-group) are editor-side templates inlined into the route's `ast` on insert — the matcher never resolves fragment references; the route editor (`RouteEditor.vue`) exposes a recursive AST builder (`FilterNodeEditor.vue`), chip multi-value input (`TagInput.vue`), live explanation and a stateless `POST /admin/api/test-match` dry-run
+- Filter DSL: a route's flat `filters` can be replaced by a nested `ast` (`all`/`any`/`not` nodes, `server/lib/events/filter-ast.ts`) that takes precedence when present; the `field` filter type reads any payload value by JSONPath (`path`, arrays expand so any element matches) and 12 comparison operators (`op`: `eq`/`ne`/`contains`/`startsWith`/`endsWith`/`regex`/`gt`/`gte`/`lt`/`lte`/`in`/`exists`) extend the legacy glob/regex/case-insensitive-exact semantics; named filter fragments (D1 `d1_fragments` via `server/lib/fragments.ts`, per-group) are editor-side templates inlined into the route's `ast` on insert — the matcher never resolves fragment references; the route editor (`RouteEditor.vue`) exposes a recursive AST builder (`FilterNodeEditor.vue`: plain selects for filter type/operator, an all/any segmented toggle, NOT toggle + delete pinned per condition), searchable multi-value / path inputs (`FilterCombobox.vue`) fed by a bilingual suggestion catalog (`app/utils/filter-catalog.ts`: GitHub events/actions from `@octokit/webhooks` plus Gitea extras, common payload paths and their known values, English keys searchable in either language) where custom values are allowed but rejected when the matcher could never match them (`validateFilterValue`), a live explanation and a stateless `POST /admin/api/test-match` dry-run
- Local dev: wrangler + Miniflare
## Architecture
@@ -38,7 +38,7 @@ app/ # Vue 3 UI (Nuxt app dir)
├── pages/ # index (landing), terms, privacy, admin/[...slug] (console SPA)
├── components/ # ConsolePage (sidebar shell + topbar), AdminHome (overview dashboard),
│ # RouteList (drag/keyboard reorder mode) + RouteCard, RouteEditor (FilterNodeEditor
-│ # AST builder + TagInput chips), GroupEditor, MembersPanel, WebhookPanel,
+│ # AST builder + FilterCombobox searchable inputs), GroupEditor, MembersPanel, WebhookPanel,
│ # ConfirmDialog (app-wide destructive-action confirm), SendLogs, AuditLog, MetricsPanel,
│ # AppToasts, LegalLayout
├── composables/ # useI18n, useToasts, useConfirm (promise-based confirm), useGroups, useGroupRoutes, useFilterNode (AST helpers), useFragments, useLogs,
diff --git a/app/assets/css/main.css b/app/assets/css/main.css
index b9bba67..30fd9d6 100644
--- a/app/assets/css/main.css
+++ b/app/assets/css/main.css
@@ -213,26 +213,6 @@
@apply px-6 py-3 text-sm;
}
- .icon-btn {
- @apply grid h-[30px] w-[30px] place-items-center cursor-pointer rounded-sm border border-border bg-transparent text-[13px] text-muted transition-all duration-150;
- }
-
- .icon-btn:hover {
- @apply border-accent bg-accent-dim text-accent;
- }
-
- .icon-btn:disabled {
- @apply cursor-not-allowed opacity-35;
- }
-
- .icon-btn:disabled:hover {
- @apply border-border bg-transparent text-muted;
- }
-
- .icon-btn.danger:hover {
- @apply border-bad bg-bad-dim text-bad;
- }
-
/* ---- Cards ---- */
.card {
@apply animate-rise rounded border border-border bg-surface p-5 transition-[border-color,transform] duration-150;
@@ -610,10 +590,6 @@
@apply truncate text-base font-extrabold tracking-tight;
}
- .editor-head .icon-btn {
- @apply h-8 w-8 rounded-full;
- }
-
.editor-body {
@apply flex-1 overflow-y-auto px-6 py-5;
scrollbar-width: thin;
@@ -1021,66 +997,155 @@
}
}
+ /* ---- Filter tree editor ---- */
.node-editor {
- @apply mb-1;
+ container-type: inline-size;
}
.node-nested {
- @apply ml-4 border-l border-border pl-3;
+ @apply ml-3 border-l border-border pl-2.5;
}
+ @container (max-width: 26rem) {
+ .node-nested {
+ @apply ml-1 pl-1.5;
+ }
+ }
+
+ /*
+ * A condition: type · path · operator on one line with the NOT toggle and
+ * delete pinned top-right, values below. Narrow containers stack the fields
+ * under the type. Field filters add a path, keyword filters have no
+ * operator, and `exists` has no values.
+ */
.leaf-row {
- @apply mb-1.5 flex flex-wrap items-center gap-2 rounded-sm border border-border bg-surface-2 p-2.5;
+ @apply grid items-start gap-2 rounded-lg border border-border bg-surface p-2.5;
+ grid-template-columns: minmax(0, 1fr) auto;
+ grid-template-areas:
+ "type actions"
+ "op op"
+ "values values";
}
- .node-select {
- @apply w-[120px] shrink-0 rounded border border-border-strong bg-surface px-2 py-1.5 font-ui text-[12.5px] font-medium text-text;
+ .leaf-row.is-field {
+ grid-template-areas:
+ "type actions"
+ "path path"
+ "op op"
+ "values values";
}
- .node-path {
- @apply w-[160px] shrink-0;
+ .leaf-row.is-keyword {
+ grid-template-areas:
+ "type actions"
+ "values values";
}
- .node-values {
- @apply min-w-[180px] flex-1;
+ .leaf-row.no-values {
+ grid-template-areas:
+ "type actions"
+ "op op";
}
- .node-exclude {
- @apply flex shrink-0 cursor-pointer items-center gap-1.5 text-[12px] font-medium text-muted;
+ .leaf-row.is-field.no-values {
+ grid-template-areas:
+ "type actions"
+ "path path"
+ "op op";
+ }
+
+ @container (min-width: 34rem) {
+ .leaf-row {
+ grid-template-columns: 9.5rem 9.5rem minmax(0, 1fr) auto;
+ grid-template-areas:
+ "type op . actions"
+ "values values values values";
+ }
+
+ .leaf-row.is-field {
+ grid-template-columns: 9.5rem minmax(0, 1fr) 9.5rem auto;
+ grid-template-areas:
+ "type path op actions"
+ "values values values values";
+ }
+
+ .leaf-row.is-keyword {
+ grid-template-columns: 9.5rem minmax(0, 1fr) auto;
+ grid-template-areas:
+ "type . actions"
+ "values values values";
+ }
+
+ .leaf-row.no-values {
+ grid-template-areas: "type op . actions";
+ }
+
+ .leaf-row.is-field.no-values {
+ grid-template-areas: "type path op actions";
+ }
+ }
+
+ .leaf-row.is-negated {
+ @apply border-bad/40;
+ }
+
+ .leaf-type {
+ @apply min-w-0;
+ grid-area: type;
+ }
+
+ .leaf-path {
+ @apply min-w-0;
+ grid-area: path;
+ }
+
+ .leaf-op {
+ @apply min-w-0;
+ grid-area: op;
+ }
+
+ .leaf-values {
+ @apply min-w-0;
+ grid-area: values;
+ }
+
+ .leaf-actions {
+ @apply flex items-center gap-1 justify-self-end;
+ grid-area: actions;
}
.node-group {
- @apply mb-1.5 rounded-sm border border-border bg-surface-2 p-2.5;
+ @apply flex flex-col gap-2 rounded-lg border border-border bg-surface-2 p-2.5;
}
.node-group-head {
- @apply mb-2 flex flex-wrap items-center gap-2;
+ @apply flex flex-wrap items-center gap-2;
}
- .node-combo {
- @apply w-[130px] rounded border border-border-strong bg-surface px-2 py-1.5 font-ui text-[12.5px] font-semibold text-text;
+ .node-kind > * {
+ @apply whitespace-nowrap;
}
- .node-combo-label {
- @apply inline-flex items-center rounded border border-border-strong bg-surface px-2 py-1.5 font-ui text-[12.5px] font-semibold text-text;
- }
-
- .node-actions {
- @apply ml-auto flex flex-wrap items-center gap-1.5;
- }
-
- .node-add {
- @apply px-2 py-1 text-[12px];
+ .node-not-label {
+ @apply inline-flex items-center rounded-md bg-bad-dim px-2.5 py-1 text-xs font-semibold text-bad;
}
.node-children {
- @apply flex flex-col gap-1.5;
+ @apply flex flex-col gap-2;
}
.node-empty {
@apply py-1 text-[12px] italic text-muted;
}
+ .node-add {
+ @apply flex flex-wrap items-center gap-1;
+ }
+
+ .test-event {
+ @apply max-w-sm;
+ }
+
.test-payload {
@apply font-mono text-[12px];
}
diff --git a/app/components/FilterNodeEditor.vue b/app/components/FilterNodeEditor.vue
index 8011bc2..1aa47db 100644
--- a/app/components/FilterNodeEditor.vue
+++ b/app/components/FilterNodeEditor.vue
@@ -1,7 +1,15 @@
-
-
-
-
diff --git a/app/composables/useFilterNode.ts b/app/composables/useFilterNode.ts
index 5ba5774..860d89d 100644
--- a/app/composables/useFilterNode.ts
+++ b/app/composables/useFilterNode.ts
@@ -1,11 +1,22 @@
+import { toRaw } from "vue";
+import type { ComputedRef, InjectionKey } from "vue";
import type { Filter, FilterNode, FilterOp, FilterType } from "~/types";
+/** Exact event names the edited route filters on (see `scopeEvents`). */
+export const FILTER_SCOPE_EVENTS: InjectionKey> = Symbol("filter-scope");
+
export interface LeafForm {
type: FilterType;
path: string;
op: FilterOp;
values: string[];
exclude: boolean;
+ /**
+ * Text typed into the values input but not added yet (editor-only, never
+ * saved). It lives on the leaf so it follows the condition when the input
+ * remounts (a NOT unwrapped, the root wrapped by an inserted fragment).
+ */
+ draft: string;
}
export type NodeKind = "leaf" | "all" | "any" | "not";
@@ -17,8 +28,22 @@ export interface NodeForm {
child: NodeForm | null;
}
+const nodeKeys = new WeakMap