@intent-framework/core 0.1.0-alpha.4 → 0.1.0-alpha.6
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/graph.d.ts +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +24 -2
- package/package.json +1 -1
package/dist/graph.d.ts
CHANGED
|
@@ -2,12 +2,17 @@ import type { ScreenDefinition } from "./screen.js";
|
|
|
2
2
|
import type { DefaultScreenServices } from "./act.js";
|
|
3
3
|
import type { AnyResourceNode } from "./resource.js";
|
|
4
4
|
export type DiagnosticSeverity = "info" | "warning" | "error";
|
|
5
|
+
export type FlowDiagnosticMeta = {
|
|
6
|
+
flowNodeId: string;
|
|
7
|
+
flowSemanticNodeId?: string;
|
|
8
|
+
};
|
|
5
9
|
export type GraphDiagnostic = {
|
|
6
10
|
severity: DiagnosticSeverity;
|
|
7
11
|
code: string;
|
|
8
12
|
message: string;
|
|
9
13
|
nodeId?: string;
|
|
10
14
|
semanticNodeId?: string;
|
|
15
|
+
flow?: FlowDiagnosticMeta;
|
|
11
16
|
};
|
|
12
17
|
export type InspectedScreen = {
|
|
13
18
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { screen } from "./screen.js";
|
|
2
2
|
export type { ScreenDefinition, ScreenBuilder } from "./screen.js";
|
|
3
3
|
export { inspectScreen } from "./graph.js";
|
|
4
|
-
export type { InspectedScreen, GraphDiagnostic, DiagnosticSeverity } from "./graph.js";
|
|
4
|
+
export type { InspectedScreen, GraphDiagnostic, DiagnosticSeverity, FlowDiagnosticMeta } from "./graph.js";
|
|
5
5
|
export type { TextState, BooleanState, ChoiceState } from "./state.js";
|
|
6
6
|
export type { AskNode, AnyAskNode, AskKind, AskBuilder } from "./ask.js";
|
|
7
7
|
export type { ActNode, ActCondition, ActStatus, FeedbackConfig, ActBuilder, NavigationService, ActionExecutionContext, DefaultScreenServices } from "./act.js";
|
package/dist/index.js
CHANGED
|
@@ -764,6 +764,22 @@ function computeDiagnostics(screenDef) {
|
|
|
764
764
|
if (screenDef.flows.length > 0) {
|
|
765
765
|
const flowNodeIds = /* @__PURE__ */ new Set();
|
|
766
766
|
for (const flow of screenDef.flows) for (const step of flow.steps) flowNodeIds.add(step.node.id);
|
|
767
|
+
for (const flow of screenDef.flows) for (const step of flow.steps) if (!surfacedNodeIds.has(step.node.id)) diagnostics.push({
|
|
768
|
+
severity: "warning",
|
|
769
|
+
code: "flow-step-not-surfaced",
|
|
770
|
+
message: `"${step.node.label}" is a flow step but not included in any surface.`,
|
|
771
|
+
nodeId: step.node.id,
|
|
772
|
+
flow: { flowNodeId: flow.id }
|
|
773
|
+
});
|
|
774
|
+
for (const flow of screenDef.flows) if (flow.steps.length > 0) {
|
|
775
|
+
const hasSurfacedStep = flow.steps.some((step) => surfacedNodeIds.has(step.node.id));
|
|
776
|
+
if (!hasSurfacedStep) diagnostics.push({
|
|
777
|
+
severity: "warning",
|
|
778
|
+
code: "orphaned-flow",
|
|
779
|
+
message: `"${flow.name}" has no surfaced steps.`,
|
|
780
|
+
flow: { flowNodeId: flow.id }
|
|
781
|
+
});
|
|
782
|
+
}
|
|
767
783
|
for (const ask of screenDef.asks) if (surfacedNodeIds.has(ask.id) && !flowNodeIds.has(ask.id)) diagnostics.push({
|
|
768
784
|
severity: "info",
|
|
769
785
|
code: "surfaced-node-not-in-any-flow",
|
|
@@ -789,9 +805,15 @@ function inspectScreen(screenDef, runtimeResources) {
|
|
|
789
805
|
const idToSemantic = /* @__PURE__ */ new Map();
|
|
790
806
|
for (const a of screenDef.asks) idToSemantic.set(a.id, askIds(a.label));
|
|
791
807
|
for (const a of screenDef.acts) idToSemantic.set(a.id, actIds(a.label));
|
|
808
|
+
const idToFlowSemantic = /* @__PURE__ */ new Map();
|
|
809
|
+
for (const f of screenDef.flows) idToFlowSemantic.set(f.id, flowIds(f.name));
|
|
792
810
|
const augmentedDiagnostics = diagnostics.map((d) => ({
|
|
793
811
|
...d,
|
|
794
|
-
semanticNodeId: d.nodeId ? idToSemantic.get(d.nodeId) : void 0
|
|
812
|
+
semanticNodeId: d.nodeId ? idToSemantic.get(d.nodeId) : void 0,
|
|
813
|
+
flow: d.flow ? {
|
|
814
|
+
...d.flow,
|
|
815
|
+
flowSemanticNodeId: idToFlowSemantic.get(d.flow.flowNodeId)
|
|
816
|
+
} : void 0
|
|
795
817
|
}));
|
|
796
818
|
return {
|
|
797
819
|
name: screenDef.name,
|
|
@@ -819,7 +841,7 @@ function inspectScreen(screenDef, runtimeResources) {
|
|
|
819
841
|
})),
|
|
820
842
|
flows: screenDef.flows.map((f) => ({
|
|
821
843
|
id: f.id,
|
|
822
|
-
semanticId:
|
|
844
|
+
semanticId: idToFlowSemantic.get(f.id),
|
|
823
845
|
name: f.name,
|
|
824
846
|
stepCount: f.steps.length
|
|
825
847
|
})),
|