@exellix/graph-composer 2.2.1 → 2.4.2
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 +4 -3
- package/dist/catalogMatchAssist.d.ts +1 -2
- package/dist/catalogMatchAssist.d.ts.map +1 -1
- package/dist/catalogMatchAssist.js +3 -4
- package/dist/cataloxCatalogBridge.d.ts +1 -2
- package/dist/cataloxCatalogBridge.d.ts.map +1 -1
- package/dist/cataloxCatalogBridge.js +2 -2
- package/dist/exampleGeneration.d.ts +11 -0
- package/dist/exampleGeneration.d.ts.map +1 -1
- package/dist/exampleGeneration.js +54 -0
- package/dist/funcxModel.d.ts +8 -0
- package/dist/funcxModel.d.ts.map +1 -0
- package/dist/funcxModel.js +10 -0
- package/dist/graphComposerActions.d.ts.map +1 -1
- package/dist/graphComposerActions.js +65 -0
- package/dist/graphComposerOutputValidation.d.ts +1 -0
- package/dist/graphComposerOutputValidation.d.ts.map +1 -1
- package/dist/graphComposerOutputValidation.js +1 -0
- package/dist/graphEntryContract.d.ts +114 -0
- package/dist/graphEntryContract.d.ts.map +1 -0
- package/dist/graphEntryContract.js +206 -0
- package/dist/graphEntryOutputValidation.d.ts +9 -0
- package/dist/graphEntryOutputValidation.d.ts.map +1 -0
- package/dist/graphEntryOutputValidation.js +276 -0
- package/dist/graphEntryPostProcess.d.ts +11 -0
- package/dist/graphEntryPostProcess.d.ts.map +1 -0
- package/dist/graphEntryPostProcess.js +114 -0
- package/dist/graphModelLayers.d.ts +19 -0
- package/dist/graphModelLayers.d.ts.map +1 -1
- package/dist/graphModelLayers.js +109 -9
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/modelConfigPatchMerge.d.ts +6 -0
- package/dist/modelConfigPatchMerge.d.ts.map +1 -0
- package/dist/modelConfigPatchMerge.js +38 -0
- package/dist/runGraphComposer.d.ts +3 -2
- package/dist/runGraphComposer.d.ts.map +1 -1
- package/dist/runGraphComposer.js +25 -11
- package/dist/scopingNeedMatchAssist.d.ts +1 -2
- package/dist/scopingNeedMatchAssist.d.ts.map +1 -1
- package/dist/scopingNeedMatchAssist.js +3 -3
- package/dist/types.d.ts +8 -1
- package/dist/types.d.ts.map +1 -1
- package/functions/graph-composer/meta.json +130 -4
- package/functions/graph-composer/prompts/README.md +8 -0
- package/functions/graph-composer/prompts/action-review-graph-entry-contract.md +37 -0
- package/functions/graph-composer/prompts/action-suggest-graph-entry-conditions.md +13 -0
- package/functions/graph-composer/prompts/action-suggest-graph-entry-examples.md +14 -0
- package/functions/graph-composer/prompts/action-suggest-graph-entry-inputs.md +14 -0
- package/functions/graph-composer/prompts/action-suggest-graph-execution-defaults.md +15 -0
- package/functions/graph-composer/prompts/action-suggest-job-knowledge-refs.md +12 -0
- package/functions/graph-composer/prompts/action-suggest-job-model-defaults.md +14 -0
- package/functions/graph-composer/prompts/shared/graph-entry-scope.md +19 -0
- package/functions/graph-composer/prompts/shared/request-context.md +2 -1
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ The Git repo lives under the **woroces** org with repo name **graph-composer**.
|
|
|
9
9
|
|
|
10
10
|
LLM-backed **graph composer** for the **worox-graph** DAG format using [@x12i/funcx](https://www.npmjs.com/package/@x12i/funcx) and OpenRouter.
|
|
11
11
|
|
|
12
|
-
**Graph structure:** **create**, **modify**, **explain**. **Product metadata:** **suggestConceptObjective** (`metadata.graphConcept`). **Concept QA:** **reviewConcept** (verdict + findings, no graph rewrite). **Managed catalogs (Catalox-backed rows → planning JSON only — host applies CRUD):** **suggestCatalogResolution**, **suggestCatalogCreations**. **Scoping-only:** **suggestScopingNeedMatch** (natural-language need vs `catalogCandidates.scopingMaps`), **suggestScopingMapCreation** (`scopingMapProposal` + `catalogRequestProposals`).
|
|
12
|
+
**Graph structure:** **create**, **modify**, **explain**. **Product metadata:** **suggestConceptObjective** (`metadata.graphConcept`). **Concept QA:** **reviewConcept** (verdict + findings, no graph rewrite). **Job-start / Layer 01 (graphs-studio Agent View):** **reviewGraphEntryContract**, **suggestGraphEntryInputs**, **suggestGraphEntryExamples**, **suggestGraphEntryConditions**, **suggestJobModelDefaults**, **suggestJobKnowledgeRefs**, **suggestGraphExecutionDefaults** — partial patches only; see [docs/graph-entry-agent-contract.md](./docs/graph-entry-agent-contract.md). **Managed catalogs (Catalox-backed rows → planning JSON only — host applies CRUD):** **suggestCatalogResolution**, **suggestCatalogCreations**. **Scoping-only:** **suggestScopingNeedMatch** (natural-language need vs `catalogCandidates.scopingMaps`), **suggestScopingMapCreation** (`scopingMapProposal` + `catalogRequestProposals`).
|
|
13
13
|
|
|
14
14
|
## Architecture (two ways to run)
|
|
15
15
|
|
|
@@ -17,11 +17,11 @@ LLM-backed **graph composer** for the **worox-graph** DAG format using [@x12i/fu
|
|
|
17
17
|
|
|
18
18
|
2. **Orchestrator (`runGraphComposerAgent`)** — You pass a natural-language **`goal`**. The orchestrator uses **`runJsonCompletion`** (structured JSON steps) to choose **registered tools**, then runs each selection via the **same** `runGraphWorker` path as direct mode. This costs **more tokens and latency** (multiple LLM rounds) than a single direct call.
|
|
19
19
|
|
|
20
|
-
Registered tool ids (mirror `GRAPH_COMPOSER_ACTION_REGISTRY`): `graph_create`, `graph_modify`, `graph_explain`, `graph_suggest_concept_objective`, `graph_suggest_catalog_resolution`, `graph_suggest_catalog_creations`, `graph_suggest_scoping_need_match`, `graph_suggest_scoping_map_creation`, `graph_review_concept`.
|
|
20
|
+
Registered tool ids (mirror `GRAPH_COMPOSER_ACTION_REGISTRY`): `graph_create`, `graph_modify`, `graph_explain`, `graph_suggest_concept_objective`, `graph_suggest_catalog_resolution`, `graph_suggest_catalog_creations`, `graph_suggest_scoping_need_match`, `graph_suggest_scoping_map_creation`, `graph_review_concept`, `graph_review_graph_entry_contract`, `graph_suggest_graph_entry_inputs`, `graph_suggest_graph_entry_examples`, `graph_suggest_graph_entry_conditions`, `graph_suggest_job_model_defaults`, `graph_suggest_job_knowledge_refs`, `graph_suggest_graph_execution_defaults`.
|
|
21
21
|
|
|
22
22
|
Pass **`catalogCandidates`** on `GraphComposerAgentInput` when the goal involves catalog or scoping tools (host loads rows from **Catalox** via `loadCatalogCandidatesFromCatalox`, or supplies fixtures).
|
|
23
23
|
|
|
24
|
-
Upstream feature
|
|
24
|
+
Upstream feature requests/specs for first-class tool loops, worker profiles, chat, preset tool arguments, and Rendrix-rendered templates in FuncX/aifunctions-js: [docs/aifunctions-agent-toolbox-feature-request.md](./docs/aifunctions-agent-toolbox-feature-request.md), [docs/funcx-generic-pack-spec.md](./docs/funcx-generic-pack-spec.md).
|
|
25
25
|
|
|
26
26
|
## Install
|
|
27
27
|
|
|
@@ -286,6 +286,7 @@ graph-composer explain-basic
|
|
|
286
286
|
| `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`. |
|
|
287
287
|
| `collectCanonicalGraphWarnings` | Warn-first **`@exellix/graph-engine`** canonical checks (top-level keys, metadata placement, memory paths, model profile aliases). |
|
|
288
288
|
| `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. |
|
|
289
|
+
| `formatNodeWinningModelLabel`, `formatGraphDefaultModelLabel` | **Canvas / Agent View labels** — e.g. `balanced (openrouter/…)` on Inference nodes after stamp; see graphs-studio node chrome. |
|
|
289
290
|
| `assertCanonicalGraphDocument` | Re-exported from graph-engine — **`validateCreateModifyOutput` hard-fails** when the canonicalized graph does not pass. |
|
|
290
291
|
| `GRAPH_ENGINE_MEMORY_PATH_ROOTS` | Re-exported memory path allowlist from graph-engine — use for validation parity, not a forked copy. |
|
|
291
292
|
| `WoroxScopingMapCatalogCreatePayload`, `WoroxScopedDataDocumentShape` | Host-side CRUD handoff (align field names with your persisted catalog / scoping schema). |
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { Client } from "@x12i/funcx";
|
|
2
|
-
import type { LlmMode } from "@x12i/funcx/functions";
|
|
3
2
|
import type { GraphComposerInput, SkillDescriptor } from "./types.js";
|
|
4
3
|
export type CatalogMatchAssistOptions = {
|
|
5
4
|
client: Client;
|
|
6
|
-
mode?:
|
|
5
|
+
mode?: string;
|
|
7
6
|
model?: string;
|
|
8
7
|
temperature?: number;
|
|
9
8
|
maxTokens?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogMatchAssist.d.ts","sourceRoot":"","sources":["../src/catalogMatchAssist.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"catalogMatchAssist.d.ts","sourceRoot":"","sources":["../src/catalogMatchAssist.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,EAEV,kBAAkB,EAGlB,eAAe,EAChB,MAAM,YAAY,CAAC;AAgKpB,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,kBAAkB,GAAG;IAC1B,SAAS,EAAE,QAAQ,GAAG,YAAY,CAAC;IACnC,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,aAAa,EAAE,eAAe,EAAE,CAAC;CAClC,EACD,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAmF9C"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { matchLists } from "@x12i/funcx/functions";
|
|
2
|
+
import { resolveFuncxModel } from "./funcxModel.js";
|
|
2
3
|
function mergeBySkillKey(a, b) {
|
|
3
4
|
if (!b?.length)
|
|
4
5
|
return [...a];
|
|
@@ -152,7 +153,8 @@ export async function buildCatalogMatchHints(input, opts) {
|
|
|
152
153
|
return undefined;
|
|
153
154
|
}
|
|
154
155
|
const hints = {};
|
|
155
|
-
const { client
|
|
156
|
+
const { client } = opts;
|
|
157
|
+
const model = resolveFuncxModel(opts);
|
|
156
158
|
const aiMerged = mergeBySkillKey(input.aiSkills, cc.aiSkills);
|
|
157
159
|
const utilMerged = mergeBySkillKey(input.utilitySkills, cc.utilitySkills);
|
|
158
160
|
const allSkills = [...utilMerged, ...aiMerged];
|
|
@@ -163,7 +165,6 @@ export async function buildCatalogMatchHints(input, opts) {
|
|
|
163
165
|
list1: nodeSummaries,
|
|
164
166
|
list2: skillCatalogItems(allSkills),
|
|
165
167
|
guidance: "Match each graph task node to the single best catalog skillKey by operational role (data read, rules, LLM, scoped IO, assembly). Prefer local/utility skills for deterministic work. Use reason briefly.",
|
|
166
|
-
mode,
|
|
167
168
|
client,
|
|
168
169
|
model,
|
|
169
170
|
}, { rules: [] });
|
|
@@ -178,7 +179,6 @@ export async function buildCatalogMatchHints(input, opts) {
|
|
|
178
179
|
list1: scopingNodes,
|
|
179
180
|
list2: scopingCatalogItems(scopingMaps),
|
|
180
181
|
guidance: "Match each scoped-data or scoping-related node to the best scopingMapId or questionId candidate by what the node reads/asks and entity scope. reason briefly.",
|
|
181
|
-
mode,
|
|
182
182
|
client,
|
|
183
183
|
model,
|
|
184
184
|
}, { rules: [] });
|
|
@@ -193,7 +193,6 @@ export async function buildCatalogMatchHints(input, opts) {
|
|
|
193
193
|
list1: narrixNodes,
|
|
194
194
|
list2: narrixCatalogItems(narrixTemplates),
|
|
195
195
|
guidance: "Match each node that has metadata.narrix to the best narrix template candidate (layer, datasetId, narrativeTypeIds, web scope). reason briefly.",
|
|
196
|
-
mode,
|
|
197
196
|
client,
|
|
198
197
|
model,
|
|
199
198
|
}, { rules: [] });
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
import type { Catalox } from "@x12i/catalox/embedder";
|
|
14
14
|
import type { CataloxContext, CatalogQueryOptions, UnifiedCatalogItem } from "@x12i/catalox/embedder";
|
|
15
15
|
import type { Client } from "@x12i/funcx";
|
|
16
|
-
import type { LlmMode } from "@x12i/funcx/functions";
|
|
17
16
|
import type { CatalogCandidates, NarrixTemplateCandidate, ScopingMapCandidate, SkillDescriptor } from "./types.js";
|
|
18
17
|
/**
|
|
19
18
|
* Which Catalox `catalogId` to read for each optional fetch. Several keys
|
|
@@ -57,7 +56,7 @@ export type CataloxCatalogBridgeAiItemMatch = {
|
|
|
57
56
|
minScore?: number;
|
|
58
57
|
/** Max rows pulled from Catalox before ranking (default 200). */
|
|
59
58
|
poolLimit?: number;
|
|
60
|
-
mode?:
|
|
59
|
+
mode?: string;
|
|
61
60
|
/** Required: OpenRouter-backed funcx client (same as graph-composer workers). */
|
|
62
61
|
client: Client;
|
|
63
62
|
model?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cataloxCatalogBridge.d.ts","sourceRoot":"","sources":["../src/cataloxCatalogBridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"cataloxCatalogBridge.d.ts","sourceRoot":"","sources":["../src/cataloxCatalogBridge.ts"],"names":[],"mapp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E,MAAM,CAAC;IACd,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gCAAgC,GAAG,OAAO,CACpD,MAAM,CAAC,MAAM,8BAA8B,EAAE,cAAc,CAAC,CAC7D,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,UAAU,EAAE,8BAA8B,CAAC;IAC3C,WAAW,CAAC,EAAE,+BAA+B,CAAC;IAC9C,4HAA4H;IAC5H,WAAW,CAAC,EAAE,+BAA+B,CAAC;IAC9C;;;OAGG;IACH,kBAAkB,CAAC,EAAE,gCAAgC,CAAC;CACvD,CAAC;AA0FF;;;GAGG;AACH,wBAAgB,mCAAmC,CACjD,IAAI,EAAE,kBAAkB,GACvB,eAAe,CAwBjB;AAED;;GAEG;AACH,wBAAgB,uCAAuC,CACrD,IAAI,EAAE,kBAAkB,GACvB,mBAAmB,CASrB;AAED;;GAEG;AACH,wBAAgB,2CAA2C,CACzD,IAAI,EAAE,kBAAkB,GACvB,uBAAuB,CAYzB;AA2CD;;;GAGG;AACH,wBAAsB,gCAAgC,CACpD,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,iBAAiB,CAAC,CAyF5B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { rank } from "@x12i/funcx/functions";
|
|
2
|
+
import { resolveFuncxModel } from "./funcxModel.js";
|
|
2
3
|
function resolveBridgeContext(bridgeKey, baseContext, options) {
|
|
3
4
|
const pin = options.contextByBridgeKey?.[bridgeKey];
|
|
4
5
|
return pin ?? baseContext;
|
|
@@ -39,9 +40,8 @@ async function rankCatalogPoolWithFuncx(pool, ai) {
|
|
|
39
40
|
const ranked = await rank({
|
|
40
41
|
items: payloads,
|
|
41
42
|
query: ai.query,
|
|
42
|
-
mode: ai.mode ?? "normal",
|
|
43
43
|
client: ai.client,
|
|
44
|
-
model: ai.model,
|
|
44
|
+
model: resolveFuncxModel({ model: ai.model, mode: ai.mode ?? "normal" }),
|
|
45
45
|
}, { rules: [] });
|
|
46
46
|
const byId = new Map(pool.map((it) => [String(it.itemId), it]));
|
|
47
47
|
const raw = ranked.rankedItems;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { generateContentExample, generateJsonExample, generateMdExample, type ExampleGenLlmOptions, type GenerateContentExampleParams, type GenerateContentExampleResult, type GenerateJsonExampleResult, type GenerateMdExampleParams, type GenerateMdExampleResult } from "@x12i/funcx/functions";
|
|
2
|
+
import type { GraphConceptEntityBindings } from "./types.js";
|
|
2
3
|
export type GenerateGraphJsonInputExampleParams = ExampleGenLlmOptions & {
|
|
3
4
|
/** JSON Schema for the input payload expected by the graph. */
|
|
4
5
|
jsonSchema: unknown;
|
|
@@ -11,5 +12,15 @@ export type GenerateGraphJsonInputExampleParams = ExampleGenLlmOptions & {
|
|
|
11
12
|
};
|
|
12
13
|
export declare function buildGraphInputExampleGuidance(existingGraph: object | undefined, guidance?: string[]): string[];
|
|
13
14
|
export declare function generateGraphJsonInputExample(params: GenerateGraphJsonInputExampleParams): Promise<GenerateJsonExampleResult>;
|
|
15
|
+
export declare function buildGraphEntryExampleGuidance(graphEntry: Record<string, unknown> | object | undefined, graphConcept?: Record<string, unknown>, entityBindings?: GraphConceptEntityBindings, extraGuidance?: string[]): string[];
|
|
16
|
+
export type GenerateGraphEntryInputExampleParams = ExampleGenLlmOptions & {
|
|
17
|
+
graph?: object;
|
|
18
|
+
graphEntry?: Record<string, unknown> | object;
|
|
19
|
+
entityBindings?: GraphConceptEntityBindings;
|
|
20
|
+
guidance?: string[];
|
|
21
|
+
examples?: unknown[];
|
|
22
|
+
seed?: unknown;
|
|
23
|
+
};
|
|
24
|
+
export declare function generateGraphEntryInputExample(params: GenerateGraphEntryInputExampleParams): Promise<GenerateJsonExampleResult>;
|
|
14
25
|
export { generateContentExample, generateJsonExample, generateMdExample, type GenerateContentExampleParams, type GenerateContentExampleResult, type GenerateJsonExampleResult, type GenerateMdExampleParams, type GenerateMdExampleResult, };
|
|
15
26
|
//# sourceMappingURL=exampleGeneration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exampleGeneration.d.ts","sourceRoot":"","sources":["../src/exampleGeneration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"exampleGeneration.d.ts","sourceRoot":"","sources":["../src/exampleGeneration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAI7D,MAAM,MAAM,mCAAmC,GAAG,oBAAoB,GAAG;IACvE,+DAA+D;IAC/D,UAAU,EAAE,OAAO,CAAC;IACpB,oFAAoF;IACpF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB,CAAC;AA0DF,wBAAgB,8BAA8B,CAC5C,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,QAAQ,GAAE,MAAM,EAAO,GACtB,MAAM,EAAE,CASV;AAED,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,mCAAmC,GAC1C,OAAO,CAAC,yBAAyB,CAAC,CAcpC;AAED,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,EACxD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,cAAc,CAAC,EAAE,0BAA0B,EAC3C,aAAa,GAAE,MAAM,EAAO,GAC3B,MAAM,EAAE,CAmCV;AAED,MAAM,MAAM,oCAAoC,GAAG,oBAAoB,GAAG;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;IAC9C,cAAc,CAAC,EAAE,0BAA0B,CAAC;IAC5C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,oCAAoC,GAC3C,OAAO,CAAC,yBAAyB,CAAC,CAoCpC;AAED,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,GAC7B,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { generateContentExample, generateJsonExample, generateMdExample, } from "@x12i/funcx/functions";
|
|
2
|
+
import { buildGraphEntryExampleJsonSchema, resolveEffectiveGraphEntry, } from "./graphEntryContract.js";
|
|
2
3
|
function asObject(v) {
|
|
3
4
|
return v !== null && typeof v === "object" && !Array.isArray(v)
|
|
4
5
|
? v
|
|
@@ -69,4 +70,57 @@ export async function generateGraphJsonInputExample(params) {
|
|
|
69
70
|
...llmOptions,
|
|
70
71
|
});
|
|
71
72
|
}
|
|
73
|
+
export function buildGraphEntryExampleGuidance(graphEntry, graphConcept, entityBindings, extraGuidance = []) {
|
|
74
|
+
const entry = resolveEffectiveGraphEntry(graphEntry !== undefined && typeof graphEntry === "object"
|
|
75
|
+
? graphEntry
|
|
76
|
+
: undefined);
|
|
77
|
+
const inputs = Array.isArray(entry.inputs) ? entry.inputs : [];
|
|
78
|
+
const pathHints = inputs
|
|
79
|
+
.slice(0, 12)
|
|
80
|
+
.map((row, i) => {
|
|
81
|
+
const r = row;
|
|
82
|
+
const path = typeof r.path === "string" ? r.path : "";
|
|
83
|
+
const kind = typeof r.kind === "string" ? r.kind : "scalar";
|
|
84
|
+
return path ? `${i + 1}. ${kind} @ ${path}` : undefined;
|
|
85
|
+
})
|
|
86
|
+
.filter((x) => x !== undefined);
|
|
87
|
+
const hints = [
|
|
88
|
+
"Generate example rows for metadata.graphEntry.exampleInputs (graph job-start contract).",
|
|
89
|
+
"Each example value must be a string; use format json with parseable JSON in value.",
|
|
90
|
+
"Paths must align with metadata.graphEntry.inputs under execution.input.*.",
|
|
91
|
+
];
|
|
92
|
+
if (pathHints.length > 0) {
|
|
93
|
+
hints.push(`Declared entry inputs: ${pathHints.join(" | ")}.`);
|
|
94
|
+
}
|
|
95
|
+
if (entityBindings?.coreEntityCollectionId) {
|
|
96
|
+
hints.push(`Core entity collection: ${entityBindings.coreEntityCollectionId}.`);
|
|
97
|
+
}
|
|
98
|
+
const expected = graphConcept?.expectedInput;
|
|
99
|
+
if (typeof expected === "string" && expected.trim()) {
|
|
100
|
+
hints.push(`Concept expectedInput: ${truncate(expected)}.`);
|
|
101
|
+
}
|
|
102
|
+
return [...hints, ...extraGuidance];
|
|
103
|
+
}
|
|
104
|
+
export async function generateGraphEntryInputExample(params) {
|
|
105
|
+
const { graph, graphEntry, entityBindings, guidance, examples, ...llmOptions } = params;
|
|
106
|
+
const entry = graphEntry !== undefined
|
|
107
|
+
? resolveEffectiveGraphEntry(graphEntry)
|
|
108
|
+
: graph !== undefined
|
|
109
|
+
? resolveEffectiveGraphEntry(graph)
|
|
110
|
+
: {};
|
|
111
|
+
const inputs = (Array.isArray(entry.inputs) ? entry.inputs : []);
|
|
112
|
+
const jsonSchema = buildGraphEntryExampleJsonSchema(inputs, entityBindings);
|
|
113
|
+
const concept = graph !== null && graph !== undefined && typeof graph === "object"
|
|
114
|
+
? graph.metadata?.graphConcept
|
|
115
|
+
: undefined;
|
|
116
|
+
const eb = entityBindings ??
|
|
117
|
+
concept?.entityBindings;
|
|
118
|
+
return generateGraphJsonInputExample({
|
|
119
|
+
jsonSchema,
|
|
120
|
+
existingGraph: graph,
|
|
121
|
+
guidance: buildGraphEntryExampleGuidance(entry, concept, eb, guidance),
|
|
122
|
+
examples,
|
|
123
|
+
...llmOptions,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
72
126
|
export { generateContentExample, generateJsonExample, generateMdExample, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* funcx 4.4+ uses `model` on call sites; legacy graph-composer options used `mode` (weak/normal/strong/ultra).
|
|
3
|
+
*/
|
|
4
|
+
export declare function resolveFuncxModel(opts: {
|
|
5
|
+
model?: string;
|
|
6
|
+
mode?: string;
|
|
7
|
+
}): string | undefined;
|
|
8
|
+
//# sourceMappingURL=funcxModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"funcxModel.d.ts","sourceRoot":"","sources":["../src/funcxModel.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,SAAS,CAK7F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* funcx 4.4+ uses `model` on call sites; legacy graph-composer options used `mode` (weak/normal/strong/ultra).
|
|
3
|
+
*/
|
|
4
|
+
export function resolveFuncxModel(opts) {
|
|
5
|
+
const model = opts.model?.trim();
|
|
6
|
+
if (model)
|
|
7
|
+
return model;
|
|
8
|
+
const mode = opts.mode?.trim();
|
|
9
|
+
return mode || undefined;
|
|
10
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphComposerActions.d.ts","sourceRoot":"","sources":["../src/graphComposerActions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EACL,KAAK,eAAe,EASrB,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"graphComposerActions.d.ts","sourceRoot":"","sources":["../src/graphComposerActions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EACL,KAAK,eAAe,EASrB,MAAM,oCAAoC,CAAC;AAY5C,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAEhE,MAAM,MAAM,6BAA6B,GAAG;IAC1C,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,uDAAuD;IACvD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,yDAAyD;IACzD,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACxC,oDAAoD;IACpD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,cAAc,EAAE,eAAe,CAAC;CAC1C,CAAC;AAaF,eAAO,MAAM,8BAA8B,EAAE,SAAS,6BAA6B,EAwMvE,CAAC;AAYb,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,GACb,6BAA6B,CAQ/B;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,GACf,6BAA6B,GAAG,SAAS,CAE3C;AAED,uEAAuE;AACvE,wBAAgB,+BAA+B,IAAI,MAAM,EAAE,CAQ1D;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAS1E"}
|
|
@@ -2,6 +2,8 @@ import { readFileSync, existsSync } from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { graphComposerPackRoot } from "./packDir.js";
|
|
4
4
|
import { validateCreateModifyOutput, validateExplainOutput, validateSuggestCatalogCreationsOutput, validateSuggestCatalogResolutionOutput, validateSuggestConceptOutput, validateSuggestScopingMapCreationOutput, validateSuggestScopingNeedMatchOutput, validateReviewConceptOutput, } from "./graphComposerOutputValidation.js";
|
|
5
|
+
import { validateReviewGraphEntryContractOutput, validateSuggestGraphEntryInputsOutput, validateSuggestGraphEntryExamplesOutput, validateSuggestGraphEntryConditionsOutput, validateSuggestJobModelDefaultsOutput, validateSuggestJobKnowledgeRefsOutput, validateSuggestGraphExecutionDefaultsOutput, } from "./graphEntryOutputValidation.js";
|
|
6
|
+
import { GRAPH_ENTRY_SHARED_INCLUDES } from "./graphEntryPostProcess.js";
|
|
5
7
|
function readPromptRelative(rel) {
|
|
6
8
|
const root = graphComposerPackRoot();
|
|
7
9
|
const p = path.join(root, "prompts", rel);
|
|
@@ -131,6 +133,69 @@ export const GRAPH_COMPOSER_ACTION_REGISTRY = [
|
|
|
131
133
|
toolDescription: "Review whether the graph concept makes sense; return verdict, categorized findings with severity, and improvement suggestions. No graph JSON returned.",
|
|
132
134
|
validateOutput: validateReviewConceptOutput,
|
|
133
135
|
},
|
|
136
|
+
{
|
|
137
|
+
action: "reviewGraphEntryContract",
|
|
138
|
+
promptFile: "action-review-graph-entry-contract.md",
|
|
139
|
+
sharedIncludes: GRAPH_ENTRY_SHARED_INCLUDES,
|
|
140
|
+
requiresExistingGraph: true,
|
|
141
|
+
toolName: "graph_review_graph_entry_contract",
|
|
142
|
+
toolDescription: "Review job-start graphEntry contract, job defaults, and alignment with graphConcept Lane 1. Returns verdict, graph-scoped findings, optional partial patches. No graph JSON.",
|
|
143
|
+
validateOutput: validateReviewGraphEntryContractOutput,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
action: "suggestGraphEntryInputs",
|
|
147
|
+
promptFile: "action-suggest-graph-entry-inputs.md",
|
|
148
|
+
sharedIncludes: GRAPH_ENTRY_SHARED_INCLUDES,
|
|
149
|
+
requiresExistingGraph: true,
|
|
150
|
+
toolName: "graph_suggest_graph_entry_inputs",
|
|
151
|
+
toolDescription: "Propose metadata.graphEntry.inputs rows (execution.input.* paths). No graph JSON.",
|
|
152
|
+
validateOutput: validateSuggestGraphEntryInputsOutput,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
action: "suggestGraphEntryExamples",
|
|
156
|
+
promptFile: "action-suggest-graph-entry-examples.md",
|
|
157
|
+
sharedIncludes: GRAPH_ENTRY_SHARED_INCLUDES,
|
|
158
|
+
requiresExistingGraph: true,
|
|
159
|
+
toolName: "graph_suggest_graph_entry_examples",
|
|
160
|
+
toolDescription: "Propose metadata.graphEntry.exampleInputs with parseable JSON examples. No graph JSON.",
|
|
161
|
+
validateOutput: validateSuggestGraphEntryExamplesOutput,
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
action: "suggestGraphEntryConditions",
|
|
165
|
+
promptFile: "action-suggest-graph-entry-conditions.md",
|
|
166
|
+
sharedIncludes: GRAPH_ENTRY_SHARED_INCLUDES,
|
|
167
|
+
requiresExistingGraph: true,
|
|
168
|
+
toolName: "graph_suggest_graph_entry_conditions",
|
|
169
|
+
toolDescription: "Propose metadata.graphEntry.conditions for job-start gating. No graph JSON.",
|
|
170
|
+
validateOutput: validateSuggestGraphEntryConditionsOutput,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
action: "suggestJobModelDefaults",
|
|
174
|
+
promptFile: "action-suggest-job-model-defaults.md",
|
|
175
|
+
sharedIncludes: GRAPH_ENTRY_SHARED_INCLUDES,
|
|
176
|
+
requiresExistingGraph: true,
|
|
177
|
+
toolName: "graph_suggest_job_model_defaults",
|
|
178
|
+
toolDescription: "Propose root modelConfig job defaults (appendCase or replaceDefault). No graph JSON.",
|
|
179
|
+
validateOutput: validateSuggestJobModelDefaultsOutput,
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
action: "suggestJobKnowledgeRefs",
|
|
183
|
+
promptFile: "action-suggest-job-knowledge-refs.md",
|
|
184
|
+
sharedIncludes: GRAPH_ENTRY_SHARED_INCLUDES,
|
|
185
|
+
requiresExistingGraph: true,
|
|
186
|
+
toolName: "graph_suggest_job_knowledge_refs",
|
|
187
|
+
toolDescription: "Propose root jobPagentiKnowledge Catalox refs. No graph JSON.",
|
|
188
|
+
validateOutput: validateSuggestJobKnowledgeRefsOutput,
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
action: "suggestGraphExecutionDefaults",
|
|
192
|
+
promptFile: "action-suggest-graph-execution-defaults.md",
|
|
193
|
+
sharedIncludes: GRAPH_ENTRY_SHARED_INCLUDES,
|
|
194
|
+
requiresExistingGraph: true,
|
|
195
|
+
toolName: "graph_suggest_graph_execution_defaults",
|
|
196
|
+
toolDescription: "Propose metadata.graphExecution partial defaults. No graph JSON.",
|
|
197
|
+
validateOutput: validateSuggestGraphExecutionDefaultsOutput,
|
|
198
|
+
},
|
|
134
199
|
];
|
|
135
200
|
const byAction = Object.fromEntries(GRAPH_COMPOSER_ACTION_REGISTRY.map((d) => [d.action, d]));
|
|
136
201
|
const byToolName = Object.fromEntries(GRAPH_COMPOSER_ACTION_REGISTRY.map((d) => [d.toolName, d]));
|
|
@@ -4,6 +4,7 @@ export type OutputValidationContext = {
|
|
|
4
4
|
input?: GraphComposerInput;
|
|
5
5
|
};
|
|
6
6
|
export type OutputValidator = (out: Record<string, unknown>, ctx?: OutputValidationContext) => void;
|
|
7
|
+
export { validateReviewGraphEntryContractOutput, validateSuggestGraphEntryInputsOutput, validateSuggestGraphEntryExamplesOutput, validateSuggestGraphEntryConditionsOutput, validateSuggestJobModelDefaultsOutput, validateSuggestJobKnowledgeRefsOutput, validateSuggestGraphExecutionDefaultsOutput, } from "./graphEntryOutputValidation.js";
|
|
7
8
|
export declare function validateExplainOutput(out: Record<string, unknown>, _ctx?: OutputValidationContext): void;
|
|
8
9
|
export declare function validateReviewConceptOutput(out: Record<string, unknown>, _ctx?: OutputValidationContext): void;
|
|
9
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphComposerOutputValidation.d.ts","sourceRoot":"","sources":["../src/graphComposerOutputValidation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAwB,MAAM,YAAY,CAAC;AAE3E,mHAAmH;AACnH,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAC5B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,GAAG,CAAC,EAAE,uBAAuB,KAC1B,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"graphComposerOutputValidation.d.ts","sourceRoot":"","sources":["../src/graphComposerOutputValidation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAwB,MAAM,YAAY,CAAC;AAE3E,mHAAmH;AACnH,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAC5B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,GAAG,CAAC,EAAE,uBAAuB,KAC1B,IAAI,CAAC;AAEV,OAAO,EACL,sCAA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C,CACrD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,IAAI,CAAC,EAAE,uBAAuB,GAC7B,IAAI,CAwDN"}
|
|
@@ -2,6 +2,7 @@ import { reportTaskNodeProtocolGaps } from "./aiTaskProfile.js";
|
|
|
2
2
|
import { collectCanonicalGraphWarnings } from "./canonicalGraphWarnings.js";
|
|
3
3
|
import { assertCanonicalGraphDocument } from "./graphEngineBridge.js";
|
|
4
4
|
import { canonicalizeGraphModel, reportTaskNodeInputsLayoutIssues, taskNodeInputsLayoutWarningMessage, } from "./taskNodeTaskVariable.js";
|
|
5
|
+
export { validateReviewGraphEntryContractOutput, validateSuggestGraphEntryInputsOutput, validateSuggestGraphEntryExamplesOutput, validateSuggestGraphEntryConditionsOutput, validateSuggestJobModelDefaultsOutput, validateSuggestJobKnowledgeRefsOutput, validateSuggestGraphExecutionDefaultsOutput, } from "./graphEntryOutputValidation.js";
|
|
5
6
|
const PRIMARY_INTENT_TYPES = new Set([
|
|
6
7
|
"question",
|
|
7
8
|
"decision",
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { GraphConceptEntityBindings } from "./types.js";
|
|
2
|
+
export type ComposerAgentSurface = "graph-entry" | "task-node";
|
|
3
|
+
/** Studio `buildGraphEntryAgentContext` envelope (FR-G1). */
|
|
4
|
+
export type GraphEntryAgentContext = {
|
|
5
|
+
surface: "graph-entry";
|
|
6
|
+
graphEntry: Record<string, unknown>;
|
|
7
|
+
jobDefaults?: Record<string, unknown>;
|
|
8
|
+
graphResponse?: Record<string, unknown>;
|
|
9
|
+
graphExecution?: Record<string, unknown>;
|
|
10
|
+
graphConcept?: Record<string, unknown>;
|
|
11
|
+
diagnostics?: Record<string, unknown>;
|
|
12
|
+
virtualIO?: Record<string, unknown>;
|
|
13
|
+
lastGraphRun?: Record<string, unknown>;
|
|
14
|
+
};
|
|
15
|
+
export type TaskNodeAgentContext = {
|
|
16
|
+
surface: "task-node";
|
|
17
|
+
nodeId: string;
|
|
18
|
+
lastRunMeta?: Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
export type GraphComposerAgentContext = GraphEntryAgentContext | TaskNodeAgentContext;
|
|
21
|
+
export type GraphEntryInputKind = "scalar" | "record";
|
|
22
|
+
export type GraphEntryInputRow = {
|
|
23
|
+
kind?: GraphEntryInputKind | string;
|
|
24
|
+
path: string;
|
|
25
|
+
required?: boolean;
|
|
26
|
+
entityIds?: string[];
|
|
27
|
+
label?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
};
|
|
30
|
+
export type GraphEntryExampleFormat = "json" | "markdown" | "text";
|
|
31
|
+
export type GraphEntryExampleRow = {
|
|
32
|
+
path?: string;
|
|
33
|
+
format: GraphEntryExampleFormat | string;
|
|
34
|
+
value: string;
|
|
35
|
+
};
|
|
36
|
+
export type GraphEntryConditionsPatch = {
|
|
37
|
+
narratives?: unknown[];
|
|
38
|
+
dataFilters?: unknown[];
|
|
39
|
+
aiCondition?: Record<string, unknown>;
|
|
40
|
+
};
|
|
41
|
+
export type GraphEntryPatch = {
|
|
42
|
+
inputs?: GraphEntryInputRow[];
|
|
43
|
+
exampleInputs?: GraphEntryExampleRow[];
|
|
44
|
+
conditions?: GraphEntryConditionsPatch;
|
|
45
|
+
};
|
|
46
|
+
export type GraphEntryFindingCategory = "graph_entry" | "expected_input" | "job_models" | "job_knowledge" | "graph_execution" | "graph_conditions";
|
|
47
|
+
export type GraphEntryFinding = {
|
|
48
|
+
scopeType: "graph";
|
|
49
|
+
category: GraphEntryFindingCategory | string;
|
|
50
|
+
severity: "info" | "warning" | "error" | string;
|
|
51
|
+
summary: string;
|
|
52
|
+
suggestedChange?: string;
|
|
53
|
+
proposal?: Record<string, unknown>;
|
|
54
|
+
};
|
|
55
|
+
export type GraphEntryReviewVerdict = {
|
|
56
|
+
coherent: boolean;
|
|
57
|
+
summary: string;
|
|
58
|
+
};
|
|
59
|
+
export type ModelConfigPatchMode = "appendCase" | "replaceDefault";
|
|
60
|
+
/** Root `modelConfig` patch (FR-G6). */
|
|
61
|
+
export type ModelConfigPatch = {
|
|
62
|
+
mode?: ModelConfigPatchMode;
|
|
63
|
+
cases?: Record<string, unknown>[];
|
|
64
|
+
/** Single default case triple when mode is replaceDefault. */
|
|
65
|
+
modelConfig?: {
|
|
66
|
+
preActionModel?: string;
|
|
67
|
+
skillModel?: string;
|
|
68
|
+
postActionModel?: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export type PagentiKnowledgeRef = {
|
|
72
|
+
catalogId: string;
|
|
73
|
+
itemId: string;
|
|
74
|
+
};
|
|
75
|
+
export type JobPagentiKnowledgePatch = {
|
|
76
|
+
refs?: PagentiKnowledgeRef[];
|
|
77
|
+
append?: PagentiKnowledgeRef[];
|
|
78
|
+
};
|
|
79
|
+
export type GraphExecutionPatch = Record<string, unknown>;
|
|
80
|
+
export type GraphResponsePatch = {
|
|
81
|
+
missing?: "omit" | "null";
|
|
82
|
+
shape?: unknown;
|
|
83
|
+
studio?: Record<string, unknown>;
|
|
84
|
+
};
|
|
85
|
+
export declare const GRAPH_ENTRY_FINDING_CATEGORIES: Set<string>;
|
|
86
|
+
export declare const GRAPH_ENTRY_PATH_PREFIX = "execution.input.";
|
|
87
|
+
export declare const GRAPH_EXECUTION_PATCH_ALLOWLIST: Set<string>;
|
|
88
|
+
/** Read `metadata.graphEntry` and normalize legacy `exampleInput` → `exampleInputs`. */
|
|
89
|
+
export declare function resolveEffectiveGraphEntry(graphOrEntry: object | Record<string, unknown> | undefined): Record<string, unknown>;
|
|
90
|
+
export declare function isValidGraphEntryPath(path: string): boolean;
|
|
91
|
+
export declare function validateGraphEntryPaths(paths: string[]): string[];
|
|
92
|
+
/** Infer JSON Schema for example generation from declared graph-entry inputs (FR-G4). */
|
|
93
|
+
export declare function buildGraphEntryExampleJsonSchema(inputs: GraphEntryInputRow[] | unknown[], _entityBindings?: GraphConceptEntityBindings): Record<string, unknown>;
|
|
94
|
+
export type EntityBindingMismatch = {
|
|
95
|
+
inputPath: string;
|
|
96
|
+
entityIds: string[];
|
|
97
|
+
message: string;
|
|
98
|
+
};
|
|
99
|
+
/** FR-G3: flag when graphEntry.inputs[].entityIds disagree with graphConcept.entityBindings. */
|
|
100
|
+
export declare function findGraphEntryEntityBindingMismatches(inputs: GraphEntryInputRow[] | unknown[], graphConcept: Record<string, unknown> | undefined): EntityBindingMismatch[];
|
|
101
|
+
export declare function parseJsonExampleValue(value: string): {
|
|
102
|
+
ok: boolean;
|
|
103
|
+
error?: string;
|
|
104
|
+
};
|
|
105
|
+
/** Resolve graph-entry context from request (agentContext preferred, analysisContext legacy). */
|
|
106
|
+
export declare function resolveGraphEntryContextFromInput(input: {
|
|
107
|
+
agentContext?: GraphComposerAgentContext;
|
|
108
|
+
analysisContext?: object;
|
|
109
|
+
}): GraphEntryAgentContext | undefined;
|
|
110
|
+
export declare function assertGraphEntryAgentSurface(input: {
|
|
111
|
+
agentContext?: GraphComposerAgentContext;
|
|
112
|
+
analysisContext?: object;
|
|
113
|
+
}, action: string): void;
|
|
114
|
+
//# sourceMappingURL=graphEntryContract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphEntryContract.d.ts","sourceRoot":"","sources":["../src/graphEntryContract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAE7D,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG,WAAW,CAAC;AAE/D,6DAA6D;AAC7D,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,aAAa,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,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