code wiki / (root) / nx_tool_run.nx

nx_tool_run.nx

buildroot/runtime/nx_tool_run.nx

9340 B195 linesdepth 2pulls 2 transitivereach 109 importersview sourcekind librarytopic tool
docsdependenciesstructsconstsfunctions

about

nx_tool_run.nx -- R0 of the EXECUTABLE-API rung: the sovereign exec+capture primitive the ecosystem is missing. Today nishifamily.com/api/tools + /mcp only LIST tools (a read-only registry) and MCP tools/call returns a SAFE STUB ("invoked X (capability-authorized)") -- there is NO way to actually RUN an organ and hand back its real stdout. This organ is that missing capability, built hardware-up from raw syscalls (fork/pipe/dup3/execve/wait4), reusing the EXACT proven wrappers from nx_hostctl's hc_dfork_exec so it inherits the same never-brick discipline. NO /bin/sh, NO shell string, NO PATH search -- callers pass an ABSOLUTE ELF path (the allowlist layer that maps tool-name -> path is R1, nx_tool_registry). Synchronous (wait4), unlike hc_dfork_exec's detach -- because an API tools/call needs the child's OUTPUT and EXIT CODE, not a fire-and-forget daemon. license_tier: ORIGINAL

dependencies 1 imports · 73 importers

nx_syscalls.nx nx_tool_run.nx nx_actlog.nx nx_atlas_citeverify.nx nx_atlas_citeverify2.nx nx_atlas_sweep.nx nx_autofix_auto.nx nx_autofix_gate.nx nx_autofix_intake_gate.nx nx_autofix_localfix.nx nx_autograde_gate.nx nx_bd_calc_gate.nx

diagram shows first 10 each side; +0 more imports, +63 more importers in the complete lists below.

imports: nx_syscalls.nx

imported by: nx_actlog.nxnx_atlas_citeverify.nxnx_atlas_citeverify2.nxnx_atlas_sweep.nxnx_autofix_auto.nxnx_autofix_gate.nxnx_autofix_intake_gate.nxnx_autofix_localfix.nxnx_autograde_gate.nxnx_bd_calc_gate.nxnx_bugforge.nxnx_capaxes_derive.nxnx_capaxes_derive_test.nxnx_capgraph_derive_lib.nxnx_capgraph_edges_lib.nxnx_capgraph_selfcheck.nxnx_claude_harvest.nxnx_clobber_guard_gate.nxnx_companion_sota.nxnx_compare_regen.nxnx_constscan_beat.nxnx_content_ship.nxnx_debt_hygiene.nxnx_debt_view.nxnx_debtconfirm.nxnx_debtmine.nxnx_dedup_migrate.nxnx_discovery_selfheal_beat.nxnx_drift_watch.nxnx_ecomat_put_gate.nxnx_featuremine.nxnx_feed_gate.nxnx_fitloop.nxnx_fixflywheel.nxnx_flip_gate.nxnx_gate_build_sweep.nxnx_gate_lib.nxnx_gate_migrate.nxnx_gateverify.nxnx_govern_sweep_gate.nxnx_landmine_probe.nxnx_law_warden.nxnx_magicratchet.nxnx_mesh_run.nxnx_mgmt_data.nxnx_minecov.nxnx_minerhub.nxnx_office_serve.nxnx_orchestrate.nxnx_pagepub.nxnx_product_score.nxnx_pub_reconcile.nxnx_rebuild_plan_test.nxnx_registrymine.nxnx_restage.nxnx_route_diff.nxnx_seat.nxnx_ship.nxnx_stale_check.nxnx_store_collision_check_gate.nxnx_store_fold_beat.nxnx_store_janitor_beat.nxnx_swapguard_beat.nxnx_tool_exec_allow.nxnx_tool_run_gate.nxnx_tool_run_timeout_gate.nxnx_trajscan_beat.nxnx_treediverge_beat.nxnx_ui_audit.nxnx_ui_struct.nxnx_ui_tdist.nxnx_ui_zss.nxnx_workflowmine.nx

structs

none

consts

86const TR_ERR_TIMEOUT: i64 = 0 - 5
87const TR_SIGKILL: i64 = 9

functions

21func tr_run_capture(path: *u8, argv: *i64, out: *u8, cap: i64, outlen: *i64) -> i64
91func tr_run_capture_to(path: *u8, argv: *i64, out: *u8, cap: i64, outlen: *i64, timeout_ms: i64) -> i64
165func tr_run1(path: *u8, arg: *u8, out: *u8, cap: i64, outlen: *i64) -> i64
173func tr_run1_to(path: *u8, arg: *u8, out: *u8, cap: i64, outlen: *i64, timeout_ms: i64) -> i64
181func tr_contains(buf: *u8, n: i64, needle: *u8) -> i64