feat(routing): add routing_rules schema, condition types, and action types (M4-001/002/003)
- Add routing_rules table to packages/db with scope, priority, conditions (jsonb), and action (jsonb) columns; generate migration 0004 - Define RoutingCondition, RoutingAction, RoutingRule, TaskClassification, and RoutingDecision types in apps/gateway/src/agent/routing/routing.types.ts - Expand @mosaic/types routing/index.ts to export all M4 types (TaskType, Complexity, Domain, CostTier+local, Capability) alongside existing RoutingCriteria/RoutingResult - Fix pre-existing type errors in routing.service.ts (local CostTier) and default-rules.ts (count optional chaining, unknown cast) - Fix pre-existing Prettier violations in agent module and provider files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
17
packages/db/drizzle/0004_bumpy_miracleman.sql
Normal file
17
packages/db/drizzle/0004_bumpy_miracleman.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
CREATE TABLE "routing_rules" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"priority" integer NOT NULL,
|
||||
"scope" text DEFAULT 'system' NOT NULL,
|
||||
"user_id" text,
|
||||
"conditions" jsonb NOT NULL,
|
||||
"action" jsonb NOT NULL,
|
||||
"enabled" boolean DEFAULT true NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "routing_rules" ADD CONSTRAINT "routing_rules_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX "routing_rules_scope_priority_idx" ON "routing_rules" USING btree ("scope","priority");--> statement-breakpoint
|
||||
CREATE INDEX "routing_rules_user_id_idx" ON "routing_rules" USING btree ("user_id");--> statement-breakpoint
|
||||
CREATE INDEX "routing_rules_enabled_idx" ON "routing_rules" USING btree ("enabled");
|
||||
2635
packages/db/drizzle/meta/0004_snapshot.json
Normal file
2635
packages/db/drizzle/meta/0004_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,13 @@
|
||||
"when": 1773887085247,
|
||||
"tag": "0003_p8003_perf_indexes",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 4,
|
||||
"version": "7",
|
||||
"when": 1774224004898,
|
||||
"tag": "0004_bumpy_miracleman",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user