{"_id":"@ai-operations/ops-core","name":"@ai-operations/ops-core","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@ai-operations/ops-core","version":"0.1.0","description":"Pipeline engine for AI Operations OS — intent classification, state machine, LLM integration, structured logging","private":false,"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","test":"jest","clean":"rm -rf dist"},"dependencies":{"@ai-operations/shared-types":"*"},"devDependencies":{"typescript":"^5.7.0"},"repository":{"type":"git","url":"git+https://github.com/zanderone1980/ai-operations-os.git","directory":"packages/ops-core"},"bugs":{"url":"https://github.com/zanderone1980/ai-operations-os/issues"},"author":{"name":"Alex Pinkevich","email":"alex@zanderpinkdesign.com"},"license":"MIT","publishConfig":{"registry":"https://registry.npmjs.org","access":"public"},"keywords":["ai-ops","ai-agents","workflow","automation","safety"],"_id":"@ai-operations/ops-core@0.1.0","gitHead":"5479e60c372e0d4d5269e3fd1f87915563e9a87d","homepage":"https://github.com/zanderone1980/ai-operations-os#readme","_nodeVersion":"22.22.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-r8Bu6f1QXTtld5667mx1mw6iWtY58Wswpaj4V7xdp7oO5m9Ugm/Al8o/OzFxJHe1UCRBUduB4/Np9ryXAZLRrg==","shasum":"d30bf536c00ec7e563dc92d03a7ec0357ff952a7","tarball":"https://registry.npmjs.org/@ai-operations/ops-core/-/ops-core-0.1.0.tgz","fileCount":54,"unpackedSize":201709,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCEstPvoU7tIGO4EkMGQXLCnccYmOQLkLuo+h/rUEPzswIgGiVXitEBXiK91GrahngMGA6lHFek3JGQhrE5wDoOVWA="}]},"_npmUser":{"name":"alexpinkone","email":"pinkevich1980@gmail.com"},"directories":{},"maintainers":[{"name":"alexpinkone","email":"pinkevich1980@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ops-core_0.1.0_1773153566433_0.9257969967394402"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-10T14:39:26.324Z","0.1.0":"2026-03-10T14:39:26.586Z","modified":"2026-03-10T14:39:27.195Z"},"maintainers":[{"name":"alexpinkone","email":"pinkevich1980@gmail.com"}],"description":"Pipeline engine for AI Operations OS — intent classification, state machine, LLM integration, structured logging","homepage":"https://github.com/zanderone1980/ai-operations-os#readme","keywords":["ai-ops","ai-agents","workflow","automation","safety"],"repository":{"type":"git","url":"git+https://github.com/zanderone1980/ai-operations-os.git","directory":"packages/ops-core"},"author":{"name":"Alex Pinkevich","email":"alex@zanderpinkdesign.com"},"bugs":{"url":"https://github.com/zanderone1980/ai-operations-os/issues"},"license":"MIT","readme":"# @ai-operations/ops-core\n\n> Workflow engine, state machine, and intent classification for AI Operations OS.\n\nPart of [AI Operations OS](https://github.com/zanderone1980/ai-operations-os) — autonomous business workflow orchestration with safety enforcement.\n\n## Install\n\n```\nnpm install @ai-operations/ops-core\n```\n\n## Quick Start\n\n```ts\nimport { WorkflowEngine, IntentClassifier } from '@ai-operations/ops-core';\n\nconst classifier = new IntentClassifier();\nconst intent = classifier.classify('Please reply to John about the meeting');\n// => 'reply'\n\nconst engine = new WorkflowEngine(connectorRegistry, safetyGate);\nfor await (const event of engine.execute(workflowRun)) {\n  console.log(event.type, event);\n}\n```\n\n## API\n\n### `WorkflowEngine`\n\nSequential step executor with safety gates. Drives a WorkflowRun through its steps, yielding typed events via an AsyncGenerator.\n\n```ts\nconstructor(connectors: ConnectorRegistry, safetyGate: SafetyGate)\nasync *execute(run: WorkflowRun): AsyncGenerator<WorkflowEvent>\npause(): void\nresume(): void\n```\n\n**Event types:** `step_start | step_complete | step_blocked | step_failed | run_complete | run_failed`\n\n### `StateMachine`\n\nEnforces valid workflow step state transitions with O(1) lookup.\n\n```ts\nconst sm = new StateMachine();\nsm.transition('pending', 'start');           // => 'running'\nsm.canTransition('running', 'complete');     // => true\nsm.validEvents('blocked');                   // => ['approve']\n```\n\n**Step events:** `start | complete | fail | block | approve | pause | resume`\n\n### `IntentClassifier`\n\nKeyword-based heuristic intent classification. Fast, deterministic first pass.\n\n```ts\nconst classifier = new IntentClassifier();\nconst result = classifier.classifyDetailed('Please reply to John');\n// => { intent: 'reply', confidence: 'low', matchedKeywords: ['reply'] }\n```\n\n### `LLMIntentClassifier`\n\nLLM-backed classification with heuristic fallback. Supports Anthropic, OpenAI, and Ollama providers via environment variables.\n\n```ts\nconst llm = new LLMIntentClassifier();\nconst intent = await llm.classify('Can you handle the refund for order #123?');\n// => 'refund' (via LLM when heuristic confidence is low)\n```\n\n**Environment variables:** `OPS_LLM_PROVIDER`, `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `OLLAMA_URL`\n\n### `TaskStore`\n\nIn-memory + JSON file task persistence with filtering.\n\n### Interfaces\n\n- `Connector` — `{ name: string; execute(operation, input): Promise<Record<string, unknown>> }`\n- `ConnectorRegistry` — `{ get(name): Connector | undefined }`\n- `SafetyGate` — `(step, run) => Promise<SafetyGateResult>`\n- `SafetyGateResult` — `{ decision: CordDecision; score: number; reason: string }`\n\n## Related Packages\n\n- [`@ai-operations/shared-types`](../shared-types) — Task, WorkflowRun, and other core types\n- [`@ai-operations/ops-connectors`](../ops-connectors) — Connector implementations (Gmail, Calendar, X, Shopify)\n- [`@ai-operations/cord-adapter`](../cord-adapter) — CORD safety gate integration\n- [`@ai-operations/ops-policy`](../ops-policy) — Policy rules and autonomy management\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-69195e1aba87567b132b08bd48ace60d"}