@sejuneoh/aitop 0.21.2 → 0.21.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sejuneoh/aitop",
3
- "version": "0.21.2",
3
+ "version": "0.21.3",
4
4
  "description": "터미널에서 Claude Code · Codex · Antigravity · Gemini 세션과 토큰을 실시간으로 보는 읽기 전용 모니터",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/notify.mjs CHANGED
@@ -67,10 +67,11 @@ export function which(name, envPath = process.env.PATH ?? '') {
67
67
  return null;
68
68
  }
69
69
 
70
- export function isWsl(env = process.env) {
70
+ // WSL 인지. --doctor 의 알림 안내에 쓴다. readVersion 은 테스트에서 /proc/version 대신 넣는다.
71
+ export function isWsl(env = process.env, readVersion = () => readFileSync('/proc/version', 'utf8')) {
71
72
  if (env.WSL_DISTRO_NAME || env.WSL_INTEROP) return true;
72
73
  try {
73
- return /microsoft/i.test(readFileSync('/proc/version', 'utf8'));
74
+ return /microsoft/i.test(readVersion());
74
75
  } catch {
75
76
  return false;
76
77
  }
package/src/pricing.mjs CHANGED
@@ -39,8 +39,8 @@ const GEMINI_PRICES = {
39
39
  'gemini-3.1-flash-lite': [{ input: 0.25, output: 1.5, cacheRead: 0.025 }],
40
40
  };
41
41
 
42
- // 가격표가 바뀌면 이 값이 바뀌고, 캐시 폴더도 바뀌어 예전 비용이 다시 계산된다.
43
- export const PRICE_TAG = createHash('sha1').update(JSON.stringify([PRICES, GEMINI_PRICES])).digest('hex').slice(0, 8);
42
+ // 가격표의 지문(8자리). 표의 값이 하나라도 바뀌면 지문도 바뀐다.
43
+ export const priceTag = (tables) => createHash('sha1').update(JSON.stringify(tables)).digest('hex').slice(0, 8);
44
44
 
45
45
  // 모델별 컨텍스트 창 크기(토큰). 출처: Anthropic 모델 표(2026-10). 표에 없는 모델은 contextWindow 가 추측한다.
46
46
  const WINDOWS = {
@@ -93,7 +93,9 @@ export function claudeCost(model, u) {
93
93
  }
94
94
 
95
95
  // Codex(OpenAI) API 정가 기준 환산 비용 (USD / 100만 토큰). Claude 와 같이 "API 로 썼다면" 기준이다.
96
- // 출처: 2026-11 가격 비교 사이트(pricepertoken.com, computeprices.com)의 OpenAI 정가. 추정값이라 README 에 적어 둔다.
96
+ // 출처: OpenAI 공식 가격표 https://developers.openai.com/api/docs/pricing 와 모델별 문서
97
+ // (https://developers.openai.com/api/docs/models/gpt-5.3-codex, gpt-5.1-codex, gpt-5.1-codex-mini, codex-mini-latest, gpt-4o-mini).
98
+ // 2026-11-11 확인, 다섯 모델 모두 공식 값과 같다. cacheRead 는 cached input 가격이다.
97
99
  const OPENAI_PRICES = {
98
100
  'gpt-5.3-codex': { input: 1.75, cacheRead: 0.175, output: 14 },
99
101
  'gpt-5.1-codex-mini': { input: 0.25, cacheRead: 0.025, output: 2 },
@@ -102,6 +104,10 @@ const OPENAI_PRICES = {
102
104
  'gpt-4o-mini': { input: 0.15, cacheRead: 0.075, output: 0.6 },
103
105
  };
104
106
 
107
+ // 가격표가 바뀌면 이 값이 바뀌고, 캐시 폴더도 바뀌어 예전 비용이 다시 계산된다. 세 표(Claude, Gemini, Codex)를 모두 넣는다.
108
+ export const PRICE_TABLES = [PRICES, GEMINI_PRICES, OPENAI_PRICES];
109
+ export const PRICE_TAG = priceTag(PRICE_TABLES);
110
+
105
111
  // Codex 세션 누적 토큰(tokens: input 은 캐시 제외, cacheRead, output)의 환산 비용. 가격표에 없는 모델이면 null.
106
112
  export function codexCost(model, t) {
107
113
  const p = lookup(OPENAI_PRICES, model);