@michengai/dsh-im-connect 0.1.25 → 0.1.27

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 (54) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/CHANGELOG.zh-CN.md +14 -0
  3. package/LICENSE +201 -201
  4. package/README.en.md +0 -1
  5. package/README.md +0 -1
  6. package/lib/engine/approval.d.ts +4 -1
  7. package/lib/engine/approval.d.ts.map +1 -1
  8. package/lib/engine/approval.js +38 -11
  9. package/lib/engine/approval.js.map +1 -1
  10. package/lib/engine/gateway.d.ts +27 -0
  11. package/lib/engine/gateway.d.ts.map +1 -1
  12. package/lib/engine/gateway.js +388 -13
  13. package/lib/engine/gateway.js.map +1 -1
  14. package/lib/engine/question.d.ts +56 -0
  15. package/lib/engine/question.d.ts.map +1 -0
  16. package/lib/engine/question.js +196 -0
  17. package/lib/engine/question.js.map +1 -0
  18. package/lib/index.d.ts.map +1 -1
  19. package/lib/index.js +9 -1
  20. package/lib/index.js.map +1 -1
  21. package/package.json +82 -82
  22. package/src/channels/dingtalk-card.ts +192 -192
  23. package/src/channels/dingtalk.ts +139 -139
  24. package/src/channels/feishu.ts +63 -63
  25. package/src/channels/meta.ts +2 -2
  26. package/src/channels/qq.ts +289 -289
  27. package/src/channels/qr/dingtalk.ts +1 -1
  28. package/src/channels/qr/feishu.ts +1 -1
  29. package/src/channels/qr/render.ts +1 -1
  30. package/src/channels/qr/shared.ts +2 -2
  31. package/src/channels/qr/wecom.ts +1 -1
  32. package/src/channels/qr/weixin.ts +1 -1
  33. package/src/channels/telegram.ts +154 -154
  34. package/src/channels/wecom.ts +171 -171
  35. package/src/channels/weixin.ts +709 -709
  36. package/src/engine/access.ts +34 -34
  37. package/src/engine/agent-options.ts +1 -1
  38. package/src/engine/approval.ts +41 -14
  39. package/src/engine/assistant-settings.ts +1 -1
  40. package/src/engine/credentials.ts +2 -2
  41. package/src/engine/gateway.ts +771 -365
  42. package/src/engine/json-state.ts +9 -9
  43. package/src/engine/merge.ts +1 -1
  44. package/src/engine/question.ts +228 -0
  45. package/src/engine/quiet-logger.ts +1 -1
  46. package/src/engine/router.ts +22 -22
  47. package/src/engine/secure-file.ts +5 -5
  48. package/src/engine/seen-store.ts +34 -34
  49. package/src/engine/session-id.ts +2 -2
  50. package/src/engine/session-store.ts +33 -33
  51. package/src/engine/split.ts +1 -1
  52. package/src/index.ts +9 -2
  53. package/src/manager.ts +798 -798
  54. package/src/optional-modules.d.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@
4
4
 
5
5
  The five most recent published versions are listed below. Git tags and GitHub Releases now mirror these entries; historical sections retain links to their original release commits.
6
6
 
7
+ ## 0.1.27 — 2026-08-31
8
+
9
+ - Routed DSH tool approvals and structured user questions through the originating IM conversation, with text replies for approvals, single-choice, multiple-choice, and custom answers.
10
+ - Kept current and legacy DSH interaction contracts compatible while serializing same-session prompts and restricting group replies to the initiating user.
11
+ - Hardened prompt delivery and cancellation so partial sends, failed deliveries, aborts, session resets, and plugin disposal cannot leave an active stale interaction.
12
+
13
+ Published package: [`@michengai/dsh-im-connect@0.1.27`](https://www.npmjs.com/package/@michengai/dsh-im-connect/v/0.1.27).
14
+
15
+ ## 0.1.26 — 2026-08-28
16
+
17
+ - Enabled npm Trusted Publishing through the repository's GitHub Actions release workflow.
18
+
19
+ Published package: [`@michengai/dsh-im-connect@0.1.26`](https://www.npmjs.com/package/@michengai/dsh-im-connect/v/0.1.26).
20
+
7
21
  ## 0.1.25 — 2026-08-27
8
22
 
9
23
  - Fixed the sidebar wrapper so the official workspace tree keeps its Host translator, only one Channels tab renders, and registry labels follow live locale changes without leaking subscriptions.
@@ -4,6 +4,20 @@
4
4
 
5
5
  以下记录最近发布的五个版本。Git 标签与 GitHub Release 现已和这些条目同步;历史条目继续保留原始发布提交链接。
6
6
 
7
+ ## 0.1.27 — 2026-08-31
8
+
9
+ - 将 DSH 工具审批和结构化用户问题路由到发起任务的 IM 会话,通过文字回复完成审批、单选、多选和自定义回答。
10
+ - 同时兼容 DSH 当前及旧版交互契约;同一会话的提示按顺序处理,群聊只允许发起用户作答。
11
+ - 加强提示发送与取消处理,避免分片发送、投递失败、任务中止、会话重置或插件卸载后留下仍可响应的过期交互。
12
+
13
+ 发布包:[`@michengai/dsh-im-connect@0.1.27`](https://www.npmjs.com/package/@michengai/dsh-im-connect/v/0.1.27)。
14
+
15
+ ## 0.1.26 — 2026-08-28
16
+
17
+ - 启用仓库 GitHub Actions 发布工作流的 npm Trusted Publishing。
18
+
19
+ 发布包:[`@michengai/dsh-im-connect@0.1.26`](https://www.npmjs.com/package/@michengai/dsh-im-connect/v/0.1.26)。
20
+
7
21
  ## 0.1.25 — 2026-08-27
8
22
 
9
23
  - 修复侧栏包装逻辑:官方工作区树继续使用宿主翻译器,频道页签只显示一个,注册表标签随语言实时刷新且不会残留订阅。
package/LICENSE CHANGED
@@ -1,201 +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.
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 CHANGED
@@ -106,7 +106,6 @@ This product can be installed independently or used through the desktop app or W
106
106
  | --- | --- |
107
107
  | [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) | The host runtime that provides models, sessions, tools, and the plugin system |
108
108
  | [DSH Codex Desktop](https://github.com/MichengAI/dsh-codex-desktop) | A ready-to-install desktop product with this product and the other five feature products built in |
109
- | [DSH Codex Suite](https://github.com/MichengAI/dsh-codex-ui/tree/main/packages/dsh-codex-suite) | A one-click suite for existing DSH Web environments that installs this product and the other five feature products |
110
109
  | Six feature products | [Codex UI](https://github.com/MichengAI/dsh-codex-ui) · [IM Connect](https://github.com/MichengAI/dsh-im-connect) · [Automation](https://github.com/MichengAI/dsh-automation) · [Skills Manager](https://github.com/MichengAI/dsh-skills-manager) · [Archive Manager](https://github.com/MichengAI/dsh-archive-manager) · [Agency Agents](https://github.com/MichengAI/dsh-agency-agents) |
111
110
 
112
111
  ## Prerequisites
package/README.md CHANGED
@@ -106,7 +106,6 @@
106
106
  | --- | --- |
107
107
  | [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) | 本产品的运行宿主,提供模型、会话、工具和插件系统 |
108
108
  | [DSH Codex Desktop](https://github.com/MichengAI/dsh-codex-desktop) | 下载安装即用的桌面产品,已内置本产品和其他 5 个功能产品 |
109
- | [DSH Codex Suite](https://github.com/MichengAI/dsh-codex-ui/tree/main/packages/dsh-codex-suite) | 面向已有 DSH Web 环境的一键套件,会安装本产品和其他 5 个功能产品 |
110
109
  | 6 个功能产品 | [Codex UI](https://github.com/MichengAI/dsh-codex-ui) · [IM Connect](https://github.com/MichengAI/dsh-im-connect) · [Automation](https://github.com/MichengAI/dsh-automation) · [Skills Manager](https://github.com/MichengAI/dsh-skills-manager) · [Archive Manager](https://github.com/MichengAI/dsh-archive-manager) · [Agency Agents](https://github.com/MichengAI/dsh-agency-agents) |
111
110
 
112
111
  ## 前置条件
@@ -2,9 +2,12 @@ export type ApprovalVerdict = 'allow' | 'reject' | undefined;
2
2
  export declare class ApprovalBroker {
3
3
  private readonly pending;
4
4
  get size(): number;
5
- wait(key: string, timeoutMs: number): Promise<ApprovalVerdict>;
5
+ wait(key: string, timeoutMs?: number, signal?: AbortSignal): Promise<ApprovalVerdict> | undefined;
6
6
  has(key: string): boolean;
7
+ activate(key: string): boolean;
8
+ isReady(key: string): boolean;
7
9
  answer(key: string, allow: boolean): boolean;
10
+ cancel(key: string): boolean;
8
11
  dispose(): void;
9
12
  }
10
13
  //# sourceMappingURL=approval.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../src/engine/approval.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAA;AAO5D,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IAErD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAgB9D,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO;IAO5C,OAAO,IAAI,IAAI;CAOhB"}
1
+ {"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../src/engine/approval.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAA;AAU5D,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IAErD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS;IA0BjG,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAO9B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI7B,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO;IAO5C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAO5B,OAAO,IAAI,IAAI;CAGhB"}
@@ -3,39 +3,66 @@ export class ApprovalBroker {
3
3
  get size() {
4
4
  return this.pending.size;
5
5
  }
6
- wait(key, timeoutMs) {
6
+ wait(key, timeoutMs, signal) {
7
7
  if (this.pending.has(key))
8
+ return undefined;
9
+ if (signal?.aborted)
8
10
  return Promise.resolve(undefined);
9
11
  return new Promise((resolve) => {
10
12
  const settle = (value) => {
11
13
  const entry = this.pending.get(key);
12
14
  if (!entry)
13
15
  return;
14
- clearTimeout(entry.timer);
16
+ if (entry.timer)
17
+ clearTimeout(entry.timer);
18
+ if (entry.signal && entry.onAbort)
19
+ entry.signal.removeEventListener('abort', entry.onAbort);
15
20
  this.pending.delete(key);
16
21
  resolve(value);
17
22
  };
18
- const timer = setTimeout(() => settle(undefined), timeoutMs);
19
- timer.unref?.();
20
- this.pending.set(key, { resolve: settle, timer });
23
+ const entry = { resolve: settle, accepting: false };
24
+ if (timeoutMs !== undefined && timeoutMs > 0) {
25
+ entry.timer = setTimeout(() => settle(undefined), timeoutMs);
26
+ entry.timer.unref?.();
27
+ }
28
+ if (signal) {
29
+ entry.signal = signal;
30
+ entry.onAbort = () => settle(undefined);
31
+ signal.addEventListener('abort', entry.onAbort, { once: true });
32
+ }
33
+ this.pending.set(key, entry);
21
34
  });
22
35
  }
23
36
  has(key) {
24
37
  return this.pending.has(key);
25
38
  }
26
- answer(key, allow) {
39
+ activate(key) {
27
40
  const entry = this.pending.get(key);
28
41
  if (!entry)
29
42
  return false;
43
+ entry.accepting = true;
44
+ return true;
45
+ }
46
+ isReady(key) {
47
+ return this.pending.get(key)?.accepting === true;
48
+ }
49
+ answer(key, allow) {
50
+ const entry = this.pending.get(key);
51
+ if (!entry || !entry.accepting)
52
+ return false;
30
53
  entry.resolve(allow ? 'allow' : 'reject');
31
54
  return true;
32
55
  }
56
+ cancel(key) {
57
+ const entry = this.pending.get(key);
58
+ if (!entry)
59
+ return false;
60
+ entry.resolve(undefined);
61
+ return true;
62
+ }
33
63
  dispose() {
34
- for (const [key, entry] of this.pending) {
35
- clearTimeout(entry.timer);
36
- entry.resolve(undefined);
37
- this.pending.delete(key);
38
- }
64
+ for (const key of [...this.pending.keys()])
65
+ this.cancel(key);
39
66
  }
40
67
  }
41
68
  //# sourceMappingURL=approval.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"approval.js","sourceRoot":"","sources":["../../src/engine/approval.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,cAAc;IACR,OAAO,GAAG,IAAI,GAAG,EAAmB,CAAA;IAErD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;IAC1B,CAAC;IAED,IAAI,CAAC,GAAW,EAAE,SAAiB;QACjC,IAAI,IAAI,C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AAG,CAAC,GAAG,CAAC,CAAA;QACnC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS;YAAE,OAAO,KAAK,CAAA;QAC5C,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;QACzC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,CAAC,GAAW;QAChB,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACnC,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAA;QACxB,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QACxB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO;QACL,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC9D,CAAC;CACF"}
@@ -12,11 +12,20 @@ export declare class ImEngine {
12
12
  private readonly channels;
13
13
  private readonly router;
14
14
  private readonly broker;
15
+ private readonly questions;
15
16
  private readonly merger;
16
17
  private readonly extraAllow;
18
+ private readonly sessionActors;
19
+ private readonly questionActors;
20
+ private readonly questionDeliveries;
21
+ private readonly questionPromptDelivered;
17
22
  private readonly queues;
23
+ private readonly interactionQueues;
18
24
  private readonly streams;
19
25
  private readonly disposeEvents;
26
+ private readonly wrappedUserQuestionServices;
27
+ private legacyServiceTimer?;
28
+ private disposed;
20
29
  constructor(ctx: Context, store: SessionMapStore, seen: SeenStore, config: EngineConfig, log: (line: string) => void, onUnauthorized?: ((channelId: string, msg: ImMessage) => string) | undefined);
21
30
  renameSession(sessionId: string, title: string): boolean;
22
31
  removeSession(sessionId: string): Promise<boolean>;
@@ -39,8 +48,26 @@ export declare class ImEngine {
39
48
  private inject;
40
49
  private answerApproval;
41
50
  private onApproval;
51
+ private onUserQuestions;
52
+ /**
53
+ * DSH 0.1.1-rc.2 exposes a mutable provider behind a stable service.ask.
54
+ * Decorate the service so later provider registrations remain visible through
55
+ * the original service implementation, while non-IM sessions keep its path.
56
+ */
57
+ private scheduleLegacyUserQuestionService;
58
+ private installLegacyUserQuestionService;
59
+ /**
60
+ * 同一会话的人机交互严格串行。队首只有在用户回复、AbortSignal 或会话销毁时释放;
61
+ * current approval 刻意不设插件超时,避免与 Host 持有的审批生命周期冲突。
62
+ */
63
+ private runInteraction;
64
+ private approvalPrompt;
42
65
  private onSessionEvent;
43
66
  /** 逐片发送;返回是否至少送达过一片,供调用方决定是否标记已投递。 */
44
67
  private deliver;
68
+ private deliverQuestionInteraction;
69
+ private announceInteractionCancelled;
70
+ /** 交互提示必须完整送达;任一分片失败或取消就不能继续在 IM 中收集决定。 */
71
+ private deliverInteraction;
45
72
  }
46
73
  //# sourceMappingURL=gateway.d.ts.map