feat: 扩展 Sub2API 成本与余额运维
This commit is contained in:
@@ -22,6 +22,7 @@ import { parseEnvFile, readTextFile, redactRepoPath, requiredEnvValue } from "..
|
||||
import { runSshCommandCapture, type SshCaptureResult } from "../ssh";
|
||||
|
||||
import type { CodexPoolConfig, CodexPoolRuntimeTarget, TraceOptions } from "./types";
|
||||
import { readCodexPoolConfig } from "./config";
|
||||
import { shQuote } from "./remote";
|
||||
import { remotePythonScript } from "./remote-python-sync";
|
||||
import { sentinelImageDockerfilePath } from "./types";
|
||||
@@ -56,6 +57,12 @@ export function profitScript(payload: unknown, pool: CodexPoolConfig, target: Co
|
||||
return remotePythonScript("profit", encoded, pool, target);
|
||||
}
|
||||
|
||||
export function creditsScript(payload: unknown, target: CodexPoolRuntimeTarget): string {
|
||||
const pool = readCodexPoolConfig();
|
||||
const encoded = Buffer.from(JSON.stringify(payload), "utf8").toString("base64");
|
||||
return remotePythonScript("credits", encoded, pool, target);
|
||||
}
|
||||
|
||||
export function sentinelReportScript(pool: CodexPoolConfig, events: number, target: CodexPoolRuntimeTarget): string {
|
||||
const stateName = pool.sentinel.stateConfigMapName;
|
||||
const cronJobName = pool.sentinel.cronJobName;
|
||||
|
||||
Reference in New Issue
Block a user