nx_gtm_svc.nx
buildroot/runtime/nx_gtm_svc.nx
about
nx_gtm_svc.nx -- GO-TO-MARKET SERVICE FACADE. One agentic tool over the
whole supplement/drug go-to-market stack: it composes the eight GTM library
modules and exposes them as verb-dispatched JSON endpoints, inheriting the
wire format, error shape and self-description from nx_service.
THIS IS WHAT "MCP / API / AGENTIC / WORKFLOW READY" MEANS CONCRETELY.
MCP-ready: a single fork-exec organ with a stable name + argv verb
contract, registerable in tool_allowlist.conf and via
/api/tools/register (fixed-arg pinning not needed -- the
verb IS the first arg, and every handler is read-only).
API-ready: pure stdout JSON with a versioned envelope + CORS-safe
structured errors, drivable behind an HTTP route.
agentic-ready: the `describe` verb emits this facade's own verb catalog
with arg shapes -- an agent discovers what it can call,
the service-level analog of MCP tools/list.
workflow-ready: every verb is a PURE function of its arguments and returns
a self-contained JSON object, so a pipeline can fan a list
of ingredients through `ingredient.class` and feed the
survivors into `formula.assess` with no shared state.
scalable: stateless; a call is a fork-exec; concurrency is free.
USAGE: nx_gtm_svc <verb> [args...]
describe
ingredient.info <id>
formula.assess <retail_cents> <margin_permil> <servings> <fmt 1|2>
claims.classify <sentence...> (joins remaining argv)
jurisdiction.path <market> <ingredient>
channel.best <ingredient>
pathway.programme <prior 0|1|2>
ethics.rank <jurisdiction>
supply.effective <base> <spend_k>
The heavy lifting stays in the libraries; this file is dispatch + shape.
It adds NO new domain logic -- every number comes from a gated module -- so
the facade cannot drift from the science it exposes.
genealogy_id: supplement_gtm + service_infrastructure
dependencies 11 imports · 0 importers
diagram shows first 10 each side; +1 more imports, +0 more importers in the complete lists below.
imports: nx_syscalls.nxnx_service.nxnx_grounding.nxnx_supp_ingredient.nxnx_supp_formula.nxnx_supp_claims.nxnx_supp_jurisdiction.nxnx_supp_channel.nxnx_drug_pathway.nxnx_trial_ethics.nxnx_supply_risk.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 50 | const GTM_MAGIC_1024: i64 = 1024 |
| 51 | const GTM_MAGIC_8192: i64 = 8192 |
| 53 | const GTM_SVC: *u8 = "gtm" as *u8 |
functions
| 61 | func gtm_describe(j: *NxJson) -> i64 |
| 84 | func gtm_ingredient_info(j: *NxJson, id: i64) -> i64 |
| 113 | func gtm_build_ref_stack() -> *NxSuppFormula |
| 125 | func gtm_formula_assess(j: *NxJson, retail: i64, margin: i64, servings: i64, fmt: i64) -> i64 |
| 168 | func gtm_join_args(argc: i64, argv: *i64, start: i64, out: *u8, cap: i64) -> i64 called by 1: gtm_dispatch |
| 187 | func gtm_claims_classify(j: *NxJson, sentence: *u8) -> i64 |
| 209 | func gtm_jurisdiction_path(j: *NxJson, market: i64, ingredient: i64) -> i64 |
| 240 | func gtm_channel_best(j: *NxJson, ingredient: i64) -> i64 |
| 264 | func gtm_pathway_programme(j: *NxJson, prior: i64) -> i64 called by 1: gtm_dispatch calls 10: nsvc_ok_opennj_kv_intnj_commanj_kv_booldp_reliance_availabledp_programme_cost_k+4 |
| 283 | func gtm_ethics_rank(j: *NxJson, jur: i64) -> i64 |
| 308 | func gtm_supply_effective(j: *NxJson, base: i64, spend_k: i64) -> i64 |
| 342 | func gtm_dispatch(argc: i64, argv: *i64, j: *NxJson) -> i64 called by 1: main calls 15: nsvc_arggtm_describensvc_streqgtm_ingredient_infonsvc_arg_intgtm_formula_assess+9 |
| 387 | func main(argc: i64, argv: *i64) -> i64 |