@ottocode/web-sdk 0.1.299 → 0.1.300
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 +9 -0
- package/dist/components/agents/AgentEditor.d.ts.map +1 -0
- package/dist/components/agents/AgentList.d.ts +10 -0
- package/dist/components/agents/AgentList.d.ts.map +1 -0
- package/dist/components/agents/AgentProviderModelFields.d.ts +10 -0
- package/dist/components/agents/AgentProviderModelFields.d.ts.map +1 -0
- package/dist/components/agents/AgentToolList.d.ts +14 -0
- package/dist/components/agents/AgentToolList.d.ts.map +1 -0
- package/dist/components/agents/AgentsManagerModal.d.ts +2 -0
- package/dist/components/agents/AgentsManagerModal.d.ts.map +1 -0
- package/dist/components/agents/AgentsSidebar.d.ts +3 -0
- package/dist/components/agents/AgentsSidebar.d.ts.map +1 -0
- package/dist/components/agents/AgentsSidebarToggle.d.ts +2 -0
- package/dist/components/agents/AgentsSidebarToggle.d.ts.map +1 -0
- package/dist/components/agents/CreateAgentModal.d.ts +8 -0
- package/dist/components/agents/CreateAgentModal.d.ts.map +1 -0
- package/dist/components/agents/agentConstants.d.ts +50 -0
- package/dist/components/agents/agentConstants.d.ts.map +1 -0
- package/dist/components/agents/index.d.ts +10 -0
- package/dist/components/agents/index.d.ts.map +1 -0
- package/dist/components/chat/UnifiedModelSelector.d.ts +2 -1
- package/dist/components/chat/UnifiedModelSelector.d.ts.map +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +3208 -1290
- package/dist/components/index.js.map +17 -8
- package/dist/components/ui/Modal.d.ts +1 -1
- package/dist/components/ui/Modal.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +232 -15
- package/dist/hooks/index.js.map +7 -5
- package/dist/hooks/useAgents.d.ts +156 -0
- package/dist/hooks/useAgents.d.ts.map +1 -0
- package/dist/hooks/useConfig.d.ts.map +1 -1
- package/dist/index.js +3486 -1560
- package/dist/index.js.map +17 -8
- package/dist/lib/api-client/config.d.ts +14 -0
- package/dist/lib/api-client/config.d.ts.map +1 -1
- package/dist/lib/api-client/index.d.ts +5 -0
- package/dist/lib/api-client/index.d.ts.map +1 -1
- package/dist/lib/index.js +48 -2
- package/dist/lib/index.js.map +4 -4
- package/dist/stores/agentsStore.d.ts +28 -0
- package/dist/stores/agentsStore.d.ts.map +1 -0
- package/dist/stores/index.d.ts +1 -0
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/index.js +68 -7
- package/dist/stores/index.js.map +4 -3
- package/package.json +3 -3
|
@@ -7,7 +7,7 @@ interface ModalProps {
|
|
|
7
7
|
showCloseButton?: boolean;
|
|
8
8
|
closeOnBackdropClick?: boolean;
|
|
9
9
|
closeOnEscape?: boolean;
|
|
10
|
-
maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '4xl';
|
|
10
|
+
maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '4xl' | '5xl';
|
|
11
11
|
position?: 'fixed' | 'absolute';
|
|
12
12
|
}
|
|
13
13
|
export declare function Modal({ isOpen, onClose, title, children, showCloseButton, closeOnBackdropClick, closeOnEscape, maxWidth, position, }: ModalProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/ui/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlD,UAAU,UAAU;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/ui/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlD,UAAU,UAAU;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IAC7D,QAAQ,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;CAChC;AAYD,wBAAgB,KAAK,CAAC,EACrB,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,eAAsB,EACtB,oBAA2B,EAC3B,aAAoB,EACpB,QAAe,EACf,QAAkB,GAClB,EAAE,UAAU,+BA4GZ"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export * from './useProviderUsage';
|
|
|
26
26
|
export * from './useFileBrowser';
|
|
27
27
|
export * from './useMCP';
|
|
28
28
|
export * from './useSkills';
|
|
29
|
+
export * from './useAgents';
|
|
29
30
|
export * from './useContainerWidth';
|
|
30
31
|
export * from './useVoiceInput';
|
|
31
32
|
export * from './useDictationModels';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -560,6 +560,11 @@ import {
|
|
|
560
560
|
getConfig as apiGetConfig,
|
|
561
561
|
getProviderModels as apiGetProviderModels,
|
|
562
562
|
getAllModels as apiGetAllModels,
|
|
563
|
+
getAgentDetails as apiGetAgentDetails,
|
|
564
|
+
getAgent as apiGetAgent,
|
|
565
|
+
getConfigTools as apiGetConfigTools,
|
|
566
|
+
upsertAgent as apiUpsertAgent,
|
|
567
|
+
deleteAgent as apiDeleteAgent,
|
|
563
568
|
discoverProviderModels as apiDiscoverProviderModels,
|
|
564
569
|
updateDefaults as apiUpdateDefaults,
|
|
565
570
|
updateProviderSettings as apiUpdateProviderSettings,
|
|
@@ -572,6 +577,42 @@ var configMixin = {
|
|
|
572
577
|
throw new Error(extractErrorMessage(response.error));
|
|
573
578
|
return response.data;
|
|
574
579
|
},
|
|
580
|
+
async getAgentDetails() {
|
|
581
|
+
const response = await apiGetAgentDetails();
|
|
582
|
+
if (response.error)
|
|
583
|
+
throw new Error(extractErrorMessage(response.error));
|
|
584
|
+
return response.data;
|
|
585
|
+
},
|
|
586
|
+
async getAgent(name) {
|
|
587
|
+
const response = await apiGetAgent({ path: { agent: name } });
|
|
588
|
+
if (response.error)
|
|
589
|
+
throw new Error(extractErrorMessage(response.error));
|
|
590
|
+
return response.data;
|
|
591
|
+
},
|
|
592
|
+
async getConfigTools() {
|
|
593
|
+
const response = await apiGetConfigTools();
|
|
594
|
+
if (response.error)
|
|
595
|
+
throw new Error(extractErrorMessage(response.error));
|
|
596
|
+
return response.data;
|
|
597
|
+
},
|
|
598
|
+
async updateAgent(name, input) {
|
|
599
|
+
const response = await apiUpsertAgent({
|
|
600
|
+
path: { agent: name },
|
|
601
|
+
body: input
|
|
602
|
+
});
|
|
603
|
+
if (response.error)
|
|
604
|
+
throw new Error(extractErrorMessage(response.error));
|
|
605
|
+
return response.data;
|
|
606
|
+
},
|
|
607
|
+
async deleteAgent(name, scope = "local") {
|
|
608
|
+
const response = await apiDeleteAgent({
|
|
609
|
+
path: { agent: name },
|
|
610
|
+
query: { scope }
|
|
611
|
+
});
|
|
612
|
+
if (response.error)
|
|
613
|
+
throw new Error(extractErrorMessage(response.error));
|
|
614
|
+
return response.data;
|
|
615
|
+
},
|
|
575
616
|
async getModels(providerId) {
|
|
576
617
|
const response = await apiGetProviderModels({
|
|
577
618
|
path: { provider: providerId }
|
|
@@ -613,7 +654,7 @@ var configMixin = {
|
|
|
613
654
|
},
|
|
614
655
|
async updateDefaults(data) {
|
|
615
656
|
const response = await apiUpdateDefaults({
|
|
616
|
-
body: data
|
|
657
|
+
body: { scope: "global", ...data }
|
|
617
658
|
});
|
|
618
659
|
if (response.error)
|
|
619
660
|
throw new Error(extractErrorMessage(response.error));
|
|
@@ -1250,6 +1291,11 @@ class ApiClient {
|
|
|
1250
1291
|
checkoutBranch = gitMixin.checkoutBranch;
|
|
1251
1292
|
createGitBranch = gitMixin.createGitBranch;
|
|
1252
1293
|
getConfig = configMixin.getConfig;
|
|
1294
|
+
getAgentDetails = configMixin.getAgentDetails;
|
|
1295
|
+
getAgent = configMixin.getAgent;
|
|
1296
|
+
getConfigTools = configMixin.getConfigTools;
|
|
1297
|
+
updateAgent = configMixin.updateAgent;
|
|
1298
|
+
deleteAgent = configMixin.deleteAgent;
|
|
1253
1299
|
getModels = configMixin.getModels;
|
|
1254
1300
|
getAllModels = configMixin.getAllModels;
|
|
1255
1301
|
discoverProviderModels = configMixin.discoverProviderModels;
|
|
@@ -7248,11 +7294,175 @@ function useSkillFileContent(name, filePath) {
|
|
|
7248
7294
|
enabled: !!name && !!filePath
|
|
7249
7295
|
});
|
|
7250
7296
|
}
|
|
7297
|
+
// src/hooks/useAgents.ts
|
|
7298
|
+
import { useEffect as useEffect18 } from "react";
|
|
7299
|
+
import { useMutation as useMutation10, useQuery as useQuery14, useQueryClient as useQueryClient13 } from "@tanstack/react-query";
|
|
7300
|
+
|
|
7301
|
+
// src/stores/agentsStore.ts
|
|
7302
|
+
import { create as create22 } from "zustand";
|
|
7303
|
+
function collapseOtherRightPanels() {
|
|
7304
|
+
useGitStore.getState().collapseSidebar();
|
|
7305
|
+
useSessionFilesStore.getState().collapseSidebar();
|
|
7306
|
+
useResearchStore.getState().collapseSidebar();
|
|
7307
|
+
useSettingsStore.getState().collapseSidebar();
|
|
7308
|
+
useTunnelStore.getState().collapseSidebar();
|
|
7309
|
+
useFileBrowserStore.getState().collapseSidebar();
|
|
7310
|
+
useMCPStore.getState().collapseSidebar();
|
|
7311
|
+
useSkillsStore.getState().collapseSidebar();
|
|
7312
|
+
}
|
|
7313
|
+
var useAgentsStore = create22((set) => ({
|
|
7314
|
+
isExpanded: false,
|
|
7315
|
+
isManagerOpen: false,
|
|
7316
|
+
managerMode: "library",
|
|
7317
|
+
editorPage: "overview",
|
|
7318
|
+
agents: [],
|
|
7319
|
+
defaultAgent: null,
|
|
7320
|
+
selectedAgent: null,
|
|
7321
|
+
isCreateModalOpen: false,
|
|
7322
|
+
setManagerMode: (mode) => set({ managerMode: mode }),
|
|
7323
|
+
openManager: () => {
|
|
7324
|
+
collapseOtherRightPanels();
|
|
7325
|
+
set({ isManagerOpen: true, isExpanded: true, managerMode: "library" });
|
|
7326
|
+
},
|
|
7327
|
+
closeManager: () => set({
|
|
7328
|
+
isManagerOpen: false,
|
|
7329
|
+
isExpanded: false,
|
|
7330
|
+
isCreateModalOpen: false,
|
|
7331
|
+
managerMode: "library",
|
|
7332
|
+
editorPage: "overview"
|
|
7333
|
+
}),
|
|
7334
|
+
toggleManager: () => {
|
|
7335
|
+
const open = useAgentsStore.getState().isManagerOpen;
|
|
7336
|
+
if (open) {
|
|
7337
|
+
useAgentsStore.getState().closeManager();
|
|
7338
|
+
} else {
|
|
7339
|
+
useAgentsStore.getState().openManager();
|
|
7340
|
+
}
|
|
7341
|
+
},
|
|
7342
|
+
setAgents: (agents, defaultAgent) => set((state) => ({
|
|
7343
|
+
agents,
|
|
7344
|
+
defaultAgent,
|
|
7345
|
+
selectedAgent: state.selectedAgent && agents.some((a) => a.name === state.selectedAgent) ? state.selectedAgent : agents.find((a) => a.name === defaultAgent)?.name ?? agents[0]?.name ?? null
|
|
7346
|
+
})),
|
|
7347
|
+
selectAgent: (agent) => set({ selectedAgent: agent }),
|
|
7348
|
+
backToList: () => set({ selectedAgent: null, editorPage: "overview" }),
|
|
7349
|
+
openAgentInManager: (agent) => set({
|
|
7350
|
+
isManagerOpen: true,
|
|
7351
|
+
isExpanded: true,
|
|
7352
|
+
managerMode: "workspace",
|
|
7353
|
+
selectedAgent: agent,
|
|
7354
|
+
editorPage: "overview",
|
|
7355
|
+
isCreateModalOpen: false
|
|
7356
|
+
}),
|
|
7357
|
+
setEditorPage: (page) => set({ editorPage: page }),
|
|
7358
|
+
openCreateModal: () => set({ isManagerOpen: true, isExpanded: true, isCreateModalOpen: true }),
|
|
7359
|
+
closeCreateModal: () => set({ isCreateModalOpen: false })
|
|
7360
|
+
}));
|
|
7361
|
+
|
|
7362
|
+
// src/hooks/useAgents.ts
|
|
7363
|
+
function useAgentDetails(options = {}) {
|
|
7364
|
+
const managerOpen = useAgentsStore((s) => s.isManagerOpen);
|
|
7365
|
+
const createOpen = useAgentsStore((s) => s.isCreateModalOpen);
|
|
7366
|
+
const enabled = options.enabled ?? (managerOpen || createOpen);
|
|
7367
|
+
const setAgents = useAgentsStore((s) => s.setAgents);
|
|
7368
|
+
const selectedAgent = useAgentsStore((s) => s.selectedAgent);
|
|
7369
|
+
const selectAgent = useAgentsStore((s) => s.selectAgent);
|
|
7370
|
+
const query = useQuery14({
|
|
7371
|
+
queryKey: ["config", "agents"],
|
|
7372
|
+
queryFn: () => apiClient.getAgentDetails(),
|
|
7373
|
+
enabled,
|
|
7374
|
+
staleTime: 15000
|
|
7375
|
+
});
|
|
7376
|
+
useEffect18(() => {
|
|
7377
|
+
if (!query.data)
|
|
7378
|
+
return;
|
|
7379
|
+
setAgents(query.data.agents, query.data.default);
|
|
7380
|
+
if (!selectedAgent && query.data.agents.length > 0) {
|
|
7381
|
+
const defaultAgent = query.data.agents.find((agent) => agent.name === query.data.default);
|
|
7382
|
+
selectAgent(defaultAgent?.name ?? query.data.agents[0].name);
|
|
7383
|
+
}
|
|
7384
|
+
}, [query.data, selectAgent, selectedAgent, setAgents]);
|
|
7385
|
+
return query;
|
|
7386
|
+
}
|
|
7387
|
+
function useAgent(agentName) {
|
|
7388
|
+
return useQuery14({
|
|
7389
|
+
queryKey: ["config", "agents", agentName],
|
|
7390
|
+
queryFn: async () => {
|
|
7391
|
+
if (!agentName)
|
|
7392
|
+
return null;
|
|
7393
|
+
return apiClient.getAgent(agentName);
|
|
7394
|
+
},
|
|
7395
|
+
enabled: Boolean(agentName),
|
|
7396
|
+
staleTime: 15000
|
|
7397
|
+
});
|
|
7398
|
+
}
|
|
7399
|
+
function useConfigTools(options = {}) {
|
|
7400
|
+
const managerOpen = useAgentsStore((s) => s.isManagerOpen);
|
|
7401
|
+
const createOpen = useAgentsStore((s) => s.isCreateModalOpen);
|
|
7402
|
+
const enabled = options.enabled ?? (managerOpen || createOpen);
|
|
7403
|
+
return useQuery14({
|
|
7404
|
+
queryKey: ["config", "tools"],
|
|
7405
|
+
queryFn: () => apiClient.getConfigTools(),
|
|
7406
|
+
enabled,
|
|
7407
|
+
staleTime: 30000
|
|
7408
|
+
});
|
|
7409
|
+
}
|
|
7410
|
+
function useUpdateAgent() {
|
|
7411
|
+
const queryClient = useQueryClient13();
|
|
7412
|
+
return useMutation10({
|
|
7413
|
+
mutationFn: ({ name, input }) => apiClient.updateAgent(name, input),
|
|
7414
|
+
onSuccess: (data, variables) => {
|
|
7415
|
+
queryClient.setQueryData(["config", "agents", variables.name], data);
|
|
7416
|
+
queryClient.invalidateQueries({ queryKey: ["config", "agents"] });
|
|
7417
|
+
}
|
|
7418
|
+
});
|
|
7419
|
+
}
|
|
7420
|
+
function useDeleteAgent() {
|
|
7421
|
+
const queryClient = useQueryClient13();
|
|
7422
|
+
const setAgents = useAgentsStore((s) => s.setAgents);
|
|
7423
|
+
const selectAgent = useAgentsStore((s) => s.selectAgent);
|
|
7424
|
+
return useMutation10({
|
|
7425
|
+
mutationFn: ({
|
|
7426
|
+
name,
|
|
7427
|
+
scope = "local"
|
|
7428
|
+
}) => apiClient.deleteAgent(name, scope),
|
|
7429
|
+
onSuccess: async (_data, variables) => {
|
|
7430
|
+
await queryClient.invalidateQueries({ queryKey: ["config", "agents"] });
|
|
7431
|
+
const refreshed = await queryClient.fetchQuery({
|
|
7432
|
+
queryKey: ["config", "agents"],
|
|
7433
|
+
queryFn: () => apiClient.getAgentDetails()
|
|
7434
|
+
});
|
|
7435
|
+
setAgents(refreshed.agents, refreshed.default);
|
|
7436
|
+
if (variables.name === useAgentsStore.getState().selectedAgent) {
|
|
7437
|
+
const next = refreshed.agents.find((a) => a.name === refreshed.default)?.name ?? refreshed.agents[0]?.name ?? null;
|
|
7438
|
+
selectAgent(next);
|
|
7439
|
+
}
|
|
7440
|
+
}
|
|
7441
|
+
});
|
|
7442
|
+
}
|
|
7443
|
+
function useSetDefaultAgent() {
|
|
7444
|
+
const queryClient = useQueryClient13();
|
|
7445
|
+
return useMutation10({
|
|
7446
|
+
mutationFn: (name) => apiClient.updateDefaults({ agent: name, scope: "global" }),
|
|
7447
|
+
onSuccess: () => {
|
|
7448
|
+
queryClient.invalidateQueries({ queryKey: ["config", "agents"] });
|
|
7449
|
+
queryClient.invalidateQueries({ queryKey: ["config"] });
|
|
7450
|
+
}
|
|
7451
|
+
});
|
|
7452
|
+
}
|
|
7453
|
+
function getAgentToolCount(agent) {
|
|
7454
|
+
if (!agent)
|
|
7455
|
+
return 0;
|
|
7456
|
+
return Array.from(new Set([
|
|
7457
|
+
...agent.toolConfig.firstClass ?? [],
|
|
7458
|
+
...agent.toolConfig.loadable ?? []
|
|
7459
|
+
])).length;
|
|
7460
|
+
}
|
|
7251
7461
|
// src/hooks/useContainerWidth.ts
|
|
7252
|
-
import { useEffect as
|
|
7462
|
+
import { useEffect as useEffect19, useState as useState6 } from "react";
|
|
7253
7463
|
function useContainerWidth(ref) {
|
|
7254
7464
|
const [width, setWidth] = useState6(0);
|
|
7255
|
-
|
|
7465
|
+
useEffect19(() => {
|
|
7256
7466
|
const el = ref.current;
|
|
7257
7467
|
if (!el)
|
|
7258
7468
|
return;
|
|
@@ -7265,7 +7475,7 @@ function useContainerWidth(ref) {
|
|
|
7265
7475
|
return width;
|
|
7266
7476
|
}
|
|
7267
7477
|
// src/hooks/useVoiceInput.ts
|
|
7268
|
-
import { useCallback as useCallback12, useEffect as
|
|
7478
|
+
import { useCallback as useCallback12, useEffect as useEffect20, useRef as useRef9, useState as useState7 } from "react";
|
|
7269
7479
|
var TARGET_SAMPLE_RATE = 16000;
|
|
7270
7480
|
var PCM_FRAME_BYTES = 3200;
|
|
7271
7481
|
function getAudioContextConstructor() {
|
|
@@ -7337,7 +7547,7 @@ function useVoiceInput({
|
|
|
7337
7547
|
const onTranscriptRef = useRef9(onTranscript);
|
|
7338
7548
|
const onErrorRef = useRef9(onError);
|
|
7339
7549
|
const onNeedsInstallRef = useRef9(onNeedsInstall);
|
|
7340
|
-
|
|
7550
|
+
useEffect20(() => {
|
|
7341
7551
|
onTranscriptRef.current = onTranscript;
|
|
7342
7552
|
onErrorRef.current = onError;
|
|
7343
7553
|
onNeedsInstallRef.current = onNeedsInstall;
|
|
@@ -7548,7 +7758,7 @@ function useVoiceInput({
|
|
|
7548
7758
|
isSupported,
|
|
7549
7759
|
lang
|
|
7550
7760
|
]);
|
|
7551
|
-
|
|
7761
|
+
useEffect20(() => cleanup, [cleanup]);
|
|
7552
7762
|
return {
|
|
7553
7763
|
isListening,
|
|
7554
7764
|
isTranscribing,
|
|
@@ -7560,8 +7770,8 @@ function useVoiceInput({
|
|
|
7560
7770
|
};
|
|
7561
7771
|
}
|
|
7562
7772
|
// src/hooks/useDictationModels.ts
|
|
7563
|
-
import { useCallback as useCallback13, useEffect as
|
|
7564
|
-
import { useMutation as
|
|
7773
|
+
import { useCallback as useCallback13, useEffect as useEffect21, useRef as useRef10, useState as useState8 } from "react";
|
|
7774
|
+
import { useMutation as useMutation11, useQuery as useQuery15, useQueryClient as useQueryClient14 } from "@tanstack/react-query";
|
|
7565
7775
|
var DICTATION_STATUS_QUERY_KEY = ["dictation", "status"];
|
|
7566
7776
|
function mergeModelState(current, model) {
|
|
7567
7777
|
if (!current)
|
|
@@ -7582,12 +7792,12 @@ function parseInstallEvent(raw) {
|
|
|
7582
7792
|
}
|
|
7583
7793
|
}
|
|
7584
7794
|
function useDictationModels() {
|
|
7585
|
-
const queryClient =
|
|
7795
|
+
const queryClient = useQueryClient14();
|
|
7586
7796
|
const eventSourceRef = useRef10(null);
|
|
7587
7797
|
const [activeInstallModelId, setActiveInstallModelId] = useState8(null);
|
|
7588
7798
|
const [installProgress, setInstallProgress] = useState8(null);
|
|
7589
7799
|
const [installStreamError, setInstallStreamError] = useState8(null);
|
|
7590
|
-
const statusQuery =
|
|
7800
|
+
const statusQuery = useQuery15({
|
|
7591
7801
|
queryKey: DICTATION_STATUS_QUERY_KEY,
|
|
7592
7802
|
queryFn: () => apiClient.getDictationStatus(),
|
|
7593
7803
|
refetchInterval: (query) => query.state.data?.models.some((model) => model.installing) ? 1000 : 30000
|
|
@@ -7629,8 +7839,8 @@ function useDictationModels() {
|
|
|
7629
7839
|
});
|
|
7630
7840
|
};
|
|
7631
7841
|
}, [closeInstallStream, queryClient]);
|
|
7632
|
-
|
|
7633
|
-
const installMutation =
|
|
7842
|
+
useEffect21(() => closeInstallStream, [closeInstallStream]);
|
|
7843
|
+
const installMutation = useMutation11({
|
|
7634
7844
|
mutationFn: (input) => apiClient.installDictationModel(input),
|
|
7635
7845
|
onSuccess: (data) => {
|
|
7636
7846
|
setInstallProgress(data.model);
|
|
@@ -7646,7 +7856,7 @@ function useDictationModels() {
|
|
|
7646
7856
|
}
|
|
7647
7857
|
}
|
|
7648
7858
|
});
|
|
7649
|
-
const removeMutation =
|
|
7859
|
+
const removeMutation = useMutation11({
|
|
7650
7860
|
mutationFn: (model) => apiClient.removeDictationModel(model),
|
|
7651
7861
|
onSuccess: (data) => {
|
|
7652
7862
|
queryClient.setQueryData(DICTATION_STATUS_QUERY_KEY, (current) => mergeModelState(current, data.model));
|
|
@@ -7680,6 +7890,7 @@ export {
|
|
|
7680
7890
|
useUpdateSkillsConfig,
|
|
7681
7891
|
useUpdateSession,
|
|
7682
7892
|
useUpdateDefaults,
|
|
7893
|
+
useUpdateAgent,
|
|
7683
7894
|
useUnstageFiles,
|
|
7684
7895
|
useTunnelStream,
|
|
7685
7896
|
useTunnelStatus,
|
|
@@ -7698,6 +7909,7 @@ export {
|
|
|
7698
7909
|
useSkillDetail,
|
|
7699
7910
|
useShareStatus,
|
|
7700
7911
|
useSetSessionPinned,
|
|
7912
|
+
useSetDefaultAgent,
|
|
7701
7913
|
useSessionsInfinite,
|
|
7702
7914
|
useSessions,
|
|
7703
7915
|
useSessionStream,
|
|
@@ -7744,12 +7956,14 @@ export {
|
|
|
7744
7956
|
useDeleteSession,
|
|
7745
7957
|
useDeleteResearchSession,
|
|
7746
7958
|
useDeleteFiles,
|
|
7959
|
+
useDeleteAgent,
|
|
7747
7960
|
useCreateSession,
|
|
7748
7961
|
useCreateResearchSession,
|
|
7749
7962
|
useCreateGitBranch,
|
|
7750
7963
|
useCreateBranch,
|
|
7751
7964
|
useCopilotDevicePoller,
|
|
7752
7965
|
useContainerWidth,
|
|
7966
|
+
useConfigTools,
|
|
7753
7967
|
useConfig,
|
|
7754
7968
|
useCommitChanges,
|
|
7755
7969
|
useClientEvents,
|
|
@@ -7758,11 +7972,14 @@ export {
|
|
|
7758
7972
|
useAuthenticateMCPServer,
|
|
7759
7973
|
useAuthStatus,
|
|
7760
7974
|
useAllModels,
|
|
7975
|
+
useAgentDetails,
|
|
7976
|
+
useAgent,
|
|
7761
7977
|
useAddRemote,
|
|
7762
7978
|
useAddMCPServer,
|
|
7763
7979
|
sessionsQueryKey,
|
|
7764
7980
|
optimisticallyQueueMessage,
|
|
7765
|
-
normalizeQueueState
|
|
7981
|
+
normalizeQueueState,
|
|
7982
|
+
getAgentToolCount
|
|
7766
7983
|
};
|
|
7767
7984
|
|
|
7768
|
-
//# debugId=
|
|
7985
|
+
//# debugId=B5B999D9CC12251A64756E2164756E21
|