@meistrari/tela-cli 1.9.5 → 1.10.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.
Files changed (2) hide show
  1. package/dist/index.js +512 -310
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -142874,9 +142874,9 @@ var require_contracts = __commonJS({
142874
142874
  }
142875
142875
  });
142876
142876
 
142877
- // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-ids.cjs
142877
+ // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-ids.cjs
142878
142878
  var require_action_ids = __commonJS({
142879
- "../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-ids.cjs"(exports2, module2) {
142879
+ "../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-ids.cjs"(exports2, module2) {
142880
142880
  "use strict";
142881
142881
  var __defProp3 = Object.defineProperty;
142882
142882
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -142902,6 +142902,7 @@ var require_action_ids = __commonJS({
142902
142902
  module2.exports = __toCommonJS2(action_ids_exports);
142903
142903
  var WORKFLOW_ACTION_IDS = {
142904
142904
  llmCompletion: "llm-completion",
142905
+ jevEvaluator: "jev-evaluator",
142905
142906
  agent: "agent",
142906
142907
  agentFcc: "agent-fcc",
142907
142908
  codeExecution: "code-execution",
@@ -142917,9 +142918,9 @@ var require_action_ids = __commonJS({
142917
142918
  }
142918
142919
  });
142919
142920
 
142920
- // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/reference-format.cjs
142921
+ // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/reference-format.cjs
142921
142922
  var require_reference_format = __commonJS({
142922
- "../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/reference-format.cjs"(exports2, module2) {
142923
+ "../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/reference-format.cjs"(exports2, module2) {
142923
142924
  "use strict";
142924
142925
  var __defProp3 = Object.defineProperty;
142925
142926
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -142957,9 +142958,9 @@ var require_reference_format = __commonJS({
142957
142958
  }
142958
142959
  });
142959
142960
 
142960
- // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-output-reference.cjs
142961
+ // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-output-reference.cjs
142961
142962
  var require_action_output_reference = __commonJS({
142962
- "../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-output-reference.cjs"(exports2, module2) {
142963
+ "../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-output-reference.cjs"(exports2, module2) {
142963
142964
  "use strict";
142964
142965
  var __defProp3 = Object.defineProperty;
142965
142966
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -149816,9 +149817,9 @@ var require_cjs = __commonJS({
149816
149817
  }
149817
149818
  });
149818
149819
 
149819
- // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-schemas.cjs
149820
+ // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-schemas.cjs
149820
149821
  var require_action_schemas = __commonJS({
149821
- "../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-schemas.cjs"(exports2, module2) {
149822
+ "../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-schemas.cjs"(exports2, module2) {
149822
149823
  "use strict";
149823
149824
  var __defProp3 = Object.defineProperty;
149824
149825
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -149855,6 +149856,8 @@ var require_action_schemas = __commonJS({
149855
149856
  documentSplitterInput: () => documentSplitterInput,
149856
149857
  documentSplitterMode: () => documentSplitterMode,
149857
149858
  documentTemplaterInput: () => documentTemplaterInput,
149859
+ jevEvaluatorInput: () => jevEvaluatorInput,
149860
+ jevQuestionSchema: () => jevQuestionSchema,
149858
149861
  llmCompletionInput: () => llmCompletionInput,
149859
149862
  mapActionInput: () => mapActionInput,
149860
149863
  templateActionInput: () => templateActionInput
@@ -149888,7 +149891,8 @@ async function execute(input: TelaInput) {
149888
149891
  condition: import_typebox.Type.String(),
149889
149892
  steps: import_typebox.Type.Array(import_typebox.Type.Any()),
149890
149893
  type: import_typebox.Type.Optional(conditionCaseTypeSchema),
149891
- portId: import_typebox.Type.Optional(import_typebox.Type.Union([import_typebox.Type.String(), import_typebox.Type.Null()]))
149894
+ portId: import_typebox.Type.Optional(import_typebox.Type.Union([import_typebox.Type.String(), import_typebox.Type.Null()])),
149895
+ repeatFor: import_typebox.Type.Optional(import_typebox.Type.String({ description: "Template-only: list slot key this case is cloned for on instantiation" }))
149892
149896
  });
149893
149897
  var defaultCaseSchema = import_typebox.Type.Object({
149894
149898
  name: import_typebox.Type.Literal("Default"),
@@ -150008,6 +150012,7 @@ async function execute(input: TelaInput) {
150008
150012
  default: DEFAULT_LLM_MODEL
150009
150013
  })),
150010
150014
  temperature: import_typebox.Type.Optional(import_typebox.Type.Number({ default: 0 })),
150015
+ reasoningEffort: import_typebox.Type.Optional(import_typebox.Type.Union([import_typebox.Type.Literal("low"), import_typebox.Type.Literal("medium"), import_typebox.Type.Literal("high"), import_typebox.Type.Null()], { default: null })),
150011
150016
  schema: import_typebox.Type.Union([
150012
150017
  import_typebox.Type.Null(),
150013
150018
  import_typebox.Type.Record(import_typebox.Type.String(), import_typebox.Type.Any())
@@ -150015,6 +150020,43 @@ async function execute(input: TelaInput) {
150015
150020
  citations: import_typebox.Type.Optional(import_typebox.Type.Boolean()),
150016
150021
  citationsRationale: import_typebox.Type.Optional(import_typebox.Type.Boolean())
150017
150022
  });
150023
+ var jevChoiceQuestionSchema = import_typebox.Type.Object({
150024
+ id: import_typebox.Type.String({ minLength: 1, maxLength: 128 }),
150025
+ type: import_typebox.Type.Literal("choice"),
150026
+ instructions: import_typebox.Type.String({ minLength: 1, maxLength: 4e3 }),
150027
+ criteria: import_typebox.Type.Array(import_typebox.Type.Object({
150028
+ key: import_typebox.Type.String({ minLength: 1, maxLength: 128 }),
150029
+ description: import_typebox.Type.Optional(import_typebox.Type.String({ maxLength: 4e3 }))
150030
+ }), { minItems: 2, maxItems: 255 })
150031
+ });
150032
+ var jevScoreQuestionSchema = import_typebox.Type.Object({
150033
+ id: import_typebox.Type.String({ minLength: 1, maxLength: 128 }),
150034
+ type: import_typebox.Type.Literal("score"),
150035
+ instructions: import_typebox.Type.String({ minLength: 1, maxLength: 4e3 }),
150036
+ criteria: import_typebox.Type.Array(import_typebox.Type.String({ minLength: 1, maxLength: 4e3 }), { minItems: 2, maxItems: 10 })
150037
+ });
150038
+ var jevNoulQuestionSchema = import_typebox.Type.Object({
150039
+ id: import_typebox.Type.String({ minLength: 1, maxLength: 128 }),
150040
+ type: import_typebox.Type.Literal("noul"),
150041
+ instructions: import_typebox.Type.String({ minLength: 1, maxLength: 4e3 }),
150042
+ criteria: import_typebox.Type.Optional(import_typebox.Type.Object({
150043
+ true: import_typebox.Type.String({ minLength: 1, maxLength: 4e3 }),
150044
+ false: import_typebox.Type.String({ minLength: 1, maxLength: 4e3 })
150045
+ }))
150046
+ });
150047
+ var jevQuestionSchema = import_typebox.Type.Union([
150048
+ jevChoiceQuestionSchema,
150049
+ jevScoreQuestionSchema,
150050
+ jevNoulQuestionSchema
150051
+ ]);
150052
+ var jevEvaluatorInput = import_typebox.Type.Object({
150053
+ state: import_typebox.Type.String({ default: "" }),
150054
+ model: import_typebox.Type.Optional(import_typebox.Type.Literal("jev-1.13.0", {
150055
+ description: "Pinned TypeSafe Jev model",
150056
+ default: "jev-1.13.0"
150057
+ })),
150058
+ questions: import_typebox.Type.Array(jevQuestionSchema, { minItems: 1, maxItems: 100, default: [] })
150059
+ });
150018
150060
  var mapActionInput = import_typebox.Type.Object({
150019
150061
  over: import_typebox.Type.Any({ default: "" }),
150020
150062
  mapVariable: import_typebox.Type.String(),
@@ -150087,14 +150129,18 @@ async function execute(input: TelaInput) {
150087
150129
  var templateActionInput = import_typebox.Type.Object({
150088
150130
  templateId: import_typebox.Type.String(),
150089
150131
  variables: import_typebox.Type.Record(import_typebox.Type.String(), import_typebox.Type.Union([import_typebox.Type.String(), import_typebox.Type.Any()])),
150090
- tags: import_typebox.Type.Optional(import_typebox.Type.Array(import_typebox.Type.String(), { default: [] }))
150132
+ tags: import_typebox.Type.Optional(import_typebox.Type.Array(import_typebox.Type.String(), { default: [] })),
150133
+ slotValues: import_typebox.Type.Optional(import_typebox.Type.Record(
150134
+ import_typebox.Type.String(),
150135
+ import_typebox.Type.Union([import_typebox.Type.String(), import_typebox.Type.Array(import_typebox.Type.Record(import_typebox.Type.String(), import_typebox.Type.String()))])
150136
+ ))
150091
150137
  });
150092
150138
  }
150093
150139
  });
150094
150140
 
150095
- // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/graph.cjs
150141
+ // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/graph.cjs
150096
150142
  var require_graph = __commonJS({
150097
- "../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/graph.cjs"(exports2, module2) {
150143
+ "../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/graph.cjs"(exports2, module2) {
150098
150144
  "use strict";
150099
150145
  var __defProp3 = Object.defineProperty;
150100
150146
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -150114,9 +150160,9 @@ var require_graph = __commonJS({
150114
150160
  }
150115
150161
  });
150116
150162
 
150117
- // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/input-reference.cjs
150163
+ // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/input-reference.cjs
150118
150164
  var require_input_reference = __commonJS({
150119
- "../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/input-reference.cjs"(exports2, module2) {
150165
+ "../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/input-reference.cjs"(exports2, module2) {
150120
150166
  "use strict";
150121
150167
  var __defProp3 = Object.defineProperty;
150122
150168
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -150341,9 +150387,9 @@ var require_input_reference = __commonJS({
150341
150387
  }
150342
150388
  });
150343
150389
 
150344
- // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/lifecycle.cjs
150390
+ // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/lifecycle.cjs
150345
150391
  var require_lifecycle = __commonJS({
150346
- "../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/lifecycle.cjs"(exports2, module2) {
150392
+ "../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/lifecycle.cjs"(exports2, module2) {
150347
150393
  "use strict";
150348
150394
  var __defProp3 = Object.defineProperty;
150349
150395
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -150363,9 +150409,9 @@ var require_lifecycle = __commonJS({
150363
150409
  }
150364
150410
  });
150365
150411
 
150366
- // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/workflow-reference.cjs
150412
+ // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/workflow-reference.cjs
150367
150413
  var require_workflow_reference = __commonJS({
150368
- "../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/workflow-reference.cjs"(exports2, module2) {
150414
+ "../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/workflow-reference.cjs"(exports2, module2) {
150369
150415
  "use strict";
150370
150416
  var __defProp3 = Object.defineProperty;
150371
150417
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -150458,9 +150504,9 @@ var require_workflow_reference = __commonJS({
150458
150504
  }
150459
150505
  });
150460
150506
 
150461
- // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/workflow-update-spec.cjs
150507
+ // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/workflow-update-spec.cjs
150462
150508
  var require_workflow_update_spec = __commonJS({
150463
- "../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/workflow-update-spec.cjs"(exports2, module2) {
150509
+ "../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/workflow-update-spec.cjs"(exports2, module2) {
150464
150510
  "use strict";
150465
150511
  var __defProp3 = Object.defineProperty;
150466
150512
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -150480,9 +150526,9 @@ var require_workflow_update_spec = __commonJS({
150480
150526
  }
150481
150527
  });
150482
150528
 
150483
- // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/index.cjs
150529
+ // ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/index.cjs
150484
150530
  var require_cjs2 = __commonJS({
150485
- "../../node_modules/.pnpm/@meistrari+workflow-shared@1.5.0/node_modules/@meistrari/workflow-shared/dist/cjs/index.cjs"(exports2, module2) {
150531
+ "../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/index.cjs"(exports2, module2) {
150486
150532
  "use strict";
150487
150533
  var __defProp3 = Object.defineProperty;
150488
150534
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -150553,6 +150599,410 @@ var require_ids = __commonJS({
150553
150599
  }
150554
150600
  });
150555
150601
 
150602
+ // ../../packages/workflow-code/dist/compiler/output-schema.js
150603
+ var require_output_schema = __commonJS({
150604
+ "../../packages/workflow-code/dist/compiler/output-schema.js"(exports2) {
150605
+ "use strict";
150606
+ Object.defineProperty(exports2, "__esModule", { value: true });
150607
+ exports2.DOC_TEMPLATE_OUTPUT_JSON_SCHEMA = exports2.CROP_OUTPUT_JSON_SCHEMA = exports2.SPLITTER_OUTPUT_JSON_SCHEMA = exports2.FILE_INPUT_JSON_SCHEMA = exports2.FILE_OUTPUT_JSON_SCHEMA = void 0;
150608
+ exports2.createPromptOutputJsonSchema = createPromptOutputJsonSchema;
150609
+ exports2.selectOutputJsonSchema = selectOutputJsonSchema;
150610
+ exports2.isFileCompatibleOutputJsonSchema = isFileCompatibleOutputJsonSchema;
150611
+ exports2.isStringCompatibleOutputJsonSchema = isStringCompatibleOutputJsonSchema;
150612
+ exports2.FILE_OUTPUT_JSON_SCHEMA = Object.freeze({
150613
+ type: "object",
150614
+ properties: Object.freeze({
150615
+ name: Object.freeze({ type: "string" }),
150616
+ fileUrl: Object.freeze({ type: "string" }),
150617
+ mimeType: Object.freeze({ type: "string" }),
150618
+ base64: Object.freeze({ type: "string" }),
150619
+ vaultReference: Object.freeze({ type: "string" })
150620
+ })
150621
+ });
150622
+ exports2.FILE_INPUT_JSON_SCHEMA = Object.freeze({
150623
+ anyOf: Object.freeze([
150624
+ exports2.FILE_OUTPUT_JSON_SCHEMA,
150625
+ Object.freeze({ type: "array", items: exports2.FILE_OUTPUT_JSON_SCHEMA })
150626
+ ])
150627
+ });
150628
+ exports2.SPLITTER_OUTPUT_JSON_SCHEMA = Object.freeze({
150629
+ type: "array",
150630
+ items: Object.freeze({
150631
+ type: "object",
150632
+ properties: Object.freeze({
150633
+ startPage: Object.freeze({ type: "number" }),
150634
+ endPage: Object.freeze({ type: "number" }),
150635
+ pages: Object.freeze({ type: "string" }),
150636
+ originalFile: exports2.FILE_OUTPUT_JSON_SCHEMA,
150637
+ file: exports2.FILE_OUTPUT_JSON_SCHEMA,
150638
+ description: Object.freeze({ anyOf: Object.freeze([{ type: "string" }, { type: "null" }]) }),
150639
+ fileType: Object.freeze({ anyOf: Object.freeze([{ type: "string" }, { type: "null" }]) })
150640
+ }),
150641
+ required: Object.freeze(["startPage", "endPage", "pages", "originalFile", "file", "description", "fileType"])
150642
+ })
150643
+ });
150644
+ exports2.CROP_OUTPUT_JSON_SCHEMA = Object.freeze({
150645
+ type: "array",
150646
+ items: Object.freeze({
150647
+ type: "object",
150648
+ properties: Object.freeze({
150649
+ indexes: Object.freeze({
150650
+ type: "array",
150651
+ items: Object.freeze({ anyOf: Object.freeze([{ type: "integer" }, { type: "string" }]) })
150652
+ }),
150653
+ originalFile: exports2.FILE_OUTPUT_JSON_SCHEMA,
150654
+ file: exports2.FILE_OUTPUT_JSON_SCHEMA
150655
+ }),
150656
+ required: Object.freeze(["indexes", "originalFile", "file"])
150657
+ })
150658
+ });
150659
+ exports2.DOC_TEMPLATE_OUTPUT_JSON_SCHEMA = Object.freeze({
150660
+ type: "object",
150661
+ properties: Object.freeze({
150662
+ generatedDocument: exports2.FILE_OUTPUT_JSON_SCHEMA,
150663
+ generatedAt: Object.freeze({ type: "string" }),
150664
+ permalinkUrl: Object.freeze({ type: "string" }),
150665
+ permalinkId: Object.freeze({ type: "string" }),
150666
+ permalinkExpiresAt: Object.freeze({ anyOf: Object.freeze([{ type: "string" }, { type: "null" }]) })
150667
+ }),
150668
+ required: Object.freeze(["generatedDocument", "generatedAt"])
150669
+ });
150670
+ function createPromptOutputJsonSchema(schema) {
150671
+ return schema === void 0 || schema === null ? void 0 : { type: "object", properties: schema };
150672
+ }
150673
+ function selectOutputJsonSchema(schema, path2) {
150674
+ let selected = schema;
150675
+ for (const segment of path2) {
150676
+ if (!selected)
150677
+ return void 0;
150678
+ selected = selectOutputJsonSchemaSegment(selected, segment);
150679
+ }
150680
+ return selected;
150681
+ }
150682
+ function isFileCompatibleOutputJsonSchema(schema) {
150683
+ const variants = jsonSchemaVariants(schema);
150684
+ if (variants)
150685
+ return variants.every(isFileCompatibleOutputJsonSchema);
150686
+ return isFileJsonSchema(schema) || isFileArrayJsonSchema(schema);
150687
+ }
150688
+ function selectOutputJsonSchemaSegment(schema, segment) {
150689
+ const variants = jsonSchemaVariants(schema);
150690
+ if (variants) {
150691
+ const selected = variants.map((variant) => selectOutputJsonSchemaSegment(variant, segment));
150692
+ return selected.every((variant) => variant !== void 0) ? { anyOf: selected } : void 0;
150693
+ }
150694
+ if (schema.type === "array")
150695
+ return /^\d+$/.test(segment) ? schema.items : void 0;
150696
+ return isRecord3(schema.properties) ? schema.properties[segment] : void 0;
150697
+ }
150698
+ function isFileJsonSchema(schema) {
150699
+ const variants = jsonSchemaVariants(schema);
150700
+ if (variants)
150701
+ return variants.every(isFileJsonSchema);
150702
+ if (!isRecord3(schema))
150703
+ return false;
150704
+ const properties = schema.properties;
150705
+ if (schema.type !== "object" || !isRecord3(properties))
150706
+ return false;
150707
+ const stringFields = ["name", "fileUrl", "mimeType", "base64", "vaultReference"];
150708
+ if (!stringFields.every((key) => !(key in properties) || isStringCompatibleOutputJsonSchema(properties[key])))
150709
+ return false;
150710
+ return isStringCompatibleOutputJsonSchema(properties.name) && ["fileUrl", "vaultReference", "base64"].some((key) => isStringCompatibleOutputJsonSchema(properties[key]));
150711
+ }
150712
+ function isFileArrayJsonSchema(schema) {
150713
+ return isRecord3(schema) && schema.type === "array" && isFileJsonSchema(schema.items);
150714
+ }
150715
+ function isStringCompatibleOutputJsonSchema(schema) {
150716
+ const variants = jsonSchemaVariants(schema);
150717
+ if (variants)
150718
+ return variants.every(isStringCompatibleOutputJsonSchema);
150719
+ if (!isRecord3(schema))
150720
+ return false;
150721
+ if (schema.type !== void 0 && schema.type !== "string")
150722
+ return false;
150723
+ const hasStringConst = typeof schema.const === "string";
150724
+ if ("const" in schema && !hasStringConst)
150725
+ return false;
150726
+ const enumValues = schema.enum;
150727
+ const hasStringEnum = Array.isArray(enumValues) && enumValues.length > 0 && enumValues.every((value) => typeof value === "string");
150728
+ if ("enum" in schema && !hasStringEnum)
150729
+ return false;
150730
+ return schema.type === "string" || hasStringConst || hasStringEnum;
150731
+ }
150732
+ function jsonSchemaVariants(schema) {
150733
+ if (!isRecord3(schema))
150734
+ return void 0;
150735
+ const variants = Array.isArray(schema.anyOf) ? schema.anyOf : Array.isArray(schema.oneOf) ? schema.oneOf : void 0;
150736
+ return variants !== void 0 && variants.length > 0 && variants.every(isRecord3) ? variants : void 0;
150737
+ }
150738
+ function isRecord3(value) {
150739
+ return typeof value === "object" && value !== null && !Array.isArray(value);
150740
+ }
150741
+ }
150742
+ });
150743
+
150744
+ // ../../packages/workflow-code/dist/compiler/refs.js
150745
+ var require_refs = __commonJS({
150746
+ "../../packages/workflow-code/dist/compiler/refs.js"(exports2) {
150747
+ "use strict";
150748
+ Object.defineProperty(exports2, "__esModule", { value: true });
150749
+ exports2.resolvePromptRefs = resolvePromptRefs;
150750
+ exports2.resolveReferenceRecordRefs = resolveReferenceRecordRefs;
150751
+ exports2.resolveWorkflowRef = resolveWorkflowRef;
150752
+ exports2.resolveExclusiveRef = resolveExclusiveRef;
150753
+ exports2.resolveVisibleNodeIdentity = resolveVisibleNodeIdentity;
150754
+ var workflow_shared_1 = require_cjs2();
150755
+ function resolvePromptRefs(context) {
150756
+ const diagnostics = [];
150757
+ let prompt = context.prompt;
150758
+ for (const ref of context.refs) {
150759
+ const resolved = resolveWorkflowRef(ref, context);
150760
+ diagnostics.push(...resolved.diagnostics);
150761
+ if (!resolved.reference)
150762
+ continue;
150763
+ prompt = prompt.split(ref.token).join(resolved.reference);
150764
+ }
150765
+ return { prompt, diagnostics };
150766
+ }
150767
+ function resolveReferenceRecordRefs(context) {
150768
+ const diagnostics = [];
150769
+ const values = { ...context.values };
150770
+ for (const ref of context.refs) {
150771
+ const resolved = resolveWorkflowRef(ref, context);
150772
+ if (resolved.reference) {
150773
+ values[ref.key] = resolved.reference;
150774
+ continue;
150775
+ }
150776
+ diagnostics.push(...resolved.diagnostics.map((diagnostic) => ({
150777
+ ...diagnostic,
150778
+ message: diagnostic.message.replace("Prompt reference", `Reference record ${ref.key} reference`)
150779
+ })));
150780
+ }
150781
+ return { values: Object.freeze(values), diagnostics };
150782
+ }
150783
+ function resolveWorkflowRef(ref, context) {
150784
+ const resolved = ref.targetKind === "input" ? resolveInputRef(ref, context) : resolveNodeRef(ref, context);
150785
+ if (!resolved) {
150786
+ return {
150787
+ diagnostics: [{
150788
+ code: "compiler.ref.dangling",
150789
+ severity: "error",
150790
+ message: `Prompt reference ${ref.targetKey} does not match a workflow input or previous node`
150791
+ }]
150792
+ };
150793
+ }
150794
+ if (resolved === "forward") {
150795
+ return {
150796
+ diagnostics: [{
150797
+ code: "compiler.ref.forward",
150798
+ severity: "error",
150799
+ message: `Prompt reference ${ref.targetKey} points to a future workflow node`
150800
+ }]
150801
+ };
150802
+ }
150803
+ if (resolved === "scope") {
150804
+ return {
150805
+ diagnostics: [{
150806
+ code: "compiler.ref.scope",
150807
+ severity: "error",
150808
+ message: `Prompt reference ${ref.targetKey} points to a workflow node outside the visible scope`
150809
+ }]
150810
+ };
150811
+ }
150812
+ return {
150813
+ reference: resolved.reference,
150814
+ inputType: "inputType" in resolved ? resolved.inputType : void 0,
150815
+ nodeId: "nodeId" in resolved ? resolved.nodeId : void 0,
150816
+ diagnostics: []
150817
+ };
150818
+ }
150819
+ function resolveExclusiveRef(ref, context) {
150820
+ const resolved = resolveWorkflowRef(ref, context);
150821
+ if (resolved.reference)
150822
+ return resolved;
150823
+ return {
150824
+ diagnostics: resolved.diagnostics.map((diagnostic) => ({
150825
+ ...diagnostic,
150826
+ message: diagnostic.message.replace("Prompt reference", "Exclusive reference")
150827
+ }))
150828
+ };
150829
+ }
150830
+ function resolveInputRef(ref, context) {
150831
+ const id = context.inputIdsByKey.get(ref.targetKey);
150832
+ if (!id)
150833
+ return void 0;
150834
+ const reference = workflow_shared_1.InputReferenceURI.fromVariable({ name: id });
150835
+ return {
150836
+ reference: formatPromptReference(reference, ref),
150837
+ inputType: context.inputTypesByKey?.get(ref.targetKey)
150838
+ };
150839
+ }
150840
+ function resolveNodeRef(ref, context) {
150841
+ const candidates = context.nodeIdentitiesByKey.get(ref.targetKey) ?? [];
150842
+ if (candidates.length === 0)
150843
+ return void 0;
150844
+ const visible = resolveVisibleNodeIdentity(ref.targetKey, context);
150845
+ if (visible) {
150846
+ const reference = workflow_shared_1.ActionOutputReferenceURI.fromStepId(visible.id);
150847
+ return { reference: formatPromptReference(reference, ref), nodeId: visible.id };
150848
+ }
150849
+ if (candidates.some((candidate) => samePath(candidate.scopePath, context.currentNode.scopePath) && candidate.sequenceIndex >= context.currentNode.sequenceIndex)) {
150850
+ return "forward";
150851
+ }
150852
+ return "scope";
150853
+ }
150854
+ function resolveVisibleNodeIdentity(key, context) {
150855
+ const currentScopeCandidate = resolvePriorCandidateInScope(key, context.currentNode.scopePath, context.currentNode.sequenceIndex, context);
150856
+ if (currentScopeCandidate)
150857
+ return currentScopeCandidate;
150858
+ for (const boundary of [...context.currentNode.ancestorScopes].reverse()) {
150859
+ const candidate = resolvePriorCandidateInScope(key, boundary.scopePath, boundary.sequenceIndex, context);
150860
+ if (candidate)
150861
+ return candidate;
150862
+ }
150863
+ return void 0;
150864
+ }
150865
+ function resolvePriorCandidateInScope(key, scopePath, beforeSequenceIndex, context) {
150866
+ const candidates = (context.nodeIdentitiesByKey.get(key) ?? []).filter((candidate) => samePath(candidate.scopePath, scopePath) && candidate.sequenceIndex < beforeSequenceIndex).sort((left, right) => right.sequenceIndex - left.sequenceIndex);
150867
+ const nearest = candidates[0];
150868
+ if (!nearest)
150869
+ return void 0;
150870
+ if (candidates.filter((candidate) => candidate.sequenceIndex === nearest.sequenceIndex).length > 1)
150871
+ return void 0;
150872
+ return nearest;
150873
+ }
150874
+ function samePath(left, right) {
150875
+ return left.length === right.length && left.every((segment, index) => segment === right[index]);
150876
+ }
150877
+ function formatPromptReference(reference, ref) {
150878
+ if (ref.path && ref.path.length > 0)
150879
+ reference.appendPath([...ref.path]);
150880
+ if ("format" in ref && ref.format)
150881
+ reference.setFormat(ref.format);
150882
+ return reference.toReference();
150883
+ }
150884
+ }
150885
+ });
150886
+
150887
+ // ../../packages/workflow-code/dist/compiler/classifier.js
150888
+ var require_classifier = __commonJS({
150889
+ "../../packages/workflow-code/dist/compiler/classifier.js"(exports2) {
150890
+ "use strict";
150891
+ Object.defineProperty(exports2, "__esModule", { value: true });
150892
+ exports2.classifierModule = void 0;
150893
+ var workflow_shared_1 = require_cjs2();
150894
+ var zod_1 = require_zod();
150895
+ var ids_1 = require_ids();
150896
+ var output_schema_1 = require_output_schema();
150897
+ var refs_1 = require_refs();
150898
+ var sharedInputSchema = zod_1.z.fromJSONSchema(workflow_shared_1.jevEvaluatorInput);
150899
+ function hasValidInput(input) {
150900
+ if (!input || typeof input !== "object")
150901
+ return false;
150902
+ const candidate = input;
150903
+ if (typeof candidate.prompt !== "string" || !candidate.prompt.trim() || !Array.isArray(candidate.questions))
150904
+ return false;
150905
+ if (!sharedInputSchema.safeParse({ ...candidate, state: candidate.prompt }).success)
150906
+ return false;
150907
+ const ids = /* @__PURE__ */ new Set();
150908
+ for (const question of candidate.questions) {
150909
+ if (question.id !== question.id.trim() || !question.instructions.trim() || ids.has(question.id))
150910
+ return false;
150911
+ ids.add(question.id);
150912
+ if (question.type === "choice") {
150913
+ const keys = /* @__PURE__ */ new Set();
150914
+ for (const criterion of question.criteria) {
150915
+ if (criterion.key !== criterion.key.trim() || keys.has(criterion.key))
150916
+ return false;
150917
+ keys.add(criterion.key);
150918
+ }
150919
+ }
150920
+ if (question.type === "score" && question.criteria.some((criterion) => !criterion.trim()))
150921
+ return false;
150922
+ if (question.type === "noul" && question.criteria && (!question.criteria.true.trim() || !question.criteria.false.trim()))
150923
+ return false;
150924
+ }
150925
+ return true;
150926
+ }
150927
+ function invalidInput(node) {
150928
+ return {
150929
+ code: "compiler.module.invalid_input",
150930
+ severity: "error",
150931
+ message: `Node ${node.name || "<unnamed>"} has invalid classifier input; use a nonblank prompt and valid questions with unique, trimmed IDs and choice keys`
150932
+ };
150933
+ }
150934
+ var probability = { type: "number", minimum: 0, maximum: 1 };
150935
+ function objectSchema(properties) {
150936
+ return { type: "object", properties, required: Object.keys(properties), additionalProperties: false };
150937
+ }
150938
+ function answerSchema(question) {
150939
+ if (question.type === "noul")
150940
+ return objectSchema({ type: { const: "noul" }, noul: probability });
150941
+ if (question.type === "choice") {
150942
+ return objectSchema({
150943
+ type: { const: "choice" },
150944
+ choice: { type: "string", enum: question.criteria.map((criterion) => criterion.key) },
150945
+ probabilities: objectSchema(Object.fromEntries(question.criteria.map((criterion) => [criterion.key, probability]))),
150946
+ confidence: probability
150947
+ });
150948
+ }
150949
+ return objectSchema({
150950
+ type: { const: "score" },
150951
+ score: { type: "number", minimum: 0, maximum: question.criteria.length - 1 },
150952
+ legend: objectSchema(Object.fromEntries(question.criteria.map((criterion, index) => [String(index), { const: criterion.trim() }]))),
150953
+ probabilities: objectSchema(Object.fromEntries(question.criteria.map((_2, index) => [String(index), probability]))),
150954
+ confidence: probability
150955
+ });
150956
+ }
150957
+ exports2.classifierModule = {
150958
+ kind: "classifier",
150959
+ actionId: workflow_shared_1.WORKFLOW_ACTION_IDS.jevEvaluator,
150960
+ validate: (node) => hasValidInput(node.input) ? [] : [invalidInput(node)],
150961
+ createFailedInput: () => ({ state: "Workflow Code compilation failed. Check compiler diagnostics.", questions: [] }),
150962
+ lower(node, context) {
150963
+ if (!hasValidInput(node.input))
150964
+ return void 0;
150965
+ for (const ref of node.refs ?? []) {
150966
+ const resolved2 = (0, refs_1.resolveWorkflowRef)(ref, context);
150967
+ const schema = resolved2.nodeId === void 0 ? void 0 : (0, output_schema_1.selectOutputJsonSchema)(context.nodeOutputSchemasById.get(resolved2.nodeId), ref.path ?? []);
150968
+ if (resolved2.inputType === "file" || (0, output_schema_1.isFileCompatibleOutputJsonSchema)(schema) || ref.format !== void 0 && ref.format !== "string") {
150969
+ context.diagnostics.push({
150970
+ code: "compiler.ref.incompatible",
150971
+ severity: "error",
150972
+ message: `Classifier ${node.name} prompt only accepts text values and string-formatted references`
150973
+ });
150974
+ }
150975
+ }
150976
+ const resolved = (0, refs_1.resolvePromptRefs)({ ...context, prompt: node.input.prompt, refs: node.refs ?? [] });
150977
+ context.diagnostics.push(...resolved.diagnostics);
150978
+ const linearPorts = { input: (0, ids_1.defaultInputPortId)(context.nodeId), output: (0, ids_1.defaultOutputPortId)(context.nodeId) };
150979
+ return {
150980
+ node: {
150981
+ id: context.nodeId,
150982
+ name: node.name,
150983
+ actionId: workflow_shared_1.WORKFLOW_ACTION_IDS.jevEvaluator,
150984
+ ports: [
150985
+ { id: linearPorts.input, dir: "in", type: "default" },
150986
+ { id: linearPorts.output, dir: "out", type: "default" }
150987
+ ],
150988
+ input: {
150989
+ state: resolved.prompt,
150990
+ questions: node.input.questions,
150991
+ ...node.input.model !== void 0 ? { model: node.input.model } : {}
150992
+ }
150993
+ },
150994
+ linearPorts,
150995
+ outputSchema: objectSchema({
150996
+ model: { type: "string" },
150997
+ answers: objectSchema(Object.fromEntries(node.input.questions.map((question) => [question.id, answerSchema(question)]))),
150998
+ usage: objectSchema({ input_tokens: { type: "integer", minimum: 0 }, output_tokens: { type: "integer", minimum: 0 } })
150999
+ })
151000
+ };
151001
+ }
151002
+ };
151003
+ }
151004
+ });
151005
+
150556
151006
  // ../../packages/workflow-code/dist/authoring/remote.js
150557
151007
  var require_remote = __commonJS({
150558
151008
  "../../packages/workflow-code/dist/authoring/remote.js"(exports2) {
@@ -364665,148 +365115,6 @@ var require_imports = __commonJS({
364665
365115
  }
364666
365116
  });
364667
365117
 
364668
- // ../../packages/workflow-code/dist/compiler/output-schema.js
364669
- var require_output_schema = __commonJS({
364670
- "../../packages/workflow-code/dist/compiler/output-schema.js"(exports2) {
364671
- "use strict";
364672
- Object.defineProperty(exports2, "__esModule", { value: true });
364673
- exports2.DOC_TEMPLATE_OUTPUT_JSON_SCHEMA = exports2.CROP_OUTPUT_JSON_SCHEMA = exports2.SPLITTER_OUTPUT_JSON_SCHEMA = exports2.FILE_INPUT_JSON_SCHEMA = exports2.FILE_OUTPUT_JSON_SCHEMA = void 0;
364674
- exports2.createPromptOutputJsonSchema = createPromptOutputJsonSchema;
364675
- exports2.selectOutputJsonSchema = selectOutputJsonSchema;
364676
- exports2.isFileCompatibleOutputJsonSchema = isFileCompatibleOutputJsonSchema;
364677
- exports2.isStringCompatibleOutputJsonSchema = isStringCompatibleOutputJsonSchema;
364678
- exports2.FILE_OUTPUT_JSON_SCHEMA = Object.freeze({
364679
- type: "object",
364680
- properties: Object.freeze({
364681
- name: Object.freeze({ type: "string" }),
364682
- fileUrl: Object.freeze({ type: "string" }),
364683
- mimeType: Object.freeze({ type: "string" }),
364684
- base64: Object.freeze({ type: "string" }),
364685
- vaultReference: Object.freeze({ type: "string" })
364686
- })
364687
- });
364688
- exports2.FILE_INPUT_JSON_SCHEMA = Object.freeze({
364689
- anyOf: Object.freeze([
364690
- exports2.FILE_OUTPUT_JSON_SCHEMA,
364691
- Object.freeze({ type: "array", items: exports2.FILE_OUTPUT_JSON_SCHEMA })
364692
- ])
364693
- });
364694
- exports2.SPLITTER_OUTPUT_JSON_SCHEMA = Object.freeze({
364695
- type: "array",
364696
- items: Object.freeze({
364697
- type: "object",
364698
- properties: Object.freeze({
364699
- startPage: Object.freeze({ type: "number" }),
364700
- endPage: Object.freeze({ type: "number" }),
364701
- pages: Object.freeze({ type: "string" }),
364702
- originalFile: exports2.FILE_OUTPUT_JSON_SCHEMA,
364703
- file: exports2.FILE_OUTPUT_JSON_SCHEMA,
364704
- description: Object.freeze({ anyOf: Object.freeze([{ type: "string" }, { type: "null" }]) }),
364705
- fileType: Object.freeze({ anyOf: Object.freeze([{ type: "string" }, { type: "null" }]) })
364706
- }),
364707
- required: Object.freeze(["startPage", "endPage", "pages", "originalFile", "file", "description", "fileType"])
364708
- })
364709
- });
364710
- exports2.CROP_OUTPUT_JSON_SCHEMA = Object.freeze({
364711
- type: "array",
364712
- items: Object.freeze({
364713
- type: "object",
364714
- properties: Object.freeze({
364715
- indexes: Object.freeze({
364716
- type: "array",
364717
- items: Object.freeze({ anyOf: Object.freeze([{ type: "integer" }, { type: "string" }]) })
364718
- }),
364719
- originalFile: exports2.FILE_OUTPUT_JSON_SCHEMA,
364720
- file: exports2.FILE_OUTPUT_JSON_SCHEMA
364721
- }),
364722
- required: Object.freeze(["indexes", "originalFile", "file"])
364723
- })
364724
- });
364725
- exports2.DOC_TEMPLATE_OUTPUT_JSON_SCHEMA = Object.freeze({
364726
- type: "object",
364727
- properties: Object.freeze({
364728
- generatedDocument: exports2.FILE_OUTPUT_JSON_SCHEMA,
364729
- generatedAt: Object.freeze({ type: "string" }),
364730
- permalinkUrl: Object.freeze({ type: "string" }),
364731
- permalinkId: Object.freeze({ type: "string" }),
364732
- permalinkExpiresAt: Object.freeze({ anyOf: Object.freeze([{ type: "string" }, { type: "null" }]) })
364733
- }),
364734
- required: Object.freeze(["generatedDocument", "generatedAt"])
364735
- });
364736
- function createPromptOutputJsonSchema(schema) {
364737
- return schema === void 0 || schema === null ? void 0 : { type: "object", properties: schema };
364738
- }
364739
- function selectOutputJsonSchema(schema, path2) {
364740
- let selected = schema;
364741
- for (const segment of path2) {
364742
- if (!selected)
364743
- return void 0;
364744
- selected = selectOutputJsonSchemaSegment(selected, segment);
364745
- }
364746
- return selected;
364747
- }
364748
- function isFileCompatibleOutputJsonSchema(schema) {
364749
- const variants = jsonSchemaVariants(schema);
364750
- if (variants)
364751
- return variants.every(isFileCompatibleOutputJsonSchema);
364752
- return isFileJsonSchema(schema) || isFileArrayJsonSchema(schema);
364753
- }
364754
- function selectOutputJsonSchemaSegment(schema, segment) {
364755
- const variants = jsonSchemaVariants(schema);
364756
- if (variants) {
364757
- const selected = variants.map((variant) => selectOutputJsonSchemaSegment(variant, segment));
364758
- return selected.every((variant) => variant !== void 0) ? { anyOf: selected } : void 0;
364759
- }
364760
- if (schema.type === "array")
364761
- return /^\d+$/.test(segment) ? schema.items : void 0;
364762
- return isRecord3(schema.properties) ? schema.properties[segment] : void 0;
364763
- }
364764
- function isFileJsonSchema(schema) {
364765
- const variants = jsonSchemaVariants(schema);
364766
- if (variants)
364767
- return variants.every(isFileJsonSchema);
364768
- if (!isRecord3(schema))
364769
- return false;
364770
- const properties = schema.properties;
364771
- if (schema.type !== "object" || !isRecord3(properties))
364772
- return false;
364773
- const stringFields = ["name", "fileUrl", "mimeType", "base64", "vaultReference"];
364774
- if (!stringFields.every((key) => !(key in properties) || isStringCompatibleOutputJsonSchema(properties[key])))
364775
- return false;
364776
- return isStringCompatibleOutputJsonSchema(properties.name) && ["fileUrl", "vaultReference", "base64"].some((key) => isStringCompatibleOutputJsonSchema(properties[key]));
364777
- }
364778
- function isFileArrayJsonSchema(schema) {
364779
- return isRecord3(schema) && schema.type === "array" && isFileJsonSchema(schema.items);
364780
- }
364781
- function isStringCompatibleOutputJsonSchema(schema) {
364782
- const variants = jsonSchemaVariants(schema);
364783
- if (variants)
364784
- return variants.every(isStringCompatibleOutputJsonSchema);
364785
- if (!isRecord3(schema))
364786
- return false;
364787
- if (schema.type !== void 0 && schema.type !== "string")
364788
- return false;
364789
- const hasStringConst = typeof schema.const === "string";
364790
- if ("const" in schema && !hasStringConst)
364791
- return false;
364792
- const enumValues = schema.enum;
364793
- const hasStringEnum = Array.isArray(enumValues) && enumValues.length > 0 && enumValues.every((value) => typeof value === "string");
364794
- if ("enum" in schema && !hasStringEnum)
364795
- return false;
364796
- return schema.type === "string" || hasStringConst || hasStringEnum;
364797
- }
364798
- function jsonSchemaVariants(schema) {
364799
- if (!isRecord3(schema))
364800
- return void 0;
364801
- const variants = Array.isArray(schema.anyOf) ? schema.anyOf : Array.isArray(schema.oneOf) ? schema.oneOf : void 0;
364802
- return variants !== void 0 && variants.length > 0 && variants.every(isRecord3) ? variants : void 0;
364803
- }
364804
- function isRecord3(value) {
364805
- return typeof value === "object" && value !== null && !Array.isArray(value);
364806
- }
364807
- }
364808
- });
364809
-
364810
365118
  // ../../packages/workflow-code/dist/compiler/code-extraction/output-schema.js
364811
365119
  var require_output_schema2 = __commonJS({
364812
365120
  "../../packages/workflow-code/dist/compiler/code-extraction/output-schema.js"(exports2) {
@@ -365187,149 +365495,6 @@ var require_rewrite_refs = __commonJS({
365187
365495
  }
365188
365496
  });
365189
365497
 
365190
- // ../../packages/workflow-code/dist/compiler/refs.js
365191
- var require_refs = __commonJS({
365192
- "../../packages/workflow-code/dist/compiler/refs.js"(exports2) {
365193
- "use strict";
365194
- Object.defineProperty(exports2, "__esModule", { value: true });
365195
- exports2.resolvePromptRefs = resolvePromptRefs;
365196
- exports2.resolveReferenceRecordRefs = resolveReferenceRecordRefs;
365197
- exports2.resolveWorkflowRef = resolveWorkflowRef;
365198
- exports2.resolveExclusiveRef = resolveExclusiveRef;
365199
- exports2.resolveVisibleNodeIdentity = resolveVisibleNodeIdentity;
365200
- var workflow_shared_1 = require_cjs2();
365201
- function resolvePromptRefs(context) {
365202
- const diagnostics = [];
365203
- let prompt = context.prompt;
365204
- for (const ref of context.refs) {
365205
- const resolved = resolveWorkflowRef(ref, context);
365206
- diagnostics.push(...resolved.diagnostics);
365207
- if (!resolved.reference)
365208
- continue;
365209
- prompt = prompt.split(ref.token).join(resolved.reference);
365210
- }
365211
- return { prompt, diagnostics };
365212
- }
365213
- function resolveReferenceRecordRefs(context) {
365214
- const diagnostics = [];
365215
- const values = { ...context.values };
365216
- for (const ref of context.refs) {
365217
- const resolved = resolveWorkflowRef(ref, context);
365218
- if (resolved.reference) {
365219
- values[ref.key] = resolved.reference;
365220
- continue;
365221
- }
365222
- diagnostics.push(...resolved.diagnostics.map((diagnostic) => ({
365223
- ...diagnostic,
365224
- message: diagnostic.message.replace("Prompt reference", `Reference record ${ref.key} reference`)
365225
- })));
365226
- }
365227
- return { values: Object.freeze(values), diagnostics };
365228
- }
365229
- function resolveWorkflowRef(ref, context) {
365230
- const resolved = ref.targetKind === "input" ? resolveInputRef(ref, context) : resolveNodeRef(ref, context);
365231
- if (!resolved) {
365232
- return {
365233
- diagnostics: [{
365234
- code: "compiler.ref.dangling",
365235
- severity: "error",
365236
- message: `Prompt reference ${ref.targetKey} does not match a workflow input or previous node`
365237
- }]
365238
- };
365239
- }
365240
- if (resolved === "forward") {
365241
- return {
365242
- diagnostics: [{
365243
- code: "compiler.ref.forward",
365244
- severity: "error",
365245
- message: `Prompt reference ${ref.targetKey} points to a future workflow node`
365246
- }]
365247
- };
365248
- }
365249
- if (resolved === "scope") {
365250
- return {
365251
- diagnostics: [{
365252
- code: "compiler.ref.scope",
365253
- severity: "error",
365254
- message: `Prompt reference ${ref.targetKey} points to a workflow node outside the visible scope`
365255
- }]
365256
- };
365257
- }
365258
- return {
365259
- reference: resolved.reference,
365260
- inputType: "inputType" in resolved ? resolved.inputType : void 0,
365261
- nodeId: "nodeId" in resolved ? resolved.nodeId : void 0,
365262
- diagnostics: []
365263
- };
365264
- }
365265
- function resolveExclusiveRef(ref, context) {
365266
- const resolved = resolveWorkflowRef(ref, context);
365267
- if (resolved.reference)
365268
- return resolved;
365269
- return {
365270
- diagnostics: resolved.diagnostics.map((diagnostic) => ({
365271
- ...diagnostic,
365272
- message: diagnostic.message.replace("Prompt reference", "Exclusive reference")
365273
- }))
365274
- };
365275
- }
365276
- function resolveInputRef(ref, context) {
365277
- const id = context.inputIdsByKey.get(ref.targetKey);
365278
- if (!id)
365279
- return void 0;
365280
- const reference = workflow_shared_1.InputReferenceURI.fromVariable({ name: id });
365281
- return {
365282
- reference: formatPromptReference(reference, ref),
365283
- inputType: context.inputTypesByKey?.get(ref.targetKey)
365284
- };
365285
- }
365286
- function resolveNodeRef(ref, context) {
365287
- const candidates = context.nodeIdentitiesByKey.get(ref.targetKey) ?? [];
365288
- if (candidates.length === 0)
365289
- return void 0;
365290
- const visible = resolveVisibleNodeIdentity(ref.targetKey, context);
365291
- if (visible) {
365292
- const reference = workflow_shared_1.ActionOutputReferenceURI.fromStepId(visible.id);
365293
- return { reference: formatPromptReference(reference, ref), nodeId: visible.id };
365294
- }
365295
- if (candidates.some((candidate) => samePath(candidate.scopePath, context.currentNode.scopePath) && candidate.sequenceIndex >= context.currentNode.sequenceIndex)) {
365296
- return "forward";
365297
- }
365298
- return "scope";
365299
- }
365300
- function resolveVisibleNodeIdentity(key, context) {
365301
- const currentScopeCandidate = resolvePriorCandidateInScope(key, context.currentNode.scopePath, context.currentNode.sequenceIndex, context);
365302
- if (currentScopeCandidate)
365303
- return currentScopeCandidate;
365304
- for (const boundary of [...context.currentNode.ancestorScopes].reverse()) {
365305
- const candidate = resolvePriorCandidateInScope(key, boundary.scopePath, boundary.sequenceIndex, context);
365306
- if (candidate)
365307
- return candidate;
365308
- }
365309
- return void 0;
365310
- }
365311
- function resolvePriorCandidateInScope(key, scopePath, beforeSequenceIndex, context) {
365312
- const candidates = (context.nodeIdentitiesByKey.get(key) ?? []).filter((candidate) => samePath(candidate.scopePath, scopePath) && candidate.sequenceIndex < beforeSequenceIndex).sort((left, right) => right.sequenceIndex - left.sequenceIndex);
365313
- const nearest = candidates[0];
365314
- if (!nearest)
365315
- return void 0;
365316
- if (candidates.filter((candidate) => candidate.sequenceIndex === nearest.sequenceIndex).length > 1)
365317
- return void 0;
365318
- return nearest;
365319
- }
365320
- function samePath(left, right) {
365321
- return left.length === right.length && left.every((segment, index) => segment === right[index]);
365322
- }
365323
- function formatPromptReference(reference, ref) {
365324
- if (ref.path && ref.path.length > 0)
365325
- reference.appendPath([...ref.path]);
365326
- if ("format" in ref && ref.format)
365327
- reference.setFormat(ref.format);
365328
- return reference.toReference();
365329
- }
365330
- }
365331
- });
365332
-
365333
365498
  // ../../packages/workflow-code/dist/compiler/code-extraction/extract.js
365334
365499
  var require_extract3 = __commonJS({
365335
365500
  "../../packages/workflow-code/dist/compiler/code-extraction/extract.js"(exports2) {
@@ -367388,6 +367553,7 @@ var require_modules = __commonJS({
367388
367553
  "use strict";
367389
367554
  Object.defineProperty(exports2, "__esModule", { value: true });
367390
367555
  exports2.nodeModuleRegistry = void 0;
367556
+ var classifier_1 = require_classifier();
367391
367557
  var contracts_1 = require_contracts();
367392
367558
  var workflow_shared_1 = require_cjs2();
367393
367559
  var remote_1 = require_remote();
@@ -368626,6 +368792,7 @@ var require_modules = __commonJS({
368626
368792
  };
368627
368793
  }
368628
368794
  exports2.nodeModuleRegistry = /* @__PURE__ */ new Map([
368795
+ [classifier_1.classifierModule.kind, classifier_1.classifierModule],
368629
368796
  [llmModule.kind, llmModule],
368630
368797
  [remoteExecutableModule.kind, remoteExecutableModule],
368631
368798
  [remoteAgentModule.kind, remoteAgentModule],
@@ -368943,12 +369110,33 @@ var require_transpile = __commonJS({
368943
369110
  return createFailedSplitterNode(workflowKey, declaration);
368944
369111
  if (declaration.node.nodeKind === "crop")
368945
369112
  return createFailedCropNode(workflowKey, declaration);
369113
+ if (declaration.node.nodeKind === "classifier")
369114
+ return createFailedClassifierNode(workflowKey, declaration);
368946
369115
  if (declaration.node.nodeKind === "doc-template")
368947
369116
  return createFailedDocTemplateNode(workflowKey, declaration);
368948
369117
  if (declaration.node.nodeKind === "remote-executable" || declaration.node.nodeKind === "remote-agent" || declaration.node.nodeKind === "remote-template")
368949
369118
  return createFailedRemoteNode(workflowKey, declaration);
368950
369119
  return createFailedPromptNode(workflowKey, declaration);
368951
369120
  }
369121
+ function createFailedClassifierNode(workflowKey, declaration) {
369122
+ const nodeId = (0, ids_1.stableNodeId)(workflowKey, declaration.node, declaration.path);
369123
+ const linearPorts = failedNodePorts(nodeId);
369124
+ const module3 = modules_1.nodeModuleRegistry.get(declaration.node.nodeKind);
369125
+ return {
369126
+ declarationIndex: declaration.ordinal,
369127
+ path: declaration.path,
369128
+ scopePath: declaration.scopePath,
369129
+ sequenceIndex: declaration.sequenceIndex,
369130
+ linearPorts,
369131
+ node: {
369132
+ id: nodeId,
369133
+ name: declaration.node.name,
369134
+ actionId: module3?.actionId ?? workflow_shared_1.WORKFLOW_ACTION_IDS.jevEvaluator,
369135
+ ports: workflowNodePorts(linearPorts),
369136
+ input: module3?.createFailedInput(declaration.node) ?? {}
369137
+ }
369138
+ };
369139
+ }
368952
369140
  function createFailedDocTemplateNode(workflowKey, declaration) {
368953
369141
  const nodeId = (0, ids_1.stableNodeId)(workflowKey, declaration.node, declaration.path);
368954
369142
  const linearPorts = failedNodePorts(nodeId);
@@ -370249,6 +370437,7 @@ var require_evaluate_source = __commonJS({
370249
370437
  collectWorkflowCodeAliasBindings(node, node.statements, "build", scopedBindings.buildBindings, scopedBindings.buildNamespaceBindings, scopedBindings.buildNamespaceMemberBindings);
370250
370438
  collectWorkflowCodeAliasBindings(node, node.statements, "code", scopedBindings.codeBindings, scopedBindings.codeNamespaceBindings, scopedBindings.codeNamespaceMemberBindings);
370251
370439
  collectWorkflowCodeAliasBindings(node, node.statements, "agent", scopedBindings.promptNodeBindings, scopedBindings.promptNodeNamespaceBindings, scopedBindings.promptNodeNamespaceMemberBindings);
370440
+ collectWorkflowCodeAliasBindings(node, node.statements, "classifier", scopedBindings.promptNodeBindings, scopedBindings.promptNodeNamespaceBindings, scopedBindings.promptNodeNamespaceMemberBindings);
370252
370441
  collectWorkflowCodeAliasBindings(node, node.statements, "llm", scopedBindings.promptNodeBindings, scopedBindings.promptNodeNamespaceBindings, scopedBindings.promptNodeNamespaceMemberBindings);
370253
370442
  collectWorkflowCodeAliasBindings(node, node.statements, "map", scopedBindings.promptNodeBindings, scopedBindings.promptNodeNamespaceBindings, scopedBindings.promptNodeNamespaceMemberBindings);
370254
370443
  collectWorkflowCodeAliasBindings(node, node.statements, "docTemplate", scopedBindings.promptNodeBindings, scopedBindings.promptNodeNamespaceBindings, scopedBindings.promptNodeNamespaceMemberBindings);
@@ -370432,7 +370621,7 @@ var require_evaluate_source = __commonJS({
370432
370621
  return Boolean(namespaceMemberBindings.get(root)?.has(members.join(".")));
370433
370622
  }
370434
370623
  function isPromptNodeMemberName(name) {
370435
- return name === "agent" || name === "condition" || name === "docTemplate" || name === "llm" || name === "map";
370624
+ return name === "agent" || name === "condition" || name === "docTemplate" || name === "classifier" || name === "llm" || name === "map";
370436
370625
  }
370437
370626
  function isWorkflowCodeMemberExpression(expression, memberName, memberBindings, namespaceBindings, namespaceMemberBindings) {
370438
370627
  const unwrapped = unwrapExpression(expression);
@@ -370952,7 +371141,7 @@ var require_evaluate_source = __commonJS({
370952
371141
  }
370953
371142
  }
370954
371143
  function addWorkflowCodePromptNodeMembersToExport(prefix, exportedNamespaces) {
370955
- for (const memberName of ["agent", "condition", "llm", "map"])
371144
+ for (const memberName of ["agent", "classifier", "condition", "llm", "map"])
370956
371145
  exportedNamespaces.add(`${prefix}.${memberName}`);
370957
371146
  }
370958
371147
  function addWorkflowCodeNamespaceMembersToExport(members, prefix, exportedNamespaces) {
@@ -371038,7 +371227,7 @@ var require_evaluate_source = __commonJS({
371038
371227
  exportedNames.codeNamespaces.add(statement.exportClause.name.text);
371039
371228
  for (const exportedName of targetExports.codeNamespaces)
371040
371229
  exportedNames.codeNamespaces.add(`${statement.exportClause.name.text}.${exportedName}`);
371041
- for (const memberName of ["agent", "condition", "llm", "map"]) {
371230
+ for (const memberName of ["agent", "classifier", "condition", "llm", "map"]) {
371042
371231
  if (targetExports.promptNodes.has(memberName))
371043
371232
  exportedNames.promptNodeNamespaces.add(`${statement.exportClause.name.text}.${memberName}`);
371044
371233
  }
@@ -371070,6 +371259,7 @@ var require_evaluate_source = __commonJS({
371070
371259
  exportedNames.promptNodes.add("agent");
371071
371260
  exportedNames.promptNodes.add("docTemplate");
371072
371261
  exportedNames.promptNodes.add("condition");
371262
+ exportedNames.promptNodes.add("classifier");
371073
371263
  exportedNames.promptNodes.add("llm");
371074
371264
  exportedNames.promptNodes.add("map");
371075
371265
  return;
@@ -371173,6 +371363,14 @@ const __workflowCodeApi = (() => {
371173
371363
  const freeze = Object.freeze
371174
371364
  const pathKey = '__workflowCodePath'
371175
371365
  const cloneJson = (value) => value == null ? value : JSON.parse(JSON.stringify(value))
371366
+ const freezeClassifierQuestions = (value) => {
371367
+ if (value && typeof value === 'object') {
371368
+ for (const child of Object.values(value))
371369
+ freezeClassifierQuestions(child)
371370
+ freeze(value)
371371
+ }
371372
+ return value
371373
+ }
371176
371374
  const remoteRefBindingKey = Symbol.for('@meistrari/workflow-code/remote-ref-binding')
371177
371375
  const sourceDiagnostic = (hint, source) => Object.freeze(Object.assign(Object.create(null), {
371178
371376
  __workflowCodeSourceDiagnostic: true,
@@ -371670,6 +371868,10 @@ const __workflowCodeApi = (() => {
371670
371868
  docTemplate: docTemplateNode,
371671
371869
  condition: conditionNode,
371672
371870
  input: freeze({ text: (options) => baseInput('text', options), file: (options) => baseInput('file', options) }),
371871
+ classifier: (options) => promptNode('classifier', options, (input) => ({
371872
+ questions: freezeClassifierQuestions(cloneJson(input.questions)),
371873
+ ...(input.model !== undefined ? { model: input.model } : {}),
371874
+ })),
371673
371875
  llm: (options) => promptNode('llm', options, llmInput),
371674
371876
  map: mapNode,
371675
371877
  splitter: splitterNode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/tela-cli",
3
- "version": "1.9.5",
3
+ "version": "1.10.0",
4
4
  "description": "Tela command line tools for local state and agent workflows.",
5
5
  "engines": {
6
6
  "node": ">=22"