dynamic-api-workflow 1.0.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/README.md +287 -0
- package/dist/engine/cli.d.ts +3 -0
- package/dist/engine/cli.d.ts.map +1 -0
- package/dist/engine/cli.js +4 -0
- package/dist/engine/cli.js.map +1 -0
- package/dist/engine/config/llm-costs.d.ts +16 -0
- package/dist/engine/config/llm-costs.d.ts.map +1 -0
- package/dist/engine/config/llm-costs.js +38 -0
- package/dist/engine/config/llm-costs.js.map +1 -0
- package/dist/engine/core/node-executor.d.ts +8 -0
- package/dist/engine/core/node-executor.d.ts.map +1 -0
- package/dist/engine/core/node-executor.js +144 -0
- package/dist/engine/core/node-executor.js.map +1 -0
- package/dist/engine/core/validator.d.ts +6 -0
- package/dist/engine/core/validator.d.ts.map +1 -0
- package/dist/engine/core/validator.js +473 -0
- package/dist/engine/core/validator.js.map +1 -0
- package/dist/engine/core/workflow-executor.d.ts +6 -0
- package/dist/engine/core/workflow-executor.d.ts.map +1 -0
- package/dist/engine/core/workflow-executor.js +186 -0
- package/dist/engine/core/workflow-executor.js.map +1 -0
- package/dist/engine/core/workflow-loader.d.ts +26 -0
- package/dist/engine/core/workflow-loader.d.ts.map +1 -0
- package/dist/engine/core/workflow-loader.js +257 -0
- package/dist/engine/core/workflow-loader.js.map +1 -0
- package/dist/engine/index.d.ts +5 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +70 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/nodes/code-node.d.ts +6 -0
- package/dist/engine/nodes/code-node.d.ts.map +1 -0
- package/dist/engine/nodes/code-node.js +70 -0
- package/dist/engine/nodes/code-node.js.map +1 -0
- package/dist/engine/nodes/llm-node.d.ts +6 -0
- package/dist/engine/nodes/llm-node.d.ts.map +1 -0
- package/dist/engine/nodes/llm-node.js +164 -0
- package/dist/engine/nodes/llm-node.js.map +1 -0
- package/dist/engine/nodes/passthrough-node.d.ts +6 -0
- package/dist/engine/nodes/passthrough-node.d.ts.map +1 -0
- package/dist/engine/nodes/passthrough-node.js +13 -0
- package/dist/engine/nodes/passthrough-node.js.map +1 -0
- package/dist/engine/nodes/reduce-node.d.ts +6 -0
- package/dist/engine/nodes/reduce-node.d.ts.map +1 -0
- package/dist/engine/nodes/reduce-node.js +44 -0
- package/dist/engine/nodes/reduce-node.js.map +1 -0
- package/dist/engine/nodes/split-node.d.ts +10 -0
- package/dist/engine/nodes/split-node.d.ts.map +1 -0
- package/dist/engine/nodes/split-node.js +51 -0
- package/dist/engine/nodes/split-node.js.map +1 -0
- package/dist/engine/providers/gemini.d.ts +27 -0
- package/dist/engine/providers/gemini.d.ts.map +1 -0
- package/dist/engine/providers/gemini.js +163 -0
- package/dist/engine/providers/gemini.js.map +1 -0
- package/dist/engine/providers/grok.d.ts +28 -0
- package/dist/engine/providers/grok.d.ts.map +1 -0
- package/dist/engine/providers/grok.js +164 -0
- package/dist/engine/providers/grok.js.map +1 -0
- package/dist/engine/providers/registry.d.ts +33 -0
- package/dist/engine/providers/registry.d.ts.map +1 -0
- package/dist/engine/providers/registry.js +51 -0
- package/dist/engine/providers/registry.js.map +1 -0
- package/dist/engine/router.d.ts +8 -0
- package/dist/engine/router.d.ts.map +1 -0
- package/dist/engine/router.js +79 -0
- package/dist/engine/router.js.map +1 -0
- package/dist/engine/scripts/cleanup-port.d.ts +2 -0
- package/dist/engine/scripts/cleanup-port.d.ts.map +1 -0
- package/dist/engine/scripts/cleanup-port.js +54 -0
- package/dist/engine/scripts/cleanup-port.js.map +1 -0
- package/dist/engine/scripts/create-endpoint.d.ts +2 -0
- package/dist/engine/scripts/create-endpoint.d.ts.map +1 -0
- package/dist/engine/scripts/create-endpoint.js +83 -0
- package/dist/engine/scripts/create-endpoint.js.map +1 -0
- package/dist/engine/scripts/scan-deps.d.ts +2 -0
- package/dist/engine/scripts/scan-deps.d.ts.map +1 -0
- package/dist/engine/scripts/scan-deps.js +112 -0
- package/dist/engine/scripts/scan-deps.js.map +1 -0
- package/dist/engine/scripts/validate-workflows.d.ts +3 -0
- package/dist/engine/scripts/validate-workflows.d.ts.map +1 -0
- package/dist/engine/scripts/validate-workflows.js +75 -0
- package/dist/engine/scripts/validate-workflows.js.map +1 -0
- package/dist/engine/server.d.ts +10 -0
- package/dist/engine/server.d.ts.map +1 -0
- package/dist/engine/server.js +92 -0
- package/dist/engine/server.js.map +1 -0
- package/dist/engine/types/index.d.ts +304 -0
- package/dist/engine/types/index.d.ts.map +1 -0
- package/dist/engine/types/index.js +24 -0
- package/dist/engine/types/index.js.map +1 -0
- package/dist/engine/utils/file-cache.d.ts +31 -0
- package/dist/engine/utils/file-cache.d.ts.map +1 -0
- package/dist/engine/utils/file-cache.js +68 -0
- package/dist/engine/utils/file-cache.js.map +1 -0
- package/dist/engine/utils/file-resolver.d.ts +21 -0
- package/dist/engine/utils/file-resolver.d.ts.map +1 -0
- package/dist/engine/utils/file-resolver.js +33 -0
- package/dist/engine/utils/file-resolver.js.map +1 -0
- package/dist/engine/utils/jsonpath.d.ts +13 -0
- package/dist/engine/utils/jsonpath.d.ts.map +1 -0
- package/dist/engine/utils/jsonpath.js +38 -0
- package/dist/engine/utils/jsonpath.js.map +1 -0
- package/dist/engine/utils/logger.d.ts +11 -0
- package/dist/engine/utils/logger.d.ts.map +1 -0
- package/dist/engine/utils/logger.js +24 -0
- package/dist/engine/utils/logger.js.map +1 -0
- package/dist/engine/utils/metrics.d.ts +6 -0
- package/dist/engine/utils/metrics.d.ts.map +1 -0
- package/dist/engine/utils/metrics.js +82 -0
- package/dist/engine/utils/metrics.js.map +1 -0
- package/dist/engine/utils/schema-validator.d.ts +10 -0
- package/dist/engine/utils/schema-validator.d.ts.map +1 -0
- package/dist/engine/utils/schema-validator.js +61 -0
- package/dist/engine/utils/schema-validator.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import logger from '../utils/logger.js';
|
|
2
|
+
import { ErrorCode } from '../types/index.js';
|
|
3
|
+
import { resolveFilePath } from '../utils/file-resolver.js';
|
|
4
|
+
const moduleCache = new Map();
|
|
5
|
+
/**
|
|
6
|
+
* Execute a code node
|
|
7
|
+
*/
|
|
8
|
+
export async function executeCodeNode(node, input, context, workflow) {
|
|
9
|
+
const startTime = performance.now();
|
|
10
|
+
// Resolve file path using endpoint context
|
|
11
|
+
const endpointPath = workflow.endpoint?.endpointPath || '';
|
|
12
|
+
const filePath = resolveFilePath(node.file, endpointPath, 'codes');
|
|
13
|
+
try {
|
|
14
|
+
// Get or load the code node function
|
|
15
|
+
let func = moduleCache.get(filePath);
|
|
16
|
+
if (!func) {
|
|
17
|
+
logger.debug('Loading code node module', { file: filePath });
|
|
18
|
+
// Dynamic import with file:// protocol for ESM
|
|
19
|
+
const fileUrl = `file://${filePath}`;
|
|
20
|
+
const module = await import(fileUrl);
|
|
21
|
+
if (!module.default || typeof module.default !== 'function') {
|
|
22
|
+
throw new Error(`Code node ${node.file} must export a default async function`);
|
|
23
|
+
}
|
|
24
|
+
func = module.default;
|
|
25
|
+
moduleCache.set(filePath, func);
|
|
26
|
+
}
|
|
27
|
+
// Execute the function with unwrapped input
|
|
28
|
+
logger.debug('Executing code node', { nodeId: node.id, file: node.file, resolvedPath: filePath });
|
|
29
|
+
const output = await func(input);
|
|
30
|
+
// Validate output structure
|
|
31
|
+
if (!output || typeof output !== 'object') {
|
|
32
|
+
throw new Error(`${ErrorCode.CODE_INVALID_OUTPUT}: Code node must return an object with { type, value }`);
|
|
33
|
+
}
|
|
34
|
+
const nodeOutput = output;
|
|
35
|
+
// Ensure output has required type and value properties
|
|
36
|
+
if (!nodeOutput.type || nodeOutput.value === undefined) {
|
|
37
|
+
throw new Error(`${ErrorCode.CODE_INVALID_OUTPUT}: Code node must return { type: 'text' | 'json', value: ... }`);
|
|
38
|
+
}
|
|
39
|
+
// Record metrics
|
|
40
|
+
const executionTime = performance.now() - startTime;
|
|
41
|
+
context.metrics.push({
|
|
42
|
+
nodeId: node.id,
|
|
43
|
+
nodeType: 'code',
|
|
44
|
+
executionTimeMs: executionTime,
|
|
45
|
+
});
|
|
46
|
+
logger.debug('Code node completed', {
|
|
47
|
+
nodeId: node.id,
|
|
48
|
+
executionTimeMs: executionTime.toFixed(2),
|
|
49
|
+
outputType: nodeOutput.type,
|
|
50
|
+
});
|
|
51
|
+
return nodeOutput;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
55
|
+
// Record failed execution time
|
|
56
|
+
const executionTime = performance.now() - startTime;
|
|
57
|
+
context.metrics.push({
|
|
58
|
+
nodeId: node.id,
|
|
59
|
+
nodeType: 'code',
|
|
60
|
+
executionTimeMs: executionTime,
|
|
61
|
+
});
|
|
62
|
+
// Re-throw if already has error code
|
|
63
|
+
if (message.startsWith('CODE_')) {
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
logger.error('Code node execution failed', { nodeId: node.id, file: node.file, error: message });
|
|
67
|
+
throw new Error(`${ErrorCode.CODE_EXCEPTION}: ${message}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=code-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-node.js","sourceRoot":"","sources":["../../../engine/nodes/code-node.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,WAAW,GAAG,IAAI,GAAG,EAAmD,CAAC;AAE/E;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACjC,IAAwB,EACxB,KAAc,EACd,OAAyB,EACzB,QAA4B;IAE5B,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAEpC,2CAA2C;IAC3C,MAAM,YAAY,GA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,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QACjG,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,CAAC,cAAc,KAAK,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NodeOutput, LLMNodeDefinition, WorkflowDefinition, ExecutionContext } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Execute an LLM node
|
|
4
|
+
*/
|
|
5
|
+
export declare function executeLLMNode(node: LLMNodeDefinition, input: unknown, workflow: WorkflowDefinition, context: ExecutionContext): Promise<NodeOutput>;
|
|
6
|
+
//# sourceMappingURL=llm-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm-node.d.ts","sourceRoot":"","sources":["../../../engine/nodes/llm-node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAa,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAOxH;;GAEG;AACH,wBAAsB,cAAc,CAChC,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,gBAAgB,GAC1B,OAAO,CAAC,UAAU,CAAC,CAyGrB"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { providerRegistry } from '../providers/registry.js';
|
|
2
|
+
import { resolveFilePath } from '../utils/file-resolver.js';
|
|
3
|
+
import fs from 'fs/promises';
|
|
4
|
+
import logger from '../utils/logger.js';
|
|
5
|
+
import { ErrorCode } from '../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Execute an LLM node
|
|
8
|
+
*/
|
|
9
|
+
export async function executeLLMNode(node, input, workflow, context) {
|
|
10
|
+
const startTime = performance.now();
|
|
11
|
+
try {
|
|
12
|
+
// Resolve LLM configuration
|
|
13
|
+
const config = resolveLLMConfig(node, workflow);
|
|
14
|
+
// Get provider
|
|
15
|
+
const providerName = node.provider || extractProviderFromRef(node.llmRef, workflow);
|
|
16
|
+
const provider = providerRegistry.get(providerName);
|
|
17
|
+
if (!provider) {
|
|
18
|
+
throw new Error(`${ErrorCode.PROVIDER_NOT_FOUND}: Provider '${providerName}' not found. Available: ${providerRegistry.getProviderNames().join(', ')}`);
|
|
19
|
+
}
|
|
20
|
+
// Validate config
|
|
21
|
+
const validation = await provider.validateConfig(config);
|
|
22
|
+
if (!validation.valid) {
|
|
23
|
+
const errors = validation.errors?.map((e) => e.message).join('; ') || 'Unknown error';
|
|
24
|
+
throw new Error(`${ErrorCode.VALIDATION_FAILED}: LLM config validation failed: ${errors}`);
|
|
25
|
+
}
|
|
26
|
+
// Validate input is string (for LLM user message)
|
|
27
|
+
if (typeof input !== 'string') {
|
|
28
|
+
logger.warn('LLM node received non-string input, converting to string', {
|
|
29
|
+
nodeId: node.id,
|
|
30
|
+
inputType: typeof input,
|
|
31
|
+
});
|
|
32
|
+
if (typeof input === 'object' && input !== null) {
|
|
33
|
+
input = JSON.stringify(input);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
input = String(input);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// Load system messages
|
|
40
|
+
const endpointPath = workflow.endpoint?.endpointPath || '';
|
|
41
|
+
const systemMessages = await loadSystemMessages(node, endpointPath);
|
|
42
|
+
// Call provider
|
|
43
|
+
logger.debug('Calling LLM provider', {
|
|
44
|
+
nodeId: node.id,
|
|
45
|
+
provider: providerName,
|
|
46
|
+
model: config.model,
|
|
47
|
+
});
|
|
48
|
+
const response = await provider.call({
|
|
49
|
+
config,
|
|
50
|
+
systemMessages,
|
|
51
|
+
userMessage: input,
|
|
52
|
+
});
|
|
53
|
+
const executionTimeMs = performance.now() - startTime;
|
|
54
|
+
// Record metrics
|
|
55
|
+
context.metrics.push({
|
|
56
|
+
nodeId: node.id,
|
|
57
|
+
nodeType: 'llm',
|
|
58
|
+
executionTimeMs,
|
|
59
|
+
model: config.model,
|
|
60
|
+
inputTokens: response.usage?.inputTokens,
|
|
61
|
+
outputTokens: response.usage?.outputTokens,
|
|
62
|
+
cachedTokens: response.usage?.cachedTokens,
|
|
63
|
+
});
|
|
64
|
+
logger.debug('LLM call successful', {
|
|
65
|
+
nodeId: node.id,
|
|
66
|
+
provider: providerName,
|
|
67
|
+
inputTokens: response.usage?.inputTokens,
|
|
68
|
+
outputTokens: response.usage?.outputTokens,
|
|
69
|
+
executionTimeMs,
|
|
70
|
+
});
|
|
71
|
+
// Return as string type
|
|
72
|
+
return {
|
|
73
|
+
type: 'string',
|
|
74
|
+
value: response.content,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
const executionTimeMs = performance.now() - startTime;
|
|
79
|
+
// Record metrics even on error
|
|
80
|
+
context.metrics.push({
|
|
81
|
+
nodeId: node.id,
|
|
82
|
+
nodeType: 'llm',
|
|
83
|
+
executionTimeMs,
|
|
84
|
+
});
|
|
85
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
86
|
+
// Re-throw if already has error code
|
|
87
|
+
if (message.startsWith('LLM_') ||
|
|
88
|
+
message.startsWith('PROVIDER_') ||
|
|
89
|
+
message.startsWith('VALIDATION_')) {
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
logger.error('LLM node execution failed', { nodeId: node.id, error: message });
|
|
93
|
+
throw new Error(`${ErrorCode.LLM_API_ERROR}: ${message}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Resolve LLM configuration from node or workflow
|
|
98
|
+
*/
|
|
99
|
+
function resolveLLMConfig(node, workflow) {
|
|
100
|
+
// If node has inline config, use it
|
|
101
|
+
if (node.config) {
|
|
102
|
+
return node.config;
|
|
103
|
+
}
|
|
104
|
+
// If node has llmRef, resolve from workflow
|
|
105
|
+
if (node.llmRef) {
|
|
106
|
+
const llmConfig = workflow.llm?.[node.llmRef];
|
|
107
|
+
if (!llmConfig) {
|
|
108
|
+
throw new Error(`${ErrorCode.VALIDATION_FAILED}: LLM reference '${node.llmRef}' not found in workflow llm configuration`);
|
|
109
|
+
}
|
|
110
|
+
return llmConfig.config;
|
|
111
|
+
}
|
|
112
|
+
throw new Error(`${ErrorCode.VALIDATION_FAILED}: LLM node must have either 'config' or 'llmRef' specified`);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Extract provider name from llmRef
|
|
116
|
+
*/
|
|
117
|
+
function extractProviderFromRef(llmRef, workflow) {
|
|
118
|
+
if (!llmRef) {
|
|
119
|
+
throw new Error(`${ErrorCode.VALIDATION_FAILED}: Cannot extract provider without llmRef`);
|
|
120
|
+
}
|
|
121
|
+
const llmConfig = workflow.llm?.[llmRef];
|
|
122
|
+
if (!llmConfig) {
|
|
123
|
+
throw new Error(`${ErrorCode.VALIDATION_FAILED}: LLM reference '${llmRef}' not found`);
|
|
124
|
+
}
|
|
125
|
+
return llmConfig.provider;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Load system messages from files
|
|
129
|
+
*/
|
|
130
|
+
async function loadSystemMessages(node, endpointPath) {
|
|
131
|
+
if (!node.systemMessages || node.systemMessages.length === 0) {
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
const messages = [];
|
|
135
|
+
for (const msg of node.systemMessages) {
|
|
136
|
+
if (msg.content) {
|
|
137
|
+
// Inline content
|
|
138
|
+
messages.push({
|
|
139
|
+
content: msg.content,
|
|
140
|
+
cache: msg.cache || false,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
else if (msg.file) {
|
|
144
|
+
// Load from file - use file-resolver for @ prefix support
|
|
145
|
+
try {
|
|
146
|
+
const filePath = resolveFilePath(msg.file, endpointPath, 'prompts');
|
|
147
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
148
|
+
messages.push({
|
|
149
|
+
content,
|
|
150
|
+
cache: msg.cache || false,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
155
|
+
throw new Error(`${ErrorCode.FILE_NOT_FOUND}: Failed to load prompt file '${msg.file}': ${errorMessage}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
throw new Error(`${ErrorCode.VALIDATION_FAILED}: System message must have either 'content' or 'file'`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return messages;
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=llm-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm-node.js","sourceRoot":"","sources":["../../../engine/nodes/llm-node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAChC,IAAuB,EACvB,KAAc,EACd,QAA4B,EAC5B,OAAyB;IAEzB,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAEpC,IAAI,CAAC;QACD,4BAA4B;QAC5B,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEhD,eAAe;QACf,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,IAAI,sBAAsB,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACpF,MAAM,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAEpD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACX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,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC5E,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,CAAC,cAAc,iCAAiC,GAAG,CAAC,IAAI,MAAM,YAAY,EAAE,CAAC,CAAC;YAC9G,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,MAAM,IAAI,KAAK,CACX,GAAG,SAAS,CAAC,iBAAiB,uDAAuD,CACxF,CAAC;QACN,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NodeOutput, PassthroughNodeDefinition } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Execute a passthrough node (passes input to output unchanged)
|
|
4
|
+
*/
|
|
5
|
+
export declare function executePassthroughNode(node: PassthroughNodeDefinition, input: NodeOutput): Promise<NodeOutput>;
|
|
6
|
+
//# sourceMappingURL=passthrough-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passthrough-node.d.ts","sourceRoot":"","sources":["../../../engine/nodes/passthrough-node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAG/E;;GAEG;AACH,wBAAsB,sBAAsB,CACxC,IAAI,EAAE,yBAAyB,EAC/B,KAAK,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAQrB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import logger from '../utils/logger.js';
|
|
2
|
+
/**
|
|
3
|
+
* Execute a passthrough node (passes input to output unchanged)
|
|
4
|
+
*/
|
|
5
|
+
export async function executePassthroughNode(node, input) {
|
|
6
|
+
logger.debug('Executing passthrough node', {
|
|
7
|
+
nodeId: node.id,
|
|
8
|
+
inputType: input.type,
|
|
9
|
+
});
|
|
10
|
+
// Simply return the input unchanged
|
|
11
|
+
return input;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=passthrough-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passthrough-node.js","sourceRoot":"","sources":["../../../engine/nodes/passthrough-node.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CACxC,IAA+B,EAC/B,KAAiB;IAEjB,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE;QACvC,MAAM,EAAE,IAAI,CAAC,EAAE;QACf,SAAS,EAAE,KAAK,CAAC,IAAI;KACxB,CAAC,CAAC;IAEH,oCAAoC;IACpC,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NodeOutput, ReduceNodeDefinition, ExecutionContext } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Execute a reduce node
|
|
4
|
+
*/
|
|
5
|
+
export declare function executeReduceNode(node: ReduceNodeDefinition, context: ExecutionContext): Promise<NodeOutput>;
|
|
6
|
+
//# sourceMappingURL=reduce-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reduce-node.d.ts","sourceRoot":"","sources":["../../../engine/nodes/reduce-node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAK5F;;GAEG;AACH,wBAAsB,iBAAiB,CACnC,IAAI,EAAE,oBAAoB,EAC1B,OAAO,EAAE,gBAAgB,GAC1B,OAAO,CAAC,UAAU,CAAC,CA8CrB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { evaluateAll } from '../utils/jsonpath.js';
|
|
2
|
+
import logger from '../utils/logger.js';
|
|
3
|
+
import { ErrorCode } from '../types/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Execute a reduce node
|
|
6
|
+
*/
|
|
7
|
+
export async function executeReduceNode(node, context) {
|
|
8
|
+
try {
|
|
9
|
+
// Collect inputs from referenced nodes
|
|
10
|
+
const inputData = {};
|
|
11
|
+
for (const inputNodeId of node.inputs) {
|
|
12
|
+
const nodeOutput = context.nodeOutputs.get(inputNodeId);
|
|
13
|
+
if (!nodeOutput) {
|
|
14
|
+
throw new Error(`${ErrorCode.NODE_NOT_FOUND}: Input node '${inputNodeId}' has not been executed yet`);
|
|
15
|
+
}
|
|
16
|
+
inputData[inputNodeId] = nodeOutput.value;
|
|
17
|
+
}
|
|
18
|
+
logger.debug('Reducing node inputs', {
|
|
19
|
+
nodeId: node.id,
|
|
20
|
+
inputs: node.inputs,
|
|
21
|
+
mapping: node.mapping,
|
|
22
|
+
});
|
|
23
|
+
// Apply JSONPath mapping to extract and combine values
|
|
24
|
+
const result = evaluateAll(node.mapping, inputData);
|
|
25
|
+
logger.debug('Reduce node executed successfully', {
|
|
26
|
+
nodeId: node.id,
|
|
27
|
+
resultKeys: Object.keys(result),
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
type: 'json',
|
|
31
|
+
value: result,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
36
|
+
// Re-throw if already has error code
|
|
37
|
+
if (message.includes(ErrorCode.JSONPATH_ERROR) || message.includes(ErrorCode.NODE_NOT_FOUND)) {
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
logger.error('Reduce node execution failed', { nodeId: node.id, error: message });
|
|
41
|
+
throw new Error(`Failed to execute reduce node: ${message}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=reduce-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reduce-node.js","sourceRoot":"","sources":["../../../engine/nodes/reduce-node.ts"],"names":[],"mappings":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,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEvE,qCAAqC;QACrC,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;YAC3F,MAAM,KAAK,CAAC;QAChB,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QAClF,MAAM,IAAI,KAAK,CAAC,kCAAkC,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NodeOutput, SplitNodeDefinition, ExecutionContext } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Execute a split node
|
|
4
|
+
*/
|
|
5
|
+
export declare function executeSplitNode(node: SplitNodeDefinition, input: unknown): Promise<Map<string, NodeOutput>>;
|
|
6
|
+
/**
|
|
7
|
+
* Get a specific output from a split node
|
|
8
|
+
*/
|
|
9
|
+
export declare function getSplitOutput(context: ExecutionContext, nodeId: string, outputName: string): NodeOutput | undefined;
|
|
10
|
+
//# sourceMappingURL=split-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-node.d.ts","sourceRoot":"","sources":["../../../engine/nodes/split-node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAK3F;;GAEG;AACH,wBAAsB,gBAAgB,CAClC,IAAI,EAAE,mBAAmB,EACzB,KAAK,EAAE,OAAO,GACf,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CA6ClC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC1B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GACnB,UAAU,GAAG,SAAS,CAGxB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { evaluateAll } from '../utils/jsonpath.js';
|
|
2
|
+
import logger from '../utils/logger.js';
|
|
3
|
+
import { ErrorCode } from '../types/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Execute a split node
|
|
6
|
+
*/
|
|
7
|
+
export async function executeSplitNode(node, input) {
|
|
8
|
+
try {
|
|
9
|
+
// Validate input is object or array
|
|
10
|
+
if (typeof input !== 'object' || input === null) {
|
|
11
|
+
throw new Error(`${ErrorCode.VALIDATION_FAILED}: Split node requires object or array input, got ${typeof input}`);
|
|
12
|
+
}
|
|
13
|
+
logger.debug('Splitting node input', {
|
|
14
|
+
nodeId: node.id,
|
|
15
|
+
mapping: node.mapping,
|
|
16
|
+
inputType: Array.isArray(input) ? 'array' : 'object',
|
|
17
|
+
});
|
|
18
|
+
// Apply JSONPath mapping to extract values
|
|
19
|
+
const extracted = evaluateAll(node.mapping, input);
|
|
20
|
+
// Convert to Map of NodeOutputs
|
|
21
|
+
const outputs = new Map();
|
|
22
|
+
for (const [key, value] of Object.entries(extracted)) {
|
|
23
|
+
outputs.set(key, {
|
|
24
|
+
type: 'json',
|
|
25
|
+
value,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
logger.debug('Split node executed successfully', {
|
|
29
|
+
nodeId: node.id,
|
|
30
|
+
outputKeys: Array.from(outputs.keys()),
|
|
31
|
+
});
|
|
32
|
+
return outputs;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
36
|
+
// Re-throw if already has error code
|
|
37
|
+
if (message.includes(ErrorCode.JSONPATH_ERROR) || message.includes(ErrorCode.VALIDATION_FAILED)) {
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
logger.error('Split node execution failed', { nodeId: node.id, error: message });
|
|
41
|
+
throw new Error(`Failed to execute split node: ${message}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get a specific output from a split node
|
|
46
|
+
*/
|
|
47
|
+
export function getSplitOutput(context, nodeId, outputName) {
|
|
48
|
+
const splitOutputs = context.splitOutputs.get(nodeId);
|
|
49
|
+
return splitOutputs?.get(outputName);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=split-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-node.js","sourceRoot":"","sources":["../../../engine/nodes/split-node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAClC,IAAyB,EACzB,KAAc;IAEd,IAAI,CAAC;QACD,oCAAoC;QACpC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CACX,GAAG,SAAS,CAAC,iBAAiB,oDAAoD,OAAO,KAAK,EAAE,CACnG,CAAC;QACN,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE;YACjC,MAAM,EAAE,IAAI,CAAC,EAAE;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ;SACvD,CAAC,CAAC;QAEH,2CAA2C;QAC3C,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAEnD,gCAAgC;QAChC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAsB,CAAC;QAE9C,KAAK,MAAM,CAAC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ponse, ValidationResult } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Gemini LLM provider implementation
|
|
4
|
+
*/
|
|
5
|
+
export declare class GeminiProvider implements LLMProvider {
|
|
6
|
+
name: string;
|
|
7
|
+
private client;
|
|
8
|
+
private apiKey;
|
|
9
|
+
constructor();
|
|
10
|
+
/**
|
|
11
|
+
* Validate Gemini configuration
|
|
12
|
+
*/
|
|
13
|
+
validateConfig(config: LLMConfig): Promise<ValidationResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Call Gemini API
|
|
16
|
+
*/
|
|
17
|
+
call(params: LLMCallParams): Promise<LLMResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Check if a feature is supported
|
|
20
|
+
*/
|
|
21
|
+
supportsFeature(feature: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a custom config key is supported
|
|
24
|
+
*/
|
|
25
|
+
private isSupportedCustomKey;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=gemini.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../../engine/providers/gemini.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,WAAW,EACX,SAAS,EACT,aAAa,EACb,WAAW,EACX,gBAAgB,EACnB,MAAM,mBAAmB,CAAC;AAG3B;;GAEG;AACH,qBAAa,cAAe,YAAW,WAAW;IAC9C,IAAI,SAAY;IAChB,OAAO,CAAC,MAAM,CAAmC;IACjD,OAAO,CAAC,MAAM,CAAqB;;IAYnC;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAsClE;;OAEG;IACG,IAAI,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC;IA2GvD;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAKzC;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAI/B"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { GoogleGenerativeAI, HarmBlockThreshold, HarmCategory } from '@google/generative-ai';
|
|
2
|
+
import logger from '../utils/logger.js';
|
|
3
|
+
/**
|
|
4
|
+
* Gemini LLM provider implementation
|
|
5
|
+
*/
|
|
6
|
+
export class GeminiProvider {
|
|
7
|
+
name = 'gemini';
|
|
8
|
+
client = null;
|
|
9
|
+
apiKey;
|
|
10
|
+
constructor() {
|
|
11
|
+
this.apiKey = process.env.GEMINI_API_KEY;
|
|
12
|
+
if (this.apiKey) {
|
|
13
|
+
this.client = new GoogleGenerativeAI(this.apiKey);
|
|
14
|
+
logger.info('Gemini provider initialized');
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
logger.warn('Gemini API key not found, provider will not be functional');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Validate Gemini configuration
|
|
22
|
+
*/
|
|
23
|
+
async validateConfig(config) {
|
|
24
|
+
const errors = [];
|
|
25
|
+
if (!config.model) {
|
|
26
|
+
errors.push({
|
|
27
|
+
code: 'MISSING_MODEL',
|
|
28
|
+
message: 'Model is required for Gemini provider',
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (!this.apiKey) {
|
|
32
|
+
errors.push({
|
|
33
|
+
code: 'MISSING_API_KEY',
|
|
34
|
+
message: 'GEMINI_API_KEY environment variable is not set',
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (config.temperature !== undefined && (config.temperature < 0 || config.temperature > 2)) {
|
|
38
|
+
errors.push({
|
|
39
|
+
code: 'INVALID_TEMPERATURE',
|
|
40
|
+
message: 'Temperature must be between 0 and 2',
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (config.maxTokens !== undefined && config.maxTokens < 1) {
|
|
44
|
+
errors.push({
|
|
45
|
+
code: 'INVALID_MAX_TOKENS',
|
|
46
|
+
message: 'Max tokens must be a positive number',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (errors.length > 0) {
|
|
50
|
+
return { valid: false, errors };
|
|
51
|
+
}
|
|
52
|
+
return { valid: true };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Call Gemini API
|
|
56
|
+
*/
|
|
57
|
+
async call(params) {
|
|
58
|
+
if (!this.client) {
|
|
59
|
+
throw new Error('Gemini client not initialized. Check GEMINI_API_KEY.');
|
|
60
|
+
}
|
|
61
|
+
const { config, systemMessages, userMessage } = params;
|
|
62
|
+
const timeout = parseInt(process.env.LLM_TIMEOUT_MS || '30000', 10);
|
|
63
|
+
try {
|
|
64
|
+
// Build generation config
|
|
65
|
+
const generationConfig = {};
|
|
66
|
+
if (config.temperature !== undefined) {
|
|
67
|
+
generationConfig.temperature = config.temperature;
|
|
68
|
+
}
|
|
69
|
+
if (config.maxTokens !== undefined) {
|
|
70
|
+
generationConfig.maxOutputTokens = config.maxTokens;
|
|
71
|
+
}
|
|
72
|
+
// Add custom config parameters
|
|
73
|
+
if (config.custom) {
|
|
74
|
+
for (const [key, value] of Object.entries(config.custom)) {
|
|
75
|
+
if (this.isSupportedCustomKey(key)) {
|
|
76
|
+
generationConfig[key] = value;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
logger.warn(`Unsupported custom config key for Gemini: ${key}`, { key, value });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Build system instruction in proper Content format
|
|
84
|
+
const systemInstruction = systemMessages.length > 0 ? {
|
|
85
|
+
parts: [{ text: systemMessages.map((msg) => msg.content).join('\n\n') }],
|
|
86
|
+
role: 'user',
|
|
87
|
+
} : undefined;
|
|
88
|
+
const model = this.client.getGenerativeModel({
|
|
89
|
+
model: config.model,
|
|
90
|
+
generationConfig,
|
|
91
|
+
systemInstruction,
|
|
92
|
+
safetySettings: [
|
|
93
|
+
{
|
|
94
|
+
category: HarmCategory.HARM_CATEGORY_HARASSMENT,
|
|
95
|
+
threshold: HarmBlockThreshold.BLOCK_NONE,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
category: HarmCategory.HARM_CATEGORY_HATE_SPEECH,
|
|
99
|
+
threshold: HarmBlockThreshold.BLOCK_NONE,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
category: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT,
|
|
103
|
+
threshold: HarmBlockThreshold.BLOCK_NONE,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
|
|
107
|
+
threshold: HarmBlockThreshold.BLOCK_NONE,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
});
|
|
111
|
+
const chat = model.startChat({
|
|
112
|
+
history: [],
|
|
113
|
+
});
|
|
114
|
+
// Call with timeout
|
|
115
|
+
const result = await Promise.race([
|
|
116
|
+
chat.sendMessage(userMessage),
|
|
117
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error('LLM_TIMEOUT')), timeout)),
|
|
118
|
+
]);
|
|
119
|
+
const response = result.response;
|
|
120
|
+
const text = response.text();
|
|
121
|
+
// Extract usage if available
|
|
122
|
+
const usage = response.usageMetadata
|
|
123
|
+
? {
|
|
124
|
+
inputTokens: response.usageMetadata.promptTokenCount || 0,
|
|
125
|
+
outputTokens: response.usageMetadata.candidatesTokenCount || 0,
|
|
126
|
+
}
|
|
127
|
+
: undefined;
|
|
128
|
+
logger.debug('Gemini API call successful', {
|
|
129
|
+
model: config.model,
|
|
130
|
+
inputTokens: usage?.inputTokens,
|
|
131
|
+
outputTokens: usage?.outputTokens,
|
|
132
|
+
});
|
|
133
|
+
return {
|
|
134
|
+
content: text,
|
|
135
|
+
usage,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
140
|
+
if (message === 'LLM_TIMEOUT') {
|
|
141
|
+
logger.error('Gemini API timeout', { timeout, model: config.model });
|
|
142
|
+
throw new Error(`LLM_TIMEOUT: Request timed out after ${timeout}ms`);
|
|
143
|
+
}
|
|
144
|
+
logger.error('Gemini API error', { error: message, model: config.model });
|
|
145
|
+
throw new Error(`LLM_API_ERROR: ${message}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Check if a feature is supported
|
|
150
|
+
*/
|
|
151
|
+
supportsFeature(feature) {
|
|
152
|
+
const supportedFeatures = ['caching', 'systemMessages', 'temperature', 'maxTokens'];
|
|
153
|
+
return supportedFeatures.includes(feature);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Check if a custom config key is supported
|
|
157
|
+
*/
|
|
158
|
+
isSupportedCustomKey(key) {
|
|
159
|
+
const supported = ['topP', 'topK', 'stopSequences', 'candidateCount'];
|
|
160
|
+
return supported.includes(key);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=gemini.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../../engine/providers/gemini.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAQ7F,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,cAAc;IACvB,IAAI,GAAG,QAAQ,CAAC;IACR,MAAM,GAA8B,IAAI,CAAC;IACzC,MAAM,CAAqB;IAEnC;QACI,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;QACzC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,IAAI,CAAC,MAAM,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAClD,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACJ,MAAM,CA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