Add scout constellation mode for APK venue persona packs.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Cluster 3+ scout_report hits on the same SSID within 10 minutes; server infers airport/campus/retail venue class and pushes persona spread_policy. Emberwake weather-map merges active scout biomes. Includes agent, server API, and Vitest coverage.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"log"
|
||||
"strings"
|
||||
@@ -36,6 +37,8 @@ func (d *Database) scanAgent(row interface {
|
||||
var notes, tagsRaw string
|
||||
var usbSpread int
|
||||
var gpuMinerActive int
|
||||
var graftStrain, graftTier sql.NullString
|
||||
var graftApproved sql.NullString
|
||||
err := row.Scan(
|
||||
&a.ID, &a.Name, &a.Wallet, &a.IP, &a.Version, &a.Status,
|
||||
&a.CPUCores, &a.MemoryGB, &a.LastSeen, &a.CreatedAt,
|
||||
@@ -46,6 +49,7 @@ func (d *Database) scanAgent(row interface {
|
||||
&a.BuildID, &a.WorkerName, &usbSpread, &a.Campaign,
|
||||
&a.GPUHashrate15m, &a.GPUModel, &gpuMinerActive,
|
||||
&a.ParentAgentID, &a.SpreadGeneration, &a.SpreadStrain,
|
||||
&graftStrain, &graftTier, &graftApproved,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -57,6 +61,7 @@ func (d *Database) scanAgent(row interface {
|
||||
active := true
|
||||
a.GPUMinerActive = &active
|
||||
}
|
||||
a.GraftSourceStrain, a.GraftTier, a.GraftApprovedAt = scanGraftFields(graftStrain, graftTier, graftApproved)
|
||||
return a, nil
|
||||
}
|
||||
|
||||
@@ -64,7 +69,8 @@ const agentSelectCols = `id, name, wallet, ip, version, status, cpu_cores, memor
|
||||
hashrate_15s, hashrate_1m, hashrate_15m, shares_total, shares_good, shares_bad,
|
||||
cpu_usage_pct, memory_usage_pct, uptime_seconds, notes, tags, platform, arch, os_version, hostname, mac_address,
|
||||
build_id, worker_name, usb_spread, campaign, gpu_hashrate_15m, gpu_model, gpu_miner_active,
|
||||
parent_agent_id, spread_generation, spread_strain`
|
||||
parent_agent_id, spread_generation, spread_strain,
|
||||
graft_source_strain, graft_tier, graft_approved_at`
|
||||
|
||||
func (d *Database) UpdateAgentMeta(id, notes string, tags []string) error {
|
||||
_, err := d.Exec(`UPDATE agents SET notes = ?, tags = ? WHERE id = ?`, notes, encodeTags(tags), id)
|
||||
|
||||
@@ -141,6 +141,9 @@ func (d *Database) migrate() error {
|
||||
_, _ = d.Exec(`ALTER TABLE agents ADD COLUMN parent_agent_id TEXT NOT NULL DEFAULT ''`)
|
||||
_, _ = d.Exec(`ALTER TABLE agents ADD COLUMN spread_generation INTEGER NOT NULL DEFAULT 0`)
|
||||
_, _ = d.Exec(`ALTER TABLE agents ADD COLUMN spread_strain TEXT NOT NULL DEFAULT ''`)
|
||||
_, _ = d.Exec(`ALTER TABLE agents ADD COLUMN graft_source_strain TEXT NOT NULL DEFAULT ''`)
|
||||
_, _ = d.Exec(`ALTER TABLE agents ADD COLUMN graft_tier TEXT NOT NULL DEFAULT ''`)
|
||||
_, _ = d.Exec(`ALTER TABLE agents ADD COLUMN graft_approved_at DATETIME`)
|
||||
_, _ = d.Exec(`ALTER TABLE builds ADD COLUMN public INTEGER NOT NULL DEFAULT 0`)
|
||||
|
||||
extraMigrations := []string{
|
||||
@@ -241,6 +244,22 @@ func (d *Database) migrate() error {
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
)`,
|
||||
`CREATE INDEX IF NOT EXISTS idx_fleet_phenotypes_fingerprint ON fleet_phenotypes(fingerprint)`,
|
||||
`CREATE TABLE IF NOT EXISTS strain_cards (
|
||||
id TEXT PRIMARY KEY,
|
||||
root_agent_id TEXT NOT NULL UNIQUE,
|
||||
source_agent_id TEXT NOT NULL,
|
||||
source_agent_name TEXT NOT NULL DEFAULT '',
|
||||
spread_strain TEXT NOT NULL DEFAULT '',
|
||||
spread_lane TEXT NOT NULL DEFAULT '',
|
||||
persona TEXT NOT NULL DEFAULT 'balanced',
|
||||
card_json TEXT NOT NULL DEFAULT '{}',
|
||||
peak_hashrate REAL NOT NULL DEFAULT 0,
|
||||
erasure_recovery_rate REAL NOT NULL DEFAULT 0,
|
||||
tree_size INTEGER NOT NULL DEFAULT 0,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
)`,
|
||||
`CREATE INDEX IF NOT EXISTS idx_strain_cards_source ON strain_cards(source_agent_id)`,
|
||||
`CREATE TABLE IF NOT EXISTS pathtrace_sessions (
|
||||
id TEXT PRIMARY KEY,
|
||||
created_at DATETIME NOT NULL,
|
||||
@@ -248,6 +267,12 @@ func (d *Database) migrate() error {
|
||||
)`,
|
||||
`CREATE INDEX IF NOT EXISTS idx_pathtrace_sessions_created ON pathtrace_sessions(created_at)`,
|
||||
}
|
||||
if err := d.ensureStrainMemoryTable(); err != nil {
|
||||
return fmt.Errorf("strain_memory migration: %w", err)
|
||||
}
|
||||
if err := d.ensureSeerTables(); err != nil {
|
||||
return fmt.Errorf("seer migration: %w", err)
|
||||
}
|
||||
for _, m := range extraMigrations {
|
||||
if _, err := d.Exec(m); err != nil {
|
||||
return fmt.Errorf("migration failed: %w\nSQL: %s", err, m)
|
||||
|
||||
Reference in New Issue
Block a user