@cartanova/qgrid-cli 1.5.0 → 1.5.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.
@@ -2,6 +2,7 @@ import { $ as __commonJSMin, S as require_react, et as __exportAll, nt as __toES
2
2
  import { n as RequestLogService } from "./services.generated-DjxCLdMu.js";
3
3
  import { a as Link } from "./lazyRouteComponent-Dyl_0WZs.js";
4
4
  import { t as Route } from "../entry-server.generated.js";
5
+ import { n as lucideCheck, t as lucideCopy } from "./copy-C9YkjJVm.js";
5
6
  import minpath from "node:path";
6
7
  import minproc from "node:process";
7
8
  import { fileURLToPath as urlToPath } from "node:url";
@@ -18109,7 +18110,7 @@ function isUint8Array(value) {
18109
18110
  * Transformed URL (optional).
18110
18111
  */
18111
18112
  var import_jsx_runtime = require_jsx_runtime();
18112
- require_react();
18113
+ var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
18113
18114
  /** @type {PluggableList} */
18114
18115
  var emptyPlugins = [];
18115
18116
  /** @type {Readonly<RemarkRehypeOptions>} */
@@ -23196,6 +23197,22 @@ var lucideArrowLeft = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("sv
23196
23197
  })
23197
23198
  });
23198
23199
  //#endregion
23200
+ //#region ~icons/lucide/chevron-down.jsx
23201
+ var lucideChevronDown = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
23202
+ viewBox: "0 0 24 24",
23203
+ width: "1.2em",
23204
+ height: "1.2em",
23205
+ ...props,
23206
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
23207
+ fill: "none",
23208
+ stroke: "currentColor",
23209
+ strokeLinecap: "round",
23210
+ strokeLinejoin: "round",
23211
+ strokeWidth: 2,
23212
+ d: "m6 9l6 6l6-6"
23213
+ })
23214
+ });
23215
+ //#endregion
23199
23216
  //#region src/routes/requests/show.tsx?tsr-split=component
23200
23217
  function RequestShowPage() {
23201
23218
  const { id } = Route.useSearch();
@@ -23213,6 +23230,197 @@ function formatDateTime(iso) {
23213
23230
  second: "2-digit"
23214
23231
  });
23215
23232
  }
23233
+ function tryParseJson(text) {
23234
+ try {
23235
+ return JSON.parse(text);
23236
+ } catch {
23237
+ return null;
23238
+ }
23239
+ }
23240
+ function JsonValue({ value, defaultOpen = true }) {
23241
+ if (value === null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
23242
+ className: "text-sand-400",
23243
+ children: "null"
23244
+ });
23245
+ if (value === void 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
23246
+ className: "text-sand-400",
23247
+ children: "undefined"
23248
+ });
23249
+ if (typeof value === "boolean") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
23250
+ className: "text-amber-600",
23251
+ children: String(value)
23252
+ });
23253
+ if (typeof value === "number") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
23254
+ className: "text-blue-600",
23255
+ children: String(value)
23256
+ });
23257
+ if (typeof value === "string") {
23258
+ if (value.length > 200) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
23259
+ className: "inline",
23260
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", {
23261
+ className: "cursor-pointer text-sage-700",
23262
+ children: [
23263
+ "\"",
23264
+ value.slice(0, 80),
23265
+ "...\"",
23266
+ " ",
23267
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
23268
+ className: "text-sand-400 text-[10px]",
23269
+ children: [
23270
+ "(",
23271
+ value.length,
23272
+ " chars)"
23273
+ ]
23274
+ })
23275
+ ]
23276
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("pre", {
23277
+ className: "mt-1 ml-2 text-sage-700 whitespace-pre-wrap wrap-break-word",
23278
+ children: [
23279
+ "\"",
23280
+ value,
23281
+ "\""
23282
+ ]
23283
+ })]
23284
+ });
23285
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
23286
+ className: "text-sage-700",
23287
+ children: [
23288
+ "\"",
23289
+ value,
23290
+ "\""
23291
+ ]
23292
+ });
23293
+ }
23294
+ if (Array.isArray(value)) {
23295
+ if (value.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
23296
+ className: "text-sand-500",
23297
+ children: "[]"
23298
+ });
23299
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
23300
+ open: defaultOpen,
23301
+ className: "inline-block w-full",
23302
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", {
23303
+ className: "cursor-pointer text-sand-500",
23304
+ children: "[]"
23305
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
23306
+ className: "ml-4 border-l border-sand-200 pl-3",
23307
+ children: value.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
23308
+ className: "py-0.5",
23309
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(JsonValue, {
23310
+ value: item,
23311
+ defaultOpen: true
23312
+ })
23313
+ }, i))
23314
+ })]
23315
+ });
23316
+ }
23317
+ if (typeof value === "object") {
23318
+ const entries = Object.entries(value);
23319
+ if (entries.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
23320
+ className: "text-sand-500",
23321
+ children: "{}"
23322
+ });
23323
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
23324
+ open: defaultOpen,
23325
+ className: "inline-block w-full",
23326
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", {
23327
+ className: "cursor-pointer text-sand-500",
23328
+ children: "{}"
23329
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
23330
+ className: "ml-4 border-l border-sand-200 pl-3",
23331
+ children: entries.map(([key, val]) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
23332
+ className: "py-0.5",
23333
+ children: [
23334
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
23335
+ className: "text-sienna-500 font-medium",
23336
+ children: key
23337
+ }),
23338
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
23339
+ className: "text-sand-400",
23340
+ children: ": "
23341
+ }),
23342
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(JsonValue, {
23343
+ value: val,
23344
+ defaultOpen: true
23345
+ })
23346
+ ]
23347
+ }, key))
23348
+ })]
23349
+ });
23350
+ }
23351
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: String(value) });
23352
+ }
23353
+ function CopyButton({ text }) {
23354
+ const [copied, setCopied] = (0, import_react.useState)(false);
23355
+ (0, import_react.useEffect)(() => {
23356
+ if (!copied) return;
23357
+ const id = setTimeout(() => setCopied(false), 1500);
23358
+ return () => clearTimeout(id);
23359
+ }, [copied]);
23360
+ const handleCopy = () => {
23361
+ navigator.clipboard.writeText(text);
23362
+ setCopied(true);
23363
+ };
23364
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
23365
+ type: "button",
23366
+ className: "absolute top-2 right-2 p-1 rounded text-sand-400 hover:text-sand-600 transition-colors",
23367
+ onClick: handleCopy,
23368
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(lucideCheck, { className: "size-3.5 text-sage-500" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(lucideCopy, { className: "size-3.5" })
23369
+ });
23370
+ }
23371
+ function FormattedContent({ text, markdown }) {
23372
+ const parsed = tryParseJson(text);
23373
+ const [mode, setMode] = (0, import_react.useState)("pretty");
23374
+ if (parsed === null) {
23375
+ if (markdown) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
23376
+ className: "prose prose-sm prose-sand max-w-none",
23377
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Markdown, {
23378
+ remarkPlugins: [remarkGfm],
23379
+ children: text
23380
+ })
23381
+ });
23382
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
23383
+ className: "text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed",
23384
+ children: text
23385
+ });
23386
+ }
23387
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
23388
+ className: "flex gap-1 mb-2",
23389
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
23390
+ type: "button",
23391
+ className: `px-2 py-0.5 text-[10px] rounded-md transition-colors ${mode === "plain" ? "bg-sand-200 text-sand-700" : "text-sand-400 hover:text-sand-600"}`,
23392
+ onClick: () => setMode("plain"),
23393
+ children: "Plain"
23394
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
23395
+ type: "button",
23396
+ className: `px-2 py-0.5 text-[10px] rounded-md transition-colors ${mode === "pretty" ? "bg-sand-200 text-sand-700" : "text-sand-400 hover:text-sand-600"}`,
23397
+ onClick: () => setMode("pretty"),
23398
+ children: "Pretty"
23399
+ })]
23400
+ }), mode === "pretty" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
23401
+ className: "text-sm font-mono leading-relaxed",
23402
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(JsonValue, { value: parsed })
23403
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
23404
+ className: "text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed",
23405
+ children: JSON.stringify(parsed, null, 2)
23406
+ })] });
23407
+ }
23408
+ function Section({ title, defaultOpen = true, children }) {
23409
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
23410
+ open: defaultOpen,
23411
+ className: "group",
23412
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", {
23413
+ className: "flex items-center gap-1 cursor-pointer select-none list-none",
23414
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(lucideChevronDown, { className: "size-3.5 text-sand-400 transition-transform group-open:rotate-0 -rotate-90" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
23415
+ className: "text-[10px] uppercase tracking-wider text-sand-500 font-medium",
23416
+ children: title
23417
+ })]
23418
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
23419
+ className: "mt-1.5",
23420
+ children
23421
+ })]
23422
+ });
23423
+ }
23216
23424
  function RequestDetail({ id }) {
23217
23425
  const { data, isLoading } = RequestLogService.useRequestLog("A", id);
23218
23426
  if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
@@ -23248,33 +23456,27 @@ function RequestDetail({ id }) {
23248
23456
  className: "text-xl font-medium text-sand-900 tracking-tight",
23249
23457
  children: "Request Detail"
23250
23458
  }),
23251
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
23252
- className: "text-[10px] uppercase tracking-wider text-sand-500 font-medium",
23253
- children: "Query"
23254
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
23255
- className: "mt-1.5 rounded-lg bg-sand-50 px-4 py-3",
23256
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
23257
- className: "text-sm text-sand-800 whitespace-pre-wrap break-words font-mono leading-relaxed",
23258
- children: data.query
23459
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Section, {
23460
+ title: "Query",
23461
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
23462
+ className: "rounded-lg bg-sand-50 px-4 py-3",
23463
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormattedContent, { text: data.query })
23259
23464
  })
23260
- })] }),
23261
- data.response && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
23262
- className: "text-[10px] uppercase tracking-wider text-sand-500 font-medium",
23263
- children: "Response"
23264
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
23265
- className: "mt-1.5 rounded-lg bg-sand-50 px-4 py-3 prose prose-sm prose-sand max-w-none",
23266
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Markdown, {
23267
- remarkPlugins: [remarkGfm],
23268
- children: data.response
23465
+ }),
23466
+ data.response && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Section, {
23467
+ title: "Response",
23468
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
23469
+ className: "relative rounded-lg bg-sand-50 px-4 py-3",
23470
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyButton, { text: data.response }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormattedContent, {
23471
+ text: data.response,
23472
+ markdown: true
23473
+ })]
23269
23474
  })
23270
- })] }),
23271
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
23272
- className: "space-y-4",
23273
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
23274
- className: "text-[10px] uppercase tracking-wider text-sand-500 font-medium",
23275
- children: "Token Breakdown"
23276
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
23277
- className: "mt-1.5 rounded-lg bg-sand-50 px-5 py-4",
23475
+ }),
23476
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Section, {
23477
+ title: "Token Breakdown",
23478
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
23479
+ className: "rounded-lg bg-sand-50 px-5 py-4",
23278
23480
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("table", {
23279
23481
  className: "w-full text-sm tabular-nums",
23280
23482
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tbody", {
@@ -23321,11 +23523,12 @@ function RequestDetail({ id }) {
23321
23523
  ]
23322
23524
  })
23323
23525
  })
23324
- })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
23325
- className: "text-[10px] uppercase tracking-wider text-sand-500 font-medium",
23326
- children: "Info"
23327
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
23328
- className: "mt-1.5 rounded-lg bg-sand-50 px-5 py-4",
23526
+ })
23527
+ }),
23528
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Section, {
23529
+ title: "Info",
23530
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
23531
+ className: "rounded-lg bg-sand-50 px-5 py-4",
23329
23532
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("table", {
23330
23533
  className: "w-full text-sm",
23331
23534
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tbody", {
@@ -23355,7 +23558,7 @@ function RequestDetail({ id }) {
23355
23558
  ]
23356
23559
  })
23357
23560
  })
23358
- })] })]
23561
+ })
23359
23562
  }),
23360
23563
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "pb-8" })
23361
23564
  ]
@@ -1,6 +1,7 @@
1
1
  import { S as require_react, b as useQueryClient, c as array, d as custom, f as date, g as string, h as object, i as SonamuQueryMode, l as bigint, m as number, nt as __toESM, o as zArrayable, p as int, s as _enum, u as boolean, x as require_jsx_runtime } from "./sd.generated-BeEKgSOs.js";
2
2
  import { r as TokenService, t as QgridService } from "./services.generated-DjxCLdMu.js";
3
3
  import { a as lucideKeyRound, i as mn, r as m5 } from "../entry-server.generated.js";
4
+ import { n as lucideCheck, t as lucideCopy } from "./copy-C9YkjJVm.js";
4
5
  //#region ~icons/lucide/eye.jsx
5
6
  var import_react = /* @__PURE__ */ __toESM(require_react());
6
7
  var import_jsx_runtime = require_jsx_runtime();
@@ -313,45 +314,6 @@ function AddTokenModal() {
313
314
  })] });
314
315
  }
315
316
  //#endregion
316
- //#region ~icons/lucide/check.jsx
317
- var lucideCheck = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
318
- viewBox: "0 0 24 24",
319
- width: "1.2em",
320
- height: "1.2em",
321
- ...props,
322
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
323
- fill: "none",
324
- stroke: "currentColor",
325
- strokeLinecap: "round",
326
- strokeLinejoin: "round",
327
- strokeWidth: 2,
328
- d: "M20 6L9 17l-5-5"
329
- })
330
- });
331
- //#endregion
332
- //#region ~icons/lucide/copy.jsx
333
- var lucideCopy = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
334
- viewBox: "0 0 24 24",
335
- width: "1.2em",
336
- height: "1.2em",
337
- ...props,
338
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
339
- fill: "none",
340
- stroke: "currentColor",
341
- strokeLinecap: "round",
342
- strokeLinejoin: "round",
343
- strokeWidth: 2,
344
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", {
345
- width: 14,
346
- height: 14,
347
- x: 8,
348
- y: 8,
349
- rx: 2,
350
- ry: 2
351
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })]
352
- })
353
- });
354
- //#endregion
355
317
  //#region ~icons/lucide/pencil.jsx
356
318
  var lucidePencil = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
357
319
  viewBox: "0 0 24 24",
@@ -42625,7 +42625,7 @@ function RootComponent() {
42625
42625
  }
42626
42626
  //#endregion
42627
42627
  //#region src/routes/tokens.tsx
42628
- var $$splitComponentImporter$3 = () => import("./assets/tokens-BYhGItkk.js");
42628
+ var $$splitComponentImporter$3 = () => import("./assets/tokens-BWmL4GfT.js");
42629
42629
  var Route$3 = createFileRoute("/tokens")({ component: lazyRouteComponent($$splitComponentImporter$3, "component") });
42630
42630
  //#endregion
42631
42631
  //#region src/routes/logs.tsx
@@ -42641,7 +42641,7 @@ var $$splitComponentImporter$1 = () => import("./assets/routes-qwzTPLE2.js");
42641
42641
  var Route$1 = createFileRoute("/")({ component: lazyRouteComponent($$splitComponentImporter$1, "component") });
42642
42642
  //#endregion
42643
42643
  //#region src/routes/requests/show.tsx
42644
- var $$splitComponentImporter = () => import("./assets/show-Btv2c6zd.js");
42644
+ var $$splitComponentImporter = () => import("./assets/show-CvoILmu3.js");
42645
42645
  var showSearchSchema = object({ id: number() });
42646
42646
  var Route = createFileRoute("/requests/show")({
42647
42647
  validateSearch: showSearchSchema,
package/dist/cli.js CHANGED
@@ -20,9 +20,10 @@ program.name("qgrid").version(pkg.version).description("Qgrid — LLM subscripti
20
20
  if (!opts.skipUpdate) {
21
21
  const latest = execSync("npm view @cartanova/qgrid-cli version", { encoding: "utf-8" }).trim();
22
22
  if (latest !== pkg.version) {
23
- console.log(`@@Updating qgrid-cli: ${pkg.version} ${latest}@@`);
24
- execSync("npm i -g @cartanova/qgrid-cli@latest", { stdio: "inherit" });
25
- console.log("@@Updated. Restarting...\n@@");
23
+ const installCmd = process.env.npm_config_user_agent?.includes("pnpm") || execSync("which qgrid", { encoding: "utf-8" }).includes("pnpm") ? "pnpm add -g @cartanova/qgrid-cli@latest" : "npm i -g @cartanova/qgrid-cli@latest";
24
+ console.log(`Updating qgrid-cli: ${pkg.version} ${latest}`);
25
+ execSync(installCmd, { stdio: "inherit" });
26
+ console.log("Updated. Restarting...\n");
26
27
  execSync(`qgrid ${process.argv.slice(2).concat("--skip-update").join(" ")}`, { stdio: "inherit" });
27
28
  process.exit(0);
28
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cartanova/qgrid-cli",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cartanova-ai/qgrid"