@juspay/neurolink 9.3.0 → 9.5.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/CHANGELOG.md +12 -0
- package/README.md +8 -8
- package/dist/cli/commands/config.d.ts +3 -3
- package/dist/cli/index.js +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +17 -0
- package/dist/lib/agent/directTools.d.ts +5 -5
- package/dist/lib/index.d.ts +35 -0
- package/dist/lib/index.js +17 -0
- package/dist/lib/neurolink.d.ts +12 -1
- package/dist/lib/neurolink.js +265 -4
- package/dist/lib/server/utils/validation.d.ts +8 -8
- package/dist/lib/types/generateTypes.d.ts +28 -0
- package/dist/lib/types/index.d.ts +6 -0
- package/dist/lib/types/index.js +12 -0
- package/dist/lib/types/modelTypes.d.ts +2 -2
- package/dist/lib/types/streamTypes.d.ts +35 -0
- package/dist/lib/types/workflowTypes.d.ts +558 -0
- package/dist/lib/types/workflowTypes.js +32 -0
- package/dist/lib/workflow/LAYER-EXAMPLES.d.ts +13 -0
- package/dist/lib/workflow/LAYER-EXAMPLES.js +312 -0
- package/dist/lib/workflow/PROMPT-EXAMPLES.d.ts +117 -0
- package/dist/lib/workflow/PROMPT-EXAMPLES.js +246 -0
- package/dist/lib/workflow/config.d.ts +1569 -0
- package/dist/lib/workflow/config.js +399 -0
- package/dist/lib/workflow/core/ensembleExecutor.d.ts +56 -0
- package/dist/lib/workflow/core/ensembleExecutor.js +398 -0
- package/dist/lib/workflow/core/judgeScorer.d.ts +26 -0
- package/dist/lib/workflow/core/judgeScorer.js +527 -0
- package/dist/lib/workflow/core/responseConditioner.d.ts +22 -0
- package/dist/lib/workflow/core/responseConditioner.js +226 -0
- package/dist/lib/workflow/core/types/conditionerTypes.d.ts +7 -0
- package/dist/lib/workflow/core/types/conditionerTypes.js +8 -0
- package/dist/lib/workflow/core/types/ensembleTypes.d.ts +7 -0
- package/dist/lib/workflow/core/types/ensembleTypes.js +8 -0
- package/dist/lib/workflow/core/types/index.d.ts +7 -0
- package/dist/lib/workflow/core/types/index.js +8 -0
- package/dist/lib/workflow/core/types/judgeTypes.d.ts +7 -0
- package/dist/lib/workflow/core/types/judgeTypes.js +8 -0
- package/dist/lib/workflow/core/types/layerTypes.d.ts +7 -0
- package/dist/lib/workflow/core/types/layerTypes.js +8 -0
- package/dist/lib/workflow/core/types/registryTypes.d.ts +7 -0
- package/dist/lib/workflow/core/types/registryTypes.js +8 -0
- package/dist/lib/workflow/core/workflowRegistry.d.ts +73 -0
- package/dist/lib/workflow/core/workflowRegistry.js +305 -0
- package/dist/lib/workflow/core/workflowRunner.d.ts +115 -0
- package/dist/lib/workflow/core/workflowRunner.js +554 -0
- package/dist/lib/workflow/index.d.ts +36 -0
- package/dist/lib/workflow/index.js +51 -0
- package/dist/lib/workflow/types.d.ts +19 -0
- package/dist/lib/workflow/types.js +10 -0
- package/dist/lib/workflow/utils/types/index.d.ts +7 -0
- package/dist/lib/workflow/utils/types/index.js +8 -0
- package/dist/lib/workflow/utils/types/metricsTypes.d.ts +7 -0
- package/dist/lib/workflow/utils/types/metricsTypes.js +8 -0
- package/dist/lib/workflow/utils/types/validationTypes.d.ts +7 -0
- package/dist/lib/workflow/utils/types/validationTypes.js +8 -0
- package/dist/lib/workflow/utils/workflowMetrics.d.ts +76 -0
- package/dist/lib/workflow/utils/workflowMetrics.js +312 -0
- package/dist/lib/workflow/utils/workflowValidation.d.ts +29 -0
- package/dist/lib/workflow/utils/workflowValidation.js +421 -0
- package/dist/lib/workflow/workflows/adaptiveWorkflow.d.ts +72 -0
- package/dist/lib/workflow/workflows/adaptiveWorkflow.js +367 -0
- package/dist/lib/workflow/workflows/consensusWorkflow.d.ts +69 -0
- package/dist/lib/workflow/workflows/consensusWorkflow.js +193 -0
- package/dist/lib/workflow/workflows/fallbackWorkflow.d.ts +49 -0
- package/dist/lib/workflow/workflows/fallbackWorkflow.js +226 -0
- package/dist/lib/workflow/workflows/multiJudgeWorkflow.d.ts +70 -0
- package/dist/lib/workflow/workflows/multiJudgeWorkflow.js +352 -0
- package/dist/neurolink.d.ts +12 -1
- package/dist/neurolink.js +265 -4
- package/dist/types/generateTypes.d.ts +28 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +12 -0
- package/dist/types/streamTypes.d.ts +35 -0
- package/dist/types/workflowTypes.d.ts +558 -0
- package/dist/types/workflowTypes.js +31 -0
- package/dist/workflow/LAYER-EXAMPLES.d.ts +13 -0
- package/dist/workflow/LAYER-EXAMPLES.js +311 -0
- package/dist/workflow/PROMPT-EXAMPLES.d.ts +117 -0
- package/dist/workflow/PROMPT-EXAMPLES.js +245 -0
- package/dist/workflow/config.d.ts +1569 -0
- package/dist/workflow/config.js +398 -0
- package/dist/workflow/core/ensembleExecutor.d.ts +56 -0
- package/dist/workflow/core/ensembleExecutor.js +397 -0
- package/dist/workflow/core/judgeScorer.d.ts +26 -0
- package/dist/workflow/core/judgeScorer.js +526 -0
- package/dist/workflow/core/responseConditioner.d.ts +22 -0
- package/dist/workflow/core/responseConditioner.js +225 -0
- package/dist/workflow/core/types/conditionerTypes.d.ts +7 -0
- package/dist/workflow/core/types/conditionerTypes.js +7 -0
- package/dist/workflow/core/types/ensembleTypes.d.ts +7 -0
- package/dist/workflow/core/types/ensembleTypes.js +7 -0
- package/dist/workflow/core/types/index.d.ts +7 -0
- package/dist/workflow/core/types/index.js +7 -0
- package/dist/workflow/core/types/judgeTypes.d.ts +7 -0
- package/dist/workflow/core/types/judgeTypes.js +7 -0
- package/dist/workflow/core/types/layerTypes.d.ts +7 -0
- package/dist/workflow/core/types/layerTypes.js +7 -0
- package/dist/workflow/core/types/registryTypes.d.ts +7 -0
- package/dist/workflow/core/types/registryTypes.js +7 -0
- package/dist/workflow/core/workflowRegistry.d.ts +73 -0
- package/dist/workflow/core/workflowRegistry.js +304 -0
- package/dist/workflow/core/workflowRunner.d.ts +115 -0
- package/dist/workflow/core/workflowRunner.js +553 -0
- package/dist/workflow/index.d.ts +36 -0
- package/dist/workflow/index.js +50 -0
- package/dist/workflow/types.d.ts +19 -0
- package/dist/workflow/types.js +9 -0
- package/dist/workflow/utils/types/index.d.ts +7 -0
- package/dist/workflow/utils/types/index.js +7 -0
- package/dist/workflow/utils/types/metricsTypes.d.ts +7 -0
- package/dist/workflow/utils/types/metricsTypes.js +7 -0
- package/dist/workflow/utils/types/validationTypes.d.ts +7 -0
- package/dist/workflow/utils/types/validationTypes.js +7 -0
- package/dist/workflow/utils/workflowMetrics.d.ts +76 -0
- package/dist/workflow/utils/workflowMetrics.js +311 -0
- package/dist/workflow/utils/workflowValidation.d.ts +29 -0
- package/dist/workflow/utils/workflowValidation.js +420 -0
- package/dist/workflow/workflows/adaptiveWorkflow.d.ts +72 -0
- package/dist/workflow/workflows/adaptiveWorkflow.js +366 -0
- package/dist/workflow/workflows/consensusWorkflow.d.ts +69 -0
- package/dist/workflow/workflows/consensusWorkflow.js +192 -0
- package/dist/workflow/workflows/fallbackWorkflow.d.ts +49 -0
- package/dist/workflow/workflows/fallbackWorkflow.js +225 -0
- package/dist/workflow/workflows/multiJudgeWorkflow.d.ts +70 -0
- package/dist/workflow/workflows/multiJudgeWorkflow.js +351 -0
- package/package.json +3 -2
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workflow/core/responseConditioner.ts
|
|
3
|
+
* Response conditioning and synthesis
|
|
4
|
+
*
|
|
5
|
+
* Uses judge feedback and ensemble responses to synthesize an improved final response.
|
|
6
|
+
* Combines strengths from multiple responses based on evaluation insights.
|
|
7
|
+
*/
|
|
8
|
+
import { logger } from "../../utils/logger.js";
|
|
9
|
+
import { AIProviderFactory } from "../../core/factory.js";
|
|
10
|
+
const functionTag = "ResponseConditioner";
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// CONDITIONING FUNCTIONS
|
|
13
|
+
// ============================================================================
|
|
14
|
+
/**
|
|
15
|
+
* Condition response by synthesizing improved version using judge feedback
|
|
16
|
+
*
|
|
17
|
+
* @param options - Conditioning options including all responses and judge feedback
|
|
18
|
+
* @returns Conditioned result with synthesized improved content
|
|
19
|
+
*/
|
|
20
|
+
export async function conditionResponse(options) {
|
|
21
|
+
const startTime = Date.now();
|
|
22
|
+
const { content, selectedResponse, allResponses, judgeScores, config, originalPrompt, } = options;
|
|
23
|
+
logger.debug(`[${functionTag}] Conditioning response with synthesis`, {
|
|
24
|
+
originalLength: content.length,
|
|
25
|
+
provider: selectedResponse.provider,
|
|
26
|
+
model: selectedResponse.model,
|
|
27
|
+
hasConfig: !!config,
|
|
28
|
+
numResponses: allResponses?.length || 0,
|
|
29
|
+
});
|
|
30
|
+
// Check if conditioning is enabled
|
|
31
|
+
if (!config || !config.useConfidence) {
|
|
32
|
+
logger.debug(`[${functionTag}] Conditioning disabled, returning original`);
|
|
33
|
+
return {
|
|
34
|
+
content,
|
|
35
|
+
conditioningTime: Date.now() - startTime,
|
|
36
|
+
metadata: {
|
|
37
|
+
conditioningApplied: false,
|
|
38
|
+
originalLength: content.length,
|
|
39
|
+
finalLength: content.length,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// If synthesis model not configured, fall back to original with metadata
|
|
44
|
+
if (!config.synthesisModel) {
|
|
45
|
+
logger.debug(`[${functionTag}] No synthesis model configured, returning original with metadata`);
|
|
46
|
+
return addMetadataOnly(content, selectedResponse, judgeScores, config, startTime);
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
// Synthesize improved response using LLM
|
|
50
|
+
const synthesizedContent = await synthesizeImprovedResponse(content, allResponses, judgeScores, originalPrompt, config);
|
|
51
|
+
const conditioningTime = Date.now() - startTime;
|
|
52
|
+
logger.debug(`[${functionTag}] Response synthesized successfully`, {
|
|
53
|
+
conditioningTime,
|
|
54
|
+
originalLength: content.length,
|
|
55
|
+
finalLength: synthesizedContent.length,
|
|
56
|
+
improvement: synthesizedContent.length - content.length,
|
|
57
|
+
});
|
|
58
|
+
return {
|
|
59
|
+
content: synthesizedContent,
|
|
60
|
+
conditioningTime,
|
|
61
|
+
metadata: {
|
|
62
|
+
conditioningApplied: true,
|
|
63
|
+
originalLength: content.length,
|
|
64
|
+
finalLength: synthesizedContent.length,
|
|
65
|
+
confidenceStatementAdded: false,
|
|
66
|
+
modelAttributionAdded: false,
|
|
67
|
+
executionTimeAdded: false,
|
|
68
|
+
synthesisApplied: true,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
logger.warn(`[${functionTag}] Synthesis failed, falling back to original`, {
|
|
74
|
+
error: error instanceof Error ? error.message : String(error),
|
|
75
|
+
});
|
|
76
|
+
// Fall back to original with metadata
|
|
77
|
+
return addMetadataOnly(content, selectedResponse, judgeScores, config, startTime);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Check if conditioning is enabled
|
|
82
|
+
* @param config - Conditioning configuration
|
|
83
|
+
* @returns True if conditioning should be applied
|
|
84
|
+
*/
|
|
85
|
+
export function isConditioningEnabled(config) {
|
|
86
|
+
return config?.useConfidence === true;
|
|
87
|
+
}
|
|
88
|
+
// ============================================================================
|
|
89
|
+
// SYNTHESIS FUNCTIONS
|
|
90
|
+
// ============================================================================
|
|
91
|
+
/**
|
|
92
|
+
* Synthesize improved response using judge feedback and all ensemble responses
|
|
93
|
+
*/
|
|
94
|
+
async function synthesizeImprovedResponse(bestContent, allResponses, judgeScores, originalPrompt, config) {
|
|
95
|
+
const reasoning = judgeScores?.reasoning || "No specific feedback available";
|
|
96
|
+
// Build synthesis prompt
|
|
97
|
+
const synthesisPrompt = `You are a response synthesis expert. Your task is to create an improved, higher-quality response by combining the best elements from multiple AI-generated responses.
|
|
98
|
+
|
|
99
|
+
ORIGINAL USER PROMPT:
|
|
100
|
+
${originalPrompt || "Not provided"}
|
|
101
|
+
|
|
102
|
+
JUDGE'S EVALUATION:
|
|
103
|
+
${reasoning}
|
|
104
|
+
|
|
105
|
+
AVAILABLE RESPONSES:
|
|
106
|
+
${allResponses
|
|
107
|
+
.filter((r) => r.status === "success" && r.content)
|
|
108
|
+
.map((r, i) => `
|
|
109
|
+
Response ${i + 1} (${r.provider}/${r.model}):
|
|
110
|
+
${r.content}
|
|
111
|
+
`)
|
|
112
|
+
.join("\n---\n")}
|
|
113
|
+
|
|
114
|
+
BEST RESPONSE (Selected by Judge):
|
|
115
|
+
${bestContent}
|
|
116
|
+
|
|
117
|
+
YOUR TASK:
|
|
118
|
+
Synthesize an improved final response that:
|
|
119
|
+
1. Incorporates the judge's feedback and addresses any identified weaknesses
|
|
120
|
+
2. Combines the strongest elements from all responses
|
|
121
|
+
3. Maintains accuracy and technical correctness
|
|
122
|
+
4. Improves clarity, completeness, and overall quality
|
|
123
|
+
5. Maintains the same tone and format as the original responses
|
|
124
|
+
6. Does NOT add meta-commentary, disclaimers, or explanatory notes
|
|
125
|
+
7. Provides a direct, polished answer to the user's original question
|
|
126
|
+
|
|
127
|
+
Output ONLY the synthesized response, nothing else.`;
|
|
128
|
+
logger.debug(`[${functionTag}] Calling synthesis model`, {
|
|
129
|
+
model: config?.synthesisModel?.model || "default",
|
|
130
|
+
provider: config?.synthesisModel?.provider || "default",
|
|
131
|
+
});
|
|
132
|
+
// Create provider for synthesis using AIProviderFactory
|
|
133
|
+
const synthesisProvider = config?.synthesisModel?.provider || "azure";
|
|
134
|
+
const synthesisModel = config?.synthesisModel?.model || "gpt-4o";
|
|
135
|
+
const provider = await AIProviderFactory.createProvider(synthesisProvider, synthesisModel);
|
|
136
|
+
// Generate improved response
|
|
137
|
+
const result = await provider.generate({
|
|
138
|
+
prompt: synthesisPrompt,
|
|
139
|
+
temperature: config?.synthesisModel?.temperature || 0.3,
|
|
140
|
+
maxTokens: 2000,
|
|
141
|
+
timeout: 30000,
|
|
142
|
+
});
|
|
143
|
+
if (!result || !result.content) {
|
|
144
|
+
throw new Error("Synthesis model returned empty response");
|
|
145
|
+
}
|
|
146
|
+
return result.content.trim();
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Fallback: Add metadata only (original behavior)
|
|
150
|
+
*/
|
|
151
|
+
function addMetadataOnly(content, selectedResponse, judgeScores, config, startTime) {
|
|
152
|
+
let conditionedContent = content;
|
|
153
|
+
// Add confidence statement if enabled
|
|
154
|
+
if (config.addConfidenceStatement && judgeScores) {
|
|
155
|
+
const confidenceLevel = getConfidenceLevel(judgeScores.confidenceInJudgment || 0.5, config);
|
|
156
|
+
conditionedContent = addConfidenceStatement(conditionedContent, confidenceLevel, judgeScores.confidenceInJudgment || 0.5);
|
|
157
|
+
}
|
|
158
|
+
// Add model attribution if enabled
|
|
159
|
+
if (config.addModelAttribution) {
|
|
160
|
+
conditionedContent = addModelAttribution(conditionedContent, selectedResponse.provider, selectedResponse.model, judgeScores);
|
|
161
|
+
}
|
|
162
|
+
// Add execution time if enabled
|
|
163
|
+
if (config.addExecutionTime) {
|
|
164
|
+
conditionedContent = addExecutionMetrics(conditionedContent, selectedResponse.responseTime);
|
|
165
|
+
}
|
|
166
|
+
const conditioningTime = Date.now() - startTime;
|
|
167
|
+
return {
|
|
168
|
+
content: conditionedContent,
|
|
169
|
+
conditioningTime,
|
|
170
|
+
metadata: {
|
|
171
|
+
conditioningApplied: true,
|
|
172
|
+
originalLength: content.length,
|
|
173
|
+
finalLength: conditionedContent.length,
|
|
174
|
+
confidenceStatementAdded: config.addConfidenceStatement,
|
|
175
|
+
modelAttributionAdded: config.addModelAttribution,
|
|
176
|
+
executionTimeAdded: config.addExecutionTime,
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
// ============================================================================
|
|
181
|
+
// HELPER FUNCTIONS
|
|
182
|
+
// ============================================================================
|
|
183
|
+
/**
|
|
184
|
+
* Determine confidence level from score
|
|
185
|
+
*/
|
|
186
|
+
function getConfidenceLevel(confidence, config) {
|
|
187
|
+
const thresholds = config.confidenceThresholds || {
|
|
188
|
+
high: 0.8,
|
|
189
|
+
medium: 0.5,
|
|
190
|
+
low: 0.3,
|
|
191
|
+
};
|
|
192
|
+
if (confidence >= thresholds.high) {
|
|
193
|
+
return "high";
|
|
194
|
+
}
|
|
195
|
+
if (confidence >= thresholds.medium) {
|
|
196
|
+
return "medium";
|
|
197
|
+
}
|
|
198
|
+
return "low";
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Add confidence statement to response
|
|
202
|
+
*/
|
|
203
|
+
function addConfidenceStatement(content, level, score) {
|
|
204
|
+
const statements = {
|
|
205
|
+
high: `\n\n---\n**Quality Assurance:** This response achieved a high confidence score (${(score * 100).toFixed(0)}%) through multi-model evaluation. The content has been validated for accuracy and completeness.`,
|
|
206
|
+
medium: `\n\n---\n**Quality Note:** This response received a moderate confidence score (${(score * 100).toFixed(0)}%) from the evaluation system. Consider cross-referencing critical details.`,
|
|
207
|
+
low: `\n\n---\n**Advisory:** This response has a lower confidence score (${(score * 100).toFixed(0)}%). Please verify important information independently.`,
|
|
208
|
+
};
|
|
209
|
+
return content + statements[level];
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Add model attribution
|
|
213
|
+
*/
|
|
214
|
+
function addModelAttribution(content, provider, model, judgeScores) {
|
|
215
|
+
const score = Object.values(judgeScores?.scores || {}).reduce((max, curr) => Math.max(max, curr), 0);
|
|
216
|
+
return (content +
|
|
217
|
+
`\n\n---\n**Source:** Generated by ${provider}/${model} | Evaluation Score: ${score}/100`);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Add execution metrics
|
|
221
|
+
*/
|
|
222
|
+
function addExecutionMetrics(content, responseTime) {
|
|
223
|
+
return (content +
|
|
224
|
+
`\n\n---\n**Performance:** Response generated in ${responseTime}ms`);
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=responseConditioner.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workflow/core/types/conditionerTypes.ts
|
|
3
|
+
* Type definitions for response conditioning
|
|
4
|
+
*
|
|
5
|
+
* Re-exports from the central types folder for backward compatibility
|
|
6
|
+
*/
|
|
7
|
+
export type { ConditionOptions, ConditionResult, } from "../../../types/workflowTypes.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workflow/core/types/ensembleTypes.ts
|
|
3
|
+
* Type definitions for ensemble execution
|
|
4
|
+
*
|
|
5
|
+
* Re-exports from the central types folder for backward compatibility
|
|
6
|
+
*/
|
|
7
|
+
export type { ExecuteEnsembleOptions, EnsembleExecutionResult, ExecuteModelOptions, } from "../../../types/workflowTypes.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workflow/core/types/index.ts
|
|
3
|
+
* Centralized export for all workflow core types
|
|
4
|
+
*
|
|
5
|
+
* Re-exports from the central types folder for backward compatibility
|
|
6
|
+
*/
|
|
7
|
+
export type { ConditionOptions, ConditionResult, EnsembleExecutionResult, ExecuteEnsembleOptions, ExecuteModelOptions, ParsedJudgeResponse, ScoreOptions, ScoreResult, ExecuteLayerOptions, LayerExecutionResult, ListOptions, RegisterOptions, RegisterResult, RegistryEntry, RegistryStats, WorkflowMetadata, } from "../../../types/workflowTypes.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workflow/core/types/layerTypes.ts
|
|
3
|
+
* Type definitions for layer-based execution
|
|
4
|
+
*
|
|
5
|
+
* Re-exports from the central types folder for backward compatibility
|
|
6
|
+
*/
|
|
7
|
+
export type { LayerExecutionResult, ExecuteLayerOptions, } from "../../../types/workflowTypes.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workflow/core/types/registryTypes.ts
|
|
3
|
+
* Type definitions for workflow registry
|
|
4
|
+
*
|
|
5
|
+
* Re-exports from the central types folder for backward compatibility
|
|
6
|
+
*/
|
|
7
|
+
export type { RegistryEntry, RegisterOptions, RegisterResult, ListOptions, WorkflowMetadata, RegistryStats, } from "../../../types/workflowTypes.js";
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workflow/core/workflowRegistry.ts
|
|
3
|
+
* Registry for managing workflow configurations
|
|
4
|
+
*/
|
|
5
|
+
import type { WorkflowConfig } from "../types.js";
|
|
6
|
+
import type { ListOptions, RegisterOptions, RegisterResult, RegistryStats, WorkflowMetadata } from "./types/index.js";
|
|
7
|
+
/**
|
|
8
|
+
* Register a new workflow
|
|
9
|
+
* @param config - Workflow configuration to register
|
|
10
|
+
* @param options - Registration options
|
|
11
|
+
* @returns Registration result
|
|
12
|
+
*/
|
|
13
|
+
export declare function registerWorkflow(config: WorkflowConfig, options?: RegisterOptions): RegisterResult;
|
|
14
|
+
/**
|
|
15
|
+
* Unregister a workflow
|
|
16
|
+
* @param workflowId - ID of workflow to unregister
|
|
17
|
+
* @returns True if workflow was unregistered
|
|
18
|
+
*/
|
|
19
|
+
export declare function unregisterWorkflow(workflowId: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Get workflow configuration by ID
|
|
22
|
+
* @param workflowId - ID of workflow to retrieve
|
|
23
|
+
* @returns Workflow configuration or undefined
|
|
24
|
+
*/
|
|
25
|
+
export declare function getWorkflow(workflowId: string): WorkflowConfig | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Check if workflow exists
|
|
28
|
+
* @param workflowId - ID of workflow to check
|
|
29
|
+
* @returns True if workflow exists
|
|
30
|
+
*/
|
|
31
|
+
export declare function hasWorkflow(workflowId: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* List all registered workflows
|
|
34
|
+
* @param options - Listing options for filtering
|
|
35
|
+
* @returns Array of workflow configurations
|
|
36
|
+
*/
|
|
37
|
+
export declare function listWorkflows(options?: ListOptions): WorkflowConfig[];
|
|
38
|
+
/**
|
|
39
|
+
* Get workflow metadata (usage stats, timestamps)
|
|
40
|
+
* @param workflowId - ID of workflow
|
|
41
|
+
* @returns Metadata or undefined
|
|
42
|
+
*/
|
|
43
|
+
export declare function getWorkflowMetadata(workflowId: string): WorkflowMetadata | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Update workflow configuration
|
|
46
|
+
* @param workflowId - ID of workflow to update
|
|
47
|
+
* @param updates - Partial workflow config with updates
|
|
48
|
+
* @param options - Update options
|
|
49
|
+
* @returns Update result
|
|
50
|
+
*/
|
|
51
|
+
export declare function updateWorkflow(workflowId: string, updates: Partial<WorkflowConfig>, options?: RegisterOptions): RegisterResult;
|
|
52
|
+
/**
|
|
53
|
+
* Clear all workflows from registry
|
|
54
|
+
* WARNING: This will remove all registered workflows
|
|
55
|
+
*/
|
|
56
|
+
export declare function clearRegistry(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Get registry statistics
|
|
59
|
+
* @returns Statistics about registered workflows
|
|
60
|
+
*/
|
|
61
|
+
export declare function getRegistryStats(): RegistryStats;
|
|
62
|
+
/**
|
|
63
|
+
* Export registry as JSON for backup/sharing
|
|
64
|
+
* @returns JSON string of all workflows
|
|
65
|
+
*/
|
|
66
|
+
export declare function exportRegistry(): string;
|
|
67
|
+
/**
|
|
68
|
+
* Import workflows from JSON
|
|
69
|
+
* @param json - JSON string of workflow configs
|
|
70
|
+
* @param options - Import options
|
|
71
|
+
* @returns Array of registration results
|
|
72
|
+
*/
|
|
73
|
+
export declare function importRegistry(json: string, options?: RegisterOptions): RegisterResult[];
|