@cartanova/qgrid-cli 2.10.10 → 2.11.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 (302) hide show
  1. package/bundle/dist/_virtual/_rolldown/runtime.js +1 -10
  2. package/bundle/dist/application/monit/log-buffer.js +12 -6
  3. package/bundle/dist/application/monit/monit.frame.js +11 -3
  4. package/bundle/dist/application/monit/monit.types.js +1 -1
  5. package/bundle/dist/application/qgrid/conv-routing.js +9 -6
  6. package/bundle/dist/application/qgrid/expired-token-reminder.js +2 -2
  7. package/bundle/dist/application/qgrid/oauth.js +31 -4
  8. package/bundle/dist/application/qgrid/qgrid-image-generation.js +1 -1
  9. package/bundle/dist/application/qgrid/qgrid-response-format.js +21 -19
  10. package/bundle/dist/application/qgrid/qgrid-run-lifecycle.js +40 -33
  11. package/bundle/dist/application/qgrid/qgrid.dispatcher.js +128 -93
  12. package/bundle/dist/application/qgrid/qgrid.frame.js +930 -49
  13. package/bundle/dist/application/qgrid/qgrid.types.js +212 -5
  14. package/bundle/dist/application/qgrid/schema-prompt.js +75 -48
  15. package/bundle/dist/application/qgrid/slack-user-map.js +1 -1
  16. package/bundle/dist/application/qgrid/token-death.js +1 -1
  17. package/bundle/dist/application/qgrid/token-subscriber.js +83 -30
  18. package/bundle/dist/application/qgrid/token-trigger-setup.js +1 -1
  19. package/bundle/dist/application/qgrid/token-window-keepalive.js +8 -6
  20. package/bundle/dist/application/qgrid/tool-emulation-schema.js +13 -13
  21. package/bundle/dist/application/qgrid/tool-emulation.js +19 -15
  22. package/bundle/dist/application/request-log/json-schema-type-text.js +29 -12
  23. package/bundle/dist/application/request-log/request-log.model.js +83 -70
  24. package/bundle/dist/application/request-log/request-log.types.js +1 -1
  25. package/bundle/dist/application/request-log/zod-code-format.js +1 -1
  26. package/bundle/dist/application/request-log-step/request-log-step.model.js +1 -1
  27. package/bundle/dist/application/request-log-step/request-log-step.types.js +1 -1
  28. package/bundle/dist/application/setting/setting.constant.js +1 -1
  29. package/bundle/dist/application/setting/setting.model.js +2 -2
  30. package/bundle/dist/application/setting/setting.store.js +2 -2
  31. package/bundle/dist/application/setting/setting.types.js +1 -1
  32. package/bundle/dist/application/sonamu.generated.js +32 -16
  33. package/bundle/dist/application/sonamu.generated.sso.js +1 -1
  34. package/bundle/dist/application/token/token.model.js +26 -9
  35. package/bundle/dist/application/token/token.types.js +20 -3
  36. package/bundle/dist/i18n/en.js +15 -1
  37. package/bundle/dist/i18n/ko.js +15 -1
  38. package/bundle/dist/i18n/sd.generated.js +1 -1
  39. package/bundle/dist/migrations/20260807133553_manual__backfill_request_log_cost.js +8 -6
  40. package/bundle/dist/server-bootstrap.js +4 -2
  41. package/bundle/dist/server-error-handler.js +1 -1
  42. package/bundle/dist/sonamu.config.js +37 -8
  43. package/bundle/dist/startup-migrations.js +17 -7
  44. package/bundle/dist/testing/global.js +1 -1
  45. package/bundle/dist/testing/schema-bench.js +0 -0
  46. package/bundle/dist/testing/test-database-name.js +1 -1
  47. package/bundle/dist/utils/providers/anthropic/anthropic-constants.js +1 -1
  48. package/bundle/dist/utils/providers/anthropic/anthropic-dispatcher.js +11 -5
  49. package/bundle/dist/utils/providers/anthropic/anthropic-quota.js +4 -4
  50. package/bundle/dist/utils/providers/anthropic/anthropic-thinking.js +1 -1
  51. package/bundle/dist/utils/providers/anthropic/claude-session.js +20 -19
  52. package/bundle/dist/utils/providers/anthropic/fence-strip.js +1 -1
  53. package/bundle/dist/utils/providers/anthropic/stream-json-adapter.js +49 -23
  54. package/bundle/dist/utils/providers/common/credentials.js +5 -1
  55. package/bundle/dist/utils/providers/common/effort.js +3 -3
  56. package/bundle/dist/utils/providers/common/model-cost.js +69 -14
  57. package/bundle/dist/utils/providers/common/provider-types.js +29 -1
  58. package/bundle/dist/utils/providers/common/schema-validation.js +78 -40
  59. package/bundle/dist/utils/providers/common/smooth-weighted-round-robin.js +1 -1
  60. package/bundle/dist/utils/providers/common/strictifier.js +62 -43
  61. package/bundle/dist/utils/providers/common/thinking.js +3 -2
  62. package/bundle/dist/utils/providers/common/ttft.js +1 -1
  63. package/bundle/dist/utils/providers/grok/grok-backend-protocol.js +427 -0
  64. package/bundle/dist/utils/providers/grok/grok-constants.js +55 -0
  65. package/bundle/dist/utils/providers/grok/grok-direct-client.js +196 -0
  66. package/bundle/dist/utils/providers/grok/grok-dispatcher.js +1313 -0
  67. package/bundle/dist/utils/providers/grok/grok-headers.js +118 -0
  68. package/bundle/dist/utils/providers/grok/grok-media-client.js +420 -0
  69. package/bundle/dist/utils/providers/grok/grok-models.js +114 -0
  70. package/bundle/dist/utils/providers/grok/grok-oauth.js +455 -0
  71. package/bundle/dist/utils/providers/grok/grok-quota.js +119 -0
  72. package/bundle/dist/utils/providers/grok/grok-refresh.js +192 -0
  73. package/bundle/dist/utils/providers/grok/grok-types.js +186 -0
  74. package/bundle/dist/utils/providers/grok/grok-voice-client.js +199 -0
  75. package/bundle/dist/utils/providers/grok/index.js +11 -0
  76. package/bundle/dist/utils/providers/openai/openai-backend-protocol.js +111 -83
  77. package/bundle/dist/utils/providers/openai/openai-callback-relay.js +3 -2
  78. package/bundle/dist/utils/providers/openai/openai-constants.js +1 -1
  79. package/bundle/dist/utils/providers/openai/openai-direct-client.js +23 -7
  80. package/bundle/dist/utils/providers/openai/openai-dispatcher.js +143 -106
  81. package/bundle/dist/utils/providers/openai/openai-image-generation.js +48 -33
  82. package/bundle/dist/utils/providers/openai/openai-oauth.js +28 -13
  83. package/bundle/dist/utils/providers/openai/openai-quota.js +38 -27
  84. package/bundle/dist/utils/providers/openai/openai-refresh.js +17 -9
  85. package/bundle/dist/utils/providers/openai/openai-sse.js +1 -1
  86. package/bundle/dist/utils/providers/openai/openai-transport-config.js +1 -1
  87. package/bundle/dist/utils/quiet-hours.js +1 -1
  88. package/bundle/dist/utils/slack-notify.js +14 -8
  89. package/bundle/dist/utils/subset-loaders.js +4 -5
  90. package/bundle/src/application/monit/log-buffer.ts +23 -9
  91. package/bundle/src/application/monit/monit.frame.ts +22 -5
  92. package/bundle/src/application/monit/monit.types.ts +6 -0
  93. package/bundle/src/application/qgrid/conv-routing.test.ts +76 -4
  94. package/bundle/src/application/qgrid/conv-routing.ts +35 -9
  95. package/bundle/src/application/qgrid/expired-token-reminder.ts +9 -1
  96. package/bundle/src/application/qgrid/oauth.ts +51 -15
  97. package/bundle/src/application/qgrid/qgrid-image-generation.ts +9 -0
  98. package/bundle/src/application/qgrid/qgrid-response-format.ts +50 -25
  99. package/bundle/src/application/qgrid/qgrid-run-lifecycle.test.ts +19 -0
  100. package/bundle/src/application/qgrid/qgrid-run-lifecycle.ts +84 -40
  101. package/bundle/src/application/qgrid/qgrid.dispatcher.test.ts +97 -0
  102. package/bundle/src/application/qgrid/qgrid.dispatcher.ts +274 -126
  103. package/bundle/src/application/qgrid/qgrid.frame.test.ts +1013 -3
  104. package/bundle/src/application/qgrid/qgrid.frame.ts +1415 -60
  105. package/bundle/src/application/qgrid/qgrid.types.ts +335 -0
  106. package/bundle/src/application/qgrid/schema-prompt.ts +105 -41
  107. package/bundle/src/application/qgrid/slack-user-map.ts +5 -0
  108. package/bundle/src/application/qgrid/token-death.ts +4 -0
  109. package/bundle/src/application/qgrid/token-subscriber.test.ts +21 -19
  110. package/bundle/src/application/qgrid/token-subscriber.ts +186 -53
  111. package/bundle/src/application/qgrid/token-trigger-setup.ts +2 -0
  112. package/bundle/src/application/qgrid/token-window-keepalive.ts +49 -6
  113. package/bundle/src/application/qgrid/tool-emulation-schema.ts +33 -29
  114. package/bundle/src/application/qgrid/tool-emulation.ts +52 -27
  115. package/bundle/src/application/request-log/json-schema-type-text.test.ts +5 -5
  116. package/bundle/src/application/request-log/json-schema-type-text.ts +81 -26
  117. package/bundle/src/application/request-log/request-log.model.test.ts +111 -4
  118. package/bundle/src/application/request-log/request-log.model.ts +277 -146
  119. package/bundle/src/application/request-log/request-log.types.ts +6 -0
  120. package/bundle/src/application/request-log/zod-code-format.ts +11 -0
  121. package/bundle/src/application/request-log-step/request-log-step.model.ts +1 -0
  122. package/bundle/src/application/request-log-step/request-log-step.types.ts +2 -0
  123. package/bundle/src/application/setting/setting.constant.ts +9 -0
  124. package/bundle/src/application/setting/setting.model.ts +12 -2
  125. package/bundle/src/application/setting/setting.store.ts +5 -1
  126. package/bundle/src/application/setting/setting.types.ts +8 -0
  127. package/bundle/src/application/sonamu.generated.http +133 -0
  128. package/bundle/src/application/sonamu.generated.sso.ts +2 -0
  129. package/bundle/src/application/sonamu.generated.ts +15 -0
  130. package/bundle/src/application/token/token.identity.test.ts +20 -0
  131. package/bundle/src/application/token/token.model.ts +66 -7
  132. package/bundle/src/application/token/token.types.ts +24 -1
  133. package/bundle/src/i18n/en.ts +19 -0
  134. package/bundle/src/i18n/ko.ts +21 -0
  135. package/bundle/src/i18n/sd.generated.ts +23 -2
  136. package/bundle/src/migrations/20260807133553_manual__backfill_request_log_cost.ts +16 -8
  137. package/bundle/src/server-bootstrap.ts +4 -2
  138. package/bundle/src/server-error-handler.ts +1 -0
  139. package/bundle/src/sonamu.config.ts +69 -7
  140. package/bundle/src/startup-migrations.ts +27 -9
  141. package/bundle/src/testing/global.ts +20 -0
  142. package/bundle/src/testing/schema-bench.ts +105 -30
  143. package/bundle/src/testing/test-database-name.ts +2 -0
  144. package/bundle/src/utils/providers/anthropic/anthropic-constants.ts +8 -0
  145. package/bundle/src/utils/providers/anthropic/anthropic-dispatcher.ts +41 -6
  146. package/bundle/src/utils/providers/anthropic/anthropic-quota.ts +7 -3
  147. package/bundle/src/utils/providers/anthropic/anthropic-thinking.ts +6 -0
  148. package/bundle/src/utils/providers/anthropic/claude-session.ts +58 -24
  149. package/bundle/src/utils/providers/anthropic/fence-strip.ts +11 -0
  150. package/bundle/src/utils/providers/anthropic/stream-json-adapter.ts +110 -45
  151. package/bundle/src/utils/providers/common/credentials.ts +8 -0
  152. package/bundle/src/utils/providers/common/effort.ts +9 -2
  153. package/bundle/src/utils/providers/common/model-cost.test.ts +48 -1
  154. package/bundle/src/utils/providers/common/model-cost.ts +259 -158
  155. package/bundle/src/utils/providers/common/provider-dispatcher.ts +98 -2
  156. package/bundle/src/utils/providers/common/provider-types.ts +46 -3
  157. package/bundle/src/utils/providers/common/schema-validation.test.ts +5 -1
  158. package/bundle/src/utils/providers/common/schema-validation.ts +124 -56
  159. package/bundle/src/utils/providers/common/smooth-weighted-round-robin.ts +4 -0
  160. package/bundle/src/utils/providers/common/strictifier.ts +185 -59
  161. package/bundle/src/utils/providers/common/thinking.ts +2 -2
  162. package/bundle/src/utils/providers/common/ttft.ts +4 -2
  163. package/bundle/src/utils/providers/grok/__fixtures__/golden-responses-1.0.60.json +164 -0
  164. package/bundle/src/utils/providers/grok/grok-backend-protocol.test.ts +325 -0
  165. package/bundle/src/utils/providers/grok/grok-backend-protocol.ts +721 -0
  166. package/bundle/src/utils/providers/grok/grok-constants.ts +105 -0
  167. package/bundle/src/utils/providers/grok/grok-direct-client.test.ts +179 -0
  168. package/bundle/src/utils/providers/grok/grok-direct-client.ts +313 -0
  169. package/bundle/src/utils/providers/grok/grok-dispatcher.test.ts +1395 -0
  170. package/bundle/src/utils/providers/grok/grok-dispatcher.ts +2105 -0
  171. package/bundle/src/utils/providers/grok/grok-headers.test.ts +149 -0
  172. package/bundle/src/utils/providers/grok/grok-headers.ts +199 -0
  173. package/bundle/src/utils/providers/grok/grok-media-client.test.ts +446 -0
  174. package/bundle/src/utils/providers/grok/grok-media-client.ts +703 -0
  175. package/bundle/src/utils/providers/grok/grok-models.test.ts +96 -0
  176. package/bundle/src/utils/providers/grok/grok-models.ts +161 -0
  177. package/bundle/src/utils/providers/grok/grok-oauth.test.ts +406 -0
  178. package/bundle/src/utils/providers/grok/grok-oauth.ts +771 -0
  179. package/bundle/src/utils/providers/grok/grok-quota.test.ts +142 -0
  180. package/bundle/src/utils/providers/grok/grok-quota.ts +198 -0
  181. package/bundle/src/utils/providers/grok/grok-refresh.test.ts +239 -0
  182. package/bundle/src/utils/providers/grok/grok-refresh.ts +325 -0
  183. package/bundle/src/utils/providers/grok/grok-types.test.ts +252 -0
  184. package/bundle/src/utils/providers/grok/grok-types.ts +374 -0
  185. package/bundle/src/utils/providers/grok/grok-voice-client.test.ts +321 -0
  186. package/bundle/src/utils/providers/grok/grok-voice-client.ts +284 -0
  187. package/bundle/src/utils/providers/grok/index.ts +20 -0
  188. package/bundle/src/utils/providers/openai/openai-backend-protocol.ts +221 -137
  189. package/bundle/src/utils/providers/openai/openai-callback-relay.ts +12 -1
  190. package/bundle/src/utils/providers/openai/openai-constants.ts +2 -0
  191. package/bundle/src/utils/providers/openai/openai-direct-client.ts +111 -21
  192. package/bundle/src/utils/providers/openai/openai-dispatcher.ts +322 -169
  193. package/bundle/src/utils/providers/openai/openai-image-generation.ts +116 -36
  194. package/bundle/src/utils/providers/openai/openai-oauth.ts +48 -20
  195. package/bundle/src/utils/providers/openai/openai-quota.ts +77 -46
  196. package/bundle/src/utils/providers/openai/openai-refresh.ts +42 -18
  197. package/bundle/src/utils/providers/openai/openai-sse.ts +27 -3
  198. package/bundle/src/utils/providers/openai/openai-transport-config.ts +2 -0
  199. package/bundle/src/utils/quiet-hours.ts +12 -1
  200. package/bundle/src/utils/slack-notify.ts +44 -13
  201. package/bundle/src/utils/subset-loaders.ts +7 -7
  202. package/bundle/web-dist/client/assets/clsx-5XM_pHvN.js +1 -0
  203. package/bundle/web-dist/client/assets/index-Be2qCZmI.css +1 -0
  204. package/bundle/web-dist/client/assets/index-C96h3feE.js +32 -0
  205. package/bundle/web-dist/client/assets/logs-DBM6U0QD.js +1 -0
  206. package/bundle/web-dist/client/assets/monit-BBjXa7vB.js +1 -0
  207. package/bundle/web-dist/client/assets/routes-Crz_PQzi.js +5 -0
  208. package/bundle/web-dist/client/assets/{services.generated-NP-ValHd.js → services.generated-B5lc3aIC.js} +5 -5
  209. package/bundle/web-dist/client/assets/settings-Cdwm3OBB.js +1 -0
  210. package/bundle/web-dist/client/assets/show-DBUhALT1.js +2 -0
  211. package/bundle/web-dist/client/assets/tokens-CVQAVJTo.js +1 -0
  212. package/bundle/web-dist/client/assets/total-cost-MnfKU8IN.js +1 -0
  213. package/bundle/web-dist/client/assets/use-oauth-login-flow-BfxYI4Oh.js +1 -0
  214. package/bundle/web-dist/client/assets/use-update-token-mutation-qKBC2sn7.js +1 -0
  215. package/bundle/web-dist/client/assets/{vendor-tanstack-DJRQAbrY.js → vendor-tanstack-DRPs09ai.js} +1 -1
  216. package/bundle/web-dist/client/index.html +5 -5
  217. package/bundle/web-dist/server/assets/clsx-D_N5PN_2.js +16 -0
  218. package/bundle/web-dist/server/assets/{lazyRouteComponent-CgBdabgd.js → lazyRouteComponent-AKiHfZWp.js} +129 -2
  219. package/bundle/web-dist/server/assets/{logs-BMyR98rU.js → logs-B7QmGJq3.js} +18 -14
  220. package/bundle/web-dist/server/assets/{monit-ZPt66W5M.js → monit-DFt7x3bh.js} +13 -12
  221. package/bundle/web-dist/server/assets/{plus-BZ9I0VgC.js → plus-DaYQRpBt.js} +1 -1
  222. package/bundle/web-dist/server/assets/{react-dom-Ds75e4Jl.js → react-dom-Cv23mm1K.js} +2 -129
  223. package/bundle/web-dist/server/assets/{refresh-cw-CztCFis-.js → refresh-cw-BpXNsAy-.js} +1 -1
  224. package/bundle/web-dist/server/assets/{request-model-DjGldb-h.js → request-model-eHE6YbaF.js} +1 -1
  225. package/bundle/web-dist/server/assets/{routes-Ct-k7nBA.js → routes-_Y-PJfgO.js} +110 -39
  226. package/bundle/web-dist/server/assets/{services.generated-BA4AcAf5.js → services.generated-CMJ8AHbO.js} +582 -172
  227. package/bundle/web-dist/server/assets/{settings-CBUZ47Xx.js → settings-JwJKxn2e.js} +14 -14
  228. package/bundle/web-dist/server/assets/{show-LSFIzvO2.js → show-BEv6z1v_.js} +90 -60
  229. package/bundle/web-dist/server/assets/{tokens-DxrBW512.js → tokens-CNT4mI-f.js} +162 -50
  230. package/bundle/web-dist/server/assets/total-cost-fTE9Xy82.js +18 -0
  231. package/bundle/web-dist/server/assets/use-oauth-login-flow-jkAkT3X6.js +2345 -0
  232. package/bundle/web-dist/server/assets/{use-update-token-mutation-pkArIzCP.js → use-update-token-mutation-Sm6kh02m.js} +1 -1
  233. package/bundle/web-dist/server/entry-server.generated.js +1644 -21655
  234. package/dist/cli.js +9 -9
  235. package/package.json +4 -11
  236. package/postinstall.mjs +12 -0
  237. package/skills/qgrid/SKILL.md +1 -0
  238. package/skills/qgrid/references/cli-env-and-server-boot.md +4 -1
  239. package/skills/qgrid/references/decision-rationale.md +23 -0
  240. package/skills/qgrid/references/grok-runtime.md +89 -0
  241. package/skills/qgrid/references/provider-runtime-differences.md +30 -29
  242. package/skills/qgrid/references/repo-map.md +10 -0
  243. package/skills/qgrid/references/token-auth-quota-lifecycle.md +56 -3
  244. package/bundle/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +0 -406
  245. package/bundle/dist/node_modules/.pnpm/@vitest_expect@4.1.10/node_modules/@vitest/expect/dist/index.js +0 -1507
  246. package/bundle/dist/node_modules/.pnpm/@vitest_pretty-format@4.1.10/node_modules/@vitest/pretty-format/dist/index.js +0 -887
  247. package/bundle/dist/node_modules/.pnpm/@vitest_runner@4.1.10/node_modules/@vitest/runner/dist/chunk-artifact.js +0 -2756
  248. package/bundle/dist/node_modules/.pnpm/@vitest_runner@4.1.10/node_modules/@vitest/runner/dist/index.js +0 -8
  249. package/bundle/dist/node_modules/.pnpm/@vitest_runner@4.1.10/node_modules/@vitest/runner/dist/utils.js +0 -8
  250. package/bundle/dist/node_modules/.pnpm/@vitest_snapshot@4.1.10/node_modules/@vitest/snapshot/dist/index.js +0 -922
  251. package/bundle/dist/node_modules/.pnpm/@vitest_spy@4.1.10/node_modules/@vitest/spy/dist/index.js +0 -386
  252. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js +0 -121
  253. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/constants.js +0 -51
  254. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/diff.js +0 -1317
  255. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/display.js +0 -561
  256. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/error.js +0 -40
  257. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/helpers.js +0 -272
  258. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/offset.js +0 -27
  259. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/serialize.js +0 -77
  260. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/source-map.js +0 -381
  261. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/timers.js +0 -51
  262. package/bundle/dist/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.js +0 -2986
  263. package/bundle/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/branding.js +0 -10
  264. package/bundle/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/index.js +0 -109
  265. package/bundle/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/messages.js +0 -10
  266. package/bundle/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/overloads.js +0 -10
  267. package/bundle/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/utils.js +0 -10
  268. package/bundle/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.js +0 -1126
  269. package/bundle/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.js +0 -21
  270. package/bundle/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +0 -432
  271. package/bundle/dist/node_modules/.pnpm/tinybench@2.9.0/node_modules/tinybench/dist/index.js +0 -517
  272. package/bundle/dist/node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.js +0 -101
  273. package/bundle/dist/node_modules/.pnpm/vite@8.0.3_@emnapi_core@1.11.2_@emnapi_runtime@1.11.2_@types_node@25.0.7_esbuild@0.27.4_5b35fc1fb85d2af4d105e0d74f940f50/node_modules/vite/dist/node/module-runner.js +0 -1265
  274. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +0 -9
  275. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/benchmark.CX_oY03V.js +0 -41
  276. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/evaluatedModules.Dg1zASAC.js +0 -19
  277. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/index.Chj8NDwU.js +0 -202
  278. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/index.DdgEv5B1.js +0 -46
  279. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/rpc.MzXet3jl.js +0 -119
  280. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/test.DNmyFkvJ.js +0 -3044
  281. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js +0 -59
  282. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/index.js +0 -28
  283. package/bundle/dist/testing/setup-mocks.js +0 -16
  284. package/bundle/src/testing/setup-mocks.ts +0 -44
  285. package/bundle/web-dist/client/assets/index-Bw2s88Ot.css +0 -1
  286. package/bundle/web-dist/client/assets/index-DZwzUfI-.js +0 -106
  287. package/bundle/web-dist/client/assets/logs-Cog79DU5.js +0 -1
  288. package/bundle/web-dist/client/assets/monit-2auznBys.js +0 -1
  289. package/bundle/web-dist/client/assets/routes-B0lTeLK-.js +0 -5
  290. package/bundle/web-dist/client/assets/settings-D8ZxZGSJ.js +0 -1
  291. package/bundle/web-dist/client/assets/show-CFSERlnM.js +0 -2
  292. package/bundle/web-dist/client/assets/tokens-CZXUyI7O.js +0 -1
  293. package/bundle/web-dist/client/assets/use-oauth-login-flow-hboOs3wG.js +0 -1
  294. package/bundle/web-dist/client/assets/use-update-token-mutation-BQHS0byG.js +0 -1
  295. package/bundle/web-dist/server/assets/use-oauth-login-flow-Gn8flMK5.js +0 -178
  296. package/dist/cli.d.ts +0 -10
  297. /package/bundle/web-dist/client/assets/{cost-DH2jZbrw.js → cost-DB3HbU7T.js} +0 -0
  298. /package/bundle/web-dist/client/assets/{plus-B62CuqT8.js → plus-BsQdY7PS.js} +0 -0
  299. /package/bundle/web-dist/client/assets/{preload-helper-ca-nBW7U.js → preload-helper-DWTEM3RW.js} +0 -0
  300. /package/bundle/web-dist/client/assets/{refresh-cw-NNcU0Cmq.js → refresh-cw-D9IUmT23.js} +0 -0
  301. /package/bundle/web-dist/client/assets/{request-model-CojtinqK.js → request-model-Bpp_rkK8.js} +0 -0
  302. /package/bundle/web-dist/server/assets/{cost-eEHeTRT5.js → cost-BC9yzyA9.js} +0 -0
@@ -14,6 +14,7 @@ export const HistoryItems = z.array(
14
14
  output: z.string().optional(),
15
15
  }),
16
16
  );
17
+
17
18
  export type HistoryItems = z.infer<typeof HistoryItems>;
18
19
 
19
20
  // 현재 user turn의 입력 이미지. image_generation tool_args.inputImages와 같은 형태다.
@@ -25,10 +26,12 @@ export const InputImages = z.array(
25
26
  byteSize: z.number().optional(),
26
27
  }),
27
28
  );
29
+
28
30
  export type InputImages = z.infer<typeof InputImages>;
29
31
 
30
32
  // 요청에 장착된 tool 정의 목록 — 저장 형태는 QgridTool 계약을 그대로 따른다.
31
33
  export const ToolDefinitions = z.array(QgridTool);
34
+
32
35
  export type ToolDefinitions = z.infer<typeof ToolDefinitions>;
33
36
 
34
37
  // request-log detail 화면이 소비하는 tool 계약 projection. API 반환 타입은 Sonamu
@@ -40,6 +43,7 @@ export const ToolView = z.object({
40
43
  inputZod: z.string(),
41
44
  fullInputZod: z.string().optional(),
42
45
  });
46
+
43
47
  export type ToolView = z.infer<typeof ToolView>;
44
48
 
45
49
  // RequestLog - ListParams
@@ -48,6 +52,7 @@ export const RequestLogListParams = RequestLogBaseListParams.extend({
48
52
  project_name_is_null: z.boolean().optional(),
49
53
  project_name_is_not_null: z.boolean().optional(),
50
54
  });
55
+
51
56
  export type RequestLogListParams = z.infer<typeof RequestLogListParams>;
52
57
 
53
58
  // RequestLog - SaveParams
@@ -58,4 +63,5 @@ export const RequestLogSaveParams = RequestLogBaseSchema.partial({
58
63
  status: true,
59
64
  error_message: true,
60
65
  });
66
+
61
67
  export type RequestLogSaveParams = z.infer<typeof RequestLogSaveParams>;
@@ -30,44 +30,55 @@ export function formatZodCode(code: string): string {
30
30
  for (const ch of source) {
31
31
  if (inString) {
32
32
  out += ch;
33
+
33
34
  if (escaped) escaped = false;
34
35
  else if (ch === "\\") escaped = true;
35
36
  else if (ch === '"') inString = false;
36
37
  continue;
37
38
  }
39
+
38
40
  if (ch === '"') {
39
41
  inString = true;
40
42
  out += ch;
41
43
  skipSpaces = false;
42
44
  continue;
43
45
  }
46
+
44
47
  if (skipSpaces && (ch === " " || ch === "\t")) continue;
45
48
  skipSpaces = false;
46
49
 
47
50
  if (ch === "{" || ch === "(" || ch === "[") {
48
51
  stack.push(ch);
49
52
  out += ch;
53
+
50
54
  if (ch === "{") {
51
55
  depth++;
52
56
  newline();
53
57
  }
58
+
54
59
  continue;
55
60
  }
61
+
56
62
  if (ch === "}" || ch === ")" || ch === "]") {
57
63
  const opener = stack.pop();
64
+
58
65
  if (ch === "}" && opener === "{") {
59
66
  depth = Math.max(0, depth - 1);
60
67
  newline();
61
68
  }
69
+
62
70
  out += ch;
63
71
  continue;
64
72
  }
73
+
65
74
  if (ch === "," && stack.at(-1) === "{") {
66
75
  out += ch;
67
76
  newline();
68
77
  continue;
69
78
  }
79
+
70
80
  out += ch;
71
81
  }
82
+
72
83
  return out;
73
84
  }
@@ -43,6 +43,7 @@ class RequestLogStepModelClass extends BaseModelClass<
43
43
  page: 1,
44
44
  queryMode: "list",
45
45
  });
46
+
46
47
  if (!rows[0]) {
47
48
  throw new NotFoundException(SD("error.entityNotFound")("RequestLogStep", id));
48
49
  }
@@ -4,6 +4,7 @@ import { RequestLogStepBaseSchema, RequestLogStepBaseListParams } from "../sonam
4
4
 
5
5
  // RequestLogStep - ListParams
6
6
  export const RequestLogStepListParams = RequestLogStepBaseListParams;
7
+
7
8
  export type RequestLogStepListParams = z.infer<typeof RequestLogStepListParams>;
8
9
 
9
10
  // RequestLogStep - SaveParams
@@ -34,4 +35,5 @@ export const RequestLogStepSaveParams = RequestLogStepBaseSchema.partial({
34
35
  tool_duration_ms: true,
35
36
  error: true,
36
37
  });
38
+
37
39
  export type RequestLogStepSaveParams = z.infer<typeof RequestLogStepSaveParams>;
@@ -166,6 +166,7 @@ export function validateSettingValue(
166
166
 
167
167
  if (def.kind === "boolean") {
168
168
  if (!["true", "false"].includes(trimmed)) return { ok: false, error: "true 또는 false" };
169
+
169
170
  return { ok: true, value: trimmed };
170
171
  }
171
172
 
@@ -173,24 +174,31 @@ export function validateSettingValue(
173
174
  // 화면은 버튼만 주지만 API 는 아무 값이나 받을 수 있다. 목록 밖의 값이 들어오면
174
175
  // 화면에서 아무 버튼도 선택돼 보이지 않아 "왜 안 바뀌지"가 된다.
175
176
  const parsed = Number(trimmed);
177
+
176
178
  if (!def.presets?.includes(parsed)) {
177
179
  return { ok: false, error: `${def.presets?.join(", ") ?? ""} 중 하나여야 합니다` };
178
180
  }
181
+
179
182
  return { ok: true, value: String(parsed) };
180
183
  }
181
184
 
182
185
  if (def.kind === "integer" || def.kind === "number") {
183
186
  const parsed = Number(trimmed);
187
+
184
188
  if (!Number.isFinite(parsed)) return { ok: false, error: "숫자를 입력하세요" };
189
+
185
190
  if (def.kind === "integer" && !Number.isInteger(parsed)) {
186
191
  return { ok: false, error: "정수를 입력하세요" };
187
192
  }
193
+
188
194
  if (def.min !== undefined && parsed < def.min) {
189
195
  return { ok: false, error: `${def.min} 이상이어야 합니다` };
190
196
  }
197
+
191
198
  if (def.max !== undefined && parsed > def.max) {
192
199
  return { ok: false, error: `${def.max} 이하여야 합니다` };
193
200
  }
201
+
194
202
  return { ok: true, value: String(parsed) };
195
203
  }
196
204
 
@@ -200,5 +208,6 @@ export function validateSettingValue(
200
208
  /** 화면에 그대로 내려보내면 안 되는 값. 앞뒤만 남긴다. */
201
209
  export function maskSecret(value: string): string {
202
210
  if (value.length <= 12) return "***";
211
+
203
212
  return `${value.slice(0, 8)}...${value.slice(-4)}`;
204
213
  }
@@ -8,7 +8,7 @@ import {
8
8
  exhaustive,
9
9
  } from "sonamu";
10
10
 
11
- import { SD, type LocalizedString } from "../../i18n/sd.generated";
11
+ import { SD } from "../../i18n/sd.generated";
12
12
  import { SlackNotificationError } from "../../utils/slack-notify";
13
13
  import { type SettingSubsetKey, type SettingSubsetMapping } from "../sonamu.generated";
14
14
  import { settingSubsetQueries, settingLoaderQueries } from "../sonamu.generated.sso";
@@ -58,6 +58,7 @@ class SettingModelClass extends BaseModelClass<
58
58
  page: 1,
59
59
  queryMode: "list",
60
60
  });
61
+
61
62
  if (!rows[0]) {
62
63
  throw new NotFoundException(SD("error.entityNotFound")("Setting", id));
63
64
  }
@@ -162,6 +163,7 @@ class SettingModelClass extends BaseModelClass<
162
163
  /** 저장된 설정 전체를 key→value 로. 부팅 시 한 번 읽어 메모리에 올린다. */
163
164
  async findAllAsMap(): Promise<Map<string, string>> {
164
165
  const { rows } = await this.findMany("A", { num: 0, page: 1, queryMode: "list" });
166
+
165
167
  return new Map(rows.map((r) => [r.key, r.value]));
166
168
  }
167
169
 
@@ -219,6 +221,7 @@ class SettingModelClass extends BaseModelClass<
219
221
  runtimeInfo(): RuntimeInfoItem[] {
220
222
  const env = process.env;
221
223
  const password = env.QGRID_DB_PASSWORD ?? env.SONAMU_DB_PASSWORD ?? "";
224
+
222
225
  return [
223
226
  { label: "NODE_ENV", value: env.NODE_ENV ?? "-" },
224
227
  { label: "HOST", value: env.HOST ?? "localhost" },
@@ -234,14 +237,17 @@ class SettingModelClass extends BaseModelClass<
234
237
  @api({ httpMethod: "POST", clients: ["axios", "tanstack-mutation"] })
235
238
  async updateSetting(key: string, value: string): Promise<{ applies: SettingApplies }> {
236
239
  const def = findSettingDef(key);
240
+
237
241
  if (!def) throw new BadRequestException(SD("setting.unknownKey")(key));
238
242
 
239
243
  const validation = validateSettingValue(def, value);
244
+
240
245
  if (!validation.ok) {
241
246
  throw new BadRequestException(SD("setting.invalidValue")(validation.error));
242
247
  }
243
248
 
244
249
  await saveStoredSetting(key, validation.value);
250
+
245
251
  return { applies: def.applies };
246
252
  }
247
253
 
@@ -249,9 +255,11 @@ class SettingModelClass extends BaseModelClass<
249
255
  @api({ httpMethod: "POST", clients: ["axios", "tanstack-mutation"] })
250
256
  async resetSetting(key: string): Promise<{ applies: SettingApplies }> {
251
257
  const def = findSettingDef(key);
258
+
252
259
  if (!def) throw new BadRequestException(SD("setting.unknownKey")(key));
253
260
 
254
261
  await resetStoredSetting(key);
262
+
255
263
  return { applies: def.applies };
256
264
  }
257
265
 
@@ -265,12 +273,14 @@ class SettingModelClass extends BaseModelClass<
265
273
  // setting.model → expired-token-reminder → token.model 경로가 생겨,
266
274
  // token.model 을 mock 하는 테스트가 실제 모듈을 먼저 로드하게 된다.
267
275
  const { sendExpiredTokenReminderNow } = await import("../qgrid/expired-token-reminder");
276
+
268
277
  try {
269
278
  return { sent: await sendExpiredTokenReminderNow() };
270
279
  } catch (error) {
271
280
  if (error instanceof SlackNotificationError) {
272
- throw new BadRequestException(error.message as LocalizedString);
281
+ throw new BadRequestException(SD("error.detail")(error.message));
273
282
  }
283
+
274
284
  throw error;
275
285
  }
276
286
  }
@@ -18,10 +18,12 @@ const logger = getLogger(["qgrid", "setting"]);
18
18
  let cache: Map<string, string> | null = null;
19
19
 
20
20
  type SettingChangeHandler = (key: string) => void;
21
+
21
22
  export type SettingPersistence = Pick<
22
23
  typeof SettingModel,
23
24
  "clearByKey" | "findAllAsMap" | "setByKey"
24
25
  >;
26
+
25
27
  let settingChangeHandler: SettingChangeHandler | null = null;
26
28
 
27
29
  /**
@@ -48,7 +50,9 @@ export async function loadSettings(persistence: SettingPersistence = SettingMode
48
50
  } catch (e) {
49
51
  // 테이블이 아직 없는 배포(마이그레이션 전)에서도 서버는 떠야 한다.
50
52
  cache = new Map();
51
- logger.warn(`settings load failed, using env only: ${(e as Error).message}`);
53
+ logger.warn(
54
+ `settings load failed, using env only: ${e instanceof Error ? e.message : String(e)}`,
55
+ );
52
56
  }
53
57
  }
54
58
 
@@ -4,21 +4,26 @@ import { SettingBaseSchema, SettingBaseListParams } from "../sonamu.generated";
4
4
 
5
5
  // Setting - ListParams
6
6
  export const SettingListParams = SettingBaseListParams;
7
+
7
8
  export type SettingListParams = z.infer<typeof SettingListParams>;
8
9
 
9
10
  // Setting - SaveParams
10
11
  export const SettingSaveParams = SettingBaseSchema.partial({ id: true, created_at: true });
12
+
11
13
  export type SettingSaveParams = z.infer<typeof SettingSaveParams>;
12
14
 
13
15
  // ── 설정 API 응답 스키마 ──
14
16
 
15
17
  export const SettingKind = z.enum(["boolean", "integer", "number", "string", "secret", "preset"]);
18
+
16
19
  export type SettingKind = z.infer<typeof SettingKind>;
17
20
 
18
21
  export const SettingApplies = z.enum(["immediate", "restart"]);
22
+
19
23
  export type SettingApplies = z.infer<typeof SettingApplies>;
20
24
 
21
25
  export const SettingSource = z.enum(["db", "env", "default"]);
26
+
22
27
  export type SettingSource = z.infer<typeof SettingSource>;
23
28
 
24
29
  export const SettingItem = z.object({
@@ -37,6 +42,7 @@ export const SettingItem = z.object({
37
42
  presets: z.number().array(),
38
43
  help: z.string().nullable(),
39
44
  });
45
+
40
46
  export type SettingItem = z.infer<typeof SettingItem>;
41
47
 
42
48
  /** 화면에서 바꿀 수 없는 기동 시점 값들 — 어떤 환경에 붙어 있는지 확인용. */
@@ -44,6 +50,7 @@ export const RuntimeInfoItem = z.object({
44
50
  label: z.string(),
45
51
  value: z.string(),
46
52
  });
53
+
47
54
  export type RuntimeInfoItem = z.infer<typeof RuntimeInfoItem>;
48
55
 
49
56
  export const SettingsResponse = z.object({
@@ -52,4 +59,5 @@ export const SettingsResponse = z.object({
52
59
  /** 이 인스턴스가 keepalive 스케줄러를 소유하도록 명시적으로 허용됐는지. */
53
60
  keepaliveRunnerEnabled: z.boolean(),
54
61
  });
62
+
55
63
  export type SettingsResponse = z.infer<typeof SettingsResponse>;
@@ -325,6 +325,12 @@ Content-Type: application/json
325
325
  "size": "auto",
326
326
  "background": "auto",
327
327
  "outputFormat": "png"
328
+ },
329
+ "providerOptions": {
330
+ "xai": {
331
+ "serviceTier": "default",
332
+ "parallelToolCalls": false
333
+ }
328
334
  }
329
335
  }
330
336
  }
@@ -390,6 +396,12 @@ Content-Type: application/json
390
396
  "size": "auto",
391
397
  "background": "auto",
392
398
  "outputFormat": "png"
399
+ },
400
+ "providerOptions": {
401
+ "xai": {
402
+ "serviceTier": "default",
403
+ "parallelToolCalls": false
404
+ }
393
405
  }
394
406
  }
395
407
  }
@@ -595,6 +607,127 @@ Content-Type: application/json
595
607
 
596
608
  ###
597
609
 
610
+ POST {{baseUrl}}/api/qgrid/oauthStartGrok
611
+ Content-Type: application/json
612
+
613
+ {
614
+ "name": "NAME"
615
+ }
616
+
617
+ ###
618
+
619
+ POST {{baseUrl}}/api/qgrid/oauthStartGrokDevice
620
+ Content-Type: application/json
621
+
622
+ {
623
+ "name": "NAME"
624
+ }
625
+
626
+ ###
627
+
628
+ POST {{baseUrl}}/api/qgrid/oauthPollGrokDevice
629
+ Content-Type: application/json
630
+
631
+ {
632
+ "deviceCode": "DEVICECODE"
633
+ }
634
+
635
+ ###
636
+
637
+ POST {{baseUrl}}/api/qgrid/generateImages
638
+ Content-Type: application/json
639
+
640
+ {
641
+ "params": {
642
+ "model": "MODEL",
643
+ "prompt": "PROMPT",
644
+ "n": 1,
645
+ "aspectRatio": "ASPECTRATIO",
646
+ "resolution": "RESOLUTION",
647
+ "quality": "QUALITY",
648
+ "outputFormat": "png",
649
+ "referenceImages": [
650
+ "REFERENCEIMAGES"
651
+ ],
652
+ "tokenName": "TOKENNAME",
653
+ "projectName": "PROJECTNAME",
654
+ "logger": false
655
+ }
656
+ }
657
+
658
+ ###
659
+
660
+ POST {{baseUrl}}/api/qgrid/videoStart
661
+ Content-Type: application/json
662
+
663
+ {
664
+ "params": {
665
+ "model": "MODEL",
666
+ "prompt": "PROMPT",
667
+ "duration": 1,
668
+ "aspectRatio": "ASPECTRATIO",
669
+ "resolution": "480p",
670
+ "image": "IMAGE",
671
+ "lastFrame": "LASTFRAME",
672
+ "referenceImages": [
673
+ "REFERENCEIMAGES"
674
+ ],
675
+ "mode": "reference-to-video",
676
+ "tokenName": "TOKENNAME",
677
+ "projectName": "PROJECTNAME",
678
+ "logger": false
679
+ }
680
+ }
681
+
682
+ ###
683
+
684
+ POST {{baseUrl}}/api/qgrid/videoStatus
685
+ Content-Type: application/json
686
+
687
+ {
688
+ "params": {
689
+ "jobHandle": "JOBHANDLE",
690
+ "projectName": "PROJECTNAME"
691
+ }
692
+ }
693
+
694
+ ###
695
+
696
+ POST {{baseUrl}}/api/qgrid/transcribe
697
+ Content-Type: application/json
698
+
699
+ {
700
+ "params": {
701
+ "model": "MODEL",
702
+ "audio": "AUDIO",
703
+ "mediaType": "MEDIATYPE",
704
+ "language": "LANGUAGE",
705
+ "tokenName": "TOKENNAME",
706
+ "projectName": "PROJECTNAME",
707
+ "logger": false
708
+ }
709
+ }
710
+
711
+ ###
712
+
713
+ POST {{baseUrl}}/api/qgrid/speak
714
+ Content-Type: application/json
715
+
716
+ {
717
+ "params": {
718
+ "model": "MODEL",
719
+ "text": "TEXT",
720
+ "voice": "VOICE",
721
+ "language": "LANGUAGE",
722
+ "format": "mp3",
723
+ "tokenName": "TOKENNAME",
724
+ "projectName": "PROJECTNAME",
725
+ "logger": false
726
+ }
727
+ }
728
+
729
+ ###
730
+
598
731
  GET {{baseUrl}}/api/qgrid/usage
599
732
  ?tokenId=0
600
733
  Content-Type: application/json
@@ -2,6 +2,8 @@
2
2
  * @generated
3
3
  * 직접 수정하지 마세요.
4
4
  */
5
+ // Sonamu 생성 코드의 타입 계약을 유지하기 위해 anti-slop 검사만 제외합니다.
6
+ /* oxlint-disable anti-slop/no-chained-type-assertions, anti-slop/no-conditional-empty-object-spread, anti-slop/no-known-value-widening, anti-slop/no-module-mocking, anti-slop/no-object-parameters, anti-slop/no-reflect-apply, anti-slop/no-reflect-get, anti-slop/no-runtime-typeof, anti-slop/no-shape-in-symbol-names, anti-slop/no-unknown-parameters, anti-slop/no-unknown-returns, anti-slop/no-unknown-type-aliases, anti-slop/no-unsafe-dictionary-type, anti-slop/no-widen-then-assert, anti-slop/require-safety-comment-for-type-assertion */
5
7
 
6
8
  import { type PuriWrapper, type DatabaseSchemaExtend, type PuriLoaderQueries } from "sonamu";
7
9
 
@@ -50,6 +50,19 @@ const TokenCredentials = z.union([
50
50
  accountId: z.string(),
51
51
  planType: z.string().optional(),
52
52
  }),
53
+ z.object({
54
+ authMode: z.literal("oauth"),
55
+ accessToken: z.string(),
56
+ refreshToken: z.string(),
57
+ expiresAt: z.string(),
58
+ issuer: z.literal("https://auth.x.ai"),
59
+ clientId: z.string(),
60
+ scopes: z.array(z.string()),
61
+ userId: z.string(),
62
+ sessionId: z.string(),
63
+ agentId: z.string(),
64
+ subscriptionTier: z.string().optional(),
65
+ }),
53
66
  ]);
54
67
  type TokenCredentials = z.infer<typeof TokenCredentials>;
55
68
 
@@ -228,6 +241,7 @@ export type RequestLogBaseSchema = z.infer<typeof RequestLogBaseSchema> & {
228
241
  "is_structured",
229
242
  "id",
230
243
  ];
244
+ readonly __json__: readonly ["history", "input_images", "tools"];
231
245
  };
232
246
 
233
247
  // BaseSchema: RequestLogStep
@@ -328,6 +342,7 @@ export type TokenBaseSchema = z.infer<typeof TokenBaseSchema> & {
328
342
  "keepalive_enabled",
329
343
  "id",
330
344
  ];
345
+ readonly __json__: readonly ["credentials"];
331
346
  };
332
347
 
333
348
  // BaseListParams: RequestLog
@@ -0,0 +1,20 @@
1
+ import { describe, expect, it } from "vitest";
2
+
3
+ import { tokenIdentityKey, UnknownTokenProviderError } from "./token.model";
4
+
5
+ describe("tokenIdentityKey", () => {
6
+ it.each([
7
+ ["anthropic", "accountUuid"],
8
+ ["openai", "accountId"],
9
+ ["grok", "userId"],
10
+ ] as const)("%s accounts are identified by credentials.%s", (provider, key) => {
11
+ expect(tokenIdentityKey(provider)).toBe(key);
12
+ });
13
+
14
+ it.each(["", "mistral", "constructor", "__proto__", "Grok"])(
15
+ "rejects unknown provider %j with a typed error",
16
+ (provider) => {
17
+ expect(() => tokenIdentityKey(provider)).toThrow(UnknownTokenProviderError);
18
+ },
19
+ );
20
+ });