@ship.zone/runner 3.0.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/.smartconfig.json +19 -1
  2. package/changelog.md +61 -0
  3. package/dist_rust/runnerworkspace_linux_amd64_musl +0 -0
  4. package/dist_rust/runnerworkspace_linux_amd64_musl.tsrust-build.json +4 -4
  5. package/dist_rust/runnerworkspace_linux_arm64_musl +0 -0
  6. package/dist_rust/runnerworkspace_linux_arm64_musl.tsrust-build.json +4 -4
  7. package/dist_ts/00_commitinfo_data.js +3 -3
  8. package/dist_ts/api-client.d.ts +2 -1
  9. package/dist_ts/api-client.js +10 -2
  10. package/dist_ts/artifact-manager.js +1 -1
  11. package/dist_ts/attempt-state.js +1 -1
  12. package/dist_ts/cache-manager.js +1 -1
  13. package/dist_ts/cli-entry.js +17 -3
  14. package/dist_ts/cli.d.ts +7 -0
  15. package/dist_ts/cli.js +155 -35
  16. package/dist_ts/config.js +75 -22
  17. package/dist_ts/egress-proxy.d.ts +99 -0
  18. package/dist_ts/egress-proxy.js +607 -0
  19. package/dist_ts/errors.js +1 -1
  20. package/dist_ts/filesystem.js +1 -1
  21. package/dist_ts/index.d.ts +5 -1
  22. package/dist_ts/index.js +6 -2
  23. package/dist_ts/interfaces.d.ts +85 -31
  24. package/dist_ts/interfaces.js +1 -1
  25. package/dist_ts/log-sender.js +1 -1
  26. package/dist_ts/microvm-executor.d.ts +90 -0
  27. package/dist_ts/microvm-executor.js +1078 -0
  28. package/dist_ts/node-version.d.ts +11 -0
  29. package/dist_ts/node-version.js +43 -0
  30. package/dist_ts/npm-grants.d.ts +9 -0
  31. package/dist_ts/npm-grants.js +44 -0
  32. package/dist_ts/oci-registry.d.ts +73 -0
  33. package/dist_ts/oci-registry.js +508 -0
  34. package/dist_ts/plugins.d.ts +6 -2
  35. package/dist_ts/plugins.js +7 -3
  36. package/dist_ts/protocol-validator.d.ts +3 -5
  37. package/dist_ts/protocol-validator.js +27 -51
  38. package/dist_ts/redactor.js +1 -1
  39. package/dist_ts/registration-state.js +1 -1
  40. package/dist_ts/runner.d.ts +5 -5
  41. package/dist_ts/runner.js +47 -22
  42. package/dist_ts/source-workspace.js +1 -1
  43. package/dist_ts/spec-version.js +1 -1
  44. package/dist_ts/staging-scavenger.js +1 -1
  45. package/dist_ts/state-owner.js +4 -2
  46. package/dist_ts/transfer-archive.js +1 -1
  47. package/dist_ts/validation.js +1 -1
  48. package/dist_ts/vsock-protocol.d.ts +130 -0
  49. package/dist_ts/vsock-protocol.js +336 -0
  50. package/dist_ts/wire-schema.js +1 -1
  51. package/package.json +19 -15
  52. package/readme.md +106 -108
  53. package/rust/Cargo.lock +1 -0
  54. package/rust/Cargo.toml +2 -1
  55. package/rust/src/cpio.rs +147 -0
  56. package/rust/src/extfs.rs +747 -0
  57. package/rust/src/guest.rs +2411 -0
  58. package/rust/src/lib.rs +41 -0
  59. package/rust/src/main.rs +6 -1
  60. package/rust/src/oci_tar.rs +842 -0
  61. package/ts/00_commitinfo_data.ts +2 -2
  62. package/ts/api-client.ts +19 -1
  63. package/ts/cli-entry.ts +15 -2
  64. package/ts/cli.ts +172 -40
  65. package/ts/config.ts +100 -25
  66. package/ts/egress-proxy.ts +649 -0
  67. package/ts/index.ts +5 -1
  68. package/ts/interfaces.ts +97 -30
  69. package/ts/microvm-executor.ts +1310 -0
  70. package/ts/node-version.ts +49 -0
  71. package/ts/npm-grants.ts +49 -0
  72. package/ts/oci-registry.ts +649 -0
  73. package/ts/plugins.ts +6 -2
  74. package/ts/protocol-validator.ts +29 -58
  75. package/ts/runner.ts +48 -21
  76. package/ts/state-owner.ts +8 -1
  77. package/ts/vsock-protocol.ts +437 -0
  78. package/dist_ts/oci-executor.d.ts +0 -155
  79. package/dist_ts/oci-executor.js +0 -2238
  80. package/ts/oci-executor.ts +0 -2989
package/rust/src/lib.rs CHANGED
@@ -1,6 +1,11 @@
1
1
  #[cfg(not(unix))]
2
2
  compile_error!("runnerworkspace requires a Unix platform");
3
3
 
4
+ pub mod cpio;
5
+ pub mod extfs;
6
+ pub mod guest;
7
+ pub mod oci_tar;
8
+
4
9
  use serde::Serialize;
5
10
  use std::ffi::CString;
6
11
  use std::ffi::OsString;
@@ -662,6 +667,42 @@ where
662
667
  }
663
668
  own_state(&state_directory)
664
669
  }
670
+ "build-initrd" => {
671
+ let mut options = Options::parse(iterator)?;
672
+ let binary = PathBuf::from(options.take_one("--binary")?);
673
+ let output = PathBuf::from(options.take_one("--output")?);
674
+ options.finish()?;
675
+ let bytes = cpio::build_initrd(&binary, &output)?;
676
+ emit_json(&serde_json::json!({ "bytes": bytes }))
677
+ }
678
+ "build-rootfs" => {
679
+ let mut options = Options::parse(iterator)?;
680
+ let output = PathBuf::from(options.take_one("--output")?);
681
+ let maximum_bytes = parse_u64(options.take_one("--maximum-bytes")?)?;
682
+ let layers = options
683
+ .take_many("--layer")
684
+ .into_iter()
685
+ .map(PathBuf::from)
686
+ .collect::<Vec<_>>();
687
+ options.finish()?;
688
+ let layer_refs = layers.iter().map(PathBuf::as_path).collect::<Vec<_>>();
689
+ let root = oci_tar::apply_oci_layers(&layer_refs, maximum_bytes)?;
690
+ let bytes = extfs::write_ext2_image(&root, &output)?;
691
+ emit_json(&serde_json::json!({ "bytes": bytes }))
692
+ }
693
+ "guest-init" => {
694
+ let mut options = Options::parse(iterator)?;
695
+ let unix_socket = options.take_one("--unix-socket").ok().map(PathBuf::from);
696
+ let workspace = options.take_one("--workspace").ok().map(PathBuf::from);
697
+ options.finish()?;
698
+ match (unix_socket, workspace) {
699
+ (Some(sock), Some(ws)) => guest::serve_unix_socket(&sock, &ws),
700
+ (None, None) => guest::run_pid1(),
701
+ _ => Err(Error::new(
702
+ "guest-init requires both --unix-socket and --workspace or neither",
703
+ )),
704
+ }
705
+ }
665
706
  _ => Err(Error::new("unknown command")),
666
707
  }
667
708
  }
package/rust/src/main.rs CHANGED
@@ -3,7 +3,12 @@
3
3
  static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
4
4
 
5
5
  fn main() {
6
- if let Err(error) = runnerworkspace::run(std::env::args_os().skip(1)) {
6
+ let result = if runnerworkspace::guest::invoked_as_pid1() {
7
+ runnerworkspace::guest::run_pid1()
8
+ } else {
9
+ runnerworkspace::run(std::env::args_os().skip(1))
10
+ };
11
+ if let Err(error) = result {
7
12
  eprintln!("runnerworkspace: {error}");
8
13
  std::process::exit(error.exit_code());
9
14
  }