Compare commits

..
Author SHA1 Message Date
weichen c8266fef42 Merge main into feature/project-inbox-r1 (sync before merge per branch protection) 2026-09-30 19:10:04 +00:00
weichen ed579bf29c Extract project channel key helpers (CF3 review fix)
Why: project channel convention (pseudo-key project:<projectId>) was
duplicated across runmgr/server/store; centralize so replay envelopes
match live stamping.
Evidence: go test green.
Impact: no behavior change; enables store replay stamping.
2026-09-30 19:07:06 +00:00
weichen f8b77c0d02 Merge pull request 'Add ProjectID to stream event envelope (CF3 project channel)' (#11) from feature/project-inbox-r1 into main 2026-09-30 18:56:52 +00:00
weichen 0b3392acea Add ProjectID to stream event envelope for project channel (CF3)
Why: D50 approved — the project inbox needs its own SSE stream reusing the
conversation event mechanism via the pseudo-key project:<projectId>; the
envelope stamps project ownership (additive field).
Evidence: conformance golden event_project_stream; go test green.
Impact: additive only (omitempty); consumers ignore unknown fields.
Refs: documents proposal 2026-09-30-card-stream-artifact-unify-project-inbox.md (D50).
2026-09-30 18:56:47 +00:00
weichen 90b57477bb Merge pull request 'Add Hidden to ToolDesc for reserved tool capabilities' (#10) from feature/file-preview-caps into main 2026-09-30 17:20:20 +00:00
weichen 6bdc4f2ada Add Hidden to ToolDesc for reserved tool capabilities
Why: the fs tool family (proposal 2026-09-30-file-preview-and-reserved-
capabilities) is implemented but must stay invisible to models and tool
listings until a runtime gate opens it.

Evidence: new bool field with json omitempty; no golden samples carry it;
go test ./... green.

Impact: registries can mark gated tools; servers and runners filter on
it (backend PR in the same task).

Refs: task feature/file-preview-caps.
2026-09-30 17:13:15 +00:00
weichen cafd9a54e5 Merge pull request 'Add CardID to CardPart for inbox-reference card parts' (#8) from feature/cardflow-r1 into main 2026-09-30 17:10:52 +00:00
weichen a64fb5a168 Add CardID to CardPart for inbox-reference card parts
Why: 卡流机制(CF1)需要消息部件正式引用收件箱 ActivityCard——submit_card 产卡时卡片为产物权威载体,消息只存引用+锚点渲染(原仅能从 data 字符串里正则抠 card:<id>)。
Evidence: go test ./... 通过;golden message.json 增 card 引用部件锁定 cardId 线格式(-update 重生成后逐字节一致)。
Impact: CardPart 增可选 cardId(omitempty,旧数据零影响);ts/types.ts 同步,镜像经 make contracts 再生成。
Refs: Dev 任务卡 feature/cardflow-r1;提案 cardflow-and-process-split(编制中)。
2026-09-30 16:10:20 +00:00
weichen c9aff06ed5 Merge pull request 'Record Gitea access facts in AGENTS.md' (#7) from feature/gitea-access-facts into main 2026-09-30 16:08:25 +00:00
weichen e6706450e4 Record Gitea access facts in AGENTS.md
Why: agents rediscovered Gitea hosts and credential locations from
scratch each session, and the retired git-panel host kept failing with
TLS broken-pipe errors before the right host was recalled.

Evidence: curl git-home...:30319/api/v1/version with token from
~/.secrets/gitea -> {"version":"1.27.3"}; ssh -p 31411 git@git-ssh...
(BatchMode) -> "Hi there, weichen!" with key ~/.ssh/home_gitea (ED25519,
SHA256:GYXaOXIMeloQ1fKSfdJ/ndgPQzs/Ix7Hk62ekfkfQ20). Same section already
merged in Agent-System-Dev (PR #73).

Impact: AGENTS.md only; records hosts and credential locations, no
secret values (baseline hard boundary 2).

Refs: Agent-System-Dev PR #73
2026-09-30 16:06:15 +00:00
weichen fd441794b1 Merge pull request 'Add cross-session flags to the Conversation contract' (#6) from feature/cross-session-reading into main 2026-09-30 15:00:44 +00:00
weichen 284e8f365f Add cross-session flags to the Conversation contract
Why: cross-session transcript reading needs per-conversation outbound
(allowCrossRead, default true) and inbound (crossPrivate, default false)
flags alongside the project-level gate; see the approved proposal.

Evidence: go test ./... passes with golden conversation.json regenerated
to exercise both wire fields.

Impact: additive contract fields (omitempty), wire-compatible for
existing clients that ignore unknown fields.

Refs: Agent-System-Documents proposals/2026-09-30-cross-session-reading.md
(Dev task feature/cross-session-reading).
2026-09-30 15:00:22 +00:00
weichen 10a84345b7 Merge pull request 'Add the avatar vocabulary to UINode (UI capability platform)' (#5) from feature/ui-capability-platform into main 2026-09-30 14:22:27 +00:00
9 changed files with 92 additions and 6 deletions
+17
View File
@@ -17,3 +17,20 @@
- 模块边界、公开契约与隔离档位见 `policy/modules/`(如有)与 PROJECT.md。
- 跨仓 gitlink 变更须经组合验证后在 Dev 仓推进;受保护分支经 PR 合入。
- 验证命令见 PROJECT.md「验证」节;完成声明须附实际命令输出证据。
## Gitea 与 Git 访问事实(2026-09-30 实测)
历史文档与旧链接里的 `git-panel.u1680832.nyat.app:30319` 已失效(TLS 握手失败),
见到一律按过期处理,不要再试。当前权威通道:
- **Web / API(HTTPS)**:`https://git-home.u1680832.nyat.app:30319`(Gitea 1.27.3,
API 前缀 `/api/v1`;偶发 broken pipe / 超时,重试即可)。
- **Git over SSH**:`ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/<Repo>.git`
(各仓 origin 与 gitlink 均为此格式)。
- **API token**:`~/.secrets/gitea`,两行键值 `URL_PREFIX=…` 与
`ACCESS_TOKEN=<40 位 hex>`;取值 `grep ACCESS_TOKEN ~/.secrets/gitea | cut -d= -f2-`,
用作 `Authorization: token <值>` 请求头。**token 值不入仓、不回显、不写进产出物**
(baseline 硬边界 2:只记录来源、字段与可用状态)。
- **SSH key**:`~/.ssh/home_gitea`(ED25519,公钥指纹
`SHA256:GYXaOXIMeloQ1fKSfdJ/ndgPQzs/Ix7Hk62ekfkfQ20`,Gitea 侧密钥名 GMKtec);
`~/.ssh/config` 已有 `git-ssh.u1680832.nyat.app` 主机条目,克隆/推送直接可用。
+9 -2
View File
@@ -47,6 +47,7 @@ func sampleMessage() Message {
{Type: PartToolResult, Process: true, ToolResult: &ToolResultPart{CallID: "call_1", Status: "ok", Summary: "3 条命中"}},
{Type: PartText, Text: "根据历史记录……"},
{Type: PartArtifactRef, Artifact: &ArtifactRef{ArtifactID: "art_abc123def456", Name: "报告.md", Kind: "document"}},
{Type: PartCard, Card: &CardPart{Kind: "result", Data: []UINode{{Type: "markdown", Markdown: "全文见卡片"}}, CardID: "card_abc123def456"}},
},
}
}
@@ -63,7 +64,7 @@ func TestGoldenDomain(t *testing.T) {
golden(t, "message", sampleMessage())
golden(t, "run", sampleRun())
golden(t, "project", Project{ID: "prj_abc123def456", Name: "示例项目"})
golden(t, "conversation", Conversation{ID: "cnv_abc123def456", ProjectID: "prj_abc123def456", Title: "新会话"})
golden(t, "conversation", Conversation{ID: "cnv_abc123def456", ProjectID: "prj_abc123def456", Title: "新会话", AllowCrossRead: true, CrossPrivate: true})
golden(t, "artifact", Artifact{ID: "art_abc123def456", ProjectID: "prj_abc123def456", Name: "报告.md", Kind: "document", MIME: "text/markdown", Size: 128})
}
@@ -124,6 +125,12 @@ func TestGoldenCardEvents(t *testing.T) {
Payload: json.RawMessage(`{"cardId":"card_abc123def456","actionId":"escalate"}`)})
}
func TestGoldenProjectStreamEvent(t *testing.T) {
// 项目流(D50):伪会话键 "project:<projectId>" 复用会话流机制;信封带 ProjectID。
golden(t, "event_project_stream", StreamEvent{Seq: 47, ConversationID: "project:prj_abc123def456", ProjectID: "prj_abc123def456", TS: "2026-09-30T11:00:00Z", V: 1, Type: EvCardCreated,
Payload: json.RawMessage(`{"card":{"id":"card_def456abc789","projectId":"prj_abc123def456","kind":"result","title":"项目级卡","status":"done","createdAt":"2026-09-30T11:00:00Z","updatedAt":"2026-09-30T11:00:00Z"}}`)})
}
func TestGoldenUIVocabularies(t *testing.T) {
golden(t, "ui_avatar", []UINode{
{Type: UIAvatar, Avatar: &UIAvatarSpec{Name: "weichen", Sub: "OWNER"}},
@@ -176,7 +183,7 @@ func TestGoldenProfileAndTools(t *testing.T) {
golden(t, "tool_http", ToolDesc{
Name: "http_translate", Description: "调用翻译 API", Source: SourceUser,
Parameters: json.RawMessage(`{"type":"object","properties":{"text":{"type":"string"}},"required":["text"]}`),
HTTP: &HTTPToolSpec{Method: "POST", URL: "https://api.example.com/translate", BodyTemplate: `{"q":"{{param.text}}"}`, TimeoutMs: 10000, ResultPath: "data.0"},
HTTP: &HTTPToolSpec{Method: "POST", URL: "https://api.example.com/translate", BodyTemplate: `{"q":"{{param.text}}"}`, TimeoutMs: 10000, ResultPath: "data.0"},
})
}
+20 -1
View File
@@ -1,13 +1,19 @@
package core
import "encoding/json"
import (
"encoding/json"
"strings"
)
// 事件信封:后端 → 前端的唯一增量通道(SSE),持久化后转发,Seq 在会话内单调。
// 消费方对未知 Type 静默忽略(原则 6 前向兼容)。
// 项目流(D50):项目频道事件以伪会话键 "project:<projectId>" 复用同一机制
//(独立 seq、持久化、断线重放),信封以 ProjectID 标识归属(会话流事件为空)。
type StreamEvent struct {
Seq int64 `json:"seq"`
RunID ID `json:"runId,omitempty"`
ConversationID ID `json:"conversationId"`
ProjectID ID `json:"projectID,omitempty"` // 项目流事件的项目归属(D50;只增不删)
TS string `json:"ts"` // RFC3339
V int `json:"v"`
Type StreamEventType `json:"type"`
@@ -16,6 +22,19 @@ type StreamEvent struct {
type StreamEventType string
// 项目流频道约定(D50):项目频道以伪会话键 "project:<projectId>" 复用会话
// 事件的持久化/seq/重放机制;信封 ProjectID 由该键派生(发布与重放同源)。
const projectChannelPrefix = "project:"
// ProjectChannelKey 返回项目流的事件频道键。
func ProjectChannelKey(projectID ID) ID { return ID(projectChannelPrefix + string(projectID)) }
// ProjectFromChannel 反解项目流频道键;非项目流频道返回 false。
func ProjectFromChannel(key ID) (ID, bool) {
pid, ok := strings.CutPrefix(string(key), projectChannelPrefix)
return ID(pid), ok && pid != ""
}
const (
EvMessageDelta StreamEventType = "message.delta"
EvThinkingDelta StreamEventType = "thinking.delta"
+7 -2
View File
@@ -33,6 +33,8 @@ type Conversation struct {
ProfileID ID `json:"profileId,omitempty"` // 空为默认画像
Pinned bool `json:"pinned,omitempty"` // 侧栏置顶(方案 A P6/P8:本端组织偏好,服务端权威)
Archived bool `json:"archived,omitempty"` // 归档:列表默认隐藏,数据保留
AllowCrossRead bool `json:"allowCrossRead,omitempty"` // 跨会话出站:本会话读取同项目其他会话记录(需项目开关 crossSession.read)
CrossPrivate bool `json:"crossPrivate,omitempty"` // 跨会话入站:私有会话,不被他读、不出现在他方列表
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
@@ -122,9 +124,12 @@ type ErrorPart struct {
}
// CardPart.Data 是 UI schema 节点(4.6 有限词汇)。
// CardID 非空 = 收件箱 ActivityCard 的引用部件(如 submit_card 产卡:卡片为产物
// 权威载体,消息只存引用+锚点渲染);空 = 插件内嵌卡片部件(自包含 Data)。
type CardPart struct {
Kind string `json:"kind"`
Data []UINode `json:"data"`
Kind string `json:"kind"`
Data []UINode `json:"data"`
CardID ID `json:"cardId,omitempty"`
}
// ---- Run(一切运行皆 Run)----
+2
View File
@@ -2,6 +2,8 @@
"id": "cnv_abc123def456",
"projectId": "prj_abc123def456",
"title": "新会话",
"allowCrossRead": true,
"crossPrivate": true,
"createdAt": "0001-01-01T00:00:00Z",
"updatedAt": "0001-01-01T00:00:00Z"
}
+19
View File
@@ -0,0 +1,19 @@
{
"seq": 47,
"conversationId": "project:prj_abc123def456",
"projectID": "prj_abc123def456",
"ts": "2026-09-30T11:00:00Z",
"v": 1,
"type": "card.created",
"payload": {
"card": {
"id": "card_def456abc789",
"projectId": "prj_abc123def456",
"kind": "result",
"title": "项目级卡",
"status": "done",
"createdAt": "2026-09-30T11:00:00Z",
"updatedAt": "2026-09-30T11:00:00Z"
}
}
}
+13
View File
@@ -39,6 +39,19 @@
"name": "报告.md",
"kind": "document"
}
},
{
"type": "card",
"card": {
"kind": "result",
"data": [
{
"type": "markdown",
"markdown": "全文见卡片"
}
],
"cardId": "card_abc123def456"
}
}
],
"createdAt": "0001-01-01T00:00:00Z"
+3
View File
@@ -20,6 +20,9 @@ type ToolDesc struct {
Source SourceKind `json:"source"`
PluginID string `json:"pluginId,omitempty"`
HTTP *HTTPToolSpec `json:"http,omitempty"` // 声明式 HTTP 工具(无代码)
// Hidden 预留能力形态:默认不对模型与 /api/tools 列表可见,须运行时开关
// (如 runtime.fsTools)或管理动作开启后可用(提案 2026-09-30-file-preview-and-reserved-capabilities)。
Hidden bool `json:"hidden,omitempty"`
}
// HTTPToolSpec:无代码自定义工具(4.8)。模板变量 {{param.x}} 从调用参数注入。
+2 -1
View File
@@ -14,6 +14,7 @@ export interface Project {
export interface Conversation {
id: ID; projectId: ID; owner?: ID; title: string; profileId?: ID;
pinned?: boolean; archived?: boolean;
allowCrossRead?: boolean; crossPrivate?: boolean;
createdAt: string; updatedAt: string;
}
@@ -31,7 +32,7 @@ export interface Part {
artifact?: { artifactId: ID; name: string; kind?: string };
hitl?: { cardId: ID; question: string; resolved: boolean; answer?: string };
plan?: PlanSnapshot;
card?: { kind: string; data: UINode[] };
card?: { kind: string; data: UINode[]; cardId?: ID }; // cardId 非空 = 收件箱卡片引用部件(submit_card)
error?: { code: string; message: string };
process?: boolean; // run 终态后折叠为摘要行
}