@ottocode/web-sdk 0.1.305 → 0.1.306
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/agentConstants.d.ts.map +1 -1
- package/dist/components/chat/ChatInputContainer.d.ts.map +1 -1
- package/dist/components/chat/NewSessionLanding.d.ts.map +1 -1
- package/dist/components/index.js +3915 -3653
- package/dist/components/index.js.map +11 -8
- package/dist/components/messages/renderers/McpManagerRenderer.d.ts +3 -0
- package/dist/components/messages/renderers/McpManagerRenderer.d.ts.map +1 -0
- package/dist/components/messages/renderers/index.d.ts.map +1 -1
- package/dist/components/ui/ResizeHandle.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +182 -40
- package/dist/hooks/index.js.map +5 -3
- package/dist/hooks/useChatComposer.d.ts +55 -0
- package/dist/hooks/useChatComposer.d.ts.map +1 -0
- package/dist/hooks/useConfigModalControls.d.ts +15 -0
- package/dist/hooks/useConfigModalControls.d.ts.map +1 -0
- package/dist/index.js +3955 -3691
- package/dist/index.js.map +11 -8
- package/package.json +3 -3
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { GenericRendererProps } from './types';
|
|
2
|
+
export declare function McpManagerRenderer({ contentJson, toolDurationMs, isExpanded, onToggle, compact, }: GenericRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=McpManagerRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"McpManagerRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/renderers/McpManagerRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAuHpD,wBAAgB,kBAAkB,CAAC,EAClC,WAAW,EACX,cAAc,EACd,UAAU,EACV,QAAQ,EACR,OAAO,GACP,EAAE,oBAAoB,2CAuGtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/renderers/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/renderers/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA6B3C,UAAU,uBAAuB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAgED,wBAAgB,kBAAkB,CAAC,EAClC,QAAQ,EACR,WAAW,EACX,cAAc,EACd,KAAK,EACL,mBAAmB,EACnB,OAAO,EACP,SAAS,EACT,OAAO,EACP,SAAS,GACT,EAAE,uBAAuB,2CAqGzB;AAED,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResizeHandle.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ResizeHandle.tsx"],"names":[],"mappings":"AAGA,UAAU,iBAAiB;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"ResizeHandle.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ResizeHandle.tsx"],"names":[],"mappings":"AAGA,UAAU,iBAAiB;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,YAAY,yDA4DvB,CAAC"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export * from './useFileBrowser';
|
|
|
27
27
|
export * from './useMCP';
|
|
28
28
|
export * from './useSkills';
|
|
29
29
|
export * from './useAgents';
|
|
30
|
+
export * from './useChatComposer';
|
|
31
|
+
export * from './useConfigModalControls';
|
|
30
32
|
export * from './useContainerWidth';
|
|
31
33
|
export * from './useVoiceInput';
|
|
32
34
|
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,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,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -7522,11 +7522,151 @@ function getAgentToolCount(agent) {
|
|
|
7522
7522
|
...agent.toolConfig.loadable ?? []
|
|
7523
7523
|
])).length;
|
|
7524
7524
|
}
|
|
7525
|
+
// src/hooks/useChatComposer.ts
|
|
7526
|
+
import { useCallback as useCallback12, useEffect as useEffect19, useMemo as useMemo4, useRef as useRef9, useState as useState6 } from "react";
|
|
7527
|
+
function useChatComposer({
|
|
7528
|
+
sessionId,
|
|
7529
|
+
defaultAgent
|
|
7530
|
+
} = {}) {
|
|
7531
|
+
const { data: config2 } = useConfig();
|
|
7532
|
+
const { data: allModels } = useAllModels();
|
|
7533
|
+
const { data: agentDetails } = useAgentDetails({ enabled: true });
|
|
7534
|
+
const session = useSession(sessionId ?? "");
|
|
7535
|
+
const updateSession = useUpdateSession(sessionId ?? "");
|
|
7536
|
+
const [agent, setAgent] = useState6("");
|
|
7537
|
+
const [provider, setProvider] = useState6("");
|
|
7538
|
+
const [model, setModel] = useState6("");
|
|
7539
|
+
const initializedRef = useRef9(false);
|
|
7540
|
+
useEffect19(() => {
|
|
7541
|
+
if (!sessionId || !session)
|
|
7542
|
+
return;
|
|
7543
|
+
setAgent(session.agent);
|
|
7544
|
+
setProvider(session.provider);
|
|
7545
|
+
setModel(session.model);
|
|
7546
|
+
}, [sessionId, session]);
|
|
7547
|
+
useEffect19(() => {
|
|
7548
|
+
if (sessionId || initializedRef.current)
|
|
7549
|
+
return;
|
|
7550
|
+
if (!config2?.defaults || !agentDetails?.agents.length)
|
|
7551
|
+
return;
|
|
7552
|
+
initializedRef.current = true;
|
|
7553
|
+
const initialAgent = defaultAgent || config2.defaults.agent || "general";
|
|
7554
|
+
const selectedAgent = agentDetails.agents.find((agentDetail) => agentDetail.name === initialAgent);
|
|
7555
|
+
setAgent(initialAgent);
|
|
7556
|
+
setProvider(selectedAgent?.provider ?? config2.defaults.provider ?? "");
|
|
7557
|
+
setModel(selectedAgent?.model ?? config2.defaults.model ?? "");
|
|
7558
|
+
}, [sessionId, agentDetails?.agents, config2, defaultAgent]);
|
|
7559
|
+
const agentNames = useMemo4(() => agentDetails?.agents.length ? agentDetails.agents.map((agentDetail) => agentDetail.name) : config2?.agents ?? [], [agentDetails?.agents, config2?.agents]);
|
|
7560
|
+
const selectedModel = useMemo4(() => allModels?.[provider]?.models?.find((m) => m.id === model), [allModels, provider, model]);
|
|
7561
|
+
const persist2 = useCallback12(async (update) => {
|
|
7562
|
+
if (!sessionId)
|
|
7563
|
+
return;
|
|
7564
|
+
try {
|
|
7565
|
+
await updateSession.mutateAsync(update);
|
|
7566
|
+
} catch (error) {
|
|
7567
|
+
console.error("Failed to update session:", error);
|
|
7568
|
+
}
|
|
7569
|
+
}, [sessionId, updateSession]);
|
|
7570
|
+
const handleAgentChange = useCallback12(async (value) => {
|
|
7571
|
+
setAgent(value);
|
|
7572
|
+
const selectedAgent = agentDetails?.agents.find((agentDetail) => agentDetail.name === value);
|
|
7573
|
+
if (!selectedAgent) {
|
|
7574
|
+
await persist2({ agent: value });
|
|
7575
|
+
return;
|
|
7576
|
+
}
|
|
7577
|
+
const nextProvider = selectedAgent.provider ?? config2?.defaults?.provider ?? provider;
|
|
7578
|
+
const nextModel = selectedAgent.model ?? config2?.defaults?.model ?? model;
|
|
7579
|
+
setProvider(nextProvider);
|
|
7580
|
+
setModel(nextModel);
|
|
7581
|
+
await persist2({
|
|
7582
|
+
agent: value,
|
|
7583
|
+
provider: nextProvider,
|
|
7584
|
+
model: nextModel
|
|
7585
|
+
});
|
|
7586
|
+
}, [
|
|
7587
|
+
agentDetails?.agents,
|
|
7588
|
+
config2?.defaults?.model,
|
|
7589
|
+
config2?.defaults?.provider,
|
|
7590
|
+
model,
|
|
7591
|
+
provider,
|
|
7592
|
+
persist2
|
|
7593
|
+
]);
|
|
7594
|
+
const handlePlanModeToggle = useCallback12(async (isPlanMode) => {
|
|
7595
|
+
await handleAgentChange(isPlanMode ? "plan" : "build");
|
|
7596
|
+
}, [handleAgentChange]);
|
|
7597
|
+
const handleModelSelectorChange = useCallback12(async (newProvider, newModel) => {
|
|
7598
|
+
setProvider(newProvider);
|
|
7599
|
+
setModel(newModel);
|
|
7600
|
+
await persist2({ provider: newProvider, model: newModel });
|
|
7601
|
+
}, [persist2]);
|
|
7602
|
+
const handleProviderChange = useCallback12(async (newProvider) => {
|
|
7603
|
+
setProvider(newProvider);
|
|
7604
|
+
if (model) {
|
|
7605
|
+
await persist2({ provider: newProvider, model });
|
|
7606
|
+
}
|
|
7607
|
+
}, [model, persist2]);
|
|
7608
|
+
const handleModelChange = useCallback12(async (newModel) => {
|
|
7609
|
+
setModel(newModel);
|
|
7610
|
+
await persist2({ provider, model: newModel });
|
|
7611
|
+
}, [provider, persist2]);
|
|
7612
|
+
return {
|
|
7613
|
+
config: config2,
|
|
7614
|
+
allModels,
|
|
7615
|
+
agent,
|
|
7616
|
+
provider,
|
|
7617
|
+
model,
|
|
7618
|
+
agentNames,
|
|
7619
|
+
isPlanMode: agent === "plan",
|
|
7620
|
+
modelSupportsReasoning: selectedModel?.reasoningText,
|
|
7621
|
+
modelSupportsVision: selectedModel?.vision,
|
|
7622
|
+
modelSupportsAttachment: selectedModel?.attachment,
|
|
7623
|
+
modelIsFree: selectedModel?.free,
|
|
7624
|
+
providerAuthType: allModels?.[provider]?.authType,
|
|
7625
|
+
isCustomProvider: allModels?.[provider]?.label?.includes("(custom)") ?? false,
|
|
7626
|
+
handleAgentChange,
|
|
7627
|
+
handlePlanModeToggle,
|
|
7628
|
+
handleProviderChange,
|
|
7629
|
+
handleModelChange,
|
|
7630
|
+
handleModelSelectorChange
|
|
7631
|
+
};
|
|
7632
|
+
}
|
|
7633
|
+
// src/hooks/useConfigModalControls.ts
|
|
7634
|
+
import { useCallback as useCallback13, useState as useState7 } from "react";
|
|
7635
|
+
function useConfigModalControls() {
|
|
7636
|
+
const [isConfigOpen, setIsConfigOpen] = useState7(false);
|
|
7637
|
+
const [configFocusTarget, setConfigFocusTarget] = useState7(null);
|
|
7638
|
+
const openConfig = useCallback13((target) => {
|
|
7639
|
+
setConfigFocusTarget(target);
|
|
7640
|
+
setIsConfigOpen(true);
|
|
7641
|
+
}, []);
|
|
7642
|
+
const toggleConfig = useCallback13(() => {
|
|
7643
|
+
setIsConfigOpen((prev) => !prev);
|
|
7644
|
+
}, []);
|
|
7645
|
+
const closeConfig = useCallback13(() => {
|
|
7646
|
+
setIsConfigOpen(false);
|
|
7647
|
+
setConfigFocusTarget(null);
|
|
7648
|
+
}, []);
|
|
7649
|
+
const openModelConfig = useCallback13(() => {
|
|
7650
|
+
openConfig("model");
|
|
7651
|
+
}, [openConfig]);
|
|
7652
|
+
const openAgentConfig = useCallback13(() => {
|
|
7653
|
+
openConfig("agent");
|
|
7654
|
+
}, [openConfig]);
|
|
7655
|
+
return {
|
|
7656
|
+
isConfigOpen,
|
|
7657
|
+
configFocusTarget,
|
|
7658
|
+
openConfig,
|
|
7659
|
+
toggleConfig,
|
|
7660
|
+
closeConfig,
|
|
7661
|
+
openModelConfig,
|
|
7662
|
+
openAgentConfig
|
|
7663
|
+
};
|
|
7664
|
+
}
|
|
7525
7665
|
// src/hooks/useContainerWidth.ts
|
|
7526
|
-
import { useEffect as
|
|
7666
|
+
import { useEffect as useEffect20, useState as useState8 } from "react";
|
|
7527
7667
|
function useContainerWidth(ref) {
|
|
7528
|
-
const [width, setWidth] =
|
|
7529
|
-
|
|
7668
|
+
const [width, setWidth] = useState8(0);
|
|
7669
|
+
useEffect20(() => {
|
|
7530
7670
|
const el = ref.current;
|
|
7531
7671
|
if (!el)
|
|
7532
7672
|
return;
|
|
@@ -7539,7 +7679,7 @@ function useContainerWidth(ref) {
|
|
|
7539
7679
|
return width;
|
|
7540
7680
|
}
|
|
7541
7681
|
// src/hooks/useVoiceInput.ts
|
|
7542
|
-
import { useCallback as
|
|
7682
|
+
import { useCallback as useCallback14, useEffect as useEffect21, useRef as useRef10, useState as useState9 } from "react";
|
|
7543
7683
|
var TARGET_SAMPLE_RATE = 16000;
|
|
7544
7684
|
var PCM_FRAME_BYTES = 3200;
|
|
7545
7685
|
function getAudioContextConstructor() {
|
|
@@ -7596,39 +7736,39 @@ function useVoiceInput({
|
|
|
7596
7736
|
onNeedsInstall,
|
|
7597
7737
|
lang = "en-US"
|
|
7598
7738
|
} = {}) {
|
|
7599
|
-
const [isListening, setIsListening] =
|
|
7600
|
-
const [isTranscribing, setIsTranscribing] =
|
|
7601
|
-
const [analyser, setAnalyser] =
|
|
7602
|
-
const [error, setError] =
|
|
7603
|
-
const streamRef =
|
|
7604
|
-
const audioContextRef =
|
|
7605
|
-
const processorRef =
|
|
7606
|
-
const sourceRef =
|
|
7607
|
-
const socketRef =
|
|
7608
|
-
const frameBufferRef =
|
|
7609
|
-
const stoppingRef =
|
|
7610
|
-
const sessionIdRef =
|
|
7611
|
-
const onTranscriptRef =
|
|
7612
|
-
const onErrorRef =
|
|
7613
|
-
const onNeedsInstallRef =
|
|
7614
|
-
|
|
7739
|
+
const [isListening, setIsListening] = useState9(false);
|
|
7740
|
+
const [isTranscribing, setIsTranscribing] = useState9(false);
|
|
7741
|
+
const [analyser, setAnalyser] = useState9(null);
|
|
7742
|
+
const [error, setError] = useState9(null);
|
|
7743
|
+
const streamRef = useRef10(null);
|
|
7744
|
+
const audioContextRef = useRef10(null);
|
|
7745
|
+
const processorRef = useRef10(null);
|
|
7746
|
+
const sourceRef = useRef10(null);
|
|
7747
|
+
const socketRef = useRef10(null);
|
|
7748
|
+
const frameBufferRef = useRef10(new Uint8Array(0));
|
|
7749
|
+
const stoppingRef = useRef10(false);
|
|
7750
|
+
const sessionIdRef = useRef10(null);
|
|
7751
|
+
const onTranscriptRef = useRef10(onTranscript);
|
|
7752
|
+
const onErrorRef = useRef10(onError);
|
|
7753
|
+
const onNeedsInstallRef = useRef10(onNeedsInstall);
|
|
7754
|
+
useEffect21(() => {
|
|
7615
7755
|
onTranscriptRef.current = onTranscript;
|
|
7616
7756
|
onErrorRef.current = onError;
|
|
7617
7757
|
onNeedsInstallRef.current = onNeedsInstall;
|
|
7618
7758
|
}, [onTranscript, onError, onNeedsInstall]);
|
|
7619
7759
|
const isSupported = typeof window !== "undefined" && !!navigator.mediaDevices?.getUserMedia && !!getAudioContextConstructor() && typeof WebSocket !== "undefined";
|
|
7620
|
-
const emitError =
|
|
7760
|
+
const emitError = useCallback14((message) => {
|
|
7621
7761
|
setError(message);
|
|
7622
7762
|
onErrorRef.current?.(message);
|
|
7623
7763
|
}, []);
|
|
7624
|
-
const handleMissingModel =
|
|
7764
|
+
const handleMissingModel = useCallback14(() => {
|
|
7625
7765
|
if (onNeedsInstallRef.current) {
|
|
7626
7766
|
onNeedsInstallRef.current();
|
|
7627
7767
|
return;
|
|
7628
7768
|
}
|
|
7629
7769
|
emitError("Install a local dictation model from Settings before recording.");
|
|
7630
7770
|
}, [emitError]);
|
|
7631
|
-
const cleanupAudio =
|
|
7771
|
+
const cleanupAudio = useCallback14(() => {
|
|
7632
7772
|
if (processorRef.current) {
|
|
7633
7773
|
processorRef.current.onaudioprocess = null;
|
|
7634
7774
|
processorRef.current.disconnect();
|
|
@@ -7650,7 +7790,7 @@ function useVoiceInput({
|
|
|
7650
7790
|
frameBufferRef.current = new Uint8Array(0);
|
|
7651
7791
|
setAnalyser(null);
|
|
7652
7792
|
}, []);
|
|
7653
|
-
const cleanup =
|
|
7793
|
+
const cleanup = useCallback14(() => {
|
|
7654
7794
|
cleanupAudio();
|
|
7655
7795
|
if (socketRef.current) {
|
|
7656
7796
|
const socket = socketRef.current;
|
|
@@ -7668,7 +7808,7 @@ function useVoiceInput({
|
|
|
7668
7808
|
setIsListening(false);
|
|
7669
7809
|
setIsTranscribing(false);
|
|
7670
7810
|
}, [cleanupAudio]);
|
|
7671
|
-
const flushFrameBuffer =
|
|
7811
|
+
const flushFrameBuffer = useCallback14((force = false) => {
|
|
7672
7812
|
const socket = socketRef.current;
|
|
7673
7813
|
if (!socket || socket.readyState !== WebSocket.OPEN)
|
|
7674
7814
|
return;
|
|
@@ -7684,7 +7824,7 @@ function useVoiceInput({
|
|
|
7684
7824
|
}
|
|
7685
7825
|
frameBufferRef.current = buffer;
|
|
7686
7826
|
}, []);
|
|
7687
|
-
const handleAudioProcess =
|
|
7827
|
+
const handleAudioProcess = useCallback14((event) => {
|
|
7688
7828
|
const audioContext = audioContextRef.current;
|
|
7689
7829
|
const socket = socketRef.current;
|
|
7690
7830
|
if (!audioContext || !socket || socket.readyState !== WebSocket.OPEN || stoppingRef.current) {
|
|
@@ -7695,7 +7835,7 @@ function useVoiceInput({
|
|
|
7695
7835
|
frameBufferRef.current = appendBuffer(frameBufferRef.current, new Uint8Array(floatToPcm16(resampled)));
|
|
7696
7836
|
flushFrameBuffer(false);
|
|
7697
7837
|
}, [flushFrameBuffer]);
|
|
7698
|
-
const stop =
|
|
7838
|
+
const stop = useCallback14(() => {
|
|
7699
7839
|
stoppingRef.current = true;
|
|
7700
7840
|
flushFrameBuffer(true);
|
|
7701
7841
|
cleanupAudio();
|
|
@@ -7709,7 +7849,7 @@ function useVoiceInput({
|
|
|
7709
7849
|
setIsTranscribing(false);
|
|
7710
7850
|
}
|
|
7711
7851
|
}, [cleanupAudio, flushFrameBuffer]);
|
|
7712
|
-
const start =
|
|
7852
|
+
const start = useCallback14(async () => {
|
|
7713
7853
|
if (!isSupported) {
|
|
7714
7854
|
emitError("Voice input is not supported in this browser");
|
|
7715
7855
|
return;
|
|
@@ -7822,7 +7962,7 @@ function useVoiceInput({
|
|
|
7822
7962
|
isSupported,
|
|
7823
7963
|
lang
|
|
7824
7964
|
]);
|
|
7825
|
-
|
|
7965
|
+
useEffect21(() => cleanup, [cleanup]);
|
|
7826
7966
|
return {
|
|
7827
7967
|
isListening,
|
|
7828
7968
|
isTranscribing,
|
|
@@ -7834,7 +7974,7 @@ function useVoiceInput({
|
|
|
7834
7974
|
};
|
|
7835
7975
|
}
|
|
7836
7976
|
// src/hooks/useDictationModels.ts
|
|
7837
|
-
import { useCallback as
|
|
7977
|
+
import { useCallback as useCallback15, useEffect as useEffect22, useRef as useRef11, useState as useState10 } from "react";
|
|
7838
7978
|
import { useMutation as useMutation11, useQuery as useQuery15, useQueryClient as useQueryClient14 } from "@tanstack/react-query";
|
|
7839
7979
|
var DICTATION_STATUS_QUERY_KEY = ["dictation", "status"];
|
|
7840
7980
|
function mergeModelState(current, model) {
|
|
@@ -7857,22 +7997,22 @@ function parseInstallEvent(raw) {
|
|
|
7857
7997
|
}
|
|
7858
7998
|
function useDictationModels() {
|
|
7859
7999
|
const queryClient = useQueryClient14();
|
|
7860
|
-
const eventSourceRef =
|
|
7861
|
-
const [activeInstallModelId, setActiveInstallModelId] =
|
|
7862
|
-
const [installProgress, setInstallProgress] =
|
|
7863
|
-
const [installStreamError, setInstallStreamError] =
|
|
8000
|
+
const eventSourceRef = useRef11(null);
|
|
8001
|
+
const [activeInstallModelId, setActiveInstallModelId] = useState10(null);
|
|
8002
|
+
const [installProgress, setInstallProgress] = useState10(null);
|
|
8003
|
+
const [installStreamError, setInstallStreamError] = useState10(null);
|
|
7864
8004
|
const statusQuery = useQuery15({
|
|
7865
8005
|
queryKey: DICTATION_STATUS_QUERY_KEY,
|
|
7866
8006
|
queryFn: () => apiClient.getDictationStatus(),
|
|
7867
8007
|
refetchInterval: (query) => query.state.data?.models.some((model) => model.installing) ? 1000 : 30000
|
|
7868
8008
|
});
|
|
7869
|
-
const closeInstallStream =
|
|
8009
|
+
const closeInstallStream = useCallback15(() => {
|
|
7870
8010
|
if (eventSourceRef.current) {
|
|
7871
8011
|
eventSourceRef.current.close();
|
|
7872
8012
|
eventSourceRef.current = null;
|
|
7873
8013
|
}
|
|
7874
8014
|
}, []);
|
|
7875
|
-
const openInstallStream =
|
|
8015
|
+
const openInstallStream = useCallback15((modelId) => {
|
|
7876
8016
|
if (typeof EventSource === "undefined")
|
|
7877
8017
|
return;
|
|
7878
8018
|
closeInstallStream();
|
|
@@ -7903,7 +8043,7 @@ function useDictationModels() {
|
|
|
7903
8043
|
});
|
|
7904
8044
|
};
|
|
7905
8045
|
}, [closeInstallStream, queryClient]);
|
|
7906
|
-
|
|
8046
|
+
useEffect22(() => closeInstallStream, [closeInstallStream]);
|
|
7907
8047
|
const installMutation = useMutation11({
|
|
7908
8048
|
mutationFn: (input) => apiClient.installDictationModel(input),
|
|
7909
8049
|
onSuccess: (data) => {
|
|
@@ -7929,8 +8069,8 @@ function useDictationModels() {
|
|
|
7929
8069
|
});
|
|
7930
8070
|
}
|
|
7931
8071
|
});
|
|
7932
|
-
const installModel =
|
|
7933
|
-
const removeModel =
|
|
8072
|
+
const installModel = useCallback15((model, options = {}) => installMutation.mutateAsync({ model, force: options.force }), [installMutation]);
|
|
8073
|
+
const removeModel = useCallback15((model) => removeMutation.mutateAsync(model), [removeMutation]);
|
|
7934
8074
|
return {
|
|
7935
8075
|
statusQuery,
|
|
7936
8076
|
status: statusQuery.data,
|
|
@@ -8028,10 +8168,12 @@ export {
|
|
|
8028
8168
|
useCopilotDevicePoller,
|
|
8029
8169
|
useContainerWidth,
|
|
8030
8170
|
useConfigTools,
|
|
8171
|
+
useConfigModalControls,
|
|
8031
8172
|
useConfig,
|
|
8032
8173
|
useCommitChanges,
|
|
8033
8174
|
useClientEvents,
|
|
8034
8175
|
useCheckoutBranch,
|
|
8176
|
+
useChatComposer,
|
|
8035
8177
|
useBranches,
|
|
8036
8178
|
useAuthenticateMCPServer,
|
|
8037
8179
|
useAuthStatus,
|
|
@@ -8046,4 +8188,4 @@ export {
|
|
|
8046
8188
|
getAgentToolCount
|
|
8047
8189
|
};
|
|
8048
8190
|
|
|
8049
|
-
//# debugId=
|
|
8191
|
+
//# debugId=0386469E53572E8E64756E2164756E21
|