@moxuli/moremote 0.0.0-stage → 0.1.1

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 (67) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +31 -0
  3. package/README.md +73 -2
  4. package/bin/moremote-cli.js +34 -0
  5. package/bin/moremote-service.js +7 -0
  6. package/dist/bindings.d.ts +6 -0
  7. package/dist/bindings.js +4 -0
  8. package/dist/cli.d.ts +1 -0
  9. package/dist/cli.js +325 -0
  10. package/dist/cloud-client.d.ts +43 -0
  11. package/dist/cloud-client.js +128 -0
  12. package/dist/config.d.ts +36 -0
  13. package/dist/config.js +68 -0
  14. package/dist/control-transport.d.ts +4 -0
  15. package/dist/control-transport.js +68 -0
  16. package/dist/control.d.ts +3 -0
  17. package/dist/control.js +297 -0
  18. package/dist/controls.d.ts +15 -0
  19. package/dist/controls.js +36 -0
  20. package/dist/crypto.d.ts +23 -0
  21. package/dist/crypto.js +68 -0
  22. package/dist/evidence.d.ts +19 -0
  23. package/dist/evidence.js +4 -0
  24. package/dist/journal.d.ts +104 -0
  25. package/dist/journal.js +132 -0
  26. package/dist/limits.d.ts +21 -0
  27. package/dist/limits.js +8 -0
  28. package/dist/official-client.d.ts +120 -0
  29. package/dist/official-client.js +162 -0
  30. package/dist/operations.d.ts +71 -0
  31. package/dist/operations.js +210 -0
  32. package/dist/pairing.d.ts +19 -0
  33. package/dist/pairing.js +68 -0
  34. package/dist/permission.d.ts +9 -0
  35. package/dist/permission.js +66 -0
  36. package/dist/projection.d.ts +24 -0
  37. package/dist/projection.js +35 -0
  38. package/dist/resources.d.ts +76 -0
  39. package/dist/resources.js +299 -0
  40. package/dist/runtime.d.ts +8 -0
  41. package/dist/runtime.js +375 -0
  42. package/dist/service.d.ts +21 -0
  43. package/dist/service.js +310 -0
  44. package/dist/supervisor.d.ts +15 -0
  45. package/dist/supervisor.js +175 -0
  46. package/dist/update-state.d.ts +30 -0
  47. package/dist/update-state.js +158 -0
  48. package/dist/updater.d.ts +9 -0
  49. package/dist/updater.js +152 -0
  50. package/docs/README.md +23 -0
  51. package/docs/STATE.md +155 -0
  52. package/docs/configuration.md +37 -0
  53. package/docs/conventions.md +9 -0
  54. package/docs/decisions/0001-managed-updates.md +19 -0
  55. package/docs/plans/2026-11-10-managed-updates.md +26 -0
  56. package/docs/plans/2026-11-10-notification-delivery.md +118 -0
  57. package/docs/releasing.md +34 -0
  58. package/docs/specs/01-architecture.md +102 -0
  59. package/docs/specs/02-encrypted-delivery.md +194 -0
  60. package/docs/specs/03-api-contract.md +397 -0
  61. package/docs/specs/04-control-and-receipt-lifecycle.md +175 -0
  62. package/docs/specs/05-endpoint-and-lifecycle.md +57 -0
  63. package/docs/specs/06-managed-updates.md +55 -0
  64. package/licenses/Paseo-0.15.3.txt +211 -0
  65. package/package.json +37 -4
  66. package/vectors/bearer-v1.json +6 -0
  67. package/vectors/envelope-v1.json +24 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
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.
package/NOTICE ADDED
@@ -0,0 +1,31 @@
1
+ MoRemote CLI
2
+ Copyright 2026 MoRemote CLI contributors
3
+ Original code: Apache License, Version 2.0 (root LICENSE).
4
+
5
+ This is an independent interoperability project, not an official Paseo distribution.
6
+
7
+ Paseo client/protocol/relay0.15.3 provenance and retained attribution:
8
+ Copyright (c) 2025-present Mohamed Boudra
9
+ Official v0.15.3 annotated tag944c98a8fd802586d6d79ac375d4fd811c6545df points to commit d91ae138cb931447635e94296023414a58bedcc5. Its root LICENSE explicitly licenses non-third-party Paseo code under Apache-2.0 and retains third-party components under their own terms. Exact upstream license text is retained in licenses/Paseo-0.15.3.txt. This conclusion comes from that release's source LICENSE, not absent npm license fields.
10
+ License: https://raw.githubusercontent.com/getpaseo/paseo/d91ae138cb931447635e94296023414a58bedcc5/LICENSE
11
+ Release reference: https://api.github.com/repos/getpaseo/paseo/git/tags/944c98a8fd802586d6d79ac375d4fd811c6545df
12
+ Matching client package: https://github.com/getpaseo/paseo/blob/d91ae138cb931447635e94296023414a58bedcc5/packages/client/package.json
13
+ Matching protocol package: https://github.com/getpaseo/paseo/blob/d91ae138cb931447635e94296023414a58bedcc5/packages/protocol/package.json
14
+ The corresponding npm distributions are pinned exactly to0.15.3 with integrity metadata in package-lock.json. No claim of a signed npm-to-source attestation is made; the tag is unsigned and npm metadata supplies no gitHead.
15
+
16
+ Local-credential target normalization/authentication in src/official-client.ts is adapted from the official interface with bounded read-only I/O and a separate companion identity. This is changed independent companion code; no official daemon files are modified. The exported internal SDK interface is unsupported upstream and intentionally exact-version-pinned and exercised by wire consumers.
17
+
18
+ qrcode1.5.4 — retained upstream license:
19
+
20
+ The MIT License (MIT)
21
+
22
+ Copyright (c) 2012 Ryan Day
23
+
24
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
25
+
26
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
27
+
28
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
+
30
+
31
+ Other dependencies retain their own licenses/notices in their npm distributions. The root Apache license does not relicense third-party components. No public publication has occurred.
package/README.md CHANGED
@@ -1,3 +1,74 @@
1
- # Temporary Holding Version
1
+ # MoRemote CLI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Optional, independent Apache-2.0 computer companion for MoRemote and an **unmodified Paseo 0.15.3** daemon. Existing official-only clients keep working without this project or its cloud.
4
+
5
+ Canonical repository/command: `moremote-cli`; public npm package:
6
+ **`@moxuli/moremote`**; source entry: `bin/moremote-cli.js`.
7
+ There is no unscoped npm alias or automatic adoption of foreign/old state.
8
+
9
+ ## Install the published package
10
+
11
+ ```sh
12
+ npm install -g @moxuli/moremote
13
+ moremote-cli --help
14
+ ```
15
+
16
+ Requires an available public package and a user-owned npm prefix; never use sudo
17
+ or upgrade global Node/tools on this project's behalf. First installed-package
18
+ `run` or explicit `service-install --yes` creates an independently owned private
19
+ managed installation with automatic updates enabled. Source-checkout `run`
20
+ alone stays manual. No command starts/upgrades the official daemon.
21
+
22
+ ## Build and foreground use
23
+
24
+ Requires Node **24.13.0 or later on Node 24** and npm. No installer scripts or service registration run during setup.
25
+
26
+ ```sh
27
+ npm ci --ignore-scripts
28
+ npm run build
29
+ node bin/moremote-cli.js --help
30
+ node bin/moremote-cli.js configure --target 127.0.0.1:6767
31
+ node bin/moremote-cli.js check --connect
32
+ node bin/moremote-cli.js run
33
+ ```
34
+
35
+ The example endpoint is synthetic. Omit `--target` to use the official `paseo.pid` listen address under `PASEO_HOME` (otherwise the platform home’s `.paseo`). Auth follows the official CLI: target password, then `PASEO_PASSWORD`, otherwise a rotating local credential only when the selected target exactly matches the pid listen address after official normalization. Credentials are never printed or uploaded. No automatic daemon start or upgrade.
36
+
37
+ For a separately operated relay:
38
+
39
+ ```sh
40
+ node bin/moremote-cli.js configure --api-origin https://relay.example.test --cloud-on
41
+ node bin/moremote-cli.js pair
42
+ node bin/moremote-cli.js run
43
+ ```
44
+
45
+ `pair` explicitly prints a **secret**, ten-minute, one-phone QR/link. Do not share screenshots or put it in logs. `--json` emits the canonical offer for explicit paste. It waits for the one-use claim and verifies the phone’s encrypted proof before activating that phone, within the original offer deadline. Each phone gets its own local 32-byte root key; only the phone receives it, never the relay. See [wire contracts](docs/specs/02-encrypted-delivery.md), [endpoint controls](docs/specs/04-control-and-receipt-lifecycle.md) and [endpoint behavior](docs/specs/05-endpoint-and-lifecycle.md).
46
+
47
+ ## What leaves the computer
48
+
49
+ The cloud sees pairing/operation/event identities, times, sizes, bounded transport states, scoped capability hashes and encrypted command/control/receipt/state/attention bodies. Attention routing includes a separately derived opaque conversation tag; default push text is generic. Endpoint-encrypted snapshots include verified daemon identity, host name, bounded task/title/current raw request metadata and actual available usage. Original supported question/approval forms are included only within strict bounds, to answer that exact request. No complete chat/history, code files, model keys or official Paseo passwords/local credentials are uploaded. The relay cannot decrypt or manufacture accepted commands. This is not forward secrecy.
50
+
51
+ Only exact message sends and responses to an **actual current** question/approval are supported. Admission accepted is not task completion. Unknown official outcomes are reconciled, **never blindly resent**, even when the same message ID is available.
52
+ Endpoint cancellation/revocation uses authenticated encrypted controls and durable local tombstones, not trust in a cloud DELETE result. An offline/withheld control is waiting/unknown, not endpoint-confirmed. A dispatched operation is too late to undo. Exact request-instance bindings retire on source/resolution/connection changes. Minimal revisioned encrypted receipts remain auditable for24h after original expiry, separately from short-lived user payloads; positive admission never regresses to unknown.
53
+
54
+ ## Lifecycle and ownership
55
+
56
+ - `status` and `check` are redacted. Only explicit `check --connect` contacts the selected official daemon (read-only).
57
+ - `service-install --yes`: explicit per-user LaunchAgent on macOS, systemd user unit on Linux, or least-privilege interactive-user **logon task** on Windows (not an administrator Windows Service). Foreground `run` needs none of these. No sudo/admin installation.
58
+ - `stop`: stop only the owned companion registration/runtime; never signal an official process. Linux/Windows registration remains available for a future login; macOS bootout leaves its owned plist available for explicit reinstallation.
59
+ - `unpair --pair-id <exact-id>`: revoke one phone, leaving other phones unchanged. Stop the runtime first.
60
+ - `cloud-disable`: stop the companion, persist local cloud-off and per-pair execution tombstones, then relay-revoke every own pairing when reachable. An unreachable relay is pending, not success; local execution remains off. Run again to retry relay revocation. Protected keys are retained for final read-only control/outcome audit; they do not restore execution authority.
61
+ - `update --version X.Y.Z --yes`: install only exact `@moxuli/moremote` into immutable private state with scripts disabled and queue a compatible candidate. A running managed supervisor drains only at a whole journalled-cycle boundary, starts the candidate and rolls back on startup failure; no service reinstallation is needed. Previously verified prefixes and bootstrap are retained. No global npm/Paseo/Node change. A staged package is never called active; use `status` for actual runtime.version and active/pending/previous/error/check facts.
62
+ - `auto-update --disable` / `auto-update --enable`: durable opt-out/in. Default managed checks are at most every six hours, including after restart; quota pauses can delay them. Disable wins during staging/drain and prevents queued activation until re-enabled. Foreign/read-only state fails visibly. Source-checkout/manual mode is explicit in status. See [update contracts](docs/specs/06-managed-updates.md).
63
+ - `uninstall --yes`: remove only owned registration/managed package; retain keys and dedupe journal. `--purge` explicitly deletes companion state too. It cannot erase cloud records while offline and does not undo dispatched actions. Disable/revoke cloud before purging. Source checkouts/global-package removal belongs to the tool that installed them.
64
+
65
+ Default CLI state uses `LOCALAPPDATA/MoRemoteCLI` on Windows, `~/Library/Application Support/MoRemoteCLI` on macOS, or `XDG_STATE_HOME/moremote-cli` (fallback `~/.local/state/moremote-cli`) on Linux. Override with `MOREMOTE_CLI_HOME` or `--data-dir`. Service identities are `com.moremote.cli` (macOS), `moremote-cli.service` (Linux) and `MoRemoteCLI` (Windows logon task). Private POSIX directory/file modes are 0700/0600; Windows relies on the user profile ACL, which operators must protect. Keep it separate from official Paseo data; never point it at an official data directory.
66
+
67
+ ## Checks and real external gates
68
+
69
+ `npm run check` runs typecheck, behavioral tests and compilation. Tests use synthetic data/temp directories, no real host session, login registration, deployment or APNs call. Integration instructions and unexercised gates are in [STATE](docs/STATE.md). Real native notification delivery requires separately configured/deployed Cloudflare and Apple APNs credentials/capabilities, an authorized app build and a physical device. Cross-OS service installation and isolated real-daemon acceptance are separate checks; local tests cannot prove them.
70
+
71
+ [Docs](docs/README.md) · [Contributing](CONTRIBUTING.md) · [License](LICENSE) · [Notices](NOTICE)
72
+
73
+ Public release prerequisites, existing-secret setup and exact verification commands:
74
+ [releasing](docs/releasing.md). Checked-in workflows are not proof of a published package.
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ import {resolve} from 'node:path';
3
+ import {fileURLToPath} from 'node:url';
4
+ import {spawn} from 'node:child_process';
5
+ import {realpath} from 'node:fs/promises';
6
+ async function main(){
7
+ const {dataDirectory}=await import('../dist/config.js');
8
+ const {readUpdateState}=await import('../dist/update-state.js');
9
+ const {managedEntry}=await import('../dist/service.js');
10
+ // Dispatch before parsing: an old global frontend must accept a newer
11
+ // selected CLI's flags, including --version. Never overwrite that frontend.
12
+ let dir=dataDirectory();const args=process.argv.slice(2);
13
+ for(let i=0;i<args.length&&args[i]!=='--';i++){
14
+ if(args[i]==='--data-dir'&&args[i+1])dir=args[++i];
15
+ else if(args[i].startsWith('--data-dir='))dir=args[i].slice(11);
16
+ }
17
+ const state=readUpdateState(resolve(dir));
18
+ if(state&&!process.env.MOREMOTE_MANAGED_CHILD){
19
+ const entry=await managedEntry(resolve(dir),state.active);
20
+ if(await realpath(entry)!==await realpath(fileURLToPath(import.meta.url))){
21
+ const child=spawn(process.execPath,[entry,...args],{stdio:['inherit','inherit','inherit','ipc'],shell:false,windowsHide:true});
22
+ const result=Promise.withResolvers();child.once('error',result.reject);child.once('exit',code=>result.resolve(code??1));
23
+ const ready=message=>{if(message&&typeof message==='object'&&message.kind==='moremote-ready'&&typeof message.version==='string'&&process.send&&process.connected)process.send({kind:'moremote-ready',version:message.version},undefined,undefined,()=>{})};
24
+ child.on('message',ready);
25
+ const forward=signal=>{if(child.exitCode!==null||child.signalCode!==null)return;if(process.platform==='win32'&&child.connected)child.send({kind:'moremote-parent-stop'},()=>{});else child.kill(signal)};
26
+ const interrupt=()=>forward('SIGINT'),terminate=()=>forward('SIGTERM');
27
+ process.once('SIGINT',interrupt);process.once('SIGTERM',terminate);
28
+ if(process.send){process.once('disconnect',terminate);if(!process.connected)terminate()}
29
+ try{process.exitCode=await result.promise}finally{child.removeListener('message',ready);process.removeListener('SIGINT',interrupt);process.removeListener('SIGTERM',terminate);process.removeListener('disconnect',terminate);if(process.connected)process.disconnect()}return;
30
+ }
31
+ }
32
+ await import('../dist/cli.js');
33
+ }
34
+ main().catch(error=>{console.error(error instanceof Error&&/^[A-Z0-9_]+$/.test(error.message)?error.message:'CLI_BOOTSTRAP_FAILED');process.exitCode=1;});
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ // Retained with its immutable bootstrap package; never points at the global install.
3
+ import('../dist/supervisor.js').then(async ({runSupervisor})=>{
4
+ if(process.argv[2]==='--probe')return;
5
+ const index=process.argv.indexOf('--data-dir');if(index<0||!process.argv[index+1])throw Error('DATA_DIRECTORY_REQUIRED');
6
+ process.exitCode=await runSupervisor(process.argv[index+1]);
7
+ }).catch(()=>{console.error('MANAGED_SUPERVISOR_FAILED');process.exitCode=1;});
@@ -0,0 +1,6 @@
1
+ import type { Pair } from './config.js';
2
+ import type { OperationJournal, Occurrence } from './journal.js';
3
+ export declare function occurrenceBinding(pair: Pick<Pair, 'pairId' | 'rootKey'>, o: Occurrence): Promise<string>;
4
+ export declare function bindRequest(journal: OperationJournal, pair: Pick<Pair, 'pairId' | 'rootKey'>, serverId: string, agentId: string, generation: string, request: {
5
+ id: string;
6
+ }): Promise<string>;
@@ -0,0 +1,4 @@
1
+ import { webcrypto } from 'node:crypto';
2
+ import { deriveKey, decode } from './crypto.js';
3
+ export async function occurrenceBinding(pair, o) { const key = await webcrypto.subtle.importKey('raw', Uint8Array.from(await deriveKey(decode(pair.rootKey, 32), pair.pairId, 'requestBinding')), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']); return Buffer.from(await webcrypto.subtle.sign('HMAC', key, Buffer.from(JSON.stringify([1, o.serverId, o.agentId, o.requestId, o.occurrenceId, o.fingerprint])))).toString('base64url'); }
4
+ export async function bindRequest(journal, pair, serverId, agentId, generation, request) { return occurrenceBinding(pair, journal.observe(serverId, agentId, generation, request)); }
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};