peakvisionos-sdk 1.5.0a1__tar.gz

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 (29) hide show
  1. peakvisionos_sdk-1.5.0a1/LICENSE +174 -0
  2. peakvisionos_sdk-1.5.0a1/PKG-INFO +284 -0
  3. peakvisionos_sdk-1.5.0a1/README.md +92 -0
  4. peakvisionos_sdk-1.5.0a1/agentos/__init__.py +7 -0
  5. peakvisionos_sdk-1.5.0a1/agentos/cli.py +2 -0
  6. peakvisionos_sdk-1.5.0a1/agentos/client.py +3 -0
  7. peakvisionos_sdk-1.5.0a1/agentos/harness.py +2 -0
  8. peakvisionos_sdk-1.5.0a1/agentos/http.py +2 -0
  9. peakvisionos_sdk-1.5.0a1/agentos/manifest.py +2 -0
  10. peakvisionos_sdk-1.5.0a1/agentos/py.typed +1 -0
  11. peakvisionos_sdk-1.5.0a1/peakvisionos_sdk.egg-info/PKG-INFO +284 -0
  12. peakvisionos_sdk-1.5.0a1/peakvisionos_sdk.egg-info/SOURCES.txt +27 -0
  13. peakvisionos_sdk-1.5.0a1/peakvisionos_sdk.egg-info/dependency_links.txt +1 -0
  14. peakvisionos_sdk-1.5.0a1/peakvisionos_sdk.egg-info/entry_points.txt +3 -0
  15. peakvisionos_sdk-1.5.0a1/peakvisionos_sdk.egg-info/top_level.txt +2 -0
  16. peakvisionos_sdk-1.5.0a1/pvos/__init__.py +28 -0
  17. peakvisionos_sdk-1.5.0a1/pvos/acceptance.py +34 -0
  18. peakvisionos_sdk-1.5.0a1/pvos/cli.py +432 -0
  19. peakvisionos_sdk-1.5.0a1/pvos/client.py +260 -0
  20. peakvisionos_sdk-1.5.0a1/pvos/harness.py +268 -0
  21. peakvisionos_sdk-1.5.0a1/pvos/http.py +372 -0
  22. peakvisionos_sdk-1.5.0a1/pvos/manifest.py +108 -0
  23. peakvisionos_sdk-1.5.0a1/pvos/mock_primitives.py +128 -0
  24. peakvisionos_sdk-1.5.0a1/pvos/mock_server.py +171 -0
  25. peakvisionos_sdk-1.5.0a1/pvos/package_manager.py +188 -0
  26. peakvisionos_sdk-1.5.0a1/pvos/py.typed +1 -0
  27. peakvisionos_sdk-1.5.0a1/pyproject.toml +35 -0
  28. peakvisionos_sdk-1.5.0a1/setup.cfg +4 -0
  29. peakvisionos_sdk-1.5.0a1/setup.py +4 -0
@@ -0,0 +1,174 @@
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
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including
48
+ the original version of the Work and any modifications or additions
49
+ to that Work or Derivative Works thereof, that is intentionally
50
+ submitted to Licensor for inclusion in the Work by the copyright owner
51
+ or by an individual or Legal Entity authorized to submit on behalf of
52
+ the copyright owner. For the purposes of this definition, "submitted"
53
+ means any form of electronic, verbal, or written communication sent
54
+ to the Licensor or its representatives, including but not limited to
55
+ communication on electronic mailing lists, source code control systems,
56
+ and issue tracking systems that are managed by, or on behalf of, the
57
+ Licensor for the purpose of discussing and improving the Work, but
58
+ excluding communication that is conspicuously marked or otherwise
59
+ designated in writing by the copyright owner as "Not a Contribution."
60
+
61
+ "Contributor" shall mean Licensor and any individual or Legal Entity
62
+ on behalf of whom a Contribution has been received by Licensor and
63
+ subsequently incorporated within the Work.
64
+
65
+ 2. Grant of Copyright License. Subject to the terms and conditions of
66
+ this License, each Contributor hereby grants to You a perpetual,
67
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
68
+ copyright license to reproduce, prepare Derivative Works of,
69
+ publicly display, publicly perform, sublicense, and distribute the
70
+ Work and such Derivative Works in Source or Object form.
71
+
72
+ 3. Grant of Patent License. Subject to the terms and conditions of
73
+ this License, each Contributor hereby grants to You a perpetual,
74
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75
+ (except as stated in this section) patent license to make, have made,
76
+ use, offer to sell, sell, import, and otherwise transfer the Work,
77
+ where such license applies only to those patent claims licensable
78
+ by such Contributor that are necessarily infringed by their
79
+ Contribution(s) alone or by combination of their Contribution(s)
80
+ with the Work to which such Contribution(s) was submitted. If You
81
+ institute patent litigation against any entity (including a
82
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
83
+ or a Contribution incorporated within the Work constitutes direct
84
+ or contributory patent infringement, then any patent licenses
85
+ granted to You under this License for that Work shall terminate
86
+ as of the date such litigation is filed.
87
+
88
+ 4. Redistribution. You may reproduce and distribute copies of the
89
+ Work or Derivative Works thereof in any medium, with or without
90
+ modifications, and in Source or Object form, provided that You
91
+ meet the following conditions:
92
+
93
+ (a) You must give any other recipients of the Work or
94
+ Derivative Works a copy of this License; and
95
+
96
+ (b) You must cause any modified files to carry prominent notices
97
+ stating that You changed the files; and
98
+
99
+ (c) You must retain, in the Source form of any Derivative Works
100
+ that You distribute, all copyright, patent, trademark, and
101
+ attribution notices from the Source form of the Work,
102
+ excluding those notices that do not pertain to any part of
103
+ the Derivative Works; and
104
+
105
+ (d) If the Work includes a "NOTICE" text file as part of its
106
+ distribution, then any Derivative Works that You distribute must
107
+ include a readable copy of the attribution notices contained
108
+ within such NOTICE file, excluding those notices that do not
109
+ pertain to any part of the Derivative Works, in at least one
110
+ of the following places: within a NOTICE text file distributed
111
+ as part of the Derivative Works; within the Source form or
112
+ documentation, if provided along with the Derivative Works; or,
113
+ within a display generated by the Derivative Works, if and
114
+ wherever such third-party notices normally appear. The contents
115
+ of the NOTICE file are for informational purposes only and
116
+ do not modify the License. You may add Your own attribution
117
+ notices within Derivative Works that You distribute, alongside
118
+ or as an addendum to the NOTICE text from the Work, provided
119
+ that such additional attribution notices cannot be construed
120
+ as modifying the License.
121
+
122
+ You may add Your own copyright statement to Your modifications and
123
+ may provide additional or different license terms and conditions
124
+ for use, reproduction, or distribution of Your modifications, or
125
+ for any such Derivative Works as a whole, provided Your use,
126
+ reproduction, and distribution of the Work otherwise complies with
127
+ the conditions stated in this License.
128
+
129
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
130
+ any Contribution intentionally submitted for inclusion in the Work
131
+ by You to the Licensor shall be under the terms and conditions of
132
+ this License, without any additional terms or conditions.
133
+
134
+ 6. Trademarks. This License does not grant permission to use the trade
135
+ names, trademarks, service marks, or product names of the Licensor,
136
+ except as required for reasonable and customary use in describing the
137
+ origin of the Work and reproducing the content of the NOTICE file.
138
+
139
+ 7. Disclaimer of Warranty. Unless required by applicable law or
140
+ agreed to in writing, Licensor provides the Work (and each
141
+ Contributor provides its Contributions) on an "AS IS" BASIS,
142
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
143
+ implied, including, without limitation, any warranties or conditions
144
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
145
+ PARTICULAR PURPOSE. You are solely responsible for determining the
146
+ appropriateness of using or redistributing the Work and assume any
147
+ risks associated with Your exercise of permissions under this License.
148
+
149
+ 8. Limitation of Liability. In no event and under no legal theory,
150
+ whether in tort (including negligence), contract, or otherwise,
151
+ unless required by applicable law (such as deliberate and grossly
152
+ negligent acts) or agreed to in writing, shall any Contributor be
153
+ liable to You for damages, including any direct, indirect, special,
154
+ incidental, or consequential damages of any character arising as a
155
+ result of this License or out of the use or inability to use the
156
+ Work (including but not limited to damages for loss of goodwill,
157
+ work stoppage, computer failure or malfunction, or any and all
158
+ other commercial damages or losses), even if such Contributor
159
+ has been advised of the possibility of such damages.
160
+
161
+ 9. Accepting Warranty or Additional Liability. While redistributing
162
+ the Work or Derivative Works thereof, You may choose to offer,
163
+ and charge a fee for, acceptance of support, warranty, indemnity,
164
+ or other liability obligations and/or rights consistent with this
165
+ License. However, in accepting such obligations, You may act only
166
+ on Your own behalf and on Your sole responsibility, not on behalf
167
+ of any other Contributor, and only if You agree to indemnify,
168
+ defend, and hold each Contributor harmless for any liability
169
+ incurred by, or claims asserted against, such Contributor by reason
170
+ of your accepting any such warranty or additional liability.
171
+
172
+ END OF TERMS AND CONDITIONS
173
+
174
+ Copyright 2026 PeakVisionAI
@@ -0,0 +1,284 @@
1
+ Metadata-Version: 2.4
2
+ Name: peakvisionos-sdk
3
+ Version: 1.5.0a1
4
+ Summary: PeakVisionOS Python SDK for local primitives, managed Agents, Harness adapters and the remote Gateway
5
+ Author: PeakVisionAI
6
+ License: Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction,
15
+ and distribution as defined by Sections 1 through 9 of this document.
16
+
17
+ "Licensor" shall mean the copyright owner or entity authorized by
18
+ the copyright owner that is granting the License.
19
+
20
+ "Legal Entity" shall mean the union of the acting entity and all
21
+ other entities that control, are controlled by, or are under common
22
+ control with that entity. For the purposes of this definition,
23
+ "control" means (i) the power, direct or indirect, to cause the
24
+ direction or management of such entity, whether by contract or
25
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
26
+ outstanding shares, or (iii) beneficial ownership of such entity.
27
+
28
+ "You" (or "Your") shall mean an individual or Legal Entity
29
+ exercising permissions granted by this License.
30
+
31
+ "Source" form shall mean the preferred form for making modifications,
32
+ including but not limited to software source code, documentation
33
+ source, and configuration files.
34
+
35
+ "Object" form shall mean any form resulting from mechanical
36
+ transformation or translation of a Source form, including but
37
+ not limited to compiled object code, generated documentation,
38
+ and conversions to other media types.
39
+
40
+ "Work" shall mean the work of authorship, whether in Source or
41
+ Object form, made available under the License, as indicated by a
42
+ copyright notice that is included in or attached to the work.
43
+
44
+ "Derivative Works" shall mean any work, whether in Source or Object
45
+ form, that is based on (or derived from) the Work and for which the
46
+ editorial revisions, annotations, elaborations, or other modifications
47
+ represent, as a whole, an original work of authorship. For the purposes
48
+ of this License, Derivative Works shall not include works that remain
49
+ separable from, or merely link (or bind by name) to the interfaces of,
50
+ the Work and Derivative Works thereof.
51
+
52
+ "Contribution" shall mean any work of authorship, including
53
+ the original version of the Work and any modifications or additions
54
+ to that Work or Derivative Works thereof, that is intentionally
55
+ submitted to Licensor for inclusion in the Work by the copyright owner
56
+ or by an individual or Legal Entity authorized to submit on behalf of
57
+ the copyright owner. For the purposes of this definition, "submitted"
58
+ means any form of electronic, verbal, or written communication sent
59
+ to the Licensor or its representatives, including but not limited to
60
+ communication on electronic mailing lists, source code control systems,
61
+ and issue tracking systems that are managed by, or on behalf of, the
62
+ Licensor for the purpose of discussing and improving the Work, but
63
+ excluding communication that is conspicuously marked or otherwise
64
+ designated in writing by the copyright owner as "Not a Contribution."
65
+
66
+ "Contributor" shall mean Licensor and any individual or Legal Entity
67
+ on behalf of whom a Contribution has been received by Licensor and
68
+ subsequently incorporated within the Work.
69
+
70
+ 2. Grant of Copyright License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ copyright license to reproduce, prepare Derivative Works of,
74
+ publicly display, publicly perform, sublicense, and distribute the
75
+ Work and such Derivative Works in Source or Object form.
76
+
77
+ 3. Grant of Patent License. Subject to the terms and conditions of
78
+ this License, each Contributor hereby grants to You a perpetual,
79
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
80
+ (except as stated in this section) patent license to make, have made,
81
+ use, offer to sell, sell, import, and otherwise transfer the Work,
82
+ where such license applies only to those patent claims licensable
83
+ by such Contributor that are necessarily infringed by their
84
+ Contribution(s) alone or by combination of their Contribution(s)
85
+ with the Work to which such Contribution(s) was submitted. If You
86
+ institute patent litigation against any entity (including a
87
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
88
+ or a Contribution incorporated within the Work constitutes direct
89
+ or contributory patent infringement, then any patent licenses
90
+ granted to You under this License for that Work shall terminate
91
+ as of the date such litigation is filed.
92
+
93
+ 4. Redistribution. You may reproduce and distribute copies of the
94
+ Work or Derivative Works thereof in any medium, with or without
95
+ modifications, and in Source or Object form, provided that You
96
+ meet the following conditions:
97
+
98
+ (a) You must give any other recipients of the Work or
99
+ Derivative Works a copy of this License; and
100
+
101
+ (b) You must cause any modified files to carry prominent notices
102
+ stating that You changed the files; and
103
+
104
+ (c) You must retain, in the Source form of any Derivative Works
105
+ that You distribute, all copyright, patent, trademark, and
106
+ attribution notices from the Source form of the Work,
107
+ excluding those notices that do not pertain to any part of
108
+ the Derivative Works; and
109
+
110
+ (d) If the Work includes a "NOTICE" text file as part of its
111
+ distribution, then any Derivative Works that You distribute must
112
+ include a readable copy of the attribution notices contained
113
+ within such NOTICE file, excluding those notices that do not
114
+ pertain to any part of the Derivative Works, in at least one
115
+ of the following places: within a NOTICE text file distributed
116
+ as part of the Derivative Works; within the Source form or
117
+ documentation, if provided along with the Derivative Works; or,
118
+ within a display generated by the Derivative Works, if and
119
+ wherever such third-party notices normally appear. The contents
120
+ of the NOTICE file are for informational purposes only and
121
+ do not modify the License. You may add Your own attribution
122
+ notices within Derivative Works that You distribute, alongside
123
+ or as an addendum to the NOTICE text from the Work, provided
124
+ that such additional attribution notices cannot be construed
125
+ as modifying the License.
126
+
127
+ You may add Your own copyright statement to Your modifications and
128
+ may provide additional or different license terms and conditions
129
+ for use, reproduction, or distribution of Your modifications, or
130
+ for any such Derivative Works as a whole, provided Your use,
131
+ reproduction, and distribution of the Work otherwise complies with
132
+ the conditions stated in this License.
133
+
134
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
135
+ any Contribution intentionally submitted for inclusion in the Work
136
+ by You to the Licensor shall be under the terms and conditions of
137
+ this License, without any additional terms or conditions.
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
+ Copyright 2026 PeakVisionAI
180
+
181
+ Project-URL: Homepage, https://github.com/PeakVisionAI/PeakVisionOS-SDK
182
+ Project-URL: Documentation, https://github.com/PeakVisionAI/PeakVisionOS-SDK/tree/main/docs
183
+ Project-URL: Repository, https://github.com/PeakVisionAI/PeakVisionOS-SDK
184
+ Keywords: agent,peakvisionos,pvos,agentos,harness,edge-ai
185
+ Classifier: Development Status :: 3 - Alpha
186
+ Classifier: Programming Language :: Python :: 3
187
+ Classifier: Programming Language :: Python :: 3 :: Only
188
+ Requires-Python: >=3.8
189
+ Description-Content-Type: text/markdown
190
+ License-File: LICENSE
191
+ Dynamic: license-file
192
+
193
+ # PeakVisionOS Python SDK
194
+
195
+ Python SDK 面向运行在 PeakVisionOS 节点上的 Agent,以及从开发电脑管理
196
+ 节点的 ISV 工具。仅使用 Python 标准库,支持 Python 3.8+。
197
+
198
+ ## 安装
199
+
200
+ ```bash
201
+ python3 -m pip install peakvisionos-sdk
202
+ # 源码开发
203
+ python3 -m pip install -e ./python
204
+ ```
205
+
206
+ ```python
207
+ import pvos
208
+ aos = pvos.PeakVisionOS(caller="my-agent")
209
+ ```
210
+
211
+ ## 本地原语
212
+
213
+ ```python
214
+ print(aos.world()) # agentd
215
+ print(aos.chat("写一个排序函数")) # inferd
216
+ aos.memory_write("项目代号为海风") # memoryd
217
+ print(aos.memory_recall("项目代号", top_k=3))
218
+ file_info = aos.fs_put("brief.md", "项目将在下周交付") # fsd
219
+ print(aos.fs_search("交付时间", top_k=3))
220
+ print(aos.ctx_assemble(8000, "项目风险")["prompt"]) # ctxd
221
+ ```
222
+
223
+ `memoryd` 的服务端协议是 `recall <query>`;SDK 的 `top_k` 在客户端对返回
224
+ 的 `hits` 截断,不会把未支持的参数发给 daemon。所有本地调用都可传
225
+ `timeout=<秒数>`。
226
+
227
+ 默认 Socket 和覆盖变量:
228
+
229
+ | 服务 | 环境变量 | 默认路径 |
230
+ | --- | --- | --- |
231
+ | agentd | `AGENTOS_AGENTD_SOCK` | `/run/agentd/agentd.sock` |
232
+ | inferd | `AGENTOS_INFERD_SOCK` | `/run/inferd/inferd.sock` |
233
+ | memoryd | `AGENTOS_MEMORYD_SOCK` | `/run/memoryd/memoryd.sock` |
234
+ | fsd | `AGENTOS_FSD_SOCK` | `/run/fsd/fsd.sock` |
235
+ | agentrund | `AGENTOS_AGENTRUND_SOCK` | `/run/agentrund/agentrund.sock` |
236
+ | ctxd | `AGENTOS_CTXD_SOCK` | `/run/ctxd/ctxd.sock` |
237
+
238
+ ## Remote Gateway
239
+
240
+ ```python
241
+ from pvos import GatewayClient, GatewayError
242
+
243
+ client = GatewayClient(endpoint="https://host/gateway/v1/nodes/n1/api/v1",
244
+ token="short-lived-token")
245
+ try:
246
+ run = client.create_run("my-agent", idempotency_key="build-001")
247
+ except GatewayError as exc:
248
+ print(exc.code, exc.status, exc.retryable, exc.request_id)
249
+ ```
250
+
251
+ 客户端覆盖 health、agents、workspaces、tasks、runs、logs、events;
252
+ `GatewayRegistryClient` 额外提供 nodes、注册、令牌轮换和 snapshot。
253
+ `AsyncGatewayClient` 提供同等方法;它在线程池中运行标准库 HTTP,取消协程
254
+ 会停止等待,但无法中断已经发出的 urllib 请求,timeout 仍是上限。
255
+
256
+ ## Harness 与打包
257
+
258
+ 实现 `plan(task, context)` 和 `validate(task, output, context)`,通过
259
+ `PeakVisionOSHarnessBridge` 执行稳定工具名。`ToolPolicy` 控制白名单和审批,
260
+ `ToolCall.timeout_seconds` 控制单次本地调用,`EventRecorder` 记录 JSONL,
261
+ `pvos replay` 离线校验终态。
262
+
263
+ ```bash
264
+ pvos new my-agent
265
+ pvos test my-agent
266
+ pvos package my-agent
267
+ pvos inspect my-agent
268
+ ```
269
+
270
+ Manifest 的 `primitives=` 是最小权限声明;安装器默认拒绝链接、特殊文件和
271
+ 超大包。生产环境应传入 `expected_sha256` 或 `signature_verifier`,并在升级前
272
+ 确认停止/重新加载策略。
273
+
274
+ ## 没有节点时
275
+
276
+ ```python
277
+ from pvos import PrimitiveMock
278
+ with PrimitiveMock():
279
+ print(pvos.PeakVisionOS().chat("离线合约测试"))
280
+ ```
281
+
282
+ `PrimitiveMock` 只验证请求形状和失败处理,不提供真实模型、隔离或安全保证。
283
+
284
+ 更多内容见[开发者快速开始](../docs/developer-quickstart.zh-CN.md)、[API 参考](../docs/api-reference.zh-CN.md)和[测试指南](../docs/testing-guide.zh-CN.md)。
@@ -0,0 +1,92 @@
1
+ # PeakVisionOS Python SDK
2
+
3
+ Python SDK 面向运行在 PeakVisionOS 节点上的 Agent,以及从开发电脑管理
4
+ 节点的 ISV 工具。仅使用 Python 标准库,支持 Python 3.8+。
5
+
6
+ ## 安装
7
+
8
+ ```bash
9
+ python3 -m pip install peakvisionos-sdk
10
+ # 源码开发
11
+ python3 -m pip install -e ./python
12
+ ```
13
+
14
+ ```python
15
+ import pvos
16
+ aos = pvos.PeakVisionOS(caller="my-agent")
17
+ ```
18
+
19
+ ## 本地原语
20
+
21
+ ```python
22
+ print(aos.world()) # agentd
23
+ print(aos.chat("写一个排序函数")) # inferd
24
+ aos.memory_write("项目代号为海风") # memoryd
25
+ print(aos.memory_recall("项目代号", top_k=3))
26
+ file_info = aos.fs_put("brief.md", "项目将在下周交付") # fsd
27
+ print(aos.fs_search("交付时间", top_k=3))
28
+ print(aos.ctx_assemble(8000, "项目风险")["prompt"]) # ctxd
29
+ ```
30
+
31
+ `memoryd` 的服务端协议是 `recall <query>`;SDK 的 `top_k` 在客户端对返回
32
+ 的 `hits` 截断,不会把未支持的参数发给 daemon。所有本地调用都可传
33
+ `timeout=<秒数>`。
34
+
35
+ 默认 Socket 和覆盖变量:
36
+
37
+ | 服务 | 环境变量 | 默认路径 |
38
+ | --- | --- | --- |
39
+ | agentd | `AGENTOS_AGENTD_SOCK` | `/run/agentd/agentd.sock` |
40
+ | inferd | `AGENTOS_INFERD_SOCK` | `/run/inferd/inferd.sock` |
41
+ | memoryd | `AGENTOS_MEMORYD_SOCK` | `/run/memoryd/memoryd.sock` |
42
+ | fsd | `AGENTOS_FSD_SOCK` | `/run/fsd/fsd.sock` |
43
+ | agentrund | `AGENTOS_AGENTRUND_SOCK` | `/run/agentrund/agentrund.sock` |
44
+ | ctxd | `AGENTOS_CTXD_SOCK` | `/run/ctxd/ctxd.sock` |
45
+
46
+ ## Remote Gateway
47
+
48
+ ```python
49
+ from pvos import GatewayClient, GatewayError
50
+
51
+ client = GatewayClient(endpoint="https://host/gateway/v1/nodes/n1/api/v1",
52
+ token="short-lived-token")
53
+ try:
54
+ run = client.create_run("my-agent", idempotency_key="build-001")
55
+ except GatewayError as exc:
56
+ print(exc.code, exc.status, exc.retryable, exc.request_id)
57
+ ```
58
+
59
+ 客户端覆盖 health、agents、workspaces、tasks、runs、logs、events;
60
+ `GatewayRegistryClient` 额外提供 nodes、注册、令牌轮换和 snapshot。
61
+ `AsyncGatewayClient` 提供同等方法;它在线程池中运行标准库 HTTP,取消协程
62
+ 会停止等待,但无法中断已经发出的 urllib 请求,timeout 仍是上限。
63
+
64
+ ## Harness 与打包
65
+
66
+ 实现 `plan(task, context)` 和 `validate(task, output, context)`,通过
67
+ `PeakVisionOSHarnessBridge` 执行稳定工具名。`ToolPolicy` 控制白名单和审批,
68
+ `ToolCall.timeout_seconds` 控制单次本地调用,`EventRecorder` 记录 JSONL,
69
+ `pvos replay` 离线校验终态。
70
+
71
+ ```bash
72
+ pvos new my-agent
73
+ pvos test my-agent
74
+ pvos package my-agent
75
+ pvos inspect my-agent
76
+ ```
77
+
78
+ Manifest 的 `primitives=` 是最小权限声明;安装器默认拒绝链接、特殊文件和
79
+ 超大包。生产环境应传入 `expected_sha256` 或 `signature_verifier`,并在升级前
80
+ 确认停止/重新加载策略。
81
+
82
+ ## 没有节点时
83
+
84
+ ```python
85
+ from pvos import PrimitiveMock
86
+ with PrimitiveMock():
87
+ print(pvos.PeakVisionOS().chat("离线合约测试"))
88
+ ```
89
+
90
+ `PrimitiveMock` 只验证请求形状和失败处理,不提供真实模型、隔离或安全保证。
91
+
92
+ 更多内容见[开发者快速开始](../docs/developer-quickstart.zh-CN.md)、[API 参考](../docs/api-reference.zh-CN.md)和[测试指南](../docs/testing-guide.zh-CN.md)。
@@ -0,0 +1,7 @@
1
+ """Compatibility import for the former ``agentos`` package.
2
+
3
+ New applications should use ``import pvos``. This module remains available
4
+ through the PeakVisionOS 1.x compatibility window.
5
+ """
6
+ from pvos import * # noqa: F401,F403
7
+ from pvos import __all__, __version__
@@ -0,0 +1,2 @@
1
+ """Compatibility wrapper; use :mod:`pvos.cli`."""
2
+ from pvos.cli import * # noqa: F401,F403
@@ -0,0 +1,3 @@
1
+ """Compatibility wrapper; use :mod:`pvos.client`."""
2
+ from pvos.client import * # noqa: F401,F403
3
+ from pvos.client import _SOCKS, _call
@@ -0,0 +1,2 @@
1
+ """Compatibility wrapper; use :mod:`pvos.harness`."""
2
+ from pvos.harness import * # noqa: F401,F403
@@ -0,0 +1,2 @@
1
+ """Compatibility wrapper; use :mod:`pvos.http`."""
2
+ from pvos.http import * # noqa: F401,F403
@@ -0,0 +1,2 @@
1
+ """Compatibility wrapper; use :mod:`pvos.manifest`."""
2
+ from pvos.manifest import * # noqa: F401,F403
@@ -0,0 +1 @@
1
+