cdsa-harness 0.22.2 → 0.22.3
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/package.json +1 -1
- package/src/builtins.js +1 -1
- package/src/cli.js +10 -0
- package/src/llm.js +18 -5
package/package.json
CHANGED
package/src/builtins.js
CHANGED
package/src/cli.js
CHANGED
|
@@ -549,6 +549,12 @@ async function runSetup(ask, cfg) {
|
|
|
549
549
|
return false;
|
|
550
550
|
}
|
|
551
551
|
cfg.provider = provider;
|
|
552
|
+
// ollama 설정이 남긴 base_url 잔재는 다른 provider 의 요청까지 그 주소로 보내버린다.
|
|
553
|
+
// provider 를 새로 고르면 지운다(ollama 는 아래에서 다시 채워진다).
|
|
554
|
+
if (provider !== "ollama" && cfg.base_url) {
|
|
555
|
+
console.log(c.dim(`(이전 설정의 base_url(${cfg.base_url}) 을 지웠어요 — ${provider} 공식 엔드포인트를 사용합니다)`));
|
|
556
|
+
cfg.base_url = "";
|
|
557
|
+
}
|
|
552
558
|
|
|
553
559
|
if (provider === "mock") {
|
|
554
560
|
cfg.model = "mock-agent";
|
|
@@ -1263,6 +1269,10 @@ export async function main(argv = []) {
|
|
|
1263
1269
|
const p = user.split(/\s+/)[1];
|
|
1264
1270
|
if (!PROVIDERS.includes(p)) { console.log(c.yellow(`provider 는 ${PROVIDERS.join("/")} 중 하나.`)); continue; }
|
|
1265
1271
|
cfg.provider = p;
|
|
1272
|
+
if (p !== "ollama" && cfg.base_url) {
|
|
1273
|
+
console.log(c.dim(`(이전 설정의 base_url(${cfg.base_url}) 을 지웠어요 — ${p} 공식 엔드포인트를 사용합니다)`));
|
|
1274
|
+
cfg.base_url = "";
|
|
1275
|
+
}
|
|
1266
1276
|
if (SUGGESTED_MODELS[p]?.length) cfg.model = SUGGESTED_MODELS[p][0];
|
|
1267
1277
|
loop.client = makeClient(cfg);
|
|
1268
1278
|
loop.reset();
|
package/src/llm.js
CHANGED
|
@@ -57,7 +57,7 @@ export class LLMClient {
|
|
|
57
57
|
res = await fetch(url, { method: "POST", headers, body: json, signal: ctrl.signal });
|
|
58
58
|
} catch (e) {
|
|
59
59
|
clearTimeout(timer);
|
|
60
|
-
throw new LLMError(this._netErrorMessage(e));
|
|
60
|
+
throw new LLMError(this._netErrorMessage(e, url));
|
|
61
61
|
}
|
|
62
62
|
if (!res.ok) {
|
|
63
63
|
clearTimeout(timer);
|
|
@@ -67,8 +67,8 @@ export class LLMClient {
|
|
|
67
67
|
return { res, started, timer, bodyBytes: Buffer.byteLength(json, "utf8") };
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
_netErrorMessage(e) {
|
|
71
|
-
return describeNetError(e, this.provider, this.timeout);
|
|
70
|
+
_netErrorMessage(e, url = "") {
|
|
71
|
+
return describeNetError(e, this.provider, this.timeout, url);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
async _post(url, headers, body) {
|
|
@@ -80,7 +80,7 @@ export class LLMClient {
|
|
|
80
80
|
try {
|
|
81
81
|
res = await fetch(url, { method: "POST", headers, body: json, signal: ctrl.signal });
|
|
82
82
|
} catch (e) {
|
|
83
|
-
throw new LLMError(this._netErrorMessage(e));
|
|
83
|
+
throw new LLMError(this._netErrorMessage(e, url));
|
|
84
84
|
} finally {
|
|
85
85
|
clearTimeout(timer);
|
|
86
86
|
}
|
|
@@ -231,7 +231,7 @@ export class LLMClient {
|
|
|
231
231
|
// Node 내장 fetch(undici)는 실패하면 겉면 메시지가 "fetch failed" 하나뿐이고,
|
|
232
232
|
// 진짜 원인(DNS 실패·프록시·인증서 등)은 e.cause 체인 안에 숨어 있다.
|
|
233
233
|
// 여기서 원인을 끝까지 파고들어 사용자에게 코드와 해결 힌트까지 보여준다.
|
|
234
|
-
export function describeNetError(e, provider = "", timeout = 0) {
|
|
234
|
+
export function describeNetError(e, provider = "", timeout = 0, url = "") {
|
|
235
235
|
// 자체 타임아웃(AbortController)에 걸린 경우: fetch 는 AbortError 를 던진다.
|
|
236
236
|
if (e?.name === "AbortError" || e?.name === "TimeoutError") {
|
|
237
237
|
return `네트워크 오류: 응답 시간 초과(${timeout}ms). 네트워크가 느리거나 요청이 너무 클 수 있어요.`;
|
|
@@ -257,6 +257,19 @@ export function describeNetError(e, provider = "", timeout = 0) {
|
|
|
257
257
|
else if (codes.length) msg += `\n ↳ 원인 코드: ${codes.join(", ")}`;
|
|
258
258
|
|
|
259
259
|
const has = (...cs) => cs.some((c) => codes.includes(c));
|
|
260
|
+
|
|
261
|
+
// provider 는 클라우드(anthropic 등)인데 요청이 로컬 주소로 가는 경우:
|
|
262
|
+
// 이전에 ollama 설정 등이 남긴 config.json 의 base_url 잔재가 원인이다.
|
|
263
|
+
// 이때 방화벽/프록시 힌트는 오답이므로 이 안내만 보여주고 끝낸다.
|
|
264
|
+
const localUrl = /^https?:\/\/(localhost|127\.0\.0\.1|\[?::1\]?)([:/]|$)/i.test(url);
|
|
265
|
+
if (localUrl && provider && provider !== "ollama") {
|
|
266
|
+
msg +=
|
|
267
|
+
`\n ↳ provider 는 '${provider}' 인데 요청이 로컬 주소(${url})로 가고 있어요. ` +
|
|
268
|
+
"설정 파일(config.json)에 이전 ollama 설정의 base_url 이 남아 있을 가능성이 큽니다.\n" +
|
|
269
|
+
" ↳ 해결: /setup 을 다시 실행하거나, config.json 에서 \"base_url\" 값을 지우고 재시작하세요.";
|
|
270
|
+
return msg;
|
|
271
|
+
}
|
|
272
|
+
|
|
260
273
|
if (has("ENOTFOUND", "EAI_AGAIN")) {
|
|
261
274
|
msg += "\n ↳ DNS 조회 실패예요. 인터넷 연결을 확인하세요. 사내망이라면 프록시 뒤일 가능성이 큽니다(아래 프록시 안내 참고).";
|
|
262
275
|
}
|