@x12i/memorix-docs 1.0.1 → 1.1.0
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/dist/generated/bundle.d.ts +4849 -3
- package/dist/generated/bundle.d.ts.map +1 -1
- package/dist/generated/bundle.js +7582 -47
- package/dist/generated/bundle.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/files/INDEX.md +84 -0
- package/files/SEARCH.json +3087 -0
- package/files/agent-manifest.json +1785 -0
- package/files/apis/memorix-records/overview.md +22 -0
- package/files/concepts/abstracts-bindings.md +27 -0
- package/files/concepts/agents-inheritance.md +28 -0
- package/files/concepts/analysis-objects.md +26 -0
- package/files/concepts/composition.md +27 -0
- package/files/concepts/decisions-content.md +27 -0
- package/files/concepts/effective-metadata.md +27 -0
- package/files/concepts/explicit-metadata-installation.md +26 -0
- package/files/concepts/intelligence-proposals.md +27 -0
- package/files/concepts/mappings-transforms.md +26 -0
- package/files/concepts/object-content-category.md +26 -0
- package/files/concepts/org-agent-scope.md +27 -0
- package/files/concepts/people-union.md +27 -0
- package/files/concepts/raw-records.md +26 -0
- package/files/concepts/record-revisions.md +26 -0
- package/files/concepts/relationship-definitions.md +26 -0
- package/files/concepts/relationship-references.md +27 -0
- package/files/concepts/resolved-unresolved.md +27 -0
- package/files/concepts/sources-and-memory.md +26 -0
- package/files/concepts/traversal.md +27 -0
- package/files/diagrams/agent-inheritance.md +34 -0
- package/files/diagrams/intelligence-journey.md +38 -0
- package/files/diagrams/memorix-central-journey.md +51 -0
- package/files/diagrams/metadata-lifecycle.md +40 -0
- package/files/diagrams/people-union-diagram.md +36 -0
- package/files/diagrams/record-content-model.md +43 -0
- package/files/diagrams/relationship-traversal.md +40 -0
- package/files/diagrams/revision-safe-write.md +39 -0
- package/files/examples/analysis-decision-records.md +11 -0
- package/files/examples/memorix-record-envelope.md +11 -0
- package/files/examples/metadata-pack-install.md +11 -0
- package/files/examples/people-abstract-query.md +11 -0
- package/files/examples/raw-vs-composed.md +11 -0
- package/files/examples/relationship-def-and-ref.md +11 -0
- package/files/examples/revision-conflict-response.md +11 -0
- package/files/examples/revision-safe-write.md +11 -0
- package/files/examples/traversal-resolved-unresolved.md +11 -0
- package/files/glossary/abstract.md +9 -0
- package/files/glossary/agent.md +9 -0
- package/files/glossary/analysis.md +9 -0
- package/files/glossary/binding.md +9 -0
- package/files/glossary/composition.md +9 -0
- package/files/glossary/content-type.md +9 -0
- package/files/glossary/data-category.md +9 -0
- package/files/glossary/decision.md +9 -0
- package/files/glossary/effective-metadata.md +9 -0
- package/files/glossary/intelligence-proposal.md +9 -0
- package/files/glossary/mapping.md +9 -0
- package/files/glossary/memory.md +9 -0
- package/files/glossary/object-type.md +9 -0
- package/files/glossary/relationship-definition.md +9 -0
- package/files/glossary/relationship-reference.md +9 -0
- package/files/glossary/revision.md +9 -0
- package/files/glossary/scope.md +9 -0
- package/files/glossary/source.md +9 -0
- package/files/glossary/traversal.md +9 -0
- package/files/guides/apply-scope.md +40 -0
- package/files/guides/choose-access-method.md +24 -0
- package/files/guides/compose-subject-ui.md +24 -0
- package/files/guides/define-traverse-relationship.md +26 -0
- package/files/guides/diagnose-unresolved.md +24 -0
- package/files/guides/evidence-to-decision.md +25 -0
- package/files/guides/first-revision-safe-write.md +30 -0
- package/files/guides/inspect-effective-metadata.md +30 -0
- package/files/guides/query-people-abstract.md +25 -0
- package/files/guides/reload-retry-conflict.md +32 -0
- package/files/guides/validate-install-pack.md +32 -0
- package/files/indexes/books.json +95 -0
- package/files/indexes/books.md +17 -0
- package/files/indexes/concepts.json +119 -0
- package/files/indexes/concepts.md +21 -0
- package/files/indexes/diagrams.json +53 -0
- package/files/indexes/diagrams.md +10 -0
- package/files/indexes/guides.json +71 -0
- package/files/indexes/guides.md +13 -0
- package/files/indexes/scenarios.json +41 -0
- package/files/indexes/scenarios.md +8 -0
- package/files/indexes/tutorials.json +47 -0
- package/files/indexes/tutorials.md +9 -0
- package/files/indexes/use-cases.json +239 -0
- package/files/indexes/use-cases.md +41 -0
- package/files/knowledge.json +2940 -0
- package/files/packs/concept/abstracts-bindings/PACK.md +11 -0
- package/files/packs/concept/abstracts-bindings/pack.json +13 -0
- package/files/packs/concept/agents-inheritance/PACK.md +11 -0
- package/files/packs/concept/agents-inheritance/pack.json +13 -0
- package/files/packs/concept/analysis-objects/PACK.md +11 -0
- package/files/packs/concept/analysis-objects/pack.json +14 -0
- package/files/packs/concept/composition/PACK.md +11 -0
- package/files/packs/concept/composition/pack.json +13 -0
- package/files/packs/concept/decisions-content/PACK.md +11 -0
- package/files/packs/concept/decisions-content/pack.json +13 -0
- package/files/packs/concept/effective-metadata/PACK.md +11 -0
- package/files/packs/concept/effective-metadata/pack.json +13 -0
- package/files/packs/concept/explicit-metadata-installation/PACK.md +11 -0
- package/files/packs/concept/explicit-metadata-installation/pack.json +14 -0
- package/files/packs/concept/intelligence-proposals/PACK.md +11 -0
- package/files/packs/concept/intelligence-proposals/pack.json +13 -0
- package/files/packs/concept/mappings-transforms/PACK.md +11 -0
- package/files/packs/concept/mappings-transforms/pack.json +13 -0
- package/files/packs/concept/object-content-category/PACK.md +11 -0
- package/files/packs/concept/object-content-category/pack.json +14 -0
- package/files/packs/concept/org-agent-scope/PACK.md +11 -0
- package/files/packs/concept/org-agent-scope/pack.json +14 -0
- package/files/packs/concept/people-union/PACK.md +11 -0
- package/files/packs/concept/people-union/pack.json +13 -0
- package/files/packs/concept/raw-records/PACK.md +11 -0
- package/files/packs/concept/raw-records/pack.json +14 -0
- package/files/packs/concept/record-revisions/PACK.md +11 -0
- package/files/packs/concept/record-revisions/pack.json +13 -0
- package/files/packs/concept/relationship-definitions/PACK.md +11 -0
- package/files/packs/concept/relationship-definitions/pack.json +14 -0
- package/files/packs/concept/relationship-references/PACK.md +11 -0
- package/files/packs/concept/relationship-references/pack.json +13 -0
- package/files/packs/concept/resolved-unresolved/PACK.md +11 -0
- package/files/packs/concept/resolved-unresolved/pack.json +13 -0
- package/files/packs/concept/sources-and-memory/PACK.md +11 -0
- package/files/packs/concept/sources-and-memory/pack.json +13 -0
- package/files/packs/concept/traversal/PACK.md +11 -0
- package/files/packs/concept/traversal/pack.json +13 -0
- package/files/packs/guide/apply-scope/PACK.md +11 -0
- package/files/packs/guide/apply-scope/pack.json +13 -0
- package/files/packs/guide/choose-access-method/PACK.md +11 -0
- package/files/packs/guide/choose-access-method/pack.json +15 -0
- package/files/packs/guide/compose-subject-ui/PACK.md +11 -0
- package/files/packs/guide/compose-subject-ui/pack.json +13 -0
- package/files/packs/guide/define-traverse-relationship/PACK.md +11 -0
- package/files/packs/guide/define-traverse-relationship/pack.json +14 -0
- package/files/packs/guide/diagnose-unresolved/PACK.md +11 -0
- package/files/packs/guide/diagnose-unresolved/pack.json +13 -0
- package/files/packs/guide/evidence-to-decision/PACK.md +11 -0
- package/files/packs/guide/evidence-to-decision/pack.json +14 -0
- package/files/packs/guide/first-revision-safe-write/PACK.md +11 -0
- package/files/packs/guide/first-revision-safe-write/pack.json +13 -0
- package/files/packs/guide/inspect-effective-metadata/PACK.md +11 -0
- package/files/packs/guide/inspect-effective-metadata/pack.json +13 -0
- package/files/packs/guide/query-people-abstract/PACK.md +11 -0
- package/files/packs/guide/query-people-abstract/pack.json +13 -0
- package/files/packs/guide/reload-retry-conflict/PACK.md +11 -0
- package/files/packs/guide/reload-retry-conflict/pack.json +13 -0
- package/files/packs/guide/validate-install-pack/PACK.md +11 -0
- package/files/packs/guide/validate-install-pack/pack.json +13 -0
- package/files/packs/scenario/choose-subject-view/PACK.md +11 -0
- package/files/packs/scenario/choose-subject-view/pack.json +11 -0
- package/files/packs/scenario/pack-valid-not-installed/PACK.md +11 -0
- package/files/packs/scenario/pack-valid-not-installed/pack.json +11 -0
- package/files/packs/scenario/scope-mismatch/PACK.md +11 -0
- package/files/packs/scenario/scope-mismatch/pack.json +11 -0
- package/files/packs/scenario/stale-revision-conflict/PACK.md +11 -0
- package/files/packs/scenario/stale-revision-conflict/pack.json +11 -0
- package/files/packs/scenario/traversal-direction/PACK.md +11 -0
- package/files/packs/scenario/traversal-direction/pack.json +11 -0
- package/files/packs/scenario/unresolved-relationship/PACK.md +11 -0
- package/files/packs/scenario/unresolved-relationship/pack.json +11 -0
- package/files/packs/tutorial/analysis-decision-lab/PACK.md +11 -0
- package/files/packs/tutorial/analysis-decision-lab/pack.json +14 -0
- package/files/packs/tutorial/compare-views/PACK.md +11 -0
- package/files/packs/tutorial/compare-views/pack.json +14 -0
- package/files/packs/tutorial/conflict-lab/PACK.md +11 -0
- package/files/packs/tutorial/conflict-lab/pack.json +13 -0
- package/files/packs/tutorial/first-revision-safe-record/PACK.md +11 -0
- package/files/packs/tutorial/first-revision-safe-record/pack.json +13 -0
- package/files/packs/tutorial/install-pack-lab/PACK.md +11 -0
- package/files/packs/tutorial/install-pack-lab/pack.json +13 -0
- package/files/packs/tutorial/relationships-lab/PACK.md +11 -0
- package/files/packs/tutorial/relationships-lab/pack.json +13 -0
- package/files/packs/tutorial/start-with-sample-data/PACK.md +11 -0
- package/files/packs/tutorial/start-with-sample-data/pack.json +13 -0
- package/files/sample-data/memorix-synthetic-basic.md +13 -0
- package/files/scenarios/choose-subject-view.md +36 -0
- package/files/scenarios/pack-valid-not-installed.md +33 -0
- package/files/scenarios/scope-mismatch.md +44 -0
- package/files/scenarios/stale-revision-conflict.md +38 -0
- package/files/scenarios/traversal-direction.md +30 -0
- package/files/scenarios/unresolved-relationship.md +31 -0
- package/files/tutorials/analysis-decision-lab.md +18 -0
- package/files/tutorials/compare-views.md +22 -0
- package/files/tutorials/conflict-lab.md +18 -0
- package/files/tutorials/first-revision-safe-record.md +18 -0
- package/files/tutorials/install-pack-lab.md +22 -0
- package/files/tutorials/relationships-lab.md +18 -0
- package/files/tutorials/start-with-sample-data.md +18 -0
- package/files/ui/clients/memorix-studio.md +9 -0
- package/files/use-cases/abstract-people-list.md +237 -0
- package/files/use-cases/ai-pipeline-fail-closed.md +117 -0
- package/files/use-cases/author-pipeline-e2e.md +339 -0
- package/files/use-cases/build-callable-service.md +347 -0
- package/files/use-cases/builder-acceptance-ops.md +112 -0
- package/files/use-cases/choose-access-method.md +111 -0
- package/files/use-cases/client-first-read-write.md +374 -0
- package/files/use-cases/compose-for-ui.md +97 -0
- package/files/use-cases/custom-kind-descriptors.md +137 -0
- package/files/use-cases/data-journey-evidence.md +115 -0
- package/files/use-cases/discriminated-content-writes.md +152 -0
- package/files/use-cases/embed-studio-host.md +165 -0
- package/files/use-cases/four-field-links.md +246 -0
- package/files/use-cases/http-process-compliance.md +225 -0
- package/files/use-cases/install-metadata-pack.md +180 -0
- package/files/use-cases/intelligence-propose-install.md +163 -0
- package/files/use-cases/knowx-claims-review.md +396 -0
- package/files/use-cases/learn-record-envelope.md +233 -0
- package/files/use-cases/lists-cursors-pagination.md +196 -0
- package/files/use-cases/local-acceptance-g12ops.md +160 -0
- package/files/use-cases/memory-hourly-ingest.md +276 -0
- package/files/use-cases/metadata-before-write.md +145 -0
- package/files/use-cases/migrate-associated-star.md +159 -0
- package/files/use-cases/openapi-typed-client.md +78 -0
- package/files/use-cases/ops-pack-fixtures.md +168 -0
- package/files/use-cases/orient-platform.md +172 -0
- package/files/use-cases/pipeline-retry-evidence.md +121 -0
- package/files/use-cases/relationship-rebuild-verify.md +128 -0
- package/files/use-cases/revision-stale-conflicts.md +194 -0
- package/files/use-cases/start-from-zero.md +171 -0
- package/files/use-cases/studio-design-types.md +122 -0
- package/files/use-cases/studio-explore-subject.md +89 -0
- package/files/use-cases/studio-operate-pipelines.md +100 -0
- package/files/use-cases/studio-review-intelligence.md +74 -0
- package/files/use-cases/studio-scope-isolation.md +67 -0
- package/files/use-cases/studio-stale-conflict-ui.md +54 -0
- package/files/use-cases/troubleshoot-http-matrix.md +164 -0
- package/files/use-cases/trusted-in-process-embed.md +94 -0
- package/files/use-cases/workflow-sibling-api.md +212 -0
- package/files/visuals/revision-conflict.md +19 -0
- package/files/visuals/scope-apply.md +19 -0
- package/package.json +5 -4
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Compose a subject for a UI view
|
|
2
|
+
|
|
3
|
+
> **Use case id:** `compose-for-ui`
|
|
4
|
+
> **Goal:** Use explicit composition instead of N+1 gets for a subject screen.
|
|
5
|
+
> **Audiences:** developers
|
|
6
|
+
> **Tags:** compose, ui, http
|
|
7
|
+
|
|
8
|
+
## Reading path
|
|
9
|
+
|
|
10
|
+
1. **Runtime Data Client** (developers) → chapters: `6-explicit-composition`
|
|
11
|
+
1. **Data Access Patterns** (developers) → chapters: `6-composition-versus-multiple-gets`
|
|
12
|
+
|
|
13
|
+
## From: Runtime Data Client — 6. Explicit composition
|
|
14
|
+
|
|
15
|
+
Composition is **requested**. Same `recordId`, multiple content types/instances.
|
|
16
|
+
|
|
17
|
+
### Shape rules
|
|
18
|
+
|
|
19
|
+
- Response uses **arrays per content type** (even singleton types appear as arrays in compose).
|
|
20
|
+
- Siblings are **not** flattened into one mega-document.
|
|
21
|
+
- Clients may select which content types to include.
|
|
22
|
+
- Workflow / context / analysis / decisions appear only when selected.
|
|
23
|
+
- Composition carries **no** relationship definitions — neighbors stay relationship APIs.
|
|
24
|
+
|
|
25
|
+
### Ops examples
|
|
26
|
+
|
|
27
|
+
| Request | Result idea |
|
|
28
|
+
|---|---|
|
|
29
|
+
| Compose `wi-100` with `snapshots` + `workflow` | One snapshot array entry + workflow array entry |
|
|
30
|
+
| Include two analyses | `analysis: [capacity, delivery-risk]` (names illustrative) |
|
|
31
|
+
| Include three decisions | Arrays under decisions; independent revisions |
|
|
32
|
+
| Optional sibling missing | Empty array or omitted per contract — not a fake null record |
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
composeSubject(wi-100)
|
|
36
|
+
snapshots[] revision N
|
|
37
|
+
workflow[] revision M
|
|
38
|
+
analysis[] each own revision
|
|
39
|
+
decisions[] each own revision
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
curl -sS -X POST \
|
|
44
|
+
-H "content-type: application/json" \
|
|
45
|
+
-H "x-memorix-org-id: $ORG" \
|
|
46
|
+
-H "x-memorix-agent-ids: $AGENTS" \
|
|
47
|
+
-d '{"recordId":"wi-100","explicit":true,"contentTypes":["snapshots","workflow","analysis","decisions"]}' \
|
|
48
|
+
"$BASE/api/data/compose"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
OpenAPI operation: `dataCompose`. `explicit: true` is required. Response keeps **arrays per content type**; missing siblings are empty/omitted arrays (plus warnings when the contract exposes them) — not invented singleton objects.
|
|
52
|
+
|
|
53
|
+
### May / must-not
|
|
54
|
+
|
|
55
|
+
- **You may** compose for a dossier / Studio Explore-style view.
|
|
56
|
+
- **You must not** invent a single “subject revision” by taking `max(sibling revisions)`.
|
|
57
|
+
- **You must not** flatten arrays into one object keyed only by content type when multiple discriminators exist.
|
|
58
|
+
- **You must not** call compose as `GET` with query params — the service accepts **`POST /api/data/compose`** only.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## From: Data Access Patterns — 6. Composition versus multiple gets
|
|
63
|
+
|
|
64
|
+
**Preferred:** request explicit composition when the client needs several sibling content types for one subject (snapshot + workflow + decisions for `wi-100`).
|
|
65
|
+
|
|
66
|
+
**Acceptable:** separate exact reads when only one or two independently refreshed siblings are needed (e.g. poll workflow alone).
|
|
67
|
+
|
|
68
|
+
**Avoid:**
|
|
69
|
+
|
|
70
|
+
- Fetching every registered sibling automatically
|
|
71
|
+
- Flattening siblings into the snapshot payload
|
|
72
|
+
- Treating analysis/workflow as relationships
|
|
73
|
+
- Caching composition as a new authoritative stored record
|
|
74
|
+
|
|
75
|
+
Composition is **virtual**. Sibling instances keep independent revisions. Payload size and freshness trade off: compose once for a dossier screen; refresh one sibling when only that pane changed.
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
Subject wi-100
|
|
79
|
+
├─ snapshots (revision N)
|
|
80
|
+
├─ workflow (revision M)
|
|
81
|
+
├─ decisions[] (per-instance revisions)
|
|
82
|
+
└─ analysis[] (per-instance revisions)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Best:** compose API / `composeSubject`.
|
|
86
|
+
**Acceptable:** multiple gets of **references / envelopes**, assembled in the client without copying neighbor `.data` into the source.
|
|
87
|
+
**Forbidden:** embed copied neighbor payloads (`associated*` revival).
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Also see
|
|
92
|
+
|
|
93
|
+
- **Format for Dummies** (`01-format-for-dummies`) — Mental model of the record envelope — OT/CT, composition, discriminators, and what is not stored on the record.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
_Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Store custom UI kind descriptors
|
|
2
|
+
|
|
3
|
+
> **Use case id:** `custom-kind-descriptors`
|
|
4
|
+
> **Goal:** Use kindDeclarations / extensions for client-owned tabs without a new engine.
|
|
5
|
+
> **Audiences:** developers
|
|
6
|
+
> **Tags:** metadata, kinds, ui
|
|
7
|
+
|
|
8
|
+
## Reading path
|
|
9
|
+
|
|
10
|
+
1. **Metadata, Agents, Abstracts & Mappings** (developers) → chapters: `8-built-in-vs-custom-kinds`
|
|
11
|
+
1. **Agent Packs & Ops** (developers) → chapters: `5-custom-kinds-in-a-pack`
|
|
12
|
+
|
|
13
|
+
## From: Metadata, Agents, Abstracts & Mappings — 8. Built-in vs custom kinds
|
|
14
|
+
|
|
15
|
+
Platform engines understand a fixed set of **built-in** kinds, including:
|
|
16
|
+
|
|
17
|
+
`agents`, `object-types`, `abstract-types`, `abstract-bindings`, `relationships`, `mappings`, `views`, `writes`, `pipelines`, `sources`, `services`, `schedules`, … plus `kind-declarations`.
|
|
18
|
+
|
|
19
|
+
Clients that need product-specific descriptor families **declare** namespaced custom kinds instead of forking tier-1 code.
|
|
20
|
+
|
|
21
|
+
| Concern | How |
|
|
22
|
+
|---|---|
|
|
23
|
+
| Declare a kind | `kindDeclarations[]` — id like `acme.ui-tabs`, `name`, `schemaVersion`, optional `itemSchema` |
|
|
24
|
+
| Author items | `extensions["acme.ui-tabs"]` — each item needs `id` |
|
|
25
|
+
| Store / resolve | Same multi-agent inheritance as built-ins (`kind` + `id`) |
|
|
26
|
+
| Catalog | Built-ins keep fixed Catalox catalogs; custom items share `memorix-extensions` |
|
|
27
|
+
| Engines | **Do not** interpret custom kinds — data / relationships / pipelines ignore them |
|
|
28
|
+
|
|
29
|
+
**Kind id rules:**
|
|
30
|
+
|
|
31
|
+
- Dotted lowercase namespace (`acme.ui-tabs`)
|
|
32
|
+
- Not a built-in id
|
|
33
|
+
- Not a forbidden operational id (`pipeline-runs`, `leases`, …)
|
|
34
|
+
|
|
35
|
+
### Worked example
|
|
36
|
+
|
|
37
|
+
Pack fragment (see also [`memorix-metadata/examples/custom-kinds/acme-ui-tabs.pack.json`](../../../memorix-metadata/examples/custom-kinds/acme-ui-tabs.pack.json)):
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"kindDeclarations": [
|
|
42
|
+
{
|
|
43
|
+
"id": "acme.ui-tabs",
|
|
44
|
+
"name": "UI Tabs",
|
|
45
|
+
"description": "Client-owned tab layouts for object detail screens (store/resolve only).",
|
|
46
|
+
"schemaVersion": "acme.uiTabs.v1",
|
|
47
|
+
"itemSchema": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"required": ["id", "title", "objectType"],
|
|
50
|
+
"properties": {
|
|
51
|
+
"id": { "type": "string" },
|
|
52
|
+
"title": { "type": "string" },
|
|
53
|
+
"objectType": { "type": "string" },
|
|
54
|
+
"tabs": { "type": "array" }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"extensions": {
|
|
60
|
+
"acme.ui-tabs": [
|
|
61
|
+
{
|
|
62
|
+
"id": "employee-detail",
|
|
63
|
+
"title": "Employee detail",
|
|
64
|
+
"objectType": "employees",
|
|
65
|
+
"schemaVersion": "acme.uiTabs.v1",
|
|
66
|
+
"tabs": [
|
|
67
|
+
{ "id": "overview", "label": "Overview" },
|
|
68
|
+
{ "id": "history", "label": "History" }
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### HTTP for kinds
|
|
77
|
+
|
|
78
|
+
```http
|
|
79
|
+
GET /api/metadata/kinds
|
|
80
|
+
GET /api/metadata/kinds/acme.ui-tabs
|
|
81
|
+
GET /api/metadata/definition?kind=acme.ui-tabs&id=employee-detail
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
`GET /api/metadata/kinds` returns `builtIn` registry rows plus effective `custom` kind-declarations for the scope. Studio browsing for custom kinds may lag the API — treat HTTP as the source of truth today.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## From: Agent Packs & Ops — 5. Custom kinds in a pack
|
|
89
|
+
|
|
90
|
+
When a client needs a descriptor family that is **not** a built-in kind, declare it on the pack and ship items:
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"format": "memorix-metadata/1",
|
|
95
|
+
"agentId": "ops",
|
|
96
|
+
"kindDeclarations": [
|
|
97
|
+
{
|
|
98
|
+
"id": "acme.ui-tabs",
|
|
99
|
+
"name": "UI Tabs",
|
|
100
|
+
"schemaVersion": "acme.uiTabs.v1"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"extensions": {
|
|
104
|
+
"acme.ui-tabs": [
|
|
105
|
+
{
|
|
106
|
+
"id": "employee-detail",
|
|
107
|
+
"title": "Employee detail",
|
|
108
|
+
"objectType": "employees"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Full worked pack: [`memorix-metadata/examples/custom-kinds/acme-ui-tabs.pack.json`](../../../memorix-metadata/examples/custom-kinds/acme-ui-tabs.pack.json).
|
|
116
|
+
|
|
117
|
+
### Rules of thumb
|
|
118
|
+
|
|
119
|
+
| Rule | Detail |
|
|
120
|
+
|---|---|
|
|
121
|
+
| Namespaced ids | `vendor.feature` (e.g. `acme.ui-tabs`) |
|
|
122
|
+
| Inheritance | Child agents may override items by same `kind` + `id` |
|
|
123
|
+
| Parent kinds | A child pack may reference a kind declared on an already-installed parent |
|
|
124
|
+
| Execution | Custom kinds are **store/resolve only** — pipelines and the data plane do **not** execute them |
|
|
125
|
+
| Prefer built-ins | Use object types, views, and writes for Memorix-native shape; custom kinds for client-owned descriptors |
|
|
126
|
+
|
|
127
|
+
Read back via effective metadata / `GET /api/metadata/kinds` after install.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Also see
|
|
132
|
+
|
|
133
|
+
- **Workflow & Studio** (`09-workflow-and-studio`) — Design · Operate · Explore — scope bar ≡ headers, workflow siblings, embedding guidance. Builders primary.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
_Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Use data-journey matrix and evidence APIs
|
|
2
|
+
|
|
3
|
+
> **Use case id:** `data-journey-evidence`
|
|
4
|
+
> **Goal:** Drive Explore/evidence UIs via /api/data-journey without inventing coverage rules.
|
|
5
|
+
> **Audiences:** developers
|
|
6
|
+
> **Tags:** data-journey, evidence, http
|
|
7
|
+
|
|
8
|
+
## Reading path
|
|
9
|
+
|
|
10
|
+
1. **Runtime Data Client** (developers) → chapters: `17-operational-clients`
|
|
11
|
+
1. **Data Access Patterns** (developers) → chapters: `19-observability`, `2-master-decision-matrix`
|
|
12
|
+
|
|
13
|
+
## From: Runtime Data Client — 17. Operational clients
|
|
14
|
+
|
|
15
|
+
Operational artifacts are **not** subject records.
|
|
16
|
+
|
|
17
|
+
Clients may:
|
|
18
|
+
|
|
19
|
+
- Start pipeline runs; inspect runs and step attempts
|
|
20
|
+
- Retry failed steps; resume runs
|
|
21
|
+
- Retrieve DataRef / artifacts
|
|
22
|
+
- Inspect captured run context
|
|
23
|
+
- Inspect Memory pulls and quarantine
|
|
24
|
+
- Inspect relationship verify/rebuild reports
|
|
25
|
+
- Inspect intelligence **proposals** (never auto-install)
|
|
26
|
+
|
|
27
|
+
Route families: `/api/pipelines` · `/api/memory` · `/api/relationships` · `/api/intelligence` · `/api/operations` · `/api/data-journey`.
|
|
28
|
+
|
|
29
|
+
### Data journey (evidence / Explore)
|
|
30
|
+
|
|
31
|
+
Read-only family for evidence cones and expected-vs-filled coverage (views as **slots only** — descriptors never invent available cells):
|
|
32
|
+
|
|
33
|
+
| Method | Path | Use |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| `GET` | `/api/data-journey/object-types` | Selector from effective metadata |
|
|
36
|
+
| `GET` | `/api/data-journey/journeys` | Real runs (+ fixture option when exposed) |
|
|
37
|
+
| `POST` | `/api/data-journey/matrix/query` | Sparse DB/SVC matrix from evidence |
|
|
38
|
+
| `POST` | `/api/data-journey/coverage` | Expected (views) − filled (evidence) |
|
|
39
|
+
| `GET` | `/api/data-journey/expected-slots` | Descriptor slots only |
|
|
40
|
+
| `GET` | `/api/data-journey/evidence/:ref` | Cell drill-down (values opt-in) |
|
|
41
|
+
|
|
42
|
+
Full Memory → pipeline → client-read narrative: [docs/runtime-data-journey.md](../../../docs/runtime-data-journey.md) (Act V). Package notes: `@x12i/memorix-data-journey` — remote apps call HTTP only.
|
|
43
|
+
|
|
44
|
+
### Partial failure
|
|
45
|
+
|
|
46
|
+
Do not blindly re-run an entire pipeline when one step failed — use the retry/resume operations for the failed step/run.
|
|
47
|
+
|
|
48
|
+
### Intelligence
|
|
49
|
+
|
|
50
|
+
Proposals are suggestions. Humans (or explicit install APIs) install metadata. Agents must not treat a proposal as already-published truth.
|
|
51
|
+
|
|
52
|
+
### Ops example
|
|
53
|
+
|
|
54
|
+
1. Memory pull lands Alex raw from ops-source.
|
|
55
|
+
2. Pipeline run promotes snapshot; one step fails validation.
|
|
56
|
+
3. Retry **that** step; retrieve artifact for the failed attempt.
|
|
57
|
+
4. Read the promoted (or still-raw) content via `/api/data` — do not confuse the artifact with the subject record.
|
|
58
|
+
5. Optionally query `/api/data-journey/coverage` for the same org/agents to see expected slots vs filled evidence.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## From: Data Access Patterns — 19. Observability
|
|
63
|
+
|
|
64
|
+
Every client pattern should carry enough identity to debug without opening Mongo:
|
|
65
|
+
|
|
66
|
+
- Correlation / request ID
|
|
67
|
+
- Run ID where async
|
|
68
|
+
- Step / attempt ID
|
|
69
|
+
- `recordId` / content address
|
|
70
|
+
- Expected and result revision
|
|
71
|
+
- `sourceId` / `pullId` where Memory
|
|
72
|
+
- `relationshipDefinitionId` where relationship operation
|
|
73
|
+
- Artifact reference where applicable
|
|
74
|
+
|
|
75
|
+
**Do not log:** credentials, unrestricted raw payloads, sensitive provider data unnecessarily, Mongo connection details.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## From: Data Access Patterns — 2. Master decision matrix
|
|
80
|
+
|
|
81
|
+
For every runtime goal: preferred method, acceptable ad-hoc, forbidden method, and the consistency / retry story.
|
|
82
|
+
|
|
83
|
+
| Goal | Best | Acceptable | Forbidden | Consistency / retry |
|
|
84
|
+
|---|---|---|---|---|
|
|
85
|
+
| Read one known content instance | Service `GET /api/data/content` (exact) | In-process `@x12i/memorix-data` `getContent` | Mongo `findOne` | Current revision; retry transient failures |
|
|
86
|
+
| Find records matching fields | Bounded list/query + opaque cursor | Temporary ad-hoc filter with hard limit | Unbounded `listAll` / decoded cursors | Cursor contract; retry **same** query+cursor |
|
|
87
|
+
| Read all content about one subject | Explicit composition | Two–three independent exact gets | Flatten siblings into the snapshot; invent `associated*` | Current siblings; per-sibling revisions |
|
|
88
|
+
| Read a union such as People | Abstract list / get | Concrete lists + UI label (diagnosis only) | Abstract collection / abstract `recordId` | Metadata-dependent projection |
|
|
89
|
+
| Follow relationships | Relationship query / `expandRelationships` | Bounded investigation queries | Client-side org-wide joins; copied payloads | Current targets; unresolved stays unresolved |
|
|
90
|
+
| Read current related properties | Related-property / expansion APIs | Two bounded queries | Persist expanded targets on the source | Current; may go stale if cached naïvely |
|
|
91
|
+
| Process a small known set | Batch get (if exposed) or bounded list of addresses | Parallel exact gets with concurrency cap | Cartesian fan-out | Per-item |
|
|
92
|
+
| Process a large set | Pipeline + DataRef | Async export for reporting | Interactive mega-list | Captured/ledgered; retry failed items |
|
|
93
|
+
| Import external data | Memory pull → raw | Controlled source test via Memory | Direct snapshot insert from connector | Source cursor; resume committed cursor |
|
|
94
|
+
| Write one content instance | `patch` / `upsert` / `replace` / `remove` + precondition | Operator script through the same API | Blind replace; Mongo update | Exact revision; never blind-retry after stale |
|
|
95
|
+
| Update an abstract property | `patchAbstract` reverse write | Temporary concrete patch when mapping is clear | Writing an “abstract record” | Maps to one concrete revision |
|
|
96
|
+
| Modify many records | Pipeline / batch with per-item revisions | Capture-all-then-write for tiny sets | Client update-many; list-mutate active sort | Partial success ledger |
|
|
97
|
+
| Create relationships | Relationship engine (discover / materialize / rebuild) | Dry-run / verify | Manual link inserts; `associated*` | Idempotent materialization |
|
|
98
|
+
| Inspect execution history | Operations / pipeline / Memory APIs | Studio Operate views | Treating ledgers as subject content | Operational identity |
|
|
99
|
+
| Inspect evidence / expected slots | `/api/data-journey/*` (matrix, coverage, evidence) | Studio Explore evidence UI | Inventing cells; treating journey rows as subject content | Read-only; views = slots only |
|
|
100
|
+
| Export large data | Asynchronous export artifact | Paginated offline consumer with checkpoint | Single-request dump | Export contract |
|
|
101
|
+
| Investigate once | Bounded ad-hoc API query | Studio Explore | Direct Mongo shell | Read-only unless labeled write |
|
|
102
|
+
| Save a repeated query | Metadata-defined view | Temporary client query | Hardcoded DB query in the product | Versioned with metadata |
|
|
103
|
+
| Repeated business process | Pipeline definition | Scheduled Memory + pipeline | UI-embedded “batch engine” | Durable run ledger |
|
|
104
|
+
| Propose new object type | Intelligence proposal → human install | Export draft for review | Intelligence auto-publish / AI writing records | Proposal ≠ live metadata |
|
|
105
|
+
| Secret to connector | `credentialRef` | — | Secret in body / Memory payload | Never log credentials |
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Also see
|
|
110
|
+
|
|
111
|
+
- **Lists, Queries, Pagination** (`03-lists-queries-pagination`) — List contracts, query grammar, cursors, page size, and multi-resource listing without foot-guns.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
_Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# Write analysis / decision / narrative content
|
|
2
|
+
|
|
3
|
+
> **Use case id:** `discriminated-content-writes`
|
|
4
|
+
> **Goal:** Use discriminators correctly for sibling content types.
|
|
5
|
+
> **Audiences:** developers
|
|
6
|
+
> **Tags:** discriminators, writes, http
|
|
7
|
+
|
|
8
|
+
## Reading path
|
|
9
|
+
|
|
10
|
+
1. **Runtime Data Client** (developers) → chapters: `11-discriminated-content-writes`
|
|
11
|
+
1. **Format for Dummies** (developers) → chapters: `10-discriminated-content-instances`
|
|
12
|
+
1. **Data Access Patterns** (developers) → chapters: `15-workflow-analysis-and-decision-content`
|
|
13
|
+
|
|
14
|
+
## From: Runtime Data Client — 11. Discriminated content writes
|
|
15
|
+
|
|
16
|
+
Multi-instance content is addressed by:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
{
|
|
20
|
+
recordId: string;
|
|
21
|
+
contentType: string;
|
|
22
|
+
discriminatorPath: string; // from content profile metadata
|
|
23
|
+
discriminatorValue: string; // e.g. "capacity"
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Rules
|
|
28
|
+
|
|
29
|
+
1. Discriminator metadata comes from the **content profile**.
|
|
30
|
+
2. Default (if any) is applied **before** addressing and is **persisted**.
|
|
31
|
+
3. Missing required discriminator fails **before** reservation.
|
|
32
|
+
4. Explicit default and omitted-with-default identify the **same** instance.
|
|
33
|
+
5. Discriminator **cannot** be changed with patch/replace — remove then add.
|
|
34
|
+
6. Each discriminator instance has an **independent** revision.
|
|
35
|
+
7. Internal storage key is **not** a client identifier.
|
|
36
|
+
|
|
37
|
+
### Ops examples
|
|
38
|
+
|
|
39
|
+
| Case | Behavior |
|
|
40
|
+
|---|---|
|
|
41
|
+
| Two analyses on `wi-100` (`capacity`, `delivery-risk`) | Two instances, two revisions |
|
|
42
|
+
| Different decision types | Separate instances under `decisions` |
|
|
43
|
+
| Duplicate discriminator add | Conflict / duplicate — read existing |
|
|
44
|
+
| Missing required discriminator | Fail before write |
|
|
45
|
+
| Patch that changes discriminator | Immutable failure |
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
curl -sS \
|
|
49
|
+
-H "x-memorix-org-id: $ORG" \
|
|
50
|
+
-H "x-memorix-agent-ids: $AGENTS" \
|
|
51
|
+
"$BASE/api/data/content?objectType=work-items&contentType=analysis&id=wi-100&discriminator=capacity"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
await writeContent({
|
|
56
|
+
op: "add",
|
|
57
|
+
objectType: "work-items",
|
|
58
|
+
contentType: "analysis",
|
|
59
|
+
recordId: "wi-100",
|
|
60
|
+
discriminatorValue: "capacity",
|
|
61
|
+
precondition: { kind: "absent" },
|
|
62
|
+
record: {
|
|
63
|
+
format: "memorix-record/2",
|
|
64
|
+
recordId: "wi-100",
|
|
65
|
+
objectType: "work-items",
|
|
66
|
+
contentType: "analysis",
|
|
67
|
+
dataCategory: "entity",
|
|
68
|
+
data: { kind: "capacity", score: 0.72 },
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## From: Format for Dummies — 10. Discriminated content instances
|
|
76
|
+
|
|
77
|
+
### Why some content types have more than one instance
|
|
78
|
+
|
|
79
|
+
Analysis, decisions, and discovery can exist many times per subject (capacity vs delivery-risk; priority vs schedule; …).
|
|
80
|
+
|
|
81
|
+
### Built-in discriminator paths (defaults)
|
|
82
|
+
|
|
83
|
+
| Content type | Path | Default |
|
|
84
|
+
|---|---|---|
|
|
85
|
+
| `analysis` | `data.analysisType` | `"default"` |
|
|
86
|
+
| `decisions` | `data.decisionType` | `"default"` |
|
|
87
|
+
| `discovery` | `data.discoveryType` | `"default"` |
|
|
88
|
+
|
|
89
|
+
Metadata defines path / requiredness / default / allowed values. Defaults are applied and **persisted** before addressing so the record stays self-describing.
|
|
90
|
+
|
|
91
|
+
### Addressing
|
|
92
|
+
|
|
93
|
+
Same `recordId` + `contentType` + discriminator value → one instance.
|
|
94
|
+
|
|
95
|
+
- Discriminator values are **immutable** for an existing instance.
|
|
96
|
+
- Changing the discriminator requires **remove + add**.
|
|
97
|
+
- Each instance has its own revision.
|
|
98
|
+
- Mongo’s deterministic storage key is internal; `recordId` remains the subject.
|
|
99
|
+
|
|
100
|
+
### Two analyses on one work item
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"recordId": "wi-100",
|
|
105
|
+
"contentType": "analysis",
|
|
106
|
+
"data": { "analysisType": "delivery-risk", "risk": "low" }
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"recordId": "wi-100",
|
|
113
|
+
"contentType": "analysis",
|
|
114
|
+
"data": { "analysisType": "capacity", "load": "nominal" }
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Validation: missing required discriminator → `V2-DISCRIMINATOR`. Missing with default → warning `V2-DISCRIMINATOR-DEFAULT` (writers apply default).
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## From: Data Access Patterns — 15. Workflow, analysis, and decision content
|
|
123
|
+
|
|
124
|
+
### Workflow
|
|
125
|
+
|
|
126
|
+
Workflow is ordinary sibling content about the subject — not a separate persistence product.
|
|
127
|
+
|
|
128
|
+
**Best:** exact workflow read; patch/replace with revision; explicit composition for subject context; pipeline/workflow operation for repeated transitions.
|
|
129
|
+
**Ad-hoc:** one revision-safe workflow correction.
|
|
130
|
+
**Forbidden:** workflow-specific direct collection writes; flattening workflow into snapshot; a second “workflow service” with different semantics.
|
|
131
|
+
|
|
132
|
+
### Analysis, decision, discovery
|
|
133
|
+
|
|
134
|
+
- Discriminator required/default rules come from metadata profiles
|
|
135
|
+
- Multiple instances per subject are normal
|
|
136
|
+
- Exact addressing + independent revisions
|
|
137
|
+
- List by discriminator when discovering instances
|
|
138
|
+
- No in-place discriminator change (remove + recreate when the product allows)
|
|
139
|
+
- Outputs from AI/services are still ordinary V2 content once written
|
|
140
|
+
|
|
141
|
+
**Best:** pipeline produces a validated typed instance; clients read exact type or list instances.
|
|
142
|
+
**Ad-hoc:** revision-safe correction of one existing instance if product rules allow.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Also see
|
|
147
|
+
|
|
148
|
+
- **Workflow & Studio** (`09-workflow-and-studio`) — Design · Operate · Explore — scope bar ≡ headers, workflow siblings, embedding guidance. Builders primary.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
_Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Embed Studio in a host app
|
|
2
|
+
|
|
3
|
+
> **Use case id:** `embed-studio-host`
|
|
4
|
+
> **Goal:** Map scope bar to HTTP headers and embed the sole product UI correctly.
|
|
5
|
+
> **Audiences:** developers
|
|
6
|
+
> **Tags:** studio, embedding
|
|
7
|
+
|
|
8
|
+
## Reading path
|
|
9
|
+
|
|
10
|
+
1. **Workflow & Studio** (developers) → chapters: `1-studio-constraint-service-only-ui`, `3-scope-bar-http-headers`, `7-embedding-guidance-for-host-apps`
|
|
11
|
+
|
|
12
|
+
## From: Workflow & Studio — 1. Studio constraint (service-only UI)
|
|
13
|
+
|
|
14
|
+
`@x12i/memorix-studio` is the **sole Memorix product UI**. It talks **only** to `@x12i/memorix-service` via proxied `/api` and `/health`.
|
|
15
|
+
|
|
16
|
+
Rules:
|
|
17
|
+
|
|
18
|
+
1. Do **not** point custom UIs at package internals (`memorix-data`, Mongo drivers, metadata JSON on disk).
|
|
19
|
+
2. Do **not** embed Studio as a shell around direct database access.
|
|
20
|
+
3. Do **not** invent a parallel “admin console” that mutates domain collections.
|
|
21
|
+
4. Host apps that need Memorix capabilities call the **same OpenAPI surface** Studio uses.
|
|
22
|
+
|
|
23
|
+
### Local run
|
|
24
|
+
|
|
25
|
+
Prefer the monorepo stack:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
node scripts/dev-stack.mjs
|
|
29
|
+
# starts ops-source + service + studio + stack-status; opens /_live tabs
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Or local pair:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# terminal 1 — service (default :5100)
|
|
36
|
+
cd memorix-service && MEMORIX_SERVICE_MODE=dev npm run dev
|
|
37
|
+
|
|
38
|
+
# terminal 2 — studio (default :5101, proxies to service)
|
|
39
|
+
cd memorix-studio && npm run dev
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
| Surface | Default |
|
|
43
|
+
|---|---|
|
|
44
|
+
| Studio | http://127.0.0.1:5101 (`MEMORIX_STUDIO_PORT` / `VITE_DEV_PORT`, odd = UI) |
|
|
45
|
+
| Service | http://127.0.0.1:5100 (`MEMORIX_SERVICE_PORT`, even = API) |
|
|
46
|
+
| Service live view | http://127.0.0.1:5100/_live |
|
|
47
|
+
| Stack status | http://127.0.0.1:5103/ |
|
|
48
|
+
| Ops-source | http://127.0.0.1:5102/ (`OPS_SOURCE_PORT`) |
|
|
49
|
+
| Proxy target | `MEMORIX_SERVICE_PROXY_TARGET` or derived from service port |
|
|
50
|
+
|
|
51
|
+
Zone map: `@x12i/ports-manager` (Memorix **5100–5119**). HTTP compliance: `@x12i/core-service`. Studio binds an **odd** UI port and proxies API via `MEMORIX_SERVICE_PROXY_TARGET` (or derived service port) — it must not bind an even API port. Open for debug: Studio Explore/Operate, service `/_live` (`:5100/_live`), stack hub (`:5103`). Authoring a worker process: [Building Services — HTTP compliance](../../07-services/developers/BOOK.md#http-process-compliance-local-services).
|
|
52
|
+
|
|
53
|
+
Acceptance workspace: isolated `g12ops*` + `agentIds: ["ops"]` in the scope bar (builders twin shows the screenshot).
|
|
54
|
+
|
|
55
|
+
### Why this boundary exists
|
|
56
|
+
|
|
57
|
+
- One auth / scope / revision model for humans and machines.
|
|
58
|
+
- One OpenAPI contract (`GET /api/openapi.json`) for generated clients.
|
|
59
|
+
- No accidental Mongo-shaped writes that bypass directory, G4 relationships, or abstract rules.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## From: Workflow & Studio — 3. Scope bar ≡ HTTP headers
|
|
64
|
+
|
|
65
|
+
Studio’s scope bar is not decoration. It is the same tenant boundary every API call must send.
|
|
66
|
+
|
|
67
|
+
```http
|
|
68
|
+
x-memorix-org-id: g12ops<suffix>
|
|
69
|
+
x-memorix-agent-ids: ops
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
| Rule | Detail |
|
|
73
|
+
|---|---|
|
|
74
|
+
| Org | Fresh `g12ops*` for acceptance — never live customer orgs |
|
|
75
|
+
| Agents | Plural header only; comma-separated when multiple |
|
|
76
|
+
| Singular `agentId` | Rejected with **400** |
|
|
77
|
+
| Effective metadata | Resolved for the supplied `agentIds[]` after install |
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
ORG=g12opsdemo01
|
|
81
|
+
H=(-H "x-memorix-org-id: $ORG" -H "x-memorix-agent-ids: ops")
|
|
82
|
+
|
|
83
|
+
curl -s "${H[@]}" "$SERVICE/api/metadata/effective" | head
|
|
84
|
+
curl -s "${H[@]}" "$SERVICE/health"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
If Studio “looks empty,” check scope first — then whether the ops pack is installed for that agent set.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## From: Workflow & Studio — 7. Embedding guidance for host apps
|
|
92
|
+
|
|
93
|
+
When you build a host that embeds Memorix operator flows (or a thin custom panel beside Studio):
|
|
94
|
+
|
|
95
|
+
### Do
|
|
96
|
+
|
|
97
|
+
1. **Generate types** from `GET /api/openapi.json` — do not hand-roll divergent envelopes.
|
|
98
|
+
2. **Mirror Studio scope** — same org + `agentIds` headers on every call; surface them in your chrome the way Studio’s scope bar does.
|
|
99
|
+
3. **Mirror Studio IA** — Design / Operate / Explore (or a documented subset). Do not mix “edit metadata” and “edit subject workflow” into one undifferentiated screen without labels.
|
|
100
|
+
4. **Prefer operator widgets** — tables, forms, status chips, confirm dialogs. Hide raw JSON behind “Technical details.”
|
|
101
|
+
5. **Reuse workflow + data + relationships routes** — composition for subject views; `/api/workflow` for review assignment; relationship query for navigation.
|
|
102
|
+
6. **Respect revisions** — never “last write wins” without showing conflict.
|
|
103
|
+
|
|
104
|
+
### Don’t
|
|
105
|
+
|
|
106
|
+
| Anti-pattern | Why it fails |
|
|
107
|
+
|---|---|
|
|
108
|
+
| Point UI at Mongo / package internals | Bypasses directory, G4, abstracts, ledgers |
|
|
109
|
+
| Primary UI = raw JSON editor | Operators cannot review safely |
|
|
110
|
+
| Invent a second workflow store | Diverges from composition / KnowX review |
|
|
111
|
+
| Hard-code `fieldstone` / `neo` orgs | Violates isolation hard rules |
|
|
112
|
+
| Singular `agentId` header | Rejected |
|
|
113
|
+
| Auto-install intelligence proposals from a host button labeled “Apply” without confirm | Violates explicit metadata install |
|
|
114
|
+
|
|
115
|
+
### Minimal host sketch
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
const headers = {
|
|
119
|
+
"x-memorix-org-id": orgId, // g12ops…
|
|
120
|
+
"x-memorix-agent-ids": agentIds.join(","), // ["ops"]
|
|
121
|
+
"content-type": "application/json",
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
async function getWorkflow(id: string) {
|
|
125
|
+
const res = await fetch(`${serviceBase}/api/workflow?id=${encodeURIComponent(id)}`, {
|
|
126
|
+
headers,
|
|
127
|
+
});
|
|
128
|
+
if (!res.ok) throw new Error(`workflowGet ${res.status}`);
|
|
129
|
+
return res.json();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async function putWorkflow(body: {
|
|
133
|
+
id: string;
|
|
134
|
+
expectedRevision: string;
|
|
135
|
+
record: MemorixRecordV2;
|
|
136
|
+
}) {
|
|
137
|
+
const res = await fetch(`${serviceBase}/api/workflow`, {
|
|
138
|
+
method: "PUT",
|
|
139
|
+
headers,
|
|
140
|
+
body: JSON.stringify(body),
|
|
141
|
+
});
|
|
142
|
+
if (res.status === 409) {
|
|
143
|
+
// surface conflict UI — re-fetch and retry
|
|
144
|
+
}
|
|
145
|
+
if (!res.ok) throw new Error(`workflowPut ${res.status}`);
|
|
146
|
+
return res.json();
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
For KnowX human review, sequence:
|
|
151
|
+
|
|
152
|
+
1. `GET` assertion composition (knowx + workflow + confirmations).
|
|
153
|
+
2. Operator decides accept/reject in UI (not by editing provenance JSON).
|
|
154
|
+
3. Write confirmations sibling + revision-safe patch on knowx epistemic state (book `12`).
|
|
155
|
+
4. Optionally update workflow `state` via `PUT /api/workflow`.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Also see
|
|
160
|
+
|
|
161
|
+
- **Platform Overview** (`00-platform-overview`) — Surfaces, packages, hard rules, and where to start — developers and builders twins.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
_Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._
|