@osborn001/zhiwei 0.0.0-stage → 0.2.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/README.md CHANGED
@@ -1,3 +1,140 @@
1
- # Temporary Holding Version
1
+ # 知微 CLI / MCP
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
+ 在其他 Agent 完成任务后,把明确选定、脱敏的工作摘要送到自己的知微。
4
+ 一个程序同时提供命令行与本地 stdio MCP;不会自动采集历史对话、源码或附件。
5
+
6
+ ## 安装与使用
7
+
8
+ npm 包名为 `@osborn001/zhiwei`,本文示例固定使用 `0.2.0`。
9
+ 安装公开 npm 包不需要注册 npm 账号;连接知微仍需每台电脑独立的连接器凭证。
10
+ 请核对完整包名与版本,不要安装名称相似的第三方包。
11
+
12
+ 需要 Node.js 20 或更新版本(建议使用受支持的 LTS)。
13
+ 支持 Windows、macOS、Linux,各提供 x64 / arm64 程序。
14
+ 当前 Windows x64 完成 npm 安装与 MCP 实际运行验收;其余平台完成交叉构建,尚待对应真机验收。
15
+
16
+ ```sh
17
+ npm install -g @osborn001/zhiwei@0.2.0
18
+ zhiwei version
19
+ ```
20
+
21
+ 也可以按需执行,无需全局安装或手选磁盘目录:
22
+
23
+ ```sh
24
+ npx --yes @osborn001/zhiwei@0.2.0 version
25
+ npx --yes @osborn001/zhiwei@0.2.0 mcp
26
+ ```
27
+
28
+ 包内带全部平台程序,安装时不编译、不额外从 GitHub 下载;首次 npm/npx 安装需要联网,
29
+ 后续本地程序运行不依赖 registry。安装无生命周期脚本、无运行依赖。
30
+ 程序启动时核对包内 SHA-256(用于发现损坏;来源真实性仍依赖可信 registry/发布者)。
31
+
32
+ ## 每台电脑独立配置
33
+
34
+ 推荐使用手机确认配对(需要支持电脑配对的知微服务端与 Android 0.3.8 或更新版本):
35
+
36
+ ```sh
37
+ zhiwei login
38
+ ```
39
+
40
+ 电脑显示短时配对码后,在手机“设置 → 连接的电脑”输入该码,核对名称、权限和有效期,再确认授权。
41
+ 只批准自己刚刚发起的请求。配对码十分钟后失效;电脑等待批准时每五秒查询一次,成功后自动保存独立凭证。
42
+ 同一电脑用户的 CLI 与 MCP 共用此配置,后续无需每次确认;到期或撤销后须重新授权。
43
+
44
+ ```sh
45
+ zhiwei auth status
46
+ zhiwei logout
47
+ ```
48
+
49
+ `auth status` 联网检查当前授权;`logout` 撤销服务器凭证并清理本地配置。手机也可单独撤销某台电脑,已提交资料保留。
50
+ 电脑凭证只可提交摘要、读取自身回执和管理自身授权;不能读取个人日记、照片、聊天或长期记忆。
51
+ 不要复制手机凭证,也不要把凭证放进 MCP 配置、聊天、命令参数或 Git。
52
+
53
+ 默认私有配置位置:Windows `%APPDATA%\zhiwei\config.json`;macOS
54
+ `~/Library/Application Support/zhiwei/config.json`;Linux `~/.config/zhiwei/config.json`。
55
+ 此路径是用户数据目录,与程序安装盘符无关。`ZHIWEI_HOME` 可指定独立目录。
56
+
57
+ 旧的管理员签发方式继续兼容。可以通过 stdin 导入管理员提供的 `{url,token}` JSON(仅创建新配置):
58
+
59
+ ```powershell
60
+ Get-Content -Raw -LiteralPath '你的私有配置文件.json' | zhiwei configure
61
+ ```
62
+
63
+ ```sh
64
+ zhiwei configure < /path/to/private-config.json
65
+ ```
66
+
67
+ 请用当前用户权限保护配置目录。它不是加密保险箱;卸载 npm 包不会删除配置与离线队列。
68
+
69
+ ## MCP 接入
70
+
71
+ 推荐先全局安装,再在 MCP 客户端配置下列内容;客户端进程必须能在 PATH 找到 `zhiwei`。
72
+ 安装 Node 或 CLI 后可能需要完全退出并重开客户端。
73
+
74
+ ```json
75
+ {
76
+ "mcpServers": {
77
+ "zhiwei": { "command": "zhiwei", "args": ["mcp"] }
78
+ }
79
+ }
80
+ ```
81
+
82
+ Codex CLI 注册命令:
83
+
84
+ ```sh
85
+ codex mcp add zhiwei -- zhiwei mcp
86
+ ```
87
+
88
+ 支持 npx 的客户端也可以使用 `command: "npx"`,
89
+ `args: ["--yes", "@osborn001/zhiwei@0.2.0", "mcp"]`。
90
+ Windows 上不能直接启动 `.cmd` 的宿主可使用:
91
+
92
+ ```json
93
+ {
94
+ "mcpServers": {
95
+ "zhiwei": {
96
+ "command": "cmd",
97
+ "args": ["/d", "/s", "/c", "npx --yes @osborn001/zhiwei@0.2.0 mcp"]
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ 配置中的命令是固定启动命令,不能拼入用户内容或令牌。重载连接后应看到
104
+ `submit_work_summary`、`get_work_receipt`、`sync_work_summaries` 三个工具。
105
+ 可对 Agent 说:“把这个任务整理成脱敏工作摘要,区分已完成和待处理,提交到知微。”
106
+ 接入本身不会添加自动上传规则。
107
+
108
+ ## 回执、补传与数据边界
109
+
110
+ 配置完成后,将明确选定的工作摘要保存为 `summary.json`,先校验再提交:
111
+
112
+ ```sh
113
+ zhiwei submit --file summary.json --dry-run
114
+ zhiwei submit --file summary.json
115
+ ```
116
+
117
+ `submit --dry-run` 只校验,不联网、不写队列。包内 `summary.example.json` 提供字段示例,
118
+ 使用前须将内容、标识和时间换成实际工作信息,不要直接上传示例。
119
+ `state: accepted` 表示已取得云端回执;`state: queued` 表示仅保存本机。
120
+ 用 `zhiwei queue` 查看待传 ID,用 `zhiwei sync` 显式重试,无后台常驻上传。
121
+ 队列按服务器与凭证隔离;更换凭证后不会自动迁移旧队列。
122
+
123
+ 同一提交重试保留 `submission_id` 和内容;新的进展使用新的 ID。
124
+ 同 ID 不同内容返回 409。401 表示凭证失效,429 表示配额限制。
125
+ 单份 JSON ≤32 KiB、正文≤4000字,每凭证滚动24小时最多120份。
126
+
127
+ 摘要进入知微的独立工作资料和日记展示段落,可在手机查询,保留 Agent 来源。
128
+ 提交不调用模型,不自动提取长期偏好。只发送允许带出且已脱敏的工作概述。
129
+ 生产服务器只处理既有 HTTPS 请求,不需要为 npm 或 MCP 额外安装服务。
130
+
131
+ ## 更新和卸载
132
+
133
+ 更新时安装已核验的明确版本;若 MCP 用 npx 固定版本,也要修改其版本号。
134
+ 运行 `npm uninstall -g @osborn001/zhiwei` 卸载程序。凭证应另行撤销;卸载程序
135
+ 不等于撤销权限,也不会清空未传队列。升级与便携版共用同一配置和队列。
136
+
137
+ ## 许可
138
+
139
+ 本包标记为 `UNLICENSED`,公开分发不等于授予开源许可。
140
+ 第三方依赖的许可说明见包内 `THIRD_PARTY_LICENSES.txt`。
@@ -0,0 +1,479 @@
1
+ Third-party licenses for Zhiwei CLI/MCP. No configuration or credentials are bundled.
2
+
3
+ github.com/google/jsonschema-go / LICENSE
4
+
5
+ MIT License
6
+
7
+ Copyright (c) 2025 JSON Schema Go Project Authors
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+
28
+ github.com/modelcontextprotocol/go-sdk / LICENSE
29
+
30
+ The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
31
+
32
+ Contributions for which relicensing consent has been obtained are licensed under Apache-2.0. Contributions made by authors who originally licensed their work under the MIT License and who have not yet granted explicit permission to relicense remain licensed under the MIT License.
33
+
34
+ No rights beyond those granted by the applicable original license are conveyed for such contributions.
35
+
36
+ ---
37
+
38
+ Apache License
39
+ Version 2.0, January 2004
40
+ http://www.apache.org/licenses/
41
+
42
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
43
+
44
+ 1. Definitions.
45
+
46
+ "License" shall mean the terms and conditions for use, reproduction,
47
+ and distribution as defined by Sections 1 through 9 of this document.
48
+
49
+ "Licensor" shall mean the copyright owner or entity authorized by
50
+ the copyright owner that is granting the License.
51
+
52
+ "Legal Entity" shall mean the union of the acting entity and all
53
+ other entities that control, are controlled by, or are under common
54
+ control with that entity. For the purposes of this definition,
55
+ "control" means (i) the power, direct or indirect, to cause the
56
+ direction or management of such entity, whether by contract or
57
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
58
+ outstanding shares, or (iii) beneficial ownership of such entity.
59
+
60
+ "You" (or "Your") shall mean an individual or Legal Entity
61
+ exercising permissions granted by this License.
62
+
63
+ "Source" form shall mean the preferred form for making modifications,
64
+ including but not limited to software source code, documentation
65
+ source, and configuration files.
66
+
67
+ "Object" form shall mean any form resulting from mechanical
68
+ transformation or translation of a Source form, including but
69
+ not limited to compiled object code, generated documentation,
70
+ and conversions to other media types.
71
+
72
+ "Work" shall mean the work of authorship, whether in Source or
73
+ Object form, made available under the License, as indicated by a
74
+ copyright notice that is included in or attached to the work
75
+ (an example is provided in the Appendix below).
76
+
77
+ "Derivative Works" shall mean any work, whether in Source or Object
78
+ form, that is based on (or derived from) the Work and for which the
79
+ editorial revisions, annotations, elaborations, or other modifications
80
+ represent, as a whole, an original work of authorship. For the purposes
81
+ of this License, Derivative Works shall not include works that remain
82
+ separable from, or merely link (or bind by name) to the interfaces of,
83
+ the Work and Derivative Works thereof.
84
+
85
+ "Contribution" shall mean any work of authorship, including
86
+ the original version of the Work and any modifications or additions
87
+ to that Work or Derivative Works thereof, that is intentionally
88
+ submitted to Licensor for inclusion in the Work by the copyright
89
+ owner or by an individual or Legal Entity authorized to submit on behalf
90
+ of the copyright owner. For the purposes of this definition, "submitted"
91
+ means any form of electronic, verbal, or written communication sent
92
+ to the Licensor or its representatives, including but not limited to
93
+ communication on electronic mailing lists, source code control systems,
94
+ and issue tracking systems that are managed by, or on behalf of, the
95
+ Licensor for the purpose of discussing and improving the Work, but
96
+ excluding communication that is conspicuously marked or otherwise
97
+ designated in writing by the copyright owner as "Not a Contribution."
98
+
99
+ "Contributor" shall mean Licensor and any individual or Legal Entity
100
+ on behalf of whom a Contribution has been received by Licensor and
101
+ subsequently incorporated within the Work.
102
+
103
+ 2. Grant of Copyright License. Subject to the terms and conditions of
104
+ this License, each Contributor hereby grants to You a perpetual,
105
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
106
+ copyright license to reproduce, prepare Derivative Works of,
107
+ publicly display, publicly perform, sublicense, and distribute the
108
+ Work and such Derivative Works in Source or Object form.
109
+
110
+ 3. Grant of Patent License. Subject to the terms and conditions of
111
+ this License, each Contributor hereby grants to You a perpetual,
112
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
113
+ (except as stated in this section) patent license to make, have made,
114
+ use, offer to sell, sell, import, and otherwise transfer the Work,
115
+ where such license applies only to those patent claims licensable
116
+ by such Contributor that are necessarily infringed by their
117
+ Contribution(s) alone or by combination of their Contribution(s)
118
+ with the Work to which such Contribution(s) was submitted. If You
119
+ institute patent litigation against any entity (including a
120
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
121
+ or a Contribution incorporated within the Work constitutes direct
122
+ or contributory patent infringement, then any patent licenses
123
+ granted to You under this License for that Work shall terminate
124
+ as of the date such litigation is filed.
125
+
126
+ 4. Redistribution. You may reproduce and distribute copies of the
127
+ Work or Derivative Works thereof in any medium, with or without
128
+ modifications, and in Source or Object form, provided that You
129
+ meet the following conditions:
130
+
131
+ (a) You must give any other recipients of the Work or
132
+ Derivative Works a copy of this License; and
133
+
134
+ (b) You must cause any modified files to carry prominent notices
135
+ stating that You changed the files; and
136
+
137
+ (c) You must retain, in the Source form of any Derivative Works
138
+ that You distribute, all copyright, patent, trademark, and
139
+ attribution notices from the Source form of the Work,
140
+ excluding those notices that do not pertain to any part of
141
+ the Derivative Works; and
142
+
143
+ (d) If the Work includes a "NOTICE" text file as part of its
144
+ distribution, then any Derivative Works that You distribute must
145
+ include a readable copy of the attribution notices contained
146
+ within such NOTICE file, excluding those notices that do not
147
+ pertain to any part of the Derivative Works, in at least one
148
+ of the following places: within a NOTICE text file distributed
149
+ as part of the Derivative Works; within the Source form or
150
+ documentation, if provided along with the Derivative Works; or,
151
+ within a display generated by the Derivative Works, if and
152
+ wherever such third-party notices normally appear. The contents
153
+ of the NOTICE file are for informational purposes only and
154
+ do not modify the License. You may add Your own attribution
155
+ notices within Derivative Works that You distribute, alongside
156
+ or as an addendum to the NOTICE text from the Work, provided
157
+ that such additional attribution notices cannot be construed
158
+ as modifying the License.
159
+
160
+ You may add Your own copyright statement to Your modifications and
161
+ may provide additional or different license terms and conditions
162
+ for use, reproduction, or distribution of Your modifications, or
163
+ for any such Derivative Works as a whole, provided Your use,
164
+ reproduction, and distribution of the Work otherwise complies with
165
+ the conditions stated in this License.
166
+
167
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
168
+ any Contribution intentionally submitted for inclusion in the Work
169
+ by You to the Licensor shall be under the terms and conditions of
170
+ this License, without any additional terms or conditions.
171
+ Notwithstanding the above, nothing herein shall supersede or modify
172
+ the terms of any separate license agreement you may have executed
173
+ with Licensor regarding such Contributions.
174
+
175
+ 6. Trademarks. This License does not grant permission to use the trade
176
+ names, trademarks, service marks, or product names of the Licensor,
177
+ except as required for reasonable and customary use in describing the
178
+ origin of the Work and reproducing the content of the NOTICE file.
179
+
180
+ 7. Disclaimer of Warranty. Unless required by applicable law or
181
+ agreed to in writing, Licensor provides the Work (and each
182
+ Contributor provides its Contributions) on an "AS IS" BASIS,
183
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
184
+ implied, including, without limitation, any warranties or conditions
185
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
186
+ PARTICULAR PURPOSE. You are solely responsible for determining the
187
+ appropriateness of using or redistributing the Work and assume any
188
+ risks associated with Your exercise of permissions under this License.
189
+
190
+ 8. Limitation of Liability. In no event and under no legal theory,
191
+ whether in tort (including negligence), contract, or otherwise,
192
+ unless required by applicable law (such as deliberate and grossly
193
+ negligent acts) or agreed to in writing, shall any Contributor be
194
+ liable to You for damages, including any direct, indirect, special,
195
+ incidental, or consequential damages of any character arising as a
196
+ result of this License or out of the use or inability to use the
197
+ Work (including but not limited to damages for loss of goodwill,
198
+ work stoppage, computer failure or malfunction, or any and all
199
+ other commercial damages or losses), even if such Contributor
200
+ has been advised of the possibility of such damages.
201
+
202
+ 9. Accepting Warranty or Additional Liability. While redistributing
203
+ the Work or Derivative Works thereof, You may choose to offer,
204
+ and charge a fee for, acceptance of support, warranty, indemnity,
205
+ or other liability obligations and/or rights consistent with this
206
+ License. However, in accepting such obligations, You may act only
207
+ on Your own behalf and on Your sole responsibility, not on behalf
208
+ of any other Contributor, and only if You agree to indemnify,
209
+ defend, and hold each Contributor harmless for any liability
210
+ incurred by, or claims asserted against, such Contributor by reason
211
+ of your accepting any such warranty or additional liability.
212
+
213
+ END OF TERMS AND CONDITIONS
214
+
215
+ ---
216
+
217
+ MIT License
218
+
219
+ Copyright (c) 2024-2025 Model Context Protocol a Series of LF Projects, LLC.
220
+
221
+ Permission is hereby granted, free of charge, to any person obtaining a copy
222
+ of this software and associated documentation files (the "Software"), to deal
223
+ in the Software without restriction, including without limitation the rights
224
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
225
+ copies of the Software, and to permit persons to whom the Software is
226
+ furnished to do so, subject to the following conditions:
227
+
228
+ The above copyright notice and this permission notice shall be included in all
229
+ copies or substantial portions of the Software.
230
+
231
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
232
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
233
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
234
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
235
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
236
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
237
+ SOFTWARE.
238
+
239
+ ---
240
+
241
+ Creative Commons Attribution 4.0 International (CC-BY-4.0)
242
+
243
+ Documentation in this project (excluding specifications) is licensed under
244
+ CC-BY-4.0. See https://creativecommons.org/licenses/by/4.0/legalcode for
245
+ the full license text.
246
+
247
+
248
+ github.com/segmentio/asm / LICENSE
249
+
250
+ MIT License
251
+
252
+ Copyright (c) 2021 Segment
253
+
254
+ Permission is hereby granted, free of charge, to any person obtaining a copy
255
+ of this software and associated documentation files (the "Software"), to deal
256
+ in the Software without restriction, including without limitation the rights
257
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
258
+ copies of the Software, and to permit persons to whom the Software is
259
+ furnished to do so, subject to the following conditions:
260
+
261
+ The above copyright notice and this permission notice shall be included in all
262
+ copies or substantial portions of the Software.
263
+
264
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
265
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
266
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
267
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
268
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
269
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
270
+ SOFTWARE.
271
+
272
+
273
+ github.com/segmentio/encoding / LICENSE
274
+
275
+ MIT License
276
+
277
+ Copyright (c) 2019 Segment.io, Inc.
278
+
279
+ Permission is hereby granted, free of charge, to any person obtaining a copy
280
+ of this software and associated documentation files (the "Software"), to deal
281
+ in the Software without restriction, including without limitation the rights
282
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
283
+ copies of the Software, and to permit persons to whom the Software is
284
+ furnished to do so, subject to the following conditions:
285
+
286
+ The above copyright notice and this permission notice shall be included in all
287
+ copies or substantial portions of the Software.
288
+
289
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
290
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
291
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
292
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
293
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
294
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
295
+ SOFTWARE.
296
+
297
+
298
+ github.com/yosida95/uritemplate/v3 / LICENSE
299
+
300
+ Copyright (C) 2016, Kohei YOSHIDA <https://yosida95.com/>. All rights reserved.
301
+
302
+ Redistribution and use in source and binary forms, with or without
303
+ modification, are permitted provided that the following conditions are met:
304
+
305
+ * Redistributions of source code must retain the above copyright
306
+ notice, this list of conditions and the following disclaimer.
307
+ * Redistributions in binary form must reproduce the above copyright
308
+ notice, this list of conditions and the following disclaimer in the
309
+ documentation and/or other materials provided with the distribution.
310
+ * Neither the name of the copyright holder nor the names of its
311
+ contributors may be used to endorse or promote products derived from
312
+ this software without specific prior written permission.
313
+
314
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
315
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
316
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
317
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
318
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
319
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
320
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
321
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
322
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
323
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
324
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
325
+
326
+
327
+ golang.org/x/oauth2 / LICENSE
328
+
329
+ Copyright 2009 The Go Authors.
330
+
331
+ Redistribution and use in source and binary forms, with or without
332
+ modification, are permitted provided that the following conditions are
333
+ met:
334
+
335
+ * Redistributions of source code must retain the above copyright
336
+ notice, this list of conditions and the following disclaimer.
337
+ * Redistributions in binary form must reproduce the above
338
+ copyright notice, this list of conditions and the following disclaimer
339
+ in the documentation and/or other materials provided with the
340
+ distribution.
341
+ * Neither the name of Google LLC nor the names of its
342
+ contributors may be used to endorse or promote products derived from
343
+ this software without specific prior written permission.
344
+
345
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
346
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
347
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
348
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
349
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
350
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
351
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
352
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
353
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
354
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
355
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
356
+
357
+
358
+ golang.org/x/sync / LICENSE
359
+
360
+ Copyright 2009 The Go Authors.
361
+
362
+ Redistribution and use in source and binary forms, with or without
363
+ modification, are permitted provided that the following conditions are
364
+ met:
365
+
366
+ * Redistributions of source code must retain the above copyright
367
+ notice, this list of conditions and the following disclaimer.
368
+ * Redistributions in binary form must reproduce the above
369
+ copyright notice, this list of conditions and the following disclaimer
370
+ in the documentation and/or other materials provided with the
371
+ distribution.
372
+ * Neither the name of Google LLC nor the names of its
373
+ contributors may be used to endorse or promote products derived from
374
+ this software without specific prior written permission.
375
+
376
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
377
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
378
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
379
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
380
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
381
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
382
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
383
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
384
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
385
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
386
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
387
+
388
+
389
+ golang.org/x/sys / LICENSE
390
+
391
+ Copyright 2009 The Go Authors.
392
+
393
+ Redistribution and use in source and binary forms, with or without
394
+ modification, are permitted provided that the following conditions are
395
+ met:
396
+
397
+ * Redistributions of source code must retain the above copyright
398
+ notice, this list of conditions and the following disclaimer.
399
+ * Redistributions in binary form must reproduce the above
400
+ copyright notice, this list of conditions and the following disclaimer
401
+ in the documentation and/or other materials provided with the
402
+ distribution.
403
+ * Neither the name of Google LLC nor the names of its
404
+ contributors may be used to endorse or promote products derived from
405
+ this software without specific prior written permission.
406
+
407
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
408
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
409
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
410
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
411
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
412
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
413
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
414
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
415
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
416
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
417
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
418
+
419
+
420
+ golang.org/x/time / LICENSE
421
+
422
+ Copyright 2009 The Go Authors.
423
+
424
+ Redistribution and use in source and binary forms, with or without
425
+ modification, are permitted provided that the following conditions are
426
+ met:
427
+
428
+ * Redistributions of source code must retain the above copyright
429
+ notice, this list of conditions and the following disclaimer.
430
+ * Redistributions in binary form must reproduce the above
431
+ copyright notice, this list of conditions and the following disclaimer
432
+ in the documentation and/or other materials provided with the
433
+ distribution.
434
+ * Neither the name of Google LLC nor the names of its
435
+ contributors may be used to endorse or promote products derived from
436
+ this software without specific prior written permission.
437
+
438
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
439
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
440
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
441
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
442
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
443
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
444
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
445
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
446
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
447
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
448
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
449
+
450
+
451
+ Go runtime LICENSE
452
+
453
+ Copyright 2009 The Go Authors.
454
+
455
+ Redistribution and use in source and binary forms, with or without
456
+ modification, are permitted provided that the following conditions are
457
+ met:
458
+
459
+ * Redistributions of source code must retain the above copyright
460
+ notice, this list of conditions and the following disclaimer.
461
+ * Redistributions in binary form must reproduce the above
462
+ copyright notice, this list of conditions and the following disclaimer
463
+ in the documentation and/or other materials provided with the
464
+ distribution.
465
+ * Neither the name of Google LLC nor the names of its
466
+ contributors may be used to endorse or promote products derived from
467
+ this software without specific prior written permission.
468
+
469
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
470
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
471
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
472
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
473
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
474
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
475
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
476
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
477
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
478
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
479
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,60 @@
1
+ 'use strict';
2
+
3
+ const { createHash } = require('node:crypto');
4
+ const { readFileSync } = require('node:fs');
5
+ const path = require('node:path');
6
+ const { spawn } = require('node:child_process');
7
+ const { constants } = require('node:os');
8
+
9
+ const targets = new Set(['win32-x64', 'win32-arm64', 'darwin-x64', 'darwin-arm64', 'linux-x64', 'linux-arm64']);
10
+
11
+ function resolveBinary(root, platform = process.platform, arch = process.arch) {
12
+ const target = `${platform}-${arch}`;
13
+ if (!targets.has(target)) throw new Error(`Unsupported platform: ${target}. Supported: Windows, macOS and Linux on x64/arm64.`);
14
+ const file = `native/${target}/zhiwei${platform === 'win32' ? '.exe' : ''}`;
15
+ try {
16
+ const manifest = JSON.parse(readFileSync(path.join(root, 'native-manifest.json'), 'utf8'));
17
+ const pkg = JSON.parse(readFileSync(path.join(root, 'package.json'), 'utf8'));
18
+ const expected = manifest.binaries[target];
19
+ if (manifest.version !== pkg.version || expected.file !== file) throw new Error('Invalid manifest');
20
+ const binary = readFileSync(path.join(root, file));
21
+ if (binary.length !== expected.size || createHash('sha256').update(binary).digest('hex') !== expected.sha256) {
22
+ throw new Error('Integrity mismatch');
23
+ }
24
+ } catch {
25
+ throw new Error(`Bundled program missing or damaged for ${target}. Reinstall the verified package.`);
26
+ }
27
+ return path.join(root, file);
28
+ }
29
+
30
+ async function run(args = process.argv.slice(2), options = {}) {
31
+ const root = options.root || path.resolve(__dirname, '..');
32
+ const host = options.host || process;
33
+ let executable;
34
+ try { executable = resolveBinary(root, options.platform, options.arch); }
35
+ catch (error) { host.stderr.write(`zhiwei: ${error.message}\n`); return 1; }
36
+
37
+ // Inherit stdio directly: stdout belongs exclusively to the CLI / MCP protocol.
38
+ // No shell, download, lifecycle installer, token arguments or environment logging.
39
+ return new Promise(resolve => {
40
+ let child;
41
+ try { child = (options.spawn || spawn)(executable, args, { stdio: 'inherit', shell: false, windowsHide: true }); }
42
+ catch { host.stderr.write('zhiwei: cannot start bundled program.\n'); resolve(1); return; }
43
+ const onInterrupt = () => child.kill('SIGINT');
44
+ const onTerminate = () => child.kill('SIGTERM');
45
+ host.on('SIGINT', onInterrupt);
46
+ host.on('SIGTERM', onTerminate);
47
+ let finished = false;
48
+ function finish(code) {
49
+ if (finished) return;
50
+ finished = true;
51
+ host.removeListener('SIGINT', onInterrupt);
52
+ host.removeListener('SIGTERM', onTerminate);
53
+ resolve(code);
54
+ }
55
+ child.once('error', () => { host.stderr.write('zhiwei: cannot start bundled program.\n'); finish(1); });
56
+ child.once('exit', (code, signal) => finish(code === null ? 128 + (constants.signals[signal] || 1) : code));
57
+ });
58
+ }
59
+
60
+ module.exports = { resolveBinary, run };
package/bin/zhiwei.cjs ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ require('./launcher.cjs').run().then(code => { process.exitCode = code; }).catch(() => {
5
+ process.stderr.write('zhiwei: launcher failed. Reinstall the verified package.\n');
6
+ process.exitCode = 1;
7
+ });
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,35 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "binaries": {
4
+ "win32-x64": {
5
+ "file": "native/win32-x64/zhiwei.exe",
6
+ "size": 9183744,
7
+ "sha256": "4f6f6b9529159b53a06dad4914d0287d4f64da4e2bd95d4ee1480f659812a9c5"
8
+ },
9
+ "win32-arm64": {
10
+ "file": "native/win32-arm64/zhiwei.exe",
11
+ "size": 8340480,
12
+ "sha256": "f635a927703b253e17898a05e9fde7420c3f4fc2fddc5385f50bae5b51453824"
13
+ },
14
+ "darwin-x64": {
15
+ "file": "native/darwin-x64/zhiwei",
16
+ "size": 9166336,
17
+ "sha256": "c6baba68d521df25eab3f5058cc462ef8034871a01ea9ebb1d96517d9c208764"
18
+ },
19
+ "darwin-arm64": {
20
+ "file": "native/darwin-arm64/zhiwei",
21
+ "size": 8502754,
22
+ "sha256": "19f484c8ea4ab4d1e36490fa571c6da249b9e25a892d6fa9bca9f5da8af86a9b"
23
+ },
24
+ "linux-x64": {
25
+ "file": "native/linux-x64/zhiwei",
26
+ "size": 8941728,
27
+ "sha256": "048ad4b9a7da15b235bd502c9d9cf84ca9033dce05909a8206bf83290fc76058"
28
+ },
29
+ "linux-arm64": {
30
+ "file": "native/linux-arm64/zhiwei",
31
+ "size": 8323232,
32
+ "sha256": "b2f9faeffe275d71eebe838ed5aa25f98dce9b9ec8fe663c62efc831389beeb8"
33
+ }
34
+ }
35
+ }
package/package.json CHANGED
@@ -1,6 +1,33 @@
1
1
  {
2
2
  "name": "@osborn001/zhiwei",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "Zhiwei CLI and local stdio MCP for explicitly selected work summaries",
5
+ "license": "UNLICENSED",
6
+ "bin": {
7
+ "zhiwei": "bin/zhiwei.cjs"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "native/",
12
+ "native-manifest.json",
13
+ "README.md",
14
+ "summary.example.json",
15
+ "THIRD_PARTY_LICENSES.txt"
16
+ ],
17
+ "engines": {
18
+ "node": ">=20"
19
+ },
20
+ "os": [
21
+ "win32",
22
+ "darwin",
23
+ "linux"
24
+ ],
25
+ "cpu": [
26
+ "x64",
27
+ "arm64"
28
+ ],
29
+ "publishConfig": {
30
+ "access": "public",
31
+ "registry": "https://registry.npmjs.org/"
32
+ }
33
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "submission_id": "task-20261006-checkpoint-1",
3
+ "task_id": "example-task",
4
+ "occurred_at": "2026-10-05T18:00:00+08:00",
5
+ "project": "示例项目",
6
+ "title": "完成接口重试验证",
7
+ "summary": "验证断网后重试和重复提交处理,生产部署仍待完成。请替换成实际脱敏摘要后提交。",
8
+ "status": "in_progress",
9
+ "outcomes": ["重试测试通过"],
10
+ "open_items": ["生产部署尚未执行"]
11
+ }