legion-data 1.4.4 → 1.4.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5cd79bdce76b7a6043a32f43448907046df4ba71a4715dc6afea5c34168f152a
4
- data.tar.gz: 9029b9c2de24c614a8c2742ffa7e276cd63b9b1205a1b39d99d22f1ad2fccc77
3
+ metadata.gz: 6e05799c2c985b4411c44ca60b6fb3b830825e113084c04f9d82292fde323dbd
4
+ data.tar.gz: 770898dd6f1675c1688ba9b2279d37faff1e440f86aeddaaa207797e8a4277cf
5
5
  SHA512:
6
- metadata.gz: beafcc4417a128f66b8d13761aa66330cf81903231591b2320c102fff188ed37f9ee82dcbf3e1111fa93c5a7d8c87f3366bea2715260566297e98269b2c6f6c4
7
- data.tar.gz: 1dada9cc4fbe1e716b718db9ae28e748ac36a1db5277c1a8652a298747403333b8f0e6d665c69d9219c8a7e268e0f22d31bc638bc334d48b93f14d08cd310824
6
+ metadata.gz: 4d77e460cbbe665134a2c106cb7d75be7d1dc263233343b102b38df6585f0e5bb43f5f7b5ca2463a08ce9a4d234e11fce40dbdbb53813868273aa47ff074e88a
7
+ data.tar.gz: 84f820d8da69d6bcbb9e8d97a5c601cac341d5791777b0a9262a084ad8be8925a6044c8b1b00abd4d58ebb152f7982951e6c74103511001ed6479e685a7ca6e0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Legion::Data Changelog
2
2
 
3
+ ## v1.4.7
4
+
5
+ ### Added
6
+ - Migration 031: adds `depth` column (Integer, default 0) to tasks table for sub-agent recursion tracking
7
+ - Migration 032: adds `cancelled_at` column (DateTime, nullable) to tasks table for cancellation support
8
+ - `cancelled?` predicate method on Task model
9
+
10
+ ## v1.4.6
11
+
12
+ ### Added
13
+ - Migration 028: agent_cluster_nodes table (stub for agent cluster support)
14
+ - Migration 029: agent_cluster_tasks table (stub for agent cluster task tracking)
15
+ - Migration 030: approval_queue table for governance board with status, requester, reviewer, and tenant filtering
16
+
17
+ ## v1.4.5
18
+
19
+ ### Added
20
+ - Migration 027: add `source_provider` column to `apollo_entries` (postgres-only)
21
+ Tracks the LLM provider or data origin of each knowledge entry for source diversity
22
+ enforcement in Apollo corroboration
23
+
3
24
  ## v1.4.4
4
25
 
5
26
  ### Added
data/CLAUDE.md CHANGED
@@ -8,7 +8,7 @@
8
8
  Manages persistent database storage for the LegionIO framework. Supports SQLite (default), MySQL, and PostgreSQL via Sequel ORM. Provides automatic schema migrations and data models for extensions, functions, runners, nodes, tasks, settings, digital workers, task relationships, Apollo shared knowledge tables (PostgreSQL only), tenants, webhooks, audit log, and archive tables. Also provides a parallel local SQLite database (`Legion::Data::Local`) for agentic cognitive state persistence.
9
9
 
10
10
  **GitHub**: https://github.com/LegionIO/legion-data
11
- **Version**: 1.4.3
11
+ **Version**: 1.4.4
12
12
  **License**: Apache-2.0
13
13
 
14
14
  ## Supported Databases
@@ -72,7 +72,8 @@ Legion::Data (singleton module)
72
72
  │ ├── 022_add_memory_traces
73
73
  │ ├── 023_add_data_archive
74
74
  │ ├── 024_add_tenant_partition_columns
75
- └── 025_add_tenants_table
75
+ ├── 025_add_tenants_table
76
+ │ └── 026_add_function_embeddings # description + embedding (TEXT) on functions; postgres: embedding_vector vector(1536) with HNSW cosine index
76
77
 
77
78
  ├── Model # Sequel model loader
78
79
  │ └── Models/
@@ -190,6 +191,10 @@ Per-adapter credential defaults are defined in `Settings::CREDS`:
190
191
  | `lib/legion/data/encryption/sequel_plugin.rb` | Transparent `encrypted_column` DSL for Sequel models |
191
192
  | `lib/legion/data/event_store.rb` | Append-only governance event store with hash chain integrity |
192
193
  | `lib/legion/data/event_store/projection.rb` | Projection base class, ConsentState, GovernanceTimeline |
194
+ | `lib/legion/data/vector.rb` | Reusable pgvector helpers: `available?`, `cosine_search`, `l2_search`, `ensure_extension!` |
195
+ | `lib/legion/data/storage_tiers.rb` | Hot/warm/cold archival lifecycle: `archive_to_warm`, `export_to_cold`, `stats` |
196
+ | `lib/legion/data/archival.rb` | Archival module entry point and configuration |
197
+ | `lib/legion/data/archival/` | Archival strategy implementations |
193
198
  | `lib/legion/data/settings.rb` | Default configuration with per-adapter credential presets |
194
199
  | `lib/legion/data/version.rb` | VERSION constant |
195
200
  | `exe/legionio_migrate` | CLI executable for running database migrations standalone |
@@ -210,6 +215,7 @@ Optional persistent storage initialized during `Legion::Service` startup (after
210
215
  11. Governance event store with append-only integrity (migration 018)
211
216
  12. Webhook subscription storage (migration 020)
212
217
  13. Archive, memory traces, and tenant partition tables (migrations 021–025)
218
+ 14. Function embeddings for semantic runner discovery (migration 026 — description + vector columns on functions table)
213
219
 
214
220
  ---
215
221
 
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Persistent database storage for the [LegionIO](https://github.com/LegionIO/LegionIO) framework. Provides database connectivity via Sequel ORM, automatic schema migrations, and data models for extensions, functions, runners, nodes, tasks, settings, digital workers, task relationships, and Apollo shared knowledge tables.
4
4
 
5
- **Version**: 1.4.3
5
+ **Version**: 1.4.4
6
6
 
7
7
  ## Supported Databases
8
8
 
@@ -50,6 +50,8 @@ gem 'legion-data'
50
50
 
51
51
  Apollo models require PostgreSQL with the `pgvector` extension. They are skipped silently on SQLite and MySQL.
52
52
 
53
+ Migration 026 adds `description` (TEXT) and `embedding` (TEXT, JSON-serialized vector) columns to the `functions` table, plus a `embedding_vector vector(1536)` column with HNSW cosine index on PostgreSQL for semantic similarity search of runner functions.
54
+
53
55
  ## Usage
54
56
 
55
57
  ```ruby
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ Sequel.migration do
4
+ up do
5
+ next unless adapter_scheme == :postgres
6
+
7
+ alter_table(:apollo_entries) do
8
+ add_column :source_provider, String, size: 50, null: true
9
+ end
10
+
11
+ run "UPDATE apollo_entries SET source_provider = 'unknown' WHERE source_provider IS NULL"
12
+ end
13
+
14
+ down do
15
+ next unless adapter_scheme == :postgres
16
+
17
+ alter_table(:apollo_entries) do
18
+ drop_column :source_provider
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ Sequel.migration do
4
+ up do
5
+ next if table_exists?(:agent_cluster_nodes)
6
+
7
+ create_table(:agent_cluster_nodes) do
8
+ primary_key :id
9
+ String :node_id, null: false, unique: true
10
+ String :role, null: false, default: 'worker'
11
+ String :status, null: false, default: 'active'
12
+ DateTime :joined_at, null: false
13
+ DateTime :last_seen
14
+ String :tenant_id
15
+ index :status
16
+ index :tenant_id
17
+ end
18
+ end
19
+
20
+ down do
21
+ drop_table?(:agent_cluster_nodes)
22
+ end
23
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ Sequel.migration do
4
+ up do
5
+ next if table_exists?(:agent_cluster_tasks)
6
+
7
+ create_table(:agent_cluster_tasks) do
8
+ primary_key :id
9
+ String :task_type, null: false
10
+ Text :payload
11
+ String :assigned_to
12
+ String :status, null: false, default: 'pending'
13
+ DateTime :created_at, null: false
14
+ DateTime :completed_at
15
+ String :tenant_id
16
+ index :status
17
+ index :assigned_to
18
+ index :tenant_id
19
+ end
20
+ end
21
+
22
+ down do
23
+ drop_table?(:agent_cluster_tasks)
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ Sequel.migration do
4
+ up do
5
+ next if table_exists?(:approval_queue)
6
+
7
+ create_table(:approval_queue) do
8
+ primary_key :id
9
+ String :approval_type, null: false
10
+ Text :payload
11
+ String :requester_id, null: false
12
+ String :status, null: false, default: 'pending'
13
+ String :reviewer_id
14
+ DateTime :reviewed_at
15
+ DateTime :created_at, null: false
16
+ String :tenant_id
17
+ index :status
18
+ index :tenant_id
19
+ index :created_at
20
+ end
21
+ end
22
+
23
+ down do
24
+ drop_table?(:approval_queue)
25
+ end
26
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ Sequel.migration do
4
+ up do
5
+ next unless table_exists?(:tasks)
6
+ next if schema(:tasks).any? { |col, _| col == :depth }
7
+
8
+ alter_table(:tasks) do
9
+ add_column :depth, Integer, default: 0, null: false
10
+ end
11
+ end
12
+
13
+ down do
14
+ next unless table_exists?(:tasks)
15
+ next unless schema(:tasks).any? { |col, _| col == :depth }
16
+
17
+ alter_table(:tasks) do
18
+ drop_column :depth
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ Sequel.migration do
4
+ up do
5
+ next unless table_exists?(:tasks)
6
+ next if schema(:tasks).any? { |col, _| col == :cancelled_at }
7
+
8
+ alter_table(:tasks) do
9
+ add_column :cancelled_at, DateTime, null: true
10
+ end
11
+ end
12
+
13
+ down do
14
+ next unless table_exists?(:tasks)
15
+ next unless schema(:tasks).any? { |col, _| col == :cancelled_at }
16
+
17
+ alter_table(:tasks) do
18
+ drop_column :cancelled_at
19
+ end
20
+ end
21
+ end
@@ -10,6 +10,10 @@ module Legion
10
10
  one_to_many :children, key: :parent_id, class: self
11
11
  many_to_one :master, class: self
12
12
  one_to_many :slave, key: :master_id, class: self
13
+
14
+ def cancelled?
15
+ !cancelled_at.nil?
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Legion
4
4
  module Data
5
- VERSION = '1.4.4'
5
+ VERSION = '1.4.7'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-data
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
@@ -122,6 +122,12 @@ files:
122
122
  - lib/legion/data/migrations/024_add_tenant_partition_columns.rb
123
123
  - lib/legion/data/migrations/025_add_tenants_table.rb
124
124
  - lib/legion/data/migrations/026_add_function_embeddings.rb
125
+ - lib/legion/data/migrations/027_add_apollo_source_provider.rb
126
+ - lib/legion/data/migrations/028_add_agent_cluster.rb
127
+ - lib/legion/data/migrations/029_add_agent_cluster_tasks.rb
128
+ - lib/legion/data/migrations/030_add_approval_queue.rb
129
+ - lib/legion/data/migrations/031_add_task_depth.rb
130
+ - lib/legion/data/migrations/032_add_task_cancelled_at.rb
125
131
  - lib/legion/data/model.rb
126
132
  - lib/legion/data/models/apollo_access_log.rb
127
133
  - lib/legion/data/models/apollo_entry.rb