From c3357f92d9e5b0c804fc342ecec7409bb9e11da1 Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Wed, 4 Feb 2026 20:21:33 +0530 Subject: [PATCH] feat(agents): Add identity and soul template fields to board creation --- ...b3eda_add_agent_heartbeat_config_column.py | 27 - backend/alembic/versions/5630abfa60f8_init.py | 574 ------- ...69858cb75533_add_agent_heartbeat_config.py | 29 - ...330227_add_agent_provision_confirmation.py | 41 - ...3d9b8c1f4a_add_boards_and_task_board_id.py | 64 - .../8045fbfb157f_add_task_assigned_agent.py | 36 - .../versions/8b6d1b8f4b21_drop_projects.py | 63 - backend/alembic/versions/939a1d2dc607_init.py | 147 ++ .../9c4f1a2b3d4e_drop_tenancy_tables.py | 56 - ...c3d4e5f6_add_agents_and_activity_events.py | 70 - .../b9d22e2a4d50_add_task_comments_index.py | 29 - .../c1a2b3c4d5e7_add_task_in_progress_at.py | 31 - .../c7f0a2b1d4e3_add_agent_session_id.py | 38 - ...f25d4634_ensure_heartbeat_config_column.py | 29 - .../d3e4f5a6b7c8_add_agent_token_hash.py | 38 - ...28e965fa5_add_agent_delete_confirmation.py | 35 - ...5a6b7c8d9_make_agent_last_seen_nullable.py | 27 - .../f1a2b3c4d5e6_add_board_gateway_config.py | 47 - backend/app/api/agents.py | 16 +- backend/app/api/boards.py | 8 + backend/app/api/tasks.py | 19 +- backend/app/api/users.py | 36 + backend/app/core/config.py | 5 + backend/app/core/logging.py | 171 +- backend/app/core/version.py | 2 + backend/app/main.py | 12 + backend/app/models/boards.py | 2 + backend/app/models/users.py | 5 + backend/app/schemas/__init__.py | 3 +- backend/app/schemas/boards.py | 4 + backend/app/schemas/users.py | 14 + backend/app/services/agent_provisioning.py | 51 +- frontend/next.config.ts | 9 + frontend/package-lock.json | 55 + frontend/package.json | 2 + .../src/api/generated/activity/activity.ts | 238 +++ frontend/src/api/generated/agents/agents.ts | 1315 +++++++++++++++ frontend/src/api/generated/auth/auth.ts | 121 ++ frontend/src/api/generated/boards/boards.ts | 767 +++++++++ frontend/src/api/generated/default/default.ts | 515 ++++++ frontend/src/api/generated/gateway/gateway.ts | 1416 +++++++++++++++++ .../api/generated/model/activityEventRead.ts | 15 + .../src/api/generated/model/agentCreate.ts | 14 + .../model/agentCreateHeartbeatConfig.ts | 8 + .../api/generated/model/agentDeleteConfirm.ts | 10 + .../src/api/generated/model/agentHeartbeat.ts | 10 + .../generated/model/agentHeartbeatCreate.ts | 12 + .../generated/model/agentProvisionConfirm.ts | 11 + frontend/src/api/generated/model/agentRead.ts | 19 + .../model/agentReadHeartbeatConfig.ts | 8 + .../src/api/generated/model/agentUpdate.ts | 14 + .../model/agentUpdateHeartbeatConfig.ts | 8 + .../src/api/generated/model/boardCreate.ts | 17 + frontend/src/api/generated/model/boardRead.ts | 19 + .../src/api/generated/model/boardUpdate.ts | 17 + ...tApiV1AgentsAgentIdDeleteConfirmPost200.ts | 10 + ...iV1AgentsAgentIdProvisionConfirmPost200.ts | 10 + .../deleteAgentApiV1AgentsAgentIdDelete200.ts | 8 + .../deleteBoardApiV1BoardsBoardIdDelete200.ts | 8 + ...kApiV1BoardsBoardIdTasksTaskIdDelete200.ts | 10 + ...tewayCommandsApiV1GatewayCommandsGet200.ts | 10 + .../gatewayStatusApiV1GatewayStatusGet200.ts | 8 + ...atewayStatusApiV1GatewayStatusGetParams.ts | 10 + ...sionApiV1GatewaySessionsSessionIdGet200.ts | 10 + ...nApiV1GatewaySessionsSessionIdGetParams.ts | 10 + ...V1GatewaySessionsSessionIdHistoryGet200.ts | 10 + ...atewaySessionsSessionIdHistoryGetParams.ts | 10 + .../generated/model/hTTPValidationError.ts | 11 + .../api/generated/model/healthHealthGet200.ts | 8 + .../generated/model/healthzHealthzGet200.ts | 8 + frontend/src/api/generated/model/index.ts | 52 + .../listActivityApiV1ActivityGetParams.ts | 18 + .../listSessionsApiV1GatewaySessionsGet200.ts | 8 + ...stSessionsApiV1GatewaySessionsGetParams.ts | 10 + ...stTasksApiV1BoardsBoardIdTasksGetParams.ts | 13 + .../api/generated/model/readyzReadyzGet200.ts | 8 + ...1GatewaySessionsSessionIdMessagePost200.ts | 10 + ...GatewaySessionsSessionIdMessagePostBody.ts | 10 + ...tewaySessionsSessionIdMessagePostParams.ts | 10 + .../api/generated/model/taskCommentCreate.ts | 10 + .../api/generated/model/taskCommentRead.ts | 14 + .../src/api/generated/model/taskCreate.ts | 16 + frontend/src/api/generated/model/taskRead.ts | 21 + .../src/api/generated/model/taskUpdate.ts | 16 + frontend/src/api/generated/model/userRead.ts | 19 + .../src/api/generated/model/userUpdate.ts | 15 + .../api/generated/model/validationError.ts | 12 + frontend/src/api/generated/tasks/tasks.ts | 1091 +++++++++++++ frontend/src/api/generated/users/users.ts | 314 ++++ frontend/src/api/mutator.ts | 6 +- .../src/app/agents/[agentId]/edit/page.tsx | 5 +- frontend/src/app/agents/[agentId]/page.tsx | 5 +- frontend/src/app/agents/new/page.tsx | 5 +- frontend/src/app/agents/page.tsx | 5 +- .../src/app/boards/[boardId]/edit/page.tsx | 36 +- frontend/src/app/boards/[boardId]/page.tsx | 5 +- frontend/src/app/boards/new/page.tsx | 38 +- frontend/src/app/boards/page.tsx | 5 +- frontend/src/app/dashboard/page.tsx | 4 +- frontend/src/app/onboarding/page.tsx | 275 ++++ .../src/components/organisms/LandingHero.tsx | 4 +- .../src/components/organisms/UserMenu.tsx | 91 ++ .../components/templates/DashboardShell.tsx | 9 +- .../src/components/templates/LandingShell.tsx | 7 +- frontend/src/components/ui/command.tsx | 133 ++ .../src/components/ui/dropdown-select.tsx | 215 +++ frontend/src/components/ui/popover.tsx | 31 + .../src/components/ui/searchable-select.tsx | 62 + frontend/src/lib/api-base.ts | 11 + templates/AGENTS.md | 1 + templates/BOOT.md | 12 +- templates/BOOTSTRAP.md | 27 +- templates/HEARTBEAT.md | 14 +- templates/IDENTITY.md | 4 + templates/SOUL.md | 42 +- templates/TOOLS.md | 5 +- templates/USER.md | 24 +- 117 files changed, 7899 insertions(+), 1339 deletions(-) delete mode 100644 backend/alembic/versions/2b4c2f7b3eda_add_agent_heartbeat_config_column.py delete mode 100644 backend/alembic/versions/5630abfa60f8_init.py delete mode 100644 backend/alembic/versions/69858cb75533_add_agent_heartbeat_config.py delete mode 100644 backend/alembic/versions/6df47d330227_add_agent_provision_confirmation.py delete mode 100644 backend/alembic/versions/7e3d9b8c1f4a_add_boards_and_task_board_id.py delete mode 100644 backend/alembic/versions/8045fbfb157f_add_task_assigned_agent.py delete mode 100644 backend/alembic/versions/8b6d1b8f4b21_drop_projects.py create mode 100644 backend/alembic/versions/939a1d2dc607_init.py delete mode 100644 backend/alembic/versions/9c4f1a2b3d4e_drop_tenancy_tables.py delete mode 100644 backend/alembic/versions/a1b2c3d4e5f6_add_agents_and_activity_events.py delete mode 100644 backend/alembic/versions/b9d22e2a4d50_add_task_comments_index.py delete mode 100644 backend/alembic/versions/c1a2b3c4d5e7_add_task_in_progress_at.py delete mode 100644 backend/alembic/versions/c7f0a2b1d4e3_add_agent_session_id.py delete mode 100644 backend/alembic/versions/cefef25d4634_ensure_heartbeat_config_column.py delete mode 100644 backend/alembic/versions/d3e4f5a6b7c8_add_agent_token_hash.py delete mode 100644 backend/alembic/versions/e0f28e965fa5_add_agent_delete_confirmation.py delete mode 100644 backend/alembic/versions/e4f5a6b7c8d9_make_agent_last_seen_nullable.py delete mode 100644 backend/alembic/versions/f1a2b3c4d5e6_add_board_gateway_config.py create mode 100644 backend/app/api/users.py create mode 100644 backend/app/core/version.py create mode 100644 frontend/src/api/generated/activity/activity.ts create mode 100644 frontend/src/api/generated/agents/agents.ts create mode 100644 frontend/src/api/generated/auth/auth.ts create mode 100644 frontend/src/api/generated/boards/boards.ts create mode 100644 frontend/src/api/generated/default/default.ts create mode 100644 frontend/src/api/generated/gateway/gateway.ts create mode 100644 frontend/src/api/generated/model/activityEventRead.ts create mode 100644 frontend/src/api/generated/model/agentCreate.ts create mode 100644 frontend/src/api/generated/model/agentCreateHeartbeatConfig.ts create mode 100644 frontend/src/api/generated/model/agentDeleteConfirm.ts create mode 100644 frontend/src/api/generated/model/agentHeartbeat.ts create mode 100644 frontend/src/api/generated/model/agentHeartbeatCreate.ts create mode 100644 frontend/src/api/generated/model/agentProvisionConfirm.ts create mode 100644 frontend/src/api/generated/model/agentRead.ts create mode 100644 frontend/src/api/generated/model/agentReadHeartbeatConfig.ts create mode 100644 frontend/src/api/generated/model/agentUpdate.ts create mode 100644 frontend/src/api/generated/model/agentUpdateHeartbeatConfig.ts create mode 100644 frontend/src/api/generated/model/boardCreate.ts create mode 100644 frontend/src/api/generated/model/boardRead.ts create mode 100644 frontend/src/api/generated/model/boardUpdate.ts create mode 100644 frontend/src/api/generated/model/confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost200.ts create mode 100644 frontend/src/api/generated/model/confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost200.ts create mode 100644 frontend/src/api/generated/model/deleteAgentApiV1AgentsAgentIdDelete200.ts create mode 100644 frontend/src/api/generated/model/deleteBoardApiV1BoardsBoardIdDelete200.ts create mode 100644 frontend/src/api/generated/model/deleteTaskApiV1BoardsBoardIdTasksTaskIdDelete200.ts create mode 100644 frontend/src/api/generated/model/gatewayCommandsApiV1GatewayCommandsGet200.ts create mode 100644 frontend/src/api/generated/model/gatewayStatusApiV1GatewayStatusGet200.ts create mode 100644 frontend/src/api/generated/model/gatewayStatusApiV1GatewayStatusGetParams.ts create mode 100644 frontend/src/api/generated/model/getGatewaySessionApiV1GatewaySessionsSessionIdGet200.ts create mode 100644 frontend/src/api/generated/model/getGatewaySessionApiV1GatewaySessionsSessionIdGetParams.ts create mode 100644 frontend/src/api/generated/model/getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet200.ts create mode 100644 frontend/src/api/generated/model/getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams.ts create mode 100644 frontend/src/api/generated/model/hTTPValidationError.ts create mode 100644 frontend/src/api/generated/model/healthHealthGet200.ts create mode 100644 frontend/src/api/generated/model/healthzHealthzGet200.ts create mode 100644 frontend/src/api/generated/model/index.ts create mode 100644 frontend/src/api/generated/model/listActivityApiV1ActivityGetParams.ts create mode 100644 frontend/src/api/generated/model/listSessionsApiV1GatewaySessionsGet200.ts create mode 100644 frontend/src/api/generated/model/listSessionsApiV1GatewaySessionsGetParams.ts create mode 100644 frontend/src/api/generated/model/listTasksApiV1BoardsBoardIdTasksGetParams.ts create mode 100644 frontend/src/api/generated/model/readyzReadyzGet200.ts create mode 100644 frontend/src/api/generated/model/sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost200.ts create mode 100644 frontend/src/api/generated/model/sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody.ts create mode 100644 frontend/src/api/generated/model/sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams.ts create mode 100644 frontend/src/api/generated/model/taskCommentCreate.ts create mode 100644 frontend/src/api/generated/model/taskCommentRead.ts create mode 100644 frontend/src/api/generated/model/taskCreate.ts create mode 100644 frontend/src/api/generated/model/taskRead.ts create mode 100644 frontend/src/api/generated/model/taskUpdate.ts create mode 100644 frontend/src/api/generated/model/userRead.ts create mode 100644 frontend/src/api/generated/model/userUpdate.ts create mode 100644 frontend/src/api/generated/model/validationError.ts create mode 100644 frontend/src/api/generated/tasks/tasks.ts create mode 100644 frontend/src/api/generated/users/users.ts create mode 100644 frontend/src/app/onboarding/page.tsx create mode 100644 frontend/src/components/organisms/UserMenu.tsx create mode 100644 frontend/src/components/ui/command.tsx create mode 100644 frontend/src/components/ui/dropdown-select.tsx create mode 100644 frontend/src/components/ui/popover.tsx create mode 100644 frontend/src/components/ui/searchable-select.tsx create mode 100644 frontend/src/lib/api-base.ts diff --git a/backend/alembic/versions/2b4c2f7b3eda_add_agent_heartbeat_config_column.py b/backend/alembic/versions/2b4c2f7b3eda_add_agent_heartbeat_config_column.py deleted file mode 100644 index dec703c4..00000000 --- a/backend/alembic/versions/2b4c2f7b3eda_add_agent_heartbeat_config_column.py +++ /dev/null @@ -1,27 +0,0 @@ -"""add agent heartbeat config column - -Revision ID: 2b4c2f7b3eda -Revises: 69858cb75533 -Create Date: 2026-02-04 16:36:55.587762 - -""" -from __future__ import annotations - -from alembic import op - - -# revision identifiers, used by Alembic. -revision = '2b4c2f7b3eda' -down_revision = '69858cb75533' -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.execute( - "ALTER TABLE agents ADD COLUMN IF NOT EXISTS heartbeat_config JSON" - ) - - -def downgrade() -> None: - op.execute("ALTER TABLE agents DROP COLUMN IF EXISTS heartbeat_config") diff --git a/backend/alembic/versions/5630abfa60f8_init.py b/backend/alembic/versions/5630abfa60f8_init.py deleted file mode 100644 index 7bac0957..00000000 --- a/backend/alembic/versions/5630abfa60f8_init.py +++ /dev/null @@ -1,574 +0,0 @@ -"""init - -Revision ID: 5630abfa60f8 -Revises: -Create Date: 2026-02-03 17:52:47.887105 - -""" - -from __future__ import annotations - -from alembic import op -import sqlalchemy as sa -import sqlmodel - - -# revision identifiers, used by Alembic. -revision = "5630abfa60f8" -down_revision = None -branch_labels = None -depends_on = None - - -def upgrade() -> None: - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "orgs", - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("slug", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_orgs_slug"), "orgs", ["slug"], unique=True) - op.create_table( - "users", - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("clerk_user_id", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), - sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), - sa.Column("is_super_admin", sa.Boolean(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_users_clerk_user_id"), "users", ["clerk_user_id"], unique=True) - op.create_index(op.f("ix_users_email"), "users", ["email"], unique=False) - op.create_table( - "workspaces", - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("slug", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_workspaces_org_id"), "workspaces", ["org_id"], unique=False) - op.create_index(op.f("ix_workspaces_slug"), "workspaces", ["slug"], unique=False) - op.create_table( - "agents", - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("workspace_id", sa.Uuid(), nullable=False), - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("role", sqlmodel.sql.sqltypes.AutoString(), nullable=True), - sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("openclaw_session_id", sqlmodel.sql.sqltypes.AutoString(), nullable=True), - sa.Column("api_token_hash", sqlmodel.sql.sqltypes.AutoString(), nullable=True), - sa.Column("api_token_last_used_at", sa.DateTime(), nullable=True), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.Column("updated_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.ForeignKeyConstraint( - ["workspace_id"], - ["workspaces.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index( - op.f("ix_agents_openclaw_session_id"), "agents", ["openclaw_session_id"], unique=False - ) - op.create_index(op.f("ix_agents_org_id"), "agents", ["org_id"], unique=False) - op.create_index(op.f("ix_agents_workspace_id"), "agents", ["workspace_id"], unique=False) - op.create_table( - "gateway_configs", - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("workspace_id", sa.Uuid(), nullable=True), - sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("base_url", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("token", sqlmodel.sql.sqltypes.AutoString(), nullable=True), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.ForeignKeyConstraint( - ["workspace_id"], - ["workspaces.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_gateway_configs_org_id"), "gateway_configs", ["org_id"], unique=False) - op.create_index( - op.f("ix_gateway_configs_workspace_id"), "gateway_configs", ["workspace_id"], unique=False - ) - op.create_table( - "memberships", - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("workspace_id", sa.Uuid(), nullable=False), - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("user_id", sa.Uuid(), nullable=False), - sa.Column("role", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.ForeignKeyConstraint( - ["user_id"], - ["users.id"], - ), - sa.ForeignKeyConstraint( - ["workspace_id"], - ["workspaces.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_memberships_org_id"), "memberships", ["org_id"], unique=False) - op.create_index(op.f("ix_memberships_user_id"), "memberships", ["user_id"], unique=False) - op.create_index( - op.f("ix_memberships_workspace_id"), "memberships", ["workspace_id"], unique=False - ) - op.create_table( - "orchestration_templates", - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("workspace_id", sa.Uuid(), nullable=False), - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("kind", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("title", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("template_markdown", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.Column("updated_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.ForeignKeyConstraint( - ["workspace_id"], - ["workspaces.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index( - op.f("ix_orchestration_templates_kind"), "orchestration_templates", ["kind"], unique=False - ) - op.create_index( - op.f("ix_orchestration_templates_org_id"), - "orchestration_templates", - ["org_id"], - unique=False, - ) - op.create_index( - op.f("ix_orchestration_templates_workspace_id"), - "orchestration_templates", - ["workspace_id"], - unique=False, - ) - op.create_table( - "projects", - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("workspace_id", sa.Uuid(), nullable=False), - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("description", sqlmodel.sql.sqltypes.AutoString(), nullable=True), - sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.Column("updated_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.ForeignKeyConstraint( - ["workspace_id"], - ["workspaces.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_projects_org_id"), "projects", ["org_id"], unique=False) - op.create_index(op.f("ix_projects_status"), "projects", ["status"], unique=False) - op.create_index(op.f("ix_projects_workspace_id"), "projects", ["workspace_id"], unique=False) - op.create_table( - "workspace_api_tokens", - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("workspace_id", sa.Uuid(), nullable=False), - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("token_hash", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("label", sqlmodel.sql.sqltypes.AutoString(), nullable=True), - sa.Column("last_used_at", sa.DateTime(), nullable=True), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.ForeignKeyConstraint( - ["workspace_id"], - ["workspaces.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index( - op.f("ix_workspace_api_tokens_org_id"), "workspace_api_tokens", ["org_id"], unique=False - ) - op.create_index( - op.f("ix_workspace_api_tokens_token_hash"), - "workspace_api_tokens", - ["token_hash"], - unique=True, - ) - op.create_index( - op.f("ix_workspace_api_tokens_workspace_id"), - "workspace_api_tokens", - ["workspace_id"], - unique=False, - ) - op.create_table( - "openclaw_sessions", - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("workspace_id", sa.Uuid(), nullable=False), - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("session_id", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("agent_id", sa.Uuid(), nullable=True), - sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("last_seen_at", sa.DateTime(), nullable=True), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint( - ["agent_id"], - ["agents.id"], - ), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.ForeignKeyConstraint( - ["workspace_id"], - ["workspaces.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index( - op.f("ix_openclaw_sessions_org_id"), "openclaw_sessions", ["org_id"], unique=False - ) - op.create_index( - op.f("ix_openclaw_sessions_session_id"), "openclaw_sessions", ["session_id"], unique=True - ) - op.create_index( - op.f("ix_openclaw_sessions_status"), "openclaw_sessions", ["status"], unique=False - ) - op.create_index( - op.f("ix_openclaw_sessions_workspace_id"), - "openclaw_sessions", - ["workspace_id"], - unique=False, - ) - op.create_table( - "tasks", - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("workspace_id", sa.Uuid(), nullable=False), - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("project_id", sa.Uuid(), nullable=False), - sa.Column("title", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("description", sqlmodel.sql.sqltypes.AutoString(), nullable=True), - sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("priority", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("due_at", sa.DateTime(), nullable=True), - sa.Column("assigned_agent_id", sa.Uuid(), nullable=True), - sa.Column("created_by_user_id", sa.Uuid(), nullable=True), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.Column("updated_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint( - ["assigned_agent_id"], - ["agents.id"], - ), - sa.ForeignKeyConstraint( - ["created_by_user_id"], - ["users.id"], - ), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.ForeignKeyConstraint( - ["project_id"], - ["projects.id"], - ), - sa.ForeignKeyConstraint( - ["workspace_id"], - ["workspaces.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index( - op.f("ix_tasks_assigned_agent_id"), "tasks", ["assigned_agent_id"], unique=False - ) - op.create_index( - op.f("ix_tasks_created_by_user_id"), "tasks", ["created_by_user_id"], unique=False - ) - op.create_index(op.f("ix_tasks_org_id"), "tasks", ["org_id"], unique=False) - op.create_index(op.f("ix_tasks_priority"), "tasks", ["priority"], unique=False) - op.create_index(op.f("ix_tasks_project_id"), "tasks", ["project_id"], unique=False) - op.create_index(op.f("ix_tasks_status"), "tasks", ["status"], unique=False) - op.create_index(op.f("ix_tasks_workspace_id"), "tasks", ["workspace_id"], unique=False) - op.create_table( - "task_activities", - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("workspace_id", sa.Uuid(), nullable=False), - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("task_id", sa.Uuid(), nullable=False), - sa.Column("activity_type", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("message", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("actor_user_id", sa.Uuid(), nullable=True), - sa.Column("actor_agent_id", sa.Uuid(), nullable=True), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint( - ["actor_agent_id"], - ["agents.id"], - ), - sa.ForeignKeyConstraint( - ["actor_user_id"], - ["users.id"], - ), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.ForeignKeyConstraint( - ["task_id"], - ["tasks.id"], - ), - sa.ForeignKeyConstraint( - ["workspace_id"], - ["workspaces.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_task_activities_org_id"), "task_activities", ["org_id"], unique=False) - op.create_index( - op.f("ix_task_activities_task_id"), "task_activities", ["task_id"], unique=False - ) - op.create_index( - op.f("ix_task_activities_workspace_id"), "task_activities", ["workspace_id"], unique=False - ) - op.create_table( - "task_deliverables", - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("workspace_id", sa.Uuid(), nullable=False), - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("task_id", sa.Uuid(), nullable=False), - sa.Column("title", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("markdown_content", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("created_by_user_id", sa.Uuid(), nullable=True), - sa.Column("created_by_agent_id", sa.Uuid(), nullable=True), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint( - ["created_by_agent_id"], - ["agents.id"], - ), - sa.ForeignKeyConstraint( - ["created_by_user_id"], - ["users.id"], - ), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.ForeignKeyConstraint( - ["task_id"], - ["tasks.id"], - ), - sa.ForeignKeyConstraint( - ["workspace_id"], - ["workspaces.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index( - op.f("ix_task_deliverables_org_id"), "task_deliverables", ["org_id"], unique=False - ) - op.create_index( - op.f("ix_task_deliverables_task_id"), "task_deliverables", ["task_id"], unique=False - ) - op.create_index( - op.f("ix_task_deliverables_workspace_id"), - "task_deliverables", - ["workspace_id"], - unique=False, - ) - op.create_table( - "task_status_history", - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("workspace_id", sa.Uuid(), nullable=False), - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("task_id", sa.Uuid(), nullable=False), - sa.Column("from_status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), - sa.Column("to_status", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("actor_user_id", sa.Uuid(), nullable=True), - sa.Column("actor_agent_id", sa.Uuid(), nullable=True), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint( - ["actor_agent_id"], - ["agents.id"], - ), - sa.ForeignKeyConstraint( - ["actor_user_id"], - ["users.id"], - ), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.ForeignKeyConstraint( - ["task_id"], - ["tasks.id"], - ), - sa.ForeignKeyConstraint( - ["workspace_id"], - ["workspaces.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index( - op.f("ix_task_status_history_org_id"), "task_status_history", ["org_id"], unique=False - ) - op.create_index( - op.f("ix_task_status_history_task_id"), "task_status_history", ["task_id"], unique=False - ) - op.create_index( - op.f("ix_task_status_history_workspace_id"), - "task_status_history", - ["workspace_id"], - unique=False, - ) - op.create_table( - "task_subagents", - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("workspace_id", sa.Uuid(), nullable=False), - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("task_id", sa.Uuid(), nullable=False), - sa.Column("agent_name", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("openclaw_session_id", sqlmodel.sql.sqltypes.AutoString(), nullable=True), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.ForeignKeyConstraint( - ["task_id"], - ["tasks.id"], - ), - sa.ForeignKeyConstraint( - ["workspace_id"], - ["workspaces.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_task_subagents_org_id"), "task_subagents", ["org_id"], unique=False) - op.create_index(op.f("ix_task_subagents_task_id"), "task_subagents", ["task_id"], unique=False) - op.create_index( - op.f("ix_task_subagents_workspace_id"), "task_subagents", ["workspace_id"], unique=False - ) - op.create_table( - "transcripts", - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("workspace_id", sa.Uuid(), nullable=False), - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("task_id", sa.Uuid(), nullable=True), - sa.Column("session_id", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("full_text", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.ForeignKeyConstraint( - ["task_id"], - ["tasks.id"], - ), - sa.ForeignKeyConstraint( - ["workspace_id"], - ["workspaces.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_transcripts_org_id"), "transcripts", ["org_id"], unique=False) - op.create_index(op.f("ix_transcripts_session_id"), "transcripts", ["session_id"], unique=False) - op.create_index(op.f("ix_transcripts_task_id"), "transcripts", ["task_id"], unique=False) - op.create_index( - op.f("ix_transcripts_workspace_id"), "transcripts", ["workspace_id"], unique=False - ) - # ### end Alembic commands ### - - -def downgrade() -> None: - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f("ix_transcripts_workspace_id"), table_name="transcripts") - op.drop_index(op.f("ix_transcripts_task_id"), table_name="transcripts") - op.drop_index(op.f("ix_transcripts_session_id"), table_name="transcripts") - op.drop_index(op.f("ix_transcripts_org_id"), table_name="transcripts") - op.drop_table("transcripts") - op.drop_index(op.f("ix_task_subagents_workspace_id"), table_name="task_subagents") - op.drop_index(op.f("ix_task_subagents_task_id"), table_name="task_subagents") - op.drop_index(op.f("ix_task_subagents_org_id"), table_name="task_subagents") - op.drop_table("task_subagents") - op.drop_index(op.f("ix_task_status_history_workspace_id"), table_name="task_status_history") - op.drop_index(op.f("ix_task_status_history_task_id"), table_name="task_status_history") - op.drop_index(op.f("ix_task_status_history_org_id"), table_name="task_status_history") - op.drop_table("task_status_history") - op.drop_index(op.f("ix_task_deliverables_workspace_id"), table_name="task_deliverables") - op.drop_index(op.f("ix_task_deliverables_task_id"), table_name="task_deliverables") - op.drop_index(op.f("ix_task_deliverables_org_id"), table_name="task_deliverables") - op.drop_table("task_deliverables") - op.drop_index(op.f("ix_task_activities_workspace_id"), table_name="task_activities") - op.drop_index(op.f("ix_task_activities_task_id"), table_name="task_activities") - op.drop_index(op.f("ix_task_activities_org_id"), table_name="task_activities") - op.drop_table("task_activities") - op.drop_index(op.f("ix_tasks_workspace_id"), table_name="tasks") - op.drop_index(op.f("ix_tasks_status"), table_name="tasks") - op.drop_index(op.f("ix_tasks_project_id"), table_name="tasks") - op.drop_index(op.f("ix_tasks_priority"), table_name="tasks") - op.drop_index(op.f("ix_tasks_org_id"), table_name="tasks") - op.drop_index(op.f("ix_tasks_created_by_user_id"), table_name="tasks") - op.drop_index(op.f("ix_tasks_assigned_agent_id"), table_name="tasks") - op.drop_table("tasks") - op.drop_index(op.f("ix_openclaw_sessions_workspace_id"), table_name="openclaw_sessions") - op.drop_index(op.f("ix_openclaw_sessions_status"), table_name="openclaw_sessions") - op.drop_index(op.f("ix_openclaw_sessions_session_id"), table_name="openclaw_sessions") - op.drop_index(op.f("ix_openclaw_sessions_org_id"), table_name="openclaw_sessions") - op.drop_table("openclaw_sessions") - op.drop_index(op.f("ix_workspace_api_tokens_workspace_id"), table_name="workspace_api_tokens") - op.drop_index(op.f("ix_workspace_api_tokens_token_hash"), table_name="workspace_api_tokens") - op.drop_index(op.f("ix_workspace_api_tokens_org_id"), table_name="workspace_api_tokens") - op.drop_table("workspace_api_tokens") - op.drop_index(op.f("ix_projects_workspace_id"), table_name="projects") - op.drop_index(op.f("ix_projects_status"), table_name="projects") - op.drop_index(op.f("ix_projects_org_id"), table_name="projects") - op.drop_table("projects") - op.drop_index( - op.f("ix_orchestration_templates_workspace_id"), table_name="orchestration_templates" - ) - op.drop_index(op.f("ix_orchestration_templates_org_id"), table_name="orchestration_templates") - op.drop_index(op.f("ix_orchestration_templates_kind"), table_name="orchestration_templates") - op.drop_table("orchestration_templates") - op.drop_index(op.f("ix_memberships_workspace_id"), table_name="memberships") - op.drop_index(op.f("ix_memberships_user_id"), table_name="memberships") - op.drop_index(op.f("ix_memberships_org_id"), table_name="memberships") - op.drop_table("memberships") - op.drop_index(op.f("ix_gateway_configs_workspace_id"), table_name="gateway_configs") - op.drop_index(op.f("ix_gateway_configs_org_id"), table_name="gateway_configs") - op.drop_table("gateway_configs") - op.drop_index(op.f("ix_agents_workspace_id"), table_name="agents") - op.drop_index(op.f("ix_agents_org_id"), table_name="agents") - op.drop_index(op.f("ix_agents_openclaw_session_id"), table_name="agents") - op.drop_table("agents") - op.drop_index(op.f("ix_workspaces_slug"), table_name="workspaces") - op.drop_index(op.f("ix_workspaces_org_id"), table_name="workspaces") - op.drop_table("workspaces") - op.drop_index(op.f("ix_users_email"), table_name="users") - op.drop_index(op.f("ix_users_clerk_user_id"), table_name="users") - op.drop_table("users") - op.drop_index(op.f("ix_orgs_slug"), table_name="orgs") - op.drop_table("orgs") - # ### end Alembic commands ### diff --git a/backend/alembic/versions/69858cb75533_add_agent_heartbeat_config.py b/backend/alembic/versions/69858cb75533_add_agent_heartbeat_config.py deleted file mode 100644 index 516f179a..00000000 --- a/backend/alembic/versions/69858cb75533_add_agent_heartbeat_config.py +++ /dev/null @@ -1,29 +0,0 @@ -"""add agent heartbeat config - -Revision ID: 69858cb75533 -Revises: f1a2b3c4d5e6 -Create Date: 2026-02-04 16:32:42.028772 - -""" -from __future__ import annotations - -from alembic import op - - -# revision identifiers, used by Alembic. -revision = '69858cb75533' -down_revision = 'f1a2b3c4d5e6' -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.execute( - "ALTER TABLE agents ADD COLUMN IF NOT EXISTS heartbeat_config JSON" - ) - - -def downgrade() -> None: - op.execute( - "ALTER TABLE agents DROP COLUMN IF EXISTS heartbeat_config" - ) diff --git a/backend/alembic/versions/6df47d330227_add_agent_provision_confirmation.py b/backend/alembic/versions/6df47d330227_add_agent_provision_confirmation.py deleted file mode 100644 index 33250824..00000000 --- a/backend/alembic/versions/6df47d330227_add_agent_provision_confirmation.py +++ /dev/null @@ -1,41 +0,0 @@ -"""add agent provision confirmation - -Revision ID: 6df47d330227 -Revises: e0f28e965fa5 -Create Date: 2026-02-04 17:16:44.472239 - -""" -from __future__ import annotations - -from alembic import op - - -# revision identifiers, used by Alembic. -revision = '6df47d330227' -down_revision = 'e0f28e965fa5' -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.execute( - "ALTER TABLE agents ADD COLUMN IF NOT EXISTS provision_requested_at TIMESTAMP" - ) - op.execute( - "ALTER TABLE agents ADD COLUMN IF NOT EXISTS provision_confirm_token_hash VARCHAR" - ) - op.execute( - "ALTER TABLE agents ADD COLUMN IF NOT EXISTS provision_action VARCHAR" - ) - - -def downgrade() -> None: - op.execute( - "ALTER TABLE agents DROP COLUMN IF EXISTS provision_action" - ) - op.execute( - "ALTER TABLE agents DROP COLUMN IF EXISTS provision_confirm_token_hash" - ) - op.execute( - "ALTER TABLE agents DROP COLUMN IF EXISTS provision_requested_at" - ) diff --git a/backend/alembic/versions/7e3d9b8c1f4a_add_boards_and_task_board_id.py b/backend/alembic/versions/7e3d9b8c1f4a_add_boards_and_task_board_id.py deleted file mode 100644 index d11df981..00000000 --- a/backend/alembic/versions/7e3d9b8c1f4a_add_boards_and_task_board_id.py +++ /dev/null @@ -1,64 +0,0 @@ -"""add boards and task board id - -Revision ID: 7e3d9b8c1f4a -Revises: 5630abfa60f8 -Create Date: 2026-02-03 20:12:00.000000 - -""" - -from __future__ import annotations - -from alembic import op -import sqlalchemy as sa -import sqlmodel - - -# revision identifiers, used by Alembic. -revision = "7e3d9b8c1f4a" -down_revision = "5630abfa60f8" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.create_table( - "boards", - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("workspace_id", sa.Uuid(), nullable=False), - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("slug", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.Column("updated_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.ForeignKeyConstraint( - ["workspace_id"], - ["workspaces.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_boards_org_id"), "boards", ["org_id"], unique=False) - op.create_index( - op.f("ix_boards_workspace_id"), "boards", ["workspace_id"], unique=False - ) - op.create_index(op.f("ix_boards_slug"), "boards", ["slug"], unique=False) - - op.add_column("tasks", sa.Column("board_id", sa.Uuid(), nullable=True)) - op.create_index(op.f("ix_tasks_board_id"), "tasks", ["board_id"], unique=False) - op.create_foreign_key( - "fk_tasks_board_id_boards", "tasks", "boards", ["board_id"], ["id"] - ) - - -def downgrade() -> None: - op.drop_constraint("fk_tasks_board_id_boards", "tasks", type_="foreignkey") - op.drop_index(op.f("ix_tasks_board_id"), table_name="tasks") - op.drop_column("tasks", "board_id") - - op.drop_index(op.f("ix_boards_slug"), table_name="boards") - op.drop_index(op.f("ix_boards_workspace_id"), table_name="boards") - op.drop_index(op.f("ix_boards_org_id"), table_name="boards") - op.drop_table("boards") diff --git a/backend/alembic/versions/8045fbfb157f_add_task_assigned_agent.py b/backend/alembic/versions/8045fbfb157f_add_task_assigned_agent.py deleted file mode 100644 index 31bf9588..00000000 --- a/backend/alembic/versions/8045fbfb157f_add_task_assigned_agent.py +++ /dev/null @@ -1,36 +0,0 @@ -"""add task assigned agent - -Revision ID: 8045fbfb157f -Revises: 6df47d330227 -Create Date: 2026-02-04 17:28:57.465934 - -""" -from __future__ import annotations - -from alembic import op - - -# revision identifiers, used by Alembic. -revision = '8045fbfb157f' -down_revision = '6df47d330227' -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.execute( - "ALTER TABLE tasks ADD COLUMN IF NOT EXISTS assigned_agent_id UUID" - ) - op.execute( - "ALTER TABLE tasks ADD CONSTRAINT IF NOT EXISTS tasks_assigned_agent_id_fkey " - "FOREIGN KEY (assigned_agent_id) REFERENCES agents(id)" - ) - - -def downgrade() -> None: - op.execute( - "ALTER TABLE tasks DROP CONSTRAINT IF EXISTS tasks_assigned_agent_id_fkey" - ) - op.execute( - "ALTER TABLE tasks DROP COLUMN IF EXISTS assigned_agent_id" - ) diff --git a/backend/alembic/versions/8b6d1b8f4b21_drop_projects.py b/backend/alembic/versions/8b6d1b8f4b21_drop_projects.py deleted file mode 100644 index bf217fca..00000000 --- a/backend/alembic/versions/8b6d1b8f4b21_drop_projects.py +++ /dev/null @@ -1,63 +0,0 @@ -"""drop projects and task project_id - -Revision ID: 8b6d1b8f4b21 -Revises: 7e3d9b8c1f4a -Create Date: 2026-02-03 23:05:00.000000 - -""" - -from __future__ import annotations - -from alembic import op -import sqlalchemy as sa -import sqlmodel - - -# revision identifiers, used by Alembic. -revision = "8b6d1b8f4b21" -down_revision = "7e3d9b8c1f4a" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.drop_constraint("tasks_project_id_fkey", "tasks", type_="foreignkey") - op.drop_index(op.f("ix_tasks_project_id"), table_name="tasks") - op.drop_column("tasks", "project_id") - - op.drop_index(op.f("ix_projects_workspace_id"), table_name="projects") - op.drop_index(op.f("ix_projects_status"), table_name="projects") - op.drop_index(op.f("ix_projects_org_id"), table_name="projects") - op.drop_table("projects") - - -def downgrade() -> None: - op.create_table( - "projects", - sa.Column("org_id", sa.Uuid(), nullable=False), - sa.Column("workspace_id", sa.Uuid(), nullable=False), - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("description", sqlmodel.sql.sqltypes.AutoString(), nullable=True), - sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.Column("updated_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint( - ["org_id"], - ["orgs.id"], - ), - sa.ForeignKeyConstraint( - ["workspace_id"], - ["workspaces.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_projects_org_id"), "projects", ["org_id"], unique=False) - op.create_index(op.f("ix_projects_status"), "projects", ["status"], unique=False) - op.create_index(op.f("ix_projects_workspace_id"), "projects", ["workspace_id"], unique=False) - - op.add_column("tasks", sa.Column("project_id", sa.Uuid(), nullable=True)) - op.create_index(op.f("ix_tasks_project_id"), "tasks", ["project_id"], unique=False) - op.create_foreign_key( - "tasks_project_id_fkey", "tasks", "projects", ["project_id"], ["id"] - ) diff --git a/backend/alembic/versions/939a1d2dc607_init.py b/backend/alembic/versions/939a1d2dc607_init.py new file mode 100644 index 00000000..a3c85cc8 --- /dev/null +++ b/backend/alembic/versions/939a1d2dc607_init.py @@ -0,0 +1,147 @@ +"""init + +Revision ID: 939a1d2dc607 +Revises: +Create Date: 2026-02-04 19:34:33.600751 + +""" +from __future__ import annotations + +from alembic import op +import sqlalchemy as sa +import sqlmodel + + +# revision identifiers, used by Alembic. +revision = '939a1d2dc607' +down_revision = None +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('boards', + sa.Column('id', sa.Uuid(), nullable=False), + sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=False), + sa.Column('slug', sqlmodel.sql.sqltypes.AutoString(), nullable=False), + sa.Column('gateway_url', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('gateway_token', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('gateway_main_session_key', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('gateway_workspace_root', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('identity_template', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('soul_template', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.PrimaryKeyConstraint('id') + ) + op.create_index(op.f('ix_boards_slug'), 'boards', ['slug'], unique=False) + op.create_table('users', + sa.Column('id', sa.Uuid(), nullable=False), + sa.Column('clerk_user_id', sqlmodel.sql.sqltypes.AutoString(), nullable=False), + sa.Column('email', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('preferred_name', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('pronouns', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('timezone', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('notes', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('context', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('is_super_admin', sa.Boolean(), nullable=False), + sa.PrimaryKeyConstraint('id') + ) + op.create_index(op.f('ix_users_clerk_user_id'), 'users', ['clerk_user_id'], unique=True) + op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=False) + op.create_table('agents', + sa.Column('id', sa.Uuid(), nullable=False), + sa.Column('board_id', sa.Uuid(), nullable=True), + sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=False), + sa.Column('status', sqlmodel.sql.sqltypes.AutoString(), nullable=False), + sa.Column('openclaw_session_id', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('agent_token_hash', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('heartbeat_config', sa.JSON(), nullable=True), + sa.Column('provision_requested_at', sa.DateTime(), nullable=True), + sa.Column('provision_confirm_token_hash', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('provision_action', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('delete_requested_at', sa.DateTime(), nullable=True), + sa.Column('delete_confirm_token_hash', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('last_seen_at', sa.DateTime(), nullable=True), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.ForeignKeyConstraint(['board_id'], ['boards.id'], ), + sa.PrimaryKeyConstraint('id') + ) + op.create_index(op.f('ix_agents_agent_token_hash'), 'agents', ['agent_token_hash'], unique=False) + op.create_index(op.f('ix_agents_board_id'), 'agents', ['board_id'], unique=False) + op.create_index(op.f('ix_agents_delete_confirm_token_hash'), 'agents', ['delete_confirm_token_hash'], unique=False) + op.create_index(op.f('ix_agents_name'), 'agents', ['name'], unique=False) + op.create_index(op.f('ix_agents_openclaw_session_id'), 'agents', ['openclaw_session_id'], unique=False) + op.create_index(op.f('ix_agents_provision_action'), 'agents', ['provision_action'], unique=False) + op.create_index(op.f('ix_agents_provision_confirm_token_hash'), 'agents', ['provision_confirm_token_hash'], unique=False) + op.create_index(op.f('ix_agents_status'), 'agents', ['status'], unique=False) + op.create_table('tasks', + sa.Column('id', sa.Uuid(), nullable=False), + sa.Column('board_id', sa.Uuid(), nullable=True), + sa.Column('title', sqlmodel.sql.sqltypes.AutoString(), nullable=False), + sa.Column('description', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('status', sqlmodel.sql.sqltypes.AutoString(), nullable=False), + sa.Column('priority', sqlmodel.sql.sqltypes.AutoString(), nullable=False), + sa.Column('due_at', sa.DateTime(), nullable=True), + sa.Column('in_progress_at', sa.DateTime(), nullable=True), + sa.Column('created_by_user_id', sa.Uuid(), nullable=True), + sa.Column('assigned_agent_id', sa.Uuid(), nullable=True), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.ForeignKeyConstraint(['assigned_agent_id'], ['agents.id'], ), + sa.ForeignKeyConstraint(['board_id'], ['boards.id'], ), + sa.ForeignKeyConstraint(['created_by_user_id'], ['users.id'], ), + sa.PrimaryKeyConstraint('id') + ) + op.create_index(op.f('ix_tasks_assigned_agent_id'), 'tasks', ['assigned_agent_id'], unique=False) + op.create_index(op.f('ix_tasks_board_id'), 'tasks', ['board_id'], unique=False) + op.create_index(op.f('ix_tasks_created_by_user_id'), 'tasks', ['created_by_user_id'], unique=False) + op.create_index(op.f('ix_tasks_priority'), 'tasks', ['priority'], unique=False) + op.create_index(op.f('ix_tasks_status'), 'tasks', ['status'], unique=False) + op.create_table('activity_events', + sa.Column('id', sa.Uuid(), nullable=False), + sa.Column('event_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False), + sa.Column('message', sqlmodel.sql.sqltypes.AutoString(), nullable=True), + sa.Column('agent_id', sa.Uuid(), nullable=True), + sa.Column('task_id', sa.Uuid(), nullable=True), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.ForeignKeyConstraint(['agent_id'], ['agents.id'], ), + sa.ForeignKeyConstraint(['task_id'], ['tasks.id'], ), + sa.PrimaryKeyConstraint('id') + ) + op.create_index(op.f('ix_activity_events_agent_id'), 'activity_events', ['agent_id'], unique=False) + op.create_index(op.f('ix_activity_events_event_type'), 'activity_events', ['event_type'], unique=False) + op.create_index(op.f('ix_activity_events_task_id'), 'activity_events', ['task_id'], unique=False) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_index(op.f('ix_activity_events_task_id'), table_name='activity_events') + op.drop_index(op.f('ix_activity_events_event_type'), table_name='activity_events') + op.drop_index(op.f('ix_activity_events_agent_id'), table_name='activity_events') + op.drop_table('activity_events') + op.drop_index(op.f('ix_tasks_status'), table_name='tasks') + op.drop_index(op.f('ix_tasks_priority'), table_name='tasks') + op.drop_index(op.f('ix_tasks_created_by_user_id'), table_name='tasks') + op.drop_index(op.f('ix_tasks_board_id'), table_name='tasks') + op.drop_index(op.f('ix_tasks_assigned_agent_id'), table_name='tasks') + op.drop_table('tasks') + op.drop_index(op.f('ix_agents_status'), table_name='agents') + op.drop_index(op.f('ix_agents_provision_confirm_token_hash'), table_name='agents') + op.drop_index(op.f('ix_agents_provision_action'), table_name='agents') + op.drop_index(op.f('ix_agents_openclaw_session_id'), table_name='agents') + op.drop_index(op.f('ix_agents_name'), table_name='agents') + op.drop_index(op.f('ix_agents_delete_confirm_token_hash'), table_name='agents') + op.drop_index(op.f('ix_agents_board_id'), table_name='agents') + op.drop_index(op.f('ix_agents_agent_token_hash'), table_name='agents') + op.drop_table('agents') + op.drop_index(op.f('ix_users_email'), table_name='users') + op.drop_index(op.f('ix_users_clerk_user_id'), table_name='users') + op.drop_table('users') + op.drop_index(op.f('ix_boards_slug'), table_name='boards') + op.drop_table('boards') + # ### end Alembic commands ### diff --git a/backend/alembic/versions/9c4f1a2b3d4e_drop_tenancy_tables.py b/backend/alembic/versions/9c4f1a2b3d4e_drop_tenancy_tables.py deleted file mode 100644 index b3054dab..00000000 --- a/backend/alembic/versions/9c4f1a2b3d4e_drop_tenancy_tables.py +++ /dev/null @@ -1,56 +0,0 @@ -"""drop tenancy tables and columns - -Revision ID: 9c4f1a2b3d4e -Revises: 8b6d1b8f4b21 -Create Date: 2026-02-03 23:35:00.000000 - -""" - -from __future__ import annotations - -from alembic import op - - -# revision identifiers, used by Alembic. -revision = "9c4f1a2b3d4e" -down_revision = "8b6d1b8f4b21" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.drop_table("task_subagents") - op.drop_table("task_status_history") - op.drop_table("task_deliverables") - op.drop_table("task_activities") - op.drop_table("transcripts") - op.drop_table("openclaw_sessions") - op.drop_table("workspace_api_tokens") - op.drop_table("orchestration_templates") - op.drop_table("memberships") - op.drop_table("gateway_configs") - - op.drop_constraint("tasks_assigned_agent_id_fkey", "tasks", type_="foreignkey") - op.drop_constraint("tasks_org_id_fkey", "tasks", type_="foreignkey") - op.drop_constraint("tasks_workspace_id_fkey", "tasks", type_="foreignkey") - op.drop_index(op.f("ix_tasks_assigned_agent_id"), table_name="tasks") - op.drop_index(op.f("ix_tasks_org_id"), table_name="tasks") - op.drop_index(op.f("ix_tasks_workspace_id"), table_name="tasks") - op.drop_column("tasks", "assigned_agent_id") - op.drop_column("tasks", "org_id") - op.drop_column("tasks", "workspace_id") - - op.drop_constraint("boards_org_id_fkey", "boards", type_="foreignkey") - op.drop_constraint("boards_workspace_id_fkey", "boards", type_="foreignkey") - op.drop_index(op.f("ix_boards_org_id"), table_name="boards") - op.drop_index(op.f("ix_boards_workspace_id"), table_name="boards") - op.drop_column("boards", "org_id") - op.drop_column("boards", "workspace_id") - - op.drop_table("agents") - op.drop_table("workspaces") - op.drop_table("orgs") - - -def downgrade() -> None: - raise NotImplementedError("Downgrade not supported for simplified tenancy removal.") diff --git a/backend/alembic/versions/a1b2c3d4e5f6_add_agents_and_activity_events.py b/backend/alembic/versions/a1b2c3d4e5f6_add_agents_and_activity_events.py deleted file mode 100644 index c1f49b71..00000000 --- a/backend/alembic/versions/a1b2c3d4e5f6_add_agents_and_activity_events.py +++ /dev/null @@ -1,70 +0,0 @@ -"""add agents and activity events - -Revision ID: a1b2c3d4e5f6 -Revises: 9c4f1a2b3d4e -Create Date: 2026-02-03 23:50:00.000000 - -""" - -from __future__ import annotations - -from alembic import op -import sqlalchemy as sa -import sqlmodel - - -# revision identifiers, used by Alembic. -revision = "a1b2c3d4e5f6" -down_revision = "9c4f1a2b3d4e" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.create_table( - "agents", - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("last_seen_at", sa.DateTime(), nullable=False), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.Column("updated_at", sa.DateTime(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_agents_name"), "agents", ["name"], unique=False) - op.create_index(op.f("ix_agents_status"), "agents", ["status"], unique=False) - - op.create_table( - "activity_events", - sa.Column("id", sa.Uuid(), nullable=False), - sa.Column("event_type", sqlmodel.sql.sqltypes.AutoString(), nullable=False), - sa.Column("message", sqlmodel.sql.sqltypes.AutoString(), nullable=True), - sa.Column("agent_id", sa.Uuid(), nullable=True), - sa.Column("task_id", sa.Uuid(), nullable=True), - sa.Column("created_at", sa.DateTime(), nullable=False), - sa.ForeignKeyConstraint(["agent_id"], ["agents.id"]), - sa.ForeignKeyConstraint(["task_id"], ["tasks.id"]), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index( - op.f("ix_activity_events_agent_id"), "activity_events", ["agent_id"], unique=False - ) - op.create_index( - op.f("ix_activity_events_event_type"), - "activity_events", - ["event_type"], - unique=False, - ) - op.create_index( - op.f("ix_activity_events_task_id"), "activity_events", ["task_id"], unique=False - ) - - -def downgrade() -> None: - op.drop_index(op.f("ix_activity_events_task_id"), table_name="activity_events") - op.drop_index(op.f("ix_activity_events_event_type"), table_name="activity_events") - op.drop_index(op.f("ix_activity_events_agent_id"), table_name="activity_events") - op.drop_table("activity_events") - op.drop_index(op.f("ix_agents_status"), table_name="agents") - op.drop_index(op.f("ix_agents_name"), table_name="agents") - op.drop_table("agents") diff --git a/backend/alembic/versions/b9d22e2a4d50_add_task_comments_index.py b/backend/alembic/versions/b9d22e2a4d50_add_task_comments_index.py deleted file mode 100644 index 1d5aad3d..00000000 --- a/backend/alembic/versions/b9d22e2a4d50_add_task_comments_index.py +++ /dev/null @@ -1,29 +0,0 @@ -"""add task comments index - -Revision ID: b9d22e2a4d50 -Revises: 8045fbfb157f -Create Date: 2026-02-04 17:32:06.204331 - -""" -from __future__ import annotations - -from alembic import op - - -# revision identifiers, used by Alembic. -revision = 'b9d22e2a4d50' -down_revision = '8045fbfb157f' -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.execute( - "CREATE INDEX IF NOT EXISTS ix_activity_events_task_comment " - "ON activity_events (task_id, created_at) " - "WHERE event_type = 'task.comment'" - ) - - -def downgrade() -> None: - op.execute("DROP INDEX IF EXISTS ix_activity_events_task_comment") diff --git a/backend/alembic/versions/c1a2b3c4d5e7_add_task_in_progress_at.py b/backend/alembic/versions/c1a2b3c4d5e7_add_task_in_progress_at.py deleted file mode 100644 index 8f09ca2b..00000000 --- a/backend/alembic/versions/c1a2b3c4d5e7_add_task_in_progress_at.py +++ /dev/null @@ -1,31 +0,0 @@ -"""add task in_progress_at - -Revision ID: c1a2b3c4d5e7 -Revises: b9d22e2a4d50 -Create Date: 2026-02-04 13:34:25.000000 - -""" -from __future__ import annotations - -from alembic import op - - -# revision identifiers, used by Alembic. -revision = "c1a2b3c4d5e7" -down_revision = "b9d22e2a4d50" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.execute( - "ALTER TABLE tasks ADD COLUMN IF NOT EXISTS in_progress_at TIMESTAMP WITHOUT TIME ZONE" - ) - op.execute( - "CREATE INDEX IF NOT EXISTS ix_tasks_in_progress_at ON tasks (in_progress_at)" - ) - - -def downgrade() -> None: - op.execute("DROP INDEX IF EXISTS ix_tasks_in_progress_at") - op.execute("ALTER TABLE tasks DROP COLUMN IF EXISTS in_progress_at") diff --git a/backend/alembic/versions/c7f0a2b1d4e3_add_agent_session_id.py b/backend/alembic/versions/c7f0a2b1d4e3_add_agent_session_id.py deleted file mode 100644 index 977c2b6c..00000000 --- a/backend/alembic/versions/c7f0a2b1d4e3_add_agent_session_id.py +++ /dev/null @@ -1,38 +0,0 @@ -"""add agent openclaw session id - -Revision ID: c7f0a2b1d4e3 -Revises: a1b2c3d4e5f6 -Create Date: 2026-02-04 02:20:00.000000 - -""" - -from __future__ import annotations - -from alembic import op -import sqlalchemy as sa -import sqlmodel - - -# revision identifiers, used by Alembic. -revision = "c7f0a2b1d4e3" -down_revision = "a1b2c3d4e5f6" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.add_column( - "agents", - sa.Column("openclaw_session_id", sqlmodel.sql.sqltypes.AutoString(), nullable=True), - ) - op.create_index( - op.f("ix_agents_openclaw_session_id"), - "agents", - ["openclaw_session_id"], - unique=False, - ) - - -def downgrade() -> None: - op.drop_index(op.f("ix_agents_openclaw_session_id"), table_name="agents") - op.drop_column("agents", "openclaw_session_id") diff --git a/backend/alembic/versions/cefef25d4634_ensure_heartbeat_config_column.py b/backend/alembic/versions/cefef25d4634_ensure_heartbeat_config_column.py deleted file mode 100644 index f077f7a7..00000000 --- a/backend/alembic/versions/cefef25d4634_ensure_heartbeat_config_column.py +++ /dev/null @@ -1,29 +0,0 @@ -"""ensure heartbeat config column - -Revision ID: cefef25d4634 -Revises: 2b4c2f7b3eda -Create Date: 2026-02-04 16:38:25.234627 - -""" -from __future__ import annotations - -from alembic import op - - -# revision identifiers, used by Alembic. -revision = 'cefef25d4634' -down_revision = '2b4c2f7b3eda' -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.execute( - "ALTER TABLE agents ADD COLUMN IF NOT EXISTS heartbeat_config JSON" - ) - - -def downgrade() -> None: - op.execute( - "ALTER TABLE agents DROP COLUMN IF EXISTS heartbeat_config" - ) diff --git a/backend/alembic/versions/d3e4f5a6b7c8_add_agent_token_hash.py b/backend/alembic/versions/d3e4f5a6b7c8_add_agent_token_hash.py deleted file mode 100644 index edc1eeea..00000000 --- a/backend/alembic/versions/d3e4f5a6b7c8_add_agent_token_hash.py +++ /dev/null @@ -1,38 +0,0 @@ -"""add agent token hash - -Revision ID: d3e4f5a6b7c8 -Revises: c7f0a2b1d4e3 -Create Date: 2026-02-04 06:50:00.000000 - -""" - -from __future__ import annotations - -from alembic import op -import sqlalchemy as sa -import sqlmodel - - -# revision identifiers, used by Alembic. -revision = "d3e4f5a6b7c8" -down_revision = "c7f0a2b1d4e3" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.add_column( - "agents", - sa.Column("agent_token_hash", sqlmodel.sql.sqltypes.AutoString(), nullable=True), - ) - op.create_index( - op.f("ix_agents_agent_token_hash"), - "agents", - ["agent_token_hash"], - unique=False, - ) - - -def downgrade() -> None: - op.drop_index(op.f("ix_agents_agent_token_hash"), table_name="agents") - op.drop_column("agents", "agent_token_hash") diff --git a/backend/alembic/versions/e0f28e965fa5_add_agent_delete_confirmation.py b/backend/alembic/versions/e0f28e965fa5_add_agent_delete_confirmation.py deleted file mode 100644 index 4092d4fc..00000000 --- a/backend/alembic/versions/e0f28e965fa5_add_agent_delete_confirmation.py +++ /dev/null @@ -1,35 +0,0 @@ -"""add agent delete confirmation - -Revision ID: e0f28e965fa5 -Revises: cefef25d4634 -Create Date: 2026-02-04 16:55:33.389505 - -""" -from __future__ import annotations - -from alembic import op - - -# revision identifiers, used by Alembic. -revision = 'e0f28e965fa5' -down_revision = 'cefef25d4634' -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.execute( - "ALTER TABLE agents ADD COLUMN IF NOT EXISTS delete_requested_at TIMESTAMP" - ) - op.execute( - "ALTER TABLE agents ADD COLUMN IF NOT EXISTS delete_confirm_token_hash VARCHAR" - ) - - -def downgrade() -> None: - op.execute( - "ALTER TABLE agents DROP COLUMN IF EXISTS delete_confirm_token_hash" - ) - op.execute( - "ALTER TABLE agents DROP COLUMN IF EXISTS delete_requested_at" - ) diff --git a/backend/alembic/versions/e4f5a6b7c8d9_make_agent_last_seen_nullable.py b/backend/alembic/versions/e4f5a6b7c8d9_make_agent_last_seen_nullable.py deleted file mode 100644 index 02d8b596..00000000 --- a/backend/alembic/versions/e4f5a6b7c8d9_make_agent_last_seen_nullable.py +++ /dev/null @@ -1,27 +0,0 @@ -"""make agent last_seen_at nullable - -Revision ID: e4f5a6b7c8d9 -Revises: d3e4f5a6b7c8 -Create Date: 2026-02-04 07:10:00.000000 - -""" - -from __future__ import annotations - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "e4f5a6b7c8d9" -down_revision = "d3e4f5a6b7c8" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.alter_column("agents", "last_seen_at", existing_type=sa.DateTime(), nullable=True) - - -def downgrade() -> None: - op.alter_column("agents", "last_seen_at", existing_type=sa.DateTime(), nullable=False) diff --git a/backend/alembic/versions/f1a2b3c4d5e6_add_board_gateway_config.py b/backend/alembic/versions/f1a2b3c4d5e6_add_board_gateway_config.py deleted file mode 100644 index ea5623a5..00000000 --- a/backend/alembic/versions/f1a2b3c4d5e6_add_board_gateway_config.py +++ /dev/null @@ -1,47 +0,0 @@ -"""add board gateway config - -Revision ID: f1a2b3c4d5e6 -Revises: e4f5a6b7c8d9 -Create Date: 2026-02-04 00:00:00.000000 - -""" - -from __future__ import annotations - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "f1a2b3c4d5e6" -down_revision = "e4f5a6b7c8d9" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.add_column("boards", sa.Column("gateway_url", sa.String(), nullable=True)) - op.add_column("boards", sa.Column("gateway_token", sa.String(), nullable=True)) - op.add_column( - "boards", sa.Column("gateway_main_session_key", sa.String(), nullable=True) - ) - op.add_column( - "boards", sa.Column("gateway_workspace_root", sa.String(), nullable=True) - ) - - op.add_column("agents", sa.Column("board_id", sa.Uuid(), nullable=True)) - op.create_foreign_key( - "agents_board_id_fkey", "agents", "boards", ["board_id"], ["id"] - ) - op.create_index(op.f("ix_agents_board_id"), "agents", ["board_id"], unique=False) - - -def downgrade() -> None: - op.drop_index(op.f("ix_agents_board_id"), table_name="agents") - op.drop_constraint("agents_board_id_fkey", "agents", type_="foreignkey") - op.drop_column("agents", "board_id") - - op.drop_column("boards", "gateway_workspace_root") - op.drop_column("boards", "gateway_main_session_key") - op.drop_column("boards", "gateway_token") - op.drop_column("boards", "gateway_url") diff --git a/backend/app/api/agents.py b/backend/app/api/agents.py index 42cb179f..eb5fea46 100644 --- a/backend/app/api/agents.py +++ b/backend/app/api/agents.py @@ -208,7 +208,9 @@ async def create_agent( ) session.commit() try: - await send_provisioning_message(agent, board, raw_token, provision_token) + await send_provisioning_message( + agent, board, raw_token, provision_token, auth.user + ) record_activity( session, event_type="agent.provision.requested", @@ -288,7 +290,9 @@ async def update_agent( session.commit() session.refresh(agent) try: - await send_update_message(agent, board, raw_token, provision_token) + await send_update_message( + agent, board, raw_token, provision_token, auth.user + ) record_activity( session, event_type="agent.update.requested", @@ -375,7 +379,9 @@ async def heartbeat_or_create_agent( ) session.commit() try: - await send_provisioning_message(agent, board, raw_token, provision_token) + await send_provisioning_message( + agent, board, raw_token, provision_token, actor.user + ) record_activity( session, event_type="agent.provision.requested", @@ -405,7 +411,9 @@ async def heartbeat_or_create_agent( try: board = _require_board(session, str(agent.board_id) if agent.board_id else None) config = _require_gateway_config(board) - await send_provisioning_message(agent, board, raw_token, provision_token) + await send_provisioning_message( + agent, board, raw_token, provision_token, actor.user + ) record_activity( session, event_type="agent.provision.requested", diff --git a/backend/app/api/boards.py b/backend/app/api/boards.py index 907ab4ca..d902f19f 100644 --- a/backend/app/api/boards.py +++ b/backend/app/api/boards.py @@ -101,6 +101,10 @@ def create_board( data = payload.model_dump() if data.get("gateway_token") == "": data["gateway_token"] = None + if data.get("identity_template") == "": + data["identity_template"] = None + if data.get("soul_template") == "": + data["soul_template"] = None if data.get("gateway_url"): if not data.get("gateway_main_session_key"): raise HTTPException( @@ -137,6 +141,10 @@ def update_board( updates = payload.model_dump(exclude_unset=True) if updates.get("gateway_token") == "": updates["gateway_token"] = None + if updates.get("identity_template") == "": + updates["identity_template"] = None + if updates.get("soul_template") == "": + updates["soul_template"] = None for key, value in updates.items(): setattr(board, key, value) if board.gateway_url: diff --git a/backend/app/api/tasks.py b/backend/app/api/tasks.py index 6fd77b2d..4362b5c9 100644 --- a/backend/app/api/tasks.py +++ b/backend/app/api/tasks.py @@ -3,7 +3,7 @@ from __future__ import annotations from datetime import datetime from uuid import UUID -from fastapi import APIRouter, Depends, HTTPException, status +from fastapi import APIRouter, Depends, HTTPException, Query, status from sqlalchemy import asc, desc from sqlmodel import Session, col, select @@ -70,11 +70,26 @@ def has_valid_recent_comment( @router.get("", response_model=list[TaskRead]) def list_tasks( + status_filter: str | None = Query(default=None, alias="status"), + assigned_agent_id: UUID | None = None, + unassigned: bool | None = None, + limit: int | None = Query(default=None, ge=1, le=200), board: Board = Depends(get_board_or_404), session: Session = Depends(get_session), actor: ActorContext = Depends(require_admin_or_agent), ) -> list[Task]: - return list(session.exec(select(Task).where(Task.board_id == board.id))) + statement = select(Task).where(Task.board_id == board.id) + if status_filter: + statuses = [s.strip() for s in status_filter.split(",") if s.strip()] + if statuses: + statement = statement.where(col(Task.status).in_(statuses)) + if assigned_agent_id is not None: + statement = statement.where(col(Task.assigned_agent_id) == assigned_agent_id) + if unassigned: + statement = statement.where(col(Task.assigned_agent_id).is_(None)) + if limit is not None: + statement = statement.limit(limit) + return list(session.exec(statement)) @router.post("", response_model=TaskRead) diff --git a/backend/app/api/users.py b/backend/app/api/users.py new file mode 100644 index 00000000..99fce48c --- /dev/null +++ b/backend/app/api/users.py @@ -0,0 +1,36 @@ +from __future__ import annotations + +from fastapi import APIRouter, Depends, HTTPException, status +from sqlmodel import Session + +from app.core.auth import AuthContext, get_auth_context +from app.db.session import get_session +from app.models.users import User +from app.schemas.users import UserRead, UserUpdate + +router = APIRouter(prefix="/users", tags=["users"]) + + +@router.get("/me", response_model=UserRead) +async def get_me(auth: AuthContext = Depends(get_auth_context)) -> UserRead: + if auth.actor_type != "user" or auth.user is None: + raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED) + return UserRead.model_validate(auth.user) + + +@router.patch("/me", response_model=UserRead) +async def update_me( + payload: UserUpdate, + session: Session = Depends(get_session), + auth: AuthContext = Depends(get_auth_context), +) -> UserRead: + if auth.actor_type != "user" or auth.user is None: + raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED) + updates = payload.model_dump(exclude_unset=True) + user: User = auth.user + for key, value in updates.items(): + setattr(user, key, value) + session.add(user) + session.commit() + session.refresh(user) + return UserRead.model_validate(user) diff --git a/backend/app/core/config.py b/backend/app/core/config.py index 11e0fdb0..75426ee6 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -25,5 +25,10 @@ class Settings(BaseSettings): # Database lifecycle db_auto_migrate: bool = False + # Logging + log_level: str = "INFO" + log_format: str = "text" + log_use_utc: bool = False + settings = Settings() diff --git a/backend/app/core/logging.py b/backend/app/core/logging.py index 739c8dbe..59d05298 100644 --- a/backend/app/core/logging.py +++ b/backend/app/core/logging.py @@ -1,14 +1,171 @@ from __future__ import annotations +import json import logging import os +import sys +import time +from datetime import datetime, timezone +from typing import Any + +from app.core.config import settings +from app.core.version import APP_NAME, APP_VERSION + +TRACE_LEVEL = 5 +logging.addLevelName(TRACE_LEVEL, "TRACE") + + +def _trace(self: logging.Logger, message: str, *args: Any, **kwargs: Any) -> None: + if self.isEnabledFor(TRACE_LEVEL): + self._log(TRACE_LEVEL, message, args, **kwargs) + + +logging.Logger.trace = _trace # type: ignore[attr-defined] + +_STANDARD_LOG_RECORD_ATTRS = { + "args", + "asctime", + "created", + "exc_info", + "exc_text", + "filename", + "funcName", + "levelname", + "levelno", + "lineno", + "module", + "msecs", + "message", + "msg", + "name", + "pathname", + "process", + "processName", + "relativeCreated", + "stack_info", + "thread", + "threadName", + "taskName", + "app", + "version", +} + + +class AppLogFilter(logging.Filter): + def __init__(self, app_name: str, version: str) -> None: + super().__init__() + self._app_name = app_name + self._version = version + + def filter(self, record: logging.LogRecord) -> bool: + record.app = self._app_name + record.version = self._version + return True + + +class JsonFormatter(logging.Formatter): + def format(self, record: logging.LogRecord) -> str: + payload: dict[str, Any] = { + "timestamp": datetime.fromtimestamp( + record.created, tz=timezone.utc + ).isoformat(), + "level": record.levelname, + "logger": record.name, + "message": record.getMessage(), + "app": getattr(record, "app", APP_NAME), + "version": getattr(record, "version", APP_VERSION), + "module": record.module, + "function": record.funcName, + "line": record.lineno, + } + if record.exc_info: + payload["exception"] = self.formatException(record.exc_info) + if record.stack_info: + payload["stack"] = self.formatStack(record.stack_info) + for key, value in record.__dict__.items(): + if key in _STANDARD_LOG_RECORD_ATTRS or key in payload: + continue + payload[key] = value + return json.dumps(payload, separators=(",", ":"), default=str) + + +class KeyValueFormatter(logging.Formatter): + def format(self, record: logging.LogRecord) -> str: + base = super().format(record) + extras = { + key: value + for key, value in record.__dict__.items() + if key not in _STANDARD_LOG_RECORD_ATTRS + } + if not extras: + return base + extra_bits = " ".join(f"{key}={value}" for key, value in extras.items()) + return f"{base} {extra_bits}" + + +class AppLogger: + _configured = False + + @classmethod + def _resolve_level(cls) -> tuple[str, int]: + level_name = (settings.log_level or os.getenv("LOG_LEVEL", "INFO")).upper() + if level_name == "TRACE": + return level_name, TRACE_LEVEL + if level_name.isdigit(): + return level_name, int(level_name) + return level_name, logging._nameToLevel.get(level_name, logging.INFO) + + @classmethod + def configure(cls, *, force: bool = False) -> None: + if cls._configured and not force: + return + + level_name, level = cls._resolve_level() + + handler = logging.StreamHandler(sys.stdout) + handler.addFilter(AppLogFilter(APP_NAME, APP_VERSION)) + format_name = (settings.log_format or "text").lower() + if format_name == "json": + formatter: logging.Formatter = JsonFormatter() + else: + formatter = KeyValueFormatter( + "%(asctime)s %(levelname)s %(name)s %(message)s app=%(app)s version=%(version)s" + ) + if settings.log_use_utc: + formatter.converter = time.gmtime + handler.setFormatter(formatter) + + root = logging.getLogger() + root.setLevel(level) + root.handlers.clear() + root.addHandler(handler) + + # Uvicorn & HTTP clients + for logger_name in ("uvicorn", "uvicorn.error", "uvicorn.access"): + logging.getLogger(logger_name).setLevel(level) + logging.getLogger("httpx").setLevel(logging.WARNING) + logging.getLogger("httpcore").setLevel(logging.WARNING) + + # SQL logs only at TRACE + sql_loggers = ("sqlalchemy", "sqlalchemy.engine", "sqlalchemy.pool") + if level_name == "TRACE": + for name in sql_loggers: + logger = logging.getLogger(name) + logger.disabled = False + logger.setLevel(logging.INFO) + else: + for name in sql_loggers: + logger = logging.getLogger(name) + logger.disabled = True + + cls._configured = True + + @classmethod + def get_logger(cls, name: str | None = None) -> logging.Logger: + if not cls._configured: + cls.configure() + return logging.getLogger(name) def configure_logging() -> None: - level_name = os.getenv("LOG_LEVEL", "INFO").upper() - level = logging._nameToLevel.get(level_name, logging.INFO) - logging.basicConfig( - level=level, - format="%(asctime)s %(levelname)s %(name)s %(message)s", - force=True, - ) + AppLogger.configure() diff --git a/backend/app/core/version.py b/backend/app/core/version.py new file mode 100644 index 00000000..360e6554 --- /dev/null +++ b/backend/app/core/version.py @@ -0,0 +1,2 @@ +APP_NAME = "mission-control" +APP_VERSION = "0.1.0" diff --git a/backend/app/main.py b/backend/app/main.py index e7e6bca2..26368542 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -9,6 +9,7 @@ from app.api.auth import router as auth_router from app.api.boards import router as boards_router from app.api.gateway import router as gateway_router from app.api.tasks import router as tasks_router +from app.api.users import router as users_router from app.core.config import settings from app.core.logging import configure_logging from app.db.session import init_db @@ -38,6 +39,16 @@ def health() -> dict[str, bool]: return {"ok": True} +@app.get("/healthz") +def healthz() -> dict[str, bool]: + return {"ok": True} + + +@app.get("/readyz") +def readyz() -> dict[str, bool]: + return {"ok": True} + + api_v1 = APIRouter(prefix="/api/v1") api_v1.include_router(auth_router) api_v1.include_router(agents_router) @@ -45,4 +56,5 @@ api_v1.include_router(activity_router) api_v1.include_router(gateway_router) api_v1.include_router(boards_router) api_v1.include_router(tasks_router) +api_v1.include_router(users_router) app.include_router(api_v1) diff --git a/backend/app/models/boards.py b/backend/app/models/boards.py index 82ce1f7a..65540d60 100644 --- a/backend/app/models/boards.py +++ b/backend/app/models/boards.py @@ -18,5 +18,7 @@ class Board(TenantScoped, table=True): gateway_token: str | None = Field(default=None) gateway_main_session_key: str | None = Field(default=None) gateway_workspace_root: str | None = Field(default=None) + identity_template: str | None = Field(default=None) + soul_template: str | None = Field(default=None) created_at: datetime = Field(default_factory=datetime.utcnow) updated_at: datetime = Field(default_factory=datetime.utcnow) diff --git a/backend/app/models/users.py b/backend/app/models/users.py index f105efac..bad848ee 100644 --- a/backend/app/models/users.py +++ b/backend/app/models/users.py @@ -12,4 +12,9 @@ class User(SQLModel, table=True): clerk_user_id: str = Field(index=True, unique=True) email: str | None = Field(default=None, index=True) name: str | None = None + preferred_name: str | None = None + pronouns: str | None = None + timezone: str | None = None + notes: str | None = None + context: str | None = None is_super_admin: bool = Field(default=False) diff --git a/backend/app/schemas/__init__.py b/backend/app/schemas/__init__.py index e9431fa5..9a7a3ffe 100644 --- a/backend/app/schemas/__init__.py +++ b/backend/app/schemas/__init__.py @@ -2,7 +2,7 @@ from app.schemas.activity_events import ActivityEventRead from app.schemas.agents import AgentCreate, AgentRead, AgentUpdate from app.schemas.boards import BoardCreate, BoardRead, BoardUpdate from app.schemas.tasks import TaskCreate, TaskRead, TaskUpdate -from app.schemas.users import UserCreate, UserRead +from app.schemas.users import UserCreate, UserRead, UserUpdate __all__ = [ "ActivityEventRead", @@ -17,4 +17,5 @@ __all__ = [ "TaskUpdate", "UserCreate", "UserRead", + "UserUpdate", ] diff --git a/backend/app/schemas/boards.py b/backend/app/schemas/boards.py index d40c1db7..218f4fcf 100644 --- a/backend/app/schemas/boards.py +++ b/backend/app/schemas/boards.py @@ -12,6 +12,8 @@ class BoardBase(SQLModel): gateway_url: str | None = None gateway_main_session_key: str | None = None gateway_workspace_root: str | None = None + identity_template: str | None = None + soul_template: str | None = None class BoardCreate(BoardBase): @@ -25,6 +27,8 @@ class BoardUpdate(SQLModel): gateway_token: str | None = None gateway_main_session_key: str | None = None gateway_workspace_root: str | None = None + identity_template: str | None = None + soul_template: str | None = None class BoardRead(BoardBase): diff --git a/backend/app/schemas/users.py b/backend/app/schemas/users.py index e106758c..f3cc283b 100644 --- a/backend/app/schemas/users.py +++ b/backend/app/schemas/users.py @@ -9,12 +9,26 @@ class UserBase(SQLModel): clerk_user_id: str email: str | None = None name: str | None = None + preferred_name: str | None = None + pronouns: str | None = None + timezone: str | None = None + notes: str | None = None + context: str | None = None class UserCreate(UserBase): pass +class UserUpdate(SQLModel): + name: str | None = None + preferred_name: str | None = None + pronouns: str | None = None + timezone: str | None = None + notes: str | None = None + context: str | None = None + + class UserRead(UserBase): id: UUID is_super_admin: bool diff --git a/backend/app/services/agent_provisioning.py b/backend/app/services/agent_provisioning.py index aab2ed47..4e234da5 100644 --- a/backend/app/services/agent_provisioning.py +++ b/backend/app/services/agent_provisioning.py @@ -12,6 +12,7 @@ from app.core.config import settings from app.integrations.openclaw_gateway import GatewayConfig, ensure_session, send_message from app.models.agents import Agent from app.models.boards import Board +from app.models.users import User TEMPLATE_FILES = [ "AGENTS.md", @@ -64,11 +65,18 @@ def _template_env() -> Environment: ) -def _read_templates(context: dict[str, str]) -> dict[str, str]: +def _read_templates( + context: dict[str, str], overrides: dict[str, str] | None = None +) -> dict[str, str]: env = _template_env() templates: dict[str, str] = {} + override_map = overrides or {} for name in TEMPLATE_FILES: path = _templates_root() / name + override = override_map.get(name) + if override: + templates[name] = env.from_string(override).render(**context).strip() + continue if not path.exists(): templates[name] = "" continue @@ -90,7 +98,9 @@ def _workspace_path(agent_name: str, workspace_root: str) -> str: return f"{root}/workspace-{_slugify(agent_name)}" -def _build_context(agent: Agent, board: Board, auth_token: str) -> dict[str, str]: +def _build_context( + agent: Agent, board: Board, auth_token: str, user: User | None +) -> dict[str, str]: if not board.gateway_workspace_root: raise ValueError("gateway_workspace_root is required") if not board.gateway_main_session_key: @@ -111,25 +121,32 @@ def _build_context(agent: Agent, board: Board, auth_token: str) -> dict[str, str "auth_token": auth_token, "main_session_key": main_session_key, "workspace_root": workspace_root, - "user_name": "Unset", - "user_preferred_name": "Unset", - "user_timezone": "Unset", - "user_notes": "Fill in user context.", + "user_name": user.name if user else "", + "user_preferred_name": user.preferred_name if user else "", + "user_pronouns": user.pronouns if user else "", + "user_timezone": user.timezone if user else "", + "user_notes": user.notes if user else "", + "user_context": user.context if user else "", } -def _build_file_blocks(context: dict[str, str]) -> str: - templates = _read_templates(context) +def _build_file_blocks(context: dict[str, str], board: Board) -> str: + overrides: dict[str, str] = {} + if board.identity_template: + overrides["IDENTITY.md"] = board.identity_template + if board.soul_template: + overrides["SOUL.md"] = board.soul_template + templates = _read_templates(context, overrides=overrides) return "".join( _render_file_block(name, templates.get(name, "")) for name in TEMPLATE_FILES ) def build_provisioning_message( - agent: Agent, board: Board, auth_token: str, confirm_token: str + agent: Agent, board: Board, auth_token: str, confirm_token: str, user: User | None ) -> str: - context = _build_context(agent, board, auth_token) - file_blocks = _build_file_blocks(context) + context = _build_context(agent, board, auth_token, user) + file_blocks = _build_file_blocks(context, board) heartbeat_snippet = json.dumps( { "id": _agent_key(agent), @@ -173,10 +190,10 @@ def build_provisioning_message( def build_update_message( - agent: Agent, board: Board, auth_token: str, confirm_token: str + agent: Agent, board: Board, auth_token: str, confirm_token: str, user: User | None ) -> str: - context = _build_context(agent, board, auth_token) - file_blocks = _build_file_blocks(context) + context = _build_context(agent, board, auth_token, user) + file_blocks = _build_file_blocks(context, board) heartbeat_snippet = json.dumps( { "id": _agent_key(agent), @@ -223,6 +240,7 @@ async def send_provisioning_message( board: Board, auth_token: str, confirm_token: str, + user: User | None, ) -> None: if not board.gateway_url: return @@ -231,7 +249,7 @@ async def send_provisioning_message( main_session = board.gateway_main_session_key config = GatewayConfig(url=board.gateway_url, token=board.gateway_token) await ensure_session(main_session, config=config, label="Main Agent") - message = build_provisioning_message(agent, board, auth_token, confirm_token) + message = build_provisioning_message(agent, board, auth_token, confirm_token, user) await send_message(message, session_key=main_session, config=config, deliver=False) @@ -240,6 +258,7 @@ async def send_update_message( board: Board, auth_token: str, confirm_token: str, + user: User | None, ) -> None: if not board.gateway_url: return @@ -248,5 +267,5 @@ async def send_update_message( main_session = board.gateway_main_session_key config = GatewayConfig(url=board.gateway_url, token=board.gateway_token) await ensure_session(main_session, config=config, label="Main Agent") - message = build_update_message(agent, board, auth_token, confirm_token) + message = build_update_message(agent, board, auth_token, confirm_token, user) await send_message(message, session_key=main_session, config=config, deliver=False) diff --git a/frontend/next.config.ts b/frontend/next.config.ts index b6bbeefb..5428756e 100644 --- a/frontend/next.config.ts +++ b/frontend/next.config.ts @@ -4,8 +4,17 @@ const nextConfig: NextConfig = { allowedDevOrigins: [ "http://localhost:3000", "http://127.0.0.1:3000", + "http://192.168.1.101", "http://192.168.1.101:3000", ], + images: { + remotePatterns: [ + { + protocol: "https", + hostname: "img.clerk.com", + }, + ], + }, }; export default nextConfig; diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 7aaca656..1d939865 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -10,11 +10,13 @@ "dependencies": { "@clerk/nextjs": "^6.37.1", "@radix-ui/react-dialog": "^1.1.2", + "@radix-ui/react-popover": "^1.1.15", "@radix-ui/react-select": "^2.2.6", "@radix-ui/react-tabs": "^1.1.1", "@radix-ui/react-tooltip": "^1.1.2", "@tanstack/react-query": "^5.90.20", "@tanstack/react-table": "^8.21.3", + "cmdk": "^1.1.1", "next": "16.1.6", "react": "19.2.3", "react-dom": "19.2.3" @@ -2221,6 +2223,43 @@ } } }, + "node_modules/@radix-ui/react-popover": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popover/-/react-popover-1.1.15.tgz", + "integrity": "sha512-kr0X2+6Yy/vJzLYJUPCZEc8SfQcf+1COFoAqauJm74umQhta9M7lNJHP7QQS3vkvcGLQUbWpMzwrXYwrYztHKA==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-dismissable-layer": "1.1.11", + "@radix-ui/react-focus-guards": "1.1.3", + "@radix-ui/react-focus-scope": "1.1.7", + "@radix-ui/react-id": "1.1.1", + "@radix-ui/react-popper": "1.2.8", + "@radix-ui/react-portal": "1.1.9", + "@radix-ui/react-presence": "1.1.5", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-slot": "1.2.3", + "@radix-ui/react-use-controllable-state": "1.2.2", + "aria-hidden": "^1.2.4", + "react-remove-scroll": "^2.6.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-popper": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.8.tgz", @@ -4232,6 +4271,22 @@ "node": ">=6" } }, + "node_modules/cmdk": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cmdk/-/cmdk-1.1.1.tgz", + "integrity": "sha512-Vsv7kFaXm+ptHDMZ7izaRsP70GgrW9NBNGswt9OZaVBLlE0SNpDq8eu/VGXyF9r7M0azK3Wy7OlYXsuyYLFzHg==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "^1.1.1", + "@radix-ui/react-dialog": "^1.1.6", + "@radix-ui/react-id": "^1.1.0", + "@radix-ui/react-primitive": "^2.0.2" + }, + "peerDependencies": { + "react": "^18 || ^19 || ^19.0.0-rc", + "react-dom": "^18 || ^19 || ^19.0.0-rc" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", diff --git a/frontend/package.json b/frontend/package.json index 779facef..97dad9cc 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,12 +12,14 @@ }, "dependencies": { "@clerk/nextjs": "^6.37.1", + "@radix-ui/react-popover": "^1.1.15", "@radix-ui/react-dialog": "^1.1.2", "@radix-ui/react-select": "^2.2.6", "@radix-ui/react-tabs": "^1.1.1", "@radix-ui/react-tooltip": "^1.1.2", "@tanstack/react-query": "^5.90.20", "@tanstack/react-table": "^8.21.3", + "cmdk": "^1.1.1", "next": "16.1.6", "react": "19.2.3", "react-dom": "19.2.3" diff --git a/frontend/src/api/generated/activity/activity.ts b/frontend/src/api/generated/activity/activity.ts new file mode 100644 index 00000000..11d36331 --- /dev/null +++ b/frontend/src/api/generated/activity/activity.ts @@ -0,0 +1,238 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ +import { useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + ActivityEventRead, + HTTPValidationError, + ListActivityApiV1ActivityGetParams, +} from ".././model"; + +import { customFetch } from "../../mutator"; + +type SecondParameter unknown> = Parameters[1]; + +/** + * @summary List Activity + */ +export type listActivityApiV1ActivityGetResponse200 = { + data: ActivityEventRead[]; + status: 200; +}; + +export type listActivityApiV1ActivityGetResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type listActivityApiV1ActivityGetResponseSuccess = + listActivityApiV1ActivityGetResponse200 & { + headers: Headers; + }; +export type listActivityApiV1ActivityGetResponseError = + listActivityApiV1ActivityGetResponse422 & { + headers: Headers; + }; + +export type listActivityApiV1ActivityGetResponse = + | listActivityApiV1ActivityGetResponseSuccess + | listActivityApiV1ActivityGetResponseError; + +export const getListActivityApiV1ActivityGetUrl = ( + params?: ListActivityApiV1ActivityGetParams, +) => { + const normalizedParams = new URLSearchParams(); + + Object.entries(params || {}).forEach(([key, value]) => { + if (value !== undefined) { + normalizedParams.append(key, value === null ? "null" : value.toString()); + } + }); + + const stringifiedParams = normalizedParams.toString(); + + return stringifiedParams.length > 0 + ? `/api/v1/activity?${stringifiedParams}` + : `/api/v1/activity`; +}; + +export const listActivityApiV1ActivityGet = async ( + params?: ListActivityApiV1ActivityGetParams, + options?: RequestInit, +): Promise => { + return customFetch( + getListActivityApiV1ActivityGetUrl(params), + { + ...options, + method: "GET", + }, + ); +}; + +export const getListActivityApiV1ActivityGetQueryKey = ( + params?: ListActivityApiV1ActivityGetParams, +) => { + return [`/api/v1/activity`, ...(params ? [params] : [])] as const; +}; + +export const getListActivityApiV1ActivityGetQueryOptions = < + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListActivityApiV1ActivityGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getListActivityApiV1ActivityGetQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + listActivityApiV1ActivityGet(params, { signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ListActivityApiV1ActivityGetQueryResult = NonNullable< + Awaited> +>; +export type ListActivityApiV1ActivityGetQueryError = HTTPValidationError; + +export function useListActivityApiV1ActivityGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params: undefined | ListActivityApiV1ActivityGetParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useListActivityApiV1ActivityGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListActivityApiV1ActivityGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useListActivityApiV1ActivityGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListActivityApiV1ActivityGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Activity + */ + +export function useListActivityApiV1ActivityGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListActivityApiV1ActivityGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getListActivityApiV1ActivityGetQueryOptions( + params, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} diff --git a/frontend/src/api/generated/agents/agents.ts b/frontend/src/api/generated/agents/agents.ts new file mode 100644 index 00000000..b8c8602b --- /dev/null +++ b/frontend/src/api/generated/agents/agents.ts @@ -0,0 +1,1315 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ +import { useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + AgentCreate, + AgentDeleteConfirm, + AgentHeartbeat, + AgentHeartbeatCreate, + AgentProvisionConfirm, + AgentRead, + AgentUpdate, + ConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost200, + ConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost200, + DeleteAgentApiV1AgentsAgentIdDelete200, + HTTPValidationError, +} from ".././model"; + +import { customFetch } from "../../mutator"; + +type SecondParameter unknown> = Parameters[1]; + +/** + * @summary List Agents + */ +export type listAgentsApiV1AgentsGetResponse200 = { + data: AgentRead[]; + status: 200; +}; + +export type listAgentsApiV1AgentsGetResponseSuccess = + listAgentsApiV1AgentsGetResponse200 & { + headers: Headers; + }; +export type listAgentsApiV1AgentsGetResponse = + listAgentsApiV1AgentsGetResponseSuccess; + +export const getListAgentsApiV1AgentsGetUrl = () => { + return `/api/v1/agents`; +}; + +export const listAgentsApiV1AgentsGet = async ( + options?: RequestInit, +): Promise => { + return customFetch( + getListAgentsApiV1AgentsGetUrl(), + { + ...options, + method: "GET", + }, + ); +}; + +export const getListAgentsApiV1AgentsGetQueryKey = () => { + return [`/api/v1/agents`] as const; +}; + +export const getListAgentsApiV1AgentsGetQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; +}) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getListAgentsApiV1AgentsGetQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => listAgentsApiV1AgentsGet({ signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ListAgentsApiV1AgentsGetQueryResult = NonNullable< + Awaited> +>; +export type ListAgentsApiV1AgentsGetQueryError = unknown; + +export function useListAgentsApiV1AgentsGet< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useListAgentsApiV1AgentsGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useListAgentsApiV1AgentsGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Agents + */ + +export function useListAgentsApiV1AgentsGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getListAgentsApiV1AgentsGetQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + +/** + * @summary Create Agent + */ +export type createAgentApiV1AgentsPostResponse200 = { + data: AgentRead; + status: 200; +}; + +export type createAgentApiV1AgentsPostResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type createAgentApiV1AgentsPostResponseSuccess = + createAgentApiV1AgentsPostResponse200 & { + headers: Headers; + }; +export type createAgentApiV1AgentsPostResponseError = + createAgentApiV1AgentsPostResponse422 & { + headers: Headers; + }; + +export type createAgentApiV1AgentsPostResponse = + | createAgentApiV1AgentsPostResponseSuccess + | createAgentApiV1AgentsPostResponseError; + +export const getCreateAgentApiV1AgentsPostUrl = () => { + return `/api/v1/agents`; +}; + +export const createAgentApiV1AgentsPost = async ( + agentCreate: AgentCreate, + options?: RequestInit, +): Promise => { + return customFetch( + getCreateAgentApiV1AgentsPostUrl(), + { + ...options, + method: "POST", + headers: { "Content-Type": "application/json", ...options?.headers }, + body: JSON.stringify(agentCreate), + }, + ); +}; + +export const getCreateAgentApiV1AgentsPostMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: AgentCreate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { data: AgentCreate }, + TContext +> => { + const mutationKey = ["createAgentApiV1AgentsPost"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { data: AgentCreate } + > = (props) => { + const { data } = props ?? {}; + + return createAgentApiV1AgentsPost(data, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type CreateAgentApiV1AgentsPostMutationResult = NonNullable< + Awaited> +>; +export type CreateAgentApiV1AgentsPostMutationBody = AgentCreate; +export type CreateAgentApiV1AgentsPostMutationError = HTTPValidationError; + +/** + * @summary Create Agent + */ +export const useCreateAgentApiV1AgentsPost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: AgentCreate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: AgentCreate }, + TContext +> => { + return useMutation( + getCreateAgentApiV1AgentsPostMutationOptions(options), + queryClient, + ); +}; +/** + * @summary Get Agent + */ +export type getAgentApiV1AgentsAgentIdGetResponse200 = { + data: AgentRead; + status: 200; +}; + +export type getAgentApiV1AgentsAgentIdGetResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type getAgentApiV1AgentsAgentIdGetResponseSuccess = + getAgentApiV1AgentsAgentIdGetResponse200 & { + headers: Headers; + }; +export type getAgentApiV1AgentsAgentIdGetResponseError = + getAgentApiV1AgentsAgentIdGetResponse422 & { + headers: Headers; + }; + +export type getAgentApiV1AgentsAgentIdGetResponse = + | getAgentApiV1AgentsAgentIdGetResponseSuccess + | getAgentApiV1AgentsAgentIdGetResponseError; + +export const getGetAgentApiV1AgentsAgentIdGetUrl = (agentId: string) => { + return `/api/v1/agents/${agentId}`; +}; + +export const getAgentApiV1AgentsAgentIdGet = async ( + agentId: string, + options?: RequestInit, +): Promise => { + return customFetch( + getGetAgentApiV1AgentsAgentIdGetUrl(agentId), + { + ...options, + method: "GET", + }, + ); +}; + +export const getGetAgentApiV1AgentsAgentIdGetQueryKey = (agentId: string) => { + return [`/api/v1/agents/${agentId}`] as const; +}; + +export const getGetAgentApiV1AgentsAgentIdGetQueryOptions = < + TData = Awaited>, + TError = HTTPValidationError, +>( + agentId: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getGetAgentApiV1AgentsAgentIdGetQueryKey(agentId); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + getAgentApiV1AgentsAgentIdGet(agentId, { signal, ...requestOptions }); + + return { + queryKey, + queryFn, + enabled: !!agentId, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type GetAgentApiV1AgentsAgentIdGetQueryResult = NonNullable< + Awaited> +>; +export type GetAgentApiV1AgentsAgentIdGetQueryError = HTTPValidationError; + +export function useGetAgentApiV1AgentsAgentIdGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + agentId: string, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useGetAgentApiV1AgentsAgentIdGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + agentId: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useGetAgentApiV1AgentsAgentIdGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + agentId: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get Agent + */ + +export function useGetAgentApiV1AgentsAgentIdGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + agentId: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getGetAgentApiV1AgentsAgentIdGetQueryOptions( + agentId, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + +/** + * @summary Update Agent + */ +export type updateAgentApiV1AgentsAgentIdPatchResponse200 = { + data: AgentRead; + status: 200; +}; + +export type updateAgentApiV1AgentsAgentIdPatchResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type updateAgentApiV1AgentsAgentIdPatchResponseSuccess = + updateAgentApiV1AgentsAgentIdPatchResponse200 & { + headers: Headers; + }; +export type updateAgentApiV1AgentsAgentIdPatchResponseError = + updateAgentApiV1AgentsAgentIdPatchResponse422 & { + headers: Headers; + }; + +export type updateAgentApiV1AgentsAgentIdPatchResponse = + | updateAgentApiV1AgentsAgentIdPatchResponseSuccess + | updateAgentApiV1AgentsAgentIdPatchResponseError; + +export const getUpdateAgentApiV1AgentsAgentIdPatchUrl = (agentId: string) => { + return `/api/v1/agents/${agentId}`; +}; + +export const updateAgentApiV1AgentsAgentIdPatch = async ( + agentId: string, + agentUpdate: AgentUpdate, + options?: RequestInit, +): Promise => { + return customFetch( + getUpdateAgentApiV1AgentsAgentIdPatchUrl(agentId), + { + ...options, + method: "PATCH", + headers: { "Content-Type": "application/json", ...options?.headers }, + body: JSON.stringify(agentUpdate), + }, + ); +}; + +export const getUpdateAgentApiV1AgentsAgentIdPatchMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { agentId: string; data: AgentUpdate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { agentId: string; data: AgentUpdate }, + TContext +> => { + const mutationKey = ["updateAgentApiV1AgentsAgentIdPatch"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { agentId: string; data: AgentUpdate } + > = (props) => { + const { agentId, data } = props ?? {}; + + return updateAgentApiV1AgentsAgentIdPatch(agentId, data, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type UpdateAgentApiV1AgentsAgentIdPatchMutationResult = NonNullable< + Awaited> +>; +export type UpdateAgentApiV1AgentsAgentIdPatchMutationBody = AgentUpdate; +export type UpdateAgentApiV1AgentsAgentIdPatchMutationError = + HTTPValidationError; + +/** + * @summary Update Agent + */ +export const useUpdateAgentApiV1AgentsAgentIdPatch = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { agentId: string; data: AgentUpdate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { agentId: string; data: AgentUpdate }, + TContext +> => { + return useMutation( + getUpdateAgentApiV1AgentsAgentIdPatchMutationOptions(options), + queryClient, + ); +}; +/** + * @summary Delete Agent + */ +export type deleteAgentApiV1AgentsAgentIdDeleteResponse200 = { + data: DeleteAgentApiV1AgentsAgentIdDelete200; + status: 200; +}; + +export type deleteAgentApiV1AgentsAgentIdDeleteResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type deleteAgentApiV1AgentsAgentIdDeleteResponseSuccess = + deleteAgentApiV1AgentsAgentIdDeleteResponse200 & { + headers: Headers; + }; +export type deleteAgentApiV1AgentsAgentIdDeleteResponseError = + deleteAgentApiV1AgentsAgentIdDeleteResponse422 & { + headers: Headers; + }; + +export type deleteAgentApiV1AgentsAgentIdDeleteResponse = + | deleteAgentApiV1AgentsAgentIdDeleteResponseSuccess + | deleteAgentApiV1AgentsAgentIdDeleteResponseError; + +export const getDeleteAgentApiV1AgentsAgentIdDeleteUrl = (agentId: string) => { + return `/api/v1/agents/${agentId}`; +}; + +export const deleteAgentApiV1AgentsAgentIdDelete = async ( + agentId: string, + options?: RequestInit, +): Promise => { + return customFetch( + getDeleteAgentApiV1AgentsAgentIdDeleteUrl(agentId), + { + ...options, + method: "DELETE", + }, + ); +}; + +export const getDeleteAgentApiV1AgentsAgentIdDeleteMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { agentId: string }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { agentId: string }, + TContext +> => { + const mutationKey = ["deleteAgentApiV1AgentsAgentIdDelete"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { agentId: string } + > = (props) => { + const { agentId } = props ?? {}; + + return deleteAgentApiV1AgentsAgentIdDelete(agentId, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type DeleteAgentApiV1AgentsAgentIdDeleteMutationResult = NonNullable< + Awaited> +>; + +export type DeleteAgentApiV1AgentsAgentIdDeleteMutationError = + HTTPValidationError; + +/** + * @summary Delete Agent + */ +export const useDeleteAgentApiV1AgentsAgentIdDelete = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { agentId: string }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { agentId: string }, + TContext +> => { + return useMutation( + getDeleteAgentApiV1AgentsAgentIdDeleteMutationOptions(options), + queryClient, + ); +}; +/** + * @summary Heartbeat Agent + */ +export type heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponse200 = { + data: AgentRead; + status: 200; +}; + +export type heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponseSuccess = + heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponse200 & { + headers: Headers; + }; +export type heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponseError = + heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponse422 & { + headers: Headers; + }; + +export type heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponse = + | heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponseSuccess + | heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponseError; + +export const getHeartbeatAgentApiV1AgentsAgentIdHeartbeatPostUrl = ( + agentId: string, +) => { + return `/api/v1/agents/${agentId}/heartbeat`; +}; + +export const heartbeatAgentApiV1AgentsAgentIdHeartbeatPost = async ( + agentId: string, + agentHeartbeat: AgentHeartbeat, + options?: RequestInit, +): Promise => { + return customFetch( + getHeartbeatAgentApiV1AgentsAgentIdHeartbeatPostUrl(agentId), + { + ...options, + method: "POST", + headers: { "Content-Type": "application/json", ...options?.headers }, + body: JSON.stringify(agentHeartbeat), + }, + ); +}; + +export const getHeartbeatAgentApiV1AgentsAgentIdHeartbeatPostMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { agentId: string; data: AgentHeartbeat }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { agentId: string; data: AgentHeartbeat }, + TContext +> => { + const mutationKey = ["heartbeatAgentApiV1AgentsAgentIdHeartbeatPost"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { agentId: string; data: AgentHeartbeat } + > = (props) => { + const { agentId, data } = props ?? {}; + + return heartbeatAgentApiV1AgentsAgentIdHeartbeatPost( + agentId, + data, + requestOptions, + ); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type HeartbeatAgentApiV1AgentsAgentIdHeartbeatPostMutationResult = + NonNullable< + Awaited> + >; +export type HeartbeatAgentApiV1AgentsAgentIdHeartbeatPostMutationBody = + AgentHeartbeat; +export type HeartbeatAgentApiV1AgentsAgentIdHeartbeatPostMutationError = + HTTPValidationError; + +/** + * @summary Heartbeat Agent + */ +export const useHeartbeatAgentApiV1AgentsAgentIdHeartbeatPost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { agentId: string; data: AgentHeartbeat }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { agentId: string; data: AgentHeartbeat }, + TContext +> => { + return useMutation( + getHeartbeatAgentApiV1AgentsAgentIdHeartbeatPostMutationOptions(options), + queryClient, + ); +}; +/** + * @summary Heartbeat Or Create Agent + */ +export type heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponse200 = { + data: AgentRead; + status: 200; +}; + +export type heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponseSuccess = + heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponse200 & { + headers: Headers; + }; +export type heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponseError = + heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponse422 & { + headers: Headers; + }; + +export type heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponse = + | heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponseSuccess + | heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponseError; + +export const getHeartbeatOrCreateAgentApiV1AgentsHeartbeatPostUrl = () => { + return `/api/v1/agents/heartbeat`; +}; + +export const heartbeatOrCreateAgentApiV1AgentsHeartbeatPost = async ( + agentHeartbeatCreate: AgentHeartbeatCreate, + options?: RequestInit, +): Promise => { + return customFetch( + getHeartbeatOrCreateAgentApiV1AgentsHeartbeatPostUrl(), + { + ...options, + method: "POST", + headers: { "Content-Type": "application/json", ...options?.headers }, + body: JSON.stringify(agentHeartbeatCreate), + }, + ); +}; + +export const getHeartbeatOrCreateAgentApiV1AgentsHeartbeatPostMutationOptions = + (options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType + >, + TError, + { data: AgentHeartbeatCreate }, + TContext + >; + request?: SecondParameter; + }): UseMutationOptions< + Awaited>, + TError, + { data: AgentHeartbeatCreate }, + TContext + > => { + const mutationKey = ["heartbeatOrCreateAgentApiV1AgentsHeartbeatPost"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited< + ReturnType + >, + { data: AgentHeartbeatCreate } + > = (props) => { + const { data } = props ?? {}; + + return heartbeatOrCreateAgentApiV1AgentsHeartbeatPost( + data, + requestOptions, + ); + }; + + return { mutationFn, ...mutationOptions }; + }; + +export type HeartbeatOrCreateAgentApiV1AgentsHeartbeatPostMutationResult = + NonNullable< + Awaited> + >; +export type HeartbeatOrCreateAgentApiV1AgentsHeartbeatPostMutationBody = + AgentHeartbeatCreate; +export type HeartbeatOrCreateAgentApiV1AgentsHeartbeatPostMutationError = + HTTPValidationError; + +/** + * @summary Heartbeat Or Create Agent + */ +export const useHeartbeatOrCreateAgentApiV1AgentsHeartbeatPost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType + >, + TError, + { data: AgentHeartbeatCreate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: AgentHeartbeatCreate }, + TContext +> => { + return useMutation( + getHeartbeatOrCreateAgentApiV1AgentsHeartbeatPostMutationOptions(options), + queryClient, + ); +}; +/** + * @summary Confirm Provision Agent + */ +export type confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponse200 = + { + data: ConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost200; + status: 200; + }; + +export type confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponse422 = + { + data: HTTPValidationError; + status: 422; + }; + +export type confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponseSuccess = + confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponse200 & { + headers: Headers; + }; +export type confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponseError = + confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponse422 & { + headers: Headers; + }; + +export type confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponse = + + | confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponseSuccess + | confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponseError; + +export const getConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostUrl = + (agentId: string) => { + return `/api/v1/agents/${agentId}/provision/confirm`; + }; + +export const confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost = + async ( + agentId: string, + agentProvisionConfirm: AgentProvisionConfirm, + options?: RequestInit, + ): Promise => { + return customFetch( + getConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostUrl( + agentId, + ), + { + ...options, + method: "POST", + headers: { "Content-Type": "application/json", ...options?.headers }, + body: JSON.stringify(agentProvisionConfirm), + }, + ); + }; + +export const getConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostMutationOptions = + (options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType< + typeof confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost + > + >, + TError, + { agentId: string; data: AgentProvisionConfirm }, + TContext + >; + request?: SecondParameter; + }): UseMutationOptions< + Awaited< + ReturnType< + typeof confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost + > + >, + TError, + { agentId: string; data: AgentProvisionConfirm }, + TContext + > => { + const mutationKey = [ + "confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost", + ]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited< + ReturnType< + typeof confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost + > + >, + { agentId: string; data: AgentProvisionConfirm } + > = (props) => { + const { agentId, data } = props ?? {}; + + return confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost( + agentId, + data, + requestOptions, + ); + }; + + return { mutationFn, ...mutationOptions }; + }; + +export type ConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostMutationResult = + NonNullable< + Awaited< + ReturnType< + typeof confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost + > + > + >; +export type ConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostMutationBody = + AgentProvisionConfirm; +export type ConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostMutationError = + HTTPValidationError; + +/** + * @summary Confirm Provision Agent + */ +export const useConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType< + typeof confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost + > + >, + TError, + { agentId: string; data: AgentProvisionConfirm }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited< + ReturnType< + typeof confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost + > + >, + TError, + { agentId: string; data: AgentProvisionConfirm }, + TContext +> => { + return useMutation( + getConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostMutationOptions( + options, + ), + queryClient, + ); +}; +/** + * @summary Confirm Delete Agent + */ +export type confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponse200 = { + data: ConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost200; + status: 200; +}; + +export type confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponseSuccess = + confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponse200 & { + headers: Headers; + }; +export type confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponseError = + confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponse422 & { + headers: Headers; + }; + +export type confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponse = + | confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponseSuccess + | confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponseError; + +export const getConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostUrl = ( + agentId: string, +) => { + return `/api/v1/agents/${agentId}/delete/confirm`; +}; + +export const confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost = async ( + agentId: string, + agentDeleteConfirm: AgentDeleteConfirm, + options?: RequestInit, +): Promise => { + return customFetch( + getConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostUrl(agentId), + { + ...options, + method: "POST", + headers: { "Content-Type": "application/json", ...options?.headers }, + body: JSON.stringify(agentDeleteConfirm), + }, + ); +}; + +export const getConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostMutationOptions = + (options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType + >, + TError, + { agentId: string; data: AgentDeleteConfirm }, + TContext + >; + request?: SecondParameter; + }): UseMutationOptions< + Awaited< + ReturnType + >, + TError, + { agentId: string; data: AgentDeleteConfirm }, + TContext + > => { + const mutationKey = [ + "confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost", + ]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited< + ReturnType + >, + { agentId: string; data: AgentDeleteConfirm } + > = (props) => { + const { agentId, data } = props ?? {}; + + return confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost( + agentId, + data, + requestOptions, + ); + }; + + return { mutationFn, ...mutationOptions }; + }; + +export type ConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostMutationResult = + NonNullable< + Awaited< + ReturnType + > + >; +export type ConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostMutationBody = + AgentDeleteConfirm; +export type ConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostMutationError = + HTTPValidationError; + +/** + * @summary Confirm Delete Agent + */ +export const useConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType + >, + TError, + { agentId: string; data: AgentDeleteConfirm }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited< + ReturnType + >, + TError, + { agentId: string; data: AgentDeleteConfirm }, + TContext +> => { + return useMutation( + getConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostMutationOptions( + options, + ), + queryClient, + ); +}; diff --git a/frontend/src/api/generated/auth/auth.ts b/frontend/src/api/generated/auth/auth.ts new file mode 100644 index 00000000..0b30a252 --- /dev/null +++ b/frontend/src/api/generated/auth/auth.ts @@ -0,0 +1,121 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ +import { useMutation } from "@tanstack/react-query"; +import type { + MutationFunction, + QueryClient, + UseMutationOptions, + UseMutationResult, +} from "@tanstack/react-query"; + +import type { UserRead } from ".././model"; + +import { customFetch } from "../../mutator"; + +type SecondParameter unknown> = Parameters[1]; + +/** + * @summary Bootstrap User + */ +export type bootstrapUserApiV1AuthBootstrapPostResponse200 = { + data: UserRead; + status: 200; +}; + +export type bootstrapUserApiV1AuthBootstrapPostResponseSuccess = + bootstrapUserApiV1AuthBootstrapPostResponse200 & { + headers: Headers; + }; +export type bootstrapUserApiV1AuthBootstrapPostResponse = + bootstrapUserApiV1AuthBootstrapPostResponseSuccess; + +export const getBootstrapUserApiV1AuthBootstrapPostUrl = () => { + return `/api/v1/auth/bootstrap`; +}; + +export const bootstrapUserApiV1AuthBootstrapPost = async ( + options?: RequestInit, +): Promise => { + return customFetch( + getBootstrapUserApiV1AuthBootstrapPostUrl(), + { + ...options, + method: "POST", + }, + ); +}; + +export const getBootstrapUserApiV1AuthBootstrapPostMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + void, + TContext +> => { + const mutationKey = ["bootstrapUserApiV1AuthBootstrapPost"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + void + > = () => { + return bootstrapUserApiV1AuthBootstrapPost(requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type BootstrapUserApiV1AuthBootstrapPostMutationResult = NonNullable< + Awaited> +>; + +export type BootstrapUserApiV1AuthBootstrapPostMutationError = unknown; + +/** + * @summary Bootstrap User + */ +export const useBootstrapUserApiV1AuthBootstrapPost = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + void, + TContext +> => { + return useMutation( + getBootstrapUserApiV1AuthBootstrapPostMutationOptions(options), + queryClient, + ); +}; diff --git a/frontend/src/api/generated/boards/boards.ts b/frontend/src/api/generated/boards/boards.ts new file mode 100644 index 00000000..fe993b75 --- /dev/null +++ b/frontend/src/api/generated/boards/boards.ts @@ -0,0 +1,767 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ +import { useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + BoardCreate, + BoardRead, + BoardUpdate, + DeleteBoardApiV1BoardsBoardIdDelete200, + HTTPValidationError, +} from ".././model"; + +import { customFetch } from "../../mutator"; + +type SecondParameter unknown> = Parameters[1]; + +/** + * @summary List Boards + */ +export type listBoardsApiV1BoardsGetResponse200 = { + data: BoardRead[]; + status: 200; +}; + +export type listBoardsApiV1BoardsGetResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type listBoardsApiV1BoardsGetResponseSuccess = + listBoardsApiV1BoardsGetResponse200 & { + headers: Headers; + }; +export type listBoardsApiV1BoardsGetResponseError = + listBoardsApiV1BoardsGetResponse422 & { + headers: Headers; + }; + +export type listBoardsApiV1BoardsGetResponse = + | listBoardsApiV1BoardsGetResponseSuccess + | listBoardsApiV1BoardsGetResponseError; + +export const getListBoardsApiV1BoardsGetUrl = () => { + return `/api/v1/boards`; +}; + +export const listBoardsApiV1BoardsGet = async ( + options?: RequestInit, +): Promise => { + return customFetch( + getListBoardsApiV1BoardsGetUrl(), + { + ...options, + method: "GET", + }, + ); +}; + +export const getListBoardsApiV1BoardsGetQueryKey = () => { + return [`/api/v1/boards`] as const; +}; + +export const getListBoardsApiV1BoardsGetQueryOptions = < + TData = Awaited>, + TError = HTTPValidationError, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; +}) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getListBoardsApiV1BoardsGetQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => listBoardsApiV1BoardsGet({ signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ListBoardsApiV1BoardsGetQueryResult = NonNullable< + Awaited> +>; +export type ListBoardsApiV1BoardsGetQueryError = HTTPValidationError; + +export function useListBoardsApiV1BoardsGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useListBoardsApiV1BoardsGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useListBoardsApiV1BoardsGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Boards + */ + +export function useListBoardsApiV1BoardsGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getListBoardsApiV1BoardsGetQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + +/** + * @summary Create Board + */ +export type createBoardApiV1BoardsPostResponse200 = { + data: BoardRead; + status: 200; +}; + +export type createBoardApiV1BoardsPostResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type createBoardApiV1BoardsPostResponseSuccess = + createBoardApiV1BoardsPostResponse200 & { + headers: Headers; + }; +export type createBoardApiV1BoardsPostResponseError = + createBoardApiV1BoardsPostResponse422 & { + headers: Headers; + }; + +export type createBoardApiV1BoardsPostResponse = + | createBoardApiV1BoardsPostResponseSuccess + | createBoardApiV1BoardsPostResponseError; + +export const getCreateBoardApiV1BoardsPostUrl = () => { + return `/api/v1/boards`; +}; + +export const createBoardApiV1BoardsPost = async ( + boardCreate: BoardCreate, + options?: RequestInit, +): Promise => { + return customFetch( + getCreateBoardApiV1BoardsPostUrl(), + { + ...options, + method: "POST", + headers: { "Content-Type": "application/json", ...options?.headers }, + body: JSON.stringify(boardCreate), + }, + ); +}; + +export const getCreateBoardApiV1BoardsPostMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BoardCreate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { data: BoardCreate }, + TContext +> => { + const mutationKey = ["createBoardApiV1BoardsPost"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { data: BoardCreate } + > = (props) => { + const { data } = props ?? {}; + + return createBoardApiV1BoardsPost(data, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type CreateBoardApiV1BoardsPostMutationResult = NonNullable< + Awaited> +>; +export type CreateBoardApiV1BoardsPostMutationBody = BoardCreate; +export type CreateBoardApiV1BoardsPostMutationError = HTTPValidationError; + +/** + * @summary Create Board + */ +export const useCreateBoardApiV1BoardsPost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: BoardCreate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: BoardCreate }, + TContext +> => { + return useMutation( + getCreateBoardApiV1BoardsPostMutationOptions(options), + queryClient, + ); +}; +/** + * @summary Get Board + */ +export type getBoardApiV1BoardsBoardIdGetResponse200 = { + data: BoardRead; + status: 200; +}; + +export type getBoardApiV1BoardsBoardIdGetResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type getBoardApiV1BoardsBoardIdGetResponseSuccess = + getBoardApiV1BoardsBoardIdGetResponse200 & { + headers: Headers; + }; +export type getBoardApiV1BoardsBoardIdGetResponseError = + getBoardApiV1BoardsBoardIdGetResponse422 & { + headers: Headers; + }; + +export type getBoardApiV1BoardsBoardIdGetResponse = + | getBoardApiV1BoardsBoardIdGetResponseSuccess + | getBoardApiV1BoardsBoardIdGetResponseError; + +export const getGetBoardApiV1BoardsBoardIdGetUrl = (boardId: string) => { + return `/api/v1/boards/${boardId}`; +}; + +export const getBoardApiV1BoardsBoardIdGet = async ( + boardId: string, + options?: RequestInit, +): Promise => { + return customFetch( + getGetBoardApiV1BoardsBoardIdGetUrl(boardId), + { + ...options, + method: "GET", + }, + ); +}; + +export const getGetBoardApiV1BoardsBoardIdGetQueryKey = (boardId: string) => { + return [`/api/v1/boards/${boardId}`] as const; +}; + +export const getGetBoardApiV1BoardsBoardIdGetQueryOptions = < + TData = Awaited>, + TError = HTTPValidationError, +>( + boardId: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getGetBoardApiV1BoardsBoardIdGetQueryKey(boardId); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + getBoardApiV1BoardsBoardIdGet(boardId, { signal, ...requestOptions }); + + return { + queryKey, + queryFn, + enabled: !!boardId, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type GetBoardApiV1BoardsBoardIdGetQueryResult = NonNullable< + Awaited> +>; +export type GetBoardApiV1BoardsBoardIdGetQueryError = HTTPValidationError; + +export function useGetBoardApiV1BoardsBoardIdGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + boardId: string, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useGetBoardApiV1BoardsBoardIdGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + boardId: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useGetBoardApiV1BoardsBoardIdGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + boardId: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get Board + */ + +export function useGetBoardApiV1BoardsBoardIdGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + boardId: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getGetBoardApiV1BoardsBoardIdGetQueryOptions( + boardId, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + +/** + * @summary Update Board + */ +export type updateBoardApiV1BoardsBoardIdPatchResponse200 = { + data: BoardRead; + status: 200; +}; + +export type updateBoardApiV1BoardsBoardIdPatchResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type updateBoardApiV1BoardsBoardIdPatchResponseSuccess = + updateBoardApiV1BoardsBoardIdPatchResponse200 & { + headers: Headers; + }; +export type updateBoardApiV1BoardsBoardIdPatchResponseError = + updateBoardApiV1BoardsBoardIdPatchResponse422 & { + headers: Headers; + }; + +export type updateBoardApiV1BoardsBoardIdPatchResponse = + | updateBoardApiV1BoardsBoardIdPatchResponseSuccess + | updateBoardApiV1BoardsBoardIdPatchResponseError; + +export const getUpdateBoardApiV1BoardsBoardIdPatchUrl = (boardId: string) => { + return `/api/v1/boards/${boardId}`; +}; + +export const updateBoardApiV1BoardsBoardIdPatch = async ( + boardId: string, + boardUpdate: BoardUpdate, + options?: RequestInit, +): Promise => { + return customFetch( + getUpdateBoardApiV1BoardsBoardIdPatchUrl(boardId), + { + ...options, + method: "PATCH", + headers: { "Content-Type": "application/json", ...options?.headers }, + body: JSON.stringify(boardUpdate), + }, + ); +}; + +export const getUpdateBoardApiV1BoardsBoardIdPatchMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { boardId: string; data: BoardUpdate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { boardId: string; data: BoardUpdate }, + TContext +> => { + const mutationKey = ["updateBoardApiV1BoardsBoardIdPatch"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { boardId: string; data: BoardUpdate } + > = (props) => { + const { boardId, data } = props ?? {}; + + return updateBoardApiV1BoardsBoardIdPatch(boardId, data, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type UpdateBoardApiV1BoardsBoardIdPatchMutationResult = NonNullable< + Awaited> +>; +export type UpdateBoardApiV1BoardsBoardIdPatchMutationBody = BoardUpdate; +export type UpdateBoardApiV1BoardsBoardIdPatchMutationError = + HTTPValidationError; + +/** + * @summary Update Board + */ +export const useUpdateBoardApiV1BoardsBoardIdPatch = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { boardId: string; data: BoardUpdate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { boardId: string; data: BoardUpdate }, + TContext +> => { + return useMutation( + getUpdateBoardApiV1BoardsBoardIdPatchMutationOptions(options), + queryClient, + ); +}; +/** + * @summary Delete Board + */ +export type deleteBoardApiV1BoardsBoardIdDeleteResponse200 = { + data: DeleteBoardApiV1BoardsBoardIdDelete200; + status: 200; +}; + +export type deleteBoardApiV1BoardsBoardIdDeleteResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type deleteBoardApiV1BoardsBoardIdDeleteResponseSuccess = + deleteBoardApiV1BoardsBoardIdDeleteResponse200 & { + headers: Headers; + }; +export type deleteBoardApiV1BoardsBoardIdDeleteResponseError = + deleteBoardApiV1BoardsBoardIdDeleteResponse422 & { + headers: Headers; + }; + +export type deleteBoardApiV1BoardsBoardIdDeleteResponse = + | deleteBoardApiV1BoardsBoardIdDeleteResponseSuccess + | deleteBoardApiV1BoardsBoardIdDeleteResponseError; + +export const getDeleteBoardApiV1BoardsBoardIdDeleteUrl = (boardId: string) => { + return `/api/v1/boards/${boardId}`; +}; + +export const deleteBoardApiV1BoardsBoardIdDelete = async ( + boardId: string, + options?: RequestInit, +): Promise => { + return customFetch( + getDeleteBoardApiV1BoardsBoardIdDeleteUrl(boardId), + { + ...options, + method: "DELETE", + }, + ); +}; + +export const getDeleteBoardApiV1BoardsBoardIdDeleteMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { boardId: string }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { boardId: string }, + TContext +> => { + const mutationKey = ["deleteBoardApiV1BoardsBoardIdDelete"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { boardId: string } + > = (props) => { + const { boardId } = props ?? {}; + + return deleteBoardApiV1BoardsBoardIdDelete(boardId, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type DeleteBoardApiV1BoardsBoardIdDeleteMutationResult = NonNullable< + Awaited> +>; + +export type DeleteBoardApiV1BoardsBoardIdDeleteMutationError = + HTTPValidationError; + +/** + * @summary Delete Board + */ +export const useDeleteBoardApiV1BoardsBoardIdDelete = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { boardId: string }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { boardId: string }, + TContext +> => { + return useMutation( + getDeleteBoardApiV1BoardsBoardIdDeleteMutationOptions(options), + queryClient, + ); +}; diff --git a/frontend/src/api/generated/default/default.ts b/frontend/src/api/generated/default/default.ts new file mode 100644 index 00000000..9c2ddab6 --- /dev/null +++ b/frontend/src/api/generated/default/default.ts @@ -0,0 +1,515 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ +import { useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + HealthHealthGet200, + HealthzHealthzGet200, + ReadyzReadyzGet200, +} from ".././model"; + +import { customFetch } from "../../mutator"; + +type SecondParameter unknown> = Parameters[1]; + +/** + * @summary Health + */ +export type healthHealthGetResponse200 = { + data: HealthHealthGet200; + status: 200; +}; + +export type healthHealthGetResponseSuccess = healthHealthGetResponse200 & { + headers: Headers; +}; +export type healthHealthGetResponse = healthHealthGetResponseSuccess; + +export const getHealthHealthGetUrl = () => { + return `/health`; +}; + +export const healthHealthGet = async ( + options?: RequestInit, +): Promise => { + return customFetch(getHealthHealthGetUrl(), { + ...options, + method: "GET", + }); +}; + +export const getHealthHealthGetQueryKey = () => { + return [`/health`] as const; +}; + +export const getHealthHealthGetQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions>, TError, TData> + >; + request?: SecondParameter; +}) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getHealthHealthGetQueryKey(); + + const queryFn: QueryFunction>> = ({ + signal, + }) => healthHealthGet({ signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type HealthHealthGetQueryResult = NonNullable< + Awaited> +>; +export type HealthHealthGetQueryError = unknown; + +export function useHealthHealthGet< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useHealthHealthGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useHealthHealthGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Health + */ + +export function useHealthHealthGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getHealthHealthGetQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + +/** + * @summary Healthz + */ +export type healthzHealthzGetResponse200 = { + data: HealthzHealthzGet200; + status: 200; +}; + +export type healthzHealthzGetResponseSuccess = healthzHealthzGetResponse200 & { + headers: Headers; +}; +export type healthzHealthzGetResponse = healthzHealthzGetResponseSuccess; + +export const getHealthzHealthzGetUrl = () => { + return `/healthz`; +}; + +export const healthzHealthzGet = async ( + options?: RequestInit, +): Promise => { + return customFetch(getHealthzHealthzGetUrl(), { + ...options, + method: "GET", + }); +}; + +export const getHealthzHealthzGetQueryKey = () => { + return [`/healthz`] as const; +}; + +export const getHealthzHealthzGetQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; +}) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getHealthzHealthzGetQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => healthzHealthzGet({ signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type HealthzHealthzGetQueryResult = NonNullable< + Awaited> +>; +export type HealthzHealthzGetQueryError = unknown; + +export function useHealthzHealthzGet< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useHealthzHealthzGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useHealthzHealthzGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Healthz + */ + +export function useHealthzHealthzGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getHealthzHealthzGetQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + +/** + * @summary Readyz + */ +export type readyzReadyzGetResponse200 = { + data: ReadyzReadyzGet200; + status: 200; +}; + +export type readyzReadyzGetResponseSuccess = readyzReadyzGetResponse200 & { + headers: Headers; +}; +export type readyzReadyzGetResponse = readyzReadyzGetResponseSuccess; + +export const getReadyzReadyzGetUrl = () => { + return `/readyz`; +}; + +export const readyzReadyzGet = async ( + options?: RequestInit, +): Promise => { + return customFetch(getReadyzReadyzGetUrl(), { + ...options, + method: "GET", + }); +}; + +export const getReadyzReadyzGetQueryKey = () => { + return [`/readyz`] as const; +}; + +export const getReadyzReadyzGetQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions>, TError, TData> + >; + request?: SecondParameter; +}) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getReadyzReadyzGetQueryKey(); + + const queryFn: QueryFunction>> = ({ + signal, + }) => readyzReadyzGet({ signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ReadyzReadyzGetQueryResult = NonNullable< + Awaited> +>; +export type ReadyzReadyzGetQueryError = unknown; + +export function useReadyzReadyzGet< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useReadyzReadyzGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useReadyzReadyzGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Readyz + */ + +export function useReadyzReadyzGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getReadyzReadyzGetQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} diff --git a/frontend/src/api/generated/gateway/gateway.ts b/frontend/src/api/generated/gateway/gateway.ts new file mode 100644 index 00000000..98294e7c --- /dev/null +++ b/frontend/src/api/generated/gateway/gateway.ts @@ -0,0 +1,1416 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ +import { useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + GatewayCommandsApiV1GatewayCommandsGet200, + GatewayStatusApiV1GatewayStatusGet200, + GatewayStatusApiV1GatewayStatusGetParams, + GetGatewaySessionApiV1GatewaySessionsSessionIdGet200, + GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams, + GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet200, + GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams, + HTTPValidationError, + ListSessionsApiV1GatewaySessionsGet200, + ListSessionsApiV1GatewaySessionsGetParams, + SendSessionMessageApiV1GatewaySessionsSessionIdMessagePost200, + SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody, + SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams, +} from ".././model"; + +import { customFetch } from "../../mutator"; + +type SecondParameter unknown> = Parameters[1]; + +/** + * @summary Gateway Status + */ +export type gatewayStatusApiV1GatewayStatusGetResponse200 = { + data: GatewayStatusApiV1GatewayStatusGet200; + status: 200; +}; + +export type gatewayStatusApiV1GatewayStatusGetResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type gatewayStatusApiV1GatewayStatusGetResponseSuccess = + gatewayStatusApiV1GatewayStatusGetResponse200 & { + headers: Headers; + }; +export type gatewayStatusApiV1GatewayStatusGetResponseError = + gatewayStatusApiV1GatewayStatusGetResponse422 & { + headers: Headers; + }; + +export type gatewayStatusApiV1GatewayStatusGetResponse = + | gatewayStatusApiV1GatewayStatusGetResponseSuccess + | gatewayStatusApiV1GatewayStatusGetResponseError; + +export const getGatewayStatusApiV1GatewayStatusGetUrl = ( + params?: GatewayStatusApiV1GatewayStatusGetParams, +) => { + const normalizedParams = new URLSearchParams(); + + Object.entries(params || {}).forEach(([key, value]) => { + if (value !== undefined) { + normalizedParams.append(key, value === null ? "null" : value.toString()); + } + }); + + const stringifiedParams = normalizedParams.toString(); + + return stringifiedParams.length > 0 + ? `/api/v1/gateway/status?${stringifiedParams}` + : `/api/v1/gateway/status`; +}; + +export const gatewayStatusApiV1GatewayStatusGet = async ( + params?: GatewayStatusApiV1GatewayStatusGetParams, + options?: RequestInit, +): Promise => { + return customFetch( + getGatewayStatusApiV1GatewayStatusGetUrl(params), + { + ...options, + method: "GET", + }, + ); +}; + +export const getGatewayStatusApiV1GatewayStatusGetQueryKey = ( + params?: GatewayStatusApiV1GatewayStatusGetParams, +) => { + return [`/api/v1/gateway/status`, ...(params ? [params] : [])] as const; +}; + +export const getGatewayStatusApiV1GatewayStatusGetQueryOptions = < + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: GatewayStatusApiV1GatewayStatusGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getGatewayStatusApiV1GatewayStatusGetQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + gatewayStatusApiV1GatewayStatusGet(params, { signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type GatewayStatusApiV1GatewayStatusGetQueryResult = NonNullable< + Awaited> +>; +export type GatewayStatusApiV1GatewayStatusGetQueryError = HTTPValidationError; + +export function useGatewayStatusApiV1GatewayStatusGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params: undefined | GatewayStatusApiV1GatewayStatusGetParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useGatewayStatusApiV1GatewayStatusGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: GatewayStatusApiV1GatewayStatusGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useGatewayStatusApiV1GatewayStatusGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: GatewayStatusApiV1GatewayStatusGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Gateway Status + */ + +export function useGatewayStatusApiV1GatewayStatusGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: GatewayStatusApiV1GatewayStatusGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getGatewayStatusApiV1GatewayStatusGetQueryOptions( + params, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + +/** + * @summary List Sessions + */ +export type listSessionsApiV1GatewaySessionsGetResponse200 = { + data: ListSessionsApiV1GatewaySessionsGet200; + status: 200; +}; + +export type listSessionsApiV1GatewaySessionsGetResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type listSessionsApiV1GatewaySessionsGetResponseSuccess = + listSessionsApiV1GatewaySessionsGetResponse200 & { + headers: Headers; + }; +export type listSessionsApiV1GatewaySessionsGetResponseError = + listSessionsApiV1GatewaySessionsGetResponse422 & { + headers: Headers; + }; + +export type listSessionsApiV1GatewaySessionsGetResponse = + | listSessionsApiV1GatewaySessionsGetResponseSuccess + | listSessionsApiV1GatewaySessionsGetResponseError; + +export const getListSessionsApiV1GatewaySessionsGetUrl = ( + params?: ListSessionsApiV1GatewaySessionsGetParams, +) => { + const normalizedParams = new URLSearchParams(); + + Object.entries(params || {}).forEach(([key, value]) => { + if (value !== undefined) { + normalizedParams.append(key, value === null ? "null" : value.toString()); + } + }); + + const stringifiedParams = normalizedParams.toString(); + + return stringifiedParams.length > 0 + ? `/api/v1/gateway/sessions?${stringifiedParams}` + : `/api/v1/gateway/sessions`; +}; + +export const listSessionsApiV1GatewaySessionsGet = async ( + params?: ListSessionsApiV1GatewaySessionsGetParams, + options?: RequestInit, +): Promise => { + return customFetch( + getListSessionsApiV1GatewaySessionsGetUrl(params), + { + ...options, + method: "GET", + }, + ); +}; + +export const getListSessionsApiV1GatewaySessionsGetQueryKey = ( + params?: ListSessionsApiV1GatewaySessionsGetParams, +) => { + return [`/api/v1/gateway/sessions`, ...(params ? [params] : [])] as const; +}; + +export const getListSessionsApiV1GatewaySessionsGetQueryOptions = < + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListSessionsApiV1GatewaySessionsGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getListSessionsApiV1GatewaySessionsGetQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + listSessionsApiV1GatewaySessionsGet(params, { signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ListSessionsApiV1GatewaySessionsGetQueryResult = NonNullable< + Awaited> +>; +export type ListSessionsApiV1GatewaySessionsGetQueryError = HTTPValidationError; + +export function useListSessionsApiV1GatewaySessionsGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params: undefined | ListSessionsApiV1GatewaySessionsGetParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useListSessionsApiV1GatewaySessionsGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListSessionsApiV1GatewaySessionsGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useListSessionsApiV1GatewaySessionsGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListSessionsApiV1GatewaySessionsGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Sessions + */ + +export function useListSessionsApiV1GatewaySessionsGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: ListSessionsApiV1GatewaySessionsGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getListSessionsApiV1GatewaySessionsGetQueryOptions( + params, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + +/** + * @summary Get Gateway Session + */ +export type getGatewaySessionApiV1GatewaySessionsSessionIdGetResponse200 = { + data: GetGatewaySessionApiV1GatewaySessionsSessionIdGet200; + status: 200; +}; + +export type getGatewaySessionApiV1GatewaySessionsSessionIdGetResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type getGatewaySessionApiV1GatewaySessionsSessionIdGetResponseSuccess = + getGatewaySessionApiV1GatewaySessionsSessionIdGetResponse200 & { + headers: Headers; + }; +export type getGatewaySessionApiV1GatewaySessionsSessionIdGetResponseError = + getGatewaySessionApiV1GatewaySessionsSessionIdGetResponse422 & { + headers: Headers; + }; + +export type getGatewaySessionApiV1GatewaySessionsSessionIdGetResponse = + | getGatewaySessionApiV1GatewaySessionsSessionIdGetResponseSuccess + | getGatewaySessionApiV1GatewaySessionsSessionIdGetResponseError; + +export const getGetGatewaySessionApiV1GatewaySessionsSessionIdGetUrl = ( + sessionId: string, + params?: GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams, +) => { + const normalizedParams = new URLSearchParams(); + + Object.entries(params || {}).forEach(([key, value]) => { + if (value !== undefined) { + normalizedParams.append(key, value === null ? "null" : value.toString()); + } + }); + + const stringifiedParams = normalizedParams.toString(); + + return stringifiedParams.length > 0 + ? `/api/v1/gateway/sessions/${sessionId}?${stringifiedParams}` + : `/api/v1/gateway/sessions/${sessionId}`; +}; + +export const getGatewaySessionApiV1GatewaySessionsSessionIdGet = async ( + sessionId: string, + params?: GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams, + options?: RequestInit, +): Promise => { + return customFetch( + getGetGatewaySessionApiV1GatewaySessionsSessionIdGetUrl(sessionId, params), + { + ...options, + method: "GET", + }, + ); +}; + +export const getGetGatewaySessionApiV1GatewaySessionsSessionIdGetQueryKey = ( + sessionId: string, + params?: GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams, +) => { + return [ + `/api/v1/gateway/sessions/${sessionId}`, + ...(params ? [params] : []), + ] as const; +}; + +export const getGetGatewaySessionApiV1GatewaySessionsSessionIdGetQueryOptions = + < + TData = Awaited< + ReturnType + >, + TError = HTTPValidationError, + >( + sessionId: string, + params?: GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + request?: SecondParameter; + }, + ) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getGetGatewaySessionApiV1GatewaySessionsSessionIdGetQueryKey( + sessionId, + params, + ); + + const queryFn: QueryFunction< + Awaited< + ReturnType + > + > = ({ signal }) => + getGatewaySessionApiV1GatewaySessionsSessionIdGet(sessionId, params, { + signal, + ...requestOptions, + }); + + return { + queryKey, + queryFn, + enabled: !!sessionId, + ...queryOptions, + } as UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > & { queryKey: DataTag }; + }; + +export type GetGatewaySessionApiV1GatewaySessionsSessionIdGetQueryResult = + NonNullable< + Awaited< + ReturnType + > + >; +export type GetGatewaySessionApiV1GatewaySessionsSessionIdGetQueryError = + HTTPValidationError; + +export function useGetGatewaySessionApiV1GatewaySessionsSessionIdGet< + TData = Awaited< + ReturnType + >, + TError = HTTPValidationError, +>( + sessionId: string, + params: undefined | GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams, + options: { + query: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useGetGatewaySessionApiV1GatewaySessionsSessionIdGet< + TData = Awaited< + ReturnType + >, + TError = HTTPValidationError, +>( + sessionId: string, + params?: GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useGetGatewaySessionApiV1GatewaySessionsSessionIdGet< + TData = Awaited< + ReturnType + >, + TError = HTTPValidationError, +>( + sessionId: string, + params?: GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get Gateway Session + */ + +export function useGetGatewaySessionApiV1GatewaySessionsSessionIdGet< + TData = Awaited< + ReturnType + >, + TError = HTTPValidationError, +>( + sessionId: string, + params?: GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getGetGatewaySessionApiV1GatewaySessionsSessionIdGetQueryOptions( + sessionId, + params, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + +/** + * @summary Get Session History + */ +export type getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponse200 = + { + data: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet200; + status: 200; + }; + +export type getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponse422 = + { + data: HTTPValidationError; + status: 422; + }; + +export type getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponseSuccess = + getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponse200 & { + headers: Headers; + }; +export type getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponseError = + getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponse422 & { + headers: Headers; + }; + +export type getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponse = + | getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponseSuccess + | getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponseError; + +export const getGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetUrl = ( + sessionId: string, + params?: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams, +) => { + const normalizedParams = new URLSearchParams(); + + Object.entries(params || {}).forEach(([key, value]) => { + if (value !== undefined) { + normalizedParams.append(key, value === null ? "null" : value.toString()); + } + }); + + const stringifiedParams = normalizedParams.toString(); + + return stringifiedParams.length > 0 + ? `/api/v1/gateway/sessions/${sessionId}/history?${stringifiedParams}` + : `/api/v1/gateway/sessions/${sessionId}/history`; +}; + +export const getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet = async ( + sessionId: string, + params?: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams, + options?: RequestInit, +): Promise => { + return customFetch( + getGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetUrl( + sessionId, + params, + ), + { + ...options, + method: "GET", + }, + ); +}; + +export const getGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetQueryKey = + ( + sessionId: string, + params?: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams, + ) => { + return [ + `/api/v1/gateway/sessions/${sessionId}/history`, + ...(params ? [params] : []), + ] as const; + }; + +export const getGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetQueryOptions = + < + TData = Awaited< + ReturnType< + typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet + > + >, + TError = HTTPValidationError, + >( + sessionId: string, + params?: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType< + typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet + > + >, + TError, + TData + > + >; + request?: SecondParameter; + }, + ) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetQueryKey( + sessionId, + params, + ); + + const queryFn: QueryFunction< + Awaited< + ReturnType< + typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet + > + > + > = ({ signal }) => + getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet( + sessionId, + params, + { signal, ...requestOptions }, + ); + + return { + queryKey, + queryFn, + enabled: !!sessionId, + ...queryOptions, + } as UseQueryOptions< + Awaited< + ReturnType< + typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet + > + >, + TError, + TData + > & { queryKey: DataTag }; + }; + +export type GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetQueryResult = + NonNullable< + Awaited< + ReturnType< + typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet + > + > + >; +export type GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetQueryError = + HTTPValidationError; + +export function useGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet< + TData = Awaited< + ReturnType + >, + TError = HTTPValidationError, +>( + sessionId: string, + params: + | undefined + | GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams, + options: { + query: Partial< + UseQueryOptions< + Awaited< + ReturnType< + typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet + > + >, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited< + ReturnType< + typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet + > + >, + TError, + Awaited< + ReturnType< + typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet + > + > + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet< + TData = Awaited< + ReturnType + >, + TError = HTTPValidationError, +>( + sessionId: string, + params?: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType< + typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet + > + >, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited< + ReturnType< + typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet + > + >, + TError, + Awaited< + ReturnType< + typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet + > + > + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet< + TData = Awaited< + ReturnType + >, + TError = HTTPValidationError, +>( + sessionId: string, + params?: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType< + typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet + > + >, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get Session History + */ + +export function useGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet< + TData = Awaited< + ReturnType + >, + TError = HTTPValidationError, +>( + sessionId: string, + params?: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType< + typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet + > + >, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetQueryOptions( + sessionId, + params, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + +/** + * @summary Send Session Message + */ +export type sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponse200 = + { + data: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePost200; + status: 200; + }; + +export type sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponse422 = + { + data: HTTPValidationError; + status: 422; + }; + +export type sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponseSuccess = + sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponse200 & { + headers: Headers; + }; +export type sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponseError = + sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponse422 & { + headers: Headers; + }; + +export type sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponse = + | sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponseSuccess + | sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponseError; + +export const getSendSessionMessageApiV1GatewaySessionsSessionIdMessagePostUrl = + ( + sessionId: string, + params?: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams, + ) => { + const normalizedParams = new URLSearchParams(); + + Object.entries(params || {}).forEach(([key, value]) => { + if (value !== undefined) { + normalizedParams.append( + key, + value === null ? "null" : value.toString(), + ); + } + }); + + const stringifiedParams = normalizedParams.toString(); + + return stringifiedParams.length > 0 + ? `/api/v1/gateway/sessions/${sessionId}/message?${stringifiedParams}` + : `/api/v1/gateway/sessions/${sessionId}/message`; + }; + +export const sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost = + async ( + sessionId: string, + sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody, + params?: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams, + options?: RequestInit, + ): Promise => { + return customFetch( + getSendSessionMessageApiV1GatewaySessionsSessionIdMessagePostUrl( + sessionId, + params, + ), + { + ...options, + method: "POST", + headers: { "Content-Type": "application/json", ...options?.headers }, + body: JSON.stringify( + sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody, + ), + }, + ); + }; + +export const getSendSessionMessageApiV1GatewaySessionsSessionIdMessagePostMutationOptions = + (options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType< + typeof sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost + > + >, + TError, + { + sessionId: string; + data: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody; + params?: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams; + }, + TContext + >; + request?: SecondParameter; + }): UseMutationOptions< + Awaited< + ReturnType< + typeof sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost + > + >, + TError, + { + sessionId: string; + data: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody; + params?: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams; + }, + TContext + > => { + const mutationKey = [ + "sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost", + ]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited< + ReturnType< + typeof sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost + > + >, + { + sessionId: string; + data: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody; + params?: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams; + } + > = (props) => { + const { sessionId, data, params } = props ?? {}; + + return sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost( + sessionId, + data, + params, + requestOptions, + ); + }; + + return { mutationFn, ...mutationOptions }; + }; + +export type SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostMutationResult = + NonNullable< + Awaited< + ReturnType< + typeof sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost + > + > + >; +export type SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostMutationBody = + SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody; +export type SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostMutationError = + HTTPValidationError; + +/** + * @summary Send Session Message + */ +export const useSendSessionMessageApiV1GatewaySessionsSessionIdMessagePost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType< + typeof sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost + > + >, + TError, + { + sessionId: string; + data: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody; + params?: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams; + }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited< + ReturnType< + typeof sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost + > + >, + TError, + { + sessionId: string; + data: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody; + params?: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams; + }, + TContext +> => { + return useMutation( + getSendSessionMessageApiV1GatewaySessionsSessionIdMessagePostMutationOptions( + options, + ), + queryClient, + ); +}; +/** + * @summary Gateway Commands + */ +export type gatewayCommandsApiV1GatewayCommandsGetResponse200 = { + data: GatewayCommandsApiV1GatewayCommandsGet200; + status: 200; +}; + +export type gatewayCommandsApiV1GatewayCommandsGetResponseSuccess = + gatewayCommandsApiV1GatewayCommandsGetResponse200 & { + headers: Headers; + }; +export type gatewayCommandsApiV1GatewayCommandsGetResponse = + gatewayCommandsApiV1GatewayCommandsGetResponseSuccess; + +export const getGatewayCommandsApiV1GatewayCommandsGetUrl = () => { + return `/api/v1/gateway/commands`; +}; + +export const gatewayCommandsApiV1GatewayCommandsGet = async ( + options?: RequestInit, +): Promise => { + return customFetch( + getGatewayCommandsApiV1GatewayCommandsGetUrl(), + { + ...options, + method: "GET", + }, + ); +}; + +export const getGatewayCommandsApiV1GatewayCommandsGetQueryKey = () => { + return [`/api/v1/gateway/commands`] as const; +}; + +export const getGatewayCommandsApiV1GatewayCommandsGetQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; +}) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getGatewayCommandsApiV1GatewayCommandsGetQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + gatewayCommandsApiV1GatewayCommandsGet({ signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type GatewayCommandsApiV1GatewayCommandsGetQueryResult = NonNullable< + Awaited> +>; +export type GatewayCommandsApiV1GatewayCommandsGetQueryError = unknown; + +export function useGatewayCommandsApiV1GatewayCommandsGet< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useGatewayCommandsApiV1GatewayCommandsGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useGatewayCommandsApiV1GatewayCommandsGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Gateway Commands + */ + +export function useGatewayCommandsApiV1GatewayCommandsGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getGatewayCommandsApiV1GatewayCommandsGetQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} diff --git a/frontend/src/api/generated/model/activityEventRead.ts b/frontend/src/api/generated/model/activityEventRead.ts new file mode 100644 index 00000000..18e1e8c5 --- /dev/null +++ b/frontend/src/api/generated/model/activityEventRead.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface ActivityEventRead { + id: string; + event_type: string; + message: string | null; + agent_id: string | null; + task_id: string | null; + created_at: string; +} diff --git a/frontend/src/api/generated/model/agentCreate.ts b/frontend/src/api/generated/model/agentCreate.ts new file mode 100644 index 00000000..82df9dc5 --- /dev/null +++ b/frontend/src/api/generated/model/agentCreate.ts @@ -0,0 +1,14 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ +import type { AgentCreateHeartbeatConfig } from "./agentCreateHeartbeatConfig"; + +export interface AgentCreate { + board_id?: string | null; + name: string; + status?: string; + heartbeat_config?: AgentCreateHeartbeatConfig; +} diff --git a/frontend/src/api/generated/model/agentCreateHeartbeatConfig.ts b/frontend/src/api/generated/model/agentCreateHeartbeatConfig.ts new file mode 100644 index 00000000..a243bb8b --- /dev/null +++ b/frontend/src/api/generated/model/agentCreateHeartbeatConfig.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type AgentCreateHeartbeatConfig = { [key: string]: unknown } | null; diff --git a/frontend/src/api/generated/model/agentDeleteConfirm.ts b/frontend/src/api/generated/model/agentDeleteConfirm.ts new file mode 100644 index 00000000..b69981fd --- /dev/null +++ b/frontend/src/api/generated/model/agentDeleteConfirm.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface AgentDeleteConfirm { + token: string; +} diff --git a/frontend/src/api/generated/model/agentHeartbeat.ts b/frontend/src/api/generated/model/agentHeartbeat.ts new file mode 100644 index 00000000..bbef5271 --- /dev/null +++ b/frontend/src/api/generated/model/agentHeartbeat.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface AgentHeartbeat { + status?: string | null; +} diff --git a/frontend/src/api/generated/model/agentHeartbeatCreate.ts b/frontend/src/api/generated/model/agentHeartbeatCreate.ts new file mode 100644 index 00000000..a847fa38 --- /dev/null +++ b/frontend/src/api/generated/model/agentHeartbeatCreate.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface AgentHeartbeatCreate { + status?: string | null; + name: string; + board_id?: string | null; +} diff --git a/frontend/src/api/generated/model/agentProvisionConfirm.ts b/frontend/src/api/generated/model/agentProvisionConfirm.ts new file mode 100644 index 00000000..dae32d2a --- /dev/null +++ b/frontend/src/api/generated/model/agentProvisionConfirm.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface AgentProvisionConfirm { + token: string; + action?: string | null; +} diff --git a/frontend/src/api/generated/model/agentRead.ts b/frontend/src/api/generated/model/agentRead.ts new file mode 100644 index 00000000..df553bac --- /dev/null +++ b/frontend/src/api/generated/model/agentRead.ts @@ -0,0 +1,19 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ +import type { AgentReadHeartbeatConfig } from "./agentReadHeartbeatConfig"; + +export interface AgentRead { + board_id?: string | null; + name: string; + status?: string; + heartbeat_config?: AgentReadHeartbeatConfig; + id: string; + openclaw_session_id?: string | null; + last_seen_at: string | null; + created_at: string; + updated_at: string; +} diff --git a/frontend/src/api/generated/model/agentReadHeartbeatConfig.ts b/frontend/src/api/generated/model/agentReadHeartbeatConfig.ts new file mode 100644 index 00000000..859672f9 --- /dev/null +++ b/frontend/src/api/generated/model/agentReadHeartbeatConfig.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type AgentReadHeartbeatConfig = { [key: string]: unknown } | null; diff --git a/frontend/src/api/generated/model/agentUpdate.ts b/frontend/src/api/generated/model/agentUpdate.ts new file mode 100644 index 00000000..dcddf1c3 --- /dev/null +++ b/frontend/src/api/generated/model/agentUpdate.ts @@ -0,0 +1,14 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ +import type { AgentUpdateHeartbeatConfig } from "./agentUpdateHeartbeatConfig"; + +export interface AgentUpdate { + board_id?: string | null; + name?: string | null; + status?: string | null; + heartbeat_config?: AgentUpdateHeartbeatConfig; +} diff --git a/frontend/src/api/generated/model/agentUpdateHeartbeatConfig.ts b/frontend/src/api/generated/model/agentUpdateHeartbeatConfig.ts new file mode 100644 index 00000000..7e3beab8 --- /dev/null +++ b/frontend/src/api/generated/model/agentUpdateHeartbeatConfig.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type AgentUpdateHeartbeatConfig = { [key: string]: unknown } | null; diff --git a/frontend/src/api/generated/model/boardCreate.ts b/frontend/src/api/generated/model/boardCreate.ts new file mode 100644 index 00000000..0694ef04 --- /dev/null +++ b/frontend/src/api/generated/model/boardCreate.ts @@ -0,0 +1,17 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface BoardCreate { + name: string; + slug: string; + gateway_url?: string | null; + gateway_main_session_key?: string | null; + gateway_workspace_root?: string | null; + identity_template?: string | null; + soul_template?: string | null; + gateway_token?: string | null; +} diff --git a/frontend/src/api/generated/model/boardRead.ts b/frontend/src/api/generated/model/boardRead.ts new file mode 100644 index 00000000..e5cff0b9 --- /dev/null +++ b/frontend/src/api/generated/model/boardRead.ts @@ -0,0 +1,19 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface BoardRead { + name: string; + slug: string; + gateway_url?: string | null; + gateway_main_session_key?: string | null; + gateway_workspace_root?: string | null; + identity_template?: string | null; + soul_template?: string | null; + id: string; + created_at: string; + updated_at: string; +} diff --git a/frontend/src/api/generated/model/boardUpdate.ts b/frontend/src/api/generated/model/boardUpdate.ts new file mode 100644 index 00000000..7d3d9610 --- /dev/null +++ b/frontend/src/api/generated/model/boardUpdate.ts @@ -0,0 +1,17 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface BoardUpdate { + name?: string | null; + slug?: string | null; + gateway_url?: string | null; + gateway_token?: string | null; + gateway_main_session_key?: string | null; + gateway_workspace_root?: string | null; + identity_template?: string | null; + soul_template?: string | null; +} diff --git a/frontend/src/api/generated/model/confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost200.ts b/frontend/src/api/generated/model/confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost200.ts new file mode 100644 index 00000000..350c97d9 --- /dev/null +++ b/frontend/src/api/generated/model/confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost200.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type ConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost200 = { + [key: string]: boolean; +}; diff --git a/frontend/src/api/generated/model/confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost200.ts b/frontend/src/api/generated/model/confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost200.ts new file mode 100644 index 00000000..3d705a54 --- /dev/null +++ b/frontend/src/api/generated/model/confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost200.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type ConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost200 = { + [key: string]: boolean; +}; diff --git a/frontend/src/api/generated/model/deleteAgentApiV1AgentsAgentIdDelete200.ts b/frontend/src/api/generated/model/deleteAgentApiV1AgentsAgentIdDelete200.ts new file mode 100644 index 00000000..8e95a0d0 --- /dev/null +++ b/frontend/src/api/generated/model/deleteAgentApiV1AgentsAgentIdDelete200.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type DeleteAgentApiV1AgentsAgentIdDelete200 = { [key: string]: boolean }; diff --git a/frontend/src/api/generated/model/deleteBoardApiV1BoardsBoardIdDelete200.ts b/frontend/src/api/generated/model/deleteBoardApiV1BoardsBoardIdDelete200.ts new file mode 100644 index 00000000..d483c745 --- /dev/null +++ b/frontend/src/api/generated/model/deleteBoardApiV1BoardsBoardIdDelete200.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type DeleteBoardApiV1BoardsBoardIdDelete200 = { [key: string]: boolean }; diff --git a/frontend/src/api/generated/model/deleteTaskApiV1BoardsBoardIdTasksTaskIdDelete200.ts b/frontend/src/api/generated/model/deleteTaskApiV1BoardsBoardIdTasksTaskIdDelete200.ts new file mode 100644 index 00000000..895d2cfc --- /dev/null +++ b/frontend/src/api/generated/model/deleteTaskApiV1BoardsBoardIdTasksTaskIdDelete200.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type DeleteTaskApiV1BoardsBoardIdTasksTaskIdDelete200 = { + [key: string]: boolean; +}; diff --git a/frontend/src/api/generated/model/gatewayCommandsApiV1GatewayCommandsGet200.ts b/frontend/src/api/generated/model/gatewayCommandsApiV1GatewayCommandsGet200.ts new file mode 100644 index 00000000..2ec6a4da --- /dev/null +++ b/frontend/src/api/generated/model/gatewayCommandsApiV1GatewayCommandsGet200.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type GatewayCommandsApiV1GatewayCommandsGet200 = { + [key: string]: unknown; +}; diff --git a/frontend/src/api/generated/model/gatewayStatusApiV1GatewayStatusGet200.ts b/frontend/src/api/generated/model/gatewayStatusApiV1GatewayStatusGet200.ts new file mode 100644 index 00000000..e830a68a --- /dev/null +++ b/frontend/src/api/generated/model/gatewayStatusApiV1GatewayStatusGet200.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type GatewayStatusApiV1GatewayStatusGet200 = { [key: string]: unknown }; diff --git a/frontend/src/api/generated/model/gatewayStatusApiV1GatewayStatusGetParams.ts b/frontend/src/api/generated/model/gatewayStatusApiV1GatewayStatusGetParams.ts new file mode 100644 index 00000000..868f8ba4 --- /dev/null +++ b/frontend/src/api/generated/model/gatewayStatusApiV1GatewayStatusGetParams.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type GatewayStatusApiV1GatewayStatusGetParams = { + board_id?: string | null; +}; diff --git a/frontend/src/api/generated/model/getGatewaySessionApiV1GatewaySessionsSessionIdGet200.ts b/frontend/src/api/generated/model/getGatewaySessionApiV1GatewaySessionsSessionIdGet200.ts new file mode 100644 index 00000000..408b4c3b --- /dev/null +++ b/frontend/src/api/generated/model/getGatewaySessionApiV1GatewaySessionsSessionIdGet200.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type GetGatewaySessionApiV1GatewaySessionsSessionIdGet200 = { + [key: string]: unknown; +}; diff --git a/frontend/src/api/generated/model/getGatewaySessionApiV1GatewaySessionsSessionIdGetParams.ts b/frontend/src/api/generated/model/getGatewaySessionApiV1GatewaySessionsSessionIdGetParams.ts new file mode 100644 index 00000000..f1547876 --- /dev/null +++ b/frontend/src/api/generated/model/getGatewaySessionApiV1GatewaySessionsSessionIdGetParams.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams = { + board_id?: string | null; +}; diff --git a/frontend/src/api/generated/model/getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet200.ts b/frontend/src/api/generated/model/getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet200.ts new file mode 100644 index 00000000..864bbab9 --- /dev/null +++ b/frontend/src/api/generated/model/getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet200.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet200 = { + [key: string]: unknown; +}; diff --git a/frontend/src/api/generated/model/getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams.ts b/frontend/src/api/generated/model/getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams.ts new file mode 100644 index 00000000..46de3da6 --- /dev/null +++ b/frontend/src/api/generated/model/getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams = { + board_id?: string | null; +}; diff --git a/frontend/src/api/generated/model/hTTPValidationError.ts b/frontend/src/api/generated/model/hTTPValidationError.ts new file mode 100644 index 00000000..4a403c5c --- /dev/null +++ b/frontend/src/api/generated/model/hTTPValidationError.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ +import type { ValidationError } from "./validationError"; + +export interface HTTPValidationError { + detail?: ValidationError[]; +} diff --git a/frontend/src/api/generated/model/healthHealthGet200.ts b/frontend/src/api/generated/model/healthHealthGet200.ts new file mode 100644 index 00000000..5c023b94 --- /dev/null +++ b/frontend/src/api/generated/model/healthHealthGet200.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type HealthHealthGet200 = { [key: string]: boolean }; diff --git a/frontend/src/api/generated/model/healthzHealthzGet200.ts b/frontend/src/api/generated/model/healthzHealthzGet200.ts new file mode 100644 index 00000000..a4b906a3 --- /dev/null +++ b/frontend/src/api/generated/model/healthzHealthzGet200.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type HealthzHealthzGet200 = { [key: string]: boolean }; diff --git a/frontend/src/api/generated/model/index.ts b/frontend/src/api/generated/model/index.ts new file mode 100644 index 00000000..dd7cf50d --- /dev/null +++ b/frontend/src/api/generated/model/index.ts @@ -0,0 +1,52 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export * from "./activityEventRead"; +export * from "./agentCreate"; +export * from "./agentCreateHeartbeatConfig"; +export * from "./agentDeleteConfirm"; +export * from "./agentHeartbeat"; +export * from "./agentHeartbeatCreate"; +export * from "./agentProvisionConfirm"; +export * from "./agentRead"; +export * from "./agentReadHeartbeatConfig"; +export * from "./agentUpdate"; +export * from "./agentUpdateHeartbeatConfig"; +export * from "./boardCreate"; +export * from "./boardRead"; +export * from "./boardUpdate"; +export * from "./confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost200"; +export * from "./confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost200"; +export * from "./deleteAgentApiV1AgentsAgentIdDelete200"; +export * from "./deleteBoardApiV1BoardsBoardIdDelete200"; +export * from "./deleteTaskApiV1BoardsBoardIdTasksTaskIdDelete200"; +export * from "./gatewayCommandsApiV1GatewayCommandsGet200"; +export * from "./gatewayStatusApiV1GatewayStatusGet200"; +export * from "./gatewayStatusApiV1GatewayStatusGetParams"; +export * from "./getGatewaySessionApiV1GatewaySessionsSessionIdGet200"; +export * from "./getGatewaySessionApiV1GatewaySessionsSessionIdGetParams"; +export * from "./getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet200"; +export * from "./getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams"; +export * from "./healthHealthGet200"; +export * from "./healthzHealthzGet200"; +export * from "./hTTPValidationError"; +export * from "./listActivityApiV1ActivityGetParams"; +export * from "./listSessionsApiV1GatewaySessionsGet200"; +export * from "./listSessionsApiV1GatewaySessionsGetParams"; +export * from "./listTasksApiV1BoardsBoardIdTasksGetParams"; +export * from "./readyzReadyzGet200"; +export * from "./sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost200"; +export * from "./sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody"; +export * from "./sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams"; +export * from "./taskCommentCreate"; +export * from "./taskCommentRead"; +export * from "./taskCreate"; +export * from "./taskRead"; +export * from "./taskUpdate"; +export * from "./userRead"; +export * from "./userUpdate"; +export * from "./validationError"; diff --git a/frontend/src/api/generated/model/listActivityApiV1ActivityGetParams.ts b/frontend/src/api/generated/model/listActivityApiV1ActivityGetParams.ts new file mode 100644 index 00000000..b389fe0b --- /dev/null +++ b/frontend/src/api/generated/model/listActivityApiV1ActivityGetParams.ts @@ -0,0 +1,18 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type ListActivityApiV1ActivityGetParams = { + /** + * @minimum 1 + * @maximum 200 + */ + limit?: number; + /** + * @minimum 0 + */ + offset?: number; +}; diff --git a/frontend/src/api/generated/model/listSessionsApiV1GatewaySessionsGet200.ts b/frontend/src/api/generated/model/listSessionsApiV1GatewaySessionsGet200.ts new file mode 100644 index 00000000..0405f61e --- /dev/null +++ b/frontend/src/api/generated/model/listSessionsApiV1GatewaySessionsGet200.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type ListSessionsApiV1GatewaySessionsGet200 = { [key: string]: unknown }; diff --git a/frontend/src/api/generated/model/listSessionsApiV1GatewaySessionsGetParams.ts b/frontend/src/api/generated/model/listSessionsApiV1GatewaySessionsGetParams.ts new file mode 100644 index 00000000..0437d272 --- /dev/null +++ b/frontend/src/api/generated/model/listSessionsApiV1GatewaySessionsGetParams.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type ListSessionsApiV1GatewaySessionsGetParams = { + board_id?: string | null; +}; diff --git a/frontend/src/api/generated/model/listTasksApiV1BoardsBoardIdTasksGetParams.ts b/frontend/src/api/generated/model/listTasksApiV1BoardsBoardIdTasksGetParams.ts new file mode 100644 index 00000000..b4952bbf --- /dev/null +++ b/frontend/src/api/generated/model/listTasksApiV1BoardsBoardIdTasksGetParams.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type ListTasksApiV1BoardsBoardIdTasksGetParams = { + status?: string | null; + assigned_agent_id?: string | null; + unassigned?: boolean | null; + limit?: number | null; +}; diff --git a/frontend/src/api/generated/model/readyzReadyzGet200.ts b/frontend/src/api/generated/model/readyzReadyzGet200.ts new file mode 100644 index 00000000..aabc7262 --- /dev/null +++ b/frontend/src/api/generated/model/readyzReadyzGet200.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type ReadyzReadyzGet200 = { [key: string]: boolean }; diff --git a/frontend/src/api/generated/model/sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost200.ts b/frontend/src/api/generated/model/sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost200.ts new file mode 100644 index 00000000..0ae12582 --- /dev/null +++ b/frontend/src/api/generated/model/sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost200.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type SendSessionMessageApiV1GatewaySessionsSessionIdMessagePost200 = { + [key: string]: boolean; +}; diff --git a/frontend/src/api/generated/model/sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody.ts b/frontend/src/api/generated/model/sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody.ts new file mode 100644 index 00000000..b2807848 --- /dev/null +++ b/frontend/src/api/generated/model/sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody = { + [key: string]: unknown; +}; diff --git a/frontend/src/api/generated/model/sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams.ts b/frontend/src/api/generated/model/sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams.ts new file mode 100644 index 00000000..6e6f3a7a --- /dev/null +++ b/frontend/src/api/generated/model/sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export type SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams = { + board_id?: string | null; +}; diff --git a/frontend/src/api/generated/model/taskCommentCreate.ts b/frontend/src/api/generated/model/taskCommentCreate.ts new file mode 100644 index 00000000..187ca019 --- /dev/null +++ b/frontend/src/api/generated/model/taskCommentCreate.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface TaskCommentCreate { + message: string; +} diff --git a/frontend/src/api/generated/model/taskCommentRead.ts b/frontend/src/api/generated/model/taskCommentRead.ts new file mode 100644 index 00000000..cc564640 --- /dev/null +++ b/frontend/src/api/generated/model/taskCommentRead.ts @@ -0,0 +1,14 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface TaskCommentRead { + id: string; + message: string | null; + agent_id: string | null; + task_id: string | null; + created_at: string; +} diff --git a/frontend/src/api/generated/model/taskCreate.ts b/frontend/src/api/generated/model/taskCreate.ts new file mode 100644 index 00000000..b52d6172 --- /dev/null +++ b/frontend/src/api/generated/model/taskCreate.ts @@ -0,0 +1,16 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface TaskCreate { + title: string; + description?: string | null; + status?: string; + priority?: string; + due_at?: string | null; + assigned_agent_id?: string | null; + created_by_user_id?: string | null; +} diff --git a/frontend/src/api/generated/model/taskRead.ts b/frontend/src/api/generated/model/taskRead.ts new file mode 100644 index 00000000..6cfc6ecd --- /dev/null +++ b/frontend/src/api/generated/model/taskRead.ts @@ -0,0 +1,21 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface TaskRead { + title: string; + description?: string | null; + status?: string; + priority?: string; + due_at?: string | null; + assigned_agent_id?: string | null; + id: string; + board_id: string | null; + created_by_user_id: string | null; + in_progress_at: string | null; + created_at: string; + updated_at: string; +} diff --git a/frontend/src/api/generated/model/taskUpdate.ts b/frontend/src/api/generated/model/taskUpdate.ts new file mode 100644 index 00000000..45715dfc --- /dev/null +++ b/frontend/src/api/generated/model/taskUpdate.ts @@ -0,0 +1,16 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface TaskUpdate { + title?: string | null; + description?: string | null; + status?: string | null; + priority?: string | null; + due_at?: string | null; + assigned_agent_id?: string | null; + comment?: string | null; +} diff --git a/frontend/src/api/generated/model/userRead.ts b/frontend/src/api/generated/model/userRead.ts new file mode 100644 index 00000000..3011c34e --- /dev/null +++ b/frontend/src/api/generated/model/userRead.ts @@ -0,0 +1,19 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface UserRead { + clerk_user_id: string; + email?: string | null; + name?: string | null; + preferred_name?: string | null; + pronouns?: string | null; + timezone?: string | null; + notes?: string | null; + context?: string | null; + id: string; + is_super_admin: boolean; +} diff --git a/frontend/src/api/generated/model/userUpdate.ts b/frontend/src/api/generated/model/userUpdate.ts new file mode 100644 index 00000000..dbb1978d --- /dev/null +++ b/frontend/src/api/generated/model/userUpdate.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface UserUpdate { + name?: string | null; + preferred_name?: string | null; + pronouns?: string | null; + timezone?: string | null; + notes?: string | null; + context?: string | null; +} diff --git a/frontend/src/api/generated/model/validationError.ts b/frontend/src/api/generated/model/validationError.ts new file mode 100644 index 00000000..14d2b708 --- /dev/null +++ b/frontend/src/api/generated/model/validationError.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ + +export interface ValidationError { + loc: (string | number)[]; + msg: string; + type: string; +} diff --git a/frontend/src/api/generated/tasks/tasks.ts b/frontend/src/api/generated/tasks/tasks.ts new file mode 100644 index 00000000..5de0e1ee --- /dev/null +++ b/frontend/src/api/generated/tasks/tasks.ts @@ -0,0 +1,1091 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ +import { useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + DeleteTaskApiV1BoardsBoardIdTasksTaskIdDelete200, + HTTPValidationError, + ListTasksApiV1BoardsBoardIdTasksGetParams, + TaskCommentCreate, + TaskCommentRead, + TaskCreate, + TaskRead, + TaskUpdate, +} from ".././model"; + +import { customFetch } from "../../mutator"; + +type SecondParameter unknown> = Parameters[1]; + +/** + * @summary List Tasks + */ +export type listTasksApiV1BoardsBoardIdTasksGetResponse200 = { + data: TaskRead[]; + status: 200; +}; + +export type listTasksApiV1BoardsBoardIdTasksGetResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type listTasksApiV1BoardsBoardIdTasksGetResponseSuccess = + listTasksApiV1BoardsBoardIdTasksGetResponse200 & { + headers: Headers; + }; +export type listTasksApiV1BoardsBoardIdTasksGetResponseError = + listTasksApiV1BoardsBoardIdTasksGetResponse422 & { + headers: Headers; + }; + +export type listTasksApiV1BoardsBoardIdTasksGetResponse = + | listTasksApiV1BoardsBoardIdTasksGetResponseSuccess + | listTasksApiV1BoardsBoardIdTasksGetResponseError; + +export const getListTasksApiV1BoardsBoardIdTasksGetUrl = ( + boardId: string, + params?: ListTasksApiV1BoardsBoardIdTasksGetParams, +) => { + const normalizedParams = new URLSearchParams(); + + Object.entries(params || {}).forEach(([key, value]) => { + if (value !== undefined) { + normalizedParams.append(key, value === null ? "null" : value.toString()); + } + }); + + const stringifiedParams = normalizedParams.toString(); + + return stringifiedParams.length > 0 + ? `/api/v1/boards/${boardId}/tasks?${stringifiedParams}` + : `/api/v1/boards/${boardId}/tasks`; +}; + +export const listTasksApiV1BoardsBoardIdTasksGet = async ( + boardId: string, + params?: ListTasksApiV1BoardsBoardIdTasksGetParams, + options?: RequestInit, +): Promise => { + return customFetch( + getListTasksApiV1BoardsBoardIdTasksGetUrl(boardId, params), + { + ...options, + method: "GET", + }, + ); +}; + +export const getListTasksApiV1BoardsBoardIdTasksGetQueryKey = ( + boardId: string, + params?: ListTasksApiV1BoardsBoardIdTasksGetParams, +) => { + return [ + `/api/v1/boards/${boardId}/tasks`, + ...(params ? [params] : []), + ] as const; +}; + +export const getListTasksApiV1BoardsBoardIdTasksGetQueryOptions = < + TData = Awaited>, + TError = HTTPValidationError, +>( + boardId: string, + params?: ListTasksApiV1BoardsBoardIdTasksGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getListTasksApiV1BoardsBoardIdTasksGetQueryKey(boardId, params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + listTasksApiV1BoardsBoardIdTasksGet(boardId, params, { + signal, + ...requestOptions, + }); + + return { + queryKey, + queryFn, + enabled: !!boardId, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ListTasksApiV1BoardsBoardIdTasksGetQueryResult = NonNullable< + Awaited> +>; +export type ListTasksApiV1BoardsBoardIdTasksGetQueryError = HTTPValidationError; + +export function useListTasksApiV1BoardsBoardIdTasksGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + boardId: string, + params: undefined | ListTasksApiV1BoardsBoardIdTasksGetParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useListTasksApiV1BoardsBoardIdTasksGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + boardId: string, + params?: ListTasksApiV1BoardsBoardIdTasksGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useListTasksApiV1BoardsBoardIdTasksGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + boardId: string, + params?: ListTasksApiV1BoardsBoardIdTasksGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Tasks + */ + +export function useListTasksApiV1BoardsBoardIdTasksGet< + TData = Awaited>, + TError = HTTPValidationError, +>( + boardId: string, + params?: ListTasksApiV1BoardsBoardIdTasksGetParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getListTasksApiV1BoardsBoardIdTasksGetQueryOptions( + boardId, + params, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + +/** + * @summary Create Task + */ +export type createTaskApiV1BoardsBoardIdTasksPostResponse200 = { + data: TaskRead; + status: 200; +}; + +export type createTaskApiV1BoardsBoardIdTasksPostResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type createTaskApiV1BoardsBoardIdTasksPostResponseSuccess = + createTaskApiV1BoardsBoardIdTasksPostResponse200 & { + headers: Headers; + }; +export type createTaskApiV1BoardsBoardIdTasksPostResponseError = + createTaskApiV1BoardsBoardIdTasksPostResponse422 & { + headers: Headers; + }; + +export type createTaskApiV1BoardsBoardIdTasksPostResponse = + | createTaskApiV1BoardsBoardIdTasksPostResponseSuccess + | createTaskApiV1BoardsBoardIdTasksPostResponseError; + +export const getCreateTaskApiV1BoardsBoardIdTasksPostUrl = ( + boardId: string, +) => { + return `/api/v1/boards/${boardId}/tasks`; +}; + +export const createTaskApiV1BoardsBoardIdTasksPost = async ( + boardId: string, + taskCreate: TaskCreate, + options?: RequestInit, +): Promise => { + return customFetch( + getCreateTaskApiV1BoardsBoardIdTasksPostUrl(boardId), + { + ...options, + method: "POST", + headers: { "Content-Type": "application/json", ...options?.headers }, + body: JSON.stringify(taskCreate), + }, + ); +}; + +export const getCreateTaskApiV1BoardsBoardIdTasksPostMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { boardId: string; data: TaskCreate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { boardId: string; data: TaskCreate }, + TContext +> => { + const mutationKey = ["createTaskApiV1BoardsBoardIdTasksPost"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { boardId: string; data: TaskCreate } + > = (props) => { + const { boardId, data } = props ?? {}; + + return createTaskApiV1BoardsBoardIdTasksPost(boardId, data, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type CreateTaskApiV1BoardsBoardIdTasksPostMutationResult = NonNullable< + Awaited> +>; +export type CreateTaskApiV1BoardsBoardIdTasksPostMutationBody = TaskCreate; +export type CreateTaskApiV1BoardsBoardIdTasksPostMutationError = + HTTPValidationError; + +/** + * @summary Create Task + */ +export const useCreateTaskApiV1BoardsBoardIdTasksPost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { boardId: string; data: TaskCreate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { boardId: string; data: TaskCreate }, + TContext +> => { + return useMutation( + getCreateTaskApiV1BoardsBoardIdTasksPostMutationOptions(options), + queryClient, + ); +}; +/** + * @summary Update Task + */ +export type updateTaskApiV1BoardsBoardIdTasksTaskIdPatchResponse200 = { + data: TaskRead; + status: 200; +}; + +export type updateTaskApiV1BoardsBoardIdTasksTaskIdPatchResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type updateTaskApiV1BoardsBoardIdTasksTaskIdPatchResponseSuccess = + updateTaskApiV1BoardsBoardIdTasksTaskIdPatchResponse200 & { + headers: Headers; + }; +export type updateTaskApiV1BoardsBoardIdTasksTaskIdPatchResponseError = + updateTaskApiV1BoardsBoardIdTasksTaskIdPatchResponse422 & { + headers: Headers; + }; + +export type updateTaskApiV1BoardsBoardIdTasksTaskIdPatchResponse = + | updateTaskApiV1BoardsBoardIdTasksTaskIdPatchResponseSuccess + | updateTaskApiV1BoardsBoardIdTasksTaskIdPatchResponseError; + +export const getUpdateTaskApiV1BoardsBoardIdTasksTaskIdPatchUrl = ( + boardId: string, + taskId: string, +) => { + return `/api/v1/boards/${boardId}/tasks/${taskId}`; +}; + +export const updateTaskApiV1BoardsBoardIdTasksTaskIdPatch = async ( + boardId: string, + taskId: string, + taskUpdate: TaskUpdate, + options?: RequestInit, +): Promise => { + return customFetch( + getUpdateTaskApiV1BoardsBoardIdTasksTaskIdPatchUrl(boardId, taskId), + { + ...options, + method: "PATCH", + headers: { "Content-Type": "application/json", ...options?.headers }, + body: JSON.stringify(taskUpdate), + }, + ); +}; + +export const getUpdateTaskApiV1BoardsBoardIdTasksTaskIdPatchMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { boardId: string; taskId: string; data: TaskUpdate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { boardId: string; taskId: string; data: TaskUpdate }, + TContext +> => { + const mutationKey = ["updateTaskApiV1BoardsBoardIdTasksTaskIdPatch"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { boardId: string; taskId: string; data: TaskUpdate } + > = (props) => { + const { boardId, taskId, data } = props ?? {}; + + return updateTaskApiV1BoardsBoardIdTasksTaskIdPatch( + boardId, + taskId, + data, + requestOptions, + ); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type UpdateTaskApiV1BoardsBoardIdTasksTaskIdPatchMutationResult = + NonNullable< + Awaited> + >; +export type UpdateTaskApiV1BoardsBoardIdTasksTaskIdPatchMutationBody = + TaskUpdate; +export type UpdateTaskApiV1BoardsBoardIdTasksTaskIdPatchMutationError = + HTTPValidationError; + +/** + * @summary Update Task + */ +export const useUpdateTaskApiV1BoardsBoardIdTasksTaskIdPatch = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { boardId: string; taskId: string; data: TaskUpdate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { boardId: string; taskId: string; data: TaskUpdate }, + TContext +> => { + return useMutation( + getUpdateTaskApiV1BoardsBoardIdTasksTaskIdPatchMutationOptions(options), + queryClient, + ); +}; +/** + * @summary Delete Task + */ +export type deleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteResponse200 = { + data: DeleteTaskApiV1BoardsBoardIdTasksTaskIdDelete200; + status: 200; +}; + +export type deleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type deleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteResponseSuccess = + deleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteResponse200 & { + headers: Headers; + }; +export type deleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteResponseError = + deleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteResponse422 & { + headers: Headers; + }; + +export type deleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteResponse = + | deleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteResponseSuccess + | deleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteResponseError; + +export const getDeleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteUrl = ( + boardId: string, + taskId: string, +) => { + return `/api/v1/boards/${boardId}/tasks/${taskId}`; +}; + +export const deleteTaskApiV1BoardsBoardIdTasksTaskIdDelete = async ( + boardId: string, + taskId: string, + options?: RequestInit, +): Promise => { + return customFetch( + getDeleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteUrl(boardId, taskId), + { + ...options, + method: "DELETE", + }, + ); +}; + +export const getDeleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { boardId: string; taskId: string }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { boardId: string; taskId: string }, + TContext +> => { + const mutationKey = ["deleteTaskApiV1BoardsBoardIdTasksTaskIdDelete"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { boardId: string; taskId: string } + > = (props) => { + const { boardId, taskId } = props ?? {}; + + return deleteTaskApiV1BoardsBoardIdTasksTaskIdDelete( + boardId, + taskId, + requestOptions, + ); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type DeleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteMutationResult = + NonNullable< + Awaited> + >; + +export type DeleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteMutationError = + HTTPValidationError; + +/** + * @summary Delete Task + */ +export const useDeleteTaskApiV1BoardsBoardIdTasksTaskIdDelete = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { boardId: string; taskId: string }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { boardId: string; taskId: string }, + TContext +> => { + return useMutation( + getDeleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteMutationOptions(options), + queryClient, + ); +}; +/** + * @summary List Task Comments + */ +export type listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetResponse200 = + { + data: TaskCommentRead[]; + status: 200; + }; + +export type listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetResponse422 = + { + data: HTTPValidationError; + status: 422; + }; + +export type listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetResponseSuccess = + listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetResponse200 & { + headers: Headers; + }; +export type listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetResponseError = + listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetResponse422 & { + headers: Headers; + }; + +export type listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetResponse = + | listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetResponseSuccess + | listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetResponseError; + +export const getListTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetUrl = ( + boardId: string, + taskId: string, +) => { + return `/api/v1/boards/${boardId}/tasks/${taskId}/comments`; +}; + +export const listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet = async ( + boardId: string, + taskId: string, + options?: RequestInit, +): Promise => { + return customFetch( + getListTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetUrl( + boardId, + taskId, + ), + { + ...options, + method: "GET", + }, + ); +}; + +export const getListTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetQueryKey = + (boardId: string, taskId: string) => { + return [`/api/v1/boards/${boardId}/tasks/${taskId}/comments`] as const; + }; + +export const getListTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetQueryOptions = + < + TData = Awaited< + ReturnType< + typeof listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet + > + >, + TError = HTTPValidationError, + >( + boardId: string, + taskId: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType< + typeof listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet + > + >, + TError, + TData + > + >; + request?: SecondParameter; + }, + ) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getListTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetQueryKey( + boardId, + taskId, + ); + + const queryFn: QueryFunction< + Awaited< + ReturnType< + typeof listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet + > + > + > = ({ signal }) => + listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet( + boardId, + taskId, + { signal, ...requestOptions }, + ); + + return { + queryKey, + queryFn, + enabled: !!(boardId && taskId), + ...queryOptions, + } as UseQueryOptions< + Awaited< + ReturnType< + typeof listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet + > + >, + TError, + TData + > & { queryKey: DataTag }; + }; + +export type ListTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetQueryResult = + NonNullable< + Awaited< + ReturnType< + typeof listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet + > + > + >; +export type ListTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetQueryError = + HTTPValidationError; + +export function useListTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet< + TData = Awaited< + ReturnType + >, + TError = HTTPValidationError, +>( + boardId: string, + taskId: string, + options: { + query: Partial< + UseQueryOptions< + Awaited< + ReturnType< + typeof listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet + > + >, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited< + ReturnType< + typeof listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet + > + >, + TError, + Awaited< + ReturnType< + typeof listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet + > + > + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useListTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet< + TData = Awaited< + ReturnType + >, + TError = HTTPValidationError, +>( + boardId: string, + taskId: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType< + typeof listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet + > + >, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited< + ReturnType< + typeof listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet + > + >, + TError, + Awaited< + ReturnType< + typeof listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet + > + > + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useListTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet< + TData = Awaited< + ReturnType + >, + TError = HTTPValidationError, +>( + boardId: string, + taskId: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType< + typeof listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet + > + >, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Task Comments + */ + +export function useListTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet< + TData = Awaited< + ReturnType + >, + TError = HTTPValidationError, +>( + boardId: string, + taskId: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType< + typeof listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet + > + >, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getListTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGetQueryOptions( + boardId, + taskId, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + +/** + * @summary Create Task Comment + */ +export type createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostResponse200 = + { + data: TaskCommentRead; + status: 200; + }; + +export type createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostResponse422 = + { + data: HTTPValidationError; + status: 422; + }; + +export type createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostResponseSuccess = + createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostResponse200 & { + headers: Headers; + }; +export type createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostResponseError = + createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostResponse422 & { + headers: Headers; + }; + +export type createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostResponse = + | createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostResponseSuccess + | createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostResponseError; + +export const getCreateTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostUrl = + (boardId: string, taskId: string) => { + return `/api/v1/boards/${boardId}/tasks/${taskId}/comments`; + }; + +export const createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPost = + async ( + boardId: string, + taskId: string, + taskCommentCreate: TaskCommentCreate, + options?: RequestInit, + ): Promise => { + return customFetch( + getCreateTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostUrl( + boardId, + taskId, + ), + { + ...options, + method: "POST", + headers: { "Content-Type": "application/json", ...options?.headers }, + body: JSON.stringify(taskCommentCreate), + }, + ); + }; + +export const getCreateTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostMutationOptions = + (options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType< + typeof createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPost + > + >, + TError, + { boardId: string; taskId: string; data: TaskCommentCreate }, + TContext + >; + request?: SecondParameter; + }): UseMutationOptions< + Awaited< + ReturnType< + typeof createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPost + > + >, + TError, + { boardId: string; taskId: string; data: TaskCommentCreate }, + TContext + > => { + const mutationKey = [ + "createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPost", + ]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited< + ReturnType< + typeof createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPost + > + >, + { boardId: string; taskId: string; data: TaskCommentCreate } + > = (props) => { + const { boardId, taskId, data } = props ?? {}; + + return createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPost( + boardId, + taskId, + data, + requestOptions, + ); + }; + + return { mutationFn, ...mutationOptions }; + }; + +export type CreateTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostMutationResult = + NonNullable< + Awaited< + ReturnType< + typeof createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPost + > + > + >; +export type CreateTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostMutationBody = + TaskCommentCreate; +export type CreateTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostMutationError = + HTTPValidationError; + +/** + * @summary Create Task Comment + */ +export const useCreateTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPost = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType< + typeof createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPost + > + >, + TError, + { boardId: string; taskId: string; data: TaskCommentCreate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited< + ReturnType< + typeof createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPost + > + >, + TError, + { boardId: string; taskId: string; data: TaskCommentCreate }, + TContext +> => { + return useMutation( + getCreateTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPostMutationOptions( + options, + ), + queryClient, + ); +}; diff --git a/frontend/src/api/generated/users/users.ts b/frontend/src/api/generated/users/users.ts new file mode 100644 index 00000000..abf3af8a --- /dev/null +++ b/frontend/src/api/generated/users/users.ts @@ -0,0 +1,314 @@ +/** + * Generated by orval v8.2.0 🍺 + * Do not edit manually. + * Mission Control API + * OpenAPI spec version: 0.1.0 + */ +import { useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { HTTPValidationError, UserRead, UserUpdate } from ".././model"; + +import { customFetch } from "../../mutator"; + +type SecondParameter unknown> = Parameters[1]; + +/** + * @summary Get Me + */ +export type getMeApiV1UsersMeGetResponse200 = { + data: UserRead; + status: 200; +}; + +export type getMeApiV1UsersMeGetResponseSuccess = + getMeApiV1UsersMeGetResponse200 & { + headers: Headers; + }; +export type getMeApiV1UsersMeGetResponse = getMeApiV1UsersMeGetResponseSuccess; + +export const getGetMeApiV1UsersMeGetUrl = () => { + return `/api/v1/users/me`; +}; + +export const getMeApiV1UsersMeGet = async ( + options?: RequestInit, +): Promise => { + return customFetch( + getGetMeApiV1UsersMeGetUrl(), + { + ...options, + method: "GET", + }, + ); +}; + +export const getGetMeApiV1UsersMeGetQueryKey = () => { + return [`/api/v1/users/me`] as const; +}; + +export const getGetMeApiV1UsersMeGetQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; +}) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetMeApiV1UsersMeGetQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => getMeApiV1UsersMeGet({ signal, ...requestOptions }); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type GetMeApiV1UsersMeGetQueryResult = NonNullable< + Awaited> +>; +export type GetMeApiV1UsersMeGetQueryError = unknown; + +export function useGetMeApiV1UsersMeGet< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useGetMeApiV1UsersMeGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useGetMeApiV1UsersMeGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get Me + */ + +export function useGetMeApiV1UsersMeGet< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getGetMeApiV1UsersMeGetQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + +/** + * @summary Update Me + */ +export type updateMeApiV1UsersMePatchResponse200 = { + data: UserRead; + status: 200; +}; + +export type updateMeApiV1UsersMePatchResponse422 = { + data: HTTPValidationError; + status: 422; +}; + +export type updateMeApiV1UsersMePatchResponseSuccess = + updateMeApiV1UsersMePatchResponse200 & { + headers: Headers; + }; +export type updateMeApiV1UsersMePatchResponseError = + updateMeApiV1UsersMePatchResponse422 & { + headers: Headers; + }; + +export type updateMeApiV1UsersMePatchResponse = + | updateMeApiV1UsersMePatchResponseSuccess + | updateMeApiV1UsersMePatchResponseError; + +export const getUpdateMeApiV1UsersMePatchUrl = () => { + return `/api/v1/users/me`; +}; + +export const updateMeApiV1UsersMePatch = async ( + userUpdate: UserUpdate, + options?: RequestInit, +): Promise => { + return customFetch( + getUpdateMeApiV1UsersMePatchUrl(), + { + ...options, + method: "PATCH", + headers: { "Content-Type": "application/json", ...options?.headers }, + body: JSON.stringify(userUpdate), + }, + ); +}; + +export const getUpdateMeApiV1UsersMePatchMutationOptions = < + TError = HTTPValidationError, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: UserUpdate }, + TContext + >; + request?: SecondParameter; +}): UseMutationOptions< + Awaited>, + TError, + { data: UserUpdate }, + TContext +> => { + const mutationKey = ["updateMeApiV1UsersMePatch"]; + const { mutation: mutationOptions, request: requestOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey }, request: undefined }; + + const mutationFn: MutationFunction< + Awaited>, + { data: UserUpdate } + > = (props) => { + const { data } = props ?? {}; + + return updateMeApiV1UsersMePatch(data, requestOptions); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type UpdateMeApiV1UsersMePatchMutationResult = NonNullable< + Awaited> +>; +export type UpdateMeApiV1UsersMePatchMutationBody = UserUpdate; +export type UpdateMeApiV1UsersMePatchMutationError = HTTPValidationError; + +/** + * @summary Update Me + */ +export const useUpdateMeApiV1UsersMePatch = < + TError = HTTPValidationError, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: UserUpdate }, + TContext + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: UserUpdate }, + TContext +> => { + return useMutation( + getUpdateMeApiV1UsersMePatchMutationOptions(options), + queryClient, + ); +}; diff --git a/frontend/src/api/mutator.ts b/frontend/src/api/mutator.ts index 70648a93..581c51ee 100644 --- a/frontend/src/api/mutator.ts +++ b/frontend/src/api/mutator.ts @@ -2,7 +2,11 @@ export const customFetch = async ( url: string, options: RequestInit ): Promise => { - const baseUrl = process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8000"; + const rawBaseUrl = process.env.NEXT_PUBLIC_API_URL; + if (!rawBaseUrl) { + throw new Error("NEXT_PUBLIC_API_URL is not set."); + } + const baseUrl = rawBaseUrl.replace(/\/+$/, ""); const response = await fetch(`${baseUrl}${url}`, { ...options, headers: { diff --git a/frontend/src/app/agents/[agentId]/edit/page.tsx b/frontend/src/app/agents/[agentId]/edit/page.tsx index c47ae985..81e18bd3 100644 --- a/frontend/src/app/agents/[agentId]/edit/page.tsx +++ b/frontend/src/app/agents/[agentId]/edit/page.tsx @@ -9,6 +9,7 @@ import { DashboardSidebar } from "@/components/organisms/DashboardSidebar"; import { DashboardShell } from "@/components/templates/DashboardShell"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; +import { getApiBaseUrl } from "@/lib/api-base"; import { Select, SelectContent, @@ -17,9 +18,7 @@ import { SelectValue, } from "@/components/ui/select"; -const apiBase = - process.env.NEXT_PUBLIC_API_URL?.replace(/\/+$/, "") || - "http://localhost:8000"; +const apiBase = getApiBaseUrl(); type Agent = { id: string; diff --git a/frontend/src/app/agents/[agentId]/page.tsx b/frontend/src/app/agents/[agentId]/page.tsx index 8eb52f75..7334518f 100644 --- a/frontend/src/app/agents/[agentId]/page.tsx +++ b/frontend/src/app/agents/[agentId]/page.tsx @@ -18,10 +18,9 @@ import { DialogHeader, DialogTitle, } from "@/components/ui/dialog"; +import { getApiBaseUrl } from "@/lib/api-base"; -const apiBase = - process.env.NEXT_PUBLIC_API_URL?.replace(/\/+$/, "") || - "http://localhost:8000"; +const apiBase = getApiBaseUrl(); type Agent = { id: string; diff --git a/frontend/src/app/agents/new/page.tsx b/frontend/src/app/agents/new/page.tsx index fb0c7952..00bf1679 100644 --- a/frontend/src/app/agents/new/page.tsx +++ b/frontend/src/app/agents/new/page.tsx @@ -9,6 +9,7 @@ import { DashboardSidebar } from "@/components/organisms/DashboardSidebar"; import { DashboardShell } from "@/components/templates/DashboardShell"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; +import { getApiBaseUrl } from "@/lib/api-base"; import { Select, SelectContent, @@ -17,9 +18,7 @@ import { SelectValue, } from "@/components/ui/select"; -const apiBase = - process.env.NEXT_PUBLIC_API_URL?.replace(/\/+$/, "") || - "http://localhost:8000"; +const apiBase = getApiBaseUrl(); type Agent = { id: string; diff --git a/frontend/src/app/agents/page.tsx b/frontend/src/app/agents/page.tsx index 70f8f6e1..21249f9c 100644 --- a/frontend/src/app/agents/page.tsx +++ b/frontend/src/app/agents/page.tsx @@ -33,10 +33,9 @@ import { SelectTrigger, SelectValue, } from "@/components/ui/select"; +import { getApiBaseUrl } from "@/lib/api-base"; -const apiBase = - process.env.NEXT_PUBLIC_API_URL?.replace(/\/+$/, "") || - "http://localhost:8000"; +const apiBase = getApiBaseUrl(); type Agent = { id: string; diff --git a/frontend/src/app/boards/[boardId]/edit/page.tsx b/frontend/src/app/boards/[boardId]/edit/page.tsx index df763e41..6196aa4c 100644 --- a/frontend/src/app/boards/[boardId]/edit/page.tsx +++ b/frontend/src/app/boards/[boardId]/edit/page.tsx @@ -9,10 +9,10 @@ import { DashboardSidebar } from "@/components/organisms/DashboardSidebar"; import { DashboardShell } from "@/components/templates/DashboardShell"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; +import { Textarea } from "@/components/ui/textarea"; +import { getApiBaseUrl } from "@/lib/api-base"; -const apiBase = - process.env.NEXT_PUBLIC_API_URL?.replace(/\/+$/, "") || - "http://localhost:8000"; +const apiBase = getApiBaseUrl(); type Board = { id: string; @@ -21,6 +21,8 @@ type Board = { gateway_url?: string | null; gateway_main_session_key?: string | null; gateway_workspace_root?: string | null; + identity_template?: string | null; + soul_template?: string | null; }; const slugify = (value: string) => @@ -44,6 +46,8 @@ export default function EditBoardPage() { const [gatewayToken, setGatewayToken] = useState(""); const [gatewayMainSessionKey, setGatewayMainSessionKey] = useState(""); const [gatewayWorkspaceRoot, setGatewayWorkspaceRoot] = useState(""); + const [identityTemplate, setIdentityTemplate] = useState(""); + const [soulTemplate, setSoulTemplate] = useState(""); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(null); @@ -66,6 +70,8 @@ export default function EditBoardPage() { setGatewayUrl(data.gateway_url ?? ""); setGatewayMainSessionKey(data.gateway_main_session_key ?? ""); setGatewayWorkspaceRoot(data.gateway_workspace_root ?? ""); + setIdentityTemplate(data.identity_template ?? ""); + setSoulTemplate(data.soul_template ?? ""); } catch (err) { setError(err instanceof Error ? err.message : "Something went wrong."); } finally { @@ -96,6 +102,8 @@ export default function EditBoardPage() { gateway_url: gatewayUrl.trim() || null, gateway_main_session_key: gatewayMainSessionKey.trim() || null, gateway_workspace_root: gatewayWorkspaceRoot.trim() || null, + identity_template: identityTemplate.trim() || null, + soul_template: soulTemplate.trim() || null, }; if (gatewayToken.trim()) { payload.gateway_token = gatewayToken.trim(); @@ -210,6 +218,28 @@ export default function EditBoardPage() { disabled={isLoading} /> +
+ +