@agentknight/client 0.9.39 → 0.9.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE 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.md CHANGED
@@ -1,299 +1,299 @@
1
- # AgentKnight
2
-
3
- AgentKnight PC Agent connects local coding-agent sessions to an AgentKnight
4
- Relay Server through Copilot, PI SDK, or ACP adapters.
5
-
6
- ## Embed
7
-
8
- Use `@agentknight/sdk` to embed the PC Agent runtime in a Node.js application
9
- without running the CLI or its local management service.
10
- Call `initialize` with an explicit absolute `dataDirectory` and the connection,
11
- identity and logging options, then manage the returned runtime with `start` and
12
- `stop`. The SDK does not select `~/.ak` or read the CLI configuration for you.
13
- Do not share a data directory between running instances.
14
-
15
- The CLI depends on the SDK; both use the same release version. The SDK can be
16
- published independently through the [npm release workflow](../../.github/workflows/agentknight-npm-publish.yml).
17
- See the [SDK entry point](../../shared/sdk/src/index.ts) for the public API.
18
-
19
- ## Run
20
-
21
- Use the Node.js version required by [package.json](package.json) and authenticate
22
- the coding agents you want to use.
23
-
24
- ```powershell
25
- npx @agentknight/client --env C:\path\to\agentknight.env
26
- ```
27
-
28
- Or install it globally:
29
-
30
- ```powershell
31
- npm install --global @agentknight/client
32
- agentknight --env C:\path\to\agentknight.env
33
- ```
34
-
35
- To switch from the unscoped `agentknight` package, stop the Agent and its service,
36
- run `npm uninstall --global agentknight`, then install `@agentknight/client` as
37
- above. The command remains `agentknight`; keep the existing data home and
38
- configuration. Re-register services that pin the old package path before
39
- restarting. Updating the old package does not migrate it to the new name.
40
-
41
- `AGENTKNIGHT_HOME` selects the PC data home, defaulting to `~/.ak`. Without
42
- `--env`, AgentKnight reads `<home>/agentknight.env`, with process settings taking
43
- precedence. With `--env`, the selected file is authoritative for PC settings:
44
- missing settings use defaults or fail validation, rather than inheriting old
45
- Relay credentials, machine names or data paths. OS and external provider
46
- environment variables are retained; explicitly supplied file values override them.
47
- Set custom `AGENTKNIGHT_HOME` in that file as well so restarts use the same home.
48
-
49
- `COPILOT_REMOTE_HOME` and `AGENTKNIGHT_PI_DIRECTORY` are deprecated input aliases
50
- for `AGENTKNIGHT_HOME` and PI's native `PI_CODING_AGENT_DIR`. Conflicting aliases
51
- in the same source are rejected. New configuration and restart metadata use only
52
- the canonical names. PI's native tilde, file URL and Windows shell path syntax
53
- is preserved; an explicitly empty PI directory selects its native default.
54
-
55
- The first normal startup can import legacy working-directory `.env` files or
56
- the old macOS service configuration into `~/.ak/agentknight.env`. Conflicting
57
- legacy values require selecting or reconciling the correct file; no source
58
- silently wins. A selected custom home does not import another home's settings.
59
- Status and upgrade commands do not import or migrate configuration.
60
-
61
- A legacy `~/.copilot-remote` home is copied only while the old Agent is stopped,
62
- preserving its machine identity, pairing keys and saved state. The stable device
63
- ID now lives in `<home>/device-id` alongside `device.json`; existing identities
64
- are preserved when importing the old `.bluepaw` ID. Fresh custom homes have
65
- independent identities. No new `.bluepaw` directory or compatibility symlink is
66
- created. Conflicting identities or homes require manual resolution, not an
67
- automatic reset. Retained legacy files are rollback copies, never dual-written;
68
- remove them only after verifying the migrated installation while old agents are stopped.
69
-
70
- Diagnostic JSONL files are under `<data-home>/logs/<version>/`. Existing
71
- unversioned logs remain historical files; they are not assigned an invented
72
- version. The local pairing page shows the running version, last successful
73
- upgrade time, configuration location, and Relay URL.
74
-
75
- ## Status and upgrades
76
-
77
- ```powershell
78
- agentknight --version
79
- agentknight status
80
- agentknight status --json
81
- agentknight upgrade --check
82
- agentknight upgrade
83
- ```
84
-
85
- `upgrade` uses the latest published version; `upgrade <version>` selects an exact
86
- newer version. Self-upgrade requires a global npm installation, not an `npx`
87
- cache or source checkout. Install a release containing this command through npm
88
- before using it for subsequent upgrades.
89
-
90
- Package resolution and installation try the official npm registry first, then
91
- the Tencent npm mirror for network failures. Existing npm/proxy configuration
92
- is respected without changing global settings. Archives and dependencies for
93
- both the target and rollback are prepared before stopping the running Agent.
94
-
95
- An independent worker waits for idle and performs the switch. Windows scheduled
96
- tasks and the supplied macOS LaunchAgent retain their existing configuration;
97
- foreground instances restart in the background. Persist their configuration and
98
- provider credentials in the environment file before upgrading; shell-only values
99
- that cannot be restored cause the upgrade to be refused. A stopped installation
100
- remains stopped. User-level installations do not require elevation; protected npm
101
- prefixes or service definitions need their existing permissions.
102
-
103
- The command reports the handoff, not successful completion. Use `status` to see
104
- the persistent result if the initiating connection closes. An Agent that remains
105
- busy is left running. Startup failure triggers an offline rollback; readiness
106
- requires the new instance's registration and initial synchronization, not merely
107
- an HTTP health response. Upgrading briefly interrupts the PC connection and does
108
- not migrate an active model turn between processes.
109
-
110
- Successful upgrades remove their temporary installation materials. Failed jobs
111
- retain their diagnostic files under `<data-home>/upgrades`; the last successful
112
- upgrade timestamp changes only after recovery is confirmed.
113
-
114
- ## Configuration
115
-
116
- Create the environment file from the
117
- [PC Agent example](https://github.com/hydraxman/AgentKnight/blob/main/clients/pc-agent/.env.example).
118
-
119
- `RELAY_URL` is used for HTTP APIs and Socket.IO, so an `https://` URL enables
120
- HTTPS and WSS for the entire PC Agent connection. `AGENTKNIGHT_MACHINE_NAME`
121
- controls the PC name shown to mobile clients. The selection and pairing webpage
122
- listens only on loopback; `PAIRING_PAGE_PORT` changes its local port.
123
-
124
- Repository checkouts also include Windows Scheduled Task and macOS LaunchAgent
125
- installers under `clients/pc-agent/scripts`. Services use the same canonical
126
- configuration as the CLI, not a copied environment file. Service support files
127
- and output logs live under `<home>/service` and `<home>/logs/service`; OS task and
128
- LaunchAgent registrations stay in their required system locations. Reinstall the
129
- service to update an older registration after stopping it and migrating its
130
- configuration. Explicit external environment files remain referenced in place.
131
- Uninstalling the service preserves configuration, identity and logs.
132
- Installers resolve the data home through `agentknight status --json`, so they
133
- must be used with the matching installed CLI. They pin the installation working
134
- directory to preserve relative paths; reinstall after changing the configured
135
- home or moving that directory. A missing canonical configuration must be
136
- created or migrated before installing the default service. Both default and
137
- explicit-file installations refuse a pending legacy-home migration; stop the old
138
- service and complete a normal startup with the selected configuration first.
139
-
140
- Re-register older Windows tasks
141
- that use `-CaCertPath` with `agentknight-service.ps1 install -EnvFile <path>`
142
- (and `-TaskName <name>` for a custom task), omitting `-CaCertPath`.
143
-
144
- ### Microsoft sign-in
145
-
146
- Set `RELAY_URL` and `RELAY_AUTH=microsoft` in the environment file, then start
147
- AgentKnight. Open the printed loopback URL and select **使用 Microsoft 登录**.
148
- Complete Microsoft sign-in and any application consent in a browser on that same
149
- computer. The browser returns to AgentKnight automatically; there is no device
150
- code to copy or enter. The Relay must support browser callback sign-in, have
151
- Microsoft sign-in enabled, and admit your account through its administrator.
152
- An older Relay must be upgraded rather than silently switching to manual codes.
153
-
154
- After approval, AgentKnight saves the machine-bound Relay credential in the
155
- current OS user's credential store, confirms it with Relay, and connects. The
156
- normal local page then provides Android pairing. Android still only scans or
157
- imports the pairing information; Microsoft sign-in does not replace the
158
- PC–phone encryption key or authenticate GitHub Copilot.
159
-
160
- Microsoft sign-in supports Windows Credential Manager and macOS Keychain only.
161
- Other operating systems are not supported for Microsoft sign-in; existing token
162
- authentication is unchanged. There is no plaintext or nonpersistent-keyring fallback.
163
- Run the service as the same OS user who signed in. Restarts reuse the saved
164
- credential; no Microsoft password, browser cookie or client secret is stored by
165
- the PC Agent.
166
-
167
- Microsoft sign-in must remain enabled on Relay so the Agent can verify saved
168
- credentials at startup. Verification failures retain the saved credential and
169
- show an error instead of silently switching accounts.
170
-
171
- To authorize a stopped installation explicitly, including before headless
172
- startup, run:
173
-
174
- ```powershell
175
- agentknight login --env C:\path\to\agentknight.env
176
- ```
177
-
178
- Use the same environment file and data home as the service. Do not delete or
179
- recreate `device.json` to sign in. A running Agent must be stopped before an
180
- explicit login; the command does not stop it for you. Browser logout does not
181
- revoke this PC: use the Relay's `/account` page to revoke its grant.
182
-
183
- ### Existing tokens
184
-
185
- An existing `RELAY_TOKEN` continues to select token authentication unless
186
- `RELAY_AUTH=microsoft` is explicitly set. Microsoft sign-in uses the server's
187
- returned user identity, not `USER_ID`, and never falls back to the old token on
188
- failure. Keep legacy tokens in the environment file, not command-line arguments
189
- or source control.
190
-
191
- The local page shows the Relay account's username, role and authentication
192
- method, separately from coding-agent connections. Generated Microsoft usernames
193
- are displayed as "Microsoft account"; **查看账户** opens the Relay's browser account
194
- page to view the Microsoft name and manage device grants. Account details require the
195
- Relay's PC account endpoint; update Relay as well as the PC client. An older
196
- Relay is reported explicitly instead of guessing a username from `USER_ID`.
197
-
198
- See the [AgentKnight repository](https://github.com/hydraxman/AgentKnight) for
199
- Relay Server and Android client setup.
200
-
201
- ## Coding agents
202
-
203
- The Copilot SDK and bundled CLI are pinned together in the [SDK manifest](../../shared/sdk/package.json).
204
- Keep separately installed Copilot terminals aligned with that CLI when attaching
205
- to their live sessions; restart the terminal after upgrading it. A
206
- `COPILOT_CLI_PATH` override must provide a compatible runtime.
207
-
208
- With `AGENTKNIGHT_CODING_AGENT=managed`, saved agent selections are restored at
209
- startup, including an intentionally empty selection. Without a saved selection,
210
- GitHub Copilot sync is enabled without visiting the local webpage. Use the webpage
211
- to enable agents and select **同步** (Sync), or explicitly show the QR code to pair Android.
212
- Multiple agents share one PC connection. Enabling an agent syncs all of its
213
- current and future locally discoverable sessions; individual sessions need no
214
- selection. Unselected agents remain private. Selections survive PC Agent restarts.
215
-
216
- Use `--agents copilot,pi` to enable agent sync at startup, or `--agents none` to disable
217
- all agent sync. This switches to managed mode and overrides both the saved selection and
218
- `AGENTKNIGHT_CODING_AGENT` for that start without overwriting saved settings.
219
- Native agent configuration still comes from the environment file. Subsequent
220
- webpage Sync actions apply immediately and save the selection; the startup flag takes precedence
221
- again on restart. Managed mode also works with the local webpage disabled.
222
-
223
- Discovery reads native session inventories without resuming their conversations.
224
- AgentKnight can continue PI's saved sessions, but does not attach to an already
225
- running PI terminal. Avoid continuing the same native session concurrently in both
226
- applications. Provider credentials and history stay in their native stores.
227
-
228
- In Android, choose **Rename** from a supported session's menu to change its native
229
- name, not a local display alias. Renaming a group changes only its title, not its
230
- participants' names.
231
-
232
- Use **Agent 群聊** on the local webpage to enable or disable group chat without
233
- restarting the PC Agent. The saved choice takes precedence over the environment
234
- setting in [.env.example](.env.example), including after a restart. Disabling
235
- pauses active groups and keeps their history; enabling does not resume them automatically.
236
- Groups connect two shared Copilot sessions on the same PC, in either managed or
237
- single-engine mode, including sessions created in the CLI or restored after a restart.
238
- Both participants must be idle with no pending input. After restarting, groups remain
239
- paused without replay; send a new group message to continue with the existing members.
240
- PI and ACP do not support groups.
241
-
242
- For experimental online conversation between Copilot sessions on two PCs, see
243
- the [peer-chat setup](../../docs/remote-sessions/agent-group-chat-design.md#使用).
244
- It is separate from local groups and sends Relay-readable text.
245
- Use only non-sensitive test content.
246
-
247
- Explicit `copilot`, `pi`, or `acp` values retain single-engine operation without
248
- selection filtering. See [.env.example](.env.example) for configuration.
249
-
250
- | Engine | Setup |
251
- | --- | --- |
252
- | `copilot` | Authenticate the GitHub Copilot CLI as before. |
253
- | `pi` | Requires Node.js >=22.19.0 and the optional PI dependencies from the [SDK manifest](../../shared/sdk/package.json). Authenticate PI using its own CLI (`/login`) or supported provider API-key environment variables. |
254
- | `acp` | Install and authenticate an ACP-compatible agent or bridge. Set `AGENTKNIGHT_ACP_COMMAND` to its executable and `AGENTKNIGHT_ACP_ARGS` to a JSON string array, such as `["--stdio"]` if that agent requires it. |
255
-
256
- PI uses its native directory by default. `PI_CODING_AGENT_DIR` selects an
257
- alternative directory containing PI authentication, model configuration, and
258
- session history; use the same directory when authenticating PI. Install
259
- AgentKnight with optional dependencies enabled to use PI.
260
- Source builds and the complete adapter suite also require the PI-compatible Node
261
- version; Copilot-only operation retains the baseline version in the manifest.
262
-
263
- The ACP executable must speak the Agent Client Protocol over stdio; an ordinary
264
- Codex or Claude Code CLI is not automatically an ACP endpoint. Arguments are
265
- passed literally, without a shell. AgentKnight does not download or authenticate
266
- the configured executable. Choose a trusted local agent: its own tools execute
267
- with the PC user's privileges. ACP state is kept under the PC data directory,
268
- separately for each executable/argument configuration.
269
-
270
- Adapters expose only supported configuration and operations. PI executes tools
271
- natively, without an added per-tool approval layer. Project resources follow PI's
272
- native project trust decisions, with unresolved trust prompts routed to Android.
273
- Machine-wide features such as uploads and deletion are available only when every
274
- selected engine supports them; session controls use that session's own engine.
275
- ACP approvals use the agent's offered one-time permission option, never an
276
- automatic persistent grant. Unsupported operations return errors rather than
277
- pretending to succeed. PI and ACP do not expose Copilot's remote-mode toggle.
278
- Generic file uploads remain Copilot-only; PI also rejects image uploads, while
279
- ACP images require the agent's negotiated image support.
280
-
281
- Optional controls follow the [capability compatibility policy](../../docs/remote-sessions/protocol-compatibility-plan.md);
282
- the historical registration `sdkVersion` is a compatibility marker, while
283
- startup logs record the actual engine and SDK version.
284
-
285
- ## Copilot uploaded files
286
-
287
- Mobile uploads are integrity-checked transport bytes, not model API messages.
288
- The PC Agent keeps generic files in its Copilot session state (`COPILOT_HOME`,
289
- or the default Copilot home) and sends absolute paths through the official
290
- [SDK file attachment contract](https://github.com/github/copilot-sdk/blob/v1.0.11/nodejs/src/types.ts);
291
- images remain blob attachments. The local CLI decides native document handling
292
- versus file-tool access: even [document support](https://github.com/github/copilot-sdk/blob/v1.0.11/docs/features/citations.md#attach-documents-to-a-message)
293
- depends on the model, so an accepted upload does not guarantee every format is readable.
294
- Files remain across acknowledgements, queued turns, failed sends and local restarts/resumes;
295
- they are removed only after successful explicit session deletion, not after each turn.
296
- This requires the runtime to share the PC Agent's filesystem and Copilot home.
297
- The default stdio runtime and the SDK's in-process override are local; unverified
298
- external clients do not advertise file uploads and reject them with an actionable error.
299
- Moving a session to another machine does not transfer these local files.
1
+ # AgentKnight
2
+
3
+ AgentKnight PC Agent connects local coding-agent sessions to an AgentKnight
4
+ Relay Server through Copilot, PI SDK, or ACP adapters.
5
+
6
+ ## Embed
7
+
8
+ Use `@agentknight/sdk` to embed the PC Agent runtime in a Node.js application
9
+ without running the CLI or its local management service.
10
+ Call `initialize` with an explicit absolute `dataDirectory` and the connection,
11
+ identity and logging options, then manage the returned runtime with `start` and
12
+ `stop`. The SDK does not select `~/.ak` or read the CLI configuration for you.
13
+ Do not share a data directory between running instances.
14
+
15
+ The CLI depends on the SDK; both use the same release version. The SDK can be
16
+ published independently through the [npm release workflow](../../.github/workflows/agentknight-npm-publish.yml).
17
+ See the [SDK entry point](../../shared/sdk/src/index.ts) for the public API.
18
+
19
+ ## Run
20
+
21
+ Use the Node.js version required by [package.json](package.json) and authenticate
22
+ the coding agents you want to use.
23
+
24
+ ```powershell
25
+ npx @agentknight/client --env C:\path\to\agentknight.env
26
+ ```
27
+
28
+ Or install it globally:
29
+
30
+ ```powershell
31
+ npm install --global @agentknight/client
32
+ agentknight --env C:\path\to\agentknight.env
33
+ ```
34
+
35
+ To switch from the unscoped `agentknight` package, stop the Agent and its service,
36
+ run `npm uninstall --global agentknight`, then install `@agentknight/client` as
37
+ above. The command remains `agentknight`; keep the existing data home and
38
+ configuration. Re-register services that pin the old package path before
39
+ restarting. Updating the old package does not migrate it to the new name.
40
+
41
+ `AGENTKNIGHT_HOME` selects the PC data home, defaulting to `~/.ak`. Without
42
+ `--env`, AgentKnight reads `<home>/agentknight.env`, with process settings taking
43
+ precedence. With `--env`, the selected file is authoritative for PC settings:
44
+ missing settings use defaults or fail validation, rather than inheriting old
45
+ Relay credentials, machine names or data paths. OS and external provider
46
+ environment variables are retained; explicitly supplied file values override them.
47
+ Set custom `AGENTKNIGHT_HOME` in that file as well so restarts use the same home.
48
+
49
+ `COPILOT_REMOTE_HOME` and `AGENTKNIGHT_PI_DIRECTORY` are deprecated input aliases
50
+ for `AGENTKNIGHT_HOME` and PI's native `PI_CODING_AGENT_DIR`. Conflicting aliases
51
+ in the same source are rejected. New configuration and restart metadata use only
52
+ the canonical names. PI's native tilde, file URL and Windows shell path syntax
53
+ is preserved; an explicitly empty PI directory selects its native default.
54
+
55
+ The first normal startup can import legacy working-directory `.env` files or
56
+ the old macOS service configuration into `~/.ak/agentknight.env`. Conflicting
57
+ legacy values require selecting or reconciling the correct file; no source
58
+ silently wins. A selected custom home does not import another home's settings.
59
+ Status and upgrade commands do not import or migrate configuration.
60
+
61
+ A legacy `~/.copilot-remote` home is copied only while the old Agent is stopped,
62
+ preserving its machine identity, pairing keys and saved state. The stable device
63
+ ID now lives in `<home>/device-id` alongside `device.json`; existing identities
64
+ are preserved when importing the old `.bluepaw` ID. Fresh custom homes have
65
+ independent identities. No new `.bluepaw` directory or compatibility symlink is
66
+ created. Conflicting identities or homes require manual resolution, not an
67
+ automatic reset. Retained legacy files are rollback copies, never dual-written;
68
+ remove them only after verifying the migrated installation while old agents are stopped.
69
+
70
+ Diagnostic JSONL files are under `<data-home>/logs/<version>/`. Existing
71
+ unversioned logs remain historical files; they are not assigned an invented
72
+ version. The local pairing page shows the running version, last successful
73
+ upgrade time, configuration location, and Relay URL.
74
+
75
+ ## Status and upgrades
76
+
77
+ ```powershell
78
+ agentknight --version
79
+ agentknight status
80
+ agentknight status --json
81
+ agentknight upgrade --check
82
+ agentknight upgrade
83
+ ```
84
+
85
+ `upgrade` uses the latest published version; `upgrade <version>` selects an exact
86
+ newer version. Self-upgrade requires a global npm installation, not an `npx`
87
+ cache or source checkout. Install a release containing this command through npm
88
+ before using it for subsequent upgrades.
89
+
90
+ Package resolution and installation try the official npm registry first, then
91
+ the Tencent npm mirror for network failures. Existing npm/proxy configuration
92
+ is respected without changing global settings. Archives and dependencies for
93
+ both the target and rollback are prepared before stopping the running Agent.
94
+
95
+ An independent worker waits for idle and performs the switch. Windows scheduled
96
+ tasks and the supplied macOS LaunchAgent retain their existing configuration;
97
+ foreground instances restart in the background. Persist their configuration and
98
+ provider credentials in the environment file before upgrading; shell-only values
99
+ that cannot be restored cause the upgrade to be refused. A stopped installation
100
+ remains stopped. User-level installations do not require elevation; protected npm
101
+ prefixes or service definitions need their existing permissions.
102
+
103
+ The command reports the handoff, not successful completion. Use `status` to see
104
+ the persistent result if the initiating connection closes. An Agent that remains
105
+ busy is left running. Startup failure triggers an offline rollback; readiness
106
+ requires the new instance's registration and initial synchronization, not merely
107
+ an HTTP health response. Upgrading briefly interrupts the PC connection and does
108
+ not migrate an active model turn between processes.
109
+
110
+ Successful upgrades remove their temporary installation materials. Failed jobs
111
+ retain their diagnostic files under `<data-home>/upgrades`; the last successful
112
+ upgrade timestamp changes only after recovery is confirmed.
113
+
114
+ ## Configuration
115
+
116
+ Create the environment file from the
117
+ [PC Agent example](https://github.com/hydraxman/AgentKnight/blob/main/clients/pc-agent/.env.example).
118
+
119
+ `RELAY_URL` is used for HTTP APIs and Socket.IO, so an `https://` URL enables
120
+ HTTPS and WSS for the entire PC Agent connection. `AGENTKNIGHT_MACHINE_NAME`
121
+ controls the PC name shown to mobile clients. The selection and pairing webpage
122
+ listens only on loopback; `PAIRING_PAGE_PORT` changes its local port.
123
+
124
+ Repository checkouts also include Windows Scheduled Task and macOS LaunchAgent
125
+ installers under `clients/pc-agent/scripts`. Services use the same canonical
126
+ configuration as the CLI, not a copied environment file. Service support files
127
+ and output logs live under `<home>/service` and `<home>/logs/service`; OS task and
128
+ LaunchAgent registrations stay in their required system locations. Reinstall the
129
+ service to update an older registration after stopping it and migrating its
130
+ configuration. Explicit external environment files remain referenced in place.
131
+ Uninstalling the service preserves configuration, identity and logs.
132
+ Installers resolve the data home through `agentknight status --json`, so they
133
+ must be used with the matching installed CLI. They pin the installation working
134
+ directory to preserve relative paths; reinstall after changing the configured
135
+ home or moving that directory. A missing canonical configuration must be
136
+ created or migrated before installing the default service. Both default and
137
+ explicit-file installations refuse a pending legacy-home migration; stop the old
138
+ service and complete a normal startup with the selected configuration first.
139
+
140
+ Re-register older Windows tasks
141
+ that use `-CaCertPath` with `agentknight-service.ps1 install -EnvFile <path>`
142
+ (and `-TaskName <name>` for a custom task), omitting `-CaCertPath`.
143
+
144
+ ### Microsoft sign-in
145
+
146
+ Set `RELAY_URL` and `RELAY_AUTH=microsoft` in the environment file, then start
147
+ AgentKnight. Open the printed loopback URL and select **使用 Microsoft 登录**.
148
+ Complete Microsoft sign-in and any application consent in a browser on that same
149
+ computer. The browser returns to AgentKnight automatically; there is no device
150
+ code to copy or enter. The Relay must support browser callback sign-in, have
151
+ Microsoft sign-in enabled, and admit your account through its administrator.
152
+ An older Relay must be upgraded rather than silently switching to manual codes.
153
+
154
+ After approval, AgentKnight saves the machine-bound Relay credential in the
155
+ current OS user's credential store, confirms it with Relay, and connects. The
156
+ normal local page then provides Android pairing. Android still only scans or
157
+ imports the pairing information; Microsoft sign-in does not replace the
158
+ PC–phone encryption key or authenticate GitHub Copilot.
159
+
160
+ Microsoft sign-in supports Windows Credential Manager and macOS Keychain only.
161
+ Other operating systems are not supported for Microsoft sign-in; existing token
162
+ authentication is unchanged. There is no plaintext or nonpersistent-keyring fallback.
163
+ Run the service as the same OS user who signed in. Restarts reuse the saved
164
+ credential; no Microsoft password, browser cookie or client secret is stored by
165
+ the PC Agent.
166
+
167
+ Microsoft sign-in must remain enabled on Relay so the Agent can verify saved
168
+ credentials at startup. Verification failures retain the saved credential and
169
+ show an error instead of silently switching accounts.
170
+
171
+ To authorize a stopped installation explicitly, including before headless
172
+ startup, run:
173
+
174
+ ```powershell
175
+ agentknight login --env C:\path\to\agentknight.env
176
+ ```
177
+
178
+ Use the same environment file and data home as the service. Do not delete or
179
+ recreate `device.json` to sign in. A running Agent must be stopped before an
180
+ explicit login; the command does not stop it for you. Browser logout does not
181
+ revoke this PC: use the Relay's `/account` page to revoke its grant.
182
+
183
+ ### Existing tokens
184
+
185
+ An existing `RELAY_TOKEN` continues to select token authentication unless
186
+ `RELAY_AUTH=microsoft` is explicitly set. Microsoft sign-in uses the server's
187
+ returned user identity, not `USER_ID`, and never falls back to the old token on
188
+ failure. Keep legacy tokens in the environment file, not command-line arguments
189
+ or source control.
190
+
191
+ The local page shows the Relay account's username, role and authentication
192
+ method, separately from coding-agent connections. Generated Microsoft usernames
193
+ are displayed as "Microsoft account"; **查看账户** opens the Relay's browser account
194
+ page to view the Microsoft name and manage device grants. Account details require the
195
+ Relay's PC account endpoint; update Relay as well as the PC client. An older
196
+ Relay is reported explicitly instead of guessing a username from `USER_ID`.
197
+
198
+ See the [AgentKnight repository](https://github.com/hydraxman/AgentKnight) for
199
+ Relay Server and Android client setup.
200
+
201
+ ## Coding agents
202
+
203
+ The Copilot SDK and bundled CLI are pinned together in the [SDK manifest](../../shared/sdk/package.json).
204
+ Keep separately installed Copilot terminals aligned with that CLI when attaching
205
+ to their live sessions; restart the terminal after upgrading it. A
206
+ `COPILOT_CLI_PATH` override must provide a compatible runtime.
207
+
208
+ With `AGENTKNIGHT_CODING_AGENT=managed`, saved agent selections are restored at
209
+ startup, including an intentionally empty selection. Without a saved selection,
210
+ GitHub Copilot sync is enabled without visiting the local webpage. Use the webpage
211
+ to enable agents and select **同步** (Sync), or explicitly show the QR code to pair Android.
212
+ Multiple agents share one PC connection. Enabling an agent syncs all of its
213
+ current and future locally discoverable sessions; individual sessions need no
214
+ selection. Unselected agents remain private. Selections survive PC Agent restarts.
215
+
216
+ Use `--agents copilot,pi` to enable agent sync at startup, or `--agents none` to disable
217
+ all agent sync. This switches to managed mode and overrides both the saved selection and
218
+ `AGENTKNIGHT_CODING_AGENT` for that start without overwriting saved settings.
219
+ Native agent configuration still comes from the environment file. Subsequent
220
+ webpage Sync actions apply immediately and save the selection; the startup flag takes precedence
221
+ again on restart. Managed mode also works with the local webpage disabled.
222
+
223
+ Discovery reads native session inventories without resuming their conversations.
224
+ AgentKnight can continue PI's saved sessions, but does not attach to an already
225
+ running PI terminal. Avoid continuing the same native session concurrently in both
226
+ applications. Provider credentials and history stay in their native stores.
227
+
228
+ In Android, choose **Rename** from a supported session's menu to change its native
229
+ name, not a local display alias. Renaming a group changes only its title, not its
230
+ participants' names.
231
+
232
+ Use **Agent 群聊** on the local webpage to enable or disable group chat without
233
+ restarting the PC Agent. The saved choice takes precedence over the environment
234
+ setting in [.env.example](.env.example), including after a restart. Disabling
235
+ pauses active groups and keeps their history; enabling does not resume them automatically.
236
+ Groups connect two shared Copilot sessions on the same PC, in either managed or
237
+ single-engine mode, including sessions created in the CLI or restored after a restart.
238
+ Both participants must be idle with no pending input. After restarting, groups remain
239
+ paused without replay; send a new group message to continue with the existing members.
240
+ PI and ACP do not support groups.
241
+
242
+ For experimental online conversation between Copilot sessions on two PCs, see
243
+ the [peer-chat setup](../../docs/remote-sessions/agent-group-chat-design.md#使用).
244
+ It is separate from local groups and sends Relay-readable text.
245
+ Use only non-sensitive test content.
246
+
247
+ Explicit `copilot`, `pi`, or `acp` values retain single-engine operation without
248
+ selection filtering. See [.env.example](.env.example) for configuration.
249
+
250
+ | Engine | Setup |
251
+ | --- | --- |
252
+ | `copilot` | Authenticate the GitHub Copilot CLI as before. |
253
+ | `pi` | Requires Node.js >=22.19.0 and the optional PI dependencies from the [SDK manifest](../../shared/sdk/package.json). Authenticate PI using its own CLI (`/login`) or supported provider API-key environment variables. |
254
+ | `acp` | Install and authenticate an ACP-compatible agent or bridge. Set `AGENTKNIGHT_ACP_COMMAND` to its executable and `AGENTKNIGHT_ACP_ARGS` to a JSON string array, such as `["--stdio"]` if that agent requires it. |
255
+
256
+ PI uses its native directory by default. `PI_CODING_AGENT_DIR` selects an
257
+ alternative directory containing PI authentication, model configuration, and
258
+ session history; use the same directory when authenticating PI. Install
259
+ AgentKnight with optional dependencies enabled to use PI.
260
+ Source builds and the complete adapter suite also require the PI-compatible Node
261
+ version; Copilot-only operation retains the baseline version in the manifest.
262
+
263
+ The ACP executable must speak the Agent Client Protocol over stdio; an ordinary
264
+ Codex or Claude Code CLI is not automatically an ACP endpoint. Arguments are
265
+ passed literally, without a shell. AgentKnight does not download or authenticate
266
+ the configured executable. Choose a trusted local agent: its own tools execute
267
+ with the PC user's privileges. ACP state is kept under the PC data directory,
268
+ separately for each executable/argument configuration.
269
+
270
+ Adapters expose only supported configuration and operations. PI executes tools
271
+ natively, without an added per-tool approval layer. Project resources follow PI's
272
+ native project trust decisions, with unresolved trust prompts routed to Android.
273
+ Machine-wide features such as uploads and deletion are available only when every
274
+ selected engine supports them; session controls use that session's own engine.
275
+ ACP approvals use the agent's offered one-time permission option, never an
276
+ automatic persistent grant. Unsupported operations return errors rather than
277
+ pretending to succeed. PI and ACP do not expose Copilot's remote-mode toggle.
278
+ Generic file uploads remain Copilot-only; PI also rejects image uploads, while
279
+ ACP images require the agent's negotiated image support.
280
+
281
+ Optional controls follow the [capability compatibility policy](../../docs/remote-sessions/protocol-compatibility-plan.md);
282
+ the historical registration `sdkVersion` is a compatibility marker, while
283
+ startup logs record the actual engine and SDK version.
284
+
285
+ ## Copilot uploaded files
286
+
287
+ Mobile uploads are integrity-checked transport bytes, not model API messages.
288
+ The PC Agent keeps generic files in its Copilot session state (`COPILOT_HOME`,
289
+ or the default Copilot home) and sends absolute paths through the official
290
+ [SDK file attachment contract](https://github.com/github/copilot-sdk/blob/v1.0.11/nodejs/src/types.ts);
291
+ images remain blob attachments. The local CLI decides native document handling
292
+ versus file-tool access: even [document support](https://github.com/github/copilot-sdk/blob/v1.0.11/docs/features/citations.md#attach-documents-to-a-message)
293
+ depends on the model, so an accepted upload does not guarantee every format is readable.
294
+ Files remain across acknowledgements, queued turns, failed sends and local restarts/resumes;
295
+ they are removed only after successful explicit session deletion, not after each turn.
296
+ This requires the runtime to share the PC Agent's filesystem and Copilot home.
297
+ The default stdio runtime and the SDK's in-process override are local; unverified
298
+ external clients do not advertise file uploads and reject them with an actionable error.
299
+ Moving a session to another machine does not transfer these local files.
package/dist/cli.js CHANGED
@@ -1730,6 +1730,7 @@ var SessionOptionsResultSchema = z18.discriminatedUnion("ok", [
1730
1730
  currentAgentMode: SessionAgentModeSchema.optional(),
1731
1731
  currentReasoningEffort: CurrentReasoningEffortSchema.optional(),
1732
1732
  environment: SessionEnvironmentInfoSchema.optional(),
1733
+ environmentPending: z18.literal(true).optional(),
1733
1734
  agentName: z18.string().trim().min(1).max(260).optional(),
1734
1735
  configOptions: z18.array(AgentConfigurationOptionSchema).max(32).optional()
1735
1736
  }),
@@ -2176,7 +2177,8 @@ var SessionAssistantPreviewSchema = z22.object({
2176
2177
  sourceEventIds: z22.array(IdSchema).min(1).max(1e3),
2177
2178
  text: z22.string().max(4096),
2178
2179
  final: z22.boolean(),
2179
- attachments: z22.array(ConversationAttachmentSchema.refine((attachment) => attachment.kind === "image" && attachment.imageRef === "sha256", "Assistant previews contain image references only")).max(4)
2180
+ attachments: z22.array(ConversationAttachmentSchema.refine((attachment) => attachment.kind === "image" && attachment.imageRef === "sha256", "Assistant previews contain image references only")).max(4),
2181
+ kind: z22.enum(["assistant-message", "task-completion"]).optional()
2180
2182
  });
2181
2183
  var SESSION_TIMELINE_PAGE_SIZE = 100;
2182
2184
  var SessionTimelinePageRequestSchema = z22.object({
@@ -2248,6 +2250,10 @@ var SessionTimelineInvalidatedSchema = z22.object({
2248
2250
  }).strict();
2249
2251
 
2250
2252
  // ../../shared/protocol/dist/sessions/prompts.js
2253
+ var SessionAvatarPersonaSchema = z23.object({
2254
+ role: z23.enum(["designer", "filmmaker", "developer", "secretary", "default"]),
2255
+ displayName: z23.string().trim().min(1).max(40).regex(/^[^\u0000-\u001f\u007f-\u009f]*$/).optional()
2256
+ }).strict().refine((value) => value.role === "default" ? value.displayName === void 0 : value.displayName !== void 0, { message: "A role requires a display name; default must not include one" });
2251
2257
  var MAX_PROMPT_IMAGE_BYTES = 3 * 1024 * 1024;
2252
2258
  var SessionPromptRequestSchema = z23.object({
2253
2259
  requestId: IdSchema,
@@ -2257,6 +2263,7 @@ var SessionPromptRequestSchema = z23.object({
2257
2263
  prompt: z23.string().trim().max(1e5),
2258
2264
  attachments: z23.array(PromptImageAttachmentSchema).max(4).optional(),
2259
2265
  fileAttachments: z23.array(PromptFileAttachmentSchema).max(4).optional(),
2266
+ avatarPersona: SessionAvatarPersonaSchema.optional(),
2260
2267
  mode: z23.enum(["enqueue", "immediate"]).default("enqueue")
2261
2268
  }).strict().superRefine((request, context) => {
2262
2269
  if (request.prompt.length === 0 && (request.attachments?.length ?? 0) === 0 && (request.fileAttachments?.length ?? 0) === 0) {
@@ -19391,7 +19391,7 @@ async function installPreparedPackage(options) {
19391
19391
  import { createConnection, createServer } from "node:net";
19392
19392
  import { join as join5, resolve as resolve3 } from "node:path";
19393
19393
 
19394
- // ../../shared/sdk/dist/chunks/chunk-E3XCZWRK.js
19394
+ // ../../shared/sdk/dist/chunks/chunk-OV77TRIH.js
19395
19395
  var IdSchema = external_exports.string().trim().min(1).max(256);
19396
19396
  var IsoDateSchema = external_exports.iso.datetime({ offset: true });
19397
19397
  var Base64UrlKeyIdSchema = external_exports.string().regex(/^[A-Za-z0-9_-]{22}$/u, "Expected a 16-byte base64url key ID");
@@ -19609,6 +19609,7 @@ var SessionOptionsResultSchema = external_exports.discriminatedUnion("ok", [
19609
19609
  currentAgentMode: SessionAgentModeSchema.optional(),
19610
19610
  currentReasoningEffort: CurrentReasoningEffortSchema.optional(),
19611
19611
  environment: SessionEnvironmentInfoSchema.optional(),
19612
+ environmentPending: external_exports.literal(true).optional(),
19612
19613
  agentName: external_exports.string().trim().min(1).max(260).optional(),
19613
19614
  configOptions: external_exports.array(AgentConfigurationOptionSchema).max(32).optional()
19614
19615
  }),
@@ -20029,7 +20030,8 @@ var SessionAssistantPreviewSchema = external_exports.object({
20029
20030
  sourceEventIds: external_exports.array(IdSchema).min(1).max(1e3),
20030
20031
  text: external_exports.string().max(4096),
20031
20032
  final: external_exports.boolean(),
20032
- attachments: external_exports.array(ConversationAttachmentSchema.refine((attachment) => attachment.kind === "image" && attachment.imageRef === "sha256", "Assistant previews contain image references only")).max(4)
20033
+ attachments: external_exports.array(ConversationAttachmentSchema.refine((attachment) => attachment.kind === "image" && attachment.imageRef === "sha256", "Assistant previews contain image references only")).max(4),
20034
+ kind: external_exports.enum(["assistant-message", "task-completion"]).optional()
20033
20035
  });
20034
20036
  var SESSION_TIMELINE_PAGE_SIZE = 100;
20035
20037
  var SessionTimelinePageRequestSchema = external_exports.object({
@@ -21321,6 +21323,10 @@ var GroupChatCreateDataSchema = external_exports.object({
21321
21323
  var GroupChatCreateResultDataSchema = external_exports.object({
21322
21324
  session: SessionSummarySchema.refine((session) => session.groupChat !== void 0, "Group creation must return a virtual group session")
21323
21325
  }).strict();
21326
+ var SessionAvatarPersonaSchema = external_exports.object({
21327
+ role: external_exports.enum(["designer", "filmmaker", "developer", "secretary", "default"]),
21328
+ displayName: external_exports.string().trim().min(1).max(40).regex(/^[^\u0000-\u001f\u007f-\u009f]*$/).optional()
21329
+ }).strict().refine((value) => value.role === "default" ? value.displayName === void 0 : value.displayName !== void 0, { message: "A role requires a display name; default must not include one" });
21324
21330
  var MAX_PROMPT_IMAGE_BYTES = 3 * 1024 * 1024;
21325
21331
  var SessionPromptRequestSchema = external_exports.object({
21326
21332
  requestId: IdSchema,
@@ -21330,6 +21336,7 @@ var SessionPromptRequestSchema = external_exports.object({
21330
21336
  prompt: external_exports.string().trim().max(1e5),
21331
21337
  attachments: external_exports.array(PromptImageAttachmentSchema).max(4).optional(),
21332
21338
  fileAttachments: external_exports.array(PromptFileAttachmentSchema).max(4).optional(),
21339
+ avatarPersona: SessionAvatarPersonaSchema.optional(),
21333
21340
  mode: external_exports.enum(["enqueue", "immediate"]).default("enqueue")
21334
21341
  }).strict().superRefine((request, context) => {
21335
21342
  if (request.prompt.length === 0 && (request.attachments?.length ?? 0) === 0 && (request.fileAttachments?.length ?? 0) === 0) {
@@ -21905,7 +21912,7 @@ var AndroidProtocolSchemas = {
21905
21912
  ProtocolError: ProtocolErrorSchema
21906
21913
  };
21907
21914
 
21908
- // ../../shared/sdk/dist/chunks/chunk-UE4QYZCG.js
21915
+ // ../../shared/sdk/dist/chunks/chunk-CVWUKZX7.js
21909
21916
  var OwnerSchema = external_exports.object({ pid: external_exports.number().int().positive(), instanceId: external_exports.uuid().optional() });
21910
21917
  var PeerChatRequestSchema = external_exports.object({
21911
21918
  sessionId: IdSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentknight/client",
3
- "version": "0.9.39",
3
+ "version": "0.9.40",
4
4
  "description": "AgentKnight PC Agent CLI for remote Copilot, PI and ACP coding sessions",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -41,7 +41,7 @@
41
41
  "qrcode": "1.5.4",
42
42
  "qrcode-terminal": "0.12.0",
43
43
  "zod": "4.5.4",
44
- "@agentknight/sdk": "0.9.39"
44
+ "@agentknight/sdk": "0.9.40"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/qrcode": "1.5.6",
@@ -49,8 +49,8 @@
49
49
  "esbuild": "0.28.2",
50
50
  "sharp": "0.34.5",
51
51
  "socket.io-client": "4.8.3",
52
- "@agentknight/shared": "0.1.0",
53
- "@agentknight/protocol": "0.1.0"
52
+ "@agentknight/protocol": "0.1.0",
53
+ "@agentknight/shared": "0.1.0"
54
54
  },
55
55
  "scripts": {
56
56
  "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",