@xdxer/dingtalk-agent 0.1.4 → 0.1.5-beta.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,37 @@
2
2
 
3
3
  All notable changes to `@xdxer/dingtalk-agent` are documented here. The project follows semantic versioning; prerelease entries describe release candidates and do not imply that Live canaries or registry publication have completed.
4
4
 
5
+ ## 0.1.5-beta.1 - 2026-07-20
6
+
7
+ Documentation and evaluation-tooling release. **No runtime code changes** — `bin/` and `src/` behavior is identical to 0.1.4; the only `bin/` edit is a header comment. Ships on the `beta` dist-tag; `latest` stays at 0.1.4.
8
+
9
+ ### Changed
10
+
11
+ - **Contract evaluations are tiered, and the default regression is 18 seconds instead of 12 minutes.** `npm run eval:contract` now runs only the 29 `core` scenarios (kernel behavior: Session/Run/Wait, Action Gate, response eligibility, perception, task checkpoint, completion gate). The 33 `extended` scenarios — Multica/OpenCode simulation, real tarball offline install, CLI install/upgrade, robot pool, L2/L3 memory providers, live-readiness runners — run under `npm run eval:contract:full`, which is what CI and `release:check` use. `--only=<id>` overrides the tier and can name any scenario. Four README string assertions were removed from the heaviest end-to-end scenarios; document integrity now belongs to `scripts/check-docs.mjs`, which covers every link and anchor in under a second instead of seven magic strings.
12
+ - The `dingtalk-agent-eval` skill teaches running the smallest useful slice first. Without `--cases`, a suite runs every case on every lane, and each case costs a model call — that is time and money. The skill now gives a four-step widening order and distinguishes `--runs 1` (did it break?) from `--runs 3` (did it actually improve?).
13
+ - The `dingtalk-agent-compose` skill no longer claims `dingtalk-agent-eval` is outside the default suite. It joined the default suite in 0.1.4-beta.17, so that sentence was telling users to install a skill they already had.
14
+
15
+ ### Fixed
16
+
17
+ - Contract scenario 60 (`AgentEnhancement`) hardcoded a CLI version for its in-process call while the spawned CLI read the real one from `package.json`. Because the generated `dingtalk-agent.json` embeds `dtaVersion: ^${version}`, the two plans produced different `planId`s the moment the package version left the 0.1.4 line — so the scenario would have failed on *any* future version bump, not just this one. The scenario now derives the version from `package.json`, and was verified to pass under an unrelated synthetic version.
18
+
19
+ - **Documentation restructured around three named models.** `docs/ARCHITECTURE.md` now answers four questions in order — what a digital employee is, what an Agent is *composed of* (model A), what it *depends on* (model B), and how this repository is *divided* (model C, six parts). Four mutually contradicting "layer" models previously coexisted across `README.md`, `docs/ARCHITECTURE.md`, `CLAUDE.md` and the `bin/` header comment; they are now one. Model C is a verified partition: every `src/` file belongs to exactly one part, with no overlap and no omission.
20
+ - **README is a signpost, not a preview.** Three tables that were byte-identical to sections of `docs/ARCHITECTURE.md` were replaced by prose plus links, removing duplicate sources of truth. Normative rule restatements across the main documents dropped from 32 to 23, and the verification command block now has a single home in `AGENTS.md`.
21
+ - **Scenario counts are no longer hardcoded.** Documents point at `node evals/run-contract-evals.mjs --list` instead of a number that was already stale in three places.
22
+ - **DWS is now defined where it first appears**, and the quick start no longer calls bare `dta` before the PATH block takes effect.
23
+ - `docs/plans/` (17 completed phase records) removed; the two unfinished items and one fixture-referenced design derivation moved to `docs/roadmap/`. `内网实相.md` → `docs/DWS-FIELD-NOTES.md`, `OPEN-SOURCE-REFERENCES.md` → `docs/PRIOR-ART.md`.
24
+ - `examples/agents/` gained an index, and both example bodies now follow the four-block `AGENTS.md` contract that the Compose skill mandates.
25
+
26
+ ### Package contents
27
+
28
+ - **Added**: `docs/ARCHITECTURE.md`, `docs/SELF-TEST.md`, `docs/PRIOR-ART.md`. Eight already-published files linked to the first two, so those links were broken inside the installed package.
29
+ - **Removed**: `docs/SECOND-AGENT-ACCEPTANCE.md` (its unique content merged into `docs/SELF-TEST.md`) and six unreferenced PNG diagrams. The SVG originals remain.
30
+ - Packed tarball drops from roughly 3.1 MB to 0.86 MB.
31
+
32
+ ### Added
33
+
34
+ - `scripts/check-docs.mjs`, wired into `release:check`: fails on dead relative links, dead anchors, a packaged file referencing an unpackaged `docs/*.md`, or structural drift between the two READMEs. The middle check exists because that exact class of breakage had already reached the published package.
35
+
5
36
  ## 0.1.4 - 2026-07-20
6
37
 
7
38
  First stable release of the 0.1.4 line. It promotes the beta series to the `latest` dist-tag, which until now still pointed at 0.1.2. No code changes relative to `0.1.4-beta.19`; the entries below describe what accumulated across the beta line.
package/README.en.md CHANGED
@@ -2,22 +2,24 @@
2
2
 
3
3
  # dingtalk-agent
4
4
 
5
- **A verifiable behavior foundation for DingTalk digital employees.**
5
+ **Give every digital employee the same verifiable behavior foundation.**
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/%40xdxer%2Fdingtalk-agent?logo=npm&color=cb3837)](https://www.npmjs.com/package/@xdxer/dingtalk-agent)
8
8
  [![CI](https://github.com/D1-2004/dingtalk-agent/actions/workflows/ci.yml/badge.svg)](https://github.com/D1-2004/dingtalk-agent/actions/workflows/ci.yml)
9
9
  [![Node.js](https://img.shields.io/node/v/%40xdxer%2Fdingtalk-agent)](https://nodejs.org/)
10
10
  [![License](https://img.shields.io/badge/license-MIT-2ea44f)](LICENSE)
11
11
 
12
- [Quick start](#quick-start) · [How it works](#how-it-works) · [Support](#support) · [Docs](#docs)
12
+ [Quick start](#quick-start) · [What an Agent is made of](#what-an-agent-is-made-of) · [How this repo is divided](#how-this-repo-is-divided) · [Docs](#docs)
13
13
 
14
- English · [简体中文](README.md)
14
+ [简体中文](README.md) · English
15
15
 
16
16
  </div>
17
17
 
18
- `dingtalk-agent` (`dta`) is a **Skill-first behavior kernel and delivery toolchain** for DingTalk digital employees. It assembles role definition, shared behavior, role capabilities, and execution gates into an Agent Project that can be created, tested, promoted, and audited.
18
+ `dingtalk-agent` (`dta`) is the **Skill-first behavior kernel and delivery toolchain** for DingTalk digital employees. It assembles role definition, shared behavior, role capability, and execution gates into an Agent Project you can create, test, promote, and audit.
19
19
 
20
- > **Skills advise. The CLI gates. DWS acts.** Skills decide when and why to act; the CLI pins identity, target, budget, idempotency, and readback; DWS executes DingTalk capabilities.
20
+ > **Skills advise. The CLI gates. DWS acts.** Skills decide when and why to act; the CLI pins identity, target, budget, idempotency, and readback; DWS performs DingTalk capabilities.
21
+
22
+ **DWS is DingTalk's own command-line tool** — separate from this project, installed and authenticated on its own (`dws auth login`) — covering roughly 20 product areas: messaging, docs, AI tables, calendar, approvals, and more. `dta` does not clone its command surface; it wraps it only where identity, target, idempotency, or readback must be frozen. **Every real DingTalk operation is ultimately executed by DWS.**
21
23
 
22
24
  ![The complete path from Agent definition to delivery through two identity types](docs/assets/agent-delivery-lifecycle.svg)
23
25
 
@@ -29,45 +31,53 @@ Requires Node.js 18.3+.
29
31
  npm install --global --prefix "$HOME/.local" \
30
32
  --registry=https://registry.npmjs.org @xdxer/dingtalk-agent@beta
31
33
 
34
+ # setup writes a PATH block into ~/.zshrc or ~/.bashrc, but a child process
35
+ # cannot change the current shell — so keep using the absolute path this round.
36
+ # A new terminal can call `dta` directly.
32
37
  "$HOME/.local/bin/dta" setup --skip-cli-install
33
- dta doctor
38
+ "$HOME/.local/bin/dta" doctor
34
39
  ```
35
40
 
36
- `setup` installs the Basic Behavior and Compose Skills, then checks DWS authentication and common Agent Hosts. Normal sessions do not require Workspace initialization.
41
+ `setup` installs the Basic Behavior, Compose, and Eval Skills, then checks DWS authentication and common Agent Hosts. Normal sessions do not require Workspace initialization.
42
+
43
+ **How far you get with nothing external**: composing, auditing, `workspace run/eval`, and the full contract suite need no DingTalk account and no managed platform — `doctor` marks what is missing as `partial` rather than failing. Only real outbound messaging, remote semantic state, and `deploy`/`promote` require DWS authentication and Multica.
37
44
 
38
45
  ## Why it exists
39
46
 
40
- A model that can talk is not yet a reliable digital employee. `dta` turns the parts most likely to drift into inherited, verifiable contracts:
47
+ A model that talks is not a digital employee that works reliably. `dta` turns the four most drift-prone concerns into inheritable, verifiable contracts:
41
48
 
42
- - **Response judgment:** decide whether to respond before deciding what to say; stay silent in an unmentioned group chat by default.
43
- - **Authority boundaries:** never infer identity, target, permission, authorization, or reply channel from message text or model memory.
44
- - **Evidence-backed completion:** command success, platform visibility, delivery, and human acceptance are different states.
45
- - **Reuse:** new Agents inherit shared behavior and add only role-specific differences instead of copying a giant prompt.
49
+ - **It judges first.** Decide whether to reply before deciding what to say; stay quiet in group chats without an `@`.
50
+ - **It stays in scope.** Identity, target, permission, authorization, and reply channel are never guessed from message text or model memory.
51
+ - **It does not overclaim.** Command success, platform visibility, message delivery, and human acceptance are four distinct completion levels, each evidenced separately.
52
+ - **It is reusable.** A new Agent inherits shared behavior and only adds role differences no copied mega-prompt.
46
53
 
47
- ## How it works
54
+ ## What an Agent is made of
48
55
 
49
- An Agent is assembled from four contract layers:
56
+ Four things: the **Definition** (`AGENTS.md` — who I am, where my duties stop), **shared behavior** (the `dingtalk-basic-behavior` Skill — when to respond, ask, stay silent, close out), **role capability** (`skills/<role>/SKILL.md`), and **storage routing** (`agent.bindings.json` — optional; the same configuration can come from host context, environment variables, or a Workspace manifest). The Agent Host, DWS, managed platform, and event source it depends on are all outside this project.
50
57
 
51
- | Layer | Responsibility |
52
- |---|---|
53
- | **`AGENTS.md`** | Role, role-specific boundaries, operating pattern, common mistakes, and the Basic startup anchor |
54
- | **Basic Behavior** | Shared response eligibility, scope, authorization, privacy, completion, and memory behavior |
55
- | **Role Skills** | Domain judgment, procedure, prohibited actions, and acceptance criteria |
56
- | **Gate + Receipt** | Hard constraints for identity, target, budget, idempotency, state transitions, and platform readback |
58
+ Full composition, dependencies, and boundaries: [Architecture](docs/ARCHITECTURE.md#2-一个-agent-由什么构成模型-a).
59
+
60
+ **File presence is not inheritance evidence** — `agent audit --verify-load` binds real load results to Definition/Skill hashes, Host and model versions, isolated probes, and raw run/export evidence:
61
+
62
+ ```bash
63
+ dta agent audit \
64
+ --bindings agent.bindings.json \
65
+ --require-skill <role-skill-name> \
66
+ --verify-load --yes --json
67
+ ```
57
68
 
58
- The Prompt keeps only what must remain resident and precisely defined. The full behavior tree belongs in Skills. Constraints that cannot rely on model discretion belong in the Gate.
69
+ ## How this repo is divided
59
70
 
60
- ### Createtest promote
71
+ **Behavior kernel** (event may I respond, to whom, what am I allowed to do), **compose & audit** (turn a repo/folder/doc into a hashable Agent and prove the Skills really loaded), **delivery chain** (reach a managed platform under control, with readback at every step), **eval & evidence** (prove it works at the cheapest sufficient level before going live), **state & memory** (stay resumable after a crash), and **machine & distribution** (one command sets up a new machine).
61
72
 
62
- | Stage | Main artifact | Gate |
63
- |---|---|---|
64
- | **Create** | `AGENTS.md`, Basic, Role Skills, bindings | Unresolved placeholders keep the project `partial` |
65
- | **Test** | Isolated Workspace, load probe, behavior eval, four evidence surfaces | A project cannot become ready without proven Definition/Skill loading |
66
- | **Promote** | Platform preflight, deployment Receipt, remote readback | Missing designated Eval evidence or identity chain blocks promotion |
67
- | **Operate** | Digital-employee account or robot entry point, task trace | No claim of write, delivery, or completion without matching evidence |
73
+ Delivery and evaluation are roughly a quarter of the codebase each — the hard part was never "make the model talk", but proving the thing really installed, really behaved, and really shipped. What each part solves, and its modules and CLI: [Architecture](docs/ARCHITECTURE.md#7-dingtalk-agent-分成哪几部分模型-c).
74
+
75
+ ## Create test promote
76
+
77
+ Each of the four stages has a gate: unfilled placeholders keep it `partial`; Skills that did not truly load cannot be ready; a missing named Eval blocks promote; nothing claims delivery or completion without evidence. Details: [Architecture](docs/ARCHITECTURE.md#8-从定义到上线).
68
78
 
69
79
  ```bash
70
- # 1. Generate a zero-write plan, then apply it explicitly
80
+ # 1. Generate a zero-write plan, then commit it explicitly
71
81
  dta agent enhance --project-name release-agent --role-skill release-manager --dry-run --json
72
82
  dta agent enhance --project-name release-agent --role-skill release-manager \
73
83
  --plan-id <plan-id> --yes --json
@@ -77,7 +87,7 @@ dta agent audit --bindings agent.bindings.json --require-skill release-manager -
77
87
  dta workspace run local-dev --json
78
88
  dta workspace eval local-dev --json
79
89
 
80
- # 3. Inspect, promote, and observe
90
+ # 3. Cloud preflight, promotion, and observation
81
91
  dta workspace inspect multica-dev --execute --yes --json
82
92
  dta workspace remote-list multica-dev --execute --yes --json
83
93
  dta promote --source local-dev --target multica-dev --dry-run --json
@@ -86,26 +96,39 @@ dta observe --promotion-id <promotion-id> --input <observation.json> --dry-run -
86
96
 
87
97
  Plans are zero-write by default. Remote writes require an explicit target, the current `planId`, and confirmation.
88
98
 
89
- ## Support
99
+ The placeholders above are not yours to invent — each has a definite source:
100
+
101
+ | Placeholder | Where it comes from |
102
+ |---|---|
103
+ | `<plan-id>` | Top-level `.planId` in the preceding `--dry-run --json` output. Any source or config change invalidates it, so re-run the dry run |
104
+ | `local-dev` / `multica-dev` | Workspace names **you** declare in `dingtalk-agent.json#workspaces` — not built-in values. Sample: [`lab/project-workspace/project.fixture.json`](lab/project-workspace/project.fixture.json) |
105
+ | `<promotion-id>` | `.promotionId` on the `promotion-receipt@1` produced by `dta promote --yes` |
106
+ | `<role-skill-name>` | The `name` in your `skills/<role>/SKILL.md` frontmatter |
107
+
108
+ ### Minimal runnable path (local only, three commands)
90
109
 
91
- ### Platforms, Harnesses, and runtimes
110
+ To see something move first, don't start with the chain above — that is the full delivery pipeline. Start here:
92
111
 
93
- These are separate concepts:
112
+ ```bash
113
+ cp -R examples/agents/release-manager my-agent && cd my-agent
114
+ dta bootstrap --json # Was the body recognized? Check definition.status and storage routes
115
+ dta agent audit --json # Expect partial — the role semantics are still template text, which is correct
116
+ ```
117
+
118
+ None of this needs a DingTalk account or a managed platform, and none of it has side effects. Fill in the real role semantics in `AGENTS.md`, run `agent audit` again, and the only remaining gap is `host.load-probe` — which needs an Agent Host, see the [Compose Skill](skills/core/dingtalk-agent-compose/SKILL.md). The third command group above only applies once you have a Multica binding and declared Workspaces.
119
+
120
+ ## Support
94
121
 
95
- - A **Managed Agent Platform** owns Workspace, Runtime, Agent, Skill, identity binding, and observation.
96
- - An **Agent Harness** loads Definition/Skills, isolates execution, and captures evidence.
97
- - The **dta Kernel** depends on a shared contract, not a specific Harness prompt or private directory layout.
122
+ A **Managed Agent Platform** (owning Workspace, Runtime, identity binding, and observation), an **Agent Host** (a.k.a. Harness — loads Definition/Skills and isolates execution), and the **dta Kernel** are three separate concepts:
98
123
 
99
124
  | Dimension | Current support |
100
125
  |---|---|
101
126
  | **Managed Platform** | Multica (DingTalk) supported; DEAP coming soon; additional platforms through registry + adapters |
102
- | **Local runtime** | Direct/Mounted sessions in Claude Code, Codex, OpenCode, and similar Hosts; OpenCode is the current complete local managed-Harness reference |
127
+ | **Local runtime** | Direct/Mounted sessions in Claude Code, Codex, OpenCode, and similar Hosts; OpenCode is the most complete local managed-Harness reference |
103
128
  | **Cloud runtime** | Multica Workspace / Runtime / Agent with the same Definition, Skills, Gate, and evidence contract |
104
129
  | **Delivery identity** | Digital-employee/account identity or robot-app identity; neither expands the Agent role or authority |
105
130
 
106
- OpenCode is not a runtime dependency, and Multica is not a privileged bypass. Any promotable Harness must prove the same outcomes: loaded Definition and Skills, pinned identity and isolation, retrievable execution trace, and independent readback.
107
-
108
- “Multi-platform” means the architecture, registry, and adapter contract are extensible. It does not claim that unopened platforms have been deployed or Live-verified.
131
+ OpenCode is not a runtime dependency, and Multica is not a privileged bypass. Any promotable Harness must prove the same outcomes: loaded Definition and Skills, pinned identity and isolation, retrievable execution trace, and independent readback. "Multi-platform" means the architecture, registry, and adapter contract are extensible; it does not claim that unopened platforms have been deployed or Live-verified.
109
132
 
110
133
  ### Runtime modes
111
134
 
@@ -117,50 +140,20 @@ OpenCode is not a runtime dependency, and Multica is not a privileged bypass. An
117
140
 
118
141
  Prepared Runs expose four message atoms: `ack`, `reply`, `ask`, and `silence`. An acknowledgement is not task acceptance, and a reply is not human acceptance.
119
142
 
120
- ## What a generated Agent inherits
121
-
122
- ```text
123
- my-agent/
124
- ├── AGENTS.md Role constitution + Basic inheritance anchor
125
- ├── agent.bindings.json Definition and storage routing
126
- ├── dingtalk-agent.json Agent Project desired state
127
- ├── .agents/skills/
128
- │ ├── dingtalk-basic-behavior/ Complete shared behavior tree
129
- │ └── <role>/ Host-discoverable Role Skill
130
- ├── skills/<role>/SKILL.md Versioned role capability source
131
- └── .dingtalk-agent/ Private state, evidence, and Receipts
132
- ```
133
-
134
- The generated `AGENTS.md` keeps four atomic contracts: **definition, non-negotiable boundaries, operating pattern, and common mistakes**. It also says to apply `dingtalk-basic-behavior` before loading task-relevant Role Skills.
135
-
136
- File presence is not inheritance evidence. `agent audit --verify-load` binds real load results to Definition/Skill hashes, Host/model versions, isolated probes, and raw run/export evidence:
137
-
138
- ```bash
139
- dta agent audit \
140
- --bindings agent.bindings.json \
141
- --require-skill <role-skill-name> \
142
- --verify-load --yes --json
143
- ```
144
-
145
- ## Non-negotiable boundaries
146
-
147
- - Normal sessions never auto-run `dingtalk-agent init`.
148
- - Target, actor, conversation, DWS profile, and permissions come only from a trusted Host or event.
149
- - Prepared Run messaging goes only through a typed Broker or `dta act`; it cannot bypass the Gate.
150
- - An online Run may propose memory or Skill candidates, but cannot hot-modify current identity, permission, or policy.
151
- - Model claims, process exit 0, platform-visible writes, delivery, and human acceptance require separate evidence.
143
+ **Triggers are out of scope for this project**: `listen` is a replaceable local integration Adapter, and `dta deploy` never creates robots, webhooks, or timers.
152
144
 
153
145
  ## Docs
154
146
 
155
147
  | Goal | Start here |
156
148
  |---|---|
157
- | Understand architecture and state | [Architecture](docs/ARCHITECTURE.md) |
149
+ | Understand the Agent architecture and how the repo is divided | [Architecture](docs/ARCHITECTURE.md) |
158
150
  | Install, upgrade, or troubleshoot | [Installation](docs/INSTALLATION.md) |
159
151
  | Understand evaluation and evidence levels | [Self-test](docs/SELF-TEST.md) |
160
152
  | Create or audit an Agent | [Compose Skill](skills/core/dingtalk-agent-compose/SKILL.md) |
161
153
  | Test or debug a delivered Agent | [Eval Skill](skills/core/dingtalk-agent-eval/SKILL.md) |
162
- | Read the shared behavior protocol | [Basic Behavior Skill](skills/core/dingtalk-basic-behavior/SKILL.md) |
163
- | Copy a complete example | [Example Agents](examples/agents) |
154
+ | Read the shared behavior protocol (a contract written for models, not a tutorial) | [Basic Behavior Skill](skills/core/dingtalk-basic-behavior/SKILL.md) |
155
+ | Copy a complete example and edit from there | [Example Agents](examples/agents) |
156
+ | See which open-source projects informed this one | [Prior Art](docs/PRIOR-ART.md) |
164
157
 
165
158
  Behavior assets come from observable contracts, counterexample-driven revision, and deployable verification. This project does not claim access to any product's hidden system prompt.
166
159
 
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  [![Node.js](https://img.shields.io/node/v/%40xdxer%2Fdingtalk-agent)](https://nodejs.org/)
10
10
  [![License](https://img.shields.io/badge/license-MIT-2ea44f)](LICENSE)
11
11
 
12
- [快速开始](#快速开始) · [工作方式](#工作方式) · [支持范围](#支持范围) · [文档](#文档)
12
+ [快速开始](#快速开始) · [一个 Agent 由什么构成](#一个-agent-由什么构成) · [仓库分成哪几部分](#这个仓库分成哪几部分) · [文档](#文档)
13
13
 
14
14
  简体中文 · [English](README.en.md)
15
15
 
@@ -19,6 +19,8 @@
19
19
 
20
20
  > **Skill 劝,CLI 拦,DWS 做。** Skill 判断何时、为何行动;CLI 固定身份、目标、预算、幂等与回读;DWS 执行钉钉能力。
21
21
 
22
+ 其中 **DWS 是钉钉侧的命令行工具**(独立于本项目,需单独安装并 `dws auth login`),涵盖消息、文档、AI 表格、日程、审批等约 20 类产品能力。`dta` 不复制它的命令面,只在需要冻结身份、目标、幂等或回读时包一层——**所有真实的钉钉操作最终都由 DWS 执行**。
23
+
22
24
  ![从 Agent 定义到两类身份交付的完整路径](docs/assets/agent-delivery-lifecycle.svg)
23
25
 
24
26
  ## 快速开始
@@ -29,42 +31,49 @@
29
31
  npm install --global --prefix "$HOME/.local" \
30
32
  --registry=https://registry.npmjs.org @xdxer/dingtalk-agent@beta
31
33
 
34
+ # setup 会把 PATH 区块写进 ~/.zshrc 或 ~/.bashrc,但子进程改不了当前 shell,
35
+ # 所以这一轮继续用绝对路径;之后开新终端即可直接用 `dta`。
32
36
  "$HOME/.local/bin/dta" setup --skip-cli-install
33
- dta doctor
37
+ "$HOME/.local/bin/dta" doctor
34
38
  ```
35
39
 
36
- `setup` 安装 Basic Behavior 与 Compose Skills,并检查 DWS 认证和常见 Agent Host。普通会话无需初始化 Workspace。
40
+ `setup` 安装 Basic Behavior、ComposeEval Skills,并检查 DWS 认证和常见 Agent Host。普通会话无需初始化 Workspace。
41
+
42
+ **纯本地能走多远**:装配、审计、`workspace run/eval` 与全部合同评测都不需要钉钉账号或托管平台——`doctor` 会把缺失项标成 `partial` 而不是失败。只有真实外发、远端语义状态和 `deploy`/`promote` 才需要 DWS 认证与 Multica。
37
43
 
38
44
  ## 为什么需要它
39
45
 
40
- 模型会说话,不等于数字员工能可靠工作。`dta` 把最容易漂移的部分变成可继承、可验证的合同:
46
+ 模型会说话,不等于数字员工能可靠工作。`dta` 把最容易漂移的四件事变成可继承、可验证的合同:
41
47
 
42
48
  - **会判断**:先判断是否该回复,再判断说什么;群聊未 `@` 默认安静。
43
49
  - **不越权**:身份、目标、权限、授权和回复渠道不能从正文或模型记忆猜测。
44
- - **不虚报**:命令成功、平台可见、消息送达和人类接受是不同的完成层级。
50
+ - **不虚报**:命令成功、平台可见、消息送达和人类接受是四个不同的完成层级,各自举证。
45
51
  - **可复用**:新 Agent 继承公共行为,只补岗位差异,不复制巨型 Prompt。
46
52
 
47
- ## 工作方式
53
+ ## 一个 Agent 由什么构成
48
54
 
49
- 一个 Agent 由四层合同组成:
55
+ 四件东西:**本体**(`AGENTS.md`,我是谁、职责边界)、**公共行为**(`dingtalk-basic-behavior` Skill,何时响应/追问/沉默/收口)、**岗位能力**(`skills/<role>/SKILL.md`)、**存储路由**(`agent.bindings.json`,可选——等价配置也可来自宿主 context、环境变量或 Workspace manifest)。它依赖的 Agent Host、DWS、托管平台和事件源都不属于本项目。
50
56
 
51
- | 层 | 负责什么 |
52
- |---|---|
53
- | **`AGENTS.md`** | 定义角色、岗位底线、做事范式和常犯错误;声明每轮先应用 Basic |
54
- | **Basic Behavior** | 所有数字员工共享的响应资格、作用域、授权、隐私、完成与记忆协议 |
55
- | **Role Skills** | 某个岗位的专业判断、流程、禁区和验收标准 |
56
- | **Gate + Receipt** | 把身份、目标、预算、幂等、状态迁移和平台回读变成硬约束 |
57
+ 完整的构成、依赖与边界见 [Architecture](docs/ARCHITECTURE.md#2-一个-agent-由什么构成模型-a)。
58
+
59
+ **"文件存在"不是继承证据**——`agent audit --verify-load` 会把真实加载结果绑定到 Definition/Skill hash、Host 与模型版本、隔离探针和原始 run/export:
60
+
61
+ ```bash
62
+ dta agent audit \
63
+ --bindings agent.bindings.json \
64
+ --require-skill <role-skill-name> \
65
+ --verify-load --yes --json
66
+ ```
57
67
 
58
- Prompt 只保留必须常驻、必须严格定义的内容;完整行为树进入 Skill;不能依赖模型自觉的约束进入 Gate。
68
+ ## 这个仓库分成哪几部分
59
69
 
60
- ### 创建 测试 发布
70
+ **行为内核**(事件能否回应、回应给谁、允许做什么)、**装配与审计**(把仓库/目录/文档变成可 hash 的 Agent 并证明真加载)、**交付链**(受控上托管平台,每步可回读)、**评测与证据**(上线前用最低成本证明它真会做事)、**状态与记忆**(崩了之后接着做)、**机器与分发**(一条命令装好一台新机器)。
61
71
 
62
- | 阶段 | 关键产物 | 门禁 |
63
- |---|---|---|
64
- | **创建** | `AGENTS.md`、Basic、Role Skills、bindings | 占位符未补全时保持 `partial` |
65
- | **测试** | 隔离 Workspace、load probe、行为评测、四类证据 | Definition/Skills 没有真实加载就不能 ready |
66
- | **发布** | 平台预检、部署 Receipt、远端 readback | 指定 Eval 未通过或身份链不完整就不能 promote |
67
- | **运行** | 数字员工账号或机器人入口、task trace | 无证据不声称写入、送达或完成 |
72
+ 交付链与评测各占约四分之一代码量——这个项目的难点从来不是"让模型说话",而是证明它真的装好了、做对了、上线了。每部分解决什么问题、对应哪些模块与 CLI,见 [Architecture](docs/ARCHITECTURE.md#7-dingtalk-agent-分成哪几部分模型-c)。
73
+
74
+ ## 创建 测试 发布
75
+
76
+ 四个阶段各有门禁:占位符没填完保持 `partial`;Skill 没真加载不能 ready;指定 Eval 没过不能 promote;没有证据不声称送达或完成。逐条见 [Architecture](docs/ARCHITECTURE.md#8-从定义到上线)。
68
77
 
69
78
  ```bash
70
79
  # 1. 创建零写入计划,再显式落盘
@@ -86,26 +95,39 @@ dta observe --promotion-id <promotion-id> --input <observation.json> --dry-run -
86
95
 
87
96
  所有计划默认零写入;所有远端写入都需要明确目标、当前 `planId` 和显式确认。
88
97
 
89
- ## 支持范围
98
+ 上面的占位符不是让你自己编的,各有确定来源:
99
+
100
+ | 占位符 | 从哪来 |
101
+ |---|---|
102
+ | `<plan-id>` | 上一条 `--dry-run --json` 输出的顶层 `.planId`。源码或配置一变它就失效,必须重新 dry-run |
103
+ | `local-dev` / `multica-dev` | **你自己**在 `dingtalk-agent.json#workspaces` 里声明的 Workspace 名,不是内置值。样例见 [`lab/project-workspace/project.fixture.json`](lab/project-workspace/project.fixture.json) |
104
+ | `<promotion-id>` | `dta promote --yes` 产出的 `promotion-receipt@1` 的 `.promotionId` |
105
+ | `<role-skill-name>` | 你 `skills/<role>/SKILL.md` 里 frontmatter 的 `name` |
106
+
107
+ ### 最小可运行路径(纯本地,三条命令)
90
108
 
91
- ### 平台、Harness 与运行时
109
+ 想先看见东西动起来,不要从上面那串开始——那是完整交付链。从这里开始:
92
110
 
93
- 这三个概念彼此独立:
111
+ ```bash
112
+ cp -R examples/agents/release-manager my-agent && cd my-agent
113
+ dta bootstrap --json # 本体被识别了吗:看 definition.status 与 storage 路由
114
+ dta agent audit --json # 预期 partial —— 岗位语义还是模板,这是正确结果
115
+ ```
116
+
117
+ 到这一步不需要钉钉账号、不需要托管平台、不产生任何副作用。把 `AGENTS.md` 里的岗位语义填成真的,再跑一次 `agent audit`,缺口就只剩 `host.load-probe`——那需要一个 Agent Host,见 [Compose Skill](skills/core/dingtalk-agent-compose/SKILL.md)。上面第 3 组云端命令要等你有了 Multica 归属和已声明的 Workspace 才用得上。
118
+
119
+ ## 支持范围
94
120
 
95
- - **Managed Agent Platform** Workspace、RuntimeAgent、Skill、身份绑定和观测。
96
- - **Agent Harness** 加载 Definition/Skills,隔离执行并采集证据。
97
- - **dta Kernel** 依赖统一合同,不依赖某个 Harness 的私有 Prompt 或目录结构。
121
+ **Managed Agent Platform**(管 Workspace、Runtime、身份绑定与观测)、**Agent Host**(也叫 Harness,加载 Definition/Skills 并隔离执行)和 **dta Kernel** 三者彼此独立:
98
122
 
99
123
  | 维度 | 当前支持 |
100
124
  |---|---|
101
125
  | **Managed Platform** | Multica(DingTalk)已支持;DEAP 为 Coming soon;更多平台通过 registry + adapter 接入 |
102
- | **本地运行** | Claude Code、Codex、OpenCode 等 Direct/Mounted Session;OpenCode 是当前完整的本地 managed Harness 参考实现 |
126
+ | **本地运行** | Claude Code、Codex、OpenCode 等 Direct/Mounted Session;OpenCode 是当前最完整的本地 managed Harness 参考实现 |
103
127
  | **云上运行** | Multica Workspace / Runtime / Agent;沿用相同的 Definition、Skills、Gate 与证据合同 |
104
128
  | **交付身份** | 数字员工/账号身份;机器人应用身份;两者都不能改变角色职责或扩大权限 |
105
129
 
106
- OpenCode 不是运行前提,Multica 也不是特殊旁路。任何 Harness 要进入可晋级路径,都必须证明同一件事:Definition 与 Skills 已加载、身份和隔离已固定、运行轨迹可取、结果可回读。
107
-
108
- “支持多平台”指架构、注册表和 adapter 合同可扩展;不把尚未开放的平台宣称为已部署或已 Live 验证。
130
+ OpenCode 不是运行前提,Multica 也不是特殊旁路。任何 Harness 要进入可晋级路径,都必须证明同一件事:Definition 与 Skills 已加载、身份和隔离已固定、运行轨迹可取、结果可回读。"支持多平台"指架构、注册表和 adapter 合同可扩展,不把尚未开放的平台宣称为已部署或已 Live 验证。
109
131
 
110
132
  ### 三种运行模式
111
133
 
@@ -117,50 +139,20 @@ OpenCode 不是运行前提,Multica 也不是特殊旁路。任何 Harness 要
117
139
 
118
140
  Prepared Run 只开放 `ack`、`reply`、`ask`、`silence` 四个消息原子动作。`ack` 不等于接单,`reply` 不等于对方接受。
119
141
 
120
- ## 创建出来的 Agent 会继承什么
121
-
122
- ```text
123
- my-agent/
124
- ├── AGENTS.md 角色宪法 + Basic 继承锚点
125
- ├── agent.bindings.json Definition 与存储路由
126
- ├── dingtalk-agent.json Agent Project 期望状态
127
- ├── .agents/skills/
128
- │ ├── dingtalk-basic-behavior/ 完整公共行为树
129
- │ └── <role>/ Host 可发现的岗位 Skill
130
- ├── skills/<role>/SKILL.md 岗位能力的版本化来源
131
- └── .dingtalk-agent/ 私有状态、证据与 Receipt
132
- ```
133
-
134
- 生成的 `AGENTS.md` 只保留四块原子合同:**定义、不能做的底线、做事标准范式、常犯错误**。模板同时声明每个任务先应用 `dingtalk-basic-behavior`,再按任务加载 Role Skills。
135
-
136
- “文件存在”不是继承证据。`agent audit --verify-load` 会把真实加载结果绑定到 Definition/Skill hash、Host/模型版本、隔离探针和原始 run/export:
137
-
138
- ```bash
139
- dta agent audit \
140
- --bindings agent.bindings.json \
141
- --require-skill <role-skill-name> \
142
- --verify-load --yes --json
143
- ```
144
-
145
- ## 不可绕过的边界
146
-
147
- - 普通 Session 不自动运行 `dingtalk-agent init`。
148
- - target、actor、conversation、DWS profile 与权限只来自可信宿主或事件。
149
- - Prepared Run 的消息副作用只走 typed Broker 或 `dta act`,不能绕过 Gate。
150
- - 在线 Run 可以提出记忆或 Skill 候选,但不能热修改当前身份、权限或策略。
151
- - 模型自述、命令退出 0、平台写入可见、消息送达与人类接受必须分别举证。
142
+ **触发器不属于本项目**:`listen` 只是本地联调的可替换 Adapter,`dta deploy` 不创建机器人、Webhook 或定时器。
152
143
 
153
144
  ## 文档
154
145
 
155
146
  | 想做什么 | 从这里开始 |
156
147
  |---|---|
157
- | 理解架构与状态模型 | [Architecture](docs/ARCHITECTURE.md) |
148
+ | 理解 Agent 架构与仓库分工 | [Architecture](docs/ARCHITECTURE.md) |
158
149
  | 安装、升级与排障 | [Installation](docs/INSTALLATION.md) |
159
150
  | 理解评测与证据分层 | [Self-test](docs/SELF-TEST.md) |
160
151
  | 创建或审计 Agent | [Compose Skill](skills/core/dingtalk-agent-compose/SKILL.md) |
161
152
  | 测试或调试已交付的 Agent | [Eval Skill](skills/core/dingtalk-agent-eval/SKILL.md) |
162
- | 查看公共行为协议 | [Basic Behavior Skill](skills/core/dingtalk-basic-behavior/SKILL.md) |
163
- | 复制完整示例 | [Example Agents](examples/agents) |
153
+ | 查看公共行为协议(写给模型读的合同,不是教程) | [Basic Behavior Skill](skills/core/dingtalk-basic-behavior/SKILL.md) |
154
+ | 复制一个完整示例开始改 | [Example Agents](examples/agents) |
155
+ | 借鉴了哪些开源项目 | [Prior Art](docs/PRIOR-ART.md) |
164
156
 
165
157
  行为资产来自可观察合同、反例修正和可部署验证;本项目不声称获得任何产品的隐藏系统提示词原文。
166
158
 
@@ -1,13 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  // dingtalk-agent —— 钉钉数字员工的标准范式(TypeScript source)。
3
3
  //
4
- // CLI = 拦 标准动作:可程序化、可强制、可验证。撞上去没得商量。
5
4
  // Skill = 劝 判断:只有 LLM 能做的(该不该答、话题归属、怎么写点评)。
6
- // 本体 = 它是谁 + 它知道什么。git clone 就带走。
5
+ // CLI = 标准动作:可程序化、可强制、可验证。撞上去没得商量。
6
+ // DWS = 做 真正的钉钉产品能力;本文件只在需要冻结事务边界时包一层。
7
7
  //
8
- // **分界线:凡是能程序化的,收进 CLI;凡是需要判断的,留在 Skill。**
8
+ // 本体(AGENTS.md + Role Skills)负责"它是谁、它知道什么",git clone 就带走;
9
+ // 它是被上面三者加载和校验的对象,不是第四个执行者。
9
10
  //
11
+ // **分界线:凡是能程序化的,收进 CLI;凡是需要判断的,留在 Skill。**
10
12
  // 因为:文档会被漏读、误读、自我说服;**撞到闸门上就没得商量。**
13
+ //
14
+ // 完整架构见 docs/ARCHITECTURE.md。
11
15
  import { parseArgs } from 'node:util';
12
16
  import { join, relative, resolve } from 'node:path';
13
17
  import { existsSync, readFileSync, realpathSync } from 'node:fs';