feat: add Ops Codex terminal setup UI
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
FROM python:3.12.10-alpine
|
||||
LABEL nodedc.deploy.cache_bust="codex-agent-setup-20260624"
|
||||
|
||||
# set environment variables
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
@@ -44,6 +45,7 @@ COPY manage.py manage.py
|
||||
COPY plane plane/
|
||||
COPY templates templates/
|
||||
COPY package.json package.json
|
||||
RUN grep -R "setup-codes" /code/plane/app/urls/codex_agents.py >/dev/null
|
||||
|
||||
COPY ./bin ./bin/
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ from plane.app.views import (
|
||||
CodexAgentListEndpoint,
|
||||
CodexAgentProjectAccessEndpoint,
|
||||
CodexAgentRevokeEndpoint,
|
||||
CodexAgentSetupCodeEndpoint,
|
||||
CodexAgentSetupEndpoint,
|
||||
CodexAgentTokenListEndpoint,
|
||||
CodexAgentTokenRevokeEndpoint,
|
||||
@@ -69,4 +70,9 @@ urlpatterns = [
|
||||
CodexAgentSetupEndpoint.as_view(),
|
||||
name="codex-agent-api-agent-setup",
|
||||
),
|
||||
path(
|
||||
"workspaces/<str:slug>/codex-agent-api/agents/<uuid:agent_id>/setup-codes/",
|
||||
CodexAgentSetupCodeEndpoint.as_view(),
|
||||
name="codex-agent-api-agent-setup-codes",
|
||||
),
|
||||
]
|
||||
|
||||
@@ -196,6 +196,7 @@ from .codex_agents import (
|
||||
CodexAgentListEndpoint,
|
||||
CodexAgentProjectAccessEndpoint,
|
||||
CodexAgentRevokeEndpoint,
|
||||
CodexAgentSetupCodeEndpoint,
|
||||
CodexAgentSetupEndpoint,
|
||||
CodexAgentTokenListEndpoint,
|
||||
CodexAgentTokenRevokeEndpoint,
|
||||
|
||||
@@ -563,3 +563,21 @@ class CodexAgentSetupEndpoint(CodexAgentEntitledEndpoint):
|
||||
return entitlement_error
|
||||
|
||||
return gateway_request("GET", f"/api/internal/v1/owners/{owner_path(request.user)}/agents/{agent_path(agent_id)}/setup")
|
||||
|
||||
|
||||
class CodexAgentSetupCodeEndpoint(CodexAgentEntitledEndpoint):
|
||||
@allow_permission(allowed_roles=[ROLE.ADMIN, ROLE.MEMBER], level="WORKSPACE")
|
||||
def post(self, request, slug, agent_id):
|
||||
entitlement_error = self.require_entitlement(request, slug)
|
||||
if entitlement_error is not None:
|
||||
return entitlement_error
|
||||
|
||||
payload = {
|
||||
"expires_in_seconds": request.data.get("expires_in_seconds") or 600,
|
||||
"token_name": request.data.get("token_name") or "Local Codex token",
|
||||
}
|
||||
return gateway_request(
|
||||
"POST",
|
||||
f"/api/internal/v1/owners/{owner_path(request.user)}/agents/{agent_path(agent_id)}/setup-codes",
|
||||
payload,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user