@principal-ai/subsystems-core 0.43.0 → 0.44.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/storage/topicStore.d.ts +11 -15
- package/dist/storage/topicStore.d.ts.map +1 -1
- package/dist/storage/topicStore.js +8 -56
- package/dist/storage/topicStore.js.map +1 -1
- package/dist/types/subsystem-model.d.ts +21 -21
- package/dist/types/subsystem-model.d.ts.map +1 -1
- package/dist/types/subsystem-model.js +5 -5
- package/dist/types/subsystem-model.js.map +1 -1
- package/dist/validation.d.ts +2 -2
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +13 -13
- package/dist/validation.js.map +1 -1
- package/package.json +2 -1
- package/schemas/subsystem-model.schema.json +15 -15
- package/src/storage/topicStore.test.ts +0 -19
- package/src/storage/topicStore.ts +11 -63
- package/src/types/subsystem-model.ts +23 -23
- package/src/validation.test.ts +10 -10
- package/src/validation.ts +15 -15
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* File-per-topic store under `~/.principal/topics/`.
|
|
3
3
|
*
|
|
4
|
-
* Layout (
|
|
5
|
-
*
|
|
4
|
+
* Layout (file-per-entity, so topics become locally greppable and an agent can
|
|
5
|
+
* read one directly):
|
|
6
6
|
*
|
|
7
7
|
* ~/.principal/topics/
|
|
8
8
|
* _index.json private, rebuildable manifest (entries[])
|
|
9
9
|
* <id>.json one pretty-printed DraftTopic per file
|
|
10
10
|
*
|
|
11
|
-
* Topics are the *least* repo-bound artifact (a bundle
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Topics are the *least* repo-bound artifact (a bundle spanning many repos), so
|
|
12
|
+
* they are stored flat by id rather than bucketed by repo Purl. No purl, no
|
|
13
|
+
* buckets, no `node:os`/Purl dependency beyond `homedir()`.
|
|
14
14
|
*
|
|
15
15
|
* The `_index.json` manifest is store-private and rebuildable: it is rebuilt by
|
|
16
16
|
* scanning the directory whenever it is missing or unparseable. It exists only
|
|
17
17
|
* to make `getTopics()` / `list()` cheap (no per-file read for listing).
|
|
18
18
|
*
|
|
19
|
-
* There is intentionally NO eviction cap.
|
|
20
|
-
*
|
|
21
|
-
* dropped, so the cap is deliberately not carried over.
|
|
19
|
+
* There is intentionally NO eviction cap. Topics are few, user-curated, and must
|
|
20
|
+
* never be silently dropped.
|
|
22
21
|
*
|
|
23
22
|
* Migration from the legacy single-blob `~/.alexandria/topics.json` is explicit
|
|
24
23
|
* (`migrateFromLegacyBlob`) — it is never run automatically on load; the desktop
|
|
@@ -66,8 +65,9 @@ export interface MigrationResult {
|
|
|
66
65
|
}
|
|
67
66
|
/**
|
|
68
67
|
* Fields a caller may set when updating a topic. `id`, `createdAt`, and
|
|
69
|
-
* `trailIds` are
|
|
70
|
-
* `trailIds
|
|
68
|
+
* `trailIds` are immutable here — `id`/`createdAt` are set once at creation, and
|
|
69
|
+
* `trailIds` is foreign-keyed membership owned by the desktop's trail store, so
|
|
70
|
+
* a topic update here can never rewrite it.
|
|
71
71
|
*/
|
|
72
72
|
export type TopicUpdate = Partial<Pick<DraftTopic, 'title' | 'description' | 'status' | 'createdBy' | 'assets' | 'repos'>>;
|
|
73
73
|
/**
|
|
@@ -104,15 +104,11 @@ export declare class TopicStore {
|
|
|
104
104
|
createTopic(input: TopicCreate): Promise<DraftTopic>;
|
|
105
105
|
updateTopic(id: string, updates: TopicUpdate): Promise<DraftTopic>;
|
|
106
106
|
deleteTopic(id: string): Promise<boolean>;
|
|
107
|
-
addTrailToTopic(topicId: string, trailId: string): Promise<DraftTopic>;
|
|
108
|
-
removeTrailFromTopic(topicId: string, trailId: string): Promise<DraftTopic>;
|
|
109
|
-
reorderTopicTrails(topicId: string, trailIds: string[]): Promise<DraftTopic>;
|
|
110
|
-
getTopicsForTrail(trailId: string): Promise<DraftTopic[]>;
|
|
111
107
|
/**
|
|
112
108
|
* One-shot migration from the legacy single-blob `~/.alexandria/topics.json`
|
|
113
109
|
* to file-per-topic. Reads the blob's `topics[]`, writes each as
|
|
114
110
|
* `<id>.json`, rebuilds the index, then renames the blob to `<blob>.bak` so
|
|
115
|
-
* a re-run is a no-op
|
|
111
|
+
* a re-run is a no-op.
|
|
116
112
|
*
|
|
117
113
|
* Explicit by design — the desktop calls this from a Settings action, never
|
|
118
114
|
* on load. Idempotent: once the blob is `.bak`'d, subsequent calls report
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topicStore.d.ts","sourceRoot":"","sources":["../../src/storage/topicStore.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"topicStore.d.ts","sourceRoot":"","sources":["../../src/storage/topicStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAaH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE7D,gEAAgE;AAChE,eAAO,MAAM,aAAa,QAAgC,CAAC;AAC3D,gCAAgC;AAChC,eAAO,MAAM,UAAU,QAAgC,CAAC;AACxD,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,QAAgD,CAAC;AAKhF;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IACtD,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;CAClB;AA6CD,MAAM,WAAW,eAAe;IAC9B,4DAA4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AAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAa/C;;;;;;;;;;OAUG;IACG,qBAAqB,IAAI,OAAO,CAAC,eAAe,CAAC;YA8DzC,QAAQ;YAQR,YAAY;IAQ1B,4EAA4E;YAC9D,UAAU;YAaV,SAAS;YAUT,cAAc;YAWd,UAAU;YASV,SAAS;IAkBvB,2EAA2E;YAC7D,YAAY;IA4B1B,OAAO,CAAC,YAAY;CAWrB"}
|
|
@@ -2,24 +2,23 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* File-per-topic store under `~/.principal/topics/`.
|
|
4
4
|
*
|
|
5
|
-
* Layout (
|
|
6
|
-
*
|
|
5
|
+
* Layout (file-per-entity, so topics become locally greppable and an agent can
|
|
6
|
+
* read one directly):
|
|
7
7
|
*
|
|
8
8
|
* ~/.principal/topics/
|
|
9
9
|
* _index.json private, rebuildable manifest (entries[])
|
|
10
10
|
* <id>.json one pretty-printed DraftTopic per file
|
|
11
11
|
*
|
|
12
|
-
* Topics are the *least* repo-bound artifact (a bundle
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* Topics are the *least* repo-bound artifact (a bundle spanning many repos), so
|
|
13
|
+
* they are stored flat by id rather than bucketed by repo Purl. No purl, no
|
|
14
|
+
* buckets, no `node:os`/Purl dependency beyond `homedir()`.
|
|
15
15
|
*
|
|
16
16
|
* The `_index.json` manifest is store-private and rebuildable: it is rebuilt by
|
|
17
17
|
* scanning the directory whenever it is missing or unparseable. It exists only
|
|
18
18
|
* to make `getTopics()` / `list()` cheap (no per-file read for listing).
|
|
19
19
|
*
|
|
20
|
-
* There is intentionally NO eviction cap.
|
|
21
|
-
*
|
|
22
|
-
* dropped, so the cap is deliberately not carried over.
|
|
20
|
+
* There is intentionally NO eviction cap. Topics are few, user-curated, and must
|
|
21
|
+
* never be silently dropped.
|
|
23
22
|
*
|
|
24
23
|
* Migration from the legacy single-blob `~/.alexandria/topics.json` is explicit
|
|
25
24
|
* (`migrateFromLegacyBlob`) — it is never run automatically on load; the desktop
|
|
@@ -145,59 +144,12 @@ class TopicStore {
|
|
|
145
144
|
await this.persistIndex();
|
|
146
145
|
return true;
|
|
147
146
|
}
|
|
148
|
-
// ===== Trail membership =====
|
|
149
|
-
async addTrailToTopic(topicId, trailId) {
|
|
150
|
-
const idx = await this.getIndex();
|
|
151
|
-
const topic = await this.requireTopic(idx, topicId);
|
|
152
|
-
if (topic.trailIds.includes(trailId))
|
|
153
|
-
return topic;
|
|
154
|
-
const next = {
|
|
155
|
-
...topic,
|
|
156
|
-
trailIds: [...topic.trailIds, trailId],
|
|
157
|
-
updatedAt: nowIso(),
|
|
158
|
-
};
|
|
159
|
-
await this.writeTopic(next, idx);
|
|
160
|
-
return next;
|
|
161
|
-
}
|
|
162
|
-
async removeTrailFromTopic(topicId, trailId) {
|
|
163
|
-
const idx = await this.getIndex();
|
|
164
|
-
const topic = await this.requireTopic(idx, topicId);
|
|
165
|
-
if (!topic.trailIds.includes(trailId))
|
|
166
|
-
return topic;
|
|
167
|
-
const next = {
|
|
168
|
-
...topic,
|
|
169
|
-
trailIds: topic.trailIds.filter((t) => t !== trailId),
|
|
170
|
-
updatedAt: nowIso(),
|
|
171
|
-
};
|
|
172
|
-
await this.writeTopic(next, idx);
|
|
173
|
-
return next;
|
|
174
|
-
}
|
|
175
|
-
async reorderTopicTrails(topicId, trailIds) {
|
|
176
|
-
const idx = await this.getIndex();
|
|
177
|
-
const topic = await this.requireTopic(idx, topicId);
|
|
178
|
-
const current = new Set(topic.trailIds);
|
|
179
|
-
const next = new Set(trailIds);
|
|
180
|
-
if (current.size !== next.size || [...current].some((t) => !next.has(t))) {
|
|
181
|
-
throw new Error('reorderTopicTrails expects a permutation of the existing trail list');
|
|
182
|
-
}
|
|
183
|
-
const updated = {
|
|
184
|
-
...topic,
|
|
185
|
-
trailIds: [...trailIds],
|
|
186
|
-
updatedAt: nowIso(),
|
|
187
|
-
};
|
|
188
|
-
await this.writeTopic(updated, idx);
|
|
189
|
-
return updated;
|
|
190
|
-
}
|
|
191
|
-
async getTopicsForTrail(trailId) {
|
|
192
|
-
const topics = await this.getTopics();
|
|
193
|
-
return topics.filter((t) => t.trailIds.includes(trailId));
|
|
194
|
-
}
|
|
195
147
|
// ===== Migration =====
|
|
196
148
|
/**
|
|
197
149
|
* One-shot migration from the legacy single-blob `~/.alexandria/topics.json`
|
|
198
150
|
* to file-per-topic. Reads the blob's `topics[]`, writes each as
|
|
199
151
|
* `<id>.json`, rebuilds the index, then renames the blob to `<blob>.bak` so
|
|
200
|
-
* a re-run is a no-op
|
|
152
|
+
* a re-run is a no-op.
|
|
201
153
|
*
|
|
202
154
|
* Explicit by design — the desktop calls this from a Settings action, never
|
|
203
155
|
* on load. Idempotent: once the blob is `.bak`'d, subsequent calls report
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topicStore.js","sourceRoot":"","sources":["../../src/storage/topicStore.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAEH,qCAAkC;AAClC,yCAA0C;AAC1C,+CAQ0B;AAG1B,gEAAgE;AACnD,QAAA,aAAa,GAAG,IAAA,gBAAI,EAAC,IAAA,iBAAO,GAAE,EAAE,YAAY,CAAC,CAAC;AAC3D,gCAAgC;AACnB,QAAA,UAAU,GAAG,IAAA,gBAAI,EAAC,qBAAa,EAAE,QAAQ,CAAC,CAAC;AACxD,wDAAwD;AAC3C,QAAA,kBAAkB,GAAG,IAAA,gBAAI,EAAC,IAAA,iBAAO,GAAE,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;AAEhF,MAAM,cAAc,GAAG,aAAa,CAAC;AACrC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AA4BpC,MAAM,UAAU,GAAG,GAAgB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;AAEpE,MAAM,eAAe,GAAG,CAAC,KAAa,EAAU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* Trail step mechanism — runtime seams with a `file:line` site.
|
|
48
|
+
* Belongs on trail steps; graph edges for these are derived.
|
|
49
49
|
*/
|
|
50
|
-
export type
|
|
50
|
+
export type SubsystemTrailMechanism = 'calls' | 'uses' | 'feeds' | 'produces' | 'writes' | 'reads' | 'watches' | 'registers-into';
|
|
51
51
|
/**
|
|
52
52
|
* Edge mechanism used by derived display edges / styling. Display edges are
|
|
53
|
-
* derived from
|
|
53
|
+
* derived from trail steps, so this is the trail mechanism.
|
|
54
54
|
*/
|
|
55
|
-
export type SubsystemEdgeMechanism =
|
|
55
|
+
export type SubsystemEdgeMechanism = SubsystemTrailMechanism;
|
|
56
56
|
export type SubsystemDeclarationProvenance = 'verified' | 'authored';
|
|
57
57
|
export type SubsystemDeclTokenKind = 'keyword' | 'name' | 'member' | 'type' | 'punctuation' | 'string' | 'newline';
|
|
58
58
|
export interface SubsystemDeclToken {
|
|
@@ -207,7 +207,7 @@ export type SubsystemConstructDeclaration = SubsystemClassDeclaration | Subsyste
|
|
|
207
207
|
/** A component node — the named unit, construct-tagged. */
|
|
208
208
|
export interface SubsystemComponent {
|
|
209
209
|
/**
|
|
210
|
-
* Model-local stable alias. Referenced by
|
|
210
|
+
* Model-local stable alias. Referenced by trail `from` /
|
|
211
211
|
* `to`; unique per model. Edges point at the alias, not the location — a
|
|
212
212
|
* file move or symbol rename leaves edges intact. Code identity lives on
|
|
213
213
|
* `purl` + `file` + `symbol` and is what composed (multi-model) views
|
|
@@ -271,8 +271,8 @@ export interface SubsystemComponent {
|
|
|
271
271
|
declarationRef?: SubsystemDeclarationRef;
|
|
272
272
|
}
|
|
273
273
|
/**
|
|
274
|
-
* Derived / display graph edge used by renderers. Built from
|
|
275
|
-
*
|
|
274
|
+
* Derived / display graph edge used by renderers. Built from trail
|
|
275
|
+
* steps — not authored as its own document field.
|
|
276
276
|
*/
|
|
277
277
|
export interface SubsystemComponentEdge {
|
|
278
278
|
id: string;
|
|
@@ -280,13 +280,13 @@ export interface SubsystemComponentEdge {
|
|
|
280
280
|
to: string;
|
|
281
281
|
mechanism: SubsystemEdgeMechanism;
|
|
282
282
|
}
|
|
283
|
-
export interface
|
|
283
|
+
export interface SubsystemTrailStep {
|
|
284
284
|
/** Source component alias. */
|
|
285
285
|
from: string;
|
|
286
286
|
/** Target component alias. */
|
|
287
287
|
to: string;
|
|
288
288
|
/** Runtime seam label (Set B). */
|
|
289
|
-
mechanism:
|
|
289
|
+
mechanism: SubsystemTrailMechanism;
|
|
290
290
|
file: string;
|
|
291
291
|
/** 1-based line within `file`. */
|
|
292
292
|
line: number;
|
|
@@ -298,23 +298,23 @@ export interface SubsystemWalkthroughStep {
|
|
|
298
298
|
*/
|
|
299
299
|
purl: string;
|
|
300
300
|
/**
|
|
301
|
-
* Frame name for this
|
|
302
|
-
* Required: the
|
|
301
|
+
* Frame name for this step — the function/method on the stack at the site.
|
|
302
|
+
* Required: the Trails list shows this instead of a bare
|
|
303
303
|
* mechanism + filename fallback.
|
|
304
304
|
*/
|
|
305
305
|
symbol: string;
|
|
306
306
|
/**
|
|
307
|
-
* Free-text note anchored to this
|
|
307
|
+
* Free-text note anchored to this step's site line. Optional — informative
|
|
308
308
|
* only, never verified against source; viewers surface it via the codeview's
|
|
309
309
|
* annotation column.
|
|
310
310
|
*/
|
|
311
311
|
annotation?: string;
|
|
312
312
|
}
|
|
313
|
-
/** Ordered runtime
|
|
314
|
-
export interface
|
|
313
|
+
/** Ordered runtime trail (one named behavior story). */
|
|
314
|
+
export interface SubsystemTrail {
|
|
315
315
|
id: string;
|
|
316
316
|
title: string;
|
|
317
|
-
steps:
|
|
317
|
+
steps: SubsystemTrailStep[];
|
|
318
318
|
}
|
|
319
319
|
/**
|
|
320
320
|
* Portable subsystem model — the shareable standard.
|
|
@@ -336,8 +336,8 @@ export interface SubsystemModelDocument {
|
|
|
336
336
|
title: string;
|
|
337
337
|
description?: string;
|
|
338
338
|
components: SubsystemComponent[];
|
|
339
|
-
/** Runtime
|
|
340
|
-
|
|
339
|
+
/** Runtime trails (ordered steps with sites). */
|
|
340
|
+
trails?: SubsystemTrail[];
|
|
341
341
|
/**
|
|
342
342
|
* The commit each referenced repo was at when the model was created. The
|
|
343
343
|
* coordinate system for every `file:line` in the document: without it, a
|
|
@@ -376,13 +376,13 @@ export declare function isSubsystemModelDocument(value: unknown): value is Subsy
|
|
|
376
376
|
* share surface that must stay schema-clean.
|
|
377
377
|
*/
|
|
378
378
|
export declare function toPortableDocument(doc: SubsystemModelDocument): SubsystemModelDocument;
|
|
379
|
-
/** Stable id for a derived graph edge from a
|
|
379
|
+
/** Stable id for a derived graph edge from a trail step. */
|
|
380
380
|
export declare function derivedGraphEdgeId(from: string, to: string, mechanism: SubsystemEdgeMechanism): string;
|
|
381
381
|
/**
|
|
382
|
-
* Build display edges for the graph canvas from
|
|
382
|
+
* Build display edges for the graph canvas from trail steps
|
|
383
383
|
* (deduped by from/to/mechanism).
|
|
384
384
|
*/
|
|
385
385
|
export declare function deriveGraphEdges(doc: {
|
|
386
|
-
|
|
386
|
+
trails?: SubsystemTrail[];
|
|
387
387
|
}): SubsystemComponentEdge[];
|
|
388
388
|
//# 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;;;;;;;;;;;;;;;;;;;;GAoBG;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;;;GAGG;AACH,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"subsystem-model.d.ts","sourceRoot":"","sources":["../../src/types/subsystem-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;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;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAC/B,OAAO,GACP,MAAM,GACN,OAAO,GACP,UAAU,GACV,QAAQ,GACR,OAAO,GACP,SAAS,GACT,gBAAgB,CAAC;AAErB;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAE7D,MAAM,MAAM,8BAA8B,GAAG,UAAU,GAAG,UAAU,CAAC;AAErE,MAAM,MAAM,sBAAsB,GAC9B,SAAS,GACT,MAAM,GACN,QAAQ,GACR,MAAM,GACN,aAAa,GACb,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,sBAAsB,CAAC;IAC7B,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,mEAAmE;AACnE,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,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doc.description;
|
|
51
|
-
if (doc.
|
|
52
|
-
out.
|
|
51
|
+
if (doc.trails)
|
|
52
|
+
out.trails = doc.trails;
|
|
53
53
|
if (doc.createdAtCommits)
|
|
54
54
|
out.createdAtCommits = doc.createdAtCommits;
|
|
55
55
|
if (doc.verifiedAtCommits)
|
|
@@ -57,18 +57,18 @@ function toPortableDocument(doc) {
|
|
|
57
57
|
return out;
|
|
58
58
|
}
|
|
59
59
|
exports.toPortableDocument = toPortableDocument;
|
|
60
|
-
/** Stable id for a derived graph edge from a
|
|
60
|
+
/** Stable id for a derived graph edge from a trail step. */
|
|
61
61
|
function derivedGraphEdgeId(from, to, mechanism) {
|
|
62
62
|
return `${from}--${mechanism}-->${to}`;
|
|
63
63
|
}
|
|
64
64
|
exports.derivedGraphEdgeId = derivedGraphEdgeId;
|
|
65
65
|
/**
|
|
66
|
-
* Build display edges for the graph canvas from
|
|
66
|
+
* Build display edges for the graph canvas from trail steps
|
|
67
67
|
* (deduped by from/to/mechanism).
|
|
68
68
|
*/
|
|
69
69
|
function deriveGraphEdges(doc) {
|
|
70
70
|
const byId = new Map();
|
|
71
|
-
for (const w of doc.
|
|
71
|
+
for (const w of doc.trails ?? []) {
|
|
72
72
|
for (const step of w.steps) {
|
|
73
73
|
const id = derivedGraphEdgeId(step.from, step.to, step.mechanism);
|
|
74
74
|
if (!byId.has(id)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subsystem-model.js","sourceRoot":"","sources":["../../src/types/subsystem-model.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AA8ZH;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,KAAc;IACrD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,CAAC,GAAG,KAGT,CAAC;IACF,OAAO,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,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CAAC,MAAM,CAAC;IACxC,IAAI,GAAG,CAAC,gBAAgB;QAAE,GAAG,CAAC,gBAAgB,GAAG,GAAG,CAAC,gBAAgB,CAAC;IACtE,IAAI,GAAG,CAAC,iBAAiB;QAAE,GAAG,CAAC,iBAAiB,GAAG,GAAG,CAAC,iBAAiB,CAAC;IACzE,OAAO,GAAG,CAAC;AACb,CAAC;AAbD,gDAaC;AAED,4DAA4D;AAC5D,SAAgB,kBAAkB,CAChC,IAAY,EACZ,EAAU,EACV,SAAiC;IAEjC,OAAO,GAAG,IAAI,KAAK,SAAS,MAAM,EAAE,EAAE,CAAC;AACzC,CAAC;AAND,gDAMC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,GAEhC;IACC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkC,CAAC;IACvD,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,IAAI,EAAE,EAAE;QAChC,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,KAAK,EAAE;YAC1B,MAAM,EAAE,GAAG,kBAAkB,CAAC,IAAI,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;AAlBD,4CAkBC"}
|
package/dist/validation.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These are the rules the JSON Schema (`schemas/subsystem-model.schema.json`)
|
|
5
5
|
* cannot express — anything that spans fields or arrays: alias uniqueness,
|
|
6
|
-
* referential integrity between
|
|
6
|
+
* referential integrity between trails and components, and the
|
|
7
7
|
* `module` implies `file` invariant. Structural checks (types, `required`,
|
|
8
8
|
* enums, ranges, closed objects) belong to the schema and are enforced per
|
|
9
9
|
* surface; this module owns only what the schema can't.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import type { SubsystemModelDocument } from './types/subsystem-model';
|
|
14
14
|
export interface SubsystemValidationProblem {
|
|
15
|
-
/** JSON-pointer-ish location, e.g. `/components/2` or `/
|
|
15
|
+
/** JSON-pointer-ish location, e.g. `/components/2` or `/trails/0/steps/0/from`. */
|
|
16
16
|
path: string;
|
|
17
17
|
message: string;
|
|
18
18
|
}
|
package/dist/validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,sBAAsB,EAGvB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,0BAA0B;IACzC,
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,sBAAsB,EAGvB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,0BAA0B;IACzC,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAyBD;;;GAGG;AACH,wBAAgB,gCAAgC,CAC9C,GAAG,EAAE,sBAAsB,GAC1B,0BAA0B,EAAE,CAuE9B"}
|
package/dist/validation.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* These are the rules the JSON Schema (`schemas/subsystem-model.schema.json`)
|
|
6
6
|
* cannot express — anything that spans fields or arrays: alias uniqueness,
|
|
7
|
-
* referential integrity between
|
|
7
|
+
* referential integrity between trails and components, and the
|
|
8
8
|
* `module` implies `file` invariant. Structural checks (types, `required`,
|
|
9
9
|
* enums, ranges, closed objects) belong to the schema and are enforced per
|
|
10
10
|
* surface; this module owns only what the schema can't.
|
|
@@ -28,7 +28,7 @@ function isUngrounded(c) {
|
|
|
28
28
|
* that draws a link nothing can open. `proposed` is exempt like every other
|
|
29
29
|
* grounding rule: its file is a placeholder for something not placed yet.
|
|
30
30
|
*
|
|
31
|
-
* The same rule covers
|
|
31
|
+
* The same rule covers trail step files — a seam into an external belongs
|
|
32
32
|
* at the call site in the caller, which *is* in the repo.
|
|
33
33
|
*/
|
|
34
34
|
function mentionsNodeModules(path) {
|
|
@@ -41,9 +41,9 @@ function mentionsNodeModules(path) {
|
|
|
41
41
|
function validateSubsystemModelCrossField(doc) {
|
|
42
42
|
const problems = [];
|
|
43
43
|
const components = doc.components ?? [];
|
|
44
|
-
const
|
|
44
|
+
const trails = doc.trails ?? [];
|
|
45
45
|
// Component aliases must be unique, and the set is the referential target
|
|
46
|
-
// for
|
|
46
|
+
// for trail steps.
|
|
47
47
|
const ids = new Set();
|
|
48
48
|
components.forEach((c, i) => {
|
|
49
49
|
if (ids.has(c.alias)) {
|
|
@@ -72,18 +72,18 @@ function validateSubsystemModelCrossField(doc) {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
|
-
|
|
75
|
+
trails.forEach((w, ti) => {
|
|
76
76
|
(w.steps ?? []).forEach((step, si) => {
|
|
77
77
|
if (!ids.has(step.from)) {
|
|
78
78
|
problems.push({
|
|
79
|
-
path: `/
|
|
80
|
-
message: `
|
|
79
|
+
path: `/trails/${ti}/steps/${si}/from`,
|
|
80
|
+
message: `trail ${JSON.stringify(w.id)}: step ${si} from ${JSON.stringify(step.from)} does not match any component alias`,
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
if (!ids.has(step.to)) {
|
|
84
84
|
problems.push({
|
|
85
|
-
path: `/
|
|
86
|
-
message: `
|
|
85
|
+
path: `/trails/${ti}/steps/${si}/to`,
|
|
86
|
+
message: `trail ${JSON.stringify(w.id)}: step ${si} to ${JSON.stringify(step.to)} does not match any component alias`,
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
// A file-anchored step purl names its own site: the fragment must be
|
|
@@ -93,15 +93,15 @@ function validateSubsystemModelCrossField(doc) {
|
|
|
93
93
|
const fragment = step.purl.split('#').slice(1).join('#');
|
|
94
94
|
if (fragment !== step.file) {
|
|
95
95
|
problems.push({
|
|
96
|
-
path: `/
|
|
97
|
-
message: `
|
|
96
|
+
path: `/trails/${ti}/steps/${si}/purl`,
|
|
97
|
+
message: `trail ${JSON.stringify(w.id)}: step ${si} purl fragment ${JSON.stringify(fragment)} does not match step file ${JSON.stringify(step.file)}`,
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
if (mentionsNodeModules(step.file)) {
|
|
102
102
|
problems.push({
|
|
103
|
-
path: `/
|
|
104
|
-
message: `
|
|
103
|
+
path: `/trails/${ti}/steps/${si}/file`,
|
|
104
|
+
message: `trail ${JSON.stringify(w.id)}: step ${si} file ${JSON.stringify(step.file)} points into node_modules — anchor the seam at the call site inside the repo instead.`,
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
});
|
package/dist/validation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAcH,SAAS,YAAY,CAAC,CAAqB;IACzC,OAAO,CAAC,CAAC,SAAS,KAAK,UAAU,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC;AAC3D,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAS,mBAAmB,CAAC,IAAY;IACvC,OAAO,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC;AAED;;;GA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oBACZ,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO;oBACtC,OAAO,EAAE,SAAS,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,EAAE,SAAS,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,uFAAuF;iBAC5K,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAzED,4EAyEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principal-ai/subsystems-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.1",
|
|
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",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"test": "bun test",
|
|
40
40
|
"test:watch": "bun test --watch",
|
|
41
41
|
"test:coverage": "bun test --coverage",
|
|
42
|
+
"prepack": "bun run build",
|
|
42
43
|
"lint": "cd ../.. && eslint packages/subsystems-core --ext .ts,.tsx,.js,.jsx",
|
|
43
44
|
"lint:fix": "cd ../.. && eslint packages/subsystems-core --ext .ts,.tsx,.js,.jsx --fix"
|
|
44
45
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
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 runtime
|
|
5
|
+
"description": "Portable subsystem model — the shareable standard. Construct-tagged components (nodes) plus runtime trails 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, module = which source file/module the export belongs to. 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",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"$ref": "#/$defs/component"
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
"
|
|
33
|
+
"trails": {
|
|
34
34
|
"type": "array",
|
|
35
|
-
"description": "Ordered runtime
|
|
35
|
+
"description": "Ordered runtime trails (one per named behavior). Each step names from/to/mechanism and the concrete file:line where that seam fires.",
|
|
36
36
|
"items": {
|
|
37
|
-
"$ref": "#/$defs/
|
|
37
|
+
"$ref": "#/$defs/trail"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"createdAtCommits": {
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
"mechanism": {
|
|
102
102
|
"type": "string",
|
|
103
|
-
"description": "
|
|
103
|
+
"description": "Trail step 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.",
|
|
104
104
|
"enum": [
|
|
105
105
|
"calls",
|
|
106
106
|
"uses",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"alias": {
|
|
127
127
|
"type": "string",
|
|
128
128
|
"minLength": 1,
|
|
129
|
-
"description": "Model-local stable alias, unique per model. Referenced by
|
|
129
|
+
"description": "Model-local stable alias, unique per model. Referenced by trail `from` / `to`; edges point at the alias, not the location, so a file move or symbol rename leaves edges intact. Code identity (for composed multi-model views) lives on `purl` + `file` + `symbol`, not here."
|
|
130
130
|
},
|
|
131
131
|
"name": {
|
|
132
132
|
"type": "string",
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
},
|
|
209
|
-
"
|
|
209
|
+
"trailStep": {
|
|
210
210
|
"type": "object",
|
|
211
211
|
"required": [
|
|
212
212
|
"from",
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
"type": "string",
|
|
237
237
|
"minLength": 1,
|
|
238
238
|
"pattern": "^(?!.*(^|/)node_modules(/|$)).*$",
|
|
239
|
-
"description": "Repo-root-relative path where the seam fires for this
|
|
239
|
+
"description": "Repo-root-relative path where the seam fires for this trail."
|
|
240
240
|
},
|
|
241
241
|
"line": {
|
|
242
242
|
"type": "integer",
|
|
@@ -251,16 +251,16 @@
|
|
|
251
251
|
"symbol": {
|
|
252
252
|
"type": "string",
|
|
253
253
|
"minLength": 1,
|
|
254
|
-
"description": "Frame name for this
|
|
254
|
+
"description": "Frame name for this step — the function/method on the stack at the site. Required; the Trails list shows this instead of a bare mechanism + filename fallback."
|
|
255
255
|
},
|
|
256
256
|
"annotation": {
|
|
257
257
|
"type": "string",
|
|
258
258
|
"minLength": 1,
|
|
259
|
-
"description": "Free-text note anchored to this
|
|
259
|
+
"description": "Free-text note anchored to this step's site line. Optional, informative only, never verified against source; viewers surface it in the codeview's annotation column."
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
},
|
|
263
|
-
"
|
|
263
|
+
"trail": {
|
|
264
264
|
"type": "object",
|
|
265
265
|
"required": [
|
|
266
266
|
"id",
|
|
@@ -272,18 +272,18 @@
|
|
|
272
272
|
"id": {
|
|
273
273
|
"type": "string",
|
|
274
274
|
"minLength": 1,
|
|
275
|
-
"description": "Stable unique
|
|
275
|
+
"description": "Stable unique trail id."
|
|
276
276
|
},
|
|
277
277
|
"title": {
|
|
278
278
|
"type": "string",
|
|
279
279
|
"minLength": 1,
|
|
280
|
-
"description": "
|
|
280
|
+
"description": "Trail name (e.g. save, load, refresh)."
|
|
281
281
|
},
|
|
282
282
|
"steps": {
|
|
283
283
|
"type": "array",
|
|
284
|
-
"description": "Ordered
|
|
284
|
+
"description": "Ordered steps; array order is execution order.",
|
|
285
285
|
"items": {
|
|
286
|
-
"$ref": "#/$defs/
|
|
286
|
+
"$ref": "#/$defs/trailStep"
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
}
|
|
@@ -91,25 +91,6 @@ describe('CRUD', () => {
|
|
|
91
91
|
expect(published.repos).toEqual(['pkg:github/acme/web']);
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
-
test('trail membership add/remove/reorder', async () => {
|
|
95
|
-
const store = makeStore();
|
|
96
|
-
await store.createTopic({ id: 'topic-m', title: 'M', trailIds: [] });
|
|
97
|
-
await store.addTrailToTopic('topic-m', 'a');
|
|
98
|
-
await store.addTrailToTopic('topic-m', 'b');
|
|
99
|
-
await store.addTrailToTopic('topic-m', 'a'); // dup no-op
|
|
100
|
-
expect((await store.getTopic('topic-m'))?.trailIds).toEqual(['a', 'b']);
|
|
101
|
-
|
|
102
|
-
await store.reorderTopicTrails('topic-m', ['b', 'a']);
|
|
103
|
-
expect((await store.getTopic('topic-m'))?.trailIds).toEqual(['b', 'a']);
|
|
104
|
-
|
|
105
|
-
await expect(
|
|
106
|
-
store.reorderTopicTrails('topic-m', ['b', 'c']),
|
|
107
|
-
).rejects.toThrow(/permutation/);
|
|
108
|
-
|
|
109
|
-
await store.removeTrailFromTopic('topic-m', 'b');
|
|
110
|
-
expect((await store.getTopic('topic-m'))?.trailIds).toEqual(['a']);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
94
|
test('delete removes the file and the index entry', async () => {
|
|
114
95
|
const store = makeStore();
|
|
115
96
|
await store.createTopic({ id: 'topic-d', title: 'D', trailIds: [] });
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* File-per-topic store under `~/.principal/topics/`.
|
|
3
3
|
*
|
|
4
|
-
* Layout (
|
|
5
|
-
*
|
|
4
|
+
* Layout (file-per-entity, so topics become locally greppable and an agent can
|
|
5
|
+
* read one directly):
|
|
6
6
|
*
|
|
7
7
|
* ~/.principal/topics/
|
|
8
8
|
* _index.json private, rebuildable manifest (entries[])
|
|
9
9
|
* <id>.json one pretty-printed DraftTopic per file
|
|
10
10
|
*
|
|
11
|
-
* Topics are the *least* repo-bound artifact (a bundle
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Topics are the *least* repo-bound artifact (a bundle spanning many repos), so
|
|
12
|
+
* they are stored flat by id rather than bucketed by repo Purl. No purl, no
|
|
13
|
+
* buckets, no `node:os`/Purl dependency beyond `homedir()`.
|
|
14
14
|
*
|
|
15
15
|
* The `_index.json` manifest is store-private and rebuildable: it is rebuilt by
|
|
16
16
|
* scanning the directory whenever it is missing or unparseable. It exists only
|
|
17
17
|
* to make `getTopics()` / `list()` cheap (no per-file read for listing).
|
|
18
18
|
*
|
|
19
|
-
* There is intentionally NO eviction cap.
|
|
20
|
-
*
|
|
21
|
-
* dropped, so the cap is deliberately not carried over.
|
|
19
|
+
* There is intentionally NO eviction cap. Topics are few, user-curated, and must
|
|
20
|
+
* never be silently dropped.
|
|
22
21
|
*
|
|
23
22
|
* Migration from the legacy single-blob `~/.alexandria/topics.json` is explicit
|
|
24
23
|
* (`migrateFromLegacyBlob`) — it is never run automatically on load; the desktop
|
|
@@ -125,8 +124,9 @@ export interface MigrationResult {
|
|
|
125
124
|
|
|
126
125
|
/**
|
|
127
126
|
* Fields a caller may set when updating a topic. `id`, `createdAt`, and
|
|
128
|
-
* `trailIds` are
|
|
129
|
-
* `trailIds
|
|
127
|
+
* `trailIds` are immutable here — `id`/`createdAt` are set once at creation, and
|
|
128
|
+
* `trailIds` is foreign-keyed membership owned by the desktop's trail store, so
|
|
129
|
+
* a topic update here can never rewrite it.
|
|
130
130
|
*/
|
|
131
131
|
export type TopicUpdate = Partial<
|
|
132
132
|
Pick<DraftTopic, 'title' | 'description' | 'status' | 'createdBy' | 'assets' | 'repos'>
|
|
@@ -241,65 +241,13 @@ export class TopicStore {
|
|
|
241
241
|
return true;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
// ===== Trail membership =====
|
|
245
|
-
|
|
246
|
-
async addTrailToTopic(topicId: string, trailId: string): Promise<DraftTopic> {
|
|
247
|
-
const idx = await this.getIndex();
|
|
248
|
-
const topic = await this.requireTopic(idx, topicId);
|
|
249
|
-
if (topic.trailIds.includes(trailId)) return topic;
|
|
250
|
-
const next: DraftTopic = {
|
|
251
|
-
...topic,
|
|
252
|
-
trailIds: [...topic.trailIds, trailId],
|
|
253
|
-
updatedAt: nowIso(),
|
|
254
|
-
};
|
|
255
|
-
await this.writeTopic(next, idx);
|
|
256
|
-
return next;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
async removeTrailFromTopic(topicId: string, trailId: string): Promise<DraftTopic> {
|
|
260
|
-
const idx = await this.getIndex();
|
|
261
|
-
const topic = await this.requireTopic(idx, topicId);
|
|
262
|
-
if (!topic.trailIds.includes(trailId)) return topic;
|
|
263
|
-
const next: DraftTopic = {
|
|
264
|
-
...topic,
|
|
265
|
-
trailIds: topic.trailIds.filter((t) => t !== trailId),
|
|
266
|
-
updatedAt: nowIso(),
|
|
267
|
-
};
|
|
268
|
-
await this.writeTopic(next, idx);
|
|
269
|
-
return next;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
async reorderTopicTrails(topicId: string, trailIds: string[]): Promise<DraftTopic> {
|
|
273
|
-
const idx = await this.getIndex();
|
|
274
|
-
const topic = await this.requireTopic(idx, topicId);
|
|
275
|
-
const current = new Set(topic.trailIds);
|
|
276
|
-
const next = new Set(trailIds);
|
|
277
|
-
if (current.size !== next.size || [...current].some((t) => !next.has(t))) {
|
|
278
|
-
throw new Error(
|
|
279
|
-
'reorderTopicTrails expects a permutation of the existing trail list',
|
|
280
|
-
);
|
|
281
|
-
}
|
|
282
|
-
const updated: DraftTopic = {
|
|
283
|
-
...topic,
|
|
284
|
-
trailIds: [...trailIds],
|
|
285
|
-
updatedAt: nowIso(),
|
|
286
|
-
};
|
|
287
|
-
await this.writeTopic(updated, idx);
|
|
288
|
-
return updated;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
async getTopicsForTrail(trailId: string): Promise<DraftTopic[]> {
|
|
292
|
-
const topics = await this.getTopics();
|
|
293
|
-
return topics.filter((t) => t.trailIds.includes(trailId));
|
|
294
|
-
}
|
|
295
|
-
|
|
296
244
|
// ===== Migration =====
|
|
297
245
|
|
|
298
246
|
/**
|
|
299
247
|
* One-shot migration from the legacy single-blob `~/.alexandria/topics.json`
|
|
300
248
|
* to file-per-topic. Reads the blob's `topics[]`, writes each as
|
|
301
249
|
* `<id>.json`, rebuilds the index, then renames the blob to `<blob>.bak` so
|
|
302
|
-
* a re-run is a no-op
|
|
250
|
+
* a re-run is a no-op.
|
|
303
251
|
*
|
|
304
252
|
* Explicit by design — the desktop calls this from a Settings action, never
|
|
305
253
|
* on load. Idempotent: once the blob is `.bak`'d, subsequent calls report
|
|
@@ -59,10 +59,10 @@ export type SubsystemFramework = string;
|
|
|
59
59
|
export type SubsystemStereotype = string;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
63
|
-
* Belongs on
|
|
62
|
+
* Trail step mechanism — runtime seams with a `file:line` site.
|
|
63
|
+
* Belongs on trail steps; graph edges for these are derived.
|
|
64
64
|
*/
|
|
65
|
-
export type
|
|
65
|
+
export type SubsystemTrailMechanism =
|
|
66
66
|
| 'calls'
|
|
67
67
|
| 'uses'
|
|
68
68
|
| 'feeds'
|
|
@@ -74,9 +74,9 @@ export type SubsystemWalkthroughMechanism =
|
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* Edge mechanism used by derived display edges / styling. Display edges are
|
|
77
|
-
* derived from
|
|
77
|
+
* derived from trail steps, so this is the trail mechanism.
|
|
78
78
|
*/
|
|
79
|
-
export type SubsystemEdgeMechanism =
|
|
79
|
+
export type SubsystemEdgeMechanism = SubsystemTrailMechanism;
|
|
80
80
|
|
|
81
81
|
export type SubsystemDeclarationProvenance = 'verified' | 'authored';
|
|
82
82
|
|
|
@@ -267,7 +267,7 @@ export type SubsystemConstructDeclaration =
|
|
|
267
267
|
/** A component node — the named unit, construct-tagged. */
|
|
268
268
|
export interface SubsystemComponent {
|
|
269
269
|
/**
|
|
270
|
-
* Model-local stable alias. Referenced by
|
|
270
|
+
* Model-local stable alias. Referenced by trail `from` /
|
|
271
271
|
* `to`; unique per model. Edges point at the alias, not the location — a
|
|
272
272
|
* file move or symbol rename leaves edges intact. Code identity lives on
|
|
273
273
|
* `purl` + `file` + `symbol` and is what composed (multi-model) views
|
|
@@ -332,8 +332,8 @@ export interface SubsystemComponent {
|
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
/**
|
|
335
|
-
* Derived / display graph edge used by renderers. Built from
|
|
336
|
-
*
|
|
335
|
+
* Derived / display graph edge used by renderers. Built from trail
|
|
336
|
+
* steps — not authored as its own document field.
|
|
337
337
|
*/
|
|
338
338
|
export interface SubsystemComponentEdge {
|
|
339
339
|
id: string;
|
|
@@ -342,13 +342,13 @@ export interface SubsystemComponentEdge {
|
|
|
342
342
|
mechanism: SubsystemEdgeMechanism;
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
-
export interface
|
|
345
|
+
export interface SubsystemTrailStep {
|
|
346
346
|
/** Source component alias. */
|
|
347
347
|
from: string;
|
|
348
348
|
/** Target component alias. */
|
|
349
349
|
to: string;
|
|
350
350
|
/** Runtime seam label (Set B). */
|
|
351
|
-
mechanism:
|
|
351
|
+
mechanism: SubsystemTrailMechanism;
|
|
352
352
|
file: string;
|
|
353
353
|
/** 1-based line within `file`. */
|
|
354
354
|
line: number;
|
|
@@ -360,24 +360,24 @@ export interface SubsystemWalkthroughStep {
|
|
|
360
360
|
*/
|
|
361
361
|
purl: string;
|
|
362
362
|
/**
|
|
363
|
-
* Frame name for this
|
|
364
|
-
* Required: the
|
|
363
|
+
* Frame name for this step — the function/method on the stack at the site.
|
|
364
|
+
* Required: the Trails list shows this instead of a bare
|
|
365
365
|
* mechanism + filename fallback.
|
|
366
366
|
*/
|
|
367
367
|
symbol: string;
|
|
368
368
|
/**
|
|
369
|
-
* Free-text note anchored to this
|
|
369
|
+
* Free-text note anchored to this step's site line. Optional — informative
|
|
370
370
|
* only, never verified against source; viewers surface it via the codeview's
|
|
371
371
|
* annotation column.
|
|
372
372
|
*/
|
|
373
373
|
annotation?: string;
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
-
/** Ordered runtime
|
|
377
|
-
export interface
|
|
376
|
+
/** Ordered runtime trail (one named behavior story). */
|
|
377
|
+
export interface SubsystemTrail {
|
|
378
378
|
id: string;
|
|
379
379
|
title: string;
|
|
380
|
-
steps:
|
|
380
|
+
steps: SubsystemTrailStep[];
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
/**
|
|
@@ -402,8 +402,8 @@ export interface SubsystemModelDocument {
|
|
|
402
402
|
title: string;
|
|
403
403
|
description?: string;
|
|
404
404
|
components: SubsystemComponent[];
|
|
405
|
-
/** Runtime
|
|
406
|
-
|
|
405
|
+
/** Runtime trails (ordered steps with sites). */
|
|
406
|
+
trails?: SubsystemTrail[];
|
|
407
407
|
/**
|
|
408
408
|
* The commit each referenced repo was at when the model was created. The
|
|
409
409
|
* coordinate system for every `file:line` in the document: without it, a
|
|
@@ -460,13 +460,13 @@ export function toPortableDocument(
|
|
|
460
460
|
};
|
|
461
461
|
if (doc.$schema) out.$schema = doc.$schema;
|
|
462
462
|
if (doc.description) out.description = doc.description;
|
|
463
|
-
if (doc.
|
|
463
|
+
if (doc.trails) out.trails = doc.trails;
|
|
464
464
|
if (doc.createdAtCommits) out.createdAtCommits = doc.createdAtCommits;
|
|
465
465
|
if (doc.verifiedAtCommits) out.verifiedAtCommits = doc.verifiedAtCommits;
|
|
466
466
|
return out;
|
|
467
467
|
}
|
|
468
468
|
|
|
469
|
-
/** Stable id for a derived graph edge from a
|
|
469
|
+
/** Stable id for a derived graph edge from a trail step. */
|
|
470
470
|
export function derivedGraphEdgeId(
|
|
471
471
|
from: string,
|
|
472
472
|
to: string,
|
|
@@ -476,14 +476,14 @@ export function derivedGraphEdgeId(
|
|
|
476
476
|
}
|
|
477
477
|
|
|
478
478
|
/**
|
|
479
|
-
* Build display edges for the graph canvas from
|
|
479
|
+
* Build display edges for the graph canvas from trail steps
|
|
480
480
|
* (deduped by from/to/mechanism).
|
|
481
481
|
*/
|
|
482
482
|
export function deriveGraphEdges(doc: {
|
|
483
|
-
|
|
483
|
+
trails?: SubsystemTrail[];
|
|
484
484
|
}): SubsystemComponentEdge[] {
|
|
485
485
|
const byId = new Map<string, SubsystemComponentEdge>();
|
|
486
|
-
for (const w of doc.
|
|
486
|
+
for (const w of doc.trails ?? []) {
|
|
487
487
|
for (const step of w.steps) {
|
|
488
488
|
const id = derivedGraphEdgeId(step.from, step.to, step.mechanism);
|
|
489
489
|
if (!byId.has(id)) {
|
package/src/validation.test.ts
CHANGED
|
@@ -28,7 +28,7 @@ describe('validateSubsystemModelCrossField', () => {
|
|
|
28
28
|
test('accepts a consistent document', () => {
|
|
29
29
|
const d = doc({
|
|
30
30
|
components: [comp('a'), comp('b')],
|
|
31
|
-
|
|
31
|
+
trails: [
|
|
32
32
|
{
|
|
33
33
|
id: 'w1',
|
|
34
34
|
title: 'flow',
|
|
@@ -47,11 +47,11 @@ describe('validateSubsystemModelCrossField', () => {
|
|
|
47
47
|
expect(problems[0]!.message).toContain('duplicate alias');
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
test('flags
|
|
50
|
+
test('flags trail step endpoints that reference no component', () => {
|
|
51
51
|
const problems = validateSubsystemModelCrossField(
|
|
52
52
|
doc({
|
|
53
53
|
components: [comp('a')],
|
|
54
|
-
|
|
54
|
+
trails: [
|
|
55
55
|
{
|
|
56
56
|
id: 'w1',
|
|
57
57
|
title: 'flow',
|
|
@@ -61,14 +61,14 @@ describe('validateSubsystemModelCrossField', () => {
|
|
|
61
61
|
}),
|
|
62
62
|
);
|
|
63
63
|
expect(problems).toHaveLength(1);
|
|
64
|
-
expect(problems[0]!.path).toBe('/
|
|
64
|
+
expect(problems[0]!.path).toBe('/trails/0/steps/0/from');
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
test('flags
|
|
67
|
+
test('flags trail step purl fragments that mismatch the step file', () => {
|
|
68
68
|
const problems = validateSubsystemModelCrossField(
|
|
69
69
|
doc({
|
|
70
70
|
components: [comp('a')],
|
|
71
|
-
|
|
71
|
+
trails: [
|
|
72
72
|
{
|
|
73
73
|
id: 'w1',
|
|
74
74
|
title: 'flow',
|
|
@@ -78,7 +78,7 @@ describe('validateSubsystemModelCrossField', () => {
|
|
|
78
78
|
}),
|
|
79
79
|
);
|
|
80
80
|
expect(problems).toHaveLength(1);
|
|
81
|
-
expect(problems[0]!.path).toBe('/
|
|
81
|
+
expect(problems[0]!.path).toBe('/trails/0/steps/0/purl');
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
test('module implies file, exempting external/proposed', () => {
|
|
@@ -147,11 +147,11 @@ describe('validateSubsystemModelCrossField', () => {
|
|
|
147
147
|
).toEqual([]);
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
test('flags a
|
|
150
|
+
test('flags a trail step anchored in node_modules', () => {
|
|
151
151
|
const problems = validateSubsystemModelCrossField(
|
|
152
152
|
doc({
|
|
153
153
|
components: [comp('a')],
|
|
154
|
-
|
|
154
|
+
trails: [
|
|
155
155
|
{
|
|
156
156
|
id: 'w1',
|
|
157
157
|
title: 'flow',
|
|
@@ -171,6 +171,6 @@ describe('validateSubsystemModelCrossField', () => {
|
|
|
171
171
|
}),
|
|
172
172
|
);
|
|
173
173
|
expect(problems).toHaveLength(1);
|
|
174
|
-
expect(problems[0]!.path).toBe('/
|
|
174
|
+
expect(problems[0]!.path).toBe('/trails/0/steps/0/file');
|
|
175
175
|
});
|
|
176
176
|
});
|
package/src/validation.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These are the rules the JSON Schema (`schemas/subsystem-model.schema.json`)
|
|
5
5
|
* cannot express — anything that spans fields or arrays: alias uniqueness,
|
|
6
|
-
* referential integrity between
|
|
6
|
+
* referential integrity between trails and components, and the
|
|
7
7
|
* `module` implies `file` invariant. Structural checks (types, `required`,
|
|
8
8
|
* enums, ranges, closed objects) belong to the schema and are enforced per
|
|
9
9
|
* surface; this module owns only what the schema can't.
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
import type {
|
|
15
15
|
SubsystemModelDocument,
|
|
16
16
|
SubsystemComponent,
|
|
17
|
-
|
|
17
|
+
SubsystemTrail,
|
|
18
18
|
} from './types/subsystem-model';
|
|
19
19
|
|
|
20
20
|
export interface SubsystemValidationProblem {
|
|
21
|
-
/** JSON-pointer-ish location, e.g. `/components/2` or `/
|
|
21
|
+
/** JSON-pointer-ish location, e.g. `/components/2` or `/trails/0/steps/0/from`. */
|
|
22
22
|
path: string;
|
|
23
23
|
message: string;
|
|
24
24
|
}
|
|
@@ -39,7 +39,7 @@ function isUngrounded(c: SubsystemComponent): boolean {
|
|
|
39
39
|
* that draws a link nothing can open. `proposed` is exempt like every other
|
|
40
40
|
* grounding rule: its file is a placeholder for something not placed yet.
|
|
41
41
|
*
|
|
42
|
-
* The same rule covers
|
|
42
|
+
* The same rule covers trail step files — a seam into an external belongs
|
|
43
43
|
* at the call site in the caller, which *is* in the repo.
|
|
44
44
|
*/
|
|
45
45
|
function mentionsNodeModules(path: string): boolean {
|
|
@@ -55,10 +55,10 @@ export function validateSubsystemModelCrossField(
|
|
|
55
55
|
): SubsystemValidationProblem[] {
|
|
56
56
|
const problems: SubsystemValidationProblem[] = [];
|
|
57
57
|
const components = doc.components ?? [];
|
|
58
|
-
const
|
|
58
|
+
const trails = doc.trails ?? [];
|
|
59
59
|
|
|
60
60
|
// Component aliases must be unique, and the set is the referential target
|
|
61
|
-
// for
|
|
61
|
+
// for trail steps.
|
|
62
62
|
const ids = new Set<string>();
|
|
63
63
|
components.forEach((c, i) => {
|
|
64
64
|
if (ids.has(c.alias)) {
|
|
@@ -87,18 +87,18 @@ export function validateSubsystemModelCrossField(
|
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
trails.forEach((w: SubsystemTrail, ti) => {
|
|
91
91
|
(w.steps ?? []).forEach((step, si) => {
|
|
92
92
|
if (!ids.has(step.from)) {
|
|
93
93
|
problems.push({
|
|
94
|
-
path: `/
|
|
95
|
-
message: `
|
|
94
|
+
path: `/trails/${ti}/steps/${si}/from`,
|
|
95
|
+
message: `trail ${JSON.stringify(w.id)}: step ${si} from ${JSON.stringify(step.from)} does not match any component alias`,
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
if (!ids.has(step.to)) {
|
|
99
99
|
problems.push({
|
|
100
|
-
path: `/
|
|
101
|
-
message: `
|
|
100
|
+
path: `/trails/${ti}/steps/${si}/to`,
|
|
101
|
+
message: `trail ${JSON.stringify(w.id)}: step ${si} to ${JSON.stringify(step.to)} does not match any component alias`,
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
// A file-anchored step purl names its own site: the fragment must be
|
|
@@ -108,15 +108,15 @@ export function validateSubsystemModelCrossField(
|
|
|
108
108
|
const fragment = step.purl.split('#').slice(1).join('#');
|
|
109
109
|
if (fragment !== step.file) {
|
|
110
110
|
problems.push({
|
|
111
|
-
path: `/
|
|
112
|
-
message: `
|
|
111
|
+
path: `/trails/${ti}/steps/${si}/purl`,
|
|
112
|
+
message: `trail ${JSON.stringify(w.id)}: step ${si} purl fragment ${JSON.stringify(fragment)} does not match step file ${JSON.stringify(step.file)}`,
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
if (mentionsNodeModules(step.file)) {
|
|
117
117
|
problems.push({
|
|
118
|
-
path: `/
|
|
119
|
-
message: `
|
|
118
|
+
path: `/trails/${ti}/steps/${si}/file`,
|
|
119
|
+
message: `trail ${JSON.stringify(w.id)}: step ${si} file ${JSON.stringify(step.file)} points into node_modules — anchor the seam at the call site inside the repo instead.`,
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
});
|