@ottocode/web-sdk 0.1.290 → 0.1.292

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.
@@ -1 +1 @@
1
- {"version":3,"file":"MessageThread.d.ts","sourceRoot":"","sources":["../../../src/components/messages/MessageThread.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAe,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAmBrE,UAAU,kBAAkB;IAC3B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AA2HD,eAAO,MAAM,aAAa,0DA2cxB,CAAC"}
1
+ {"version":3,"file":"MessageThread.d.ts","sourceRoot":"","sources":["../../../src/components/messages/MessageThread.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAe,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAmBrE,UAAU,kBAAkB;IAC3B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AA0JD,eAAO,MAAM,aAAa,0DA2cxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressUpdateRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/renderers/ProgressUpdateRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,wBAAgB,sBAAsB,CAAC,EAAE,WAAW,EAAE,EAAE,aAAa,2CAiBpE"}
1
+ {"version":3,"file":"ProgressUpdateRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/renderers/ProgressUpdateRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,wBAAgB,sBAAsB,CAAC,EAAE,WAAW,EAAE,EAAE,aAAa,2CA0BpE"}
@@ -1 +1 @@
1
- {"version":3,"file":"TodosRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/renderers/TodosRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAY7C,wBAAgB,aAAa,CAAC,EAAE,WAAW,EAAE,EAAE,aAAa,2CA+C3D"}
1
+ {"version":3,"file":"TodosRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/renderers/TodosRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAyE7C,wBAAgB,aAAa,CAAC,EAAE,WAAW,EAAE,EAAE,aAAa,2CA+C3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"SkillsSidebar.d.ts","sourceRoot":"","sources":["../../../src/components/skills/SkillsSidebar.tsx"],"names":[],"mappings":"AA8CA,eAAO,MAAM,aAAa,8CAuRxB,CAAC"}
1
+ {"version":3,"file":"SkillsSidebar.d.ts","sourceRoot":"","sources":["../../../src/components/skills/SkillsSidebar.tsx"],"names":[],"mappings":"AA8CA,eAAO,MAAM,aAAa,8CA2RxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleSwitch.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ToggleSwitch.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY;aAMf,OAAO;cACN,OAAO;cACP,MAAM,IAAI;eACT,OAAO;EA2BjB,CAAC"}
1
+ {"version":3,"file":"ToggleSwitch.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ToggleSwitch.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY;aAMf,OAAO;cACN,OAAO;cACP,MAAM,IAAI;eACT,OAAO;EAgCjB,CAAC"}
@@ -20,6 +20,68 @@ import {
20
20
  // src/lib/api-client/utils.ts
21
21
  import { client } from "@ottocode/api";
22
22
 
23
+ // src/lib/platform.ts
24
+ function getPlatformWindow() {
25
+ if (typeof window === "undefined")
26
+ return null;
27
+ return window;
28
+ }
29
+ function openPlatformUrl(url) {
30
+ const win = getPlatformWindow();
31
+ if (!win?.OTTO_OPEN_URL)
32
+ return false;
33
+ win.OTTO_OPEN_URL(url);
34
+ return true;
35
+ }
36
+ function showPlatformNotification(notification) {
37
+ const win = getPlatformWindow();
38
+ if (!win?.OTTO_SHOW_NOTIFICATION)
39
+ return false;
40
+ win.OTTO_SHOW_NOTIFICATION(notification);
41
+ return true;
42
+ }
43
+ function listPlatformSystemFonts() {
44
+ const win = getPlatformWindow();
45
+ if (!win?.OTTO_LIST_SYSTEM_FONTS)
46
+ return null;
47
+ return win.OTTO_LIST_SYSTEM_FONTS();
48
+ }
49
+ function notifyPlatformFontFamilyChanged(fontFamily) {
50
+ const win = getPlatformWindow();
51
+ if (!win?.OTTO_SET_DESKTOP_FONT)
52
+ return false;
53
+ win.OTTO_SET_DESKTOP_FONT(fontFamily);
54
+ return true;
55
+ }
56
+ function openPlatformSession(sessionId) {
57
+ const win = getPlatformWindow();
58
+ if (!win?.OTTO_OPEN_SESSION)
59
+ return false;
60
+ win.OTTO_OPEN_SESSION(sessionId);
61
+ return true;
62
+ }
63
+ function getPlatformWindowFocused() {
64
+ const win = getPlatformWindow();
65
+ if (!win?.OTTO_IS_WINDOW_FOCUSED)
66
+ return null;
67
+ return win.OTTO_IS_WINDOW_FOCUSED();
68
+ }
69
+ function hasPlatformOpenUrl() {
70
+ return !!getPlatformWindow()?.OTTO_OPEN_URL;
71
+ }
72
+ function hasPlatformSystemFonts() {
73
+ return !!getPlatformWindow()?.OTTO_LIST_SYSTEM_FONTS;
74
+ }
75
+ function isPlatformDesktop() {
76
+ if (typeof window === "undefined")
77
+ return false;
78
+ try {
79
+ return "__TAURI__" in window || "__TAURI_INTERNALS__" in window || "__TAURI_METADATA__" in window;
80
+ } catch {
81
+ return false;
82
+ }
83
+ }
84
+
23
85
  // src/lib/config.ts
24
86
  var RUNTIME_API_BASE_URL_STORAGE_KEY = "otto-api-base-url";
25
87
  function normalizeApiBaseUrl(value) {
@@ -43,6 +105,8 @@ function normalizeApiBaseUrl(value) {
43
105
  function getStoredApiBaseUrl() {
44
106
  if (typeof window === "undefined")
45
107
  return;
108
+ if (isPlatformDesktop())
109
+ return;
46
110
  try {
47
111
  return window.localStorage.getItem(RUNTIME_API_BASE_URL_STORAGE_KEY) ?? undefined;
48
112
  } catch {
@@ -74,9 +138,11 @@ function setRuntimeApiBaseUrl(value) {
74
138
  if (typeof window !== "undefined") {
75
139
  const win = window;
76
140
  win.OTTO_SERVER_URL = baseUrl;
77
- try {
78
- window.localStorage.setItem(RUNTIME_API_BASE_URL_STORAGE_KEY, baseUrl);
79
- } catch {}
141
+ if (!isPlatformDesktop()) {
142
+ try {
143
+ window.localStorage.setItem(RUNTIME_API_BASE_URL_STORAGE_KEY, baseUrl);
144
+ } catch {}
145
+ }
80
146
  }
81
147
  return baseUrl;
82
148
  }
@@ -1261,70 +1327,6 @@ function useUpdateDefaults() {
1261
1327
  }
1262
1328
  // src/hooks/usePreferences.ts
1263
1329
  import { useCallback, useEffect, useMemo } from "react";
1264
-
1265
- // src/lib/platform.ts
1266
- function getPlatformWindow() {
1267
- if (typeof window === "undefined")
1268
- return null;
1269
- return window;
1270
- }
1271
- function openPlatformUrl(url) {
1272
- const win = getPlatformWindow();
1273
- if (!win?.OTTO_OPEN_URL)
1274
- return false;
1275
- win.OTTO_OPEN_URL(url);
1276
- return true;
1277
- }
1278
- function showPlatformNotification(notification) {
1279
- const win = getPlatformWindow();
1280
- if (!win?.OTTO_SHOW_NOTIFICATION)
1281
- return false;
1282
- win.OTTO_SHOW_NOTIFICATION(notification);
1283
- return true;
1284
- }
1285
- function listPlatformSystemFonts() {
1286
- const win = getPlatformWindow();
1287
- if (!win?.OTTO_LIST_SYSTEM_FONTS)
1288
- return null;
1289
- return win.OTTO_LIST_SYSTEM_FONTS();
1290
- }
1291
- function notifyPlatformFontFamilyChanged(fontFamily) {
1292
- const win = getPlatformWindow();
1293
- if (!win?.OTTO_SET_DESKTOP_FONT)
1294
- return false;
1295
- win.OTTO_SET_DESKTOP_FONT(fontFamily);
1296
- return true;
1297
- }
1298
- function openPlatformSession(sessionId) {
1299
- const win = getPlatformWindow();
1300
- if (!win?.OTTO_OPEN_SESSION)
1301
- return false;
1302
- win.OTTO_OPEN_SESSION(sessionId);
1303
- return true;
1304
- }
1305
- function getPlatformWindowFocused() {
1306
- const win = getPlatformWindow();
1307
- if (!win?.OTTO_IS_WINDOW_FOCUSED)
1308
- return null;
1309
- return win.OTTO_IS_WINDOW_FOCUSED();
1310
- }
1311
- function hasPlatformOpenUrl() {
1312
- return !!getPlatformWindow()?.OTTO_OPEN_URL;
1313
- }
1314
- function hasPlatformSystemFonts() {
1315
- return !!getPlatformWindow()?.OTTO_LIST_SYSTEM_FONTS;
1316
- }
1317
- function isPlatformDesktop() {
1318
- if (typeof window === "undefined")
1319
- return false;
1320
- try {
1321
- return "__TAURI__" in window || "__TAURI_INTERNALS__" in window || "__TAURI_METADATA__" in window;
1322
- } catch {
1323
- return false;
1324
- }
1325
- }
1326
-
1327
- // src/hooks/usePreferences.ts
1328
1330
  var DEFAULT_FONT_FAMILY = "IBM Plex Mono";
1329
1331
  var DEFAULT_PREFERENCES = {
1330
1332
  vimMode: false,
@@ -4501,14 +4503,21 @@ function useClientEvents(activeSessionId) {
4501
4503
  return buildClientEventsStreamUrl({ baseUrl: getBaseUrl() });
4502
4504
  }
4503
4505
  // src/hooks/useTheme.ts
4504
- import { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo3 } from "react";
4506
+ import { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo3, useState } from "react";
4505
4507
  function normalizeTheme(theme) {
4506
4508
  return theme === "light" ? "light" : "dark";
4507
4509
  }
4508
4510
  function useTheme() {
4509
4511
  const { data: config2 } = useConfig();
4510
4512
  const updateDefaults = useUpdateDefaults();
4511
- const theme = normalizeTheme(config2?.defaults?.theme);
4513
+ const configTheme = normalizeTheme(config2?.defaults?.theme);
4514
+ const [optimisticTheme, setOptimisticTheme] = useState(null);
4515
+ const theme = optimisticTheme ?? configTheme;
4516
+ useEffect4(() => {
4517
+ if (optimisticTheme === configTheme) {
4518
+ setOptimisticTheme(null);
4519
+ }
4520
+ }, [configTheme, optimisticTheme]);
4512
4521
  useEffect4(() => {
4513
4522
  if (typeof document === "undefined")
4514
4523
  return;
@@ -4523,7 +4532,12 @@ function useTheme() {
4523
4532
  }
4524
4533
  }, [theme]);
4525
4534
  const setTheme = useCallback2((nextTheme) => {
4526
- updateDefaults.mutate({ theme: nextTheme, scope: "global" });
4535
+ setOptimisticTheme(nextTheme);
4536
+ updateDefaults.mutate({ theme: nextTheme, scope: "global" }, {
4537
+ onError: () => {
4538
+ setOptimisticTheme((currentTheme) => currentTheme === nextTheme ? null : currentTheme);
4539
+ }
4540
+ });
4527
4541
  }, [updateDefaults]);
4528
4542
  const toggleTheme = useCallback2(() => {
4529
4543
  setTheme(theme === "dark" ? "light" : "dark");
@@ -4531,10 +4545,10 @@ function useTheme() {
4531
4545
  return useMemo3(() => ({ theme, setTheme, toggleTheme }), [theme, setTheme, toggleTheme]);
4532
4546
  }
4533
4547
  // src/hooks/useWorkingDirectory.ts
4534
- import { useEffect as useEffect5, useState } from "react";
4548
+ import { useEffect as useEffect5, useState as useState2 } from "react";
4535
4549
  import { getCwd } from "@ottocode/api";
4536
4550
  function useWorkingDirectory() {
4537
- const [dirName, setDirName] = useState(null);
4551
+ const [dirName, setDirName] = useState2(null);
4538
4552
  useEffect5(() => {
4539
4553
  const fetchWorkingDirectory = async () => {
4540
4554
  try {
@@ -4932,7 +4946,7 @@ function useKeyboardShortcuts({
4932
4946
  }
4933
4947
  // src/hooks/useImageUpload.ts
4934
4948
  import {
4935
- useState as useState2,
4949
+ useState as useState3,
4936
4950
  useCallback as useCallback4,
4937
4951
  useEffect as useEffect7
4938
4952
  } from "react";
@@ -4962,9 +4976,9 @@ async function fileToPreview(file) {
4962
4976
  }
4963
4977
  function useImageUpload(options = {}) {
4964
4978
  const { maxImages = 5, maxSizeMB = 5, pageWide = true } = options;
4965
- const [images, setImages] = useState2([]);
4966
- const [isDragging, setIsDragging] = useState2(false);
4967
- const [error, setError] = useState2(null);
4979
+ const [images, setImages] = useState3([]);
4980
+ const [isDragging, setIsDragging] = useState3(false);
4981
+ const [error, setError] = useState3(null);
4968
4982
  const maxSizeBytes = maxSizeMB * 1024 * 1024;
4969
4983
  const validateFile = useCallback4((file) => {
4970
4984
  if (!SUPPORTED_TYPES.includes(file.type)) {
@@ -5132,7 +5146,7 @@ function useImageUpload(options = {}) {
5132
5146
  }
5133
5147
  // src/hooks/useFileUpload.ts
5134
5148
  import {
5135
- useState as useState3,
5149
+ useState as useState4,
5136
5150
  useCallback as useCallback5,
5137
5151
  useEffect as useEffect8
5138
5152
  } from "react";
@@ -5264,9 +5278,9 @@ function useFileUpload(options = {}) {
5264
5278
  sessionId,
5265
5279
  onError
5266
5280
  } = options;
5267
- const [files, setFiles] = useState3([]);
5268
- const [isDragging, setIsDragging] = useState3(false);
5269
- const [error, setError] = useState3(null);
5281
+ const [files, setFiles] = useState4([]);
5282
+ const [isDragging, setIsDragging] = useState4(false);
5283
+ const [error, setError] = useState4(null);
5270
5284
  const maxSizeBytes = maxSizeMB * 1024 * 1024;
5271
5285
  const validateFile = useCallback5((file) => {
5272
5286
  if (file.size > maxSizeBytes) {
@@ -6132,7 +6146,7 @@ function useTopupCallback() {
6132
6146
  }, [setBalance, removeToast]);
6133
6147
  }
6134
6148
  // src/hooks/useAuthStatus.ts
6135
- import { useEffect as useEffect13, useCallback as useCallback8, useState as useState4, useRef as useRef5 } from "react";
6149
+ import { useEffect as useEffect13, useCallback as useCallback8, useState as useState5, useRef as useRef5 } from "react";
6136
6150
  import { useQueryClient as useQueryClient9 } from "@tanstack/react-query";
6137
6151
 
6138
6152
  // src/stores/onboardingStore.ts
@@ -6184,8 +6198,8 @@ function useAuthStatus() {
6184
6198
  const authStatus = useOnboardingStore((s) => s.authStatus);
6185
6199
  const isOpen = useOnboardingStore((s) => s.isOpen);
6186
6200
  const queryClient = useQueryClient9();
6187
- const [initialized, setInitialized] = useState4(false);
6188
- const [oauthPolling, setOauthPolling] = useState4(false);
6201
+ const [initialized, setInitialized] = useState5(false);
6202
+ const [oauthPolling, setOauthPolling] = useState5(false);
6189
6203
  const oauthPollingRef = useRef5(null);
6190
6204
  const preOauthProvidersRef = useRef5(new Set);
6191
6205
  const fetchAuthStatus = useCallback8(async () => {
@@ -7002,9 +7016,9 @@ function useSkillFileContent(name, filePath) {
7002
7016
  });
7003
7017
  }
7004
7018
  // src/hooks/useContainerWidth.ts
7005
- import { useEffect as useEffect18, useState as useState5 } from "react";
7019
+ import { useEffect as useEffect18, useState as useState6 } from "react";
7006
7020
  function useContainerWidth(ref) {
7007
- const [width, setWidth] = useState5(0);
7021
+ const [width, setWidth] = useState6(0);
7008
7022
  useEffect18(() => {
7009
7023
  const el = ref.current;
7010
7024
  if (!el)
@@ -7018,7 +7032,7 @@ function useContainerWidth(ref) {
7018
7032
  return width;
7019
7033
  }
7020
7034
  // src/hooks/useVoiceInput.ts
7021
- import { useCallback as useCallback12, useEffect as useEffect19, useRef as useRef9, useState as useState6 } from "react";
7035
+ import { useCallback as useCallback12, useEffect as useEffect19, useRef as useRef9, useState as useState7 } from "react";
7022
7036
  var TARGET_SAMPLE_RATE = 16000;
7023
7037
  var PCM_FRAME_BYTES = 3200;
7024
7038
  function getAudioContextConstructor() {
@@ -7074,10 +7088,10 @@ function useVoiceInput({
7074
7088
  onError,
7075
7089
  lang = "en-US"
7076
7090
  } = {}) {
7077
- const [isListening, setIsListening] = useState6(false);
7078
- const [isTranscribing, setIsTranscribing] = useState6(false);
7079
- const [analyser, setAnalyser] = useState6(null);
7080
- const [error, setError] = useState6(null);
7091
+ const [isListening, setIsListening] = useState7(false);
7092
+ const [isTranscribing, setIsTranscribing] = useState7(false);
7093
+ const [analyser, setAnalyser] = useState7(null);
7094
+ const [error, setError] = useState7(null);
7081
7095
  const streamRef = useRef9(null);
7082
7096
  const audioContextRef = useRef9(null);
7083
7097
  const processorRef = useRef9(null);
@@ -7296,7 +7310,7 @@ function useVoiceInput({
7296
7310
  };
7297
7311
  }
7298
7312
  // src/hooks/useDictationModels.ts
7299
- import { useCallback as useCallback13, useEffect as useEffect20, useRef as useRef10, useState as useState7 } from "react";
7313
+ import { useCallback as useCallback13, useEffect as useEffect20, useRef as useRef10, useState as useState8 } from "react";
7300
7314
  import { useMutation as useMutation10, useQuery as useQuery14, useQueryClient as useQueryClient13 } from "@tanstack/react-query";
7301
7315
  var DICTATION_STATUS_QUERY_KEY = ["dictation", "status"];
7302
7316
  function mergeModelState(current, model) {
@@ -7320,9 +7334,9 @@ function parseInstallEvent(raw) {
7320
7334
  function useDictationModels() {
7321
7335
  const queryClient = useQueryClient13();
7322
7336
  const eventSourceRef = useRef10(null);
7323
- const [activeInstallModelId, setActiveInstallModelId] = useState7(null);
7324
- const [installProgress, setInstallProgress] = useState7(null);
7325
- const [installStreamError, setInstallStreamError] = useState7(null);
7337
+ const [activeInstallModelId, setActiveInstallModelId] = useState8(null);
7338
+ const [installProgress, setInstallProgress] = useState8(null);
7339
+ const [installStreamError, setInstallStreamError] = useState8(null);
7326
7340
  const statusQuery = useQuery14({
7327
7341
  queryKey: DICTATION_STATUS_QUERY_KEY,
7328
7342
  queryFn: () => apiClient.getDictationStatus(),
@@ -7500,4 +7514,4 @@ export {
7500
7514
  normalizeQueueState
7501
7515
  };
7502
7516
 
7503
- //# debugId=6E5B9890DD6BFD3564756E2164756E21
7517
+ //# debugId=8D3C59E94B6700C564756E2164756E21