@cartanova/qgrid-cli 2.10.0 → 2.10.2

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 (77) hide show
  1. package/README.ko.md +1 -1
  2. package/README.md +1 -1
  3. package/bundle/dist/application/qgrid/conv-routing.js +4 -14
  4. package/bundle/dist/application/qgrid/qgrid.dispatcher.js +10 -5
  5. package/bundle/dist/application/request-log/request-log.model.js +14 -12
  6. package/bundle/dist/application/request-log-step/request-log-step.model.js +7 -11
  7. package/bundle/dist/application/setting/setting.model.js +13 -27
  8. package/bundle/dist/application/token/token.model.js +52 -47
  9. package/bundle/dist/server-error-handler.js +1 -1
  10. package/bundle/dist/sonamu.config.js +3 -15
  11. package/bundle/dist/utils/providers/anthropic/anthropic-constants.js +4 -2
  12. package/bundle/dist/utils/providers/common/model-cost.js +10 -3
  13. package/bundle/src/application/qgrid/conv-routing.test.ts +0 -32
  14. package/bundle/src/application/qgrid/conv-routing.ts +7 -26
  15. package/bundle/src/application/qgrid/qgrid.dispatcher.test.ts +65 -121
  16. package/bundle/src/application/qgrid/qgrid.dispatcher.ts +12 -6
  17. package/bundle/src/application/qgrid/qgrid.frame.test.ts +10 -24
  18. package/bundle/src/application/request-log/request-log.model.test.ts +37 -2
  19. package/bundle/src/application/request-log/request-log.model.ts +14 -7
  20. package/bundle/src/application/request-log-step/request-log-step.model.ts +3 -15
  21. package/bundle/src/application/setting/setting.constant.test.ts +1 -13
  22. package/bundle/src/application/setting/setting.model.ts +10 -26
  23. package/bundle/src/application/setting/setting.persistence.test.ts +27 -0
  24. package/bundle/src/application/token/token.model.test.ts +86 -19
  25. package/bundle/src/application/token/token.model.ts +59 -44
  26. package/bundle/src/server-error-handler.ts +1 -2
  27. package/bundle/src/sonamu.config.ts +4 -31
  28. package/bundle/src/utils/providers/anthropic/anthropic-constants.test.ts +6 -1
  29. package/bundle/src/utils/providers/anthropic/anthropic-constants.ts +5 -2
  30. package/bundle/src/utils/providers/anthropic/anthropic-dispatcher.test.ts +1 -26
  31. package/bundle/src/utils/providers/common/model-cost.test.ts +22 -1
  32. package/bundle/src/utils/providers/common/model-cost.ts +22 -5
  33. package/bundle/src/utils/providers/common/provider-dispatcher.ts +4 -11
  34. package/bundle/web-dist/client/assets/index-DtRTSTes.js +106 -0
  35. package/bundle/web-dist/client/assets/logs-BhVYDEzC.js +1 -0
  36. package/bundle/web-dist/client/assets/monit-BxN4JWqK.js +1 -0
  37. package/bundle/web-dist/client/assets/refresh-cw-NNcU0Cmq.js +1 -0
  38. package/bundle/web-dist/client/assets/{routes-C8Y6olae.js → routes-CBCqRp2o.js} +1 -1
  39. package/bundle/web-dist/client/assets/services.generated-Cbvg2sGQ.js +51 -0
  40. package/bundle/web-dist/client/assets/{settings-CdVqtDQ5.js → settings-hBTEC7Ki.js} +1 -1
  41. package/bundle/web-dist/client/assets/show-BzYft5N4.js +2 -0
  42. package/bundle/web-dist/client/assets/{tokens-CxXtdk9o.js → tokens-PMybtI8X.js} +1 -1
  43. package/bundle/web-dist/client/assets/use-oauth-login-flow-C51_d6-6.js +1 -0
  44. package/bundle/web-dist/client/assets/{use-update-token-mutation-Dkv_HG-C.js → use-update-token-mutation-D-Y8OySK.js} +1 -1
  45. package/bundle/web-dist/client/index.html +2 -2
  46. package/bundle/web-dist/server/assets/{lazyRouteComponent-DyizoQKi.js → lazyRouteComponent-Bj1cPq6x.js} +2 -2
  47. package/bundle/web-dist/server/assets/{logs-DO8zBdBR.js → logs-BSk9lOHe.js} +31 -13
  48. package/bundle/web-dist/server/assets/{monit-COH4MckI.js → monit-D9W4ioUi.js} +5 -24
  49. package/bundle/web-dist/server/assets/{plus-C1D8z9o0.js → plus-CmvbWuDf.js} +1 -1
  50. package/bundle/web-dist/server/assets/{react-dom-PfWvArTX.js → react-dom-BjR1Iaz8.js} +1 -1
  51. package/bundle/web-dist/server/assets/refresh-cw-B8U9BL9-.js +23 -0
  52. package/bundle/web-dist/server/assets/{routes-Btja-741.js → routes-C7lB2Q85.js} +5 -5
  53. package/bundle/web-dist/server/assets/{services.generated-BsKOUSXl.js → services.generated-BM4X3Ecj.js} +102 -6
  54. package/bundle/web-dist/server/assets/{settings-DPcWGvy-.js → settings-BFVuldch.js} +4 -4
  55. package/bundle/web-dist/server/assets/{show-CMXbb3TJ.js → show-Cswh_tqs.js} +10 -9
  56. package/bundle/web-dist/server/assets/{tokens-DAUmTrgO.js → tokens-DiTUwUwr.js} +5 -5
  57. package/bundle/web-dist/server/assets/{use-oauth-login-flow-GsGwqefs.js → use-oauth-login-flow-DYKnG4A2.js} +32 -15
  58. package/bundle/web-dist/server/assets/{use-update-token-mutation-RujWERvj.js → use-update-token-mutation-DqGMopII.js} +1 -1
  59. package/bundle/web-dist/server/entry-server.generated.js +381 -22
  60. package/package.json +1 -1
  61. package/skills/qgrid/references/ai-sdk-provider-contract.md +4 -2
  62. package/skills/qgrid/references/anthropic-claude-code-runtime.md +3 -2
  63. package/skills/qgrid/references/request-log-run-lifecycle.md +2 -0
  64. package/skills/qgrid/references/sonamu-api-web-flow.md +3 -1
  65. package/skills/qgrid/references/token-auth-quota-lifecycle.md +2 -0
  66. package/skills/qgrid/references/verification-and-debugging.md +24 -13
  67. package/bundle/dist/utils/providers/common/token-picker.js +0 -14
  68. package/bundle/src/utils/providers/common/token-picker.ts +0 -18
  69. package/bundle/web-dist/client/assets/index-BfwrIBHs.js +0 -106
  70. package/bundle/web-dist/client/assets/logs-Brit-LqB.js +0 -1
  71. package/bundle/web-dist/client/assets/monit-DrYZkisv.js +0 -1
  72. package/bundle/web-dist/client/assets/services.generated-Bg2XkD-D.js +0 -51
  73. package/bundle/web-dist/client/assets/show-2B2X9MkO.js +0 -2
  74. package/bundle/web-dist/client/assets/use-oauth-login-flow-B9EqnwY9.js +0 -1
  75. /package/bundle/web-dist/client/assets/{plus-CknMNCP5.js → plus-B62CuqT8.js} +0 -0
  76. /package/bundle/web-dist/client/assets/{request-model-eygfdRv7.js → request-model-D4CZPmnG.js} +0 -0
  77. /package/bundle/web-dist/server/assets/{request-model-DXclJfdP.js → request-model-CnCeaNLE.js} +0 -0
@@ -19072,7 +19072,7 @@ var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/
19072
19072
  var base64url = /^[A-Za-z0-9_-]*$/;
19073
19073
  var e164 = /^\+[1-9]\d{6,14}$/;
19074
19074
  var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
19075
- var date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
19075
+ var date$2 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
19076
19076
  function timeSource(args) {
19077
19077
  const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
19078
19078
  return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
@@ -19094,6 +19094,7 @@ var string$1 = (params) => {
19094
19094
  };
19095
19095
  var integer = /^-?\d+$/;
19096
19096
  var number$1 = /^-?\d+(?:\.\d+)?$/;
19097
+ var boolean$1 = /^(?:true|false)$/i;
19097
19098
  var lowercase = /^[^A-Z]*$/;
19098
19099
  var uppercase = /^[^a-z]*$/;
19099
19100
  //#endregion
@@ -19705,7 +19706,7 @@ var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def
19705
19706
  $ZodStringFormat.init(inst, def);
19706
19707
  });
19707
19708
  var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
19708
- def.pattern ?? (def.pattern = date$1);
19709
+ def.pattern ?? (def.pattern = date$2);
19709
19710
  $ZodStringFormat.init(inst, def);
19710
19711
  });
19711
19712
  var $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
@@ -19868,6 +19869,24 @@ var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, d
19868
19869
  $ZodCheckNumberFormat.init(inst, def);
19869
19870
  $ZodNumber.init(inst, def);
19870
19871
  });
19872
+ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
19873
+ $ZodType.init(inst, def);
19874
+ inst._zod.pattern = boolean$1;
19875
+ inst._zod.parse = (payload, _ctx) => {
19876
+ if (def.coerce) try {
19877
+ payload.value = Boolean(payload.value);
19878
+ } catch (_) {}
19879
+ const input = payload.value;
19880
+ if (typeof input === "boolean") return payload;
19881
+ payload.issues.push({
19882
+ expected: "boolean",
19883
+ code: "invalid_type",
19884
+ input,
19885
+ inst
19886
+ });
19887
+ return payload;
19888
+ };
19889
+ });
19871
19890
  var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
19872
19891
  $ZodType.init(inst, def);
19873
19892
  inst._zod.parse = (payload) => payload;
@@ -19884,6 +19903,25 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
19884
19903
  return payload;
19885
19904
  };
19886
19905
  });
19906
+ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
19907
+ $ZodType.init(inst, def);
19908
+ inst._zod.parse = (payload, _ctx) => {
19909
+ if (def.coerce) try {
19910
+ payload.value = new Date(payload.value);
19911
+ } catch (_err) {}
19912
+ const input = payload.value;
19913
+ const isDate = input instanceof Date;
19914
+ if (isDate && !Number.isNaN(input.getTime())) return payload;
19915
+ payload.issues.push({
19916
+ expected: "date",
19917
+ code: "invalid_type",
19918
+ input,
19919
+ ...isDate ? { received: "Invalid Date" } : {},
19920
+ inst
19921
+ });
19922
+ return payload;
19923
+ };
19924
+ });
19887
19925
  function handleArrayResult(result, final, index) {
19888
19926
  if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
19889
19927
  final.value[index] = result.value;
@@ -20848,6 +20886,13 @@ function _int(Class, params) {
20848
20886
  });
20849
20887
  }
20850
20888
  /* @__NO_SIDE_EFFECTS__ */
20889
+ function _boolean(Class, params) {
20890
+ return new Class({
20891
+ type: "boolean",
20892
+ ...normalizeParams(params)
20893
+ });
20894
+ }
20895
+ /* @__NO_SIDE_EFFECTS__ */
20851
20896
  function _unknown(Class) {
20852
20897
  return new Class({ type: "unknown" });
20853
20898
  }
@@ -20859,6 +20904,13 @@ function _never(Class, params) {
20859
20904
  });
20860
20905
  }
20861
20906
  /* @__NO_SIDE_EFFECTS__ */
20907
+ function _date(Class, params) {
20908
+ return new Class({
20909
+ type: "date",
20910
+ ...normalizeParams(params)
20911
+ });
20912
+ }
20913
+ /* @__NO_SIDE_EFFECTS__ */
20862
20914
  function _lt(value, params) {
20863
20915
  return new $ZodCheckLessThan({
20864
20916
  check: "less_than",
@@ -21014,6 +21066,17 @@ function _array(Class, element, params) {
21014
21066
  });
21015
21067
  }
21016
21068
  /* @__NO_SIDE_EFFECTS__ */
21069
+ function _custom(Class, fn, _params) {
21070
+ const norm = normalizeParams(_params);
21071
+ norm.abort ?? (norm.abort = true);
21072
+ return new Class({
21073
+ type: "custom",
21074
+ check: "custom",
21075
+ fn,
21076
+ ...norm
21077
+ });
21078
+ }
21079
+ /* @__NO_SIDE_EFFECTS__ */
21017
21080
  function _refine(Class, fn, _params) {
21018
21081
  return new Class({
21019
21082
  type: "custom",
@@ -21390,10 +21453,16 @@ var numberProcessor = (schema, ctx, _json, _params) => {
21390
21453
  }
21391
21454
  if (typeof multipleOf === "number") json.multipleOf = multipleOf;
21392
21455
  };
21456
+ var booleanProcessor = (_schema, _ctx, json, _params) => {
21457
+ json.type = "boolean";
21458
+ };
21393
21459
  var neverProcessor = (_schema, _ctx, json, _params) => {
21394
21460
  json.not = {};
21395
21461
  };
21396
21462
  var unknownProcessor = (_schema, _ctx, _json, _params) => {};
21463
+ var dateProcessor = (_schema, ctx, _json, _params) => {
21464
+ if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
21465
+ };
21397
21466
  var enumProcessor = (schema, _ctx, json, _params) => {
21398
21467
  const def = schema._zod.def;
21399
21468
  const values = getEnumValues(def.entries);
@@ -21558,7 +21627,7 @@ var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
21558
21627
  $ZodISODate.init(inst, def);
21559
21628
  ZodStringFormat.init(inst, def);
21560
21629
  });
21561
- function date(params) {
21630
+ function date$1(params) {
21562
21631
  return /* @__PURE__ */ _isoDate(ZodISODate, params);
21563
21632
  }
21564
21633
  var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
@@ -21742,7 +21811,7 @@ var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
21742
21811
  inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
21743
21812
  inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
21744
21813
  inst.datetime = (params) => inst.check(datetime(params));
21745
- inst.date = (params) => inst.check(date(params));
21814
+ inst.date = (params) => inst.check(date$1(params));
21746
21815
  inst.time = (params) => inst.check(time(params));
21747
21816
  inst.duration = (params) => inst.check(duration(params));
21748
21817
  });
@@ -21865,6 +21934,14 @@ var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def
21865
21934
  function int(params) {
21866
21935
  return /* @__PURE__ */ _int(ZodNumberFormat, params);
21867
21936
  }
21937
+ var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
21938
+ $ZodBoolean.init(inst, def);
21939
+ ZodType.init(inst, def);
21940
+ inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
21941
+ });
21942
+ function boolean(params) {
21943
+ return /* @__PURE__ */ _boolean(ZodBoolean, params);
21944
+ }
21868
21945
  var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
21869
21946
  $ZodUnknown.init(inst, def);
21870
21947
  ZodType.init(inst, def);
@@ -21881,6 +21958,19 @@ var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
21881
21958
  function never(params) {
21882
21959
  return /* @__PURE__ */ _never(ZodNever, params);
21883
21960
  }
21961
+ var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
21962
+ $ZodDate.init(inst, def);
21963
+ ZodType.init(inst, def);
21964
+ inst._zod.processJSONSchema = (ctx, json, params) => dateProcessor(inst, ctx, json, params);
21965
+ inst.min = (value, params) => inst.check(/* @__PURE__ */ _gte(value, params));
21966
+ inst.max = (value, params) => inst.check(/* @__PURE__ */ _lte(value, params));
21967
+ const c = inst._zod.bag;
21968
+ inst.minDate = c.minimum ? new Date(c.minimum) : null;
21969
+ inst.maxDate = c.maximum ? new Date(c.maximum) : null;
21970
+ });
21971
+ function date(params) {
21972
+ return /* @__PURE__ */ _date(ZodDate, params);
21973
+ }
21884
21974
  var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
21885
21975
  $ZodArray.init(inst, def);
21886
21976
  ZodType.init(inst, def);
@@ -22161,6 +22251,9 @@ var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
22161
22251
  ZodType.init(inst, def);
22162
22252
  inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
22163
22253
  });
22254
+ function custom(fn, _params) {
22255
+ return /* @__PURE__ */ _custom(ZodCustom, fn ?? (() => true), _params);
22256
+ }
22164
22257
  function refine(fn, _params = {}) {
22165
22258
  return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
22166
22259
  }
@@ -22673,7 +22766,7 @@ var SonamuError = class extends Error {
22673
22766
  function isSonamuError(e) {
22674
22767
  return e && e.isSonamuError === true;
22675
22768
  }
22676
- _enum([
22769
+ var SonamuQueryMode = _enum([
22677
22770
  "both",
22678
22771
  "list",
22679
22772
  "count"
@@ -22687,6 +22780,9 @@ object({ semanticQuery: object({
22687
22780
  "inner_product"
22688
22781
  ]).optional()
22689
22782
  }) });
22783
+ function zArrayable(shape) {
22784
+ return union([shape, shape.array()]);
22785
+ }
22690
22786
  string().regex(/([0-9]{4}-[0-9]{2}-[0-9]{2}( [0-9]{2}:[0-9]{2}:[0-9]{2})*)$/, { message: "잘못된 SQLDate 타입" }).min(10).max(19).describe("SQLDateTimeString");
22691
22787
  array(object({
22692
22788
  name: string(),
@@ -23617,4 +23713,4 @@ RequestLogStepService.useRequestLogSteps, RequestLogStepService.useRequestLogSte
23617
23713
  SettingService.useSettings, SettingService.useSettingsInfinite;
23618
23714
  TokenService.useTokens, TokenService.useTokensInfinite;
23619
23715
  //#endregion
23620
- export { hashQueryKeyByOptions as A, __exportAll as B, Mutation as C, notifyManager as D, onlineManager as E, resolveStaleTime as F, __toESM as H, skipToken as I, focusManager as L, matchQuery as M, noop$2 as N, functionalUpdate as O, partialMatchKey as P, Subscribable as R, require_react as S, Query as T, __require as V, useMutation as _, SettingService as a, useQueryClient as b, isSonamuError as c, setLocale as d, _enum as f, isAxiosError as g, string as h, RequestLogStepService as i, matchMutation as j, hashKey as k, SD as l, object as m, QgridService as n, TokenService as o, number as p, RequestLogService as r, fetch$1 as s, MonitService as t, SUPPORTED_LOCALES as u, useQuery as v, infiniteQueryBehavior as w, require_jsx_runtime as x, QueryClientProvider as y, __commonJSMin as z };
23716
+ export { require_jsx_runtime as A, matchMutation as B, union as C, useQuery as D, useMutation as E, onlineManager as F, skipToken as G, noop$2 as H, notifyManager as I, __commonJSMin as J, focusManager as K, functionalUpdate as L, Mutation as M, infiniteQueryBehavior as N, QueryClientProvider as O, Query as P, hashKey as R, string as S, isAxiosError as T, partialMatchKey as U, matchQuery as V, resolveStaleTime as W, __require as X, __exportAll as Y, __toESM as Z, custom as _, SettingService as a, number as b, fetch$1 as c, SD as d, SUPPORTED_LOCALES as f, boolean as g, array as h, RequestLogStepService as i, require_react as j, useQueryClient as k, isSonamuError as l, _enum as m, QgridService as n, TokenService as o, setLocale as p, Subscribable as q, RequestLogService as r, SonamuQueryMode as s, MonitService as t, zArrayable as u, date as v, unknown as w, object as x, int as y, hashQueryKeyByOptions as z };
@@ -1,7 +1,7 @@
1
- import { H as __toESM, S as require_react, a as SettingService, b as useQueryClient, c as isSonamuError, g as isAxiosError, n as QgridService, o as TokenService, v as useQuery, x as require_jsx_runtime } from "./services.generated-BsKOUSXl.js";
2
- import { s as lucideRotateCcw } from "../entry-server.generated.js";
3
- import { t as useUpdateTokenMutation } from "./use-update-token-mutation-RujWERvj.js";
4
- import { t as lucidePlus } from "./plus-C1D8z9o0.js";
1
+ import { A as require_jsx_runtime, D as useQuery, T as isAxiosError, Z as __toESM, a as SettingService, j as require_react, k as useQueryClient, l as isSonamuError, n as QgridService, o as TokenService } from "./services.generated-BM4X3Ecj.js";
2
+ import { l as lucideRotateCcw } from "../entry-server.generated.js";
3
+ import { t as useUpdateTokenMutation } from "./use-update-token-mutation-DqGMopII.js";
4
+ import { t as lucidePlus } from "./plus-CmvbWuDf.js";
5
5
  //#region ~icons/lucide/eye.jsx
6
6
  var import_react = /* @__PURE__ */ __toESM(require_react());
7
7
  var import_jsx_runtime = require_jsx_runtime();
@@ -1,8 +1,8 @@
1
- import { H as __toESM, S as require_react, i as RequestLogStepService, r as RequestLogService, v as useQuery, x as require_jsx_runtime, z as __commonJSMin } from "./services.generated-BsKOUSXl.js";
2
- import { a as Link } from "./lazyRouteComponent-DyizoQKi.js";
3
- import { c as remarkGfm, l as Markdown, o as lucideX, t as Route } from "../entry-server.generated.js";
1
+ import { A as require_jsx_runtime, D as useQuery, J as __commonJSMin, Z as __toESM, i as RequestLogStepService, j as require_react, l as isSonamuError, r as RequestLogService } from "./services.generated-BM4X3Ecj.js";
2
+ import { a as Link } from "./lazyRouteComponent-Bj1cPq6x.js";
3
+ import { c as lucideX, d as Markdown, t as Route, u as remarkGfm } from "../entry-server.generated.js";
4
4
  import { n as formatMicroUsd, t as cacheHitRate } from "./cost-CSH_t17I.js";
5
- import { t as requestModelDisplay } from "./request-model-DXclJfdP.js";
5
+ import { t as requestModelDisplay } from "./request-model-CnCeaNLE.js";
6
6
  //#region ../../node_modules/.pnpm/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/extends.js
7
7
  var require_extends = /* @__PURE__ */ __commonJSMin(((exports, module) => {
8
8
  function _extends() {
@@ -2867,8 +2867,8 @@ function ResponseTypePanel({ id }) {
2867
2867
  });
2868
2868
  }
2869
2869
  function RequestDetail({ id }) {
2870
- const { data, isLoading } = RequestLogService.useRequestLog("A", id);
2871
- const { data: stepsData, isLoading: isStepsLoading } = RequestLogStepService.useRequestLogSteps("T", {
2870
+ const { data, isLoading, error, isError } = RequestLogService.useRequestLog("A", id);
2871
+ const { data: stepsData, isLoading: isStepsLoading, isError: isStepsError } = RequestLogStepService.useRequestLogSteps("T", {
2872
2872
  request_log_id: id,
2873
2873
  num: 0,
2874
2874
  page: 1,
@@ -2883,15 +2883,16 @@ function RequestDetail({ id }) {
2883
2883
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-32 panel animate-pulse" })
2884
2884
  ]
2885
2885
  });
2886
- if (!data) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2886
+ if (isError || isStepsError || !data) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2887
2887
  className: "max-w-6xl mx-auto",
2888
2888
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
2889
2889
  to: "/logs",
2890
2890
  className: "flex items-center gap-1 text-[13px] text-sand-500 hover:text-sienna-500 mb-4",
2891
2891
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(lucideArrowLeft, { className: "size-3.5" }), "Back to Logs"]
2892
2892
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
2893
- className: "text-sand-400 text-sm",
2894
- children: "Request not found."
2893
+ role: "alert",
2894
+ className: "text-danger-500 text-sm",
2895
+ children: isError ? isSonamuError(error) && error.code === 404 ? "Request not found." : "Failed to load request." : isStepsError ? "Failed to load request steps." : "Request not found."
2895
2896
  })]
2896
2897
  });
2897
2898
  const toolCalls = stepTree.flatMap((step) => step.toolCalls);
@@ -1,8 +1,8 @@
1
- import { H as __toESM, S as require_react, b as useQueryClient, n as QgridService, o as TokenService, x as require_jsx_runtime } from "./services.generated-BsKOUSXl.js";
2
- import { i as Q, u as lucideKeyRound } from "../entry-server.generated.js";
3
- import { t as useUpdateTokenMutation } from "./use-update-token-mutation-RujWERvj.js";
4
- import { n as OAuthCodeEntry, t as useOAuthLoginFlow } from "./use-oauth-login-flow-GsGwqefs.js";
5
- import { t as lucidePlus } from "./plus-C1D8z9o0.js";
1
+ import { A as require_jsx_runtime, Z as __toESM, j as require_react, k as useQueryClient, n as QgridService, o as TokenService } from "./services.generated-BM4X3Ecj.js";
2
+ import { f as lucideKeyRound, o as Q } from "../entry-server.generated.js";
3
+ import { t as useUpdateTokenMutation } from "./use-update-token-mutation-DqGMopII.js";
4
+ import { n as OAuthCodeEntry, t as useOAuthLoginFlow } from "./use-oauth-login-flow-DYKnG4A2.js";
5
+ import { t as lucidePlus } from "./plus-CmvbWuDf.js";
6
6
  //#region src/components/qgrid/AddTokenModal.tsx
7
7
  var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
8
8
  var import_jsx_runtime = require_jsx_runtime();
@@ -1,5 +1,5 @@
1
- import { H as __toESM, S as require_react, b as useQueryClient, n as QgridService, x as require_jsx_runtime } from "./services.generated-BsKOUSXl.js";
2
- import { i as Q } from "../entry-server.generated.js";
1
+ import { A as require_jsx_runtime, Z as __toESM, j as require_react, k as useQueryClient, n as QgridService, o as TokenService } from "./services.generated-BM4X3Ecj.js";
2
+ import { o as Q } from "../entry-server.generated.js";
3
3
  //#region src/components/qgrid/OAuthCodeEntry.tsx
4
4
  var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
5
5
  var import_jsx_runtime = require_jsx_runtime();
@@ -53,14 +53,12 @@ function OAuthCodeEntry({ provider, isPending, isError, onSubmit, onRestart }) {
53
53
  //#region src/components/qgrid/use-oauth-login-flow.ts
54
54
  var OPENAI_POLL_INTERVAL_MS = 3e3;
55
55
  var OPENAI_POLL_TIMEOUT_MS = 3e5;
56
- /** 캐시에 적재된 토큰 행 수. 폴링 조기 종료 판정에만 쓰는 근사치다. */
57
- function countTokens(queryClient) {
58
- let total = 0;
59
- for (const query of queryClient.getQueryCache().findAll({ queryKey: ["Token"] })) {
60
- const rows = query.state.data?.rows;
61
- if (Array.isArray(rows)) total = Math.max(total, rows.length);
62
- }
63
- return total;
56
+ async function getTokenIds(provider, name) {
57
+ const { rows } = await TokenService.getTokens("A", {
58
+ num: 0,
59
+ queryMode: "list"
60
+ });
61
+ return new Set(rows.filter((token) => token.provider === provider && token.name === name).map((token) => token.id));
64
62
  }
65
63
  /**
66
64
  * provider별 OAuth 로그인 시작과 코드 제출을 한 곳에 모은다.
@@ -75,7 +73,9 @@ function useOAuthLoginFlow() {
75
73
  const oauthStartOpenAIMutation = QgridService.useOauthStartOpenAIMutation();
76
74
  const oauthCompleteMutation = QgridService.useOauthCompleteMutation();
77
75
  const pollTimers = (0, import_react.useRef)({});
76
+ const attemptRef = (0, import_react.useRef)(0);
78
77
  const stopPolling = () => {
78
+ attemptRef.current += 1;
79
79
  if (pollTimers.current.interval !== void 0) clearInterval(pollTimers.current.interval);
80
80
  if (pollTimers.current.timeout !== void 0) clearTimeout(pollTimers.current.timeout);
81
81
  pollTimers.current = {};
@@ -85,11 +85,22 @@ function useOAuthLoginFlow() {
85
85
  const start = async (provider, name) => {
86
86
  const trimmed = name.trim();
87
87
  if (!trimmed) return;
88
+ stopPolling();
89
+ const attempt = attemptRef.current;
88
90
  const popup = window.open("about:blank", "_blank");
89
91
  setLoadingProvider(provider);
90
92
  try {
91
93
  if (provider === "openai") {
94
+ const before = await getTokenIds(provider, trimmed);
95
+ if (attempt !== attemptRef.current) {
96
+ popup?.close();
97
+ return;
98
+ }
92
99
  const { authUrl, mode } = await oauthStartOpenAIMutation.mutateAsync({ name: trimmed });
100
+ if (attempt !== attemptRef.current) {
101
+ popup?.close();
102
+ return;
103
+ }
93
104
  if (popup) popup.location.href = authUrl;
94
105
  else window.open(authUrl, "_blank");
95
106
  if (mode === "code") {
@@ -97,23 +108,28 @@ function useOAuthLoginFlow() {
97
108
  setLoadingProvider(null);
98
109
  return;
99
110
  }
100
- const before = countTokens(queryClient);
101
- stopPolling();
102
111
  pollTimers.current.interval = window.setInterval(() => {
103
- invalidateTokens().then(() => {
104
- if (countTokens(queryClient) > before) {
112
+ getTokenIds(provider, trimmed).then((ids) => {
113
+ if (attempt !== attemptRef.current) return;
114
+ if ([...ids].some((id) => !before.has(id))) {
105
115
  stopPolling();
106
116
  setLoadingProvider(null);
117
+ invalidateTokens();
107
118
  }
108
- });
119
+ }).catch(() => {});
109
120
  }, OPENAI_POLL_INTERVAL_MS);
110
121
  pollTimers.current.timeout = window.setTimeout(() => {
122
+ if (attempt !== attemptRef.current) return;
111
123
  stopPolling();
112
124
  setLoadingProvider(null);
113
125
  }, OPENAI_POLL_TIMEOUT_MS);
114
126
  return;
115
127
  }
116
128
  const { authUrl, mode } = await oauthStartMutation.mutateAsync({ name: trimmed });
129
+ if (attempt !== attemptRef.current) {
130
+ popup?.close();
131
+ return;
132
+ }
117
133
  if (mode === "code") {
118
134
  if (popup) popup.location.href = authUrl;
119
135
  else window.open(authUrl, "_blank");
@@ -125,6 +141,7 @@ function useOAuthLoginFlow() {
125
141
  }
126
142
  } catch (e) {
127
143
  popup?.close();
144
+ if (attempt !== attemptRef.current) return;
128
145
  console.error("OAuth start failed:", e);
129
146
  setLoadingProvider(null);
130
147
  }
@@ -1,4 +1,4 @@
1
- import { _ as useMutation, n as QgridService } from "./services.generated-BsKOUSXl.js";
1
+ import { E as useMutation, n as QgridService } from "./services.generated-BM4X3Ecj.js";
2
2
  //#region src/services/token/use-update-token-mutation.ts
3
3
  function useUpdateTokenMutation() {
4
4
  return useMutation({ mutationFn: ({ id, name, quotaThreshold, weight, keepaliveEnabled }) => QgridService.updateToken(id, name, quotaThreshold, weight, keepaliveEnabled) });