@tscgoods/codex-effort-discovery 0.5.2 → 0.5.6

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effort-discovery",
3
- "version": "0.5.2",
3
+ "version": "0.5.6",
4
4
  "description": "Inspect gateway reasoning-effort evidence and prepare a Codex model catalog.",
5
5
  "author": {
6
6
  "name": "tscgoods"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscgoods/codex-effort-discovery",
3
- "version": "0.5.2",
3
+ "version": "0.5.6",
4
4
  "description": "Codex CLI plugin: inspect gateway effort evidence and update a model catalog after verifying the route.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/scripts/lib.mjs CHANGED
@@ -86,10 +86,22 @@ export function parseLevels(text) {
86
86
  return null
87
87
  }
88
88
 
89
+ /** 通用网关可能回显全枚举;只有互相印证的窄子集才算模型级证据 */
90
+ export function pickLevels(candidates) {
91
+ const specific = candidates.filter((levels) => levels.length > 0 && levels.length < 6)
92
+ if (specific.length === 0) return null
93
+ let result = specific[0]
94
+ for (const levels of specific.slice(1)) {
95
+ result = result.filter((level) => levels.includes(level))
96
+ }
97
+ return result.length > 0 ? result : null
98
+ }
99
+
89
100
  export async function probeOpenAI({ baseURL, apiKey, model, headers = {}, timeoutMs = 20_000 }) {
90
101
  const url = `${String(baseURL).replace(/\/+$/, "")}/chat/completions`
91
102
  let last = { levels: null, source: "error", at: Date.now() }
92
103
  let sawOk = false
104
+ const candidates = []
93
105
  for (const sentinel of ["effort-discovery-probe", "ultra", "maximum", "bogus"]) {
94
106
  let response
95
107
  try {
@@ -116,10 +128,16 @@ export async function probeOpenAI({ baseURL, apiKey, model, headers = {}, timeou
116
128
  const text = await response.text()
117
129
  if (response.ok) { sawOk = true; continue }
118
130
  const levels = parseLevels(text)
119
- if (levels) return { levels, source: "validated", at: Date.now() }
131
+ if (levels) {
132
+ candidates.push(levels)
133
+ continue
134
+ }
120
135
  last = { levels: null, source: `http-${response.status}`, at: Date.now() }
121
136
  if ([401, 403, 429].includes(response.status)) return last
122
137
  }
138
+ const levels = pickLevels(candidates)
139
+ if (levels) return { levels, source: "validated", at: Date.now() }
140
+ if (candidates.length > 0) return { levels: null, source: "no-validation", at: Date.now() }
123
141
  return sawOk ? { levels: null, source: "no-validation", at: Date.now() } : last
124
142
  }
125
143