@principal-ai/subsystems-react 0.55.3 → 0.56.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.
Files changed (98) hide show
  1. package/dist/index.d.ts +6 -2
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +3 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/pierre/PierreFileView.js +3 -3
  6. package/dist/pierre/PierreFileView.js.map +1 -1
  7. package/dist/pierre/PierreTrailCodeView.d.ts +4 -9
  8. package/dist/pierre/PierreTrailCodeView.d.ts.map +1 -1
  9. package/dist/pierre/PierreTrailCodeView.js +28 -25
  10. package/dist/pierre/PierreTrailCodeView.js.map +1 -1
  11. package/dist/pierre/fileAvailability.d.ts +4 -7
  12. package/dist/pierre/fileAvailability.d.ts.map +1 -1
  13. package/dist/pierre/fileAvailability.js +5 -10
  14. package/dist/pierre/fileAvailability.js.map +1 -1
  15. package/dist/pierre/trailSnippet.d.ts +10 -0
  16. package/dist/pierre/trailSnippet.d.ts.map +1 -0
  17. package/dist/pierre/trailSnippet.js +22 -0
  18. package/dist/pierre/trailSnippet.js.map +1 -0
  19. package/dist/subsystem/C4Graph.d.ts.map +1 -1
  20. package/dist/subsystem/C4Graph.js +1 -1
  21. package/dist/subsystem/C4Graph.js.map +1 -1
  22. package/dist/subsystem/FileDrawer.d.ts +3 -1
  23. package/dist/subsystem/FileDrawer.d.ts.map +1 -1
  24. package/dist/subsystem/FileDrawer.js +2 -2
  25. package/dist/subsystem/FileDrawer.js.map +1 -1
  26. package/dist/subsystem/IssueList.d.ts.map +1 -1
  27. package/dist/subsystem/IssueList.js +26 -0
  28. package/dist/subsystem/IssueList.js.map +1 -1
  29. package/dist/subsystem/SubsystemComponentGraph.d.ts +9 -5
  30. package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
  31. package/dist/subsystem/SubsystemComponentGraph.js +37 -47
  32. package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
  33. package/dist/subsystem/TrailStackBreadcrumb.d.ts +21 -0
  34. package/dist/subsystem/TrailStackBreadcrumb.d.ts.map +1 -0
  35. package/dist/subsystem/TrailStackBreadcrumb.js +77 -0
  36. package/dist/subsystem/TrailStackBreadcrumb.js.map +1 -0
  37. package/dist/subsystem/TrailStepsNav.d.ts +4 -3
  38. package/dist/subsystem/TrailStepsNav.d.ts.map +1 -1
  39. package/dist/subsystem/TrailStepsNav.js +13 -16
  40. package/dist/subsystem/TrailStepsNav.js.map +1 -1
  41. package/dist/subsystem/TrailsPanel.d.ts +9 -7
  42. package/dist/subsystem/TrailsPanel.d.ts.map +1 -1
  43. package/dist/subsystem/TrailsPanel.js +126 -76
  44. package/dist/subsystem/TrailsPanel.js.map +1 -1
  45. package/dist/subsystem/model.d.ts +5 -18
  46. package/dist/subsystem/model.d.ts.map +1 -1
  47. package/dist/subsystem/model.js +3 -11
  48. package/dist/subsystem/model.js.map +1 -1
  49. package/dist/subsystem/nodes.d.ts.map +1 -1
  50. package/dist/subsystem/nodes.js +17 -24
  51. package/dist/subsystem/nodes.js.map +1 -1
  52. package/dist/subsystem/stepEmphasis.d.ts +78 -0
  53. package/dist/subsystem/stepEmphasis.d.ts.map +1 -0
  54. package/dist/subsystem/stepEmphasis.js +89 -0
  55. package/dist/subsystem/stepEmphasis.js.map +1 -0
  56. package/dist/subsystem/trailBrief.d.ts.map +1 -1
  57. package/dist/subsystem/trailBrief.js +20 -0
  58. package/dist/subsystem/trailBrief.js.map +1 -1
  59. package/dist/subsystem/trailStack.d.ts +53 -0
  60. package/dist/subsystem/trailStack.d.ts.map +1 -0
  61. package/dist/subsystem/trailStack.js +154 -0
  62. package/dist/subsystem/trailStack.js.map +1 -0
  63. package/dist/subsystem/trailStepDisplay.d.ts +38 -0
  64. package/dist/subsystem/trailStepDisplay.d.ts.map +1 -0
  65. package/dist/subsystem/trailStepDisplay.js +41 -0
  66. package/dist/subsystem/trailStepDisplay.js.map +1 -0
  67. package/package.json +3 -3
  68. package/src/index.ts +10 -1
  69. package/src/pierre/PierreFileView.tsx +3 -3
  70. package/src/pierre/PierreTrailCodeView.tsx +24 -36
  71. package/src/pierre/fileAvailability.test.ts +0 -6
  72. package/src/pierre/fileAvailability.ts +5 -13
  73. package/src/pierre/trailSnippet.test.ts +74 -0
  74. package/src/pierre/trailSnippet.ts +35 -0
  75. package/src/stories/Canvases/Subsystem/Deprecated.stories.tsx +3 -17
  76. package/src/stories/Canvases/Subsystem/NodeAnatomy.stories.tsx +3 -31
  77. package/src/stories/Canvases/Subsystem/Trails.stories.tsx +0 -187
  78. package/src/subsystem/C4Graph.tsx +0 -1
  79. package/src/subsystem/FileDrawer.tsx +6 -0
  80. package/src/subsystem/IssueList.tsx +26 -0
  81. package/src/subsystem/SubsystemComponentGraph.tsx +68 -65
  82. package/src/subsystem/TrailStackBreadcrumb.test.tsx +109 -0
  83. package/src/subsystem/TrailStackBreadcrumb.tsx +172 -0
  84. package/src/subsystem/TrailStepsNav.test.tsx +35 -0
  85. package/src/subsystem/TrailStepsNav.tsx +18 -19
  86. package/src/subsystem/TrailsPanel.test.tsx +149 -0
  87. package/src/subsystem/TrailsPanel.tsx +165 -39
  88. package/src/subsystem/model.test.ts +7 -22
  89. package/src/subsystem/model.ts +6 -20
  90. package/src/subsystem/nodes.tsx +19 -28
  91. package/src/subsystem/stepEmphasis.ts +151 -0
  92. package/src/subsystem/trailBrief.test.ts +29 -0
  93. package/src/subsystem/trailBrief.ts +20 -0
  94. package/src/subsystem/trailStack.test.ts +133 -0
  95. package/src/subsystem/trailStack.ts +229 -0
  96. package/src/subsystem/trailStepDisplay.ts +68 -0
  97. package/src/stories/Canvases/Subsystem/Proposed.stories.tsx +0 -256
  98. package/src/stories/Canvases/Subsystem/ProposedTrails.stories.tsx +0 -184
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Step emphasis — PROTOTYPE contract for the "guiding focus" augmentation.
3
+ *
4
+ * A step emphasis is an authored pointer at a walkthrough step: "look here
5
+ * first", with optional markdown guidance explaining why. It is deliberately
6
+ * **not** part of the portable subsystem model and **not** a verification
7
+ * signal — it belongs in a separate, host-owned augmentation document:
8
+ *
9
+ * `~/.principal/subsystem-model-augmentations/<model-identity>.json`
10
+ *
11
+ * The key question this prototype is here to answer is identity: a step has no
12
+ * id today and steps move. `stepClaimKey` fingerprints the step's *claim*
13
+ * (`from`/`to`/`mechanism`/site/symbol/span), so a mark survives a reorder but
14
+ * stops resolving when the claim itself is edited. Orphaned records are kept
15
+ * (and can be pruned deliberately) rather than silently dropped.
16
+ *
17
+ * The mark is a single star rather than a closed kind vocabulary. `guidance`
18
+ * is markdown so a mark can carry the same kind of prose as a model
19
+ * description — headings, emphasis, links, code — while staying a string.
20
+ *
21
+ * Nothing here is wired to disk yet. The story `Canvases/Subsystem/Step
22
+ * Emphasis` exercises the shape with an in-memory store and a live JSON view.
23
+ */
24
+ import type { SubsystemTrail, SubsystemTrailStep } from './model';
25
+ export interface StepEmphasisProvenance {
26
+ /** Who authored the mark. Agent marks are expected too. */
27
+ source: 'author' | 'agent';
28
+ /** ISO timestamp. */
29
+ at: string;
30
+ /** Optional human/agent identity. */
31
+ author?: string;
32
+ }
33
+ /** One mark in the separate augmentation document. */
34
+ export interface StepEmphasisRecord {
35
+ /** The trail the step belongs to. */
36
+ trailId: string;
37
+ /**
38
+ * Fingerprint of the step's claim (see `stepClaimKey`). Stable across
39
+ * reorder; changes when the claim changes.
40
+ */
41
+ stepKey: string;
42
+ /** Optional markdown "why look here", rendered like a model description. */
43
+ guidance?: string;
44
+ provenance: StepEmphasisProvenance;
45
+ }
46
+ /**
47
+ * The whole separate document. `modelId` is the host-store id (or an identity
48
+ * key) — this document is host-local and never rides on the portable model.
49
+ */
50
+ export interface StepEmphasisDocument {
51
+ version: 1;
52
+ modelId: string;
53
+ emphasis: StepEmphasisRecord[];
54
+ }
55
+ /**
56
+ * Lookup key for the UI. `trailId:stepKey` — one flat map is enough for a
57
+ * graph and keeps the panel from re-deriving a nested structure per render.
58
+ */
59
+ export type StepEmphasisMap = ReadonlyMap<string, StepEmphasisRecord>;
60
+ /** Stable content key for a step's claim. */
61
+ export declare function stepClaimKey(step: Pick<SubsystemTrailStep, 'from' | 'to' | 'mechanism' | 'file' | 'symbol' | 'span'>): string;
62
+ /** Map key for one step's mark. */
63
+ export declare function emphasisKey(trailId: string, step: Pick<SubsystemTrailStep, 'from' | 'to' | 'mechanism' | 'file' | 'symbol' | 'span'>): string;
64
+ export declare function buildStepEmphasisMap(records: readonly StepEmphasisRecord[]): StepEmphasisMap;
65
+ export declare function findStepEmphasis(map: StepEmphasisMap | undefined, trailId: string, step: SubsystemTrailStep): StepEmphasisRecord | undefined;
66
+ /**
67
+ * Records whose step claim no longer exists in the current trails. Kept in the
68
+ * document (so a bad edit does not destroy authored intent) but surfaced so
69
+ * the author can prune them.
70
+ */
71
+ export declare function orphanedEmphasis(records: readonly StepEmphasisRecord[], trails: readonly SubsystemTrail[]): StepEmphasisRecord[];
72
+ /** Records for one trail, in current step order (for reader surfaces). */
73
+ export declare function emphasisForTrail(map: StepEmphasisMap | undefined, trail: SubsystemTrail): Array<{
74
+ stepIndex: number;
75
+ step: SubsystemTrailStep;
76
+ record: StepEmphasisRecord;
77
+ }>;
78
+ //# sourceMappingURL=stepEmphasis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepEmphasis.d.ts","sourceRoot":"","sources":["../../src/subsystem/stepEmphasis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElE,MAAM,WAAW,sBAAsB;IACrC,2DAA2D;IAC3D,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC3B,qBAAqB;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,sDAAsD;AACtD,MAAM,WAAW,kBAAk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AAc,GACpB,KAAK,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,kBAAkB,CAAA;CAAE,CAAC,CAQpF"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Step emphasis — PROTOTYPE contract for the "guiding focus" augmentation.
3
+ *
4
+ * A step emphasis is an authored pointer at a walkthrough step: "look here
5
+ * first", with optional markdown guidance explaining why. It is deliberately
6
+ * **not** part of the portable subsystem model and **not** a verification
7
+ * signal — it belongs in a separate, host-owned augmentation document:
8
+ *
9
+ * `~/.principal/subsystem-model-augmentations/<model-identity>.json`
10
+ *
11
+ * The key question this prototype is here to answer is identity: a step has no
12
+ * id today and steps move. `stepClaimKey` fingerprints the step's *claim*
13
+ * (`from`/`to`/`mechanism`/site/symbol/span), so a mark survives a reorder but
14
+ * stops resolving when the claim itself is edited. Orphaned records are kept
15
+ * (and can be pruned deliberately) rather than silently dropped.
16
+ *
17
+ * The mark is a single star rather than a closed kind vocabulary. `guidance`
18
+ * is markdown so a mark can carry the same kind of prose as a model
19
+ * description — headings, emphasis, links, code — while staying a string.
20
+ *
21
+ * Nothing here is wired to disk yet. The story `Canvases/Subsystem/Step
22
+ * Emphasis` exercises the shape with an in-memory store and a live JSON view.
23
+ */
24
+ /** The claim fields a mark is attached to. Deliberately excludes `annotation`. */
25
+ function claimFields(step) {
26
+ return [
27
+ step.from,
28
+ step.to,
29
+ step.mechanism,
30
+ step.file,
31
+ step.symbol,
32
+ step.span?.startLine == null ? '' : String(step.span.startLine),
33
+ step.span?.endLine == null ? '' : String(step.span.endLine),
34
+ step.span?.contentHash ?? '',
35
+ ];
36
+ }
37
+ /**
38
+ * FNV-1a (32-bit) fingerprint. Good enough for a local key: the point is
39
+ * "same claim => same key", not cryptographic resistance. Swap for SHA-256 at
40
+ * the store boundary if marks ever travel between hosts.
41
+ */
42
+ function fnv1a(value) {
43
+ let hash = 0x811c9dc5;
44
+ for (let i = 0; i < value.length; i++) {
45
+ hash ^= value.charCodeAt(i);
46
+ hash = Math.imul(hash, 0x01000193);
47
+ }
48
+ return (hash >>> 0).toString(16).padStart(8, '0');
49
+ }
50
+ /** Stable content key for a step's claim. */
51
+ export function stepClaimKey(step) {
52
+ return fnv1a(claimFields(step).join('\u001f'));
53
+ }
54
+ /** Map key for one step's mark. */
55
+ export function emphasisKey(trailId, step) {
56
+ return `${trailId}:${stepClaimKey(step)}`;
57
+ }
58
+ export function buildStepEmphasisMap(records) {
59
+ return new Map(records.map((r) => [`${r.trailId}:${r.stepKey}`, r]));
60
+ }
61
+ export function findStepEmphasis(map, trailId, step) {
62
+ return map?.get(emphasisKey(trailId, step));
63
+ }
64
+ /**
65
+ * Records whose step claim no longer exists in the current trails. Kept in the
66
+ * document (so a bad edit does not destroy authored intent) but surfaced so
67
+ * the author can prune them.
68
+ */
69
+ export function orphanedEmphasis(records, trails) {
70
+ const live = new Set();
71
+ for (const trail of trails) {
72
+ for (const step of trail.steps)
73
+ live.add(emphasisKey(trail.id, step));
74
+ }
75
+ return records.filter((r) => !live.has(`${r.trailId}:${r.stepKey}`));
76
+ }
77
+ /** Records for one trail, in current step order (for reader surfaces). */
78
+ export function emphasisForTrail(map, trail) {
79
+ if (!map)
80
+ return [];
81
+ const rows = [];
82
+ trail.steps.forEach((step, stepIndex) => {
83
+ const record = map.get(emphasisKey(trail.id, step));
84
+ if (record)
85
+ rows.push({ stepIndex, step, record });
86
+ });
87
+ return rows;
88
+ }
89
+ //# sourceMappingURL=stepEmphasis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepEmphasis.js","sourceRoot":"","sources":["../../src/subsystem/stepEmphasis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AA2CH,kFAAkF;AAClF,SAAS,WAAW,CAAC,IAAwF;IAC3G,OAAO;QACL,IAAI,CAAC,IAAI;QACT,IAAI,CAAC,EAAE;QACP,IAAI,CAAC,SAAS;QACd,IAAI,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C,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"trailBrief.d.ts","sourceRoot":"","sources":["../../src/subsystem/trailBrief.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,CAuBR"}
1
+ {"version":3,"file":"trailBrief.d.ts","sourceRoot":"","sources":["../../src/subsystem/trailBrief.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,CA2CR"}
@@ -24,12 +24,32 @@ export function buildStepBrief(trail, stepIndex) {
24
24
  lines.push(`- to: \`${step.to}\``);
25
25
  lines.push(`- mechanism: \`${step.mechanism}\``);
26
26
  lines.push(`- symbol: \`${step.symbol}\``);
27
+ // `calls` means the site is the caller frame. Every other mechanism is a
28
+ // logical hop whose evidence can live in another construct; say so, so an
29
+ // agent does not treat the site symbol as the source component.
30
+ if (step.mechanism !== 'calls') {
31
+ lines.push(`- site role: \`via\``);
32
+ }
27
33
  const site = step.span
28
34
  ? step.span.startLine === step.span.endLine
29
35
  ? `${step.file}:${step.span.startLine}`
30
36
  : `${step.file}:${step.span.startLine}-${step.span.endLine}`
31
37
  : step.file;
32
38
  lines.push(`- site: \`${site}\``);
39
+ if (step.site) {
40
+ const frame = step.site.span.startLine === step.site.span.endLine
41
+ ? `${step.file}:${step.site.span.startLine}`
42
+ : `${step.file}:${step.site.span.startLine}-${step.site.span.endLine}`;
43
+ lines.push(`- site construct: \`${step.site.symbol}\` (${frame})`);
44
+ }
45
+ if (step.target) {
46
+ const targetSpan = step.target.span
47
+ ? step.target.span.startLine === step.target.span.endLine
48
+ ? `:${step.target.span.startLine}`
49
+ : `:${step.target.span.startLine}-${step.target.span.endLine}`
50
+ : '';
51
+ lines.push(`- target: \`${step.target.symbol}\` (${step.target.file}${targetSpan})`);
52
+ }
33
53
  lines.push(`- purl: \`${step.purl}\``);
34
54
  if (step.annotation != null && step.annotation.length > 0) {
35
55
  lines.push(`- note: ${step.annotation}`);
@@ -1 +1 @@
1
- {"version":3,"file":"trailBrief.js","sourceRoot":"","sources":["../../src/subsystem/trailBrief.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAqB,EACrB,SAAiB;IAEjB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACpC,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CACR,UAAU,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,EAAE,YAAY,SAAS,GAAG,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CACpF,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;IACvC,KAAK,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IACnC,KAAK,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC;IACjD,KAAK,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI;QACpB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,IAAI,CAAC,O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,CAAC,IAAI,CAAC,MAAM,OAAO,KAAK,GAAG,CAAC,CAAC;KACpE;IACD,IAAI,IAAI,CAAC,MAAM,EAAE;QACf,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI;YACjC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;gBACvD,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE;gBAClC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE;YAChE,CAAC,CAAC,EAAE,CAAC;QACP,KAAK,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,MAAM,CAAC,MAAM,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,UAAU,GAAG,CAAC,CAAC;KACtF;IACD,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;IACvC,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;QACzD,KAAK,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;KAC1C;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Derive a call stack for one trail step.
3
+ *
4
+ * A trail is a timeline, not a stack frame dump: steps can return to an
5
+ * ancestor, take sibling calls, or describe a non-call seam (`uses`, `feeds`,
6
+ * …). This module links each `calls` step to the prior call that entered its
7
+ * caller construct, then renders that ancestry as a stack. Non-call steps are
8
+ * annotations on the nearest frame — they are not frames.
9
+ *
10
+ * The links use the resolved `site`/`target` when present, falling back to the
11
+ * component aliases. That keeps the view useful before every step has its
12
+ * construct refs captured.
13
+ */
14
+ import type { SubsystemTrail, SubsystemTrailMechanism } from './model';
15
+ import { type TrailComponentLabels } from './trailStepDisplay';
16
+ export interface TrailStackFrame {
17
+ /** The step whose call creates this frame. */
18
+ stepIndex: number;
19
+ /** Frame label — the caller construct, or the component alias. */
20
+ label: string;
21
+ /** Component alias of the caller (for focus/selection wiring). */
22
+ componentAlias: string;
23
+ /** The selected step's own frame (innermost). */
24
+ current: boolean;
25
+ }
26
+ export interface TrailStackAnnotation {
27
+ /** Non-call step attached to the current frame. */
28
+ stepIndex: number;
29
+ mechanism: SubsystemTrailMechanism;
30
+ label: string;
31
+ /** The selected step itself (vs context around it). */
32
+ selected: boolean;
33
+ }
34
+ export interface TrailStackView {
35
+ /** Outermost → innermost. Empty only for an out-of-range index. */
36
+ frames: TrailStackFrame[];
37
+ /** Non-call seams attached to the current frame. */
38
+ annotations: TrailStackAnnotation[];
39
+ /** True when the selected step is a call frame. */
40
+ isCall: boolean;
41
+ /** The selected call's target, shown as the next frame-to-be. */
42
+ callee?: string;
43
+ }
44
+ /**
45
+ * Build the stack at one trail step.
46
+ *
47
+ * - `calls` → the chain of calls into the caller frame, plus the callee as the
48
+ * next frame (not yet on the stack).
49
+ * - `uses` / data + event seams → the nearest call frame they attach to, with
50
+ * the seam as an annotation.
51
+ */
52
+ export declare function buildTrailStack(trail: SubsystemTrail, stepIndex: number, byAlias?: TrailComponentLabels): TrailStackView;
53
+ //# sourceMappingURL=trailStack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trailStack.d.ts","sourceRoot":"","sources":["../../src/subsystem/trailStack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EAExB,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,cAAc,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,uBAAuB,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,oDAAoD;IACpD,WAAW,EAAE,oBAAoB,EAAE,CAAC;IACpC,mDAAmD;IACnD,MAAM,EAAE,OAAO,CAAC;IAChB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA+GD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,cAAc,CAoDhB"}
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Derive a call stack for one trail step.
3
+ *
4
+ * A trail is a timeline, not a stack frame dump: steps can return to an
5
+ * ancestor, take sibling calls, or describe a non-call seam (`uses`, `feeds`,
6
+ * …). This module links each `calls` step to the prior call that entered its
7
+ * caller construct, then renders that ancestry as a stack. Non-call steps are
8
+ * annotations on the nearest frame — they are not frames.
9
+ *
10
+ * The links use the resolved `site`/`target` when present, falling back to the
11
+ * component aliases. That keeps the view useful before every step has its
12
+ * construct refs captured.
13
+ */
14
+ import { trailComponentLabel, } from './trailStepDisplay';
15
+ function callerSymbol(step) {
16
+ return step.site?.symbol?.trim() || step.symbol?.trim() || step.from;
17
+ }
18
+ function calleeSymbol(step) {
19
+ return step.target?.symbol?.trim() || step.to;
20
+ }
21
+ function callerLabel(step, byAlias) {
22
+ return callerSymbol(step) || trailComponentLabel(step.from, byAlias);
23
+ }
24
+ function calleeLabel(step, byAlias) {
25
+ return step.target?.symbol?.trim() || trailComponentLabel(step.to, byAlias);
26
+ }
27
+ function isCallStep(step) {
28
+ return step?.mechanism === 'calls';
29
+ }
30
+ /** Does call `a` lead into the caller of call `b`? */
31
+ function leadsInto(a, b) {
32
+ return a.to === b.from || calleeSymbol(a) === callerSymbol(b);
33
+ }
34
+ /** The nearest earlier call that entered this step's caller frame. */
35
+ function parentCallIndex(trail, stepIndex) {
36
+ const child = trail.steps[stepIndex];
37
+ if (!child)
38
+ return null;
39
+ for (let i = stepIndex - 1; i >= 0; i--) {
40
+ const candidate = trail.steps[i];
41
+ if (!isCallStep(candidate))
42
+ continue;
43
+ if (leadsInto(candidate, child))
44
+ return i;
45
+ }
46
+ return null;
47
+ }
48
+ /** The call chain ending at `stepIndex`, outermost first. */
49
+ function callChain(trail, stepIndex) {
50
+ const chain = [];
51
+ const seen = new Set();
52
+ let cursor = stepIndex;
53
+ while (cursor != null && !seen.has(cursor)) {
54
+ seen.add(cursor);
55
+ chain.unshift(cursor);
56
+ cursor = parentCallIndex(trail, cursor);
57
+ }
58
+ return chain;
59
+ }
60
+ function framesForChain(trail, chain, selectedStepIndex, byAlias) {
61
+ return chain.map((idx) => {
62
+ const step = trail.steps[idx];
63
+ return {
64
+ stepIndex: idx,
65
+ label: callerLabel(step, byAlias),
66
+ componentAlias: step.from,
67
+ current: idx === selectedStepIndex,
68
+ };
69
+ });
70
+ }
71
+ /**
72
+ * The nearest earlier call that shares this non-call step's source component.
73
+ * `uses`/`feeds`/… are dependencies of that frame, not new frames.
74
+ */
75
+ function anchorCallIndex(trail, stepIndex) {
76
+ const step = trail.steps[stepIndex];
77
+ if (!step)
78
+ return null;
79
+ const source = callerSymbol(step);
80
+ for (let i = stepIndex - 1; i >= 0; i--) {
81
+ const candidate = trail.steps[i];
82
+ if (!isCallStep(candidate))
83
+ continue;
84
+ if (candidate.from === step.from ||
85
+ candidate.to === step.from ||
86
+ callerSymbol(candidate) === source ||
87
+ calleeSymbol(candidate) === source) {
88
+ return i;
89
+ }
90
+ }
91
+ return null;
92
+ }
93
+ function annotationLabel(step, byAlias) {
94
+ return `${step.mechanism} ${calleeLabel(step, byAlias)}`;
95
+ }
96
+ /**
97
+ * Build the stack at one trail step.
98
+ *
99
+ * - `calls` → the chain of calls into the caller frame, plus the callee as the
100
+ * next frame (not yet on the stack).
101
+ * - `uses` / data + event seams → the nearest call frame they attach to, with
102
+ * the seam as an annotation.
103
+ */
104
+ export function buildTrailStack(trail, stepIndex, byAlias) {
105
+ const step = trail.steps[stepIndex];
106
+ if (!step) {
107
+ return { frames: [], annotations: [], isCall: false };
108
+ }
109
+ if (isCallStep(step)) {
110
+ const chain = callChain(trail, stepIndex);
111
+ return {
112
+ frames: framesForChain(trail, chain, stepIndex, byAlias),
113
+ annotations: [],
114
+ isCall: true,
115
+ callee: calleeLabel(step, byAlias),
116
+ };
117
+ }
118
+ const anchor = anchorCallIndex(trail, stepIndex);
119
+ if (anchor != null) {
120
+ const chain = callChain(trail, anchor);
121
+ return {
122
+ frames: framesForChain(trail, chain, anchor, byAlias),
123
+ annotations: [
124
+ {
125
+ stepIndex,
126
+ mechanism: step.mechanism,
127
+ label: annotationLabel(step, byAlias),
128
+ selected: true,
129
+ },
130
+ ],
131
+ isCall: false,
132
+ };
133
+ }
134
+ return {
135
+ frames: [
136
+ {
137
+ stepIndex,
138
+ label: callerLabel(step, byAlias),
139
+ componentAlias: step.from,
140
+ current: true,
141
+ },
142
+ ],
143
+ annotations: [
144
+ {
145
+ stepIndex,
146
+ mechanism: step.mechanism,
147
+ label: annotationLabel(step, byAlias),
148
+ selected: true,
149
+ },
150
+ ],
151
+ isCall: false,
152
+ };
153
+ }
154
+ //# sourceMappingURL=trailStack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trailStack.js","sourceRoot":"","sources":["../../src/subsystem/trailStack.ts"],"names":[],"mappings":"AA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OAAO,CAAC;YACxD,WAAW,EAAE,EAAE;YACf,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC;SACnC,CAAC;KACH;IAED,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACjD,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACvC,OAAO;YACL,MAAM,EAAE,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC;YACrD,WAAW,EAAE;gBACX;oBACE,SAAS;oBACT,SAAS,EAAE,IAAI,CAAC,SAAS;oBACzB,KAAK,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC;oBACrC,QAAQ,EAAE,IAAI;iBACf;aACF;YACD,MAAM,EAAE,KAAK;SACd,CAAC;KACH;IAED,OAAO;QACL,MAAM,EAAE;YACN;gBACE,SAAS;gBACT,KAAK,EAAE,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC;gBACjC,cAAc,EAAE,IAAI,CAAC,IAAI;gBACzB,OAAO,EAAE,IAAI;aACd;SACF;QACD,WAAW,EAAE;YACX;gBACE,SAAS;gBACT,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,KAAK,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC;gBACrC,QAAQ,EAAE,IAAI;aACf;SACF;QACD,MAAM,EAAE,KAAK;KACd,CAAC;AACJ,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * How a trail step reads in the Trails panel.
3
+ *
4
+ * A step is one seam, but the panel shows the logical hop and the site in a
5
+ * single wrapping line:
6
+ *
7
+ * - `calls` — the caller frame (the site construct).
8
+ * - `uses` — `from uses to`, where `to` is the precise target when resolved.
9
+ * - Everything else — `from mechanism to`.
10
+ *
11
+ * The evidence site lives in the code view and the stack breadcrumb; the
12
+ * sidebar row stays one line so it can wrap instead of truncating.
13
+ */
14
+ import type { SubsystemTrailStep, SubsystemTrailMechanism } from './model';
15
+ /** The slice of a component the labels need — keeps fixtures light. */
16
+ export interface TrailComponentLabelSource {
17
+ alias: string;
18
+ name?: string;
19
+ symbol?: string;
20
+ }
21
+ /** Alias → component, for turning model-local aliases into display names. */
22
+ export type TrailComponentLabels = ReadonlyMap<string, TrailComponentLabelSource>;
23
+ /** One row's primary text. */
24
+ export interface TrailStepDisplay {
25
+ mechanism: SubsystemTrailMechanism;
26
+ /** The line that names the step: caller frame for `calls`, hop otherwise. */
27
+ primary: string;
28
+ }
29
+ /** Display label for a component alias; falls back to the alias. */
30
+ export declare function trailComponentLabel(alias: string, byAlias?: TrailComponentLabels): string;
31
+ /**
32
+ * Build the single display line for one step.
33
+ *
34
+ * The resolved target (`step.target.symbol`) is the precise callee, while `to`
35
+ * is only a component alias and can be a whole class/store. Prefer the target.
36
+ */
37
+ export declare function trailStepDisplay(step: SubsystemTrailStep, byAlias?: TrailComponentLabels): TrailStepDisplay;
38
+ //# sourceMappingURL=trailStepDisplay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trailStepDisplay.d.ts","sourceRoot":"","sources":["../../src/subsystem/trailStepDisplay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAE3E,uEAAuE;AACvE,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,6EAA6E;AAC7E,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;AAElF,8BAA8B;AAC9B,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,uBAAuB,CAAC;IACnC,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,oEAAoE;AACpE,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,oBAAoB,GAC7B,MAAM,CAIR;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,kBAAkB,EACxB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,gBAAgB,CAelB"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * How a trail step reads in the Trails panel.
3
+ *
4
+ * A step is one seam, but the panel shows the logical hop and the site in a
5
+ * single wrapping line:
6
+ *
7
+ * - `calls` — the caller frame (the site construct).
8
+ * - `uses` — `from uses to`, where `to` is the precise target when resolved.
9
+ * - Everything else — `from mechanism to`.
10
+ *
11
+ * The evidence site lives in the code view and the stack breadcrumb; the
12
+ * sidebar row stays one line so it can wrap instead of truncating.
13
+ */
14
+ /** Display label for a component alias; falls back to the alias. */
15
+ export function trailComponentLabel(alias, byAlias) {
16
+ const component = byAlias?.get(alias);
17
+ const label = component?.name?.trim() || component?.symbol?.trim();
18
+ return label || alias;
19
+ }
20
+ /**
21
+ * Build the single display line for one step.
22
+ *
23
+ * The resolved target (`step.target.symbol`) is the precise callee, while `to`
24
+ * is only a component alias and can be a whole class/store. Prefer the target.
25
+ */
26
+ export function trailStepDisplay(step, byAlias) {
27
+ const from = trailComponentLabel(step.from, byAlias);
28
+ const to = step.target?.symbol?.trim() || trailComponentLabel(step.to, byAlias);
29
+ const siteSymbol = step.site?.symbol?.trim() || step.symbol?.trim() || from;
30
+ if (step.mechanism === 'calls') {
31
+ return { mechanism: step.mechanism, primary: siteSymbol };
32
+ }
33
+ if (step.mechanism === 'uses') {
34
+ return { mechanism: step.mechanism, primary: `${from} uses ${to}` };
35
+ }
36
+ return {
37
+ mechanism: step.mechanism,
38
+ primary: `${from} ${step.mechanism} ${to}`,
39
+ };
40
+ }
41
+ //# sourceMappingURL=trailStepDisplay.js.map
@@ -0,0 +1 @@
1
+ {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E;KAC3C,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principal-ai/subsystems-react",
3
- "version": "0.55.3",
3
+ "version": "0.56.1",
4
4
  "description": "React UI for Subsystem Models — graph, Pierre code views, and session-event feeds",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -38,7 +38,7 @@
38
38
  "peerDependencies": {
39
39
  "@pierre/diffs": ">=1.1.20",
40
40
  "@principal-ade/industry-theme": "^0.1.7",
41
- "@principal-ai/subsystems-core": "^0.49.0",
41
+ "@principal-ai/subsystems-core": "^0.50.0",
42
42
  "react": "^18.0.0 || ^19.0.0",
43
43
  "react-dom": "^18.0.0 || ^19.0.0"
44
44
  },
@@ -46,7 +46,7 @@
46
46
  "@pierre/diffs": "1.3.6",
47
47
  "@principal-ade/industry-theme": "0.1.7",
48
48
  "@principal-ai/agent-monitoring": "^0.3.38",
49
- "@principal-ai/subsystems-core": "^0.49.1",
49
+ "@principal-ai/subsystems-core": "^0.50.0",
50
50
  "@storybook/addon-docs": "10.1.2",
51
51
  "@storybook/addon-links": "10.1.2",
52
52
  "@storybook/addon-onboarding": "10.1.2",
package/src/index.ts CHANGED
@@ -218,6 +218,14 @@ export {
218
218
  export type { TrailsPanelProps } from './subsystem/TrailsPanel';
219
219
  export { TrailStepsNav } from './subsystem/TrailStepsNav';
220
220
  export type { TrailStepsNavProps } from './subsystem/TrailStepsNav';
221
+ export { TrailStackBreadcrumb } from './subsystem/TrailStackBreadcrumb';
222
+ export type { TrailStackBreadcrumbProps } from './subsystem/TrailStackBreadcrumb';
223
+ export { buildTrailStack } from './subsystem/trailStack';
224
+ export type {
225
+ TrailStackAnnotation,
226
+ TrailStackFrame,
227
+ TrailStackView,
228
+ } from './subsystem/trailStack';
221
229
  export { buildStepBrief } from './subsystem/trailBrief';
222
230
  export { GraphLayoutCover } from './subsystem/GraphLayoutCover';
223
231
  export type { GraphLayoutCoverProps } from './subsystem/GraphLayoutCover';
@@ -232,6 +240,8 @@ export type {
232
240
  SubsystemComponentEdge,
233
241
  SubsystemTrail,
234
242
  SubsystemTrailStep,
243
+ SubsystemSiteConstruct,
244
+ SubsystemTargetConstruct,
235
245
  SubsystemTrailMechanism,
236
246
  SubsystemModelDocument,
237
247
  SubsystemComponentConstruct,
@@ -315,7 +325,6 @@ export {
315
325
  ROLE_COLOR,
316
326
  ROLE_LABEL,
317
327
  FRAMEWORK_BADGE_COLOR,
318
- PROPOSED_COLOR,
319
328
  } from './subsystem/model';
320
329
  export type {
321
330
  SubsystemSourceSpan,
@@ -105,14 +105,14 @@ export function PierreFileView({
105
105
  );
106
106
 
107
107
  if (error) {
108
- // A file with no local checkout is usually a proposed seam that isn't
109
- // implemented yet — explain that instead of echoing the host error.
108
+ // A file with no local checkout is usually a seam that isn't implemented
109
+ // yet — explain that instead of echoing the host error.
110
110
  if (isFileUnavailableError(error)) {
111
111
  return (
112
112
  <div style={{ padding: 16, display: 'flex', flexDirection: 'column', gap: 4 }}>
113
113
  <span style={{ color: theme.colors.text }}>
114
114
  This file isn't in the local checkout for this repo — it may be
115
- proposed or not yet implemented.
115
+ missing or not yet implemented.
116
116
  </span>
117
117
  <span
118
118
  style={{