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
This commit is contained in:
+5
-6
@@ -5,10 +5,10 @@
|
||||
## 仓库与操作
|
||||
|
||||
- 目标/产品边界:独立的 Agent 执行基础库。提供执行契约(contract)、执行端口(exec)、自研运行时(runtime)、外部适配器(adapters)与行为验收(conformance)。不实现小队编排,不依赖 Core 或 Squad。
|
||||
- 源码、资产、文档、机器契约位置:Go 源码在仓库根包目录;模块路径 `agent-native`;人类文档在根 `README.md`、`docs/`、`policy/`;过程记录在 `docs/records/`;机器契约以 `contract` 包类型为准。
|
||||
- 源码、资产、文档、机器契约位置:Go 源码在仓库根包目录;模块路径 `git-ssh.u1680832.nyat.app/weichen/Agent-Native.git`;人类文档在根 `README.md`、`docs/`、`policy/`;过程记录在 `docs/records/`;机器契约以 `contract` 包类型为准。
|
||||
- 权威远端、集成基线、受保护分支:`ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-Native.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-Native` 的 Issue 与 Pull Request。
|
||||
- 规范性文档目录:`policy/`。
|
||||
@@ -21,9 +21,8 @@
|
||||
| 逻辑 ID | 路径 | 角色 |
|
||||
|---|---|---|
|
||||
| development-guidelines | `deps/development-guidelines` | development-only,规范文本 |
|
||||
| error-code-system | `deps/error-code-system` | build-required,规范码目录 |
|
||||
| logging-system | `deps/logging-system` | build-required,可选日志器 |
|
||||
| agent-intent | `deps/agent-intent` | build-required,可选意图闸门装饰器(`adapters/intentgate`) |
|
||||
| error-code-system | `go.mod` / `go.sum` | build-required,规范码目录 |
|
||||
| logging-system | `go.mod` / `go.sum` | build-required,可选日志器 |
|
||||
|
||||
克隆:
|
||||
|
||||
@@ -32,7 +31,7 @@ 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 固定。
|
||||
|
||||
## 验证命令
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
独立的 Agent 执行基础仓库:自研执行内核(runtime)、模型与工具能力接入、外部 Agent
|
||||
适配器(现有 PI Runner 等),以及共用执行契约与行为验收(conformance)。
|
||||
|
||||
本仓库是该模块的源码位置。Go 模块路径为 `agent-native`。
|
||||
本仓库是该模块的源码位置。Go 模块路径为 `git-ssh.u1680832.nyat.app/weichen/Agent-Native.git`。
|
||||
|
||||
## 仓库分层
|
||||
|
||||
@@ -43,20 +43,11 @@
|
||||
- Workspace 路径授权 ≠ OS 沙箱。
|
||||
- `contract.ErrorCode` 取值是 `agent.*` 规范码。`ErrorCode()` / `ErrorFields()` 供日志库识别,本包不导入错误码库。
|
||||
|
||||
## 依赖子模块
|
||||
## 依赖与版本
|
||||
|
||||
| 路径 | 作用 |
|
||||
|---|---|
|
||||
| `deps/development-guidelines` | 开发规范,不参与编译 |
|
||||
| `deps/error-code-system` | 规范码目录。`go.mod` 的 `replace` 指向这里 |
|
||||
| `deps/logging-system` | 结构化日志。runtime 与 native 适配器可选使用 |
|
||||
错误码与日志依赖由 `go.mod` / `go.sum` 固定远端可获取的提交版本。正式测试和构建使用 `GOWORK=off`,不依赖源码目录替换。私有模块获取使用 Dev 工作区提供的进程级传输配置;模块身份不包含端口或凭证。
|
||||
|
||||
版本以本仓 gitlink 为准。`scripts/submodule-consistency.sh` 核对 gitlink 与检出的 HEAD。
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-Native.git
|
||||
# 已克隆时:git submodule update --init --recursive
|
||||
```
|
||||
`deps/` 的既有 gitlink 暂留供旧提交和在途分支重建;本版本编译不消费其中的 Go 源码。开发规范仍由 `deps/development-guidelines` 固定。迁移在途分支时只改 Go import 前缀与模块声明,不改后端名、事件或持久化标识;本地联调通过 Dev 的显式组件链接管理。
|
||||
|
||||
## CodeGraph
|
||||
|
||||
@@ -73,15 +64,14 @@ go test ./...
|
||||
|
||||
## 依赖本仓库
|
||||
|
||||
消费方把本仓库当作独立模块。模块路径是短名 `agent-native`,在消费方 `go.mod` 中用 `replace` 指向检出目录:
|
||||
消费方以真实提交版本接入,在已配置私有传输的环境中运行:
|
||||
|
||||
```
|
||||
require agent-native v0.0.0
|
||||
|
||||
replace agent-native => ./deps/agent-native
|
||||
```bash
|
||||
go get git-ssh.u1680832.nyat.app/weichen/Agent-Native.git@<approved-commit>
|
||||
GOWORK=off go test ./...
|
||||
```
|
||||
|
||||
本仓自己的 `go.mod` 则把错误码库和日志库替换到 `./deps/`。消费方若同时依赖这三仓,必须在消费方 `go.mod` 里写自己的 `replace`:依赖模块内部的 `replace` 不会在上层构建中生效。
|
||||
版本由 Go 生成并记录在消费方 `go.mod` / `go.sum`。源码 import 使用同一完整模块前缀;运行时后端名仍为 `agent-native`。
|
||||
|
||||
远程:`ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-Native.git`
|
||||
|
||||
|
||||
+13
-13
@@ -12,20 +12,20 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"agent-native/exec"
|
||||
"agent-native/runtime"
|
||||
"agent-native/runtime/checkpoint"
|
||||
"agent-native/runtime/filestate"
|
||||
"agent-native/runtime/hooks"
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/mcp"
|
||||
"agent-native/runtime/promptx"
|
||||
"agent-native/runtime/session"
|
||||
"agent-native/runtime/skills"
|
||||
"agent-native/runtime/subagent"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/checkpoint"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/filestate"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/hooks"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/mcp"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/promptx"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/session"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/skills"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/subagent"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
|
||||
"logging-system/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
)
|
||||
|
||||
// ModelOptions 是模型接入。Stream 非空时不再按 APIBase/APIKey 构造客户端。
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"agent-native/exec"
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
// script 按序回放假助手轮次(对齐 runtime/loop_test 的伪造方式)。
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/exec"
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
func TestBackendCompactBeforeRun(t *testing.T) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"agent-native/exec"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
|
||||
)
|
||||
|
||||
// contractBackend 把 Backend 适配为 exec.ContractBackend。
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"agent-native/conformance"
|
||||
"agent-native/exec"
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/conformance"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
// TestContractBackendConformance 把 native 后端的契约形态挂上最小契约套件
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/exec"
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/mcp"
|
||||
"agent-native/runtime/subagent"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/mcp"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/subagent"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
func TestBackendExecToolsWiredWithOptionsAndRequestEnv(t *testing.T) {
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"agent-native/exec"
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
type hostTool struct{ name string }
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/mcp"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/mcp"
|
||||
)
|
||||
|
||||
// TestMain:MCP fake server 的 re-exec 分支(详见 mcp.RunFakeServer)。
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"os/exec"
|
||||
"testing"
|
||||
|
||||
"agent-native/rpc"
|
||||
"agent-native/runtime"
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/session"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/rpc"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/session"
|
||||
)
|
||||
|
||||
func TestEventAndRPCFixtures(t *testing.T) {
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"agent-native/exec"
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
// captureStream 捕获每次调用的 model / 首条 system 消息,并按序回放回合。
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"agent-native/exec"
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
// failThenSucceed 首次流返回 context overflow 错误,之后正常结束。
|
||||
|
||||
@@ -3,8 +3,8 @@ package catalogcheck
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"agent-native/exec"
|
||||
"error-code-system/errcode"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Error-Code-System.git/errcode"
|
||||
)
|
||||
|
||||
// 常量取值必须与错误码库种子码相同。旧短字符串只作为错误码库里的别名存在。
|
||||
|
||||
@@ -10,10 +10,10 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"agent-native/rpc"
|
||||
"agent-native/runtime"
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/session"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/rpc"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/session"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"agent-native/exec"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
|
||||
)
|
||||
|
||||
// FakeBackend 是确定性假实现,仅用于契约套件自测与消费方单测。
|
||||
|
||||
@@ -3,7 +3,7 @@ package conformance
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"agent-native/exec"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
|
||||
)
|
||||
|
||||
func TestFakeBackendSuite(t *testing.T) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"agent-native/exec"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
|
||||
)
|
||||
|
||||
func TestStubBackendExecution(t *testing.T) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"agent-native/exec"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
|
||||
)
|
||||
|
||||
type slowBackend struct {
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
module agent-native
|
||||
module git-ssh.u1680832.nyat.app/weichen/Agent-Native.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
|
||||
)
|
||||
|
||||
replace error-code-system => ./deps/error-code-system
|
||||
|
||||
replace logging-system => ./deps/logging-system
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
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=
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"agent-native/runtime"
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/session"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/session"
|
||||
)
|
||||
|
||||
// Request is one RPC command. Type matches the pi headless command set.
|
||||
|
||||
+3
-3
@@ -6,9 +6,9 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime"
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/session"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/session"
|
||||
)
|
||||
|
||||
func TestRPCSessionCommandsAndClient(t *testing.T) {
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/hooks"
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/hooks"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
func TestHookAdaptersMatchDirectCallbacks(t *testing.T) {
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/session"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/session"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
type replayTool struct {
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// ProcessEventVocabulary 是过程流消费方(小队过程视图,对应 PI proc 帧转发)
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"os/exec"
|
||||
"sync"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// Message is one JSONL frame on the extension pipe.
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"agent-native/runtime/ext/pkg"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/ext/pkg"
|
||||
)
|
||||
|
||||
func TestExtensionRegistersAndHooks(t *testing.T) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"agent-native/runtime/reminders"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/reminders"
|
||||
)
|
||||
|
||||
// ProgressReminder 是进度提醒的节流状态机与格式化机制。
|
||||
|
||||
@@ -7,7 +7,7 @@ package guardrails
|
||||
import (
|
||||
"context"
|
||||
|
||||
"agent-native/runtime/hooks"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/hooks"
|
||||
)
|
||||
|
||||
// Verdict 是一次护栏表态。空 Decision 表示不插手。
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/hooks"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/hooks"
|
||||
)
|
||||
|
||||
func TestToolGuardrailMergesOnPreToolUse(t *testing.T) {
|
||||
|
||||
+8
-8
@@ -9,15 +9,15 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"agent-native/runtime/hooks"
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/memory"
|
||||
"agent-native/runtime/reminders"
|
||||
"agent-native/runtime/session"
|
||||
"agent-native/runtime/telemetry"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/hooks"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/memory"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/reminders"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/session"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/telemetry"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
|
||||
"logging-system/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// usageScript 产出带 usage 的固定回合,用于预算测试。
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// ---- N2 WP1:前缀稳定契约(缓存友好的机器钉住:同一注册序列 → 逐字节确定)----
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// ctxEchoTool 把自己从 ctx 读到的调用 ID 记下来(并发安全),验证内核
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// TestLoopToolEventsCarryCallID 验证 tool_execution_start/end 事件带工具调用
|
||||
|
||||
@@ -5,10 +5,10 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/guardrails"
|
||||
"agent-native/runtime/hooks"
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/guardrails"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/hooks"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// TestInputGuardrailDenySkipsLoop:输入护栏 deny 时不进循环、不调模型,
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/session"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/session"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
func TestLoopStopContinuesUntilCap(t *testing.T) {
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/hooks"
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/hooks"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
type eventRecorder struct {
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// ---- N3 WP4:循环 span 形态(名称后缀、关联、usage)----
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// orderTool 记录自己的执行序号(并发安全)。
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/session"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/session"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
func script(turns ...llm.Message) llm.StreamFunc {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// 桥接上限:server 元数据是不可信输入,长度与数量都必须受限。
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// TestMain:环境变量置位时,本测试二进制化身为 stdio MCP server(真实子进程测试)。
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// memory_write 工具:模型自服务写回(fail-closed 校验 scope/type/content)。
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/memory"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/memory"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// ---- N3 WP5:循环消费点(注入 + memory_write 接线)----
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/session"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/session"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
type countingTool struct {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
type Kind string
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
func TestAttachDoesNotAddUserAfterTool(t *testing.T) {
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/skills"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/skills"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
func TestContextAndPromptAndTrust(t *testing.T) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
// Stats 是转录文件的轻量元数据(扫描即得,无副作用)。
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
func appendMsgs(t *testing.T, s *Store, msgs ...llm.Message) {
|
||||
|
||||
@@ -3,7 +3,7 @@ package session
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
// ToolIntent 是一次尚未配对结果的工具调用声明。
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
// Store is an append-only JSONL transcript. New sessions are a tree of
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
func TestAppendAndReplay(t *testing.T) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
func TestClearOldToolResultsKeepsLastFive(t *testing.T) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
func TestR2CompactKeepsToolPair(t *testing.T) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
// EntryType is the kind of one JSONL record.
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
func TestTreeForkCloneAndLeaf(t *testing.T) {
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"agent-native/runtime/hooks"
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/session"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/hooks"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/session"
|
||||
)
|
||||
|
||||
// Delivery selects how a queued steer or follow-up is handed to the loop.
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
)
|
||||
|
||||
func TestAgentSessionPromptForwardsStop(t *testing.T) {
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// writeSkill 写一份符合开放规范的 SKILL.md(name/description 齐备)。
|
||||
|
||||
@@ -15,8 +15,8 @@ import (
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"agent-native/runtime/hooks"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/hooks"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// Request 是一次委派的完整信息集(模型经工具参数逐项填写)。
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/hooks"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/hooks"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
func TestDelegateEmitsStartAndStop(t *testing.T) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
func TestRegisterNilFactoryNoop(t *testing.T) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"logging-system/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
)
|
||||
|
||||
// Span 是一次 invoke_agent、chat 或 execute_tool。
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"agent-native/runtime/filestate"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/filestate"
|
||||
)
|
||||
|
||||
type readFile struct {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/checkpoint"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/checkpoint"
|
||||
)
|
||||
|
||||
func TestWriteAndEditRecordCheckpoints(t *testing.T) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"agent-native/runtime/codeorch"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/codeorch"
|
||||
)
|
||||
|
||||
// RegisterCodeTool 注册 run_tool_script。调用方在开关打开时才注册。
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"agent-native/runtime/codeorch"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/codeorch"
|
||||
)
|
||||
|
||||
type searchTool struct{ reg *Registry }
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-native/runtime/filestate"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/filestate"
|
||||
)
|
||||
|
||||
func TestTrackedWriteRejectsUnreadAndStale(t *testing.T) {
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"agent-native/runtime/checkpoint"
|
||||
"agent-native/runtime/filestate"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/checkpoint"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/filestate"
|
||||
)
|
||||
|
||||
// Result is the tool payload returned to the model.
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"agent-native/runtime/llm"
|
||||
"agent-native/runtime/tools"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/llm"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/tools"
|
||||
)
|
||||
|
||||
// ---- N3 WP6:计费拆分与默认重试 ----
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"agent-native/exec"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
|
||||
)
|
||||
|
||||
func TestRequestAndResultRoundTrip(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user