Skip to content

Commit 54be92c

Browse files
committed
feat(plugin): load rust_dynamic plugins in relay
Signed-off-by: Will Killian <wkillian@nvidia.com>
1 parent 93e5b53 commit 54be92c

16 files changed

Lines changed: 3502 additions & 38 deletions

File tree

ATTRIBUTIONS-Rust.md

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32413,6 +32413,215 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
3241332413

3241432414
```
3241532415

32416+
## sha2 - 0.10.9
32417+
**Repository URL**: https://github.com/RustCrypto/hashes
32418+
**License Type(s)**: Apache-2.0
32419+
### License: https://spdx.org/licenses/Apache-2.0.html
32420+
```
32421+
Apache License
32422+
Version 2.0, January 2004
32423+
http://www.apache.org/licenses/
32424+
32425+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
32426+
32427+
1. Definitions.
32428+
32429+
"License" shall mean the terms and conditions for use, reproduction,
32430+
and distribution as defined by Sections 1 through 9 of this document.
32431+
32432+
"Licensor" shall mean the copyright owner or entity authorized by
32433+
the copyright owner that is granting the License.
32434+
32435+
"Legal Entity" shall mean the union of the acting entity and all
32436+
other entities that control, are controlled by, or are under common
32437+
control with that entity. For the purposes of this definition,
32438+
"control" means (i) the power, direct or indirect, to cause the
32439+
direction or management of such entity, whether by contract or
32440+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
32441+
outstanding shares, or (iii) beneficial ownership of such entity.
32442+
32443+
"You" (or "Your") shall mean an individual or Legal Entity
32444+
exercising permissions granted by this License.
32445+
32446+
"Source" form shall mean the preferred form for making modifications,
32447+
including but not limited to software source code, documentation
32448+
source, and configuration files.
32449+
32450+
"Object" form shall mean any form resulting from mechanical
32451+
transformation or translation of a Source form, including but
32452+
not limited to compiled object code, generated documentation,
32453+
and conversions to other media types.
32454+
32455+
"Work" shall mean the work of authorship, whether in Source or
32456+
Object form, made available under the License, as indicated by a
32457+
copyright notice that is included in or attached to the work
32458+
(an example is provided in the Appendix below).
32459+
32460+
"Derivative Works" shall mean any work, whether in Source or Object
32461+
form, that is based on (or derived from) the Work and for which the
32462+
editorial revisions, annotations, elaborations, or other modifications
32463+
represent, as a whole, an original work of authorship. For the purposes
32464+
of this License, Derivative Works shall not include works that remain
32465+
separable from, or merely link (or bind by name) to the interfaces of,
32466+
the Work and Derivative Works thereof.
32467+
32468+
"Contribution" shall mean any work of authorship, including
32469+
the original version of the Work and any modifications or additions
32470+
to that Work or Derivative Works thereof, that is intentionally
32471+
submitted to Licensor for inclusion in the Work by the copyright owner
32472+
or by an individual or Legal Entity authorized to submit on behalf of
32473+
the copyright owner. For the purposes of this definition, "submitted"
32474+
means any form of electronic, verbal, or written communication sent
32475+
to the Licensor or its representatives, including but not limited to
32476+
communication on electronic mailing lists, source code control systems,
32477+
and issue tracking systems that are managed by, or on behalf of, the
32478+
Licensor for the purpose of discussing and improving the Work, but
32479+
excluding communication that is conspicuously marked or otherwise
32480+
designated in writing by the copyright owner as "Not a Contribution."
32481+
32482+
"Contributor" shall mean Licensor and any individual or Legal Entity
32483+
on behalf of whom a Contribution has been received by Licensor and
32484+
subsequently incorporated within the Work.
32485+
32486+
2. Grant of Copyright License. Subject to the terms and conditions of
32487+
this License, each Contributor hereby grants to You a perpetual,
32488+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
32489+
copyright license to reproduce, prepare Derivative Works of,
32490+
publicly display, publicly perform, sublicense, and distribute the
32491+
Work and such Derivative Works in Source or Object form.
32492+
32493+
3. Grant of Patent License. Subject to the terms and conditions of
32494+
this License, each Contributor hereby grants to You a perpetual,
32495+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
32496+
(except as stated in this section) patent license to make, have made,
32497+
use, offer to sell, sell, import, and otherwise transfer the Work,
32498+
where such license applies only to those patent claims licensable
32499+
by such Contributor that are necessarily infringed by their
32500+
Contribution(s) alone or by combination of their Contribution(s)
32501+
with the Work to which such Contribution(s) was submitted. If You
32502+
institute patent litigation against any entity (including a
32503+
cross-claim or counterclaim in a lawsuit) alleging that the Work
32504+
or a Contribution incorporated within the Work constitutes direct
32505+
or contributory patent infringement, then any patent licenses
32506+
granted to You under this License for that Work shall terminate
32507+
as of the date such litigation is filed.
32508+
32509+
4. Redistribution. You may reproduce and distribute copies of the
32510+
Work or Derivative Works thereof in any medium, with or without
32511+
modifications, and in Source or Object form, provided that You
32512+
meet the following conditions:
32513+
32514+
(a) You must give any other recipients of the Work or
32515+
Derivative Works a copy of this License; and
32516+
32517+
(b) You must cause any modified files to carry prominent notices
32518+
stating that You changed the files; and
32519+
32520+
(c) You must retain, in the Source form of any Derivative Works
32521+
that You distribute, all copyright, patent, trademark, and
32522+
attribution notices from the Source form of the Work,
32523+
excluding those notices that do not pertain to any part of
32524+
the Derivative Works; and
32525+
32526+
(d) If the Work includes a "NOTICE" text file as part of its
32527+
distribution, then any Derivative Works that You distribute must
32528+
include a readable copy of the attribution notices contained
32529+
within such NOTICE file, excluding those notices that do not
32530+
pertain to any part of the Derivative Works, in at least one
32531+
of the following places: within a NOTICE text file distributed
32532+
as part of the Derivative Works; within the Source form or
32533+
documentation, if provided along with the Derivative Works; or,
32534+
within a display generated by the Derivative Works, if and
32535+
wherever such third-party notices normally appear. The contents
32536+
of the NOTICE file are for informational purposes only and
32537+
do not modify the License. You may add Your own attribution
32538+
notices within Derivative Works that You distribute, alongside
32539+
or as an addendum to the NOTICE text from the Work, provided
32540+
that such additional attribution notices cannot be construed
32541+
as modifying the License.
32542+
32543+
You may add Your own copyright statement to Your modifications and
32544+
may provide additional or different license terms and conditions
32545+
for use, reproduction, or distribution of Your modifications, or
32546+
for any such Derivative Works as a whole, provided Your use,
32547+
reproduction, and distribution of the Work otherwise complies with
32548+
the conditions stated in this License.
32549+
32550+
5. Submission of Contributions. Unless You explicitly state otherwise,
32551+
any Contribution intentionally submitted for inclusion in the Work
32552+
by You to the Licensor shall be under the terms and conditions of
32553+
this License, without any additional terms or conditions.
32554+
Notwithstanding the above, nothing herein shall supersede or modify
32555+
the terms of any separate license agreement you may have executed
32556+
with Licensor regarding such Contributions.
32557+
32558+
6. Trademarks. This License does not grant permission to use the trade
32559+
names, trademarks, service marks, or product names of the Licensor,
32560+
except as required for reasonable and customary use in describing the
32561+
origin of the Work and reproducing the content of the NOTICE file.
32562+
32563+
7. Disclaimer of Warranty. Unless required by applicable law or
32564+
agreed to in writing, Licensor provides the Work (and each
32565+
Contributor provides its Contributions) on an "AS IS" BASIS,
32566+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
32567+
implied, including, without limitation, any warranties or conditions
32568+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
32569+
PARTICULAR PURPOSE. You are solely responsible for determining the
32570+
appropriateness of using or redistributing the Work and assume any
32571+
risks associated with Your exercise of permissions under this License.
32572+
32573+
8. Limitation of Liability. In no event and under no legal theory,
32574+
whether in tort (including negligence), contract, or otherwise,
32575+
unless required by applicable law (such as deliberate and grossly
32576+
negligent acts) or agreed to in writing, shall any Contributor be
32577+
liable to You for damages, including any direct, indirect, special,
32578+
incidental, or consequential damages of any character arising as a
32579+
result of this License or out of the use or inability to use the
32580+
Work (including but not limited to damages for loss of goodwill,
32581+
work stoppage, computer failure or malfunction, or any and all
32582+
other commercial damages or losses), even if such Contributor
32583+
has been advised of the possibility of such damages.
32584+
32585+
9. Accepting Warranty or Additional Liability. While redistributing
32586+
the Work or Derivative Works thereof, You may choose to offer,
32587+
and charge a fee for, acceptance of support, warranty, indemnity,
32588+
or other liability obligations and/or rights consistent with this
32589+
License. However, in accepting such obligations, You may act only
32590+
on Your own behalf and on Your sole responsibility, not on behalf
32591+
of any other Contributor, and only if You agree to indemnify,
32592+
defend, and hold each Contributor harmless for any liability
32593+
incurred by, or claims asserted against, such Contributor by reason
32594+
of your accepting any such warranty or additional liability.
32595+
32596+
END OF TERMS AND CONDITIONS
32597+
32598+
APPENDIX: How to apply the Apache License to your work.
32599+
32600+
To apply the Apache License to your work, attach the following
32601+
boilerplate notice, with the fields enclosed by brackets "[]"
32602+
replaced with your own identifying information. (Don't include
32603+
the brackets!) The text should be enclosed in the appropriate
32604+
comment syntax for the file format. We also recommend that a
32605+
file or class name and description of purpose be included on the
32606+
same "printed page" as the copyright notice for easier
32607+
identification within third-party archives.
32608+
32609+
Copyright [yyyy] [name of copyright owner]
32610+
32611+
Licensed under the Apache License, Version 2.0 (the "License");
32612+
you may not use this file except in compliance with the License.
32613+
You may obtain a copy of the License at
32614+
32615+
http://www.apache.org/licenses/LICENSE-2.0
32616+
32617+
Unless required by applicable law or agreed to in writing, software
32618+
distributed under the License is distributed on an "AS IS" BASIS,
32619+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32620+
See the License for the specific language governing permissions and
32621+
limitations under the License.
32622+
32623+
```
32624+
3241632625
## sha2 - 0.11.0
3241732626
**Repository URL**: https://github.com/RustCrypto/hashes
3241832627
**License Type(s)**: Apache-2.0

Cargo.lock

Lines changed: 18 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/cli/src/launcher.rs

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use crate::error::CliError;
2222
use crate::installer::{
2323
generated_hooks, hook_forward_command, merge_hermes_config, merge_hooks, read_json_file,
2424
};
25+
use crate::plugins::lifecycle::ActiveDynamicPluginComponent;
2526
use crate::server;
2627

2728
/// Runs a child coding-agent command behind an ephemeral local gateway.
@@ -87,6 +88,7 @@ struct TransparentRun {
8788
agent: CodingAgent,
8889
prepared: PreparedRun,
8990
resolved: ResolvedConfig,
91+
dynamic_plugins: Vec<ActiveDynamicPluginComponent>,
9092
listener: TcpListener,
9193
gateway_url: String,
9294
dry_run: bool,
@@ -99,7 +101,15 @@ impl TransparentRun {
99101
async fn new(command: RunCommand, inherited: Option<&ServerArgs>) -> Result<Self, CliError> {
100102
let dry_run = command.dry_run;
101103
let print = command.print;
104+
let explicit_config = command
105+
.config
106+
.as_ref()
107+
.or_else(|| inherited.and_then(|args| args.config.as_ref()));
102108
let mut resolved = resolve_run_config(&command, inherited)?;
109+
let dynamic_plugins = crate::plugins::lifecycle::active_dynamic_plugin_components(
110+
explicit_config,
111+
&resolved,
112+
)?;
103113
let (agent, argv) = resolve_agent_and_argv(&command, &resolved.agents)?;
104114
let listener = TcpListener::bind("127.0.0.1:0").await?;
105115
let address = listener.local_addr()?;
@@ -111,6 +121,7 @@ impl TransparentRun {
111121
agent,
112122
prepared,
113123
resolved,
124+
dynamic_plugins,
114125
listener,
115126
gateway_url,
116127
dry_run,
@@ -134,9 +145,10 @@ impl TransparentRun {
134145
}
135146
self.prepared
136147
.print_live_status(self.agent, &self.gateway_url, &self.resolved);
137-
execute_live_run(
148+
execute_live_run_with_dynamic(
138149
self.listener,
139150
self.resolved.gateway,
151+
self.dynamic_plugins,
140152
&self.gateway_url,
141153
self.prepared,
142154
)
@@ -146,13 +158,24 @@ impl TransparentRun {
146158

147159
// Starts the gateway, waits for readiness, runs the child command, restores temporary state, and then
148160
// maps the child process status to the launcher's exit code.
161+
#[cfg(test)]
149162
async fn execute_live_run(
150163
listener: TcpListener,
151164
gateway_config: GatewayConfig,
152165
gateway_url: &str,
153166
prepared: PreparedRun,
154167
) -> Result<ExitCode, CliError> {
155-
let running_server = RunningGateway::start(listener, gateway_config);
168+
execute_live_run_with_dynamic(listener, gateway_config, Vec::new(), gateway_url, prepared).await
169+
}
170+
171+
async fn execute_live_run_with_dynamic(
172+
listener: TcpListener,
173+
gateway_config: GatewayConfig,
174+
dynamic_plugins: Vec<ActiveDynamicPluginComponent>,
175+
gateway_url: &str,
176+
prepared: PreparedRun,
177+
) -> Result<ExitCode, CliError> {
178+
let running_server = RunningGateway::start(listener, gateway_config, dynamic_plugins);
156179
if let Err(error) = wait_for_health(gateway_url).await {
157180
let restore = prepared.restore();
158181
let server_result = running_server.stop().await;
@@ -269,10 +292,20 @@ struct RunningGateway {
269292
impl RunningGateway {
270293
// Starts the gateway listener on a background task and keeps the shutdown sender paired with the
271294
// task handle so health failures and normal exits use identical cleanup semantics.
272-
fn start(listener: TcpListener, config: crate::config::GatewayConfig) -> Self {
295+
fn start(
296+
listener: TcpListener,
297+
config: crate::config::GatewayConfig,
298+
dynamic_plugins: Vec<ActiveDynamicPluginComponent>,
299+
) -> Self {
273300
let (shutdown_tx, shutdown_rx) = oneshot::channel();
274301
let task = tokio::spawn(async move {
275-
server::serve_listener(listener, config, Some(shutdown_rx)).await
302+
server::serve_listener_with_dynamic(
303+
listener,
304+
config,
305+
dynamic_plugins,
306+
Some(shutdown_rx),
307+
)
308+
.await
276309
});
277310
Self { shutdown_tx, task }
278311
}

crates/cli/src/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,12 @@ async fn run_default(server_args: &ServerArgs) -> Result<ExitCode, error::CliErr
196196
// exists. Once configured, bare `nemo-relay` becomes a quick health check; explicit
197197
// `nemo-relay config` remains the reconfiguration path.
198198
if server_args.requested_daemon_mode() {
199-
let config = config::resolve_server_config(server_args)?;
200-
server::serve(config.gateway).await?;
199+
let resolved = config::resolve_server_config(server_args)?;
200+
let dynamic_plugins = plugins::lifecycle::active_dynamic_plugin_components(
201+
server_args.config.as_ref(),
202+
&resolved,
203+
)?;
204+
server::serve_with_dynamic(resolved.gateway, dynamic_plugins).await?;
201205
Ok(ExitCode::SUCCESS)
202206
} else if config::any_config_file_exists() {
203207
doctor::run_doctor(None, false).await

0 commit comments

Comments
 (0)