@yoonion/mimi-seed-mcp 0.24.0 → 0.25.1

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.
Files changed (287) hide show
  1. package/dist/admob/cli.js +34 -5
  2. package/dist/admob/errors.js +39 -14
  3. package/dist/ai/client.js +35 -14
  4. package/dist/ai/notes.js +14 -3
  5. package/dist/ai/review.js +17 -4
  6. package/dist/android/keystore-store.js +28 -8
  7. package/dist/android/keystore.d.ts +17 -2
  8. package/dist/android/keystore.js +110 -21
  9. package/dist/android/messages.d.ts +13 -11
  10. package/dist/android/messages.js +166 -72
  11. package/dist/android/playstore-sa.js +6 -3
  12. package/dist/appstore/analytics.js +46 -14
  13. package/dist/appstore/app-info-policy.js +7 -1
  14. package/dist/appstore/app-info.js +13 -3
  15. package/dist/appstore/apps.js +7 -1
  16. package/dist/appstore/asset-library-write.js +119 -37
  17. package/dist/appstore/asset-library.js +19 -5
  18. package/dist/appstore/auth.d.ts +2 -0
  19. package/dist/appstore/auth.js +31 -5
  20. package/dist/appstore/client.js +27 -6
  21. package/dist/appstore/declarations.js +22 -6
  22. package/dist/appstore/errors.d.ts +1 -1
  23. package/dist/appstore/errors.js +60 -34
  24. package/dist/appstore/http.d.ts +6 -0
  25. package/dist/appstore/http.js +22 -5
  26. package/dist/appstore/messages.js +86 -28
  27. package/dist/appstore/previews.js +22 -6
  28. package/dist/appstore/product-localization.js +10 -2
  29. package/dist/appstore/product-review.js +29 -10
  30. package/dist/appstore/products.js +20 -6
  31. package/dist/appstore/read-response.js +13 -3
  32. package/dist/appstore/release-target.js +13 -3
  33. package/dist/appstore/release.js +59 -22
  34. package/dist/appstore/review-preview.js +17 -6
  35. package/dist/appstore/review-submission.js +86 -35
  36. package/dist/appstore/sales.js +96 -44
  37. package/dist/appstore/screenshots.js +19 -5
  38. package/dist/appstore/testflight.js +41 -18
  39. package/dist/appstore/upload-parts.js +12 -3
  40. package/dist/appstore/versions.js +22 -10
  41. package/dist/auth/bigquery-auth.js +44 -15
  42. package/dist/auth/bigquery-setup-cli.js +1 -1
  43. package/dist/auth/cli.js +4 -2
  44. package/dist/auth/constants.js +13 -3
  45. package/dist/auth/drive-auth.d.ts +3 -2
  46. package/dist/auth/drive-auth.js +47 -17
  47. package/dist/auth/drive-setup-cli.js +1 -0
  48. package/dist/auth/errors.d.ts +75 -0
  49. package/dist/auth/errors.js +190 -86
  50. package/dist/auth/google-auth.d.ts +3 -1
  51. package/dist/auth/google-auth.js +39 -27
  52. package/dist/auth/playstore-auth.d.ts +1 -0
  53. package/dist/auth/playstore-auth.js +35 -15
  54. package/dist/auth/scopes.d.ts +11 -29
  55. package/dist/auth/scopes.js +38 -11
  56. package/dist/auth/youtube-channel.d.ts +8 -0
  57. package/dist/auth/youtube-channel.js +11 -3
  58. package/dist/bigquery/ids.js +19 -5
  59. package/dist/bigquery/tools.js +24 -8
  60. package/dist/billing/tools.js +22 -6
  61. package/dist/checks/appstore-submission.d.ts +1 -1
  62. package/dist/checks/appstore-submission.js +29 -8
  63. package/dist/checks/plan.js +169 -62
  64. package/dist/checks/release-status.js +10 -2
  65. package/dist/checks/risks.js +230 -63
  66. package/dist/checks/screenshots.d.ts +4 -4
  67. package/dist/checks/screenshots.js +63 -22
  68. package/dist/ci/config.js +8 -5
  69. package/dist/ci/gitlab.js +3 -1
  70. package/dist/core/atomic-write.d.ts +5 -2
  71. package/dist/core/atomic-write.js +8 -4
  72. package/dist/core/catch-scan.d.ts +17 -0
  73. package/dist/core/catch-scan.js +111 -0
  74. package/dist/core/checks/billing.d.ts +5 -0
  75. package/dist/core/checks/billing.js +36 -5
  76. package/dist/core/checks/lockfile.js +2 -0
  77. package/dist/core/checks/release-doctor/fcm.js +1 -0
  78. package/dist/core/checks/release-doctor/files.d.ts +3 -1
  79. package/dist/core/checks/release-doctor/files.js +12 -1
  80. package/dist/core/checks/release-doctor/gradle-apply.js +1 -0
  81. package/dist/core/checks/release-doctor/ios-xcode.js +22 -3
  82. package/dist/core/checks/release-doctor/target-sdk.js +1 -1
  83. package/dist/core/checks/release-doctor/util.d.ts +5 -0
  84. package/dist/core/checks/release-doctor/util.js +56 -0
  85. package/dist/core/checks/release-doctor.js +59 -16
  86. package/dist/core/credential-envelope.d.ts +25 -0
  87. package/dist/core/credential-envelope.js +66 -0
  88. package/dist/core/credential-keystore.d.ts +51 -0
  89. package/dist/core/credential-keystore.js +331 -0
  90. package/dist/core/credential-read.d.ts +33 -0
  91. package/dist/core/credential-read.js +112 -0
  92. package/dist/core/credential-store.d.ts +61 -0
  93. package/dist/core/credential-store.js +240 -0
  94. package/dist/core/http-errors.js +1 -0
  95. package/dist/core/i18n-scan.d.ts +10 -0
  96. package/dist/core/i18n-scan.js +79 -0
  97. package/dist/core/json-file.d.ts +30 -0
  98. package/dist/core/json-file.js +53 -0
  99. package/dist/core/lang.d.ts +14 -0
  100. package/dist/core/lang.js +22 -2
  101. package/dist/core/project-manifest.d.ts +24 -1
  102. package/dist/core/project-manifest.js +27 -16
  103. package/dist/drive/tools.js +86 -34
  104. package/dist/facebook/api.js +3 -1
  105. package/dist/facebook/config.js +11 -3
  106. package/dist/facebook/setup.d.ts +2 -0
  107. package/dist/facebook/setup.js +32 -9
  108. package/dist/firebase/cli.js +39 -5
  109. package/dist/firebase/tools.js +36 -10
  110. package/dist/ga4/cli.js +48 -4
  111. package/dist/ga4/tools.js +4 -2
  112. package/dist/googleads/config.js +24 -8
  113. package/dist/googleads/tools.js +3 -1
  114. package/dist/gsc/tools.js +10 -2
  115. package/dist/helpers.d.ts +4 -2
  116. package/dist/helpers.js +66 -32
  117. package/dist/i18n/manifest-en.d.ts +6 -0
  118. package/dist/i18n/manifest-en.js +53 -0
  119. package/dist/i18n/tools-en/admob.d.ts +25 -0
  120. package/dist/i18n/tools-en/admob.js +24 -0
  121. package/dist/i18n/tools-en/ai.d.ts +14 -0
  122. package/dist/i18n/tools-en/ai.js +13 -0
  123. package/dist/i18n/tools-en/android.d.ts +14 -0
  124. package/dist/i18n/tools-en/android.js +13 -0
  125. package/dist/i18n/tools-en/appstore.d.ts +240 -0
  126. package/dist/i18n/tools-en/appstore.js +239 -0
  127. package/dist/i18n/tools-en/auth.d.ts +16 -0
  128. package/dist/i18n/tools-en/auth.js +15 -0
  129. package/dist/i18n/tools-en/bigquery.d.ts +16 -0
  130. package/dist/i18n/tools-en/bigquery.js +15 -0
  131. package/dist/i18n/tools-en/billing.d.ts +17 -0
  132. package/dist/i18n/tools-en/billing.js +16 -0
  133. package/dist/i18n/tools-en/checks.d.ts +23 -0
  134. package/dist/i18n/tools-en/checks.js +22 -0
  135. package/dist/i18n/tools-en/ci.d.ts +21 -0
  136. package/dist/i18n/tools-en/ci.js +20 -0
  137. package/dist/i18n/tools-en/drive.d.ts +33 -0
  138. package/dist/i18n/tools-en/drive.js +32 -0
  139. package/dist/i18n/tools-en/facebook.d.ts +14 -0
  140. package/dist/i18n/tools-en/facebook.js +13 -0
  141. package/dist/i18n/tools-en/firebase.d.ts +42 -0
  142. package/dist/i18n/tools-en/firebase.js +41 -0
  143. package/dist/i18n/tools-en/ga4.d.ts +35 -0
  144. package/dist/i18n/tools-en/ga4.js +34 -0
  145. package/dist/i18n/tools-en/googleads.d.ts +15 -0
  146. package/dist/i18n/tools-en/googleads.js +14 -0
  147. package/dist/i18n/tools-en/gsc.d.ts +27 -0
  148. package/dist/i18n/tools-en/gsc.js +26 -0
  149. package/dist/i18n/tools-en/iam.d.ts +15 -0
  150. package/dist/i18n/tools-en/iam.js +14 -0
  151. package/dist/i18n/tools-en/index.d.ts +7 -0
  152. package/dist/i18n/tools-en/index.js +58 -0
  153. package/dist/i18n/tools-en/instagram.d.ts +16 -0
  154. package/dist/i18n/tools-en/instagram.js +15 -0
  155. package/dist/i18n/tools-en/jenkins.d.ts +41 -0
  156. package/dist/i18n/tools-en/jenkins.js +40 -0
  157. package/dist/i18n/tools-en/naver.d.ts +10 -0
  158. package/dist/i18n/tools-en/naver.js +9 -0
  159. package/dist/i18n/tools-en/playstore.d.ts +148 -0
  160. package/dist/i18n/tools-en/playstore.js +147 -0
  161. package/dist/i18n/tools-en/registrar.d.ts +6 -0
  162. package/dist/i18n/tools-en/registrar.js +6 -0
  163. package/dist/i18n/tools-en/threads.d.ts +21 -0
  164. package/dist/i18n/tools-en/threads.js +20 -0
  165. package/dist/i18n/tools-en/tiktok.d.ts +21 -0
  166. package/dist/i18n/tools-en/tiktok.js +20 -0
  167. package/dist/i18n/tools-en/video.d.ts +59 -0
  168. package/dist/i18n/tools-en/video.js +58 -0
  169. package/dist/i18n/tools-en/youtube.d.ts +44 -0
  170. package/dist/i18n/tools-en/youtube.js +43 -0
  171. package/dist/iam/key-files.js +13 -3
  172. package/dist/instagram/api.js +19 -5
  173. package/dist/instagram/config.js +11 -3
  174. package/dist/instagram/setup.js +37 -11
  175. package/dist/jenkins/builds.d.ts +2 -2
  176. package/dist/jenkins/builds.js +70 -30
  177. package/dist/jenkins/config.d.ts +5 -0
  178. package/dist/jenkins/config.js +25 -6
  179. package/dist/jenkins/credentials.js +33 -13
  180. package/dist/jenkins/http.js +6 -3
  181. package/dist/jenkins/jobs.js +19 -5
  182. package/dist/jenkins/messages.js +93 -36
  183. package/dist/lib/cli-args.js +13 -7
  184. package/dist/lib/google-errors.js +31 -9
  185. package/dist/lib/http.js +10 -3
  186. package/dist/lib/json-file.d.ts +15 -0
  187. package/dist/lib/json-file.js +65 -0
  188. package/dist/lib/meta-auth.d.ts +1 -1
  189. package/dist/lib/meta-auth.js +26 -8
  190. package/dist/lib/package-name.js +15 -4
  191. package/dist/lib/package-root.js +1 -1
  192. package/dist/lib/paginate.js +10 -2
  193. package/dist/lib/path-containment.js +22 -6
  194. package/dist/lib/resource-id.js +10 -3
  195. package/dist/lib/store-create-result.js +54 -13
  196. package/dist/lib/text-validators.js +20 -5
  197. package/dist/lib/tool-registrar.d.ts +9 -0
  198. package/dist/lib/tool-registrar.js +33 -14
  199. package/dist/lib/tool-text.d.ts +31 -0
  200. package/dist/lib/tool-text.js +52 -0
  201. package/dist/lib/toolsets.js +13 -3
  202. package/dist/lib/url-path.js +3 -1
  203. package/dist/naver/tools.js +138 -46
  204. package/dist/playstore/data-safety.js +16 -4
  205. package/dist/playstore/errors.js +33 -8
  206. package/dist/playstore/financials.js +83 -35
  207. package/dist/playstore/listing.js +7 -1
  208. package/dist/playstore/messages.js +179 -57
  209. package/dist/playstore/products.js +10 -2
  210. package/dist/playstore/recovery.js +10 -2
  211. package/dist/playstore/releases.js +34 -14
  212. package/dist/playstore/reviews.js +14 -4
  213. package/dist/playstore/statistics.js +3 -1
  214. package/dist/prompts.js +160 -50
  215. package/dist/registers/admob.js +36 -11
  216. package/dist/registers/android.js +25 -9
  217. package/dist/registers/appstore/apps.js +22 -6
  218. package/dist/registers/appstore/customer-reviews.js +7 -1
  219. package/dist/registers/appstore/declarations.js +63 -19
  220. package/dist/registers/appstore/media.js +76 -24
  221. package/dist/registers/appstore/metadata.js +26 -8
  222. package/dist/registers/appstore/products.js +53 -19
  223. package/dist/registers/appstore/review-submission.js +31 -9
  224. package/dist/registers/appstore/testflight.js +82 -24
  225. package/dist/registers/appstore/versions.js +88 -30
  226. package/dist/registers/auth.js +343 -90
  227. package/dist/registers/bigquery.js +54 -14
  228. package/dist/registers/billing.js +18 -4
  229. package/dist/registers/checks.js +20 -5
  230. package/dist/registers/ci.js +60 -20
  231. package/dist/registers/drive.js +18 -7
  232. package/dist/registers/facebook.js +31 -9
  233. package/dist/registers/firebase.js +21 -7
  234. package/dist/registers/googleads.js +23 -6
  235. package/dist/registers/gsc.js +3 -1
  236. package/dist/registers/iam.js +44 -13
  237. package/dist/registers/instagram.js +19 -5
  238. package/dist/registers/jenkins.js +43 -14
  239. package/dist/registers/naver.js +13 -3
  240. package/dist/registers/playstore/financials.d.ts +6 -0
  241. package/dist/registers/playstore/financials.js +48 -0
  242. package/dist/registers/playstore/listing.d.ts +15 -0
  243. package/dist/registers/playstore/listing.js +138 -0
  244. package/dist/registers/playstore/media.d.ts +6 -0
  245. package/dist/registers/playstore/media.js +56 -0
  246. package/dist/registers/playstore/products.d.ts +21 -0
  247. package/dist/registers/playstore/products.js +238 -0
  248. package/dist/registers/playstore/recovery.d.ts +11 -0
  249. package/dist/registers/playstore/recovery.js +105 -0
  250. package/dist/registers/playstore/releases.d.ts +8 -0
  251. package/dist/registers/playstore/releases.js +157 -0
  252. package/dist/registers/playstore/reviews.d.ts +6 -0
  253. package/dist/registers/playstore/reviews.js +43 -0
  254. package/dist/registers/playstore/service-accounts.d.ts +13 -0
  255. package/dist/registers/playstore/service-accounts.js +127 -0
  256. package/dist/registers/playstore/shared.d.ts +12 -0
  257. package/dist/registers/playstore/shared.js +24 -0
  258. package/dist/registers/playstore.d.ts +8 -0
  259. package/dist/registers/playstore.js +28 -734
  260. package/dist/registers/threads.js +28 -8
  261. package/dist/registers/tiktok.js +4 -2
  262. package/dist/registers/video.js +3 -1
  263. package/dist/remote-sync.js +80 -28
  264. package/dist/resources.d.ts +0 -8
  265. package/dist/resources.js +73 -32
  266. package/dist/server.d.ts +2 -0
  267. package/dist/server.js +9 -1
  268. package/dist/social/profile-store.js +36 -12
  269. package/dist/social/setup-cli.js +1 -1
  270. package/dist/threads/api.js +23 -6
  271. package/dist/threads/setup.js +42 -14
  272. package/dist/tiktok-business/api.js +13 -3
  273. package/dist/tiktok-business/auth.js +10 -2
  274. package/dist/tiktok-business/config.js +8 -3
  275. package/dist/tiktok-business/posting.d.ts +6 -0
  276. package/dist/tiktok-business/posting.js +118 -36
  277. package/dist/tiktok-business/setup-cli.js +3 -1
  278. package/dist/tools-cli.js +4 -5
  279. package/dist/video/captions.js +3 -1
  280. package/dist/video/files.js +13 -3
  281. package/dist/video/project.js +65 -21
  282. package/dist/video/providers.js +52 -16
  283. package/dist/video/render.js +71 -22
  284. package/dist/video/research.js +10 -2
  285. package/dist/video/schemas.js +19 -5
  286. package/dist/video/youtube-publish.js +62 -32
  287. package/package.json +1 -1
@@ -1,4 +1,14 @@
1
1
  import { fetchWithTimeout } from '../lib/http.js';
2
+ import { catalog } from '#core/lang.js';
3
+ const M = catalog({
4
+ unreachable: (base, d) => `mcp-auth-config fetch failed (${base} 접속 불가: ${d})`,
5
+ notJson: (d) => `mcp-auth-config fetch failed (응답이 JSON 이 아님: ${d})`,
6
+ empty: 'mcp-auth-config fetch failed (서버 응답에 clientId/clientSecret 비어 있음)',
7
+ }, {
8
+ unreachable: (base, d) => `mcp-auth-config fetch failed (cannot reach ${base}: ${d})`,
9
+ notJson: (d) => `mcp-auth-config fetch failed (response is not JSON: ${d})`,
10
+ empty: 'mcp-auth-config fetch failed (clientId/clientSecret empty in the server response)',
11
+ });
2
12
  const WEB_BASE = process.env.MIMI_SEED_WEB_BASE ?? 'https://mimi-seed.pryzm.gg';
3
13
  let _cached = null;
4
14
  /**
@@ -25,7 +35,7 @@ export async function getMcpOAuthClient() {
25
35
  }
26
36
  catch (e) {
27
37
  const detail = e instanceof Error ? e.message : String(e);
28
- throw new Error(`mcp-auth-config fetch failed (${WEB_BASE} 접속 불가: ${detail})`, { cause: e });
38
+ throw new Error(M().unreachable(WEB_BASE, detail), { cause: e });
29
39
  }
30
40
  if (!res.ok)
31
41
  throw new Error(`mcp-auth-config fetch failed (${res.status})`);
@@ -37,11 +47,11 @@ export async function getMcpOAuthClient() {
37
47
  }
38
48
  catch (e) {
39
49
  const detail = e instanceof Error ? e.message : String(e);
40
- throw new Error(`mcp-auth-config fetch failed (응답이 JSON 이 아님: ${detail})`, { cause: e });
50
+ throw new Error(M().notJson(detail), { cause: e });
41
51
  }
42
52
  // 빈 값 200 응답(서버 env 미설정)을 캐싱하면 프로세스 수명 내내 invalid_client 로 오진된다.
43
53
  if (!data || typeof data !== 'object' || !data.clientId || !data.clientSecret) {
44
- throw new Error('mcp-auth-config fetch failed (서버 응답에 clientId/clientSecret 비어 있음)');
54
+ throw new Error(M().empty);
45
55
  }
46
56
  _cached = { clientId: data.clientId, clientSecret: data.clientSecret };
47
57
  return _cached;
@@ -18,9 +18,10 @@ export interface DriveServiceAccount {
18
18
  /**
19
19
  * 설정된 Drive 서비스 계정. 환경 변수가 있으면 그것이 이긴다.
20
20
  * 환경 변수가 있는데 형식이 틀리면 조용히 파일로 넘어가지 않고 throw — 잘못된 키를 쓰는 줄
21
- * 모른 채 다른 계정으로 올라가는 일을 막는다.
21
+ * 모른 채 다른 계정으로 올라가는 일을 막는다. 파일도 같다 — 있는데 깨졌으면 OAuth 로 넘어가지 않고 throw.
22
22
  */
23
23
  export declare function getDriveServiceAccount(env?: NodeJS.ProcessEnv): DriveServiceAccount | null;
24
24
  /** 서비스 계정 키 → Drive 스코프 JWT 클라이언트. */
25
25
  export declare function driveJwt(key: ServiceAccountKey): JWT;
26
- export declare const DRIVE_AUTH_HINT: string;
26
+ /** Drive 인증 안내 — 호출 시점의 언어로 만든다. */
27
+ export declare function driveAuthHint(): string;
@@ -3,6 +3,41 @@ import fs from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import os from 'node:os';
5
5
  import { writeCredentialFile } from '#core/atomic-write.js';
6
+ import { catalog } from '#core/lang.js';
7
+ import { readCredentialFileSync } from '#core/credential-read.js';
8
+ const M = catalog({
9
+ badJson: 'JSON 파싱 실패 — 올바른 서비스 계정 키 파일이 아닙니다.',
10
+ notSaKey: '서비스 계정 키 형식이 아닙니다 (type="service_account", client_email, private_key 필요).',
11
+ get hint() {
12
+ return [
13
+ '❌ Google Drive 인증이 설정되지 않았어.',
14
+ '',
15
+ '방법 1 — Drive 서비스 계정 (권장: 기존 폴더·공유 드라이브, CI·클라우드):',
16
+ ' npx -y @yoonion/mimi-seed-mcp mimi-seed-drive-auth',
17
+ ` (파일을 둘 수 없는 환경이면 키 JSON 본문을 환경 변수 ${DRIVE_SA_ENV} 에 넣는다)`,
18
+ ' 그 다음 대상 폴더(또는 공유 드라이브)를 서비스 계정 이메일과 공유해.',
19
+ '',
20
+ '방법 2 — Google 계정 OAuth (mimi-seed 가 만든 파일·폴더만 다룸):',
21
+ ' npx -y @yoonion/mimi-seed-mcp mimi-seed-auth --domains drive',
22
+ ];
23
+ },
24
+ }, {
25
+ badJson: 'JSON parse failed — this is not a valid service account key file.',
26
+ notSaKey: 'Not a service account key (needs type="service_account", client_email, private_key).',
27
+ get hint() {
28
+ return [
29
+ '❌ Google Drive authentication is not set up.',
30
+ '',
31
+ 'Option 1 — Drive service account (recommended: existing folders and shared drives, CI and cloud):',
32
+ ' npx -y @yoonion/mimi-seed-mcp mimi-seed-drive-auth',
33
+ ` (where a file cannot be placed, put the key JSON body in the environment variable ${DRIVE_SA_ENV})`,
34
+ ' Then share the target folder (or shared drive) with the service account email.',
35
+ '',
36
+ 'Option 2 — Google account OAuth (handles only files and folders mimi-seed created):',
37
+ ' npx -y @yoonion/mimi-seed-mcp mimi-seed-auth --domains drive',
38
+ ];
39
+ },
40
+ });
6
41
  /**
7
42
  * Google Drive 인증 — 서비스 계정 우선, 없으면 사용자 OAuth(drive.file).
8
43
  *
@@ -30,10 +65,10 @@ export function parseDriveServiceAccountJson(json) {
30
65
  parsed = JSON.parse(json);
31
66
  }
32
67
  catch {
33
- throw new Error('JSON 파싱 실패 — 올바른 서비스 계정 키 파일이 아닙니다.');
68
+ throw new Error(M().badJson);
34
69
  }
35
70
  if (parsed.type !== 'service_account' || !parsed.client_email || !parsed.private_key) {
36
- throw new Error('서비스 계정 키 형식이 아닙니다 (type="service_account", client_email, private_key 필요).');
71
+ throw new Error(M().notSaKey);
37
72
  }
38
73
  return parsed;
39
74
  }
@@ -53,7 +88,7 @@ export function deleteDriveServiceAccountJson() {
53
88
  /**
54
89
  * 설정된 Drive 서비스 계정. 환경 변수가 있으면 그것이 이긴다.
55
90
  * 환경 변수가 있는데 형식이 틀리면 조용히 파일로 넘어가지 않고 throw — 잘못된 키를 쓰는 줄
56
- * 모른 채 다른 계정으로 올라가는 일을 막는다.
91
+ * 모른 채 다른 계정으로 올라가는 일을 막는다. 파일도 같다 — 있는데 깨졌으면 OAuth 로 넘어가지 않고 throw.
57
92
  */
58
93
  export function getDriveServiceAccount(env = process.env) {
59
94
  const fromEnv = env[DRIVE_SA_ENV];
@@ -68,24 +103,19 @@ export function getDriveServiceAccount(env = process.env) {
68
103
  if (!fs.existsSync(DRIVE_SA_PATH))
69
104
  return null;
70
105
  try {
71
- return { key: parseDriveServiceAccountJson(fs.readFileSync(DRIVE_SA_PATH, 'utf-8')), source: 'service-account' };
106
+ return { key: parseDriveServiceAccountJson(readCredentialFileSync(DRIVE_SA_PATH)), source: 'service-account' };
72
107
  }
73
- catch {
74
- return null;
108
+ catch (e) {
109
+ // 깨진 키 파일을 null 로 돌려주면 resolveDriveAuth 가 사용자 OAuth 로 조용히 넘어가 다른 계정으로 올라간다.
110
+ const reason = e.code ?? (e instanceof Error ? e.message : String(e));
111
+ throw new Error(`${DRIVE_SA_PATH}: ${reason}`, { cause: e });
75
112
  }
76
113
  }
77
114
  /** 서비스 계정 키 → Drive 스코프 JWT 클라이언트. */
78
115
  export function driveJwt(key) {
79
116
  return newJWT({ email: key.client_email, key: key.private_key, scopes: DRIVE_SA_SCOPES });
80
117
  }
81
- export const DRIVE_AUTH_HINT = [
82
- '❌ Google Drive 인증이 설정되지 않았어.',
83
- '',
84
- '방법 1 — Drive 서비스 계정 (권장: 기존 폴더·공유 드라이브, CI·클라우드):',
85
- ' npx -y @yoonion/mimi-seed-mcp mimi-seed-drive-auth',
86
- ` (파일을 둘 수 없는 환경이면 키 JSON 본문을 환경 변수 ${DRIVE_SA_ENV} 에 넣는다)`,
87
- ' 그 다음 대상 폴더(또는 공유 드라이브)를 서비스 계정 이메일과 공유해.',
88
- '',
89
- '방법 2 — Google 계정 OAuth (mimi-seed 가 만든 파일·폴더만 다룸):',
90
- ' npx -y @yoonion/mimi-seed-mcp mimi-seed-auth --domains drive',
91
- ].join('\n');
118
+ /** Drive 인증 안내 — 호출 시점의 언어로 만든다. */
119
+ export function driveAuthHint() {
120
+ return M().hint.join('\n');
121
+ }
@@ -112,6 +112,7 @@ async function main() {
112
112
  existing = getDriveServiceAccount();
113
113
  }
114
114
  catch {
115
+ // 기존 키가 깨졌으면(getDriveServiceAccount 가 throw) '기존 없음'으로 보고 새로 설정받는다 — 저장이 파일을 통째로 덮어쓴다
115
116
  existing = null;
116
117
  }
117
118
  if (existing) {
@@ -7,6 +7,81 @@ export interface AuthErrorPayload {
7
7
  needsReauth: boolean;
8
8
  cause?: string;
9
9
  }
10
+ /** 사용자에게 보여줄 메시지 한 쌍. */
11
+ interface AuthText {
12
+ message: string;
13
+ hint: string;
14
+ }
15
+ declare const ko: {
16
+ invalidGrant: {
17
+ message: string;
18
+ hint: string;
19
+ };
20
+ raptRequired: {
21
+ message: string;
22
+ hint: string;
23
+ };
24
+ invalidClient: {
25
+ message: string;
26
+ hint: string;
27
+ };
28
+ unauthorizedClient: {
29
+ message: string;
30
+ hint: string;
31
+ };
32
+ userDenied: {
33
+ message: string;
34
+ hint: string;
35
+ };
36
+ configFetchFailed: {
37
+ message: string;
38
+ hint: string;
39
+ };
40
+ networkError: {
41
+ message: string;
42
+ hint: string;
43
+ };
44
+ portInUse: {
45
+ message: string;
46
+ hint: string;
47
+ };
48
+ callbackTimeout: {
49
+ message: string;
50
+ hint: string;
51
+ };
52
+ unknown: {
53
+ message: string;
54
+ hint: string;
55
+ };
56
+ unauthenticated: {
57
+ message: string;
58
+ hint: string;
59
+ };
60
+ tokenFileInvalid: (file: string, reason: string) => AuthText;
61
+ noRefreshToken: {
62
+ message: string;
63
+ hint: string;
64
+ };
65
+ tokenResponseInvalid: {
66
+ message: string;
67
+ hint: string;
68
+ };
69
+ callbackAddressInUse: (address: string, port: number) => AuthText;
70
+ insufficientScope: (scopes: readonly string[]) => AuthText;
71
+ /** MCP 응답에서 재로그인 명령 앞에 붙는 줄. */
72
+ reloginInTerminal: string;
73
+ /** OAuth 콜백 성공 시 브라우저에 뜨는 페이지. */
74
+ callbackPage: {
75
+ lang: string;
76
+ title: string;
77
+ body: string;
78
+ };
79
+ };
80
+ /**
81
+ * 현재 언어의 인증 문구. 호출 시점에 언어를 읽는다(모듈 로드 시점이 아니라) — MIMI_SEED_LANG 이나
82
+ * settings.json 이 바뀌면 다음 에러부터 반영된다.
83
+ */
84
+ export declare function authText(): typeof ko;
10
85
  export declare class AuthError extends Error {
11
86
  payload: AuthErrorPayload;
12
87
  constructor(payload: AuthErrorPayload);
@@ -1,5 +1,179 @@
1
1
  // Auth 에러 코드 — CLI/MCP/스크립트 모두 같은 코드를 보고 분기할 수 있도록
2
2
  // 단일 source of truth.
3
+ import { resolveLang } from '#core/lang.js';
4
+ // 인증 에러 문구 — 사람이 터미널(mimi-seed-auth)·브라우저 콜백 페이지·MCP 클라이언트에서 그대로 읽는다.
5
+ // 도구 description 과 달리 "LLM 전용 인터페이스"가 아니라 사용자가 따라 해야 하는 복구 안내라서
6
+ // 언어를 고른다. ko 가 원본이고 en 은 `typeof ko` 를 만족해야 한다 — 키를 빠뜨리면 컴파일이 깨진다.
7
+ // code / retriable / needsReauth 는 언어와 무관하므로 여기 두지 않는다.
8
+ const ko = {
9
+ invalidGrant: {
10
+ message: 'refresh_token이 더 이상 유효하지 않습니다 (revoke 또는 만료).',
11
+ hint: 'mimi-seed-auth 로 재로그인하세요.',
12
+ },
13
+ raptRequired: {
14
+ message: 'Google Workspace 재인증(reauth) 정책으로 토큰 갱신이 거부되었습니다 (invalid_rapt).',
15
+ hint: 'mimi-seed-auth 로 재로그인하거나, 재인증 정책의 영향을 받지 않는 서비스 계정 인증을 사용하세요 ' +
16
+ '(BigQuery: mimi-seed-bigquery-auth).',
17
+ },
18
+ invalidClient: {
19
+ message: 'OAuth client_id/secret이 토큰 발급 당시와 일치하지 않습니다.',
20
+ hint: '일반적으로 발생하지 않음. 환경변수 MIMI_SEED_GOOGLE_CLIENT_ID/SECRET 오버라이드 사용 시 ' +
21
+ '동일 값으로 다시 발급받으세요.',
22
+ },
23
+ unauthorizedClient: {
24
+ message: 'OAuth client에 부여되지 않은 grant_type 또는 scope입니다.',
25
+ hint: 'mimi-seed-auth 로 새로운 동의를 받으세요.',
26
+ },
27
+ userDenied: {
28
+ message: 'Google 동의가 거부되었습니다 (access_denied).',
29
+ hint: '직접 거부하지 않았다면: 이 OAuth 앱은 Google 미검증(테스트) 상태라 등록된 테스트 사용자만 로그인할 수 있습니다. ' +
30
+ '운영자에게 Google Cloud Console → OAuth 동의 화면 → 테스트 사용자에 이 계정 추가를 요청한 뒤 재시도하세요. ' +
31
+ '직접 거부했다면 다시 시도해 모든 권한에 동의해주세요.',
32
+ },
33
+ configFetchFailed: {
34
+ message: 'Mimi Seed 서버에서 OAuth 클라이언트 설정을 받지 못했습니다.',
35
+ hint: 'mimi-seed.pryzm.gg 접속 가능 여부를 확인하거나, ' +
36
+ '환경변수 MIMI_SEED_GOOGLE_CLIENT_ID / MIMI_SEED_GOOGLE_CLIENT_SECRET 로 자체 OAuth 클라이언트를 지정하세요.',
37
+ },
38
+ networkError: {
39
+ message: '구글 토큰 엔드포인트(oauth2.googleapis.com)에 연결할 수 없습니다.',
40
+ hint: '인터넷 연결, 프록시, 방화벽을 확인하세요.',
41
+ },
42
+ portInUse: {
43
+ message: 'OAuth 콜백 포트 9876이 이미 사용 중입니다.',
44
+ hint: '해당 포트를 점유 중인 프로세스를 종료하거나 잠시 후 다시 시도하세요.',
45
+ },
46
+ callbackTimeout: {
47
+ message: '시간 내 Google 콜백을 받지 못했습니다.',
48
+ hint: '브라우저에서 동의 안 하셨거나 자동 열기 실패. ' +
49
+ '`mimi-seed-auth --no-browser`로 URL을 직접 받아 다른 환경에서 여세요.',
50
+ },
51
+ unknown: {
52
+ message: '인증 처리 중 알 수 없는 오류가 발생했습니다.',
53
+ hint: '재시도 후 동일하면 mimi-seed-auth 로 재로그인하세요.',
54
+ },
55
+ unauthenticated: {
56
+ message: '저장된 인증 토큰이 없습니다.',
57
+ hint: 'mimi-seed-auth 로 로그인하세요.',
58
+ },
59
+ tokenFileInvalid: (file, reason) => ({
60
+ message: `저장된 인증 토큰 파일을 읽을 수 없습니다: ${file} (${reason}).`,
61
+ hint: 'mimi-seed-auth 로 다시 로그인하면 파일을 새로 씁니다.',
62
+ }),
63
+ noRefreshToken: {
64
+ message: '저장된 토큰에 refresh_token이 없습니다 (offline_access 미발급).',
65
+ hint: 'mimi-seed-auth 로 재로그인하면 prompt=consent로 새 refresh_token이 발급됩니다.',
66
+ },
67
+ tokenResponseInvalid: {
68
+ message: 'Google 응답에 access_token 또는 refresh_token이 누락되었습니다.',
69
+ hint: 'OAuth 동의 화면에서 모든 권한에 동의했는지 확인하세요.',
70
+ },
71
+ callbackAddressInUse: (address, port) => ({
72
+ message: `OAuth 콜백 주소 ${address} 를 다른 프로세스가 사용 중입니다.`,
73
+ hint: `localhost 는 127.0.0.1 과 ::1 어느 쪽으로도 풀릴 수 있어 로그인은 두 주소의 ${port} 포트를 모두 엽니다. ` +
74
+ `점유 프로세스를 찾아 종료한 뒤 다시 시도하세요 — macOS/Linux: \`lsof -nP -i :${port}\`, ` +
75
+ `Windows: \`netstat -ano | findstr :${port}\`. 중단된 이전 로그인이면 잠시 후 재시도해도 됩니다.`,
76
+ }),
77
+ insufficientScope: (scopes) => ({
78
+ message: `이 도구는 추가 권한이 필요해 (${scopes.join(' 또는 ')}). 현재 로그인에 그 권한이 없어.`,
79
+ hint: '아래 명령으로 로그인하면 기존 권한을 유지하면서 필요한 권한을 추가할 수 있어.',
80
+ }),
81
+ /** MCP 응답에서 재로그인 명령 앞에 붙는 줄. */
82
+ reloginInTerminal: '터미널에서 재로그인:',
83
+ /** OAuth 콜백 성공 시 브라우저에 뜨는 페이지. */
84
+ callbackPage: {
85
+ lang: 'ko',
86
+ title: '✅ Mimi Seed 인증 완료!',
87
+ body: '이 창을 닫고 Claude Code 또는 Codex로 돌아가세요.',
88
+ },
89
+ };
90
+ const en = {
91
+ invalidGrant: {
92
+ message: 'The refresh_token is no longer valid (revoked or expired).',
93
+ hint: 'Log in again with mimi-seed-auth.',
94
+ },
95
+ raptRequired: {
96
+ message: 'A Google Workspace reauthentication policy rejected the token refresh (invalid_rapt).',
97
+ hint: 'Log in again with mimi-seed-auth, or use service-account auth, which the reauth policy does not affect ' +
98
+ '(BigQuery: mimi-seed-bigquery-auth).',
99
+ },
100
+ invalidClient: {
101
+ message: 'The OAuth client_id/secret does not match the one the token was issued to.',
102
+ hint: 'This normally does not happen. If you override MIMI_SEED_GOOGLE_CLIENT_ID/SECRET, ' +
103
+ 'log in again with the same values.',
104
+ },
105
+ unauthorizedClient: {
106
+ message: 'The OAuth client is not allowed this grant_type or scope.',
107
+ hint: 'Grant consent again with mimi-seed-auth.',
108
+ },
109
+ userDenied: {
110
+ message: 'Google consent was denied (access_denied).',
111
+ hint: 'If you did not deny it yourself: this OAuth app is unverified (testing) on Google, so only registered test users can log in. ' +
112
+ 'Ask the operator to add this account under Google Cloud Console → OAuth consent screen → Test users, then retry. ' +
113
+ 'If you denied it, try again and accept every permission.',
114
+ },
115
+ configFetchFailed: {
116
+ message: 'Could not fetch the OAuth client configuration from the Mimi Seed server.',
117
+ hint: 'Check that mimi-seed.pryzm.gg is reachable, or set your own OAuth client with ' +
118
+ 'MIMI_SEED_GOOGLE_CLIENT_ID / MIMI_SEED_GOOGLE_CLIENT_SECRET.',
119
+ },
120
+ networkError: {
121
+ message: 'Cannot reach the Google token endpoint (oauth2.googleapis.com).',
122
+ hint: 'Check your internet connection, proxy, and firewall.',
123
+ },
124
+ portInUse: {
125
+ message: 'OAuth callback port 9876 is already in use.',
126
+ hint: 'Stop the process holding the port, or wait a moment and retry.',
127
+ },
128
+ callbackTimeout: {
129
+ message: 'Did not receive the Google callback in time.',
130
+ hint: 'Consent was not given in the browser, or the browser failed to open. ' +
131
+ 'Use `mimi-seed-auth --no-browser` to get the URL and open it elsewhere.',
132
+ },
133
+ unknown: {
134
+ message: 'An unknown error occurred during authentication.',
135
+ hint: 'Retry; if it keeps failing, log in again with mimi-seed-auth.',
136
+ },
137
+ unauthenticated: {
138
+ message: 'No stored auth token.',
139
+ hint: 'Log in with mimi-seed-auth.',
140
+ },
141
+ tokenFileInvalid: (file, reason) => ({
142
+ message: `The stored auth token file cannot be read: ${file} (${reason}).`,
143
+ hint: 'Log in again with mimi-seed-auth; it rewrites the file.',
144
+ }),
145
+ noRefreshToken: {
146
+ message: 'The stored token has no refresh_token (offline_access was not granted).',
147
+ hint: 'Log in again with mimi-seed-auth; prompt=consent issues a new refresh_token.',
148
+ },
149
+ tokenResponseInvalid: {
150
+ message: 'Google’s response is missing access_token or refresh_token.',
151
+ hint: 'Make sure you accepted every permission on the OAuth consent screen.',
152
+ },
153
+ callbackAddressInUse: (address, port) => ({
154
+ message: `The OAuth callback address ${address} is already in use by another process.`,
155
+ hint: `Login listens on port ${port} on both 127.0.0.1 and ::1 because localhost can resolve to either. ` +
156
+ `Find and stop the process holding it — macOS/Linux: \`lsof -nP -i :${port}\`, ` +
157
+ `Windows: \`netstat -ano | findstr :${port}\` — or wait for an abandoned earlier login to time out, then retry.`,
158
+ }),
159
+ insufficientScope: (scopes) => ({
160
+ message: `This tool needs an additional permission (${scopes.join(' or ')}) that the current login does not have.`,
161
+ hint: 'Log in with the command below to add it while keeping your existing permissions.',
162
+ }),
163
+ reloginInTerminal: 'Log in again from a terminal:',
164
+ callbackPage: {
165
+ lang: 'en',
166
+ title: '✅ Mimi Seed authentication complete!',
167
+ body: 'Close this window and return to Claude Code or Codex.',
168
+ },
169
+ };
170
+ /**
171
+ * 현재 언어의 인증 문구. 호출 시점에 언어를 읽는다(모듈 로드 시점이 아니라) — MIMI_SEED_LANG 이나
172
+ * settings.json 이 바뀌면 다음 에러부터 반영된다.
173
+ */
174
+ export function authText() {
175
+ return resolveLang() === 'en' ? en : ko;
176
+ }
3
177
  export class AuthError extends Error {
4
178
  payload;
5
179
  constructor(payload) {
@@ -15,117 +189,47 @@ export class AuthError extends Error {
15
189
  * googleapis 라이브러리는 e.response?.data?.error 또는 e.message에 코드 포함.
16
190
  */
17
191
  export function classifyError(e, ctx) {
192
+ // 이미 분류된 에러는 그대로 — 다시 분류하면 메시지 텍스트(언어마다 다름)를 정규식으로 재해석하게 되어
193
+ // 원래 code 를 잃는다 (예: 한국어 CALLBACK_PORT_IN_USE 문구는 'already in use' 를 담지 않는다).
194
+ if (e instanceof AuthError)
195
+ return e.payload;
18
196
  const raw = describeError(e);
19
197
  const oauthCode = extractOAuthErrorCode(e, raw);
198
+ const T = authText();
199
+ const make = (code, text, flags) => ({ code, ...text, ...flags, cause: raw });
20
200
  // Google OAuth 표준 에러 코드 매핑
21
201
  if (oauthCode === 'invalid_grant') {
22
- return {
23
- code: 'INVALID_GRANT',
24
- message: 'refresh_token이 더 이상 유효하지 않습니다 (revoke 또는 만료).',
25
- hint: 'mimi-seed-auth 로 재로그인하세요.',
26
- retriable: false,
27
- needsReauth: true,
28
- cause: raw,
29
- };
202
+ return make('INVALID_GRANT', T.invalidGrant, { retriable: false, needsReauth: true });
30
203
  }
31
204
  if (oauthCode === 'invalid_rapt' || oauthCode === 'rapt_required') {
32
- return {
33
- code: 'RAPT_REQUIRED',
34
- message: 'Google Workspace 재인증(reauth) 정책으로 토큰 갱신이 거부되었습니다 (invalid_rapt).',
35
- hint: 'mimi-seed-auth 로 재로그인하거나, 재인증 정책의 영향을 받지 않는 서비스 계정 인증을 사용하세요 ' +
36
- '(BigQuery: mimi-seed-bigquery-auth).',
37
- retriable: false,
38
- needsReauth: true,
39
- cause: raw,
40
- };
205
+ return make('RAPT_REQUIRED', T.raptRequired, { retriable: false, needsReauth: true });
41
206
  }
42
207
  if (oauthCode === 'invalid_client') {
43
- return {
44
- code: 'INVALID_CLIENT',
45
- message: 'OAuth client_id/secret이 토큰 발급 당시와 일치하지 않습니다.',
46
- hint: '일반적으로 발생하지 않음. 환경변수 MIMI_SEED_GOOGLE_CLIENT_ID/SECRET 오버라이드 사용 시 ' +
47
- '동일 값으로 다시 발급받으세요.',
48
- retriable: false,
49
- needsReauth: true,
50
- cause: raw,
51
- };
208
+ return make('INVALID_CLIENT', T.invalidClient, { retriable: false, needsReauth: true });
52
209
  }
53
210
  if (oauthCode === 'unauthorized_client') {
54
- return {
55
- code: 'UNAUTHORIZED_CLIENT',
56
- message: 'OAuth client에 부여되지 않은 grant_type 또는 scope입니다.',
57
- hint: 'mimi-seed-auth 로 새로운 동의를 받으세요.',
58
- retriable: false,
59
- needsReauth: true,
60
- cause: raw,
61
- };
211
+ return make('UNAUTHORIZED_CLIENT', T.unauthorizedClient, { retriable: false, needsReauth: true });
62
212
  }
63
213
  if (oauthCode === 'access_denied') {
64
- return {
65
- code: 'USER_DENIED',
66
- message: 'Google 동의가 거부되었습니다 (access_denied).',
67
- hint: '직접 거부하지 않았다면: 이 OAuth 앱은 Google 미검증(테스트) 상태라 등록된 테스트 사용자만 로그인할 수 있습니다. ' +
68
- '운영자에게 Google Cloud Console → OAuth 동의 화면 → 테스트 사용자에 이 계정 추가를 요청한 뒤 재시도하세요. ' +
69
- '직접 거부했다면 다시 시도해 모든 권한에 동의해주세요.',
70
- retriable: true,
71
- needsReauth: true,
72
- cause: raw,
73
- };
214
+ return make('USER_DENIED', T.userDenied, { retriable: true, needsReauth: true });
74
215
  }
75
216
  // OAuth client 설정 조회 실패 — 구글이 아니라 mimi-seed 웹 콘솔 쪽 문제.
76
217
  // 네트워크 분류보다 먼저 검사해야 "oauth2.googleapis.com 연결 실패" 오진을 막는다.
77
218
  if (/mcp-auth-config/i.test(raw)) {
78
- return {
79
- code: 'CONFIG_FETCH_FAILED',
80
- message: 'Mimi Seed 서버에서 OAuth 클라이언트 설정을 받지 못했습니다.',
81
- hint: 'mimi-seed.pryzm.gg 접속 가능 여부를 확인하거나, ' +
82
- '환경변수 MIMI_SEED_GOOGLE_CLIENT_ID / MIMI_SEED_GOOGLE_CLIENT_SECRET 로 자체 OAuth 클라이언트를 지정하세요.',
83
- retriable: true,
84
- needsReauth: false,
85
- cause: raw,
86
- };
219
+ return make('CONFIG_FETCH_FAILED', T.configFetchFailed, { retriable: true, needsReauth: false });
87
220
  }
88
221
  // 네트워크 / 시스템 레벨
89
222
  if (isNetworkError(e, raw)) {
90
- return {
91
- code: 'REFRESH_NETWORK_ERROR',
92
- message: '구글 토큰 엔드포인트(oauth2.googleapis.com)에 연결할 수 없습니다.',
93
- hint: '인터넷 연결, 프록시, 방화벽을 확인하세요.',
94
- retriable: true,
95
- needsReauth: false,
96
- cause: raw,
97
- };
223
+ return make('REFRESH_NETWORK_ERROR', T.networkError, { retriable: true, needsReauth: false });
98
224
  }
99
225
  if (isPortInUseError(e, raw)) {
100
- return {
101
- code: 'CALLBACK_PORT_IN_USE',
102
- message: 'OAuth 콜백 포트 9876이 이미 사용 중입니다.',
103
- hint: '해당 포트를 점유 중인 프로세스를 종료하거나 잠시 후 다시 시도하세요.',
104
- retriable: true,
105
- needsReauth: false,
106
- cause: raw,
107
- };
226
+ return make('CALLBACK_PORT_IN_USE', T.portInUse, { retriable: true, needsReauth: false });
108
227
  }
109
228
  if (/timeout/i.test(raw) && ctx.phase === 'login') {
110
- return {
111
- code: 'CALLBACK_TIMEOUT',
112
- message: '시간 내 Google 콜백을 받지 못했습니다.',
113
- hint: '브라우저에서 동의 안 하셨거나 자동 열기 실패. ' +
114
- '`mimi-seed-auth --no-browser`로 URL을 직접 받아 다른 환경에서 여세요.',
115
- retriable: true,
116
- needsReauth: false,
117
- cause: raw,
118
- };
229
+ return make('CALLBACK_TIMEOUT', T.callbackTimeout, { retriable: true, needsReauth: false });
119
230
  }
120
231
  // 분류 안 됨
121
- return {
122
- code: ctx.phase === 'refresh' ? 'REFRESH_UNKNOWN' : 'CODE_EXCHANGE_FAILED',
123
- message: '인증 처리 중 알 수 없는 오류가 발생했습니다.',
124
- hint: '재시도 후 동일하면 mimi-seed-auth 로 재로그인하세요.',
125
- retriable: true,
126
- needsReauth: ctx.phase === 'refresh',
127
- cause: raw,
128
- };
232
+ return make(ctx.phase === 'refresh' ? 'REFRESH_UNKNOWN' : 'CODE_EXCHANGE_FAILED', T.unknown, { retriable: true, needsReauth: ctx.phase === 'refresh' });
129
233
  }
130
234
  function describeError(e) {
131
235
  if (e instanceof Error)
@@ -40,6 +40,8 @@ export declare function getStoredCredentials(profile?: string): {
40
40
  clientSecret: string;
41
41
  } | null;
42
42
  export declare function saveCredentials(clientId: string, clientSecret: string): void;
43
+ /** getStoredTokens 가 읽는 파일 — 프로필이면 그 파일, 아니면 tokens.json (없으면 레거시 경로). */
44
+ export declare function googleTokenFilePath(profile?: string): string;
43
45
  export declare function getStoredTokens(profile?: string): StoredTokens | null;
44
46
  /**
45
47
  * tokens.json mtime — 마지막 refresh 시각의 근사값.
@@ -53,7 +55,7 @@ export declare const OAUTH_CALLBACK_PORT = 9876;
53
55
  export declare const OAUTH_REDIRECT_URI = "http://localhost:9876/callback";
54
56
  /** `localhost` 가 풀릴 수 있는 두 루프백 주소 — 외부 인터페이스에는 열지 않는다. */
55
57
  export declare const OAUTH_CALLBACK_HOSTS: readonly ["127.0.0.1", "::1"];
56
- /** 콜백 포트가 한 루프백 주소에서 점유됐을 때의 안내 (한/영). */
58
+ /** 콜백 포트가 한 루프백 주소에서 점유됐을 때의 안내 (현재 언어). */
57
59
  export declare function callbackPortInUse(host: string, err: Error): AuthErrorPayload;
58
60
  export declare function createOAuth2Client(clientId: string, clientSecret: string): import("google-auth-library").OAuth2Client;
59
61
  /**