@ottocode/web-sdk 0.1.260 → 0.1.262
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":"useConfig.d.ts","sourceRoot":"","sources":["../../src/hooks/useConfig.ts"],"names":[],"mappings":"AAKA,wBAAgB,SAAS;;;;;;;
|
|
1
|
+
{"version":3,"file":"useConfig.d.ts","sourceRoot":"","sources":["../../src/hooks/useConfig.ts"],"names":[],"mappings":"AAKA,wBAAgB,SAAS;;;;;;;oBAkCnB,CAAC;kBAAsD,CAAC;qBAClD,CAAC;sBACH,CAAC;wBAEA,CAAC;kCACA,CAAC;;UAjCZ;AAED,wBAAgB,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM;;;;gBAwCd,CAAC;qBAEhB,CAAC;cAAoB,CAAC;kBAC/B,CAAC;YACD,CAAJ;qBACU,CAAC;uBACN,CAAC;iBACF,CAAA;yBAIS,CAAC;;;;;;UA7Cd;AAED,wBAAgB,YAAY,0FAK3B;AAED,wBAAgB,iBAAiB;;;;;;oBAgDklF,CAAC;kBAAsD,CAAC;qBAA2B,CAAC;sBAA4B,CAAC;wBAA8E,CAAC;kCAAwC,CAAC;;;YA3Cj1F,MAAM;eACH,MAAM;YACT,MAAM;mBACC,MAAM,GAAG,WAAW,GAAG,KAAK,GAAG,MAAM;iBACvC,OAAO;oBACJ,OAAO;qBACN,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO;uBACrD,OAAO;iCACG,MAAM,GAAG,IAAI;YAClC,QAAQ,GAAG,OAAO;;;;;;;;;wBAHvB,CAAC;sBAAsD,CAAC;yBAClD,CAAC;0BACH,CAAC;4BAEA,CAAC;sCACA,CAAC;;;GA+BZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResearch.d.ts","sourceRoot":"","sources":["../../src/hooks/useResearch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useResearch.d.ts","sourceRoot":"","sources":["../../src/hooks/useResearch.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,eAAe;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACxC,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACtC,OAAO,EAAE,eAAe,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACvC,UAAU,EAAE;QACX,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;KACd,CAAC;IACF,eAAe,EAAE,MAAM,CAAC;CACxB;AA+DD,wBAAgB,mBAAmB,CAClC,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,OAAO,UAAO,mFAQd;AAED,wBAAgB,wBAAwB;qBAQpB,MAAM;WAChB;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;YAQ9D;AAED,wBAAgB,wBAAwB;aAnEjB,OAAO;2BA6E7B;AAED,wBAAgB,gBAAgB;qBASZ,MAAM;uBACJ,MAAM;YACjB,MAAM;YAWhB;AAED,wBAAgB,kBAAkB;gBAQnB,MAAM;WACX;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;YAM9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTunnel.d.ts","sourceRoot":"","sources":["../../src/hooks/useTunnel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTunnel.d.ts","sourceRoot":"","sources":["../../src/hooks/useTunnel.ts"],"names":[],"mappings":"AAYA,UAAU,oBAAoB;IAC7B,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC;IACpD,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,mBAAmB;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,gBAAgB;IACzB,EAAE,EAAE,OAAO,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAiCD,wBAAgB,eAAe,gFAoB9B;AAED,wBAAgB,cAAc,iGAgC7B;AAED,wBAAgB,aAAa;QAvExB,OAAO;cACD,MAAM;YACR,MAAM;yBAgFd;AAED,wBAAgB,WAAW,4EAiB1B;AAED,wBAAgB,eAAe;;EAyD9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWorkingDirectory.d.ts","sourceRoot":"","sources":["../../src/hooks/useWorkingDirectory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useWorkingDirectory.d.ts","sourceRoot":"","sources":["../../src/hooks/useWorkingDirectory.ts"],"names":[],"mappings":"AASA,wBAAgB,mBAAmB,WA6BlC"}
|
package/dist/index.js
CHANGED
|
@@ -361,6 +361,7 @@ function Toaster() {
|
|
|
361
361
|
}
|
|
362
362
|
// src/components/ui/ToolApprovalDialog.tsx
|
|
363
363
|
import { useCallback as useCallback2, useState as useState3 } from "react";
|
|
364
|
+
import { resolveApproval } from "@ottocode/api";
|
|
364
365
|
|
|
365
366
|
// src/stores/toolApprovalStore.ts
|
|
366
367
|
import { create as create3 } from "zustand";
|
|
@@ -403,12 +404,12 @@ function ToolApprovalDialog({
|
|
|
403
404
|
const handleApproval = useCallback2(async (callId, approved) => {
|
|
404
405
|
setProcessingId(callId);
|
|
405
406
|
try {
|
|
406
|
-
const response = await
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
body:
|
|
407
|
+
const response = await resolveApproval({
|
|
408
|
+
baseURL: baseUrl,
|
|
409
|
+
path: { id: sessionId },
|
|
410
|
+
body: { callId, approved }
|
|
410
411
|
});
|
|
411
|
-
if (response.
|
|
412
|
+
if (!response.error) {
|
|
412
413
|
removePendingApproval(callId);
|
|
413
414
|
}
|
|
414
415
|
} catch (error) {
|
|
@@ -797,7 +798,8 @@ import {
|
|
|
797
798
|
updateSession as apiUpdateSession,
|
|
798
799
|
getSessionQueue as apiGetSessionQueue,
|
|
799
800
|
removeFromQueue as apiRemoveFromQueue,
|
|
800
|
-
retryMessage as apiRetryMessage
|
|
801
|
+
retryMessage as apiRetryMessage,
|
|
802
|
+
buildSessionStreamUrl
|
|
801
803
|
} from "@ottocode/api";
|
|
802
804
|
|
|
803
805
|
// src/lib/api-client/utils.ts
|
|
@@ -979,7 +981,7 @@ var sessionsMixin = {
|
|
|
979
981
|
return response.data;
|
|
980
982
|
},
|
|
981
983
|
getStreamUrl(sessionId) {
|
|
982
|
-
return
|
|
984
|
+
return buildSessionStreamUrl({ baseUrl: getBaseUrl(), sessionId });
|
|
983
985
|
},
|
|
984
986
|
async retryMessage(sessionId, messageId) {
|
|
985
987
|
const response = await apiRetryMessage({
|
|
@@ -1141,6 +1143,7 @@ import {
|
|
|
1141
1143
|
getConfig as apiGetConfig,
|
|
1142
1144
|
getProviderModels as apiGetProviderModels,
|
|
1143
1145
|
getAllModels as apiGetAllModels,
|
|
1146
|
+
discoverProviderModels as apiDiscoverProviderModels,
|
|
1144
1147
|
updateDefaults as apiUpdateDefaults,
|
|
1145
1148
|
updateProviderSettings as apiUpdateProviderSettings,
|
|
1146
1149
|
deleteProviderSettings as apiDeleteProviderSettings
|
|
@@ -1167,15 +1170,12 @@ var configMixin = {
|
|
|
1167
1170
|
return response.data;
|
|
1168
1171
|
},
|
|
1169
1172
|
async discoverProviderModels(data) {
|
|
1170
|
-
const response = await
|
|
1171
|
-
|
|
1172
|
-
headers: { "content-type": "application/json" },
|
|
1173
|
-
body: JSON.stringify(data)
|
|
1173
|
+
const response = await apiDiscoverProviderModels({
|
|
1174
|
+
body: data
|
|
1174
1175
|
});
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
return payload;
|
|
1176
|
+
if (response.error)
|
|
1177
|
+
throw new Error(extractErrorMessage(response.error));
|
|
1178
|
+
return response.data;
|
|
1179
1179
|
},
|
|
1180
1180
|
async updateProviderSettings(provider, data) {
|
|
1181
1181
|
const response = await apiUpdateProviderSettings({
|
|
@@ -17224,6 +17224,7 @@ import {
|
|
|
17224
17224
|
prism as prism9,
|
|
17225
17225
|
vscDarkPlus as vscDarkPlus9
|
|
17226
17226
|
} from "react-syntax-highlighter/dist/esm/styles/prism";
|
|
17227
|
+
import { client as client2 } from "@ottocode/api";
|
|
17227
17228
|
import { jsx as jsx72, jsxs as jsxs64, Fragment as Fragment31 } from "react/jsx-runtime";
|
|
17228
17229
|
var IMAGE_EXTENSIONS = new Set([
|
|
17229
17230
|
"png",
|
|
@@ -17358,7 +17359,11 @@ function GitDiffViewer({ diff }) {
|
|
|
17358
17359
|
}
|
|
17359
17360
|
if (diff.isBinary) {
|
|
17360
17361
|
const isImage = isImageFile(diff.file);
|
|
17361
|
-
const imageUrl = isImage ?
|
|
17362
|
+
const imageUrl = isImage ? client2.buildUrl({
|
|
17363
|
+
baseURL: getRuntimeApiBaseUrl(),
|
|
17364
|
+
url: "/v1/files/raw",
|
|
17365
|
+
query: { path: diff.file }
|
|
17366
|
+
}) : null;
|
|
17362
17367
|
return /* @__PURE__ */ jsxs64("div", {
|
|
17363
17368
|
className: "flex flex-col h-full bg-background",
|
|
17364
17369
|
children: [
|
|
@@ -19084,7 +19089,7 @@ var TerminalTabBar = memo23(function TerminalTabBar2({
|
|
|
19084
19089
|
// src/components/terminals/TerminalViewer.tsx
|
|
19085
19090
|
import { useEffect as useEffect31, useRef as useRef20, useState as useState36, useCallback as useCallback23 } from "react";
|
|
19086
19091
|
import { init, Terminal as Terminal7, FitAddon } from "ghostty-web";
|
|
19087
|
-
import { client as
|
|
19092
|
+
import { client as client3 } from "@ottocode/api";
|
|
19088
19093
|
import { jsx as jsx80, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
19089
19094
|
var FONT_FAMILY = '"JetBrainsMono NFM", monospace';
|
|
19090
19095
|
var WS_RECONNECT_DELAY = 1500;
|
|
@@ -19151,7 +19156,7 @@ async function loadEmbeddedFont() {
|
|
|
19151
19156
|
fontsLoaded2 = true;
|
|
19152
19157
|
}
|
|
19153
19158
|
function resolveApiBaseUrl() {
|
|
19154
|
-
const config2 =
|
|
19159
|
+
const config2 = client3.getConfig?.();
|
|
19155
19160
|
if (config2 && typeof config2.baseURL === "string" && config2.baseURL.length > 0) {
|
|
19156
19161
|
return config2.baseURL;
|
|
19157
19162
|
}
|
|
@@ -20511,74 +20516,56 @@ import {
|
|
|
20511
20516
|
|
|
20512
20517
|
// src/hooks/useResearch.ts
|
|
20513
20518
|
import { useQuery as useQuery11, useMutation as useMutation7, useQueryClient as useQueryClient13 } from "@tanstack/react-query";
|
|
20519
|
+
import {
|
|
20520
|
+
createResearchSession as apiCreateResearchSession,
|
|
20521
|
+
deleteResearchSession as apiDeleteResearchSession,
|
|
20522
|
+
exportResearchSession as apiExportResearchSession,
|
|
20523
|
+
injectResearchContext as apiInjectResearchContext,
|
|
20524
|
+
listResearchSessions as apiListResearchSessions
|
|
20525
|
+
} from "@ottocode/api";
|
|
20514
20526
|
class ResearchApiClient {
|
|
20515
|
-
get baseUrl() {
|
|
20516
|
-
const win = window;
|
|
20517
|
-
if (win.OTTO_SERVER_URL) {
|
|
20518
|
-
return win.OTTO_SERVER_URL;
|
|
20519
|
-
}
|
|
20520
|
-
if (import.meta.env?.VITE_API_BASE_URL) {
|
|
20521
|
-
return import.meta.env.VITE_API_BASE_URL;
|
|
20522
|
-
}
|
|
20523
|
-
return API_BASE_URL;
|
|
20524
|
-
}
|
|
20525
20527
|
async listResearchSessions(parentSessionId) {
|
|
20526
|
-
const response = await
|
|
20527
|
-
|
|
20528
|
-
headers: { "Content-Type": "application/json" }
|
|
20528
|
+
const response = await apiListResearchSessions({
|
|
20529
|
+
path: { parentId: parentSessionId }
|
|
20529
20530
|
});
|
|
20530
|
-
if (
|
|
20531
|
-
|
|
20532
|
-
|
|
20533
|
-
}
|
|
20534
|
-
return response.json();
|
|
20531
|
+
if (response.error)
|
|
20532
|
+
throw new Error(JSON.stringify(response.error));
|
|
20533
|
+
return response.data;
|
|
20535
20534
|
}
|
|
20536
20535
|
async createResearchSession(parentSessionId, data) {
|
|
20537
|
-
const response = await
|
|
20538
|
-
|
|
20539
|
-
|
|
20540
|
-
body: JSON.stringify(data)
|
|
20536
|
+
const response = await apiCreateResearchSession({
|
|
20537
|
+
path: { parentId: parentSessionId },
|
|
20538
|
+
body: data
|
|
20541
20539
|
});
|
|
20542
|
-
if (
|
|
20543
|
-
|
|
20544
|
-
|
|
20545
|
-
}
|
|
20546
|
-
return response.json();
|
|
20540
|
+
if (response.error)
|
|
20541
|
+
throw new Error(JSON.stringify(response.error));
|
|
20542
|
+
return response.data;
|
|
20547
20543
|
}
|
|
20548
20544
|
async deleteResearchSession(researchId) {
|
|
20549
|
-
const response = await
|
|
20550
|
-
|
|
20551
|
-
headers: { "Content-Type": "application/json" }
|
|
20545
|
+
const response = await apiDeleteResearchSession({
|
|
20546
|
+
path: { researchId }
|
|
20552
20547
|
});
|
|
20553
|
-
if (
|
|
20554
|
-
|
|
20555
|
-
|
|
20556
|
-
}
|
|
20557
|
-
return response.json();
|
|
20548
|
+
if (response.error)
|
|
20549
|
+
throw new Error(JSON.stringify(response.error));
|
|
20550
|
+
return response.data;
|
|
20558
20551
|
}
|
|
20559
20552
|
async injectContext(parentSessionId, researchSessionId, label) {
|
|
20560
|
-
const response = await
|
|
20561
|
-
|
|
20562
|
-
|
|
20563
|
-
body: JSON.stringify({ researchSessionId, label })
|
|
20553
|
+
const response = await apiInjectResearchContext({
|
|
20554
|
+
path: { parentId: parentSessionId },
|
|
20555
|
+
body: { researchSessionId, label }
|
|
20564
20556
|
});
|
|
20565
|
-
if (
|
|
20566
|
-
|
|
20567
|
-
|
|
20568
|
-
}
|
|
20569
|
-
return response.json();
|
|
20557
|
+
if (response.error)
|
|
20558
|
+
throw new Error(JSON.stringify(response.error));
|
|
20559
|
+
return response.data;
|
|
20570
20560
|
}
|
|
20571
20561
|
async exportToNewSession(researchId, data) {
|
|
20572
|
-
const response = await
|
|
20573
|
-
|
|
20574
|
-
|
|
20575
|
-
body: JSON.stringify(data ?? {})
|
|
20562
|
+
const response = await apiExportResearchSession({
|
|
20563
|
+
path: { researchId },
|
|
20564
|
+
body: data ?? {}
|
|
20576
20565
|
});
|
|
20577
|
-
if (
|
|
20578
|
-
|
|
20579
|
-
|
|
20580
|
-
}
|
|
20581
|
-
return response.json();
|
|
20566
|
+
if (response.error)
|
|
20567
|
+
throw new Error(JSON.stringify(response.error));
|
|
20568
|
+
return response.data;
|
|
20582
20569
|
}
|
|
20583
20570
|
}
|
|
20584
20571
|
var researchApi = new ResearchApiClient;
|
|
@@ -22738,30 +22725,38 @@ import { QRCodeSVG as QRCodeSVG2 } from "qrcode.react";
|
|
|
22738
22725
|
// src/hooks/useTunnel.ts
|
|
22739
22726
|
import { useQuery as useQuery12, useMutation as useMutation9, useQueryClient as useQueryClient16 } from "@tanstack/react-query";
|
|
22740
22727
|
import { useEffect as useEffect38, useCallback as useCallback28, useRef as useRef27 } from "react";
|
|
22728
|
+
import {
|
|
22729
|
+
client as client4,
|
|
22730
|
+
getTunnelQr,
|
|
22731
|
+
getTunnelStatus,
|
|
22732
|
+
startTunnel as apiStartTunnel,
|
|
22733
|
+
stopTunnel as apiStopTunnel
|
|
22734
|
+
} from "@ottocode/api";
|
|
22741
22735
|
async function fetchTunnelStatus() {
|
|
22742
|
-
const response = await
|
|
22743
|
-
if (
|
|
22744
|
-
throw new Error(
|
|
22745
|
-
|
|
22746
|
-
return response.json();
|
|
22736
|
+
const response = await getTunnelStatus();
|
|
22737
|
+
if (response.error)
|
|
22738
|
+
throw new Error(JSON.stringify(response.error));
|
|
22739
|
+
return response.data;
|
|
22747
22740
|
}
|
|
22748
22741
|
async function startTunnel() {
|
|
22749
|
-
const response = await
|
|
22750
|
-
|
|
22751
|
-
headers: { "Content-Type": "application/json" },
|
|
22752
|
-
body: JSON.stringify({})
|
|
22742
|
+
const response = await apiStartTunnel({
|
|
22743
|
+
body: {}
|
|
22753
22744
|
});
|
|
22754
|
-
|
|
22745
|
+
if (response.error)
|
|
22746
|
+
throw new Error(JSON.stringify(response.error));
|
|
22747
|
+
return response.data;
|
|
22755
22748
|
}
|
|
22756
22749
|
async function stopTunnel() {
|
|
22757
|
-
const response = await
|
|
22758
|
-
|
|
22759
|
-
|
|
22760
|
-
return response.
|
|
22750
|
+
const response = await apiStopTunnel();
|
|
22751
|
+
if (response.error)
|
|
22752
|
+
throw new Error(JSON.stringify(response.error));
|
|
22753
|
+
return response.data;
|
|
22761
22754
|
}
|
|
22762
22755
|
async function fetchTunnelQr() {
|
|
22763
|
-
const response = await
|
|
22764
|
-
|
|
22756
|
+
const response = await getTunnelQr();
|
|
22757
|
+
if (response.error)
|
|
22758
|
+
throw new Error(JSON.stringify(response.error));
|
|
22759
|
+
return response.data;
|
|
22765
22760
|
}
|
|
22766
22761
|
function useTunnelStatus() {
|
|
22767
22762
|
const setStatus = useTunnelStore((s) => s.setStatus);
|
|
@@ -22850,7 +22845,7 @@ function useTunnelStream() {
|
|
|
22850
22845
|
if (eventSourceRef.current) {
|
|
22851
22846
|
eventSourceRef.current.close();
|
|
22852
22847
|
}
|
|
22853
|
-
const es = new EventSource(
|
|
22848
|
+
const es = new EventSource(client4.buildUrl({ baseURL: API_BASE_URL, url: "/v1/tunnel/stream" }));
|
|
22854
22849
|
eventSourceRef.current = es;
|
|
22855
22850
|
es.onmessage = (event) => {
|
|
22856
22851
|
try {
|
|
@@ -27544,21 +27539,17 @@ function useTheme() {
|
|
|
27544
27539
|
}
|
|
27545
27540
|
// src/hooks/useWorkingDirectory.ts
|
|
27546
27541
|
import { useEffect as useEffect49, useState as useState47 } from "react";
|
|
27542
|
+
import { getCwd } from "@ottocode/api";
|
|
27547
27543
|
function useWorkingDirectory() {
|
|
27548
27544
|
const [dirName, setDirName] = useState47(null);
|
|
27549
27545
|
useEffect49(() => {
|
|
27550
27546
|
const fetchWorkingDirectory = async () => {
|
|
27551
27547
|
try {
|
|
27552
|
-
const
|
|
27553
|
-
|
|
27554
|
-
|
|
27555
|
-
console.log("[useWorkingDirectory] Fetching from:", url);
|
|
27556
|
-
const response = await fetch(url);
|
|
27557
|
-
if (!response.ok) {
|
|
27558
|
-
console.error("[useWorkingDirectory] Failed:", response.status, response.statusText);
|
|
27559
|
-
throw new Error(`Failed to fetch working directory: ${response.status}`);
|
|
27548
|
+
const response = await getCwd({ baseURL: getBaseUrl() });
|
|
27549
|
+
if (response.error) {
|
|
27550
|
+
throw new Error(JSON.stringify(response.error));
|
|
27560
27551
|
}
|
|
27561
|
-
const data =
|
|
27552
|
+
const data = response.data;
|
|
27562
27553
|
console.log("[useWorkingDirectory] Success:", data);
|
|
27563
27554
|
if (data.dirName) {
|
|
27564
27555
|
console.log("[useWorkingDirectory] Setting title to:", data.dirName);
|
|
@@ -28031,11 +28022,11 @@ function useSetuPayments(sessionId) {
|
|
|
28031
28022
|
useEffect52(() => {
|
|
28032
28023
|
if (!sessionId)
|
|
28033
28024
|
return;
|
|
28034
|
-
const
|
|
28035
|
-
clientRef.current =
|
|
28025
|
+
const client5 = new SSEClient;
|
|
28026
|
+
clientRef.current = client5;
|
|
28036
28027
|
const url = apiClient.getStreamUrl(sessionId);
|
|
28037
|
-
|
|
28038
|
-
const unsubscribe =
|
|
28028
|
+
client5.connect(url);
|
|
28029
|
+
const unsubscribe = client5.on("*", (event) => {
|
|
28039
28030
|
const payload = event.payload;
|
|
28040
28031
|
switch (event.type) {
|
|
28041
28032
|
case "ottorouter.topup.required": {
|
|
@@ -28145,7 +28136,7 @@ function useSetuPayments(sessionId) {
|
|
|
28145
28136
|
});
|
|
28146
28137
|
return () => {
|
|
28147
28138
|
unsubscribe();
|
|
28148
|
-
|
|
28139
|
+
client5.disconnect();
|
|
28149
28140
|
};
|
|
28150
28141
|
}, [
|
|
28151
28142
|
sessionId,
|
|
@@ -28332,4 +28323,4 @@ export {
|
|
|
28332
28323
|
API_BASE_URL
|
|
28333
28324
|
};
|
|
28334
28325
|
|
|
28335
|
-
//# debugId=
|
|
28326
|
+
//# debugId=CD1AF44B1C22B25564756E2164756E21
|