@antprofuse/saddle-skill 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +5 -4
- package/agents/openai.yaml +1 -1
- package/assets/saddle-configured.toml +4 -0
- package/assets/saddle-database.toml +4 -0
- package/assets/saddle-unit.toml +4 -0
- package/package.json +2 -2
- package/references/consumer-start.md +2 -2
- package/references/external-function-contracts.md +2 -2
- package/references/local-integration.md +9 -3
- package/references/programming-model.md +1 -1
- package/references/validation.md +4 -4
- package/scripts/saddle-03-gate.js +12 -5
package/SKILL.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: saddle-service-0-3
|
|
3
|
-
description: 使用 Saddle 0.3.
|
|
3
|
+
description: 使用 Saddle 0.3.4 Skill 开发或审查带 profusegw 固定入口和 profusecontract 强类型外部函数调用的 Rust 业务应用。用于定义 protobuf 契约、声明强类型业务配置、编写固定 ProfuseGwContext 四参数 handler、以框架响应映射业务拒绝和技术失败,或运行正式业务门禁。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Saddle 0.3.
|
|
6
|
+
# Saddle 0.3.4 业务研发契约
|
|
7
7
|
|
|
8
8
|
业务 Agent 的直接输入只有业务 spec 与本 Skill。不要要求用户阅读 Saddle 仓库、审计报告、组件提交或内部实现。
|
|
9
9
|
|
|
@@ -29,7 +29,7 @@ description: 使用 Saddle 0.3.3 Skill 开发或审查带 profusegw 固定入口
|
|
|
29
29
|
|
|
30
30
|
```toml
|
|
31
31
|
[dependencies]
|
|
32
|
-
saddle-framework = "=0.3.
|
|
32
|
+
saddle-framework = "=0.3.4"
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
`saddle-framework` 是唯一业务 facade。业务不得直接依赖 `saddle-core`、`saddle-admission`、`saddle-boundary`、`saddle-db`、`saddle-macros`、`saddle-observability`、`saddle-runtime` 或 `saddle-service`。
|
|
@@ -58,6 +58,7 @@ saddle-framework = "=0.3.3"
|
|
|
58
58
|
- 唯一配置入口是一个 `saddle.toml`,进程唯一参数为 `--config <path>`。生产启动使用绝对路径,例如 `target/release/my-app --config /etc/my-app/saddle.toml`;`--config saddle.toml` 与 `--config ./saddle.toml` 也合法,均相对当前工作目录定位文件,文件内相对路径则相对该配置文件所在目录解析。
|
|
59
59
|
- profusecontract 部署只接受 `[framework.profusecontract].authority`:值为一个固定 `http://host:port` plaintext authority,或含唯一 `{zone}` 占位的模板;不得携带 URL path、凭据、TLS、服务发现或 per-call endpoint。业务 handler 不读取该配置。
|
|
60
60
|
- 配置在 listener 建立前一次解析、校验、解析 secret 环境引用并冻结。普通配置不接受环境变量覆盖;secret 只能通过 `[secrets]` 明确声明的环境变量名注入。未知字段、缺失必填字段、类型错误、secret 缺失、数据库 secret/mapping 配置不成对或相对路径非法均须 fail-fast。
|
|
61
|
+
- 文件日志只由 `[framework.observability.logging]` 配置;默认目录 `./logs`、默认 `daily`。活动文件固定为 `saddle.log`;daily 归档为 `saddle.log.YYYY-MM-DD`,hourly 归档为 `saddle.log.YYYY-MM-DD-HH`。应用不得安装第二 subscriber,也不得把 stdout/stderr 混入该文件。大小轮转、压缩和清理策略不属于 Saddle 0.3.4,由运维侧管理归档目录容量与采集。
|
|
61
62
|
|
|
62
63
|
## 立即停止
|
|
63
64
|
|
|
@@ -70,7 +71,7 @@ saddle-framework = "=0.3.3"
|
|
|
70
71
|
- handler 返回 Rust `Result`/`Err`、空成功、任意 JSON,或业务自建第二响应结构;
|
|
71
72
|
- 业务拒绝或任一技术失败组合没有显式映射,机器码不稳定,或 `FailureMessage` 超过 256 bytes;
|
|
72
73
|
- 出现旧响应字段、顶层 code/message 或任何旧协议兼容叙述;
|
|
73
|
-
- Cargo 不是精确 `=0.3.
|
|
74
|
+
- Cargo 不是精确 `=0.3.4` Rust facade、缺 lock,或正式 Gate 不通过。
|
|
74
75
|
- 出现旧扁平 authority 长键或旧配置类型模块路径。
|
|
75
76
|
|
|
76
77
|
停止时只交最小复现和期望业务表达,由 Saddle 修复公共能力缺口。
|
package/agents/openai.yaml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Saddle 0.3 业务应用"
|
|
3
3
|
short_description: "使用 Saddle 0.3 开发受控边界的 Rust 业务应用"
|
|
4
|
-
default_prompt: "请安装 Saddle 0.3.
|
|
4
|
+
default_prompt: "请安装 Saddle 0.3.4 Skill(npm install --save-exact --ignore-scripts --no-audit --no-fund @antprofuse/saddle-skill@0.3.4),结合业务 spec 开始研发。"
|
|
@@ -4,6 +4,10 @@ listen = "0.0.0.0:8080"
|
|
|
4
4
|
[framework.profusecontract]
|
|
5
5
|
authority = "http://profusecontract-{zone}.internal:50051"
|
|
6
6
|
|
|
7
|
+
[framework.observability.logging]
|
|
8
|
+
directory = "/var/log/my-saddle-app"
|
|
9
|
+
rotation = "daily"
|
|
10
|
+
|
|
7
11
|
[secrets]
|
|
8
12
|
databaseUrlEnv = "SADDLE_DATABASE_URL"
|
|
9
13
|
|
package/assets/saddle-unit.toml
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antprofuse/saddle-skill",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "Saddle 0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
|
+
"description": "Saddle 0.3.4 中文 AI Coding 研发契约与业务门禁。",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"files": ["SKILL.md", "agents", "references", "scripts", "assets"],
|
|
7
7
|
"bin": {"saddle-03-gate": "scripts/saddle-03-gate.js"},
|
|
@@ -46,7 +46,7 @@ Saddle 在编译期从 `contract_dir` 确定性递归收集 `.proto`,闭合 im
|
|
|
46
46
|
|
|
47
47
|
## 阶段 3:Rust 实现
|
|
48
48
|
|
|
49
|
-
业务 crate 精确使用 `saddle-framework = "=0.3.
|
|
49
|
+
业务 crate 精确使用 `saddle-framework = "=0.3.4"`,然后按 [最小编程模型](programming-model.md) 编写固定 `deployment_app`、显式 `business_config`、静态 operation 声明和四参数 handler。不得直接依赖任何 Saddle 中间件 crate。
|
|
50
50
|
|
|
51
51
|
实现通过 Gate 后,按 [本地联调](local-integration.md) 由外部 harness 注入唯一 plaintext profusecontract authority,并以固定 profusegw body 验证真实 typed call。endpoint、request/call identity 和 deadline 都是框架或部署输入,不写入业务 spec。
|
|
52
52
|
|
|
@@ -63,6 +63,6 @@ Saddle 在编译期从 `contract_dir` 确定性递归收集 `.proto`,闭合 im
|
|
|
63
63
|
- 缺少固定 `deployment_app`,或 app/interfaceId/endpoint 被做成动态业务输入;
|
|
64
64
|
- 技术失败码或执行确定性存在 catch-all/default;
|
|
65
65
|
- 需要裸 gRPC/channel/bytes、第二入口、动态 descriptor 或未声明外部 I/O;
|
|
66
|
-
- `saddle-framework` 不是精确 `=0.3.
|
|
66
|
+
- `saddle-framework` 不是精确 `=0.3.4`,或 [正式 Gate](validation.md) 失败。
|
|
67
67
|
|
|
68
68
|
停止产物只包含最小复现、缺失身份和期望业务表达,不包含中间件替代实现。
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
- `puc` 是业务单元,例如 `puc`。
|
|
16
16
|
- `function` 是契约原始函数名,允许中文,例如 `查询用户绑定户号`。
|
|
17
17
|
- protobuf method、Rust 方法和 Java 方法使用各语言合法的本地标识符;它们不是跨系统身份。
|
|
18
|
-
- 0.3.
|
|
18
|
+
- 0.3.4 不定义 contract version、多版本路由、翻译表、alias 或 fallback。
|
|
19
19
|
|
|
20
20
|
## 定义步骤
|
|
21
21
|
|
|
@@ -82,4 +82,4 @@ message BoundAccount {
|
|
|
82
82
|
|
|
83
83
|
## 变更规则
|
|
84
84
|
|
|
85
|
-
先修改共同契约目录并重新通过双方 conformance,再修改两侧实现。禁止两侧各自维护近似定义后人工对齐;0.3.
|
|
85
|
+
先修改共同契约目录并重新通过双方 conformance,再修改两侧实现。禁止两侧各自维护近似定义后人工对齐;0.3.4 遇到不兼容变化时停止并共同升级,不在运行时并存或猜测版本。
|
|
@@ -38,7 +38,7 @@ target/release/my-saddle-app --config /etc/my-saddle-app/saddle.toml
|
|
|
38
38
|
|
|
39
39
|
生产推荐传绝对配置路径。`--config saddle.toml` 与 `--config ./saddle.toml` 也合法,它们都相对进程当前工作目录定位配置文件;配置中的 `mappingDir` 和业务 `resolve_path()` 则相对 `saddle.toml` 所在目录解析。进程只接受这一对参数,不从默认位置搜索、不合并多文件、不热更新。
|
|
40
40
|
|
|
41
|
-
0.3.
|
|
41
|
+
0.3.4 部署配置只接受 `[framework.profusecontract].authority`。有业务配置的完整最小文件是 [saddle-configured.toml](../assets/saddle-configured.toml),`business_config ();` 应用使用不含 `[business]` 的 [saddle-unit.toml](../assets/saddle-unit.toml):
|
|
42
42
|
|
|
43
43
|
```toml
|
|
44
44
|
[framework]
|
|
@@ -47,6 +47,10 @@ listen = "127.0.0.1:39101"
|
|
|
47
47
|
[framework.profusecontract]
|
|
48
48
|
authority = "http://127.0.0.{zone}:39102"
|
|
49
49
|
|
|
50
|
+
[framework.observability.logging]
|
|
51
|
+
directory = "./logs"
|
|
52
|
+
rotation = "daily"
|
|
53
|
+
|
|
50
54
|
[secrets]
|
|
51
55
|
|
|
52
56
|
[business]
|
|
@@ -58,13 +62,15 @@ dataPath = "fixtures/data"
|
|
|
58
62
|
|
|
59
63
|
- `[framework].listen`:必填字符串、无默认值,格式为可解析的 `IP:port`,决定实际 ProfuseGW bind 地址。
|
|
60
64
|
- `[framework.profusecontract].authority`:必填字符串、无默认值;必须是 plaintext `http://host:port` 固定地址,或只含一个 `{zone}` 的模板。模板由同一请求的 LDC zone 在调用前解析;禁止 path、query、fragment、userinfo、凭据和其他模板。
|
|
65
|
+
- `[framework.observability.logging].directory`:可选路径,默认 `./logs`;相对路径按进程当前工作目录解析。目录必须可创建并可写,否则 listener 建立前 fail-fast。
|
|
66
|
+
- `[framework.observability.logging].rotation`:可选枚举,默认 `daily`,也可显式设为 `hourly`。活动文件永远是 `saddle.log`;daily 归档名为 `saddle.log.YYYY-MM-DD`,hourly 归档名为 `saddle.log.YYYY-MM-DD-HH`。
|
|
61
67
|
- `[secrets].databaseUrlEnv`:仅数据库应用使用;值是必填环境变量的名称,不是连接串本身。启动时该环境变量必须存在且有效。
|
|
62
68
|
- `[database].mappingDir`:仅数据库应用使用;必须和 `databaseUrlEnv` 同时出现,指向相对配置文件目录的映射目录。数据库模板见 [saddle-database.toml](../assets/saddle-database.toml)。
|
|
63
69
|
- `[business]`:仅 `business_config Type;` 应用使用;字段由该强类型 `Type` 决定,没有框架默认值。字段缺失、额外或类型错误均拒绝。`business_config ();` 必须省略整节。
|
|
64
70
|
|
|
65
71
|
所有配置在 listener 建立前一次解析和冻结。普通字段不能由环境变量覆盖;secret 只能通过 `[secrets]` 中明确声明的环境变量引用注入。文件不可读、未知/旧键、缺失字段、类型错误、非法 bind/authority、secret 缺失、数据库配置不完整或映射目录非法都必须 fail-fast,并返回稳定的 `saddle.process.*` 错误码。
|
|
66
72
|
|
|
67
|
-
该 authority 是部署输入,不进入业务 spec、request 或 handler。TLS、鉴权、服务发现、负载均衡和生产凭据不属于 0.3.
|
|
73
|
+
该 authority 是部署输入,不进入业务 spec、request 或 handler。TLS、鉴权、服务发现、负载均衡和生产凭据不属于 0.3.4;需要其中任一能力时立即停止,不得在业务 crate 自建 client。
|
|
68
74
|
|
|
69
75
|
## 联调完成条件
|
|
70
76
|
|
|
@@ -76,6 +82,6 @@ dataPath = "fixtures/data"
|
|
|
76
82
|
4. 返回 `Completed` 或八类 `TechnicalFailure × ExecutionCertainty` 之一;业务代码显式处理,不自动重试。
|
|
77
83
|
5. 受管请求只形成一个 terminal,并在写 HTTP response 前完成资源归还。
|
|
78
84
|
|
|
79
|
-
结构化日志至少按正式 API 暴露的字段记录 trace/rpc、span/parent、request/call、app/interface、zone、outcome 与 duration;不得记录 payload、Cookie、session、原始 context、PII、secret 或数据库值。业务不得安装第二日志 subscriber
|
|
85
|
+
结构化日志至少按正式 API 暴露的字段记录 trace/rpc、span/parent、request/call、app/interface、zone、outcome 与 duration;不得记录 payload、Cookie、session、原始 context、PII、secret 或数据库值。业务不得安装第二日志 subscriber。`saddle.log` 是框架结构化日志;stdout/stderr 是独立进程流,运维采集时不得与文件日志拼接成同一记录源。Saddle 0.3.4 不提供按大小轮转、归档压缩或历史清理;目录容量、外部采集、压缩与保留期由业务运维环境负责。
|
|
80
86
|
|
|
81
87
|
联调 harness 可托管 listener 与受控 profusecontract server;业务源码不得复制 harness、直接依赖中间件 crate或注册第二入口。
|
package/references/validation.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Saddle 0.3.
|
|
1
|
+
# Saddle 0.3.4 Skill 正式业务 Gate
|
|
2
2
|
|
|
3
3
|
## 依赖与锁
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ edition = "2024"
|
|
|
12
12
|
rust-version = "1.95"
|
|
13
13
|
|
|
14
14
|
[dependencies]
|
|
15
|
-
saddle-framework = "=0.3.
|
|
15
|
+
saddle-framework = "=0.3.4"
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
在允许访问正式 registry 的依赖准备阶段生成并提交 `Cargo.lock`。禁止 `path`、`git`、`[patch]`、source replacement 或宽松 Saddle 版本。
|
|
@@ -25,10 +25,10 @@ saddle-framework = "=0.3.3"
|
|
|
25
25
|
npx --no-install saddle-03-gate --manifest-path Cargo.toml
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
命令由已安装的 `@antprofuse/saddle-skill@0.3.
|
|
28
|
+
命令由已安装的 `@antprofuse/saddle-skill@0.3.4` 提供,不需要 Saddle 源码仓库。它会检查:
|
|
29
29
|
|
|
30
30
|
- facade 精确版本、禁止直接中间件依赖和 Cargo source 旁路;
|
|
31
|
-
- `Cargo.lock` 中 admission、boundary、core、db、framework、macros、observability、runtime、service 九包统一精确映射 `0.3.
|
|
31
|
+
- `Cargo.lock` 中 admission、boundary、core、db、framework、macros、observability、runtime、service 九包统一精确映射 `0.3.4`;
|
|
32
32
|
- 唯一 `contract_dir`、目录存在、禁止旧单文件 contract 声明;
|
|
33
33
|
- 目录根部 `saddle_external_function.proto` 与 Skill 权威模板逐字一致且仅出现一次,使用 option 的业务 proto 必须 direct import 根文件;
|
|
34
34
|
- 编译期递归扫描/import 闭包、option-only 索引、身份唯一、请求结果类型匹配,以及所有 function 均有实际 `uses`;
|
|
@@ -30,8 +30,8 @@ if (/^\s*\[(patch|replace)\b/m.test(cargo) || /\b(path|git|branch|tag)\s*=/.test
|
|
|
30
30
|
stop("DEPENDENCY_SOURCE", "禁止 path/git/patch/replace 依赖旁路");
|
|
31
31
|
}
|
|
32
32
|
const facade = cargo.match(/^\s*saddle-framework\s*=\s*(.+)$/m);
|
|
33
|
-
if (!facade || !/^"=0\.3\.
|
|
34
|
-
stop("SADDLE_VERSION", '必须直接且精确依赖 saddle-framework = "=0.3.
|
|
33
|
+
if (!facade || !/^"=0\.3\.4"\s*(?:#.*)?$/.test(facade[1].trim())) {
|
|
34
|
+
stop("SADDLE_VERSION", '必须直接且精确依赖 saddle-framework = "=0.3.4"');
|
|
35
35
|
}
|
|
36
36
|
const internals = ["saddle-core","saddle-admission","saddle-boundary","saddle-db","saddle-macros","saddle-observability","saddle-runtime","saddle-service"];
|
|
37
37
|
for (const name of internals) {
|
|
@@ -44,8 +44,8 @@ if (!fs.existsSync(lockPath)) {
|
|
|
44
44
|
const publicClosure = ["saddle-admission", "saddle-boundary", "saddle-core", "saddle-db", "saddle-framework", "saddle-macros", "saddle-observability", "saddle-runtime", "saddle-service"];
|
|
45
45
|
for (const name of publicClosure) {
|
|
46
46
|
const escaped = name.replaceAll("-", "\\-");
|
|
47
|
-
if (!new RegExp(`name = "${escaped}"\\nversion = "0\\.3\\.
|
|
48
|
-
stop("LOCK", `Cargo.lock 未绑定 ${name} 0.3.
|
|
47
|
+
if (!new RegExp(`name = "${escaped}"\\nversion = "0\\.3\\.4"`).test(lock)) {
|
|
48
|
+
stop("LOCK", `Cargo.lock 未绑定 ${name} 0.3.4`);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -80,6 +80,13 @@ if (!fs.existsSync(configPath)) {
|
|
|
80
80
|
if (/^\s*(?:profusecontractAuthorityTemplate|profusecontractEndpointEnv|profusecontractAuthority)\s*=/m.test(config)) {
|
|
81
81
|
stop("AUTHORITY_TEMPLATE", "禁止旧长键或近似 authority 配置键");
|
|
82
82
|
}
|
|
83
|
+
const logging = config.match(/^\s*\[framework\.observability\.logging\]\s*$([\s\S]*?)(?=^\s*\[|\s*$)/m);
|
|
84
|
+
if (logging) {
|
|
85
|
+
const directory = logging[1].match(/^\s*directory\s*=\s*"([^"]+)"\s*$/m);
|
|
86
|
+
const rotation = logging[1].match(/^\s*rotation\s*=\s*"([^"]+)"\s*$/m);
|
|
87
|
+
if (directory && directory[1].trim() === "") stop("LOGGING", "logging.directory 不得为空");
|
|
88
|
+
if (rotation && !/^(daily|hourly)$/.test(rotation[1])) stop("LOGGING", "logging.rotation 只允许 daily/hourly");
|
|
89
|
+
}
|
|
83
90
|
const unitConfig = /\bbusiness_config\s+\(\)\s*;/.test(source);
|
|
84
91
|
const hasBusinessTable = /^\s*\[business\]\s*$/m.test(config);
|
|
85
92
|
if (unitConfig && hasBusinessTable) stop("BUSINESS_CONFIG", "business_config () 的 saddle.toml 必须省略 [business]");
|
|
@@ -175,4 +182,4 @@ try {
|
|
|
175
182
|
fs.rmSync(target, {recursive: true, force: true});
|
|
176
183
|
}
|
|
177
184
|
if (process.exitCode) process.exit(process.exitCode);
|
|
178
|
-
process.stdout.write("SADDLE_03_GATE PASS; SKILL=0.3.
|
|
185
|
+
process.stdout.write("SADDLE_03_GATE PASS; SKILL=0.3.4; RUST=0.3.4; CLOSED_RESPONSE; CLOSED_CODES; FAILURE_MESSAGE_256; FAILURE_8X3; LOCKED_OFFLINE\n");
|