@x12i/memorix-service 3.6.4 → 3.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +223 -191
- package/dist/access-gate.d.ts +11 -0
- package/dist/access-gate.d.ts.map +1 -1
- package/dist/access-gate.js +33 -0
- package/dist/access-gate.js.map +1 -1
- package/dist/app.d.ts +2 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +16 -1
- package/dist/app.js.map +1 -1
- package/dist/caller-identity.d.ts +37 -0
- package/dist/caller-identity.d.ts.map +1 -0
- package/dist/caller-identity.js +77 -0
- package/dist/caller-identity.js.map +1 -0
- package/dist/catalog-store-cli.js +11 -11
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +7 -5
- package/dist/cli.js.map +1 -1
- package/dist/deployment-identity.d.ts +19 -0
- package/dist/deployment-identity.d.ts.map +1 -0
- package/dist/deployment-identity.js +105 -0
- package/dist/deployment-identity.js.map +1 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +68 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +1 -0
- package/dist/live.js.map +1 -1
- package/dist/magit/magit-pack-service.d.ts +1 -1
- package/dist/magit/magit-pack-service.js +4 -4
- package/dist/openapi/openapi.json +393 -2
- package/dist/platform.d.ts +2 -0
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +28 -6
- package/dist/platform.js.map +1 -1
- package/dist/request-countex.d.ts +56 -0
- package/dist/request-countex.d.ts.map +1 -0
- package/dist/request-countex.js +206 -0
- package/dist/request-countex.js.map +1 -0
- package/dist/routes/data.d.ts.map +1 -1
- package/dist/routes/data.js +2 -1
- package/dist/routes/data.js.map +1 -1
- package/dist/routes/metadata.d.ts.map +1 -1
- package/dist/routes/metadata.js +27 -1
- package/dist/routes/metadata.js.map +1 -1
- package/openapi/openapi.json +393 -2
- package/package.json +109 -108
package/README.md
CHANGED
|
@@ -1,191 +1,223 @@
|
|
|
1
|
-
# `@x12i/memorix-service`
|
|
2
|
-
|
|
3
|
-
Sole production **HTTP composition root** over accepted Memorix packages.
|
|
4
|
-
|
|
5
|
-
Remote apps should **call** this service over HTTP — not reinvent wiring by installing every engine. Running the process (or a hosted deployment) is the product surface.
|
|
6
|
-
|
|
7
|
-
## Install / run
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install @x12i/memorix-service@3.6.0 # composition library / CLI
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Prefer the monorepo stack (service + Studio + opx-source):
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
# from repo root
|
|
17
|
-
node scripts/dev-stack.mjs
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Or this package alone:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
MEMORIX_SERVICE_MODE=prod MONGO_URI=mongodb://127.0.0.1:27017 npm run serve
|
|
24
|
-
MEMORIX_SERVICE_MODE=dev npm run dev # metadata in-memory; durable routes 503 without Mongo
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
| | |
|
|
28
|
-
|--|--|
|
|
29
|
-
| Default port | **5100** (`MEMORIX_SERVICE_PORT`, zone `memorix`) |
|
|
30
|
-
| OpenAPI | `GET /api/openapi.json` |
|
|
31
|
-
| Live view | `GET /_live` (`@x12i/core-service` → `@x12i/api-live-view`) |
|
|
32
|
-
| Health | `GET /health` |
|
|
33
|
-
|
|
34
|
-
Compliance: this process uses **`@x12i/core-service`** (zone port, health, live view, correlation-id).
|
|
35
|
-
|
|
36
|
-
## Dual-mode org blob plane (cloud / on-prem)
|
|
37
|
-
|
|
38
|
-
Not Magit. When storing **org/connector object payloads** that would use cloud buckets,
|
|
39
|
-
on-prem must use **local disk**.
|
|
40
|
-
|
|
41
|
-
| Env | Effect |
|
|
42
|
-
|-----|--------|
|
|
43
|
-
| `MEMORIX_BLOB_BACKEND` | `disk` / `onprem` (default) or `s3` / `cloud` |
|
|
44
|
-
| `MEMORIX_BLOB_ROOT` | Disk root for on-prem (default `.memorix-blobs`) |
|
|
45
|
-
| `MEMORIX_S3_BUCKET` | Required when backend=`s3` |
|
|
46
|
-
| `MEMORIX_RESTRICTED_KEK` | Optional AES-GCM KEK for disk-encrypted restricted bodies |
|
|
47
|
-
|
|
48
|
-
Used by **`/api/restricted-store/v1`** (FG-A3). See
|
|
49
|
-
[restricted-store.md](../docs/connector-framework/restricted-store.md) and
|
|
50
|
-
[integration-registry.md](../docs/connector-framework/integration-registry.md).
|
|
51
|
-
|
|
52
|
-
## Magit package catalog
|
|
53
|
-
|
|
54
|
-
Default-on when durable Mongo is configured (`METADATA_MAGIT=0` disables).
|
|
55
|
-
|
|
56
|
-
| Mode | Config |
|
|
57
|
-
|------|--------|
|
|
58
|
-
| **A typed store** | `MAGIT_PACKAGE_STORE_SELECTOR` + `MAGIT_PACKAGE_TYPE_ID` |
|
|
59
|
-
| **B flat catalog** | both unset |
|
|
60
|
-
|
|
61
|
-
Requires `@x12i/magit@2.14.0`. Defaults: `MAGIT_CATALOG_TENANT=x12i`, `MAGIT_CATALOG_REPO=memorix`.
|
|
62
|
-
|
|
63
|
-
Ops (provision / verify / recover / channels / smoke): see
|
|
64
|
-
[documentation/magit-typed-store-runbook.md](../documentation/magit-typed-store-runbook.md).
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
npm run catalog:provision -- --out /secure/magit-store.env --confirm-allowed-kinds
|
|
68
|
-
npm run catalog:verify
|
|
69
|
-
npm run catalog:recover -- --store-id st_… --out /secure/magit-store.env
|
|
70
|
-
npm run catalog:list
|
|
71
|
-
npm run magit:cross-env-smoke
|
|
72
|
-
npm run magit:cross-env-smoke -- --publish
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
**Owner mint:** repo `memorix`, Package stores **empty** until the store exists.
|
|
76
|
-
**Consumer:** store grant + `repoIds: []` (Repositories unchecked).
|
|
77
|
-
Channels and release sets need Mode A + publisher token to promote; consumers only resolve.
|
|
78
|
-
|
|
79
|
-
Env examples: [memorix-service/.env.example](./.env.example). Selector never appears in Studio or `GET /api/diagnostics/scope`.
|
|
80
|
-
|
|
81
|
-
## Library exports
|
|
82
|
-
|
|
83
|
-
When embedding the composition root in-process:
|
|
84
|
-
|
|
85
|
-
```ts
|
|
86
|
-
import {
|
|
87
|
-
createMemorixPlatform,
|
|
88
|
-
createMemorixServiceApp,
|
|
89
|
-
startMemorixServiceHttp,
|
|
90
|
-
} from "@x12i/memorix-service";
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## Scope headers
|
|
94
|
-
|
|
95
|
-
Every `/api/*` request requires:
|
|
96
|
-
|
|
97
|
-
```http
|
|
98
|
-
x-memorix-org-id: sandboxdemo
|
|
99
|
-
x-memorix-agent-ids: opx
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Singular `agentId` headers are rejected. `agentIds[]` selects **effective metadata**; `orgId` selects the **data** universe.
|
|
103
|
-
|
|
104
|
-
### Org identity is case-insensitive (MX-ORG-01)
|
|
105
|
-
|
|
106
|
-
Org ids are canonicalized with trim + `toLocaleLowerCase("en-US")`. Matching is
|
|
107
|
-
case-insensitive (`TGI` / `tgi` / `Tgi` are the same org). `scope.orgId`,
|
|
108
|
-
`addressing.orgId`, and storage keys always use that canonical form, so writers
|
|
109
|
-
and readers that differ only by case share one tenant bag. Empty / missing org
|
|
110
|
-
is still rejected (400).
|
|
111
|
-
|
|
112
|
-
###
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
|
158
|
-
|
|
159
|
-
| `
|
|
160
|
-
| `
|
|
161
|
-
| `
|
|
162
|
-
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
1
|
+
# `@x12i/memorix-service`
|
|
2
|
+
|
|
3
|
+
Sole production **HTTP composition root** over accepted Memorix packages.
|
|
4
|
+
|
|
5
|
+
Remote apps should **call** this service over HTTP — not reinvent wiring by installing every engine. Running the process (or a hosted deployment) is the product surface.
|
|
6
|
+
|
|
7
|
+
## Install / run
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @x12i/memorix-service@3.6.0 # composition library / CLI
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Prefer the monorepo stack (service + Studio + opx-source):
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# from repo root
|
|
17
|
+
node scripts/dev-stack.mjs
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or this package alone:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
MEMORIX_SERVICE_MODE=prod MONGO_URI=mongodb://127.0.0.1:27017 npm run serve
|
|
24
|
+
MEMORIX_SERVICE_MODE=dev npm run dev # metadata in-memory; durable routes 503 without Mongo
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| | |
|
|
28
|
+
|--|--|
|
|
29
|
+
| Default port | **5100** (`MEMORIX_SERVICE_PORT`, zone `memorix`) |
|
|
30
|
+
| OpenAPI | `GET /api/openapi.json` |
|
|
31
|
+
| Live view | `GET /_live` (`@x12i/core-service` → `@x12i/api-live-view`) |
|
|
32
|
+
| Health | `GET /health` |
|
|
33
|
+
|
|
34
|
+
Compliance: this process uses **`@x12i/core-service`** (zone port, health, live view, correlation-id).
|
|
35
|
+
|
|
36
|
+
## Dual-mode org blob plane (cloud / on-prem)
|
|
37
|
+
|
|
38
|
+
Not Magit. When storing **org/connector object payloads** that would use cloud buckets,
|
|
39
|
+
on-prem must use **local disk**.
|
|
40
|
+
|
|
41
|
+
| Env | Effect |
|
|
42
|
+
|-----|--------|
|
|
43
|
+
| `MEMORIX_BLOB_BACKEND` | `disk` / `onprem` (default) or `s3` / `cloud` |
|
|
44
|
+
| `MEMORIX_BLOB_ROOT` | Disk root for on-prem (default `.memorix-blobs`) |
|
|
45
|
+
| `MEMORIX_S3_BUCKET` | Required when backend=`s3` |
|
|
46
|
+
| `MEMORIX_RESTRICTED_KEK` | Optional AES-GCM KEK for disk-encrypted restricted bodies |
|
|
47
|
+
|
|
48
|
+
Used by **`/api/restricted-store/v1`** (FG-A3). See
|
|
49
|
+
[restricted-store.md](../docs/connector-framework/restricted-store.md) and
|
|
50
|
+
[integration-registry.md](../docs/connector-framework/integration-registry.md).
|
|
51
|
+
|
|
52
|
+
## Magit package catalog
|
|
53
|
+
|
|
54
|
+
Default-on when durable Mongo is configured (`METADATA_MAGIT=0` disables).
|
|
55
|
+
|
|
56
|
+
| Mode | Config |
|
|
57
|
+
|------|--------|
|
|
58
|
+
| **A typed store** | `MAGIT_PACKAGE_STORE_SELECTOR` + `MAGIT_PACKAGE_TYPE_ID` |
|
|
59
|
+
| **B flat catalog** | both unset |
|
|
60
|
+
|
|
61
|
+
Requires `@x12i/magit@2.14.0`. Defaults: `MAGIT_CATALOG_TENANT=x12i`, `MAGIT_CATALOG_REPO=memorix`.
|
|
62
|
+
|
|
63
|
+
Ops (provision / verify / recover / channels / smoke): see
|
|
64
|
+
[documentation/magit-typed-store-runbook.md](../documentation/magit-typed-store-runbook.md).
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm run catalog:provision -- --out /secure/magit-store.env --confirm-allowed-kinds
|
|
68
|
+
npm run catalog:verify
|
|
69
|
+
npm run catalog:recover -- --store-id st_… --out /secure/magit-store.env
|
|
70
|
+
npm run catalog:list
|
|
71
|
+
npm run magit:cross-env-smoke
|
|
72
|
+
npm run magit:cross-env-smoke -- --publish
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Owner mint:** repo `memorix`, Package stores **empty** until the store exists.
|
|
76
|
+
**Consumer:** store grant + `repoIds: []` (Repositories unchecked).
|
|
77
|
+
Channels and release sets need Mode A + publisher token to promote; consumers only resolve.
|
|
78
|
+
|
|
79
|
+
Env examples: [memorix-service/.env.example](./.env.example). Selector never appears in Studio or `GET /api/diagnostics/scope`.
|
|
80
|
+
|
|
81
|
+
## Library exports
|
|
82
|
+
|
|
83
|
+
When embedding the composition root in-process:
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import {
|
|
87
|
+
createMemorixPlatform,
|
|
88
|
+
createMemorixServiceApp,
|
|
89
|
+
startMemorixServiceHttp,
|
|
90
|
+
} from "@x12i/memorix-service";
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Scope headers
|
|
94
|
+
|
|
95
|
+
Every `/api/*` request requires:
|
|
96
|
+
|
|
97
|
+
```http
|
|
98
|
+
x-memorix-org-id: sandboxdemo
|
|
99
|
+
x-memorix-agent-ids: opx
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Singular `agentId` headers are rejected. `agentIds[]` selects **effective metadata**; `orgId` selects the **data** universe.
|
|
103
|
+
|
|
104
|
+
### Org identity is case-insensitive (MX-ORG-01)
|
|
105
|
+
|
|
106
|
+
Org ids are canonicalized with trim + `toLocaleLowerCase("en-US")`. Matching is
|
|
107
|
+
case-insensitive (`TGI` / `tgi` / `Tgi` are the same org). `scope.orgId`,
|
|
108
|
+
`addressing.orgId`, and storage keys always use that canonical form, so writers
|
|
109
|
+
and readers that differ only by case share one tenant bag. Empty / missing org
|
|
110
|
+
is still rejected (400).
|
|
111
|
+
|
|
112
|
+
### Deployment writer / reader (MX-AUTH-01)
|
|
113
|
+
|
|
114
|
+
Default: **off** (scope headers only). To separate Synapix lander (writer) from
|
|
115
|
+
map-store (read-only):
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
MEMORIX_DEPLOYMENT_AUTH=required # or optional
|
|
119
|
+
MEMORIX_DEPLOYMENT_HMAC_SECRET=… # optional; falls back to callback/service secret
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Mint tokens (same process secret):
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
import { issueDeploymentIdentity } from "@x12i/memorix-service";
|
|
126
|
+
const writer = issueDeploymentIdentity({ orgId: "tgi", role: "writer" });
|
|
127
|
+
const reader = issueDeploymentIdentity({ orgId: "tgi", role: "reader" });
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Send `x-memorix-deployment-identity: <token>` on every product call. Readers may
|
|
131
|
+
GET/list/compose; only writers may POST content / install metadata.
|
|
132
|
+
|
|
133
|
+
### Content miss status (MX-CONTENT-01)
|
|
134
|
+
|
|
135
|
+
`GET /api/data/content?…&id=` for a missing record returns **404** `READ_NOT_FOUND`
|
|
136
|
+
(not 500).
|
|
137
|
+
|
|
138
|
+
### Metadata hot-reload (MX-META-01)
|
|
139
|
+
|
|
140
|
+
After pack install the live catalog is flushed and OrgPorts cleared — no restart
|
|
141
|
+
required in-process. Ops may also call `POST /api/metadata/reload` with
|
|
142
|
+
`{ "confirm": true }` (e.g. after Magit apply on another worker).
|
|
143
|
+
|
|
144
|
+
### Minimal curl
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
curl -s http://127.0.0.1:5100/health
|
|
148
|
+
curl -s http://127.0.0.1:5100/api/diagnostics/scope \
|
|
149
|
+
-H 'x-memorix-org-id: sandboxdemo' \
|
|
150
|
+
-H 'x-memorix-agent-ids: opx'
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Route families
|
|
154
|
+
|
|
155
|
+
| Family | Role |
|
|
156
|
+
|--------|------|
|
|
157
|
+
| `/api/metadata` | Kinds, definitions, install/publish, pack versions (Magit default-on; `METADATA_MAGIT=0` disables) |
|
|
158
|
+
| `/api/data` | Content get/list/write, compose, abstract |
|
|
159
|
+
| `/api/relationships` | Query / discover / verify / rebuild (**no** ad-hoc link PUT) |
|
|
160
|
+
| `/api/memory` | Pull, raw, sources, **checkpoints**, schedules, runs, `commit-page`, connection probe |
|
|
161
|
+
| `/api/pipelines` | Definitions, start, runs, retry/resume |
|
|
162
|
+
| `/api/operations` | Operational helpers |
|
|
163
|
+
| `/api/workflow` | Workflow sibling content |
|
|
164
|
+
| `/api/intelligence` | Profiles / proposals (never auto-install) |
|
|
165
|
+
| `/api/data-journey` | Evidence cone + expected-vs-filled coverage |
|
|
166
|
+
| `/api/ai-services` | Companion AI-services (function / skill / task / graph) — list, items, invoke proxy |
|
|
167
|
+
|
|
168
|
+
### AI-services companions
|
|
169
|
+
|
|
170
|
+
Point memorix-service at FR-compliant processes via env (`FUNCX_URL`, `AI_SKILLS_URL`, `AI_TASKS_URL`, `GRAPH_ENGINE_URL`).
|
|
171
|
+
Stack: AI companions are **on by default**; skip with `--no-ai-services` or `AI_SERVICES=0`.
|
|
172
|
+
|
|
173
|
+
### Vendor pipeline workers (opt-in)
|
|
174
|
+
|
|
175
|
+
Archetype-A HTTP companions invoke via `POST {origin}/pipeline`. Inject **base origin only** (no `/pipeline` path). Soft-skip when URL unset; fail-closed when set (`src/optional-companion-url.ts`).
|
|
176
|
+
|
|
177
|
+
| Suite | Stack flag | Client env |
|
|
178
|
+
|-------|------------|------------|
|
|
179
|
+
| Exellix Apollo + M365 | `--exellix-connectors` / `EXELLIX_CONNECTORS=1` | `EXELLIX_APOLLO_READ_URL`, `EXELLIX_APOLLO_ACTIONS_URL`, `EXELLIX_M365_USER_READ_URL`, `EXELLIX_M365_USER_ACTION_URL` (ports 9711–9722, zone `exellix-connectors`) |
|
|
180
|
+
| Neo security workers | `--neo-connectors` / `NEO_CONNECTORS=1` | `NEO_FIREWALL_URL`, `NEO_XDR_URL`, `NEO_NESSUS_URL`, `NEO_ENTRA_URL`, `NEO_SPLUNK_URL`, `NEO_CROWDSTRIKE_URL` (zone **neo-proagentics** **10000–10100**) |
|
|
181
|
+
| Neo status UI | `--neo-status-ui` / `NEO_STATUS_UI=1` | `NEO_STATUS_UI_URL` (:10001) |
|
|
182
|
+
|
|
183
|
+
Optional hard gates: `EXELLIX_CONNECTORS_REQUIRED=1`, `NEO_CONNECTORS_REQUIRED=1`.
|
|
184
|
+
|
|
185
|
+
**Neo packages** ship on GitHub Packages. Local install needs `.npmrc` scope + `NODE_AUTH_TOKEN` (see [`.npmrc.example`](../.npmrc.example)).
|
|
186
|
+
|
|
187
|
+
### Memory (operator + called-service)
|
|
188
|
+
|
|
189
|
+
| Method | Path | Notes |
|
|
190
|
+
|--------|------|-------|
|
|
191
|
+
| `GET` | `/api/memory/sources/{sourceId}/connection` | Probe configured URL |
|
|
192
|
+
| `GET`/`PUT`/`POST` | `…/checkpoints` (+ `/reset`) | Source position per OT × route |
|
|
193
|
+
| `POST` | `…/commit-page` | Model B atomic land + checkpoint |
|
|
194
|
+
| `POST` | `/api/memory/pull` | **Operator-only** — rejected when `x-memorix-invocation-grant` is present |
|
|
195
|
+
|
|
196
|
+
Called services with `memorixAccess` receive an HMAC grant scoped to `explore` · `checkpoints` · `raw`. Prefer **`@x12i/memorix-sdk`** (`/client` / `/worker`) over raw fetch.
|
|
197
|
+
|
|
198
|
+
### Data journey (read-only)
|
|
199
|
+
|
|
200
|
+
| Method | Path |
|
|
201
|
+
|--------|------|
|
|
202
|
+
| `GET` | `/api/data-journey/object-types` |
|
|
203
|
+
| `GET` | `/api/data-journey/journeys` |
|
|
204
|
+
| `POST` | `/api/data-journey/matrix/query` |
|
|
205
|
+
| `POST` | `/api/data-journey/matrix/columns/query` |
|
|
206
|
+
| `POST` | `/api/data-journey/matrix/cells/query` |
|
|
207
|
+
| `GET` | `/api/data-journey/evidence/:evidenceRef` |
|
|
208
|
+
| `GET` | `/api/data-journey/expected-slots` |
|
|
209
|
+
| `POST` | `/api/data-journey/coverage` |
|
|
210
|
+
|
|
211
|
+
## Hard rules
|
|
212
|
+
|
|
213
|
+
- Prod rejects missing Mongo and in-memory durable fallbacks
|
|
214
|
+
- `/api/relationships/links` → **405** (no ad-hoc link mutation)
|
|
215
|
+
- Intelligence never auto-installs/publishes
|
|
216
|
+
- Only `credentialRef` may cross Memory APIs
|
|
217
|
+
|
|
218
|
+
## Docs
|
|
219
|
+
|
|
220
|
+
- [`documentation/http-api.md`](../documentation/http-api.md) · OpenAPI in-repo [`openapi/openapi.json`](./openapi/openapi.json)
|
|
221
|
+
- Capability SDK: [`@x12i/memorix-sdk`](../memorix-sdk/) · HTTP client: [`@x12i/memorix-client`](../memorix-client/)
|
|
222
|
+
- Ebooks: [Platform Overview](../memorix-docs/00-platform-overview/) · [Services](../memorix-docs/07-services/) · [Runtime Data Client](../memorix-docs/02-runtime-data-client/)
|
|
223
|
+
- Hub: [https://docs.memorix.x12i.com](https://docs.memorix.x12i.com) · npm `@x12i/memorix-docs`
|
package/dist/access-gate.d.ts
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Enforce callback grants on Explore / Memory / checkpoint routes.
|
|
3
3
|
* Product hosts without a grant keep full org-scoped access.
|
|
4
|
+
*
|
|
5
|
+
* MX-AUTH-01: optional deployment writer/reader identities (see
|
|
6
|
+
* `requireDeploymentAccess`) — default off for lab compatibility.
|
|
4
7
|
*/
|
|
5
8
|
import type { FastifyRequest } from "fastify";
|
|
6
9
|
import type { MemorixServiceAccess } from "@x12i/memorix-pipeline/v2";
|
|
7
10
|
import { type CallbackGrantPayload } from "./callback-grant.js";
|
|
11
|
+
import { type DeploymentAccessKind } from "./deployment-identity.js";
|
|
8
12
|
export declare function readInvocationGrant(req: FastifyRequest): CallbackGrantPayload | null;
|
|
13
|
+
/**
|
|
14
|
+
* MX-AUTH-01 — gate product APIs by deployment role when auth mode is on.
|
|
15
|
+
* - off (default): no check
|
|
16
|
+
* - optional: missing token allowed; present token must match org + role
|
|
17
|
+
* - required: valid writer/reader token required
|
|
18
|
+
*/
|
|
19
|
+
export declare function requireDeploymentAccess(req: FastifyRequest, access: DeploymentAccessKind): void;
|
|
9
20
|
export declare function requireCallbackAccess(req: FastifyRequest, surface: MemorixServiceAccess): void;
|
|
10
21
|
/**
|
|
11
22
|
* Fail-closed grant for MGC landing ports (raw-records, target-receipts, artifacts).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-gate.d.ts","sourceRoot":"","sources":["../src/access-gate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"access-gate.d.ts","sourceRoot":"","sources":["../src/access-gate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGtE,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAKL,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAIlC,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,cAAc,GAClB,oBAAoB,GAAG,IAAI,CAK7B;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,oBAAoB,GAC3B,IAAI,CAwCN;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,oBAAoB,GAC5B,IAAI,CA+BN;AAWD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAiCA;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,CAQ7D"}
|
package/dist/access-gate.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ServiceError } from "./errors.js";
|
|
2
2
|
import { decodeLandingGrantToken } from "./mgc-landing-stores.js";
|
|
3
3
|
import { grantHasAccess, verifyCallbackGrant, } from "./callback-grant.js";
|
|
4
|
+
import { identityAllows, readDeploymentTokenFromHeaders, resolveDeploymentAuthMode, verifyDeploymentIdentity, } from "./deployment-identity.js";
|
|
4
5
|
import { resolveScope } from "./request-scope.js";
|
|
5
6
|
import { orgIdsEqual, normalizeOrgId } from "./scope.js";
|
|
6
7
|
export function readInvocationGrant(req) {
|
|
@@ -10,7 +11,39 @@ export function readInvocationGrant(req) {
|
|
|
10
11
|
return null;
|
|
11
12
|
return verifyCallbackGrant(token);
|
|
12
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* MX-AUTH-01 — gate product APIs by deployment role when auth mode is on.
|
|
16
|
+
* - off (default): no check
|
|
17
|
+
* - optional: missing token allowed; present token must match org + role
|
|
18
|
+
* - required: valid writer/reader token required
|
|
19
|
+
*/
|
|
20
|
+
export function requireDeploymentAccess(req, access) {
|
|
21
|
+
const mode = resolveDeploymentAuthMode();
|
|
22
|
+
if (mode === "off")
|
|
23
|
+
return;
|
|
24
|
+
const token = readDeploymentTokenFromHeaders(req.headers);
|
|
25
|
+
if (!token) {
|
|
26
|
+
if (mode === "optional")
|
|
27
|
+
return;
|
|
28
|
+
throw new ServiceError("ACCESS_DENIED", "x-memorix-deployment-identity required (writer or reader)", 401);
|
|
29
|
+
}
|
|
30
|
+
const identity = verifyDeploymentIdentity(token);
|
|
31
|
+
if (!identity) {
|
|
32
|
+
throw new ServiceError("ACCESS_DENIED", "deployment identity invalid or expired", 401);
|
|
33
|
+
}
|
|
34
|
+
const scope = resolveScope(req);
|
|
35
|
+
if (!orgIdsEqual(identity.orgId, scope.orgId)) {
|
|
36
|
+
throw new ServiceError("ACCESS_DENIED", "deployment identity orgId mismatch", 403);
|
|
37
|
+
}
|
|
38
|
+
if (!identityAllows(identity, access)) {
|
|
39
|
+
throw new ServiceError("ACCESS_DENIED", `deployment role "${identity.role}" cannot ${access}`, 403);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
13
42
|
export function requireCallbackAccess(req, surface) {
|
|
43
|
+
// Explore surfaces are reads; raw/checkpoints stay grant-scoped separately.
|
|
44
|
+
if (surface === "explore") {
|
|
45
|
+
requireDeploymentAccess(req, "read");
|
|
46
|
+
}
|
|
14
47
|
const grant = readInvocationGrant(req);
|
|
15
48
|
if (!grant)
|
|
16
49
|
return; // product host — no grant restriction
|
package/dist/access-gate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-gate.js","sourceRoot":"","sources":["../src/access-gate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"access-gate.js","sourceRoot":"","sources":["../src/access-gate.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EACL,cAAc,EACd,mBAAmB,GAEpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,cAAc,EAC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WAAW,CAAC,GAAG,EAAE,mBAAmB,CAAC;QACrC,WAAW,CAAC,GAAG,EAAE,kBAAkB,CAAC;QACpC,WAAW,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAC/B,IAAI,SAAS,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,YAAY,CACpB,eAAe,EACf,iCAAiC,EACjC,GAAG,CACJ,CAAC;IACJ,CAAC;IACD,OAAO;QACL,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC;QAClC,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;KACpE,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAmB;IACrD,MAAM,KAAK,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,MAAM,IAAI,YAAY,CACpB,eAAe,EACf,uGAAuG,EACvG,GAAG,CACJ,CAAC;AACJ,CAAC"}
|
package/dist/app.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import Fastify, { type FastifyInstance } from "fastify";
|
|
|
2
2
|
import { type MemorixPlatform, type PlatformDeps } from "./platform.js";
|
|
3
3
|
export type CreateMemorixServiceAppOptions = PlatformDeps & {
|
|
4
4
|
logger?: boolean;
|
|
5
|
+
/** When true (CLI serve), skip per-request access log lines; use /_live counters. */
|
|
6
|
+
disableRequestLogging?: boolean;
|
|
5
7
|
platform?: MemorixPlatform;
|
|
6
8
|
};
|
|
7
9
|
export declare function createMemorixServiceApp(opts: CreateMemorixServiceAppOptions): Promise<{
|
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAIA,OAAO,OAAO,EAAE,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAIxD,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAIA,OAAO,OAAO,EAAE,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAIxD,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AAmCvB,MAAM,MAAM,8BAA8B,GAAG,YAAY,GAAG;IAC1D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qFAAqF;IACrF,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B,CAAC;AAEF,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,8BAA8B,GACnC,OAAO,CAAC;IAAE,GAAG,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAwH5E;AAED,MAAM,MAAM,0BAA0B,GAAG,8BAA8B,GAAG;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,0BAA0B;;;;;GAM7E"}
|
package/dist/app.js
CHANGED
|
@@ -32,12 +32,26 @@ import { registerAiServicesRoutes } from "./routes/ai-services.js";
|
|
|
32
32
|
import { createSimulationController } from "./simulation.js";
|
|
33
33
|
import { memorixLiveRing } from "./live.js";
|
|
34
34
|
import { resolveConfiguredAiServiceOrigins } from "./ai-services/config.js";
|
|
35
|
+
import { enforceCallerOnRequest } from "./caller-identity.js";
|
|
36
|
+
import { attachRequestCountex, createRequestCountex, registerRequestStatsRoute, } from "./request-countex.js";
|
|
35
37
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
36
38
|
export async function createMemorixServiceApp(opts) {
|
|
37
39
|
const platform = opts.platform ?? (await createMemorixPlatform(opts));
|
|
38
40
|
const simulation = createSimulationController();
|
|
39
|
-
const app = Fastify({
|
|
41
|
+
const app = Fastify({
|
|
42
|
+
logger: opts.logger ?? false,
|
|
43
|
+
// Prefer /_live Counters over per-request Pino spam.
|
|
44
|
+
disableRequestLogging: opts.disableRequestLogging ?? true,
|
|
45
|
+
});
|
|
40
46
|
await app.register(cors, { origin: true });
|
|
47
|
+
// MX-CALLER-01: every /api/* request must identify the calling app.
|
|
48
|
+
app.addHook("onRequest", async (req) => {
|
|
49
|
+
enforceCallerOnRequest(req);
|
|
50
|
+
});
|
|
51
|
+
const requestCountex = await createRequestCountex({
|
|
52
|
+
mongoUri: opts.mongoUri ?? process.env.MONGO_URI?.trim(),
|
|
53
|
+
});
|
|
54
|
+
attachRequestCountex(app, requestCountex);
|
|
41
55
|
const healthPayload = async () => {
|
|
42
56
|
const sim = simulation.getState();
|
|
43
57
|
return {
|
|
@@ -70,6 +84,7 @@ export async function createMemorixServiceApp(opts) {
|
|
|
70
84
|
},
|
|
71
85
|
getHealth: healthPayload,
|
|
72
86
|
});
|
|
87
|
+
registerRequestStatsRoute(app, requestCountex);
|
|
73
88
|
app.setErrorHandler((err, req, reply) => {
|
|
74
89
|
const correlationId = req.correlationId ?? randomUUID();
|
|
75
90
|
const mapped = mapErrorToHttp(err, correlationId);
|
package/dist/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,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E,IAAI,EAAE,QAAQ,EAAE,GAAG,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC9E,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,QAAQ,CAAC;IACnC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,WAAW,CAAC;IACtC,MAAM,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IACjC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MX-CALLER-01 — mandatory product caller identity.
|
|
3
|
+
*
|
|
4
|
+
* Every `/api/*` request must send `x-memorix-caller` identifying the app
|
|
5
|
+
* that is pushing or fetching (e.g. synapix-lander, map-store, memorix-studio).
|
|
6
|
+
* Scope headers (org/agents) are separate; this names the HTTP client.
|
|
7
|
+
*/
|
|
8
|
+
import type { FastifyRequest } from "fastify";
|
|
9
|
+
export declare const CALLER_HEADER = "x-memorix-caller";
|
|
10
|
+
/** Max length after trim. */
|
|
11
|
+
export declare const CALLER_MAX_LEN = 128;
|
|
12
|
+
/**
|
|
13
|
+
* Starts with alphanumeric or `@` (scoped package ids); then alnum, `.` `_` `@` `/` `-`.
|
|
14
|
+
* Examples: synapix-lander, map-store, memorix-studio, @x12i/memorix-client
|
|
15
|
+
*/
|
|
16
|
+
export declare const CALLER_PATTERN: RegExp;
|
|
17
|
+
export declare function readCallerFromHeaders(headers: Record<string, string | string[] | undefined>): string | undefined;
|
|
18
|
+
export declare function normalizeCaller(raw: string): string;
|
|
19
|
+
export declare function validateCallerValue(raw: string | undefined): {
|
|
20
|
+
ok: true;
|
|
21
|
+
caller: string;
|
|
22
|
+
} | {
|
|
23
|
+
ok: false;
|
|
24
|
+
code: "CALLER_REQUIRED" | "CALLER_INVALID";
|
|
25
|
+
message: string;
|
|
26
|
+
};
|
|
27
|
+
/** True when the path is a product API that requires caller identity. */
|
|
28
|
+
export declare function pathRequiresCaller(urlPath: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Read + validate caller from the request. Throws ServiceError on failure.
|
|
31
|
+
* Returns the canonical caller string when valid.
|
|
32
|
+
*/
|
|
33
|
+
export declare function requireCaller(req: FastifyRequest): string;
|
|
34
|
+
/** Fastify onRequest: enforce caller on /api/* only. */
|
|
35
|
+
export declare function enforceCallerOnRequest(req: FastifyRequest): void;
|
|
36
|
+
export declare function getRequestCaller(req: FastifyRequest): string | undefined;
|
|
37
|
+
//# sourceMappingURL=caller-identity.d.ts.map
|