
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@defai.digital/algorithms
Advanced tools
Performance-critical algorithms for AutomatosX.
pnpm add @ax/algorithms
This package contains optimized algorithms implemented in ReScript with TypeScript bindings:
Select the best provider based on multiple factors:
import { selectProvider, calculateProviderScore } from '@ax/algorithms';
const result = selectProvider(providers, context);
console.log(result.provider); // Selected provider
console.log(result.score); // Selection score
console.log(result.alternatives); // Fallback options
// Scoring factors:
// - Provider health status
// - Recent latency
// - Success rate
// - Priority configuration
Schedule tasks with dependencies:
import {
createDAG,
addTask,
addDependency,
getExecutionOrder,
getParallelGroups,
getCriticalPath,
detectCycles,
} from '@ax/algorithms';
// Create task graph
const dag = createDAG();
addTask(dag, 'setup', { name: 'Setup environment' });
addTask(dag, 'build', { name: 'Build project' });
addTask(dag, 'test', { name: 'Run tests' });
addDependency(dag, 'build', 'setup');
addDependency(dag, 'test', 'build');
// Get execution order (topological sort)
const order = getExecutionOrder(dag);
// ['setup', 'build', 'test']
// Get parallel execution groups
const groups = getParallelGroups(dag);
// [['setup'], ['build'], ['test']]
// Find critical path
const critical = getCriticalPath(dag);
// Detect cycles (returns null if valid)
const cycle = detectCycles(dag);
Rank memory entries by relevance:
import { rankMemories, calculateRelevanceScore } from '@ax/algorithms';
const ranked = rankMemories(entries, {
query: 'authentication API',
recencyWeight: 0.3,
frequencyWeight: 0.2,
typeBonus: { code: 1.2, decision: 1.1 },
tagBonus: { important: 1.5 },
});
// Each result includes:
// - entry: The memory entry
// - score: Combined relevance score
// - components: Individual score breakdown
| Factor | Weight | Description |
|---|---|---|
| Health | 0.4 | Provider availability |
| Latency | 0.3 | Recent response times |
| Success | 0.2 | Historical success rate |
| Priority | 0.1 | Configuration priority |
| Factor | Weight | Description |
|---|---|---|
| FTS Score | 0.4 | Full-text search match |
| Recency | 0.3 | Time decay factor |
| Frequency | 0.2 | Access count |
| Type/Tag | 0.1 | Bonus multipliers |
The core algorithms are implemented in ReScript for performance:
packages/algorithms/
├── src/
│ ├── Routing.res # Provider selection
│ ├── DagScheduler.res # DAG operations
│ └── MemoryRank.res # Relevance ranking
└── bindings/
├── routing.ts # TypeScript bindings
├── dag.ts # TypeScript bindings
└── ranking.ts # TypeScript bindings
Apache-2.0
FAQs
Performance-critical algorithms for AutomatosX (ReScript)
We found that @defai.digital/algorithms demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.