@agent-proxy/agy 0.11.1 → 0.12.0
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/dist/catalog.d.ts +2 -5
- package/dist/catalog.js +7 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/resources/models.js +3260 -910
- package/package.json +4 -4
package/dist/catalog.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export declare function parseAgyCatalogData(value: unknown): AgyCatalogData;
|
|
|
46
46
|
export declare function agyEffortTier(effort: unknown): AgyTier;
|
|
47
47
|
/** 家族内按档位解析上游模型 id;目标档缺失时按「就近偏高」回退,家族必有成员。 */
|
|
48
48
|
export declare function resolveAgyFamilyModel(family: AgyModelFamily, effort: unknown): string;
|
|
49
|
-
/** Codex
|
|
49
|
+
/** Codex 行为字段沿用快照基底(优先 gpt-5.5,缺失回退首条);模型名与能力仅由当前账号目录决定。
|
|
50
50
|
* 多档位家族合并为一个 `agy/<base>` 条目(能力/窗口取成员并集或最大值),
|
|
51
51
|
* `supported_reasoning_levels` 只列家族实际存在的档位;无档位后缀的模型保持
|
|
52
52
|
* 独立条目且不暴露档位选择。 */
|
|
@@ -64,10 +64,7 @@ export interface AgyCatalogStoreOptions {
|
|
|
64
64
|
/** manual 仅允许显式刷新;目录查询不按 TTL 拉取。 */
|
|
65
65
|
catalogMode?: "dynamic" | "manual";
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
* 目录存储:内存 + 磁盘双指纹缓存、TTL、单飞刷新、失败回退 last-good。
|
|
69
|
-
* 账号切换(identity 变化)后旧 key 条目不复用。
|
|
70
|
-
*/
|
|
67
|
+
export declare const AGY_RUNTIME_ARTIFACTS: readonly string[];
|
|
71
68
|
export declare function createAgyCatalogStore(options: AgyCatalogStoreOptions): {
|
|
72
69
|
/** 返回目录条目、档位家族与旧 id 重定向表;无凭据或完全无缓存时抛错。 */
|
|
73
70
|
catalog(): Promise<{
|
package/dist/catalog.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
|
-
import {
|
|
4
|
+
import { getCodexBaselineEntry } from "./resources/models.js";
|
|
5
5
|
import { invalidateModelsCache, withAgentSystemPrompt } from "@agent-proxy/plugin-api";
|
|
6
6
|
import { atomicWrite } from "@agent-proxy/plugin-api";
|
|
7
7
|
import { AGY_AGENT_SYSTEM_PROMPT, AGY_ENDPOINT } from "./transport.js";
|
|
@@ -166,14 +166,12 @@ const baseLevelDescriptions = (base) => new Map((Array.isArray(base.supported_re
|
|
|
166
166
|
? base.supported_reasoning_levels
|
|
167
167
|
: []).filter((level) => typeof level.effort === "string" && typeof level.description === "string")
|
|
168
168
|
.map((level) => [level.effort, level.description]));
|
|
169
|
-
/** Codex
|
|
169
|
+
/** Codex 行为字段沿用快照基底(优先 gpt-5.5,缺失回退首条);模型名与能力仅由当前账号目录决定。
|
|
170
170
|
* 多档位家族合并为一个 `agy/<base>` 条目(能力/窗口取成员并集或最大值),
|
|
171
171
|
* `supported_reasoning_levels` 只列家族实际存在的档位;无档位后缀的模型保持
|
|
172
172
|
* 独立条目且不暴露档位选择。 */
|
|
173
173
|
export function buildAgyCatalog(data) {
|
|
174
|
-
const BASE =
|
|
175
|
-
if (!BASE)
|
|
176
|
-
throw new Error("Codex 模型快照缺少 gpt-5.5 基底条目");
|
|
174
|
+
const BASE = getCodexBaselineEntry();
|
|
177
175
|
const BASE_LEVEL_DESCRIPTIONS = baseLevelDescriptions(BASE);
|
|
178
176
|
const familyByMember = new Map();
|
|
179
177
|
for (const family of data.families) {
|
|
@@ -277,12 +275,15 @@ export function mergeAgyCatalog(base, agy) {
|
|
|
277
275
|
* 目录存储:内存 + 磁盘双指纹缓存、TTL、单飞刷新、失败回退 last-good。
|
|
278
276
|
* 账号切换(identity 变化)后旧 key 条目不复用。
|
|
279
277
|
*/
|
|
278
|
+
/** agy 落在缓存目录的产物清单(目录缓存,与落盘点同源);卸载清理与受管值守卫经组合层聚合消费。 */
|
|
279
|
+
const AGY_CATALOG_FILE_NAME = "agy-catalog.json";
|
|
280
|
+
export const AGY_RUNTIME_ARTIFACTS = Object.freeze([AGY_CATALOG_FILE_NAME]);
|
|
280
281
|
export function createAgyCatalogStore(options) {
|
|
281
282
|
const now = options.now ?? Date.now;
|
|
282
283
|
const ttlMs = Math.max(60_000, options.ttlMs ?? CATALOG_TTL_MS);
|
|
283
284
|
const endpoint = options.endpoint ?? AGY_ENDPOINT;
|
|
284
285
|
const endpointDigest = createHash("sha256").update(endpoint).digest("hex").slice(0, 16);
|
|
285
|
-
const cacheFile = path.join(options.cacheDirectory,
|
|
286
|
+
const cacheFile = path.join(options.cacheDirectory, AGY_CATALOG_FILE_NAME);
|
|
286
287
|
let cached;
|
|
287
288
|
let retryAt = 0;
|
|
288
289
|
let refreshing;
|
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export interface SafeAgyError {
|
|
|
41
41
|
/** 只输出预定义分类;私有错误正文(可能回显请求或凭据)不进客户端与日志。 */
|
|
42
42
|
export declare function safeAgyUpstreamError(status: number, body: string): SafeAgyError;
|
|
43
43
|
export { isAgyModel, mergeAgyCatalog };
|
|
44
|
+
export { AGY_RUNTIME_ARTIFACTS } from "./catalog.ts";
|
|
44
45
|
export declare function createAgyAdapter<Config extends AgentConfig>(config: Config, dependencies?: AgyDependencies): {
|
|
45
46
|
catalog(): Promise<ModelCatalog>;
|
|
46
47
|
/** 显式刷新不吞错;无 last-good 时由命令报告失败。 */
|
package/dist/index.js
CHANGED
|
@@ -358,6 +358,7 @@ function buildAgyAdapter(config, dependencies = {}) {
|
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
360
|
export { isAgyModel, mergeAgyCatalog };
|
|
361
|
+
export { AGY_RUNTIME_ARTIFACTS } from "./catalog.js";
|
|
361
362
|
export function createAgyAdapter(config, dependencies = {}) {
|
|
362
363
|
return bindHostMethods(buildAgyAdapter(config, dependencies));
|
|
363
364
|
}
|