@pipelex/mthds-ui 0.14.0 → 0.16.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/{chunk-GS2KODND.js → chunk-HURB2U53.js} +16 -2
- package/dist/chunk-HURB2U53.js.map +1 -0
- package/dist/chunk-QD5YDMWV.js +1 -0
- package/dist/{chunk-V4FKGLKA.js → chunk-UDA2XA23.js} +7 -4
- package/dist/chunk-UDA2XA23.js.map +1 -0
- package/dist/graph/index.d.ts +3 -2
- package/dist/graph/index.js +7 -3
- package/dist/graph/react/index.d.ts +2 -2
- package/dist/graph/react/index.js +6 -10
- package/dist/graph/react/index.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +7 -3
- package/dist/pipeRefs-BQJO5nh5.d.ts +19 -0
- package/dist/standalone/graph-standalone.html +9 -9
- package/dist/standalone/graph-viewer.js +9 -9
- package/dist/static-graph/index.d.ts +17 -3
- package/dist/static-graph/index.js +81 -34
- package/dist/static-graph/index.js.map +1 -1
- package/dist/{types-CIH1Ae16.d.ts → types-DM_Ws3oW.d.ts} +16 -7
- package/package.json +1 -1
- package/dist/chunk-GS2KODND.js.map +0 -1
- package/dist/chunk-LJQS5ZNA.js +0 -1
- package/dist/chunk-V4FKGLKA.js.map +0 -1
- /package/dist/{chunk-LJQS5ZNA.js.map → chunk-QD5YDMWV.js.map} +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { C as ConceptInfo, P as PipeBlueprintUnion, G as GraphSpec, V as ValidationIssue } from '../types-
|
|
1
|
+
import { C as ConceptInfo, P as PipeBlueprintUnion, G as GraphSpec, V as ValidationIssue } from '../types-DM_Ws3oW.js';
|
|
2
|
+
export { P as ParsedPipeRef, m as makePipeRef, p as parsePipeRef } from '../pipeRefs-BQJO5nh5.js';
|
|
2
3
|
|
|
3
4
|
type DiagnosticSeverity = "error" | "warning";
|
|
4
|
-
type DiagnosticCode = "toml-parse-error" | "missing-domain" | "invalid-bundle-shape" | "invalid-concept-entry" | "invalid-pipe-entry" | "unknown-pipe-type" | "invalid-concept-ref" | "missing-pipe-output" | "invalid-sub-pipe" | "incomplete-batch-spec" | "duplicate-concept" | "duplicate-pipe" | "unresolved-pipe-ref" | "cyclic-pipe-ref" | "missing-main-pipe" | "no-entry-pipe" | "conflicting-input-concept";
|
|
5
|
+
type DiagnosticCode = "toml-parse-error" | "missing-domain" | "invalid-bundle-shape" | "invalid-concept-entry" | "invalid-pipe-entry" | "unknown-pipe-type" | "retired-signature-tag" | "invalid-concept-ref" | "missing-pipe-output" | "invalid-sub-pipe" | "incomplete-batch-spec" | "duplicate-concept" | "duplicate-pipe" | "unresolved-pipe-ref" | "cyclic-pipe-ref" | "missing-main-pipe" | "no-entry-pipe" | "conflicting-input-concept";
|
|
5
6
|
/**
|
|
6
7
|
* A non-fatal note collected while parsing or merging. `error` means a whole
|
|
7
8
|
* unit could not be interpreted (unparseable TOML, a skipped pipe); `warning`
|
|
@@ -13,6 +14,19 @@ interface Diagnostic {
|
|
|
13
14
|
message: string;
|
|
14
15
|
/** TOML-style locator for the offending entry, e.g. `pipe.analyze_candidate.output`. */
|
|
15
16
|
path?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Domain of the bundle namespace the diagnostic belongs to — the declaring-file
|
|
19
|
+
* identity a host needs to qualify a `pipe.<code>` locator into a full pipe ref
|
|
20
|
+
* (`domain_code.pipe_code`). Stamped wherever the owning namespace is known:
|
|
21
|
+
* per-file diagnostics get their bundle's domain ({@link UNKNOWN_DOMAIN} when
|
|
22
|
+
* the bundle declares none), merge/walk diagnostics the namespace being
|
|
23
|
+
* processed, and entry selection stamps the diagnostics it can attribute (a
|
|
24
|
+
* missing or unresolvable `main_pipe` names its declaring domain). Absent only
|
|
25
|
+
* when no owning bundle can be resolved: unparseable TOML, or entry selection
|
|
26
|
+
* with no resolvable owner (no bundles, no pipes anywhere, or a host-supplied
|
|
27
|
+
* entry ref that matches nothing).
|
|
28
|
+
*/
|
|
29
|
+
domain_code?: string;
|
|
16
30
|
}
|
|
17
31
|
/**
|
|
18
32
|
* One `.mthds` file, parsed and normalized. Pipes are narrowed to the same
|
|
@@ -113,7 +127,7 @@ declare function buildStaticGraphSpecFromToml(tomlTexts: string | string[], opti
|
|
|
113
127
|
* The TOML-style `path` becomes the locator chip; `origin: "static"` lets the
|
|
114
128
|
* panel (and the host's issue policy) distinguish them from validator verdicts.
|
|
115
129
|
* When the path identifies a pipe declaration or a precise invocation, the
|
|
116
|
-
* targeting fields (`
|
|
130
|
+
* targeting fields (`pipeRef` / `nodeId`) are filled so the viewer can
|
|
117
131
|
* decorate the affected graph nodes.
|
|
118
132
|
*/
|
|
119
133
|
declare function staticDiagnosticsToValidationIssues(diagnostics: Diagnostic[]): ValidationIssue[];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
KNOWN_PIPE_TYPES
|
|
3
|
-
|
|
2
|
+
KNOWN_PIPE_TYPES,
|
|
3
|
+
makePipeRef,
|
|
4
|
+
parsePipeRef
|
|
5
|
+
} from "../chunk-HURB2U53.js";
|
|
4
6
|
import {
|
|
5
7
|
__spreadProps,
|
|
6
8
|
__spreadValues
|
|
@@ -26,22 +28,28 @@ function boolOrNull(value) {
|
|
|
26
28
|
// src/static-graph/conceptRefs.ts
|
|
27
29
|
var NATIVE_DOMAIN = "native";
|
|
28
30
|
var NATIVE_CONCEPT_DESCRIPTIONS = {
|
|
29
|
-
Dynamic: "
|
|
31
|
+
Dynamic: "A dynamic concept",
|
|
30
32
|
Text: "A text",
|
|
31
33
|
Image: "An image",
|
|
32
34
|
Document: "A document",
|
|
33
35
|
Html: "HTML content",
|
|
34
|
-
TextAndImages: "A text
|
|
36
|
+
TextAndImages: "A text and an image",
|
|
35
37
|
Number: "A number",
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
YesNo: "The answer to a yes/no question",
|
|
39
|
+
Date: "A calendar date, optionally with a time of day \u2014 as precise as its source states.",
|
|
40
|
+
Time: "A time of day, optionally with a UTC offset \u2014 as precise as its source states.",
|
|
41
|
+
Page: "The content of a page of a document, comprising text and linked images and an optional page view image",
|
|
42
|
+
JSON: "A JSON object",
|
|
43
|
+
SearchResult: "A search result with answer and sources",
|
|
39
44
|
Anything: "Anything",
|
|
40
|
-
Composite: "A named composition of
|
|
45
|
+
Composite: "A named composition of contents"
|
|
41
46
|
};
|
|
42
47
|
var NATIVE_CONCEPT_CODES = new Set(
|
|
43
48
|
Object.keys(NATIVE_CONCEPT_DESCRIPTIONS)
|
|
44
49
|
);
|
|
50
|
+
function isNativeConceptCode(code) {
|
|
51
|
+
return Object.hasOwn(NATIVE_CONCEPT_DESCRIPTIONS, code);
|
|
52
|
+
}
|
|
45
53
|
var CONCEPT_REF_RE = /^(?:([A-Za-z0-9_][A-Za-z0-9_.]*)\.)?([A-Za-z0-9_]+)(?:\[(\d*)\])?$/;
|
|
46
54
|
function parseConceptRef(raw) {
|
|
47
55
|
if (typeof raw !== "string") return null;
|
|
@@ -58,11 +66,10 @@ function qualifiedStructureClassName(domain, code) {
|
|
|
58
66
|
return `${domain.replaceAll(".", "\xB7")}__${code}`;
|
|
59
67
|
}
|
|
60
68
|
function nativeConceptInfo(code) {
|
|
61
|
-
var _a;
|
|
62
69
|
return {
|
|
63
70
|
code,
|
|
64
71
|
domain_code: NATIVE_DOMAIN,
|
|
65
|
-
description:
|
|
72
|
+
description: NATIVE_CONCEPT_DESCRIPTIONS[code],
|
|
66
73
|
structure_class_name: `${code}Content`,
|
|
67
74
|
refines: null
|
|
68
75
|
};
|
|
@@ -78,14 +85,14 @@ function stubConceptInfo(code, domain) {
|
|
|
78
85
|
}
|
|
79
86
|
function resolveConceptInfo(parts, currentDomain, localConcepts) {
|
|
80
87
|
if (parts.domain === NATIVE_DOMAIN) {
|
|
81
|
-
return
|
|
88
|
+
return isNativeConceptCode(parts.code) ? nativeConceptInfo(parts.code) : stubConceptInfo(parts.code, NATIVE_DOMAIN);
|
|
82
89
|
}
|
|
83
90
|
if (parts.domain !== null && parts.domain !== currentDomain) {
|
|
84
91
|
return stubConceptInfo(parts.code, parts.domain);
|
|
85
92
|
}
|
|
86
93
|
const local = localConcepts[parts.code];
|
|
87
94
|
if (local) return local;
|
|
88
|
-
if (parts.domain === null &&
|
|
95
|
+
if (parts.domain === null && isNativeConceptCode(parts.code)) {
|
|
89
96
|
return nativeConceptInfo(parts.code);
|
|
90
97
|
}
|
|
91
98
|
return stubConceptInfo(parts.code, currentDomain);
|
|
@@ -234,18 +241,41 @@ function normalizeConstruct(raw) {
|
|
|
234
241
|
}
|
|
235
242
|
return Object.keys(fields).length > 0 ? { fields } : null;
|
|
236
243
|
}
|
|
237
|
-
|
|
238
|
-
|
|
244
|
+
var SIGNATURE_ONLY_KEYS = /* @__PURE__ */ new Set([
|
|
245
|
+
"description",
|
|
246
|
+
"inputs",
|
|
247
|
+
"output",
|
|
248
|
+
"signature_for"
|
|
249
|
+
]);
|
|
250
|
+
function resolvePipeTypeTag(code, raw, ctx) {
|
|
239
251
|
const typeValue = raw.type;
|
|
240
|
-
if (
|
|
252
|
+
if (typeValue === void 0) {
|
|
253
|
+
const isSignature = raw.output !== void 0 && Object.keys(raw).every((key) => SIGNATURE_ONLY_KEYS.has(key));
|
|
254
|
+
if (isSignature) return "PipeSignature";
|
|
255
|
+
} else if (typeValue === "PipeSignature") {
|
|
241
256
|
ctx.diagnostics.push({
|
|
242
|
-
severity: "
|
|
243
|
-
code: "
|
|
244
|
-
message: `pipe "${code}":
|
|
257
|
+
severity: "warning",
|
|
258
|
+
code: "retired-signature-tag",
|
|
259
|
+
message: `pipe "${code}": \`type = "PipeSignature"\` is no longer a pipe type \u2014 delete the \`type\` line. A pipe with no \`type\` and no implementation is a signature (contract only).`,
|
|
245
260
|
path: `pipe.${code}.type`
|
|
246
261
|
});
|
|
247
|
-
return
|
|
262
|
+
return "PipeSignature";
|
|
248
263
|
}
|
|
264
|
+
if (typeof typeValue === "string" && KNOWN_PIPE_TYPES.has(typeValue)) {
|
|
265
|
+
return typeValue;
|
|
266
|
+
}
|
|
267
|
+
ctx.diagnostics.push({
|
|
268
|
+
severity: "error",
|
|
269
|
+
code: "unknown-pipe-type",
|
|
270
|
+
message: `pipe "${code}": unknown pipe type ${JSON.stringify(typeValue)} \u2014 pipe skipped`,
|
|
271
|
+
path: `pipe.${code}.type`
|
|
272
|
+
});
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
function normalizePipe(code, raw, ctx) {
|
|
276
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
277
|
+
const typeValue = resolvePipeTypeTag(code, raw, ctx);
|
|
278
|
+
if (typeValue === null) return null;
|
|
249
279
|
const type = typeValue;
|
|
250
280
|
const base = {
|
|
251
281
|
code,
|
|
@@ -321,7 +351,6 @@ function normalizePipe(code, raw, ctx) {
|
|
|
321
351
|
type,
|
|
322
352
|
pipe_category: "PipeOperator",
|
|
323
353
|
llm_prompt_spec: {
|
|
324
|
-
templating_style: null,
|
|
325
354
|
system_prompt_blueprint: systemPrompt === null ? null : makeTemplate(systemPrompt, "llm_prompt"),
|
|
326
355
|
prompt_blueprint: prompt === null ? null : makeTemplate(prompt, "llm_prompt"),
|
|
327
356
|
user_image_references: null,
|
|
@@ -433,7 +462,7 @@ function normalizePipe(code, raw, ctx) {
|
|
|
433
462
|
return __spreadProps(__spreadValues({}, base), {
|
|
434
463
|
type,
|
|
435
464
|
pipe_category: null,
|
|
436
|
-
signature_for: signatureFor !== null && KNOWN_PIPE_TYPES.has(signatureFor) ? signatureFor : null
|
|
465
|
+
signature_for: signatureFor !== null && signatureFor !== "PipeSignature" && KNOWN_PIPE_TYPES.has(signatureFor) ? signatureFor : null
|
|
437
466
|
});
|
|
438
467
|
}
|
|
439
468
|
default: {
|
|
@@ -449,7 +478,9 @@ var FIELD_TYPE_TO_JSON = {
|
|
|
449
478
|
integer: { type: "integer" },
|
|
450
479
|
number: { type: "number" },
|
|
451
480
|
boolean: { type: "boolean" },
|
|
452
|
-
date: { type: "string", format: "date
|
|
481
|
+
date: { type: "string", format: "date" },
|
|
482
|
+
datetime: { type: "string", format: "date-time" },
|
|
483
|
+
time: { type: "string", format: "time" },
|
|
453
484
|
list: { type: "array" },
|
|
454
485
|
dict: { type: "object" },
|
|
455
486
|
concept: { type: "object" }
|
|
@@ -496,7 +527,7 @@ function qualifyRefines(raw, domain, declaredCodes) {
|
|
|
496
527
|
const parts = parseConceptRef(raw);
|
|
497
528
|
if (parts === null) return null;
|
|
498
529
|
if (parts.domain !== null) return `${parts.domain}.${parts.code}`;
|
|
499
|
-
if (!declaredCodes.has(parts.code) &&
|
|
530
|
+
if (!declaredCodes.has(parts.code) && isNativeConceptCode(parts.code)) {
|
|
500
531
|
return `${NATIVE_DOMAIN}.${parts.code}`;
|
|
501
532
|
}
|
|
502
533
|
return `${domain}.${parts.code}`;
|
|
@@ -559,7 +590,7 @@ function emptyBundle() {
|
|
|
559
590
|
};
|
|
560
591
|
}
|
|
561
592
|
function parseMthdsBundle(tomlText) {
|
|
562
|
-
var _a;
|
|
593
|
+
var _a, _b;
|
|
563
594
|
const diagnostics = [];
|
|
564
595
|
let root;
|
|
565
596
|
try {
|
|
@@ -613,6 +644,9 @@ function parseMthdsBundle(tomlText) {
|
|
|
613
644
|
}
|
|
614
645
|
}
|
|
615
646
|
}
|
|
647
|
+
for (const diagnostic of diagnostics) {
|
|
648
|
+
(_b = diagnostic.domain_code) != null ? _b : diagnostic.domain_code = domain;
|
|
649
|
+
}
|
|
616
650
|
return { bundle, diagnostics };
|
|
617
651
|
}
|
|
618
652
|
|
|
@@ -651,7 +685,8 @@ function mergeBundles(bundles) {
|
|
|
651
685
|
severity: "warning",
|
|
652
686
|
code: "duplicate-concept",
|
|
653
687
|
message: `concept "${domain}.${code}" declared more than once \u2014 keeping the first declaration`,
|
|
654
|
-
path: `concept.${code}
|
|
688
|
+
path: `concept.${code}`,
|
|
689
|
+
domain_code: domain
|
|
655
690
|
});
|
|
656
691
|
continue;
|
|
657
692
|
}
|
|
@@ -663,7 +698,8 @@ function mergeBundles(bundles) {
|
|
|
663
698
|
severity: "warning",
|
|
664
699
|
code: "duplicate-pipe",
|
|
665
700
|
message: `pipe "${domain}.${code}" declared more than once \u2014 keeping the first declaration`,
|
|
666
|
-
path: `pipe.${code}
|
|
701
|
+
path: `pipe.${code}`,
|
|
702
|
+
domain_code: domain
|
|
667
703
|
});
|
|
668
704
|
continue;
|
|
669
705
|
}
|
|
@@ -806,13 +842,17 @@ function pickEntryPipe(set, explicitRef, diagnostics) {
|
|
|
806
842
|
diagnostics.push({
|
|
807
843
|
severity: "warning",
|
|
808
844
|
code: "unresolved-pipe-ref",
|
|
809
|
-
message: `main_pipe "${set.mainPipe}" not found \u2014 falling back to a root heuristic
|
|
845
|
+
message: `main_pipe "${set.mainPipe}" not found \u2014 falling back to a root heuristic`,
|
|
846
|
+
// The owning bundle is known (the namespace that declares this main_pipe),
|
|
847
|
+
// so stamp it — this is not an ownerless diagnostic.
|
|
848
|
+
domain_code: fallbackDomain
|
|
810
849
|
});
|
|
811
850
|
} else {
|
|
812
851
|
diagnostics.push({
|
|
813
852
|
severity: "warning",
|
|
814
853
|
code: "missing-main-pipe",
|
|
815
|
-
message: "no main_pipe declared \u2014 falling back to a root heuristic"
|
|
854
|
+
message: "no main_pipe declared \u2014 falling back to a root heuristic",
|
|
855
|
+
domain_code: fallbackDomain
|
|
816
856
|
});
|
|
817
857
|
}
|
|
818
858
|
const domainWithPipes = [fallbackDomain, ...domainsInOrder].find(
|
|
@@ -894,7 +934,8 @@ function bindInputs(ctx, blueprint, scope) {
|
|
|
894
934
|
severity: "warning",
|
|
895
935
|
code: "conflicting-input-concept",
|
|
896
936
|
message: `pipe "${blueprint.code}": dangling input "${name}" is declared as ${conceptKey(spec.concept)} here but was first seen as ${conceptKey(bound.concept)} \u2014 keeping the first`,
|
|
897
|
-
path: `pipe.${blueprint.code}.inputs.${name}
|
|
937
|
+
path: `pipe.${blueprint.code}.inputs.${name}`,
|
|
938
|
+
domain_code: blueprint.domain_code
|
|
898
939
|
});
|
|
899
940
|
}
|
|
900
941
|
}
|
|
@@ -934,7 +975,10 @@ function walkPipe(ctx, ref, currentDomain, nodeId, parentId, scope, inv) {
|
|
|
934
975
|
severity: "warning",
|
|
935
976
|
code: "unresolved-pipe-ref",
|
|
936
977
|
message: `pipe ref "${ref}" cannot be resolved \u2014 node skipped`,
|
|
937
|
-
path: nodeId
|
|
978
|
+
path: nodeId,
|
|
979
|
+
// The uttering file's domain: a bare ref belongs to the namespace that
|
|
980
|
+
// wrote it, mirroring the runtime's `_qualify_pipe_ref` inference.
|
|
981
|
+
domain_code: currentDomain
|
|
938
982
|
});
|
|
939
983
|
return null;
|
|
940
984
|
}
|
|
@@ -960,7 +1004,8 @@ function walkPipe(ctx, ref, currentDomain, nodeId, parentId, scope, inv) {
|
|
|
960
1004
|
severity: "warning",
|
|
961
1005
|
code: "cyclic-pipe-ref",
|
|
962
1006
|
message: `pipe "${qualified}" is invoked recursively \u2014 rendered as a leaf`,
|
|
963
|
-
path: nodeId
|
|
1007
|
+
path: nodeId,
|
|
1008
|
+
domain_code: domain
|
|
964
1009
|
});
|
|
965
1010
|
return finishLeaf(ctx, node, blueprint, nodeId, inv);
|
|
966
1011
|
}
|
|
@@ -1256,12 +1301,12 @@ function walkInlineBatch(ctx, sub, domain, nodeId, parentId, scope) {
|
|
|
1256
1301
|
}
|
|
1257
1302
|
|
|
1258
1303
|
// src/static-graph/validationIssues.ts
|
|
1259
|
-
function targetFromPath(path) {
|
|
1304
|
+
function targetFromPath(path, domainCode) {
|
|
1260
1305
|
if (!path) return {};
|
|
1261
1306
|
if (path.includes("/")) return { nodeId: path };
|
|
1262
1307
|
if (path.startsWith("pipe.")) {
|
|
1263
1308
|
const code = path.split(".")[1];
|
|
1264
|
-
if (code) return {
|
|
1309
|
+
if (code && domainCode) return { pipeRef: makePipeRef(domainCode, code) };
|
|
1265
1310
|
}
|
|
1266
1311
|
return {};
|
|
1267
1312
|
}
|
|
@@ -1271,7 +1316,7 @@ function staticDiagnosticsToValidationIssues(diagnostics) {
|
|
|
1271
1316
|
message: diagnostic.message,
|
|
1272
1317
|
context: diagnostic.path,
|
|
1273
1318
|
origin: "static"
|
|
1274
|
-
}, targetFromPath(diagnostic.path)));
|
|
1319
|
+
}, targetFromPath(diagnostic.path, diagnostic.domain_code)));
|
|
1275
1320
|
}
|
|
1276
1321
|
export {
|
|
1277
1322
|
NATIVE_CONCEPT_CODES,
|
|
@@ -1279,9 +1324,11 @@ export {
|
|
|
1279
1324
|
UNKNOWN_DOMAIN,
|
|
1280
1325
|
buildStaticGraphSpec,
|
|
1281
1326
|
buildStaticGraphSpecFromToml,
|
|
1327
|
+
makePipeRef,
|
|
1282
1328
|
mergeBundles,
|
|
1283
1329
|
parseConceptRef,
|
|
1284
1330
|
parseMthdsBundle,
|
|
1331
|
+
parsePipeRef,
|
|
1285
1332
|
staticDiagnosticsToValidationIssues
|
|
1286
1333
|
};
|
|
1287
1334
|
//# sourceMappingURL=index.js.map
|