docs(reference): import Dune: Awakening server-manager references
All checks were successful
CI / backend-types (push) Successful in 10s
CI / frontend-build (push) Successful in 15s
CI / agent-tests (push) Successful in 39s
CI / integration (push) Successful in 22s

Phase 2 references for the host-agent Dune adapter, moved out of volatile /tmp
into docs/reference-repos/ (per Commander). Three upstream projects, .git +
node_modules + compiled binaries stripped (16MB source). Nested AI-instruction
files (.claude/, CLAUDE.md) removed so they don't pollute Corrosion sessions.

- icehunter/    dune-admin (Go+React) — 4 control planes; SETUP_DOCKER.md is the
                closest analog to our agent's Dune docker control plane (compose
                lifecycle, docker logs, RabbitMQ-via-exec, dune Postgres schema)
- adainrivers/  Rust/Tauri desktop — SSH+k8s BattleGroup control, maintenance
                daemon, in-game admin console (Rust idiom reference)
- the4rchangel/ Node web UI replacing battlegroup.bat — matches the Commander's
                Hyper-V self-host path + game-config schema

See docs/reference-repos/README.md for the full index + how we use each.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Vantz Stockwell
2026-06-11 21:08:05 -04:00
parent 0715492ddf
commit 651a35d4be
1334 changed files with 238971 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
-- create_event_log_partition_table(IN table_name text, IN partition_id bigint) -> void
-- oid: 58182 kind: PROCEDURE category: event_log
CREATE OR REPLACE PROCEDURE dune.create_event_log_partition_table(IN table_name text, IN partition_id bigint)
LANGUAGE plpgsql
AS $procedure$
DECLARE
start_range BIGINT;
end_range BIGINT;
partition_table_name TEXT;
BEGIN
start_range := partition_id;
end_range := partition_id + 1;
partition_table_name := format('%s_p%s', table_name, partition_id);
EXECUTE format('
CREATE TABLE IF NOT EXISTS %I PARTITION OF %I
FOR VALUES FROM (%s) TO (%s);
', partition_table_name, table_name, start_range, end_range);
END;
$procedure$

View File

@@ -0,0 +1,14 @@
-- landsraad_insert_tasks(IN in_term_id bigint, IN in_tasks dune.landsraadtask[], IN in_task_rewards dune.landsraadtaskreward[]) -> void
-- oid: 58417 kind: PROCEDURE category: landsraad
CREATE OR REPLACE PROCEDURE dune.landsraad_insert_tasks(IN in_term_id bigint, IN in_tasks dune.landsraadtask[], IN in_task_rewards dune.landsraadtaskreward[])
LANGUAGE plpgsql
AS $procedure$
BEGIN
INSERT INTO landsraad_tasks (term_id, board_index, house_name, goal_amount)
SELECT in_term_id, tasks.board_index, tasks.house_name, tasks.goal_amount FROM UNNEST(in_tasks) AS tasks;
INSERT INTO landsraad_task_rewards (task_id, threshold, template_id, amount)
SELECT tasks.id, task_rewards.threshold, task_rewards.template_id, task_rewards.amount FROM UNNEST(in_task_rewards) AS task_rewards
LEFT JOIN landsraad_tasks AS tasks ON task_rewards.house_name = tasks.house_name WHERE tasks.term_id = in_term_id;
END $procedure$

View File

@@ -0,0 +1,24 @@
-- landsraad_nominate_decrees_for_voting(IN last_active_decree_id bigint, IN num_decrees integer) -> void
-- oid: 58428 kind: PROCEDURE category: landsraad
CREATE OR REPLACE PROCEDURE dune.landsraad_nominate_decrees_for_voting(IN last_active_decree_id bigint, IN num_decrees integer)
LANGUAGE plpgsql
AS $procedure$
BEGIN
LOCK TABLE landsraad_decrees, landsraad_decree_rotation, landsraad_decree_votes IN EXCLUSIVE MODE;
TRUNCATE TABLE landsraad_decree_votes;
TRUNCATE TABLE landsraad_decree_rotation;
INSERT INTO landsraad_decree_rotation
SELECT id FROM landsraad_decrees
WHERE (
CASE WHEN last_active_decree_id IS NULL THEN
True
ELSE
last_active_decree_id != id
END
) AND disabled = FALSE
ORDER BY RANDOM() * weight DESC
LIMIT num_decrees;
END $procedure$

View File

@@ -0,0 +1,14 @@
-- landsraad_update_decrees(IN in_decrees dune.landsraaddecree[]) -> void
-- oid: 58434 kind: PROCEDURE category: landsraad
CREATE OR REPLACE PROCEDURE dune.landsraad_update_decrees(IN in_decrees dune.landsraaddecree[])
LANGUAGE plpgsql
AS $procedure$
BEGIN
UPDATE landsraad_decrees SET disabled = TRUE WHERE decree_name NOT IN (
SELECT(UNNEST(in_decrees)).decree_name
);
INSERT INTO landsraad_decrees (decree_name, version, disabled, weight)
SELECT decrees.decree_name, decrees.version, decrees.disabled, decrees.weight FROM UNNEST(in_decrees) AS decrees
ON CONFLICT(decree_name) DO UPDATE SET version = excluded.version, disabled = excluded.disabled, weight = excluded.weight;
END $procedure$

View File

@@ -0,0 +1,12 @@
-- landsraad_update_factions(IN in_faction_names text[]) -> void
-- oid: 58435 kind: PROCEDURE category: landsraad
CREATE OR REPLACE PROCEDURE dune.landsraad_update_factions(IN in_faction_names text[])
LANGUAGE plpgsql
AS $procedure$
BEGIN
WITH new_factions AS (
SELECT f FROM UNNEST(in_faction_names) f LEFT JOIN factions ON f = factions.name WHERE id IS NULL
)
INSERT INTO factions (name) SELECT * FROM new_factions;
END $procedure$

View File

@@ -0,0 +1,62 @@
-- setup_user_data_encryption(IN in_enable boolean) -> void
-- oid: 58597 kind: PROCEDURE category: encryption
CREATE OR REPLACE PROCEDURE dune.setup_user_data_encryption(IN in_enable boolean)
LANGUAGE plpgsql
AS $procedure$
declare
encryption_key Text;
encryption_key_hash bytea;
stored_encryption_key_hash bytea;
stored_encryption_status UserDataEncryptionStatus;
begin
select current_setting('funcom.user_data_encryption_key', true) into encryption_key;
-- might be null if the encryption_key is null
select ext.digest(encryption_key, 'md5') into encryption_key_hash;
-- might be null if the stored data is not encrypted
select get_stored_user_data_encryption_key_hash() into stored_encryption_key_hash;
-- should never be null
select get_stored_user_data_encryption_status() into stored_encryption_status;
drop index if exists encrypted_player_state_character_name_gin;
if stored_encryption_status = 'Disabled' then
if in_enable then
perform _user_data_encryption_setup_enabled(encryption_key_hash);
perform _user_data_encryption_initially_encrypt_existing_data();
else
-- technically we shouldn't do anything but let's just validate a few things
-- we not replacing get_stored_user_data_encryption_key_hash()
if (select get_stored_user_data_encryption_key_hash()) is not null then
-- should have been filtered by the main setup function
raise exception 'The data is encrypted, should use the taint version';
end if;
if (select get_stored_user_data_encryption_taint_xmax()) is not null then
-- should have been filtered by the main setup function
raise exception 'The data is tainted, should use the taint version';
end if;
end if;
elseif stored_encryption_status = 'Tainted' then
-- doesn't matter what we want, we get the tainted version
perform _user_data_encryption_setup_tainted();
else -- Enabled
if in_enable is null or in_enable then
if encryption_key_hash = stored_encryption_key_hash then -- and our key is the same
perform _user_data_encryption_setup_enabled(encryption_key_hash);
else
raise warning 'User-data encryption requested but the data is already encrypted with a different key';
perform _user_data_encryption_setup_tainted();
end if;
else
raise warning 'User-data encryption not requested but the data is already encrypted';
perform _user_data_encryption_setup_tainted();
end if;
end if;
commit;
CREATE INDEX encrypted_player_state_character_name_gin ON encrypted_player_state USING GIN((decrypt_user_data(encrypted_character_name)) ext.gin_trgm_ops);
end
$procedure$