tianshu-mcp 0.1.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/LICENSE +201 -0
- package/README.en.md +107 -0
- package/README.md +115 -0
- package/dist/agents/adapter.d.ts +76 -0
- package/dist/agents/adapter.js +2 -0
- package/dist/agents/adapter.js.map +1 -0
- package/dist/agents/builtin.d.ts +7 -0
- package/dist/agents/builtin.js +51 -0
- package/dist/agents/builtin.js.map +1 -0
- package/dist/agents/cli.d.ts +15 -0
- package/dist/agents/cli.js +75 -0
- package/dist/agents/cli.js.map +1 -0
- package/dist/agents/registry.d.ts +26 -0
- package/dist/agents/registry.js +212 -0
- package/dist/agents/registry.js.map +1 -0
- package/dist/agents/spawn.d.ts +36 -0
- package/dist/agents/spawn.js +182 -0
- package/dist/agents/spawn.js.map +1 -0
- package/dist/config/schema.d.ts +488 -0
- package/dist/config/schema.js +118 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/store.d.ts +49 -0
- package/dist/config/store.js +224 -0
- package/dist/config/store.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/loop/fix-loop.d.ts +48 -0
- package/dist/loop/fix-loop.js +217 -0
- package/dist/loop/fix-loop.js.map +1 -0
- package/dist/mcp/context.d.ts +13 -0
- package/dist/mcp/context.js +16 -0
- package/dist/mcp/context.js.map +1 -0
- package/dist/mcp/formatter.d.ts +44 -0
- package/dist/mcp/formatter.js +41 -0
- package/dist/mcp/formatter.js.map +1 -0
- package/dist/mcp/handlers.d.ts +32 -0
- package/dist/mcp/handlers.js +334 -0
- package/dist/mcp/handlers.js.map +1 -0
- package/dist/mcp/tools.d.ts +15 -0
- package/dist/mcp/tools.js +69 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/server.d.ts +19 -0
- package/dist/server.js +92 -0
- package/dist/server.js.map +1 -0
- package/dist/tasks/task-manager.d.ts +77 -0
- package/dist/tasks/task-manager.js +296 -0
- package/dist/tasks/task-manager.js.map +1 -0
- package/dist/tasks/task-store.d.ts +31 -0
- package/dist/tasks/task-store.js +145 -0
- package/dist/tasks/task-store.js.map +1 -0
- package/dist/tasks/task.d.ts +111 -0
- package/dist/tasks/task.js +39 -0
- package/dist/tasks/task.js.map +1 -0
- package/dist/util/fs.d.ts +12 -0
- package/dist/util/fs.js +93 -0
- package/dist/util/fs.js.map +1 -0
- package/dist/util/id.d.ts +3 -0
- package/dist/util/id.js +22 -0
- package/dist/util/id.js.map +1 -0
- package/dist/util/log.d.ts +12 -0
- package/dist/util/log.js +46 -0
- package/dist/util/log.js.map +1 -0
- package/dist/util/path.d.ts +17 -0
- package/dist/util/path.js +90 -0
- package/dist/util/path.js.map +1 -0
- package/dist/util/skill-install.d.ts +13 -0
- package/dist/util/skill-install.js +122 -0
- package/dist/util/skill-install.js.map +1 -0
- package/dist/util/timeout.d.ts +7 -0
- package/dist/util/timeout.js +26 -0
- package/dist/util/timeout.js.map +1 -0
- package/dist/verify/acceptance.d.ts +38 -0
- package/dist/verify/acceptance.js +203 -0
- package/dist/verify/acceptance.js.map +1 -0
- package/dist/verify/code-analysis.d.ts +9 -0
- package/dist/verify/code-analysis.js +234 -0
- package/dist/verify/code-analysis.js.map +1 -0
- package/dist/verify/exec.d.ts +13 -0
- package/dist/verify/exec.js +32 -0
- package/dist/verify/exec.js.map +1 -0
- package/dist/verify/git-baseline.d.ts +54 -0
- package/dist/verify/git-baseline.js +221 -0
- package/dist/verify/git-baseline.js.map +1 -0
- package/dist/verify/report.d.ts +6 -0
- package/dist/verify/report.js +112 -0
- package/dist/verify/report.js.map +1 -0
- package/dist/verify/runner.d.ts +11 -0
- package/dist/verify/runner.js +125 -0
- package/dist/verify/runner.js.map +1 -0
- package/dist/verify/signals.d.ts +11 -0
- package/dist/verify/signals.js +42 -0
- package/dist/verify/signals.js.map +1 -0
- package/package.json +62 -0
- package/skills/tianshu-mcp/SKILL.md +69 -0
- package/skills/tianshu-mcp/usage-examples.md +109 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# tianshu-mcp
|
|
4
|
+
|
|
5
|
+
**Tianshu × AI-Agent orchestration MCP server**
|
|
6
|
+
|
|
7
|
+
Registered by Tianshu as a standard MCP server, it dispatches external AI-Agent CLIs (Codex; Zcode and TraeWork/TRAE SOLO CN verified to lack headless interfaces → unsupported; architecture stays horizontally extensible) to drive the closed loop of **project development → acceptance → failure rework → re-acceptance**.
|
|
8
|
+
|
|
9
|
+
TypeScript · Node.js ≥ 20 · `@modelcontextprotocol/sdk` (stdio)
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## What this is
|
|
16
|
+
|
|
17
|
+
Tianshu plays the role of the overall commander; this MCP server is the **scheduler + execution surface + objective acceptance gate**; the external AI-Agent CLI (e.g. Codex) is the "worker" that does the development.
|
|
18
|
+
|
|
19
|
+
- **8 MCP tools**: `run_task / query_task / list_tasks / get_task_report / cancel_task / verify_task / rework_task / get_profiles`.
|
|
20
|
+
- **Async contract**: `run_task` returns a `taskId` immediately; long-running work is polled via `query_task` (never blocks `tools/call`).
|
|
21
|
+
- **Objective acceptance**: automated command checks (typecheck/lint/test/build — skipped when absent, plus tech-stack derivation) + programmatic code analysis (changed-file list / diffstat / suspicious signals such as TODO, debugger, secret-like patterns), all relative to a **git baseline**; never auto-commits or stashes.
|
|
22
|
+
- **Rework loop**: automatic rework (`autoFixRounds`) + manual `rework_task`; when rounds run out → `needs_attention` awaiting Tianshu's verdict.
|
|
23
|
+
- **Scheduling discipline**: per-project serial queue + global concurrency cap (default 2, configurable).
|
|
24
|
+
- **No key handling**: each agent uses its own login state; this server never stores or forwards any API key.
|
|
25
|
+
- **Extensible**: a new agent = one profile (data) + (if needed) one adapter file — no changes to the orchestration core.
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install
|
|
31
|
+
npm run build # → dist/
|
|
32
|
+
npm test # 53 tests: unit + stub-agent 3-playbook integration + protocol + cancel/timeout/baseline/params regression
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Register as a Tianshu MCP server (local dev mode):
|
|
36
|
+
|
|
37
|
+
```jsonc
|
|
38
|
+
{
|
|
39
|
+
"mcp": {
|
|
40
|
+
"servers": {
|
|
41
|
+
"tianshu-mcp": {
|
|
42
|
+
"command": "node",
|
|
43
|
+
"args": ["<absolute-repo-path>/dist/index.js"],
|
|
44
|
+
"env": { "TIANSHU_MCP_HOME": "<absolute-repo-path>/.tianshu-mcp" }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
After opening a new session, the 8 tools such as `mcp__tianshu-mcp__run_task` appear. Rehearse with the stub agent first (no real login state), then switch to the `codex` profile for real tasks:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
run_task(projectPath=D:/xxx/my-app, task=「…task brief…」, agentId=codex, autoVerify=true, autoFixRounds=2)
|
|
55
|
+
→ taskId → poll query_task(taskId) → succeeded / failed / needs_attention → get_task_report
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Documentation
|
|
59
|
+
|
|
60
|
+
| Doc | Content |
|
|
61
|
+
|---|---|
|
|
62
|
+
| [docs/tianshu-integration.md](docs/tianshu-integration.md) | Two config.json integration modes, UI/API steps, smoke test, FAQ |
|
|
63
|
+
| [docs/agent-profiles.md](docs/agent-profiles.md) | Agent profile field reference + real-machine samples (codex M2 finalized) |
|
|
64
|
+
| [docs/adapter-matrix.md](docs/adapter-matrix.md) | Agent capability research matrix (Codex/Zcode/TraeWork/extension slots) |
|
|
65
|
+
| [docs/m2-smoke-record.md](docs/m2-smoke-record.md) | M2 real-Codex smoke record (run_task→verify_task passed + bug fixes) |
|
|
66
|
+
| [docs/m2-rework-record.md](docs/m2-rework-record.md) | M2 codex rework-loop record (failure→rework_task→re-verify, with artifacts) |
|
|
67
|
+
| [docs/acceptance-config.md](docs/acceptance-config.md) | Project-level `.tianshu-mcp/acceptance.json` acceptance config spec |
|
|
68
|
+
| English docs | [acceptance-config.en.md](docs/acceptance-config.en.md) · [tianshu-integration.en.md](docs/tianshu-integration.en.md) · [agent-profiles.en.md](docs/agent-profiles.en.md) · [adapter-matrix.en.md](docs/adapter-matrix.en.md) |
|
|
69
|
+
| [skills/tianshu-mcp/](skills/tianshu-mcp/SKILL.md) | Skill teaching Tianshu how to orchestrate this MCP (with usage examples) |
|
|
70
|
+
|
|
71
|
+
## Milestone status
|
|
72
|
+
|
|
73
|
+
- **M1 — Core engine + stub-agent end-to-end** ✅
|
|
74
|
+
- 8 tools, TaskManager state machine / queue / concurrency gate / cancel (kill tree) / event-stream persistence
|
|
75
|
+
- Acceptance engine (git baseline & diff, default-set derivation, command runner, code analysis, report.md/json)
|
|
76
|
+
- fix-loop auto rework + needs_attention; skill self-install
|
|
77
|
+
- Stub-agent 3 playbooks (good / fix-on-first / never) integration tests + protocol tests — **53/53 green** (incl. R1–R5 cancel/timeout/baseline/params regressions)
|
|
78
|
+
- **M2 — Real Codex CLI smoke + rework loop** ✅ (2026-09-07)
|
|
79
|
+
- Real `codex exec` completed `run_task → query_task → verify_task` (see [m2-smoke-record.md](docs/m2-smoke-record.md))
|
|
80
|
+
- Real **failure → rework_task → re-verify succeeded** loop ([m2-rework-record.md](docs/m2-rework-record.md), artifacts in `docs/m2-evidence/`)
|
|
81
|
+
- Fixed 3 real bugs the smoke exposed (Windows npm shim / spawn log race crash / codex flag conflict) + regression tests
|
|
82
|
+
- Zcode headless entry (Z1) verified: ZCode desktop ships no headless CLI → unsupported
|
|
83
|
+
- **M3 — TraeWork research + full delivery** ✅ (2026-09-07 T1 settled + delivery ready)
|
|
84
|
+
- T1 settled: local TRAE SOLO CN v1.107.1 verified **unsupported** (no headless programmable agent interface; VS Code-family CLI only; see [adapter-matrix.md](docs/adapter-matrix.md))
|
|
85
|
+
- npm name `tianshu-mcp` available; npm publish needs an npmjs token
|
|
86
|
+
- Real Tianshu-session skill-trigger validation (DoD #8) needs a GUI session (skill self-installed and ready)
|
|
87
|
+
|
|
88
|
+
## Acceptance remediation (R1–R8, 2026-09-07)
|
|
89
|
+
|
|
90
|
+
Per the acceptance-remediation plan, all P1/P2 findings are fixed with regression tests (total **53/53**):
|
|
91
|
+
|
|
92
|
+
- **R1** ✅ cancel/interrupt state persistence (`cancel_requested → cancelled`, cancelReason/finishedAt/errorType, restart-recoverable, idempotent, bounded shutdown)
|
|
93
|
+
- **R2** ✅ call-level `taskTimeoutMs` wins (adapter no longer overrides); POSIX process-group SIGTERM→SIGKILL with exit polling; Windows `taskkill /T /F`; single kill-tree impl + abort-race guard
|
|
94
|
+
- **R3** ✅ git baseline participates in diff (baseline.head boundary; agent commits don't lose changes; dirty-worktree hash attribution; `--untracked-files=all`)
|
|
95
|
+
- **R4** ✅ params: `round=0` valid; manual verify allocates next round (no overwrite); `extraChecks` append + `checksMode=replace`; `optional` doesn't fail verdict; `baselineRef` validated
|
|
96
|
+
- **R5** ✅ hardcoded paths removed (`{LOCALAPPDATA}` placeholders + platform defaults); mtime+size hot reload for config/profile/projects
|
|
97
|
+
- **R6** ✅ CI matrix win/mac/linux × Node 20/22 all green (run 25); Release version consistency (tag=package=tarball, v0.1.1 draft OK); tarball content check
|
|
98
|
+
- **R7** 🟡 real Tianshu loop: host connect (DoD #6) + skill install verified; GUI-session invoke needs a user session
|
|
99
|
+
- **R8** 🔄 docs synced (ZH/EN + dev-plan checklist); see [remediation-recheck report](.codex/review/2026-09-07-remediation-recheck.md)
|
|
100
|
+
|
|
101
|
+
## Recommended phrasing (for Tianshu)
|
|
102
|
+
|
|
103
|
+
> "In project D:\xxx, implement 『task』 with codex. First run run_task(autoVerify:true, autoFixRounds:2), then check with query_task; if the report says needs_attention, feed the failed items from get_task_report as feedback into rework_task and verify again; when everything passes, report changedFiles and diffstat."
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
[MIT](LICENSE)
|
package/README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# tianshu-mcp
|
|
4
|
+
|
|
5
|
+
**天枢 × AI-Agent 编排 MCP server**
|
|
6
|
+
|
|
7
|
+
由天枢(Tianshu)当作标准 MCP server 接入,调度外部 AI-Agent CLI(Codex;Zcode 与 TraeWork/TRAE SOLO CN 经实测无无头接口标 unsupported,架构可横向扩展)完成 **项目开发 → 验收 → 失败返修 → 再验收** 的闭环。
|
|
8
|
+
|
|
9
|
+
TypeScript · Node.js ≥ 20 · `@modelcontextprotocol/sdk`(stdio)
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 这是什么
|
|
16
|
+
|
|
17
|
+
天枢的角色是总指挥;本 MCP server 是**调度 + 执行面 + 客观验收仪**;外部 AI-Agent CLI(Codex 等)是执行开发的"工人"。
|
|
18
|
+
|
|
19
|
+
- **8 个 MCP 工具**:`run_task / query_task / list_tasks / get_task_report / cancel_task / verify_task / rework_task / get_profiles`。
|
|
20
|
+
- **异步契约**:`run_task` 秒回 `taskId`,长任务用 `query_task` 轮询(长任务不卡 `tools/call`)。
|
|
21
|
+
- **客观验收**:自动命令检查(typecheck/lint/test/build,缺则跳过 + 技术栈推导)+ 程序化代码分析(变更清单/diffstat/TODO·debugger·密钥形态等可疑标记),全部相对 **git 基线**,不自动 commit/stash。
|
|
22
|
+
- **失败返修闭环**:自动返修(`autoFixRounds`)+ 手动 `rework_task`;轮次用尽 → `needs_attention` 等天枢裁决。
|
|
23
|
+
- **调度纪律**:每项目串行队列 + 全局并发上限(默认 2,可配)。
|
|
24
|
+
- **不碰密钥**:各 agent 用自己的登录态;本 server 不保存/转发任何 API key。
|
|
25
|
+
- **可扩展**:新 agent = 一个 profile(数据)+(如需)一个 adapter 文件,零改编排核心。
|
|
26
|
+
|
|
27
|
+
## 快速开始
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install
|
|
31
|
+
npm run build # → dist/
|
|
32
|
+
npm test # 53 项测试:单元 + stub-agent 三剧本集成 + 协议 + 取消/超时/基线/参数回归
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
配置为天枢 MCP server(本地开发模式):
|
|
36
|
+
|
|
37
|
+
```jsonc
|
|
38
|
+
{
|
|
39
|
+
"mcp": {
|
|
40
|
+
"servers": {
|
|
41
|
+
"tianshu-mcp": {
|
|
42
|
+
"command": "node",
|
|
43
|
+
"args": ["<仓库绝对路径>/dist/index.js"],
|
|
44
|
+
"env": { "TIANSHU_MCP_HOME": "<仓库绝对路径>/.tianshu-mcp" }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
新开会话后,工具面出现 `mcp__tianshu-mcp__run_task` 等 8 个工具。用 stub 预演(不碰真实登录态)→ 切 codex 跑真实任务:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
run_task(projectPath=D:/xxx/my-app, task=「…任务书…」, agentId=codex, autoVerify=true, autoFixRounds=2)
|
|
55
|
+
→ taskId → query_task(taskId) 轮询 → succeeded / failed / needs_attention → get_task_report 读报告
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 文档
|
|
59
|
+
|
|
60
|
+
| 文档 | 内容 |
|
|
61
|
+
|---|---|
|
|
62
|
+
| [docs/tianshu-integration.md](docs/tianshu-integration.md) | 天枢 config.json 两种接入模式、UI/API 操作、冒烟步骤、FAQ |
|
|
63
|
+
| [docs/agent-profiles.md](docs/agent-profiles.md) | agent profiles 字段说明 + 真实机器样例(codex M2 定稿) |
|
|
64
|
+
| [docs/adapter-matrix.md](docs/adapter-matrix.md) | 各 Agent 能力调研矩阵(Codex/Zcode/TraeWork/扩展位) |
|
|
65
|
+
| [docs/m2-smoke-record.md](docs/m2-smoke-record.md) | M2 真实 codex 冒烟记录(run_task→verify_task 通过 + 缺陷修复) |
|
|
66
|
+
| [docs/m2-rework-record.md](docs/m2-rework-record.md) | M2 codex rework 闭环记录(失败→rework_task→再验收,含物证) |
|
|
67
|
+
| [docs/host-integration-record.md](docs/host-integration-record.md) | 天枢宿主真实接入实测(DoD #6:2 servers / 10 tools) |
|
|
68
|
+
| [docs/acceptance-config.md](docs/acceptance-config.md) | 项目级 `.tianshu-mcp/acceptance.json` 验收配置规范 |
|
|
69
|
+
| English docs | [acceptance-config.en.md](docs/acceptance-config.en.md) · [tianshu-integration.en.md](docs/tianshu-integration.en.md) · [agent-profiles.en.md](docs/agent-profiles.en.md) · [adapter-matrix.en.md](docs/adapter-matrix.en.md) |
|
|
70
|
+
| [skills/tianshu-mcp/](skills/tianshu-mcp/SKILL.md) | 教天枢编排本 MCP 的技能(含使用示例) |
|
|
71
|
+
|
|
72
|
+
## 里程碑状态
|
|
73
|
+
|
|
74
|
+
- **M1 — 核心引擎 + stub-agent 全链路** ✅
|
|
75
|
+
- 8 工具、TaskManager 状态机/队列/并发闸/cancel(kill tree)/事件流落盘
|
|
76
|
+
- 验收引擎(git 基线/diff、默认集推导、命令 runner、代码分析、report.md/json)
|
|
77
|
+
- fix-loop 自动返修 + needs_attention;技能自检安装(已在本机真实 `~/.rivet/skills` 验证)
|
|
78
|
+
- stub-agent 三剧本(good/fix-on-first/never)集成测试 + 协议测试,**53/53 绿**(含 R1–R5 取消/超时/基线/参数回归)
|
|
79
|
+
- **M2 — 真实 Codex CLI 冒烟 + rework 闭环** ✅(2026-09-07)
|
|
80
|
+
- 真实 `codex exec` 跑通 `run_task → query_task → verify_task`([m2-smoke-record.md](docs/m2-smoke-record.md))
|
|
81
|
+
- 真实 **失败→rework_task→再验收 succeeded** 闭环([m2-rework-record.md](docs/m2-rework-record.md),物证 `docs/m2-evidence/`)
|
|
82
|
+
- 修复冒烟暴露的 3 个真实缺陷(Windows npm 垫片 / spawn 日志竞态崩溃 / codex flags 互斥)并各加回归测试
|
|
83
|
+
- Zcode 无头接口(Z1)实测定论:ZCode 桌面无随包 headless CLI → unsupported
|
|
84
|
+
- **工程/CI** ✅(2026-09-07)
|
|
85
|
+
- GitHub Actions 实测:`CI`(Node 20/22 矩阵)与 `Release`(tag v0.1.0 触发)均绿(提交 d91aea8/2a9ac82 起)
|
|
86
|
+
- 技能自检安装已在本机真实 `~/.rivet/skills/tianshu-mcp` 验证生效且幂等
|
|
87
|
+
- npm 包名 `tianshu-mcp` 在 npmjs 可用(未占用)
|
|
88
|
+
- **天枢宿主真实接入(DoD #6)** ✅(2026-09-07,[host-integration-record.md](docs/host-integration-record.md))
|
|
89
|
+
- 在真实 `D:\Tianshu` 桌面宿主 `mcp.servers` 配置 §11.1 本地模式 → sidecar `MCP: 2 servers connected, 10 tools`(含本 server 8 工具),spawn 子进程并 stdio 连通
|
|
90
|
+
- 实测暴露并修复技能安装源路径 bug(fileURLToPath,提交 55cf2d0)
|
|
91
|
+
- **M3 — TraeWork 调研 + 全套交付** ✅(2026-09-07 T1 定论 + 交付就绪)
|
|
92
|
+
- T1 定论:本机 TRAE SOLO CN v1.107.1 实测 **unsupported**(无无头可编程 agent 接口,仅 VS Code 家族 CLI;见 [adapter-matrix.md](docs/adapter-matrix.md))
|
|
93
|
+
- npm 包名 `tianshu-mcp` 可用;npm publish 需 npmjs token
|
|
94
|
+
- GUI 聊天会话内实际调用工具(DoD #8 最后一环)需用户开天枢新会话(宿主连通与 8 工具注册已就位)
|
|
95
|
+
|
|
96
|
+
## 验收整改(R1–R8,2026-09-07)
|
|
97
|
+
|
|
98
|
+
按 [验收修复计划](.zcode/plans/tianshu-mcp-development-plan.md) 与 `.codex/plans/2026-09-07-acceptance-remediation-plan.md` 完成:
|
|
99
|
+
|
|
100
|
+
- **R1** ✅ 取消/中断状态机持久化:运行中取消 `cancel_requested → cancelled`(cancelReason/finishedAt/errorType 落盘)、重启可恢复、幂等、shutdown 有界等待。
|
|
101
|
+
- **R2** ✅ 调用级 `taskTimeoutMs` 覆盖生效(adapter 不再用 profile 覆盖)、POSIX 进程组 SIGTERM→SIGKILL、Windows taskkill /T /F,kill-tree 单实现。
|
|
102
|
+
- **R3** ✅ Git 基线参与差异计算:以 baseline.head 为边界,agent 提交不丢变更、脏工作区 hash 归因、porcelain 逐文件展开。
|
|
103
|
+
- **R4** ✅ 参数语义:`get_task_report(round=0)` 合法、手动验收分配新轮次不覆盖、`extraChecks` 追加 + `checksMode=replace`、`optional` 不影响 verdict、`baselineRef` 校验。
|
|
104
|
+
- **R5** ✅ 移除路径硬编码(`{LOCALAPPDATA}` 等占位符 + 平台标准候选),config/profile/projects mtime 热加载。
|
|
105
|
+
- **R6** 🔄 CI 矩阵扩到 Windows/macOS/Linux × Node 20/22;Release 版本一致性校验;tarball 内容校验。
|
|
106
|
+
- **R7** 🟡 天枢真实闭环:宿主连通(DoD #6)与技能安装已实测;GUI 会话内工具调用待用户开天枢新会话。
|
|
107
|
+
- **R8** 🔄 文档同步 + 最终复验。
|
|
108
|
+
|
|
109
|
+
## 推荐用法(给天枢的提示语)
|
|
110
|
+
|
|
111
|
+
> "在项目 D:\xxx 用 codex 实现『任务』。先跑 run_task(autoVerify:true, autoFixRounds:2),完成后用 query_task 看结果;若报告显示 needs_attention,把 get_task_report 的失败项摘要作为 feedback 调 rework_task 再验一轮;全部通过后向我汇报 changedFiles 与 diffstat。"
|
|
112
|
+
|
|
113
|
+
## 许可
|
|
114
|
+
|
|
115
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentAdapter 接口(开发计划 §7.1):统一抽象,横向扩展点。
|
|
3
|
+
* 实现基于 profile 数据驱动:resolve 探测可执行,buildInvocation 构造命令,
|
|
4
|
+
* parseExit 判定结果。新增 agent = 新 profile +(如需)子类 adapter。
|
|
5
|
+
*/
|
|
6
|
+
import type { SpawnSpec } from "./spawn.js";
|
|
7
|
+
import type { AgentProfile } from "../config/schema.js";
|
|
8
|
+
export interface ResolvedAgent {
|
|
9
|
+
id: string;
|
|
10
|
+
displayName: string;
|
|
11
|
+
profile: AgentProfile;
|
|
12
|
+
command: string;
|
|
13
|
+
argsTemplate: string[];
|
|
14
|
+
ok: boolean;
|
|
15
|
+
message: string;
|
|
16
|
+
/** resolve 成功后缓存的探测信息 */
|
|
17
|
+
discovered?: {
|
|
18
|
+
source: "explicit" | "fallback" | "discovery";
|
|
19
|
+
version?: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface TaskContext {
|
|
23
|
+
taskId: string;
|
|
24
|
+
projectPath: string;
|
|
25
|
+
displayPath: string;
|
|
26
|
+
agentId: string;
|
|
27
|
+
task: string;
|
|
28
|
+
context?: string;
|
|
29
|
+
round: number;
|
|
30
|
+
feedback?: string;
|
|
31
|
+
taskDir: string;
|
|
32
|
+
workDir: string;
|
|
33
|
+
taskTimeoutMs: number;
|
|
34
|
+
}
|
|
35
|
+
export interface SpawnInvocation {
|
|
36
|
+
spec: Omit<SpawnSpec, "logFile" | "timeoutMs">;
|
|
37
|
+
promptText: string;
|
|
38
|
+
stdinText?: string;
|
|
39
|
+
timeoutMs: number;
|
|
40
|
+
logFile: string;
|
|
41
|
+
}
|
|
42
|
+
export interface AgentRunResult {
|
|
43
|
+
ok: boolean;
|
|
44
|
+
exitCode: number | null;
|
|
45
|
+
timeout: boolean;
|
|
46
|
+
killed: boolean;
|
|
47
|
+
error?: string;
|
|
48
|
+
durationMs: number;
|
|
49
|
+
logFile: string;
|
|
50
|
+
hardFailure?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/** parseExit: SpawnResult → AgentRunResult,按 agent 语义 */
|
|
53
|
+
export type ParseExitFn = (res: {
|
|
54
|
+
ok: boolean;
|
|
55
|
+
exitCode: number | null;
|
|
56
|
+
timeout: boolean;
|
|
57
|
+
killed: boolean;
|
|
58
|
+
error?: string;
|
|
59
|
+
durationMs: number;
|
|
60
|
+
logFile: string;
|
|
61
|
+
}) => AgentRunResult;
|
|
62
|
+
export interface AgentAdapter {
|
|
63
|
+
id: string;
|
|
64
|
+
/** 构造一次调用(命令/参数/工作目录/env/prompt 传递) */
|
|
65
|
+
buildInvocation(ctx: TaskContext, resolved: ResolvedAgent): SpawnInvocation;
|
|
66
|
+
/** 将子进程退出结果翻译为语义结果 */
|
|
67
|
+
parseExit(res: {
|
|
68
|
+
ok: boolean;
|
|
69
|
+
exitCode: number | null;
|
|
70
|
+
timeout: boolean;
|
|
71
|
+
killed: boolean;
|
|
72
|
+
error?: string;
|
|
73
|
+
durationMs: number;
|
|
74
|
+
logFile: string;
|
|
75
|
+
}): AgentRunResult;
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/agents/adapter.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 内置 agent profiles(开发计划 §7.2)。用户数据目录 agent-profiles.json 可整键覆盖。
|
|
3
|
+
* 代码优先、profile 可配:真实路径属于机器/环境数据 → 默认只给结构与探测规则。
|
|
4
|
+
*/
|
|
5
|
+
import type { AgentProfile } from "../config/schema.js";
|
|
6
|
+
export declare const BUILTIN_PROFILES: Record<string, AgentProfile>;
|
|
7
|
+
export declare const BUILTIN_PROFILE_IDS: string[];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const BUILTIN_PROFILES = {
|
|
2
|
+
codex: {
|
|
3
|
+
displayName: "Codex (OpenAI 桌面端 CLI)",
|
|
4
|
+
type: "cli",
|
|
5
|
+
status: "ready",
|
|
6
|
+
command: null,
|
|
7
|
+
argsTemplate: ["exec", "<prompt:arg>", "--skip-git-repo-check", "--sandbox", "workspace-write"],
|
|
8
|
+
promptMode: "arg",
|
|
9
|
+
cwd: "task",
|
|
10
|
+
env: {},
|
|
11
|
+
timeoutMs: 30 * 60_000,
|
|
12
|
+
killTree: "taskkill",
|
|
13
|
+
authNote: "复用 ~/.codex 登录态(与桌面端同账号);需本机已装 Codex 桌面端;勿与 --approve-for-me 同用(实测互斥)",
|
|
14
|
+
executableDiscovery: {
|
|
15
|
+
dirs: ["{LOCALAPPDATA}/OpenAI/Codex/bin", "{USERPROFILE}/AppData/Local/OpenAI/Codex/bin", "/Applications/Codex.app/Contents/Resources/app/bin"],
|
|
16
|
+
fileNames: ["codex.exe", "codex"],
|
|
17
|
+
fallbackCommand: "codex",
|
|
18
|
+
},
|
|
19
|
+
note: "M2 真实冒烟已定稿(见 docs/m2-smoke-record.md):--sandbox workspace-write 非交互通过",
|
|
20
|
+
},
|
|
21
|
+
zcode: {
|
|
22
|
+
displayName: "Zcode (ZCode 桌面)",
|
|
23
|
+
type: "cli",
|
|
24
|
+
status: "unsupported",
|
|
25
|
+
command: null,
|
|
26
|
+
argsTemplate: [],
|
|
27
|
+
promptMode: "arg",
|
|
28
|
+
cwd: "task",
|
|
29
|
+
env: {},
|
|
30
|
+
timeoutMs: 30 * 60_000,
|
|
31
|
+
killTree: "taskkill",
|
|
32
|
+
authNote: "复用本机 ZCode 登录态",
|
|
33
|
+
note: "Z1 实测(2026-09-07):ZCode = Electron 桌面(D:/Z-Code/ZCode/ZCode.exe),无随包 headless agent-exec CLI,打包 tools 仅 cua-helper/ripgrep/ugrep → 无法无头 spawn → unsupported(详见 docs/adapter-matrix.md §Z1)",
|
|
34
|
+
},
|
|
35
|
+
traework: {
|
|
36
|
+
displayName: "TraeWork (TRAE SOLO CN)",
|
|
37
|
+
type: "cli",
|
|
38
|
+
status: "unsupported",
|
|
39
|
+
command: null,
|
|
40
|
+
argsTemplate: [],
|
|
41
|
+
promptMode: "arg",
|
|
42
|
+
cwd: "task",
|
|
43
|
+
env: {},
|
|
44
|
+
timeoutMs: 30 * 60_000,
|
|
45
|
+
killTree: "taskkill",
|
|
46
|
+
authNote: "",
|
|
47
|
+
note: "T1 实测(2026-09-07):本机 D:/TRAE Work CN = TRAE SOLO CN v1.107.1,仅有 VS Code 家族 CLI(open/serve-web/扩展管理),无 codex 风格无头 agent-exec,builtin-mcp 为 MCP 客户端扩展。无可编程无头驱动接口 → unsupported(详见 docs/adapter-matrix.md §T1)。若 Trae 未来提供 headless agent CLI 可重评",
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
export const BUILTIN_PROFILE_IDS = Object.keys(BUILTIN_PROFILES);
|
|
51
|
+
//# sourceMappingURL=builtin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin.js","sourceRoot":"","sources":["../../src/agents/builtin.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,gBAAgB,GAAiC;IAC5D,KAAK,EAAE;QACL,WAAW,EAAE,wBAAwB;QACrC,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,uBAAuB,EAAE,WAAW,EAAE,iBAAiB,CAAC;QAC/F,UAAU,EAAE,KAAK;QACjB,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,EAAE;QACP,SAAS,EAAE,EAAE,GAAG,MAAM;QACtB,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,uEAAuE;QACjF,mBAAmB,EAAE;YACnB,IAAI,EAAE,CAAC,iCAAiC,EAAE,8CAA8C,EAAE,oDAAoD,CAAC;YAC/I,SAAS,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC;YACjC,eAAe,EAAE,OAAO;SACzB;QACD,IAAI,EAAE,uEAAuE;KAC9E;IACD,KAAK,EAAE;QACL,WAAW,EAAE,kBAAkB;QAC/B,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,aAAa;QACrB,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE,KAAK;QACjB,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,EAAE;QACP,SAAS,EAAE,EAAE,GAAG,MAAM;QACtB,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,gBAAgB;QAC1B,IAAI,EAAE,4LAA4L;KACnM;IACD,QAAQ,EAAE;QACR,WAAW,EAAE,yBAAyB;QACtC,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,aAAa;QACrB,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE,KAAK;QACjB,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,EAAE;QACP,SAAS,EAAE,EAAE,GAAG,MAAM;QACtB,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,gPAAgP;KACvP;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AgentAdapter, AgentRunResult, ResolvedAgent, SpawnInvocation, TaskContext } from "./adapter.js";
|
|
2
|
+
import type { SpawnResult } from "./spawn.js";
|
|
3
|
+
export declare const PROMPT_ARG = "<prompt:arg>";
|
|
4
|
+
export declare const PROMPT_STDIN = "<prompt:stdin>";
|
|
5
|
+
export declare const PROMPT_FILE = "<prompt:file>";
|
|
6
|
+
export declare class CliAdapter implements AgentAdapter {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
constructor(id: string);
|
|
9
|
+
buildInvocation(ctx: TaskContext, resolved: ResolvedAgent): SpawnInvocation;
|
|
10
|
+
/** file 模式下写 prompt 文件(幂等,可重复调用) */
|
|
11
|
+
prepare(ctx: TaskContext, resolved: ResolvedAgent): Promise<void>;
|
|
12
|
+
private promptFilePath;
|
|
13
|
+
private homeDir;
|
|
14
|
+
parseExit(res: SpawnResult): AgentRunResult;
|
|
15
|
+
}
|