@sesamespace/hivemind 0.5.3 → 0.5.5

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 (96) hide show
  1. package/.github/workflows/memory-release.yml +89 -0
  2. package/config/default.toml +12 -0
  3. package/data/lancedb/contexts.lance/_transactions/0-c4755ab9-b604-4d90-851f-0491f3cbcbce.txn +2 -0
  4. package/data/lancedb/contexts.lance/_versions/1.manifest +0 -0
  5. package/data/lancedb/episode_access.lance/_transactions/0-407a6366-0dca-490a-868b-ea63bee3b40c.txn +2 -0
  6. package/data/lancedb/episode_access.lance/_versions/1.manifest +0 -0
  7. package/data/lancedb/episode_cooccurrence.lance/_transactions/0-0e103c7f-29d7-4f09-8100-505c076f01ae.txn +1 -0
  8. package/data/lancedb/episode_cooccurrence.lance/_versions/1.manifest +0 -0
  9. package/data/lancedb/episodes.lance/_transactions/0-e678cbac-792b-4a9d-a457-17b0d4d23607.txn +1 -0
  10. package/data/lancedb/episodes.lance/_versions/1.manifest +0 -0
  11. package/data/lancedb/l3_knowledge.lance/_transactions/0-cdb3561f-3a59-4e15-bded-e93c5f9a50e3.txn +1 -0
  12. package/data/lancedb/l3_knowledge.lance/_versions/1.manifest +0 -0
  13. package/data/lancedb/tasks.lance/_transactions/0-d1cf10ec-1eb8-48b4-bbbe-34b3a1083664.txn +4 -0
  14. package/data/lancedb/tasks.lance/_versions/1.manifest +0 -0
  15. package/dist/{chunk-HGNVCCYG.js → chunk-2OIRJFI5.js} +14 -31
  16. package/dist/chunk-2OIRJFI5.js.map +1 -0
  17. package/dist/chunk-7D4SUZUM.js +38 -0
  18. package/dist/chunk-7D4SUZUM.js.map +1 -0
  19. package/dist/chunk-LRK64BAK.js +3601 -0
  20. package/dist/chunk-LRK64BAK.js.map +1 -0
  21. package/dist/chunk-MBS5A6BZ.js +132 -0
  22. package/dist/chunk-MBS5A6BZ.js.map +1 -0
  23. package/dist/{chunk-LNV373IF.js → chunk-OQ272HKA.js} +3 -28
  24. package/dist/chunk-OQ272HKA.js.map +1 -0
  25. package/dist/{chunk-CGSXJVSS.js → chunk-RXCV57H3.js} +2 -2
  26. package/dist/{chunk-S3RVZBPZ.js → chunk-YEOAEJ62.js} +2 -2
  27. package/dist/commands/fleet.js +4 -3
  28. package/dist/commands/init.js +2 -1
  29. package/dist/commands/service.js +2 -1
  30. package/dist/commands/start.js +4 -3
  31. package/dist/commands/upgrade.js +1 -0
  32. package/dist/index.js +3 -2
  33. package/dist/main.js +7 -6
  34. package/dist/main.js.map +1 -1
  35. package/dist/start.js +2 -1
  36. package/dist/start.js.map +1 -1
  37. package/package.json +1 -1
  38. package/PLANNING.md +0 -383
  39. package/TASKS.md +0 -60
  40. package/dist/chunk-HGNVCCYG.js.map +0 -1
  41. package/dist/chunk-LNV373IF.js.map +0 -1
  42. package/dist/chunk-PPQGQHXJ.js +0 -151
  43. package/dist/chunk-PPQGQHXJ.js.map +0 -1
  44. package/dist/chunk-YHRGEWAZ.js +0 -2326
  45. package/dist/chunk-YHRGEWAZ.js.map +0 -1
  46. package/install.sh +0 -120
  47. package/npm-package.json +0 -26
  48. package/packages/cli/package.json +0 -23
  49. package/packages/cli/src/commands/fleet.ts +0 -206
  50. package/packages/cli/src/commands/init.ts +0 -253
  51. package/packages/cli/src/commands/service.ts +0 -159
  52. package/packages/cli/src/commands/start.ts +0 -78
  53. package/packages/cli/src/commands/upgrade.ts +0 -158
  54. package/packages/cli/src/main.ts +0 -64
  55. package/packages/cli/tsconfig.json +0 -8
  56. package/packages/memory/Cargo.lock +0 -6480
  57. package/packages/memory/Cargo.toml +0 -21
  58. package/packages/memory/src/context.rs +0 -179
  59. package/packages/memory/src/embeddings.rs +0 -51
  60. package/packages/memory/src/main.rs +0 -626
  61. package/packages/memory/src/promotion.rs +0 -637
  62. package/packages/memory/src/scoring.rs +0 -131
  63. package/packages/memory/src/store.rs +0 -460
  64. package/packages/memory/src/tasks.rs +0 -321
  65. package/packages/runtime/package.json +0 -24
  66. package/packages/runtime/src/__tests__/fleet-integration.test.ts +0 -235
  67. package/packages/runtime/src/__tests__/fleet.test.ts +0 -207
  68. package/packages/runtime/src/__tests__/integration.test.ts +0 -434
  69. package/packages/runtime/src/agent.ts +0 -255
  70. package/packages/runtime/src/config.ts +0 -130
  71. package/packages/runtime/src/context.ts +0 -192
  72. package/packages/runtime/src/fleet/fleet-manager.ts +0 -399
  73. package/packages/runtime/src/fleet/memory-sync.ts +0 -362
  74. package/packages/runtime/src/fleet/primary-client.ts +0 -285
  75. package/packages/runtime/src/fleet/worker-protocol.ts +0 -158
  76. package/packages/runtime/src/fleet/worker-server.ts +0 -246
  77. package/packages/runtime/src/index.ts +0 -57
  78. package/packages/runtime/src/llm-client.ts +0 -65
  79. package/packages/runtime/src/memory-client.ts +0 -309
  80. package/packages/runtime/src/pipeline.ts +0 -187
  81. package/packages/runtime/src/prompt.ts +0 -173
  82. package/packages/runtime/src/sesame.ts +0 -226
  83. package/packages/runtime/src/start.ts +0 -20
  84. package/packages/runtime/src/task-engine.ts +0 -113
  85. package/packages/runtime/src/worker.ts +0 -339
  86. package/packages/runtime/tsconfig.json +0 -8
  87. package/pnpm-workspace.yaml +0 -2
  88. package/run-aidan.sh +0 -23
  89. package/scripts/bootstrap.sh +0 -196
  90. package/scripts/build-npm.sh +0 -92
  91. package/scripts/com.hivemind.agent.plist +0 -44
  92. package/scripts/com.hivemind.memory.plist +0 -31
  93. package/tsconfig.json +0 -22
  94. package/tsup.config.ts +0 -27
  95. /package/dist/{chunk-CGSXJVSS.js.map → chunk-RXCV57H3.js.map} +0 -0
  96. /package/dist/{chunk-S3RVZBPZ.js.map → chunk-YEOAEJ62.js.map} +0 -0
@@ -1,21 +0,0 @@
1
- [package]
2
- name = "hivemind-memory"
3
- version = "0.1.0"
4
- edition = "2021"
5
-
6
- [dependencies]
7
- axum = "0.7"
8
- tokio = { version = "1", features = ["full"] }
9
- serde = { version = "1", features = ["derive"] }
10
- serde_json = "1"
11
- lancedb = "0.15"
12
- arrow-array = "53"
13
- arrow-schema = "53"
14
- reqwest = { version = "0.12", features = ["json"] }
15
- uuid = { version = "1", features = ["v4"] }
16
- chrono = { version = "0.4", features = ["serde"] }
17
- tracing = "0.1"
18
- tracing-subscriber = { version = "0.3", features = ["env-filter"] }
19
- tower-http = { version = "0.5", features = ["cors", "trace"] }
20
- anyhow = "1"
21
- futures = "0.3"
@@ -1,179 +0,0 @@
1
- use anyhow::Result;
2
- use arrow_array::{RecordBatch, RecordBatchIterator, StringArray};
3
- use arrow_schema::{DataType, Field, Schema};
4
- use chrono::Utc;
5
- use futures::stream::TryStreamExt;
6
- use lancedb::{connection::Connection, query::ExecutableQuery, query::QueryBase, Table};
7
- use serde::{Deserialize, Serialize};
8
- use std::sync::Arc;
9
- use uuid;
10
-
11
- const CONTEXTS_TABLE: &str = "contexts";
12
-
13
- #[derive(Debug, Serialize, Deserialize, Clone)]
14
- pub struct ContextMetadata {
15
- pub name: String,
16
- pub description: String,
17
- pub created_at: String,
18
- }
19
-
20
- pub struct ContextStore {
21
- db: Connection,
22
- }
23
-
24
- impl ContextStore {
25
- pub async fn new(db: Connection) -> Result<Self> {
26
- let store = Self { db };
27
- store.ensure_table().await?;
28
- Ok(store)
29
- }
30
-
31
- fn schema() -> Arc<Schema> {
32
- Arc::new(Schema::new(vec![
33
- Field::new("name", DataType::Utf8, false),
34
- Field::new("description", DataType::Utf8, false),
35
- Field::new("created_at", DataType::Utf8, false),
36
- ]))
37
- }
38
-
39
- async fn ensure_table(&self) -> Result<()> {
40
- let names = self.db.table_names().execute().await?;
41
- if !names.contains(&CONTEXTS_TABLE.to_string()) {
42
- let schema = Self::schema();
43
- let batch = RecordBatch::new_empty(schema.clone());
44
- let batches = RecordBatchIterator::new(vec![Ok(batch)], schema);
45
- self.db
46
- .create_table(CONTEXTS_TABLE, Box::new(batches))
47
- .execute()
48
- .await?;
49
- tracing::info!("Created contexts metadata table");
50
- }
51
- Ok(())
52
- }
53
-
54
- pub async fn create_context(&self, name: &str, description: &str) -> Result<ContextMetadata> {
55
- // Check if context already exists
56
- if let Some(existing) = self.get_context(name).await? {
57
- return Ok(existing);
58
- }
59
-
60
- let created_at = Utc::now().to_rfc3339();
61
-
62
- let metadata = ContextMetadata {
63
- name: name.to_string(),
64
- description: description.to_string(),
65
- created_at: created_at.clone(),
66
- };
67
-
68
- let schema = Self::schema();
69
- let batch = RecordBatch::try_new(
70
- schema.clone(),
71
- vec![
72
- Arc::new(StringArray::from(vec![name])),
73
- Arc::new(StringArray::from(vec![description])),
74
- Arc::new(StringArray::from(vec![created_at.as_str()])),
75
- ],
76
- )?;
77
-
78
- let table = self.db.open_table(CONTEXTS_TABLE).execute().await?;
79
- let batches = RecordBatchIterator::new(vec![Ok(batch)], schema);
80
- table.add(Box::new(batches)).execute().await?;
81
-
82
- tracing::info!("Created context: {}", name);
83
- Ok(metadata)
84
- }
85
-
86
- pub async fn get_context(&self, name: &str) -> Result<Option<ContextMetadata>> {
87
- let table = self.db.open_table(CONTEXTS_TABLE).execute().await?;
88
- let results = table
89
- .query()
90
- .only_if(format!("name = '{}'", name))
91
- .execute()
92
- .await?;
93
-
94
- let batches: Vec<RecordBatch> = results.try_collect().await?;
95
- for batch in &batches {
96
- if batch.num_rows() > 0 {
97
- let names = batch
98
- .column_by_name("name")
99
- .unwrap()
100
- .as_any()
101
- .downcast_ref::<StringArray>()
102
- .unwrap();
103
- let descriptions = batch
104
- .column_by_name("description")
105
- .unwrap()
106
- .as_any()
107
- .downcast_ref::<StringArray>()
108
- .unwrap();
109
- let created_ats = batch
110
- .column_by_name("created_at")
111
- .unwrap()
112
- .as_any()
113
- .downcast_ref::<StringArray>()
114
- .unwrap();
115
-
116
- return Ok(Some(ContextMetadata {
117
- name: names.value(0).to_string(),
118
- description: descriptions.value(0).to_string(),
119
- created_at: created_ats.value(0).to_string(),
120
- }));
121
- }
122
- }
123
-
124
- Ok(None)
125
- }
126
-
127
- pub async fn list_contexts(&self) -> Result<Vec<ContextMetadata>> {
128
- let table = self.db.open_table(CONTEXTS_TABLE).execute().await?;
129
- let results = table.query().execute().await?;
130
-
131
- let batches: Vec<RecordBatch> = results.try_collect().await?;
132
- let mut contexts = Vec::new();
133
-
134
- for batch in &batches {
135
- let names = batch
136
- .column_by_name("name")
137
- .unwrap()
138
- .as_any()
139
- .downcast_ref::<StringArray>()
140
- .unwrap();
141
- let descriptions = batch
142
- .column_by_name("description")
143
- .unwrap()
144
- .as_any()
145
- .downcast_ref::<StringArray>()
146
- .unwrap();
147
- let created_ats = batch
148
- .column_by_name("created_at")
149
- .unwrap()
150
- .as_any()
151
- .downcast_ref::<StringArray>()
152
- .unwrap();
153
-
154
- for i in 0..batch.num_rows() {
155
- contexts.push(ContextMetadata {
156
- name: names.value(i).to_string(),
157
- description: descriptions.value(i).to_string(),
158
- created_at: created_ats.value(i).to_string(),
159
- });
160
- }
161
- }
162
-
163
- Ok(contexts)
164
- }
165
-
166
- pub async fn delete_context(&self, name: &str) -> Result<bool> {
167
- if name == "global" {
168
- anyhow::bail!("Cannot delete global context");
169
- }
170
-
171
- let table = self.db.open_table(CONTEXTS_TABLE).execute().await?;
172
- table
173
- .delete(&format!("name = '{}'", name))
174
- .await?;
175
-
176
- tracing::info!("Deleted context metadata: {}", name);
177
- Ok(true)
178
- }
179
- }
@@ -1,51 +0,0 @@
1
- use anyhow::Result;
2
- use serde::{Deserialize, Serialize};
3
-
4
- pub struct OllamaClient {
5
- base_url: String,
6
- model: String,
7
- http: reqwest::Client,
8
- }
9
-
10
- #[derive(Serialize)]
11
- struct EmbedRequest {
12
- model: String,
13
- input: String,
14
- }
15
-
16
- #[derive(Deserialize)]
17
- struct EmbedResponse {
18
- embeddings: Vec<Vec<f32>>,
19
- }
20
-
21
- impl OllamaClient {
22
- pub fn new(base_url: &str, model: &str) -> Self {
23
- Self {
24
- base_url: base_url.to_string(),
25
- model: model.to_string(),
26
- http: reqwest::Client::new(),
27
- }
28
- }
29
-
30
- pub async fn embed(&self, text: &str) -> Result<Vec<f32>> {
31
- let url = format!("{}/api/embed", self.base_url);
32
- let req = EmbedRequest {
33
- model: self.model.clone(),
34
- input: text.to_string(),
35
- };
36
-
37
- let resp = self
38
- .http
39
- .post(&url)
40
- .json(&req)
41
- .send()
42
- .await?
43
- .error_for_status()?;
44
-
45
- let body: EmbedResponse = resp.json().await?;
46
- body.embeddings
47
- .into_iter()
48
- .next()
49
- .ok_or_else(|| anyhow::anyhow!("No embedding returned from Ollama"))
50
- }
51
- }