@yhong91/cpac 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/ping.js +4 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -369,7 +369,7 @@ cpac restore cline
|
|
|
369
369
|
|
|
370
370
|
```bash
|
|
371
371
|
cpac ping codex # 目录里匹配 gpt-*-luna 的一条
|
|
372
|
-
cpac ping agy # gemini-3.8-flash
|
|
372
|
+
cpac ping agy # gemini-3.8-flash 和 claude-sonnet-4-6,各一条
|
|
373
373
|
```
|
|
374
374
|
|
|
375
375
|
用 `CPA_API_KEY`。日志只打模型、HTTP 状态和不含 key 的 `x-cpa-*` trace。CPA 按账号轮询,一次只会落在一个账号上。
|
package/dist/ping.js
CHANGED
|
@@ -2,7 +2,7 @@ import { apiBase, catalogSlugs, fetchCatalog } from "./config.js";
|
|
|
2
2
|
import { CPACError } from "./util.js";
|
|
3
3
|
const LUNA = /^gpt-.+-luna$/;
|
|
4
4
|
export const PING_MODELS = {
|
|
5
|
-
agy: ["gemini-3.8-flash
|
|
5
|
+
agy: ["gemini-3.8-flash", "claude-sonnet-4-6"],
|
|
6
6
|
};
|
|
7
7
|
export function matchLuna(slugs) {
|
|
8
8
|
const model = slugs.filter((slug) => LUNA.test(slug)).sort().at(-1);
|
|
@@ -51,14 +51,15 @@ export async function runPing(config, target, deps = {}) {
|
|
|
51
51
|
failed += 1;
|
|
52
52
|
continue;
|
|
53
53
|
}
|
|
54
|
-
await response.
|
|
54
|
+
const text = await response.text();
|
|
55
55
|
const trace = [];
|
|
56
56
|
response.headers.forEach((value, key) => {
|
|
57
57
|
const name = key.toLowerCase();
|
|
58
58
|
if (name.startsWith("x-cpa-") && !name.includes("key"))
|
|
59
59
|
trace.push(`${name}=${redact(value)}`);
|
|
60
60
|
});
|
|
61
|
-
|
|
61
|
+
const detail = response.status === 200 ? "" : ` ${redact(text).replaceAll(apiKey, "***").slice(0, 180)}`;
|
|
62
|
+
log(`${model} HTTP ${response.status}${trace.length ? ` ${trace.join(" ")}` : ""}${detail}`);
|
|
62
63
|
if (response.status !== 200)
|
|
63
64
|
failed += 1;
|
|
64
65
|
}
|