Files
JX-BPOS/db/migrations/0002_superb_talisman.sql
JCAI Main AgentandClaude Opus 5 f0444f1417 M2: 基座能力 —— memory / toolbox / channel / message
- memory   任务记忆四性质(只追加·信封盖戳·治理先行·归侧)、活动记忆四层与条目三件套、
           任务日志两级投影(结构化零 LLM / 叙述性小结不入事实库)、度量八指标只读投影
- toolbox  注册两审(静态审 + 试运行审)、效应等级决定运行时待遇、契约演进只增不破坏、
           白名单与纯工具私有作用域、ToolInvoker(两缝之二,live/record/replay)
- channel  通道实例配置、入站归一(解析 → 系统写 → 数据事件)、出站发送与关联记录登记
- message  通知 / 跨任务征答(就地作答 · 驳回重答只增不改)/ 死信 / 无主兜底

app:message 接上 event 的 MessageFallback;派发器按目标 ID 取 advisory lock 串行消费 +
消费幂等表;/api/ingest 模拟邮件通道(mock 只在外界)

已验证:无主 RFQ 邮件入站 → 归属解析 no-match → 事件落库 → 兜底落 OP 岗位的消息要素
门禁五道全绿;150 个单元测试 + 1 个 PG 集成测试

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
2026-07-27 01:16:52 +08:00

41 lines
1.4 KiB
SQL

CREATE TABLE "sys"."channel_instance" (
"id" text PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"kind" text NOT NULL,
"address" text NOT NULL,
"enabled" boolean DEFAULT true NOT NULL,
"extract" jsonb DEFAULT '[]'::jsonb NOT NULL,
"mapping" jsonb DEFAULT '[]'::jsonb NOT NULL,
"fallback_position" text,
"address_window_ms" integer DEFAULT 604800000 NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "sys"."outbound_mail" (
"id" text PRIMARY KEY NOT NULL,
"thread_id" text NOT NULL,
"from_addr" text NOT NULL,
"to_addrs" jsonb NOT NULL,
"cc_addrs" jsonb DEFAULT '[]'::jsonb NOT NULL,
"subject" text NOT NULL,
"body" text NOT NULL,
"attachments" jsonb DEFAULT '[]'::jsonb NOT NULL,
"sent_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "sys"."system_message" (
"id" text PRIMARY KEY NOT NULL,
"kind" text NOT NULL,
"staff_id" text NOT NULL,
"position_id" text,
"title" text NOT NULL,
"body" text NOT NULL,
"at" timestamp with time zone DEFAULT now() NOT NULL,
"read_at" timestamp with time zone,
"card" jsonb,
"answer" jsonb,
"event_ref" text
);
--> statement-breakpoint
CREATE INDEX "message_staff_idx" ON "sys"."system_message" USING btree ("staff_id","at");--> statement-breakpoint
CREATE INDEX "message_unread_idx" ON "sys"."system_message" USING btree ("staff_id","read_at");