@principal-ai/subsystems-core 0.31.3 → 0.32.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.
@@ -12,7 +12,8 @@
12
12
  * Used by viewers and stores; not part of the portable standard.
13
13
  *
14
14
  * Ontology: construct = what a node is, framework + stereotype = which
15
- * framework pattern it plays, role = where it sits, process = where it runs.
15
+ * framework pattern it plays, role = where it sits, process = where it runs,
16
+ * proposed = not yet in source (design / migration placeholder).
16
17
  * `symbol` is the code identity; `name` is the display label.
17
18
  */
18
19
  /** What the node IS as a declaration. `module` is not an authored construct —
@@ -39,9 +40,21 @@ export type SubsystemFramework = string;
39
40
  * Empty when no framework pattern applies. Pair with `framework` when set.
40
41
  */
41
42
  export type SubsystemStereotype = string;
42
- /** How `from` relates to `to` on an edge. */
43
- export type SubsystemEdgeMechanism = 'imports' | 'imports_from' | 're_exports' | 'defines' | 'calls' | 'extends' | 'inherits' | 'implements' | 'mixes_in' | 'uses' | 'method' | 'references' | 'contains' | 'feeds' | 'produces' | 'writes' | 'reads' | 'watches' | 'registers-into';
44
- export type SubsystemCapture = 'edited' | 'analyzed' | 'referenced';
43
+ /**
44
+ * Topology relation type — structural / module / type claims between
45
+ * components. Belongs on `relations[]`, not on walkthrough hops.
46
+ */
47
+ export type SubsystemRelationType = 'imports' | 'imports_from' | 're_exports' | 'defines' | 'extends' | 'inherits' | 'implements' | 'mixes_in' | 'method' | 'references' | 'contains';
48
+ /**
49
+ * Walkthrough hop mechanism — runtime seams with a `file:line` site.
50
+ * Belongs on walkthrough steps; graph edges for these are derived.
51
+ */
52
+ export type SubsystemWalkthroughMechanism = 'calls' | 'uses' | 'feeds' | 'produces' | 'writes' | 'reads' | 'watches' | 'registers-into';
53
+ /**
54
+ * Union used by derived graph edges / styling (topology relationType or
55
+ * walkthrough hop mechanism).
56
+ */
57
+ export type SubsystemEdgeMechanism = SubsystemRelationType | SubsystemWalkthroughMechanism;
45
58
  export type SubsystemDeclarationProvenance = 'verified' | 'authored';
46
59
  export type SubsystemDeclTokenKind = 'keyword' | 'name' | 'member' | 'type' | 'punctuation' | 'string' | 'newline';
47
60
  export interface SubsystemDeclToken {
@@ -120,11 +133,46 @@ export interface SubsystemMethodDeclaration {
120
133
  parameters?: SubsystemParamInfo[];
121
134
  returnType?: string;
122
135
  }
136
+ /** One generic type parameter, e.g. `T` or `K extends keyof StudioMessages`. */
137
+ export interface SubsystemTypeParamInfo {
138
+ name: string;
139
+ /** Constraint written after `extends` (or language equivalent). */
140
+ constraint?: string;
141
+ }
142
+ /** A callable/function type: `(params) => returnType`. */
143
+ export interface SubsystemCallableTypeInfo {
144
+ parameters?: SubsystemParamInfo[];
145
+ returnType?: string;
146
+ }
147
+ /** One enum member, with its optional literal value. */
148
+ export interface SubsystemEnumMemberInfo {
149
+ name: string;
150
+ value?: string;
151
+ }
152
+ /**
153
+ * Type-family declaration (interface / type alias / enum). Structured buckets
154
+ * cover common shapes; `rhs` is the verbatim escape hatch when none fit.
155
+ */
123
156
  export interface SubsystemTypeDeclaration {
124
157
  kind: 'type';
125
158
  properties: SubsystemPropertyInfo[];
126
159
  usedBy: SubsystemReferenceInfo[];
127
160
  implementors: string[];
161
+ /** Generic type parameters, e.g. `<K extends keyof StudioMessages>`. */
162
+ generics?: SubsystemTypeParamInfo[];
163
+ /** Callable type — `(params) => returnType`. */
164
+ signature?: SubsystemCallableTypeInfo;
165
+ /** Enum members (name, optional literal value). */
166
+ enumMembers?: SubsystemEnumMemberInfo[];
167
+ /** Alias whose RHS is a plain reference, e.g. `ServerSessionRow[]`. */
168
+ aliasOf?: string;
169
+ /** Simple union of alternatives, e.g. `'started' | 'stopped'`. */
170
+ unionOf?: string[];
171
+ /**
172
+ * Verbatim RHS — escape hatch for shapes the structured fields can't
173
+ * express. Wins over every shape above when set.
174
+ */
175
+ rhs?: string;
128
176
  }
129
177
  export interface SubsystemModuleDeclaration {
130
178
  kind: 'module';
@@ -138,6 +186,11 @@ export interface SubsystemExternalDeclaration {
138
186
  }
139
187
  export interface SubsystemStoreDeclaration {
140
188
  kind: 'store';
189
+ /** Where retained state lives / who mediates access. Authored, never
190
+ * extracted: `memory` (process-lifetime RAM), `disk` (this process
191
+ * reads/writes files), or `external` (another system — db/service; carries
192
+ * no `process`). */
193
+ storage?: 'memory' | 'disk' | 'external';
141
194
  properties: SubsystemPropertyInfo[];
142
195
  }
143
196
  /** A single authored attribute on a custom entity — free-form key/value. */
@@ -168,6 +221,13 @@ export interface SubsystemComponent {
168
221
  purl: string;
169
222
  purpose?: string;
170
223
  role?: SubsystemComponentRole;
224
+ /**
225
+ * Design / migration placeholder — participates in edges and flows but is
226
+ * not a live source declaration yet. Verification skips source checks until
227
+ * promoted (`proposed` cleared, `file` + `symbol` filled). Orthogonal to
228
+ * `construct` (intended shape) and `role` (topology).
229
+ */
230
+ proposed?: boolean;
171
231
  /**
172
232
  * Framework that owns the stereotype (e.g. `react`, `nestjs`).
173
233
  * Orthogonal to `construct` — a React component is still `construct: function`.
@@ -192,7 +252,6 @@ export interface SubsystemComponent {
192
252
  */
193
253
  color?: string;
194
254
  layer?: number;
195
- capture?: SubsystemCapture;
196
255
  /** Structured declaration shape of the construct (params, members, …). */
197
256
  declaration?: SubsystemConstructDeclaration;
198
257
  declarationProvenance?: SubsystemDeclarationProvenance;
@@ -200,19 +259,35 @@ export interface SubsystemComponent {
200
259
  /** Location anchor (file/line/hash) — distinct from `declaration` (shape). */
201
260
  declarationRef?: SubsystemDeclarationRef;
202
261
  }
203
- /** A cross-component edge. */
204
- export interface SubsystemComponentEdge {
262
+ /** A topology relation between components (structural / module / type). */
263
+ export interface SubsystemRelation {
205
264
  id: string;
206
265
  /** Source component id. */
207
266
  from: string;
208
267
  /** Target component id (or external label). */
209
268
  to: string;
210
- mechanism: SubsystemEdgeMechanism;
269
+ relationType: SubsystemRelationType;
211
270
  /** Concrete file/symbol evidence (often purls). */
212
271
  refs?: string[];
213
272
  }
214
- export interface SubsystemThroughlineStep {
215
- edgeId: string;
273
+ /**
274
+ * Derived / display graph edge used by renderers. Built from `relations`
275
+ * and/or walkthrough hops — not authored as its own document field.
276
+ */
277
+ export interface SubsystemComponentEdge {
278
+ id: string;
279
+ from: string;
280
+ to: string;
281
+ mechanism: SubsystemEdgeMechanism;
282
+ refs?: string[];
283
+ }
284
+ export interface SubsystemWalkthroughStep {
285
+ /** Source component id. */
286
+ from: string;
287
+ /** Target component id. */
288
+ to: string;
289
+ /** Runtime seam label (Set B). */
290
+ mechanism: SubsystemWalkthroughMechanism;
216
291
  file: string;
217
292
  /** 1-based line within `file`. */
218
293
  line: number;
@@ -225,11 +300,11 @@ export interface SubsystemThroughlineStep {
225
300
  */
226
301
  annotation?: string;
227
302
  }
228
- /** Ordered execution story over existing edges (one per flow). */
229
- export interface SubsystemThroughline {
303
+ /** Ordered runtime walkthrough (one named behavior story). */
304
+ export interface SubsystemWalkthrough {
230
305
  id: string;
231
306
  title: string;
232
- steps: SubsystemThroughlineStep[];
307
+ steps: SubsystemWalkthroughStep[];
233
308
  }
234
309
  export interface SubsystemRepoRef {
235
310
  owner: string;
@@ -249,8 +324,10 @@ export interface SubsystemModelDocument {
249
324
  title: string;
250
325
  description?: string;
251
326
  components: SubsystemComponent[];
252
- edges: SubsystemComponentEdge[];
253
- throughlines?: SubsystemThroughline[];
327
+ /** Topology relations (structural / module / type). May be empty. */
328
+ relations: SubsystemRelation[];
329
+ /** Runtime walkthroughs (ordered hops with sites). */
330
+ walkthroughs?: SubsystemWalkthrough[];
254
331
  }
255
332
  /**
256
333
  * Host/machine fields layered onto a portable document for local use.
@@ -299,4 +376,14 @@ export declare function isSubsystemModelDocument(value: unknown): value is Subsy
299
376
  * share surface that must stay schema-clean.
300
377
  */
301
378
  export declare function toPortableDocument(doc: SubsystemModelDocument): SubsystemModelDocument;
379
+ /** Stable id for a derived graph edge from a relation or walkthrough hop. */
380
+ export declare function derivedGraphEdgeId(from: string, to: string, mechanism: SubsystemEdgeMechanism): string;
381
+ /**
382
+ * Build display edges for the graph canvas from topology relations and
383
+ * walkthrough hops (deduped by from/to/mechanism).
384
+ */
385
+ export declare function deriveGraphEdges(doc: {
386
+ relations?: SubsystemRelation[];
387
+ walkthroughs?: SubsystemWalkthrough[];
388
+ }): SubsystemComponentEdge[];
302
389
  //# sourceMappingURL=subsystem-model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"subsystem-model.d.ts","sourceRoot":"","sources":["../../src/types/subsystem-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;0CAE0C;AAC1C,MAAM,MAAM,kBAAkB,GAC1B,OAAO,GACP,UAAU,GACV,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,MAAM,GACN,OAAO,GACP,UAAU,GACV,eAAe,CAAC;AAEpB,oEAAoE;AACpE,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,SAAS,CAAC;AAEzD;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAExC;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEzC,6CAA6C;AAC7C,MAAM,MAAM,sBAAsB,GAC9B,SAAS,GACT,cAAc,GACd,YAAY,GACZ,SAAS,GACT,OAAO,GACP,SAAS,GACT,UAAU,GACV,YAAY,GACZ,UAAU,GACV,MAAM,GACN,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,OAAO,GACP,UAAU,GACV,QAAQ,GACR,OAAO,GACP,SAAS,GACT,gBAAgB,CAAC;AAErB,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,CAAC;AAEpE,MAAM,MAAM,8BAA8B,GAAG,UAAU,GAAG,UAAU,CAAC;AAErE,MAAM,MAAM,sBAAsB,GAC9B,SAAS,GACT,MAAM,GACN,QAAQ,GACR,MAAM,GACN,aAAa,GACb,QAAQ,GAC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AC7E,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,sBAAsB,GAChC,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE;IACpC,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACvC,GAAG,sBAAsB,EAAE,CA4B3B"}
@@ -13,11 +13,12 @@
13
13
  * Used by viewers and stores; not part of the portable standard.
14
14
  *
15
15
  * Ontology: construct = what a node is, framework + stereotype = which
16
- * framework pattern it plays, role = where it sits, process = where it runs.
16
+ * framework pattern it plays, role = where it sits, process = where it runs,
17
+ * proposed = not yet in source (design / migration placeholder).
17
18
  * `symbol` is the code identity; `name` is the display label.
18
19
  */
19
20
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.toPortableDocument = exports.isSubsystemModelDocument = void 0;
21
+ exports.deriveGraphEdges = exports.derivedGraphEdgeId = exports.toPortableDocument = exports.isSubsystemModelDocument = void 0;
21
22
  /**
22
23
  * Type guard: true when the value plausibly conforms to a portable
23
24
  * subsystem model. Shallow check — full validation belongs to the schema /
@@ -29,7 +30,7 @@ function isSubsystemModelDocument(value) {
29
30
  const v = value;
30
31
  return (typeof v.title === 'string' &&
31
32
  Array.isArray(v.components) &&
32
- Array.isArray(v.edges));
33
+ Array.isArray(v.relations));
33
34
  }
34
35
  exports.isSubsystemModelDocument = isSubsystemModelDocument;
35
36
  /**
@@ -41,15 +42,54 @@ function toPortableDocument(doc) {
41
42
  const out = {
42
43
  title: doc.title,
43
44
  components: doc.components,
44
- edges: doc.edges,
45
+ relations: doc.relations,
45
46
  };
46
47
  if (doc.$schema)
47
48
  out.$schema = doc.$schema;
48
49
  if (doc.description)
49
50
  out.description = doc.description;
50
- if (doc.throughlines)
51
- out.throughlines = doc.throughlines;
51
+ if (doc.walkthroughs)
52
+ out.walkthroughs = doc.walkthroughs;
52
53
  return out;
53
54
  }
54
55
  exports.toPortableDocument = toPortableDocument;
56
+ /** Stable id for a derived graph edge from a relation or walkthrough hop. */
57
+ function derivedGraphEdgeId(from, to, mechanism) {
58
+ return `${from}--${mechanism}-->${to}`;
59
+ }
60
+ exports.derivedGraphEdgeId = derivedGraphEdgeId;
61
+ /**
62
+ * Build display edges for the graph canvas from topology relations and
63
+ * walkthrough hops (deduped by from/to/mechanism).
64
+ */
65
+ function deriveGraphEdges(doc) {
66
+ const byId = new Map();
67
+ for (const r of doc.relations ?? []) {
68
+ const id = r.id || derivedGraphEdgeId(r.from, r.to, r.relationType);
69
+ if (!byId.has(id)) {
70
+ byId.set(id, {
71
+ id,
72
+ from: r.from,
73
+ to: r.to,
74
+ mechanism: r.relationType,
75
+ refs: r.refs,
76
+ });
77
+ }
78
+ }
79
+ for (const w of doc.walkthroughs ?? []) {
80
+ for (const step of w.steps) {
81
+ const id = derivedGraphEdgeId(step.from, step.to, step.mechanism);
82
+ if (!byId.has(id)) {
83
+ byId.set(id, {
84
+ id,
85
+ from: step.from,
86
+ to: step.to,
87
+ mechanism: step.mechanism,
88
+ });
89
+ }
90
+ }
91
+ }
92
+ return [...byId.values()];
93
+ }
94
+ exports.deriveGraphEdges = deriveGraphEdges;
55
95
  //# sourceMappingURL=subsystem-model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subsystem-model.js","sourceRoot":"","sources":["../../src/types/subsystem-model.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAkWH;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,KAAc;IACrD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,CAAC,GAAG,KAIT,CAAC;IACF,OAAO,CACL,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ;QAC3B,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;QAC3B,KAAK,CA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AI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAClE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;gBACjB,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE;oBACX,EAAE;oBACF,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,EAAE,EAAE,IAAI,CAAC,EAAE;oBACX,SAAS,EAAE,IAAI,CAAC,SAAS;iBAC1B,CAAC,CAAC;aACJ;SACF;KACF;IACD,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;AAC5B,CAAC;AA/BD,4CA+BC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principal-ai/subsystems-core",
3
- "version": "0.31.3",
3
+ "version": "0.32.0",
4
4
  "description": "Subsystem model types and agent-session tooling for Principal AI",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -2,12 +2,12 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://principal-ai.dev/schemas/subsystem-model.schema.json",
4
4
  "title": "Subsystem Model",
5
- "description": "Portable subsystem model — the shareable standard. Construct-tagged components (nodes) plus typed edges describing one subsystem of a codebase. Ontology: construct = what a node is, framework + stereotype = which framework pattern it plays, role = where it sits, process = where it runs. Symbol is the code identity; name is the display label (often derived from symbol). Host-only fields (local path binding, provenance, store ids, verification) are NOT part of this document; they belong on a hydrated envelope around it.",
5
+ "description": "Portable subsystem model — the shareable standard. Construct-tagged components (nodes) plus topology relations and/or runtime walkthroughs describing one subsystem of a codebase. Ontology: construct = what a node is, framework + stereotype = which framework pattern it plays, role = where it sits, process = where it runs. Symbol is the code identity; name is the display label (often derived from symbol). Host-only fields (local path binding, provenance, store ids, verification) are NOT part of this document; they belong on a hydrated envelope around it.",
6
6
  "type": "object",
7
7
  "required": [
8
8
  "title",
9
9
  "components",
10
- "edges"
10
+ "relations"
11
11
  ],
12
12
  "additionalProperties": false,
13
13
  "properties": {
@@ -31,18 +31,18 @@
31
31
  "$ref": "#/$defs/component"
32
32
  }
33
33
  },
34
- "edges": {
34
+ "relations": {
35
35
  "type": "array",
36
- "description": "Typed interactions between components. `from` / `to` reference component `id`s.",
36
+ "description": "Topology relations (structural / module / type). `from` / `to` reference component `id`s. Runtime seams belong on walkthrough steps, not here.",
37
37
  "items": {
38
- "$ref": "#/$defs/edge"
38
+ "$ref": "#/$defs/relation"
39
39
  }
40
40
  },
41
- "throughlines": {
41
+ "walkthroughs": {
42
42
  "type": "array",
43
- "description": "Ordered execution stories over existing edges (one throughline per flow). Each step names an edge id, the concrete file:line where that seam fires, and an optional frame symbol.",
43
+ "description": "Ordered runtime walkthroughs (one per named behavior). Each step names from/to/mechanism and the concrete file:line where that seam fires.",
44
44
  "items": {
45
- "$ref": "#/$defs/throughline"
45
+ "$ref": "#/$defs/walkthrough"
46
46
  }
47
47
  }
48
48
  },
@@ -70,6 +70,10 @@
70
70
  "service"
71
71
  ]
72
72
  },
73
+ "proposed": {
74
+ "type": "boolean",
75
+ "description": "Design / migration placeholder — not a live source declaration yet. Verification skips source checks until promoted. Keep a real construct for the intended shape."
76
+ },
73
77
  "framework": {
74
78
  "type": "string",
75
79
  "minLength": 1,
@@ -80,15 +84,6 @@
80
84
  "minLength": 1,
81
85
  "description": "Framework-level pattern stamped on a language construct (open string). Examples: component, hook, middleware, controller, guard. Prefer this over inventing framework-specific constructs. Pair with framework when set."
82
86
  },
83
- "capture": {
84
- "type": "string",
85
- "description": "How the authoring session occupied this component.",
86
- "enum": [
87
- "edited",
88
- "analyzed",
89
- "referenced"
90
- ]
91
- },
92
87
  "declarationProvenance": {
93
88
  "type": "string",
94
89
  "description": "Where `declaration` came from. `verified` is reserved for tool-extracted data; hand-authored declarations must be `authored` (also the default when declaration is present without provenance).",
@@ -97,23 +92,29 @@
97
92
  "authored"
98
93
  ]
99
94
  },
100
- "mechanism": {
95
+ "relationType": {
101
96
  "type": "string",
102
- "description": "How `from` relates to `to`. Pick the closest label; put specifics in `refs`. `uses` = general dependency; `feeds` = data-flow into a processor; `produces` = emits an output; `references` = type/symbol reference that is not a call; `writes`/`reads`/`watches` = retained-state interactions.",
97
+ "description": "Topology relation type — structural / module / type claim between components.",
103
98
  "enum": [
104
99
  "imports",
105
100
  "imports_from",
106
101
  "re_exports",
107
102
  "defines",
108
- "calls",
109
103
  "extends",
110
104
  "inherits",
111
105
  "implements",
112
106
  "mixes_in",
113
- "uses",
114
107
  "method",
115
108
  "references",
116
- "contains",
109
+ "contains"
110
+ ]
111
+ },
112
+ "mechanism": {
113
+ "type": "string",
114
+ "description": "Walkthrough hop mechanism — how `from` relates to `to` at a runtime site. `uses` = general dependency; `feeds` = data-flow into a processor; `produces` = emits an output; `writes`/`reads`/`watches` = retained-state interactions.",
115
+ "enum": [
116
+ "calls",
117
+ "uses",
117
118
  "feeds",
118
119
  "produces",
119
120
  "writes",
@@ -136,7 +137,7 @@
136
137
  "id": {
137
138
  "type": "string",
138
139
  "minLength": 1,
139
- "description": "Stable unique id. Referenced by edge `from` / `to`; never rename on update."
140
+ "description": "Stable unique id. Referenced by relation / walkthrough `from` / `to`; never rename on update."
140
141
  },
141
142
  "name": {
142
143
  "type": "string",
@@ -174,6 +175,9 @@
174
175
  "role": {
175
176
  "$ref": "#/$defs/role"
176
177
  },
178
+ "proposed": {
179
+ "$ref": "#/$defs/proposed"
180
+ },
177
181
  "framework": {
178
182
  "$ref": "#/$defs/framework"
179
183
  },
@@ -188,9 +192,6 @@
188
192
  "type": "integer",
189
193
  "description": "Semantic layout layer/phase (lower = closer to entry). When set, layout places the component in this layer for a left-to-right pipeline."
190
194
  },
191
- "capture": {
192
- "$ref": "#/$defs/capture"
193
- },
194
195
  "declaration": {
195
196
  "$ref": "#/$defs/constructDeclaration",
196
197
  "description": "Structured declaration shape of the construct for the click panel (parameters, members, etc.). Hand-author when highlighting specific inputs/outputs; set `declarationProvenance` accordingly."
@@ -211,20 +212,20 @@
211
212
  }
212
213
  }
213
214
  },
214
- "edge": {
215
+ "relation": {
215
216
  "type": "object",
216
217
  "required": [
217
218
  "id",
218
219
  "from",
219
220
  "to",
220
- "mechanism"
221
+ "relationType"
221
222
  ],
222
223
  "additionalProperties": false,
223
224
  "properties": {
224
225
  "id": {
225
226
  "type": "string",
226
227
  "minLength": 1,
227
- "description": "Stable unique edge id. Referenced by throughline steps."
228
+ "description": "Stable unique relation id."
228
229
  },
229
230
  "from": {
230
231
  "type": "string",
@@ -236,12 +237,12 @@
236
237
  "minLength": 1,
237
238
  "description": "Target component `id` (or external target label)."
238
239
  },
239
- "mechanism": {
240
- "$ref": "#/$defs/mechanism"
240
+ "relationType": {
241
+ "$ref": "#/$defs/relationType"
241
242
  },
242
243
  "refs": {
243
244
  "type": "array",
244
- "description": "Concrete file/symbol evidence backing the edge (often purl refs).",
245
+ "description": "Concrete file/symbol evidence backing the relation (often purl refs).",
245
246
  "items": {
246
247
  "type": "string",
247
248
  "minLength": 1
@@ -249,24 +250,34 @@
249
250
  }
250
251
  }
251
252
  },
252
- "throughlineStep": {
253
+ "walkthroughStep": {
253
254
  "type": "object",
254
255
  "required": [
255
- "edgeId",
256
+ "from",
257
+ "to",
258
+ "mechanism",
256
259
  "file",
257
260
  "line"
258
261
  ],
259
262
  "additionalProperties": false,
260
263
  "properties": {
261
- "edgeId": {
264
+ "from": {
262
265
  "type": "string",
263
266
  "minLength": 1,
264
- "description": "Id of an existing edge this hop traverses."
267
+ "description": "Source component `id`."
268
+ },
269
+ "to": {
270
+ "type": "string",
271
+ "minLength": 1,
272
+ "description": "Target component `id`."
273
+ },
274
+ "mechanism": {
275
+ "$ref": "#/$defs/mechanism"
265
276
  },
266
277
  "file": {
267
278
  "type": "string",
268
279
  "minLength": 1,
269
- "description": "Repo-root-relative path where the edge fires for this flow."
280
+ "description": "Repo-root-relative path where the seam fires for this walkthrough."
270
281
  },
271
282
  "line": {
272
283
  "type": "integer",
@@ -285,7 +296,7 @@
285
296
  }
286
297
  }
287
298
  },
288
- "throughline": {
299
+ "walkthrough": {
289
300
  "type": "object",
290
301
  "required": [
291
302
  "id",
@@ -297,18 +308,18 @@
297
308
  "id": {
298
309
  "type": "string",
299
310
  "minLength": 1,
300
- "description": "Stable unique throughline id."
311
+ "description": "Stable unique walkthrough id."
301
312
  },
302
313
  "title": {
303
314
  "type": "string",
304
315
  "minLength": 1,
305
- "description": "Flow name (e.g. save flow, load flow)."
316
+ "description": "Walkthrough name (e.g. save, load, refresh)."
306
317
  },
307
318
  "steps": {
308
319
  "type": "array",
309
320
  "description": "Ordered hops; array order is execution order.",
310
321
  "items": {
311
- "$ref": "#/$defs/throughlineStep"
322
+ "$ref": "#/$defs/walkthroughStep"
312
323
  }
313
324
  }
314
325
  }
@@ -671,6 +682,35 @@
671
682
  }
672
683
  }
673
684
  },
685
+ "typeParamInfo": {
686
+ "type": "object",
687
+ "required": ["name"],
688
+ "additionalProperties": false,
689
+ "properties": {
690
+ "name": { "type": "string" },
691
+ "constraint": { "type": "string" }
692
+ }
693
+ },
694
+ "callableTypeInfo": {
695
+ "type": "object",
696
+ "additionalProperties": false,
697
+ "properties": {
698
+ "parameters": {
699
+ "type": "array",
700
+ "items": { "$ref": "#/$defs/paramInfo" }
701
+ },
702
+ "returnType": { "type": "string" }
703
+ }
704
+ },
705
+ "enumMemberInfo": {
706
+ "type": "object",
707
+ "required": ["name"],
708
+ "additionalProperties": false,
709
+ "properties": {
710
+ "name": { "type": "string" },
711
+ "value": { "type": "string" }
712
+ }
713
+ },
674
714
  "typeDeclaration": {
675
715
  "type": "object",
676
716
  "required": [
@@ -680,6 +720,7 @@
680
720
  "implementors"
681
721
  ],
682
722
  "additionalProperties": false,
723
+ "description": "Type-family declaration (interface / type alias / enum). Prefer structured buckets; use `rhs` when none fit.",
683
724
  "properties": {
684
725
  "kind": {
685
726
  "const": "type"
@@ -701,6 +742,24 @@
701
742
  "items": {
702
743
  "type": "string"
703
744
  }
745
+ },
746
+ "generics": {
747
+ "type": "array",
748
+ "items": { "$ref": "#/$defs/typeParamInfo" }
749
+ },
750
+ "signature": { "$ref": "#/$defs/callableTypeInfo" },
751
+ "enumMembers": {
752
+ "type": "array",
753
+ "items": { "$ref": "#/$defs/enumMemberInfo" }
754
+ },
755
+ "aliasOf": { "type": "string" },
756
+ "unionOf": {
757
+ "type": "array",
758
+ "items": { "type": "string" }
759
+ },
760
+ "rhs": {
761
+ "type": "string",
762
+ "description": "Verbatim RHS escape hatch; wins over structured buckets when set."
704
763
  }
705
764
  }
706
765
  },
@@ -12,7 +12,8 @@
12
12
  * Used by viewers and stores; not part of the portable standard.
13
13
  *
14
14
  * Ontology: construct = what a node is, framework + stereotype = which
15
- * framework pattern it plays, role = where it sits, process = where it runs.
15
+ * framework pattern it plays, role = where it sits, process = where it runs,
16
+ * proposed = not yet in source (design / migration placeholder).
16
17
  * `symbol` is the code identity; `name` is the display label.
17
18
  */
18
19
 
@@ -54,21 +55,30 @@ export type SubsystemFramework = string;
54
55
  */
55
56
  export type SubsystemStereotype = string;
56
57
 
57
- /** How `from` relates to `to` on an edge. */
58
- export type SubsystemEdgeMechanism =
58
+ /**
59
+ * Topology relation type — structural / module / type claims between
60
+ * components. Belongs on `relations[]`, not on walkthrough hops.
61
+ */
62
+ export type SubsystemRelationType =
59
63
  | 'imports'
60
64
  | 'imports_from'
61
65
  | 're_exports'
62
66
  | 'defines'
63
- | 'calls'
64
67
  | 'extends'
65
68
  | 'inherits'
66
69
  | 'implements'
67
70
  | 'mixes_in'
68
- | 'uses'
69
71
  | 'method'
70
72
  | 'references'
71
- | 'contains'
73
+ | 'contains';
74
+
75
+ /**
76
+ * Walkthrough hop mechanism — runtime seams with a `file:line` site.
77
+ * Belongs on walkthrough steps; graph edges for these are derived.
78
+ */
79
+ export type SubsystemWalkthroughMechanism =
80
+ | 'calls'
81
+ | 'uses'
72
82
  | 'feeds'
73
83
  | 'produces'
74
84
  | 'writes'
@@ -76,7 +86,13 @@ export type SubsystemEdgeMechanism =
76
86
  | 'watches'
77
87
  | 'registers-into';
78
88
 
79
- export type SubsystemCapture = 'edited' | 'analyzed' | 'referenced';
89
+ /**
90
+ * Union used by derived graph edges / styling (topology relationType or
91
+ * walkthrough hop mechanism).
92
+ */
93
+ export type SubsystemEdgeMechanism =
94
+ | SubsystemRelationType
95
+ | SubsystemWalkthroughMechanism;
80
96
 
81
97
  export type SubsystemDeclarationProvenance = 'verified' | 'authored';
82
98
 
@@ -176,11 +192,49 @@ export interface SubsystemMethodDeclaration {
176
192
  returnType?: string;
177
193
  }
178
194
 
195
+ /** One generic type parameter, e.g. `T` or `K extends keyof StudioMessages`. */
196
+ export interface SubsystemTypeParamInfo {
197
+ name: string;
198
+ /** Constraint written after `extends` (or language equivalent). */
199
+ constraint?: string;
200
+ }
201
+
202
+ /** A callable/function type: `(params) => returnType`. */
203
+ export interface SubsystemCallableTypeInfo {
204
+ parameters?: SubsystemParamInfo[];
205
+ returnType?: string;
206
+ }
207
+
208
+ /** One enum member, with its optional literal value. */
209
+ export interface SubsystemEnumMemberInfo {
210
+ name: string;
211
+ value?: string;
212
+ }
213
+
214
+ /**
215
+ * Type-family declaration (interface / type alias / enum). Structured buckets
216
+ * cover common shapes; `rhs` is the verbatim escape hatch when none fit.
217
+ */
179
218
  export interface SubsystemTypeDeclaration {
180
219
  kind: 'type';
181
220
  properties: SubsystemPropertyInfo[];
182
221
  usedBy: SubsystemReferenceInfo[];
183
222
  implementors: string[];
223
+ /** Generic type parameters, e.g. `<K extends keyof StudioMessages>`. */
224
+ generics?: SubsystemTypeParamInfo[];
225
+ /** Callable type — `(params) => returnType`. */
226
+ signature?: SubsystemCallableTypeInfo;
227
+ /** Enum members (name, optional literal value). */
228
+ enumMembers?: SubsystemEnumMemberInfo[];
229
+ /** Alias whose RHS is a plain reference, e.g. `ServerSessionRow[]`. */
230
+ aliasOf?: string;
231
+ /** Simple union of alternatives, e.g. `'started' | 'stopped'`. */
232
+ unionOf?: string[];
233
+ /**
234
+ * Verbatim RHS — escape hatch for shapes the structured fields can't
235
+ * express. Wins over every shape above when set.
236
+ */
237
+ rhs?: string;
184
238
  }
185
239
 
186
240
  export interface SubsystemModuleDeclaration {
@@ -197,6 +251,11 @@ export interface SubsystemExternalDeclaration {
197
251
 
198
252
  export interface SubsystemStoreDeclaration {
199
253
  kind: 'store';
254
+ /** Where retained state lives / who mediates access. Authored, never
255
+ * extracted: `memory` (process-lifetime RAM), `disk` (this process
256
+ * reads/writes files), or `external` (another system — db/service; carries
257
+ * no `process`). */
258
+ storage?: 'memory' | 'disk' | 'external';
200
259
  properties: SubsystemPropertyInfo[];
201
260
  }
202
261
 
@@ -239,6 +298,13 @@ export interface SubsystemComponent {
239
298
  purl: string;
240
299
  purpose?: string;
241
300
  role?: SubsystemComponentRole;
301
+ /**
302
+ * Design / migration placeholder — participates in edges and flows but is
303
+ * not a live source declaration yet. Verification skips source checks until
304
+ * promoted (`proposed` cleared, `file` + `symbol` filled). Orthogonal to
305
+ * `construct` (intended shape) and `role` (topology).
306
+ */
307
+ proposed?: boolean;
242
308
  /**
243
309
  * Framework that owns the stereotype (e.g. `react`, `nestjs`).
244
310
  * Orthogonal to `construct` — a React component is still `construct: function`.
@@ -263,7 +329,6 @@ export interface SubsystemComponent {
263
329
  */
264
330
  color?: string;
265
331
  layer?: number;
266
- capture?: SubsystemCapture;
267
332
  /** Structured declaration shape of the construct (params, members, …). */
268
333
  declaration?: SubsystemConstructDeclaration;
269
334
  declarationProvenance?: SubsystemDeclarationProvenance;
@@ -272,20 +337,37 @@ export interface SubsystemComponent {
272
337
  declarationRef?: SubsystemDeclarationRef;
273
338
  }
274
339
 
275
- /** A cross-component edge. */
276
- export interface SubsystemComponentEdge {
340
+ /** A topology relation between components (structural / module / type). */
341
+ export interface SubsystemRelation {
277
342
  id: string;
278
343
  /** Source component id. */
279
344
  from: string;
280
345
  /** Target component id (or external label). */
281
346
  to: string;
282
- mechanism: SubsystemEdgeMechanism;
347
+ relationType: SubsystemRelationType;
283
348
  /** Concrete file/symbol evidence (often purls). */
284
349
  refs?: string[];
285
350
  }
286
351
 
287
- export interface SubsystemThroughlineStep {
288
- edgeId: string;
352
+ /**
353
+ * Derived / display graph edge used by renderers. Built from `relations`
354
+ * and/or walkthrough hops — not authored as its own document field.
355
+ */
356
+ export interface SubsystemComponentEdge {
357
+ id: string;
358
+ from: string;
359
+ to: string;
360
+ mechanism: SubsystemEdgeMechanism;
361
+ refs?: string[];
362
+ }
363
+
364
+ export interface SubsystemWalkthroughStep {
365
+ /** Source component id. */
366
+ from: string;
367
+ /** Target component id. */
368
+ to: string;
369
+ /** Runtime seam label (Set B). */
370
+ mechanism: SubsystemWalkthroughMechanism;
289
371
  file: string;
290
372
  /** 1-based line within `file`. */
291
373
  line: number;
@@ -299,11 +381,11 @@ export interface SubsystemThroughlineStep {
299
381
  annotation?: string;
300
382
  }
301
383
 
302
- /** Ordered execution story over existing edges (one per flow). */
303
- export interface SubsystemThroughline {
384
+ /** Ordered runtime walkthrough (one named behavior story). */
385
+ export interface SubsystemWalkthrough {
304
386
  id: string;
305
387
  title: string;
306
- steps: SubsystemThroughlineStep[];
388
+ steps: SubsystemWalkthroughStep[];
307
389
  }
308
390
 
309
391
  export interface SubsystemRepoRef {
@@ -326,8 +408,10 @@ export interface SubsystemModelDocument {
326
408
  title: string;
327
409
  description?: string;
328
410
  components: SubsystemComponent[];
329
- edges: SubsystemComponentEdge[];
330
- throughlines?: SubsystemThroughline[];
411
+ /** Topology relations (structural / module / type). May be empty. */
412
+ relations: SubsystemRelation[];
413
+ /** Runtime walkthroughs (ordered hops with sites). */
414
+ walkthroughs?: SubsystemWalkthrough[];
331
415
  }
332
416
 
333
417
  /**
@@ -378,12 +462,12 @@ export function isSubsystemModelDocument(value: unknown): value is SubsystemMode
378
462
  const v = value as {
379
463
  title?: unknown;
380
464
  components?: unknown;
381
- edges?: unknown;
465
+ relations?: unknown;
382
466
  };
383
467
  return (
384
468
  typeof v.title === 'string' &&
385
469
  Array.isArray(v.components) &&
386
- Array.isArray(v.edges)
470
+ Array.isArray(v.relations)
387
471
  );
388
472
  }
389
473
 
@@ -398,10 +482,56 @@ export function toPortableDocument(
398
482
  const out: SubsystemModelDocument = {
399
483
  title: doc.title,
400
484
  components: doc.components,
401
- edges: doc.edges,
485
+ relations: doc.relations,
402
486
  };
403
487
  if (doc.$schema) out.$schema = doc.$schema;
404
488
  if (doc.description) out.description = doc.description;
405
- if (doc.throughlines) out.throughlines = doc.throughlines;
489
+ if (doc.walkthroughs) out.walkthroughs = doc.walkthroughs;
406
490
  return out;
407
491
  }
492
+
493
+ /** Stable id for a derived graph edge from a relation or walkthrough hop. */
494
+ export function derivedGraphEdgeId(
495
+ from: string,
496
+ to: string,
497
+ mechanism: SubsystemEdgeMechanism,
498
+ ): string {
499
+ return `${from}--${mechanism}-->${to}`;
500
+ }
501
+
502
+ /**
503
+ * Build display edges for the graph canvas from topology relations and
504
+ * walkthrough hops (deduped by from/to/mechanism).
505
+ */
506
+ export function deriveGraphEdges(doc: {
507
+ relations?: SubsystemRelation[];
508
+ walkthroughs?: SubsystemWalkthrough[];
509
+ }): SubsystemComponentEdge[] {
510
+ const byId = new Map<string, SubsystemComponentEdge>();
511
+ for (const r of doc.relations ?? []) {
512
+ const id = r.id || derivedGraphEdgeId(r.from, r.to, r.relationType);
513
+ if (!byId.has(id)) {
514
+ byId.set(id, {
515
+ id,
516
+ from: r.from,
517
+ to: r.to,
518
+ mechanism: r.relationType,
519
+ refs: r.refs,
520
+ });
521
+ }
522
+ }
523
+ for (const w of doc.walkthroughs ?? []) {
524
+ for (const step of w.steps) {
525
+ const id = derivedGraphEdgeId(step.from, step.to, step.mechanism);
526
+ if (!byId.has(id)) {
527
+ byId.set(id, {
528
+ id,
529
+ from: step.from,
530
+ to: step.to,
531
+ mechanism: step.mechanism,
532
+ });
533
+ }
534
+ }
535
+ }
536
+ return [...byId.values()];
537
+ }