@graftland/plugin-remote 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +76 -2
- package/README.zh-CN.md +71 -0
- package/README.zh-TW.md +71 -0
- package/dist/Auth-BElTC9_X.js +6 -0
- package/dist/Auth.d.ts +49 -0
- package/dist/Auth.d.ts.map +1 -0
- package/dist/Auth.js +8 -0
- package/dist/Auth.js.map +1 -0
- package/dist/Bootstrap-MCwivGN1.js +9 -0
- package/dist/ConfigDirectory-BCC6q2R4.js +5 -0
- package/dist/Contract-CcpSIJm4.js +121 -0
- package/dist/Contract.d.ts +71 -0
- package/dist/Contract.d.ts.map +1 -0
- package/dist/Contract.js +1 -0
- package/dist/Contract.js.map +1 -0
- package/dist/Errors-oPsTLY7l.js +45 -0
- package/dist/Errors.d.ts +67 -0
- package/dist/Errors.d.ts.map +1 -0
- package/dist/Errors.js +47 -0
- package/dist/Errors.js.map +1 -0
- package/dist/FailureGroup-BcH0XOBi.js +53 -0
- package/dist/Framing-zaYdOJnT.js +61 -0
- package/dist/Graft-BsYq3F-J.js +985 -0
- package/dist/Instance.d.ts +7 -0
- package/dist/Instance.d.ts.map +1 -0
- package/dist/Instance.js +14 -0
- package/dist/Instance.js.map +1 -0
- package/dist/Packages-B1TPk8pa.js +111 -0
- package/dist/Peer-IJgFK6mD.js +342 -0
- package/dist/ProcessObservation-DEGrEMfP.js +38 -0
- package/dist/ServeLifecycle-CJM0gG5B.js +24 -0
- package/dist/Testing.d.ts +26 -0
- package/dist/Testing.d.ts.map +1 -0
- package/dist/Testing.js +69 -0
- package/dist/Testing.js.map +1 -0
- package/dist/Transport-DULzpsgR.js +6 -0
- package/dist/Transport.d.ts +39 -0
- package/dist/Transport.d.ts.map +1 -0
- package/dist/Transport.js +8 -0
- package/dist/Transport.js.map +1 -0
- package/dist/WatchdogProtocol-BZmVxrBP.js +17 -0
- package/dist/_virtual/_rolldown/runtime.js +12 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +28275 -0
- package/dist/bin.js.map +1 -0
- package/dist/childRuntime-DSqtFN9o.js +188 -0
- package/dist/cleanup-BPWr-5U9.js +13 -0
- package/dist/command-9zrHdbwT.js +7 -0
- package/dist/connectionEnded-DUgcobEd.js +9 -0
- package/dist/directTransport-DrexuPSm.js +5 -0
- package/dist/entry-SYsx9VNb.js +708 -0
- package/dist/host/auth/bearer.d.ts +5 -0
- package/dist/host/auth/bearer.d.ts.map +1 -0
- package/dist/host/auth/bearer.js +4 -0
- package/dist/host/auth/bearer.js.map +1 -0
- package/dist/host/auth/jwt.d.ts +5 -0
- package/dist/host/auth/jwt.d.ts.map +1 -0
- package/dist/host/auth/jwt.js +4 -0
- package/dist/host/auth/jwt.js.map +1 -0
- package/dist/host/auth/mtls.d.ts +8 -0
- package/dist/host/auth/mtls.d.ts.map +1 -0
- package/dist/host/auth/mtls.js +34 -0
- package/dist/host/auth/mtls.js.map +1 -0
- package/dist/host/auth/none.d.ts +3 -0
- package/dist/host/auth/none.d.ts.map +1 -0
- package/dist/host/auth/none.js +13 -0
- package/dist/host/auth/none.js.map +1 -0
- package/dist/host/command.d.ts +22 -0
- package/dist/host/command.d.ts.map +1 -0
- package/dist/host/command.js +61 -0
- package/dist/host/command.js.map +1 -0
- package/dist/host/local.d.ts +4 -0
- package/dist/host/local.d.ts.map +1 -0
- package/dist/host/local.js +52 -0
- package/dist/host/local.js.map +1 -0
- package/dist/host/unix.d.ts +11 -0
- package/dist/host/unix.d.ts.map +1 -0
- package/dist/host/unix.js +39 -0
- package/dist/host/unix.js.map +1 -0
- package/dist/host/websocket.d.ts +13 -0
- package/dist/host/websocket.d.ts.map +1 -0
- package/dist/host/websocket.js +36 -0
- package/dist/host/websocket.js.map +1 -0
- package/dist/host/worker.d.ts +4 -0
- package/dist/host/worker.d.ts.map +1 -0
- package/dist/host/worker.js +52 -0
- package/dist/host/worker.js.map +1 -0
- package/dist/importer-D7zSgqxq.js +347 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +86 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/Certificates.js +182 -0
- package/dist/internal/Certificates.js.map +1 -0
- package/dist/internal/FailureGroup.js +55 -0
- package/dist/internal/FailureGroup.js.map +1 -0
- package/dist/internal/Limits.d.ts +1 -0
- package/dist/internal/Limits.js +17 -0
- package/dist/internal/Limits.js.map +1 -0
- package/dist/internal/Peer.js +6 -0
- package/dist/internal/Peer.js.map +1 -0
- package/dist/internal/ServeLifecycle.js +26 -0
- package/dist/internal/ServeLifecycle.js.map +1 -0
- package/dist/internal/Supervisor.js +7 -0
- package/dist/internal/Supervisor.js.map +1 -0
- package/dist/internal/assembly.d.ts +5 -0
- package/dist/internal/assembly.js +138 -0
- package/dist/internal/assembly.js.map +1 -0
- package/dist/internal/auth/mtls.js +23 -0
- package/dist/internal/auth/mtls.js.map +1 -0
- package/dist/internal/auth/token.js +19 -0
- package/dist/internal/auth/token.js.map +1 -0
- package/dist/internal/auth/tokenCredentials.d.ts +8 -0
- package/dist/internal/auth/tokenCredentials.d.ts.map +1 -0
- package/dist/internal/auth/tokenCredentials.js +33 -0
- package/dist/internal/auth/tokenCredentials.js.map +1 -0
- package/dist/internal/child.js +125 -0
- package/dist/internal/child.js.map +1 -0
- package/dist/internal/childErrors.d.ts +33 -0
- package/dist/internal/childErrors.d.ts.map +1 -0
- package/dist/internal/childErrors.js +29 -0
- package/dist/internal/childErrors.js.map +1 -0
- package/dist/internal/childRuntime.js +59 -0
- package/dist/internal/childRuntime.js.map +1 -0
- package/dist/internal/cleanup.js +15 -0
- package/dist/internal/cleanup.js.map +1 -0
- package/dist/internal/config.js +6 -0
- package/dist/internal/config.js.map +1 -0
- package/dist/internal/control.js +42 -0
- package/dist/internal/control.js.map +1 -0
- package/dist/internal/credentials.d.ts +44 -0
- package/dist/internal/credentials.d.ts.map +1 -0
- package/dist/internal/credentials.js +54 -0
- package/dist/internal/credentials.js.map +1 -0
- package/dist/internal/directTransport.d.ts +3 -0
- package/dist/internal/directTransport.js +7 -0
- package/dist/internal/directTransport.js.map +1 -0
- package/dist/internal/entry.d.ts +9 -0
- package/dist/internal/entry.d.ts.map +1 -0
- package/dist/internal/entry.js +144 -0
- package/dist/internal/entry.js.map +1 -0
- package/dist/internal/entryConfig.d.ts +202 -0
- package/dist/internal/entryConfig.d.ts.map +1 -0
- package/dist/internal/entryConfig.js +176 -0
- package/dist/internal/entryConfig.js.map +1 -0
- package/dist/internal/execution.d.ts +5 -0
- package/dist/internal/execution.js +43 -0
- package/dist/internal/execution.js.map +1 -0
- package/dist/internal/follow.js +11 -0
- package/dist/internal/follow.js.map +1 -0
- package/dist/internal/forkTree.js +7 -0
- package/dist/internal/forkTree.js.map +1 -0
- package/dist/internal/host/local.js +28 -0
- package/dist/internal/host/local.js.map +1 -0
- package/dist/internal/host/runner.js +100 -0
- package/dist/internal/host/runner.js.map +1 -0
- package/dist/internal/host.js +71 -0
- package/dist/internal/host.js.map +1 -0
- package/dist/internal/importer.js +18 -0
- package/dist/internal/importer.js.map +1 -0
- package/dist/internal/listenerStartup.js +17 -0
- package/dist/internal/listenerStartup.js.map +1 -0
- package/dist/internal/loadModule.js +20 -0
- package/dist/internal/loadModule.js.map +1 -0
- package/dist/internal/platform.js +9 -0
- package/dist/internal/platform.js.map +1 -0
- package/dist/internal/port.d.ts +13 -0
- package/dist/internal/port.d.ts.map +1 -0
- package/dist/internal/port.js +275 -0
- package/dist/internal/port.js.map +1 -0
- package/dist/internal/release.js +25 -0
- package/dist/internal/release.js.map +1 -0
- package/dist/internal/runner/Bootstrap.js +11 -0
- package/dist/internal/runner/Bootstrap.js.map +1 -0
- package/dist/internal/runner/Connection.d.ts +11 -0
- package/dist/internal/runner/Connection.js +56 -0
- package/dist/internal/runner/Connection.js.map +1 -0
- package/dist/internal/runner/Execution.js +115 -0
- package/dist/internal/runner/Execution.js.map +1 -0
- package/dist/internal/runner/Framing.d.ts +11 -0
- package/dist/internal/runner/Framing.d.ts.map +1 -0
- package/dist/internal/runner/Framing.js +63 -0
- package/dist/internal/runner/Framing.js.map +1 -0
- package/dist/internal/runner/Local.js +46 -0
- package/dist/internal/runner/Local.js.map +1 -0
- package/dist/internal/runner/Lock.js +25 -0
- package/dist/internal/runner/Lock.js.map +1 -0
- package/dist/internal/runner/Multiplex.d.ts +5 -0
- package/dist/internal/runner/Multiplex.js +49 -0
- package/dist/internal/runner/Multiplex.js.map +1 -0
- package/dist/internal/runner/Packages.d.ts +3 -0
- package/dist/internal/runner/Packages.js +108 -0
- package/dist/internal/runner/Packages.js.map +1 -0
- package/dist/internal/runner/ProcessObservation.js +40 -0
- package/dist/internal/runner/ProcessObservation.js.map +1 -0
- package/dist/internal/runner/Processes.js +83 -0
- package/dist/internal/runner/Processes.js.map +1 -0
- package/dist/internal/runner/Retention.js +13 -0
- package/dist/internal/runner/Retention.js.map +1 -0
- package/dist/internal/runner/Store.js +78 -0
- package/dist/internal/runner/Store.js.map +1 -0
- package/dist/internal/runner/Supervisor.js +375 -0
- package/dist/internal/runner/Supervisor.js.map +1 -0
- package/dist/internal/runner/Watchdog.js +47 -0
- package/dist/internal/runner/Watchdog.js.map +1 -0
- package/dist/internal/runner/WatchdogProtocol.js +19 -0
- package/dist/internal/runner/WatchdogProtocol.js.map +1 -0
- package/dist/internal/runner/Wire.d.ts +5 -0
- package/dist/internal/runner/Wire.js +64 -0
- package/dist/internal/runner/Wire.js.map +1 -0
- package/dist/internal/runner/accept.js +57 -0
- package/dist/internal/runner/accept.js.map +1 -0
- package/dist/internal/runner/command.js +9 -0
- package/dist/internal/runner/command.js.map +1 -0
- package/dist/internal/runner/connectionEnded.js +11 -0
- package/dist/internal/runner/connectionEnded.js.map +1 -0
- package/dist/internal/runner/model.d.ts +17 -0
- package/dist/internal/runner/model.d.ts.map +1 -0
- package/dist/internal/runner/model.js +231 -0
- package/dist/internal/runner/model.js.map +1 -0
- package/dist/internal/serve.js +60 -0
- package/dist/internal/serve.js.map +1 -0
- package/dist/internal/services.d.ts +18 -0
- package/dist/internal/services.d.ts.map +1 -0
- package/dist/internal/services.js +22 -0
- package/dist/internal/services.js.map +1 -0
- package/dist/internal/socketChannel.js +24 -0
- package/dist/internal/socketChannel.js.map +1 -0
- package/dist/internal/stdioChannel.js +23 -0
- package/dist/internal/stdioChannel.js.map +1 -0
- package/dist/internal/supervisorPlugin.js +1 -0
- package/dist/internal/supervisorPlugin.js.map +1 -0
- package/dist/internal/transportOptions.d.ts +18 -0
- package/dist/internal/transportOptions.d.ts.map +1 -0
- package/dist/internal/watchdogMain.d.ts +1 -0
- package/dist/internal/watchdogMain.js +55 -0
- package/dist/internal/watchdogMain.js.map +1 -0
- package/dist/internal/websocket.js +46 -0
- package/dist/internal/websocket.js.map +1 -0
- package/dist/internal/websocketServer.js +61 -0
- package/dist/internal/websocketServer.js.map +1 -0
- package/dist/internal/workerBootstrap.js +9 -0
- package/dist/internal/workerBootstrap.js.map +1 -0
- package/dist/internal/workerChannel.js +24 -0
- package/dist/internal/workerChannel.js.map +1 -0
- package/dist/internal/workerMain.d.ts +1 -0
- package/dist/internal/workerMain.js +18 -0
- package/dist/internal/workerMain.js.map +1 -0
- package/dist/port-Blbh8tms.js +285 -0
- package/dist/release-BY4Mlluy.js +23 -0
- package/dist/rolldown-runtime-DYf_mQCB.js +34 -0
- package/dist/runner/auth/bearer.d.ts +7 -0
- package/dist/runner/auth/bearer.d.ts.map +1 -0
- package/dist/runner/auth/bearer.js +42 -0
- package/dist/runner/auth/bearer.js.map +1 -0
- package/dist/runner/auth/jwt.d.ts +19 -0
- package/dist/runner/auth/jwt.d.ts.map +1 -0
- package/dist/runner/auth/jwt.js +65 -0
- package/dist/runner/auth/jwt.js.map +1 -0
- package/dist/runner/auth/mtls.d.ts +11 -0
- package/dist/runner/auth/mtls.d.ts.map +1 -0
- package/dist/runner/auth/mtls.js +48 -0
- package/dist/runner/auth/mtls.js.map +1 -0
- package/dist/runner/auth/none.d.ts +3 -0
- package/dist/runner/auth/none.d.ts.map +1 -0
- package/dist/runner/auth/none.js +13 -0
- package/dist/runner/auth/none.js.map +1 -0
- package/dist/runner/index.d.ts +3 -0
- package/dist/runner/index.d.ts.map +1 -0
- package/dist/runner/index.js +71 -0
- package/dist/runner/index.js.map +1 -0
- package/dist/runner/stdio.d.ts +7 -0
- package/dist/runner/stdio.d.ts.map +1 -0
- package/dist/runner/stdio.js +39 -0
- package/dist/runner/stdio.js.map +1 -0
- package/dist/runner/unix.d.ts +7 -0
- package/dist/runner/unix.d.ts.map +1 -0
- package/dist/runner/unix.js +42 -0
- package/dist/runner/unix.js.map +1 -0
- package/dist/runner/websocket.d.ts +28 -0
- package/dist/runner/websocket.d.ts.map +1 -0
- package/dist/runner/websocket.js +77 -0
- package/dist/runner/websocket.js.map +1 -0
- package/dist/socketChannel-KmtzF-9G.js +3658 -0
- package/dist/supervisorPlugin-Inb1S5IV.js +737 -0
- package/dist/token-v5ne2I0-.js +17 -0
- package/dist/tokenCredentials-WUJm2AKm.js +31 -0
- package/dist/websocketServer-MXcCJx0v.js +58 -0
- package/dist/workerChannel-P82YdNjh.js +27 -0
- package/package.json +69 -3
- package/src/Auth.ts +62 -0
- package/src/Contract.ts +100 -0
- package/src/Errors.ts +82 -0
- package/src/Instance.ts +12 -0
- package/src/Testing.ts +135 -0
- package/src/Transport.ts +52 -0
- package/src/bin.ts +145 -0
- package/src/host/auth/bearer.ts +10 -0
- package/src/host/auth/jwt.ts +10 -0
- package/src/host/auth/mtls.ts +48 -0
- package/src/host/auth/none.ts +13 -0
- package/src/host/command.ts +131 -0
- package/src/host/local.ts +41 -0
- package/src/host/unix.ts +65 -0
- package/src/host/websocket.ts +66 -0
- package/src/host/worker.ts +90 -0
- package/src/index.ts +115 -0
- package/src/internal/Certificates.ts +330 -0
- package/src/internal/FailureGroup.ts +176 -0
- package/src/internal/Limits.ts +12 -0
- package/src/internal/Peer.ts +4 -0
- package/src/internal/ServeLifecycle.ts +53 -0
- package/src/internal/Supervisor.ts +14 -0
- package/src/internal/assembly.ts +337 -0
- package/src/internal/auth/mtls.ts +40 -0
- package/src/internal/auth/token.ts +26 -0
- package/src/internal/auth/tokenCredentials.ts +65 -0
- package/src/internal/child.ts +323 -0
- package/src/internal/childErrors.ts +44 -0
- package/src/internal/childRuntime.ts +111 -0
- package/src/internal/cleanup.ts +34 -0
- package/src/internal/config.ts +8 -0
- package/src/internal/control.ts +49 -0
- package/src/internal/credentials.ts +112 -0
- package/src/internal/directTransport.ts +38 -0
- package/src/internal/entry.ts +288 -0
- package/src/internal/entryConfig.ts +190 -0
- package/src/internal/execution.ts +121 -0
- package/src/internal/follow.ts +17 -0
- package/src/internal/forkTree.ts +13 -0
- package/src/internal/host/local.ts +53 -0
- package/src/internal/host/runner.ts +187 -0
- package/src/internal/host.ts +209 -0
- package/src/internal/importer.ts +27 -0
- package/src/internal/listenerStartup.ts +55 -0
- package/src/internal/loadModule.ts +23 -0
- package/src/internal/platform.ts +12 -0
- package/src/internal/port.ts +623 -0
- package/src/internal/release.ts +71 -0
- package/src/internal/runner/Bootstrap.ts +9 -0
- package/src/internal/runner/Connection.ts +184 -0
- package/src/internal/runner/Execution.ts +244 -0
- package/src/internal/runner/Framing.ts +122 -0
- package/src/internal/runner/Local.ts +73 -0
- package/src/internal/runner/Lock.ts +29 -0
- package/src/internal/runner/Multiplex.ts +120 -0
- package/src/internal/runner/Packages.ts +178 -0
- package/src/internal/runner/ProcessObservation.ts +63 -0
- package/src/internal/runner/Processes.ts +109 -0
- package/src/internal/runner/Retention.ts +49 -0
- package/src/internal/runner/Store.ts +160 -0
- package/src/internal/runner/Supervisor.ts +901 -0
- package/src/internal/runner/Watchdog.ts +83 -0
- package/src/internal/runner/WatchdogProtocol.ts +12 -0
- package/src/internal/runner/Wire.ts +99 -0
- package/src/internal/runner/accept.ts +103 -0
- package/src/internal/runner/command.ts +15 -0
- package/src/internal/runner/connectionEnded.ts +28 -0
- package/src/internal/runner/model.ts +364 -0
- package/src/internal/serve.ts +117 -0
- package/src/internal/services.ts +74 -0
- package/src/internal/socketChannel.ts +64 -0
- package/src/internal/stdioChannel.ts +25 -0
- package/src/internal/supervisorPlugin.ts +67 -0
- package/src/internal/transportOptions.ts +17 -0
- package/src/internal/watchdogMain.ts +72 -0
- package/src/internal/websocket.ts +81 -0
- package/src/internal/websocketServer.ts +152 -0
- package/src/internal/workerBootstrap.ts +6 -0
- package/src/internal/workerChannel.ts +54 -0
- package/src/internal/workerMain.ts +23 -0
- package/src/runner/auth/bearer.ts +66 -0
- package/src/runner/auth/jwt.ts +114 -0
- package/src/runner/auth/mtls.ts +37 -0
- package/src/runner/auth/none.ts +13 -0
- package/src/runner/index.ts +97 -0
- package/src/runner/stdio.ts +76 -0
- package/src/runner/unix.ts +53 -0
- package/src/runner/websocket.ts +143 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
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.
|
|
202
|
+
|
package/README.md
CHANGED
|
@@ -1,3 +1,77 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @graftland/plugin-remote
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
English | [简体中文](README.zh-CN.md) | [繁體中文](README.zh-TW.md)
|
|
4
|
+
|
|
5
|
+
Run a Graft plugin in a child process, a Node worker, or on a runner. Declare
|
|
6
|
+
cross-boundary services in a contract; consumers keep their usual interfaces.
|
|
7
|
+
The host imports only the contract, whose `module` points to the implementation.
|
|
8
|
+
Build both to JavaScript.
|
|
9
|
+
|
|
10
|
+
```yaml
|
|
11
|
+
- id: greeter
|
|
12
|
+
name: remote
|
|
13
|
+
config:
|
|
14
|
+
contract: ./dist/contract.js
|
|
15
|
+
connect: { local: {} }
|
|
16
|
+
config: { greeting: Hello }
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Use `graft start`, or load this TypeScript plugin with `Graft.plugin(entry)`:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import * as Remote from "@graftland/plugin-remote"
|
|
23
|
+
import { contract } from "./contract.js"
|
|
24
|
+
|
|
25
|
+
export default Remote.plugin(contract, {
|
|
26
|
+
contractModule: new URL("./contract.js", import.meta.url).href,
|
|
27
|
+
connect: { worker: {} },
|
|
28
|
+
config: { greeting: "Hello" },
|
|
29
|
+
})
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
TS and YAML share `connect`: local, worker, url (ws/wss), unix, or command. Auth
|
|
33
|
+
is mtls, bearer, jwt, none, or a third-party `{ name, config }` reference. No
|
|
34
|
+
separate capability entries or service-key strings are needed. TS credentials
|
|
35
|
+
can also be Effects or `{ inject, read }`. A custom host supplies
|
|
36
|
+
`NodeServices.layer` and `SecureRandom.layerWebCrypto` to Graft.
|
|
37
|
+
|
|
38
|
+
A runner configuration:
|
|
39
|
+
|
|
40
|
+
```yaml
|
|
41
|
+
- name: remote/runner
|
|
42
|
+
config:
|
|
43
|
+
root: ./installation
|
|
44
|
+
state: ./state
|
|
45
|
+
listen:
|
|
46
|
+
- url: wss://0.0.0.0:7443
|
|
47
|
+
cert: ./certs/server.crt
|
|
48
|
+
key: ./certs/server.key
|
|
49
|
+
auth: { mtls: { ca: ./certs/ca.crt } }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Run `graft-remote serve --config runner.yml`. Install its plugin packages in
|
|
53
|
+
advance, preserve the state directory, and supervise the runner and descendants.
|
|
54
|
+
`graft-remote certificates` can issue certificates. A saved host entry id names
|
|
55
|
+
the instance by default; the runner confirms old-process exit before replacement
|
|
56
|
+
and advances generation. Read the guide for leases and three stopping outcomes.
|
|
57
|
+
|
|
58
|
+
Workers do not isolate permissions. Unix relies on file permissions; stdio
|
|
59
|
+
relies on SSH or another external mechanism. Use wss for tokens; stolen tokens
|
|
60
|
+
can be replayed while valid. JWT is checked once at upgrade. Restart the host
|
|
61
|
+
after changing a contract; contract imports do not participate in HMR.
|
|
62
|
+
|
|
63
|
+
Public APIs: root default, `plugin`, `Contract`, `Instance`, public errors;
|
|
64
|
+
`/runner`; `/Auth`, `/Transport`, `/Errors`, `/Contract`, `/Testing`; and
|
|
65
|
+
capability modules under `host/*` and `runner/*`. The executable paths
|
|
66
|
+
`/internal/bin`, `/internal/worker`, `/internal/watchdog` are **not public
|
|
67
|
+
APIs**.
|
|
68
|
+
|
|
69
|
+
- [Remote](https://graftland.github.io/graft/remote/overview/)
|
|
70
|
+
- [Capabilities](https://graftland.github.io/graft/remote/capabilities/)
|
|
71
|
+
- [06 · Remote](../../samples/06-remote/)
|
|
72
|
+
- [Chat bot](../../samples/chat-bot/)
|
|
73
|
+
|
|
74
|
+
This workspace package remains private.
|
|
75
|
+
|
|
76
|
+
Part of [Graft](https://github.com/graftland/graft). Licensed under
|
|
77
|
+
[Apache 2.0](https://github.com/graftland/graft/blob/main/LICENSE).
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# @graftland/plugin-remote
|
|
2
|
+
|
|
3
|
+
English | [简体中文](README.zh-CN.md) | [繁體中文](README.zh-TW.md)
|
|
4
|
+
|
|
5
|
+
在子进程、Node
|
|
6
|
+
worker 或 runner 上运行 Graft 插件。契约声明跨边界的服务,消费者保留原来的接口。宿主只导入契约,契约的
|
|
7
|
+
`module` 指向实现;先把两者构建成 JavaScript。
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
- id: greeter
|
|
11
|
+
name: remote
|
|
12
|
+
config:
|
|
13
|
+
contract: ./dist/contract.js
|
|
14
|
+
connect: { local: {} }
|
|
15
|
+
config: { greeting: Hello }
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
运行 `graft start`,或用 `Graft.plugin(entry)` 加载 TS 插件:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import * as Remote from "@graftland/plugin-remote"
|
|
22
|
+
import { contract } from "./contract.js"
|
|
23
|
+
|
|
24
|
+
export default Remote.plugin(contract, {
|
|
25
|
+
contractModule: new URL("./contract.js", import.meta.url).href,
|
|
26
|
+
connect: { worker: {} },
|
|
27
|
+
config: { greeting: "Hello" },
|
|
28
|
+
})
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
TS 和 YAML 共用
|
|
32
|
+
`connect`:local、worker、url(ws/wss)、unix、command。认证可以选 mtls、bearer、jwt、none,或第三方
|
|
33
|
+
`{ name, config }`
|
|
34
|
+
引用。不必另写能力 entry 或服务键字符串。TS 凭证还允许 Effect 或
|
|
35
|
+
`{ inject, read }`。自定义宿主需为 Graft 提供 `NodeServices.layer` 和
|
|
36
|
+
`SecureRandom.layerWebCrypto`。
|
|
37
|
+
|
|
38
|
+
runner 配置:
|
|
39
|
+
|
|
40
|
+
```yaml
|
|
41
|
+
- name: remote/runner
|
|
42
|
+
config:
|
|
43
|
+
root: ./installation
|
|
44
|
+
state: ./state
|
|
45
|
+
listen:
|
|
46
|
+
- url: wss://0.0.0.0:7443
|
|
47
|
+
cert: ./certs/server.crt
|
|
48
|
+
key: ./certs/server.key
|
|
49
|
+
auth: { mtls: { ca: ./certs/ca.crt } }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
运行
|
|
53
|
+
`graft-remote serve --config runner.yml`。提前安装插件包,保留状态目录,并由外部 supervisor 管理 runner 及后代进程。`graft-remote certificates`
|
|
54
|
+
可生成证书。宿主保存的条目 id 默认就是实例名;runner 确认旧进程退出后才接纳替换,并递增 generation。租约和三种停止结果见指南。
|
|
55
|
+
|
|
56
|
+
worker 不隔离权限;unix 依赖文件权限;stdio 依赖 SSH 等外部机制。token 建议走 wss,被盗后在有效期内可以重放。JWT 只在 upgrade 验证一次。修改契约后须重启宿主,契约导入不参与 HMR。
|
|
57
|
+
|
|
58
|
+
公开 API:包根 default、`plugin`、`Contract`、`Instance`、公开错误;`/runner`;`/Auth`、`/Transport`、`/Errors`、`/Contract`、`/Testing`;以及
|
|
59
|
+
`host/*`、`runner/*`
|
|
60
|
+
能力模块。`/internal/bin`、`/internal/worker`、`/internal/watchdog`
|
|
61
|
+
只是可执行文件路径,**不是公开 API**。
|
|
62
|
+
|
|
63
|
+
- [Remote](https://graftland.github.io/graft/zh-cn/remote/overview/)
|
|
64
|
+
- [Capabilities](https://graftland.github.io/graft/zh-cn/remote/capabilities/)
|
|
65
|
+
- [06 · Remote](../../samples/06-remote/)
|
|
66
|
+
- [Chat bot](../../samples/chat-bot/)
|
|
67
|
+
|
|
68
|
+
本工作区包仍为 private。
|
|
69
|
+
|
|
70
|
+
Part of [Graft](https://github.com/graftland/graft). Licensed under
|
|
71
|
+
[Apache 2.0](https://github.com/graftland/graft/blob/main/LICENSE).
|
package/README.zh-TW.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# @graftland/plugin-remote
|
|
2
|
+
|
|
3
|
+
English | [简体中文](README.zh-CN.md) | [繁體中文](README.zh-TW.md)
|
|
4
|
+
|
|
5
|
+
在子行程、Node
|
|
6
|
+
worker 或 runner 執行 Graft 外掛。契約宣告跨邊界的服務,消費者保留原來的介面。宿主只匯入契約,契約的
|
|
7
|
+
`module` 指向實作;先將兩者建置為 JavaScript。
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
- id: greeter
|
|
11
|
+
name: remote
|
|
12
|
+
config:
|
|
13
|
+
contract: ./dist/contract.js
|
|
14
|
+
connect: { local: {} }
|
|
15
|
+
config: { greeting: Hello }
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
執行 `graft start`,或以 `Graft.plugin(entry)` 載入 TS 外掛:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import * as Remote from "@graftland/plugin-remote"
|
|
22
|
+
import { contract } from "./contract.js"
|
|
23
|
+
|
|
24
|
+
export default Remote.plugin(contract, {
|
|
25
|
+
contractModule: new URL("./contract.js", import.meta.url).href,
|
|
26
|
+
connect: { worker: {} },
|
|
27
|
+
config: { greeting: "Hello" },
|
|
28
|
+
})
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
TS 與 YAML 共用
|
|
32
|
+
`connect`:local、worker、url(ws/wss)、unix、command。驗證可選 mtls、bearer、jwt、none,或第三方
|
|
33
|
+
`{ name, config }`
|
|
34
|
+
引用。不必另寫能力 entry 或服務鍵字串。TS 憑證也允許 Effect 或
|
|
35
|
+
`{ inject, read }`。自訂宿主須為 Graft 提供 `NodeServices.layer` 與
|
|
36
|
+
`SecureRandom.layerWebCrypto`。
|
|
37
|
+
|
|
38
|
+
runner 設定:
|
|
39
|
+
|
|
40
|
+
```yaml
|
|
41
|
+
- name: remote/runner
|
|
42
|
+
config:
|
|
43
|
+
root: ./installation
|
|
44
|
+
state: ./state
|
|
45
|
+
listen:
|
|
46
|
+
- url: wss://0.0.0.0:7443
|
|
47
|
+
cert: ./certs/server.crt
|
|
48
|
+
key: ./certs/server.key
|
|
49
|
+
auth: { mtls: { ca: ./certs/ca.crt } }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
執行
|
|
53
|
+
`graft-remote serve --config runner.yml`。預先安裝外掛套件,保留狀態目錄,並由外部 supervisor 管理 runner 及後代行程。`graft-remote certificates`
|
|
54
|
+
可產生憑證。宿主保存的條目 id 預設就是實例名稱;runner 確認舊行程退出後才接受替換,並遞增 generation。租約與三種停止結果見指南。
|
|
55
|
+
|
|
56
|
+
worker 不隔離權限;unix 依賴檔案權限;stdio 依賴 SSH 等外部機制。token 建議走 wss,被竊後在有效期內可以重放。JWT 只在 upgrade 驗證一次。修改契約後須重啟宿主,契約匯入不參與 HMR。
|
|
57
|
+
|
|
58
|
+
公開 API:套件根目錄 default、`plugin`、`Contract`、`Instance`、公開錯誤;`/runner`;`/Auth`、`/Transport`、`/Errors`、`/Contract`、`/Testing`;以及
|
|
59
|
+
`host/*`、`runner/*`
|
|
60
|
+
能力模組。`/internal/bin`、`/internal/worker`、`/internal/watchdog`
|
|
61
|
+
僅是執行檔路徑,**不是公開 API**。
|
|
62
|
+
|
|
63
|
+
- [Remote](https://graftland.github.io/graft/zh-tw/remote/overview/)
|
|
64
|
+
- [Capabilities](https://graftland.github.io/graft/zh-tw/remote/capabilities/)
|
|
65
|
+
- [06 · Remote](../../samples/06-remote/)
|
|
66
|
+
- [Chat bot](../../samples/chat-bot/)
|
|
67
|
+
|
|
68
|
+
此工作區套件仍為 private。
|
|
69
|
+
|
|
70
|
+
Part of [Graft](https://github.com/graftland/graft). Licensed under
|
|
71
|
+
[Apache 2.0](https://github.com/graftland/graft/blob/main/LICENSE).
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Context } from "effect";
|
|
2
|
+
// packages/remote/src/Auth.ts
|
|
3
|
+
/** Credentials and authenticated identities shared by transport plugins. */
|
|
4
|
+
var Credentials = class extends Context.Service()("@graftland/plugin-remote/Auth/Credentials") {};
|
|
5
|
+
var Authenticator = class extends Context.Service()("@graftland/plugin-remote/Auth/Authenticator") {};
|
|
6
|
+
export { Credentials as n, Authenticator as t };
|
package/dist/Auth.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { AuthenticationFailed, CredentialsError } from "./Errors.js";
|
|
2
|
+
import { Context, Effect, Option, Redacted, Scope } from "effect";
|
|
3
|
+
export interface ClientCertificate {
|
|
4
|
+
readonly cert: string;
|
|
5
|
+
readonly key: Redacted.Redacted<string>;
|
|
6
|
+
}
|
|
7
|
+
export interface VerifiedCertificate {
|
|
8
|
+
readonly der: Uint8Array;
|
|
9
|
+
readonly subjectAltName: Option.Option<string>;
|
|
10
|
+
}
|
|
11
|
+
export interface TlsPolicy {
|
|
12
|
+
readonly ca: ReadonlyArray<string>;
|
|
13
|
+
readonly minVersion: "TLSv1.3";
|
|
14
|
+
readonly requestCert: true;
|
|
15
|
+
readonly rejectUnauthorized: true;
|
|
16
|
+
}
|
|
17
|
+
export type Prepared = {
|
|
18
|
+
readonly _tag: "Authorization";
|
|
19
|
+
readonly value: Redacted.Redacted<string>;
|
|
20
|
+
} | {
|
|
21
|
+
readonly _tag: "Certificate";
|
|
22
|
+
readonly value: ClientCertificate;
|
|
23
|
+
} | {
|
|
24
|
+
readonly _tag: "None";
|
|
25
|
+
};
|
|
26
|
+
export type CredentialsApi = { [K in Prepared["_tag"]]: {
|
|
27
|
+
readonly kind: K;
|
|
28
|
+
readonly read: Effect.Effect<Extract<Prepared, {
|
|
29
|
+
readonly _tag: K;
|
|
30
|
+
}>, CredentialsError, Scope.Scope>;
|
|
31
|
+
}; }[Prepared["_tag"]];
|
|
32
|
+
export type AuthenticatorApi = {
|
|
33
|
+
readonly _tag: "Header";
|
|
34
|
+
readonly issuer?: string;
|
|
35
|
+
readonly authenticate: (header: Option.Option<Redacted.Redacted<string>>) => Effect.Effect<string, AuthenticationFailed>;
|
|
36
|
+
} | {
|
|
37
|
+
readonly _tag: "Mtls";
|
|
38
|
+
readonly tls: TlsPolicy;
|
|
39
|
+
readonly authenticate: (peer: VerifiedCertificate) => Effect.Effect<string, AuthenticationFailed>;
|
|
40
|
+
} | {
|
|
41
|
+
readonly _tag: "None";
|
|
42
|
+
readonly identity: string;
|
|
43
|
+
};
|
|
44
|
+
declare const Credentials_base: Context.ServiceClass<Credentials, "@graftland/plugin-remote/Auth/Credentials", CredentialsApi>;
|
|
45
|
+
export declare class Credentials extends Credentials_base {}
|
|
46
|
+
declare const Authenticator_base: Context.ServiceClass<Authenticator, "@graftland/plugin-remote/Auth/Authenticator", AuthenticatorApi>;
|
|
47
|
+
export declare class Authenticator extends Authenticator_base {}
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=Auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Auth.d.ts","names":[],"sources":["../src/Auth.ts"],"mappings":";;iBAKiB;WACP;WACA,KAAK,SAAS;;iBAEP;WACP,KAAK;WACL,gBAAgB,OAAO;;iBAEhB;WACP,IAAI;WACJ;WACA;WACA;;YAEE;WAEA;WACA,OAAO,SAAS;;WAEd;WAA8B,OAAO;;WACrC;;YAEF,oBACV,KAAK;WACI,MAAM;WACN,MAAM,OAAO,OACrB,QAAQ;aAAqB,MAAM;MACnC,kBACA,MAAM;KAGP;YAEU;WAEA;WACA;WACA,eACR,QAAQ,OAAO,OAAO,SAAS,sBAC3B,OAAO,eAAe;;WAGlB;WACA,KAAK;WACL,eACR,MAAM,wBACF,OAAO,eAAe;;WAEhB;WAAuB;;;qBAExB,oBAAoB;;qBAGpB,sBAAsB"}
|
package/dist/Auth.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Context } from "effect";
|
|
2
|
+
// src/Auth.ts
|
|
3
|
+
/** Credentials and authenticated identities shared by transport plugins. */
|
|
4
|
+
var Credentials = class extends Context.Service()("@graftland/plugin-remote/Auth/Credentials") {};
|
|
5
|
+
var Authenticator = class extends Context.Service()("@graftland/plugin-remote/Auth/Authenticator") {};
|
|
6
|
+
export { Authenticator, Credentials };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=Auth.js.map
|
package/dist/Auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Auth.js","names":[],"sources":["../src/Auth.ts"],"sourcesContent":["/** Credentials and authenticated identities shared by transport plugins. */\nimport { Context } from \"effect\"\nimport type { Effect, Redacted, Option, Scope } from \"effect\"\nimport type { AuthenticationFailed, CredentialsError } from \"./Errors\"\n\nexport interface ClientCertificate {\n\treadonly cert: string\n\treadonly key: Redacted.Redacted<string>\n}\nexport interface VerifiedCertificate {\n\treadonly der: Uint8Array\n\treadonly subjectAltName: Option.Option<string>\n}\nexport interface TlsPolicy {\n\treadonly ca: ReadonlyArray<string>\n\treadonly minVersion: \"TLSv1.3\"\n\treadonly requestCert: true\n\treadonly rejectUnauthorized: true\n}\nexport type Prepared =\n\t| {\n\t\t\treadonly _tag: \"Authorization\"\n\t\t\treadonly value: Redacted.Redacted<string>\n\t }\n\t| { readonly _tag: \"Certificate\"; readonly value: ClientCertificate }\n\t| { readonly _tag: \"None\" }\n\nexport type CredentialsApi = {\n\t[K in Prepared[\"_tag\"]]: {\n\t\treadonly kind: K\n\t\treadonly read: Effect.Effect<\n\t\t\tExtract<Prepared, { readonly _tag: K }>,\n\t\t\tCredentialsError,\n\t\t\tScope.Scope\n\t\t>\n\t}\n}[Prepared[\"_tag\"]]\n\nexport type AuthenticatorApi =\n\t| {\n\t\t\treadonly _tag: \"Header\"\n\t\t\treadonly issuer?: string\n\t\t\treadonly authenticate: (\n\t\t\t\theader: Option.Option<Redacted.Redacted<string>>,\n\t\t\t) => Effect.Effect<string, AuthenticationFailed>\n\t }\n\t| {\n\t\t\treadonly _tag: \"Mtls\"\n\t\t\treadonly tls: TlsPolicy\n\t\t\treadonly authenticate: (\n\t\t\t\tpeer: VerifiedCertificate,\n\t\t\t) => Effect.Effect<string, AuthenticationFailed>\n\t }\n\t| { readonly _tag: \"None\"; readonly identity: string }\n\nexport class Credentials extends Context.Service<Credentials, CredentialsApi>()(\n\t\"@graftland/plugin-remote/Auth/Credentials\",\n) {}\nexport class Authenticator extends Context.Service<\n\tAuthenticator,\n\tAuthenticatorApi\n>()(\"@graftland/plugin-remote/Auth/Authenticator\") {}\n"],"mappings":";;;AAuDA,IAAa,cAAb,cAAiC,QAAQ,QAAqC,CAAC,CAC9E,2CACD,CAAC,CAAC,CAAC;AACH,IAAa,gBAAb,cAAmC,QAAQ,QAGzC,CAAC,CAAC,6CAA6C,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { D as Identity } from "./Peer-IJgFK6mD.js";
|
|
2
|
+
import { r as Limits } from "./port-Blbh8tms.js";
|
|
3
|
+
import { Schema } from "effect";
|
|
4
|
+
// packages/remote/src/internal/runner/Bootstrap.ts
|
|
5
|
+
const Bootstrap = Schema.Struct({
|
|
6
|
+
identity: Identity,
|
|
7
|
+
limits: Limits
|
|
8
|
+
});
|
|
9
|
+
export { Bootstrap as t };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Context, Option } from "effect";
|
|
2
|
+
// packages/loader/src/ConfigDirectory.ts
|
|
3
|
+
/** Directory of the supplied configuration path, before following symbolic links. */
|
|
4
|
+
const ConfigDirectory = Context.Reference("@graftland/loader/ConfigDirectory", { defaultValue: Option.none });
|
|
5
|
+
export { ConfigDirectory as t };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { n as __exportAll } from "./rolldown-runtime-DYf_mQCB.js";
|
|
2
|
+
import { t as Priority } from "./port-Blbh8tms.js";
|
|
3
|
+
import { a as provide } from "./Graft-BsYq3F-J.js";
|
|
4
|
+
import { Array, Cause, Context, Effect, Predicate, Record, Schema } from "effect";
|
|
5
|
+
import { Rpc, RpcClient, RpcGroup, RpcServer } from "effect/rpc";
|
|
6
|
+
// packages/remote/src/internal/childErrors.ts
|
|
7
|
+
var AlreadyLoaded = class extends Schema.TaggedError()("AlreadyLoaded", {}) {};
|
|
8
|
+
var ContractNotFound = class extends Schema.TaggedError()("ContractNotFound", { module: Schema.String }) {
|
|
9
|
+
get message() {
|
|
10
|
+
return `No remote contract exported by ${this.module}`;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
var ModuleImportFailed = class extends Schema.TaggedError()("ModuleImportFailed", {
|
|
14
|
+
module: Schema.String,
|
|
15
|
+
cause: Schema.Defect({ includeStack: true })
|
|
16
|
+
}) {};
|
|
17
|
+
var ActivationFailed = class extends Schema.TaggedError()("ActivationFailed", {
|
|
18
|
+
detail: Schema.String,
|
|
19
|
+
cause: Schema.optionalKey(Schema.Cause(Schema.Defect({ includeStack: true }), Schema.Defect({ includeStack: true })))
|
|
20
|
+
}) {
|
|
21
|
+
get message() {
|
|
22
|
+
return this.detail;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const ChildFailure = Schema.Union([
|
|
26
|
+
AlreadyLoaded,
|
|
27
|
+
ContractNotFound,
|
|
28
|
+
ModuleImportFailed,
|
|
29
|
+
ActivationFailed
|
|
30
|
+
]);
|
|
31
|
+
// packages/remote/src/internal/control.ts
|
|
32
|
+
const Log = Schema.Struct({
|
|
33
|
+
level: Schema.Literals([
|
|
34
|
+
"Fatal",
|
|
35
|
+
"Error",
|
|
36
|
+
"Warn",
|
|
37
|
+
"Info",
|
|
38
|
+
"Debug",
|
|
39
|
+
"Trace",
|
|
40
|
+
"All",
|
|
41
|
+
"None"
|
|
42
|
+
]),
|
|
43
|
+
message: Schema.Defect({ includeStack: true }),
|
|
44
|
+
cause: Schema.Json,
|
|
45
|
+
annotations: Schema.Record(Schema.String, Schema.Defect({ includeStack: true }))
|
|
46
|
+
});
|
|
47
|
+
const Event = Schema.Union([
|
|
48
|
+
Schema.TaggedStruct("Failed", { cause: Schema.Json }),
|
|
49
|
+
Schema.TaggedStruct("Stopped", {}),
|
|
50
|
+
Schema.TaggedStruct("Withdrawing", {})
|
|
51
|
+
]);
|
|
52
|
+
const LogEvent = Schema.Union([Schema.TaggedStruct("Log", {
|
|
53
|
+
entry: Log,
|
|
54
|
+
dropped: Schema.Int
|
|
55
|
+
}), Schema.TaggedStruct("LogsEnded", { dropped: Schema.Int })]);
|
|
56
|
+
const endpoint = "@graftland/plugin-remote/control";
|
|
57
|
+
const make$1 = (cause) => RpcGroup.make(Rpc.make("Load", {
|
|
58
|
+
payload: { input: Schema.Json },
|
|
59
|
+
error: cause
|
|
60
|
+
}), Rpc.make("Events", {
|
|
61
|
+
success: Event,
|
|
62
|
+
stream: true
|
|
63
|
+
}), Rpc.make("Dispose", { error: cause })).annotateRpcs(Priority, "control").add(Rpc.make("Logs", {
|
|
64
|
+
success: LogEvent,
|
|
65
|
+
stream: true
|
|
66
|
+
}).annotate(Priority, "log"));
|
|
67
|
+
// packages/remote/src/internal/services.ts
|
|
68
|
+
const service = (key, group, mapping) => ({
|
|
69
|
+
key,
|
|
70
|
+
group,
|
|
71
|
+
serve: Effect.fnUntraced(function* (port) {
|
|
72
|
+
const context = yield* Effect.context();
|
|
73
|
+
const value = yield* Effect.fromOption(Context.getOption(context, key)).pipe(Effect.orDie);
|
|
74
|
+
const handlers = yield* group.toHandlers(mapping.toHandlers(value));
|
|
75
|
+
return yield* RpcServer.make(group, { disableFatalDefects: true }).pipe(Effect.provideContext(handlers), Effect.provideService(RpcServer.Protocol, port.serverProtocol(key.key)));
|
|
76
|
+
}),
|
|
77
|
+
publish: Effect.fnUntraced(function* (port) {
|
|
78
|
+
const client = yield* RpcClient.make(group).pipe(Effect.provideService(RpcClient.Protocol, port.clientProtocol(key.key)));
|
|
79
|
+
yield* provide(key, mapping.fromClient(client));
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
const endpoints = (services) => Record.fromEntries(Array.map(services, (service) => [service.key.key, service.group]));
|
|
83
|
+
// packages/remote/src/Contract.ts
|
|
84
|
+
var Contract_exports = /* @__PURE__ */ __exportAll({
|
|
85
|
+
ChildFailure: () => ChildFailure,
|
|
86
|
+
UndeclaredFailure: () => UndeclaredFailure,
|
|
87
|
+
fromModule: () => fromModule,
|
|
88
|
+
isContract: () => isContract,
|
|
89
|
+
make: () => make,
|
|
90
|
+
service: () => service
|
|
91
|
+
});
|
|
92
|
+
const TypeId = "~@graftland/plugin-remote/Contract";
|
|
93
|
+
/** An undeclared failure still crosses the boundary, with its diagnostic value. */
|
|
94
|
+
var UndeclaredFailure = class extends Schema.TaggedError()("UndeclaredFailure", { original: Schema.Defect({ includeStack: true }) }) {};
|
|
95
|
+
/** Pure metadata shared by the host and the executable runner bootstrap. */
|
|
96
|
+
const make = (options) => {
|
|
97
|
+
const keys = Array.map([...options.inject ?? [], ...options.provides ?? []], (service) => service.key.key);
|
|
98
|
+
if (Array.dedupe(keys).length !== keys.length || keys.includes("@graftland/plugin-remote/control")) throw new Error("Service keys must be unique within a remote contract and must not use the control endpoint");
|
|
99
|
+
const failure = Schema.Union([
|
|
100
|
+
options.error,
|
|
101
|
+
UndeclaredFailure,
|
|
102
|
+
ChildFailure
|
|
103
|
+
]);
|
|
104
|
+
const codec = Schema.toCodecJson(Schema.Cause(failure, Schema.Defect({ includeStack: true })));
|
|
105
|
+
const declared = Schema.is(failure);
|
|
106
|
+
const normalizeCause = (cause) => Cause.map(cause, (error) => declared(error) ? error : UndeclaredFailure.make({ original: error }));
|
|
107
|
+
return {
|
|
108
|
+
...options,
|
|
109
|
+
control: make$1(codec),
|
|
110
|
+
normalizeCause,
|
|
111
|
+
inject: options.inject ?? [],
|
|
112
|
+
provides: options.provides ?? [],
|
|
113
|
+
[TypeId]: TypeId,
|
|
114
|
+
encodeCause: (cause) => normalizeCause(cause).pipe(Schema.encodeEffect(codec)),
|
|
115
|
+
decodeCause: Schema.decodeUnknownEffect(codec)
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
const isContract = (value) => Predicate.hasProperty(value, TypeId) && value[TypeId] === TypeId;
|
|
119
|
+
/** A contract module exports either default or a named contract. */
|
|
120
|
+
const fromModule = (module) => Array.findFirst([Predicate.hasProperty(module, "default") ? module.default : void 0, Predicate.hasProperty(module, "contract") ? module.contract : void 0], isContract);
|
|
121
|
+
export { make as a, endpoint as c, ChildFailure as d, ContractNotFound as f, isContract as i, ActivationFailed as l, UndeclaredFailure as n, endpoints as o, ModuleImportFailed as p, fromModule as r, service as s, Contract_exports as t, AlreadyLoaded as u };
|