@exellix/graph-composer 2.0.9 → 2.1.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/README.md +1 -0
- package/dist/canonicalGraphDocument.d.ts.map +1 -1
- package/dist/canonicalGraphDocument.js +1 -0
- package/dist/canonicalGraphWarnings.d.ts.map +1 -1
- package/dist/canonicalGraphWarnings.js +1 -0
- package/dist/graphEngineBridge.d.ts +1 -1
- package/dist/graphEngineBridge.d.ts.map +1 -1
- package/dist/graphEngineBridge.js +1 -1
- package/dist/graphModelLayers.d.ts +91 -0
- package/dist/graphModelLayers.d.ts.map +1 -0
- package/dist/graphModelLayers.js +322 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/functions/graph-composer/metadata/log-diagnostics.json +20 -20
- package/functions/graph-composer/prompts/action-explain.md +2 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -283,6 +283,7 @@ graph-composer explain-basic
|
|
|
283
283
|
| `loadCatalogCandidatesFromCatalox`, `createCatalox`, `unifiedCatalogItemToSkillDescriptor`, … | Build `catalogCandidates` from **Catalox** catalogs; see [`docs/catalog-metadb-end-state-contract.md`](./docs/catalog-metadb-end-state-contract.md). |
|
|
284
284
|
| `reportTaskNodeProtocolGaps` | Offline list of **AI task** nodes violating **`taskConfiguration.aiTaskProfile`** (pre/post, **`webScoping.questions`** when enabled, **`inputSynthesis`** fields when synthesis is on). See `docs/task-node-execution-protocol.md`. |
|
|
285
285
|
| `collectCanonicalGraphWarnings` | Warn-first **`@exellix/graph-engine`** canonical checks (top-level keys, metadata placement, memory paths, model profile aliases). |
|
|
286
|
+
| `analyzeGraphModelLayers`, `stampGraphModelLayersOnGraph`, `graphModelLayerLegend` | **Model map** for AI nodes: which `@x12i/ai-profiles` names win (PRE/MAIN/POST), resolved provider ids, precedence layer + color stack — **model JSON only** unless you pass an explicit `runtime` overlay. Stamp with `stampGraphModelLayersOnGraph` before explain/UI. |
|
|
286
287
|
| `assertCanonicalGraphDocument` | Re-exported from graph-engine — **`validateCreateModifyOutput` hard-fails** when the canonicalized graph does not pass. |
|
|
287
288
|
| `GRAPH_ENGINE_MEMORY_PATH_ROOTS` | Re-exported memory path allowlist from graph-engine — use for validation parity, not a forked copy. |
|
|
288
289
|
| `WoroxScopingMapCatalogCreatePayload`, `WoroxScopedDataDocumentShape` | Host-side CRUD handoff (align field names with your persisted catalog / scoping schema). |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonicalGraphDocument.d.ts","sourceRoot":"","sources":["../src/canonicalGraphDocument.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"canonicalGraphDocument.d.ts","sourceRoot":"","sources":["../src/canonicalGraphDocument.ts"],"names":[],"mappings":"AAAA;;GAEG;AAmbH,qFAAqF;AACrF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAc7E;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAiCtF;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAWpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonicalGraphWarnings.d.ts","sourceRoot":"","sources":["../src/canonicalGraphWarnings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"canonicalGraphWarnings.d.ts","sourceRoot":"","sources":["../src/canonicalGraphWarnings.ts"],"names":[],"mappings":"AAwIA;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAuHrE"}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Re-exports from `@exellix/graph-engine` so hosts validate graphs with the same
|
|
3
3
|
* rules as runtime — do not fork gap codes or memory path allowlists here.
|
|
4
4
|
*/
|
|
5
|
-
export { assertCanonicalGraphDocument, getCanonicalGraphDocumentViolations, CANONICAL_GRAPH_TOP_LEVEL_KEYS, GRAPH_ENGINE_MEMORY_PATH_ROOTS, isAllowedGraphEngineMemoryPath, collectAiTasksNodeExtensionIssues, assertAiTasksNodeExtensionsValid, resolveGraphEngineMemoryPathValue, buildGraphEngineMemoryResolutionRootFromWorkingMemory, DEFAULT_GRAPH_AI_MODEL_PROFILE_CONFIG, looksLikeConcreteModelId, isGraphAiProfileName, } from "@exellix/graph-engine";
|
|
5
|
+
export { assertCanonicalGraphDocument, getCanonicalGraphDocumentViolations, CANONICAL_GRAPH_TOP_LEVEL_KEYS, GRAPH_ENGINE_MEMORY_PATH_ROOTS, isAllowedGraphEngineMemoryPath, collectAiTasksNodeExtensionIssues, assertAiTasksNodeExtensionsValid, resolveGraphEngineMemoryPathValue, buildGraphEngineMemoryResolutionRootFromWorkingMemory, DEFAULT_GRAPH_AI_MODEL_PROFILE_CONFIG, looksLikeConcreteModelId, isGraphAiProfileName, isGraphAiModelConfig, isModelConfigSelection, resolveGraphAiModelConfig, } from "@exellix/graph-engine";
|
|
6
6
|
export type { GraphEngineMemoryResolutionRoot } from "@exellix/graph-engine";
|
|
7
7
|
//# sourceMappingURL=graphEngineBridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphEngineBridge.d.ts","sourceRoot":"","sources":["../src/graphEngineBridge.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,4BAA4B,EAC5B,mCAAmC,EACnC,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,iCAAiC,EACjC,gCAAgC,EAChC,iCAAiC,EACjC,qDAAqD,EACrD,qCAAqC,EACrC,wBAAwB,EACxB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"graphEngineBridge.d.ts","sourceRoot":"","sources":["../src/graphEngineBridge.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,4BAA4B,EAC5B,mCAAmC,EACnC,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,iCAAiC,EACjC,gCAAgC,EAChC,iCAAiC,EACjC,qDAAqD,EACrD,qCAAqC,EACrC,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Re-exports from `@exellix/graph-engine` so hosts validate graphs with the same
|
|
3
3
|
* rules as runtime — do not fork gap codes or memory path allowlists here.
|
|
4
4
|
*/
|
|
5
|
-
export { assertCanonicalGraphDocument, getCanonicalGraphDocumentViolations, CANONICAL_GRAPH_TOP_LEVEL_KEYS, GRAPH_ENGINE_MEMORY_PATH_ROOTS, isAllowedGraphEngineMemoryPath, collectAiTasksNodeExtensionIssues, assertAiTasksNodeExtensionsValid, resolveGraphEngineMemoryPathValue, buildGraphEngineMemoryResolutionRootFromWorkingMemory, DEFAULT_GRAPH_AI_MODEL_PROFILE_CONFIG, looksLikeConcreteModelId, isGraphAiProfileName, } from "@exellix/graph-engine";
|
|
5
|
+
export { assertCanonicalGraphDocument, getCanonicalGraphDocumentViolations, CANONICAL_GRAPH_TOP_LEVEL_KEYS, GRAPH_ENGINE_MEMORY_PATH_ROOTS, isAllowedGraphEngineMemoryPath, collectAiTasksNodeExtensionIssues, assertAiTasksNodeExtensionsValid, resolveGraphEngineMemoryPathValue, buildGraphEngineMemoryResolutionRootFromWorkingMemory, DEFAULT_GRAPH_AI_MODEL_PROFILE_CONFIG, looksLikeConcreteModelId, isGraphAiProfileName, isGraphAiModelConfig, isModelConfigSelection, resolveGraphAiModelConfig, } from "@exellix/graph-engine";
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/** Precedence layer ids (lowest number = wins when present). Matches @exellix/graph-engine 7.2. */
|
|
2
|
+
export type GraphModelLayerSource = "runtime.nodes.modelConfig" | "node.taskConfiguration.modelConfig" | "runtime.modelConfig" | "graph.modelConfig" | "graph-engine.default";
|
|
3
|
+
export type GraphModelLayerPhase = "preActionModel" | "skillModel" | "postActionModel";
|
|
4
|
+
/** Same three slots as `GraphAiModelConfig` in @exellix/graph-engine (profile names or concrete ids). */
|
|
5
|
+
export type GraphModelProfilesTriple = {
|
|
6
|
+
preActionModel: string;
|
|
7
|
+
skillModel: string;
|
|
8
|
+
postActionModel: string;
|
|
9
|
+
};
|
|
10
|
+
export type GraphModelLayerStackEntry = {
|
|
11
|
+
/** Stable layer id for UI / explain output. */
|
|
12
|
+
source: GraphModelLayerSource;
|
|
13
|
+
/** Dot-path style location, e.g. `graph.modelConfig.cases[0]`. */
|
|
14
|
+
sourcePath: string;
|
|
15
|
+
/** Hex color for diagram overlays (stack order uses `layerOrder`). */
|
|
16
|
+
layerColor: string;
|
|
17
|
+
/** 1 = highest precedence (runtime node); 5 = engine default. */
|
|
18
|
+
layerOrder: number;
|
|
19
|
+
/** True when this layer is the effective winner for the node (model-only or with runtime). */
|
|
20
|
+
active: boolean;
|
|
21
|
+
profiles: GraphModelProfilesTriple;
|
|
22
|
+
/** Set when `profiles` were resolved through bundled @x12i/ai-profiles. */
|
|
23
|
+
providerIds?: GraphModelProfilesTriple;
|
|
24
|
+
/** Present when the tier uses conditional cases and no execution context was supplied. */
|
|
25
|
+
conditionalNote?: string;
|
|
26
|
+
};
|
|
27
|
+
export type NodeGraphModelLayers = {
|
|
28
|
+
nodeId: string;
|
|
29
|
+
skillKey: string;
|
|
30
|
+
winning: Pick<GraphModelLayerStackEntry, "source" | "sourcePath" | "layerColor" | "layerOrder" | "profiles" | "providerIds">;
|
|
31
|
+
/** All declared tiers on this graph/run (map layers), highest precedence first. */
|
|
32
|
+
stack: GraphModelLayerStackEntry[];
|
|
33
|
+
};
|
|
34
|
+
export type GraphModelLayersAnalysis = {
|
|
35
|
+
analyzedAt: string;
|
|
36
|
+
/** False when `runtime` was omitted — analysis reflects model JSON + engine default only. */
|
|
37
|
+
runtimeIncluded: boolean;
|
|
38
|
+
graphDefaultProfiles: GraphModelProfilesTriple;
|
|
39
|
+
graphDefaultProviderIds?: GraphModelProfilesTriple;
|
|
40
|
+
nodes: NodeGraphModelLayers[];
|
|
41
|
+
};
|
|
42
|
+
export type GraphModelLayersRuntimeOverlay = {
|
|
43
|
+
modelConfig?: unknown;
|
|
44
|
+
nodes?: Record<string, {
|
|
45
|
+
modelConfig?: unknown;
|
|
46
|
+
} | undefined>;
|
|
47
|
+
};
|
|
48
|
+
export type AnalyzeGraphModelLayersOptions = {
|
|
49
|
+
/**
|
|
50
|
+
* Optional runtime overlay. Omit to analyze **model-authored** config only (recommended).
|
|
51
|
+
* Do not inject `runtime.modelConfig` at execute time unless you intend to override the graph.
|
|
52
|
+
*/
|
|
53
|
+
runtime?: GraphModelLayersRuntimeOverlay;
|
|
54
|
+
utilitySkills?: Iterable<{
|
|
55
|
+
skillKey?: string;
|
|
56
|
+
}>;
|
|
57
|
+
extraLocalSkillKeys?: Iterable<string>;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Where runtime logs the resolved model (for operators debugging failed tasks):
|
|
61
|
+
* - `RunTaskRequest.modelConfig` (wire: `xynthesisModel` / `skillModel` per phase)
|
|
62
|
+
* - skill-executions / ai-actions / runTask diagnostics when level is not `basic`
|
|
63
|
+
* - `resolveCanonicalModelUsed(runTaskResponse)` after the call (authoritative provider id)
|
|
64
|
+
*
|
|
65
|
+
* This function answers the **authoring / planning** view from graph JSON (+ optional runtime overlay).
|
|
66
|
+
*/
|
|
67
|
+
export declare function analyzeGraphModelLayers(graph: object, options?: AnalyzeGraphModelLayersOptions): Promise<GraphModelLayersAnalysis>;
|
|
68
|
+
/** Profile accent color for UI badges (MAIN slot). */
|
|
69
|
+
export declare function graphModelProfileAccent(profileName: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Human-readable legend for diagram tools (source → color → meaning).
|
|
72
|
+
*/
|
|
73
|
+
export declare function graphModelLayerLegend(): Array<{
|
|
74
|
+
source: GraphModelLayerSource;
|
|
75
|
+
layerColor: string;
|
|
76
|
+
label: string;
|
|
77
|
+
layerOrder: number;
|
|
78
|
+
}>;
|
|
79
|
+
/**
|
|
80
|
+
* Stamp `metadata.graphModelLayers` on each AI task node (planning-only; not read by graph-engine).
|
|
81
|
+
* Does not mutate `runtime` and does not add runtime model overrides.
|
|
82
|
+
*/
|
|
83
|
+
export declare function stampGraphModelLayersOnGraph<T extends object>(graph: T, options?: AnalyzeGraphModelLayersOptions): Promise<T>;
|
|
84
|
+
/** Resolve a single profile name to provider/model id (for docs and explain text). */
|
|
85
|
+
export declare function resolveGraphModelProfileName(profileName: string): Promise<{
|
|
86
|
+
profile: string;
|
|
87
|
+
provider: string;
|
|
88
|
+
modelId: string;
|
|
89
|
+
formatted: string;
|
|
90
|
+
}>;
|
|
91
|
+
//# sourceMappingURL=graphModelLayers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphModelLayers.d.ts","sourceRoot":"","sources":["../src/graphModelLayers.ts"],"names":[],"mappings":"AAaA,mGAAmG;AACnG,MAAM,MAAM,qBAAqB,GAC7B,2BAA2B,GAC3B,oCAAoC,GACpC,qBAAqB,GACrB,mBAAmB,GACnB,sBAAsB,CAAC;AAE3B,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG,YAAY,GAAG,iBAAiB,CAAC;AAEvF,yGAAyG;AACzG,MAAM,MAAM,wBAAwB,GAAG;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,+CAA+C;IAC/C,MAAM,EAAE,qBAAqB,CAAC;IAC9B,kEAAkE;IAClE,UAAU,EAAE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MAAM,CAAC,CAAC;CACxC,CAAC;AA0JF;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,8BAA8B,GACvC,OAAO,CAAC,wBAAwB,CAAC,CAuInC;AAED,sDAAsD;AACtD,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAGnE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,KAAK,CAAC;IAC7C,MAAM,EAAE,qBAAqB,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAKD;AAED;;;GAGG;AACH,wBAAsB,4BAA4B,CAAC,CAAC,SAAS,MAAM,EACjE,KAAK,EAAE,CAAC,EACR,OAAO,CAAC,EAAE,8BAA8B,GACvC,OAAO,CAAC,CAAC,CAAC,CAyCZ;AAED,sFAAsF;AACtF,wBAAsB,4BAA4B,CAChD,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAYpF"}
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model resolution map for worox graphs: which @x12i/ai-profiles names apply per AI node,
|
|
3
|
+
* which precedence layer wins, and resolved provider ids — without forcing runtime overrides.
|
|
4
|
+
*/
|
|
5
|
+
import { resolveAIProfile } from "@x12i/ai-profiles";
|
|
6
|
+
import { DEFAULT_GRAPH_AI_MODEL_PROFILE_CONFIG, isGraphAiModelConfig, isModelConfigSelection, resolveGraphAiModelConfig, } from "./graphEngineBridge.js";
|
|
7
|
+
import { DEFAULT_LOCAL_SKILL_KEYS } from "./aiTaskProfile.js";
|
|
8
|
+
const LAYER_META = {
|
|
9
|
+
"runtime.nodes.modelConfig": {
|
|
10
|
+
layerOrder: 1,
|
|
11
|
+
layerColor: "#dc2626",
|
|
12
|
+
label: "runtime node override",
|
|
13
|
+
},
|
|
14
|
+
"node.taskConfiguration.modelConfig": {
|
|
15
|
+
layerOrder: 2,
|
|
16
|
+
layerColor: "#ea580c",
|
|
17
|
+
label: "per-node model (graph)",
|
|
18
|
+
},
|
|
19
|
+
"runtime.modelConfig": {
|
|
20
|
+
layerOrder: 3,
|
|
21
|
+
layerColor: "#ca8a04",
|
|
22
|
+
label: "runtime graph override",
|
|
23
|
+
},
|
|
24
|
+
"graph.modelConfig": {
|
|
25
|
+
layerOrder: 4,
|
|
26
|
+
layerColor: "#2563eb",
|
|
27
|
+
label: "graph default model",
|
|
28
|
+
},
|
|
29
|
+
"graph-engine.default": {
|
|
30
|
+
layerOrder: 5,
|
|
31
|
+
layerColor: "#6b7280",
|
|
32
|
+
label: "engine default (@exellix/graph-engine)",
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
/** Distinct accent per profile name for MAIN slot badges in UIs. */
|
|
36
|
+
const PROFILE_ACCENT = {
|
|
37
|
+
cheap: "#16a34a",
|
|
38
|
+
balanced: "#2563eb",
|
|
39
|
+
deep: "#7c3aed",
|
|
40
|
+
strong: "#9333ea",
|
|
41
|
+
weak: "#84cc16",
|
|
42
|
+
};
|
|
43
|
+
function readRecord(v) {
|
|
44
|
+
if (v === null || v === undefined || typeof v !== "object" || Array.isArray(v)) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
return v;
|
|
48
|
+
}
|
|
49
|
+
function localSkillKeys(options) {
|
|
50
|
+
const s = new Set(DEFAULT_LOCAL_SKILL_KEYS);
|
|
51
|
+
for (const u of options?.utilitySkills ?? []) {
|
|
52
|
+
if (typeof u.skillKey === "string" && u.skillKey.trim() !== "") {
|
|
53
|
+
s.add(u.skillKey.trim());
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
for (const k of options?.extraLocalSkillKeys ?? []) {
|
|
57
|
+
if (typeof k === "string" && k.trim() !== "")
|
|
58
|
+
s.add(k.trim());
|
|
59
|
+
}
|
|
60
|
+
return s;
|
|
61
|
+
}
|
|
62
|
+
function describeModelConfigTier(value, basePath) {
|
|
63
|
+
if (isGraphAiModelConfig(value)) {
|
|
64
|
+
return { profiles: value, sourcePath: basePath };
|
|
65
|
+
}
|
|
66
|
+
if (!isModelConfigSelection(value)) {
|
|
67
|
+
return { sourcePath: basePath };
|
|
68
|
+
}
|
|
69
|
+
const cases = value.cases;
|
|
70
|
+
if (!Array.isArray(cases) || cases.length === 0) {
|
|
71
|
+
return { sourcePath: basePath, conditionalNote: "empty cases[]" };
|
|
72
|
+
}
|
|
73
|
+
const unconditional = cases.find((c) => c.when === undefined || c.when === null);
|
|
74
|
+
if (unconditional?.modelConfig && isGraphAiModelConfig(unconditional.modelConfig)) {
|
|
75
|
+
const idx = cases.indexOf(unconditional);
|
|
76
|
+
return {
|
|
77
|
+
profiles: unconditional.modelConfig,
|
|
78
|
+
sourcePath: `${basePath}.cases[${idx}]`,
|
|
79
|
+
conditionalNote: cases.length > 1
|
|
80
|
+
? "static analysis uses default case (no when); other cases need runtime gates"
|
|
81
|
+
: undefined,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const first = cases[0];
|
|
85
|
+
if (first?.modelConfig && isGraphAiModelConfig(first.modelConfig)) {
|
|
86
|
+
return {
|
|
87
|
+
profiles: first.modelConfig,
|
|
88
|
+
sourcePath: `${basePath}.cases[0]`,
|
|
89
|
+
conditionalNote: "no unconditional case — showing cases[0] only; runtime may pick another",
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return { sourcePath: basePath, conditionalNote: "could not read modelConfig from cases" };
|
|
93
|
+
}
|
|
94
|
+
async function resolveProviderTriple(profiles, context) {
|
|
95
|
+
return resolveGraphAiModelConfig(profiles, context);
|
|
96
|
+
}
|
|
97
|
+
function buildStackEntry(source, sourcePath, profiles, active, conditionalNote, providerIds) {
|
|
98
|
+
if (profiles === undefined)
|
|
99
|
+
return undefined;
|
|
100
|
+
const meta = LAYER_META[source];
|
|
101
|
+
return {
|
|
102
|
+
source,
|
|
103
|
+
sourcePath,
|
|
104
|
+
layerColor: meta.layerColor,
|
|
105
|
+
layerOrder: meta.layerOrder,
|
|
106
|
+
active,
|
|
107
|
+
profiles,
|
|
108
|
+
...(providerIds !== undefined ? { providerIds } : {}),
|
|
109
|
+
...(conditionalNote !== undefined ? { conditionalNote } : {}),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
async function resolveWinningTier(tiers) {
|
|
113
|
+
for (const tier of tiers) {
|
|
114
|
+
const described = describeModelConfigTier(tier.value, tier.basePath);
|
|
115
|
+
if (described.profiles !== undefined) {
|
|
116
|
+
return {
|
|
117
|
+
source: tier.source,
|
|
118
|
+
sourcePath: described.sourcePath,
|
|
119
|
+
profiles: described.profiles,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
source: "graph-engine.default",
|
|
125
|
+
sourcePath: "@exellix/graph-engine DEFAULT_GRAPH_AI_MODEL_PROFILE_CONFIG",
|
|
126
|
+
profiles: { ...DEFAULT_GRAPH_AI_MODEL_PROFILE_CONFIG },
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Where runtime logs the resolved model (for operators debugging failed tasks):
|
|
131
|
+
* - `RunTaskRequest.modelConfig` (wire: `xynthesisModel` / `skillModel` per phase)
|
|
132
|
+
* - skill-executions / ai-actions / runTask diagnostics when level is not `basic`
|
|
133
|
+
* - `resolveCanonicalModelUsed(runTaskResponse)` after the call (authoritative provider id)
|
|
134
|
+
*
|
|
135
|
+
* This function answers the **authoring / planning** view from graph JSON (+ optional runtime overlay).
|
|
136
|
+
*/
|
|
137
|
+
export async function analyzeGraphModelLayers(graph, options) {
|
|
138
|
+
const g = graph;
|
|
139
|
+
const graphId = typeof g.id === "string" ? g.id : undefined;
|
|
140
|
+
const runtime = options?.runtime;
|
|
141
|
+
const runtimeIncluded = runtime !== undefined;
|
|
142
|
+
const locals = localSkillKeys(options);
|
|
143
|
+
const graphTier = describeModelConfigTier(g.modelConfig, "graph.modelConfig");
|
|
144
|
+
const graphDefaultProfiles = graphTier.profiles ?? { ...DEFAULT_GRAPH_AI_MODEL_PROFILE_CONFIG };
|
|
145
|
+
const graphDefaultProviderIds = await resolveProviderTriple(graphDefaultProfiles, {
|
|
146
|
+
graphId,
|
|
147
|
+
});
|
|
148
|
+
const nodes = [];
|
|
149
|
+
const nodeList = g.nodes;
|
|
150
|
+
if (!Array.isArray(nodeList)) {
|
|
151
|
+
return {
|
|
152
|
+
analyzedAt: new Date().toISOString(),
|
|
153
|
+
runtimeIncluded,
|
|
154
|
+
graphDefaultProfiles,
|
|
155
|
+
graphDefaultProviderIds,
|
|
156
|
+
nodes,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
for (const n of nodeList) {
|
|
160
|
+
const node = readRecord(n);
|
|
161
|
+
if (node === undefined)
|
|
162
|
+
continue;
|
|
163
|
+
if (node.type !== undefined && node.type !== "task")
|
|
164
|
+
continue;
|
|
165
|
+
const nodeId = typeof node.id === "string" ? node.id : "";
|
|
166
|
+
const skillKey = typeof node.skillKey === "string" ? node.skillKey.trim() : "";
|
|
167
|
+
if (nodeId === "" || skillKey === "" || locals.has(skillKey))
|
|
168
|
+
continue;
|
|
169
|
+
const tc = readRecord(node.taskConfiguration);
|
|
170
|
+
const runtimeNode = runtime?.nodes?.[nodeId];
|
|
171
|
+
const runtimeNodeMc = readRecord(runtimeNode)?.modelConfig;
|
|
172
|
+
const tiers = [];
|
|
173
|
+
if (runtimeIncluded && runtimeNodeMc !== undefined) {
|
|
174
|
+
tiers.push({
|
|
175
|
+
source: "runtime.nodes.modelConfig",
|
|
176
|
+
basePath: `runtime.nodes["${nodeId}"].modelConfig`,
|
|
177
|
+
value: runtimeNodeMc,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
if (tc?.modelConfig !== undefined) {
|
|
181
|
+
tiers.push({
|
|
182
|
+
source: "node.taskConfiguration.modelConfig",
|
|
183
|
+
basePath: `nodes["${nodeId}"].taskConfiguration.modelConfig`,
|
|
184
|
+
value: tc.modelConfig,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
if (runtimeIncluded && runtime?.modelConfig !== undefined) {
|
|
188
|
+
tiers.push({
|
|
189
|
+
source: "runtime.modelConfig",
|
|
190
|
+
basePath: "runtime.modelConfig",
|
|
191
|
+
value: runtime.modelConfig,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
if (g.modelConfig !== undefined) {
|
|
195
|
+
tiers.push({
|
|
196
|
+
source: "graph.modelConfig",
|
|
197
|
+
basePath: "graph.modelConfig",
|
|
198
|
+
value: g.modelConfig,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
const winning = await resolveWinningTier(tiers);
|
|
202
|
+
const winningProviderIds = await resolveProviderTriple(winning.profiles, {
|
|
203
|
+
graphId,
|
|
204
|
+
nodeId,
|
|
205
|
+
});
|
|
206
|
+
const stack = [];
|
|
207
|
+
const pushTier = async (tier) => {
|
|
208
|
+
const described = describeModelConfigTier(tier.value, tier.basePath);
|
|
209
|
+
if (described.profiles === undefined)
|
|
210
|
+
return;
|
|
211
|
+
const providerIds = await resolveProviderTriple(described.profiles, {
|
|
212
|
+
graphId,
|
|
213
|
+
nodeId,
|
|
214
|
+
});
|
|
215
|
+
const entry = buildStackEntry(tier.source, described.sourcePath, described.profiles, tier.source === winning.source && described.sourcePath === winning.sourcePath, described.conditionalNote, providerIds);
|
|
216
|
+
if (entry !== undefined)
|
|
217
|
+
stack.push(entry);
|
|
218
|
+
};
|
|
219
|
+
for (const tier of tiers) {
|
|
220
|
+
await pushTier(tier);
|
|
221
|
+
}
|
|
222
|
+
const defaultEntry = buildStackEntry("graph-engine.default", "@exellix/graph-engine DEFAULT_GRAPH_AI_MODEL_PROFILE_CONFIG", { ...DEFAULT_GRAPH_AI_MODEL_PROFILE_CONFIG }, winning.source === "graph-engine.default", tiers.length === 0
|
|
223
|
+
? "no modelConfig on graph or node — engine default applies"
|
|
224
|
+
: undefined, await resolveProviderTriple(DEFAULT_GRAPH_AI_MODEL_PROFILE_CONFIG, { graphId, nodeId }));
|
|
225
|
+
if (defaultEntry !== undefined) {
|
|
226
|
+
stack.push(defaultEntry);
|
|
227
|
+
}
|
|
228
|
+
stack.sort((a, b) => a.layerOrder - b.layerOrder);
|
|
229
|
+
nodes.push({
|
|
230
|
+
nodeId,
|
|
231
|
+
skillKey,
|
|
232
|
+
winning: {
|
|
233
|
+
source: winning.source,
|
|
234
|
+
sourcePath: winning.sourcePath,
|
|
235
|
+
layerColor: LAYER_META[winning.source].layerColor,
|
|
236
|
+
layerOrder: LAYER_META[winning.source].layerOrder,
|
|
237
|
+
profiles: winning.profiles,
|
|
238
|
+
providerIds: winningProviderIds,
|
|
239
|
+
},
|
|
240
|
+
stack,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
analyzedAt: new Date().toISOString(),
|
|
245
|
+
runtimeIncluded,
|
|
246
|
+
graphDefaultProfiles,
|
|
247
|
+
graphDefaultProviderIds,
|
|
248
|
+
nodes,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
/** Profile accent color for UI badges (MAIN slot). */
|
|
252
|
+
export function graphModelProfileAccent(profileName) {
|
|
253
|
+
const key = profileName.trim().toLowerCase();
|
|
254
|
+
return PROFILE_ACCENT[key] ?? "#64748b";
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Human-readable legend for diagram tools (source → color → meaning).
|
|
258
|
+
*/
|
|
259
|
+
export function graphModelLayerLegend() {
|
|
260
|
+
return Object.keys(LAYER_META).map((source) => ({
|
|
261
|
+
source,
|
|
262
|
+
...LAYER_META[source],
|
|
263
|
+
}));
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Stamp `metadata.graphModelLayers` on each AI task node (planning-only; not read by graph-engine).
|
|
267
|
+
* Does not mutate `runtime` and does not add runtime model overrides.
|
|
268
|
+
*/
|
|
269
|
+
export async function stampGraphModelLayersOnGraph(graph, options) {
|
|
270
|
+
const analysis = await analyzeGraphModelLayers(graph, options);
|
|
271
|
+
const g = graph;
|
|
272
|
+
const byId = new Map(analysis.nodes.map((n) => [n.nodeId, n]));
|
|
273
|
+
const nodes = g.nodes;
|
|
274
|
+
if (!Array.isArray(nodes))
|
|
275
|
+
return graph;
|
|
276
|
+
for (const n of nodes) {
|
|
277
|
+
const node = readRecord(n);
|
|
278
|
+
if (node === undefined)
|
|
279
|
+
continue;
|
|
280
|
+
const nodeId = typeof node.id === "string" ? node.id : "";
|
|
281
|
+
const layer = byId.get(nodeId);
|
|
282
|
+
if (layer === undefined)
|
|
283
|
+
continue;
|
|
284
|
+
const meta = { ...readRecord(node.metadata) };
|
|
285
|
+
meta.graphModelLayers = {
|
|
286
|
+
...layer,
|
|
287
|
+
profileAccents: {
|
|
288
|
+
preActionModel: graphModelProfileAccent(layer.winning.profiles.preActionModel),
|
|
289
|
+
skillModel: graphModelProfileAccent(layer.winning.profiles.skillModel),
|
|
290
|
+
postActionModel: graphModelProfileAccent(layer.winning.profiles.postActionModel),
|
|
291
|
+
},
|
|
292
|
+
legend: graphModelLayerLegend(),
|
|
293
|
+
};
|
|
294
|
+
node.metadata = meta;
|
|
295
|
+
}
|
|
296
|
+
const rootMeta = { ...readRecord(g.metadata) };
|
|
297
|
+
rootMeta.graphModelLayersSummary = {
|
|
298
|
+
analyzedAt: analysis.analyzedAt,
|
|
299
|
+
runtimeIncluded: analysis.runtimeIncluded,
|
|
300
|
+
legend: graphModelLayerLegend(),
|
|
301
|
+
graphDefault: {
|
|
302
|
+
profiles: analysis.graphDefaultProfiles,
|
|
303
|
+
providerIds: analysis.graphDefaultProviderIds,
|
|
304
|
+
},
|
|
305
|
+
note: "Planning overlay only. At execute time @exellix/graph-engine resolves modelConfig (runtime.nodes → node → runtime → graph → default), then @x12i/ai-profiles maps profile names to provider ids. Omit runtime.modelConfig unless you intend to override the graph.",
|
|
306
|
+
};
|
|
307
|
+
g.metadata = rootMeta;
|
|
308
|
+
return graph;
|
|
309
|
+
}
|
|
310
|
+
/** Resolve a single profile name to provider/model id (for docs and explain text). */
|
|
311
|
+
export async function resolveGraphModelProfileName(profileName) {
|
|
312
|
+
const resolved = await resolveAIProfile(profileName.trim(), { source: "bundled" });
|
|
313
|
+
const formatted = resolved.modelId.includes("/")
|
|
314
|
+
? resolved.modelId
|
|
315
|
+
: `${resolved.provider}/${resolved.modelId}`;
|
|
316
|
+
return {
|
|
317
|
+
profile: resolved.profile,
|
|
318
|
+
provider: resolved.provider,
|
|
319
|
+
modelId: resolved.modelId,
|
|
320
|
+
formatted,
|
|
321
|
+
};
|
|
322
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export type { ParsedGraphConcept } from "./parseGraphConceptStory.js";
|
|
|
19
19
|
export { reportTaskNodeProtocolGaps, DEFAULT_LOCAL_SKILL_KEYS, type AiTaskProfileMetadata, type TaskNodeProtocolGap, type TaskNodeProtocolIssueCode, type WebScopingNodeConfig, type InputSynthesisNodeConfig, type InputSynthesisDestination, } from "./aiTaskProfile.js";
|
|
20
20
|
export { assertCanonicalGraphDocument, getCanonicalGraphDocumentViolations, CANONICAL_GRAPH_TOP_LEVEL_KEYS, GRAPH_ENGINE_MEMORY_PATH_ROOTS, isAllowedGraphEngineMemoryPath, collectAiTasksNodeExtensionIssues, assertAiTasksNodeExtensionsValid, resolveGraphEngineMemoryPathValue, buildGraphEngineMemoryResolutionRootFromWorkingMemory, DEFAULT_GRAPH_AI_MODEL_PROFILE_CONFIG, looksLikeConcreteModelId, isGraphAiProfileName, type GraphEngineMemoryResolutionRoot, } from "./graphEngineBridge.js";
|
|
21
21
|
export { collectCanonicalGraphWarnings } from "./canonicalGraphWarnings.js";
|
|
22
|
+
export { analyzeGraphModelLayers, stampGraphModelLayersOnGraph, graphModelLayerLegend, graphModelProfileAccent, resolveGraphModelProfileName, type AnalyzeGraphModelLayersOptions, type GraphModelLayerPhase, type GraphModelLayerSource, type GraphModelLayerStackEntry, type GraphModelLayersAnalysis, type GraphModelLayersRuntimeOverlay, type GraphModelProfilesTriple, type NodeGraphModelLayers, } from "./graphModelLayers.js";
|
|
22
23
|
export { resolveTaskNodeInputs, resolveTaskNodeInputsConfig, resolveTaskNodeTaskVariable, canonicalizeGraphTaskNodeTaskVariable, canonicalizeGraphModel, reportTaskNodeInputsLayoutIssues, taskNodeInputsLayoutWarningMessage, isTaskVariablePathRef, isTaskNode, isFinalizerNode, type TaskNodeInputsLayoutIssue, type TaskNodeInputsLayoutIssueCode, } from "./taskNodeTaskVariable.js";
|
|
23
24
|
export { createCatalox, bindCataloxContext, Catalox, CataloxBound, } from "@x12i/catalox/embedder";
|
|
24
25
|
export type { CataloxContext, CataloxRuntimeConfig, } from "@x12i/catalox/embedder";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,8BAA8B,EAC9B,mBAAmB,EACnB,6BAA6B,EAC7B,+BAA+B,EAC/B,sBAAsB,EACtB,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,GACnC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,0BAA0B,EAC1B,yBAAyB,EACzB,UAAU,EACV,mCAAmC,EACnC,oCAAoC,EACpC,mBAA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C"}
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export { parseGraphConceptStory, parseGraphConceptStoryBody, isGraphConceptStory
|
|
|
15
15
|
export { reportTaskNodeProtocolGaps, DEFAULT_LOCAL_SKILL_KEYS, } from "./aiTaskProfile.js";
|
|
16
16
|
export { assertCanonicalGraphDocument, getCanonicalGraphDocumentViolations, CANONICAL_GRAPH_TOP_LEVEL_KEYS, GRAPH_ENGINE_MEMORY_PATH_ROOTS, isAllowedGraphEngineMemoryPath, collectAiTasksNodeExtensionIssues, assertAiTasksNodeExtensionsValid, resolveGraphEngineMemoryPathValue, buildGraphEngineMemoryResolutionRootFromWorkingMemory, DEFAULT_GRAPH_AI_MODEL_PROFILE_CONFIG, looksLikeConcreteModelId, isGraphAiProfileName, } from "./graphEngineBridge.js";
|
|
17
17
|
export { collectCanonicalGraphWarnings } from "./canonicalGraphWarnings.js";
|
|
18
|
+
export { analyzeGraphModelLayers, stampGraphModelLayersOnGraph, graphModelLayerLegend, graphModelProfileAccent, resolveGraphModelProfileName, } from "./graphModelLayers.js";
|
|
18
19
|
export { resolveTaskNodeInputs, resolveTaskNodeInputsConfig, resolveTaskNodeTaskVariable, canonicalizeGraphTaskNodeTaskVariable, canonicalizeGraphModel, reportTaskNodeInputsLayoutIssues, taskNodeInputsLayoutWarningMessage, isTaskVariablePathRef, isTaskNode, isFinalizerNode, } from "./taskNodeTaskVariable.js";
|
|
19
20
|
export { createCatalox, bindCataloxContext, Catalox, CataloxBound, } from "@x12i/catalox/embedder";
|
|
20
21
|
export { loadCatalogCandidatesFromCatalox, unifiedCatalogItemToSkillDescriptor, unifiedCatalogItemToScopingMapCandidate, unifiedCatalogItemToNarrixTemplateCandidate, } from "./cataloxCatalogBridge.js";
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
{
|
|
2
|
-
"GRAPH_COMPOSER_WORKER_FAILED": {
|
|
3
|
-
"defaultLevel": "error",
|
|
4
|
-
"title": "Graph composer worker failed",
|
|
5
|
-
"impact": "The requested graph-composer action did not complete; callers receive no result.",
|
|
6
|
-
"possibleCauses": [
|
|
7
|
-
"OpenRouter or @x12i/funcx returned an error or timed out.",
|
|
8
|
-
"Model output failed action-specific validation.",
|
|
9
|
-
"Missing or invalid input (existingGraph, catalogCandidates, etc.)."
|
|
10
|
-
],
|
|
11
|
-
"remediation": [
|
|
12
|
-
"Set GRAPH_COMPOSER_LOGS_LEVEL=debug (or traceReviewConceptIo for reviewConcept).",
|
|
13
|
-
"Inspect the exception message and validation errors in logs.",
|
|
14
|
-
"Verify OPENROUTER_API_KEY and LLM model slugs."
|
|
15
|
-
],
|
|
16
|
-
"retryable": true,
|
|
17
|
-
"userActionRequired": false,
|
|
18
|
-
"confidence": "medium"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"GRAPH_COMPOSER_WORKER_FAILED": {
|
|
3
|
+
"defaultLevel": "error",
|
|
4
|
+
"title": "Graph composer worker failed",
|
|
5
|
+
"impact": "The requested graph-composer action did not complete; callers receive no result.",
|
|
6
|
+
"possibleCauses": [
|
|
7
|
+
"OpenRouter or @x12i/funcx returned an error or timed out.",
|
|
8
|
+
"Model output failed action-specific validation.",
|
|
9
|
+
"Missing or invalid input (existingGraph, catalogCandidates, etc.)."
|
|
10
|
+
],
|
|
11
|
+
"remediation": [
|
|
12
|
+
"Set GRAPH_COMPOSER_LOGS_LEVEL=debug (or traceReviewConceptIo for reviewConcept).",
|
|
13
|
+
"Inspect the exception message and validation errors in logs.",
|
|
14
|
+
"Verify OPENROUTER_API_KEY and LLM model slugs."
|
|
15
|
+
],
|
|
16
|
+
"retryable": true,
|
|
17
|
+
"userActionRequired": false,
|
|
18
|
+
"confidence": "medium"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -8,6 +8,7 @@ You are a graph architect for the **worox-graph** DAG execution format. Your out
|
|
|
8
8
|
- **`summary`**: 2–6 sentences: what the graph achieves end-to-end, main phases (ingest → transform → branch → infer → finalize), and where the canonical result appears.
|
|
9
9
|
- **`executionOrder`**: A topologically sensible sequence of **node ids**. For branches, you may use short inline notes in string elements (e.g. `"nodeB (when tier=high)"`) or group logically—clarity beats perfect formatting.
|
|
10
10
|
- **`nodeDescriptions`**: Array of objects with at least `nodeId`, `role` (one line), `reads` (memory paths, `inputs`, and `taskVariable` used), `writes` (output path or effect). Cover every task node; include the finalizer. If `focusNodeIds` is set, expand those nodes and keep others shorter.
|
|
11
|
+
- **`modelLayers`** (required when `metadata.graphModelLayers` / `graphModelLayersSummary` exist on the graph): For each **AI** task node, state the **winning** PRE/MAIN/POST profile names, resolved provider ids if stamped, **`sourcePath`** (where that triple was set — e.g. `graph-engine.default`, `graph.modelConfig`, `nodes["iq-…"].taskConfiguration.modelConfig`), and note that **runtime** overrides (`runtime.nodes[id].modelConfig`, `runtime.modelConfig`) are **not** in the graph JSON unless the host injected them at execute time. Use the stamped `stack` colors/legend when present. If no `graphModelLayers` metadata, say explicitly that the graph has **no** authored `modelConfig` and runs on **engine default** (`cheap` / `balanced` / `cheap` → bundled `@x12i/ai-profiles` provider ids).
|
|
11
12
|
- **`dataFlow`**: Prose: how data enters (`input.*`), which nodes write which execution-memory paths, and how the finalizer builds the output.
|
|
12
13
|
- **`conditionalPaths`**: List conditional edges: `fromNodeId`, branches with `toNodeId` and human-readable `condition`. Use `[]` if none.
|
|
13
14
|
3. Use **node ids** and **paths** here as needed—they belong in technical explanation, not in product-facing `suggestConceptObjective` fields.
|
|
@@ -19,7 +20,7 @@ Respond with a **single JSON object**. **No markdown fences, no preamble, no tra
|
|
|
19
20
|
|
|
20
21
|
The object **MUST** include top-level `"action": "explain"` (must match the request).
|
|
21
22
|
|
|
22
|
-
**Required:** `action`, `explanation` (object with `summary`, `executionOrder`, `nodeDescriptions`, `dataFlow`, `conditionalPaths
|
|
23
|
+
**Required:** `action`, `explanation` (object with `summary`, `executionOrder`, `nodeDescriptions`, `dataFlow`, `conditionalPaths`; include **`modelLayers`** when graph model metadata exists or when inferring defaults); `warnings` optional.
|
|
23
24
|
|
|
24
25
|
Do **not** place `summary`, `executionOrder`, etc. at the top level—they must live under `explanation`.
|
|
25
26
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exellix/graph-composer",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"verify:local": "tsx src/verify-local.ts",
|
|
37
37
|
"verify:catalog-live": "x12i-env run --env-file .env -- tsx scripts/verify-catalog-live.ts",
|
|
38
38
|
"test": "npm run test:unit && npm run test:live",
|
|
39
|
-
"test:unit": "node --import tsx/esm --test --test-force-exit test/unit/explain-shape.test.ts test/unit/graph-concept-patch.test.ts test/unit/graph-concept-story-parse.test.ts test/unit/review-concept-output-validation.test.ts test/unit/review-concept-catalog-alias.test.ts test/unit/redact-for-log.test.ts test/unit/graph-composer-logging.test.ts test/unit/worker-instructions.test.ts test/unit/catalog-output-validation.test.ts test/unit/catalox-catalog-bridge.test.ts test/unit/ai-task-profile.test.ts test/unit/create-modify-output-validation.test.ts test/unit/task-node-task-variable.test.ts test/unit/canonical-graph-document.test.ts test/unit/graph-engine-bridge.test.ts test/unit/example-generation.test.ts",
|
|
39
|
+
"test:unit": "node --import tsx/esm --test --test-force-exit test/unit/explain-shape.test.ts test/unit/graph-concept-patch.test.ts test/unit/graph-concept-story-parse.test.ts test/unit/review-concept-output-validation.test.ts test/unit/review-concept-catalog-alias.test.ts test/unit/redact-for-log.test.ts test/unit/graph-composer-logging.test.ts test/unit/worker-instructions.test.ts test/unit/catalog-output-validation.test.ts test/unit/catalox-catalog-bridge.test.ts test/unit/ai-task-profile.test.ts test/unit/create-modify-output-validation.test.ts test/unit/task-node-task-variable.test.ts test/unit/canonical-graph-document.test.ts test/unit/graph-engine-bridge.test.ts test/unit/graph-model-layers.test.ts test/unit/example-generation.test.ts",
|
|
40
40
|
"test:live": "x12i-env run --env-file .env -- node --import tsx/esm --test test/live/all.ts",
|
|
41
41
|
"pack:check": "npm pack --dry-run",
|
|
42
42
|
"suggest-smoke": "x12i-env run --env-file .env -- tsx scripts/run-suggest-concept-smoke.ts"
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@x12i/ai-profiles": "^1.
|
|
75
|
-
"@x12i/catalox": "^5.1.
|
|
74
|
+
"@x12i/ai-profiles": "^1.7.0",
|
|
75
|
+
"@x12i/catalox": "^5.1.3",
|
|
76
76
|
"@x12i/env": "^4.0.1",
|
|
77
|
-
"@x12i/funcx": "^4.2.
|
|
78
|
-
"@x12i/logxer": "^4.
|
|
77
|
+
"@x12i/funcx": "^4.2.4",
|
|
78
|
+
"@x12i/logxer": "^4.6.0"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@exellix/graph-engine": "^7.2.0",
|