@ottocode/web-sdk 0.1.291 → 0.1.293
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.
- package/dist/components/chat/ChatInput.d.ts.map +1 -1
- package/dist/components/chat/InputSecureInputBar.d.ts +6 -0
- package/dist/components/chat/InputSecureInputBar.d.ts.map +1 -0
- package/dist/components/chat/NewSessionLanding.d.ts +1 -0
- package/dist/components/chat/NewSessionLanding.d.ts.map +1 -1
- package/dist/components/index.js +4080 -3848
- package/dist/components/index.js.map +13 -10
- package/dist/components/messages/MessageThread.d.ts.map +1 -1
- package/dist/components/messages/renderers/ProgressUpdateRenderer.d.ts.map +1 -1
- package/dist/components/messages/renderers/TodosRenderer.d.ts.map +1 -1
- package/dist/hooks/index.js +214 -115
- package/dist/hooks/index.js.map +10 -8
- package/dist/hooks/useSessionStream.d.ts.map +1 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/index.js +4120 -3875
- package/dist/index.js.map +14 -11
- package/dist/lib/api-client/index.d.ts +21 -0
- package/dist/lib/api-client/index.d.ts.map +1 -1
- package/dist/lib/api-client/secure-input.d.ts +24 -0
- package/dist/lib/api-client/secure-input.d.ts.map +1 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/index.js +103 -65
- package/dist/lib/index.js.map +8 -7
- package/dist/stores/index.d.ts +1 -0
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/index.js +34 -17
- package/dist/stores/index.js.map +4 -3
- package/dist/stores/secureInputStore.d.ts +18 -0
- package/dist/stores/secureInputStore.d.ts.map +1 -0
- package/package.json +3 -3
|
@@ -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;
|
|
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,
|
|
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;
|
|
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"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
}
|
|
@@ -1103,6 +1169,36 @@ var dictationMixin = {
|
|
|
1103
1169
|
getDictationModelInstallEventsUrl: buildInstallEventsUrl
|
|
1104
1170
|
};
|
|
1105
1171
|
|
|
1172
|
+
// src/lib/api-client/secure-input.ts
|
|
1173
|
+
var secureInputMixin = {
|
|
1174
|
+
async submitSecureInput(sessionId, promptId, value) {
|
|
1175
|
+
const response = await fetch(`${getBaseUrl()}/v1/sessions/${encodeURIComponent(sessionId)}/secure-input`, {
|
|
1176
|
+
method: "POST",
|
|
1177
|
+
headers: { "Content-Type": "application/json" },
|
|
1178
|
+
body: JSON.stringify({ promptId, value })
|
|
1179
|
+
});
|
|
1180
|
+
if (!response.ok)
|
|
1181
|
+
throw new Error("Failed to submit secure input");
|
|
1182
|
+
return response.json();
|
|
1183
|
+
},
|
|
1184
|
+
async cancelSecureInput(sessionId, promptId) {
|
|
1185
|
+
const response = await fetch(`${getBaseUrl()}/v1/sessions/${encodeURIComponent(sessionId)}/secure-input`, {
|
|
1186
|
+
method: "POST",
|
|
1187
|
+
headers: { "Content-Type": "application/json" },
|
|
1188
|
+
body: JSON.stringify({ promptId, cancelled: true })
|
|
1189
|
+
});
|
|
1190
|
+
if (!response.ok)
|
|
1191
|
+
throw new Error("Failed to cancel secure input");
|
|
1192
|
+
return response.json();
|
|
1193
|
+
},
|
|
1194
|
+
async getPendingSecureInputs(sessionId) {
|
|
1195
|
+
const response = await fetch(`${getBaseUrl()}/v1/sessions/${encodeURIComponent(sessionId)}/secure-input/pending`);
|
|
1196
|
+
if (!response.ok)
|
|
1197
|
+
throw new Error("Failed to get pending secure inputs");
|
|
1198
|
+
return response.json();
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
|
|
1106
1202
|
// src/lib/api-client/index.ts
|
|
1107
1203
|
class ApiClient {
|
|
1108
1204
|
getSessions = sessionsMixin.getSessions;
|
|
@@ -1161,6 +1257,9 @@ class ApiClient {
|
|
|
1161
1257
|
syncSession = branchesMixin.syncSession;
|
|
1162
1258
|
approveToolCall = approvalMixin.approveToolCall;
|
|
1163
1259
|
getPendingApprovals = approvalMixin.getPendingApprovals;
|
|
1260
|
+
submitSecureInput = secureInputMixin.submitSecureInput;
|
|
1261
|
+
cancelSecureInput = secureInputMixin.cancelSecureInput;
|
|
1262
|
+
getPendingSecureInputs = secureInputMixin.getPendingSecureInputs;
|
|
1164
1263
|
getOttoRouterBalance = ottorouterMixin.getOttoRouterBalance;
|
|
1165
1264
|
getOttoRouterWallet = ottorouterMixin.getOttoRouterWallet;
|
|
1166
1265
|
getOttoRouterUsdcBalance = ottorouterMixin.getOttoRouterUsdcBalance;
|
|
@@ -1261,70 +1360,6 @@ function useUpdateDefaults() {
|
|
|
1261
1360
|
}
|
|
1262
1361
|
// src/hooks/usePreferences.ts
|
|
1263
1362
|
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
1363
|
var DEFAULT_FONT_FAMILY = "IBM Plex Mono";
|
|
1329
1364
|
var DEFAULT_PREFERENCES = {
|
|
1330
1365
|
vimMode: false,
|
|
@@ -2815,6 +2850,23 @@ var useToolApprovalStore = create10((set) => ({
|
|
|
2815
2850
|
setPendingApprovals: (approvals) => set({ pendingApprovals: approvals })
|
|
2816
2851
|
}));
|
|
2817
2852
|
|
|
2853
|
+
// src/stores/secureInputStore.ts
|
|
2854
|
+
import { create as create11 } from "zustand";
|
|
2855
|
+
var useSecureInputStore = create11((set) => ({
|
|
2856
|
+
pendingInputs: [],
|
|
2857
|
+
addPendingInput: (input) => set((state) => ({
|
|
2858
|
+
pendingInputs: [
|
|
2859
|
+
...state.pendingInputs.filter((item) => item.promptId !== input.promptId),
|
|
2860
|
+
input
|
|
2861
|
+
]
|
|
2862
|
+
})),
|
|
2863
|
+
removePendingInput: (promptId) => set((state) => ({
|
|
2864
|
+
pendingInputs: state.pendingInputs.filter((input) => input.promptId !== promptId)
|
|
2865
|
+
})),
|
|
2866
|
+
setPendingInputs: (inputs) => set({ pendingInputs: inputs }),
|
|
2867
|
+
clearPendingInputs: () => set({ pendingInputs: [] })
|
|
2868
|
+
}));
|
|
2869
|
+
|
|
2818
2870
|
// src/hooks/useSessionStream.ts
|
|
2819
2871
|
var TOOL_PREVIEW_THROTTLE_MS = 500;
|
|
2820
2872
|
var TOOL_PREVIEW_THROTTLE_MIN_CHARS = 8000;
|
|
@@ -2838,6 +2890,7 @@ function useSessionStream(sessionId, enabled = true) {
|
|
|
2838
2890
|
updatePendingApproval,
|
|
2839
2891
|
setPendingApprovals
|
|
2840
2892
|
} = useToolApprovalStore();
|
|
2893
|
+
const { addPendingInput, removePendingInput, setPendingInputs } = useSecureInputStore();
|
|
2841
2894
|
useEffect2(() => {
|
|
2842
2895
|
if (!sessionId || !enabled) {
|
|
2843
2896
|
return;
|
|
@@ -2856,6 +2909,15 @@ function useSessionStream(sessionId, enabled = true) {
|
|
|
2856
2909
|
}).catch(() => {
|
|
2857
2910
|
setPendingApprovals([]);
|
|
2858
2911
|
});
|
|
2912
|
+
apiClient.getPendingSecureInputs(sessionId).then((result) => {
|
|
2913
|
+
if (result.ok && result.pending.length > 0) {
|
|
2914
|
+
setPendingInputs(result.pending);
|
|
2915
|
+
} else {
|
|
2916
|
+
setPendingInputs([]);
|
|
2917
|
+
}
|
|
2918
|
+
}).catch(() => {
|
|
2919
|
+
setPendingInputs([]);
|
|
2920
|
+
});
|
|
2859
2921
|
const client2 = new SSEClient;
|
|
2860
2922
|
clientRef.current = client2;
|
|
2861
2923
|
const url = apiClient.getStreamUrl(sessionId);
|
|
@@ -4091,6 +4153,28 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
|
|
|
4091
4153
|
}
|
|
4092
4154
|
break;
|
|
4093
4155
|
}
|
|
4156
|
+
case "shell.secure_input.required": {
|
|
4157
|
+
const promptId = typeof payload?.promptId === "string" ? payload.promptId : null;
|
|
4158
|
+
const prompt = typeof payload?.prompt === "string" ? payload.prompt : null;
|
|
4159
|
+
if (promptId && prompt) {
|
|
4160
|
+
addPendingInput({
|
|
4161
|
+
promptId,
|
|
4162
|
+
prompt,
|
|
4163
|
+
messageId: typeof payload?.messageId === "string" ? payload.messageId : undefined,
|
|
4164
|
+
callId: typeof payload?.callId === "string" ? payload.callId : undefined,
|
|
4165
|
+
inputKind: "password",
|
|
4166
|
+
createdAt: Date.now()
|
|
4167
|
+
});
|
|
4168
|
+
}
|
|
4169
|
+
break;
|
|
4170
|
+
}
|
|
4171
|
+
case "shell.secure_input.resolved": {
|
|
4172
|
+
const promptId = typeof payload?.promptId === "string" ? payload.promptId : null;
|
|
4173
|
+
if (promptId) {
|
|
4174
|
+
removePendingInput(promptId);
|
|
4175
|
+
}
|
|
4176
|
+
break;
|
|
4177
|
+
}
|
|
4094
4178
|
case "error": {
|
|
4095
4179
|
handleToolActivityViewerEvent("error", payload);
|
|
4096
4180
|
removeEphemeralToolCall(payload);
|
|
@@ -4162,9 +4246,12 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
|
|
|
4162
4246
|
sessionId,
|
|
4163
4247
|
queryClient,
|
|
4164
4248
|
addPendingApproval,
|
|
4249
|
+
addPendingInput,
|
|
4165
4250
|
removePendingApproval,
|
|
4251
|
+
removePendingInput,
|
|
4166
4252
|
enabled,
|
|
4167
4253
|
setPendingApprovals,
|
|
4254
|
+
setPendingInputs,
|
|
4168
4255
|
updatePendingApproval
|
|
4169
4256
|
]);
|
|
4170
4257
|
}
|
|
@@ -4177,9 +4264,9 @@ import {
|
|
|
4177
4264
|
} from "@ottocode/api";
|
|
4178
4265
|
|
|
4179
4266
|
// src/stores/toastStore.ts
|
|
4180
|
-
import { create as
|
|
4267
|
+
import { create as create12 } from "zustand";
|
|
4181
4268
|
var toastId = 0;
|
|
4182
|
-
var useToastStore =
|
|
4269
|
+
var useToastStore = create12((set) => ({
|
|
4183
4270
|
toasts: [],
|
|
4184
4271
|
addToast: (toast) => {
|
|
4185
4272
|
const id = `toast-${++toastId}`;
|
|
@@ -4501,14 +4588,21 @@ function useClientEvents(activeSessionId) {
|
|
|
4501
4588
|
return buildClientEventsStreamUrl({ baseUrl: getBaseUrl() });
|
|
4502
4589
|
}
|
|
4503
4590
|
// src/hooks/useTheme.ts
|
|
4504
|
-
import { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo3 } from "react";
|
|
4591
|
+
import { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo3, useState } from "react";
|
|
4505
4592
|
function normalizeTheme(theme) {
|
|
4506
4593
|
return theme === "light" ? "light" : "dark";
|
|
4507
4594
|
}
|
|
4508
4595
|
function useTheme() {
|
|
4509
4596
|
const { data: config2 } = useConfig();
|
|
4510
4597
|
const updateDefaults = useUpdateDefaults();
|
|
4511
|
-
const
|
|
4598
|
+
const configTheme = normalizeTheme(config2?.defaults?.theme);
|
|
4599
|
+
const [optimisticTheme, setOptimisticTheme] = useState(null);
|
|
4600
|
+
const theme = optimisticTheme ?? configTheme;
|
|
4601
|
+
useEffect4(() => {
|
|
4602
|
+
if (optimisticTheme === configTheme) {
|
|
4603
|
+
setOptimisticTheme(null);
|
|
4604
|
+
}
|
|
4605
|
+
}, [configTheme, optimisticTheme]);
|
|
4512
4606
|
useEffect4(() => {
|
|
4513
4607
|
if (typeof document === "undefined")
|
|
4514
4608
|
return;
|
|
@@ -4523,7 +4617,12 @@ function useTheme() {
|
|
|
4523
4617
|
}
|
|
4524
4618
|
}, [theme]);
|
|
4525
4619
|
const setTheme = useCallback2((nextTheme) => {
|
|
4526
|
-
|
|
4620
|
+
setOptimisticTheme(nextTheme);
|
|
4621
|
+
updateDefaults.mutate({ theme: nextTheme, scope: "global" }, {
|
|
4622
|
+
onError: () => {
|
|
4623
|
+
setOptimisticTheme((currentTheme) => currentTheme === nextTheme ? null : currentTheme);
|
|
4624
|
+
}
|
|
4625
|
+
});
|
|
4527
4626
|
}, [updateDefaults]);
|
|
4528
4627
|
const toggleTheme = useCallback2(() => {
|
|
4529
4628
|
setTheme(theme === "dark" ? "light" : "dark");
|
|
@@ -4531,10 +4630,10 @@ function useTheme() {
|
|
|
4531
4630
|
return useMemo3(() => ({ theme, setTheme, toggleTheme }), [theme, setTheme, toggleTheme]);
|
|
4532
4631
|
}
|
|
4533
4632
|
// src/hooks/useWorkingDirectory.ts
|
|
4534
|
-
import { useEffect as useEffect5, useState } from "react";
|
|
4633
|
+
import { useEffect as useEffect5, useState as useState2 } from "react";
|
|
4535
4634
|
import { getCwd } from "@ottocode/api";
|
|
4536
4635
|
function useWorkingDirectory() {
|
|
4537
|
-
const [dirName, setDirName] =
|
|
4636
|
+
const [dirName, setDirName] = useState2(null);
|
|
4538
4637
|
useEffect5(() => {
|
|
4539
4638
|
const fetchWorkingDirectory = async () => {
|
|
4540
4639
|
try {
|
|
@@ -4562,8 +4661,8 @@ function useWorkingDirectory() {
|
|
|
4562
4661
|
import { useEffect as useEffect6, useCallback as useCallback3 } from "react";
|
|
4563
4662
|
|
|
4564
4663
|
// src/stores/focusStore.ts
|
|
4565
|
-
import { create as
|
|
4566
|
-
var useFocusStore =
|
|
4664
|
+
import { create as create13 } from "zustand";
|
|
4665
|
+
var useFocusStore = create13((set) => ({
|
|
4567
4666
|
currentFocus: null,
|
|
4568
4667
|
sessionIndex: 0,
|
|
4569
4668
|
gitFileIndex: 0,
|
|
@@ -4575,9 +4674,9 @@ var useFocusStore = create12((set) => ({
|
|
|
4575
4674
|
}));
|
|
4576
4675
|
|
|
4577
4676
|
// src/stores/sidebarStore.ts
|
|
4578
|
-
import { create as
|
|
4677
|
+
import { create as create14 } from "zustand";
|
|
4579
4678
|
import { persist } from "zustand/middleware";
|
|
4580
|
-
var useSidebarStore =
|
|
4679
|
+
var useSidebarStore = create14()(persist((set) => ({
|
|
4581
4680
|
isCollapsed: false,
|
|
4582
4681
|
toggleCollapse: () => set((state) => ({ isCollapsed: !state.isCollapsed })),
|
|
4583
4682
|
setCollapsed: (collapsed) => set({ isCollapsed: collapsed })
|
|
@@ -4586,8 +4685,8 @@ var useSidebarStore = create13()(persist((set) => ({
|
|
|
4586
4685
|
}));
|
|
4587
4686
|
|
|
4588
4687
|
// src/stores/filePickerStore.ts
|
|
4589
|
-
import { create as
|
|
4590
|
-
var useFilePickerStore =
|
|
4688
|
+
import { create as create15 } from "zustand";
|
|
4689
|
+
var useFilePickerStore = create15((set) => ({
|
|
4591
4690
|
isOpen: false,
|
|
4592
4691
|
open: () => set({ isOpen: true }),
|
|
4593
4692
|
close: () => set({ isOpen: false }),
|
|
@@ -4595,10 +4694,10 @@ var useFilePickerStore = create14((set) => ({
|
|
|
4595
4694
|
}));
|
|
4596
4695
|
|
|
4597
4696
|
// src/stores/terminalStore.ts
|
|
4598
|
-
import { create as
|
|
4697
|
+
import { create as create16 } from "zustand";
|
|
4599
4698
|
var DEFAULT_HEIGHT = 300;
|
|
4600
4699
|
var MIN_HEIGHT = 150;
|
|
4601
|
-
var useTerminalStore =
|
|
4700
|
+
var useTerminalStore = create16((set) => ({
|
|
4602
4701
|
isOpen: false,
|
|
4603
4702
|
panelHeight: DEFAULT_HEIGHT,
|
|
4604
4703
|
activeTabId: null,
|
|
@@ -4932,7 +5031,7 @@ function useKeyboardShortcuts({
|
|
|
4932
5031
|
}
|
|
4933
5032
|
// src/hooks/useImageUpload.ts
|
|
4934
5033
|
import {
|
|
4935
|
-
useState as
|
|
5034
|
+
useState as useState3,
|
|
4936
5035
|
useCallback as useCallback4,
|
|
4937
5036
|
useEffect as useEffect7
|
|
4938
5037
|
} from "react";
|
|
@@ -4962,9 +5061,9 @@ async function fileToPreview(file) {
|
|
|
4962
5061
|
}
|
|
4963
5062
|
function useImageUpload(options = {}) {
|
|
4964
5063
|
const { maxImages = 5, maxSizeMB = 5, pageWide = true } = options;
|
|
4965
|
-
const [images, setImages] =
|
|
4966
|
-
const [isDragging, setIsDragging] =
|
|
4967
|
-
const [error, setError] =
|
|
5064
|
+
const [images, setImages] = useState3([]);
|
|
5065
|
+
const [isDragging, setIsDragging] = useState3(false);
|
|
5066
|
+
const [error, setError] = useState3(null);
|
|
4968
5067
|
const maxSizeBytes = maxSizeMB * 1024 * 1024;
|
|
4969
5068
|
const validateFile = useCallback4((file) => {
|
|
4970
5069
|
if (!SUPPORTED_TYPES.includes(file.type)) {
|
|
@@ -5132,7 +5231,7 @@ function useImageUpload(options = {}) {
|
|
|
5132
5231
|
}
|
|
5133
5232
|
// src/hooks/useFileUpload.ts
|
|
5134
5233
|
import {
|
|
5135
|
-
useState as
|
|
5234
|
+
useState as useState4,
|
|
5136
5235
|
useCallback as useCallback5,
|
|
5137
5236
|
useEffect as useEffect8
|
|
5138
5237
|
} from "react";
|
|
@@ -5264,9 +5363,9 @@ function useFileUpload(options = {}) {
|
|
|
5264
5363
|
sessionId,
|
|
5265
5364
|
onError
|
|
5266
5365
|
} = options;
|
|
5267
|
-
const [files, setFiles] =
|
|
5268
|
-
const [isDragging, setIsDragging] =
|
|
5269
|
-
const [error, setError] =
|
|
5366
|
+
const [files, setFiles] = useState4([]);
|
|
5367
|
+
const [isDragging, setIsDragging] = useState4(false);
|
|
5368
|
+
const [error, setError] = useState4(null);
|
|
5270
5369
|
const maxSizeBytes = maxSizeMB * 1024 * 1024;
|
|
5271
5370
|
const validateFile = useCallback5((file) => {
|
|
5272
5371
|
if (file.size > maxSizeBytes) {
|
|
@@ -5552,8 +5651,8 @@ import {
|
|
|
5552
5651
|
} from "@ottocode/api";
|
|
5553
5652
|
|
|
5554
5653
|
// src/stores/pendingResearchStore.ts
|
|
5555
|
-
import { create as
|
|
5556
|
-
var usePendingResearchStore =
|
|
5654
|
+
import { create as create17 } from "zustand";
|
|
5655
|
+
var usePendingResearchStore = create17((set, get) => ({
|
|
5557
5656
|
pendingContexts: new Map,
|
|
5558
5657
|
addContext: (parentSessionId, context) => {
|
|
5559
5658
|
set((state) => {
|
|
@@ -5702,8 +5801,8 @@ function useExportToSession() {
|
|
|
5702
5801
|
import { useEffect as useEffect9, useRef as useRef3 } from "react";
|
|
5703
5802
|
|
|
5704
5803
|
// src/stores/ottorouterStore.ts
|
|
5705
|
-
import { create as
|
|
5706
|
-
var useOttoRouterStore =
|
|
5804
|
+
import { create as create18 } from "zustand";
|
|
5805
|
+
var useOttoRouterStore = create18((set) => ({
|
|
5707
5806
|
balance: null,
|
|
5708
5807
|
usdcBalance: null,
|
|
5709
5808
|
network: "mainnet",
|
|
@@ -5732,8 +5831,8 @@ var useOttoRouterStore = create17((set) => ({
|
|
|
5732
5831
|
}));
|
|
5733
5832
|
|
|
5734
5833
|
// src/stores/topupApprovalStore.ts
|
|
5735
|
-
import { create as
|
|
5736
|
-
var useTopupApprovalStore =
|
|
5834
|
+
import { create as create19 } from "zustand";
|
|
5835
|
+
var useTopupApprovalStore = create19((set) => ({
|
|
5737
5836
|
pendingTopup: null,
|
|
5738
5837
|
isProcessing: false,
|
|
5739
5838
|
selectedMethod: null,
|
|
@@ -5886,8 +5985,8 @@ function useOttoRouterPayments(sessionId) {
|
|
|
5886
5985
|
import { useEffect as useEffect10, useCallback as useCallback6 } from "react";
|
|
5887
5986
|
|
|
5888
5987
|
// src/stores/usageStore.ts
|
|
5889
|
-
import { create as
|
|
5890
|
-
var useUsageStore =
|
|
5988
|
+
import { create as create20 } from "zustand";
|
|
5989
|
+
var useUsageStore = create20((set) => ({
|
|
5891
5990
|
usage: {},
|
|
5892
5991
|
isLoading: {},
|
|
5893
5992
|
lastFetched: {},
|
|
@@ -6132,13 +6231,13 @@ function useTopupCallback() {
|
|
|
6132
6231
|
}, [setBalance, removeToast]);
|
|
6133
6232
|
}
|
|
6134
6233
|
// src/hooks/useAuthStatus.ts
|
|
6135
|
-
import { useEffect as useEffect13, useCallback as useCallback8, useState as
|
|
6234
|
+
import { useEffect as useEffect13, useCallback as useCallback8, useState as useState5, useRef as useRef5 } from "react";
|
|
6136
6235
|
import { useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
6137
6236
|
|
|
6138
6237
|
// src/stores/onboardingStore.ts
|
|
6139
|
-
import { create as
|
|
6238
|
+
import { create as create21 } from "zustand";
|
|
6140
6239
|
var STEPS = ["wallet", "defaults"];
|
|
6141
|
-
var useOnboardingStore =
|
|
6240
|
+
var useOnboardingStore = create21((set, get) => ({
|
|
6142
6241
|
isOpen: false,
|
|
6143
6242
|
currentStep: "wallet",
|
|
6144
6243
|
manageMode: false,
|
|
@@ -6184,8 +6283,8 @@ function useAuthStatus() {
|
|
|
6184
6283
|
const authStatus = useOnboardingStore((s) => s.authStatus);
|
|
6185
6284
|
const isOpen = useOnboardingStore((s) => s.isOpen);
|
|
6186
6285
|
const queryClient = useQueryClient9();
|
|
6187
|
-
const [initialized, setInitialized] =
|
|
6188
|
-
const [oauthPolling, setOauthPolling] =
|
|
6286
|
+
const [initialized, setInitialized] = useState5(false);
|
|
6287
|
+
const [oauthPolling, setOauthPolling] = useState5(false);
|
|
6189
6288
|
const oauthPollingRef = useRef5(null);
|
|
6190
6289
|
const preOauthProvidersRef = useRef5(new Set);
|
|
6191
6290
|
const fetchAuthStatus = useCallback8(async () => {
|
|
@@ -7002,9 +7101,9 @@ function useSkillFileContent(name, filePath) {
|
|
|
7002
7101
|
});
|
|
7003
7102
|
}
|
|
7004
7103
|
// src/hooks/useContainerWidth.ts
|
|
7005
|
-
import { useEffect as useEffect18, useState as
|
|
7104
|
+
import { useEffect as useEffect18, useState as useState6 } from "react";
|
|
7006
7105
|
function useContainerWidth(ref) {
|
|
7007
|
-
const [width, setWidth] =
|
|
7106
|
+
const [width, setWidth] = useState6(0);
|
|
7008
7107
|
useEffect18(() => {
|
|
7009
7108
|
const el = ref.current;
|
|
7010
7109
|
if (!el)
|
|
@@ -7018,7 +7117,7 @@ function useContainerWidth(ref) {
|
|
|
7018
7117
|
return width;
|
|
7019
7118
|
}
|
|
7020
7119
|
// src/hooks/useVoiceInput.ts
|
|
7021
|
-
import { useCallback as useCallback12, useEffect as useEffect19, useRef as useRef9, useState as
|
|
7120
|
+
import { useCallback as useCallback12, useEffect as useEffect19, useRef as useRef9, useState as useState7 } from "react";
|
|
7022
7121
|
var TARGET_SAMPLE_RATE = 16000;
|
|
7023
7122
|
var PCM_FRAME_BYTES = 3200;
|
|
7024
7123
|
function getAudioContextConstructor() {
|
|
@@ -7074,10 +7173,10 @@ function useVoiceInput({
|
|
|
7074
7173
|
onError,
|
|
7075
7174
|
lang = "en-US"
|
|
7076
7175
|
} = {}) {
|
|
7077
|
-
const [isListening, setIsListening] =
|
|
7078
|
-
const [isTranscribing, setIsTranscribing] =
|
|
7079
|
-
const [analyser, setAnalyser] =
|
|
7080
|
-
const [error, setError] =
|
|
7176
|
+
const [isListening, setIsListening] = useState7(false);
|
|
7177
|
+
const [isTranscribing, setIsTranscribing] = useState7(false);
|
|
7178
|
+
const [analyser, setAnalyser] = useState7(null);
|
|
7179
|
+
const [error, setError] = useState7(null);
|
|
7081
7180
|
const streamRef = useRef9(null);
|
|
7082
7181
|
const audioContextRef = useRef9(null);
|
|
7083
7182
|
const processorRef = useRef9(null);
|
|
@@ -7296,7 +7395,7 @@ function useVoiceInput({
|
|
|
7296
7395
|
};
|
|
7297
7396
|
}
|
|
7298
7397
|
// src/hooks/useDictationModels.ts
|
|
7299
|
-
import { useCallback as useCallback13, useEffect as useEffect20, useRef as useRef10, useState as
|
|
7398
|
+
import { useCallback as useCallback13, useEffect as useEffect20, useRef as useRef10, useState as useState8 } from "react";
|
|
7300
7399
|
import { useMutation as useMutation10, useQuery as useQuery14, useQueryClient as useQueryClient13 } from "@tanstack/react-query";
|
|
7301
7400
|
var DICTATION_STATUS_QUERY_KEY = ["dictation", "status"];
|
|
7302
7401
|
function mergeModelState(current, model) {
|
|
@@ -7320,9 +7419,9 @@ function parseInstallEvent(raw) {
|
|
|
7320
7419
|
function useDictationModels() {
|
|
7321
7420
|
const queryClient = useQueryClient13();
|
|
7322
7421
|
const eventSourceRef = useRef10(null);
|
|
7323
|
-
const [activeInstallModelId, setActiveInstallModelId] =
|
|
7324
|
-
const [installProgress, setInstallProgress] =
|
|
7325
|
-
const [installStreamError, setInstallStreamError] =
|
|
7422
|
+
const [activeInstallModelId, setActiveInstallModelId] = useState8(null);
|
|
7423
|
+
const [installProgress, setInstallProgress] = useState8(null);
|
|
7424
|
+
const [installStreamError, setInstallStreamError] = useState8(null);
|
|
7326
7425
|
const statusQuery = useQuery14({
|
|
7327
7426
|
queryKey: DICTATION_STATUS_QUERY_KEY,
|
|
7328
7427
|
queryFn: () => apiClient.getDictationStatus(),
|
|
@@ -7500,4 +7599,4 @@ export {
|
|
|
7500
7599
|
normalizeQueueState
|
|
7501
7600
|
};
|
|
7502
7601
|
|
|
7503
|
-
//# debugId=
|
|
7602
|
+
//# debugId=A9770107614A950A64756E2164756E21
|