@ottocode/web-sdk 0.1.259 → 0.1.261
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/git/GitDiffViewer.d.ts.map +1 -1
- package/dist/components/index.js +84 -89
- package/dist/components/index.js.map +8 -8
- package/dist/components/ui/ToolApprovalDialog.d.ts.map +1 -1
- package/dist/hooks/index.js +75 -90
- package/dist/hooks/index.js.map +7 -7
- package/dist/hooks/useConfig.d.ts.map +1 -1
- package/dist/hooks/useResearch.d.ts.map +1 -1
- package/dist/hooks/useTunnel.d.ts.map +1 -1
- package/dist/hooks/useWorkingDirectory.d.ts.map +1 -1
- package/dist/index.js +94 -103
- package/dist/index.js.map +9 -9
- package/dist/lib/api-client/config.d.ts.map +1 -1
- package/dist/lib/api-client/index.d.ts.map +1 -1
- package/dist/lib/api-client/sessions.d.ts.map +1 -1
- package/dist/lib/index.js +10 -11
- package/dist/lib/index.js.map +4 -4
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolApprovalDialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ToolApprovalDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToolApprovalDialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ToolApprovalDialog.tsx"],"names":[],"mappings":"AAkBA,UAAU,uBAAuB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,kBAAkB,CAAC,EAClC,OAAO,EACP,SAAS,GACT,EAAE,uBAAuB,2CA+FzB"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
updateSession as apiUpdateSession,
|
|
13
13
|
getSessionQueue as apiGetSessionQueue,
|
|
14
14
|
removeFromQueue as apiRemoveFromQueue,
|
|
15
|
-
retryMessage as apiRetryMessage
|
|
15
|
+
retryMessage as apiRetryMessage,
|
|
16
|
+
buildSessionStreamUrl
|
|
16
17
|
} from "@ottocode/api";
|
|
17
18
|
|
|
18
19
|
// src/lib/api-client/utils.ts
|
|
@@ -194,7 +195,7 @@ var sessionsMixin = {
|
|
|
194
195
|
return response.data;
|
|
195
196
|
},
|
|
196
197
|
getStreamUrl(sessionId) {
|
|
197
|
-
return
|
|
198
|
+
return buildSessionStreamUrl({ baseUrl: getBaseUrl(), sessionId });
|
|
198
199
|
},
|
|
199
200
|
async retryMessage(sessionId, messageId) {
|
|
200
201
|
const response = await apiRetryMessage({
|
|
@@ -356,6 +357,7 @@ import {
|
|
|
356
357
|
getConfig as apiGetConfig,
|
|
357
358
|
getProviderModels as apiGetProviderModels,
|
|
358
359
|
getAllModels as apiGetAllModels,
|
|
360
|
+
discoverProviderModels as apiDiscoverProviderModels,
|
|
359
361
|
updateDefaults as apiUpdateDefaults,
|
|
360
362
|
updateProviderSettings as apiUpdateProviderSettings,
|
|
361
363
|
deleteProviderSettings as apiDeleteProviderSettings
|
|
@@ -382,15 +384,12 @@ var configMixin = {
|
|
|
382
384
|
return response.data;
|
|
383
385
|
},
|
|
384
386
|
async discoverProviderModels(data) {
|
|
385
|
-
const response = await
|
|
386
|
-
|
|
387
|
-
headers: { "content-type": "application/json" },
|
|
388
|
-
body: JSON.stringify(data)
|
|
387
|
+
const response = await apiDiscoverProviderModels({
|
|
388
|
+
body: data
|
|
389
389
|
});
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
return payload;
|
|
390
|
+
if (response.error)
|
|
391
|
+
throw new Error(extractErrorMessage(response.error));
|
|
392
|
+
return response.data;
|
|
394
393
|
},
|
|
395
394
|
async updateProviderSettings(provider, data) {
|
|
396
395
|
const response = await apiUpdateProviderSettings({
|
|
@@ -2711,21 +2710,17 @@ function useTheme() {
|
|
|
2711
2710
|
}
|
|
2712
2711
|
// src/hooks/useWorkingDirectory.ts
|
|
2713
2712
|
import { useEffect as useEffect3, useState as useState2 } from "react";
|
|
2713
|
+
import { getCwd } from "@ottocode/api";
|
|
2714
2714
|
function useWorkingDirectory() {
|
|
2715
2715
|
const [dirName, setDirName] = useState2(null);
|
|
2716
2716
|
useEffect3(() => {
|
|
2717
2717
|
const fetchWorkingDirectory = async () => {
|
|
2718
2718
|
try {
|
|
2719
|
-
const
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
console.log("[useWorkingDirectory] Fetching from:", url);
|
|
2723
|
-
const response = await fetch(url);
|
|
2724
|
-
if (!response.ok) {
|
|
2725
|
-
console.error("[useWorkingDirectory] Failed:", response.status, response.statusText);
|
|
2726
|
-
throw new Error(`Failed to fetch working directory: ${response.status}`);
|
|
2719
|
+
const response = await getCwd({ baseURL: getBaseUrl() });
|
|
2720
|
+
if (response.error) {
|
|
2721
|
+
throw new Error(JSON.stringify(response.error));
|
|
2727
2722
|
}
|
|
2728
|
-
const data =
|
|
2723
|
+
const data = response.data;
|
|
2729
2724
|
console.log("[useWorkingDirectory] Success:", data);
|
|
2730
2725
|
if (data.dirName) {
|
|
2731
2726
|
console.log("[useWorkingDirectory] Setting title to:", data.dirName);
|
|
@@ -3629,6 +3624,13 @@ function useParentSession(sessionId) {
|
|
|
3629
3624
|
}
|
|
3630
3625
|
// src/hooks/useResearch.ts
|
|
3631
3626
|
import { useQuery as useQuery8, useMutation as useMutation6, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
3627
|
+
import {
|
|
3628
|
+
createResearchSession as apiCreateResearchSession,
|
|
3629
|
+
deleteResearchSession as apiDeleteResearchSession,
|
|
3630
|
+
exportResearchSession as apiExportResearchSession,
|
|
3631
|
+
injectResearchContext as apiInjectResearchContext,
|
|
3632
|
+
listResearchSessions as apiListResearchSessions
|
|
3633
|
+
} from "@ottocode/api";
|
|
3632
3634
|
|
|
3633
3635
|
// src/stores/pendingResearchStore.ts
|
|
3634
3636
|
import { create as create13 } from "zustand";
|
|
@@ -3671,73 +3673,48 @@ var usePendingResearchStore = create13((set, get) => ({
|
|
|
3671
3673
|
|
|
3672
3674
|
// src/hooks/useResearch.ts
|
|
3673
3675
|
class ResearchApiClient {
|
|
3674
|
-
get baseUrl() {
|
|
3675
|
-
const win = window;
|
|
3676
|
-
if (win.OTTO_SERVER_URL) {
|
|
3677
|
-
return win.OTTO_SERVER_URL;
|
|
3678
|
-
}
|
|
3679
|
-
if (import.meta.env?.VITE_API_BASE_URL) {
|
|
3680
|
-
return import.meta.env.VITE_API_BASE_URL;
|
|
3681
|
-
}
|
|
3682
|
-
return API_BASE_URL;
|
|
3683
|
-
}
|
|
3684
3676
|
async listResearchSessions(parentSessionId) {
|
|
3685
|
-
const response = await
|
|
3686
|
-
|
|
3687
|
-
headers: { "Content-Type": "application/json" }
|
|
3677
|
+
const response = await apiListResearchSessions({
|
|
3678
|
+
path: { parentId: parentSessionId }
|
|
3688
3679
|
});
|
|
3689
|
-
if (
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
}
|
|
3693
|
-
return response.json();
|
|
3680
|
+
if (response.error)
|
|
3681
|
+
throw new Error(JSON.stringify(response.error));
|
|
3682
|
+
return response.data;
|
|
3694
3683
|
}
|
|
3695
3684
|
async createResearchSession(parentSessionId, data) {
|
|
3696
|
-
const response = await
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
body: JSON.stringify(data)
|
|
3685
|
+
const response = await apiCreateResearchSession({
|
|
3686
|
+
path: { parentId: parentSessionId },
|
|
3687
|
+
body: data
|
|
3700
3688
|
});
|
|
3701
|
-
if (
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
}
|
|
3705
|
-
return response.json();
|
|
3689
|
+
if (response.error)
|
|
3690
|
+
throw new Error(JSON.stringify(response.error));
|
|
3691
|
+
return response.data;
|
|
3706
3692
|
}
|
|
3707
3693
|
async deleteResearchSession(researchId) {
|
|
3708
|
-
const response = await
|
|
3709
|
-
|
|
3710
|
-
headers: { "Content-Type": "application/json" }
|
|
3694
|
+
const response = await apiDeleteResearchSession({
|
|
3695
|
+
path: { researchId }
|
|
3711
3696
|
});
|
|
3712
|
-
if (
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
}
|
|
3716
|
-
return response.json();
|
|
3697
|
+
if (response.error)
|
|
3698
|
+
throw new Error(JSON.stringify(response.error));
|
|
3699
|
+
return response.data;
|
|
3717
3700
|
}
|
|
3718
3701
|
async injectContext(parentSessionId, researchSessionId, label) {
|
|
3719
|
-
const response = await
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
body: JSON.stringify({ researchSessionId, label })
|
|
3702
|
+
const response = await apiInjectResearchContext({
|
|
3703
|
+
path: { parentId: parentSessionId },
|
|
3704
|
+
body: { researchSessionId, label }
|
|
3723
3705
|
});
|
|
3724
|
-
if (
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
}
|
|
3728
|
-
return response.json();
|
|
3706
|
+
if (response.error)
|
|
3707
|
+
throw new Error(JSON.stringify(response.error));
|
|
3708
|
+
return response.data;
|
|
3729
3709
|
}
|
|
3730
3710
|
async exportToNewSession(researchId, data) {
|
|
3731
|
-
const response = await
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
body: JSON.stringify(data ?? {})
|
|
3711
|
+
const response = await apiExportResearchSession({
|
|
3712
|
+
path: { researchId },
|
|
3713
|
+
body: data ?? {}
|
|
3735
3714
|
});
|
|
3736
|
-
if (
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
}
|
|
3740
|
-
return response.json();
|
|
3715
|
+
if (response.error)
|
|
3716
|
+
throw new Error(JSON.stringify(response.error));
|
|
3717
|
+
return response.data;
|
|
3741
3718
|
}
|
|
3742
3719
|
}
|
|
3743
3720
|
var researchApi = new ResearchApiClient;
|
|
@@ -4614,30 +4591,38 @@ function useAuthStatus() {
|
|
|
4614
4591
|
// src/hooks/useTunnel.ts
|
|
4615
4592
|
import { useQuery as useQuery10, useMutation as useMutation7, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
4616
4593
|
import { useEffect as useEffect12, useCallback as useCallback9, useRef as useRef5 } from "react";
|
|
4594
|
+
import {
|
|
4595
|
+
client as client2,
|
|
4596
|
+
getTunnelQr,
|
|
4597
|
+
getTunnelStatus,
|
|
4598
|
+
startTunnel as apiStartTunnel,
|
|
4599
|
+
stopTunnel as apiStopTunnel
|
|
4600
|
+
} from "@ottocode/api";
|
|
4617
4601
|
async function fetchTunnelStatus() {
|
|
4618
|
-
const response = await
|
|
4619
|
-
if (
|
|
4620
|
-
throw new Error(
|
|
4621
|
-
|
|
4622
|
-
return response.json();
|
|
4602
|
+
const response = await getTunnelStatus();
|
|
4603
|
+
if (response.error)
|
|
4604
|
+
throw new Error(JSON.stringify(response.error));
|
|
4605
|
+
return response.data;
|
|
4623
4606
|
}
|
|
4624
4607
|
async function startTunnel() {
|
|
4625
|
-
const response = await
|
|
4626
|
-
|
|
4627
|
-
headers: { "Content-Type": "application/json" },
|
|
4628
|
-
body: JSON.stringify({})
|
|
4608
|
+
const response = await apiStartTunnel({
|
|
4609
|
+
body: {}
|
|
4629
4610
|
});
|
|
4630
|
-
|
|
4611
|
+
if (response.error)
|
|
4612
|
+
throw new Error(JSON.stringify(response.error));
|
|
4613
|
+
return response.data;
|
|
4631
4614
|
}
|
|
4632
4615
|
async function stopTunnel() {
|
|
4633
|
-
const response = await
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
return response.
|
|
4616
|
+
const response = await apiStopTunnel();
|
|
4617
|
+
if (response.error)
|
|
4618
|
+
throw new Error(JSON.stringify(response.error));
|
|
4619
|
+
return response.data;
|
|
4637
4620
|
}
|
|
4638
4621
|
async function fetchTunnelQr() {
|
|
4639
|
-
const response = await
|
|
4640
|
-
|
|
4622
|
+
const response = await getTunnelQr();
|
|
4623
|
+
if (response.error)
|
|
4624
|
+
throw new Error(JSON.stringify(response.error));
|
|
4625
|
+
return response.data;
|
|
4641
4626
|
}
|
|
4642
4627
|
function useTunnelStatus() {
|
|
4643
4628
|
const setStatus = useTunnelStore((s) => s.setStatus);
|
|
@@ -4726,7 +4711,7 @@ function useTunnelStream() {
|
|
|
4726
4711
|
if (eventSourceRef.current) {
|
|
4727
4712
|
eventSourceRef.current.close();
|
|
4728
4713
|
}
|
|
4729
|
-
const es = new EventSource(
|
|
4714
|
+
const es = new EventSource(client2.buildUrl({ baseURL: API_BASE_URL, url: "/v1/tunnel/stream" }));
|
|
4730
4715
|
eventSourceRef.current = es;
|
|
4731
4716
|
es.onmessage = (event) => {
|
|
4732
4717
|
try {
|
|
@@ -5197,4 +5182,4 @@ export {
|
|
|
5197
5182
|
sessionsQueryKey
|
|
5198
5183
|
};
|
|
5199
5184
|
|
|
5200
|
-
//# debugId=
|
|
5185
|
+
//# debugId=2FC62A50D828F41864756E2164756E21
|