@oni.bot/core 0.6.3 → 0.8.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.
Files changed (129) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/README.md +315 -200
  3. package/SECURITY.md +71 -0
  4. package/dist/checkpointers/sqlite.d.ts.map +1 -1
  5. package/dist/checkpointers/sqlite.js +20 -18
  6. package/dist/checkpointers/sqlite.js.map +1 -1
  7. package/dist/circuit-breaker.d.ts +20 -0
  8. package/dist/circuit-breaker.d.ts.map +1 -0
  9. package/dist/circuit-breaker.js +58 -0
  10. package/dist/circuit-breaker.js.map +1 -0
  11. package/dist/cli/index.d.ts +3 -0
  12. package/dist/cli/index.d.ts.map +1 -0
  13. package/dist/cli/index.js +32 -0
  14. package/dist/cli/index.js.map +1 -0
  15. package/dist/cli/init.d.ts +2 -0
  16. package/dist/cli/init.d.ts.map +1 -0
  17. package/dist/cli/init.js +17 -0
  18. package/dist/cli/init.js.map +1 -0
  19. package/dist/cli/templates.d.ts +8 -0
  20. package/dist/cli/templates.d.ts.map +1 -0
  21. package/dist/cli/templates.js +119 -0
  22. package/dist/cli/templates.js.map +1 -0
  23. package/dist/dlq.d.ts +17 -0
  24. package/dist/dlq.d.ts.map +1 -0
  25. package/dist/dlq.js +41 -0
  26. package/dist/dlq.js.map +1 -0
  27. package/dist/errors.d.ts +36 -1
  28. package/dist/errors.d.ts.map +1 -1
  29. package/dist/errors.js +163 -7
  30. package/dist/errors.js.map +1 -1
  31. package/dist/graph.d.ts +17 -0
  32. package/dist/graph.d.ts.map +1 -1
  33. package/dist/graph.js +13 -2
  34. package/dist/graph.js.map +1 -1
  35. package/dist/harness/agent-loop.d.ts +8 -0
  36. package/dist/harness/agent-loop.d.ts.map +1 -0
  37. package/dist/harness/agent-loop.js +327 -0
  38. package/dist/harness/agent-loop.js.map +1 -0
  39. package/dist/harness/context-compactor.d.ts +73 -0
  40. package/dist/harness/context-compactor.d.ts.map +1 -0
  41. package/dist/harness/context-compactor.js +162 -0
  42. package/dist/harness/context-compactor.js.map +1 -0
  43. package/dist/harness/harness.d.ts +41 -0
  44. package/dist/harness/harness.d.ts.map +1 -0
  45. package/dist/harness/harness.js +140 -0
  46. package/dist/harness/harness.js.map +1 -0
  47. package/dist/harness/hooks-engine.d.ts +71 -0
  48. package/dist/harness/hooks-engine.d.ts.map +1 -0
  49. package/dist/harness/hooks-engine.js +232 -0
  50. package/dist/harness/hooks-engine.js.map +1 -0
  51. package/dist/harness/index.d.ts +16 -0
  52. package/dist/harness/index.d.ts.map +1 -0
  53. package/dist/harness/index.js +19 -0
  54. package/dist/harness/index.js.map +1 -0
  55. package/dist/harness/safety-gate.d.ts +29 -0
  56. package/dist/harness/safety-gate.d.ts.map +1 -0
  57. package/dist/harness/safety-gate.js +72 -0
  58. package/dist/harness/safety-gate.js.map +1 -0
  59. package/dist/harness/skill-loader.d.ts +63 -0
  60. package/dist/harness/skill-loader.d.ts.map +1 -0
  61. package/dist/harness/skill-loader.js +214 -0
  62. package/dist/harness/skill-loader.js.map +1 -0
  63. package/dist/harness/todo-module.d.ts +39 -0
  64. package/dist/harness/todo-module.d.ts.map +1 -0
  65. package/dist/harness/todo-module.js +179 -0
  66. package/dist/harness/todo-module.js.map +1 -0
  67. package/dist/harness/types.d.ts +78 -0
  68. package/dist/harness/types.d.ts.map +1 -0
  69. package/dist/harness/types.js +9 -0
  70. package/dist/harness/types.js.map +1 -0
  71. package/dist/hitl/interrupt.d.ts.map +1 -1
  72. package/dist/hitl/interrupt.js +7 -6
  73. package/dist/hitl/interrupt.js.map +1 -1
  74. package/dist/index.d.ts +14 -3
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +12 -3
  77. package/dist/index.js.map +1 -1
  78. package/dist/models/google.d.ts.map +1 -1
  79. package/dist/models/google.js +7 -6
  80. package/dist/models/google.js.map +1 -1
  81. package/dist/models/index.d.ts +2 -0
  82. package/dist/models/index.d.ts.map +1 -1
  83. package/dist/models/index.js +1 -0
  84. package/dist/models/index.js.map +1 -1
  85. package/dist/models/openai.js +6 -1
  86. package/dist/models/openai.js.map +1 -1
  87. package/dist/models/openrouter.d.ts +13 -0
  88. package/dist/models/openrouter.d.ts.map +1 -0
  89. package/dist/models/openrouter.js +322 -0
  90. package/dist/models/openrouter.js.map +1 -0
  91. package/dist/prebuilt/tool-node.d.ts.map +1 -1
  92. package/dist/prebuilt/tool-node.js +0 -1
  93. package/dist/prebuilt/tool-node.js.map +1 -1
  94. package/dist/pregel.d.ts +11 -1
  95. package/dist/pregel.d.ts.map +1 -1
  96. package/dist/pregel.js +88 -7
  97. package/dist/pregel.js.map +1 -1
  98. package/dist/retry.d.ts.map +1 -1
  99. package/dist/retry.js +6 -1
  100. package/dist/retry.js.map +1 -1
  101. package/dist/store/index.d.ts +2 -0
  102. package/dist/store/index.d.ts.map +1 -1
  103. package/dist/store/index.js +7 -1
  104. package/dist/store/index.js.map +1 -1
  105. package/dist/stream-events.js +2 -2
  106. package/dist/stream-events.js.map +1 -1
  107. package/dist/streaming.d.ts +10 -0
  108. package/dist/streaming.d.ts.map +1 -1
  109. package/dist/streaming.js +28 -0
  110. package/dist/streaming.js.map +1 -1
  111. package/dist/swarm/graph.d.ts.map +1 -1
  112. package/dist/swarm/graph.js +0 -4
  113. package/dist/swarm/graph.js.map +1 -1
  114. package/dist/swarm/supervisor.d.ts.map +1 -1
  115. package/dist/swarm/supervisor.js +0 -4
  116. package/dist/swarm/supervisor.js.map +1 -1
  117. package/dist/telemetry.d.ts +41 -0
  118. package/dist/telemetry.d.ts.map +1 -0
  119. package/dist/telemetry.js +69 -0
  120. package/dist/telemetry.js.map +1 -0
  121. package/dist/testing/index.d.ts +33 -0
  122. package/dist/testing/index.d.ts.map +1 -0
  123. package/dist/testing/index.js +95 -0
  124. package/dist/testing/index.js.map +1 -0
  125. package/dist/types.d.ts +9 -0
  126. package/dist/types.d.ts.map +1 -1
  127. package/dist/types.js +1 -1
  128. package/dist/types.js.map +1 -1
  129. package/package.json +38 -5
package/CHANGELOG.md ADDED
@@ -0,0 +1,111 @@
1
+ # Changelog
2
+
3
+ All notable changes to @oni.bot/core are documented here.
4
+
5
+ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
+ This project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.7.0] - 2026-03-08
9
+
10
+ ### Added
11
+ - Structured error codes with `ONI_<CATEGORY>_<NAME>` taxonomy — every error carries code, category, recoverable flag, suggestion, and context
12
+ - Per-node timeouts via `addNode(name, fn, { timeout: ms })` with `NodeTimeoutError`
13
+ - Global default timeout via `compile({ defaults: { nodeTimeout: ms } })`
14
+ - Circuit breaker pattern: `addNode(name, fn, { circuitBreaker: { threshold, resetAfter, fallback? } })`
15
+ - Dead letter queue: `compile({ deadLetterQueue: true })` captures failed node inputs for recovery
16
+ - OpenTelemetry tracing adapter (`ONITracer`) — zero-dep, user brings own tracer
17
+ - Backpressure streaming with `BoundedBuffer` (drop-oldest and error strategies)
18
+ - Testing utilities: `mockModel()`, `assertGraph()`, `createTestHarness()` via `@oni.bot/core/testing`
19
+ - `oni init` CLI command for project scaffolding
20
+ - 7 new error types: `NodeTimeoutError`, `CircuitBreakerOpenError`, `SwarmDeadlockError`, `ModelRateLimitError`, `ModelContextLengthError`, `CheckpointCorruptError`, `StoreKeyNotFoundError`
21
+
22
+ ### Changed
23
+ - `ONIError` now accepts optional `ONIErrorOptions` as second constructor parameter
24
+ - All existing error classes enhanced with structured codes (backward compatible)
25
+
26
+ ## [0.6.3] - 2026-03-05
27
+
28
+ ### Added
29
+ - `set()` alias for `put()` on `InMemoryStore` and `NamespacedStore`
30
+
31
+ ## [0.6.2] - 2026-03-05
32
+
33
+ ### Fixed
34
+ - `createReactAgent` now accepts `ONIModel` (auto-adapts chat to invoke)
35
+
36
+ ### Changed
37
+ - Package renamed from `@oni-bot/core` to `@oni.bot/core`
38
+
39
+ ## [0.6.1] - 2026-03-05
40
+
41
+ ### Changed
42
+ - Removed all external framework references from codebase and documentation
43
+
44
+ ### Fixed
45
+ - Resolved TypeScript strict errors in swarm template `Send` casts
46
+
47
+ ## [0.6.0] - 2026-03-04
48
+
49
+ ### Added
50
+ - `SwarmGraph` builder for multi-agent orchestration
51
+ - `SwarmGraph.hierarchical()` template — supervisor-workers pattern
52
+ - `SwarmGraph.fanOut()` template — parallel agent execution with reducer
53
+ - `SwarmGraph.pipeline()` template — linear chain with conditional transitions
54
+ - `SwarmGraph.peerNetwork()` template — decentralized agent handoffs
55
+ - `SwarmGraph.mapReduce()` template — parallel map with reducer
56
+ - `SwarmGraph.debate()` template — multi-round parallel debate with judge
57
+ - `SwarmGraph.hierarchicalMesh()` template — nested team coordination
58
+ - Lazy coordination auto-wiring (broker and pubsub) on `SwarmGraph`
59
+ - Handoff execution — agent `Handoff` returns converted to `Command` routing
60
+ - Retry-then-fallback — agents retry on failure, fall back to supervisor
61
+
62
+ ### Changed
63
+ - Replaced `SwarmLLM` with `ONIModel` in supervisor routing
64
+
65
+ ## [0.5.0] - 2026-03-04
66
+
67
+ ### Added
68
+ - `ONIModel` interface and core LLM types
69
+ - Anthropic LLM adapter
70
+ - OpenAI LLM adapter
71
+ - Ollama LLM adapter
72
+ - Google Gemini LLM adapter
73
+ - Models export path and re-exports
74
+ - Tool framework with `defineTool()` and `ToolContext`
75
+ - `AgentContext` and agent types
76
+ - `defineAgent()` declarative agent factory
77
+ - `agent()` functional agent factory
78
+ - `addAgent()` on `StateGraph` to wire agent nodes
79
+ - Request/response and pub/sub coordination patterns
80
+ - Tool permission guardrails
81
+ - Budget tracking and cost control guardrails
82
+ - Content filtering guardrails
83
+ - Audit trail and guardrails exports
84
+ - `EventBus` for structured lifecycle events
85
+ - Guardrails and event bus wired into compile/execution pipeline
86
+ - Integration tests for agents, tools, and guardrails
87
+
88
+ ### Removed
89
+ - Direct `openai` dependency (adapters are now bring-your-own-client)
90
+
91
+ ## [0.4.0] - 2026-03-04
92
+
93
+ ### Added
94
+ - `StateGraph` builder with `addNode()`, `addEdge()`, `addConditionalEdges()`
95
+ - Pregel execution engine (`ONIPregelRunner`) with parallel superstep execution
96
+ - `Command` and `Send` primitives for dynamic routing
97
+ - Subgraph support via `addSubgraph()`
98
+ - Functional API (`entrypoint`, `task`)
99
+ - `MemoryCheckpointer` and `NoopCheckpointer`
100
+ - `InMemoryStore` and `NamespacedStore` for shared key-value state
101
+ - Human-in-the-loop via `interrupt()` and `getUserInput()`
102
+ - Token streaming with `emitToken()` and `TokenStreamWriter`
103
+ - Stream modes: `values`, `updates`, `events`, `messages`, `custom`
104
+ - Graph inspection via `getGraphDef()`
105
+ - `createReactAgent` prebuilt for tool-calling loops
106
+ - `ToolNode` prebuilt for automatic tool dispatch
107
+ - Messages reducer (`messagesReducer`, `addMessages`, `removeMessages`)
108
+ - Retry policies with configurable backoff
109
+ - Swarm primitives: `AgentRegistry`, `AgentPool`, `Mailbox`, `Supervisor`
110
+ - Ephemeral channel support
111
+ - Map-reduce parallel fan-out pattern