shiplightai 0.1.84 → 0.1.86

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.
@@ -29598,30 +29598,54 @@ const useSWRHandler = (_key, fetcher2, config2) => {
29598
29598
  return swrResponse;
29599
29599
  };
29600
29600
  const useSWR = withArgs(useSWRHandler);
29601
+ const SESSION_PREFIX_RE = /^(\/debugger\/[^/]+)(?:\/|$)/;
29602
+ function getApiBase() {
29603
+ if (typeof window === "undefined") return "";
29604
+ const locMatch = window.location.pathname.match(SESSION_PREFIX_RE);
29605
+ if (locMatch) return locMatch[1];
29606
+ if (typeof document !== "undefined" && document.baseURI) {
29607
+ try {
29608
+ const baseMatch = new URL(document.baseURI).pathname.match(SESSION_PREFIX_RE);
29609
+ if (baseMatch) return baseMatch[1];
29610
+ } catch {
29611
+ }
29612
+ }
29613
+ return "";
29614
+ }
29615
+ function apiUrl(path) {
29616
+ const base = getApiBase();
29617
+ if (!base) return path;
29618
+ if (!path.startsWith("/")) return path;
29619
+ if (/^https?:\/\//i.test(path)) return path;
29620
+ if (path === base || path.startsWith(`${base}/`)) return path;
29621
+ return `${base}${path}`;
29622
+ }
29601
29623
  const fetcher = {
29602
29624
  async get(url, options = {}) {
29603
29625
  const { headers = {}, timeout = 1e4, errMsg } = options;
29626
+ const resolved = apiUrl(url);
29604
29627
  try {
29605
- const response = await fetch(url, {
29628
+ const response = await fetch(resolved, {
29606
29629
  headers: {
29607
29630
  ...headers
29608
29631
  },
29609
29632
  signal: AbortSignal.timeout(timeout)
29610
29633
  });
29611
29634
  if (!response.ok) {
29612
- throw new Error(errMsg || url + ` error! status: ${response.status}`);
29635
+ throw new Error(errMsg || resolved + ` error! status: ${response.status}`);
29613
29636
  }
29614
29637
  const data = await response.json();
29615
29638
  return data;
29616
29639
  } catch (error) {
29617
- console.error(`[Fetcher] Error fetching ${url}:`, error);
29640
+ console.error(`[Fetcher] Error fetching ${resolved}:`, error);
29618
29641
  throw error;
29619
29642
  }
29620
29643
  },
29621
29644
  async post(url, data, options = {}) {
29622
29645
  const { headers = {}, timeout = 3e4, errMsg } = options;
29646
+ const resolved = apiUrl(url);
29623
29647
  try {
29624
- const response = await fetch(url, {
29648
+ const response = await fetch(resolved, {
29625
29649
  method: "POST",
29626
29650
  headers: {
29627
29651
  "Content-Type": "application/json",
@@ -29635,14 +29659,15 @@ const fetcher = {
29635
29659
  }
29636
29660
  return response.json();
29637
29661
  } catch (error) {
29638
- console.error(`[Fetcher] Error posting to ${url}:`, error);
29662
+ console.error(`[Fetcher] Error posting to ${resolved}:`, error);
29639
29663
  throw error;
29640
29664
  }
29641
29665
  },
29642
29666
  async put(url, data, options = {}) {
29643
29667
  const { headers = {}, timeout = 3e4, errMsg } = options;
29668
+ const resolved = apiUrl(url);
29644
29669
  try {
29645
- const response = await fetch(url, {
29670
+ const response = await fetch(resolved, {
29646
29671
  method: "PUT",
29647
29672
  headers: {
29648
29673
  "Content-Type": "application/json",
@@ -29652,18 +29677,19 @@ const fetcher = {
29652
29677
  signal: AbortSignal.timeout(timeout)
29653
29678
  });
29654
29679
  if (!response.ok) {
29655
- throw new Error(errMsg || url + ` error! status: ${response.status}`);
29680
+ throw new Error(errMsg || resolved + ` error! status: ${response.status}`);
29656
29681
  }
29657
29682
  return response.json();
29658
29683
  } catch (error) {
29659
- console.error(`[Fetcher] Error putting to ${url}:`, error);
29684
+ console.error(`[Fetcher] Error putting to ${resolved}:`, error);
29660
29685
  throw error;
29661
29686
  }
29662
29687
  },
29663
29688
  async patch(url, data, options = {}) {
29664
29689
  const { headers = {}, timeout = 3e4, errMsg } = options;
29690
+ const resolved = apiUrl(url);
29665
29691
  try {
29666
- const response = await fetch(url, {
29692
+ const response = await fetch(resolved, {
29667
29693
  method: "PATCH",
29668
29694
  headers: {
29669
29695
  "Content-Type": "application/json",
@@ -29673,18 +29699,19 @@ const fetcher = {
29673
29699
  signal: AbortSignal.timeout(timeout)
29674
29700
  });
29675
29701
  if (!response.ok) {
29676
- throw new Error(errMsg || url + ` error! status: ${response.status}`);
29702
+ throw new Error(errMsg || resolved + ` error! status: ${response.status}`);
29677
29703
  }
29678
29704
  return response.json();
29679
29705
  } catch (error) {
29680
- console.error(`[Fetcher] Error patching ${url}:`, error);
29706
+ console.error(`[Fetcher] Error patching ${resolved}:`, error);
29681
29707
  throw error;
29682
29708
  }
29683
29709
  },
29684
29710
  async delete(url, data = {}, options = {}) {
29685
29711
  const { headers = {}, timeout = 3e4, errMsg } = options;
29712
+ const resolved = apiUrl(url);
29686
29713
  try {
29687
- const response = await fetch(url, {
29714
+ const response = await fetch(resolved, {
29688
29715
  method: "DELETE",
29689
29716
  headers: {
29690
29717
  "Content-Type": "application/json",
@@ -29694,11 +29721,11 @@ const fetcher = {
29694
29721
  signal: AbortSignal.timeout(timeout)
29695
29722
  });
29696
29723
  if (!response.ok) {
29697
- throw new Error(errMsg || url + ` error! status: ${response.status}`);
29724
+ throw new Error(errMsg || resolved + ` error! status: ${response.status}`);
29698
29725
  }
29699
29726
  return response.json();
29700
29727
  } catch (error) {
29701
- console.error(`[Fetcher] Error deleting at ${url}:`, error);
29728
+ console.error(`[Fetcher] Error deleting at ${resolved}:`, error);
29702
29729
  throw error;
29703
29730
  }
29704
29731
  }
@@ -188634,7 +188661,7 @@ function dynamic(importFn, _options) {
188634
188661
  );
188635
188662
  return Wrapper;
188636
188663
  }
188637
- const MonacoEditor = dynamic(() => __vitePreload(() => import("./index-dPxSGq_T.js"), true ? [] : void 0), {});
188664
+ const MonacoEditor = dynamic(() => __vitePreload(() => import("./index-CMdPZNG2.js"), true ? [] : void 0), {});
188638
188665
  const CodeEditor = ({
188639
188666
  initialCode = "",
188640
188667
  onConfirm,
@@ -189177,27 +189204,6 @@ const FunctionEditor = ({
189177
189204
  )
189178
189205
  ] });
189179
189206
  };
189180
- const SESSION_PREFIX_RE = /^(\/debugger\/[^/]+)(?:\/|$)/;
189181
- const API_BASE = computeApiBase();
189182
- function computeApiBase() {
189183
- if (typeof window === "undefined") return "";
189184
- const locMatch = window.location.pathname.match(SESSION_PREFIX_RE);
189185
- if (locMatch) return locMatch[1];
189186
- if (typeof document !== "undefined" && document.baseURI) {
189187
- try {
189188
- const baseMatch = new URL(document.baseURI).pathname.match(SESSION_PREFIX_RE);
189189
- if (baseMatch) return baseMatch[1];
189190
- } catch {
189191
- }
189192
- }
189193
- return "";
189194
- }
189195
- function apiUrl(path) {
189196
- if (!API_BASE) return path;
189197
- if (!path.startsWith("/")) return path;
189198
- if (/^https?:\/\//i.test(path)) return path;
189199
- return `${API_BASE}${path}`;
189200
- }
189201
189207
  function readAsBase64(file) {
189202
189208
  return new Promise((resolve, reject) => {
189203
189209
  const reader = new FileReader();
@@ -201549,6 +201555,30 @@ function LocalDebuggerPage() {
201549
201555
  ] })
201550
201556
  ] });
201551
201557
  }
201558
+ function rewrite(input) {
201559
+ if (typeof input === "string") {
201560
+ return input.startsWith("/api/") ? apiUrl(input) : input;
201561
+ }
201562
+ if (input instanceof URL) {
201563
+ const sameOrigin = typeof window !== "undefined" && input.origin === window.location.origin;
201564
+ if (sameOrigin && input.pathname.startsWith("/api/")) {
201565
+ const next = new URL(input.href);
201566
+ next.pathname = apiUrl(next.pathname);
201567
+ return next;
201568
+ }
201569
+ return input;
201570
+ }
201571
+ return input;
201572
+ }
201573
+ function installApiFetchInterceptor() {
201574
+ if (typeof window === "undefined") return;
201575
+ const current = window.fetch;
201576
+ if (current.__apiInterceptor) return;
201577
+ const original = current.bind(window);
201578
+ const patched = (input, init) => original(rewrite(input), init);
201579
+ patched.__apiInterceptor = true;
201580
+ window.fetch = patched;
201581
+ }
201552
201582
  const Common = { "save": "Save", "saveChanges": "Save Changes", "apply": "Apply", "cancel": "Cancel", "loading": "Loading...", "error": "Error", "success": "Success", "createNew": "Create New", "delete": "Delete", "edit": "Edit", "close": "Close", "confirm": "Confirm", "back": "Back", "next": "Next", "submit": "Submit", "search": "Search", "filter": "Filter", "sort": "Sort", "noResults": "No results found", "noOptions": "No options available", "required": "Required", "clear": "Clear", "clearAllFilters": "Clear all filters", "saveAsNew": "Save as new", "or": "Or", "duplicate": "Duplicate", "active": "Active", "draft": "Draft", "copied": "Copied!", "copiedToClipboard": "Copied to clipboard", "failedToCopyUrl": "Failed to copy URL", "filterSearchPlaceholder": "Search...", "filterPlaceholder": "Filter...", "filterIs": "is", "filterIsAnyOf": "is any of", "setByCurrentView": "Set by current view", "noFiltersFound": "No filters found", "addLabels": "Add labels", "searchOrCreateLabels": "Search or Create labels...", "noLabelsFound": "No labels found", "noLabelsAvailable": "No labels available", "moreLabels": "+{count} labels", "pickerLabelColor": "Picker label color...", "createNamed": 'Create "{name}"', "noMatchingDirectoriesFound": "No matching directories found", "selectDirectory": "Select directory...", "itemsSelected": "{count} items selected", "failedToFetchSensitiveValue": "Failed to fetch sensitive value", "enterTag": "Enter tag", "createNewItem": "Create New Item", "noItemsAvailable": "No items available", "selectPlaceholder": "Select...", "clearAllSelections": "Clear all selections", "noImageAvailable": "No image available", "imageAlt": "Image", "none": "None", "selectEnvironment": "Select environment", "clickToAddText": "Click to add text", "disabled": "Disabled", "beforeTest": "Before Test", "afterTest": "After Test", "saving": "Saving", "recordCount": "{count} {label}{count, plural, one {} other {s}}" };
201553
201583
  const ThemeToggle = { "light": "Light", "lightTheme": "Light theme", "dark": "Dark", "darkTheme": "Dark theme", "auto": "Auto", "followSystemPreference": "Follow system preference" };
201554
201584
  const LocaleToggle = { "en": "EN", "zhCN": "中文" };
@@ -201637,6 +201667,7 @@ const enMessages = {
201637
201667
  AutoFix,
201638
201668
  QA
201639
201669
  };
201670
+ installApiFetchInterceptor();
201640
201671
  const theme = createTheme(LoggiaTheme);
201641
201672
  function App() {
201642
201673
  return /* @__PURE__ */ jsxRuntimeExports.jsx(t, { locale: "en", messages: enMessages, timeZone: "UTC", children: /* @__PURE__ */ jsxRuntimeExports.jsx(MantineProvider, { theme, forceColorScheme: "dark", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeProvider, { defaultTheme: "dark", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AuthProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(LocalDebuggerPage, {}) }) }) }) });
@@ -201652,4 +201683,4 @@ export {
201652
201683
  We as W,
201653
201684
  reactExports as r
201654
201685
  };
201655
- //# sourceMappingURL=index-DEDW0aC5.js.map
201686
+ //# sourceMappingURL=index-Bcj9zYt-.js.map
@@ -1,4 +1,4 @@
1
- import { r as reactExports, W as We } from "./index-DEDW0aC5.js";
1
+ import { r as reactExports, W as We } from "./index-Bcj9zYt-.js";
2
2
  function _defineProperty$1(obj, key, value) {
3
3
  if (key in obj) {
4
4
  Object.defineProperty(obj, key, {
@@ -649,4 +649,4 @@ export {
649
649
  loader,
650
650
  Le as useMonaco
651
651
  };
652
- //# sourceMappingURL=index-dPxSGq_T.js.map
652
+ //# sourceMappingURL=index-CMdPZNG2.js.map
@@ -8,7 +8,7 @@
8
8
  /* Prevent FOUC */
9
9
  body { margin: 0; background: #1a1b1e; color: #c1c2c5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; }
10
10
  </style>
11
- <script type="module" crossorigin src="/assets/index-DEDW0aC5.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-Bcj9zYt-.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="/assets/index-CrXycucL.css">
13
13
  </head>
14
14
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shiplightai",
3
- "version": "0.1.84",
3
+ "version": "0.1.86",
4
4
  "type": "module",
5
5
  "description": "Shiplight CLI for running and debugging .test.yaml files",
6
6
  "main": "dist/index.js",
@@ -98,8 +98,8 @@
98
98
  "tsup": "^8.3.5",
99
99
  "typescript": "5.5.4",
100
100
  "mcp-tools": "1.0.0",
101
- "sdk-internal": "0.1.1",
102
101
  "sdk-core": "0.1.0",
102
+ "sdk-internal": "0.1.1",
103
103
  "shiplight-tools": "1.0.0",
104
104
  "shiplight-types": "0.1.0"
105
105
  },