@atlaswork/atlascode 0.1.134 → 0.1.135
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 +4 -1
- package/dist/atlasweb-carrier.json +1 -1
- package/dist/cli.js +42 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,7 +61,10 @@ atlascode --help # 别名 `atlas` 同效
|
|
|
61
61
|
|
|
62
62
|
- **三角色模型池**(`premium` / `fast` / `small`):`modelRoles.<role>` =
|
|
63
63
|
`{ provider, model?, models?(池,水平回退序), baseURL?, apiKey? }`;
|
|
64
|
-
`defaultRole`
|
|
64
|
+
`defaultRole` 选主循环默认角色(合法值 `premium`/`fast`/`small`;未设或非法时
|
|
65
|
+
headless `-p` 车道缺省 `premium`,TUI 引导面缺省 `small`)。
|
|
66
|
+
`--model` 亦接受角色别名 `small`/`premium`/`fast`(等价该角色池;未知 ref
|
|
67
|
+
启动即报错退出,0.1.135 起)。
|
|
65
68
|
- **Provider 表**:`providers.<name>` =
|
|
66
69
|
`{ baseURL, apiKey, api, models: [{ id, name?, contextWindow?, maxTokens? }],
|
|
67
70
|
defaultContextWindow?, defaultMaxTokens? }`;模型引用 `"<provider>/<modelId>"`。
|
package/dist/cli.js
CHANGED
|
@@ -27355,16 +27355,7 @@ function getRoleModels(role, sessionModel, fallbackModel) {
|
|
|
27355
27355
|
const envModel = process.env["ATLAS_" + roleKey + "_MODEL"];
|
|
27356
27356
|
const providers = getEndpointConfigSource().getProviders();
|
|
27357
27357
|
const roleSetting = getEndpointConfigSource().getRoleSetting(role);
|
|
27358
|
-
const normalizeRef = (ref) =>
|
|
27359
|
-
if (ref.includes("/"))
|
|
27360
|
-
return ref;
|
|
27361
|
-
for (const [pName, pCfg] of Object.entries(providers)) {
|
|
27362
|
-
const models = pCfg.models || [];
|
|
27363
|
-
if (models.some((m) => m?.id === ref))
|
|
27364
|
-
return pName + "/" + ref;
|
|
27365
|
-
}
|
|
27366
|
-
return ref;
|
|
27367
|
-
};
|
|
27358
|
+
const normalizeRef = (ref) => normalizeModelRefWithProviders(ref, providers);
|
|
27368
27359
|
const rolePool = (Array.isArray(roleSetting.models) ? roleSetting.models : []).map((m) => {
|
|
27369
27360
|
if (typeof m === "string")
|
|
27370
27361
|
return m;
|
|
@@ -27385,6 +27376,30 @@ function getRoleModels(role, sessionModel, fallbackModel) {
|
|
|
27385
27376
|
}
|
|
27386
27377
|
return refs;
|
|
27387
27378
|
}
|
|
27379
|
+
function normalizeModelRefWithProviders(ref, providers) {
|
|
27380
|
+
if (ref.includes("/"))
|
|
27381
|
+
return ref;
|
|
27382
|
+
for (const [pName, pCfg] of Object.entries(providers)) {
|
|
27383
|
+
const models = pCfg.models || [];
|
|
27384
|
+
if (models.some((m) => m?.id === ref))
|
|
27385
|
+
return pName + "/" + ref;
|
|
27386
|
+
}
|
|
27387
|
+
return ref;
|
|
27388
|
+
}
|
|
27389
|
+
function resolveModelRefStrict(ref) {
|
|
27390
|
+
const providers = getEndpointConfigSource().getProviders();
|
|
27391
|
+
const model = resolveModel(normalizeModelRefWithProviders(ref, providers));
|
|
27392
|
+
if (model)
|
|
27393
|
+
return { kind: "provider", model };
|
|
27394
|
+
if (MODEL_ROLES.includes(ref)) {
|
|
27395
|
+
const role = ref;
|
|
27396
|
+
return getRoleModel(role) !== undefined ? { kind: "role", role } : { kind: "unconfigured-role", role };
|
|
27397
|
+
}
|
|
27398
|
+
return { kind: "unknown" };
|
|
27399
|
+
}
|
|
27400
|
+
function resolveDefaultRole(raw) {
|
|
27401
|
+
return MODEL_ROLES.includes(raw) ? raw : "premium";
|
|
27402
|
+
}
|
|
27388
27403
|
function resolveModel(ref) {
|
|
27389
27404
|
const providers = getEndpointConfigSource().getProviders();
|
|
27390
27405
|
const slash = ref.indexOf("/");
|
|
@@ -29238,9 +29253,11 @@ var init_modelprovider = __esm(() => {
|
|
|
29238
29253
|
`);
|
|
29239
29254
|
const hasQuota = failures.some((f) => f.code === "quota_exhausted");
|
|
29240
29255
|
const fix = hasQuota ? "Top up your provider quota, or switch to another provider/model (settings.json modelRoles/providers, or --model), then retry." : "Check provider credentials/quota, or switch to another provider/model (settings.json modelRoles/providers, or --model), then retry.";
|
|
29256
|
+
const has404 = failures.some((f) => f.code === "api_error_404");
|
|
29257
|
+
const fix404 = has404 ? " api_error_404 often means the URL path is wrong — if the gateway serves an OpenAI-compatible API under /v1, append /v1 to the provider baseURL (settings.json providers.<name>.baseURL)." : "";
|
|
29241
29258
|
super(`All ${failures.length} model(s) in pool for role '${role}' failed:
|
|
29242
29259
|
` + lines + `
|
|
29243
|
-
Fix: ${fix}`);
|
|
29260
|
+
Fix: ${fix}${fix404}`);
|
|
29244
29261
|
this.name = "ModelPoolExhaustedError";
|
|
29245
29262
|
this.role = role;
|
|
29246
29263
|
this.failures = failures;
|
|
@@ -29373,6 +29390,7 @@ var init_modelprovider2 = __esm(() => {
|
|
|
29373
29390
|
init_modelprovider();
|
|
29374
29391
|
init_params();
|
|
29375
29392
|
init_roles7();
|
|
29393
|
+
init_roles7();
|
|
29376
29394
|
init_errorUtils();
|
|
29377
29395
|
init_effort();
|
|
29378
29396
|
init_params();
|
|
@@ -94063,6 +94081,17 @@ async function runHeadless(inputPrompt, options) {
|
|
|
94063
94081
|
}
|
|
94064
94082
|
if (options.outputFormat === "stream-json" && !options.verbose) {
|
|
94065
94083
|
process.stderr.write(`Error: When using --print, --output-format=stream-json requires --verbose
|
|
94084
|
+
`);
|
|
94085
|
+
process.exit(1);
|
|
94086
|
+
}
|
|
94087
|
+
const strictModelRef = options.model ? resolveModelRefStrict(options.model) : undefined;
|
|
94088
|
+
if (strictModelRef?.kind === "unconfigured-role") {
|
|
94089
|
+
process.stderr.write(`Error: role '${strictModelRef.role}' is not configured (modelRoles.${strictModelRef.role})
|
|
94090
|
+
`);
|
|
94091
|
+
process.exit(1);
|
|
94092
|
+
}
|
|
94093
|
+
if (strictModelRef?.kind === "unknown") {
|
|
94094
|
+
process.stderr.write(`Error: unknown model ref '${options.model}' (no provider entry in settings.json providers table)
|
|
94066
94095
|
`);
|
|
94067
94096
|
process.exit(1);
|
|
94068
94097
|
}
|
|
@@ -94090,7 +94119,7 @@ async function runHeadless(inputPrompt, options) {
|
|
|
94090
94119
|
strictMcpConfig: options.strictMcpConfig
|
|
94091
94120
|
});
|
|
94092
94121
|
const hasPromptRoute = options.permissionPromptToolName === "stdio";
|
|
94093
|
-
const role = options.model ? modelToRole(options.model) :
|
|
94122
|
+
const role = options.model ? strictModelRef?.kind === "role" ? strictModelRef.role : modelToRole(options.model) : resolveDefaultRole(settings.settings.defaultRole);
|
|
94094
94123
|
const roleModel = getRoleModel(role);
|
|
94095
94124
|
logForDebugging2(modelLine(role, options.model ?? roleModel));
|
|
94096
94125
|
const bundle = await createAgentLoopDeps({
|
|
@@ -94107,7 +94136,7 @@ async function runHeadless(inputPrompt, options) {
|
|
|
94107
94136
|
baseTools: getBaseToolEntities()
|
|
94108
94137
|
},
|
|
94109
94138
|
role,
|
|
94110
|
-
sessionModel: options.model,
|
|
94139
|
+
sessionModel: strictModelRef?.kind === "role" ? undefined : options.model,
|
|
94111
94140
|
disablePersistence: options.disablePersistence,
|
|
94112
94141
|
systemPrompt: resolveHeadlessSystemPrompt(options),
|
|
94113
94142
|
thinkingConfig: options.thinkingConfig,
|
package/package.json
CHANGED