KeiSeiKit-1.0/_primitives/_rust/kei-runtime/src
Parfii-bot 8626e23c22 feat(stream-e): invoke wire — kei-runtime subprocess → real atoms
Replace NotImplemented stub with real atom execution per schema
§Runtime invocation contract.

Convention: JSON-in/JSON-out over subprocess. Every refactored crate
exposes `<crate> run-atom <verb>` that reads JSON from stdin (or
--input), dispatches to atoms::<verb>::run, emits Output JSON on
stdout, exits per atom-error class.

Runtime side (kei-runtime):
- InvokeError: +AtomFailed{atom,code,stderr} +SubprocessError
  +OutputParse +BinaryNotFound{crate_name}. NotImplemented kept as
  legacy escape for atoms opting out of run-atom protocol.
- Output: now {atom: String, result: Value} — carries atom's actual
  return value.
- invoke_exit_code: AtomFailed passes through child exit (0..=255),
  Subprocess/OutputParse → 1, BinaryNotFound → 127, NotImplemented → 64.
- Binary resolution: KEI_RUNTIME_BIN_DIR env → PATH fallback.

kei-task side:
- New `pub mod run_atom` in lib.rs
- atoms/mod.rs: VERBS const + DispatchError enum wrapping per-atom errors
- src/run_atom.rs: read_input (stdin/@path/literal), dispatch, exit mapping
- main.rs: Cmd::RunAtom{verb, input} subcommand; collapsed three
  classify_*_error helpers into single classify_dispatch. Legacy
  create/search/add-dependency CLIs preserved.

Tests: 5/5 runtime (+1 invoke_real_atom integration), 9/9 kei-task
(+1 atoms::tests::verbs_list_matches_submodules).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 01:21:00 +08:00
..
discover.rs fix(substrate): E1 — kei-atom-discovery shared crate + 4 critical security fixes 2026-04-23 00:49:49 +08:00
invoke.rs feat(stream-e): invoke wire — kei-runtime subprocess → real atoms 2026-04-23 01:21:00 +08:00
lib.rs feat(stream-d): kei-runtime — discover + validate + lint (invoke stub) 2026-04-23 00:09:58 +08:00
lint.rs Merge fix/e3-contract-compliance — exit codes + invoke Err + strict lint 2026-04-23 00:52:54 +08:00
main.rs feat(stream-e): invoke wire — kei-runtime subprocess → real atoms 2026-04-23 01:21:00 +08:00
validate.rs fix(substrate): amendment A-1 (input/output required all kinds) + integration test + jsonschema 0.18 relative-$id bug 2026-04-23 00:56:27 +08:00