dsh-carryon 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ # Changelog
2
+
3
+ All notable changes to dsh-carryon. Versions follow [SemVer](https://semver.org/); while the version is 0.x, any
4
+ release may change behaviour or configuration. Each release supports exactly one dsh release, given by
5
+ `engines.dsh` in `package.json`.
6
+
7
+ ## 0.1.0 (2026-11-06)
8
+
9
+ First release. It supports dsh `0.2.2-alpha.3`.
10
+
11
+ - **CarryOn compaction backend.** `CarryOnCompactionEngine` replaces dsh's `compaction-basic` in the `headless`,
12
+ `tui`, `sdk` and `acp` profiles. Each compaction runs one CarryOn fold: the Tracker updates candidates, the
13
+ Compiler proposes carrier edits and an execution context, and the Validator checks them before commit. These are
14
+ TypeScript ports of carrycode's runtime roles. The port is checked against carrycode's parity fixtures.
15
+ - **CarryOn mode in the Web UI.** In `web` and desktop profiles, a "CarryOn mode" agent preset is added next to
16
+ Standard mode and made the default for new sessions.
17
+ - **State.** Fold state is stored in each `compaction/summary` event's `rawOutput` (state format v1) and restored on
18
+ resume by a session projection.
19
+ - **Failure handling.**
20
+ - A rejected fold changes nothing.
21
+ - Rescans then back off as in the paper: 6,000 new tokens, doubling after each failure, at most 6 doublings.
22
+ - At 95% of the context window or above, a failed fold falls back to dsh's own summary.
23
+ - **Display metadata.** The plugin has a title, a description and an icon in dsh's Plugins page and in plugin
24
+ indexes.
25
+
26
+ Known limitations:
27
+ - **No measurements yet.** Not benchmarked, so there are no token or quality numbers. See the README for what has
28
+ been run.
29
+ - **No Grounder.** Folds do not run carrycode's Grounder checks.
30
+ - **Extra cost per fold.** A fold costs one Tracker call and, when the Tracker asks for compilation, one Compiler
31
+ call. Each call is retried once on invalid JSON. dsh's basic backend makes a single summary call instead.
32
+ - **Startup warning.** Profiles without agent presets print one harmless warning at startup:
33
+ `patch: entry "agent-preset-registry" not found`.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,151 @@
1
- # Temporary Holding Version
1
+ <h1 align="center">dsh-carryon</h1>
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <p align="center">
4
+ <strong>CarryOn context folding for DeepSeek Harness: long agent sessions keep what they established, not the whole transcript.</strong>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://ethannju.github.io/carryon/"><img src="https://img.shields.io/badge/Project-Page-2d6bb1?style=flat-square" alt="Project Page"></a>
9
+ <a href="https://arxiv.org/abs/2610.18784"><img src="https://img.shields.io/badge/arXiv-2610.18784-B31B1B?style=flat-square&amp;logo=arxiv&amp;logoColor=white" alt="arXiv 2610.18784"></a>
10
+ <a href="https://huggingface.co/papers/2610.18784"><img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fhuggingface.co%2Fapi%2Fpapers%2F2610.18784&amp;query=%24.upvotes&amp;label=Hugging%20Face&amp;prefix=%E2%96%B2%20&amp;suffix=%20upvotes&amp;color=ffd21e&amp;logo=huggingface&amp;style=flat-square" alt="Hugging Face Paper upvotes"></a>
11
+ <a href="https://github.com/xuan-tu-ai/dsh-carryon/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/xuan-tu-ai/dsh-carryon/ci.yml?branch=main&amp;style=flat-square&amp;logo=githubactions&amp;logoColor=white&amp;label=CI" alt="CI"></a>
12
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache--2.0-blue?style=flat-square" alt="License Apache-2.0"></a>
13
+ <a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/dsh-0.2.2--alpha.3-4D6BFE?style=flat-square" alt="dsh 0.2.2-alpha.3"></a>
14
+ <img src="https://img.shields.io/badge/Node.js-%E2%89%A522-339933?style=flat-square&amp;logo=nodedotjs&amp;logoColor=white" alt="Node.js 22 or later">
15
+ </p>
16
+
17
+ <p align="center">
18
+ <strong>English</strong> · <a href="README.zh-CN.md">简体中文</a>
19
+ </p>
20
+
21
+ When a [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) session grows long, dsh compacts it
22
+ by summarizing old turns into free text. dsh-carryon replaces that step with **CarryOn** from
23
+ [*Pack Light, CarryOn*](https://arxiv.org/abs/2610.18784). Old turns are folded into small, versioned records of
24
+ what the agent has established ("carriers") and an execution context: the task, open obligations and the next step.
25
+ Each fold is validated before it is committed, and a rejected fold changes nothing.
26
+
27
+ https://github.com/user-attachments/assets/5f4a6889-5cf6-41a4-aff1-327a9d5d6b7b
28
+
29
+ <p align="center"><sub>CarryOn demo by the paper's authors. Also on the <a href="https://ethannju.github.io/carryon/">project page</a>.</sub></p>
30
+
31
+ <p align="center"><img src="https://raw.githubusercontent.com/Ethannju/carryon/2d5c8db78e136a74d6e1cccfdf984607b565ee6e/docs/assets/overview.png" alt="Overview of CarryOn" width="860"></p>
32
+ <p align="center"><sub>The CarryOn runtime, from the paper. In dsh-carryon, dsh decides when to fold and keeps the recent turns; the Grounder is not ported yet (<a href="docs/how-it-works.md">details</a>).</sub></p>
33
+
34
+ [Configuration](docs/configuration.md) · [How it works](docs/how-it-works.md) · [Development](docs/development.md) · [Benchmark](bench/README.md) · [Releasing](docs/release.md) · [Changelog](CHANGELOG.md)
35
+
36
+ ## Highlights
37
+
38
+ - **Drop-in backend.** dsh-carryon replaces dsh's compaction in the terminal, headless, SDK and ACP profiles. dsh
39
+ keeps its trigger, its verbatim tail and its safety checks, and `/compact` works as before.
40
+ - **CarryOn mode in the Web UI.** The plugin adds a mode next to Standard mode, so you can compare both in the same
41
+ app.
42
+ - **Validated folds.** A fold that fails validation leaves the session untouched. Rescans then back off as in the
43
+ paper. Close to the context limit, a failed fold falls back to dsh's own summary, so the session can go on.
44
+ - **Resumable.** Fold state is stored as readable JSON in the session log and restored on resume.
45
+ - **Ported, not reinvented.** The runtime is a TypeScript port of [carrycode](https://github.com/xuan-tu-ai/carrycode),
46
+ checked case by case against its parity fixtures.
47
+
48
+ ## How it works
49
+
50
+ ```mermaid
51
+ flowchart LR
52
+ A["Session reaches<br/>dsh's compaction threshold"] --> B["Tracker<br/>updates candidates"]
53
+ B -->|compile request| C["Compiler<br/>carrier edits +<br/>execution context"]
54
+ B -->|nothing to compile| R
55
+ C --> D{"Validator"}
56
+ D -->|valid| E["Commit: checkpoint<br/>replaces old turns"]
57
+ D -->|invalid| R["Rejected: session unchanged,<br/>next scan backs off"]
58
+ R -.->|context near the limit| F["Fallback:<br/>dsh's summary"]
59
+ ```
60
+
61
+ The checkpoint holds every carrier and the execution context. dsh keeps the most recent turns verbatim after it.
62
+ A fold costs one Tracker call, plus one Compiler call when the Tracker asks for compilation; dsh's own compaction
63
+ makes one summary call. The engine, the state format and how this port differs from the paper are described in
64
+ [How it works](docs/how-it-works.md).
65
+
66
+ ## Results reported in the paper
67
+
68
+ These results come from the paper (Lu, McAuley, Zhang, 2026), with Claude Opus 4.7 as the agent. dsh-carryon has not
69
+ been benchmarked against them.
70
+
71
+ <p align="center"><img src="https://raw.githubusercontent.com/Ethannju/carryon/2d5c8db78e136a74d6e1cccfdf984607b565ee6e/docs/assets/osworld-results.png" alt="Task performance on OSWorld 2.0" width="760"></p>
72
+ <p align="center"><sub>OSWorld 2.0. CarryOn improves both binary and partial scores of the same Claude Opus 4.7 agent
73
+ while cutting cost per task by 35.9%. Figure from the paper's authors.</sub></p>
74
+
75
+ <p align="center"><img src="https://raw.githubusercontent.com/Ethannju/carryon/2d5c8db78e136a74d6e1cccfdf984607b565ee6e/docs/assets/context-and-cost.png" alt="Context and cost over agent turns on OSWorld 2.0" width="760"></p>
76
+ <p align="center"><sub>Context and cost over agent turns on OSWorld 2.0. The baseline's input context keeps growing past
77
+ 200K tokens, while CarryOn's stays near 65K. Figure from the paper's authors.</sub></p>
78
+
79
+ On BrowseComp-Plus, the paper reports accuracy rising from 49.0% to 56.0% with 22.9% fewer tokens per task.
80
+
81
+ ## Quick start
82
+
83
+ You need [dsh](https://github.com/deepseek-ai/deepseek-harness) **0.2.2-alpha.3** (each dsh-carryon release supports
84
+ exactly one dsh release), Node.js 22 or later, and pnpm.
85
+
86
+ Install the plugin into the profile you use. For the terminal UI:
87
+
88
+ ```bash
89
+ npx @deepseek-ai/dsh@0.2.2-alpha.3 plugin --profile tui add dsh-carryon
90
+ ```
91
+
92
+ For the Web UI:
93
+
94
+ ```bash
95
+ npx @deepseek-ai/dsh@0.2.2-alpha.3 plugin --profile web add dsh-carryon
96
+ ```
97
+
98
+ Restart dsh. In the terminal UI, every compaction is now a CarryOn fold. In the Web UI, new sessions start in
99
+ **CarryOn mode**, which you can switch from the mode menu next to the chat box:
100
+
101
+ <p align="center">
102
+ <img src="docs/images/web-carryon-mode-menu.png" alt="CarryOn mode in the dsh Web UI mode menu" width="720">
103
+ </p>
104
+
105
+ The plugin is listed under **Plugins → Installed plugins**. A fold's checkpoint appears where dsh shows a compaction
106
+ summary, and its full state is under Trajectory → Raw Output. To remove the plugin:
107
+
108
+ ```bash
109
+ npx @deepseek-ai/dsh@0.2.2-alpha.3 plugin --profile tui remove dsh-carryon
110
+ ```
111
+
112
+ ## Configuration
113
+
114
+ The plugin's config row is `carryon-compaction`. It accepts dsh's own compaction keys (`thresholdRatio`,
115
+ `retainTokens`, …) and a few CarryOn keys. For example, put this in `$DSH_HOME/profiles/tui/cordis.patch.yml` to fold at
116
+ half of the context window and run the CarryOn roles on the cheaper `deepseek-flash`:
117
+
118
+ ```yaml
119
+ - id: carryon-compaction
120
+ config:
121
+ thresholdRatio: 0.5
122
+ runtimeProvider: deepseek-official
123
+ runtimeModel: deepseek-flash
124
+ ```
125
+
126
+ dsh replaces a row's whole `config` with the patched one, so list all your keys together. See
127
+ [Configuration](docs/configuration.md) for every key, the defaults, and the Web UI's limits.
128
+
129
+ ## Citation
130
+
131
+ dsh-carryon implements the method of this paper. If you use it in research, please cite the paper:
132
+
133
+ ```bibtex
134
+ @misc{lu2026carryon,
135
+ title = {Pack Light, CarryOn: Building Object-Oriented Context for Long-Horizon Agents},
136
+ author = {Lu, Yuchen and McAuley, Julian and Zhang, Lei},
137
+ year = {2026},
138
+ eprint = {2610.18784},
139
+ archivePrefix = {arXiv},
140
+ primaryClass = {cs.AI},
141
+ url = {https://arxiv.org/abs/2610.18784}
142
+ }
143
+ ```
144
+
145
+ carrycode and dsh-carryon are independent reimplementations built from the paper. They are not affiliated with the
146
+ paper's authors or with DeepSeek.
147
+
148
+ ## License
149
+
150
+ dsh-carryon's code is [Apache-2.0](LICENSE). The demo video and the figures shown above belong to the paper's authors,
151
+ who gave permission to show them here; they are not covered by that license.
@@ -0,0 +1,131 @@
1
+ <h1 align="center">dsh-carryon</h1>
2
+
3
+ <p align="center">
4
+ <strong>为 DeepSeek Harness 提供 CarryOn 上下文折叠:长会话保留已确立的进展,而不是整段历史。</strong>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://ethannju.github.io/carryon/"><img src="https://img.shields.io/badge/Project-Page-2d6bb1?style=flat-square" alt="Project Page"></a>
9
+ <a href="https://arxiv.org/abs/2610.18784"><img src="https://img.shields.io/badge/arXiv-2610.18784-B31B1B?style=flat-square&amp;logo=arxiv&amp;logoColor=white" alt="arXiv 2610.18784"></a>
10
+ <a href="https://huggingface.co/papers/2610.18784"><img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fhuggingface.co%2Fapi%2Fpapers%2F2610.18784&amp;query=%24.upvotes&amp;label=Hugging%20Face&amp;prefix=%E2%96%B2%20&amp;suffix=%20upvotes&amp;color=ffd21e&amp;logo=huggingface&amp;style=flat-square" alt="Hugging Face Paper upvotes"></a>
11
+ <a href="https://github.com/xuan-tu-ai/dsh-carryon/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/xuan-tu-ai/dsh-carryon/ci.yml?branch=main&amp;style=flat-square&amp;logo=githubactions&amp;logoColor=white&amp;label=CI" alt="CI"></a>
12
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache--2.0-blue?style=flat-square" alt="License Apache-2.0"></a>
13
+ <a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/dsh-0.2.2--alpha.3-4D6BFE?style=flat-square" alt="dsh 0.2.2-alpha.3"></a>
14
+ <img src="https://img.shields.io/badge/Node.js-%E2%89%A522-339933?style=flat-square&amp;logo=nodedotjs&amp;logoColor=white" alt="Node.js 22 或更高版本">
15
+ </p>
16
+
17
+ <p align="center">
18
+ <a href="README.md">English</a> · <strong>简体中文</strong>
19
+ </p>
20
+
21
+ [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(dsh)的会话变长时,dsh 会把较早的轮次总结成一段自由文本来压缩上下文。dsh-carryon 用论文 [*Pack Light, CarryOn*](https://arxiv.org/abs/2610.18784) 中的 **CarryOn** 替换这一步:较早的轮次被折叠(fold)成两部分。一部分是记录智能体已确立内容的小型、带版本的记录,称为“载体”(carrier)。另一部分是执行上下文,包含任务、未完成的义务和下一步。每次折叠在提交前都会经过校验,被拒绝的折叠不会改变任何东西。
22
+
23
+ https://github.com/user-attachments/assets/5f4a6889-5cf6-41a4-aff1-327a9d5d6b7b
24
+
25
+ <p align="center"><sub>论文作者制作的 CarryOn 演示视频,也可在<a href="https://ethannju.github.io/carryon/">项目主页</a>观看。</sub></p>
26
+
27
+ <p align="center"><img src="https://raw.githubusercontent.com/Ethannju/carryon/2d5c8db78e136a74d6e1cccfdf984607b565ee6e/docs/assets/overview.png" alt="Overview of CarryOn" width="860"></p>
28
+ <p align="center"><sub>论文中的 CarryOn 运行时示意图。在 dsh-carryon 中,何时折叠以及保留哪些最近轮次由 dsh 决定;Grounder 尚未移植(<a href="docs/how-it-works.md">详情</a>,英文)。</sub></p>
29
+
30
+ [配置](docs/configuration.md) · [工作原理](docs/how-it-works.md) · [开发](docs/development.md) · [基准测试](bench/README.md) · [发布](docs/release.md) · [更新日志](CHANGELOG.md)
31
+
32
+ 以上文档为英文。
33
+
34
+ ## 特性
35
+
36
+ - **直接替换。** 在终端、headless、SDK 和 ACP 配置中,dsh-carryon 替换 dsh 的压缩后端。触发条件、原样保留的尾部和安全检查仍由 dsh 负责,`/compact` 照常可用。
37
+ - **Web UI 中的 CarryOn mode。** 插件在 Standard mode 旁边新增一个模式,可以在同一个应用里对比两者。
38
+ - **折叠经过校验。** 未通过校验的折叠不会改动会话,之后的扫描按论文的方式退避。接近上下文上限时,失败的折叠会退回到 dsh 自己的总结,会话得以继续。
39
+ - **可恢复。** 折叠状态以可读的 JSON 保存在会话日志中,恢复会话时会重建。
40
+ - **移植而非重写。** 运行时是 [carrycode](https://github.com/xuan-tu-ai/carrycode) 的 TypeScript 移植,逐条对照其一致性测试用例(parity fixtures)检查。
41
+
42
+ ## 工作原理
43
+
44
+ ```mermaid
45
+ flowchart LR
46
+ A["会话达到<br/>dsh 的压缩阈值"] --> B["Tracker<br/>更新候选"]
47
+ B -->|请求编译| C["Compiler<br/>载体修改 +<br/>执行上下文"]
48
+ B -->|无需编译| R
49
+ C --> D{"Validator"}
50
+ D -->|通过| E["提交:检查点<br/>替换旧轮次"]
51
+ D -->|不通过| R["拒绝:会话不变,<br/>下次扫描退避"]
52
+ R -.->|上下文接近上限| F["退回:<br/>dsh 的总结"]
53
+ ```
54
+
55
+ 检查点包含所有载体和执行上下文,dsh 会在它之后原样保留最近的轮次。每次折叠调用一次 Tracker;Tracker 请求编译时,再调用一次 Compiler。dsh 自带的压缩只调用一次总结。引擎、状态格式以及本移植与论文的差异,见[工作原理](docs/how-it-works.md)。
56
+
57
+ ## 论文报告的结果
58
+
59
+ 以下结果来自论文(Lu、McAuley、Zhang,2026),智能体使用 Claude Opus 4.7。dsh-carryon 尚未对照这些结果做过基准测试。
60
+
61
+ <p align="center"><img src="https://raw.githubusercontent.com/Ethannju/carryon/2d5c8db78e136a74d6e1cccfdf984607b565ee6e/docs/assets/osworld-results.png" alt="OSWorld 2.0 上的任务表现" width="760"></p>
62
+ <p align="center"><sub>OSWorld 2.0。CarryOn 提高了同一个 Claude Opus 4.7 智能体的二值得分和部分得分,同时把每个任务的成本降低 35.9%。图片来自论文作者。</sub></p>
63
+
64
+ <p align="center"><img src="https://raw.githubusercontent.com/Ethannju/carryon/2d5c8db78e136a74d6e1cccfdf984607b565ee6e/docs/assets/context-and-cost.png" alt="OSWorld 2.0 上上下文与成本随轮次的变化" width="760"></p>
65
+ <p align="center"><sub>OSWorld 2.0 上上下文与成本随智能体轮次的变化。基线的输入上下文持续增长到 200K token 以上,而 CarryOn 稳定在约 65K。图片来自论文作者。</sub></p>
66
+
67
+ 在 BrowseComp-Plus 上,论文报告准确率从 49.0% 提升到 56.0%,每个任务的 token 减少 22.9%。
68
+
69
+ ## 快速开始
70
+
71
+ 需要 [dsh](https://github.com/deepseek-ai/deepseek-harness) **0.2.2-alpha.3**(每个 dsh-carryon 版本只支持一个 dsh 版本)、Node.js 22 或更高版本,以及 pnpm。
72
+
73
+ 把插件安装到你使用的配置(profile)中。终端界面:
74
+
75
+ ```bash
76
+ npx @deepseek-ai/dsh@0.2.2-alpha.3 plugin --profile tui add dsh-carryon
77
+ ```
78
+
79
+ Web UI:
80
+
81
+ ```bash
82
+ npx @deepseek-ai/dsh@0.2.2-alpha.3 plugin --profile web add dsh-carryon
83
+ ```
84
+
85
+ 重启 dsh。在终端界面中,每次压缩都会变成一次 CarryOn 折叠。在 Web UI 中,新会话默认使用 **CarryOn mode**,可以在输入框旁的模式菜单中切换:
86
+
87
+ <p align="center">
88
+ <img src="docs/images/web-carryon-mode-menu.png" alt="dsh Web UI 模式菜单中的 CarryOn mode" width="720">
89
+ </p>
90
+
91
+ 插件会出现在 **Plugins → Installed plugins** 中。折叠的检查点显示在 dsh 显示压缩总结的位置,完整状态在 Trajectory → Raw Output 中。卸载插件:
92
+
93
+ ```bash
94
+ npx @deepseek-ai/dsh@0.2.2-alpha.3 plugin --profile tui remove dsh-carryon
95
+ ```
96
+
97
+ ## 配置
98
+
99
+ 插件的配置行是 `carryon-compaction`。它接受 dsh 自带压缩的键(`thresholdRatio`、`retainTokens` 等),以及少量 CarryOn 专用的键。例如,下面的配置写入 `$DSH_HOME/profiles/tui/cordis.patch.yml` 后,会在上下文窗口用到一半时折叠,并让 CarryOn 的角色调用使用更便宜的 `deepseek-flash`:
100
+
101
+ ```yaml
102
+ - id: carryon-compaction
103
+ config:
104
+ thresholdRatio: 0.5
105
+ runtimeProvider: deepseek-official
106
+ runtimeModel: deepseek-flash
107
+ ```
108
+
109
+ dsh 会用补丁中的 `config` 整体替换该行的配置,所以请把所有要改的键写在一起。全部键、默认值以及 Web UI 中的限制见[配置](docs/configuration.md)。
110
+
111
+ ## 引用
112
+
113
+ dsh-carryon 实现的是这篇论文的方法。如果你在研究中使用它,请引用该论文:
114
+
115
+ ```bibtex
116
+ @misc{lu2026carryon,
117
+ title = {Pack Light, CarryOn: Building Object-Oriented Context for Long-Horizon Agents},
118
+ author = {Lu, Yuchen and McAuley, Julian and Zhang, Lei},
119
+ year = {2026},
120
+ eprint = {2610.18784},
121
+ archivePrefix = {arXiv},
122
+ primaryClass = {cs.AI},
123
+ url = {https://arxiv.org/abs/2610.18784}
124
+ }
125
+ ```
126
+
127
+ carrycode 和 dsh-carryon 是仅依据论文完成的独立实现,与论文作者及 DeepSeek 均无关联。
128
+
129
+ ## 许可证
130
+
131
+ dsh-carryon 的代码采用 [Apache-2.0](LICENSE)。上文的演示视频和图片属于论文作者,经作者许可在此展示,不在该许可证范围内。
@@ -0,0 +1,18 @@
1
+ # dsh-carryon bundle layer: run CarryOnCompactionEngine as `ctx.compaction`.
2
+ #
3
+ # Profiles without agent presets (headless, tui, sdk, acp) mount compaction at the root as row
4
+ # `compaction-basic`. A patch row cannot re-point an existing row to another plugin (its `name` must match), so
5
+ # we disable that row and insert our own. CarryOnCompactionEngine extends BasicCompactionEngine and takes the
6
+ # same config keys (thresholdRatio, retainTokens, ...); config written for `compaction-basic` must move to
7
+ # `carryon-compaction`.
8
+ #
9
+ # Profiles built on dsh-web-app (web, desktop) mount compaction inside each agent preset instead and disable
10
+ # the root row. There the root carryon row stays disabled (a root engine would also hear preset agents) and
11
+ # web-preset.patch.yml adds "CarryOn mode", which is made the default preset below.
12
+ - id: compaction-basic
13
+ disabled: true
14
+
15
+ - insert:
16
+ - id: carryon-compaction
17
+ name: dsh-carryon
18
+ disabled: !!js "ctx.get('profileContext')?.startedBundles?.includes('@deepseek-ai/dsh-web-app') === true"
package/icon.svg ADDED
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="CarryOn compaction">
2
+ <rect width="64" height="64" rx="14" fill="#1f4e79"/>
3
+ <rect x="14" y="14" width="36" height="7" rx="3.5" fill="#9fc5e8"/>
4
+ <rect x="14" y="26" width="36" height="7" rx="3.5" fill="#cfe2f3"/>
5
+ <rect x="14" y="38" width="22" height="7" rx="3.5" fill="#ffffff"/>
6
+ <path d="M42 36 l8 5.5 l-8 5.5 z" fill="#ffd966"/>
7
+ </svg>