code wiki / (root) / nx_gtm_svc.nx

nx_gtm_svc.nx

buildroot/runtime/nx_gtm_svc.nx

15949 B392 linesdepth 4pulls 12 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_service.nx nx_grounding.nx nx_supp_ingredient.nx nx_supp_formula.nx nx_supp_claims.nx nx_supp_jurisdiction.nx nx_supp_channel.nx nx_drug_pathway.nx nx_trial_ethics.nx nx_gtm_svc.nx

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

main nx_json_new sys_mmap gtm_dispatch nsvc_arg gtm_describe nsvc_ok_open nj_putc nj_kv_int nj_key nj_putstr nj_putc ↻ nj_puti nj_putc ↻ sys_mmap ↻ nj_comma nj_putc ↻ nj_kv_str nj_key ↻ nj_putstr ↻ nj_kv_bool nj_key ↻ nj_puts nj_putc ↻ nj_key ↻ nj_kv_str ↻ nj_comma ↻ nj_kv_int ↻ nj_key ↻ nj_puts ↻ nsvc_ok_close_g nsvc_ground nj_comma ↻ nj_kv_str ↻ gnd_name nj_kv_bool ↻ gnd_is_verified gnd_meaning nsvc_ok_close nj_putc ↻

structs

none

consts

50const GTM_MAGIC_1024: i64 = 1024
51const GTM_MAGIC_8192: i64 = 8192
53const GTM_SVC: *u8 = "gtm" as *u8

functions

61func gtm_describe(j: *NxJson) -> i64
84func gtm_ingredient_info(j: *NxJson, id: i64) -> i64
113func gtm_build_ref_stack() -> *NxSuppFormula
125func gtm_formula_assess(j: *NxJson, retail: i64, margin: i64, servings: i64, fmt: i64) -> i64
168func gtm_join_args(argc: i64, argv: *i64, start: i64, out: *u8, cap: i64) -> i64
called by 1: gtm_dispatch
187func gtm_claims_classify(j: *NxJson, sentence: *u8) -> i64
209func gtm_jurisdiction_path(j: *NxJson, market: i64, ingredient: i64) -> i64
240func gtm_channel_best(j: *NxJson, ingredient: i64) -> i64
264func gtm_pathway_programme(j: *NxJson, prior: i64) -> i64
283func gtm_ethics_rank(j: *NxJson, jur: i64) -> i64
308func gtm_supply_effective(j: *NxJson, base: i64, spend_k: i64) -> i64
342func gtm_dispatch(argc: i64, argv: *i64, j: *NxJson) -> i64
387func main(argc: i64, argv: *i64) -> i64