@x12i/memorix-service 3.0.0 → 3.0.2
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 +71 -22
- package/dist/app.d.ts +1 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +24 -14
- package/dist/app.js.map +1 -1
- package/dist/journey/collect.d.ts +53 -0
- package/dist/journey/collect.d.ts.map +1 -0
- package/dist/journey/collect.js +220 -0
- package/dist/journey/collect.js.map +1 -0
- package/dist/journey/coverage.d.ts +46 -0
- package/dist/journey/coverage.d.ts.map +1 -0
- package/dist/journey/coverage.js +103 -0
- package/dist/journey/coverage.js.map +1 -0
- package/dist/live.d.ts +18 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +9 -0
- package/dist/live.js.map +1 -0
- package/dist/openapi/openapi.json +405 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +7 -2
- package/dist/platform.js.map +1 -1
- package/dist/routes/data-journey.d.ts +4 -0
- package/dist/routes/data-journey.d.ts.map +1 -0
- package/dist/routes/data-journey.js +199 -0
- package/dist/routes/data-journey.js.map +1 -0
- package/openapi/openapi.json +405 -1
- package/package.json +14 -11
package/README.md
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@x12i/memorix-service`
|
|
2
2
|
|
|
3
3
|
Sole production **HTTP composition root** over accepted Memorix packages.
|
|
4
4
|
|
|
5
|
-
|
|
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
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- `x-memorix-org-id` — organization data universe
|
|
10
|
-
- `x-memorix-agent-ids` — comma-separated agent ids (effective metadata)
|
|
11
|
-
|
|
12
|
-
Singular `agentId` headers are rejected.
|
|
7
|
+
## Install / run
|
|
13
8
|
|
|
14
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install @x12i/memorix-service@3.0.0 # composition library / CLI
|
|
11
|
+
```
|
|
15
12
|
|
|
16
13
|
Prefer the monorepo stack (service + Studio + ops-source):
|
|
17
14
|
|
|
18
15
|
```bash
|
|
16
|
+
# from repo root
|
|
19
17
|
node scripts/dev-stack.mjs
|
|
20
18
|
```
|
|
21
19
|
|
|
@@ -26,28 +24,79 @@ MEMORIX_SERVICE_MODE=prod MONGO_URI=mongodb://127.0.0.1:27017 npm run serve
|
|
|
26
24
|
MEMORIX_SERVICE_MODE=dev npm run dev # metadata in-memory; durable routes 503 without Mongo
|
|
27
25
|
```
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
| | |
|
|
28
|
+
|--|--|
|
|
29
|
+
| Default port | **5100** (`MEMORIX_SERVICE_PORT`) |
|
|
30
|
+
| OpenAPI | `GET /api/openapi.json` |
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## Library exports
|
|
33
|
+
|
|
34
|
+
When embedding the composition root in-process:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import {
|
|
38
|
+
createMemorixPlatform,
|
|
39
|
+
createMemorixServiceApp,
|
|
40
|
+
startMemorixServiceHttp,
|
|
41
|
+
} from "@x12i/memorix-service";
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Scope headers
|
|
33
45
|
|
|
34
|
-
|
|
46
|
+
Every `/api/*` request requires:
|
|
47
|
+
|
|
48
|
+
```http
|
|
49
|
+
x-memorix-org-id: g12ops-demo
|
|
50
|
+
x-memorix-agent-ids: ops
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Singular `agentId` headers are rejected. `agentIds[]` selects **effective metadata**; `orgId` selects the **data** universe.
|
|
54
|
+
|
|
55
|
+
### Minimal curl
|
|
35
56
|
|
|
36
|
-
|
|
57
|
+
```bash
|
|
58
|
+
curl -s http://127.0.0.1:5100/health
|
|
59
|
+
curl -s http://127.0.0.1:5100/api/diagnostics/scope \
|
|
60
|
+
-H 'x-memorix-org-id: g12ops-demo' \
|
|
61
|
+
-H 'x-memorix-agent-ids: ops'
|
|
62
|
+
```
|
|
37
63
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
64
|
+
## Route families
|
|
65
|
+
|
|
66
|
+
| Family | Role |
|
|
67
|
+
|--------|------|
|
|
68
|
+
| `/api/metadata` | Kinds, definitions, install/publish |
|
|
69
|
+
| `/api/data` | Content get/list/write, compose, abstract |
|
|
70
|
+
| `/api/relationships` | Query / discover / verify / rebuild (**no** ad-hoc link PUT) |
|
|
71
|
+
| `/api/memory` | Pull, raw, sources, runs |
|
|
72
|
+
| `/api/pipelines` | Definitions, start, runs, retry/resume |
|
|
73
|
+
| `/api/operations` | Operational helpers |
|
|
74
|
+
| `/api/workflow` | Workflow sibling content |
|
|
75
|
+
| `/api/intelligence` | Profiles / proposals (never auto-install) |
|
|
76
|
+
| `/api/data-journey` | Evidence cone + expected-vs-filled coverage |
|
|
77
|
+
|
|
78
|
+
### Data journey (read-only)
|
|
79
|
+
|
|
80
|
+
| Method | Path |
|
|
81
|
+
|--------|------|
|
|
82
|
+
| `GET` | `/api/data-journey/object-types` |
|
|
83
|
+
| `GET` | `/api/data-journey/journeys` |
|
|
84
|
+
| `POST` | `/api/data-journey/matrix/query` |
|
|
85
|
+
| `POST` | `/api/data-journey/matrix/columns/query` |
|
|
86
|
+
| `POST` | `/api/data-journey/matrix/cells/query` |
|
|
87
|
+
| `GET` | `/api/data-journey/evidence/:evidenceRef` |
|
|
88
|
+
| `GET` | `/api/data-journey/expected-slots` |
|
|
89
|
+
| `POST` | `/api/data-journey/coverage` |
|
|
41
90
|
|
|
42
91
|
## Hard rules
|
|
43
92
|
|
|
44
93
|
- Prod rejects missing Mongo and in-memory durable fallbacks
|
|
45
|
-
-
|
|
94
|
+
- `/api/relationships/links` → **405** (no ad-hoc link mutation)
|
|
46
95
|
- Intelligence never auto-installs/publishes
|
|
47
96
|
- Only `credentialRef` may cross Memory APIs
|
|
48
97
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
---
|
|
98
|
+
## Docs
|
|
52
99
|
|
|
53
|
-
|
|
100
|
+
- [`documentation/http-api.md`](../documentation/http-api.md) · OpenAPI in-repo [`openapi/openapi.json`](./openapi/openapi.json)
|
|
101
|
+
- Ebooks: [Platform Overview](../new-ebooks/00-platform-overview/) · [Services](../new-ebooks/07-services/) · [Runtime Data Client](../new-ebooks/02-runtime-data-client/)
|
|
102
|
+
- Hub: [https://ebooks.memorix.x12i.com](https://ebooks.memorix.x12i.com)
|
package/dist/app.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type CreateMemorixServiceAppOptions = PlatformDeps & {
|
|
|
7
7
|
export declare function createMemorixServiceApp(opts: CreateMemorixServiceAppOptions): Promise<{
|
|
8
8
|
app: FastifyInstance;
|
|
9
9
|
platform: MemorixPlatform;
|
|
10
|
+
port: number;
|
|
10
11
|
}>;
|
|
11
12
|
export type StartMemorixServiceOptions = CreateMemorixServiceAppOptions & {
|
|
12
13
|
port?: number;
|
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;
|
|
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;AAevB,MAAM,MAAM,8BAA8B,GAAG,YAAY,GAAG;IAC1D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,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,CAsD5E;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
|
@@ -4,6 +4,7 @@ import { dirname, resolve } from "node:path";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import Fastify from "fastify";
|
|
6
6
|
import cors from "@fastify/cors";
|
|
7
|
+
import { attachCoreFastify } from "@x12i/core-service/fastify";
|
|
7
8
|
import { mapErrorToHttp, redactSecrets } from "./errors.js";
|
|
8
9
|
import { createMemorixPlatform, } from "./platform.js";
|
|
9
10
|
import { resolveScope } from "./request-scope.js";
|
|
@@ -15,17 +16,30 @@ import { registerPipelineRoutes } from "./routes/pipelines.js";
|
|
|
15
16
|
import { registerOperationsRoutes } from "./routes/operations.js";
|
|
16
17
|
import { registerWorkflowRoutes } from "./routes/workflow.js";
|
|
17
18
|
import { registerIntelligenceRoutes } from "./routes/intelligence.js";
|
|
19
|
+
import { registerDataJourneyRoutes } from "./routes/data-journey.js";
|
|
20
|
+
import { memorixLiveRing } from "./live.js";
|
|
18
21
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
19
22
|
export async function createMemorixServiceApp(opts) {
|
|
20
23
|
const platform = opts.platform ?? (await createMemorixPlatform(opts));
|
|
21
24
|
const app = Fastify({ logger: opts.logger ?? false });
|
|
22
25
|
await app.register(cors, { origin: true });
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const core = await attachCoreFastify(app, {
|
|
27
|
+
ring: memorixLiveRing,
|
|
28
|
+
identity: {
|
|
29
|
+
id: "@x12i/memorix-service",
|
|
30
|
+
title: "Memorix Service",
|
|
31
|
+
kind: "api",
|
|
32
|
+
zoneId: "memorix",
|
|
33
|
+
portKey: "service",
|
|
34
|
+
portEnv: "MEMORIX_SERVICE_PORT",
|
|
35
|
+
docsPath: "/api/openapi.json",
|
|
36
|
+
description: "Sole HTTP composition root",
|
|
37
|
+
},
|
|
38
|
+
getHealth: async () => ({
|
|
39
|
+
ok: true,
|
|
40
|
+
service: "@x12i/memorix-service",
|
|
41
|
+
mode: platform.mode,
|
|
42
|
+
}),
|
|
29
43
|
});
|
|
30
44
|
app.setErrorHandler((err, req, reply) => {
|
|
31
45
|
const correlationId = req.correlationId ?? randomUUID();
|
|
@@ -33,11 +47,6 @@ export async function createMemorixServiceApp(opts) {
|
|
|
33
47
|
mapped.body.error = redactSecrets(mapped.body.error);
|
|
34
48
|
return reply.code(mapped.status).send(mapped.body);
|
|
35
49
|
});
|
|
36
|
-
app.get("/health", async () => ({
|
|
37
|
-
ok: true,
|
|
38
|
-
service: "@x12i/memorix-service",
|
|
39
|
-
mode: platform.mode,
|
|
40
|
-
}));
|
|
41
50
|
app.get("/api/openapi.json", async (_req, reply) => {
|
|
42
51
|
const path = resolve(__dirname, "../openapi/openapi.json");
|
|
43
52
|
const body = readFileSync(path, "utf8");
|
|
@@ -55,11 +64,12 @@ export async function createMemorixServiceApp(opts) {
|
|
|
55
64
|
await registerOperationsRoutes(app, platform);
|
|
56
65
|
await registerWorkflowRoutes(app, platform);
|
|
57
66
|
await registerIntelligenceRoutes(app, platform);
|
|
58
|
-
|
|
67
|
+
await registerDataJourneyRoutes(app, platform);
|
|
68
|
+
return { app, platform, port: core.port };
|
|
59
69
|
}
|
|
60
70
|
export async function startMemorixServiceHttp(opts) {
|
|
61
|
-
const { app, platform } = await createMemorixServiceApp(opts);
|
|
62
|
-
const port = opts.port ??
|
|
71
|
+
const { app, platform, port: corePort } = await createMemorixServiceApp(opts);
|
|
72
|
+
const port = opts.port ?? corePort;
|
|
63
73
|
const host = opts.host ?? "127.0.0.1";
|
|
64
74
|
await app.listen({ port, host });
|
|
65
75
|
return { app, platform, port, host };
|
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,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,OAAiC,MAAM,SAAS,CAAC;AACxD,OAAO,IAAI,MAAM,eAAe,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EACL,qBAAqB,GAGtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;
|
|
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,MAA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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,53 @@
|
|
|
1
|
+
import { type JourneyBasis, type JourneyObservation, type MatrixGranularity, type MatrixResponse, type PartialTruthReason } from "@x12i/memorix-data-journey";
|
|
2
|
+
import type { MemorixPlatform } from "../platform.js";
|
|
3
|
+
import type { MemorixScope } from "../scope.js";
|
|
4
|
+
/**
|
|
5
|
+
* Collect journey observations for run and/or record basis.
|
|
6
|
+
* Prefers live ports; optional fixtureName loads golden observations (Studio demos / tests).
|
|
7
|
+
*/
|
|
8
|
+
export declare function collectJourneyObservations(platform: MemorixPlatform, scope: MemorixScope, input: {
|
|
9
|
+
objectType: string;
|
|
10
|
+
runId?: string;
|
|
11
|
+
recordId?: string;
|
|
12
|
+
fixtureName?: string;
|
|
13
|
+
includeCompose?: boolean;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
observations: JourneyObservation[];
|
|
16
|
+
partialReasons: PartialTruthReason[];
|
|
17
|
+
basis: JourneyBasis;
|
|
18
|
+
}>;
|
|
19
|
+
export declare function queryJourneyMatrix(platform: MemorixPlatform, scope: MemorixScope, body: {
|
|
20
|
+
objectType?: string;
|
|
21
|
+
basis?: {
|
|
22
|
+
kind?: string;
|
|
23
|
+
runId?: string;
|
|
24
|
+
recordId?: string;
|
|
25
|
+
fixtureName?: string;
|
|
26
|
+
};
|
|
27
|
+
granularity?: MatrixGranularity;
|
|
28
|
+
includeValues?: boolean;
|
|
29
|
+
includeSystem?: boolean;
|
|
30
|
+
includeRawProperties?: boolean;
|
|
31
|
+
expandPath?: string;
|
|
32
|
+
includeCompose?: boolean;
|
|
33
|
+
}): Promise<MatrixResponse & {
|
|
34
|
+
observations?: JourneyObservation[];
|
|
35
|
+
}>;
|
|
36
|
+
export declare function resolveJourneyEvidence(observations: JourneyObservation[], evidenceRef: string, includeValues: boolean): {
|
|
37
|
+
origin: import("@x12i/memorix-data-journey").CellOrigin;
|
|
38
|
+
path: string;
|
|
39
|
+
valueKind?: import("@x12i/memorix-data-journey").CellValueKind;
|
|
40
|
+
visibility: import("@x12i/memorix-data-journey").CellVisibility;
|
|
41
|
+
contentType?: string;
|
|
42
|
+
recordId?: string;
|
|
43
|
+
revision?: number;
|
|
44
|
+
dataCategory?: string;
|
|
45
|
+
service?: string;
|
|
46
|
+
phase?: string;
|
|
47
|
+
runId?: string;
|
|
48
|
+
attemptId?: string;
|
|
49
|
+
artifactRef?: string;
|
|
50
|
+
mutationRef?: string;
|
|
51
|
+
persistedAtThisCheckpoint?: boolean;
|
|
52
|
+
} | null;
|
|
53
|
+
//# sourceMappingURL=collect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../src/journey/collect.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA0ChD;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE;IACL,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GACA,OAAO,CAAC;IACT,YAAY,EAAE,kBAAkB,EAAE,CAAC;IACnC,cAAc,EAAE,kBAAkB,EAAE,CAAC;IACrC,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC,CAyLD;AAED,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE;IACJ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GACA,OAAO,CAAC,cAAc,GAAG;IAAE,YAAY,CAAC,EAAE,kBAAkB,EAAE,CAAA;CAAE,CAAC,CA6BnE;AAED,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,kBAAkB,EAAE,EAClC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,OAAO;;;;;;;;;;;;;;;;SASvB"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { attemptToObservations, composeToObservations, linkToDatabaseObservation, loadFixtureObservations, projectMatrix, queryEvidence, recordToDatabaseObservation, } from "@x12i/memorix-data-journey";
|
|
2
|
+
import { ServiceError } from "../errors.js";
|
|
3
|
+
function isDataRef(v) {
|
|
4
|
+
return (typeof v === "object" &&
|
|
5
|
+
v !== null &&
|
|
6
|
+
"artifactId" in v &&
|
|
7
|
+
typeof v.artifactId === "string");
|
|
8
|
+
}
|
|
9
|
+
async function resolveAttemptOutput(platform, scope, output) {
|
|
10
|
+
if (output === undefined)
|
|
11
|
+
return {};
|
|
12
|
+
if (!isDataRef(output))
|
|
13
|
+
return { resolved: output };
|
|
14
|
+
const artifactId = String(output.artifactId);
|
|
15
|
+
try {
|
|
16
|
+
const ledger = platform.pipelineLedgerFor(scope.orgId);
|
|
17
|
+
const art = await ledger.artifacts?.get(scope.orgId, artifactId);
|
|
18
|
+
if (art?.data !== undefined)
|
|
19
|
+
return { resolved: art.data };
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
/* fall through */
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
partial: {
|
|
26
|
+
code: "missing-artifact",
|
|
27
|
+
message: `DataRef artifact ${artifactId} could not be resolved`,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Collect journey observations for run and/or record basis.
|
|
33
|
+
* Prefers live ports; optional fixtureName loads golden observations (Studio demos / tests).
|
|
34
|
+
*/
|
|
35
|
+
export async function collectJourneyObservations(platform, scope, input) {
|
|
36
|
+
if (input.fixtureName) {
|
|
37
|
+
const observations = loadFixtureObservations(input.fixtureName).filter((o) => o.objectType === input.objectType);
|
|
38
|
+
return {
|
|
39
|
+
observations,
|
|
40
|
+
partialReasons: [],
|
|
41
|
+
basis: {
|
|
42
|
+
kind: input.runId ? "run" : "record",
|
|
43
|
+
runId: input.runId ?? "run-proc-2",
|
|
44
|
+
recordId: input.recordId ?? "PROC-2",
|
|
45
|
+
resolvedAt: new Date().toISOString(),
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const ports = platform.portsFor(scope);
|
|
50
|
+
const observations = [];
|
|
51
|
+
const partialReasons = [];
|
|
52
|
+
let seq = 10;
|
|
53
|
+
const now = new Date().toISOString();
|
|
54
|
+
let runId = input.runId;
|
|
55
|
+
if (!runId && input.recordId) {
|
|
56
|
+
// latest-run: pick most recent run that mentions this org
|
|
57
|
+
const runs = await ports.pipeline.listRuns({ limit: 50 });
|
|
58
|
+
runId = runs[0]?.runId;
|
|
59
|
+
}
|
|
60
|
+
if (runId) {
|
|
61
|
+
const attempts = await ports.pipeline.getStepAttempts(runId);
|
|
62
|
+
attempts.sort((a, b) => String(a.startedAt).localeCompare(String(b.startedAt)) ||
|
|
63
|
+
a.attemptNumber - b.attemptNumber);
|
|
64
|
+
for (const attempt of attempts) {
|
|
65
|
+
const { resolved, partial } = await resolveAttemptOutput(platform, scope, attempt.output);
|
|
66
|
+
if (partial)
|
|
67
|
+
partialReasons.push(partial);
|
|
68
|
+
const role = attempt.stepKind === "relationship-discover"
|
|
69
|
+
? "relationship-candidate"
|
|
70
|
+
: attempt.stepKind === "compose"
|
|
71
|
+
? "composition"
|
|
72
|
+
: attempt.stepKind === "map-normalize"
|
|
73
|
+
? "mapped"
|
|
74
|
+
: attempt.stepKind;
|
|
75
|
+
const { observations: obs, partialReasons: pr } = attemptToObservations({
|
|
76
|
+
attemptId: attempt.attemptId,
|
|
77
|
+
runId: attempt.runId,
|
|
78
|
+
stepId: attempt.stepId,
|
|
79
|
+
stepKind: attempt.stepKind,
|
|
80
|
+
attemptNumber: attempt.attemptNumber,
|
|
81
|
+
status: attempt.status,
|
|
82
|
+
output: attempt.output,
|
|
83
|
+
mutationRefs: attempt.mutationRefs,
|
|
84
|
+
startedAt: attempt.startedAt,
|
|
85
|
+
finishedAt: attempt.finishedAt,
|
|
86
|
+
error: attempt.error,
|
|
87
|
+
}, {
|
|
88
|
+
objectType: input.objectType,
|
|
89
|
+
recordId: input.recordId,
|
|
90
|
+
sequence: seq,
|
|
91
|
+
resolvedOutput: resolved,
|
|
92
|
+
outputRole: role,
|
|
93
|
+
targetContentType: attempt.stepKind === "write-record" ? "snapshots" : undefined,
|
|
94
|
+
relationshipGroup: "link",
|
|
95
|
+
});
|
|
96
|
+
observations.push(...obs);
|
|
97
|
+
partialReasons.push(...pr);
|
|
98
|
+
seq += 10;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (input.recordId) {
|
|
102
|
+
const composed = await ports.reader.composeSubject(scope, {
|
|
103
|
+
recordId: input.recordId,
|
|
104
|
+
objectType: input.objectType,
|
|
105
|
+
});
|
|
106
|
+
const contents = composed
|
|
107
|
+
.contents;
|
|
108
|
+
if (contents) {
|
|
109
|
+
for (const [ct, records] of Object.entries(contents)) {
|
|
110
|
+
const list = Array.isArray(records) ? records : [records];
|
|
111
|
+
for (const rec of list) {
|
|
112
|
+
if (!rec || typeof rec !== "object")
|
|
113
|
+
continue;
|
|
114
|
+
observations.push(recordToDatabaseObservation(rec, {
|
|
115
|
+
observationId: `db-${input.recordId}-${ct}-${seq}`,
|
|
116
|
+
sequence: seq,
|
|
117
|
+
occurredAt: now,
|
|
118
|
+
phase: ct === "raw" ? "memory-raw" : `${ct}-stored`,
|
|
119
|
+
runId,
|
|
120
|
+
includeValues: false,
|
|
121
|
+
}));
|
|
122
|
+
seq += 1;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (input.includeCompose !== false) {
|
|
127
|
+
observations.push(...composeToObservations({
|
|
128
|
+
recordId: input.recordId,
|
|
129
|
+
objectType: input.objectType,
|
|
130
|
+
contents: contents,
|
|
131
|
+
}, {
|
|
132
|
+
sequence: seq,
|
|
133
|
+
occurredAt: now,
|
|
134
|
+
objectType: input.objectType,
|
|
135
|
+
runId,
|
|
136
|
+
}));
|
|
137
|
+
seq += 10;
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
const rels = await ports.reader.getRelationships(scope, input.recordId, {
|
|
141
|
+
include: true,
|
|
142
|
+
});
|
|
143
|
+
for (const item of rels.items ?? []) {
|
|
144
|
+
const link = item;
|
|
145
|
+
if (!link.relationshipId)
|
|
146
|
+
continue;
|
|
147
|
+
observations.push(linkToDatabaseObservation({
|
|
148
|
+
relationshipId: link.relationshipId,
|
|
149
|
+
relationshipDefinitionId: link.relationshipDefinitionId ??
|
|
150
|
+
link.definitionId ??
|
|
151
|
+
"unknown",
|
|
152
|
+
fromRecordId: link.fromRecordId ?? input.recordId,
|
|
153
|
+
toRecordId: link.toRecordId ?? "",
|
|
154
|
+
}, {
|
|
155
|
+
observationId: `rel-${link.relationshipId}`,
|
|
156
|
+
objectType: input.objectType,
|
|
157
|
+
recordId: input.recordId,
|
|
158
|
+
sequence: seq++,
|
|
159
|
+
occurredAt: now,
|
|
160
|
+
group: "link",
|
|
161
|
+
runId,
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
/* relationships optional */
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const basis = {
|
|
170
|
+
kind: runId ? (input.runId ? "run" : "latest-run") : "record",
|
|
171
|
+
runId,
|
|
172
|
+
recordId: input.recordId,
|
|
173
|
+
resolvedAt: now,
|
|
174
|
+
};
|
|
175
|
+
if (observations.length === 0) {
|
|
176
|
+
partialReasons.push({
|
|
177
|
+
code: "partial-run",
|
|
178
|
+
message: "no journey observations collected for the requested basis",
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
return { observations, partialReasons, basis };
|
|
182
|
+
}
|
|
183
|
+
export async function queryJourneyMatrix(platform, scope, body) {
|
|
184
|
+
if (!body.objectType) {
|
|
185
|
+
throw new ServiceError("VALIDATION", "objectType required", 400);
|
|
186
|
+
}
|
|
187
|
+
const collected = await collectJourneyObservations(platform, scope, {
|
|
188
|
+
objectType: body.objectType,
|
|
189
|
+
runId: body.basis?.runId,
|
|
190
|
+
recordId: body.basis?.recordId,
|
|
191
|
+
fixtureName: body.basis?.fixtureName,
|
|
192
|
+
includeCompose: body.includeCompose,
|
|
193
|
+
});
|
|
194
|
+
const matrix = projectMatrix(collected.observations, {
|
|
195
|
+
objectType: body.objectType,
|
|
196
|
+
basis: {
|
|
197
|
+
...collected.basis,
|
|
198
|
+
kind: body.basis?.kind ?? collected.basis.kind,
|
|
199
|
+
},
|
|
200
|
+
granularity: body.granularity ?? "root",
|
|
201
|
+
includeValues: body.includeValues ?? false,
|
|
202
|
+
includeSystem: body.includeSystem ?? false,
|
|
203
|
+
includeRawProperties: body.includeRawProperties ?? false,
|
|
204
|
+
expandPath: body.expandPath,
|
|
205
|
+
scope: { orgId: scope.orgId, agentIds: scope.agentIds },
|
|
206
|
+
partialReasons: collected.partialReasons,
|
|
207
|
+
});
|
|
208
|
+
return matrix;
|
|
209
|
+
}
|
|
210
|
+
export function resolveJourneyEvidence(observations, evidenceRef, includeValues) {
|
|
211
|
+
const detail = queryEvidence(observations, evidenceRef);
|
|
212
|
+
if (!detail)
|
|
213
|
+
return null;
|
|
214
|
+
if (!includeValues) {
|
|
215
|
+
const { value: _v, ...rest } = detail;
|
|
216
|
+
return rest;
|
|
217
|
+
}
|
|
218
|
+
return detail;
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=collect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect.js","sourceRoot":"","sources":["../../src/journey/collect.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,2BAA2B,GAM5B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,SAAS,SAAS,CAAC,CAAU;IAC3B,OAAO,CACL,OAAO,CAAC,KAAK,QAAQ;QACrB,CAAC,KAAK,IAAI;QACV,YAAY,IAAI,CAAC;QACjB,OAAQ,CAA8B,CAAC,UAAU,KAAK,QAAQ,CAC/D,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,oBAAoB,CACjC,QAAyB,EACzB,KAAmB,EACnB,MAAe;IAEf,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACpC,IAAI,CAAC,SAA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AAa,IAAI,KAAK;QAC1C,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,IAAI,KAAK;QACxD,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE;QACvD,cAAc,EAAE,SAAS,CAAC,cAAc;KACzC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,YAAkC,EAClC,WAAmB,EACnB,aAAsB;IAEtB,MAAM,MAAM,GAAG,aAAa,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IACxD,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type JourneyBasis, type ViewDefinitionLike } from "@x12i/memorix-data-journey";
|
|
2
|
+
import type { MemorixPlatform } from "../platform.js";
|
|
3
|
+
import type { MemorixScope } from "../scope.js";
|
|
4
|
+
/** Views from effective metadata (Catalox-backed install). */
|
|
5
|
+
export declare function viewsFromEffectiveMetadata(platform: MemorixPlatform, scope: MemorixScope): ViewDefinitionLike[];
|
|
6
|
+
export declare function queryJourneyCoverage(platform: MemorixPlatform, scope: MemorixScope, body: {
|
|
7
|
+
objectType?: string;
|
|
8
|
+
basis?: {
|
|
9
|
+
kind?: string;
|
|
10
|
+
runId?: string;
|
|
11
|
+
recordId?: string;
|
|
12
|
+
fixtureName?: string;
|
|
13
|
+
};
|
|
14
|
+
viewIds?: string[];
|
|
15
|
+
/** Inline descriptor snapshot (tests / fixture override). */
|
|
16
|
+
views?: ViewDefinitionLike[];
|
|
17
|
+
includeRawProperties?: boolean;
|
|
18
|
+
includeMatrix?: boolean;
|
|
19
|
+
granularity?: "root" | "content" | "property";
|
|
20
|
+
}): Promise<{
|
|
21
|
+
matrix?: import("@x12i/memorix-data-journey").MatrixResponse | undefined;
|
|
22
|
+
scope: {
|
|
23
|
+
orgId: string;
|
|
24
|
+
agentIds: string[];
|
|
25
|
+
};
|
|
26
|
+
objectType: string;
|
|
27
|
+
basis: JourneyBasis;
|
|
28
|
+
truth: import("@x12i/memorix-data-journey").MatrixTruth;
|
|
29
|
+
expectedSlots: import("@x12i/memorix-data-journey").ExpectedSlot[];
|
|
30
|
+
coverage: import("@x12i/memorix-data-journey").ExpectedCoverage;
|
|
31
|
+
}>;
|
|
32
|
+
export declare function listExpectedSlots(platform: MemorixPlatform, scope: MemorixScope, opts: {
|
|
33
|
+
objectType: string;
|
|
34
|
+
viewIds?: string[];
|
|
35
|
+
fixtureName?: string;
|
|
36
|
+
views?: ViewDefinitionLike[];
|
|
37
|
+
}): {
|
|
38
|
+
scope: {
|
|
39
|
+
orgId: string;
|
|
40
|
+
agentIds: string[];
|
|
41
|
+
};
|
|
42
|
+
objectType: string;
|
|
43
|
+
expectedSlots: import("@x12i/memorix-data-journey").ExpectedSlot[];
|
|
44
|
+
expectedPaths: string[];
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=coverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../src/journey/coverage.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgBhD,8DAA8D;AAC9D,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,eAAe,EACzB,KAAK,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