feat: add Ops Codex terminal setup UI
This commit is contained in:
@@ -10,6 +10,7 @@ import { APIService } from "@/services/api.service";
|
||||
export type TCodexAgentStatus = "active" | "disabled" | "revoked";
|
||||
export type TCodexAgentGrantMode = "voluntary" | "reporting";
|
||||
export type TCodexAgentTokenStatus = "active" | "revoked" | "expired";
|
||||
export type TCodexAgentSetupCodeStatus = "active" | "used" | "expired" | "revoked";
|
||||
|
||||
export type TCodexAgent = {
|
||||
id: string;
|
||||
@@ -45,6 +46,19 @@ export type TCodexAgentToken = {
|
||||
created_at: string;
|
||||
};
|
||||
|
||||
export type TCodexAgentSetupCode = {
|
||||
id: string;
|
||||
agent_id: string;
|
||||
code_suffix: string | null;
|
||||
status: TCodexAgentSetupCodeStatus;
|
||||
token_name: string;
|
||||
created_by_user_id: string | null;
|
||||
expires_at: string;
|
||||
used_at: string | null;
|
||||
used_token_id: string | null;
|
||||
created_at: string;
|
||||
};
|
||||
|
||||
export type TCodexAgentSetupPacket = {
|
||||
agents_md?: string;
|
||||
codex_config_template?: Record<string, unknown>;
|
||||
@@ -67,6 +81,25 @@ export type TCodexAgentCreateTokenResponse = {
|
||||
token_record: TCodexAgentToken;
|
||||
};
|
||||
|
||||
export type TCodexAgentCreateSetupCodeResponse = {
|
||||
ok: boolean;
|
||||
install: {
|
||||
command: string;
|
||||
fallback_command?: string;
|
||||
installer_kind?: "npm_registry" | "npm_tarball" | "python_script";
|
||||
installer_url: string;
|
||||
legacy_python_installer_url?: string;
|
||||
mcp_server_name: string;
|
||||
npm_spec?: string;
|
||||
package_url?: string;
|
||||
platform: "macos_linux";
|
||||
registry_command?: string;
|
||||
skill_name: string;
|
||||
};
|
||||
setup_code: string;
|
||||
setup_code_record: TCodexAgentSetupCode;
|
||||
};
|
||||
|
||||
export type TCodexAgentTokenListResponse = {
|
||||
ok: boolean;
|
||||
tokens: TCodexAgentToken[];
|
||||
@@ -222,6 +255,18 @@ export class WorkspaceCodexAgentService extends APIService {
|
||||
});
|
||||
}
|
||||
|
||||
async createSetupCode(
|
||||
workspaceSlug: string,
|
||||
agentId: string,
|
||||
data: { expires_in_seconds?: number; token_name?: string }
|
||||
): Promise<TCodexAgentCreateSetupCodeResponse> {
|
||||
return this.post(`/api/workspaces/${workspaceSlug}/codex-agent-api/agents/${agentId}/setup-codes/`, data)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async listTokens(workspaceSlug: string, agentId: string): Promise<TCodexAgentTokenListResponse> {
|
||||
return this.get(`/api/workspaces/${workspaceSlug}/codex-agent-api/agents/${agentId}/tokens/`)
|
||||
.then((response) => response?.data)
|
||||
|
||||
Reference in New Issue
Block a user