agentworkshop 0.12.0 → 0.13.0
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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/2f96705b-cf57-4bde-87a4-1b818b268f0f.json +1 -0
- package/.output/server/chunks/_/nitro.mjs +1102 -1088
- package/.output/server/package.json +1 -1
- package/README-zh.md +18 -6
- package/README.md +20 -6
- package/config.yml +1 -1
- package/docs/cli.en.md +1 -1
- package/docs/cli.md +1 -1
- package/docs/plugin-idd-rag-contract.md +87 -0
- package/docs/plugins.en.md +2 -2
- package/docs/plugins.md +2 -2
- package/docs/sdk.en.md +1 -1
- package/docs/sdk.md +1 -1
- package/package.json +2 -1
- package/scripts/onboarding/sim-twin.mjs +27 -15
- package/server/plugins-builtin/diag-bridge/host/deposit.mjs +232 -0
- package/server/plugins-builtin/diag-bridge/host/diagnosis.mjs +121 -38
- package/server/plugins-builtin/diag-bridge/host/external-v1.mjs +213 -0
- package/server/plugins-builtin/diag-bridge/host/helpers.mjs +4 -2
- package/server/plugins-builtin/diag-bridge/host/intents.mjs +65 -62
- package/server/plugins-builtin/diag-bridge/host/plugin.mjs +351 -82
- package/server/plugins-builtin/diag-bridge/host/receipt.mjs +83 -0
- package/server/plugins-builtin/diag-bridge/host/sweep.mjs +70 -91
- package/server/plugins-builtin/diag-bridge/i18n.json +4 -0
- package/server/plugins-builtin/rag-bridge/i18n.json +18 -0
- package/server/plugins-builtin/rag-bridge/index.mjs +556 -68
- package/server/services/workshop/agents/industrial/optimization-tools.ts +12 -1
- package/server/services/workshop/tools/policy.ts +16 -1
- package/.output/public/_nuxt/builds/meta/577f464e-672a-4c4e-a3c8-dc8c1b38930d.json +0 -1
package/README-zh.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
[](https://www.npmjs.com/package/agentworkshop)
|
|
12
12
|
[](https://www.npmjs.com/package/agentworkshop)
|
|
13
|
-
[](https://github.com/kingdol666/AgentWorkShop/releases/tag/v0.
|
|
13
|
+
[](https://github.com/kingdol666/AgentWorkShop/releases/tag/v0.13.0)
|
|
14
14
|
[](https://github.com/kingdol666/AgentWorkShop/stargazers)
|
|
15
15
|
[](https://github.com/kingdol666/AgentWorkShop/commits)
|
|
16
16
|
[](https://github.com/kingdol666/AgentWorkShop/issues)
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
**[English](./README.md)** · **[在线文档](https://kingdol666.github.io/AgentWorkShop)** · **[版本发布](https://github.com/kingdol666/AgentWorkShop/releases)** · **[更新日志](./changelog.md)** · **[插件 API](./docs/plugins.md)** · **[SDK](./docs/sdk.md)**
|
|
30
30
|
|
|
31
|
-
<sub><b>源码 v0.
|
|
31
|
+
<sub><b>源码 v0.13.0(2026-11-18 发布)</b> · 14 个执行引擎 · 6 种现场协议(5 内置 + 串口插件)+ MES REST(镜像与直连双路径)· **项目中心** · **RSI 经验演化** · **IDD/RAG 插件集成** · 142 个宿主工具 · 144 个运行时设置项 · 双语文档(简体中文 / English)</sub>
|
|
32
32
|
|
|
33
33
|
<br />
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
</div>
|
|
38
38
|
|
|
39
|
-
[快速开始](#快速开始) · [当前源码](#当前源码-v0-
|
|
39
|
+
[快速开始](#快速开始) · [当前源码](#当前源码-v0-13-0) · [0.13.0 发布说明](#whats-new-in-0130) · [Agent 团队模型](#agent-团队模型) · [核心能力](#核心能力) · [设计架构](#设计架构) · [验证与验收](#验证与验收) · [文档站](https://kingdol666.github.io/AgentWorkShop)
|
|
40
40
|
|
|
41
41
|
---
|
|
42
42
|
|
|
@@ -49,9 +49,21 @@
|
|
|
49
49
|
- **交付是一等概念**:**Project 模式**把蓝图变成计划、带依赖的 WBS、L1 技术复核、L2 Owner 验收与真实交付物——交付物不通过,项目不算完成;
|
|
50
50
|
- **作业链按治理阶段实现**:读取 → 分析 → 提案 → 按有效策略审批(如适用)→ 下发 → 回读/审计;每份验收证据应注明实际覆盖范围及使用模拟器还是物理设备。
|
|
51
51
|
|
|
52
|
-
## 当前源码 v0.
|
|
52
|
+
## 当前源码 v0.13.0
|
|
53
53
|
|
|
54
|
-
当前源码版本为 **0.
|
|
54
|
+
当前源码版本为 **0.13.0**,已于 2026-11-18 发布(npm + GitHub Release)。本版把 **IDD**(工业深度诊断)与 **RAG**(rag-knowledge)两座桥生产化:diag-bridge 主契约迁移 IDD `external/v1`(提交前 capabilities 定轨 + 显式 legacy 回退),新增 `diag_chat` / `diag_stop` / `diag_deposit`;rag-bridge 新增文档工具族(`kb_doc_create/search/read/catalog`),落在独立的 `aw-docs` 知识库。插件写工具纳入 fail-closed 写族联合判定,插件 health 暴露逐工具计数,提交→轮询→回执→结果→入库全链按同一持久化契约路由。全新 home 三系统实测:供给 **9/9**、频道锻造 **11/11**、V1–V6 **11/11**;**142 个宿主工具**(127 内置 + 15 插件,schema 增量约 965 tokens);真实模型回合原生调用 `kb_doc_search → kb_doc_read → diag_run → diag_status`;受治理闭环 **SP 156→150→144→138 °C**(每步 HITL、设备证实 1/1),PV 复测 3/3 落 [138,142](均值 139.68),配方 v2 固化。门禁:lint、typecheck、unit **2059/2060**(1 skip)、build。证据:[2026-11-18 插件 v1 验收](docs/audit/evidence/2026-11-18-idd-rag-plugin-v1-contract/REPORT.md)。
|
|
55
|
+
|
|
56
|
+
## What's new in 0.13.0
|
|
57
|
+
|
|
58
|
+
- **diag-bridge v2.4**:`external/v1` 为主契约,提交前 `GET /capabilities` 定轨(5 分钟指纹缓存)+ 显式 `contract=legacy` 回退;六态生命周期,`awaiting_input` 占产线单飞锁并按老化上限转 `expired`;新增 `diag_chat` / `diag_stop` / `diag_deposit`;全 7 意图与 ontology / preprocessing / report-language 透传;9 类错误码映射为可读处方。
|
|
59
|
+
- **rag-bridge v2.3**:`kb_doc_create` / `kb_doc_search` / `kb_doc_read` / `kb_catalog` 四工具落在 `aw-docs`(与 `aw-industrial` 经验库分键);two-stage 主检索 + 带标注的关键词降级;创建幂等,并用 `index-document`(向量 + BM25 增量)建索引——整库 reindex 不会刷新后端进程内 BM25。
|
|
60
|
+
- **一条闭环入库**:`diag_deposit` 取已完成 run 的报告 → 写 `aw-docs` → 建索引 → 打标签 → 两段检索自查;报告为空时如实失败、不落半截文档。
|
|
61
|
+
- **写安全与可观测**:`isPolicyWriteTool` = 静态写名单 ∪ 已注册插件 `riskClass='write'`(实时注册表,无缓存窗口);插件 health 暴露逐工具 ok/err 计数,写类工具留 ops 审计。
|
|
62
|
+
- **双语指南**:[IDD / RAG 插件集成](https://kingdol666.github.io/AgentWorkShop/guide/idd-rag-plugins)覆盖工具清单、契约定轨、生命周期、错误码、降级与灰度。
|
|
63
|
+
|
|
64
|
+
## What's new in 0.12.0 — 历史发布说明
|
|
65
|
+
|
|
66
|
+
0.12.0 引入 claim-token CAS、恢复保留处置面、DCW transport-ack 写验证与模拟器归属证明;完整列表见[更新日志](./changelog.md)。发布后第二轮加固(`900ad228`,PR #228)修复了第二轮测评复现的四个缺陷:消息看门狗改为活动窗口(HITL 等待不再误杀健康长回合——上一轮被 abort+重放 3 次的 16 分钟治理回合本轮一次投递、0 次 abort)、HITL 到期权威收口并发终态通告、rag-bridge kb_agent 失败分类(401→轮换 token,不再误导"检查 web")、verify-line V6 对未预置夹具的 fresh home 记 SKIP。门禁:lint、typecheck、unit **1799/1799**、build、docs **101/101**、Skills **176/176**、MCP **14/14**、插件 **22/22**、SDK、twin 5/5。全新五协议实测:onboard 首跑 25/25 + 冒烟 7/7;omp + `ustc/deepseek-flash` 频道治理步(HITL → run `readback-verified` 1/1、journal 锚点);IDD `industrial-optimizer-loop` R001 31.7875→32.5611 g(incumbent,D=0.825)+ R002 GP-EI 落 CI 内、gate 13/13;RAG 入库后检索排名第 1。见[第二轮测评报告](docs/audit/2026-11-16-round2-fixes-full-acceptance.md)。物理 HIL 未验证;RAG 内部 agent 仍不稳定(外部);Mimosa inconclusive;USTC key 两次触及 3h 预算(外部配额)。
|
|
55
67
|
|
|
56
68
|
## 0.11.2 历史发布快照(不是当前主干验收)
|
|
57
69
|
|
|
@@ -416,7 +428,7 @@ curl -X POST http://localhost:3001/api/workshop/projects/instantiate \
|
|
|
416
428
|
|
|
417
429
|
**如果这个项目对你有用,点一个 ⭐ 能让更多人找到它。**
|
|
418
430
|
|
|
419
|
-
当前源码版本:**v0.
|
|
431
|
+
当前源码版本:**v0.13.0(已发布 2026-11-18)** —— [最新版本 v0.13.0](https://github.com/kingdol666/AgentWorkShop/releases/tag/v0.13.0) · [更新日志](./changelog.md) · [在线文档](https://kingdol666.github.io/AgentWorkShop)
|
|
420
432
|
|
|
421
433
|
<a href="https://star-history.com/#kingdol666/AgentWorkShop&Date">
|
|
422
434
|
<img src="https://api.star-history.com/svg?repos=kingdol666/AgentWorkShop&type=Date" alt="Star history" width="70%" />
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
[](https://www.npmjs.com/package/agentworkshop)
|
|
12
12
|
[](https://www.npmjs.com/package/agentworkshop)
|
|
13
|
-
[](https://github.com/kingdol666/AgentWorkShop/releases/tag/v0.
|
|
13
|
+
[](https://github.com/kingdol666/AgentWorkShop/releases/tag/v0.13.0)
|
|
14
14
|
[](https://github.com/kingdol666/AgentWorkShop/stargazers)
|
|
15
15
|
[](https://github.com/kingdol666/AgentWorkShop/commits)
|
|
16
16
|
[](https://github.com/kingdol666/AgentWorkShop/issues)
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
**[简体中文](./README-zh.md)** · **[Documentation](https://kingdol666.github.io/AgentWorkShop)** · **[Releases](https://github.com/kingdol666/AgentWorkShop/releases)** · **[Changelog](./changelog.md)** · **[Plugin API](./docs/plugins.md)** · **[SDK](./docs/sdk.md)**
|
|
30
30
|
|
|
31
|
-
<sub><b>source v0.
|
|
31
|
+
<sub><b>source v0.13.0 (released 2026-11-18)</b> · 14 engines · 6 field protocols (5 built-in + serial plugin) + MES REST (mirror & live) · **Project center** · **RSI experience evolution** · **IDD/RAG plugin integration** · 142 host tools · 144 runtime settings · bilingual docs (简体中文 / English)</sub>
|
|
32
32
|
|
|
33
33
|
<br />
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
</div>
|
|
38
38
|
|
|
39
|
-
[Quick start](#quick-start) · [Current source](#current-source-v0-
|
|
39
|
+
[Quick start](#quick-start) · [Current source](#current-source-v0-13-0) · [0.13.0 release notes](#whats-new-in-0130) · [Agent team model](#the-agent-team-model) · [Capabilities](#capabilities) · [Architecture](#architecture) · [Verification](#verification) · [Docs site](https://kingdol666.github.io/AgentWorkShop)
|
|
40
40
|
|
|
41
41
|
---
|
|
42
42
|
|
|
@@ -49,9 +49,23 @@ A configuration-driven platform where **AI agent teams** and industrial systems
|
|
|
49
49
|
- **Delivery is a first-class concept**: **Project mode** turns a blueprint into a plan, a WBS with dependencies, L1 technical review, L2 owner acceptance and real deliverables — the project closes only when the deliverables pass;
|
|
50
50
|
- **The loop is implemented in governed stages**: read → analyze → propose → policy-controlled approval where required → write → readback/audit; the scope of each test and whether it used a simulator or physical equipment are stated with its evidence.
|
|
51
51
|
|
|
52
|
-
## Current source: v0.
|
|
52
|
+
## Current source: v0.13.0
|
|
53
53
|
|
|
54
|
-
The source version is **0.
|
|
54
|
+
The source version is **0.13.0**, published on 2026-11-18 (npm + GitHub Release). This release productizes the **IDD** (industrial deep-diagnostic) and **RAG** (rag-knowledge) bridges: diag-bridge now targets IDD's `external/v1` contract with pre-submit capability pinning and an explicit legacy fallback, adds `diag_chat` / `diag_stop` / `diag_deposit`, and rag-bridge adds a deterministic document tool family (`kb_doc_create/search/read/catalog`) on a dedicated `aw-docs` knowledge base. Plugin write tools now join the fail-closed write classification, tool counters are exposed on plugin health, and the whole lifecycle (submit → poll → receipts → results → deposit) routes on one persisted contract.
|
|
55
|
+
|
|
56
|
+
Fresh-home three-system acceptance: provisioning **9/9**, channel forge **11/11**, V1–V6 **11/11**; **142 host tools** (127 builtin + 15 plugin, +965 schema tokens); a real model turn natively called `kb_doc_search → kb_doc_read → diag_run → diag_status`; governed closed loop **SP 156→150→144→138 °C** with HITL on every step and device-confirmed 1/1 writes, PV retest 3/3 inside [138,142] (mean 139.68), recipe v2 frozen. Gates: lint, typecheck, unit **2059/2060** (1 skipped), build. Evidence: [2026-11-18 plugin v1 acceptance](docs/audit/evidence/2026-11-18-idd-rag-plugin-v1-contract/REPORT.md).
|
|
57
|
+
|
|
58
|
+
## What's new in 0.13.0
|
|
59
|
+
|
|
60
|
+
- **diag-bridge v2.4**: `external/v1` is the primary contract with a pre-submit `GET /capabilities` probe (5-min fingerprint cache) and an explicit `contract=legacy` fallback; the six v1 terminal states are handled, `awaiting_input` holds the line single-flight lock and ages to `expired`, and `diag_chat` / `diag_stop` / `diag_deposit` are new tools. All seven analysis intents pass through, along with ontology / preprocessing / report-language fields.
|
|
61
|
+
- **rag-bridge v2.3**: document tools `kb_doc_create` / `kb_doc_search` / `kb_doc_read` / `kb_catalog` on the `aw-docs` knowledge base (separate from the `aw-industrial` experience base); two-stage retrieval is the primary path with a labelled keyword fallback; creation is idempotent and uses `index-document` (vector + BM25) because a whole-KB reindex does not refresh the backend's in-process BM25 index.
|
|
62
|
+
- **One-loop deposit**: `diag_deposit` reads a completed run's report, writes it to `aw-docs`, indexes it, tags it and self-checks retrieval — no manual copy step; empty reports fail readably without creating a partial document.
|
|
63
|
+
- **Write safety & observability**: `isPolicyWriteTool` now unions the static write list with registered plugin tools declaring `riskClass: 'write'`; plugin health exposes per-tool ok/err counters and write tools emit ops audits.
|
|
64
|
+
- **Bilingual guide**: [IDD / RAG plugin integration](https://kingdol666.github.io/AgentWorkShop/guide/idd-rag-plugins) covers tools, contract pinning, lifecycle, error codes, degradation and gray release.
|
|
65
|
+
|
|
66
|
+
## What's new in 0.12.0 (historical release notes)
|
|
67
|
+
|
|
68
|
+
The 0.12.0 round added claim-token CAS, recovery-hold dispositions, DCW transport-ack verification and simulator attestation; see the [changelog](./changelog.md) for the full list. Post-release hardening round 2 (`900ad228`, PR #228) fixed the four defects reproduced in the round-2 evaluation: the message watchdog is now an activity window (HITL waits no longer kill healthy long turns; the 16-minute governed turn that was aborted and replayed 3× in round 1 completed once with zero watchdog aborts), HITL expiry settles authoritatively with denial notices, rag-bridge kb_agent errors are classified (401 → rotate token instead of a misleading "check the web"), and verify-line V6 treats a missing fresh-home fixture as a documented SKIP. Gates: lint, typecheck, unit **1799/1799**, build, docs **101/101**, Skills **176/176**, MCP **14/14**, plugin **22/22**, SDK, twin 5/5. Fresh-home five-protocol round: onboarding 25/25 + smoke 7/7 on first pass; omp + `ustc/deepseek-flash` Channel governed step (HITL → run `readback-verified` 1/1, journal anchor); IDD `industrial-optimizer-loop` R001 31.7875→32.5611 g (incumbent, D=0.825) + R002 GP-EI within CI, gate 13/13; RAG index → retrieval rank 1. See the [round-2 report](docs/audit/2026-11-16-round2-fixes-full-acceptance.md). Physical HIL unverified; RAG internal agent still flaky (external); Mimosa inconclusive; the USTC key hit its 3h budget twice (external quota).
|
|
55
69
|
|
|
56
70
|
## What's new in 0.11.2 (historical release snapshot)
|
|
57
71
|
|
|
@@ -412,7 +426,7 @@ Please **do not** open public issues for vulnerabilities — report privately vi
|
|
|
412
426
|
|
|
413
427
|
**If this project is useful to you, a ⭐ helps others find it.**
|
|
414
428
|
|
|
415
|
-
Current source version: **v0.
|
|
429
|
+
Current source version: **v0.13.0 (released 2026-11-18)** — [Latest release v0.13.0](https://github.com/kingdol666/AgentWorkShop/releases/tag/v0.13.0) · [Changelog](./changelog.md) · [Documentation](https://kingdol666.github.io/AgentWorkShop)
|
|
416
430
|
|
|
417
431
|
<a href="https://star-history.com/#kingdol666/AgentWorkShop&Date">
|
|
418
432
|
<img src="https://api.star-history.com/svg?repos=kingdol666/AgentWorkShop&type=Date" alt="Star history" width="70%" />
|
package/config.yml
CHANGED
package/docs/cli.en.md
CHANGED
|
@@ -79,7 +79,7 @@ npx -p agentworkshop aw doctor # use -p when you want the name aw
|
|
|
79
79
|
| Package manager | `pnpm@11.9.0` (`packageManager`, needed only for source development) |
|
|
80
80
|
| Module format | ESM (`type: module`) |
|
|
81
81
|
| License | `Apache-2.0` |
|
|
82
|
-
| Current version | `0.
|
|
82
|
+
| Current version | `0.13.0` (`package.json`) |
|
|
83
83
|
|
|
84
84
|
## 2. First start (the Claude Code experience)
|
|
85
85
|
|
package/docs/cli.md
CHANGED
|
@@ -76,7 +76,7 @@ npx -p agentworkshop aw doctor # 需要 aw 这个名字时用 -p 指定包
|
|
|
76
76
|
| 包管理器 | `pnpm@11.9.0`(`packageManager`,仅源码开发需要) |
|
|
77
77
|
| 模块形态 | ESM(`type: module`) |
|
|
78
78
|
| 许可证 | `Apache-2.0` |
|
|
79
|
-
| 当前版本 | `0.
|
|
79
|
+
| 当前版本 | `0.13.0`(`package.json`) |
|
|
80
80
|
|
|
81
81
|
## 二、首次启动(Claude Code 式)
|
|
82
82
|
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# IDD / RAG 插件契约与运维说明(v2.4 / v2.3)
|
|
2
|
+
|
|
3
|
+
> 适用:`server/plugins-builtin/diag-bridge`(v2.4)与 `server/plugins-builtin/rag-bridge`(v2.3)。
|
|
4
|
+
> 上游契约:IDD `docs/api-external-plugin-manual.md` v1.3;RAG `docs/api-web.md` v2.0。
|
|
5
|
+
> 本文只描述**平台侧插件**的工具面、错误语义与降级行为;后端功能不在本文范围。
|
|
6
|
+
|
|
7
|
+
## 1. 工具清单
|
|
8
|
+
|
|
9
|
+
### rag-bridge(v2.3,文档面确定性工具)
|
|
10
|
+
|
|
11
|
+
| 工具 | 角色 | riskClass | 用途 | 关键参数 | 首行输出 |
|
|
12
|
+
| --- | --- | --- | --- | --- | --- |
|
|
13
|
+
| `kb_agent` | lead+worker | write | 知识库原生 Agent 对话(检索/入库/经验);写走 HITL | `prompt` `action=query\|ingest` `wait/wait_seconds` | 完成文本(✅) |
|
|
14
|
+
| `kb_agent_status` | lead+worker | read | 异步任务查询/长轮询 | `task_id` `wait_seconds` | 结果文本 |
|
|
15
|
+
| `kb_doc_create` | lead+worker | write | Markdown 直入文档库并建索引(同名幂等) | `name` `content` `description?` `kb?` `tags?` | `status=created doc_path=… index=ok tags=ok` |
|
|
16
|
+
| `kb_doc_search` | lead+worker | read | 两段检索为主,关键词兜底 | `query` `kb?` `top_k?` | `status=ok mode=two-stage hits=N` |
|
|
17
|
+
| `kb_doc_read` | lead+worker | read | 读文档正文(截断) | `doc_path` `kb?` `max_chars?` | `status=ok doc_path=… truncated=no` |
|
|
18
|
+
| `kb_catalog` | lead+worker | read | 库清单与文档数 | — | `status=ok kbs=N` |
|
|
19
|
+
|
|
20
|
+
缺省文档库 = `plugins.rag-bridge.docs_kb`(默认 `aw-docs`);经验面(`kb_agent`)仍写 `aw-industrial`。
|
|
21
|
+
`kb_doc_create` 显式指定 `aw-industrial` 时输出**漂移警告**,不硬拦。
|
|
22
|
+
|
|
23
|
+
### diag-bridge(v2.4,external v1 主契约)
|
|
24
|
+
|
|
25
|
+
| 工具 | 角色 | riskClass | 用途 | 关键参数 | 首行输出 |
|
|
26
|
+
| --- | --- | --- | --- | --- | --- |
|
|
27
|
+
| `diag_run` | lead+worker | read | 发起任意意图分析(提交即返 task_id) | `line/export_id/data_path` `analysis_intent` `wait?` `ontology_*` `preprocessing_mode` `report_language` | `已发起…contract=v1` |
|
|
28
|
+
| `diag_status` | lead+worker | read | 状态/结果(含报告路径与 URL) | `run_id?` | `run_id=… contract=… 状态=…` |
|
|
29
|
+
| `diag_chat` | lead+worker | read | 已完成/运行中 run 续聊(v1) | `run_id` `message` | `status=ok delivered=… resumed=…` |
|
|
30
|
+
| `diag_stop` | lead+worker | write | 停止 run(写审计) | `run_id` | `status=stopped run_id=…` |
|
|
31
|
+
| `diag_deposit` | lead+worker | write | 报告一键入 `aw-docs` + 检索自查 | `run_id` `kb?` `title?` | `status=ok doc_path=… search=hit` |
|
|
32
|
+
| `diag_results` / `diag_result_get` / `diag_result_annotate` | 结果库(默认关;worker 可读默认关/编辑仅 lead) | 见旧版文档 | 历史结果检索/详情/元数据 | — | — |
|
|
33
|
+
|
|
34
|
+
全部 7 意图:`deep-diagnosis` / `stability-report` / `quick-screen` / `doe-analysis` /
|
|
35
|
+
`experience-mining` / `optimizer-campaign` / `improvement-advisory`。
|
|
36
|
+
|
|
37
|
+
## 2. 契约与回退
|
|
38
|
+
|
|
39
|
+
- `plugins.diag-bridge.contract = auto|v1|legacy`(默认 auto)。
|
|
40
|
+
- auto:**提交前** `GET /api/external/v1/capabilities` 定轨并缓存 5min(base+token 指纹)。
|
|
41
|
+
- 200 且 v1 信封 → v1;
|
|
42
|
+
- 404/不可达/200 非 v1 信封(代理兜底)→ legacy;
|
|
43
|
+
- 401/403/5xx → **不静默回退**,返回可读 token/服务错误(避免掩盖故障)。
|
|
44
|
+
- run 级 `contract + task_id + run_id` 落 kv;提交、轮询、状态、回执、`/report` 全链同契约。
|
|
45
|
+
- 显式 `legacy` 仅作回归保障;新功能(`diag_chat`、`diag_deposit`)要求 v1。
|
|
46
|
+
|
|
47
|
+
## 3. 生命周期与单飞锁
|
|
48
|
+
|
|
49
|
+
- 终态:`completed` / `failed` / `stopped` / `interrupted` / `expired`。
|
|
50
|
+
- `awaiting_input` **不是**终态:占产线单飞锁、不发终态回执;超过
|
|
51
|
+
`plugins.diag-bridge.awaiting_max_minutes`(默认 30)转 `expired` 并发送提示性回执。
|
|
52
|
+
- v1 `404` 连续 3 轮 → `expired`;legacy 仍收敛 `failed`。
|
|
53
|
+
- 同一产线同时只允许一个未终态 run(`queued/running/awaiting_input` 均占锁)。
|
|
54
|
+
|
|
55
|
+
## 4. 错误语义(可读优先)
|
|
56
|
+
|
|
57
|
+
- IDD v1 错误码映射:手册 §9 全表(鉴权/意图/引擎/数据路径/意图-引擎不匹配/续聊状态/停止终态)。
|
|
58
|
+
- `diag_run` 提交前 capabilities 软预检:未知意图、引擎无 `runs` 能力、意图不受支持 → 不提交,直接给处方。
|
|
59
|
+
- RAG:401/403(重铸 token 路径)、429(退避 30s 一次后给指引)、404(库/文档名)、5xx/timeout(改 async 或 `kb_doc_search`)。
|
|
60
|
+
|
|
61
|
+
## 5. 降级
|
|
62
|
+
|
|
63
|
+
- 知识库 Agent 回合不可用(600s 硬顶/502/503)→ `kb_agent` 报错并建议 `kb_doc_search`(两段检索不依赖内部 agent)。
|
|
64
|
+
- 两段检索失败 → `kb_doc_search` 关键词兜底,输出 `mode=keyword-degraded`(仅名称/描述,必须 `kb_doc_read` 核实)。
|
|
65
|
+
- `diag_deposit` 检索自查未命中(索引可见性窗口)→ `search=miss`,文档已落盘,稍后 `kb_doc_search` 复核。
|
|
66
|
+
|
|
67
|
+
## 6. 可观测
|
|
68
|
+
|
|
69
|
+
- `GET /api/plugins/rag-bridge/health`:双库 id、token verify 三态、`toolCounters`(每工具 ok/err)。
|
|
70
|
+
- `GET /api/plugins/diag-bridge/health`:contract、token 实测、runs byStatus、`toolCounters`。
|
|
71
|
+
- `GET /api/workshop/channels/:id/tool-usage`:Agent 实际调用的工具计数(harness|tool|agent 分账)。
|
|
72
|
+
- 写类审计:`plugin.kb_doc.create`、`diag.report.deposit`、`diag.run.stop` 入平台 ops 面。
|
|
73
|
+
|
|
74
|
+
## 7. 灰度与关停
|
|
75
|
+
|
|
76
|
+
1. 批一(读类):`kb_doc_search` / `kb_doc_read` / `kb_catalog` / `diag_chat` 先行。
|
|
77
|
+
2. 批二(写类):`kb_doc_create` / `diag_deposit` / `diag_stop` 在批一验收通过后启用。
|
|
78
|
+
3. 一键关停:`plugins.*-bridge.enabled=false`(或插件管理页停用)→ 工具调用返回可读“未注册”,不崩溃。
|
|
79
|
+
4. 契约开关:`contract=legacy` 可即时回到旧路径(无需重启)。
|
|
80
|
+
|
|
81
|
+
## 8. 安全边界
|
|
82
|
+
|
|
83
|
+
- 出站地址限 `http(s)://127.0.0.1|localhost`(两插件共用守卫);token 只存系统配置,不入源码。
|
|
84
|
+
- `diag_run`/`diag_chat`/`diag_stop`/`diag_deposit` 均校验产线可读面(fail-closed)。
|
|
85
|
+
- `diag_deposit`/`diag_stop`/`kb_doc_create` 属写族:策略或目录不可读时 fail-closed
|
|
86
|
+
(`isPolicyWriteTool` 联合判定:静态名单 ∪ 插件 `riskClass='write'`)。
|
|
87
|
+
- 结果库默认关闭;`diag_results` 默认仅 lead,worker 需显式开关。
|
package/docs/plugins.en.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
>
|
|
10
10
|
> Applies to: plugin system v2 has been available since **v0.7.29** (frontend component
|
|
11
11
|
> injection / plugin settings / plugin i18n / runtime services surface); this document
|
|
12
|
-
> describes **v0.
|
|
12
|
+
> describes **v0.13.0**. `ctx.sdkVersion` is currently `0.3.0`.
|
|
13
13
|
|
|
14
14
|
## 1. Folder layout & quick start
|
|
15
15
|
|
|
@@ -488,7 +488,7 @@ ctx.route('POST', '/threshold', (event) => {
|
|
|
488
488
|
|
|
489
489
|
Tools registered with `ctx.omp.registerTool(def)` are exposed to harnesses subject to role, channel and invocation-path filters. Omp receives definitions over RPC `set_host_tools`; other engines can obtain a list through the agent-token MCP bridge; mock can use an authorized user REST invoke. Registry changes are re-pushed to running sessions.
|
|
490
490
|
|
|
491
|
-
Compatibility boundary (
|
|
491
|
+
Compatibility boundary (v0.13.0; not a stability guarantee): an agent token identifies the agent, not a trusted turn. The bridge filters and rejects plugin tools unless they explicitly declare `riskClass: 'read'`; omitted, `write` and `admin` classifications are denied. Declare `read` only for genuinely read-only tools, not to bypass the restriction. Role, channel and other governance checks still apply. Native omp calls and user-authenticated REST calls have their own checks and do not necessarily expose the same tool surface as the agent-token bridge.
|
|
492
492
|
|
|
493
493
|
```js
|
|
494
494
|
ctx.omp.registerTool({
|
package/docs/plugins.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
> 本文是唯一权威参考;`docs/site/plugins/` 的分页文档与本文同源。
|
|
7
7
|
>
|
|
8
8
|
> 适用版本:插件系统 v2 自 **v0.7.29** 起可用(前端组件注入 / 插件设置 / 插件 i18n /
|
|
9
|
-
> 运行时服务面);本文档对应当前版本 **v0.
|
|
9
|
+
> 运行时服务面);本文档对应当前版本 **v0.13.0**。`ctx.sdkVersion` 当前为 `0.3.0`。
|
|
10
10
|
|
|
11
11
|
## 一、目录结构与快速开始
|
|
12
12
|
|
|
@@ -477,7 +477,7 @@ ctx.route('POST', '/threshold', (event) => {
|
|
|
477
477
|
|
|
478
478
|
`ctx.omp.registerTool(def)` 注册的工具按角色、频道与调用路径过滤后提供给 harness。omp 经 RPC `set_host_tools` 注入;其他引擎可经 agent-token MCP 桥获取工具列表;mock 可经已授权用户的 REST invoke 调用。注册表变更会向在跑的会话重发工具定义。
|
|
479
479
|
|
|
480
|
-
|
|
480
|
+
兼容性边界(v0.13.0;不属于稳定承诺):agent token 只标识 agent,不能证明可信回合来源;桥接路径只允许显式声明 `riskClass: 'read'` 的插件工具,缺省、`write` 或 `admin` 均被过滤并拒绝调用。仅对真正只读的工具声明 `read`,不要为了绕过限制错误标注;角色、频道和其他治理检查仍然适用。原生 omp 工具调用和用户鉴权 REST 路径有各自的检查,不能假定它们与 agent-token 桥的工具面相同。
|
|
481
481
|
|
|
482
482
|
```js
|
|
483
483
|
ctx.omp.registerTool({
|
package/docs/sdk.en.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
**SDK version constants**: server-side `SDK_VERSION = '0.3.0'`, browser-side `CLIENT_SDK_VERSION = '0.3.0'`.
|
|
9
9
|
These two constants are the **interface version of the SDK itself** and evolve **independently**
|
|
10
|
-
from the npm package version (the `version` field in `package.json`, currently 0.
|
|
10
|
+
from the npm package version (the `version` field in `package.json`, currently 0.13.0) —
|
|
11
11
|
them being out of sync is expected. Never use `SDK_VERSION` to infer the package version, or the reverse.
|
|
12
12
|
**Module format**: ESM only (only `import` / `export`; there is no CJS entry).
|
|
13
13
|
**Types**: `sdk/index.d.mts` and `sdk/client.d.mts` ship with the package, so TypeScript projects
|
package/docs/sdk.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
> 零第三方运行时依赖,Node ≥ 23.4 与现代浏览器双端可用。
|
|
6
6
|
|
|
7
7
|
**SDK 版本常量**:服务端 `SDK_VERSION = '0.3.0'`,浏览器端 `CLIENT_SDK_VERSION = '0.3.0'`。
|
|
8
|
-
这两个常量是 **SDK 自身接口的版本号**,与 npm 包版本(`package.json` 的 `version`,当前 0.
|
|
8
|
+
这两个常量是 **SDK 自身接口的版本号**,与 npm 包版本(`package.json` 的 `version`,当前 0.13.0)
|
|
9
9
|
**各自独立演进** —— 常数不同步是预期行为,不要拿 `SDK_VERSION` 去推断包版本,反之亦然。
|
|
10
10
|
**模块形态**:ESM only(只有 `import` / `export`,没有 CJS 入口)。
|
|
11
11
|
**类型**:`sdk/index.d.mts`、`sdk/client.d.mts` 随包发布,TS 项目零配置获得提示(覆盖范围见 §7)。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentworkshop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AgentWorkShop — a configuration-driven industrial agent runtime: agent teams, Channel sessions, Project delivery and governed plant writes",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"docs/plugins.en.md",
|
|
54
54
|
"docs/sdk.md",
|
|
55
55
|
"docs/sdk.en.md",
|
|
56
|
+
"docs/plugin-idd-rag-contract.md",
|
|
56
57
|
"docs/aml.md",
|
|
57
58
|
"docs/mcp.md",
|
|
58
59
|
"docs/mcp.en.md",
|
|
@@ -186,16 +186,22 @@ const lagHook = (spName, tau, noise, fallback) =>
|
|
|
186
186
|
`const cur = Number.isFinite(state.v)?state.v:${fallback};`
|
|
187
187
|
+ `const tgt = Number.isFinite(vars['${spName}']) ? vars['${spName}'] : ${fallback};`
|
|
188
188
|
+ `const k = Math.min(1, dt/1000/${tau}); state.v = cur + (tgt-cur)*k + (rand()-0.5)*${noise}; return state.v`
|
|
189
|
-
const causalHook = (d, fallback, nominals = {}) => {
|
|
189
|
+
const causalHook = (d, fallback, nominals = {}, nameById = {}) => {
|
|
190
190
|
// 偏差语义:base=标称点输出,每项增益作用于 (SP 当前值 − SP 标称值) —— 与文档「工艺耦合」公式同构
|
|
191
|
+
// follows[].sp 契约=SP 信号名(蓝图文档示例);历史输入可能给信号 id —— 这里按 name→id 双解析,
|
|
192
|
+
// 返回未解析键列表(调用方上报),不再静默退化成 tgt=base 的死动力学(2026-11-18 实机教训)。
|
|
193
|
+
const unresolved = []
|
|
191
194
|
const terms = (d.follows ?? []).map((f) => {
|
|
192
|
-
const
|
|
193
|
-
|
|
195
|
+
const spName = nameById[f.sp] ?? (nominals[f.sp] !== undefined ? f.sp : null)
|
|
196
|
+
if (!spName) unresolved.push(f.sp)
|
|
197
|
+
const nom = Number.isFinite(f.at) ? f.at : (nominals[spName] ?? 0)
|
|
198
|
+
return `${f.gain}*((Number.isFinite(vars['${spName}'])?vars['${spName}']:0) - ${nom})`
|
|
194
199
|
})
|
|
195
200
|
const base = d.base ?? fallback
|
|
196
|
-
|
|
201
|
+
const code = `const tgt = ${base}${terms.length ? ' + ' + terms.join(' + ') : ''};`
|
|
197
202
|
+ `const cur = Number.isFinite(state.v)?state.v:${fallback};`
|
|
198
203
|
+ `const k = Math.min(1, dt/1000/${d.tau ?? 8}); state.v = cur + (tgt-cur)*k + (rand()-0.5)*${d.noise ?? 1}; return state.v`
|
|
204
|
+
return { code, unresolved }
|
|
199
205
|
}
|
|
200
206
|
const wanderHook = (mid, span) =>
|
|
201
207
|
`state.v = (Number.isFinite(state.v)?state.v:${mid}) + (rand()-0.5)*${span}; `
|
|
@@ -315,17 +321,23 @@ async function materialize(devices, mqttPort) {
|
|
|
315
321
|
throw new Error(`不支持的蓝图协议:${protocol}(支持 modbus-tcp/modbus-rtu/mqtt/opcua/http)`)
|
|
316
322
|
}
|
|
317
323
|
const nominals = Object.fromEntries(dev.signals.filter(s => s.kind === 'sp').map(s => [s.name, Number(s.initial ?? (s.min + s.max) / 2)]))
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
324
|
+
const nameById = Object.fromEntries(dev.signals.map(s => [s.id, s.name]))
|
|
325
|
+
const unresolvedAll = []
|
|
326
|
+
const signals = dev.signals.map((s) => {
|
|
327
|
+
let strategy
|
|
328
|
+
if (s.strategy) strategy = s.strategy
|
|
329
|
+
else if (s.kind === 'sp') strategy = { kind: 'manual', value: s.initial ?? (s.min + s.max) / 2 }
|
|
330
|
+
else if (s.dynamics && (s.dynamics.follows?.length || s.dynamics.base != null)) {
|
|
331
|
+
const { code, unresolved } = causalHook(s.dynamics, (s.min + s.max) / 2, nominals, nameById)
|
|
332
|
+
unresolvedAll.push(...unresolved.map(k => `${s.id}→${k}`))
|
|
333
|
+
strategy = { kind: 'hook', code: s.code ?? code }
|
|
334
|
+
}
|
|
335
|
+
else strategy = { kind: 'hook', code: s.code ?? wanderHook((s.min + s.max) / 2, Math.max((s.max - s.min) / 200, 0.2)) }
|
|
336
|
+
return { id: s.id, name: s.name, description: `孪生:${s.name}`, unit: s.unit, min: s.min, max: s.max, decimals: s.decimals, format: s.format ?? 'scalar', strategy }
|
|
337
|
+
})
|
|
338
|
+
if (unresolvedAll.length) {
|
|
339
|
+
ok('follows[].sp 可解析性(按名或按 id)', false, `未解析:${unresolvedAll.join(', ')} —— 生成的 hook 将退化为常量目标,请改用 SP 信号名`)
|
|
340
|
+
}
|
|
329
341
|
const r = await simApi('POST', '/api/nodes', { id, name: `${id}(孪生)`, description: `aw-plc-sim-twin 生成:${dev.signals.length} 信号`, protocol, enabled: true, tickMs: 1000, signals, config })
|
|
330
342
|
ok(`设备 ${id}(${protocol},${signals.length} 信号)`, r?.code === 0, r?.message ?? '')
|
|
331
343
|
created.push({ id, protocol, port: config.port ?? null, signals: signals.length, sourceNodes: dev.nodes?.map(n => n.id) ?? null })
|