Define the core contracts: domain model

Details (original message):
Define the core contracts: domain model, stream events, HITL, profiles, tools, plugins, UI vocabulary, ingest IR, retrieval and memory; golden-sample conformance tests; TS mirror.
This commit is contained in:
weichen
2026-09-29 17:34:58 +00:00
parent f2fcc2f62e
commit 9929d8f8ad
25 changed files with 1585 additions and 2 deletions
+10
View File
@@ -0,0 +1,10 @@
{
"id": "art_abc123def456",
"projectId": "prj_abc123def456",
"name": "报告.md",
"kind": "document",
"mime": "text/markdown",
"size": 128,
"createdAt": "0001-01-01T00:00:00Z",
"updatedAt": "0001-01-01T00:00:00Z"
}
+7
View File
@@ -0,0 +1,7 @@
{
"id": "cnv_abc123def456",
"projectId": "prj_abc123def456",
"title": "新会话",
"createdAt": "0001-01-01T00:00:00Z",
"updatedAt": "0001-01-01T00:00:00Z"
}
+13
View File
@@ -0,0 +1,13 @@
{
"seq": 43,
"runId": "run_1",
"conversationId": "cnv_1",
"ts": "2026-09-29T10:00:01Z",
"v": 1,
"type": "agent.spawn",
"payload": {
"agentRun": "run_sub1",
"name": "检索员",
"task": "查法规"
}
}
+12
View File
@@ -0,0 +1,12 @@
{
"seq": 42,
"runId": "run_1",
"conversationId": "cnv_1",
"ts": "2026-09-29T10:00:00Z",
"v": 1,
"type": "message.delta",
"payload": {
"index": 0,
"text": "你"
}
}
+17
View File
@@ -0,0 +1,17 @@
{
"seq": 44,
"runId": "run_1",
"conversationId": "cnv_1",
"ts": "2026-09-29T10:00:02Z",
"v": 1,
"type": "run.completed",
"payload": {
"usage": {
"promptTokens": 100,
"completionTokens": 20,
"totalTokens": 120,
"durationMs": 1500,
"toolCalls": 1
}
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"id": "hitl_abc123def456",
"runId": "run_1",
"conversationId": "cnv_1",
"question": "采用哪种输出格式?",
"kind": "choice",
"choices": [
{
"id": "md",
"label": "Markdown 文档",
"description": "可版本管理的轻量文档",
"impact": "写入 artifacts,可在右栏查看",
"recommended": true
},
{
"id": "docx",
"label": "Word 文档",
"description": "正式交付格式",
"impact": "生成 docx 工件"
}
],
"allowFreeInput": true,
"freeInputHint": "也可以直接输入其他格式要求",
"createdAt": "",
"resolved": false
}
+45
View File
@@ -0,0 +1,45 @@
{
"id": "msg_abc123def456",
"conversationId": "cnv_abc123def456",
"runId": "run_abc123def456",
"role": "assistant",
"parts": [
{
"type": "thinking",
"text": "考虑先检索…",
"process": true
},
{
"type": "tool_call",
"toolCall": {
"id": "call_1",
"name": "history_search",
"arguments": "{\"q\":\"部署\"}",
"durationMs": 12.5
},
"process": true
},
{
"type": "tool_result",
"toolResult": {
"callId": "call_1",
"status": "ok",
"summary": "3 条命中"
},
"process": true
},
{
"type": "text",
"text": "根据历史记录……"
},
{
"type": "artifact_ref",
"artifact": {
"artifactId": "art_abc123def456",
"name": "报告.md",
"kind": "document"
}
}
],
"createdAt": "0001-01-01T00:00:00Z"
}
+40
View File
@@ -0,0 +1,40 @@
{
"meta": {
"filename": "报告.docx",
"mime": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"parser": "builtin:docx",
"confidence": 0.92,
"parsedAt": "0001-01-01T00:00:00Z"
},
"blocks": [
{
"type": "heading",
"level": 1,
"text": "概述"
},
{
"type": "para",
"text": "本文档说明……"
},
{
"type": "list",
"items": [
"要点一",
"要点二"
]
},
{
"type": "table",
"rows": [
[
"项",
"值"
],
[
"版本",
"1.0"
]
]
}
]
}
+28
View File
@@ -0,0 +1,28 @@
{
"id": "example",
"name": "示例插件",
"version": "0.1.0",
"apiVersion": "1.0",
"requires": {
"network": [
"api.example.com"
]
},
"provides": {
"tools": [
"http_echo"
],
"intents": [
"demo"
],
"panels": [
"demo"
],
"cards": [
"note"
],
"settings": [
"greeting"
]
}
}
+32
View File
@@ -0,0 +1,32 @@
{
"id": "default",
"name": "通用助手",
"builtin": true,
"source": "builtin",
"systemPrompt": "你是一个通用智能体助手。",
"model": {
"chat": "gpt-default",
"lightweight": "gpt-lite"
},
"tools": {
"allow": [
"*"
],
"deny": [
"http.admin."
],
"confirm": [
"http."
]
},
"context": {
"maxHistoryMessages": 40,
"maxToolResultChars": 20000
},
"hitl": {
"askOnAmbiguity": true
},
"budget": {
"maxToolCalls": 40
}
}
+6
View File
@@ -0,0 +1,6 @@
{
"id": "prj_abc123def456",
"name": "示例项目",
"createdAt": "0001-01-01T00:00:00Z",
"updatedAt": "0001-01-01T00:00:00Z"
}
+17
View File
@@ -0,0 +1,17 @@
{
"id": "run_abc123def456",
"conversationId": "cnv_abc123def456",
"projectId": "prj_abc123def456",
"kind": "conversation",
"profileId": "default",
"status": "completed",
"phase": "done",
"createdAt": "0001-01-01T00:00:00Z",
"usage": {
"promptTokens": 1200,
"completionTokens": 300,
"totalTokens": 1500,
"durationMs": 4200.5,
"toolCalls": 2
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"name": "http_translate",
"description": "调用翻译 API",
"parameters": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
},
"required": [
"text"
]
},
"source": "user",
"http": {
"method": "POST",
"url": "https://api.example.com/translate",
"bodyTemplate": "{\"q\":\"{{param.text}}\"}",
"timeoutMs": 10000,
"resultPath": "data.0"
}
}