Lines 31-71javascript
31 const config = CitioConfigSchema.parse(rawConfig);
32 const workspacePath = process.env.CITIO_WORKSPACE || "/workspace";
33 console.log(JSON.stringify({
36 provider: config.engine.default_provider,
37 channel: config.slack.channel_id,
38 workspace: workspacePath,
39 repos: config.workspace.repos.length,
40 skills: config.skills.installed.length,
42 // Refresh Codex tokens on startup (id_token expires every hour)
43 if (config.engine.default_provider === "codex") {
44 const fs = await import("fs");
45 const home = process.env.HOME || "/home/citio";
46 const authPath = getCodexAuthPath(home);
47 console.log(JSON.stringify({
48 type: "codex_auth_check",
51 hasAuthFile: fs.existsSync(authPath),
52 hasApiKey: Boolean(process.env.OPENAI_API_KEY),
54 if (!hasCodexCredentials()) {
55 console.log(JSON.stringify({
56 type: "codex_auth_missing",
57 message: formatCodexAuthHint(home),
61 const authData = JSON.parse(fs.readFileSync(authPath, "utf-8"));
62 const refreshToken = authData?.tokens?.refresh_token;
64 console.log(JSON.stringify({ type: "token_refresh", status: "refreshing" }));
65 const { execSync: ex } = await import("child_process");
66 const resp = ex(`curl -s -X POST "https://auth.openai.com/oauth/token" -H "Content-Type: application/json" -d '{"grant_type":"refresh_token","refresh_token":"${refreshToken}","client_id":"app_EMoamEEZ73f0CkXaXp7hrann"}'`, { encoding: "utf-8", timeout: 15000 });
67 const fresh = JSON.parse(resp);
HighSame File Env Network Execution
A single source file combines environment access, network access, and code or shell execution; review context before blocking.
dist/index.jsView on unpkg · L51 68 if (fresh.id_token && fresh.access_token) {
69 authData.tokens.id_token = fresh.id_token;
70 authData.tokens.access_token = fresh.access_token;
71 if (fresh.refresh_token)