Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
workflow-function-manifold
Advanced tools
for building dynamic, LLM-driven workflows using a region-based execution model
A TypeScript/JavaScript library for building dynamic, LLM-driven workflows using a region-based execution model.
workflow-function-manifold
is a powerful library for creating dynamic, LLM-driven workflows that leverage a region-based execution model. It enables seamless navigation between different execution regions based on natural language prompts and maintains consistent workflow state throughout the execution process.
npx workflow-function-manifold
npm install workflow-function-manifold
Or using Bun:
bun add workflow-function-manifold
import {
WorkflowFunctionManifold,
ManifoldRegion,
WorkflowOperator,
DummyIntentMap,
} from 'workflow-function-manifold';
// Create a new manifold instance
const intentService = new DummyIntentMap();
const manifold = new WorkflowFunctionManifold(intentService);
// Define operators
const analysisOperator = new WorkflowOperator('analysis', async state => ({
...state,
analyzed: true,
}));
// Create regions
const analysisRegion = new ManifoldRegion('analysis', [analysisOperator]);
manifold.addRegion(analysisRegion);
// Execute workflow
await manifold.navigate('analyze the data');
await manifold.executeWorkflow('analyze the data');
The main orchestrator that manages workflow execution and region navigation.
const manifold = new WorkflowFunctionManifold(intentService);
manifold.addRegion(region);
await manifold.navigate(prompt);
await manifold.executeWorkflow(prompt);
Represents a discrete workflow area containing operators and connections to other regions.
const region = new ManifoldRegion('regionName', [operator1, operator2]);
region.connectTo(otherRegion);
region.addOperator(newOperator);
Defines executable operations within regions.
const operator = new WorkflowOperator('operatorName', async state => {
return { ...state, processed: true };
});
Enables hierarchical workflow structures by embedding one manifold within another.
const nestedManifold = new WorkflowFunctionManifold(intentService);
const nestedRegion = new NestedManifoldRegion('preprocessing', nestedManifold);
Here's a comprehensive example demonstrating nested workflows:
import {
WorkflowFunctionManifold,
ManifoldRegion,
WorkflowOperator,
NestedManifoldRegion,
DummyIntentMap,
} from 'workflow-function-manifold';
async function createWorkflow() {
// Create nested workflow for preprocessing
const nestedIntentService = new DummyIntentMap();
const nestedManifold = new WorkflowFunctionManifold(nestedIntentService);
const validateOp = new WorkflowOperator('validation', async state => ({
...state,
validated: true,
}));
const cleanOp = new WorkflowOperator('cleaning', async state => ({
...state,
cleaned: true,
}));
const validateRegion = new ManifoldRegion('validation', [validateOp]);
const cleanRegion = new ManifoldRegion('cleaning', [cleanOp]);
validateRegion.connectTo(cleanRegion);
nestedManifold.addRegion(validateRegion);
nestedManifold.addRegion(cleanRegion);
// Create main workflow
const mainIntentService = new DummyIntentMap();
const mainManifold = new WorkflowFunctionManifold(mainIntentService);
const nestedPreprocessRegion = new NestedManifoldRegion('preprocessing', nestedManifold);
const analysisRegion = new ManifoldRegion('analysis', [
new WorkflowOperator('analysis', async state => ({
...state,
analyzed: true,
})),
]);
nestedPreprocessRegion.connectTo(analysisRegion);
mainManifold.addRegion(nestedPreprocessRegion);
mainManifold.addRegion(analysisRegion);
return mainManifold;
}
// Execute workflow
const manifold = await createWorkflow();
const prompts = [
'validate the input',
'clean the data',
'analyze the results',
];
for (const prompt of prompts) {
await manifold.navigate(prompt);
await manifold.executeWorkflow(prompt);
}
The library maintains workflow state across operations and regions. Each operator can access and modify the state:
const operator = new WorkflowOperator('example', async state => {
// Access existing state
const currentValue = state.someValue;
// Return modified state
return {
...state,
newValue: 'updated',
processed: true,
};
});
The library includes built-in error handling for:
git checkout -b feature/my-feature
git commit -m 'Add my feature'
git push origin feature/my-feature
MIT © 2024 Geoff Seemueller
# Install dependencies
bun install
# Run development mode
bun dev
# Build for production
bun run build
# Fix formatting and lint issues
bun run fix
FAQs
for building dynamic, LLM-driven workflows using a region-based execution model
The npm package workflow-function-manifold receives a total of 151 weekly downloads. As such, workflow-function-manifold popularity was classified as not popular.
We found that workflow-function-manifold demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.