@ottocode/web-sdk 0.1.306 → 0.1.308
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/agents/AgentEditor.d.ts.map +1 -1
- package/dist/components/agents/CreateAgentModal.d.ts.map +1 -1
- package/dist/components/chat/ChatInput.d.ts.map +1 -1
- package/dist/components/chat/ChatInputKeyHandler.d.ts.map +1 -1
- package/dist/components/chat/ConfigModal.d.ts.map +1 -1
- package/dist/components/chat/InputHighlightOverlay.d.ts +16 -0
- package/dist/components/chat/InputHighlightOverlay.d.ts.map +1 -0
- package/dist/components/chat/InputSubagentsBar.d.ts +6 -0
- package/dist/components/chat/InputSubagentsBar.d.ts.map +1 -0
- package/dist/components/chat/MentionPopup.d.ts +30 -0
- package/dist/components/chat/MentionPopup.d.ts.map +1 -0
- package/dist/components/goals/GoalsSidebar.d.ts +6 -0
- package/dist/components/goals/GoalsSidebar.d.ts.map +1 -0
- package/dist/components/goals/GoalsSidebarToggle.d.ts +6 -0
- package/dist/components/goals/GoalsSidebarToggle.d.ts.map +1 -0
- package/dist/components/goals/index.d.ts +3 -0
- package/dist/components/goals/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +6895 -5084
- package/dist/components/index.js.map +34 -20
- package/dist/components/messages/GoalStartNotice.d.ts +12 -0
- package/dist/components/messages/GoalStartNotice.d.ts.map +1 -0
- package/dist/components/messages/SubagentResultsNotice.d.ts +21 -0
- package/dist/components/messages/SubagentResultsNotice.d.ts.map +1 -0
- package/dist/components/messages/UserMessageGroup.d.ts.map +1 -1
- package/dist/components/messages/compactActivity.d.ts.map +1 -1
- package/dist/components/messages/renderers/GoalToolRenderer.d.ts +3 -0
- package/dist/components/messages/renderers/GoalToolRenderer.d.ts.map +1 -0
- package/dist/components/messages/renderers/SubagentToolRenderer.d.ts +3 -0
- package/dist/components/messages/renderers/SubagentToolRenderer.d.ts.map +1 -0
- package/dist/components/messages/renderers/index.d.ts.map +1 -1
- package/dist/components/settings/SettingsSidebar.d.ts.map +1 -1
- package/dist/components/subagents/SubagentFloatingViewer.d.ts +6 -0
- package/dist/components/subagents/SubagentFloatingViewer.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +269 -63
- package/dist/hooks/index.js.map +10 -8
- package/dist/hooks/useAgents.d.ts +44 -1
- package/dist/hooks/useAgents.d.ts.map +1 -1
- package/dist/hooks/useChatComposer.d.ts +1 -0
- package/dist/hooks/useChatComposer.d.ts.map +1 -1
- package/dist/hooks/useConfig.d.ts +4 -0
- package/dist/hooks/useConfig.d.ts.map +1 -1
- package/dist/hooks/useGoals.d.ts +48 -0
- package/dist/hooks/useGoals.d.ts.map +1 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts +1 -1
- package/dist/hooks/useSessionStream.d.ts.map +1 -1
- package/dist/index.js +6952 -5128
- package/dist/index.js.map +34 -20
- package/dist/lib/api-client/config.d.ts +3 -0
- package/dist/lib/api-client/config.d.ts.map +1 -1
- package/dist/lib/api-client/goals.d.ts +70 -0
- package/dist/lib/api-client/goals.d.ts.map +1 -0
- package/dist/lib/api-client/index.d.ts +35 -0
- package/dist/lib/api-client/index.d.ts.map +1 -1
- package/dist/lib/index.js +78 -1
- package/dist/lib/index.js.map +6 -5
- package/dist/lib/mentionHighlightStyles.d.ts +3 -0
- package/dist/lib/mentionHighlightStyles.d.ts.map +1 -0
- package/dist/stores/goalsPanelStore.d.ts +9 -0
- package/dist/stores/goalsPanelStore.d.ts.map +1 -0
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/index.js +61 -9
- package/dist/stores/index.js.map +5 -3
- package/dist/stores/subagentViewerStore.d.ts +15 -0
- package/dist/stores/subagentViewerStore.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/components/chat/FileMentionPopup.d.ts +0 -15
- package/dist/components/chat/FileMentionPopup.d.ts.map +0 -1
package/dist/hooks/index.js
CHANGED
|
@@ -758,6 +758,76 @@ var branchesMixin = {
|
|
|
758
758
|
}
|
|
759
759
|
};
|
|
760
760
|
|
|
761
|
+
// src/lib/api-client/goals.ts
|
|
762
|
+
import {
|
|
763
|
+
getSessionGoal as apiGetSessionGoal,
|
|
764
|
+
createSessionGoal as apiCreateSessionGoal,
|
|
765
|
+
updateGoal as apiUpdateGoal,
|
|
766
|
+
addGoalTasks as apiAddGoalTasks,
|
|
767
|
+
updateGoalTask as apiUpdateGoalTask,
|
|
768
|
+
startGoal as apiStartGoal,
|
|
769
|
+
listSessionSubagents as apiListSessionSubagents
|
|
770
|
+
} from "@ottocode/api";
|
|
771
|
+
var goalsMixin = {
|
|
772
|
+
async getSessionGoal(sessionId) {
|
|
773
|
+
const response = await apiGetSessionGoal({ path: { sessionId } });
|
|
774
|
+
if (response.error)
|
|
775
|
+
throw new Error(extractErrorMessage(response.error));
|
|
776
|
+
return response.data;
|
|
777
|
+
},
|
|
778
|
+
async createSessionGoal(sessionId, data) {
|
|
779
|
+
const response = await apiCreateSessionGoal({
|
|
780
|
+
path: { sessionId },
|
|
781
|
+
body: data
|
|
782
|
+
});
|
|
783
|
+
if (response.error)
|
|
784
|
+
throw new Error(extractErrorMessage(response.error));
|
|
785
|
+
return response.data;
|
|
786
|
+
},
|
|
787
|
+
async updateGoal(goalId, data) {
|
|
788
|
+
const response = await apiUpdateGoal({
|
|
789
|
+
path: { goalId },
|
|
790
|
+
body: data
|
|
791
|
+
});
|
|
792
|
+
if (response.error)
|
|
793
|
+
throw new Error(extractErrorMessage(response.error));
|
|
794
|
+
return response.data;
|
|
795
|
+
},
|
|
796
|
+
async addGoalTasks(goalId, tasks) {
|
|
797
|
+
const response = await apiAddGoalTasks({
|
|
798
|
+
path: { goalId },
|
|
799
|
+
body: { tasks }
|
|
800
|
+
});
|
|
801
|
+
if (response.error)
|
|
802
|
+
throw new Error(extractErrorMessage(response.error));
|
|
803
|
+
return response.data;
|
|
804
|
+
},
|
|
805
|
+
async updateGoalTask(goalId, taskId, data) {
|
|
806
|
+
const response = await apiUpdateGoalTask({
|
|
807
|
+
path: { goalId, taskId },
|
|
808
|
+
body: data
|
|
809
|
+
});
|
|
810
|
+
if (response.error)
|
|
811
|
+
throw new Error(extractErrorMessage(response.error));
|
|
812
|
+
return response.data;
|
|
813
|
+
},
|
|
814
|
+
async startGoal(goalId) {
|
|
815
|
+
const response = await apiStartGoal({ path: { goalId } });
|
|
816
|
+
if (response.error)
|
|
817
|
+
throw new Error(extractErrorMessage(response.error));
|
|
818
|
+
return response.data;
|
|
819
|
+
},
|
|
820
|
+
async listSessionSubagents(sessionId, status) {
|
|
821
|
+
const response = await apiListSessionSubagents({
|
|
822
|
+
path: { sessionId },
|
|
823
|
+
query: status ? { status } : undefined
|
|
824
|
+
});
|
|
825
|
+
if (response.error)
|
|
826
|
+
throw new Error(extractErrorMessage(response.error));
|
|
827
|
+
return response.data;
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
|
|
761
831
|
// src/lib/api-client/approval.ts
|
|
762
832
|
import {
|
|
763
833
|
resolveApproval as apiResolveApproval,
|
|
@@ -1313,6 +1383,13 @@ class ApiClient {
|
|
|
1313
1383
|
getShareStatus = branchesMixin.getShareStatus;
|
|
1314
1384
|
shareSession = branchesMixin.shareSession;
|
|
1315
1385
|
syncSession = branchesMixin.syncSession;
|
|
1386
|
+
getSessionGoal = goalsMixin.getSessionGoal;
|
|
1387
|
+
createSessionGoal = goalsMixin.createSessionGoal;
|
|
1388
|
+
updateGoal = goalsMixin.updateGoal;
|
|
1389
|
+
addGoalTasks = goalsMixin.addGoalTasks;
|
|
1390
|
+
updateGoalTask = goalsMixin.updateGoalTask;
|
|
1391
|
+
startGoal = goalsMixin.startGoal;
|
|
1392
|
+
listSessionSubagents = goalsMixin.listSessionSubagents;
|
|
1316
1393
|
approveToolCall = approvalMixin.approveToolCall;
|
|
1317
1394
|
getPendingApprovals = approvalMixin.getPendingApprovals;
|
|
1318
1395
|
submitSecureInput = secureInputMixin.submitSecureInput;
|
|
@@ -4328,6 +4405,8 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
|
|
|
4328
4405
|
}
|
|
4329
4406
|
queryClient.invalidateQueries({ queryKey: ["messages", sessionId] });
|
|
4330
4407
|
queryClient.invalidateQueries({ queryKey: sessionsQueryKey });
|
|
4408
|
+
queryClient.invalidateQueries({ queryKey: ["goal", sessionId] });
|
|
4409
|
+
queryClient.invalidateQueries({ queryKey: ["subagents", sessionId] });
|
|
4331
4410
|
break;
|
|
4332
4411
|
}
|
|
4333
4412
|
case "tool.delta": {
|
|
@@ -4455,6 +4534,13 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
|
|
|
4455
4534
|
}
|
|
4456
4535
|
break;
|
|
4457
4536
|
}
|
|
4537
|
+
case "goal.updated": {
|
|
4538
|
+
queryClient.invalidateQueries({ queryKey: ["goal", sessionId] });
|
|
4539
|
+
queryClient.invalidateQueries({
|
|
4540
|
+
queryKey: ["subagents", sessionId]
|
|
4541
|
+
});
|
|
4542
|
+
break;
|
|
4543
|
+
}
|
|
4458
4544
|
case "queue.updated": {
|
|
4459
4545
|
const queueState = normalizeQueueState({
|
|
4460
4546
|
currentMessageId: payload?.currentMessageId,
|
|
@@ -5878,8 +5964,109 @@ function useParentSession(sessionId) {
|
|
|
5878
5964
|
enabled: Boolean(sessionId)
|
|
5879
5965
|
});
|
|
5880
5966
|
}
|
|
5967
|
+
// src/hooks/useGoals.ts
|
|
5968
|
+
import { useMutation as useMutation6, useQuery as useQuery8, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
|
|
5969
|
+
var goalQueryKey = (sessionId) => [
|
|
5970
|
+
"goal",
|
|
5971
|
+
sessionId
|
|
5972
|
+
];
|
|
5973
|
+
var subagentsQueryKey = (sessionId) => [
|
|
5974
|
+
"subagents",
|
|
5975
|
+
sessionId
|
|
5976
|
+
];
|
|
5977
|
+
function useOttoEnabled() {
|
|
5978
|
+
const { data: config2 } = useConfig();
|
|
5979
|
+
return config2?.defaults?.ottoEnabled ?? true;
|
|
5980
|
+
}
|
|
5981
|
+
function useSessionGoal(sessionId) {
|
|
5982
|
+
const ottoEnabled = useOttoEnabled();
|
|
5983
|
+
return useQuery8({
|
|
5984
|
+
queryKey: goalQueryKey(sessionId),
|
|
5985
|
+
queryFn: () => {
|
|
5986
|
+
if (!sessionId)
|
|
5987
|
+
throw new Error("No session ID");
|
|
5988
|
+
return apiClient.getSessionGoal(sessionId);
|
|
5989
|
+
},
|
|
5990
|
+
enabled: Boolean(sessionId) && ottoEnabled,
|
|
5991
|
+
refetchInterval: 15000
|
|
5992
|
+
});
|
|
5993
|
+
}
|
|
5994
|
+
function useCreateSessionGoal(sessionId) {
|
|
5995
|
+
const queryClient = useQueryClient8();
|
|
5996
|
+
return useMutation6({
|
|
5997
|
+
mutationFn: (data) => {
|
|
5998
|
+
if (!sessionId)
|
|
5999
|
+
throw new Error("No session ID");
|
|
6000
|
+
return apiClient.createSessionGoal(sessionId, data);
|
|
6001
|
+
},
|
|
6002
|
+
onSuccess: () => {
|
|
6003
|
+
queryClient.invalidateQueries({ queryKey: goalQueryKey(sessionId) });
|
|
6004
|
+
}
|
|
6005
|
+
});
|
|
6006
|
+
}
|
|
6007
|
+
function useUpdateGoal(sessionId) {
|
|
6008
|
+
const queryClient = useQueryClient8();
|
|
6009
|
+
return useMutation6({
|
|
6010
|
+
mutationFn: (input) => apiClient.updateGoal(input.goalId, {
|
|
6011
|
+
title: input.title,
|
|
6012
|
+
status: input.status
|
|
6013
|
+
}),
|
|
6014
|
+
onSuccess: () => {
|
|
6015
|
+
queryClient.invalidateQueries({ queryKey: goalQueryKey(sessionId) });
|
|
6016
|
+
}
|
|
6017
|
+
});
|
|
6018
|
+
}
|
|
6019
|
+
function useAddGoalTasks(sessionId) {
|
|
6020
|
+
const queryClient = useQueryClient8();
|
|
6021
|
+
return useMutation6({
|
|
6022
|
+
mutationFn: (input) => apiClient.addGoalTasks(input.goalId, input.tasks),
|
|
6023
|
+
onSuccess: () => {
|
|
6024
|
+
queryClient.invalidateQueries({ queryKey: goalQueryKey(sessionId) });
|
|
6025
|
+
}
|
|
6026
|
+
});
|
|
6027
|
+
}
|
|
6028
|
+
function useUpdateGoalTask(sessionId) {
|
|
6029
|
+
const queryClient = useQueryClient8();
|
|
6030
|
+
return useMutation6({
|
|
6031
|
+
mutationFn: (input) => apiClient.updateGoalTask(input.goalId, input.taskId, {
|
|
6032
|
+
content: input.content,
|
|
6033
|
+
status: input.status,
|
|
6034
|
+
note: input.note
|
|
6035
|
+
}),
|
|
6036
|
+
onSuccess: () => {
|
|
6037
|
+
queryClient.invalidateQueries({ queryKey: goalQueryKey(sessionId) });
|
|
6038
|
+
}
|
|
6039
|
+
});
|
|
6040
|
+
}
|
|
6041
|
+
function useSessionSubagents(sessionId, status) {
|
|
6042
|
+
return useQuery8({
|
|
6043
|
+
queryKey: [...subagentsQueryKey(sessionId), status ?? "all"],
|
|
6044
|
+
queryFn: () => {
|
|
6045
|
+
if (!sessionId)
|
|
6046
|
+
throw new Error("No session ID");
|
|
6047
|
+
return apiClient.listSessionSubagents(sessionId, status);
|
|
6048
|
+
},
|
|
6049
|
+
enabled: Boolean(sessionId),
|
|
6050
|
+
refetchInterval: (query) => {
|
|
6051
|
+
const hasRunning = query.state.data?.subagents.some((record) => record.status === "running");
|
|
6052
|
+
return hasRunning ? 5000 : 30000;
|
|
6053
|
+
}
|
|
6054
|
+
});
|
|
6055
|
+
}
|
|
6056
|
+
function useStartGoal(sessionId) {
|
|
6057
|
+
const queryClient = useQueryClient8();
|
|
6058
|
+
return useMutation6({
|
|
6059
|
+
mutationFn: (input) => apiClient.startGoal(input.goalId),
|
|
6060
|
+
onSuccess: () => {
|
|
6061
|
+
queryClient.invalidateQueries({ queryKey: goalQueryKey(sessionId) });
|
|
6062
|
+
if (sessionId) {
|
|
6063
|
+
queryClient.invalidateQueries({ queryKey: ["messages", sessionId] });
|
|
6064
|
+
}
|
|
6065
|
+
}
|
|
6066
|
+
});
|
|
6067
|
+
}
|
|
5881
6068
|
// src/hooks/useResearch.ts
|
|
5882
|
-
import { useQuery as
|
|
6069
|
+
import { useQuery as useQuery9, useMutation as useMutation7, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
5883
6070
|
import {
|
|
5884
6071
|
createResearchSession as apiCreateResearchSession,
|
|
5885
6072
|
deleteResearchSession as apiDeleteResearchSession,
|
|
@@ -5975,7 +6162,7 @@ class ResearchApiClient {
|
|
|
5975
6162
|
}
|
|
5976
6163
|
var researchApi = new ResearchApiClient;
|
|
5977
6164
|
function useResearchSessions(parentSessionId, enabled = true) {
|
|
5978
|
-
return
|
|
6165
|
+
return useQuery9({
|
|
5979
6166
|
queryKey: ["research", "sessions", parentSessionId],
|
|
5980
6167
|
queryFn: () => researchApi.listResearchSessions(parentSessionId),
|
|
5981
6168
|
enabled: !!parentSessionId && enabled,
|
|
@@ -5983,8 +6170,8 @@ function useResearchSessions(parentSessionId, enabled = true) {
|
|
|
5983
6170
|
});
|
|
5984
6171
|
}
|
|
5985
6172
|
function useCreateResearchSession() {
|
|
5986
|
-
const queryClient =
|
|
5987
|
-
return
|
|
6173
|
+
const queryClient = useQueryClient9();
|
|
6174
|
+
return useMutation7({
|
|
5988
6175
|
mutationFn: ({
|
|
5989
6176
|
parentSessionId,
|
|
5990
6177
|
data
|
|
@@ -5997,8 +6184,8 @@ function useCreateResearchSession() {
|
|
|
5997
6184
|
});
|
|
5998
6185
|
}
|
|
5999
6186
|
function useDeleteResearchSession() {
|
|
6000
|
-
const queryClient =
|
|
6001
|
-
return
|
|
6187
|
+
const queryClient = useQueryClient9();
|
|
6188
|
+
return useMutation7({
|
|
6002
6189
|
mutationFn: (researchId) => researchApi.deleteResearchSession(researchId),
|
|
6003
6190
|
onSuccess: () => {
|
|
6004
6191
|
queryClient.invalidateQueries({ queryKey: ["research", "sessions"] });
|
|
@@ -6007,7 +6194,7 @@ function useDeleteResearchSession() {
|
|
|
6007
6194
|
}
|
|
6008
6195
|
function useInjectContext() {
|
|
6009
6196
|
const addContext = usePendingResearchStore((state) => state.addContext);
|
|
6010
|
-
return
|
|
6197
|
+
return useMutation7({
|
|
6011
6198
|
mutationFn: ({
|
|
6012
6199
|
parentSessionId,
|
|
6013
6200
|
researchSessionId,
|
|
@@ -6024,8 +6211,8 @@ function useInjectContext() {
|
|
|
6024
6211
|
});
|
|
6025
6212
|
}
|
|
6026
6213
|
function useExportToSession() {
|
|
6027
|
-
const queryClient =
|
|
6028
|
-
return
|
|
6214
|
+
const queryClient = useQueryClient9();
|
|
6215
|
+
return useMutation7({
|
|
6029
6216
|
mutationFn: ({
|
|
6030
6217
|
researchId,
|
|
6031
6218
|
data
|
|
@@ -6324,9 +6511,9 @@ function useOttoRouterBalance(providerName) {
|
|
|
6324
6511
|
};
|
|
6325
6512
|
}
|
|
6326
6513
|
// src/hooks/useShareStatus.ts
|
|
6327
|
-
import { useQuery as
|
|
6514
|
+
import { useQuery as useQuery10 } from "@tanstack/react-query";
|
|
6328
6515
|
function useShareStatus(sessionId) {
|
|
6329
|
-
const { data, isLoading, error } =
|
|
6516
|
+
const { data, isLoading, error } = useQuery10({
|
|
6330
6517
|
queryKey: ["share-status", sessionId],
|
|
6331
6518
|
queryFn: () => apiClient.getShareStatus(sessionId),
|
|
6332
6519
|
enabled: !!sessionId,
|
|
@@ -6470,7 +6657,7 @@ function useTopupCallback() {
|
|
|
6470
6657
|
}
|
|
6471
6658
|
// src/hooks/useAuthStatus.ts
|
|
6472
6659
|
import { useEffect as useEffect13, useCallback as useCallback8, useState as useState5, useRef as useRef5 } from "react";
|
|
6473
|
-
import { useQueryClient as
|
|
6660
|
+
import { useQueryClient as useQueryClient10 } from "@tanstack/react-query";
|
|
6474
6661
|
|
|
6475
6662
|
// src/stores/onboardingStore.ts
|
|
6476
6663
|
import { create as create21 } from "zustand";
|
|
@@ -6520,7 +6707,7 @@ function useAuthStatus() {
|
|
|
6520
6707
|
const setError = useOnboardingStore((s) => s.setError);
|
|
6521
6708
|
const authStatus = useOnboardingStore((s) => s.authStatus);
|
|
6522
6709
|
const isOpen = useOnboardingStore((s) => s.isOpen);
|
|
6523
|
-
const queryClient =
|
|
6710
|
+
const queryClient = useQueryClient10();
|
|
6524
6711
|
const [initialized, setInitialized] = useState5(false);
|
|
6525
6712
|
const [oauthPolling, setOauthPolling] = useState5(false);
|
|
6526
6713
|
const oauthPollingRef = useRef5(null);
|
|
@@ -6816,7 +7003,7 @@ function useAuthStatus() {
|
|
|
6816
7003
|
};
|
|
6817
7004
|
}
|
|
6818
7005
|
// src/hooks/useTunnel.ts
|
|
6819
|
-
import { useQuery as
|
|
7006
|
+
import { useQuery as useQuery11, useMutation as useMutation8, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
|
|
6820
7007
|
import { useEffect as useEffect14, useCallback as useCallback9, useRef as useRef6 } from "react";
|
|
6821
7008
|
import {
|
|
6822
7009
|
client as client2,
|
|
@@ -6864,7 +7051,7 @@ function useTunnelStatus() {
|
|
|
6864
7051
|
const setStatus = useTunnelStore((s) => s.setStatus);
|
|
6865
7052
|
const setUrl = useTunnelStore((s) => s.setUrl);
|
|
6866
7053
|
const setError = useTunnelStore((s) => s.setError);
|
|
6867
|
-
const query =
|
|
7054
|
+
const query = useQuery11({
|
|
6868
7055
|
queryKey: ["tunnel", "status"],
|
|
6869
7056
|
queryFn: fetchTunnelStatus,
|
|
6870
7057
|
refetchInterval: 3000,
|
|
@@ -6880,12 +7067,12 @@ function useTunnelStatus() {
|
|
|
6880
7067
|
return query;
|
|
6881
7068
|
}
|
|
6882
7069
|
function useStartTunnel() {
|
|
6883
|
-
const queryClient =
|
|
7070
|
+
const queryClient = useQueryClient11();
|
|
6884
7071
|
const setStatus = useTunnelStore((s) => s.setStatus);
|
|
6885
7072
|
const setUrl = useTunnelStore((s) => s.setUrl);
|
|
6886
7073
|
const setError = useTunnelStore((s) => s.setError);
|
|
6887
7074
|
const setProgress = useTunnelStore((s) => s.setProgress);
|
|
6888
|
-
return
|
|
7075
|
+
return useMutation8({
|
|
6889
7076
|
mutationFn: () => startTunnel(),
|
|
6890
7077
|
onMutate: () => {
|
|
6891
7078
|
setStatus("starting");
|
|
@@ -6914,9 +7101,9 @@ function useStartTunnel() {
|
|
|
6914
7101
|
});
|
|
6915
7102
|
}
|
|
6916
7103
|
function useStopTunnel() {
|
|
6917
|
-
const queryClient =
|
|
7104
|
+
const queryClient = useQueryClient11();
|
|
6918
7105
|
const reset = useTunnelStore((s) => s.reset);
|
|
6919
|
-
return
|
|
7106
|
+
return useMutation8({
|
|
6920
7107
|
mutationFn: stopTunnel,
|
|
6921
7108
|
onSuccess: () => {
|
|
6922
7109
|
reset();
|
|
@@ -6927,7 +7114,7 @@ function useStopTunnel() {
|
|
|
6927
7114
|
function useTunnelQr() {
|
|
6928
7115
|
const url = useTunnelStore((s) => s.url);
|
|
6929
7116
|
const setQrCode = useTunnelStore((s) => s.setQrCode);
|
|
6930
|
-
const query =
|
|
7117
|
+
const query = useQuery11({
|
|
6931
7118
|
queryKey: ["tunnel", "qr", url],
|
|
6932
7119
|
queryFn: fetchTunnelQr,
|
|
6933
7120
|
enabled: !!url
|
|
@@ -7040,9 +7227,9 @@ function useProviderUsage(provider, authType) {
|
|
|
7040
7227
|
};
|
|
7041
7228
|
}
|
|
7042
7229
|
// src/hooks/useFileBrowser.ts
|
|
7043
|
-
import { useQuery as
|
|
7230
|
+
import { useQuery as useQuery12 } from "@tanstack/react-query";
|
|
7044
7231
|
function useFileTree(dirPath, enabled = true) {
|
|
7045
|
-
return
|
|
7232
|
+
return useQuery12({
|
|
7046
7233
|
queryKey: ["files", "tree", dirPath],
|
|
7047
7234
|
queryFn: () => apiClient.getFileTree(dirPath),
|
|
7048
7235
|
enabled,
|
|
@@ -7051,7 +7238,7 @@ function useFileTree(dirPath, enabled = true) {
|
|
|
7051
7238
|
});
|
|
7052
7239
|
}
|
|
7053
7240
|
function useFileContent(filePath) {
|
|
7054
|
-
return
|
|
7241
|
+
return useQuery12({
|
|
7055
7242
|
queryKey: ["files", "read", filePath],
|
|
7056
7243
|
queryFn: () => filePath ? apiClient.readFileContent(filePath) : null,
|
|
7057
7244
|
enabled: !!filePath,
|
|
@@ -7060,7 +7247,7 @@ function useFileContent(filePath) {
|
|
|
7060
7247
|
});
|
|
7061
7248
|
}
|
|
7062
7249
|
function useGitDiffFullFile(file, staged = false, enabled = false) {
|
|
7063
|
-
return
|
|
7250
|
+
return useQuery12({
|
|
7064
7251
|
queryKey: ["git", "diff", "fullFile", file, staged],
|
|
7065
7252
|
queryFn: () => file ? apiClient.getGitDiffFullFile(file, staged) : null,
|
|
7066
7253
|
enabled: enabled && !!file,
|
|
@@ -7069,7 +7256,7 @@ function useGitDiffFullFile(file, staged = false, enabled = false) {
|
|
|
7069
7256
|
});
|
|
7070
7257
|
}
|
|
7071
7258
|
// src/hooks/useMCP.ts
|
|
7072
|
-
import { useQuery as
|
|
7259
|
+
import { useQuery as useQuery13, useMutation as useMutation9, useQueryClient as useQueryClient12 } from "@tanstack/react-query";
|
|
7073
7260
|
import { useEffect as useEffect16, useRef as useRef8, useCallback as useCallback11 } from "react";
|
|
7074
7261
|
import {
|
|
7075
7262
|
listMcpServers,
|
|
@@ -7084,7 +7271,7 @@ import {
|
|
|
7084
7271
|
} from "@ottocode/api";
|
|
7085
7272
|
function useMCPServers() {
|
|
7086
7273
|
const setServers = useMCPStore((s) => s.setServers);
|
|
7087
|
-
const query =
|
|
7274
|
+
const query = useQuery13({
|
|
7088
7275
|
queryKey: ["mcp", "servers"],
|
|
7089
7276
|
queryFn: async () => {
|
|
7090
7277
|
const { data } = await listMcpServers();
|
|
@@ -7100,8 +7287,8 @@ function useMCPServers() {
|
|
|
7100
7287
|
return query;
|
|
7101
7288
|
}
|
|
7102
7289
|
function useStartMCPServer() {
|
|
7103
|
-
const queryClient =
|
|
7104
|
-
return
|
|
7290
|
+
const queryClient = useQueryClient12();
|
|
7291
|
+
return useMutation9({
|
|
7105
7292
|
mutationFn: async (name) => {
|
|
7106
7293
|
const { data, error } = await startMcpServer({
|
|
7107
7294
|
path: { name }
|
|
@@ -7119,9 +7306,9 @@ function useStartMCPServer() {
|
|
|
7119
7306
|
});
|
|
7120
7307
|
}
|
|
7121
7308
|
function useStopMCPServer() {
|
|
7122
|
-
const queryClient =
|
|
7309
|
+
const queryClient = useQueryClient12();
|
|
7123
7310
|
const setLoading = useMCPStore((s) => s.setLoading);
|
|
7124
|
-
return
|
|
7311
|
+
return useMutation9({
|
|
7125
7312
|
mutationFn: async (name) => {
|
|
7126
7313
|
setLoading(name, true);
|
|
7127
7314
|
const { data, error } = await stopMcpServer({
|
|
@@ -7141,8 +7328,8 @@ function useStopMCPServer() {
|
|
|
7141
7328
|
});
|
|
7142
7329
|
}
|
|
7143
7330
|
function useAddMCPServer() {
|
|
7144
|
-
const queryClient =
|
|
7145
|
-
return
|
|
7331
|
+
const queryClient = useQueryClient12();
|
|
7332
|
+
return useMutation9({
|
|
7146
7333
|
mutationFn: async (params) => {
|
|
7147
7334
|
const { data, error } = await addMcpServer({
|
|
7148
7335
|
body: params
|
|
@@ -7160,8 +7347,8 @@ function useAddMCPServer() {
|
|
|
7160
7347
|
});
|
|
7161
7348
|
}
|
|
7162
7349
|
function useRemoveMCPServer() {
|
|
7163
|
-
const queryClient =
|
|
7164
|
-
return
|
|
7350
|
+
const queryClient = useQueryClient12();
|
|
7351
|
+
return useMutation9({
|
|
7165
7352
|
mutationFn: async (name) => {
|
|
7166
7353
|
const { data, error } = await removeMcpServer({
|
|
7167
7354
|
path: { name }
|
|
@@ -7179,8 +7366,8 @@ function useRemoveMCPServer() {
|
|
|
7179
7366
|
});
|
|
7180
7367
|
}
|
|
7181
7368
|
function useAuthenticateMCPServer() {
|
|
7182
|
-
const queryClient =
|
|
7183
|
-
return
|
|
7369
|
+
const queryClient = useQueryClient12();
|
|
7370
|
+
return useMutation9({
|
|
7184
7371
|
mutationFn: async (name) => {
|
|
7185
7372
|
const { data, error } = await initiateMcpAuth({
|
|
7186
7373
|
path: { name }
|
|
@@ -7198,8 +7385,8 @@ function useAuthenticateMCPServer() {
|
|
|
7198
7385
|
});
|
|
7199
7386
|
}
|
|
7200
7387
|
function useRevokeMCPAuth() {
|
|
7201
|
-
const queryClient =
|
|
7202
|
-
return
|
|
7388
|
+
const queryClient = useQueryClient12();
|
|
7389
|
+
return useMutation9({
|
|
7203
7390
|
mutationFn: async (name) => {
|
|
7204
7391
|
const { data, error } = await revokeMcpAuth({
|
|
7205
7392
|
path: { name }
|
|
@@ -7217,7 +7404,7 @@ function useRevokeMCPAuth() {
|
|
|
7217
7404
|
});
|
|
7218
7405
|
}
|
|
7219
7406
|
function useMCPAuthStatus(name) {
|
|
7220
|
-
return
|
|
7407
|
+
return useQuery13({
|
|
7221
7408
|
queryKey: ["mcp", "auth", name],
|
|
7222
7409
|
queryFn: async () => {
|
|
7223
7410
|
if (!name)
|
|
@@ -7235,7 +7422,7 @@ function useCopilotDevicePoller() {
|
|
|
7235
7422
|
const copilotDevice = useMCPStore((s) => s.copilotDevice);
|
|
7236
7423
|
const setCopilotDevice = useMCPStore((s) => s.setCopilotDevice);
|
|
7237
7424
|
const setLoading = useMCPStore((s) => s.setLoading);
|
|
7238
|
-
const queryClient =
|
|
7425
|
+
const queryClient = useQueryClient12();
|
|
7239
7426
|
const timerRef = useRef8(null);
|
|
7240
7427
|
const stopPolling = useCallback11(() => {
|
|
7241
7428
|
if (timerRef.current) {
|
|
@@ -7278,12 +7465,12 @@ function useCopilotDevicePoller() {
|
|
|
7278
7465
|
return copilotDevice;
|
|
7279
7466
|
}
|
|
7280
7467
|
// src/hooks/useSkills.ts
|
|
7281
|
-
import { useMutation as
|
|
7468
|
+
import { useMutation as useMutation10, useQuery as useQuery14, useQueryClient as useQueryClient13 } from "@tanstack/react-query";
|
|
7282
7469
|
import { useEffect as useEffect17 } from "react";
|
|
7283
7470
|
function useSkills(options = {}) {
|
|
7284
7471
|
const enabled = options.enabled ?? true;
|
|
7285
7472
|
const setSkillsConfig = useSkillsStore((s) => s.setSkillsConfig);
|
|
7286
|
-
const query =
|
|
7473
|
+
const query = useQuery14({
|
|
7287
7474
|
queryKey: ["skills"],
|
|
7288
7475
|
queryFn: async () => {
|
|
7289
7476
|
return apiClient.getSkillsConfig();
|
|
@@ -7304,9 +7491,9 @@ function useSkills(options = {}) {
|
|
|
7304
7491
|
return query;
|
|
7305
7492
|
}
|
|
7306
7493
|
function useUpdateSkillsConfig() {
|
|
7307
|
-
const queryClient =
|
|
7494
|
+
const queryClient = useQueryClient13();
|
|
7308
7495
|
const setSkillsConfig = useSkillsStore((s) => s.setSkillsConfig);
|
|
7309
|
-
return
|
|
7496
|
+
return useMutation10({
|
|
7310
7497
|
mutationFn: (input) => apiClient.updateSkillsConfig(input),
|
|
7311
7498
|
onSuccess: (data) => {
|
|
7312
7499
|
setSkillsConfig({
|
|
@@ -7320,7 +7507,7 @@ function useUpdateSkillsConfig() {
|
|
|
7320
7507
|
});
|
|
7321
7508
|
}
|
|
7322
7509
|
function useSkillDetail(name) {
|
|
7323
|
-
return
|
|
7510
|
+
return useQuery14({
|
|
7324
7511
|
queryKey: ["skills", name],
|
|
7325
7512
|
queryFn: async () => {
|
|
7326
7513
|
if (!name)
|
|
@@ -7331,7 +7518,7 @@ function useSkillDetail(name) {
|
|
|
7331
7518
|
});
|
|
7332
7519
|
}
|
|
7333
7520
|
function useSkillFiles(name) {
|
|
7334
|
-
return
|
|
7521
|
+
return useQuery14({
|
|
7335
7522
|
queryKey: ["skills", name, "files"],
|
|
7336
7523
|
queryFn: async () => {
|
|
7337
7524
|
if (!name)
|
|
@@ -7342,7 +7529,7 @@ function useSkillFiles(name) {
|
|
|
7342
7529
|
});
|
|
7343
7530
|
}
|
|
7344
7531
|
function useSkillFileContent(name, filePath) {
|
|
7345
|
-
return
|
|
7532
|
+
return useQuery14({
|
|
7346
7533
|
queryKey: ["skills", name, "files", filePath],
|
|
7347
7534
|
queryFn: async () => {
|
|
7348
7535
|
if (!name || !filePath)
|
|
@@ -7354,7 +7541,7 @@ function useSkillFileContent(name, filePath) {
|
|
|
7354
7541
|
}
|
|
7355
7542
|
// src/hooks/useAgents.ts
|
|
7356
7543
|
import { useEffect as useEffect18 } from "react";
|
|
7357
|
-
import { useMutation as
|
|
7544
|
+
import { useMutation as useMutation11, useQuery as useQuery15, useQueryClient as useQueryClient14 } from "@tanstack/react-query";
|
|
7358
7545
|
|
|
7359
7546
|
// src/stores/agentsStore.ts
|
|
7360
7547
|
import { create as create22 } from "zustand";
|
|
@@ -7429,7 +7616,7 @@ function useAgentDetails(options = {}) {
|
|
|
7429
7616
|
const setAgents = useAgentsStore((s) => s.setAgents);
|
|
7430
7617
|
const selectedAgent = useAgentsStore((s) => s.selectedAgent);
|
|
7431
7618
|
const selectAgent = useAgentsStore((s) => s.selectAgent);
|
|
7432
|
-
const query =
|
|
7619
|
+
const query = useQuery15({
|
|
7433
7620
|
queryKey: ["config", "agents"],
|
|
7434
7621
|
queryFn: () => apiClient.getAgentDetails(),
|
|
7435
7622
|
enabled,
|
|
@@ -7447,7 +7634,7 @@ function useAgentDetails(options = {}) {
|
|
|
7447
7634
|
return query;
|
|
7448
7635
|
}
|
|
7449
7636
|
function useAgent(agentName) {
|
|
7450
|
-
return
|
|
7637
|
+
return useQuery15({
|
|
7451
7638
|
queryKey: ["config", "agents", agentName],
|
|
7452
7639
|
queryFn: async () => {
|
|
7453
7640
|
if (!agentName)
|
|
@@ -7458,11 +7645,19 @@ function useAgent(agentName) {
|
|
|
7458
7645
|
staleTime: 15000
|
|
7459
7646
|
});
|
|
7460
7647
|
}
|
|
7648
|
+
function useMentionAgents(options = {}) {
|
|
7649
|
+
return useQuery15({
|
|
7650
|
+
queryKey: ["config", "agents"],
|
|
7651
|
+
queryFn: () => apiClient.getAgentDetails(),
|
|
7652
|
+
enabled: options.enabled ?? true,
|
|
7653
|
+
staleTime: 60000
|
|
7654
|
+
});
|
|
7655
|
+
}
|
|
7461
7656
|
function useConfigTools(options = {}) {
|
|
7462
7657
|
const managerOpen = useAgentsStore((s) => s.isManagerOpen);
|
|
7463
7658
|
const createOpen = useAgentsStore((s) => s.isCreateModalOpen);
|
|
7464
7659
|
const enabled = options.enabled ?? (managerOpen || createOpen);
|
|
7465
|
-
return
|
|
7660
|
+
return useQuery15({
|
|
7466
7661
|
queryKey: ["config", "tools"],
|
|
7467
7662
|
queryFn: () => apiClient.getConfigTools(),
|
|
7468
7663
|
enabled,
|
|
@@ -7470,8 +7665,8 @@ function useConfigTools(options = {}) {
|
|
|
7470
7665
|
});
|
|
7471
7666
|
}
|
|
7472
7667
|
function useUpdateAgent() {
|
|
7473
|
-
const queryClient =
|
|
7474
|
-
return
|
|
7668
|
+
const queryClient = useQueryClient14();
|
|
7669
|
+
return useMutation11({
|
|
7475
7670
|
mutationFn: ({ name, input }) => apiClient.updateAgent(name, input),
|
|
7476
7671
|
onSuccess: (data, variables) => {
|
|
7477
7672
|
queryClient.setQueryData(["config", "agents", variables.name], data);
|
|
@@ -7481,10 +7676,10 @@ function useUpdateAgent() {
|
|
|
7481
7676
|
});
|
|
7482
7677
|
}
|
|
7483
7678
|
function useDeleteAgent() {
|
|
7484
|
-
const queryClient =
|
|
7679
|
+
const queryClient = useQueryClient14();
|
|
7485
7680
|
const setAgents = useAgentsStore((s) => s.setAgents);
|
|
7486
7681
|
const selectAgent = useAgentsStore((s) => s.selectAgent);
|
|
7487
|
-
return
|
|
7682
|
+
return useMutation11({
|
|
7488
7683
|
mutationFn: ({
|
|
7489
7684
|
name,
|
|
7490
7685
|
scope = "local"
|
|
@@ -7505,8 +7700,8 @@ function useDeleteAgent() {
|
|
|
7505
7700
|
});
|
|
7506
7701
|
}
|
|
7507
7702
|
function useSetDefaultAgent() {
|
|
7508
|
-
const queryClient =
|
|
7509
|
-
return
|
|
7703
|
+
const queryClient = useQueryClient14();
|
|
7704
|
+
return useMutation11({
|
|
7510
7705
|
mutationFn: (name) => apiClient.updateDefaults({ agent: name, scope: "global" }),
|
|
7511
7706
|
onSuccess: () => {
|
|
7512
7707
|
queryClient.invalidateQueries({ queryKey: ["config", "agents"] });
|
|
@@ -7975,7 +8170,7 @@ function useVoiceInput({
|
|
|
7975
8170
|
}
|
|
7976
8171
|
// src/hooks/useDictationModels.ts
|
|
7977
8172
|
import { useCallback as useCallback15, useEffect as useEffect22, useRef as useRef11, useState as useState10 } from "react";
|
|
7978
|
-
import { useMutation as
|
|
8173
|
+
import { useMutation as useMutation12, useQuery as useQuery16, useQueryClient as useQueryClient15 } from "@tanstack/react-query";
|
|
7979
8174
|
var DICTATION_STATUS_QUERY_KEY = ["dictation", "status"];
|
|
7980
8175
|
function mergeModelState(current, model) {
|
|
7981
8176
|
if (!current)
|
|
@@ -7996,12 +8191,12 @@ function parseInstallEvent(raw) {
|
|
|
7996
8191
|
}
|
|
7997
8192
|
}
|
|
7998
8193
|
function useDictationModels() {
|
|
7999
|
-
const queryClient =
|
|
8194
|
+
const queryClient = useQueryClient15();
|
|
8000
8195
|
const eventSourceRef = useRef11(null);
|
|
8001
8196
|
const [activeInstallModelId, setActiveInstallModelId] = useState10(null);
|
|
8002
8197
|
const [installProgress, setInstallProgress] = useState10(null);
|
|
8003
8198
|
const [installStreamError, setInstallStreamError] = useState10(null);
|
|
8004
|
-
const statusQuery =
|
|
8199
|
+
const statusQuery = useQuery16({
|
|
8005
8200
|
queryKey: DICTATION_STATUS_QUERY_KEY,
|
|
8006
8201
|
queryFn: () => apiClient.getDictationStatus(),
|
|
8007
8202
|
refetchInterval: (query) => query.state.data?.models.some((model) => model.installing) ? 1000 : 30000
|
|
@@ -8044,7 +8239,7 @@ function useDictationModels() {
|
|
|
8044
8239
|
};
|
|
8045
8240
|
}, [closeInstallStream, queryClient]);
|
|
8046
8241
|
useEffect22(() => closeInstallStream, [closeInstallStream]);
|
|
8047
|
-
const installMutation =
|
|
8242
|
+
const installMutation = useMutation12({
|
|
8048
8243
|
mutationFn: (input) => apiClient.installDictationModel(input),
|
|
8049
8244
|
onSuccess: (data) => {
|
|
8050
8245
|
setInstallProgress(data.model);
|
|
@@ -8060,7 +8255,7 @@ function useDictationModels() {
|
|
|
8060
8255
|
}
|
|
8061
8256
|
}
|
|
8062
8257
|
});
|
|
8063
|
-
const removeMutation =
|
|
8258
|
+
const removeMutation = useMutation12({
|
|
8064
8259
|
mutationFn: (model) => apiClient.removeDictationModel(model),
|
|
8065
8260
|
onSuccess: (data) => {
|
|
8066
8261
|
queryClient.setQueryData(DICTATION_STATUS_QUERY_KEY, (current) => mergeModelState(current, data.model));
|
|
@@ -8093,6 +8288,8 @@ export {
|
|
|
8093
8288
|
useVoiceInput,
|
|
8094
8289
|
useUpdateSkillsConfig,
|
|
8095
8290
|
useUpdateSession,
|
|
8291
|
+
useUpdateGoalTask,
|
|
8292
|
+
useUpdateGoal,
|
|
8096
8293
|
useUpdateDefaults,
|
|
8097
8294
|
useUpdateAgent,
|
|
8098
8295
|
useUnstageFiles,
|
|
@@ -8106,6 +8303,7 @@ export {
|
|
|
8106
8303
|
useStopMCPServer,
|
|
8107
8304
|
useStartTunnel,
|
|
8108
8305
|
useStartMCPServer,
|
|
8306
|
+
useStartGoal,
|
|
8109
8307
|
useStageFiles,
|
|
8110
8308
|
useSkills,
|
|
8111
8309
|
useSkillFiles,
|
|
@@ -8116,7 +8314,9 @@ export {
|
|
|
8116
8314
|
useSetDefaultAgent,
|
|
8117
8315
|
useSessionsInfinite,
|
|
8118
8316
|
useSessions,
|
|
8317
|
+
useSessionSubagents,
|
|
8119
8318
|
useSessionStream,
|
|
8319
|
+
useSessionGoal,
|
|
8120
8320
|
useSessionFiles,
|
|
8121
8321
|
useSession,
|
|
8122
8322
|
useSendMessage,
|
|
@@ -8133,9 +8333,11 @@ export {
|
|
|
8133
8333
|
useParentSession,
|
|
8134
8334
|
useOttoRouterPayments,
|
|
8135
8335
|
useOttoRouterBalance,
|
|
8336
|
+
useOttoEnabled,
|
|
8136
8337
|
useModels,
|
|
8137
8338
|
useMessages,
|
|
8138
8339
|
useMessageQueuePosition,
|
|
8340
|
+
useMentionAgents,
|
|
8139
8341
|
useMarkSessionViewed,
|
|
8140
8342
|
useMCPServers,
|
|
8141
8343
|
useMCPAuthStatus,
|
|
@@ -8161,6 +8363,7 @@ export {
|
|
|
8161
8363
|
useDeleteResearchSession,
|
|
8162
8364
|
useDeleteFiles,
|
|
8163
8365
|
useDeleteAgent,
|
|
8366
|
+
useCreateSessionGoal,
|
|
8164
8367
|
useCreateSession,
|
|
8165
8368
|
useCreateResearchSession,
|
|
8166
8369
|
useCreateGitBranch,
|
|
@@ -8182,10 +8385,13 @@ export {
|
|
|
8182
8385
|
useAgent,
|
|
8183
8386
|
useAddRemote,
|
|
8184
8387
|
useAddMCPServer,
|
|
8388
|
+
useAddGoalTasks,
|
|
8389
|
+
subagentsQueryKey,
|
|
8185
8390
|
sessionsQueryKey,
|
|
8186
8391
|
optimisticallyQueueMessage,
|
|
8187
8392
|
normalizeQueueState,
|
|
8393
|
+
goalQueryKey,
|
|
8188
8394
|
getAgentToolCount
|
|
8189
8395
|
};
|
|
8190
8396
|
|
|
8191
|
-
//# debugId=
|
|
8397
|
+
//# debugId=37EDDE4EE625A54D64756E2164756E21
|