aida-sdk
v1.0.5
Published
AIDA — AI DevOps Incident Intelligence SDK. Auto-captures logs and errors, triggers AI-powered incident analysis.
Maintainers
Readme
aida
AI DevOps Incident Intelligence SDK for Node.js / TypeScript. Auto-captures console output and errors — triggers AI-powered incident analysis.
Install
npm install aida
# or
yarn add aidaQuick Start
import aida from 'aida';
aida.init({
apiKey: 'sk-...', // from GET /api/v1/sdk/keys
projectId: 'owner/my-repo', // your GitHub repo full name
repoName: 'owner/my-repo',
baseUrl: 'https://your-aida-backend.com',
environment: 'production',
service: 'my-api',
});
// ✅ After this line — ALL console output is auto-captured.
// ✅ uncaughtException and unhandledRejection are auto-captured.
// ✅ Error-level entries trigger the 4-agent AI incident pipeline.
console.log('Server started on port 3000'); // → captured as info log
console.error('Database connection failed'); // → captured as error, triggers AI analysis
throw new Error('Something broke'); // → captured with stack traceCommonJS
const aida = require('aida');
aida.init({ apiKey: '...', projectId: '...', repoName: '...', baseUrl: '...' });What Gets Captured Automatically
| Source | Level |
|---|---|
| console.log() | info |
| console.info() | info |
| console.warn() | warn |
| console.error() | error |
| process.uncaughtException | error (with stack trace) |
| process.unhandledRejection | error |
Manual Logging (Optional)
aida.error('Payment timeout', { gateway: 'stripe', latency_ms: 5000 });
aida.info('User signed up', { user_id: '123' });Configuration
| Option | Default | Description |
|---|---|---|
| apiKey | required | Bearer token from /api/v1/sdk/keys |
| projectId | required | Repo full name for linking logs to incidents |
| repoName | required | Same as projectId |
| baseUrl | required | Backend URL |
| environment | "production" | Environment tag |
| service | "app" | Service name |
| batchSize | 20 | Logs per HTTP request |
| flushIntervalMs | 2000 | Milliseconds between flushes |
| interceptConsole | true | Auto-capture console methods |
| interceptExceptions | true | Auto-capture uncaughtException |
| interceptRejections | true | Auto-capture unhandledRejection |
Build & Publish
CI publish (GitHub Actions):
- Tag the repo with
node-sdk-v*or runworkflow_dispatch. - Required secret:
NPM_TOKEN.
cd node-sdk
npm install
npm run build
npm publish