@ottocode/web-sdk 0.1.292 → 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 +4027 -3827
- package/dist/components/index.js.map +10 -7
- package/dist/hooks/index.js +106 -21
- package/dist/hooks/index.js.map +7 -5
- package/dist/hooks/useSessionStream.d.ts.map +1 -1
- package/dist/index.js +4054 -3853
- package/dist/index.js.map +10 -7
- 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/index.js +34 -1
- package/dist/lib/index.js.map +5 -4
- 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
package/dist/hooks/index.js
CHANGED
|
@@ -1169,6 +1169,36 @@ var dictationMixin = {
|
|
|
1169
1169
|
getDictationModelInstallEventsUrl: buildInstallEventsUrl
|
|
1170
1170
|
};
|
|
1171
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
|
+
|
|
1172
1202
|
// src/lib/api-client/index.ts
|
|
1173
1203
|
class ApiClient {
|
|
1174
1204
|
getSessions = sessionsMixin.getSessions;
|
|
@@ -1227,6 +1257,9 @@ class ApiClient {
|
|
|
1227
1257
|
syncSession = branchesMixin.syncSession;
|
|
1228
1258
|
approveToolCall = approvalMixin.approveToolCall;
|
|
1229
1259
|
getPendingApprovals = approvalMixin.getPendingApprovals;
|
|
1260
|
+
submitSecureInput = secureInputMixin.submitSecureInput;
|
|
1261
|
+
cancelSecureInput = secureInputMixin.cancelSecureInput;
|
|
1262
|
+
getPendingSecureInputs = secureInputMixin.getPendingSecureInputs;
|
|
1230
1263
|
getOttoRouterBalance = ottorouterMixin.getOttoRouterBalance;
|
|
1231
1264
|
getOttoRouterWallet = ottorouterMixin.getOttoRouterWallet;
|
|
1232
1265
|
getOttoRouterUsdcBalance = ottorouterMixin.getOttoRouterUsdcBalance;
|
|
@@ -2817,6 +2850,23 @@ var useToolApprovalStore = create10((set) => ({
|
|
|
2817
2850
|
setPendingApprovals: (approvals) => set({ pendingApprovals: approvals })
|
|
2818
2851
|
}));
|
|
2819
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
|
+
|
|
2820
2870
|
// src/hooks/useSessionStream.ts
|
|
2821
2871
|
var TOOL_PREVIEW_THROTTLE_MS = 500;
|
|
2822
2872
|
var TOOL_PREVIEW_THROTTLE_MIN_CHARS = 8000;
|
|
@@ -2840,6 +2890,7 @@ function useSessionStream(sessionId, enabled = true) {
|
|
|
2840
2890
|
updatePendingApproval,
|
|
2841
2891
|
setPendingApprovals
|
|
2842
2892
|
} = useToolApprovalStore();
|
|
2893
|
+
const { addPendingInput, removePendingInput, setPendingInputs } = useSecureInputStore();
|
|
2843
2894
|
useEffect2(() => {
|
|
2844
2895
|
if (!sessionId || !enabled) {
|
|
2845
2896
|
return;
|
|
@@ -2858,6 +2909,15 @@ function useSessionStream(sessionId, enabled = true) {
|
|
|
2858
2909
|
}).catch(() => {
|
|
2859
2910
|
setPendingApprovals([]);
|
|
2860
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
|
+
});
|
|
2861
2921
|
const client2 = new SSEClient;
|
|
2862
2922
|
clientRef.current = client2;
|
|
2863
2923
|
const url = apiClient.getStreamUrl(sessionId);
|
|
@@ -4093,6 +4153,28 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
|
|
|
4093
4153
|
}
|
|
4094
4154
|
break;
|
|
4095
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
|
+
}
|
|
4096
4178
|
case "error": {
|
|
4097
4179
|
handleToolActivityViewerEvent("error", payload);
|
|
4098
4180
|
removeEphemeralToolCall(payload);
|
|
@@ -4164,9 +4246,12 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
|
|
|
4164
4246
|
sessionId,
|
|
4165
4247
|
queryClient,
|
|
4166
4248
|
addPendingApproval,
|
|
4249
|
+
addPendingInput,
|
|
4167
4250
|
removePendingApproval,
|
|
4251
|
+
removePendingInput,
|
|
4168
4252
|
enabled,
|
|
4169
4253
|
setPendingApprovals,
|
|
4254
|
+
setPendingInputs,
|
|
4170
4255
|
updatePendingApproval
|
|
4171
4256
|
]);
|
|
4172
4257
|
}
|
|
@@ -4179,9 +4264,9 @@ import {
|
|
|
4179
4264
|
} from "@ottocode/api";
|
|
4180
4265
|
|
|
4181
4266
|
// src/stores/toastStore.ts
|
|
4182
|
-
import { create as
|
|
4267
|
+
import { create as create12 } from "zustand";
|
|
4183
4268
|
var toastId = 0;
|
|
4184
|
-
var useToastStore =
|
|
4269
|
+
var useToastStore = create12((set) => ({
|
|
4185
4270
|
toasts: [],
|
|
4186
4271
|
addToast: (toast) => {
|
|
4187
4272
|
const id = `toast-${++toastId}`;
|
|
@@ -4576,8 +4661,8 @@ function useWorkingDirectory() {
|
|
|
4576
4661
|
import { useEffect as useEffect6, useCallback as useCallback3 } from "react";
|
|
4577
4662
|
|
|
4578
4663
|
// src/stores/focusStore.ts
|
|
4579
|
-
import { create as
|
|
4580
|
-
var useFocusStore =
|
|
4664
|
+
import { create as create13 } from "zustand";
|
|
4665
|
+
var useFocusStore = create13((set) => ({
|
|
4581
4666
|
currentFocus: null,
|
|
4582
4667
|
sessionIndex: 0,
|
|
4583
4668
|
gitFileIndex: 0,
|
|
@@ -4589,9 +4674,9 @@ var useFocusStore = create12((set) => ({
|
|
|
4589
4674
|
}));
|
|
4590
4675
|
|
|
4591
4676
|
// src/stores/sidebarStore.ts
|
|
4592
|
-
import { create as
|
|
4677
|
+
import { create as create14 } from "zustand";
|
|
4593
4678
|
import { persist } from "zustand/middleware";
|
|
4594
|
-
var useSidebarStore =
|
|
4679
|
+
var useSidebarStore = create14()(persist((set) => ({
|
|
4595
4680
|
isCollapsed: false,
|
|
4596
4681
|
toggleCollapse: () => set((state) => ({ isCollapsed: !state.isCollapsed })),
|
|
4597
4682
|
setCollapsed: (collapsed) => set({ isCollapsed: collapsed })
|
|
@@ -4600,8 +4685,8 @@ var useSidebarStore = create13()(persist((set) => ({
|
|
|
4600
4685
|
}));
|
|
4601
4686
|
|
|
4602
4687
|
// src/stores/filePickerStore.ts
|
|
4603
|
-
import { create as
|
|
4604
|
-
var useFilePickerStore =
|
|
4688
|
+
import { create as create15 } from "zustand";
|
|
4689
|
+
var useFilePickerStore = create15((set) => ({
|
|
4605
4690
|
isOpen: false,
|
|
4606
4691
|
open: () => set({ isOpen: true }),
|
|
4607
4692
|
close: () => set({ isOpen: false }),
|
|
@@ -4609,10 +4694,10 @@ var useFilePickerStore = create14((set) => ({
|
|
|
4609
4694
|
}));
|
|
4610
4695
|
|
|
4611
4696
|
// src/stores/terminalStore.ts
|
|
4612
|
-
import { create as
|
|
4697
|
+
import { create as create16 } from "zustand";
|
|
4613
4698
|
var DEFAULT_HEIGHT = 300;
|
|
4614
4699
|
var MIN_HEIGHT = 150;
|
|
4615
|
-
var useTerminalStore =
|
|
4700
|
+
var useTerminalStore = create16((set) => ({
|
|
4616
4701
|
isOpen: false,
|
|
4617
4702
|
panelHeight: DEFAULT_HEIGHT,
|
|
4618
4703
|
activeTabId: null,
|
|
@@ -5566,8 +5651,8 @@ import {
|
|
|
5566
5651
|
} from "@ottocode/api";
|
|
5567
5652
|
|
|
5568
5653
|
// src/stores/pendingResearchStore.ts
|
|
5569
|
-
import { create as
|
|
5570
|
-
var usePendingResearchStore =
|
|
5654
|
+
import { create as create17 } from "zustand";
|
|
5655
|
+
var usePendingResearchStore = create17((set, get) => ({
|
|
5571
5656
|
pendingContexts: new Map,
|
|
5572
5657
|
addContext: (parentSessionId, context) => {
|
|
5573
5658
|
set((state) => {
|
|
@@ -5716,8 +5801,8 @@ function useExportToSession() {
|
|
|
5716
5801
|
import { useEffect as useEffect9, useRef as useRef3 } from "react";
|
|
5717
5802
|
|
|
5718
5803
|
// src/stores/ottorouterStore.ts
|
|
5719
|
-
import { create as
|
|
5720
|
-
var useOttoRouterStore =
|
|
5804
|
+
import { create as create18 } from "zustand";
|
|
5805
|
+
var useOttoRouterStore = create18((set) => ({
|
|
5721
5806
|
balance: null,
|
|
5722
5807
|
usdcBalance: null,
|
|
5723
5808
|
network: "mainnet",
|
|
@@ -5746,8 +5831,8 @@ var useOttoRouterStore = create17((set) => ({
|
|
|
5746
5831
|
}));
|
|
5747
5832
|
|
|
5748
5833
|
// src/stores/topupApprovalStore.ts
|
|
5749
|
-
import { create as
|
|
5750
|
-
var useTopupApprovalStore =
|
|
5834
|
+
import { create as create19 } from "zustand";
|
|
5835
|
+
var useTopupApprovalStore = create19((set) => ({
|
|
5751
5836
|
pendingTopup: null,
|
|
5752
5837
|
isProcessing: false,
|
|
5753
5838
|
selectedMethod: null,
|
|
@@ -5900,8 +5985,8 @@ function useOttoRouterPayments(sessionId) {
|
|
|
5900
5985
|
import { useEffect as useEffect10, useCallback as useCallback6 } from "react";
|
|
5901
5986
|
|
|
5902
5987
|
// src/stores/usageStore.ts
|
|
5903
|
-
import { create as
|
|
5904
|
-
var useUsageStore =
|
|
5988
|
+
import { create as create20 } from "zustand";
|
|
5989
|
+
var useUsageStore = create20((set) => ({
|
|
5905
5990
|
usage: {},
|
|
5906
5991
|
isLoading: {},
|
|
5907
5992
|
lastFetched: {},
|
|
@@ -6150,9 +6235,9 @@ import { useEffect as useEffect13, useCallback as useCallback8, useState as useS
|
|
|
6150
6235
|
import { useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
6151
6236
|
|
|
6152
6237
|
// src/stores/onboardingStore.ts
|
|
6153
|
-
import { create as
|
|
6238
|
+
import { create as create21 } from "zustand";
|
|
6154
6239
|
var STEPS = ["wallet", "defaults"];
|
|
6155
|
-
var useOnboardingStore =
|
|
6240
|
+
var useOnboardingStore = create21((set, get) => ({
|
|
6156
6241
|
isOpen: false,
|
|
6157
6242
|
currentStep: "wallet",
|
|
6158
6243
|
manageMode: false,
|
|
@@ -7514,4 +7599,4 @@ export {
|
|
|
7514
7599
|
normalizeQueueState
|
|
7515
7600
|
};
|
|
7516
7601
|
|
|
7517
|
-
//# debugId=
|
|
7602
|
+
//# debugId=A9770107614A950A64756E2164756E21
|