nushell/crates/nu-protocol/src/engine
Renan Ribeiro 2d868323b6
Inter-Job direct messaging (#15253)
# Description

This PR implements an experimental inter-job communication model,
through direct message passing, aka "mail"ing or "dm"ing:



- `job send <id>`: Sends a message the job with the given id, the root
job has id 0. Messages are stored in the recipient's "mailbox"
- `job recv`: Returns a stored message, blocks if the mailbox is empty
- `job flush`: Clear all messages from mailbox

Additionally, messages can be sent with a numeric tag, which can then be
filtered with `mail recv --tag`.
This is useful for spawning jobs and receiving messages specifically
from those jobs.

This PR is mostly a proof of concept for how inter-job communication
could look like, so people can provide feedback and suggestions

Closes  #15199

May close #15220 since now jobs can access their own id.

# User-Facing Changes

Adds, `job id`, `job send`, `job recv` and `job flush`  commands.

# Tests + Formatting

[X] TODO:  Implement tests
[X] Consider rewriting some of the job-related tests to use this, to
make them a bit less fragile.

# After Submitting
2025-04-26 23:24:35 +08:00
..
argument.rs Clippy fixes for toolchain bump (#13497) 2024-07-31 14:49:22 +02:00
cached_file.rs Refactor source cache into CachedFile struct (#12240) 2024-03-20 19:43:50 +01:00
call_info.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
call.rs Replace raw usize IDs with new types (#13832) 2024-09-30 13:20:15 +02:00
closure.rs Unify closure serializing logic for to nuon, to msgpack, and to json (#15285) 2025-03-16 20:15:02 +01:00
command.rs Custom command attributes (#14906) 2025-02-11 06:34:51 -06:00
description.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
engine_state.rs Inter-Job direct messaging (#15253) 2025-04-26 23:24:35 +08:00
error_handler.rs Clippy fixes for toolchain bump (#13497) 2024-07-31 14:49:22 +02:00
jobs.rs Inter-Job direct messaging (#15253) 2025-04-26 23:24:35 +08:00
mod.rs Unify closure serializing logic for to nuon, to msgpack, and to json (#15285) 2025-03-16 20:15:02 +01:00
overlay.rs fix: clippy warning of rust 1.8.4 (#14984) 2025-02-02 07:56:54 -06:00
pattern_match.rs Change how and and or operations are compiled to IR to support custom values (#14653) 2024-12-25 06:12:53 -06:00
sequence.rs feat: make ctrlc available to plugins (#13181) 2024-07-30 08:29:18 -05:00
stack_out_dest.rs Fix future clippy lints (#15519) 2025-04-08 08:51:12 +08:00
stack.rs preserve variable capture spans in blocks (#15334) 2025-03-20 14:20:28 -04:00
state_delta.rs feat(lsp): document highlight (#14898) 2025-01-23 05:44:23 -06:00
state_working_set.rs refactor(completion, lsp): include decl_id in suggetion_kind for later usage (#15536) 2025-04-15 07:24:56 -05:00
variable.rs Restructure nu-protocol in more meaningful units (#11917) 2024-03-10 18:45:45 +01:00