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
This commit is contained in:
co-authored by
Claude Opus 5
parent
14d4fa046a
commit
f0444f1417
@@ -0,0 +1,70 @@
|
||||
CREATE TABLE "sys"."activity_memory" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"activity_id" text NOT NULL,
|
||||
"layer" text NOT NULL,
|
||||
"statement" text NOT NULL,
|
||||
"evidence" jsonb NOT NULL,
|
||||
"increment" jsonb,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"pruned_at" timestamp with time zone,
|
||||
"active" boolean DEFAULT true NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "sys"."task_memory_seal" (
|
||||
"task_id" text PRIMARY KEY NOT NULL,
|
||||
"sealed_at" timestamp with time zone NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "sys"."task_memory" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"task_id" text NOT NULL,
|
||||
"seq" integer NOT NULL,
|
||||
"at" timestamp with time zone NOT NULL,
|
||||
"kind" text NOT NULL,
|
||||
"side" text NOT NULL,
|
||||
"title" text NOT NULL,
|
||||
"detail" jsonb,
|
||||
"stamp" jsonb NOT NULL,
|
||||
"governance" jsonb NOT NULL,
|
||||
"links_to" text,
|
||||
"event_ref" text
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "sys"."replay_tool" (
|
||||
"key" text PRIMARY KEY NOT NULL,
|
||||
"call" jsonb NOT NULL,
|
||||
"result" jsonb NOT NULL,
|
||||
"recorded_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "sys"."tool_allowlist" (
|
||||
"activity_id" text NOT NULL,
|
||||
"tool" text NOT NULL,
|
||||
CONSTRAINT "tool_allowlist_activity_id_tool_pk" PRIMARY KEY("activity_id","tool")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "sys"."tool" (
|
||||
"name" text PRIMARY KEY NOT NULL,
|
||||
"version" text NOT NULL,
|
||||
"description" text NOT NULL,
|
||||
"input" jsonb NOT NULL,
|
||||
"output" jsonb NOT NULL,
|
||||
"effect" text NOT NULL,
|
||||
"errors" jsonb DEFAULT '[]'::jsonb NOT NULL,
|
||||
"idempotent" boolean DEFAULT false NOT NULL,
|
||||
"timeout_ms" integer DEFAULT 30000 NOT NULL,
|
||||
"retries" integer DEFAULT 1 NOT NULL,
|
||||
"connection_keys" jsonb DEFAULT '[]'::jsonb NOT NULL,
|
||||
"capabilities" jsonb,
|
||||
"pure" boolean DEFAULT false NOT NULL,
|
||||
"owner_activity_id" text,
|
||||
"connection_cipher" jsonb,
|
||||
"enabled" boolean DEFAULT true NOT NULL,
|
||||
"registered_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX "activity_memory_layer_idx" ON "sys"."activity_memory" USING btree ("activity_id","layer","created_at");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "task_memory_seq_key" ON "sys"."task_memory" USING btree ("task_id","seq");--> statement-breakpoint
|
||||
CREATE INDEX "task_memory_task_idx" ON "sys"."task_memory" USING btree ("task_id","at");--> statement-breakpoint
|
||||
CREATE INDEX "tool_effect_idx" ON "sys"."tool" USING btree ("effect");--> statement-breakpoint
|
||||
CREATE INDEX "tool_owner_idx" ON "sys"."tool" USING btree ("owner_activity_id");
|
||||
Reference in New Issue
Block a user