From 3a8468c83a80fa8ed17d9df347fd2565ddb95ebe Mon Sep 17 00:00:00 2001 From: weichen Date: Tue, 13 Oct 2026 15:36:11 +0000 Subject: [PATCH] Enable canonical versioned Go module consumption Why: Allow consumers to download an immutable module revision without nested source checkouts or local path replacements. Evidence: SELF package tests and the prior canonical-path rejection are recorded in the Dev dependency-workspace task card; remote consumption is replayed against the committed candidate. Impact: Change the module identity and its Go imports while preserving API behavior. Existing historical submodule revisions remain buildable. Refs: Versioned dependencies U1/U3; feature/dependency-workspace --- PROJECT.md | 14 +++++++------- README.md | 18 ++++++++---------- catalogcheck/align_test.go | 6 +++--- cmd/intentctl/main.go | 2 +- conformance/conformance.go | 2 +- conformance/conformance_test.go | 2 +- examples/example_test.go | 4 ++-- go.mod | 13 ++++--------- go.sum | 4 ++++ intent/recognizer.go | 2 +- intent/registry.go | 2 +- schema/roundtrip_test.go | 2 +- 12 files changed, 34 insertions(+), 37 deletions(-) diff --git a/PROJECT.md b/PROJECT.md index 88f2120..29e1a04 100644 --- a/PROJECT.md +++ b/PROJECT.md @@ -5,10 +5,10 @@ ## 仓库与操作 - 目标/产品边界:通用意图识别基础库。提供意图定义(spec)、注册表与配置合并(registry/loader)、四级漏斗识别器(guard → expectation → rules → adjudicate)、槽位抽取与诊断(conformance/catalogcheck/intentctl)。不做动作执行、不内置 LLM 客户端、不含任何业务意图内容,不依赖 Agent-Native / Agent-Squad / Agent-System。 -- 源码、资产、文档、机器契约位置:Go 源码在仓库根包目录;模块路径 `agent-intent`;人类文档在根 `README.md`、`docs/`、`policy/`;过程记录在 `docs/records/`;机器契约以 `intent` 包公开类型为准。 +- 源码、资产、文档、机器契约位置:Go 源码在仓库根包目录;模块路径 `git-ssh.u1680832.nyat.app/weichen/Agent-Intent.git`;人类文档在根 `README.md`、`docs/`、`policy/`;过程记录在 `docs/records/`;机器契约以 `intent` 包公开类型为准。 - 权威远端、集成基线、受保护分支:`ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-Intent.git`,集成基线 `main`。 - 并行共同基线记录位置、合入通知/主动检查方式:任务主记录在 Gitea Issue/PR;合入前在本仓 `main` 上 `git fetch` 并确认 HEAD。 -- 发布线与批准版本/实际制品查询入口:当前无独立制品仓库。可构建性以本仓 `main` 的 `go test` 为准;依赖子模块版本以 gitlink 为准,不把工作区未提交文件当发布组合。 +- 发布线与批准版本/实际制品查询入口:当前无独立制品仓库。可构建性以本仓 `main` 的 `go test` 为准;Go 依赖以 `go.mod` / `go.sum` 为准,不把工作区未提交文件当发布组合。 - 提交/审核/合并/发布身份与权限:仓库所有者 weichen。本机提交不代替远端合并。 - 任务唯一来源:Gitea `weichen/Agent-Intent` 的 Issue 与 Pull Request。 - 规范性文档目录:`policy/`。 @@ -21,8 +21,8 @@ | 逻辑 ID | 路径 | 角色 | |---|---|---| | development-guidelines | `deps/development-guidelines` | development-only,规范文本 | -| error-code-system | `deps/error-code-system` | build-required,规范码目录(catalogcheck 对齐 + `intent.*` 常量值) | -| logging-system | `deps/logging-system` | build-required,可选日志器 | +| error-code-system | `go.mod` / `go.sum` | build-required,规范码目录(catalogcheck 对齐 + `intent.*` 常量值) | +| logging-system | `go.mod` / `go.sum` | build-required,可选日志器 | 克隆: @@ -31,9 +31,9 @@ git clone --recurse-submodules ssh://git@git-ssh.u1680832.nyat.app:31411/weichen # 已克隆时:git submodule update --init --recursive ``` -构建、审核和发布固定父仓 gitlink,不执行 `submodule update --remote`。 +Go 构建、审核固定 `go.mod` / `go.sum` 版本,正式消费使用 `GOWORK=off`。既有源码 gitlink 暂留用于旧提交与在途分支重建;开发规范仍由 gitlink 固定。 -消费方(Agent-Squad / Agent-Native)接入本仓时须自带全部 replace:依赖模块内部的 replace 在上层构建中不生效。 +消费方接入完整模块路径的批准提交,由 `go get MODULE@COMMIT` 生成版本;本地联调由 Dev 显式链接组件,不写入正式 `go.mod`。 ## 验证命令 @@ -42,7 +42,7 @@ git clone --recurse-submodules ssh://git@git-ssh.u1680832.nyat.app:31411/weichen | 文档 | 人工核对 `AGENTS.md`、`PROJECT.md`、`policy/` 相对链接 | 不证明运行时行为 | | 模块/接口 | 仓库根:`GOWORK=off go vet ./... && GOWORK=off go test -count=1 ./...` | 需要 Go 1.27 | | 并发/快照隔离 | 仓库根:`GOWORK=off go test -count=1 -race ./...` | 覆盖 Reload 与识别并发 | -| 依赖纪律 | 仓库根:`GOWORK=off go list -m all` 仅标准库 + 两个生态模块 | 不证明宿主接入正确性 | +| 依赖纪律 | 仓库根:`GOWORK=off go list -m all` 核对生态模块及 `golang.org/x/text` 的实际版本 | 不证明宿主接入正确性 | | 宿主行为验收 | 消费方仓内跑 `conformance.Run` | 本命令不覆盖真实宿主配置 | ## 环境与数据 diff --git a/README.md b/README.md index 72e51ba..299b098 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ 可定义、可配置、可扩展的通用意图识别基础库:把「输入文本 → 意图 + 槽位 + 分支裁决」做成纯内存、确定性的库能力,供宿主在 LLM 之前完成确定性分流——守卫拦截(安全红线、识别即拒绝)、系统功能命令识别、路由提示与多轮澄清入口。 -本仓库是该模块的源码位置。Go 模块路径为 `agent-intent`。不依赖 Agent-Native、Agent-Squad 或任何第三方模块;错误码与日志和 Error-Code-System / Logging-System 轻接入对齐(常量对齐 + 鸭子接口,核心包不依赖错误码库)。 +本仓库是该模块的源码位置。Go 模块路径为 `git-ssh.u1680832.nyat.app/weichen/Agent-Intent.git`。不依赖 Agent-Native 或 Agent-Squad;文本处理依赖 `golang.org/x/text`,错误码与日志和 Error-Code-System / Logging-System 轻接入对齐(常量对齐 + 鸭子接口,核心包不依赖错误码库)。 设计目标与边界: @@ -128,27 +128,25 @@ go run ./cmd/intentctl catalog -root configs/intents # 能力目录(注入 错误常量与 Error-Code-System 对齐(`intent.invalid_spec` / `intent.spec_protected` / `intent.load_failed`,调用方错误复用 `sys.invalid_argument`),`catalogcheck` 测试防双权威;映射表见 [Error-Code-System 的 agent-intent 映射](deps/error-code-system/docs/agent-intent-mapping.md)。错误类型实现 `ErrorCode()` / `ErrorFields()`,logsys 自动展开码与字段。日志为可选注入(`Options.Log`,nil→Nop),事件:`intent recognized`(branch/top/confidence/revision/duration)、`intent snapshot reloaded`、`intent config rejected`;原始输入不写入日志。 -## 作为 submodule 使用 +## 版本依赖与消费 -消费方把本库固定为 submodule,推荐路径 `deps/agent-intent`;版本以消费方 gitlink 为准,不执行 `submodule update --remote`: +消费方在已配置私有传输的环境中获取批准提交,由 Go 写入实际版本: ```bash -git submodule add ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-Intent.git deps/agent-intent +go get git-ssh.u1680832.nyat.app/weichen/Agent-Intent.git@ +GOWORK=off go test ./... ``` -```text -require agent-intent v0.0.0 -replace agent-intent => ./deps/agent-intent -``` +`go.mod` / `go.sum` 固定错误码与日志依赖,无源码目录 `replace`。正式构建使用 `GOWORK=off`;本地源码联调通过 Dev 的显式组件链接管理。接入后建议在消费方测试里用 `conformance.Run` 跑自己的用例集。 -依赖模块内部的 replace 在上层构建中不生效:消费方须自带 `error-code-system` 与 `logging-system` 的 require + replace,并保持与本仓 gitlink 相同的组合。接入后建议在消费方测试里用 `conformance.Run` 跑自己的用例集。 +既有 `deps/` gitlink 暂留供旧提交和在途分支重建;本版本 Go 编译不消费这些目录,开发规范仍固定于 `deps/development-guidelines`。在途分支显式迁移 import 与模块前缀,不改意图、命令或历史事件标识。 ## 验证 ```bash GOWORK=off go vet ./... && GOWORK=off go test -count=1 ./... GOWORK=off go test -count=1 -race ./... -GOWORK=off go list -m all # 仅标准库 + 两个生态模块 +GOWORK=off go list -m all # 核对固定版本与 MVS 解析结果 ``` 需要 Go 1.27。规则入口见 [AGENTS.md](AGENTS.md),项目事实见 [PROJECT.md](PROJECT.md),设计与验证记录见 `docs/records/`。 diff --git a/catalogcheck/align_test.go b/catalogcheck/align_test.go index 16d5200..d06ec74 100644 --- a/catalogcheck/align_test.go +++ b/catalogcheck/align_test.go @@ -5,10 +5,10 @@ package catalogcheck import ( "testing" - _ "error-code-system/domains" // 填充 errcode.Default 种子码 - "error-code-system/errcode" + _ "git-ssh.u1680832.nyat.app/weichen/Error-Code-System.git/domains" // 填充 errcode.Default 种子码 + "git-ssh.u1680832.nyat.app/weichen/Error-Code-System.git/errcode" - "agent-intent/intent" + "git-ssh.u1680832.nyat.app/weichen/Agent-Intent.git/intent" ) func TestIntentCodesAlignWithCatalog(t *testing.T) { diff --git a/cmd/intentctl/main.go b/cmd/intentctl/main.go index eb5f95f..40fdec4 100644 --- a/cmd/intentctl/main.go +++ b/cmd/intentctl/main.go @@ -11,7 +11,7 @@ import ( "sort" "strings" - "agent-intent/intent" + "git-ssh.u1680832.nyat.app/weichen/Agent-Intent.git/intent" ) func main() { diff --git a/conformance/conformance.go b/conformance/conformance.go index ba9e776..37a3e5f 100644 --- a/conformance/conformance.go +++ b/conformance/conformance.go @@ -9,7 +9,7 @@ import ( "sync" "testing" - "agent-intent/intent" + "git-ssh.u1680832.nyat.app/weichen/Agent-Intent.git/intent" ) // Case 单条行为验收用例。ExpectTopID 为空断言 Top 为 nil; diff --git a/conformance/conformance_test.go b/conformance/conformance_test.go index 4bfa39a..1b56c28 100644 --- a/conformance/conformance_test.go +++ b/conformance/conformance_test.go @@ -5,7 +5,7 @@ import ( "testing" "testing/fstest" - "agent-intent/intent" + "git-ssh.u1680832.nyat.app/weichen/Agent-Intent.git/intent" ) func TestRunAcceptsCompliantRecognizer(t *testing.T) { diff --git a/examples/example_test.go b/examples/example_test.go index e09f659..b542eeb 100644 --- a/examples/example_test.go +++ b/examples/example_test.go @@ -7,8 +7,8 @@ import ( "embed" "testing" - "agent-intent/conformance" - "agent-intent/intent" + "git-ssh.u1680832.nyat.app/weichen/Agent-Intent.git/conformance" + "git-ssh.u1680832.nyat.app/weichen/Agent-Intent.git/intent" ) //go:embed specs/*.json diff --git a/go.mod b/go.mod index 13fa331..06b5939 100644 --- a/go.mod +++ b/go.mod @@ -1,14 +1,9 @@ -module agent-intent +module git-ssh.u1680832.nyat.app/weichen/Agent-Intent.git go 1.27 require ( - error-code-system v0.0.0 - logging-system v0.0.0 + git-ssh.u1680832.nyat.app/weichen/Error-Code-System.git v0.0.0-20261013150648-28d2d5074347 + git-ssh.u1680832.nyat.app/weichen/Logging-System.git v0.0.0-20261013150647-9c5442f06d05 + golang.org/x/text v0.29.0 ) - -require golang.org/x/text v0.29.0 // indirect - -replace error-code-system => ./deps/error-code-system - -replace logging-system => ./deps/logging-system diff --git a/go.sum b/go.sum index 3adec61..6bb76be 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,6 @@ +git-ssh.u1680832.nyat.app/weichen/Error-Code-System.git v0.0.0-20261013150648-28d2d5074347 h1:mESnwe9ZpZqpLoGPzLyCWEmXDHKm7ouKC8qpF8EztEQ= +git-ssh.u1680832.nyat.app/weichen/Error-Code-System.git v0.0.0-20261013150648-28d2d5074347/go.mod h1:b8CDy31Xo3uRzAhA3HldwcgNnk0x5Lb02osIb9ewJ3A= +git-ssh.u1680832.nyat.app/weichen/Logging-System.git v0.0.0-20261013150647-9c5442f06d05 h1:gtFuWlGr7GlpEkuoIfIw6f/uXHUlYXlHU2qgLWAV46Y= +git-ssh.u1680832.nyat.app/weichen/Logging-System.git v0.0.0-20261013150647-9c5442f06d05/go.mod h1:Jg/bDRsd1/g5YjIoEUYkCsTgJOrTolYccfyb/tc57Dk= golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= diff --git a/intent/recognizer.go b/intent/recognizer.go index 64590a8..777b9ba 100644 --- a/intent/recognizer.go +++ b/intent/recognizer.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "logging-system/logsys" + "git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys" ) // Recognizer 是识别的公开端口(Query 语义:纯函数式、无副作用)。 diff --git a/intent/registry.go b/intent/registry.go index 7805e8d..0dc3c6a 100644 --- a/intent/registry.go +++ b/intent/registry.go @@ -11,7 +11,7 @@ import ( "sync" "sync/atomic" - "logging-system/logsys" + "git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys" ) // Options 注册表与识别器的共享选项。零值字段在构建时填入默认值; diff --git a/schema/roundtrip_test.go b/schema/roundtrip_test.go index 3bf0988..8a7fb26 100644 --- a/schema/roundtrip_test.go +++ b/schema/roundtrip_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "agent-intent/intent" + "git-ssh.u1680832.nyat.app/weichen/Agent-Intent.git/intent" ) func TestIntentSpecRoundTrip(t *testing.T) {