@ottocode/web-sdk 0.1.230 → 0.1.232

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":"DefaultsStep.d.ts","sourceRoot":"","sources":["../../../../src/components/onboarding/steps/DefaultsStep.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAGlE,UAAU,iBAAiB;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAqBD,eAAO,MAAM,YAAY,yDAsUvB,CAAC"}
1
+ {"version":3,"file":"DefaultsStep.d.ts","sourceRoot":"","sources":["../../../../src/components/onboarding/steps/DefaultsStep.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAGlE,UAAU,iBAAiB;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAuBD,eAAO,MAAM,YAAY,yDAuUvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TerminalViewer.d.ts","sourceRoot":"","sources":["../../../src/components/terminals/TerminalViewer.tsx"],"names":[],"mappings":"AA2FA,UAAU,mBAAmB;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED,wBAAgB,cAAc,CAAC,EAC9B,UAAU,EACV,QAAQ,EACR,MAAM,GACN,EAAE,mBAAmB,2CA8WrB"}
1
+ {"version":3,"file":"TerminalViewer.d.ts","sourceRoot":"","sources":["../../../src/components/terminals/TerminalViewer.tsx"],"names":[],"mappings":"AA2FA,UAAU,mBAAmB;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED,wBAAgB,cAAc,CAAC,EAC9B,UAAU,EACV,QAAQ,EACR,MAAM,GACN,EAAE,mBAAmB,2CA0YrB"}
@@ -924,6 +924,26 @@ function useUpdateDefaults() {
924
924
  const queryClient = useQueryClient();
925
925
  return useMutation({
926
926
  mutationFn: (data) => apiClient.updateDefaults(data),
927
+ onMutate: async (data) => {
928
+ await queryClient.cancelQueries({ queryKey: ["config"] });
929
+ const previousConfig = queryClient.getQueryData(["config"]);
930
+ if (previousConfig) {
931
+ const defaultUpdates = Object.fromEntries(Object.entries(data).filter(([key, value]) => key !== "scope" && value !== undefined));
932
+ queryClient.setQueryData(["config"], {
933
+ ...previousConfig,
934
+ defaults: {
935
+ ...previousConfig.defaults,
936
+ ...defaultUpdates
937
+ }
938
+ });
939
+ }
940
+ return { previousConfig };
941
+ },
942
+ onError: (_error, _data, context) => {
943
+ if (context?.previousConfig) {
944
+ queryClient.setQueryData(["config"], context.previousConfig);
945
+ }
946
+ },
927
947
  onSuccess: () => {
928
948
  queryClient.invalidateQueries({ queryKey: ["config"] });
929
949
  }
@@ -932,28 +952,27 @@ function useUpdateDefaults() {
932
952
  // src/hooks/usePreferences.ts
933
953
  import { useCallback, useMemo, useSyncExternalStore } from "react";
934
954
  var STORAGE_KEY = "otto-preferences";
935
- var DEFAULT_PREFERENCES = {
955
+ var DEFAULT_STORED_PREFERENCES = {
936
956
  vimMode: false,
937
- compactThread: true,
938
- fullWidthContent: false
957
+ compactThread: true
939
958
  };
940
959
  function resolveInitialPreferences() {
941
960
  if (typeof window === "undefined") {
942
- return DEFAULT_PREFERENCES;
961
+ return DEFAULT_STORED_PREFERENCES;
943
962
  }
944
963
  try {
945
964
  const stored = window.localStorage.getItem(STORAGE_KEY);
946
965
  if (stored) {
947
966
  const parsed = JSON.parse(stored);
948
967
  return {
949
- ...DEFAULT_PREFERENCES,
950
- ...parsed
968
+ vimMode: typeof parsed.vimMode === "boolean" ? parsed.vimMode : DEFAULT_STORED_PREFERENCES.vimMode,
969
+ compactThread: typeof parsed.compactThread === "boolean" ? parsed.compactThread : DEFAULT_STORED_PREFERENCES.compactThread
951
970
  };
952
971
  }
953
972
  } catch (error) {
954
973
  console.warn("Failed to load preferences", error);
955
974
  }
956
- return DEFAULT_PREFERENCES;
975
+ return DEFAULT_STORED_PREFERENCES;
957
976
  }
958
977
  var preferences = resolveInitialPreferences();
959
978
  var listeners = new Set;
@@ -961,7 +980,7 @@ function getSnapshot() {
961
980
  return preferences;
962
981
  }
963
982
  function getServerSnapshot() {
964
- return DEFAULT_PREFERENCES;
983
+ return DEFAULT_STORED_PREFERENCES;
965
984
  }
966
985
  function subscribe(listener) {
967
986
  listeners.add(listener);
@@ -985,10 +1004,31 @@ function updateStore(updates) {
985
1004
  }
986
1005
  function usePreferences() {
987
1006
  const currentPreferences = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
1007
+ const { data: config2 } = useConfig();
1008
+ const updateDefaults = useUpdateDefaults();
988
1009
  const updatePreferences = useCallback((updates) => {
989
- updateStore(updates);
990
- }, []);
991
- return useMemo(() => ({ preferences: currentPreferences, updatePreferences }), [currentPreferences, updatePreferences]);
1010
+ const localUpdates = {};
1011
+ if (updates.vimMode !== undefined) {
1012
+ localUpdates.vimMode = updates.vimMode;
1013
+ }
1014
+ if (updates.compactThread !== undefined) {
1015
+ localUpdates.compactThread = updates.compactThread;
1016
+ }
1017
+ if (Object.keys(localUpdates).length > 0) {
1018
+ updateStore(localUpdates);
1019
+ }
1020
+ if (updates.fullWidthContent !== undefined && updates.fullWidthContent !== config2?.defaults?.fullWidthContent) {
1021
+ updateDefaults.mutate({
1022
+ fullWidthContent: updates.fullWidthContent,
1023
+ scope: "global"
1024
+ });
1025
+ }
1026
+ }, [config2?.defaults?.fullWidthContent, updateDefaults]);
1027
+ const resolvedPreferences = useMemo(() => ({
1028
+ ...currentPreferences,
1029
+ fullWidthContent: config2?.defaults?.fullWidthContent ?? false
1030
+ }), [currentPreferences, config2?.defaults?.fullWidthContent]);
1031
+ return useMemo(() => ({ preferences: resolvedPreferences, updatePreferences }), [resolvedPreferences, updatePreferences]);
992
1032
  }
993
1033
  // src/hooks/useFiles.ts
994
1034
  import { useQuery as useQuery2 } from "@tanstack/react-query";
@@ -1674,8 +1714,10 @@ class SSEClient {
1674
1714
  }
1675
1715
  this.abortController = new AbortController;
1676
1716
  this.running = true;
1717
+ const isTunnel = !url.includes("localhost") && !url.includes("127.0.0.1");
1677
1718
  try {
1678
1719
  const response = await fetch(url, {
1720
+ method: isTunnel ? "POST" : "GET",
1679
1721
  headers: { Accept: "text/event-stream" },
1680
1722
  signal: this.abortController.signal
1681
1723
  });
@@ -2351,6 +2393,26 @@ function useSessionStream(sessionId, enabled = true) {
2351
2393
  const agent = typeof payload?.agent === "string" ? payload.agent : "";
2352
2394
  const provider = typeof payload?.provider === "string" ? payload.provider : "";
2353
2395
  const model = typeof payload?.model === "string" ? payload.model : "";
2396
+ const content = typeof payload?.content === "string" ? payload.content : null;
2397
+ const userParts = role === "user" && content ? [
2398
+ {
2399
+ id: `${id}-text`,
2400
+ messageId: id,
2401
+ index: 0,
2402
+ stepIndex: null,
2403
+ type: "text",
2404
+ content: JSON.stringify({ text: content }),
2405
+ contentJson: { text: content },
2406
+ agent,
2407
+ provider,
2408
+ model,
2409
+ startedAt: Date.now(),
2410
+ completedAt: Date.now(),
2411
+ toolName: null,
2412
+ toolCallId: null,
2413
+ toolDurationMs: null
2414
+ }
2415
+ ] : [];
2354
2416
  queryClient.setQueryData(["messages", sessionId], (oldMessages) => {
2355
2417
  if (!oldMessages)
2356
2418
  return oldMessages;
@@ -2360,7 +2422,7 @@ function useSessionStream(sessionId, enabled = true) {
2360
2422
  id,
2361
2423
  sessionId,
2362
2424
  role,
2363
- status: "pending",
2425
+ status: role === "user" ? "complete" : "pending",
2364
2426
  agent,
2365
2427
  provider,
2366
2428
  model,
@@ -2371,7 +2433,7 @@ function useSessionStream(sessionId, enabled = true) {
2371
2433
  completionTokens: null,
2372
2434
  totalTokens: null,
2373
2435
  error: null,
2374
- parts: []
2436
+ parts: userParts
2375
2437
  };
2376
2438
  const next = [...oldMessages, newMessage];
2377
2439
  next.sort((a, b) => a.createdAt - b.createdAt);
@@ -4985,4 +5047,4 @@ export {
4985
5047
  sessionsQueryKey
4986
5048
  };
4987
5049
 
4988
- //# debugId=8BD673F5FE928A9E64756E2164756E21
5050
+ //# debugId=E3072251705A9AC764756E2164756E21