rust-kgdb 0.8.11 → 0.8.12

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 (2) hide show
  1. package/hypermind-agent.js +35 -22
  2. package/package.json +1 -1
@@ -5119,9 +5119,9 @@ class HyperMindAgent {
5119
5119
  * @private
5120
5120
  */
5121
5121
  _recordObservations(results, trace) {
5122
- const observationIds = []
5122
+ let observationCount = 0
5123
5123
 
5124
- if (!Array.isArray(results)) return observationIds
5124
+ if (!Array.isArray(results)) return observationCount
5125
5125
 
5126
5126
  for (const result of results) {
5127
5127
  if (!result.success) continue
@@ -5134,17 +5134,20 @@ class HyperMindAgent {
5134
5134
 
5135
5135
  if (keys.length >= 2) {
5136
5136
  try {
5137
- const obsId = this.reasoner.observe(
5138
- `SPARQL result: ${JSON.stringify(bindings)}`,
5139
- {
5140
- subject: String(bindings[keys[0]] || 'unknown'),
5141
- predicate: keys.length >= 2 ? String(keys[1]) : 'related',
5142
- object: String(bindings[keys[keys.length > 2 ? 2 : 1]] || 'value')
5143
- }
5137
+ // Use appendEvent for observations (NAPI-RS API)
5138
+ this.reasoner.appendEvent(
5139
+ 'Observation',
5140
+ `SPARQL: ${JSON.stringify(bindings)}`,
5141
+ this.name || 'agent',
5142
+ trace.sessionId || 'session'
5144
5143
  )
5145
- if (obsId && obsId.id) {
5146
- observationIds.push(obsId.id)
5147
- }
5144
+ observationCount++
5145
+
5146
+ // Also record as hypothesis for deduction
5147
+ const subject = String(bindings[keys[0]] || 'unknown')
5148
+ const predicate = keys.length >= 2 ? String(keys[1]) : 'related'
5149
+ const object = String(bindings[keys[keys.length > 2 ? 2 : 1]] || 'value')
5150
+ this.reasoner.hypothesize(subject, predicate, object, 0.9, [])
5148
5151
  } catch (e) {
5149
5152
  // Continue on observation errors
5150
5153
  }
@@ -5155,28 +5158,38 @@ class HyperMindAgent {
5155
5158
  // Handle triple-format results
5156
5159
  if (result.result?.subject && result.result?.predicate && result.result?.object) {
5157
5160
  try {
5158
- const obsId = this.reasoner.observe(
5159
- `Triple: ${result.result.subject} ${result.result.predicate} ${result.result.object}`,
5160
- result.result
5161
+ const { subject, predicate, object } = result.result
5162
+ // Use appendEvent for observations (NAPI-RS API)
5163
+ this.reasoner.appendEvent(
5164
+ 'Observation',
5165
+ `Triple: ${subject} ${predicate} ${object}`,
5166
+ this.name || 'agent',
5167
+ trace.sessionId || 'session'
5168
+ )
5169
+ observationCount++
5170
+
5171
+ // Also record as hypothesis for deduction
5172
+ this.reasoner.hypothesize(
5173
+ String(subject),
5174
+ String(predicate),
5175
+ String(object),
5176
+ 0.9,
5177
+ []
5161
5178
  )
5162
- if (obsId && obsId.id) {
5163
- observationIds.push(obsId.id)
5164
- }
5165
5179
  } catch (e) {
5166
5180
  // Continue on observation errors
5167
5181
  }
5168
5182
  }
5169
5183
  }
5170
5184
 
5171
- if (observationIds.length > 0) {
5185
+ if (observationCount > 0) {
5172
5186
  trace.addStep({
5173
5187
  type: 'observations_recorded',
5174
- count: observationIds.length,
5175
- ids: observationIds.slice(0, 5)
5188
+ count: observationCount
5176
5189
  })
5177
5190
  }
5178
5191
 
5179
- return observationIds
5192
+ return observationCount
5180
5193
  }
5181
5194
 
5182
5195
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rust-kgdb",
3
- "version": "0.8.11",
3
+ "version": "0.8.12",
4
4
  "description": "High-performance RDF/SPARQL database with AI agent framework and cross-database federation. GraphDB (449ns lookups, 5-11x faster than RDFox), HyperFederate (KGDB + Snowflake + BigQuery), GraphFrames analytics, Datalog reasoning, HNSW vector embeddings. HyperMindAgent for schema-aware query generation with audit trails. W3C SPARQL 1.1 compliant. Native performance via Rust + NAPI-RS.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",