@meistrari/tela-cli 1.9.4 → 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.
- package/dist/commands/ingredients.js +1 -1
- package/dist/index.js +539 -326
- package/dist/session.d.ts +1 -1
- package/dist/session.js +21 -9
- package/package.json +1 -1
|
@@ -138,7 +138,7 @@ async function callIngredientApi(args, _options, io) {
|
|
|
138
138
|
const { client, baseUrl } = await (0, session_1.loadPantryForContext)(targetSession.resolved);
|
|
139
139
|
const ingredient = (0, tela_pantry_1.assertIngredientType)(await (0, tela_pantry_1.fetchServiceIngredient)(client, slug, baseUrl), 'api');
|
|
140
140
|
const { inventory } = await (0, tela_local_config_1.loadInventory)((0, tela_local_config_1.getTelaLocalPaths)().inventoryFile);
|
|
141
|
-
const environment = (0, tela_pantry_1.resolveServiceEnvironment)(ingredient, inventory.services.environmentDefaults, flags.serviceEnv);
|
|
141
|
+
const environment = (0, tela_pantry_1.resolveServiceEnvironment)(ingredient, inventory.services.environmentDefaults, flags.serviceEnv, targetSession.resolved.context.environmentId);
|
|
142
142
|
if (!environment) {
|
|
143
143
|
return usageError(`Ingredient '${slug}' has no environments configured.`, io);
|
|
144
144
|
}
|
package/dist/index.js
CHANGED
|
@@ -62061,7 +62061,7 @@ var require_environments = __commonJS({
|
|
|
62061
62061
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
62062
62062
|
exports2.resolveServiceEnvironment = resolveServiceEnvironment2;
|
|
62063
62063
|
var FALLBACK_ORDER = ["tooling", "production", "staging", "development"];
|
|
62064
|
-
function resolveServiceEnvironment2(ingredient, environmentDefaults, override) {
|
|
62064
|
+
function resolveServiceEnvironment2(ingredient, environmentDefaults, override, preferred) {
|
|
62065
62065
|
const environments = ingredient.environments;
|
|
62066
62066
|
if (override) {
|
|
62067
62067
|
const found = environments.find((environment) => environment.slug === override);
|
|
@@ -62081,8 +62081,9 @@ var require_environments = __commonJS({
|
|
|
62081
62081
|
if (found)
|
|
62082
62082
|
return found;
|
|
62083
62083
|
}
|
|
62084
|
-
|
|
62085
|
-
|
|
62084
|
+
const order = preferred ? [preferred] : FALLBACK_ORDER;
|
|
62085
|
+
for (const slug of order) {
|
|
62086
|
+
const found = environments.find((environment) => environment.slug === slug);
|
|
62086
62087
|
if (found)
|
|
62087
62088
|
return found;
|
|
62088
62089
|
}
|
|
@@ -142873,9 +142874,9 @@ var require_contracts = __commonJS({
|
|
|
142873
142874
|
}
|
|
142874
142875
|
});
|
|
142875
142876
|
|
|
142876
|
-
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
142877
|
+
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-ids.cjs
|
|
142877
142878
|
var require_action_ids = __commonJS({
|
|
142878
|
-
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
142879
|
+
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-ids.cjs"(exports2, module2) {
|
|
142879
142880
|
"use strict";
|
|
142880
142881
|
var __defProp3 = Object.defineProperty;
|
|
142881
142882
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -142901,6 +142902,7 @@ var require_action_ids = __commonJS({
|
|
|
142901
142902
|
module2.exports = __toCommonJS2(action_ids_exports);
|
|
142902
142903
|
var WORKFLOW_ACTION_IDS = {
|
|
142903
142904
|
llmCompletion: "llm-completion",
|
|
142905
|
+
jevEvaluator: "jev-evaluator",
|
|
142904
142906
|
agent: "agent",
|
|
142905
142907
|
agentFcc: "agent-fcc",
|
|
142906
142908
|
codeExecution: "code-execution",
|
|
@@ -142916,9 +142918,9 @@ var require_action_ids = __commonJS({
|
|
|
142916
142918
|
}
|
|
142917
142919
|
});
|
|
142918
142920
|
|
|
142919
|
-
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
142921
|
+
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/reference-format.cjs
|
|
142920
142922
|
var require_reference_format = __commonJS({
|
|
142921
|
-
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
142923
|
+
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/reference-format.cjs"(exports2, module2) {
|
|
142922
142924
|
"use strict";
|
|
142923
142925
|
var __defProp3 = Object.defineProperty;
|
|
142924
142926
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -142956,9 +142958,9 @@ var require_reference_format = __commonJS({
|
|
|
142956
142958
|
}
|
|
142957
142959
|
});
|
|
142958
142960
|
|
|
142959
|
-
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
142961
|
+
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-output-reference.cjs
|
|
142960
142962
|
var require_action_output_reference = __commonJS({
|
|
142961
|
-
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
142963
|
+
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-output-reference.cjs"(exports2, module2) {
|
|
142962
142964
|
"use strict";
|
|
142963
142965
|
var __defProp3 = Object.defineProperty;
|
|
142964
142966
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -149815,9 +149817,9 @@ var require_cjs = __commonJS({
|
|
|
149815
149817
|
}
|
|
149816
149818
|
});
|
|
149817
149819
|
|
|
149818
|
-
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
149820
|
+
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-schemas.cjs
|
|
149819
149821
|
var require_action_schemas = __commonJS({
|
|
149820
|
-
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
149822
|
+
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/action-schemas.cjs"(exports2, module2) {
|
|
149821
149823
|
"use strict";
|
|
149822
149824
|
var __defProp3 = Object.defineProperty;
|
|
149823
149825
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -149854,6 +149856,8 @@ var require_action_schemas = __commonJS({
|
|
|
149854
149856
|
documentSplitterInput: () => documentSplitterInput,
|
|
149855
149857
|
documentSplitterMode: () => documentSplitterMode,
|
|
149856
149858
|
documentTemplaterInput: () => documentTemplaterInput,
|
|
149859
|
+
jevEvaluatorInput: () => jevEvaluatorInput,
|
|
149860
|
+
jevQuestionSchema: () => jevQuestionSchema,
|
|
149857
149861
|
llmCompletionInput: () => llmCompletionInput,
|
|
149858
149862
|
mapActionInput: () => mapActionInput,
|
|
149859
149863
|
templateActionInput: () => templateActionInput
|
|
@@ -149887,7 +149891,8 @@ async function execute(input: TelaInput) {
|
|
|
149887
149891
|
condition: import_typebox.Type.String(),
|
|
149888
149892
|
steps: import_typebox.Type.Array(import_typebox.Type.Any()),
|
|
149889
149893
|
type: import_typebox.Type.Optional(conditionCaseTypeSchema),
|
|
149890
|
-
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" }))
|
|
149891
149896
|
});
|
|
149892
149897
|
var defaultCaseSchema = import_typebox.Type.Object({
|
|
149893
149898
|
name: import_typebox.Type.Literal("Default"),
|
|
@@ -150007,6 +150012,7 @@ async function execute(input: TelaInput) {
|
|
|
150007
150012
|
default: DEFAULT_LLM_MODEL
|
|
150008
150013
|
})),
|
|
150009
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 })),
|
|
150010
150016
|
schema: import_typebox.Type.Union([
|
|
150011
150017
|
import_typebox.Type.Null(),
|
|
150012
150018
|
import_typebox.Type.Record(import_typebox.Type.String(), import_typebox.Type.Any())
|
|
@@ -150014,6 +150020,43 @@ async function execute(input: TelaInput) {
|
|
|
150014
150020
|
citations: import_typebox.Type.Optional(import_typebox.Type.Boolean()),
|
|
150015
150021
|
citationsRationale: import_typebox.Type.Optional(import_typebox.Type.Boolean())
|
|
150016
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
|
+
});
|
|
150017
150060
|
var mapActionInput = import_typebox.Type.Object({
|
|
150018
150061
|
over: import_typebox.Type.Any({ default: "" }),
|
|
150019
150062
|
mapVariable: import_typebox.Type.String(),
|
|
@@ -150086,14 +150129,18 @@ async function execute(input: TelaInput) {
|
|
|
150086
150129
|
var templateActionInput = import_typebox.Type.Object({
|
|
150087
150130
|
templateId: import_typebox.Type.String(),
|
|
150088
150131
|
variables: import_typebox.Type.Record(import_typebox.Type.String(), import_typebox.Type.Union([import_typebox.Type.String(), import_typebox.Type.Any()])),
|
|
150089
|
-
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
|
+
))
|
|
150090
150137
|
});
|
|
150091
150138
|
}
|
|
150092
150139
|
});
|
|
150093
150140
|
|
|
150094
|
-
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
150141
|
+
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/graph.cjs
|
|
150095
150142
|
var require_graph = __commonJS({
|
|
150096
|
-
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
150143
|
+
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/graph.cjs"(exports2, module2) {
|
|
150097
150144
|
"use strict";
|
|
150098
150145
|
var __defProp3 = Object.defineProperty;
|
|
150099
150146
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -150113,9 +150160,9 @@ var require_graph = __commonJS({
|
|
|
150113
150160
|
}
|
|
150114
150161
|
});
|
|
150115
150162
|
|
|
150116
|
-
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
150163
|
+
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/input-reference.cjs
|
|
150117
150164
|
var require_input_reference = __commonJS({
|
|
150118
|
-
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
150165
|
+
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/input-reference.cjs"(exports2, module2) {
|
|
150119
150166
|
"use strict";
|
|
150120
150167
|
var __defProp3 = Object.defineProperty;
|
|
150121
150168
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -150340,9 +150387,9 @@ var require_input_reference = __commonJS({
|
|
|
150340
150387
|
}
|
|
150341
150388
|
});
|
|
150342
150389
|
|
|
150343
|
-
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
150390
|
+
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/lifecycle.cjs
|
|
150344
150391
|
var require_lifecycle = __commonJS({
|
|
150345
|
-
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
150392
|
+
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/lifecycle.cjs"(exports2, module2) {
|
|
150346
150393
|
"use strict";
|
|
150347
150394
|
var __defProp3 = Object.defineProperty;
|
|
150348
150395
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -150362,9 +150409,9 @@ var require_lifecycle = __commonJS({
|
|
|
150362
150409
|
}
|
|
150363
150410
|
});
|
|
150364
150411
|
|
|
150365
|
-
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
150412
|
+
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/workflow-reference.cjs
|
|
150366
150413
|
var require_workflow_reference = __commonJS({
|
|
150367
|
-
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
150414
|
+
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/workflow-reference.cjs"(exports2, module2) {
|
|
150368
150415
|
"use strict";
|
|
150369
150416
|
var __defProp3 = Object.defineProperty;
|
|
150370
150417
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -150457,9 +150504,9 @@ var require_workflow_reference = __commonJS({
|
|
|
150457
150504
|
}
|
|
150458
150505
|
});
|
|
150459
150506
|
|
|
150460
|
-
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
150507
|
+
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/workflow-update-spec.cjs
|
|
150461
150508
|
var require_workflow_update_spec = __commonJS({
|
|
150462
|
-
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
150509
|
+
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/workflow-update-spec.cjs"(exports2, module2) {
|
|
150463
150510
|
"use strict";
|
|
150464
150511
|
var __defProp3 = Object.defineProperty;
|
|
150465
150512
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -150479,9 +150526,9 @@ var require_workflow_update_spec = __commonJS({
|
|
|
150479
150526
|
}
|
|
150480
150527
|
});
|
|
150481
150528
|
|
|
150482
|
-
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
150529
|
+
// ../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/index.cjs
|
|
150483
150530
|
var require_cjs2 = __commonJS({
|
|
150484
|
-
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.
|
|
150531
|
+
"../../node_modules/.pnpm/@meistrari+workflow-shared@1.7.0/node_modules/@meistrari/workflow-shared/dist/cjs/index.cjs"(exports2, module2) {
|
|
150485
150532
|
"use strict";
|
|
150486
150533
|
var __defProp3 = Object.defineProperty;
|
|
150487
150534
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -150552,6 +150599,410 @@ var require_ids = __commonJS({
|
|
|
150552
150599
|
}
|
|
150553
150600
|
});
|
|
150554
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
|
+
|
|
150555
151006
|
// ../../packages/workflow-code/dist/authoring/remote.js
|
|
150556
151007
|
var require_remote = __commonJS({
|
|
150557
151008
|
"../../packages/workflow-code/dist/authoring/remote.js"(exports2) {
|
|
@@ -364664,148 +365115,6 @@ var require_imports = __commonJS({
|
|
|
364664
365115
|
}
|
|
364665
365116
|
});
|
|
364666
365117
|
|
|
364667
|
-
// ../../packages/workflow-code/dist/compiler/output-schema.js
|
|
364668
|
-
var require_output_schema = __commonJS({
|
|
364669
|
-
"../../packages/workflow-code/dist/compiler/output-schema.js"(exports2) {
|
|
364670
|
-
"use strict";
|
|
364671
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
364672
|
-
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;
|
|
364673
|
-
exports2.createPromptOutputJsonSchema = createPromptOutputJsonSchema;
|
|
364674
|
-
exports2.selectOutputJsonSchema = selectOutputJsonSchema;
|
|
364675
|
-
exports2.isFileCompatibleOutputJsonSchema = isFileCompatibleOutputJsonSchema;
|
|
364676
|
-
exports2.isStringCompatibleOutputJsonSchema = isStringCompatibleOutputJsonSchema;
|
|
364677
|
-
exports2.FILE_OUTPUT_JSON_SCHEMA = Object.freeze({
|
|
364678
|
-
type: "object",
|
|
364679
|
-
properties: Object.freeze({
|
|
364680
|
-
name: Object.freeze({ type: "string" }),
|
|
364681
|
-
fileUrl: Object.freeze({ type: "string" }),
|
|
364682
|
-
mimeType: Object.freeze({ type: "string" }),
|
|
364683
|
-
base64: Object.freeze({ type: "string" }),
|
|
364684
|
-
vaultReference: Object.freeze({ type: "string" })
|
|
364685
|
-
})
|
|
364686
|
-
});
|
|
364687
|
-
exports2.FILE_INPUT_JSON_SCHEMA = Object.freeze({
|
|
364688
|
-
anyOf: Object.freeze([
|
|
364689
|
-
exports2.FILE_OUTPUT_JSON_SCHEMA,
|
|
364690
|
-
Object.freeze({ type: "array", items: exports2.FILE_OUTPUT_JSON_SCHEMA })
|
|
364691
|
-
])
|
|
364692
|
-
});
|
|
364693
|
-
exports2.SPLITTER_OUTPUT_JSON_SCHEMA = Object.freeze({
|
|
364694
|
-
type: "array",
|
|
364695
|
-
items: Object.freeze({
|
|
364696
|
-
type: "object",
|
|
364697
|
-
properties: Object.freeze({
|
|
364698
|
-
startPage: Object.freeze({ type: "number" }),
|
|
364699
|
-
endPage: Object.freeze({ type: "number" }),
|
|
364700
|
-
pages: Object.freeze({ type: "string" }),
|
|
364701
|
-
originalFile: exports2.FILE_OUTPUT_JSON_SCHEMA,
|
|
364702
|
-
file: exports2.FILE_OUTPUT_JSON_SCHEMA,
|
|
364703
|
-
description: Object.freeze({ anyOf: Object.freeze([{ type: "string" }, { type: "null" }]) }),
|
|
364704
|
-
fileType: Object.freeze({ anyOf: Object.freeze([{ type: "string" }, { type: "null" }]) })
|
|
364705
|
-
}),
|
|
364706
|
-
required: Object.freeze(["startPage", "endPage", "pages", "originalFile", "file", "description", "fileType"])
|
|
364707
|
-
})
|
|
364708
|
-
});
|
|
364709
|
-
exports2.CROP_OUTPUT_JSON_SCHEMA = Object.freeze({
|
|
364710
|
-
type: "array",
|
|
364711
|
-
items: Object.freeze({
|
|
364712
|
-
type: "object",
|
|
364713
|
-
properties: Object.freeze({
|
|
364714
|
-
indexes: Object.freeze({
|
|
364715
|
-
type: "array",
|
|
364716
|
-
items: Object.freeze({ anyOf: Object.freeze([{ type: "integer" }, { type: "string" }]) })
|
|
364717
|
-
}),
|
|
364718
|
-
originalFile: exports2.FILE_OUTPUT_JSON_SCHEMA,
|
|
364719
|
-
file: exports2.FILE_OUTPUT_JSON_SCHEMA
|
|
364720
|
-
}),
|
|
364721
|
-
required: Object.freeze(["indexes", "originalFile", "file"])
|
|
364722
|
-
})
|
|
364723
|
-
});
|
|
364724
|
-
exports2.DOC_TEMPLATE_OUTPUT_JSON_SCHEMA = Object.freeze({
|
|
364725
|
-
type: "object",
|
|
364726
|
-
properties: Object.freeze({
|
|
364727
|
-
generatedDocument: exports2.FILE_OUTPUT_JSON_SCHEMA,
|
|
364728
|
-
generatedAt: Object.freeze({ type: "string" }),
|
|
364729
|
-
permalinkUrl: Object.freeze({ type: "string" }),
|
|
364730
|
-
permalinkId: Object.freeze({ type: "string" }),
|
|
364731
|
-
permalinkExpiresAt: Object.freeze({ anyOf: Object.freeze([{ type: "string" }, { type: "null" }]) })
|
|
364732
|
-
}),
|
|
364733
|
-
required: Object.freeze(["generatedDocument", "generatedAt"])
|
|
364734
|
-
});
|
|
364735
|
-
function createPromptOutputJsonSchema(schema) {
|
|
364736
|
-
return schema === void 0 || schema === null ? void 0 : { type: "object", properties: schema };
|
|
364737
|
-
}
|
|
364738
|
-
function selectOutputJsonSchema(schema, path2) {
|
|
364739
|
-
let selected = schema;
|
|
364740
|
-
for (const segment of path2) {
|
|
364741
|
-
if (!selected)
|
|
364742
|
-
return void 0;
|
|
364743
|
-
selected = selectOutputJsonSchemaSegment(selected, segment);
|
|
364744
|
-
}
|
|
364745
|
-
return selected;
|
|
364746
|
-
}
|
|
364747
|
-
function isFileCompatibleOutputJsonSchema(schema) {
|
|
364748
|
-
const variants = jsonSchemaVariants(schema);
|
|
364749
|
-
if (variants)
|
|
364750
|
-
return variants.every(isFileCompatibleOutputJsonSchema);
|
|
364751
|
-
return isFileJsonSchema(schema) || isFileArrayJsonSchema(schema);
|
|
364752
|
-
}
|
|
364753
|
-
function selectOutputJsonSchemaSegment(schema, segment) {
|
|
364754
|
-
const variants = jsonSchemaVariants(schema);
|
|
364755
|
-
if (variants) {
|
|
364756
|
-
const selected = variants.map((variant) => selectOutputJsonSchemaSegment(variant, segment));
|
|
364757
|
-
return selected.every((variant) => variant !== void 0) ? { anyOf: selected } : void 0;
|
|
364758
|
-
}
|
|
364759
|
-
if (schema.type === "array")
|
|
364760
|
-
return /^\d+$/.test(segment) ? schema.items : void 0;
|
|
364761
|
-
return isRecord3(schema.properties) ? schema.properties[segment] : void 0;
|
|
364762
|
-
}
|
|
364763
|
-
function isFileJsonSchema(schema) {
|
|
364764
|
-
const variants = jsonSchemaVariants(schema);
|
|
364765
|
-
if (variants)
|
|
364766
|
-
return variants.every(isFileJsonSchema);
|
|
364767
|
-
if (!isRecord3(schema))
|
|
364768
|
-
return false;
|
|
364769
|
-
const properties = schema.properties;
|
|
364770
|
-
if (schema.type !== "object" || !isRecord3(properties))
|
|
364771
|
-
return false;
|
|
364772
|
-
const stringFields = ["name", "fileUrl", "mimeType", "base64", "vaultReference"];
|
|
364773
|
-
if (!stringFields.every((key) => !(key in properties) || isStringCompatibleOutputJsonSchema(properties[key])))
|
|
364774
|
-
return false;
|
|
364775
|
-
return isStringCompatibleOutputJsonSchema(properties.name) && ["fileUrl", "vaultReference", "base64"].some((key) => isStringCompatibleOutputJsonSchema(properties[key]));
|
|
364776
|
-
}
|
|
364777
|
-
function isFileArrayJsonSchema(schema) {
|
|
364778
|
-
return isRecord3(schema) && schema.type === "array" && isFileJsonSchema(schema.items);
|
|
364779
|
-
}
|
|
364780
|
-
function isStringCompatibleOutputJsonSchema(schema) {
|
|
364781
|
-
const variants = jsonSchemaVariants(schema);
|
|
364782
|
-
if (variants)
|
|
364783
|
-
return variants.every(isStringCompatibleOutputJsonSchema);
|
|
364784
|
-
if (!isRecord3(schema))
|
|
364785
|
-
return false;
|
|
364786
|
-
if (schema.type !== void 0 && schema.type !== "string")
|
|
364787
|
-
return false;
|
|
364788
|
-
const hasStringConst = typeof schema.const === "string";
|
|
364789
|
-
if ("const" in schema && !hasStringConst)
|
|
364790
|
-
return false;
|
|
364791
|
-
const enumValues = schema.enum;
|
|
364792
|
-
const hasStringEnum = Array.isArray(enumValues) && enumValues.length > 0 && enumValues.every((value) => typeof value === "string");
|
|
364793
|
-
if ("enum" in schema && !hasStringEnum)
|
|
364794
|
-
return false;
|
|
364795
|
-
return schema.type === "string" || hasStringConst || hasStringEnum;
|
|
364796
|
-
}
|
|
364797
|
-
function jsonSchemaVariants(schema) {
|
|
364798
|
-
if (!isRecord3(schema))
|
|
364799
|
-
return void 0;
|
|
364800
|
-
const variants = Array.isArray(schema.anyOf) ? schema.anyOf : Array.isArray(schema.oneOf) ? schema.oneOf : void 0;
|
|
364801
|
-
return variants !== void 0 && variants.length > 0 && variants.every(isRecord3) ? variants : void 0;
|
|
364802
|
-
}
|
|
364803
|
-
function isRecord3(value) {
|
|
364804
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
364805
|
-
}
|
|
364806
|
-
}
|
|
364807
|
-
});
|
|
364808
|
-
|
|
364809
365118
|
// ../../packages/workflow-code/dist/compiler/code-extraction/output-schema.js
|
|
364810
365119
|
var require_output_schema2 = __commonJS({
|
|
364811
365120
|
"../../packages/workflow-code/dist/compiler/code-extraction/output-schema.js"(exports2) {
|
|
@@ -365186,149 +365495,6 @@ var require_rewrite_refs = __commonJS({
|
|
|
365186
365495
|
}
|
|
365187
365496
|
});
|
|
365188
365497
|
|
|
365189
|
-
// ../../packages/workflow-code/dist/compiler/refs.js
|
|
365190
|
-
var require_refs = __commonJS({
|
|
365191
|
-
"../../packages/workflow-code/dist/compiler/refs.js"(exports2) {
|
|
365192
|
-
"use strict";
|
|
365193
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
365194
|
-
exports2.resolvePromptRefs = resolvePromptRefs;
|
|
365195
|
-
exports2.resolveReferenceRecordRefs = resolveReferenceRecordRefs;
|
|
365196
|
-
exports2.resolveWorkflowRef = resolveWorkflowRef;
|
|
365197
|
-
exports2.resolveExclusiveRef = resolveExclusiveRef;
|
|
365198
|
-
exports2.resolveVisibleNodeIdentity = resolveVisibleNodeIdentity;
|
|
365199
|
-
var workflow_shared_1 = require_cjs2();
|
|
365200
|
-
function resolvePromptRefs(context) {
|
|
365201
|
-
const diagnostics = [];
|
|
365202
|
-
let prompt = context.prompt;
|
|
365203
|
-
for (const ref of context.refs) {
|
|
365204
|
-
const resolved = resolveWorkflowRef(ref, context);
|
|
365205
|
-
diagnostics.push(...resolved.diagnostics);
|
|
365206
|
-
if (!resolved.reference)
|
|
365207
|
-
continue;
|
|
365208
|
-
prompt = prompt.split(ref.token).join(resolved.reference);
|
|
365209
|
-
}
|
|
365210
|
-
return { prompt, diagnostics };
|
|
365211
|
-
}
|
|
365212
|
-
function resolveReferenceRecordRefs(context) {
|
|
365213
|
-
const diagnostics = [];
|
|
365214
|
-
const values = { ...context.values };
|
|
365215
|
-
for (const ref of context.refs) {
|
|
365216
|
-
const resolved = resolveWorkflowRef(ref, context);
|
|
365217
|
-
if (resolved.reference) {
|
|
365218
|
-
values[ref.key] = resolved.reference;
|
|
365219
|
-
continue;
|
|
365220
|
-
}
|
|
365221
|
-
diagnostics.push(...resolved.diagnostics.map((diagnostic) => ({
|
|
365222
|
-
...diagnostic,
|
|
365223
|
-
message: diagnostic.message.replace("Prompt reference", `Reference record ${ref.key} reference`)
|
|
365224
|
-
})));
|
|
365225
|
-
}
|
|
365226
|
-
return { values: Object.freeze(values), diagnostics };
|
|
365227
|
-
}
|
|
365228
|
-
function resolveWorkflowRef(ref, context) {
|
|
365229
|
-
const resolved = ref.targetKind === "input" ? resolveInputRef(ref, context) : resolveNodeRef(ref, context);
|
|
365230
|
-
if (!resolved) {
|
|
365231
|
-
return {
|
|
365232
|
-
diagnostics: [{
|
|
365233
|
-
code: "compiler.ref.dangling",
|
|
365234
|
-
severity: "error",
|
|
365235
|
-
message: `Prompt reference ${ref.targetKey} does not match a workflow input or previous node`
|
|
365236
|
-
}]
|
|
365237
|
-
};
|
|
365238
|
-
}
|
|
365239
|
-
if (resolved === "forward") {
|
|
365240
|
-
return {
|
|
365241
|
-
diagnostics: [{
|
|
365242
|
-
code: "compiler.ref.forward",
|
|
365243
|
-
severity: "error",
|
|
365244
|
-
message: `Prompt reference ${ref.targetKey} points to a future workflow node`
|
|
365245
|
-
}]
|
|
365246
|
-
};
|
|
365247
|
-
}
|
|
365248
|
-
if (resolved === "scope") {
|
|
365249
|
-
return {
|
|
365250
|
-
diagnostics: [{
|
|
365251
|
-
code: "compiler.ref.scope",
|
|
365252
|
-
severity: "error",
|
|
365253
|
-
message: `Prompt reference ${ref.targetKey} points to a workflow node outside the visible scope`
|
|
365254
|
-
}]
|
|
365255
|
-
};
|
|
365256
|
-
}
|
|
365257
|
-
return {
|
|
365258
|
-
reference: resolved.reference,
|
|
365259
|
-
inputType: "inputType" in resolved ? resolved.inputType : void 0,
|
|
365260
|
-
nodeId: "nodeId" in resolved ? resolved.nodeId : void 0,
|
|
365261
|
-
diagnostics: []
|
|
365262
|
-
};
|
|
365263
|
-
}
|
|
365264
|
-
function resolveExclusiveRef(ref, context) {
|
|
365265
|
-
const resolved = resolveWorkflowRef(ref, context);
|
|
365266
|
-
if (resolved.reference)
|
|
365267
|
-
return resolved;
|
|
365268
|
-
return {
|
|
365269
|
-
diagnostics: resolved.diagnostics.map((diagnostic) => ({
|
|
365270
|
-
...diagnostic,
|
|
365271
|
-
message: diagnostic.message.replace("Prompt reference", "Exclusive reference")
|
|
365272
|
-
}))
|
|
365273
|
-
};
|
|
365274
|
-
}
|
|
365275
|
-
function resolveInputRef(ref, context) {
|
|
365276
|
-
const id = context.inputIdsByKey.get(ref.targetKey);
|
|
365277
|
-
if (!id)
|
|
365278
|
-
return void 0;
|
|
365279
|
-
const reference = workflow_shared_1.InputReferenceURI.fromVariable({ name: id });
|
|
365280
|
-
return {
|
|
365281
|
-
reference: formatPromptReference(reference, ref),
|
|
365282
|
-
inputType: context.inputTypesByKey?.get(ref.targetKey)
|
|
365283
|
-
};
|
|
365284
|
-
}
|
|
365285
|
-
function resolveNodeRef(ref, context) {
|
|
365286
|
-
const candidates = context.nodeIdentitiesByKey.get(ref.targetKey) ?? [];
|
|
365287
|
-
if (candidates.length === 0)
|
|
365288
|
-
return void 0;
|
|
365289
|
-
const visible = resolveVisibleNodeIdentity(ref.targetKey, context);
|
|
365290
|
-
if (visible) {
|
|
365291
|
-
const reference = workflow_shared_1.ActionOutputReferenceURI.fromStepId(visible.id);
|
|
365292
|
-
return { reference: formatPromptReference(reference, ref), nodeId: visible.id };
|
|
365293
|
-
}
|
|
365294
|
-
if (candidates.some((candidate) => samePath(candidate.scopePath, context.currentNode.scopePath) && candidate.sequenceIndex >= context.currentNode.sequenceIndex)) {
|
|
365295
|
-
return "forward";
|
|
365296
|
-
}
|
|
365297
|
-
return "scope";
|
|
365298
|
-
}
|
|
365299
|
-
function resolveVisibleNodeIdentity(key, context) {
|
|
365300
|
-
const currentScopeCandidate = resolvePriorCandidateInScope(key, context.currentNode.scopePath, context.currentNode.sequenceIndex, context);
|
|
365301
|
-
if (currentScopeCandidate)
|
|
365302
|
-
return currentScopeCandidate;
|
|
365303
|
-
for (const boundary of [...context.currentNode.ancestorScopes].reverse()) {
|
|
365304
|
-
const candidate = resolvePriorCandidateInScope(key, boundary.scopePath, boundary.sequenceIndex, context);
|
|
365305
|
-
if (candidate)
|
|
365306
|
-
return candidate;
|
|
365307
|
-
}
|
|
365308
|
-
return void 0;
|
|
365309
|
-
}
|
|
365310
|
-
function resolvePriorCandidateInScope(key, scopePath, beforeSequenceIndex, context) {
|
|
365311
|
-
const candidates = (context.nodeIdentitiesByKey.get(key) ?? []).filter((candidate) => samePath(candidate.scopePath, scopePath) && candidate.sequenceIndex < beforeSequenceIndex).sort((left, right) => right.sequenceIndex - left.sequenceIndex);
|
|
365312
|
-
const nearest = candidates[0];
|
|
365313
|
-
if (!nearest)
|
|
365314
|
-
return void 0;
|
|
365315
|
-
if (candidates.filter((candidate) => candidate.sequenceIndex === nearest.sequenceIndex).length > 1)
|
|
365316
|
-
return void 0;
|
|
365317
|
-
return nearest;
|
|
365318
|
-
}
|
|
365319
|
-
function samePath(left, right) {
|
|
365320
|
-
return left.length === right.length && left.every((segment, index) => segment === right[index]);
|
|
365321
|
-
}
|
|
365322
|
-
function formatPromptReference(reference, ref) {
|
|
365323
|
-
if (ref.path && ref.path.length > 0)
|
|
365324
|
-
reference.appendPath([...ref.path]);
|
|
365325
|
-
if ("format" in ref && ref.format)
|
|
365326
|
-
reference.setFormat(ref.format);
|
|
365327
|
-
return reference.toReference();
|
|
365328
|
-
}
|
|
365329
|
-
}
|
|
365330
|
-
});
|
|
365331
|
-
|
|
365332
365498
|
// ../../packages/workflow-code/dist/compiler/code-extraction/extract.js
|
|
365333
365499
|
var require_extract3 = __commonJS({
|
|
365334
365500
|
"../../packages/workflow-code/dist/compiler/code-extraction/extract.js"(exports2) {
|
|
@@ -367387,6 +367553,7 @@ var require_modules = __commonJS({
|
|
|
367387
367553
|
"use strict";
|
|
367388
367554
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
367389
367555
|
exports2.nodeModuleRegistry = void 0;
|
|
367556
|
+
var classifier_1 = require_classifier();
|
|
367390
367557
|
var contracts_1 = require_contracts();
|
|
367391
367558
|
var workflow_shared_1 = require_cjs2();
|
|
367392
367559
|
var remote_1 = require_remote();
|
|
@@ -368625,6 +368792,7 @@ var require_modules = __commonJS({
|
|
|
368625
368792
|
};
|
|
368626
368793
|
}
|
|
368627
368794
|
exports2.nodeModuleRegistry = /* @__PURE__ */ new Map([
|
|
368795
|
+
[classifier_1.classifierModule.kind, classifier_1.classifierModule],
|
|
368628
368796
|
[llmModule.kind, llmModule],
|
|
368629
368797
|
[remoteExecutableModule.kind, remoteExecutableModule],
|
|
368630
368798
|
[remoteAgentModule.kind, remoteAgentModule],
|
|
@@ -368942,12 +369110,33 @@ var require_transpile = __commonJS({
|
|
|
368942
369110
|
return createFailedSplitterNode(workflowKey, declaration);
|
|
368943
369111
|
if (declaration.node.nodeKind === "crop")
|
|
368944
369112
|
return createFailedCropNode(workflowKey, declaration);
|
|
369113
|
+
if (declaration.node.nodeKind === "classifier")
|
|
369114
|
+
return createFailedClassifierNode(workflowKey, declaration);
|
|
368945
369115
|
if (declaration.node.nodeKind === "doc-template")
|
|
368946
369116
|
return createFailedDocTemplateNode(workflowKey, declaration);
|
|
368947
369117
|
if (declaration.node.nodeKind === "remote-executable" || declaration.node.nodeKind === "remote-agent" || declaration.node.nodeKind === "remote-template")
|
|
368948
369118
|
return createFailedRemoteNode(workflowKey, declaration);
|
|
368949
369119
|
return createFailedPromptNode(workflowKey, declaration);
|
|
368950
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
|
+
}
|
|
368951
369140
|
function createFailedDocTemplateNode(workflowKey, declaration) {
|
|
368952
369141
|
const nodeId = (0, ids_1.stableNodeId)(workflowKey, declaration.node, declaration.path);
|
|
368953
369142
|
const linearPorts = failedNodePorts(nodeId);
|
|
@@ -370248,6 +370437,7 @@ var require_evaluate_source = __commonJS({
|
|
|
370248
370437
|
collectWorkflowCodeAliasBindings(node, node.statements, "build", scopedBindings.buildBindings, scopedBindings.buildNamespaceBindings, scopedBindings.buildNamespaceMemberBindings);
|
|
370249
370438
|
collectWorkflowCodeAliasBindings(node, node.statements, "code", scopedBindings.codeBindings, scopedBindings.codeNamespaceBindings, scopedBindings.codeNamespaceMemberBindings);
|
|
370250
370439
|
collectWorkflowCodeAliasBindings(node, node.statements, "agent", scopedBindings.promptNodeBindings, scopedBindings.promptNodeNamespaceBindings, scopedBindings.promptNodeNamespaceMemberBindings);
|
|
370440
|
+
collectWorkflowCodeAliasBindings(node, node.statements, "classifier", scopedBindings.promptNodeBindings, scopedBindings.promptNodeNamespaceBindings, scopedBindings.promptNodeNamespaceMemberBindings);
|
|
370251
370441
|
collectWorkflowCodeAliasBindings(node, node.statements, "llm", scopedBindings.promptNodeBindings, scopedBindings.promptNodeNamespaceBindings, scopedBindings.promptNodeNamespaceMemberBindings);
|
|
370252
370442
|
collectWorkflowCodeAliasBindings(node, node.statements, "map", scopedBindings.promptNodeBindings, scopedBindings.promptNodeNamespaceBindings, scopedBindings.promptNodeNamespaceMemberBindings);
|
|
370253
370443
|
collectWorkflowCodeAliasBindings(node, node.statements, "docTemplate", scopedBindings.promptNodeBindings, scopedBindings.promptNodeNamespaceBindings, scopedBindings.promptNodeNamespaceMemberBindings);
|
|
@@ -370431,7 +370621,7 @@ var require_evaluate_source = __commonJS({
|
|
|
370431
370621
|
return Boolean(namespaceMemberBindings.get(root)?.has(members.join(".")));
|
|
370432
370622
|
}
|
|
370433
370623
|
function isPromptNodeMemberName(name) {
|
|
370434
|
-
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";
|
|
370435
370625
|
}
|
|
370436
370626
|
function isWorkflowCodeMemberExpression(expression, memberName, memberBindings, namespaceBindings, namespaceMemberBindings) {
|
|
370437
370627
|
const unwrapped = unwrapExpression(expression);
|
|
@@ -370951,7 +371141,7 @@ var require_evaluate_source = __commonJS({
|
|
|
370951
371141
|
}
|
|
370952
371142
|
}
|
|
370953
371143
|
function addWorkflowCodePromptNodeMembersToExport(prefix, exportedNamespaces) {
|
|
370954
|
-
for (const memberName of ["agent", "condition", "llm", "map"])
|
|
371144
|
+
for (const memberName of ["agent", "classifier", "condition", "llm", "map"])
|
|
370955
371145
|
exportedNamespaces.add(`${prefix}.${memberName}`);
|
|
370956
371146
|
}
|
|
370957
371147
|
function addWorkflowCodeNamespaceMembersToExport(members, prefix, exportedNamespaces) {
|
|
@@ -371037,7 +371227,7 @@ var require_evaluate_source = __commonJS({
|
|
|
371037
371227
|
exportedNames.codeNamespaces.add(statement.exportClause.name.text);
|
|
371038
371228
|
for (const exportedName of targetExports.codeNamespaces)
|
|
371039
371229
|
exportedNames.codeNamespaces.add(`${statement.exportClause.name.text}.${exportedName}`);
|
|
371040
|
-
for (const memberName of ["agent", "condition", "llm", "map"]) {
|
|
371230
|
+
for (const memberName of ["agent", "classifier", "condition", "llm", "map"]) {
|
|
371041
371231
|
if (targetExports.promptNodes.has(memberName))
|
|
371042
371232
|
exportedNames.promptNodeNamespaces.add(`${statement.exportClause.name.text}.${memberName}`);
|
|
371043
371233
|
}
|
|
@@ -371069,6 +371259,7 @@ var require_evaluate_source = __commonJS({
|
|
|
371069
371259
|
exportedNames.promptNodes.add("agent");
|
|
371070
371260
|
exportedNames.promptNodes.add("docTemplate");
|
|
371071
371261
|
exportedNames.promptNodes.add("condition");
|
|
371262
|
+
exportedNames.promptNodes.add("classifier");
|
|
371072
371263
|
exportedNames.promptNodes.add("llm");
|
|
371073
371264
|
exportedNames.promptNodes.add("map");
|
|
371074
371265
|
return;
|
|
@@ -371172,6 +371363,14 @@ const __workflowCodeApi = (() => {
|
|
|
371172
371363
|
const freeze = Object.freeze
|
|
371173
371364
|
const pathKey = '__workflowCodePath'
|
|
371174
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
|
+
}
|
|
371175
371374
|
const remoteRefBindingKey = Symbol.for('@meistrari/workflow-code/remote-ref-binding')
|
|
371176
371375
|
const sourceDiagnostic = (hint, source) => Object.freeze(Object.assign(Object.create(null), {
|
|
371177
371376
|
__workflowCodeSourceDiagnostic: true,
|
|
@@ -371669,6 +371868,10 @@ const __workflowCodeApi = (() => {
|
|
|
371669
371868
|
docTemplate: docTemplateNode,
|
|
371670
371869
|
condition: conditionNode,
|
|
371671
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
|
+
})),
|
|
371672
371875
|
llm: (options) => promptNode('llm', options, llmInput),
|
|
371673
371876
|
map: mapNode,
|
|
371674
371877
|
splitter: splitterNode,
|
|
@@ -388063,6 +388266,7 @@ function terminalWidth(target) {
|
|
|
388063
388266
|
// src/session.ts
|
|
388064
388267
|
var import_tela_local_config6 = __toESM(require_dist());
|
|
388065
388268
|
var import_tela_pantry = __toESM(require_dist2());
|
|
388269
|
+
var PANTRY_ENVIRONMENT_ID = "production";
|
|
388066
388270
|
var ENV_ACCESS_TOKEN_REF = {
|
|
388067
388271
|
provider: "env",
|
|
388068
388272
|
service: "env",
|
|
@@ -388079,7 +388283,7 @@ async function loadPantry(flags) {
|
|
|
388079
388283
|
}
|
|
388080
388284
|
async function loadPantryForContext(resolved, config2) {
|
|
388081
388285
|
const loadedConfig = config2 ?? await (0, import_tela_local_config6.loadConfig)();
|
|
388082
|
-
const baseUrl = resolvePantryBaseUrl(
|
|
388286
|
+
const baseUrl = resolvePantryBaseUrl(loadedConfig);
|
|
388083
388287
|
const credential = await loadPantryCredential(loadedConfig, resolved);
|
|
388084
388288
|
return { client: (0, import_tela_pantry.createPantryClient)(baseUrl, credential), baseUrl };
|
|
388085
388289
|
}
|
|
@@ -388096,7 +388300,7 @@ async function loadPantryCredential(config2, selected) {
|
|
|
388096
388300
|
return credential;
|
|
388097
388301
|
}
|
|
388098
388302
|
throw new Error(
|
|
388099
|
-
`Pantry discovery requires a user-session access token for Tela environment '${
|
|
388303
|
+
`Pantry discovery requires a user-session access token for Tela environment '${PANTRY_ENVIRONMENT_ID}'. Run \`tela auth login --environment ${PANTRY_ENVIRONMENT_ID}\` or set TELA_ACCESS_TOKEN.`
|
|
388100
388304
|
);
|
|
388101
388305
|
}
|
|
388102
388306
|
function pantryCredentialCandidates(config2, selected) {
|
|
@@ -388106,19 +388310,19 @@ function pantryCredentialCandidates(config2, selected) {
|
|
|
388106
388310
|
if (!contextId || seen.has(contextId))
|
|
388107
388311
|
return;
|
|
388108
388312
|
const context = config2.contexts[contextId];
|
|
388109
|
-
if (!context || context.environmentId !==
|
|
388313
|
+
if (!context || context.environmentId !== PANTRY_ENVIRONMENT_ID)
|
|
388110
388314
|
return;
|
|
388111
388315
|
if (context.credentialRef.kind !== "user-session")
|
|
388112
388316
|
return;
|
|
388113
|
-
const
|
|
388114
|
-
if (!
|
|
388317
|
+
const environment2 = config2.environments[context.environmentId];
|
|
388318
|
+
if (!environment2)
|
|
388115
388319
|
return;
|
|
388116
388320
|
seen.add(contextId);
|
|
388117
388321
|
candidates.push({
|
|
388118
388322
|
resolved: {
|
|
388119
388323
|
id: contextId,
|
|
388120
388324
|
context,
|
|
388121
|
-
environment
|
|
388325
|
+
environment: environment2
|
|
388122
388326
|
},
|
|
388123
388327
|
credentialRef: context.credentialRef
|
|
388124
388328
|
});
|
|
@@ -388128,7 +388332,17 @@ function pantryCredentialCandidates(config2, selected) {
|
|
|
388128
388332
|
addContext(config2.activeContextId);
|
|
388129
388333
|
for (const contextId of Object.keys(config2.contexts))
|
|
388130
388334
|
addContext(contextId);
|
|
388131
|
-
|
|
388335
|
+
const environment = config2.environments[PANTRY_ENVIRONMENT_ID];
|
|
388336
|
+
if (environment) {
|
|
388337
|
+
candidates.push({
|
|
388338
|
+
resolved: {
|
|
388339
|
+
...selected,
|
|
388340
|
+
context: { ...selected.context, environmentId: PANTRY_ENVIRONMENT_ID },
|
|
388341
|
+
environment
|
|
388342
|
+
},
|
|
388343
|
+
credentialRef: ENV_ACCESS_TOKEN_REF
|
|
388344
|
+
});
|
|
388345
|
+
}
|
|
388132
388346
|
return candidates;
|
|
388133
388347
|
}
|
|
388134
388348
|
async function loadSession(contextId, environmentId) {
|
|
@@ -388147,13 +388361,11 @@ async function loadSession(contextId, environmentId) {
|
|
|
388147
388361
|
refreshed: credential !== originalCredential
|
|
388148
388362
|
};
|
|
388149
388363
|
}
|
|
388150
|
-
function resolvePantryBaseUrl(
|
|
388151
|
-
const baseUrl =
|
|
388364
|
+
function resolvePantryBaseUrl(config2) {
|
|
388365
|
+
const baseUrl = config2.environments[PANTRY_ENVIRONMENT_ID]?.services.pantry;
|
|
388152
388366
|
if (baseUrl)
|
|
388153
388367
|
return baseUrl;
|
|
388154
|
-
throw new Error(
|
|
388155
|
-
`Tela environment '${resolved.context.environmentId}' does not configure a Pantry service URL. Select a context whose environment defines services.pantry.`
|
|
388156
|
-
);
|
|
388368
|
+
throw new Error(`Tela environment '${PANTRY_ENVIRONMENT_ID}' does not configure a Pantry service URL (services.pantry).`);
|
|
388157
388369
|
}
|
|
388158
388370
|
|
|
388159
388371
|
// src/commands/ingredients.ts
|
|
@@ -388275,7 +388487,8 @@ async function callIngredientApi(args, _options, io) {
|
|
|
388275
388487
|
const environment = (0, import_tela_pantry2.resolveServiceEnvironment)(
|
|
388276
388488
|
ingredient,
|
|
388277
388489
|
inventory.services.environmentDefaults,
|
|
388278
|
-
flags.serviceEnv
|
|
388490
|
+
flags.serviceEnv,
|
|
388491
|
+
targetSession.resolved.context.environmentId
|
|
388279
388492
|
);
|
|
388280
388493
|
if (!environment) {
|
|
388281
388494
|
return usageError(`Ingredient '${slug}' has no environments configured.`, io);
|
package/dist/session.d.ts
CHANGED
|
@@ -25,4 +25,4 @@ export type PantrySession = {
|
|
|
25
25
|
export declare function loadPantry(flags: CatalogFlags): Promise<PantrySession>;
|
|
26
26
|
export declare function loadPantryForContext(resolved: ResolvedContext, config?: TelaLocalConfig): Promise<PantrySession>;
|
|
27
27
|
export declare function loadSession(contextId?: string, environmentId?: string): Promise<Session>;
|
|
28
|
-
export declare function resolvePantryBaseUrl(
|
|
28
|
+
export declare function resolvePantryBaseUrl(config: TelaLocalConfig): string;
|
package/dist/session.js
CHANGED
|
@@ -8,6 +8,9 @@ const refresh_session_1 = require("./refresh-session");
|
|
|
8
8
|
const tela_local_config_1 = require("@meistrari/tela-local-config");
|
|
9
9
|
const tela_pantry_1 = require("@meistrari/tela-pantry");
|
|
10
10
|
const credentials_1 = require("./credentials");
|
|
11
|
+
// Pantry only runs in Production. Other environments still pick the credential
|
|
12
|
+
// and service environment a command targets, never where the catalog lives.
|
|
13
|
+
const PANTRY_ENVIRONMENT_ID = 'production';
|
|
11
14
|
const ENV_ACCESS_TOKEN_REF = {
|
|
12
15
|
provider: 'env',
|
|
13
16
|
service: 'env',
|
|
@@ -31,7 +34,7 @@ async function loadPantry(flags) {
|
|
|
31
34
|
}
|
|
32
35
|
async function loadPantryForContext(resolved, config) {
|
|
33
36
|
const loadedConfig = config ?? await (0, tela_local_config_1.loadConfig)();
|
|
34
|
-
const baseUrl = resolvePantryBaseUrl(
|
|
37
|
+
const baseUrl = resolvePantryBaseUrl(loadedConfig);
|
|
35
38
|
const credential = await loadPantryCredential(loadedConfig, resolved);
|
|
36
39
|
return { client: (0, tela_pantry_1.createPantryClient)(baseUrl, credential), baseUrl };
|
|
37
40
|
}
|
|
@@ -49,8 +52,8 @@ async function loadPantryCredential(config, selected) {
|
|
|
49
52
|
if (credential.accessToken)
|
|
50
53
|
return credential;
|
|
51
54
|
}
|
|
52
|
-
throw new Error(`Pantry discovery requires a user-session access token for Tela environment '${
|
|
53
|
-
+
|
|
55
|
+
throw new Error(`Pantry discovery requires a user-session access token for Tela environment '${PANTRY_ENVIRONMENT_ID}'. `
|
|
56
|
+
+ `Run \`tela auth login --environment ${PANTRY_ENVIRONMENT_ID}\` or set TELA_ACCESS_TOKEN.`);
|
|
54
57
|
}
|
|
55
58
|
function pantryCredentialCandidates(config, selected) {
|
|
56
59
|
const candidates = [];
|
|
@@ -59,7 +62,7 @@ function pantryCredentialCandidates(config, selected) {
|
|
|
59
62
|
if (!contextId || seen.has(contextId))
|
|
60
63
|
return;
|
|
61
64
|
const context = config.contexts[contextId];
|
|
62
|
-
if (!context || context.environmentId !==
|
|
65
|
+
if (!context || context.environmentId !== PANTRY_ENVIRONMENT_ID)
|
|
63
66
|
return;
|
|
64
67
|
if (context.credentialRef.kind !== 'user-session')
|
|
65
68
|
return;
|
|
@@ -81,7 +84,17 @@ function pantryCredentialCandidates(config, selected) {
|
|
|
81
84
|
addContext(config.activeContextId);
|
|
82
85
|
for (const contextId of Object.keys(config.contexts))
|
|
83
86
|
addContext(contextId);
|
|
84
|
-
|
|
87
|
+
const environment = config.environments[PANTRY_ENVIRONMENT_ID];
|
|
88
|
+
if (environment) {
|
|
89
|
+
candidates.push({
|
|
90
|
+
resolved: {
|
|
91
|
+
...selected,
|
|
92
|
+
context: { ...selected.context, environmentId: PANTRY_ENVIRONMENT_ID },
|
|
93
|
+
environment,
|
|
94
|
+
},
|
|
95
|
+
credentialRef: ENV_ACCESS_TOKEN_REF,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
85
98
|
return candidates;
|
|
86
99
|
}
|
|
87
100
|
async function loadSession(contextId, environmentId) {
|
|
@@ -102,10 +115,9 @@ async function loadSession(contextId, environmentId) {
|
|
|
102
115
|
refreshed: credential !== originalCredential,
|
|
103
116
|
};
|
|
104
117
|
}
|
|
105
|
-
function resolvePantryBaseUrl(
|
|
106
|
-
const baseUrl =
|
|
118
|
+
function resolvePantryBaseUrl(config) {
|
|
119
|
+
const baseUrl = config.environments[PANTRY_ENVIRONMENT_ID]?.services.pantry;
|
|
107
120
|
if (baseUrl)
|
|
108
121
|
return baseUrl;
|
|
109
|
-
throw new Error(`Tela environment '${
|
|
110
|
-
+ 'Select a context whose environment defines services.pantry.');
|
|
122
|
+
throw new Error(`Tela environment '${PANTRY_ENVIRONMENT_ID}' does not configure a Pantry service URL (services.pantry).`);
|
|
111
123
|
}
|