@xdxer/dingtalk-agent 0.1.4-beta.9 → 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.
Files changed (129) hide show
  1. package/CHANGELOG.md +229 -0
  2. package/README.en.md +89 -324
  3. package/README.md +88 -674
  4. package/dist/bin/dingtalk-agent.js +207 -21
  5. package/dist/bin/dingtalk-agent.js.map +1 -1
  6. package/dist/src/agent-audit.js +1014 -89
  7. package/dist/src/agent-audit.js.map +1 -1
  8. package/dist/src/agent-enhance.js +41 -8
  9. package/dist/src/agent-enhance.js.map +1 -1
  10. package/dist/src/agent-platform.js +299 -0
  11. package/dist/src/agent-platform.js.map +1 -0
  12. package/dist/src/config.js +1 -7
  13. package/dist/src/config.js.map +1 -1
  14. package/dist/src/development-workspace.js +31 -5
  15. package/dist/src/development-workspace.js.map +1 -1
  16. package/dist/src/doctor.js +74 -15
  17. package/dist/src/doctor.js.map +1 -1
  18. package/dist/src/host-detect.js +146 -0
  19. package/dist/src/host-detect.js.map +1 -0
  20. package/dist/src/instruction-path.js +270 -0
  21. package/dist/src/instruction-path.js.map +1 -0
  22. package/dist/src/multica-deploy.js +78 -20
  23. package/dist/src/multica-deploy.js.map +1 -1
  24. package/dist/src/multica-provider.js +1 -1
  25. package/dist/src/multica-provider.js.map +1 -1
  26. package/dist/src/opencode-evals.js +710 -225
  27. package/dist/src/opencode-evals.js.map +1 -1
  28. package/dist/src/opencode-isolation.js +124 -0
  29. package/dist/src/opencode-isolation.js.map +1 -0
  30. package/dist/src/opencode-provider.js +1 -0
  31. package/dist/src/opencode-provider.js.map +1 -1
  32. package/dist/src/opencode-workspace.js +21 -10
  33. package/dist/src/opencode-workspace.js.map +1 -1
  34. package/dist/src/remote-state-evals.js +2 -1
  35. package/dist/src/remote-state-evals.js.map +1 -1
  36. package/dist/src/robot-evals.js +2 -1
  37. package/dist/src/robot-evals.js.map +1 -1
  38. package/dist/src/setup.js +6 -5
  39. package/dist/src/setup.js.map +1 -1
  40. package/dist/src/skill-manager.js +141 -12
  41. package/dist/src/skill-manager.js.map +1 -1
  42. package/dist/src/skills.js +2 -1
  43. package/dist/src/skills.js.map +1 -1
  44. package/dist/src/types.js.map +1 -1
  45. package/dist/src/upgrade.js +23 -27
  46. package/dist/src/upgrade.js.map +1 -1
  47. package/dist/src/version.js +73 -0
  48. package/dist/src/version.js.map +1 -0
  49. package/docs/ARCHITECTURE.md +232 -0
  50. package/docs/INSTALLATION.md +3 -3
  51. package/docs/PRIOR-ART.md +122 -0
  52. package/docs/SELF-TEST.md +182 -0
  53. package/docs/assets/agent-delivery-lifecycle.svg +103 -0
  54. package/docs/schemas/agent-platform.schema.json +13 -0
  55. package/docs/schemas/project.schema.json +3 -0
  56. package/docs/schemas/release-readiness.schema.json +2 -1
  57. package/evals/README.md +17 -0
  58. package/examples/agents/README.md +43 -0
  59. package/examples/agents/fde-coach/AGENTS.md +26 -17
  60. package/examples/agents/release-manager/AGENTS.md +26 -17
  61. package/lab/README.md +3 -3
  62. package/lab/agent-eval/catalog.json +5 -5
  63. package/lab/agent-eval/classic-failures.json +9 -9
  64. package/lab/agent-eval/completion-gate-regression.json +6 -6
  65. package/lab/agent-eval/remote-state-workspace/opencode.json +1 -1
  66. package/lab/agent-eval/workspace/AGENTS.md +1 -1
  67. package/lab/project-workspace/fake-multica-provider.mjs +17 -6
  68. package/lab/project-workspace/opencode-provider-suite.json +2 -2
  69. package/lab/robot-eval/suite.json +1 -1
  70. package/lab/robot-eval/workspace/AGENTS.md +1 -1
  71. package/lab/schemas/agent-eval-catalog.schema.json +1 -1
  72. package/package.json +18 -13
  73. package/skills/README.md +23 -0
  74. package/skills/core/dingtalk-agent-compose/SKILL.md +151 -0
  75. package/skills/core/dingtalk-agent-compose/assets/AGENTS.template.md +35 -0
  76. package/skills/core/dingtalk-agent-compose/assets/role-skill.template.md +32 -0
  77. package/skills/core/dingtalk-agent-compose/evals/evals.json +129 -0
  78. package/skills/{dingtalk-agent-compose → core/dingtalk-agent-compose}/references/agent-definition-contract.md +3 -3
  79. package/skills/core/dingtalk-agent-compose/references/host-loading-contract.md +58 -0
  80. package/skills/core/dingtalk-agent-compose/references/hosts/claude-code.md +48 -0
  81. package/skills/core/dingtalk-agent-compose/references/hosts/opencode.md +77 -0
  82. package/skills/{dingtalk-agent-eval → core/dingtalk-agent-eval}/SKILL.md +57 -8
  83. package/skills/{dingtalk-agent-eval → core/dingtalk-agent-eval}/assets/eval-catalog.template.json +1 -1
  84. package/skills/{dingtalk-agent-eval → core/dingtalk-agent-eval}/evals/evals.json +22 -0
  85. package/skills/{dingtalk-agent-eval → core/dingtalk-agent-eval}/references/eval-topology.md +14 -0
  86. package/skills/{dingtalk-agent-eval → core/dingtalk-agent-eval}/references/evidence-contract.md +21 -0
  87. package/skills/core/dingtalk-agent-eval/references/failure-to-case.md +35 -0
  88. package/skills/core/dingtalk-agent-eval/references/interactive-debug-channels.md +93 -0
  89. package/skills/core/dingtalk-agent-eval/references/local-connector-smoke.md +75 -0
  90. package/skills/core/dingtalk-basic-behavior/SKILL.md +87 -0
  91. package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/references/memory-and-evolution.md +12 -0
  92. package/skills/core/dingtalk-basic-behavior/references/risk-authority-and-privacy.md +62 -0
  93. package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/references/task-lifecycle.md +15 -3
  94. package/skills/core/dingtalk-basic-behavior/references/truth-and-recovery.md +65 -0
  95. package/skills/platforms/deap/PLATFORM.md +3 -0
  96. package/skills/platforms/multica-dingtalk/PLATFORM.md +40 -0
  97. package/skills/{dingtalk-agent-boot-multica → platforms/multica-dingtalk/dingtalk-agent-boot-multica}/SKILL.md +4 -4
  98. package/skills/{dingtalk-agent-deploy → platforms/multica-dingtalk/dingtalk-agent-deploy-multica}/SKILL.md +1 -1
  99. package/skills/platforms/multica-dingtalk/multica-external/SKILL.md +282 -0
  100. package/skills/platforms/multica-dingtalk/multica-external/scripts/bootstrap.sh +78 -0
  101. package/skills/platforms/multica-dingtalk/multica-external/scripts/multica_ext.py +1180 -0
  102. package/docs/SECOND-AGENT-ACCEPTANCE.md +0 -62
  103. package/docs/architecture/agent-memory-topology.png +0 -0
  104. package/docs/architecture/agent-memory-topology.svg +0 -132
  105. package/docs/architecture/dingtalk-agent-blueprint.png +0 -0
  106. package/docs/architecture/durable-async-agent-runtime.png +0 -0
  107. package/docs/architecture/general-agent-kernel-topology.png +0 -0
  108. package/docs/architecture/provider-bound-development-workspace.png +0 -0
  109. package/docs/architecture/task-completion-gate.png +0 -0
  110. package/skills/dingtalk-agent-compose/SKILL.md +0 -110
  111. package/skills/dingtalk-agent-compose/assets/AGENTS.template.md +0 -26
  112. package/skills/dingtalk-agent-compose/assets/role-skill.template.md +0 -24
  113. package/skills/dingtalk-agent-compose/evals/evals.json +0 -94
  114. package/skills/dingtalk-agent-compose/references/opencode-host-contract.md +0 -65
  115. package/skills/dingtalk-basic-behavior/SKILL.md +0 -146
  116. /package/skills/{dingtalk-agent-compose → core/dingtalk-agent-compose}/assets/agent.bindings.dingtalk-doc.template.json +0 -0
  117. /package/skills/{dingtalk-agent-compose → core/dingtalk-agent-compose}/assets/agent.bindings.local.template.json +0 -0
  118. /package/skills/{dingtalk-agent-compose/assets → core/dingtalk-agent-compose/assets/hosts/opencode}/opencode.template.json +0 -0
  119. /package/skills/{dingtalk-agent-compose → core/dingtalk-agent-compose}/references/storage-routing.md +0 -0
  120. /package/skills/{dingtalk-agent-eval → core/dingtalk-agent-eval}/references/scenario-taxonomy.md +0 -0
  121. /package/skills/{dingtalk-agent-eval → core/dingtalk-agent-eval}/references/storage-modes.md +0 -0
  122. /package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/assets/memory-candidate-proposal.json +0 -0
  123. /package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/assets/task-checkpoint.json +0 -0
  124. /package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/references/action-contract.md +0 -0
  125. /package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/references/event-to-behavior.md +0 -0
  126. /package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/references/perception-and-gates.md +0 -0
  127. /package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/references/runtime-modes.md +0 -0
  128. /package/skills/{dingtalk-agent-deploy → platforms/multica-dingtalk/dingtalk-agent-deploy-multica}/references/multica-deployment-contract.md +0 -0
  129. /package/skills/{dingtalk-agent-deploy → platforms/multica-dingtalk/dingtalk-agent-deploy-multica}/references/promotion-observation-contract.md +0 -0
package/README.en.md CHANGED
@@ -2,394 +2,159 @@
2
2
 
3
3
  # dingtalk-agent
4
4
 
5
- **A shared behavior kernel 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
- English · [简体中文](README.md)
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
- </div>
15
-
16
- ## What it is
17
-
18
- **DWS gives an Agent DingTalk system calls. dingtalk-agent (`dta`) gives every Agent an inheritable, frozen, and verifiable employee behavior kernel.** It does not own event delivery and does not duplicate DingTalk APIs. Starting from a normalized invocation, it organizes the Agent definition, perception enrichment, response eligibility, Session/Run state, action gates, and effect evidence into a Skill-first container.
19
-
20
- ```text
21
- Agent Host + dta Kernel + Agent Definition + Basic Behavior + Role Skills + DWS
22
- = a DingTalk digital employee that can keep working
23
- ```
24
-
25
- | Layer | Owns | Does not own |
26
- |---|---|---|
27
- | Agent Definition | Identity, responsibilities, service scope, Skills, resources, authority | Current Run state or IDs guessed from message text |
28
- | Basic + Role Skills | When to reply, ask, stay silent, and how to perform role work | Bypassing identity, target, or effect gates |
29
- | dta Kernel | Invocation, enrichment, Session/Run/Wait, Action Gate, Receipt | Models, universal event listeners, or a second DWS |
30
- | DWS | DingTalk messages, docs, tasks, calendars, tables, and other product operations | Deciding whether an employee should act and on whose behalf |
14
+ [简体中文](README.md) · English
31
15
 
32
- Claude Code, Codex, OpenCode, and other Agent Hosts can use the same kernel. Trigger adapters, models, sandboxes, Role Skills, and storage providers remain replaceable.
33
-
34
- ## Why it exists
16
+ </div>
35
17
 
36
- DWS is enough for occasional manual API operations. A digital employee that works over time also needs a maintained **body, state, and constrained action boundary**. Calling an API is not the same as behaving like a colleague. A reliable Agent must:
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.
37
19
 
38
- - stay quiet in unmentioned group conversations and respond to direct messages or explicit mentions;
39
- - complete well-specified work directly and ask only one truly blocking question;
40
- - never guess recipients, identities, document IDs, or permissions from natural-language text;
41
- - acknowledge long work, wait for dependencies, and resume from a later event;
42
- - distinguish a command attempt, platform visibility, delivery, and human acceptance;
43
- - store task state, business memory, long-term knowledge, locks, and receipts in the right media.
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.
44
21
 
45
- The boundary is: **Skills advise, the CLI enforces, and DWS executes.** Semantic judgment remains in Skills; invariants belong in code; DingTalk product operations stay in DWS.
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.**
46
23
 
47
- > The beta.9 line includes the Basic 0.10.0/0.9.4 model regression, host-issued Completion Evidence, remote semantic-state cold-start and Live-ready runners, the developer Golden Path, safe enhancement of existing Agent repositories, Provider-bound Workspace W1–W5, Completion-grader hardening, a Phase 9 personal-event Live-ready runner, and isolated installation acceptance, with 60 deterministic contracts. Phase 8's recorded sample passed the safety and artifact gates that existed at the time, but did not prove a stable model-quality gain for 0.10.0. Phase 15 adds fail-closed contradictory-claim detection and a predeclared effectiveness policy without rewriting historical scores. Real personal-event, remote-state, and Multica Live are explicitly waived as release gates for this beta; local and fake-Provider evidence is not relabeled as real platform proof. Distribution is limited to the npm `beta` tag, a Git tag, and a GitHub pre-release, with no Trigger or DingTalk/Multica side effect.
24
+ ![The complete path from Agent definition to delivery through two identity types](docs/assets/agent-delivery-lifecycle.svg)
48
25
 
49
26
  ## Quick start
50
27
 
51
- Requires Node.js 18.3 or later.
28
+ Requires Node.js 18.3+.
52
29
 
53
30
  ```bash
54
31
  npm install --global --prefix "$HOME/.local" \
55
32
  --registry=https://registry.npmjs.org @xdxer/dingtalk-agent@beta
56
- "$HOME/.local/bin/dta" setup --skip-cli-install
57
-
58
- dta --version
59
- dta doctor
60
- ```
61
33
 
62
- `setup` checks Node.js, DWS version and authentication, installs and verifies the Basic Behavior Skill, and reports whether Claude Code, Codex, and OpenCode can discover it. `listen` is an optional development adapter, not the mandatory Agent entry point.
63
-
64
- For a source release candidate, run the deterministic tarball acceptance:
65
-
66
- ```bash
67
- npm run release:check
68
- ```
69
-
70
- It creates a real npm tarball, installs it offline into a fresh HOME/prefix, and exercises setup, doctor, direct bootstrap, a plan-only lab eval, forced upgrade from the same tarball, and explicit rollback dry-run. It uses fake DWS and skills-installer binaries only; it sends no DingTalk message, accesses no Multica resource, creates no Trigger, and performs no npm publish, Tag, or GitHub Release.
71
-
72
- ## Three runtime modes
73
-
74
- ### Direct Session
75
-
76
- No initialized Workspace is required. The Agent behaves as a normal colleague but does not invent identity, memory, targets, or DingTalk authority.
77
-
78
- ```bash
79
- dta bootstrap --json
80
- dta bootstrap --agent local-dir:/path/to/agent --json
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.
37
+ "$HOME/.local/bin/dta" setup --skip-cli-install
38
+ "$HOME/.local/bin/dta" doctor
81
39
  ```
82
40
 
83
- ### Mounted Session
84
-
85
- The Agent hydrates a local folder or a DingTalk document without requiring `init` on every session.
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.
86
42
 
87
- ```bash
88
- dta bootstrap \
89
- --agent local-dir:/path/to/agent \
90
- --skills local-dir:/path/to/agent/skills \
91
- --memory local-md:MEMORY.md \
92
- --knowledge 'dingtalk-doc:<node-or-url>' --json
93
- ```
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.
94
44
 
95
- ### Prepared Run
45
+ ## Why it exists
96
46
 
97
- A trusted host freezes the Invocation, Definition, Skills, target, budgets, and allowed actions. Message effects can only pass through the typed Broker or `dta act`.
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:
98
48
 
99
- ## From one Agent to many
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.
100
53
 
101
- Different employees should vary only in their Definition, Role Skills, field bindings, storage, and authority. They share Basic Behavior, Session/Run/Wait, the two-part gate, Receipt semantics, and the same Lab contract.
54
+ ## What an Agent is made of
102
55
 
103
- A minimal Agent kit is:
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.
104
57
 
105
- ```text
106
- my-agent/
107
- ├── AGENTS.md identity, responsibilities, deliverables, boundaries
108
- ├── agent.bindings.json Definition and semantic-storage routes
109
- ├── opencode.json Host loading contract
110
- ├── .agents/skills/ Host-visible Skill exposure
111
- ├── skills/<role>/SKILL.md role-specific methods
112
- ├── MEMORY.md reviewed semantic memory
113
- ├── knowledge/INDEX.md knowledge entry point
114
- └── .dingtalk-agent/artifacts/ independently verifiable deliverables
115
- ```
58
+ Full composition, dependencies, and boundaries: [Architecture](docs/ARCHITECTURE.md#2-一个-agent-由什么构成模型-a).
116
59
 
117
- Use the bundled [`dingtalk-agent-compose`](skills/dingtalk-agent-compose/SKILL.md) Skill to audit and assemble a Git checkout or local folder as an Agent, optionally binding semantic state to DingTalk documents. Basic Behavior must be forced into every Host session; directory discovery alone is not proof that the Skill body was loaded.
118
-
119
- The recommended definition stays local and versioned: `AGENTS.md + Role Skills`. `agent.bindings@1` routes memory and knowledge either to local Markdown or dedicated DingTalk documents, while artifacts and private control state stay local. The shortest acceptance path is:
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:
120
61
 
121
62
  ```bash
122
- # Plan only: no local write, DWS access, or Trigger creation.
123
- dta agent enhance --project-name release-agent \
124
- --role-skill release-manager --dry-run --json
125
-
126
- # Review operations/blockers/semanticReview, then use the current plan ID.
127
- dta agent enhance --project-name release-agent \
128
- --role-skill release-manager \
129
- --plan-id <current-plan-id> --yes --json
130
-
131
- dta bootstrap --bindings agent.bindings.json --json
132
-
133
- # Static only: no model and no DWS. Gaps return partial and exit code 2.
134
- dta agent audit --bindings agent.bindings.json \
135
- --require-skill <role-skill-name> --json
136
-
137
- # Isolated OpenCode load probe; still no DingTalk access.
138
- dta agent audit --bindings agent.bindings.json \
139
- --require-skill <role-skill-name> --verify-load --yes --json
63
+ dta agent audit \
64
+ --bindings agent.bindings.json \
65
+ --require-skill <role-skill-name> \
66
+ --verify-load --yes --json
140
67
  ```
141
68
 
142
- This chain has been dogfooded once with `examples/agents/release-manager`. On OpenCode 1.17.14 and `deepseek/deepseek-chat`, the with-skill random probe loaded exactly 1/1, the without-skill control did not guess it 1/1, and the final audit moved from `partial` with only `host.load-probe` missing to `ready`. This proves that the assembly and load path works for that fixture; it does not prove domain-task quality or a stable behavior gain. See the [sanitized dogfood summary](evals/baselines/2026-07-17/agent-enhance-opencode-dogfood-summary.json).
143
-
144
- `agent enhance` merges rather than blindly overwriting an existing repository. Before updating an old file it creates an operation-scoped backup under `.dingtalk-agent/backups/agent-enhance/<operationId>/`, and a custom `stateDir` is added to `.gitignore`; a stale plan, source drift, invalid Role path, unknown OpenCode instruction entry, path escape, or symlink fails before replacement. Apply has local-file side effects only. Generated body and Role Skill templates intentionally remain `partial` until real identity, responsibilities, deliverables, refusal boundaries, domain SOPs, and acceptance criteria replace every placeholder. Thus a ready [`agent-enhancement-plan@1`](docs/schemas/agent-enhancement-plan.schema.json) means “safe to apply,” not “the Agent is ready”; [`agent-enhancement-receipt@1`](docs/schemas/agent-enhancement-receipt.schema.json) carries the follow-up audit gaps.
69
+ ## How this repo is divided
145
70
 
146
- `agent-audit@1` separates Definition, Storage, Host exposure, and actual loading. A remote memory/knowledge binding remains `partial` until an authorized storage evaluation proves identity, document type, hashes, independent readback, and model use and its report is supplied with `--remote-report`. Local cache presence is never remote proof; Wait, generation, idempotency, Receipts, and credentials remain in the host atomic store.
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).
147
72
 
148
- ### One Project, multiple development Workspaces
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).
149
74
 
150
- `agent.bindings.json` describes the Agent body and storage routes. A root-level [`dingtalk-agent.json`](docs/schemas/project.schema.json) declares where the same Agent is developed. Each Development Workspace binds exactly one Host Provider, while memory, knowledge, and artifacts remain independent Storage bindings.
75
+ ## Create test promote
151
76
 
152
- ```text
153
- Agent Project
154
- ├── local-dev ── Host: OpenCode ── Storage: local-md/local-dir
155
- ├── multica-dev ── Host: Multica ── Storage: dingtalk-doc/local-dir
156
- └── legacy-prepared ── read-only view of the existing workspace@1
157
- ```
158
-
159
- W1 exposes a read-only control plane:
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-从定义到上线).
160
78
 
161
79
  ```bash
162
- dta info --json
163
- dta workspace list --json
164
- dta workspace show local-dev --json
165
- dta workspace doctor local-dev --json
166
- ```
167
-
168
- The CLI discovers the Project from any child directory and reports Provider configuration sources, `desiredHash/observedHash`, and [`workspace-state@1`](docs/schemas/workspace-state.schema.json). Doctor inspects only the named Workspace: a missing Multica installation cannot make `local-dev` fail, while Provider, source, managed bytes, or desired-state drift fails closed.
169
-
170
- OpenCode W2 adds a managed development environment. `create` is plan-only by default; `--yes` atomically materializes a gitignored copy and independently hashes it. `run/eval` use external temporary sandboxes. Provider state becomes `ready` only after the random Basic load probe, exported Session directory, and hard evidence gates pass.
171
-
172
- ```bash
173
- dta workspace create local-dev --dry-run --json
174
- dta workspace create local-dev --yes --json
175
- dta workspace use local-dev --json
176
- dta workspace run local-dev --prompt-file prompt.md --execute --yes --json
177
- dta workspace eval local-dev --suite evals/core.json --runs 3 --execute --yes --json
178
- ```
179
-
180
- `workspace run` is zero-tool. File and Artifact tools are available only through case-scoped eval permissions. W2 writes local managed Workspace, selection, state, and evidence, but never calls DWS. CI, evaluations, and future deploy flows must select the Workspace explicitly rather than rely on `current-workspace`.
80
+ # 1. Generate a zero-write plan, then commit it explicitly
81
+ dta agent enhance --project-name release-agent --role-skill release-manager --dry-run --json
82
+ dta agent enhance --project-name release-agent --role-skill release-manager \
83
+ --plan-id <plan-id> --yes --json
181
84
 
182
- Multica W3 first exposes controlled remote reads. `plan` never starts Multica. After explicit confirmation, `inspect/remote-list` use the declared profile, Workspace ID, Runtime ID, and optional Agent ID to read auth, Workspace, Runtime, Agent, Skill catalog, and assignments. An existing Agent must be bound by `agentIdFrom` or trusted prior state and is never adopted by display name.
85
+ # 2. Audit, run, and evaluate
86
+ dta agent audit --bindings agent.bindings.json --require-skill release-manager --json
87
+ dta workspace run local-dev --json
88
+ dta workspace eval local-dev --json
183
89
 
184
- ```bash
185
- dta workspace plan multica-dev --json
90
+ # 3. Cloud preflight, promotion, and observation
186
91
  dta workspace inspect multica-dev --execute --yes --json
187
92
  dta workspace remote-list multica-dev --execute --yes --json
188
- dta workspace status multica-dev --json
93
+ dta promote --source local-dev --target multica-dev --dry-run --json
94
+ dta observe --promotion-id <promotion-id> --input <observation.json> --dry-run --json
189
95
  ```
190
96
 
191
- Evidence retains only minimum resource facts and raw-output hashes; it excludes tokens, email, cleartext Server URLs, Agent instructions/runtime config, and Skill content. Identity, default Workspace, scope, stable IDs, Skill uniqueness, and evidence hashes all fail closed. A successful inspection leaves state at `verifying`: `readyForApply=true` only means W4 planning may start.
97
+ Plans are zero-write by default. Remote writes require an explicit target, the current `planId`, and confirmation.
192
98
 
193
- W4 turns that trusted inspection into a plan-bound apply through `dta deploy`. Dry-run freezes the profile, Workspace, Runtime, Agent, Definition, complete Skill-tree hashes, and maximum forward/rollback write budgets; apply re-reads the same ID chain. Only the current `--plan-id` plus explicit `--yes` may create or update remote resources. The CLI synchronizes managed Boot, Basic, and Role Skill trees and the exact assignment, then uses a dedicated Issue to independently read the Skill tool trace and an exact JSON response. Both must pass before state can move from `verifying` to `ready`.
99
+ The placeholders above are not yours to invent each has a definite source:
194
100
 
195
- ```bash
196
- dta deploy --workspace multica-dev --dry-run --json
197
- dta deploy --workspace multica-dev --plan-id <plan-id> --yes --json
198
- dta deploy --workspace multica-dev --status --json
199
- dta deploy --workspace multica-dev --status --execute --yes --json
200
- dta deploy --workspace multica-dev --list --json
201
- dta deploy --workspace multica-dev --retire --dry-run --json
202
- dta deploy --workspace multica-dev --retire --plan-id <plan-id> --yes --json
203
- ```
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 |
204
107
 
205
- A timed-out write persists its operation/Receipt and enters `reconciling`; status performs independent reads rather than retrying or rolling back an ambiguous action. If Agent create returned no ID, recovery reads candidates by stable ID and binds only one exact instructions/runtime fingerprint match, never a display name alone. Confirmed failures roll back only changes managed by the current operation. Retire archives the exact Agent without deleting Skills, Issues, semantic storage, or evidence history. Deploy never creates a robot, webhook, schedule, or other Trigger. The `dingtalk-agent-deploy` Skill only guides these stable CLI calls; it does not write through Multica directly or retain credentials.
108
+ ### Minimal runnable path (local only, three commands)
206
109
 
207
- W5 links designated W2 Eval evidence to a W4 Receipt as an explicit Promotion chain. A policy freezes source/target Workspaces, suite, minimum runs, required cases, and evidence surfaces. Dry-run recomputes the Definition/Skill, managed Workspace, plan/suite/report, and deployment hashes without Provider calls. Only the current planId plus explicit confirmation may delegate to W4 deploy. The resulting Promotion Receipt binds source, Eval, the historical deployment Receipt, and the final observed hash.
110
+ To see something move first, don't start with the chain above that is the full delivery pipeline. Start here:
208
111
 
209
112
  ```bash
210
- dta promote --policy promotion-policy.json --route local-dev-to-multica-dev --dry-run --json
211
- dta promote --policy promotion-policy.json --route local-dev-to-multica-dev \
212
- --plan-id <plan-id> --yes --json
213
- dta promote --status --promotion-id <promotion-id> --json
214
- dta promote --list --json
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
215
116
  ```
216
117
 
217
- `observe` accepts only redacted feedback whose `observedHash` exactly matches a promoted Receipt. It writes one gitignored Eval candidate fixed as `proposed`, review-required, suite-ineligible, and unpublished. It never changes AGENTS.md, prompts, Basic/Role Skills, or Triggers.
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.
218
119
 
219
- ```bash
220
- dta observe --promotion-id <promotion-id> --input observation.json --dry-run --json
221
- dta observe --promotion-id <promotion-id> --input observation.json --yes --json
222
- ```
223
-
224
- See the reusable two-Provider fixture at [`lab/project-workspace/project.fixture.json`](lab/project-workspace/project.fixture.json), the redacted read-only fixture at [`multica-readonly.fixture.json`](lab/project-workspace/multica-readonly.fixture.json), the W4 stateful fake data at [`multica-deploy.fixture.json`](lab/project-workspace/multica-deploy.fixture.json), and the W5 [`promotion-policy.fixture.json`](lab/project-workspace/promotion-policy.fixture.json). Manifests and state reject credential-like fields; `*From` fields preserve only `env:VAR` sources, never resolved values. The current contract proves local orchestration and fail-closed behavior; it does not claim that a real Multica Live apply or promotion has passed.
225
-
226
- ## Employee task protocol
227
-
228
- ![Employee task loop and completion gate](docs/architecture/task-completion-gate.svg)
229
-
230
- ```text
231
- UNDERSTAND → CLARIFY → PLAN → EXECUTE → WAIT → VERIFY → COMPLETE
232
- ```
233
-
234
- `CLARIFY` is a conditional branch, not a mandatory opening question. The Agent first forms an internal task contract—goal, deliverable, scope, observable done conditions, authority, and timing—then asks one question only when a gap blocks safe progress.
120
+ ## Support
235
121
 
236
- `COMPLETE` is evidence-gated rather than self-declared. A cross-Run task must move from `working` to `verifying`; every `doneWhen` condition must map to a file check, Workspace/Artifact assertion, Action Receipt, independent platform readback, or human confirmation. A reply that says “created” is not evidence. The CLI rejects `working completed` and any completed checkpoint without verification evidence.
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:
237
123
 
238
- ## Identity and delegation
124
+ | Dimension | Current support |
125
+ |---|---|
126
+ | **Managed Platform** | Multica (DingTalk) supported; DEAP coming soon; additional platforms through registry + adapters |
127
+ | **Local runtime** | Direct/Mounted sessions in Claude Code, Codex, OpenCode, and similar Hosts; OpenCode is the most complete local managed-Harness reference |
128
+ | **Cloud runtime** | Multica Workspace / Runtime / Agent with the same Definition, Skills, Gate, and evidence contract |
129
+ | **Delivery identity** | Digital-employee/account identity or robot-app identity; neither expands the Agent role or authority |
239
130
 
240
- The role identity and the sandbox execution identity are separate:
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.
241
132
 
242
- - the role identity says who the employee is, what it owns, whom it serves, and who delegated the work;
243
- - the execution identity is the trusted DWS profile used for platform effects;
244
- - if they represent the same subject, it is the Agent's own identity;
245
- - if they differ, the Definition must make the delegation explicit and the Action Gate must keep the delegated scope narrow.
133
+ ### Runtime modes
246
134
 
247
- Neither identity can be replaced by a display name, message body, or model memory.
248
-
249
- ## The two-part gate
250
-
251
- The safety half prevents wrong actions: response eligibility, trusted identity and target, one egress owner, action budgets, idempotency, and readback.
252
-
253
- The empathy half supplies context a colleague naturally has: quoted messages, recent conversation burst, attachments, readable identity, status, and interruption context. Enrichment improves decisions but never expands authority.
254
-
255
- ## Three semantic memory layers
256
-
257
- | Layer | Typical medium | Content |
135
+ | Mode | Use | Boundary |
258
136
  |---|---|---|
259
- | L1 task memory | Session checkpoint | Current goal, progress, next step, wait condition, evidence |
260
- | L2 operational memory | AI table, task, calendar, business system | Structured and aggregatable working facts |
261
- | L3 long-term knowledge | DingTalk docs, knowledge base, wiki | Reviewed methods, stable facts, SOPs, lessons |
262
-
263
- Control state is separate: event dedupe, leases, generation, idempotency keys, budgets, Wait, and Receipts require an atomic host store. Markdown, DingTalk documents, and Git are not transaction or lock services.
137
+ | **Direct Session** | Normal interactive work | Never guess an outbound target without a trusted event |
138
+ | **Mounted Session** | Mount local or DingTalk semantic content | Locks, idempotency, and Receipts do not live in Markdown |
139
+ | **Prepared Run** | Reliable event-driven side effects | Actions go only through the typed Broker or `dta act` |
264
140
 
265
- ## Real-world Lab
266
-
267
- Evaluation progresses through five levels:
268
-
269
- | Level | Environment | Evidence |
270
- |---|---|---|
271
- | L0 | fixtures + real CLI | Contracts, state machines, target integrity, idempotency |
272
- | L1 | model shadow | Skill loading and behavioral gain, without DingTalk effects |
273
- | L2 | fake DWS + real Action Gate | Intent/Attempt/Receipt, readback, recovery |
274
- | L3 | dedicated robot connector | Real connection, Workspace, expression, delivery, teardown |
275
- | L4 | test colleague/group + personal event + dta Broker | Full envelope, identity, target, Wait/Resume, single egress |
276
-
277
- Live runs require dedicated resources, allowlists, unique markers, fixed budgets, independent platform readback, and exact teardown. A robot response does not prove the personal-event envelope or dta-owned egress.
278
-
279
- The [`personal-event-eval@1`](lab/schemas/personal-event-eval.schema.json) suite binds Basic + Role Skills, response eligibility, Wait/Resume, duplicate delivery, Perception, Receipts, and teardown into one evidence chain. Event capture remains external; dta does not create a subscription or trigger. The default command is plan-only. Execution requires both `liveAuthorized=yes` in the local suite and all CLI confirmations:
280
-
281
- ```bash
282
- dta lab eval --engine personal-event \
283
- --workspace <agent-workspace> \
284
- --suite .dingtalk-agent/personal-event-live.local.json --json
285
-
286
- dta lab eval --engine personal-event \
287
- --workspace <agent-workspace> \
288
- --suite .dingtalk-agent/personal-event-live.local.json \
289
- --execute --live --yes --json
290
- ```
291
-
292
- See the placeholder [`personal-event-live.example.json`](lab/agent-eval/personal-event-live.example.json) and the sanitized local [`personal-event-live-readiness-summary.json`](evals/baselines/2026-07-17/personal-event-live-readiness-summary.json). Each reply must independently read back the exact body under the same message ID; a duplicate must reuse the original Run, Action, and Attempt with no new egress. The fake-DWS contract passes 8/8 scenarios, seven physical Runs, and five new outward effects, while rejecting a readback with the correct ID but rewritten body. That proves runner readiness, not a real personal-event delivery.
293
-
294
- ```bash
295
- # OpenCode plan only
296
- dta lab eval --engine opencode \
297
- --workspace lab/robot-eval/workspace \
298
- --suite lab/robot-eval/suite.json --lanes stateless --runs 3 --json
299
-
300
- # Fixed model, isolated Workspace, no DingTalk side effects
301
- dta lab eval --engine opencode \
302
- --workspace lab/robot-eval/workspace \
303
- --suite lab/robot-eval/suite.json --lanes stateless --runs 3 \
304
- --execute --yes --json
305
- ```
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.
306
142
 
307
- ## Evaluation as a reusable Skill
308
-
309
- The bundled [`dingtalk-agent-eval`](skills/dingtalk-agent-eval/SKILL.md) Skill defines the complete workflow: identify the Definition, prove Basic Skill loading, select a stable scenario, isolate execution, collect multiple evidence surfaces, apply hard gates, and only then score quality.
310
-
311
- Scenarios are grouped by the condition they can break, not by date or role:
312
-
313
- 1. `host-loading`
314
- 2. `conversation-contract`
315
- 3. `authority-and-egress`
316
- 4. `task-lifecycle`
317
- 5. `memory-and-storage`
318
- 6. `workspace-and-artifacts`
319
- 7. `platform-reliability`
320
-
321
- The repository catalog is [`lab/agent-eval/catalog.json`](lab/agent-eval/catalog.json). A reply is only one evidence surface. Cases can also require filesystem paths and contents, a valid Agent Workspace, artifact manifests and hashes, Receipts, or independent DWS readback. A failed load, safety, or integrity gate cannot be averaged away by a high quality score.
322
-
323
- Run the classic incident suite or select individual cases:
324
-
325
- ```bash
326
- dta lab eval --engine opencode \
327
- --workspace lab/agent-eval/workspace \
328
- --suite lab/agent-eval/classic-failures.json \
329
- --cases requester-only-authorization,workspace-artifact \
330
- --runs 1 --execute --yes --json
331
- ```
332
-
333
- The 2026-07-16 OpenCode 1.17.14 + DeepSeek development regression covers nine classic cases. Basic 0.9.4 passed its load gate. Eight cases passed in the full run; the only correct refusal missed a phrase-only grader and passed a targeted rerun after the grader changed to a bounded regex plus independent reason and exclusion checks. The artifact case allowed only `read/write/edit` and actually used only `write`; it passed all seven Workspace/Artifact/Filesystem postconditions and copied two hashed outputs into the evidence bundle. Writable sandboxes live under a system temporary root outside the repository; the runner canonicalizes and audits every tool path so OpenCode cannot resolve a relative write against a parent Git checkout. This is combined 9/9 passing evidence, not a claim of one statistically significant run. See the [sanitized multi-surface summary](evals/baselines/2026-07-16/opencode-multi-surface-summary.json).
334
-
335
- The same local `AGENTS.md + Skills` can be evaluated with local semantic state or with `memory` and `knowledge` hydrated from `dingtalk-doc:`:
336
-
337
- ```bash
338
- cp lab/agent-eval/remote-state.example.json \
339
- .dingtalk-agent/remote-state.local.json
340
-
341
- # Plan only: no DWS read and no model call
342
- dta lab eval --engine storage \
343
- --workspace lab/agent-eval/remote-state-workspace \
344
- --suite .dingtalk-agent/remote-state.local.json --json
345
-
346
- # Read two dedicated documents and evaluate OpenCode; --live adds one unique write probe
347
- dta lab eval --engine storage \
348
- --workspace lab/agent-eval/remote-state-workspace \
349
- --suite .dingtalk-agent/remote-state.local.json \
350
- --execute --live --yes --json
351
- ```
352
-
353
- The 2026-07-16 live DWS canary used two dedicated `adoc` documents. The local Definition was ready, Basic 0.9.4 was forced through OpenCode instructions, both remote/mount/cache/manifest hashes matched, and DeepSeek returned two remote-only probe values with zero tools. One append marker was verified exactly once through a full-document readback. Deterministic contracts also reject a wrong DWS identity, a non-adoc node, and post-bootstrap drift. The first byte-level marker check produced a false negative because DingTalk escaped Markdown punctuation; the runner now counts the normalized text stream and never treats a command response as proof. See the [sanitized remote-state summary](evals/baselines/2026-07-16/remote-state-live-summary.json).
354
-
355
- Remote Markdown remains semantic state; private control state stays in the host's atomic store. The evaluator does not infer permission to delete its dedicated test documents.
356
-
357
- ## Development and verification
358
-
359
- ```bash
360
- npm ci
361
- npm run typecheck
362
- npm run eval:contract
363
- npm pack --dry-run
364
- ```
365
-
366
- The 60-case deterministic suite also covers `agent-bindings@1`, plan-bound enhancement with backups and semantic-placeholder gates, precise partial-to-ready repairs, OpenCode load evidence bound to the current Definition and Host exposure, two-process L1/L2/L3 remote semantic-state recovery, a default-safe Phase 11B Live runner, the Phase 9 personal-event evidence chain, fail-closed identity/type/drift/slot/cache checks, replication of a second isolated Role Agent without kernel changes, multi-Provider Project/Workspace isolation, Workspace-bound OpenCode materialization/run/eval, Multica W3–W5 orchestration, isolated npm-tarball readiness, negation-aware completion claims, and predeclared comparison policies. A passing comparison policy is a deterministic release gate, not statistical significance or proof of a stable model gain.
367
-
368
- See [Self-test and evolution](docs/SELF-TEST.md), [Architecture](docs/ARCHITECTURE.md), and the [implementation plan](docs/plans/2026-07-16/eval-test-skill-and-remote-state.md).
369
-
370
- ## Project layout
371
-
372
- ```text
373
- bin/ CLI composition root
374
- src/ TypeScript runtime
375
- skills/dingtalk-basic-behavior/ shared employee behavior
376
- skills/dingtalk-agent-compose/ Agent assembly and optimization
377
- skills/dingtalk-agent-eval/ scenario, evidence, and promotion method
378
- examples/agents/ reusable role kits
379
- lab/ catalogs, manifests, schemas, and runbooks
380
- evals/ deterministic and model evaluations
381
- docs/ architecture and decisions
382
- ```
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.
383
144
 
384
- ## Current boundaries
145
+ ## Docs
385
146
 
386
- - Event listeners and schedulers are outside the kernel.
387
- - Workspace initialization is optional and never automatic per session.
388
- - dta does not duplicate the DWS command surface.
389
- - DingTalk documents do not store locks, idempotency, generation, or effect receipts.
390
- - Online Runs cannot hot-expand identity, authority, or enabled Skills.
391
- - `bootstrap` hydrates `dingtalk-doc` as a read-only snapshot; remote publication requires explicit authorization and readback.
147
+ | Goal | Start here |
148
+ |---|---|
149
+ | Understand the Agent architecture and how the repo is divided | [Architecture](docs/ARCHITECTURE.md) |
150
+ | Install, upgrade, or troubleshoot | [Installation](docs/INSTALLATION.md) |
151
+ | Understand evaluation and evidence levels | [Self-test](docs/SELF-TEST.md) |
152
+ | Create or audit an Agent | [Compose Skill](skills/core/dingtalk-agent-compose/SKILL.md) |
153
+ | Test or debug a delivered Agent | [Eval Skill](skills/core/dingtalk-agent-eval/SKILL.md) |
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) |
392
157
 
393
- ## License
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.
394
159
 
395
- [MIT](LICENSE)
160
+ MIT License