@pipelex/mthds-ui 0.15.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.
@@ -1,8 +1,8 @@
1
- import { C as ConceptInfo, P as PipeBlueprintUnion, G as GraphSpec, V as ValidationIssue } from '../types-DFIZ_rx6.js';
1
+ import { C as ConceptInfo, P as PipeBlueprintUnion, G as GraphSpec, V as ValidationIssue } from '../types-DM_Ws3oW.js';
2
2
  export { P as ParsedPipeRef, m as makePipeRef, p as parsePipeRef } from '../pipeRefs-BQJO5nh5.js';
3
3
 
4
4
  type DiagnosticSeverity = "error" | "warning";
5
- 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";
6
6
  /**
7
7
  * A non-fatal note collected while parsing or merging. `error` means a whole
8
8
  * unit could not be interpreted (unparseable TOML, a skipped pipe); `warning`
@@ -2,7 +2,7 @@ import {
2
2
  KNOWN_PIPE_TYPES,
3
3
  makePipeRef,
4
4
  parsePipeRef
5
- } from "../chunk-YC7TW3BW.js";
5
+ } from "../chunk-HURB2U53.js";
6
6
  import {
7
7
  __spreadProps,
8
8
  __spreadValues
@@ -28,22 +28,28 @@ function boolOrNull(value) {
28
28
  // src/static-graph/conceptRefs.ts
29
29
  var NATIVE_DOMAIN = "native";
30
30
  var NATIVE_CONCEPT_DESCRIPTIONS = {
31
- Dynamic: "Dynamically typed content",
31
+ Dynamic: "A dynamic concept",
32
32
  Text: "A text",
33
33
  Image: "An image",
34
34
  Document: "A document",
35
35
  Html: "HTML content",
36
- TextAndImages: "A text with images",
36
+ TextAndImages: "A text and an image",
37
37
  Number: "A number",
38
- Page: "The content of a page of a document",
39
- JSON: "JSON content",
40
- SearchResult: "A search result",
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",
41
44
  Anything: "Anything",
42
- Composite: "A named composition of multiple contents"
45
+ Composite: "A named composition of contents"
43
46
  };
44
47
  var NATIVE_CONCEPT_CODES = new Set(
45
48
  Object.keys(NATIVE_CONCEPT_DESCRIPTIONS)
46
49
  );
50
+ function isNativeConceptCode(code) {
51
+ return Object.hasOwn(NATIVE_CONCEPT_DESCRIPTIONS, code);
52
+ }
47
53
  var CONCEPT_REF_RE = /^(?:([A-Za-z0-9_][A-Za-z0-9_.]*)\.)?([A-Za-z0-9_]+)(?:\[(\d*)\])?$/;
48
54
  function parseConceptRef(raw) {
49
55
  if (typeof raw !== "string") return null;
@@ -60,11 +66,10 @@ function qualifiedStructureClassName(domain, code) {
60
66
  return `${domain.replaceAll(".", "\xB7")}__${code}`;
61
67
  }
62
68
  function nativeConceptInfo(code) {
63
- var _a;
64
69
  return {
65
70
  code,
66
71
  domain_code: NATIVE_DOMAIN,
67
- description: (_a = NATIVE_CONCEPT_DESCRIPTIONS[code]) != null ? _a : code,
72
+ description: NATIVE_CONCEPT_DESCRIPTIONS[code],
68
73
  structure_class_name: `${code}Content`,
69
74
  refines: null
70
75
  };
@@ -80,14 +85,14 @@ function stubConceptInfo(code, domain) {
80
85
  }
81
86
  function resolveConceptInfo(parts, currentDomain, localConcepts) {
82
87
  if (parts.domain === NATIVE_DOMAIN) {
83
- return NATIVE_CONCEPT_CODES.has(parts.code) ? nativeConceptInfo(parts.code) : stubConceptInfo(parts.code, NATIVE_DOMAIN);
88
+ return isNativeConceptCode(parts.code) ? nativeConceptInfo(parts.code) : stubConceptInfo(parts.code, NATIVE_DOMAIN);
84
89
  }
85
90
  if (parts.domain !== null && parts.domain !== currentDomain) {
86
91
  return stubConceptInfo(parts.code, parts.domain);
87
92
  }
88
93
  const local = localConcepts[parts.code];
89
94
  if (local) return local;
90
- if (parts.domain === null && NATIVE_CONCEPT_CODES.has(parts.code)) {
95
+ if (parts.domain === null && isNativeConceptCode(parts.code)) {
91
96
  return nativeConceptInfo(parts.code);
92
97
  }
93
98
  return stubConceptInfo(parts.code, currentDomain);
@@ -236,18 +241,41 @@ function normalizeConstruct(raw) {
236
241
  }
237
242
  return Object.keys(fields).length > 0 ? { fields } : null;
238
243
  }
239
- function normalizePipe(code, raw, ctx) {
240
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
244
+ var SIGNATURE_ONLY_KEYS = /* @__PURE__ */ new Set([
245
+ "description",
246
+ "inputs",
247
+ "output",
248
+ "signature_for"
249
+ ]);
250
+ function resolvePipeTypeTag(code, raw, ctx) {
241
251
  const typeValue = raw.type;
242
- if (typeof typeValue !== "string" || !KNOWN_PIPE_TYPES.has(typeValue)) {
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") {
243
256
  ctx.diagnostics.push({
244
- severity: "error",
245
- code: "unknown-pipe-type",
246
- message: `pipe "${code}": unknown pipe type ${JSON.stringify(typeValue)} \u2014 pipe skipped`,
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).`,
247
260
  path: `pipe.${code}.type`
248
261
  });
249
- return null;
262
+ return "PipeSignature";
250
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;
251
279
  const type = typeValue;
252
280
  const base = {
253
281
  code,
@@ -323,7 +351,6 @@ function normalizePipe(code, raw, ctx) {
323
351
  type,
324
352
  pipe_category: "PipeOperator",
325
353
  llm_prompt_spec: {
326
- templating_style: null,
327
354
  system_prompt_blueprint: systemPrompt === null ? null : makeTemplate(systemPrompt, "llm_prompt"),
328
355
  prompt_blueprint: prompt === null ? null : makeTemplate(prompt, "llm_prompt"),
329
356
  user_image_references: null,
@@ -435,7 +462,7 @@ function normalizePipe(code, raw, ctx) {
435
462
  return __spreadProps(__spreadValues({}, base), {
436
463
  type,
437
464
  pipe_category: null,
438
- 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
439
466
  });
440
467
  }
441
468
  default: {
@@ -451,7 +478,9 @@ var FIELD_TYPE_TO_JSON = {
451
478
  integer: { type: "integer" },
452
479
  number: { type: "number" },
453
480
  boolean: { type: "boolean" },
454
- date: { type: "string", format: "date-time" },
481
+ date: { type: "string", format: "date" },
482
+ datetime: { type: "string", format: "date-time" },
483
+ time: { type: "string", format: "time" },
455
484
  list: { type: "array" },
456
485
  dict: { type: "object" },
457
486
  concept: { type: "object" }
@@ -498,7 +527,7 @@ function qualifyRefines(raw, domain, declaredCodes) {
498
527
  const parts = parseConceptRef(raw);
499
528
  if (parts === null) return null;
500
529
  if (parts.domain !== null) return `${parts.domain}.${parts.code}`;
501
- if (!declaredCodes.has(parts.code) && NATIVE_CONCEPT_CODES.has(parts.code)) {
530
+ if (!declaredCodes.has(parts.code) && isNativeConceptCode(parts.code)) {
502
531
  return `${NATIVE_DOMAIN}.${parts.code}`;
503
532
  }
504
533
  return `${domain}.${parts.code}`;