@principal-ai/subsystems-react 0.38.0 → 0.39.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.
Files changed (54) hide show
  1. package/dist/graphify/consolidated.d.ts +8 -0
  2. package/dist/graphify/consolidated.d.ts.map +1 -1
  3. package/dist/graphify/construct.d.ts +18 -0
  4. package/dist/graphify/construct.d.ts.map +1 -1
  5. package/dist/graphify/construct.js +23 -0
  6. package/dist/graphify/construct.js.map +1 -1
  7. package/dist/graphify/index.d.ts +2 -2
  8. package/dist/graphify/index.d.ts.map +1 -1
  9. package/dist/graphify/index.js +1 -1
  10. package/dist/graphify/index.js.map +1 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/subsystem/IssueList.d.ts +49 -3
  16. package/dist/subsystem/IssueList.d.ts.map +1 -1
  17. package/dist/subsystem/IssueList.js +180 -79
  18. package/dist/subsystem/IssueList.js.map +1 -1
  19. package/dist/subsystem/SubsystemComponentGraph.d.ts +9 -1
  20. package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
  21. package/dist/subsystem/SubsystemComponentGraph.js +461 -12
  22. package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
  23. package/dist/subsystem/formatDeclaration.js +19 -5
  24. package/dist/subsystem/formatDeclaration.js.map +1 -1
  25. package/dist/subsystem/model.d.ts +38 -0
  26. package/dist/subsystem/model.d.ts.map +1 -1
  27. package/dist/subsystem/model.js.map +1 -1
  28. package/dist/subsystem/nodes.d.ts.map +1 -1
  29. package/dist/subsystem/nodes.js +124 -67
  30. package/dist/subsystem/nodes.js.map +1 -1
  31. package/dist/subsystem/symbolRefs.d.ts.map +1 -1
  32. package/dist/subsystem/symbolRefs.js +2 -0
  33. package/dist/subsystem/symbolRefs.js.map +1 -1
  34. package/package.json +3 -3
  35. package/src/graphify/consolidated.ts +8 -0
  36. package/src/graphify/construct.test.ts +61 -1
  37. package/src/graphify/construct.ts +33 -0
  38. package/src/graphify/index.ts +6 -1
  39. package/src/index.ts +1 -0
  40. package/src/stories/Subsystem/ComponentGraph/IssueOverlay.stories.tsx +625 -0
  41. package/src/stories/Subsystem/ComponentGraph/Issues.stories.tsx +7 -1
  42. package/src/stories/Subsystem/ComponentGraph/NodeAnatomy.stories.tsx +40 -73
  43. package/src/stories/Subsystem/ComponentGraph/StoreValueType.stories.tsx +261 -0
  44. package/src/stories/Subsystem/StoreValueTypeDeclaration.stories.tsx +182 -0
  45. package/src/subsystem/IssueList.focus.test.tsx +113 -0
  46. package/src/subsystem/IssueList.icon.test.tsx +95 -0
  47. package/src/subsystem/IssueList.tsx +267 -111
  48. package/src/subsystem/SubsystemComponentGraph.tsx +530 -12
  49. package/src/subsystem/formatDeclaration.test.ts +64 -0
  50. package/src/subsystem/formatDeclaration.ts +20 -5
  51. package/src/subsystem/model.ts +46 -0
  52. package/src/subsystem/nodes.group.test.tsx +52 -0
  53. package/src/subsystem/nodes.tsx +102 -2
  54. package/src/subsystem/symbolRefs.ts +2 -0
@@ -1,6 +1,10 @@
1
1
  import { describe, expect, test } from 'bun:test';
2
2
  import type { GraphifyEdge, GraphifyNode } from './types';
3
- import { inferConstructFromGraphify, constructsMatch } from './construct';
3
+ import {
4
+ inferConstructFromGraphify,
5
+ constructsMatch,
6
+ resolveConstructMatch,
7
+ } from './construct';
4
8
 
5
9
  function node(
6
10
  id: string,
@@ -106,3 +110,59 @@ describe('constructsMatch', () => {
106
110
  expect(constructsMatch('function', 'class')).toBe(false);
107
111
  });
108
112
  });
113
+
114
+ describe('resolveConstructMatch', () => {
115
+ test('structural match is enough (no augmentation)', () => {
116
+ expect(resolveConstructMatch('function', 'function')).toEqual({
117
+ match: true,
118
+ });
119
+ });
120
+
121
+ test('plain mismatch without augmentation stays a hard failure', () => {
122
+ expect(resolveConstructMatch('function', 'class')).toEqual({
123
+ match: false,
124
+ });
125
+ });
126
+
127
+ test('unknown without augmentation is unconfirmed, not a mismatch', () => {
128
+ expect(resolveConstructMatch('store', 'unknown')).toEqual({ match: null });
129
+ });
130
+
131
+ test('accepted augmentation confirms a claim Graphify infers differently', () => {
132
+ expect(resolveConstructMatch('store', 'function', 'store')).toEqual({
133
+ match: true,
134
+ augmentedBy: 'store',
135
+ });
136
+ });
137
+
138
+ test('accepted augmentation confirms a claim Graphify leaves unknown', () => {
139
+ expect(resolveConstructMatch('interface', 'unknown', 'interface')).toEqual({
140
+ match: true,
141
+ augmentedBy: 'interface',
142
+ });
143
+ });
144
+
145
+ test('augmentation only confirms its own claim, not a different one', () => {
146
+ expect(resolveConstructMatch('store', 'function', 'module')).toEqual({
147
+ match: false,
148
+ });
149
+ expect(resolveConstructMatch('store', 'unknown', 'module')).toEqual({
150
+ match: null,
151
+ });
152
+ });
153
+
154
+ test('blank augmentation is ignored', () => {
155
+ expect(resolveConstructMatch('store', 'function', ' ')).toEqual({
156
+ match: false,
157
+ });
158
+ });
159
+
160
+ test('external / missing claimed still short-circuits to match', () => {
161
+ expect(resolveConstructMatch('external', 'function')).toEqual({
162
+ match: true,
163
+ });
164
+ expect(resolveConstructMatch(undefined, 'unknown')).toEqual({
165
+ match: true,
166
+ });
167
+ });
168
+ });
@@ -118,3 +118,36 @@ export function constructsMatch(
118
118
  if (TYPE_FAMILY.has(claimed)) return inferred === 'type';
119
119
  return claimed === inferred;
120
120
  }
121
+
122
+ export interface ConstructCheckOutcome {
123
+ /** true = confirmed, false = known mismatch, null = unconfirmed (needs agent). */
124
+ match: boolean | null;
125
+ /** Confirming construct from an accepted augmentation, when that is what confirmed it. */
126
+ augmentedBy?: string;
127
+ }
128
+
129
+ /**
130
+ * Resolve a claimed construct against Graphify's inferred construct, allowing an
131
+ * accepted, agent-confirmed augmentation to stand in for Graphify when it is
132
+ * silent (`unknown`) or when it disagrees.
133
+ *
134
+ * Graphify's inferred construct is a *structural hint*, never ground truth: its
135
+ * vocabulary (`class | function | method | type | module | unknown`) has no
136
+ * `store` or `custom_entity`, and a call-style accessor label biases it to
137
+ * `function`. When source-reading confirms the model's claim, that confirmation
138
+ * (recorded as an accepted augmentation) wins over the hint.
139
+ */
140
+ export function resolveConstructMatch(
141
+ claimed: string | undefined,
142
+ inferred: InferredGraphifyConstruct,
143
+ augmentedConstruct?: string | null,
144
+ ): ConstructCheckOutcome {
145
+ const aug = augmentedConstruct?.trim();
146
+ if (!claimed || claimed === 'external') return { match: true };
147
+ const augConfirms = !!aug && aug === claimed;
148
+ if (inferred === 'unknown') {
149
+ return augConfirms ? { match: true, augmentedBy: aug } : { match: null };
150
+ }
151
+ if (constructsMatch(claimed, inferred)) return { match: true };
152
+ return augConfirms ? { match: true, augmentedBy: aug } : { match: false };
153
+ }
@@ -61,8 +61,13 @@ export {
61
61
  export type {
62
62
  InferredGraphifyConstruct,
63
63
  InferConstructFromGraphifyResult,
64
+ ConstructCheckOutcome,
65
+ } from './construct';
66
+ export {
67
+ inferConstructFromGraphify,
68
+ constructsMatch,
69
+ resolveConstructMatch,
64
70
  } from './construct';
65
- export { inferConstructFromGraphify, constructsMatch } from './construct';
66
71
  export type {
67
72
  GraphifyInferredSignature,
68
73
  ClaimedSignature,
package/src/index.ts CHANGED
@@ -62,6 +62,7 @@ export {
62
62
  symbolLabelVariants,
63
63
  inferConstructFromGraphify,
64
64
  constructsMatch,
65
+ resolveConstructMatch,
65
66
  extractNamedTypes,
66
67
  extractGraphifySignature,
67
68
  compareSignatures,