@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.
- package/dist/graphify/consolidated.d.ts +8 -0
- package/dist/graphify/consolidated.d.ts.map +1 -1
- package/dist/graphify/construct.d.ts +18 -0
- package/dist/graphify/construct.d.ts.map +1 -1
- package/dist/graphify/construct.js +23 -0
- package/dist/graphify/construct.js.map +1 -1
- package/dist/graphify/index.d.ts +2 -2
- package/dist/graphify/index.d.ts.map +1 -1
- package/dist/graphify/index.js +1 -1
- package/dist/graphify/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/subsystem/IssueList.d.ts +49 -3
- package/dist/subsystem/IssueList.d.ts.map +1 -1
- package/dist/subsystem/IssueList.js +180 -79
- package/dist/subsystem/IssueList.js.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.d.ts +9 -1
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +461 -12
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/formatDeclaration.js +19 -5
- package/dist/subsystem/formatDeclaration.js.map +1 -1
- package/dist/subsystem/model.d.ts +38 -0
- package/dist/subsystem/model.d.ts.map +1 -1
- package/dist/subsystem/model.js.map +1 -1
- package/dist/subsystem/nodes.d.ts.map +1 -1
- package/dist/subsystem/nodes.js +124 -67
- package/dist/subsystem/nodes.js.map +1 -1
- package/dist/subsystem/symbolRefs.d.ts.map +1 -1
- package/dist/subsystem/symbolRefs.js +2 -0
- package/dist/subsystem/symbolRefs.js.map +1 -1
- package/package.json +3 -3
- package/src/graphify/consolidated.ts +8 -0
- package/src/graphify/construct.test.ts +61 -1
- package/src/graphify/construct.ts +33 -0
- package/src/graphify/index.ts +6 -1
- package/src/index.ts +1 -0
- package/src/stories/Subsystem/ComponentGraph/IssueOverlay.stories.tsx +625 -0
- package/src/stories/Subsystem/ComponentGraph/Issues.stories.tsx +7 -1
- package/src/stories/Subsystem/ComponentGraph/NodeAnatomy.stories.tsx +40 -73
- package/src/stories/Subsystem/ComponentGraph/StoreValueType.stories.tsx +261 -0
- package/src/stories/Subsystem/StoreValueTypeDeclaration.stories.tsx +182 -0
- package/src/subsystem/IssueList.focus.test.tsx +113 -0
- package/src/subsystem/IssueList.icon.test.tsx +95 -0
- package/src/subsystem/IssueList.tsx +267 -111
- package/src/subsystem/SubsystemComponentGraph.tsx +530 -12
- package/src/subsystem/formatDeclaration.test.ts +64 -0
- package/src/subsystem/formatDeclaration.ts +20 -5
- package/src/subsystem/model.ts +46 -0
- package/src/subsystem/nodes.group.test.tsx +52 -0
- package/src/subsystem/nodes.tsx +102 -2
- 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 {
|
|
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
|
+
}
|
package/src/graphify/index.ts
CHANGED
|
@@ -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,
|