Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A command World proposal #509

Closed
sunfishcode opened this issue Jan 28, 2023 · 7 comments
Closed

A command World proposal #509

sunfishcode opened this issue Jan 28, 2023 · 7 comments

Comments

@sunfishcode
Copy link
Member

We should create a CLI command World proposal.

As has been discussed at various WASI Subgroup meetings, the idea is to have a command entrypoint function which has arguments for things like command-line arguments, environment variables, preopens, and stdio, and to have it include wasi-filesystem, wasi-sockets, wasi-clocks, wasi-random, and others that make up a typical CLI command environment.

@sunfishcode
Copy link
Member Author

We should make sure that it supports preopened files, as well as preopened directories, as discussed here.

@sunfishcode sunfishcode transferred this issue from WebAssembly/wasi-filesystem Jan 28, 2023
@sunfishcode
Copy link
Member Author

(I originally opened this in wasi-filesystem by mistake; I've now transferred it to the WASI repo.)

@codefromthecrypt
Copy link
Contributor

what does "World proposal" imply? this is a top-level proposal like wasi-filesystem? would it be called wasi-command?Besides what has been mentioned, would this be the thing that defines in fact memory is required for everything? or would each proposal (e.g. filesystem) have in their WIT that the guest needs to export that?

@sunfishcode
Copy link
Member Author

Wit defines a World construct, which is a way to collect sets of interfaces. For additional background I also have a blog post about Worlds.

This command World would be the first WASI proposal that contains a World rather than just being an interface. We'll likely need to do some administrative work to set this up, including updating to a newer version of the wit tooling to support this.

The spec that defines how linear memory used in wit APIs is the Canonical ABI.

@sunfishcode
Copy link
Member Author

This proposal should specify the meaning of the first argument, to fix WebAssembly/wasi-classic-command#7, which is also being fixed for preview1 in #510.

sunfishcode added a commit to WebAssembly/wasi-classic-command that referenced this issue Jan 28, 2023
Mention WebAssembly/WASI#509, which is the place to follow for now.
sunfishcode added a commit to WebAssembly/wasi-classic-command that referenced this issue Jan 28, 2023
Mention WebAssembly/WASI#509, which is the place to follow for now.
@sunfishcode
Copy link
Member Author

sunfishcode commented Jan 28, 2023

Here's a rough sketch of what the world might look like:

default world wasi-command {
  import wasi-clocks: pkg.wasi-clocks
  import wasi-default-clocks: pkg.wasi-clocks.wasi-default-clocks
  import wasi-stderr: pkg.wasi-stderr
  import wasi-filesystem: pkg.wasi-filesystem
  import wasi-random: pkg.wasi-random
  import wasi-poll: pkg.wasi-poll
  import wasi-io: pkg.wasi-io
  import wasi-sockets: pkg.wasi-sockets
  import wasi-exit: pkg.wasi-exit

  variant preopen {
     file(descriptor),
     directory(descriptor),
     socket(socket)
  }

  export command: func(
    stdin: tuple<input-stream, input-terminal>,
    stdout: tuple<output-stream, output-terminal>,
    args: list<string>,
    env-vars: list<tuple<string, string>>,
    preopens: list<tuple<preopen, string>>,
    timezone: timezone,
  ) -> result
}

@sunfishcode
Copy link
Member Author

The command world proposal is now in active development at https://github.com/WebAssembly/wasi-cli !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants