@beingmartinbmc/ojas 0.2.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 (174) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +308 -0
  3. package/dist/aahar/index.d.ts +179 -0
  4. package/dist/aahar/index.d.ts.map +1 -0
  5. package/dist/aahar/index.js +657 -0
  6. package/dist/aahar/index.js.map +1 -0
  7. package/dist/aahar/scoring.d.ts +85 -0
  8. package/dist/aahar/scoring.d.ts.map +1 -0
  9. package/dist/aahar/scoring.js +268 -0
  10. package/dist/aahar/scoring.js.map +1 -0
  11. package/dist/agni/index.d.ts +113 -0
  12. package/dist/agni/index.d.ts.map +1 -0
  13. package/dist/agni/index.js +328 -0
  14. package/dist/agni/index.js.map +1 -0
  15. package/dist/agni/model-router.d.ts +77 -0
  16. package/dist/agni/model-router.d.ts.map +1 -0
  17. package/dist/agni/model-router.js +163 -0
  18. package/dist/agni/model-router.js.map +1 -0
  19. package/dist/agni/response-distiller.d.ts +37 -0
  20. package/dist/agni/response-distiller.d.ts.map +1 -0
  21. package/dist/agni/response-distiller.js +193 -0
  22. package/dist/agni/response-distiller.js.map +1 -0
  23. package/dist/agni/tiktoken-adapter.d.ts +55 -0
  24. package/dist/agni/tiktoken-adapter.d.ts.map +1 -0
  25. package/dist/agni/tiktoken-adapter.js +113 -0
  26. package/dist/agni/tiktoken-adapter.js.map +1 -0
  27. package/dist/chikitsa/index.d.ts +130 -0
  28. package/dist/chikitsa/index.d.ts.map +1 -0
  29. package/dist/chikitsa/index.js +565 -0
  30. package/dist/chikitsa/index.js.map +1 -0
  31. package/dist/demo.d.ts +15 -0
  32. package/dist/demo.d.ts.map +1 -0
  33. package/dist/demo.js +278 -0
  34. package/dist/demo.js.map +1 -0
  35. package/dist/index.d.ts +201 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +588 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/mcp/audit.d.ts +39 -0
  40. package/dist/mcp/audit.d.ts.map +1 -0
  41. package/dist/mcp/audit.js +73 -0
  42. package/dist/mcp/audit.js.map +1 -0
  43. package/dist/mcp/contracts.d.ts +76 -0
  44. package/dist/mcp/contracts.d.ts.map +1 -0
  45. package/dist/mcp/contracts.js +44 -0
  46. package/dist/mcp/contracts.js.map +1 -0
  47. package/dist/mcp/envelope.d.ts +107 -0
  48. package/dist/mcp/envelope.d.ts.map +1 -0
  49. package/dist/mcp/envelope.js +162 -0
  50. package/dist/mcp/envelope.js.map +1 -0
  51. package/dist/mcp/registry.d.ts +110 -0
  52. package/dist/mcp/registry.d.ts.map +1 -0
  53. package/dist/mcp/registry.js +258 -0
  54. package/dist/mcp/registry.js.map +1 -0
  55. package/dist/mcp/server.d.ts +26 -0
  56. package/dist/mcp/server.d.ts.map +1 -0
  57. package/dist/mcp/server.js +107 -0
  58. package/dist/mcp/server.js.map +1 -0
  59. package/dist/mcp/tools/agent.d.ts +4 -0
  60. package/dist/mcp/tools/agent.d.ts.map +1 -0
  61. package/dist/mcp/tools/agent.js +300 -0
  62. package/dist/mcp/tools/agent.js.map +1 -0
  63. package/dist/mcp/tools/context.d.ts +4 -0
  64. package/dist/mcp/tools/context.d.ts.map +1 -0
  65. package/dist/mcp/tools/context.js +261 -0
  66. package/dist/mcp/tools/context.js.map +1 -0
  67. package/dist/mcp/tools/index.d.ts +5 -0
  68. package/dist/mcp/tools/index.d.ts.map +1 -0
  69. package/dist/mcp/tools/index.js +20 -0
  70. package/dist/mcp/tools/index.js.map +1 -0
  71. package/dist/mcp/tools/memory.d.ts +4 -0
  72. package/dist/mcp/tools/memory.d.ts.map +1 -0
  73. package/dist/mcp/tools/memory.js +220 -0
  74. package/dist/mcp/tools/memory.js.map +1 -0
  75. package/dist/mcp/tools/output.d.ts +4 -0
  76. package/dist/mcp/tools/output.d.ts.map +1 -0
  77. package/dist/mcp/tools/output.js +206 -0
  78. package/dist/mcp/tools/output.js.map +1 -0
  79. package/dist/mcp/tools/recovery.d.ts +4 -0
  80. package/dist/mcp/tools/recovery.d.ts.map +1 -0
  81. package/dist/mcp/tools/recovery.js +165 -0
  82. package/dist/mcp/tools/recovery.js.map +1 -0
  83. package/dist/mcp/tools/registrar.d.ts +4 -0
  84. package/dist/mcp/tools/registrar.d.ts.map +1 -0
  85. package/dist/mcp/tools/registrar.js +17 -0
  86. package/dist/mcp/tools/registrar.js.map +1 -0
  87. package/dist/mcp/tools/report.d.ts +4 -0
  88. package/dist/mcp/tools/report.d.ts.map +1 -0
  89. package/dist/mcp/tools/report.js +68 -0
  90. package/dist/mcp/tools/report.js.map +1 -0
  91. package/dist/mcp/tools/shared.d.ts +37 -0
  92. package/dist/mcp/tools/shared.d.ts.map +1 -0
  93. package/dist/mcp/tools/shared.js +214 -0
  94. package/dist/mcp/tools/shared.js.map +1 -0
  95. package/dist/mcp/trace.d.ts +47 -0
  96. package/dist/mcp/trace.d.ts.map +1 -0
  97. package/dist/mcp/trace.js +216 -0
  98. package/dist/mcp/trace.js.map +1 -0
  99. package/dist/nidra/index.d.ts +275 -0
  100. package/dist/nidra/index.d.ts.map +1 -0
  101. package/dist/nidra/index.js +889 -0
  102. package/dist/nidra/index.js.map +1 -0
  103. package/dist/persistence/migrations.d.ts +10 -0
  104. package/dist/persistence/migrations.d.ts.map +1 -0
  105. package/dist/persistence/migrations.js +77 -0
  106. package/dist/persistence/migrations.js.map +1 -0
  107. package/dist/persistence/sqlite.d.ts +30 -0
  108. package/dist/persistence/sqlite.d.ts.map +1 -0
  109. package/dist/persistence/sqlite.js +209 -0
  110. package/dist/persistence/sqlite.js.map +1 -0
  111. package/dist/persistence/types.d.ts +104 -0
  112. package/dist/persistence/types.d.ts.map +1 -0
  113. package/dist/persistence/types.js +5 -0
  114. package/dist/persistence/types.js.map +1 -0
  115. package/dist/pulse/index.d.ts +144 -0
  116. package/dist/pulse/index.d.ts.map +1 -0
  117. package/dist/pulse/index.js +453 -0
  118. package/dist/pulse/index.js.map +1 -0
  119. package/dist/raksha/classifiers/http-classifier.d.ts +26 -0
  120. package/dist/raksha/classifiers/http-classifier.d.ts.map +1 -0
  121. package/dist/raksha/classifiers/http-classifier.js +62 -0
  122. package/dist/raksha/classifiers/http-classifier.js.map +1 -0
  123. package/dist/raksha/classifiers/index.d.ts +5 -0
  124. package/dist/raksha/classifiers/index.d.ts.map +1 -0
  125. package/dist/raksha/classifiers/index.js +8 -0
  126. package/dist/raksha/classifiers/index.js.map +1 -0
  127. package/dist/raksha/classifiers/onnx-classifier.d.ts +41 -0
  128. package/dist/raksha/classifiers/onnx-classifier.d.ts.map +1 -0
  129. package/dist/raksha/classifiers/onnx-classifier.js +99 -0
  130. package/dist/raksha/classifiers/onnx-classifier.js.map +1 -0
  131. package/dist/raksha/hallucination-detectors.d.ts +106 -0
  132. package/dist/raksha/hallucination-detectors.d.ts.map +1 -0
  133. package/dist/raksha/hallucination-detectors.js +327 -0
  134. package/dist/raksha/hallucination-detectors.js.map +1 -0
  135. package/dist/raksha/index.d.ts +168 -0
  136. package/dist/raksha/index.d.ts.map +1 -0
  137. package/dist/raksha/index.js +597 -0
  138. package/dist/raksha/index.js.map +1 -0
  139. package/dist/raksha/prompt-injection-detectors.d.ts +30 -0
  140. package/dist/raksha/prompt-injection-detectors.d.ts.map +1 -0
  141. package/dist/raksha/prompt-injection-detectors.js +153 -0
  142. package/dist/raksha/prompt-injection-detectors.js.map +1 -0
  143. package/dist/types.d.ts +1115 -0
  144. package/dist/types.d.ts.map +1 -0
  145. package/dist/types.js +71 -0
  146. package/dist/types.js.map +1 -0
  147. package/dist/util/calibration.d.ts +32 -0
  148. package/dist/util/calibration.d.ts.map +1 -0
  149. package/dist/util/calibration.js +108 -0
  150. package/dist/util/calibration.js.map +1 -0
  151. package/dist/util/id.d.ts +2 -0
  152. package/dist/util/id.d.ts.map +1 -0
  153. package/dist/util/id.js +9 -0
  154. package/dist/util/id.js.map +1 -0
  155. package/dist/vyayam/index.d.ts +76 -0
  156. package/dist/vyayam/index.d.ts.map +1 -0
  157. package/dist/vyayam/index.js +528 -0
  158. package/dist/vyayam/index.js.map +1 -0
  159. package/dist/vyayam/tool-fault-proxy.d.ts +95 -0
  160. package/dist/vyayam/tool-fault-proxy.d.ts.map +1 -0
  161. package/dist/vyayam/tool-fault-proxy.js +170 -0
  162. package/dist/vyayam/tool-fault-proxy.js.map +1 -0
  163. package/docs/ARCHITECTURE.md +162 -0
  164. package/docs/BACKLOG.md +342 -0
  165. package/docs/CONFIGURATION.md +305 -0
  166. package/docs/EVIDENCE.md +232 -0
  167. package/docs/EVIDENCE_MATRIX.md +293 -0
  168. package/docs/KNOWN_FAILURES.md +367 -0
  169. package/docs/MCP.md +614 -0
  170. package/docs/MODULES.md +368 -0
  171. package/docs/SECURITY.md +251 -0
  172. package/docs/TRUST.md +88 -0
  173. package/docs/assets/ojas-hero.png +0 -0
  174. package/package.json +101 -0
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+ /**
3
+ * Rich trace event taxonomy for the Ojas MCP `ojas_ingest_trace` tool.
4
+ *
5
+ * The on-disk Ojas runtime uses a single `ExecutionTrace` shape, but the
6
+ * MCP boundary accepts a richer event vocabulary so that agents can stream
7
+ * tool calls, retrievals, memory ops, fallbacks, and policy violations
8
+ * without flattening everything into a single action label.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.classifyEvent = classifyEvent;
12
+ exports.recommendActionFor = recommendActionFor;
13
+ function readNonNegInt(data, key) {
14
+ const v = data[key];
15
+ if (typeof v === 'number' && Number.isFinite(v) && v >= 0 && Number.isInteger(v))
16
+ return v;
17
+ return undefined;
18
+ }
19
+ function extractTokenFields(data) {
20
+ const inputTokens = readNonNegInt(data, 'input_tokens') ?? readNonNegInt(data, 'prompt_tokens');
21
+ const outputTokens = readNonNegInt(data, 'output_tokens') ?? readNonNegInt(data, 'completion_tokens');
22
+ let tokensUsed = readNonNegInt(data, 'total_tokens') ?? readNonNegInt(data, 'tokens_used');
23
+ if (tokensUsed === undefined && (inputTokens !== undefined || outputTokens !== undefined)) {
24
+ tokensUsed = (inputTokens ?? 0) + (outputTokens ?? 0);
25
+ }
26
+ const toolCalls = readNonNegInt(data, 'tool_calls');
27
+ const cost = data.cost_usd;
28
+ const costUsd = typeof cost === 'number' && Number.isFinite(cost) && cost >= 0 ? cost : undefined;
29
+ return {
30
+ tokens_used: tokensUsed,
31
+ input_tokens: inputTokens,
32
+ output_tokens: outputTokens,
33
+ tool_calls: toolCalls,
34
+ cost_usd: costUsd,
35
+ };
36
+ }
37
+ /**
38
+ * Map a `TraceEventType` + arbitrary payload to the canonical Ojas
39
+ * `ExecutionTrace` shape plus a set of modules whose state is touched.
40
+ */
41
+ function classifyEvent(eventType, data = {}) {
42
+ const toolName = typeof data.tool_name === 'string' ? data.tool_name : null;
43
+ const errorType = typeof data.error_type === 'string' ? data.error_type : null;
44
+ const latencyMs = typeof data.latency_ms === 'number' ? data.latency_ms : null;
45
+ switch (eventType) {
46
+ case 'tool_call_started':
47
+ return {
48
+ meta: { action: toolName ?? 'tool_call', success: true, duration_ms: 0 },
49
+ affected_modules: ['agni'],
50
+ health_impact: false,
51
+ };
52
+ case 'tool_call_succeeded':
53
+ return {
54
+ meta: {
55
+ action: toolName ?? 'tool_call',
56
+ success: true,
57
+ duration_ms: latencyMs ?? 0,
58
+ ...extractTokenFields(data),
59
+ },
60
+ affected_modules: ['agni', 'pulse'],
61
+ health_impact: false,
62
+ };
63
+ case 'tool_call_failed':
64
+ return {
65
+ meta: {
66
+ action: toolName ?? 'tool_call',
67
+ success: false,
68
+ duration_ms: latencyMs ?? 0,
69
+ error: errorType ?? 'unknown_failure',
70
+ ...extractTokenFields(data),
71
+ },
72
+ affected_modules: ['agni', 'pulse', 'chikitsa'],
73
+ health_impact: true,
74
+ };
75
+ case 'retrieval_result':
76
+ return {
77
+ meta: { action: 'retrieval', success: true, duration_ms: latencyMs ?? 0 },
78
+ affected_modules: ['aahar', 'pulse'],
79
+ health_impact: false,
80
+ };
81
+ case 'memory_read':
82
+ return {
83
+ meta: { action: 'memory_read', success: true, duration_ms: 0 },
84
+ affected_modules: ['nidra'],
85
+ health_impact: false,
86
+ };
87
+ case 'memory_write':
88
+ return {
89
+ meta: { action: 'memory_write', success: true, duration_ms: 0 },
90
+ affected_modules: ['nidra', 'raksha'],
91
+ health_impact: false,
92
+ };
93
+ case 'failure':
94
+ return {
95
+ meta: {
96
+ action: 'failure',
97
+ success: false,
98
+ duration_ms: 0,
99
+ error: typeof data.message === 'string' ? data.message : 'unknown_failure',
100
+ ...extractTokenFields(data),
101
+ },
102
+ affected_modules: ['chikitsa', 'pulse'],
103
+ health_impact: true,
104
+ };
105
+ case 'latency_measurement':
106
+ return {
107
+ meta: { action: 'latency', success: true, duration_ms: latencyMs ?? 0 },
108
+ affected_modules: ['agni', 'pulse'],
109
+ health_impact: false,
110
+ };
111
+ case 'token_usage':
112
+ return {
113
+ meta: {
114
+ action: 'token_usage',
115
+ success: true,
116
+ duration_ms: 0,
117
+ ...extractTokenFields(data),
118
+ },
119
+ affected_modules: ['agni'],
120
+ health_impact: false,
121
+ };
122
+ case 'user_correction':
123
+ return {
124
+ meta: { action: 'user_correction', success: false, duration_ms: 0 },
125
+ affected_modules: ['nidra', 'pulse'],
126
+ health_impact: true,
127
+ };
128
+ case 'planning_loop':
129
+ return {
130
+ meta: {
131
+ action: 'planning_loop',
132
+ success: false,
133
+ duration_ms: 0,
134
+ error: 'planning_loop_detected',
135
+ },
136
+ affected_modules: ['nidra', 'chikitsa', 'pulse'],
137
+ health_impact: true,
138
+ };
139
+ case 'fallback':
140
+ return {
141
+ meta: { action: 'fallback', success: true, duration_ms: 0 },
142
+ affected_modules: ['chikitsa', 'pulse'],
143
+ health_impact: false,
144
+ };
145
+ case 'policy_violation':
146
+ return {
147
+ meta: {
148
+ action: 'policy_violation',
149
+ success: false,
150
+ duration_ms: 0,
151
+ error: typeof data.message === 'string' ? data.message : 'policy_violation',
152
+ },
153
+ affected_modules: ['raksha', 'chikitsa', 'pulse'],
154
+ health_impact: true,
155
+ };
156
+ case 'prompt_injection_detected':
157
+ return {
158
+ meta: {
159
+ action: 'prompt_injection_detected',
160
+ success: false,
161
+ duration_ms: 0,
162
+ error: 'prompt_injection',
163
+ },
164
+ affected_modules: ['raksha', 'pulse'],
165
+ health_impact: true,
166
+ };
167
+ case 'context_overload_detected':
168
+ return {
169
+ meta: {
170
+ action: 'context_overload_detected',
171
+ success: false,
172
+ duration_ms: 0,
173
+ error: 'context_overload',
174
+ },
175
+ affected_modules: ['aahar', 'pulse'],
176
+ health_impact: true,
177
+ };
178
+ case 'agent_input':
179
+ case 'agent_output':
180
+ default:
181
+ return {
182
+ meta: {
183
+ action: eventType,
184
+ success: true,
185
+ duration_ms: latencyMs ?? 0,
186
+ ...extractTokenFields(data),
187
+ },
188
+ affected_modules: ['pulse'],
189
+ health_impact: false,
190
+ };
191
+ }
192
+ }
193
+ /**
194
+ * Recommend a follow-up Ojas action keyed off the event type. Returned
195
+ * verbatim in `ojas_ingest_trace`'s response.
196
+ */
197
+ function recommendActionFor(eventType) {
198
+ switch (eventType) {
199
+ case 'tool_call_failed':
200
+ return 'diagnose_tool_failure';
201
+ case 'failure':
202
+ case 'planning_loop':
203
+ return 'diagnose_failure';
204
+ case 'prompt_injection_detected':
205
+ return 'quarantine_and_scan_remaining_inputs';
206
+ case 'context_overload_detected':
207
+ return 'compress_context';
208
+ case 'user_correction':
209
+ return 'consolidate_memory_with_failure_reflection';
210
+ case 'policy_violation':
211
+ return 'enter_safe_mode';
212
+ default:
213
+ return undefined;
214
+ }
215
+ }
216
+ //# sourceMappingURL=trace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace.js","sourceRoot":"","sources":["../../src/mcp/trace.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AA8EH,sCA0KC;AAMD,gDAkBC;AAlOD,SAAS,aAAa,CAAC,IAA6B,EAAE,GAAW;IAC/D,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC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AK,2BAA2B;YAC9B,OAAO,sCAAsC,CAAC;QAChD,KAAK,2BAA2B;YAC9B,OAAO,kBAAkB,CAAC;QAC5B,KAAK,iBAAiB;YACpB,OAAO,4CAA4C,CAAC;QACtD,KAAK,kBAAkB;YACrB,OAAO,iBAAiB,CAAC;QAC3B;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -0,0 +1,275 @@
1
+ /**
2
+ * Ojas Nidra (ओजस निद्रा) — AI Recovery & Consolidation System
3
+ *
4
+ * Governs how AI agents recover, stabilize, and evolve.
5
+ * Provides memory consolidation, cognitive recovery,
6
+ * and reflective learning cycles.
7
+ */
8
+ import { ExecutionTrace, ConsolidatedMemory, ConsolidatedMemoryKind, MemoryCursor, MemoryDelta, RecoveryHealth, RecoveryPolicy, RecoveryCycleResult, RecoveryAnalysis, HealthRecommendation } from '../types';
9
+ import type { NidraStateSnapshot } from '../persistence/types';
10
+ export declare class Nidra {
11
+ private policy;
12
+ private traces;
13
+ private memories;
14
+ private cycleHistory;
15
+ private lastRecovery;
16
+ /**
17
+ * Trace IDs that have been processed by a recovery cycle — regardless of
18
+ * whether they produced a retained memory. Without this set, low-confidence
19
+ * traces would be reprocessed forever because the prior implementation only
20
+ * treated a trace as "processed" if it ended up inside a kept memory.
21
+ */
22
+ private processedTraceIds;
23
+ /**
24
+ * IDs of memories that have already emitted a `memory_cold` event
25
+ * during the current run, so we don't re-emit on every `assess()`
26
+ * pass while the temperature stays below the cold threshold.
27
+ * Cleared when a memory is re-warmed via `touchMemory`.
28
+ */
29
+ private coldNotifiedIds;
30
+ /**
31
+ * IDs of memories pruned in this Nidra's lifetime, kept so
32
+ * `getMemoryDelta()` can report them under `removedIds`.
33
+ * Bounded by `maxProcessedTraceIds` to avoid unbounded growth.
34
+ */
35
+ private prunedMemoryIds;
36
+ constructor(policy?: Partial<RecoveryPolicy>);
37
+ /**
38
+ * Mark a memory as accessed: bump its temperature toward `1.0` and
39
+ * stamp the touch timestamp. Used by agents when they actually read
40
+ * a memory; `Aahar.filter()` integrations can also call this when a
41
+ * memory makes it into the context window.
42
+ *
43
+ * Returns `true` if the touched memory was previously below the
44
+ * cold threshold (i.e. the touch *re-warmed* it). Callers may
45
+ * choose to suppress next-cycle `memory_cold` emission in that case.
46
+ */
47
+ touchMemory(id: string): boolean;
48
+ /**
49
+ * Current temperature of `id`, with decay applied since the last
50
+ * touch. Returns `undefined` for unknown memory IDs.
51
+ */
52
+ getMemoryTemperature(id: string): number | undefined;
53
+ /**
54
+ * Decay model: exponential half-life. Given `temperature` last
55
+ * updated at `temperatureUpdatedAt`, returns the current decayed
56
+ * value. The half-life is configurable via
57
+ * `RecoveryPolicy.temperatureHalfLifeSec` (default one week).
58
+ */
59
+ private computeDecayedTemperature;
60
+ /**
61
+ * Returns memories whose decayed temperature is now below the cold
62
+ * threshold. The set is *idempotent across calls* via the
63
+ * `coldNotifiedIds` set, so this can be called from a periodic
64
+ * `assess()` pass without spamming the agent.
65
+ *
66
+ * The returned shape is the data needed to construct a `memory_cold`
67
+ * Pulse event; Ojas wires the actual emission in `Ojas.healthCheck()`.
68
+ */
69
+ detectColdMemories(): {
70
+ id: string;
71
+ temperature: number;
72
+ abstraction: string;
73
+ }[];
74
+ /**
75
+ * Cursor representing the agent's view of the memory set right now.
76
+ * The hash collapses a fingerprint of every active memory's
77
+ * `(id, createdAt, invalidatedAt?, content)` tuple so any change
78
+ * produces a different cursor.
79
+ */
80
+ getMemoryCursor(): MemoryCursor;
81
+ /**
82
+ * Return only the memories that changed since `cursor`. If the
83
+ * cursor is unknown (the agent is calling for the first time, or
84
+ * its cursor is older than our pruned-id horizon), the response is
85
+ * a full resync.
86
+ */
87
+ getMemoryDelta(cursor?: MemoryCursor): MemoryDelta;
88
+ /**
89
+ * Cheap hash for `MemoryCursor.cursorHash`. We just sum a per-memory
90
+ * fingerprint into a 32-bit accumulator. Not collision-resistant in
91
+ * the cryptographic sense — but the cursor only needs to detect
92
+ * "anything changed since last time", and per-id IDs are already
93
+ * unique.
94
+ */
95
+ private computeMemoryHash;
96
+ /**
97
+ * Reject malformed RecoveryPolicy fields at the boundary so a buggy
98
+ * caller can't poison division by `0`, blow up `Math.exp(NaN)`, or
99
+ * silently disable retention with `-1`.
100
+ */
101
+ private validatePolicy;
102
+ /**
103
+ * Record an execution trace for later consolidation. Evicts the oldest
104
+ * traces (and any matching processed-id markers) once the configured
105
+ * retention cap is hit, so long-running agents stay bounded in memory.
106
+ */
107
+ recordTrace(trace: ExecutionTrace): void;
108
+ /** Record multiple traces at once. */
109
+ recordTraces(traces: ExecutionTrace[]): void;
110
+ private enforceTraceRetention;
111
+ private enforceMemoryAndCycleRetention;
112
+ /**
113
+ * Analyse unprocessed traces without committing anything. The returned
114
+ * envelope can be inspected, passed to `agent.injectMemory()`, and then
115
+ * finalised via `commitAnalysis()`. This is the building block for
116
+ * transactional recovery — see `Ojas.recover()` for the canonical use.
117
+ *
118
+ * `estimatedHealthAfter` is a forward-looking projection from the same
119
+ * pre-mutation state; for a true post-state, call `assess()` after
120
+ * committing.
121
+ */
122
+ analyseUnprocessed(): RecoveryAnalysis;
123
+ /**
124
+ * Pure preview: returns the memories, patterns, and drift estimate a
125
+ * commit would produce, with NO mutation. Memories are not appended,
126
+ * `lastRecovery` is unchanged, no trace IDs are marked processed, and
127
+ * no cycle is added to history. `healthAfter` is an estimate — for the
128
+ * true post-commit state, call `runRecoveryCycle()`.
129
+ *
130
+ * `supersededMemoryIds` lists the IDs that a commit WOULD invalidate
131
+ * given current state, so operators can see the impact of running
132
+ * the cycle without taking the side effect.
133
+ */
134
+ previewRecoveryCycle(): RecoveryCycleResult;
135
+ /**
136
+ * Commit a precomputed `RecoveryAnalysis`. This is the side-effecting
137
+ * half of the analyse/commit pair: appends memories, marks traces
138
+ * processed, updates `lastRecovery`, and records the cycle. Use this
139
+ * directly to interleave external side effects (e.g. injecting memories
140
+ * into an agent) between analysis and commit, so a failure in those
141
+ * side effects leaves Nidra state untouched.
142
+ *
143
+ * `healthAfter` is captured AFTER mutation, so `driftReduction`
144
+ * reflects the real change.
145
+ *
146
+ * **Stale-analysis semantics.** Between `analyseUnprocessed()` and
147
+ * `commitAnalysis()`, new traces may arrive (carried over to next
148
+ * cycle — fine) AND existing traces may be evicted by retention caps
149
+ * if the trace store filled up. We mark any covered trace ID as
150
+ * processed regardless, because the analysis already encoded what
151
+ * those traces meant. The result reports `coveredTraceIdsStillRetained`
152
+ * vs `coveredTraceIdsEvicted` so the caller can tell when memories
153
+ * reference source traces that are no longer in `getTraces()`.
154
+ */
155
+ commitAnalysis(a: RecoveryAnalysis): RecoveryCycleResult;
156
+ /**
157
+ * Run a full recovery cycle in-process: analyse, then commit. Equivalent
158
+ * to `commitAnalysis(analyseUnprocessed())`. Convenient when there are
159
+ * no external side effects to sequence in between.
160
+ */
161
+ runRecoveryCycle(): RecoveryCycleResult;
162
+ /**
163
+ * Cluster traces by action pattern for consolidation.
164
+ */
165
+ private clusterTraces;
166
+ /**
167
+ * Convert pattern clusters into consolidated memories.
168
+ */
169
+ private consolidateClusters;
170
+ /**
171
+ * Pure planning step: compute which existing *active* memories would
172
+ * be superseded by the given new memories. Does **not** mutate. Used
173
+ * by `commitAnalysis()` to invalidate prior memories, and by
174
+ * `previewRecoveryCycle()` to surface the same plan without applying
175
+ * it.
176
+ *
177
+ * A new memory supersedes an existing one when ALL of:
178
+ * - existing.invalidatedAt is unset (still active);
179
+ * - kinds match (defaulting to `'procedural'` when unset);
180
+ * - `applicability` lists share at least one element;
181
+ * - `|existing.confidence - new.confidence|` ≥ the policy's
182
+ * `supersessionConfidenceDelta` (default 0.15).
183
+ *
184
+ * Each existing memory is claimed by at most one new memory per batch.
185
+ */
186
+ private computeSupersessions;
187
+ /**
188
+ * Compute confidence for a pattern cluster.
189
+ */
190
+ private computeConfidence;
191
+ /**
192
+ * Measure consistency of outcomes within a cluster.
193
+ */
194
+ private measureConsistency;
195
+ /**
196
+ * Extract a heuristic from a pattern cluster.
197
+ */
198
+ private extractHeuristic;
199
+ /**
200
+ * Extract a higher-level abstraction from a cluster.
201
+ */
202
+ private extractAbstraction;
203
+ /**
204
+ * Identify recurring patterns across trace clusters.
205
+ */
206
+ private identifyPatterns;
207
+ /**
208
+ * Measure cognitive drift: how much recent behavior deviates
209
+ * from stable patterns. Higher = more drift.
210
+ */
211
+ measureDrift(traces?: ExecutionTrace[]): number;
212
+ /**
213
+ * Produce a complete recovery health report.
214
+ *
215
+ * `memoryConsolidation` is computed against *active* memories only
216
+ * (those with no `invalidatedAt`). Counting superseded memories
217
+ * would inflate the ratio as the agent revises its beliefs, hiding
218
+ * that the live memory store has actually grown leaner.
219
+ */
220
+ assess(): RecoveryHealth;
221
+ recommend(): HealthRecommendation[];
222
+ /**
223
+ * Returns true if enough traces exist to justify a recovery cycle.
224
+ */
225
+ needsRecovery(): boolean;
226
+ private getUnprocessedTraces;
227
+ /**
228
+ * All memories ever consolidated by this Nidra instance, including
229
+ * those that have been invalidated by supersession. Use this for
230
+ * audit / replay; use `getActiveMemories()` for the "what's true now"
231
+ * view and `findMemories(query)` for richer queries.
232
+ */
233
+ getMemories(): readonly Readonly<ConsolidatedMemory>[];
234
+ /**
235
+ * The currently authoritative memories — those with no
236
+ * `invalidatedAt` set. This is the live view a consumer should
237
+ * inject into an agent or surface on a dashboard. Memories that
238
+ * have been superseded are excluded but remain in `getMemories()`
239
+ * for provenance.
240
+ */
241
+ getActiveMemories(): readonly Readonly<ConsolidatedMemory>[];
242
+ /**
243
+ * Bi-temporal / kind-aware query over the memory store: "what was
244
+ * true at any point in time".
245
+ *
246
+ * - `asOf` (ISO timestamp; default = now): include only memories
247
+ * that were valid at that instant — `createdAt <= asOf` AND
248
+ * (`invalidatedAt` is unset OR `invalidatedAt > asOf`). Set
249
+ * `includeInvalidated` to `true` to drop the invalidation cutoff
250
+ * and see every memory created on or before `asOf`.
251
+ * - `kind`: restrict to one or more memory kinds. Memories with no
252
+ * explicit `kind` are treated as `'procedural'`.
253
+ * - `applicability`: exact match against any element of the
254
+ * memory's `applicability` list.
255
+ * - `minConfidence`: drop memories below this confidence.
256
+ * - `limit`: cap the result length (no cap if undefined).
257
+ *
258
+ * Results are returned in insertion order (oldest first).
259
+ */
260
+ findMemories(query?: {
261
+ asOf?: string;
262
+ kind?: ConsolidatedMemoryKind | ConsolidatedMemoryKind[];
263
+ applicability?: string;
264
+ minConfidence?: number;
265
+ includeInvalidated?: boolean;
266
+ limit?: number;
267
+ }): ConsolidatedMemory[];
268
+ getTraces(): readonly Readonly<ExecutionTrace>[];
269
+ getCycleHistory(): readonly Readonly<RecoveryCycleResult>[];
270
+ exportState(): NidraStateSnapshot;
271
+ importState(snapshot: Partial<NidraStateSnapshot> | undefined): void;
272
+ getPolicy(): RecoveryPolicy;
273
+ updatePolicy(updates: Partial<RecoveryPolicy>): void;
274
+ }
275
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nidra/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAEhB,oBAAoB,EAErB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAkD/D,qBAAa,KAAK;IAChB,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,YAAY,CAAuB;IAC3C;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB,CAA0B;IAEnD;;;;;OAKG;IACH,OAAO,CAAC,eAAe,CAA0B;IAEjD;;;;OAIG;IACH,OAAO,CAAC,eAAe,CAAgB;gBAE3B,MAAM,GAAE,OAAO,CAAC,cA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