@tonyclaw/llm-inspector 1.10.0 → 1.11.0

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 (74) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/index-BIZeMR5N.js +105 -0
  3. package/.output/public/assets/index-SmtLx1lM.css +1 -0
  4. package/.output/public/assets/main-QfbQ5oBP.js +17 -0
  5. package/.output/server/_libs/@radix-ui/react-use-controllable-state+[...].mjs +1 -1
  6. package/.output/server/_libs/ajv-formats.mjs +18 -18
  7. package/.output/server/_libs/ajv.mjs +6306 -942
  8. package/.output/server/_libs/cookie-es.mjs +21 -7
  9. package/.output/server/_libs/diff.mjs +320 -0
  10. package/.output/server/_libs/floating-ui__core.mjs +17 -18
  11. package/.output/server/_libs/floating-ui__dom.mjs +20 -24
  12. package/.output/server/_libs/floating-ui__react-dom.mjs +28 -55
  13. package/.output/server/_libs/floating-ui__utils.mjs +36 -36
  14. package/.output/server/_libs/h3-v2.mjs +9 -20
  15. package/.output/server/_libs/isbot.mjs +2 -3
  16. package/.output/server/_libs/json-schema-traverse.mjs +90 -1
  17. package/.output/server/_libs/jszip.mjs +28 -28
  18. package/.output/server/_libs/lucide-react.mjs +103 -80
  19. package/.output/server/_libs/mdast-util-from-markdown.mjs +1 -1
  20. package/.output/server/_libs/pako.mjs +13 -13
  21. package/.output/server/_libs/property-information.mjs +1 -13
  22. package/.output/server/_libs/radix-ui__react-collection.mjs +1 -1
  23. package/.output/server/_libs/radix-ui__react-id.mjs +1 -1
  24. package/.output/server/_libs/react-dom.mjs +10 -10
  25. package/.output/server/_libs/react.mjs +44 -44
  26. package/.output/server/_libs/readable-stream.mjs +15 -15
  27. package/.output/server/_libs/rou3.mjs +7 -1
  28. package/.output/server/_libs/safe-buffer.mjs +3 -3
  29. package/.output/server/_libs/semver.mjs +10 -10
  30. package/.output/server/_libs/seroval-plugins.mjs +5 -5
  31. package/.output/server/_libs/seroval.mjs +596 -606
  32. package/.output/server/_libs/srvx.mjs +245 -10
  33. package/.output/server/_libs/swr.mjs +1 -1
  34. package/.output/server/_libs/tailwind-merge.mjs +41 -286
  35. package/.output/server/_libs/tanstack__history.mjs +44 -31
  36. package/.output/server/_libs/tanstack__react-router.mjs +1089 -780
  37. package/.output/server/_libs/tanstack__react-store.mjs +1 -1
  38. package/.output/server/_libs/tanstack__react-virtual.mjs +7 -82
  39. package/.output/server/_libs/tanstack__router-core.mjs +2331 -2226
  40. package/.output/server/_libs/tanstack__virtual-core.mjs +17 -58
  41. package/.output/server/_libs/tiny-invariant.mjs +12 -0
  42. package/.output/server/_libs/tiny-warning.mjs +5 -0
  43. package/.output/server/_libs/ungap__structured-clone.mjs +2 -14
  44. package/.output/server/_libs/use-sync-external-store.mjs +1 -1
  45. package/.output/server/_libs/zod.mjs +207 -505
  46. package/.output/server/_ssr/{index-XyU4WVWt.mjs → index-I_Nx8QEB.mjs} +532 -79
  47. package/.output/server/_ssr/index.mjs +776 -1098
  48. package/.output/server/_ssr/{router-BR4XO8XJ.mjs → router-BVxfVFsb.mjs} +98 -53
  49. package/.output/server/_tanstack-start-manifest_v-Cm2Owszu.mjs +4 -0
  50. package/.output/server/index.mjs +28 -28
  51. package/README.md +1 -1
  52. package/package.json +2 -1
  53. package/src/components/ProxyViewer.tsx +10 -3
  54. package/src/components/ProxyViewerContainer.tsx +6 -0
  55. package/src/components/proxy-viewer/ConversationGroup.tsx +10 -1
  56. package/src/components/proxy-viewer/LogEntry.tsx +114 -5
  57. package/src/components/proxy-viewer/diff/DiffView.tsx +319 -0
  58. package/src/components/proxy-viewer/diff/computeDiff.ts +178 -0
  59. package/src/components/proxy-viewer/diff/index.ts +3 -0
  60. package/src/components/ui/crab-logo.tsx +45 -0
  61. package/src/proxy/config.ts +3 -17
  62. package/src/proxy/dataDir.ts +56 -0
  63. package/src/proxy/formats/anthropic/stream.ts +5 -2
  64. package/src/proxy/formats/jsonSchema.ts +12 -0
  65. package/src/proxy/formats/openai/stream.ts +21 -16
  66. package/src/proxy/handler.ts +15 -5
  67. package/src/proxy/providers.ts +61 -1
  68. package/src/proxy/schemas.ts +42 -0
  69. package/src/proxy/store.ts +6 -23
  70. package/.output/public/assets/index-BFuUQkWu.js +0 -11
  71. package/.output/public/assets/index-F2ojFPJp.css +0 -1
  72. package/.output/public/assets/index-nKnhyW4Y.js +0 -122
  73. package/.output/server/_ssr/empty-plugin-adapters-BFgPZ6_d.mjs +0 -6
  74. package/.output/server/_tanstack-start-manifest_v-DFoSjBkb.mjs +0 -4
@@ -1,34 +1,39 @@
1
- var stateIndexKey = "__TSR_index";
1
+ const stateIndexKey = "__TSR_index";
2
2
  function createHistory(opts) {
3
3
  let location = opts.getLocation();
4
4
  const subscribers = /* @__PURE__ */ new Set();
5
5
  const notify = (action) => {
6
6
  location = opts.getLocation();
7
- subscribers.forEach((subscriber) => subscriber({
8
- location,
9
- action
10
- }));
7
+ subscribers.forEach((subscriber) => subscriber({ location, action }));
11
8
  };
12
9
  const handleIndexChange = (action) => {
13
10
  if (opts.notifyOnIndexChange ?? true) notify(action);
14
11
  else location = opts.getLocation();
15
12
  };
16
- const tryNavigation = async ({ task, navigateOpts, ...actionInfo }) => {
17
- if (navigateOpts?.ignoreBlocker ?? false) {
13
+ const tryNavigation = async ({
14
+ task,
15
+ navigateOpts,
16
+ ...actionInfo
17
+ }) => {
18
+ const ignoreBlocker = navigateOpts?.ignoreBlocker ?? false;
19
+ if (ignoreBlocker) {
18
20
  task();
19
21
  return;
20
22
  }
21
23
  const blockers = opts.getBlockers?.() ?? [];
22
24
  const isPushOrReplace = actionInfo.type === "PUSH" || actionInfo.type === "REPLACE";
23
- if (typeof document !== "undefined" && blockers.length && isPushOrReplace) for (const blocker of blockers) {
24
- const nextLocation = parseHref(actionInfo.path, actionInfo.state);
25
- if (await blocker.blockerFn({
26
- currentLocation: location,
27
- nextLocation,
28
- action: actionInfo.type
29
- })) {
30
- opts.onBlocked?.();
31
- return;
25
+ if (typeof document !== "undefined" && blockers.length && isPushOrReplace) {
26
+ for (const blocker of blockers) {
27
+ const nextLocation = parseHref(actionInfo.path, actionInfo.state);
28
+ const isBlocked = await blocker.blockerFn({
29
+ currentLocation: location,
30
+ nextLocation,
31
+ action: actionInfo.type
32
+ });
33
+ if (isBlocked) {
34
+ opts.onBlocked?.();
35
+ return;
36
+ }
32
37
  }
33
38
  }
34
39
  task();
@@ -79,10 +84,7 @@ function createHistory(opts) {
79
84
  tryNavigation({
80
85
  task: () => {
81
86
  opts.go(index);
82
- handleIndexChange({
83
- type: "GO",
84
- index
85
- });
87
+ handleIndexChange({ type: "GO", index });
86
88
  },
87
89
  navigateOpts,
88
90
  type: "GO"
@@ -126,19 +128,26 @@ function createHistory(opts) {
126
128
  };
127
129
  }
128
130
  function assignKeyAndIndex(index, state) {
129
- if (!state) state = {};
131
+ if (!state) {
132
+ state = {};
133
+ }
130
134
  const key = createRandomKey();
131
135
  return {
132
136
  ...state,
133
137
  key,
138
+ // TODO: Remove in v2 - use __TSR_key instead
134
139
  __TSR_key: key,
135
140
  [stateIndexKey]: index
136
141
  };
137
142
  }
138
- function createMemoryHistory(opts = { initialEntries: ["/"] }) {
143
+ function createMemoryHistory(opts = {
144
+ initialEntries: ["/"]
145
+ }) {
139
146
  const entries = opts.initialEntries;
140
147
  let index = opts.initialIndex ? Math.min(Math.max(opts.initialIndex, 0), entries.length - 1) : entries.length - 1;
141
- const states = entries.map((_entry, index2) => assignKeyAndIndex(index2, void 0));
148
+ const states = entries.map(
149
+ (_entry, index2) => assignKeyAndIndex(index2, void 0)
150
+ );
142
151
  const getLocation = () => parseHref(entries[index], states[index]);
143
152
  let blockers = [];
144
153
  const _getBlockers = () => blockers;
@@ -175,7 +184,9 @@ function createMemoryHistory(opts = { initialEntries: ["/"] }) {
175
184
  }
176
185
  function sanitizePath(path) {
177
186
  let sanitized = path.replace(/[\x00-\x1f\x7f]/g, "");
178
- if (sanitized.startsWith("//")) sanitized = "/" + sanitized.replace(/^\/+/, "");
187
+ if (sanitized.startsWith("//")) {
188
+ sanitized = "/" + sanitized.replace(/^\/+/, "");
189
+ }
179
190
  return sanitized;
180
191
  }
181
192
  function parseHref(href, state) {
@@ -185,14 +196,16 @@ function parseHref(href, state) {
185
196
  const addedKey = createRandomKey();
186
197
  return {
187
198
  href: sanitizedHref,
188
- pathname: sanitizedHref.substring(0, hashIndex > 0 ? searchIndex > 0 ? Math.min(hashIndex, searchIndex) : hashIndex : searchIndex > 0 ? searchIndex : sanitizedHref.length),
199
+ pathname: sanitizedHref.substring(
200
+ 0,
201
+ hashIndex > 0 ? searchIndex > 0 ? Math.min(hashIndex, searchIndex) : hashIndex : searchIndex > 0 ? searchIndex : sanitizedHref.length
202
+ ),
189
203
  hash: hashIndex > -1 ? sanitizedHref.substring(hashIndex) : "",
190
- search: searchIndex > -1 ? sanitizedHref.slice(searchIndex, hashIndex === -1 ? void 0 : hashIndex) : "",
191
- state: state || {
192
- [stateIndexKey]: 0,
193
- key: addedKey,
194
- __TSR_key: addedKey
195
- }
204
+ search: searchIndex > -1 ? sanitizedHref.slice(
205
+ searchIndex,
206
+ hashIndex === -1 ? void 0 : hashIndex
207
+ ) : "",
208
+ state: state || { [stateIndexKey]: 0, key: addedKey, __TSR_key: addedKey }
196
209
  };
197
210
  }
198
211
  function createRandomKey() {