openvibers/openvibe.bot Commits
Restore the applied migrations byte for byte (#417)
Changes
@@@ -25,9 +25,9 @@ CREATE TABLE robots (profile_version integer NOT NULL DEFAULT 1,access_policy text NOT NULL DEFAULT 'private' CHECK (access_policy IN ('private', 'invite', 'queue')),limits jsonb NOT NULL DEFAULT '{}', -- owner-set: max_speed, max_turn, max_command_ms, turn_ms, turn_budget, cooldown_ms, allow-- estop_latched boolean NOT NULL DEFAULT false, -- legacy stop latch, no longer read or written; contract-migration later-- estop_by text, -- legacy: who latched it; unused-- estop_at timestamptz, -- legacy; unused++ estop_latched boolean NOT NULL DEFAULT false,++ estop_by text, -- the principal that latched it, or 'device'++ estop_at timestamptz,created_at timestamptz NOT NULL,updated_at timestamptz NOT NULL);@@@ -94,7 +94,7 @@ CREATE TABLE command_audit (operator_subject text, -- the person, or the subject a service acted foroperator_kind text, -- user | servicerole text, -- owner | operator | viewer | null-- kind text, -- drive | actuator | ptz | say | display | halt++ kind text, -- drive | actuator | ptz | say | display | halt | estopvalue jsonb NOT NULL DEFAULT '{}', -- a small summary (clamped axes, servo, text length), never a credentialresult text NOT NULL CHECK (result IN ('ack', 'nack', 'refused', 'expired')),reason text,@@@ -2,7 +2,7 @@---- The owner's agent (plan T15 "an Actor agent can pilot a robot under the owner's grant", always through Bot): with-- agent_control on, the owner's OpenVibe.Actor agent may send this robot commands as the owner (Actor's service token,++-- grant bot.robot.control, X-OV-Subject = the owner). Bot's gate, limits and e-stop still decide every command; the-- device's deadman still stops it. Off for every robot until its owner turns it on. Additive only.ALTER TABLE robots ADD COLUMN agent_control boolean NOT NULL DEFAULT false;@@@ -1,8 +1,8 @@-- phase: expand-- LOOI Operators card (Maticus's 2026-11-12 spec): a Mod role between the owner and operators, a per-person-- on/off switch that the command gate reads before it forwards anything, sole control for one subject, and an++-- audit of who changed authority. Panel E-STOP stays the robots.estop_latched latch; the tray's local STOP and++-- ARM are never touched by this table.ALTER TABLE robot_operators DROP CONSTRAINT IF EXISTS robot_operators_role_check;ALTER TABLE robot_operators ADD CONSTRAINT robot_operators_role_check CHECK (role IN ('owner', 'operator', 'viewer', 'mod'));ALTER TABLE robot_operators ADD COLUMN IF NOT EXISTS enabled boolean NOT NULL DEFAULT true;@@@ -17,7 +17,7 @@ CREATE TABLE IF NOT EXISTS robot_operator_control ();-- Authority changes: who granted sole control, switched someone on or off, promoted or demoted a Mod, or++-- tripped/cleared the panel E-STOP. Subjects and roles only: no command values, tokens or secrets.CREATE TABLE IF NOT EXISTS robot_operator_audit (id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,robot_id text NOT NULL,
@@ -25,9 +25,9 @@ CREATE TABLE robots (
@@ -25,9 +25,9 @@ CREATE TABLE robots (
profile_version integer NOT NULL DEFAULT 1,
profile_version integer NOT NULL DEFAULT 1,
access_policy text NOT NULL DEFAULT 'private' CHECK (access_policy IN ('private', 'invite', 'queue')),
access_policy text NOT NULL DEFAULT 'private' CHECK (access_policy IN ('private', 'invite', 'queue')),
limits jsonb NOT NULL DEFAULT '{}', -- owner-set: max_speed, max_turn, max_command_ms, turn_ms, turn_budget, cooldown_ms, allow
limits jsonb NOT NULL DEFAULT '{}', -- owner-set: max_speed, max_turn, max_command_ms, turn_ms, turn_budget, cooldown_ms, allow
- estop_latched boolean NOT NULL DEFAULT false, -- legacy stop latch, no longer read or written; contract-migration later
- estop_by text, -- legacy: who latched it; unused
- estop_at timestamptz, -- legacy; unused
+ estop_latched boolean NOT NULL DEFAULT false,
+ estop_by text, -- the principal that latched it, or 'device'
+ estop_at timestamptz,
created_at timestamptz NOT NULL,
created_at timestamptz NOT NULL,
updated_at timestamptz NOT NULL
updated_at timestamptz NOT NULL
);
);
@@ -94,7 +94,7 @@ CREATE TABLE command_audit (
@@ -94,7 +94,7 @@ CREATE TABLE command_audit (
operator_subject text, -- the person, or the subject a service acted for
operator_subject text, -- the person, or the subject a service acted for
operator_kind text, -- user | service
operator_kind text, -- user | service
role text, -- owner | operator | viewer | null
role text, -- owner | operator | viewer | null
- kind text, -- drive | actuator | ptz | say | display | halt
+ kind text, -- drive | actuator | ptz | say | display | halt | estop
value jsonb NOT NULL DEFAULT '{}', -- a small summary (clamped axes, servo, text length), never a credential
value jsonb NOT NULL DEFAULT '{}', -- a small summary (clamped axes, servo, text length), never a credential
result text NOT NULL CHECK (result IN ('ack', 'nack', 'refused', 'expired')),
result text NOT NULL CHECK (result IN ('ack', 'nack', 'refused', 'expired')),
reason text,
reason text,
@@ -2,7 +2,7 @@
@@ -2,7 +2,7 @@
--
--
-- The owner's agent (plan T15 "an Actor agent can pilot a robot under the owner's grant", always through Bot): with
-- The owner's agent (plan T15 "an Actor agent can pilot a robot under the owner's grant", always through Bot): with
-- agent_control on, the owner's OpenVibe.Actor agent may send this robot commands as the owner (Actor's service token,
-- agent_control on, the owner's OpenVibe.Actor agent may send this robot commands as the owner (Actor's service token,
+-- grant bot.robot.control, X-OV-Subject = the owner). Bot's gate, limits and e-stop still decide every command; the
-- device's deadman still stops it. Off for every robot until its owner turns it on. Additive only.
-- device's deadman still stops it. Off for every robot until its owner turns it on. Additive only.
ALTER TABLE robots ADD COLUMN agent_control boolean NOT NULL DEFAULT false;
ALTER TABLE robots ADD COLUMN agent_control boolean NOT NULL DEFAULT false;
@@ -1,8 +1,8 @@
@@ -1,8 +1,8 @@
-- phase: expand
-- phase: expand
-- LOOI Operators card (Maticus's 2026-11-12 spec): a Mod role between the owner and operators, a per-person
-- LOOI Operators card (Maticus's 2026-11-12 spec): a Mod role between the owner and operators, a per-person
-- on/off switch that the command gate reads before it forwards anything, sole control for one subject, and an
-- on/off switch that the command gate reads before it forwards anything, sole control for one subject, and an
+-- audit of who changed authority. Panel E-STOP stays the robots.estop_latched latch; the tray's local STOP and
+-- ARM are never touched by this table.
ALTER TABLE robot_operators DROP CONSTRAINT IF EXISTS robot_operators_role_check;
ALTER TABLE robot_operators DROP CONSTRAINT IF EXISTS robot_operators_role_check;
ALTER TABLE robot_operators ADD CONSTRAINT robot_operators_role_check CHECK (role IN ('owner', 'operator', 'viewer', 'mod'));
ALTER TABLE robot_operators ADD CONSTRAINT robot_operators_role_check CHECK (role IN ('owner', 'operator', 'viewer', 'mod'));
ALTER TABLE robot_operators ADD COLUMN IF NOT EXISTS enabled boolean NOT NULL DEFAULT true;
ALTER TABLE robot_operators ADD COLUMN IF NOT EXISTS enabled boolean NOT NULL DEFAULT true;
@@ -17,7 +17,7 @@ CREATE TABLE IF NOT EXISTS robot_operator_control (
@@ -17,7 +17,7 @@ CREATE TABLE IF NOT EXISTS robot_operator_control (
);
);
-- Authority changes: who granted sole control, switched someone on or off, promoted or demoted a Mod, or
-- Authority changes: who granted sole control, switched someone on or off, promoted or demoted a Mod, or
+-- tripped/cleared the panel E-STOP. Subjects and roles only: no command values, tokens or secrets.
CREATE TABLE IF NOT EXISTS robot_operator_audit (
CREATE TABLE IF NOT EXISTS robot_operator_audit (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
robot_id text NOT NULL,
robot_id text NOT NULL,