@ravefox/space 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/LICENSE +21 -205
  2. package/README.md +104 -31
  3. package/bin/space.js +113 -0
  4. package/lib/agents.js +181 -0
  5. package/lib/boardTools.js +89 -0
  6. package/lib/credentials.js +95 -0
  7. package/lib/daemon.js +294 -0
  8. package/lib/harness.js +166 -0
  9. package/lib/http.js +101 -0
  10. package/lib/login.js +68 -0
  11. package/lib/mcp.js +39 -0
  12. package/lib/runtime.js +253 -0
  13. package/lib/store.js +96 -0
  14. package/lib/tools.js +93 -0
  15. package/lib/workspaceSandbox.js +77 -0
  16. package/lib/workspaceTools.js +160 -0
  17. package/lib/workspaceWorker.js +17 -0
  18. package/package.json +27 -46
  19. package/NOTICE +0 -55
  20. package/assets/webhook-sdk/python/bot.py +0 -63
  21. package/assets/webhook-sdk/python/commonly.py +0 -232
  22. package/node_modules/@commonlyai/seats/README.md +0 -25
  23. package/node_modules/@commonlyai/seats/package.json +0 -22
  24. package/node_modules/@commonlyai/seats/src/adapters/hermes.js +0 -264
  25. package/node_modules/@commonlyai/seats/src/adapters/stub.js +0 -24
  26. package/node_modules/@commonlyai/seats/src/contract.js +0 -48
  27. package/node_modules/@commonlyai/seats/src/failures.js +0 -44
  28. package/node_modules/@commonlyai/seats/src/harness-plan.js +0 -329
  29. package/node_modules/@commonlyai/seats/src/index.js +0 -22
  30. package/node_modules/@commonlyai/seats/src/process-group.js +0 -269
  31. package/node_modules/@commonlyai/seats/src/record/format.js +0 -737
  32. package/node_modules/@commonlyai/seats/src/record/otel.js +0 -238
  33. package/node_modules/@commonlyai/seats/src/runtime-observation.js +0 -29
  34. package/node_modules/@commonlyai/seats/src/seat-model.js +0 -17
  35. package/node_modules/@commonlyai/seats/src/supervisor.js +0 -308
  36. package/node_modules/@commonlyai/seats/src/trace/events.js +0 -46
  37. package/node_modules/@commonlyai/seats/src/trace/store.js +0 -276
  38. package/node_modules/@commonlyai/seats/src/turn-processes.js +0 -226
  39. package/node_modules/@commonlyai/seats/src/upstream-refusal.js +0 -418
  40. package/node_modules/@commonlyai/seats/src/valet/env.js +0 -201
  41. package/node_modules/@commonlyai/seats/src/valet/grant.js +0 -123
  42. package/node_modules/@commonlyai/seats/src/valet/permissions.js +0 -213
  43. package/node_modules/@commonlyai/seats/src/wire/provider-proxy.js +0 -529
  44. package/skills/commonly/SKILL.md +0 -233
  45. package/src/commands/agent.js +0 -6334
  46. package/src/commands/daemon.js +0 -933
  47. package/src/commands/dev.js +0 -153
  48. package/src/commands/doctor.js +0 -141
  49. package/src/commands/inbox.js +0 -330
  50. package/src/commands/login.js +0 -194
  51. package/src/commands/mcp.js +0 -56
  52. package/src/commands/pod.js +0 -120
  53. package/src/commands/task.js +0 -279
  54. package/src/commands/verify.js +0 -48
  55. package/src/index.js +0 -99
  56. package/src/lib/adapter-login.js +0 -76
  57. package/src/lib/adapters/broker-bridge-entry.js +0 -76
  58. package/src/lib/adapters/claude.js +0 -2207
  59. package/src/lib/adapters/codex-broker-bridge.mjs +0 -298
  60. package/src/lib/adapters/codex.js +0 -1898
  61. package/src/lib/adapters/dsh.js +0 -513
  62. package/src/lib/adapters/goose.js +0 -510
  63. package/src/lib/adapters/hermes.js +0 -18
  64. package/src/lib/adapters/index.js +0 -68
  65. package/src/lib/adapters/opencode.js +0 -1681
  66. package/src/lib/adapters/pi-commonly-mcp.mjs +0 -71
  67. package/src/lib/adapters/pi-mcp-client.mjs +0 -617
  68. package/src/lib/adapters/pi-shell-env.mjs +0 -41
  69. package/src/lib/adapters/pi.js +0 -1025
  70. package/src/lib/adapters/qwen.js +0 -523
  71. package/src/lib/adapters/seat-model.js +0 -8
  72. package/src/lib/adapters/stub.js +0 -1
  73. package/src/lib/adapters/tested-version.js +0 -106
  74. package/src/lib/api.js +0 -205
  75. package/src/lib/claim-outcome.js +0 -128
  76. package/src/lib/claimed-work-gate.js +0 -73
  77. package/src/lib/cli-hint.js +0 -33
  78. package/src/lib/commit-attribution.js +0 -391
  79. package/src/lib/config.js +0 -155
  80. package/src/lib/content-refusal.js +0 -94
  81. package/src/lib/credential-file.js +0 -208
  82. package/src/lib/daemon-agent-states.js +0 -95
  83. package/src/lib/daemon-hint.js +0 -18
  84. package/src/lib/daemon-logs.js +0 -43
  85. package/src/lib/daemon-service-windows.js +0 -263
  86. package/src/lib/daemon-service.js +0 -486
  87. package/src/lib/daemon-state.js +0 -84
  88. package/src/lib/daemon-store.js +0 -119
  89. package/src/lib/daemon-supervisor.js +0 -629
  90. package/src/lib/daemon-watch.js +0 -115
  91. package/src/lib/declared-mcp-guard.js +0 -284
  92. package/src/lib/default-environment.js +0 -207
  93. package/src/lib/device-login.js +0 -126
  94. package/src/lib/digest-frame.js +0 -151
  95. package/src/lib/doctor.js +0 -291
  96. package/src/lib/egress-proxy.js +0 -160
  97. package/src/lib/enforcement.js +0 -946
  98. package/src/lib/environment.js +0 -681
  99. package/src/lib/first-output-watchdog.js +0 -191
  100. package/src/lib/git-readonly-server.js +0 -138
  101. package/src/lib/git-readonly.js +0 -463
  102. package/src/lib/git-remote-commonly.mjs +0 -100
  103. package/src/lib/grant-broker-guard.js +0 -345
  104. package/src/lib/hooks-config.js +0 -238
  105. package/src/lib/host-gh-broker.js +0 -152
  106. package/src/lib/host-gh-shim.mjs +0 -98
  107. package/src/lib/inbox.js +0 -483
  108. package/src/lib/instance-proxy.js +0 -76
  109. package/src/lib/machine-host.js +0 -29
  110. package/src/lib/mcp-credential-delivery.js +0 -121
  111. package/src/lib/mcp-first-run.js +0 -50
  112. package/src/lib/mcp-home.js +0 -644
  113. package/src/lib/mcp-ready.js +0 -68
  114. package/src/lib/mcp-server-version.js +0 -123
  115. package/src/lib/mcp-token.js +0 -36
  116. package/src/lib/mcp-warm-child.mjs +0 -412
  117. package/src/lib/memory-bridge.js +0 -191
  118. package/src/lib/memory-import.js +0 -156
  119. package/src/lib/missing-harness.js +0 -31
  120. package/src/lib/model-unavailable.js +0 -154
  121. package/src/lib/native-runtime-inventory.js +0 -40
  122. package/src/lib/outsider-grant-mcp.js +0 -82
  123. package/src/lib/own-key-launch.js +0 -42
  124. package/src/lib/pod-catch-up.js +0 -55
  125. package/src/lib/pod-focus.js +0 -224
  126. package/src/lib/pod-tail.js +0 -68
  127. package/src/lib/poll-liveness.js +0 -103
  128. package/src/lib/poll-retry.js +0 -81
  129. package/src/lib/poller.js +0 -200
  130. package/src/lib/provider-proxy.js +0 -42
  131. package/src/lib/public-seat-mcp-flag.js +0 -36
  132. package/src/lib/public-tool-error.js +0 -60
  133. package/src/lib/public-withheld-tools.js +0 -48
  134. package/src/lib/reply-receipt.js +0 -55
  135. package/src/lib/resolve-on-path.js +0 -22
  136. package/src/lib/runtime-inventory.js +0 -56
  137. package/src/lib/runtime-observation.js +0 -37
  138. package/src/lib/sandbox/bwrap.js +0 -275
  139. package/src/lib/sandbox/codex-perimeter.js +0 -16
  140. package/src/lib/sandbox/host-check.js +0 -268
  141. package/src/lib/sandbox/mode.js +0 -49
  142. package/src/lib/sandbox/opencode-loopback.mjs +0 -68
  143. package/src/lib/sandbox/seatbelt.js +0 -684
  144. package/src/lib/sandbox/turn-dir.js +0 -56
  145. package/src/lib/sandbox/windows-unsandboxed.js +0 -183
  146. package/src/lib/sandbox/workspace-git-config.js +0 -243
  147. package/src/lib/sandbox/workspace-pin.js +0 -158
  148. package/src/lib/seat-runtime-controls.js +0 -61
  149. package/src/lib/seat-stop.js +0 -97
  150. package/src/lib/server-skills.js +0 -32
  151. package/src/lib/session-recycle.js +0 -219
  152. package/src/lib/session-store.js +0 -215
  153. package/src/lib/skill-prompt.js +0 -74
  154. package/src/lib/skills-import.js +0 -113
  155. package/src/lib/spawn-credential.js +0 -402
  156. package/src/lib/spawn-retry.js +0 -311
  157. package/src/lib/stable-install.js +0 -176
  158. package/src/lib/supervised-turn.js +0 -352
  159. package/src/lib/task.js +0 -235
  160. package/src/lib/turn-failure-notice.js +0 -177
  161. package/src/lib/unconfined-seat-guard.js +0 -94
  162. package/src/lib/update-check.js +0 -192
  163. package/src/lib/upstream-refusal.js +0 -1
  164. package/src/lib/webhook-server.js +0 -109
  165. package/src/lib/windows-command.js +0 -393
  166. package/src/lib/workspace-git.js +0 -87
  167. package/src/lib/workspace-trust.js +0 -162
package/LICENSE CHANGED
@@ -1,205 +1,21 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright [yyyy] [name of copyright owner]
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.
203
- Copyright 2026 Commonly
204
-
205
- Copyright 2026 Ravefox and contributors (Space modifications)
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ravefox and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,64 +1,137 @@
1
1
  # Space CLI
2
2
 
3
- Connect your AI agents to **Space**. Set up a computer once, run agents in the
4
- background and manage their connections from your workspace.
3
+ Connect your AI teammates to **Space**, keep them available in the background
4
+ and manage their connections from your workspace.
5
5
 
6
- Built and maintained by **Ravefox**. Space CLI has its own releases, updates
7
- and product roadmap.
6
+ Built and maintained by **Ravefox**.
8
7
 
9
- [Open Space](https://space.ravefox.dev) · [Roadmap](https://vote.ravefox.dev/roadmap) · [Support](https://vote.ravefox.dev/support) · [Telegram](https://t.me/ravefoxlab)
8
+ [Space](https://space.ravefox.dev) · [Roadmap](https://vote.ravefox.dev/roadmap) · [Support](https://vote.ravefox.dev/support) · [Telegram](https://t.me/ravefoxlab)
10
9
 
11
- ## Get started
10
+ ## Start
12
11
 
13
- Requires **Node.js 22 or newer** and an installed, signed-in agent such as Codex.
12
+ Install **Node.js 22+** and sign in to **Codex 0.164+** or **Claude Code** on the
13
+ computer that will run your agent. Then:
14
14
 
15
15
  ```sh
16
16
  npx -y @ravefox/space@latest daemon setup --instance https://space.ravefox.dev
17
17
  ```
18
18
 
19
- Setup installs Space CLI, signs you into Space, registers your computer and
20
- sets up its background service. In Space, choose **On my computer** when adding
21
- an agent, then select the registered computer.
19
+ Approve the Space sign-in in your browser. Setup registers this computer and
20
+ installs a stable, private copy of Space CLI and its background service. Choose
21
+ **On my computer** in Space and select this computer when connecting an agent.
22
22
 
23
- You can connect more agents to the same computer without starting a separate
24
- terminal listener for each one.
23
+ Background setup supports macOS and Linux with user systemd. A Linux server
24
+ without a user session can run `space daemon run` under an operator-managed
25
+ service. Foreground connections are also available on supported harness hosts.
25
26
 
26
- ## Update
27
+ ## Install and update
27
28
 
28
- Run the setup command again to update the installed CLI and service:
29
+ ```sh
30
+ npm install -g @ravefox/space@latest
31
+ space --help
32
+ ```
33
+
34
+ Run `daemon setup` again to update the installed background service. One
35
+ computer supervises up to four explicitly assigned Codex/Claude agents; it does
36
+ not adopt unrelated connections from your disk.
29
37
 
30
38
  ```sh
31
- npx -y @ravefox/space@latest daemon setup --instance https://space.ravefox.dev
39
+ space daemon status
40
+ space daemon logs --lines 50
41
+ space daemon restart
42
+ space daemon stop
32
43
  ```
33
44
 
34
- ## Install the command globally
45
+ ## Connect one agent directly
46
+
47
+ Copy the scoped connection values from Space into your environment, then:
35
48
 
36
49
  ```sh
37
- npm install -g @ravefox/space@latest
38
- space --help
50
+ space agent run my-agent --adapter codex
51
+ ```
52
+
53
+ Space accepts `SPACE_API_URL` and `SPACE_AGENT_TOKEN`. Existing server-provided
54
+ `COMMONLY_API_URL` and `COMMONLY_AGENT_TOKEN` connection variables also work.
55
+ The token is saved privately after its agent identity is verified. Close the
56
+ terminal to stop a foreground listener; use daemon setup for background work.
57
+
58
+ ```sh
59
+ space agent list
60
+ space agent configure my-agent --model MODEL --instructions-file ./instructions.md
61
+ space agent run my-agent --workspace ./project --allow write
62
+ space doctor
63
+ ```
64
+
65
+ Codex model commands use a restricted permission profile with command network
66
+ access disabled and credential directories denied. Claude runs with built-in
67
+ tools disabled and only the Space MCP tools enabled. Both Codex and Claude can read an explicitly selected project through Space
68
+ project tools. `--allow write` permits project edits; `--allow web` adds public
69
+ web lookups. Combine them with `--allow write,web`. Local file tools run in a
70
+ separate macOS/Linux OS sandbox; web lookups validate and pin public DNS and
71
+ refuse private network targets. Unrestricted mode, arbitrary external MCP
72
+ servers, provider overrides and automatic local skill imports are refused
73
+ explicitly.
74
+ Space tools read current-pod context, messages, attachments, posts and skills;
75
+ write permitted agent memory, comment on known posts and propose human-approved
76
+ actions. The runner posts the final reply, preventing duplicate chat sends.
77
+
78
+ ## Settings and authorization
79
+
80
+ State belongs to Space under `~/.space` (or `SPACE_HOME`), with private files
81
+ and separate human, machine, agent and short-lived turn credentials. Model
82
+ access belongs to the harness on the computer running it. Space CLI does not
83
+ include a subscription or transfer model credentials between computers.
84
+
85
+ A local agent needs the computer awake and online. For replies while a laptop
86
+ is off, connect an always-on server and authenticate its harness there.
87
+ Each turn receives only its current pod context. Personal model history and
88
+ other projects are not automatically imported.
89
+
90
+ ## Project access, web and memory
91
+
92
+ ```sh
93
+ space agent run my-agent --adapter claude --workspace ./project --allow write,web
94
+ space agent import-memory my-agent --file ./selected-context.md
95
+ space agent attach codex --pod POD_ID --name next-agent --memory-from orbit-source --memory-instance default
39
96
  ```
40
97
 
41
- ## Run an agent in the foreground
98
+ Permissions are explicit per connection and default to read-only/no web.
99
+ File imports require the server’s atomic memory-append API; older servers
100
+ refuse safely rather than overwriting memory. Memory import adds only the
101
+ selected context and preserves existing target
102
+ memory; it does not import model session history or credentials. Hosted memory
103
+ handoff requires that the signed-in Space user owns the source and target.
42
104
 
43
- Use the connection settings shown in Space:
105
+ Agents also receive the current pod's task board and can list, read, create and
106
+ update tasks using scoped tools. `context.task` is a request focus, not the
107
+ board inventory. Chat replies in group pods stay attached to their source
108
+ message.
109
+
110
+ ## Existing connections
111
+
112
+ The 0.4 line is a fresh implementation. It does not read old connection state
113
+ implicitly. To import one existing private connection file, use:
44
114
 
45
115
  ```sh
46
- npx -y @ravefox/space@latest agent run my-agent --adapter codex
116
+ space migrate /absolute/path/to/connection.json
47
117
  ```
48
118
 
49
- This process runs until you stop it or close the terminal. Use background setup
50
- for a persistent connection.
119
+ The source remains intact. Unsupported custom tools, provider settings or
120
+ unrestricted permissions need explicit reconfiguration. Existing running
121
+ services keep their installed version until you intentionally update them.
51
122
 
52
- ## Where your agent runs
123
+ ## Use Space tools in another MCP client
53
124
 
54
- An agent on your computer needs that computer to be awake and online. To keep
55
- an agent available while your laptop is off, connect it from an always-on server
56
- and sign in to its model provider there.
125
+ ```sh
126
+ space mcp config my-agent --pod POD_ID
127
+ ```
57
128
 
58
- Space CLI uses the model access configured on the computer where the agent
59
- runs. It does not include a model subscription or silently transfer credentials
60
- between computers.
129
+ This prints an stdio MCP configuration with a private record reference, not the
130
+ agent token. Keep the record and your Space directory private.
61
131
 
62
132
  ## Feedback
63
133
 
64
- [Request a feature](https://vote.ravefox.dev/roadmap), [ask a question or report a bug](https://vote.ravefox.dev/support), or [join Ravefox on Telegram](https://t.me/ravefoxlab).
134
+ [Request a feature](https://vote.ravefox.dev/roadmap), [ask a question or report a bug](https://vote.ravefox.dev/support), or [join Telegram](https://t.me/ravefoxlab).
135
+
136
+ Space CLI source is released under the MIT license, copyright Ravefox.
137
+ Dependencies retain their respective licenses.
package/bin/space.js ADDED
@@ -0,0 +1,113 @@
1
+ #!/usr/bin/env node
2
+ // Copyright 2026 Ravefox. SPDX-License-Identifier: MIT
3
+ import { Command } from 'commander';
4
+ import { readFile, readdir } from 'node:fs/promises';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { join, resolve } from 'node:path';
7
+ import { readState, writeState, stateDir, sessionFor } from '../lib/store.js';
8
+ import { SpaceClient } from '../lib/http.js';
9
+ import { login, ensureLogin } from '../lib/login.js';
10
+ import { runAgent, agentKey, validateAgent } from '../lib/runtime.js';
11
+ import { availableAdapters } from '../lib/harness.js';
12
+ import { runMcp } from '../lib/mcp.js';
13
+ import { setupDaemon, registerMachine, runDaemon, daemonStatus, daemonService, daemonLogs, unregisterMachine } from '../lib/daemon.js';
14
+ import { importAgent, attachAgent, listAgents, lookupAgent, removeAgent, migrateLegacy, importMemory } from '../lib/agents.js';
15
+
16
+ const meta = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8'));
17
+ const program = new Command().name('space').description('Connect and manage your AI teammates in Space').version(meta.version).showHelpAfterError();
18
+ const print = value => console.log(typeof value === 'string' ? value : JSON.stringify(value, null, 2));
19
+ const stop = new AbortController();
20
+ process.once('SIGINT', () => stop.abort(new Error('Stopped')));
21
+ process.once('SIGTERM', () => stop.abort(new Error('Stopped')));
22
+ const withInstance = command => command.option('--instance <url>', 'Space server URL');
23
+ const withIdentity = command => withInstance(command).option('--instance-id <id>', 'Agent identity variant', 'default');
24
+ const human = async options => new SpaceClient(await ensureLogin({ instance: options.instance }));
25
+
26
+ withInstance(program.command('login').description('Sign in through your browser')).option('--no-browser', 'Print the approval URL without opening it').action(async options => { await login({ instance: options.instance, open: options.browser }); });
27
+ withInstance(program.command('whoami').description('Show the signed-in Space account')).action(async options => {
28
+ const result = await (await human(options)).get('/api/auth/user');
29
+ const user = result.user || result;
30
+ print({ username: user.username, email: user.email, id: user._id || user.id, instance: sessionFor(options.instance).url });
31
+ });
32
+ program.command('doctor').description('Check Node, installed harnesses and saved connections').action(async () => print({ version: meta.version, node: process.versions.node, state: stateDir(), adapters: await availableAdapters(), agents: await listAgents(), machine: readState('machine.json')?.machineName || null }));
33
+
34
+ const agent = program.command('agent').description('Connect an AI teammate');
35
+ agent.command('list').description('List local connections without secrets').action(async () => print(await listAgents()));
36
+ withIdentity(agent.command('run <name>').description('Keep one agent listening until stopped'))
37
+ .option('--adapter <name>', 'codex or claude')
38
+ .option('--workspace <path>', 'Local project directory')
39
+ .option('--model <name>', 'Explicit model for this connection')
40
+ .option('--allow <permissions>', 'Explicit permissions: write, web or write,web')
41
+ .option('--instructions <text>', 'Instructions for this agent')
42
+ .action(async (name, options) => {
43
+ let record;
44
+ if (process.env.SPACE_AGENT_TOKEN || process.env.COMMONLY_AGENT_TOKEN) record = await importAgent({ name, ...options });
45
+ else record = await lookupAgent({ name, ...options });
46
+ if (!record) throw new Error('No saved connection. Use the connection command from Space or space agent attach.');
47
+ const requested = options.allow?.split(',').map(x => x.trim()).filter(Boolean) || [];
48
+ if (requested.some(x => !['write','web'].includes(x))) throw new Error('Supported permissions are write and web');
49
+ record = { ...record, ...(options.adapter ? { adapter: options.adapter } : {}), ...(options.workspace ? { workspacePath: resolve(options.workspace) } : {}), ...(options.model ? { model: options.model } : {}), ...(options.instructions ? { instructions: options.instructions } : {}), ...(options.allow !== undefined ? { sandbox: requested.includes('write') ? 'workspace-write' : 'read-only', allowWrite: requested.includes('write'), allowWeb: requested.includes('web') } : {}) };
50
+ await runAgent({ record, signal: stop.signal });
51
+ });
52
+ withIdentity(agent.command('attach <adapter>').description('Create an agent connection in a pod'))
53
+ .requiredOption('--pod <id>', 'Space pod ID').requiredOption('--name <name>', 'Agent name')
54
+ .option('--env <file>', 'Explicit connection environment file')
55
+ .option('--memory-from <agent>', 'Copy Space memory from an agent you own')
56
+ .option('--memory-instance <id>', 'Source identity variant', 'default')
57
+ .action(async (adapter, options) => { const result = await attachAgent({ adapter, ...options }); print({ connected: true, agent: result.agentName, instanceId: result.instanceId, adapter: result.adapter }); });
58
+ withIdentity(agent.command('detach <name>').description('Remove a local connection; leaves the server agent intact')).action(async (name, options) => print(await removeAgent({ name, ...options })));
59
+ withIdentity(agent.command('import-memory <name>').description('Explicitly add selected context to an owned agent'))
60
+ .option('--file <path>', 'Read one selected UTF-8 context file')
61
+ .option('--from <agent>', 'Read an owned saved Space connection')
62
+ .option('--from-instance-id <id>', 'Source identity variant', 'default')
63
+ .action(async (name, options) => print(await importMemory({ name, ...options })));
64
+ withIdentity(agent.command('configure <name>').description('Change local model and instructions for a saved connection')).option('--model <name>').option('--instructions-file <file>').action(async (name, options) => {
65
+ const record = await lookupAgent({ name, ...options });
66
+ if (!record) throw new Error('No saved connection');
67
+ if (options.model) record.model = options.model;
68
+ if (options.instructionsFile) { const content = await readFile(options.instructionsFile, 'utf8'); if (content.length > 16000) throw new Error('Instructions exceed 16,000 characters'); record.instructions = content; }
69
+ validateAgent(record); writeState(`agents/${agentKey(record)}.json`, record); print({ updated: true, agent: record.agentName });
70
+ });
71
+ program.command('migrate <file>').description('Explicitly import one existing connection file without deleting the source').action(async path => { const record = await migrateLegacy({ path }); print({ imported: true, agent: record.agentName, instanceId: record.instanceId }); });
72
+
73
+ const daemon = program.command('daemon').description('Manage this computer and its background agents');
74
+ for (const [name, handler] of [['setup', setupDaemon], ['register', registerMachine]]) withInstance(daemon.command(name)).option('--name <name>', 'Computer name').action(async options => print(await handler(options)));
75
+ daemon.command('run').description('Run the computer supervisor in the foreground').action(() => runDaemon({ signal: stop.signal }));
76
+ daemon.command('status').description('Show computer and agent state').action(async () => print(await daemonStatus()));
77
+ daemon.command('logs').description('Show recent background service logs').option('--lines <count>', 'Number of lines', '50').action(async options => print(await daemonLogs(options)));
78
+ for (const action of ['install', 'start', 'stop', 'restart', 'uninstall']) daemon.command(action).action(async () => print(await daemonService(action)));
79
+ withInstance(daemon.command('unregister')).action(async options => print(await unregisterMachine(options)));
80
+
81
+ const mcp = program.command('mcp').description('Use Space tools from an MCP client');
82
+ mcp.command('serve').description('Serve MCP tools over stdio').requiredOption('--record <name>', 'Private record inside SPACE_HOME').option('--pod <id>', 'Current pod').action(async options => {
83
+ if (!/^(?:agents|turns)\/[a-z0-9-]+\.json$/.test(options.record)) throw new Error('Invalid MCP record name');
84
+ const record = readState(options.record);
85
+ if (!record?.runtimeToken) throw new Error('No saved agent credential');
86
+ const server = await runMcp({ record, podId: options.pod || record.podId });
87
+ stop.signal.addEventListener('abort', () => void server.close(), { once: true });
88
+ });
89
+ withIdentity(mcp.command('config <name>').description('Print MCP configuration without exposing a token')).option('--pod <id>').action(async (name, options) => {
90
+ const record = await lookupAgent({ name, ...options });
91
+ if (!record) throw new Error('No saved connection');
92
+ const pod = options.pod || record.podId;
93
+ if (!pod) throw new Error('Specify a pod with --pod');
94
+ print({ mcpServers: { space: { command: process.execPath, args: [fileURLToPath(import.meta.url), 'mcp', 'serve', '--record', `agents/${agentKey(record)}.json`, '--pod', pod], env: { SPACE_HOME: stateDir() } } } });
95
+ });
96
+ const pod = program.command('pod').description('Work with Space conversations');
97
+ withInstance(pod.command('list')).action(async options => print(await (await human(options)).get('/api/pods')));
98
+ withInstance(pod.command('tail <id>')).option('--limit <count>', 'Recent messages', '20').action(async (id, options) => {
99
+ if (!/^[a-f\d]{24}$/i.test(id)) throw new Error('Invalid pod ID');
100
+ const limit = Number(options.limit); if (!Number.isSafeInteger(limit) || limit < 1 || limit > 50) throw new Error('Limit must be 1–50');
101
+ print(await (await human(options)).get(`/api/messages/${id}`, { limit }));
102
+ });
103
+ withInstance(pod.command('send <id> <text>')).action(async (id, text, options) => {
104
+ if (!/^[a-f\d]{24}$/i.test(id)) throw new Error('Invalid pod ID');
105
+ const result = await (await human(options)).post(`/api/messages/${id}`, { content: text });
106
+ print({ sent: true, id: result._id || result.message?._id || result.id });
107
+ });
108
+ program.addHelpText('after', '\nGet started:\n npx -y @ravefox/space@latest daemon setup\n\nSpace: https://space.ravefox.dev\nSupport: https://vote.ravefox.dev/support\n');
109
+ try { await program.parseAsync(process.argv); }
110
+ catch (error) {
111
+ if (!stop.signal.aborted) console.error(`Space: ${error.message}`);
112
+ process.exitCode = stop.signal.aborted ? 0 : 1;
113
+ }