@warmdrift/kgauto-compiler 2.0.0-alpha.7 → 2.0.0-alpha.70

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 (55) hide show
  1. package/README.md +176 -46
  2. package/dist/brain-proxy.d.mts +113 -0
  3. package/dist/brain-proxy.d.ts +113 -0
  4. package/dist/brain-proxy.js +193 -0
  5. package/dist/brain-proxy.mjs +6 -0
  6. package/dist/chunk-4UO4CCSP.mjs +1620 -0
  7. package/dist/chunk-65ZMX5OT.mjs +169 -0
  8. package/dist/{chunk-5TI6PNSK.mjs → chunk-BVEXV5KC.mjs} +11 -0
  9. package/dist/chunk-FR4DNGLW.mjs +203 -0
  10. package/dist/chunk-NBO4R5PC.mjs +313 -0
  11. package/dist/chunk-P3TOAEG4.mjs +56 -0
  12. package/dist/chunk-RO22VFIF.mjs +29 -0
  13. package/dist/chunk-SBFSYCQG.mjs +719 -0
  14. package/dist/dialect.d.mts +41 -3
  15. package/dist/dialect.d.ts +41 -3
  16. package/dist/dialect.js +14 -2
  17. package/dist/dialect.mjs +5 -3
  18. package/dist/glassbox/index.d.mts +59 -0
  19. package/dist/glassbox/index.d.ts +59 -0
  20. package/dist/glassbox/index.js +312 -0
  21. package/dist/glassbox/index.mjs +12 -0
  22. package/dist/glassbox-routes/format.d.mts +24 -0
  23. package/dist/glassbox-routes/format.d.ts +24 -0
  24. package/dist/glassbox-routes/format.js +86 -0
  25. package/dist/glassbox-routes/format.mjs +18 -0
  26. package/dist/glassbox-routes/index.d.mts +191 -0
  27. package/dist/glassbox-routes/index.d.ts +191 -0
  28. package/dist/glassbox-routes/index.js +2888 -0
  29. package/dist/glassbox-routes/index.mjs +667 -0
  30. package/dist/glassbox-routes/react/index.d.mts +74 -0
  31. package/dist/glassbox-routes/react/index.d.ts +74 -0
  32. package/dist/glassbox-routes/react/index.js +819 -0
  33. package/dist/glassbox-routes/react/index.mjs +754 -0
  34. package/dist/index.d.mts +2739 -17
  35. package/dist/index.d.ts +2739 -17
  36. package/dist/index.js +8989 -1659
  37. package/dist/index.mjs +5078 -367
  38. package/dist/ir-Bqn1RVdV.d.mts +1583 -0
  39. package/dist/ir-Bvlkw5ja.d.ts +1583 -0
  40. package/dist/key-health.d.mts +131 -0
  41. package/dist/key-health.d.ts +131 -0
  42. package/dist/key-health.js +228 -0
  43. package/dist/key-health.mjs +6 -0
  44. package/dist/profiles.d.mts +292 -2
  45. package/dist/profiles.d.ts +292 -2
  46. package/dist/profiles.js +1231 -16
  47. package/dist/profiles.mjs +9 -1
  48. package/dist/types-Bon96eyc.d.ts +131 -0
  49. package/dist/types-CwGhacGT.d.mts +149 -0
  50. package/dist/types-DIxRZ3Dj.d.ts +149 -0
  51. package/dist/types-DsEq35WY.d.mts +131 -0
  52. package/package.json +54 -8
  53. package/dist/chunk-MBEI5UOM.mjs +0 -409
  54. package/dist/profiles-B3eNQ2py.d.ts +0 -619
  55. package/dist/profiles-Py8c7zjJ.d.mts +0 -619
@@ -0,0 +1,56 @@
1
+ // src/glassbox-routes/format.ts
2
+ function formatAgo(iso, now = Date.now()) {
3
+ const t = Date.parse(iso);
4
+ if (Number.isNaN(t)) return iso;
5
+ const sec = Math.max(0, Math.floor((now - t) / 1e3));
6
+ if (sec < 60) return `${sec}s ago`;
7
+ if (sec < 3600) return `${Math.floor(sec / 60)}m ago`;
8
+ if (sec < 86400) return `${Math.floor(sec / 3600)}h ago`;
9
+ return `${Math.floor(sec / 86400)}d ago`;
10
+ }
11
+ function shortTraceId(traceId) {
12
+ return traceId.slice(-6);
13
+ }
14
+ function formatCost(usd) {
15
+ if (usd === void 0 || usd === null || Number.isNaN(usd)) return "\u2014";
16
+ if (usd === 0) return "$0.0000";
17
+ if (usd < 0.01) return `$${usd.toFixed(4)}`;
18
+ return `$${usd.toFixed(3)}`;
19
+ }
20
+ function formatMs(ms) {
21
+ if (ms === void 0 || ms === null) return "\u2014";
22
+ if (ms < 1e3) return `${ms}ms`;
23
+ return `${(ms / 1e3).toFixed(1)}s`;
24
+ }
25
+ function formatOrDash(v) {
26
+ if (v === void 0 || v === null) return "\u2014";
27
+ if (typeof v === "number") return v.toLocaleString();
28
+ return v;
29
+ }
30
+ function inputRatioLabel(status) {
31
+ switch (status) {
32
+ case "green":
33
+ return "healthy";
34
+ case "yellow":
35
+ return "borderline";
36
+ case "red":
37
+ return "input-heavy";
38
+ }
39
+ }
40
+ function formatMutation(mutation) {
41
+ const m = /^(.*)-(\d+)-to-(\d+)$/.exec(mutation);
42
+ if (m) {
43
+ return `${m[1]} (${m[2]} \u2192 ${m[3]})`;
44
+ }
45
+ return mutation;
46
+ }
47
+
48
+ export {
49
+ formatAgo,
50
+ shortTraceId,
51
+ formatCost,
52
+ formatMs,
53
+ formatOrDash,
54
+ inputRatioLabel,
55
+ formatMutation
56
+ };
@@ -0,0 +1,29 @@
1
+ import {
2
+ appChannel,
3
+ getPubSub,
4
+ traceChannel
5
+ } from "./chunk-NBO4R5PC.mjs";
6
+
7
+ // src/glassbox/subscribe.ts
8
+ function emptyStream() {
9
+ return new ReadableStream({
10
+ start(controller) {
11
+ controller.close();
12
+ }
13
+ });
14
+ }
15
+ function subscribe(traceId) {
16
+ if (!traceId) return emptyStream();
17
+ return getPubSub().subscribe(traceChannel(traceId));
18
+ }
19
+ function subscribeApp({
20
+ appId
21
+ }) {
22
+ if (!appId) return emptyStream();
23
+ return getPubSub().subscribe(appChannel(appId));
24
+ }
25
+
26
+ export {
27
+ subscribe,
28
+ subscribeApp
29
+ };