File size: 2,217 Bytes
a6a5d8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# @szl-holdings/a11oy-mesh-router

Substrate-side typed HTTP router from a11oy to its sibling organs.

a11oy is the skeleton/substrate. It routes:

- **reasoning / memory** to **amaru** (the brain) — `GET /state`, `GET /receipts`, `POST /chakra/{name}/evaluate`
- **policy / threat verdicts** to **sentra** (the immune organ) — `POST /v1/verdict`
- **operator I/O** to **rosie** (the operator console) — `POST /v1/events`

## Why this exists

The cross-repo mining audit found that two anatomy wires were declared but had
no runtime client in a11oy:

- a11oy → amaru memory query (the brain ↔ skeleton path was one-directional)
- a11oy → sentra delegation (nothing called the immune organ at runtime)

This package is the substrate-side client for those calls. Strategy: wire over
HTTP using each producer's existing server (instillation strategy C).

## Honest wiring state

- **amaru** exposes the FastAPI sidecar routes called here (verified in the
  cross-repo server index): `GET /state`, `GET /receipts`,
  `POST /chakra/{name}/evaluate`.
- **sentra** does **not** yet expose an inbound verdict HTTP server. The
  contract path is `POST /v1/verdict`. Until sentra ships that route,
  `requestSentraVerdict` **fails closed** (returns `deny`) on any transport
  error, so a missing immune organ never silently allows an action.
- **rosie** event sink is the agreed contract path; rosie wires its inbound
  surface separately.

## Usage

```ts
import { meshConfigFromEnv, queryAmaruState, requestSentraVerdict } from "@szl-holdings/a11oy-mesh-router";

const cfg = meshConfigFromEnv(); // reads A11OY_AMARU_URL / A11OY_SENTRA_URL / A11OY_ROSIE_URL

const state = await queryAmaruState(cfg);          // GET amaru /state
const verdict = await requestSentraVerdict(cfg, {  // POST sentra /v1/verdict (fail closed)
  actionId: "act-123",
  kind: "egress",
  payload: { bytes: 4096 },
});
```

## Test

```
npm test   # node --experimental-strip-types src/index.test.ts
```

The tests boot a real loopback `node:http` server on an ephemeral port and
exercise every function over real TCP — no transport mock.

## License

Apache-2.0 © 2026 SZL Holdings (Stephen P. Lutar Jr., ORCID 0009-0001-0110-4173)